@tmagic/editor 1.3.0-alpha.16 → 1.3.0-alpha.17

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.
Files changed (51) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/tmagic-editor.js +933 -673
  3. package/dist/tmagic-editor.js.map +1 -1
  4. package/dist/tmagic-editor.umd.cjs +944 -678
  5. package/dist/tmagic-editor.umd.cjs.map +1 -1
  6. package/package.json +12 -12
  7. package/src/components/CodeBlockEditor.vue +1 -0
  8. package/src/fields/Code.vue +6 -10
  9. package/src/fields/CodeLink.vue +6 -7
  10. package/src/fields/CodeSelect.vue +5 -8
  11. package/src/fields/CodeSelectCol.vue +4 -15
  12. package/src/fields/DataSourceFieldSelect.vue +47 -0
  13. package/src/fields/DataSourceFields.vue +5 -10
  14. package/src/fields/DataSourceInput.vue +9 -12
  15. package/src/fields/DataSourceMethodSelect.vue +5 -16
  16. package/src/fields/DataSourceMethods.vue +6 -11
  17. package/src/fields/DataSourceSelect.vue +5 -12
  18. package/src/fields/EventSelect.vue +20 -12
  19. package/src/fields/KeyValue.vue +9 -11
  20. package/src/fields/UISelect.vue +19 -10
  21. package/src/index.ts +3 -0
  22. package/src/initService.ts +36 -16
  23. package/src/layouts/sidebar/code-block/CodeBlockList.vue +2 -2
  24. package/src/layouts/sidebar/data-source/DataSourceConfigPanel.vue +1 -0
  25. package/src/layouts/sidebar/data-source/DataSourceList.vue +51 -17
  26. package/src/services/dep.ts +19 -19
  27. package/src/theme/code-editor.scss +1 -1
  28. package/src/type.ts +20 -0
  29. package/src/utils/dep.ts +33 -7
  30. package/src/utils/props.ts +298 -189
  31. package/src/utils/stage.ts +3 -5
  32. package/types/fields/Code.vue.d.ts +11 -26
  33. package/types/fields/CodeLink.vue.d.ts +12 -21
  34. package/types/fields/CodeSelect.vue.d.ts +6 -17
  35. package/types/fields/CodeSelectCol.vue.d.ts +3 -18
  36. package/types/fields/DataSourceFieldSelect.vue.d.ts +29 -0
  37. package/types/fields/DataSourceFields.vue.d.ts +7 -20
  38. package/types/fields/DataSourceInput.vue.d.ts +10 -30
  39. package/types/fields/DataSourceMethodSelect.vue.d.ts +3 -18
  40. package/types/fields/DataSourceMethods.vue.d.ts +7 -20
  41. package/types/fields/DataSourceSelect.vue.d.ts +13 -29
  42. package/types/fields/EventSelect.vue.d.ts +2 -13
  43. package/types/fields/KeyValue.vue.d.ts +9 -24
  44. package/types/fields/UISelect.vue.d.ts +2 -11
  45. package/types/index.d.ts +1 -0
  46. package/types/initService.d.ts +1 -1
  47. package/types/services/dep.d.ts +12 -21
  48. package/types/services/props.d.ts +8 -113
  49. package/types/type.d.ts +18 -0
  50. package/types/utils/dep.d.ts +4 -2
  51. package/types/utils/props.d.ts +13 -102
@@ -8,7 +8,7 @@ import { HookType, ActionType, NodeType } from '@tmagic/schema';
8
8
  import { MFormDrawer, MForm, createValues, MFormDialog, MSelect } from '@tmagic/form';
9
9
  import { MagicTable } from '@tmagic/table';
10
10
  import Gesto from 'gesto';
11
- import { isPop, getNodePath, isNumber, isPage, toLine, guid, removeClassNameByClassName, getNodes } from '@tmagic/utils';
11
+ import { guid, isPop, getNodePath, isNumber, isPage, toLine, removeClassNameByClassName, isObject as isObject$1, getNodes } from '@tmagic/utils';
12
12
  import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS_NAME, ContainerHighlightType } from '@tmagic/stage';
13
13
  import { EventEmitter } from 'events';
14
14
  import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
@@ -17,7 +17,7 @@ import KeyController from 'keycon';
17
17
  const _hoisted_1$r = {
18
18
  class: /* @__PURE__ */ normalizeClass(`magic-code-editor`)
19
19
  };
20
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
20
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
21
21
  ...{
22
22
  name: "MEditorCodeEditor"
23
23
  },
@@ -191,7 +191,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
191
191
  }
192
192
  });
193
193
 
194
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
194
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
195
195
  ...{
196
196
  name: "MEditorCode"
197
197
  },
@@ -199,11 +199,13 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
199
199
  props: {
200
200
  config: {},
201
201
  model: {},
202
+ initValues: {},
203
+ values: {},
202
204
  name: {},
203
205
  prop: {},
204
- lastValues: {},
205
206
  disabled: { type: Boolean, default: false },
206
- size: {}
207
+ size: {},
208
+ lastValues: {}
207
209
  },
208
210
  emits: ["change"],
209
211
  setup(__props, { emit }) {
@@ -213,7 +215,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
213
215
  emit("change", v);
214
216
  };
215
217
  return (_ctx, _cache) => {
216
- return openBlock(), createBlock(_sfc_main$K, {
218
+ return openBlock(), createBlock(_sfc_main$L, {
217
219
  height: _ctx.config.height,
218
220
  "init-values": _ctx.model[_ctx.name],
219
221
  language: _ctx.config.language,
@@ -233,7 +235,7 @@ const setConfig = (option) => {
233
235
  };
234
236
  const getConfig = (key) => $TMAGIC_EDITOR[key];
235
237
 
236
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
238
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
237
239
  ...{
238
240
  name: "MEditorCodeLink"
239
241
  },
@@ -241,8 +243,13 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
241
243
  props: {
242
244
  config: {},
243
245
  model: {},
246
+ initValues: {},
247
+ values: {},
244
248
  name: {},
245
- prop: {}
249
+ prop: {},
250
+ disabled: { type: Boolean },
251
+ size: {},
252
+ lastValues: {}
246
253
  },
247
254
  emits: ["change"],
248
255
  setup(__props, { emit }) {
@@ -307,7 +314,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
307
314
  }
308
315
  });
309
316
 
310
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
317
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
311
318
  ...{
312
319
  name: "MEditorCodeSelect"
313
320
  },
@@ -315,9 +322,13 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
315
322
  props: {
316
323
  config: {},
317
324
  model: {},
318
- prop: {},
325
+ initValues: {},
326
+ values: {},
319
327
  name: {},
320
- size: {}
328
+ prop: {},
329
+ disabled: { type: Boolean },
330
+ size: {},
331
+ lastValues: {}
321
332
  },
322
333
  emits: ["change"],
323
334
  setup(__props, { emit }) {
@@ -375,7 +386,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
375
386
  }
376
387
  });
377
388
 
378
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
389
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
379
390
  ...{
380
391
  name: "MEditorCodeBlockEditor"
381
392
  },
@@ -494,6 +505,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
494
505
  ref_key: "fomDrawer",
495
506
  ref: fomDrawer,
496
507
  "label-width": "80px",
508
+ "close-on-press-escape": false,
497
509
  title: _ctx.content.name,
498
510
  width: size.value,
499
511
  config: functionConfig.value,
@@ -507,7 +519,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
507
519
  }
508
520
  });
509
521
 
510
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
522
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
511
523
  ...{
512
524
  name: "MEditorCodeParams"
513
525
  },
@@ -557,7 +569,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
557
569
  });
558
570
 
559
571
  const _hoisted_1$q = ["src"];
560
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
572
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
561
573
  ...{
562
574
  name: "MEditorIcon"
563
575
  },
@@ -659,7 +671,7 @@ const useCodeBlockEdit = (codeBlockService) => {
659
671
 
660
672
  const _hoisted_1$p = { class: "m-fields-code-select-col" };
661
673
  const _hoisted_2$f = { class: "code-select-container" };
662
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
674
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
663
675
  ...{
664
676
  name: "MEditorCodeSelectCol"
665
677
  },
@@ -667,11 +679,13 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
667
679
  props: {
668
680
  config: {},
669
681
  model: {},
670
- prop: {},
682
+ initValues: {},
683
+ values: {},
671
684
  name: {},
672
- lastValues: {},
685
+ prop: {},
673
686
  disabled: { type: Boolean, default: false },
674
- size: {}
687
+ size: {},
688
+ lastValues: {}
675
689
  },
676
690
  emits: ["change"],
677
691
  setup(__props, { emit }) {
@@ -731,14 +745,14 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
731
745
  model: _ctx.model,
732
746
  onChange: onParamsChangeHandler
733
747
  }, null, 8, ["model"]),
734
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$E, {
748
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$F, {
735
749
  key: 0,
736
750
  class: "icon",
737
751
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
738
752
  onClick: _cache[0] || (_cache[0] = ($event) => unref(editCode)(_ctx.model[_ctx.name]))
739
753
  }, null, 8, ["icon"])) : createCommentVNode("", true)
740
754
  ]),
741
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$F, {
755
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$G, {
742
756
  key: 0,
743
757
  name: "params",
744
758
  model: _ctx.model,
@@ -746,7 +760,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
746
760
  "params-config": paramsConfig.value,
747
761
  onChange: onParamsChangeHandler
748
762
  }, null, 8, ["model", "size", "params-config"])) : createCommentVNode("", true),
749
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$G, {
763
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$H, {
750
764
  key: 1,
751
765
  ref_key: "codeBlockEditor",
752
766
  ref: codeBlockEditor,
@@ -761,7 +775,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
761
775
 
762
776
  const _hoisted_1$o = { class: "m-editor-data-source-fields" };
763
777
  const _hoisted_2$e = { class: "m-editor-data-source-fields-footer" };
764
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
778
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
765
779
  ...{
766
780
  name: "MEditorDataSourceFields"
767
781
  },
@@ -769,10 +783,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
769
783
  props: {
770
784
  config: {},
771
785
  model: {},
786
+ initValues: {},
787
+ values: {},
788
+ name: {},
772
789
  prop: {},
773
- lastValues: {},
774
790
  disabled: { type: Boolean, default: false },
775
- name: {}
791
+ size: {},
792
+ lastValues: {}
776
793
  },
777
794
  emits: ["change"],
778
795
  setup(__props, { emit }) {
@@ -936,6 +953,53 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
936
953
  }
937
954
  });
938
955
 
