vueye-table 1.4.1 → 2.0.0-alpha.2
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 +20 -0
- package/README.md +31 -202
- package/dist/components/core/VueyeTable/VSelect.d.ts +15 -0
- package/dist/components/core/VueyeTable/VueyeBody/VueyeBody.vue.d.ts +49 -0
- package/dist/components/core/VueyeTable/VueyeBody/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/VueyeHead/VueyeHead.vue.d.ts +22 -0
- package/dist/components/core/VueyeTable/VueyeHead/index.d.ts +2 -0
- package/dist/components/core/VueyeTable/VueyePagination/VueyePagination.vue.d.ts +55 -0
- package/dist/components/core/VueyeTable/VueyePagination/index.d.ts +6 -0
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +78 -0
- package/dist/components/core/VueyeTable/composables/index.d.ts +1 -0
- package/dist/components/core/VueyeTable/composables/props/PaginationProps.d.ts +5 -0
- package/dist/components/core/VueyeTable/composables/useHeaderKeys.d.ts +4 -0
- package/dist/components/core/VueyeTable/index.d.ts +5 -0
- package/dist/components/core/VueyeTable/types/Column.d.ts +55 -0
- package/dist/components/core/VueyeTable/types/Row.d.ts +3 -0
- package/dist/components/core/VueyeTable/types/Utils.d.ts +13 -0
- package/dist/components/core/VueyeTable/types/index.d.ts +3 -0
- package/dist/components/core/VueyeTable/util-components/VueyeDropdown.vue.d.ts +53 -0
- package/dist/components/core/VueyeTable/utils/body.d.ts +4 -0
- package/dist/components/core/VueyeTable/utils/header.d.ts +6 -0
- package/dist/components/core/VueyeTable/utils/index.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/dark.d.ts +2 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/data/product.d.ts +14 -0
- package/dist/data/user.d.ts +22 -0
- package/dist/favicon.ico +0 -0
- package/dist/histoire-setup.d.ts +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +8 -0
- package/dist/vueye-table.js +469 -0
- package/dist/vueye-table.umd.cjs +1 -0
- package/dist/white-logo.ico +0 -0
- package/package.json +105 -62
- package/build/vueye-table.common.js +0 -7473
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dark';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnHeader } from '../components/core/VueyeTable';
|
|
2
|
+
export declare const headers: ColumnHeader[];
|
|
3
|
+
export declare const data: {
|
|
4
|
+
id: number;
|
|
5
|
+
product: string;
|
|
6
|
+
sales: {
|
|
7
|
+
'2022': {
|
|
8
|
+
jan: number;
|
|
9
|
+
feb: number;
|
|
10
|
+
mar: number;
|
|
11
|
+
};
|
|
12
|
+
'2023': number;
|
|
13
|
+
};
|
|
14
|
+
}[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const userHeaders: ({
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
children?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
children: {
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
})[];
|
|
13
|
+
export declare const userRows: {
|
|
14
|
+
name: string;
|
|
15
|
+
age: number;
|
|
16
|
+
address: {
|
|
17
|
+
street: string;
|
|
18
|
+
city: string;
|
|
19
|
+
state: string;
|
|
20
|
+
zip: string;
|
|
21
|
+
};
|
|
22
|
+
}[];
|
package/dist/favicon.ico
ADDED
|
Binary file
|
|
File without changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/index'
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const app: globalThis.ComponentPublicInstance;
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pagination__wrapper[data-v-d06f6d12]{display:flex;align-items:center;-moz-column-gap:.75rem;column-gap:.75rem}.pagination__details[data-v-d06f6d12]{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}[data-v-d06f6d12]:is(.dark .pagination__details){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.pagination__btn-list[data-v-d06f6d12]{display:flex}.pagination__btn[data-v-d06f6d12]{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-width:1px;--tw-border-opacity: 1;border-color:rgb(186 227 253 / var(--tw-border-opacity));background-color:transparent;padding:.5rem}.pagination__btn[data-v-d06f6d12]:disabled{cursor:not-allowed;opacity:.5}[data-v-d06f6d12]:is(.dark .pagination__btn){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity))}.pagination__btn--current[data-v-d06f6d12]{--tw-bg-opacity: 1;background-color:rgb(186 227 253 / var(--tw-bg-opacity))}[data-v-d06f6d12]:is(.dark .pagination__btn--current){--tw-bg-opacity: 1;background-color:rgb(6 83 134 / var(--tw-bg-opacity))}table{min-width:800px;border-collapse:collapse;border-radius:.25rem!important;border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));font-size:.875rem;line-height:1.25rem;letter-spacing:.025em}th{border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(224 241 254 / var(--tw-bg-opacity));padding:.5rem 1rem}:is(.dark th){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(8 44 73 / var(--tw-bg-opacity))}td{border-width:1px;--tw-border-opacity: 1;border-color:rgb(55 179 249 / var(--tw-border-opacity));padding:.5rem 1rem}:is(.dark td){--tw-border-opacity: 1;border-color:rgb(6 83 134 / var(--tw-border-opacity))}table{text-align:center}tr:nth-child(2n) td{--tw-bg-opacity: 1;background-color:rgb(224 241 254 / var(--tw-bg-opacity))}:is(.dark tr:nth-child(2n) td){--tw-bg-opacity: 1;background-color:rgb(8 44 73 / var(--tw-bg-opacity))}tr:nth-child(odd) td{--tw-bg-opacity: 1;background-color:rgb(240 248 255 / var(--tw-bg-opacity))}:is(.dark tr:nth-child(odd) td){--tw-bg-opacity: 1;background-color:rgb(11 69 111 / var(--tw-bg-opacity))}caption{padding:.5rem}.table__wrapper{display:flex;flex-direction:column;overflow-x:auto}.table__pagination-wrapper{display:flex;justify-content:flex-end;padding-top:1rem;padding-bottom:1rem}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { getCurrentScope as K, onScopeDispose as W, unref as p, watch as x, defineComponent as E, ref as O, computed as P, watchEffect as F, openBlock as f, createElementBlock as g, createElementVNode as u, toDisplayString as y, Fragment as w, renderList as $, normalizeClass as S, createCommentVNode as U, createVNode as A, pushScopeId as z, popScopeId as q, renderSlot as k, createTextVNode as G, toRef as J, useSlots as Q, createSlots as X, withCtx as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
|
|
2
|
+
function te(a) {
|
|
3
|
+
return K() ? (W(a), !0) : !1;
|
|
4
|
+
}
|
|
5
|
+
function H(a) {
|
|
6
|
+
return typeof a == "function" ? a() : p(a);
|
|
7
|
+
}
|
|
8
|
+
const M = typeof window < "u" && typeof document < "u", B = () => {
|
|
9
|
+
}, ne = /* @__PURE__ */ ae();
|
|
10
|
+
function ae() {
|
|
11
|
+
var a;
|
|
12
|
+
return M && ((a = window == null ? void 0 : window.navigator) == null ? void 0 : a.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
13
|
+
}
|
|
14
|
+
function V(a) {
|
|
15
|
+
const n = H(a);
|
|
16
|
+
return (n == null ? void 0 : n.$el) ?? n;
|
|
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 = {
|
|
79
|
+
class: "py-1",
|
|
80
|
+
role: "none"
|
|
81
|
+
}, ie = ["onClick"], ce = /* @__PURE__ */ E({
|
|
82
|
+
__name: "VueyeDropdown",
|
|
83
|
+
props: {
|
|
84
|
+
options: { default: () => [] },
|
|
85
|
+
modelValue: { default: "" },
|
|
86
|
+
label: { default: "" },
|
|
87
|
+
defaultValue: {}
|
|
88
|
+
},
|
|
89
|
+
emits: ["update:modelValue"],
|
|
90
|
+
setup(a, { emit: n }) {
|
|
91
|
+
const e = a, t = O(null);
|
|
92
|
+
se(t, () => {
|
|
93
|
+
r.value = !1;
|
|
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;
|
|
98
|
+
}
|
|
99
|
+
function b(l) {
|
|
100
|
+
o.value = l, r.value = !1, n("update:modelValue", c.value.value);
|
|
101
|
+
}
|
|
102
|
+
return F(() => {
|
|
103
|
+
const l = e.options.findIndex((m) => m.value === e.modelValue);
|
|
104
|
+
l !== -1 && (o.value = l);
|
|
105
|
+
}), (l, m) => (f(), g("div", oe, [
|
|
106
|
+
u("button", {
|
|
107
|
+
type: "button",
|
|
108
|
+
class: "bg-slate-100 dark:bg-primary-900 border flex items-center space-x-2 rtl:space-x-reverse border-primary-300 dark:border-primary-900 rounded-md shadow-sm py-2 px-4 text-sm font-medium text-slate-700 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",
|
|
109
|
+
onClick: h,
|
|
110
|
+
"aria-expanded": p(r),
|
|
111
|
+
"aria-haspopup": !0
|
|
112
|
+
}, [
|
|
113
|
+
u("span", null, y(p(c).label), 1),
|
|
114
|
+
le
|
|
115
|
+
], 8, re),
|
|
116
|
+
p(r) ? (f(), g("div", {
|
|
117
|
+
key: 0,
|
|
118
|
+
class: "origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-slate-100 dark:bg-primary-950 ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
119
|
+
role: "menu",
|
|
120
|
+
"aria-orientation": "vertical",
|
|
121
|
+
"aria-labelledby": _,
|
|
122
|
+
ref_key: "target",
|
|
123
|
+
ref: t
|
|
124
|
+
}, [
|
|
125
|
+
u("div", ue, [
|
|
126
|
+
(f(!0), g(w, null, $(l.options, (i, s) => (f(), g("button", {
|
|
127
|
+
key: s,
|
|
128
|
+
class: S([{
|
|
129
|
+
"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-primary-900 ": s === p(o),
|
|
130
|
+
"text-slate-700 dark:text-slate-50 hover:bg-slate-50": s !== p(o)
|
|
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"]),
|
|
132
|
+
role: "menuitem",
|
|
133
|
+
onClick: (d) => b(s)
|
|
134
|
+
}, y(i.label), 11, ie))), 128))
|
|
135
|
+
])
|
|
136
|
+
], 512)) : U("", !0)
|
|
137
|
+
]));
|
|
138
|
+
}
|
|
139
|
+
}), v = (a) => (z("data-v-d06f6d12"), a = a(), q(), a), de = { class: "pagination__wrapper" }, pe = { class: "pagination__details" }, fe = { class: "pagination__btn-list" }, ge = ["disabled"], _e = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "First page", -1)), he = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
140
|
+
"aria-hidden": "true",
|
|
141
|
+
class: "i-solar-alt-arrow-left-linear"
|
|
142
|
+
}, null, -1)), me = [
|
|
143
|
+
_e,
|
|
144
|
+
he
|
|
145
|
+
], ye = ["disabled"], be = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Previous page", -1)), Pe = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
class: "i-solar-double-alt-arrow-left-linear"
|
|
148
|
+
}, null, -1)), ve = [
|
|
149
|
+
be,
|
|
150
|
+
Pe
|
|
151
|
+
], ke = ["onClick"], $e = {
|
|
152
|
+
key: 1,
|
|
153
|
+
class: "pagination__btn"
|
|
154
|
+
}, we = ["disabled"], Ce = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Next page", -1)), Ve = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
155
|
+
"aria-hidden": "true",
|
|
156
|
+
class: "i-solar-alt-arrow-right-linear"
|
|
157
|
+
}, null, -1)), Se = [
|
|
158
|
+
Ce,
|
|
159
|
+
Ve
|
|
160
|
+
], Ee = ["disabled"], Oe = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Last page", -1)), Ae = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
class: "i-solar-double-alt-arrow-right-linear"
|
|
163
|
+
}, null, -1)), Ie = [
|
|
164
|
+
Oe,
|
|
165
|
+
Ae
|
|
166
|
+
], Be = /* @__PURE__ */ E({
|
|
167
|
+
__name: "VueyePagination",
|
|
168
|
+
props: {
|
|
169
|
+
perPage: { default: 10 },
|
|
170
|
+
currentPage: { default: 1 },
|
|
171
|
+
total: { default: 0 },
|
|
172
|
+
perPageOptions: { default: () => [10, 20, 30, 40, 50] }
|
|
173
|
+
},
|
|
174
|
+
emits: ["update:currentPage", "update:perPage"],
|
|
175
|
+
setup(a, { emit: n }) {
|
|
176
|
+
const e = a, t = P(() => Math.ceil(e.total / e.perPage)), r = P(() => e.perPageOptions.map((s) => ({
|
|
177
|
+
value: s,
|
|
178
|
+
label: s.toString()
|
|
179
|
+
}))), o = P(() => r.value.find((s) => s.value === e.perPage)), c = P(() => Array.from({ length: t.value }, (s, d) => d + 1).reduce(
|
|
180
|
+
(s, d) => (d === 1 || d === e.total || d >= e.currentPage - 2 && d <= e.currentPage + 2 ? s.push(d) : (d === e.currentPage - 3 || d === e.currentPage + 3) && s.push("..."), s),
|
|
181
|
+
[]
|
|
182
|
+
));
|
|
183
|
+
function _() {
|
|
184
|
+
e.currentPage < t.value && n("update:currentPage", e.currentPage + 1);
|
|
185
|
+
}
|
|
186
|
+
function h() {
|
|
187
|
+
e.currentPage > 1 && n("update:currentPage", e.currentPage - 1);
|
|
188
|
+
}
|
|
189
|
+
function b() {
|
|
190
|
+
e.currentPage > 1 && n("update:currentPage", 1);
|
|
191
|
+
}
|
|
192
|
+
function l() {
|
|
193
|
+
e.currentPage < t.value && n("update:currentPage", e.total);
|
|
194
|
+
}
|
|
195
|
+
function m(s) {
|
|
196
|
+
s > 0 && s <= t.value && n("update:currentPage", s);
|
|
197
|
+
}
|
|
198
|
+
function i(s) {
|
|
199
|
+
n("update:perPage", Number(s));
|
|
200
|
+
}
|
|
201
|
+
return (s, d) => (f(), g("div", de, [
|
|
202
|
+
u("div", null, [
|
|
203
|
+
A(ce, {
|
|
204
|
+
options: p(r),
|
|
205
|
+
"default-value": p(o),
|
|
206
|
+
label: "Per page",
|
|
207
|
+
"onUpdate:modelValue": i
|
|
208
|
+
}, null, 8, ["options", "default-value"])
|
|
209
|
+
]),
|
|
210
|
+
u("div", null, [
|
|
211
|
+
u("span", pe, y((s.currentPage - 1) * s.perPage + 1) + " - " + y(s.currentPage * s.perPage > s.total ? s.total : s.currentPage * s.perPage) + " of " + y(s.total), 1)
|
|
212
|
+
]),
|
|
213
|
+
u("ul", fe, [
|
|
214
|
+
u("li", null, [
|
|
215
|
+
u("button", {
|
|
216
|
+
class: "pagination__btn",
|
|
217
|
+
onClick: b,
|
|
218
|
+
disabled: s.currentPage === 1
|
|
219
|
+
}, me, 8, ge)
|
|
220
|
+
]),
|
|
221
|
+
u("li", null, [
|
|
222
|
+
u("button", {
|
|
223
|
+
class: "pagination__btn",
|
|
224
|
+
onClick: h,
|
|
225
|
+
disabled: s.currentPage === 1
|
|
226
|
+
}, ve, 8, ye)
|
|
227
|
+
]),
|
|
228
|
+
(f(!0), g(w, null, $(p(c), (C) => (f(), g("li", { key: C }, [
|
|
229
|
+
typeof C == "number" ? (f(), g("button", {
|
|
230
|
+
key: 0,
|
|
231
|
+
class: S(["pagination__btn", { "pagination__btn--current": C === s.currentPage }]),
|
|
232
|
+
onClick: (Xe) => m(C)
|
|
233
|
+
}, y(C), 11, ke)) : (f(), g("span", $e, "..."))
|
|
234
|
+
]))), 128)),
|
|
235
|
+
u("li", null, [
|
|
236
|
+
u("button", {
|
|
237
|
+
class: "pagination__btn",
|
|
238
|
+
onClick: _,
|
|
239
|
+
disabled: s.currentPage === p(t)
|
|
240
|
+
}, Se, 8, we)
|
|
241
|
+
]),
|
|
242
|
+
u("li", null, [
|
|
243
|
+
u("button", {
|
|
244
|
+
class: "pagination__btn",
|
|
245
|
+
onClick: l,
|
|
246
|
+
disabled: s.currentPage === p(t)
|
|
247
|
+
}, Ie, 8, Ee)
|
|
248
|
+
])
|
|
249
|
+
])
|
|
250
|
+
]));
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
const Re = (a, n) => {
|
|
254
|
+
const e = a.__vccOpts || a;
|
|
255
|
+
for (const [t, r] of n)
|
|
256
|
+
e[t] = r;
|
|
257
|
+
return e;
|
|
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;
|
|
264
|
+
}
|
|
265
|
+
function D(a) {
|
|
266
|
+
let n = 0;
|
|
267
|
+
return a.forEach((e) => {
|
|
268
|
+
e.children ? n += D(e.children) : n++;
|
|
269
|
+
}), n;
|
|
270
|
+
}
|
|
271
|
+
function L(a, n, e = [], t = 0, r = 0) {
|
|
272
|
+
return a.forEach((o) => {
|
|
273
|
+
if (e[t] || (e[t] = []), o.children) {
|
|
274
|
+
const { children: c, ..._ } = o, h = D(c);
|
|
275
|
+
e[t].push({
|
|
276
|
+
..._,
|
|
277
|
+
colSpan: h,
|
|
278
|
+
scope: "colgroup"
|
|
279
|
+
}), L(c, n, e, t + 1, r + 1);
|
|
280
|
+
} else {
|
|
281
|
+
const c = n - r;
|
|
282
|
+
e[t].push({
|
|
283
|
+
...o,
|
|
284
|
+
key: o.key,
|
|
285
|
+
label: o.label,
|
|
286
|
+
rowSpan: c,
|
|
287
|
+
scope: "col"
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}), e;
|
|
291
|
+
}
|
|
292
|
+
function N(a, n = "", e = []) {
|
|
293
|
+
return a.forEach((t) => {
|
|
294
|
+
t.children ? N(t.children, `${n}${t.key}.`, e) : e.push(`${n}${t.key}`);
|
|
295
|
+
}), e;
|
|
296
|
+
}
|
|
297
|
+
function Ze(a) {
|
|
298
|
+
const n = R(a);
|
|
299
|
+
return L(a, n).reduce((r, o) => [...r, ...o], []);
|
|
300
|
+
}
|
|
301
|
+
const Ne = (a, n) => {
|
|
302
|
+
const e = n.split(".");
|
|
303
|
+
let t = a;
|
|
304
|
+
for (let r = 0; r < e.length; r++)
|
|
305
|
+
if (t[e[r]])
|
|
306
|
+
t = t[e[r]];
|
|
307
|
+
else
|
|
308
|
+
return;
|
|
309
|
+
return t;
|
|
310
|
+
};
|
|
311
|
+
function Te(a, n, e = 0, t = a.length) {
|
|
312
|
+
return a.map((r) => N(n).map((o) => ({
|
|
313
|
+
[o]: Ne(r, o)
|
|
314
|
+
})).reduce((o, c) => ({ ...o, ...c }), {})).slice(e, t);
|
|
315
|
+
}
|
|
316
|
+
function He(a, n, e) {
|
|
317
|
+
return {
|
|
318
|
+
bodyRows: P(() => {
|
|
319
|
+
const r = e.value.perPage * (e.value.currentPage - 1), o = e.value.perPage * e.value.currentPage;
|
|
320
|
+
return Te(a, p(n), r, o);
|
|
321
|
+
})
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function Me(a) {
|
|
325
|
+
const n = p(a) ?? [];
|
|
326
|
+
return {
|
|
327
|
+
headers: P(() => L(n, R(n)))
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const je = { key: 0 }, De = ["colspan"], Ke = /* @__PURE__ */ u("div", { class: "flex justify-center items-center" }, [
|
|
331
|
+
/* @__PURE__ */ u("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" })
|
|
332
|
+
], -1), We = [
|
|
333
|
+
Ke
|
|
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({
|
|
394
|
+
inheritAttrs: !1,
|
|
395
|
+
__name: "VueyeTable",
|
|
396
|
+
props: {
|
|
397
|
+
itemValue: { default: "id" },
|
|
398
|
+
columnHeaders: { default: () => [] },
|
|
399
|
+
data: { default: () => [] },
|
|
400
|
+
perPage: { default: 10 },
|
|
401
|
+
currentPage: { default: 1 },
|
|
402
|
+
perPageOptions: { default: () => [5, 10, 20, 30] },
|
|
403
|
+
loading: { type: Boolean, default: !1 },
|
|
404
|
+
selectable: { type: Boolean, default: !1 },
|
|
405
|
+
caption: { default: "" },
|
|
406
|
+
summary: { default: "" }
|
|
407
|
+
},
|
|
408
|
+
setup(a) {
|
|
409
|
+
const n = a, e = J(n, "columnHeaders"), t = O({
|
|
410
|
+
perPage: n.perPage || 10,
|
|
411
|
+
currentPage: n.currentPage || 1
|
|
412
|
+
}), { headers: r } = Me(e), { bodyRows: o } = He(n.data, e, t), c = Q(), _ = Object.keys(c).filter((l) => l.startsWith("headerCell"));
|
|
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")
|
|
422
|
+
}, [
|
|
423
|
+
k(l.$slots, "caption", {}, () => [
|
|
424
|
+
u("caption", Ge, y(l.caption), 1)
|
|
425
|
+
]),
|
|
426
|
+
A(p(ze), { columnHeaders: p(r) }, X({ _: 2 }, [
|
|
427
|
+
$(p(_), (i) => ({
|
|
428
|
+
name: i,
|
|
429
|
+
fn: Y((s) => [
|
|
430
|
+
k(l.$slots, i, Z(ee(s)))
|
|
431
|
+
])
|
|
432
|
+
}))
|
|
433
|
+
]), 1032, ["columnHeaders"]),
|
|
434
|
+
A(p(Fe), {
|
|
435
|
+
bodyRows: p(o),
|
|
436
|
+
loading: l.loading
|
|
437
|
+
}, null, 8, ["bodyRows", "loading"]),
|
|
438
|
+
k(l.$slots, "summary", {}, () => [
|
|
439
|
+
u("caption", Je, y(l.summary), 1)
|
|
440
|
+
])
|
|
441
|
+
], 2),
|
|
442
|
+
u("div", Qe, [
|
|
443
|
+
A(Le, {
|
|
444
|
+
perPage: p(t).perPage,
|
|
445
|
+
currentPage: p(t).currentPage,
|
|
446
|
+
perPageOptions: l.perPageOptions,
|
|
447
|
+
total: l.data.length,
|
|
448
|
+
"onUpdate:currentPage": h,
|
|
449
|
+
"onUpdate:perPage": b
|
|
450
|
+
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total"])
|
|
451
|
+
])
|
|
452
|
+
]));
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
function tt(a) {
|
|
456
|
+
return {
|
|
457
|
+
headerKeys: P(() => N(a.flat()))
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
export {
|
|
461
|
+
et as VueyeTable,
|
|
462
|
+
Ze as defineColumnHeaders,
|
|
463
|
+
R as depthCount,
|
|
464
|
+
L as flatHeadersToRows,
|
|
465
|
+
Te as getBodyRows,
|
|
466
|
+
N as getHeaderKeys,
|
|
467
|
+
D as leafCount,
|
|
468
|
+
tt as useHeaderKeys
|
|
469
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["vueye-table"]={},u.Vue))})(this,function(u,e){"use strict";function L(a){return e.getCurrentScope()?(e.onScopeDispose(a),!0):!1}function N(a){return typeof a=="function"?a():e.unref(a)}const C=typeof window<"u"&&typeof document<"u",V=()=>{},A=D();function D(){var a;return C&&((a=window==null?void 0:window.navigator)==null?void 0:a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function y(a){const o=N(a);return(o==null?void 0:o.$el)??o}const S=C?window:void 0;function B(...a){let o,t,n,s;if(typeof a[0]=="string"||Array.isArray(a[0])?([t,n,s]=a,o=S):[o,t,n,s]=a,!o)return V;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const l=[],d=()=>{l.forEach(c=>c()),l.length=0},f=(c,g,i,r)=>(c.addEventListener(g,i,r),()=>c.removeEventListener(g,i,r)),m=e.watch(()=>[y(o),N(s)],([c,g])=>{d(),c&&l.push(...t.flatMap(i=>n.map(r=>f(c,i,r,g))))},{immediate:!0,flush:"post"}),_=()=>{m(),d()};return L(_),_}let w=!1;function I(a,o,t={}){const{window:n=S,ignore:s=[],capture:l=!0,detectIframe:d=!1}=t;if(!n)return;A&&!w&&(w=!0,Array.from(n.document.body.children).forEach(i=>i.addEventListener("click",V)),n.document.documentElement.addEventListener("click",V));let f=!0;const m=i=>s.some(r=>{if(typeof r=="string")return Array.from(n.document.querySelectorAll(r)).some(p=>p===i.target||i.composedPath().includes(p));{const p=y(r);return p&&(i.target===p||i.composedPath().includes(p))}}),c=[B(n,"click",i=>{const r=y(a);if(!(!r||r===i.target||i.composedPath().includes(r))){if(i.detail===0&&(f=!m(i)),!f){f=!0;return}o(i)}},{passive:!0,capture:l}),B(n,"pointerdown",i=>{const r=y(a);r&&(f=!i.composedPath().includes(r)&&!m(i))},{passive:!0}),d&&B(n,"blur",i=>{setTimeout(()=>{var p;const r=y(a);((p=n.document.activeElement)==null?void 0:p.tagName)==="IFRAME"&&!(r!=null&&r.contains(n.document.activeElement))&&o(i)},0)})].filter(Boolean);return()=>c.forEach(i=>i())}const R={class:"relative"},T=["aria-expanded"],H=e.createElementVNode("span",{class:"i-solar-alt-arrow-down-linear"},null,-1),F={class:"py-1",role:"none"},j=["onClick"],M=e.defineComponent({__name:"VueyeDropdown",props:{options:{default:()=>[]},modelValue:{default:""},label:{default:""},defaultValue:{}},emits:["update:modelValue"],setup(a,{emit:o}){const t=a,n=e.ref(null);I(n,()=>{s.value=!1});const s=e.ref(!1),l=e.ref(-1),d=e.computed(()=>t.options[l.value]??t.defaultValue),f=`dropdown-label-${Math.random().toString(36).substring(2,9)}`;function m(){s.value=!s.value}function _(c){l.value=c,s.value=!1,o("update:modelValue",d.value.value)}return e.watchEffect(()=>{const c=t.options.findIndex(g=>g.value===t.modelValue);c!==-1&&(l.value=c)}),(c,g)=>(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("button",{type:"button",class:"bg-slate-100 dark:bg-primary-900 border flex items-center space-x-2 rtl:space-x-reverse border-primary-300 dark:border-primary-900 rounded-md shadow-sm py-2 px-4 text-sm font-medium text-slate-700 dark:text-slate-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",onClick:m,"aria-expanded":e.unref(s),"aria-haspopup":!0},[e.createElementVNode("span",null,e.toDisplayString(e.unref(d).label),1),H],8,T),e.unref(s)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-slate-100 dark:bg-primary-950 ring-1 ring-black ring-opacity-5 focus:outline-none",role:"menu","aria-orientation":"vertical","aria-labelledby":f,ref_key:"target",ref:n},[e.createElementVNode("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.options,(i,r)=>(e.openBlock(),e.createElementBlock("button",{key:r,class:e.normalizeClass([{"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-primary-900 ":r===e.unref(l),"text-slate-700 dark:text-slate-50 hover:bg-slate-50":r!==e.unref(l)},"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"]),role:"menuitem",onClick:p=>_(r)},e.toDisplayString(i.label),11,j))),128))])],512)):e.createCommentVNode("",!0)]))}}),h=a=>(e.pushScopeId("data-v-d06f6d12"),a=a(),e.popScopeId(),a),z={class:"pagination__wrapper"},K={class:"pagination__details"},W={class:"pagination__btn-list"},U=["disabled"],q=[h(()=>e.createElementVNode("span",{class:"sr-only"},"First page",-1)),h(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-solar-alt-arrow-left-linear"},null,-1))],G=["disabled"],J=[h(()=>e.createElementVNode("span",{class:"sr-only"},"Previous page",-1)),h(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-solar-double-alt-arrow-left-linear"},null,-1))],Q=["onClick"],X={key:1,class:"pagination__btn"},Y=["disabled"],Z=[h(()=>e.createElementVNode("span",{class:"sr-only"},"Next page",-1)),h(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-solar-alt-arrow-right-linear"},null,-1))],x=["disabled"],v=[h(()=>e.createElementVNode("span",{class:"sr-only"},"Last page",-1)),h(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-solar-double-alt-arrow-right-linear"},null,-1))],ee=e.defineComponent({__name:"VueyePagination",props:{perPage:{default:10},currentPage:{default:1},total:{default:0},perPageOptions:{default:()=>[10,20,30,40,50]}},emits:["update:currentPage","update:perPage"],setup(a,{emit:o}){const t=a,n=e.computed(()=>Math.ceil(t.total/t.perPage)),s=e.computed(()=>t.perPageOptions.map(r=>({value:r,label:r.toString()}))),l=e.computed(()=>s.value.find(r=>r.value===t.perPage)),d=e.computed(()=>Array.from({length:n.value},(r,p)=>p+1).reduce((r,p)=>(p===1||p===t.total||p>=t.currentPage-2&&p<=t.currentPage+2?r.push(p):(p===t.currentPage-3||p===t.currentPage+3)&&r.push("..."),r),[]));function f(){t.currentPage<n.value&&o("update:currentPage",t.currentPage+1)}function m(){t.currentPage>1&&o("update:currentPage",t.currentPage-1)}function _(){t.currentPage>1&&o("update:currentPage",1)}function c(){t.currentPage<n.value&&o("update:currentPage",t.total)}function g(r){r>0&&r<=n.value&&o("update:currentPage",r)}function i(r){o("update:perPage",Number(r))}return(r,p)=>(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",null,[e.createVNode(M,{options:e.unref(s),"default-value":e.unref(l),label:"Per page","onUpdate:modelValue":i},null,8,["options","default-value"])]),e.createElementVNode("div",null,[e.createElementVNode("span",K,e.toDisplayString((r.currentPage-1)*r.perPage+1)+" - "+e.toDisplayString(r.currentPage*r.perPage>r.total?r.total:r.currentPage*r.perPage)+" of "+e.toDisplayString(r.total),1)]),e.createElementVNode("ul",W,[e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:_,disabled:r.currentPage===1},q,8,U)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:m,disabled:r.currentPage===1},J,8,G)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(d),b=>(e.openBlock(),e.createElementBlock("li",{key:b},[typeof b=="number"?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["pagination__btn",{"pagination__btn--current":b===r.currentPage}]),onClick:Ae=>g(b)},e.toDisplayString(b),11,Q)):(e.openBlock(),e.createElementBlock("span",X,"..."))]))),128)),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:f,disabled:r.currentPage===e.unref(n)},Z,8,Y)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:c,disabled:r.currentPage===e.unref(n)},v,8,x)])])]))}}),Ce="",te=((a,o)=>{const t=a.__vccOpts||a;for(const[n,s]of o)t[n]=s;return t})(ee,[["__scopeId","data-v-d06f6d12"]]);function k(a){let o=1;return a.forEach(t=>{t.children&&(o=Math.max(o,k(t.children)+1))}),o}function $(a){let o=0;return a.forEach(t=>{t.children?o+=$(t.children):o++}),o}function P(a,o,t=[],n=0,s=0){return a.forEach(l=>{if(t[n]||(t[n]=[]),l.children){const{children:d,...f}=l,m=$(d);t[n].push({...f,colSpan:m,scope:"colgroup"}),P(d,o,t,n+1,s+1)}else{const d=o-s;t[n].push({...l,key:l.key,label:l.label,rowSpan:d,scope:"col"})}}),t}function E(a,o="",t=[]){return a.forEach(n=>{n.children?E(n.children,`${o}${n.key}.`,t):t.push(`${o}${n.key}`)}),t}function ne(a){const o=k(a);return P(a,o).reduce((s,l)=>[...s,...l],[])}const oe=(a,o)=>{const t=o.split(".");let n=a;for(let s=0;s<t.length;s++)if(n[t[s]])n=n[t[s]];else return;return n};function O(a,o,t=0,n=a.length){return a.map(s=>E(o).map(l=>({[l]:oe(s,l)})).reduce((l,d)=>({...l,...d}),{})).slice(t,n)}function ae(a,o,t){return{bodyRows:e.computed(()=>{const s=t.value.perPage*(t.value.currentPage-1),l=t.value.perPage*t.value.currentPage;return O(a,e.unref(o),s,l)})}}function re(a){const o=e.unref(a)??[];return{headers:e.computed(()=>P(o,k(o)))}}const le={key:0},se=["colspan"],ce=[e.createElementVNode("div",{class:"flex justify-center items-center"},[e.createElementVNode("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"})],-1)],ie=["id"],de=e.defineComponent({__name:"VueyeBody",props:{loading:{type:Boolean,default:!1},bodyRows:{default:()=>[]},itemValue:{default:"id"}},setup(a){const o=a,t=e.computed(()=>Object.keys(o.bodyRows[0]).length);return(n,s)=>(e.openBlock(),e.createElementBlock("tbody",null,[n.loading?(e.openBlock(),e.createElementBlock("tr",le,[e.createElementVNode("td",{colspan:e.unref(t)},ce,8,se)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.bodyRows,l=>(e.openBlock(),e.createElementBlock("tr",{key:l[n.itemValue]},[e.renderSlot(n.$slots,"default",{row:l},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(l),d=>(e.openBlock(),e.createElementBlock("td",{key:`${l[n.itemValue]}.${d}`,id:`${l[n.itemValue]}.${d}`},[e.renderSlot(n.$slots,"default",{cell:l[d],key:`${l[n.itemValue]}.${d}`},()=>[e.createTextVNode(e.toDisplayString(l[d]),1)])],8,ie))),128))])]))),128))]))}}),pe=["colspan","rowspan","scope"],ue=e.defineComponent({__name:"VueyeHead",props:{columnHeaders:{default:()=>[]}},setup(a){return(o,t)=>(e.openBlock(),e.createElementBlock("thead",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnHeaders,(n,s)=>(e.openBlock(),e.createElementBlock("tr",{key:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,l=>e.renderSlot(o.$slots,`headerCell.${l.key}`,{key:l.key,headerCell:l},()=>[e.createElementVNode("th",{colspan:l.colSpan,rowspan:l.rowSpan,scope:l.scope,class:e.normalizeClass([l.className,"th"])},[e.renderSlot(o.$slots,`headerCellContent.${l.key}`,{headerCellContent:l},()=>[e.createElementVNode("span",{class:e.normalizeClass(l.labelClassName)},e.toDisplayString(l.label),3)])],10,pe)])),128))]))),128))]))}}),fe={class:"table__wrapper"},me={class:"table__caption"},ge={class:"table__summary"},_e={class:"table__pagination-wrapper"},he=e.defineComponent({inheritAttrs:!1,__name:"VueyeTable",props:{itemValue:{default:"id"},columnHeaders:{default:()=>[]},data:{default:()=>[]},perPage:{default:10},currentPage:{default:1},perPageOptions:{default:()=>[5,10,20,30]},loading:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},caption:{default:""},summary:{default:""}},setup(a){const o=a,t=e.toRef(o,"columnHeaders"),n=e.ref({perPage:o.perPage||10,currentPage:o.currentPage||1}),{headers:s}=re(t),{bodyRows:l}=ae(o.data,t,n),d=e.useSlots(),f=Object.keys(d).filter(c=>c.startsWith("headerCell"));function m(c){n.value.currentPage=c}function _(c){n.value.perPage=c}return(c,g)=>(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("table",{class:e.normalizeClass(c.$attrs.class??"table")},[e.renderSlot(c.$slots,"caption",{},()=>[e.createElementVNode("caption",me,e.toDisplayString(c.caption),1)]),e.createVNode(e.unref(ue),{columnHeaders:e.unref(s)},e.createSlots({_:2},[e.renderList(e.unref(f),i=>({name:i,fn:e.withCtx(r=>[e.renderSlot(c.$slots,i,e.normalizeProps(e.guardReactiveProps(r)))])}))]),1032,["columnHeaders"]),e.createVNode(e.unref(de),{bodyRows:e.unref(l),loading:c.loading},null,8,["bodyRows","loading"]),e.renderSlot(c.$slots,"summary",{},()=>[e.createElementVNode("caption",ge,e.toDisplayString(c.summary),1)])],2),e.createElementVNode("div",_e,[e.createVNode(te,{perPage:e.unref(n).perPage,currentPage:e.unref(n).currentPage,perPageOptions:c.perPageOptions,total:c.data.length,"onUpdate:currentPage":m,"onUpdate:perPage":_},null,8,["perPage","currentPage","perPageOptions","total"])])]))}}),Oe="",Le="";function ye(a){return{headerKeys:e.computed(()=>E(a.flat()))}}u.VueyeTable=he,u.defineColumnHeaders=ne,u.depthCount=k,u.flatHeadersToRows=P,u.getBodyRows=O,u.getHeaderKeys=E,u.leafCount=$,u.useHeaderKeys=ye,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
Binary file
|