mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
This commit is contained in:
parent
9a1178d826
commit
cc72fe81e5
@ -154,20 +154,18 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
||||
|
||||
setHotValue(data: any, options?: any) {
|
||||
this.hotValue = data;
|
||||
const v = this.transducer.toNative(data);
|
||||
const value = this.transducer.toNative(data);
|
||||
if (this.isUseVariable()) {
|
||||
const ov = this.getValue();
|
||||
const oldValue = this.getValue();
|
||||
this.setValue({
|
||||
type: 'JSExpression',
|
||||
value: ov.value,
|
||||
mock: v,
|
||||
value: oldValue.value,
|
||||
mock: value,
|
||||
}, false, false, options);
|
||||
} else {
|
||||
this.setValue(v, false, false, options);
|
||||
this.setValue(value, false, false, options);
|
||||
}
|
||||
|
||||
this.notifyValueChange();
|
||||
|
||||
// dirty fix list setter
|
||||
if (Array.isArray(data) && data[0] && data[0].__sid__) {
|
||||
return;
|
||||
|
||||
@ -163,14 +163,13 @@ export class SettingPropEntry implements SettingEntry {
|
||||
* 设置当前属性值
|
||||
*/
|
||||
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: any) {
|
||||
const oldValue = this.getValue();
|
||||
if (this.type === 'field') {
|
||||
this.parent.setPropValue(this.name, val);
|
||||
}
|
||||
if (!extraOptions) {
|
||||
extraOptions = {};
|
||||
}
|
||||
|
||||
const { setValue } = this.extraProps;
|
||||
if (setValue && !extraOptions.disableMutator) {
|
||||
if (setValue && !extraOptions?.disableMutator) {
|
||||
try {
|
||||
setValue(this, val);
|
||||
} catch (e) {
|
||||
@ -178,6 +177,7 @@ export class SettingPropEntry implements SettingEntry {
|
||||
console.warn(e);
|
||||
}
|
||||
}
|
||||
this.notifyValueChange(oldValue, val);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,8 +276,8 @@ export class SettingPropEntry implements SettingEntry {
|
||||
this.emitter.emit('valuechange');
|
||||
}
|
||||
|
||||
notifyValueChange() {
|
||||
this.editor.emit('node.prop.change', { node: this.getNode(), prop: this });
|
||||
notifyValueChange(oldValue: any, newValue:any) {
|
||||
this.editor.emit('node.prop.change', { node: this.getNode(), prop: this, oldValue, newValue });
|
||||
}
|
||||
|
||||
getDefaultValue() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user