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

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;
@@ -2315,12 +2310,14 @@
2315
2310
  const doc = stage?.renderer.contentWindow?.document;
2316
2311
  if (doc) {
2317
2312
  const el = doc.getElementById(`${node.id}`);
2318
- const parentEl = el?.offsetParent;
2313
+ const parentEl = layout === Layout.FIXED ? doc.body : el?.offsetParent;
2319
2314
  if (parentEl && el) {
2320
2315
  node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
2316
+ node.style.right = "";
2321
2317
  }
2322
2318
  } else if (parent.style && utils.isNumber(parent.style?.width) && utils.isNumber(node.style?.width)) {
2323
2319
  node.style.left = (parent.style.width - node.style.width) / 2;
2320
+ node.style.right = "";
2324
2321
  }
2325
2322
  return node;
2326
2323
  }
@@ -2432,21 +2429,43 @@
2432
2429
  if (!node || utils.isPage(node))
2433
2430
  return;
2434
2431
  const { style, id, type } = node;
2435
- if (!style || style.position !== "absolute")
2436
- return;
2437
- if (top && !utils.isNumber(style.top))
2432
+ if (!style || !["absolute", "fixed"].includes(style.position))
2438
2433
  return;
2439
- if (left && !utils.isNumber(style.left))
2440
- return;
2441
- this.update({
2434
+ const update = (style2) => this.update({
2442
2435
  id,
2443
2436
  type,
2444
- style: {
2445
- ...style,
2446
- left: Number(style.left) + left,
2447
- top: Number(style.top) + top
2448
- }
2437
+ style: style2
2449
2438
  });
2439
+ if (top) {
2440
+ if (utils.isNumber(style.top)) {
2441
+ update({
2442
+ ...style,
2443
+ top: Number(style.top) + Number(top),
2444
+ bottom: ""
2445
+ });
2446
+ } else if (utils.isNumber(style.bottom)) {
2447
+ update({
2448
+ ...style,
2449
+ bottom: Number(style.bottom) - Number(top),
2450
+ top: ""
2451
+ });
2452
+ }
2453
+ }
2454
+ if (left) {
2455
+ if (utils.isNumber(style.left)) {
2456
+ update({
2457
+ ...style,
2458
+ left: Number(style.left) + Number(left),
2459
+ right: ""
2460
+ });
2461
+ } else if (utils.isNumber(style.right)) {
2462
+ update({
2463
+ ...style,
2464
+ right: Number(style.right) - Number(left),
2465
+ left: ""
2466
+ });
2467
+ }
2468
+ }
2450
2469
  }
2451
2470
  resetState() {
2452
2471
  this.set("root", null);
@@ -2757,7 +2776,7 @@
2757
2776
  };
2758
2777
 
2759
2778
  const _hoisted_1$p = { class: "m-fields-code-select-col" };
2760
- const _hoisted_2$g = { class: "code-select-container" };
2779
+ const _hoisted_2$i = { class: "code-select-container" };
2761
2780
  const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
2762
2781
  ...{
2763
2782
  name: "MEditorCodeSelectCol"
@@ -2825,7 +2844,7 @@
2825
2844
  return (_ctx, _cache) => {
2826
2845
  const _component_m_form_container = vue.resolveComponent("m-form-container");
2827
2846
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$p, [
2828
- vue.createElementVNode("div", _hoisted_2$g, [
2847
+ vue.createElementVNode("div", _hoisted_2$i, [
2829
2848
  vue.createVNode(_component_m_form_container, {
2830
2849
  class: "select",
2831
2850
  config: selectConfig,
@@ -2861,7 +2880,7 @@
2861
2880
  });
2862
2881
 
2863
2882
  const _hoisted_1$o = { class: "m-editor-data-source-fields" };
2864
- const _hoisted_2$f = { class: "m-editor-data-source-fields-footer" };
2883
+ const _hoisted_2$h = { class: "m-editor-data-source-fields-footer" };
2865
2884
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
2866
2885
  ...{
2867
2886
  name: "MEditorDataSourceFields"
@@ -2881,9 +2900,11 @@
2881
2900
  emits: ["change"],
2882
2901
  setup(__props, { emit }) {
2883
2902
  const props = __props;
2903
+ const services = vue.inject("services");
2884
2904
  const addDialog = vue.ref();
2885
2905
  const fieldValues = vue.ref({});
2886
2906
  const filedTitle = vue.ref("");
2907
+ const width = vue.computed(() => globalThis.document.body.clientWidth - (services?.uiService.get("columnWidth").left || 0));
2887
2908
  const newHandler = () => {
2888
2909
  fieldValues.value = {};
2889
2910
  filedTitle.value = "新增属性";
@@ -3016,7 +3037,7 @@
3016
3037
  data: _ctx.model[_ctx.name],
3017
3038
  columns: fieldColumns
3018
3039
  }, null, 8, ["data"]),
3019
- vue.createElementVNode("div", _hoisted_2$f, [
3040
+ vue.createElementVNode("div", _hoisted_2$h, [
3020
3041
  vue.createVNode(vue.unref(design.TMagicButton), {
3021
3042
  size: "small",
3022
3043
  type: "primary",
@@ -3039,8 +3060,9 @@
3039
3060
  values: fieldValues.value,
3040
3061
  parentValues: _ctx.model[_ctx.name],
3041
3062
  disabled: _ctx.disabled,
3063
+ width: width.value,
3042
3064
  onSubmit: fieldChange
3043
- }, null, 8, ["title", "values", "parentValues", "disabled"])
3065
+ }, null, 8, ["title", "values", "parentValues", "disabled", "width"])
3044
3066
  ]);
3045
3067
  };
3046
3068
  }
@@ -3094,8 +3116,8 @@
3094
3116
  });
3095
3117
 
3096
3118
  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)" } };
3098
- const _hoisted_3$5 = { class: "el-input__inner" };
3119
+ const _hoisted_2$g = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3120
+ const _hoisted_3$6 = { class: "el-input__inner" };
3099
3121
  const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
3100
3122
  ...{
3101
3123
  name: "MEditorDataSourceInput"
@@ -3141,6 +3163,7 @@
3141
3163
  const blurHandler = () => {
3142
3164
  isFocused.value = false;
3143
3165
  setDisplayState();
3166
+ emit("change", state.value);
3144
3167
  };
3145
3168
  const changeHandler = (v) => {
3146
3169
  emit("change", v);
@@ -3257,6 +3280,7 @@
3257
3280
  newSelectionStart = dotIndex + suggestText.length + 1;
3258
3281
  }
3259
3282
  input.value?.setSelectionRange(newSelectionStart, newSelectionStart);
3283
+ changeHandler(state.value);
3260
3284
  };
3261
3285
  return (_ctx, _cache) => {
3262
3286
  return _ctx.disabled || isFocused.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(design.getConfig)("components")?.autocomplete.component || "el-autocomplete"), vue.mergeProps(
@@ -3278,7 +3302,6 @@
3278
3302
  {
3279
3303
  style: { "width": "100%" },
3280
3304
  onBlur: blurHandler,
3281
- onChange: changeHandler,
3282
3305
  onInput: inputHandler,
3283
3306
  onSelect: selectHandler
3284
3307
  }
@@ -3289,7 +3312,7 @@
3289
3312
  default: vue.withCtx(({ item }) => [
3290
3313
  vue.createElementVNode("div", _hoisted_1$n, [
3291
3314
  vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
3292
- vue.createElementVNode("span", _hoisted_2$e, vue.toDisplayString(item.value), 1)
3315
+ vue.createElementVNode("span", _hoisted_2$g, vue.toDisplayString(item.value), 1)
3293
3316
  ])
3294
3317
  ]),
3295
3318
  _: 1
@@ -3301,7 +3324,7 @@
3301
3324
  vue.createElementVNode("div", {
3302
3325
  class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
3303
3326
  }, [
3304
- vue.createElementVNode("div", _hoisted_3$5, [
3327
+ vue.createElementVNode("div", _hoisted_3$6, [
3305
3328
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
3306
3329
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3307
3330
  item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
@@ -3403,7 +3426,7 @@
3403
3426
  };
3404
3427
 
3405
3428
  const _hoisted_1$m = { class: "m-editor-data-source-methods" };
3406
- const _hoisted_2$d = { class: "m-editor-data-source-methods-footer" };
3429
+ const _hoisted_2$f = { class: "m-editor-data-source-methods-footer" };
3407
3430
  const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
3408
3431
  ...{
3409
3432
  name: "MEditorDataSourceMethods"
@@ -3478,7 +3501,7 @@
3478
3501
  data: _ctx.model[_ctx.name],
3479
3502
  columns: methodColumns
3480
3503
  }, null, 8, ["data"]),
3481
- vue.createElementVNode("div", _hoisted_2$d, [
3504
+ vue.createElementVNode("div", _hoisted_2$f, [
3482
3505
  vue.createVNode(vue.unref(design.TMagicButton), {
3483
3506
  size: "small",
3484
3507
  type: "primary",
@@ -3507,7 +3530,7 @@
3507
3530
  });
3508
3531
 
3509
3532
  const _hoisted_1$l = { class: "m-fields-data-source-method-select" };
3510
- const _hoisted_2$c = { class: "data-source-method-select-container" };
3533
+ const _hoisted_2$e = { class: "data-source-method-select-container" };
3511
3534
  const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
3512
3535
  ...{
3513
3536
  name: "MEditorDataSourceMethodSelect"
@@ -3587,7 +3610,7 @@
3587
3610
  return (_ctx, _cache) => {
3588
3611
  const _component_m_form_container = vue.resolveComponent("m-form-container");
3589
3612
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
3590
- vue.createElementVNode("div", _hoisted_2$c, [
3613
+ vue.createElementVNode("div", _hoisted_2$e, [
3591
3614
  vue.createVNode(_component_m_form_container, {
3592
3615
  class: "select",
3593
3616
  config: cascaderConfig,
@@ -3679,7 +3702,7 @@
3679
3702
  });
3680
3703
 
3681
3704
  const _hoisted_1$k = { class: "m-fields-event-select" };
3682
- const _hoisted_2$b = {
3705
+ const _hoisted_2$d = {
3683
3706
  key: 1,
3684
3707
  class: "fullWidth"
3685
3708
  };
@@ -3883,7 +3906,7 @@
3883
3906
  model: _ctx.model,
3884
3907
  config: tableConfig.value,
3885
3908
  onChange: onChangeHandler
3886
- }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$b, [
3909
+ }, null, 8, ["size", "disabled", "model", "config"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
3887
3910
  vue.createVNode(vue.unref(design.TMagicButton), {
3888
3911
  class: "create-button",
3889
3912
  type: "primary",
@@ -3933,7 +3956,7 @@
3933
3956
  });
3934
3957
 
3935
3958
  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);
3959
+ const _hoisted_2$c = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
3937
3960
  const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
3938
3961
  ...{
3939
3962
  name: "MEditorKeyValue"
@@ -3993,7 +4016,7 @@
3993
4016
  size: _ctx.size,
3994
4017
  onChange: keyChangeHandler
3995
4018
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
3996
- _hoisted_2$a,
4019
+ _hoisted_2$c,
3997
4020
  vue.createVNode(vue.unref(design.TMagicInput), {
3998
4021
  placeholder: "value",
3999
4022
  modelValue: records.value[index][1],
@@ -4372,8 +4395,8 @@
4372
4395
  });
4373
4396
 
4374
4397
  const _hoisted_1$h = { class: "m-editor-empty-panel" };
4375
- const _hoisted_2$9 = { class: "m-editor-empty-content" };
4376
- const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
4398
+ const _hoisted_2$b = { class: "m-editor-empty-content" };
4399
+ const _hoisted_3$5 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
4377
4400
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
4378
4401
  ...{
4379
4402
  name: "MEditorAddPageBox"
@@ -4395,7 +4418,7 @@
4395
4418
  };
4396
4419
  return (_ctx, _cache) => {
4397
4420
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
4398
- vue.createElementVNode("div", _hoisted_2$9, [
4421
+ vue.createElementVNode("div", _hoisted_2$b, [
4399
4422
  vue.createElementVNode("div", {
4400
4423
  class: "m-editor-empty-button",
4401
4424
  onClick: clickHandler
@@ -4403,7 +4426,7 @@
4403
4426
  vue.createElementVNode("div", null, [
4404
4427
  vue.createVNode(_sfc_main$F, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
4405
4428
  ]),
4406
- _hoisted_3$4
4429
+ _hoisted_3$5
4407
4430
  ])
4408
4431
  ])
4409
4432
  ]);
@@ -4546,7 +4569,7 @@
4546
4569
  key: 1,
4547
4570
  class: "menu-item-text"
4548
4571
  };
4549
- const _hoisted_2$8 = { class: "el-dropdown-link menubar-menu-button" };
4572
+ const _hoisted_2$a = { class: "el-dropdown-link menubar-menu-button" };
4550
4573
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
4551
4574
  ...{
4552
4575
  name: "MEditorToolButton"
@@ -4690,7 +4713,7 @@
4690
4713
  })) : vue.createCommentVNode("", true)
4691
4714
  ]),
4692
4715
  default: vue.withCtx(() => [
4693
- vue.createElementVNode("span", _hoisted_2$8, [
4716
+ vue.createElementVNode("span", _hoisted_2$a, [
4694
4717
  vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
4695
4718
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
4696
4719
  default: vue.withCtx(() => [
@@ -4991,7 +5014,7 @@
4991
5014
  });
4992
5015
 
4993
5016
  const _hoisted_1$e = { xmlns: "http://www.w3.org/2000/svg" };
4994
- const _hoisted_2$7 = /* @__PURE__ */ vue.createElementVNode("g", {
5017
+ const _hoisted_2$9 = /* @__PURE__ */ vue.createElementVNode("g", {
4995
5018
  fill: "#7C878E",
4996
5019
  "fill-rule": "evenodd"
4997
5020
  }, [
@@ -5001,8 +5024,8 @@
5001
5024
  }),
5002
5025
  /* @__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
5026
  ], -1);
5004
- const _hoisted_3$3 = [
5005
- _hoisted_2$7
5027
+ const _hoisted_3$4 = [
5028
+ _hoisted_2$9
5006
5029
  ];
5007
5030
  const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
5008
5031
  ...{
@@ -5011,7 +5034,7 @@
5011
5034
  __name: "AppManageIcon",
5012
5035
  setup(__props) {
5013
5036
  return (_ctx, _cache) => {
5014
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$e, _hoisted_3$3);
5037
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$e, _hoisted_3$4);
5015
5038
  };
5016
5039
  }
5017
5040
  });
@@ -5022,9 +5045,9 @@
5022
5045
  xmlns: "http://www.w3.org/2000/svg",
5023
5046
  "xmlns:xlink": "http://www.w3.org/1999/xlink"
5024
5047
  };
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);
5026
- const _hoisted_4$1 = [
5027
- _hoisted_2$6
5048
+ const _hoisted_2$8 = /* @__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);
5049
+ const _hoisted_4$2 = [
5050
+ _hoisted_2$8
5028
5051
  ];
5029
5052
  const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
5030
5053
  ...{
@@ -5033,14 +5056,14 @@
5033
5056
  __name: "CodeIcon",
5034
5057
  setup(__props) {
5035
5058
  return (_ctx, _cache) => {
5036
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_4$1);
5059
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_4$2);
5037
5060
  };
5038
5061
  }
5039
5062
  });
5040
5063
 
5041
5064
  const _hoisted_1$c = ["id"];
5042
- const _hoisted_2$5 = { class: "list-item" };
5043
- const _hoisted_3$2 = {
5065
+ const _hoisted_2$7 = { class: "list-item" };
5066
+ const _hoisted_3$3 = {
5044
5067
  key: 2,
5045
5068
  class: "right-tool"
5046
5069
  };
@@ -5145,7 +5168,7 @@
5145
5168
  id: data.id,
5146
5169
  class: "list-container"
5147
5170
  }, [
5148
- vue.createElementVNode("div", _hoisted_2$5, [
5171
+ vue.createElementVNode("div", _hoisted_2$7, [
5149
5172
  data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
5150
5173
  key: 0,
5151
5174
  class: "codeIcon"
@@ -5157,7 +5180,7 @@
5157
5180
  vue.createElementVNode("span", {
5158
5181
  class: vue.normalizeClass(["name", { code: data.type === "code", hook: data.type === "key" }])
5159
5182
  }, vue.toDisplayString(data.name) + " (" + vue.toDisplayString(data.id) + ")", 3),
5160
- data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
5183
+ data.type === "code" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
5161
5184
  vue.createVNode(vue.unref(design.TMagicTooltip), {
5162
5185
  effect: "dark",
5163
5186
  content: editable.value ? "编辑" : "查看",
@@ -5235,7 +5258,8 @@
5235
5258
  vue.createTextVNode("新增")
5236
5259
  ]),
5237
5260
  _: 1
5238
- }, 8, ["onClick"])) : vue.createCommentVNode("", true)
5261
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
5262
+ vue.renderSlot(_ctx.$slots, "code-block-panel-search")
5239
5263
  ])
5240
5264
  ]),
5241
5265
  vue.createVNode(_sfc_main$k, {
@@ -5340,8 +5364,8 @@
5340
5364
  });
5341
5365
 
5342
5366
  const _hoisted_1$a = ["id"];
5343
- const _hoisted_2$4 = { class: "list-item" };
5344
- const _hoisted_3$1 = {
5367
+ const _hoisted_2$6 = { class: "list-item" };
5368
+ const _hoisted_3$2 = {
5345
5369
  key: 2,
5346
5370
  class: "right-tool"
5347
5371
  };
@@ -5440,7 +5464,7 @@
5440
5464
  id: data.id,
5441
5465
  class: "list-container"
5442
5466
  }, [
5443
- vue.createElementVNode("div", _hoisted_2$4, [
5467
+ vue.createElementVNode("div", _hoisted_2$6, [
5444
5468
  data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$F, {
5445
5469
  key: 0,
5446
5470
  class: "codeIcon",
@@ -5454,7 +5478,7 @@
5454
5478
  vue.createElementVNode("span", {
5455
5479
  class: vue.normalizeClass(["name", { code: data.type === "ds", hook: data.type === "key" }])
5456
5480
  }, vue.toDisplayString(data.type === "key" ? data.name : `${data.name}(${data.id})`), 3),
5457
- data.type === "ds" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
5481
+ data.type === "ds" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
5458
5482
  vue.createVNode(vue.unref(design.TMagicTooltip), {
5459
5483
  effect: "dark",
5460
5484
  content: editable.value ? "编辑" : "查看",
@@ -5499,6 +5523,7 @@
5499
5523
  });
5500
5524
 
5501
5525
  const _hoisted_1$9 = { class: "search-wrapper" };
5526
+ const _hoisted_2$5 = { class: "data-source-list-panel-add-menu" };
5502
5527
  const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
5503
5528
  ...{
5504
5529
  name: "MEditorDataSourceListPanel"
@@ -5508,11 +5533,22 @@
5508
5533
  const { dataSourceService } = vue.inject("services") || {};
5509
5534
  const editDialog = vue.ref();
5510
5535
  const dataSourceValues = vue.ref({});
5536
+ const dialogTitle = vue.ref("");
5511
5537
  const editable = vue.computed(() => dataSourceService?.get("editable") ?? true);
5512
- const addHandler = () => {
5538
+ const datasourceTypeList = vue.computed(
5539
+ () => [
5540
+ { text: "基础", type: "base" },
5541
+ { text: "HTTP", type: "http" }
5542
+ ].concat(dataSourceService?.get("datasourceTypeList") ?? [])
5543
+ );
5544
+ const addHandler = (type) => {
5513
5545
  if (!editDialog.value)
5514
5546
  return;
5515
- dataSourceValues.value = {};
5547
+ dataSourceValues.value = {
5548
+ type
5549
+ };
5550
+ const datasourceType = datasourceTypeList.value.find((item) => item.type === type);
5551
+ dialogTitle.value = `新增${datasourceType?.text || ""}`;
5516
5552
  editDialog.value.show();
5517
5553
  };
5518
5554
  const editHandler = (id) => {
@@ -5521,6 +5557,7 @@
5521
5557
  dataSourceValues.value = {
5522
5558
  ...dataSourceService?.getDataSourceById(id)
5523
5559
  };
5560
+ dialogTitle.value = `新增${dataSourceValues.value.title || ""}`;
5524
5561
  editDialog.value.show();
5525
5562
  };
5526
5563
  const removeHandler = (id) => {
@@ -5543,14 +5580,36 @@
5543
5580
  default: vue.withCtx(() => [
5544
5581
  vue.createElementVNode("div", _hoisted_1$9, [
5545
5582
  vue.createVNode(_sfc_main$n, { onSearch: filterTextChangeHandler }),
5546
- editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5583
+ editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
5547
5584
  key: 0,
5548
- type: "primary",
5549
- size: "small",
5550
- onClick: addHandler
5585
+ placement: "right"
5551
5586
  }, {
5587
+ reference: vue.withCtx(() => [
5588
+ vue.createVNode(vue.unref(design.TMagicButton), {
5589
+ type: "primary",
5590
+ size: "small"
5591
+ }, {
5592
+ default: vue.withCtx(() => [
5593
+ vue.createTextVNode("新增")
5594
+ ]),
5595
+ _: 1
5596
+ })
5597
+ ]),
5552
5598
  default: vue.withCtx(() => [
5553
- vue.createTextVNode("新增")
5599
+ vue.createElementVNode("div", _hoisted_2$5, [
5600
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
5601
+ return vue.openBlock(), vue.createBlock(_sfc_main$q, {
5602
+ data: {
5603
+ type: "button",
5604
+ text: item.text,
5605
+ handler: () => {
5606
+ addHandler(item.type);
5607
+ }
5608
+ },
5609
+ key: index
5610
+ }, null, 8, ["data"]);
5611
+ }), 128))
5612
+ ])
5554
5613
  ]),
5555
5614
  _: 1
5556
5615
  })) : vue.createCommentVNode("", true)
@@ -5564,7 +5623,7 @@
5564
5623
  ref: editDialog,
5565
5624
  disabled: !editable.value,
5566
5625
  values: dataSourceValues.value,
5567
- title: typeof dataSourceValues.value.id !== "undefined" ? `编辑${dataSourceValues.value.title}` : "新增",
5626
+ title: dialogTitle.value,
5568
5627
  onSubmit: submitDataSourceHandler
5569
5628
  }, null, 8, ["disabled", "values", "title"])
5570
5629
  ]),
@@ -5575,7 +5634,7 @@
5575
5634
  });
5576
5635
 
5577
5636
  const _hoisted_1$8 = ["onClick", "onDragstart"];
5578
- const _hoisted_2$3 = ["title"];
5637
+ const _hoisted_2$4 = ["title"];
5579
5638
  const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
5580
5639
  ...{
5581
5640
  name: "MEditorComponentListPanel"
@@ -5684,7 +5743,7 @@
5684
5743
  }, null, 8, ["title", "icon"]),
5685
5744
  vue.createElementVNode("span", {
5686
5745
  title: item.text
5687
- }, vue.toDisplayString(item.text), 9, _hoisted_2$3)
5746
+ }, vue.toDisplayString(item.text), 9, _hoisted_2$4)
5688
5747
  ])
5689
5748
  ], 40, _hoisted_1$8);
5690
5749
  }), 128))
@@ -6352,6 +6411,12 @@
6352
6411
  });
6353
6412
 
6354
6413
  const _hoisted_1$5 = {
6414
+ key: 0,
6415
+ class: "m-editor-sidebar"
6416
+ };
6417
+ const _hoisted_2$3 = { class: "m-editor-sidebar-header" };
6418
+ const _hoisted_3$1 = ["onClick"];
6419
+ const _hoisted_4$1 = {
6355
6420
  key: 1,
6356
6421
  class: "magic-editor-tab-panel-title"
6357
6422
  };
@@ -6366,8 +6431,6 @@
6366
6431
  },
6367
6432
  setup(__props, { expose: __expose }) {
6368
6433
  const props = __props;
6369
- const tabPaneComponent = design.getConfig("components")?.tabPane;
6370
- const tabsComponent = design.getConfig("components")?.tabs;
6371
6434
  const activeTabName = vue.ref(props.data?.status);
6372
6435
  const getItemConfig = (data) => {
6373
6436
  const map = {
@@ -6420,98 +6483,94 @@
6420
6483
  activeTabName
6421
6484
  });
6422
6485
  return (_ctx, _cache) => {
6423
- return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabsComponent)?.component || "el-tabs"), vue.mergeProps({
6424
- key: 0,
6425
- modelValue: activeTabName.value,
6426
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
6427
- class: "m-editor-sidebar tmagic-design-tabs"
6428
- }, vue.unref(tabsComponent)?.props({ type: "card", tabPosition: "left" }) || {}), {
6429
- default: vue.withCtx(() => [
6486
+ return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
6487
+ vue.createElementVNode("div", _hoisted_2$3, [
6430
6488
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
6431
- return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tabPaneComponent)?.component || "el-tab-pane"), vue.mergeProps(vue.unref(tabPaneComponent)?.props({ name: config.text, lazy: config.lazy }) || {}, {
6432
- key: config.$key || index
6433
- }), {
6434
- label: vue.withCtx(() => [
6435
- (vue.openBlock(), vue.createElementBlock("div", {
6436
- key: config.text
6437
- }, [
6438
- config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$F, {
6439
- key: 0,
6440
- icon: config.icon
6441
- }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
6442
- config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
6443
- ]))
6444
- ]),
6445
- default: vue.withCtx(() => [
6446
- config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
6447
- config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
6448
- name: "component-list-panel-header",
6449
- fn: vue.withCtx(() => [
6450
- config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6451
- ]),
6452
- key: "0"
6453
- } : void 0,
6454
- config.$key === "component-list" || config.slots?.componentListItem ? {
6455
- name: "component-list-item",
6456
- fn: vue.withCtx(({ component }) => [
6457
- config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
6458
- key: 0,
6459
- component
6460
- }) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
6461
- key: 1,
6462
- component
6463
- }, null, 8, ["component"])) : vue.createCommentVNode("", true)
6464
- ]),
6465
- key: "1"
6466
- } : void 0,
6467
- config.$key === "layer" || config.slots?.layerPanelHeader ? {
6468
- name: "layer-panel-header",
6469
- fn: vue.withCtx(() => [
6470
- config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6471
- ]),
6472
- key: "2"
6473
- } : void 0,
6474
- config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
6475
- name: "code-block-panel-header",
6476
- fn: vue.withCtx(() => [
6477
- config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6478
- ]),
6479
- key: "3"
6480
- } : void 0,
6481
- config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
6482
- name: "code-block-panel-tool",
6483
- fn: vue.withCtx(({ id, data }) => [
6484
- config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
6485
- key: 0,
6486
- id,
6487
- data
6488
- }) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
6489
- ]),
6490
- key: "4"
6491
- } : void 0,
6492
- config.$key === "layer" || config.slots?.layerNodeContent ? {
6493
- name: "layer-node-content",
6494
- fn: vue.withCtx(({ data: nodeData, node }) => [
6495
- config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
6496
- key: 0,
6497
- data: nodeData,
6498
- node
6499
- }) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
6500
- key: 1,
6501
- data: nodeData,
6502
- node
6503
- }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
6504
- ]),
6505
- key: "5"
6506
- } : void 0
6507
- ]), 1040)) : vue.createCommentVNode("", true)
6508
- ]),
6509
- _: 2
6510
- }, 1040);
6489
+ return vue.openBlock(), vue.createElementBlock("div", {
6490
+ class: vue.normalizeClass(["m-editor-sidebar-header-item", { "is-active": activeTabName.value === config.text }]),
6491
+ key: config.$key ?? index,
6492
+ onClick: ($event) => activeTabName.value = config.text || `${index}`
6493
+ }, [
6494
+ config.icon ? (vue.openBlock(), vue.createBlock(_sfc_main$F, {
6495
+ key: 0,
6496
+ icon: config.icon
6497
+ }, null, 8, ["icon"])) : vue.createCommentVNode("", true),
6498
+ config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
6499
+ ], 10, _hoisted_3$1);
6511
6500
  }), 128))
6512
6501
  ]),
6513
- _: 3
6514
- }, 16, ["modelValue"])) : vue.createCommentVNode("", true);
6502
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(sideBarItems.value, (config, index) => {
6503
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
6504
+ class: "m-editor-sidebar-content",
6505
+ key: config.$key ?? index
6506
+ }, [
6507
+ config ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.component), vue.mergeProps({ key: 0 }, config.props || {}, vue.toHandlers(config?.listeners || {})), vue.createSlots({ _: 2 }, [
6508
+ config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
6509
+ name: "component-list-panel-header",
6510
+ fn: vue.withCtx(() => [
6511
+ config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6512
+ ]),
6513
+ key: "0"
6514
+ } : void 0,
6515
+ config.$key === "component-list" || config.slots?.componentListItem ? {
6516
+ name: "component-list-item",
6517
+ fn: vue.withCtx(({ component }) => [
6518
+ config.$key === "component-list" ? vue.renderSlot(_ctx.$slots, "component-list-item", {
6519
+ key: 0,
6520
+ component
6521
+ }) : config.slots?.componentListItem ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.componentListItem), {
6522
+ key: 1,
6523
+ component
6524
+ }, null, 8, ["component"])) : vue.createCommentVNode("", true)
6525
+ ]),
6526
+ key: "1"
6527
+ } : void 0,
6528
+ config.$key === "layer" || config.slots?.layerPanelHeader ? {
6529
+ name: "layer-panel-header",
6530
+ fn: vue.withCtx(() => [
6531
+ config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6532
+ ]),
6533
+ key: "2"
6534
+ } : void 0,
6535
+ config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
6536
+ name: "code-block-panel-header",
6537
+ fn: vue.withCtx(() => [
6538
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : vue.createCommentVNode("", true)
6539
+ ]),
6540
+ key: "3"
6541
+ } : void 0,
6542
+ config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
6543
+ name: "code-block-panel-tool",
6544
+ fn: vue.withCtx(({ id, data }) => [
6545
+ config.$key === "code-block" ? vue.renderSlot(_ctx.$slots, "code-block-panel-tool", {
6546
+ key: 0,
6547
+ id,
6548
+ data
6549
+ }) : config.slots?.codeBlockPanelTool ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : vue.createCommentVNode("", true)
6550
+ ]),
6551
+ key: "4"
6552
+ } : void 0,
6553
+ config.$key === "layer" || config.slots?.layerNodeContent ? {
6554
+ name: "layer-node-content",
6555
+ fn: vue.withCtx(({ data: nodeData, node }) => [
6556
+ config.$key === "layer" ? vue.renderSlot(_ctx.$slots, "layer-node-content", {
6557
+ key: 0,
6558
+ data: nodeData,
6559
+ node
6560
+ }) : config.slots?.layerNodeContent ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(config.slots.layerNodeContent), {
6561
+ key: 1,
6562
+ data: nodeData,
6563
+ node
6564
+ }, null, 8, ["data", "node"])) : vue.createCommentVNode("", true)
6565
+ ]),
6566
+ key: "5"
6567
+ } : void 0
6568
+ ]), 1040)) : vue.createCommentVNode("", true)
6569
+ ])), [
6570
+ [vue.vShow, activeTabName.value === config.text]
6571
+ ]);
6572
+ }), 128))
6573
+ ])) : vue.createCommentVNode("", true);
6515
6574
  };
6516
6575
  }
6517
6576
  });