vueye-table 2.0.0-alpha.12 → 2.0.0-alpha.13
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/components/core/VueyeTable/components/VueyeBody/VueyeBody.vue.d.ts +1 -0
- package/dist/components/core/VueyeTable/components/VueyeBody/api.d.ts +1 -0
- package/dist/components/core/VueyeTable/components/utils/VueyeCheckbox.vue.d.ts +2 -3
- package/dist/components/core/VueyeTable/composables/useBodyRows.d.ts +1 -0
- package/dist/components/core/VueyeTable/utils/body.d.ts +2 -2
- package/dist/vueye-table.js +390 -372
- package/dist/vueye-table.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/vueye-table.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
function
|
|
1
|
+
import { openBlock as g, createElementBlock as b, createElementVNode as d, defineComponent as L, mergeDefaults as D, ref as C, computed as m, watchEffect as Y, unref as c, toDisplayString as P, createVNode as $, createCommentVNode as z, withDirectives as F, normalizeClass as K, Fragment as j, renderList as R, vShow as q, nextTick as te, mergeProps as ne, isRef as A, vModelCheckbox as oe, createStaticVNode as le, renderSlot as y, createTextVNode as J, watch as se, toValue as S, useSlots as ae, createSlots as X, withCtx as O, normalizeProps as M, guardReactiveProps as H } from "vue";
|
|
2
|
+
function re(t) {
|
|
3
3
|
return t.replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/(?:^|\s)\S/g, (n) => n.toUpperCase()).trim().replace(/\s\s+/g, " ");
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function Q(t) {
|
|
6
6
|
let n = 1;
|
|
7
7
|
return t.forEach((e) => {
|
|
8
|
-
e.children && (n = Math.max(n,
|
|
8
|
+
e.children && (n = Math.max(n, Q(e.children) + 1));
|
|
9
9
|
}), n;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function W(t) {
|
|
12
12
|
let n = 0;
|
|
13
13
|
return t.forEach((e) => {
|
|
14
|
-
e.children ? n +=
|
|
14
|
+
e.children ? n += W(e.children) : n++;
|
|
15
15
|
}), n;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return t.forEach((
|
|
19
|
-
if (e[o] || (e[o] = []),
|
|
20
|
-
const { children:
|
|
17
|
+
function Z(t, n, e = [], o = 0, s = 0, a = "") {
|
|
18
|
+
return t.forEach((u) => {
|
|
19
|
+
if (e[o] || (e[o] = []), u.children) {
|
|
20
|
+
const { children: h, ...r } = u, l = W(h);
|
|
21
21
|
e[o].push({
|
|
22
|
-
...
|
|
22
|
+
...r,
|
|
23
23
|
colSpan: l,
|
|
24
24
|
scope: "colgroup"
|
|
25
|
-
}),
|
|
25
|
+
}), Z(h, n, e, o + 1, s + 1, `${a}${u.key}.`);
|
|
26
26
|
} else {
|
|
27
|
-
const
|
|
27
|
+
const h = n - s;
|
|
28
28
|
e[o].push({
|
|
29
|
-
...
|
|
30
|
-
key:
|
|
31
|
-
fullKey: `${
|
|
32
|
-
label:
|
|
33
|
-
rowSpan:
|
|
29
|
+
...u,
|
|
30
|
+
key: u.key,
|
|
31
|
+
fullKey: `${a}${u.key}`,
|
|
32
|
+
label: u.label,
|
|
33
|
+
rowSpan: h,
|
|
34
34
|
scope: "col",
|
|
35
|
-
sortable: Object.prototype.hasOwnProperty.call(
|
|
35
|
+
sortable: Object.prototype.hasOwnProperty.call(u, "sortable") ? u.sortable : !0
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}), e;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function I(t, n = "", e = []) {
|
|
41
41
|
return t.forEach((o) => {
|
|
42
|
-
o.children ?
|
|
42
|
+
o.children ? I(o.children, `${n}${o.key}.`, e) : e.push(`${n}${o.key}`);
|
|
43
43
|
}), e;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const n =
|
|
47
|
-
return
|
|
45
|
+
function At(t) {
|
|
46
|
+
const n = Q(t);
|
|
47
|
+
return Z(t, n).reduce((s, a) => [...s, ...a], []);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function G(t) {
|
|
50
50
|
const n = [];
|
|
51
51
|
for (const e in t) {
|
|
52
|
-
const o =
|
|
52
|
+
const o = re(e), s = {
|
|
53
53
|
key: e,
|
|
54
54
|
label: o
|
|
55
55
|
};
|
|
56
56
|
if (typeof t[e] == "object" && t[e] !== null) {
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const a = G(t[e]);
|
|
58
|
+
a.length > 0 && (s.children = a);
|
|
59
59
|
}
|
|
60
60
|
n.push(s);
|
|
61
61
|
}
|
|
62
62
|
return n;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
64
|
+
const ce = (t, n) => {
|
|
65
65
|
const e = n.split(".");
|
|
66
66
|
let o = t;
|
|
67
67
|
for (let s = 0; s < e.length; s++)
|
|
@@ -71,39 +71,40 @@ const ae = (t, n) => {
|
|
|
71
71
|
return;
|
|
72
72
|
return o;
|
|
73
73
|
};
|
|
74
|
-
function
|
|
75
|
-
return t.map((e) =>
|
|
76
|
-
[
|
|
77
|
-
|
|
74
|
+
function ie(t, n) {
|
|
75
|
+
return t.map((e) => n.map((a) => ({
|
|
76
|
+
[a]: ce(e, a)
|
|
77
|
+
// ...row,
|
|
78
|
+
})).reduce((a, u) => ({ ...a, ...u }), {}));
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function ue(t, n = 0, e = t.length) {
|
|
80
81
|
return t.slice(n, e);
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function x(t) {
|
|
83
84
|
const n = {};
|
|
84
85
|
for (const [e, o] of Object.entries(t))
|
|
85
86
|
if (e.includes(".")) {
|
|
86
|
-
const [s,
|
|
87
|
-
n[s] || (n[s] = {}), n[s][
|
|
87
|
+
const [s, a] = e.split(".");
|
|
88
|
+
n[s] || (n[s] = {}), n[s][a] = o;
|
|
88
89
|
} else
|
|
89
90
|
n[e] = o;
|
|
90
91
|
for (const [e, o] of Object.entries(n))
|
|
91
|
-
typeof o == "object" && (n[e] =
|
|
92
|
+
typeof o == "object" && (n[e] = x(o));
|
|
92
93
|
return n;
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function de(t) {
|
|
95
96
|
const n = [];
|
|
96
97
|
for (const e in t)
|
|
97
|
-
typeof t[e] == "object" ? n.push(...
|
|
98
|
+
typeof t[e] == "object" ? n.push(...de(t[e])) : n.push(t[e]);
|
|
98
99
|
return n;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function pe(t) {
|
|
101
102
|
return typeof t != "function" || typeof t != "object";
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function It(t) {
|
|
104
105
|
return (n, e, o) => t(n, e, o);
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function _e() {
|
|
107
108
|
return {
|
|
108
109
|
itemValue: "id",
|
|
109
110
|
columnHeaders: () => [],
|
|
@@ -119,12 +120,12 @@ function de() {
|
|
|
119
120
|
filterQuery: "",
|
|
120
121
|
filterBy: void 0,
|
|
121
122
|
filterMethod: (t, n, e) => t === "" || t === void 0 || e === void 0 || e.length === 0 ? !0 : e == null ? void 0 : e.some((s) => {
|
|
122
|
-
const
|
|
123
|
-
return
|
|
123
|
+
const a = n[s];
|
|
124
|
+
return pe(a) ? a == null ? void 0 : a.toString().toLowerCase().includes(t.toLowerCase()) : !1;
|
|
124
125
|
})
|
|
125
126
|
};
|
|
126
127
|
}
|
|
127
|
-
const
|
|
128
|
+
const he = {
|
|
128
129
|
options: () => [],
|
|
129
130
|
modelValue: "",
|
|
130
131
|
label: ""
|
|
@@ -133,99 +134,99 @@ const pe = {
|
|
|
133
134
|
for (const [o, s] of n)
|
|
134
135
|
e[o] = s;
|
|
135
136
|
return e;
|
|
136
|
-
},
|
|
137
|
+
}, ge = {}, be = {
|
|
137
138
|
xmlns: "http://www.w3.org/2000/svg",
|
|
138
139
|
width: "1em",
|
|
139
140
|
height: "1em",
|
|
140
141
|
viewBox: "0 0 24 24"
|
|
141
|
-
},
|
|
142
|
+
}, fe = /* @__PURE__ */ d("path", {
|
|
142
143
|
fill: "none",
|
|
143
144
|
stroke: "currentColor",
|
|
144
145
|
"stroke-linecap": "round",
|
|
145
146
|
"stroke-linejoin": "round",
|
|
146
147
|
"stroke-width": "1.5",
|
|
147
148
|
d: "m19 9l-7 6l-7-6"
|
|
148
|
-
}, null, -1),
|
|
149
|
-
|
|
149
|
+
}, null, -1), me = [
|
|
150
|
+
fe
|
|
150
151
|
];
|
|
151
|
-
function
|
|
152
|
-
return
|
|
152
|
+
function ye(t, n) {
|
|
153
|
+
return g(), b("svg", be, me);
|
|
153
154
|
}
|
|
154
|
-
const
|
|
155
|
+
const ve = /* @__PURE__ */ U(ge, [["render", ye]]), we = { class: "table__dropdown-wrapper" }, ke = ["aria-expanded"], $e = {
|
|
155
156
|
class: "py-1",
|
|
156
157
|
role: "none"
|
|
157
|
-
},
|
|
158
|
+
}, Pe = ["onClick"], Ce = /* @__PURE__ */ L({
|
|
158
159
|
__name: "VueyeDropdown",
|
|
159
|
-
props:
|
|
160
|
+
props: D({
|
|
160
161
|
options: {},
|
|
161
162
|
modelValue: {},
|
|
162
163
|
label: {},
|
|
163
164
|
defaultValue: {}
|
|
164
|
-
},
|
|
165
|
+
}, he),
|
|
165
166
|
emits: ["update:modelValue"],
|
|
166
167
|
setup(t, { emit: n }) {
|
|
167
|
-
const e = t, o =
|
|
168
|
-
async function
|
|
169
|
-
var
|
|
168
|
+
const e = t, o = C(!1), s = C(-1), a = C(null), u = C(null), h = C(!0), r = m(() => s.value === -1 ? e.options[0] : e.options[s.value]), l = `dropdown-label-${Math.random().toString(36).substring(2, 9)}`;
|
|
169
|
+
async function i() {
|
|
170
|
+
var v, p;
|
|
170
171
|
if (o.value = !o.value, o.value) {
|
|
171
|
-
await
|
|
172
|
-
const
|
|
173
|
-
|
|
172
|
+
await te();
|
|
173
|
+
const k = ((v = a.value) == null ? void 0 : v.getBoundingClientRect()) ?? { bottom: 0 }, V = ((p = u.value) == null ? void 0 : p.offsetHeight) ?? 200;
|
|
174
|
+
h.value = window.innerHeight - (k == null ? void 0 : k.bottom) > V;
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
-
s.value =
|
|
177
|
+
function _(v) {
|
|
178
|
+
s.value = v, o.value = !1, n("update:modelValue", r.value.content);
|
|
178
179
|
}
|
|
179
|
-
return
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
}), (
|
|
183
|
-
|
|
180
|
+
return Y(() => {
|
|
181
|
+
const v = e.options.findIndex((p) => p.content === e.modelValue);
|
|
182
|
+
v !== -1 && (s.value = v), e.modelValue === void 0 && (s.value = -1);
|
|
183
|
+
}), (v, p) => (g(), b("div", we, [
|
|
184
|
+
d("button", {
|
|
184
185
|
type: "button",
|
|
185
186
|
class: "table__dropdown-trigger",
|
|
186
|
-
onClick:
|
|
187
|
+
onClick: i,
|
|
187
188
|
"aria-expanded": c(o),
|
|
188
189
|
"aria-haspopup": !0,
|
|
189
190
|
ref_key: "buttonRef",
|
|
190
|
-
ref:
|
|
191
|
+
ref: a
|
|
191
192
|
}, [
|
|
192
|
-
|
|
193
|
-
$(
|
|
194
|
-
], 8,
|
|
195
|
-
c(o) ? (
|
|
193
|
+
d("span", null, P(c(r).label), 1),
|
|
194
|
+
$(ve)
|
|
195
|
+
], 8, ke),
|
|
196
|
+
c(o) ? (g(), b("div", {
|
|
196
197
|
key: 0,
|
|
197
198
|
class: "table__dropdown-overlay",
|
|
198
|
-
onClick:
|
|
199
|
-
})) :
|
|
200
|
-
|
|
201
|
-
class:
|
|
199
|
+
onClick: i
|
|
200
|
+
})) : z("", !0),
|
|
201
|
+
F(d("div", {
|
|
202
|
+
class: K(["table__dropdown-menu", { "table__dropdown-menu--top": !c(h) }]),
|
|
202
203
|
role: "menu",
|
|
203
204
|
"aria-orientation": "vertical",
|
|
204
205
|
"aria-labelledby": l,
|
|
205
206
|
ref_key: "dropdownMenuRef",
|
|
206
|
-
ref:
|
|
207
|
+
ref: u
|
|
207
208
|
}, [
|
|
208
|
-
|
|
209
|
-
(
|
|
210
|
-
key:
|
|
211
|
-
class:
|
|
212
|
-
"table__dropdown-menu-item--selected ":
|
|
209
|
+
d("div", $e, [
|
|
210
|
+
(g(!0), b(j, null, R(v.options, (k, V) => (g(), b("button", {
|
|
211
|
+
key: V,
|
|
212
|
+
class: K([{
|
|
213
|
+
"table__dropdown-menu-item--selected ": V === c(s)
|
|
213
214
|
}, "table__dropdown-menu-item"]),
|
|
214
215
|
role: "menuitem",
|
|
215
|
-
onClick: (
|
|
216
|
-
}, P(
|
|
216
|
+
onClick: (B) => _(V)
|
|
217
|
+
}, P(k.label), 11, Pe))), 128))
|
|
217
218
|
])
|
|
218
219
|
], 2), [
|
|
219
|
-
[
|
|
220
|
+
[q, c(o)]
|
|
220
221
|
])
|
|
221
222
|
]));
|
|
222
223
|
}
|
|
223
|
-
}),
|
|
224
|
+
}), Ve = {
|
|
224
225
|
loading: !1,
|
|
225
226
|
bodyRows: () => [],
|
|
226
227
|
itemValue: "id",
|
|
227
228
|
columnsLength: 0
|
|
228
|
-
},
|
|
229
|
+
}, Se = ["id", "checked", "indeterminate"], Ke = ["for"], Oe = /* @__PURE__ */ le('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="1.5"><path class="rounded-square" d="M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2c4.714 0 7.071 0 8.535 1.464C22 4.93 22 7.286 22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z"></path><path class="checkmark" stroke-linecap="round" stroke-linejoin="round" d="m8.5 12.5l2 2l5-5"></path><path class="indeterminate" stroke-linecap="round" stroke-linejoin="round" d="M6 12h12"></path></g></svg>', 1), ee = /* @__PURE__ */ L({
|
|
229
230
|
inheritAttrs: !1,
|
|
230
231
|
__name: "VueyeCheckbox",
|
|
231
232
|
props: {
|
|
@@ -233,127 +234,128 @@ const me = /* @__PURE__ */ U(_e, [["render", fe]]), ve = { class: "table__dropdo
|
|
|
233
234
|
id: String,
|
|
234
235
|
label: String,
|
|
235
236
|
indeterminate: Boolean,
|
|
236
|
-
modelValue: Boolean
|
|
237
|
+
modelValue: [Boolean, Array]
|
|
237
238
|
},
|
|
238
239
|
emits: ["change", "update:modelValue"],
|
|
239
240
|
setup(t, { emit: n }) {
|
|
240
|
-
const e = t, o =
|
|
241
|
+
const e = t, o = C(e.modelValue), s = m({
|
|
241
242
|
get() {
|
|
242
243
|
return e.modelValue;
|
|
243
244
|
},
|
|
244
|
-
set(
|
|
245
|
-
n("update:modelValue",
|
|
245
|
+
set(u) {
|
|
246
|
+
n("update:modelValue", u);
|
|
246
247
|
}
|
|
247
|
-
}),
|
|
248
|
-
n("change",
|
|
248
|
+
}), a = (u) => {
|
|
249
|
+
n("change", u);
|
|
249
250
|
};
|
|
250
|
-
return (
|
|
251
|
-
class:
|
|
251
|
+
return (u, h) => (g(), b("div", {
|
|
252
|
+
class: K(["table__checkbox", { "table__checkbox--checked": o.value, "table__checkbox--indeterminate": t.indeterminate }])
|
|
252
253
|
}, [
|
|
253
|
-
|
|
254
|
+
F(d("input", ne({
|
|
254
255
|
id: t.id,
|
|
255
256
|
type: "checkbox",
|
|
256
257
|
checked: o.value,
|
|
257
|
-
"onUpdate:modelValue":
|
|
258
|
+
"onUpdate:modelValue": h[0] || (h[0] = (r) => A(s) ? s.value = r : null),
|
|
258
259
|
indeterminate: t.indeterminate,
|
|
259
|
-
onChange:
|
|
260
|
+
onChange: a,
|
|
260
261
|
"aria-labelledby": "checkboxLabel"
|
|
261
|
-
},
|
|
262
|
-
[
|
|
262
|
+
}, u.$attrs), null, 16, Se), [
|
|
263
|
+
[oe, c(s)]
|
|
263
264
|
]),
|
|
264
|
-
|
|
265
|
+
d("label", {
|
|
265
266
|
for: t.id,
|
|
266
267
|
id: "checkboxLabel"
|
|
267
|
-
}, P(t.label), 9,
|
|
268
|
-
|
|
268
|
+
}, P(t.label), 9, Ke),
|
|
269
|
+
Oe
|
|
269
270
|
], 2));
|
|
270
271
|
}
|
|
271
272
|
});
|
|
272
|
-
const
|
|
273
|
+
const Re = { class: "table__body" }, Be = {
|
|
273
274
|
key: 0,
|
|
274
275
|
class: "table__row table__row--loading"
|
|
275
|
-
},
|
|
276
|
+
}, Le = ["colspan"], Me = {
|
|
276
277
|
key: 1,
|
|
277
278
|
class: "table__row table__row--empty"
|
|
278
|
-
},
|
|
279
|
+
}, He = ["colspan"], je = /* @__PURE__ */ d("div", { class: "text-center" }, "No data available", -1), De = { class: "table__row" }, Ue = { class: "table__cell table_cell--checkbox" }, Ne = { class: "table__cell" }, Ae = /* @__PURE__ */ L({
|
|
279
280
|
__name: "VueyeBody",
|
|
280
|
-
props:
|
|
281
|
+
props: D({
|
|
281
282
|
loading: { type: Boolean },
|
|
282
283
|
bodyRows: {},
|
|
284
|
+
notListedKeys: {},
|
|
283
285
|
itemValue: {},
|
|
284
286
|
columnsLength: {},
|
|
285
287
|
selected: {}
|
|
286
|
-
},
|
|
288
|
+
}, Ve),
|
|
287
289
|
emits: ["update:selected"],
|
|
288
290
|
setup(t, { emit: n }) {
|
|
289
|
-
const e = t, o =
|
|
290
|
-
(
|
|
291
|
-
...
|
|
291
|
+
const e = t, o = m(() => Object.keys(e.bodyRows[0]).filter((r) => !e.notListedKeys.includes(r))), s = m(() => o.value.reduce(
|
|
292
|
+
(r, l) => ({
|
|
293
|
+
...r,
|
|
292
294
|
[l]: l.split(".").pop() ?? ""
|
|
293
295
|
}),
|
|
294
296
|
{}
|
|
295
|
-
)),
|
|
296
|
-
flat:
|
|
297
|
-
nest:
|
|
298
|
-
}))),
|
|
297
|
+
)), a = m(() => e.bodyRows.map((r) => ({
|
|
298
|
+
flat: r,
|
|
299
|
+
nest: x(r)
|
|
300
|
+
}))), u = m(() => a.value.map((r) => r.nest)), h = m({
|
|
299
301
|
get() {
|
|
300
302
|
return e.selected;
|
|
301
303
|
},
|
|
302
|
-
set(
|
|
303
|
-
n("update:selected",
|
|
304
|
+
set(r) {
|
|
305
|
+
n("update:selected", r);
|
|
304
306
|
}
|
|
305
307
|
});
|
|
306
|
-
return (
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
colspan:
|
|
308
|
+
return (r, l) => y(r.$slots, "body", { rows: r.bodyRows }, () => [
|
|
309
|
+
d("tbody", Re, [
|
|
310
|
+
r.loading ? (g(), b("tr", Be, [
|
|
311
|
+
d("td", {
|
|
312
|
+
colspan: r.columnsLength,
|
|
311
313
|
class: "table__cell table__cell--loading"
|
|
312
314
|
}, [
|
|
313
|
-
|
|
314
|
-
|
|
315
|
+
y(r.$slots, "loading", {}, () => [
|
|
316
|
+
J(" Loading... ")
|
|
315
317
|
])
|
|
316
|
-
], 8,
|
|
317
|
-
])) :
|
|
318
|
-
|
|
318
|
+
], 8, Le)
|
|
319
|
+
])) : r.bodyRows.length === 0 ? (g(), b("tr", Me, [
|
|
320
|
+
d("td", {
|
|
319
321
|
class: "table__cell",
|
|
320
|
-
colspan:
|
|
322
|
+
colspan: r.columnsLength
|
|
321
323
|
}, [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
+
y(r.$slots, "empty", {}, () => [
|
|
325
|
+
je
|
|
324
326
|
])
|
|
325
|
-
], 8,
|
|
326
|
-
])) :
|
|
327
|
+
], 8, He)
|
|
328
|
+
])) : y(r.$slots, "rows", {
|
|
327
329
|
key: 2,
|
|
328
|
-
rows: c(
|
|
330
|
+
rows: c(u)
|
|
329
331
|
}, () => [
|
|
330
|
-
(
|
|
331
|
-
key:
|
|
332
|
-
row:
|
|
332
|
+
(g(!0), b(j, null, R(c(a), (i) => y(r.$slots, "row", {
|
|
333
|
+
key: i[r.itemValue],
|
|
334
|
+
row: i.nest
|
|
333
335
|
}, () => [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
+
d("tr", De, [
|
|
337
|
+
r.selected ? y(r.$slots, "checkbox", {
|
|
336
338
|
key: 0,
|
|
337
|
-
row:
|
|
339
|
+
row: i.nest
|
|
338
340
|
}, () => [
|
|
339
|
-
|
|
340
|
-
$(
|
|
341
|
-
modelValue: c(
|
|
342
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
343
|
-
value:
|
|
341
|
+
d("td", Ue, [
|
|
342
|
+
$(ee, {
|
|
343
|
+
modelValue: c(h),
|
|
344
|
+
"onUpdate:modelValue": l[0] || (l[0] = (_) => A(h) ? h.value = _ : null),
|
|
345
|
+
value: i.nest,
|
|
344
346
|
"aria-label": "Select row"
|
|
345
347
|
}, null, 8, ["modelValue", "value"])
|
|
346
348
|
])
|
|
347
|
-
]) :
|
|
348
|
-
(
|
|
349
|
-
key: `${
|
|
350
|
-
itemCell:
|
|
349
|
+
]) : z("", !0),
|
|
350
|
+
(g(!0), b(j, null, R(c(o), (_) => y(r.$slots, `itemCell.${_}`, {
|
|
351
|
+
key: `${i[r.itemValue]}.${_}`,
|
|
352
|
+
itemCell: i.nest
|
|
351
353
|
}, () => [
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
itemCellContent:
|
|
354
|
+
d("td", Ne, [
|
|
355
|
+
y(r.$slots, `itemCellContent.${c(s)[_]}`, {
|
|
356
|
+
itemCellContent: i.nest
|
|
355
357
|
}, () => [
|
|
356
|
-
|
|
358
|
+
J(P(i.flat[_]), 1)
|
|
357
359
|
])
|
|
358
360
|
])
|
|
359
361
|
])), 128))
|
|
@@ -363,54 +365,54 @@ const Oe = { class: "table__body" }, Re = {
|
|
|
363
365
|
])
|
|
364
366
|
]);
|
|
365
367
|
}
|
|
366
|
-
}),
|
|
368
|
+
}), Ie = {
|
|
367
369
|
columnHeaders: () => [],
|
|
368
370
|
selectable: !1,
|
|
369
371
|
select: "none"
|
|
370
|
-
},
|
|
372
|
+
}, Te = {
|
|
371
373
|
xmlns: "http://www.w3.org/2000/svg",
|
|
372
374
|
width: "1em",
|
|
373
375
|
height: "1em",
|
|
374
376
|
viewBox: "0 0 16 16"
|
|
375
|
-
},
|
|
377
|
+
}, Ee = ["opacity"], ze = ["opacity"], Fe = /* @__PURE__ */ L({
|
|
376
378
|
__name: "ArrowUpDownIcon",
|
|
377
379
|
props: {
|
|
378
380
|
down: Boolean
|
|
379
381
|
},
|
|
380
382
|
setup(t) {
|
|
381
|
-
const n = t, e =
|
|
383
|
+
const n = t, e = m(() => ({
|
|
382
384
|
up: n.down ? 0.5 : 1,
|
|
383
385
|
down: n.down ? 1 : 0.5
|
|
384
386
|
}));
|
|
385
|
-
return (o, s) => (
|
|
386
|
-
|
|
387
|
+
return (o, s) => (g(), b("svg", Te, [
|
|
388
|
+
d("path", {
|
|
387
389
|
opacity: c(e).up,
|
|
388
390
|
fill: "currentColor",
|
|
389
391
|
fillRule: "evenodd",
|
|
390
392
|
d: "M2.22 5.53a.75.75 0 0 1 0-1.06l2.25-2.25a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1-1.06 1.06l-.97-.97v5.69a.75.75 0 0 1-1.5 0V4.56l-.97.97a.75.75 0 0 1-1.06 0",
|
|
391
393
|
clipRule: "evenodd"
|
|
392
|
-
}, null, 8,
|
|
393
|
-
|
|
394
|
+
}, null, 8, Ee),
|
|
395
|
+
d("path", {
|
|
394
396
|
opacity: c(e).down,
|
|
395
397
|
fill: "currentColor",
|
|
396
398
|
fillRule: "evenodd",
|
|
397
399
|
d: "M13.78 10.47a.75.75 0 0 1 0 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 1 1 1.06-1.06l.97.97V5.75a.75.75 0 0 1 1.5 0v5.69l.97-.97a.75.75 0 0 1 1.06 0",
|
|
398
400
|
clipRule: "evenodd"
|
|
399
|
-
}, null, 8,
|
|
401
|
+
}, null, 8, ze)
|
|
400
402
|
]));
|
|
401
403
|
}
|
|
402
|
-
}),
|
|
404
|
+
}), Qe = { class: "table__head" }, We = ["colspan", "rowspan", "scope"], Ze = ["onClick"], Ge = /* @__PURE__ */ L({
|
|
403
405
|
__name: "VueyeHead",
|
|
404
|
-
props:
|
|
406
|
+
props: D({
|
|
405
407
|
columnHeaders: {},
|
|
406
408
|
selectable: { type: Boolean },
|
|
407
409
|
select: {}
|
|
408
|
-
},
|
|
410
|
+
}, Ie),
|
|
409
411
|
emits: ["update:select", "sort"],
|
|
410
412
|
setup(t, { emit: n }) {
|
|
411
|
-
const e = t, o =
|
|
413
|
+
const e = t, o = C(""), s = C(!1), a = (l) => {
|
|
412
414
|
l.sortable && l.scope === "col" && (o.value === l.fullKey ? s.value = !s.value : (o.value = l.fullKey ?? "", s.value = !1), n("sort", { key: o.value, desc: s.value }));
|
|
413
|
-
},
|
|
415
|
+
}, u = m(() => e.selectable ? [
|
|
414
416
|
[
|
|
415
417
|
{
|
|
416
418
|
key: "checkbox",
|
|
@@ -423,255 +425,260 @@ const Oe = { class: "table__body" }, Re = {
|
|
|
423
425
|
...e.columnHeaders[0]
|
|
424
426
|
],
|
|
425
427
|
...e.columnHeaders.slice(1)
|
|
426
|
-
] : e.columnHeaders),
|
|
428
|
+
] : e.columnHeaders), h = m({
|
|
427
429
|
get() {
|
|
428
430
|
return e.select;
|
|
429
431
|
},
|
|
430
432
|
set(l) {
|
|
431
433
|
n("update:select", l);
|
|
432
434
|
}
|
|
433
|
-
}),
|
|
434
|
-
l.target.checked ?
|
|
435
|
+
}), r = (l) => {
|
|
436
|
+
l.target.checked ? h.value = "all" : h.value = "none";
|
|
435
437
|
};
|
|
436
|
-
return (l,
|
|
437
|
-
|
|
438
|
-
(
|
|
438
|
+
return (l, i) => y(l.$slots, "headers", { headers: l.columnHeaders }, () => [
|
|
439
|
+
d("thead", Qe, [
|
|
440
|
+
(g(!0), b(j, null, R(c(u), (_, v) => (g(), b("tr", {
|
|
439
441
|
class: "table__row table__row",
|
|
440
|
-
key:
|
|
442
|
+
key: v
|
|
441
443
|
}, [
|
|
442
|
-
(
|
|
444
|
+
(g(!0), b(j, null, R(_, (p) => y(l.$slots, `headerCell.${p.key}`, {
|
|
443
445
|
key: p.key,
|
|
444
446
|
headerItem: p
|
|
445
447
|
}, () => [
|
|
446
|
-
|
|
448
|
+
d("th", {
|
|
447
449
|
colspan: p.colSpan,
|
|
448
450
|
rowspan: p.rowSpan,
|
|
449
451
|
scope: p.scope,
|
|
450
|
-
class:
|
|
452
|
+
class: K(["table__cell table__cell--head", p.className])
|
|
451
453
|
}, [
|
|
452
|
-
p.key === "checkbox" && l.selectable ?
|
|
453
|
-
$(
|
|
454
|
-
indeterminate: c(
|
|
454
|
+
p.key === "checkbox" && l.selectable ? y(l.$slots, "checkbox", { key: 0 }, () => [
|
|
455
|
+
$(ee, {
|
|
456
|
+
indeterminate: c(h) === "indeterminate",
|
|
455
457
|
type: "checkbox",
|
|
456
|
-
checked: c(
|
|
457
|
-
onChange:
|
|
458
|
+
checked: c(h) === "all",
|
|
459
|
+
onChange: r,
|
|
458
460
|
"aria-label": "select all rows",
|
|
459
461
|
class: "table__checkbox"
|
|
460
462
|
}, null, 8, ["indeterminate", "checked"])
|
|
461
|
-
]) :
|
|
463
|
+
]) : y(l.$slots, `headerCellContent.${p.key}`, {
|
|
462
464
|
key: 1,
|
|
463
465
|
headerItem: p
|
|
464
466
|
}, () => [
|
|
465
|
-
p.scope === "col" ? (
|
|
467
|
+
p.scope === "col" ? (g(), b("button", {
|
|
466
468
|
key: 0,
|
|
467
|
-
onClick: (
|
|
469
|
+
onClick: (k) => a(p),
|
|
468
470
|
class: "table__sort-button"
|
|
469
471
|
}, [
|
|
470
|
-
|
|
471
|
-
class:
|
|
472
|
+
d("span", {
|
|
473
|
+
class: K(["table__label table__label--head", p.labelClassName])
|
|
472
474
|
}, P(p.label), 3),
|
|
473
|
-
$(
|
|
474
|
-
class:
|
|
475
|
+
$(Fe, {
|
|
476
|
+
class: K([{ "table__sort-icon--show": c(o) === p.key }, "table__sort-icon"]),
|
|
475
477
|
down: c(s)
|
|
476
478
|
}, null, 8, ["class", "down"])
|
|
477
|
-
], 8,
|
|
479
|
+
], 8, Ze)) : (g(), b("span", {
|
|
478
480
|
key: 1,
|
|
479
|
-
class:
|
|
481
|
+
class: K(["table__label table__label--head", p.labelClassName])
|
|
480
482
|
}, P(p.label), 3))
|
|
481
483
|
])
|
|
482
|
-
], 10,
|
|
484
|
+
], 10, We)
|
|
483
485
|
])), 128))
|
|
484
486
|
]))), 128))
|
|
485
487
|
])
|
|
486
488
|
]);
|
|
487
489
|
}
|
|
488
490
|
});
|
|
489
|
-
const
|
|
491
|
+
const xe = {}, Je = {
|
|
490
492
|
xmlns: "http://www.w3.org/2000/svg",
|
|
491
493
|
width: "1em",
|
|
492
494
|
height: "1em",
|
|
493
495
|
viewBox: "0 0 24 24"
|
|
494
|
-
},
|
|
496
|
+
}, Xe = /* @__PURE__ */ d("path", {
|
|
495
497
|
fill: "none",
|
|
496
498
|
stroke: "currentColor",
|
|
497
499
|
"stroke-linecap": "round",
|
|
498
500
|
"stroke-linejoin": "round",
|
|
499
501
|
"stroke-width": "1.5",
|
|
500
502
|
d: "m9 5l6 7l-6 7"
|
|
501
|
-
}, null, -1),
|
|
502
|
-
|
|
503
|
+
}, null, -1), Ye = [
|
|
504
|
+
Xe
|
|
503
505
|
];
|
|
504
|
-
function
|
|
505
|
-
return
|
|
506
|
+
function qe(t, n) {
|
|
507
|
+
return g(), b("svg", Je, Ye);
|
|
506
508
|
}
|
|
507
|
-
const
|
|
509
|
+
const et = /* @__PURE__ */ U(xe, [["render", qe]]), tt = {}, nt = {
|
|
508
510
|
xmlns: "http://www.w3.org/2000/svg",
|
|
509
511
|
width: "1em",
|
|
510
512
|
height: "1em",
|
|
511
513
|
viewBox: "0 0 24 24"
|
|
512
|
-
},
|
|
514
|
+
}, ot = /* @__PURE__ */ d("path", {
|
|
513
515
|
fill: "none",
|
|
514
516
|
stroke: "currentColor",
|
|
515
517
|
"stroke-linecap": "round",
|
|
516
518
|
"stroke-linejoin": "round",
|
|
517
519
|
"stroke-width": "1.5",
|
|
518
520
|
d: "m15 5l-6 7l6 7"
|
|
519
|
-
}, null, -1),
|
|
520
|
-
|
|
521
|
+
}, null, -1), lt = [
|
|
522
|
+
ot
|
|
521
523
|
];
|
|
522
|
-
function
|
|
523
|
-
return
|
|
524
|
+
function st(t, n) {
|
|
525
|
+
return g(), b("svg", nt, lt);
|
|
524
526
|
}
|
|
525
|
-
const
|
|
527
|
+
const at = /* @__PURE__ */ U(tt, [["render", st]]), rt = {}, ct = {
|
|
526
528
|
xmlns: "http://www.w3.org/2000/svg",
|
|
527
529
|
width: "1em",
|
|
528
530
|
height: "1em",
|
|
529
531
|
viewBox: "0 0 24 24"
|
|
530
|
-
},
|
|
532
|
+
}, it = /* @__PURE__ */ d("g", {
|
|
531
533
|
fill: "none",
|
|
532
534
|
stroke: "currentColor",
|
|
533
535
|
"stroke-linecap": "round",
|
|
534
536
|
"stroke-linejoin": "round",
|
|
535
537
|
"stroke-width": "1.5"
|
|
536
538
|
}, [
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
], -1),
|
|
540
|
-
|
|
539
|
+
/* @__PURE__ */ d("path", { d: "m11 19l6-7l-6-7" }),
|
|
540
|
+
/* @__PURE__ */ d("path", { d: "m7 19l6-7l-6-7" })
|
|
541
|
+
], -1), ut = [
|
|
542
|
+
it
|
|
541
543
|
];
|
|
542
|
-
function
|
|
543
|
-
return
|
|
544
|
+
function dt(t, n) {
|
|
545
|
+
return g(), b("svg", ct, ut);
|
|
544
546
|
}
|
|
545
|
-
const
|
|
547
|
+
const pt = /* @__PURE__ */ U(rt, [["render", dt]]), _t = {}, ht = {
|
|
546
548
|
xmlns: "http://www.w3.org/2000/svg",
|
|
547
549
|
width: "1em",
|
|
548
550
|
height: "1em",
|
|
549
551
|
viewBox: "0 0 24 24"
|
|
550
|
-
},
|
|
552
|
+
}, gt = /* @__PURE__ */ d("g", {
|
|
551
553
|
fill: "none",
|
|
552
554
|
stroke: "currentColor",
|
|
553
555
|
"stroke-linecap": "round",
|
|
554
556
|
"stroke-linejoin": "round",
|
|
555
557
|
"stroke-width": "1.5"
|
|
556
558
|
}, [
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
], -1),
|
|
560
|
-
|
|
559
|
+
/* @__PURE__ */ d("path", { d: "m13 19l-6-7l6-7" }),
|
|
560
|
+
/* @__PURE__ */ d("path", { d: "m17 19l-6-7l6-7" })
|
|
561
|
+
], -1), bt = [
|
|
562
|
+
gt
|
|
561
563
|
];
|
|
562
|
-
function
|
|
563
|
-
return
|
|
564
|
+
function ft(t, n) {
|
|
565
|
+
return g(), b("svg", ht, bt);
|
|
564
566
|
}
|
|
565
|
-
const
|
|
567
|
+
const mt = /* @__PURE__ */ U(_t, [["render", ft]]), yt = {
|
|
566
568
|
perPage: 10,
|
|
567
569
|
currentPage: 1,
|
|
568
570
|
total: 0,
|
|
569
571
|
perPageOptions: () => [10, 20, 30, 40, 50]
|
|
570
|
-
},
|
|
572
|
+
}, vt = { class: "table__pagination-wrapper" }, wt = { class: "table__pagination-details" }, kt = { class: "table__pagination-btn-list" }, $t = ["disabled"], Pt = ["disabled"], Ct = ["onClick", "aria-label"], Vt = {
|
|
571
573
|
key: 1,
|
|
572
574
|
class: "table__pagination-btn table__btn"
|
|
573
|
-
},
|
|
575
|
+
}, St = ["disabled"], Kt = ["disabled"], Ot = /* @__PURE__ */ L({
|
|
574
576
|
__name: "VueyePagination",
|
|
575
|
-
props:
|
|
577
|
+
props: D({
|
|
576
578
|
perPage: {},
|
|
577
579
|
currentPage: {},
|
|
578
580
|
total: {},
|
|
579
581
|
perPageOptions: {}
|
|
580
|
-
},
|
|
582
|
+
}, yt),
|
|
581
583
|
emits: ["update:currentPage", "update:perPage"],
|
|
582
584
|
setup(t, { emit: n }) {
|
|
583
|
-
const e = t, o =
|
|
585
|
+
const e = t, o = m(() => Math.ceil(e.total / e.perPage)), s = m(() => e.perPageOptions.map((l) => ({
|
|
584
586
|
content: l,
|
|
585
587
|
label: l.toString()
|
|
586
|
-
}))),
|
|
587
|
-
(l,
|
|
588
|
+
}))), a = m(() => s.value.find((l) => l.content === e.perPage)), u = m(() => Array.from({ length: o.value }, (l, i) => i + 1).reduce(
|
|
589
|
+
(l, i) => (i === 1 || i === e.total || i >= e.currentPage - 2 && i <= e.currentPage + 2 ? l.push(i) : (i === e.currentPage - 3 || i === e.currentPage + 3) && l.push("..."), l),
|
|
588
590
|
[]
|
|
589
591
|
));
|
|
590
|
-
function
|
|
592
|
+
function h(l) {
|
|
591
593
|
n("update:perPage", Number(l));
|
|
592
594
|
}
|
|
593
|
-
function
|
|
595
|
+
function r(l) {
|
|
594
596
|
l >= 1 && l <= o.value && n("update:currentPage", l);
|
|
595
597
|
}
|
|
596
|
-
return (l,
|
|
597
|
-
$(c(
|
|
598
|
+
return (l, i) => (g(), b("div", vt, [
|
|
599
|
+
$(c(Ce), {
|
|
598
600
|
options: c(s),
|
|
599
|
-
"default-value": c(
|
|
601
|
+
"default-value": c(a),
|
|
600
602
|
label: "Per page",
|
|
601
|
-
"onUpdate:modelValue":
|
|
603
|
+
"onUpdate:modelValue": h
|
|
602
604
|
}, null, 8, ["options", "default-value"]),
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
605
|
+
d("span", wt, P((l.currentPage - 1) * l.perPage + 1) + " - " + P(l.currentPage * l.perPage > l.total ? l.total : l.currentPage * l.perPage) + " of " + P(l.total), 1),
|
|
606
|
+
d("ul", kt, [
|
|
607
|
+
d("li", null, [
|
|
608
|
+
d("button", {
|
|
607
609
|
class: "table__pagination-btn table__btn",
|
|
608
|
-
onClick:
|
|
610
|
+
onClick: i[0] || (i[0] = (_) => r(1)),
|
|
609
611
|
disabled: l.currentPage === 1,
|
|
610
612
|
"aria-label": "First page"
|
|
611
613
|
}, [
|
|
612
|
-
$(
|
|
613
|
-
], 8,
|
|
614
|
+
$(mt)
|
|
615
|
+
], 8, $t)
|
|
614
616
|
]),
|
|
615
|
-
|
|
616
|
-
|
|
617
|
+
d("li", null, [
|
|
618
|
+
d("button", {
|
|
617
619
|
class: "table__pagination-btn table__btn",
|
|
618
|
-
onClick:
|
|
620
|
+
onClick: i[1] || (i[1] = (_) => r(e.currentPage - 1)),
|
|
619
621
|
disabled: l.currentPage === 1,
|
|
620
622
|
"aria-label": "Previous page"
|
|
621
623
|
}, [
|
|
622
|
-
$(
|
|
623
|
-
], 8,
|
|
624
|
+
$(at)
|
|
625
|
+
], 8, Pt)
|
|
624
626
|
]),
|
|
625
|
-
(
|
|
626
|
-
typeof
|
|
627
|
+
(g(!0), b(j, null, R(c(u), (_) => (g(), b("li", { key: _ }, [
|
|
628
|
+
typeof _ == "number" ? (g(), b("button", {
|
|
627
629
|
key: 0,
|
|
628
|
-
class:
|
|
629
|
-
onClick: (
|
|
630
|
-
"aria-label": "Go to page " +
|
|
631
|
-
}, P(
|
|
630
|
+
class: K(["table__pagination-btn table__btn", { "table__pagination-btn--current ": _ === l.currentPage }]),
|
|
631
|
+
onClick: (v) => r(_),
|
|
632
|
+
"aria-label": "Go to page " + _
|
|
633
|
+
}, P(_), 11, Ct)) : (g(), b("span", Vt, "..."))
|
|
632
634
|
]))), 128)),
|
|
633
|
-
|
|
634
|
-
|
|
635
|
+
d("li", null, [
|
|
636
|
+
d("button", {
|
|
635
637
|
class: "table__pagination-btn table__btn",
|
|
636
|
-
onClick:
|
|
638
|
+
onClick: i[2] || (i[2] = (_) => r(l.currentPage + 1)),
|
|
637
639
|
disabled: l.currentPage === c(o),
|
|
638
640
|
"aria-label": "Next page"
|
|
639
641
|
}, [
|
|
640
|
-
$(
|
|
641
|
-
], 8,
|
|
642
|
+
$(et)
|
|
643
|
+
], 8, St)
|
|
642
644
|
]),
|
|
643
|
-
|
|
644
|
-
|
|
645
|
+
d("li", null, [
|
|
646
|
+
d("button", {
|
|
645
647
|
class: "table__pagination-btn table__btn",
|
|
646
|
-
onClick:
|
|
648
|
+
onClick: i[3] || (i[3] = (_) => r(l.total)),
|
|
647
649
|
disabled: l.currentPage === c(o),
|
|
648
650
|
"aria-label": "Last page"
|
|
649
651
|
}, [
|
|
650
|
-
$(
|
|
651
|
-
], 8,
|
|
652
|
+
$(pt)
|
|
653
|
+
], 8, Kt)
|
|
652
654
|
])
|
|
653
655
|
])
|
|
654
656
|
]));
|
|
655
657
|
}
|
|
656
658
|
});
|
|
657
|
-
function
|
|
659
|
+
function Tt(t) {
|
|
658
660
|
return {
|
|
659
|
-
headerKeys:
|
|
661
|
+
headerKeys: m(() => I(t.flat()))
|
|
660
662
|
};
|
|
661
663
|
}
|
|
662
|
-
function
|
|
663
|
-
const e =
|
|
664
|
+
function Rt(t = {}, n) {
|
|
665
|
+
const e = C({
|
|
664
666
|
perPage: t.perPage || 10,
|
|
665
667
|
currentPage: t.currentPage || 1
|
|
666
668
|
});
|
|
667
|
-
|
|
669
|
+
Y(() => {
|
|
668
670
|
e.value.perPage = t.perPage || 10, e.value.currentPage = t.currentPage || 1;
|
|
669
|
-
})
|
|
670
|
-
|
|
671
|
-
|
|
671
|
+
}), se(
|
|
672
|
+
() => e.value.perPage,
|
|
673
|
+
(a, u) => {
|
|
674
|
+
a !== u && o(1);
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
function o(a) {
|
|
678
|
+
e.value.currentPage = a, n("update:currentPage", a);
|
|
672
679
|
}
|
|
673
|
-
function s(
|
|
674
|
-
e.value.perPage =
|
|
680
|
+
function s(a) {
|
|
681
|
+
e.value.perPage = a, n("update:perPage", a);
|
|
675
682
|
}
|
|
676
683
|
return {
|
|
677
684
|
pagination: e,
|
|
@@ -679,50 +686,60 @@ function Ot(t = {}, n) {
|
|
|
679
686
|
updatePerPage: s
|
|
680
687
|
};
|
|
681
688
|
}
|
|
682
|
-
function
|
|
683
|
-
const o =
|
|
684
|
-
function
|
|
685
|
-
o.value =
|
|
689
|
+
function Bt(t, n, e) {
|
|
690
|
+
const o = C(), s = C(!1);
|
|
691
|
+
function a({ key: r, desc: l }) {
|
|
692
|
+
o.value = r, s.value = l;
|
|
686
693
|
}
|
|
694
|
+
const u = m(() => {
|
|
695
|
+
const r = G(S(t.data)[0]), l = I(r), i = I(S(n)), _ = [], v = [...i];
|
|
696
|
+
for (const p of l)
|
|
697
|
+
i.includes(p) || (_.push(p), v.push(p));
|
|
698
|
+
return {
|
|
699
|
+
notListedKeys: _,
|
|
700
|
+
allKeys: v
|
|
701
|
+
};
|
|
702
|
+
});
|
|
687
703
|
return {
|
|
688
|
-
bodyRows:
|
|
689
|
-
const
|
|
690
|
-
var
|
|
691
|
-
return (
|
|
704
|
+
bodyRows: m(() => {
|
|
705
|
+
const r = S(e).perPage * (S(e).currentPage - 1), l = S(e).perPage * S(e).currentPage, i = ie(S(t.data), u.value.allKeys), _ = m(() => t.filterBy === void 0 || t.filterBy.length === 0 ? Object.keys(i[0]) : t.filterBy), v = i.filter((p) => {
|
|
706
|
+
var k;
|
|
707
|
+
return (k = t.filterMethod) == null ? void 0 : k.call(t, t.filterQuery, p, S(_));
|
|
692
708
|
});
|
|
693
|
-
return o.value &&
|
|
709
|
+
return o.value && v.sort((p, k) => {
|
|
694
710
|
if (!o.value)
|
|
695
711
|
return 0;
|
|
696
|
-
const
|
|
697
|
-
return
|
|
698
|
-
}),
|
|
712
|
+
const V = p[o.value], B = k[o.value];
|
|
713
|
+
return V < B ? s.value ? 1 : -1 : V > B ? s.value ? -1 : 1 : 0;
|
|
714
|
+
}), ue(v, r, l);
|
|
699
715
|
}),
|
|
700
|
-
|
|
701
|
-
|
|
716
|
+
notListedKeys: m(() => u.value.notListedKeys),
|
|
717
|
+
rowsCount: m(() => S(t.data).length),
|
|
718
|
+
onSort: a
|
|
702
719
|
};
|
|
703
720
|
}
|
|
704
|
-
function
|
|
721
|
+
function Lt(t) {
|
|
705
722
|
const n = c(t) ?? [];
|
|
706
723
|
return {
|
|
707
|
-
headers:
|
|
708
|
-
headersCount:
|
|
724
|
+
headers: m(() => Z(n, Q(n))),
|
|
725
|
+
headersCount: W(n)
|
|
709
726
|
};
|
|
710
727
|
}
|
|
711
728
|
function Mt(t, n, e) {
|
|
712
|
-
const o =
|
|
729
|
+
const o = m({
|
|
713
730
|
get() {
|
|
714
|
-
var
|
|
715
|
-
return t.selected === null || ((
|
|
731
|
+
var a, u, h;
|
|
732
|
+
return t.selected === null || ((a = t.selected) == null ? void 0 : a.length) === 0 ? "none" : ((u = t.selected) == null ? void 0 : u.length) === t.data.length || t.selectMode === "page" && ((h = t.selected) == null ? void 0 : h.length) === n.value.length ? "all" : "indeterminate";
|
|
716
733
|
},
|
|
717
|
-
set(
|
|
718
|
-
|
|
734
|
+
set(a) {
|
|
735
|
+
a === "all" ? t.selectMode === "page" ? s.value = n.value.map((u) => x(u)) : s.value = t.data : a === "none" && (s.value = []);
|
|
719
736
|
}
|
|
720
|
-
}), s =
|
|
737
|
+
}), s = m({
|
|
721
738
|
get() {
|
|
722
739
|
return t.selected;
|
|
723
740
|
},
|
|
724
|
-
set(
|
|
725
|
-
e("update:selected",
|
|
741
|
+
set(a) {
|
|
742
|
+
e("update:selected", a);
|
|
726
743
|
}
|
|
727
744
|
});
|
|
728
745
|
return {
|
|
@@ -730,13 +747,13 @@ function Mt(t, n, e) {
|
|
|
730
747
|
selected: s
|
|
731
748
|
};
|
|
732
749
|
}
|
|
733
|
-
const
|
|
750
|
+
const Ht = { class: "table__wrapper" }, jt = {
|
|
734
751
|
key: 0,
|
|
735
752
|
class: "table__caption"
|
|
736
|
-
},
|
|
753
|
+
}, Dt = { class: "table__summary" }, Et = /* @__PURE__ */ L({
|
|
737
754
|
inheritAttrs: !1,
|
|
738
755
|
__name: "VueyeTable",
|
|
739
|
-
props:
|
|
756
|
+
props: D({
|
|
740
757
|
data: {},
|
|
741
758
|
columnHeaders: {},
|
|
742
759
|
itemValue: {},
|
|
@@ -751,96 +768,97 @@ const jt = { class: "table__wrapper" }, Dt = {
|
|
|
751
768
|
filterQuery: {},
|
|
752
769
|
filterBy: {},
|
|
753
770
|
filterMethod: { type: Function }
|
|
754
|
-
},
|
|
771
|
+
}, _e()),
|
|
755
772
|
emits: ["update:currentPage", "update:perPage", "update:loading", "update:selected"],
|
|
756
773
|
setup(t, { emit: n }) {
|
|
757
|
-
const e = t, o =
|
|
758
|
-
() => e.columnHeaders.length === 0 ?
|
|
759
|
-
), { headers: s, headersCount:
|
|
760
|
-
return (f, N) => (
|
|
761
|
-
|
|
762
|
-
class:
|
|
774
|
+
const e = t, o = m(
|
|
775
|
+
() => e.columnHeaders.length === 0 ? G(e.data[0]) : e.columnHeaders
|
|
776
|
+
), { headers: s, headersCount: a } = Lt(o), u = ae(), h = Object.keys(u).filter((f) => f.startsWith("headerCell")), r = Object.keys(u).filter((f) => f.startsWith("itemCell")), { pagination: l, updateCurrentPage: i, updatePerPage: _ } = Rt(e, n), { bodyRows: v, rowsCount: p, notListedKeys: k, onSort: V } = Bt(e, o, l), { selected: B, selectAll: T } = Mt(e, v, n);
|
|
777
|
+
return (f, N) => (g(), b("div", Ht, [
|
|
778
|
+
d("table", {
|
|
779
|
+
class: K(f.$attrs.class ?? "table")
|
|
763
780
|
}, [
|
|
764
|
-
|
|
765
|
-
f.caption ? (
|
|
781
|
+
y(f.$slots, "caption", {}, () => [
|
|
782
|
+
f.caption ? (g(), b("caption", jt, P(f.caption), 1)) : z("", !0)
|
|
766
783
|
]),
|
|
767
|
-
$(c(
|
|
784
|
+
$(c(Ge), {
|
|
768
785
|
columnHeaders: c(s),
|
|
769
786
|
selectable: f.selected !== null,
|
|
770
|
-
select: c(
|
|
771
|
-
"onUpdate:select": N[0] || (N[0] = (
|
|
772
|
-
onSort: c(
|
|
773
|
-
},
|
|
774
|
-
headers:
|
|
775
|
-
|
|
787
|
+
select: c(T),
|
|
788
|
+
"onUpdate:select": N[0] || (N[0] = (w) => A(T) ? T.value = w : null),
|
|
789
|
+
onSort: c(V)
|
|
790
|
+
}, X({
|
|
791
|
+
headers: O((w) => [
|
|
792
|
+
y(f.$slots, "headers", M(H(w)))
|
|
776
793
|
]),
|
|
777
794
|
_: 2
|
|
778
795
|
}, [
|
|
779
|
-
|
|
780
|
-
name:
|
|
781
|
-
fn:
|
|
782
|
-
|
|
796
|
+
R(c(h), (w) => ({
|
|
797
|
+
name: w,
|
|
798
|
+
fn: O((E) => [
|
|
799
|
+
y(f.$slots, w, M(H(E)))
|
|
783
800
|
])
|
|
784
801
|
}))
|
|
785
802
|
]), 1032, ["columnHeaders", "selectable", "select", "onSort"]),
|
|
786
|
-
$(c(
|
|
787
|
-
selected: c(
|
|
788
|
-
"onUpdate:selected": N[1] || (N[1] = (
|
|
789
|
-
bodyRows: c(
|
|
803
|
+
$(c(Ae), {
|
|
804
|
+
selected: c(B),
|
|
805
|
+
"onUpdate:selected": N[1] || (N[1] = (w) => A(B) ? B.value = w : null),
|
|
806
|
+
bodyRows: c(v),
|
|
790
807
|
loading: f.loading,
|
|
791
808
|
itemValue: f.itemValue,
|
|
792
|
-
"columns-length": c(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
809
|
+
"columns-length": c(a),
|
|
810
|
+
"not-listed-keys": c(k)
|
|
811
|
+
}, X({
|
|
812
|
+
checkbox: O((w) => [
|
|
813
|
+
y(f.$slots, "checkbox", M(H(w)))
|
|
796
814
|
]),
|
|
797
|
-
loading:
|
|
798
|
-
|
|
815
|
+
loading: O(() => [
|
|
816
|
+
y(f.$slots, "loading")
|
|
799
817
|
]),
|
|
800
|
-
empty:
|
|
801
|
-
|
|
818
|
+
empty: O(() => [
|
|
819
|
+
y(f.$slots, "empty")
|
|
802
820
|
]),
|
|
803
|
-
rows:
|
|
804
|
-
|
|
821
|
+
rows: O((w) => [
|
|
822
|
+
y(f.$slots, "rows", M(H(w)))
|
|
805
823
|
]),
|
|
806
|
-
row:
|
|
807
|
-
|
|
824
|
+
row: O((w) => [
|
|
825
|
+
y(f.$slots, "row", M(H(w)))
|
|
808
826
|
]),
|
|
809
827
|
_: 2
|
|
810
828
|
}, [
|
|
811
|
-
|
|
812
|
-
name:
|
|
813
|
-
fn:
|
|
814
|
-
|
|
829
|
+
R(c(r), (w) => ({
|
|
830
|
+
name: w,
|
|
831
|
+
fn: O((E) => [
|
|
832
|
+
y(f.$slots, w, M(H(E)))
|
|
815
833
|
])
|
|
816
834
|
}))
|
|
817
|
-
]), 1032, ["selected", "bodyRows", "loading", "itemValue", "columns-length"]),
|
|
818
|
-
|
|
819
|
-
|
|
835
|
+
]), 1032, ["selected", "bodyRows", "loading", "itemValue", "columns-length", "not-listed-keys"]),
|
|
836
|
+
y(f.$slots, "summary", {}, () => [
|
|
837
|
+
d("caption", Dt, P(f.summary), 1)
|
|
820
838
|
])
|
|
821
839
|
], 2),
|
|
822
|
-
|
|
840
|
+
y(f.$slots, "pagination", {
|
|
823
841
|
pagination: { ...c(l), perPageOptions: f.perPageOptions, total: c(p) }
|
|
824
842
|
}, () => [
|
|
825
|
-
|
|
843
|
+
F($(c(Ot), {
|
|
826
844
|
perPage: c(l).perPage,
|
|
827
845
|
currentPage: c(l).currentPage,
|
|
828
846
|
perPageOptions: f.perPageOptions,
|
|
829
847
|
total: c(p),
|
|
830
|
-
"onUpdate:currentPage": c(
|
|
831
|
-
"onUpdate:perPage": c(
|
|
848
|
+
"onUpdate:currentPage": c(i),
|
|
849
|
+
"onUpdate:perPage": c(_),
|
|
832
850
|
class: "table__pagination"
|
|
833
851
|
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total", "onUpdate:currentPage", "onUpdate:perPage"]), [
|
|
834
|
-
[
|
|
852
|
+
[q, f.data.length > 0]
|
|
835
853
|
])
|
|
836
854
|
])
|
|
837
855
|
]));
|
|
838
856
|
}
|
|
839
857
|
});
|
|
840
|
-
function
|
|
858
|
+
function Ut(t) {
|
|
841
859
|
const n = [];
|
|
842
860
|
for (const e of t) {
|
|
843
|
-
const o = e.children ?
|
|
861
|
+
const o = e.children ? Ut(e.children) : void 0;
|
|
844
862
|
n.push({
|
|
845
863
|
...e,
|
|
846
864
|
children: o
|
|
@@ -849,25 +867,25 @@ function Ht(t) {
|
|
|
849
867
|
return n;
|
|
850
868
|
}
|
|
851
869
|
export {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
870
|
+
Et as VueyeTable,
|
|
871
|
+
de as deepValues,
|
|
872
|
+
At as defineColumnHeaders,
|
|
873
|
+
It as defineFilterMethod,
|
|
874
|
+
Ut as defineTableColumnHeaders,
|
|
875
|
+
Q as depthCount,
|
|
876
|
+
Z as flatHeadersToRows,
|
|
877
|
+
G as generateColumns,
|
|
878
|
+
ie as getBodyRows,
|
|
879
|
+
I as getHeaderKeys,
|
|
880
|
+
_e as getVueyeTablePropDefaults,
|
|
881
|
+
re as humanize,
|
|
882
|
+
pe as isPrimitive,
|
|
883
|
+
W as leafCount,
|
|
884
|
+
x as nestedObjectTransformer,
|
|
885
|
+
ue as paginateRows,
|
|
886
|
+
Bt as useBodyRows,
|
|
887
|
+
Tt as useHeaderKeys,
|
|
888
|
+
Lt as useHeaders,
|
|
889
|
+
Rt as usePagination,
|
|
872
890
|
Mt as useSelection
|
|
873
891
|
};
|