956
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
957
+ __name: "DataSourceFieldSelect",
958
+ props: {
959
+ config: {},
960
+ model: {},
961
+ initValues: {},
962
+ values: {},
963
+ name: {},
964
+ prop: {},
965
+ disabled: { type: Boolean, default: false },
966
+ size: {},
967
+ lastValues: {}
968
+ },
969
+ emits: ["change"],
970
+ setup(__props, { emit }) {
971
+ const props = __props;
972
+ const services = inject("services");
973
+ const dataSources = computed(() => services?.dataSourceService.get("dataSources"));
974
+ const cascaderConfig = {
975
+ type: "cascader",
976
+ name: props.name,
977
+ options: () => dataSources.value?.filter((ds) => ds.fields?.length)?.map((ds) => ({
978
+ label: ds.title || ds.id,
979
+ value: ds.id,
980
+ children: ds.fields?.map((field) => ({
981
+ label: field.title,
982
+ value: field.name
983
+ }))
984
+ })) || []
985
+ };
986
+ const onChangeHandler = (value) => {
987
+ emit("change", value);
988
+ };
989
+ return (_ctx, _cache) => {
990
+ const _component_m_form_container = resolveComponent("m-form-container");
991
+ return openBlock(), createBlock(_component_m_form_container, {
992
+ config: {
993
+ ..._ctx.config,
994
+ ...cascaderConfig
995
+ },
996
+ model: _ctx.model,
997
+ onChange: onChangeHandler
998
+ }, null, 8, ["config", "model"]);
999
+ };
1000
+ }
1001
+ });
1002
+
939
1003
  const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
940
1004
  const _hoisted_2$d = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
941
1005
  const _hoisted_3$5 = { class: "el-input__inner" };
@@ -947,11 +1011,13 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
947
1011
  props: {
948
1012
  config: {},
949
1013
  model: {},
1014
+ initValues: {},
1015
+ values: {},
950
1016
  name: {},
951
1017
  prop: {},
952
1018
  disabled: { type: Boolean, default: false },
953
- lastValues: {},
954
- size: {}
1019
+ size: {},
1020
+ lastValues: {}
955
1021
  },
956
1022
  emits: ["change"],
957
1023
  setup(__props, { emit }) {
@@ -1158,7 +1224,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1158
1224
  }
1159
1225
  ), {
1160
1226
  suffix: withCtx(() => [
1161
- createVNode(_sfc_main$E, { icon: unref(Coin) }, null, 8, ["icon"])
1227
+ createVNode(_sfc_main$F, { icon: unref(Coin) }, null, 8, ["icon"])
1162
1228
  ]),
1163
1229
  default: withCtx(({ item }) => [
1164
1230
  createElementVNode("div", _hoisted_1$n, [
@@ -1193,7 +1259,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1193
1259
  }, 1032, ["size"])) : createCommentVNode("", true)
1194
1260
  ], 64);
1195
1261
  }), 256)),
1196
- createVNode(_sfc_main$E, {
1262
+ createVNode(_sfc_main$F, {
1197
1263
  class: "tmagic-data-source-input-icon",
1198
1264
  icon: unref(Coin)
1199
1265
  }, null, 8, ["icon"])
@@ -1286,10 +1352,13 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1286
1352
  props: {
1287
1353
  config: {},
1288
1354
  model: {},
1355
+ initValues: {},
1356
+ values: {},
1357
+ name: {},
1289
1358
  prop: {},
1290
- lastValues: {},
1291
1359
  disabled: { type: Boolean, default: false },
1292
- name: {}
1360
+ size: {},
1361
+ lastValues: {}
1293
1362
  },
1294
1363
  emits: ["change"],
1295
1364
  setup(__props, { emit }) {
@@ -1359,7 +1428,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1359
1428
  _: 1
1360
1429
  }, 8, ["disabled"])
1361
1430
  ]),
1362
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$G, {
1431
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$H, {
1363
1432
  key: 0,
1364
1433
  ref_key: "codeBlockEditor",
1365
1434
  ref: codeBlockEditor,
@@ -1382,11 +1451,13 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1382
1451
  props: {
1383
1452
  config: {},
1384
1453
  model: {},
1385
- lastValues: {},
1386
- prop: {},
1454
+ initValues: {},
1455
+ values: {},
1387
1456
  name: {},
1457
+ prop: {},
1388
1458
  disabled: { type: Boolean, default: false },
1389
- size: {}
1459
+ size: {},
1460
+ lastValues: {}
1390
1461
  },
1391
1462
  emits: ["change"],
1392
1463
  setup(__props, { emit }) {
@@ -1420,7 +1491,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1420
1491
  name: props.name,
1421
1492
  labelWidth: "80px",
1422
1493
  options: () => dataSources.value?.filter((ds) => ds.methods?.length)?.map((ds) => ({
1423
- label: `${ds.title}(${ds.id})`,
1494
+ label: ds.title || ds.id,
1424
1495
  value: ds.id,
1425
1496
  children: ds.methods?.map((method) => ({
1426
1497
  label: method.name,
@@ -1458,14 +1529,14 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1458
1529
  model: _ctx.model,
1459
1530
  onChange: onChangeHandler
1460
1531
  }, null, 8, ["model"]),
1461
- _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$E, {
1532
+ _ctx.model[_ctx.name] ? (openBlock(), createBlock(_sfc_main$F, {
1462
1533
  key: 0,
1463
1534
  class: "icon",
1464
1535
  icon: !_ctx.disabled ? unref(Edit) : unref(View),
1465
1536
  onClick: editCodeHandler
1466
1537
  }, null, 8, ["icon"])) : createCommentVNode("", true)
1467
1538
  ]),
1468
- paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$F, {
1539
+ paramsConfig.value.length ? (openBlock(), createBlock(_sfc_main$G, {
1469
1540
  key: 0,
1470
1541
  name: "params",
1471
1542
  model: _ctx.model,
@@ -1474,7 +1545,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1474
1545
  "params-config": paramsConfig.value,
1475
1546
  onChange: onChangeHandler
1476
1547
  }, null, 8, ["model", "size", "disabled", "params-config"])) : createCommentVNode("", true),
1477
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$G, {
1548
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$H, {
1478
1549
  key: 1,
1479
1550
  ref_key: "codeBlockEditor",
1480
1551
  ref: codeBlockEditor,
@@ -1495,11 +1566,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1495
1566
  props: {
1496
1567
  config: {},
1497
1568
  model: {},
1569
+ initValues: {},
1570
+ values: {},
1498
1571
  name: {},
1499
1572
  prop: {},
1500
1573
  disabled: { type: Boolean, default: false },
1501
- lastValues: {},
1502
- size: {}
1574
+ size: {},
1575
+ lastValues: {}
1503
1576
  },
1504
1577
  emits: ["change"],
1505
1578
  setup(__props, { emit }) {
@@ -1553,9 +1626,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1553
1626
  props: {
1554
1627
  config: {},
1555
1628
  model: {},
1556
- prop: {},
1629
+ initValues: {},
1630
+ values: {},
1557
1631
  name: {},
1558
- size: {}
1632
+ prop: {},
1633
+ disabled: { type: Boolean },
1634
+ size: {},
1635
+ lastValues: {}
1559
1636
  },
1560
1637
  emits: ["change"],
1561
1638
  setup(__props, { emit }) {
@@ -1735,26 +1812,30 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1735
1812
  isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
1736
1813
  key: 0,
1737
1814
  ref: "eventForm",
1738
- size: props.size,
1739
- model: _ctx.model,
1740
1815
  name: "events",
1816
+ size: _ctx.size,
1817
+ disabled: _ctx.disabled,
1818
+ model: _ctx.model,
1741
1819
  config: tableConfig.value,
1742
1820
  onChange: onChangeHandler
1743
- }, null, 8, ["size", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$a, [
1821
+ }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$a, [
1744
1822
  createVNode(unref(TMagicButton), {
1745
1823
  class: "create-button",
1746
1824
  type: "primary",
1747
- size: "small",
1825
+ size: _ctx.size,
1826
+ disabled: _ctx.disabled,
1748
1827
  onClick: _cache[0] || (_cache[0] = ($event) => addEvent())
1749
1828
  }, {
1750
1829
  default: withCtx(() => [
1751
1830
  createTextVNode("添加事件")
1752
1831
  ]),
1753
1832
  _: 1
1754
- }),
1833
+ }, 8, ["size", "disabled"]),
1755
1834
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.model[_ctx.name], (cardItem, index) => {
1756
1835
  return openBlock(), createBlock(_component_m_form_panel, {
1757
1836
  key: index,
1837
+ disabled: _ctx.disabled,
1838
+ size: _ctx.size,
1758
1839
  config: actionsConfig.value,
1759
1840
  model: cardItem,
1760
1841
  onChange: onChangeHandler
@@ -1764,17 +1845,21 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1764
1845
  class: "fullWidth",
1765
1846
  config: eventNameConfig.value,
1766
1847
  model: cardItem,
1848
+ disabled: _ctx.disabled,
1849
+ size: _ctx.size,
1767
1850
  onChange: onChangeHandler
1768
- }, null, 8, ["config", "model"]),
1851
+ }, null, 8, ["config", "model", "disabled", "size"]),
1769
1852
  createVNode(unref(TMagicButton), {
1770
1853
  style: { "color": "#f56c6c" },
1771
1854
  text: "",
1772
1855
  icon: unref(Delete),
1856
+ disabled: _ctx.disabled,
1857
+ size: _ctx.size,
1773
1858
  onClick: ($event) => removeEvent(index)
1774
- }, null, 8, ["icon", "onClick"])
1859
+ }, null, 8, ["icon", "disabled", "size", "onClick"])
1775
1860
  ]),
1776
1861
  _: 2
1777
- }, 1032, ["config", "model"]);
1862
+ }, 1032, ["disabled", "size", "config", "model"]);
1778
1863
  }), 128))
1779
1864
  ]))
1780
1865
  ]);
@@ -1792,11 +1877,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1792
1877
  props: {
1793
1878
  config: {},
1794
1879
  model: {},
1880
+ initValues: {},
1881
+ values: {},
1795
1882
  name: {},
1796
1883
  prop: {},
1797
1884
  disabled: { type: Boolean, default: false },
1798
- lastValues: {},
1799
- size: {}
1885
+ size: {},
1886
+ lastValues: {}
1800
1887
  },
1801
1888
  emits: ["change"],
1802
1889
  setup(__props, { emit }) {
@@ -1854,16 +1941,18 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1854
1941
  class: "m-fileds-key-value-delete",
1855
1942
  type: "danger",
1856
1943
  size: _ctx.size,
1944
+ disabled: _ctx.disabled,
1857
1945
  circle: "",
1858
1946
  plain: "",
1859
1947
  icon: unref(Delete),
1860
1948
  onClick: ($event) => deleteHandler(index)
1861
- }, null, 8, ["size", "icon", "onClick"])
1949
+ }, null, 8, ["size", "disabled", "icon", "onClick"])
1862
1950
  ]);
1863
1951
  }), 128)),
1864
1952
  createVNode(unref(TMagicButton), {
1865
1953
  type: "primary",
1866
1954
  size: _ctx.size,
1955
+ disabled: _ctx.disabled,
1867
1956
  plain: "",
1868
1957
  icon: unref(Plus),
1869
1958
  onClick: addHandler
@@ -1872,7 +1961,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1872
1961
  createTextVNode("添加")
1873
1962
  ]),
1874
1963
  _: 1
1875
- }, 8, ["size", "icon"])
1964
+ }, 8, ["size", "disabled", "icon"])
1876
1965
  ]);
1877
1966
  };
1878
1967
  }
