chore: input-table 支持单元格为容器时内部放表单项也参与校验 Close: #9756 (#9757)

This commit is contained in:
liaoxuezhi 2024-03-14 14:06:00 +08:00 committed by GitHub
parent 8aa7d73543
commit 6d4ada1bbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -78,6 +78,7 @@ export interface ControlOutterProps extends RendererProps {
changePristine?: boolean
) => void;
formItemDispatchEvent: (type: string, data: any) => void;
formItemRef?: (control: any) => void;
}
export interface ControlProps {
@ -541,7 +542,12 @@ export function wrapControl<
}
controlRef(control: any) {
const {addHook, removeHook, formStore: form} = this.props;
const {
addHook,
removeHook,
formStore: form,
formItemRef
} = this.props;
// 因为 control 有可能被 n 层 hoc 包裹。
while (control && control.getWrappedInstance) {
@ -570,6 +576,7 @@ export function wrapControl<
this.hook = undefined;
}
formItemRef?.(control);
// 注册到 Scoped 上
const originRef = this.control;
this.control = control;

View File

@ -609,7 +609,7 @@ export const HocQuickEdit =
value: getPropValue(this.props) ?? '',
onChange: this.handleFormItemChange,
onBulkChange: this.handleBulkChange,
ref: this.formItemRef,
formItemRef: this.formItemRef,
defaultStatic: false
});
}
@ -652,7 +652,7 @@ export const HocQuickEdit =
// 此处的readOnly会导致组件值无法传递出去如 value: "${a + b}" 这样的 value 变化需要同步到数据域
// || readOnly
) {
return <Component {...this.props} />;
return <Component {...this.props} formItemRef={this.formItemRef} />;
}
if (