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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,10 @@
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";
1
+ import { defineComponent as L, mergeModels as U, useModel as b, computed as y, watchEffect as F, openBlock as n, createElementBlock as u, Fragment as d, renderSlot as w, unref as o, createCommentVNode as S, createVNode as g, withCtx as a, renderList as f, createBlock as m, createElementVNode as z, createTextVNode as v, toDisplayString as C } from "vue";
2
2
  import { _ as O } from "./BuiCollapsible.vue_vue_type_script_setup_true_lang-BfgRYJts.js";
3
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
- import { v as C } from "./utils-DPuEjrVV.js";
7
- import { _ as z } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
4
+ import { _ as j } 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 R } from "./utils-DPuEjrVV.js";
7
+ import { _ as N } from "./BuiTableRowSubrow.vue_vue_type_script_setup_true_lang-Ch5gemw2.js";
8
8
  import { useVueTable as H, getCoreRowModel as K, getPaginationRowModel as Y, getSortedRowModel as q, FlexRender as A } from "@tanstack/vue-table";
9
9
  import { _ as J } from "./BuiTable.vue_vue_type_script_setup_true_lang-CUPSwE5z.js";
10
10
  import { _ as Q } from "./BuiTableBody.vue_vue_type_script_setup_true_lang-CWT4u-Ma.js";
