@tmagic/form 1.3.6 → 1.3.8

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