mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
chore: 调整表单项默认值变更逻辑支持值格式是数组的情况
This commit is contained in:
parent
a76e8a7b6d
commit
d4c540e121
@ -128,11 +128,23 @@ export function makeWrapper(
|
||||
}
|
||||
|
||||
@autobind
|
||||
wrapperRef(ref: any) {
|
||||
wrapperRef(raw: any) {
|
||||
let ref = raw;
|
||||
while (ref?.getWrappedInstance) {
|
||||
ref = ref.getWrappedInstance();
|
||||
}
|
||||
|
||||
if (ref && !ref.props) {
|
||||
Object.defineProperty(ref, 'props', {
|
||||
get: () => this.props
|
||||
});
|
||||
} else if (!ref && raw) {
|
||||
ref = {};
|
||||
Object.defineProperty(ref, 'props', {
|
||||
get: () => this.props
|
||||
});
|
||||
}
|
||||
|
||||
if (this.editorNode && isAlive(this.editorNode)) {
|
||||
this.editorNode.setComponent(ref);
|
||||
|
||||
|
@ -222,18 +222,11 @@ export class ItemPlugin extends BasePlugin {
|
||||
context.info.renderer.isFormItem &&
|
||||
context.diff?.some(change => change.path?.join('.') === 'value')
|
||||
) {
|
||||
const change: any = find(
|
||||
context.diff,
|
||||
change => change.path?.join('.') === 'value'
|
||||
)!;
|
||||
const component = this.manager.store
|
||||
.getNodeById(context.id)
|
||||
?.getComponent();
|
||||
|
||||
let value = change?.rhs;
|
||||
let value = context.value.value;
|
||||
const component = context.node?.getComponent();
|
||||
|
||||
if (typeof value === 'string' && isExpression(value)) {
|
||||
const data = event.context.node?.getComponent()?.props.data || {};
|
||||
const data = component?.props.data || {};
|
||||
value = resolveVariableAndFilter(value, data, '| raw');
|
||||
}
|
||||
component?.props.onChange(value);
|
||||
|
Loading…
Reference in New Issue
Block a user