@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.
package/dist/style.css CHANGED
@@ -53,6 +53,13 @@
53
53
  display: none;
54
54
  }
55
55
 
56
+ .m-form-validate__warning {
57
+ color: var(--el-color-warning);
58
+ font-size: 12px;
59
+ width: 100%;
60
+ line-height: 1.4;
61
+ }
62
+
56
63
  div.m-fields-link {
57
64
  width: fit-content;
58
65
  }
@@ -119,6 +126,10 @@ fieldset.m-fieldset .m-form-tip {
119
126
  margin-bottom: 20px;
120
127
  }
121
128
 
129
+ .m-fields-table-wrap {
130
+ width: 100%;
131
+ }
132
+
122
133
  .m-fields-table {
123
134
  width: 100%;
124
135
  }
@@ -1,7 +1,7 @@
1
1
  import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, nextTick, resolveDirective, createSlots, withModifiers } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual, isEmpty } from 'lodash-es';
4
- import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicTimePicker, TMagicDrawer } from '@tmagic/design';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer } from '@tmagic/design';
5
5
  import Sortable from 'sortablejs';
6
6
  import { sleep, asyncLoadJs, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
7
7
 
@@ -167,11 +167,11 @@ const initValue = async (mForm, { initValues, config }) => {
167
167
  };
168
168
 
169
169
  const _hoisted_1$e = ["id", "data-magic-id"];
170
- const _hoisted_2$8 = ["innerHTML"];
171
- const _hoisted_3$4 = ["innerHTML"];
170
+ const _hoisted_2$9 = ["innerHTML"];
171
+ const _hoisted_3$5 = ["innerHTML"];
172
172
  const _hoisted_4$4 = ["innerHTML"];
173
173
  const _hoisted_5$4 = ["innerHTML"];
174
- const _hoisted_6$1 = ["innerHTML"];
174
+ const _hoisted_6$2 = ["innerHTML"];
175
175
  const _hoisted_7$1 = ["innerHTML"];
176
176
  const _hoisted_8$1 = ["innerHTML"];
177
177
  const _hoisted_9 = ["innerHTML"];
@@ -247,6 +247,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
247
247
  }
248
248
  if (type2 === "form")
249
249
  return "";
250
+ if (type2 === "container")
251
+ return "";
250
252
  return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (items.value ? "" : "text");
251
253
  });
252
254
  const display$1 = computed(() => {
@@ -370,12 +372,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
370
372
  label: withCtx(() => [
371
373
  createElementVNode("span", {
372
374
  innerHTML: type.value === "checkbox" ? "" : text.value
373
- }, null, 8, _hoisted_2$8)
375
+ }, null, 8, _hoisted_2$9)
374
376
  ]),
375
377
  default: withCtx(() => [
376
378
  tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
377
379
  content: withCtx(() => [
378
- createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$4)
380
+ createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
379
381
  ]),
380
382
  default: withCtx(() => [
381
383
  (openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
@@ -442,7 +444,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
442
444
  label: withCtx(() => [
443
445
  createElementVNode("span", {
444
446
  innerHTML: type.value === "checkbox" ? "" : text.value
445
- }, null, 8, _hoisted_6$1)
447
+ }, null, 8, _hoisted_6$2)
446
448
  ]),
447
449
  default: withCtx(() => [
448
450
  tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
@@ -590,7 +592,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
590
592
  type: "primary",
591
593
  size: "small",
592
594
  disabled: false,
593
- text: "",
595
+ link: "",
594
596
  onClick: expandHandler
595
597
  }, {
596
598
  default: withCtx(() => [
@@ -605,11 +607,11 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
605
607
  });
606
608
 
607
609
  const _hoisted_1$d = ["innerHTML"];
608
- const _hoisted_2$7 = ["innerHTML"];
609
- const _hoisted_3$3 = { key: 1 };
610
+ const _hoisted_2$8 = ["innerHTML"];
611
+ const _hoisted_3$4 = { key: 1 };
610
612
  const _hoisted_4$3 = ["innerHTML"];
611
613
  const _hoisted_5$3 = ["innerHTML"];
612
- const _hoisted_6 = {
614
+ const _hoisted_6$1 = {
613
615
  key: 2,
614
616
  style: { "display": "flex" }
615
617
  };
@@ -680,13 +682,13 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
680
682
  key: 0,
681
683
  innerHTML: _ctx.config.extra,
682
684
  class: "m-form-tip"
683
- }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
685
+ }, null, 8, _hoisted_2$8)) : createCommentVNode("", true)
684
686
  ]),
