@tmagic/form 1.3.9 → 1.3.11

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.
@@ -166,11 +166,11 @@
166
166
  };
167
167
 
168
168
  const _hoisted_1$e = ["id", "data-magic-id"];
169
- const _hoisted_2$8 = ["innerHTML"];
170
- const _hoisted_3$4 = ["innerHTML"];
169
+ const _hoisted_2$9 = ["innerHTML"];
170
+ const _hoisted_3$5 = ["innerHTML"];
171
171
  const _hoisted_4$4 = ["innerHTML"];
172
172
  const _hoisted_5$4 = ["innerHTML"];
173
- const _hoisted_6$1 = ["innerHTML"];
173
+ const _hoisted_6$2 = ["innerHTML"];
174
174
  const _hoisted_7$1 = ["innerHTML"];
175
175
  const _hoisted_8$1 = ["innerHTML"];
176
176
  const _hoisted_9 = ["innerHTML"];
@@ -246,6 +246,8 @@
246
246
  }
247
247
  if (type2 === "form")
248
248
  return "";
249
+ if (type2 === "container")
250
+ return "";
249
251
  return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (items.value ? "" : "text");
250
252
  });
251
253
  const display$1 = vue.computed(() => {
@@ -369,12 +371,12 @@
369
371
  label: vue.withCtx(() => [
370
372
  vue.createElementVNode("span", {
371
373
  innerHTML: type.value === "checkbox" ? "" : text.value
372
- }, null, 8, _hoisted_2$8)
374
+ }, null, 8, _hoisted_2$9)
373
375
  ]),
374
376
  default: vue.withCtx(() => [
375
377
  tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
376
378
  content: vue.withCtx(() => [
377
- vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$4)
379
+ vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
378
380
  ]),
379
381
  default: vue.withCtx(() => [
380
382
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
@@ -441,7 +443,7 @@
441
443
  label: vue.withCtx(() => [
442
444
  vue.createElementVNode("span", {
443
445
  innerHTML: type.value === "checkbox" ? "" : text.value
444
- }, null, 8, _hoisted_6$1)
446
+ }, null, 8, _hoisted_6$2)
445
447
  ]),
446
448
  default: vue.withCtx(() => [
447
449
  tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
@@ -589,7 +591,7 @@
589
591
  type: "primary",
590
592
  size: "small",
591
593
  disabled: false,
592
- text: "",
594
+ link: "",
593
595
  onClick: expandHandler
594
596
  }, {
595
597
  default: vue.withCtx(() => [
@@ -604,11 +606,11 @@
604
606
  });
605
607
 
606
608
  const _hoisted_1$d = ["innerHTML"];
607
- const _hoisted_2$7 = ["innerHTML"];
608
- const _hoisted_3$3 = { key: 1 };
609
+ const _hoisted_2$8 = ["innerHTML"];
610
+ const _hoisted_3$4 = { key: 1 };
609
611
  const _hoisted_4$3 = ["innerHTML"];
610
612
  const _hoisted_5$3 = ["innerHTML"];
611
- const _hoisted_6 = {
613
+ const _hoisted_6$1 = {
612
614
  key: 2,
613
615
  style: { "display": "flex" }
614
616
  };
@@ -679,13 +681,13 @@
679
681
  key: 0,
680
682
  innerHTML: _ctx.config.extra,
681
683
  class: "m-form-tip"
682
- }, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
684
+ }, null, 8, _hoisted_2$8)) : vue.createCommentVNode("", true)
683
685
  ]),
684
686
  _: 1
685
687
  }, 8, ["modelValue", "prop"])
686
688
  ]),
687
689
  _: 1
688
- })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$3, [
690
+ })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$4, [
689
691
  vue.createElementVNode("span", {
690
692
  innerHTML: _ctx.config.legend
691
693
  }, null, 8, _hoisted_4$3),
@@ -695,7 +697,7 @@
695
697
  class: "m-form-tip"
696
698
  }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
697
699
  ])),
