@tmagic/editor 1.7.12 → 1.7.13-beta.0
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/es/Editor.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/components/ScrollViewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/Tree.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/es/components/TreeNode.vue_vue_type_script_setup_true_lang.js +12 -7
- package/dist/es/index.js +2 -2
- package/dist/es/layouts/props-panel/PropsPanel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/es/layouts/sidebar/layer/LayerPanel.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/layouts/workspace/Breadcrumb.vue_vue_type_script_setup_true_lang.js +87 -12
- package/dist/es/layouts/workspace/Workspace.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/layouts/workspace/viewer/Stage.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/services/editor.js +7 -5
- package/dist/es/services/props.js +2 -2
- package/dist/es/style.css +20 -0
- package/dist/es/utils/tree.js +3 -1
- package/dist/style.css +20 -0
- package/dist/tmagic-editor.umd.cjs +136 -35
- package/package.json +7 -7
- package/src/Editor.vue +2 -0
- package/src/components/ScrollViewer.vue +4 -1
- package/src/components/Tree.vue +4 -1
- package/src/components/TreeNode.vue +8 -8
- package/src/editorProps.ts +3 -0
- package/src/layouts/props-panel/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/Sidebar.vue +4 -0
- package/src/layouts/sidebar/layer/LayerPanel.vue +11 -1
- package/src/layouts/workspace/Breadcrumb.vue +87 -6
- package/src/layouts/workspace/Workspace.vue +3 -1
- package/src/layouts/workspace/viewer/Stage.vue +7 -1
- package/src/services/editor.ts +11 -6
- package/src/services/props.ts +2 -2
- package/src/theme/breadcrumb.scss +24 -0
- package/src/type.ts +14 -1
- package/src/utils/tree.ts +5 -1
- package/types/index.d.ts +30 -7
|
@@ -63,6 +63,7 @@ var Editor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
63
63
|
canSelect: { type: Function },
|
|
64
64
|
isContainer: { type: Function },
|
|
65
65
|
customContentMenu: { type: Function },
|
|
66
|
+
layerNodeIsExpandable: { type: Function },
|
|
66
67
|
beforeDblclick: { type: Function },
|
|
67
68
|
extendFormState: { type: Function },
|
|
68
69
|
pageBarSortOptions: {},
|
|
@@ -146,7 +147,8 @@ var Editor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
146
147
|
"layer-content-menu": __props.layerContentMenu,
|
|
147
148
|
"custom-content-menu": __props.customContentMenu,
|
|
148
149
|
indent: __props.treeIndent,
|
|
149
|
-
"next-level-indent-increment": __props.treeNextLevelIndentIncrement
|
|
150
|
+
"next-level-indent-increment": __props.treeNextLevelIndentIncrement,
|
|
151
|
+
"layer-node-is-expandable": __props.layerNodeIsExpandable
|
|
150
152
|
}, {
|
|
151
153
|
"layer-panel-header": withCtx(() => [renderSlot(_ctx.$slots, "layer-panel-header")]),
|
|
152
154
|
"layer-node-content": withCtx(({ data }) => [renderSlot(_ctx.$slots, "layer-node-content", { data })]),
|
|
@@ -169,13 +171,15 @@ var Editor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
169
171
|
"layer-content-menu",
|
|
170
172
|
"custom-content-menu",
|
|
171
173
|
"indent",
|
|
172
|
-
"next-level-indent-increment"
|
|
174
|
+
"next-level-indent-increment",
|
|
175
|
+
"layer-node-is-expandable"
|
|
173
176
|
])])]),
|
|
174
177
|
workspace: withCtx(() => [renderSlot(_ctx.$slots, "workspace", { editorService: unref(editor_default) }, () => [createVNode(Workspace_default, {
|
|
175
178
|
"disabled-stage-overlay": __props.disabledStageOverlay,
|
|
176
179
|
"stage-content-menu": __props.stageContentMenu,
|
|
177
180
|
"custom-content-menu": __props.customContentMenu
|
|
178
181
|
}, {
|
|
182
|
+
"stage-top": withCtx(() => [renderSlot(_ctx.$slots, "stage-top")]),
|
|
179
183
|
stage: withCtx(() => [renderSlot(_ctx.$slots, "stage")]),
|
|
180
184
|
"workspace-content": withCtx(() => [renderSlot(_ctx.$slots, "workspace-content", { editorService: unref(editor_default) })]),
|
|
181
185
|
_: 3
|
|
@@ -71,7 +71,7 @@ var ScrollViewer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
71
71
|
createElementVNode("div", {
|
|
72
72
|
ref: "target",
|
|
73
73
|
style: normalizeStyle(style.value)
|
|
74
|
-
}, [renderSlot(_ctx.$slots, "default")], 4),
|
|
74
|
+
}, [renderSlot(_ctx.$slots, "before"), renderSlot(_ctx.$slots, "default")], 4),
|
|
75
75
|
renderSlot(_ctx.$slots, "content"),
|
|
76
76
|
scrollHeight.value > __props.wrapHeight ? (openBlock(), createBlock(ScrollBar_default, {
|
|
77
77
|
key: 0,
|
|
@@ -13,7 +13,8 @@ var Tree_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
13
13
|
nodeStatusMap: {},
|
|
14
14
|
indent: { default: 0 },
|
|
15
15
|
nextLevelIndentIncrement: {},
|
|
16
|
-
emptyText: { default: "暂无数据" }
|
|
16
|
+
emptyText: { default: "暂无数据" },
|
|
17
|
+
isExpandable: {}
|
|
17
18
|
},
|
|
18
19
|
emits: [
|
|
19
20
|
"node-dragover",
|
|
@@ -40,7 +41,8 @@ var Tree_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
40
41
|
data: item,
|
|
41
42
|
indent: __props.indent,
|
|
42
43
|
"next-level-indent-increment": __props.nextLevelIndentIncrement,
|
|
43
|
-
"node-status-map": __props.nodeStatusMap
|
|
44
|
+
"node-status-map": __props.nodeStatusMap,
|
|
45
|
+
"is-expandable": __props.isExpandable
|
|
44
46
|
}, {
|
|
45
47
|
"tree-node-content": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })]),
|
|
46
48
|
"tree-node-label": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "tree-node-label", { data: nodeData })]),
|
|
@@ -50,7 +52,8 @@ var Tree_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
50
52
|
"data",
|
|
51
53
|
"indent",
|
|
52
54
|
"next-level-indent-increment",
|
|
53
|
-
"node-status-map"
|
|
55
|
+
"node-status-map",
|
|
56
|
+
"is-expandable"
|
|
54
57
|
]);
|
|
55
58
|
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("p", null, toDisplayString(__props.emptyText), 1)]))], 32);
|
|
56
59
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { updateStatus } from "../utils/tree.js";
|
|
1
|
+
import { defaultIsExpandable, updateStatus } from "../utils/tree.js";
|
|
2
2
|
import Icon_default from "./Icon.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderList, renderSlot, resolveComponent, toDisplayString, unref, vShow, withCtx, withDirectives } from "vue";
|
|
4
4
|
import { ArrowDown, ArrowRight } from "@element-plus/icons-vue";
|
|
@@ -25,7 +25,11 @@ var TreeNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
25
25
|
parentsId: { default: () => [] },
|
|
26
26
|
nodeStatusMap: {},
|
|
27
27
|
indent: { default: 0 },
|
|
28
|
-
nextLevelIndentIncrement: { default: 11 }
|
|
28
|
+
nextLevelIndentIncrement: { default: 11 },
|
|
29
|
+
isExpandable: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: defaultIsExpandable
|
|
32
|
+
}
|
|
29
33
|
},
|
|
30
34
|
emits: [
|
|
31
35
|
"node-dragstart",
|
|
@@ -48,7 +52,6 @@ var TreeNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
48
52
|
const selected = computed(() => nodeStatus.value.selected);
|
|
49
53
|
const visible = computed(() => nodeStatus.value.visible);
|
|
50
54
|
const draggable = computed(() => nodeStatus.value.draggable);
|
|
51
|
-
const hasChildren = computed(() => Array.isArray(props.data.items) && props.data.items.some((item) => props.nodeStatusMap.get(item.id)?.visible));
|
|
52
55
|
const handleDragStart = (event) => {
|
|
53
56
|
treeEmit?.("node-dragstart", event, props.data);
|
|
54
57
|
};
|
|
@@ -92,20 +95,21 @@ var TreeNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
92
95
|
onMouseenter: mouseenterHandler
|
|
93
96
|
}, [createVNode(Icon_default, {
|
|
94
97
|
class: "expand-icon",
|
|
95
|
-
style: normalizeStyle(
|
|
98
|
+
style: normalizeStyle(__props.isExpandable(__props.data, __props.nodeStatusMap) ? "" : "color: transparent; cursor: default"),
|
|
96
99
|
icon: expanded.value ? unref(ArrowDown) : unref(ArrowRight),
|
|
97
100
|
onClick: expandHandler
|
|
98
101
|
}, null, 8, ["style", "icon"]), createElementVNode("div", {
|
|
99
102
|
class: "tree-node-content",
|
|
100
103
|
onClick: nodeClickHandler
|
|
101
|
-
}, [renderSlot(_ctx.$slots, "tree-node-content", { data: __props.data }, () => [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "tree-node-label", { data: __props.data }, () => [createTextVNode(toDisplayString(`${__props.data.name} (${__props.data.id})`), 1)])]), createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "tree-node-tool", { data: __props.data })])])])], 38),
|
|
104
|
+
}, [renderSlot(_ctx.$slots, "tree-node-content", { data: __props.data }, () => [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "tree-node-label", { data: __props.data }, () => [createTextVNode(toDisplayString(`${__props.data.name} (${__props.data.id})`), 1)])]), createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "tree-node-tool", { data: __props.data })])])])], 38), __props.isExpandable(__props.data, __props.nodeStatusMap) && expanded.value ? (openBlock(), createElementBlock("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.items, (item) => {
|
|
102
105
|
return openBlock(), createBlock(_component_TreeNode, {
|
|
103
106
|
key: item.id,
|
|
104
107
|
data: item,
|
|
105
108
|
parent: __props.data,
|
|
106
109
|
parentsId: [...__props.parentsId, __props.data.id],
|
|
107
110
|
"node-status-map": __props.nodeStatusMap,
|
|
108
|
-
indent: __props.indent + __props.nextLevelIndentIncrement
|
|
111
|
+
indent: __props.indent + __props.nextLevelIndentIncrement,
|
|
112
|
+
"is-expandable": __props.isExpandable
|
|
109
113
|
}, {
|
|
110
114
|
"tree-node-content": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "tree-node-content", { data: nodeData })]),
|
|
111
115
|
"tree-node-label": withCtx(({ data: nodeData }) => [renderSlot(_ctx.$slots, "tree-node-label", { data: nodeData })]),
|
|
@@ -116,7 +120,8 @@ var TreeNode_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
116
120
|
"parent",
|
|
117
121
|
"parentsId",
|
|
118
122
|
"node-status-map",
|
|
119
|
-
"indent"
|
|
123
|
+
"indent",
|
|
124
|
+
"is-expandable"
|
|
120
125
|
]);
|
|
121
126
|
}), 128))])) : createCommentVNode("v-if", true)], 40, _hoisted_1)), [[vShow, visible.value]]);
|
|
122
127
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { useServices } from "./hooks/use-services.js";
|
|
|
16
16
|
import { useFloatBox } from "./hooks/use-float-box.js";
|
|
17
17
|
import { useWindowRect } from "./hooks/use-window-rect.js";
|
|
18
18
|
import { useEditorContentHeight } from "./hooks/use-editor-content-height.js";
|
|
19
|
-
import { updateStatus } from "./utils/tree.js";
|
|
19
|
+
import { defaultIsExpandable, updateStatus } from "./utils/tree.js";
|
|
20
20
|
import { useFilter } from "./hooks/use-filter.js";
|
|
21
21
|
import { useGetSo } from "./hooks/use-getso.js";
|
|
22
22
|
import { useNextFloatBoxPosition } from "./hooks/use-next-float-box-position.js";
|
|
@@ -76,4 +76,4 @@ export * from "@tmagic/table";
|
|
|
76
76
|
export * from "@tmagic/stage";
|
|
77
77
|
export * from "@tmagic/design";
|
|
78
78
|
export * from "@tmagic/utils";
|
|
79
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectRelatedNodes, dataSource_default as dataSourceService, debug, plugin_default as default, dep_default as depService, designPlugin, displayTabConfig, editorNodeMergeCustomizer, editor_default as editorService, eqOptions, error, eventTabConfig, events_default as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, history_default as historyService, info, isIncludeDataSource, monaco_editor_default as loadMonaco, log, moveItemsInContainer, numberOptions, props_default as propsService, resolveSelectedNode, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
79
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CodeBlockEditor_default as CodeBlockEditor, CodeBlockList_default as CodeBlockList, CodeBlockListPanel_default as CodeBlockListPanel, CodeDeleteErrorType, CodeSelect_default as CodeSelect, CodeSelectCol_default as CodeSelectCol, ColumnLayout, ComponentListPanel_default as ComponentListPanel, CondOpSelect_default as CondOpSelect, ContentMenu_default as ContentMenu, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, DataSourceAddButton_default as DataSourceAddButton, DataSourceConfigPanel_default as DataSourceConfigPanel, Index_default as DataSourceFieldSelect, DataSourceFields_default as DataSourceFields, DataSourceInput_default as DataSourceInput, DataSourceMethodSelect_default as DataSourceMethodSelect, DataSourceMethods_default as DataSourceMethods, DataSourceMocks_default as DataSourceMocks, DataSourceSelect_default as DataSourceSelect, DepTargetType, DisplayConds_default as DisplayConds, DragType, EventSelect_default as EventSelect, Fixed2Other, FloatingBox_default as FloatingBox, H_GUIDE_LINE_STORAGE_KEY, Icon_default as Icon, IdleTask, KeyBindingCommand, KeyValue_default as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerOffset, LayerPanel_default as LayerPanel, Layout, SplitView_default as LayoutContainer, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, PageFragmentSelect_default as PageFragmentSelect, FormPanel_default as PropsFormPanel, PropsPanel_default as PropsPanel, RIGHT_COLUMN_WIDTH_STORAGE_KEY, Resizer_default as Resizer, ScrollViewer, SideItemKey, SplitView_default as SplitView, StageCore, Index_default$1 as StyleSetter, CodeEditor_default as TMagicCodeEditor, Editor_default as TMagicEditor, ToolButton_default as ToolButton, Tree_default as Tree, TreeNode_default as TreeNode, UI_SELECT_MODE_EVENT_NAME, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, codeBlock_default as codeBlockService, collectRelatedNodes, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, designPlugin, displayTabConfig, editorNodeMergeCustomizer, editor_default as editorService, eqOptions, error, eventTabConfig, events_default as eventsService, fillConfig, fixNodeLeft, fixNodePosition, formPlugin, generatePageName, generatePageNameByApp, getAddParent, getCascaderOptionsFromFields, getDefaultConfig, getDisplayField, getEditorConfig, getFieldType, getFormConfig, getFormValue, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, history_default as historyService, info, isIncludeDataSource, monaco_editor_default as loadMonaco, log, moveItemsInContainer, numberOptions, props_default as propsService, resolveSelectedNode, serializeConfig, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
|
@@ -46,7 +46,7 @@ var PropsPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const type = node.value.type || (node.value.items ? "container" : "text");
|
|
49
|
-
curFormConfig.value = await propsService.getPropsConfig(type);
|
|
49
|
+
curFormConfig.value = await propsService.getPropsConfig(type, { node: node.value });
|
|
50
50
|
values.value = node.value;
|
|
51
51
|
};
|
|
52
52
|
watchEffect(init);
|
|
@@ -47,7 +47,8 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
47
47
|
layerContentMenu: {},
|
|
48
48
|
indent: {},
|
|
49
49
|
nextLevelIndentIncrement: {},
|
|
50
|
-
customContentMenu: {}
|
|
50
|
+
customContentMenu: {},
|
|
51
|
+
layerNodeIsExpandable: {}
|
|
51
52
|
},
|
|
52
53
|
setup(__props, { expose: __expose }) {
|
|
53
54
|
const props = __props;
|
|
@@ -86,7 +87,8 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
86
87
|
layerContentMenu: props.layerContentMenu,
|
|
87
88
|
customContentMenu: props.customContentMenu,
|
|
88
89
|
indent: props.indent,
|
|
89
|
-
nextLevelIndentIncrement: props.nextLevelIndentIncrement
|
|
90
|
+
nextLevelIndentIncrement: props.nextLevelIndentIncrement,
|
|
91
|
+
isExpandable: props.layerNodeIsExpandable
|
|
90
92
|
},
|
|
91
93
|
component: LayerPanel_default,
|
|
92
94
|
slots: {}
|
|
@@ -18,7 +18,8 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
18
18
|
layerContentMenu: {},
|
|
19
19
|
indent: {},
|
|
20
20
|
nextLevelIndentIncrement: {},
|
|
21
|
-
customContentMenu: { type: Function }
|
|
21
|
+
customContentMenu: { type: Function },
|
|
22
|
+
isExpandable: { type: Function }
|
|
22
23
|
},
|
|
23
24
|
setup(__props) {
|
|
24
25
|
const services = useServices();
|
|
@@ -58,6 +59,7 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
58
59
|
"node-status-map": unref(nodeStatusMap),
|
|
59
60
|
indent: __props.indent,
|
|
60
61
|
"next-level-indent-increment": __props.nextLevelIndentIncrement,
|
|
62
|
+
"is-expandable": __props.isExpandable,
|
|
61
63
|
onNodeDragover: unref(handleDragOver),
|
|
62
64
|
onNodeDragstart: unref(handleDragStart),
|
|
63
65
|
onNodeDragleave: unref(handleDragLeave),
|
|
@@ -75,6 +77,7 @@ var LayerPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
75
77
|
"node-status-map",
|
|
76
78
|
"indent",
|
|
77
79
|
"next-level-indent-increment",
|
|
80
|
+
"is-expandable",
|
|
78
81
|
"onNodeDragover",
|
|
79
82
|
"onNodeDragstart",
|
|
80
83
|
"onNodeDragleave",
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { useServices } from "../../hooks/use-services.js";
|
|
2
|
-
import { TMagicButton } from "@tmagic/design";
|
|
2
|
+
import { TMagicButton, TMagicTooltip } from "@tmagic/design";
|
|
3
3
|
import { getNodePath } from "@tmagic/utils";
|
|
4
|
-
import { Fragment, computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, nextTick, onBeforeUnmount, onMounted, openBlock, ref, renderList, toDisplayString, unref, watch, withCtx } from "vue";
|
|
5
5
|
//#region packages/editor/src/layouts/workspace/Breadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _hoisted_1 = {
|
|
7
7
|
key: 0,
|
|
8
|
-
class: "m-editor-breadcrumb"
|
|
8
|
+
class: "m-editor-breadcrumb-ellipsis"
|
|
9
9
|
};
|
|
10
|
-
var _hoisted_2 = {
|
|
10
|
+
var _hoisted_2 = {
|
|
11
|
+
key: 2,
|
|
12
|
+
class: "m-editor-breadcrumb-separator"
|
|
13
|
+
};
|
|
14
|
+
var COLLAPSE_RATIO = .8;
|
|
11
15
|
var Breadcrumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
12
16
|
name: "MEditorBreadcrumb",
|
|
13
17
|
__name: "Breadcrumb",
|
|
@@ -17,21 +21,92 @@ var Breadcrumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
17
21
|
const nodes = computed(() => editorService.get("nodes"));
|
|
18
22
|
const root = computed(() => editorService.get("root"));
|
|
19
23
|
const path = computed(() => getNodePath(node.value?.id || "", root.value?.items || []));
|
|
24
|
+
const containerRef = ref(null);
|
|
25
|
+
const collapsed = ref(false);
|
|
26
|
+
const displayPath = computed(() => {
|
|
27
|
+
const list = path.value;
|
|
28
|
+
if (!collapsed.value || list.length <= 3) return list;
|
|
29
|
+
return [
|
|
30
|
+
list[0],
|
|
31
|
+
{
|
|
32
|
+
isEllipsis: true,
|
|
33
|
+
id: "__ellipsis__",
|
|
34
|
+
name: "..."
|
|
35
|
+
},
|
|
36
|
+
list[list.length - 2],
|
|
37
|
+
list[list.length - 1]
|
|
38
|
+
];
|
|
39
|
+
});
|
|
40
|
+
const measureOverflow = async () => {
|
|
41
|
+
if (collapsed.value) {
|
|
42
|
+
collapsed.value = false;
|
|
43
|
+
await nextTick();
|
|
44
|
+
}
|
|
45
|
+
const el = containerRef.value;
|
|
46
|
+
const parent = el?.parentElement;
|
|
47
|
+
if (!el || !parent) return;
|
|
48
|
+
const contentWidth = el.scrollWidth;
|
|
49
|
+
const parentWidth = parent.clientWidth;
|
|
50
|
+
if (parentWidth <= 0) return;
|
|
51
|
+
collapsed.value = contentWidth > parentWidth * COLLAPSE_RATIO;
|
|
52
|
+
};
|
|
53
|
+
let resizeObserver = null;
|
|
54
|
+
const observe = () => {
|
|
55
|
+
resizeObserver?.disconnect();
|
|
56
|
+
const el = containerRef.value;
|
|
57
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
58
|
+
resizeObserver = new ResizeObserver(() => {
|
|
59
|
+
measureOverflow();
|
|
60
|
+
});
|
|
61
|
+
resizeObserver.observe(el);
|
|
62
|
+
if (el.parentElement) resizeObserver.observe(el.parentElement);
|
|
63
|
+
};
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
observe();
|
|
66
|
+
measureOverflow();
|
|
67
|
+
});
|
|
68
|
+
onBeforeUnmount(() => {
|
|
69
|
+
resizeObserver?.disconnect();
|
|
70
|
+
resizeObserver = null;
|
|
71
|
+
});
|
|
72
|
+
watch(() => nodes.value.length, async () => {
|
|
73
|
+
await nextTick();
|
|
74
|
+
observe();
|
|
75
|
+
measureOverflow();
|
|
76
|
+
});
|
|
77
|
+
watch(path, async () => {
|
|
78
|
+
await nextTick();
|
|
79
|
+
measureOverflow();
|
|
80
|
+
});
|
|
20
81
|
const select = async (node) => {
|
|
21
82
|
await editorService.select(node);
|
|
22
83
|
editorService.get("stage")?.select(node.id);
|
|
23
84
|
};
|
|
24
85
|
return (_ctx, _cache) => {
|
|
25
|
-
return nodes.value.length === 1 ? (openBlock(), createElementBlock("div",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
86
|
+
return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", {
|
|
87
|
+
key: 0,
|
|
88
|
+
ref_key: "containerRef",
|
|
89
|
+
ref: containerRef,
|
|
90
|
+
class: "m-editor-breadcrumb"
|
|
91
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(displayPath.value, (item, index) => {
|
|
92
|
+
return openBlock(), createElementBlock(Fragment, { key: item.isEllipsis ? `ellipsis-${index}` : item.id }, [item.isEllipsis ? (openBlock(), createElementBlock("span", _hoisted_1, "...")) : (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
93
|
+
key: 1,
|
|
94
|
+
content: item.name,
|
|
95
|
+
placement: "top",
|
|
96
|
+
"show-after": 500
|
|
30
97
|
}, {
|
|
31
|
-
default: withCtx(() => [
|
|
98
|
+
default: withCtx(() => [createVNode(unref(TMagicButton), {
|
|
99
|
+
class: "m-editor-breadcrumb-item",
|
|
100
|
+
link: "",
|
|
101
|
+
disabled: item.id === node.value?.id,
|
|
102
|
+
onClick: ($event) => select(item)
|
|
103
|
+
}, {
|
|
104
|
+
default: withCtx(() => [createTextVNode(toDisplayString(item.name), 1)]),
|
|
105
|
+
_: 2
|
|
106
|
+
}, 1032, ["disabled", "onClick"])]),
|
|
32
107
|
_: 2
|
|
33
|
-
}, 1032, ["
|
|
34
|
-
}), 128))])) : createCommentVNode("v-if", true);
|
|
108
|
+
}, 1032, ["content"])), index < displayPath.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2, "/")) : createCommentVNode("v-if", true)], 64);
|
|
109
|
+
}), 128))], 512)) : createCommentVNode("v-if", true);
|
|
35
110
|
};
|
|
36
111
|
}
|
|
37
112
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useServices } from "../../hooks/use-services.js";
|
|
2
2
|
import Stage_default from "./viewer/Stage.js";
|
|
3
3
|
import Breadcrumb_default from "./Breadcrumb.js";
|
|
4
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, inject, openBlock, renderSlot, unref } from "vue";
|
|
4
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, inject, openBlock, renderSlot, unref, withCtx } from "vue";
|
|
5
5
|
//#region packages/editor/src/layouts/workspace/Workspace.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _hoisted_1 = { class: "m-editor-workspace" };
|
|
7
7
|
var Workspace_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
@@ -28,7 +28,10 @@ var Workspace_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
28
28
|
"disabled-stage-overlay": __props.disabledStageOverlay,
|
|
29
29
|
"stage-content-menu": __props.stageContentMenu,
|
|
30
30
|
"custom-content-menu": __props.customContentMenu
|
|
31
|
-
},
|
|
31
|
+
}, {
|
|
32
|
+
"stage-top": withCtx(() => [renderSlot(_ctx.$slots, "stage-top")]),
|
|
33
|
+
_: 3
|
|
34
|
+
}, 8, [
|
|
32
35
|
"stage-options",
|
|
33
36
|
"disabled-stage-overlay",
|
|
34
37
|
"stage-content-menu",
|
|
@@ -9,7 +9,7 @@ import StageOverlay_default from "./StageOverlay.js";
|
|
|
9
9
|
import ViewerMenu_default from "./ViewerMenu.js";
|
|
10
10
|
import { getOffset } from "@tmagic/stage";
|
|
11
11
|
import { calcValueByFontsize, getIdFromEl } from "@tmagic/utils";
|
|
12
|
-
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, markRaw, nextTick, normalizeStyle, onBeforeUnmount, onMounted, openBlock, resolveDirective, useTemplateRef, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
12
|
+
import { Teleport, computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, markRaw, nextTick, normalizeStyle, onBeforeUnmount, onMounted, openBlock, renderSlot, resolveDirective, useTemplateRef, watch, watchEffect, withCtx, withDirectives } from "vue";
|
|
13
13
|
//#region packages/editor/src/layouts/workspace/viewer/Stage.vue?vue&type=script&setup=true&lang.ts
|
|
14
14
|
var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
15
15
|
name: "MEditorStage",
|
|
@@ -236,6 +236,7 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
236
236
|
},
|
|
237
237
|
onClick: _cache[0] || (_cache[0] = ($event) => stageWrapRef.value?.container?.focus())
|
|
238
238
|
}, {
|
|
239
|
+
before: withCtx(() => [renderSlot(_ctx.$slots, "stage-top")]),
|
|
239
240
|
content: withCtx(() => [!__props.disabledStageOverlay ? (openBlock(), createBlock(StageOverlay_default, { key: 0 })) : createCommentVNode("v-if", true), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(ViewerMenu_default, {
|
|
240
241
|
ref: "menu",
|
|
241
242
|
"is-multi-select": isMultiSelect.value,
|
|
@@ -254,7 +255,7 @@ var Stage_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
|
|
|
254
255
|
onDrop: dropHandler,
|
|
255
256
|
onDragover: dragoverHandler
|
|
256
257
|
}, null, 36), createVNode(NodeListMenu_default)]),
|
|
257
|
-
_:
|
|
258
|
+
_: 3
|
|
258
259
|
}, 8, [
|
|
259
260
|
"width",
|
|
260
261
|
"height",
|
|
@@ -334,7 +334,7 @@ var Editor = class extends BaseService_default {
|
|
|
334
334
|
if (removedItems.length > 0 && pageForOp) this.pushOpHistory("remove", { removedItems }, pageForOp);
|
|
335
335
|
this.emit("remove", nodes);
|
|
336
336
|
}
|
|
337
|
-
async doUpdate(config, { changeRecords = [] } = {}) {
|
|
337
|
+
async doUpdate(config, { changeRecords = [], selectedAfterUpdate = true } = {}) {
|
|
338
338
|
const root = this.get("root");
|
|
339
339
|
if (!root) throw new Error("root为空");
|
|
340
340
|
if (!config?.id) throw new Error("没有配置或者配置缺少id值");
|
|
@@ -361,10 +361,12 @@ var Editor = class extends BaseService_default {
|
|
|
361
361
|
const layout = await this.getLayout(node);
|
|
362
362
|
if (Array.isArray(newConfig.items) && newLayout !== layout) newConfig = setChildrenLayout(newConfig, newLayout);
|
|
363
363
|
parentNodeItems[index] = newConfig;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
364
|
+
if (selectedAfterUpdate) {
|
|
365
|
+
const nodes = this.get("nodes");
|
|
366
|
+
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
367
|
+
nodes.splice(targetIndex, 1, newConfig);
|
|
368
|
+
this.set("nodes", [...nodes]);
|
|
369
|
+
}
|
|
368
370
|
if (isPage(newConfig) || isPageFragment(newConfig)) this.set("page", newConfig);
|
|
369
371
|
this.addModifiedNodeId(newConfig.id);
|
|
370
372
|
return {
|
|
@@ -72,8 +72,8 @@ var Props = class extends BaseService_default {
|
|
|
72
72
|
* @param type 组件类型
|
|
73
73
|
* @returns 组件属性表单配置
|
|
74
74
|
*/
|
|
75
|
-
async getPropsConfig(type) {
|
|
76
|
-
if (type === "area") return await this.getPropsConfig("button");
|
|
75
|
+
async getPropsConfig(type, data) {
|
|
76
|
+
if (type === "area") return await this.getPropsConfig("button", data);
|
|
77
77
|
return cloneDeep(this.state.propsConfigMap[toLine(type)] || await this.fillConfig([]));
|
|
78
78
|
}
|
|
79
79
|
setPropsValues(values) {
|
package/dist/es/style.css
CHANGED
|
@@ -1325,6 +1325,26 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
1325
1325
|
left: 5px;
|
|
1326
1326
|
top: 5px;
|
|
1327
1327
|
z-index: 10;
|
|
1328
|
+
display: flex;
|
|
1329
|
+
align-items: center;
|
|
1330
|
+
white-space: nowrap;
|
|
1331
|
+
}
|
|
1332
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-item {
|
|
1333
|
+
max-width: 100px;
|
|
1334
|
+
min-width: 0;
|
|
1335
|
+
overflow: hidden;
|
|
1336
|
+
}
|
|
1337
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-item > span {
|
|
1338
|
+
display: block;
|
|
1339
|
+
max-width: 100%;
|
|
1340
|
+
overflow: hidden;
|
|
1341
|
+
text-overflow: ellipsis;
|
|
1342
|
+
white-space: nowrap;
|
|
1343
|
+
}
|
|
1344
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-separator,
|
|
1345
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-ellipsis {
|
|
1346
|
+
margin: 0 4px;
|
|
1347
|
+
flex-shrink: 0;
|
|
1328
1348
|
}
|
|
1329
1349
|
|
|
1330
1350
|
.data-source-list-panel .list-container .list-item .codeIcon {
|
package/dist/es/utils/tree.js
CHANGED
|
@@ -7,5 +7,7 @@ var updateStatus = (nodeStatusMap, id, status) => {
|
|
|
7
7
|
if (nodeStatus[key] !== void 0 && status[key] !== void 0) nodeStatus[key] = Boolean(status[key]);
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
/** 默认的组件树节点是否可展开的判断函数:当节点的子项中至少存在一个可见节点时认为可展开 */
|
|
11
|
+
var defaultIsExpandable = (data, nodeStatusMap) => Array.isArray(data.items) && data.items.some((item) => nodeStatusMap.get(item.id)?.visible);
|
|
10
12
|
//#endregion
|
|
11
|
-
export { updateStatus };
|
|
13
|
+
export { defaultIsExpandable, updateStatus };
|
package/dist/style.css
CHANGED
|
@@ -1325,6 +1325,26 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
1325
1325
|
left: 5px;
|
|
1326
1326
|
top: 5px;
|
|
1327
1327
|
z-index: 10;
|
|
1328
|
+
display: flex;
|
|
1329
|
+
align-items: center;
|
|
1330
|
+
white-space: nowrap;
|
|
1331
|
+
}
|
|
1332
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-item {
|
|
1333
|
+
max-width: 100px;
|
|
1334
|
+
min-width: 0;
|
|
1335
|
+
overflow: hidden;
|
|
1336
|
+
}
|
|
1337
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-item > span {
|
|
1338
|
+
display: block;
|
|
1339
|
+
max-width: 100%;
|
|
1340
|
+
overflow: hidden;
|
|
1341
|
+
text-overflow: ellipsis;
|
|
1342
|
+
white-space: nowrap;
|
|
1343
|
+
}
|
|
1344
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-separator,
|
|
1345
|
+
.m-editor-breadcrumb .m-editor-breadcrumb-ellipsis {
|
|
1346
|
+
margin: 0 4px;
|
|
1347
|
+
flex-shrink: 0;
|
|
1328
1348
|
}
|
|
1329
1349
|
|
|
1330
1350
|
.data-source-list-panel .list-container .list-item .codeIcon {
|