@tmagic/editor 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tmagic-editor.js +25 -17
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +25 -16
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/layouts/sidebar/data-source/DataSourceList.vue +0 -1
- package/src/services/editor.ts +11 -2
- package/src/utils/editor.ts +18 -13
- package/types/utils/editor.d.ts +2 -1
package/dist/tmagic-editor.js
CHANGED
|
@@ -1626,23 +1626,27 @@ const getInitPositionStyle = (style = {}, layout) => {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
return style;
|
|
1628
1628
|
};
|
|
1629
|
-
const
|
|
1629
|
+
const setChilrenLayout = (node, layout) => {
|
|
1630
1630
|
node.items?.forEach((child) => {
|
|
1631
|
-
|
|
1632
|
-
return;
|
|
1633
|
-
const style = child.style || {};
|
|
1634
|
-
if (style.position === "fixed")
|
|
1635
|
-
return;
|
|
1636
|
-
if (layout !== Layout.RELATIVE) {
|
|
1637
|
-
style.position = "absolute";
|
|
1638
|
-
} else {
|
|
1639
|
-
child.style = getRelativeStyle(style);
|
|
1640
|
-
child.style.right = "auto";
|
|
1641
|
-
child.style.bottom = "auto";
|
|
1642
|
-
}
|
|
1631
|
+
setLayout(child, layout);
|
|
1643
1632
|
});
|
|
1644
1633
|
return node;
|
|
1645
1634
|
};
|
|
1635
|
+
const setLayout = (node, layout) => {
|
|
1636
|
+
if (isPop(node))
|
|
1637
|
+
return;
|
|
1638
|
+
const style = node.style || {};
|
|
1639
|
+
if (style.position === "fixed")
|
|
1640
|
+
return;
|
|
1641
|
+
if (layout !== Layout.RELATIVE) {
|
|
1642
|
+
style.position = "absolute";
|
|
1643
|
+
} else {
|
|
1644
|
+
node.style = getRelativeStyle(style);
|
|
1645
|
+
node.style.right = "auto";
|
|
1646
|
+
node.style.bottom = "auto";
|
|
1647
|
+
}
|
|
1648
|
+
return node;
|
|
1649
|
+
};
|
|
1646
1650
|
const change2Fixed = (node, root) => {
|
|
1647
1651
|
const path = getNodePath(node.id, root.items);
|
|
1648
1652
|
const offset = {
|
|
@@ -2497,8 +2501,8 @@ class Editor extends BaseService {
|
|
|
2497
2501
|
throw new Error("更新的节点未找到");
|
|
2498
2502
|
const newLayout = await this.getLayout(newConfig);
|
|
2499
2503
|
const layout = await this.getLayout(node);
|
|
2500
|
-
if (newLayout !== layout) {
|
|
2501
|
-
newConfig =
|
|
2504
|
+
if (Array.isArray(newConfig.items) && newLayout !== layout) {
|
|
2505
|
+
newConfig = setChilrenLayout(newConfig, newLayout);
|
|
2502
2506
|
}
|
|
2503
2507
|
parentNodeItems[index] = newConfig;
|
|
2504
2508
|
const nodes = this.get("nodes");
|
|
@@ -2720,6 +2724,11 @@ class Editor extends BaseService {
|
|
|
2720
2724
|
targetIndex -= 1;
|
|
2721
2725
|
}
|
|
2722
2726
|
}
|
|
2727
|
+
const layout = await this.getLayout(parent);
|
|
2728
|
+
const newLayout = await this.getLayout(targetParent);
|
|
2729
|
+
if (newLayout !== layout) {
|
|
2730
|
+
setLayout(config, newLayout);
|
|
2731
|
+
}
|
|
2723
2732
|
parent.items?.splice(index, 1);
|
|
2724
2733
|
targetParent.items?.splice(targetIndex, 0, config);
|
|
2725
2734
|
const page = this.get("page");
|
|
@@ -6143,7 +6152,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
6143
6152
|
const tree = ref();
|
|
6144
6153
|
__expose({
|
|
6145
6154
|
filter(val) {
|
|
6146
|
-
debugger;
|
|
6147
6155
|
tree.value?.filter(val);
|
|
6148
6156
|
}
|
|
6149
6157
|
});
|
|
@@ -10502,5 +10510,5 @@ const index = {
|
|
|
10502
10510
|
}
|
|
10503
10511
|
};
|
|
10504
10512
|
|
|
10505
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$r as CodeBlockList, _sfc_main$q as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$k as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DepTargetType, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$A as LayoutContainer, _sfc_main$v as PropsPanel, _sfc_main$B as Resizer, _sfc_main$A as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
|
|
10513
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$P as CodeBlockEditor, _sfc_main$r as CodeBlockList, _sfc_main$q as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$Q as CodeSelect, _sfc_main$M as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$k as ContentMenu, _sfc_main$K as DataSourceFieldSelect, _sfc_main$L as DataSourceFields, _sfc_main$J as DataSourceInput, _sfc_main$H as DataSourceMethodSelect, _sfc_main$I as DataSourceMethods, _sfc_main$G as DataSourceMocks, _sfc_main$F as DataSourceSelect, DepTargetType, DragType, _sfc_main$E as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$N as Icon, KeyBindingCommand, _sfc_main$D as KeyValue, Keys, LayerOffset, _sfc_main$g as LayerPanel, Layout, _sfc_main$A as LayoutContainer, _sfc_main$v as PropsPanel, _sfc_main$B as Resizer, _sfc_main$A as SplitView, _sfc_main$T as TMagicCodeEditor, _sfc_main as TMagicEditor, _sfc_main$x as ToolButton, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getDisplayField, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setChilrenLayout, setConfig, setLayout, storageService, styleTabConfig, traverseNode, uiService, useCodeBlockEdit, useDataSourceMethod, useStage, warn };
|
|
10506
10514
|
//# sourceMappingURL=tmagic-editor.js.map
|