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

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 s, 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,9 @@ 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" }, E = "#UNDEFINED#", we = /* @__PURE__ */ L({
21
21
  __name: "BuiDataTable",
22
- props: /* @__PURE__ */ L({
22
+ props: /* @__PURE__ */ U({
23
23
  columns: {},
24
24
  data: {},
25
25
  pageSize: { default: 10 },
@@ -43,9 +43,9 @@ const te = {
43
43
  }),
44
44
  emits: ["update:sorting", "update:pagination", "update:selection", "update:columnVisibility"],
45
45
  setup(c) {
46
- const t = c, R = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), E = b(c, "columnVisibility"), I = S(
46
+ const t = c, $ = b(c, "sorting"), p = b(c, "pagination"), k = b(c, "selection"), D = b(c, "columnVisibility"), I = y(
47
47
  () => t.manualPagination ? t.totalItems : t.data.length
48
- ), i = H({
48
+ ), u = H({
49
49
  initialState: { pagination: { pageSize: t.pageSize } },
50
50
  get data() {
51
51
  return t.data;
@@ -57,13 +57,13 @@ const te = {
57
57
  getPaginationRowModel: Y(),
58
58
  getSortedRowModel: q(),
59
59
  onSortingChange: (e) => {
60
- C(e, R);
60
+ R(e, $);
61
61
  },
62
62
  onPaginationChange: (e) => {
63
- C(e, p);
63
+ R(e, p);
64
64
  },
65
65
  onRowSelectionChange: (e) => {
66
- C(e, k);
66
+ R(e, k);
67
67
  },
68
68
  autoResetPageIndex: !1,
69
69
  manualPagination: t.manualPagination,
@@ -71,7 +71,7 @@ const te = {
71
71
  manualSorting: t.manualSorting,
72
72
  state: {
73
73
  get sorting() {
74
- return R.value;
74
+ return $.value;
75
75
  },
76
76
  get pagination() {
77
77
  return p.value;
@@ -80,56 +80,56 @@ const te = {
80
80
  return k.value;
81
81
  },
82
82
  get columnVisibility() {
83
- return E.value;
83
+ return D.value;
84
84
  }
85
85
  },
86
86
  getRowId: t.getRowId
87
- }), $ = S({
87
+ }), B = y({
88
88
  get() {
89
- return i.getState().pagination.pageSize;
89
+ return u.getState().pagination.pageSize;
90
90
  },
91
91
  set(e) {
92
- p.value && (p.value.pageSize = e, i.setPageSize(e), i.setPageIndex(0));
92
+ p.value && (p.value.pageSize = e, u.setPageSize(e), u.setPageIndex(0));
93
93
  }
94
- }), _ = S({
94
+ }), _ = y({
95
95
  get() {
96
- return i.getState().pagination.pageIndex + 1;
96
+ return u.getState().pagination.pageIndex + 1;
97
97
  },
98
98
  set(e) {
99
- p.value && (p.value.pageIndex = e - 1, i.setPageIndex(e - 1));
99
+ p.value && (p.value.pageIndex = e - 1, u.setPageIndex(e - 1));
100
100
  }
101
101
  });
102
- U(() => {
103
- const e = i.getPageCount();
102
+ F(() => {
103
+ const e = u.getPageCount();
104
104
  e && e < _.value && (_.value = e);
105
105
  });
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;
106
+ const M = y(() => t.groupBy ? u.getRowModel().rows.reduce((e, i) => {
107
+ const l = i.getValue(t.groupBy) ?? E;
108
+ return e[l] = e[l] || [], e[l].push(i), e;
109
109
  }, /* @__PURE__ */ Object.create(null)) : null);
110
110
  function h(e) {
111
111
  return (t.groupBy && t.groupLabels ? t.groupLabels[t.groupBy] || [] : [])[e];
112
112
  }
113
- return (e, u) => (n(), s(d, null, [
113
+ return (e, i) => (n(), s(d, null, [
114
114
  e.$slots.caption ? (n(), s("div", te, [
115
- V(e.$slots, "caption", { table: o(i) })
116
- ])) : y("", !0),
115
+ w(e.$slots, "caption", { table: o(u) })
116
+ ])) : S("", !0),
117
117
  g(o(J), null, {
118
118
  default: a(() => [
119
119
  g(o(X), null, {
120
120
  default: a(() => [
121
- (n(!0), s(d, null, f(o(i).getHeaderGroups(), (l) => (n(), m(o(P), {
122
- key: l.id
121
+ (n(!0), s(d, null, f(o(u).getHeaderGroups(), (r) => (n(), m(o(P), {
122
+ key: r.id
123
123
  }, {
124
124
  default: a(() => [
125
- (n(!0), s(d, null, f(l.headers, (r) => (n(), m(o(W), {
126
- key: r.id
125
+ (n(!0), s(d, null, f(r.headers, (l) => (n(), m(o(W), {
126
+ key: l.id
127
127
  }, {
128
128
  default: a(() => [
129
- r.isPlaceholder ? y("", !0) : (n(), m(o(A), {
129
+ l.isPlaceholder ? S("", !0) : (n(), m(o(A), {
130
130
  key: 0,
131
- render: r.column.columnDef.header,
132
- props: r.getContext()
131
+ render: l.column.columnDef.header,
132
+ props: l.getContext()
133
133
  }, null, 8, ["render", "props"]))
134
134
  ]),
135
135
  _: 2
@@ -142,10 +142,10 @@ const te = {
142
142
  }),
143
143
  g(o(Q), null, {
144
144
  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), {
145
+ o(u).getRowModel().rows?.length ? (n(), s(d, { key: 0 }, [
146
+ t.groupBy && M.value ? (n(!0), s(d, { key: 0 }, f(M.value, (r, l) => (n(), m(o(O), {
147
147
  asChild: "",
148
- key: r,
148
+ key: l,
149
149
  open: !0
150
150
  }, {
151
151
  default: a(() => [
@@ -158,12 +158,18 @@ const te = {
158
158
  class: "!pb-0"
159
159
  }, {
160
160
  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))
161
+ z("div", oe, [
162
+ z("div", ne, [
163
+ l === E ? (n(), s(d, { key: 0 }, [
164
+ v(C(h(1)), 1)
165
+ ], 64)) : (n(), s(d, { key: 1 }, [
166
+ v(C(h(0)) + ": " + C(l), 1)
167
+ ], 64))
168
+ ]),
169
+ e.$slots.groupByRow ? w(e.$slots, "groupByRow", {
170
+ key: 0,
171
+ group: l
172
+ }) : S("", !0)
167
173
  ])
168
174
  ]),
169
175
  _: 2
@@ -174,12 +180,12 @@ const te = {
174
180
  ]),
175
181
  _: 2
176
182
  }, 1024),
177
- g(o(G), { asChild: "" }, {
183
+ g(o(j), { asChild: "" }, {
178
184
  default: a(() => [
179
- (n(!0), s(d, null, f(l, (B) => (n(), m(z, {
180
- key: B.id,
185
+ (n(!0), s(d, null, f(r, (V) => (n(), m(N, {
186
+ key: V.id,
181
187
  columns: t.columns,
182
- row: B,
188
+ row: V,
183
189
  renderSubComponent: t.renderSubComponent
184
190
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
185
191
  ]),
@@ -187,10 +193,10 @@ const te = {
187
193
  }, 1024)
188
194
  ]),
189
195
  _: 2
190
- }, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(i).getRowModel().rows, (l) => (n(), m(z, {
191
- key: l.id,
196
+ }, 1024))), 128)) : (n(!0), s(d, { key: 1 }, f(o(u).getRowModel().rows, (r) => (n(), m(N, {
197
+ key: r.id,
192
198
  columns: t.columns,
193
- row: l,
199
+ row: r,
194
200
  renderSubComponent: t.renderSubComponent
195
201
  }, null, 8, ["columns", "row", "renderSubComponent"]))), 128))
196
202
  ], 64)) : (n(), m(o(Z), {
@@ -198,8 +204,8 @@ const te = {
198
204
  colspan: e.columns.length
199
205
  }, {
200
206
  default: a(() => [
201
- V(e.$slots, "nodata", {}, () => [
202
- u[2] || (u[2] = v("No data"))
207
+ w(e.$slots, "nodata", {}, () => [
208
+ i[2] || (i[2] = v("No data"))
203
209
  ])
204
210
  ]),
205
211
  _: 3
@@ -215,13 +221,13 @@ const te = {
215
221
  colspan: e.columns.length
216
222
  }, {
217
223
  default: a(() => [
218
- g(o(j), {
224
+ g(o(G), {
219
225
  class: "float-right",
220
226
  total: I.value,
221
227
  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)
228
+ "onUpdate:pageIndex": i[0] || (i[0] = (r) => _.value = r),
229
+ pageSize: B.value,
230
+ "onUpdate:pageSize": i[1] || (i[1] = (r) => B.value = r)
225
231
  }, null, 8, ["total", "pageIndex", "pageSize"])
226
232
  ]),
227
233
  _: 1
@@ -231,7 +237,7 @@ const te = {
231
237
  })
232
238
  ]),
233
239
  _: 1
234
- })) : y("", !0)
240
+ })) : S("", !0)
235
241
  ]),
236
242
  _: 3
237
243
  })
@@ -239,5 +245,5 @@ const te = {
239
245
  }
240
246
  });
241
247
  export {
242
- ye as _
248
+ we as _
243
249
  };
@@ -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-CUH3nl15.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-CUH3nl15.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-CUH3nl15.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.6",
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,14 @@ 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
+ <slot v-if="$slots.groupByRow" name="groupByRow" :group="key" />
178
181
  </div>
179
182
  </BuiTableCell>
180
183
  </BuiTableRow>