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