chore: form 下发 onFlushForm 方便自定义组件拿取最新数据 (#10976)

This commit is contained in:
liaoxuezhi 2024-09-27 17:11:25 +08:00 committed by GitHub
parent 4372a8330c
commit 9002363c66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -507,6 +507,7 @@ export default class Form extends React.Component<FormProps, object> {
this.blockRouting = this.blockRouting.bind(this);
this.beforePageUnload = this.beforePageUnload.bind(this);
this.formItemDispatchEvent = this.formItemDispatchEvent.bind(this);
this.flush = this.flush.bind(this);
const {store, canAccessSuperData, persistData, simpleMode, formLazyChange} =
props;
@ -1960,7 +1961,8 @@ export default class Form extends React.Component<FormProps, object> {
removeHook: this.removeHook,
renderFormItems: this.renderFormItems,
formItemDispatchEvent: this.formItemDispatchEvent,
formPristine: form.pristine
formPristine: form.pristine,
onFlushForm: this.flush
// value: (control as any)?.name
// ? getVariable(form.data, (control as any)?.name, canAccessSuperData)
// : (control as any)?.value,

View File

@ -774,7 +774,7 @@ test('Renderer:input-table formula', async () => {
fireEvent.change(dollor!, {target: {value: '22'}});
await wait(400);
await wait(800);
const inputs = container.querySelectorAll('input[name=score]');
expect(inputs.length).toBe(3);