@soft-stech/bootsman-ui-shadcn 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/BuiDataTable.vue_vue_type_script_setup_true_lang-CLpLGgTZ.js +238 -0
- package/dist/{BuiTableHead.vue_vue_type_script_setup_true_lang-bRr43VQ9.js → BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js} +8 -8
- package/dist/components/ui/table/BuiDataTable.js +1 -1
- package/dist/components/ui/table/BuiTableHead.js +1 -1
- package/dist/components/ui/table/index.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/components/ui/table/BuiDataTable.vue +3 -2
- package/src/components/ui/table/BuiTableHead.vue +1 -1
- package/dist/BuiDataTable.vue_vue_type_script_setup_true_lang-BBdRXWLA.js +0 -237
@@ -0,0 +1,238 @@
|
|
1
|
+
import { defineComponent as V, mergeModels as D, useModel as b, computed as S, watchEffect as L, openBlock as n, createElementBlock as i, Fragment as d, renderSlot as z, unref as o, createCommentVNode as v, createVNode as g, withCtx as a, renderList as f, createBlock as p, createElementVNode as U, createTextVNode as w, toDisplayString as y } from "vue";
|
2
|
+
import { _ as F } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
|
3
|
+
import { _ as O } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-DJ8YMCCp.js";
|
4
|
+
import { _ as T } from "./BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-eieHE5yV.js";
|
5
|
+
import { _ as G } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
|
6
|
+
import { v as C } from "./utils-DPuEjrVV.js";
|
7
|
+
import { _ as x } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
|
8
|
+
import { useVueTable as j, getCoreRowModel as H, getPaginationRowModel as K, getSortedRowModel as Y, FlexRender as q } from "@tanstack/vue-table";
|
9
|
+
import { _ as A } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
|
10
|
+
import { _ as J } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
|
11
|
+
import { _ as N } from "./BuiTableCell.vue_vue_type_script_setup_true_lang-BrTQJCiZ.js";
|
12
|
+
import { _ as Q } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js";
|
13
|
+
import { _ as W } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
|
14
|
+
import { _ as P } from "./BuiTableRow.vue_vue_type_script_setup_true_lang-CpEilJsW.js";
|
15
|
+
import { _ as X } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
|
16
|
+
import { _ as Z } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
|
17
|
+
const ee = {
|
18
|
+
key: 0,
|
19
|
+
class: "w-full py-4"
|
20
|
+
}, te = { class: "inline-block rounded-t bg-background px-4 py-3" }, E = "#UNDEFINED#", be = /* @__PURE__ */ V({
|
21
|
+
__name: "BuiDataTable",
|
22
|
+
props: /* @__PURE__ */ D({
|
23
|
+
columns: {},
|
24
|
+
data: {},
|
25
|
+
pageSize: { default: 10 },
|
26
|
+
showPagination: { type: Boolean, default: !0 },
|
27
|
+
totalItems: { default: 0 },
|
28
|
+
manualPagination: { type: Boolean, default: !0 },
|
29
|
+
manualSorting: { type: Boolean, default: !0 },
|
30
|
+
groupBy: {},
|
31
|
+
groupLabels: {},
|
32
|
+
getRowId: {},
|
33
|
+
renderSubComponent: {}
|
34
|
+
}, {
|
35
|
+
sorting: {},
|
36
|
+
sortingModifiers: {},
|
37
|
+
pagination: {},
|
38
|
+
paginationModifiers: {},
|
39
|
+
selection: {},
|
40
|
+
selectionModifiers: {}
|
41
|
+
}),
|
42
|
+
emits: ["update:sorting", "update:pagination", "update:selection"],
|
43
|
+
setup(c) {
|
44
|
+
const t = c, R = b(c, "sorting"), m = b(c, "pagination"), k = b(c, "selection"), I = S(
|
45
|
+
() => t.manualPagination ? t.totalItems : t.data.length
|
46
|
+
), u = j({
|
47
|
+
initialState: { pagination: { pageSize: t.pageSize } },
|
48
|
+
get data() {
|
49
|
+
return t.data;
|
50
|
+
},
|
51
|
+
get columns() {
|
52
|
+
return t.columns;
|
53
|
+
},
|
54
|
+
getCoreRowModel: H(),
|
55
|
+
getPaginationRowModel: K(),
|
56
|
+
getSortedRowModel: Y(),
|
57
|
+
onSortingChange: (e) => {
|
58
|
+
C(e, R);
|
59
|
+
},
|
60
|
+
onPaginationChange: (e) => {
|
61
|
+
C(e, m);
|
62
|
+
},
|
63
|
+
onRowSelectionChange: (e) => {
|
64
|
+
C(e, k);
|
65
|
+
},
|
66
|
+
autoResetPageIndex: !1,
|
67
|
+
manualPagination: t.manualPagination,
|
68
|
+
// set to false to enable client-side pagination
|
69
|
+
manualSorting: t.manualSorting,
|
70
|
+
state: {
|
71
|
+
get sorting() {
|
72
|
+
return R.value;
|
73
|
+
},
|
74
|
+
get pagination() {
|
75
|
+
return m.value;
|
76
|
+
},
|
77
|
+
get rowSelection() {
|
78
|
+
return k.value;
|
79
|
+
}
|
80
|
+
},
|
81
|
+
getRowId: t.getRowId
|
82
|
+
}), $ = S({
|
83
|
+
get() {
|
84
|
+
return u.getState().pagination.pageSize;
|
85
|
+
},
|
86
|
+
set(e) {
|
87
|
+
m.value && (m.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
|
88
|
+
}
|
89
|
+
}), _ = S({
|
90
|
+
get() {
|
91
|
+
return u.getState().pagination.pageIndex + 1;
|
92
|
+
},
|
93
|
+
set(e) {
|
94
|
+
m.value && (m.value.pageIndex = e - 1, u.setPageIndex(e - 1));
|
95
|
+
}
|
96
|
+
});
|
97
|
+
L(() => {
|
98
|
+
const e = u.getPageCount();
|
99
|
+
e && e < _.value && (_.value = e);
|
100
|
+
});
|
101
|
+
const M = S(() => t.groupBy ? u.getRowModel().rows.reduce((e, s) => {
|
102
|
+
const r = s.getValue(t.groupBy) ?? E;
|
103
|
+
return e[r] = e[r] || [], e[r].push(s), e;
|
104
|
+
}, /* @__PURE__ */ Object.create(null)) : null);
|
105
|
+
function h(e) {
|
106
|
+
return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
|
107
|
+
}
|
108
|
+
return (e, s) => (n(), i(d, null, [
|
109
|
+
e.$slots.caption ? (n(), i("div", ee, [
|
110
|
+
z(e.$slots, "caption", { table: o(u) })
|
111
|
+
])) : v("", !0),
|
112
|
+
g(o(A), null, {
|
113
|
+
default: a(() => [
|
114
|
+
g(o(W), null, {
|
115
|
+
default: a(() => [
|
116
|
+
(n(!0), i(d, null, f(o(u).getHeaderGroups(), (l) => (n(), p(o(P), {
|
117
|
+
key: l.id
|
118
|
+
}, {
|
119
|
+
default: a(() => [
|
120
|
+
(n(!0), i(d, null, f(l.headers, (r) => (n(), p(o(Q), {
|
121
|
+
key: r.id
|
122
|
+
}, {
|
123
|
+
default: a(() => [
|
124
|
+
r.isPlaceholder ? v("", !0) : (n(), p(o(q), {
|
125
|
+
key: 0,
|
126
|
+
render: r.column.columnDef.header,
|
127
|
+
props: r.getContext()
|
128
|
+
}, null, 8, ["render", "props"]))
|
129
|
+
]),
|
130
|
+
_: 2
|
131
|
+
}, 1024))), 128))
|
132
|
+
]),
|
133
|
+
_: 2
|
134
|
+
}, 1024))), 128))
|
135
|
+
]),
|
136
|
+
_: 1
|
137
|
+
}),
|
138
|
+
g(o(J), null, {
|
139
|
+
default: a(() => [
|
140
|
+
o(u).getRowModel().rows?.length ? (n(), i(d, { key: 0 }, [
|
141
|
+
t.groupBy && M.value ? (n(!0), i(d, { key: 0 }, f(M.value, (l, r) => (n(), p(o(F), {
|
142
|
+
asChild: "",
|
143
|
+
key: r,
|
144
|
+
open: !0
|
145
|
+
}, {
|
146
|
+
default: a(() => [
|
147
|
+
g(o(O), { asChild: "" }, {
|
148
|
+
default: a(() => [
|
149
|
+
g(o(P), { class: "bg-foreground/[0.04]" }, {
|
150
|
+
default: a(() => [
|
151
|
+
g(o(N), {
|
152
|
+
colspan: e.columns.length,
|
153
|
+
class: "!pb-0"
|
154
|
+
}, {
|
155
|
+
default: a(() => [
|
156
|
+
U("div", te, [
|
157
|
+
r === E ? (n(), i(d, { key: 0 }, [
|
158
|
+
w(y(h(1)), 1)
|
159
|
+
], 64)) : (n(), i(d, { key: 1 }, [
|
160
|
+
w(y(h(0)) + ": " + y(r), 1)
|
161
|
+
], 64))
|
162
|
+
])
|
163
|
+
]),
|
164
|
+
_: 2
|
165
|
+
}, 1032, ["colspan"])
|
166
|
+
]),
|
167
|
+
_: 2
|
168
|
+
}, 1024)
|
169
|
+
]),
|
170
|
+
_: 2
|
171
|
+
}, 1024),
|
172
|
+
g(o(T), { asChild: "" }, {
|
173
|
+
default: a(() => [
|
174
|
+
(n(!0), i(d, null, f(l, (B) => (n(), p(x, {
|
175
|
+
key: B.id,
|
176
|
+
columns: t.columns,
|
177
|
+
row: B,
|
178
|
+
renderSubComponent: t.renderSubComponent
|
179
|
+
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
180
|
+
]),
|
181
|
+
_: 2
|
182
|
+
}, 1024)
|
183
|
+
]),
|
184
|
+
_: 2
|
185
|
+
}, 1024))), 128)) : (n(!0), i(d, { key: 1 }, f(o(u).getRowModel().rows, (l) => (n(), p(x, {
|
186
|
+
key: l.id,
|
187
|
+
columns: t.columns,
|
188
|
+
row: l,
|
189
|
+
renderSubComponent: t.renderSubComponent
|
190
|
+
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
191
|
+
], 64)) : (n(), p(o(X), {
|
192
|
+
key: 1,
|
193
|
+
colspan: e.columns.length
|
194
|
+
}, {
|
195
|
+
default: a(() => [
|
196
|
+
z(e.$slots, "nodata", {}, () => [
|
197
|
+
s[2] || (s[2] = w("No data"))
|
198
|
+
])
|
199
|
+
]),
|
200
|
+
_: 3
|
201
|
+
}, 8, ["colspan"]))
|
202
|
+
]),
|
203
|
+
_: 3
|
204
|
+
}),
|
205
|
+
e.showPagination && I.value > 0 ? (n(), p(o(Z), { key: 0 }, {
|
206
|
+
default: a(() => [
|
207
|
+
g(o(P), null, {
|
208
|
+
default: a(() => [
|
209
|
+
g(o(N), {
|
210
|
+
colspan: e.columns.length
|
211
|
+
}, {
|
212
|
+
default: a(() => [
|
213
|
+
g(o(G), {
|
214
|
+
class: "float-right",
|
215
|
+
total: I.value,
|
216
|
+
pageIndex: _.value,
|
217
|
+
"onUpdate:pageIndex": s[0] || (s[0] = (l) => _.value = l),
|
218
|
+
pageSize: $.value,
|
219
|
+
"onUpdate:pageSize": s[1] || (s[1] = (l) => $.value = l)
|
220
|
+
}, null, 8, ["total", "pageIndex", "pageSize"])
|
221
|
+
]),
|
222
|
+
_: 1
|
223
|
+
}, 8, ["colspan"])
|
224
|
+
]),
|
225
|
+
_: 1
|
226
|
+
})
|
227
|
+
]),
|
228
|
+
_: 1
|
229
|
+
})) : v("", !0)
|
230
|
+
]),
|
231
|
+
_: 3
|
232
|
+
})
|
233
|
+
], 64));
|
234
|
+
}
|
235
|
+
});
|
236
|
+
export {
|
237
|
+
be as _
|
238
|
+
};
|
@@ -1,26 +1,26 @@
|
|
1
|
-
import { defineComponent as t, openBlock as s, createElementBlock as n, normalizeClass as
|
2
|
-
import { c as
|
3
|
-
const i = { class: "flex h-10 items-center border-r border-border/[0.16] p-4" },
|
1
|
+
import { defineComponent as t, openBlock as s, createElementBlock as n, normalizeClass as a, unref as c, createElementVNode as l, renderSlot as d } from "vue";
|
2
|
+
import { c as p } from "./utils-DPuEjrVV.js";
|
3
|
+
const i = { class: "flex h-10 items-center whitespace-nowrap border-r border-border/[0.16] p-4" }, h = /* @__PURE__ */ t({
|
4
4
|
__name: "BuiTableHead",
|
5
5
|
props: {
|
6
6
|
class: {}
|
7
7
|
},
|
8
8
|
setup(e) {
|
9
9
|
const o = e;
|
10
|
-
return (r,
|
11
|
-
class:
|
12
|
-
|
10
|
+
return (r, m) => (s(), n("th", {
|
11
|
+
class: a(
|
12
|
+
c(p)(
|
13
13
|
"h-14 bg-foreground/[0.04] text-left align-middle text-base font-semibold text-foreground [&:has([role=checkbox])]:pr-0 ",
|
14
14
|
o.class
|
15
15
|
)
|
16
16
|
)
|
17
17
|
}, [
|
18
|
-
|
18
|
+
l("div", i, [
|
19
19
|
d(r.$slots, "default")
|
20
20
|
])
|
21
21
|
], 2));
|
22
22
|
}
|
23
23
|
});
|
24
24
|
export {
|
25
|
-
|
25
|
+
h as _
|
26
26
|
};
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { _ as e } from "../../../BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
|
2
2
|
import { _ as t } from "../../../BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
|
3
3
|
import { _ as p } from "../../../BuiTableCell.vue_vue_type_script_setup_true_lang-BrTQJCiZ.js";
|
4
|
-
import { _ as i } from "../../../BuiTableHead.vue_vue_type_script_setup_true_lang-
|
4
|
+
import { _ as i } from "../../../BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js";
|
5
5
|
import { _ as u } from "../../../BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
|
6
6
|
import { _ as f } from "../../../BuiTableRow.vue_vue_type_script_setup_true_lang-CpEilJsW.js";
|
7
7
|
import { _ as x } from "../../../BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
|
8
8
|
import { _ } from "../../../BuiTableCaption.vue_vue_type_script_setup_true_lang-053YvtXp.js";
|
9
9
|
import { _ as w } from "../../../BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
|
10
10
|
import { _ as C } from "../../../BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
|
11
|
-
import { _ as R } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-
|
11
|
+
import { _ as R } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-CLpLGgTZ.js";
|
12
12
|
export {
|
13
13
|
R as BuiDataTable,
|
14
14
|
e as BuiTable,
|
package/dist/index.js
CHANGED
@@ -109,14 +109,14 @@ import { _ as Mt } from "./BuiSwitch.vue_vue_type_script_setup_true_lang-VtywyEj
|
|
109
109
|
import { _ as It } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
|
110
110
|
import { _ as Vt } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
|
111
111
|
import { _ as ht } from "./BuiTableCell.vue_vue_type_script_setup_true_lang-BrTQJCiZ.js";
|
112
|
-
import { _ as yt } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-
|
112
|
+
import { _ as yt } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js";
|
113
113
|
import { _ as Ht } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
|
114
114
|
import { _ as kt } from "./BuiTableRow.vue_vue_type_script_setup_true_lang-CpEilJsW.js";
|
115
115
|
import { _ as jt } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
|
116
116
|
import { _ as Ot } from "./BuiTableCaption.vue_vue_type_script_setup_true_lang-053YvtXp.js";
|
117
117
|
import { _ as qt } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
|
118
118
|
import { _ as Jt } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
|
119
|
-
import { _ as Qt } from "./BuiDataTable.vue_vue_type_script_setup_true_lang-
|
119
|
+
import { _ as Qt } from "./BuiDataTable.vue_vue_type_script_setup_true_lang-CLpLGgTZ.js";
|
120
120
|
import { BuiTabsList as Xt, BuiTabsTrigger as Yt, tabsListVariants as Zt, tabsTriggerVariants as $t } from "./components/ui/tabs/index.js";
|
121
121
|
import { BuiTextarea as ra, textareaVariants as ea } from "./components/ui/textarea/index.js";
|
122
122
|
import { BuiToast as aa, BuiToaster as ia, toastVariants as ua } from "./components/ui/toast/index.js";
|
package/package.json
CHANGED
@@ -25,7 +25,6 @@ import { computed, watchEffect } from 'vue'
|
|
25
25
|
import {
|
26
26
|
BuiTable,
|
27
27
|
BuiTableBody,
|
28
|
-
BuiTableCaption,
|
29
28
|
BuiTableCell,
|
30
29
|
BuiTableEmpty,
|
31
30
|
BuiTableFooter,
|
@@ -144,8 +143,10 @@ function getGroupLabel(index: number) {
|
|
144
143
|
</script>
|
145
144
|
|
146
145
|
<template>
|
146
|
+
<div v-if="$slots.caption" class="w-full py-4">
|
147
|
+
<slot name="caption" :table="table" />
|
148
|
+
</div>
|
147
149
|
<BuiTable>
|
148
|
-
<BuiTableCaption v-if="$slots.caption"><slot name="caption" :table="table" /></BuiTableCaption>
|
149
150
|
<BuiTableHeader>
|
150
151
|
<BuiTableRow v-for="headerGroup in table.getHeaderGroups()" :key="headerGroup.id">
|
151
152
|
<BuiTableHead v-for="header in headerGroup.headers" :key="header.id">
|
@@ -1,237 +0,0 @@
|
|
1
|
-
import { defineComponent as V, mergeModels as D, useModel as b, computed as S, watchEffect as L, openBlock as n, createBlock as i, unref as t, withCtx as a, renderSlot as z, createCommentVNode as v, createVNode as g, createElementBlock as d, Fragment as m, renderList as f, createElementVNode as U, createTextVNode as w, toDisplayString as y } from "vue";
|
2
|
-
import { _ as F } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
|
3
|
-
import { _ as O } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-DJ8YMCCp.js";
|
4
|
-
import { _ as T } from "./BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-eieHE5yV.js";
|
5
|
-
import { _ as G } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
|
6
|
-
import { v as C } from "./utils-DPuEjrVV.js";
|
7
|
-
import { _ as x } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
|
8
|
-
import { useVueTable as j, getCoreRowModel as H, getPaginationRowModel as K, getSortedRowModel as Y, FlexRender as q } from "@tanstack/vue-table";
|
9
|
-
import { _ as A } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
|
10
|
-
import { _ as J } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
|
11
|
-
import { _ as N } from "./BuiTableCell.vue_vue_type_script_setup_true_lang-BrTQJCiZ.js";
|
12
|
-
import { _ as Q } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-bRr43VQ9.js";
|
13
|
-
import { _ as W } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
|
14
|
-
import { _ as P } from "./BuiTableRow.vue_vue_type_script_setup_true_lang-CpEilJsW.js";
|
15
|
-
import { _ as X } from "./BuiTableCaption.vue_vue_type_script_setup_true_lang-053YvtXp.js";
|
16
|
-
import { _ as Z } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
|
17
|
-
import { _ as ee } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
|
18
|
-
const te = { class: "inline-block rounded-t bg-background px-4 py-3" }, E = "#UNDEFINED#", ve = /* @__PURE__ */ V({
|
19
|
-
__name: "BuiDataTable",
|
20
|
-
props: /* @__PURE__ */ D({
|
21
|
-
columns: {},
|
22
|
-
data: {},
|
23
|
-
pageSize: { default: 10 },
|
24
|
-
showPagination: { type: Boolean, default: !0 },
|
25
|
-
totalItems: { default: 0 },
|
26
|
-
manualPagination: { type: Boolean, default: !0 },
|
27
|
-
manualSorting: { type: Boolean, default: !0 },
|
28
|
-
groupBy: {},
|
29
|
-
groupLabels: {},
|
30
|
-
getRowId: {},
|
31
|
-
renderSubComponent: {}
|
32
|
-
}, {
|
33
|
-
sorting: {},
|
34
|
-
sortingModifiers: {},
|
35
|
-
pagination: {},
|
36
|
-
paginationModifiers: {},
|
37
|
-
selection: {},
|
38
|
-
selectionModifiers: {}
|
39
|
-
}),
|
40
|
-
emits: ["update:sorting", "update:pagination", "update:selection"],
|
41
|
-
setup(c) {
|
42
|
-
const o = c, R = b(c, "sorting"), p = b(c, "pagination"), $ = b(c, "selection"), k = S(
|
43
|
-
() => o.manualPagination ? o.totalItems : o.data.length
|
44
|
-
), u = j({
|
45
|
-
initialState: { pagination: { pageSize: o.pageSize } },
|
46
|
-
get data() {
|
47
|
-
return o.data;
|
48
|
-
},
|
49
|
-
get columns() {
|
50
|
-
return o.columns;
|
51
|
-
},
|
52
|
-
getCoreRowModel: H(),
|
53
|
-
getPaginationRowModel: K(),
|
54
|
-
getSortedRowModel: Y(),
|
55
|
-
onSortingChange: (e) => {
|
56
|
-
C(e, R);
|
57
|
-
},
|
58
|
-
onPaginationChange: (e) => {
|
59
|
-
C(e, p);
|
60
|
-
},
|
61
|
-
onRowSelectionChange: (e) => {
|
62
|
-
C(e, $);
|
63
|
-
},
|
64
|
-
autoResetPageIndex: !1,
|
65
|
-
manualPagination: o.manualPagination,
|
66
|
-
// set to false to enable client-side pagination
|
67
|
-
manualSorting: o.manualSorting,
|
68
|
-
state: {
|
69
|
-
get sorting() {
|
70
|
-
return R.value;
|
71
|
-
},
|
72
|
-
get pagination() {
|
73
|
-
return p.value;
|
74
|
-
},
|
75
|
-
get rowSelection() {
|
76
|
-
return $.value;
|
77
|
-
}
|
78
|
-
},
|
79
|
-
getRowId: o.getRowId
|
80
|
-
}), I = S({
|
81
|
-
get() {
|
82
|
-
return u.getState().pagination.pageSize;
|
83
|
-
},
|
84
|
-
set(e) {
|
85
|
-
p.value && (p.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
|
86
|
-
}
|
87
|
-
}), _ = S({
|
88
|
-
get() {
|
89
|
-
return u.getState().pagination.pageIndex + 1;
|
90
|
-
},
|
91
|
-
set(e) {
|
92
|
-
p.value && (p.value.pageIndex = e - 1, u.setPageIndex(e - 1));
|
93
|
-
}
|
94
|
-
});
|
95
|
-
L(() => {
|
96
|
-
const e = u.getPageCount();
|
97
|
-
e && e < _.value && (_.value = e);
|
98
|
-
});
|
99
|
-
const M = S(() => o.groupBy ? u.getRowModel().rows.reduce((e, s) => {
|
100
|
-
const r = s.getValue(o.groupBy) ?? E;
|
101
|
-
return e[r] = e[r] || [], e[r].push(s), e;
|
102
|
-
}, /* @__PURE__ */ Object.create(null)) : null);
|
103
|
-
function B(e) {
|
104
|
-
return (o.groupBy && o.groupLabels ? o.groupLabels[o.groupBy] || [] : [])[e];
|
105
|
-
}
|
106
|
-
return (e, s) => (n(), i(t(A), null, {
|
107
|
-
default: a(() => [
|
108
|
-
e.$slots.caption ? (n(), i(t(X), { key: 0 }, {
|
109
|
-
default: a(() => [
|
110
|
-
z(e.$slots, "caption", { table: t(u) })
|
111
|
-
]),
|
112
|
-
_: 3
|
113
|
-
})) : v("", !0),
|
114
|
-
g(t(W), null, {
|
115
|
-
default: a(() => [
|
116
|
-
(n(!0), d(m, null, f(t(u).getHeaderGroups(), (l) => (n(), i(t(P), {
|
117
|
-
key: l.id
|
118
|
-
}, {
|
119
|
-
default: a(() => [
|
120
|
-
(n(!0), d(m, null, f(l.headers, (r) => (n(), i(t(Q), {
|
121
|
-
key: r.id
|
122
|
-
}, {
|
123
|
-
default: a(() => [
|
124
|
-
r.isPlaceholder ? v("", !0) : (n(), i(t(q), {
|
125
|
-
key: 0,
|
126
|
-
render: r.column.columnDef.header,
|
127
|
-
props: r.getContext()
|
128
|
-
}, null, 8, ["render", "props"]))
|
129
|
-
]),
|
130
|
-
_: 2
|
131
|
-
}, 1024))), 128))
|
132
|
-
]),
|
133
|
-
_: 2
|
134
|
-
}, 1024))), 128))
|
135
|
-
]),
|
136
|
-
_: 1
|
137
|
-
}),
|
138
|
-
g(t(J), null, {
|
139
|
-
default: a(() => [
|
140
|
-
t(u).getRowModel().rows?.length ? (n(), d(m, { key: 0 }, [
|
141
|
-
o.groupBy && M.value ? (n(!0), d(m, { key: 0 }, f(M.value, (l, r) => (n(), i(t(F), {
|
142
|
-
asChild: "",
|
143
|
-
key: r,
|
144
|
-
open: !0
|
145
|
-
}, {
|
146
|
-
default: a(() => [
|
147
|
-
g(t(O), { asChild: "" }, {
|
148
|
-
default: a(() => [
|
149
|
-
g(t(P), { class: "bg-foreground/[0.04]" }, {
|
150
|
-
default: a(() => [
|
151
|
-
g(t(N), {
|
152
|
-
colspan: e.columns.length,
|
153
|
-
class: "!pb-0"
|
154
|
-
}, {
|
155
|
-
default: a(() => [
|
156
|
-
U("div", te, [
|
157
|
-
r === E ? (n(), d(m, { key: 0 }, [
|
158
|
-
w(y(B(1)), 1)
|
159
|
-
], 64)) : (n(), d(m, { key: 1 }, [
|
160
|
-
w(y(B(0)) + ": " + y(r), 1)
|
161
|
-
], 64))
|
162
|
-
])
|
163
|
-
]),
|
164
|
-
_: 2
|
165
|
-
}, 1032, ["colspan"])
|
166
|
-
]),
|
167
|
-
_: 2
|
168
|
-
}, 1024)
|
169
|
-
]),
|
170
|
-
_: 2
|
171
|
-
}, 1024),
|
172
|
-
g(t(T), { asChild: "" }, {
|
173
|
-
default: a(() => [
|
174
|
-
(n(!0), d(m, null, f(l, (h) => (n(), i(x, {
|
175
|
-
key: h.id,
|
176
|
-
columns: o.columns,
|
177
|
-
row: h,
|
178
|
-
renderSubComponent: o.renderSubComponent
|
179
|
-
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
180
|
-
]),
|
181
|
-
_: 2
|
182
|
-
}, 1024)
|
183
|
-
]),
|
184
|
-
_: 2
|
185
|
-
}, 1024))), 128)) : (n(!0), d(m, { key: 1 }, f(t(u).getRowModel().rows, (l) => (n(), i(x, {
|
186
|
-
key: l.id,
|
187
|
-
columns: o.columns,
|
188
|
-
row: l,
|
189
|
-
renderSubComponent: o.renderSubComponent
|
190
|
-
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
191
|
-
], 64)) : (n(), i(t(Z), {
|
192
|
-
key: 1,
|
193
|
-
colspan: e.columns.length
|
194
|
-
}, {
|
195
|
-
default: a(() => [
|
196
|
-
z(e.$slots, "nodata", {}, () => [
|
197
|
-
s[2] || (s[2] = w("No data"))
|
198
|
-
])
|
199
|
-
]),
|
200
|
-
_: 3
|
201
|
-
}, 8, ["colspan"]))
|
202
|
-
]),
|
203
|
-
_: 3
|
204
|
-
}),
|
205
|
-
e.showPagination && k.value > 0 ? (n(), i(t(ee), { key: 1 }, {
|
206
|
-
default: a(() => [
|
207
|
-
g(t(P), null, {
|
208
|
-
default: a(() => [
|
209
|
-
g(t(N), {
|
210
|
-
colspan: e.columns.length
|
211
|
-
}, {
|
212
|
-
default: a(() => [
|
213
|
-
g(t(G), {
|
214
|
-
class: "float-right",
|
215
|
-
total: k.value,
|
216
|
-
pageIndex: _.value,
|
217
|
-
"onUpdate:pageIndex": s[0] || (s[0] = (l) => _.value = l),
|
218
|
-
pageSize: I.value,
|
219
|
-
"onUpdate:pageSize": s[1] || (s[1] = (l) => I.value = l)
|
220
|
-
}, null, 8, ["total", "pageIndex", "pageSize"])
|
221
|
-
]),
|
222
|
-
_: 1
|
223
|
-
}, 8, ["colspan"])
|
224
|
-
]),
|
225
|
-
_: 1
|
226
|
-
})
|
227
|
-
]),
|
228
|
-
_: 1
|
229
|
-
})) : v("", !0)
|
230
|
-
]),
|
231
|
-
_: 3
|
232
|
-
}));
|
233
|
-
}
|
234
|
-
});
|
235
|
-
export {
|
236
|
-
ve as _
|
237
|
-
};
|