mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 05:48:17 +00:00
Merge branch fix/change-event-for-variable-binding-mr into release/1.0.30
Title: fix: 变量绑定时未触发事件 http://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/issues/100851 Link: https://code.aone.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/codereview/4554521
This commit is contained in:
commit
a2902c2f8e
@ -154,20 +154,18 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
|
|
||||||
setHotValue(data: any, options?: any) {
|
setHotValue(data: any, options?: any) {
|
||||||
this.hotValue = data;
|
this.hotValue = data;
|
||||||
const v = this.transducer.toNative(data);
|
const value = this.transducer.toNative(data);
|
||||||
if (this.isUseVariable()) {
|
if (this.isUseVariable()) {
|
||||||
const ov = this.getValue();
|
const oldValue = this.getValue();
|
||||||
this.setValue({
|
this.setValue({
|
||||||
type: 'JSExpression',
|
type: 'JSExpression',
|
||||||
value: ov.value,
|
value: oldValue.value,
|
||||||
mock: v,
|
mock: value,
|
||||||
}, false, false, options);
|
}, false, false, options);
|
||||||
} else {
|
} else {
|
||||||
this.setValue(v, false, false, options);
|
this.setValue(value, false, false, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.notifyValueChange();
|
|
||||||
|
|
||||||
// dirty fix list setter
|
// dirty fix list setter
|
||||||
if (Array.isArray(data) && data[0] && data[0].__sid__) {
|
if (Array.isArray(data) && data[0] && data[0].__sid__) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -163,14 +163,13 @@ export class SettingPropEntry implements SettingEntry {
|
|||||||
* 设置当前属性值
|
* 设置当前属性值
|
||||||
*/
|
*/
|
||||||
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: any) {
|
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: any) {
|
||||||
|
const oldValue = this.getValue();
|
||||||
if (this.type === 'field') {
|
if (this.type === 'field') {
|
||||||
this.parent.setPropValue(this.name, val);
|
this.parent.setPropValue(this.name, val);
|
||||||
}
|
}
|
||||||
if (!extraOptions) {
|
|
||||||
extraOptions = {};
|
|
||||||
}
|
|
||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue && !extraOptions.disableMutator) {
|
if (setValue && !extraOptions?.disableMutator) {
|
||||||
try {
|
try {
|
||||||
setValue(this, val);
|
setValue(this, val);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -178,6 +177,7 @@ export class SettingPropEntry implements SettingEntry {
|
|||||||
console.warn(e);
|
console.warn(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.notifyValueChange(oldValue, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,8 +276,8 @@ export class SettingPropEntry implements SettingEntry {
|
|||||||
this.emitter.emit('valuechange');
|
this.emitter.emit('valuechange');
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyValueChange() {
|
notifyValueChange(oldValue: any, newValue:any) {
|
||||||
this.editor.emit('node.prop.change', { node: this.getNode(), prop: this });
|
this.editor.emit('node.prop.change', { node: this.getNode(), prop: this, oldValue, newValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultValue() {
|
getDefaultValue() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user