685
687
  _: 1
686
688
  }, 8, ["modelValue", "prop"])
687
689
  ]),
688
690
  _: 1
689
- })) : (openBlock(), createElementBlock("legend", _hoisted_3$3, [
691
+ })) : (openBlock(), createElementBlock("legend", _hoisted_3$4, [
690
692
  createElementVNode("span", {
691
693
  innerHTML: _ctx.config.legend
692
694
  }, null, 8, _hoisted_4$3),
@@ -696,7 +698,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
696
698
  class: "m-form-tip"
697
699
  }, null, 8, _hoisted_5$3)) : createCommentVNode("", true)
698
700
  ])),
699
- _ctx.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
701
+ _ctx.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
700
702
  createElementVNode("div", _hoisted_7, [
701
703
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (item, index) => {
702
704
  return openBlock(), createBlock(_sfc_main$z, {
@@ -741,7 +743,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
741
743
  });
742
744
 
743
745
  const _hoisted_1$c = { class: "m-fields-group-list-item" };
744
- const _hoisted_2$6 = ["innerHTML"];
746
+ const _hoisted_2$7 = ["innerHTML"];
745
747
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
746
748
  ...{
747
749
  name: "MFormGroupListItem"
@@ -811,7 +813,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
811
813
  return openBlock(), createElementBlock("div", _hoisted_1$c, [
812
814
  createElementVNode("div", null, [
813
815
  createVNode(unref(TMagicButton), {
814
- text: "",
816
+ link: "",
815
817
  disabled: _ctx.disabled,
816
818
  icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
817
819
  onClick: expandHandler
@@ -823,7 +825,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
823
825
  }, 8, ["disabled", "icon"]),
824
826
  withDirectives(createVNode(unref(TMagicButton), {
825
827
  style: { "color": "#f56c6c" },
826
- text: "",
828
+ link: "",
827
829
  icon: unref(Delete),
828
830
  disabled: _ctx.disabled,
829
831
  onClick: removeHandler
@@ -832,7 +834,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
832
834
  ]),
833
835
  movable() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
834
836
  withDirectives(createVNode(unref(TMagicButton), {
835
- text: "",
837
+ link: "",
836
838
  disabled: _ctx.disabled,
837
839
  size: "small",
838
840
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
@@ -852,7 +854,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
852
854
  ]),
853
855
  withDirectives(createVNode(unref(TMagicButton), {
854
856
  disabled: _ctx.disabled,
855
- text: "",
857
+ link: "",
856
858
  size: "small",
857
859
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
858
860
  }, {
@@ -874,7 +876,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
874
876
  key: 1,
875
877
  innerHTML: itemExtra.value,
876
878
  class: "m-form-tip"
877
- }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
879
+ }, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
878
880
  ]),
879
881
  expand.value ? (openBlock(), createBlock(_sfc_main$z, {
880
882
  key: 0,
@@ -895,8 +897,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
895
897
  });
896
898
 
897
899
  const _hoisted_1$b = { class: "m-fields-group-list" };
898
- const _hoisted_2$5 = ["innerHTML"];
899
- const _hoisted_3$2 = {
900
+ const _hoisted_2$6 = ["innerHTML"];
901
+ const _hoisted_3$3 = {
900
902
  key: 1,
901
903
  class: "el-table__empty-block"
902
904
  };
@@ -993,8 +995,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
993
995
  key: 0,
994
996
  innerHTML: _ctx.config.extra,
995
997
  style: { "color": "rgba(0, 0, 0, 0.45)" }
996
- }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
997
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$2, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
998
+ }, null, 8, _hoisted_2$6)) : createCommentVNode("", true),
999
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
998
1000
  return openBlock(), createBlock(_sfc_main$x, {
999
1001
  key: index,
1000
1002
  model: item,
@@ -1041,8 +1043,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1041
1043
  });
1042
1044
 
1043
1045
  const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1044
- const _hoisted_2$4 = ["innerHTML"];
1045
- const _hoisted_3$1 = {
1046
+ const _hoisted_2$5 = ["innerHTML"];
1047
+ const _hoisted_3$2 = {
1046
1048
  key: 0,
1047
1049
  style: { "display": "flex" }
1048
1050
  };
@@ -1084,7 +1086,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1084
1086
  createElementVNode("div", _hoisted_1$a, [
1085
1087
  createVNode(unref(TMagicButton), {
1086
1088
  style: { "padding": "0" },
1087
- text: "",
1089
+ link: "",
1088
1090
  icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
1089
1091
  onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
1090
1092
  }, null, 8, ["icon"]),
@@ -1092,7 +1094,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1092
1094
  key: 0,
1093
1095
  innerHTML: _ctx.config.extra,
1094
1096
  class: "m-form-tip"
1095
- }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1097
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
1096
1098
  renderSlot(_ctx.$slots, "header", {}, () => [
1097
1099
  createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
1098
1100
  ])
@@ -1101,7 +1103,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1101
1103
  default: withCtx(() => [
1102
1104
  createElementVNode("div", null, [
1103
1105
  renderSlot(_ctx.$slots, "default"),
1104
- _ctx.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
1106
+ _ctx.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
1105
1107
  createElementVNode("div", _hoisted_4$1, [
1106
1108
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
1107
1109
  return openBlock(), createBlock(_sfc_main$z, {
@@ -1326,11 +1328,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1326
1328
  }
1327
1329
  });
1328
1330
 
1329
- const _hoisted_1$9 = ["innerHTML"];
1330
- const _hoisted_2$3 = ["innerHTML"];
1331
- const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1332
- const _hoisted_4 = { style: { "display": "flex" } };
1333
- const _hoisted_5 = {
1331
+ const _hoisted_1$9 = { class: "m-fields-table-wrap" };
1332
+ const _hoisted_2$4 = ["innerHTML"];
1333
+ const _hoisted_3$1 = ["innerHTML"];
1334
+ const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1335
+ const _hoisted_5 = { style: { "display": "flex" } };
1336
+ const _hoisted_6 = {
1334
1337
  key: 1,
1335
1338
  class: "bottom",
1336
1339
  style: { "text-align": "right" }
@@ -1362,6 +1365,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1362
1365
  const emit = __emit;
1363
1366
  let timer = null;
1364
1367
  const mForm = inject("mForm");
1368
+ const { nextZIndex } = useZIndex();
1365
1369
  const tMagicTable = ref();
1366
1370
  const excelBtn = ref();
1367
1371
  const mTable = ref();
@@ -1674,11 +1678,14 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1674
1678
  });
1675
1679
  };
1676
1680
  const toggleFullscreen = () => {
1681
+ if (!mTable.value)
1682
+ return;
1677
1683
  if (isFullscreen.value) {
1678
- mTable.value?.classList.remove("fixed");
1684
+ mTable.value.classList.remove("fixed");
1679
1685
  isFullscreen.value = false;
1680
1686
  } else {
1681
- mTable.value?.classList.add("fixed");
1687
+ mTable.value.classList.add("fixed");
1688
+ mTable.value.style.zIndex = `${nextZIndex()}`;
1682
1689
  isFullscreen.value = true;
1683
1690
  }
1684
1691
  };
@@ -1691,7 +1698,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1691
1698
  toggleRowSelection
1692
1699
  });
1693
1700
  return (_ctx, _cache) => {
1694
- return openBlock(), createElementBlock("div", null, [
1701
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
1695
1702
  (openBlock(), createBlock(Teleport, {
1696
1703
  to: "body",
1697
1704
  disabled: !isFullscreen.value
@@ -1705,7 +1712,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1705
1712
  key: 0,
1706
1713
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1707
1714
  innerHTML: _ctx.config.extra
1708
- }, null, 8, _hoisted_1$9)) : createCommentVNode("", true),
1715
+ }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1709
1716
  createVNode(unref(TMagicTooltip), {
1710
1717
  content: "拖拽可排序",
1711
1718
  placement: "left-start",
@@ -1737,7 +1744,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1737
1744
  createElementVNode("span", {
1738
1745
  innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1739
1746
  class: "m-form-tip"
1740
- }, null, 8, _hoisted_2$3)
1747
+ }, null, 8, _hoisted_3$1)
1741
1748
  ]),
1742
1749
  _: 1
1743
1750
  })) : createCommentVNode("", true),
@@ -1781,7 +1788,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1781
1788
  type: "primary",
1782
1789
  icon: unref(ArrowUp),
1783
1790
  disabled: _ctx.disabled,
1784
- text: "",
1791
+ link: "",
1785
1792
  onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1786
1793
  onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1787
1794
  }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
@@ -1800,7 +1807,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1800
1807
  type: "primary",
1801
1808
  icon: unref(ArrowDown),
1802
1809
  disabled: _ctx.disabled,
1803
- text: "",
1810
+ link: "",
1804
1811
  onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1805
1812
  onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1806
1813
  }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
@@ -1865,7 +1872,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1865
1872
  _: 3
1866
1873
  }, 8, ["disabled"]),
1867
1874
  renderSlot(_ctx.$slots, "default"),
1868
- createElementVNode("div", _hoisted_3, [
1875
+ createElementVNode("div", _hoisted_4, [
1869
1876
  addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1870
1877
  key: 0,
1871
1878
  size: "small",
@@ -1879,7 +1886,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1879
1886
  ]),
1880
1887
  _: 1
1881
1888
  }, 8, ["disabled"])) : createCommentVNode("", true),
1882
- createElementVNode("div", _hoisted_4, [
1889
+ createElementVNode("div", _hoisted_5, [
1883
1890
  _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1884
1891
  key: 0,
1885
1892
  icon: unref(Grid),
@@ -1944,7 +1951,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1944
1951
  }, 8, ["disabled"])) : createCommentVNode("", true)
1945
1952
  ])
1946
1953
  ]),
