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 loc = this._dropLocation;
if (loc) {
if (isLocationChildrenDetail(loc.detail)) {
if (isLocationChildrenDetail(loc.detail) && loc.detail.valid !== false) {
let nodes: Node[] | undefined;
if (isDragNodeObject(dragObject)) {
nodes = insertChildren(loc.target, dragObject.nodes, loc.detail.index, copy);

View File

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

View File

@ -142,19 +142,8 @@ export default class MixedSetter extends Component<{
// dirty fix vision variable setter logic
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) => {
const { field, onChange } = this.props;
const oldUsed = this.used;
if (name === 'VariableSetter') {
const setterComponent = getSetter('VariableSetter')?.component as any;
if (setterComponent && setterComponent.isPopup) {
@ -167,10 +156,7 @@ export default class MixedSetter extends Component<{
}
const setter = this.setters.find((item) => item.name === name);
this.used = name;
const newValue = this.getDefaultValueWhenUseSetter(oldUsed);
if (newValue !== undefined) {
onChange && onChange(newValue);
} else if (setter) {
if (setter) {
this.handleInitial(setter);
}
};

View File

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