@@ -1891,8 +1980,13 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1891
1980
  props: {
1892
1981
  config: {},
1893
1982
  model: {},
1983
+ initValues: {},
1984
+ values: {},
1985
+ name: {},
1894
1986
  prop: {},
1895
- name: {}
1987
+ disabled: { type: Boolean },
1988
+ size: {},
1989
+ lastValues: {}
1896
1990
  },
1897
1991
  emits: ["change"],
1898
1992
  setup(__props, { emit }) {
@@ -1957,6 +2051,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1957
2051
  createVNode(unref(TMagicButton), {
1958
2052
  type: "danger",
1959
2053
  icon: unref(Delete),
2054
+ disabled: _ctx.disabled,
2055
+ size: _ctx.size,
1960
2056
  text: "",
1961
2057
  style: { "padding": "0" }
1962
2058
  }, {
@@ -1964,7 +2060,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1964
2060
  createTextVNode("取消")
1965
2061
  ]),
1966
2062
  _: 1
1967
- }, 8, ["icon"])
2063
+ }, 8, ["icon", "disabled", "size"])
1968
2064
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$i, [
1969
2065
  val.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1970
2066
  createVNode(unref(TMagicTooltip), {
@@ -1976,9 +2072,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1976
2072
  style: { "padding": "0" },
1977
2073
  type: "danger",
1978
2074
  icon: unref(Close),
2075
+ disabled: _ctx.disabled,
2076
+ size: _ctx.size,
1979
2077
  text: "",
1980
2078
  onClick: withModifiers(deleteHandler, ["stop"])
1981
- }, null, 8, ["icon", "onClick"])
2079
+ }, null, 8, ["icon", "disabled", "size", "onClick"])
1982
2080
  ]),
1983
2081
  _: 1
1984
2082
  }),
@@ -1990,6 +2088,8 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1990
2088
  createVNode(unref(TMagicButton), {
1991
2089
  text: "",
1992
2090
  style: { "padding": "0", "margin": "0" },
2091
+ disabled: _ctx.disabled,
2092
+ size: _ctx.size,
1993
2093
  onClick: _cache[0] || (_cache[0] = ($event) => selectNode(val.value)),
1994
2094
  onMouseenter: _cache[1] || (_cache[1] = ($event) => unref(highlight)(val.value)),
1995
2095
  onMouseleave: unhightlight
@@ -1998,7 +2098,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1998
2098
  createTextVNode(toDisplayString(`${toName.value}_${val.value}`), 1)
1999
2099
  ]),
2000
2100
  _: 1
2001
- })
2101
+ }, 8, ["disabled", "size"])
2002
2102
  ]),
2003
2103
  _: 1
2004
2104
  })
@@ -2011,13 +2111,15 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2011
2111
  createVNode(unref(TMagicButton), {
2012
2112
  text: "",
2013
2113
  style: { "padding": "0", "margin": "0" },
2114
+ disabled: _ctx.disabled,
2115
+ size: _ctx.size,
2014
2116
  onClick: startSelect
2015
2117
  }, {
2016
2118
  default: withCtx(() => [
2017
2119
  createTextVNode("点击此处选择")
2018
2120
  ]),
2019
2121
  _: 1
2020
- })
2122
+ }, 8, ["disabled", "size"])
2021
2123
  ]),
2022
2124
  _: 1
2023
2125
  }))
@@ -2204,246 +2306,631 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2204
2306
  }
2205
2307
  });
2206
2308
 
