vueye-table 2.0.0-alpha.2 → 2.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -13
- package/README.md +55 -30
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +20 -33
- package/dist/components/core/VueyeTable/api.d.ts +14 -0
- package/dist/components/core/VueyeTable/{VueyeBody → components/VueyeBody}/VueyeBody.vue.d.ts +8 -9
- package/dist/components/core/VueyeTable/components/VueyeBody/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/components/VueyeDropdown/api.d.ts +17 -0
- package/dist/components/core/VueyeTable/components/VueyeDropdown/index.d.ts +4 -0
- package/dist/components/core/VueyeTable/{VueyeHead → components/VueyeHead}/VueyeHead.vue.d.ts +2 -3
- package/dist/components/core/VueyeTable/{VueyePagination → components/VueyePagination}/VueyePagination.vue.d.ts +12 -12
- package/dist/components/core/VueyeTable/components/VueyePagination/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/components/index.d.ts +4 -0
- package/dist/components/core/VueyeTable/composables/index.d.ts +3 -0
- package/dist/components/core/VueyeTable/composables/usePagination.d.ts +11 -0
- package/dist/components/core/VueyeTable/types/Utils.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/vueye-table.js +314 -367
- package/dist/vueye-table.umd.cjs +1 -1
- package/package.json +86 -103
- package/dist/components/core/VueyeTable/VSelect.d.ts +0 -15
- package/dist/components/core/VueyeTable/VueyeBody/index.d.ts +0 -2
- package/dist/components/core/VueyeTable/VueyePagination/index.d.ts +0 -6
- package/dist/components/core/VueyeTable/util-components/VueyeDropdown.vue.d.ts +0 -53
- package/dist/data/product.d.ts +0 -14
- package/dist/data/user.d.ts +0 -22
- package/dist/types.d.ts +0 -8
- /package/dist/components/core/VueyeTable/{VueyeHead → components/VueyeHead}/index.d.ts +0 -0
package/dist/vueye-table.js
CHANGED
|
@@ -1,169 +1,171 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const j = M ? window : void 0;
|
|
19
|
-
function I(...a) {
|
|
20
|
-
let n, e, t, r;
|
|
21
|
-
if (typeof a[0] == "string" || Array.isArray(a[0]) ? ([e, t, r] = a, n = j) : [n, e, t, r] = a, !n)
|
|
22
|
-
return B;
|
|
23
|
-
Array.isArray(e) || (e = [e]), Array.isArray(t) || (t = [t]);
|
|
24
|
-
const o = [], c = () => {
|
|
25
|
-
o.forEach((l) => l()), o.length = 0;
|
|
26
|
-
}, _ = (l, m, i, s) => (l.addEventListener(m, i, s), () => l.removeEventListener(m, i, s)), h = x(
|
|
27
|
-
() => [V(n), H(r)],
|
|
28
|
-
([l, m]) => {
|
|
29
|
-
c(), l && o.push(
|
|
30
|
-
...e.flatMap((i) => t.map((s) => _(l, i, s, m)))
|
|
31
|
-
);
|
|
32
|
-
},
|
|
33
|
-
{ immediate: !0, flush: "post" }
|
|
34
|
-
), b = () => {
|
|
35
|
-
h(), c();
|
|
36
|
-
};
|
|
37
|
-
return te(b), b;
|
|
38
|
-
}
|
|
39
|
-
let T = !1;
|
|
40
|
-
function se(a, n, e = {}) {
|
|
41
|
-
const { window: t = j, ignore: r = [], capture: o = !0, detectIframe: c = !1 } = e;
|
|
42
|
-
if (!t)
|
|
43
|
-
return;
|
|
44
|
-
ne && !T && (T = !0, Array.from(t.document.body.children).forEach((i) => i.addEventListener("click", B)), t.document.documentElement.addEventListener("click", B));
|
|
45
|
-
let _ = !0;
|
|
46
|
-
const h = (i) => r.some((s) => {
|
|
47
|
-
if (typeof s == "string")
|
|
48
|
-
return Array.from(t.document.querySelectorAll(s)).some((d) => d === i.target || i.composedPath().includes(d));
|
|
49
|
-
{
|
|
50
|
-
const d = V(s);
|
|
51
|
-
return d && (i.target === d || i.composedPath().includes(d));
|
|
52
|
-
}
|
|
53
|
-
}), l = [
|
|
54
|
-
I(t, "click", (i) => {
|
|
55
|
-
const s = V(a);
|
|
56
|
-
if (!(!s || s === i.target || i.composedPath().includes(s))) {
|
|
57
|
-
if (i.detail === 0 && (_ = !h(i)), !_) {
|
|
58
|
-
_ = !0;
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
n(i);
|
|
62
|
-
}
|
|
63
|
-
}, { passive: !0, capture: o }),
|
|
64
|
-
I(t, "pointerdown", (i) => {
|
|
65
|
-
const s = V(a);
|
|
66
|
-
s && (_ = !i.composedPath().includes(s) && !h(i));
|
|
67
|
-
}, { passive: !0 }),
|
|
68
|
-
c && I(t, "blur", (i) => {
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
var d;
|
|
71
|
-
const s = V(a);
|
|
72
|
-
((d = t.document.activeElement) == null ? void 0 : d.tagName) === "IFRAME" && !(s != null && s.contains(t.document.activeElement)) && n(i);
|
|
73
|
-
}, 0);
|
|
74
|
-
})
|
|
75
|
-
].filter(Boolean);
|
|
76
|
-
return () => l.forEach((i) => i());
|
|
77
|
-
}
|
|
78
|
-
const oe = { class: "relative" }, re = ["aria-expanded"], le = /* @__PURE__ */ u("span", { class: "i-solar-alt-arrow-down-linear" }, null, -1), ue = {
|
|
1
|
+
import { defineComponent as C, mergeDefaults as H, ref as S, computed as h, watchEffect as T, openBlock as i, createElementBlock as d, createElementVNode as r, unref as u, toDisplayString as f, createCommentVNode as B, Fragment as $, renderList as v, normalizeClass as k, renderSlot as m, createTextVNode as j, createVNode as O, toRef as U, useSlots as K, createSlots as M, withCtx as I, normalizeProps as L, guardReactiveProps as z } from "vue";
|
|
2
|
+
const A = {
|
|
3
|
+
itemValue: "id",
|
|
4
|
+
columnHeaders: () => [],
|
|
5
|
+
data: () => [],
|
|
6
|
+
perPage: 10,
|
|
7
|
+
currentPage: 1,
|
|
8
|
+
perPageOptions: () => [5, 10, 20, 30],
|
|
9
|
+
loading: !1,
|
|
10
|
+
selectable: !1,
|
|
11
|
+
caption: "",
|
|
12
|
+
summary: ""
|
|
13
|
+
}, F = {
|
|
14
|
+
options: () => [],
|
|
15
|
+
modelValue: "",
|
|
16
|
+
label: ""
|
|
17
|
+
}, W = { class: "dropdown__wrapper" }, q = ["aria-expanded"], G = /* @__PURE__ */ r("span", { class: "i-solar-alt-arrow-down-linear" }, null, -1), J = {
|
|
79
18
|
class: "py-1",
|
|
80
19
|
role: "none"
|
|
81
|
-
},
|
|
20
|
+
}, Q = ["onClick"], X = /* @__PURE__ */ C({
|
|
82
21
|
__name: "VueyeDropdown",
|
|
83
|
-
props: {
|
|
84
|
-
options: {
|
|
85
|
-
modelValue: {
|
|
86
|
-
label: {
|
|
22
|
+
props: H({
|
|
23
|
+
options: {},
|
|
24
|
+
modelValue: {},
|
|
25
|
+
label: {},
|
|
87
26
|
defaultValue: {}
|
|
88
|
-
},
|
|
27
|
+
}, F),
|
|
89
28
|
emits: ["update:modelValue"],
|
|
90
|
-
setup(
|
|
91
|
-
const e = a,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
95
|
-
const r = O(!1), o = O(-1), c = P(() => e.options[o.value] ?? e.defaultValue), _ = `dropdown-label-${Math.random().toString(36).substring(2, 9)}`;
|
|
96
|
-
function h() {
|
|
97
|
-
r.value = !r.value;
|
|
29
|
+
setup(s, { emit: t }) {
|
|
30
|
+
const e = s, n = S(!1), l = S(-1), a = h(() => e.options[l.value] ?? e.defaultValue), c = `dropdown-label-${Math.random().toString(36).substring(2, 9)}`;
|
|
31
|
+
function P() {
|
|
32
|
+
n.value = !n.value;
|
|
98
33
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
34
|
+
function y(_) {
|
|
35
|
+
l.value = _, n.value = !1, t("update:modelValue", a.value.content);
|
|
101
36
|
}
|
|
102
|
-
return
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
}), (
|
|
106
|
-
|
|
37
|
+
return T(() => {
|
|
38
|
+
const _ = e.options.findIndex((p) => p.content === e.modelValue);
|
|
39
|
+
_ !== -1 && (l.value = _);
|
|
40
|
+
}), (_, p) => (i(), d("div", W, [
|
|
41
|
+
r("button", {
|
|
107
42
|
type: "button",
|
|
108
|
-
class: "
|
|
109
|
-
onClick:
|
|
110
|
-
"aria-expanded":
|
|
111
|
-
"aria-haspopup": !0
|
|
43
|
+
class: "dropdown__trigger",
|
|
44
|
+
onClick: P,
|
|
45
|
+
"aria-expanded": u(n),
|
|
46
|
+
"aria-haspopup": !0,
|
|
47
|
+
ref: "buttonRef"
|
|
112
48
|
}, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
], 8,
|
|
116
|
-
|
|
49
|
+
r("span", null, f(u(a).label), 1),
|
|
50
|
+
G
|
|
51
|
+
], 8, q),
|
|
52
|
+
u(n) ? (i(), d("div", {
|
|
117
53
|
key: 0,
|
|
118
|
-
class: "
|
|
54
|
+
class: "dropdown__overlay",
|
|
55
|
+
onClick: P
|
|
56
|
+
})) : B("", !0),
|
|
57
|
+
u(n) ? (i(), d("div", {
|
|
58
|
+
key: 1,
|
|
59
|
+
class: "dropdown__menu",
|
|
119
60
|
role: "menu",
|
|
120
61
|
"aria-orientation": "vertical",
|
|
121
|
-
"aria-labelledby":
|
|
122
|
-
ref_key: "target",
|
|
123
|
-
ref: t
|
|
62
|
+
"aria-labelledby": c
|
|
124
63
|
}, [
|
|
125
|
-
|
|
126
|
-
(
|
|
127
|
-
key:
|
|
128
|
-
class:
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
}, "block px-4 py-2 text-sm text-left w-full text-slate-700 dark:text-slate-50 hover:bg-slate-200 hover:text-slate-900 focus:outline-none focus:bg-slate-100 focus:text-slate-900 dark:hover:text-slate-300 dark:hover:bg-primary-900"]),
|
|
64
|
+
r("div", J, [
|
|
65
|
+
(i(!0), d($, null, v(_.options, (w, b) => (i(), d("button", {
|
|
66
|
+
key: b,
|
|
67
|
+
class: k([{
|
|
68
|
+
"dropdown__menu__item--selected ": b === u(l)
|
|
69
|
+
}, "dropdown__menu__item"]),
|
|
132
70
|
role: "menuitem",
|
|
133
|
-
onClick: (
|
|
134
|
-
},
|
|
71
|
+
onClick: (o) => y(b)
|
|
72
|
+
}, f(w.label), 11, Q))), 128))
|
|
135
73
|
])
|
|
136
|
-
]
|
|
74
|
+
])) : B("", !0)
|
|
137
75
|
]));
|
|
138
76
|
}
|
|
139
|
-
})
|
|
77
|
+
});
|
|
78
|
+
const Y = { key: 0 }, Z = ["colspan"], x = /* @__PURE__ */ r("div", { class: "flex justify-center items-center" }, [
|
|
79
|
+
/* @__PURE__ */ r("div", { class: "loader animate-spin ease-linear rounded-full border-8 border-t-8 border-t-primary-300 dark:border-t-primary-800 dark:border-primary-600 border-primary-200 h-16 w-16" })
|
|
80
|
+
], -1), ee = [
|
|
81
|
+
x
|
|
82
|
+
], te = ["id"], ne = /* @__PURE__ */ C({
|
|
83
|
+
__name: "VueyeBody",
|
|
84
|
+
props: {
|
|
85
|
+
loading: { type: Boolean, default: !1 },
|
|
86
|
+
bodyRows: { default: () => [] },
|
|
87
|
+
itemValue: { default: "id" }
|
|
88
|
+
},
|
|
89
|
+
setup(s) {
|
|
90
|
+
const t = s, e = h(() => Object.keys(t.bodyRows[0]).length);
|
|
91
|
+
return (n, l) => (i(), d("tbody", null, [
|
|
92
|
+
n.loading ? (i(), d("tr", Y, [
|
|
93
|
+
r("td", { colspan: u(e) }, ee, 8, Z)
|
|
94
|
+
])) : (i(!0), d($, { key: 1 }, v(n.bodyRows, (a) => (i(), d("tr", {
|
|
95
|
+
key: a[n.itemValue]
|
|
96
|
+
}, [
|
|
97
|
+
m(n.$slots, "default", { row: a }, () => [
|
|
98
|
+
(i(!0), d($, null, v(Object.keys(a), (c) => (i(), d("td", {
|
|
99
|
+
key: `${a[n.itemValue]}.${c}`,
|
|
100
|
+
id: `${a[n.itemValue]}.${c}`
|
|
101
|
+
}, [
|
|
102
|
+
m(n.$slots, "default", {
|
|
103
|
+
cell: a[c],
|
|
104
|
+
key: `${a[n.itemValue]}.${c}`
|
|
105
|
+
}, () => [
|
|
106
|
+
j(f(a[c]), 1)
|
|
107
|
+
])
|
|
108
|
+
], 8, te))), 128))
|
|
109
|
+
])
|
|
110
|
+
]))), 128))
|
|
111
|
+
]));
|
|
112
|
+
}
|
|
113
|
+
}), ae = ["colspan", "rowspan", "scope"], se = /* @__PURE__ */ C({
|
|
114
|
+
__name: "VueyeHead",
|
|
115
|
+
props: {
|
|
116
|
+
columnHeaders: { default: () => [] }
|
|
117
|
+
},
|
|
118
|
+
setup(s) {
|
|
119
|
+
return (t, e) => (i(), d("thead", null, [
|
|
120
|
+
(i(!0), d($, null, v(t.columnHeaders, (n, l) => (i(), d("tr", { key: l }, [
|
|
121
|
+
(i(!0), d($, null, v(n, (a) => m(t.$slots, `headerCell.${a.key}`, {
|
|
122
|
+
key: a.key,
|
|
123
|
+
headerCell: a
|
|
124
|
+
}, () => [
|
|
125
|
+
r("th", {
|
|
126
|
+
colspan: a.colSpan,
|
|
127
|
+
rowspan: a.rowSpan,
|
|
128
|
+
scope: a.scope,
|
|
129
|
+
class: k([a.className, "th"])
|
|
130
|
+
}, [
|
|
131
|
+
m(t.$slots, `headerCellContent.${a.key}`, { headerCellContent: a }, () => [
|
|
132
|
+
r("span", {
|
|
133
|
+
class: k(a.labelClassName)
|
|
134
|
+
}, f(a.label), 3)
|
|
135
|
+
])
|
|
136
|
+
], 10, ae)
|
|
137
|
+
])), 128))
|
|
138
|
+
]))), 128))
|
|
139
|
+
]));
|
|
140
|
+
}
|
|
141
|
+
}), oe = { class: "pagination__wrapper" }, re = { class: "pagination__details" }, le = { class: "pagination__btn-list" }, ue = ["disabled"], ie = /* @__PURE__ */ r("span", { class: "sr-only" }, "First page", -1), de = /* @__PURE__ */ r("span", {
|
|
140
142
|
"aria-hidden": "true",
|
|
141
143
|
class: "i-solar-alt-arrow-left-linear"
|
|
142
|
-
}, null, -1)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
],
|
|
144
|
+
}, null, -1), ce = [
|
|
145
|
+
ie,
|
|
146
|
+
de
|
|
147
|
+
], pe = ["disabled"], _e = /* @__PURE__ */ r("span", { class: "sr-only" }, "Previous page", -1), ge = /* @__PURE__ */ r("span", {
|
|
146
148
|
"aria-hidden": "true",
|
|
147
149
|
class: "i-solar-double-alt-arrow-left-linear"
|
|
148
|
-
}, null, -1)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
],
|
|
150
|
+
}, null, -1), fe = [
|
|
151
|
+
_e,
|
|
152
|
+
ge
|
|
153
|
+
], he = ["onClick"], Pe = {
|
|
152
154
|
key: 1,
|
|
153
155
|
class: "pagination__btn"
|
|
154
|
-
},
|
|
156
|
+
}, be = ["disabled"], ye = /* @__PURE__ */ r("span", { class: "sr-only" }, "Next page", -1), me = /* @__PURE__ */ r("span", {
|
|
155
157
|
"aria-hidden": "true",
|
|
156
158
|
class: "i-solar-alt-arrow-right-linear"
|
|
157
|
-
}, null, -1)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
],
|
|
159
|
+
}, null, -1), ve = [
|
|
160
|
+
ye,
|
|
161
|
+
me
|
|
162
|
+
], $e = ["disabled"], Ve = /* @__PURE__ */ r("span", { class: "sr-only" }, "Last page", -1), ke = /* @__PURE__ */ r("span", {
|
|
161
163
|
"aria-hidden": "true",
|
|
162
164
|
class: "i-solar-double-alt-arrow-right-linear"
|
|
163
|
-
}, null, -1)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
],
|
|
165
|
+
}, null, -1), Ce = [
|
|
166
|
+
Ve,
|
|
167
|
+
ke
|
|
168
|
+
], we = /* @__PURE__ */ C({
|
|
167
169
|
__name: "VueyePagination",
|
|
168
170
|
props: {
|
|
169
171
|
perPage: { default: 10 },
|
|
@@ -172,298 +174,243 @@ const oe = { class: "relative" }, re = ["aria-expanded"], le = /* @__PURE__ */ u
|
|
|
172
174
|
perPageOptions: { default: () => [10, 20, 30, 40, 50] }
|
|
173
175
|
},
|
|
174
176
|
emits: ["update:currentPage", "update:perPage"],
|
|
175
|
-
setup(
|
|
176
|
-
const e =
|
|
177
|
-
value:
|
|
178
|
-
label:
|
|
179
|
-
}))),
|
|
180
|
-
(
|
|
177
|
+
setup(s, { emit: t }) {
|
|
178
|
+
const e = s, n = h(() => Math.ceil(e.total / e.perPage)), l = h(() => e.perPageOptions.map((o) => ({
|
|
179
|
+
value: o,
|
|
180
|
+
label: o.toString()
|
|
181
|
+
}))), a = h(() => l.value.find((o) => o.value === e.perPage)), c = h(() => Array.from({ length: n.value }, (o, g) => g + 1).reduce(
|
|
182
|
+
(o, g) => (g === 1 || g === e.total || g >= e.currentPage - 2 && g <= e.currentPage + 2 ? o.push(g) : (g === e.currentPage - 3 || g === e.currentPage + 3) && o.push("..."), o),
|
|
181
183
|
[]
|
|
182
184
|
));
|
|
183
|
-
function
|
|
184
|
-
e.currentPage <
|
|
185
|
+
function P() {
|
|
186
|
+
e.currentPage < n.value && t("update:currentPage", e.currentPage + 1);
|
|
185
187
|
}
|
|
186
|
-
function
|
|
187
|
-
e.currentPage > 1 &&
|
|
188
|
+
function y() {
|
|
189
|
+
e.currentPage > 1 && t("update:currentPage", e.currentPage - 1);
|
|
188
190
|
}
|
|
189
|
-
function
|
|
190
|
-
e.currentPage > 1 &&
|
|
191
|
+
function _() {
|
|
192
|
+
e.currentPage > 1 && t("update:currentPage", 1);
|
|
191
193
|
}
|
|
192
|
-
function
|
|
193
|
-
e.currentPage <
|
|
194
|
+
function p() {
|
|
195
|
+
e.currentPage < n.value && t("update:currentPage", e.total);
|
|
194
196
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
+
function w(o) {
|
|
198
|
+
o > 0 && o <= n.value && t("update:currentPage", o);
|
|
197
199
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
+
function b(o) {
|
|
201
|
+
t("update:perPage", Number(o));
|
|
200
202
|
}
|
|
201
|
-
return (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
options:
|
|
205
|
-
"default-value":
|
|
203
|
+
return (o, g) => (i(), d("div", oe, [
|
|
204
|
+
r("div", null, [
|
|
205
|
+
O(u(X), {
|
|
206
|
+
options: u(l),
|
|
207
|
+
"default-value": u(a),
|
|
206
208
|
label: "Per page",
|
|
207
|
-
"onUpdate:modelValue":
|
|
209
|
+
"onUpdate:modelValue": b
|
|
208
210
|
}, null, 8, ["options", "default-value"])
|
|
209
211
|
]),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
+
r("div", null, [
|
|
213
|
+
r("span", re, f((o.currentPage - 1) * o.perPage + 1) + " - " + f(o.currentPage * o.perPage > o.total ? o.total : o.currentPage * o.perPage) + " of " + f(o.total), 1)
|
|
212
214
|
]),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
r("ul", le, [
|
|
216
|
+
r("li", null, [
|
|
217
|
+
r("button", {
|
|
216
218
|
class: "pagination__btn",
|
|
217
|
-
onClick:
|
|
218
|
-
disabled:
|
|
219
|
-
},
|
|
219
|
+
onClick: _,
|
|
220
|
+
disabled: o.currentPage === 1
|
|
221
|
+
}, ce, 8, ue)
|
|
220
222
|
]),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
r("li", null, [
|
|
224
|
+
r("button", {
|
|
223
225
|
class: "pagination__btn",
|
|
224
|
-
onClick:
|
|
225
|
-
disabled:
|
|
226
|
-
},
|
|
226
|
+
onClick: y,
|
|
227
|
+
disabled: o.currentPage === 1
|
|
228
|
+
}, fe, 8, pe)
|
|
227
229
|
]),
|
|
228
|
-
(
|
|
229
|
-
typeof
|
|
230
|
+
(i(!0), d($, null, v(u(c), (V) => (i(), d("li", { key: V }, [
|
|
231
|
+
typeof V == "number" ? (i(), d("button", {
|
|
230
232
|
key: 0,
|
|
231
|
-
class:
|
|
232
|
-
onClick: (
|
|
233
|
-
},
|
|
233
|
+
class: k(["pagination__btn", { "pagination__btn--current": V === o.currentPage }]),
|
|
234
|
+
onClick: (je) => w(V)
|
|
235
|
+
}, f(V), 11, he)) : (i(), d("span", Pe, "..."))
|
|
234
236
|
]))), 128)),
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
r("li", null, [
|
|
238
|
+
r("button", {
|
|
237
239
|
class: "pagination__btn",
|
|
238
|
-
onClick:
|
|
239
|
-
disabled:
|
|
240
|
-
},
|
|
240
|
+
onClick: P,
|
|
241
|
+
disabled: o.currentPage === u(n)
|
|
242
|
+
}, ve, 8, be)
|
|
241
243
|
]),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
r("li", null, [
|
|
245
|
+
r("button", {
|
|
244
246
|
class: "pagination__btn",
|
|
245
|
-
onClick:
|
|
246
|
-
disabled:
|
|
247
|
-
},
|
|
247
|
+
onClick: p,
|
|
248
|
+
disabled: o.currentPage === u(n)
|
|
249
|
+
}, Ce, 8, $e)
|
|
248
250
|
])
|
|
249
251
|
])
|
|
250
252
|
]));
|
|
251
253
|
}
|
|
252
254
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
e
|
|
257
|
-
|
|
258
|
-
}, Le = /* @__PURE__ */ Re(Be, [["__scopeId", "data-v-d06f6d12"]]);
|
|
259
|
-
function R(a) {
|
|
260
|
-
let n = 1;
|
|
261
|
-
return a.forEach((e) => {
|
|
262
|
-
e.children && (n = Math.max(n, R(e.children) + 1));
|
|
263
|
-
}), n;
|
|
255
|
+
function R(s) {
|
|
256
|
+
let t = 1;
|
|
257
|
+
return s.forEach((e) => {
|
|
258
|
+
e.children && (t = Math.max(t, R(e.children) + 1));
|
|
259
|
+
}), t;
|
|
264
260
|
}
|
|
265
|
-
function
|
|
266
|
-
let
|
|
267
|
-
return
|
|
268
|
-
e.children ?
|
|
269
|
-
}),
|
|
261
|
+
function N(s) {
|
|
262
|
+
let t = 0;
|
|
263
|
+
return s.forEach((e) => {
|
|
264
|
+
e.children ? t += N(e.children) : t++;
|
|
265
|
+
}), t;
|
|
270
266
|
}
|
|
271
|
-
function
|
|
272
|
-
return
|
|
273
|
-
if (e[
|
|
274
|
-
const { children: c, ...
|
|
275
|
-
e[
|
|
276
|
-
...
|
|
277
|
-
colSpan:
|
|
267
|
+
function D(s, t, e = [], n = 0, l = 0) {
|
|
268
|
+
return s.forEach((a) => {
|
|
269
|
+
if (e[n] || (e[n] = []), a.children) {
|
|
270
|
+
const { children: c, ...P } = a, y = N(c);
|
|
271
|
+
e[n].push({
|
|
272
|
+
...P,
|
|
273
|
+
colSpan: y,
|
|
278
274
|
scope: "colgroup"
|
|
279
|
-
}),
|
|
275
|
+
}), D(c, t, e, n + 1, l + 1);
|
|
280
276
|
} else {
|
|
281
|
-
const c =
|
|
282
|
-
e[
|
|
283
|
-
...
|
|
284
|
-
key:
|
|
285
|
-
label:
|
|
277
|
+
const c = t - l;
|
|
278
|
+
e[n].push({
|
|
279
|
+
...a,
|
|
280
|
+
key: a.key,
|
|
281
|
+
label: a.label,
|
|
286
282
|
rowSpan: c,
|
|
287
283
|
scope: "col"
|
|
288
284
|
});
|
|
289
285
|
}
|
|
290
286
|
}), e;
|
|
291
287
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
294
|
-
|
|
288
|
+
function E(s, t = "", e = []) {
|
|
289
|
+
return s.forEach((n) => {
|
|
290
|
+
n.children ? E(n.children, `${t}${n.key}.`, e) : e.push(`${t}${n.key}`);
|
|
295
291
|
}), e;
|
|
296
292
|
}
|
|
297
|
-
function
|
|
298
|
-
const
|
|
299
|
-
return
|
|
293
|
+
function Ke(s) {
|
|
294
|
+
const t = R(s);
|
|
295
|
+
return D(s, t).reduce((l, a) => [...l, ...a], []);
|
|
300
296
|
}
|
|
301
|
-
const
|
|
302
|
-
const e =
|
|
303
|
-
let
|
|
304
|
-
for (let
|
|
305
|
-
if (
|
|
306
|
-
|
|
297
|
+
const Oe = (s, t) => {
|
|
298
|
+
const e = t.split(".");
|
|
299
|
+
let n = s;
|
|
300
|
+
for (let l = 0; l < e.length; l++)
|
|
301
|
+
if (n[e[l]])
|
|
302
|
+
n = n[e[l]];
|
|
307
303
|
else
|
|
308
304
|
return;
|
|
309
|
-
return
|
|
305
|
+
return n;
|
|
310
306
|
};
|
|
311
|
-
function
|
|
312
|
-
return
|
|
313
|
-
[
|
|
314
|
-
})).reduce((
|
|
307
|
+
function Se(s, t, e = 0, n = s.length) {
|
|
308
|
+
return s.map((l) => E(t).map((a) => ({
|
|
309
|
+
[a]: Oe(l, a)
|
|
310
|
+
})).reduce((a, c) => ({ ...a, ...c }), {})).slice(e, n);
|
|
315
311
|
}
|
|
316
|
-
function
|
|
312
|
+
function Me(s) {
|
|
317
313
|
return {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
314
|
+
headerKeys: h(() => E(s.flat()))
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function Be(s = {}) {
|
|
318
|
+
const t = S({
|
|
319
|
+
perPage: s.perPage || 10,
|
|
320
|
+
currentPage: s.currentPage || 1
|
|
321
|
+
});
|
|
322
|
+
function e(l) {
|
|
323
|
+
t.value.currentPage = l;
|
|
324
|
+
}
|
|
325
|
+
function n(l) {
|
|
326
|
+
t.value.perPage = l;
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
pagination: t,
|
|
330
|
+
updateCurrentPage: e,
|
|
331
|
+
updatePerPage: n
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function Re(s, t, e) {
|
|
335
|
+
return {
|
|
336
|
+
bodyRows: h(() => {
|
|
337
|
+
const l = t.value.perPage * (t.value.currentPage - 1), a = t.value.perPage * t.value.currentPage;
|
|
338
|
+
return Se(s, u(e), l, a);
|
|
321
339
|
})
|
|
322
340
|
};
|
|
323
341
|
}
|
|
324
|
-
function
|
|
325
|
-
const
|
|
342
|
+
function De(s) {
|
|
343
|
+
const t = u(s) ?? [];
|
|
326
344
|
return {
|
|
327
|
-
headers:
|
|
345
|
+
headers: h(() => D(t, R(t)))
|
|
328
346
|
};
|
|
329
347
|
}
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
], xe = ["id"], Fe = /* @__PURE__ */ E({
|
|
335
|
-
__name: "VueyeBody",
|
|
336
|
-
props: {
|
|
337
|
-
loading: { type: Boolean, default: !1 },
|
|
338
|
-
bodyRows: { default: () => [] },
|
|
339
|
-
itemValue: { default: "id" }
|
|
340
|
-
},
|
|
341
|
-
setup(a) {
|
|
342
|
-
const n = a, e = P(() => Object.keys(n.bodyRows[0]).length);
|
|
343
|
-
return (t, r) => (f(), g("tbody", null, [
|
|
344
|
-
t.loading ? (f(), g("tr", je, [
|
|
345
|
-
u("td", { colspan: p(e) }, We, 8, De)
|
|
346
|
-
])) : (f(!0), g(w, { key: 1 }, $(t.bodyRows, (o) => (f(), g("tr", {
|
|
347
|
-
key: o[t.itemValue]
|
|
348
|
-
}, [
|
|
349
|
-
k(t.$slots, "default", { row: o }, () => [
|
|
350
|
-
(f(!0), g(w, null, $(Object.keys(o), (c) => (f(), g("td", {
|
|
351
|
-
key: `${o[t.itemValue]}.${c}`,
|
|
352
|
-
id: `${o[t.itemValue]}.${c}`
|
|
353
|
-
}, [
|
|
354
|
-
k(t.$slots, "default", {
|
|
355
|
-
cell: o[c],
|
|
356
|
-
key: `${o[t.itemValue]}.${c}`
|
|
357
|
-
}, () => [
|
|
358
|
-
G(y(o[c]), 1)
|
|
359
|
-
])
|
|
360
|
-
], 8, xe))), 128))
|
|
361
|
-
])
|
|
362
|
-
]))), 128))
|
|
363
|
-
]));
|
|
364
|
-
}
|
|
365
|
-
}), Ue = ["colspan", "rowspan", "scope"], ze = /* @__PURE__ */ E({
|
|
366
|
-
__name: "VueyeHead",
|
|
367
|
-
props: {
|
|
368
|
-
columnHeaders: { default: () => [] }
|
|
369
|
-
},
|
|
370
|
-
setup(a) {
|
|
371
|
-
return (n, e) => (f(), g("thead", null, [
|
|
372
|
-
(f(!0), g(w, null, $(n.columnHeaders, (t, r) => (f(), g("tr", { key: r }, [
|
|
373
|
-
(f(!0), g(w, null, $(t, (o) => k(n.$slots, `headerCell.${o.key}`, {
|
|
374
|
-
key: o.key,
|
|
375
|
-
headerCell: o
|
|
376
|
-
}, () => [
|
|
377
|
-
u("th", {
|
|
378
|
-
colspan: o.colSpan,
|
|
379
|
-
rowspan: o.rowSpan,
|
|
380
|
-
scope: o.scope,
|
|
381
|
-
class: S([o.className, "th"])
|
|
382
|
-
}, [
|
|
383
|
-
k(n.$slots, `headerCellContent.${o.key}`, { headerCellContent: o }, () => [
|
|
384
|
-
u("span", {
|
|
385
|
-
class: S(o.labelClassName)
|
|
386
|
-
}, y(o.label), 3)
|
|
387
|
-
])
|
|
388
|
-
], 10, Ue)
|
|
389
|
-
])), 128))
|
|
390
|
-
]))), 128))
|
|
391
|
-
]));
|
|
392
|
-
}
|
|
393
|
-
}), qe = { class: "table__wrapper" }, Ge = { class: "table__caption" }, Je = { class: "table__summary" }, Qe = { class: "table__pagination-wrapper" }, et = /* @__PURE__ */ E({
|
|
348
|
+
const Ee = { class: "table__wrapper" }, He = {
|
|
349
|
+
key: 0,
|
|
350
|
+
class: "table__caption"
|
|
351
|
+
}, Ne = { class: "table__summary" }, Te = { class: "table__pagination-wrapper" }, Ie = /* @__PURE__ */ C({
|
|
394
352
|
inheritAttrs: !1,
|
|
395
353
|
__name: "VueyeTable",
|
|
396
|
-
props: {
|
|
397
|
-
itemValue: {
|
|
398
|
-
columnHeaders: {
|
|
399
|
-
data: {
|
|
400
|
-
perPage: {
|
|
401
|
-
currentPage: {
|
|
402
|
-
perPageOptions: {
|
|
403
|
-
loading: { type: Boolean
|
|
404
|
-
selectable: { type: Boolean
|
|
405
|
-
caption: {
|
|
406
|
-
summary: {
|
|
407
|
-
},
|
|
408
|
-
setup(
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
function h(l) {
|
|
414
|
-
t.value.currentPage = l;
|
|
415
|
-
}
|
|
416
|
-
function b(l) {
|
|
417
|
-
t.value.perPage = l;
|
|
418
|
-
}
|
|
419
|
-
return (l, m) => (f(), g("div", qe, [
|
|
420
|
-
u("table", {
|
|
421
|
-
class: S(l.$attrs.class ?? "table")
|
|
354
|
+
props: H({
|
|
355
|
+
itemValue: {},
|
|
356
|
+
columnHeaders: {},
|
|
357
|
+
data: {},
|
|
358
|
+
perPage: {},
|
|
359
|
+
currentPage: {},
|
|
360
|
+
perPageOptions: {},
|
|
361
|
+
loading: { type: Boolean },
|
|
362
|
+
selectable: { type: Boolean },
|
|
363
|
+
caption: {},
|
|
364
|
+
summary: {}
|
|
365
|
+
}, A),
|
|
366
|
+
setup(s) {
|
|
367
|
+
const t = s, e = U(() => t.columnHeaders), { headers: n } = De(e), l = K(), a = Object.keys(l).filter((p) => p.startsWith("headerCell")), { pagination: c, updateCurrentPage: P, updatePerPage: y } = Be(t), { bodyRows: _ } = Re(t.data, c, e);
|
|
368
|
+
return (p, w) => (i(), d("div", Ee, [
|
|
369
|
+
r("table", {
|
|
370
|
+
class: k(p.$attrs.class ?? "table")
|
|
422
371
|
}, [
|
|
423
|
-
|
|
424
|
-
|
|
372
|
+
m(p.$slots, "caption", {}, () => [
|
|
373
|
+
p.caption ? (i(), d("caption", He, f(p.caption), 1)) : B("", !0)
|
|
425
374
|
]),
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
name:
|
|
429
|
-
fn:
|
|
430
|
-
|
|
375
|
+
O(u(se), { columnHeaders: u(n) }, M({ _: 2 }, [
|
|
376
|
+
v(u(a), (b) => ({
|
|
377
|
+
name: b,
|
|
378
|
+
fn: I((o) => [
|
|
379
|
+
m(p.$slots, b, L(z(o)))
|
|
431
380
|
])
|
|
432
381
|
}))
|
|
433
382
|
]), 1032, ["columnHeaders"]),
|
|
434
|
-
|
|
435
|
-
bodyRows:
|
|
436
|
-
loading:
|
|
383
|
+
O(u(ne), {
|
|
384
|
+
bodyRows: u(_),
|
|
385
|
+
loading: p.loading
|
|
437
386
|
}, null, 8, ["bodyRows", "loading"]),
|
|
438
|
-
|
|
439
|
-
|
|
387
|
+
m(p.$slots, "summary", {}, () => [
|
|
388
|
+
r("caption", Ne, f(p.summary), 1)
|
|
440
389
|
])
|
|
441
390
|
], 2),
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
perPage:
|
|
445
|
-
currentPage:
|
|
446
|
-
perPageOptions:
|
|
447
|
-
total:
|
|
448
|
-
"onUpdate:currentPage":
|
|
449
|
-
"onUpdate:perPage":
|
|
450
|
-
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total"])
|
|
391
|
+
r("div", Te, [
|
|
392
|
+
O(u(we), {
|
|
393
|
+
perPage: u(c).perPage,
|
|
394
|
+
currentPage: u(c).currentPage,
|
|
395
|
+
perPageOptions: p.perPageOptions,
|
|
396
|
+
total: p.data.length,
|
|
397
|
+
"onUpdate:currentPage": u(P),
|
|
398
|
+
"onUpdate:perPage": u(y)
|
|
399
|
+
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total", "onUpdate:currentPage", "onUpdate:perPage"])
|
|
451
400
|
])
|
|
452
401
|
]));
|
|
453
402
|
}
|
|
454
403
|
});
|
|
455
|
-
function tt(a) {
|
|
456
|
-
return {
|
|
457
|
-
headerKeys: P(() => N(a.flat()))
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
404
|
export {
|
|
461
|
-
|
|
462
|
-
|
|
405
|
+
Ie as VueyeTable,
|
|
406
|
+
Ke as defineColumnHeaders,
|
|
463
407
|
R as depthCount,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
408
|
+
D as flatHeadersToRows,
|
|
409
|
+
Se as getBodyRows,
|
|
410
|
+
E as getHeaderKeys,
|
|
411
|
+
N as leafCount,
|
|
412
|
+
Re as useBodyRows,
|
|
413
|
+
Me as useHeaderKeys,
|
|
414
|
+
De as useHeaders,
|
|
415
|
+
Be as usePagination
|
|
469
416
|
};
|