@tmagic/editor 1.8.0-beta.1 → 1.8.0-beta.3
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 +20 -2
- package/dist/es/components/CodeBlockEditor.vue_vue_type_script_setup_true_lang.js +18 -110
- package/dist/es/components/CodeParams.vue_vue_type_script_setup_true_lang.js +6 -0
- package/dist/es/components/CompareForm.js +5 -0
- package/dist/es/components/CompareForm.vue_vue_type_script_setup_true_lang.js +171 -0
- package/dist/es/editorProps.js +2 -0
- package/dist/es/fields/Code.vue_vue_type_script_setup_true_lang.js +19 -3
- package/dist/es/fields/CodeLink.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/es/fields/CodeSelect.vue_vue_type_script_setup_true_lang.js +18 -2
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +37 -6
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/es/fields/DataSourceFieldSelect/Index.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +14 -6
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +3 -1
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +15 -7
- package/dist/es/fields/DataSourceMocks.vue_vue_type_script_setup_true_lang.js +14 -6
- package/dist/es/fields/DataSourceSelect.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/es/fields/EventSelect.vue_vue_type_script_setup_true_lang.js +58 -11
- package/dist/es/fields/KeyValue.vue_vue_type_script_setup_true_lang.js +11 -6
- package/dist/es/fields/UISelect.vue_vue_type_script_setup_true_lang.js +8 -5
- package/dist/es/hooks/use-code-block-edit.js +2 -2
- package/dist/es/hooks/use-stage.js +17 -8
- package/dist/es/index.js +5 -1
- package/dist/es/initService.js +6 -6
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +12 -7
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +8 -0
- package/dist/es/layouts/history-list/Bucket.js +5 -0
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/es/layouts/history-list/BucketTab.js +5 -0
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/es/layouts/history-list/GroupRow.js +5 -0
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +198 -0
- package/dist/es/layouts/history-list/HistoryDiffDialog.js +5 -0
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +245 -0
- package/dist/es/layouts/history-list/HistoryListPanel.js +5 -0
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +340 -0
- package/dist/es/layouts/history-list/InitialRow.js +5 -0
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/es/layouts/history-list/PageTab.js +5 -0
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/es/layouts/history-list/composables.js +172 -0
- package/dist/es/layouts/sidebar/layer/use-node-status.js +1 -1
- package/dist/es/services/BaseService.js +31 -68
- package/dist/es/services/codeBlock.js +205 -8
- package/dist/es/services/componentList.js +2 -2
- package/dist/es/services/dataSource.js +217 -8
- package/dist/es/services/dep.js +21 -9
- package/dist/es/services/editor.js +350 -160
- package/dist/es/services/events.js +2 -2
- package/dist/es/services/history.js +410 -12
- package/dist/es/services/keybinding.js +2 -2
- package/dist/es/services/props.js +8 -8
- package/dist/es/services/stageOverlay.js +2 -2
- package/dist/es/services/storage.js +2 -2
- package/dist/es/services/ui.js +2 -2
- package/dist/es/style.css +379 -1
- package/dist/es/utils/code-block.js +122 -0
- package/dist/es/utils/content-menu.js +4 -5
- package/dist/es/utils/dep/worker.js +1 -1
- package/dist/es/utils/editor.js +2 -2
- package/dist/es/utils/undo-redo.js +20 -0
- package/dist/style.css +379 -1
- package/dist/tmagic-editor.umd.cjs +3331 -787
- package/package.json +7 -7
- package/src/Editor.vue +15 -0
- package/src/components/CodeBlockEditor.vue +20 -109
- package/src/components/CodeParams.vue +6 -0
- package/src/components/CompareForm.vue +238 -0
- package/src/editorProps.ts +9 -0
- package/src/fields/Code.vue +19 -3
- package/src/fields/CodeLink.vue +2 -5
- package/src/fields/CodeSelect.vue +17 -1
- package/src/fields/CodeSelectCol.vue +30 -2
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +7 -1
- package/src/fields/DataSourceFieldSelect/Index.vue +2 -2
- package/src/fields/DataSourceFields.vue +12 -3
- package/src/fields/DataSourceMethodSelect.vue +4 -1
- package/src/fields/DataSourceMethods.vue +14 -4
- package/src/fields/DataSourceMocks.vue +13 -3
- package/src/fields/DataSourceSelect.vue +4 -1
- package/src/fields/EventSelect.vue +57 -8
- package/src/fields/KeyValue.vue +17 -4
- package/src/fields/UISelect.vue +5 -2
- package/src/hooks/use-code-block-edit.ts +5 -2
- package/src/hooks/use-stage.ts +24 -7
- package/src/index.ts +3 -0
- package/src/layouts/CodeEditor.vue +17 -5
- package/src/layouts/Framework.vue +10 -5
- package/src/layouts/NavMenu.vue +9 -0
- package/src/layouts/history-list/Bucket.vue +124 -0
- package/src/layouts/history-list/BucketTab.vue +77 -0
- package/src/layouts/history-list/GroupRow.vue +242 -0
- package/src/layouts/history-list/HistoryDiffDialog.vue +231 -0
- package/src/layouts/history-list/HistoryListPanel.vue +380 -0
- package/src/layouts/history-list/InitialRow.vue +52 -0
- package/src/layouts/history-list/PageTab.vue +108 -0
- package/src/layouts/history-list/composables.ts +226 -0
- package/src/layouts/sidebar/layer/use-node-status.ts +9 -6
- package/src/services/BaseService.ts +35 -86
- package/src/services/codeBlock.ts +256 -5
- package/src/services/dataSource.ts +257 -6
- package/src/services/dep.ts +32 -9
- package/src/services/editor.ts +454 -171
- package/src/services/history.ts +455 -8
- package/src/services/props.ts +2 -2
- package/src/theme/history-list-panel.scss +462 -0
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +269 -6
- package/src/utils/code-block.ts +150 -0
- package/src/utils/content-menu.ts +8 -5
- package/src/utils/dep/worker.ts +5 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/undo-redo.ts +23 -0
- package/types/index.d.ts +2274 -819
- package/dist/es/utils/compose.js +0 -44
- package/dist/es/utils/editor-history.js +0 -100
- package/src/utils/compose.ts +0 -52
- package/src/utils/editor-history.ts +0 -138
|
@@ -7,10 +7,13 @@ import { MFormBox } from "@tmagic/form";
|
|
|
7
7
|
import { MagicTable } from "@tmagic/table";
|
|
8
8
|
import { TMagicButton, tMagicMessage, tMagicMessageBox } from "@tmagic/design";
|
|
9
9
|
import { getDefaultValueFromFields } from "@tmagic/utils";
|
|
10
|
-
import {
|
|
10
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, isRef, mergeModels, openBlock, ref, unref, useModel, withCtx } from "vue";
|
|
11
11
|
//#region packages/editor/src/fields/DataSourceFields.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var _hoisted_1 = { class: "m-editor-data-source-fields" };
|
|
13
|
-
var _hoisted_2 = {
|
|
13
|
+
var _hoisted_2 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "m-editor-data-source-fields-footer"
|
|
16
|
+
};
|
|
14
17
|
var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
15
18
|
name: "MFieldsDataSourceFields",
|
|
16
19
|
__name: "DataSourceFields",
|
|
@@ -51,6 +54,9 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
51
54
|
const props = __props;
|
|
52
55
|
const emit = __emit;
|
|
53
56
|
const { uiService } = useServices();
|
|
57
|
+
const mForm = inject("mForm");
|
|
58
|
+
/** 对比模式下隐藏新增/编辑/删除等操作按钮,仅保留只读展示。 */
|
|
59
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
54
60
|
const fieldValues = ref({});
|
|
55
61
|
const fieldTitle = ref("");
|
|
56
62
|
const width = useModel(__props, "width");
|
|
@@ -130,6 +136,8 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
130
136
|
}]
|
|
131
137
|
}
|
|
132
138
|
];
|
|
139
|
+
/** 对比模式下移除「操作」列(编辑/删除按钮),仅保留只读列。 */
|
|
140
|
+
const displayColumns = computed(() => isCompare.value ? fieldColumns.filter((col) => !col.actions) : fieldColumns);
|
|
133
141
|
const dataSourceFieldsConfig = [
|
|
134
142
|
{
|
|
135
143
|
name: "index",
|
|
@@ -306,10 +314,10 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
306
314
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
307
315
|
createVNode(unref(MagicTable), {
|
|
308
316
|
data: __props.model[__props.name],
|
|
309
|
-
columns:
|
|
317
|
+
columns: displayColumns.value,
|
|
310
318
|
border: true
|
|
311
|
-
}, null, 8, ["data"]),
|
|
312
|
-
|
|
319
|
+
}, null, 8, ["data", "columns"]),
|
|
320
|
+
!isCompare.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(TMagicButton), {
|
|
313
321
|
size: "small",
|
|
314
322
|
disabled: __props.disabled,
|
|
315
323
|
plain: "",
|
|
@@ -326,7 +334,7 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
326
334
|
}, {
|
|
327
335
|
default: withCtx(() => [..._cache[9] || (_cache[9] = [createTextVNode("添加", -1)])]),
|
|
328
336
|
_: 1
|
|
329
|
-
}, 8, ["disabled"])]),
|
|
337
|
+
}, 8, ["disabled"])])) : createCommentVNode("v-if", true),
|
|
330
338
|
createVNode(FloatingBox_default, {
|
|
331
339
|
visible: addDialogVisible.value,
|
|
332
340
|
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => addDialogVisible.value = $event),
|
package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js
CHANGED
|
@@ -38,6 +38,8 @@ var DataSourceMethodSelect_vue_vue_type_script_setup_true_name_true_lang_default
|
|
|
38
38
|
const props = __props;
|
|
39
39
|
const hasDataSourceSidePanel = computed(() => (uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE));
|
|
40
40
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
41
|
+
/** 对比模式下隐藏查看/编辑操作按钮,仅保留只读展示。 */
|
|
42
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
41
43
|
const dataSources = computed(() => dataSourceService.get("dataSources"));
|
|
42
44
|
const isCustomMethod = computed(() => {
|
|
43
45
|
const [id, name] = props.model[props.name];
|
|
@@ -143,7 +145,7 @@ var DataSourceMethodSelect_vue_vue_type_script_setup_true_name_true_lang_default
|
|
|
143
145
|
"size",
|
|
144
146
|
"disabled",
|
|
145
147
|
"prop"
|
|
146
|
-
]), __props.model[__props.name] && isCustomMethod.value && hasDataSourceSidePanel.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
148
|
+
]), __props.model[__props.name] && isCustomMethod.value && hasDataSourceSidePanel.value && !isCompare.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
147
149
|
key: 0,
|
|
148
150
|
content: notEditable.value ? "查看" : "编辑"
|
|
149
151
|
}, {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import CodeBlockEditor_default from "../components/CodeBlockEditor.js";
|
|
2
2
|
import { MagicTable } from "@tmagic/table";
|
|
3
3
|
import { TMagicButton, tMagicMessageBox } from "@tmagic/design";
|
|
4
|
-
import { createBlock, createCommentVNode, createElementBlock,
|
|
4
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, nextTick, openBlock, ref, unref, useTemplateRef, withCtx } from "vue";
|
|
5
5
|
import { cloneDeep } from "lodash-es";
|
|
6
6
|
//#region packages/editor/src/fields/DataSourceMethods.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var _hoisted_1 = { class: "m-editor-data-source-methods" };
|
|
8
|
-
var _hoisted_2 = {
|
|
8
|
+
var _hoisted_2 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "m-editor-data-source-methods-footer"
|
|
11
|
+
};
|
|
9
12
|
var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
10
13
|
name: "MFieldsDataSourceMethods",
|
|
11
14
|
__name: "DataSourceMethods",
|
|
@@ -28,6 +31,9 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
28
31
|
setup(__props, { emit: __emit }) {
|
|
29
32
|
const props = __props;
|
|
30
33
|
const emit = __emit;
|
|
34
|
+
const mForm = inject("mForm");
|
|
35
|
+
/** 对比模式下隐藏新增/编辑/删除等操作按钮,仅保留只读展示。 */
|
|
36
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
31
37
|
const codeConfig = ref();
|
|
32
38
|
const codeBlockEditorRef = useTemplateRef("codeBlockEditor");
|
|
33
39
|
let editIndex = -1;
|
|
@@ -78,6 +84,8 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
78
84
|
}]
|
|
79
85
|
}
|
|
80
86
|
];
|
|
87
|
+
/** 对比模式下移除「操作」列(编辑/删除按钮),仅保留只读列。 */
|
|
88
|
+
const displayColumns = computed(() => isCompare.value ? methodColumns.filter((col) => !col.actions) : methodColumns);
|
|
81
89
|
const createCodeHandler = () => {
|
|
82
90
|
codeConfig.value = {
|
|
83
91
|
name: "",
|
|
@@ -115,10 +123,10 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
115
123
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
116
124
|
createVNode(unref(MagicTable), {
|
|
117
125
|
data: __props.model[__props.name],
|
|
118
|
-
columns:
|
|
126
|
+
columns: displayColumns.value,
|
|
119
127
|
border: true
|
|
120
|
-
}, null, 8, ["data"]),
|
|
121
|
-
|
|
128
|
+
}, null, 8, ["data", "columns"]),
|
|
129
|
+
!isCompare.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(TMagicButton), {
|
|
122
130
|
size: "small",
|
|
123
131
|
type: "primary",
|
|
124
132
|
disabled: __props.disabled,
|
|
@@ -127,9 +135,9 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
127
135
|
}, {
|
|
128
136
|
default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("添加", -1)])]),
|
|
129
137
|
_: 1
|
|
130
|
-
}, 8, ["disabled"])]),
|
|
138
|
+
}, 8, ["disabled"])])) : createCommentVNode("v-if", true),
|
|
131
139
|
codeConfig.value ? (openBlock(), createBlock(CodeBlockEditor_default, {
|
|
132
|
-
key:
|
|
140
|
+
key: 1,
|
|
133
141
|
ref: "codeBlockEditor",
|
|
134
142
|
disabled: __props.disabled,
|
|
135
143
|
content: codeConfig.value,
|
|
@@ -7,10 +7,13 @@ import { MFormBox } from "@tmagic/form";
|
|
|
7
7
|
import { MagicTable } from "@tmagic/table";
|
|
8
8
|
import { TMagicButton, TMagicSwitch, tMagicMessageBox } from "@tmagic/design";
|
|
9
9
|
import { getDefaultValueFromFields } from "@tmagic/utils";
|
|
10
|
-
import {
|
|
10
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, isRef, mergeModels, openBlock, ref, unref, useModel, withCtx } from "vue";
|
|
11
11
|
//#region packages/editor/src/fields/DataSourceMocks.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var _hoisted_1 = { class: "m-editor-data-source-fields" };
|
|
13
|
-
var _hoisted_2 = {
|
|
13
|
+
var _hoisted_2 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "m-editor-data-source-fields-footer"
|
|
16
|
+
};
|
|
14
17
|
var DataSourceMocks_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
15
18
|
name: "MFieldsDataSourceMocks",
|
|
16
19
|
__name: "DataSourceMocks",
|
|
@@ -42,6 +45,9 @@ var DataSourceMocks_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
42
45
|
const props = __props;
|
|
43
46
|
const emit = __emit;
|
|
44
47
|
const { uiService } = useServices();
|
|
48
|
+
const mForm = inject("mForm");
|
|
49
|
+
/** 对比模式下隐藏新增/编辑/删除等操作按钮,仅保留只读展示。 */
|
|
50
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
45
51
|
const width = useModel(__props, "width");
|
|
46
52
|
const drawerTitle = ref("");
|
|
47
53
|
const formValues = ref({});
|
|
@@ -175,6 +181,8 @@ var DataSourceMocks_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
175
181
|
}]
|
|
176
182
|
}
|
|
177
183
|
];
|
|
184
|
+
/** 对比模式下移除「操作」列(编辑/删除按钮),仅保留只读列。 */
|
|
185
|
+
const displayColumns = computed(() => isCompare.value ? columns.filter((col) => !col.actions) : columns);
|
|
178
186
|
const newHandler = () => {
|
|
179
187
|
const isFirstRow = props.model[props.name].length === 0;
|
|
180
188
|
formValues.value = {
|
|
@@ -209,9 +217,9 @@ var DataSourceMocks_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
209
217
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
210
218
|
createVNode(unref(MagicTable), {
|
|
211
219
|
data: __props.model[__props.name],
|
|
212
|
-
columns
|
|
213
|
-
}, null, 8, ["data"]),
|
|
214
|
-
|
|
220
|
+
columns: displayColumns.value
|
|
221
|
+
}, null, 8, ["data", "columns"]),
|
|
222
|
+
!isCompare.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(TMagicButton), {
|
|
215
223
|
size: "small",
|
|
216
224
|
type: "primary",
|
|
217
225
|
disabled: __props.disabled,
|
|
@@ -220,7 +228,7 @@ var DataSourceMocks_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
220
228
|
}, {
|
|
221
229
|
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("添加", -1)])]),
|
|
222
230
|
_: 1
|
|
223
|
-
}, 8, ["disabled"])]),
|
|
231
|
+
}, 8, ["disabled"])])) : createCommentVNode("v-if", true),
|
|
224
232
|
createVNode(FloatingBox_default, {
|
|
225
233
|
visible: addDialogVisible.value,
|
|
226
234
|
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => addDialogVisible.value = $event),
|
|
@@ -34,6 +34,8 @@ var DataSourceSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
34
34
|
const eventBus = inject("eventBus");
|
|
35
35
|
const dataSources = computed(() => dataSourceService.get("dataSources"));
|
|
36
36
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
37
|
+
/** 对比模式下隐藏查看/编辑操作按钮,仅保留只读展示。 */
|
|
38
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
37
39
|
const hasDataSourceSidePanel = computed(() => uiService.get("sideBarItems").find((item) => item.$key === SideItemKey.DATA_SOURCE));
|
|
38
40
|
const selectConfig = computed(() => {
|
|
39
41
|
const { type, dataSourceType, value, ...config } = props.config;
|
|
@@ -80,7 +82,7 @@ var DataSourceSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
80
82
|
"disabled",
|
|
81
83
|
"config",
|
|
82
84
|
"last-values"
|
|
83
|
-
]), __props.model[__props.name] && hasDataSourceSidePanel.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
85
|
+
]), __props.model[__props.name] && hasDataSourceSidePanel.value && !isCompare.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
84
86
|
key: 0,
|
|
85
87
|
content: notEditable.value ? "查看" : "编辑"
|
|
86
88
|
}, {
|
|
@@ -4,7 +4,7 @@ import { MContainer, MPanel, MTable, defineFormItem } from "@tmagic/form";
|
|
|
4
4
|
import { TMagicButton } from "@tmagic/design";
|
|
5
5
|
import { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, traverseNode } from "@tmagic/utils";
|
|
6
6
|
import { ActionType } from "@tmagic/core";
|
|
7
|
-
import { Fragment, computed, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, renderList, unref, withCtx } from "vue";
|
|
7
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, renderList, unref, withCtx } from "vue";
|
|
8
8
|
import { has } from "lodash-es";
|
|
9
9
|
import { Delete } from "@element-plus/icons-vue";
|
|
10
10
|
//#region packages/editor/src/fields/EventSelect.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -243,6 +243,39 @@ var EventSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
243
243
|
if (props.model[props.name].length === 0) return false;
|
|
244
244
|
return !has(props.model[props.name][0], "actions");
|
|
245
245
|
});
|
|
246
|
+
/**
|
|
247
|
+
* 对比模式判定:
|
|
248
|
+
*
|
|
249
|
+
* event-select 内部由「事件列表 + 嵌套子表单」组成,属于复合字段。父级 `MFormContainer` 已将其
|
|
250
|
+
* 归入「自接管对比字段」(见 Container.vue 的 `SELF_DIFF_FIELD_TYPES`),即对比时只渲染一次本组件,
|
|
251
|
+
* 并把当前值 `model` 与历史值 `lastValues` 一并传入,由本组件把 `is-compare`/`lastValues` 透传给
|
|
252
|
+
* 内部的 MPanel / MFormContainer,逐项(事件名、动作)展示前后差异。
|
|
253
|
+
*
|
|
254
|
+
* 仅当存在历史值时才启用对比,避免 lastValues 缺失时退化为「全部新增」的空对比。
|
|
255
|
+
*/
|
|
256
|
+
const isCompareMode = computed(() => Boolean(props.isCompare && props.lastValues));
|
|
257
|
+
/**
|
|
258
|
+
* 待渲染的事件卡片列表。
|
|
259
|
+
*
|
|
260
|
+
* - 非对比模式:直接映射当前事件列表,`lastCardItem` 为空;
|
|
261
|
+
* - 对比模式:按索引对齐当前值与历史值,取两者长度的最大值,使得「新增」(仅当前有)与
|
|
262
|
+
* 「删除」(仅历史有)的事件都能被渲染出来;缺失的一侧用空对象兜底,从而让子级正确高亮差异。
|
|
263
|
+
*/
|
|
264
|
+
const displayList = computed(() => {
|
|
265
|
+
const current = props.model[props.name] || [];
|
|
266
|
+
if (!isCompareMode.value) return current.map((cardItem, index) => ({
|
|
267
|
+
cardItem,
|
|
268
|
+
lastCardItem: void 0,
|
|
269
|
+
index
|
|
270
|
+
}));
|
|
271
|
+
const last = props.lastValues?.[props.name] || [];
|
|
272
|
+
const length = Math.max(current.length, last.length);
|
|
273
|
+
return Array.from({ length }, (_, index) => ({
|
|
274
|
+
cardItem: current[index] ?? {},
|
|
275
|
+
lastCardItem: last[index] ?? {},
|
|
276
|
+
index
|
|
277
|
+
}));
|
|
278
|
+
});
|
|
246
279
|
const addEvent = () => {
|
|
247
280
|
const defaultEvent = {
|
|
248
281
|
name: "",
|
|
@@ -267,14 +300,19 @@ var EventSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
267
300
|
size: __props.size,
|
|
268
301
|
disabled: __props.disabled,
|
|
269
302
|
model: __props.model,
|
|
303
|
+
"last-values": __props.lastValues,
|
|
304
|
+
"is-compare": isCompareMode.value,
|
|
270
305
|
config: tableConfig.value,
|
|
271
306
|
onChange: onChangeHandler
|
|
272
307
|
}, null, 8, [
|
|
273
308
|
"size",
|
|
274
309
|
"disabled",
|
|
275
310
|
"model",
|
|
311
|
+
"last-values",
|
|
312
|
+
"is-compare",
|
|
276
313
|
"config"
|
|
277
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
314
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2, [!isCompareMode.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
315
|
+
key: 0,
|
|
278
316
|
class: "create-button",
|
|
279
317
|
type: "primary",
|
|
280
318
|
size: __props.size,
|
|
@@ -283,44 +321,51 @@ var EventSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
283
321
|
}, {
|
|
284
322
|
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("添加事件", -1)])]),
|
|
285
323
|
_: 1
|
|
286
|
-
}, 8, ["size", "disabled"]), (openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
324
|
+
}, 8, ["size", "disabled"])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(displayList.value, (entry) => {
|
|
287
325
|
return openBlock(), createBlock(unref(MPanel), {
|
|
288
|
-
key: index,
|
|
326
|
+
key: entry.index,
|
|
289
327
|
disabled: __props.disabled,
|
|
290
328
|
size: __props.size,
|
|
291
|
-
prop: `${__props.prop}.${index}`,
|
|
329
|
+
prop: `${__props.prop}.${entry.index}`,
|
|
292
330
|
config: actionsConfig.value,
|
|
293
|
-
model: cardItem,
|
|
331
|
+
model: entry.cardItem,
|
|
332
|
+
"last-values": entry.lastCardItem,
|
|
333
|
+
"is-compare": isCompareMode.value,
|
|
294
334
|
"label-width": __props.config.labelWidth || "100px",
|
|
295
335
|
onChange: onChangeHandler
|
|
296
336
|
}, {
|
|
297
337
|
header: withCtx(() => [createVNode(unref(MContainer), {
|
|
298
338
|
class: "fullWidth",
|
|
299
339
|
config: eventNameConfig.value,
|
|
300
|
-
model: cardItem,
|
|
340
|
+
model: entry.cardItem,
|
|
341
|
+
"last-values": entry.lastCardItem,
|
|
342
|
+
"is-compare": isCompareMode.value,
|
|
301
343
|
disabled: __props.disabled,
|
|
302
344
|
size: __props.size,
|
|
303
|
-
prop: `${__props.prop}.${index}`,
|
|
345
|
+
prop: `${__props.prop}.${entry.index}`,
|
|
304
346
|
onChange: eventNameChangeHandler
|
|
305
347
|
}, null, 8, [
|
|
306
348
|
"config",
|
|
307
349
|
"model",
|
|
350
|
+
"last-values",
|
|
351
|
+
"is-compare",
|
|
308
352
|
"disabled",
|
|
309
353
|
"size",
|
|
310
354
|
"prop"
|
|
311
|
-
]),
|
|
355
|
+
]), !isCompareMode.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
356
|
+
key: 0,
|
|
312
357
|
style: { "color": "#f56c6c" },
|
|
313
358
|
link: "",
|
|
314
359
|
icon: unref(Delete),
|
|
315
360
|
disabled: __props.disabled,
|
|
316
361
|
size: __props.size,
|
|
317
|
-
onClick: ($event) => removeEvent(Number(index))
|
|
362
|
+
onClick: ($event) => removeEvent(Number(entry.index))
|
|
318
363
|
}, null, 8, [
|
|
319
364
|
"icon",
|
|
320
365
|
"disabled",
|
|
321
366
|
"size",
|
|
322
367
|
"onClick"
|
|
323
|
-
])]),
|
|
368
|
+
])) : createCommentVNode("v-if", true)]),
|
|
324
369
|
_: 2
|
|
325
370
|
}, 1032, [
|
|
326
371
|
"disabled",
|
|
@@ -328,6 +373,8 @@ var EventSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
328
373
|
"prop",
|
|
329
374
|
"config",
|
|
330
375
|
"model",
|
|
376
|
+
"last-values",
|
|
377
|
+
"is-compare",
|
|
331
378
|
"label-width"
|
|
332
379
|
]);
|
|
333
380
|
}), 128))]))]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CodeEditor_default from "../layouts/CodeEditor.js";
|
|
2
2
|
import CodeIcon_default from "../icons/CodeIcon.js";
|
|
3
3
|
import { TMagicButton, TMagicInput } from "@tmagic/design";
|
|
4
|
-
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderList, unref, watchEffect, withCtx } from "vue";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, openBlock, ref, renderList, unref, watchEffect, withCtx } from "vue";
|
|
5
5
|
import { Delete, Plus } from "@element-plus/icons-vue";
|
|
6
6
|
//#region packages/editor/src/fields/KeyValue.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var _hoisted_1 = { class: "m-fields-key-value" };
|
|
@@ -28,6 +28,9 @@ var KeyValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
28
28
|
setup(__props, { emit: __emit }) {
|
|
29
29
|
const props = __props;
|
|
30
30
|
const emit = __emit;
|
|
31
|
+
const mForm = inject("mForm");
|
|
32
|
+
/** 对比模式下隐藏增删/代码切换等操作按钮,仅保留只读展示。 */
|
|
33
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
31
34
|
const records = ref([]);
|
|
32
35
|
const showCode = ref(false);
|
|
33
36
|
watchEffect(() => {
|
|
@@ -98,7 +101,8 @@ var KeyValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
98
101
|
"disabled",
|
|
99
102
|
"size"
|
|
100
103
|
]),
|
|
101
|
-
|
|
104
|
+
!isCompare.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
105
|
+
key: 0,
|
|
102
106
|
class: "m-fields-key-value-delete",
|
|
103
107
|
type: "danger",
|
|
104
108
|
size: __props.size,
|
|
@@ -112,9 +116,10 @@ var KeyValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
112
116
|
"disabled",
|
|
113
117
|
"icon",
|
|
114
118
|
"onClick"
|
|
115
|
-
])
|
|
119
|
+
])) : createCommentVNode("v-if", true)
|
|
116
120
|
]);
|
|
117
|
-
}), 128)),
|
|
121
|
+
}), 128)), !isCompare.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
122
|
+
key: 0,
|
|
118
123
|
type: "primary",
|
|
119
124
|
size: __props.size,
|
|
120
125
|
disabled: __props.disabled,
|
|
@@ -128,7 +133,7 @@ var KeyValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
128
133
|
"size",
|
|
129
134
|
"disabled",
|
|
130
135
|
"icon"
|
|
131
|
-
])])) : createCommentVNode("v-if", true),
|
|
136
|
+
])) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
|
|
132
137
|
__props.config.advanced && showCode.value ? (openBlock(), createBlock(CodeEditor_default, {
|
|
133
138
|
key: 1,
|
|
134
139
|
"editor-custom-type": "m-fields-key-value",
|
|
@@ -142,7 +147,7 @@ var KeyValue_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
142
147
|
parse: true,
|
|
143
148
|
onSave: save
|
|
144
149
|
}, null, 8, ["init-values", "options"])) : createCommentVNode("v-if", true),
|
|
145
|
-
__props.config.advanced ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
150
|
+
__props.config.advanced && !isCompare.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
146
151
|
key: 2,
|
|
147
152
|
size: "default",
|
|
148
153
|
disabled: __props.disabled,
|
|
@@ -2,7 +2,7 @@ import { UI_SELECT_MODE_EVENT_NAME } from "../utils/const.js";
|
|
|
2
2
|
import { useServices } from "../hooks/use-services.js";
|
|
3
3
|
import { TMagicButton, TMagicTooltip } from "@tmagic/design";
|
|
4
4
|
import { getIdFromEl } from "@tmagic/utils";
|
|
5
|
-
import { Fragment, computed, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, inject, openBlock, ref, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
5
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, openBlock, ref, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
6
6
|
import { throttle } from "lodash-es";
|
|
7
7
|
import { Close, Delete } from "@element-plus/icons-vue";
|
|
8
8
|
//#region packages/editor/src/fields/UISelect.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -34,6 +34,8 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
34
34
|
const mForm = inject("mForm");
|
|
35
35
|
const val = computed(() => props.model[props.name]);
|
|
36
36
|
const uiSelectMode = ref(false);
|
|
37
|
+
/** 对比模式下隐藏清除/选择等操作按钮,仅保留只读展示。 */
|
|
38
|
+
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
37
39
|
const cancelHandler = () => {
|
|
38
40
|
uiService.set("uiSelectMode", false);
|
|
39
41
|
uiSelectMode.value = false;
|
|
@@ -96,7 +98,8 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
96
98
|
"icon",
|
|
97
99
|
"disabled",
|
|
98
100
|
"size"
|
|
99
|
-
])])) : (openBlock(), createElementBlock("div", _hoisted_1, [val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
101
|
+
])])) : (openBlock(), createElementBlock("div", _hoisted_1, [val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [!isCompare.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
102
|
+
key: 0,
|
|
100
103
|
content: "清除",
|
|
101
104
|
placement: "top"
|
|
102
105
|
}, {
|
|
@@ -114,7 +117,7 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
114
117
|
"size"
|
|
115
118
|
])]),
|
|
116
119
|
_: 1
|
|
117
|
-
}), createVNode(unref(TMagicTooltip), {
|
|
120
|
+
})) : createCommentVNode("v-if", true), createVNode(unref(TMagicTooltip), {
|
|
118
121
|
content: "点击选中组件",
|
|
119
122
|
placement: "top"
|
|
120
123
|
}, {
|
|
@@ -134,7 +137,7 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
134
137
|
_: 1
|
|
135
138
|
}, 8, ["disabled", "size"])]),
|
|
136
139
|
_: 1
|
|
137
|
-
})], 64)) : (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
140
|
+
})], 64)) : !isCompare.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
138
141
|
key: 1,
|
|
139
142
|
content: "点击此处选择",
|
|
140
143
|
placement: "top"
|
|
@@ -153,7 +156,7 @@ var UISelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defin
|
|
|
153
156
|
_: 1
|
|
154
157
|
}, 8, ["disabled", "size"])]),
|
|
155
158
|
_: 1
|
|
156
|
-
}))]));
|
|
159
|
+
})) : createCommentVNode("v-if", true)]));
|
|
157
160
|
};
|
|
158
161
|
}
|
|
159
162
|
});
|
|
@@ -36,9 +36,9 @@ var useCodeBlockEdit = (codeBlockService) => {
|
|
|
36
36
|
const deleteCode = async (key) => {
|
|
37
37
|
codeBlockService.deleteCodeDslByIds([key]);
|
|
38
38
|
};
|
|
39
|
-
const submitCodeBlockHandler = async (values) => {
|
|
39
|
+
const submitCodeBlockHandler = async (values, eventData) => {
|
|
40
40
|
if (!codeId.value) return;
|
|
41
|
-
await codeBlockService.setCodeDslById(codeId.value, values);
|
|
41
|
+
await codeBlockService.setCodeDslById(codeId.value, values, { changeRecords: eventData?.changeRecords });
|
|
42
42
|
codeBlockEditorRef.value?.hide();
|
|
43
43
|
};
|
|
44
44
|
return {
|
|
@@ -38,7 +38,8 @@ var useStage = (stageOptions) => {
|
|
|
38
38
|
guidesOptions: stageOptions.guidesOptions,
|
|
39
39
|
disabledMultiSelect: stageOptions.disabledMultiSelect,
|
|
40
40
|
alwaysMultiSelect: stageOptions.alwaysMultiSelect,
|
|
41
|
-
disabledRule: stageOptions.disabledRule
|
|
41
|
+
disabledRule: stageOptions.disabledRule,
|
|
42
|
+
disabledFlashTip: stageOptions.disabledFlashTip
|
|
42
43
|
});
|
|
43
44
|
watch(() => editor_default.get("disabledMultiSelect"), (disabledMultiSelect) => {
|
|
44
45
|
if (disabledMultiSelect) stage.disableMultiSelect();
|
|
@@ -69,25 +70,33 @@ var useStage = (stageOptions) => {
|
|
|
69
70
|
});
|
|
70
71
|
stage.on("update", (ev) => {
|
|
71
72
|
if (ev.parentEl) {
|
|
72
|
-
|
|
73
|
+
const pId = getIdFromEl()(ev.parentEl);
|
|
74
|
+
if (!pId) return;
|
|
75
|
+
const configs = ev.data.map((data) => {
|
|
73
76
|
const id = getIdFromEl()(data.el);
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
if (!id) return null;
|
|
78
|
+
return {
|
|
76
79
|
id,
|
|
77
80
|
style: data.style
|
|
78
|
-
}
|
|
79
|
-
}
|
|
81
|
+
};
|
|
82
|
+
}).filter((cfg) => Boolean(cfg));
|
|
83
|
+
if (configs.length > 0) editor_default.moveToContainer(configs, pId);
|
|
80
84
|
return;
|
|
81
85
|
}
|
|
86
|
+
const configs = [];
|
|
87
|
+
const changeRecordList = [];
|
|
82
88
|
ev.data.forEach((data) => {
|
|
83
89
|
const id = getIdFromEl()(data.el);
|
|
84
90
|
if (!id) return;
|
|
85
91
|
const { style = {} } = data;
|
|
86
|
-
|
|
92
|
+
configs.push({
|
|
87
93
|
id,
|
|
88
94
|
style
|
|
89
|
-
}
|
|
95
|
+
});
|
|
96
|
+
changeRecordList.push(buildChangeRecords(style, "style"));
|
|
90
97
|
});
|
|
98
|
+
if (configs.length === 0) return;
|
|
99
|
+
editor_default.update(configs, { changeRecordList });
|
|
91
100
|
});
|
|
92
101
|
stage.on("sort", (ev) => {
|
|
93
102
|
editor_default.sort(ev.src, ev.dist);
|
package/dist/es/index.js
CHANGED
|
@@ -21,6 +21,7 @@ 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";
|
|
23
23
|
import { useNodeStatus } from "./hooks/use-node-status.js";
|
|
24
|
+
import { getCodeBlockFormConfig } from "./utils/code-block.js";
|
|
24
25
|
import { debug, error, info, log, warn } from "./utils/logger.js";
|
|
25
26
|
import { getCascaderOptionsFromFields, getDisplayField, getFieldType, getFormConfig, getFormValue } from "./utils/data-source/index.js";
|
|
26
27
|
import { IdleTask } from "./utils/dep/idle-task.js";
|
|
@@ -31,6 +32,9 @@ import SplitView_default from "./components/SplitView.js";
|
|
|
31
32
|
import Icon_default from "./components/Icon.js";
|
|
32
33
|
import ToolButton_default from "./components/ToolButton.js";
|
|
33
34
|
import CodeEditor_default from "./layouts/CodeEditor.js";
|
|
35
|
+
import Bucket_default from "./layouts/history-list/Bucket.js";
|
|
36
|
+
import CompareForm_default from "./components/CompareForm.js";
|
|
37
|
+
import HistoryDiffDialog_default from "./layouts/history-list/HistoryDiffDialog.js";
|
|
34
38
|
import FormPanel_default from "./layouts/props-panel/FormPanel.js";
|
|
35
39
|
import PropsPanel_default from "./layouts/props-panel/PropsPanel.js";
|
|
36
40
|
import FloatingBox_default from "./components/FloatingBox.js";
|
|
@@ -76,4 +80,4 @@ export * from "@tmagic/table";
|
|
|
76
80
|
export * from "@tmagic/stage";
|
|
77
81
|
export * from "@tmagic/design";
|
|
78
82
|
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, 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 };
|
|
83
|
+
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, CompareForm_default as CompareForm, 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, HistoryDiffDialog_default as HistoryDiffDialog, Bucket_default as HistoryListBucket, 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, getCodeBlockFormConfig, 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 };
|
package/dist/es/initService.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isIncludeDataSource } from "./utils/editor.js";
|
|
|
2
2
|
import { getDepNodeIds, getNodes, isPage, isValueIncludeDataSource } from "@tmagic/utils";
|
|
3
3
|
import { DepTargetType, NODE_CONDS_KEY, NodeType, createCodeBlockTarget, createDataSourceCondTarget, createDataSourceMethodTarget, createDataSourceTarget, updateNode } from "@tmagic/core";
|
|
4
4
|
import { nextTick, onBeforeUnmount, reactive, toRaw, watch } from "vue";
|
|
5
|
-
import { cloneDeep } from "lodash-es";
|
|
5
|
+
import { cloneDeep as cloneDeep$1 } from "lodash-es";
|
|
6
6
|
//#region packages/editor/src/initService.ts
|
|
7
7
|
var initServiceState = (props, { editorService, historyService, componentListService, propsService, eventsService, uiService, codeBlockService, keybindingService, dataSourceService, depService }) => {
|
|
8
8
|
watch(() => props.modelValue, (modelValue) => {
|
|
@@ -86,9 +86,9 @@ var initServiceEvents = (props, emit, { editorService, codeBlockService, dataSou
|
|
|
86
86
|
const root = editorService.get("root");
|
|
87
87
|
if (!root) return;
|
|
88
88
|
return editorService.get("stage")?.update({
|
|
89
|
-
config: cloneDeep(node),
|
|
89
|
+
config: cloneDeep$1(node),
|
|
90
90
|
parentId: editorService.getParentById(node.id)?.id,
|
|
91
|
-
root: cloneDeep(root)
|
|
91
|
+
root: cloneDeep$1(root)
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
const updateDataSourceSchema = async () => {
|
|
@@ -128,7 +128,7 @@ var initServiceEvents = (props, emit, { editorService, codeBlockService, dataSou
|
|
|
128
128
|
if (!stage) return;
|
|
129
129
|
stage.reloadIframe(url);
|
|
130
130
|
stage.renderer?.once("runtime-ready", (runtime) => {
|
|
131
|
-
runtime.updateRootConfig?.(cloneDeep(toRaw(editorService.get("root"))));
|
|
131
|
+
runtime.updateRootConfig?.(cloneDeep$1(toRaw(editorService.get("root"))));
|
|
132
132
|
const page = editorService.get("page");
|
|
133
133
|
const node = editorService.get("node");
|
|
134
134
|
page?.id && runtime?.updatePageId?.(page.id);
|
|
@@ -155,7 +155,7 @@ var initServiceEvents = (props, emit, { editorService, codeBlockService, dataSou
|
|
|
155
155
|
const stage = await getStage();
|
|
156
156
|
const runtime = await stage.renderer?.getRuntime();
|
|
157
157
|
const app = await getTMagicApp();
|
|
158
|
-
if (!app?.dataSourceManager) runtime?.updateRootConfig?.(cloneDeep(toRaw(value)));
|
|
158
|
+
if (!app?.dataSourceManager) runtime?.updateRootConfig?.(cloneDeep$1(toRaw(value)));
|
|
159
159
|
const page = editorService.get("page");
|
|
160
160
|
const node = editorService.get("node");
|
|
161
161
|
page?.id && runtime?.updatePageId?.(page.id);
|
|
@@ -165,7 +165,7 @@ var initServiceEvents = (props, emit, { editorService, codeBlockService, dataSou
|
|
|
165
165
|
if (value) {
|
|
166
166
|
depService.clearIdleTasks();
|
|
167
167
|
await (typeof Worker === "undefined" ? collectIdle(value.items, true) : depService.collectByWorker(value));
|
|
168
|
-
const dsl = cloneDeep(toRaw(value));
|
|
168
|
+
const dsl = cloneDeep$1(toRaw(value));
|
|
169
169
|
if (dsl.dataSources && dsl.dataSourceDeps && app?.dataSourceManager) for (const node of getNodes(getDepNodeIds(dsl.dataSourceDeps), dsl.items)) updateNode(app.dataSourceManager.compiledNode(node), dsl);
|
|
170
170
|
runtime?.updateRootConfig?.(dsl);
|
|
171
171
|
}
|