@tmagic/editor 1.8.0-beta.4 → 1.8.0-beta.6
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/components/CompareForm.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/es/fields/CodeSelectCol.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js +8 -2
- package/dist/es/fields/DataSourceFields.vue_vue_type_script_setup_true_lang.js +25 -8
- package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js +6 -4
- package/dist/es/fields/DataSourceMethods.vue_vue_type_script_setup_true_lang.js +25 -12
- package/dist/es/fields/StyleSetter/components/Border.vue_vue_type_script_setup_true_lang.js +27 -5
- package/dist/es/index.js +6 -3
- package/dist/es/initService.js +1 -1
- package/dist/es/layouts/Framework.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/layouts/history-list/Bucket.vue_vue_type_script_setup_true_lang.js +19 -55
- package/dist/es/layouts/history-list/BucketTab.vue_vue_type_script_setup_true_lang.js +22 -39
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +149 -103
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +32 -8
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +335 -213
- package/dist/es/layouts/history-list/InitialRow.vue_vue_type_script_setup_true_lang.js +36 -7
- package/dist/es/layouts/history-list/PageTab.vue_vue_type_script_setup_true_lang.js +47 -60
- package/dist/es/layouts/history-list/composables.js +73 -32
- package/dist/es/layouts/page-bar/PageBar.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +16 -3
- package/dist/es/layouts/sidebar/data-source/DataSourceListPanel.vue_vue_type_script_setup_true_lang.js +23 -1
- package/dist/es/services/codeBlock.js +96 -37
- package/dist/es/services/dataSource.js +70 -26
- package/dist/es/services/editor.js +266 -104
- package/dist/es/services/history.js +271 -212
- package/dist/es/services/ui.js +3 -0
- package/dist/es/style.css +53 -7
- package/dist/es/utils/data-source/index.js +2 -0
- package/dist/es/utils/editor.js +103 -49
- package/dist/es/utils/history.js +232 -0
- package/dist/es/utils/indexed-db.js +86 -0
- package/dist/es/utils/undo-redo.js +60 -1
- package/dist/style.css +53 -7
- package/dist/tmagic-editor.umd.cjs +2064 -1000
- package/package.json +7 -7
- package/src/components/CompareForm.vue +3 -1
- package/src/components/ToolButton.vue +2 -2
- package/src/fields/CodeSelectCol.vue +7 -1
- package/src/fields/DataSourceFieldSelect/FieldSelect.vue +16 -2
- package/src/fields/DataSourceFields.vue +37 -8
- package/src/fields/DataSourceMethodSelect.vue +9 -4
- package/src/fields/DataSourceMethods.vue +42 -21
- package/src/fields/StyleSetter/components/Border.vue +15 -6
- package/src/index.ts +1 -0
- package/src/initService.ts +1 -1
- package/src/layouts/Framework.vue +1 -1
- package/src/layouts/history-list/Bucket.vue +34 -71
- package/src/layouts/history-list/BucketTab.vue +46 -54
- package/src/layouts/history-list/GroupRow.vue +146 -111
- package/src/layouts/history-list/HistoryDiffDialog.vue +94 -68
- package/src/layouts/history-list/HistoryListPanel.vue +298 -115
- package/src/layouts/history-list/InitialRow.vue +28 -9
- package/src/layouts/history-list/PageTab.vue +57 -51
- package/src/layouts/history-list/composables.ts +157 -36
- package/src/layouts/page-bar/PageBar.vue +4 -2
- package/src/layouts/sidebar/Sidebar.vue +6 -1
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +30 -2
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +26 -1
- package/src/services/codeBlock.ts +113 -37
- package/src/services/dataSource.ts +94 -40
- package/src/services/editor.ts +376 -136
- package/src/services/history.ts +306 -209
- package/src/services/ui.ts +7 -0
- package/src/theme/history-list-panel.scss +72 -5
- package/src/theme/page-bar.scss +0 -4
- package/src/theme/style-setter/border.scss +4 -1
- package/src/type.ts +183 -64
- package/src/utils/data-source/index.ts +2 -0
- package/src/utils/editor.ts +166 -60
- package/src/utils/history.ts +308 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/indexed-db.ts +122 -0
- package/src/utils/undo-redo.ts +88 -0
- package/types/index.d.ts +813 -302
|
@@ -101,7 +101,7 @@ var CompareForm_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
101
101
|
switch (props.category) {
|
|
102
102
|
case "node":
|
|
103
103
|
if (!props.type) return [];
|
|
104
|
-
return removeStyleDisplayConfig(await propsService.getPropsConfig(props.type));
|
|
104
|
+
return removeStyleDisplayConfig(await propsService.getPropsConfig(props.type, { node: props.value }));
|
|
105
105
|
case "data-source": return dataSourceService.getFormConfig(props.type || "base");
|
|
106
106
|
case "code-block": return getCodeBlockFormConfig({
|
|
107
107
|
paramColConfig: codeBlockService.getParamsColConfig(),
|
|
@@ -73,11 +73,11 @@ var ToolButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
73
73
|
placement: "bottom-start",
|
|
74
74
|
content: __props.data.tooltip
|
|
75
75
|
}, {
|
|
76
|
-
default: withCtx(() => [createVNode(unref(TMagicButton), {
|
|
76
|
+
default: withCtx(() => [createVNode(unref(TMagicButton), mergeProps({
|
|
77
77
|
size: "small",
|
|
78
78
|
link: "",
|
|
79
79
|
disabled: disabled.value
|
|
80
|
-
}, createSlots({ _: 2 }, [__props.data.icon ? {
|
|
80
|
+
}, __props.data.buttonProps || {}), createSlots({ _: 2 }, [__props.data.icon ? {
|
|
81
81
|
name: "icon",
|
|
82
82
|
fn: withCtx(() => [createVNode(Icon_default, { icon: __props.data.icon }, null, 8, ["icon"])]),
|
|
83
83
|
key: "0"
|
|
@@ -85,15 +85,15 @@ var ToolButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
85
85
|
name: "default",
|
|
86
86
|
fn: withCtx(() => [createTextVNode(toDisplayString(__props.data.text), 1)]),
|
|
87
87
|
key: "1"
|
|
88
|
-
} : void 0]),
|
|
88
|
+
} : void 0]), 1040, ["disabled"])]),
|
|
89
89
|
_: 1
|
|
90
|
-
}, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), {
|
|
90
|
+
}, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), mergeProps({
|
|
91
91
|
key: 1,
|
|
92
92
|
size: "small",
|
|
93
93
|
link: "",
|
|
94
94
|
disabled: disabled.value,
|
|
95
95
|
title: __props.data.text
|
|
96
|
-
}, createSlots({ _: 2 }, [__props.data.icon ? {
|
|
96
|
+
}, __props.data.buttonProps || {}), createSlots({ _: 2 }, [__props.data.icon ? {
|
|
97
97
|
name: "icon",
|
|
98
98
|
fn: withCtx(() => [createVNode(Icon_default, { icon: __props.data.icon }, null, 8, ["icon"])]),
|
|
99
99
|
key: "0"
|
|
@@ -101,7 +101,7 @@ var ToolButton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
101
101
|
name: "default",
|
|
102
102
|
fn: withCtx(() => [createTextVNode(toDisplayString(__props.data.text), 1)]),
|
|
103
103
|
key: "1"
|
|
104
|
-
} : void 0]),
|
|
104
|
+
} : void 0]), 1040, ["disabled", "title"]))], 64)) : __props.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
|
|
105
105
|
key: 3,
|
|
106
106
|
trigger: "click",
|
|
107
107
|
disabled: disabled.value,
|
|
@@ -47,7 +47,8 @@ var CodeSelectCol_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
47
47
|
*/
|
|
48
48
|
const isCompareMode = computed(() => Boolean(props.isCompare && props.lastValues));
|
|
49
49
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
50
|
-
const
|
|
50
|
+
const codeBlockSidePanel = computed(() => (uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.CODE_BLOCK));
|
|
51
|
+
const hasCodeBlockSidePanel = computed(() => codeBlockSidePanel.value);
|
|
51
52
|
/**
|
|
52
53
|
* 根据代码块id获取代码块参数配置
|
|
53
54
|
* @param codeId 代码块ID
|
|
@@ -102,6 +103,8 @@ var CodeSelectCol_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
102
103
|
emit("change", props.model[props.name], eventData);
|
|
103
104
|
};
|
|
104
105
|
const editCode = (id) => {
|
|
106
|
+
const sideBarItem = codeBlockSidePanel.value;
|
|
107
|
+
if (sideBarItem) uiService.set("sideBarActiveTabName", sideBarItem.text || sideBarItem.$key || SideItemKey.CODE_BLOCK);
|
|
105
108
|
eventBus?.emit("edit-code", id);
|
|
106
109
|
};
|
|
107
110
|
return (_ctx, _cache) => {
|
package/dist/es/fields/DataSourceFieldSelect/FieldSelect.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -89,9 +89,15 @@ var FieldSelect_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
89
89
|
modelValue.value = v;
|
|
90
90
|
emit("change", v);
|
|
91
91
|
};
|
|
92
|
-
const
|
|
92
|
+
const dataSourceSidePanel = computed(() => uiService.get("sideBarItems").find((item) => item.$key === SideItemKey.DATA_SOURCE));
|
|
93
|
+
const hasDataSourceSidePanel = computed(() => dataSourceSidePanel.value);
|
|
93
94
|
const editHandler = (id) => {
|
|
94
|
-
|
|
95
|
+
const sideBarItem = dataSourceSidePanel.value;
|
|
96
|
+
if (sideBarItem) uiService.set("sideBarActiveTabName", sideBarItem.text || sideBarItem.$key || SideItemKey.DATA_SOURCE);
|
|
97
|
+
const dataSourceId = removeDataSourceFieldPrefix(id);
|
|
98
|
+
const fieldPath = selectFieldsId.value;
|
|
99
|
+
if (fieldPath.length) eventBus?.emit("edit-data-source-field", dataSourceId, [...fieldPath]);
|
|
100
|
+
else eventBus?.emit("edit-data-source", dataSourceId);
|
|
95
101
|
};
|
|
96
102
|
return (_ctx, _cache) => {
|
|
97
103
|
return openBlock(), createElementBlock("div", _hoisted_1, [__props.dataSourceId ? (openBlock(), createBlock(unref(TMagicCascader), {
|
|
@@ -7,7 +7,7 @@ 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 { computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, isRef, mergeModels, openBlock, ref, unref, useModel, withCtx } from "vue";
|
|
10
|
+
import { computed, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, isRef, mergeModels, onMounted, openBlock, provide, 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
13
|
var _hoisted_2 = {
|
|
@@ -66,6 +66,15 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
66
66
|
calcBoxPosition();
|
|
67
67
|
addDialogVisible.value = true;
|
|
68
68
|
};
|
|
69
|
+
const editField = (row, index) => {
|
|
70
|
+
fieldValues.value = {
|
|
71
|
+
...row,
|
|
72
|
+
index
|
|
73
|
+
};
|
|
74
|
+
fieldTitle.value = `编辑${row.title}`;
|
|
75
|
+
calcBoxPosition();
|
|
76
|
+
addDialogVisible.value = true;
|
|
77
|
+
};
|
|
69
78
|
const fieldChange = ({ index, ...value }, data) => {
|
|
70
79
|
addDialogVisible.value = false;
|
|
71
80
|
if (index > -1) emit("change", value, {
|
|
@@ -117,13 +126,7 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
117
126
|
actions: [{
|
|
118
127
|
text: "编辑",
|
|
119
128
|
handler: (row, index) => {
|
|
120
|
-
|
|
121
|
-
...row,
|
|
122
|
-
index
|
|
123
|
-
};
|
|
124
|
-
fieldTitle.value = `编辑${row.title}`;
|
|
125
|
-
calcBoxPosition();
|
|
126
|
-
addDialogVisible.value = true;
|
|
129
|
+
editField(row, index);
|
|
127
130
|
}
|
|
128
131
|
}, {
|
|
129
132
|
text: "删除",
|
|
@@ -310,6 +313,20 @@ var DataSourceFields_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
310
313
|
const addFromJsonDialogVisible = useModel(__props, "visible1");
|
|
311
314
|
const { height: editorHeight } = useEditorContentHeight();
|
|
312
315
|
const { boxPosition, calcBoxPosition } = useNextFloatBoxPosition(uiService, inject("parentFloating", ref(null)));
|
|
316
|
+
/**
|
|
317
|
+
* 由 DataSourceConfigPanel 注入:打开数据源详情后需要直接打开的字段路径(字段名数组)。
|
|
318
|
+
* 当前层消费 path[0],并把剩余路径下发给嵌套字段,实现逐层打开。
|
|
319
|
+
*/
|
|
320
|
+
const editingFieldPath = inject("editingDataSourceFieldPath", computed(() => []));
|
|
321
|
+
provide("editingDataSourceFieldPath", computed(() => editingFieldPath.value.slice(1)));
|
|
322
|
+
onMounted(() => {
|
|
323
|
+
const path = editingFieldPath.value;
|
|
324
|
+
if (!path.length) return;
|
|
325
|
+
const fields = props.model[props.name] || [];
|
|
326
|
+
const index = fields.findIndex((field) => field.name === path[0]);
|
|
327
|
+
if (index === -1) return;
|
|
328
|
+
editField(fields[index], index);
|
|
329
|
+
});
|
|
313
330
|
return (_ctx, _cache) => {
|
|
314
331
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
315
332
|
createVNode(unref(MagicTable), {
|
package/dist/es/fields/DataSourceMethodSelect.vue_vue_type_script_setup_true_name_true_lang.js
CHANGED
|
@@ -36,7 +36,7 @@ var DataSourceMethodSelect_vue_vue_type_script_setup_true_name_true_lang_default
|
|
|
36
36
|
const eventBus = inject("eventBus");
|
|
37
37
|
const emit = __emit;
|
|
38
38
|
const props = __props;
|
|
39
|
-
const
|
|
39
|
+
const dataSourceSidePanel = computed(() => (uiService.get("sideBarItems") || []).find((item) => item.$key === SideItemKey.DATA_SOURCE));
|
|
40
40
|
const notEditable = computed(() => filterFunction(mForm, props.config.notEditable, props));
|
|
41
41
|
/** 对比模式下隐藏查看/编辑操作按钮,仅保留只读展示。 */
|
|
42
42
|
const isCompare = computed(() => Boolean(mForm?.isCompare));
|
|
@@ -124,9 +124,11 @@ var DataSourceMethodSelect_vue_vue_type_script_setup_true_name_true_lang_default
|
|
|
124
124
|
emit("change", props.model[props.name], eventData);
|
|
125
125
|
};
|
|
126
126
|
const editCodeHandler = () => {
|
|
127
|
-
const [id] = props.model[props.name];
|
|
127
|
+
const [id, methodName] = props.model[props.name];
|
|
128
128
|
if (!dataSourceService.getDataSourceById(id)) return;
|
|
129
|
-
|
|
129
|
+
const sideBarItem = dataSourceSidePanel.value;
|
|
130
|
+
if (sideBarItem) uiService.set("sideBarActiveTabName", sideBarItem.text || sideBarItem.$key || SideItemKey.DATA_SOURCE);
|
|
131
|
+
eventBus?.emit("edit-data-source-method", id, methodName);
|
|
130
132
|
};
|
|
131
133
|
return (_ctx, _cache) => {
|
|
132
134
|
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createVNode(unref(MCascader), {
|
|
@@ -145,7 +147,7 @@ var DataSourceMethodSelect_vue_vue_type_script_setup_true_name_true_lang_default
|
|
|
145
147
|
"size",
|
|
146
148
|
"disabled",
|
|
147
149
|
"prop"
|
|
148
|
-
]), __props.model[__props.name] && isCustomMethod.value &&
|
|
150
|
+
]), __props.model[__props.name] && isCustomMethod.value && dataSourceSidePanel.value && !isCompare.value ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
149
151
|
key: 0,
|
|
150
152
|
content: notEditable.value ? "查看" : "编辑"
|
|
151
153
|
}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, nextTick, openBlock, ref, unref, useTemplateRef, withCtx } from "vue";
|
|
4
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, nextTick, onMounted, 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" };
|
|
@@ -37,6 +37,19 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
37
37
|
const codeConfig = ref();
|
|
38
38
|
const codeBlockEditorRef = useTemplateRef("codeBlockEditor");
|
|
39
39
|
let editIndex = -1;
|
|
40
|
+
const editMethod = (method, index) => {
|
|
41
|
+
let codeContent = "({ params, dataSource, app }) => {\n // place your code here\n}";
|
|
42
|
+
if (method.content) if (typeof method.content !== "string") codeContent = method.content.toString();
|
|
43
|
+
else codeContent = method.content;
|
|
44
|
+
codeConfig.value = {
|
|
45
|
+
...cloneDeep(method),
|
|
46
|
+
content: codeContent
|
|
47
|
+
};
|
|
48
|
+
editIndex = index;
|
|
49
|
+
nextTick(() => {
|
|
50
|
+
codeBlockEditorRef.value?.show();
|
|
51
|
+
});
|
|
52
|
+
};
|
|
40
53
|
const methodColumns = [
|
|
41
54
|
{
|
|
42
55
|
label: "名称",
|
|
@@ -61,17 +74,7 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
61
74
|
actions: [{
|
|
62
75
|
text: "编辑",
|
|
63
76
|
handler: (method, index) => {
|
|
64
|
-
|
|
65
|
-
if (method.content) if (typeof method.content !== "string") codeContent = method.content.toString();
|
|
66
|
-
else codeContent = method.content;
|
|
67
|
-
codeConfig.value = {
|
|
68
|
-
...cloneDeep(method),
|
|
69
|
-
content: codeContent
|
|
70
|
-
};
|
|
71
|
-
editIndex = index;
|
|
72
|
-
nextTick(() => {
|
|
73
|
-
codeBlockEditorRef.value?.show();
|
|
74
|
-
});
|
|
77
|
+
editMethod(method, index);
|
|
75
78
|
}
|
|
76
79
|
}, {
|
|
77
80
|
text: "删除",
|
|
@@ -119,6 +122,16 @@ var DataSourceMethods_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
119
122
|
codeConfig.value = void 0;
|
|
120
123
|
codeBlockEditorRef.value?.hide();
|
|
121
124
|
};
|
|
125
|
+
/** 由 DataSourceConfigPanel 注入:打开数据源详情后需要直接打开的方法名 */
|
|
126
|
+
const editingMethodName = inject("editingDataSourceMethodName", computed(() => ""));
|
|
127
|
+
onMounted(() => {
|
|
128
|
+
const methodName = editingMethodName.value;
|
|
129
|
+
if (!methodName) return;
|
|
130
|
+
const methods = props.model[props.name] || [];
|
|
131
|
+
const index = methods.findIndex((method) => method.name === methodName);
|
|
132
|
+
if (index === -1) return;
|
|
133
|
+
editMethod(methods[index], index);
|
|
134
|
+
});
|
|
122
135
|
return (_ctx, _cache) => {
|
|
123
136
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
124
137
|
createVNode(unref(MagicTable), {
|
|
@@ -54,6 +54,13 @@ var Border_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
54
54
|
] }));
|
|
55
55
|
const selectDirection = (d) => direction.value = d || "";
|
|
56
56
|
const emit = __emit;
|
|
57
|
+
const props = __props;
|
|
58
|
+
const hasValue = (value) => value !== void 0 && value !== null && value !== "";
|
|
59
|
+
const isConfigured = (d) => [
|
|
60
|
+
"Width",
|
|
61
|
+
"Color",
|
|
62
|
+
"Style"
|
|
63
|
+
].some((key) => hasValue(props.model?.[`border${d}${key}`]));
|
|
57
64
|
const change = (value, eventData) => {
|
|
58
65
|
eventData.changeRecords?.forEach((record) => {
|
|
59
66
|
emit("change", record.value, { modifyKey: record.propPath });
|
|
@@ -63,25 +70,40 @@ var Border_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
63
70
|
return (_ctx, _cache) => {
|
|
64
71
|
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
|
|
65
72
|
createElementVNode("div", _hoisted_3, [createElementVNode("div", {
|
|
66
|
-
class: normalizeClass(["border-icon border-icon-top", {
|
|
73
|
+
class: normalizeClass(["border-icon border-icon-top", {
|
|
74
|
+
active: direction.value === "Top",
|
|
75
|
+
configured: isConfigured("Top")
|
|
76
|
+
}]),
|
|
67
77
|
onClick: _cache[0] || (_cache[0] = ($event) => selectDirection("Top"))
|
|
68
78
|
}, null, 2)]),
|
|
69
79
|
createElementVNode("div", _hoisted_4, [
|
|
70
80
|
createElementVNode("div", {
|
|
71
|
-
class: normalizeClass(["border-icon border-icon-left", {
|
|
81
|
+
class: normalizeClass(["border-icon border-icon-left", {
|
|
82
|
+
active: direction.value === "Left",
|
|
83
|
+
configured: isConfigured("Left")
|
|
84
|
+
}]),
|
|
72
85
|
onClick: _cache[1] || (_cache[1] = ($event) => selectDirection("Left"))
|
|
73
86
|
}, null, 2),
|
|
74
87
|
createElementVNode("div", {
|
|
75
|
-
class: normalizeClass(["border-icon", {
|
|
88
|
+
class: normalizeClass(["border-icon", {
|
|
89
|
+
active: direction.value === "",
|
|
90
|
+
configured: isConfigured("")
|
|
91
|
+
}]),
|
|
76
92
|
onClick: _cache[2] || (_cache[2] = ($event) => selectDirection())
|
|
77
93
|
}, null, 2),
|
|
78
94
|
createElementVNode("div", {
|
|
79
|
-
class: normalizeClass(["border-icon border-icon-right", {
|
|
95
|
+
class: normalizeClass(["border-icon border-icon-right", {
|
|
96
|
+
active: direction.value === "Right",
|
|
97
|
+
configured: isConfigured("Right")
|
|
98
|
+
}]),
|
|
80
99
|
onClick: _cache[3] || (_cache[3] = ($event) => selectDirection("Right"))
|
|
81
100
|
}, null, 2)
|
|
82
101
|
]),
|
|
83
102
|
createElementVNode("div", _hoisted_5, [createElementVNode("div", {
|
|
84
|
-
class: normalizeClass(["border-icon border-icon-bottom", {
|
|
103
|
+
class: normalizeClass(["border-icon border-icon-bottom", {
|
|
104
|
+
active: direction.value === "Bottom",
|
|
105
|
+
configured: isConfigured("Bottom")
|
|
106
|
+
}]),
|
|
85
107
|
onClick: _cache[4] || (_cache[4] = ($event) => selectDirection("Bottom"))
|
|
86
108
|
}, null, 2)])
|
|
87
109
|
]), createElementVNode("div", _hoisted_6, [createVNode(unref(MContainer), {
|
package/dist/es/index.js
CHANGED
|
@@ -2,11 +2,13 @@ import { CODE_DRAFT_STORAGE_KEY, CodeDeleteErrorType, ColumnLayout, DragType, Ke
|
|
|
2
2
|
import { useCodeBlockEdit } from "./hooks/use-code-block-edit.js";
|
|
3
3
|
import { advancedTabConfig, arrayOptions, displayTabConfig, eqOptions, eventTabConfig, fillConfig, numberOptions, styleTabConfig } from "./utils/props.js";
|
|
4
4
|
import props_default from "./services/props.js";
|
|
5
|
+
import { getEditorConfig, setEditorConfig } from "./utils/config.js";
|
|
5
6
|
import { UndoRedo } from "./utils/undo-redo.js";
|
|
7
|
+
import { createStackStep, describeRevertStep, deserializeStacks, detectPageTargetId, detectPageTargetName, detectStackOpType, getLastPushedHistoryIds, getOrCreateStack, markStackSaved, mergePageSteps, mergeStackSteps, serializeStacks, undoFloor } from "./utils/history.js";
|
|
8
|
+
import { idbDelete, idbGet, idbSet, isIndexedDBSupported, openIndexedDB } from "./utils/indexed-db.js";
|
|
6
9
|
import history_default from "./services/history.js";
|
|
7
|
-
import { getEditorConfig, setEditorConfig } from "./utils/config.js";
|
|
8
10
|
import storage_default from "./services/storage.js";
|
|
9
|
-
import { COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, Fixed2Other, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, change2Fixed, classifyDragSources, collectRelatedNodes, editorNodeMergeCustomizer, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getRelativeStyle, isIncludeDataSource, moveItemsInContainer, resolveSelectedNode, serializeConfig, setChildrenLayout, setLayout, toggleFixedPosition } from "./utils/editor.js";
|
|
11
|
+
import { COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, Fixed2Other, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, change2Fixed, classifyDragSources, collectRelatedNodes, describeStepForRevert, editorNodeMergeCustomizer, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageFragmentList, getPageList, getPageNameList, getRelativeStyle, isIncludeDataSource, moveItemsInContainer, resolveSelectedNode, serializeConfig, setChildrenLayout, setLayout, toggleFixedPosition } from "./utils/editor.js";
|
|
10
12
|
import { beforePaste, getAddParent, getDefaultConfig, getPositionInContainer } from "./utils/operator.js";
|
|
11
13
|
import editor_default from "./services/editor.js";
|
|
12
14
|
import { DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, H_GUIDE_LINE_STORAGE_KEY, LEFT_COLUMN_WIDTH_STORAGE_KEY, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, PROPS_PANEL_WIDTH_STORAGE_KEY, RIGHT_COLUMN_WIDTH_STORAGE_KEY, UI_SELECT_MODE_EVENT_NAME, V_GUIDE_LINE_STORAGE_KEY } from "./utils/const.js";
|
|
@@ -33,6 +35,7 @@ import Icon_default from "./components/Icon.js";
|
|
|
33
35
|
import ToolButton_default from "./components/ToolButton.js";
|
|
34
36
|
import CodeEditor_default from "./layouts/CodeEditor.js";
|
|
35
37
|
import Bucket_default from "./layouts/history-list/Bucket.js";
|
|
38
|
+
import BucketTab_default from "./layouts/history-list/BucketTab.js";
|
|
36
39
|
import CompareForm_default from "./components/CompareForm.js";
|
|
37
40
|
import HistoryDiffDialog_default from "./layouts/history-list/HistoryDiffDialog.js";
|
|
38
41
|
import FormPanel_default from "./layouts/props-panel/FormPanel.js";
|
|
@@ -80,4 +83,4 @@ export * from "@tmagic/table";
|
|
|
80
83
|
export * from "@tmagic/stage";
|
|
81
84
|
export * from "@tmagic/design";
|
|
82
85
|
export * from "@tmagic/utils";
|
|
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 };
|
|
86
|
+
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, BucketTab_default as HistoryListBucketTab, 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, createStackStep, dataSource_default as dataSourceService, debug, plugin_default as default, defaultIsExpandable, dep_default as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, 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, getLastPushedHistoryIds, getNodeIndex, getOrCreateStack, getPageFragmentList, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, history_default as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, monaco_editor_default as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, props_default as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, stageOverlay_default as stageOverlayService, storage_default as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, ui_default as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|
package/dist/es/initService.js
CHANGED
|
@@ -6,7 +6,7 @@ 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) => {
|
|
9
|
-
editorService.set("root", modelValue || null);
|
|
9
|
+
editorService.set("root", modelValue || null, { historySource: "initial" });
|
|
10
10
|
}, { immediate: true });
|
|
11
11
|
watch(() => props.disabledMultiSelect, (disabledMultiSelect) => {
|
|
12
12
|
editorService.set("disabledMultiSelect", disabledMultiSelect || false);
|
|
@@ -66,7 +66,7 @@ var Framework_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
66
66
|
const saveCode = (value) => {
|
|
67
67
|
try {
|
|
68
68
|
const parseDSL = getEditorConfig("parseDSL");
|
|
69
|
-
editorService.set("root", parseDSL(value));
|
|
69
|
+
editorService.set("root", parseDSL(value), { historySource: "root-code" });
|
|
70
70
|
} catch (e) {
|
|
71
71
|
console.error(e);
|
|
72
72
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isHistoryGroupExpanded, toRowGroup } from "./composables.js";
|
|
2
2
|
import GroupRow_default from "./GroupRow.js";
|
|
3
3
|
import InitialRow_default from "./InitialRow.js";
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, renderList, toDisplayString, unref } from "vue";
|
|
@@ -11,23 +11,10 @@ var Bucket_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
11
11
|
name: "MEditorHistoryListBucket",
|
|
12
12
|
__name: "Bucket",
|
|
13
13
|
props: {
|
|
14
|
-
|
|
14
|
+
config: {},
|
|
15
15
|
bucketId: {},
|
|
16
|
-
prefix: {},
|
|
17
|
-
showInitial: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: true
|
|
20
|
-
},
|
|
21
16
|
groups: {},
|
|
22
|
-
|
|
23
|
-
describeStep: {},
|
|
24
|
-
isStepDiffable: {},
|
|
25
|
-
isStepRevertable: {},
|
|
26
|
-
expanded: {},
|
|
27
|
-
gotoEnabled: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: true
|
|
30
|
-
}
|
|
17
|
+
expanded: {}
|
|
31
18
|
},
|
|
32
19
|
emits: [
|
|
33
20
|
"toggle",
|
|
@@ -38,65 +25,42 @@ var Bucket_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
38
25
|
],
|
|
39
26
|
setup(__props) {
|
|
40
27
|
const props = __props;
|
|
28
|
+
/**
|
|
29
|
+
* 子项 / 折叠状态 key:`${prefix}-${bucketId}-${组内首步 index}`。
|
|
30
|
+
* 以稳定的 step 索引(而非展示位置)标识分组,历史数据更新后已展开的分组状态仍能正确保持。
|
|
31
|
+
*/
|
|
32
|
+
const rowKey = (group) => `${props.config.prefix}-${props.bucketId}-${group.steps[0]?.index}`;
|
|
33
|
+
/** 把原始分组派生为 GroupRow 直接消费的视图模型。 */
|
|
34
|
+
const toRow = (group) => toRowGroup(group, rowKey(group), props.config);
|
|
41
35
|
/** 该 bucket 是否处于初始状态(栈 cursor=0),等价于全部 group 都未 applied。 */
|
|
42
36
|
const isInitial = computed(() => props.groups.length > 0 && props.groups.every((g) => !g.applied));
|
|
43
37
|
return (_ctx, _cache) => {
|
|
44
38
|
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
|
|
45
|
-
createElementVNode("span", null, toDisplayString(__props.title), 1),
|
|
39
|
+
createElementVNode("span", null, toDisplayString(__props.config.title), 1),
|
|
46
40
|
createElementVNode("code", null, toDisplayString(String(__props.bucketId)), 1),
|
|
47
41
|
createElementVNode("span", _hoisted_3, toDisplayString(__props.groups.length) + " 组", 1)
|
|
48
42
|
]), createElementVNode("ul", _hoisted_4, [
|
|
49
43
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.groups, (group) => {
|
|
50
44
|
return openBlock(), createBlock(GroupRow_default, {
|
|
51
|
-
key:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"op-type": group.opType,
|
|
56
|
-
desc: __props.describeGroup(group),
|
|
57
|
-
source: unref(groupSource)(group),
|
|
58
|
-
time: unref(formatHistoryTime)(unref(groupTimestamp)(group)),
|
|
59
|
-
"time-title": unref(formatHistoryFullTime)(unref(groupTimestamp)(group)),
|
|
60
|
-
"step-count": group.steps.length,
|
|
61
|
-
"sub-steps": group.steps.map((s) => ({
|
|
62
|
-
index: s.index,
|
|
63
|
-
applied: s.applied,
|
|
64
|
-
isCurrent: s.isCurrent,
|
|
65
|
-
desc: __props.describeStep(s.step),
|
|
66
|
-
diffable: __props.isStepDiffable ? __props.isStepDiffable(s.step) : false,
|
|
67
|
-
revertable: s.applied && (__props.isStepRevertable ? __props.isStepRevertable(s.step) : true),
|
|
68
|
-
source: s.step.source,
|
|
69
|
-
time: unref(formatHistoryTime)(s.step.timestamp),
|
|
70
|
-
timeTitle: unref(formatHistoryFullTime)(s.step.timestamp)
|
|
71
|
-
})),
|
|
72
|
-
"is-current": group.isCurrent,
|
|
73
|
-
expanded: !!__props.expanded[`${__props.prefix}-${__props.bucketId}-${group.steps[0]?.index}`],
|
|
74
|
-
"goto-enabled": __props.gotoEnabled,
|
|
45
|
+
key: rowKey(group),
|
|
46
|
+
group: toRow(group),
|
|
47
|
+
expanded: unref(isHistoryGroupExpanded)(__props.expanded, rowKey(group)),
|
|
48
|
+
"goto-enabled": __props.config.gotoEnabled,
|
|
75
49
|
onToggle: _cache[0] || (_cache[0] = (key) => _ctx.$emit("toggle", key)),
|
|
76
50
|
onGoto: _cache[1] || (_cache[1] = (index) => _ctx.$emit("goto", __props.bucketId, index)),
|
|
77
51
|
onDiffStep: _cache[2] || (_cache[2] = (index) => _ctx.$emit("diff-step", __props.bucketId, index)),
|
|
78
52
|
onRevertStep: _cache[3] || (_cache[3] = (index) => _ctx.$emit("revert-step", __props.bucketId, index))
|
|
79
53
|
}, null, 8, [
|
|
80
|
-
"group
|
|
81
|
-
"applied",
|
|
82
|
-
"merged",
|
|
83
|
-
"op-type",
|
|
84
|
-
"desc",
|
|
85
|
-
"source",
|
|
86
|
-
"time",
|
|
87
|
-
"time-title",
|
|
88
|
-
"step-count",
|
|
89
|
-
"sub-steps",
|
|
90
|
-
"is-current",
|
|
54
|
+
"group",
|
|
91
55
|
"expanded",
|
|
92
56
|
"goto-enabled"
|
|
93
57
|
]);
|
|
94
58
|
}), 128)),
|
|
95
|
-
createCommentVNode("\n 初始状态项:永远位于该 bucket 列表底部(同样按倒序展示,最底部 = 最早状态)。\n 当 bucket 内所有 group 都未 applied 时即为当前位置。\n showInitial=false 时不展示(用于没有\"撤销到初始状态\"语义的自定义历史,如业务模块历史)。\n "),
|
|
96
|
-
__props.showInitial !== false ? (openBlock(), createBlock(InitialRow_default, {
|
|
59
|
+
createCommentVNode("\n 初始状态项:永远位于该 bucket 列表底部(同样按倒序展示,最底部 = 最早状态)。\n 当 bucket 内所有 group 都未 applied 时即为当前位置。\n config.showInitial=false 时不展示(用于没有\"撤销到初始状态\"语义的自定义历史,如业务模块历史)。\n "),
|
|
60
|
+
__props.config.showInitial !== false ? (openBlock(), createBlock(InitialRow_default, {
|
|
97
61
|
key: 0,
|
|
98
62
|
"is-current": isInitial.value,
|
|
99
|
-
"goto-enabled": __props.gotoEnabled,
|
|
63
|
+
"goto-enabled": __props.config.gotoEnabled,
|
|
100
64
|
onGotoInitial: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("goto-initial", __props.bucketId))
|
|
101
65
|
}, null, 8, ["is-current", "goto-enabled"])) : createCommentVNode("v-if", true)
|
|
102
66
|
])]);
|
|
@@ -1,74 +1,57 @@
|
|
|
1
1
|
import Bucket_default from "./Bucket.js";
|
|
2
2
|
import { TMagicScrollbar } from "@tmagic/design";
|
|
3
|
-
import { Fragment, createBlock, createElementBlock, defineComponent, openBlock, renderList, unref, withCtx } from "vue";
|
|
3
|
+
import { Fragment, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, renderList, unref, withCtx } from "vue";
|
|
4
4
|
//#region packages/editor/src/layouts/history-list/BucketTab.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "m-editor-history-list-empty"
|
|
8
8
|
};
|
|
9
|
+
var _hoisted_2 = { class: "m-editor-history-list-toolbar" };
|
|
10
|
+
var _hoisted_3 = ["title"];
|
|
9
11
|
var BucketTab_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
10
12
|
name: "MEditorHistoryListBucketTab",
|
|
11
13
|
__name: "BucketTab",
|
|
12
14
|
props: {
|
|
13
|
-
|
|
14
|
-
prefix: {},
|
|
15
|
+
config: {},
|
|
15
16
|
buckets: {},
|
|
16
|
-
|
|
17
|
-
describeStep: {},
|
|
18
|
-
isStepDiffable: {},
|
|
19
|
-
isStepRevertable: {},
|
|
20
|
-
expanded: {},
|
|
21
|
-
gotoEnabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: true
|
|
24
|
-
}
|
|
17
|
+
expanded: {}
|
|
25
18
|
},
|
|
26
19
|
emits: [
|
|
27
20
|
"toggle",
|
|
28
21
|
"goto",
|
|
29
22
|
"goto-initial",
|
|
30
23
|
"diff-step",
|
|
31
|
-
"revert-step"
|
|
24
|
+
"revert-step",
|
|
25
|
+
"clear"
|
|
32
26
|
],
|
|
33
27
|
setup(__props) {
|
|
34
28
|
return (_ctx, _cache) => {
|
|
35
|
-
return !__props.buckets.length ? (openBlock(), createElementBlock("div", _hoisted_1, "暂无操作记录")) : (openBlock(),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
return !__props.buckets.length ? (openBlock(), createElementBlock("div", _hoisted_1, "暂无操作记录")) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createElementVNode("div", _hoisted_2, [createElementVNode("span", {
|
|
30
|
+
class: "m-editor-history-list-clear",
|
|
31
|
+
title: `清空${__props.config.title}的历史记录`,
|
|
32
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("clear"))
|
|
33
|
+
}, "清空", 8, _hoisted_3)]), createVNode(unref(TMagicScrollbar), { "max-height": "360px" }, {
|
|
39
34
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.buckets, (bucket) => {
|
|
40
35
|
return openBlock(), createBlock(Bucket_default, {
|
|
41
|
-
key: `${__props.prefix}-${bucket.id}`,
|
|
42
|
-
|
|
36
|
+
key: `${__props.config.prefix}-${bucket.id}`,
|
|
37
|
+
config: __props.config,
|
|
43
38
|
"bucket-id": bucket.id,
|
|
44
|
-
prefix: __props.prefix,
|
|
45
39
|
groups: bucket.groups,
|
|
46
|
-
"describe-group": __props.describeGroup,
|
|
47
|
-
"describe-step": __props.describeStep,
|
|
48
|
-
"is-step-diffable": __props.isStepDiffable,
|
|
49
|
-
"is-step-revertable": __props.isStepRevertable,
|
|
50
40
|
expanded: __props.expanded,
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
onRevertStep: _cache[4] || (_cache[4] = (id, index) => _ctx.$emit("revert-step", id, index))
|
|
41
|
+
onToggle: _cache[1] || (_cache[1] = (key) => _ctx.$emit("toggle", key)),
|
|
42
|
+
onGoto: _cache[2] || (_cache[2] = (id, index) => _ctx.$emit("goto", id, index)),
|
|
43
|
+
onGotoInitial: _cache[3] || (_cache[3] = (id) => _ctx.$emit("goto-initial", id)),
|
|
44
|
+
onDiffStep: _cache[4] || (_cache[4] = (id, index) => _ctx.$emit("diff-step", id, index)),
|
|
45
|
+
onRevertStep: _cache[5] || (_cache[5] = (id, index) => _ctx.$emit("revert-step", id, index))
|
|
57
46
|
}, null, 8, [
|
|
58
|
-
"
|
|
47
|
+
"config",
|
|
59
48
|
"bucket-id",
|
|
60
|
-
"prefix",
|
|
61
49
|
"groups",
|
|
62
|
-
"
|
|
63
|
-
"describe-step",
|
|
64
|
-
"is-step-diffable",
|
|
65
|
-
"is-step-revertable",
|
|
66
|
-
"expanded",
|
|
67
|
-
"goto-enabled"
|
|
50
|
+
"expanded"
|
|
68
51
|
]);
|
|
69
52
|
}), 128))]),
|
|
70
53
|
_: 1
|
|
71
|
-
}));
|
|
54
|
+
})], 64));
|
|
72
55
|
};
|
|
73
56
|
}
|
|
74
57
|
});
|