mc-plus 1.0.64 → 1.0.65
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/es/{hooks-CGzJKvr_.js → hooks-DghKpOue.js} +4 -3
- package/dist/es/index.js +38 -38
- package/dist/es/{mc-alert-message-CinXZ0tM.js → mc-alert-message-D5xabGCX.js} +2 -2
- package/dist/es/{mc-button-jjZ1cFJx.js → mc-button-B-2mob1r.js} +3 -3
- package/dist/es/{mc-checkbox-DBTBERJQ.js → mc-checkbox-iP5RHA6x.js} +4 -4
- package/dist/es/{mc-collapse-DUOKmqfY.js → mc-collapse-C2oWrpLp.js} +2 -2
- package/dist/es/{mc-copy-BcM4lyRW.js → mc-copy-Baim9vBo.js} +3 -3
- package/dist/es/{mc-count-CMSVLQR8.js → mc-count-BqyWuWKT.js} +1 -1
- package/dist/es/{mc-currency-icon-jT9o6zvb.js → mc-currency-icon-Do56_Rk9.js} +2 -2
- package/dist/es/{mc-divider-CvAVIbPj.js → mc-divider-BSXy8GNr.js} +1 -1
- package/dist/es/{mc-drawer-CNeHLu-v.js → mc-drawer-CeCN5c5X.js} +5 -5
- package/dist/es/{mc-footer-DTmWsLYW.js → mc-footer-DjlFAv9f.js} +1 -1
- package/dist/es/{mc-form-DDfiOG9s.js → mc-form-Bf0120BQ.js} +4 -4
- package/dist/es/{mc-icon-IbJYufG-.js → mc-icon-B_dAlj4r.js} +9 -8
- package/dist/es/{mc-input-CqBzOAz5.js → mc-input-C5MU4U2V.js} +5 -5
- package/dist/es/{mc-lightbox-BsUeQpwu.js → mc-lightbox-8zpx4nrJ.js} +5 -5
- package/dist/es/{mc-loading-CXadQqQf.js → mc-loading-C311OVMI.js} +6 -5
- package/dist/es/{mc-modal-header-5_k9U4WX.js → mc-modal-header-CMNRK0Rb.js} +3 -3
- package/dist/es/{mc-otp-DWzv8zKs.js → mc-otp-BE08aHEv.js} +5 -5
- package/dist/es/{mc-overlay-D3L83lMC.js → mc-overlay-BHxTmf2H.js} +1 -1
- package/dist/es/{mc-popper-B08tDa9O.js → mc-popper-B8qMu2va.js} +3 -3
- package/dist/es/{mc-progress-bar-XvvNZ-ef.js → mc-progress-bar-GGuMUhLo.js} +3 -3
- package/dist/es/{mc-radio-BcfwMaZZ.js → mc-radio-BPBdgFH4.js} +4 -4
- package/dist/es/{mc-reset-B-jk5Wxa.js → mc-reset-hnnz6SoG.js} +2 -2
- package/dist/es/{mc-secondary-menu-CLZVBsLM.js → mc-secondary-menu-2eW8se9v.js} +2 -2
- package/dist/es/{mc-select-DZzvR6r3.js → mc-select-D4OYQtvg.js} +12 -12
- package/dist/es/{mc-status-C2V51mhO.js → mc-status-Bbu0MyzD.js} +2 -2
- package/dist/es/{mc-step-8_bbfcnk.js → mc-step-DKfRXGSk.js} +5 -5
- package/dist/es/{mc-success-icon-BiN_K4dV.js → mc-success-icon-Cj-5Hgzy.js} +1 -1
- package/dist/es/{mc-switch-3iWF558F.js → mc-switch-fuT3qt1P.js} +3 -3
- package/dist/es/mc-tab-D_pxBB3w.js +641 -0
- package/dist/es/{mc-tag-BBOwBzDa.js → mc-tag-jYhZ-J2S.js} +2 -2
- package/dist/es/{mc-textarea-DJcRz9YP.js → mc-textarea-DtsztsBR.js} +3 -3
- package/dist/es/{mc-title-DR3kaXNt.js → mc-title-C_lOz0mp.js} +3 -3
- package/dist/es/{mc-toast-QxGn_8nt.js → mc-toast-DB9Y1bvS.js} +2 -2
- package/dist/es/{mc-tooltip-D31bUUmR.js → mc-tooltip-4mxkVOGx.js} +3 -3
- package/dist/es/{mc-upload-Dem3mTAo.js → mc-upload-D8-d7Xhv.js} +7 -7
- package/dist/es/theme/mc-tab.css +1 -1
- package/dist/es/utils-BDbMLK9w.js +36 -0
- package/dist/es/{vendor-COcyTY4s.js → vendor-CExPGg1i.js} +276 -260
- package/dist/index.css +1 -1
- package/dist/types/components/mc-icon-plus/types.d.ts +1 -1
- package/dist/types/components/mc-table-plus/constant.d.ts +6 -6
- package/dist/types/components/mc-table-plus/hooks/index.d.ts +6 -0
- package/dist/types/components/mc-table-plus/hooks/useColumns.d.ts +43 -0
- package/dist/types/components/mc-table-plus/hooks/useExpand.d.ts +9 -0
- package/dist/types/components/mc-table-plus/hooks/useScroll.d.ts +6 -0
- package/dist/types/components/mc-table-plus/hooks/useSectionWidth.d.ts +15 -0
- package/dist/types/components/mc-table-plus/hooks/useSort.d.ts +15 -0
- package/dist/types/components/mc-table-plus/hooks/useTableCell.d.ts +23 -0
- package/dist/types/components/mc-table-plus/hooks/useTableContext.d.ts +21 -11
- package/dist/types/components/mc-table-plus/index.d.ts +5 -1
- package/dist/types/components/mc-table-plus/types/index.d.ts +3 -7
- package/dist/types/components/mc-table-plus/types/mc-table-body.d.ts +1 -2
- package/dist/types/components/mc-table-plus/types/mc-table-cell.d.ts +20 -0
- package/dist/types/components/mc-table-plus/types/mc-table-column.d.ts +1 -2
- package/dist/types/components/mc-table-plus/types/mc-table-row.d.ts +8 -0
- package/dist/types/components/mc-table-plus/types/mc-table-sort.d.ts +1 -1
- package/dist/types/components/mc-table-plus/types/mc-table.d.ts +23 -16
- package/dist/types/components/mc-table-plus/utils/generateColumns.d.ts +2 -2
- package/dist/types/components/mc-table-plus/utils/getNextSort.d.ts +3 -0
- package/dist/types/components/mc-table-plus/utils/index.d.ts +1 -0
- package/dist/types/hooks/useProp.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/numberToPx.d.ts +2 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +4 -4
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +1 -1
- package/dist/es/mc-tab-Bpuz-FF0.js +0 -582
- package/dist/es/utils-CPLhakO-.js +0 -35
- package/dist/types/components/mc-table-plus/types/mc-table-body-cell.d.ts +0 -8
- package/dist/types/components/mc-table-plus/types/mc-table-content.d.ts +0 -4
- package/dist/types/components/mc-table-plus/types/mc-table-expand-cell.d.ts +0 -5
- package/dist/types/components/mc-table-plus/types/mc-table-header-cell.d.ts +0 -5
- package/dist/types/components/mc-table-plus/types/mc-table-header.d.ts +0 -4
- package/dist/types/components/mc-table-plus/types/mc-table-tr.d.ts +0 -3
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
import { defineComponent as e, ref as a, useSlots as l, watchEffect as t, Fragment as n, computed as o, onMounted as s, onUnmounted as i, watch as r, createElementBlock as c, openBlock as u, normalizeClass as d, createElementVNode as p, createCommentVNode as m, normalizeStyle as v, renderList as g, toDisplayString as h, createBlock as f, resolveDynamicComponent as b, h as y, renderSlot as w, createTextVNode as _, createVNode as x, unref as k, createSlots as C, withCtx as S, mergeProps as W, nextTick as I, toRefs as R, normalizeProps as E, guardReactiveProps as T, inject as D, reactive as $, getCurrentInstance as z, onBeforeUnmount as M, provide as P } from "vue";
|
|
2
|
+
import { m as N, f as L, D as B, y as A, F as H, v as V, i as O, C as F, a as j, G as K, t as X, c as U, H as G, I as q, x as J } from "./vendor-CExPGg1i.js";
|
|
3
|
+
import { _ as Q, w as Y, n as Z } from "./utils-BDbMLK9w.js";
|
|
4
|
+
import { a as ee } from "./mc-checkbox-iP5RHA6x.js";
|
|
5
|
+
import { M as ae, a as le } from "./mc-icon-B_dAlj4r.js";
|
|
6
|
+
import { left as te } from "@popperjs/core";
|
|
7
|
+
import { e as ne, c as oe, i as se, b as ie } from "./hooks-DghKpOue.js";
|
|
8
|
+
import { M as re } from "./mc-loading-C311OVMI.js";
|
|
9
|
+
const ce = ["onClick"], ue = { key: 0, class: "mc-tab-nav-item-count" }, de = { class: "mc-tab-actived-component-wrapper" }, pe = Q(e({ name: "McTab", __name: "mc-tab", props: { modelValue: {}, type: { default: "plain" }, wrapperPadding: { default: "0" } }, emits: ["update:modelValue", "change"], setup(e2, { expose: w2, emit: _2 }) {
|
|
10
|
+
const x2 = e2, k2 = _2, C2 = a(), S2 = a(), W2 = a(), I2 = a([]), R2 = l();
|
|
11
|
+
t(() => {
|
|
12
|
+
if (!R2.default) return void (I2.value = []);
|
|
13
|
+
let e3 = R2.default();
|
|
14
|
+
e3.length && e3[0].type === n && (e3 = [...Array.from(e3[0].children)]), I2.value = N(L(e3, (e4) => "McTabItem" === e4.type.name), (e4) => {
|
|
15
|
+
var _a2, _b, _c;
|
|
16
|
+
const a2 = e4.props;
|
|
17
|
+
return { _vnode: y("div", (_c = (_b = (_a2 = e4.children) == null ? void 0 : _a2.default) == null ? void 0 : _b.call(_a2)) == null ? void 0 : _c[0]), ...a2 };
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const E2 = o(() => B(I2.value, (e3) => e3.name === x2.modelValue)), T2 = o(() => "plain" === x2.type);
|
|
21
|
+
s(async () => {
|
|
22
|
+
D2(x2.modelValue), setTimeout(() => {
|
|
23
|
+
$2();
|
|
24
|
+
});
|
|
25
|
+
}), i(() => {
|
|
26
|
+
$2(false);
|
|
27
|
+
});
|
|
28
|
+
const D2 = (e3) => {
|
|
29
|
+
if (!T2.value) return;
|
|
30
|
+
const a2 = W2.value, l2 = S2.value, t2 = A(I2.value, (a3) => a3.name === e3);
|
|
31
|
+
if (t2 < 0) return void (a2.style.width = "0");
|
|
32
|
+
const n2 = Array.from(l2.children)[t2], { x: o2, width: s2 } = n2.getBoundingClientRect(), { x: i2 } = l2.getBoundingClientRect();
|
|
33
|
+
a2.style.width = `${s2}px`, a2.style.transform = `translateX(${o2 - i2}px)`;
|
|
34
|
+
}, $2 = (e3 = true) => {
|
|
35
|
+
const a2 = W2.value;
|
|
36
|
+
T2.value && a2 && (a2.style.transition = e3 ? "transform 0.3s ease-in-out" : "");
|
|
37
|
+
};
|
|
38
|
+
r(() => x2.modelValue, (e3) => {
|
|
39
|
+
D2(e3);
|
|
40
|
+
});
|
|
41
|
+
const z2 = o(() => {
|
|
42
|
+
var _a2;
|
|
43
|
+
return "string" == typeof x2.wrapperPadding ? x2.wrapperPadding : ((_a2 = x2.wrapperPadding) == null ? void 0 : _a2.left) ?? "0";
|
|
44
|
+
}), M2 = o(() => {
|
|
45
|
+
var _a2;
|
|
46
|
+
return "string" == typeof x2.wrapperPadding ? x2.wrapperPadding : ((_a2 = x2.wrapperPadding) == null ? void 0 : _a2.right) ?? "0";
|
|
47
|
+
});
|
|
48
|
+
return w2({ ref: C2 }), (e3, a2) => {
|
|
49
|
+
var _a2;
|
|
50
|
+
return u(), c("div", { class: d(["mc-tab", `mc-tab-${e3.type}`]), ref_key: "_ref", ref: C2 }, [p("div", { class: "mc-tab-nav", style: v({ paddingLeft: z2.value, paddingRight: M2.value }) }, [p("div", { class: "mc-tab-nav-wrapper", ref_key: "tabNavRef", ref: S2 }, [(u(true), c(n, null, g(I2.value, (a3) => (u(), c("div", { class: d(["mc-tab-nav-item", { "mc-tab-nav-item-active": a3.name === e3.modelValue, "mc-tab-nav-item-disabled": a3.disabled }]), key: a3.name, onClick: (e4) => ((e5) => {
|
|
51
|
+
e5.disabled || (k2("update:modelValue", e5.name), k2("change", e5.name));
|
|
52
|
+
})(a3) }, [p("span", null, h(a3.label), 1), a3.count ? (u(), c("span", ue, h(a3.count), 1)) : m("", true)], 10, ce))), 128))], 512), T2.value ? (u(), c("div", { key: 0, class: "mc-tab-line", ref_key: "tabLineRef", ref: W2 }, null, 512)) : m("", true)], 4), ((_a2 = E2.value) == null ? void 0 : _a2._vnode) ? (u(), c("div", { key: 0, class: "mc-tab-actived-component", style: v({ paddingLeft: z2.value, paddingRight: M2.value }) }, [p("div", de, [(u(), f(b(E2.value._vnode), { key: E2.value.name }))])], 4)) : m("", true)], 2);
|
|
53
|
+
};
|
|
54
|
+
} }), [["__scopeId", "data-v-e0d73bc5"]]), me = { class: "mc-tab-item" }, ve = e({ name: "McTabItem", __name: "mc-tab-item", props: { name: {}, label: {}, disabled: { type: Boolean }, count: {} }, setup: (e2) => (e3, a2) => (u(), c("div", me, [w(e3.$slots, "default")])) }), ge = Y(pe), he = Y(ve), fe = ["rowspan", "colspan"], be = Q(e({ __name: "mc-table-cell", props: { row: {}, column: {}, rowIndex: {}, columnIndex: {}, pagination: {}, spanMethod: { type: Function } }, setup(e2) {
|
|
55
|
+
const a2 = e2, l2 = o(() => a2.row[a2.column.prop]), t2 = o(() => {
|
|
56
|
+
const e3 = [a2.column.className];
|
|
57
|
+
if (a2.column.align && e3.push(`is-${a2.column.align}`), a2.column.fixed) {
|
|
58
|
+
const l4 = "boolean" == typeof a2.column.fixed ? "left" : a2.column.fixed;
|
|
59
|
+
e3.push(`is-fixed-${l4}`);
|
|
60
|
+
}
|
|
61
|
+
const l3 = 0 === v2.value ? "none" : "table-cell";
|
|
62
|
+
return e3.push(`is-display-${l3}`), e3;
|
|
63
|
+
}), s2 = () => {
|
|
64
|
+
var _a2, _b;
|
|
65
|
+
return ((_a2 = a2.pagination) == null ? void 0 : _a2.currentPage) && ((_b = a2.pagination) == null ? void 0 : _b.pageSize) ? (a2.pagination.currentPage - 1) * a2.pagination.pageSize + a2.rowIndex : a2.rowIndex;
|
|
66
|
+
}, i2 = () => {
|
|
67
|
+
if (!a2.spanMethod) return null;
|
|
68
|
+
const e3 = s2();
|
|
69
|
+
return a2.spanMethod({ row: a2.row, column: a2.column, rowIndex: e3, columnIndex: a2.columnIndex });
|
|
70
|
+
}, r2 = (e3, l3) => {
|
|
71
|
+
var _a2, _b;
|
|
72
|
+
if (!((_a2 = a2.pagination) == null ? void 0 : _a2.currentPage) || !((_b = a2.pagination) == null ? void 0 : _b.pageSize) || l3 <= 1) return true;
|
|
73
|
+
const t3 = (a2.pagination.currentPage - 1) * a2.pagination.pageSize, n2 = t3 + a2.pagination.pageSize - 1, o2 = e3;
|
|
74
|
+
return !(e3 + l3 - 1 < t3 || o2 > n2) && Math.max(o2, t3) === e3;
|
|
75
|
+
}, p2 = o(() => {
|
|
76
|
+
const e3 = i2();
|
|
77
|
+
if (e3) {
|
|
78
|
+
const l3 = s2();
|
|
79
|
+
let t3;
|
|
80
|
+
return t3 = Array.isArray(e3) ? e3[0] : e3.rowspan || 1, t3 > 1 ? r2(l3, t3) ? ((e4, l4) => {
|
|
81
|
+
var _a2, _b;
|
|
82
|
+
if (!((_a2 = a2.pagination) == null ? void 0 : _a2.currentPage) || !((_b = a2.pagination) == null ? void 0 : _b.pageSize) || l4 <= 1) return l4;
|
|
83
|
+
const t4 = (a2.pagination.currentPage - 1) * a2.pagination.pageSize, n2 = t4 + a2.pagination.pageSize - 1, o2 = e4, s3 = e4 + l4 - 1, i3 = Math.max(o2, t4);
|
|
84
|
+
return Math.min(s3, n2) - i3 + 1;
|
|
85
|
+
})(l3, t3) : 0 : t3;
|
|
86
|
+
}
|
|
87
|
+
if (a2.column.rowSpan) return "function" == typeof a2.column.rowSpan ? a2.column.rowSpan(a2.row, a2.column, a2.rowIndex) : a2.column.rowSpan;
|
|
88
|
+
}), v2 = o(() => {
|
|
89
|
+
const e3 = i2();
|
|
90
|
+
return e3 ? Array.isArray(e3) ? e3[1] : e3.colspan : a2.column.colSpan ? "function" == typeof a2.column.colSpan ? a2.column.colSpan(a2.row, a2.column, a2.rowIndex) : a2.column.colSpan : void 0;
|
|
91
|
+
}), g2 = o(() => {
|
|
92
|
+
const e3 = i2();
|
|
93
|
+
if (e3) {
|
|
94
|
+
const a3 = s2();
|
|
95
|
+
let l3, t3;
|
|
96
|
+
return Array.isArray(e3) ? (l3 = e3[0], t3 = e3[1]) : (l3 = e3.rowspan || 1, t3 = e3.colspan || 1), !(l3 > 1 && !r2(a3, l3) || 0 === l3 || 0 === t3);
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
});
|
|
100
|
+
return (e3, a3) => g2.value ? (u(), c("td", { key: 0, class: d(t2.value), rowspan: p2.value, colspan: v2.value }, [w(e3.$slots, "cell", { row: e3.row, column: e3.column, index: e3.rowIndex, value: l2.value, prop: e3.column.prop }, () => [w(e3.$slots, e3.column.slot || e3.column.prop, { row: e3.row, column: e3.column, index: e3.rowIndex, value: l2.value }, () => [e3.column.formatter ? (u(), c(n, { key: 0 }, [_(h(e3.column.formatter(e3.row, e3.column, l2.value, e3.rowIndex)), 1)], 64)) : (u(), c(n, { key: 1 }, [_(h(l2.value), 1)], 64))], true)], true)], 10, fe)) : m("", true);
|
|
101
|
+
} }), [["__scopeId", "data-v-810a226e"]]), ye = { class: "mc-table__body", cellspacing: "0", cellpadding: "0", border: "0" }, we = { key: 0, width: "50" }, _e = ["width"], xe = ["onClick"], ke = { key: 0, class: "mc-table__selection-column" }, Ce = { class: "mc-table__cell" }, Se = { key: 1 }, We = ["colspan"], Ie = { key: 1 }, Re = Q(e({ __name: "mc-table-body", props: { data: {}, columns: {}, rowKey: {}, emptyText: {}, height: {}, maxHeight: {}, pagination: {}, spanMethod: {}, getRowClass: {}, selectable: { type: Boolean, default: false }, selectedRows: {}, selectOnRowClick: { type: Boolean, default: false } }, emits: ["row-click", "select"], setup(e2, { expose: t2, emit: s2 }) {
|
|
102
|
+
const i2 = e2, r2 = l(), b2 = s2, y2 = a(), _2 = o(() => {
|
|
103
|
+
const e3 = {};
|
|
104
|
+
return i2.height && (e3.height = "number" == typeof i2.height ? `${i2.height}px` : i2.height), i2.maxHeight && (e3.maxHeight = "number" == typeof i2.maxHeight ? `${i2.maxHeight}px` : i2.maxHeight), e3;
|
|
105
|
+
}), I2 = o(() => i2.pagination), R2 = (e3, a2) => i2.rowKey ? e3[i2.rowKey] : a2, E2 = (e3, a2) => i2.getRowClass ? i2.getRowClass(e3, a2) : [], T2 = (e3) => !!i2.selectedRows && i2.selectedRows.some((a2) => i2.rowKey ? a2[i2.rowKey] === e3[i2.rowKey] : a2 === e3);
|
|
106
|
+
return t2({ bodyWrapper: y2 }), (e3, a2) => (u(), c("div", { class: "mc-table__body-wrapper", ref_key: "bodyWrapper", ref: y2, style: v(_2.value) }, [p("table", ye, [p("colgroup", null, [e3.selectable ? (u(), c("col", we)) : m("", true), (u(true), c(n, null, g(e3.columns, (e4, a3) => (u(), c("col", { key: a3, width: e4.width }, null, 8, _e))), 128))]), p("tbody", null, [e3.data && e3.data.length > 0 ? (u(true), c(n, { key: 0 }, g(e3.data, (a3, l2) => (u(), c("tr", { key: R2(a3, l2), class: d(E2(a3, l2)), onClick: (e4) => ((e5, a4) => {
|
|
107
|
+
b2("row-click", e5, a4);
|
|
108
|
+
})(a3, l2) }, [e3.selectable ? (u(), c("td", ke, [p("div", Ce, [x(k(ee), { "model-value": T2(a3), onChange: (e4) => ((e5, a4) => {
|
|
109
|
+
b2("select", e5, a4);
|
|
110
|
+
})(a3, e4) }, null, 8, ["model-value", "onChange"])])])) : m("", true), (u(true), c(n, null, g(e3.columns, (t3, n2) => (u(), f(be, { key: n2, row: a3, column: t3, "row-index": l2, "column-index": n2, "span-method": e3.spanMethod, pagination: I2.value }, C({ _: 2 }, [g(Object.keys(e3.$slots), (a4) => ({ name: a4, fn: S((l3) => [w(e3.$slots, a4, W({ ref_for: true }, l3), void 0, true)]) }))]), 1032, ["row", "column", "row-index", "column-index", "span-method", "pagination"]))), 128))], 10, xe))), 128)) : (u(), c("tr", Se, [p("td", { colspan: i2.selectable ? i2.columns.length + 1 : i2.columns.length, class: "mc-table__empty-cell" }, [k(r2).empty ? w(e3.$slots, "empty", { key: 0 }, void 0, true) : (u(), c("div", Ie, h(e3.emptyText), 1))], 8, We)]))])])], 4));
|
|
111
|
+
} }), [["__scopeId", "data-v-a687ab3a"]]), Ee = { class: "mc-table__header", cellspacing: "0", cellpadding: "0", border: "0" }, Te = { key: 0, width: "50" }, De = ["width"], $e = { key: 0, class: "mc-table__selection-column" }, ze = { class: "mc-table__header-cell" }, Me = ["onClick"], Pe = { class: "mc-table__header-label" }, Ne = { key: 0, class: "mc-table__sort-caret" }, Le = Q(e({ __name: "mc-table-header", props: { columns: {}, showHeader: { type: Boolean, default: true }, getSortOrder: { type: Function, default: () => null }, selectable: { type: Boolean, default: false }, isAllSelected: { type: Boolean, default: false }, isIndeterminate: { type: Boolean, default: false } }, emits: ["header-click", "sort-change", "select-all"], setup(e2, { expose: l2, emit: t2 }) {
|
|
112
|
+
const o2 = e2, s2 = t2, i2 = a(), r2 = (e3) => {
|
|
113
|
+
const a2 = [];
|
|
114
|
+
if (e3.headerClassName && a2.push(e3.headerClassName), e3.align && a2.push(`is-${e3.align}`), e3.fixed) {
|
|
115
|
+
const l4 = "boolean" == typeof e3.fixed ? "left" : e3.fixed;
|
|
116
|
+
a2.push(`is-fixed-${l4}`);
|
|
117
|
+
}
|
|
118
|
+
e3.sortable && a2.push("is-sortable");
|
|
119
|
+
const l3 = v2(e3.prop);
|
|
120
|
+
return l3 && a2.push(l3), a2;
|
|
121
|
+
}, v2 = (e3) => {
|
|
122
|
+
const a2 = o2.getSortOrder(e3);
|
|
123
|
+
return "asc" === a2 ? "is-sort-asc" : "desc" === a2 ? "is-sort-desc" : "";
|
|
124
|
+
}, b2 = (e3) => {
|
|
125
|
+
s2("select-all", e3);
|
|
126
|
+
};
|
|
127
|
+
return l2({ headerWrapper: i2 }), (e3, a2) => e3.showHeader ? (u(), c("div", { key: 0, class: "mc-table__header-wrapper", ref_key: "headerWrapper", ref: i2 }, [p("table", Ee, [p("colgroup", null, [e3.selectable ? (u(), c("col", Te)) : m("", true), (u(true), c(n, null, g(e3.columns, (e4, a3) => (u(), c("col", { key: a3, width: e4.width }, null, 8, De))), 128))]), p("thead", null, [p("tr", null, [e3.selectable ? (u(), c("th", $e, [p("div", ze, [x(k(ee), { "model-value": e3.isAllSelected, partial: e3.isIndeterminate, onChange: b2 }, null, 8, ["model-value", "partial"])])])) : m("", true), (u(true), c(n, null, g(e3.columns, (a3, l3) => (u(), c("th", { key: l3, class: d(r2(a3)), onClick: (e4) => ((e5, a4) => {
|
|
128
|
+
e5.sortable && s2("sort-change", e5), s2("header-click", e5, a4);
|
|
129
|
+
})(a3, e4) }, [p("div", { class: d(["mc-table__header-cell", `mc-table__header-cell-${a3.align}`]) }, [p("span", Pe, [w(e3.$slots, `header-${a3.slot || a3.prop}`, { column: a3, index: l3 }, () => [_(h(a3.label), 1)], true)]), a3.sortable ? (u(), c("span", Ne, ["asc" === e3.getSortOrder(a3.prop) ? (u(), f(ae, { key: 0, name: "Up-Chevron02", class: d(["mc-table__sort-icon", { "is-active": "asc" === e3.getSortOrder(a3.prop) }]) }, null, 8, ["class"])) : (u(), f(ae, { key: 1, name: "Down-Chevron02", class: d(["mc-table__sort-icon", { "is-active": "desc" === e3.getSortOrder(a3.prop) }]) }, null, 8, ["class"]))])) : m("", true)], 2)], 10, Me))), 128))])])])], 512)) : m("", true);
|
|
130
|
+
} }), [["__scopeId", "data-v-ba4ab5c6"]]), Be = { class: "mc-table__loading-content" }, Ae = { class: "mc-table__loading-spinner" }, He = { key: 0, class: "mc-table__spinner mc-table__spinner--default" }, Ve = { key: 1, class: "mc-table__spinner mc-table__spinner--circle" }, Oe = { key: 2, class: "mc-table__spinner mc-table__spinner--pulse" }, Fe = ["innerHTML"], je = { key: 0, class: "mc-table__loading-text" }, Ke = Q(e({ __name: "mc-table-loading", props: { loading: { type: Boolean, default: false }, loadingText: { default: "Loading..." }, loadingConfig: { default: () => ({ spinner: "default" }) } }, setup(e2) {
|
|
131
|
+
const a2 = e2, l2 = o(() => {
|
|
132
|
+
var _a2;
|
|
133
|
+
return ((_a2 = a2.loadingConfig) == null ? void 0 : _a2.text) || a2.loadingText;
|
|
134
|
+
}), t2 = o(() => {
|
|
135
|
+
var _a2;
|
|
136
|
+
const e3 = {};
|
|
137
|
+
return ((_a2 = a2.loadingConfig) == null ? void 0 : _a2.background) && (e3.backgroundColor = a2.loadingConfig.background), e3;
|
|
138
|
+
});
|
|
139
|
+
return (e3, a3) => {
|
|
140
|
+
var _a2;
|
|
141
|
+
return e3.loading ? (u(), c("div", { key: 0, class: d(["mc-table__loading-wrapper", ["mc-table__loading-wrapper", (_a2 = e3.loadingConfig) == null ? void 0 : _a2.customClass]]), style: v(t2.value) }, [p("div", Be, [w(e3.$slots, "loading", { loading: e3.loading, text: l2.value }, () => {
|
|
142
|
+
var _a3;
|
|
143
|
+
return [p("div", Ae, [((_a3 = e3.loadingConfig) == null ? void 0 : _a3.spinner) && "default" !== e3.loadingConfig.spinner ? "circle" === e3.loadingConfig.spinner ? (u(), c("div", Ve)) : "pulse" === e3.loadingConfig.spinner ? (u(), c("div", Oe)) : (u(), c("div", { key: 3, class: "mc-table__spinner mc-table__spinner--custom", innerHTML: e3.loadingConfig.spinner }, null, 8, Fe)) : (u(), c("div", He, a3[0] || (a3[0] = [p("div", { class: "mc-table__spinner-dot" }, null, -1), p("div", { class: "mc-table__spinner-dot" }, null, -1), p("div", { class: "mc-table__spinner-dot" }, null, -1), p("div", { class: "mc-table__spinner-dot" }, null, -1)])))]), l2.value ? (u(), c("div", je, h(l2.value), 1)) : m("", true)];
|
|
144
|
+
}, true)])], 6)) : m("", true);
|
|
145
|
+
};
|
|
146
|
+
} }), [["__scopeId", "data-v-f10577d2"]]), Xe = { key: 0, class: "mc-table__pagination" }, Ue = { class: "mc-table__pagination-info" }, Ge = { class: "mc-table__pagination-info-number" }, qe = { class: "mc-table__pagination-info-number" }, Je = { class: "mc-table__pagination-controls" }, Qe = ["onClick"], Ye = { key: 1, class: "mc-table__pagination-ellipsis" }, Ze = { class: "mc-table__pagination-size" }, ea = { class: "mc-table-pagination-size-group" }, aa = ["onClick"], la = Q(e({ __name: "mc-table-pagination", props: { pagination: {} }, emits: ["page-change"], setup(e2, { emit: l2 }) {
|
|
147
|
+
var _a2, _b, _c;
|
|
148
|
+
const t2 = e2, s2 = l2, i2 = a(((_a2 = t2.pagination) == null ? void 0 : _a2.currentPage) || 1), v2 = a(((_b = t2.pagination) == null ? void 0 : _b.pageSize) || 50), f2 = a(((_c = t2.pagination) == null ? void 0 : _c.pageSizes) || [25, 50, 75, 100]);
|
|
149
|
+
r(() => {
|
|
150
|
+
var _a3;
|
|
151
|
+
return (_a3 = t2.pagination) == null ? void 0 : _a3.currentPage;
|
|
152
|
+
}, (e3) => {
|
|
153
|
+
void 0 !== e3 && (i2.value = e3);
|
|
154
|
+
}), r(() => {
|
|
155
|
+
var _a3;
|
|
156
|
+
return (_a3 = t2.pagination) == null ? void 0 : _a3.pageSize;
|
|
157
|
+
}, (e3) => {
|
|
158
|
+
void 0 !== e3 && (v2.value = e3);
|
|
159
|
+
});
|
|
160
|
+
const b2 = o(() => t2.pagination ? Math.ceil(t2.pagination.total / v2.value) : 1), y2 = o(() => t2.pagination && 0 !== t2.pagination.total ? (i2.value - 1) * v2.value + 1 : 0), w2 = o(() => {
|
|
161
|
+
if (!t2.pagination) return 0;
|
|
162
|
+
const e3 = i2.value * v2.value;
|
|
163
|
+
return Math.min(e3, t2.pagination.total);
|
|
164
|
+
}), k2 = o(() => {
|
|
165
|
+
const e3 = b2.value, a2 = i2.value, l3 = [];
|
|
166
|
+
if (e3 <= 7) for (let a3 = 1; a3 <= e3; a3++) l3.push(a3);
|
|
167
|
+
else if (l3.push(1), a2 <= 4) {
|
|
168
|
+
for (let e4 = 2; e4 <= 5; e4++) l3.push(e4);
|
|
169
|
+
l3.push("..."), l3.push(e3);
|
|
170
|
+
} else if (a2 >= e3 - 3) {
|
|
171
|
+
l3.push("...");
|
|
172
|
+
for (let a3 = e3 - 4; a3 <= e3; a3++) l3.push(a3);
|
|
173
|
+
} else {
|
|
174
|
+
l3.push("...");
|
|
175
|
+
for (let e4 = a2 - 1; e4 <= a2 + 1; e4++) l3.push(e4);
|
|
176
|
+
l3.push("..."), l3.push(e3);
|
|
177
|
+
}
|
|
178
|
+
return l3;
|
|
179
|
+
}), C2 = (e3, a2) => {
|
|
180
|
+
e3 < 1 || e3 > b2.value || a2 || (i2.value = e3, s2("page-change", { pageSize: v2.value, pageNum: e3 }));
|
|
181
|
+
};
|
|
182
|
+
return (e3, a2) => e3.pagination ? (u(), c("div", Xe, [p("div", Ue, [a2[4] || (a2[4] = _(" Showing ")), p("span", Ge, h(y2.value) + "-" + h(w2.value), 1), a2[5] || (a2[5] = _(" of ")), p("span", qe, h(e3.pagination.total), 1)]), p("div", Je, [x(ae, { name: "First", class: d({ "mc-table__icon": true, "is-disabled": i2.value <= 1 }), size: 24, onClick: a2[0] || (a2[0] = (e4) => C2(1, i2.value <= 1)) }, null, 8, ["class"]), x(ae, { name: "Left-Chevron", class: d({ "mc-table__icon": true, "is-disabled": i2.value <= 1 }), size: 24, onClick: a2[1] || (a2[1] = (e4) => C2(i2.value - 1, i2.value <= 1)) }, null, 8, ["class"]), (u(true), c(n, null, g(k2.value, (e4) => (u(), c(n, { key: e4 }, ["..." !== e4 ? (u(), c("button", { key: 0, class: d(["mc-table__pagination-button mc-table__pagination-button--page", { "is-active": e4 === i2.value }]), onClick: (a3) => "number" == typeof e4 ? C2(e4, false) : void 0 }, h(e4), 11, Qe)) : (u(), c("span", Ye, "..."))], 64))), 128)), x(ae, { name: "Right-Chevron", class: d({ "mc-table__icon": true, "is-disabled": i2.value >= b2.value }), size: 24, onClick: a2[2] || (a2[2] = (e4) => C2(i2.value + 1, i2.value >= b2.value)) }, null, 8, ["class"]), x(ae, { name: "Last", class: d({ "mc-table__icon": true, "is-disabled": i2.value >= b2.value }), size: 24, onClick: a2[3] || (a2[3] = (e4) => C2(b2.value, i2.value >= b2.value)) }, null, 8, ["class"])]), p("div", Ze, [a2[6] || (a2[6] = p("label", { class: "mc-table__pagination-size-label" }, "View per page", -1)), p("div", ea, [(u(true), c(n, null, g(f2.value, (e4) => (u(), c("div", { class: d(["mc-table-pagination-size-group-item", { "is-active": e4 === v2.value }]), key: e4, onClick: (a3) => ((e5) => {
|
|
183
|
+
v2.value = e5, i2.value = 1, s2("page-change", { pageSize: v2.value, pageNum: 1 });
|
|
184
|
+
})(e4) }, h(e4), 11, aa))), 128))])])])) : m("", true);
|
|
185
|
+
} }), [["__scopeId", "data-v-7b991a4d"]]);
|
|
186
|
+
function ta(e2, l2, t2) {
|
|
187
|
+
var _a2, _b;
|
|
188
|
+
const n2 = a(((_a2 = l2.value) == null ? void 0 : _a2.currentPage) || 1), s2 = a(((_b = l2.value) == null ? void 0 : _b.pageSize) || 50);
|
|
189
|
+
r(() => {
|
|
190
|
+
var _a3;
|
|
191
|
+
return (_a3 = l2.value) == null ? void 0 : _a3.currentPage;
|
|
192
|
+
}, (e3) => {
|
|
193
|
+
void 0 !== e3 && (n2.value = e3);
|
|
194
|
+
}), r(() => {
|
|
195
|
+
var _a3;
|
|
196
|
+
return (_a3 = l2.value) == null ? void 0 : _a3.pageSize;
|
|
197
|
+
}, (e3) => {
|
|
198
|
+
void 0 !== e3 && (s2.value = e3);
|
|
199
|
+
});
|
|
200
|
+
const i2 = o(() => {
|
|
201
|
+
if (!l2.value) return e2.value;
|
|
202
|
+
const a2 = (n2.value - 1) * s2.value, o2 = a2 + s2.value;
|
|
203
|
+
return t2.value ? e2.value.slice(a2, o2) : e2.value;
|
|
204
|
+
}), c2 = o(() => {
|
|
205
|
+
if (!l2.value) return { currentPage: 1, pageSize: e2.value.length, total: e2.value.length, totalPages: 1 };
|
|
206
|
+
const a2 = l2.value.total, t3 = Math.ceil(a2 / s2.value);
|
|
207
|
+
return { currentPage: n2.value, pageSize: s2.value, total: a2, totalPages: t3 };
|
|
208
|
+
});
|
|
209
|
+
return { currentPage: n2, pageSize: s2, paginatedData: i2, paginationInfo: c2, updatePagination: function(e3) {
|
|
210
|
+
n2.value = e3.pageNum, s2.value = e3.pageSize;
|
|
211
|
+
} };
|
|
212
|
+
}
|
|
213
|
+
function na(e2, l2, t2) {
|
|
214
|
+
const n2 = a(false), i2 = a(null), r2 = o(() => n2.value ? e2.value : e2.value.map((e3) => ({ ...e3, fixed: void 0 })));
|
|
215
|
+
function c2() {
|
|
216
|
+
i2.value && (n2.value = i2.value.scrollWidth > i2.value.clientWidth);
|
|
217
|
+
}
|
|
218
|
+
function u2() {
|
|
219
|
+
var _a2, _b;
|
|
220
|
+
((_a2 = l2.value) == null ? void 0 : _a2.headerWrapper) && ((_b = t2.value) == null ? void 0 : _b.bodyWrapper) && (l2.value.headerWrapper.scrollLeft = t2.value.bodyWrapper.scrollLeft);
|
|
221
|
+
}
|
|
222
|
+
function d2() {
|
|
223
|
+
I(() => {
|
|
224
|
+
var _a2;
|
|
225
|
+
((_a2 = t2.value) == null ? void 0 : _a2.bodyWrapper) && (i2.value = t2.value.bodyWrapper, c2(), new ResizeObserver(() => {
|
|
226
|
+
c2();
|
|
227
|
+
}).observe(t2.value.bodyWrapper), window.addEventListener("resize", c2), t2.value.bodyWrapper.addEventListener("scroll", u2));
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return s(() => {
|
|
231
|
+
d2();
|
|
232
|
+
}), { hasHorizontalScroll: n2, columnsWithFixed: r2, checkHorizontalScroll: c2, syncHeaderScroll: u2, initScrollSync: d2 };
|
|
233
|
+
}
|
|
234
|
+
function oa(e2, l2, t2) {
|
|
235
|
+
const n2 = a(t2 || null);
|
|
236
|
+
return { sortedData: o(() => {
|
|
237
|
+
if (!n2.value || !n2.value.order) return e2.value;
|
|
238
|
+
const { prop: a2, order: t3 } = n2.value, o2 = l2.value.find((e3) => e3.prop === a2);
|
|
239
|
+
if (!o2) return e2.value;
|
|
240
|
+
const s2 = [...e2.value];
|
|
241
|
+
return s2.sort((e3, l3) => {
|
|
242
|
+
let n3 = e3[a2], s3 = l3[a2];
|
|
243
|
+
if (o2.sortMethod) {
|
|
244
|
+
const e4 = o2.sortMethod(n3, s3);
|
|
245
|
+
return "desc" === t3 ? -e4 : e4;
|
|
246
|
+
}
|
|
247
|
+
return null == n3 && (n3 = ""), null == s3 && (s3 = ""), "string" == typeof n3 && "string" == typeof s3 && (n3 = n3.toLowerCase(), s3 = s3.toLowerCase()), n3 < s3 ? "asc" === t3 ? -1 : 1 : n3 > s3 ? "asc" === t3 ? 1 : -1 : 0;
|
|
248
|
+
}), s2;
|
|
249
|
+
}), currentSort: n2, handleSort: function(e3) {
|
|
250
|
+
if (!e3.sortable) return;
|
|
251
|
+
const { prop: a2 } = e3;
|
|
252
|
+
let l3 = "asc";
|
|
253
|
+
return n2.value && n2.value.prop === a2 && (l3 = "asc" === n2.value.order ? "desc" : "desc" === n2.value.order ? null : "asc"), n2.value = null === l3 ? null : { prop: a2, order: l3 }, n2.value;
|
|
254
|
+
}, getSortOrder: function(e3) {
|
|
255
|
+
return n2.value && n2.value.prop === e3 ? n2.value.order : null;
|
|
256
|
+
} };
|
|
257
|
+
}
|
|
258
|
+
const sa = Y(Q(e({ name: "McTable", __name: "mc-table", props: { data: {}, columns: {}, showHeader: { type: Boolean, default: true }, height: {}, maxHeight: {}, rowKey: {}, emptyText: { default: "No Data" }, pagination: {}, loading: { type: Boolean, default: false }, loadingText: { default: "Loading..." }, loadingConfig: {}, highlightCurrentRow: { type: Boolean, default: false }, selectable: { type: Boolean, default: false }, selectedRows: {}, selectOnRowClick: { type: Boolean, default: false }, spanMethod: {}, isInitTableData: { type: Boolean, default: true }, initTableData: {}, isFrontPagination: { type: Boolean, default: false }, defaultSort: {} }, emits: ["row-click", "header-click", "page-change", "sort-change", "current-change", "selection-change", "select", "select-all", "update:selectedRows"], setup(e2, { expose: l2, emit: t2 }) {
|
|
259
|
+
const n2 = e2, { data: i2, columns: p2, pagination: v2, spanMethod: h2, loading: b2, loadingText: y2, loadingConfig: _2, defaultSort: W2, highlightCurrentRow: D2, rowKey: $2, selectable: z2, selectedRows: M2, selectOnRowClick: P2, isFrontPagination: N2 } = R(n2), L2 = a(i2.value), B2 = t2, A2 = a(), H2 = a(), V2 = a(), { columnsWithFixed: O2 } = na(p2, H2, V2), { sortedData: F2, handleSort: j2, getSortOrder: K2 } = oa(L2, O2, W2 == null ? void 0 : W2.value), { paginatedData: X2, updatePagination: U2 } = ta(F2, v2, N2), G2 = o(() => X2.value), { internalSelectedRows: q2, isAllSelected: J2, isIndeterminate: Q2, toggleRowSelection: Y2, toggleAllSelection: Z2, clearSelection: ee2, getSelectedRows: ae2 } = function(e3, l3, t3) {
|
|
260
|
+
const n3 = a((t3 == null ? void 0 : t3.value) || []);
|
|
261
|
+
r(t3, (e4) => {
|
|
262
|
+
e4 && (n3.value = [...e4]);
|
|
263
|
+
}, { deep: true, immediate: true });
|
|
264
|
+
const s2 = (e4) => n3.value.some((a2) => l3.value ? a2[l3.value] === e4[l3.value] : a2 === e4), i3 = () => e3.value.filter((e4) => s2(e4)).length, c2 = o(() => !!e3.value.length && e3.value.every((e4) => s2(e4))), u2 = o(() => {
|
|
265
|
+
if (!e3.value.length) return false;
|
|
266
|
+
const a2 = i3();
|
|
267
|
+
return a2 > 0 && a2 < e3.value.length;
|
|
268
|
+
});
|
|
269
|
+
return { internalSelectedRows: n3, isRowSelected: s2, isAllSelected: c2, isIndeterminate: u2, toggleRowSelection: (e4, a2) => {
|
|
270
|
+
const t4 = void 0 !== a2 ? a2 : !s2(e4);
|
|
271
|
+
if (t4) s2(e4) || n3.value.push(e4);
|
|
272
|
+
else {
|
|
273
|
+
const a3 = n3.value.findIndex((a4) => l3.value ? a4[l3.value] === e4[l3.value] : a4 === e4);
|
|
274
|
+
a3 > -1 && n3.value.splice(a3, 1);
|
|
275
|
+
}
|
|
276
|
+
return t4;
|
|
277
|
+
}, toggleAllSelection: (a2) => {
|
|
278
|
+
a2 ? e3.value.forEach((e4) => {
|
|
279
|
+
s2(e4) || n3.value.push(e4);
|
|
280
|
+
}) : e3.value.forEach((e4) => {
|
|
281
|
+
const a3 = n3.value.findIndex((a4) => l3.value ? a4[l3.value] === e4[l3.value] : a4 === e4);
|
|
282
|
+
a3 > -1 && n3.value.splice(a3, 1);
|
|
283
|
+
});
|
|
284
|
+
}, clearSelection: () => {
|
|
285
|
+
n3.value = [];
|
|
286
|
+
}, getSelectedRows: () => [...n3.value], getCurrentPageSelectionInfo: () => {
|
|
287
|
+
const a2 = e3.value.length, l4 = i3();
|
|
288
|
+
return { totalCount: a2, selectedCount: l4, isAllSelected: a2 > 0 && l4 === a2, isIndeterminate: l4 > 0 && l4 < a2 };
|
|
289
|
+
} };
|
|
290
|
+
}(G2, $2, M2), { setCurrentRow: le2, getRowClass: te2 } = function(e3) {
|
|
291
|
+
const l3 = a(null);
|
|
292
|
+
return { currentRow: l3, setCurrentRow: (e4) => (l3.value = e4, l3.value), getRowClass: (a2) => {
|
|
293
|
+
const t3 = [];
|
|
294
|
+
return e3.value && l3.value === a2 && t3.push("is-current"), t3;
|
|
295
|
+
}, clearCurrentRow: () => {
|
|
296
|
+
l3.value = null;
|
|
297
|
+
} };
|
|
298
|
+
}(D2);
|
|
299
|
+
r(() => i2.value, (e3) => {
|
|
300
|
+
L2.value = e3;
|
|
301
|
+
}, { deep: true, immediate: true });
|
|
302
|
+
const ne2 = (e3, a2) => {
|
|
303
|
+
if (D2.value) {
|
|
304
|
+
const a3 = le2(e3);
|
|
305
|
+
B2("current-change", a3);
|
|
306
|
+
}
|
|
307
|
+
if (z2.value && P2.value) {
|
|
308
|
+
const a3 = Y2(e3);
|
|
309
|
+
ue2(e3, a3);
|
|
310
|
+
}
|
|
311
|
+
B2("row-click", e3, a2);
|
|
312
|
+
}, oe2 = (e3, a2) => {
|
|
313
|
+
B2("header-click", e3, a2);
|
|
314
|
+
}, se2 = (e3) => {
|
|
315
|
+
const a2 = j2(e3);
|
|
316
|
+
a2 && B2("sort-change", a2);
|
|
317
|
+
}, ie2 = (e3, a2) => {
|
|
318
|
+
const l3 = Y2(e3, a2);
|
|
319
|
+
ue2(e3, l3);
|
|
320
|
+
}, re2 = (e3) => {
|
|
321
|
+
Z2(e3), ue2(null, e3);
|
|
322
|
+
}, ce2 = async (e3) => {
|
|
323
|
+
U2(e3), I(() => {
|
|
324
|
+
var _a2;
|
|
325
|
+
((_a2 = V2.value) == null ? void 0 : _a2.bodyWrapper) && (V2.value.bodyWrapper.scrollTop = 0);
|
|
326
|
+
}), B2("page-change", e3), await de2();
|
|
327
|
+
}, ue2 = (e3, a2) => {
|
|
328
|
+
B2("update:selectedRows", [...q2.value]), B2("selection-change", [...q2.value]), e3 ? B2("select", e3, a2) : B2("select-all", a2);
|
|
329
|
+
}, de2 = async () => {
|
|
330
|
+
if (n2.isInitTableData && n2.initTableData && "function" == typeof n2.initTableData) {
|
|
331
|
+
const { data: e3, total: a2 } = await n2.initTableData({ pageSize: v2.value.pageSize || 10, pageNum: v2.value.currentPage || 1 });
|
|
332
|
+
L2.value = e3, v2.value.total = a2;
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
return s(() => {
|
|
336
|
+
de2();
|
|
337
|
+
}), l2({ ref: A2, clearSort: () => {
|
|
338
|
+
p2.value.forEach((e3) => {
|
|
339
|
+
e3.sortable && (e3.sortOrder = null);
|
|
340
|
+
});
|
|
341
|
+
}, toggleRowSelection: (e3, a2) => {
|
|
342
|
+
const l3 = Y2(e3, a2);
|
|
343
|
+
ue2(e3, l3);
|
|
344
|
+
}, refresh: async () => {
|
|
345
|
+
v2.value.currentPage = 1, await de2();
|
|
346
|
+
}, toggleAllSelection: (e3) => {
|
|
347
|
+
Z2(e3), ue2(null, e3);
|
|
348
|
+
}, clearSelection: () => {
|
|
349
|
+
ee2(), B2("update:selectedRows", []), B2("selection-change", []);
|
|
350
|
+
}, getSelectedRows: ae2 }), (e3, a2) => {
|
|
351
|
+
var _a2;
|
|
352
|
+
return u(), c("div", { ref_key: "_ref", ref: A2, class: d(["mc-table", { "mc-table--loading": k(b2) }]) }, [x(Le, { ref_key: "headerRef", ref: H2, columns: k(O2), "show-header": e3.showHeader, "get-sort-order": k(K2), selectable: k(z2), "is-all-selected": k(J2), "is-indeterminate": k(Q2), onHeaderClick: oe2, onSortChange: se2, onSelectAll: re2 }, C({ _: 2 }, [g(Object.keys(e3.$slots), (a3) => ({ name: a3, fn: S((l3) => [w(e3.$slots, a3, E(T(l3)), void 0, true)]) }))]), 1032, ["columns", "show-header", "get-sort-order", "selectable", "is-all-selected", "is-indeterminate"]), x(Re, { ref_key: "bodyRef", ref: V2, data: G2.value, columns: k(O2), "row-key": k($2), "empty-text": e3.emptyText, height: e3.height, "max-height": e3.maxHeight, "span-method": k(h2), pagination: k(v2), "get-row-class": k(te2), selectable: k(z2), "selected-rows": k(q2), "select-on-row-click": k(P2), onRowClick: ne2, onSelect: ie2 }, C({ _: 2 }, [g(Object.keys(e3.$slots), (a3) => ({ name: a3, fn: S((l3) => [w(e3.$slots, a3, E(T(l3)), void 0, true)]) }))]), 1032, ["data", "columns", "row-key", "empty-text", "height", "max-height", "span-method", "pagination", "get-row-class", "selectable", "selected-rows", "select-on-row-click"]), k(v2) && ((_a2 = k(v2)) == null ? void 0 : _a2.total) > 0 ? (u(), f(la, { key: 0, pagination: k(v2), onPageChange: ce2 }, null, 8, ["pagination"])) : m("", true), x(Ke, { class: "mc-table__loading", loading: k(b2), "loading-text": k(y2), "loading-config": k(_2) }, { loading: S((a3) => [w(e3.$slots, "loading", E(T(a3)), void 0, true)]), _: 3 }, 8, ["loading", "loading-text", "loading-config"])], 2);
|
|
353
|
+
};
|
|
354
|
+
} }), [["__scopeId", "data-v-81fc6f47"]])), ia = "McTableColumnPlus", ra = Symbol("McTableContext"), ca = () => {
|
|
355
|
+
const e2 = D(ra, void 0);
|
|
356
|
+
return { tableCtx: e2, data: e2.data, tableWidth: e2.tableWidth, isLoading: o(() => !!e2.isLoading.value), columnWidth: e2.columnWidth, leftColumns: e2.leftColumns, rightColumns: e2.rightColumns, centerColumns: e2.centerColumns, scroll: e2.scroll, setScroll: e2.setScroll, pagination: e2.pagination, handlePagination: e2.handlePagination, doSort: e2.handleSort, isExpanded: e2.isExpanded, getExpandData: e2.getExpandData, setExpandData: e2.setExpandData, removeExpandData: e2.removeExpandData, getCurrentSort: e2.getCurrentSort, expandCondition: e2.expandCondition, fetchExpandData: e2.fetchExpandData, leftWidth: e2.leftWidth, rightWidth: e2.rightWidth, centerWidth: e2.centerWidth, viewWidth: e2.viewWidth };
|
|
357
|
+
}, ua = { pageNum: 1, pageSize: 25, total: 1, pageSizes: [25, 50, 75, 100] }, da = (e2 = te) => {
|
|
358
|
+
switch (e2) {
|
|
359
|
+
case "left":
|
|
360
|
+
return "flex-start";
|
|
361
|
+
case "center":
|
|
362
|
+
return "center";
|
|
363
|
+
case "right":
|
|
364
|
+
return "flex-end";
|
|
365
|
+
}
|
|
366
|
+
}, pa = { key: 0, class: "mc-table-row-tr mc-table-row-left" }, ma = { class: "mc-table-row-center-content" }, va = { key: 3, class: "mc-table-row-tr mc-table-row-right" }, ga = Q(e({ name: "McTableRow", __name: "mc-table-row", props: { type: { default: "body" }, leftColumns: { default: () => [] }, rightColumns: { default: () => [] }, centerColumns: { default: () => [] } }, setup(e2) {
|
|
367
|
+
const l2 = e2, t2 = a(), { scroll: n2, setScroll: i2, leftWidth: g2, rightWidth: h2, centerWidth: f2, viewWidth: b2 } = ca();
|
|
368
|
+
s(() => {
|
|
369
|
+
x2(n2.value);
|
|
370
|
+
}), r(() => n2.value, (e3) => {
|
|
371
|
+
x2(e3);
|
|
372
|
+
});
|
|
373
|
+
const y2 = o(() => l2.rightColumns.length > 0 && n2.value > 0), _2 = o(() => {
|
|
374
|
+
const e3 = q(b2.value) + q(n2.value) + 5 < q(f2.value);
|
|
375
|
+
return l2.leftColumns.length > 0 && e3;
|
|
376
|
+
}), x2 = (e3) => {
|
|
377
|
+
t2.value && t2.value.scrollTo({ left: e3 });
|
|
378
|
+
};
|
|
379
|
+
return se(t2, "scroll", (e3) => {
|
|
380
|
+
const a2 = e3.target.scrollLeft || 0;
|
|
381
|
+
i2(a2);
|
|
382
|
+
}), (e3, a2) => (u(), c("div", { class: d(["mc-table-row", [`mc-table-row-${e3.type}`]]) }, [e3.leftColumns.length ? (u(), c("tr", pa, [w(e3.$slots, "left", { columns: e3.leftColumns }, void 0, true)])) : m("", true), y2.value ? (u(), c("div", { key: 1, class: "mc-table-border mc-table-row-left-border", style: v({ left: k(Z)(k(g2)) }) }, null, 4)) : m("", true), p("div", { ref_key: "rowRef", ref: t2, class: "mc-table-row-tr mc-table-row-center" }, [p("div", ma, [w(e3.$slots, "default", { columns: e3.centerColumns }, void 0, true)])], 512), _2.value ? (u(), c("div", { key: 2, class: "mc-table-border mc-table-row-right-border", style: v({ right: k(Z)(k(h2)) }) }, null, 4)) : m("", true), e3.rightColumns.length ? (u(), c("tr", va, [w(e3.$slots, "right", { columns: e3.rightColumns }, void 0, true)])) : m("", true)], 2));
|
|
383
|
+
} }), [["__scopeId", "data-v-066bac3c"]]), ha = Q(e({ name: "McTableSort", __name: "mc-table-sort", props: { sort: { default: "normal" } }, setup: (e2) => (e3, a2) => (u(), c("div", { class: d(["mc-table-sort", `mc-table-sort-${e3.sort}`]) }, [x(ae, { name: "Up-Chevron02", class: d({ "mc-table-sort-actived": "asc" === e3.sort }), style: { height: "8px" } }, null, 8, ["class"]), x(ae, { name: "Down-Chevron02", class: d({ "mc-table-sort-actived": "desc" === e3.sort }), style: { height: "8px" } }, null, 8, ["class"])], 2)) }), [["__scopeId", "data-v-d4c78979"]]), fa = { class: "mc-table-header-cell-title" }, ba = { class: "mc-table-header-cell-title-text" }, ya = { key: 0, class: "mc-table-header-cell-sort" }, wa = { class: "mc-table-header-cell-desc" }, _a = { class: "mc-table-body-cell-value" }, xa = Q(e({ name: "McTableCell", __name: "mc-table-cell", props: { column: {}, width: {}, type: { default: "body" }, row: {}, rowIndex: {} }, setup(e2) {
|
|
384
|
+
const l2 = a(), { isHeader: t2, isExpand: n2, isExpandIcon: s2, cellStyle: i2, headerCtx: r2, bodyCtx: g2, expandIconCtx: b2 } = ((e3) => {
|
|
385
|
+
var _a2;
|
|
386
|
+
const { columnWidth: a2, doSort: l3, isExpanded: t3, setExpandData: n3, removeExpandData: s3, getCurrentSort: i3, expandCondition: r3, fetchExpandData: c2 } = ca(), u2 = ne("column"), d2 = ne("type"), p2 = ne("width"), m2 = o(() => "header" === d2.value), v2 = o(() => "body" === d2.value), g3 = o(() => "expand" === d2.value), h2 = o(() => "expand-icon" === d2.value), f2 = o(() => {
|
|
387
|
+
var _a3, _b;
|
|
388
|
+
const e4 = p2.value ? `${p2.value}px` : (a2 == null ? void 0 : a2.value) ? `${a2.value}px` : "auto";
|
|
389
|
+
let l4 = "default";
|
|
390
|
+
return m2.value && ((_a3 = u2 == null ? void 0 : u2.value) == null ? void 0 : _a3.sortable) && (l4 = "pointer"), { width: e4, cursor: l4, alignItems: h2.value ? "center" : da((_b = u2 == null ? void 0 : u2.value) == null ? void 0 : _b.columnAlign) };
|
|
391
|
+
});
|
|
392
|
+
let b3 = {}, y2 = {}, w2 = {};
|
|
393
|
+
if (m2.value) {
|
|
394
|
+
const a3 = o(() => {
|
|
395
|
+
var _a3;
|
|
396
|
+
return j(i3) ? i3(((_a3 = u2 == null ? void 0 : u2.value) == null ? void 0 : _a3.prop) || "") : "normal";
|
|
397
|
+
});
|
|
398
|
+
if ((_a2 = u2 == null ? void 0 : u2.value) == null ? void 0 : _a2.sortable) {
|
|
399
|
+
const t4 = X(() => {
|
|
400
|
+
var _a3;
|
|
401
|
+
l3(((_a3 = u2 == null ? void 0 : u2.value) == null ? void 0 : _a3.prop) || "", ((e4) => {
|
|
402
|
+
switch (e4) {
|
|
403
|
+
case "normal":
|
|
404
|
+
return "desc";
|
|
405
|
+
case "desc":
|
|
406
|
+
return "asc";
|
|
407
|
+
default:
|
|
408
|
+
return "normal";
|
|
409
|
+
}
|
|
410
|
+
})(a3.value));
|
|
411
|
+
}, 500);
|
|
412
|
+
se(e3, "click", t4);
|
|
413
|
+
}
|
|
414
|
+
b3 = { currentSort: a3 };
|
|
415
|
+
} else if (h2.value) {
|
|
416
|
+
const a3 = ne("row"), l4 = ne("rowIndex"), i4 = o(() => !j(r3) || k(r3(a3 == null ? void 0 : a3.value))), u3 = o(() => {
|
|
417
|
+
const e4 = l4 == null ? void 0 : l4.value;
|
|
418
|
+
return !U(e4) && t3(e4);
|
|
419
|
+
});
|
|
420
|
+
if (i4.value) {
|
|
421
|
+
const t4 = X(async () => {
|
|
422
|
+
if (U(l4 == null ? void 0 : l4.value)) return;
|
|
423
|
+
let e4 = [];
|
|
424
|
+
j(c2) && !u3.value ? (e4 = k(await c2(a3 == null ? void 0 : a3.value)), n3(l4.value, e4)) : s3(l4.value);
|
|
425
|
+
}, 500);
|
|
426
|
+
se(e3, "click", t4);
|
|
427
|
+
}
|
|
428
|
+
w2 = { allowExpand: i4, isExpanded: u3 };
|
|
429
|
+
} else if (v2.value) {
|
|
430
|
+
const e4 = ne("row");
|
|
431
|
+
y2 = { displayValue: o(() => {
|
|
432
|
+
var _a3, _b;
|
|
433
|
+
const a3 = ((_a3 = u2 == null ? void 0 : u2.value) == null ? void 0 : _a3.defaultValue) || "--", l4 = (_b = u2 == null ? void 0 : u2.value) == null ? void 0 : _b.prop;
|
|
434
|
+
return U(l4) || U(e4 == null ? void 0 : e4.value) || U(e4.value[l4]) ? a3 : e4.value[l4];
|
|
435
|
+
}) };
|
|
436
|
+
}
|
|
437
|
+
return { isHeader: m2, isBody: v2, isExpand: g3, isExpandIcon: h2, cellStyle: f2, headerCtx: b3, bodyCtx: y2, expandIconCtx: w2 };
|
|
438
|
+
})(l2);
|
|
439
|
+
return (e3, a2) => k(t2) ? (u(), c("th", { key: 0, ref_key: "cellRef", ref: l2, class: d(`mc-table-${e3.type}-cell`), style: v(k(i2)) }, [w(e3.$slots, "header", {}, () => {
|
|
440
|
+
var _a2;
|
|
441
|
+
return [p("div", fa, [p("div", ba, [w(e3.$slots, "title", {}, () => [_(h(e3.column.label), 1)], true)]), e3.column.sortable ? (u(), c("div", ya, [x(ha, { sort: (_a2 = k(r2).currentSort) == null ? void 0 : _a2.value }, null, 8, ["sort"])])) : m("", true)]), e3.column.desc || e3.$slots.desc ? w(e3.$slots, "desc", { key: 0 }, () => [p("div", wa, h(e3.column.desc), 1)], true) : m("", true)];
|
|
442
|
+
}, true)], 6)) : k(n2) ? (u(), c("td", { key: 1, ref_key: "cellRef", ref: l2, class: d(`mc-table-${e3.type}-cell`), style: v(k(i2)) }, [w(e3.$slots, "default", {}, void 0, true)], 6)) : k(s2) ? (u(), c("td", { key: 2, ref_key: "cellRef", ref: l2, class: d(`mc-table-${e3.type}-cell`), style: v(k(i2)) }, [w(e3.$slots, "default", {}, () => {
|
|
443
|
+
var _a2, _b, _c;
|
|
444
|
+
return [((_a2 = k(b2).allowExpand) == null ? void 0 : _a2.value) ? (u(), f(le, { key: 0, class: d(["mc-table-expand-icon", { "mc-table-expand-icon-active": (_b = k(b2).isExpanded) == null ? void 0 : _b.value }]), cursor: ((_c = k(b2).allowExpand) == null ? void 0 : _c.value) ? "pointer" : "default", name: "down-chevron" }, null, 8, ["class", "cursor"])) : m("", true)];
|
|
445
|
+
}, true)], 6)) : (u(), c("td", { key: 3, ref_key: "cellRef", ref: l2, class: d(`mc-table-${e3.type}-cell`), style: v(k(i2)) }, [w(e3.$slots, "default", {}, () => {
|
|
446
|
+
var _a2;
|
|
447
|
+
return [p("span", _a, h((_a2 = k(g2).displayValue) == null ? void 0 : _a2.value), 1)];
|
|
448
|
+
}, true)], 6));
|
|
449
|
+
} }), [["__scopeId", "data-v-63834da7"]]), ka = { class: "mc-table-header" }, Ca = { class: "mc-table-header-thead" }, Sa = Q(e({ name: "McTableHeader", __name: "mc-table-header", setup(e2) {
|
|
450
|
+
const { leftColumns: a2, rightColumns: l2, centerColumns: t2 } = ca();
|
|
451
|
+
return (e3, o2) => (u(), c("table", ka, [p("thead", Ca, [x(ga, { type: "header", "left-columns": k(a2), "right-columns": k(l2), "center-columns": k(t2) }, { left: S(({ columns: e4 }) => [(u(true), c(n, null, g(e4, (e5) => (u(), f(xa, { key: e5.prop, column: e5, width: e5.width, type: "header" }, C({ _: 2 }, [e5.header ? { name: "header", fn: S(() => [(u(), f(b(e5.header)))]), key: "0" } : void 0, e5.headerTitle ? { name: "title", fn: S(() => [(u(), f(b(e5.headerTitle)))]), key: "1" } : void 0, e5.headerDesc ? { name: "desc", fn: S(() => [(u(), f(b(e5.headerDesc)))]), key: "2" } : void 0]), 1032, ["column", "width"]))), 128))]), default: S(({ columns: e4 }) => [(u(true), c(n, null, g(e4, (e5) => (u(), f(xa, { key: e5.prop, column: e5, width: e5.width, type: "header" }, C({ _: 2 }, [e5.header ? { name: "header", fn: S(() => [(u(), f(b(e5.header)))]), key: "0" } : void 0, e5.headerTitle ? { name: "title", fn: S(() => [(u(), f(b(e5.headerTitle)))]), key: "1" } : void 0, e5.headerDesc ? { name: "desc", fn: S(() => [(u(), f(b(e5.headerDesc)))]), key: "2" } : void 0]), 1032, ["column", "width"]))), 128))]), right: S(({ columns: e4 }) => [(u(true), c(n, null, g(e4, (e5) => (u(), f(xa, { key: e5.prop, column: e5, width: e5.width, type: "header" }, C({ _: 2 }, [e5.header ? { name: "header", fn: S(() => [(u(), f(b(e5.header)))]), key: "0" } : void 0, e5.headerTitle ? { name: "title", fn: S(() => [(u(), f(b(e5.headerTitle)))]), key: "1" } : void 0, e5.headerDesc ? { name: "desc", fn: S(() => [(u(), f(b(e5.headerDesc)))]), key: "2" } : void 0]), 1032, ["column", "width"]))), 128))]), _: 1 }, 8, ["left-columns", "right-columns", "center-columns"])])]));
|
|
452
|
+
} }), [["__scopeId", "data-v-e6a8a142"]]), Wa = { key: 0, class: "mc-table-total" }, Ia = { class: "mc-table-total-number" }, Ra = { class: "mc-table-total-number" }, Ea = Q(e({ name: "McTableTotal", __name: "mc-table-total", setup(e2) {
|
|
453
|
+
const { pagination: a2 } = ca(), l2 = o(() => {
|
|
454
|
+
if (!a2) return;
|
|
455
|
+
const { pageNum: e3, pageSize: l3, total: t2 } = a2;
|
|
456
|
+
return { range: `${(e3 - 1) * l3 + 1}-${Math.min(e3 * l3, t2)}`, total: t2 };
|
|
457
|
+
});
|
|
458
|
+
return (e3, a3) => l2.value ? (u(), c("div", Wa, [a3[0] || (a3[0] = p("span", null, "Showing", -1)), p("span", Ia, h(l2.value.range), 1), a3[1] || (a3[1] = p("span", null, "of", -1)), p("span", Ra, h(l2.value.total), 1)])) : m("", true);
|
|
459
|
+
} }), [["__scopeId", "data-v-9f0c3c47"]]), Ta = { class: "mc-table-ellipsis" }, Da = Q(e({ name: "McTableEllipsis", __name: "mc-table-ellipsis", setup: (e2) => (e3, a2) => (u(), c("div", Ta, a2[0] || (a2[0] = [p("i", { class: "mc-table-ellipsis-dot" }, null, -1), p("i", { class: "mc-table-ellipsis-dot" }, null, -1), p("i", { class: "mc-table-ellipsis-dot" }, null, -1)]))) }), [["__scopeId", "data-v-348fd3b0"]]), $a = Q(e({ name: "McTablePaginationItem", __name: "mc-table-pagination-item", props: { type: { default: "page" }, value: { default: 1 }, isActive: { type: Boolean, default: false }, isDisabled: { type: Boolean, default: false } }, setup(e2) {
|
|
460
|
+
const a2 = e2, l2 = o(() => {
|
|
461
|
+
switch (a2.type) {
|
|
462
|
+
case "page":
|
|
463
|
+
return "mc-table-pagination-item-page";
|
|
464
|
+
case "prev":
|
|
465
|
+
return "mc-table-pagination-item-prev";
|
|
466
|
+
case "next":
|
|
467
|
+
return "mc-table-pagination-item-next";
|
|
468
|
+
case "first":
|
|
469
|
+
return "mc-table-pagination-item-first";
|
|
470
|
+
case "last":
|
|
471
|
+
return "mc-table-pagination-item-last";
|
|
472
|
+
case "ellipsis":
|
|
473
|
+
return "mc-table-pagination-item-ellipsis";
|
|
474
|
+
default:
|
|
475
|
+
return "mc-table-pagination-item";
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
return (e3, a3) => (u(), c("li", { class: d(["mc-table-pagination-item", [{ "mc-table-pagination-item-active": e3.isActive, "mc-table-pagination-item-disabled": e3.isDisabled }, l2.value]]) }, ["page" === e3.type ? (u(), c(n, { key: 0 }, [_(h(e3.value), 1)], 64)) : "prev" === e3.type ? (u(), f(ae, { key: 1, name: "Left-Chevron" })) : "next" === e3.type ? (u(), f(ae, { key: 2, name: "Right-Chevron" })) : "first" === e3.type ? (u(), f(ae, { key: 3, name: "First" })) : "last" === e3.type ? (u(), f(ae, { key: 4, name: "Last" })) : "ellipsis" === e3.type ? (u(), f(Da, { key: 5 })) : m("", true)], 2));
|
|
479
|
+
} }), [["__scopeId", "data-v-8fca232d"]]), za = { key: 0, class: "mc-table-pagination" }, Ma = Q(e({ name: "McTablePagination", __name: "mc-table-pagination", setup(e2) {
|
|
480
|
+
const { pagination: a2, isLoading: l2, handlePagination: t2 } = ca(), s2 = o(() => a2 ? Math.ceil(a2.total / a2.pageSize) : 0), i2 = o(() => {
|
|
481
|
+
if (!a2 || s2.value <= 1) return [];
|
|
482
|
+
const e3 = [];
|
|
483
|
+
if (s2.value <= 5) for (let a3 = 2; a3 < s2.value; a3++) e3.push(a3);
|
|
484
|
+
else a2.pageNum <= 2 ? e3.push(2, 3, 4, 5) : a2.pageNum >= s2.value - 1 ? e3.push(s2.value - 4, s2.value - 3, s2.value - 2, s2.value - 1) : e3.push(a2.pageNum - 1, a2.pageNum, a2.pageNum + 1);
|
|
485
|
+
return e3;
|
|
486
|
+
}), r2 = o(() => !a2 || a2.pageNum <= 1), d2 = o(() => !a2 || a2.pageNum >= s2.value), p2 = o(() => !a2 || s2.value <= 1), v2 = o(() => !!a2 && s2.value > 5 && a2.pageNum > 2), h2 = o(() => !!a2 && s2.value > 5 && a2.pageNum < s2.value - 1), b2 = (e3) => {
|
|
487
|
+
j(t2) && !l2.value && ("first" === e3 ? r2.value || t2({ pageNum: 1 }) : "prev" === e3 ? a2 && a2.pageNum > 1 && !r2.value && t2({ pageNum: a2.pageNum - 1 }) : "next" === e3 ? a2 && a2.pageNum < s2.value && !d2.value && t2({ pageNum: a2.pageNum + 1 }) : "last" === e3 ? d2.value || t2({ pageNum: s2.value }) : e3 !== (a2 == null ? void 0 : a2.pageNum) && t2({ pageNum: e3 }));
|
|
488
|
+
};
|
|
489
|
+
return (e3, l3) => {
|
|
490
|
+
var _a2, _b;
|
|
491
|
+
return p2.value ? m("", true) : (u(), c("ul", za, [x($a, { type: "first", "is-disabled": r2.value, onClick: l3[0] || (l3[0] = (e4) => b2("first")) }, null, 8, ["is-disabled"]), x($a, { type: "prev", "is-disabled": r2.value, onClick: l3[1] || (l3[1] = (e4) => b2("prev")) }, null, 8, ["is-disabled"]), x($a, { value: 1, "is-active": 1 === ((_a2 = k(a2)) == null ? void 0 : _a2.pageNum), onClick: l3[2] || (l3[2] = (e4) => b2(1)) }, null, 8, ["is-active"]), v2.value ? (u(), f($a, { key: 0, type: "ellipsis" })) : m("", true), (u(true), c(n, null, g(i2.value, (e4) => {
|
|
492
|
+
var _a3;
|
|
493
|
+
return u(), f($a, { key: e4, value: e4, "is-active": ((_a3 = k(a2)) == null ? void 0 : _a3.pageNum) === e4, onClick: (a3) => b2(e4) }, null, 8, ["value", "is-active", "onClick"]);
|
|
494
|
+
}), 128)), h2.value ? (u(), f($a, { key: 1, type: "ellipsis" })) : m("", true), x($a, { value: s2.value, "is-active": ((_b = k(a2)) == null ? void 0 : _b.pageNum) === s2.value, onClick: l3[3] || (l3[3] = (e4) => b2(s2.value)) }, null, 8, ["value", "is-active"]), x($a, { type: "next", "is-disabled": d2.value, onClick: l3[4] || (l3[4] = (e4) => b2("next")) }, null, 8, ["is-disabled"]), x($a, { type: "last", "is-disabled": d2.value, onClick: l3[5] || (l3[5] = (e4) => b2("last")) }, null, 8, ["is-disabled"])]));
|
|
495
|
+
};
|
|
496
|
+
} }), [["__scopeId", "data-v-1b005248"]]), Pa = { class: "mc-table-page-size" }, Na = { class: "mc-table-page-size-group" }, La = ["onClick"], Ba = Q(e({ name: "McPageSize", __name: "mc-table-page-size", setup(e2) {
|
|
497
|
+
const { pagination: a2, isLoading: l2, handlePagination: t2 } = ca();
|
|
498
|
+
return (e3, o2) => {
|
|
499
|
+
var _a2;
|
|
500
|
+
return u(), c("div", Pa, [o2[0] || (o2[0] = p("span", { class: "mc-table-page-size-text" }, "View per page", -1)), p("ul", Na, [(u(true), c(n, null, g((_a2 = k(a2)) == null ? void 0 : _a2.pageSizes, (e4) => {
|
|
501
|
+
var _a3;
|
|
502
|
+
return u(), c("li", { class: d(["mc-table-page-size-group-item", { "mc-table-page-size-group-item-active": e4 === ((_a3 = k(a2)) == null ? void 0 : _a3.pageSize) }]), key: e4, onClick: (a3) => ((e5) => {
|
|
503
|
+
j(t2) && !l2.value && t2({ pageSize: e5, pageNum: 1 });
|
|
504
|
+
})(e4) }, h(e4), 11, La);
|
|
505
|
+
}), 128))])]);
|
|
506
|
+
};
|
|
507
|
+
} }), [["__scopeId", "data-v-624cdec7"]]), Aa = { class: "mc-table-footer" }, Ha = Q(e({ name: "McTableFooter", __name: "mc-table-footer", setup: (e2) => (e3, a2) => (u(), c("div", Aa, [x(Ea), x(Ma), x(Ba)])) }), [["__scopeId", "data-v-b0dfb110"]]), Va = { class: "mc-table-loading" }, Oa = Q(e({ name: "McTableLoading", __name: "mc-table-loading", setup: (e2) => (e3, a2) => (u(), c("div", Va, [w(e3.$slots, "default", {}, () => [x(re, { loading: true, type: "pulse", size: "small" })], true)])) }), [["__scopeId", "data-v-e7655832"]]), Fa = { class: "mc-table-body" }, ja = { class: "mc-table-body-tbody" }, Ka = Q(e({ name: "McTableBody", __name: "mc-table-body", props: { loading: { type: Boolean, default: false } }, setup(e2) {
|
|
508
|
+
const { data: a2, leftColumns: l2, rightColumns: t2, centerColumns: o2, isExpanded: s2, getExpandData: i2 } = ca();
|
|
509
|
+
return (e3, r2) => (u(), c("table", Fa, [p("tbody", ja, [(u(true), c(n, null, g(k(a2), (e4, a3) => (u(), c(n, { key: a3 }, [x(ga, { "left-columns": k(l2), "right-columns": k(t2), "center-columns": k(o2) }, { left: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, row: e4, "row-index": a3, width: l4.width, type: l4.isExpand ? "expand-icon" : "body" }, C({ _: 2 }, [l4.tableValue ? { name: "default", fn: S(() => [(u(), f(b(l4.tableValue), { value: e4 == null ? void 0 : e4[l4.prop], row: e4, "row-index": a3 }, null, 8, ["value", "row", "row-index"]))]), key: "0" } : void 0]), 1032, ["column", "row", "row-index", "width", "type"]))), 128))]), default: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, row: e4, "row-index": a3, width: l4.width, type: l4.isExpand ? "expand-icon" : "body" }, C({ _: 2 }, [l4.tableValue ? { name: "default", fn: S(() => [(u(), f(b(l4.tableValue), { value: e4 == null ? void 0 : e4[l4.prop], row: e4, "row-index": a3 }, null, 8, ["value", "row", "row-index"]))]), key: "0" } : void 0]), 1032, ["column", "row", "row-index", "width", "type"]))), 128))]), right: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, row: e4, "row-index": a3, width: l4.width, type: l4.isExpand ? "expand-icon" : "body" }, C({ _: 2 }, [l4.tableValue ? { name: "default", fn: S(() => [(u(), f(b(l4.tableValue), { value: e4 == null ? void 0 : e4[l4.prop], row: e4, "row-index": a3 }, null, 8, ["value", "row", "row-index"]))]), key: "0" } : void 0]), 1032, ["column", "row", "row-index", "width", "type"]))), 128))]), _: 2 }, 1032, ["left-columns", "right-columns", "center-columns"]), k(s2)(a3) ? (u(true), c(n, { key: 0 }, g(k(i2)(a3), (e5, a4) => (u(), f(ga, { key: a4, "left-columns": k(l2), "right-columns": k(t2), "center-columns": k(o2), type: "expand" }, { left: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, width: l4.width, type: "expand" }, { default: S(() => [l4.expand ? (u(), f(b(l4.expand), { key: 0, expandRow: e5, expandRowIndex: a4 }, null, 8, ["expandRow", "expandRowIndex"])) : m("", true)]), _: 2 }, 1032, ["column", "width"]))), 128))]), default: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, width: l4.width, type: "expand" }, { default: S(() => [l4.expand ? (u(), f(b(l4.expand), { key: 0, expandRow: e5, expandRowIndex: a4 }, null, 8, ["expandRow", "expandRowIndex"])) : m("", true)]), _: 2 }, 1032, ["column", "width"]))), 128))]), right: S(({ columns: l3 }) => [(u(true), c(n, null, g(l3, (l4) => (u(), f(xa, { key: l4.prop, column: l4, width: l4.width, type: "expand" }, { default: S(() => [l4.expand ? (u(), f(b(l4.expand), { key: 0, expandRow: e5, expandRowIndex: a4 }, null, 8, ["expandRow", "expandRowIndex"])) : m("", true)]), _: 2 }, 1032, ["column", "width"]))), 128))]), _: 2 }, 1032, ["left-columns", "right-columns", "center-columns"]))), 128)) : m("", true)], 64))), 128))]), e3.loading ? (u(), f(Oa, { key: 0 }, { default: S(() => [w(e3.$slots, "loading", {}, void 0, true)]), _: 3 })) : m("", true)]));
|
|
510
|
+
} }), [["__scopeId", "data-v-1511f152"]]), Xa = { class: "mc-table-empty" }, Ua = Q(e({ name: "McTableEmpty", __name: "mc-table-empty", setup: (e2) => (e3, a2) => (u(), c("div", Xa, [w(e3.$slots, "default", {}, () => [a2[0] || (a2[0] = p("p", { class: "mc-table-empty-content" }, "No available data", -1))], true)])) }), [["__scopeId", "data-v-613caf10"]]), Ga = Q(e({ name: "McTableScroll", __name: "mc-table-scroll", setup(e2) {
|
|
511
|
+
const { scroll: l2, centerWidth: n2, viewWidth: s2, tableWidth: i2, setScroll: r2 } = ca(), d2 = a(), g2 = a(), h2 = o(() => J(s2.value / n2.value * 100)), f2 = o(() => q(h2.value) <= 95), b2 = o(() => `${h2.value}%`), y2 = a(0);
|
|
512
|
+
t(() => {
|
|
513
|
+
y2.value = n2.value ? l2.value * i2.value / n2.value : 0;
|
|
514
|
+
});
|
|
515
|
+
let w2 = 0, _2 = 0;
|
|
516
|
+
const x2 = (e3) => {
|
|
517
|
+
d2.value && (w2 = e3.clientX, _2 = y2.value, window.addEventListener("mousemove", C2), window.addEventListener("mouseup", S2));
|
|
518
|
+
}, C2 = (e3) => {
|
|
519
|
+
var _a2, _b;
|
|
520
|
+
let a2 = e3.clientX - w2 + _2;
|
|
521
|
+
a2 < 0 && (a2 = 0);
|
|
522
|
+
const l3 = ((_b = (_a2 = g2.value) == null ? void 0 : _a2.getBoundingClientRect()) == null ? void 0 : _b.width) || 0, t2 = i2.value - l3 + 2;
|
|
523
|
+
a2 > t2 && (a2 = t2), y2.value = a2;
|
|
524
|
+
const o2 = y2.value * n2.value / i2.value;
|
|
525
|
+
r2(o2);
|
|
526
|
+
}, S2 = () => {
|
|
527
|
+
W2();
|
|
528
|
+
}, W2 = () => {
|
|
529
|
+
window.removeEventListener("mousemove", C2), window.removeEventListener("mouseup", S2);
|
|
530
|
+
};
|
|
531
|
+
return M(() => {
|
|
532
|
+
W2();
|
|
533
|
+
}), (e3, a2) => f2.value ? (u(), c("div", { key: 0, ref_key: "scrollRef", ref: d2, class: "mc-table-scroll", onMousedown: x2 }, [p("div", { ref_key: "thumbRef", ref: g2, class: "mc-table-scroll-thumb", style: v({ width: b2.value, transform: `translateX(${k(Z)(y2.value)})` }) }, null, 4)], 544)) : m("", true);
|
|
534
|
+
} }), [["__scopeId", "data-v-5cffbf6c"]]), qa = Q(e({ name: "McTablePlus", __name: "mc-table-plus", props: { data: { default: () => [] }, loading: { type: Boolean, default: false }, sortType: { default: "back" }, pagination: {}, width: { default: "100%" }, height: {}, expandCondition: {}, fetchExpandData: {} }, emits: ["change:sort", "change:pagination", "change:expand"], setup(e2, { emit: t2 }) {
|
|
535
|
+
const n2 = e2, i2 = t2, d2 = a(), { width: g2, height: h2 } = ie(), b2 = a(n2.data), { columns: y2, leftColumns: _2, centerColumns: C2, rightColumns: W2, tableWidth: I2, columnWidth: R2 } = ((e3) => {
|
|
536
|
+
const t3 = a([]), n3 = a([]), s2 = a([]), i3 = a([]), c2 = a(0), u2 = $({ tableWidth: 0, fixedWidth: 0, restColumns: 0 }), d3 = l();
|
|
537
|
+
r(() => {
|
|
538
|
+
var _a2;
|
|
539
|
+
return (_a2 = d3.default) == null ? void 0 : _a2.call(d3);
|
|
540
|
+
}, () => {
|
|
541
|
+
var _a2;
|
|
542
|
+
const { columns: e4, columnWidthInfo: a2, leftColumns: l2, centerColumns: o2, rightColumns: r2 } = ((e5) => {
|
|
543
|
+
const a3 = [], l3 = [], t4 = [], n4 = [], o3 = { tableWidth: 0, fixedWidth: 0, restColumns: 0 }, s3 = (e6) => {
|
|
544
|
+
O(e6) && e6.forEach((e7) => {
|
|
545
|
+
var _a3;
|
|
546
|
+
const i4 = (_a3 = (e7 == null ? void 0 : e7.type) || {}) == null ? void 0 : _a3.name;
|
|
547
|
+
if (i4 === ia) {
|
|
548
|
+
const s4 = e7.children, i5 = e7.props, r3 = F(i5 == null ? void 0 : i5.sortable) && "" === i5.sortable || (i5 == null ? void 0 : i5.sortable) || false, c3 = { prop: i5 == null ? void 0 : i5.prop, label: i5 == null ? void 0 : i5.label, desc: i5 == null ? void 0 : i5.desc, width: "expand" === (i5 == null ? void 0 : i5.prop) ? 40 : i5 == null ? void 0 : i5.width, fixed: (i5 == null ? void 0 : i5.fixed) || "none", defaultValue: i5 == null ? void 0 : i5.defaultValue, sortable: r3, isExpand: "expand" === (i5 == null ? void 0 : i5.prop), sortType: (i5 == null ? void 0 : i5.sortType) || (i5 == null ? void 0 : i5["sort-type"]) || "string", columnAlign: (i5 == null ? void 0 : i5.columnAlign) || (i5 == null ? void 0 : i5["column-align"]) || "left", headerTitle: s4 == null ? void 0 : s4["header-title"], headerDesc: s4 == null ? void 0 : s4["header-desc"], header: s4 == null ? void 0 : s4.header, expand: s4 == null ? void 0 : s4.expand, tableValue: s4 == null ? void 0 : s4.default };
|
|
549
|
+
c3.width ? o3.fixedWidth += c3.width : o3.restColumns += 1, "left" === c3.fixed ? l3.push(c3) : "right" === c3.fixed ? n4.push(c3) : t4.push(c3), a3.push(c3);
|
|
550
|
+
} else Array.isArray(e7.children) && s3(e7.children);
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
return s3(e5), { columns: a3, columnWidthInfo: o3, leftColumns: l3, centerColumns: t4, rightColumns: n4 };
|
|
554
|
+
})((_a2 = d3.default) == null ? void 0 : _a2.call(d3));
|
|
555
|
+
t3.value = e4, u2.fixedWidth = a2.fixedWidth, u2.restColumns = a2.restColumns, n3.value = l2, s2.value = o2, i3.value = r2;
|
|
556
|
+
}, { immediate: true }), oe(e3, ({ width: e4 }) => {
|
|
557
|
+
let a2 = e4;
|
|
558
|
+
n3.value.length > 0 && (a2 -= 1), i3.value.length > 0 && (a2 -= 1), c2.value = a2;
|
|
559
|
+
});
|
|
560
|
+
const p2 = o(() => {
|
|
561
|
+
const e4 = (c2.value - u2.fixedWidth) / u2.restColumns;
|
|
562
|
+
return e4 <= 0 ? 240 : e4;
|
|
563
|
+
});
|
|
564
|
+
return { columns: t3, leftColumns: n3, centerColumns: s2, rightColumns: i3, tableWidth: c2, columnWidth: p2 };
|
|
565
|
+
})(d2), { scroll: E2, setScroll: T2, resetScroll: D2 } = (() => {
|
|
566
|
+
const e3 = a(0);
|
|
567
|
+
return { scroll: e3, setScroll: (a2) => {
|
|
568
|
+
e3.value = a2;
|
|
569
|
+
}, resetScroll: () => {
|
|
570
|
+
e3.value = 0;
|
|
571
|
+
} };
|
|
572
|
+
})(), { setSort: M2, resetSort: N2, getCurrentSort: L2, sortData: A2 } = (() => {
|
|
573
|
+
const e3 = a({ sort: "normal", sortColumn: "" }), l2 = (a2, l3) => {
|
|
574
|
+
e3.value = { sort: l3, sortColumn: a2 };
|
|
575
|
+
}, t3 = (a2) => e3.value.sortColumn === a2 ? e3.value.sort : "normal";
|
|
576
|
+
return { sortInfo: e3, setSort: l2, resetSort: () => l2("", "normal"), getCurrentSort: t3, sortData: (e4, a2) => {
|
|
577
|
+
let l3 = [...e4];
|
|
578
|
+
const n3 = a2.prop, o2 = t3(n3), s2 = a2.sortType || "string";
|
|
579
|
+
return "normal" !== o2 && (j(s2) || (l3 = K(l3, "number" === s2 ? (e5) => Number(e5[n3]) : [n3], [o2]))), l3;
|
|
580
|
+
} };
|
|
581
|
+
})(), { pagination: X2, hasPagination: U2, handlePagination: q2 } = (() => {
|
|
582
|
+
const e3 = ne("pagination"), a2 = $({ ...ua });
|
|
583
|
+
s(() => {
|
|
584
|
+
l2(e3.value || ua);
|
|
585
|
+
});
|
|
586
|
+
const l2 = (e4) => {
|
|
587
|
+
H(a2, { ...e4 });
|
|
588
|
+
};
|
|
589
|
+
r(() => e3.value, (e4) => {
|
|
590
|
+
l2(e4 || ua);
|
|
591
|
+
}, { deep: true });
|
|
592
|
+
const t3 = z(), n3 = V(() => {
|
|
593
|
+
t3 == null ? void 0 : t3.emit("change:pagination", a2);
|
|
594
|
+
}, 500), i3 = o(() => {
|
|
595
|
+
var _a2;
|
|
596
|
+
return !!((_a2 = e3.value) == null ? void 0 : _a2.pageNum);
|
|
597
|
+
});
|
|
598
|
+
return { pagination: a2, hasPagination: i3, handlePagination: (e4) => {
|
|
599
|
+
l2(e4), n3();
|
|
600
|
+
} };
|
|
601
|
+
})(), { isExpanded: J2, getExpandData: Q2, resetExpandData: Y2, setExpandData: Z2, removeExpandData: ee2 } = (() => {
|
|
602
|
+
const e3 = $(/* @__PURE__ */ new Map());
|
|
603
|
+
return { expandData: e3, isExpanded: (a2) => e3.has(a2), getExpandData: (a2) => e3.get(a2) || [], resetExpandData: () => {
|
|
604
|
+
e3.clear();
|
|
605
|
+
}, setExpandData: (a2, l2) => {
|
|
606
|
+
e3.set(a2, l2);
|
|
607
|
+
}, removeExpandData: (a2) => {
|
|
608
|
+
e3.delete(a2);
|
|
609
|
+
} };
|
|
610
|
+
})(), { leftWidth: ae2, rightWidth: le2, centerWidth: te2, viewWidth: se2 } = ((e3) => {
|
|
611
|
+
const { leftColumns: a2, rightColumns: l2, centerColumns: t3, tableWidth: n3, columnWidth: s2 } = e3, i3 = (e4) => G(e4, (e5, a3) => e5 + (a3.width || s2.value), 0), r2 = o(() => i3(a2.value)), c2 = o(() => i3(l2.value)), u2 = o(() => i3(t3.value)), d3 = o(() => n3.value - r2.value - c2.value);
|
|
612
|
+
return { leftWidth: r2, rightWidth: c2, centerWidth: u2, viewWidth: d3 };
|
|
613
|
+
})({ leftColumns: _2, rightColumns: W2, centerColumns: C2, tableWidth: I2, columnWidth: R2 });
|
|
614
|
+
r(() => n2.data, () => {
|
|
615
|
+
b2.value = n2.data, Y2(), N2(), D2();
|
|
616
|
+
});
|
|
617
|
+
const re2 = o(() => {
|
|
618
|
+
var _a2;
|
|
619
|
+
return !n2.loading && !((_a2 = b2.value) == null ? void 0 : _a2.length);
|
|
620
|
+
}), ce2 = o(() => U2.value && !re2.value);
|
|
621
|
+
return P(ra, { data: b2, tableWidth: I2, isLoading: o(() => !!n2.loading), columns: y2, columnWidth: R2, leftColumns: _2, rightColumns: W2, centerColumns: C2, scroll: E2, setScroll: T2, pagination: X2, handlePagination: q2, handleSort: (e3, a2) => {
|
|
622
|
+
if (Y2(), M2(e3, a2), "front" === n2.sortType) {
|
|
623
|
+
const a3 = B(y2.value, (a4) => a4.prop === e3);
|
|
624
|
+
a3 && (b2.value = A2(n2.data, a3));
|
|
625
|
+
} else i2("change:sort", e3, a2);
|
|
626
|
+
}, getCurrentSort: L2, isExpanded: J2, getExpandData: Q2, setExpandData: (e3, a2) => {
|
|
627
|
+
Z2(e3, a2), i2("change:expand", b2.value[e3], true);
|
|
628
|
+
}, removeExpandData: (e3) => {
|
|
629
|
+
ee2(e3), i2("change:expand", b2.value[e3], false);
|
|
630
|
+
}, expandCondition: n2.expandCondition, fetchExpandData: n2.fetchExpandData, leftWidth: ae2, rightWidth: le2, centerWidth: te2, viewWidth: se2 }), (e3, a2) => (u(), c("div", { class: "mc-table-plus", style: v({ width: k(g2), height: k(h2) }), ref_key: "tableRef", ref: d2 }, [p("div", null, [x(Sa), re2.value ? (u(), f(Ua, { key: 1 }, { default: S(() => [w(e3.$slots, "empty", {}, void 0, true)]), _: 3 })) : (u(), f(Ka, { key: 0, loading: e3.loading }, null, 8, ["loading"]))]), x(Ga), ce2.value ? (u(), f(Ha, { key: 0 })) : m("", true)], 4));
|
|
631
|
+
} }), [["__scopeId", "data-v-0256cc07"]]), Ja = { class: "mc-table-column" }, Qa = Q(e({ name: ia, __name: "mc-table-column-plus", props: { prop: {}, label: {}, desc: {}, width: {}, fixed: {}, sortable: { type: Boolean }, columnAlign: {}, sortType: { type: [String, Function] }, defaultValue: { type: [String, Number, Boolean] } }, setup: (e2) => (e3, a2) => (u(), c("div", Ja)) }), [["__scopeId", "data-v-2bff466d"]]), Ya = Y(qa), Za = Y(Qa);
|
|
632
|
+
export {
|
|
633
|
+
ge as M,
|
|
634
|
+
he as a,
|
|
635
|
+
sa as b,
|
|
636
|
+
Ya as c,
|
|
637
|
+
Za as d,
|
|
638
|
+
na as e,
|
|
639
|
+
oa as f,
|
|
640
|
+
ta as u
|
|
641
|
+
};
|