mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
parent
8aa7d73543
commit
6d4ada1bbe
@ -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;
|
||||
|
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user