@soft-stech/bootsman-ui-shadcn 1.3.4 → 1.3.6
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-D2QvMzcY.js → BuiDataTable.vue_vue_type_script_setup_true_lang-CUH3nl15.js} +65 -59
- package/dist/components/ui/table/BuiDataTable.js +1 -1
- package/dist/components/ui/table/BuiDataTable.vue.d.ts +3 -0
- package/dist/components/ui/table/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/stories/BuiDataTable.story.vue +1 -0
- package/src/components/ui/table/BuiDataTable.vue +8 -5
@@ -1,10 +1,10 @@
|
|
1
|
-
import { defineComponent as
|
1
|
+
import { defineComponent as L, mergeModels as U, useModel as b, computed as y, watchEffect as F, openBlock as n, createElementBlock as s, Fragment as d, renderSlot as w, unref as o, createCommentVNode as S, createVNode as g, withCtx as a, renderList as f, createBlock as m, createElementVNode as z, createTextVNode as v, toDisplayString as C } from "vue";
|
2
2
|
import { _ as O } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
|
3
3
|
import { _ as T } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-DJ8YMCCp.js";
|
4
|
-
import { _ as
|
5
|
-
import { _ as
|
6
|
-
import { v as
|
7
|
-
import { _ as
|
4
|
+
import { _ as j } 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 R } from "./utils-DPuEjrVV.js";
|
7
|
+
import { _ as N } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
|
8
8
|
import { useVueTable as H, getCoreRowModel as K, getPaginationRowModel as Y, getSortedRowModel as q, FlexRender as A } from "@tanstack/vue-table";
|
9
9
|
import { _ as J } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
|
10
10
|
import { _ as Q } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
|
@@ -17,9 +17,9 @@ import { _ as ee } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cf
|
|
17
17
|
const te = {
|
18
18
|
key: 0,
|
19
19
|
class: "w-full py-4"
|
20
|
-
}, oe = { class: "inline-block rounded-t bg-background px-4 py-3" },
|
20
|
+
}, oe = { class: "flex w-full items-center justify-between" }, ne = { class: "inline-block rounded-t bg-background px-4 py-3" }, E = "#UNDEFINED#", we = /* @__PURE__ */ L({
|
21
21
|
__name: "BuiDataTable",
|
22
|
-
props: /* @__PURE__ */
|
22
|
+
props: /* @__PURE__ */ U({
|
23
23
|
columns: {},
|
24
24
|
data: {},
|
25
25
|
pageSize: { default: 10 },
|
@@ -43,9 +43,9 @@ const te = {
|
|
43
43
|
}),
|
44
44
|
emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
|
45
45
|
setup(c) {
|
46
|
-
const t = c,
|
46
|
+
const t = c, $ = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), D = b(c, "columnVisibility"), I = y(
|
47
47
|
() => t.manualPagination ? t.totalItems : t.data.length
|
48
|
-
),
|
48
|
+
), u = H({
|
49
49
|
initialState: { pagination: { pageSize: t.pageSize } },
|
50
50
|
get data() {
|
51
51
|
return t.data;
|
@@ -57,13 +57,13 @@ const te = {
|
|
57
57
|
getPaginationRowModel: Y(),
|
58
58
|
getSortedRowModel: q(),
|
59
59
|
onSortingChange: (e) => {
|
60
|
-
|
60
|
+
R(e, $);
|
61
61
|
},
|
62
62
|
onPaginationChange: (e) => {
|
63
|
-
|
63
|
+
R(e, p);
|
64
64
|
},
|
65
65
|
onRowSelectionChange: (e) => {
|
66
|
-
|
66
|
+
R(e, k);
|
67
67
|
},
|
68
68
|
autoResetPageIndex: !1,
|
69
69
|
manualPagination: t.manualPagination,
|
@@ -71,7 +71,7 @@ const te = {
|
|
71
71
|
manualSorting: t.manualSorting,
|
72
72
|
state: {
|
73
73
|
get sorting() {
|
74
|
-
return
|
74
|
+
return $.value;
|
75
75
|
},
|
76
76
|
get pagination() {
|
77
77
|
return p.value;
|
@@ -80,56 +80,56 @@ const te = {
|
|
80
80
|
return k.value;
|
81
81
|
},
|
82
82
|
get columnVisibility() {
|
83
|
-
return
|
83
|
+
return D.value;
|
84
84
|
}
|
85
85
|
},
|
86
86
|
getRowId: t.getRowId
|
87
|
-
}),
|
87
|
+
}), B = y({
|
88
88
|
get() {
|
89
|
-
return
|
89
|
+
return u.getState().pagination.pageSize;
|
90
90
|
},
|
91
91
|
set(e) {
|
92
|
-
p.value && (p.value.pageSize = e,
|
92
|
+
p.value && (p.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
|
93
93
|
}
|
94
|
-
}), _ =
|
94
|
+
}), _ = y({
|
95
95
|
get() {
|
96
|
-
return
|
96
|
+
return u.getState().pagination.pageIndex + 1;
|
97
97
|
},
|
98
98
|
set(e) {
|
99
|
-
p.value && (p.value.pageIndex = e - 1,
|
99
|
+
p.value && (p.value.pageIndex = e - 1, u.setPageIndex(e - 1));
|
100
100
|
}
|
101
101
|
});
|
102
|
-
|
103
|
-
const e =
|
102
|
+
F(() => {
|
103
|
+
const e = u.getPageCount();
|
104
104
|
e && e < _.value && (_.value = e);
|
105
105
|
});
|
106
|
-
const M =
|
107
|
-
const
|
108
|
-
return e[
|
106
|
+
const M = y(() => t.groupBy ? u.getRowModel().rows.reduce((e, i) => {
|
107
|
+
const l = i.getValue(t.groupBy) ?? E;
|
108
|
+
return e[l] = e[l] || [], e[l].push(i), e;
|
109
109
|
}, /* @__PURE__ */ Object.create(null)) : null);
|
110
110
|
function h(e) {
|
111
111
|
return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
|
112
112
|
}
|
113
|
-
return (e,
|
113
|
+
return (e, i) => (n(), s(d, null, [
|
114
114
|
e.$slots.caption ? (n(), s("div", te, [
|
115
|
-
|
116
|
-
])) :
|
115
|
+
w(e.$slots, "caption", { table: o(u) })
|
116
|
+
])) : S("", !0),
|
117
117
|
g(o(J), null, {
|
118
118
|
default: a(() => [
|
119
119
|
g(o(X), null, {
|
120
120
|
default: a(() => [
|
121
|
-
(n(!0), s(d, null, f(o(
|
122
|
-
key:
|
121
|
+
(n(!0), s(d, null, f(o(u).getHeaderGroups(), (r) => (n(), m(o(P), {
|
122
|
+
key: r.id
|
123
123
|
}, {
|
124
124
|
default: a(() => [
|
125
|
-
(n(!0), s(d, null, f(
|
126
|
-
key:
|
125
|
+
(n(!0), s(d, null, f(r.headers, (l) => (n(), m(o(W), {
|
126
|
+
key: l.id
|
127
127
|
}, {
|
128
128
|
default: a(() => [
|
129
|
-
|
129
|
+
l.isPlaceholder ? S("", !0) : (n(), m(o(A), {
|
130
130
|
key: 0,
|
131
|
-
render:
|
132
|
-
props:
|
131
|
+
render: l.column.columnDef.header,
|
132
|
+
props: l.getContext()
|
133
133
|
}, null, 8, ["render", "props"]))
|
134
134
|
]),
|
135
135
|
_: 2
|
@@ -142,10 +142,10 @@ const te = {
|
|
142
142
|
}),
|
143
143
|
g(o(Q), null, {
|
144
144
|
default: a(() => [
|
145
|
-
o(
|
146
|
-
t.groupBy && M.value ? (n(!0), s(d, { key: 0 }, f(M.value, (
|
145
|
+
o(u).getRowModel().rows?.length ? (n(), s(d, { key: 0 }, [
|
146
|
+
t.groupBy && M.value ? (n(!0), s(d, { key: 0 }, f(M.value, (r, l) => (n(), m(o(O), {
|
147
147
|
asChild: "",
|
148
|
-
key:
|
148
|
+
key: l,
|
149
149
|
open: !0
|
150
150
|
}, {
|
151
151
|
default: a(() => [
|
@@ -158,12 +158,18 @@ const te = {
|
|
158
158
|
class: "!pb-0"
|
159
159
|
}, {
|
160
160
|
default: a(() => [
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
161
|
+
z("div", oe, [
|
162
|
+
z("div", ne, [
|
163
|
+
l === E ? (n(), s(d, { key: 0 }, [
|
164
|
+
v(C(h(1)), 1)
|
165
|
+
], 64)) : (n(), s(d, { key: 1 }, [
|
166
|
+
v(C(h(0)) + ": " + C(l), 1)
|
167
|
+
], 64))
|
168
|
+
]),
|
169
|
+
e.$slots.groupByRow ? w(e.$slots, "groupByRow", {
|
170
|
+
key: 0,
|
171
|
+
group: l
|
172
|
+
}) : S("", !0)
|
167
173
|
])
|
168
174
|
]),
|
169
175
|
_: 2
|
@@ -174,12 +180,12 @@ const te = {
|
|
174
180
|
]),
|
175
181
|
_: 2
|
176
182
|
}, 1024),
|
177
|
-
g(o(
|
183
|
+
g(o(j), { asChild: "" }, {
|
178
184
|
default: a(() => [
|
179
|
-
(n(!0), s(d, null, f(
|
180
|
-
key:
|
185
|
+
(n(!0), s(d, null, f(r, (V) => (n(), m(N, {
|
186
|
+
key: V.id,
|
181
187
|
columns: t.columns,
|
182
|
-
row:
|
188
|
+
row: V,
|
183
189
|
renderSubComponent: t.renderSubComponent
|
184
190
|
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
185
191
|
]),
|
@@ -187,10 +193,10 @@ const te = {
|
|
187
193
|
}, 1024)
|
188
194
|
]),
|
189
195
|
_: 2
|
190
|
-
}, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(
|
191
|
-
key:
|
196
|
+
}, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(u).getRowModel().rows, (r) => (n(), m(N, {
|
197
|
+
key: r.id,
|
192
198
|
columns: t.columns,
|
193
|
-
row:
|
199
|
+
row: r,
|
194
200
|
renderSubComponent: t.renderSubComponent
|
195
201
|
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
196
202
|
], 64)) : (n(), m(o(Z), {
|
@@ -198,8 +204,8 @@ const te = {
|
|
198
204
|
colspan: e.columns.length
|
199
205
|
}, {
|
200
206
|
default: a(() => [
|
201
|
-
|
202
|
-
|
207
|
+
w(e.$slots, "nodata", {}, () => [
|
208
|
+
i[2] || (i[2] = v("No data"))
|
203
209
|
])
|
204
210
|
]),
|
205
211
|
_: 3
|
@@ -215,13 +221,13 @@ const te = {
|
|
215
221
|
colspan: e.columns.length
|
216
222
|
}, {
|
217
223
|
default: a(() => [
|
218
|
-
g(o(
|
224
|
+
g(o(G), {
|
219
225
|
class: "float-right",
|
220
226
|
total: I.value,
|
221
227
|
pageIndex: _.value,
|
222
|
-
"onUpdate:pageIndex":
|
223
|
-
pageSize:
|
224
|
-
"onUpdate:pageSize":
|
228
|
+
"onUpdate:pageIndex": i[0] || (i[0] = (r) => _.value = r),
|
229
|
+
pageSize: B.value,
|
230
|
+
"onUpdate:pageSize": i[1] || (i[1] = (r) => B.value = r)
|
225
231
|
}, null, 8, ["total", "pageIndex", "pageSize"])
|
226
232
|
]),
|
227
233
|
_: 1
|
@@ -231,7 +237,7 @@ const te = {
|
|
231
237
|
})
|
232
238
|
]),
|
233
239
|
_: 1
|
234
|
-
})) :
|
240
|
+
})) : S("", !0)
|
235
241
|
]),
|
236
242
|
_: 3
|
237
243
|
})
|
@@ -239,5 +245,5 @@ const te = {
|
|
239
245
|
}
|
240
246
|
});
|
241
247
|
export {
|
242
|
-
|
248
|
+
we as _
|
243
249
|
};
|
@@ -34,6 +34,9 @@ declare const _default: <TData, TValue>(__VLS_props: NonNullable<Awaited<typeof
|
|
34
34
|
caption?(_: {
|
35
35
|
table: import('@tanstack/vue-table').Table<TData>;
|
36
36
|
}): any;
|
37
|
+
groupByRow?(_: {
|
38
|
+
group: string | number;
|
39
|
+
}): any;
|
37
40
|
nodata?(_: {}): any;
|
38
41
|
};
|
39
42
|
emit: {
|
@@ -8,7 +8,7 @@ import { _ as x } from "../../../BuiTableRowSubrow.vue_vue_type_script_setup_tru
|
|
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-CUH3nl15.js";
|
12
12
|
export {
|
13
13
|
R as BuiDataTable,
|
14
14
|
e as BuiTable,
|
package/dist/index.js
CHANGED
@@ -116,7 +116,7 @@ import { _ as jt } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang
|
|
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-CUH3nl15.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
@@ -170,11 +170,14 @@ function getGroupLabel(index: number) {
|
|
170
170
|
<BuiCollapsibleTrigger asChild>
|
171
171
|
<BuiTableRow class="bg-foreground/[0.04]">
|
172
172
|
<BuiTableCell :colspan="columns.length" class="!pb-0">
|
173
|
-
<div class="
|
174
|
-
<
|
175
|
-
|
176
|
-
|
177
|
-
|
173
|
+
<div class="flex w-full items-center justify-between">
|
174
|
+
<div class="inline-block rounded-t bg-background px-4 py-3">
|
175
|
+
<template v-if="key === NO_GROUP_KEY">
|
176
|
+
{{ getGroupLabel(1) }}
|
177
|
+
</template>
|
178
|
+
<template v-else> {{ getGroupLabel(0) }}: {{ key }} </template>
|
179
|
+
</div>
|
180
|
+
<slot v-if="$slots.groupByRow" name="groupByRow" :group="key" />
|
178
181
|
</div>
|
179
182
|
</BuiTableCell>
|
180
183
|
</BuiTableRow>
|