@tmagic/editor 1.3.3 → 1.3.5

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.
@@ -413,7 +413,7 @@
413
413
 
414
414
  const _hoisted_1$w = { style: { "display": "flex", "margin-bottom": "10px" } };
415
415
  const _hoisted_2$p = { style: { "flex": "1" } };
416
- const _hoisted_3$b = { style: { "flex": "1" } };
416
+ const _hoisted_3$c = { style: { "flex": "1" } };
417
417
  const _hoisted_4$7 = { class: "dialog-footer" };
418
418
  const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
419
419
  ...{
@@ -671,7 +671,7 @@
671
671
  _: 1
672
672
  })
673
673
  ]),
674
- vue.createElementVNode("div", _hoisted_3$b, [
674
+ vue.createElementVNode("div", _hoisted_3$c, [
675
675
  vue.createVNode(vue.unref(design.TMagicTag), {
676
676
  size: "small",
677
677
  type: "success"
@@ -776,6 +776,7 @@
776
776
  name: "data",
777
777
  type: "key-value",
778
778
  defaultValue: {},
779
+ advanced: true,
779
780
  text: "请求体"
780
781
  },
781
782
  {
@@ -2537,7 +2538,9 @@
2537
2538
  async update(config) {
2538
2539
  const nodes = Array.isArray(config) ? config : [config];
2539
2540
  const newNodes = await Promise.all(nodes.map((node) => this.doUpdate(node)));
2540
- this.pushHistoryState();
2541
+ if (newNodes[0]?.type !== schema.NodeType.ROOT) {
2542
+ this.pushHistoryState();
2543
+ }
2541
2544
  this.emit("update", newNodes);
2542
2545
  return Array.isArray(config) ? newNodes : newNodes[0];
2543
2546
  }
@@ -3290,7 +3293,7 @@
3290
3293
  },
3291
3294
  {
3292
3295
  label: "属性描述",
3293
- prop: "desc"
3296
+ prop: "description"
3294
3297
  },
3295
3298
  {
3296
3299
  label: "默认值",
@@ -3421,6 +3424,7 @@
3421
3424
  data: {}
3422
3425
  });
3423
3426
  const newFromJsonHandler = () => {
3427
+ jsonFromValues.value.data = utils.getDefaultValueFromFields(props.model[props.name]);
3424
3428
  addFromJsonDialog.value?.show();
3425
3429
  };
3426
3430
  const getValueType = (value) => {
@@ -3438,33 +3442,35 @@
3438
3442
  return "string";
3439
3443
  return "any";
3440
3444
  };
3441
- const getFieldsConfig = (value) => {
3445
+ const getFieldsConfig = (value, fields = []) => {
3442
3446
  if (!value || typeof value !== "object")
3443
3447
  throw new Error("数据格式错误");
3444
- const fields = [];
3448
+ const newFields = [];
3445
3449
  Object.entries(value).forEach(([key, value2]) => {
3446
3450
  const type = getValueType(value2);
3451
+ const oldField = fields.find((field) => field.name === key);
3447
3452
  let childFields = [];
3448
3453
  if (Array.isArray(value2) && value2.length > 0) {
3449
- childFields = getFieldsConfig(value2[0]);
3454
+ childFields = getFieldsConfig(value2[0], oldField?.fields);
3450
3455
  } else if (type === "object") {
3451
- childFields = getFieldsConfig(value2);
3456
+ childFields = getFieldsConfig(value2, oldField?.fields);
3452
3457
  }
3453
- fields.push({
3458
+ newFields.push({
3454
3459
  name: key,
3455
- title: key,
3460
+ title: oldField?.title || key,
3456
3461
  type,
3462
+ description: oldField?.description || "",
3463
+ enable: oldField?.enable ?? true,
3457
3464
  defaultValue: value2,
3458
3465
  fields: childFields
3459
3466
  });
3460
3467
  });
3461
- return fields;
3468
+ return newFields;
3462
3469
  };
3463
3470
  const addFromJsonFromChange = ({ data }) => {
3464
- console.log(data);
3465
3471
  try {
3466
3472
  const value = JSON.parse(data);
3467
- props.model[props.name] = getFieldsConfig(value);
3473
+ props.model[props.name] = getFieldsConfig(value, props.model[props.name]);
3468
3474
  addFromJsonDialog.value?.hide();
3469
3475
  emit("change", props.model[props.name]);
3470
3476
  } catch (e) {
@@ -3586,7 +3592,7 @@
3586
3592
 
3587
3593
  const _hoisted_1$s = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
3588
3594
  const _hoisted_2$m = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
3589
- const _hoisted_3$a = { class: "el-input__inner" };
3595
+ const _hoisted_3$b = { class: "el-input__inner" };
3590
3596
  const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
3591
3597
  ...{
3592
3598
  name: "MEditorDataSourceInput"
@@ -3794,7 +3800,7 @@
3794
3800
  vue.createElementVNode("div", {
3795
3801
  class: vue.normalizeClass(`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused.value ? " is-focus" : ""}`)
3796
3802
  }, [
3797
- vue.createElementVNode("div", _hoisted_3$a, [
3803
+ vue.createElementVNode("div", _hoisted_3$b, [
3798
3804
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(displayState.value, (item, index) => {
3799
3805
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3800
3806
  item.type === "text" ? (vue.openBlock(), vue.createElementBlock("span", {
@@ -4682,9 +4688,32 @@
4682
4688
  }
4683
4689
  });
4684
4690
 
4685
- const _hoisted_1$n = { class: "m-fields-key-value" };
4686
- const _hoisted_2$h = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
4691
+ const _hoisted_1$n = {
4692
+ viewBox: "0 0 32 32",
4693
+ version: "1.1",
4694
+ xmlns: "http://www.w3.org/2000/svg",
4695
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
4696
+ };
4697
+ const _hoisted_2$h = /* @__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);
4698
+ const _hoisted_4$6 = [
4699
+ _hoisted_2$h
4700
+ ];
4687
4701
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
4702
+ ...{
4703
+ name: "MEditorCodeIcon"
4704
+ },
4705
+ __name: "CodeIcon",
4706
+ setup(__props) {
4707
+ return (_ctx, _cache) => {
4708
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$n, _hoisted_4$6);
4709
+ };
4710
+ }
4711
+ });
4712
+
4713
+ const _hoisted_1$m = { class: "m-fields-key-value" };
4714
+ const _hoisted_2$g = { key: 0 };
4715
+ const _hoisted_3$a = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
4716
+ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
4688
4717
  ...{
4689
4718
  name: "MEditorKeyValue"
4690
4719
  },
@@ -4705,8 +4734,16 @@
4705
4734
  const props = __props;
4706
4735
  const emit = __emit;
4707
4736
  const records = vue.ref([]);
4737
+ const showCode = vue.ref(false);
4708
4738
  vue.watchEffect(() => {
4709
- records.value = Object.entries(props.model[props.name] || {});
4739
+ const initValues = Object.entries(props.model[props.name] || {});
4740
+ for (const [, value] of initValues) {
4741
+ if (typeof value !== "string") {
4742
+ showCode.value = true;
4743
+ break;
4744
+ }
4745
+ }
4746
+ records.value = initValues;
4710
4747
  });
4711
4748
  const getValue = () => {
4712
4749
  const record = {};
@@ -4730,66 +4767,90 @@
4730
4767
  records.value.splice(index, 1);
4731
4768
  emit("change", getValue());
4732
4769
  };
4770
+ const save = (v) => {
4771
+ emit("change", v);
4772
+ };
4733
4773
  return (_ctx, _cache) => {
4734
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
4735
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
4736
- return vue.openBlock(), vue.createElementBlock("div", {
4737
- class: "m-fields-key-value-item",
4738
- key: index
4739
- }, [
4740
- vue.createVNode(vue.unref(design.TMagicInput), {
4741
- placeholder: "key",
4742
- modelValue: records.value[index][0],
4743
- "onUpdate:modelValue": ($event) => records.value[index][0] = $event,
4744
- disabled: _ctx.disabled,
4745
- size: _ctx.size,
4746
- onChange: keyChangeHandler
4747
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
4748
- _hoisted_2$h,
4749
- vue.createVNode(vue.unref(design.TMagicInput), {
4750
- placeholder: "value",
4751
- modelValue: records.value[index][1],
4752
- "onUpdate:modelValue": ($event) => records.value[index][1] = $event,
4753
- disabled: _ctx.disabled,
4754
- size: _ctx.size,
4755
- onChange: valueChangeHandler
4756
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
4757
- vue.createVNode(vue.unref(design.TMagicButton), {
4758
- class: "m-fileds-key-value-delete",
4759
- type: "danger",
4760
- size: _ctx.size,
4761
- disabled: _ctx.disabled,
4762
- circle: "",
4763
- plain: "",
4764
- icon: vue.unref(iconsVue.Delete),
4765
- onClick: ($event) => deleteHandler(index)
4766
- }, null, 8, ["size", "disabled", "icon", "onClick"])
4767
- ]);
4768
- }), 128)),
4769
- vue.createVNode(vue.unref(design.TMagicButton), {
4770
- type: "primary",
4771
- size: _ctx.size,
4774
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
4775
+ !showCode.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$g, [
4776
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
4777
+ return vue.openBlock(), vue.createElementBlock("div", {
4778
+ class: "m-fields-key-value-item",
4779
+ key: index
4780
+ }, [
4781
+ vue.createVNode(vue.unref(design.TMagicInput), {
4782
+ placeholder: "key",
4783
+ modelValue: records.value[index][0],
4784
+ "onUpdate:modelValue": ($event) => records.value[index][0] = $event,
4785
+ disabled: _ctx.disabled,
4786
+ size: _ctx.size,
4787
+ onChange: keyChangeHandler
4788
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
4789
+ _hoisted_3$a,
4790
+ vue.createVNode(vue.unref(design.TMagicInput), {
4791
+ placeholder: "value",
4792
+ modelValue: records.value[index][1],
4793
+ "onUpdate:modelValue": ($event) => records.value[index][1] = $event,
4794
+ disabled: _ctx.disabled,
4795
+ size: _ctx.size,
4796
+ onChange: valueChangeHandler
4797
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "size"]),
4798
+ vue.createVNode(vue.unref(design.TMagicButton), {
4799
+ class: "m-fileds-key-value-delete",
4800
+ type: "danger",
4801
+ size: _ctx.size,
4802
+ disabled: _ctx.disabled,
4803
+ circle: "",
4804
+ plain: "",
4805
+ icon: vue.unref(iconsVue.Delete),
4806
+ onClick: ($event) => deleteHandler(index)
4807
+ }, null, 8, ["size", "disabled", "icon", "onClick"])
4808
+ ]);
4809
+ }), 128)),
4810
+ vue.createVNode(vue.unref(design.TMagicButton), {
4811
+ type: "primary",
4812
+ size: _ctx.size,
4813
+ disabled: _ctx.disabled,
4814
+ plain: "",
4815
+ icon: vue.unref(iconsVue.Plus),
4816
+ onClick: addHandler
4817
+ }, {
4818
+ default: vue.withCtx(() => [
4819
+ vue.createTextVNode("添加")
4820
+ ]),
4821
+ _: 1
4822
+ }, 8, ["size", "disabled", "icon"])
4823
+ ])) : vue.createCommentVNode("", true),
4824
+ _ctx.config.advanced && showCode.value ? (vue.openBlock(), vue.createBlock(_sfc_main$T, {
4825
+ key: 1,
4826
+ height: "200px",
4827
+ "init-values": _ctx.model[_ctx.name],
4828
+ language: "json",
4829
+ options: {
4830
+ readOnly: _ctx.disabled
4831
+ },
4832
+ parse: true,
4833
+ onSave: save
4834
+ }, null, 8, ["init-values", "options"])) : vue.createCommentVNode("", true),
4835
+ _ctx.config.advanced ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4836
+ key: 2,
4837
+ size: "default",
4772
4838
  disabled: _ctx.disabled,
4773
- plain: "",
4774
- icon: vue.unref(iconsVue.Plus),
4775
- onClick: addHandler
4776
- }, {
4777
- default: vue.withCtx(() => [
4778
- vue.createTextVNode("添加")
4779
- ]),
4780
- _: 1
4781
- }, 8, ["size", "disabled", "icon"])
4839
+ text: "",
4840
+ icon: _sfc_main$D,
4841
+ onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
4842
+ }, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
4782
4843
  ]);
4783
4844
  };
4784
4845
  }
4785
4846
  });
4786
4847
 
4787
- const _hoisted_1$m = {
4848
+ const _hoisted_1$l = {
4788
4849
  key: 1,
4789
4850
  class: "m-fields-ui-select",
4790
4851
  style: { "display": "flex" }
4791
4852
  };
4792
- const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
4853
+ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
4793
4854
  ...{
4794
4855
  name: "MEditorUISelect"
4795
4856
  },
@@ -4879,7 +4940,7 @@
4879
4940
  ]),
4880
4941
  _: 1
4881
4942
  }, 8, ["icon", "disabled", "size"])
4882
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
4943
+ ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
4883
4944
  val.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4884
4945
  vue.createVNode(vue.unref(design.TMagicTooltip), {
4885
4946
  content: "清除",
@@ -4976,7 +5037,7 @@
4976
5037
  };
4977
5038
  };
4978
5039
 
4979
- const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
5040
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
4980
5041
  ...{
4981
5042
  name: "MEditorResizer"
4982
5043
  },
@@ -4998,7 +5059,7 @@
4998
5059
  }
4999
5060
  });
5000
5061
 
5001
- const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
5062
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5002
5063
  ...{
5003
5064
  name: "MEditorLayout"
5004
5065
  },
@@ -5125,7 +5186,7 @@
5125
5186
  }, [
5126
5187
  vue.renderSlot(_ctx.$slots, "left")
5127
5188
  ], 6),
5128
- vue.createVNode(_sfc_main$B, { onChange: changeLeft })
5189
+ vue.createVNode(_sfc_main$A, { onChange: changeLeft })
5129
5190
  ], 64)) : vue.createCommentVNode("", true),
5130
5191
  vue.createElementVNode("div", {
5131
5192
  class: vue.normalizeClass(["m-editor-layout-center", _ctx.centerClass]),
@@ -5134,7 +5195,7 @@
5134
5195
  vue.renderSlot(_ctx.$slots, "center")
5135
5196
  ], 6),
5136
5197
  hasRight.value && _ctx.$slots.right ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5137
- vue.createVNode(_sfc_main$B, { onChange: changeRight }),
5198
+ vue.createVNode(_sfc_main$A, { onChange: changeRight }),
5138
5199
  vue.createElementVNode("div", {
5139
5200
  class: vue.normalizeClass(["m-editor-layout-right", _ctx.rightClass]),
5140
5201
  style: vue.normalizeStyle(`width: ${_ctx.right}px`)
@@ -5147,10 +5208,10 @@
5147
5208
  }
5148
5209
  });
5149
5210
 
5150
- const _hoisted_1$l = { class: "m-editor-empty-panel" };
5151
- const _hoisted_2$g = { class: "m-editor-empty-content" };
5211
+ const _hoisted_1$k = { class: "m-editor-empty-panel" };
5212
+ const _hoisted_2$f = { class: "m-editor-empty-content" };
5152
5213
  const _hoisted_3$9 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
5153
- const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
5214
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5154
5215
  ...{
5155
5216
  name: "MEditorAddPageBox"
5156
5217
  },
@@ -5170,8 +5231,8 @@
5170
5231
  });
5171
5232
  };
5172
5233
  return (_ctx, _cache) => {
5173
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
5174
- vue.createElementVNode("div", _hoisted_2$g, [
5234
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
5235
+ vue.createElementVNode("div", _hoisted_2$f, [
5175
5236
  vue.createElementVNode("div", {
5176
5237
  class: "m-editor-empty-button",
5177
5238
  onClick: clickHandler
@@ -5191,7 +5252,7 @@
5191
5252
  const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
5192
5253
  const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
5193
5254
  const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
5194
- const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
5255
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
5195
5256
  ...{
5196
5257
  name: "MEditorFramework"
5197
5258
  },
@@ -5272,7 +5333,7 @@
5272
5333
  options: vue.unref(codeOptions),
5273
5334
  onSave: saveCode
5274
5335
  }, null, 8, ["init-values", "options"])
5275
- ]) : (vue.openBlock(), vue.createBlock(_sfc_main$A, {
5336
+ ]) : (vue.openBlock(), vue.createBlock(_sfc_main$z, {
5276
5337
  key: 1,
5277
5338
  ref_key: "splitView",
5278
5339
  ref: splitView,
@@ -5294,7 +5355,7 @@
5294
5355
  ]),
5295
5356
  center: vue.withCtx(() => [
5296
5357
  pageLength.value > 0 ? vue.renderSlot(_ctx.$slots, "workspace", { key: 0 }) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
5297
- vue.createVNode(_sfc_main$z)
5358
+ vue.createVNode(_sfc_main$y)
5298
5359
  ])
5299
5360
  ]),
5300
5361
  _: 2
@@ -5319,12 +5380,12 @@
5319
5380
  }
5320
5381
  });
5321
5382
 
5322
- const _hoisted_1$k = {
5383
+ const _hoisted_1$j = {
5323
5384
  key: 1,
5324
5385
  class: "menu-item-text"
5325
5386
  };
5326
- const _hoisted_2$f = { class: "el-dropdown-link menubar-menu-button" };
5327
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
5387
+ const _hoisted_2$e = { class: "el-dropdown-link menubar-menu-button" };
5388
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
5328
5389
  ...{
5329
5390
  name: "MEditorToolButton"
5330
5391
  },
@@ -5403,7 +5464,7 @@
5403
5464
  _ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
5404
5465
  key: 0,
5405
5466
  direction: _ctx.data.direction || "vertical"
5406
- }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
5467
+ }, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
5407
5468
  _ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
5408
5469
  key: 0,
5409
5470
  effect: "dark",
@@ -5468,7 +5529,7 @@
5468
5529
  })) : vue.createCommentVNode("", true)
5469
5530
  ]),
5470
5531
  default: vue.withCtx(() => [
5471
- vue.createElementVNode("span", _hoisted_2$f, [
5532
+ vue.createElementVNode("span", _hoisted_2$e, [
5472
5533
  vue.createTextVNode(vue.toDisplayString(_ctx.data.text), 1),
5473
5534
  vue.createVNode(vue.unref(design.TMagicIcon), { class: "el-icon--right" }, {
5474
5535
  default: vue.withCtx(() => [
@@ -5485,7 +5546,7 @@
5485
5546
  }
5486
5547
  });
5487
5548
 
5488
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
5549
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5489
5550
  ...{
5490
5551
  name: "MEditorNavMenu"
5491
5552
  },
@@ -5647,7 +5708,7 @@
5647
5708
  style: vue.normalizeStyle(`width: ${columnWidth.value?.[key]}px`)
5648
5709
  }, [
5649
5710
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(buttons.value[key], (item, index) => {
5650
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
5711
+ return vue.openBlock(), vue.createBlock(_sfc_main$w, {
5651
5712
  data: item,
5652
5713
  key: index
5653
5714
  }, null, 8, ["data"]);
@@ -5659,8 +5720,8 @@
5659
5720
  }
5660
5721
  });
5661
5722
 
5662
- const _hoisted_1$j = { class: "m-editor-props-panel" };
5663
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
5723
+ const _hoisted_1$i = { class: "m-editor-props-panel" };
5724
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5664
5725
  ...{
5665
5726
  name: "MEditorPropsPanel"
5666
5727
  },
@@ -5714,7 +5775,7 @@
5714
5775
  };
5715
5776
  __expose({ configForm, submit });
5716
5777
  return (_ctx, _cache) => {
5717
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
5778
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
5718
5779
  vue.renderSlot(_ctx.$slots, "props-panel-header"),
5719
5780
  vue.createVNode(vue.unref(form.MForm), {
5720
5781
  ref_key: "configForm",
@@ -5865,7 +5926,7 @@
5865
5926
  };
5866
5927
  };
5867
5928
 
5868
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
5929
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5869
5930
  ...{
5870
5931
  name: "MEditorSearchInput"
5871
5932
  },
@@ -5905,8 +5966,8 @@
5905
5966
  }
5906
5967
  });
5907
5968
 
5908
- const _hoisted_1$i = { xmlns: "http://www.w3.org/2000/svg" };
5909
- const _hoisted_2$e = /* @__PURE__ */ vue.createElementVNode("g", {
5969
+ const _hoisted_1$h = { xmlns: "http://www.w3.org/2000/svg" };
5970
+ const _hoisted_2$d = /* @__PURE__ */ vue.createElementVNode("g", {
5910
5971
  fill: "#7C878E",
5911
5972
  "fill-rule": "evenodd"
5912
5973
  }, [
@@ -5917,38 +5978,16 @@
5917
5978
  /* @__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" })
5918
5979
  ], -1);
5919
5980
  const _hoisted_3$8 = [
5920
- _hoisted_2$e
5921
- ];
5922
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
5923
- ...{
5924
- name: "MEditorAppManageIcon"
5925
- },
5926
- __name: "AppManageIcon",
5927
- setup(__props) {
5928
- return (_ctx, _cache) => {
5929
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$i, _hoisted_3$8);
5930
- };
5931
- }
5932
- });
5933
-
5934
- const _hoisted_1$h = {
5935
- viewBox: "0 0 32 32",
5936
- version: "1.1",
5937
- xmlns: "http://www.w3.org/2000/svg",
5938
- "xmlns:xlink": "http://www.w3.org/1999/xlink"
5939
- };
5940
- const _hoisted_2$d = /* @__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);
5941
- const _hoisted_4$6 = [
5942
5981
  _hoisted_2$d
5943
5982
  ];
5944
5983
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
5945
5984
  ...{
5946
- name: "MEditorCodeIcon"
5985
+ name: "MEditorAppManageIcon"
5947
5986
  },
5948
- __name: "CodeIcon",
5987
+ __name: "AppManageIcon",
5949
5988
  setup(__props) {
5950
5989
  return (_ctx, _cache) => {
5951
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$h, _hoisted_4$6);
5990
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$h, _hoisted_3$8);
5952
5991
  };
5953
5992
  }
5954
5993
  });
@@ -6062,11 +6101,11 @@
6062
6101
  class: "list-container"
6063
6102
  }, [
6064
6103
  vue.createElementVNode("div", _hoisted_2$c, [
6065
- data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
6104
+ data.type === "code" ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
6066
6105
  key: 0,
6067
6106
  class: "codeIcon"
6068
6107
  })) : vue.createCommentVNode("", true),
6069
- data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$t, {
6108
+ data.type === "node" ? (vue.openBlock(), vue.createBlock(_sfc_main$s, {
6070
6109
  key: 1,
6071
6110
  class: "compIcon"
6072
6111
  })) : vue.createCommentVNode("", true),
@@ -6141,7 +6180,7 @@
6141
6180
  default: vue.withCtx(() => [
6142
6181
  vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
6143
6182
  vue.createElementVNode("div", _hoisted_1$f, [
6144
- vue.createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
6183
+ vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
6145
6184
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
6146
6185
  key: 0,
6147
6186
  class: "create-code-button",
@@ -6468,7 +6507,7 @@
6468
6507
  vue.createVNode(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
6469
6508
  default: vue.withCtx(() => [
6470
6509
  vue.createElementVNode("div", _hoisted_1$d, [
6471
- vue.createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
6510
+ vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
6472
6511
  editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
6473
6512
  key: 0,
6474
6513
  placement: "right"
@@ -6487,7 +6526,7 @@
6487
6526
  default: vue.withCtx(() => [
6488
6527
  vue.createElementVNode("div", _hoisted_2$a, [
6489
6528
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(datasourceTypeList.value, (item, index) => {
6490
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
6529
+ return vue.openBlock(), vue.createBlock(_sfc_main$w, {
6491
6530
  data: {
6492
6531
  type: "button",
6493
6532
  text: item.text,
@@ -6830,7 +6869,7 @@
6830
6869
  vue.renderSlot(_ctx.$slots, "title"),
6831
6870
  vue.createElementVNode("div", null, [
6832
6871
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
6833
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
6872
+ return vue.openBlock(), vue.createBlock(_sfc_main$w, {
6834
6873
  "event-type": "mouseup",
6835
6874
  ref_for: true,
6836
6875
  ref_key: "buttons",
@@ -7628,7 +7667,7 @@
7628
7667
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-layer-panel" }, {
7629
7668
  default: vue.withCtx(() => [
7630
7669
  vue.renderSlot(_ctx.$slots, "layer-panel-header"),
7631
- vue.createVNode(_sfc_main$u, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
7670
+ vue.createVNode(_sfc_main$t, { onSearch: vue.unref(filterTextChangeHandler) }, null, 8, ["onSearch"]),
7632
7671
  page.value && vue.unref(nodeStatusMap) ? (vue.openBlock(), vue.createBlock(_sfc_main$l, {
7633
7672
  key: 0,
7634
7673
  tabindex: "-1",
@@ -7751,7 +7790,7 @@
7751
7790
  "model-value": collapseValue.value
7752
7791
  }, {
7753
7792
  default: vue.withCtx(() => [
7754
- vue.createVNode(_sfc_main$u, { onSearch: filterTextChangeHandler }),
7793
+ vue.createVNode(_sfc_main$t, { onSearch: filterTextChangeHandler }),
7755
7794
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (group, index) => {
7756
7795
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
7757
7796
  group.items && group.items.length ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCollapseItem), {
@@ -8310,8 +8349,8 @@
8310
8349
  const el = vue.ref();
8311
8350
  const style = vue.computed(
8312
8351
  () => `
8313
- width: ${props.width}px;
8314
- height: ${props.height}px;
8352
+ width: ${utils.isNumber(`${props.width}`) ? `${props.width}px` : props.width};
8353
+ height: ${utils.isNumber(`${props.height}`) ? `${props.height}px` : props.height};
8315
8354
  position: absolute;
8316
8355
  margin-top: 30px;
8317
8356
  `
@@ -8449,8 +8488,10 @@
8449
8488
  const { height, width } = stageContainerRect;
8450
8489
  if (!width || !height)
8451
8490
  return 1;
8452
- const stageWidth = stageRect.width + 30;
8453
- const stageHeight = stageRect.height + 30;
8491
+ let stageWidth = utils.convertToNumber(stageRect.width, width);
8492
+ let stageHeight = utils.convertToNumber(stageRect.height, height);
8493
+ stageWidth = stageWidth + 30;
8494
+ stageHeight = stageHeight + 30;
8454
8495
  if (width > stageWidth && height > stageHeight) {
8455
8496
  return 1;
8456
8497
  }
@@ -9170,7 +9211,11 @@
9170
9211
  let top = 0;
9171
9212
  let left = 0;
9172
9213
  let position = "relative";
9173
- if (layout === Layout.ABSOLUTE) {
9214
+ if (style.position === "fixed") {
9215
+ position = "fixed";
9216
+ top = e.clientY - containerRect.top;
9217
+ left = e.clientX - containerRect.left;
9218
+ } else if (layout === Layout.ABSOLUTE) {
9174
9219
  position = "absolute";
9175
9220
  top = e.clientY - containerRect.top + scrollTop;
9176
9221
  left = e.clientX - containerRect.left + scrollLeft;
@@ -9468,7 +9513,7 @@
9468
9513
  default: vue.withCtx(() => [
9469
9514
  vue.createElementVNode("div", null, [
9470
9515
  vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
9471
- vue.createVNode(_sfc_main$x, {
9516
+ vue.createVNode(_sfc_main$w, {
9472
9517
  data: {
9473
9518
  type: "button",
9474
9519
  text: "复制",
@@ -9476,7 +9521,7 @@
9476
9521
  handler: () => copy(item)
9477
9522
  }
9478
9523
  }, null, 8, ["data"]),
9479
- vue.createVNode(_sfc_main$x, {
9524
+ vue.createVNode(_sfc_main$w, {
9480
9525
  data: {
9481
9526
  type: "button",
9482
9527
  text: "删除",
@@ -10391,13 +10436,13 @@
10391
10436
  );
10392
10437
  __expose(services);
10393
10438
  return (_ctx, _cache) => {
10394
- return vue.openBlock(), vue.createBlock(_sfc_main$y, null, {
10439
+ return vue.openBlock(), vue.createBlock(_sfc_main$x, null, {
10395
10440
  header: vue.withCtx(() => [
10396
10441
  vue.renderSlot(_ctx.$slots, "header")
10397
10442
  ]),
10398
10443
  nav: vue.withCtx(() => [
10399
10444
  vue.renderSlot(_ctx.$slots, "nav", { editorService: vue.unref(editorService) }, () => [
10400
- vue.createVNode(_sfc_main$w, { data: _ctx.menu }, null, 8, ["data"])
10445
+ vue.createVNode(_sfc_main$v, { data: _ctx.menu }, null, 8, ["data"])
10401
10446
  ])
10402
10447
  ]),
10403
10448
  "content-before": vue.withCtx(() => [
@@ -10464,7 +10509,7 @@
10464
10509
  ]),
10465
10510
  "props-panel": vue.withCtx(() => [
10466
10511
  vue.renderSlot(_ctx.$slots, "props-panel", {}, () => [
10467
- vue.createVNode(_sfc_main$v, {
10512
+ vue.createVNode(_sfc_main$u, {
10468
10513
  "extend-state": _ctx.extendFormState,
10469
10514
  onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
10470
10515
  }, {
@@ -10502,7 +10547,7 @@
10502
10547
  app.config.globalProperties.$TMAGIC_EDITOR = option;
10503
10548
  setConfig(option);
10504
10549
  app.component(_sfc_main.name, _sfc_main);
10505
- app.component("m-fields-ui-select", _sfc_main$C);
10550
+ app.component("m-fields-ui-select", _sfc_main$B);
10506
10551
  app.component("m-fields-code-link", _sfc_main$R);
10507
10552
  app.component("m-fields-vs-code", _sfc_main$S);
10508
10553
  app.component("magic-code-editor", _sfc_main$T);
@@ -10511,7 +10556,7 @@
10511
10556
  app.component("m-fields-event-select", _sfc_main$E);
10512
10557
  app.component("m-fields-data-source-fields", _sfc_main$L);
10513
10558
  app.component("m-fields-data-source-mocks", _sfc_main$G);
10514
- app.component("m-fields-key-value", _sfc_main$D);
10559
+ app.component("m-fields-key-value", _sfc_main$C);
10515
10560
  app.component("m-fields-data-source-input", _sfc_main$J);
10516
10561
  app.component("m-fields-data-source-select", _sfc_main$F);
10517
10562
  app.component("m-fields-data-source-methods", _sfc_main$I);
@@ -10548,18 +10593,18 @@
10548
10593
  exports.H_GUIDE_LINE_STORAGE_KEY = H_GUIDE_LINE_STORAGE_KEY;
10549
10594
  exports.Icon = _sfc_main$N;
10550
10595
  exports.KeyBindingCommand = KeyBindingCommand;
10551
- exports.KeyValue = _sfc_main$D;
10596
+ exports.KeyValue = _sfc_main$C;
10552
10597
  exports.Keys = Keys;
10553
10598
  exports.LayerOffset = LayerOffset;
10554
10599
  exports.LayerPanel = _sfc_main$g;
10555
10600
  exports.Layout = Layout;
10556
- exports.LayoutContainer = _sfc_main$A;
10557
- exports.PropsPanel = _sfc_main$v;
10558
- exports.Resizer = _sfc_main$B;
10559
- exports.SplitView = _sfc_main$A;
10601
+ exports.LayoutContainer = _sfc_main$z;
10602
+ exports.PropsPanel = _sfc_main$u;
10603
+ exports.Resizer = _sfc_main$A;
10604
+ exports.SplitView = _sfc_main$z;
10560
10605
  exports.TMagicCodeEditor = _sfc_main$T;
10561
10606
  exports.TMagicEditor = _sfc_main;
10562
- exports.ToolButton = _sfc_main$x;
10607
+ exports.ToolButton = _sfc_main$w;
10563
10608
  exports.UI_SELECT_MODE_EVENT_NAME = UI_SELECT_MODE_EVENT_NAME;
10564
10609
  exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
10565
10610
  exports.advancedTabConfig = advancedTabConfig;