@tmagic/editor 1.8.0-beta.6 → 1.8.0-beta.7
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/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js +8 -12
- package/dist/es/layouts/history-list/composables.js +28 -77
- 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/utils/editor.js +2 -2
- package/dist/tmagic-editor.umd.cjs +41 -94
- package/package.json +7 -7
- package/src/layouts/history-list/HistoryListPanel.vue +10 -23
- package/src/layouts/history-list/composables.ts +34 -94
- package/src/layouts/sidebar/Sidebar.vue +2 -2
- package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +5 -4
- package/src/services/history.ts +5 -6
- package/src/type.ts +22 -25
- package/src/utils/editor.ts +2 -2
- package/src/utils/history.ts +2 -9
- package/types/index.d.ts +23 -45
package/dist/es/layouts/history-list/HistoryListPanel.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useServices } from "../../hooks/use-services.js";
|
|
2
2
|
import Icon_default from "../../components/Icon.js";
|
|
3
|
-
import {
|
|
3
|
+
import { describeStep, isSingleDiffStepRevertable, useHistoryList } from "./composables.js";
|
|
4
4
|
import BucketTab_default from "./BucketTab.js";
|
|
5
5
|
import HistoryDiffDialog_default from "./HistoryDiffDialog.js";
|
|
6
6
|
import PageTab_default from "./PageTab.js";
|
|
@@ -78,10 +78,8 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
78
78
|
* 基于 historyService 的 reactive state 派生,活动页切换或标记写入后自动刷新。
|
|
79
79
|
*/
|
|
80
80
|
const pageMarker = computed(() => historyService.getPageMarker());
|
|
81
|
-
/** 数据源 step 仅 update(前后 schema 都存在)时可查看差异。 */
|
|
82
|
-
const isDataSourceStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
83
81
|
/** 代码块 step 仅 update(前后 content 都存在)时可查看差异。 */
|
|
84
|
-
const
|
|
82
|
+
const isStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
85
83
|
/**
|
|
86
84
|
* 数据源 / 代码块两类 bucket 历史的整体渲染配置:把 title / prefix 与各自的描述、
|
|
87
85
|
* 可差异、可回滚判定收敛为单一对象整体注入 BucketTab,组件内部按需读取。
|
|
@@ -89,18 +87,16 @@ var HistoryListPanel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
89
87
|
const dataSourceConfig = {
|
|
90
88
|
title: "数据源",
|
|
91
89
|
prefix: "ds",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
isStepRevertable: isDataSourceStepRevertable
|
|
90
|
+
describeStep: (step) => describeStep(step, (schema) => schema?.title, "数据源"),
|
|
91
|
+
isStepDiffable,
|
|
92
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
96
93
|
};
|
|
97
94
|
const codeBlockConfig = {
|
|
98
95
|
title: "代码块",
|
|
99
96
|
prefix: "cb",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
isStepRevertable: isCodeBlockStepRevertable
|
|
97
|
+
describeStep: (step) => describeStep(step, (content) => content?.name, "代码块"),
|
|
98
|
+
isStepDiffable,
|
|
99
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
104
100
|
};
|
|
105
101
|
/** 把"目标 step 索引"翻译成"目标 cursor"(已应用步骤数量)。 */
|
|
106
102
|
const indexToCursor = (index) => index + 1;
|
|
@@ -109,12 +109,13 @@ var groupSource = (group) => group.steps[group.steps.length - 1]?.step.source;
|
|
|
109
109
|
var toRowGroup = (group, key, descriptor) => {
|
|
110
110
|
const { describeGroup, describeStep, isStepDiffable, isStepRevertable } = descriptor;
|
|
111
111
|
const timestamp = groupTimestamp(group);
|
|
112
|
+
const lastStep = group.steps[group.steps.length - 1]?.step;
|
|
112
113
|
return {
|
|
113
114
|
key,
|
|
114
115
|
applied: group.applied,
|
|
115
116
|
isCurrent: Boolean(group.isCurrent),
|
|
116
117
|
opType: group.opType,
|
|
117
|
-
desc: describeGroup(group),
|
|
118
|
+
desc: describeGroup ? describeGroup(group) : describeStep(lastStep),
|
|
118
119
|
source: groupSource(group),
|
|
119
120
|
time: formatHistoryTime(timestamp),
|
|
120
121
|
timeTitle: formatHistoryFullTime(timestamp),
|
|
@@ -147,28 +148,36 @@ var labelWithId = (label, id) => {
|
|
|
147
148
|
var pickLastDescription = (descs) => {
|
|
148
149
|
for (let i = descs.length - 1; i >= 0; i--) if (descs[i]) return descs[i];
|
|
149
150
|
};
|
|
150
|
-
|
|
151
|
+
/**
|
|
152
|
+
* 页面 / 数据源 / 代码块三类历史共用的单步描述核心。
|
|
153
|
+
* 各类型只在「取展示名」与「实体单位名」上有差异,通过参数注入,文案模板完全一致:
|
|
154
|
+
* - 新增 / 删除:单实体展示「label」,多实体(仅页面可能出现)退化为「N 个X」;
|
|
155
|
+
* - 修改:展示「label · propPath」,无 diff 时兜底「X」,多实体退化为「N 个X」。
|
|
156
|
+
* 操作类型(新增 / 删除 / 修改)已由列表行的 op 徽标单独展示,故描述文案不再重复动词。
|
|
157
|
+
* 展示 id 统一取 schema.id;调用方显式传入的 historyDescription 永远优先。
|
|
158
|
+
*/
|
|
159
|
+
var describeStep = (step, getLabel, unit) => {
|
|
151
160
|
if (step.historyDescription) return step.historyDescription;
|
|
152
|
-
const { opType } = step;
|
|
153
161
|
const items = step.diff ?? [];
|
|
154
|
-
|
|
155
|
-
|
|
162
|
+
const label = (schema) => labelWithId(getLabel(schema), schema?.id);
|
|
163
|
+
if (step.opType === "add") {
|
|
156
164
|
const node = items[0]?.newSchema;
|
|
157
|
-
return
|
|
165
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
158
166
|
}
|
|
159
|
-
if (opType === "remove") {
|
|
160
|
-
const count = items.length;
|
|
167
|
+
if (step.opType === "remove") {
|
|
161
168
|
const node = items[0]?.oldSchema;
|
|
162
|
-
return
|
|
169
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
163
170
|
}
|
|
164
|
-
if (!items.length) return
|
|
171
|
+
if (!items.length) return unit;
|
|
165
172
|
if (items.length === 1) {
|
|
166
|
-
const { newSchema, changeRecords } = items[0];
|
|
167
|
-
const propPath = changeRecords?.
|
|
168
|
-
|
|
173
|
+
const { newSchema, oldSchema, changeRecords } = items[0];
|
|
174
|
+
const propPath = changeRecords?.map((changeRecord) => changeRecord.propPath).join(",");
|
|
175
|
+
const target = label(newSchema ?? oldSchema);
|
|
176
|
+
return propPath ? `${target} · ${propPath}` : target;
|
|
169
177
|
}
|
|
170
|
-
return
|
|
178
|
+
return `${items.length} 个${unit}`;
|
|
171
179
|
};
|
|
180
|
+
var describePageStep = (step) => describeStep(step, (node) => nameOf(node), "节点");
|
|
172
181
|
/**
|
|
173
182
|
* 合并组的展示文案:
|
|
174
183
|
* - 若组内任一步显式提供了 historyDescription:取最后一条非空 historyDescription(最近一次的描述更准确);
|
|
@@ -179,55 +188,7 @@ var describePageGroup = (group) => {
|
|
|
179
188
|
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
180
189
|
if (lastDesc) return lastDesc;
|
|
181
190
|
if (group.steps.length === 1) return describePageStep(group.steps[0].step);
|
|
182
|
-
|
|
183
|
-
group.steps.forEach((s) => {
|
|
184
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
185
|
-
});
|
|
186
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
187
|
-
const target = labelWithId(group.targetName ?? (group.targetId !== void 0 ? `${group.targetId}` : "节点"), group.targetId);
|
|
188
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
189
|
-
};
|
|
190
|
-
var describeDataSourceStep = (step) => {
|
|
191
|
-
if (step.historyDescription) return step.historyDescription;
|
|
192
|
-
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
193
|
-
if (!oldSchema && newSchema) return `创建 ${labelWithId(newSchema.title, newSchema.id ?? step.id)}`;
|
|
194
|
-
if (!newSchema && oldSchema) return `删除 ${labelWithId(oldSchema.title, oldSchema.id ?? step.id)}`;
|
|
195
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
196
|
-
const title = labelWithId(newSchema?.title || oldSchema?.title, step.id);
|
|
197
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
198
|
-
};
|
|
199
|
-
var describeDataSourceGroup = (group) => {
|
|
200
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
201
|
-
if (lastDesc) return lastDesc;
|
|
202
|
-
if (group.steps.length === 1) return describeDataSourceStep(group.steps[0].step);
|
|
203
|
-
const paths = /* @__PURE__ */ new Set();
|
|
204
|
-
group.steps.forEach((s) => {
|
|
205
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
206
|
-
});
|
|
207
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
208
|
-
const target = labelWithId(group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.title || group.steps[0].step.diff?.[0]?.oldSchema?.title, group.id);
|
|
209
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
210
|
-
};
|
|
211
|
-
var describeCodeBlockStep = (step) => {
|
|
212
|
-
if (step.historyDescription) return step.historyDescription;
|
|
213
|
-
const { oldSchema: oldContent, newSchema: newContent, changeRecords } = step.diff?.[0] ?? {};
|
|
214
|
-
if (!oldContent && newContent) return `创建 ${labelWithId(newContent.name, newContent.id ?? step.id)}`;
|
|
215
|
-
if (!newContent && oldContent) return `删除 ${labelWithId(oldContent.name, oldContent.id ?? step.id)}`;
|
|
216
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
217
|
-
const title = labelWithId(newContent?.name || oldContent?.name, step.id);
|
|
218
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
219
|
-
};
|
|
220
|
-
var describeCodeBlockGroup = (group) => {
|
|
221
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
222
|
-
if (lastDesc) return lastDesc;
|
|
223
|
-
if (group.steps.length === 1) return describeCodeBlockStep(group.steps[0].step);
|
|
224
|
-
const paths = /* @__PURE__ */ new Set();
|
|
225
|
-
group.steps.forEach((s) => {
|
|
226
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
227
|
-
});
|
|
228
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
229
|
-
const target = labelWithId(group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.name || group.steps[0].step.diff?.[0]?.oldSchema?.name, group.id);
|
|
230
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
191
|
+
return labelWithId(group.targetName ?? (group.targetId !== void 0 ? `${group.targetId}` : "节点"), group.targetId);
|
|
231
192
|
};
|
|
232
193
|
/**
|
|
233
194
|
* 页面 step 是否支持「回滚」(类 git revert):
|
|
@@ -242,24 +203,14 @@ var isPageStepRevertable = (step) => {
|
|
|
242
203
|
return items.every((item) => Boolean(item.changeRecords?.length));
|
|
243
204
|
};
|
|
244
205
|
/**
|
|
245
|
-
*
|
|
246
|
-
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
247
|
-
* - 更新(前后 schema 都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
248
|
-
*/
|
|
249
|
-
var isDataSourceStepRevertable = (step) => {
|
|
250
|
-
const item = step.diff?.[0];
|
|
251
|
-
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
252
|
-
return Boolean(item.changeRecords?.length);
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* 代码块 step 是否支持「回滚」:
|
|
206
|
+
* 单 diff 项历史(数据源 / 代码块)是否支持「回滚」:
|
|
256
207
|
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
257
|
-
* -
|
|
208
|
+
* - 更新(前后内容都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
258
209
|
*/
|
|
259
|
-
var
|
|
210
|
+
var isSingleDiffStepRevertable = (step) => {
|
|
260
211
|
const item = step.diff?.[0];
|
|
261
212
|
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
262
213
|
return Boolean(item.changeRecords?.length);
|
|
263
214
|
};
|
|
264
215
|
//#endregion
|
|
265
|
-
export {
|
|
216
|
+
export { describePageGroup, describePageStep, describeStep, formatHistoryFullTime, formatHistoryTime, isHistoryGroupExpanded, isPageStepRevertable, isSingleDiffStepRevertable, opLabel, sourceLabel, toRowGroup, useHistoryList };
|
|
@@ -87,7 +87,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
87
87
|
slots: {}
|
|
88
88
|
},
|
|
89
89
|
layer: {
|
|
90
|
-
$key:
|
|
90
|
+
$key: SideItemKey.LAYER,
|
|
91
91
|
type: "component",
|
|
92
92
|
icon: List,
|
|
93
93
|
text: "已选组件",
|
|
@@ -105,7 +105,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
105
105
|
slots: {}
|
|
106
106
|
},
|
|
107
107
|
[SideItemKey.CODE_BLOCK]: {
|
|
108
|
-
$key:
|
|
108
|
+
$key: SideItemKey.CODE_BLOCK,
|
|
109
109
|
type: "component",
|
|
110
110
|
icon: EditPen,
|
|
111
111
|
text: "代码编辑",
|
|
@@ -46,13 +46,13 @@ var DataSourceConfigPanel_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
46
46
|
watchEffect(() => {
|
|
47
47
|
initValues.value = props.values;
|
|
48
48
|
const config = dataSourceService.getFormConfig(initValues.value.type);
|
|
49
|
-
let activeTab = "";
|
|
49
|
+
let activeTab = "fields";
|
|
50
50
|
if (props.editMethodName) activeTab = "methods";
|
|
51
51
|
else if (props.editFieldPath?.length) activeTab = "fields";
|
|
52
|
-
dataSourceConfig.value =
|
|
52
|
+
dataSourceConfig.value = config.map((item) => item.type === "tab" ? {
|
|
53
53
|
...item,
|
|
54
54
|
active: activeTab
|
|
55
|
-
} : item)
|
|
55
|
+
} : item);
|
|
56
56
|
});
|
|
57
57
|
const submitHandler = (values, data) => {
|
|
58
58
|
emit("submit", values, data);
|
package/dist/es/utils/editor.js
CHANGED
|
@@ -208,8 +208,8 @@ var fixNodePosition = (config, parent, stage) => {
|
|
|
208
208
|
if (config.style?.position !== "absolute") return config.style;
|
|
209
209
|
const style = { ...config.style || {} };
|
|
210
210
|
const baseStyle = config.style || {};
|
|
211
|
-
if (
|
|
212
|
-
if ("top" in baseStyle && !("bottom" in baseStyle)) style.top = getMiddleTop(config, parent, stage);
|
|
211
|
+
if (!("right" in baseStyle)) style.left = fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document);
|
|
212
|
+
if (!("top" in baseStyle) && !("bottom" in baseStyle)) style.top = getMiddleTop(config, parent, stage);
|
|
213
213
|
return style;
|
|
214
214
|
};
|
|
215
215
|
var serializeConfig = (config) => serialize(config, {
|
|
@@ -6211,8 +6211,8 @@
|
|
|
6211
6211
|
if (config.style?.position !== "absolute") return config.style;
|
|
6212
6212
|
const style = { ...config.style || {} };
|
|
6213
6213
|
const baseStyle = config.style || {};
|
|
6214
|
-
if (
|
|
6215
|
-
if ("top" in baseStyle && !("bottom" in baseStyle)) style.top = getMiddleTop(config, parent, stage);
|
|
6214
|
+
if (!("right" in baseStyle)) style.left = fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document);
|
|
6215
|
+
if (!("top" in baseStyle) && !("bottom" in baseStyle)) style.top = getMiddleTop(config, parent, stage);
|
|
6216
6216
|
return style;
|
|
6217
6217
|
};
|
|
6218
6218
|
var serializeConfig = (config) => (0, serialize_javascript.default)(config, {
|
|
@@ -10175,12 +10175,13 @@
|
|
|
10175
10175
|
var toRowGroup = (group, key, descriptor) => {
|
|
10176
10176
|
const { describeGroup, describeStep, isStepDiffable, isStepRevertable } = descriptor;
|
|
10177
10177
|
const timestamp = groupTimestamp(group);
|
|
10178
|
+
const lastStep = group.steps[group.steps.length - 1]?.step;
|
|
10178
10179
|
return {
|
|
10179
10180
|
key,
|
|
10180
10181
|
applied: group.applied,
|
|
10181
10182
|
isCurrent: Boolean(group.isCurrent),
|
|
10182
10183
|
opType: group.opType,
|
|
10183
|
-
desc: describeGroup(group),
|
|
10184
|
+
desc: describeGroup ? describeGroup(group) : describeStep(lastStep),
|
|
10184
10185
|
source: groupSource(group),
|
|
10185
10186
|
time: formatHistoryTime(timestamp),
|
|
10186
10187
|
timeTitle: formatHistoryFullTime(timestamp),
|
|
@@ -10213,28 +10214,36 @@
|
|
|
10213
10214
|
var pickLastDescription = (descs) => {
|
|
10214
10215
|
for (let i = descs.length - 1; i >= 0; i--) if (descs[i]) return descs[i];
|
|
10215
10216
|
};
|
|
10216
|
-
|
|
10217
|
+
/**
|
|
10218
|
+
* 页面 / 数据源 / 代码块三类历史共用的单步描述核心。
|
|
10219
|
+
* 各类型只在「取展示名」与「实体单位名」上有差异,通过参数注入,文案模板完全一致:
|
|
10220
|
+
* - 新增 / 删除:单实体展示「label」,多实体(仅页面可能出现)退化为「N 个X」;
|
|
10221
|
+
* - 修改:展示「label · propPath」,无 diff 时兜底「X」,多实体退化为「N 个X」。
|
|
10222
|
+
* 操作类型(新增 / 删除 / 修改)已由列表行的 op 徽标单独展示,故描述文案不再重复动词。
|
|
10223
|
+
* 展示 id 统一取 schema.id;调用方显式传入的 historyDescription 永远优先。
|
|
10224
|
+
*/
|
|
10225
|
+
var describeStep = (step, getLabel, unit) => {
|
|
10217
10226
|
if (step.historyDescription) return step.historyDescription;
|
|
10218
|
-
const { opType } = step;
|
|
10219
10227
|
const items = step.diff ?? [];
|
|
10220
|
-
|
|
10221
|
-
|
|
10228
|
+
const label = (schema) => labelWithId(getLabel(schema), schema?.id);
|
|
10229
|
+
if (step.opType === "add") {
|
|
10222
10230
|
const node = items[0]?.newSchema;
|
|
10223
|
-
return
|
|
10231
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
10224
10232
|
}
|
|
10225
|
-
if (opType === "remove") {
|
|
10226
|
-
const count = items.length;
|
|
10233
|
+
if (step.opType === "remove") {
|
|
10227
10234
|
const node = items[0]?.oldSchema;
|
|
10228
|
-
return
|
|
10235
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
10229
10236
|
}
|
|
10230
|
-
if (!items.length) return
|
|
10237
|
+
if (!items.length) return unit;
|
|
10231
10238
|
if (items.length === 1) {
|
|
10232
|
-
const { newSchema, changeRecords } = items[0];
|
|
10233
|
-
const propPath = changeRecords?.
|
|
10234
|
-
|
|
10239
|
+
const { newSchema, oldSchema, changeRecords } = items[0];
|
|
10240
|
+
const propPath = changeRecords?.map((changeRecord) => changeRecord.propPath).join(",");
|
|
10241
|
+
const target = label(newSchema ?? oldSchema);
|
|
10242
|
+
return propPath ? `${target} · ${propPath}` : target;
|
|
10235
10243
|
}
|
|
10236
|
-
return
|
|
10244
|
+
return `${items.length} 个${unit}`;
|
|
10237
10245
|
};
|
|
10246
|
+
var describePageStep = (step) => describeStep(step, (node) => nameOf(node), "节点");
|
|
10238
10247
|
/**
|
|
10239
10248
|
* 合并组的展示文案:
|
|
10240
10249
|
* - 若组内任一步显式提供了 historyDescription:取最后一条非空 historyDescription(最近一次的描述更准确);
|
|
@@ -10245,55 +10254,7 @@
|
|
|
10245
10254
|
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
10246
10255
|
if (lastDesc) return lastDesc;
|
|
10247
10256
|
if (group.steps.length === 1) return describePageStep(group.steps[0].step);
|
|
10248
|
-
|
|
10249
|
-
group.steps.forEach((s) => {
|
|
10250
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
10251
|
-
});
|
|
10252
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
10253
|
-
const target = labelWithId(group.targetName ?? (group.targetId !== void 0 ? `${group.targetId}` : "节点"), group.targetId);
|
|
10254
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
10255
|
-
};
|
|
10256
|
-
var describeDataSourceStep = (step) => {
|
|
10257
|
-
if (step.historyDescription) return step.historyDescription;
|
|
10258
|
-
const { oldSchema, newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
10259
|
-
if (!oldSchema && newSchema) return `创建 ${labelWithId(newSchema.title, newSchema.id ?? step.id)}`;
|
|
10260
|
-
if (!newSchema && oldSchema) return `删除 ${labelWithId(oldSchema.title, oldSchema.id ?? step.id)}`;
|
|
10261
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
10262
|
-
const title = labelWithId(newSchema?.title || oldSchema?.title, step.id);
|
|
10263
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
10264
|
-
};
|
|
10265
|
-
var describeDataSourceGroup = (group) => {
|
|
10266
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
10267
|
-
if (lastDesc) return lastDesc;
|
|
10268
|
-
if (group.steps.length === 1) return describeDataSourceStep(group.steps[0].step);
|
|
10269
|
-
const paths = /* @__PURE__ */ new Set();
|
|
10270
|
-
group.steps.forEach((s) => {
|
|
10271
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
10272
|
-
});
|
|
10273
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
10274
|
-
const target = labelWithId(group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.title || group.steps[0].step.diff?.[0]?.oldSchema?.title, group.id);
|
|
10275
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
10276
|
-
};
|
|
10277
|
-
var describeCodeBlockStep = (step) => {
|
|
10278
|
-
if (step.historyDescription) return step.historyDescription;
|
|
10279
|
-
const { oldSchema: oldContent, newSchema: newContent, changeRecords } = step.diff?.[0] ?? {};
|
|
10280
|
-
if (!oldContent && newContent) return `创建 ${labelWithId(newContent.name, newContent.id ?? step.id)}`;
|
|
10281
|
-
if (!newContent && oldContent) return `删除 ${labelWithId(oldContent.name, oldContent.id ?? step.id)}`;
|
|
10282
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
10283
|
-
const title = labelWithId(newContent?.name || oldContent?.name, step.id);
|
|
10284
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
10285
|
-
};
|
|
10286
|
-
var describeCodeBlockGroup = (group) => {
|
|
10287
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
10288
|
-
if (lastDesc) return lastDesc;
|
|
10289
|
-
if (group.steps.length === 1) return describeCodeBlockStep(group.steps[0].step);
|
|
10290
|
-
const paths = /* @__PURE__ */ new Set();
|
|
10291
|
-
group.steps.forEach((s) => {
|
|
10292
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
10293
|
-
});
|
|
10294
|
-
const pathList = Array.from(paths).slice(0, 3).join(", ");
|
|
10295
|
-
const target = labelWithId(group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.name || group.steps[0].step.diff?.[0]?.oldSchema?.name, group.id);
|
|
10296
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? "…" : ""}` : `修改 ${target}`;
|
|
10257
|
+
return labelWithId(group.targetName ?? (group.targetId !== void 0 ? `${group.targetId}` : "节点"), group.targetId);
|
|
10297
10258
|
};
|
|
10298
10259
|
/**
|
|
10299
10260
|
* 页面 step 是否支持「回滚」(类 git revert):
|
|
@@ -10308,21 +10269,11 @@
|
|
|
10308
10269
|
return items.every((item) => Boolean(item.changeRecords?.length));
|
|
10309
10270
|
};
|
|
10310
10271
|
/**
|
|
10311
|
-
*
|
|
10312
|
-
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
10313
|
-
* - 更新(前后 schema 都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
10314
|
-
*/
|
|
10315
|
-
var isDataSourceStepRevertable = (step) => {
|
|
10316
|
-
const item = step.diff?.[0];
|
|
10317
|
-
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
10318
|
-
return Boolean(item.changeRecords?.length);
|
|
10319
|
-
};
|
|
10320
|
-
/**
|
|
10321
|
-
* 代码块 step 是否支持「回滚」:
|
|
10272
|
+
* 单 diff 项历史(数据源 / 代码块)是否支持「回滚」:
|
|
10322
10273
|
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
10323
|
-
* -
|
|
10274
|
+
* - 更新(前后内容都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
10324
10275
|
*/
|
|
10325
|
-
var
|
|
10276
|
+
var isSingleDiffStepRevertable = (step) => {
|
|
10326
10277
|
const item = step.diff?.[0];
|
|
10327
10278
|
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
10328
10279
|
return Boolean(item.changeRecords?.length);
|
|
@@ -11407,10 +11358,8 @@
|
|
|
11407
11358
|
* 基于 historyService 的 reactive state 派生,活动页切换或标记写入后自动刷新。
|
|
11408
11359
|
*/
|
|
11409
11360
|
const pageMarker = (0, vue.computed)(() => historyService.getPageMarker());
|
|
11410
|
-
/** 数据源 step 仅 update(前后 schema 都存在)时可查看差异。 */
|
|
11411
|
-
const isDataSourceStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
11412
11361
|
/** 代码块 step 仅 update(前后 content 都存在)时可查看差异。 */
|
|
11413
|
-
const
|
|
11362
|
+
const isStepDiffable = (step) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
11414
11363
|
/**
|
|
11415
11364
|
* 数据源 / 代码块两类 bucket 历史的整体渲染配置:把 title / prefix 与各自的描述、
|
|
11416
11365
|
* 可差异、可回滚判定收敛为单一对象整体注入 BucketTab,组件内部按需读取。
|
|
@@ -11418,18 +11367,16 @@
|
|
|
11418
11367
|
const dataSourceConfig = {
|
|
11419
11368
|
title: "数据源",
|
|
11420
11369
|
prefix: "ds",
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
isStepRevertable: isDataSourceStepRevertable
|
|
11370
|
+
describeStep: (step) => describeStep(step, (schema) => schema?.title, "数据源"),
|
|
11371
|
+
isStepDiffable,
|
|
11372
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
11425
11373
|
};
|
|
11426
11374
|
const codeBlockConfig = {
|
|
11427
11375
|
title: "代码块",
|
|
11428
11376
|
prefix: "cb",
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
isStepRevertable: isCodeBlockStepRevertable
|
|
11377
|
+
describeStep: (step) => describeStep(step, (content) => content?.name, "代码块"),
|
|
11378
|
+
isStepDiffable,
|
|
11379
|
+
isStepRevertable: isSingleDiffStepRevertable
|
|
11433
11380
|
};
|
|
11434
11381
|
/** 把"目标 step 索引"翻译成"目标 cursor"(已应用步骤数量)。 */
|
|
11435
11382
|
const indexToCursor = (index) => index + 1;
|
|
@@ -13730,13 +13677,13 @@
|
|
|
13730
13677
|
(0, vue.watchEffect)(() => {
|
|
13731
13678
|
initValues.value = props.values;
|
|
13732
13679
|
const config = dataSourceService.getFormConfig(initValues.value.type);
|
|
13733
|
-
let activeTab = "";
|
|
13680
|
+
let activeTab = "fields";
|
|
13734
13681
|
if (props.editMethodName) activeTab = "methods";
|
|
13735
13682
|
else if (props.editFieldPath?.length) activeTab = "fields";
|
|
13736
|
-
dataSourceConfig.value =
|
|
13683
|
+
dataSourceConfig.value = config.map((item) => item.type === "tab" ? {
|
|
13737
13684
|
...item,
|
|
13738
13685
|
active: activeTab
|
|
13739
|
-
} : item)
|
|
13686
|
+
} : item);
|
|
13740
13687
|
});
|
|
13741
13688
|
const submitHandler = (values, data) => {
|
|
13742
13689
|
emit("submit", values, data);
|
|
@@ -15134,7 +15081,7 @@
|
|
|
15134
15081
|
slots: {}
|
|
15135
15082
|
},
|
|
15136
15083
|
layer: {
|
|
15137
|
-
$key:
|
|
15084
|
+
$key: SideItemKey.LAYER,
|
|
15138
15085
|
type: "component",
|
|
15139
15086
|
icon: _element_plus_icons_vue.List,
|
|
15140
15087
|
text: "已选组件",
|
|
@@ -15152,7 +15099,7 @@
|
|
|
15152
15099
|
slots: {}
|
|
15153
15100
|
},
|
|
15154
15101
|
[SideItemKey.CODE_BLOCK]: {
|
|
15155
|
-
$key:
|
|
15102
|
+
$key: SideItemKey.CODE_BLOCK,
|
|
15156
15103
|
type: "component",
|
|
15157
15104
|
icon: _element_plus_icons_vue.EditPen,
|
|
15158
15105
|
text: "代码编辑",
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.8.0-beta.
|
|
2
|
+
"version": "1.8.0-beta.7",
|
|
3
3
|
"name": "@tmagic/editor",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"moveable": "^0.53.0",
|
|
59
59
|
"serialize-javascript": "^7.0.0",
|
|
60
60
|
"sortablejs": "^1.15.6",
|
|
61
|
-
"@tmagic/
|
|
62
|
-
"@tmagic/
|
|
63
|
-
"@tmagic/
|
|
64
|
-
"@tmagic/
|
|
65
|
-
"@tmagic/
|
|
61
|
+
"@tmagic/form": "1.8.0-beta.7",
|
|
62
|
+
"@tmagic/design": "1.8.0-beta.7",
|
|
63
|
+
"@tmagic/table": "1.8.0-beta.7",
|
|
64
|
+
"@tmagic/utils": "1.8.0-beta.7",
|
|
65
|
+
"@tmagic/stage": "1.8.0-beta.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/events": "^3.0.3",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"type-fest": "^5.2.0",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
78
|
"vue": "^3.5.34",
|
|
79
|
-
"@tmagic/core": "1.8.0-beta.
|
|
79
|
+
"@tmagic/core": "1.8.0-beta.7"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"typescript": {
|
|
@@ -135,6 +135,7 @@ import type { FormState } from '@tmagic/form';
|
|
|
135
135
|
import MIcon from '@editor/components/Icon.vue';
|
|
136
136
|
import { useServices } from '@editor/hooks/use-services';
|
|
137
137
|
import type {
|
|
138
|
+
BaseStepValue,
|
|
138
139
|
CodeBlockStepValue,
|
|
139
140
|
DataSourceStepValue,
|
|
140
141
|
DiffDialogPayload,
|
|
@@ -143,15 +144,7 @@ import type {
|
|
|
143
144
|
} from '@editor/type';
|
|
144
145
|
|
|
145
146
|
import BucketTab from './BucketTab.vue';
|
|
146
|
-
import {
|
|
147
|
-
describeCodeBlockGroup,
|
|
148
|
-
describeCodeBlockStep,
|
|
149
|
-
describeDataSourceGroup,
|
|
150
|
-
describeDataSourceStep,
|
|
151
|
-
isCodeBlockStepRevertable,
|
|
152
|
-
isDataSourceStepRevertable,
|
|
153
|
-
useHistoryList,
|
|
154
|
-
} from './composables';
|
|
147
|
+
import { describeStep, isSingleDiffStepRevertable, useHistoryList } from './composables';
|
|
155
148
|
import HistoryDiffDialog from './HistoryDiffDialog.vue';
|
|
156
149
|
import PageTab from './PageTab.vue';
|
|
157
150
|
|
|
@@ -223,34 +216,28 @@ const {
|
|
|
223
216
|
*/
|
|
224
217
|
const pageMarker = computed(() => historyService.getPageMarker());
|
|
225
218
|
|
|
226
|
-
/** 数据源 step 仅 update(前后 schema 都存在)时可查看差异。 */
|
|
227
|
-
const isDataSourceStepDiffable = (step: DataSourceStepValue) =>
|
|
228
|
-
Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
229
|
-
|
|
230
219
|
/** 代码块 step 仅 update(前后 content 都存在)时可查看差异。 */
|
|
231
|
-
const
|
|
232
|
-
Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
220
|
+
const isStepDiffable = (step: BaseStepValue) => Boolean(step.diff?.[0]?.oldSchema && step.diff?.[0]?.newSchema);
|
|
233
221
|
|
|
234
222
|
/**
|
|
235
223
|
* 数据源 / 代码块两类 bucket 历史的整体渲染配置:把 title / prefix 与各自的描述、
|
|
236
224
|
* 可差异、可回滚判定收敛为单一对象整体注入 BucketTab,组件内部按需读取。
|
|
237
225
|
*/
|
|
226
|
+
// 数据源/代码块不做相邻合并,每组恒为单步,省略 describeGroup,由 toRowGroup 回退到 describeStep。
|
|
238
227
|
const dataSourceConfig: HistoryBucketConfig<DataSourceStepValue> = {
|
|
239
228
|
title: '数据源',
|
|
240
229
|
prefix: 'ds',
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
isStepRevertable: isDataSourceStepRevertable,
|
|
230
|
+
describeStep: (step: DataSourceStepValue): string => describeStep(step, (schema) => schema?.title, '数据源'),
|
|
231
|
+
isStepDiffable,
|
|
232
|
+
isStepRevertable: isSingleDiffStepRevertable,
|
|
245
233
|
};
|
|
246
234
|
|
|
247
235
|
const codeBlockConfig: HistoryBucketConfig<CodeBlockStepValue> = {
|
|
248
236
|
title: '代码块',
|
|
249
237
|
prefix: 'cb',
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
isStepRevertable: isCodeBlockStepRevertable,
|
|
238
|
+
describeStep: (step: CodeBlockStepValue): string => describeStep(step, (content) => content?.name, '代码块'),
|
|
239
|
+
isStepDiffable,
|
|
240
|
+
isStepRevertable: isSingleDiffStepRevertable,
|
|
254
241
|
};
|
|
255
242
|
|
|
256
243
|
/** 把"目标 step 索引"翻译成"目标 cursor"(已应用步骤数量)。 */
|
|
@@ -5,10 +5,6 @@ import { datetimeFormatter } from '@tmagic/form';
|
|
|
5
5
|
import { useServices } from '@editor/hooks/use-services';
|
|
6
6
|
import type {
|
|
7
7
|
BaseStepValue,
|
|
8
|
-
CodeBlockHistoryGroup,
|
|
9
|
-
CodeBlockStepValue,
|
|
10
|
-
DataSourceHistoryGroup,
|
|
11
|
-
DataSourceStepValue,
|
|
12
8
|
HistoryOpSource,
|
|
13
9
|
HistoryOpType,
|
|
14
10
|
HistoryRowDescriptor,
|
|
@@ -227,12 +223,14 @@ export const toRowGroup = <T extends BaseStepValue = BaseStepValue>(
|
|
|
227
223
|
): HistoryRowGroup => {
|
|
228
224
|
const { describeGroup, describeStep, isStepDiffable, isStepRevertable } = descriptor;
|
|
229
225
|
const timestamp = groupTimestamp(group);
|
|
226
|
+
// 无 describeGroup 时回退到组内最后一步的 describeStep:数据源/代码块不做相邻合并,每组恒为单步,二者等价。
|
|
227
|
+
const lastStep = group.steps[group.steps.length - 1]?.step;
|
|
230
228
|
return {
|
|
231
229
|
key,
|
|
232
230
|
applied: group.applied,
|
|
233
231
|
isCurrent: Boolean(group.isCurrent),
|
|
234
232
|
opType: group.opType,
|
|
235
|
-
desc: describeGroup(group),
|
|
233
|
+
desc: describeGroup ? describeGroup(group) : describeStep(lastStep),
|
|
236
234
|
source: groupSource(group),
|
|
237
235
|
time: formatHistoryTime(timestamp),
|
|
238
236
|
timeTitle: formatHistoryFullTime(timestamp),
|
|
@@ -273,30 +271,43 @@ const pickLastDescription = (descs: (string | undefined)[]): string | undefined
|
|
|
273
271
|
return undefined;
|
|
274
272
|
};
|
|
275
273
|
|
|
276
|
-
|
|
274
|
+
/**
|
|
275
|
+
* 页面 / 数据源 / 代码块三类历史共用的单步描述核心。
|
|
276
|
+
* 各类型只在「取展示名」与「实体单位名」上有差异,通过参数注入,文案模板完全一致:
|
|
277
|
+
* - 新增 / 删除:单实体展示「label」,多实体(仅页面可能出现)退化为「N 个X」;
|
|
278
|
+
* - 修改:展示「label · propPath」,无 diff 时兜底「X」,多实体退化为「N 个X」。
|
|
279
|
+
* 操作类型(新增 / 删除 / 修改)已由列表行的 op 徽标单独展示,故描述文案不再重复动词。
|
|
280
|
+
* 展示 id 统一取 schema.id;调用方显式传入的 historyDescription 永远优先。
|
|
281
|
+
*/
|
|
282
|
+
export const describeStep = <T>(
|
|
283
|
+
step: BaseStepValue<T>,
|
|
284
|
+
getLabel: (_schema?: T) => string | number | undefined,
|
|
285
|
+
unit: string,
|
|
286
|
+
): string => {
|
|
277
287
|
if (step.historyDescription) return step.historyDescription;
|
|
278
|
-
const { opType } = step;
|
|
279
288
|
const items = step.diff ?? [];
|
|
280
|
-
|
|
281
|
-
|
|
289
|
+
const label = (schema?: T) => labelWithId(getLabel(schema), (schema as { id?: string | number } | undefined)?.id);
|
|
290
|
+
|
|
291
|
+
if (step.opType === 'add') {
|
|
282
292
|
const node = items[0]?.newSchema;
|
|
283
|
-
return
|
|
293
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
284
294
|
}
|
|
285
|
-
if (opType === 'remove') {
|
|
286
|
-
const count = items.length;
|
|
295
|
+
if (step.opType === 'remove') {
|
|
287
296
|
const node = items[0]?.oldSchema;
|
|
288
|
-
return
|
|
297
|
+
return items.length === 1 && node ? label(node) : `${items.length} 个${unit}`;
|
|
289
298
|
}
|
|
290
|
-
if (!items.length) return
|
|
299
|
+
if (!items.length) return unit;
|
|
291
300
|
if (items.length === 1) {
|
|
292
|
-
const { newSchema, changeRecords } = items[0];
|
|
293
|
-
const propPath = changeRecords?.
|
|
294
|
-
const target =
|
|
295
|
-
return
|
|
301
|
+
const { newSchema, oldSchema, changeRecords } = items[0];
|
|
302
|
+
const propPath = changeRecords?.map((changeRecord) => changeRecord.propPath).join(',');
|
|
303
|
+
const target = label(newSchema ?? oldSchema);
|
|
304
|
+
return propPath ? `${target} · ${propPath}` : target;
|
|
296
305
|
}
|
|
297
|
-
return
|
|
306
|
+
return `${items.length} 个${unit}`;
|
|
298
307
|
};
|
|
299
308
|
|
|
309
|
+
export const describePageStep = (step: StepValue): string => describeStep(step, (node) => nameOf(node), '节点');
|
|
310
|
+
|
|
300
311
|
/**
|
|
301
312
|
* 合并组的展示文案:
|
|
302
313
|
* - 若组内任一步显式提供了 historyDescription:取最后一条非空 historyDescription(最近一次的描述更准确);
|
|
@@ -307,68 +318,8 @@ export const describePageGroup = (group: PageHistoryGroup) => {
|
|
|
307
318
|
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
308
319
|
if (lastDesc) return lastDesc;
|
|
309
320
|
if (group.steps.length === 1) return describePageStep(group.steps[0].step);
|
|
310
|
-
const paths = new Set<string>();
|
|
311
|
-
group.steps.forEach((s) => {
|
|
312
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
313
|
-
});
|
|
314
|
-
const pathList = Array.from(paths).slice(0, 3).join(', ');
|
|
315
|
-
const target = labelWithId(
|
|
316
|
-
group.targetName ?? (group.targetId !== undefined ? `${group.targetId}` : '节点'),
|
|
317
|
-
group.targetId,
|
|
318
|
-
);
|
|
319
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? '…' : ''}` : `修改 ${target}`;
|
|
320
|
-
};
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
if (step.historyDescription) return step.historyDescription;
|
|
324
|
-
const { oldSchema: oldSchema, newSchema: newSchema, changeRecords } = step.diff?.[0] ?? {};
|
|
325
|
-
if (!oldSchema && newSchema) return `创建 ${labelWithId(newSchema.title, newSchema.id ?? step.id)}`;
|
|
326
|
-
if (!newSchema && oldSchema) return `删除 ${labelWithId(oldSchema.title, oldSchema.id ?? step.id)}`;
|
|
327
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
328
|
-
const title = labelWithId(newSchema?.title || oldSchema?.title, step.id);
|
|
329
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export const describeDataSourceGroup = (group: DataSourceHistoryGroup) => {
|
|
333
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
334
|
-
if (lastDesc) return lastDesc;
|
|
335
|
-
if (group.steps.length === 1) return describeDataSourceStep(group.steps[0].step);
|
|
336
|
-
const paths = new Set<string>();
|
|
337
|
-
group.steps.forEach((s) => {
|
|
338
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
339
|
-
});
|
|
340
|
-
const pathList = Array.from(paths).slice(0, 3).join(', ');
|
|
341
|
-
const rawTitle =
|
|
342
|
-
group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.title ||
|
|
343
|
-
group.steps[0].step.diff?.[0]?.oldSchema?.title;
|
|
344
|
-
const target = labelWithId(rawTitle, group.id);
|
|
345
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? '…' : ''}` : `修改 ${target}`;
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
export const describeCodeBlockStep = (step: CodeBlockStepValue) => {
|
|
349
|
-
if (step.historyDescription) return step.historyDescription;
|
|
350
|
-
const { oldSchema: oldContent, newSchema: newContent, changeRecords } = step.diff?.[0] ?? {};
|
|
351
|
-
if (!oldContent && newContent) return `创建 ${labelWithId(newContent.name, newContent.id ?? step.id)}`;
|
|
352
|
-
if (!newContent && oldContent) return `删除 ${labelWithId(oldContent.name, oldContent.id ?? step.id)}`;
|
|
353
|
-
const propPath = changeRecords?.[0]?.propPath;
|
|
354
|
-
const title = labelWithId(newContent?.name || oldContent?.name, step.id);
|
|
355
|
-
return propPath ? `修改 ${title} · ${propPath}` : `修改 ${title}`;
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
export const describeCodeBlockGroup = (group: CodeBlockHistoryGroup) => {
|
|
359
|
-
const lastDesc = pickLastDescription(group.steps.map((s) => s.step.historyDescription));
|
|
360
|
-
if (lastDesc) return lastDesc;
|
|
361
|
-
if (group.steps.length === 1) return describeCodeBlockStep(group.steps[0].step);
|
|
362
|
-
const paths = new Set<string>();
|
|
363
|
-
group.steps.forEach((s) => {
|
|
364
|
-
s.step.diff?.[0]?.changeRecords?.forEach((r) => r.propPath && paths.add(r.propPath));
|
|
365
|
-
});
|
|
366
|
-
const pathList = Array.from(paths).slice(0, 3).join(', ');
|
|
367
|
-
const rawName =
|
|
368
|
-
group.steps[group.steps.length - 1].step.diff?.[0]?.newSchema?.name ||
|
|
369
|
-
group.steps[0].step.diff?.[0]?.oldSchema?.name;
|
|
370
|
-
const target = labelWithId(rawName, group.id);
|
|
371
|
-
return pathList ? `修改 ${target} · ${pathList}${paths.size > 3 ? '…' : ''}` : `修改 ${target}`;
|
|
322
|
+
return labelWithId(group.targetName ?? (group.targetId !== undefined ? `${group.targetId}` : '节点'), group.targetId);
|
|
372
323
|
};
|
|
373
324
|
|
|
374
325
|
/**
|
|
@@ -385,22 +336,11 @@ export const isPageStepRevertable = (step: StepValue): boolean => {
|
|
|
385
336
|
};
|
|
386
337
|
|
|
387
338
|
/**
|
|
388
|
-
*
|
|
389
|
-
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
390
|
-
* - 更新(前后 schema 都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
391
|
-
*/
|
|
392
|
-
export const isDataSourceStepRevertable = (step: DataSourceStepValue): boolean => {
|
|
393
|
-
const item = step.diff?.[0];
|
|
394
|
-
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
395
|
-
return Boolean(item.changeRecords?.length);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* 代码块 step 是否支持「回滚」:
|
|
339
|
+
* 单 diff 项历史(数据源 / 代码块)是否支持「回滚」:
|
|
400
340
|
* - 新增(无 oldSchema)/ 删除(无 newSchema):不依赖 changeRecords,始终可回滚;
|
|
401
|
-
* -
|
|
341
|
+
* - 更新(前后内容都存在):必须有 changeRecords 才支持局部反向 patch,否则不支持回滚。
|
|
402
342
|
*/
|
|
403
|
-
export const
|
|
343
|
+
export const isSingleDiffStepRevertable = (step: BaseStepValue): boolean => {
|
|
404
344
|
const item = step.diff?.[0];
|
|
405
345
|
if (!item?.oldSchema || !item?.newSchema) return true;
|
|
406
346
|
return Boolean(item.changeRecords?.length);
|
|
@@ -257,7 +257,7 @@ const getItemConfig = (data: SideItem): SideComponent => {
|
|
|
257
257
|
slots: {},
|
|
258
258
|
},
|
|
259
259
|
layer: {
|
|
260
|
-
$key:
|
|
260
|
+
$key: SideItemKey.LAYER,
|
|
261
261
|
type: 'component',
|
|
262
262
|
icon: List,
|
|
263
263
|
text: '已选组件',
|
|
@@ -277,7 +277,7 @@ const getItemConfig = (data: SideItem): SideComponent => {
|
|
|
277
277
|
slots: {},
|
|
278
278
|
},
|
|
279
279
|
[SideItemKey.CODE_BLOCK]: {
|
|
280
|
-
$key:
|
|
280
|
+
$key: SideItemKey.CODE_BLOCK,
|
|
281
281
|
type: 'component',
|
|
282
282
|
icon: EditPen,
|
|
283
283
|
text: '代码编辑',
|
|
@@ -83,16 +83,17 @@ watchEffect(() => {
|
|
|
83
83
|
const config = dataSourceService.getFormConfig(initValues.value.type);
|
|
84
84
|
|
|
85
85
|
// 传入方法名/字段路径时,将外层 tab 容器默认激活到对应 tab(status: methods / fields)
|
|
86
|
-
|
|
86
|
+
// 未传入时默认激活「数据定义」tab(fields)
|
|
87
|
+
let activeTab = 'fields';
|
|
87
88
|
if (props.editMethodName) {
|
|
88
89
|
activeTab = 'methods';
|
|
89
90
|
} else if (props.editFieldPath?.length) {
|
|
90
91
|
activeTab = 'fields';
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
dataSourceConfig.value =
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
dataSourceConfig.value = config.map((item) =>
|
|
95
|
+
(item as { type?: string }).type === 'tab' ? { ...item, active: activeTab } : item,
|
|
96
|
+
);
|
|
96
97
|
});
|
|
97
98
|
|
|
98
99
|
const submitHandler = (values: any, data: ContainerChangeEventData) => {
|
package/src/services/history.ts
CHANGED
|
@@ -23,9 +23,7 @@ import type { ChangeRecord } from '@tmagic/form';
|
|
|
23
23
|
import { guid } from '@tmagic/utils';
|
|
24
24
|
|
|
25
25
|
import type {
|
|
26
|
-
CodeBlockHistoryGroup,
|
|
27
26
|
CodeBlockStepValue,
|
|
28
|
-
DataSourceHistoryGroup,
|
|
29
27
|
DataSourceStepValue,
|
|
30
28
|
HistoryOpSource,
|
|
31
29
|
HistoryPersistOptions,
|
|
@@ -33,6 +31,7 @@ import type {
|
|
|
33
31
|
PageHistoryGroup,
|
|
34
32
|
PageHistoryStepEntry,
|
|
35
33
|
PersistedHistoryState,
|
|
34
|
+
StackHistoryGroup,
|
|
36
35
|
StepValue,
|
|
37
36
|
} from '@editor/type';
|
|
38
37
|
import { getEditorConfig } from '@editor/utils/config';
|
|
@@ -527,8 +526,8 @@ class History extends BaseService {
|
|
|
527
526
|
* 取出全部代码块的历史栈,按 codeBlockId 分桶展示。
|
|
528
527
|
* 同一栈内每条操作记录独立成组,不做相邻 update 合并。
|
|
529
528
|
*/
|
|
530
|
-
public getCodeBlockHistoryGroups():
|
|
531
|
-
const groups:
|
|
529
|
+
public getCodeBlockHistoryGroups(): StackHistoryGroup<CodeBlockStepValue, 'code-block'>[] {
|
|
530
|
+
const groups: StackHistoryGroup<CodeBlockStepValue, 'code-block'>[] = [];
|
|
532
531
|
Object.entries(this.state.codeBlockState).forEach(([id, undoRedo]) => {
|
|
533
532
|
if (!undoRedo) return;
|
|
534
533
|
const list = undoRedo.getElementList();
|
|
@@ -619,8 +618,8 @@ class History extends BaseService {
|
|
|
619
618
|
/**
|
|
620
619
|
* 取出全部数据源的历史栈,按 dataSourceId 分桶展示。同上,每条操作独立成组。
|
|
621
620
|
*/
|
|
622
|
-
public getDataSourceHistoryGroups():
|
|
623
|
-
const groups:
|
|
621
|
+
public getDataSourceHistoryGroups(): StackHistoryGroup<DataSourceStepValue, 'data-source'>[] {
|
|
622
|
+
const groups: StackHistoryGroup<DataSourceStepValue, 'data-source'>[] = [];
|
|
624
623
|
Object.entries(this.state.dataSourceState).forEach(([id, undoRedo]) => {
|
|
625
624
|
if (!undoRedo) return;
|
|
626
625
|
const list = undoRedo.getElementList();
|
package/src/type.ts
CHANGED
|
@@ -962,32 +962,26 @@ export interface PageHistoryGroup {
|
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
/**
|
|
965
|
-
*
|
|
966
|
-
*
|
|
967
|
-
* -
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
/** 关联的 codeBlock id */
|
|
972
|
-
id: Id;
|
|
973
|
-
/** 该分组的操作类型 */
|
|
974
|
-
opType: HistoryOpType;
|
|
975
|
-
/** 组内所有步骤,按时间正序 */
|
|
976
|
-
steps: { step: CodeBlockStepValue; index: number; applied: boolean; isCurrent?: boolean }[];
|
|
977
|
-
/** 组内最后一步是否已应用,用于整组的状态展示 */
|
|
978
|
-
applied: boolean;
|
|
979
|
-
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
980
|
-
isCurrent?: boolean;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
/**
|
|
984
|
-
* 数据源历史面板分组,结构同 CodeBlockHistoryGroup。
|
|
965
|
+
* 数据源 / 代码块历史面板分组(按 id 分栈展示)。
|
|
966
|
+
* 二者结构完全一致,仅 `kind` 与 step 类型不同,统一由该泛型描述:
|
|
967
|
+
* - 数据源:`StackHistoryGroup<DataSourceStepValue, 'data-source'>`;
|
|
968
|
+
* - 代码块:`StackHistoryGroup<CodeBlockStepValue, 'code-block'>`。
|
|
969
|
+
*
|
|
970
|
+
* 每条操作记录独立成组,不做相邻合并(与页面历史 {@link PageHistoryGroup} 不同),故 `steps` 恒为单元素。
|
|
985
971
|
*/
|
|
986
|
-
export interface
|
|
987
|
-
|
|
972
|
+
export interface StackHistoryGroup<
|
|
973
|
+
T extends BaseStepValue = BaseStepValue,
|
|
974
|
+
K extends 'code-block' | 'data-source' = 'code-block' | 'data-source',
|
|
975
|
+
> {
|
|
976
|
+
/** 区分代码块 / 数据源。 */
|
|
977
|
+
kind: K;
|
|
978
|
+
/** 关联的代码块 / 数据源 id。 */
|
|
988
979
|
id: Id;
|
|
980
|
+
/** 该分组的操作类型。 */
|
|
989
981
|
opType: HistoryOpType;
|
|
990
|
-
|
|
982
|
+
/** 组内所有步骤,按时间正序(不做相邻合并,恒为单元素)。 */
|
|
983
|
+
steps: { step: T; index: number; applied: boolean; isCurrent?: boolean }[];
|
|
984
|
+
/** 组内最后一步是否已应用,用于整组的状态展示。 */
|
|
991
985
|
applied: boolean;
|
|
992
986
|
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
993
987
|
isCurrent?: boolean;
|
|
@@ -1296,8 +1290,11 @@ export interface DiffDialogPayload {
|
|
|
1296
1290
|
* 各自实现一份,作为整体注入,避免把 describe* / isStep* 拆成多个独立 props 反复透传。
|
|
1297
1291
|
*/
|
|
1298
1292
|
export interface HistoryRowDescriptor<T extends BaseStepValue = BaseStepValue> {
|
|
1299
|
-
/**
|
|
1300
|
-
|
|
1293
|
+
/**
|
|
1294
|
+
* 组级描述文案生成器,接收一个 group,返回展示文本。
|
|
1295
|
+
* 不传时回退到对组内最后一步调用 {@link describeStep}(适用于不做相邻合并、每组恒为单步的历史,如数据源/代码块)。
|
|
1296
|
+
*/
|
|
1297
|
+
describeGroup?: (_group: any) => string;
|
|
1301
1298
|
/** 单步描述文案生成器,接收一个 step,返回展示文本(合并组展开后的子步列表用)。 */
|
|
1302
1299
|
describeStep: (_step: T) => string;
|
|
1303
1300
|
/** 判断某个 step 是否可查看差异(前后值都存在)。不传则一律不展示差异入口。 */
|
package/src/utils/editor.ts
CHANGED
|
@@ -378,11 +378,11 @@ export const fixNodePosition = (config: MNode, parent: MContainer, stage: StageC
|
|
|
378
378
|
const style = { ...(config.style || {}) };
|
|
379
379
|
const baseStyle = config.style || {};
|
|
380
380
|
|
|
381
|
-
if (
|
|
381
|
+
if (!('right' in baseStyle)) {
|
|
382
382
|
style.left = fixNodeLeft(config, parent, stage?.renderer?.contentWindow?.document);
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
if ('top' in baseStyle && !('bottom' in baseStyle)) {
|
|
385
|
+
if (!('top' in baseStyle) && !('bottom' in baseStyle)) {
|
|
386
386
|
style.top = getMiddleTop(config, parent, stage);
|
|
387
387
|
}
|
|
388
388
|
|
package/src/utils/history.ts
CHANGED
|
@@ -26,9 +26,9 @@ import { guid } from '@tmagic/utils';
|
|
|
26
26
|
import type {
|
|
27
27
|
BaseStepValue,
|
|
28
28
|
HistoryOpSource,
|
|
29
|
-
HistoryOpType,
|
|
30
29
|
PageHistoryGroup,
|
|
31
30
|
PageHistoryStepEntry,
|
|
31
|
+
StackHistoryGroup,
|
|
32
32
|
StepDiffItem,
|
|
33
33
|
StepValue,
|
|
34
34
|
} from '@editor/type';
|
|
@@ -131,14 +131,7 @@ export const mergeStackSteps = <S extends BaseStepValue, K extends 'code-block'
|
|
|
131
131
|
id: Id,
|
|
132
132
|
list: S[],
|
|
133
133
|
cursor: number,
|
|
134
|
-
): {
|
|
135
|
-
kind: K;
|
|
136
|
-
id: Id;
|
|
137
|
-
opType: HistoryOpType;
|
|
138
|
-
steps: { step: S; index: number; applied: boolean; isCurrent?: boolean }[];
|
|
139
|
-
applied: boolean;
|
|
140
|
-
isCurrent?: boolean;
|
|
141
|
-
}[] => {
|
|
134
|
+
): StackHistoryGroup<S, K>[] => {
|
|
142
135
|
const currentIndex = cursor - 1;
|
|
143
136
|
return list.map((step, index) => {
|
|
144
137
|
const applied = index < cursor;
|
package/types/index.d.ts
CHANGED
|
@@ -1170,7 +1170,7 @@ declare class History extends BaseService {
|
|
|
1170
1170
|
* 取出全部代码块的历史栈,按 codeBlockId 分桶展示。
|
|
1171
1171
|
* 同一栈内每条操作记录独立成组,不做相邻 update 合并。
|
|
1172
1172
|
*/
|
|
1173
|
-
getCodeBlockHistoryGroups():
|
|
1173
|
+
getCodeBlockHistoryGroups(): StackHistoryGroup<CodeBlockStepValue, 'code-block'>[];
|
|
1174
1174
|
/**
|
|
1175
1175
|
* 读取指定页面历史栈的当前游标(已应用步骤数量)。不传则取当前活动页。
|
|
1176
1176
|
* 没有对应栈时返回 0。
|
|
@@ -1220,7 +1220,7 @@ declare class History extends BaseService {
|
|
|
1220
1220
|
/**
|
|
1221
1221
|
* 取出全部数据源的历史栈,按 dataSourceId 分桶展示。同上,每条操作独立成组。
|
|
1222
1222
|
*/
|
|
1223
|
-
getDataSourceHistoryGroups():
|
|
1223
|
+
getDataSourceHistoryGroups(): StackHistoryGroup<DataSourceStepValue, 'data-source'>[];
|
|
1224
1224
|
/**
|
|
1225
1225
|
* 取出指定页面的栈;不传 pageId 时按当前活动页取。
|
|
1226
1226
|
*
|
|
@@ -2244,41 +2244,28 @@ interface PageHistoryGroup {
|
|
|
2244
2244
|
isCurrent?: boolean;
|
|
2245
2245
|
}
|
|
2246
2246
|
/**
|
|
2247
|
-
*
|
|
2248
|
-
*
|
|
2249
|
-
* -
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
/** 关联的 codeBlock id */
|
|
2254
|
-
id: Id;
|
|
2255
|
-
/** 该分组的操作类型 */
|
|
2256
|
-
opType: HistoryOpType;
|
|
2257
|
-
/** 组内所有步骤,按时间正序 */
|
|
2258
|
-
steps: {
|
|
2259
|
-
step: CodeBlockStepValue;
|
|
2260
|
-
index: number;
|
|
2261
|
-
applied: boolean;
|
|
2262
|
-
isCurrent?: boolean;
|
|
2263
|
-
}[];
|
|
2264
|
-
/** 组内最后一步是否已应用,用于整组的状态展示 */
|
|
2265
|
-
applied: boolean;
|
|
2266
|
-
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
2267
|
-
isCurrent?: boolean;
|
|
2268
|
-
}
|
|
2269
|
-
/**
|
|
2270
|
-
* 数据源历史面板分组,结构同 CodeBlockHistoryGroup。
|
|
2247
|
+
* 数据源 / 代码块历史面板分组(按 id 分栈展示)。
|
|
2248
|
+
* 二者结构完全一致,仅 `kind` 与 step 类型不同,统一由该泛型描述:
|
|
2249
|
+
* - 数据源:`StackHistoryGroup<DataSourceStepValue, 'data-source'>`;
|
|
2250
|
+
* - 代码块:`StackHistoryGroup<CodeBlockStepValue, 'code-block'>`。
|
|
2251
|
+
*
|
|
2252
|
+
* 每条操作记录独立成组,不做相邻合并(与页面历史 {@link PageHistoryGroup} 不同),故 `steps` 恒为单元素。
|
|
2271
2253
|
*/
|
|
2272
|
-
interface
|
|
2273
|
-
|
|
2254
|
+
interface StackHistoryGroup<T extends BaseStepValue = BaseStepValue, K extends 'code-block' | 'data-source' = 'code-block' | 'data-source'> {
|
|
2255
|
+
/** 区分代码块 / 数据源。 */
|
|
2256
|
+
kind: K;
|
|
2257
|
+
/** 关联的代码块 / 数据源 id。 */
|
|
2274
2258
|
id: Id;
|
|
2259
|
+
/** 该分组的操作类型。 */
|
|
2275
2260
|
opType: HistoryOpType;
|
|
2261
|
+
/** 组内所有步骤,按时间正序(不做相邻合并,恒为单元素)。 */
|
|
2276
2262
|
steps: {
|
|
2277
|
-
step:
|
|
2263
|
+
step: T;
|
|
2278
2264
|
index: number;
|
|
2279
2265
|
applied: boolean;
|
|
2280
2266
|
isCurrent?: boolean;
|
|
2281
2267
|
}[];
|
|
2268
|
+
/** 组内最后一步是否已应用,用于整组的状态展示。 */
|
|
2282
2269
|
applied: boolean;
|
|
2283
2270
|
/** 是否为当前所在的分组(包含该栈最近一次已应用步骤的那一组)。 */
|
|
2284
2271
|
isCurrent?: boolean;
|
|
@@ -2496,8 +2483,11 @@ interface DiffDialogPayload {
|
|
|
2496
2483
|
* 各自实现一份,作为整体注入,避免把 describe* / isStep* 拆成多个独立 props 反复透传。
|
|
2497
2484
|
*/
|
|
2498
2485
|
interface HistoryRowDescriptor<T extends BaseStepValue = BaseStepValue> {
|
|
2499
|
-
/**
|
|
2500
|
-
|
|
2486
|
+
/**
|
|
2487
|
+
* 组级描述文案生成器,接收一个 group,返回展示文本。
|
|
2488
|
+
* 不传时回退到对组内最后一步调用 {@link describeStep}(适用于不做相邻合并、每组恒为单步的历史,如数据源/代码块)。
|
|
2489
|
+
*/
|
|
2490
|
+
describeGroup?: (_group: any) => string;
|
|
2501
2491
|
/** 单步描述文案生成器,接收一个 step,返回展示文本(合并组展开后的子步列表用)。 */
|
|
2502
2492
|
describeStep: (_step: T) => string;
|
|
2503
2493
|
/** 判断某个 step 是否可查看差异(前后值都存在)。不传则一律不展示差异入口。 */
|
|
@@ -3050,19 +3040,7 @@ declare const markStackSaved: <S extends {
|
|
|
3050
3040
|
*
|
|
3051
3041
|
* 代码块与数据源除 `kind` 外结构完全一致,统一由本方法处理;`kind` 决定返回的具体分组类型。
|
|
3052
3042
|
*/
|
|
3053
|
-
declare const mergeStackSteps: <S extends BaseStepValue, K extends "code-block" | "data-source">(kind: K, id: Id, list: S[], cursor: number) =>
|
|
3054
|
-
kind: K;
|
|
3055
|
-
id: Id;
|
|
3056
|
-
opType: HistoryOpType;
|
|
3057
|
-
steps: {
|
|
3058
|
-
step: S;
|
|
3059
|
-
index: number;
|
|
3060
|
-
applied: boolean;
|
|
3061
|
-
isCurrent?: boolean;
|
|
3062
|
-
}[];
|
|
3063
|
-
applied: boolean;
|
|
3064
|
-
isCurrent?: boolean;
|
|
3065
|
-
}[];
|
|
3043
|
+
declare const mergeStackSteps: <S extends BaseStepValue, K extends "code-block" | "data-source">(kind: K, id: Id, list: S[], cursor: number) => StackHistoryGroup<S, K>[];
|
|
3066
3044
|
/**
|
|
3067
3045
|
* 把页面栈拆成若干 group:
|
|
3068
3046
|
* - 单节点的 'update' 按 targetId 与相邻同 targetId 的 update 合并到一个 group;
|
|
@@ -6218,4 +6196,4 @@ declare const _default$40: {
|
|
|
6218
6196
|
install: (app: App, opt?: Partial<EditorInstallOptions | DesignPluginOptions | FormInstallOptions>) => void;
|
|
6219
6197
|
};
|
|
6220
6198
|
//#endregion
|
|
6221
|
-
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor,
|
|
6199
|
+
export { AddMNode, AddPrefixToObject, AsyncAfterHook, AsyncBeforeHook, AsyncHookPlugin, AsyncMethodName, BaseStepValue, BeforeAdd, CODE_DRAFT_STORAGE_KEY, COPY_CODE_STORAGE_KEY, COPY_DS_STORAGE_KEY, COPY_STORAGE_KEY, CanDropInFunction, CanDropInScene, _default as CodeBlockEditor, _default$1 as CodeBlockList, _default$2 as CodeBlockListPanel, CodeBlockListPanelSlots, CodeBlockListSlots, CodeBlockStepValue, CodeDeleteErrorType, CodeDslItem, CodeParamStatement, CodeRelation, _default$3 as CodeSelect, _default$4 as CodeSelectCol, CodeState, ColumnLayout, CombineInfo, CompareCategory, _default$5 as CompareForm, CompareFormLoadConfig, CompareFormLoadConfigContext, ComponentGroup, ComponentGroupState, ComponentItem, _default$6 as ComponentListPanel, ComponentListPanelSlots, _default$7 as CondOpSelect, _default$8 as ContentMenu, CustomContentMenuFunction, DEFAULT_LEFT_COLUMN_WIDTH, DEFAULT_RIGHT_COLUMN_WIDTH, _default$9 as DataSourceAddButton, _default$10 as DataSourceConfigPanel, _default$11 as DataSourceFieldSelect, _default$12 as DataSourceFields, _default$13 as DataSourceInput, DataSourceListSlots, _default$14 as DataSourceMethodSelect, _default$15 as DataSourceMethods, _default$16 as DataSourceMocks, _default$17 as DataSourceSelect, DataSourceStepValue, DatasourceTypeOption, DepTargetType, DiffDialogPayload, _default$18 as DisplayConds, DragClassification, DragType, DslOpOptions, DslOpWithHistoryIdsResult, EditorEvents, EditorInstallOptions, EditorNodeInfo, EditorSlots, EventBus, EventBusEvent, _default$19 as EventSelect, Fixed2Other, _default$20 as FloatingBox, FrameworkSlots, GetCodeBlockFormConfigOptions, GetColumnWidth, GetConfig, H_GUIDE_LINE_STORAGE_KEY, HistoryBucketConfig, _default$21 as HistoryDiffDialog, _default$22 as HistoryListBucket, _default$23 as HistoryListBucketTab, HistoryListExtraTab, HistoryOpOptions, HistoryOpOptionsWithChangeRecords, HistoryOpSource, HistoryOpType, HistoryPersistOptions, HistoryRowDescriptor, HistoryState, _default$24 as Icon, IdleTask, IdleTaskEvents, IsExpandableFunction, KeyBindingCacheItem, KeyBindingCommand, KeyBindingItem, _default$25 as KeyValue, Keys, LEFT_COLUMN_WIDTH_STORAGE_KEY, LayerNodeSlots, LayerNodeStatus, LayerOffset, _default$26 as LayerPanel, LayerPanelSlots, Layout, _default$27 as LayoutContainer, _default$27 as SplitView, ListState, MIN_CENTER_COLUMN_WIDTH, MIN_LEFT_COLUMN_WIDTH, MIN_RIGHT_COLUMN_WIDTH, MenuBarData, MenuButton, MenuComponent, MenuItem, type OnDrag, PROPS_PANEL_WIDTH_STORAGE_KEY, PageBarSortOptions, _default$28 as PageFragmentSelect, PageHistoryGroup, PageHistoryStepEntry, PartSortableOptions, PastePosition, PersistedHistoryState, PropsFormConfigFunction, _default$29 as PropsFormPanel, PropsFormValueFunction, _default$30 as PropsPanel, PropsPanelSlots, PropsState, RIGHT_COLUMN_WIDTH_STORAGE_KEY, _default$31 as Resizer, ScrollViewer, ScrollViewerEvent, ScrollViewerSlots, SerializedUndoRedo, Services, SetColumnWidth, SideBarData, SideComponent, SideItem, SideItemKey, SidebarSlots, StackHistoryGroup, StageCore, StageOptions, StageOverlayState, StageRect, StageSlots, StepDiffItem, StepValue, StoreState, StoreStateKey, _default$32 as StyleSetter, SyncAfterHook, SyncBeforeHook, SyncHookPlugin, _default$33 as TMagicCodeEditor, _default$34 as TMagicEditor, _default$35 as ToolButton, _default$36 as Tree, _default$37 as TreeNode, TreeNodeData, UI_SELECT_MODE_EVENT_NAME, UiState, UndoRedo, V_GUIDE_LINE_STORAGE_KEY, WorkspaceSlots, advancedTabConfig, arrayOptions, beforePaste, buildChangeRecords, calcAlignCenterStyle, calcLayerTargetIndex, calcMoveStyle, canUsePluginMethods, change2Fixed, classifyDragSources, _default$38 as codeBlockService, collectRelatedNodes, createStackStep, _default$39 as dataSourceService, debug, _default$40 as default, defaultIsExpandable, _default$41 as depService, describeRevertStep, describeStepForRevert, deserializeStacks, designPlugin, detectPageTargetId, detectPageTargetName, detectStackOpType, displayTabConfig, editorNodeMergeCustomizer, _default$42 as editorService, eqOptions, error, eventTabConfig, _default$43 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, _default$44 as historyService, idbDelete, idbGet, idbSet, info, isIncludeDataSource, isIndexedDBSupported, _default$45 as loadMonaco, log, markStackSaved, mergePageSteps, mergeStackSteps, moveItemsInContainer, numberOptions, openIndexedDB, _default$46 as propsService, resolveSelectedNode, serializeConfig, serializeStacks, setChildrenLayout, setEditorConfig, setLayout, _default$47 as stageOverlayService, _default$48 as storageService, styleTabConfig, tablePlugin, toggleFixedPosition, _default$49 as uiService, undoFloor, updateStatus, useCodeBlockEdit, useEditorContentHeight, useFilter, useFloatBox, useGetSo, useNextFloatBoxPosition, useNodeStatus, useServices, useStage, useWindowRect, warn };
|