@tmagic/form 1.3.8 → 1.3.10

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.
@@ -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,272 +1698,274 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1691
1698
  toggleRowSelection
1692
1699
  });
1693
1700
  return (_ctx, _cache) => {
1694
- return openBlock(), createBlock(Teleport, {
1695
- to: "body",
1696
- disabled: !isFullscreen.value
1697
- }, [
1698
- createElementVNode("div", {
1699
- ref_key: "mTable",
1700
- ref: mTable,
1701
- class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1701
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
1702
+ (openBlock(), createBlock(Teleport, {
1703
+ to: "body",
1704
+ disabled: !isFullscreen.value
1702
1705
  }, [
1703
- _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1704
- key: 0,
1705
- style: { "color": "rgba(0, 0, 0, 0.45)" },
1706
- innerHTML: _ctx.config.extra
1707
- }, null, 8, _hoisted_1$9)) : createCommentVNode("", true),
1708
- createVNode(unref(TMagicTooltip), {
1709
- content: "拖拽可排序",
1710
- placement: "left-start",
1711
- disabled: _ctx.config.dropSort !== true
1712
- }, {
1713
- default: withCtx(() => [
1714
- _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1715
- ref_key: "tMagicTable",
1716
- ref: tMagicTable,
1717
- style: { "width": "100%" },
1718
- "row-key": _ctx.config.rowKey || "id",
1719
- data: data.value,
1720
- lastData: lastData.value,
1721
- border: _ctx.config.border,
1722
- "max-height": _ctx.config.maxHeight,
1723
- "default-expand-all": true,
1724
- key: updateKey.value,
1725
- onSelect: selectHandle,
1726
- onSortChange: sortChange
1727
- }, {
1728
- default: withCtx(() => [
1729
- _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1730
- key: 0,
1731
- fixed: "left",
1732
- width: "30",
1733
- type: "expand"
1734
- }, {
1735
- default: withCtx((scope) => [
1736
- createElementVNode("span", {
1737
- innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1738
- class: "m-form-tip"
1739
- }, null, 8, _hoisted_2$3)
1740
- ]),
1741
- _: 1
1742
- })) : createCommentVNode("", true),
1743
- createVNode(unref(TMagicTableColumn), {
1744
- label: "操作",
1745
- width: _ctx.config.operateColWidth || 55,
1746
- align: "center",
1747
- fixed: _ctx.config.fixed === false ? void 0 : "left"
1748
- }, {
1749
- default: withCtx((scope) => [
1750
- renderSlot(_ctx.$slots, "operateCol", { scope }),
1751
- withDirectives(createVNode(unref(TMagicIcon), {
1752
- class: "m-table-delete-icon",
1753
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1754
- }, {
1755
- default: withCtx(() => [
1756
- createVNode(unref(Delete))
1757
- ]),
1758
- _: 2
1759
- }, 1032, ["onClick"]), [
1760
- [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1761
- ])
1762
- ]),
1763
- _: 3
1764
- }, 8, ["width", "fixed"]),
1765
- _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1766
- key: 1,
1767
- label: "排序",
1768
- width: "60"
1769
- }, {
1770
- default: withCtx((scope) => [
1771
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1772
- key: 0,
1773
- content: "点击上移,双击置顶",
1774
- placement: "top"
1775
- }, {
1776
- default: withCtx(() => [
1777
- createVNode(unref(TMagicButton), {
1778
- plain: "",
1779
- size: "small",
1780
- type: "primary",
1781
- icon: unref(ArrowUp),
1782
- disabled: _ctx.disabled,
1783
- text: "",
1784
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1785
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1786
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1787
- ]),
1788
- _: 2
1789
- }, 1024)) : createCommentVNode("", true),
1790
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1791
- key: 1,
1792
- content: "点击下移,双击置底",
1793
- placement: "top"
1794
- }, {
1795
- default: withCtx(() => [
1796
- createVNode(unref(TMagicButton), {
1797
- plain: "",
1798
- size: "small",
1799
- type: "primary",
1800
- icon: unref(ArrowDown),
1801
- disabled: _ctx.disabled,
1802
- text: "",
1803
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1804
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1805
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1806
- ]),
1807
- _: 2
1808
- }, 1024)) : createCommentVNode("", true)
1809
- ]),
1810
- _: 1
1811
- })) : createCommentVNode("", true),
1812
- selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1813
- key: 2,
1814
- align: "center",
1815
- "header-align": "center",
1816
- type: "selection",
1817
- width: "45"
1818
- })) : createCommentVNode("", true),
1819
- _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1820
- key: 3,
1821
- width: "60",
1822
- label: "序号"
1823
- }, {
1824
- default: withCtx((scope) => [
1825
- createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1826
- ]),
1827
- _: 1
1828
- })) : createCommentVNode("", true),
1829
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1830
- return openBlock(), createElementBlock(Fragment, null, [
1831
- column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1832
- prop: column.name,
1833
- width: column.width,
1834
- label: column.label,
1835
- sortable: column.sortable,
1836
- "sort-orders": ["ascending", "descending"],
1837
- key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1838
- "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1839
- }, {
1840
- default: withCtx((scope) => [
1841
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$z, {
1842
- key: 0,
1843
- labelWidth: "0",
1844
- disabled: _ctx.disabled,
1845
- prop: getProp(scope.$index),
1846
- rules: column.rules,
1847
- config: makeConfig(column, scope.row),
1848
- model: scope.row,
1849
- lastValues: lastData.value[scope.$index],
1850
- "is-compare": _ctx.isCompare,
1851
- size: _ctx.size,
1852
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1853
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1854
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1855
- ]),
1856
- _: 2
1857
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1858
- ], 64);
1859
- }), 256))
1860
- ]),
1861
- _: 3
1862
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1863
- ]),
1864
- _: 3
1865
- }, 8, ["disabled"]),
1866
- renderSlot(_ctx.$slots, "default"),
1867
- createElementVNode("div", _hoisted_3, [
1868
- addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1706
+ createElementVNode("div", {
1707
+ ref_key: "mTable",
1708
+ ref: mTable,
1709
+ class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1710
+ }, [
1711
+ _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1869
1712
  key: 0,
1870
- size: "small",
1871
- type: "primary",
1872
- disabled: _ctx.disabled,
1873
- plain: "",
1874
- onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1713
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
1714
+ innerHTML: _ctx.config.extra
1715
+ }, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
1716
+ createVNode(unref(TMagicTooltip), {
1717
+ content: "拖拽可排序",
1718
+ placement: "left-start",
1719
+ disabled: _ctx.config.dropSort !== true
1875
1720
  }, {
1876
1721
  default: withCtx(() => [
1877
- createTextVNode("新增一行")
1722
+ _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1723
+ ref_key: "tMagicTable",
1724
+ ref: tMagicTable,
1725
+ style: { "width": "100%" },
1726
+ "row-key": _ctx.config.rowKey || "id",
1727
+ data: data.value,
1728
+ lastData: lastData.value,
1729
+ border: _ctx.config.border,
1730
+ "max-height": _ctx.config.maxHeight,
1731
+ "default-expand-all": true,
1732
+ key: updateKey.value,
1733
+ onSelect: selectHandle,
1734
+ onSortChange: sortChange
1735
+ }, {
1736
+ default: withCtx(() => [
1737
+ _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1738
+ key: 0,
1739
+ fixed: "left",
1740
+ width: "30",
1741
+ type: "expand"
1742
+ }, {
1743
+ default: withCtx((scope) => [
1744
+ createElementVNode("span", {
1745
+ innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1746
+ class: "m-form-tip"
1747
+ }, null, 8, _hoisted_3$1)
1748
+ ]),
1749
+ _: 1
1750
+ })) : createCommentVNode("", true),
1751
+ createVNode(unref(TMagicTableColumn), {
1752
+ label: "操作",
1753
+ width: _ctx.config.operateColWidth || 55,
1754
+ align: "center",
1755
+ fixed: _ctx.config.fixed === false ? void 0 : "left"
1756
+ }, {
1757
+ default: withCtx((scope) => [
1758
+ renderSlot(_ctx.$slots, "operateCol", { scope }),
1759
+ withDirectives(createVNode(unref(TMagicIcon), {
1760
+ class: "m-table-delete-icon",
1761
+ onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1762
+ }, {
1763
+ default: withCtx(() => [
1764
+ createVNode(unref(Delete))
1765
+ ]),
1766
+ _: 2
1767
+ }, 1032, ["onClick"]), [
1768
+ [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1769
+ ])
1770
+ ]),
1771
+ _: 3
1772
+ }, 8, ["width", "fixed"]),
1773
+ _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1774
+ key: 1,
1775
+ label: "排序",
1776
+ width: "60"
1777
+ }, {
1778
+ default: withCtx((scope) => [
1779
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1780
+ key: 0,
1781
+ content: "点击上移,双击置顶",
1782
+ placement: "top"
1783
+ }, {
1784
+ default: withCtx(() => [
1785
+ createVNode(unref(TMagicButton), {
1786
+ plain: "",
1787
+ size: "small",
1788
+ type: "primary",
1789
+ icon: unref(ArrowUp),
1790
+ disabled: _ctx.disabled,
1791
+ link: "",
1792
+ onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1793
+ onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1794
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1795
+ ]),
1796
+ _: 2
1797
+ }, 1024)) : createCommentVNode("", true),
1798
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1799
+ key: 1,
1800
+ content: "点击下移,双击置底",
1801
+ placement: "top"
1802
+ }, {
1803
+ default: withCtx(() => [
1804
+ createVNode(unref(TMagicButton), {
1805
+ plain: "",
1806
+ size: "small",
1807
+ type: "primary",
1808
+ icon: unref(ArrowDown),
1809
+ disabled: _ctx.disabled,
1810
+ link: "",
1811
+ onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1812
+ onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1813
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1814
+ ]),
1815
+ _: 2
1816
+ }, 1024)) : createCommentVNode("", true)
1817
+ ]),
1818
+ _: 1
1819
+ })) : createCommentVNode("", true),
1820
+ selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1821
+ key: 2,
1822
+ align: "center",
1823
+ "header-align": "center",
1824
+ type: "selection",
1825
+ width: "45"
1826
+ })) : createCommentVNode("", true),
1827
+ _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1828
+ key: 3,
1829
+ width: "60",
1830
+ label: "序号"
1831
+ }, {
1832
+ default: withCtx((scope) => [
1833
+ createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1834
+ ]),
1835
+ _: 1
1836
+ })) : createCommentVNode("", true),
1837
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1838
+ return openBlock(), createElementBlock(Fragment, null, [
1839
+ column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1840
+ prop: column.name,
1841
+ width: column.width,
1842
+ label: column.label,
1843
+ sortable: column.sortable,
1844
+ "sort-orders": ["ascending", "descending"],
1845
+ key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1846
+ "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1847
+ }, {
1848
+ default: withCtx((scope) => [
1849
+ scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$z, {
1850
+ key: 0,
1851
+ labelWidth: "0",
1852
+ disabled: _ctx.disabled,
1853
+ prop: getProp(scope.$index),
1854
+ rules: column.rules,
1855
+ config: makeConfig(column, scope.row),
1856
+ model: scope.row,
1857
+ lastValues: lastData.value[scope.$index],
1858
+ "is-compare": _ctx.isCompare,
1859
+ size: _ctx.size,
1860
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1861
+ onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1862
+ }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1863
+ ]),
1864
+ _: 2
1865
+ }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1866
+ ], 64);
1867
+ }), 256))
1868
+ ]),
1869
+ _: 3
1870
+ }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1878
1871
  ]),