698
- _ctx.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
700
+ _ctx.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
699
701
  vue.createElementVNode("div", _hoisted_7, [
700
702
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (item, index) => {
701
703
  return vue.openBlock(), vue.createBlock(_sfc_main$z, {
@@ -740,7 +742,7 @@
740
742
  });
741
743
 
742
744
  const _hoisted_1$c = { class: "m-fields-group-list-item" };
743
- const _hoisted_2$6 = ["innerHTML"];
745
+ const _hoisted_2$7 = ["innerHTML"];
744
746
  const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
745
747
  ...{
746
748
  name: "MFormGroupListItem"
@@ -810,7 +812,7 @@
810
812
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
811
813
  vue.createElementVNode("div", null, [
812
814
  vue.createVNode(vue.unref(design.TMagicButton), {
813
- text: "",
815
+ link: "",
814
816
  disabled: _ctx.disabled,
815
817
  icon: expand.value ? vue.unref(iconsVue.CaretBottom) : vue.unref(iconsVue.CaretRight),
816
818
  onClick: expandHandler
@@ -822,7 +824,7 @@
822
824
  }, 8, ["disabled", "icon"]),
823
825
  vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
824
826
  style: { "color": "#f56c6c" },
825
- text: "",
827
+ link: "",
826
828
  icon: vue.unref(iconsVue.Delete),
827
829
  disabled: _ctx.disabled,
828
830
  onClick: removeHandler
@@ -831,7 +833,7 @@
831
833
  ]),
832
834
  movable() ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
833
835
  vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
834
- text: "",
836
+ link: "",
835
837
  disabled: _ctx.disabled,
836
838
  size: "small",
837
839
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
@@ -851,7 +853,7 @@
851
853
  ]),
852
854
  vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
853
855
  disabled: _ctx.disabled,
854
- text: "",
856
+ link: "",
855
857
  size: "small",
856
858
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
857
859
  }, {
@@ -873,7 +875,7 @@
873
875
  key: 1,
874
876
  innerHTML: itemExtra.value,
875
877
  class: "m-form-tip"
876
- }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
878
+ }, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
877
879
  ]),
878
880
  expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$z, {
879
881
  key: 0,
@@ -894,8 +896,8 @@
894
896
  });
895
897
 
896
898
  const _hoisted_1$b = { class: "m-fields-group-list" };
897
- const _hoisted_2$5 = ["innerHTML"];
898
- const _hoisted_3$2 = {
899
+ const _hoisted_2$6 = ["innerHTML"];
900
+ const _hoisted_3$3 = {
899
901
  key: 1,
900
902
  class: "el-table__empty-block"
901
903
  };
@@ -992,8 +994,8 @@
992
994
  key: 0,
993
995
  innerHTML: _ctx.config.extra,
994
996
  style: { "color": "rgba(0, 0, 0, 0.45)" }
995
- }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
996
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
997
+ }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true),
998
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
997
999
  return vue.openBlock(), vue.createBlock(_sfc_main$x, {
998
1000
  key: index,
999
1001
  model: item,
@@ -1040,8 +1042,8 @@
1040
1042
  });
1041
1043
 
1042
1044
  const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1043