1947
- _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
1954
+ _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_6, [
1948
1955
  createVNode(unref(TMagicPagination), {
1949
1956
  layout: "total, sizes, prev, pager, next, jumper",
1950
1957
  "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
@@ -3138,7 +3145,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3138
3145
  });
3139
3146
 
3140
3147
  const _hoisted_1$5 = ["href"];
3141
- const _hoisted_2$2 = {
3148
+ const _hoisted_2$3 = {
3142
3149
  key: 2,
3143
3150
  class: "m-fields-link"
3144
3151
  };
@@ -3214,9 +3221,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3214
3221
  }, toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3215
3222
  key: 1,
3216
3223
  style: normalizeStyle(_ctx.config.disabledCss || {})
3217
- }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
3224
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
3218
3225
  createVNode(unref(TMagicButton), {
3219
- text: true,
3226
+ link: "",
3220
3227
  type: "primary",
3221
3228
  onClick: editHandler
3222
3229
  }, {
@@ -3291,7 +3298,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3291
3298
  });
3292
3299
 
3293
3300
  const _hoisted_1$4 = { class: "m-fields-number-range" };
3294
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3301
+ const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3295
3302
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
3296
3303
  ...{
3297
3304
  name: "MFormNumberRange"
@@ -3332,7 +3339,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3332
3339
  disabled: _ctx.disabled,
3333
3340
  onChange: minChangeHandler
3334
3341
  }, null, 8, ["modelValue", "size", "disabled"]),