1879
- _: 1
1880
- }, 8, ["disabled"])) : createCommentVNode("", true),
1872
+ _: 3
1873
+ }, 8, ["disabled"]),
1874
+ renderSlot(_ctx.$slots, "default"),
1881
1875
  createElementVNode("div", _hoisted_4, [
1882
- _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1876
+ addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1883
1877
  key: 0,
1884
- icon: unref(Grid),
1885
1878
  size: "small",
1886
1879
  type: "primary",
1887
- onClick: toggleMode
1888
- }, {
1889
- default: withCtx(() => [
1890
- createTextVNode("展开配置")
1891
- ]),
1892
- _: 1
1893
- }, 8, ["icon"])) : createCommentVNode("", true),
1894
- _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1895
- key: 1,
1896
- icon: unref(FullScreen),
1897
- size: "small",
1898
- type: "primary",
1899
- onClick: toggleFullscreen
1900
- }, {
1901
- default: withCtx(() => [
1902
- createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1903
- ]),
1904
- _: 1
1905
- }, 8, ["icon"])) : createCommentVNode("", true),
1906
- importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1907
- key: 2,
1908
- style: { "display": "inline-block" },
1909
- ref_key: "excelBtn",
1910
- ref: excelBtn,
1911
- action: "/noop",
1912
- disabled: _ctx.disabled,
1913
- "on-change": excelHandler,
1914
- "auto-upload": false
1915
- }, {
1916
- default: withCtx(() => [
1917
- createVNode(unref(TMagicButton), {
1918
- size: "small",
1919
- type: "success",
1920
- disabled: _ctx.disabled,
1921
- plain: ""
1922
- }, {
1923
- default: withCtx(() => [
1924
- createTextVNode("导入EXCEL")
1925
- ]),
1926
- _: 1
1927
- }, 8, ["disabled"])
1928
- ]),
1929
- _: 1
1930
- }, 8, ["disabled"])) : createCommentVNode("", true),
1931
- importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1932
- key: 3,
1933
- size: "small",
1934
- type: "warning",
1935
1880
  disabled: _ctx.disabled,