- const _hoisted_2$4 = ["innerHTML"];
1044
- const _hoisted_3$1 = {
1045
+ const _hoisted_2$5 = ["innerHTML"];
1046
+ const _hoisted_3$2 = {
1045
1047
  key: 0,
1046
1048
  style: { "display": "flex" }
1047
1049
  };
@@ -1083,7 +1085,7 @@
1083
1085
  vue.createElementVNode("div", _hoisted_1$a, [
1084
1086
  vue.createVNode(vue.unref(design.TMagicButton), {
1085
1087
  style: { "padding": "0" },
1086
- text: "",
1088
+ link: "",
1087
1089
  icon: expand.value ? vue.unref(iconsVue.CaretBottom) : vue.unref(iconsVue.CaretRight),
1088
1090
  onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
1089
1091
  }, null, 8, ["icon"]),
@@ -1091,7 +1093,7 @@
1091
1093
  key: 0,
1092
1094
  innerHTML: _ctx.config.extra,
1093
1095
  class: "m-form-tip"
1094
- }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1096
+ }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
1095
1097
  vue.renderSlot(_ctx.$slots, "header", {}, () => [
1096
1098
  vue.createTextVNode(vue.toDisplayString(filter(_ctx.config.title)), 1)
1097
1099
  ])
@@ -1100,7 +1102,7 @@
1100
1102
  default: vue.withCtx(() => [
1101
1103
  vue.createElementVNode("div", null, [
1102
1104
  vue.renderSlot(_ctx.$slots, "default"),
1103
- _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
1105
+ _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
1104
1106
  vue.createElementVNode("div", _hoisted_4$1, [
1105
1107
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
1106
1108
  return vue.openBlock(), vue.createBlock(_sfc_main$z, {
@@ -1325,11 +1327,12 @@
1325
1327
  }
1326
1328
  });
1327
1329
 
1328
- const _hoisted_1$9 = ["innerHTML"];
1329
- const _hoisted_2$3 = ["innerHTML"];
1330
- const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1331
- const _hoisted_4 = { style: { "display": "flex" } };
1332
- const _hoisted_5 = {
1330
+ const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1331
+ const _hoisted_2$4 = ["innerHTML"];
1332
+ const _hoisted_3$1 = ["innerHTML"];
1333
+ const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1334
+ const _hoisted_5 = { style: { "display": "flex" } };
1335
+ const _hoisted_6 = {
1333
1336
  key: 1,
1334
1337
  class: "bottom",
1335
1338
  style: { "text-align": "right" }
@@ -1361,6 +1364,7 @@
1361
1364
  const emit = __emit;
1362
1365
  let timer = null;
1363
1366
  const mForm = vue.inject("mForm");
1367
+ const { nextZIndex } = design.useZIndex();
1364
1368
  const tMagicTable = vue.ref();
1365
1369
  const excelBtn = vue.ref();
1366
1370
  const mTable = vue.ref();
@@ -1673,11 +1677,14 @@
1673
1677
  });
1674
1678
  };
1675
1679
  const toggleFullscreen = () => {
1680
+ if (!mTable.value)
1681
+ return;
1676
1682
  if (isFullscreen.value) {
1677
- mTable.value?.classList.remove("fixed");
1683
+ mTable.value.classList.remove("fixed");
1678
1684
  isFullscreen.value = false;
1679
1685
  } else {
1680
- mTable.value?.classList.add("fixed");
1686
+ mTable.value.classList.add("fixed");
1687
+ mTable.value.style.zIndex = `${nextZIndex()}`;
1681
1688
  isFullscreen.value = true;
1682
1689
  }
1683
1690
  };
@@ -1690,7 +1697,7 @@
1690
1697
  toggleRowSelection
1691
1698
  });
1692
1699
  return (_ctx, _cache) => {
1693
- return vue.openBlock(), vue.createElementBlock("div", null, [
1700
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
1694
1701
  (vue.openBlock(), vue.createBlock(vue.Teleport, {
1695
1702
  to: "body",
1696
1703
  disabled: !isFullscreen.value
@@ -1704,7 +1711,7 @@
1704
1711
  key: 0,
1705
1712
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1706
1713
  innerHTML: _ctx.config.extra
1707
- }, null, 8, _hoisted_1$9)) : vue.createCommentVNode("", true),
1714
+ }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1708
1715
  vue.createVNode(vue.unref(design.TMagicTooltip), {
1709
1716
  content: "拖拽可排序",
1710
1717
  placement: "left-start",
@@ -1736,7 +1743,7 @@
1736
1743
  vue.createElementVNode("span", {
1737
1744
  innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1738
1745
  class: "m-form-tip"
1739
- }, null, 8, _hoisted_2$3)
1746
+ }, null, 8, _hoisted_3$1)
1740
1747
  ]),
1741
1748
  _: 1
1742
1749
  })) : vue.createCommentVNode("", true),
@@ -1780,7 +1787,7 @@
1780
1787
  type: "primary",
1781
1788
  icon: vue.unref(iconsVue.ArrowUp),
1782
1789
  disabled: _ctx.disabled,
1783
- text: "",
1790
+ link: "",
1784
1791
  onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1785
1792
  onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1786
1793
  }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
@@ -1799,7 +1806,7 @@
1799
1806
  type: "primary",
1800
1807
  icon: vue.unref(iconsVue.ArrowDown),
1801
1808
  disabled: _ctx.disabled,
1802
- text: "",
1809
+ link: "",
1803
1810
  onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1804
1811
  onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1805
1812
  }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
@@ -1864,7 +1871,7 @@
1864
1871
  _: 3
1865
1872
  }, 8, ["disabled"]),
1866
1873
  vue.renderSlot(_ctx.$slots, "default"),
1867
- vue.createElementVNode("div", _hoisted_3, [
1874
+ vue.createElementVNode("div", _hoisted_4, [
1868
1875
  addable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
1869
1876
  key: 0,
1870
1877
  size: "small",
@@ -1878,7 +1885,7 @@
1878
1885
  ]),
1879
1886
  _: 1
1880
1887
  }, 8, ["disabled"])) : vue.createCommentVNode("", true),
