@soft-stech/bootsman-ui-shadcn 1.3.4 → 1.3.5
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-B38w7sKR.js} +63 -55
- 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 +10 -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 u, 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,12 @@ 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" }, ae = {
|
21
|
+
key: 0,
|
22
|
+
class: ""
|
23
|
+
}, E = "#UNDEFINED#", ve = /* @__PURE__ */ L({
|
21
24
|
__name: "BuiDataTable",
|
22
|
-
props: /* @__PURE__ */
|
25
|
+
props: /* @__PURE__ */ U({
|
23
26
|
columns: {},
|
24
27
|
data: {},
|
25
28
|
pageSize: { default: 10 },
|
@@ -43,7 +46,7 @@ const te = {
|
|
43
46
|
}),
|
44
47
|
emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
|
45
48
|
setup(c) {
|
46
|
-
const t = c,
|
49
|
+
const t = c, $ = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), D = b(c, "columnVisibility"), I = y(
|
47
50
|
() => t.manualPagination ? t.totalItems : t.data.length
|
48
51
|
), i = H({
|
49
52
|
initialState: { pagination: { pageSize: t.pageSize } },
|
@@ -57,13 +60,13 @@ const te = {
|
|
57
60
|
getPaginationRowModel: Y(),
|
58
61
|
getSortedRowModel: q(),
|
59
62
|
onSortingChange: (e) => {
|
60
|
-
|
63
|
+
R(e, $);
|
61
64
|
},
|
62
65
|
onPaginationChange: (e) => {
|
63
|
-
|
66
|
+
R(e, p);
|
64
67
|
},
|
65
68
|
onRowSelectionChange: (e) => {
|
66
|
-
|
69
|
+
R(e, k);
|
67
70
|
},
|
68
71
|
autoResetPageIndex: !1,
|
69
72
|
manualPagination: t.manualPagination,
|
@@ -71,7 +74,7 @@ const te = {
|
|
71
74
|
manualSorting: t.manualSorting,
|
72
75
|
state: {
|
73
76
|
get sorting() {
|
74
|
-
return
|
77
|
+
return $.value;
|
75
78
|
},
|
76
79
|
get pagination() {
|
77
80
|
return p.value;
|
@@ -80,18 +83,18 @@ const te = {
|
|
80
83
|
return k.value;
|
81
84
|
},
|
82
85
|
get columnVisibility() {
|
83
|
-
return
|
86
|
+
return D.value;
|
84
87
|
}
|
85
88
|
},
|
86
89
|
getRowId: t.getRowId
|
87
|
-
}),
|
90
|
+
}), h = y({
|
88
91
|
get() {
|
89
92
|
return i.getState().pagination.pageSize;
|
90
93
|
},
|
91
94
|
set(e) {
|
92
95
|
p.value && (p.value.pageSize = e, i.setPageSize(e), i.setPageIndex(0));
|
93
96
|
}
|
94
|
-
}), _ =
|
97
|
+
}), _ = y({
|
95
98
|
get() {
|
96
99
|
return i.getState().pagination.pageIndex + 1;
|
97
100
|
},
|
@@ -99,37 +102,37 @@ const te = {
|
|
99
102
|
p.value && (p.value.pageIndex = e - 1, i.setPageIndex(e - 1));
|
100
103
|
}
|
101
104
|
});
|
102
|
-
|
105
|
+
F(() => {
|
103
106
|
const e = i.getPageCount();
|
104
107
|
e && e < _.value && (_.value = e);
|
105
108
|
});
|
106
|
-
const
|
107
|
-
const
|
108
|
-
return e[
|
109
|
+
const B = y(() => t.groupBy ? i.getRowModel().rows.reduce((e, s) => {
|
110
|
+
const l = s.getValue(t.groupBy) ?? E;
|
111
|
+
return e[l] = e[l] || [], e[l].push(s), e;
|
109
112
|
}, /* @__PURE__ */ Object.create(null)) : null);
|
110
|
-
function
|
113
|
+
function M(e) {
|
111
114
|
return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
|
112
115
|
}
|
113
|
-
return (e,
|
114
|
-
e.$slots.caption ? (n(),
|
115
|
-
|
116
|
-
])) :
|
116
|
+
return (e, s) => (n(), u(d, null, [
|
117
|
+
e.$slots.caption ? (n(), u("div", te, [
|
118
|
+
w(e.$slots, "caption", { table: o(i) })
|
119
|
+
])) : S("", !0),
|
117
120
|
g(o(J), null, {
|
118
121
|
default: a(() => [
|
119
122
|
g(o(X), null, {
|
120
123
|
default: a(() => [
|
121
|
-
(n(!0),
|
122
|
-
key:
|
124
|
+
(n(!0), u(d, null, f(o(i).getHeaderGroups(), (r) => (n(), m(o(P), {
|
125
|
+
key: r.id
|
123
126
|
}, {
|
124
127
|
default: a(() => [
|
125
|
-
(n(!0),
|
126
|
-
key:
|
128
|
+
(n(!0), u(d, null, f(r.headers, (l) => (n(), m(o(W), {
|
129
|
+
key: l.id
|
127
130
|
}, {
|
128
131
|
default: a(() => [
|
129
|
-
|
132
|
+
l.isPlaceholder ? S("", !0) : (n(), m(o(A), {
|
130
133
|
key: 0,
|
131
|
-
render:
|
132
|
-
props:
|
134
|
+
render: l.column.columnDef.header,
|
135
|
+
props: l.getContext()
|
133
136
|
}, null, 8, ["render", "props"]))
|
134
137
|
]),
|
135
138
|
_: 2
|
@@ -142,10 +145,10 @@ const te = {
|
|
142
145
|
}),
|
143
146
|
g(o(Q), null, {
|
144
147
|
default: a(() => [
|
145
|
-
o(i).getRowModel().rows?.length ? (n(),
|
146
|
-
t.groupBy &&
|
148
|
+
o(i).getRowModel().rows?.length ? (n(), u(d, { key: 0 }, [
|
149
|
+
t.groupBy && B.value ? (n(!0), u(d, { key: 0 }, f(B.value, (r, l) => (n(), m(o(O), {
|
147
150
|
asChild: "",
|
148
|
-
key:
|
151
|
+
key: l,
|
149
152
|
open: !0
|
150
153
|
}, {
|
151
154
|
default: a(() => [
|
@@ -158,12 +161,17 @@ const te = {
|
|
158
161
|
class: "!pb-0"
|
159
162
|
}, {
|
160
163
|
default: a(() => [
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
164
|
+
z("div", oe, [
|
165
|
+
z("div", ne, [
|
166
|
+
l === E ? (n(), u(d, { key: 0 }, [
|
167
|
+
v(C(M(1)), 1)
|
168
|
+
], 64)) : (n(), u(d, { key: 1 }, [
|
169
|
+
v(C(M(0)) + ": " + C(l), 1)
|
170
|
+
], 64))
|
171
|
+
]),
|
172
|
+
e.$slots.groupByRow ? (n(), u("div", ae, [
|
173
|
+
w(e.$slots, "groupByRow", { group: l })
|
174
|
+
])) : S("", !0)
|
167
175
|
])
|
168
176
|
]),
|
169
177
|
_: 2
|
@@ -174,12 +182,12 @@ const te = {
|
|
174
182
|
]),
|
175
183
|
_: 2
|
176
184
|
}, 1024),
|
177
|
-
g(o(
|
185
|
+
g(o(j), { asChild: "" }, {
|
178
186
|
default: a(() => [
|
179
|
-
(n(!0),
|
180
|
-
key:
|
187
|
+
(n(!0), u(d, null, f(r, (V) => (n(), m(N, {
|
188
|
+
key: V.id,
|
181
189
|
columns: t.columns,
|
182
|
-
row:
|
190
|
+
row: V,
|
183
191
|
renderSubComponent: t.renderSubComponent
|
184
192
|
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
185
193
|
]),
|
@@ -187,10 +195,10 @@ const te = {
|
|
187
195
|
}, 1024)
|
188
196
|
]),
|
189
197
|
_: 2
|
190
|
-
}, 1024))), 128)) : (n(!0),
|
191
|
-
key:
|
198
|
+
}, 1024))), 128)) : (n(!0), u(d, { key: 1 }, f(o(i).getRowModel().rows, (r) => (n(), m(N, {
|
199
|
+
key: r.id,
|
192
200
|
columns: t.columns,
|
193
|
-
row:
|
201
|
+
row: r,
|
194
202
|
renderSubComponent: t.renderSubComponent
|
195
203
|
}, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
|
196
204
|
], 64)) : (n(), m(o(Z), {
|
@@ -198,8 +206,8 @@ const te = {
|
|
198
206
|
colspan: e.columns.length
|
199
207
|
}, {
|
200
208
|
default: a(() => [
|
201
|
-
|
202
|
-
|
209
|
+
w(e.$slots, "nodata", {}, () => [
|
210
|
+
s[2] || (s[2] = v("No data"))
|
203
211
|
])
|
204
212
|
]),
|
205
213
|
_: 3
|
@@ -215,13 +223,13 @@ const te = {
|
|
215
223
|
colspan: e.columns.length
|
216
224
|
}, {
|
217
225
|
default: a(() => [
|
218
|
-
g(o(
|
226
|
+
g(o(G), {
|
219
227
|
class: "float-right",
|
220
228
|
total: I.value,
|
221
229
|
pageIndex: _.value,
|
222
|
-
"onUpdate:pageIndex":
|
223
|
-
pageSize:
|
224
|
-
"onUpdate:pageSize":
|
230
|
+
"onUpdate:pageIndex": s[0] || (s[0] = (r) => _.value = r),
|
231
|
+
pageSize: h.value,
|
232
|
+
"onUpdate:pageSize": s[1] || (s[1] = (r) => h.value = r)
|
225
233
|
}, null, 8, ["total", "pageIndex", "pageSize"])
|
226
234
|
]),
|
227
235
|
_: 1
|
@@ -231,7 +239,7 @@ const te = {
|
|
231
239
|
})
|
232
240
|
]),
|
233
241
|
_: 1
|
234
|
-
})) :
|
242
|
+
})) : S("", !0)
|
235
243
|
]),
|
236
244
|
_: 3
|
237
245
|
})
|
@@ -239,5 +247,5 @@ const te = {
|
|
239
247
|
}
|
240
248
|
});
|
241
249
|
export {
|
242
|
-
|
250
|
+
ve as _
|
243
251
|
};
|
@@ -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-B38w7sKR.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-B38w7sKR.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,16 @@ 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
|
+
<div v-if="$slots.groupByRow" class="">
|
181
|
+
<slot name="groupByRow" :group="key" />
|
182
|
+
</div>
|
178
183
|
</div>
|
179
184
|
</BuiTableCell>
|
180
185
|
</BuiTableRow>
|