1936
1881
  plain: "",
1937
- onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1882
+ onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1938
1883
  }, {
1939
1884
  default: withCtx(() => [
1940
- createTextVNode("清空")
1885
+ createTextVNode("新增一行")
1941
1886
  ]),
1942
1887
  _: 1
1943
- }, 8, ["disabled"])) : createCommentVNode("", true)
1944
- ])
1945
- ]),
1946
- _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
1947
- createVNode(unref(TMagicPagination), {
1948
- layout: "total, sizes, prev, pager, next, jumper",
1949
- "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
1950
- "current-page": pagecontext.value + 1,
1951
- "page-sizes": [pagesize.value, 60, 120, 300],
1952
- "page-size": pagesize.value,
1953
- total: _ctx.model[modelName.value].length,
1954
- onSizeChange: handleSizeChange,
1955
- onCurrentChange: handleCurrentChange
1956
- }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
1957
- ])) : createCommentVNode("", true)
1958
- ], 2)
1959
- ], 8, ["disabled"]);
1888
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1889
+ createElementVNode("div", _hoisted_5, [
1890
+ _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1891
+ key: 0,
1892
+ icon: unref(Grid),
1893
+ size: "small",
1894
+ type: "primary",
1895
+ onClick: toggleMode
1896
+ }, {
1897
+ default: withCtx(() => [
1898
+ createTextVNode("展开配置")
1899
+ ]),
1900
+ _: 1
1901
+ }, 8, ["icon"])) : createCommentVNode("", true),
1902
+ _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1903
+ key: 1,
1904
+ icon: unref(FullScreen),
1905
+ size: "small",
1906
+ type: "primary",
1907
+ onClick: toggleFullscreen
1908
+ }, {
1909
+ default: withCtx(() => [
1910
+ createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1911
+ ]),
1912
+ _: 1
1913
+ }, 8, ["icon"])) : createCommentVNode("", true),
1914
+ importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1915
+ key: 2,
1916
+ style: { "display": "inline-block" },
1917
+ ref_key: "excelBtn",
1918
+ ref: excelBtn,
1919
+ action: "/noop",
1920
+ disabled: _ctx.disabled,
1921
+ "on-change": excelHandler,
1922
+ "auto-upload": false
1923
+ }, {
1924
+ default: withCtx(() => [
1925
+ createVNode(unref(TMagicButton), {
1926
+ size: "small",
1927
+ type: "success",
1928
+ disabled: _ctx.disabled,
1929
+ plain: ""
1930
+ }, {
1931
+ default: withCtx(() => [
1932
+ createTextVNode("导入EXCEL")
1933
+ ]),
1934
+ _: 1
1935
+ }, 8, ["disabled"])
1936
+ ]),
1937
+ _: 1
1938
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1939
+ importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1940
+ key: 3,
1941
+ size: "small",
1942
+ type: "warning",
1943
+ disabled: _ctx.disabled,
1944
+ plain: "",
1945
+ onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1946
+ }, {
1947
+ default: withCtx(() => [
1948
+ createTextVNode("清空")
1949
+ ]),
1950
+ _: 1
1951
+ }, 8, ["disabled"])) : createCommentVNode("", true)
1952
+ ])
1953
+ ]),
1954
+ _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_6, [
1955
+ createVNode(unref(TMagicPagination), {
1956
+ layout: "total, sizes, prev, pager, next, jumper",
1957
+ "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
1958
+ "current-page": pagecontext.value + 1,
1959
+ "page-sizes": [pagesize.value, 60, 120, 300],
1960
+ "page-size": pagesize.value,
1961
+ total: _ctx.model[modelName.value].length,
1962
+ onSizeChange: handleSizeChange,
1963
+ onCurrentChange: handleCurrentChange
1964
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
1965
+ ])) : createCommentVNode("", true)
1966
+ ], 2)
1967
+ ], 8, ["disabled"]))
1968
+ ]);
1960
1969
  };