2207
- const fillConfig$1 = (config = []) => [
2309
+ const BaseFormConfig = [
2208
2310
  {
2209
- type: "tab",
2311
+ name: "id",
2312
+ type: "hidden"
2313
+ },
2314
+ {
2315
+ name: "type",
2316
+ text: "类型",
2317
+ type: "select",
2318
+ options: [
2319
+ { text: "基础", value: "base" },
2320
+ { text: "HTTP", value: "http" }
2321
+ ],
2322
+ defaultValue: "base"
2323
+ },
2324
+ {
2325
+ name: "title",
2326
+ text: "名称",
2327
+ rules: [
2328
+ {
2329
+ required: true,
2330
+ message: "请输入名称"
2331
+ }
2332
+ ]
2333
+ },
2334
+ {
2335
+ name: "description",
2336
+ text: "描述"
2337
+ }
2338
+ ];
2339
+
2340
+ const HttpFormConfig = [
2341
+ {
2342
+ name: "autoFetch",
2343
+ text: "自动请求",
2344
+ type: "switch",
2345
+ defaultValue: true
2346
+ },
2347
+ {
2348
+ type: "fieldset",
2349
+ name: "options",
2350
+ legend: "HTTP 配置",
2210
2351
  items: [
2211
2352
  {
2212
- title: "属性",
2213
- labelWidth: "80px",
2214
- items: [
2215
- // 组件类型,必须要有
2216
- {
2217
- text: "type",
2218
- name: "type",
2219
- type: "hidden"
2220
- },
2221
- // 组件id,必须要有
2222
- {
2223
- name: "id",
2224
- type: "display",
2225
- text: "id"
2226
- },
2227
- {
2228
- name: "name",
2229
- text: "组件名称"
2230
- },
2231
- ...config
2232
- ]
2353
+ name: "url",
2354
+ text: "URL"
2233
2355
  },
2234
2356
  {
2235
- title: "样式",
2236
- labelWidth: "80px",
2237
- items: [
2238
- {
2239
- name: "style",
2240
- items: [
2241
- {
2242
- type: "fieldset",
2243
- legend: "位置",
2244
- items: [
2245
- {
2246
- name: "position",
2247
- type: "checkbox",
2248
- activeValue: "fixed",
2249
- inactiveValue: "absolute",
2250
- defaultValue: "absolute",
2251
- text: "固定定位"
2252
- },
2253
- {
2254
- name: "left",
2255
- text: "left"
2256
- },
2257
- {
2258
- name: "top",
2259
- text: "top",
2260
- disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
2261
- },
2262
- {
2263
- name: "right",
2264
- text: "right"
2265
- },
2266
- {
2267
- name: "bottom",
2268
- text: "bottom",
2269
- disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
2270
- }
2271
- ]
2272
- },
2273
- {
2274
- type: "fieldset",
2275
- legend: "盒子",
2276
- items: [
2277
- {
2278
- name: "width",
2279
- text: "宽度"
2280
- },
2281
- {
2282
- name: "height",
2283
- text: "高度"
2284
- }
2285
- ]
2286
- },
2287
- {
2288
- type: "fieldset",
2289
- legend: "边框",
2290
- items: [
2291
- {
2292
- name: "borderWidth",
2293
- text: "宽度",
2294
- defaultValue: "0"
2295
- },
2296
- {
2297
- name: "borderColor",
2298
- text: "颜色",
2299
- type: "colorPicker"
2300
- },
2301
- {
2302
- name: "borderStyle",
2303
- text: "样式",
2304
- type: "select",
2305
- defaultValue: "none",
2306
- options: [
2307
- { text: "none", value: "none" },
2308
- { text: "hidden", value: "hidden" },
2309
- { text: "dotted", value: "dotted" },
2310
- { text: "dashed", value: "dashed" },
2311
- { text: "solid", value: "solid" },
2312
- { text: "double", value: "double" },
2313
- { text: "groove", value: "groove" },
2314
- { text: "ridge", value: "ridge" },
2315
- { text: "inset", value: "inset" },
2316
- { text: "outset", value: "outset" }
2317
- ]
2318
- }
2319
- ]
2320
- },
2321
- {
2322
- type: "fieldset",
2323
- legend: "背景",
2324
- items: [
2325
- {
2326
- name: "backgroundImage",
2327
- text: "背景图"
2328
- },
2329
- {
2330
- name: "backgroundColor",
2331
- text: "背景颜色",
2332
- type: "colorPicker"
2333
- },
2334
- {
2335
- name: "backgroundRepeat",
2336
- text: "背景图重复",
2337
- type: "select",
2338
- defaultValue: "no-repeat",
2339
- options: [
2340
- { text: "repeat", value: "repeat" },
2341
- { text: "repeat-x", value: "repeat-x" },
2342
- { text: "repeat-y", value: "repeat-y" },
2343
- { text: "no-repeat", value: "no-repeat" },
2344
- { text: "inherit", value: "inherit" }
2345
- ]
2346
- },
2347
- {
2348
- name: "backgroundSize",
2349
- text: "背景图大小",
2350
- defaultValue: "100% 100%"
2351
- }
2352
- ]
2353
- },
2354
- {
2355
- type: "fieldset",
2356
- legend: "字体",
2357
- items: [
2358
- {
2359
- name: "color",
2360
- text: "颜色",
2361
- type: "colorPicker"
2362
- },
2363
- {
2364
- name: "fontSize",
2365
- text: "大小"
2366
- },
2367
- {
2368
- name: "fontWeight",
2369
- text: "粗细"
2370
- }
2371
- ]
2372
- },
2373
- {
2374
- type: "fieldset",
2375
- legend: "变形",
2376
- name: "transform",
2377
- items: [
2378
- {
2379
- name: "rotate",
2380
- text: "旋转角度"
2381
- },
2382
- {
2383
- name: "scale",
2384
- text: "缩放"
2385
- }
2386
- ]
2387
- }
2388
- ]
2389
- }
2357
+ name: "method",
2358
+ text: "Method",
2359
+ type: "select",
2360
+ options: [
2361
+ { text: "GET", value: "GET" },
2362
+ { text: "POST", value: "POST" },
2363
+ { text: "PUT", value: "PUT" },
2364
+ { text: "DELETE", value: "DELETE" }
2390
2365
  ]
2391
2366
  },
2392
2367
  {
2393
- title: "事件",
2394
- items: [
2395
- {
2396
- name: "events",
2397
- type: "event-select",
2398
- labelWidth: 0
2399
- }
2400
- ]
2368
+ name: "params",
2369
+ type: "key-value",
2370
+ defaultValue: {},
2371
+ text: "参数"
2401
2372
  },
2402
2373
  {
2403
- title: "高级",
2404
- lazy: true,
2405
- items: [
2406
- {
2407
- name: "created",
2408
- text: "created",
2409
- labelWidth: "100px",
2410
- type: "code-select"
2411
- },
2412
- {
2413
- name: "mounted",
2414
- text: "mounted",
2415
- labelWidth: "100px",
2416
- type: "code-select"
2417
- }
2418
- ]
2374
+ name: "data",
2375
+ type: "key-value",
2376
+ defaultValue: {},
2377
+ text: "请求体"
2378
+ },
2379
+ {
2380
+ name: "headers",
2381
+ type: "key-value",
2382
+ defaultValue: {},
2383
+ text: "请求头"
2419
2384
  }
2420
2385
  ]
2421
2386
  }
2422
2387
  ];
2423
2388
 
2424
- const log = (...args) => {
2425
- if (process.env.NODE_ENV === "development") {
2426
- console.log("magic editor: ", ...args);
2427
- }
2428
- };
2429
- const info = (...args) => {
2430
- if (process.env.NODE_ENV === "development") {
2431
- console.info("magic editor: ", ...args);
2432
- }
2433
- };
2434
- const warn = (...args) => {
2435
- if (process.env.NODE_ENV === "development") {
2436
- console.warn("magic editor: ", ...args);
2437
- }
2438
- };
2439
- const debug = (...args) => {
2440
- if (process.env.NODE_ENV === "development") {
2441
- console.debug("magic editor: ", ...args);
2442
- }
2443
- };
2444
- const error = (...args) => {
2445
- if (process.env.NODE_ENV === "development") {
2446
- console.error("magic editor: ", ...args);
2389
+ const fillConfig$1 = (config) => [
2390
+ ...BaseFormConfig,
2391
+ ...config,
2392
+ {
2393
+ type: "panel",
2394
+ title: "数据定义",
2395
+ items: [
2396
+ {
2397
+ name: "fields",
2398
+ type: "data-source-fields",
2399
+ defaultValue: []
2400
+ }
2401
+ ]
2402
+ },
2403
+ {
2404
+ type: "panel",
2405
+ title: "方法定义",
2406
+ items: [
2407
+ {
2408
+ name: "methods",
2409
+ type: "data-source-methods",
2410
+ defaultValue: []
2411
+ }
2412
+ ]
2413
+ }
2414
+ ];
2415
+ const getFormConfig = (type, configs) => {
2416
+ switch (type) {
2417
+ case "base":
2418
+ return fillConfig$1([]);
2419
+ case "http":
2420
+ return fillConfig$1(HttpFormConfig);
2421
+ default:
2422
+ return fillConfig$1(configs[type] || []);
2423
+ }
2424
+ };
2425
+
2426
+ const compose = (middleware) => {
2427
+ if (!Array.isArray(middleware))
2428
+ throw new TypeError("Middleware 必须是一个数组!");
2429
+ for (const fn of middleware) {
2430
+ if (typeof fn !== "function")
2431
+ throw new TypeError("Middleware 必须由函数组成!");
2432
+ }
2433
+ return (args, next) => {
2434
+ let index = -1;
2435
+ return dispatch(0);
2436
+ function dispatch(i) {
2437
+ if (i <= index)
2438
+ return Promise.reject(new Error("next() 被多次调用"));
2439
+ index = i;
2440
+ let fn = middleware[i];
2441
+ if (i === middleware.length && next)
2442
+ fn = next;
2443
+ if (!fn)
2444
+ return Promise.resolve();
2445
+ try {
2446
+ return Promise.resolve(fn(...args, dispatch.bind(null, i + 1)));
2447
+ } catch (err) {
2448
+ return Promise.reject(err);
2449
+ }
2450
+ }
2451
+ };
2452
+ };
2453
+
2454
+ const methodName = (prefix, name) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;
2455
+ const isError = (error) => Object.prototype.toString.call(error) === "[object Error]";
2456
+ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethodName, fn) => {
2457
+ try {
2458
+ let beforeArgs = args;
2459
+ for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
2460
+ beforeArgs = await beforeMethod(...beforeArgs) || [];
2461
+ if (isError(beforeArgs))
2462
+ throw beforeArgs;
2463
+ if (!Array.isArray(beforeArgs)) {
2464
+ beforeArgs = [beforeArgs];
2465
+ }
2466
+ }
2467
+ let returnValue = await fn(beforeArgs, sourceMethod.bind(scope));
2468
+ for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
2469
+ returnValue = await afterMethod(returnValue, ...beforeArgs);
2470
+ if (isError(returnValue))
2471
+ throw returnValue;
2472
+ }
2473
+ return returnValue;
2474
+ } catch (error) {
2475
+ throw error;
2476
+ }
2477
+ };
2478
+ class BaseService extends EventEmitter {
2479
+ pluginOptionsList = {};
2480
+ middleware = {};
2481
+ taskList = [];
2482
+ doingTask = false;
2483
+ constructor(methods = [], serialMethods = []) {
2484
+ super();
2485
+ methods.forEach((propertyName) => {
2486
+ const scope = this;
2487
+ const sourceMethod = scope[propertyName];
2488
+ const beforeMethodName = methodName("before", propertyName);
2489
+ const afterMethodName = methodName("after", propertyName);
2490
+ this.pluginOptionsList[beforeMethodName] = [];
2491
+ this.pluginOptionsList[afterMethodName] = [];
2492
+ this.middleware[propertyName] = [];
2493
+ const fn = compose(this.middleware[propertyName]);
2494
+ Object.defineProperty(scope, propertyName, {
2495
+ value: async (...args) => {
2496
+ if (!serialMethods.includes(propertyName)) {
2497
+ return doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
2498
+ }
2499
+ const promise = new Promise((resolve, reject) => {
2500
+ this.taskList.push(async () => {
2501
+ try {
2502
+ const value = await doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
2503
+ resolve(value);
2504
+ } catch (e) {
2505
+ reject(e);
2506
+ }
2507
+ });
2508
+ });
2509
+ if (!this.doingTask) {
2510
+ this.doTask();
2511
+ }
2512
+ return promise;
2513
+ }
2514
+ });
2515
+ });
2516
+ }
2517
+ use(options) {
2518
+ Object.entries(options).forEach(([methodName2, method]) => {
2519
+ if (typeof method === "function")
2520
+ this.middleware[methodName2].push(method);
2521
+ });
2522
+ }
2523
+ usePlugin(options) {
2524
+ Object.entries(options).forEach(([methodName2, method]) => {
2525
+ if (typeof method === "function")
2526
+ this.pluginOptionsList[methodName2].push(method);
2527
+ });
2528
+ }
2529
+ removeAllPlugins() {
2530
+ Object.keys(this.pluginOptionsList).forEach((key) => {
2531
+ this.pluginOptionsList[key] = [];
2532
+ });
2533
+ Object.keys(this.middleware).forEach((key) => {
2534
+ this.middleware[key] = [];
2535
+ });
2536
+ }
2537
+ async doTask() {
2538
+ this.doingTask = true;
2539
+ let task = this.taskList.shift();
2540
+ while (task) {
2541
+ await task();
2542
+ task = this.taskList.shift();
2543
+ }
2544
+ this.doingTask = false;
2545
+ }
2546
+ }
2547
+
2548
+ class DataSource extends BaseService {
2549
+ state = reactive({
2550
+ dataSources: [],
2551
+ editable: true,
2552
+ configs: {}
2553
+ });
2554
+ set(name, value) {
2555
+ this.state[name] = value;
2556
+ }
2557
+ get(name) {
2558
+ return this.state[name];
2559
+ }
2560
+ getFormConfig(type = "base") {
2561
+ return getFormConfig(type, this.get("configs"));
2562
+ }
2563
+ setFormConfig(type, config) {
2564
+ this.get("configs")[type] = config;
2565
+ }
2566
+ add(config) {
2567
+ const newConfig = {
2568
+ ...config,
2569
+ id: this.createId()
2570
+ };
2571
+ this.get("dataSources").push(newConfig);
2572
+ this.emit("add", newConfig);
2573
+ }
2574
+ update(config) {
2575
+ const dataSources = this.get("dataSources");
2576
+ const index = dataSources.findIndex((ds) => ds.id === config.id);
2577
+ dataSources[index] = cloneDeep(config);
2578
+ this.emit("update", config);
2579
+ }
2580
+ remove(id) {
2581
+ const dataSources = this.get("dataSources");
2582
+ const index = dataSources.findIndex((ds) => ds.id === id);
2583
+ dataSources.splice(index, 1);
2584
+ this.emit("remove", id);
2585
+ }
2586
+ getDataSourceById(id) {
2587
+ return this.get("dataSources").find((ds) => ds.id === id);
2588
+ }
2589
+ resetState() {
2590
+ this.set("dataSources", []);
2591
+ }
2592
+ destroy() {
2593
+ this.removeAllListeners();
2594
+ this.resetState();
2595
+ this.removeAllPlugins();
2596
+ }
2597
+ createId() {
2598
+ return `ds_${guid()}`;
2599
+ }
2600
+ }
2601
+ const dataSourceService = new DataSource();
2602
+
2603
+ const arrayOptions = [
2604
+ { text: "包含", value: "include" },
2605
+ { text: "不包含", value: "not_include" }
2606
+ ];
2607
+ const eqOptions = [
2608
+ { text: "等于", value: "=" },
2609
+ { text: "不等于", value: "!=" }
2610
+ ];
2611
+ const numberOptions = [
2612
+ { text: "大于", value: ">" },
2613
+ { text: "大于等于", value: ">=" },
2614
+ { text: "小于", value: "<" },
2615
+ { text: "小于等于", value: "<=" },
2616
+ { text: "在范围内", value: "between" },
2617
+ { text: "不在范围内", value: "not_between" }
2618
+ ];
2619
+ const styleTabConfig = {
2620
+ title: "样式",
2621
+ labelWidth: "80px",
2622
+ items: [
2623
+ {
2624
+ name: "style",
2625
+ items: [
2626
+ {
2627
+ type: "fieldset",
2628
+ legend: "位置",
2629
+ items: [
2630
+ {
2631
+ name: "position",
2632
+ type: "checkbox",
2633
+ activeValue: "fixed",
2634
+ inactiveValue: "absolute",
2635
+ defaultValue: "absolute",
2636
+ text: "固定定位"
2637
+ },
2638
+ {
2639
+ name: "left",
2640
+ text: "left"
2641
+ },
2642
+ {
2643
+ name: "top",
2644
+ text: "top",
2645
+ disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedBottom"
2646
+ },
2647
+ {
2648
+ name: "right",
2649
+ text: "right"
2650
+ },
2651
+ {
2652
+ name: "bottom",
2653
+ text: "bottom",
2654
+ disabled: (vm, { model }) => model.position === "fixed" && model._magic_position === "fixedTop"
2655
+ }
2656
+ ]
2657
+ },
2658
+ {
2659
+ type: "fieldset",
2660
+ legend: "盒子",
2661
+ items: [
2662
+ {
2663
+ name: "width",
2664
+ text: "宽度"
2665
+ },
2666
+ {
2667
+ name: "height",
2668
+ text: "高度"
2669
+ }
2670
+ ]
2671
+ },
2672
+ {
2673
+ type: "fieldset",
2674
+ legend: "边框",
2675
+ items: [
2676
+ {
2677
+ name: "borderWidth",
2678
+ text: "宽度",
2679
+ defaultValue: "0"
2680
+ },
2681
+ {
2682
+ name: "borderColor",
2683
+ text: "颜色",
2684
+ type: "colorPicker"
2685
+ },
2686
+ {
2687
+ name: "borderStyle",
2688
+ text: "样式",
2689
+ type: "select",
2690
+ defaultValue: "none",
2691
+ options: [
2692
+ { text: "none", value: "none" },
2693
+ { text: "hidden", value: "hidden" },
2694
+ { text: "dotted", value: "dotted" },
2695
+ { text: "dashed", value: "dashed" },
2696
+ { text: "solid", value: "solid" },
2697
+ { text: "double", value: "double" },
2698
+ { text: "groove", value: "groove" },
2699
+ { text: "ridge", value: "ridge" },
2700
+ { text: "inset", value: "inset" },
2701
+ { text: "outset", value: "outset" }
2702
+ ]
2703
+ }
2704
+ ]
2705
+ },
2706
+ {
2707
+ type: "fieldset",
2708
+ legend: "背景",
2709
+ items: [
2710
+ {
2711
+ name: "backgroundImage",
2712
+ text: "背景图"
2713
+ },
2714
+ {
2715
+ name: "backgroundColor",
2716
+ text: "背景颜色",
2717
+ type: "colorPicker"
2718
+ },
2719
+ {
2720
+ name: "backgroundRepeat",
2721
+ text: "背景图重复",
2722
+ type: "select",
2723
+ defaultValue: "no-repeat",
2724
+ options: [
2725
+ { text: "repeat", value: "repeat" },
2726
+ { text: "repeat-x", value: "repeat-x" },
2727
+ { text: "repeat-y", value: "repeat-y" },
2728
+ { text: "no-repeat", value: "no-repeat" },
2729
+ { text: "inherit", value: "inherit" }
2730
+ ]
2731
+ },
2732
+ {
2733
+ name: "backgroundSize",
2734
+ text: "背景图大小",
2735
+ defaultValue: "100% 100%"
2736
+ }
2737
+ ]
2738
+ },
2739
+ {
2740
+ type: "fieldset",
2741
+ legend: "字体",
2742
+ items: [
2743
+ {
2744
+ name: "color",
2745
+ text: "颜色",
2746
+ type: "colorPicker"
2747
+ },
2748
+ {
2749
+ name: "fontSize",
2750
+ text: "大小"
2751
+ },
2752
+ {
2753
+ name: "fontWeight",
2754
+ text: "粗细"
2755
+ }
2756
+ ]
2757
+ },
2758
+ {
2759
+ type: "fieldset",
2760
+ legend: "变形",
2761
+ name: "transform",
2762
+ items: [
2763
+ {
2764
+ name: "rotate",
2765
+ text: "旋转角度"
2766
+ },
2767
+ {
2768
+ name: "scale",
2769
+ text: "缩放"
2770
+ }
2771
+ ]
2772
+ }
2773
+ ]
2774
+ }
2775
+ ]
2776
+ };
2777
+ const eventTabConfig = {
2778
+ title: "事件",
2779
+ items: [
2780
+ {
2781
+ name: "events",
2782
+ type: "event-select"
2783
+ }
2784
+ ]
2785
+ };
2786
+ const advancedTabConfig = {
2787
+ title: "高级",
2788
+ lazy: true,
2789
+ items: [
2790
+ {
2791
+ name: "created",
2792
+ text: "created",
2793
+ labelWidth: "100px",
2794
+ type: "code-select"
2795
+ },
2796
+ {
2797
+ name: "mounted",
2798
+ text: "mounted",
2799
+ labelWidth: "100px",
2800
+ type: "code-select"
2801
+ }
2802
+ ]
2803
+ };
2804
+ const displayTabConfig = {
2805
+ title: "显示条件",
2806
+ display: (vm, { model }) => model.type !== "page",
2807
+ items: [
2808
+ {
2809
+ type: "groupList",
2810
+ name: "displayConds",
2811
+ items: [
2812
+ {
2813
+ type: "table",
2814
+ name: "cond",
2815
+ items: [
2816
+ {
2817
+ type: "data-source-field-select",
2818
+ name: "field",
2819
+ label: "字段"
2820
+ },
2821
+ {
2822
+ type: "select",
2823
+ options: (mForm, { model }) => {
2824
+ const [id, field] = model.field;
2825
+ const ds = dataSourceService.getDataSourceById(id);
2826
+ const type = ds?.fields.find((f) => f.name === field)?.type;
2827
+ if (type === "array") {
2828
+ return arrayOptions;
2829
+ }
2830
+ if (type === "boolean") {
2831
+ return [
2832
+ { text: "是", value: "is" },
2833
+ { text: "不是", value: "not" }
2834
+ ];
2835
+ }
2836
+ if (type === "number") {
2837
+ return [...eqOptions, ...numberOptions];
2838
+ }
2839
+ if (type === "string") {
2840
+ return [...arrayOptions, ...eqOptions];
2841
+ }
2842
+ return [...arrayOptions, ...eqOptions, ...numberOptions];
2843
+ },
2844
+ label: "条件",
2845
+ name: "op"
2846
+ },
2847
+ {
2848
+ label: "值",
2849
+ items: [
2850
+ {
2851
+ name: "value",
2852
+ display: (vm, { model }) => !["between", "not_between", "is", "not"].includes(model.op)
2853
+ },
2854
+ {
2855
+ name: "value",
2856
+ type: "select",
2857
+ options: [
2858
+ { text: "true", value: true },
2859
+ { text: "false", value: false }
2860
+ ],
2861
+ display: (vm, { model }) => ["is", "not"].includes(model.op)
2862
+ },
2863
+ {
2864
+ name: "range",
2865
+ type: "number-range",
2866
+ display: (vm, { model }) => ["between", "not_between"].includes(model.op) && !["is", "not"].includes(model.op)
2867
+ }
2868
+ ]
2869
+ }
2870
+ ]
2871
+ }
2872
+ ]
2873
+ }
2874
+ ]
2875
+ };
2876
+ const fillConfig = (config = []) => [
2877
+ {
2878
+ type: "tab",
2879
+ items: [
2880
+ {
2881
+ title: "属性",
2882
+ labelWidth: "80px",
2883
+ items: [
2884
+ // 组件类型,必须要有
2885
+ {
2886
+ text: "type",
2887
+ name: "type",
2888
+ type: "hidden"
2889
+ },
2890
+ // 组件id,必须要有
2891
+ {
2892
+ name: "id",
2893
+ type: "display",
2894
+ text: "id"
2895
+ },
2896
+ {
2897
+ name: "name",
2898
+ text: "组件名称"
2899
+ },
2900
+ ...config
2901
+ ]
2902
+ },
2903
+ { ...styleTabConfig },
2904
+ { ...eventTabConfig },
2905
+ { ...advancedTabConfig },
2906
+ { ...displayTabConfig }
2907
+ ]
2908
+ }
2909
+ ];
2910
+
2911
+ const log = (...args) => {
2912
+ if (process.env.NODE_ENV === "development") {
2913
+ console.log("magic editor: ", ...args);
2914
+ }
2915
+ };
2916
+ const info = (...args) => {
2917
+ if (process.env.NODE_ENV === "development") {
2918
+ console.info("magic editor: ", ...args);
2919
+ }
2920
+ };
2921
+ const warn = (...args) => {
2922
+ if (process.env.NODE_ENV === "development") {
2923
+ console.warn("magic editor: ", ...args);
2924
+ }
2925
+ };
2926
+ const debug = (...args) => {
2927
+ if (process.env.NODE_ENV === "development") {
2928
+ console.debug("magic editor: ", ...args);
2929
+ }
2930
+ };
2931
+ const error = (...args) => {
2932
+ if (process.env.NODE_ENV === "development") {
2933
+ console.error("magic editor: ", ...args);
2447
2934
  }
2448
2935
  };
2449
2936
 
@@ -2499,6 +2986,14 @@ var KeyBindingCommand = /* @__PURE__ */ ((KeyBindingCommand2) => {
2499
2986
  KeyBindingCommand2["SWITCH_NODE"] = "tmagic-system-switch-node";
2500
2987
  return KeyBindingCommand2;
2501
2988
  })(KeyBindingCommand || {});
2989
+ var DepTargetType = /* @__PURE__ */ ((DepTargetType2) => {
2990
+ DepTargetType2["DEFAULT"] = "default";
2991
+ DepTargetType2["CODE_BLOCK"] = "code-block";
2992
+ DepTargetType2["DATA_SOURCE"] = "data-source";
2993
+ DepTargetType2["DATA_SOURCE_METHOD"] = "data-source-method";
2994
+ DepTargetType2["DATA_SOURCE_COND"] = "data-source-cond";
2995
+ return DepTargetType2;
2996
+ })(DepTargetType || {});
2502
2997
 
2503
2998
  const COPY_STORAGE_KEY = "$MagicEditorCopyData";
2504
2999
  const getPageList = (app) => {
@@ -2675,158 +3170,36 @@ class UndoRedo {
2675
3170
  this.listCursor += 1;
2676
3171
  if (this.elementList.length > this.listMaxSize) {
2677
3172
  this.elementList.shift();
2678
- this.listCursor -= 1;
2679
- }
2680
- }
2681
- canUndo() {
2682
- return this.listCursor > 1;
2683
- }
2684
- // 返回undo后的当前元素
2685
- undo() {
2686
- if (!this.canUndo()) {
2687
- return null;
2688
- }
2689
- this.listCursor -= 1;
2690
- return this.getCurrentElement();
2691
- }
2692
- canRedo() {
2693
- return this.elementList.length > this.listCursor;
2694
- }
2695
- // 返回redo后的当前元素
2696
- redo() {
2697
- if (!this.canRedo()) {
2698
- return null;
2699
- }
2700
- this.listCursor += 1;
2701
- return this.getCurrentElement();
2702
- }
2703
- getCurrentElement() {
2704
- if (this.listCursor < 1) {
2705
- return null;
2706
- }
2707
- return cloneDeep(this.elementList[this.listCursor - 1]);
2708
- }
2709
- }
2710
-
2711
- const compose = (middleware) => {
2712
- if (!Array.isArray(middleware))
2713
- throw new TypeError("Middleware 必须是一个数组!");
2714
- for (const fn of middleware) {
2715
- if (typeof fn !== "function")
2716
- throw new TypeError("Middleware 必须由函数组成!");
2717
- }
2718
- return (args, next) => {
2719
- let index = -1;
2720
- return dispatch(0);
2721
- function dispatch(i) {
2722
- if (i <= index)
2723
- return Promise.reject(new Error("next() 被多次调用"));
2724
- index = i;
2725
- let fn = middleware[i];
2726
- if (i === middleware.length && next)
2727
- fn = next;
2728
- if (!fn)
2729
- return Promise.resolve();
2730
- try {
2731
- return Promise.resolve(fn(...args, dispatch.bind(null, i + 1)));
2732
- } catch (err) {
2733
- return Promise.reject(err);
2734
- }
2735
- }
2736
- };
2737
- };
2738
-
2739
- const methodName = (prefix, name) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;
2740
- const isError = (error) => Object.prototype.toString.call(error) === "[object Error]";
2741
- const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethodName, fn) => {
2742
- try {
2743
- let beforeArgs = args;
2744
- for (const beforeMethod of scope.pluginOptionsList[beforeMethodName]) {
2745
- beforeArgs = await beforeMethod(...beforeArgs) || [];
2746
- if (isError(beforeArgs))
2747
- throw beforeArgs;
2748
- if (!Array.isArray(beforeArgs)) {
2749
- beforeArgs = [beforeArgs];
2750
- }
2751
- }
2752
- let returnValue = await fn(beforeArgs, sourceMethod.bind(scope));
2753
- for (const afterMethod of scope.pluginOptionsList[afterMethodName]) {
2754
- returnValue = await afterMethod(returnValue, ...beforeArgs);
2755
- if (isError(returnValue))
2756
- throw returnValue;
2757
- }
2758
- return returnValue;
2759
- } catch (error) {
2760
- throw error;
2761
- }
2762
- };
2763
- class BaseService extends EventEmitter {
2764
- pluginOptionsList = {};
2765
- middleware = {};
2766
- taskList = [];
2767
- doingTask = false;
2768
- constructor(methods = [], serialMethods = []) {
2769
- super();
2770
- methods.forEach((propertyName) => {
2771
- const scope = this;
2772
- const sourceMethod = scope[propertyName];
2773
- const beforeMethodName = methodName("before", propertyName);
2774
- const afterMethodName = methodName("after", propertyName);
2775
- this.pluginOptionsList[beforeMethodName] = [];
2776
- this.pluginOptionsList[afterMethodName] = [];
2777
- this.middleware[propertyName] = [];
2778
- const fn = compose(this.middleware[propertyName]);
2779
- Object.defineProperty(scope, propertyName, {
2780
- value: async (...args) => {
2781
- if (!serialMethods.includes(propertyName)) {
2782
- return doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
2783
- }
2784
- const promise = new Promise((resolve, reject) => {
2785
- this.taskList.push(async () => {
2786
- try {
2787
- const value = await doAction(args, scope, sourceMethod, beforeMethodName, afterMethodName, fn);
2788
- resolve(value);
2789
- } catch (e) {
2790
- reject(e);
2791
- }
2792
- });
2793
- });
2794
- if (!this.doingTask) {
2795
- this.doTask();
2796
- }
2797
- return promise;
2798
- }
2799
- });
2800
- });
3173
+ this.listCursor -= 1;
3174
+ }
2801
3175
  }