1881
- vue.createElementVNode("div", _hoisted_4, [
1888
+ vue.createElementVNode("div", _hoisted_5, [
1882
1889
  _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
1883
1890
  key: 0,
1884
1891
  icon: vue.unref(iconsVue.Grid),
@@ -1943,7 +1950,7 @@
1943
1950
  }, 8, ["disabled"])) : vue.createCommentVNode("", true)
1944
1951
  ])
1945
1952
  ]),
1946
- _ctx.config.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
1953
+ _ctx.config.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
1947
1954
  vue.createVNode(vue.unref(design.TMagicPagination), {
1948
1955
  layout: "total, sizes, prev, pager, next, jumper",
1949
1956
  "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
@@ -3137,7 +3144,7 @@
3137
3144
  });
3138
3145
 
3139
3146
  const _hoisted_1$5 = ["href"];
3140
- const _hoisted_2$2 = {
3147
+ const _hoisted_2$3 = {
3141
3148
  key: 2,
3142
3149
  class: "m-fields-link"
3143
3150
  };
@@ -3213,9 +3220,9 @@
3213
3220
  }, vue.toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
3214
3221
  key: 1,
3215
3222
  style: vue.normalizeStyle(_ctx.config.disabledCss || {})
3216
- }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
3223
+ }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
3217
3224
  vue.createVNode(vue.unref(design.TMagicButton), {
3218
- text: true,
3225
+ link: "",
3219
3226
  type: "primary",
3220
3227
  onClick: editHandler
3221
3228
  }, {
@@ -3290,7 +3297,7 @@
3290
3297
  });
3291
3298
 
3292
3299
  const _hoisted_1$4 = { class: "m-fields-number-range" };
3293
- const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3300
+ const _hoisted_2$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3294
3301
  const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
3295
3302
  ...{
3296
3303
  name: "MFormNumberRange"
@@ -3331,7 +3338,7 @@
3331
3338
  disabled: _ctx.disabled,
3332
3339
  onChange: minChangeHandler
3333
3340
  }, null, 8, ["modelValue", "size", "disabled"]),
3334
- _hoisted_2$1,
3341
+ _hoisted_2$2,
3335
3342
  vue.createVNode(vue.unref(design.TMagicInput), {
3336
3343
  modelValue: _ctx.model[_ctx.name][1],
3337
3344
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3874,7 +3881,9 @@
3874
3881
  }
3875
3882
  });
3876
3883
 