1961
1970
  }
1962
1971
  });
@@ -3136,7 +3145,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3136
3145
  });
3137
3146
 
3138
3147
  const _hoisted_1$5 = ["href"];
3139
- const _hoisted_2$2 = {
3148
+ const _hoisted_2$3 = {
3140
3149
  key: 2,
3141
3150
  class: "m-fields-link"
3142
3151
  };
@@ -3212,9 +3221,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3212
3221
  }, toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
3213
3222
  key: 1,
3214
3223
  style: normalizeStyle(_ctx.config.disabledCss || {})
3215
- }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
3224
+ }, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$3, [
3216
3225
  createVNode(unref(TMagicButton), {
3217
- text: true,
3226
+ link: "",
3218
3227
  type: "primary",
3219
3228
  onClick: editHandler
3220
3229
  }, {
@@ -3289,7 +3298,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3289
3298
  });
3290
3299
 
3291
3300
  const _hoisted_1$4 = { class: "m-fields-number-range" };
3292
- const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3301
+ const _hoisted_2$2 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3293
3302
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
3294
3303
  ...{
3295
3304
  name: "MFormNumberRange"
@@ -3330,7 +3339,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3330
3339
  disabled: _ctx.disabled,
3331
3340
  onChange: minChangeHandler
3332
3341
  }, null, 8, ["modelValue", "size", "disabled"]),
