vueye-table 2.0.0-alpha.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/README.md +4 -14
- package/dist/components/core/VueyeTable/VueyeHead/VueyeHead.vue.d.ts +1 -1
- package/dist/components/core/VueyeTable/VueyeTable.vue.d.ts +60 -18
- package/dist/components/core/VueyeTable/types/Column.d.ts +11 -6
- package/dist/components/core/VueyeTable/types/Utils.d.ts +10 -0
- package/dist/components/core/VueyeTable/utils/header.d.ts +2 -1
- package/dist/data/product.d.ts +2 -6
- package/dist/style.css +1 -1
- package/dist/vueye-table.js +295 -278
- package/dist/vueye-table.umd.cjs +1 -1
- package/package.json +25 -21
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Vueye-table
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
:warning: **This project is still in development.**
|
|
4
|
+
|
|
5
|
+
## Tools and conventions
|
|
4
6
|
|
|
5
7
|
- [x] Eslint
|
|
6
8
|
- [x] Prettier
|
|
@@ -25,17 +27,5 @@
|
|
|
25
27
|
11. Responsive Design
|
|
26
28
|
12. Customization
|
|
27
29
|
13. Accessibility
|
|
30
|
+
14. ...
|
|
28
31
|
|
|
29
|
-
## How to use:
|
|
30
|
-
|
|
31
|
-
1. Clone the project
|
|
32
|
-
2. `yarn`
|
|
33
|
-
3. `npx semantic-release-cli setup`
|
|
34
|
-
4. Add components
|
|
35
|
-
5. `git add .`
|
|
36
|
-
6. `yarn commit`
|
|
37
|
-
7. `git push`
|
|
38
|
-
|
|
39
|
-
## Real Example:
|
|
40
|
-
|
|
41
|
-
[vue-tradingviewWidgets](https://github.com/boussadjra/vue-tradingviewWidgets)
|
|
@@ -13,7 +13,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
13
13
|
};
|
|
14
14
|
}>>, {
|
|
15
15
|
columnHeaders: ColumnHeader[][];
|
|
16
|
-
}, {}>, SlotHeader<string
|
|
16
|
+
}, {}>, SlotHeader<Record<string, string>>>;
|
|
17
17
|
export default _default;
|
|
18
18
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
19
19
|
new (): {
|
|
@@ -1,35 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
columnHeaders: ColumnHeaderBase<Record<string, unknown>>[];
|
|
1
|
+
import { ColumnHeader } from './types';
|
|
2
|
+
declare const _default: <TData extends Record<string, unknown>, TColumn extends ColumnHeader>(__VLS_props: {
|
|
3
|
+
itemValue?: string | undefined;
|
|
4
|
+
columnHeaders: TColumn[];
|
|
6
5
|
data: TData[];
|
|
7
|
-
perPage?: number;
|
|
8
|
-
currentPage?: number;
|
|
9
|
-
perPageOptions?: number[];
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
selectable?: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
perPage?: number | undefined;
|
|
7
|
+
currentPage?: number | undefined;
|
|
8
|
+
perPageOptions?: number[] | undefined;
|
|
9
|
+
loading?: boolean | undefined;
|
|
10
|
+
selectable?: boolean | undefined;
|
|
11
|
+
caption?: string | undefined;
|
|
12
|
+
summary?: string | undefined;
|
|
13
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
|
|
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
|
+
};
|
|
15
26
|
expose(exposed: {}): void;
|
|
16
27
|
attrs: any;
|
|
17
|
-
slots:
|
|
28
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
29
|
+
caption: () => any;
|
|
30
|
+
summary: () => any;
|
|
31
|
+
};
|
|
18
32
|
emit: any;
|
|
19
33
|
}, "attrs" | "emit" | "slots"> | undefined, __VLS_setup?: Promise<{
|
|
20
|
-
props:
|
|
34
|
+
props: {
|
|
35
|
+
itemValue?: string | undefined;
|
|
36
|
+
columnHeaders: TColumn[];
|
|
37
|
+
data: TData[];
|
|
38
|
+
perPage?: number | undefined;
|
|
39
|
+
currentPage?: number | undefined;
|
|
40
|
+
perPageOptions?: number[] | undefined;
|
|
41
|
+
loading?: boolean | undefined;
|
|
42
|
+
selectable?: boolean | undefined;
|
|
43
|
+
caption?: string | undefined;
|
|
44
|
+
summary?: string | undefined;
|
|
45
|
+
};
|
|
21
46
|
expose(exposed: {}): void;
|
|
22
47
|
attrs: any;
|
|
23
|
-
slots:
|
|
48
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
49
|
+
caption: () => any;
|
|
50
|
+
summary: () => any;
|
|
51
|
+
};
|
|
24
52
|
emit: any;
|
|
25
53
|
}>) => globalThis.VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
26
54
|
[key: string]: any;
|
|
27
55
|
}> & {
|
|
28
56
|
__ctx?: {
|
|
29
|
-
props:
|
|
57
|
+
props: {
|
|
58
|
+
itemValue?: string | undefined;
|
|
59
|
+
columnHeaders: TColumn[];
|
|
60
|
+
data: TData[];
|
|
61
|
+
perPage?: number | undefined;
|
|
62
|
+
currentPage?: number | undefined;
|
|
63
|
+
perPageOptions?: number[] | undefined;
|
|
64
|
+
loading?: boolean | undefined;
|
|
65
|
+
selectable?: boolean | undefined;
|
|
66
|
+
caption?: string | undefined;
|
|
67
|
+
summary?: string | undefined;
|
|
68
|
+
};
|
|
30
69
|
expose(exposed: {}): void;
|
|
31
70
|
attrs: any;
|
|
32
|
-
slots:
|
|
71
|
+
slots: import("./types").SlotHeaderCell<TData> & import("./types").SlotHeaderCellContent<TData> & {
|
|
72
|
+
caption: () => any;
|
|
73
|
+
summary: () => any;
|
|
74
|
+
};
|
|
33
75
|
emit: any;
|
|
34
76
|
} | undefined;
|
|
35
77
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DeepKeys } from './Utils';
|
|
1
2
|
export type SortOrder = 'ascending' | 'descending' | null;
|
|
2
3
|
export type FiltrableColumnHeaderBase = {
|
|
3
4
|
filterable?: boolean;
|
|
@@ -22,7 +23,7 @@ export type SortableColumnHeader = SortableColumnHeaderBase & {
|
|
|
22
23
|
defaultSortOrder?: SortOrder;
|
|
23
24
|
};
|
|
24
25
|
export type ColumnHeaderBase<TData extends Record<string, unknown>> = FiltrableColumnHeaderBase & SortableColumnHeaderBase & {
|
|
25
|
-
key:
|
|
26
|
+
key: string;
|
|
26
27
|
label: string;
|
|
27
28
|
children?: ColumnHeaderBase<TData>[];
|
|
28
29
|
align?: 'left' | 'center' | 'right';
|
|
@@ -34,17 +35,21 @@ export type ColumnHeaderBase<TData extends Record<string, unknown>> = FiltrableC
|
|
|
34
35
|
resizable?: boolean;
|
|
35
36
|
showOverflowTooltip?: boolean;
|
|
36
37
|
};
|
|
37
|
-
export type ColumnHeader = ColumnHeaderBase<{
|
|
38
|
-
id: any;
|
|
39
|
-
}> & FiltrableColumnHeader & SortableColumnHeader & {
|
|
38
|
+
export type ColumnHeader = ColumnHeaderBase<{}> & {
|
|
40
39
|
rowSpan?: number;
|
|
41
40
|
colSpan?: number;
|
|
42
41
|
width?: string;
|
|
43
42
|
minWidth?: string;
|
|
44
43
|
scope?: string;
|
|
45
44
|
};
|
|
46
|
-
export type
|
|
47
|
-
[
|
|
45
|
+
export type SlotHeaderCell<T> = {
|
|
46
|
+
[K in DeepKeys<T> as K extends string ? `headerCell.${K}` : never]: (props: {
|
|
48
47
|
headerCell: ColumnHeader;
|
|
49
48
|
}) => any;
|
|
50
49
|
};
|
|
50
|
+
export type SlotHeaderCellContent<T> = {
|
|
51
|
+
[K in DeepKeys<T> as K extends string ? `headerCellContent.${K}` : never]: (props: {
|
|
52
|
+
headerCellContent: ColumnHeader;
|
|
53
|
+
}) => any;
|
|
54
|
+
};
|
|
55
|
+
export type SlotHeader<T> = SlotHeaderCell<T> & SlotHeaderCellContent<T>;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export type DeepKeys<T> = T extends object ? {
|
|
2
2
|
[K in keyof T]: K | DeepKeys<T[K]>;
|
|
3
3
|
}[keyof T] : never;
|
|
4
|
+
export type Prefix<T extends object, P extends string> = {
|
|
5
|
+
[key in keyof T as `${P}${string & key}`]: T[key];
|
|
6
|
+
};
|
|
7
|
+
export type DeepKeyValues<T extends readonly object[]> = {
|
|
8
|
+
[K in keyof T]: T[K] extends {
|
|
9
|
+
key: infer U;
|
|
10
|
+
} ? U extends string ? T[K] extends {
|
|
11
|
+
children: infer C;
|
|
12
|
+
} ? C extends readonly object[] ? U | DeepKeyValues<C> : never : U : never : never;
|
|
13
|
+
}[number];
|
|
@@ -2,4 +2,5 @@ import { ColumnHeader } from '../types';
|
|
|
2
2
|
export declare function depthCount(headers: ColumnHeader[]): number;
|
|
3
3
|
export declare function leafCount(headers: ColumnHeader[]): number;
|
|
4
4
|
export declare function flatHeadersToRows(headers: ColumnHeader[], depth: number, rows?: ColumnHeader[][], currentRow?: number, level?: number): ColumnHeader[][];
|
|
5
|
-
export declare function getHeaderKeys(headers:
|
|
5
|
+
export declare function getHeaderKeys<T extends ColumnHeader>(headers: T[], keysPath?: string, keys?: string[]): string[];
|
|
6
|
+
export declare function defineColumnHeaders(headers: any[]): ColumnHeader[];
|
package/dist/data/product.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
[k in DeepKeys<DataItem>]: any;
|
|
4
|
-
};
|
|
5
|
-
export declare const headers: ColumnHeaderBase<FlattenData<(typeof data)[0]>>[];
|
|
1
|
+
import { ColumnHeader } from '../components/core/VueyeTable';
|
|
2
|
+
export declare const headers: ColumnHeader[];
|
|
6
3
|
export declare const data: {
|
|
7
4
|
id: number;
|
|
8
5
|
product: string;
|
|
@@ -15,4 +12,3 @@ export declare const data: {
|
|
|
15
12
|
'2023': number;
|
|
16
13
|
};
|
|
17
14
|
}[];
|
|
18
|
-
export {};
|
package/dist/style.css
CHANGED
|
@@ -1 +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;overflow-x:auto}.table__pagination-wrapper{display:flex;justify-content:flex-end;padding-top:1rem;padding-bottom:1rem}
|
package/dist/vueye-table.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { getCurrentScope as K, onScopeDispose as
|
|
2
|
-
function
|
|
3
|
-
return K() ? (
|
|
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
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return typeof
|
|
5
|
+
function H(a) {
|
|
6
|
+
return typeof a == "function" ? a() : p(a);
|
|
7
7
|
}
|
|
8
|
-
const
|
|
9
|
-
},
|
|
10
|
-
function
|
|
11
|
-
var
|
|
12
|
-
return
|
|
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
13
|
}
|
|
14
|
-
function V(
|
|
15
|
-
const
|
|
16
|
-
return (
|
|
14
|
+
function V(a) {
|
|
15
|
+
const n = H(a);
|
|
16
|
+
return (n == null ? void 0 : n.$el) ?? n;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
if (typeof
|
|
22
|
-
return
|
|
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
23
|
Array.isArray(e) || (e = [e]), Array.isArray(t) || (t = [t]);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}, _ = (
|
|
27
|
-
() => [V(
|
|
28
|
-
([
|
|
29
|
-
|
|
30
|
-
...e.flatMap((
|
|
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
31
|
);
|
|
32
32
|
},
|
|
33
33
|
{ immediate: !0, flush: "post" }
|
|
34
|
-
),
|
|
35
|
-
|
|
34
|
+
), b = () => {
|
|
35
|
+
h(), c();
|
|
36
36
|
};
|
|
37
|
-
return
|
|
37
|
+
return te(b), b;
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
function
|
|
41
|
-
const { window: t =
|
|
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
42
|
if (!t)
|
|
43
43
|
return;
|
|
44
|
-
|
|
44
|
+
ne && !T && (T = !0, Array.from(t.document.body.children).forEach((i) => i.addEventListener("click", B)), t.document.documentElement.addEventListener("click", B));
|
|
45
45
|
let _ = !0;
|
|
46
|
-
const
|
|
47
|
-
if (typeof
|
|
48
|
-
return Array.from(t.document.querySelectorAll(
|
|
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
49
|
{
|
|
50
|
-
const
|
|
51
|
-
return
|
|
50
|
+
const d = V(s);
|
|
51
|
+
return d && (i.target === d || i.composedPath().includes(d));
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
if (!(!
|
|
57
|
-
if (
|
|
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
58
|
_ = !0;
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
n(i);
|
|
62
62
|
}
|
|
63
|
-
}, { passive: !0, capture:
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
63
|
+
}, { passive: !0, capture: o }),
|
|
64
|
+
I(t, "pointerdown", (i) => {
|
|
65
|
+
const s = V(a);
|
|
66
|
+
s && (_ = !i.composedPath().includes(s) && !h(i));
|
|
67
67
|
}, { passive: !0 }),
|
|
68
|
-
|
|
68
|
+
c && I(t, "blur", (i) => {
|
|
69
69
|
setTimeout(() => {
|
|
70
|
-
var
|
|
71
|
-
const
|
|
72
|
-
((
|
|
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
73
|
}, 0);
|
|
74
74
|
})
|
|
75
75
|
].filter(Boolean);
|
|
76
|
-
return () =>
|
|
76
|
+
return () => l.forEach((i) => i());
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const oe = { class: "relative" }, re = ["aria-expanded"], le = /* @__PURE__ */ u("span", { class: "i-solar-alt-arrow-down-linear" }, null, -1), ue = {
|
|
79
79
|
class: "py-1",
|
|
80
80
|
role: "none"
|
|
81
|
-
},
|
|
81
|
+
}, ie = ["onClick"], ce = /* @__PURE__ */ E({
|
|
82
82
|
__name: "VueyeDropdown",
|
|
83
83
|
props: {
|
|
84
84
|
options: { default: () => [] },
|
|
@@ -87,83 +87,83 @@ const re = { class: "relative" }, le = ["aria-expanded"], ue = /* @__PURE__ */ i
|
|
|
87
87
|
defaultValue: {}
|
|
88
88
|
},
|
|
89
89
|
emits: ["update:modelValue"],
|
|
90
|
-
setup(
|
|
91
|
-
const e =
|
|
92
|
-
|
|
90
|
+
setup(a, { emit: n }) {
|
|
91
|
+
const e = a, t = O(null);
|
|
92
|
+
se(t, () => {
|
|
93
93
|
r.value = !1;
|
|
94
94
|
});
|
|
95
|
-
const r =
|
|
96
|
-
function
|
|
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
97
|
r.value = !r.value;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
|
|
99
|
+
function b(l) {
|
|
100
|
+
o.value = l, r.value = !1, n("update:modelValue", c.value.value);
|
|
101
101
|
}
|
|
102
|
-
return
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
}), (
|
|
106
|
-
|
|
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
107
|
type: "button",
|
|
108
|
-
class: "bg-slate-100 dark:bg-
|
|
109
|
-
onClick:
|
|
110
|
-
"aria-expanded":
|
|
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
111
|
"aria-haspopup": !0
|
|
112
112
|
}, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
], 8,
|
|
116
|
-
|
|
113
|
+
u("span", null, y(p(c).label), 1),
|
|
114
|
+
le
|
|
115
|
+
], 8, re),
|
|
116
|
+
p(r) ? (f(), g("div", {
|
|
117
117
|
key: 0,
|
|
118
|
-
class: "origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-slate-100 dark:bg-
|
|
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
119
|
role: "menu",
|
|
120
120
|
"aria-orientation": "vertical",
|
|
121
121
|
"aria-labelledby": _,
|
|
122
122
|
ref_key: "target",
|
|
123
123
|
ref: t
|
|
124
124
|
}, [
|
|
125
|
-
|
|
126
|
-
(
|
|
127
|
-
key:
|
|
128
|
-
class:
|
|
129
|
-
"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-
|
|
130
|
-
"text-slate-700 dark:text-slate-50 hover:bg-slate-50":
|
|
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-
|
|
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
132
|
role: "menuitem",
|
|
133
|
-
onClick: (
|
|
134
|
-
},
|
|
133
|
+
onClick: (d) => b(s)
|
|
134
|
+
}, y(i.label), 11, ie))), 128))
|
|
135
135
|
])
|
|
136
|
-
], 512)) :
|
|
136
|
+
], 512)) : U("", !0)
|
|
137
137
|
]));
|
|
138
138
|
}
|
|
139
|
-
}), v = (
|
|
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
140
|
"aria-hidden": "true",
|
|
141
|
-
class: "i-
|
|
141
|
+
class: "i-solar-alt-arrow-left-linear"
|
|
142
142
|
}, null, -1)), me = [
|
|
143
143
|
_e,
|
|
144
|
-
|
|
145
|
-
], ye = ["disabled"],
|
|
144
|
+
he
|
|
145
|
+
], ye = ["disabled"], be = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", { class: "sr-only" }, "Previous page", -1)), Pe = /* @__PURE__ */ v(() => /* @__PURE__ */ u("span", {
|
|
146
146
|
"aria-hidden": "true",
|
|
147
|
-
class: "i-
|
|
148
|
-
}, null, -1)),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
],
|
|
147
|
+
class: "i-solar-double-alt-arrow-left-linear"
|
|
148
|
+
}, null, -1)), ve = [
|
|
149
|
+
be,
|
|
150
|
+
Pe
|
|
151
|
+
], ke = ["onClick"], $e = {
|
|
152
152
|
key: 1,
|
|
153
|
-
class: "
|
|
154
|
-
},
|
|
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
155
|
"aria-hidden": "true",
|
|
156
|
-
class: "i-
|
|
156
|
+
class: "i-solar-alt-arrow-right-linear"
|
|
157
157
|
}, null, -1)), Se = [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
], Ee = ["disabled"], Oe = /* @__PURE__ */ v(() => /* @__PURE__ */
|
|
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
161
|
"aria-hidden": "true",
|
|
162
|
-
class: "i-
|
|
162
|
+
class: "i-solar-double-alt-arrow-right-linear"
|
|
163
163
|
}, null, -1)), Ie = [
|
|
164
164
|
Oe,
|
|
165
165
|
Ae
|
|
166
|
-
],
|
|
166
|
+
], Be = /* @__PURE__ */ E({
|
|
167
167
|
__name: "VueyePagination",
|
|
168
168
|
props: {
|
|
169
169
|
perPage: { default: 10 },
|
|
@@ -172,128 +172,135 @@ const re = { class: "relative" }, le = ["aria-expanded"], ue = /* @__PURE__ */ i
|
|
|
172
172
|
perPageOptions: { default: () => [10, 20, 30, 40, 50] }
|
|
173
173
|
},
|
|
174
174
|
emits: ["update:currentPage", "update:perPage"],
|
|
175
|
-
setup(
|
|
176
|
-
const e =
|
|
177
|
-
value:
|
|
178
|
-
label:
|
|
179
|
-
}))),
|
|
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
|
+
));
|
|
180
183
|
function _() {
|
|
181
|
-
e.currentPage < t.value &&
|
|
182
|
-
}
|
|
183
|
-
function m() {
|
|
184
|
-
e.currentPage > 1 && s("update:currentPage", e.currentPage - 1);
|
|
184
|
+
e.currentPage < t.value && n("update:currentPage", e.currentPage + 1);
|
|
185
185
|
}
|
|
186
186
|
function h() {
|
|
187
|
-
e.currentPage > 1 &&
|
|
187
|
+
e.currentPage > 1 && n("update:currentPage", e.currentPage - 1);
|
|
188
|
+
}
|
|
189
|
+
function b() {
|
|
190
|
+
e.currentPage > 1 && n("update:currentPage", 1);
|
|
188
191
|
}
|
|
189
|
-
function
|
|
190
|
-
e.currentPage < t.value &&
|
|
192
|
+
function l() {
|
|
193
|
+
e.currentPage < t.value && n("update:currentPage", e.total);
|
|
191
194
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
195
|
+
function m(s) {
|
|
196
|
+
s > 0 && s <= t.value && n("update:currentPage", s);
|
|
194
197
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
198
|
+
function i(s) {
|
|
199
|
+
n("update:perPage", Number(s));
|
|
197
200
|
}
|
|
198
|
-
return (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
options:
|
|
202
|
-
"default-value":
|
|
201
|
+
return (s, d) => (f(), g("div", de, [
|
|
202
|
+
u("div", null, [
|
|
203
|
+
A(ce, {
|
|
204
|
+
options: p(r),
|
|
205
|
+
"default-value": p(o),
|
|
203
206
|
label: "Per page",
|
|
204
|
-
"onUpdate:modelValue":
|
|
207
|
+
"onUpdate:modelValue": i
|
|
205
208
|
}, null, 8, ["options", "default-value"])
|
|
206
209
|
]),
|
|
207
|
-
|
|
208
|
-
|
|
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)
|
|
209
212
|
]),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
class: "
|
|
214
|
-
onClick:
|
|
215
|
-
disabled:
|
|
216
|
-
}, me, 8,
|
|
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)
|
|
217
220
|
]),
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
class: "
|
|
221
|
-
onClick:
|
|
222
|
-
disabled:
|
|
223
|
-
},
|
|
221
|
+
u("li", null, [
|
|
222
|
+
u("button", {
|
|
223
|
+
class: "pagination__btn",
|
|
224
|
+
onClick: h,
|
|
225
|
+
disabled: s.currentPage === 1
|
|
226
|
+
}, ve, 8, ye)
|
|
224
227
|
]),
|
|
225
|
-
(
|
|
226
|
-
typeof
|
|
228
|
+
(f(!0), g(w, null, $(p(c), (C) => (f(), g("li", { key: C }, [
|
|
229
|
+
typeof C == "number" ? (f(), g("button", {
|
|
227
230
|
key: 0,
|
|
228
|
-
class:
|
|
229
|
-
onClick: (
|
|
230
|
-
},
|
|
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, "..."))
|
|
231
234
|
]))), 128)),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
class: "
|
|
235
|
+
u("li", null, [
|
|
236
|
+
u("button", {
|
|
237
|
+
class: "pagination__btn",
|
|
235
238
|
onClick: _,
|
|
236
|
-
disabled:
|
|
237
|
-
}, Se, 8,
|
|
239
|
+
disabled: s.currentPage === p(t)
|
|
240
|
+
}, Se, 8, we)
|
|
238
241
|
]),
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
class: "
|
|
242
|
-
onClick:
|
|
243
|
-
disabled:
|
|
242
|
+
u("li", null, [
|
|
243
|
+
u("button", {
|
|
244
|
+
class: "pagination__btn",
|
|
245
|
+
onClick: l,
|
|
246
|
+
disabled: s.currentPage === p(t)
|
|
244
247
|
}, Ie, 8, Ee)
|
|
245
248
|
])
|
|
246
249
|
])
|
|
247
250
|
]));
|
|
248
251
|
}
|
|
249
252
|
});
|
|
250
|
-
const
|
|
251
|
-
const e =
|
|
252
|
-
for (const [t, r] of
|
|
253
|
+
const Re = (a, n) => {
|
|
254
|
+
const e = a.__vccOpts || a;
|
|
255
|
+
for (const [t, r] of n)
|
|
253
256
|
e[t] = r;
|
|
254
257
|
return e;
|
|
255
|
-
},
|
|
256
|
-
function
|
|
257
|
-
let
|
|
258
|
-
return
|
|
259
|
-
e.children && (
|
|
260
|
-
}),
|
|
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;
|
|
261
264
|
}
|
|
262
|
-
function
|
|
263
|
-
let
|
|
264
|
-
return
|
|
265
|
-
e.children ?
|
|
266
|
-
}),
|
|
265
|
+
function D(a) {
|
|
266
|
+
let n = 0;
|
|
267
|
+
return a.forEach((e) => {
|
|
268
|
+
e.children ? n += D(e.children) : n++;
|
|
269
|
+
}), n;
|
|
267
270
|
}
|
|
268
|
-
function
|
|
269
|
-
return
|
|
270
|
-
if (e[t] || (e[t] = []),
|
|
271
|
-
const { children:
|
|
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);
|
|
272
275
|
e[t].push({
|
|
273
276
|
..._,
|
|
274
|
-
colSpan:
|
|
277
|
+
colSpan: h,
|
|
275
278
|
scope: "colgroup"
|
|
276
|
-
}),
|
|
279
|
+
}), L(c, n, e, t + 1, r + 1);
|
|
277
280
|
} else {
|
|
278
|
-
const
|
|
281
|
+
const c = n - r;
|
|
279
282
|
e[t].push({
|
|
280
|
-
...
|
|
281
|
-
key:
|
|
282
|
-
label:
|
|
283
|
-
rowSpan:
|
|
283
|
+
...o,
|
|
284
|
+
key: o.key,
|
|
285
|
+
label: o.label,
|
|
286
|
+
rowSpan: c,
|
|
284
287
|
scope: "col"
|
|
285
288
|
});
|
|
286
289
|
}
|
|
287
290
|
}), e;
|
|
288
291
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
291
|
-
t.children ?
|
|
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}`);
|
|
292
295
|
}), e;
|
|
293
296
|
}
|
|
294
|
-
|
|
295
|
-
const
|
|
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;
|
|
297
304
|
for (let r = 0; r < e.length; r++)
|
|
298
305
|
if (t[e[r]])
|
|
299
306
|
t = t[e[r]];
|
|
@@ -301,91 +308,89 @@ const Le = (n, s) => {
|
|
|
301
308
|
return;
|
|
302
309
|
return t;
|
|
303
310
|
};
|
|
304
|
-
function
|
|
305
|
-
return
|
|
306
|
-
[
|
|
307
|
-
})).reduce((
|
|
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);
|
|
308
315
|
}
|
|
309
|
-
function He(
|
|
316
|
+
function He(a, n, e) {
|
|
310
317
|
return {
|
|
311
|
-
bodyRows:
|
|
312
|
-
const r = e.value.perPage * (e.value.currentPage - 1),
|
|
313
|
-
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);
|
|
314
321
|
})
|
|
315
322
|
};
|
|
316
323
|
}
|
|
317
|
-
function Me(
|
|
318
|
-
const
|
|
324
|
+
function Me(a) {
|
|
325
|
+
const n = p(a) ?? [];
|
|
319
326
|
return {
|
|
320
|
-
headers:
|
|
327
|
+
headers: P(() => L(n, R(n)))
|
|
321
328
|
};
|
|
322
329
|
}
|
|
323
|
-
const
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
], -1),
|
|
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 = [
|
|
326
333
|
Ke
|
|
327
|
-
],
|
|
334
|
+
], xe = ["id"], Fe = /* @__PURE__ */ E({
|
|
328
335
|
__name: "VueyeBody",
|
|
329
336
|
props: {
|
|
330
337
|
loading: { type: Boolean, default: !1 },
|
|
331
338
|
bodyRows: { default: () => [] },
|
|
332
339
|
itemValue: { default: "id" }
|
|
333
340
|
},
|
|
334
|
-
setup(
|
|
335
|
-
const
|
|
336
|
-
return (t, r) => (
|
|
337
|
-
t.loading ? (
|
|
338
|
-
|
|
339
|
-
])) : (
|
|
340
|
-
key:
|
|
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]
|
|
341
348
|
}, [
|
|
342
|
-
|
|
343
|
-
(
|
|
344
|
-
key: `${
|
|
345
|
-
id: `${
|
|
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}`
|
|
346
353
|
}, [
|
|
347
|
-
|
|
348
|
-
cell:
|
|
349
|
-
key: `${
|
|
354
|
+
k(t.$slots, "default", {
|
|
355
|
+
cell: o[c],
|
|
356
|
+
key: `${o[t.itemValue]}.${c}`
|
|
350
357
|
}, () => [
|
|
351
|
-
|
|
358
|
+
G(y(o[c]), 1)
|
|
352
359
|
])
|
|
353
|
-
], 8,
|
|
360
|
+
], 8, xe))), 128))
|
|
354
361
|
])
|
|
355
362
|
]))), 128))
|
|
356
363
|
]));
|
|
357
364
|
}
|
|
358
|
-
})
|
|
359
|
-
function D(n) {
|
|
360
|
-
return {
|
|
361
|
-
headerKeys: y(() => j(n.flat()))
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
const ze = ["colspan", "rowspan", "scope"], qe = /* @__PURE__ */ C({
|
|
365
|
+
}), Ue = ["colspan", "rowspan", "scope"], ze = /* @__PURE__ */ E({
|
|
365
366
|
__name: "VueyeHead",
|
|
366
367
|
props: {
|
|
367
368
|
columnHeaders: { default: () => [] }
|
|
368
369
|
},
|
|
369
|
-
setup(
|
|
370
|
-
return
|
|
371
|
-
(
|
|
372
|
-
(
|
|
373
|
-
key:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
|
|
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))
|
|
385
390
|
]))), 128))
|
|
386
391
|
]));
|
|
387
392
|
}
|
|
388
|
-
}), Ge = { class: "
|
|
393
|
+
}), qe = { class: "table__wrapper" }, Ge = { class: "table__caption" }, Je = { class: "table__summary" }, Qe = { class: "table__pagination-wrapper" }, et = /* @__PURE__ */ E({
|
|
389
394
|
inheritAttrs: !1,
|
|
390
395
|
__name: "VueyeTable",
|
|
391
396
|
props: {
|
|
@@ -396,57 +401,69 @@ const ze = ["colspan", "rowspan", "scope"], qe = /* @__PURE__ */ C({
|
|
|
396
401
|
currentPage: { default: 1 },
|
|
397
402
|
perPageOptions: { default: () => [5, 10, 20, 30] },
|
|
398
403
|
loading: { type: Boolean, default: !1 },
|
|
399
|
-
selectable: { type: Boolean, default: !1 }
|
|
404
|
+
selectable: { type: Boolean, default: !1 },
|
|
405
|
+
caption: { default: "" },
|
|
406
|
+
summary: { default: "" }
|
|
400
407
|
},
|
|
401
|
-
setup(
|
|
402
|
-
const
|
|
403
|
-
perPage:
|
|
404
|
-
currentPage:
|
|
405
|
-
}), { headers: r } = Me(e), { bodyRows:
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
function _(h) {
|
|
409
|
-
t.value.currentPage = h;
|
|
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;
|
|
410
415
|
}
|
|
411
|
-
function
|
|
412
|
-
t.value.perPage =
|
|
416
|
+
function b(l) {
|
|
417
|
+
t.value.perPage = l;
|
|
413
418
|
}
|
|
414
|
-
return (
|
|
415
|
-
|
|
416
|
-
class:
|
|
419
|
+
return (l, m) => (f(), g("div", qe, [
|
|
420
|
+
u("table", {
|
|
421
|
+
class: S(l.$attrs.class ?? "table")
|
|
417
422
|
}, [
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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)))
|
|
423
431
|
])
|
|
424
432
|
}))
|
|
425
433
|
]), 1032, ["columnHeaders"]),
|
|
426
|
-
|
|
427
|
-
bodyRows:
|
|
428
|
-
loading:
|
|
429
|
-
}, null, 8, ["bodyRows", "loading"])
|
|
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
|
+
])
|
|
430
441
|
], 2),
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
perPage:
|
|
434
|
-
currentPage:
|
|
435
|
-
perPageOptions:
|
|
436
|
-
total:
|
|
437
|
-
"onUpdate:currentPage":
|
|
438
|
-
"onUpdate:perPage":
|
|
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
|
|
439
450
|
}, null, 8, ["perPage", "currentPage", "perPageOptions", "total"])
|
|
440
451
|
])
|
|
441
452
|
]));
|
|
442
453
|
}
|
|
443
454
|
});
|
|
455
|
+
function tt(a) {
|
|
456
|
+
return {
|
|
457
|
+
headerKeys: P(() => N(a.flat()))
|
|
458
|
+
};
|
|
459
|
+
}
|
|
444
460
|
export {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
D as
|
|
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
|
|
452
469
|
};
|
package/dist/vueye-table.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g["vueye-table"]={},g.Vue))})(this,function(g,e){"use strict";function L(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function C(o){return typeof o=="function"?o():e.unref(o)}const S=typeof window<"u"&&typeof document<"u",P=()=>{},j=A();function A(){var o;return S&&((o=window==null?void 0:window.navigator)==null?void 0:o.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent)}function y(o){const r=C(o);return(r==null?void 0:r.$el)??r}const w=S?window:void 0;function E(...o){let r,t,n,l;if(typeof o[0]=="string"||Array.isArray(o[0])?([t,n,l]=o,r=w):[r,t,n,l]=o,!r)return P;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const s=[],c=()=>{s.forEach(p=>p()),s.length=0},f=(p,m,i,a)=>(p.addEventListener(m,i,a),()=>p.removeEventListener(m,i,a)),h=e.watch(()=>[y(r),C(l)],([p,m])=>{c(),p&&s.push(...t.flatMap(i=>n.map(a=>f(p,i,a,m))))},{immediate:!0,flush:"post"}),u=()=>{h(),c()};return L(u),u}let x=!1;function I(o,r,t={}){const{window:n=w,ignore:l=[],capture:s=!0,detectIframe:c=!1}=t;if(!n)return;j&&!x&&(x=!0,Array.from(n.document.body.children).forEach(i=>i.addEventListener("click",P)),n.document.documentElement.addEventListener("click",P));let f=!0;const h=i=>l.some(a=>{if(typeof a=="string")return Array.from(n.document.querySelectorAll(a)).some(d=>d===i.target||i.composedPath().includes(d));{const d=y(a);return d&&(i.target===d||i.composedPath().includes(d))}}),p=[E(n,"click",i=>{const a=y(o);if(!(!a||a===i.target||i.composedPath().includes(a))){if(i.detail===0&&(f=!h(i)),!f){f=!0;return}r(i)}},{passive:!0,capture:s}),E(n,"pointerdown",i=>{const a=y(o);a&&(f=!i.composedPath().includes(a)&&!h(i))},{passive:!0}),c&&E(n,"blur",i=>{setTimeout(()=>{var d;const a=y(o);((d=n.document.activeElement)==null?void 0:d.tagName)==="IFRAME"&&!(a!=null&&a.contains(n.document.activeElement))&&r(i)},0)})].filter(Boolean);return()=>p.forEach(i=>i())}const D={class:"relative"},R=["aria-expanded"],T=e.createElementVNode("span",{class:"i-tabler-chevron-down"},null,-1),H={class:"py-1",role:"none"},F=["onClick"],M=e.defineComponent({__name:"VueyeDropdown",props:{options:{default:()=>[]},modelValue:{default:""},label:{default:""},defaultValue:{}},emits:["update:modelValue"],setup(o,{emit:r}){const t=o,n=e.ref(null);I(n,()=>{l.value=!1});const l=e.ref(!1),s=e.ref(-1),c=e.computed(()=>t.options[s.value]??t.defaultValue),f=`dropdown-label-${Math.random().toString(36).substring(2,9)}`;function h(){l.value=!l.value}function u(p){s.value=p,l.value=!1,r("update:modelValue",c.value.value)}return e.watchEffect(()=>{const p=t.options.findIndex(m=>m.value===t.modelValue);p!==-1&&(s.value=p)}),(p,m)=>(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("button",{type:"button",class:"bg-slate-100 dark:bg-indigo-900 border flex items-center space-x-2 rtl:space-x-reverse border-indigo-300 dark:border-indigo-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:h,"aria-expanded":e.unref(l),"aria-haspopup":!0},[e.createElementVNode("span",null,e.toDisplayString(e.unref(c).label),1),T],8,R),e.unref(l)?(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-indigo-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",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.options,(i,a)=>(e.openBlock(),e.createElementBlock("button",{key:a,class:e.normalizeClass([{"text-slate-700 bg-slate-200 dark:text-slate-300 dark:bg-indigo-900 ":a===e.unref(s),"text-slate-700 dark:text-slate-50 hover:bg-slate-50":a!==e.unref(s)},"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-indigo-900"]),role:"menuitem",onClick:d=>u(a)},e.toDisplayString(i.label),11,F))),128))])],512)):e.createCommentVNode("",!0)]))}}),_=o=>(e.pushScopeId("data-v-5e0f7ce7"),o=o(),e.popScopeId(),o),z={class:"flex space-x-3 rtl:space-x-reverse items-center"},K={class:"text-sm text-gray-500 dark:text-gray-400"},U={class:"flex"},W=["disabled"],q=[_(()=>e.createElementVNode("span",{class:"sr-only"},"First page",-1)),_(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-tabler-chevrons-left"},null,-1))],G=["disabled"],J=[_(()=>e.createElementVNode("span",{class:"sr-only"},"Previous page",-1)),_(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-tabler-chevron-left"},null,-1))],Q=["onClick"],X={key:1,class:"w-8 h-8 font-bold flex items-center justify-center btn"},Y=["disabled"],Z=[_(()=>e.createElementVNode("span",{class:"sr-only"},"Next page",-1)),_(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-tabler-chevron-right"},null,-1))],v=["disabled"],ee=[_(()=>e.createElementVNode("span",{class:"sr-only"},"Last page",-1)),_(()=>e.createElementVNode("span",{"aria-hidden":"true",class:"i-tabler-chevrons-right"},null,-1))],te=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:r}){const t=o,n=e.computed(()=>Math.ceil(t.total/t.perPage)),l=e.computed(()=>t.perPageOptions.map(a=>({value:a,label:a.toString()}))),s=e.computed(()=>l.value.find(a=>a.value===t.perPage)),c=e.computed(()=>Array.from({length:n.value},(a,d)=>d+1).reduce((a,d)=>(d===1||d===t.total||d>=t.currentPage-2&&d<=t.currentPage+2?a.push(d):(d===t.currentPage-3||d===t.currentPage+3)&&a.push("..."),a),[]));function f(){t.currentPage<n.value&&r("update:currentPage",t.currentPage+1)}function h(){t.currentPage>1&&r("update:currentPage",t.currentPage-1)}function u(){t.currentPage>1&&r("update:currentPage",1)}function p(){t.currentPage<n.value&&r("update:currentPage",t.total)}function m(a){a>0&&a<=n.value&&r("update:currentPage",a)}function i(a){r("update:perPage",Number(a))}return(a,d)=>(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",null,[e.createVNode(M,{options:e.unref(l),"default-value":e.unref(s),label:"Per page","onUpdate:modelValue":i},null,8,["options","default-value"])]),e.createElementVNode("div",null,[e.createElementVNode("span",K,e.toDisplayString((a.currentPage-1)*a.perPage+1)+" - "+e.toDisplayString(a.currentPage*a.perPage)+" of "+e.toDisplayString(a.total),1)]),e.createElementVNode("ul",U,[e.createElementVNode("li",null,[e.createElementVNode("button",{class:"w-8 h-8 flex items-center justify-center btn",onClick:u,disabled:a.currentPage===1},q,8,W)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"w-8 h-8 flex items-center justify-center btn",onClick:h,disabled:a.currentPage===1},J,8,G)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),b=>(e.openBlock(),e.createElementBlock("li",{key:b},[typeof b=="number"?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["w-8 h-8 flex items-center justify-center btn",[b===a.currentPage?"bg-indigo-200 dark:bg-indigo-900 ":"bg-transparent"]]),onClick:Ce=>m(b)},e.toDisplayString(b),11,Q)):(e.openBlock(),e.createElementBlock("span",X,"..."))]))),128)),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"w-8 h-8 flex items-center justify-center btn",onClick:f,disabled:a.currentPage===e.unref(n)},Z,8,Y)]),e.createElementVNode("li",null,[e.createElementVNode("button",{class:"w-8 h-8 flex items-center justify-center btn",onClick:p,disabled:a.currentPage===e.unref(n)},ee,8,v)])])]))}}),Ve="",ne=((o,r)=>{const t=o.__vccOpts||o;for(const[n,l]of r)t[n]=l;return t})(te,[["__scopeId","data-v-5e0f7ce7"]]);function V(o){let r=1;return o.forEach(t=>{t.children&&(r=Math.max(r,V(t.children)+1))}),r}function B(o){let r=0;return o.forEach(t=>{t.children?r+=B(t.children):r++}),r}function N(o,r,t=[],n=0,l=0){return o.forEach(s=>{if(t[n]||(t[n]=[]),s.children){const{children:c,...f}=s,h=B(c);t[n].push({...f,colSpan:h,scope:"colgroup"}),N(c,r,t,n+1,l+1)}else{const c=r-l;t[n].push({...s,key:s.key,label:s.label,rowSpan:c,scope:"col"})}}),t}function k(o,r="",t=[]){return o.forEach(n=>{n.children?k(n.children,`${r}${n.key}.`,t):t.push(`${r}${n.key}`)}),t}const oe=(o,r)=>{const t=r.split(".");let n=o;for(let l=0;l<t.length;l++)if(n[t[l]])n=n[t[l]];else return;return n};function O(o,r,t=0,n=o.length){return o.map(l=>k(r).map(s=>({[s]:oe(l,s)})).reduce((s,c)=>({...s,...c}),{})).slice(t,n)}function re(o,r,t){return{bodyRows:e.computed(()=>{const l=t.value.perPage*(t.value.currentPage-1),s=t.value.perPage*t.value.currentPage;return O(o,e.unref(r),l,s)})}}function ae(o){const r=e.unref(o)??[];return{headers:e.computed(()=>N(r,V(r)))}}const se={key:0},le=["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-indigo-300 dark:border-t-indigo-800 dark:border-indigo-600 border-indigo-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(o){const r=o,t=e.computed(()=>Object.keys(r.bodyRows[0]).length);return(n,l)=>(e.openBlock(),e.createElementBlock("tbody",null,[n.loading?(e.openBlock(),e.createElementBlock("tr",se,[e.createElementVNode("td",{colspan:e.unref(t)},ce,8,le)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(n.bodyRows,s=>(e.openBlock(),e.createElementBlock("tr",{key:s[n.itemValue]},[e.renderSlot(n.$slots,"default",{row:s},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(s),c=>(e.openBlock(),e.createElementBlock("td",{key:`${s[n.itemValue]}.${c}`,id:`${s[n.itemValue]}.${c}`},[e.renderSlot(n.$slots,"default",{cell:s[c],key:`${s[n.itemValue]}.${c}`},()=>[e.createTextVNode(e.toDisplayString(s[c]),1)])],8,ie))),128))])]))),128))]))}});function $(o){return{headerKeys:e.computed(()=>k(o.flat()))}}const pe=["colspan","rowspan","scope"],ue=e.defineComponent({__name:"VueyeHead",props:{columnHeaders:{default:()=>[]}},setup(o){return $(o.columnHeaders),(t,n)=>(e.openBlock(),e.createElementBlock("thead",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnHeaders,(l,s)=>(e.openBlock(),e.createElementBlock("tr",{key:s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,c=>(e.openBlock(),e.createElementBlock("th",{key:c.key,colspan:c.colSpan,rowspan:c.rowSpan,scope:c.scope,class:e.normalizeClass([c.className,"th"])},[e.renderSlot(t.$slots,`headerCell.${c.key}`,{headerCell:c},()=>[e.createElementVNode("span",{class:e.normalizeClass(c.labelClassName)},e.toDisplayString(c.label),3)])],10,pe))),128))]))),128))]))}}),fe={class:"py-4 flex justify-end"},ge=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}},setup(o){const r=o,t=e.toRef(r,"columnHeaders"),n=e.ref({perPage:r.perPage||10,currentPage:r.currentPage||1}),{headers:l}=ae(t),{bodyRows:s}=re(r.data,t,n);$(l.value);const c=e.useSlots();function f(u){n.value.currentPage=u}function h(u){n.value.perPage=u}return(u,p)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("table",{class:e.normalizeClass(u.$attrs.class??"table")},[e.createVNode(e.unref(ue),{columnHeaders:e.unref(l)},e.createSlots({_:2},[e.renderList(Object.keys(e.unref(c)),m=>({name:m,fn:e.withCtx(i=>[e.renderSlot(u.$slots,m,e.normalizeProps(e.guardReactiveProps(i)))])}))]),1032,["columnHeaders"]),e.createVNode(e.unref(de),{bodyRows:e.unref(s),loading:u.loading},null,8,["bodyRows","loading"])],2),e.createElementVNode("div",fe,[e.createVNode(ne,{perPage:e.unref(n).perPage,currentPage:e.unref(n).currentPage,perPageOptions:u.perPageOptions,total:u.data.length,"onUpdate:currentPage":f,"onUpdate:perPage":h},null,8,["perPage","currentPage","perPageOptions","total"])])]))}}),$e="";g.VueyeTable=ge,g.depthCount=V,g.flatHeadersToRows=N,g.getBodyRows=O,g.getHeaderKeys=k,g.leafCount=B,g.useHeaderKeys=$,Object.defineProperty(g,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(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"})});
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueye-table",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vue data table",
|
|
6
6
|
"author": "Brahim Boussadjra",
|
|
7
|
+
"repository": "https://github.com/boussadjra/vueye-table",
|
|
7
8
|
"license": "MIT",
|
|
8
9
|
"files": [
|
|
9
10
|
"dist"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"dev": "vite",
|
|
30
|
-
"build": "
|
|
31
|
+
"build": " vite build",
|
|
31
32
|
"preview": "vite preview",
|
|
32
33
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
33
34
|
"format": "prettier . --write --ignore-path .gitignore",
|
|
@@ -40,20 +41,25 @@
|
|
|
40
41
|
"test": "vitest",
|
|
41
42
|
"coverage": "vitest run --coverage"
|
|
42
43
|
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
|
|
44
|
+
"dependencies": {},
|
|
45
|
+
"devDependencies": {
|
|
45
46
|
"@vueuse/core": "^10.4.0",
|
|
46
47
|
"@vueuse/head": "^1.3.1",
|
|
47
|
-
"vue": "^
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
"vue-router": "^4.2.4",
|
|
49
|
+
"@antfu/eslint-config": "^0.41.0",
|
|
50
|
+
"@commitlint/cli": "^17.7.1",
|
|
51
|
+
"@commitlint/config-conventional": "^17.7.0",
|
|
52
|
+
"@egoist/tailwindcss-icons": "^1.1.0",
|
|
51
53
|
"@histoire/plugin-vue": "^0.17.1",
|
|
54
|
+
"@iconify-json/solar": "^1.1.2",
|
|
52
55
|
"@iconify-json/tabler": "^1.1.89",
|
|
53
56
|
"@rushstack/eslint-patch": "^1.3.3",
|
|
57
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
54
58
|
"@testing-library/vue": "^7.0.0",
|
|
55
59
|
"@types/node": "^20.5.6",
|
|
60
|
+
"@unhead/vue": "^1.5.3",
|
|
56
61
|
"@unocss/preset-icons": "^0.55.3",
|
|
62
|
+
"@unocss/preset-uno": "^0.55.3",
|
|
57
63
|
"@vitejs/plugin-vue": "^4.3.3",
|
|
58
64
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
59
65
|
"@vue/eslint-config-typescript": "^11.0.3",
|
|
@@ -66,15 +72,22 @@
|
|
|
66
72
|
"histoire": "^0.17.0",
|
|
67
73
|
"husky": "^8.0.3",
|
|
68
74
|
"lint-staged": "^14.0.1",
|
|
75
|
+
"markdown-it-anchor": "^8.6.7",
|
|
76
|
+
"markdown-it-prism": "^2.3.0",
|
|
69
77
|
"npm-run-all": "^4.1.5",
|
|
70
78
|
"pathe": "^1.1.1",
|
|
79
|
+
"pnpm": "^8.7.0",
|
|
71
80
|
"postcss": "^8.4.28",
|
|
72
81
|
"prettier": "^3.0.2",
|
|
73
82
|
"semantic-release": "^21.1.1",
|
|
83
|
+
"simple-git-hooks": "^2.9.0",
|
|
74
84
|
"tailwindcss": "^3.3.3",
|
|
75
85
|
"typescript": "~5.2.2",
|
|
76
86
|
"unocss": "^0.55.3",
|
|
77
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",
|
|
78
91
|
"vite": "^4.4.9",
|
|
79
92
|
"vite-plugin-dts": "^3.5.2",
|
|
80
93
|
"vite-plugin-pages": "^0.31.0",
|
|
@@ -82,20 +95,11 @@
|
|
|
82
95
|
"vitest": "^0.34.3",
|
|
83
96
|
"vue-tsc": "^1.8.8"
|
|
84
97
|
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"vue": "^3.3.4"
|
|
100
|
+
},
|
|
85
101
|
"lint-staged": {
|
|
86
102
|
"*.{js,ts,vue}": "eslint --fix",
|
|
87
103
|
"*.{js,ts,vue,css,scss,json,md}": "prettier --write"
|
|
88
|
-
},
|
|
89
|
-
"config": {
|
|
90
|
-
"commitizen": {
|
|
91
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"repository": {
|
|
95
|
-
"type": "git",
|
|
96
|
-
"url": "https://github.com/boussadjra/vueye-table"
|
|
97
|
-
},
|
|
98
|
-
"bugs": {
|
|
99
|
-
"url": "https://github.com/boussadjra/vueye-table/issues"
|
|
100
104
|
}
|
|
101
|
-
}
|
|
105
|
+
}
|