3877
- const _hoisted_1$2 = { key: 0 };
3884
+ const _hoisted_1$2 = { class: "m-form-item__content" };
3885
+ const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3886
+ const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3878
3887
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
3879
3888
  ...{
3880
3889
  name: "MFormText"
@@ -3897,18 +3906,45 @@
3897
3906
  const emit = __emit;
3898
3907
  useAddField(props.prop);
3899
3908
  const mForm = vue.inject("mForm");
3909
+ const appendConfig = vue.computed(() => {
3910
+ if (typeof props.config.append === "string") {
3911
+ return {
3912
+ text: props.config.append,
3913
+ type: "button",
3914
+ handler: void 0
3915
+ };
3916
+ }
3917
+ if (props.config.append && typeof props.config.append === "object") {
3918
+ if (props.config.append.value === 0) {
3919
+ return false;
3920
+ }
3921
+ return props.config.append;
3922
+ }
3923
+ return false;
3924
+ });
3925
+ const popoverVisible = vue.ref(false);
3926
+ const confirmTrimHandler = () => {
3927
+ emit("change", props.model[props.name].trim() || "");
3928
+ popoverVisible.value = false;
3929
+ };
3930
+ const checkWhiteSpace = (value) => {
3931
+ if (typeof value === "string" && !props.config.trim) {
3932
+ popoverVisible.value = value.trim() !== value;
3933
+ }
3934
+ };
3900
3935
  const changeHandler = (value) => {
3901
3936
  emit("change", value);
3902
3937
  };
3903
3938
  const inputHandler = (v) => {
3939
+ checkWhiteSpace(v);
3904
3940
  emit("input", v);
3905
3941
  mForm?.$emit("field-input", props.prop, v);
3906
3942
  };
3907
3943
  const buttonClickHandler = () => {
3908
- if (typeof props.config.append === "string")
3944
+ if (!appendConfig.value)
3909
3945
  return;
3910
- if (props.config.append?.handler) {
3911
- props.config.append.handler(mForm, {
3946
+ if (typeof appendConfig.value.handler === "function") {
3947
+ appendConfig.value.handler(mForm, {
3912
3948
  model: props.model,
3913
3949
  values: mForm?.values
3914
3950
  });
@@ -3966,36 +4002,70 @@
3966
4002
  emit("change", props.model[props.name]);
3967
4003
  };
3968
4004
  return (_ctx, _cache) => {
3969
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
3970
- modelValue: _ctx.model[_ctx.name],
3971
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3972
- clearable: "",
3973
- size: _ctx.size,
3974
- placeholder: _ctx.config.placeholder,
3975
- disabled: _ctx.disabled,
3976
- onChange: changeHandler,
3977
- onInput: inputHandler,
3978
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
3979
- }, vue.createSlots({ _: 2 }, [
3980
- _ctx.config.append ? {
3981
- name: "append",
3982
- fn: vue.withCtx(() => [
3983
- typeof _ctx.config.append === "string" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$2, vue.toDisplayString(_ctx.config.append), 1)) : vue.createCommentVNode("", true),
3984
- typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3985
- key: 1,
3986
- style: { "color": "#409eff" },
3987
- size: _ctx.size,
3988
- onClick: vue.withModifiers(buttonClickHandler, ["prevent"])
3989
- }, {
3990
- default: vue.withCtx(() => [
3991
- vue.createTextVNode(vue.toDisplayString(_ctx.config.append.text), 1)
4005
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
4006
+ visible: popoverVisible.value,
4007
+ width: "220px"
4008
+ }, {
4009
+ reference: vue.withCtx(() => [
4010
+ vue.createVNode(vue.unref(design.TMagicInput), {
4011
+ modelValue: _ctx.model[_ctx.name],
4012
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
4013
+ clearable: "",
4014
+ size: _ctx.size,
4015
+ placeholder: _ctx.config.placeholder,
4016
+ disabled: _ctx.disabled,
4017
+ onChange: changeHandler,
4018
+ onInput: inputHandler,
4019
+ onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
4020
+ }, vue.createSlots({ _: 2 }, [
4021
+ appendConfig.value ? {
4022
+ name: "append",
4023
+ fn: vue.withCtx(() => [
4024
+ appendConfig.value.type === "button" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4025
+ key: 0,
4026
+ style: { "color": "#409eff" },
4027
+ size: _ctx.size,
4028
+ onClick: vue.withModifiers(buttonClickHandler, ["prevent"])
4029
+ }, {
4030
+ default: vue.withCtx(() => [
4031
+ vue.createTextVNode(vue.toDisplayString(appendConfig.value.text), 1)
4032
+ ]),
4033
+ _: 1
4034
+ }, 8, ["size", "onClick"])) : vue.createCommentVNode("", true)
3992
4035
  ]),
3993
- _: 1
3994
- }, 8, ["size", "onClick"])) : vue.createCommentVNode("", true)
3995
- ]),
3996
- key: "0"
3997
- } : void 0
3998
- ]), 1032, ["modelValue", "size", "placeholder", "disabled"]);
4036
+ key: "0"
4037
+ } : void 0
4038
+ ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4039
+ ]),
4040
+ default: vue.withCtx(() => [
4041
+ vue.createElementVNode("div", _hoisted_1$2, [
4042
+ _hoisted_2$1,
4043
+ vue.createElementVNode("div", _hoisted_3, [
4044
+ vue.createVNode(vue.unref(design.TMagicButton), {
4045
+ link: "",
4046
+ size: "small",
4047
+ onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
4048
+ }, {
4049
+ default: vue.withCtx(() => [
4050
+ vue.createTextVNode("保持原样")
4051
+ ]),
4052
+ _: 1
4053
+ }),
4054
+ vue.createVNode(vue.unref(design.TMagicButton), {
4055
+ type: "primary",
4056
+ size: "small",
4057
+ onClick: confirmTrimHandler
4058
+ }, {
4059
+ default: vue.withCtx(() => [
4060
+ vue.createTextVNode("移除空格")
4061
+ ]),
4062
+ _: 1
4063
+ })
4064
+ ])
4065
+ ])
4066
+ ]),
4067
+ _: 1
4068
+ }, 8, ["visible"]);
3999
4069
  };
4000
4070
  }
