vue2-components-plus 1.0.70 → 1.0.80
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 +60 -41
- package/dist/ComponentDemo/TableDemo.vue +127 -409
- package/dist/vue2-components-plus.css +1 -1
- package/dist/vue2-components-plus.js +300 -271
- package/dist/vue2-components-plus.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/vue2-components-plus.es5.js +0 -3742
|
@@ -290,15 +290,15 @@ function registerDirective(Vue2) {
|
|
|
290
290
|
Vue2.directive("enterClick", enterClickDirective);
|
|
291
291
|
Vue2.directive("enter-click", enterClickDirective);
|
|
292
292
|
}
|
|
293
|
-
class ThemeVar {
|
|
294
|
-
}
|
|
295
|
-
ThemeVar.VARS = {};
|
|
296
|
-
function loadCssVars() {
|
|
293
|
+
let ThemeVar$1 = class ThemeVar {
|
|
294
|
+
};
|
|
295
|
+
ThemeVar$1.VARS = {};
|
|
296
|
+
function loadCssVars$1() {
|
|
297
297
|
if (typeof document === "undefined") {
|
|
298
|
-
return ThemeVar.VARS;
|
|
298
|
+
return ThemeVar$1.VARS;
|
|
299
299
|
}
|
|
300
|
-
if (Object.keys(ThemeVar.VARS).length > 0) {
|
|
301
|
-
return ThemeVar.VARS;
|
|
300
|
+
if (Object.keys(ThemeVar$1.VARS).length > 0) {
|
|
301
|
+
return ThemeVar$1.VARS;
|
|
302
302
|
}
|
|
303
303
|
const variables = {};
|
|
304
304
|
Array.from(document.styleSheets || []).forEach((sheet) => {
|
|
@@ -317,7 +317,7 @@ function loadCssVars() {
|
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
319
|
});
|
|
320
|
-
ThemeVar.VARS = variables;
|
|
320
|
+
ThemeVar$1.VARS = variables;
|
|
321
321
|
return variables;
|
|
322
322
|
}
|
|
323
323
|
function toKebabCase$1(value) {
|
|
@@ -1060,7 +1060,37 @@ var __component__$5 = /* @__PURE__ */ normalizeComponent(
|
|
|
1060
1060
|
null
|
|
1061
1061
|
);
|
|
1062
1062
|
const NsForm = __component__$5.exports;
|
|
1063
|
-
|
|
1063
|
+
class ThemeVar2 {
|
|
1064
|
+
}
|
|
1065
|
+
ThemeVar2.VARS = {};
|
|
1066
|
+
function loadCssVars() {
|
|
1067
|
+
if (typeof document === "undefined") {
|
|
1068
|
+
return ThemeVar2.VARS;
|
|
1069
|
+
}
|
|
1070
|
+
if (Object.keys(ThemeVar2.VARS).length > 0) {
|
|
1071
|
+
return ThemeVar2.VARS;
|
|
1072
|
+
}
|
|
1073
|
+
const variables = {};
|
|
1074
|
+
Array.from(document.styleSheets || []).forEach((sheet) => {
|
|
1075
|
+
let cssRules = [];
|
|
1076
|
+
try {
|
|
1077
|
+
cssRules = Array.from(sheet.cssRules || []);
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
cssRules = [];
|
|
1080
|
+
}
|
|
1081
|
+
cssRules.forEach((rule) => {
|
|
1082
|
+
if (rule.selectorText !== ":root") {
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
Array.from(rule.style || []).filter((name) => name.indexOf("--matrix-") === 0).forEach((name) => {
|
|
1086
|
+
variables[name] = rule.style.getPropertyValue(name).trim();
|
|
1087
|
+
});
|
|
1088
|
+
});
|
|
1089
|
+
});
|
|
1090
|
+
ThemeVar2.VARS = variables;
|
|
1091
|
+
return variables;
|
|
1092
|
+
}
|
|
1093
|
+
const DynamicFormTitle_vue_vue_type_style_index_0_scoped_29c80ec1_lang = "";
|
|
1064
1094
|
const _sfc_main$4 = {
|
|
1065
1095
|
name: "NsFormTitle",
|
|
1066
1096
|
props: {
|
|
@@ -1086,7 +1116,7 @@ var __component__$4 = /* @__PURE__ */ normalizeComponent(
|
|
|
1086
1116
|
_sfc_staticRenderFns$4,
|
|
1087
1117
|
false,
|
|
1088
1118
|
null,
|
|
1089
|
-
"
|
|
1119
|
+
"29c80ec1",
|
|
1090
1120
|
null,
|
|
1091
1121
|
null
|
|
1092
1122
|
);
|
|
@@ -1500,175 +1530,8 @@ const RESERVED_KEYS = [
|
|
|
1500
1530
|
"imageHeight",
|
|
1501
1531
|
"linkText"
|
|
1502
1532
|
];
|
|
1503
|
-
function getColumnProps(column) {
|
|
1504
|
-
const props = __spreadValues({}, column);
|
|
1505
|
-
RESERVED_KEYS.forEach((key) => delete props[key]);
|
|
1506
|
-
return props;
|
|
1507
|
-
}
|
|
1508
|
-
function getRenderer(slotRenderers, name) {
|
|
1509
|
-
return name ? slotRenderers[name] : null;
|
|
1510
|
-
}
|
|
1511
|
-
function getCellValue(row, column) {
|
|
1512
|
-
return column.prop ? row[column.prop] : void 0;
|
|
1513
|
-
}
|
|
1514
|
-
function isVisible(config, row) {
|
|
1515
|
-
if (typeof config.show === "function") {
|
|
1516
|
-
return config.show(row) !== false;
|
|
1517
|
-
}
|
|
1518
|
-
if (config.show === void 0) {
|
|
1519
|
-
return true;
|
|
1520
|
-
}
|
|
1521
|
-
return !!config.show;
|
|
1522
|
-
}
|
|
1523
|
-
function isDisabled(config, row) {
|
|
1524
|
-
return typeof config.disabled === "function" ? !!config.disabled(row) : !!config.disabled;
|
|
1525
|
-
}
|
|
1526
|
-
function emit(listeners, name, ...args) {
|
|
1527
|
-
const handler = listeners && listeners[name];
|
|
1528
|
-
if (!handler) {
|
|
1529
|
-
return;
|
|
1530
|
-
}
|
|
1531
|
-
if (Array.isArray(handler)) {
|
|
1532
|
-
handler.forEach((fn) => typeof fn === "function" && fn(...args));
|
|
1533
|
-
return;
|
|
1534
|
-
}
|
|
1535
|
-
if (typeof handler === "function") {
|
|
1536
|
-
handler(...args);
|
|
1537
|
-
}
|
|
1538
|
-
}
|
|
1539
|
-
function resolveEnumText(column, value) {
|
|
1540
|
-
const enumList = column.enum || column.options || [];
|
|
1541
|
-
if (!Array.isArray(enumList)) {
|
|
1542
|
-
return value;
|
|
1543
|
-
}
|
|
1544
|
-
const matched = enumList.find((item) => item.value === value);
|
|
1545
|
-
return matched ? matched.label : value;
|
|
1546
|
-
}
|
|
1547
|
-
function renderActionButtons(h, scope, column, slotRenderers, listeners) {
|
|
1548
|
-
const buttons = Array.isArray(column.buttons) ? column.buttons : [];
|
|
1549
|
-
return buttons.filter((button) => isVisible(button, scope.row)).map((button, index2) => {
|
|
1550
|
-
const slotRenderer = getRenderer(slotRenderers, button.slot);
|
|
1551
|
-
if (slotRenderer) {
|
|
1552
|
-
return slotRenderer(__spreadProps(__spreadValues({}, scope), { row: scope.row, column, button }));
|
|
1553
|
-
}
|
|
1554
|
-
return h(
|
|
1555
|
-
"el-button",
|
|
1556
|
-
{
|
|
1557
|
-
key: button.label || index2,
|
|
1558
|
-
props: {
|
|
1559
|
-
size: button.size || "mini",
|
|
1560
|
-
type: button.link ? "text" : button.type || "text",
|
|
1561
|
-
icon: typeof button.icon === "string" ? button.icon : void 0,
|
|
1562
|
-
disabled: isDisabled(button, scope.row)
|
|
1563
|
-
},
|
|
1564
|
-
on: {
|
|
1565
|
-
click: () => {
|
|
1566
|
-
if (typeof button.handler === "function") {
|
|
1567
|
-
button.handler(scope.row, scope.$index);
|
|
1568
|
-
}
|
|
1569
|
-
emit(listeners, "button-click", scope.row, column, button);
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
},
|
|
1573
|
-
[button.label]
|
|
1574
|
-
);
|
|
1575
|
-
});
|
|
1576
|
-
}
|
|
1577
|
-
function renderTag(h, scope, column) {
|
|
1578
|
-
const cellValue = getCellValue(scope.row, column);
|
|
1579
|
-
const tagType = typeof column.tagType === "function" ? column.tagType(scope.row, cellValue) : column.tagType;
|
|
1580
|
-
const text = typeof column.formatter === "function" ? column.formatter(scope.row, column, cellValue) : resolveEnumText(column, cellValue);
|
|
1581
|
-
return h("el-tag", { props: { type: tagType || "info", size: column.tagSize || "small" } }, [text]);
|
|
1582
|
-
}
|
|
1583
|
-
function renderImage(h, scope, column) {
|
|
1584
|
-
const src = getCellValue(scope.row, column);
|
|
1585
|
-
if (!src) {
|
|
1586
|
-
return "-";
|
|
1587
|
-
}
|
|
1588
|
-
return h("img", {
|
|
1589
|
-
style: {
|
|
1590
|
-
width: column.imageWidth || "40px",
|
|
1591
|
-
height: column.imageHeight || "40px",
|
|
1592
|
-
objectFit: "cover",
|
|
1593
|
-
borderRadius: "4px"
|
|
1594
|
-
},
|
|
1595
|
-
attrs: {
|
|
1596
|
-
src,
|
|
1597
|
-
alt: column.label || "image"
|
|
1598
|
-
}
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
function renderLink(h, scope, column, slotRenderers, listeners) {
|
|
1602
|
-
const renderer = getRenderer(slotRenderers, column.slot);
|
|
1603
|
-
if (renderer) {
|
|
1604
|
-
return renderer(scope);
|
|
1605
|
-
}
|
|
1606
|
-
const cellValue = getCellValue(scope.row, column);
|
|
1607
|
-
return h(
|
|
1608
|
-
"el-button",
|
|
1609
|
-
{
|
|
1610
|
-
props: {
|
|
1611
|
-
type: "text"
|
|
1612
|
-
},
|
|
1613
|
-
on: {
|
|
1614
|
-
click: () => emit(listeners, "link-click", scope.row, column)
|
|
1615
|
-
}
|
|
1616
|
-
},
|
|
1617
|
-
[column.linkText || cellValue || "-"]
|
|
1618
|
-
);
|
|
1619
|
-
}
|
|
1620
|
-
function renderDefaultCell(h, scope, column, slotRenderers, listeners) {
|
|
1621
|
-
const renderer = getRenderer(slotRenderers, column.slot);
|
|
1622
|
-
if (renderer) {
|
|
1623
|
-
return renderer(scope);
|
|
1624
|
-
}
|
|
1625
|
-
if (column.type === "action") {
|
|
1626
|
-
return h("div", { class: "ns-table-column__actions" }, renderActionButtons(h, scope, column, slotRenderers, listeners));
|
|
1627
|
-
}
|
|
1628
|
-
if (column.type === "tag") {
|
|
1629
|
-
return renderTag(h, scope, column);
|
|
1630
|
-
}
|
|
1631
|
-
if (column.type === "image") {
|
|
1632
|
-
return renderImage(h, scope, column);
|
|
1633
|
-
}
|
|
1634
|
-
if (column.type === "link") {
|
|
1635
|
-
return renderLink(h, scope, column, slotRenderers, listeners);
|
|
1636
|
-
}
|
|
1637
|
-
const cellValue = getCellValue(scope.row, column);
|
|
1638
|
-
if (typeof column.formatter === "function") {
|
|
1639
|
-
return column.formatter(scope.row, column, cellValue);
|
|
1640
|
-
}
|
|
1641
|
-
if (column.enum) {
|
|
1642
|
-
return resolveEnumText(column, cellValue);
|
|
1643
|
-
}
|
|
1644
|
-
return cellValue === void 0 || cellValue === null || cellValue === "" ? "-" : cellValue;
|
|
1645
|
-
}
|
|
1646
|
-
function renderColumn(h, column, slotRenderers, listeners) {
|
|
1647
|
-
const children = Array.isArray(column.children) ? column.children.map(
|
|
1648
|
-
(child, index2) => h(TableColumn, {
|
|
1649
|
-
key: child.prop || child.label || index2,
|
|
1650
|
-
props: {
|
|
1651
|
-
column: child,
|
|
1652
|
-
slotRenderers
|
|
1653
|
-
},
|
|
1654
|
-
on: listeners
|
|
1655
|
-
})
|
|
1656
|
-
) : [];
|
|
1657
|
-
const headerRenderer = getRenderer(slotRenderers, column.headerSlot);
|
|
1658
|
-
return h(
|
|
1659
|
-
"el-table-column",
|
|
1660
|
-
{
|
|
1661
|
-
props: getColumnProps(column),
|
|
1662
|
-
scopedSlots: children.length ? headerRenderer ? { header: headerRenderer } : void 0 : __spreadValues({
|
|
1663
|
-
default: (scope) => renderDefaultCell(h, scope, column, slotRenderers, listeners)
|
|
1664
|
-
}, headerRenderer ? { header: headerRenderer } : {})
|
|
1665
|
-
},
|
|
1666
|
-
children
|
|
1667
|
-
);
|
|
1668
|
-
}
|
|
1669
1533
|
const TableColumn = {
|
|
1670
1534
|
name: "NsTableColumn",
|
|
1671
|
-
functional: true,
|
|
1672
1535
|
props: {
|
|
1673
1536
|
column: {
|
|
1674
1537
|
type: Object,
|
|
@@ -1679,8 +1542,166 @@ const TableColumn = {
|
|
|
1679
1542
|
default: () => ({})
|
|
1680
1543
|
}
|
|
1681
1544
|
},
|
|
1682
|
-
|
|
1683
|
-
|
|
1545
|
+
methods: {
|
|
1546
|
+
getColumnProps(column) {
|
|
1547
|
+
const props = __spreadValues({}, column);
|
|
1548
|
+
RESERVED_KEYS.forEach((key) => delete props[key]);
|
|
1549
|
+
return props;
|
|
1550
|
+
},
|
|
1551
|
+
getRenderer(name) {
|
|
1552
|
+
return name ? this.slotRenderers[name] : null;
|
|
1553
|
+
},
|
|
1554
|
+
getCellValue(row, column) {
|
|
1555
|
+
return column.prop ? row[column.prop] : void 0;
|
|
1556
|
+
},
|
|
1557
|
+
isVisible(config, row) {
|
|
1558
|
+
if (typeof config.show === "function") {
|
|
1559
|
+
return config.show(row) !== false;
|
|
1560
|
+
}
|
|
1561
|
+
if (config.show === void 0) {
|
|
1562
|
+
return true;
|
|
1563
|
+
}
|
|
1564
|
+
return !!config.show;
|
|
1565
|
+
},
|
|
1566
|
+
isDisabled(config, row) {
|
|
1567
|
+
return typeof config.disabled === "function" ? !!config.disabled(row) : !!config.disabled;
|
|
1568
|
+
},
|
|
1569
|
+
renderActionButtons(h, scope, column) {
|
|
1570
|
+
const buttons = Array.isArray(column.buttons) ? column.buttons : [];
|
|
1571
|
+
return buttons.filter((button) => this.isVisible(button, scope.row)).map((button, index2) => {
|
|
1572
|
+
const slotRenderer = this.getRenderer(button.slot);
|
|
1573
|
+
if (slotRenderer) {
|
|
1574
|
+
return slotRenderer(__spreadProps(__spreadValues({}, scope), { row: scope.row, column, button }));
|
|
1575
|
+
}
|
|
1576
|
+
return h(
|
|
1577
|
+
"el-button",
|
|
1578
|
+
{
|
|
1579
|
+
key: button.label || index2,
|
|
1580
|
+
props: {
|
|
1581
|
+
size: button.size || "mini",
|
|
1582
|
+
type: button.link ? "text" : button.type || "text",
|
|
1583
|
+
icon: typeof button.icon === "string" ? button.icon : void 0,
|
|
1584
|
+
disabled: this.isDisabled(button, scope.row)
|
|
1585
|
+
},
|
|
1586
|
+
on: {
|
|
1587
|
+
click: () => {
|
|
1588
|
+
if (typeof button.handler === "function") {
|
|
1589
|
+
button.handler(scope.row, scope.$index);
|
|
1590
|
+
}
|
|
1591
|
+
this.$emit("button-click", scope.row, column, button);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1595
|
+
[button.label]
|
|
1596
|
+
);
|
|
1597
|
+
});
|
|
1598
|
+
},
|
|
1599
|
+
renderTag(h, scope, column) {
|
|
1600
|
+
const cellValue = this.getCellValue(scope.row, column);
|
|
1601
|
+
const tagType = typeof column.tagType === "function" ? column.tagType(scope.row, cellValue) : column.tagType;
|
|
1602
|
+
const text = typeof column.formatter === "function" ? column.formatter(scope.row, column, cellValue) : this.resolveEnumText(column, cellValue);
|
|
1603
|
+
return h("el-tag", { props: { type: tagType || "info", size: column.tagSize || "small" } }, [text]);
|
|
1604
|
+
},
|
|
1605
|
+
renderImage(h, scope, column) {
|
|
1606
|
+
const src = this.getCellValue(scope.row, column);
|
|
1607
|
+
if (!src) {
|
|
1608
|
+
return "-";
|
|
1609
|
+
}
|
|
1610
|
+
return h("img", {
|
|
1611
|
+
style: {
|
|
1612
|
+
width: column.imageWidth || "40px",
|
|
1613
|
+
height: column.imageHeight || "40px",
|
|
1614
|
+
objectFit: "cover",
|
|
1615
|
+
borderRadius: "4px"
|
|
1616
|
+
},
|
|
1617
|
+
attrs: {
|
|
1618
|
+
src,
|
|
1619
|
+
alt: column.label || "image"
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
},
|
|
1623
|
+
renderLink(h, scope, column) {
|
|
1624
|
+
const renderer = this.getRenderer(column.slot);
|
|
1625
|
+
if (renderer) {
|
|
1626
|
+
return renderer(scope);
|
|
1627
|
+
}
|
|
1628
|
+
const cellValue = this.getCellValue(scope.row, column);
|
|
1629
|
+
return h(
|
|
1630
|
+
"el-button",
|
|
1631
|
+
{
|
|
1632
|
+
props: {
|
|
1633
|
+
type: "text"
|
|
1634
|
+
},
|
|
1635
|
+
on: {
|
|
1636
|
+
click: () => this.$emit("link-click", scope.row, column)
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
[column.linkText || cellValue || "-"]
|
|
1640
|
+
);
|
|
1641
|
+
},
|
|
1642
|
+
resolveEnumText(column, value) {
|
|
1643
|
+
const enumList = column.enum || column.options || [];
|
|
1644
|
+
if (!Array.isArray(enumList)) {
|
|
1645
|
+
return value;
|
|
1646
|
+
}
|
|
1647
|
+
const matched = enumList.find((item) => item.value === value);
|
|
1648
|
+
return matched ? matched.label : value;
|
|
1649
|
+
},
|
|
1650
|
+
renderDefaultCell(h, scope, column) {
|
|
1651
|
+
const renderer = this.getRenderer(column.slot);
|
|
1652
|
+
if (renderer) {
|
|
1653
|
+
return renderer(scope);
|
|
1654
|
+
}
|
|
1655
|
+
if (column.type === "action") {
|
|
1656
|
+
return h("div", { class: "ns-table-column__actions" }, this.renderActionButtons(h, scope, column));
|
|
1657
|
+
}
|
|
1658
|
+
if (column.type === "tag") {
|
|
1659
|
+
return this.renderTag(h, scope, column);
|
|
1660
|
+
}
|
|
1661
|
+
if (column.type === "image") {
|
|
1662
|
+
return this.renderImage(h, scope, column);
|
|
1663
|
+
}
|
|
1664
|
+
if (column.type === "link") {
|
|
1665
|
+
return this.renderLink(h, scope, column);
|
|
1666
|
+
}
|
|
1667
|
+
const cellValue = this.getCellValue(scope.row, column);
|
|
1668
|
+
if (typeof column.formatter === "function") {
|
|
1669
|
+
return column.formatter(scope.row, column, cellValue);
|
|
1670
|
+
}
|
|
1671
|
+
if (column.enum) {
|
|
1672
|
+
return this.resolveEnumText(column, cellValue);
|
|
1673
|
+
}
|
|
1674
|
+
return cellValue === void 0 || cellValue === null || cellValue === "" ? "-" : cellValue;
|
|
1675
|
+
},
|
|
1676
|
+
renderColumn(h, column) {
|
|
1677
|
+
const children = Array.isArray(column.children) ? column.children.map(
|
|
1678
|
+
(child, index2) => h(TableColumn, {
|
|
1679
|
+
key: child.prop || child.label || index2,
|
|
1680
|
+
props: {
|
|
1681
|
+
column: child,
|
|
1682
|
+
slotRenderers: this.slotRenderers
|
|
1683
|
+
},
|
|
1684
|
+
on: {
|
|
1685
|
+
"link-click": (...args) => this.$emit("link-click", ...args),
|
|
1686
|
+
"button-click": (...args) => this.$emit("button-click", ...args)
|
|
1687
|
+
}
|
|
1688
|
+
})
|
|
1689
|
+
) : [];
|
|
1690
|
+
const headerRenderer = this.getRenderer(column.headerSlot);
|
|
1691
|
+
return h(
|
|
1692
|
+
"el-table-column",
|
|
1693
|
+
{
|
|
1694
|
+
props: this.getColumnProps(column),
|
|
1695
|
+
scopedSlots: children.length ? headerRenderer ? { header: headerRenderer } : void 0 : __spreadValues({
|
|
1696
|
+
default: (scope) => this.renderDefaultCell(h, scope, column)
|
|
1697
|
+
}, headerRenderer ? { header: headerRenderer } : {})
|
|
1698
|
+
},
|
|
1699
|
+
children
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
render(h) {
|
|
1704
|
+
return this.renderColumn(h, this.column);
|
|
1684
1705
|
}
|
|
1685
1706
|
};
|
|
1686
1707
|
const TableColumn$1 = TableColumn;
|
|
@@ -1711,7 +1732,7 @@ function resetPagination(pagination) {
|
|
|
1711
1732
|
pagination.pageSize = 10;
|
|
1712
1733
|
return pagination;
|
|
1713
1734
|
}
|
|
1714
|
-
const
|
|
1735
|
+
const PageTable_vue_vue_type_style_index_0_scoped_86cf2232_lang = "";
|
|
1715
1736
|
const RESERVED_LISTENERS = ["add", "selection-change", "sort-change", "row-click", "size-change", "current-change", "link-click"];
|
|
1716
1737
|
const _sfc_main$2 = {
|
|
1717
1738
|
name: "NsTable",
|
|
@@ -1817,6 +1838,10 @@ const _sfc_main$2 = {
|
|
|
1817
1838
|
type: Number,
|
|
1818
1839
|
default: null
|
|
1819
1840
|
},
|
|
1841
|
+
useDefaultPage: {
|
|
1842
|
+
type: Boolean,
|
|
1843
|
+
default: true
|
|
1844
|
+
},
|
|
1820
1845
|
pageSizes: {
|
|
1821
1846
|
type: Array,
|
|
1822
1847
|
default: () => [10, 20, 50, 100]
|
|
@@ -1844,9 +1869,7 @@ const _sfc_main$2 = {
|
|
|
1844
1869
|
},
|
|
1845
1870
|
data() {
|
|
1846
1871
|
return {
|
|
1847
|
-
internalPagination: createPagination()
|
|
1848
|
-
resizeObserver: null,
|
|
1849
|
-
layoutTimer: null
|
|
1872
|
+
internalPagination: createPagination()
|
|
1850
1873
|
};
|
|
1851
1874
|
},
|
|
1852
1875
|
computed: {
|
|
@@ -1865,9 +1888,12 @@ const _sfc_main$2 = {
|
|
|
1865
1888
|
return listeners;
|
|
1866
1889
|
},
|
|
1867
1890
|
resolvedHeight() {
|
|
1868
|
-
if (this.height !== void 0
|
|
1891
|
+
if (this.height !== void 0) {
|
|
1869
1892
|
return this.height;
|
|
1870
1893
|
}
|
|
1894
|
+
if (this.autoHeight && this.maxHeight === void 0) {
|
|
1895
|
+
return "100%";
|
|
1896
|
+
}
|
|
1871
1897
|
return void 0;
|
|
1872
1898
|
},
|
|
1873
1899
|
resolvedMaxHeight() {
|
|
@@ -1893,63 +1919,9 @@ const _sfc_main$2 = {
|
|
|
1893
1919
|
}
|
|
1894
1920
|
},
|
|
1895
1921
|
immediate: true
|
|
1896
|
-
},
|
|
1897
|
-
tableData: {
|
|
1898
|
-
handler() {
|
|
1899
|
-
this.scheduleLayout();
|
|
1900
|
-
},
|
|
1901
|
-
deep: true,
|
|
1902
|
-
immediate: true
|
|
1903
|
-
},
|
|
1904
|
-
columns: {
|
|
1905
|
-
handler() {
|
|
1906
|
-
this.scheduleLayout();
|
|
1907
|
-
},
|
|
1908
|
-
deep: true,
|
|
1909
|
-
immediate: true
|
|
1910
|
-
}
|
|
1911
|
-
},
|
|
1912
|
-
mounted() {
|
|
1913
|
-
this.scheduleLayout();
|
|
1914
|
-
this.initResizeObserver();
|
|
1915
|
-
},
|
|
1916
|
-
beforeDestroy() {
|
|
1917
|
-
if (this.resizeObserver) {
|
|
1918
|
-
this.resizeObserver.disconnect();
|
|
1919
|
-
this.resizeObserver = null;
|
|
1920
|
-
}
|
|
1921
|
-
if (this.layoutTimer) {
|
|
1922
|
-
clearTimeout(this.layoutTimer);
|
|
1923
|
-
this.layoutTimer = null;
|
|
1924
1922
|
}
|
|
1925
1923
|
},
|
|
1926
1924
|
methods: {
|
|
1927
|
-
scheduleLayout() {
|
|
1928
|
-
this.$nextTick(() => {
|
|
1929
|
-
this.doLayout();
|
|
1930
|
-
if (this.layoutTimer) {
|
|
1931
|
-
clearTimeout(this.layoutTimer);
|
|
1932
|
-
}
|
|
1933
|
-
this.layoutTimer = setTimeout(() => {
|
|
1934
|
-
this.doLayout();
|
|
1935
|
-
this.layoutTimer = null;
|
|
1936
|
-
}, 50);
|
|
1937
|
-
});
|
|
1938
|
-
},
|
|
1939
|
-
initResizeObserver() {
|
|
1940
|
-
if (typeof ResizeObserver === "undefined") {
|
|
1941
|
-
return;
|
|
1942
|
-
}
|
|
1943
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
1944
|
-
this.scheduleLayout();
|
|
1945
|
-
});
|
|
1946
|
-
if (this.$el) {
|
|
1947
|
-
this.resizeObserver.observe(this.$el);
|
|
1948
|
-
}
|
|
1949
|
-
if (this.$el && this.$el.parentElement) {
|
|
1950
|
-
this.resizeObserver.observe(this.$el.parentElement);
|
|
1951
|
-
}
|
|
1952
|
-
},
|
|
1953
1925
|
handleAdd() {
|
|
1954
1926
|
this.$emit("add");
|
|
1955
1927
|
},
|
|
@@ -1964,12 +1936,16 @@ const _sfc_main$2 = {
|
|
|
1964
1936
|
},
|
|
1965
1937
|
handleSizeChange(size) {
|
|
1966
1938
|
this.internalPagination.pageSize = size;
|
|
1967
|
-
this
|
|
1939
|
+
if (!this.useDefaultPage) {
|
|
1940
|
+
this.$emit("update:pageSize", size);
|
|
1941
|
+
}
|
|
1968
1942
|
this.$emit("size-change", size);
|
|
1969
1943
|
},
|
|
1970
1944
|
handleCurrentChange(page) {
|
|
1971
1945
|
this.internalPagination.currentPage = page;
|
|
1972
|
-
this
|
|
1946
|
+
if (!this.useDefaultPage) {
|
|
1947
|
+
this.$emit("update:currentPage", page);
|
|
1948
|
+
}
|
|
1973
1949
|
this.$emit("current-change", page);
|
|
1974
1950
|
},
|
|
1975
1951
|
handleLinkClick(row, column) {
|
|
@@ -2053,15 +2029,21 @@ const _sfc_main$2 = {
|
|
|
2053
2029
|
},
|
|
2054
2030
|
resetPage() {
|
|
2055
2031
|
this.internalPagination.currentPage = 1;
|
|
2056
|
-
this
|
|
2032
|
+
if (!this.useDefaultPage) {
|
|
2033
|
+
this.$emit("update:currentPage", 1);
|
|
2034
|
+
}
|
|
2057
2035
|
},
|
|
2058
2036
|
setPage(page) {
|
|
2059
2037
|
this.internalPagination.currentPage = page;
|
|
2060
|
-
this
|
|
2038
|
+
if (!this.useDefaultPage) {
|
|
2039
|
+
this.$emit("update:currentPage", page);
|
|
2040
|
+
}
|
|
2061
2041
|
},
|
|
2062
2042
|
setPageSize(size) {
|
|
2063
2043
|
this.internalPagination.pageSize = size;
|
|
2064
|
-
this
|
|
2044
|
+
if (!this.useDefaultPage) {
|
|
2045
|
+
this.$emit("update:pageSize", size);
|
|
2046
|
+
}
|
|
2065
2047
|
},
|
|
2066
2048
|
getPagination() {
|
|
2067
2049
|
return {
|
|
@@ -2093,12 +2075,12 @@ var __component__$2 = /* @__PURE__ */ normalizeComponent(
|
|
|
2093
2075
|
_sfc_staticRenderFns$2,
|
|
2094
2076
|
false,
|
|
2095
2077
|
null,
|
|
2096
|
-
"
|
|
2078
|
+
"86cf2232",
|
|
2097
2079
|
null,
|
|
2098
2080
|
null
|
|
2099
2081
|
);
|
|
2100
2082
|
const NsTable = __component__$2.exports;
|
|
2101
|
-
const
|
|
2083
|
+
const PageContainer_vue_vue_type_style_index_0_scoped_0d1f3c53_lang = "";
|
|
2102
2084
|
const _sfc_main$1 = {
|
|
2103
2085
|
name: "NsTableContainer",
|
|
2104
2086
|
components: {
|
|
@@ -2166,24 +2148,37 @@ const _sfc_main$1 = {
|
|
|
2166
2148
|
type: Object,
|
|
2167
2149
|
default: () => ({})
|
|
2168
2150
|
},
|
|
2169
|
-
|
|
2170
|
-
type:
|
|
2171
|
-
default:
|
|
2151
|
+
useDefaultPage: {
|
|
2152
|
+
type: Boolean,
|
|
2153
|
+
default: true
|
|
2172
2154
|
}
|
|
2173
2155
|
},
|
|
2174
2156
|
data() {
|
|
2175
2157
|
return {
|
|
2176
2158
|
internalPagination: createPagination(),
|
|
2159
|
+
internalSearchParams: {},
|
|
2160
|
+
internalSortState: { prop: "", order: "" },
|
|
2177
2161
|
pendingSelectionKeys: /* @__PURE__ */ new Set(),
|
|
2178
2162
|
selectionRowMap: {},
|
|
2179
|
-
isSyncingSelection: false
|
|
2163
|
+
isSyncingSelection: false,
|
|
2164
|
+
_emitSearchTimer: null
|
|
2180
2165
|
};
|
|
2181
2166
|
},
|
|
2167
|
+
beforeDestroy() {
|
|
2168
|
+
if (this._emitSearchTimer) {
|
|
2169
|
+
clearTimeout(this._emitSearchTimer);
|
|
2170
|
+
this._emitSearchTimer = null;
|
|
2171
|
+
}
|
|
2172
|
+
},
|
|
2182
2173
|
computed: {
|
|
2183
2174
|
currentPageModel() {
|
|
2175
|
+
if (this.useDefaultPage)
|
|
2176
|
+
return this.internalPagination.currentPage;
|
|
2184
2177
|
return this.currentPage === null ? this.internalPagination.currentPage : this.currentPage;
|
|
2185
2178
|
},
|
|
2186
2179
|
pageSizeModel() {
|
|
2180
|
+
if (this.useDefaultPage)
|
|
2181
|
+
return this.internalPagination.pageSize;
|
|
2187
2182
|
return this.pageSize === null ? this.internalPagination.pageSize : this.pageSize;
|
|
2188
2183
|
},
|
|
2189
2184
|
currentRowKey() {
|
|
@@ -2193,6 +2188,8 @@ const _sfc_main$1 = {
|
|
|
2193
2188
|
watch: {
|
|
2194
2189
|
currentPage: {
|
|
2195
2190
|
handler(value) {
|
|
2191
|
+
if (this.useDefaultPage)
|
|
2192
|
+
return;
|
|
2196
2193
|
if (value !== null) {
|
|
2197
2194
|
this.internalPagination.currentPage = value;
|
|
2198
2195
|
}
|
|
@@ -2201,6 +2198,8 @@ const _sfc_main$1 = {
|
|
|
2201
2198
|
},
|
|
2202
2199
|
pageSize: {
|
|
2203
2200
|
handler(value) {
|
|
2201
|
+
if (this.useDefaultPage)
|
|
2202
|
+
return;
|
|
2204
2203
|
if (value !== null) {
|
|
2205
2204
|
this.internalPagination.pageSize = value;
|
|
2206
2205
|
}
|
|
@@ -2247,14 +2246,17 @@ const _sfc_main$1 = {
|
|
|
2247
2246
|
},
|
|
2248
2247
|
handleSearch(params) {
|
|
2249
2248
|
this.resetSelectionState();
|
|
2249
|
+
let nextParams = params || {};
|
|
2250
2250
|
if (params && params._resetPage) {
|
|
2251
2251
|
const _a = params, { _resetPage } = _a, searchParams = __objRest(_a, ["_resetPage"]);
|
|
2252
|
+
nextParams = searchParams;
|
|
2252
2253
|
this.internalPagination.currentPage = 1;
|
|
2253
|
-
this
|
|
2254
|
-
|
|
2255
|
-
|
|
2254
|
+
if (!this.useDefaultPage) {
|
|
2255
|
+
this.$emit("update:currentPage", 1);
|
|
2256
|
+
}
|
|
2256
2257
|
}
|
|
2257
|
-
this
|
|
2258
|
+
this.internalSearchParams = __spreadValues({}, nextParams);
|
|
2259
|
+
this.emitSearch();
|
|
2258
2260
|
},
|
|
2259
2261
|
handleReset() {
|
|
2260
2262
|
this.resetSelectionState();
|
|
@@ -2265,27 +2267,35 @@ const _sfc_main$1 = {
|
|
|
2265
2267
|
},
|
|
2266
2268
|
handleSizeChange(size) {
|
|
2267
2269
|
this.internalPagination.pageSize = size;
|
|
2268
|
-
|
|
2270
|
+
const maxPage = Math.max(1, Math.ceil((this.total || 0) / size));
|
|
2271
|
+
if (this.internalPagination.currentPage > maxPage) {
|
|
2272
|
+
this.internalPagination.currentPage = maxPage;
|
|
2273
|
+
}
|
|
2274
|
+
if (!this.useDefaultPage) {
|
|
2275
|
+
this.$emit("update:pageSize", size);
|
|
2276
|
+
this.$emit("update:currentPage", this.internalPagination.currentPage);
|
|
2277
|
+
}
|
|
2269
2278
|
this.$emit("size-change", size);
|
|
2270
2279
|
this.$emit("page-change", {
|
|
2271
|
-
currentPage: this.
|
|
2280
|
+
currentPage: this.internalPagination.currentPage,
|
|
2272
2281
|
pageSize: size
|
|
2273
2282
|
});
|
|
2274
|
-
|
|
2275
|
-
this.loadData();
|
|
2276
|
-
}
|
|
2283
|
+
this.emitSearch();
|
|
2277
2284
|
},
|
|
2278
2285
|
handleCurrentChange(page) {
|
|
2286
|
+
if (this.internalPagination.currentPage === page) {
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
2279
2289
|
this.internalPagination.currentPage = page;
|
|
2280
|
-
this
|
|
2290
|
+
if (!this.useDefaultPage) {
|
|
2291
|
+
this.$emit("update:currentPage", page);
|
|
2292
|
+
}
|
|
2281
2293
|
this.$emit("current-change", page);
|
|
2282
2294
|
this.$emit("page-change", {
|
|
2283
2295
|
currentPage: page,
|
|
2284
2296
|
pageSize: this.pageSizeModel
|
|
2285
2297
|
});
|
|
2286
|
-
|
|
2287
|
-
this.loadData();
|
|
2288
|
-
}
|
|
2298
|
+
this.emitSearch();
|
|
2289
2299
|
},
|
|
2290
2300
|
handleSelectionChange(selection) {
|
|
2291
2301
|
if (this.isSyncingSelection) {
|
|
@@ -2308,7 +2318,9 @@ const _sfc_main$1 = {
|
|
|
2308
2318
|
this.$emit("selection-change", Object.values(this.selectionRowMap));
|
|
2309
2319
|
},
|
|
2310
2320
|
handleSortChange(sort) {
|
|
2321
|
+
this.internalSortState = sort || { prop: "", order: "" };
|
|
2311
2322
|
this.$emit("sort-change", sort);
|
|
2323
|
+
this.emitSearch();
|
|
2312
2324
|
},
|
|
2313
2325
|
handleRowClick(row, column, event) {
|
|
2314
2326
|
this.$emit("row-click", row, column, event);
|
|
@@ -2316,15 +2328,32 @@ const _sfc_main$1 = {
|
|
|
2316
2328
|
handleLinkClick(row, column) {
|
|
2317
2329
|
this.$emit("link-click", row, column);
|
|
2318
2330
|
},
|
|
2331
|
+
buildLoadQuery() {
|
|
2332
|
+
return __spreadProps(__spreadValues({}, this.internalSearchParams), {
|
|
2333
|
+
[this.pageNumberKey]: this.currentPageModel,
|
|
2334
|
+
[this.pageSizeKey]: this.pageSizeModel,
|
|
2335
|
+
sort: __spreadValues({}, this.internalSortState)
|
|
2336
|
+
});
|
|
2337
|
+
},
|
|
2338
|
+
emitSearch() {
|
|
2339
|
+
if (this._emitSearchTimer) {
|
|
2340
|
+
clearTimeout(this._emitSearchTimer);
|
|
2341
|
+
}
|
|
2342
|
+
this._emitSearchTimer = setTimeout(() => {
|
|
2343
|
+
this._emitSearchTimer = null;
|
|
2344
|
+
this.$emit("search", this.buildLoadQuery());
|
|
2345
|
+
}, 0);
|
|
2346
|
+
},
|
|
2347
|
+
reload() {
|
|
2348
|
+
this.emitSearch();
|
|
2349
|
+
},
|
|
2319
2350
|
initSearchAndLoad() {
|
|
2320
2351
|
this.$nextTick(() => {
|
|
2321
2352
|
if (this.showSearch && this.$refs.searchRef) {
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
}
|
|
2325
|
-
if (this.loadData) {
|
|
2326
|
-
this.loadData();
|
|
2353
|
+
const formData = this.$refs.searchRef.getFormData();
|
|
2354
|
+
this.internalSearchParams = __spreadValues({}, formData);
|
|
2327
2355
|
}
|
|
2356
|
+
this.emitSearch();
|
|
2328
2357
|
});
|
|
2329
2358
|
},
|
|
2330
2359
|
getSearchFormData() {
|
|
@@ -2411,7 +2440,7 @@ const _sfc_main$1 = {
|
|
|
2411
2440
|
};
|
|
2412
2441
|
var _sfc_render$1 = function render5() {
|
|
2413
2442
|
var _vm = this, _c = _vm._self._c;
|
|
2414
|
-
return _c("div", { staticClass: "page-container" }, [_vm.showSearch ? _c("page-search", _vm._b({ ref: "searchRef", attrs: { "items": _vm.searchItems, "external-params": _vm.externalSearchParams, "enter-trigger": _vm.enterTrigger, "slot-renderers": _vm.$scopedSlots }, on: { "search": _vm.handleSearch, "reset": _vm.handleReset } }, "page-search", _vm.searchProps, false)) : _vm._e(), _vm._t("extend"), _c("page-table", _vm._b({ ref: "tableRef", attrs: { "table-data": _vm.tableData, "columns": _vm.columns, "action-buttons": _vm.actionButtons, "total": _vm.total, "current-page": _vm.currentPageModel, "page-size": _vm.pageSizeModel, "page-number-key": _vm.pageNumberKey, "page-size-key": _vm.pageSizeKey, "page-total-key": _vm.pageTotalKey, "slot-renderers": _vm.$scopedSlots }, on: { "add": _vm.handleAdd, "selection-change": _vm.handleSelectionChange, "sort-change": _vm.handleSortChange, "row-click": _vm.handleRowClick, "size-change": _vm.handleSizeChange, "current-change": _vm.handleCurrentChange, "link-click": _vm.handleLinkClick } }, "page-table", _vm.tableProps, false))], 2);
|
|
2443
|
+
return _c("div", { staticClass: "page-container" }, [_vm.showSearch ? _c("page-search", _vm._b({ ref: "searchRef", attrs: { "items": _vm.searchItems, "external-params": _vm.externalSearchParams, "enter-trigger": _vm.enterTrigger, "slot-renderers": _vm.$scopedSlots }, on: { "search": _vm.handleSearch, "reset": _vm.handleReset } }, "page-search", _vm.searchProps, false)) : _vm._e(), _vm._t("extend"), _c("page-table", _vm._b({ ref: "tableRef", attrs: { "table-data": _vm.tableData, "columns": _vm.columns, "action-buttons": _vm.actionButtons, "total": _vm.total, "current-page": _vm.currentPageModel, "page-size": _vm.pageSizeModel, "use-default-page": _vm.useDefaultPage, "page-number-key": _vm.pageNumberKey, "page-size-key": _vm.pageSizeKey, "page-total-key": _vm.pageTotalKey, "slot-renderers": _vm.$scopedSlots }, on: { "add": _vm.handleAdd, "selection-change": _vm.handleSelectionChange, "sort-change": _vm.handleSortChange, "row-click": _vm.handleRowClick, "size-change": _vm.handleSizeChange, "current-change": _vm.handleCurrentChange, "link-click": _vm.handleLinkClick } }, "page-table", _vm.tableProps, false))], 2);
|
|
2415
2444
|
};
|
|
2416
2445
|
var _sfc_staticRenderFns$1 = [];
|
|
2417
2446
|
var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
@@ -2420,7 +2449,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
|
2420
2449
|
_sfc_staticRenderFns$1,
|
|
2421
2450
|
false,
|
|
2422
2451
|
null,
|
|
2423
|
-
"
|
|
2452
|
+
"0d1f3c53",
|
|
2424
2453
|
null,
|
|
2425
2454
|
null
|
|
2426
2455
|
);
|
|
@@ -2681,7 +2710,7 @@ const _sfc_main = {
|
|
|
2681
2710
|
}
|
|
2682
2711
|
},
|
|
2683
2712
|
mounted() {
|
|
2684
|
-
loadCssVars();
|
|
2713
|
+
loadCssVars$1();
|
|
2685
2714
|
this.visible = true;
|
|
2686
2715
|
this.updateModalStyle();
|
|
2687
2716
|
this.syncDialogInstance();
|
|
@@ -3185,7 +3214,7 @@ function install2(Vue2, options = {}) {
|
|
|
3185
3214
|
}
|
|
3186
3215
|
});
|
|
3187
3216
|
setExternalApp(Vue2, options);
|
|
3188
|
-
loadCssVars();
|
|
3217
|
+
loadCssVars$1();
|
|
3189
3218
|
if (Vue2 && Vue2.prototype) {
|
|
3190
3219
|
Vue2.prototype.$NsDialog = NsDialog;
|
|
3191
3220
|
Vue2.prototype.$closeAllNsDialog = closeAllNsDialog;
|