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