3335
- _hoisted_2$1,
3342
+ _hoisted_2$2,
3336
3343
  createVNode(unref(TMagicInput), {
3337
3344
  modelValue: _ctx.model[_ctx.name][1],
3338
3345
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3875,7 +3882,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3875
3882
  }
3876
3883
  });
3877
3884
 
3878
- const _hoisted_1$2 = { key: 0 };
3885
+ const _hoisted_1$2 = { class: "m-form-item__content" };
3886
+ const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3887
+ const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3879
3888
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3880
3889
  ...{
3881
3890
  name: "MFormText"
@@ -3898,18 +3907,45 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3898
3907
  const emit = __emit;
3899
3908
  useAddField(props.prop);
3900
3909
  const mForm = inject("mForm");
3910
+ const appendConfig = computed(() => {
3911
+ if (typeof props.config.append === "string") {
3912
+ return {
3913
+ text: props.config.append,
3914
+ type: "button",
3915
+ handler: void 0
3916
+ };
3917
+ }
3918
+ if (props.config.append && typeof props.config.append === "object") {
3919
+ if (props.config.append.value === 0) {
3920
+ return false;
3921
+ }
3922
+ return props.config.append;
3923
+ }
3924
+ return false;
3925
+ });
3926
+ const popoverVisible = ref(false);
3927
+ const confirmTrimHandler = () => {
3928
+ emit("change", props.model[props.name].trim() || "");
3929
+ popoverVisible.value = false;
3930
+ };
3931
+ const checkWhiteSpace = (value) => {
3932
+ if (typeof value === "string" && !props.config.trim) {
3933
+ popoverVisible.value = value.trim() !== value;
3934
+ }
3935
+ };
3901
3936
  const changeHandler = (value) => {
3902
3937
  emit("change", value);
3903
3938
  };
3904
3939
  const inputHandler = (v) => {
3940
+ checkWhiteSpace(v);
3905
3941
  emit("input", v);
3906
3942
  mForm?.$emit("field-input", props.prop, v);
3907
3943
  };
3908
3944
  const buttonClickHandler = () => {
3909
- if (typeof props.config.append === "string")
3945
+ if (!appendConfig.value)
3910
3946
  return;
3911
- if (props.config.append?.handler) {
3912
- props.config.append.handler(mForm, {
3947
+ if (typeof appendConfig.value.handler === "function") {
3948
+ appendConfig.value.handler(mForm, {
3913
3949
  model: props.model,
3914
3950
  values: mForm?.values
3915
3951
  });
@@ -3967,36 +4003,70 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3967
4003
  emit("change", props.model[props.name]);
3968
4004
  };
3969
4005
  return (_ctx, _cache) => {
3970
- return openBlock(), createBlock(unref(TMagicInput), {
3971
- modelValue: _ctx.model[_ctx.name],
3972
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3973
- clearable: "",
3974
- size: _ctx.size,
3975
- placeholder: _ctx.config.placeholder,
3976
- disabled: _ctx.disabled,
3977
- onChange: changeHandler,
3978
- onInput: inputHandler,
3979
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
3980
- }, createSlots({ _: 2 }, [
3981
- _ctx.config.append ? {
3982
- name: "append",
3983
- fn: withCtx(() => [
3984
- typeof _ctx.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1$2, toDisplayString(_ctx.config.append), 1)) : createCommentVNode("", true),
3985
- typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
3986
- key: 1,
3987
- style: { "color": "#409eff" },
3988
- size: _ctx.size,
3989
- onClick: withModifiers(buttonClickHandler, ["prevent"])
3990
- }, {
3991
- default: withCtx(() => [
3992
- createTextVNode(toDisplayString(_ctx.config.append.text), 1)
4006
+ return openBlock(), createBlock(unref(TMagicPopover), {
4007
+ visible: popoverVisible.value,
4008
+ width: "220px"
4009
+ }, {
4010
+ reference: withCtx(() => [
4011
+ createVNode(unref(TMagicInput), {
4012
+ modelValue: _ctx.model[_ctx.name],
4013
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
4014
+ clearable: "",
4015
+ size: _ctx.size,
4016
+ placeholder: _ctx.config.placeholder,
4017
+ disabled: _ctx.disabled,
4018
+ onChange: changeHandler,
4019
+ onInput: inputHandler,
4020
+ onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
4021
+ }, createSlots({ _: 2 }, [
4022
+ appendConfig.value ? {
4023
+ name: "append",
4024
+ fn: withCtx(() => [
4025
+ appendConfig.value.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
4026
+ key: 0,
4027
+ style: { "color": "#409eff" },
4028
+ size: _ctx.size,
4029
+ onClick: withModifiers(buttonClickHandler, ["prevent"])
4030
+ }, {
4031
+ default: withCtx(() => [
4032
+ createTextVNode(toDisplayString(appendConfig.value.text), 1)
4033
+ ]),
4034
+ _: 1
4035
+ }, 8, ["size", "onClick"])) : createCommentVNode("", true)
3993
4036
  ]),
3994
- _: 1
3995
- }, 8, ["size", "onClick"])) : createCommentVNode("", true)
3996
- ]),
3997
- key: "0"
3998
- } : void 0
3999
- ]), 1032, ["modelValue", "size", "placeholder", "disabled"]);
4037
+ key: "0"
4038
+ } : void 0
4039
+ ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4040
+ ]),
4041
+ default: withCtx(() => [
4042
+ createElementVNode("div", _hoisted_1$2, [
4043
+ _hoisted_2$1,
4044
+ createElementVNode("div", _hoisted_3, [
4045
+ createVNode(unref(TMagicButton), {
4046
+ link: "",
4047
+ size: "small",
4048
+ onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
4049
+ }, {
4050
+ default: withCtx(() => [
4051
+ createTextVNode("保持原样")
4052
+ ]),
4053
+ _: 1
4054
+ }),
4055
+ createVNode(unref(TMagicButton), {
4056
+ type: "primary",
4057
+ size: "small",
4058
+ onClick: confirmTrimHandler
4059
+ }, {
4060
+ default: withCtx(() => [
4061
+ createTextVNode("移除空格")
4062
+ ]),
4063
+ _: 1
4064
+ })
4065
+ ])
4066
+ ])
4067
+ ]),
4068
+ _: 1
4069
+ }, 8, ["visible"]);
4000
4070
  };
4001
4071
  }
4002
4072
  });
