@tmagic/editor 1.3.0-alpha.21 → 1.3.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -860,6 +860,13 @@
860
860
  height: 22px;
861
861
  margin-right: 5px;
862
862
  }
863
+ .data-source-list-panel-add-menu .tmagic-design-button {
864
+ width: 100%;
865
+ text-align: left;
866
+ }
867
+ .data-source-list-panel-add-menu .tmagic-design-button span {
868
+ width: 100%;
869
+ }
863
870
  .m-editor-data-source-fields {
864
871
  width: 100%;
865
872
  }
@@ -3,7 +3,7 @@ import { FullScreen, Edit, View, Coin, Delete, Plus, Close, ArrowDown, Grid, Mem
3
3
  import { throttle, isEmpty, cloneDeep, mergeWith, isObject, uniq, map, has, difference, union, pick, keys } from 'lodash-es';
4
4
  import * as monaco from 'monaco-editor';
5
5
  import serialize from 'serialize-javascript';
6
- import { TMagicButton, TMagicCard, tMagicMessage, TMagicIcon, tMagicMessageBox, getConfig as getConfig$1, TMagicTag, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicTree, TMagicCollapse, TMagicCollapseItem, TMagicPopover } from '@tmagic/design';
6
+ import { TMagicButton, TMagicCard, tMagicMessage, TMagicIcon, tMagicMessageBox, getConfig as getConfig$1, TMagicTag, TMagicInput, TMagicTooltip, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicTree, TMagicPopover, TMagicCollapse, TMagicCollapseItem } from '@tmagic/design';
7
7
  import { HookType, NodeType, ActionType } from '@tmagic/schema';
8
8
  import { MFormDrawer, MForm, createValues, MSelect } from '@tmagic/form';
9
9
  import { MagicTable } from '@tmagic/table';
@@ -534,7 +534,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
534
534
  }
535
535
  });
536
536
 
