Merge branch 'preset-vision/0.9.0' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into preset-vision/0.9.0

This commit is contained in:
kangwei 2020-05-12 13:24:26 +08:00
commit b774428a0f
4 changed files with 7 additions and 29 deletions

View File

@ -99,7 +99,7 @@ export class Designer {
const { dragObject, copy } = e; const { dragObject, copy } = e;
const loc = this._dropLocation; const loc = this._dropLocation;
if (loc) { if (loc) {
if (isLocationChildrenDetail(loc.detail)) { if (isLocationChildrenDetail(loc.detail) && loc.detail.valid !== false) {
let nodes: Node[] | undefined; let nodes: Node[] | undefined;
if (isDragNodeObject(dragObject)) { if (isDragNodeObject(dragObject)) {
nodes = insertChildren(loc.target, dragObject.nodes, loc.detail.index, copy); nodes = insertChildren(loc.target, dragObject.nodes, loc.detail.index, copy);

View File

@ -41,7 +41,6 @@ export class DocumentModel {
private seqId = 0; private seqId = 0;
private _simulator?: ISimulatorHost; private _simulator?: ISimulatorHost;
/** /**
* *
*/ */
@ -119,7 +118,6 @@ export class DocumentModel {
// return this.addonsData[name]; // return this.addonsData[name];
// } // }
/** /**
* id * id
*/ */
@ -240,12 +238,12 @@ export class DocumentModel {
node.remove(); node.remove();
} }
getAddonData(name: string) { getAddonData(name: string) {
const addon = this.getNode(name) const addon = this.getNode(name);
if (addon) { if (addon) {
// 无法确定是否有这个api // 无法确定是否有这个api
// return addon.exportData(); // return addon.exportData();
} }
return addon return addon;
} }
@obx.ref private _dropLocation: DropLocation | null = null; @obx.ref private _dropLocation: DropLocation | null = null;
@ -485,7 +483,8 @@ export class DocumentModel {
// add toData // add toData
toData() { toData() {
return { componentsTree: [this.project?.currentDocument?.export(TransformStage.Save)] }; const node = this.project?.currentDocument?.export(TransformStage.Serilize);
return { componentsTree: [node] };
} }
getHistory(): History { getHistory(): History {

View File

@ -142,19 +142,8 @@ export default class MixedSetter extends Component<{
// dirty fix vision variable setter logic // dirty fix vision variable setter logic
private hasVariableSetter = this.setters.some((item) => item.name === 'VariableSetter'); private hasVariableSetter = this.setters.some((item) => item.name === 'VariableSetter');
private getDefaultValueWhenUseSetter(oldUsed?: string): any {
if (this.used === 'I18nSetter') {
return {
type: 'i18n',
zh_CN: '',
en_US: '',
}
}
}
private useSetter = (name: string) => { private useSetter = (name: string) => {
const { field, onChange } = this.props; const { field, onChange } = this.props;
const oldUsed = this.used;
if (name === 'VariableSetter') { if (name === 'VariableSetter') {
const setterComponent = getSetter('VariableSetter')?.component as any; const setterComponent = getSetter('VariableSetter')?.component as any;
if (setterComponent && setterComponent.isPopup) { if (setterComponent && setterComponent.isPopup) {
@ -167,10 +156,7 @@ export default class MixedSetter extends Component<{
} }
const setter = this.setters.find((item) => item.name === name); const setter = this.setters.find((item) => item.name === name);
this.used = name; this.used = name;
const newValue = this.getDefaultValueWhenUseSetter(oldUsed); if (setter) {
if (newValue !== undefined) {
onChange && onChange(newValue);
} else if (setter) {
this.handleInitial(setter); this.handleInitial(setter);
} }
}; };

View File

@ -370,14 +370,7 @@ export function upgradePropConfig(config: OldPropConfig, addInitial: AddIntial)
}, },
]; ];
if (allowTextInput !== false) { if (allowTextInput !== false) {
setters.unshift({ setters.unshift('I18nSetter');
componentName: 'I18nSetter',
title: {
'type': 'i18n',
'zh-CN': '国际化输入',
'en-US': 'Internationalized Input'
},
});
} }
if (supportVariable) { if (supportVariable) {
setters.push('VariableSetter'); setters.push('VariableSetter');