vueye-table 2.0.0-alpha.2 → 2.0.0-alpha.3
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/README.md +0 -1
- package/dist/components/core/VueyeTable/VueyeBody/VueyeBody.vue.d.ts +1 -1
- package/dist/components/core/VueyeTable/VueyeHead/VueyeHead.vue.d.ts +3 -3
- package/dist/components/core/VueyeTable/VueyePagination/VueyePagination.vue.d.ts +1 -1
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +25 -38
- package/dist/components/core/VueyeTable/util-components/VueyeDropdown.vue.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/vueye-table.js +237 -229
- package/dist/vueye-table.umd.cjs +1 -1
- package/package.json +77 -103
- package/dist/types.d.ts +0 -8
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
15
15
|
required: true;
|
|
16
16
|
default: string;
|
|
17
17
|
};
|
|
18
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
18
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
19
19
|
loading: {
|
|
20
20
|
type: globalThis.PropType<boolean>;
|
|
21
21
|
required: true;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ColumnHeader
|
|
1
|
+
import type { ColumnHeader } from '../types';
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
3
3
|
columnHeaders: {
|
|
4
4
|
type: globalThis.PropType<ColumnHeader[][]>;
|
|
5
5
|
required: true;
|
|
6
6
|
default: () => never[];
|
|
7
7
|
};
|
|
8
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
8
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
9
9
|
columnHeaders: {
|
|
10
10
|
type: globalThis.PropType<ColumnHeader[][]>;
|
|
11
11
|
required: true;
|
|
@@ -13,7 +13,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
13
13
|
};
|
|
14
14
|
}>>, {
|
|
15
15
|
columnHeaders: ColumnHeader[][];
|
|
16
|
-
}, {}>,
|
|
16
|
+
}, {}>, Readonly<import("../types").SlotHeaderCell<Record<string, string>> & import("../types").SlotHeaderCellContent<Record<string, string>>>>;
|
|
17
17
|
export default _default;
|
|
18
18
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
19
19
|
new (): {
|
|
@@ -22,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
23
23
|
"update:currentPage": (value: number) => void;
|
|
24
24
|
"update:perPage": (value: number) => void;
|
|
25
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
25
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
26
26
|
perPage: {
|
|
27
27
|
type: globalThis.PropType<number>;
|
|
28
28
|
required: true;
|
|
@@ -1,77 +1,64 @@
|
|
|
1
1
|
import { ColumnHeader } from './types';
|
|
2
2
|
declare const _default: <TData extends Record<string, unknown>, TColumn extends ColumnHeader>(__VLS_props: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
loading?: boolean | undefined;
|
|
4
|
+
caption?: string | undefined;
|
|
5
5
|
data: TData[];
|
|
6
|
+
summary?: string | undefined;
|
|
6
7
|
perPage?: number | undefined;
|
|
7
8
|
currentPage?: number | undefined;
|
|
8
9
|
perPageOptions?: number[] | undefined;
|
|
9
|
-
loading?: boolean | undefined;
|
|
10
10
|
selectable?: boolean | undefined;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?:
|
|
14
|
-
props: {
|
|
15
|
-
itemValue?: string | undefined;
|
|
16
|
-
columnHeaders: TColumn[];
|
|
17
|
-
data: TData[];
|
|
18
|
-
perPage?: number | undefined;
|
|
19
|
-
currentPage?: number | undefined;
|
|
20
|
-
perPageOptions?: number[] | undefined;
|
|
21
|
-
loading?: boolean | undefined;
|
|
22
|
-
selectable?: boolean | undefined;
|
|
23
|
-
caption?: string | undefined;
|
|
24
|
-
summary?: string | undefined;
|
|
25
|
-
};
|
|
26
|
-
expose(exposed: {}): void;
|
|
11
|
+
itemValue?: string | undefined;
|
|
12
|
+
columnHeaders: TColumn[];
|
|
13
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
|
|
27
14
|
attrs: any;
|
|
28
|
-
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
15
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
29
16
|
caption: () => any;
|
|
30
17
|
summary: () => any;
|
|
31
|
-
}
|
|
18
|
+
}>;
|
|
32
19
|
emit: any;
|
|
33
|
-
},
|
|
20
|
+
} | undefined, __VLS_expose?: ((exposed: {}) => void) | undefined, __VLS_setup?: Promise<{
|
|
34
21
|
props: {
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
loading?: boolean | undefined;
|
|
23
|
+
caption?: string | undefined;
|
|
37
24
|
data: TData[];
|
|
25
|
+
summary?: string | undefined;
|
|
38
26
|
perPage?: number | undefined;
|
|
39
27
|
currentPage?: number | undefined;
|
|
40
28
|
perPageOptions?: number[] | undefined;
|
|
41
|
-
loading?: boolean | undefined;
|
|
42
29
|
selectable?: boolean | undefined;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
30
|
+
itemValue?: string | undefined;
|
|
31
|
+
columnHeaders: TColumn[];
|
|
32
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
46
33
|
expose(exposed: {}): void;
|
|
47
34
|
attrs: any;
|
|
48
|
-
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
35
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
49
36
|
caption: () => any;
|
|
50
37
|
summary: () => any;
|
|
51
|
-
}
|
|
38
|
+
}>;
|
|
52
39
|
emit: any;
|
|
53
40
|
}>) => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
54
41
|
[key: string]: any;
|
|
55
42
|
}> & {
|
|
56
43
|
__ctx?: {
|
|
57
44
|
props: {
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
loading?: boolean | undefined;
|
|
46
|
+
caption?: string | undefined;
|
|
60
47
|
data: TData[];
|
|
48
|
+
summary?: string | undefined;
|
|
61
49
|
perPage?: number | undefined;
|
|
62
50
|
currentPage?: number | undefined;
|
|
63
51
|
perPageOptions?: number[] | undefined;
|
|
64
|
-
loading?: boolean | undefined;
|
|
65
52
|
selectable?: boolean | undefined;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
53
|
+
itemValue?: string | undefined;
|
|
54
|
+
columnHeaders: TColumn[];
|
|
55
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
69
56
|
expose(exposed: {}): void;
|
|
70
57
|
attrs: any;
|
|
71
|
-
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
58
|
+
slots: Readonly<import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
72
59
|
caption: () => any;
|
|
73
60
|
summary: () => any;
|
|
74
|
-
}
|
|
61
|
+
}>;
|
|
75
62
|
emit: any;
|
|
76
63
|
} | undefined;
|
|
77
64
|
};
|
|
@@ -24,7 +24,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
24
|
};
|
|
25
25
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
26
|
"update:modelValue": (value: OptionValue) => void;
|
|
27
|
-
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<
|
|
27
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<globalThis.ExtractPropTypes<{
|
|
28
28
|
label: {
|
|
29
29
|
type: globalThis.PropType<string>;
|
|
30
30
|
required: true;
|
package/dist/style.css
CHANGED
|
@@ -1 +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
|
|
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;width:-moz-max-content;width:max-content;flex-direction:column}.table__pagination-wrapper{display:flex;justify-content:flex-end;padding-top:1rem;padding-bottom:1rem}
|
package/dist/vueye-table.js
CHANGED
|
@@ -1,84 +1,88 @@
|
|
|
1
|
-
import { getCurrentScope as
|
|
2
|
-
function te(
|
|
3
|
-
return
|
|
1
|
+
import { getCurrentScope as W, onScopeDispose as x, unref as p, watch as z, defineComponent as S, ref as E, computed as P, watchEffect as F, openBlock as f, createElementBlock as g, createElementVNode as u, toDisplayString as b, Fragment as w, renderList as $, normalizeClass as O, createCommentVNode as U, createVNode as A, pushScopeId as q, popScopeId as G, renderSlot as k, createTextVNode as T, toRef as J, useSlots as Q, createSlots as X, withCtx as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
|
|
2
|
+
function te(n) {
|
|
3
|
+
return W() ? (x(n), !0) : !1;
|
|
4
4
|
}
|
|
5
|
-
function H(
|
|
6
|
-
return typeof
|
|
5
|
+
function H(n) {
|
|
6
|
+
return typeof n == "function" ? n() : p(n);
|
|
7
7
|
}
|
|
8
|
-
const M = typeof window < "u" && typeof document < "u", B = () => {
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
var
|
|
12
|
-
return M && ((
|
|
8
|
+
const M = typeof window < "u" && typeof document < "u", ne = Object.prototype.toString, ae = (n) => ne.call(n) === "[object Object]", B = () => {
|
|
9
|
+
}, oe = /* @__PURE__ */ se();
|
|
10
|
+
function se() {
|
|
11
|
+
var n;
|
|
12
|
+
return M && ((n = window == null ? void 0 : window.navigator) == null ? void 0 : n.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
13
13
|
}
|
|
14
|
-
function V(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function V(n) {
|
|
15
|
+
var a;
|
|
16
|
+
const e = H(n);
|
|
17
|
+
return (a = e == null ? void 0 : e.$el) != null ? a : e;
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
function I(...
|
|
20
|
-
let
|
|
21
|
-
if (typeof
|
|
19
|
+
const D = M ? window : void 0;
|
|
20
|
+
function I(...n) {
|
|
21
|
+
let a, e, t, r;
|
|
22
|
+
if (typeof n[0] == "string" || Array.isArray(n[0]) ? ([e, t, r] = n, a = D) : [a, e, t, r] = n, !a)
|
|
22
23
|
return B;
|
|
23
24
|
Array.isArray(e) || (e = [e]), Array.isArray(t) || (t = [t]);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}, _ = (l,
|
|
27
|
-
() => [V(
|
|
28
|
-
([l,
|
|
29
|
-
c(), l
|
|
30
|
-
|
|
25
|
+
const s = [], c = () => {
|
|
26
|
+
s.forEach((l) => l()), s.length = 0;
|
|
27
|
+
}, _ = (l, h, i, o) => (l.addEventListener(h, i, o), () => l.removeEventListener(h, i, o)), m = z(
|
|
28
|
+
() => [V(a), H(r)],
|
|
29
|
+
([l, h]) => {
|
|
30
|
+
if (c(), !l)
|
|
31
|
+
return;
|
|
32
|
+
const i = ae(h) ? { ...h } : h;
|
|
33
|
+
s.push(
|
|
34
|
+
...e.flatMap((o) => t.map((d) => _(l, o, d, i)))
|
|
31
35
|
);
|
|
32
36
|
},
|
|
33
37
|
{ immediate: !0, flush: "post" }
|
|
34
|
-
),
|
|
35
|
-
|
|
38
|
+
), y = () => {
|
|
39
|
+
m(), c();
|
|
36
40
|
};
|
|
37
|
-
return te(
|
|
41
|
+
return te(y), y;
|
|
38
42
|
}
|
|
39
|
-
let
|
|
40
|
-
function
|
|
41
|
-
const { window: t =
|
|
43
|
+
let N = !1;
|
|
44
|
+
function re(n, a, e = {}) {
|
|
45
|
+
const { window: t = D, ignore: r = [], capture: s = !0, detectIframe: c = !1 } = e;
|
|
42
46
|
if (!t)
|
|
43
47
|
return;
|
|
44
|
-
|
|
48
|
+
oe && !N && (N = !0, Array.from(t.document.body.children).forEach((i) => i.addEventListener("click", B)), t.document.documentElement.addEventListener("click", B));
|
|
45
49
|
let _ = !0;
|
|
46
|
-
const
|
|
47
|
-
if (typeof
|
|
48
|
-
return Array.from(t.document.querySelectorAll(
|
|
50
|
+
const m = (i) => r.some((o) => {
|
|
51
|
+
if (typeof o == "string")
|
|
52
|
+
return Array.from(t.document.querySelectorAll(o)).some((d) => d === i.target || i.composedPath().includes(d));
|
|
49
53
|
{
|
|
50
|
-
const d = V(
|
|
54
|
+
const d = V(o);
|
|
51
55
|
return d && (i.target === d || i.composedPath().includes(d));
|
|
52
56
|
}
|
|
53
57
|
}), l = [
|
|
54
58
|
I(t, "click", (i) => {
|
|
55
|
-
const
|
|
56
|
-
if (!(!
|
|
57
|
-
if (i.detail === 0 && (_ = !
|
|
59
|
+
const o = V(n);
|
|
60
|
+
if (!(!o || o === i.target || i.composedPath().includes(o))) {
|
|
61
|
+
if (i.detail === 0 && (_ = !m(i)), !_) {
|
|
58
62
|
_ = !0;
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
a(i);
|
|
62
66
|
}
|
|
63
|
-
}, { passive: !0, capture:
|
|
67
|
+
}, { passive: !0, capture: s }),
|
|
64
68
|
I(t, "pointerdown", (i) => {
|
|
65
|
-
const
|
|
66
|
-
|
|
69
|
+
const o = V(n);
|
|
70
|
+
o && (_ = !i.composedPath().includes(o) && !m(i));
|
|
67
71
|
}, { passive: !0 }),
|
|
68
72
|
c && I(t, "blur", (i) => {
|
|
69
73
|
setTimeout(() => {
|
|
70
|
-
var
|
|
71
|
-
const
|
|
72
|
-
((
|
|
74
|
+
var o;
|
|
75
|
+
const d = V(n);
|
|
76
|
+
((o = t.document.activeElement) == null ? void 0 : o.tagName) === "IFRAME" && !(d != null && d.contains(t.document.activeElement)) && a(i);
|
|
73
77
|
}, 0);
|
|
74
78
|
})
|
|
75
79
|
].filter(Boolean);
|
|
76
80
|
return () => l.forEach((i) => i());
|
|
77
81
|
}
|
|
78
|
-
const
|
|
82
|
+
const le = { class: "relative" }, ue = ["aria-expanded"], ie = /* @__PURE__ */ u("span", { class: "i-solar-alt-arrow-down-linear" }, null, -1), ce = {
|
|
79
83
|
class: "py-1",
|
|
80
84
|
role: "none"
|
|
81
|
-
},
|
|
85
|
+
}, de = ["onClick"], pe = /* @__PURE__ */ S({
|
|
82
86
|
__name: "VueyeDropdown",
|
|
83
87
|
props: {
|
|
84
88
|
options: { default: () => [] },
|
|
@@ -87,83 +91,84 @@ const oe = { class: "relative" }, re = ["aria-expanded"], le = /* @__PURE__ */ u
|
|
|
87
91
|
defaultValue: {}
|
|
88
92
|
},
|
|
89
93
|
emits: ["update:modelValue"],
|
|
90
|
-
setup(
|
|
91
|
-
const e =
|
|
92
|
-
|
|
94
|
+
setup(n, { emit: a }) {
|
|
95
|
+
const e = n, t = E(null);
|
|
96
|
+
re(t, () => {
|
|
93
97
|
r.value = !1;
|
|
94
98
|
});
|
|
95
|
-
const r =
|
|
96
|
-
function
|
|
99
|
+
const r = E(!1), s = E(-1), c = P(() => e.options[s.value] ?? e.defaultValue), _ = `dropdown-label-${Math.random().toString(36).substring(2, 9)}`;
|
|
100
|
+
function m() {
|
|
97
101
|
r.value = !r.value;
|
|
98
102
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
103
|
+
function y(l) {
|
|
104
|
+
s.value = l, r.value = !1, a("update:modelValue", c.value.value);
|
|
101
105
|
}
|
|
102
106
|
return F(() => {
|
|
103
|
-
const l = e.options.findIndex((
|
|
104
|
-
l !== -1 && (
|
|
105
|
-
}), (l,
|
|
107
|
+
const l = e.options.findIndex((h) => h.value === e.modelValue);
|
|
108
|
+
l !== -1 && (s.value = l);
|
|
109
|
+
}), (l, h) => (f(), g("div", le, [
|
|
106
110
|
u("button", {
|
|
107
111
|
type: "button",
|
|
108
112
|
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:
|
|
113
|
+
onClick: m,
|
|
110
114
|
"aria-expanded": p(r),
|
|
111
|
-
"aria-haspopup": !0
|
|
115
|
+
"aria-haspopup": !0,
|
|
116
|
+
ref: "buttonRef"
|
|
112
117
|
}, [
|
|
113
|
-
u("span", null,
|
|
114
|
-
|
|
115
|
-
], 8,
|
|
118
|
+
u("span", null, b(p(c).label), 1),
|
|
119
|
+
ie
|
|
120
|
+
], 8, ue),
|
|
116
121
|
p(r) ? (f(), g("div", {
|
|
117
122
|
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",
|
|
123
|
+
class: "origin-top-right bottom-full 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 z-40",
|
|
119
124
|
role: "menu",
|
|
120
125
|
"aria-orientation": "vertical",
|
|
121
126
|
"aria-labelledby": _,
|
|
122
127
|
ref_key: "target",
|
|
123
128
|
ref: t
|
|
124
129
|
}, [
|
|
125
|
-
u("div",
|
|
126
|
-
(f(!0), g(w, null, $(l.options, (i,
|
|
127
|
-
key:
|
|
128
|
-
class:
|
|
129
|
-
"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-primary-900 ":
|
|
130
|
-
"text-slate-700 dark:text-slate-50 hover:bg-slate-50":
|
|
130
|
+
u("div", ce, [
|
|
131
|
+
(f(!0), g(w, null, $(l.options, (i, o) => (f(), g("button", {
|
|
132
|
+
key: o,
|
|
133
|
+
class: O([{
|
|
134
|
+
"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-primary-900 ": o === p(s),
|
|
135
|
+
"text-slate-700 dark:text-slate-50 hover:bg-slate-50": o !== p(s)
|
|
131
136
|
}, "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
137
|
role: "menuitem",
|
|
133
|
-
onClick: (d) =>
|
|
134
|
-
},
|
|
138
|
+
onClick: (d) => y(o)
|
|
139
|
+
}, b(i.label), 11, de))), 128))
|
|
135
140
|
])
|
|
136
141
|
], 512)) : U("", !0)
|
|
137
142
|
]));
|
|
138
143
|
}
|
|
139
|
-
}), v = (
|
|
144
|
+
}), v = (n) => (q("data-v-d06f6d12"), n = n(), G(), n), fe = { class: "pagination__wrapper" }, ge = { class: "pagination__details" }, _e = { class: "pagination__btn-list" }, he = ["disabled"], me = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "First page", -1)), be = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
140
145
|
"aria-hidden": "true",
|
|
141
146
|
class: "i-solar-alt-arrow-left-linear"
|
|
142
|
-
}, null, -1)),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
],
|
|
147
|
+
}, null, -1)), ye = [
|
|
148
|
+
me,
|
|
149
|
+
be
|
|
150
|
+
], Pe = ["disabled"], ve = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Previous page", -1)), ke = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
146
151
|
"aria-hidden": "true",
|
|
147
152
|
class: "i-solar-double-alt-arrow-left-linear"
|
|
148
|
-
}, null, -1)),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
],
|
|
153
|
+
}, null, -1)), $e = [
|
|
154
|
+
ve,
|
|
155
|
+
ke
|
|
156
|
+
], we = ["onClick"], Ce = {
|
|
152
157
|
key: 1,
|
|
153
158
|
class: "pagination__btn"
|
|
154
|
-
},
|
|
159
|
+
}, Ve = ["disabled"], Oe = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Next page", -1)), Se = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
155
160
|
"aria-hidden": "true",
|
|
156
161
|
class: "i-solar-alt-arrow-right-linear"
|
|
157
|
-
}, null, -1)),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
],
|
|
162
|
+
}, null, -1)), Ee = [
|
|
163
|
+
Oe,
|
|
164
|
+
Se
|
|
165
|
+
], Ae = ["disabled"], Ie = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Last page", -1)), Be = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
161
166
|
"aria-hidden": "true",
|
|
162
167
|
class: "i-solar-double-alt-arrow-right-linear"
|
|
163
|
-
}, null, -1)),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
],
|
|
168
|
+
}, null, -1)), Re = [
|
|
169
|
+
Ie,
|
|
170
|
+
Be
|
|
171
|
+
], je = /* @__PURE__ */ S({
|
|
167
172
|
__name: "VueyePagination",
|
|
168
173
|
props: {
|
|
169
174
|
perPage: { default: 10 },
|
|
@@ -172,135 +177,135 @@ const oe = { class: "relative" }, re = ["aria-expanded"], le = /* @__PURE__ */ u
|
|
|
172
177
|
perPageOptions: { default: () => [10, 20, 30, 40, 50] }
|
|
173
178
|
},
|
|
174
179
|
emits: ["update:currentPage", "update:perPage"],
|
|
175
|
-
setup(
|
|
176
|
-
const e =
|
|
177
|
-
value:
|
|
178
|
-
label:
|
|
179
|
-
}))),
|
|
180
|
-
(
|
|
180
|
+
setup(n, { emit: a }) {
|
|
181
|
+
const e = n, t = P(() => Math.ceil(e.total / e.perPage)), r = P(() => e.perPageOptions.map((o) => ({
|
|
182
|
+
value: o,
|
|
183
|
+
label: o.toString()
|
|
184
|
+
}))), s = P(() => r.value.find((o) => o.value === e.perPage)), c = P(() => Array.from({ length: t.value }, (o, d) => d + 1).reduce(
|
|
185
|
+
(o, d) => (d === 1 || d === e.total || d >= e.currentPage - 2 && d <= e.currentPage + 2 ? o.push(d) : (d === e.currentPage - 3 || d === e.currentPage + 3) && o.push("..."), o),
|
|
181
186
|
[]
|
|
182
187
|
));
|
|
183
188
|
function _() {
|
|
184
|
-
e.currentPage < t.value &&
|
|
189
|
+
e.currentPage < t.value && a("update:currentPage", e.currentPage + 1);
|
|
185
190
|
}
|
|
186
|
-
function
|
|
187
|
-
e.currentPage > 1 &&
|
|
191
|
+
function m() {
|
|
192
|
+
e.currentPage > 1 && a("update:currentPage", e.currentPage - 1);
|
|
188
193
|
}
|
|
189
|
-
function
|
|
190
|
-
e.currentPage > 1 &&
|
|
194
|
+
function y() {
|
|
195
|
+
e.currentPage > 1 && a("update:currentPage", 1);
|
|
191
196
|
}
|
|
192
197
|
function l() {
|
|
193
|
-
e.currentPage < t.value &&
|
|
198
|
+
e.currentPage < t.value && a("update:currentPage", e.total);
|
|
194
199
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
200
|
+
function h(o) {
|
|
201
|
+
o > 0 && o <= t.value && a("update:currentPage", o);
|
|
197
202
|
}
|
|
198
|
-
function i(
|
|
199
|
-
|
|
203
|
+
function i(o) {
|
|
204
|
+
a("update:perPage", Number(o));
|
|
200
205
|
}
|
|
201
|
-
return (
|
|
206
|
+
return (o, d) => (f(), g("div", fe, [
|
|
202
207
|
u("div", null, [
|
|
203
|
-
A(
|
|
208
|
+
A(pe, {
|
|
204
209
|
options: p(r),
|
|
205
|
-
"default-value": p(
|
|
210
|
+
"default-value": p(s),
|
|
206
211
|
label: "Per page",
|
|
207
212
|
"onUpdate:modelValue": i
|
|
208
213
|
}, null, 8, ["options", "default-value"])
|
|
209
214
|
]),
|
|
210
215
|
u("div", null, [
|
|
211
|
-
u("span",
|
|
216
|
+
u("span", ge, b((o.currentPage - 1) * o.perPage + 1) + " - " + b(o.currentPage * o.perPage > o.total ? o.total : o.currentPage * o.perPage) + " of " + b(o.total), 1)
|
|
212
217
|
]),
|
|
213
|
-
u("ul",
|
|
218
|
+
u("ul", _e, [
|
|
214
219
|
u("li", null, [
|
|
215
220
|
u("button", {
|
|
216
221
|
class: "pagination__btn",
|
|
217
|
-
onClick:
|
|
218
|
-
disabled:
|
|
219
|
-
},
|
|
222
|
+
onClick: y,
|
|
223
|
+
disabled: o.currentPage === 1
|
|
224
|
+
}, ye, 8, he)
|
|
220
225
|
]),
|
|
221
226
|
u("li", null, [
|
|
222
227
|
u("button", {
|
|
223
228
|
class: "pagination__btn",
|
|
224
|
-
onClick:
|
|
225
|
-
disabled:
|
|
226
|
-
},
|
|
229
|
+
onClick: m,
|
|
230
|
+
disabled: o.currentPage === 1
|
|
231
|
+
}, $e, 8, Pe)
|
|
227
232
|
]),
|
|
228
233
|
(f(!0), g(w, null, $(p(c), (C) => (f(), g("li", { key: C }, [
|
|
229
234
|
typeof C == "number" ? (f(), g("button", {
|
|
230
235
|
key: 0,
|
|
231
|
-
class:
|
|
232
|
-
onClick: (
|
|
233
|
-
},
|
|
236
|
+
class: O(["pagination__btn", { "pagination__btn--current": C === o.currentPage }]),
|
|
237
|
+
onClick: (Ze) => h(C)
|
|
238
|
+
}, b(C), 11, we)) : (f(), g("span", Ce, "..."))
|
|
234
239
|
]))), 128)),
|
|
235
240
|
u("li", null, [
|
|
236
241
|
u("button", {
|
|
237
242
|
class: "pagination__btn",
|
|
238
243
|
onClick: _,
|
|
239
|
-
disabled:
|
|
240
|
-
},
|
|
244
|
+
disabled: o.currentPage === p(t)
|
|
245
|
+
}, Ee, 8, Ve)
|
|
241
246
|
]),
|
|
242
247
|
u("li", null, [
|
|
243
248
|
u("button", {
|
|
244
249
|
class: "pagination__btn",
|
|
245
250
|
onClick: l,
|
|
246
|
-
disabled:
|
|
247
|
-
},
|
|
251
|
+
disabled: o.currentPage === p(t)
|
|
252
|
+
}, Re, 8, Ae)
|
|
248
253
|
])
|
|
249
254
|
])
|
|
250
255
|
]));
|
|
251
256
|
}
|
|
252
257
|
});
|
|
253
|
-
const
|
|
254
|
-
const e =
|
|
255
|
-
for (const [t, r] of
|
|
258
|
+
const Le = (n, a) => {
|
|
259
|
+
const e = n.__vccOpts || n;
|
|
260
|
+
for (const [t, r] of a)
|
|
256
261
|
e[t] = r;
|
|
257
262
|
return e;
|
|
258
|
-
},
|
|
259
|
-
function R(
|
|
260
|
-
let
|
|
261
|
-
return
|
|
262
|
-
e.children && (
|
|
263
|
-
}),
|
|
263
|
+
}, Ne = /* @__PURE__ */ Le(je, [["__scopeId", "data-v-d06f6d12"]]);
|
|
264
|
+
function R(n) {
|
|
265
|
+
let a = 1;
|
|
266
|
+
return n.forEach((e) => {
|
|
267
|
+
e.children && (a = Math.max(a, R(e.children) + 1));
|
|
268
|
+
}), a;
|
|
264
269
|
}
|
|
265
|
-
function
|
|
266
|
-
let
|
|
267
|
-
return
|
|
268
|
-
e.children ?
|
|
269
|
-
}),
|
|
270
|
+
function K(n) {
|
|
271
|
+
let a = 0;
|
|
272
|
+
return n.forEach((e) => {
|
|
273
|
+
e.children ? a += K(e.children) : a++;
|
|
274
|
+
}), a;
|
|
270
275
|
}
|
|
271
|
-
function
|
|
272
|
-
return
|
|
273
|
-
if (e[t] || (e[t] = []),
|
|
274
|
-
const { children: c, ..._ } =
|
|
276
|
+
function j(n, a, e = [], t = 0, r = 0) {
|
|
277
|
+
return n.forEach((s) => {
|
|
278
|
+
if (e[t] || (e[t] = []), s.children) {
|
|
279
|
+
const { children: c, ..._ } = s, m = K(c);
|
|
275
280
|
e[t].push({
|
|
276
281
|
..._,
|
|
277
|
-
colSpan:
|
|
282
|
+
colSpan: m,
|
|
278
283
|
scope: "colgroup"
|
|
279
|
-
}),
|
|
284
|
+
}), j(c, a, e, t + 1, r + 1);
|
|
280
285
|
} else {
|
|
281
|
-
const c =
|
|
286
|
+
const c = a - r;
|
|
282
287
|
e[t].push({
|
|
283
|
-
...
|
|
284
|
-
key:
|
|
285
|
-
label:
|
|
288
|
+
...s,
|
|
289
|
+
key: s.key,
|
|
290
|
+
label: s.label,
|
|
286
291
|
rowSpan: c,
|
|
287
292
|
scope: "col"
|
|
288
293
|
});
|
|
289
294
|
}
|
|
290
295
|
}), e;
|
|
291
296
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
294
|
-
t.children ?
|
|
297
|
+
function L(n, a = "", e = []) {
|
|
298
|
+
return n.forEach((t) => {
|
|
299
|
+
t.children ? L(t.children, `${a}${t.key}.`, e) : e.push(`${a}${t.key}`);
|
|
295
300
|
}), e;
|
|
296
301
|
}
|
|
297
|
-
function
|
|
298
|
-
const
|
|
299
|
-
return
|
|
302
|
+
function tt(n) {
|
|
303
|
+
const a = R(n);
|
|
304
|
+
return j(n, a).reduce((r, s) => [...r, ...s], []);
|
|
300
305
|
}
|
|
301
|
-
const
|
|
302
|
-
const e =
|
|
303
|
-
let t =
|
|
306
|
+
const Te = (n, a) => {
|
|
307
|
+
const e = a.split(".");
|
|
308
|
+
let t = n;
|
|
304
309
|
for (let r = 0; r < e.length; r++)
|
|
305
310
|
if (t[e[r]])
|
|
306
311
|
t = t[e[r]];
|
|
@@ -308,89 +313,89 @@ const Ne = (a, n) => {
|
|
|
308
313
|
return;
|
|
309
314
|
return t;
|
|
310
315
|
};
|
|
311
|
-
function
|
|
312
|
-
return
|
|
313
|
-
[
|
|
314
|
-
})).reduce((
|
|
316
|
+
function He(n, a, e = 0, t = n.length) {
|
|
317
|
+
return n.map((r) => L(a).map((s) => ({
|
|
318
|
+
[s]: Te(r, s)
|
|
319
|
+
})).reduce((s, c) => ({ ...s, ...c }), {})).slice(e, t);
|
|
315
320
|
}
|
|
316
|
-
function
|
|
321
|
+
function Me(n, a, e) {
|
|
317
322
|
return {
|
|
318
323
|
bodyRows: P(() => {
|
|
319
|
-
const r = e.value.perPage * (e.value.currentPage - 1),
|
|
320
|
-
return
|
|
324
|
+
const r = e.value.perPage * (e.value.currentPage - 1), s = e.value.perPage * e.value.currentPage;
|
|
325
|
+
return He(n, p(a), r, s);
|
|
321
326
|
})
|
|
322
327
|
};
|
|
323
328
|
}
|
|
324
|
-
function
|
|
325
|
-
const
|
|
329
|
+
function De(n) {
|
|
330
|
+
const a = p(n) ?? [];
|
|
326
331
|
return {
|
|
327
|
-
headers: P(() =>
|
|
332
|
+
headers: P(() => j(a, R(a)))
|
|
328
333
|
};
|
|
329
334
|
}
|
|
330
|
-
const
|
|
335
|
+
const Ke = { key: 0 }, We = ["colspan"], xe = /* @__PURE__ */ u("div", { class: "flex justify-center items-center" }, [
|
|
331
336
|
/* @__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),
|
|
333
|
-
|
|
334
|
-
],
|
|
337
|
+
], -1), ze = [
|
|
338
|
+
xe
|
|
339
|
+
], Fe = ["id"], Ue = /* @__PURE__ */ S({
|
|
335
340
|
__name: "VueyeBody",
|
|
336
341
|
props: {
|
|
337
342
|
loading: { type: Boolean, default: !1 },
|
|
338
343
|
bodyRows: { default: () => [] },
|
|
339
344
|
itemValue: { default: "id" }
|
|
340
345
|
},
|
|
341
|
-
setup(
|
|
342
|
-
const
|
|
346
|
+
setup(n) {
|
|
347
|
+
const a = n, e = P(() => Object.keys(a.bodyRows[0]).length);
|
|
343
348
|
return (t, r) => (f(), g("tbody", null, [
|
|
344
|
-
t.loading ? (f(), g("tr",
|
|
345
|
-
u("td", { colspan: p(e) },
|
|
346
|
-
])) : (f(!0), g(w, { key: 1 }, $(t.bodyRows, (
|
|
347
|
-
key:
|
|
349
|
+
t.loading ? (f(), g("tr", Ke, [
|
|
350
|
+
u("td", { colspan: p(e) }, ze, 8, We)
|
|
351
|
+
])) : (f(!0), g(w, { key: 1 }, $(t.bodyRows, (s) => (f(), g("tr", {
|
|
352
|
+
key: s[t.itemValue]
|
|
348
353
|
}, [
|
|
349
|
-
k(t.$slots, "default", { row:
|
|
350
|
-
(f(!0), g(w, null, $(Object.keys(
|
|
351
|
-
key: `${
|
|
352
|
-
id: `${
|
|
354
|
+
k(t.$slots, "default", { row: s }, () => [
|
|
355
|
+
(f(!0), g(w, null, $(Object.keys(s), (c) => (f(), g("td", {
|
|
356
|
+
key: `${s[t.itemValue]}.${c}`,
|
|
357
|
+
id: `${s[t.itemValue]}.${c}`
|
|
353
358
|
}, [
|
|
354
359
|
k(t.$slots, "default", {
|
|
355
|
-
cell:
|
|
356
|
-
key: `${
|
|
360
|
+
cell: s[c],
|
|
361
|
+
key: `${s[t.itemValue]}.${c}`
|
|
357
362
|
}, () => [
|
|
358
|
-
|
|
363
|
+
T(b(s[c]), 1)
|
|
359
364
|
])
|
|
360
|
-
], 8,
|
|
365
|
+
], 8, Fe))), 128))
|
|
361
366
|
])
|
|
362
367
|
]))), 128))
|
|
363
368
|
]));
|
|
364
369
|
}
|
|
365
|
-
}),
|
|
370
|
+
}), qe = ["colspan", "rowspan", "scope"], Ge = /* @__PURE__ */ S({
|
|
366
371
|
__name: "VueyeHead",
|
|
367
372
|
props: {
|
|
368
373
|
columnHeaders: { default: () => [] }
|
|
369
374
|
},
|
|
370
|
-
setup(
|
|
371
|
-
return (
|
|
372
|
-
(f(!0), g(w, null, $(
|
|
373
|
-
(f(!0), g(w, null, $(t, (
|
|
374
|
-
key:
|
|
375
|
-
headerCell:
|
|
375
|
+
setup(n) {
|
|
376
|
+
return (a, e) => (f(), g("thead", null, [
|
|
377
|
+
(f(!0), g(w, null, $(a.columnHeaders, (t, r) => (f(), g("tr", { key: r }, [
|
|
378
|
+
(f(!0), g(w, null, $(t, (s) => k(a.$slots, `headerCell.${s.key}`, {
|
|
379
|
+
key: s.key,
|
|
380
|
+
headerCell: s
|
|
376
381
|
}, () => [
|
|
377
382
|
u("th", {
|
|
378
|
-
colspan:
|
|
379
|
-
rowspan:
|
|
380
|
-
scope:
|
|
381
|
-
class:
|
|
383
|
+
colspan: s.colSpan,
|
|
384
|
+
rowspan: s.rowSpan,
|
|
385
|
+
scope: s.scope,
|
|
386
|
+
class: O([s.className, "th"])
|
|
382
387
|
}, [
|
|
383
|
-
k(
|
|
388
|
+
k(a.$slots, `headerCellContent.${s.key}`, { headerCellContent: s }, () => [
|
|
384
389
|
u("span", {
|
|
385
|
-
class:
|
|
386
|
-
},
|
|
390
|
+
class: O(s.labelClassName)
|
|
391
|
+
}, b(s.label), 3)
|
|
387
392
|
])
|
|
388
|
-
], 10,
|
|
393
|
+
], 10, qe)
|
|
389
394
|
])), 128))
|
|
390
395
|
]))), 128))
|
|
391
396
|
]));
|
|
392
397
|
}
|
|
393
|
-
}),
|
|
398
|
+
}), Je = { class: "table__wrapper" }, Qe = { class: "table__caption" }, Xe = { class: "table__summary" }, Ye = { class: "table__pagination-wrapper" }, nt = /* @__PURE__ */ S({
|
|
394
399
|
inheritAttrs: !1,
|
|
395
400
|
__name: "VueyeTable",
|
|
396
401
|
props: {
|
|
@@ -405,65 +410,68 @@ const je = { key: 0 }, De = ["colspan"], Ke = /* @__PURE__ */ u("div", { class:
|
|
|
405
410
|
caption: { default: "" },
|
|
406
411
|
summary: { default: "" }
|
|
407
412
|
},
|
|
408
|
-
setup(
|
|
409
|
-
const
|
|
410
|
-
perPage:
|
|
411
|
-
currentPage:
|
|
412
|
-
})
|
|
413
|
-
|
|
413
|
+
setup(n) {
|
|
414
|
+
const a = n, e = J(a, "columnHeaders"), t = E({
|
|
415
|
+
perPage: a.perPage || 10,
|
|
416
|
+
currentPage: a.currentPage || 1
|
|
417
|
+
});
|
|
418
|
+
console.log(a);
|
|
419
|
+
const { headers: r } = De(e), { bodyRows: s } = Me(a.data, e, t), c = Q(), _ = Object.keys(c).filter((l) => l.startsWith("headerCell"));
|
|
420
|
+
function m(l) {
|
|
414
421
|
t.value.currentPage = l;
|
|
415
422
|
}
|
|
416
|
-
function
|
|
423
|
+
function y(l) {
|
|
417
424
|
t.value.perPage = l;
|
|
418
425
|
}
|
|
419
|
-
return (l,
|
|
426
|
+
return (l, h) => (f(), g("div", Je, [
|
|
427
|
+
T(" The table Header "),
|
|
420
428
|
u("table", {
|
|
421
|
-
class:
|
|
429
|
+
class: O(l.$attrs.class ?? "table")
|
|
422
430
|
}, [
|
|
423
431
|
k(l.$slots, "caption", {}, () => [
|
|
424
|
-
u("caption",
|
|
432
|
+
u("caption", Qe, b(l.caption), 1)
|
|
425
433
|
]),
|
|
426
|
-
A(p(
|
|
434
|
+
A(p(Ge), { columnHeaders: p(r) }, X({ _: 2 }, [
|
|
427
435
|
$(p(_), (i) => ({
|
|
428
436
|
name: i,
|
|
429
|
-
fn: Y((
|
|
430
|
-
k(l.$slots, i, Z(ee(
|
|
437
|
+
fn: Y((o) => [
|
|
438
|
+
k(l.$slots, i, Z(ee(o)))
|
|
431
439
|
])
|
|
432
440
|
}))
|
|
433
441
|
]), 1032, ["columnHeaders"]),
|
|
434
|
-
A(p(
|
|
435
|
-
bodyRows: p(
|
|
442
|
+
A(p(Ue), {
|
|
443
|
+
bodyRows: p(s),
|
|
436
444
|
loading: l.loading
|
|
437
445
|
}, null, 8, ["bodyRows", "loading"]),
|
|
438
446
|
k(l.$slots, "summary", {}, () => [
|
|
439
|
-
u("caption",
|
|
447
|
+
u("caption", Xe, b(l.summary), 1)
|
|
440
448
|
])
|
|
441
449
|
], 2),
|
|
442
|
-
u("div",
|
|
443
|
-
A(
|
|
450
|
+
u("div", Ye, [
|
|
451
|
+
A(Ne, {
|
|
444
452
|
perPage: p(t).perPage,
|
|
445
453
|
currentPage: p(t).currentPage,
|
|
446
454
|
perPageOptions: l.perPageOptions,
|
|
447
455
|
total: l.data.length,
|
|
448
|
-
"onUpdate:currentPage":
|
|
449
|
-
"onUpdate:perPage":
|
|
456
|
+
"onUpdate:currentPage": m,
|
|
457
|
+
"onUpdate:perPage": y
|
|
450
458
|
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total"])
|
|
451
459
|
])
|
|
452
460
|
]));
|
|
453
461
|
}
|
|
454
462
|
});
|
|
455
|
-
function
|
|
463
|
+
function at(n) {
|
|
456
464
|
return {
|
|
457
|
-
headerKeys: P(() =>
|
|
465
|
+
headerKeys: P(() => L(n.flat()))
|
|
458
466
|
};
|
|
459
467
|
}
|
|
460
468
|
export {
|
|
461
|
-
|
|
462
|
-
|
|
469
|
+
nt as VueyeTable,
|
|
470
|
+
tt as defineColumnHeaders,
|
|
463
471
|
R as depthCount,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
472
|
+
j as flatHeadersToRows,
|
|
473
|
+
He as getBodyRows,
|
|
474
|
+
L as getHeaderKeys,
|
|
475
|
+
K as leafCount,
|
|
476
|
+
at as useHeaderKeys
|
|
469
477
|
};
|
package/dist/vueye-table.umd.cjs
CHANGED
|
@@ -1 +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"})});
|
|
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(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function N(o){return typeof o=="function"?o():e.unref(o)}const C=typeof window<"u"&&typeof document<"u",A=Object.prototype.toString,D=o=>A.call(o)==="[object Object]",V=()=>{},I=R();function R(){var o;return C&&((o=window==null?void 0:window.navigator)==null?void 0:o.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function y(o){var a;const t=N(o);return(a=t==null?void 0:t.$el)!=null?a:t}const S=C?window:void 0;function B(...o){let a,t,n,s;if(typeof o[0]=="string"||Array.isArray(o[0])?([t,n,s]=o,a=S):[a,t,n,s]=o,!a)return V;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const l=[],d=()=>{l.forEach(c=>c()),l.length=0},f=(c,m,i,r)=>(c.addEventListener(m,i,r),()=>c.removeEventListener(m,i,r)),g=e.watch(()=>[y(a),N(s)],([c,m])=>{if(d(),!c)return;const i=D(m)?{...m}:m;l.push(...t.flatMap(r=>n.map(p=>f(c,r,p,i))))},{immediate:!0,flush:"post"}),_=()=>{g(),d()};return L(_),_}let w=!1;function T(o,a,t={}){const{window:n=S,ignore:s=[],capture:l=!0,detectIframe:d=!1}=t;if(!n)return;I&&!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 g=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(o);if(!(!r||r===i.target||i.composedPath().includes(r))){if(i.detail===0&&(f=!g(i)),!f){f=!0;return}a(i)}},{passive:!0,capture:l}),B(n,"pointerdown",i=>{const r=y(o);r&&(f=!i.composedPath().includes(r)&&!g(i))},{passive:!0}),d&&B(n,"blur",i=>{setTimeout(()=>{var r;const p=y(o);((r=n.document.activeElement)==null?void 0:r.tagName)==="IFRAME"&&!(p!=null&&p.contains(n.document.activeElement))&&a(i)},0)})].filter(Boolean);return()=>c.forEach(i=>i())}const j={class:"relative"},H=["aria-expanded"],F=e.createElementVNode("span",{class:"i-solar-alt-arrow-down-linear"},null,-1),z={class:"py-1",role:"none"},M=["onClick"],K=e.defineComponent({__name:"VueyeDropdown",props:{options:{default:()=>[]},modelValue:{default:""},label:{default:""},defaultValue:{}},emits:["update:modelValue"],setup(o,{emit:a}){const t=o,n=e.ref(null);T(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 g(){s.value=!s.value}function _(c){l.value=c,s.value=!1,a("update:modelValue",d.value.value)}return e.watchEffect(()=>{const c=t.options.findIndex(m=>m.value===t.modelValue);c!==-1&&(l.value=c)}),(c,m)=>(e.openBlock(),e.createElementBlock("div",j,[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:g,"aria-expanded":e.unref(s),"aria-haspopup":!0,ref:"buttonRef"},[e.createElementVNode("span",null,e.toDisplayString(e.unref(d).label),1),F],8,H),e.unref(s)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"origin-top-right bottom-full 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 z-40",role:"menu","aria-orientation":"vertical","aria-labelledby":f,ref_key:"target",ref:n},[e.createElementVNode("div",z,[(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,M))),128))])],512)):e.createCommentVNode("",!0)]))}}),h=o=>(e.pushScopeId("data-v-d06f6d12"),o=o(),e.popScopeId(),o),W={class:"pagination__wrapper"},U={class:"pagination__details"},q={class:"pagination__btn-list"},G=["disabled"],J=[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))],Q=["disabled"],X=[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))],Y=["onClick"],Z={key:1,class:"pagination__btn"},x=["disabled"],v=[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))],ee=["disabled"],te=[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))],ne=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(o,{emit:a}){const t=o,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&&a("update:currentPage",t.currentPage+1)}function g(){t.currentPage>1&&a("update:currentPage",t.currentPage-1)}function _(){t.currentPage>1&&a("update:currentPage",1)}function c(){t.currentPage<n.value&&a("update:currentPage",t.total)}function m(r){r>0&&r<=n.value&&a("update:currentPage",r)}function i(r){a("update:perPage",Number(r))}return(r,p)=>(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",null,[e.createVNode(K,{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",U,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",q,[e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:_,disabled:r.currentPage===1},J,8,G)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:g,disabled:r.currentPage===1},X,8,Q)]),(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:Ie=>m(b)},e.toDisplayString(b),11,Y)):(e.openBlock(),e.createElementBlock("span",Z,"..."))]))),128)),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:f,disabled:r.currentPage===e.unref(n)},v,8,x)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"pagination__btn",onClick:c,disabled:r.currentPage===e.unref(n)},te,8,ee)])])]))}}),we="",oe=((o,a)=>{const t=o.__vccOpts||o;for(const[n,s]of a)t[n]=s;return t})(ne,[["__scopeId","data-v-d06f6d12"]]);function k(o){let a=1;return o.forEach(t=>{t.children&&(a=Math.max(a,k(t.children)+1))}),a}function $(o){let a=0;return o.forEach(t=>{t.children?a+=$(t.children):a++}),a}function P(o,a,t=[],n=0,s=0){return o.forEach(l=>{if(t[n]||(t[n]=[]),l.children){const{children:d,...f}=l,g=$(d);t[n].push({...f,colSpan:g,scope:"colgroup"}),P(d,a,t,n+1,s+1)}else{const d=a-s;t[n].push({...l,key:l.key,label:l.label,rowSpan:d,scope:"col"})}}),t}function E(o,a="",t=[]){return o.forEach(n=>{n.children?E(n.children,`${a}${n.key}.`,t):t.push(`${a}${n.key}`)}),t}function ae(o){const a=k(o);return P(o,a).reduce((s,l)=>[...s,...l],[])}const re=(o,a)=>{const t=a.split(".");let n=o;for(let s=0;s<t.length;s++)if(n[t[s]])n=n[t[s]];else return;return n};function O(o,a,t=0,n=o.length){return o.map(s=>E(a).map(l=>({[l]:re(s,l)})).reduce((l,d)=>({...l,...d}),{})).slice(t,n)}function le(o,a,t){return{bodyRows:e.computed(()=>{const s=t.value.perPage*(t.value.currentPage-1),l=t.value.perPage*t.value.currentPage;return O(o,e.unref(a),s,l)})}}function se(o){const a=e.unref(o)??[];return{headers:e.computed(()=>P(a,k(a)))}}const ce={key:0},ie=["colspan"],de=[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)],pe=["id"],ue=e.defineComponent({__name:"VueyeBody",props:{loading:{type:Boolean,default:!1},bodyRows:{default:()=>[]},itemValue:{default:"id"}},setup(o){const a=o,t=e.computed(()=>Object.keys(a.bodyRows[0]).length);return(n,s)=>(e.openBlock(),e.createElementBlock("tbody",null,[n.loading?(e.openBlock(),e.createElementBlock("tr",ce,[e.createElementVNode("td",{colspan:e.unref(t)},de,8,ie)])):(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,pe))),128))])]))),128))]))}}),fe=["colspan","rowspan","scope"],me=e.defineComponent({__name:"VueyeHead",props:{columnHeaders:{default:()=>[]}},setup(o){return(a,t)=>(e.openBlock(),e.createElementBlock("thead",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columnHeaders,(n,s)=>(e.openBlock(),e.createElementBlock("tr",{key:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,l=>e.renderSlot(a.$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(a.$slots,`headerCellContent.${l.key}`,{headerCellContent:l},()=>[e.createElementVNode("span",{class:e.normalizeClass(l.labelClassName)},e.toDisplayString(l.label),3)])],10,fe)])),128))]))),128))]))}}),ge={class:"table__wrapper"},_e={class:"table__caption"},he={class:"table__summary"},ye={class:"table__pagination-wrapper"},be=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(o){const a=o,t=e.toRef(a,"columnHeaders"),n=e.ref({perPage:a.perPage||10,currentPage:a.currentPage||1});console.log(a);const{headers:s}=se(t),{bodyRows:l}=le(a.data,t,n),d=e.useSlots(),f=Object.keys(d).filter(c=>c.startsWith("headerCell"));function g(c){n.value.currentPage=c}function _(c){n.value.perPage=c}return(c,m)=>(e.openBlock(),e.createElementBlock("div",ge,[e.createTextVNode(" The table Header "),e.createElementVNode("table",{class:e.normalizeClass(c.$attrs.class??"table")},[e.renderSlot(c.$slots,"caption",{},()=>[e.createElementVNode("caption",_e,e.toDisplayString(c.caption),1)]),e.createVNode(e.unref(me),{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(ue),{bodyRows:e.unref(l),loading:c.loading},null,8,["bodyRows","loading"]),e.renderSlot(c.$slots,"summary",{},()=>[e.createElementVNode("caption",he,e.toDisplayString(c.summary),1)])],2),e.createElementVNode("div",ye,[e.createVNode(oe,{perPage:e.unref(n).perPage,currentPage:e.unref(n).currentPage,perPageOptions:c.perPageOptions,total:c.data.length,"onUpdate:currentPage":g,"onUpdate:perPage":_},null,8,["perPage","currentPage","perPageOptions","total"])])]))}}),Ae="",De="";function ke(o){return{headerKeys:e.computed(()=>E(o.flat()))}}u.VueyeTable=be,u.defineColumnHeaders=ae,u.depthCount=k,u.flatHeadersToRows=P,u.getBodyRows=O,u.getHeaderKeys=E,u.leafCount=$,u.useHeaderKeys=ke,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,105 +1,79 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"./*": "./dist/vueye-table.js",
|
|
27
|
-
"./dist/style.css": "./dist/style.css"
|
|
2
|
+
"name": "vueye-table",
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Vue data table",
|
|
6
|
+
"author": "Brahim Boussadjra",
|
|
7
|
+
"repository": "https://github.com/boussadjra/vueye-table",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"vue",
|
|
14
|
+
"vite",
|
|
15
|
+
"template"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./dist/vueye-table.umd.cjs",
|
|
19
|
+
"module": "./dist/vueye-table.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/vueye-table.js",
|
|
24
|
+
"require": "./dist/vueye-table.umd.cjs",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
28
26
|
},
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"semantic-release": "^21.1.1",
|
|
83
|
-
"simple-git-hooks": "^2.9.0",
|
|
84
|
-
"tailwindcss": "^3.3.3",
|
|
85
|
-
"typescript": "~5.2.2",
|
|
86
|
-
"unocss": "^0.55.3",
|
|
87
|
-
"unplugin-auto-import": "^0.16.6",
|
|
88
|
-
"unplugin-icons": "^0.17.0",
|
|
89
|
-
"unplugin-vue-components": "^0.25.2",
|
|
90
|
-
"unplugin-vue-markdown": "^0.24.3",
|
|
91
|
-
"vite": "^4.4.9",
|
|
92
|
-
"vite-plugin-dts": "^3.5.2",
|
|
93
|
-
"vite-plugin-pages": "^0.31.0",
|
|
94
|
-
"vite-plugin-vue-layouts": "^0.8.0",
|
|
95
|
-
"vitest": "^0.34.3",
|
|
96
|
-
"vue-tsc": "^1.8.8"
|
|
97
|
-
},
|
|
98
|
-
"peerDependencies": {
|
|
99
|
-
"vue": "^3.3.4"
|
|
100
|
-
},
|
|
101
|
-
"lint-staged": {
|
|
102
|
-
"*.{js,ts,vue}": "eslint --fix",
|
|
103
|
-
"*.{js,ts,vue,css,scss,json,md}": "prettier --write"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
27
|
+
"./*": "./dist/vueye-table.js",
|
|
28
|
+
"./dist/style.css": "./dist/style.css"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@antfu/eslint-config": "^0.43.1",
|
|
32
|
+
"@egoist/tailwindcss-icons": "^1.2.0",
|
|
33
|
+
"@faker-js/faker": "^8.1.0",
|
|
34
|
+
"@iconify-json/solar": "^1.1.5",
|
|
35
|
+
"@iconify-json/tabler": "^1.1.92",
|
|
36
|
+
"@rushstack/eslint-patch": "^1.5.0",
|
|
37
|
+
"@testing-library/vue": "^7.0.0",
|
|
38
|
+
"@types/node": "^20.7.1",
|
|
39
|
+
"@vitejs/plugin-vue": "^4.3.4",
|
|
40
|
+
"@vue/eslint-config-prettier": "^8.0.0",
|
|
41
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
42
|
+
"@vue/tsconfig": "^0.4.0",
|
|
43
|
+
"@vueuse/core": "^10.4.1",
|
|
44
|
+
"@vueuse/head": "^2.0.0",
|
|
45
|
+
"autoprefixer": "^10.4.16",
|
|
46
|
+
"eslint": "^8.50.0",
|
|
47
|
+
"eslint-plugin-import": "^2.28.1",
|
|
48
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
49
|
+
"pathe": "^1.1.1",
|
|
50
|
+
"pnpm": "^8.8.0",
|
|
51
|
+
"postcss": "^8.4.30",
|
|
52
|
+
"prettier": "^3.0.3",
|
|
53
|
+
"tailwindcss": "^3.3.3",
|
|
54
|
+
"typescript": "~5.2.2",
|
|
55
|
+
"unplugin-auto-import": "^0.16.6",
|
|
56
|
+
"unplugin-icons": "^0.17.0",
|
|
57
|
+
"vite": "^4.4.9",
|
|
58
|
+
"vite-plugin-dts": "^3.6.0",
|
|
59
|
+
"vitest": "^0.34.5",
|
|
60
|
+
"vue-router": "^4.2.5",
|
|
61
|
+
"vue-tsc": "^1.8.15"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"vue": "^3.3.4"
|
|
65
|
+
},
|
|
66
|
+
"lint-staged": {
|
|
67
|
+
"*.{js,ts,vue}": "eslint --fix",
|
|
68
|
+
"*.{js,ts,vue,css,scss,json,md}": "prettier --write"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"dev": "vite",
|
|
72
|
+
"build": " vite build",
|
|
73
|
+
"preview": "vite preview",
|
|
74
|
+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
75
|
+
"format": "prettier . --write --ignore-path .gitignore",
|
|
76
|
+
"test:unit": "vitest",
|
|
77
|
+
"pub:release": "pnpm publish --access public"
|
|
78
|
+
}
|
|
79
|
+
}
|