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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +1,25 @@
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";
1
+ import { defineComponent as D, mergeModels as L, useModel as b, computed as S, watchEffect as U, openBlock as n, createElementBlock as s, Fragment as d, renderSlot as V, unref as o, createCommentVNode as y, createVNode as g, withCtx as a, renderList as f, createBlock as m, createElementVNode as F, createTextVNode as v, toDisplayString as w } from "vue";
2
+ import { _ as O } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
3
+ import { _ as T } from "./BuiCollapsibleTrigger.vue_vue_type_script_setup_true_lang-DJ8YMCCp.js";
4
+ import { _ as G } from "./BuiCollapsibleContent.vue_vue_type_script_setup_true_lang-eieHE5yV.js";
5
+ import { _ as j } from "./BuiPaginationCommon.vue_vue_type_script_setup_true_lang-DjLAqoa-.js";
6
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";
7
+ import { _ as z } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
8
+ import { useVueTable as H, getCoreRowModel as K, getPaginationRowModel as Y, getSortedRowModel as q, FlexRender as A } from "@tanstack/vue-table";
9
+ import { _ as J } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
10
+ import { _ as Q } 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 W } from "./BuiTableHead.vue_vue_type_script_setup_true_lang-CCXONmtG.js";
13
+ import { _ as X } from "./BuiTableHeader.vue_vue_type_script_setup_true_lang-DZOqi3dp.js";
14
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 = {
15
+ import { _ as Z } from "./BuiTableEmpty.vue_vue_type_script_setup_true_lang-BJDYHpRG.js";
16
+ import { _ as ee } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cfxlxsbh.js";
17
+ const te = {
18
18
  key: 0,
19
19
  class: "w-full py-4"
20
- }, te = { class: "inline-block rounded-t bg-background px-4 py-3" }, E = "#UNDEFINED#", be = /* @__PURE__ */ V({
20
+ }, oe = { class: "inline-block rounded-t bg-background px-4 py-3" }, N = "#UNDEFINED#", ye = /* @__PURE__ */ D({
21
21
  __name: "BuiDataTable",
22
- props: /* @__PURE__ */ D({
22
+ props: /* @__PURE__ */ L({
23
23
  columns: {},
24
24
  data: {},
25
25
  pageSize: { default: 10 },
@@ -37,13 +37,15 @@ const ee = {
37
37
  pagination: {},
38
38
  paginationModifiers: {},
39
39
  selection: {},
40
- selectionModifiers: {}
40
+ selectionModifiers: {},
41
+ columnVisibility: {},
42
+ columnVisibilityModifiers: {}
41
43
  }),
42
- emits: ["update:sorting", "update:pagination", "update:selection"],
44
+ emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
43
45
  setup(c) {
44
- const t = c, R = b(c, "sorting"), m = b(c, "pagination"), k = b(c, "selection"), I = S(
46
+ const t = c, R = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), E = b(c, "columnVisibility"), I = S(
45
47
  () => t.manualPagination ? t.totalItems : t.data.length
46
- ), u = j({
48
+ ), i = H({
47
49
  initialState: { pagination: { pageSize: t.pageSize } },
48
50
  get data() {
49
51
  return t.data;
@@ -51,14 +53,14 @@ const ee = {
51
53
  get columns() {
52
54
  return t.columns;
53
55
  },
54
- getCoreRowModel: H(),
55
- getPaginationRowModel: K(),
56
- getSortedRowModel: Y(),
56
+ getCoreRowModel: K(),
57
+ getPaginationRowModel: Y(),
58
+ getSortedRowModel: q(),
57
59
  onSortingChange: (e) => {
58
60
  C(e, R);
59
61
  },
60
62
  onPaginationChange: (e) => {
61
- C(e, m);
63
+ C(e, p);
62
64
  },
63
65
  onRowSelectionChange: (e) => {
64
66
  C(e, k);
@@ -72,56 +74,59 @@ const ee = {
72
74
  return R.value;
73
75
  },
74
76
  get pagination() {
75
- return m.value;
77
+ return p.value;
76
78
  },
77
79
  get rowSelection() {
78
80
  return k.value;
81
+ },
82
+ get columnVisibility() {
83
+ return E.value;
79
84
  }
80
85
  },
81
86
  getRowId: t.getRowId
82
87
  }), $ = S({
83
88
  get() {
84
- return u.getState().pagination.pageSize;
89
+ return i.getState().pagination.pageSize;
85
90
  },
86
91
  set(e) {
87
- m.value && (m.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
92
+ p.value && (p.value.pageSize = e, i.setPageSize(e), i.setPageIndex(0));
88
93
  }
89
94
  }), _ = S({
90
95
  get() {
91
- return u.getState().pagination.pageIndex + 1;
96
+ return i.getState().pagination.pageIndex + 1;
92
97
  },
93
98
  set(e) {
94
- m.value && (m.value.pageIndex = e - 1, u.setPageIndex(e - 1));
99
+ p.value && (p.value.pageIndex = e - 1, i.setPageIndex(e - 1));
95
100
  }
96
101
  });
97
- L(() => {
98
- const e = u.getPageCount();
102
+ U(() => {
103
+ const e = i.getPageCount();
99
104
  e && e < _.value && (_.value = e);
100
105
  });
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;
106
+ const M = S(() => t.groupBy ? i.getRowModel().rows.reduce((e, u) => {
107
+ const r = u.getValue(t.groupBy) ?? N;
108
+ return e[r] = e[r] || [], e[r].push(u), e;
104
109
  }, /* @__PURE__ */ Object.create(null)) : null);
105
110
  function h(e) {
106
111
  return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
107
112
  }
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
+ return (e, u) => (n(), s(d, null, [
114
+ e.$slots.caption ? (n(), s("div", te, [
115
+ V(e.$slots, "caption", { table: o(i) })
116
+ ])) : y("", !0),
117
+ g(o(J), null, {
113
118
  default: a(() => [
114
- g(o(W), null, {
119
+ g(o(X), null, {
115
120
  default: a(() => [
116
- (n(!0), i(d, null, f(o(u).getHeaderGroups(), (l) => (n(), p(o(P), {
121
+ (n(!0), s(d, null, f(o(i).getHeaderGroups(), (l) => (n(), m(o(P), {
117
122
  key: l.id
118
123
  }, {
119
124
  default: a(() => [
120
- (n(!0), i(d, null, f(l.headers, (r) => (n(), p(o(Q), {
125
+ (n(!0), s(d, null, f(l.headers, (r) => (n(), m(o(W), {
121
126
  key: r.id
122
127
  }, {
123
128
  default: a(() => [
124
- r.isPlaceholder ? v("", !0) : (n(), p(o(q), {
129
+ r.isPlaceholder ? y("", !0) : (n(), m(o(A), {
125
130
  key: 0,
126
131
  render: r.column.columnDef.header,
127
132
  props: r.getContext()
@@ -135,29 +140,29 @@ const ee = {
135
140
  ]),
136
141
  _: 1
137
142
  }),
138
- g(o(J), null, {
143
+ g(o(Q), null, {
139
144
  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), {
145
+ o(i).getRowModel().rows?.length ? (n(), s(d, { key: 0 }, [
146
+ t.groupBy && M.value ? (n(!0), s(d, { key: 0 }, f(M.value, (l, r) => (n(), m(o(O), {
142
147
  asChild: "",
143
148
  key: r,
144
149
  open: !0
145
150
  }, {
146
151
  default: a(() => [
147
- g(o(O), { asChild: "" }, {
152
+ g(o(T), { asChild: "" }, {
148
153
  default: a(() => [
149
154
  g(o(P), { class: "bg-foreground/[0.04]" }, {
150
155
  default: a(() => [
151
- g(o(N), {
156
+ g(o(x), {
152
157
  colspan: e.columns.length,
153
158
  class: "!pb-0"
154
159
  }, {
155
160
  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
+ F("div", oe, [
162
+ r === N ? (n(), s(d, { key: 0 }, [
163
+ v(w(h(1)), 1)
164
+ ], 64)) : (n(), s(d, { key: 1 }, [
165
+ v(w(h(0)) + ": " + w(r), 1)
161
166
  ], 64))
162
167
  ])
163
168
  ]),
@@ -169,9 +174,9 @@ const ee = {
169
174
  ]),
170
175
  _: 2
171
176
  }, 1024),
172
- g(o(T), { asChild: "" }, {
177
+ g(o(G), { asChild: "" }, {
173
178
  default: a(() => [
174
- (n(!0), i(d, null, f(l, (B) => (n(), p(x, {
179
+ (n(!0), s(d, null, f(l, (B) => (n(), m(z, {
175
180
  key: B.id,
176
181
  columns: t.columns,
177
182
  row: B,
@@ -182,19 +187,19 @@ const ee = {
182
187
  }, 1024)
183
188
  ]),
184
189
  _: 2
185
- }, 1024))), 128)) : (n(!0), i(d, { key: 1 }, f(o(u).getRowModel().rows, (l) => (n(), p(x, {
190
+ }, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(i).getRowModel().rows, (l) => (n(), m(z, {
186
191
  key: l.id,
187
192
  columns: t.columns,
188
193
  row: l,
189
194
  renderSubComponent: t.renderSubComponent
190
195
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
191
- ], 64)) : (n(), p(o(X), {
196
+ ], 64)) : (n(), m(o(Z), {
192
197
  key: 1,
193
198
  colspan: e.columns.length
194
199
  }, {
195
200
  default: a(() => [
196
- z(e.$slots, "nodata", {}, () => [
197
- s[2] || (s[2] = w("No data"))
201
+ V(e.$slots, "nodata", {}, () => [
202
+ u[2] || (u[2] = v("No data"))
198
203
  ])
199
204
  ]),
200
205
  _: 3
@@ -202,21 +207,21 @@ const ee = {
202
207
  ]),
203
208
  _: 3
204
209
  }),
205
- e.showPagination && I.value > 0 ? (n(), p(o(Z), { key: 0 }, {
210
+ e.showPagination && I.value > 0 ? (n(), m(o(ee), { key: 0 }, {
206
211
  default: a(() => [
207
212
  g(o(P), null, {
208
213
  default: a(() => [
209
- g(o(N), {
214
+ g(o(x), {
210
215
  colspan: e.columns.length
211
216
  }, {
212
217
  default: a(() => [
213
- g(o(G), {
218
+ g(o(j), {
214
219
  class: "float-right",
215
220
  total: I.value,
216
221
  pageIndex: _.value,
217
- "onUpdate:pageIndex": s[0] || (s[0] = (l) => _.value = l),
222
+ "onUpdate:pageIndex": u[0] || (u[0] = (l) => _.value = l),
218
223
  pageSize: $.value,
219
- "onUpdate:pageSize": s[1] || (s[1] = (l) => $.value = l)
224
+ "onUpdate:pageSize": u[1] || (u[1] = (l) => $.value = l)
220
225
  }, null, 8, ["total", "pageIndex", "pageSize"])
221
226
  ]),
222
227
  _: 1
@@ -226,7 +231,7 @@ const ee = {
226
231
  })
227
232
  ]),
228
233
  _: 1
229
- })) : v("", !0)
234
+ })) : y("", !0)
230
235
  ]),
231
236
  _: 3
232
237
  })
@@ -234,5 +239,5 @@ const ee = {
234
239
  }
235
240
  });
236
241
  export {
237
- be as _
242
+ ye as _
238
243
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-CLpLGgTZ.js";
1
+ import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-D2QvMzcY.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,17 +1,20 @@
1
- import { ColumnDef, PaginationState, Row, RowSelectionState, SortingState } from '@tanstack/vue-table';
1
+ import { ColumnDef, PaginationState, Row, RowSelectionState, SortingState, VisibilityState } from '@tanstack/vue-table';
2
2
  declare const _default: <TData, TValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
4
  readonly "onUpdate:sorting"?: ((sorting: SortingState) => any) | undefined;
5
5
  readonly "onUpdate:pagination"?: ((pagination: PaginationState) => any) | undefined;
6
6
  readonly "onUpdate:selection"?: ((selection: RowSelectionState) => any) | undefined;
7
+ readonly "onUpdate:columnVisibility"?: ((columnVisibility: VisibilityState) => any) | undefined;
7
8
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
8
9
  "onUpdate:sorting"?: ((sorting: SortingState) => any) | undefined;
9
10
  "onUpdate:pagination"?: ((pagination: PaginationState) => any) | undefined;
10
11
  "onUpdate:selection"?: ((selection: RowSelectionState) => any) | undefined;
11
- }>, never>, "onUpdate:sorting" | "onUpdate:pagination" | "onUpdate:selection"> & ({
12
+ "onUpdate:columnVisibility"?: ((columnVisibility: VisibilityState) => any) | undefined;
13
+ }>, never>, "onUpdate:sorting" | "onUpdate:pagination" | "onUpdate:selection" | "onUpdate:columnVisibility"> & ({
12
14
  sorting?: SortingState;
13
15
  pagination?: PaginationState;
14
16
  selection?: RowSelectionState;
17
+ columnVisibility?: VisibilityState;
15
18
  } & {
16
19
  columns: ColumnDef<TData, TValue>[];
17
20
  data: TData[];
@@ -37,6 +40,7 @@ declare const _default: <TData, TValue>(__VLS_props: NonNullable<Awaited<typeof
37
40
  'update:sorting': [sorting: SortingState];
38
41
  'update:pagination': [pagination: PaginationState];
39
42
  'update:selection': [selection: RowSelectionState];
43
+ 'update:columnVisibility': [columnVisibility: VisibilityState];
40
44
  };
41
45
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
42
46
  [key: string]: any;
@@ -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-CLpLGgTZ.js";
11
+ import { _ as R } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-D2QvMzcY.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-CLpLGgTZ.js";
119
+ import { _ as Qt } from "./BuiDataTable.vue_vue_type_script_setup_true_lang-D2QvMzcY.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.3",
3
+ "version": "1.3.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -53,7 +53,8 @@ const columns: ColumnDef<Task>[] = [
53
53
  {
54
54
  accessorKey: 'priority',
55
55
  header: ({ column }) => tableColumnSortCommon(column, 'Priorities')
56
- }
56
+ },
57
+ { id: 'hiddenColumn', header: 'Hidden Column', cell: 'secret info' }
57
58
  ]
58
59
  const data = ref<Task[]>(tasks)
59
60
 
@@ -137,6 +138,7 @@ function updateRows() {
137
138
  :groupBy="groupBy === 'none' ? undefined : groupBy"
138
139
  :groupLabels="groupLabels"
139
140
  :renderSubComponent="renderSubComponent"
141
+ :columnVisibility="{ hiddenColumn: false }"
140
142
  >
141
143
  <template #caption="{ table }">
142
144
  <div class="flex justify-between">
@@ -12,7 +12,8 @@ import type {
12
12
  PaginationState,
13
13
  Row,
14
14
  RowSelectionState,
15
- SortingState
15
+ SortingState,
16
+ VisibilityState
16
17
  } from '@tanstack/vue-table'
17
18
  import {
18
19
  FlexRender,
@@ -55,6 +56,7 @@ const props = withDefaults(
55
56
  const sorting = defineModel<SortingState>('sorting')
56
57
  const pagination = defineModel<PaginationState>('pagination')
57
58
  const rowSelection = defineModel<RowSelectionState>('selection')
59
+ const columnVisibility = defineModel<VisibilityState>('columnVisibility')
58
60
  const computedItems = computed(() =>
59
61
  props.manualPagination ? props.totalItems : props.data.length
60
62
  )
@@ -90,6 +92,9 @@ const table = useVueTable({
90
92
  },
91
93
  get rowSelection() {
92
94
  return rowSelection.value
95
+ },
96
+ get columnVisibility() {
97
+ return columnVisibility.value
93
98
  }
94
99
  },
95
100
  getRowId: props.getRowId