vue2-components-plus 1.0.70 → 1.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ComponentDemo/CaptchaTableDemo.vue +281 -0
- package/dist/ComponentDemo/TableDemo.md +72 -41
- package/dist/ComponentDemo/TableDemo.vue +143 -409
- package/dist/vue2-components-plus.css +1 -1
- package/dist/vue2-components-plus.es5.js +406 -355
- package/dist/vue2-components-plus.js +312 -271
- package/dist/vue2-components-plus.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -331,16 +331,16 @@ function registerDirective(Vue2) {
|
|
|
331
331
|
Vue2.directive("enterClick", enterClickDirective);
|
|
332
332
|
Vue2.directive("enter-click", enterClickDirective);
|
|
333
333
|
}
|
|
334
|
-
var ThemeVar = /*#__PURE__*/_createClass(function ThemeVar() {
|
|
334
|
+
var ThemeVar$1 = /*#__PURE__*/_createClass(function ThemeVar() {
|
|
335
335
|
_classCallCheck(this, ThemeVar);
|
|
336
336
|
});
|
|
337
|
-
ThemeVar.VARS = {};
|
|
338
|
-
function loadCssVars() {
|
|
337
|
+
ThemeVar$1.VARS = {};
|
|
338
|
+
function loadCssVars$1() {
|
|
339
339
|
if (typeof document === "undefined") {
|
|
340
|
-
return ThemeVar.VARS;
|
|
340
|
+
return ThemeVar$1.VARS;
|
|
341
341
|
}
|
|
342
|
-
if (Object.keys(ThemeVar.VARS).length > 0) {
|
|
343
|
-
return ThemeVar.VARS;
|
|
342
|
+
if (Object.keys(ThemeVar$1.VARS).length > 0) {
|
|
343
|
+
return ThemeVar$1.VARS;
|
|
344
344
|
}
|
|
345
345
|
var variables = {};
|
|
346
346
|
Array.from(document.styleSheets || []).forEach(function (sheet) {
|
|
@@ -361,7 +361,7 @@ function loadCssVars() {
|
|
|
361
361
|
});
|
|
362
362
|
});
|
|
363
363
|
});
|
|
364
|
-
ThemeVar.VARS = variables;
|
|
364
|
+
ThemeVar$1.VARS = variables;
|
|
365
365
|
return variables;
|
|
366
366
|
}
|
|
367
367
|
function toKebabCase$1(value) {
|
|
@@ -1201,7 +1201,40 @@ var _sfc_render$5 = function render() {
|
|
|
1201
1201
|
var _sfc_staticRenderFns$5 = [];
|
|
1202
1202
|
var __component__$5 = /* @__PURE__ */normalizeComponent(_sfc_main$5, _sfc_render$5, _sfc_staticRenderFns$5, false, null, "a83d5d48", null, null);
|
|
1203
1203
|
var NsForm = __component__$5.exports;
|
|
1204
|
-
var
|
|
1204
|
+
var ThemeVar2 = /*#__PURE__*/_createClass(function ThemeVar2() {
|
|
1205
|
+
_classCallCheck(this, ThemeVar2);
|
|
1206
|
+
});
|
|
1207
|
+
ThemeVar2.VARS = {};
|
|
1208
|
+
function loadCssVars() {
|
|
1209
|
+
if (typeof document === "undefined") {
|
|
1210
|
+
return ThemeVar2.VARS;
|
|
1211
|
+
}
|
|
1212
|
+
if (Object.keys(ThemeVar2.VARS).length > 0) {
|
|
1213
|
+
return ThemeVar2.VARS;
|
|
1214
|
+
}
|
|
1215
|
+
var variables = {};
|
|
1216
|
+
Array.from(document.styleSheets || []).forEach(function (sheet) {
|
|
1217
|
+
var cssRules = [];
|
|
1218
|
+
try {
|
|
1219
|
+
cssRules = Array.from(sheet.cssRules || []);
|
|
1220
|
+
} catch (error) {
|
|
1221
|
+
cssRules = [];
|
|
1222
|
+
}
|
|
1223
|
+
cssRules.forEach(function (rule) {
|
|
1224
|
+
if (rule.selectorText !== ":root") {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
Array.from(rule.style || []).filter(function (name) {
|
|
1228
|
+
return name.indexOf("--matrix-") === 0;
|
|
1229
|
+
}).forEach(function (name) {
|
|
1230
|
+
variables[name] = rule.style.getPropertyValue(name).trim();
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
ThemeVar2.VARS = variables;
|
|
1235
|
+
return variables;
|
|
1236
|
+
}
|
|
1237
|
+
var DynamicFormTitle_vue_vue_type_style_index_0_scoped_29c80ec1_lang = "";
|
|
1205
1238
|
var _sfc_main$4 = {
|
|
1206
1239
|
name: "NsFormTitle",
|
|
1207
1240
|
props: {
|
|
@@ -1232,7 +1265,7 @@ var _sfc_render$4 = function render2() {
|
|
|
1232
1265
|
}, [_vm._t("default")], 2)]);
|
|
1233
1266
|
};
|
|
1234
1267
|
var _sfc_staticRenderFns$4 = [];
|
|
1235
|
-
var __component__$4 = /* @__PURE__ */normalizeComponent(_sfc_main$4, _sfc_render$4, _sfc_staticRenderFns$4, false, null, "
|
|
1268
|
+
var __component__$4 = /* @__PURE__ */normalizeComponent(_sfc_main$4, _sfc_render$4, _sfc_staticRenderFns$4, false, null, "29c80ec1", null, null);
|
|
1236
1269
|
var NsFormTitle = __component__$4.exports;
|
|
1237
1270
|
function getImageBaseUrl(instance) {
|
|
1238
1271
|
var _a;
|
|
@@ -1740,193 +1773,8 @@ var _sfc_staticRenderFns$3 = [];
|
|
|
1740
1773
|
var __component__$3 = /* @__PURE__ */normalizeComponent(_sfc_main$3, _sfc_render$3, _sfc_staticRenderFns$3, false, null, "90982d04", null, null);
|
|
1741
1774
|
var NsSearch = __component__$3.exports;
|
|
1742
1775
|
var RESERVED_KEYS = ["children", "slot", "headerSlot", "buttons", "enum", "type", "imageWidth", "imageHeight", "linkText"];
|
|
1743
|
-
function getColumnProps(column) {
|
|
1744
|
-
var props = __spreadValues({}, column);
|
|
1745
|
-
RESERVED_KEYS.forEach(function (key) {
|
|
1746
|
-
return delete props[key];
|
|
1747
|
-
});
|
|
1748
|
-
return props;
|
|
1749
|
-
}
|
|
1750
|
-
function getRenderer(slotRenderers, name) {
|
|
1751
|
-
return name ? slotRenderers[name] : null;
|
|
1752
|
-
}
|
|
1753
|
-
function getCellValue(row, column) {
|
|
1754
|
-
return column.prop ? row[column.prop] : void 0;
|
|
1755
|
-
}
|
|
1756
|
-
function isVisible(config, row) {
|
|
1757
|
-
if (typeof config.show === "function") {
|
|
1758
|
-
return config.show(row) !== false;
|
|
1759
|
-
}
|
|
1760
|
-
if (config.show === void 0) {
|
|
1761
|
-
return true;
|
|
1762
|
-
}
|
|
1763
|
-
return !!config.show;
|
|
1764
|
-
}
|
|
1765
|
-
function isDisabled(config, row) {
|
|
1766
|
-
return typeof config.disabled === "function" ? !!config.disabled(row) : !!config.disabled;
|
|
1767
|
-
}
|
|
1768
|
-
function emit(listeners, name) {
|
|
1769
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
1770
|
-
args[_key2 - 2] = arguments[_key2];
|
|
1771
|
-
}
|
|
1772
|
-
var handler = listeners && listeners[name];
|
|
1773
|
-
if (!handler) {
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
if (Array.isArray(handler)) {
|
|
1777
|
-
handler.forEach(function (fn) {
|
|
1778
|
-
return typeof fn === "function" && fn.apply(void 0, args);
|
|
1779
|
-
});
|
|
1780
|
-
return;
|
|
1781
|
-
}
|
|
1782
|
-
if (typeof handler === "function") {
|
|
1783
|
-
handler.apply(void 0, args);
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
function resolveEnumText(column, value) {
|
|
1787
|
-
var enumList = column.enum || column.options || [];
|
|
1788
|
-
if (!Array.isArray(enumList)) {
|
|
1789
|
-
return value;
|
|
1790
|
-
}
|
|
1791
|
-
var matched = enumList.find(function (item) {
|
|
1792
|
-
return item.value === value;
|
|
1793
|
-
});
|
|
1794
|
-
return matched ? matched.label : value;
|
|
1795
|
-
}
|
|
1796
|
-
function renderActionButtons(h, scope, column, slotRenderers, listeners) {
|
|
1797
|
-
var buttons = Array.isArray(column.buttons) ? column.buttons : [];
|
|
1798
|
-
return buttons.filter(function (button) {
|
|
1799
|
-
return isVisible(button, scope.row);
|
|
1800
|
-
}).map(function (button, index2) {
|
|
1801
|
-
var slotRenderer = getRenderer(slotRenderers, button.slot);
|
|
1802
|
-
if (slotRenderer) {
|
|
1803
|
-
return slotRenderer(__spreadProps(__spreadValues({}, scope), {
|
|
1804
|
-
row: scope.row,
|
|
1805
|
-
column: column,
|
|
1806
|
-
button: button
|
|
1807
|
-
}));
|
|
1808
|
-
}
|
|
1809
|
-
return h("el-button", {
|
|
1810
|
-
key: button.label || index2,
|
|
1811
|
-
props: {
|
|
1812
|
-
size: button.size || "mini",
|
|
1813
|
-
type: button.link ? "text" : button.type || "text",
|
|
1814
|
-
icon: typeof button.icon === "string" ? button.icon : void 0,
|
|
1815
|
-
disabled: isDisabled(button, scope.row)
|
|
1816
|
-
},
|
|
1817
|
-
on: {
|
|
1818
|
-
click: function click() {
|
|
1819
|
-
if (typeof button.handler === "function") {
|
|
1820
|
-
button.handler(scope.row, scope.$index);
|
|
1821
|
-
}
|
|
1822
|
-
emit(listeners, "button-click", scope.row, column, button);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
}, [button.label]);
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
function renderTag(h, scope, column) {
|
|
1829
|
-
var cellValue = getCellValue(scope.row, column);
|
|
1830
|
-
var tagType = typeof column.tagType === "function" ? column.tagType(scope.row, cellValue) : column.tagType;
|
|
1831
|
-
var text = typeof column.formatter === "function" ? column.formatter(scope.row, column, cellValue) : resolveEnumText(column, cellValue);
|
|
1832
|
-
return h("el-tag", {
|
|
1833
|
-
props: {
|
|
1834
|
-
type: tagType || "info",
|
|
1835
|
-
size: column.tagSize || "small"
|
|
1836
|
-
}
|
|
1837
|
-
}, [text]);
|
|
1838
|
-
}
|
|
1839
|
-
function renderImage(h, scope, column) {
|
|
1840
|
-
var src = getCellValue(scope.row, column);
|
|
1841
|
-
if (!src) {
|
|
1842
|
-
return "-";
|
|
1843
|
-
}
|
|
1844
|
-
return h("img", {
|
|
1845
|
-
style: {
|
|
1846
|
-
width: column.imageWidth || "40px",
|
|
1847
|
-
height: column.imageHeight || "40px",
|
|
1848
|
-
objectFit: "cover",
|
|
1849
|
-
borderRadius: "4px"
|
|
1850
|
-
},
|
|
1851
|
-
attrs: {
|
|
1852
|
-
src: src,
|
|
1853
|
-
alt: column.label || "image"
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
function renderLink(h, scope, column, slotRenderers, listeners) {
|
|
1858
|
-
var renderer = getRenderer(slotRenderers, column.slot);
|
|
1859
|
-
if (renderer) {
|
|
1860
|
-
return renderer(scope);
|
|
1861
|
-
}
|
|
1862
|
-
var cellValue = getCellValue(scope.row, column);
|
|
1863
|
-
return h("el-button", {
|
|
1864
|
-
props: {
|
|
1865
|
-
type: "text"
|
|
1866
|
-
},
|
|
1867
|
-
on: {
|
|
1868
|
-
click: function click() {
|
|
1869
|
-
return emit(listeners, "link-click", scope.row, column);
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
}, [column.linkText || cellValue || "-"]);
|
|
1873
|
-
}
|
|
1874
|
-
function renderDefaultCell(h, scope, column, slotRenderers, listeners) {
|
|
1875
|
-
var renderer = getRenderer(slotRenderers, column.slot);
|
|
1876
|
-
if (renderer) {
|
|
1877
|
-
return renderer(scope);
|
|
1878
|
-
}
|
|
1879
|
-
if (column.type === "action") {
|
|
1880
|
-
return h("div", {
|
|
1881
|
-
class: "ns-table-column__actions"
|
|
1882
|
-
}, renderActionButtons(h, scope, column, slotRenderers, listeners));
|
|
1883
|
-
}
|
|
1884
|
-
if (column.type === "tag") {
|
|
1885
|
-
return renderTag(h, scope, column);
|
|
1886
|
-
}
|
|
1887
|
-
if (column.type === "image") {
|
|
1888
|
-
return renderImage(h, scope, column);
|
|
1889
|
-
}
|
|
1890
|
-
if (column.type === "link") {
|
|
1891
|
-
return renderLink(h, scope, column, slotRenderers, listeners);
|
|
1892
|
-
}
|
|
1893
|
-
var cellValue = getCellValue(scope.row, column);
|
|
1894
|
-
if (typeof column.formatter === "function") {
|
|
1895
|
-
return column.formatter(scope.row, column, cellValue);
|
|
1896
|
-
}
|
|
1897
|
-
if (column.enum) {
|
|
1898
|
-
return resolveEnumText(column, cellValue);
|
|
1899
|
-
}
|
|
1900
|
-
return cellValue === void 0 || cellValue === null || cellValue === "" ? "-" : cellValue;
|
|
1901
|
-
}
|
|
1902
|
-
function renderColumn(h, column, slotRenderers, listeners) {
|
|
1903
|
-
var children = Array.isArray(column.children) ? column.children.map(function (child, index2) {
|
|
1904
|
-
return h(TableColumn, {
|
|
1905
|
-
key: child.prop || child.label || index2,
|
|
1906
|
-
props: {
|
|
1907
|
-
column: child,
|
|
1908
|
-
slotRenderers: slotRenderers
|
|
1909
|
-
},
|
|
1910
|
-
on: listeners
|
|
1911
|
-
});
|
|
1912
|
-
}) : [];
|
|
1913
|
-
var headerRenderer = getRenderer(slotRenderers, column.headerSlot);
|
|
1914
|
-
return h("el-table-column", {
|
|
1915
|
-
props: getColumnProps(column),
|
|
1916
|
-
scopedSlots: children.length ? headerRenderer ? {
|
|
1917
|
-
header: headerRenderer
|
|
1918
|
-
} : void 0 : __spreadValues({
|
|
1919
|
-
default: function _default(scope) {
|
|
1920
|
-
return renderDefaultCell(h, scope, column, slotRenderers, listeners);
|
|
1921
|
-
}
|
|
1922
|
-
}, headerRenderer ? {
|
|
1923
|
-
header: headerRenderer
|
|
1924
|
-
} : {})
|
|
1925
|
-
}, children);
|
|
1926
|
-
}
|
|
1927
1776
|
var TableColumn = {
|
|
1928
1777
|
name: "NsTableColumn",
|
|
1929
|
-
functional: true,
|
|
1930
1778
|
props: {
|
|
1931
1779
|
column: {
|
|
1932
1780
|
type: Object,
|
|
@@ -1939,8 +1787,192 @@ var TableColumn = {
|
|
|
1939
1787
|
}
|
|
1940
1788
|
}
|
|
1941
1789
|
},
|
|
1942
|
-
|
|
1943
|
-
|
|
1790
|
+
methods: {
|
|
1791
|
+
getColumnProps: function getColumnProps(column) {
|
|
1792
|
+
var props = __spreadValues({}, column);
|
|
1793
|
+
RESERVED_KEYS.forEach(function (key) {
|
|
1794
|
+
return delete props[key];
|
|
1795
|
+
});
|
|
1796
|
+
return props;
|
|
1797
|
+
},
|
|
1798
|
+
getRenderer: function getRenderer(name) {
|
|
1799
|
+
return name ? this.slotRenderers[name] : null;
|
|
1800
|
+
},
|
|
1801
|
+
getCellValue: function getCellValue(row, column) {
|
|
1802
|
+
return column.prop ? row[column.prop] : void 0;
|
|
1803
|
+
},
|
|
1804
|
+
isVisible: function isVisible(config, row) {
|
|
1805
|
+
if (typeof config.show === "function") {
|
|
1806
|
+
return config.show(row) !== false;
|
|
1807
|
+
}
|
|
1808
|
+
if (config.show === void 0) {
|
|
1809
|
+
return true;
|
|
1810
|
+
}
|
|
1811
|
+
return !!config.show;
|
|
1812
|
+
},
|
|
1813
|
+
isDisabled: function isDisabled(config, row) {
|
|
1814
|
+
return typeof config.disabled === "function" ? !!config.disabled(row) : !!config.disabled;
|
|
1815
|
+
},
|
|
1816
|
+
renderActionButtons: function renderActionButtons(h, scope, column) {
|
|
1817
|
+
var _this7 = this;
|
|
1818
|
+
var buttons = Array.isArray(column.buttons) ? column.buttons : [];
|
|
1819
|
+
return buttons.filter(function (button) {
|
|
1820
|
+
return _this7.isVisible(button, scope.row);
|
|
1821
|
+
}).map(function (button, index2) {
|
|
1822
|
+
var slotRenderer = _this7.getRenderer(button.slot);
|
|
1823
|
+
if (slotRenderer) {
|
|
1824
|
+
return slotRenderer(__spreadProps(__spreadValues({}, scope), {
|
|
1825
|
+
row: scope.row,
|
|
1826
|
+
column: column,
|
|
1827
|
+
button: button
|
|
1828
|
+
}));
|
|
1829
|
+
}
|
|
1830
|
+
return h("el-button", {
|
|
1831
|
+
key: button.label || index2,
|
|
1832
|
+
props: {
|
|
1833
|
+
size: button.size || "mini",
|
|
1834
|
+
type: button.link ? "text" : button.type || "text",
|
|
1835
|
+
icon: typeof button.icon === "string" ? button.icon : void 0,
|
|
1836
|
+
disabled: _this7.isDisabled(button, scope.row)
|
|
1837
|
+
},
|
|
1838
|
+
on: {
|
|
1839
|
+
click: function click() {
|
|
1840
|
+
if (typeof button.handler === "function") {
|
|
1841
|
+
button.handler(scope.row, scope.$index);
|
|
1842
|
+
}
|
|
1843
|
+
_this7.$emit("button-click", scope.row, column, button);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}, [button.label]);
|
|
1847
|
+
});
|
|
1848
|
+
},
|
|
1849
|
+
renderTag: function renderTag(h, scope, column) {
|
|
1850
|
+
var cellValue = this.getCellValue(scope.row, column);
|
|
1851
|
+
var tagType = typeof column.tagType === "function" ? column.tagType(scope.row, cellValue) : column.tagType;
|
|
1852
|
+
var text = typeof column.formatter === "function" ? column.formatter(scope.row, column, cellValue) : this.resolveEnumText(column, cellValue);
|
|
1853
|
+
return h("el-tag", {
|
|
1854
|
+
props: {
|
|
1855
|
+
type: tagType || "info",
|
|
1856
|
+
size: column.tagSize || "small"
|
|
1857
|
+
}
|
|
1858
|
+
}, [text]);
|
|
1859
|
+
},
|
|
1860
|
+
renderImage: function renderImage(h, scope, column) {
|
|
1861
|
+
var src = this.getCellValue(scope.row, column);
|
|
1862
|
+
if (!src) {
|
|
1863
|
+
return "-";
|
|
1864
|
+
}
|
|
1865
|
+
return h("img", {
|
|
1866
|
+
style: {
|
|
1867
|
+
width: column.imageWidth || "40px",
|
|
1868
|
+
height: column.imageHeight || "40px",
|
|
1869
|
+
objectFit: "cover",
|
|
1870
|
+
borderRadius: "4px"
|
|
1871
|
+
},
|
|
1872
|
+
attrs: {
|
|
1873
|
+
src: src,
|
|
1874
|
+
alt: column.label || "image"
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
},
|
|
1878
|
+
renderLink: function renderLink(h, scope, column) {
|
|
1879
|
+
var _this8 = this;
|
|
1880
|
+
var renderer = this.getRenderer(column.slot);
|
|
1881
|
+
if (renderer) {
|
|
1882
|
+
return renderer(scope);
|
|
1883
|
+
}
|
|
1884
|
+
var cellValue = this.getCellValue(scope.row, column);
|
|
1885
|
+
return h("el-button", {
|
|
1886
|
+
props: {
|
|
1887
|
+
type: "text"
|
|
1888
|
+
},
|
|
1889
|
+
on: {
|
|
1890
|
+
click: function click() {
|
|
1891
|
+
return _this8.$emit("link-click", scope.row, column);
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
}, [column.linkText || cellValue || "-"]);
|
|
1895
|
+
},
|
|
1896
|
+
resolveEnumText: function resolveEnumText(column, value) {
|
|
1897
|
+
var enumList = column.enum || column.options || [];
|
|
1898
|
+
if (!Array.isArray(enumList)) {
|
|
1899
|
+
return value;
|
|
1900
|
+
}
|
|
1901
|
+
var matched = enumList.find(function (item) {
|
|
1902
|
+
return item.value === value;
|
|
1903
|
+
});
|
|
1904
|
+
return matched ? matched.label : value;
|
|
1905
|
+
},
|
|
1906
|
+
renderDefaultCell: function renderDefaultCell(h, scope, column) {
|
|
1907
|
+
var renderer = this.getRenderer(column.slot);
|
|
1908
|
+
if (renderer) {
|
|
1909
|
+
return renderer(scope);
|
|
1910
|
+
}
|
|
1911
|
+
if (column.type === "action") {
|
|
1912
|
+
return h("div", {
|
|
1913
|
+
class: "ns-table-column__actions"
|
|
1914
|
+
}, this.renderActionButtons(h, scope, column));
|
|
1915
|
+
}
|
|
1916
|
+
if (column.type === "tag") {
|
|
1917
|
+
return this.renderTag(h, scope, column);
|
|
1918
|
+
}
|
|
1919
|
+
if (column.type === "image") {
|
|
1920
|
+
return this.renderImage(h, scope, column);
|
|
1921
|
+
}
|
|
1922
|
+
if (column.type === "link") {
|
|
1923
|
+
return this.renderLink(h, scope, column);
|
|
1924
|
+
}
|
|
1925
|
+
var cellValue = this.getCellValue(scope.row, column);
|
|
1926
|
+
if (typeof column.formatter === "function") {
|
|
1927
|
+
return column.formatter(scope.row, column, cellValue);
|
|
1928
|
+
}
|
|
1929
|
+
if (column.enum) {
|
|
1930
|
+
return this.resolveEnumText(column, cellValue);
|
|
1931
|
+
}
|
|
1932
|
+
return cellValue === void 0 || cellValue === null || cellValue === "" ? "-" : cellValue;
|
|
1933
|
+
},
|
|
1934
|
+
renderColumn: function renderColumn(h, column) {
|
|
1935
|
+
var _this9 = this;
|
|
1936
|
+
var children = Array.isArray(column.children) ? column.children.map(function (child, index2) {
|
|
1937
|
+
return h(TableColumn, {
|
|
1938
|
+
key: child.prop || child.label || index2,
|
|
1939
|
+
props: {
|
|
1940
|
+
column: child,
|
|
1941
|
+
slotRenderers: _this9.slotRenderers
|
|
1942
|
+
},
|
|
1943
|
+
on: {
|
|
1944
|
+
"link-click": function linkClick() {
|
|
1945
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1946
|
+
args[_key2] = arguments[_key2];
|
|
1947
|
+
}
|
|
1948
|
+
return _this9.$emit.apply(_this9, ["link-click"].concat(args));
|
|
1949
|
+
},
|
|
1950
|
+
"button-click": function buttonClick() {
|
|
1951
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1952
|
+
args[_key3] = arguments[_key3];
|
|
1953
|
+
}
|
|
1954
|
+
return _this9.$emit.apply(_this9, ["button-click"].concat(args));
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
}) : [];
|
|
1959
|
+
var headerRenderer = this.getRenderer(column.headerSlot);
|
|
1960
|
+
return h("el-table-column", {
|
|
1961
|
+
props: this.getColumnProps(column),
|
|
1962
|
+
scopedSlots: children.length ? headerRenderer ? {
|
|
1963
|
+
header: headerRenderer
|
|
1964
|
+
} : void 0 : __spreadValues({
|
|
1965
|
+
default: function _default(scope) {
|
|
1966
|
+
return _this9.renderDefaultCell(h, scope, column);
|
|
1967
|
+
}
|
|
1968
|
+
}, headerRenderer ? {
|
|
1969
|
+
header: headerRenderer
|
|
1970
|
+
} : {})
|
|
1971
|
+
}, children);
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1974
|
+
render: function render(h) {
|
|
1975
|
+
return this.renderColumn(h, this.column);
|
|
1944
1976
|
}
|
|
1945
1977
|
};
|
|
1946
1978
|
var TableColumn$1 = TableColumn;
|
|
@@ -1969,7 +2001,7 @@ function resetPagination(pagination) {
|
|
|
1969
2001
|
pagination.pageSize = 10;
|
|
1970
2002
|
return pagination;
|
|
1971
2003
|
}
|
|
1972
|
-
var
|
|
2004
|
+
var PageTable_vue_vue_type_style_index_0_scoped_86cf2232_lang = "";
|
|
1973
2005
|
var RESERVED_LISTENERS = ["add", "selection-change", "sort-change", "row-click", "size-change", "current-change", "link-click"];
|
|
1974
2006
|
var _sfc_main$2 = {
|
|
1975
2007
|
name: "NsTable",
|
|
@@ -2081,6 +2113,10 @@ var _sfc_main$2 = {
|
|
|
2081
2113
|
type: Number,
|
|
2082
2114
|
default: null
|
|
2083
2115
|
},
|
|
2116
|
+
useDefaultPage: {
|
|
2117
|
+
type: Boolean,
|
|
2118
|
+
default: true
|
|
2119
|
+
},
|
|
2084
2120
|
pageSizes: {
|
|
2085
2121
|
type: Array,
|
|
2086
2122
|
default: function _default() {
|
|
@@ -2112,9 +2148,7 @@ var _sfc_main$2 = {
|
|
|
2112
2148
|
},
|
|
2113
2149
|
data: function data() {
|
|
2114
2150
|
return {
|
|
2115
|
-
internalPagination: createPagination()
|
|
2116
|
-
resizeObserver: null,
|
|
2117
|
-
layoutTimer: null
|
|
2151
|
+
internalPagination: createPagination()
|
|
2118
2152
|
};
|
|
2119
2153
|
},
|
|
2120
2154
|
computed: {
|
|
@@ -2135,9 +2169,12 @@ var _sfc_main$2 = {
|
|
|
2135
2169
|
return listeners;
|
|
2136
2170
|
},
|
|
2137
2171
|
resolvedHeight: function resolvedHeight() {
|
|
2138
|
-
if (this.height !== void 0
|
|
2172
|
+
if (this.height !== void 0) {
|
|
2139
2173
|
return this.height;
|
|
2140
2174
|
}
|
|
2175
|
+
if (this.autoHeight && this.maxHeight === void 0) {
|
|
2176
|
+
return "100%";
|
|
2177
|
+
}
|
|
2141
2178
|
return void 0;
|
|
2142
2179
|
},
|
|
2143
2180
|
resolvedMaxHeight: function resolvedMaxHeight() {
|
|
@@ -2163,65 +2200,9 @@ var _sfc_main$2 = {
|
|
|
2163
2200
|
}
|
|
2164
2201
|
},
|
|
2165
2202
|
immediate: true
|
|
2166
|
-
},
|
|
2167
|
-
tableData: {
|
|
2168
|
-
handler: function handler() {
|
|
2169
|
-
this.scheduleLayout();
|
|
2170
|
-
},
|
|
2171
|
-
deep: true,
|
|
2172
|
-
immediate: true
|
|
2173
|
-
},
|
|
2174
|
-
columns: {
|
|
2175
|
-
handler: function handler() {
|
|
2176
|
-
this.scheduleLayout();
|
|
2177
|
-
},
|
|
2178
|
-
deep: true,
|
|
2179
|
-
immediate: true
|
|
2180
|
-
}
|
|
2181
|
-
},
|
|
2182
|
-
mounted: function mounted() {
|
|
2183
|
-
this.scheduleLayout();
|
|
2184
|
-
this.initResizeObserver();
|
|
2185
|
-
},
|
|
2186
|
-
beforeDestroy: function beforeDestroy() {
|
|
2187
|
-
if (this.resizeObserver) {
|
|
2188
|
-
this.resizeObserver.disconnect();
|
|
2189
|
-
this.resizeObserver = null;
|
|
2190
|
-
}
|
|
2191
|
-
if (this.layoutTimer) {
|
|
2192
|
-
clearTimeout(this.layoutTimer);
|
|
2193
|
-
this.layoutTimer = null;
|
|
2194
2203
|
}
|
|
2195
2204
|
},
|
|
2196
2205
|
methods: {
|
|
2197
|
-
scheduleLayout: function scheduleLayout() {
|
|
2198
|
-
var _this7 = this;
|
|
2199
|
-
this.$nextTick(function () {
|
|
2200
|
-
_this7.doLayout();
|
|
2201
|
-
if (_this7.layoutTimer) {
|
|
2202
|
-
clearTimeout(_this7.layoutTimer);
|
|
2203
|
-
}
|
|
2204
|
-
_this7.layoutTimer = setTimeout(function () {
|
|
2205
|
-
_this7.doLayout();
|
|
2206
|
-
_this7.layoutTimer = null;
|
|
2207
|
-
}, 50);
|
|
2208
|
-
});
|
|
2209
|
-
},
|
|
2210
|
-
initResizeObserver: function initResizeObserver() {
|
|
2211
|
-
var _this8 = this;
|
|
2212
|
-
if (typeof ResizeObserver === "undefined") {
|
|
2213
|
-
return;
|
|
2214
|
-
}
|
|
2215
|
-
this.resizeObserver = new ResizeObserver(function () {
|
|
2216
|
-
_this8.scheduleLayout();
|
|
2217
|
-
});
|
|
2218
|
-
if (this.$el) {
|
|
2219
|
-
this.resizeObserver.observe(this.$el);
|
|
2220
|
-
}
|
|
2221
|
-
if (this.$el && this.$el.parentElement) {
|
|
2222
|
-
this.resizeObserver.observe(this.$el.parentElement);
|
|
2223
|
-
}
|
|
2224
|
-
},
|
|
2225
2206
|
handleAdd: function handleAdd() {
|
|
2226
2207
|
this.$emit("add");
|
|
2227
2208
|
},
|
|
@@ -2236,12 +2217,16 @@ var _sfc_main$2 = {
|
|
|
2236
2217
|
},
|
|
2237
2218
|
handleSizeChange: function handleSizeChange(size) {
|
|
2238
2219
|
this.internalPagination.pageSize = size;
|
|
2239
|
-
this
|
|
2220
|
+
if (!this.useDefaultPage) {
|
|
2221
|
+
this.$emit("update:pageSize", size);
|
|
2222
|
+
}
|
|
2240
2223
|
this.$emit("size-change", size);
|
|
2241
2224
|
},
|
|
2242
2225
|
handleCurrentChange: function handleCurrentChange(page) {
|
|
2243
2226
|
this.internalPagination.currentPage = page;
|
|
2244
|
-
this
|
|
2227
|
+
if (!this.useDefaultPage) {
|
|
2228
|
+
this.$emit("update:currentPage", page);
|
|
2229
|
+
}
|
|
2245
2230
|
this.$emit("current-change", page);
|
|
2246
2231
|
},
|
|
2247
2232
|
handleLinkClick: function handleLinkClick(row, column) {
|
|
@@ -2259,33 +2244,33 @@ var _sfc_main$2 = {
|
|
|
2259
2244
|
return this.$refs.tableRef && this.$refs.tableRef.selection ? this.$refs.tableRef.selection : [];
|
|
2260
2245
|
},
|
|
2261
2246
|
getSelectionKeys: function getSelectionKeys() {
|
|
2262
|
-
var
|
|
2247
|
+
var _this0 = this;
|
|
2263
2248
|
var rows = this.getSelectionRows();
|
|
2264
2249
|
if (!this.rowKey) {
|
|
2265
2250
|
return rows;
|
|
2266
2251
|
}
|
|
2267
2252
|
return rows.map(function (row) {
|
|
2268
|
-
return typeof
|
|
2253
|
+
return typeof _this0.rowKey === "function" ? _this0.rowKey(row) : row[_this0.rowKey];
|
|
2269
2254
|
});
|
|
2270
2255
|
},
|
|
2271
2256
|
setSelectionRows: function setSelectionRows(rows) {
|
|
2272
|
-
var
|
|
2257
|
+
var _this1 = this;
|
|
2273
2258
|
if (!this.$refs.tableRef) return;
|
|
2274
2259
|
this.$refs.tableRef.clearSelection();
|
|
2275
2260
|
(rows || []).forEach(function (row) {
|
|
2276
|
-
|
|
2261
|
+
_this1.$refs.tableRef.toggleRowSelection(row, true);
|
|
2277
2262
|
});
|
|
2278
2263
|
},
|
|
2279
2264
|
setSelectionKeys: function setSelectionKeys(keys) {
|
|
2280
|
-
var
|
|
2265
|
+
var _this10 = this;
|
|
2281
2266
|
if (!this.$refs.tableRef || !this.rowKey) return;
|
|
2282
2267
|
this.$refs.tableRef.clearSelection();
|
|
2283
2268
|
(keys || []).forEach(function (key) {
|
|
2284
|
-
var row = (
|
|
2285
|
-
return (typeof
|
|
2269
|
+
var row = (_this10.tableData || []).find(function (item) {
|
|
2270
|
+
return (typeof _this10.rowKey === "function" ? _this10.rowKey(item) : item[_this10.rowKey]) === key;
|
|
2286
2271
|
});
|
|
2287
2272
|
if (row) {
|
|
2288
|
-
|
|
2273
|
+
_this10.$refs.tableRef.toggleRowSelection(row, true);
|
|
2289
2274
|
}
|
|
2290
2275
|
});
|
|
2291
2276
|
},
|
|
@@ -2330,15 +2315,21 @@ var _sfc_main$2 = {
|
|
|
2330
2315
|
},
|
|
2331
2316
|
resetPage: function resetPage() {
|
|
2332
2317
|
this.internalPagination.currentPage = 1;
|
|
2333
|
-
this
|
|
2318
|
+
if (!this.useDefaultPage) {
|
|
2319
|
+
this.$emit("update:currentPage", 1);
|
|
2320
|
+
}
|
|
2334
2321
|
},
|
|
2335
2322
|
setPage: function setPage(page) {
|
|
2336
2323
|
this.internalPagination.currentPage = page;
|
|
2337
|
-
this
|
|
2324
|
+
if (!this.useDefaultPage) {
|
|
2325
|
+
this.$emit("update:currentPage", page);
|
|
2326
|
+
}
|
|
2338
2327
|
},
|
|
2339
2328
|
setPageSize: function setPageSize(size) {
|
|
2340
2329
|
this.internalPagination.pageSize = size;
|
|
2341
|
-
this
|
|
2330
|
+
if (!this.useDefaultPage) {
|
|
2331
|
+
this.$emit("update:pageSize", size);
|
|
2332
|
+
}
|
|
2342
2333
|
},
|
|
2343
2334
|
getPagination: function getPagination() {
|
|
2344
2335
|
return _defineProperty(_defineProperty(_defineProperty({}, this.pageTotalKey, this.total), this.pageNumberKey, this.currentPageModel), this.pageSizeKey, this.pageSizeModel);
|
|
@@ -2467,9 +2458,9 @@ var _sfc_render$2 = function render4() {
|
|
|
2467
2458
|
})], 1) : _vm._e()]);
|
|
2468
2459
|
};
|
|
2469
2460
|
var _sfc_staticRenderFns$2 = [];
|
|
2470
|
-
var __component__$2 = /* @__PURE__ */normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, "
|
|
2461
|
+
var __component__$2 = /* @__PURE__ */normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, "86cf2232", null, null);
|
|
2471
2462
|
var NsTable = __component__$2.exports;
|
|
2472
|
-
var
|
|
2463
|
+
var PageContainer_vue_vue_type_style_index_0_scoped_07327ea0_lang = "";
|
|
2473
2464
|
var _sfc_main$1 = {
|
|
2474
2465
|
name: "NsTableContainer",
|
|
2475
2466
|
components: {
|
|
@@ -2551,24 +2542,38 @@ var _sfc_main$1 = {
|
|
|
2551
2542
|
return {};
|
|
2552
2543
|
}
|
|
2553
2544
|
},
|
|
2554
|
-
|
|
2555
|
-
type:
|
|
2556
|
-
default:
|
|
2545
|
+
useDefaultPage: {
|
|
2546
|
+
type: Boolean,
|
|
2547
|
+
default: true
|
|
2557
2548
|
}
|
|
2558
2549
|
},
|
|
2559
2550
|
data: function data() {
|
|
2560
2551
|
return {
|
|
2561
2552
|
internalPagination: createPagination(),
|
|
2553
|
+
internalSearchParams: {},
|
|
2554
|
+
internalSortState: {
|
|
2555
|
+
prop: "",
|
|
2556
|
+
order: ""
|
|
2557
|
+
},
|
|
2562
2558
|
pendingSelectionKeys: /* @__PURE__ */new Set(),
|
|
2563
2559
|
selectionRowMap: {},
|
|
2564
|
-
isSyncingSelection: false
|
|
2560
|
+
isSyncingSelection: false,
|
|
2561
|
+
_emitSearchTimer: null
|
|
2565
2562
|
};
|
|
2566
2563
|
},
|
|
2564
|
+
beforeDestroy: function beforeDestroy() {
|
|
2565
|
+
if (this._emitSearchTimer) {
|
|
2566
|
+
clearTimeout(this._emitSearchTimer);
|
|
2567
|
+
this._emitSearchTimer = null;
|
|
2568
|
+
}
|
|
2569
|
+
},
|
|
2567
2570
|
computed: {
|
|
2568
2571
|
currentPageModel: function currentPageModel() {
|
|
2572
|
+
if (this.useDefaultPage) return this.internalPagination.currentPage;
|
|
2569
2573
|
return this.currentPage === null ? this.internalPagination.currentPage : this.currentPage;
|
|
2570
2574
|
},
|
|
2571
2575
|
pageSizeModel: function pageSizeModel() {
|
|
2576
|
+
if (this.useDefaultPage) return this.internalPagination.pageSize;
|
|
2572
2577
|
return this.pageSize === null ? this.internalPagination.pageSize : this.pageSize;
|
|
2573
2578
|
},
|
|
2574
2579
|
currentRowKey: function currentRowKey() {
|
|
@@ -2578,6 +2583,7 @@ var _sfc_main$1 = {
|
|
|
2578
2583
|
watch: {
|
|
2579
2584
|
currentPage: {
|
|
2580
2585
|
handler: function handler(value) {
|
|
2586
|
+
if (this.useDefaultPage) return;
|
|
2581
2587
|
if (value !== null) {
|
|
2582
2588
|
this.internalPagination.currentPage = value;
|
|
2583
2589
|
}
|
|
@@ -2586,6 +2592,7 @@ var _sfc_main$1 = {
|
|
|
2586
2592
|
},
|
|
2587
2593
|
pageSize: {
|
|
2588
2594
|
handler: function handler(value) {
|
|
2595
|
+
if (this.useDefaultPage) return;
|
|
2589
2596
|
if (value !== null) {
|
|
2590
2597
|
this.internalPagination.pageSize = value;
|
|
2591
2598
|
}
|
|
@@ -2594,9 +2601,9 @@ var _sfc_main$1 = {
|
|
|
2594
2601
|
},
|
|
2595
2602
|
tableData: {
|
|
2596
2603
|
handler: function handler() {
|
|
2597
|
-
var
|
|
2604
|
+
var _this11 = this;
|
|
2598
2605
|
this.$nextTick(function () {
|
|
2599
|
-
|
|
2606
|
+
_this11.syncSelectionToCurrentPage();
|
|
2600
2607
|
});
|
|
2601
2608
|
},
|
|
2602
2609
|
deep: true,
|
|
@@ -2614,35 +2621,38 @@ var _sfc_main$1 = {
|
|
|
2614
2621
|
this.$refs.tableRef && this.$refs.tableRef.clearSelection && this.$refs.tableRef.clearSelection();
|
|
2615
2622
|
},
|
|
2616
2623
|
syncSelectionToCurrentPage: function syncSelectionToCurrentPage() {
|
|
2617
|
-
var
|
|
2624
|
+
var _this12 = this;
|
|
2618
2625
|
if (!this.currentRowKey || !this.$refs.tableRef) {
|
|
2619
2626
|
return;
|
|
2620
2627
|
}
|
|
2621
2628
|
this.isSyncingSelection = true;
|
|
2622
2629
|
this.$refs.tableRef.clearSelection();
|
|
2623
2630
|
(this.tableData || []).forEach(function (row) {
|
|
2624
|
-
var key =
|
|
2625
|
-
if (
|
|
2626
|
-
|
|
2627
|
-
|
|
2631
|
+
var key = _this12.getRowKey(row);
|
|
2632
|
+
if (_this12.pendingSelectionKeys.has(key)) {
|
|
2633
|
+
_this12.$set(_this12.selectionRowMap, key, row);
|
|
2634
|
+
_this12.$refs.tableRef.toggleRowSelection(row, true);
|
|
2628
2635
|
}
|
|
2629
2636
|
});
|
|
2630
2637
|
this.$nextTick(function () {
|
|
2631
|
-
|
|
2638
|
+
_this12.isSyncingSelection = false;
|
|
2632
2639
|
});
|
|
2633
2640
|
},
|
|
2634
2641
|
handleSearch: function handleSearch(params) {
|
|
2635
2642
|
this.resetSelectionState();
|
|
2643
|
+
var nextParams = params || {};
|
|
2636
2644
|
if (params && params._resetPage) {
|
|
2637
2645
|
var _a = params,
|
|
2638
2646
|
_resetPage = _a._resetPage,
|
|
2639
2647
|
searchParams = __objRest(_a, ["_resetPage"]);
|
|
2648
|
+
nextParams = searchParams;
|
|
2640
2649
|
this.internalPagination.currentPage = 1;
|
|
2641
|
-
this
|
|
2642
|
-
|
|
2643
|
-
|
|
2650
|
+
if (!this.useDefaultPage) {
|
|
2651
|
+
this.$emit("update:currentPage", 1);
|
|
2652
|
+
}
|
|
2644
2653
|
}
|
|
2645
|
-
this
|
|
2654
|
+
this.internalSearchParams = __spreadValues({}, nextParams);
|
|
2655
|
+
this.emitSearch();
|
|
2646
2656
|
},
|
|
2647
2657
|
handleReset: function handleReset() {
|
|
2648
2658
|
this.resetSelectionState();
|
|
@@ -2653,30 +2663,38 @@ var _sfc_main$1 = {
|
|
|
2653
2663
|
},
|
|
2654
2664
|
handleSizeChange: function handleSizeChange(size) {
|
|
2655
2665
|
this.internalPagination.pageSize = size;
|
|
2656
|
-
|
|
2666
|
+
var maxPage = Math.max(1, Math.ceil((this.total || 0) / size));
|
|
2667
|
+
if (this.internalPagination.currentPage > maxPage) {
|
|
2668
|
+
this.internalPagination.currentPage = maxPage;
|
|
2669
|
+
}
|
|
2670
|
+
if (!this.useDefaultPage) {
|
|
2671
|
+
this.$emit("update:pageSize", size);
|
|
2672
|
+
this.$emit("update:currentPage", this.internalPagination.currentPage);
|
|
2673
|
+
}
|
|
2657
2674
|
this.$emit("size-change", size);
|
|
2658
2675
|
this.$emit("page-change", {
|
|
2659
|
-
currentPage: this.
|
|
2676
|
+
currentPage: this.internalPagination.currentPage,
|
|
2660
2677
|
pageSize: size
|
|
2661
2678
|
});
|
|
2662
|
-
|
|
2663
|
-
this.loadData();
|
|
2664
|
-
}
|
|
2679
|
+
this.emitSearch();
|
|
2665
2680
|
},
|
|
2666
2681
|
handleCurrentChange: function handleCurrentChange(page) {
|
|
2682
|
+
if (this.internalPagination.currentPage === page) {
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
2667
2685
|
this.internalPagination.currentPage = page;
|
|
2668
|
-
this
|
|
2686
|
+
if (!this.useDefaultPage) {
|
|
2687
|
+
this.$emit("update:currentPage", page);
|
|
2688
|
+
}
|
|
2669
2689
|
this.$emit("current-change", page);
|
|
2670
2690
|
this.$emit("page-change", {
|
|
2671
2691
|
currentPage: page,
|
|
2672
2692
|
pageSize: this.pageSizeModel
|
|
2673
2693
|
});
|
|
2674
|
-
|
|
2675
|
-
this.loadData();
|
|
2676
|
-
}
|
|
2694
|
+
this.emitSearch();
|
|
2677
2695
|
},
|
|
2678
2696
|
handleSelectionChange: function handleSelectionChange(selection) {
|
|
2679
|
-
var
|
|
2697
|
+
var _this13 = this;
|
|
2680
2698
|
if (this.isSyncingSelection) {
|
|
2681
2699
|
return;
|
|
2682
2700
|
}
|
|
@@ -2685,21 +2703,26 @@ var _sfc_main$1 = {
|
|
|
2685
2703
|
return;
|
|
2686
2704
|
}
|
|
2687
2705
|
var currentPageKeys = (this.tableData || []).map(function (row) {
|
|
2688
|
-
return
|
|
2706
|
+
return _this13.getRowKey(row);
|
|
2689
2707
|
});
|
|
2690
2708
|
currentPageKeys.forEach(function (key) {
|
|
2691
|
-
|
|
2692
|
-
|
|
2709
|
+
_this13.pendingSelectionKeys.delete(key);
|
|
2710
|
+
_this13.$delete(_this13.selectionRowMap, key);
|
|
2693
2711
|
});
|
|
2694
2712
|
(selection || []).forEach(function (row) {
|
|
2695
|
-
var key =
|
|
2696
|
-
|
|
2697
|
-
|
|
2713
|
+
var key = _this13.getRowKey(row);
|
|
2714
|
+
_this13.pendingSelectionKeys.add(key);
|
|
2715
|
+
_this13.$set(_this13.selectionRowMap, key, row);
|
|
2698
2716
|
});
|
|
2699
2717
|
this.$emit("selection-change", Object.values(this.selectionRowMap));
|
|
2700
2718
|
},
|
|
2701
2719
|
handleSortChange: function handleSortChange(sort) {
|
|
2720
|
+
this.internalSortState = sort || {
|
|
2721
|
+
prop: "",
|
|
2722
|
+
order: ""
|
|
2723
|
+
};
|
|
2702
2724
|
this.$emit("sort-change", sort);
|
|
2725
|
+
this.emitSearch();
|
|
2703
2726
|
},
|
|
2704
2727
|
handleRowClick: function handleRowClick(row, column, event) {
|
|
2705
2728
|
this.$emit("row-click", row, column, event);
|
|
@@ -2707,16 +2730,43 @@ var _sfc_main$1 = {
|
|
|
2707
2730
|
handleLinkClick: function handleLinkClick(row, column) {
|
|
2708
2731
|
this.$emit("link-click", row, column);
|
|
2709
2732
|
},
|
|
2733
|
+
buildLoadQuery: function buildLoadQuery() {
|
|
2734
|
+
return __spreadProps(__spreadValues({}, this.internalSearchParams), _defineProperty(_defineProperty(_defineProperty({}, this.pageNumberKey, this.currentPageModel), this.pageSizeKey, this.pageSizeModel), "sort", __spreadValues({}, this.internalSortState)));
|
|
2735
|
+
},
|
|
2736
|
+
emitSearch: function emitSearch() {
|
|
2737
|
+
var _this14 = this;
|
|
2738
|
+
if (this._emitSearchTimer) {
|
|
2739
|
+
clearTimeout(this._emitSearchTimer);
|
|
2740
|
+
}
|
|
2741
|
+
this._emitSearchTimer = setTimeout(function () {
|
|
2742
|
+
_this14._emitSearchTimer = null;
|
|
2743
|
+
_this14.$emit("search", _this14.buildLoadQuery());
|
|
2744
|
+
}, 0);
|
|
2745
|
+
},
|
|
2746
|
+
reload: function reload() {
|
|
2747
|
+
this.emitSearch();
|
|
2748
|
+
},
|
|
2749
|
+
refresh: function refresh() {
|
|
2750
|
+
var isFirstPage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2751
|
+
if (isFirstPage) {
|
|
2752
|
+
this.internalPagination.currentPage = 1;
|
|
2753
|
+
if (!this.useDefaultPage) {
|
|
2754
|
+
this.$emit("update:currentPage", 1);
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
this.emitSearch();
|
|
2758
|
+
},
|
|
2759
|
+
getSearchParams: function getSearchParams() {
|
|
2760
|
+
return this.buildLoadQuery();
|
|
2761
|
+
},
|
|
2710
2762
|
initSearchAndLoad: function initSearchAndLoad() {
|
|
2711
|
-
var
|
|
2763
|
+
var _this15 = this;
|
|
2712
2764
|
this.$nextTick(function () {
|
|
2713
|
-
if (
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
}
|
|
2717
|
-
if (_this13.loadData) {
|
|
2718
|
-
_this13.loadData();
|
|
2765
|
+
if (_this15.showSearch && _this15.$refs.searchRef) {
|
|
2766
|
+
var formData = _this15.$refs.searchRef.getFormData();
|
|
2767
|
+
_this15.internalSearchParams = __spreadValues({}, formData);
|
|
2719
2768
|
}
|
|
2769
|
+
_this15.emitSearch();
|
|
2720
2770
|
});
|
|
2721
2771
|
},
|
|
2722
2772
|
getSearchFormData: function getSearchFormData() {
|
|
@@ -2743,7 +2793,7 @@ var _sfc_main$1 = {
|
|
|
2743
2793
|
return this.currentRowKey ? Array.from(this.pendingSelectionKeys) : ((_b = (_a = this.$refs.tableRef) == null ? void 0 : _a.getSelectionKeys) == null ? void 0 : _b.call(_a)) || [];
|
|
2744
2794
|
},
|
|
2745
2795
|
setSelectionRows: function setSelectionRows(rows) {
|
|
2746
|
-
var
|
|
2796
|
+
var _this16 = this;
|
|
2747
2797
|
if (!this.currentRowKey) {
|
|
2748
2798
|
this.$refs.tableRef && this.$refs.tableRef.setSelectionRows(rows);
|
|
2749
2799
|
return;
|
|
@@ -2751,23 +2801,23 @@ var _sfc_main$1 = {
|
|
|
2751
2801
|
this.pendingSelectionKeys = /* @__PURE__ */new Set();
|
|
2752
2802
|
this.selectionRowMap = {};
|
|
2753
2803
|
(rows || []).forEach(function (row) {
|
|
2754
|
-
var key =
|
|
2755
|
-
|
|
2756
|
-
|
|
2804
|
+
var key = _this16.getRowKey(row);
|
|
2805
|
+
_this16.pendingSelectionKeys.add(key);
|
|
2806
|
+
_this16.$set(_this16.selectionRowMap, key, row);
|
|
2757
2807
|
});
|
|
2758
2808
|
this.syncSelectionToCurrentPage();
|
|
2759
2809
|
},
|
|
2760
2810
|
setSelectionKeys: function setSelectionKeys(keys) {
|
|
2761
|
-
var
|
|
2811
|
+
var _this17 = this;
|
|
2762
2812
|
if (!this.currentRowKey) {
|
|
2763
2813
|
this.$refs.tableRef && this.$refs.tableRef.setSelectionKeys(keys);
|
|
2764
2814
|
return;
|
|
2765
2815
|
}
|
|
2766
2816
|
this.pendingSelectionKeys = new Set(keys || []);
|
|
2767
2817
|
(this.tableData || []).forEach(function (row) {
|
|
2768
|
-
var key =
|
|
2769
|
-
if (
|
|
2770
|
-
|
|
2818
|
+
var key = _this17.getRowKey(row);
|
|
2819
|
+
if (_this17.pendingSelectionKeys.has(key)) {
|
|
2820
|
+
_this17.$set(_this17.selectionRowMap, key, row);
|
|
2771
2821
|
}
|
|
2772
2822
|
});
|
|
2773
2823
|
this.syncSelectionToCurrentPage();
|
|
@@ -2776,16 +2826,16 @@ var _sfc_main$1 = {
|
|
|
2776
2826
|
this.resetSelectionState();
|
|
2777
2827
|
},
|
|
2778
2828
|
selectAll: function selectAll() {
|
|
2779
|
-
var
|
|
2829
|
+
var _this18 = this;
|
|
2780
2830
|
if (!this.$refs.tableRef) return;
|
|
2781
2831
|
if (!this.currentRowKey) {
|
|
2782
2832
|
this.$refs.tableRef.selectAll();
|
|
2783
2833
|
return;
|
|
2784
2834
|
}
|
|
2785
2835
|
(this.tableData || []).forEach(function (row) {
|
|
2786
|
-
var key =
|
|
2787
|
-
|
|
2788
|
-
|
|
2836
|
+
var key = _this18.getRowKey(row);
|
|
2837
|
+
_this18.pendingSelectionKeys.add(key);
|
|
2838
|
+
_this18.$set(_this18.selectionRowMap, key, row);
|
|
2789
2839
|
});
|
|
2790
2840
|
this.$refs.tableRef.setSelectionRows(this.tableData);
|
|
2791
2841
|
},
|
|
@@ -2825,6 +2875,7 @@ var _sfc_render$1 = function render5() {
|
|
|
2825
2875
|
"total": _vm.total,
|
|
2826
2876
|
"current-page": _vm.currentPageModel,
|
|
2827
2877
|
"page-size": _vm.pageSizeModel,
|
|
2878
|
+
"use-default-page": _vm.useDefaultPage,
|
|
2828
2879
|
"page-number-key": _vm.pageNumberKey,
|
|
2829
2880
|
"page-size-key": _vm.pageSizeKey,
|
|
2830
2881
|
"page-total-key": _vm.pageTotalKey,
|
|
@@ -2842,7 +2893,7 @@ var _sfc_render$1 = function render5() {
|
|
|
2842
2893
|
}, "page-table", _vm.tableProps, false))], 2);
|
|
2843
2894
|
};
|
|
2844
2895
|
var _sfc_staticRenderFns$1 = [];
|
|
2845
|
-
var __component__$1 = /* @__PURE__ */normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, "
|
|
2896
|
+
var __component__$1 = /* @__PURE__ */normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, "07327ea0", null, null);
|
|
2846
2897
|
var NsTableContainer = __component__$1.exports;
|
|
2847
2898
|
[NsTableContainer, NsSearch, NsTable].forEach(function (component) {
|
|
2848
2899
|
component.install = function install3(Vue2) {
|
|
@@ -3102,33 +3153,33 @@ var _sfc_main = {
|
|
|
3102
3153
|
if (!this.isMaximized) this.currentY = value;
|
|
3103
3154
|
},
|
|
3104
3155
|
visible: function visible() {
|
|
3105
|
-
var
|
|
3156
|
+
var _this19 = this;
|
|
3106
3157
|
this.$nextTick(function () {
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3158
|
+
_this19.applyDialogLayout();
|
|
3159
|
+
_this19.syncDialogInstance();
|
|
3160
|
+
_this19.triggerDomCompleted();
|
|
3110
3161
|
});
|
|
3111
3162
|
}
|
|
3112
3163
|
},
|
|
3113
3164
|
mounted: function mounted() {
|
|
3114
|
-
var
|
|
3115
|
-
loadCssVars();
|
|
3165
|
+
var _this20 = this;
|
|
3166
|
+
loadCssVars$1();
|
|
3116
3167
|
this.visible = true;
|
|
3117
3168
|
this.updateModalStyle();
|
|
3118
3169
|
this.syncDialogInstance();
|
|
3119
3170
|
this.$nextTick(function () {
|
|
3120
|
-
|
|
3121
|
-
|
|
3171
|
+
_this20.applyDialogLayout();
|
|
3172
|
+
_this20.triggerDomCompleted();
|
|
3122
3173
|
});
|
|
3123
3174
|
document.addEventListener("keydown", this.handleKeydown);
|
|
3124
3175
|
window.addEventListener("resize", this.applyDialogLayout);
|
|
3125
3176
|
},
|
|
3126
3177
|
updated: function updated() {
|
|
3127
|
-
var
|
|
3178
|
+
var _this21 = this;
|
|
3128
3179
|
this.syncDialogInstance();
|
|
3129
3180
|
this.triggerDomCompleted();
|
|
3130
3181
|
this.$nextTick(function () {
|
|
3131
|
-
|
|
3182
|
+
_this21.applyDialogLayout();
|
|
3132
3183
|
});
|
|
3133
3184
|
},
|
|
3134
3185
|
beforeDestroy: function beforeDestroy() {
|
|
@@ -3165,10 +3216,10 @@ var _sfc_main = {
|
|
|
3165
3216
|
return Number.isNaN(Number(str)) ? str : "".concat(Number(str), "px");
|
|
3166
3217
|
},
|
|
3167
3218
|
resolvePadding: function resolvePadding() {
|
|
3168
|
-
var
|
|
3219
|
+
var _this22 = this;
|
|
3169
3220
|
if (Array.isArray(this.dialogPadding)) {
|
|
3170
3221
|
return this.dialogPadding.map(function (item) {
|
|
3171
|
-
return
|
|
3222
|
+
return _this22.normalizeSize(item);
|
|
3172
3223
|
}).join(" ");
|
|
3173
3224
|
}
|
|
3174
3225
|
if (this.dialogPadding === -1 || this.dialogPadding === "-1") {
|
|
@@ -3189,11 +3240,11 @@ var _sfc_main = {
|
|
|
3189
3240
|
return source;
|
|
3190
3241
|
},
|
|
3191
3242
|
mergeEvents: function mergeEvents() {
|
|
3192
|
-
var
|
|
3243
|
+
var _this23 = this;
|
|
3193
3244
|
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3194
3245
|
return __spreadProps(__spreadValues({}, listeners), {
|
|
3195
3246
|
close: function close() {
|
|
3196
|
-
return
|
|
3247
|
+
return _this23.closeDialog();
|
|
3197
3248
|
}
|
|
3198
3249
|
});
|
|
3199
3250
|
},
|
|
@@ -3263,25 +3314,25 @@ var _sfc_main = {
|
|
|
3263
3314
|
}
|
|
3264
3315
|
},
|
|
3265
3316
|
syncDialogInstance: function syncDialogInstance() {
|
|
3266
|
-
var
|
|
3317
|
+
var _this24 = this;
|
|
3267
3318
|
if (!this.dialogInstance) return;
|
|
3268
3319
|
this.dialogInstance.domRef = this.$refs.contentRef || null;
|
|
3269
3320
|
this.dialogInstance.updateOption = function () {
|
|
3270
3321
|
var newOption = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3271
3322
|
if (Object.prototype.hasOwnProperty.call(newOption, "title")) {
|
|
3272
|
-
|
|
3323
|
+
_this24.currentTitle = newOption.title;
|
|
3273
3324
|
}
|
|
3274
3325
|
if (Object.prototype.hasOwnProperty.call(newOption, "width")) {
|
|
3275
|
-
|
|
3326
|
+
_this24.currentWidth = newOption.width;
|
|
3276
3327
|
}
|
|
3277
3328
|
if (Object.prototype.hasOwnProperty.call(newOption, "height")) {
|
|
3278
|
-
|
|
3329
|
+
_this24.currentHeight = newOption.height;
|
|
3279
3330
|
}
|
|
3280
3331
|
if (Object.prototype.hasOwnProperty.call(newOption, "x")) {
|
|
3281
|
-
|
|
3332
|
+
_this24.currentX = newOption.x;
|
|
3282
3333
|
}
|
|
3283
3334
|
if (Object.prototype.hasOwnProperty.call(newOption, "y")) {
|
|
3284
|
-
|
|
3335
|
+
_this24.currentY = newOption.y;
|
|
3285
3336
|
}
|
|
3286
3337
|
var mergedOption = __spreadValues({}, newOption);
|
|
3287
3338
|
delete mergedOption.title;
|
|
@@ -3289,20 +3340,20 @@ var _sfc_main = {
|
|
|
3289
3340
|
delete mergedOption.height;
|
|
3290
3341
|
delete mergedOption.x;
|
|
3291
3342
|
delete mergedOption.y;
|
|
3292
|
-
|
|
3343
|
+
_this24.currentOption = __spreadValues(__spreadValues({}, _this24.currentOption), mergedOption);
|
|
3293
3344
|
};
|
|
3294
3345
|
this.dialogInstance.callMethod = function (methodName) {
|
|
3295
|
-
var target =
|
|
3346
|
+
var target = _this24.$refs.contentRef;
|
|
3296
3347
|
if (target && typeof target[methodName] === "function") {
|
|
3297
|
-
for (var
|
|
3298
|
-
args[
|
|
3348
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
3349
|
+
args[_key4 - 1] = arguments[_key4];
|
|
3299
3350
|
}
|
|
3300
3351
|
return target[methodName].apply(target, args);
|
|
3301
3352
|
}
|
|
3302
3353
|
return void 0;
|
|
3303
3354
|
};
|
|
3304
3355
|
this.dialogInstance.close = function () {
|
|
3305
|
-
return
|
|
3356
|
+
return _this24.closeDialog();
|
|
3306
3357
|
};
|
|
3307
3358
|
},
|
|
3308
3359
|
triggerDomCompleted: function triggerDomCompleted() {
|
|
@@ -3315,7 +3366,7 @@ var _sfc_main = {
|
|
|
3315
3366
|
}
|
|
3316
3367
|
},
|
|
3317
3368
|
toggleMaximize: function toggleMaximize() {
|
|
3318
|
-
var
|
|
3369
|
+
var _this25 = this;
|
|
3319
3370
|
if (!this.showMaximizeButton) return;
|
|
3320
3371
|
if (!this.isMaximized) {
|
|
3321
3372
|
this.originalSize = {
|
|
@@ -3339,7 +3390,7 @@ var _sfc_main = {
|
|
|
3339
3390
|
}
|
|
3340
3391
|
this.notifySizeChange();
|
|
3341
3392
|
this.$nextTick(function () {
|
|
3342
|
-
return
|
|
3393
|
+
return _this25.applyDialogLayout(false);
|
|
3343
3394
|
});
|
|
3344
3395
|
},
|
|
3345
3396
|
closeDialog: function closeDialog() {
|
|
@@ -3356,7 +3407,7 @@ var _sfc_main = {
|
|
|
3356
3407
|
}
|
|
3357
3408
|
},
|
|
3358
3409
|
dealConfirm: function dealConfirm() {
|
|
3359
|
-
var
|
|
3410
|
+
var _this26 = this;
|
|
3360
3411
|
var vm = this;
|
|
3361
3412
|
var loadingController = {
|
|
3362
3413
|
get value() {
|
|
@@ -3378,8 +3429,8 @@ var _sfc_main = {
|
|
|
3378
3429
|
return;
|
|
3379
3430
|
}
|
|
3380
3431
|
this.confirm(function () {
|
|
3381
|
-
|
|
3382
|
-
|
|
3432
|
+
_this26.footerLoading = false;
|
|
3433
|
+
_this26.visible = false;
|
|
3383
3434
|
}, this.$refs.contentRef, loadingController);
|
|
3384
3435
|
},
|
|
3385
3436
|
handleKeydown: function handleKeydown(event) {
|
|
@@ -3711,7 +3762,7 @@ function install2(Vue2) {
|
|
|
3711
3762
|
}
|
|
3712
3763
|
});
|
|
3713
3764
|
setExternalApp(Vue2, options);
|
|
3714
|
-
loadCssVars();
|
|
3765
|
+
loadCssVars$1();
|
|
3715
3766
|
if (Vue2 && Vue2.prototype) {
|
|
3716
3767
|
Vue2.prototype.$NsDialog = NsDialog;
|
|
3717
3768
|
Vue2.prototype.$closeAllNsDialog = closeAllNsDialog;
|