@tmagic/editor 1.2.11 → 1.2.13

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.
@@ -4,7 +4,7 @@ import { Edit, View, Delete, Close, Plus, ArrowDown, Grid, Memo, FullScreen, Sca
4
4
  import { isEmpty, map, has, throttle, cloneDeep, mergeWith, isObject, uniq, forIn, difference, union, pick, keys } from 'lodash-es';
5
5
  import { createValues, MForm } from '@tmagic/form';
6
6
  import { HookType, ActionType, NodeType } from '@tmagic/schema';
7
- import { TMagicIcon, TMagicButton, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, tMagicMessageBox, TMagicCard, TMagicInput, TMagicDialog, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
7
+ import { TMagicIcon, TMagicButton, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, tMagicMessage, TMagicInput, tMagicMessageBox, TMagicCard, TMagicDrawer, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
8
8
  import * as monaco from 'monaco-editor';
9
9
  import Gesto from 'gesto';
10
10
  import { isPop, getNodePath, isNumber, isPage, toLine, datetimeFormatter, removeClassNameByClassName } from '@tmagic/utils';
@@ -16,7 +16,7 @@ import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
16
16
  const __default__$v = defineComponent({
17
17
  name: "MEditorCode"
18
18
  });
19
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
19
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
20
20
  ...__default__$v,
21
21
  props: {
22
22
  model: null,
@@ -49,7 +49,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
49
49
  const __default__$u = defineComponent({
50
50
  name: "MEditorCodeLink"
51
51
  });
52
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
52
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
53
53
  ...__default__$u,
54
54
  props: {
55
55
  config: null,
@@ -123,7 +123,7 @@ const _hoisted_1$h = ["src"];
123
123
  const __default__$t = defineComponent({
124
124
  name: "MEditorIcon"
125
125
  });
126
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
126
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
127
127
  ...__default__$t,
128
128
  props: {
129
129
  icon: null
@@ -165,7 +165,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
165
165
  const __default__$s = defineComponent({
166
166
  name: "MEditorCodeSelect"
167
167
  });
168
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
168
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
169
169
  ...__default__$s,
170
170
  props: {
171
171
  config: { default: () => ({
@@ -276,7 +276,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
276
276
  onChange: changeHandler
277
277
  }, {
278
278
  operateCol: withCtx(({ scope }) => [
279
- scope.row.codeId && __props.config.editable ? (openBlock(), createBlock(_sfc_main$u, {
279
+ scope.row.codeId && __props.config.editable ? (openBlock(), createBlock(_sfc_main$v, {
280
280
  key: 0,
281
281
  icon: unref(editable) ? unref(Edit) : unref(View),
282
282
  class: "edit-icon",
@@ -294,7 +294,7 @@ const _hoisted_1$g = { class: "m-fields-code-select-col" };
294
294
  const __default__$r = defineComponent({
295
295
  name: "MEditorCodeSelectCol"
296
296
  });
297
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
297
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
298
298
  ...__default__$r,
299
299
  props: {
300
300
  config: null,
@@ -404,7 +404,7 @@ const _hoisted_3$4 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u4E8B\u4EF6")
404
404
  const __default__$q = defineComponent({
405
405
  name: "MEditorEventSelect"
406
406
  });
407
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
407
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
408
408
  ...__default__$q,
409
409
  props: {
410
410
  config: null,
@@ -614,7 +614,7 @@ const _hoisted_1$e = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
614
614
  const __default__$p = defineComponent({
615
615
  name: "MEditorUISelect"
616
616
  });
617
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
617
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
618
618
  ...__default__$p,
619
619
  props: {
620
620
  config: null,
@@ -728,7 +728,7 @@ const UISelect_vue_vue_type_style_index_0_lang = '';
728
728
  const __default__$o = defineComponent({
729
729
  name: "MEditorCodeEditor"
730
730
  });
731
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
731
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
732
732
  ...__default__$o,
733
733
  props: {
734
734
  initValues: null,
@@ -861,7 +861,7 @@ const getConfig = (key) => $TMAGIC_EDITOR[key];
861
861
  const __default__$n = defineComponent({
862
862
  name: "MEditorResizer"
863
863
  });
864
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
864
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
865
865
  ...__default__$n,
866
866
  emits: ["change"],
867
867
  setup(__props, { emit }) {
@@ -897,7 +897,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
897
897
  const __default__$m = defineComponent({
898
898
  name: "MEditorLayout"
899
899
  });
900
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
900
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
901
901
  ...__default__$m,
902
902
  props: {
903
903
  left: null,
@@ -1006,7 +1006,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1006
1006
  }, [
1007
1007
  renderSlot(_ctx.$slots, "left")
1008
1008
  ], 6),
1009
- createVNode(_sfc_main$o, { onChange: changeLeft })
1009
+ createVNode(_sfc_main$p, { onChange: changeLeft })
1010
1010
  ], 64)) : createCommentVNode("", true),
1011
1011
  createElementVNode("div", {
1012
1012
  class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
@@ -1015,7 +1015,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1015
1015
  renderSlot(_ctx.$slots, "center")
1016
1016
  ], 6),
1017
1017
  unref(hasRight) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1018
- createVNode(_sfc_main$o, { onChange: changeRight }),
1018
+ createVNode(_sfc_main$p, { onChange: changeRight }),
1019
1019
  createElementVNode("div", {
1020
1020
  class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
1021
1021
  style: normalizeStyle(`width: ${__props.right}px`)
@@ -2735,7 +2735,7 @@ const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E
2735
2735
  const __default__$l = defineComponent({
2736
2736
  name: "MEditorAddPageBox"
2737
2737
  });
2738
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2738
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2739
2739
  ...__default__$l,
2740
2740
  setup(__props) {
2741
2741
  const services = inject("services");
@@ -2759,7 +2759,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2759
2759
  onClick: clickHandler
2760
2760
  }, [
2761
2761
  createElementVNode("div", null, [
2762
- createVNode(_sfc_main$u, { icon: unref(Plus) }, null, 8, ["icon"])
2762
+ createVNode(_sfc_main$v, { icon: unref(Plus) }, null, 8, ["icon"])
2763
2763
  ]),
2764
2764
  _hoisted_3$3
2765
2765
  ])
@@ -2773,7 +2773,7 @@ const _hoisted_1$c = { class: "m-editor" };
2773
2773
  const __default__$k = defineComponent({
2774
2774
  name: "MEditorFramework"
2775
2775
  });
2776
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2776
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2777
2777
  ...__default__$k,
2778
2778
  props: {
2779
2779
  codeOptions: { default: () => ({}) }
@@ -2851,7 +2851,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2851
2851
  "init-values": unref(root),
2852
2852
  options: __props.codeOptions,
2853
2853
  onSave: saveCode
2854
- }, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$n, {
2854
+ }, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$o, {
2855
2855
  key: 1,
2856
2856
  class: "m-editor-content",
2857
2857
  "left-class": "m-editor-framework-left",
@@ -2870,7 +2870,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2870
2870
  ]),
2871
2871
  center: withCtx(() => [
2872
2872
  unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
2873
- createVNode(_sfc_main$m)
2873
+ createVNode(_sfc_main$n)
2874
2874
  ])
2875
2875
  ]),
2876
2876
  _: 2
@@ -2900,7 +2900,7 @@ const _hoisted_2$5 = { class: "el-dropdown-link menubar-menu-button" };
2900
2900
  const __default__$j = defineComponent({
2901
2901
  name: "MEditorToolButton"
2902
2902
  });
2903
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2903
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2904
2904
  ...__default__$j,
2905
2905
  props: {
2906
2906
  data: { default: () => ({
@@ -2990,7 +2990,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2990
2990
  disabled: unref(disabled)
2991
2991
  }, {
2992
2992
  default: withCtx(() => [
2993
- __props.data.icon ? (openBlock(), createBlock(_sfc_main$u, {
2993
+ __props.data.icon ? (openBlock(), createBlock(_sfc_main$v, {
2994
2994
  key: 0,
2995
2995
  icon: __props.data.icon
2996
2996
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -3007,7 +3007,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3007
3007
  disabled: unref(disabled)
3008
3008
  }, {
3009
3009
  default: withCtx(() => [
3010
- __props.data.icon ? (openBlock(), createBlock(_sfc_main$u, {
3010
+ __props.data.icon ? (openBlock(), createBlock(_sfc_main$v, {
3011
3011
  key: 0,
3012
3012
  icon: __props.data.icon
3013
3013
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -3060,7 +3060,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3060
3060
  const __default__$i = defineComponent({
3061
3061
  name: "MEditorNavMenu"
3062
3062
  });
3063
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
3063
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
3064
3064
  ...__default__$i,
3065
3065
  props: {
3066
3066
  data: { default: () => ({}) },
@@ -3219,7 +3219,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3219
3219
  style: normalizeStyle(`width: ${unref(columnWidth)?.[key]}px`)
3220
3220
  }, [
3221
3221
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttons)[key], (item, index) => {
3222
- return openBlock(), createBlock(_sfc_main$k, {
3222
+ return openBlock(), createBlock(_sfc_main$l, {
3223
3223
  data: item,
3224
3224
  key: index
3225
3225
  }, null, 8, ["data"]);
@@ -3235,7 +3235,7 @@ const _hoisted_1$a = { class: "m-editor-props-panel" };
3235
3235
  const __default__$h = defineComponent({
3236
3236
  name: "MEditorPropsPanel"
3237
3237
  });
3238
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
3238
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
3239
3239
  ...__default__$h,
3240
3240
  emits: ["mounted"],
3241
3241
  setup(__props, { expose, emit }) {
@@ -3298,6 +3298,29 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3298
3298
  }
3299
3299
  });
3300
3300
 
3301
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
3302
+ __name: "SearchInput",
3303
+ emits: ["search"],
3304
+ setup(__props, { emit }) {
3305
+ const filterText = ref("");
3306
+ const filterTextChangeHandler = () => {
3307
+ emit("search", filterText.value);
3308
+ };
3309
+ return (_ctx, _cache) => {
3310
+ return openBlock(), createBlock(unref(TMagicInput), {
3311
+ modelValue: filterText.value,
3312
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
3313
+ class: "search-input",
3314
+ size: "small",
3315
+ placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
3316
+ clearable: "",
3317
+ "prefix-icon": unref(Search),
3318
+ onInput: filterTextChangeHandler
3319
+ }, null, 8, ["modelValue", "prefix-icon"]);
3320
+ };
3321
+ }
3322
+ });
3323
+
3301
3324
  const _hoisted_1$9 = {
3302
3325
  key: 0,
3303
3326
  class: "m-editor-content-bottom"
@@ -3391,7 +3414,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3391
3414
  return openBlock(), createElementBlock("div", {
3392
3415
  class: normalizeClass(["m-editor-wrapper", isFullScreen.value ? "fullScreen" : "normal"])
3393
3416
  }, [
3394
- createVNode(_sfc_main$p, {
3417
+ createVNode(_sfc_main$q, {
3395
3418
  ref_key: "codeEditor",
3396
3419
  ref: codeEditor,
3397
3420
  class: "m-editor-container",
@@ -3641,6 +3664,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3641
3664
  setup(__props) {
3642
3665
  const services = inject("services");
3643
3666
  const codeOptions = inject("codeOptions", {});
3667
+ const size = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
3644
3668
  const left = ref(200);
3645
3669
  const currentTitle = ref("");
3646
3670
  const codeConfig = ref(null);
@@ -3670,17 +3694,18 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3670
3694
  currentTitle.value = state.codeList[0]?.name || "";
3671
3695
  });
3672
3696
  return (_ctx, _cache) => {
3673
- return openBlock(), createBlock(unref(TMagicDialog), {
3674
- "model-value": true,
3697
+ return openBlock(), createBlock(unref(TMagicDrawer), {
3675
3698
  class: "code-editor-dialog",
3699
+ "model-value": true,
3676
3700
  title: currentTitle.value,
3677
- fullscreen: true,
3678
3701
  "close-on-press-escape": false,
3679
3702
  "append-to-body": true,
3680
- "show-close": false
3703
+ "show-close": false,
3704
+ "close-on-click-modal": false,
3705
+ size: unref(size)
3681
3706
  }, {
3682
3707
  default: withCtx(() => [
3683
- createVNode(_sfc_main$n, {
3708
+ createVNode(_sfc_main$o, {
3684
3709
  left: left.value,
3685
3710
  "onUpdate:left": _cache[0] || (_cache[0] = ($event) => left.value = $event),
3686
3711
  "min-left": 45,
@@ -3705,18 +3730,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3705
3730
  }, 8, ["left"])
3706
3731
  ]),
3707
3732
  _: 3
3708
- }, 8, ["title"]);
3733
+ }, 8, ["title", "size"]);
3709
3734
  };
3710
3735
  }
3711
3736
  });
3712
3737
 
3713
- const _hoisted_1$6 = { class: "m-editor-code-block-list" };
3714
- const _hoisted_2$2 = { class: "code-header-wrapper" };
3715
- const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
3716
- const _hoisted_4 = ["id"];
3717
- const _hoisted_5 = { class: "list-item" };
3718
- const _hoisted_6 = { class: "code-name" };
3719
- const _hoisted_7 = {
3738
+ const _hoisted_1$6 = { class: "code-header-wrapper" };
3739
+ const _hoisted_2$2 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
3740
+ const _hoisted_3 = ["id"];
3741
+ const _hoisted_4 = { class: "list-item" };
3742
+ const _hoisted_5 = { class: "code-name" };
3743
+ const _hoisted_6 = {
3720
3744
  key: 0,
3721
3745
  class: "right-tool"
3722
3746
  };
@@ -3737,6 +3761,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3737
3761
  id: target.id,
3738
3762
  name: target.name,
3739
3763
  type: "code",
3764
+ codeBlockContent: codeBlockService?.getCodeContentById(target.id),
3740
3765
  children: Object.entries(target.deps).map(([id, dep]) => ({
3741
3766
  name: dep.name,
3742
3767
  type: "node",
@@ -3780,7 +3805,6 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3780
3805
  }
3781
3806
  }
3782
3807
  };
3783
- const filterText = ref("");
3784
3808
  const tree = ref();
3785
3809
  const filterNode = (value, data) => {
3786
3810
  if (!value) {
@@ -3804,107 +3828,97 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3804
3828
  }
3805
3829
  };
3806
3830
  return (_ctx, _cache) => {
3807
- return openBlock(), createElementBlock("div", _hoisted_1$6, [
3808
- renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
3809
- createElementVNode("div", _hoisted_2$2, [
3810
- createVNode(unref(TMagicInput), {
3811
- class: normalizeClass([unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
3812
- size: "small",
3813
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
3814
- clearable: "",
3815
- modelValue: filterText.value,
3816
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
3817
- onInput: filterTextChangeHandler
3818
- }, null, 8, ["class", "modelValue"]),
3819
- unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
3820
- key: 0,
3821
- class: "create-code-button",
3822
- type: "primary",
3823
- size: "small",
3824
- onClick: createCodeBlock
3825
- }, {
3826
- default: withCtx(() => [
3827
- _hoisted_3
3828
- ]),
3829
- _: 1
3830
- })) : createCommentVNode("", true)
3831
- ])
3832
- ]),
3833
- createVNode(unref(TMagicScrollbar), null, {
3834
- default: withCtx(() => [
3835
- createVNode(unref(TMagicTree), {
3836
- ref_key: "tree",
3837
- ref: tree,
3838
- class: "magic-editor-layer-tree",
3839
- "node-key": "id",
3840
- "empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
3841
- "default-expand-all": "",
3842
- "expand-on-click-node": false,
3843
- data: unref(codeList),
3844
- "highlight-current": true,
3845
- "filter-node-method": filterNode,
3846
- onNodeClick: clickHandler
3847
- }, {
3848
- default: withCtx(({ data }) => [
3849
- createElementVNode("div", {
3850
- id: data.id,
3851
- class: "list-container"
3852
- }, [
3853
- createElementVNode("div", _hoisted_5, [
3854
- createElementVNode("span", _hoisted_6, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1),
3855
- data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_7, [
3856
- createVNode(unref(TMagicTooltip), {
3857
- effect: "dark",
3858
- content: unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
3859
- placement: "bottom"
3860
- }, {
3861
- default: withCtx(() => [
3862
- createVNode(_sfc_main$u, {
3863
- icon: unref(editable) ? unref(Edit) : unref(View),
3864
- class: "edit-icon",
3865
- onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
3866
- }, null, 8, ["icon", "onClick"])
3867
- ]),
3868
- _: 2
3869
- }, 1032, ["content"]),
3870
- unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
3871
- key: 0,
3872
- effect: "dark",
3873
- content: "\u5220\u9664",
3874
- placement: "bottom"
3875
- }, {
3876
- default: withCtx(() => [
3877
- createVNode(_sfc_main$u, {
3878
- icon: unref(Close),
3879
- class: "edit-icon",
3880
- onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
3881
- }, null, 8, ["icon", "onClick"])
3882
- ]),
3883
- _: 2
3884
- }, 1024)) : createCommentVNode("", true),
3885
- renderSlot(_ctx.$slots, "code-block-panel-tool", {
3886
- id: data.id,
3887
- data: data.codeBlockContent
3888
- })
3889
- ])) : createCommentVNode("", true)
3890
- ])
3891
- ], 8, _hoisted_4)
3892
- ]),
3893
- _: 3
3894
- }, 8, ["data"])
3895
- ]),
3896
- _: 3
3897
- }),
3898
- unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
3899
- key: 0,
3900
- paramsColConfig: __props.paramsColConfig
3901
- }, {
3902
- "code-block-edit-panel-header": withCtx(({ id }) => [
3903
- renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
3831
+ return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list" }, {
3832
+ default: withCtx(() => [
3833
+ renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
3834
+ createElementVNode("div", _hoisted_1$6, [
3835
+ createVNode(_sfc_main$i, { onSearch: filterTextChangeHandler }),
3836
+ unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
3837
+ key: 0,
3838
+ class: "create-code-button",
3839
+ type: "primary",
3840
+ size: "small",
3841
+ onClick: createCodeBlock
3842
+ }, {
3843
+ default: withCtx(() => [
3844
+ _hoisted_2$2
3845
+ ]),
3846
+ _: 1
3847
+ })) : createCommentVNode("", true)
3848
+ ])
3904
3849
  ]),
3905
- _: 3
3906
- }, 8, ["paramsColConfig"])) : createCommentVNode("", true)
3907
- ]);
3850
+ createVNode(unref(TMagicTree), {
3851
+ ref_key: "tree",
3852
+ ref: tree,
3853
+ class: "magic-editor-layer-tree",
3854
+ "node-key": "id",
3855
+ "empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
3856
+ "default-expand-all": "",
3857
+ "expand-on-click-node": false,
3858
+ data: unref(codeList),
3859
+ "highlight-current": true,
3860
+ "filter-node-method": filterNode,
3861
+ onNodeClick: clickHandler
3862
+ }, {
3863
+ default: withCtx(({ data }) => [
3864
+ createElementVNode("div", {
3865
+ id: data.id,
3866
+ class: "list-container"
3867
+ }, [
3868
+ createElementVNode("div", _hoisted_4, [
3869
+ createElementVNode("span", _hoisted_5, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1),
3870
+ data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_6, [
3871
+ createVNode(unref(TMagicTooltip), {
3872
+ effect: "dark",
3873
+ content: unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
3874
+ placement: "bottom"
3875
+ }, {
3876
+ default: withCtx(() => [
3877
+ createVNode(_sfc_main$v, {
3878
+ icon: unref(editable) ? unref(Edit) : unref(View),
3879
+ class: "edit-icon",
3880
+ onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
3881
+ }, null, 8, ["icon", "onClick"])
3882
+ ]),
3883
+ _: 2
3884
+ }, 1032, ["content"]),
3885
+ unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
3886
+ key: 0,
3887
+ effect: "dark",
3888
+ content: "\u5220\u9664",
3889
+ placement: "bottom"
3890
+ }, {
3891
+ default: withCtx(() => [
3892
+ createVNode(_sfc_main$v, {
3893
+ icon: unref(Close),
3894
+ class: "edit-icon",
3895
+ onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
3896
+ }, null, 8, ["icon", "onClick"])
3897
+ ]),
3898
+ _: 2
3899
+ }, 1024)) : createCommentVNode("", true),
3900
+ renderSlot(_ctx.$slots, "code-block-panel-tool", {
3901
+ id: data.id,
3902
+ data: data.codeBlockContent
3903
+ })
3904
+ ])) : createCommentVNode("", true)
3905
+ ])
3906
+ ], 8, _hoisted_3)
3907
+ ]),
3908
+ _: 3
3909
+ }, 8, ["data"]),
3910
+ unref(isShowCodeBlockEditor) ? (openBlock(), createBlock(_sfc_main$f, {
3911
+ key: 0,
3912
+ paramsColConfig: __props.paramsColConfig
3913
+ }, {
3914
+ "code-block-edit-panel-header": withCtx(({ id }) => [
3915
+ renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
3916
+ ]),
3917
+ _: 3
3918
+ }, 8, ["paramsColConfig"])) : createCommentVNode("", true)
3919
+ ]),
3920
+ _: 3
3921
+ });
3908
3922
  };
3909
3923
  }
3910
3924
  });
@@ -3917,6 +3931,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3917
3931
  ...__default__$c,
3918
3932
  setup(__props) {
3919
3933
  const searchText = ref("");
3934
+ const filterTextChangeHandler = (v) => {
3935
+ searchText.value = v;
3936
+ };
3920
3937
  const services = inject("services");
3921
3938
  const stageOptions = inject("stageOptions");
3922
3939
  const stage = computed(() => services?.editorService.get("stage"));
@@ -3987,15 +4004,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3987
4004
  "model-value": unref(collapseValue)
3988
4005
  }, {
3989
4006
  default: withCtx(() => [
3990
- createVNode(unref(TMagicInput), {
3991
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
3992
- class: "search-input",
3993
- size: "small",
3994
- clearable: "",
3995
- "prefix-icon": unref(Search),
3996
- modelValue: searchText.value,
3997
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
3998
- }, null, 8, ["prefix-icon", "modelValue"]),
4007
+ createVNode(_sfc_main$i, { onSearch: filterTextChangeHandler }),
3999
4008
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
4000
4009
  return openBlock(), createElementBlock(Fragment, null, [
4001
4010
  group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
@@ -4003,7 +4012,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4003
4012
  name: `${index}`
4004
4013
  }, {
4005
4014
  title: withCtx(() => [
4006
- createVNode(_sfc_main$u, { icon: unref(Grid) }, null, 8, ["icon"]),
4015
+ createVNode(_sfc_main$v, { icon: unref(Grid) }, null, 8, ["icon"]),
4007
4016
  createTextVNode(toDisplayString(group.title), 1)
4008
4017
  ]),
4009
4018
  default: withCtx(() => [
@@ -4018,7 +4027,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4018
4027
  onDrag: dragHandler
4019
4028
  }, [
4020
4029
  renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
4021
- createVNode(_sfc_main$u, {
4030
+ createVNode(_sfc_main$v, {
4022
4031
  icon: item.icon
4023
4032
  }, null, 8, ["icon"]),
4024
4033
  createVNode(unref(TMagicTooltip), {
@@ -4141,7 +4150,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4141
4150
  }, [
4142
4151
  createElementVNode("div", null, [
4143
4152
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
4144
- return openBlock(), createBlock(_sfc_main$k, {
4153
+ return openBlock(), createBlock(_sfc_main$l, {
4145
4154
  "event-type": "mouseup",
4146
4155
  data: item,
4147
4156
  key: index,
@@ -4288,7 +4297,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4288
4297
  const menu = ref();
4289
4298
  const checkedKeys = ref([]);
4290
4299
  const isCtrlKeyDown = ref(false);
4291
- const filterText = ref("");
4292
4300
  const expandedKeys = ref([]);
4293
4301
  const currentNodeKey = ref();
4294
4302
  const clicked = ref(false);
@@ -4473,16 +4481,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4473
4481
  return openBlock(), createBlock(unref(TMagicScrollbar), { class: "magic-editor-layer-panel" }, {
4474
4482
  default: withCtx(() => [
4475
4483
  renderSlot(_ctx.$slots, "layer-panel-header"),
4476
- createVNode(unref(TMagicInput), {
4477
- modelValue: filterText.value,
4478
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
4479
- class: "search-input",
4480
- size: "small",
4481
- placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
4482
- clearable: "",
4483
- "prefix-icon": unref(Search),
4484
- onChange: filterTextChangeHandler
4485
- }, null, 8, ["modelValue", "prefix-icon"]),
4484
+ createVNode(_sfc_main$i, { onSearch: filterTextChangeHandler }),
4486
4485
  unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
4487
4486
  key: 0,
4488
4487
  class: "magic-editor-layer-tree",
@@ -4619,7 +4618,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4619
4618
  (openBlock(), createElementBlock("div", {
4620
4619
  key: config.text
4621
4620
  }, [
4622
- config.icon ? (openBlock(), createBlock(_sfc_main$u, {
4621
+ config.icon ? (openBlock(), createBlock(_sfc_main$v, {
4623
4622
  key: 0,
4624
4623
  icon: config.icon
4625
4624
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -4840,14 +4839,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4840
4839
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4841
4840
  onClick: addPage
4842
4841
  }, [
4843
- createVNode(_sfc_main$u, { icon: unref(Plus) }, null, 8, ["icon"])
4842
+ createVNode(_sfc_main$v, { icon: unref(Plus) }, null, 8, ["icon"])
4844
4843
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
4845
4844
  canScroll.value ? (openBlock(), createElementBlock("div", {
4846
4845
  key: 2,
4847
4846
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4848
4847
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
4849
4848
  }, [
4850
- createVNode(_sfc_main$u, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
4849
+ createVNode(_sfc_main$v, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
4851
4850
  ])) : createCommentVNode("", true),
4852
4851
  unref(pageLength) ? (openBlock(), createElementBlock("div", {
4853
4852
  key: 3,
@@ -4863,7 +4862,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4863
4862
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4864
4863
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
4865
4864
  }, [
4866
- createVNode(_sfc_main$u, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
4865
+ createVNode(_sfc_main$v, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
4867
4866
  ])) : createCommentVNode("", true)
4868
4867
  ], 512);
4869
4868
  };
@@ -4935,7 +4934,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4935
4934
  default: withCtx(() => [
4936
4935
  createElementVNode("div", null, [
4937
4936
  renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
4938
- createVNode(_sfc_main$k, {
4937
+ createVNode(_sfc_main$l, {
4939
4938
  data: {
4940
4939
  type: "button",
4941
4940
  text: "\u590D\u5236",
@@ -4943,7 +4942,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4943
4942
  handler: () => copy(item)
4944
4943
  }
4945
4944
  }, null, 8, ["data"]),
4946
- createVNode(_sfc_main$k, {
4945
+ createVNode(_sfc_main$l, {
4947
4946
  data: {
4948
4947
  type: "button",
4949
4948
  text: "\u5220\u9664",
@@ -5758,9 +5757,6 @@ class CodeBlock extends BaseService {
5758
5757
  });
5759
5758
  constructor() {
5760
5759
  super([
5761
- "getCodeContentById",
5762
- "getCodeDslByIds",
5763
- "getCurrentDsl",
5764
5760
  "setCodeDslById",
5765
5761
  "setCodeEditorShowStatus",
5766
5762
  "setEditStatus",
@@ -5777,16 +5773,16 @@ class CodeBlock extends BaseService {
5777
5773
  getCodeDsl() {
5778
5774
  return this.state.codeDsl;
5779
5775
  }
5780
- async getCodeContentById(id2) {
5776
+ getCodeContentById(id2) {
5781
5777
  if (!id2)
5782
5778
  return null;
5783
- const totalCodeDsl = await this.getCodeDsl();
5779
+ const totalCodeDsl = this.getCodeDsl();
5784
5780
  if (!totalCodeDsl)
5785
5781
  return null;
5786
5782
  return totalCodeDsl[id2] ?? null;
5787
5783
  }
5788
5784
  async setCodeDslById(id, codeConfig) {
5789
- const codeDsl = await this.getCodeDsl();
5785
+ const codeDsl = this.getCodeDsl();
5790
5786
  if (!codeDsl) {
5791
5787
  throw new Error("dsl\u4E2D\u6CA1\u6709codeBlocks");
5792
5788
  }
@@ -5801,8 +5797,8 @@ class CodeBlock extends BaseService {
5801
5797
  };
5802
5798
  this.emit("addOrUpdate", id, codeDsl[id]);
5803
5799
  }
5804
- async getCodeDslByIds(ids) {
5805
- const codeDsl2 = await this.getCodeDsl();
5800
+ getCodeDslByIds(ids) {
5801
+ const codeDsl2 = this.getCodeDsl();
5806
5802
  return pick(codeDsl2, ids);
5807
5803
  }
5808
5804
  async setCodeEditorShowStatus(status) {
@@ -5817,8 +5813,8 @@ class CodeBlock extends BaseService {
5817
5813
  this.setId(id2);
5818
5814
  this.state.isShowCodeEditor = status;
5819
5815
  }
5820
- async getCurrentDsl() {
5821
- return await this.getCodeContentById(this.state.id);
5816
+ getCurrentDsl() {
5817
+ return this.getCodeContentById(this.state.id);
5822
5818
  }
5823
5819
  getEditStatus() {
5824
5820
  return this.state.editable;
@@ -6380,11 +6376,11 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, depSe
6380
6376
  const _sfc_main = defineComponent({
6381
6377
  name: "m-editor",
6382
6378
  components: {
6383
- TMagicNavMenu: _sfc_main$j,
6379
+ TMagicNavMenu: _sfc_main$k,
6384
6380
  Sidebar: _sfc_main$9,
6385
6381
  Workspace: _sfc_main$1,
6386
- PropsPanel: _sfc_main$i,
6387
- Framework: _sfc_main$l
6382
+ PropsPanel: _sfc_main$j,
6383
+ Framework: _sfc_main$m
6388
6384
  },
6389
6385
  props: editorProps,
6390
6386
  emits: ["props-panel-mounted", "update:modelValue"],
@@ -6529,15 +6525,15 @@ const index = {
6529
6525
  app.config.globalProperties.$TMAGIC_EDITOR = option;
6530
6526
  setConfig(option);
6531
6527
  app.component(Editor.name, Editor);
6532
- app.component("m-fields-ui-select", _sfc_main$q);
6533
- app.component("m-fields-code-link", _sfc_main$v);
6534
- app.component("m-fields-vs-code", _sfc_main$w);
6535
- app.component("magic-code-editor", _sfc_main$p);
6536
- app.component("m-fields-code-select", _sfc_main$t);
6537
- app.component("m-fields-code-select-col", _sfc_main$s);
6538
- app.component("m-fields-event-select", _sfc_main$r);
6528
+ app.component("m-fields-ui-select", _sfc_main$r);
6529
+ app.component("m-fields-code-link", _sfc_main$w);
6530
+ app.component("m-fields-vs-code", _sfc_main$x);
6531
+ app.component("magic-code-editor", _sfc_main$q);
6532
+ app.component("m-fields-code-select", _sfc_main$u);
6533
+ app.component("m-fields-code-select-col", _sfc_main$t);
6534
+ app.component("m-fields-event-select", _sfc_main$s);
6539
6535
  }
6540
6536
  };
6541
6537
 
6542
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$t as CodeSelect, _sfc_main$s as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$r as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$u as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$n as LayoutContainer, _sfc_main$i as PropsPanel, _sfc_main$p as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$k as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, debug, index as default, depService, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
6538
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, _sfc_main$u as CodeSelect, _sfc_main$t as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$s as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$v as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$o as LayoutContainer, _sfc_main$j as PropsPanel, _sfc_main$q as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$l as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, debug, index as default, depService, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
6543
6539
  //# sourceMappingURL=tmagic-editor.js.map