@@ -4445,6 +4515,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4445
4515
  }
4446
4516
  });
4447
4517
 
4518
+ const createForm = function(config) {
4519
+ return config;
4520
+ };
4448
4521
  const defaultInstallOpt = {};
4449
4522
  const index = {
4450
4523
  install(app, opt = {}) {
@@ -4484,5 +4557,4 @@ const index = {
4484
4557
  }
4485
4558
  };
4486
4559
 
4487
- export { _sfc_main$p as MCascader, _sfc_main$o as MCheckbox, _sfc_main$n as MCheckboxGroup, _sfc_main$m as MColorPicker, _sfc_main$z as MContainer, _sfc_main$l as MDate, _sfc_main$j as MDateTime, _sfc_main$k as MDaterange, _sfc_main$i as MDisplay, _sfc_main$h as MDynamicField, _sfc_main$y as MFieldset, _sfc_main$f as MForm, _sfc_main as MFormBox, _sfc_main$e as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$g as MHidden, _sfc_main$d as MLink, _sfc_main$c as MNumber, _sfc_main$b as MNumberRange, _sfc_main$v as MPanel, _sfc_main$a as MRadioGroup, _sfc_main$t as MRow, _sfc_main$7 as MSelect, _sfc_main$6 as MSwitch, _sfc_main$r as MTable, _sfc_main$q as MTabs, _sfc_main$5 as MText, _sfc_main$4 as MTextarea, _sfc_main$3 as MTime, _sfc_main$2 as MTimerange, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
4488
- //# sourceMappingURL=tmagic-form.js.map
4560
+ export { _sfc_main$p as MCascader, _sfc_main$o as MCheckbox, _sfc_main$n as MCheckboxGroup, _sfc_main$m as MColorPicker, _sfc_main$z as MContainer, _sfc_main$l as MDate, _sfc_main$j as MDateTime, _sfc_main$k as MDaterange, _sfc_main$i as MDisplay, _sfc_main$h as MDynamicField, _sfc_main$y as MFieldset, _sfc_main$f as MForm, _sfc_main as MFormBox, _sfc_main$e as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$g as MHidden, _sfc_main$d as MLink, _sfc_main$c as MNumber, _sfc_main$b as MNumberRange, _sfc_main$v as MPanel, _sfc_main$a as MRadioGroup, _sfc_main$t as MRow, _sfc_main$7 as MSelect, _sfc_main$6 as MSwitch, _sfc_main$r as MTable, _sfc_main$q as MTabs, _sfc_main$5 as MText, _sfc_main$4 as MTextarea, _sfc_main$3 as MTime, _sfc_main$2 as MTimerange, createForm, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };