@soft-stech/bootsman-ui-shadcn 1.3.1 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
+ };
@@ -0,0 +1,109 @@
1
+ import { defineComponent as $, mergeModels as y, useModel as c, computed as v, openBlock as n, createElementBlock as p, createVNode as e, unref as t, withCtx as r, createElementVNode as x, Fragment as S, renderList as I, createTextVNode as P, toDisplayString as u, createCommentVNode as M } from "vue";
2
+ /* empty css */
3
+ import { f as z, y as k } from "./index-uA4l4INt.js";
4
+ import "@vueuse/core";
5
+ import "./BuiCalendar.vue_vue_type_style_index_0_lang-DK4yUiXC.js";
6
+ import "vee-validate";
7
+ import { BuiInput as B } from "./components/ui/input/index.js";
8
+ import { _ as C } from "./BuiSelect.vue_vue_type_script_setup_true_lang-YVZaZc0x.js";
9
+ import { _ as N } from "./BuiSelectValue.vue_vue_type_script_setup_true_lang-CseYU299.js";
10
+ import { _ as w } from "./BuiSelectTrigger.vue_vue_type_script_setup_true_lang-Dh-1xzuh.js";
11
+ import { _ as U } from "./BuiSelectContent.vue_vue_type_script_setup_true_lang-CX82dW-X.js";
12
+ import { _ as b } from "./BuiSelectItem.vue_vue_type_script_setup_true_lang-DsWD84S8.js";
13
+ import "@tanstack/vue-table";
14
+ import "./components/ui/toast/use-toast.js";
15
+ import "@vee-validate/zod";
16
+ import "zod";
17
+ import "./index-BGsblnmA.js";
18
+ /* empty css */
19
+ import { _ as q } from "./BuiPaginationFirst.vue_vue_type_script_setup_true_lang-CvMVo3wC.js";
20
+ import { _ as E } from "./BuiPaginationLast.vue_vue_type_script_setup_true_lang-BTNEZSgQ.js";
21
+ import { _ as j } from "./BuiPaginationNext.vue_vue_type_script_setup_true_lang-DcwRaAYo.js";
22
+ import { _ as D } from "./BuiPaginationPrev.vue_vue_type_script_setup_true_lang-DkK8mnKY.js";
23
+ const F = { class: "m-2" }, L = { class: "text-sm text-muted-foreground" }, se = /* @__PURE__ */ $({
24
+ __name: "BuiPaginationCommon",
25
+ props: /* @__PURE__ */ y({
26
+ total: {}
27
+ }, {
28
+ pageSize: { default: 10, required: !0 },
29
+ pageSizeModifiers: {},
30
+ pageIndex: { default: 1, required: !0 },
31
+ pageIndexModifiers: {}
32
+ }),
33
+ emits: ["update:pageSize", "update:pageIndex"],
34
+ setup(l) {
35
+ const V = [10, 20, 30, 40, 50], d = l, m = c(l, "pageSize"), i = c(l, "pageIndex"), f = v(() => Math.ceil(d.total / m.value)), _ = v({
36
+ get() {
37
+ return String(m.value);
38
+ },
39
+ set(g) {
40
+ m.value = parseInt(g);
41
+ }
42
+ });
43
+ return (g, a) => (n(), p("div", F, [
44
+ e(t(z), {
45
+ total: d.total,
46
+ itemsPerPage: m.value,
47
+ page: i.value,
48
+ "onUpdate:page": a[2] || (a[2] = (s) => i.value = s)
49
+ }, {
50
+ default: r(({ page: s }) => [
51
+ e(t(k), { class: "relative flex items-center justify-center gap-2" }, {
52
+ default: r(() => [
53
+ a[3] || (a[3] = x("p", { class: "text-sm text-muted-foreground" }, "Items per page", -1)),
54
+ e(t(C), {
55
+ modelValue: _.value,
56
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => _.value = o),
57
+ modelModifiers: { number: !0 }
58
+ }, {
59
+ default: r(() => [
60
+ e(t(w), { class: "mr-2 w-[70px]" }, {
61
+ default: r(() => [
62
+ e(t(N), {
63
+ placeholder: m.value.toString()
64
+ }, null, 8, ["placeholder"])
65
+ ]),
66
+ _: 1
67
+ }),
68
+ e(t(U), { side: "top" }, {
69
+ default: r(() => [
70
+ (n(), p(S, null, I(V, (o) => e(t(b), {
71
+ key: o,
72
+ value: o.toString()
73
+ }, {
74
+ default: r(() => [
75
+ P(u(o), 1)
76
+ ]),
77
+ _: 2
78
+ }, 1032, ["value"])), 64))
79
+ ]),
80
+ _: 1
81
+ })
82
+ ]),
83
+ _: 1
84
+ }, 8, ["modelValue"]),
85
+ f.value > 1 ? (n(), p(S, { key: 0 }, [
86
+ x("p", L, "Page " + u(s) + " of " + u(f.value), 1),
87
+ e(t(q)),
88
+ e(t(D)),
89
+ e(t(B), {
90
+ modelValue: i.value,
91
+ "onUpdate:modelValue": a[1] || (a[1] = (o) => i.value = o),
92
+ class: "w-28",
93
+ placeholder: "Page number"
94
+ }, null, 8, ["modelValue"]),
95
+ e(t(j)),
96
+ e(t(E))
97
+ ], 64)) : M("", !0)
98
+ ]),
99
+ _: 2
100
+ }, 1024)
101
+ ]),
102
+ _: 1
103
+ }, 8, ["total", "itemsPerPage", "page"])
104
+ ]));
105
+ }
106
+ });
107
+ export {
108
+ se as _
109
+ };
@@ -1,26 +1,26 @@
1
- import { defineComponent as t, openBlock as s, createElementBlock as n, normalizeClass as l, unref as a, createElementVNode as c, renderSlot as d } from "vue";
2
- import { c as m } from "./utils-DPuEjrVV.js";
3
- const i = { class: "flex h-10 items-center border-r border-border/[0.16] p-4" }, u = /* @__PURE__ */ t({
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, p) => (s(), n("th", {
11
- class: l(
12
- a(m)(
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
- c("div", i, [
18
+ l("div", i, [
19
19
  d(r.$slots, "default")
20
20
  ])
21
21
  ], 2));
22
22
  }
23
23
  });
24
24
  export {
25
- u as _
25
+ h as _
26
26
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../../../BuiPaginationCommon.vue_vue_type_script_setup_true_lang-6BhiWgI6.js";
1
+ import { _ as f } from "../../../BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as o } from "../../../BuiPaginationCommon.vue_vue_type_script_setup_true_lang-6BhiWgI6.js";
1
+ import { _ as o } from "../../../BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
2
2
  import { f as n, y as r, g as s } from "../../../index-uA4l4INt.js";
3
3
  import { _ as g } from "../../../BuiPaginationFirst.vue_vue_type_script_setup_true_lang-CvMVo3wC.js";
4
4
  import { _ as P } from "../../../BuiPaginationLast.vue_vue_type_script_setup_true_lang-BTNEZSgQ.js";
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-CBCScilf.js";
1
+ import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-CLpLGgTZ.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../../../BuiTableHead.vue_vue_type_script_setup_true_lang-bRr43VQ9.js";
1
+ import { _ as f } from "../../../BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -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-bRr43VQ9.js";
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-CBCScilf.js";
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
@@ -82,7 +82,7 @@ import { _ as Ce } from "./BuiHoverCardTrigger.vue_vue_type_script_setup_true_la
82
82
  import { _ as Fe } from "./BuiHoverCardContent.vue_vue_type_script_setup_true_lang-DsSfafrp.js";
83
83
  import { BuiBadgedInput as be, BuiInput as De, BuiPasswordInput as Ae, inputVariants as Se } from "./components/ui/input/index.js";
84
84
  import { _ as we } from "./BuiLabel.vue_vue_type_script_setup_true_lang-DQH-AF9N.js";
85
- import { _ as Pe } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-6BhiWgI6.js";
85
+ import { _ as Pe } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
86
86
  import { _ as ve } from "./BuiPaginationFirst.vue_vue_type_script_setup_true_lang-CvMVo3wC.js";
87
87
  import { _ as Le } from "./BuiPaginationLast.vue_vue_type_script_setup_true_lang-BTNEZSgQ.js";
88
88
  import { _ as Ge } from "./BuiPaginationNext.vue_vue_type_script_setup_true_lang-DcwRaAYo.js";
@@ -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-bRr43VQ9.js";
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-CBCScilf.js";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soft-stech/bootsman-ui-shadcn",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -62,12 +62,14 @@ const pageSizeString = computed({
62
62
  </BuiSelectItem>
63
63
  </BuiSelectContent>
64
64
  </BuiSelect>
65
- <p class="text-sm text-muted-foreground">Page {{ page }} of {{ totalPages }}</p>
66
- <BuiPaginationFirst />
67
- <BuiPaginationPrev />
68
- <BuiInput v-model="pageIndex" class="w-28" placeholder="Page number" />
69
- <BuiPaginationNext />
70
- <BuiPaginationLast />
65
+ <template v-if="totalPages > 1">
66
+ <p class="text-sm text-muted-foreground">Page {{ page }} of {{ totalPages }}</p>
67
+ <BuiPaginationFirst />
68
+ <BuiPaginationPrev />
69
+ <BuiInput v-model="pageIndex" class="w-28" placeholder="Page number" />
70
+ <BuiPaginationNext />
71
+ <BuiPaginationLast />
72
+ </template>
71
73
  </BuiPaginationList>
72
74
  </BuiPagination>
73
75
  </div>
@@ -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">
@@ -201,7 +202,7 @@ function getGroupLabel(index: number) {
201
202
  </BuiTableEmpty>
202
203
  </template>
203
204
  </BuiTableBody>
204
- <BuiTableFooter v-if="showPagination && table.getPageCount() > 1">
205
+ <BuiTableFooter v-if="showPagination && computedItems > 0">
205
206
  <BuiTableRow>
206
207
  <BuiTableCell :colspan="columns.length">
207
208
  <BuiPaginationCommon
@@ -13,7 +13,7 @@ const props = defineProps<{ class?: string }>()
13
13
  )
14
14
  "
15
15
  >
16
- <div class="flex h-10 items-center border-r border-border/[0.16] p-4">
16
+ <div class="flex h-10 items-center whitespace-nowrap border-r border-border/[0.16] p-4">
17
17
  <slot />
18
18
  </div>
19
19
  </th>
@@ -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 h, createCommentVNode as w, createVNode as g, createElementBlock as d, Fragment as m, renderList as f, createElementVNode as U, createTextVNode as y, toDisplayString as v } 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-6BhiWgI6.js";
6
- import { v as C } from "./utils-DPuEjrVV.js";
7
- import { _ as z } 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 x } 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" }, N = "#UNDEFINED#", we = /* @__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"), E = S(
43
- () => o.manualPagination ? o.totalItems : o.data.length
44
- ), l = 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
- }), k = S({
81
- get() {
82
- return l.getState().pagination.pageSize;
83
- },
84
- set(e) {
85
- p.value && (p.value.pageSize = e, l.setPageSize(e), l.setPageIndex(0));
86
- }
87
- }), _ = S({
88
- get() {
89
- return l.getState().pagination.pageIndex + 1;
90
- },
91
- set(e) {
92
- p.value && (p.value.pageIndex = e - 1, l.setPageIndex(e - 1));
93
- }
94
- });
95
- L(() => {
96
- const e = l.getPageCount();
97
- e && e < _.value && (_.value = e);
98
- });
99
- const I = S(() => o.groupBy ? l.getRowModel().rows.reduce((e, s) => {
100
- const u = s.getValue(o.groupBy) ?? N;
101
- return e[u] = e[u] || [], e[u].push(s), e;
102
- }, /* @__PURE__ */ Object.create(null)) : null);
103
- function M(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
- h(e.$slots, "caption", { table: t(l) })
111
- ]),
112
- _: 3
113
- })) : w("", !0),
114
- g(t(W), null, {
115
- default: a(() => [
116
- (n(!0), d(m, null, f(t(l).getHeaderGroups(), (r) => (n(), i(t(P), {
117
- key: r.id
118
- }, {
119
- default: a(() => [
120
- (n(!0), d(m, null, f(r.headers, (u) => (n(), i(t(Q), {
121
- key: u.id
122
- }, {
123
- default: a(() => [
124
- u.isPlaceholder ? w("", !0) : (n(), i(t(q), {
125
- key: 0,
126
- render: u.column.columnDef.header,
127
- props: u.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(l).getRowModel().rows?.length ? (n(), d(m, { key: 0 }, [
141
- o.groupBy && I.value ? (n(!0), d(m, { key: 0 }, f(I.value, (r, u) => (n(), i(t(F), {
142
- asChild: "",
143
- key: u,
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(x), {
152
- colspan: e.columns.length,
153
- class: "!pb-0"
154
- }, {
155
- default: a(() => [
156
- U("div", te, [
157
- u === N ? (n(), d(m, { key: 0 }, [
158
- y(v(M(1)), 1)
159
- ], 64)) : (n(), d(m, { key: 1 }, [
160
- y(v(M(0)) + ": " + v(u), 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(r, (B) => (n(), i(z, {
175
- key: B.id,
176
- columns: o.columns,
177
- row: B,
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(l).getRowModel().rows, (r) => (n(), i(z, {
186
- key: r.id,
187
- columns: o.columns,
188
- row: r,
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
- h(e.$slots, "nodata", {}, () => [
197
- s[2] || (s[2] = y("No data"))
198
- ])
199
- ]),
200
- _: 3
201
- }, 8, ["colspan"]))
202
- ]),
203
- _: 3
204
- }),
205
- e.showPagination && t(l).getPageCount() > 1 ? (n(), i(t(ee), { key: 1 }, {
206
- default: a(() => [
207
- g(t(P), null, {
208
- default: a(() => [
209
- g(t(x), {
210
- colspan: e.columns.length
211
- }, {
212
- default: a(() => [
213
- g(t(G), {
214
- class: "float-right",
215
- total: E.value,
216
- pageIndex: _.value,
217
- "onUpdate:pageIndex": s[0] || (s[0] = (r) => _.value = r),
218
- pageSize: k.value,
219
- "onUpdate:pageSize": s[1] || (s[1] = (r) => k.value = r)
220
- }, null, 8, ["total", "pageIndex", "pageSize"])
221
- ]),
222
- _: 1
223
- }, 8, ["colspan"])
224
- ]),
225
- _: 1
226
- })
227
- ]),
228
- _: 1
229
- })) : w("", !0)
230
- ]),
231
- _: 3
232
- }));
233
- }
234
- });
235
- export {
236
- we as _
237
- };
@@ -1,107 +0,0 @@
1
- import { defineComponent as $, mergeModels as V, useModel as f, computed as _, openBlock as g, createElementBlock as c, createVNode as e, unref as t, withCtx as r, createElementVNode as v, Fragment as I, renderList as P, createTextVNode as y, toDisplayString as n } from "vue";
2
- /* empty css */
3
- import { f as M, y as z } from "./index-uA4l4INt.js";
4
- import "@vueuse/core";
5
- import "./BuiCalendar.vue_vue_type_style_index_0_lang-DK4yUiXC.js";
6
- import "vee-validate";
7
- import { BuiInput as B } from "./components/ui/input/index.js";
8
- import { _ as k } from "./BuiSelect.vue_vue_type_script_setup_true_lang-YVZaZc0x.js";
9
- import { _ as w } from "./BuiSelectValue.vue_vue_type_script_setup_true_lang-CseYU299.js";
10
- import { _ as C } from "./BuiSelectTrigger.vue_vue_type_script_setup_true_lang-Dh-1xzuh.js";
11
- import { _ as N } from "./BuiSelectContent.vue_vue_type_script_setup_true_lang-CX82dW-X.js";
12
- import { _ as U } from "./BuiSelectItem.vue_vue_type_script_setup_true_lang-DsWD84S8.js";
13
- import "@tanstack/vue-table";
14
- import "./components/ui/toast/use-toast.js";
15
- import "@vee-validate/zod";
16
- import "zod";
17
- import "./index-BGsblnmA.js";
18
- /* empty css */
19
- import { _ as b } from "./BuiPaginationFirst.vue_vue_type_script_setup_true_lang-CvMVo3wC.js";
20
- import { _ as q } from "./BuiPaginationLast.vue_vue_type_script_setup_true_lang-BTNEZSgQ.js";
21
- import { _ as E } from "./BuiPaginationNext.vue_vue_type_script_setup_true_lang-DcwRaAYo.js";
22
- import { _ as j } from "./BuiPaginationPrev.vue_vue_type_script_setup_true_lang-DkK8mnKY.js";
23
- const D = { class: "m-2" }, F = { class: "text-sm text-muted-foreground" }, le = /* @__PURE__ */ $({
24
- __name: "BuiPaginationCommon",
25
- props: /* @__PURE__ */ V({
26
- total: {}
27
- }, {
28
- pageSize: { default: 10, required: !0 },
29
- pageSizeModifiers: {},
30
- pageIndex: { default: 1, required: !0 },
31
- pageIndexModifiers: {}
32
- }),
33
- emits: ["update:pageSize", "update:pageIndex"],
34
- setup(l) {
35
- const x = [10, 20, 30, 40, 50], p = l, m = f(l, "pageSize"), i = f(l, "pageIndex"), S = _(() => Math.ceil(p.total / m.value)), u = _({
36
- get() {
37
- return String(m.value);
38
- },
39
- set(d) {
40
- m.value = parseInt(d);
41
- }
42
- });
43
- return (d, a) => (g(), c("div", D, [
44
- e(t(M), {
45
- total: p.total,
46
- itemsPerPage: m.value,
47
- page: i.value,
48
- "onUpdate:page": a[2] || (a[2] = (s) => i.value = s)
49
- }, {
50
- default: r(({ page: s }) => [
51
- e(t(z), { class: "relative flex items-center justify-center gap-2" }, {
52
- default: r(() => [
53
- a[3] || (a[3] = v("p", { class: "text-sm text-muted-foreground" }, "Items per page", -1)),
54
- e(t(k), {
55
- modelValue: u.value,
56
- "onUpdate:modelValue": a[0] || (a[0] = (o) => u.value = o),
57
- modelModifiers: { number: !0 }
58
- }, {
59
- default: r(() => [
60
- e(t(C), { class: "mr-2 w-[70px]" }, {
61
- default: r(() => [
62
- e(t(w), {
63
- placeholder: m.value.toString()
64
- }, null, 8, ["placeholder"])
65
- ]),
66
- _: 1
67
- }),
68
- e(t(N), { side: "top" }, {
69
- default: r(() => [
70
- (g(), c(I, null, P(x, (o) => e(t(U), {
71
- key: o,
72
- value: o.toString()
73
- }, {
74
- default: r(() => [
75
- y(n(o), 1)
76
- ]),
77
- _: 2
78
- }, 1032, ["value"])), 64))
79
- ]),
80
- _: 1
81
- })
82
- ]),
83
- _: 1
84
- }, 8, ["modelValue"]),
85
- v("p", F, "Page " + n(s) + " of " + n(S.value), 1),
86
- e(t(b)),
87
- e(t(j)),
88
- e(t(B), {
89
- modelValue: i.value,
90
- "onUpdate:modelValue": a[1] || (a[1] = (o) => i.value = o),
91
- class: "w-28",
92
- placeholder: "Page number"
93
- }, null, 8, ["modelValue"]),
94
- e(t(E)),
95
- e(t(q))
96
- ]),
97
- _: 2
98
- }, 1024)
99
- ]),
100
- _: 1
101
- }, 8, ["total", "itemsPerPage", "page"])
102
- ]));
103
- }
104
- });
105
- export {
106
- le as _
107
- };