@soft-stech/bootsman-ui-shadcn 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,21 @@
1
- import { defineComponent as V, mergeModels as D, useModel as S, computed as _, openBlock as n, createBlock as s, unref as t, withCtx as a, renderSlot as E, createCommentVNode as b, createVNode as g, createElementBlock as d, Fragment as m, renderList as f, createElementVNode as L, createTextVNode as y, toDisplayString as w } from "vue";
2
- import { _ as U } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
3
- import { _ as F } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-DJ8YMCCp.js";
4
- import { _ as O } from "./BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-eieHE5yV.js";
5
- import { _ as T } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-6BhiWgI6.js";
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
6
  import { v as C } from "./utils-DPuEjrVV.js";
7
- import { _ as h } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
8
- import { useVueTable as G, getCoreRowModel as j, getPaginationRowModel as H, getSortedRowModel as K, FlexRender as Y } from "@tanstack/vue-table";
9
- import { _ as q } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
10
- import { _ as A } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
11
- import { _ as z } from "./BuiTableCell.vue_vue_type_script_setup_true_lang-BrTQJCiZ.js";
12
- import { _ as J } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-bRr43VQ9.js";
13
- import { _ as Q } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
14
- import { _ as v } from "./BuiTableRow.vue_vue_type_script_setup_true_lang-CpEilJsW.js";
15
- import { _ as W } from "./BuiTableCaption.vue_vue_type_script_setup_true_lang-053YvtXp.js";
16
- import { _ as X } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
17
- import { _ as Z } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
18
- const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UNDEFINED#", be = /* @__PURE__ */ V({
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
19
  __name: "BuiDataTable",
20
20
  props: /* @__PURE__ */ D({
21
21
  columns: {},
@@ -39,9 +39,9 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
39
39
  }),
40
40
  emits: ["update:sorting", "update:pagination", "update:selection"],
