@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.
@@ -543,7 +543,7 @@
543
543
  }
544
544
  });
545
545
 
546
- function BaseFormConfig(datasourceTypeList = []) {
546
+ function BaseFormConfig() {
547
547
  return [
548
548
  {
549
549
  name: "id",
@@ -552,12 +552,7 @@
552
552
  {
553
553
  name: "type",
554
554
  text: "类型",
555
- type: "select",
556
- options: [
557
- { text: "基础", value: "base" },
558
- { text: "HTTP", value: "http" },
559
- ...datasourceTypeList.map((item) => ({ text: item.text, value: item.type }))
560
- ],
555
+ type: "hidden",
561
556
  defaultValue: "base"
562
557
  },
563
558
  {
@@ -626,8 +621,8 @@
626
621
  }
627
622
  ];
628
623
 
629
- const fillConfig$1 = (config, datasourceTypeList) => [
630
- ...BaseFormConfig(datasourceTypeList),
624
+ const fillConfig$1 = (config) => [
625
+ ...BaseFormConfig(),
631
626
  ...config,
632
627
  {
633
628
  type: "panel",
@@ -636,7 +631,7 @@
636
631
  {
637
632
  name: "fields",
638
633
  type: "data-source-fields",
639
- defaultValue: []
634
+ defaultValue: () => []
640
635
  }
641
636
  ]
642
637
  },
@@ -647,19 +642,19 @@
647
642
  {
648
643
  name: "methods",
649
644
  type: "data-source-methods",
650
- defaultValue: []
645
+ defaultValue: () => []
651
646
  }
652
647
  ]
653
648
  }
654
649
  ];
655
- const getFormConfig = (type, datasourceTypeList, configs) => {
650
+ const getFormConfig = (type, configs) => {
656
651
  switch (type) {
657
652
  case "base":
658
- return fillConfig$1([], datasourceTypeList);
653
+ return fillConfig$1([]);
659
654
  case "http":
660
- return fillConfig$1(HttpFormConfig, datasourceTypeList);
655
+ return fillConfig$1(HttpFormConfig);
661
656
  default:
662
- return fillConfig$1(configs[type] || [], datasourceTypeList);
657
+ return fillConfig$1(configs[type] || []);
663
658
  }
664
659
  };
665
660
  const getDisplayField = (dataSources, key) => {
@@ -839,7 +834,7 @@
839
834
  return this.state[name];
840
835
  }
841
836
  getFormConfig(type = "base") {
842
- return getFormConfig(type, this.get("datasourceTypeList"), this.get("configs"));
837
+ return getFormConfig(type, this.get("configs"));
843
838
  }
844
839
  setFormConfig(type, config) {
845
840
  this.get("configs")[type] = config;
@@ -2757,7 +2752,7 @@
2757
2752
  };
2758
2753
 
2759
2754
  const _hoisted_1$p = { class: "m-fields-code-select-col" };
2760
- const _hoisted_2$g = { class: "code-select-container" };
2755
+ const _hoisted_2$h = { class: "code-select-container" };
2761
2756
  const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
2762
2757
  ...{
2763
2758
  name: "MEditorCodeSelectCol"
@@ -2825,7 +2820,7 @@
2825
2820
  return (_ctx, _cache) => {
2826
2821
  const _component_m_form_container = vue.resolveComponent("m-form-container");
2827
2822
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
2828
- vue.createElementVNode("div", _hoisted_2$g, [
2823
+ vue.createElementVNode("div", _hoisted_2$h, [
2829
2824
  vue.createVNode(_component_m_form_container, {
2830
2825
  class: "select",
2831
2826
  config: selectConfig,
@@ -2861,7 +2856,7 @@
2861
2856
  });
2862
2857
 
2863
2858
  const _hoisted_1$o = { class: "m-editor-data-source-fields" };
2864
- const _hoisted_2$f = { class: "m-editor-data-source-fields-footer" };
2859
+ const _hoisted_2$g = { class: "m-editor-data-source-fields-footer" };
2865
2860
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
2866
2861
  ...{
2867
2862
  name: "MEditorDataSourceFields"
@@ -2881,9 +2876,11 @@
2881
2876
  emits: ["change"],
2882
2877
  setup(__props, { emit }) {
2883
2878
  const props = __props;
2879
+ const services = vue.inject("services");
2884
2880
  const addDialog = vue.ref();
2885
2881
  const fieldValues = vue.ref({});
2886
2882
  const filedTitle = vue.ref("");
2883
+ const width = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
2887
2884
  const newHandler = () => {
2888
2885
  fieldValues.value = {};
2889
2886
  filedTitle.value = "新增属性";
@@ -3016,7 +3013,7 @@
3016
3013
  data: _ctx.model[_ctx.name],
3017
3014
  columns: fieldColumns
3018
3015
  }, null, 8, ["data"]),
3019
- vue.createElementVNode("div", _hoisted_2$f, [
3016
+ vue.createElementVNode("div", _hoisted_2$g, [
3020
3017
  vue.createVNode(vue.unref(design.TMagicButton), {
3021
3018
  size: "small",
3022
3019
  type: "primary",
@@ -3039,8 +3036,9 @@
3039
3036
  values: fieldValues.value,
3040
3037
  parentValues: _ctx.model[_ctx.name],
3041
3038
  disabled: _ctx.disabled,
3039
+ width: width.value,
3042
3040
  onSubmit: fieldChange
3043
- }, null, 8, ["title", "values", "parentValues", "disabled"])
3041
+ }, null, 8, ["title", "values", "parentValues", "disabled", "width"])
3044
3042
  ]);
3045
3043
  };
3046
3044
  }
@@ -3094,7 +3092,7 @@
3094
3092
  });
3095
3093
 
3096
3094
  const _hoisted_1$n = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3097
- const _hoisted_2$e = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3095
+ const _hoisted_2$f = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3098
3096
  const _hoisted_3$5 = { class: "el-input__inner" };
3099
3097
  const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
3100
3098
  ...{
@@ -3141,6 +3139,7 @@
3141
3139
  const blurHandler = () => {
3142
3140
  isFocused.value = false;
3143
3141
  setDisplayState();
3142
+ emit("change", state.value);
3144
3143
  };
3145
3144
  const changeHandler = (v) => {
3146
3145
  emit("change", v);
@@ -3257,6 +3256,7 @@
3257
3256
  newSelectionStart = dotIndex + suggestText.length + 1;
3258
3257
  }
3259
3258
  input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
3259
+ changeHandler(state.value);
3260
3260
  };
3261
3261
  return (_ctx, _cache) => {
3262
3262
  return _ctx.disabled || isFocused.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(design.getConfig)("components")?.autocomplete.component || "el-autocomplete"), vue.mergeProps(
@@ -3278,7 +3278,6 @@
3278
3278
  {
3279
3279
  style: { "width": "100%" },
3280
3280
  onBlur: blurHandler,
3281
- onChange: changeHandler,
3282
3281
  onInput: inputHandler,
3283
3282
  onSelect: selectHandler
3284
3283
  }
@@ -3289,7 +3288,7 @@
3289
3288
  default: vue.withCtx(({ item }) => [
3290
3289
  vue.createElementVNode("div", _hoisted_1$n, [
3291
3290
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
3292
- vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(item.value), 1)
3291
+ vue.createElementVNode("span", _hoisted_2$f, vue.toDisplayString(item.value), 1)
3293
3292
  ])
3294
3293
  ]),
3295
3294
  _: 1
@@ -3403,7 +3402,7 @@
3403
3402
  };
3404
3403
 
3405
3404
  const _hoisted_1$m = { class: "m-editor-data-source-methods" };
3406
- const _hoisted_2$d = { class: "m-editor-data-source-methods-footer" };
3405
+ const _hoisted_2$e = { class: "m-editor-data-source-methods-footer" };
3407
3406
  const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
3408
3407
  ...{
3409
3408
  name: "MEditorDataSourceMethods"
@@ -3478,7 +3477,7 @@
3478
3477
  data: _ctx.model[_ctx.name],
3479
3478
  columns: methodColumns
3480
3479
  }, null, 8, ["data"]),
3481
- vue.createElementVNode("div", _hoisted_2$d, [
3480
+ vue.createElementVNode("div", _hoisted_2$e, [
3482
3481
  vue.createVNode(vue.unref(design.TMagicButton), {
3483
3482
  size: "small",
3484
3483
  type: "primary",
@@ -3507,7 +3506,7 @@
3507
3506
  });
3508
3507
 
3509
3508
  const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
3510
- const _hoisted_2$c = { class: "data-source-method-select-container" };
3509
+ const _hoisted_2$d = { class: "data-source-method-select-container" };
3511
3510
  const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
3512
3511
  ...{
3513
3512
  name: "MEditorDataSourceMethodSelect"
@@ -3587,7 +3586,7 @@
3587
3586
  return (_ctx, _cache) => {
3588
3587
  const _component_m_form_container = vue.resolveComponent("m-form-container");
3589
3588
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
3590
- vue.createElementVNode("div", _hoisted_2$c, [
3589
+ vue.createElementVNode("div", _hoisted_2$d, [
3591
3590
  vue.createVNode(_component_m_form_container, {
3592
3591
  class: "select",
3593
3592
  config: cascaderConfig,
@@ -3679,7 +3678,7 @@
3679
3678
  });
3680
3679
 
3681
3680
  const _hoisted_1$k = { class: "m-fields-event-select" };
3682
- const _hoisted_2$b = {
3681
+ const _hoisted_2$c = {
3683
3682
  key: 1,
3684
3683
  class: "fullWidth"
3685
3684
  };
@@ -3883,7 +3882,7 @@
3883
3882
  model: _ctx.model,
3884
3883
  config: tableConfig.value,
3885
3884
  onChange: onChangeHandler
3886
- }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
3885
+ }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
3887
3886
  vue.createVNode(vue.unref(design.TMagicButton), {
3888
3887
  class: "create-button",
3889
3888
  type: "primary",
@@ -3933,7 +3932,7 @@
3933
3932
  });
3934
3933
 
3935
3934
  const _hoisted_1$j = { class: "m-fields-key-value" };
3936
- const _hoisted_2$a = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
3935
+ const _hoisted_2$b = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
3937
3936
  const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
3938
3937
  ...{
3939
3938
  name: "MEditorKeyValue"
@@ -3993,7 +3992,7 @@
3993
3992
  size: _ctx.size,
3994
3993
  onChange: keyChangeHandler
3995
3994
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
3996
- _hoisted_2$a,
3995
+ _hoisted_2$b,
3997
3996
  vue.createVNode(vue.unref(design.TMagicInput), {
3998
3997
  placeholder: "value",
3999
3998
  modelValue: records.value[index][1],
@@ -4372,7 +4371,7 @@
4372
4371
  });
4373
4372
 
4374
4373
  const _hoisted_1$h = { class: "m-editor-empty-panel" };
4375
- const _hoisted_2$9 = { class: "m-editor-empty-content" };
4374
+ const _hoisted_2$a = { class: "m-editor-empty-content" };
4376
4375
  const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
4377
4376
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
4378
4377
  ...{
@@ -4395,7 +4394,7 @@
4395
4394
  };
4396
4395
  return (_ctx, _cache) => {
4397
4396
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
4398
- vue.createElementVNode("div", _hoisted_2$9, [
4397
+ vue.createElementVNode("div", _hoisted_2$a, [
4399
4398
  vue.createElementVNode("div", {
4400
4399
  class: "m-editor-empty-button",
4401
4400
  onClick: clickHandler
@@ -4546,7 +4545,7 @@
4546
4545
  key: 1,
4547
4546
  class: "menu-item-text"
4548
4547
  };
4549
- const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
4548
+ const _hoisted_2$9 = { class: "el-dropdown-link menubar-menu-button" };
4550
4549
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
4551
4550
  ...{
4552
4551
  name: "MEditorToolButton"
@@ -4690,7 +4689,7 @@
4690
4689
  })) : vue.createCommentVNode("", true)
4691
4690
  ]),
4692
4691
  default: vue.withCtx(() => [
4693
- vue.createElementVNode("span", _hoisted_2$8, [
4692
+ vue.createElementVNode("span", _hoisted_2$9, [
4694
4693
  vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
4695
4694
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
4696
4695
  default: vue.withCtx(() => [
@@ -4991,7 +4990,7 @@
4991
4990
  });
4992
4991
 
4993
4992
  const _hoisted_1$e = { xmlns: "http://www.w3.org/2000/svg" };
4994
- const _hoisted_2$7 = /* @__PURE__ */ vue.createElementVNode("g", {
4993
+ const _hoisted_2$8 = /* @__PURE__ */ vue.createElementVNode("g", {
4995
4994
  fill: "#7C878E",
4996
4995
  "fill-rule": "evenodd"
4997
4996
  }, [
@@ -5002,7 +5001,7 @@
5002
5001
  /* @__PURE__ */ vue.createElementVNode("path", { d: "M8 13.5L2.3 9.2 0.7 10.5 8 16 15.3 10.5 13.7 9.2z" })
5003
5002
  ], -1);
5004
5003
  const _hoisted_3$3 = [
5005
- _hoisted_2$7
5004
+ _hoisted_2$8
5006
5005
  ];
5007
5006
  const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
5008
5007
  ...{
@@ -5022,9 +5021,9 @@
5022
5021
  xmlns: "http://www.w3.org/2000/svg",
5023
5022
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
5024
5023
  };
5025
- const _hoisted_2$6 = /* @__PURE__ */ vue.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);
5024
+ const _hoisted_2$7 = /* @__PURE__ */ vue.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);
5026
5025
  const _hoisted_4$1 = [
5027
- _hoisted_2$6
5026
+ _hoisted_2$7
5028
5027
  ];
5029
5028
  const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
5030
5029
  ...{
@@ -5039,7 +5038,7 @@
5039
5038
  });
5040
5039
 
5041
5040
  const _hoisted_1$c = ["id"];
5042
- const _hoisted_2$5 = { class: "list-item" };
5041
+ const _hoisted_2$6 = { class: "list-item" };
5043
5042
  const _hoisted_3$2 = {
5044
5043
  key: 2,
5045
5044
  class: "right-tool"
@@ -5145,7 +5144,7 @@
5145
5144
  id: data.id,
5146
5145
  class: "list-container"
5147
5146
  }, [
5148
- vue.createElementVNode("div", _hoisted_2$5, [
5147
+ vue.createElementVNode("div", _hoisted_2$6, [
5149
5148
  data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
5150
5149
  key: 0,
5151
5150
  class: "codeIcon"
@@ -5235,7 +5234,8 @@
5235
5234
  vue.createTextVNode("新增")
5236
5235
  ]),
5237
5236
  _: 1
5238
- }, 8, ["onClick"])) : vue.createCommentVNode("", true)
5237
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
5238
+ vue.renderSlot(_ctx.$slots, "code-block-panel-search")
5239
5239
  ])
5240
5240
  ]),
5241
5241
  vue.createVNode(_sfc_main$k, {
@@ -5340,7 +5340,7 @@
5340
5340
  });
5341
5341
 
5342
5342
  const _hoisted_1$a = ["id"];
5343
- const _hoisted_2$4 = { class: "list-item" };
5343
+ const _hoisted_2$5 = { class: "list-item" };
5344
5344
  const _hoisted_3$1 = {
5345
5345
  key: 2,
5346
5346
  class: "right-tool"
@@ -5440,7 +5440,7 @@
5440
5440
  id: data.id,
5441
5441
  class: "list-container"
5442
5442
  }, [
5443
- vue.createElementVNode("div", _hoisted_2$4, [
5443
+ vue.createElementVNode("div", _hoisted_2$5, [
5444
5444
  data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$F, {
5445
5445
  key: 0,
5446
5446
  class: "codeIcon",
@@ -5499,6 +5499,7 @@
5499
5499
  });
5500
5500
 
5501
5501
  const _hoisted_1$9 = { class: "search-wrapper" };
5502
+ const _hoisted_2$4 = { class: "data-source-list-panel-add-menu" };
5502
5503
  const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
5503
5504
  ...{
5504
5505
  name: "MEditorDataSourceListPanel"
@@ -5508,11 +5509,22 @@
5508
5509
  const { dataSourceService } = vue.inject("services") || {};
5509
5510
  const editDialog = vue.ref();
5510
5511
  const dataSourceValues = vue.ref({});
5512
+ const dialogTitle = vue.ref("");
5511
5513
  const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
5512
- const addHandler = () => {
5514
+ const datasourceTypeList = vue.computed(
5515
+ () => [
5516
+ { text: "基础", type: "base" },
5517
+ { text: "HTTP", type: "http" }
5518
+ ].concat(dataSourceService?.get("datasourceTypeList") ?? [])
5519
+ );
5520
+ const addHandler = (type) => {
5513
5521
  if (!editDialog.value)
5514
5522
  return;
5515
- dataSourceValues.value = {};
5523
+ dataSourceValues.value = {
5524
+ type
5525
+ };
5526
+ const datasourceType = datasourceTypeList.value.find((item) => item.type === type);
5527
+ dialogTitle.value = `新增${datasourceType?.text || ""}`;
5516
5528
  editDialog.value.show();
5517
5529
  };
5518
5530
  const editHandler = (id) => {
@@ -5521,6 +5533,7 @@
5521
5533
  dataSourceValues.value = {
5522
5534
  ...dataSourceService?.getDataSourceById(id)
5523
5535
  };
5536
+ dialogTitle.value = `新增${dataSourceValues.value.title || ""}`;
5524
5537
  editDialog.value.show();
5525
5538
  };
5526
5539
  const removeHandler = (id) => {
@@ -5543,14 +5556,36 @@
5543
5556
  default: vue.withCtx(() => [
5544
5557
  vue.createElementVNode("div", _hoisted_1$9, [
5545
5558
  vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5546
- editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5559
+ editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
5547
5560
  key: 0,
5548
- type: "primary",
5549
- size: "small",
5550
- onClick: addHandler
5561
+ placement: "right"
5551
5562
  }, {
5563
+ reference: vue.withCtx(() => [
5564
+ vue.createVNode(vue.unref(design.TMagicButton), {
5565
+ type: "primary",
5566
+ size: "small"
5567
+ }, {
5568
+ default: vue.withCtx(() => [
5569
+ vue.createTextVNode("新增")
5570
+ ]),
5571
+ _: 1
5572
+ })
5573
+ ]),
5552
5574
  default: vue.withCtx(() => [
5553
- vue.createTextVNode("新增")
5575
+ vue.createElementVNode("div", _hoisted_2$4, [
5576
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
5577
+ return vue.openBlock(), vue.createBlock(_sfc_main$q, {
5578
+ data: {
5579
+ type: "button",
5580
+ text: item.text,
5581
+ handler: () => {
5582
+ addHandler(item.type);
5583
+ }
5584
+ },
5585
+ key: index
5586
+ }, null, 8, ["data"]);
5587
+ }), 128))
5588
+ ])
5554
5589
  ]),
5555
5590
  _: 1
5556
5591
  })) : vue.createCommentVNode("", true)
@@ -5564,7 +5599,7 @@
5564
5599
  ref: editDialog,
5565
5600
  disabled: !editable.value,
5566
5601
  values: dataSourceValues.value,
5567
- title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
5602
+ title: dialogTitle.value,
5568
5603
  onSubmit: submitDataSourceHandler
5569
5604
  }, null, 8, ["disabled", "values", "title"])
5570
5605
  ]),