@soft-stech/bootsman-ui-shadcn 1.1.16 → 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,219 @@
1
+ import { defineComponent as z, mergeModels as x, useModel as S, computed as _, openBlock as o, createBlock as u, unref as t, withCtx as r, renderSlot as V, createCommentVNode as b, createVNode as i, createElementBlock as m, Fragment as p, renderList as c, createElementVNode as N, toDisplayString as I, createTextVNode as L } from "vue";
2
+ import { _ as D } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-B4dxhX_r.js";
3
+ import { _ as F } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-b1qMpG9a.js";
4
+ import { _ as T } from "./BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-3St49aGF.js";
5
+ import { _ as U } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-dh6FvXRc.js";
6
+ import { v as w } from "./utils-DMgok1im.js";
7
+ import { u as E, g as j, a as H, b as O, F as q, _ as M } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-zozuVlJm.js";
8
+ import { _ as A } from "./BuiTable.vue_vue_type_script_setup_true_lang-BbPh0gPO.js";
9
+ import { _ as G } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-B4pSpE-L.js";
10
+ import { _ as h } from "./BuiTableCell.vue_vue_type_script_setup_true_lang-DwoXqpKg.js";
11
+ import { _ as J } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-DlE-Jn0g.js";
12
+ import { _ as K } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-ByDzPSa9.js";
13
+ import { _ as y } from "./BuiTableRow.vue_vue_type_script_setup_true_lang-Dh4QgH7f.js";
14
+ import { _ as Q } from "./BuiTableCaption.vue_vue_type_script_setup_true_lang-DhTn_6Ag.js";
15
+ import { _ as W } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BRA5Uz6D.js";
16
+ import { _ as X } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-_Im-lcXC.js";
17
+ const Y = { class: "inline-block rounded-t bg-background px-4 py-3" }, fe = /* @__PURE__ */ z({
18
+ __name: "BuiDataTable",
19
+ props: /* @__PURE__ */ x({
20
+ columns: {},
21
+ data: {},
22
+ pageSize: { default: 10 },
23
+ showPagination: { type: Boolean, default: !0 },
24
+ totalItems: { default: 0 },
25
+ manualPagination: { type: Boolean, default: !0 },
26
+ manualSorting: { type: Boolean, default: !0 },
27
+ groupBy: {},
28
+ groupLabels: {},
29
+ getRowId: {},
30
+ renderSubComponent: {}
31
+ }, {
32
+ sorting: {},
33
+ sortingModifiers: {},
34
+ pagination: {},
35
+ paginationModifiers: {},
36
+ selection: {},
37
+ selectionModifiers: {}
38
+ }),
39
+ emits: ["update:sorting", "update:pagination", "update:selection"],
40
+ setup(f) {
41
+ const n = f, C = S(f, "sorting"), d = S(f, "pagination"), v = S(f, "selection"), B = _(
42
+ () => n.manualPagination ? n.totalItems : n.data.length
43
+ ), l = E({
44
+ initialState: { pagination: { pageSize: n.pageSize } },
45
+ get data() {
46
+ return n.data;
47
+ },
48
+ get columns() {
49
+ return n.columns;
50
+ },
51
+ getCoreRowModel: j(),
52
+ getPaginationRowModel: H(),
53
+ getSortedRowModel: O(),
54
+ onSortingChange: (e) => {
55
+ w(e, C);
56
+ },
57
+ onPaginationChange: (e) => {
58
+ w(e, d);
59
+ },
60
+ onRowSelectionChange: (e) => {
61
+ w(e, v);
62
+ },
63
+ manualPagination: n.manualPagination,
64
+ // set to false to enable client-side pagination
65
+ manualSorting: n.manualSorting,
66
+ state: {
67
+ get sorting() {
68
+ return C.value;
69
+ },
70
+ get pagination() {
71
+ return d.value;
72
+ },
73
+ get rowSelection() {
74
+ return v.value;
75
+ }
76
+ },
77
+ getRowId: n.getRowId
78
+ }), $ = _({
79
+ get() {
80
+ return l.getState().pagination.pageSize;
81
+ },
82
+ set(e) {
83
+ d.value && (d.value.pageSize = e, l.setPageSize(e), l.setPageIndex(0));
84
+ }
85
+ }), k = _({
86
+ get() {
87
+ return l.getState().pagination.pageIndex + 1;
88
+ },
89
+ set(e) {
90
+ d.value && (d.value.pageIndex = e - 1, l.setPageIndex(e - 1));
91
+ }
92
+ }), P = _(() => n.groupBy ? l.getRowModel().rows.reduce((e, s) => {
93
+ const a = s.getValue(n.groupBy);
94
+ return e[a] = e[a] || [], e[a].push(s), e;
95
+ }, /* @__PURE__ */ Object.create(null)) : null);
96
+ return (e, s) => (o(), u(t(A), null, {
97
+ default: r(() => [
98
+ e.$slots.caption ? (o(), u(t(Q), { key: 0 }, {
99
+ default: r(() => [
100
+ V(e.$slots, "caption", { table: t(l) })
101
+ ]),
102
+ _: 3
103
+ })) : b("", !0),
104
+ i(t(K), null, {
105
+ default: r(() => [
106
+ (o(!0), m(p, null, c(t(l).getHeaderGroups(), (a) => (o(), u(t(y), {
107
+ key: a.id
108
+ }, {
109
+ default: r(() => [
110
+ (o(!0), m(p, null, c(a.headers, (g) => (o(), u(t(J), {
111
+ key: g.id
112
+ }, {
113
+ default: r(() => [
114
+ g.isPlaceholder ? b("", !0) : (o(), u(t(q), {
115
+ key: 0,
116
+ render: g.column.columnDef.header,
117
+ props: g.getContext()
118
+ }, null, 8, ["render", "props"]))
119
+ ]),
120
+ _: 2
121
+ }, 1024))), 128))
122
+ ]),
123
+ _: 2
124
+ }, 1024))), 128))
125
+ ]),
126
+ _: 1
127
+ }),
128
+ i(t(G), null, {
129
+ default: r(() => [
130
+ t(l).getRowModel().rows?.length ? (o(), m(p, { key: 0 }, [
131
+ n.groupBy && P.value ? (o(!0), m(p, { key: 0 }, c(P.value, (a, g) => (o(), u(t(D), {
132
+ asChild: "",
133
+ key: g,
134
+ open: !0
135
+ }, {
136
+ default: r(() => [
137
+ i(t(F), { asChild: "" }, {
138
+ default: r(() => [
139
+ i(t(y), { class: "bg-foreground/[0.04]" }, {
140
+ default: r(() => [
141
+ i(t(h), {
142
+ colspan: e.columns.length,
143
+ class: "!pb-0"
144
+ }, {
145
+ default: r(() => [
146
+ N("div", Y, I(n.groupLabels && n.groupLabels[n.groupBy]) + ": " + I(g), 1)
147
+ ]),
148
+ _: 2
149
+ }, 1032, ["colspan"])
150
+ ]),
151
+ _: 2
152
+ }, 1024)
153
+ ]),
154
+ _: 2
155
+ }, 1024),
156
+ i(t(T), { asChild: "" }, {
157
+ default: r(() => [
158
+ (o(!0), m(p, null, c(a, (R) => (o(), u(M, {
159
+ key: R.id,
160
+ columns: n.columns,
161
+ row: R,
162
+ renderSubComponent: n.renderSubComponent
163
+ }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
164
+ ]),
165
+ _: 2
166
+ }, 1024)
167
+ ]),
168
+ _: 2
169
+ }, 1024))), 128)) : (o(!0), m(p, { key: 1 }, c(t(l).getRowModel().rows, (a) => (o(), u(M, {
170
+ key: a.id,
171
+ columns: n.columns,
172
+ row: a,
173
+ renderSubComponent: n.renderSubComponent
174
+ }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
175
+ ], 64)) : (o(), u(t(W), {
176
+ key: 1,
177
+ colspan: e.columns.length
178
+ }, {
179
+ default: r(() => [
180
+ L("No data")
181
+ ]),
182
+ _: 1
183
+ }, 8, ["colspan"]))
184
+ ]),
185
+ _: 1
186
+ }),
187
+ e.showPagination && t(l).getPageCount() > 1 ? (o(), u(t(X), { key: 1 }, {
188
+ default: r(() => [
189
+ i(t(y), null, {
190
+ default: r(() => [
191
+ i(t(h), {
192
+ colspan: e.columns.length
193
+ }, {
194
+ default: r(() => [
195
+ i(t(U), {
196
+ class: "float-right",
197
+ total: B.value,
198
+ pageIndex: k.value,
199
+ "onUpdate:pageIndex": s[0] || (s[0] = (a) => k.value = a),
200
+ pageSize: $.value,
201
+ "onUpdate:pageSize": s[1] || (s[1] = (a) => $.value = a)
202
+ }, null, 8, ["total", "pageIndex", "pageSize"])
203
+ ]),
204
+ _: 1
205
+ }, 8, ["colspan"])
206
+ ]),
207
+ _: 1
208
+ })
209
+ ]),
210
+ _: 1
211
+ })) : b("", !0)
212
+ ]),
213
+ _: 3
214
+ }));
215
+ }
216
+ });
217
+ export {
218
+ fe as _
219
+ };
@@ -10,11 +10,12 @@ import { _ as C } from "./BuiSelectContent.vue_vue_type_script_setup_true_lang-C
10
10
  import { _ as L } from "./BuiSelectItem.vue_vue_type_script_setup_true_lang-j4FFgeLR.js";
11
11
  import "./components/ui/toast/use-toast.js";
12
12
  import "./index-BGsblnmA.js";
13
+ /* empty css */
13
14
  import { _ as N } from "./BuiPaginationFirst.vue_vue_type_script_setup_true_lang-b341Y0jB.js";
14
15
  import { _ as U } from "./BuiPaginationLast.vue_vue_type_script_setup_true_lang-BYpwx_Ik.js";
15
16
  import { _ as b } from "./BuiPaginationNext.vue_vue_type_script_setup_true_lang-BZZG77kQ.js";
16
17
  import { _ as q } from "./BuiPaginationPrev.vue_vue_type_script_setup_true_lang-DsYapLGr.js";
17
- const E = { class: "m-2" }, H = /* @__PURE__ */ v("p", { class: "text-sm text-muted-foreground" }, "Items per page", -1), j = { class: "text-sm text-muted-foreground" }, ae = /* @__PURE__ */ $({
18
+ const E = { class: "m-2" }, H = /* @__PURE__ */ v("p", { class: "text-sm text-muted-foreground" }, "Items per page", -1), j = { class: "text-sm text-muted-foreground" }, oe = /* @__PURE__ */ $({
18
19
  __name: "BuiPaginationCommon",
19
20
  props: /* @__PURE__ */ V({
20
21
  total: {}
@@ -42,7 +43,7 @@ const E = { class: "m-2" }, H = /* @__PURE__ */ v("p", { class: "text-sm text-mu
42
43
  "onUpdate:page": o[2] || (o[2] = (i) => s.value = i)
43
44
  }, {
44
45
  default: r(({ page: i }) => [
45
- e(t(B), { class: "flex items-center justify-center gap-2" }, {
46
+ e(t(B), { class: "relative flex items-center justify-center gap-2" }, {
46
47
  default: r(() => [
47
48
  H,
48
49
  e(t(k), {
@@ -97,5 +98,5 @@ const E = { class: "m-2" }, H = /* @__PURE__ */ v("p", { class: "text-sm text-mu
97
98
  }
98
99
  });
99
100
  export {
100
- ae as _
101
+ oe as _
101
102
  };