mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge commit '14fc9c3dcc7ed8576e72d9f7310195f6ff461cf4' into def_releases_2021081610154444_ali-lowcode_ali-lowcode-engine/1.0.63
This commit is contained in:
commit
02dc69e791
@ -156,7 +156,11 @@ hotkey.bind(['command+v', 'ctrl+v'], (e) => {
|
||||
if (!target) {
|
||||
return;
|
||||
}
|
||||
const nodes = insertChildren(target, componentsTree, index);
|
||||
let canAddComponentsTree = componentsTree.filter((i) => {
|
||||
return doc.checkNestingUp(target, i);
|
||||
});
|
||||
if (canAddComponentsTree.length === 0) return;
|
||||
const nodes = insertChildren(target, canAddComponentsTree, index);
|
||||
if (nodes) {
|
||||
doc.selection.selectAll(nodes.map((o) => o.id));
|
||||
setTimeout(() => designer.activeTracker.track(nodes[0]), 10);
|
||||
|
||||
@ -122,6 +122,7 @@ export class NodeChildren {
|
||||
* 删除一个节点
|
||||
*/
|
||||
delete(node: Node, purge = false, useMutator = true, options: NodeRemoveOptions = {}): boolean {
|
||||
node.internalPurgeStart();
|
||||
if (node.isParental()) {
|
||||
foreachReverse(node.children, (subNode: Node) => {
|
||||
subNode.remove(useMutator, purge, options);
|
||||
@ -150,7 +151,7 @@ export class NodeChildren {
|
||||
document.destroyNode(node);
|
||||
this.emitter.emit('change');
|
||||
if (useMutator) {
|
||||
this.reportModified(node, this.owner, { type: 'remove', removeIndex: i, removeNode: node });
|
||||
this.reportModified(node, this.owner, { type: 'remove', propagated: false, isSubDeleting: this.owner.isPurging, removeIndex: i, removeNode: node });
|
||||
}
|
||||
// purge 为 true 时,已在 internalSetParent 中删除了子节点
|
||||
if (i > -1 && !purge) {
|
||||
@ -200,7 +201,9 @@ export class NodeChildren {
|
||||
if (globalContext.has('editor')) {
|
||||
globalContext.get('editor').emit('node.add', { node });
|
||||
}
|
||||
// this.reportModified(node, this.owner, { type: 'insert' });
|
||||
if (useMutator) {
|
||||
this.reportModified(node, this.owner, { type: 'insert' });
|
||||
}
|
||||
|
||||
// check condition group
|
||||
if (node.conditionGroup) {
|
||||
@ -367,14 +370,6 @@ export class NodeChildren {
|
||||
return 'Array';
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @deprecated
|
||||
// * 为了兼容vision体系存量api
|
||||
// */
|
||||
// getChildrenArray() {
|
||||
// return this.children;
|
||||
// }
|
||||
|
||||
private reportModified(node: Node, owner: Node, options = {}) {
|
||||
if (!node) {
|
||||
return;
|
||||
@ -392,7 +387,7 @@ export class NodeChildren {
|
||||
}
|
||||
|
||||
if (owner.parent && !owner.parent.isRoot()) {
|
||||
this.reportModified(node, owner.parent, options);
|
||||
this.reportModified(node, owner.parent, { ...options, propagated: true, });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,6 +834,18 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
// this.document.destroyNode(this);
|
||||
}
|
||||
|
||||
private purging: boolean = false;
|
||||
internalPurgeStart() {
|
||||
this.purging = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否正在销毁
|
||||
*/
|
||||
get isPurging() {
|
||||
return this.purging;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可执行某action
|
||||
*/
|
||||
|
||||
@ -25,7 +25,11 @@ class Contents extends Component<{ area: Area }> {
|
||||
const { area } = this.props;
|
||||
const top: any[] = [];
|
||||
const bottom: any[] = [];
|
||||
area.container.items.forEach((item) => {
|
||||
area.container.items.sort((a, b) => {
|
||||
const index1 = a.config?.index || 0;
|
||||
const index2 = b.config?.index || 0;
|
||||
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
|
||||
}).forEach((item) => {
|
||||
const content = <div key={`left-area-${item.name}`}>{item.content}</div>;
|
||||
if (item.align === 'bottom') {
|
||||
bottom.push(content);
|
||||
|
||||
@ -335,9 +335,16 @@ body {
|
||||
flex-direction: column;
|
||||
z-index: 10;
|
||||
.lc-toolbar {
|
||||
display: flex;
|
||||
height: var(--toolbar-height);
|
||||
background-color: var(--color-pane-background);
|
||||
padding: 8px 16px;
|
||||
.lc-toolbar-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
.lc-main-area {
|
||||
flex: 1;
|
||||
|
||||
@ -40,8 +40,7 @@ export function deepValueParser(obj: any, node: Node): any {
|
||||
if (isI18nData(obj)) {
|
||||
// FIXME! use editor.get
|
||||
let locale = Env.getLocale();
|
||||
if (obj.key) {
|
||||
// FIXME: 此处需要升级I18nUtil,改成响应式
|
||||
if (obj.key && i18nUtil.get(obj.key, locale)) {
|
||||
return i18nUtil.get(obj.key, locale);
|
||||
}
|
||||
if (locale !== 'zh_CN' && locale !== 'zh_TW' && !obj[locale]) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user