3333
- _hoisted_2$1,
3342
+ _hoisted_2$2,
3334
3343
  createVNode(unref(TMagicInput), {
3335
3344
  modelValue: _ctx.model[_ctx.name][1],
3336
3345
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3873,7 +3882,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3873
3882
  }
3874
3883
  });
3875
3884
 
3876
- 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" } };
3877
3888
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3878
3889
  ...{
3879
3890
  name: "MFormText"
@@ -3896,18 +3907,45 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3896
3907
  const emit = __emit;
3897
3908
  useAddField(props.prop);
3898
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
+ };
3899
3936
  const changeHandler = (value) => {
3900
3937
  emit("change", value);
3901
3938
  };
3902
3939
  const inputHandler = (v) => {
3940
+ checkWhiteSpace(v);
3903
3941
  emit("input", v);
3904
3942
  mForm?.$emit("field-input", props.prop, v);
3905
3943
  };
3906
3944
  const buttonClickHandler = () => {
3907
- if (typeof props.config.append === "string")
3945
+ if (!appendConfig.value)
3908
3946
  return;
3909
- if (props.config.append?.handler) {
3910
- props.config.append.handler(mForm, {
3947
+ if (typeof appendConfig.value.handler === "function") {
3948
+ appendConfig.value.handler(mForm, {
3911
3949
  model: props.model,
3912
3950
  values: mForm?.values
3913
3951
  });
@@ -3965,36 +4003,70 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3965
4003
  emit("change", props.model[props.name]);
3966
4004
  };
3967
4005
  return (_ctx, _cache) => {
3968
- return openBlock(), createBlock(unref(TMagicInput), {
3969
- modelValue: _ctx.model[_ctx.name],
3970
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3971
- clearable: "",
3972
- size: _ctx.size,
3973
- placeholder: _ctx.config.placeholder,
3974
- disabled: _ctx.disabled,
3975
- onChange: changeHandler,
3976
- onInput: inputHandler,
3977
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
3978
- }, createSlots({ _: 2 }, [
3979
- _ctx.config.append ? {
3980
- name: "append",
3981
- fn: withCtx(() => [
3982
- typeof _ctx.config.append === "string" ? (openBlock(), createElementBlock("span", _hoisted_1$2, toDisplayString(_ctx.config.append), 1)) : createCommentVNode("", true),
3983
- typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (openBlock(), createBlock(unref(TMagicButton), {
3984
- key: 1,
3985
- style: { "color": "#409eff" },
3986
- size: _ctx.size,
3987
- onClick: withModifiers(buttonClickHandler, ["prevent"])
3988
- }, {
3989
- default: withCtx(() => [
3990
- 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)
3991
4036
  ]),
3992
- _: 1
3993
- }, 8, ["size", "onClick"])) : createCommentVNode("", true)
3994
- ]),
3995
- key: "0"
3996
- } : void 0
3997
- ]), 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
+ type: "text",
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"]);
3998
4070
  };
3999
4071
  }
4000
4072
  });
@@ -4443,6 +4515,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4443
4515
  }
4444
4516
  });
4445
4517
 
4518
+ const createForm = function(config) {
4519
+ return config;
4520
+ };
4446
4521
  const defaultInstallOpt = {};
4447
4522
  const index = {
4448
4523
  install(app, opt = {}) {
@@ -4482,5 +4557,5 @@ const index = {
4482
4557
  }
4483
4558
  };
4484
4559
 
4485
- 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 };
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 };
4486
4561
  //# sourceMappingURL=tmagic-form.js.map