537
- function BaseFormConfig(datasourceTypeList = []) {
537
+ function BaseFormConfig() {
538
538
  return [
539
539
  {
540
540
  name: "id",
@@ -543,12 +543,7 @@ function BaseFormConfig(datasourceTypeList = []) {
543
543
  {
544
544
  name: "type",
545
545
  text: "类型",
546
- type: "select",
547
- options: [
548
- { text: "基础", value: "base" },
549
- { text: "HTTP", value: "http" },
550
- ...datasourceTypeList.map((item) => ({ text: item.text, value: item.type }))
551
- ],
546
+ type: "hidden",
552
547
  defaultValue: "base"
553
548
  },
554
549
  {
@@ -617,8 +612,8 @@ const HttpFormConfig = [
617
612
  }
618
613
  ];
619
614
 
620
- const fillConfig$1 = (config, datasourceTypeList) => [
621
- ...BaseFormConfig(datasourceTypeList),
615
+ const fillConfig$1 = (config) => [
616
+ ...BaseFormConfig(),
622
617
  ...config,
623
618
  {
624
619
  type: "panel",
@@ -627,7 +622,7 @@ const fillConfig$1 = (config, datasourceTypeList) => [
627
622
  {
628
623
  name: "fields",
629
624
  type: "data-source-fields",
630
- defaultValue: []
625
+ defaultValue: () => []
631
626
  }
632
627
  ]
633
628
  },
@@ -638,19 +633,19 @@ const fillConfig$1 = (config, datasourceTypeList) => [
638
633
  {
639
634
  name: "methods",
640
635
  type: "data-source-methods",
641
- defaultValue: []
636
+ defaultValue: () => []
642
637
  }
643
638
  ]
644
639
  }
645
640
  ];
646
- const getFormConfig = (type, datasourceTypeList, configs) => {
641
+ const getFormConfig = (type, configs) => {
647
642
  switch (type) {
648
643
  case "base":
649
- return fillConfig$1([], datasourceTypeList);
644
+ return fillConfig$1([]);
650
645
  case "http":
651
- return fillConfig$1(HttpFormConfig, datasourceTypeList);
646
+ return fillConfig$1(HttpFormConfig);
652
647
  default:
653
- return fillConfig$1(configs[type] || [], datasourceTypeList);
648
+ return fillConfig$1(configs[type] || []);
654
649
  }
655
650
  };
656
651
  const getDisplayField = (dataSources, key) => {
@@ -830,7 +825,7 @@ class DataSource extends BaseService {
830
825
  return this.state[name];
831
826
  }
832
827
  getFormConfig(type = "base") {
833
- return getFormConfig(type, this.get("datasourceTypeList"), this.get("configs"));
828
+ return getFormConfig(type, this.get("configs"));
834
829
  }
835
830
  setFormConfig(type, config) {
836
831
  this.get("configs")[type] = config;
@@ -2748,7 +2743,7 @@ const useCodeBlockEdit = (codeBlockService) => {
2748
2743
  };
2749
2744
 
2750
2745
  const _hoisted_1$p = { class: "m-fields-code-select-col" };
2751
- const _hoisted_2$g = { class: "code-select-container" };
2746
+ const _hoisted_2$h = { class: "code-select-container" };
2752
2747
  const _sfc_main$E = /* @__PURE__ */ defineComponent({
2753
2748
  ...{
2754
2749
  name: "MEditorCodeSelectCol"
@@ -2816,7 +2811,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
2816
2811
  return (_ctx, _cache) => {
2817
2812
  const _component_m_form_container = resolveComponent("m-form-container");
2818
2813
  return openBlock(), createElementBlock("div", _hoisted_1$p, [
2819
- createElementVNode("div", _hoisted_2$g, [
2814
+ createElementVNode("div", _hoisted_2$h, [
2820
2815
  createVNode(_component_m_form_container, {
2821
2816
  class: "select",
2822
2817
  config: selectConfig,
@@ -2852,7 +2847,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
2852
2847
  });
2853
2848
 
2854
2849
  const _hoisted_1$o = { class: "m-editor-data-source-fields" };
2855
- const _hoisted_2$f = { class: "m-editor-data-source-fields-footer" };
2850
+ const _hoisted_2$g = { class: "m-editor-data-source-fields-footer" };
2856
2851
  const _sfc_main$D = /* @__PURE__ */ defineComponent({
2857
2852
  ...{
2858
2853
  name: "MEditorDataSourceFields"
@@ -2872,9 +2867,11 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
2872
2867
  emits: ["change"],
2873
2868
  setup(__props, { emit }) {
2874
2869
  const props = __props;
2870
+ const services = inject("services");
2875
2871
  const addDialog = ref();
2876
2872
  const fieldValues = ref({});
2877
2873
  const filedTitle = ref("");
2874
+ const width = computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
2878
2875
  const newHandler = () => {
2879
2876
  fieldValues.value = {};
2880
2877
  filedTitle.value = "新增属性";
@@ -3007,7 +3004,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
3007
3004
  data: _ctx.model[_ctx.name],
3008
3005
  columns: fieldColumns
3009
3006
  }, null, 8, ["data"]),
3010
- createElementVNode("div", _hoisted_2$f, [
3007
+ createElementVNode("div", _hoisted_2$g, [
3011
3008
  createVNode(unref(TMagicButton), {
3012
3009
  size: "small",
3013
3010
  type: "primary",
@@ -3030,8 +3027,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
3030
3027
  values: fieldValues.value,
3031
3028
  parentValues: _ctx.model[_ctx.name],
3032
3029
  disabled: _ctx.disabled,
3030
+ width: width.value,
3033
3031
  onSubmit: fieldChange
3034
- }, null, 8, ["title", "values", "parentValues", "disabled"])
3032
+ }, null, 8, ["title", "values", "parentValues", "disabled", "width"])
3035
3033
  ]);
3036
3034
  };
3037
3035
  }
@@ -3085,7 +3083,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
3085
3083
  });
3086
3084
 
3087
3085
  const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3088
- const _hoisted_2$e = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3086
+ const _hoisted_2$f = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3089
3087
  const _hoisted_3$5 = { class: "el-input__inner" };
3090
3088
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
3091
3089
  ...{
@@ -3132,6 +3130,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
3132
3130
  const blurHandler = () => {
3133
3131
  isFocused.value = false;
3134
3132
  setDisplayState();
3133
+ emit("change", state.value);
3135
3134
  };
3136
3135
  const changeHandler = (v) => {
3137
3136
  emit("change", v);
@@ -3248,6 +3247,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
3248
3247
  newSelectionStart = dotIndex + suggestText.length + 1;
3249
3248
  }
3250
3249
  input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
3250
+ changeHandler(state.value);
3251
3251
  };
3252
3252
  return (_ctx, _cache) => {
3253
3253
  return _ctx.disabled || isFocused.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(getConfig$1)("components")?.autocomplete.component || "el-autocomplete"), mergeProps(
@@ -3269,7 +3269,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
3269
3269
  {
3270
3270
  style: { "width": "100%" },
3271
3271
  onBlur: blurHandler,
3272
- onChange: changeHandler,
3273
3272
  onInput: inputHandler,
3274
3273
  onSelect: selectHandler
3275
3274
  }
@@ -3280,7 +3279,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
3280
3279
  default: withCtx(({ item }) => [
3281
3280
  createElementVNode("div", _hoisted_1$n, [
3282
3281
  createElementVNode("div", null, toDisplayString(item.text), 1),
3283
- createElementVNode("span", _hoisted_2$e, toDisplayString(item.value), 1)
3282
+ createElementVNode("span", _hoisted_2$f, toDisplayString(item.value), 1)
3284
3283
  ])
3285
3284
  ]),
3286
3285
  _: 1
@@ -3394,7 +3393,7 @@ const useDataSourceMethod = () => {
3394
3393
  };
3395
3394
 
3396
3395
  const _hoisted_1$m = { class: "m-editor-data-source-methods" };
3397
- const _hoisted_2$d = { class: "m-editor-data-source-methods-footer" };
3396
+ const _hoisted_2$e = { class: "m-editor-data-source-methods-footer" };
3398
3397
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
3399
3398
  ...{
3400
3399
  name: "MEditorDataSourceMethods"
@@ -3469,7 +3468,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
3469
3468
  data: _ctx.model[_ctx.name],
3470
3469
  columns: methodColumns
3471
3470
  }, null, 8, ["data"]),
3472
- createElementVNode("div", _hoisted_2$d, [
3471
+ createElementVNode("div", _hoisted_2$e, [
3473
3472
  createVNode(unref(TMagicButton), {
3474
3473
  size: "small",
3475
3474
  type: "primary",
@@ -3498,7 +3497,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
3498
3497
  });
3499
3498
 
3500
3499
  const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
3501
- const _hoisted_2$c = { class: "data-source-method-select-container" };
3500
+ const _hoisted_2$d = { class: "data-source-method-select-container" };
3502
3501
  const _sfc_main$z = /* @__PURE__ */ defineComponent({
3503
3502
  ...{
3504
3503
  name: "MEditorDataSourceMethodSelect"
@@ -3578,7 +3577,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
3578
3577
  return (_ctx, _cache) => {
3579
3578
  const _component_m_form_container = resolveComponent("m-form-container");
3580
3579
  return openBlock(), createElementBlock("div", _hoisted_1$l, [
3581
- createElementVNode("div", _hoisted_2$c, [
3580
+ createElementVNode("div", _hoisted_2$d, [
3582
3581
  createVNode(_component_m_form_container, {
3583
3582
  class: "select",
3584
3583
  config: cascaderConfig,
@@ -3670,7 +3669,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
3670
3669
  });
3671
3670
 
3672
3671
  const _hoisted_1$k = { class: "m-fields-event-select" };
3673
- const _hoisted_2$b = {
3672
+ const _hoisted_2$c = {
3674
3673
  key: 1,
3675
3674
  class: "fullWidth"
3676
3675
  };
@@ -3874,7 +3873,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
3874
3873
  model: _ctx.model,
3875
3874
  config: tableConfig.value,
3876
3875
  onChange: onChangeHandler
3877
- }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$b, [
3876
+ }, null, 8, ["size", "disabled", "model", "config"])) : (openBlock(), createElementBlock("div", _hoisted_2$c, [
3878
3877
  createVNode(unref(TMagicButton), {
3879
3878
  class: "create-button",
3880
3879
  type: "primary",
@@ -3924,7 +3923,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
3924
3923
  });
3925
3924
 
3926
3925
  const _hoisted_1$j = { class: "m-fields-key-value" };
3927
- const _hoisted_2$a = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
3926
+ const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
3928
3927
  const _sfc_main$w = /* @__PURE__ */ defineComponent({
3929
3928
  ...{
3930
3929
  name: "MEditorKeyValue"
@@ -3984,7 +3983,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
3984
3983
  size: _ctx.size,
3985
3984
  onChange: keyChangeHandler
3986
3985
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
3987
- _hoisted_2$a,
3986
+ _hoisted_2$b,
3988
3987
  createVNode(unref(TMagicInput), {
3989
3988
  placeholder: "value",
3990
3989
  modelValue: records.value[index][1],
@@ -4363,7 +4362,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
4363
4362
  });
4364
4363
 
4365
4364
  const _hoisted_1$h = { class: "m-editor-empty-panel" };
4366
- const _hoisted_2$9 = { class: "m-editor-empty-content" };
4365
+ const _hoisted_2$a = { class: "m-editor-empty-content" };
4367
4366
  const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
4368
4367
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
4369
4368
  ...{
@@ -4386,7 +4385,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
4386
4385
  };
4387
4386
  return (_ctx, _cache) => {
4388
4387
  return openBlock(), createElementBlock("div", _hoisted_1$h, [
4389
- createElementVNode("div", _hoisted_2$9, [
4388
+ createElementVNode("div", _hoisted_2$a, [
4390
4389
  createElementVNode("div", {
4391
4390
  class: "m-editor-empty-button",
4392
4391
  onClick: clickHandler
@@ -4537,7 +4536,7 @@ const _hoisted_1$g = {
4537
4536
  key: 1,
4538
4537
  class: "menu-item-text"
4539
4538
  };
4540
- const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
4539
+ const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
4541
4540
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
4542
4541
  ...{
4543
4542
  name: "MEditorToolButton"
@@ -4681,7 +4680,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
4681
4680
  })) : createCommentVNode("", true)
4682
4681
  ]),
4683
4682
  default: withCtx(() => [
4684
- createElementVNode("span", _hoisted_2$8, [
4683
+ createElementVNode("span", _hoisted_2$9, [
4685
4684
  createTextVNode(toDisplayString(_ctx.data.text), 1),
4686
4685
  createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
4687
4686
  default: withCtx(() => [
@@ -4982,7 +4981,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
4982
4981
  });
4983
4982
 
4984
4983
  const _hoisted_1$e = { xmlns: "http://www.w3.org/2000/svg" };
4985
- const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("g", {
4984
+ const _hoisted_2$8 = /* @__PURE__ */ createElementVNode("g", {
4986
4985
  fill: "#7C878E",
4987
4986
  "fill-rule": "evenodd"
4988
4987
  }, [
@@ -4993,7 +4992,7 @@ const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("g", {
4993
4992
  /* @__PURE__ */ createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
4994
4993
  ], -1);
4995
4994
  const _hoisted_3$3 = [
4996
- _hoisted_2$7
4995
+ _hoisted_2$8
4997
4996
  ];
4998
4997
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
4999
4998
  ...{
@@ -5013,9 +5012,9 @@ const _hoisted_1$d = {
5013
5012
  xmlns: "http://www.w3.org/2000/svg",
5014
5013
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
5015
5014
  };
5016
- const _hoisted_2$6 = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
5015
+ const _hoisted_2$7 = /* @__PURE__ */ createStaticVNode('<defs><rect id="path-1" x="0" y="0" width="32" height="32"></rect></defs><g id="组件规范" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="03图标" transform="translate(-561.000000, -2356.000000)"><g id="icon/line/Universal/code" transform="translate(561.000000, 2356.000000)"><g id="路径"><mask id="mask-2" fill="white"><use xlink:href="#path-1"></use></mask><use id="蒙版" fill="#D8D8D8" opacity="0" xlink:href="#path-1"></use><path d="M21.9284587,7.9482233 L29.8079004,15.827665 C29.9055315,15.9252961 29.9055315,16.0835874 29.8079004,16.1812184 L21.9284587,24.0606602 C21.8308276,24.1582912 21.6725364,24.1582912 21.5749053,24.0606602 L20.3374684,22.8232233 C20.2419143,22.7276698 20.2398813,22.5740096 20.331369,22.4759832 L20.3374687,22.4696702 L26.8027181,16.0044417 L20.3374687,9.53921328 C20.2398372,9.44158265 20.2398369,9.2832914 20.3374679,9.18566017 L21.5749053,7.9482233 C21.6725364,7.85059223 21.8308276,7.85059223 21.9284587,7.9482233 Z M10.3999684,7.9482233 L11.6374053,9.18566017 C11.7329594,9.28121371 11.7349925,9.43487387 11.6435048,9.53290029 L11.637405,9.53921328 L5.17215562,16.0044417 L11.637405,22.4696702 C11.7329593,22.5652236 11.7349926,22.7188837 11.643505,22.8169103 L11.6374053,22.8232233 L10.3999684,24.0606602 C10.3023374,24.1582912 10.1440461,24.1582912 10.046415,24.0606602 L2.1669733,16.1812184 C2.06934223,16.0835874 2.06934223,15.9252961 2.1669733,15.827665 L10.046415,7.9482233 C10.1440461,7.85059223 10.3023374,7.85059223 10.3999684,7.9482233 Z M17.2612532,9.29310422 L18.9262468,9.83189578 C19.0576112,9.87440526 19.1296423,10.0153579 19.0871328,10.1467222 L15.0848232,22.514807 C15.0423138,22.6461714 14.9013612,22.7182025 14.7699968,22.675693 L13.1050032,22.1369014 C12.9736388,22.0943919 12.9016077,21.9534393 12.9441172,21.822075 L16.9464268,9.45399022 C16.9889362,9.32262585 17.1298888,9.25059474 17.2612532,9.29310422 Z" id="形状" fill="#1D1F24" mask="url(#mask-2)"></path></g></g><g id="icon切图" transform="translate(226.000000, 1782.000000)"></g></g></g>', 2);
5017
5016
  const _hoisted_4$1 = [
5018
- _hoisted_2$6
5017
+ _hoisted_2$7
5019
5018
  ];
5020
5019
  const _sfc_main$l = /* @__PURE__ */ defineComponent({
5021
5020
  ...{
@@ -5030,7 +5029,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
5030
5029
  });
5031
5030
 
5032
5031
  const _hoisted_1$c = ["id"];
5033
- const _hoisted_2$5 = { class: "list-item" };
5032
+ const _hoisted_2$6 = { class: "list-item" };
5034
5033
  const _hoisted_3$2 = {
5035
5034
  key: 2,
5036
5035
  class: "right-tool"
@@ -5136,7 +5135,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
5136
5135
  id: data.id,
5137
5136
  class: "list-container"
5138
5137
  }, [
5139
- createElementVNode("div", _hoisted_2$5, [
5138
+ createElementVNode("div", _hoisted_2$6, [
5140
5139
  data.type === "code" ? (openBlock(), createBlock(_sfc_main$l, {
5141
5140
  key: 0,
5142
5141
  class: "codeIcon"
@@ -5226,7 +5225,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
5226
5225
  createTextVNode("新增")
5227
5226
  ]),
5228
5227
  _: 1
5229
- }, 8, ["onClick"])) : createCommentVNode("", true)
5228
+ }, 8, ["onClick"])) : createCommentVNode("", true),
5229
+ renderSlot(_ctx.$slots, "code-block-panel-search")
5230
5230
  ])
5231
5231
  ]),
5232
5232
  createVNode(_sfc_main$k, {
@@ -5331,7 +5331,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
5331
5331
  });
5332
5332
 
5333
5333
  const _hoisted_1$a = ["id"];
5334
- const _hoisted_2$4 = { class: "list-item" };
5334
+ const _hoisted_2$5 = { class: "list-item" };
5335
5335
  const _hoisted_3$1 = {
5336
5336
  key: 2,
5337
5337
  class: "right-tool"
@@ -5431,7 +5431,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
5431
5431
  id: data.id,
5432
5432
  class: "list-container"
5433
5433
  }, [
5434
- createElementVNode("div", _hoisted_2$4, [
5434
+ createElementVNode("div", _hoisted_2$5, [
5435
5435
  data.type === "code" ? (openBlock(), createBlock(_sfc_main$F, {
5436
5436
  key: 0,
5437
5437
  class: "codeIcon",
@@ -5490,6 +5490,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
5490
5490
  });
5491
5491
 
5492
5492
  const _hoisted_1$9 = { class: "search-wrapper" };
5493
+ const _hoisted_2$4 = { class: "data-source-list-panel-add-menu" };
5493
5494
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
5494
5495
  ...{
5495
5496
  name: "MEditorDataSourceListPanel"
@@ -5499,11 +5500,22 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
5499
5500
  const { dataSourceService } = inject("services") || {};
5500
5501
  const editDialog = ref();
5501
5502
  const dataSourceValues = ref({});
5503
+ const dialogTitle = ref("");
5502
5504
  const editable = computed(() => dataSourceService?.get("editable") ?? true);
5503
- const addHandler = () => {
5505
+ const datasourceTypeList = computed(
5506
+ () => [
5507
+ { text: "基础", type: "base" },
5508
+ { text: "HTTP", type: "http" }
5509
+ ].concat(dataSourceService?.get("datasourceTypeList") ?? [])
5510
+ );
5511
+ const addHandler = (type) => {
5504
5512
  if (!editDialog.value)
5505
5513
  return;
5506
- dataSourceValues.value = {};
5514
+ dataSourceValues.value = {
5515
+ type
5516
+ };
5517
+ const datasourceType = datasourceTypeList.value.find((item) => item.type === type);
5518
+ dialogTitle.value = `新增${datasourceType?.text || ""}`;
5507
5519
  editDialog.value.show();
5508
5520
  };
5509
5521
  const editHandler = (id) => {
@@ -5512,6 +5524,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
5512
5524
  dataSourceValues.value = {
5513
5525
  ...dataSourceService?.getDataSourceById(id)
5514
5526
  };
5527
+ dialogTitle.value = `新增${dataSourceValues.value.title || ""}`;
5515
5528
  editDialog.value.show();
5516
5529
  };
5517
5530
  const removeHandler = (id) => {
@@ -5534,14 +5547,36 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
5534
5547
  default: withCtx(() => [
5535
5548
  createElementVNode("div", _hoisted_1$9, [
5536
5549
  createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5537
- editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
5550
+ editable.value ? (openBlock(), createBlock(unref(TMagicPopover), {
5538
5551
  key: 0,
5539
- type: "primary",
5540
- size: "small",
5541
- onClick: addHandler
5552
+ placement: "right"
5542
5553
  }, {
5554
+ reference: withCtx(() => [
5555
+ createVNode(unref(TMagicButton), {
5556
+ type: "primary",
5557
+ size: "small"
5558
+ }, {
5559
+ default: withCtx(() => [
5560
+ createTextVNode("新增")
5561
+ ]),
5562
+ _: 1
5563
+ })
5564
+ ]),
5543
5565
  default: withCtx(() => [
5544
- createTextVNode("新增")
5566
+ createElementVNode("div", _hoisted_2$4, [
5567
+ (openBlock(true), createElementBlock(Fragment, null, renderList(datasourceTypeList.value, (item, index) => {
5568
+ return openBlock(), createBlock(_sfc_main$q, {
5569
+ data: {
5570
+ type: "button",
5571
+ text: item.text,
5572
+ handler: () => {
5573
+ addHandler(item.type);
5574
+ }
5575
+ },
5576
+ key: index
5577
+ }, null, 8, ["data"]);
5578
+ }), 128))
5579
+ ])
5545
5580
  ]),
5546
5581
  _: 1
5547
5582
  })) : createCommentVNode("", true)
@@ -5555,7 +5590,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
5555
5590
  ref: editDialog,
5556
5591
  disabled: !editable.value,
5557
5592
  values: dataSourceValues.value,
5558
- title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
5593
+ title: dialogTitle.value,
5559
5594
  onSubmit: submitDataSourceHandler
5560
5595
  }, null, 8, ["disabled", "values", "title"])
5561
5596
  ]),