@tmagic/editor 1.8.0-beta.6 → 1.8.0-beta.8
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 +10 -6
- package/dist/es/index.js +6 -4
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/history-list/GroupRow.vue_vue_type_script_setup_true_lang.js +38 -26
- package/dist/es/layouts/history-list/HistoryDiffDialog.vue_vue_type_script_setup_true_lang.js +5 -1
- package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +163 -310
- package/dist/es/layouts/history-list/composables.js +47 -128
- package/dist/es/layouts/history-list/useHistoryList.js +56 -0
- package/dist/es/layouts/history-list/useHistoryRevert.js +304 -0
- package/dist/es/layouts/sidebar/Sidebar.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/es/layouts/sidebar/data-source/DataSourceConfigPanel.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/es/services/codeBlock.js +32 -28
- package/dist/es/services/dataSource.js +43 -34
- package/dist/es/services/editor.js +31 -26
- package/dist/es/services/history.js +268 -384
- package/dist/es/style.css +12 -0
- package/dist/es/utils/editor.js +2 -2
- package/dist/es/utils/history.js +35 -47
- package/dist/style.css +12 -0
- package/dist/tmagic-editor.umd.cjs +3808 -3090
- package/package.json +7 -7
- package/src/components/CompareForm.vue +14 -6
- package/src/index.ts +2 -0
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/history-list/GroupRow.vue +10 -0
- package/src/layouts/history-list/HistoryDiffDialog.vue +6 -1
- package/src/layouts/history-list/HistoryListPanel.vue +60 -270
- package/src/layouts/history-list/PageTab.vue +4 -4
- package/src/layouts/history-list/composables.ts +82 -180
- package/src/layouts/history-list/useHistoryList.ts +60 -0
- package/src/layouts/history-list/useHistoryRevert.ts +400 -0
- package/src/layouts/sidebar/Sidebar.vue +2 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +5 -4
- package/src/services/codeBlock.ts +30 -29
- package/src/services/dataSource.ts +37 -37
- package/src/services/editor.ts +32 -29
- package/src/services/history.ts +340 -431
- package/src/theme/history-list-panel.scss +14 -0
- package/src/type.ts +179 -100
- package/src/utils/editor.ts +2 -2
- package/src/utils/history.ts +52 -74
- package/types/index.d.ts +435 -309
package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { useServices } from "../../hooks/use-services.js";
|
|
2
2
|
import Icon_default from "../../components/Icon.js";
|
|
3
|
-
import {
|
|
3
|
+
import { confirmHistoryAction, describeStep, isSingleDiffStepRevertable } from "./composables.js";
|
|
4
4
|
import BucketTab_default from "./BucketTab.js";
|
|
5
|
-
import HistoryDiffDialog_default from "./HistoryDiffDialog.js";
|
|
6
5
|
import PageTab_default from "./PageTab.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useHistoryList } from "./useHistoryList.js";
|
|
7
|
+
import { useHistoryRevert } from "./useHistoryRevert.js";
|
|
8
|
+
import { TMagicButton, TMagicPopover, TMagicTabs, TMagicTooltip, getDesignConfig, tMagicMessage } from "@tmagic/design";
|
|
9
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, markRaw, mergeProps, normalizeProps, openBlock, ref, renderList, resolveDynamicComponent, toHandlers, unref, watch, withCtx } from "vue";
|
|
9
10
|
import { Clock, Close } from "@element-plus/icons-vue";
|
|
10
11
|
//#region packages/editor/src/layouts/history-list/HistoryListPanel.vue?vue&type=script&setup=true&lang.ts
|
|
11
12
|
var _hoisted_1 = { class: "m-editor-history-list" };
|
|
12
|
-
/**
|
|
13
|
-
* 构造差异弹窗入参:仅 update(前后值都存在)可对比。
|
|
14
|
-
* - 页面(无 id):在全部分组中按 index 定位 step,目标 id 取自快照;
|
|
15
|
-
* - 数据源 / 代码块(带 id):先匹配分组 id 再按 index 定位。
|
|
16
|
-
* 无可对比内容(多节点 / add / remove)或定位不到时返回 null。
|
|
17
|
-
*/
|
|
18
13
|
var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
19
14
|
name: "MEditorHistoryListPanel",
|
|
20
15
|
__name: "HistoryListPanel",
|
|
@@ -56,7 +51,8 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
56
51
|
const extraTabs = inject("historyListExtraTabs", []);
|
|
57
52
|
/** label 支持字符串或函数,函数形式便于展示动态数量等内容。 */
|
|
58
53
|
const resolveTabLabel = (tab) => typeof tab.label === "function" ? tab.label() : tab.label;
|
|
59
|
-
const
|
|
54
|
+
const services = useServices();
|
|
55
|
+
const { editorService, dataSourceService, codeBlockService, historyService, propsService, stageOverlayService } = services;
|
|
60
56
|
/**
|
|
61
57
|
* 数据源 / 代码块功能可被业务方通过 `disabledDataSource` / `disabledCodeBlock` 禁用,
|
|
62
58
|
* 禁用后对应的历史记录 tab 不再展示。若当前激活的 tab 恰好被禁用,则回退到「页面」tab。
|
|
@@ -77,31 +73,35 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
77
73
|
* 当前活动页的「加载/初始」标记记录(设置 root 时生成),透传给 PageTab 的底部初始行展示。
|
|
78
74
|
* 基于 historyService 的 reactive state 派生,活动页切换或标记写入后自动刷新。
|
|
79
75
|
*/
|
|
80
|
-
const pageMarker = computed(() => historyService.
|
|
81
|
-
/**
|
|
82
|
-
|
|
76
|
+
const pageMarker = computed(() => historyService.getMarker("page", editorService.get("page")?.id));
|
|
77
|
+
/**
|
|
78
|
+
* 各历史类型的展示名称(页面 / 数据源 / 代码块),由 historyService.state.stepNames 配置,
|
|
79
|
+
* 业务方可通过 historyService.setStepName / registerStepType 覆盖。基于 reactive state 派生,配置变更后自动刷新。
|
|
80
|
+
*/
|
|
81
|
+
const pageName = computed(() => historyService.getStepName("page"));
|
|
82
|
+
const dataSourceName = computed(() => historyService.getStepName("dataSource"));
|
|
83
|
+
const codeBlockName = computed(() => historyService.getStepName("codeBlock"));
|
|
83
84
|
/** 代码块 step 仅 update(前后 content 都存在)时可查看差异。 */
|
|
84
|
-
const
|
|
85
|
+
const isStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
85
86
|
/**
|
|
86
87
|
* 数据源 / 代码块两类 bucket 历史的整体渲染配置:把 title / prefix 与各自的描述、
|
|
87
88
|
* 可差异、可回滚判定收敛为单一对象整体注入 BucketTab,组件内部按需读取。
|
|
89
|
+
* title / 描述回退名取自可配置的展示名称,故用 computed 使其随 stepNames 变更刷新。
|
|
88
90
|
*/
|
|
89
|
-
const dataSourceConfig = {
|
|
90
|
-
title:
|
|
91
|
+
const dataSourceConfig = computed(() => ({
|
|
92
|
+
title: dataSourceName.value,
|
|
91
93
|
prefix: "ds",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
title: "代码块",
|
|
94
|
+
describeStep: (step) => describeStep(step, (schema) => schema?.title, dataSourceName.value),
|
|
95
|
+
isStepDiffable,
|
|
96
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
97
|
+
}));
|
|
98
|
+
const codeBlockConfig = computed(() => ({
|
|
99
|
+
title: codeBlockName.value,
|
|
99
100
|
prefix: "cb",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
101
|
+
describeStep: (step) => describeStep(step, (content) => content?.name, codeBlockName.value),
|
|
102
|
+
isStepDiffable,
|
|
103
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
104
|
+
}));
|
|
105
105
|
/** 把"目标 step 索引"翻译成"目标 cursor"(已应用步骤数量)。 */
|
|
106
106
|
const indexToCursor = (index) => index + 1;
|
|
107
107
|
const onPageGoto = (index) => {
|
|
@@ -114,7 +114,7 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
114
114
|
* - 该 step 涉及的节点都已不存在(如删除记录、被撤销的新增)时给出提示,不做选中。
|
|
115
115
|
*/
|
|
116
116
|
const onPageSelect = async (index) => {
|
|
117
|
-
const step = historyService.
|
|
117
|
+
const step = historyService.getStepList("page", editorService.get("page")?.id)[index]?.step;
|
|
118
118
|
if (!step) return;
|
|
119
119
|
const targetId = (step.diff ?? []).map((item) => item.newSchema?.id ?? item.oldSchema?.id).find((id) => id !== void 0 && id !== null && editorService.getNodeById(id, false));
|
|
120
120
|
if (targetId === void 0 || targetId === null) {
|
|
@@ -146,156 +146,12 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
146
146
|
const onCodeBlockGotoInitial = (id) => {
|
|
147
147
|
codeBlockService.goto(id, 0);
|
|
148
148
|
};
|
|
149
|
-
const diffDialogRef = useTemplateRef("diffDialog");
|
|
150
|
-
const confirmDialogRef = useTemplateRef("confirmDialog");
|
|
151
|
-
/**
|
|
152
|
-
* 三类历史(页面 / 数据源 / 代码块)差异弹窗入参的构造差异,收敛为一份配置:
|
|
153
|
-
* 仅「分组来源、当前值读取、类型 / 展示名提取」不同,定位 step、校验前后值、组装 payload 的流程共用。
|
|
154
|
-
*/
|
|
155
|
-
const buildDiffPayload = (source, index, id) => {
|
|
156
|
-
for (const group of source.groups()) {
|
|
157
|
-
if (id !== void 0 && group.id !== id) continue;
|
|
158
|
-
const step = group.steps.find((s) => s.index === index)?.step;
|
|
159
|
-
if (!step) continue;
|
|
160
|
-
const oldSchema = step.diff?.[0]?.oldSchema;
|
|
161
|
-
const newSchema = step.diff?.[0]?.newSchema;
|
|
162
|
-
if (!oldSchema || !newSchema) return null;
|
|
163
|
-
const targetId = id ?? newSchema.id ?? oldSchema.id;
|
|
164
|
-
const type = source.resolveType?.(newSchema, oldSchema);
|
|
165
|
-
return {
|
|
166
|
-
category: source.category,
|
|
167
|
-
...type !== void 0 ? { type } : {},
|
|
168
|
-
lastValue: oldSchema,
|
|
169
|
-
value: newSchema,
|
|
170
|
-
currentValue: (targetId !== void 0 ? source.getCurrent(targetId) : null) || null,
|
|
171
|
-
targetLabel: source.resolveLabel(newSchema, oldSchema, targetId),
|
|
172
|
-
id: targetId
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
};
|
|
177
|
-
const buildPageDiffPayload = (index) => buildDiffPayload({
|
|
178
|
-
category: "node",
|
|
179
|
-
groups: () => historyService.getPageHistoryGroups(),
|
|
180
|
-
getCurrent: (id) => editorService.getNodeById(id),
|
|
181
|
-
resolveType: (n, o) => n.type || o.type || "",
|
|
182
|
-
resolveLabel: (n, o) => n.name || o.name || n.type || o.type || ""
|
|
183
|
-
}, index);
|
|
184
|
-
const buildDataSourceDiffPayload = (id, index) => buildDiffPayload({
|
|
185
|
-
category: "data-source",
|
|
186
|
-
groups: () => historyService.getDataSourceHistoryGroups(),
|
|
187
|
-
getCurrent: (id) => dataSourceService.getDataSourceById(`${id}`),
|
|
188
|
-
resolveType: (n, o) => n.type || o.type || "base",
|
|
189
|
-
resolveLabel: (n, o, id) => n.title || o.title || `${id}`
|
|
190
|
-
}, index, id);
|
|
191
|
-
const buildCodeBlockDiffPayload = (id, index) => buildDiffPayload({
|
|
192
|
-
category: "code-block",
|
|
193
|
-
groups: () => historyService.getCodeBlockHistoryGroups(),
|
|
194
|
-
getCurrent: (id) => codeBlockService.getCodeContentById(id),
|
|
195
|
-
resolveLabel: (n, o, id) => n.name || o.name || `${id}`
|
|
196
|
-
}, index, id);
|
|
197
|
-
const onPageDiff = (index) => {
|
|
198
|
-
const payload = buildPageDiffPayload(index);
|
|
199
|
-
if (payload) diffDialogRef.value?.open(payload);
|
|
200
|
-
};
|
|
201
|
-
const onDataSourceDiff = (id, index) => {
|
|
202
|
-
const payload = buildDataSourceDiffPayload(id, index);
|
|
203
|
-
if (payload) diffDialogRef.value?.open(payload);
|
|
204
|
-
};
|
|
205
|
-
const onCodeBlockDiff = (id, index) => {
|
|
206
|
-
const payload = buildCodeBlockDiffPayload(id, index);
|
|
207
|
-
if (payload) diffDialogRef.value?.open(payload);
|
|
208
|
-
};
|
|
209
|
-
/**
|
|
210
|
-
* 「回滚」统一入口:把目标历史步骤的修改作为一次新操作反向应用(类 git revert),
|
|
211
|
-
* 不破坏原有栈结构。各 service 内部完成反向 + 入栈,并自带描述用于面板展示。
|
|
212
|
-
*
|
|
213
|
-
* 交互:
|
|
214
|
-
* - 可差异对比的步骤(单节点 / 单实体 update):弹出差异弹窗供用户确认,点「确定回滚」再执行;
|
|
215
|
-
* - 无法对比的步骤(add / remove / 多节点更新,payload 为 null):弹出普通二次确认框,确认后执行。
|
|
216
|
-
*
|
|
217
|
-
* 页面 / 数据源 / 代码块三类回滚仅「差异入参构造」与「实际 revert 调用」不同,
|
|
218
|
-
* 由调用方分别传入 payload 与 revert,公共的弹窗 / 确认流程在此收敛。
|
|
219
|
-
*/
|
|
220
|
-
const runRevert = (payload) => {
|
|
221
|
-
if (payload && confirmDialogRef.value) return confirmDialogRef.value.confirm(payload);
|
|
222
|
-
return confirmRevert();
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* 回滚前置校验:若该历史步骤回滚所依赖的目标数据已被删除,则无法回滚。
|
|
226
|
-
* - update(把旧值写回):被修改的目标必须仍存在;
|
|
227
|
-
* - 页面 remove(还原被删节点):被删节点的原父容器必须仍存在,否则无处插回;
|
|
228
|
-
* add(回滚即删除)即使目标已不在,也已达成「删除」目的,不视为失败。
|
|
229
|
-
*
|
|
230
|
-
* 命中时弹出「回滚失败」提示并返回 true,调用方据此中止本次回滚。
|
|
231
|
-
*/
|
|
232
|
-
const isPageRevertTargetMissing = (index) => {
|
|
233
|
-
const step = historyService.getPageStepList()[index]?.step;
|
|
234
|
-
if (!step) return false;
|
|
235
|
-
if (step.opType === "update") return (step.diff ?? []).some((item) => {
|
|
236
|
-
const id = item.newSchema?.id ?? item.oldSchema?.id;
|
|
237
|
-
return id !== void 0 && !editorService.getNodeById(id, false);
|
|
238
|
-
});
|
|
239
|
-
if (step.opType === "remove") return (step.diff ?? []).some((item) => item.parentId !== void 0 && !editorService.getNodeById(item.parentId, false));
|
|
240
|
-
return false;
|
|
241
|
-
};
|
|
242
|
-
/** 数据源 update 步骤回滚时,对应数据源必须仍存在(已删除则无处写回旧值)。 */
|
|
243
|
-
const isDataSourceRevertTargetMissing = (id, index) => {
|
|
244
|
-
const step = historyService.getDataSourceStepList(id)[index]?.step;
|
|
245
|
-
return Boolean(step && step.opType === "update" && !dataSourceService.getDataSourceById(`${id}`));
|
|
246
|
-
};
|
|
247
|
-
/** 代码块 update 步骤回滚时,对应代码块必须仍存在(已删除则无处写回旧值)。 */
|
|
248
|
-
const isCodeBlockRevertTargetMissing = (id, index) => {
|
|
249
|
-
const step = historyService.getCodeBlockStepList(id)[index]?.step;
|
|
250
|
-
return Boolean(step && step.opType === "update" && !codeBlockService.getCodeContentById(id));
|
|
251
|
-
};
|
|
252
|
-
/** 目标数据已被删除、无法回滚时的统一提示。 */
|
|
253
|
-
const showRevertTargetMissing = () => {
|
|
254
|
-
tMagicMessage.error("回滚失败:该记录对应的数据已被删除");
|
|
255
|
-
};
|
|
256
|
-
const onPageRevert = (index) => {
|
|
257
|
-
if (isPageRevertTargetMissing(index)) {
|
|
258
|
-
showRevertTargetMissing();
|
|
259
|
-
return Promise.resolve(null);
|
|
260
|
-
}
|
|
261
|
-
return runRevert(buildPageDiffPayload(index)).then((result) => result ? editorService.revertPageStep(index) : null);
|
|
262
|
-
};
|
|
263
|
-
const onDataSourceRevert = (id, index) => {
|
|
264
|
-
if (isDataSourceRevertTargetMissing(id, index)) {
|
|
265
|
-
showRevertTargetMissing();
|
|
266
|
-
return Promise.resolve(null);
|
|
267
|
-
}
|
|
268
|
-
return runRevert(buildDataSourceDiffPayload(id, index)).then((result) => result ? dataSourceService.revert(id, index) : null);
|
|
269
|
-
};
|
|
270
|
-
const onCodeBlockRevert = (id, index) => {
|
|
271
|
-
if (isCodeBlockRevertTargetMissing(id, index)) {
|
|
272
|
-
showRevertTargetMissing();
|
|
273
|
-
return Promise.resolve(null);
|
|
274
|
-
}
|
|
275
|
-
return runRevert(buildCodeBlockDiffPayload(id, index)).then((result) => result ? codeBlockService.revert(id, index) : null);
|
|
276
|
-
};
|
|
277
149
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
150
|
+
* 「单步回滚」与「查看差异」的完整逻辑收敛到 useHistoryRevert,面板与业务方共用:
|
|
151
|
+
* 二者均由 useHistoryRevert 内部按需动态挂载 HistoryDiffDialog,
|
|
152
|
+
* 业务方亦可直接 import useHistoryRevert(services) 调用,无需自行挂载任何弹窗。
|
|
281
153
|
*/
|
|
282
|
-
const
|
|
283
|
-
/**
|
|
284
|
-
* 通用二次确认弹窗:清空历史 / 无法差异对比的回滚等会改变状态的操作,先弹出确认框,
|
|
285
|
-
* 用户点击「确定」返回 true,取消(confirm reject)时返回 false 并静默忽略。
|
|
286
|
-
*/
|
|
287
|
-
const confirmDialog = async (message) => {
|
|
288
|
-
try {
|
|
289
|
-
await tMagicMessageBox.confirm(message, "提示", {
|
|
290
|
-
confirmButtonText: "确定",
|
|
291
|
-
cancelButtonText: "取消",
|
|
292
|
-
type: "warning"
|
|
293
|
-
});
|
|
294
|
-
return true;
|
|
295
|
-
} catch (e) {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
};
|
|
154
|
+
const { onPageRevert, onDataSourceRevert, onCodeBlockRevert, onPageDiff, onDataSourceDiff, onCodeBlockDiff } = useHistoryRevert(services, { extendState: extendFormState });
|
|
299
155
|
/**
|
|
300
156
|
* 把内存中(已清空对应类别后的)历史状态重新写回 IndexedDB,
|
|
301
157
|
* 使本地持久化的那份与内存保持一致——即「连同本地保存的一并删除」。
|
|
@@ -307,158 +163,155 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
307
163
|
} catch (e) {}
|
|
308
164
|
};
|
|
309
165
|
const onPageClear = async () => {
|
|
310
|
-
if (await
|
|
311
|
-
historyService.
|
|
166
|
+
if (await confirmHistoryAction("确定清空当前页面的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
167
|
+
historyService.clear("page", editorService.get("page")?.id);
|
|
312
168
|
await syncIndexedDB();
|
|
313
169
|
}
|
|
314
170
|
};
|
|
315
171
|
const onDataSourceClear = async () => {
|
|
316
|
-
if (await
|
|
317
|
-
historyService.
|
|
172
|
+
if (await confirmHistoryAction("确定清空数据源的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
173
|
+
historyService.clear("dataSource");
|
|
318
174
|
await syncIndexedDB();
|
|
319
175
|
}
|
|
320
176
|
};
|
|
321
177
|
const onCodeBlockClear = async () => {
|
|
322
|
-
if (await
|
|
323
|
-
historyService.
|
|
178
|
+
if (await confirmHistoryAction("确定清空代码块的历史记录吗?清空后将无法撤销/重做之前的操作,本地保存的记录也会一并删除。")) {
|
|
179
|
+
historyService.clear("codeBlock");
|
|
324
180
|
await syncIndexedDB();
|
|
325
181
|
}
|
|
326
182
|
};
|
|
327
183
|
return (_ctx, _cache) => {
|
|
328
|
-
return openBlock(),
|
|
329
|
-
|
|
330
|
-
|
|
184
|
+
return openBlock(), createBlock(unref(TMagicPopover), {
|
|
185
|
+
"popper-class": "m-editor-history-list-popover",
|
|
186
|
+
placement: "bottom",
|
|
187
|
+
trigger: "click",
|
|
188
|
+
visible: visible.value,
|
|
189
|
+
"onUpdate:visible": _cache[3] || (_cache[3] = ($event) => visible.value = $event),
|
|
190
|
+
width: 660
|
|
191
|
+
}, {
|
|
192
|
+
reference: withCtx(() => [createVNode(unref(TMagicTooltip), {
|
|
193
|
+
effect: "dark",
|
|
331
194
|
placement: "bottom",
|
|
332
|
-
|
|
333
|
-
visible: visible.value,
|
|
334
|
-
"onUpdate:visible": _cache[3] || (_cache[3] = ($event) => visible.value = $event),
|
|
335
|
-
width: 660
|
|
195
|
+
content: "历史记录"
|
|
336
196
|
}, {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
197
|
+
default: withCtx(() => [createVNode(unref(TMagicButton), {
|
|
198
|
+
size: "small",
|
|
199
|
+
link: "",
|
|
200
|
+
onClick: _cache[2] || (_cache[2] = ($event) => visible.value = !visible.value)
|
|
341
201
|
}, {
|
|
342
|
-
|
|
343
|
-
size: "small",
|
|
344
|
-
link: "",
|
|
345
|
-
onClick: _cache[2] || (_cache[2] = ($event) => visible.value = !visible.value)
|
|
346
|
-
}, {
|
|
347
|
-
icon: withCtx(() => [createVNode(Icon_default, { icon: unref(ClockIcon) }, null, 8, ["icon"])]),
|
|
348
|
-
_: 1
|
|
349
|
-
})]),
|
|
202
|
+
icon: withCtx(() => [createVNode(Icon_default, { icon: unref(ClockIcon) }, null, 8, ["icon"])]),
|
|
350
203
|
_: 1
|
|
351
204
|
})]),
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
_: 1
|
|
365
|
-
})]),
|
|
366
|
-
_: 1
|
|
367
|
-
}), createVNode(unref(TMagicTabs), {
|
|
368
|
-
modelValue: activeTab.value,
|
|
369
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => activeTab.value = $event),
|
|
370
|
-
class: "m-editor-history-list-tabs"
|
|
205
|
+
_: 1
|
|
206
|
+
})]),
|
|
207
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(TMagicTooltip), {
|
|
208
|
+
effect: "dark",
|
|
209
|
+
placement: "top",
|
|
210
|
+
content: "关闭"
|
|
211
|
+
}, {
|
|
212
|
+
default: withCtx(() => [createVNode(unref(TMagicButton), {
|
|
213
|
+
class: "m-editor-history-list-close",
|
|
214
|
+
size: "small",
|
|
215
|
+
link: "",
|
|
216
|
+
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = false)
|
|
371
217
|
}, {
|
|
372
|
-
|
|
373
|
-
(openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(guardReactiveProps(unref(tabPaneComponent)?.props({
|
|
374
|
-
name: "page",
|
|
375
|
-
label: `页面 (${unref(pageGroups).length})`
|
|
376
|
-
}) || {})), {
|
|
377
|
-
default: withCtx(() => [createVNode(PageTab_default, {
|
|
378
|
-
list: unref(pageGroupsDisplay),
|
|
379
|
-
expanded: unref(expanded),
|
|
380
|
-
marker: pageMarker.value,
|
|
381
|
-
onToggle: unref(toggleGroup),
|
|
382
|
-
onGoto: onPageGoto,
|
|
383
|
-
onGotoInitial: onPageGotoInitial,
|
|
384
|
-
onDiffStep: onPageDiff,
|
|
385
|
-
onRevertStep: onPageRevert,
|
|
386
|
-
onSelect: onPageSelect,
|
|
387
|
-
onClear: onPageClear
|
|
388
|
-
}, null, 8, [
|
|
389
|
-
"list",
|
|
390
|
-
"expanded",
|
|
391
|
-
"marker",
|
|
392
|
-
"onToggle"
|
|
393
|
-
])]),
|
|
394
|
-
_: 1
|
|
395
|
-
}, 16)),
|
|
396
|
-
!disabledDataSource.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 0 }, unref(tabPaneComponent)?.props({
|
|
397
|
-
name: "data-source",
|
|
398
|
-
label: `数据源 (${unref(dataSourceGroups).length})`
|
|
399
|
-
}) || {})), {
|
|
400
|
-
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
401
|
-
config: dataSourceConfig,
|
|
402
|
-
buckets: unref(dataSourceGroupsByTarget),
|
|
403
|
-
expanded: unref(expanded),
|
|
404
|
-
onToggle: unref(toggleGroup),
|
|
405
|
-
onGoto: onDataSourceGoto,
|
|
406
|
-
onGotoInitial: onDataSourceGotoInitial,
|
|
407
|
-
onDiffStep: onDataSourceDiff,
|
|
408
|
-
onRevertStep: onDataSourceRevert,
|
|
409
|
-
onClear: onDataSourceClear
|
|
410
|
-
}, null, 8, [
|
|
411
|
-
"buckets",
|
|
412
|
-
"expanded",
|
|
413
|
-
"onToggle"
|
|
414
|
-
])]),
|
|
415
|
-
_: 1
|
|
416
|
-
}, 16)) : createCommentVNode("v-if", true),
|
|
417
|
-
!disabledCodeBlock.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 1 }, unref(tabPaneComponent)?.props({
|
|
418
|
-
name: "code-block",
|
|
419
|
-
label: `代码块 (${unref(codeBlockGroups).length})`
|
|
420
|
-
}) || {})), {
|
|
421
|
-
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
422
|
-
config: codeBlockConfig,
|
|
423
|
-
buckets: unref(codeBlockGroupsByTarget),
|
|
424
|
-
expanded: unref(expanded),
|
|
425
|
-
onToggle: unref(toggleGroup),
|
|
426
|
-
onGoto: onCodeBlockGoto,
|
|
427
|
-
onGotoInitial: onCodeBlockGotoInitial,
|
|
428
|
-
onDiffStep: onCodeBlockDiff,
|
|
429
|
-
onRevertStep: onCodeBlockRevert,
|
|
430
|
-
onClear: onCodeBlockClear
|
|
431
|
-
}, null, 8, [
|
|
432
|
-
"buckets",
|
|
433
|
-
"expanded",
|
|
434
|
-
"onToggle"
|
|
435
|
-
])]),
|
|
436
|
-
_: 1
|
|
437
|
-
}, 16)) : createCommentVNode("v-if", true),
|
|
438
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(extraTabs), (tab) => {
|
|
439
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), mergeProps({ key: tab.name }, { ref_for: true }, unref(tabPaneComponent)?.props({
|
|
440
|
-
name: tab.name,
|
|
441
|
-
label: resolveTabLabel(tab)
|
|
442
|
-
}) || {}), {
|
|
443
|
-
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tab.component), mergeProps({ ref_for: true }, tab.props || {}, toHandlers(tab.listeners || {})), null, 16))]),
|
|
444
|
-
_: 2
|
|
445
|
-
}, 1040);
|
|
446
|
-
}), 128))
|
|
447
|
-
]),
|
|
218
|
+
icon: withCtx(() => [createVNode(Icon_default, { icon: unref(CloseIcon) }, null, 8, ["icon"])]),
|
|
448
219
|
_: 1
|
|
449
|
-
}
|
|
220
|
+
})]),
|
|
221
|
+
_: 1
|
|
222
|
+
}), createVNode(unref(TMagicTabs), {
|
|
223
|
+
modelValue: activeTab.value,
|
|
224
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => activeTab.value = $event),
|
|
225
|
+
class: "m-editor-history-list-tabs"
|
|
226
|
+
}, {
|
|
227
|
+
default: withCtx(() => [
|
|
228
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(guardReactiveProps(unref(tabPaneComponent)?.props({
|
|
229
|
+
name: "page",
|
|
230
|
+
label: `${pageName.value} (${unref(pageGroups).length})`
|
|
231
|
+
}) || {})), {
|
|
232
|
+
default: withCtx(() => [createVNode(PageTab_default, {
|
|
233
|
+
list: unref(pageGroupsDisplay),
|
|
234
|
+
expanded: unref(expanded),
|
|
235
|
+
marker: pageMarker.value,
|
|
236
|
+
onToggle: unref(toggleGroup),
|
|
237
|
+
onGoto: onPageGoto,
|
|
238
|
+
onGotoInitial: onPageGotoInitial,
|
|
239
|
+
onDiffStep: unref(onPageDiff),
|
|
240
|
+
onRevertStep: unref(onPageRevert),
|
|
241
|
+
onSelect: onPageSelect,
|
|
242
|
+
onClear: onPageClear
|
|
243
|
+
}, null, 8, [
|
|
244
|
+
"list",
|
|
245
|
+
"expanded",
|
|
246
|
+
"marker",
|
|
247
|
+
"onToggle",
|
|
248
|
+
"onDiffStep",
|
|
249
|
+
"onRevertStep"
|
|
250
|
+
])]),
|
|
251
|
+
_: 1
|
|
252
|
+
}, 16)),
|
|
253
|
+
!disabledDataSource.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 0 }, unref(tabPaneComponent)?.props({
|
|
254
|
+
name: "data-source",
|
|
255
|
+
label: `${dataSourceName.value} (${unref(dataSourceGroups).length})`
|
|
256
|
+
}) || {})), {
|
|
257
|
+
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
258
|
+
config: dataSourceConfig.value,
|
|
259
|
+
buckets: unref(dataSourceGroupsByTarget),
|
|
260
|
+
expanded: unref(expanded),
|
|
261
|
+
onToggle: unref(toggleGroup),
|
|
262
|
+
onGoto: onDataSourceGoto,
|
|
263
|
+
onGotoInitial: onDataSourceGotoInitial,
|
|
264
|
+
onDiffStep: unref(onDataSourceDiff),
|
|
265
|
+
onRevertStep: unref(onDataSourceRevert),
|
|
266
|
+
onClear: onDataSourceClear
|
|
267
|
+
}, null, 8, [
|
|
268
|
+
"config",
|
|
269
|
+
"buckets",
|
|
270
|
+
"expanded",
|
|
271
|
+
"onToggle",
|
|
272
|
+
"onDiffStep",
|
|
273
|
+
"onRevertStep"
|
|
274
|
+
])]),
|
|
275
|
+
_: 1
|
|
276
|
+
}, 16)) : createCommentVNode("v-if", true),
|
|
277
|
+
!disabledCodeBlock.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), normalizeProps(mergeProps({ key: 1 }, unref(tabPaneComponent)?.props({
|
|
278
|
+
name: "code-block",
|
|
279
|
+
label: `${codeBlockName.value} (${unref(codeBlockGroups).length})`
|
|
280
|
+
}) || {})), {
|
|
281
|
+
default: withCtx(() => [createVNode(BucketTab_default, {
|
|
282
|
+
config: codeBlockConfig.value,
|
|
283
|
+
buckets: unref(codeBlockGroupsByTarget),
|
|
284
|
+
expanded: unref(expanded),
|
|
285
|
+
onToggle: unref(toggleGroup),
|
|
286
|
+
onGoto: onCodeBlockGoto,
|
|
287
|
+
onGotoInitial: onCodeBlockGotoInitial,
|
|
288
|
+
onDiffStep: unref(onCodeBlockDiff),
|
|
289
|
+
onRevertStep: unref(onCodeBlockRevert),
|
|
290
|
+
onClear: onCodeBlockClear
|
|
291
|
+
}, null, 8, [
|
|
292
|
+
"config",
|
|
293
|
+
"buckets",
|
|
294
|
+
"expanded",
|
|
295
|
+
"onToggle",
|
|
296
|
+
"onDiffStep",
|
|
297
|
+
"onRevertStep"
|
|
298
|
+
])]),
|
|
299
|
+
_: 1
|
|
300
|
+
}, 16)) : createCommentVNode("v-if", true),
|
|
301
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(extraTabs), (tab) => {
|
|
302
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(tabPaneComponent)?.component || "el-tab-pane"), mergeProps({ key: tab.name }, { ref_for: true }, unref(tabPaneComponent)?.props({
|
|
303
|
+
name: tab.name,
|
|
304
|
+
label: resolveTabLabel(tab)
|
|
305
|
+
}) || {}), {
|
|
306
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tab.component), mergeProps({ ref_for: true }, tab.props || {}, toHandlers(tab.listeners || {})), null, 16))]),
|
|
307
|
+
_: 2
|
|
308
|
+
}, 1040);
|
|
309
|
+
}), 128))
|
|
310
|
+
]),
|
|
450
311
|
_: 1
|
|
451
|
-
}, 8, ["
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
"extend-state": unref(extendFormState)
|
|
455
|
-
}, null, 8, ["extend-state"]),
|
|
456
|
-
createVNode(HistoryDiffDialog_default, {
|
|
457
|
-
ref: "confirmDialog",
|
|
458
|
-
"is-confirm": true,
|
|
459
|
-
"extend-state": unref(extendFormState)
|
|
460
|
-
}, null, 8, ["extend-state"])
|
|
461
|
-
], 64);
|
|
312
|
+
}, 8, ["modelValue"])])]),
|
|
313
|
+
_: 1
|
|
314
|
+
}, 8, ["visible"]);
|
|
462
315
|
};
|
|
463
316
|
}
|
|
464
317
|
});
|