@tmagic/form 1.3.7 → 1.3.9

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.
@@ -1433,6 +1433,15 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1433
1433
  tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
1434
1434
  return;
1435
1435
  }
1436
+ if (typeof props.config.beforeAddRow === "function") {
1437
+ const beforeCheckRes = props.config.beforeAddRow(mForm, {
1438
+ model: props.model[modelName.value],
1439
+ formValue: mForm?.values,
1440
+ prop: props.prop
1441
+ });
1442
+ if (!beforeCheckRes)
1443
+ return;
1444
+ }
1436
1445
  const columns = props.config.items;
1437
1446
  const enumValues = props.config.enum || [];
1438
1447
  let enumV = [];
@@ -1682,272 +1691,274 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1682
1691
  toggleRowSelection
1683
1692
  });
1684
1693
  return (_ctx, _cache) => {
1685
- return openBlock(), createBlock(Teleport, {
1686
- to: "body",
1687
- disabled: !isFullscreen.value
1688
- }, [
1689
- createElementVNode("div", {
1690
- ref_key: "mTable",
1691
- ref: mTable,
1692
- class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1694
+ return openBlock(), createElementBlock("div", null, [
1695
+ (openBlock(), createBlock(Teleport, {
1696
+ to: "body",
1697
+ disabled: !isFullscreen.value
1693
1698
  }, [
1694
- _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1695
- key: 0,
1696
- style: { "color": "rgba(0, 0, 0, 0.45)" },
1697
- innerHTML: _ctx.config.extra
1698
- }, null, 8, _hoisted_1$9)) : createCommentVNode("", true),
1699
- createVNode(unref(TMagicTooltip), {
1700
- content: "拖拽可排序",
1701
- placement: "left-start",
1702
- disabled: _ctx.config.dropSort !== true
1703
- }, {
1704
- default: withCtx(() => [
1705
- _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1706
- ref_key: "tMagicTable",
1707
- ref: tMagicTable,
1708
- style: { "width": "100%" },
1709
- "row-key": _ctx.config.rowKey || "id",
1710
- data: data.value,
1711
- lastData: lastData.value,
1712
- border: _ctx.config.border,
1713
- "max-height": _ctx.config.maxHeight,
1714
- "default-expand-all": true,
1715
- key: updateKey.value,
1716
- onSelect: selectHandle,
1717
- onSortChange: sortChange
1718
- }, {
1719
- default: withCtx(() => [
1720
- _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1721
- key: 0,
1722
- fixed: "left",
1723
- width: "30",
1724
- type: "expand"
1725
- }, {
1726
- default: withCtx((scope) => [
1727
- createElementVNode("span", {
1728
- innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1729
- class: "m-form-tip"
1730
- }, null, 8, _hoisted_2$3)
1731
- ]),
1732
- _: 1
1733
- })) : createCommentVNode("", true),
1734
- createVNode(unref(TMagicTableColumn), {
1735
- label: "操作",
1736
- width: _ctx.config.operateColWidth || 55,
1737
- align: "center",
1738
- fixed: _ctx.config.fixed === false ? void 0 : "left"
1739
- }, {
1740
- default: withCtx((scope) => [
1741
- renderSlot(_ctx.$slots, "operateCol", { scope }),
1742
- withDirectives(createVNode(unref(TMagicIcon), {
1743
- class: "m-table-delete-icon",
1744
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1745
- }, {
1746
- default: withCtx(() => [
1747
- createVNode(unref(Delete))
1748
- ]),
1749
- _: 2
1750
- }, 1032, ["onClick"]), [
1751
- [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1752
- ])
1753
- ]),
1754
- _: 3
1755
- }, 8, ["width", "fixed"]),
1756
- _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1757
- key: 1,
1758
- label: "排序",
1759
- width: "60"
1760
- }, {
1761
- default: withCtx((scope) => [
1762
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1763
- key: 0,
1764
- content: "点击上移,双击置顶",
1765
- placement: "top"
1766
- }, {
1767
- default: withCtx(() => [
1768
- createVNode(unref(TMagicButton), {
1769
- plain: "",
1770
- size: "small",
1771
- type: "primary",
1772
- icon: unref(ArrowUp),
1773
- disabled: _ctx.disabled,
1774
- text: "",
1775
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1776
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1777
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1778
- ]),
1779
- _: 2
1780
- }, 1024)) : createCommentVNode("", true),
1781
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1782
- key: 1,
1783
- content: "点击下移,双击置底",
1784
- placement: "top"
1785
- }, {
1786
- default: withCtx(() => [
1787
- createVNode(unref(TMagicButton), {
1788
- plain: "",
1789
- size: "small",
1790
- type: "primary",
1791
- icon: unref(ArrowDown),
1792
- disabled: _ctx.disabled,
1793
- text: "",
1794
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1795
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1796
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1797
- ]),
1798
- _: 2
1799
- }, 1024)) : createCommentVNode("", true)
1800
- ]),
1801
- _: 1
1802
- })) : createCommentVNode("", true),
1803
- selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1804
- key: 2,
1805
- align: "center",
1806
- "header-align": "center",
1807
- type: "selection",
1808
- width: "45"
1809
- })) : createCommentVNode("", true),
1810
- _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1811
- key: 3,
1812
- width: "60",
1813
- label: "序号"
1814
- }, {
1815
- default: withCtx((scope) => [
1816
- createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1817
- ]),
1818
- _: 1
1819
- })) : createCommentVNode("", true),
1820
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1821
- return openBlock(), createElementBlock(Fragment, null, [
1822
- column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1823
- prop: column.name,
1824
- width: column.width,
1825
- label: column.label,
1826
- sortable: column.sortable,
1827
- "sort-orders": ["ascending", "descending"],
1828
- key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1829
- "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1830
- }, {
1831
- default: withCtx((scope) => [
1832
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$z, {
1833
- key: 0,
1834
- labelWidth: "0",
1835
- disabled: _ctx.disabled,
1836
- prop: getProp(scope.$index),
1837
- rules: column.rules,
1838
- config: makeConfig(column, scope.row),
1839
- model: scope.row,
1840
- lastValues: lastData.value[scope.$index],
1841
- "is-compare": _ctx.isCompare,
1842
- size: _ctx.size,
1843
- onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1844
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1845
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1846
- ]),
1847
- _: 2
1848
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1849
- ], 64);
1850
- }), 256))
1851
- ]),
1852
- _: 3
1853
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1854
- ]),
1855
- _: 3
1856
- }, 8, ["disabled"]),
1857
- renderSlot(_ctx.$slots, "default"),
1858
- createElementVNode("div", _hoisted_3, [
1859
- addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1699
+ createElementVNode("div", {
1700
+ ref_key: "mTable",
1701
+ ref: mTable,
1702
+ class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1703
+ }, [
1704
+ _ctx.config.extra ? (openBlock(), createElementBlock("span", {
1860
1705
  key: 0,
1861
- size: "small",
1862
- type: "primary",
1863
- disabled: _ctx.disabled,
1864
- plain: "",
1865
- onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1706
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
1707
+ innerHTML: _ctx.config.extra
1708
+ }, null, 8, _hoisted_1$9)) : createCommentVNode("", true),
1709
+ createVNode(unref(TMagicTooltip), {
1710
+ content: "拖拽可排序",
1711
+ placement: "left-start",
1712
+ disabled: _ctx.config.dropSort !== true
1866
1713
  }, {
1867
1714
  default: withCtx(() => [
1868
- createTextVNode("新增一行")
1715
+ _ctx.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
1716
+ ref_key: "tMagicTable",
1717
+ ref: tMagicTable,
1718
+ style: { "width": "100%" },
1719
+ "row-key": _ctx.config.rowKey || "id",
1720
+ data: data.value,
1721
+ lastData: lastData.value,
1722
+ border: _ctx.config.border,
1723
+ "max-height": _ctx.config.maxHeight,
1724
+ "default-expand-all": true,
1725
+ key: updateKey.value,
1726
+ onSelect: selectHandle,
1727
+ onSortChange: sortChange
1728
+ }, {
1729
+ default: withCtx(() => [
1730
+ _ctx.config.itemExtra ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1731
+ key: 0,
1732
+ fixed: "left",
1733
+ width: "30",
1734
+ type: "expand"
1735
+ }, {
1736
+ default: withCtx((scope) => [
1737
+ createElementVNode("span", {
1738
+ innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1739
+ class: "m-form-tip"
1740
+ }, null, 8, _hoisted_2$3)
1741
+ ]),
1742
+ _: 1
1743
+ })) : createCommentVNode("", true),
1744
+ createVNode(unref(TMagicTableColumn), {
1745
+ label: "操作",
1746
+ width: _ctx.config.operateColWidth || 55,
1747
+ align: "center",
1748
+ fixed: _ctx.config.fixed === false ? void 0 : "left"
1749
+ }, {
1750
+ default: withCtx((scope) => [
1751
+ renderSlot(_ctx.$slots, "operateCol", { scope }),
1752
+ withDirectives(createVNode(unref(TMagicIcon), {
1753
+ class: "m-table-delete-icon",
1754
+ onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1755
+ }, {
1756
+ default: withCtx(() => [
1757
+ createVNode(unref(Delete))
1758
+ ]),
1759
+ _: 2
1760
+ }, 1032, ["onClick"]), [
1761
+ [vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
1762
+ ])
1763
+ ]),
1764
+ _: 3
1765
+ }, 8, ["width", "fixed"]),
1766
+ _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1767
+ key: 1,
1768
+ label: "排序",
1769
+ width: "60"
1770
+ }, {
1771
+ default: withCtx((scope) => [
1772
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1773
+ key: 0,
1774
+ content: "点击上移,双击置顶",
1775
+ placement: "top"
1776
+ }, {
1777
+ default: withCtx(() => [
1778
+ createVNode(unref(TMagicButton), {
1779
+ plain: "",
1780
+ size: "small",
1781
+ type: "primary",
1782
+ icon: unref(ArrowUp),
1783
+ disabled: _ctx.disabled,
1784
+ text: "",
1785
+ onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1786
+ onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1787
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1788
+ ]),
1789
+ _: 2
1790
+ }, 1024)) : createCommentVNode("", true),
1791
+ scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (openBlock(), createBlock(unref(TMagicTooltip), {
1792
+ key: 1,
1793
+ content: "点击下移,双击置底",
1794
+ placement: "top"
1795
+ }, {
1796
+ default: withCtx(() => [
1797
+ createVNode(unref(TMagicButton), {
1798
+ plain: "",
1799
+ size: "small",
1800
+ type: "primary",
1801
+ icon: unref(ArrowDown),
1802
+ disabled: _ctx.disabled,
1803
+ text: "",
1804
+ onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
1805
+ onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
1806
+ }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
1807
+ ]),
1808
+ _: 2
1809
+ }, 1024)) : createCommentVNode("", true)
1810
+ ]),
1811
+ _: 1
1812
+ })) : createCommentVNode("", true),
1813
+ selection.value ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1814
+ key: 2,
1815
+ align: "center",
1816
+ "header-align": "center",
1817
+ type: "selection",
1818
+ width: "45"
1819
+ })) : createCommentVNode("", true),
1820
+ _ctx.showIndex && _ctx.config.showIndex ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1821
+ key: 3,
1822
+ width: "60",
1823
+ label: "序号"
1824
+ }, {
1825
+ default: withCtx((scope) => [
1826
+ createTextVNode(toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
1827
+ ]),
1828
+ _: 1
1829
+ })) : createCommentVNode("", true),
1830
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (column, index) => {
1831
+ return openBlock(), createElementBlock(Fragment, null, [
1832
+ column.type !== "hidden" && display$1(column.display) ? (openBlock(), createBlock(unref(TMagicTableColumn), {
1833
+ prop: column.name,
1834
+ width: column.width,
1835
+ label: column.label,
1836
+ sortable: column.sortable,
1837
+ "sort-orders": ["ascending", "descending"],
1838
+ key: column[unref(mForm)?.keyProp || "__key"] ?? index,
1839
+ "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1840
+ }, {
1841
+ default: withCtx((scope) => [
1842
+ scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$z, {
1843
+ key: 0,
1844
+ labelWidth: "0",
1845
+ disabled: _ctx.disabled,
1846
+ prop: getProp(scope.$index),
1847
+ rules: column.rules,
1848
+ config: makeConfig(column, scope.row),
1849
+ model: scope.row,
1850
+ lastValues: lastData.value[scope.$index],
1851
+ "is-compare": _ctx.isCompare,
1852
+ size: _ctx.size,
1853
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[modelName.value])),
1854
+ onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
1855
+ }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : createCommentVNode("", true)
1856
+ ]),
1857
+ _: 2
1858
+ }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
1859
+ ], 64);
1860
+ }), 256))
1861
+ ]),
1862
+ _: 3
1863
+ }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : createCommentVNode("", true)
1869
1864
  ]),
