fix: grid-layout-form 类型精化——widget 返回 JSX.Element|null,消除 any 类型

This commit is contained in:
2026-09-22 16:17:03 +08:00
parent 1726a18093
commit f9d1b01f18
2 changed files with 11 additions and 10 deletions
+10 -9
View File
@@ -273,14 +273,15 @@ declare function useFieldArray(value: any, onChange: (value: any[]) => void): Us
* @param {boolean} [props.required] 是否必填
* @param {string} [props.placeholder] 输入占位文字,透传给实际控件
* @param {boolean} [props.noStyle] 是否隐藏 FormItem 的 label/border 等样式
* @param {Object} [props.style] FormItem 根节点行内样式
* @param {CSSProperties} [props.style] FormItem 根节点行内样式
* @param {string} [props.help] 字段提示文字(tooltip)
* @param {GridLayoutFormFieldValidators} [props.validators] 校验规则配置,合并到 rc-field-form rules
* @param {Object} [props.extras] 透传给 ItemWidget.$setting 的扩展配置(key 由 defaultProps.extras 定义)
* @param {Record<string, unknown>} [props.extras] 透传给 ItemWidget.$setting 的扩展配置(key 由 defaultProps.extras 定义)
* @param {*} [props.initialValue] 字段初始值
* @param {string} [props.initialValueLanguage] 初始值语言(用于特定类型的取值转换)
* @param {boolean} [props.isVirtual] 虚拟字段,不参与表单提交
* 其余未识别的 props 经 itemWidgetRender 透传到实际控件的 fieldProps 中
* @returns {React.JSX.Element | null}
*/
declare function GridLayoutFormWidget({ widget, widgetPrefix, widgetDecorator, subWidgets, basicForm, ...props }: {
widget?: string;
@@ -294,14 +295,14 @@ declare function GridLayoutFormWidget({ widget, widgetPrefix, widgetDecorator, s
required?: boolean;
placeholder?: string;
noStyle?: boolean;
style?: any;
style?: React.CSSProperties;
help?: string;
validators?: GridLayoutFormFieldValidators;
extras?: any;
extras?: Record<string, unknown>;
initialValue?: any;
initialValueLanguage?: string;
isVirtual?: boolean;
}): undefined;
}): React.JSX.Element | null;
/**
* 弹窗表单容器:包裹 GridLayoutForm 并附带保存/取消操作按钮,保存时校验并提交表单,
@@ -341,10 +342,10 @@ declare function GridLayoutFormHelper({ $setting, $close, extras, code, primaryK
* @param {Record<string, unknown>} [props.formProps={}] 注入为 `__PROPS__` 字段值的表单级参数
* @param {GridLayoutFormItem[]} [props.formFields=[]] 额外注入的表单字段(与 formProps/primaryKey 一并作为初始 fields)
* @param {string[]} [props.listenChangeFields] 触发联动表达式重新求值的字段列表
* @param {*} [props.listenChangeFieldsFunc] 字段值变化时执行的联动表达式(经 func.exec 执行)
* @param {GridLayoutFormWidgetDecorator} [props.listenChangeFieldsFunc] 字段值变化时执行的联动表达式(经 func.exec 执行)
* @param {(changedValues: Object, allValues: Object) => void} [props.onValuesChange] 表单值变化回调,先于联动表达式执行
* @param {string} [props.theme] 主题组件标识,指定时通过 GridLayoutFramework 渲染主题外壳
* @param {Object} [props.themeProps={}] 传给主题组件的额外参数
* @param {Record<string, unknown>} [props.themeProps={}] 传给主题组件的额外参数
* @param {GridLayoutFormGroup[]} [props.groups=[{key:'default',label:'默认'}]] 字段分组配置,用于主题多分组渲染
* @param {ReactNode} [props.children] 附加渲染在字段项之后的内容
*/
@@ -364,10 +365,10 @@ declare function GridLayoutForm({ name, form: initForm, basicForm, style, classN
formProps?: Record<string, unknown>;
formFields?: GridLayoutFormItem[];
listenChangeFields?: string[];
listenChangeFieldsFunc?: any;
listenChangeFieldsFunc?: GridLayoutFormWidgetDecorator;
onValuesChange?: (changedValues: any, allValues: any) => void;
theme?: string;
themeProps?: any;
themeProps?: Record<string, unknown>;
groups?: GridLayoutFormGroup[];
children?: React.ReactNode;
}): React.JSX.Element;