@soft-stech/bootsman-ui-shadcn 1.4.14 → 1.4.15
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,10 @@
|
|
1
1
|
import { _ as j } from "../../../BuiTable.vue_vue_type_script_setup_true_lang-CKRiQHpD.js";
|
2
2
|
import { _ as A } from "../../../BuiTableBody.vue_vue_type_script_setup_true_lang-DblqmDim.js";
|
3
|
-
import { _ as
|
3
|
+
import { _ as T } from "../../../BuiTableCell.vue_vue_type_script_setup_true_lang-CYBx0oJL.js";
|
4
4
|
import { _ as H } from "../../../BuiTableHead.vue_vue_type_script_setup_true_lang-uE4Py8ky.js";
|
5
5
|
import { _ as O } from "../../../BuiTableHeader.vue_vue_type_script_setup_true_lang-BcnB4-3x.js";
|
6
|
-
import { _ as
|
7
|
-
import { defineComponent as
|
6
|
+
import { _ as $ } from "../../../BuiTableRow.vue_vue_type_script_setup_true_lang-Bl4nF6yV.js";
|
7
|
+
import { defineComponent as x, computed as S, openBlock as o, createElementBlock as u, Fragment as d, createBlock as m, unref as a, normalizeClass as G, withCtx as l, renderSlot as c, renderList as y, normalizeStyle as F, createVNode as p, createCommentVNode as v, resolveDynamicComponent as K, mergeModels as Y, useModel as k, watchEffect as q, createElementVNode as f, createTextVNode as _, toDisplayString as I } from "vue";
|
8
8
|
import { _ as Re } from "../../../BuiTableCaption.vue_vue_type_script_setup_true_lang-CTEP1Sde.js";
|
9
9
|
import { _ as J } from "../../../BuiTableEmpty.vue_vue_type_script_setup_true_lang-BTyX0sT5.js";
|
10
10
|
import { _ as Ie } from "../../../BuiTableFooter.vue_vue_type_script_setup_true_lang-CRyh8XF5.js";
|
@@ -13,9 +13,9 @@ import { _ as W } from "../../../BuiCollapsibleTrigger.vue_vue_type_script_setup
|
|
13
13
|
import { _ as X } from "../../../BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-BiD89zzH.js";
|
14
14
|
import { _ as Z } from "../../../variables-Dw5mPbg_.js";
|
15
15
|
import "vee-validate";
|
16
|
-
import { v as
|
17
|
-
import { FlexRender as
|
18
|
-
const
|
16
|
+
import { v as M } from "../../../utils-CwP7Up6y.js";
|
17
|
+
import { FlexRender as L, useVueTable as ee, getCoreRowModel as te, getPaginationRowModel as oe, getSortedRowModel as ne } from "@tanstack/vue-table";
|
18
|
+
const D = /* @__PURE__ */ x({
|
19
19
|
__name: "BuiTableRowSubrow",
|
20
20
|
props: {
|
21
21
|
row: {},
|
@@ -23,45 +23,46 @@ const N = /* @__PURE__ */ E({
|
|
23
23
|
columns: {}
|
24
24
|
},
|
25
25
|
setup(b) {
|
26
|
-
const
|
27
|
-
return (
|
28
|
-
m(a(
|
29
|
-
|
30
|
-
|
26
|
+
const t = b, C = S(() => t.row.getVisibleCells().every((r) => !r.getContext().getValue()));
|
27
|
+
return (r, R) => (o(), u(d, null, [
|
28
|
+
C.value ? v("", !0) : (o(), m(a($), {
|
29
|
+
key: 0,
|
30
|
+
"data-row-state": r.row.getIsSelected() ? "selected" : void 0,
|
31
|
+
class: G(t.renderSubComponent?.(r.row) ? "border-b-0" : "")
|
31
32
|
}, {
|
32
33
|
actions: l(() => [
|
33
|
-
c(
|
34
|
+
c(r.$slots, "actions")
|
34
35
|
]),
|
35
36
|
default: l(() => [
|
36
|
-
(
|
37
|
-
key:
|
38
|
-
style:
|
37
|
+
(o(!0), u(d, null, y(r.row.getVisibleCells(), (w) => (o(), m(a(T), {
|
38
|
+
key: w.id,
|
39
|
+
style: F({ ...a(U)(w.column) })
|
39
40
|
}, {
|
40
41
|
default: l(() => [
|
41
|
-
|
42
|
-
render:
|
43
|
-
props:
|
42
|
+
p(a(L), {
|
43
|
+
render: w.column.columnDef.cell,
|
44
|
+
props: w.getContext()
|
44
45
|
}, null, 8, ["render", "props"])
|
45
46
|
]),
|
46
47
|
_: 2
|
47
48
|
}, 1032, ["style"]))), 128))
|
48
49
|
]),
|
49
50
|
_: 3
|
50
|
-
}, 8, ["data-row-state", "class"]),
|
51
|
-
|
52
|
-
key:
|
53
|
-
"data-row-state":
|
51
|
+
}, 8, ["data-row-state", "class"])),
|
52
|
+
t.renderSubComponent?.(r.row) ? (o(), m(a($), {
|
53
|
+
key: 1,
|
54
|
+
"data-row-state": r.row.getIsSelected() ? "selected" : void 0
|
54
55
|
}, {
|
55
56
|
actions: l(() => [
|
56
|
-
c(
|
57
|
+
c(r.$slots, "actions")
|
57
58
|
]),
|
58
59
|
default: l(() => [
|
59
|
-
|
60
|
-
colspan:
|
60
|
+
p(a(T), {
|
61
|
+
colspan: r.columns.length,
|
61
62
|
class: "pt-0"
|
62
63
|
}, {
|
63
64
|
default: l(() => [
|
64
|
-
(
|
65
|
+
(o(), m(K(t.renderSubComponent?.(r.row)?.())))
|
65
66
|
]),
|
66
67
|
_: 1
|
67
68
|
}, 8, ["colspan"])
|
@@ -76,7 +77,7 @@ const N = /* @__PURE__ */ E({
|
|
76
77
|
}, le = { class: "mt-1 flex w-full items-center justify-between" }, re = { class: "relative -mb-[5px] inline-block rounded-t-lg bg-background px-4 py-2 text-sm font-medium shadow-top-shadow" }, se = {
|
77
78
|
key: 1,
|
78
79
|
class: "flex w-full justify-end border-x border-b border-border/[0.16] bg-primary/[0.04] px-4 py-1 text-base text-muted-foreground"
|
79
|
-
},
|
80
|
+
}, E = "#UNDEFINED#", ke = /* @__PURE__ */ x({
|
80
81
|
__name: "BuiDataTable",
|
81
82
|
props: /* @__PURE__ */ Y({
|
82
83
|
columns: {},
|
@@ -102,98 +103,98 @@ const N = /* @__PURE__ */ E({
|
|
102
103
|
}),
|
103
104
|
emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
|
104
105
|
setup(b) {
|
105
|
-
const
|
106
|
-
() =>
|
106
|
+
const t = b, C = k(b, "sorting"), r = k(b, "pagination"), R = k(b, "selection"), w = k(b, "columnVisibility"), V = S(
|
107
|
+
() => t.manualPagination ? t.totalItems : t.data.length
|
107
108
|
), g = ee({
|
108
109
|
initialState: {
|
109
110
|
// TODO: column freeze
|
110
111
|
//columnPinning: { left: ['id'] },
|
111
|
-
pagination: { pageSize:
|
112
|
+
pagination: { pageSize: t.pageSize }
|
112
113
|
},
|
113
114
|
get data() {
|
114
|
-
return
|
115
|
+
return t.data;
|
115
116
|
},
|
116
117
|
get columns() {
|
117
|
-
return
|
118
|
+
return t.columns;
|
118
119
|
},
|
119
|
-
getCoreRowModel:
|
120
|
-
getPaginationRowModel:
|
120
|
+
getCoreRowModel: te(),
|
121
|
+
getPaginationRowModel: oe(),
|
121
122
|
getSortedRowModel: ne(),
|
122
123
|
onSortingChange: (e) => {
|
123
|
-
|
124
|
+
M(e, C);
|
124
125
|
},
|
125
126
|
onPaginationChange: (e) => {
|
126
|
-
|
127
|
+
M(e, r);
|
127
128
|
},
|
128
129
|
onRowSelectionChange: (e) => {
|
129
|
-
|
130
|
+
M(e, R);
|
130
131
|
},
|
131
132
|
autoResetPageIndex: !1,
|
132
|
-
manualPagination:
|
133
|
+
manualPagination: t.manualPagination,
|
133
134
|
// set to false to enable client-side pagination
|
134
|
-
manualSorting:
|
135
|
+
manualSorting: t.manualSorting,
|
135
136
|
state: {
|
136
137
|
get sorting() {
|
137
|
-
return
|
138
|
+
return C.value;
|
138
139
|
},
|
139
140
|
get pagination() {
|
140
|
-
return
|
141
|
+
return r.value;
|
141
142
|
},
|
142
143
|
get rowSelection() {
|
143
|
-
return
|
144
|
+
return R.value;
|
144
145
|
},
|
145
146
|
get columnVisibility() {
|
146
|
-
return
|
147
|
+
return w.value;
|
147
148
|
}
|
148
149
|
},
|
149
|
-
getRowId:
|
150
|
-
}),
|
150
|
+
getRowId: t.getRowId
|
151
|
+
}), z = S({
|
151
152
|
get() {
|
152
153
|
return g.getState().pagination.pageSize;
|
153
154
|
},
|
154
155
|
set(e) {
|
155
|
-
|
156
|
+
r.value && (r.value.pageSize = e, g.setPageSize(e), g.setPageIndex(0));
|
156
157
|
}
|
157
|
-
}),
|
158
|
+
}), B = S({
|
158
159
|
get() {
|
159
160
|
return g.getState().pagination.pageIndex + 1;
|
160
161
|
},
|
161
162
|
set(e) {
|
162
|
-
|
163
|
+
r.value && (r.value.pageIndex = e - 1, g.setPageIndex(e - 1));
|
163
164
|
}
|
164
165
|
});
|
165
166
|
q(() => {
|
166
167
|
const e = g.getPageCount();
|
167
|
-
e && e <
|
168
|
+
e && e < B.value && (B.value = e);
|
168
169
|
});
|
169
|
-
const
|
170
|
-
const
|
171
|
-
return e[
|
170
|
+
const h = S(() => t.groupBy ? g.getRowModel().rows.reduce((e, n) => {
|
171
|
+
const s = n.getValue(t.groupBy) ?? E;
|
172
|
+
return e[s] = e[s] || [], e[s].push(n), e;
|
172
173
|
}, /* @__PURE__ */ Object.create(null)) : null);
|
173
|
-
function
|
174
|
-
return (
|
174
|
+
function N(e) {
|
175
|
+
return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
|
175
176
|
}
|
176
|
-
return (e,
|
177
|
-
e.$slots.caption ? (
|
177
|
+
return (e, n) => (o(), u(d, null, [
|
178
|
+
e.$slots.caption ? (o(), u("div", ae, [
|
178
179
|
c(e.$slots, "caption", { table: a(g) })
|
179
180
|
])) : v("", !0),
|
180
|
-
|
181
|
+
p(a(j), null, {
|
181
182
|
default: l(() => [
|
182
|
-
|
183
|
+
p(a(O), null, {
|
183
184
|
default: l(() => [
|
184
|
-
(
|
185
|
-
key:
|
185
|
+
(o(!0), u(d, null, y(a(g).getHeaderGroups(), (i) => (o(), m(a($), {
|
186
|
+
key: i.id
|
186
187
|
}, {
|
187
188
|
default: l(() => [
|
188
|
-
(
|
189
|
-
key:
|
190
|
-
style:
|
189
|
+
(o(!0), u(d, null, y(i.headers, (s) => (o(), m(a(H), {
|
190
|
+
key: s.id,
|
191
|
+
style: F({ ...a(U)(s.column) })
|
191
192
|
}, {
|
192
193
|
default: l(() => [
|
193
|
-
|
194
|
+
s.isPlaceholder ? v("", !0) : (o(), m(a(L), {
|
194
195
|
key: 0,
|
195
|
-
render:
|
196
|
-
props:
|
196
|
+
render: s.column.columnDef.header,
|
197
|
+
props: s.getContext()
|
197
198
|
}, null, 8, ["render", "props"]))
|
198
199
|
]),
|
199
200
|
_: 2
|
@@ -204,51 +205,51 @@ const N = /* @__PURE__ */ E({
|
|
204
205
|
]),
|
205
206
|
_: 1
|
206
207
|
}),
|
207
|
-
|
208
|
+
p(a(A), null, {
|
208
209
|
default: l(() => [
|
209
|
-
a(g).getRowModel().rows?.length ? (
|
210
|
-
|
210
|
+
a(g).getRowModel().rows?.length ? (o(), u(d, { key: 0 }, [
|
211
|
+
t.groupBy && h.value ? (o(!0), u(d, { key: 0 }, y(h.value, (i, s) => (o(), m(a(Q), {
|
211
212
|
asChild: "",
|
212
|
-
key:
|
213
|
+
key: s,
|
213
214
|
open: !0
|
214
215
|
}, {
|
215
216
|
default: l(() => [
|
216
|
-
|
217
|
+
p(a(W), { asChild: "" }, {
|
217
218
|
default: l(() => [
|
218
|
-
|
219
|
+
p(a($), { class: "bg-foreground/[0.04]" }, {
|
219
220
|
actions: l(() => [
|
220
|
-
c(e.$slots, "groupActions", { group:
|
221
|
+
c(e.$slots, "groupActions", { group: s })
|
221
222
|
]),
|
222
223
|
default: l(() => [
|
223
|
-
|
224
|
+
p(a(T), {
|
224
225
|
colspan: e.columns.length,
|
225
226
|
class: "!pb-0"
|
226
227
|
}, {
|
227
228
|
default: l(() => [
|
228
229
|
f("div", le, [
|
229
230
|
f("div", re, [
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
], 64)) : (
|
240
|
-
|
231
|
+
n[2] || (n[2] = f("div", { class: "absolute -left-2 bottom-0 h-2 w-2 bg-background" }, null, -1)),
|
232
|
+
n[3] || (n[3] = f("div", { class: "absolute -left-4 bottom-0 h-4 w-4 rounded-lg bg-background" }, null, -1)),
|
233
|
+
n[4] || (n[4] = f("div", { class: "absolute -left-4 bottom-0 h-4 w-4 rounded-lg bg-foreground/[0.04]" }, null, -1)),
|
234
|
+
n[5] || (n[5] = f("div", { class: "absolute -right-2 bottom-0 h-2 w-2 bg-background" }, null, -1)),
|
235
|
+
n[6] || (n[6] = f("div", { class: "absolute -right-4 bottom-0 h-4 w-4 rounded-lg bg-background" }, null, -1)),
|
236
|
+
n[7] || (n[7] = f("div", { class: "absolute -right-4 bottom-0 h-4 w-4 rounded-lg bg-foreground/[0.04]" }, null, -1)),
|
237
|
+
n[8] || (n[8] = f("div", null, null, -1)),
|
238
|
+
s === E ? (o(), u(d, { key: 0 }, [
|
239
|
+
_(I(N(1)), 1)
|
240
|
+
], 64)) : (o(), u(d, { key: 1 }, [
|
241
|
+
_(I(N(0)) + ": ", 1),
|
241
242
|
e.$slots.groupName ? c(e.$slots, "groupName", {
|
242
243
|
key: 0,
|
243
|
-
group:
|
244
|
-
}) : (
|
245
|
-
|
244
|
+
group: s
|
245
|
+
}) : (o(), u(d, { key: 1 }, [
|
246
|
+
_(I(s), 1)
|
246
247
|
], 64))
|
247
248
|
], 64))
|
248
249
|
]),
|
249
250
|
e.$slots.groupByRow ? c(e.$slots, "groupByRow", {
|
250
251
|
key: 0,
|
251
|
-
group:
|
252
|
+
group: s
|
252
253
|
}) : v("", !0)
|
253
254
|
])
|
254
255
|
]),
|
@@ -260,17 +261,17 @@ const N = /* @__PURE__ */ E({
|
|
260
261
|
]),
|
261
262
|
_: 2
|
262
263
|
}, 1024),
|
263
|
-
|
264
|
+
p(a(X), { asChild: "" }, {
|
264
265
|
default: l(() => [
|
265
|
-
(
|
266
|
-
key:
|
267
|
-
columns:
|
268
|
-
row:
|
269
|
-
renderSubComponent:
|
266
|
+
(o(!0), u(d, null, y(i, (P) => (o(), m(D, {
|
267
|
+
key: P.id,
|
268
|
+
columns: t.columns,
|
269
|
+
row: P,
|
270
|
+
renderSubComponent: t.renderSubComponent
|
270
271
|
}, {
|
271
272
|
actions: l(() => [
|
272
273
|
c(e.$slots, "rowActions", {
|
273
|
-
row:
|
274
|
+
row: P.original
|
274
275
|
})
|
275
276
|
]),
|
276
277
|
_: 2
|
@@ -280,26 +281,26 @@ const N = /* @__PURE__ */ E({
|
|
280
281
|
}, 1024)
|
281
282
|
]),
|
282
283
|
_: 2
|
283
|
-
}, 1024))), 128)) : (
|
284
|
-
key:
|
285
|
-
columns:
|
286
|
-
row:
|
287
|
-
renderSubComponent:
|
284
|
+
}, 1024))), 128)) : (o(!0), u(d, { key: 1 }, y(a(g).getRowModel().rows, (i) => (o(), m(D, {
|
285
|
+
key: i.id,
|
286
|
+
columns: t.columns,
|
287
|
+
row: i,
|
288
|
+
renderSubComponent: t.renderSubComponent
|
288
289
|
}, {
|
289
290
|
actions: l(() => [
|
290
291
|
c(e.$slots, "rowActions", {
|
291
|
-
row:
|
292
|
+
row: i.original
|
292
293
|
})
|
293
294
|
]),
|
294
295
|
_: 2
|
295
296
|
}, 1032, ["columns", "row", "renderSubComponent"]))), 128))
|
296
|
-
], 64)) : (
|
297
|
+
], 64)) : (o(), m(a(J), {
|
297
298
|
key: 1,
|
298
299
|
colspan: e.columns.length
|
299
300
|
}, {
|
300
301
|
default: l(() => [
|
301
302
|
c(e.$slots, "nodata", {}, () => [
|
302
|
-
|
303
|
+
n[9] || (n[9] = _("No data"))
|
303
304
|
])
|
304
305
|
]),
|
305
306
|
_: 3
|
@@ -310,37 +311,37 @@ const N = /* @__PURE__ */ E({
|
|
310
311
|
]),
|
311
312
|
_: 3
|
312
313
|
}),
|
313
|
-
e.showPagination &&
|
314
|
-
|
315
|
-
total:
|
316
|
-
pageIndex:
|
317
|
-
"onUpdate:pageIndex":
|
318
|
-
pageSize:
|
319
|
-
"onUpdate:pageSize":
|
314
|
+
e.showPagination && V.value > 0 ? (o(), u("div", se, [
|
315
|
+
p(a(Z), {
|
316
|
+
total: V.value,
|
317
|
+
pageIndex: B.value,
|
318
|
+
"onUpdate:pageIndex": n[0] || (n[0] = (i) => B.value = i),
|
319
|
+
pageSize: z.value,
|
320
|
+
"onUpdate:pageSize": n[1] || (n[1] = (i) => z.value = i)
|
320
321
|
}, null, 8, ["total", "pageIndex", "pageSize"])
|
321
322
|
])) : v("", !0)
|
322
323
|
], 64));
|
323
324
|
}
|
324
325
|
});
|
325
|
-
function
|
326
|
-
const
|
326
|
+
function U(b) {
|
327
|
+
const t = b.getIsPinned();
|
327
328
|
return {
|
328
|
-
left:
|
329
|
-
position:
|
330
|
-
zIndex:
|
329
|
+
left: t === "left" ? "0" : void 0,
|
330
|
+
position: t ? "sticky" : "relative",
|
331
|
+
zIndex: t ? "1" : "0"
|
331
332
|
};
|
332
333
|
}
|
333
334
|
export {
|
334
|
-
|
335
|
+
ke as BuiDataTable,
|
335
336
|
j as BuiTable,
|
336
337
|
A as BuiTableBody,
|
337
338
|
Re as BuiTableCaption,
|
338
|
-
|
339
|
+
T as BuiTableCell,
|
339
340
|
J as BuiTableEmpty,
|
340
341
|
Ie as BuiTableFooter,
|
341
342
|
H as BuiTableHead,
|
342
343
|
O as BuiTableHeader,
|
343
|
-
|
344
|
-
|
345
|
-
|
344
|
+
$ as BuiTableRow,
|
345
|
+
D as BuiTableRowSubrow,
|
346
|
+
U as getPinningStyle
|
346
347
|
};
|
package/package.json
CHANGED
@@ -2,16 +2,23 @@
|
|
2
2
|
import { BuiTableCell, BuiTableRow } from '@/components/ui/table'
|
3
3
|
import { FlexRender, type ColumnDef, type Row } from '@tanstack/vue-table'
|
4
4
|
import { getPinningStyle } from './'
|
5
|
+
import { computed } from 'vue'
|
5
6
|
|
6
7
|
const props = defineProps<{
|
7
8
|
row: Row<TData>
|
8
9
|
renderSubComponent?: (row: Row<TData>) => (() => any) | undefined
|
9
10
|
columns: ColumnDef<TData, TValue>[]
|
10
11
|
}>()
|
12
|
+
|
13
|
+
// иногда мы используем фейковые строки с пустыми значениями, лучше их скрыть
|
14
|
+
const isEmptyRow = computed(() => {
|
15
|
+
return props.row.getVisibleCells().every((cell) => !cell.getContext().getValue())
|
16
|
+
})
|
11
17
|
</script>
|
12
18
|
|
13
19
|
<template>
|
14
20
|
<BuiTableRow
|
21
|
+
v-if="!isEmptyRow"
|
15
22
|
:data-row-state="row.getIsSelected() ? 'selected' : undefined"
|
16
23
|
:class="props.renderSubComponent?.(row) ? 'border-b-0' : ''"
|
17
24
|
>
|