iter(g169): 表单字段支持跨列

This commit is contained in:
HIsheR
2026-10-26 16:16:07 +08:00
parent adc94cabf5
commit bd98fc8e70
7 changed files with 26 additions and 5 deletions
+1
View File
@@ -39,6 +39,7 @@ export function formItem(props: FormItemProps, control: HTMLElement): FormItemHa
const hint = props.hint ? h('div', { class: 'ua-form-hint' }, props.hint) : null; // 辅助说明:报错时隐藏,避免与错误挤在一起
const label = h('label', { class: 'ua-form-label' }, props.label, props.required ? h('i', { class: 'ua-form-req' }, '*') : null);
const el = h('div', { class: 'ua-form-item' }, label, h('div', { class: 'ua-form-control' }, control, hint, error));
if (props.span) el.style.gridColumn = `span ${props.span}`; // 多列布局里跨列;单列容器下由 CSS 还原为整行
let seq = 0; // 校验轮次:异步结论回来时若已有更新的一轮,丢弃旧结果(防乱序覆盖)
/*** 错误态落点:控件根 + 内部原生控件,保证 select / checkbox 这类包裹式控件也能标红 ***/
+1
View File
@@ -400,6 +400,7 @@ export interface FormItemProps {
rules?: FormRule[]; // 附加校验规则,按序执行
validateOn?: 'input' | 'blur' | 'submit'; // 校验时机;缺省 blur
hint?: string; // 控件下方辅助说明(格式提示等);报错时让位给错误文案
span?: number; // 多列表单里本字段占几列(如整宽的多行文本);单列布局下无效
}
/*** 表单字段句柄:form 聚合校验用 ***/