4001
4071
  });
@@ -4444,6 +4514,9 @@
4444
4514
  }
4445
4515
  });
4446
4516
 
4517
+ const createForm = function(config) {
4518
+ return config;
4519
+ };
4447
4520
  const defaultInstallOpt = {};
4448
4521
  const index = {
4449
4522
  install(app, opt = {}) {
@@ -4514,6 +4587,7 @@
4514
4587
  exports.MTextarea = _sfc_main$4;
4515
4588
  exports.MTime = _sfc_main$3;
4516
4589
  exports.MTimerange = _sfc_main$2;
4590
+ exports.createForm = createForm;
4517
4591
  exports.createValues = createValues;
4518
4592
  exports.default = index;
4519
4593
  exports.display = display;
@@ -4525,4 +4599,3 @@
4525
4599
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4526
4600
 
4527
4601
  }));
4528
- //# sourceMappingURL=tmagic-form.umd.cjs.map
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.9",
2
+ "version": "1.3.11",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@element-plus/icons-vue": "^2.3.1",
35
- "@tmagic/design": "1.3.9",
36
- "@tmagic/utils": "1.3.9",
35
+ "@tmagic/design": "1.3.11",
36
+ "@tmagic/utils": "1.3.11",
37
37
  "lodash-es": "^4.17.21",
38
38
  "sortablejs": "^1.14.0",
39
39
  "vue": "^3.3.8"
@@ -212,7 +212,7 @@
212
212
  </template>
213
213
 
214
214
  <div style="text-align: center" v-if="config.expand && type !== 'fieldset'">
215
- <TMagicButton type="primary" size="small" :disabled="false" text @click="expandHandler">{{
215
+ <TMagicButton type="primary" size="small" :disabled="false" link @click="expandHandler">{{
216
216
  expand ? '收起配置' : '展开更多配置'
217
217
  }}</TMagicButton>
218
218
  </div>
@@ -312,6 +312,7 @@ const type = computed((): string => {
312
312
  });
313
313
  }
314
314
  if (type === 'form') return '';
315
+ if (type === 'container') return '';
315
316
  return type?.replace(/([A-Z])/g, '-$1').toLowerCase() || (items.value ? '' : 'text');
316
317
  });
317
318
 
@@ -1,24 +1,24 @@
1
1
  <template>
2
2
  <div class="m-fields-group-list-item">
3
3
  <div>
4
- <TMagicButton text :disabled="disabled" :icon="expand ? CaretBottom : CaretRight" @click="expandHandler">{{
4
+ <TMagicButton link :disabled="disabled" :icon="expand ? CaretBottom : CaretRight" @click="expandHandler">{{
5
5
  title
6
6
  }}</TMagicButton>
7
7
 
8
8
  <TMagicButton
9
9
  v-show="showDelete(parseInt(String(index)))"
10
10
  style="color: #f56c6c"
11
- text
11
+ link
12
12
  :icon="Delete"
13
13
  :disabled="disabled"
14
14
  @click="removeHandler"
15
15
  ></TMagicButton>
16
16
 
17
17
  <template v-if="movable()">
18
- <TMagicButton v-show="index !== 0" text :disabled="disabled" size="small" @click="changeOrder(-1)"
18
+ <TMagicButton v-show="index !== 0" link :disabled="disabled" size="small" @click="changeOrder(-1)"
19
19
  >上移<TMagicIcon><CaretTop /></TMagicIcon
20
20
  ></TMagicButton>
21
- <TMagicButton v-show="index !== length - 1" :disabled="disabled" text size="small" @click="changeOrder(1)"
21
+ <TMagicButton v-show="index !== length - 1" :disabled="disabled" link size="small" @click="changeOrder(1)"
22
22
  >下移<TMagicIcon><CaretBottom /></TMagicIcon
23
23
  ></TMagicButton>
24
24
  </template>
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <template #header>
8
8
  <div style="width: 100%; display: flex; align-items: center">
9
- <TMagicButton style="padding: 0" text :icon="expand ? CaretBottom : CaretRight" @click="expand = !expand">
9
+ <TMagicButton style="padding: 0" link :icon="expand ? CaretBottom : CaretRight" @click="expand = !expand">
10
10
  </TMagicButton>
11
11
  <span v-if="config && config.extra" v-html="config.extra" class="m-form-tip"></span>
12
12
  <slot name="header">{{ filter(config.title) }}</slot>