2802
- use(options) {
2803
- Object.entries(options).forEach(([methodName2, method]) => {
2804
- if (typeof method === "function")
2805
- this.middleware[methodName2].push(method);
2806
- });
3176
+ canUndo() {
3177
+ return this.listCursor > 1;
2807
3178
  }
2808
- usePlugin(options) {
2809
- Object.entries(options).forEach(([methodName2, method]) => {
2810
- if (typeof method === "function")
2811
- this.pluginOptionsList[methodName2].push(method);
2812
- });
3179
+ // 返回undo后的当前元素
3180
+ undo() {
3181
+ if (!this.canUndo()) {
3182
+ return null;
3183
+ }
3184
+ this.listCursor -= 1;
3185
+ return this.getCurrentElement();
2813
3186
  }
2814
- removeAllPlugins() {
2815
- Object.keys(this.pluginOptionsList).forEach((key) => {
2816
- this.pluginOptionsList[key] = [];
2817
- });
2818
- Object.keys(this.middleware).forEach((key) => {
2819
- this.middleware[key] = [];
2820
- });
3187
+ canRedo() {
3188
+ return this.elementList.length > this.listCursor;
2821
3189
  }
2822
- async doTask() {
2823
- this.doingTask = true;
2824
- let task = this.taskList.shift();
2825
- while (task) {
2826
- await task();
2827
- task = this.taskList.shift();
3190
+ // 返回redo后的当前元素
3191
+ redo() {
3192
+ if (!this.canRedo()) {
3193
+ return null;
2828
3194
  }
2829
- this.doingTask = false;
3195
+ this.listCursor += 1;
3196
+ return this.getCurrentElement();
3197
+ }
3198
+ getCurrentElement() {
3199
+ if (this.listCursor < 1) {
3200
+ return null;
3201
+ }
3202
+ return cloneDeep(this.elementList[this.listCursor - 1]);
2830
3203
  }
2831
3204
  }
2832
3205
 
@@ -3047,7 +3420,7 @@ class Props extends BaseService {
3047
3420
  this.emit("props-configs-change");
3048
3421
  }
3049
3422
  async fillConfig(config) {
3050
- return fillConfig$1(config);
3423
+ return fillConfig(config);
3051
3424
  }
3052
3425
  /**
3053
3426
  * 为指定类型组件设置组件属性表单配置
@@ -4085,11 +4458,8 @@ const useStage = (stageOptions) => {
4085
4458
  editorService.sort(ev.src, ev.dist);
4086
4459
  });
4087
4460
  stage.on("remove", (ev) => {
4088
- editorService.remove(
4089
- ev.data.map(({ el }) => ({
4090
- id: el.id
4091
- }))
4092
- );
4461
+ const nodes = ev.data.map(({ el }) => editorService.getNodeById(el.id));
4462
+ editorService.remove(nodes.filter((node) => Boolean(node)));
4093
4463
  });
4094
4464
  stage.on("select-parent", () => {
4095
4465
  const parent = editorService.get("parent");
@@ -4144,7 +4514,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
4144
4514
  onClick: clickHandler
4145
4515
  }, [
4146
4516
  createElementVNode("div", null, [
4147
- createVNode(_sfc_main$E, { icon: unref(Plus) }, null, 8, ["icon"])
4517
+ createVNode(_sfc_main$F, { icon: unref(Plus) }, null, 8, ["icon"])
4148
4518
  ]),
4149
4519
  _hoisted_3$4
4150
4520
  ])
@@ -4235,7 +4605,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
4235
4605
  renderSlot(_ctx.$slots, "nav"),
4236
4606
  renderSlot(_ctx.$slots, "content-before"),
4237
4607
  showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
4238
- createVNode(_sfc_main$K, {
4608
+ createVNode(_sfc_main$L, {
4239
4609
  class: "m-editor-content",
4240
4610
  "init-values": root.value,
4241
4611
  options: unref(codeOptions),
@@ -4383,7 +4753,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
4383
4753
  disabled: disabled.value
4384
4754
  }, {
4385
4755
  default: withCtx(() => [
4386
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$E, {
4756
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$F, {
4387
4757
  key: 0,
4388
4758
  icon: _ctx.data.icon
4389
4759
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -4400,7 +4770,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
4400
4770
  disabled: disabled.value
4401
4771
  }, {
4402
4772
  default: withCtx(() => [
4403
- _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$E, {
4773
+ _ctx.data.icon ? (openBlock(), createBlock(_sfc_main$F, {
4404
4774
  key: 0,
4405
4775
  icon: _ctx.data.icon
4406
4776
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -4800,7 +5170,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4800
5170
  const props = __props;
4801
5171
  const { codeBlockService, depService, editorService } = inject("services") || {};
4802
5172
  const codeList = computed(
4803
- () => Object.values(depService?.targets["code-block"] || {}).map((target) => {
5173
+ () => Object.values(depService?.getTargets(DepTargetType.CODE_BLOCK) || {}).map((target) => {
4804
5174
  const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
4805
5175
  name: dep.name,
4806
5176
  type: "node",
@@ -4907,7 +5277,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4907
5277
  placement: "bottom"
4908
5278
  }, {
4909
5279
  default: withCtx(() => [
4910
- createVNode(_sfc_main$E, {
5280
+ createVNode(_sfc_main$F, {
4911
5281
  icon: editable.value ? unref(Edit) : unref(View),
4912
5282
  class: "edit-icon",
4913
5283
  onClick: withModifiers(($event) => editCode(data.id), ["stop"])
@@ -4922,7 +5292,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4922
5292
  placement: "bottom"
4923
5293
  }, {
4924
5294
  default: withCtx(() => [
4925
- createVNode(_sfc_main$E, {
5295
+ createVNode(_sfc_main$F, {
4926
5296
  icon: unref(Close),
4927
5297
  class: "edit-icon",
4928
5298
  onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -4996,7 +5366,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4996
5366
  ]),
4997
5367
  _: 3
4998
5368
  }, 8, ["custom-error", "onEdit", "onRemove"]),
4999
- unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$G, {
5369
+ unref(codeConfig) ? (openBlock(), createBlock(_sfc_main$H, {
5000
5370
  key: 0,
5001
5371
  ref_key: "codeBlockEditor",
5002
5372
  ref: codeBlockEditor,
@@ -5060,6 +5430,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
5060
5430
  ref_key: "fomDrawer",
5061
5431
  ref: fomDrawer,
5062
5432
  "label-width": "80px",
5433
+ "close-on-press-escape": false,
5063
5434
  title: _ctx.title,
5064
5435
  width: size.value,
5065
5436
  config: dataSourceConfig.value,
@@ -5088,18 +5459,43 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
5088
5459
  setup(__props, { expose: __expose, emit }) {
5089
5460
  const { depService, editorService, dataSourceService } = inject("services") || {};
5090
5461
  const editable = computed(() => dataSourceService?.get("editable") ?? true);
5462
+ const dataSources = computed(() => dataSourceService?.get("dataSources") || []);
5463
+ const dsDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE) || {});
5464
+ const dsMethodDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE_METHOD) || {});
5465
+ const dsCondDep = computed(() => depService?.getTargets(DepTargetType.DATA_SOURCE_COND) || {});
5466
+ const getKeyTreeConfig = (dep, type) => dep.keys.map((key) => ({ name: key, id: key, type: "key", isMethod: type === "method", isCond: type === "cond" }));
5467
+ const getNodeTreeConfig = (id, dep, type) => ({
5468
+ name: dep.name,
5469
+ type: "node",
5470
+ id,
5471
+ children: getKeyTreeConfig(dep, type)
5472
+ });
5091
5473
  const list = computed(
5092
- () => Object.values(depService?.targets["data-source"] || {}).map((target) => ({
5093
- id: target.id,
5094
- name: target.name,
5095
- type: "code",
5096
- children: Object.entries(target.deps).map(([id, dep]) => ({
5097
- name: dep.name,
5098
- type: "node",
5099
- id,
5100
- children: dep.keys.map((key) => ({ name: key, id: key, type: "key" }))
5101
- }))
5102
- }))
5474
+ () => dataSources.value.map((ds) => {
5475
+ const dsDeps = dsDep.value[ds.id].deps;
5476
+ const dsMethodDeps = dsMethodDep.value[ds.id].deps;
5477
+ const dsCondDeps = dsCondDep.value[ds.id].deps;
5478
+ const children = [];
5479
+ const mergeChildren = (deps, type) => {
5480
+ Object.entries(deps).forEach(([id, dep]) => {
5481
+ const nodeItem = children.find((item) => item.id === id);
5482
+ if (nodeItem) {
5483
+ nodeItem.children = nodeItem.children.concat(getKeyTreeConfig(dep, type));
5484
+ } else {
5485
+ children.push(getNodeTreeConfig(id, dep, type));
5486
+ }
5487
+ });
5488
+ };
5489
+ mergeChildren(dsDeps);
5490
+ mergeChildren(dsMethodDeps, "method");
5491
+ mergeChildren(dsCondDeps, "cond");
5492
+ return {
5493
+ id: ds.id,
5494
+ name: ds.title,
5495
+ type: "ds",
5496
+ children
5497
+ };
5498
+ })
5103
5499
  );
5104
5500
  const editHandler = (id) => {
5105
5501
  emit("edit", id);
@@ -5150,27 +5546,27 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
5150
5546
  class: "list-container"
5151
5547
  }, [
5152
5548
  createElementVNode("div", _hoisted_2$3, [
5153
- data.type === "code" ? (openBlock(), createBlock(_sfc_main$E, {
5549
+ data.type === "code" ? (openBlock(), createBlock(_sfc_main$F, {
5154
5550
  key: 0,
5155
5551
  class: "codeIcon",
5156
5552
  icon: unref(Coin)
5157
5553
  }, null, 8, ["icon"])) : createCommentVNode("", true),
5158
- data.type === "node" ? (openBlock(), createBlock(_sfc_main$E, {
5554
+ data.type === "node" ? (openBlock(), createBlock(_sfc_main$F, {
5159
5555
  key: 1,
5160
5556
  class: "compIcon",
5161
5557
  icon: unref(Aim)
5162
5558
  }, null, 8, ["icon"])) : createCommentVNode("", true),
5163
5559
  createElementVNode("span", {
5164
- class: normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
5165
- }, toDisplayString(data.name) + "" + toDisplayString(data.id) + ")", 3),
5166
- data.type === "code" ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
5560
+ class: normalizeClass(["name", { code: data.type === "ds", hook: data.type === "key" }])
5561
+ }, toDisplayString(data.type === "key" ? data.name : `${data.name}(${data.id})`), 3),
5562
+ data.type === "ds" ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
5167
5563
  createVNode(unref(TMagicTooltip), {
5168
5564
  effect: "dark",
5169
5565
  content: editable.value ? "编辑" : "查看",
5170
5566
  placement: "bottom"
5171
5567
  }, {
5172
5568
  default: withCtx(() => [
5173
- createVNode(_sfc_main$E, {
5569
+ createVNode(_sfc_main$F, {
5174
5570
  icon: editable.value ? unref(Edit) : unref(View),
5175
5571
  class: "edit-icon",
5176
5572
  onClick: withModifiers(($event) => editHandler(`${data.id}`), ["stop"])
@@ -5185,7 +5581,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
5185
5581
  placement: "bottom"
5186
5582
  }, {
5187
5583
  default: withCtx(() => [
5188
- createVNode(_sfc_main$E, {
5584
+ createVNode(_sfc_main$F, {
5189
5585
  icon: unref(Close),
5190
5586
  class: "edit-icon",
5191
5587
  onClick: withModifiers(($event) => removeHandler(`${data.id}`), ["stop"])
@@ -5371,7 +5767,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
5371
5767
  name: `${index}`
5372
5768
  }, {
5373
5769
  title: withCtx(() => [
5374
- createVNode(_sfc_main$E, { icon: unref(Grid) }, null, 8, ["icon"]),
5770
+ createVNode(_sfc_main$F, { icon: unref(Grid) }, null, 8, ["icon"]),
5375
5771
  createTextVNode(toDisplayString(group.title), 1)
5376
5772
  ]),
5377
5773
  default: withCtx(() => [
@@ -5386,7 +5782,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
5386
5782
  onDrag: dragHandler
5387
5783
  }, [
5388
5784
  renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
5389
- createVNode(_sfc_main$E, {
5785
+ createVNode(_sfc_main$F, {
5390
5786
  icon: item.icon
5391
5787
  }, null, 8, ["icon"]),
5392
5788
  createVNode(unref(TMagicTooltip), {
@@ -6149,7 +6545,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
6149
6545
  (openBlock(), createElementBlock("div", {
6150
6546
  key: config.text
6151
6547
  }, [
6152
- config.icon ? (openBlock(), createBlock(_sfc_main$E, {
6548
+ config.icon ? (openBlock(), createBlock(_sfc_main$F, {
6153
6549
  key: 0,
6154
6550
  icon: config.icon
6155
6551
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -6367,14 +6763,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
6367
6763
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
6368
6764
  onClick: addPage
6369
6765
  }, [
6370
- createVNode(_sfc_main$E, { icon: unref(Plus) }, null, 8, ["icon"])
6766
+ createVNode(_sfc_main$F, { icon: unref(Plus) }, null, 8, ["icon"])
6371
6767
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$3)),
6372
6768
  canScroll.value ? (openBlock(), createElementBlock("div", {
6373
6769
  key: 2,
6374
6770
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
6375
6771
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
6376
6772
  }, [
6377
- createVNode(_sfc_main$E, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
6773
+ createVNode(_sfc_main$F, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
6378
6774
  ])) : createCommentVNode("", true),
6379
6775
  pageLength.value ? (openBlock(), createElementBlock("div", {
6380
6776
  key: 3,
@@ -6390,7 +6786,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
6390
6786
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
6391
6787
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
6392
6788
  }, [
6393
- createVNode(_sfc_main$E, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
6789
+ createVNode(_sfc_main$F, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
6394
6790
  ])) : createCommentVNode("", true)
6395
6791
  ], 512);
6396
6792
  };
@@ -7415,178 +7811,6 @@ class ComponentList extends BaseService {
7415
7811
  }
7416
7812
  const componentListService = new ComponentList();
7417
7813
 
7418
- const BaseFormConfig = [
7419
- {
7420
- name: "id",
7421
- type: "hidden"
7422
- },
7423
- {
7424
- name: "type",
7425
- text: "类型",
7426
- type: "select",
7427
- options: [
7428
- { text: "基础", value: "base" },
7429
- { text: "HTTP", value: "http" }
7430
- ],
7431
- defaultValue: "base"
7432
- },
7433
- {
7434
- name: "title",
7435
- text: "名称",
7436
- rules: [
7437
- {
7438
- required: true,
7439
- message: "请输入名称"
7440
- }
7441
- ]
7442
- },
7443
- {
7444
- name: "description",
7445
- text: "描述"
7446
- }
7447
- ];
7448
-
7449
- const HttpFormConfig = [
7450
- {
7451
- name: "autoFetch",
7452
- text: "自动请求",
7453
- type: "switch",
7454
- defaultValue: true
7455
- },
7456
- {
7457
- type: "fieldset",
7458
- name: "options",
7459
- legend: "HTTP 配置",
7460
- items: [
7461
- {
7462
- name: "url",
7463
- text: "URL"
7464
- },
7465
- {
7466
- name: "method",
7467
- text: "Method",
7468
- type: "select",
7469
- options: [
7470
- { text: "GET", value: "GET" },
7471
- { text: "POST", value: "POST" },
7472
- { text: "PUT", value: "PUT" },
7473
- { text: "DELETE", value: "DELETE" }
7474
- ]
7475
- },
7476
- {
7477
- name: "params",
7478
- type: "key-value",
7479
- defaultValue: {},
7480
- text: "参数"
7481
- },
7482
- {
7483
- name: "data",
7484
- type: "key-value",
7485
- defaultValue: {},
7486
- text: "请求体"
7487
- },
7488
- {
7489
- name: "headers",
7490
- type: "key-value",
7491
- defaultValue: {},
7492
- text: "请求头"
7493
- }
7494
- ]
7495
- }
7496
- ];
7497
-
7498
- const fillConfig = (config) => [
7499
- ...BaseFormConfig,
7500
- ...config,
7501
- {
7502
- type: "panel",
7503
- title: "数据定义",
7504
- items: [
7505
- {
7506
- name: "fields",
7507
- type: "data-source-fields",
7508
- defaultValue: []
7509
- }
7510
- ]
7511
- },
7512
- {
7513
- type: "panel",
7514
- title: "方法定义",
7515
- items: [
7516
- {
7517
- name: "methods",
7518
- type: "data-source-methods",
7519
- defaultValue: []
7520
- }
7521
- ]
7522
- }
7523
- ];
7524
- const getFormConfig = (type, configs) => {
7525
- switch (type) {
7526
- case "base":
7527
- return fillConfig([]);
7528
- case "http":
7529
- return fillConfig(HttpFormConfig);
7530
- default:
7531
- return fillConfig(configs[type] || []);
7532
- }
7533
- };
7534
-
7535
- class DataSource extends BaseService {
7536
- state = reactive({
7537
- dataSources: [],
7538
- editable: true,
7539
- configs: {}
7540
- });
7541
- set(name, value) {
7542
- this.state[name] = value;
7543
- }
7544
- get(name) {
7545
- return this.state[name];
7546
- }
7547
- getFormConfig(type = "base") {
7548
- return getFormConfig(type, this.get("configs"));
7549
- }
7550
- setFormConfig(type, config) {
7551
- this.get("configs")[type] = config;
7552
- }
7553
- add(config) {
7554
- const newConfig = {
7555
- ...config,
7556
- id: this.createId()
7557
- };
7558
- this.get("dataSources").push(newConfig);
7559
- this.emit("add", newConfig);
7560
- }
7561
- update(config) {
7562
- const dataSources = this.get("dataSources");
7563
- const index = dataSources.findIndex((ds) => ds.id === config.id);
7564
- dataSources[index] = cloneDeep(config);
7565
- this.emit("update", config);
7566
- }
7567
- remove(id) {
7568
- const dataSources = this.get("dataSources");
7569
- const index = dataSources.findIndex((ds) => ds.id === id);
7570
- dataSources.splice(index, 1);
7571
- this.emit("remove", id);
7572
- }
7573
- getDataSourceById(id) {
7574
- return this.get("dataSources").find((ds) => ds.id === id);
7575
- }
7576
- resetState() {
7577
- this.set("dataSources", []);
7578
- }
7579
- destroy() {
7580
- this.removeAllListeners();
7581
- this.resetState();
7582
- this.removeAllPlugins();
7583
- }
7584
- createId() {
7585
- return `ds_${guid()}`;
7586
- }
7587
- }
7588
- const dataSourceService = new DataSource();
7589
-
7590
7814
  class Target extends EventEmitter {
7591
7815
  /**
7592
7816
  * 如何识别目标
@@ -7604,7 +7828,7 @@ class Target extends EventEmitter {
7604
7828
  /**
7605
7829
  * 不同的目标可以进行分类,例如代码块,数据源可以为两个不同的type
7606
7830
  */
7607
- type = "default";
7831
+ type = DepTargetType.DEFAULT;
7608
7832
  /**
7609
7833
  * 依赖详情
7610
7834
  * 实例:{ 'node_id': { name: 'node_name', keys: [ created, mounted ] } }
@@ -7687,7 +7911,7 @@ class Watcher extends EventEmitter {
7687
7911
  * @param type 分类
7688
7912
  * @returns Target[]
7689
7913
  */
7690
- getTargets(type = "default") {
7914
+ getTargets(type = DepTargetType.DEFAULT) {
7691
7915
  return this.targets[type] || {};
7692
7916
  }
7693
7917
  /**
@@ -7746,7 +7970,7 @@ class Watcher extends EventEmitter {
7746
7970
  * @param type 分类
7747
7971
  * @returns void
7748
7972
  */
7749
- removeTargets(type = "default") {
7973
+ removeTargets(type = DepTargetType.DEFAULT) {
7750
7974
  const targets = this.targets[type];
7751
7975
  if (!targets)
7752
7976
  return;
@@ -7812,9 +8036,11 @@ class Watcher extends EventEmitter {
7812
8036
  this.emit("update-dep", node, fullKey);
7813
8037
  } else if (!keyIsItems && Array.isArray(value)) {
7814
8038
  value.forEach((item, index) => {
7815
- collectTarget(item, `${fullKey}.${index}`);
8039
+ if (isObject$1(item)) {
8040
+ collectTarget(item, `${fullKey}.${index}`);
8041
+ }
7816
8042
  });
7817
- } else if (Object.prototype.toString.call(value) === "[object Object]") {
8043
+ } else if (isObject$1(value)) {
7818
8044
  collectTarget(value, fullKey);
7819
8045
  }
7820
8046
  if (keyIsItems && deep && Array.isArray(value)) {
@@ -7824,6 +8050,8 @@ class Watcher extends EventEmitter {
7824
8050
  }
7825
8051
  };
7826
8052
  Object.entries(config).forEach(([key, value]) => {
8053
+ if (typeof value === "undefined" || value === "")
8054
+ return;
7827
8055
  doCollect(key, value);
7828
8056
  });
7829
8057
  };
@@ -8259,7 +8487,7 @@ const editorProps = {
8259
8487
  };
8260
8488
 
8261
8489
  const createCodeBlockTarget = (id, codeBlock) => new Target({
8262
- type: "code-block",
8490
+ type: DepTargetType.CODE_BLOCK,
8263
8491
  id,
8264
8492
  name: codeBlock.name,
8265
8493
  isTarget: (key, value) => {
@@ -8273,15 +8501,34 @@ const createCodeBlockTarget = (id, codeBlock) => new Target({
8273
8501
  return false;
8274
8502
  }
8275
8503
  });
8276
- const createDataSourceTarget = (id, ds) => new Target({
8277
- type: "data-source",
8504
+ const createDataSourceTarget = (id) => new Target({
8505
+ type: DepTargetType.DATA_SOURCE,
8278
8506
  id,
8279
- name: ds.title || `${id}`,
8280
8507
  isTarget: (key, value) => (
8281
8508
  // 关联数据源对象或者在模板在使用数据源
8282
- value.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
8509
+ value?.isBindDataSource && value.dataSourceId || typeof value === "string" && value.includes(`${id}`)
8283
8510
  )
8284
8511
  });
8512
+ const createDataSourceCondTarget = (id) => new Target({
8513
+ type: DepTargetType.DATA_SOURCE_COND,
8514
+ id,
8515
+ isTarget: (key, value) => {
8516
+ if (!Array.isArray(value) || value[0] !== id)
8517
+ return false;
8518
+ const ds = dataSourceService.getDataSourceById(id);
8519
+ return Boolean(ds?.fields?.find((field) => field.name === value[1]));
8520
+ }
8521
+ });
8522
+ const createDataSourceMethodTarget = (id) => new Target({
8523
+ type: DepTargetType.DATA_SOURCE_METHOD,
8524
+ id,
8525
+ isTarget: (key, value) => {
8526
+ if (!Array.isArray(value) || value[0] !== id)
8527
+ return false;
8528
+ const ds = dataSourceService.getDataSourceById(id);
8529
+ return Boolean(ds?.methods?.find((method) => method.name === value[1]));
8530
+ }
8531
+ });
8285
8532
 
8286
8533
  const initServiceState = (props, {
8287
8534
  editorService,
@@ -8384,6 +8631,7 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8384
8631
  return;
8385
8632
  if (app.dsl) {
8386
8633
  app.dsl.dataSourceDeps = root.dataSourceDeps;
8634
+ app.dsl.dataSourceCondDeps = root.dataSourceCondDeps;
8387
8635
  app.dsl.dataSources = root.dataSources;
8388
8636
  }
8389
8637
  updateDataSoucreSchema();
@@ -8401,21 +8649,30 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8401
8649
  });
8402
8650
  };
8403
8651
  const targetAddHandler = (target) => {
8404
- if (target.type !== "data-source")
8405
- return;
8406
8652
  const root = editorService.get("root");
8407
8653
  if (!root)
8408
8654
  return;
8409
- if (!root.dataSourceDeps) {
8410
- root.dataSourceDeps = {};
8655
+ if (target.type === DepTargetType.DATA_SOURCE) {
8656
+ if (!root.dataSourceDeps) {
8657
+ root.dataSourceDeps = {};
8658
+ }
8659
+ root.dataSourceDeps[target.id] = target.deps;
8660
+ }
8661
+ if (target.type === DepTargetType.DATA_SOURCE_COND) {
8662
+ if (!root.dataSourceCondDeps) {
8663
+ root.dataSourceCondDeps = {};
8664
+ }
8665
+ root.dataSourceCondDeps[target.id] = target.deps;
8411
8666
  }
8412
- root.dataSourceDeps[target.id] = target.deps;
8413
8667
  };
8414
8668
  const targetRemoveHandler = (id) => {
8415
8669
  const root = editorService.get("root");
8416
- if (!root?.dataSourceDeps)
8417
- return;
8418
- delete root.dataSourceDeps[id];
8670
+ if (root?.dataSourceDeps) {
8671
+ delete root.dataSourceDeps[id];
8672
+ }
8673
+ if (root?.dataSourceCondDeps) {
8674
+ delete root.dataSourceCondDeps[id];
8675
+ }
8419
8676
  };
8420
8677
  const depUpdateHandler = (node) => {
8421
8678
  upateNodeWhenDataSourceChange([node]);
@@ -8427,6 +8684,11 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8427
8684
  depService.on("remove-target", targetRemoveHandler);
8428
8685
  depService.on("dep-update", depUpdateHandler);
8429
8686
  depService.on("collected", collectedHandler);
8687
+ const initDataSourceDepTarget = (ds) => {
8688
+ depService.addTarget(createDataSourceTarget(ds.id));
8689
+ depService.addTarget(createDataSourceMethodTarget(ds.id));
8690
+ depService.addTarget(createDataSourceCondTarget(ds.id));
8691
+ };
8430
8692
  const rootChangeHandler = async (value, preValue) => {
8431
8693
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
8432
8694
  let node;
@@ -8449,12 +8711,12 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8449
8711
  value.dataSources = value.dataSources || [];
8450
8712
  codeBlockService.setCodeDsl(value.codeBlocks);
8451
8713
  dataSourceService.set("dataSources", value.dataSources);
8452
- depService.removeTargets("code-block");
8714
+ depService.removeTargets(DepTargetType.CODE_BLOCK);
8453
8715
  Object.entries(value.codeBlocks).forEach(([id, code]) => {
8454
8716
  depService.addTarget(createCodeBlockTarget(id, code));
8455
8717
  });
8456
8718
  value.dataSources.forEach((ds) => {
8457
- depService.addTarget(createDataSourceTarget(ds.id, ds));
8719
+ initDataSourceDepTarget(ds);
8458
8720
  });
8459
8721
  if (value && Array.isArray(value.items)) {
8460
8722
  depService.collect(value.items, true);
@@ -8493,15 +8755,12 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
8493
8755
  codeBlockService.on("addOrUpdate", codeBlockAddOrUpdateHandler);
8494
8756
  codeBlockService.on("remove", codeBlockRemoveHandler);
8495
8757
  const dataSourceAddHandler = (config) => {
8496
- depService.addTarget(createDataSourceTarget(config.id, config));
8758
+ initDataSourceDepTarget(config);
8497
8759
  getApp()?.dataSourceManager?.addDataSource(config);
8498
8760
  };
8499
8761
  const dataSourceUpdateHandler = (config) => {
8500
- if (config.title) {
8501
- depService.getTarget(config.id).name = config.title;
8502
- }
8503
8762
  const root = editorService.get("root");
8504
- const targets = depService.getTargets("data-source");
8763
+ const targets = depService.getTargets(DepTargetType.DATA_SOURCE);
8505
8764
  const nodes = getNodes(Object.keys(targets[config.id].deps), root?.items);
8506
8765
  upateNodeWhenDataSourceChange(nodes);
8507
8766
  };
@@ -8703,20 +8962,21 @@ const index = {
8703
8962
  setConfig(option);
8704
8963
  app.component(Editor.name, Editor);
8705
8964
  app.component("m-fields-ui-select", _sfc_main$v);
8706
- app.component("m-fields-code-link", _sfc_main$I);
8707
- app.component("m-fields-vs-code", _sfc_main$J);
8708
- app.component("magic-code-editor", _sfc_main$K);
8709
- app.component("m-fields-code-select", _sfc_main$H);
8710
- app.component("m-fields-code-select-col", _sfc_main$D);
8965
+ app.component("m-fields-code-link", _sfc_main$J);
8966
+ app.component("m-fields-vs-code", _sfc_main$K);
8967
+ app.component("magic-code-editor", _sfc_main$L);
8968
+ app.component("m-fields-code-select", _sfc_main$I);
8969
+ app.component("m-fields-code-select-col", _sfc_main$E);
8711
8970
  app.component("m-fields-event-select", _sfc_main$x);
8712
- app.component("m-fields-data-source-fields", _sfc_main$C);
8971
+ app.component("m-fields-data-source-fields", _sfc_main$D);
8713
8972
  app.component("m-fields-key-value", _sfc_main$w);
8714
8973
  app.component("m-fields-data-source-input", _sfc_main$B);
8715
8974
  app.component("m-fields-data-source-select", _sfc_main$y);
8716
8975
  app.component("m-fields-data-source-methods", _sfc_main$A);
8717
8976
  app.component("m-fields-data-source-method-select", _sfc_main$z);
8977
+ app.component("m-fields-data-source-field-select", _sfc_main$C);
8718
8978
  }
8719
8979
  };
8720
8980
 
8721
- export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$G as CodeBlockEditor, _sfc_main$k as CodeBlockList, _sfc_main$j as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$H as CodeSelect, _sfc_main$D as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$e as ContentMenu, _sfc_main$C as DataSourceFields, _sfc_main$B as DataSourceInput, _sfc_main$z as DataSourceMethodSelect, _sfc_main$A as DataSourceMethods, _sfc_main$y as DataSourceSelect, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$E as Icon, KeyBindingCommand, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$b as LayerPanel, Layout, _sfc_main$t as LayoutContainer, _sfc_main$o as PropsPanel, _sfc_main$u as Resizer, _sfc_main$t as SplitView, _sfc_main$K as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$q as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as 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 };
8981
+ export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$H as CodeBlockEditor, _sfc_main$k as CodeBlockList, _sfc_main$j as CodeBlockListPanel, CodeDeleteErrorType, _sfc_main$I as CodeSelect, _sfc_main$E as CodeSelectCol, ColumnLayout, _sfc_main$f as ComponentListPanel, _sfc_main$e as ContentMenu, _sfc_main$C as DataSourceFieldSelect, _sfc_main$D as DataSourceFields, _sfc_main$B as DataSourceInput, _sfc_main$z as DataSourceMethodSelect, _sfc_main$A as DataSourceMethods, _sfc_main$y as DataSourceSelect, DepTargetType, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$F as Icon, KeyBindingCommand, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$b as LayerPanel, Layout, _sfc_main$t as LayoutContainer, _sfc_main$o as PropsPanel, _sfc_main$u as Resizer, _sfc_main$t as SplitView, _sfc_main$L as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$q as ToolButton, V_GUIDE_LINE_STORAGE_KEY, advancedTabConfig, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, displayTabConfig, editorService, error, eventTabConfig, 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, styleTabConfig, uiService, useStage, warn };
8722
8982
  //# sourceMappingURL=tmagic-editor.js.map