1870
- _: 1
1871
- }, 8, ["disabled"])) : createCommentVNode("", true),
1872
- createElementVNode("div", _hoisted_4, [
1873
- _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1865
+ _: 3
1866
+ }, 8, ["disabled"]),
1867
+ renderSlot(_ctx.$slots, "default"),
1868
+ createElementVNode("div", _hoisted_3, [
1869
+ addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1874
1870
  key: 0,
1875
- icon: unref(Grid),
1876
- size: "small",
1877
- type: "primary",
1878
- onClick: toggleMode
1879
- }, {
1880
- default: withCtx(() => [
1881
- createTextVNode("展开配置")
1882
- ]),
1883
- _: 1
1884
- }, 8, ["icon"])) : createCommentVNode("", true),
1885
- _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1886
- key: 1,
1887
- icon: unref(FullScreen),
1888
1871
  size: "small",
1889
1872
  type: "primary",
1890
- onClick: toggleFullscreen
1891
- }, {
1892
- default: withCtx(() => [
1893
- createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1894
- ]),
1895
- _: 1
1896
- }, 8, ["icon"])) : createCommentVNode("", true),
1897
- importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1898
- key: 2,
1899
- style: { "display": "inline-block" },
1900
- ref_key: "excelBtn",
1901
- ref: excelBtn,
1902
- action: "/noop",
1903
- disabled: _ctx.disabled,
1904
- "on-change": excelHandler,
1905
- "auto-upload": false
1906
- }, {
1907
- default: withCtx(() => [
1908
- createVNode(unref(TMagicButton), {
1909
- size: "small",
1910
- type: "success",
1911
- disabled: _ctx.disabled,
1912
- plain: ""
1913
- }, {
1914
- default: withCtx(() => [
1915
- createTextVNode("导入EXCEL")
1916
- ]),
1917
- _: 1
1918
- }, 8, ["disabled"])
1919
- ]),
1920
- _: 1
1921
- }, 8, ["disabled"])) : createCommentVNode("", true),
1922
- importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1923
- key: 3,
1924
- size: "small",
1925
- type: "warning",
1926
1873
  disabled: _ctx.disabled,
