@tmagic/editor 1.2.0-beta.2 → 1.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tmagic-editor.mjs +415 -400
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +417 -402
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/components/ContentMenu.vue +2 -2
- package/src/components/Icon.vue +6 -4
- package/src/components/ToolButton.vue +29 -14
- package/src/fields/CodeSelect.vue +6 -6
- package/src/fields/UISelect.vue +8 -7
- package/src/layouts/AddPageBox.vue +2 -1
- package/src/layouts/Framework.vue +3 -2
- package/src/layouts/PropsPanel.vue +3 -8
- package/src/layouts/sidebar/ComponentListPanel.vue +13 -11
- package/src/layouts/sidebar/LayerPanel.vue +252 -162
- package/src/layouts/sidebar/Sidebar.vue +4 -2
- package/src/layouts/sidebar/TabPane.vue +4 -2
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +21 -16
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +19 -19
- package/src/layouts/workspace/PageBar.vue +11 -10
- package/types/Editor.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +16 -883
package/dist/tmagic-editor.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, inject, ref, watchEffect, createElementBlock, createVNode, withCtx, createElementVNode, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onUnmounted, toRaw, renderSlot, Fragment,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, inject, ref, watchEffect, createElementBlock, createVNode, withCtx, createElementVNode, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onUnmounted, normalizeClass, resolveDynamicComponent, toRaw, renderSlot, Fragment, createSlots, renderList, normalizeProps, mergeProps, markRaw, getCurrentInstance, isRef, Teleport, nextTick, toHandlers, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import { ElMessage } from 'element-plus';
|
|
4
3
|
import { cloneDeep, map, xor, throttle, pick, isEmpty, forIn, omit, keys, mergeWith, uniq } from 'lodash-es';
|
|
5
|
-
import {
|
|
4
|
+
import { TMagicCard, TMagicTooltip, tMagicMessage, TMagicButton, TMagicIcon, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicDialog, TMagicInput, TMagicTree, TMagicCollapse, TMagicCollapseItem, TMagicTabPane, TMagicTabs, TMagicPopover } from '@tmagic/design';
|
|
5
|
+
import { Delete, Close, Edit, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, View, Link, Files, DocumentCopy, EditPen, Coin, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
|
|
6
6
|
import * as monaco from 'monaco-editor';
|
|
7
7
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS, ContainerHighlightType } from '@tmagic/stage';
|
|
8
8
|
import { NodeType } from '@tmagic/schema';
|
|
@@ -154,12 +154,12 @@ var CodeSelectOp = /* @__PURE__ */ ((CodeSelectOp2) => {
|
|
|
154
154
|
})(CodeSelectOp || {});
|
|
155
155
|
|
|
156
156
|
const _hoisted_1$d = { class: "tool-bar" };
|
|
157
|
-
const _hoisted_2$
|
|
157
|
+
const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("path", {
|
|
158
158
|
fill: "currentColor",
|
|
159
159
|
d: "m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414L23 12zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414L3.828 12z"
|
|
160
160
|
}, null, -1);
|
|
161
161
|
const _hoisted_3$3 = [
|
|
162
|
-
_hoisted_2$
|
|
162
|
+
_hoisted_2$5
|
|
163
163
|
];
|
|
164
164
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
165
165
|
__name: "CodeSelect",
|
|
@@ -235,7 +235,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
235
235
|
};
|
|
236
236
|
const viewHandler = async () => {
|
|
237
237
|
if (props.model[props.name].length === 0) {
|
|
238
|
-
|
|
238
|
+
tMagicMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
await setCombineIds(props.model[props.name]);
|
|
@@ -244,13 +244,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
244
244
|
};
|
|
245
245
|
return (_ctx, _cache) => {
|
|
246
246
|
const _component_m_fields_select = resolveComponent("m-fields-select");
|
|
247
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
248
|
-
const _component_el_card = resolveComponent("el-card");
|
|
249
247
|
return openBlock(), createElementBlock("div", {
|
|
250
248
|
class: "m-fields-code-select",
|
|
251
249
|
key: fieldKey.value
|
|
252
250
|
}, [
|
|
253
|
-
createVNode(
|
|
251
|
+
createVNode(unref(TMagicCard), { shadow: "never" }, {
|
|
254
252
|
header: withCtx(() => [
|
|
255
253
|
createVNode(_component_m_fields_select, {
|
|
256
254
|
config: unref(selectConfig),
|
|
@@ -263,7 +261,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
263
261
|
]),
|
|
264
262
|
default: withCtx(() => [
|
|
265
263
|
createElementVNode("div", _hoisted_1$d, [
|
|
266
|
-
createVNode(
|
|
264
|
+
createVNode(unref(TMagicTooltip), {
|
|
267
265
|
class: "tool-item",
|
|
268
266
|
effect: "dark",
|
|
269
267
|
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
@@ -342,14 +340,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
342
340
|
}
|
|
343
341
|
};
|
|
344
342
|
return (_ctx, _cache) => {
|
|
345
|
-
const _component_el_button = resolveComponent("el-button");
|
|
346
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
347
343
|
return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
|
|
348
344
|
key: 0,
|
|
349
345
|
class: "m-fields-ui-select",
|
|
350
346
|
onClick: cancelHandler
|
|
351
347
|
}, [
|
|
352
|
-
createVNode(
|
|
348
|
+
createVNode(unref(TMagicButton), {
|
|
353
349
|
type: "danger",
|
|
354
350
|
icon: unref(Delete),
|
|
355
351
|
text: "",
|
|
@@ -366,12 +362,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
366
362
|
onClick: startSelect,
|
|
367
363
|
style: { "display": "flex" }
|
|
368
364
|
}, [
|
|
369
|
-
unref(val) ? (openBlock(), createBlock(
|
|
365
|
+
unref(val) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
370
366
|
key: 0,
|
|
371
367
|
content: "\u6E05\u9664"
|
|
372
368
|
}, {
|
|
373
369
|
default: withCtx(() => [
|
|
374
|
-
createVNode(
|
|
370
|
+
createVNode(unref(TMagicButton), {
|
|
375
371
|
style: { "padding": "0" },
|
|
376
372
|
type: "danger",
|
|
377
373
|
icon: unref(Close),
|
|
@@ -381,11 +377,11 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
381
377
|
]),
|
|
382
378
|
_: 1
|
|
383
379
|
})) : createCommentVNode("", true),
|
|
384
|
-
createVNode(
|
|
380
|
+
createVNode(unref(TMagicTooltip), {
|
|
385
381
|
content: unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
386
382
|
}, {
|
|
387
383
|
default: withCtx(() => [
|
|
388
|
-
createVNode(
|
|
384
|
+
createVNode(unref(TMagicButton), {
|
|
389
385
|
text: "",
|
|
390
386
|
style: { "padding": "0", "margin": "0" }
|
|
391
387
|
}, {
|
|
@@ -534,6 +530,46 @@ const setConfig = (option) => {
|
|
|
534
530
|
};
|
|
535
531
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
536
532
|
|
|
533
|
+
const _hoisted_1$b = ["src"];
|
|
534
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
535
|
+
__name: "Icon",
|
|
536
|
+
props: {
|
|
537
|
+
icon: null
|
|
538
|
+
},
|
|
539
|
+
setup(__props) {
|
|
540
|
+
return (_ctx, _cache) => {
|
|
541
|
+
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
542
|
+
key: 0,
|
|
543
|
+
class: "magic-editor-icon"
|
|
544
|
+
}, {
|
|
545
|
+
default: withCtx(() => [
|
|
546
|
+
createVNode(unref(Edit))
|
|
547
|
+
]),
|
|
548
|
+
_: 1
|
|
549
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
550
|
+
key: 1,
|
|
551
|
+
class: "magic-editor-icon"
|
|
552
|
+
}, {
|
|
553
|
+
default: withCtx(() => [
|
|
554
|
+
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$b)
|
|
555
|
+
]),
|
|
556
|
+
_: 1
|
|
557
|
+
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
558
|
+
key: 2,
|
|
559
|
+
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
560
|
+
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
561
|
+
key: 3,
|
|
562
|
+
class: "magic-editor-icon"
|
|
563
|
+
}, {
|
|
564
|
+
default: withCtx(() => [
|
|
565
|
+
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
566
|
+
]),
|
|
567
|
+
_: 1
|
|
568
|
+
}));
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
537
573
|
const log = (...args) => {
|
|
538
574
|
if (process.env.NODE_ENV === "development") {
|
|
539
575
|
console.log("magic editor: ", ...args);
|
|
@@ -2390,10 +2426,10 @@ const useStage = (stageOptions) => {
|
|
|
2390
2426
|
return stage;
|
|
2391
2427
|
};
|
|
2392
2428
|
|
|
2393
|
-
const _hoisted_1$
|
|
2394
|
-
const _hoisted_2$
|
|
2429
|
+
const _hoisted_1$a = { class: "m-editor-empty-panel" };
|
|
2430
|
+
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
2395
2431
|
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2396
|
-
const _sfc_main$
|
|
2432
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
2397
2433
|
__name: "AddPageBox",
|
|
2398
2434
|
setup(__props) {
|
|
2399
2435
|
const services = inject("services");
|
|
@@ -2407,20 +2443,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2407
2443
|
});
|
|
2408
2444
|
};
|
|
2409
2445
|
return (_ctx, _cache) => {
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
createElementVNode("div", _hoisted_2$5, [
|
|
2446
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2447
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
2413
2448
|
createElementVNode("div", {
|
|
2414
2449
|
class: "m-editor-empty-button",
|
|
2415
2450
|
onClick: clickHandler
|
|
2416
2451
|
}, [
|
|
2417
2452
|
createElementVNode("div", null, [
|
|
2418
|
-
createVNode(
|
|
2419
|
-
default: withCtx(() => [
|
|
2420
|
-
createVNode(unref(Plus))
|
|
2421
|
-
]),
|
|
2422
|
-
_: 1
|
|
2423
|
-
})
|
|
2453
|
+
createVNode(_sfc_main$n, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2424
2454
|
]),
|
|
2425
2455
|
_hoisted_3$2
|
|
2426
2456
|
])
|
|
@@ -2430,7 +2460,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
2430
2460
|
}
|
|
2431
2461
|
});
|
|
2432
2462
|
|
|
2433
|
-
const _sfc_main$
|
|
2463
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
2434
2464
|
__name: "Resizer",
|
|
2435
2465
|
emits: ["change"],
|
|
2436
2466
|
setup(__props, { emit }) {
|
|
@@ -2463,7 +2493,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
2463
2493
|
}
|
|
2464
2494
|
});
|
|
2465
2495
|
|
|
2466
|
-
const _sfc_main$
|
|
2496
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
2467
2497
|
__name: "Layout",
|
|
2468
2498
|
props: {
|
|
2469
2499
|
left: null,
|
|
@@ -2536,7 +2566,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2536
2566
|
}, [
|
|
2537
2567
|
renderSlot(_ctx.$slots, "left")
|
|
2538
2568
|
], 6),
|
|
2539
|
-
createVNode(_sfc_main$
|
|
2569
|
+
createVNode(_sfc_main$l, { onChange: changeLeft })
|
|
2540
2570
|
], 64)) : createCommentVNode("", true),
|
|
2541
2571
|
createElementVNode("div", {
|
|
2542
2572
|
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
@@ -2545,7 +2575,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2545
2575
|
renderSlot(_ctx.$slots, "center")
|
|
2546
2576
|
], 6),
|
|
2547
2577
|
typeof props.right !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2548
|
-
createVNode(_sfc_main$
|
|
2578
|
+
createVNode(_sfc_main$l, { onChange: changeRight }),
|
|
2549
2579
|
createElementVNode("div", {
|
|
2550
2580
|
class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
2551
2581
|
style: normalizeStyle(`width: ${__props.right}px`)
|
|
@@ -2558,8 +2588,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
2558
2588
|
}
|
|
2559
2589
|
});
|
|
2560
2590
|
|
|
2561
|
-
const _hoisted_1$
|
|
2562
|
-
const _sfc_main$
|
|
2591
|
+
const _hoisted_1$9 = { class: "m-editor" };
|
|
2592
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2563
2593
|
__name: "Framework",
|
|
2564
2594
|
props: {
|
|
2565
2595
|
codeOptions: { default: () => ({}) }
|
|
@@ -2609,8 +2639,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2609
2639
|
};
|
|
2610
2640
|
return (_ctx, _cache) => {
|
|
2611
2641
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2612
|
-
|
|
2613
|
-
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2642
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
2614
2643
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2615
2644
|
unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
2616
2645
|
key: 0,
|
|
@@ -2618,7 +2647,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2618
2647
|
"init-values": unref(root),
|
|
2619
2648
|
options: __props.codeOptions,
|
|
2620
2649
|
onSave: saveCode
|
|
2621
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
2650
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$k, {
|
|
2622
2651
|
key: 1,
|
|
2623
2652
|
class: "m-editor-content",
|
|
2624
2653
|
"left-class": "m-editor-framework-left",
|
|
@@ -2637,7 +2666,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2637
2666
|
]),
|
|
2638
2667
|
center: withCtx(() => [
|
|
2639
2668
|
unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2640
|
-
createVNode(_sfc_main$
|
|
2669
|
+
createVNode(_sfc_main$m)
|
|
2641
2670
|
])
|
|
2642
2671
|
]),
|
|
2643
2672
|
_: 2
|
|
@@ -2645,7 +2674,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2645
2674
|
unref(pageLength) > 0 ? {
|
|
2646
2675
|
name: "right",
|
|
2647
2676
|
fn: withCtx(() => [
|
|
2648
|
-
createVNode(
|
|
2677
|
+
createVNode(unref(TMagicScrollbar), null, {
|
|
2649
2678
|
default: withCtx(() => [
|
|
2650
2679
|
renderSlot(_ctx.$slots, "props-panel")
|
|
2651
2680
|
]),
|
|
@@ -2659,52 +2688,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2659
2688
|
}
|
|
2660
2689
|
});
|
|
2661
2690
|
|
|
2662
|
-
const _hoisted_1$9 = ["src"];
|
|
2663
|
-
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2664
|
-
__name: "Icon",
|
|
2665
|
-
props: {
|
|
2666
|
-
icon: null
|
|
2667
|
-
},
|
|
2668
|
-
setup(__props) {
|
|
2669
|
-
return (_ctx, _cache) => {
|
|
2670
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
2671
|
-
return !__props.icon ? (openBlock(), createBlock(_component_el_icon, {
|
|
2672
|
-
key: 0,
|
|
2673
|
-
class: "magic-editor-icon"
|
|
2674
|
-
}, {
|
|
2675
|
-
default: withCtx(() => [
|
|
2676
|
-
createVNode(unref(Edit))
|
|
2677
|
-
]),
|
|
2678
|
-
_: 1
|
|
2679
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(_component_el_icon, {
|
|
2680
|
-
key: 1,
|
|
2681
|
-
class: "magic-editor-icon"
|
|
2682
|
-
}, {
|
|
2683
|
-
default: withCtx(() => [
|
|
2684
|
-
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$9)
|
|
2685
|
-
]),
|
|
2686
|
-
_: 1
|
|
2687
|
-
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
2688
|
-
key: 2,
|
|
2689
|
-
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
2690
|
-
}, null, 2)) : (openBlock(), createBlock(_component_el_icon, {
|
|
2691
|
-
key: 3,
|
|
2692
|
-
class: "magic-editor-icon"
|
|
2693
|
-
}, {
|
|
2694
|
-
default: withCtx(() => [
|
|
2695
|
-
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
2696
|
-
]),
|
|
2697
|
-
_: 1
|
|
2698
|
-
}));
|
|
2699
|
-
};
|
|
2700
|
-
}
|
|
2701
|
-
});
|
|
2702
|
-
|
|
2703
2691
|
const _hoisted_1$8 = {
|
|
2704
2692
|
key: 1,
|
|
2705
2693
|
class: "menu-item-text"
|
|
2706
2694
|
};
|
|
2707
|
-
const _hoisted_2$
|
|
2695
|
+
const _hoisted_2$3 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2708
2696
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2709
2697
|
__name: "ToolButton",
|
|
2710
2698
|
props: {
|
|
@@ -2771,13 +2759,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2771
2759
|
}
|
|
2772
2760
|
};
|
|
2773
2761
|
return (_ctx, _cache) => {
|
|
2774
|
-
const _component_el_divider = resolveComponent("el-divider");
|
|
2775
|
-
const _component_el_button = resolveComponent("el-button");
|
|
2776
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
2777
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
2778
|
-
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
2779
|
-
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
2780
|
-
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
2781
2762
|
return unref(display) ? (openBlock(), createElementBlock("div", {
|
|
2782
2763
|
key: 0,
|
|
2783
2764
|
class: normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
|
|
@@ -2785,24 +2766,24 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2785
2766
|
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
|
|
2786
2767
|
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
|
|
2787
2768
|
}, [
|
|
2788
|
-
__props.data.type === "divider" ? (openBlock(), createBlock(
|
|
2769
|
+
__props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
2789
2770
|
key: 0,
|
|
2790
2771
|
direction: __props.data.direction || "vertical"
|
|
2791
2772
|
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$8, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2792
|
-
__props.data.tooltip ? (openBlock(), createBlock(
|
|
2773
|
+
__props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
2793
2774
|
key: 0,
|
|
2794
2775
|
effect: "dark",
|
|
2795
2776
|
placement: "bottom-start",
|
|
2796
2777
|
content: __props.data.tooltip
|
|
2797
2778
|
}, {
|
|
2798
2779
|
default: withCtx(() => [
|
|
2799
|
-
createVNode(
|
|
2780
|
+
createVNode(unref(TMagicButton), {
|
|
2800
2781
|
size: "small",
|
|
2801
2782
|
text: "",
|
|
2802
2783
|
disabled: unref(disabled)
|
|
2803
2784
|
}, {
|
|
2804
2785
|
default: withCtx(() => [
|
|
2805
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2786
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$n, {
|
|
2806
2787
|
key: 0,
|
|
2807
2788
|
icon: __props.data.icon
|
|
2808
2789
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2812,14 +2793,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2812
2793
|
}, 8, ["disabled"])
|
|
2813
2794
|
]),
|
|
2814
2795
|
_: 1
|
|
2815
|
-
}, 8, ["content"])) : (openBlock(), createBlock(
|
|
2796
|
+
}, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), {
|
|
2816
2797
|
key: 1,
|
|
2817
2798
|
size: "small",
|
|
2818
2799
|
text: "",
|
|
2819
2800
|
disabled: unref(disabled)
|
|
2820
2801
|
}, {
|
|
2821
2802
|
default: withCtx(() => [
|
|
2822
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2803
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$n, {
|
|
2823
2804
|
key: 0,
|
|
2824
2805
|
icon: __props.data.icon
|
|
2825
2806
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2827,17 +2808,17 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2827
2808
|
]),
|
|
2828
2809
|
_: 1
|
|
2829
2810
|
}, 8, ["disabled"]))
|
|
2830
|
-
], 64)) : __props.data.type === "dropdown" ? (openBlock(), createBlock(
|
|
2811
|
+
], 64)) : __props.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
|
|
2831
2812
|
key: 3,
|
|
2832
2813
|
trigger: "click",
|
|
2833
2814
|
disabled: unref(disabled),
|
|
2834
2815
|
onCommand: dropdownHandler
|
|
2835
2816
|
}, {
|
|
2836
2817
|
dropdown: withCtx(() => [
|
|
2837
|
-
__props.data.items && __props.data.items.length ? (openBlock(), createBlock(
|
|
2818
|
+
__props.data.items && __props.data.items.length ? (openBlock(), createBlock(unref(TMagicDropdownMenu), { key: 0 }, {
|
|
2838
2819
|
default: withCtx(() => [
|
|
2839
2820
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.items, (subItem, index) => {
|
|
2840
|
-
return openBlock(), createBlock(
|
|
2821
|
+
return openBlock(), createBlock(unref(TMagicDropdownItem), {
|
|
2841
2822
|
key: index,
|
|
2842
2823
|
command: { data: __props.data, subItem }
|
|
2843
2824
|
}, {
|
|
@@ -2852,9 +2833,9 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2852
2833
|
})) : createCommentVNode("", true)
|
|
2853
2834
|
]),
|
|
2854
2835
|
default: withCtx(() => [
|
|
2855
|
-
createElementVNode("span", _hoisted_2$
|
|
2836
|
+
createElementVNode("span", _hoisted_2$3, [
|
|
2856
2837
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
2857
|
-
createVNode(
|
|
2838
|
+
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
2858
2839
|
default: withCtx(() => [
|
|
2859
2840
|
createVNode(unref(ArrowDown))
|
|
2860
2841
|
]),
|
|
@@ -3075,13 +3056,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3075
3056
|
services?.editorService.update(values2);
|
|
3076
3057
|
} catch (e) {
|
|
3077
3058
|
console.error(e);
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
duration: 1e4,
|
|
3081
|
-
showClose: true,
|
|
3082
|
-
message: e.message,
|
|
3083
|
-
dangerouslyUseHTMLString: true
|
|
3084
|
-
});
|
|
3059
|
+
tMagicMessage.closeAll();
|
|
3060
|
+
tMagicMessage.error(e.message);
|
|
3085
3061
|
}
|
|
3086
3062
|
};
|
|
3087
3063
|
expose({ submit });
|
|
@@ -3105,7 +3081,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3105
3081
|
});
|
|
3106
3082
|
|
|
3107
3083
|
const _hoisted_1$6 = ["id"];
|
|
3108
|
-
const _hoisted_2$
|
|
3084
|
+
const _hoisted_2$2 = { class: "list-item" };
|
|
3109
3085
|
const _hoisted_3$1 = { class: "code-name" };
|
|
3110
3086
|
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
3111
3087
|
const _hoisted_5$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
|
|
@@ -3162,14 +3138,14 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3162
3138
|
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3163
3139
|
codeConfig.value.content = eval(codeContent);
|
|
3164
3140
|
} catch (e) {
|
|
3165
|
-
|
|
3141
|
+
tMagicMessage.error(e.stack);
|
|
3166
3142
|
return false;
|
|
3167
3143
|
}
|
|
3168
3144
|
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3169
3145
|
name: codeConfig.value.name,
|
|
3170
3146
|
content: codeConfig.value.content
|
|
3171
3147
|
});
|
|
3172
|
-
|
|
3148
|
+
tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3173
3149
|
return true;
|
|
3174
3150
|
};
|
|
3175
3151
|
const saveAndClose = async () => {
|
|
@@ -3183,12 +3159,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3183
3159
|
currentTitle.value = data.name;
|
|
3184
3160
|
};
|
|
3185
3161
|
return (_ctx, _cache) => {
|
|
3186
|
-
|
|
3187
|
-
const _component_el_input = resolveComponent("el-input");
|
|
3188
|
-
const _component_el_button = resolveComponent("el-button");
|
|
3189
|
-
const _component_el_card = resolveComponent("el-card");
|
|
3190
|
-
const _component_el_dialog = resolveComponent("el-dialog");
|
|
3191
|
-
return openBlock(), createBlock(_component_el_dialog, {
|
|
3162
|
+
return openBlock(), createBlock(unref(TMagicDialog), {
|
|
3192
3163
|
modelValue: unref(isShowCodeBlockEditor),
|
|
3193
3164
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3194
3165
|
class: "code-editor-dialog",
|
|
@@ -3198,7 +3169,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3198
3169
|
"append-to-body": true
|
|
3199
3170
|
}, {
|
|
3200
3171
|
default: withCtx(() => [
|
|
3201
|
-
createVNode(_sfc_main$
|
|
3172
|
+
createVNode(_sfc_main$k, {
|
|
3202
3173
|
left: left.value,
|
|
3203
3174
|
"onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
|
|
3204
3175
|
"min-left": 45,
|
|
@@ -3212,11 +3183,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3212
3183
|
])
|
|
3213
3184
|
}, [
|
|
3214
3185
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3215
|
-
createVNode(
|
|
3186
|
+
createVNode(unref(TMagicCard), { shadow: "never" }, {
|
|
3216
3187
|
header: withCtx(() => [
|
|
3217
3188
|
createElementVNode("div", _hoisted_4$1, [
|
|
3218
3189
|
_hoisted_5$1,
|
|
3219
|
-
codeConfig.value ? (openBlock(), createBlock(
|
|
3190
|
+
codeConfig.value ? (openBlock(), createBlock(unref(TMagicInput), {
|
|
3220
3191
|
key: 0,
|
|
3221
3192
|
class: "code-name-input",
|
|
3222
3193
|
modelValue: codeConfig.value.name,
|
|
@@ -3242,7 +3213,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3242
3213
|
}
|
|
3243
3214
|
}, null, 8, ["init-values", "options"])) : createCommentVNode("", true),
|
|
3244
3215
|
unref(editable) ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
3245
|
-
createVNode(
|
|
3216
|
+
createVNode(unref(TMagicButton), {
|
|
3246
3217
|
type: "primary",
|
|
3247
3218
|
class: "button",
|
|
3248
3219
|
onClick: saveCode
|
|
@@ -3252,7 +3223,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3252
3223
|
]),
|
|
3253
3224
|
_: 1
|
|
3254
3225
|
}),
|
|
3255
|
-
createVNode(
|
|
3226
|
+
createVNode(unref(TMagicButton), {
|
|
3256
3227
|
type: "primary",
|
|
3257
3228
|
class: "button",
|
|
3258
3229
|
onClick: saveAndClose
|
|
@@ -3263,7 +3234,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3263
3234
|
_: 1
|
|
3264
3235
|
})
|
|
3265
3236
|
])) : (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
3266
|
-
createVNode(
|
|
3237
|
+
createVNode(unref(TMagicButton), {
|
|
3267
3238
|
type: "primary",
|
|
3268
3239
|
class: "button",
|
|
3269
3240
|
onClick: saveAndClose
|
|
@@ -3285,23 +3256,22 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3285
3256
|
unref(mode) === unref(CodeEditorMode).LIST ? {
|
|
3286
3257
|
name: "left",
|
|
3287
3258
|
fn: withCtx(() => [
|
|
3288
|
-
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(
|
|
3259
|
+
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
3289
3260
|
key: 0,
|
|
3290
|
-
|
|
3261
|
+
class: "side-tree",
|
|
3291
3262
|
"node-key": "id",
|
|
3292
3263
|
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3293
3264
|
data: state.codeList,
|
|
3294
3265
|
"highlight-current": true,
|
|
3295
|
-
onNodeClick: selectHandler,
|
|
3296
3266
|
"current-node-key": state.codeList[0].id,
|
|
3297
|
-
|
|
3267
|
+
onNodeClick: selectHandler
|
|
3298
3268
|
}, {
|
|
3299
3269
|
default: withCtx(({ data }) => [
|
|
3300
3270
|
createElementVNode("div", {
|
|
3301
3271
|
id: data.id,
|
|
3302
3272
|
class: "list-container"
|
|
3303
3273
|
}, [
|
|
3304
|
-
createElementVNode("div", _hoisted_2$
|
|
3274
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
3305
3275
|
createElementVNode("div", _hoisted_3$1, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1)
|
|
3306
3276
|
])
|
|
3307
3277
|
], 8, _hoisted_1$6)
|
|
@@ -3319,7 +3289,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3319
3289
|
});
|
|
3320
3290
|
|
|
3321
3291
|
const _hoisted_1$5 = { class: "m-editor-code-block-list" };
|
|
3322
|
-
const _hoisted_2$
|
|
3292
|
+
const _hoisted_2$1 = { class: "code-header-wrapper" };
|
|
3323
3293
|
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
|
|
3324
3294
|
const _hoisted_4 = ["id"];
|
|
3325
3295
|
const _hoisted_5 = { class: "list-item" };
|
|
@@ -3409,7 +3379,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3409
3379
|
const createCodeBlock = async () => {
|
|
3410
3380
|
const { codeBlockService } = services || {};
|
|
3411
3381
|
if (!codeBlockService) {
|
|
3412
|
-
|
|
3382
|
+
tMagicMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
|
|
3413
3383
|
return;
|
|
3414
3384
|
}
|
|
3415
3385
|
const codeConfig = {
|
|
@@ -3436,7 +3406,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3436
3406
|
if (typeof props.customError === "function") {
|
|
3437
3407
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3438
3408
|
} else {
|
|
3439
|
-
|
|
3409
|
+
tMagicMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
|
|
3440
3410
|
}
|
|
3441
3411
|
}
|
|
3442
3412
|
};
|
|
@@ -3468,14 +3438,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3468
3438
|
stage?.select(compId);
|
|
3469
3439
|
};
|
|
3470
3440
|
return (_ctx, _cache) => {
|
|
3471
|
-
const _component_el_input = resolveComponent("el-input");
|
|
3472
|
-
const _component_el_button = resolveComponent("el-button");
|
|
3473
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3474
|
-
const _component_el_tree = resolveComponent("el-tree");
|
|
3475
3441
|
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
3476
3442
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3477
|
-
createElementVNode("div", _hoisted_2$
|
|
3478
|
-
createVNode(
|
|
3443
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
3444
|
+
createVNode(unref(TMagicInput), {
|
|
3479
3445
|
class: normalizeClass([unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
|
|
3480
3446
|
size: "small",
|
|
3481
3447
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
@@ -3484,7 +3450,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3484
3450
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3485
3451
|
onInput: filterTextChangeHandler
|
|
3486
3452
|
}, null, 8, ["class", "modelValue"]),
|
|
3487
|
-
unref(editable) ? (openBlock(), createBlock(
|
|
3453
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3488
3454
|
key: 0,
|
|
3489
3455
|
class: "create-code-button",
|
|
3490
3456
|
type: "primary",
|
|
@@ -3498,7 +3464,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3498
3464
|
})) : createCommentVNode("", true)
|
|
3499
3465
|
])
|
|
3500
3466
|
]),
|
|
3501
|
-
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(
|
|
3467
|
+
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
3502
3468
|
key: 0,
|
|
3503
3469
|
ref_key: "tree",
|
|
3504
3470
|
ref: tree,
|
|
@@ -3517,13 +3483,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3517
3483
|
createElementVNode("div", _hoisted_5, [
|
|
3518
3484
|
createElementVNode("div", _hoisted_6, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1),
|
|
3519
3485
|
createElementVNode("div", _hoisted_7, [
|
|
3520
|
-
createVNode(
|
|
3486
|
+
createVNode(unref(TMagicTooltip), {
|
|
3521
3487
|
effect: "dark",
|
|
3522
3488
|
content: unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3523
3489
|
placement: "bottom"
|
|
3524
3490
|
}, {
|
|
3525
3491
|
default: withCtx(() => [
|
|
3526
|
-
createVNode(_sfc_main$
|
|
3492
|
+
createVNode(_sfc_main$n, {
|
|
3527
3493
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
3528
3494
|
class: "edit-icon",
|
|
3529
3495
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3531,14 +3497,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3531
3497
|
]),
|
|
3532
3498
|
_: 2
|
|
3533
3499
|
}, 1032, ["content"]),
|
|
3534
|
-
state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createBlock(
|
|
3500
|
+
state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3535
3501
|
key: 0,
|
|
3536
3502
|
effect: "dark",
|
|
3537
3503
|
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3538
3504
|
placement: "bottom"
|
|
3539
3505
|
}, {
|
|
3540
3506
|
default: withCtx(() => [
|
|
3541
|
-
createVNode(_sfc_main$
|
|
3507
|
+
createVNode(_sfc_main$n, {
|
|
3542
3508
|
icon: unref(Link),
|
|
3543
3509
|
class: "edit-icon",
|
|
3544
3510
|
onClick: withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3546,14 +3512,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3546
3512
|
]),
|
|
3547
3513
|
_: 2
|
|
3548
3514
|
}, 1024)) : createCommentVNode("", true),
|
|
3549
|
-
unref(editable) ? (openBlock(), createBlock(
|
|
3515
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3550
3516
|
key: 1,
|
|
3551
3517
|
effect: "dark",
|
|
3552
3518
|
content: "\u5220\u9664",
|
|
3553
3519
|
placement: "bottom"
|
|
3554
3520
|
}, {
|
|
3555
3521
|
default: withCtx(() => [
|
|
3556
|
-
createVNode(_sfc_main$
|
|
3522
|
+
createVNode(_sfc_main$n, {
|
|
3557
3523
|
icon: unref(Close),
|
|
3558
3524
|
class: "edit-icon",
|
|
3559
3525
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3570,7 +3536,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3570
3536
|
data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
3571
3537
|
_hoisted_9,
|
|
3572
3538
|
(openBlock(true), createElementBlock(Fragment, null, renderList(state.bindComps[data.id], (comp, index) => {
|
|
3573
|
-
return openBlock(), createBlock(
|
|
3539
|
+
return openBlock(), createBlock(unref(TMagicButton), {
|
|
3574
3540
|
key: index,
|
|
3575
3541
|
class: "code-comp",
|
|
3576
3542
|
size: "small",
|
|
@@ -3599,8 +3565,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3599
3565
|
}
|
|
3600
3566
|
});
|
|
3601
3567
|
|
|
3602
|
-
const _hoisted_1$4 =
|
|
3603
|
-
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
3568
|
+
const _hoisted_1$4 = ["onClick", "onDragstart"];
|
|
3604
3569
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
3605
3570
|
__name: "ComponentListPanel",
|
|
3606
3571
|
setup(__props) {
|
|
@@ -3615,7 +3580,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3615
3580
|
}))
|
|
3616
3581
|
);
|
|
3617
3582
|
const collapseValue = computed(
|
|
3618
|
-
() => Array(list.value?.length).fill(1).map((x, i) => i)
|
|
3583
|
+
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
3619
3584
|
);
|
|
3620
3585
|
let timeout;
|
|
3621
3586
|
let clientX;
|
|
@@ -3667,20 +3632,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3667
3632
|
timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
|
|
3668
3633
|
};
|
|
3669
3634
|
return (_ctx, _cache) => {
|
|
3670
|
-
|
|
3671
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3672
|
-
const _component_el_collapse_item = resolveComponent("el-collapse-item");
|
|
3673
|
-
const _component_el_collapse = resolveComponent("el-collapse");
|
|
3674
|
-
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
3675
|
-
return openBlock(), createBlock(_component_el_scrollbar, null, {
|
|
3635
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
3676
3636
|
default: withCtx(() => [
|
|
3677
3637
|
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
3678
|
-
createVNode(
|
|
3638
|
+
createVNode(unref(TMagicCollapse), {
|
|
3679
3639
|
class: "ui-component-panel",
|
|
3680
3640
|
"model-value": unref(collapseValue)
|
|
3681
3641
|
}, {
|
|
3682
3642
|
default: withCtx(() => [
|
|
3683
|
-
createVNode(
|
|
3643
|
+
createVNode(unref(TMagicInput), {
|
|
3684
3644
|
"prefix-icon": "el-icon-search",
|
|
3685
3645
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
3686
3646
|
class: "search-input",
|
|
@@ -3691,12 +3651,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3691
3651
|
}, null, 8, ["modelValue"]),
|
|
3692
3652
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
|
|
3693
3653
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3694
|
-
group.items && group.items.length ? (openBlock(), createBlock(
|
|
3654
|
+
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
3695
3655
|
key: index,
|
|
3696
|
-
name: index
|
|
3656
|
+
name: `${index}`
|
|
3697
3657
|
}, {
|
|
3698
3658
|
title: withCtx(() => [
|
|
3699
|
-
|
|
3659
|
+
createVNode(_sfc_main$n, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
3700
3660
|
createTextVNode(toDisplayString(group.title), 1)
|
|
3701
3661
|
]),
|
|
3702
3662
|
default: withCtx(() => [
|
|
@@ -3711,10 +3671,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3711
3671
|
onDrag: dragHandler
|
|
3712
3672
|
}, [
|
|
3713
3673
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3714
|
-
createVNode(_sfc_main$
|
|
3674
|
+
createVNode(_sfc_main$n, {
|
|
3715
3675
|
icon: item.icon
|
|
3716
3676
|
}, null, 8, ["icon"]),
|
|
3717
|
-
createVNode(
|
|
3677
|
+
createVNode(unref(TMagicTooltip), {
|
|
3718
3678
|
effect: "dark",
|
|
3719
3679
|
placement: "bottom",
|
|
3720
3680
|
content: item.text
|
|
@@ -3725,7 +3685,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3725
3685
|
_: 2
|
|
3726
3686
|
}, 1032, ["content"])
|
|
3727
3687
|
])
|
|
3728
|
-
], 40,
|
|
3688
|
+
], 40, _hoisted_1$4);
|
|
3729
3689
|
}), 128))
|
|
3730
3690
|
]),
|
|
3731
3691
|
_: 2
|
|
@@ -3953,255 +3913,307 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3953
3913
|
}
|
|
3954
3914
|
});
|
|
3955
3915
|
|
|
3956
|
-
const
|
|
3957
|
-
const
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
const
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
const
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3916
|
+
const _hoisted_1$3 = ["id", "onMouseenter"];
|
|
3917
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
3918
|
+
__name: "LayerPanel",
|
|
3919
|
+
setup(__props) {
|
|
3920
|
+
const throttleTime = 150;
|
|
3921
|
+
const services = inject("services");
|
|
3922
|
+
const tree = ref();
|
|
3923
|
+
const menu = ref();
|
|
3924
|
+
const editorService = services?.editorService;
|
|
3925
|
+
const page = computed(() => editorService?.get("page"));
|
|
3926
|
+
const values = computed(() => page.value ? [page.value] : []);
|
|
3927
|
+
const selectedNodes = ref([]);
|
|
3928
|
+
const selectedIds = computed(() => selectedNodes.value.map((node) => node.id));
|
|
3929
|
+
const isMultiSelectStatus = ref(false);
|
|
3930
|
+
const spliceNodeKey = ref();
|
|
3931
|
+
const filterText = ref("");
|
|
3932
|
+
const defaultExpandedKeys = computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
3933
|
+
editorService?.on("remove", () => {
|
|
3934
|
+
setTimeout(() => {
|
|
3935
|
+
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
3936
|
+
}, 0);
|
|
3937
|
+
});
|
|
3938
|
+
const select = async (data) => {
|
|
3939
|
+
if (!data.id) {
|
|
3940
|
+
throw new Error("\u6CA1\u6709id");
|
|
3941
|
+
}
|
|
3942
|
+
await editorService?.select(data);
|
|
3943
|
+
editorService?.get("stage")?.select(data.id);
|
|
3944
|
+
};
|
|
3945
|
+
const multiSelect = async (data) => {
|
|
3946
|
+
await editorService?.multiSelect(data);
|
|
3947
|
+
editorService?.get("stage")?.multiSelect(data);
|
|
3948
|
+
};
|
|
3949
|
+
const highlight = (data) => {
|
|
3950
|
+
if (!data?.id) {
|
|
3951
|
+
throw new Error("\u6CA1\u6709id");
|
|
3952
|
+
}
|
|
3953
|
+
editorService?.highlight(data);
|
|
3954
|
+
editorService?.get("stage")?.highlight(data.id);
|
|
3955
|
+
};
|
|
3956
|
+
const expandedKeys = /* @__PURE__ */ new Map();
|
|
3957
|
+
const allowDrop = (draggingNode, dropNode, type) => {
|
|
3958
|
+
const { data } = dropNode || {};
|
|
3959
|
+
const { data: ingData } = draggingNode;
|
|
3960
|
+
const { type: ingType } = ingData;
|
|
3961
|
+
if (ingType !== NodeType.PAGE && data.type === NodeType.PAGE)
|
|
3962
|
+
return false;
|
|
3963
|
+
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
3964
|
+
return false;
|
|
3965
|
+
if (!data || !data.type)
|
|
3966
|
+
return false;
|
|
3967
|
+
if (["prev", "next"].includes(type))
|
|
3968
|
+
return true;
|
|
3969
|
+
if (data.items || data.type === "container")
|
|
3970
|
+
return true;
|
|
3981
3971
|
return false;
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
if (data.items || data.type === "container")
|
|
3985
|
-
return true;
|
|
3986
|
-
return false;
|
|
3987
|
-
},
|
|
3988
|
-
async handleDragEnd(e) {
|
|
3989
|
-
if (!tree.value)
|
|
3990
|
-
return;
|
|
3991
|
-
const { data: node } = e;
|
|
3992
|
-
const parent = editorService?.getParentById(node.id, false);
|
|
3993
|
-
const layout = await editorService?.getLayout(parent);
|
|
3994
|
-
node.style.position = layout;
|
|
3995
|
-
if (layout === Layout.RELATIVE) {
|
|
3996
|
-
node.style.top = 0;
|
|
3997
|
-
node.style.left = 0;
|
|
3998
|
-
}
|
|
3999
|
-
const { data } = tree.value;
|
|
4000
|
-
const [page] = data;
|
|
4001
|
-
editorService?.update(page);
|
|
4002
|
-
}
|
|
4003
|
-
});
|
|
4004
|
-
const useStatus = (tree, editorService) => {
|
|
4005
|
-
const node = ref();
|
|
4006
|
-
const page = computed(() => editorService?.get("page"));
|
|
4007
|
-
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4008
|
-
const expandNodes = () => {
|
|
4009
|
-
expandedKeys.forEach((key) => {
|
|
3972
|
+
};
|
|
3973
|
+
const handleDragEnd = async (e) => {
|
|
4010
3974
|
if (!tree.value)
|
|
4011
3975
|
return;
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
return;
|
|
4020
|
-
node.value = editorService.get("node");
|
|
4021
|
-
if (!node.value)
|
|
4022
|
-
return;
|
|
4023
|
-
tree.value.setCurrentKey(node.value.id, true);
|
|
4024
|
-
const parent = editorService.get("parent");
|
|
4025
|
-
if (!parent?.id)
|
|
4026
|
-
return;
|
|
4027
|
-
const treeNode = tree.value.getNode(parent.id);
|
|
4028
|
-
treeNode?.updateChildren();
|
|
4029
|
-
setTimeout(() => {
|
|
4030
|
-
tree.value && Object.entries(tree.value.store.nodesMap).forEach(([id, node2]) => {
|
|
4031
|
-
if (node2.expanded && node2.data.items) {
|
|
4032
|
-
expandedKeys.set(id, id);
|
|
4033
|
-
}
|
|
4034
|
-
});
|
|
4035
|
-
expandNodes();
|
|
4036
|
-
});
|
|
4037
|
-
});
|
|
4038
|
-
return {
|
|
4039
|
-
values: computed(() => page.value ? [page.value] : []),
|
|
4040
|
-
loadItems: (node2, resolve) => {
|
|
4041
|
-
if (Array.isArray(node2.data)) {
|
|
4042
|
-
return resolve(node2.data);
|
|
3976
|
+
const { data: node } = e;
|
|
3977
|
+
const parent = editorService?.getParentById(node.id, false);
|
|
3978
|
+
const layout = await editorService?.getLayout(parent);
|
|
3979
|
+
node.style.position = layout;
|
|
3980
|
+
if (layout === Layout.RELATIVE) {
|
|
3981
|
+
node.style.top = 0;
|
|
3982
|
+
node.style.left = 0;
|
|
4043
3983
|
}
|
|
4044
|
-
|
|
4045
|
-
|
|
3984
|
+
const data = tree.value.getData();
|
|
3985
|
+
const [page2] = data;
|
|
3986
|
+
editorService?.update(page2);
|
|
3987
|
+
};
|
|
3988
|
+
const loadItems = (node, resolve) => {
|
|
3989
|
+
if (Array.isArray(node.data)) {
|
|
3990
|
+
return resolve(node.data);
|
|
3991
|
+
}
|
|
3992
|
+
if (Array.isArray(node.data?.items)) {
|
|
3993
|
+
return resolve(node.data?.items);
|
|
4046
3994
|
}
|
|
4047
3995
|
resolve([]);
|
|
4048
|
-
}
|
|
4049
|
-
|
|
4050
|
-
clickNode: node,
|
|
4051
|
-
expandedKeys: computed(() => node.value ? [node.value.id] : []),
|
|
4052
|
-
handleCollapse: (data) => {
|
|
3996
|
+
};
|
|
3997
|
+
const handleCollapse = (data) => {
|
|
4053
3998
|
expandedKeys.delete(data.id);
|
|
4054
|
-
}
|
|
4055
|
-
handleExpand
|
|
3999
|
+
};
|
|
4000
|
+
const handleExpand = (data) => {
|
|
4056
4001
|
const parent = editorService?.getParentById(data.id);
|
|
4057
4002
|
if (!parent?.id)
|
|
4058
4003
|
return;
|
|
4059
4004
|
expandedKeys.set(parent.id, parent.id);
|
|
4060
|
-
}
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
}
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4005
|
+
};
|
|
4006
|
+
const filterNode = (value, data) => {
|
|
4007
|
+
if (!value) {
|
|
4008
|
+
return true;
|
|
4009
|
+
}
|
|
4010
|
+
let name = "";
|
|
4011
|
+
if (data.name) {
|
|
4012
|
+
name = data.name;
|
|
4013
|
+
} else if (data.items) {
|
|
4014
|
+
name = "container";
|
|
4015
|
+
}
|
|
4016
|
+
return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
|
|
4017
|
+
};
|
|
4018
|
+
const filterTextChangeHandler = (val) => {
|
|
4019
|
+
tree.value?.filter(val);
|
|
4020
|
+
};
|
|
4021
|
+
const expandNodes = () => {
|
|
4022
|
+
expandedKeys.forEach((key) => {
|
|
4023
|
+
if (!tree.value)
|
|
4024
|
+
return;
|
|
4025
|
+
tree.value.getNode(key)?.expand();
|
|
4026
|
+
});
|
|
4027
|
+
};
|
|
4028
|
+
watch(
|
|
4029
|
+
() => editorService?.get("nodes"),
|
|
4030
|
+
(nodes) => {
|
|
4031
|
+
if (!tree.value)
|
|
4032
|
+
return;
|
|
4033
|
+
if (!editorService)
|
|
4034
|
+
return;
|
|
4035
|
+
if (!nodes)
|
|
4036
|
+
return;
|
|
4037
|
+
selectedNodes.value = nodes;
|
|
4038
|
+
const parent = editorService.get("parent");
|
|
4039
|
+
if (!parent?.id)
|
|
4040
|
+
return;
|
|
4041
|
+
const treeNode = tree.value.getNode(parent.id);
|
|
4042
|
+
treeNode?.updateChildren();
|
|
4043
|
+
setTimeout(() => {
|
|
4044
|
+
tree.value && Object.entries(tree.value.getStore().nodesMap).forEach(([id, node]) => {
|
|
4045
|
+
if (node.expanded && node.data.items) {
|
|
4046
|
+
expandedKeys.set(id, id);
|
|
4047
|
+
}
|
|
4048
|
+
});
|
|
4049
|
+
expandNodes();
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
4052
|
+
);
|
|
4053
|
+
const setTreeKeyStatus = () => {
|
|
4054
|
+
if (!tree.value)
|
|
4055
|
+
return;
|
|
4056
|
+
if (selectedIds.value.length === 0) {
|
|
4057
|
+
tree.value.setCheckedKeys([]);
|
|
4058
|
+
tree.value.setCurrentKey();
|
|
4059
|
+
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4060
|
+
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4061
|
+
tree.value.setCheckedKeys([]);
|
|
4062
|
+
} else {
|
|
4063
|
+
tree.value.setCheckedKeys(selectedIds.value);
|
|
4064
|
+
tree.value.setCurrentKey();
|
|
4065
|
+
}
|
|
4066
|
+
};
|
|
4067
|
+
watch(selectedIds, () => {
|
|
4068
|
+
setTreeKeyStatus();
|
|
4069
|
+
});
|
|
4070
|
+
const keycon = ref();
|
|
4071
|
+
const addSelectModeListener = () => {
|
|
4072
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4073
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
4074
|
+
keycon.value = new KeyController();
|
|
4075
|
+
keycon.value.keydown(ctrl, (e) => {
|
|
4076
|
+
e.inputEvent.preventDefault();
|
|
4077
|
+
isMultiSelectStatus.value = true;
|
|
4078
|
+
});
|
|
4079
|
+
keycon.value.on("blur", () => {
|
|
4080
|
+
isMultiSelectStatus.value = false;
|
|
4081
|
+
});
|
|
4082
|
+
keycon.value.keyup(ctrl, (e) => {
|
|
4083
|
+
e.inputEvent.preventDefault();
|
|
4084
|
+
isMultiSelectStatus.value = false;
|
|
4085
|
+
});
|
|
4086
|
+
};
|
|
4087
|
+
const removeSelectModeListener = () => {
|
|
4088
|
+
keycon.value?.destroy();
|
|
4089
|
+
if (selectedIds.value.length === 1)
|
|
4090
|
+
isMultiSelectStatus.value = false;
|
|
4091
|
+
};
|
|
4088
4092
|
const clicked = ref(false);
|
|
4089
|
-
const
|
|
4093
|
+
const highlightNode = computed(() => editorService?.get("highlightNode"));
|
|
4090
4094
|
const highlightHandler = throttle((data) => {
|
|
4091
|
-
highlight(data
|
|
4095
|
+
highlight(data);
|
|
4092
4096
|
}, throttleTime);
|
|
4093
4097
|
const toggleClickFlag = () => {
|
|
4094
4098
|
clicked.value = !clicked.value;
|
|
4095
4099
|
};
|
|
4096
|
-
const
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4100
|
+
const canHighlight = (data) => {
|
|
4101
|
+
if (clicked.value)
|
|
4102
|
+
return false;
|
|
4103
|
+
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4104
|
+
};
|
|
4105
|
+
watch(isMultiSelectStatus, () => {
|
|
4106
|
+
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === NodeType.PAGE) {
|
|
4107
|
+
selectedNodes.value = [];
|
|
4108
|
+
}
|
|
4104
4109
|
});
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4110
|
+
const multiClickHandler = (data) => {
|
|
4111
|
+
if (!data?.id) {
|
|
4112
|
+
throw new Error("\u6CA1\u6709id");
|
|
4113
|
+
}
|
|
4114
|
+
if (data.type === NodeType.PAGE) {
|
|
4115
|
+
tree.value?.setCheckedKeys([]);
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4119
|
+
if (index !== -1) {
|
|
4120
|
+
selectedNodes.value.splice(index, 1);
|
|
4121
|
+
spliceNodeKey.value = data.id;
|
|
4122
|
+
} else {
|
|
4123
|
+
selectedNodes.value = [...selectedNodes.value, data];
|
|
4124
|
+
}
|
|
4125
|
+
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4126
|
+
multiSelect(selectedIds.value);
|
|
4127
|
+
};
|
|
4128
|
+
const clickHandler = (data) => {
|
|
4129
|
+
if (!isMultiSelectStatus.value) {
|
|
4115
4130
|
if (services?.uiService.get("uiSelectMode")) {
|
|
4116
4131
|
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
4117
4132
|
return;
|
|
4118
4133
|
}
|
|
4119
4134
|
tree.value?.setCurrentKey(data.id);
|
|
4120
|
-
select(data
|
|
4121
|
-
}
|
|
4122
|
-
|
|
4123
|
-
event.preventDefault();
|
|
4124
|
-
await select(data, editorService);
|
|
4125
|
-
menu.value?.show(event);
|
|
4135
|
+
select(data);
|
|
4136
|
+
} else {
|
|
4137
|
+
multiClickHandler(data);
|
|
4126
4138
|
}
|
|
4127
4139
|
};
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
const _hoisted_1$3 = ["id", "onMouseenter"];
|
|
4140
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4141
|
-
const _component_el_input = resolveComponent("el-input");
|
|
4142
|
-
const _component_el_tree = resolveComponent("el-tree");
|
|
4143
|
-
const _component_layer_menu = resolveComponent("layer-menu");
|
|
4144
|
-
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
4145
|
-
return openBlock(), createBlock(_component_el_scrollbar, { class: "magic-editor-layer-panel" }, {
|
|
4146
|
-
default: withCtx(() => [
|
|
4147
|
-
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4148
|
-
createVNode(_component_el_input, {
|
|
4149
|
-
class: "filterInput",
|
|
4150
|
-
size: "small",
|
|
4151
|
-
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4152
|
-
clearable: "",
|
|
4153
|
-
modelValue: _ctx.filterText,
|
|
4154
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filterText = $event),
|
|
4155
|
-
onChange: _ctx.filterTextChangeHandler
|
|
4156
|
-
}, null, 8, ["modelValue", "onChange"]),
|
|
4157
|
-
_ctx.values.length ? (openBlock(), createBlock(_component_el_tree, {
|
|
4158
|
-
key: 0,
|
|
4159
|
-
ref: "tree",
|
|
4160
|
-
"node-key": "id",
|
|
4161
|
-
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4162
|
-
draggable: "",
|
|
4163
|
-
"default-expanded-keys": _ctx.expandedKeys,
|
|
4164
|
-
load: _ctx.loadItems,
|
|
4165
|
-
data: _ctx.values,
|
|
4166
|
-
"expand-on-click-node": false,
|
|
4167
|
-
"highlight-current": true,
|
|
4168
|
-
props: {
|
|
4169
|
-
children: "items"
|
|
4170
|
-
},
|
|
4171
|
-
"filter-node-method": _ctx.filterNode,
|
|
4172
|
-
"allow-drop": _ctx.allowDrop,
|
|
4173
|
-
onNodeClick: _ctx.clickHandler,
|
|
4174
|
-
onNodeContextmenu: _ctx.contextmenu,
|
|
4175
|
-
onNodeDragEnd: _ctx.handleDragEnd,
|
|
4176
|
-
onNodeCollapse: _ctx.handleCollapse,
|
|
4177
|
-
onNodeExpand: _ctx.handleExpand
|
|
4140
|
+
const contextmenu = async (event, data) => {
|
|
4141
|
+
event.preventDefault();
|
|
4142
|
+
await select(data);
|
|
4143
|
+
menu.value?.show(event);
|
|
4144
|
+
};
|
|
4145
|
+
return (_ctx, _cache) => {
|
|
4146
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), {
|
|
4147
|
+
class: "magic-editor-layer-panel",
|
|
4148
|
+
onMouseenter: addSelectModeListener,
|
|
4149
|
+
onMouseleave: removeSelectModeListener
|
|
4178
4150
|
}, {
|
|
4179
|
-
default: withCtx((
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
class:
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4151
|
+
default: withCtx(() => [
|
|
4152
|
+
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4153
|
+
createVNode(unref(TMagicInput), {
|
|
4154
|
+
class: "filterInput",
|
|
4155
|
+
size: "small",
|
|
4156
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4157
|
+
clearable: "",
|
|
4158
|
+
modelValue: filterText.value,
|
|
4159
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4160
|
+
onChange: filterTextChangeHandler
|
|
4161
|
+
}, null, 8, ["modelValue"]),
|
|
4162
|
+
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4163
|
+
key: 0,
|
|
4164
|
+
ref_key: "tree",
|
|
4165
|
+
ref: tree,
|
|
4166
|
+
"node-key": "id",
|
|
4167
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4168
|
+
draggable: "",
|
|
4169
|
+
"default-expanded-keys": unref(defaultExpandedKeys),
|
|
4170
|
+
load: loadItems,
|
|
4171
|
+
data: unref(values),
|
|
4172
|
+
"expand-on-click-node": false,
|
|
4173
|
+
"highlight-current": true,
|
|
4174
|
+
props: {
|
|
4175
|
+
children: "items"
|
|
4176
|
+
},
|
|
4177
|
+
"filter-node-method": filterNode,
|
|
4178
|
+
"allow-drop": allowDrop,
|
|
4179
|
+
"show-checkbox": isMultiSelectStatus.value || unref(selectedIds).length > 1,
|
|
4180
|
+
onNodeClick: clickHandler,
|
|
4181
|
+
onNodeContextmenu: contextmenu,
|
|
4182
|
+
onNodeDragEnd: handleDragEnd,
|
|
4183
|
+
onNodeCollapse: handleCollapse,
|
|
4184
|
+
onNodeExpand: handleExpand,
|
|
4185
|
+
onCheck: multiClickHandler,
|
|
4186
|
+
onMousedown: toggleClickFlag,
|
|
4187
|
+
onMouseup: toggleClickFlag
|
|
4188
|
+
}, {
|
|
4189
|
+
default: withCtx(({ node, data }) => [
|
|
4190
|
+
createElementVNode("div", {
|
|
4191
|
+
id: data.id,
|
|
4192
|
+
class: normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4193
|
+
onMouseenter: ($event) => unref(highlightHandler)(data)
|
|
4194
|
+
}, [
|
|
4195
|
+
renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4196
|
+
node,
|
|
4197
|
+
data
|
|
4198
|
+
}, () => [
|
|
4199
|
+
createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4200
|
+
])
|
|
4201
|
+
], 42, _hoisted_1$3)
|
|
4202
|
+
]),
|
|
4203
|
+
_: 3
|
|
4204
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : createCommentVNode("", true),
|
|
4205
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4206
|
+
createVNode(_sfc_main$b, {
|
|
4207
|
+
ref_key: "menu",
|
|
4208
|
+
ref: menu
|
|
4209
|
+
}, null, 512)
|
|
4210
|
+
]))
|
|
4194
4211
|
]),
|
|
4195
4212
|
_: 3
|
|
4196
|
-
}
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
]),
|
|
4201
|
-
_: 3
|
|
4202
|
-
});
|
|
4203
|
-
}
|
|
4204
|
-
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1]]);
|
|
4213
|
+
});
|
|
4214
|
+
};
|
|
4215
|
+
}
|
|
4216
|
+
});
|
|
4205
4217
|
|
|
4206
4218
|
const _hoisted_1$2 = {
|
|
4207
4219
|
key: 1,
|
|
@@ -4232,7 +4244,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4232
4244
|
type: "component",
|
|
4233
4245
|
icon: Files,
|
|
4234
4246
|
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4235
|
-
component:
|
|
4247
|
+
component: _sfc_main$a,
|
|
4236
4248
|
slots: {}
|
|
4237
4249
|
};
|
|
4238
4250
|
case "code-block":
|
|
@@ -4248,8 +4260,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4248
4260
|
}
|
|
4249
4261
|
});
|
|
4250
4262
|
return (_ctx, _cache) => {
|
|
4251
|
-
|
|
4252
|
-
return unref(config) ? (openBlock(), createBlock(_component_el_tab_pane, {
|
|
4263
|
+
return unref(config) ? (openBlock(), createBlock(unref(TMagicTabPane), {
|
|
4253
4264
|
key: 0,
|
|
4254
4265
|
name: unref(config).text
|
|
4255
4266
|
}, {
|
|
@@ -4257,7 +4268,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4257
4268
|
(openBlock(), createElementBlock("div", {
|
|
4258
4269
|
key: unref(config).text
|
|
4259
4270
|
}, [
|
|
4260
|
-
unref(config).icon ? (openBlock(), createBlock(_sfc_main$
|
|
4271
|
+
unref(config).icon ? (openBlock(), createBlock(_sfc_main$n, {
|
|
4261
4272
|
key: 0,
|
|
4262
4273
|
icon: unref(config).icon
|
|
4263
4274
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -4355,8 +4366,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4355
4366
|
activeTabName
|
|
4356
4367
|
});
|
|
4357
4368
|
return (_ctx, _cache) => {
|
|
4358
|
-
|
|
4359
|
-
return __props.data.type === "tabs" && __props.data.items.length ? (openBlock(), createBlock(_component_el_tabs, {
|
|
4369
|
+
return __props.data.type === "tabs" && __props.data.items.length ? (openBlock(), createBlock(unref(TMagicTabs), {
|
|
4360
4370
|
key: 0,
|
|
4361
4371
|
class: "m-editor-sidebar",
|
|
4362
4372
|
modelValue: activeTabName.value,
|
|
@@ -4513,14 +4523,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4513
4523
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4514
4524
|
onClick: addPage
|
|
4515
4525
|
}, [
|
|
4516
|
-
createVNode(_sfc_main$
|
|
4526
|
+
createVNode(_sfc_main$n, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4517
4527
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
4518
4528
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
4519
4529
|
key: 2,
|
|
4520
4530
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4521
4531
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4522
4532
|
}, [
|
|
4523
|
-
createVNode(_sfc_main$
|
|
4533
|
+
createVNode(_sfc_main$n, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
4524
4534
|
])) : createCommentVNode("", true),
|
|
4525
4535
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
4526
4536
|
key: 3,
|
|
@@ -4536,7 +4546,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4536
4546
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4537
4547
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4538
4548
|
}, [
|
|
4539
|
-
createVNode(_sfc_main$
|
|
4549
|
+
createVNode(_sfc_main$n, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
4540
4550
|
])) : createCommentVNode("", true)
|
|
4541
4551
|
], 512);
|
|
4542
4552
|
};
|
|
@@ -4566,9 +4576,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4566
4576
|
editorService?.remove(node);
|
|
4567
4577
|
};
|
|
4568
4578
|
return (_ctx, _cache) => {
|
|
4569
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
4570
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
4571
|
-
const _component_el_popover = resolveComponent("el-popover");
|
|
4572
4579
|
return openBlock(), createBlock(_sfc_main$7, null, {
|
|
4573
4580
|
default: withCtx(() => [
|
|
4574
4581
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(root) && unref(root).items || [], (item) => {
|
|
@@ -4579,7 +4586,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4579
4586
|
}, [
|
|
4580
4587
|
createElementVNode("div", _hoisted_2, [
|
|
4581
4588
|
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
4582
|
-
createVNode(
|
|
4589
|
+
createVNode(unref(TMagicTooltip), {
|
|
4583
4590
|
effect: "dark",
|
|
4584
4591
|
placement: "top-start",
|
|
4585
4592
|
content: item.name
|
|
@@ -4591,14 +4598,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4591
4598
|
}, 1032, ["content"])
|
|
4592
4599
|
])
|
|
4593
4600
|
]),
|
|
4594
|
-
createVNode(
|
|
4601
|
+
createVNode(unref(TMagicPopover), {
|
|
4595
4602
|
"popper-class": "page-bar-popover",
|
|
4596
4603
|
placement: "top",
|
|
4597
4604
|
width: 160,
|
|
4598
4605
|
trigger: "hover"
|
|
4599
4606
|
}, {
|
|
4600
4607
|
reference: withCtx(() => [
|
|
4601
|
-
createVNode(
|
|
4608
|
+
createVNode(unref(TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
|
|
4602
4609
|
default: withCtx(() => [
|
|
4603
4610
|
createVNode(unref(CaretBottom))
|
|
4604
4611
|
]),
|
|
@@ -5394,7 +5401,7 @@ const _sfc_main = defineComponent({
|
|
|
5394
5401
|
Sidebar: _sfc_main$8,
|
|
5395
5402
|
Workspace: _sfc_main$1,
|
|
5396
5403
|
PropsPanel: _sfc_main$g,
|
|
5397
|
-
Framework: _sfc_main$
|
|
5404
|
+
Framework: _sfc_main$j
|
|
5398
5405
|
},
|
|
5399
5406
|
props: {
|
|
5400
5407
|
modelValue: {
|
|
@@ -5588,6 +5595,14 @@ const _sfc_main = defineComponent({
|
|
|
5588
5595
|
}
|
|
5589
5596
|
});
|
|
5590
5597
|
|
|
5598
|
+
const _export_sfc = (sfc, props) => {
|
|
5599
|
+
const target = sfc.__vccOpts || sfc;
|
|
5600
|
+
for (const [key, val] of props) {
|
|
5601
|
+
target[key] = val;
|
|
5602
|
+
}
|
|
5603
|
+
return target;
|
|
5604
|
+
};
|
|
5605
|
+
|
|
5591
5606
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5592
5607
|
const _component_nav_menu = resolveComponent("nav-menu");
|
|
5593
5608
|
const _component_sidebar = resolveComponent("sidebar");
|
|
@@ -5690,5 +5705,5 @@ const index = {
|
|
|
5690
5705
|
}
|
|
5691
5706
|
};
|
|
5692
5707
|
|
|
5693
|
-
export { COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$q as CodeSelect, CodeSelectOp, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$
|
|
5708
|
+
export { COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$q as CodeSelect, CodeSelectOp, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$n as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$g as PropsPanel, _sfc_main$o as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$i as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
5694
5709
|
//# sourceMappingURL=tmagic-editor.mjs.map
|