@@ -17,9 +17,12 @@ import { _ as ee } from "./BuiTableFooter.vue_vue_type_script_setup_true_lang-Cf
17
17
  const te = {
18
18
  key: 0,
19
19
  class: "w-full py-4"
20
- }, oe = { class: "inline-block rounded-t bg-background px-4 py-3" }, N = "#UNDEFINED#", ye = /* @__PURE__ */ D({
20
+ }, oe = { class: "flex w-full items-center justify-between" }, ne = { class: "inline-block rounded-t bg-background px-4 py-3" }, ae = {
21
+ key: 0,
22
+ class: ""
23
+ }, E = "#UNDEFINED#", ve = /* @__PURE__ */ L({
21
24
  __name: "BuiDataTable",
22
- props: /* @__PURE__ */ L({
25
+ props: /* @__PURE__ */ U({
23
26
  columns: {},
24
27
  data: {},
25
28
  pageSize: { default: 10 },
@@ -43,7 +46,7 @@ const te = {
43
46
  }),
44
47
  emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
45
48
  setup(c) {
46
- const t = c, R = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), E = b(c, "columnVisibility"), I = S(
49
+ const t = c, $ = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), D = b(c, "columnVisibility"), I = y(
47
50
  () => t.manualPagination ? t.totalItems : t.data.length
48
51
  ), i = H({
49
52
  initialState: { pagination: { pageSize: t.pageSize } },
@@ -57,13 +60,13 @@ const te = {
57
60
  getPaginationRowModel: Y(),
58
61
  getSortedRowModel: q(),
59
62
  onSortingChange: (e) => {
60
- C(e, R);
63
+ R(e, $);
61
64
  },
62
65
  onPaginationChange: (e) => {
63
- C(e, p);
66
+ R(e, p);
64
67
  },
65
68
  onRowSelectionChange: (e) => {
66
- C(e, k);
69
+ R(e, k);
67
70
  },
68
71
  autoResetPageIndex: !1,
69
72
  manualPagination: t.manualPagination,
@@ -71,7 +74,7 @@ const te = {
71
74
  manualSorting: t.manualSorting,
72
75
  state: {
73
76
  get sorting() {
74
- return R.value;
77
+ return $.value;
75
78
  },
76
79
  get pagination() {
77
80
  return p.value;
@@ -80,18 +83,18 @@ const te = {
80
83
  return k.value;
81
84
  },
82
85
  get columnVisibility() {
83
- return E.value;
86
+ return D.value;
84
87
  }
85
88
  },
86
89
  getRowId: t.getRowId
87
- }), $ = S({
90
+ }), h = y({
88
91
  get() {
89
92
  return i.getState().pagination.pageSize;
90
93
  },
91
94
  set(e) {
92
95
  p.value && (p.value.pageSize = e, i.setPageSize(e), i.setPageIndex(0));
93
96
  }
94
- }), _ = S({
97
+ }), _ = y({
95
98
  get() {
96
99
  return i.getState().pagination.pageIndex + 1;
97
100
  },
@@ -99,37 +102,37 @@ const te = {
99
102
  p.value && (p.value.pageIndex = e - 1, i.setPageIndex(e - 1));
100
103
  }
101
104
  });
102
- U(() => {
105
+ F(() => {
103
106
  const e = i.getPageCount();
104
107
  e && e < _.value && (_.value = e);
105
108
  });
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;
109
+ const B = y(() => t.groupBy ? i.getRowModel().rows.reduce((e, s) => {
110
+ const l = s.getValue(t.groupBy) ?? E;
111
+ return e[l] = e[l] || [], e[l].push(s), e;
109
112
  }, /* @__PURE__ */ Object.create(null)) : null);
110
- function h(e) {
113
+ function M(e) {
111
114
  return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
112
115
  }
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),
116
+ return (e, s) => (n(), u(d, null, [
117
+ e.$slots.caption ? (n(), u("div", te, [
118
+ w(e.$slots, "caption", { table: o(i) })
119
+ ])) : S("", !0),
117
120
  g(o(J), null, {
118
121
  default: a(() => [
119
122
  g(o(X), null, {
120
123
  default: a(() => [
121
- (n(!0), s(d, null, f(o(i).getHeaderGroups(), (l) => (n(), m(o(P), {
122
- key: l.id
124
+ (n(!0), u(d, null, f(o(i).getHeaderGroups(), (r) => (n(), m(o(P), {
125
+ key: r.id
123
126
  }, {
124
127
  default: a(() => [
125
- (n(!0), s(d, null, f(l.headers, (r) => (n(), m(o(W), {
126
- key: r.id
128
+ (n(!0), u(d, null, f(r.headers, (l) => (n(), m(o(W), {
129
+ key: l.id
127
130
  }, {
128
131
  default: a(() => [
129
- r.isPlaceholder ? y("", !0) : (n(), m(o(A), {
132
+ l.isPlaceholder ? S("", !0) : (n(), m(o(A), {
130
133
  key: 0,
131
- render: r.column.columnDef.header,
132
- props: r.getContext()
134
+ render: l.column.columnDef.header,
135
+ props: l.getContext()
133
136
  }, null, 8, ["render", "props"]))
134
137
  ]),
135
138
  _: 2
@@ -142,10 +145,10 @@ const te = {
142
145
  }),
143
146
  g(o(Q), null, {
144
147
  default: a(() => [
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), {
148
+ o(i).getRowModel().rows?.length ? (n(), u(d, { key: 0 }, [
149
+ t.groupBy && B.value ? (n(!0), u(d, { key: 0 }, f(B.value, (r, l) => (n(), m(o(O), {
147
150
  asChild: "",
148
- key: r,
151
+ key: l,
149
152
  open: !0
150
153
  }, {
151
154
  default: a(() => [
@@ -158,12 +161,17 @@ const te = {
158
161
  class: "!pb-0"
159
162
  }, {
160
163
  default: a(() => [
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)
166
- ], 64))
164
+ z("div", oe, [
165
+ z("div", ne, [
166
+ l === E ? (n(), u(d, { key: 0 }, [
167
+ v(C(M(1)), 1)
168
+ ], 64)) : (n(), u(d, { key: 1 }, [
169
+ v(C(M(0)) + ": " + C(l), 1)
170
+ ], 64))
171
+ ]),
172
+ e.$slots.groupByRow ? (n(), u("div", ae, [
173
+ w(e.$slots, "groupByRow", { group: l })
174
+ ])) : S("", !0)
167
175
  ])
168
176
  ]),
169
177
  _: 2
@@ -174,12 +182,12 @@ const te = {
174
182
  ]),
175
183
  _: 2
176
184
  }, 1024),
177
- g(o(G), { asChild: "" }, {
185
+ g(o(j), { asChild: "" }, {
178
186
  default: a(() => [
179
- (n(!0), s(d, null, f(l, (B) => (n(), m(z, {
180
- key: B.id,
187
+ (n(!0), u(d, null, f(r, (V) => (n(), m(N, {
188
+ key: V.id,
181
189
  columns: t.columns,
182
- row: B,
190
+ row: V,
183
191
  renderSubComponent: t.renderSubComponent
184
192
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
185
193
  ]),
@@ -187,10 +195,10 @@ const te = {
187
195
  }, 1024)
188
196
  ]),
189
197
  _: 2
190
- }, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(i).getRowModel().rows, (l) => (n(), m(z, {
191
- key: l.id,
198
+ }, 1024))), 128)) : (n(!0), u(d, { key: 1 }, f(o(i).getRowModel().rows, (r) => (n(), m(N, {
199
+ key: r.id,
192
200
  columns: t.columns,
193
- row: l,
201
+ row: r,
194
202
  renderSubComponent: t.renderSubComponent
195
203
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
196
204
  ], 64)) : (n(), m(o(Z), {
@@ -198,8 +206,8 @@ const te = {
198
206
  colspan: e.columns.length
199
207
  }, {
200
208
  default: a(() => [
201
- V(e.$slots, "nodata", {}, () => [
202
- u[2] || (u[2] = v("No data"))
209
+ w(e.$slots, "nodata", {}, () => [
210
+ s[2] || (s[2] = v("No data"))
203
211
  ])
204
212
  ]),
205
213
  _: 3
@@ -215,13 +223,13 @@ const te = {
215
223
  colspan: e.columns.length
216
224
  }, {
217
225
  default: a(() => [
218
- g(o(j), {
226
+ g(o(G), {
219
227
  class: "float-right",
220
228
  total: I.value,
221
229
  pageIndex: _.value,
222
- "onUpdate:pageIndex": u[0] || (u[0] = (l) => _.value = l),
223
- pageSize: $.value,
224
- "onUpdate:pageSize": u[1] || (u[1] = (l) => $.value = l)
230
+ "onUpdate:pageIndex": s[0] || (s[0] = (r) => _.value = r),
231
+ pageSize: h.value,
232
+ "onUpdate:pageSize": s[1] || (s[1] = (r) => h.value = r)
225
233
  }, null, 8, ["total", "pageIndex", "pageSize"])
226
234
  ]),
227
235
  _: 1
@@ -231,7 +239,7 @@ const te = {
231
239
  })
232
240
  ]),
233
241
  _: 1
234
- })) : y("", !0)
242
+ })) : S("", !0)
235
243
  ]),
236
244
  _: 3
237
245
  })
@@ -239,5 +247,5 @@ const te = {
239
247
  }
240
248
  });
241
249
  export {
242
- ye as _
250
+ ve as _
243
251
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-D2QvMzcY.js";
1
+ import { _ as f } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-B38w7sKR.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -34,6 +34,9 @@ declare const _default: <TData, TValue>(__VLS_props: NonNullable<Awaited<typeof
34
34
  caption?(_: {
35
35
  table: import('@tanstack/vue-table').Table<TData>;
36
36
  }): any;
37
+ groupByRow?(_: {
38
+ group: string | number;
39
+ }): any;
37
40
  nodata?(_: {}): any;
38
41
  };
39
42
  emit: {
@@ -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-D2QvMzcY.js";
11
+ import { _ as R } from "../../../BuiDataTable.vue_vue_type_script_setup_true_lang-B38w7sKR.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-D2QvMzcY.js";
119
+ import { _ as Qt } from "./BuiDataTable.vue_vue_type_script_setup_true_lang-B38w7sKR.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.4",
3
+ "version": "1.3.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -164,6 +164,7 @@ function updateRows() {
164
164
  </div>
165
165
  </template>
166
166
  <template #nodata>Нет данных</template>
167
+ <template #groupByRow="{ group }"> Optional slot for: `{{ group }}` </template>
167
168
  </BuiDataTable>
168
169
  </Variant>
169
170
  </Story>
@@ -170,11 +170,16 @@ function getGroupLabel(index: number) {
170
170
  <BuiCollapsibleTrigger asChild>
171
171
  <BuiTableRow class="bg-foreground/[0.04]">
172
172
  <BuiTableCell :colspan="columns.length" class="!pb-0">
173
- <div class="inline-block rounded-t bg-background px-4 py-3">
174
- <template v-if="key === NO_GROUP_KEY">
175
- {{ getGroupLabel(1) }}
176
- </template>
177
- <template v-else> {{ getGroupLabel(0) }}: {{ key }} </template>
173
+ <div class="flex w-full items-center justify-between">
174
+ <div class="inline-block rounded-t bg-background px-4 py-3">
175
+ <template v-if="key === NO_GROUP_KEY">
176
+ {{ getGroupLabel(1) }}
177
+ </template>
178
+ <template v-else> {{ getGroupLabel(0) }}: {{ key }} </template>
179
+ </div>
180
+ <div v-if="$slots.groupByRow" class="">
181
+ <slot name="groupByRow" :group="key" />
182
+ </div>
178
183
  </div>
179
184
  </BuiTableCell>
180
185
  </BuiTableRow>