41
41
  setup(c) {
42
- const o = c, k = S(c, "sorting"), p = S(c, "pagination"), P = S(c, "selection"), N = _(
42
+ const o = c, R = b(c, "sorting"), p = b(c, "pagination"), $ = b(c, "selection"), E = S(
43
43
  () => o.manualPagination ? o.totalItems : o.data.length
44
- ), u = G({
44
+ ), l = j({
45
45
  initialState: { pagination: { pageSize: o.pageSize } },
46
46
  get data() {
47
47
  return o.data;
@@ -49,76 +49,82 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
49
49
  get columns() {
50
50
  return o.columns;
51
51
  },
52
- getCoreRowModel: j(),
53
- getPaginationRowModel: H(),
54
- getSortedRowModel: K(),
52
+ getCoreRowModel: H(),
53
+ getPaginationRowModel: K(),
54
+ getSortedRowModel: Y(),
55
55
  onSortingChange: (e) => {
56
- C(e, k);
56
+ C(e, R);
57
57
  },
58
58
  onPaginationChange: (e) => {
59
59
  C(e, p);
60
60
  },
61
61
  onRowSelectionChange: (e) => {
62
- C(e, P);
62
+ C(e, $);
63
63
  },
64
+ autoResetPageIndex: !1,
64
65
  manualPagination: o.manualPagination,
65
66
  // set to false to enable client-side pagination
66
67
  manualSorting: o.manualSorting,
67
68
  state: {
68
69
  get sorting() {
69
- return k.value;
70
+ return R.value;
70
71
  },
71
72
  get pagination() {
72
73
  return p.value;
73
74
  },
74
75
  get rowSelection() {
75
- return P.value;
76
+ return $.value;
76
77
  }
77
78
  },
78
79
  getRowId: o.getRowId
79
- }), R = _({
80
+ }), k = S({
80
81
  get() {
81
- return u.getState().pagination.pageSize;
82
+ return l.getState().pagination.pageSize;
82
83
  },
83
84
  set(e) {
84
- p.value && (p.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
85
+ p.value && (p.value.pageSize = e, l.setPageSize(e), l.setPageIndex(0));
85
86
  }
86
- }), $ = _({
87
+ }), _ = S({
87
88
  get() {
88
- return u.getState().pagination.pageIndex + 1;
89
+ return l.getState().pagination.pageIndex + 1;
89
90
  },
90
91
  set(e) {
91
- p.value && (p.value.pageIndex = e - 1, u.setPageIndex(e - 1));
92
+ p.value && (p.value.pageIndex = e - 1, l.setPageIndex(e - 1));
92
93
  }
93
- }), I = _(() => o.groupBy ? u.getRowModel().rows.reduce((e, i) => {
94
- const l = i.getValue(o.groupBy) ?? x;
95
- return e[l] = e[l] || [], e[l].push(i), e;
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;
96
102
  }, /* @__PURE__ */ Object.create(null)) : null);
97
103
  function M(e) {
98
104
  return (o.groupBy && o.groupLabels ? o.groupLabels[o.groupBy] || [] : [])[e];
99
105
  }
100
- return (e, i) => (n(), s(t(q), null, {
106
+ return (e, s) => (n(), i(t(A), null, {
101
107
  default: a(() => [
102
- e.$slots.caption ? (n(), s(t(W), { key: 0 }, {
108
+ e.$slots.caption ? (n(), i(t(X), { key: 0 }, {
103
109
  default: a(() => [
104
- E(e.$slots, "caption", { table: t(u) })
110
+ h(e.$slots, "caption", { table: t(l) })
105
111
  ]),
106
112
  _: 3
107
- })) : b("", !0),
108
- g(t(Q), null, {
113
+ })) : w("", !0),
114
+ g(t(W), null, {
109
115
  default: a(() => [
110
- (n(!0), d(m, null, f(t(u).getHeaderGroups(), (r) => (n(), s(t(v), {
116
+ (n(!0), d(m, null, f(t(l).getHeaderGroups(), (r) => (n(), i(t(P), {
111
117
  key: r.id
112
118
  }, {
113
119
  default: a(() => [
114
- (n(!0), d(m, null, f(r.headers, (l) => (n(), s(t(J), {
115
- key: l.id
120
+ (n(!0), d(m, null, f(r.headers, (u) => (n(), i(t(Q), {
121
+ key: u.id
116
122
  }, {
117
123
  default: a(() => [
118
- l.isPlaceholder ? b("", !0) : (n(), s(t(Y), {
124
+ u.isPlaceholder ? w("", !0) : (n(), i(t(q), {
119
125
  key: 0,
120
- render: l.column.columnDef.header,
121
- props: l.getContext()
126
+ render: u.column.columnDef.header,
127
+ props: u.getContext()
122
128
  }, null, 8, ["render", "props"]))
123
129
  ]),
124
130
  _: 2
@@ -129,29 +135,29 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
129
135
  ]),
130
136
  _: 1
131
137
  }),
132
- g(t(A), null, {
138
+ g(t(J), null, {
133
139
  default: a(() => [
134
- t(u).getRowModel().rows?.length ? (n(), d(m, { key: 0 }, [
135
- o.groupBy && I.value ? (n(!0), d(m, { key: 0 }, f(I.value, (r, l) => (n(), s(t(U), {
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), {
136
142
  asChild: "",
137
- key: l,
143
+ key: u,
138
144
  open: !0
139
145
  }, {
140
146
  default: a(() => [
141
- g(t(F), { asChild: "" }, {
147
+ g(t(O), { asChild: "" }, {
142
148
  default: a(() => [
143
- g(t(v), { class: "bg-foreground/[0.04]" }, {
149
+ g(t(P), { class: "bg-foreground/[0.04]" }, {
144
150
  default: a(() => [
145
- g(t(z), {
151
+ g(t(x), {
146
152
  colspan: e.columns.length,
147
153
  class: "!pb-0"
148
154
  }, {
149
155
  default: a(() => [
150
- L("div", ee, [
151
- l === x ? (n(), d(m, { key: 0 }, [
152
- y(w(M(1)), 1)
156
+ U("div", te, [
157
+ u === N ? (n(), d(m, { key: 0 }, [
158
+ y(v(M(1)), 1)
153
159
  ], 64)) : (n(), d(m, { key: 1 }, [
154
- y(w(M(0)) + ": " + w(l), 1)
160
+ y(v(M(0)) + ": " + v(u), 1)
155
161
  ], 64))
156
162
  ])
157
163
  ]),
@@ -163,9 +169,9 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
163
169
  ]),
164
170
  _: 2
165
171
  }, 1024),
166
- g(t(O), { asChild: "" }, {
172
+ g(t(T), { asChild: "" }, {
167
173
  default: a(() => [
168
- (n(!0), d(m, null, f(r, (B) => (n(), s(h, {
174
+ (n(!0), d(m, null, f(r, (B) => (n(), i(z, {
169
175
  key: B.id,
170
176
  columns: o.columns,
171
177
  row: B,
@@ -176,39 +182,41 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
176
182
  }, 1024)
177
183
  ]),
178
184
  _: 2
179
- }, 1024))), 128)) : (n(!0), d(m, { key: 1 }, f(t(u).getRowModel().rows, (r) => (n(), s(h, {
185
+ }, 1024))), 128)) : (n(!0), d(m, { key: 1 }, f(t(l).getRowModel().rows, (r) => (n(), i(z, {
180
186
  key: r.id,
181
187
  columns: o.columns,
182
188
  row: r,
183
189
  renderSubComponent: o.renderSubComponent
184
190
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
185
- ], 64)) : (n(), s(t(X), {
191
+ ], 64)) : (n(), i(t(Z), {
186
192
  key: 1,
187
193
  colspan: e.columns.length
188
194
  }, {
189
- default: a(() => i[2] || (i[2] = [
190
- y("No data")
191
- ])),
192
- _: 1
195
+ default: a(() => [
196
+ h(e.$slots, "nodata", {}, () => [
197
+ s[2] || (s[2] = y("No data"))
198
+ ])
199
+ ]),
200
+ _: 3
193
201
  }, 8, ["colspan"]))
194
202
  ]),
195
- _: 1
203
+ _: 3
196
204
  }),
197
- e.showPagination && t(u).getPageCount() > 1 ? (n(), s(t(Z), { key: 1 }, {
205
+ e.showPagination && t(l).getPageCount() > 1 ? (n(), i(t(ee), { key: 1 }, {
198
206
  default: a(() => [
199
- g(t(v), null, {
207
+ g(t(P), null, {
200
208
  default: a(() => [
201
- g(t(z), {
209
+ g(t(x), {
202
210
  colspan: e.columns.length
203
211
  }, {
204
212
  default: a(() => [
205
- g(t(T), {
213
+ g(t(G), {
206
214
  class: "float-right",
207
- total: N.value,
208
- pageIndex: $.value,
209
- "onUpdate:pageIndex": i[0] || (i[0] = (r) => $.value = r),
210
- pageSize: R.value,
211
- "onUpdate:pageSize": i[1] || (i[1] = (r) => R.value = r)
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)
212
220
  }, null, 8, ["total", "pageIndex", "pageSize"])
213
221
  ]),
214
222
  _: 1
@@ -218,12 +226,12 @@ const ee = { class: "inline-block rounded-t bg-background px-4 py-3" }, x = "#UN
218
226
  })
219
227
  ]),
220
228
  _: 1
221
- })) : b("", !0)
229
+ })) : w("", !0)
222
230
  ]),
223
231
  _: 3
224
232
  }));
225
233
  }
226
234
  });
227
235
  export {
228
- be as _
236
+ we as _
229
237
  };