@tmagic/editor 1.7.14-beta.1 → 1.7.14-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/ToolButton.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/es/layouts/CodeEditor.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/es/layouts/NavMenu.vue_vue_type_script_setup_true_lang.js +11 -11
- package/dist/es/layouts/NavMenuColumn.js +5 -0
- package/dist/es/layouts/NavMenuColumn.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/es/services/editor.js +88 -31
- package/dist/es/services/storage.js +5 -5
- package/dist/es/style.css +51 -0
- package/dist/es/utils/keybinding-config.js +19 -19
- package/dist/style.css +51 -0
- package/dist/tmagic-editor.umd.cjs +353 -93
- package/package.json +8 -8
- package/src/components/ToolButton.vue +7 -1
- package/src/layouts/CodeEditor.vue +18 -10
- package/src/layouts/NavMenu.vue +9 -4
- package/src/layouts/NavMenuColumn.vue +252 -0
- package/src/services/editor.ts +132 -40
- package/src/theme/nav-menu.scss +61 -0
- package/src/type.ts +42 -0
- package/src/utils/undo-redo.ts +2 -0
- package/types/index.d.ts +456 -437
|
@@ -5146,10 +5146,10 @@
|
|
|
5146
5146
|
const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
|
|
5147
5147
|
if (item === null) return null;
|
|
5148
5148
|
switch (protocol) {
|
|
5149
|
-
case
|
|
5150
|
-
case
|
|
5151
|
-
case
|
|
5152
|
-
case
|
|
5149
|
+
case "object": return getEditorConfig("parseDSL")(`(${item})`);
|
|
5150
|
+
case "json": return JSON.parse(item);
|
|
5151
|
+
case "number": return Number(item);
|
|
5152
|
+
case "boolean":
|
|
5153
5153
|
if (item === "true") return true;
|
|
5154
5154
|
if (item === "false") return false;
|
|
5155
5155
|
default: return item;
|
|
@@ -5177,7 +5177,7 @@
|
|
|
5177
5177
|
const namespace = this.getNamespace();
|
|
5178
5178
|
let item = value;
|
|
5179
5179
|
const protocol = options.protocol ? `${options.protocol}:` : "";
|
|
5180
|
-
if (typeof value ===
|
|
5180
|
+
if (typeof value === "string" || typeof value === "number") item = `${protocol}${value}`;
|
|
5181
5181
|
else item = `${protocol}${(0, serialize_javascript.default)(value)}`;
|
|
5182
5182
|
storage.setItem(`${options.namespace || namespace}:${key}`, item);
|
|
5183
5183
|
}
|
|
@@ -5793,6 +5793,23 @@
|
|
|
5793
5793
|
};
|
|
5794
5794
|
//#endregion
|
|
5795
5795
|
//#region packages/editor/src/services/editor.ts
|
|
5796
|
+
/**
|
|
5797
|
+
* 经过 BaseService 的插件 / 中间件包装后,源方法的最后一个形参可能被注入为 dispatch 函数
|
|
5798
|
+
* 当 options 形参位置被注入为函数(或为 null)时,将其归一为空对象,避免后续逻辑误读
|
|
5799
|
+
*/
|
|
5800
|
+
var safeOptions = (options) => {
|
|
5801
|
+
const empty = {};
|
|
5802
|
+
if (!options || typeof options === "function") return empty;
|
|
5803
|
+
return options;
|
|
5804
|
+
};
|
|
5805
|
+
/**
|
|
5806
|
+
* 经过 BaseService 的插件 / 中间件包装后,源方法的形参可能被注入为 dispatch 函数
|
|
5807
|
+
* 当 parent 形参位置被注入为函数(或为空值)时,归一为 null,由调用方继续走默认 parent 逻辑
|
|
5808
|
+
*/
|
|
5809
|
+
var safeParent = (parent) => {
|
|
5810
|
+
if (!parent || typeof parent === "function") return null;
|
|
5811
|
+
return parent;
|
|
5812
|
+
};
|
|
5796
5813
|
var Editor = class extends BaseService_default {
|
|
5797
5814
|
state = (0, vue.reactive)({
|
|
5798
5815
|
root: null,
|
|
@@ -6003,9 +6020,13 @@
|
|
|
6003
6020
|
* 向指点容器添加组件节点
|
|
6004
6021
|
* @param addConfig 将要添加的组件节点配置
|
|
6005
6022
|
* @param parent 要添加到的容器组件节点配置,如果不设置,默认为当前选中的组件的父节点
|
|
6023
|
+
* @param options 可选配置
|
|
6024
|
+
* @param options.doNotSelect 添加后是否不更新当前选中节点(默认 false,添加后会选中新增的节点)
|
|
6006
6025
|
* @returns 添加后的节点
|
|
6007
6026
|
*/
|
|
6008
|
-
async add(addNode, parent) {
|
|
6027
|
+
async add(addNode, parent, options) {
|
|
6028
|
+
const safeParentNode = safeParent(parent);
|
|
6029
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6009
6030
|
this.captureSelectionBeforeOp();
|
|
6010
6031
|
const stage = this.get("stage");
|
|
6011
6032
|
const addNodes = [];
|
|
@@ -6017,19 +6038,21 @@
|
|
|
6017
6038
|
const newNodes = await Promise.all(addNodes.map((node) => {
|
|
6018
6039
|
const root = this.get("root");
|
|
6019
6040
|
if (((0, _tmagic_utils.isPage)(node) || (0, _tmagic_utils.isPageFragment)(node)) && root) return this.doAdd(node, root);
|
|
6020
|
-
const parentNode =
|
|
6041
|
+
const parentNode = safeParentNode ?? getAddParent(node);
|
|
6021
6042
|
if (!parentNode) throw new Error("未找到父元素");
|
|
6022
6043
|
return this.doAdd(node, parentNode);
|
|
6023
6044
|
}));
|
|
6024
6045
|
if (newNodes.length > 1) {
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6046
|
+
if (!doNotSelect) {
|
|
6047
|
+
const newNodeIds = newNodes.map((node) => node.id);
|
|
6048
|
+
stage?.multiSelect(newNodeIds);
|
|
6049
|
+
await this.multiSelect(newNodeIds);
|
|
6050
|
+
}
|
|
6028
6051
|
} else {
|
|
6029
|
-
await this.select(newNodes[0]);
|
|
6052
|
+
if (!doNotSelect) await this.select(newNodes[0]);
|
|
6030
6053
|
if ((0, _tmagic_utils.isPage)(newNodes[0])) this.state.pageLength += 1;
|
|
6031
6054
|
else if ((0, _tmagic_utils.isPageFragment)(newNodes[0])) this.state.pageFragmentLength += 1;
|
|
6032
|
-
else stage?.select(newNodes[0].id);
|
|
6055
|
+
else if (!doNotSelect) stage?.select(newNodes[0].id);
|
|
6033
6056
|
}
|
|
6034
6057
|
if (!((0, _tmagic_utils.isPage)(newNodes[0]) || (0, _tmagic_utils.isPageFragment)(newNodes[0]))) {
|
|
6035
6058
|
const pageForOp = this.getNodeInfo(newNodes[0].id, false).page;
|
|
@@ -6048,7 +6071,8 @@
|
|
|
6048
6071
|
this.emit("add", newNodes);
|
|
6049
6072
|
return Array.isArray(addNode) ? newNodes : newNodes[0];
|
|
6050
6073
|
}
|
|
6051
|
-
async doRemove(node) {
|
|
6074
|
+
async doRemove(node, options) {
|
|
6075
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6052
6076
|
const root = this.get("root");
|
|
6053
6077
|
if (!root) throw new Error("root不能为空");
|
|
6054
6078
|
const { parent, node: curNode } = this.getNodeInfo(node.id, false);
|
|
@@ -6062,6 +6086,19 @@
|
|
|
6062
6086
|
parentId: parent.id,
|
|
6063
6087
|
root: cloneDeep(root)
|
|
6064
6088
|
});
|
|
6089
|
+
if (doNotSelect) {
|
|
6090
|
+
const selectedNodes = this.get("nodes");
|
|
6091
|
+
const removedSelectedIndex = selectedNodes.findIndex((n) => `${n.id}` === `${node.id}`);
|
|
6092
|
+
if (removedSelectedIndex !== -1) {
|
|
6093
|
+
const nextSelected = [...selectedNodes];
|
|
6094
|
+
nextSelected.splice(removedSelectedIndex, 1);
|
|
6095
|
+
this.set("nodes", nextSelected);
|
|
6096
|
+
}
|
|
6097
|
+
if ((0, _tmagic_utils.isPage)(node) || (0, _tmagic_utils.isPageFragment)(node)) {
|
|
6098
|
+
const currentPage = this.get("page");
|
|
6099
|
+
if (currentPage && `${currentPage.id}` === `${node.id}`) this.set("page", null);
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6065
6102
|
const selectDefault = async (pages) => {
|
|
6066
6103
|
if (pages[0]) {
|
|
6067
6104
|
await this.select(pages[0]);
|
|
@@ -6074,13 +6111,15 @@
|
|
|
6074
6111
|
const rootItems = root.items || [];
|
|
6075
6112
|
if ((0, _tmagic_utils.isPage)(node)) {
|
|
6076
6113
|
this.state.pageLength -= 1;
|
|
6077
|
-
await selectDefault(rootItems);
|
|
6114
|
+
if (!doNotSelect) await selectDefault(rootItems);
|
|
6078
6115
|
} else if ((0, _tmagic_utils.isPageFragment)(node)) {
|
|
6079
6116
|
this.state.pageFragmentLength -= 1;
|
|
6080
|
-
await selectDefault(rootItems);
|
|
6117
|
+
if (!doNotSelect) await selectDefault(rootItems);
|
|
6081
6118
|
} else {
|
|
6082
|
-
|
|
6083
|
-
|
|
6119
|
+
if (!doNotSelect) {
|
|
6120
|
+
await this.select(parent);
|
|
6121
|
+
stage?.select(parent.id);
|
|
6122
|
+
}
|
|
6084
6123
|
this.addModifiedNodeId(parent.id);
|
|
6085
6124
|
}
|
|
6086
6125
|
if (!rootItems.length) {
|
|
@@ -6090,9 +6129,12 @@
|
|
|
6090
6129
|
}
|
|
6091
6130
|
/**
|
|
6092
6131
|
* 删除组件
|
|
6093
|
-
* @param {Object} node
|
|
6132
|
+
* @param {Object} node 要删除的节点或节点集合
|
|
6133
|
+
* @param options 可选配置
|
|
6134
|
+
* @param options.doNotSelect 删除后是否不更新当前选中节点(默认 false,删除后会选中父节点或首个页面)
|
|
6094
6135
|
*/
|
|
6095
|
-
async remove(nodeOrNodeList) {
|
|
6136
|
+
async remove(nodeOrNodeList, options) {
|
|
6137
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6096
6138
|
this.captureSelectionBeforeOp();
|
|
6097
6139
|
const nodes = Array.isArray(nodeOrNodeList) ? nodeOrNodeList : [nodeOrNodeList];
|
|
6098
6140
|
const removedItems = [];
|
|
@@ -6112,11 +6154,11 @@
|
|
|
6112
6154
|
});
|
|
6113
6155
|
}
|
|
6114
6156
|
}
|
|
6115
|
-
await Promise.all(nodes.map((node) => this.doRemove(node)));
|
|
6157
|
+
await Promise.all(nodes.map((node) => this.doRemove(node, { doNotSelect })));
|
|
6116
6158
|
if (removedItems.length > 0 && pageForOp) this.pushOpHistory("remove", { removedItems }, pageForOp);
|
|
6117
6159
|
this.emit("remove", nodes);
|
|
6118
6160
|
}
|
|
6119
|
-
async doUpdate(config, { changeRecords = []
|
|
6161
|
+
async doUpdate(config, { changeRecords = [] } = {}) {
|
|
6120
6162
|
const root = this.get("root");
|
|
6121
6163
|
if (!root) throw new Error("root为空");
|
|
6122
6164
|
if (!config?.id) throw new Error("没有配置或者配置缺少id值");
|
|
@@ -6143,11 +6185,11 @@
|
|
|
6143
6185
|
const layout = await this.getLayout(node);
|
|
6144
6186
|
if (Array.isArray(newConfig.items) && newLayout !== layout) newConfig = setChildrenLayout(newConfig, newLayout);
|
|
6145
6187
|
parentNodeItems[index] = newConfig;
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
this.set("nodes", [...
|
|
6188
|
+
const selectedNodes = this.get("nodes");
|
|
6189
|
+
const targetIndex = selectedNodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
6190
|
+
if (targetIndex !== -1) {
|
|
6191
|
+
selectedNodes.splice(targetIndex, 1, newConfig);
|
|
6192
|
+
this.set("nodes", [...selectedNodes]);
|
|
6151
6193
|
}
|
|
6152
6194
|
if ((0, _tmagic_utils.isPage)(newConfig) || (0, _tmagic_utils.isPageFragment)(newConfig)) this.set("page", newConfig);
|
|
6153
6195
|
this.addModifiedNodeId(newConfig.id);
|
|
@@ -6188,9 +6230,12 @@
|
|
|
6188
6230
|
* 将id为id1的组件移动到id为id2的组件位置上,例如:[1,2,3,4] -> sort(1,3) -> [2,1,3,4]
|
|
6189
6231
|
* @param id1 组件ID
|
|
6190
6232
|
* @param id2 组件ID
|
|
6233
|
+
* @param options 可选配置
|
|
6234
|
+
* @param options.doNotSelect 排序后是否不更新当前选中节点(默认 false)
|
|
6191
6235
|
* @returns void
|
|
6192
6236
|
*/
|
|
6193
|
-
async sort(id1, id2) {
|
|
6237
|
+
async sort(id1, id2, options) {
|
|
6238
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6194
6239
|
this.captureSelectionBeforeOp();
|
|
6195
6240
|
const root = this.get("root");
|
|
6196
6241
|
if (!root) throw new Error("root为空");
|
|
@@ -6203,7 +6248,7 @@
|
|
|
6203
6248
|
const index1 = parent.items.findIndex((node) => `${node.id}` === `${id1}`);
|
|
6204
6249
|
parent.items.splice(index2, 0, ...parent.items.splice(index1, 1));
|
|
6205
6250
|
await this.update(parent);
|
|
6206
|
-
await this.select(node);
|
|
6251
|
+
if (!doNotSelect) await this.select(node);
|
|
6207
6252
|
this.get("stage")?.update({
|
|
6208
6253
|
config: cloneDeep(node),
|
|
6209
6254
|
parentId: parent.id,
|
|
@@ -6231,9 +6276,13 @@
|
|
|
6231
6276
|
/**
|
|
6232
6277
|
* 从localStorage中获取节点,然后添加到当前容器中
|
|
6233
6278
|
* @param position 粘贴的坐标
|
|
6279
|
+
* @param collectorOptions 可选的依赖收集器配置
|
|
6280
|
+
* @param options 可选配置
|
|
6281
|
+
* @param options.doNotSelect 粘贴后是否不更新当前选中节点(默认 false)
|
|
6234
6282
|
* @returns 添加后的组件节点配置
|
|
6235
6283
|
*/
|
|
6236
|
-
async paste(position = {}, collectorOptions) {
|
|
6284
|
+
async paste(position = {}, collectorOptions, options) {
|
|
6285
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6237
6286
|
const config = storage_default.getItem(COPY_STORAGE_KEY);
|
|
6238
6287
|
if (!Array.isArray(config)) return;
|
|
6239
6288
|
const node = this.get("node");
|
|
@@ -6244,7 +6293,7 @@
|
|
|
6244
6293
|
}
|
|
6245
6294
|
const pasteConfigs = await this.doPaste(config, position);
|
|
6246
6295
|
if (collectorOptions && typeof collectorOptions.isTarget === "function") props_default.replaceRelateId(config, pasteConfigs, collectorOptions);
|
|
6247
|
-
return this.add(pasteConfigs, parent);
|
|
6296
|
+
return this.add(pasteConfigs, parent, { doNotSelect });
|
|
6248
6297
|
}
|
|
6249
6298
|
async doPaste(config, position = {}) {
|
|
6250
6299
|
props_default.clearRelateId();
|
|
@@ -6265,14 +6314,17 @@
|
|
|
6265
6314
|
/**
|
|
6266
6315
|
* 将指点节点设置居中
|
|
6267
6316
|
* @param config 组件节点配置
|
|
6317
|
+
* @param options 可选配置
|
|
6318
|
+
* @param options.doNotSelect 居中后是否不更新当前选中节点(默认 false)
|
|
6268
6319
|
* @returns 当前组件节点配置
|
|
6269
6320
|
*/
|
|
6270
|
-
async alignCenter(config) {
|
|
6321
|
+
async alignCenter(config, options) {
|
|
6322
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6271
6323
|
const nodes = Array.isArray(config) ? config : [config];
|
|
6272
6324
|
const stage = this.get("stage");
|
|
6273
6325
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
6274
6326
|
const newNode = await this.update(newNodes);
|
|
6275
|
-
if (newNodes.length > 1) await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
6327
|
+
if (!doNotSelect) if (newNodes.length > 1) await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
6276
6328
|
else await stage?.select(newNodes[0].id);
|
|
6277
6329
|
return newNode;
|
|
6278
6330
|
}
|
|
@@ -6317,8 +6369,11 @@
|
|
|
6317
6369
|
* 移动到指定容器中
|
|
6318
6370
|
* @param config 需要移动的节点
|
|
6319
6371
|
* @param targetId 容器ID
|
|
6372
|
+
* @param options 可选配置
|
|
6373
|
+
* @param options.doNotSelect 移动后是否不更新当前选中节点(默认 false)
|
|
6320
6374
|
*/
|
|
6321
|
-
async moveToContainer(config, targetId) {
|
|
6375
|
+
async moveToContainer(config, targetId, options) {
|
|
6376
|
+
const { doNotSelect = false } = safeOptions(options);
|
|
6322
6377
|
this.captureSelectionBeforeOp();
|
|
6323
6378
|
const root = this.get("root");
|
|
6324
6379
|
const { node, parent, page: pageForOp } = this.getNodeInfo(config.id, false);
|
|
@@ -6340,15 +6395,17 @@
|
|
|
6340
6395
|
});
|
|
6341
6396
|
newConfig.style = getInitPositionStyle(newConfig.style, layout);
|
|
6342
6397
|
target.items.push(newConfig);
|
|
6343
|
-
await stage.select(targetId);
|
|
6398
|
+
if (!doNotSelect) await stage.select(targetId);
|
|
6344
6399
|
const targetParent = this.getParentById(target.id);
|
|
6345
6400
|
await stage.update({
|
|
6346
6401
|
config: cloneDeep(target),
|
|
6347
6402
|
parentId: targetParent?.id,
|
|
6348
6403
|
root: cloneDeep(root)
|
|
6349
6404
|
});
|
|
6350
|
-
|
|
6351
|
-
|
|
6405
|
+
if (!doNotSelect) {
|
|
6406
|
+
await this.select(newConfig);
|
|
6407
|
+
stage.select(newConfig.id);
|
|
6408
|
+
}
|
|
6352
6409
|
this.addModifiedNodeId(target.id);
|
|
6353
6410
|
this.addModifiedNodeId(parent.id);
|
|
6354
6411
|
this.pushOpHistory("update", { updatedItems: [{
|
|
@@ -7674,7 +7731,7 @@
|
|
|
7674
7731
|
var SplitView_default = SplitView_vue_vue_type_script_setup_true_lang_default;
|
|
7675
7732
|
//#endregion
|
|
7676
7733
|
//#region packages/editor/src/components/Icon.vue?vue&type=script&setup=true&lang.ts
|
|
7677
|
-
var _hoisted_1$
|
|
7734
|
+
var _hoisted_1$64 = ["src"];
|
|
7678
7735
|
var Icon_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
7679
7736
|
name: "MEditorIcon",
|
|
7680
7737
|
__name: "Icon",
|
|
@@ -7692,7 +7749,7 @@
|
|
|
7692
7749
|
key: 1,
|
|
7693
7750
|
class: "magic-editor-icon"
|
|
7694
7751
|
}, {
|
|
7695
|
-
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("img", { src: __props.icon }, null, 8, _hoisted_1$
|
|
7752
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("img", { src: __props.icon }, null, 8, _hoisted_1$64)]),
|
|
7696
7753
|
_: 1
|
|
7697
7754
|
})) : typeof __props.icon === "string" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("i", {
|
|
7698
7755
|
key: 2,
|
|
@@ -7712,7 +7769,7 @@
|
|
|
7712
7769
|
var Icon_default = Icon_vue_vue_type_script_setup_true_lang_default;
|
|
7713
7770
|
//#endregion
|
|
7714
7771
|
//#region packages/editor/src/components/ToolButton.vue?vue&type=script&setup=true&lang.ts
|
|
7715
|
-
var _hoisted_1$
|
|
7772
|
+
var _hoisted_1$63 = {
|
|
7716
7773
|
key: 1,
|
|
7717
7774
|
class: "menu-item-text"
|
|
7718
7775
|
};
|
|
@@ -7727,9 +7784,11 @@
|
|
|
7727
7784
|
}) },
|
|
7728
7785
|
eventType: { default: "click" }
|
|
7729
7786
|
},
|
|
7730
|
-
setup(__props) {
|
|
7787
|
+
setup(__props, { expose: __expose }) {
|
|
7731
7788
|
const props = __props;
|
|
7732
7789
|
const services = useServices();
|
|
7790
|
+
const rootElRef = (0, vue.useTemplateRef)("rootEl");
|
|
7791
|
+
const getElRef = () => rootElRef;
|
|
7733
7792
|
const disabled = (0, vue.computed)(() => {
|
|
7734
7793
|
if (typeof props.data === "string") return false;
|
|
7735
7794
|
if (props.data.type === "component") return false;
|
|
@@ -7761,9 +7820,11 @@
|
|
|
7761
7820
|
if (props.eventType !== "mouseup") return;
|
|
7762
7821
|
if (item.type === "button" && event.button === 0) buttonHandler(item, event);
|
|
7763
7822
|
};
|
|
7823
|
+
__expose({ getElRef });
|
|
7764
7824
|
return (_ctx, _cache) => {
|
|
7765
7825
|
return display.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
7766
7826
|
key: 0,
|
|
7827
|
+
ref: "rootEl",
|
|
7767
7828
|
class: (0, vue.normalizeClass)(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
|
|
7768
7829
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(__props.data, $event)),
|
|
7769
7830
|
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
|
|
@@ -7771,7 +7832,7 @@
|
|
|
7771
7832
|
}, [__props.data.type === "divider" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicDivider), {
|
|
7772
7833
|
key: 0,
|
|
7773
7834
|
direction: __props.data.direction || "vertical"
|
|
7774
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
7835
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$63, (0, vue.toDisplayString)(__props.data.text), 1)) : __props.data.type === "button" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [__props.data.tooltip ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
|
|
7775
7836
|
key: 0,
|
|
7776
7837
|
effect: "dark",
|
|
7777
7838
|
placement: "bottom-start",
|
|
@@ -7840,7 +7901,7 @@
|
|
|
7840
7901
|
var ToolButton_default = ToolButton_vue_vue_type_script_setup_true_lang_default;
|
|
7841
7902
|
//#endregion
|
|
7842
7903
|
//#region packages/editor/src/layouts/page-bar/AddButton.vue?vue&type=script&setup=true&lang.ts
|
|
7843
|
-
var _hoisted_1$
|
|
7904
|
+
var _hoisted_1$62 = {
|
|
7844
7905
|
key: 0,
|
|
7845
7906
|
id: "m-editor-page-bar-add-icon",
|
|
7846
7907
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
@@ -7866,7 +7927,7 @@
|
|
|
7866
7927
|
editorService.add(pageConfig);
|
|
7867
7928
|
};
|
|
7868
7929
|
return (_ctx, _cache) => {
|
|
7869
|
-
return showAddPageButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
7930
|
+
return showAddPageButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$62, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), { "popper-class": "data-source-list-panel-add-menu" }, {
|
|
7870
7931
|
reference: (0, vue.withCtx)(() => [(0, vue.createVNode)(Icon_default, { icon: (0, vue.unref)(_element_plus_icons_vue.Plus) }, null, 8, ["icon"])]),
|
|
7871
7932
|
default: (0, vue.withCtx)(() => [(0, vue.createVNode)(ToolButton_default, { data: {
|
|
7872
7933
|
type: "button",
|
|
@@ -7891,7 +7952,7 @@
|
|
|
7891
7952
|
var AddButton_default = AddButton_vue_vue_type_script_setup_true_lang_default;
|
|
7892
7953
|
//#endregion
|
|
7893
7954
|
//#region packages/editor/src/layouts/page-bar/PageBarScrollContainer.vue?vue&type=script&setup=true&lang.ts
|
|
7894
|
-
var _hoisted_1$
|
|
7955
|
+
var _hoisted_1$61 = {
|
|
7895
7956
|
class: "m-editor-page-bar",
|
|
7896
7957
|
ref: "pageBar"
|
|
7897
7958
|
};
|
|
@@ -7985,7 +8046,7 @@
|
|
|
7985
8046
|
}
|
|
7986
8047
|
});
|
|
7987
8048
|
return (_ctx, _cache) => {
|
|
7988
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8049
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$61, [
|
|
7989
8050
|
(0, vue.renderSlot)(_ctx.$slots, "prepend"),
|
|
7990
8051
|
__props.length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2$22, [(0, vue.renderSlot)(_ctx.$slots, "default")], 512)) : (0, vue.createCommentVNode)("v-if", true),
|
|
7991
8052
|
canScroll.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
@@ -8007,7 +8068,7 @@
|
|
|
8007
8068
|
var PageBarScrollContainer_default = PageBarScrollContainer_vue_vue_type_script_setup_true_lang_default;
|
|
8008
8069
|
//#endregion
|
|
8009
8070
|
//#region packages/editor/src/layouts/page-bar/PageList.vue?vue&type=script&setup=true&lang.ts
|
|
8010
|
-
var _hoisted_1$
|
|
8071
|
+
var _hoisted_1$60 = {
|
|
8011
8072
|
key: 0,
|
|
8012
8073
|
id: "m-editor-page-bar-list-icon",
|
|
8013
8074
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon"
|
|
@@ -8026,7 +8087,7 @@
|
|
|
8026
8087
|
await editorService.select(id);
|
|
8027
8088
|
};
|
|
8028
8089
|
return (_ctx, _cache) => {
|
|
8029
|
-
return showPageListButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8090
|
+
return showPageListButton.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$60, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), {
|
|
8030
8091
|
"popper-class": "page-bar-popover",
|
|
8031
8092
|
placement: "top",
|
|
8032
8093
|
trigger: "hover",
|
|
@@ -8058,7 +8119,7 @@
|
|
|
8058
8119
|
var PageList_default = PageList_vue_vue_type_script_setup_true_lang_default;
|
|
8059
8120
|
//#endregion
|
|
8060
8121
|
//#region packages/editor/src/layouts/page-bar/Search.vue?vue&type=script&setup=true&lang.ts
|
|
8061
|
-
var _hoisted_1$
|
|
8122
|
+
var _hoisted_1$59 = { class: "m-editor-page-bar-item m-editor-page-bar-item-icon m-editor-page-bar-search" };
|
|
8062
8123
|
var Search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8063
8124
|
__name: "Search",
|
|
8064
8125
|
props: {
|
|
@@ -8091,7 +8152,7 @@
|
|
|
8091
8152
|
emit("search", values);
|
|
8092
8153
|
};
|
|
8093
8154
|
return (_ctx, _cache) => {
|
|
8094
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8155
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$59, [(0, vue.createVNode)(Icon_default, {
|
|
8095
8156
|
icon: (0, vue.unref)(_element_plus_icons_vue.Search),
|
|
8096
8157
|
onClick: _cache[0] || (_cache[0] = ($event) => visible.value = !visible.value),
|
|
8097
8158
|
class: (0, vue.normalizeClass)({ "icon-active": visible.value })
|
|
@@ -8115,7 +8176,7 @@
|
|
|
8115
8176
|
var Search_default = Search_vue_vue_type_script_setup_true_lang_default;
|
|
8116
8177
|
//#endregion
|
|
8117
8178
|
//#region packages/editor/src/layouts/page-bar/PageBar.vue?vue&type=script&setup=true&lang.ts
|
|
8118
|
-
var _hoisted_1$
|
|
8179
|
+
var _hoisted_1$58 = { class: "m-editor-page-bar-tabs" };
|
|
8119
8180
|
var _hoisted_2$20 = ["data-page-id", "onClick"];
|
|
8120
8181
|
var _hoisted_3$6 = { class: "m-editor-page-bar-title" };
|
|
8121
8182
|
var _hoisted_4$5 = ["title"];
|
|
@@ -8183,7 +8244,7 @@
|
|
|
8183
8244
|
}
|
|
8184
8245
|
});
|
|
8185
8246
|
return (_ctx, _cache) => {
|
|
8186
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8247
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$58, [(0, vue.createVNode)(PageBarScrollContainer_default, {
|
|
8187
8248
|
ref: "pageBarScrollContainer",
|
|
8188
8249
|
"page-bar-sort-options": __props.pageBarSortOptions,
|
|
8189
8250
|
length: list.value.length
|
|
@@ -8242,7 +8303,7 @@
|
|
|
8242
8303
|
var PageBar_default = PageBar_vue_vue_type_script_setup_true_lang_default;
|
|
8243
8304
|
//#endregion
|
|
8244
8305
|
//#region packages/editor/src/layouts/AddPageBox.vue?vue&type=script&setup=true&lang.ts
|
|
8245
|
-
var _hoisted_1$
|
|
8306
|
+
var _hoisted_1$57 = { class: "m-editor-empty-panel" };
|
|
8246
8307
|
var _hoisted_2$19 = { class: "m-editor-empty-content" };
|
|
8247
8308
|
var AddPageBox_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8248
8309
|
name: "MEditorAddPageBox",
|
|
@@ -8260,7 +8321,7 @@
|
|
|
8260
8321
|
});
|
|
8261
8322
|
};
|
|
8262
8323
|
return (_ctx, _cache) => {
|
|
8263
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8324
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$57, [(0, vue.createElementVNode)("div", _hoisted_2$19, [(0, vue.createElementVNode)("div", {
|
|
8264
8325
|
class: "m-editor-empty-button",
|
|
8265
8326
|
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler((0, vue.unref)(_tmagic_core.NodeType).PAGE))
|
|
8266
8327
|
}, [(0, vue.createElementVNode)("div", null, [(0, vue.createVNode)(Icon_default, { icon: (0, vue.unref)(_element_plus_icons_vue.Plus) }, null, 8, ["icon"])]), _cache[2] || (_cache[2] = (0, vue.createElementVNode)("p", null, "新增页面", -1))]), !__props.disabledPageFragment ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
@@ -8276,7 +8337,7 @@
|
|
|
8276
8337
|
var AddPageBox_default = AddPageBox_vue_vue_type_script_setup_true_lang_default;
|
|
8277
8338
|
//#endregion
|
|
8278
8339
|
//#region packages/editor/src/layouts/CodeEditor.vue?vue&type=script&setup=true&lang.ts
|
|
8279
|
-
var _hoisted_1$
|
|
8340
|
+
var _hoisted_1$56 = { class: "magic-code-editor" };
|
|
8280
8341
|
var _hoisted_2$18 = {
|
|
8281
8342
|
ref: "codeEditor",
|
|
8282
8343
|
class: "magic-code-editor-content"
|
|
@@ -8393,23 +8454,23 @@
|
|
|
8393
8454
|
if (props.type === "diff") {
|
|
8394
8455
|
const originalModel = monaco.editor.createModel(values.value, "text/javascript");
|
|
8395
8456
|
const modifiedModel = monaco.editor.createModel(toString(m, props.language), "text/javascript");
|
|
8396
|
-
const
|
|
8457
|
+
const viewState = vsDiffEditor?.saveViewState();
|
|
8397
8458
|
const result = vsDiffEditor?.setModel({
|
|
8398
8459
|
original: originalModel,
|
|
8399
8460
|
modified: modifiedModel
|
|
8400
8461
|
});
|
|
8401
|
-
if (
|
|
8402
|
-
vsDiffEditor?.
|
|
8462
|
+
if (viewState) (0, vue.nextTick)(() => {
|
|
8463
|
+
vsDiffEditor?.restoreViewState(viewState);
|
|
8403
8464
|
vsDiffEditor?.focus();
|
|
8404
|
-
}
|
|
8465
|
+
});
|
|
8405
8466
|
return result;
|
|
8406
8467
|
}
|
|
8407
|
-
const
|
|
8468
|
+
const viewState = vsEditor?.saveViewState();
|
|
8408
8469
|
const result = vsEditor?.setValue(values.value);
|
|
8409
|
-
if (
|
|
8410
|
-
vsEditor?.
|
|
8470
|
+
if (viewState) (0, vue.nextTick)(() => {
|
|
8471
|
+
vsEditor?.restoreViewState(viewState);
|
|
8411
8472
|
vsEditor?.focus();
|
|
8412
|
-
}
|
|
8473
|
+
});
|
|
8413
8474
|
return result;
|
|
8414
8475
|
};
|
|
8415
8476
|
const getEditorValue = () => (props.type === "diff" ? vsDiffEditor?.getModifiedEditor().getValue() : vsEditor?.getValue()) || "";
|
|
@@ -8513,7 +8574,7 @@
|
|
|
8513
8574
|
}
|
|
8514
8575
|
});
|
|
8515
8576
|
return (_ctx, _cache) => {
|
|
8516
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8577
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$56, [((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
|
|
8517
8578
|
to: "body",
|
|
8518
8579
|
disabled: !fullScreen.value
|
|
8519
8580
|
}, [(0, vue.createElementVNode)("div", {
|
|
@@ -8540,7 +8601,7 @@
|
|
|
8540
8601
|
var CodeEditor_default = CodeEditor_vue_vue_type_script_setup_true_lang_default;
|
|
8541
8602
|
//#endregion
|
|
8542
8603
|
//#region packages/editor/src/layouts/Framework.vue?vue&type=script&setup=true&lang.ts
|
|
8543
|
-
var _hoisted_1$
|
|
8604
|
+
var _hoisted_1$55 = {
|
|
8544
8605
|
class: "m-editor",
|
|
8545
8606
|
ref: "content",
|
|
8546
8607
|
style: { "min-width": "900px" }
|
|
@@ -8602,7 +8663,7 @@
|
|
|
8602
8663
|
}
|
|
8603
8664
|
};
|
|
8604
8665
|
return (_ctx, _cache) => {
|
|
8605
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$
|
|
8666
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$55, [
|
|
8606
8667
|
(0, vue.renderSlot)(_ctx.$slots, "header"),
|
|
8607
8668
|
(0, vue.renderSlot)(_ctx.$slots, "nav"),
|
|
8608
8669
|
(0, vue.renderSlot)(_ctx.$slots, "content-before"),
|
|
@@ -8666,6 +8727,205 @@
|
|
|
8666
8727
|
//#region packages/editor/src/layouts/Framework.vue
|
|
8667
8728
|
var Framework_default = Framework_vue_vue_type_script_setup_true_lang_default;
|
|
8668
8729
|
//#endregion
|
|
8730
|
+
//#region packages/editor/src/layouts/NavMenuColumn.vue?vue&type=script&setup=true&lang.ts
|
|
8731
|
+
var _hoisted_1$54 = { class: "m-editor-nav-menu-overflow-list" };
|
|
8732
|
+
var NavMenuColumn_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8733
|
+
name: "MEditorNavMenuColumn",
|
|
8734
|
+
__name: "NavMenuColumn",
|
|
8735
|
+
props: {
|
|
8736
|
+
columnKey: {},
|
|
8737
|
+
items: { default: () => [] },
|
|
8738
|
+
width: {},
|
|
8739
|
+
gap: { default: 3 },
|
|
8740
|
+
popoverWidth: { default: 180 }
|
|
8741
|
+
},
|
|
8742
|
+
setup(__props) {
|
|
8743
|
+
const props = __props;
|
|
8744
|
+
const columnEl = (0, vue.useTemplateRef)("columnEl");
|
|
8745
|
+
const moreWrapperEl = (0, vue.useTemplateRef)("moreWrapperEl");
|
|
8746
|
+
const popoverVisible = (0, vue.ref)(false);
|
|
8747
|
+
const togglePopover = () => {
|
|
8748
|
+
popoverVisible.value = !popoverVisible.value;
|
|
8749
|
+
};
|
|
8750
|
+
const itemInstances = (0, vue.ref)([]);
|
|
8751
|
+
let slotsRO;
|
|
8752
|
+
const observedEls = /* @__PURE__ */ new Set();
|
|
8753
|
+
const setItemRef = (inst, index) => {
|
|
8754
|
+
itemInstances.value[index] = inst ?? null;
|
|
8755
|
+
};
|
|
8756
|
+
const itemEls = (0, vue.computed)(() => itemInstances.value.map((inst) => inst?.getElRef?.().value ?? null));
|
|
8757
|
+
const reobserveSlots = () => {
|
|
8758
|
+
if (!slotsRO) return;
|
|
8759
|
+
for (const el of observedEls) slotsRO.unobserve(el);
|
|
8760
|
+
observedEls.clear();
|
|
8761
|
+
for (const el of itemEls.value) if (el) {
|
|
8762
|
+
slotsRO.observe(el);
|
|
8763
|
+
observedEls.add(el);
|
|
8764
|
+
}
|
|
8765
|
+
};
|
|
8766
|
+
const cachedWidths = (0, vue.ref)(/* @__PURE__ */ new Map());
|
|
8767
|
+
const moreWidth = (0, vue.ref)(0);
|
|
8768
|
+
const containerWidth = (0, vue.ref)(0);
|
|
8769
|
+
const hiddenIndexSet = (0, vue.ref)(/* @__PURE__ */ new Set());
|
|
8770
|
+
const hasOverflow = (0, vue.computed)(() => hiddenIndexSet.value.size > 0);
|
|
8771
|
+
const overflowItems = (0, vue.computed)(() => props.items.filter((_, index) => hiddenIndexSet.value.has(index)));
|
|
8772
|
+
const measureAndCompute = () => {
|
|
8773
|
+
if (!columnEl.value) return;
|
|
8774
|
+
containerWidth.value = columnEl.value.clientWidth;
|
|
8775
|
+
const els = itemEls.value;
|
|
8776
|
+
for (let i = 0; i < props.items.length; i++) {
|
|
8777
|
+
const el = els[i];
|
|
8778
|
+
if (!el) {
|
|
8779
|
+
cachedWidths.value.delete(i);
|
|
8780
|
+
continue;
|
|
8781
|
+
}
|
|
8782
|
+
const w = el.getBoundingClientRect().width;
|
|
8783
|
+
if (w > 0) cachedWidths.value.set(i, w);
|
|
8784
|
+
else cachedWidths.value.delete(i);
|
|
8785
|
+
}
|
|
8786
|
+
if (moreWrapperEl.value) {
|
|
8787
|
+
const w = moreWrapperEl.value.getBoundingClientRect().width;
|
|
8788
|
+
if (w > 0) moreWidth.value = w;
|
|
8789
|
+
}
|
|
8790
|
+
const total = props.items.length;
|
|
8791
|
+
if (total === 0 || containerWidth.value <= 0) {
|
|
8792
|
+
if (hiddenIndexSet.value.size > 0) hiddenIndexSet.value = /* @__PURE__ */ new Set();
|
|
8793
|
+
return;
|
|
8794
|
+
}
|
|
8795
|
+
let fullSum = 0;
|
|
8796
|
+
let positive = 0;
|
|
8797
|
+
for (let i = 0; i < total; i++) {
|
|
8798
|
+
const w = cachedWidths.value.get(i) ?? 0;
|
|
8799
|
+
if (w > 0) {
|
|
8800
|
+
fullSum += w;
|
|
8801
|
+
positive += 1;
|
|
8802
|
+
}
|
|
8803
|
+
}
|
|
8804
|
+
fullSum += props.gap * Math.max(0, positive - 1);
|
|
8805
|
+
const effectiveMoreWidth = moreWidth.value > 0 ? moreWidth.value : 32;
|
|
8806
|
+
const reservedMore = effectiveMoreWidth + (positive > 0 ? props.gap : 0);
|
|
8807
|
+
let nextHidden = null;
|
|
8808
|
+
if (fullSum + reservedMore <= containerWidth.value + .5) {
|
|
8809
|
+
if (hiddenIndexSet.value.size > 0) nextHidden = /* @__PURE__ */ new Set();
|
|
8810
|
+
} else {
|
|
8811
|
+
const newHidden = /* @__PURE__ */ new Set();
|
|
8812
|
+
let used = effectiveMoreWidth;
|
|
8813
|
+
let cutoff = -1;
|
|
8814
|
+
for (let i = 0; i < total; i++) {
|
|
8815
|
+
const w = cachedWidths.value.get(i) ?? 0;
|
|
8816
|
+
if (w === 0) continue;
|
|
8817
|
+
const need = props.gap + w;
|
|
8818
|
+
if (used + need > containerWidth.value) {
|
|
8819
|
+
cutoff = i;
|
|
8820
|
+
break;
|
|
8821
|
+
}
|
|
8822
|
+
used += need;
|
|
8823
|
+
}
|
|
8824
|
+
if (cutoff >= 0) for (let j = cutoff; j < total; j++) newHidden.add(j);
|
|
8825
|
+
nextHidden = newHidden;
|
|
8826
|
+
}
|
|
8827
|
+
if (nextHidden) {
|
|
8828
|
+
if (!(nextHidden.size === hiddenIndexSet.value.size && [...nextHidden].every((v) => hiddenIndexSet.value.has(v)))) hiddenIndexSet.value = nextHidden;
|
|
8829
|
+
}
|
|
8830
|
+
};
|
|
8831
|
+
let raf = 0;
|
|
8832
|
+
const scheduleMeasure = () => {
|
|
8833
|
+
if (raf) cancelAnimationFrame(raf);
|
|
8834
|
+
raf = requestAnimationFrame(() => {
|
|
8835
|
+
raf = 0;
|
|
8836
|
+
measureAndCompute();
|
|
8837
|
+
if (hasOverflow.value && moreWidth.value === 0) raf = requestAnimationFrame(() => {
|
|
8838
|
+
raf = 0;
|
|
8839
|
+
measureAndCompute();
|
|
8840
|
+
});
|
|
8841
|
+
});
|
|
8842
|
+
};
|
|
8843
|
+
(0, vue.watch)(hasOverflow, (value) => {
|
|
8844
|
+
if (!value) popoverVisible.value = false;
|
|
8845
|
+
});
|
|
8846
|
+
(0, vue.watch)(() => props.items, () => {
|
|
8847
|
+
cachedWidths.value = /* @__PURE__ */ new Map();
|
|
8848
|
+
hiddenIndexSet.value = /* @__PURE__ */ new Set();
|
|
8849
|
+
}, { deep: true });
|
|
8850
|
+
(0, vue.watch)(itemEls, () => {
|
|
8851
|
+
cachedWidths.value = /* @__PURE__ */ new Map();
|
|
8852
|
+
reobserveSlots();
|
|
8853
|
+
scheduleMeasure();
|
|
8854
|
+
});
|
|
8855
|
+
(0, vue.watch)(() => props.width, () => scheduleMeasure());
|
|
8856
|
+
let ro;
|
|
8857
|
+
(0, vue.onMounted)(() => {
|
|
8858
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
8859
|
+
if (columnEl.value) {
|
|
8860
|
+
ro = new ResizeObserver(() => scheduleMeasure());
|
|
8861
|
+
ro.observe(columnEl.value);
|
|
8862
|
+
}
|
|
8863
|
+
slotsRO = new ResizeObserver(() => scheduleMeasure());
|
|
8864
|
+
reobserveSlots();
|
|
8865
|
+
}
|
|
8866
|
+
scheduleMeasure();
|
|
8867
|
+
});
|
|
8868
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
8869
|
+
if (raf) cancelAnimationFrame(raf);
|
|
8870
|
+
ro?.disconnect();
|
|
8871
|
+
slotsRO?.disconnect();
|
|
8872
|
+
slotsRO = void 0;
|
|
8873
|
+
observedEls.clear();
|
|
8874
|
+
});
|
|
8875
|
+
return (_ctx, _cache) => {
|
|
8876
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
8877
|
+
class: (0, vue.normalizeClass)(`menu-${__props.columnKey} m-editor-nav-menu-column`),
|
|
8878
|
+
style: (0, vue.normalizeStyle)(__props.width != null ? `width: ${__props.width}px` : ""),
|
|
8879
|
+
ref_key: "columnEl",
|
|
8880
|
+
ref: columnEl
|
|
8881
|
+
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.items, (item, index) => {
|
|
8882
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(ToolButton_default, {
|
|
8883
|
+
data: item,
|
|
8884
|
+
key: `item-${index}`,
|
|
8885
|
+
class: (0, vue.normalizeClass)({ "m-editor-nav-menu-slot-hidden": hiddenIndexSet.value.has(index) }),
|
|
8886
|
+
ref_for: true,
|
|
8887
|
+
ref: (comp) => setItemRef(comp, index)
|
|
8888
|
+
}, null, 8, ["data", "class"]);
|
|
8889
|
+
}), 128)), (0, vue.createElementVNode)("div", {
|
|
8890
|
+
class: (0, vue.normalizeClass)(["m-editor-nav-menu-more-wrapper", { "m-editor-nav-menu-more-wrapper-hidden": !hasOverflow.value }]),
|
|
8891
|
+
ref_key: "moreWrapperEl",
|
|
8892
|
+
ref: moreWrapperEl
|
|
8893
|
+
}, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPopover), {
|
|
8894
|
+
placement: "bottom-end",
|
|
8895
|
+
"popper-class": "m-editor-nav-menu-popover",
|
|
8896
|
+
width: __props.popoverWidth,
|
|
8897
|
+
visible: popoverVisible.value
|
|
8898
|
+
}, {
|
|
8899
|
+
reference: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", {
|
|
8900
|
+
class: "menu-item button m-editor-nav-menu-more",
|
|
8901
|
+
ref: "referenceEl",
|
|
8902
|
+
onClick: togglePopover
|
|
8903
|
+
}, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
8904
|
+
size: "small",
|
|
8905
|
+
text: "",
|
|
8906
|
+
icon: popoverVisible.value ? (0, vue.unref)(_element_plus_icons_vue.ArrowUp) : (0, vue.unref)(_element_plus_icons_vue.ArrowDown),
|
|
8907
|
+
bg: popoverVisible.value,
|
|
8908
|
+
type: popoverVisible.value ? "primary" : ""
|
|
8909
|
+
}, null, 8, [
|
|
8910
|
+
"icon",
|
|
8911
|
+
"bg",
|
|
8912
|
+
"type"
|
|
8913
|
+
])], 512)]),
|
|
8914
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$54, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(overflowItems.value, (item, index) => {
|
|
8915
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(ToolButton_default, {
|
|
8916
|
+
data: item,
|
|
8917
|
+
key: `o-${index}`
|
|
8918
|
+
}, null, 8, ["data"]);
|
|
8919
|
+
}), 128))])]),
|
|
8920
|
+
_: 1
|
|
8921
|
+
}, 8, ["width", "visible"])], 2)], 6);
|
|
8922
|
+
};
|
|
8923
|
+
}
|
|
8924
|
+
});
|
|
8925
|
+
//#endregion
|
|
8926
|
+
//#region packages/editor/src/layouts/NavMenuColumn.vue
|
|
8927
|
+
var NavMenuColumn_default = NavMenuColumn_vue_vue_type_script_setup_true_lang_default;
|
|
8928
|
+
//#endregion
|
|
8669
8929
|
//#region packages/editor/src/layouts/NavMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8670
8930
|
var NavMenu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
8671
8931
|
name: "MEditorNavMenu",
|
|
@@ -8827,16 +9087,16 @@
|
|
|
8827
9087
|
style: (0, vue.normalizeStyle)({ height: `${__props.height}px` }),
|
|
8828
9088
|
ref: "navMenu"
|
|
8829
9089
|
}, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)((0, vue.unref)(keys), (key) => {
|
|
8830
|
-
return (0, vue.openBlock)(), (0, vue.
|
|
8831
|
-
class: (0, vue.normalizeClass)(`menu-${key}`),
|
|
9090
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(NavMenuColumn_default, {
|
|
8832
9091
|
key,
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
9092
|
+
"column-key": key,
|
|
9093
|
+
items: buttons.value[key],
|
|
9094
|
+
width: columnWidth.value?.[key]
|
|
9095
|
+
}, null, 8, [
|
|
9096
|
+
"column-key",
|
|
9097
|
+
"items",
|
|
9098
|
+
"width"
|
|
9099
|
+
]);
|
|
8840
9100
|
}), 128))], 4);
|
|
8841
9101
|
};
|
|
8842
9102
|
}
|
|
@@ -11315,97 +11575,97 @@
|
|
|
11315
11575
|
{
|
|
11316
11576
|
command: KeyBindingCommand.DELETE_NODE,
|
|
11317
11577
|
keybinding: ["delete", "backspace"],
|
|
11318
|
-
when: [[
|
|
11578
|
+
when: [["stage", "keyup"], ["layer-panel", "keydown"]]
|
|
11319
11579
|
},
|
|
11320
11580
|
{
|
|
11321
11581
|
command: KeyBindingCommand.COPY_NODE,
|
|
11322
11582
|
keybinding: "ctrl+c",
|
|
11323
|
-
when: [[
|
|
11583
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11324
11584
|
},
|
|
11325
11585
|
{
|
|
11326
11586
|
command: KeyBindingCommand.PASTE_NODE,
|
|
11327
11587
|
keybinding: "ctrl+v",
|
|
11328
|
-
when: [[
|
|
11588
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11329
11589
|
},
|
|
11330
11590
|
{
|
|
11331
11591
|
command: KeyBindingCommand.CUT_NODE,
|
|
11332
11592
|
keybinding: "ctrl+x",
|
|
11333
|
-
when: [[
|
|
11593
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11334
11594
|
},
|
|
11335
11595
|
{
|
|
11336
11596
|
command: KeyBindingCommand.UNDO,
|
|
11337
11597
|
keybinding: "ctrl+z",
|
|
11338
|
-
when: [[
|
|
11598
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11339
11599
|
},
|
|
11340
11600
|
{
|
|
11341
11601
|
command: KeyBindingCommand.REDO,
|
|
11342
11602
|
keybinding: "ctrl+shift+z",
|
|
11343
|
-
when: [[
|
|
11603
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11344
11604
|
},
|
|
11345
11605
|
{
|
|
11346
11606
|
command: KeyBindingCommand.MOVE_UP_1,
|
|
11347
11607
|
keybinding: "up",
|
|
11348
|
-
when: [[
|
|
11608
|
+
when: [["stage", "keydown"]]
|
|
11349
11609
|
},
|
|
11350
11610
|
{
|
|
11351
11611
|
command: KeyBindingCommand.MOVE_DOWN_1,
|
|
11352
11612
|
keybinding: "down",
|
|
11353
|
-
when: [[
|
|
11613
|
+
when: [["stage", "keydown"]]
|
|
11354
11614
|
},
|
|
11355
11615
|
{
|
|
11356
11616
|
command: KeyBindingCommand.MOVE_LEFT_1,
|
|
11357
11617
|
keybinding: "left",
|
|
11358
|
-
when: [[
|
|
11618
|
+
when: [["stage", "keydown"]]
|
|
11359
11619
|
},
|
|
11360
11620
|
{
|
|
11361
11621
|
command: KeyBindingCommand.MOVE_RIGHT_1,
|
|
11362
11622
|
keybinding: "right",
|
|
11363
|
-
when: [[
|
|
11623
|
+
when: [["stage", "keydown"]]
|
|
11364
11624
|
},
|
|
11365
11625
|
{
|
|
11366
11626
|
command: KeyBindingCommand.MOVE_UP_10,
|
|
11367
11627
|
keybinding: "ctrl+up",
|
|
11368
|
-
when: [[
|
|
11628
|
+
when: [["stage", "keydown"]]
|
|
11369
11629
|
},
|
|
11370
11630
|
{
|
|
11371
11631
|
command: KeyBindingCommand.MOVE_DOWN_10,
|
|
11372
11632
|
keybinding: "ctrl+down",
|
|
11373
|
-
when: [[
|
|
11633
|
+
when: [["stage", "keydown"]]
|
|
11374
11634
|
},
|
|
11375
11635
|
{
|
|
11376
11636
|
command: KeyBindingCommand.MOVE_LEFT_10,
|
|
11377
11637
|
keybinding: "ctrl+left",
|
|
11378
|
-
when: [[
|
|
11638
|
+
when: [["stage", "keydown"]]
|
|
11379
11639
|
},
|
|
11380
11640
|
{
|
|
11381
11641
|
command: KeyBindingCommand.MOVE_RIGHT_10,
|
|
11382
11642
|
keybinding: "ctrl+right",
|
|
11383
|
-
when: [[
|
|
11643
|
+
when: [["stage", "keydown"]]
|
|
11384
11644
|
},
|
|
11385
11645
|
{
|
|
11386
11646
|
command: KeyBindingCommand.SWITCH_NODE,
|
|
11387
11647
|
keybinding: "tab",
|
|
11388
|
-
when: [[
|
|
11648
|
+
when: [["stage", "keydown"], ["layer-panel", "keydown"]]
|
|
11389
11649
|
},
|
|
11390
11650
|
{
|
|
11391
11651
|
command: KeyBindingCommand.ZOOM_IN,
|
|
11392
11652
|
keybinding: ["ctrl+=", "ctrl+numpadplus"],
|
|
11393
|
-
when: [[
|
|
11653
|
+
when: [["stage", "keydown"]]
|
|
11394
11654
|
},
|
|
11395
11655
|
{
|
|
11396
11656
|
command: KeyBindingCommand.ZOOM_OUT,
|
|
11397
11657
|
keybinding: ["ctrl+-", "ctrl+numpad-"],
|
|
11398
|
-
when: [[
|
|
11658
|
+
when: [["stage", "keydown"]]
|
|
11399
11659
|
},
|
|
11400
11660
|
{
|
|
11401
11661
|
command: KeyBindingCommand.ZOOM_FIT,
|
|
11402
11662
|
keybinding: "ctrl+0",
|
|
11403
|
-
when: [[
|
|
11663
|
+
when: [["stage", "keydown"]]
|
|
11404
11664
|
},
|
|
11405
11665
|
{
|
|
11406
11666
|
command: KeyBindingCommand.ZOOM_RESET,
|
|
11407
11667
|
keybinding: "ctrl+1",
|
|
11408
|
-
when: [[
|
|
11668
|
+
when: [["stage", "keydown"]]
|
|
11409
11669
|
}
|
|
11410
11670
|
];
|
|
11411
11671
|
//#endregion
|