fix prop getValue

This commit is contained in:
kangwei 2020-03-16 20:40:11 +08:00
commit 99d1962748
4 changed files with 16 additions and 16 deletions

View File

@ -74,7 +74,7 @@ export default class Prop implements IPropParent {
if (type === 'list') {
if (!this._items) {
return this._items;
return this._value;
}
return this.items!.map(prop => {
const v = prop.export(serialize);
@ -172,8 +172,12 @@ export default class Prop implements IPropParent {
this.dispose();
}
getValue(serialize = true) {
// todo:
@computed getValue(): CompositeValue {
const v = this.export(true);
if (v === UNSET) {
return null;
}
return v;
}
private dispose() {

View File

@ -31,12 +31,14 @@ export default class EventsSetter extends Component<{
selectType: null,
nativeEventList: [],
lifeCycleEventList: [],
eventDataList: [],
eventDataList: this.props.value || [],
isShowEventDialog: false,
bindEventName: '',
relatedEventName: '',
};
// TODO: getDerivedStateFromProps recieve eventDataList from prop.value
componentWillMount() {
this.initEventBtns();
this.initEventList();
@ -239,10 +241,7 @@ export default class EventsSetter extends Component<{
}
});
this.props.onChange(eventDataList);
// field.setValue(eventDataList);
this.closeDialog();
};

View File

@ -455,7 +455,7 @@ export class SettingsMain implements SettingTarget {
if (this.nodes.length < 1) {
return null;
}
return this.nodes[0].getProp(propName, false)?.value;
return this.nodes[0].getProp(propName, true)?.getValue();
}
/**
@ -471,7 +471,7 @@ export class SettingsMain implements SettingTarget {
if (this.nodes.length < 1) {
return null;
}
return this.nodes[0].getExtraProp(propName, false)?.value;
return this.nodes[0].getExtraProp(propName, false)?.getValue();
}
setExtraPropValue(propName: string, value: any) {

View File

@ -417,17 +417,14 @@ registerMetadataTransducer(metadata => {
},
},
getValue(field: SettingField, val?: any[]) {
getValue(field: SettingField, val?:any[]) {
return val;
let data = field.parent.getPropValue('eventDataList');
return data;
},
setValue(field: SettingField, eventDataList: any[]) {
return;
console.info(eventDataList);
field.parent.setPropValue('eventDataList', eventDataList);
// console.info(eventDataList);
// field.parent.setPropValue('eventDataList', eventDataList);
},
},
],