1927
1874
  plain: "",
1928
- onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1875
+ onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1929
1876
  }, {
1930
1877
  default: withCtx(() => [
1931
- createTextVNode("清空")
1878
+ createTextVNode("新增一行")
1932
1879
  ]),
1933
1880
  _: 1
1934
- }, 8, ["disabled"])) : createCommentVNode("", true)
1935
- ])
1936
- ]),
1937
- _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
1938
- createVNode(unref(TMagicPagination), {
1939
- layout: "total, sizes, prev, pager, next, jumper",
1940
- "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
1941
- "current-page": pagecontext.value + 1,
1942
- "page-sizes": [pagesize.value, 60, 120, 300],
1943
- "page-size": pagesize.value,
1944
- total: _ctx.model[modelName.value].length,
1945
- onSizeChange: handleSizeChange,
1946
- onCurrentChange: handleCurrentChange
1947
- }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
1948
- ])) : createCommentVNode("", true)
1949
- ], 2)
1950
- ], 8, ["disabled"]);
1881
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1882
+ createElementVNode("div", _hoisted_4, [
1883
+ _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
1884
+ key: 0,
1885
+ icon: unref(Grid),
1886
+ size: "small",
1887
+ type: "primary",
1888
+ onClick: toggleMode
1889
+ }, {
1890
+ default: withCtx(() => [
1891
+ createTextVNode("展开配置")
1892
+ ]),
1893
+ _: 1
1894
+ }, 8, ["icon"])) : createCommentVNode("", true),
1895
+ _ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
1896
+ key: 1,
1897
+ icon: unref(FullScreen),
1898
+ size: "small",
1899
+ type: "primary",
1900
+ onClick: toggleFullscreen
1901
+ }, {
1902
+ default: withCtx(() => [
1903
+ createTextVNode(toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1904
+ ]),
1905
+ _: 1
1906
+ }, 8, ["icon"])) : createCommentVNode("", true),
1907
+ importable.value ? (openBlock(), createBlock(unref(TMagicUpload), {
1908
+ key: 2,
1909
+ style: { "display": "inline-block" },
1910
+ ref_key: "excelBtn",
1911
+ ref: excelBtn,
1912
+ action: "/noop",
1913
+ disabled: _ctx.disabled,
1914
+ "on-change": excelHandler,
1915
+ "auto-upload": false
1916
+ }, {
1917
+ default: withCtx(() => [
1918
+ createVNode(unref(TMagicButton), {
1919
+ size: "small",
1920
+ type: "success",
1921
+ disabled: _ctx.disabled,
1922
+ plain: ""
1923
+ }, {
1924
+ default: withCtx(() => [
1925
+ createTextVNode("导入EXCEL")
1926
+ ]),
1927
+ _: 1
1928
+ }, 8, ["disabled"])
1929
+ ]),
1930
+ _: 1
1931
+ }, 8, ["disabled"])) : createCommentVNode("", true),
1932
+ importable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1933
+ key: 3,
1934
+ size: "small",
1935
+ type: "warning",
1936
+ disabled: _ctx.disabled,
1937
+ plain: "",
1938
+ onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1939
+ }, {
1940
+ default: withCtx(() => [
1941
+ createTextVNode("清空")
1942
+ ]),
1943
+ _: 1
1944
+ }, 8, ["disabled"])) : createCommentVNode("", true)
1945
+ ])
1946
+ ]),
1947
+ _ctx.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
1948
+ createVNode(unref(TMagicPagination), {
1949
+ layout: "total, sizes, prev, pager, next, jumper",
1950
+ "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
1951
+ "current-page": pagecontext.value + 1,
1952
+ "page-sizes": [pagesize.value, 60, 120, 300],
1953
+ "page-size": pagesize.value,
1954
+ total: _ctx.model[modelName.value].length,
1955
+ onSizeChange: handleSizeChange,
1956
+ onCurrentChange: handleCurrentChange
1957
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
1958
+ ])) : createCommentVNode("", true)
1959
+ ], 2)
1960
+ ], 8, ["disabled"]))
1961
+ ]);
1951
1962
  };
1952
1963
  }
1953
1964
  });
@@ -2788,7 +2799,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2788
2799
  popperClass: {},
2789
2800
  extendState: {}
2790
2801
  },
2791
- emits: ["change", "field-input", "field-change"],
2802
+ emits: ["change", "error", "field-input", "field-change"],
2792
2803
  setup(__props, { expose: __expose, emit: __emit }) {
2793
2804
  const props = __props;
2794
2805
  const emit = __emit;
@@ -2878,6 +2889,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2878
2889
  await tMagicForm.value?.validate();
2879
2890
  return native ? values.value : cloneDeep(toRaw(values.value));
2880
2891
  } catch (invalidFields) {
2892
+ emit("error", invalidFields);
2881
2893
  const error = [];
2882
2894
  Object.entries(invalidFields).forEach(([, ValidateError]) => {
2883
2895
  ValidateError.forEach(({ field, message }) => {