@dazzadev/vuetify-datatable 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -88,6 +88,10 @@ this shows while every column fits.
88
88
  hidden, and stays visible in that case even if the rest fits. `actions`, expand and select
89
89
  columns are never listed.
90
90
 
91
+ Two header options shape the chooser: `hidden: true` starts a column hidden until the user shows
92
+ it (and "Reset" hides it again), and `locked: true` keeps a column always visible (it can still be
93
+ moved). The `column-chooser` slot receives `locked` on each column.
94
+
91
95
  The choices are saved in `localStorage`, keyed by the set of header keys. Texts and the storage
92
96
  key can be set in the global config:
93
97
 
package/dist/types.d.ts CHANGED
@@ -5,6 +5,10 @@ export interface TableHeader {
5
5
  align?: string;
6
6
  sortable?: boolean;
7
7
  fixed?: boolean;
8
+ /** Starts hidden in the column chooser until the user shows it. */
9
+ hidden?: boolean;
10
+ /** Always visible: the column chooser can move it but not hide it. */
11
+ locked?: boolean;
8
12
  }
9
13
  export interface SortItem {
10
14
  key: string;
@@ -34,6 +38,7 @@ export interface DataTableColumn {
34
38
  key: string;
35
39
  title: string;
36
40
  visible: boolean;
41
+ locked: boolean;
37
42
  }
38
43
  export interface DataTableConfig {
39
44
  icons?: DataTableIconConfig;
@@ -1,12 +1,12 @@
1
- import { defineComponent as Pe, computed as c, resolveComponent as f, openBlock as m, createBlock as k, withCtx as a, createVNode as r, createTextVNode as V, toDisplayString as g, renderSlot as C, createCommentVNode as N, inject as ot, ref as v, watch as z, nextTick as lt, onMounted as nt, onBeforeUnmount as at, createElementBlock as G, normalizeStyle as st, normalizeClass as $e, withDirectives as rt, createElementVNode as P, Fragment as it, renderList as Ie, withModifiers as le, withKeys as Le, mergeProps as H, vShow as dt, createSlots as ut, resolveDynamicComponent as he } from "vue";
2
- function ct(o) {
3
- return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
1
+ import { defineComponent as Ee, computed as c, resolveComponent as f, openBlock as m, createBlock as C, withCtx as n, createVNode as r, createTextVNode as V, toDisplayString as g, renderSlot as k, createCommentVNode as K, inject as at, ref as v, watch as N, nextTick as nt, onMounted as st, onBeforeUnmount as rt, createElementBlock as Y, normalizeStyle as it, normalizeClass as Le, withDirectives as dt, createElementVNode as P, Fragment as ut, renderList as Me, withModifiers as ae, withKeys as Pe, mergeProps as H, vShow as ct, createSlots as vt, resolveDynamicComponent as we } from "vue";
2
+ function mt(l) {
3
+ return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
4
4
  }
5
- var ne = { exports: {} }, Me;
6
- function vt() {
7
- if (Me) return ne.exports;
8
- Me = 1;
9
- function o(_, $ = 100, I = {}) {
5
+ var ne = { exports: {} }, He;
6
+ function ft() {
7
+ if (He) return ne.exports;
8
+ He = 1;
9
+ function l(_, $ = 100, I = {}) {
10
10
  if (typeof _ != "function")
11
11
  throw new TypeError(`Expected the first parameter to be a function, got \`${typeof _}\`.`);
12
12
  if ($ < 0)
@@ -40,10 +40,10 @@ function vt() {
40
40
  h = M(), p.clear();
41
41
  }, p;
42
42
  }
43
- return ne.exports.debounce = o, ne.exports = o, ne.exports;
43
+ return ne.exports.debounce = l, ne.exports = l, ne.exports;
44
44
  }
45
- var mt = /* @__PURE__ */ vt();
46
- const ft = /* @__PURE__ */ ct(mt), pt = /* @__PURE__ */ Pe({
45
+ var pt = /* @__PURE__ */ ft();
46
+ const gt = /* @__PURE__ */ mt(pt), bt = /* @__PURE__ */ Ee({
47
47
  __name: "ConfirmationModal",
48
48
  props: {
49
49
  show: Boolean,
@@ -53,42 +53,42 @@ const ft = /* @__PURE__ */ ct(mt), pt = /* @__PURE__ */ Pe({
53
53
  cancelButtonText: String
54
54
  },
55
55
  emits: ["close", "confirm"],
56
- setup(o) {
57
- const _ = o, $ = c({
56
+ setup(l) {
57
+ const _ = l, $ = c({
58
58
  get: () => _.show,
59
59
  set: () => {
60
60
  }
61
61
  });
62
62
  return (I, b) => {
63
63
  const d = f("v-card-title"), y = f("v-card-text"), i = f("v-spacer"), L = f("v-btn"), h = f("v-card-actions"), M = f("v-card"), E = f("v-dialog");
64
- return m(), k(E, {
64
+ return m(), C(E, {
65
65
  modelValue: $.value,
66
66
  "onUpdate:modelValue": b[2] || (b[2] = (p) => $.value = p),
67
67
  "max-width": "500px",
68
68
  persistent: "",
69
69
  "no-click-animation": ""
70
70
  }, {
71
- default: a(() => [
71
+ default: n(() => [
72
72
  r(M, null, {
73
- default: a(() => [
73
+ default: n(() => [
74
74
  r(d, { class: "text-h5 text-center py-6" }, {
75
- default: a(() => [
76
- V(g(o.title), 1)
75
+ default: n(() => [
76
+ V(g(l.title), 1)
77
77
  ]),
78
78
  _: 1
79
79
  }),
80
- o.description ? (m(), k(y, {
80
+ l.description ? (m(), C(y, {
81
81
  key: 0,
82
82
  class: "text-center px-0 py-0"
83
83
  }, {
84
- default: a(() => [
85
- V(g(o.description) + " ", 1),
86
- C(I.$slots, "description")
84
+ default: n(() => [
85
+ V(g(l.description) + " ", 1),
86
+ k(I.$slots, "description")
87
87
  ]),
88
88
  _: 3
89
- })) : N("", !0),
89
+ })) : K("", !0),
90
90
  r(h, null, {
91
- default: a(() => [
91
+ default: n(() => [
92
92
  r(i),
93
93
  r(L, {
94
94
  color: "error",
@@ -96,8 +96,8 @@ const ft = /* @__PURE__ */ ct(mt), pt = /* @__PURE__ */ Pe({
96
96
  dark: "",
97
97
  onClick: b[0] || (b[0] = (p) => I.$emit("close"))
98
98
  }, {
99
- default: a(() => [
100
- V(g(o.cancelButtonText), 1)
99
+ default: n(() => [
100
+ V(g(l.cancelButtonText), 1)
101
101
  ]),
102
102
  _: 1
103
103
  }),
@@ -107,8 +107,8 @@ const ft = /* @__PURE__ */ ct(mt), pt = /* @__PURE__ */ Pe({
107
107
  dark: "",
108
108
  onClick: b[1] || (b[1] = (p) => I.$emit("confirm"))
109
109
  }, {
110
- default: a(() => [
111
- V(g(o.confirmButtonText), 1)
110
+ default: n(() => [
111
+ V(g(l.confirmButtonText), 1)
112
112
  ]),
113
113
  _: 1
114
114
  }),
@@ -124,18 +124,18 @@ const ft = /* @__PURE__ */ ct(mt), pt = /* @__PURE__ */ Pe({
124
124
  }, 8, ["modelValue"]);
125
125
  };
126
126
  }
127
- }), He = Symbol("DataTableConfig");
128
- function Mt(o) {
127
+ }), Oe = Symbol("DataTableConfig");
128
+ function Ht(l) {
129
129
  return {
130
130
  install(_) {
131
- _.provide(He, o);
131
+ _.provide(Oe, l);
132
132
  }
133
133
  };
134
134
  }
135
- const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}', bt = { class: "vdt-toolbar" }, yt = { class: "vdt-columns__actions" }, ht = { class: "vdt-columns__list" }, xt = ["onDragstart", "onDragover", "onDrop"], wt = ["aria-label", "title", "onKeydown"], Ct = ["aria-label"], kt = ["aria-label"], Vt = {
135
+ const yt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}', ht = { class: "vdt-toolbar" }, xt = { class: "vdt-columns__actions" }, wt = { class: "vdt-columns__list" }, kt = ["onDragstart", "onDragover", "onDrop"], Ct = ["aria-label", "title", "onKeydown"], Vt = ["aria-label"], St = ["aria-label"], Dt = {
136
136
  key: 2,
137
137
  class: "vdt-hint"
138
- }, ae = "actions", St = 300, xe = 2, Tt = "vuetify-datatable:columns:", Bt = "svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z", Dt = "svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z", _t = "svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z", $t = "svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z", It = /* @__PURE__ */ Pe({
138
+ }, se = "actions", Tt = 300, ke = 2, Bt = "vuetify-datatable:columns:", _t = "svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z", $t = "svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z", It = "svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z", Lt = "svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z", Mt = /* @__PURE__ */ Ee({
139
139
  inheritAttrs: !1,
140
140
  __name: "DataTable",
141
141
  props: {
@@ -169,14 +169,14 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
169
169
  disableDelete: {}
170
170
  },
171
171
  emits: ["onLoadData", "editItem", "deleteItem", "viewItem", "update:modelValue"],
172
- setup(o, { emit: _ }) {
172
+ setup(l, { emit: _ }) {
173
173
  function $() {
174
174
  if (typeof document > "u" || document.getElementById("vuetify-datatable-styles")) return;
175
175
  const e = document.createElement("style");
176
- e.id = "vuetify-datatable-styles", e.textContent = gt, document.head.appendChild(e);
176
+ e.id = "vuetify-datatable-styles", e.textContent = yt, document.head.appendChild(e);
177
177
  }
178
178
  $();
179
- const I = [ae, "expanded-row", "data-table-expand", "data-table-select"], b = {
179
+ const I = [se, "expanded-row", "data-table-expand", "data-table-select"], b = {
180
180
  columns: "Columns",
181
181
  hiddenColumns: (e) => `Columns · ${e} hidden`,
182
182
  searchColumns: "Search columns",
@@ -187,7 +187,7 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
187
187
  scrollHint: "Scroll to see more columns",
188
188
  scrollLeft: "Previous columns",
189
189
  scrollRight: "More columns"
190
- }, d = o, y = _, i = ot(He, { icons: {} }), L = c(() => {
190
+ }, d = l, y = _, i = at(Oe, { icons: {} }), L = c(() => {
191
191
  var e;
192
192
  return d.viewIcon ?? ((e = i.icons) == null ? void 0 : e.view) ?? "mdi-eye-outline";
193
193
  }), h = c(() => {
@@ -204,142 +204,147 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
204
204
  get: () => d.modelValue,
205
205
  set: (e) => y("update:modelValue", e)
206
206
  });
207
- function Ee() {
207
+ function Re() {
208
208
  y("update:modelValue", []);
209
209
  }
210
- const R = v(d.itemsPerPage), Y = v([]), Z = v(1), se = v(null), W = v(!1), Oe = c(() => {
210
+ const A = v(d.itemsPerPage), Z = v([]), W = v(1), re = v(null), J = v(!1), Ae = c(() => {
211
211
  var e;
212
212
  return ((e = d.headers) == null ? void 0 : e.filter(
213
213
  (t) => t.key !== "actions" && t.key !== "expanded-row" && t.key !== "data-table-expand"
214
214
  )) || [];
215
215
  });
216
- function T(e) {
217
- var n;
218
- const t = ((n = i.texts) == null ? void 0 : n[e]) ?? b[e];
216
+ function D(e) {
217
+ var o;
218
+ const t = ((o = i.texts) == null ? void 0 : o[e]) ?? b[e];
219
219
  return typeof t == "function" ? t() : t;
220
220
  }
221
- const re = v(!1), ie = v(""), A = v([]), x = v([]), J = v(null), X = v(null), K = c(() => d.headers.filter((e) => !I.includes(e.key) && !!e.title)), U = c(() => {
222
- const e = new Map(K.value.map((n) => [n.key, n]));
223
- return [...A.value.filter((n) => e.has(n)).map((n) => e.get(n)), ...K.value.filter((n) => !A.value.includes(n.key))];
224
- }), Re = c(() => {
225
- const e = (ie.value ?? "").trim().toLowerCase();
221
+ const ie = v(!1), de = v(""), z = v([]), x = v([]), X = v(null), Q = v(null), R = c(() => d.headers.filter((e) => !I.includes(e.key) && !!e.title)), U = c(() => {
222
+ const e = new Map(R.value.map((o) => [o.key, o]));
223
+ return [...z.value.filter((o) => e.has(o)).map((o) => e.get(o)), ...R.value.filter((o) => !z.value.includes(o.key))];
224
+ }), ze = c(() => {
225
+ const e = (de.value ?? "").trim().toLowerCase();
226
226
  return e ? U.value.filter((t) => {
227
- var n;
228
- return (n = t.title) == null ? void 0 : n.toLowerCase().includes(e);
227
+ var o;
228
+ return (o = t.title) == null ? void 0 : o.toLowerCase().includes(e);
229
229
  }) : U.value;
230
- }), j = c(() => K.value.filter((e) => x.value.includes(e.key)).length), Ae = c(
231
- () => U.value.map((e) => ({ key: e.key, title: e.title ?? "", visible: !x.value.includes(e.key) }))
232
- ), we = c(() => d.headers.some((e) => e.key === ae)), de = c(() => {
233
- const e = new Set(K.value.map((s) => s.key)), t = [...U.value], n = d.headers.map((s) => e.has(s.key) ? t.shift() : s);
230
+ }), ue = c(() => new Set(R.value.filter((e) => e.locked).map((e) => e.key))), q = c(() => R.value.filter((e) => e.hidden && !e.locked).map((e) => e.key)), j = c(() => R.value.filter((e) => x.value.includes(e.key)).length), Ne = c(
231
+ () => U.value.map((e) => ({
232
+ key: e.key,
233
+ title: e.title ?? "",
234
+ visible: !x.value.includes(e.key),
235
+ locked: ue.value.has(e.key)
236
+ }))
237
+ ), Ce = c(() => d.headers.some((e) => e.key === se)), ce = c(() => {
238
+ const e = new Set(R.value.map((s) => s.key)), t = [...U.value], o = d.headers.map((s) => e.has(s.key) ? t.shift() : s);
234
239
  return [
235
- ...n.filter((s) => s.key !== ae && !x.value.includes(s.key)),
236
- ...n.filter((s) => s.key === ae)
240
+ ...o.filter((s) => s.key !== se && !x.value.includes(s.key)),
241
+ ...o.filter((s) => s.key === se)
237
242
  ];
238
- }), Ce = c(
243
+ }), Ve = c(
239
244
  () => {
240
245
  var e;
241
- return j.value > 0 ? (((e = i.texts) == null ? void 0 : e.hiddenColumns) ?? b.hiddenColumns)(j.value) : T("columns");
246
+ return j.value > 0 ? (((e = i.texts) == null ? void 0 : e.hiddenColumns) ?? b.hiddenColumns)(j.value) : D("columns");
242
247
  }
243
248
  );
244
- function ke(e, t) {
245
- x.value = t ? x.value.filter((n) => n !== e) : [...x.value, e];
249
+ function Se(e, t) {
250
+ ue.value.has(e) || (x.value = t ? x.value.filter((o) => o !== e) : [...x.value, e]);
246
251
  }
247
- function Ve() {
248
- x.value = j.value === 0 ? K.value.map((e) => e.key) : [];
252
+ function De() {
253
+ x.value = j.value === 0 ? R.value.filter((e) => !e.locked).map((e) => e.key) : [];
249
254
  }
250
- function Se() {
251
- A.value = [], x.value = [];
255
+ function Te() {
256
+ z.value = [], x.value = [...q.value];
252
257
  }
253
- function ue(e, t) {
254
- const n = U.value.map((w) => w.key), s = n.indexOf(e), B = n.indexOf(t);
255
- s === -1 || B === -1 || s === B || (n.splice(B, 0, ...n.splice(s, 1)), A.value = n);
258
+ function ve(e, t) {
259
+ const o = U.value.map((w) => w.key), s = o.indexOf(e), T = o.indexOf(t);
260
+ s === -1 || T === -1 || s === T || (o.splice(T, 0, ...o.splice(s, 1)), z.value = o);
256
261
  }
257
- function ce(e, t) {
258
- const n = U.value.map((B) => B.key), s = n[n.indexOf(e) + t];
259
- s && ue(e, s);
262
+ function me(e, t) {
263
+ const o = U.value.map((T) => T.key), s = o[o.indexOf(e) + t];
264
+ s && ve(e, s);
260
265
  }
261
- function ze(e, t) {
262
- var n;
263
- J.value = t, (n = e.dataTransfer) == null || n.setData("text/plain", t);
266
+ function Ke(e, t) {
267
+ var o;
268
+ X.value = t, (o = e.dataTransfer) == null || o.setData("text/plain", t);
264
269
  }
265
- function Ne(e) {
266
- J.value && ue(J.value, e), Te();
270
+ function Ue(e) {
271
+ X.value && ve(X.value, e), Be();
267
272
  }
268
- function Te() {
269
- J.value = null, X.value = null;
273
+ function Be() {
274
+ X.value = null, Q.value = null;
270
275
  }
271
- const ve = c(() => {
276
+ const fe = c(() => {
272
277
  var t;
273
- const e = Tt + K.value.map((n) => n.key).sort().join(",");
278
+ const e = Bt + R.value.map((o) => o.key).sort().join(",");
274
279
  return ((t = i.storageKey) == null ? void 0 : t.call(i, e)) ?? e;
275
280
  });
276
- z(
277
- ve,
281
+ N(
282
+ fe,
278
283
  (e) => {
279
284
  try {
280
285
  const t = JSON.parse(localStorage.getItem(e) ?? "null");
281
- A.value = Array.isArray(t == null ? void 0 : t.order) ? t.order : [], x.value = Array.isArray(t == null ? void 0 : t.hidden) ? t.hidden : [];
286
+ z.value = Array.isArray(t == null ? void 0 : t.order) ? t.order : [], x.value = Array.isArray(t == null ? void 0 : t.hidden) ? t.hidden.filter((o) => !ue.value.has(o)) : [...q.value];
282
287
  } catch {
283
- A.value = [], x.value = [];
288
+ z.value = [], x.value = [...q.value];
284
289
  }
285
290
  },
286
291
  { immediate: !0 }
287
- ), z([A, x], ([e, t]) => {
292
+ ), N([z, x], ([e, t]) => {
288
293
  try {
289
- e.length || t.length ? localStorage.setItem(ve.value, JSON.stringify({ order: e, hidden: t })) : localStorage.removeItem(ve.value);
294
+ e.length === 0 && t.length === q.value.length && t.every((s) => q.value.includes(s)) ? localStorage.removeItem(fe.value) : localStorage.setItem(fe.value, JSON.stringify({ order: e, hidden: t }));
290
295
  } catch {
291
296
  }
292
297
  });
293
- const me = v(null), fe = v(null), Q = v(!1), pe = v(!1), ee = v(!1), ge = v(!1), Be = v({});
294
- let q = null;
295
- const Ke = c(() => Q.value || j.value > 0 || re.value), De = c(() => ee.value && !ge.value), Ue = c(() => ({
296
- "vdt--pinned": we.value,
297
- "vdt--can-left": pe.value,
298
- "vdt--can-right": ee.value
298
+ const pe = v(null), ge = v(null), ee = v(!1), be = v(!1), te = v(!1), ye = v(!1), _e = v({});
299
+ let F = null;
300
+ const je = c(() => ee.value || j.value > 0 || ie.value), $e = c(() => te.value && !ye.value), qe = c(() => ({
301
+ "vdt--pinned": Ce.value,
302
+ "vdt--can-left": be.value,
303
+ "vdt--can-right": te.value
299
304
  }));
300
- function be() {
305
+ function he() {
301
306
  var e;
302
- return ((e = fe.value) == null ? void 0 : e.querySelector(".v-table__wrapper")) ?? null;
307
+ return ((e = ge.value) == null ? void 0 : e.querySelector(".v-table__wrapper")) ?? null;
303
308
  }
304
- function te() {
305
- const e = fe.value, t = be();
309
+ function le() {
310
+ const e = ge.value, t = he();
306
311
  if (!e || !t) return;
307
- const n = t.scrollWidth - t.clientWidth;
308
- Q.value = n > xe, pe.value = Q.value && t.scrollLeft > xe, ee.value = Q.value && t.scrollLeft < n - xe;
309
- const s = we.value ? t.querySelector("thead > tr > th:last-child") : null, B = t.querySelector("thead"), w = t.getBoundingClientRect();
310
- Be.value = {
312
+ const o = t.scrollWidth - t.clientWidth;
313
+ ee.value = o > ke, be.value = ee.value && t.scrollLeft > ke, te.value = ee.value && t.scrollLeft < o - ke;
314
+ const s = Ce.value ? t.querySelector("thead > tr > th:last-child") : null, T = t.querySelector("thead"), w = t.getBoundingClientRect();
315
+ _e.value = {
311
316
  "--vdt-pinned-w": `${(s == null ? void 0 : s.offsetWidth) ?? 0}px`,
312
317
  "--vdt-scroll-top": `${w.top - e.getBoundingClientRect().top}px`,
313
318
  "--vdt-scroll-h": `${w.height}px`,
314
- "--vdt-head-h": `${(B == null ? void 0 : B.offsetHeight) ?? 48}px`
319
+ "--vdt-head-h": `${(T == null ? void 0 : T.offsetHeight) ?? 48}px`
315
320
  };
316
321
  }
317
- function je(e) {
318
- const t = be();
319
- !t || e.target !== t || (t.scrollLeft > 10 && (ge.value = !0), te());
322
+ function Fe(e) {
323
+ const t = he();
324
+ !t || e.target !== t || (t.scrollLeft > 10 && (ye.value = !0), le());
320
325
  }
321
- function _e(e) {
326
+ function Ie(e) {
322
327
  var t;
323
- e === 1 && (ge.value = !0), (t = be()) == null || t.scrollBy({ left: e * St, behavior: "smooth" });
328
+ e === 1 && (ye.value = !0), (t = he()) == null || t.scrollBy({ left: e * Tt, behavior: "smooth" });
324
329
  }
325
- z([de, () => d.items, () => d.loading], () => lt(te)), nt(() => {
326
- F({
327
- page: Z.value,
328
- itemsPerPage: R.value
329
- }), typeof ResizeObserver < "u" && me.value && (q = new ResizeObserver(() => requestAnimationFrame(te)), q.observe(me.value)), te();
330
- }), at(() => q == null ? void 0 : q.disconnect());
331
- const qe = (e) => {
332
- se.value = e, W.value = !0;
333
- }, Fe = () => {
334
- se.value = null, W.value = !1;
335
- }, Ge = (e) => {
330
+ N([ce, () => d.items, () => d.loading], () => nt(le)), st(() => {
331
+ G({
332
+ page: W.value,
333
+ itemsPerPage: A.value
334
+ }), typeof ResizeObserver < "u" && pe.value && (F = new ResizeObserver(() => requestAnimationFrame(le)), F.observe(pe.value)), le();
335
+ }), rt(() => F == null ? void 0 : F.disconnect());
336
+ const Ge = (e) => {
337
+ re.value = e, J.value = !0;
338
+ }, Ye = () => {
339
+ re.value = null, J.value = !1;
340
+ }, Ze = (e) => {
336
341
  y("editItem", e);
337
- }, Ye = (e) => {
342
+ }, We = (e) => {
338
343
  y("viewItem", e);
339
- }, Ze = () => {
340
- y("deleteItem", se.value), W.value = !1;
341
- }, F = ({ page: e, itemsPerPage: t }) => {
342
- const n = Y.value.map((s) => ({
344
+ }, Je = () => {
345
+ y("deleteItem", re.value), J.value = !1;
346
+ }, G = ({ page: e, itemsPerPage: t }) => {
347
+ const o = Z.value.map((s) => ({
343
348
  column: s.key,
344
349
  direction: s.order
345
350
  }));
@@ -347,149 +352,150 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
347
352
  page: e,
348
353
  itemsPerPage: t,
349
354
  search: d.search,
350
- sortBy: n
355
+ sortBy: o
351
356
  });
352
357
  };
353
- function We() {
354
- F({
358
+ function Xe() {
359
+ G({
355
360
  page: 1,
356
- itemsPerPage: R.value
361
+ itemsPerPage: A.value
357
362
  });
358
363
  }
359
- const Je = ft(We, 400);
360
- return z(
364
+ const Qe = gt(Xe, 400);
365
+ return N(
361
366
  () => d.search,
362
367
  (e, t) => {
363
- e !== t && Je();
368
+ e !== t && Qe();
364
369
  }
365
- ), z(R, (e, t) => {
366
- e !== t && F({
370
+ ), N(A, (e, t) => {
371
+ e !== t && G({
367
372
  page: 1,
368
373
  itemsPerPage: e
369
374
  });
370
- }), z(Y, () => {
371
- F({
375
+ }), N(Z, () => {
376
+ G({
372
377
  page: 1,
373
- itemsPerPage: R.value
378
+ itemsPerPage: A.value
374
379
  });
375
- }), z(Z, (e) => {
376
- F({
380
+ }), N(W, (e) => {
381
+ G({
377
382
  page: e,
378
- itemsPerPage: R.value
383
+ itemsPerPage: A.value
379
384
  });
380
385
  }), (e, t) => {
381
- const n = f("v-btn"), s = f("v-text-field"), B = f("v-checkbox-btn"), w = f("v-icon"), Xe = f("v-card-text"), Qe = f("v-card"), et = f("v-menu"), oe = f("v-tooltip"), tt = f("v-data-table-server");
382
- return m(), G("div", {
386
+ const o = f("v-btn"), s = f("v-text-field"), T = f("v-checkbox-btn"), w = f("v-icon"), et = f("v-card-text"), tt = f("v-card"), lt = f("v-menu"), oe = f("v-tooltip"), ot = f("v-data-table-server");
387
+ return m(), Y("div", {
383
388
  ref_key: "rootRef",
384
- ref: me,
385
- class: $e(["vdt", Ue.value]),
386
- style: st(Be.value)
389
+ ref: pe,
390
+ class: Le(["vdt", qe.value]),
391
+ style: it(_e.value)
387
392
  }, [
388
- rt(P("div", bt, [
389
- C(e.$slots, "column-chooser", {
390
- columns: Ae.value,
393
+ dt(P("div", ht, [
394
+ k(e.$slots, "column-chooser", {
395
+ columns: Ne.value,
391
396
  hiddenCount: j.value,
392
- label: Ce.value,
393
- setVisible: ke,
394
- toggleAll: Ve,
395
- reset: Se,
396
- move: ce,
397
- place: ue
397
+ label: Ve.value,
398
+ setVisible: Se,
399
+ toggleAll: De,
400
+ reset: Te,
401
+ move: me,
402
+ place: ve
398
403
  }, () => [
399
- r(et, {
400
- modelValue: re.value,
401
- "onUpdate:modelValue": t[2] || (t[2] = (l) => re.value = l),
404
+ r(lt, {
405
+ modelValue: ie.value,
406
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => ie.value = a),
402
407
  "close-on-content-click": !1,
403
408
  location: "bottom start"
404
409
  }, {
405
- activator: a(({ props: l }) => [
406
- r(n, H(l, {
410
+ activator: n(({ props: a }) => [
411
+ r(o, H(a, {
407
412
  class: "vdt-columns__button",
408
413
  variant: "outlined",
409
414
  color: "primary",
410
415
  size: "small",
411
- "prepend-icon": Bt
416
+ "prepend-icon": _t
412
417
  }), {
413
- default: a(() => [
414
- V(g(Ce.value), 1)
418
+ default: n(() => [
419
+ V(g(Ve.value), 1)
415
420
  ]),
416
421
  _: 1
417
422
  }, 16)
418
423
  ]),
419
- default: a(() => [
420
- r(Qe, {
424
+ default: n(() => [
425
+ r(tt, {
421
426
  class: "vdt-columns",
422
427
  "min-width": "280"
423
428
  }, {
424
- default: a(() => [
425
- r(Xe, { class: "pa-3" }, {
426
- default: a(() => [
429
+ default: n(() => [
430
+ r(et, { class: "pa-3" }, {
431
+ default: n(() => [
427
432
  r(s, {
428
- modelValue: ie.value,
429
- "onUpdate:modelValue": t[0] || (t[0] = (l) => ie.value = l),
430
- placeholder: T("searchColumns"),
433
+ modelValue: de.value,
434
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => de.value = a),
435
+ placeholder: D("searchColumns"),
431
436
  density: "compact",
432
437
  variant: "outlined",
433
438
  "hide-details": "",
434
439
  clearable: ""
435
440
  }, null, 8, ["modelValue", "placeholder"]),
436
- P("div", yt, [
437
- r(n, {
441
+ P("div", xt, [
442
+ r(o, {
438
443
  variant: "text",
439
444
  size: "small",
440
445
  color: "primary",
441
- onClick: Ve
446
+ onClick: De
442
447
  }, {
443
- default: a(() => [
444
- V(g(j.value === 0 ? T("hideAllColumns") : T("showAllColumns")), 1)
448
+ default: n(() => [
449
+ V(g(j.value === 0 ? D("hideAllColumns") : D("showAllColumns")), 1)
445
450
  ]),
446
451
  _: 1
447
452
  }),
448
- r(n, {
453
+ r(o, {
449
454
  variant: "text",
450
455
  size: "small",
451
- onClick: Se
456
+ onClick: Te
452
457
  }, {
453
- default: a(() => [
454
- V(g(T("resetColumns")), 1)
458
+ default: n(() => [
459
+ V(g(D("resetColumns")), 1)
455
460
  ]),
456
461
  _: 1
457
462
  })
458
463
  ]),
459
- P("ul", ht, [
460
- (m(!0), G(it, null, Ie(Re.value, (l) => (m(), G("li", {
461
- key: l.key,
462
- class: $e(["vdt-columns__item", { "vdt-columns__item--over": X.value === l.key }]),
464
+ P("ul", wt, [
465
+ (m(!0), Y(ut, null, Me(ze.value, (a) => (m(), Y("li", {
466
+ key: a.key,
467
+ class: Le(["vdt-columns__item", { "vdt-columns__item--over": Q.value === a.key }]),
463
468
  draggable: "true",
464
- onDragstart: (u) => ze(u, l.key),
465
- onDragover: le((u) => X.value = l.key, ["prevent"]),
466
- onDragleave: t[1] || (t[1] = (u) => X.value = null),
467
- onDrop: le((u) => Ne(l.key), ["prevent"]),
468
- onDragend: Te
469
+ onDragstart: (u) => Ke(u, a.key),
470
+ onDragover: ae((u) => Q.value = a.key, ["prevent"]),
471
+ onDragleave: t[1] || (t[1] = (u) => Q.value = null),
472
+ onDrop: ae((u) => Ue(a.key), ["prevent"]),
473
+ onDragend: Be
469
474
  }, [
470
- r(B, {
471
- "model-value": !x.value.includes(l.key),
472
- label: l.title,
475
+ r(T, {
476
+ "model-value": !x.value.includes(a.key),
477
+ label: a.title,
478
+ disabled: !!a.locked,
473
479
  density: "compact",
474
480
  class: "flex-grow-1",
475
- "onUpdate:modelValue": (u) => ke(l.key, !!u)
476
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
481
+ "onUpdate:modelValue": (u) => Se(a.key, !!u)
482
+ }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
477
483
  P("button", {
478
484
  type: "button",
479
485
  class: "vdt-columns__handle",
480
- "aria-label": `${T("moveColumn")}: ${l.title}`,
481
- title: T("moveColumn"),
486
+ "aria-label": `${D("moveColumn")}: ${a.title}`,
487
+ title: D("moveColumn"),
482
488
  onKeydown: [
483
- Le(le((u) => ce(l.key, -1), ["prevent"]), ["up"]),
484
- Le(le((u) => ce(l.key, 1), ["prevent"]), ["down"])
489
+ Pe(ae((u) => me(a.key, -1), ["prevent"]), ["up"]),
490
+ Pe(ae((u) => me(a.key, 1), ["prevent"]), ["down"])
485
491
  ]
486
492
  }, [
487
493
  r(w, {
488
- icon: Dt,
494
+ icon: $t,
489
495
  size: "18"
490
496
  })
491
- ], 40, wt)
492
- ], 42, xt))), 128))
497
+ ], 40, Ct)
498
+ ], 42, kt))), 128))
493
499
  ])
494
500
  ]),
495
501
  _: 1
@@ -502,48 +508,48 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
502
508
  }, 8, ["modelValue"])
503
509
  ])
504
510
  ], 512), [
505
- [dt, Ke.value]
511
+ [ct, je.value]
506
512
  ]),
507
513
  P("div", {
508
514
  ref_key: "bodyRef",
509
- ref: fe,
515
+ ref: ge,
510
516
  class: "vdt-body",
511
- onScrollCapturePassive: je
517
+ onScrollCapturePassive: Fe
512
518
  }, [
513
- r(tt, H(e.$attrs, {
514
- headers: de.value,
515
- items: o.items,
516
- loading: o.loading,
517
- "items-length": o.totalItems,
518
- "items-per-page": R.value,
519
- "onUpdate:itemsPerPage": t[3] || (t[3] = (l) => R.value = l),
520
- search: o.search,
521
- "sort-by": Y.value,
522
- "onUpdate:sortBy": t[4] || (t[4] = (l) => Y.value = l),
523
- page: Z.value,
524
- "onUpdate:page": t[5] || (t[5] = (l) => Z.value = l),
525
- "item-value": o.itemValue,
526
- "show-expand": o.showExpand,
527
- "show-select": o.showSelect,
528
- "select-strategy": o.selectStrategy,
519
+ r(ot, H(e.$attrs, {
520
+ headers: ce.value,
521
+ items: l.items,
522
+ loading: l.loading,
523
+ "items-length": l.totalItems,
524
+ "items-per-page": A.value,
525
+ "onUpdate:itemsPerPage": t[3] || (t[3] = (a) => A.value = a),
526
+ search: l.search,
527
+ "sort-by": Z.value,
528
+ "onUpdate:sortBy": t[4] || (t[4] = (a) => Z.value = a),
529
+ page: W.value,
530
+ "onUpdate:page": t[5] || (t[5] = (a) => W.value = a),
531
+ "item-value": l.itemValue,
532
+ "show-expand": l.showExpand,
533
+ "show-select": l.showSelect,
534
+ "select-strategy": l.selectStrategy,
529
535
  modelValue: O.value,
530
- "onUpdate:modelValue": t[6] || (t[6] = (l) => O.value = l),
536
+ "onUpdate:modelValue": t[6] || (t[6] = (a) => O.value = a),
531
537
  class: p.value
532
- }), ut({
533
- "item.data-table-expand": a(({ internalItem: l, isExpanded: u, toggleExpand: D }) => [
534
- C(e.$slots, "item.data-table-expand", {
535
- internalItem: l,
538
+ }), vt({
539
+ "item.data-table-expand": n(({ internalItem: a, isExpanded: u, toggleExpand: B }) => [
540
+ k(e.$slots, "item.data-table-expand", {
541
+ internalItem: a,
536
542
  isExpanded: u,
537
- toggleExpand: D
543
+ toggleExpand: B
538
544
  }, () => [
539
- r(n, {
540
- onClick: (ye) => D(l),
545
+ r(o, {
546
+ onClick: (xe) => B(a),
541
547
  rounded: ""
542
548
  }, {
543
- default: a(() => [
549
+ default: n(() => [
544
550
  r(w, null, {
545
- default: a(() => [
546
- V(g(u(l) ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
551
+ default: n(() => [
552
+ V(g(u(a) ? "mdi-chevron-up" : "mdi-chevron-down"), 1)
547
553
  ]),
548
554
  _: 2
549
555
  }, 1024)
@@ -552,40 +558,40 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
552
558
  }, 1032, ["onClick"])
553
559
  ])
554
560
  ]),
555
- "expanded-row": a(({ columns: l, item: u }) => [
556
- C(e.$slots, "expanded-row", {
557
- columns: l,
561
+ "expanded-row": n(({ columns: a, item: u }) => [
562
+ k(e.$slots, "expanded-row", {
563
+ columns: a,
558
564
  item: u
559
565
  })
560
566
  ]),
561
- "item.actions": a(({ item: l }) => [
562
- C(e.$slots, "before-actions", { item: l }),
563
- o.showViewButton ? (m(), k(oe, {
567
+ "item.actions": n(({ item: a }) => [
568
+ k(e.$slots, "before-actions", { item: a }),
569
+ l.showViewButton ? (m(), C(oe, {
564
570
  key: 0,
565
- text: o.viewButtonText
571
+ text: l.viewButtonText
566
572
  }, {
567
- activator: a(({ props: u }) => {
568
- var D;
573
+ activator: n(({ props: u }) => {
574
+ var B;
569
575
  return [
570
- r(n, H({
576
+ r(o, H({
571
577
  icon: "",
572
578
  flat: "",
573
- onClick: (ye) => Ye(l)
579
+ onClick: (xe) => We(a)
574
580
  }, u, {
575
- disabled: (D = o.disableView) == null ? void 0 : D.call(o, l)
581
+ disabled: (B = l.disableView) == null ? void 0 : B.call(l, a)
576
582
  }), {
577
- default: a(() => [
578
- C(e.$slots, "view-icon", {}, () => [
579
- S(L.value) ? (m(), k(he(L.value), H({
583
+ default: n(() => [
584
+ k(e.$slots, "view-icon", {}, () => [
585
+ S(L.value) ? (m(), C(we(L.value), H({
580
586
  key: 0,
581
587
  size: 20,
582
588
  class: "text-info"
583
- }, E.value), null, 16)) : (m(), k(w, {
589
+ }, E.value), null, 16)) : (m(), C(w, {
584
590
  key: 1,
585
591
  size: "20",
586
592
  class: "text-info"
587
593
  }, {
588
- default: a(() => [
594
+ default: n(() => [
589
595
  V(g(L.value), 1)
590
596
  ]),
591
597
  _: 1
@@ -597,33 +603,33 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
597
603
  ];
598
604
  }),
599
605
  _: 2
600
- }, 1032, ["text"])) : N("", !0),
601
- o.showEditButton ? (m(), k(oe, {
606
+ }, 1032, ["text"])) : K("", !0),
607
+ l.showEditButton ? (m(), C(oe, {
602
608
  key: 1,
603
- text: o.editButtonText
609
+ text: l.editButtonText
604
610
  }, {
605
- activator: a(({ props: u }) => {
606
- var D;
611
+ activator: n(({ props: u }) => {
612
+ var B;
607
613
  return [
608
- r(n, H({
614
+ r(o, H({
609
615
  icon: "",
610
616
  flat: "",
611
- onClick: (ye) => Ge(l)
617
+ onClick: (xe) => Ze(a)
612
618
  }, u, {
613
- disabled: (D = o.disableEdit) == null ? void 0 : D.call(o, l)
619
+ disabled: (B = l.disableEdit) == null ? void 0 : B.call(l, a)
614
620
  }), {
615
- default: a(() => [
616
- C(e.$slots, "edit-icon", {}, () => [
617
- S(h.value) ? (m(), k(he(h.value), H({
621
+ default: n(() => [
622
+ k(e.$slots, "edit-icon", {}, () => [
623
+ S(h.value) ? (m(), C(we(h.value), H({
618
624
  key: 0,
619
625
  size: 20,
620
626
  class: "text-primary"
621
- }, E.value), null, 16)) : (m(), k(w, {
627
+ }, E.value), null, 16)) : (m(), C(w, {
622
628
  key: 1,
623
629
  size: "20",
624
630
  class: "text-primary"
625
631
  }, {
626
- default: a(() => [
632
+ default: n(() => [
627
633
  V(g(h.value), 1)
628
634
  ]),
629
635
  _: 1
@@ -635,33 +641,33 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
635
641
  ];
636
642
  }),
637
643
  _: 2
638
- }, 1032, ["text"])) : N("", !0),
639
- o.showDeleteButton ? (m(), k(oe, {
644
+ }, 1032, ["text"])) : K("", !0),
645
+ l.showDeleteButton ? (m(), C(oe, {
640
646
  key: 2,
641
- text: o.deleteButtonText
647
+ text: l.deleteButtonText
642
648
  }, {
643
- activator: a(({ props: u }) => {
644
- var D;
649
+ activator: n(({ props: u }) => {
650
+ var B;
645
651
  return [
646
- r(n, H({
652
+ r(o, H({
647
653
  icon: "",
648
654
  flat: "",
649
- onClick: (ye) => qe(l)
655
+ onClick: (xe) => Ge(a)
650
656
  }, u, {
651
- disabled: (D = o.disableDelete) == null ? void 0 : D.call(o, l)
657
+ disabled: (B = l.disableDelete) == null ? void 0 : B.call(l, a)
652
658
  }), {
653
- default: a(() => [
654
- C(e.$slots, "delete-icon", {}, () => [
655
- S(M.value) ? (m(), k(he(M.value), H({
659
+ default: n(() => [
660
+ k(e.$slots, "delete-icon", {}, () => [
661
+ S(M.value) ? (m(), C(we(M.value), H({
656
662
  key: 0,
657
663
  size: 20,
658
664
  class: "text-error"
659
- }, E.value), null, 16)) : (m(), k(w, {
665
+ }, E.value), null, 16)) : (m(), C(w, {
660
666
  key: 1,
661
667
  size: "20",
662
668
  class: "text-error"
663
669
  }, {
664
- default: a(() => [
670
+ default: n(() => [
665
671
  V(g(M.value), 1)
666
672
  ]),
667
673
  _: 1
@@ -673,93 +679,93 @@ const gt = '.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify
673
679
  ];
674
680
  }),
675
681
  _: 2
676
- }, 1032, ["text"])) : N("", !0),
677
- C(e.$slots, "after-actions", { item: l })
682
+ }, 1032, ["text"])) : K("", !0),
683
+ k(e.$slots, "after-actions", { item: a })
678
684
  ]),
679
- tfoot: a(() => [
685
+ tfoot: n(() => [
680
686
  P("tfoot", null, [
681
- C(e.$slots, "item.tfoot", { columns: de.value })
687
+ k(e.$slots, "item.tfoot", { columns: ce.value })
682
688
  ])
683
689
  ]),
684
690
  _: 2
685
691
  }, [
686
- o.showSelect ? {
692
+ l.showSelect ? {
687
693
  name: "top",
688
- fn: a(() => [
689
- C(e.$slots, "selection-actions", {
694
+ fn: n(() => [
695
+ k(e.$slots, "selection-actions", {
690
696
  selected: O.value,
691
697
  count: O.value.length,
692
- clear: Ee
698
+ clear: Re
693
699
  })
694
700
  ]),
695
701
  key: "0"
696
702
  } : void 0,
697
- Ie(Oe.value, (l) => ({
698
- name: `item.${l.key}`,
699
- fn: a(({ item: u }) => [
700
- C(e.$slots, `item.${l.key}`, { item: u }, () => [
701
- V(g(u[l.key]), 1)
703
+ Me(Ae.value, (a) => ({
704
+ name: `item.${a.key}`,
705
+ fn: n(({ item: u }) => [
706
+ k(e.$slots, `item.${a.key}`, { item: u }, () => [
707
+ V(g(u[a.key]), 1)
702
708
  ])
703
709
  ])
704
710
  }))
705
711
  ]), 1040, ["headers", "items", "loading", "items-length", "items-per-page", "search", "sort-by", "page", "item-value", "show-expand", "show-select", "select-strategy", "modelValue", "class"]),
706
712
  t[9] || (t[9] = P("div", { class: "vdt-fade vdt-fade--left" }, null, -1)),
707
713
  t[10] || (t[10] = P("div", { class: "vdt-fade vdt-fade--right" }, null, -1)),
708
- pe.value ? (m(), G("button", {
714
+ be.value ? (m(), Y("button", {
709
715
  key: 0,
710
716
  type: "button",
711
717
  class: "vdt-arrow vdt-arrow--left",
712
- "aria-label": T("scrollLeft"),
713
- onClick: t[7] || (t[7] = (l) => _e(-1))
718
+ "aria-label": D("scrollLeft"),
719
+ onClick: t[7] || (t[7] = (a) => Ie(-1))
714
720
  }, [
715
721
  r(w, {
716
- icon: _t,
722
+ icon: It,
717
723
  size: "20"
718
724
  })
719
- ], 8, Ct)) : N("", !0),
720
- ee.value ? (m(), k(oe, {
725
+ ], 8, Vt)) : K("", !0),
726
+ te.value ? (m(), C(oe, {
721
727
  key: 1,
722
- text: T("scrollRight"),
723
- disabled: De.value,
728
+ text: D("scrollRight"),
729
+ disabled: $e.value,
724
730
  location: "top"
725
731
  }, {
726
- activator: a(({ props: l }) => [
727
- P("button", H(l, {
732
+ activator: n(({ props: a }) => [
733
+ P("button", H(a, {
728
734
  type: "button",
729
735
  class: "vdt-arrow vdt-arrow--right",
730
- "aria-label": T("scrollRight"),
731
- onClick: t[8] || (t[8] = (u) => _e(1))
736
+ "aria-label": D("scrollRight"),
737
+ onClick: t[8] || (t[8] = (u) => Ie(1))
732
738
  }), [
733
739
  r(w, {
734
- icon: $t,
740
+ icon: Lt,
735
741
  size: "20"
736
742
  })
737
- ], 16, kt)
743
+ ], 16, St)
738
744
  ]),
739
745
  _: 1
740
- }, 8, ["text", "disabled"])) : N("", !0),
741
- De.value ? (m(), G("span", Vt, g(T("scrollHint")), 1)) : N("", !0)
746
+ }, 8, ["text", "disabled"])) : K("", !0),
747
+ $e.value ? (m(), Y("span", Dt, g(D("scrollHint")), 1)) : K("", !0)
742
748
  ], 544),
743
- r(pt, {
744
- show: W.value,
745
- title: o.deleteModalTitle,
746
- description: o.deleteModalMessage,
747
- confirmButtonText: o.deleteModalConfirmButtonText,
748
- cancelButtonText: o.deleteModalCancelButtonText,
749
- onClose: Fe,
750
- onConfirm: Ze
749
+ r(bt, {
750
+ show: J.value,
751
+ title: l.deleteModalTitle,
752
+ description: l.deleteModalMessage,
753
+ confirmButtonText: l.deleteModalConfirmButtonText,
754
+ cancelButtonText: l.deleteModalCancelButtonText,
755
+ onClose: Ye,
756
+ onConfirm: Je
751
757
  }, null, 8, ["show", "title", "description", "confirmButtonText", "cancelButtonText"])
752
758
  ], 6);
753
759
  };
754
760
  }
755
- }), Pt = {
756
- install(o) {
757
- o.component("DataTable", It);
761
+ }), Et = {
762
+ install(l) {
763
+ l.component("DataTable", Mt);
758
764
  }
759
765
  };
760
766
  export {
761
- He as DATA_TABLE_CONFIG_KEY,
762
- It as DataTable,
763
- Mt as createDataTableConfig,
764
- Pt as default
767
+ Oe as DATA_TABLE_CONFIG_KEY,
768
+ Mt as DataTable,
769
+ Ht as createDataTableConfig,
770
+ Et as default
765
771
  };
@@ -1 +1 @@
1
- (function(v,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(v=typeof globalThis<"u"?globalThis:v||self,e(v.VuetifyDatatable={},v.Vue))})(this,(function(v,e){"use strict";function be(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var L={exports:{}},se;function xe(){if(se)return L.exports;se=1;function l(C,w=100,k={}){if(typeof C!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof C}\`.`);if(w<0)throw new RangeError("`wait` must not be negative.");const{immediate:m}=typeof k=="boolean"?{immediate:k}:k;let i,u,s,V,p;function B(){const g=i,N=u;return i=void 0,u=void 0,p=C.apply(g,N),p}function S(){const g=Date.now()-V;g<w&&g>=0?s=setTimeout(S,w-g):(s=void 0,m||(p=B()))}const d=function(...g){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,u=g,V=Date.now();const N=m&&!s;return s||(s=setTimeout(S,w)),N&&(p=B()),p};return Object.defineProperty(d,"isPending",{get(){return s!==void 0}}),d.clear=()=>{s&&(clearTimeout(s),s=void 0)},d.flush=()=>{s&&d.trigger()},d.trigger=()=>{p=B(),d.clear()},d}return L.exports.debounce=l,L.exports=l,L.exports}var ve=xe();const Ce=be(ve),we=e.defineComponent({__name:"ConfirmationModal",props:{show:Boolean,title:String,description:String,confirmButtonText:String,cancelButtonText:String},emits:["close","confirm"],setup(l){const C=l,w=e.computed({get:()=>C.show,set:()=>{}});return(k,m)=>{const i=e.resolveComponent("v-card-title"),u=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-spacer"),V=e.resolveComponent("v-btn"),p=e.resolveComponent("v-card-actions"),B=e.resolveComponent("v-card"),S=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(S,{modelValue:w.value,"onUpdate:modelValue":m[2]||(m[2]=d=>w.value=d),"max-width":"500px",persistent:"","no-click-animation":""},{default:e.withCtx(()=>[e.createVNode(B,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"text-h5 text-center py-6"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.title),1)]),_:1}),l.description?(e.openBlock(),e.createBlock(u,{key:0,class:"text-center px-0 py-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.description)+" ",1),e.renderSlot(k.$slots,"description")]),_:3})):e.createCommentVNode("",!0),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(s),e.createVNode(V,{color:"error",variant:"flat",dark:"",onClick:m[0]||(m[0]=d=>k.$emit("close"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cancelButtonText),1)]),_:1}),e.createVNode(V,{color:"success",variant:"flat",dark:"",onClick:m[1]||(m[1]=d=>k.$emit("confirm"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.confirmButtonText),1)]),_:1}),e.createVNode(s)]),_:1})]),_:3})]),_:3},8,["modelValue"])}}}),F=Symbol("DataTableConfig");function ke(l){return{install(C){C.provide(F,l)}}}const Ve='.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}',Be={class:"vdt-toolbar"},Se={class:"vdt-columns__actions"},Ne={class:"vdt-columns__list"},Te=["onDragstart","onDragover","onDrop"],De=["aria-label","title","onKeydown"],_e=["aria-label"],Ee=["aria-label"],Pe={key:2,class:"vdt-hint"},I="actions",Me=300,G=2,$e="vuetify-datatable:columns:",Le="svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z",Ie="svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z",He="svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",Oe="svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",ie=e.defineComponent({inheritAttrs:!1,__name:"DataTable",props:{tableClass:{},headers:{default:()=>[]},items:{default:()=>[]},loading:{type:Boolean,default:!1},itemValue:{default:"id"},totalItems:{default:0},itemsPerPage:{default:10},search:{},showExpand:{type:Boolean,default:!1},showSelect:{type:Boolean,default:!1},selectStrategy:{default:"page"},modelValue:{default:()=>[]},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},showViewButton:{type:Boolean,default:!1},viewButtonText:{},deleteButtonText:{},deleteModalTitle:{},deleteModalMessage:{},deleteModalConfirmButtonText:{},deleteModalCancelButtonText:{},editButtonText:{},viewIcon:{},editIcon:{},deleteIcon:{},disableView:{},disableEdit:{},disableDelete:{}},emits:["onLoadData","editItem","deleteItem","viewItem","update:modelValue"],setup(l,{emit:C}){function w(){if(typeof document>"u"||document.getElementById("vuetify-datatable-styles"))return;const t=document.createElement("style");t.id="vuetify-datatable-styles",t.textContent=Ve,document.head.appendChild(t)}w();const k=[I,"expanded-row","data-table-expand","data-table-select"],m={columns:"Columns",hiddenColumns:t=>`Columns · ${t} hidden`,searchColumns:"Search columns",showAllColumns:"Show all",hideAllColumns:"Hide all",resetColumns:"Reset",moveColumn:"Drag or use the arrow keys to reorder",scrollHint:"Scroll to see more columns",scrollLeft:"Previous columns",scrollRight:"More columns"},i=l,u=C,s=e.inject(F,{icons:{}}),V=e.computed(()=>{var t;return i.viewIcon??((t=s.icons)==null?void 0:t.view)??"mdi-eye-outline"}),p=e.computed(()=>{var t;return i.editIcon??((t=s.icons)==null?void 0:t.edit)??"mdi-pencil-outline"}),B=e.computed(()=>{var t;return i.deleteIcon??((t=s.icons)==null?void 0:t.delete)??"mdi-trash-can-outline"}),S=e.computed(()=>s.iconProps??{}),d=e.computed(()=>i.tableClass??s.tableClass??"border rounded-md");function g(t){return typeof t!="string"}const N=e.computed({get:()=>i.modelValue,set:t=>u("update:modelValue",t)});function Re(){u("update:modelValue",[])}const T=e.ref(i.itemsPerPage),H=e.ref([]),O=e.ref(1),Y=e.ref(null),A=e.ref(!1),ze=e.computed(()=>{var t;return((t=i.headers)==null?void 0:t.filter(o=>o.key!=="actions"&&o.key!=="expanded-row"&&o.key!=="data-table-expand"))||[]});function y(t){var a;const o=((a=s.texts)==null?void 0:a[t])??m[t];return typeof o=="function"?o():o}const Z=e.ref(!1),W=e.ref(""),D=e.ref([]),f=e.ref([]),R=e.ref(null),z=e.ref(null),_=e.computed(()=>i.headers.filter(t=>!k.includes(t.key)&&!!t.title)),E=e.computed(()=>{const t=new Map(_.value.map(a=>[a.key,a]));return[...D.value.filter(a=>t.has(a)).map(a=>t.get(a)),..._.value.filter(a=>!D.value.includes(a.key))]}),Ke=e.computed(()=>{const t=(W.value??"").trim().toLowerCase();return t?E.value.filter(o=>{var a;return(a=o.title)==null?void 0:a.toLowerCase().includes(t)}):E.value}),P=e.computed(()=>_.value.filter(t=>f.value.includes(t.key)).length),je=e.computed(()=>E.value.map(t=>({key:t.key,title:t.title??"",visible:!f.value.includes(t.key)}))),ce=e.computed(()=>i.headers.some(t=>t.key===I)),J=e.computed(()=>{const t=new Set(_.value.map(r=>r.key)),o=[...E.value],a=i.headers.map(r=>t.has(r.key)?o.shift():r);return[...a.filter(r=>r.key!==I&&!f.value.includes(r.key)),...a.filter(r=>r.key===I)]}),de=e.computed(()=>{var t;return P.value>0?(((t=s.texts)==null?void 0:t.hiddenColumns)??m.hiddenColumns)(P.value):y("columns")});function me(t,o){f.value=o?f.value.filter(a=>a!==t):[...f.value,t]}function ue(){f.value=P.value===0?_.value.map(t=>t.key):[]}function pe(){D.value=[],f.value=[]}function X(t,o){const a=E.value.map(h=>h.key),r=a.indexOf(t),b=a.indexOf(o);r===-1||b===-1||r===b||(a.splice(b,0,...a.splice(r,1)),D.value=a)}function Q(t,o){const a=E.value.map(b=>b.key),r=a[a.indexOf(t)+o];r&&X(t,r)}function Ue(t,o){var a;R.value=o,(a=t.dataTransfer)==null||a.setData("text/plain",o)}function qe(t){R.value&&X(R.value,t),fe()}function fe(){R.value=null,z.value=null}const ee=e.computed(()=>{var o;const t=$e+_.value.map(a=>a.key).sort().join(",");return((o=s.storageKey)==null?void 0:o.call(s,t))??t});e.watch(ee,t=>{try{const o=JSON.parse(localStorage.getItem(t)??"null");D.value=Array.isArray(o==null?void 0:o.order)?o.order:[],f.value=Array.isArray(o==null?void 0:o.hidden)?o.hidden:[]}catch{D.value=[],f.value=[]}},{immediate:!0}),e.watch([D,f],([t,o])=>{try{t.length||o.length?localStorage.setItem(ee.value,JSON.stringify({order:t,hidden:o})):localStorage.removeItem(ee.value)}catch{}});const te=e.ref(null),oe=e.ref(null),K=e.ref(!1),le=e.ref(!1),j=e.ref(!1),ne=e.ref(!1),he=e.ref({});let M=null;const Fe=e.computed(()=>K.value||P.value>0||Z.value),ge=e.computed(()=>j.value&&!ne.value),Ge=e.computed(()=>({"vdt--pinned":ce.value,"vdt--can-left":le.value,"vdt--can-right":j.value}));function ae(){var t;return((t=oe.value)==null?void 0:t.querySelector(".v-table__wrapper"))??null}function U(){const t=oe.value,o=ae();if(!t||!o)return;const a=o.scrollWidth-o.clientWidth;K.value=a>G,le.value=K.value&&o.scrollLeft>G,j.value=K.value&&o.scrollLeft<a-G;const r=ce.value?o.querySelector("thead > tr > th:last-child"):null,b=o.querySelector("thead"),h=o.getBoundingClientRect();he.value={"--vdt-pinned-w":`${(r==null?void 0:r.offsetWidth)??0}px`,"--vdt-scroll-top":`${h.top-t.getBoundingClientRect().top}px`,"--vdt-scroll-h":`${h.height}px`,"--vdt-head-h":`${(b==null?void 0:b.offsetHeight)??48}px`}}function Ye(t){const o=ae();!o||t.target!==o||(o.scrollLeft>10&&(ne.value=!0),U())}function ye(t){var o;t===1&&(ne.value=!0),(o=ae())==null||o.scrollBy({left:t*Me,behavior:"smooth"})}e.watch([J,()=>i.items,()=>i.loading],()=>e.nextTick(U)),e.onMounted(()=>{$({page:O.value,itemsPerPage:T.value}),typeof ResizeObserver<"u"&&te.value&&(M=new ResizeObserver(()=>requestAnimationFrame(U)),M.observe(te.value)),U()}),e.onBeforeUnmount(()=>M==null?void 0:M.disconnect());const Ze=t=>{Y.value=t,A.value=!0},We=()=>{Y.value=null,A.value=!1},Je=t=>{u("editItem",t)},Xe=t=>{u("viewItem",t)},Qe=()=>{u("deleteItem",Y.value),A.value=!1},$=({page:t,itemsPerPage:o})=>{const a=H.value.map(r=>({column:r.key,direction:r.order}));u("onLoadData",{page:t,itemsPerPage:o,search:i.search,sortBy:a})};function et(){$({page:1,itemsPerPage:T.value})}const tt=Ce(et,400);return e.watch(()=>i.search,(t,o)=>{t!==o&&tt()}),e.watch(T,(t,o)=>{t!==o&&$({page:1,itemsPerPage:t})}),e.watch(H,()=>{$({page:1,itemsPerPage:T.value})}),e.watch(O,t=>{$({page:t,itemsPerPage:T.value})}),(t,o)=>{const a=e.resolveComponent("v-btn"),r=e.resolveComponent("v-text-field"),b=e.resolveComponent("v-checkbox-btn"),h=e.resolveComponent("v-icon"),ot=e.resolveComponent("v-card-text"),lt=e.resolveComponent("v-card"),nt=e.resolveComponent("v-menu"),q=e.resolveComponent("v-tooltip"),at=e.resolveComponent("v-data-table-server");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:te,class:e.normalizeClass(["vdt",Ge.value]),style:e.normalizeStyle(he.value)},[e.withDirectives(e.createElementVNode("div",Be,[e.renderSlot(t.$slots,"column-chooser",{columns:je.value,hiddenCount:P.value,label:de.value,setVisible:me,toggleAll:ue,reset:pe,move:Q,place:X},()=>[e.createVNode(nt,{modelValue:Z.value,"onUpdate:modelValue":o[2]||(o[2]=n=>Z.value=n),"close-on-content-click":!1,location:"bottom start"},{activator:e.withCtx(({props:n})=>[e.createVNode(a,e.mergeProps(n,{class:"vdt-columns__button",variant:"outlined",color:"primary",size:"small","prepend-icon":Le}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(de.value),1)]),_:1},16)]),default:e.withCtx(()=>[e.createVNode(lt,{class:"vdt-columns","min-width":"280"},{default:e.withCtx(()=>[e.createVNode(ot,{class:"pa-3"},{default:e.withCtx(()=>[e.createVNode(r,{modelValue:W.value,"onUpdate:modelValue":o[0]||(o[0]=n=>W.value=n),placeholder:y("searchColumns"),density:"compact",variant:"outlined","hide-details":"",clearable:""},null,8,["modelValue","placeholder"]),e.createElementVNode("div",Se,[e.createVNode(a,{variant:"text",size:"small",color:"primary",onClick:ue},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(P.value===0?y("hideAllColumns"):y("showAllColumns")),1)]),_:1}),e.createVNode(a,{variant:"text",size:"small",onClick:pe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y("resetColumns")),1)]),_:1})]),e.createElementVNode("ul",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ke.value,n=>(e.openBlock(),e.createElementBlock("li",{key:n.key,class:e.normalizeClass(["vdt-columns__item",{"vdt-columns__item--over":z.value===n.key}]),draggable:"true",onDragstart:c=>Ue(c,n.key),onDragover:e.withModifiers(c=>z.value=n.key,["prevent"]),onDragleave:o[1]||(o[1]=c=>z.value=null),onDrop:e.withModifiers(c=>qe(n.key),["prevent"]),onDragend:fe},[e.createVNode(b,{"model-value":!f.value.includes(n.key),label:n.title,density:"compact",class:"flex-grow-1","onUpdate:modelValue":c=>me(n.key,!!c)},null,8,["model-value","label","onUpdate:modelValue"]),e.createElementVNode("button",{type:"button",class:"vdt-columns__handle","aria-label":`${y("moveColumn")}: ${n.title}`,title:y("moveColumn"),onKeydown:[e.withKeys(e.withModifiers(c=>Q(n.key,-1),["prevent"]),["up"]),e.withKeys(e.withModifiers(c=>Q(n.key,1),["prevent"]),["down"])]},[e.createVNode(h,{icon:Ie,size:"18"})],40,De)],42,Te))),128))])]),_:1})]),_:1})]),_:1},8,["modelValue"])])],512),[[e.vShow,Fe.value]]),e.createElementVNode("div",{ref_key:"bodyRef",ref:oe,class:"vdt-body",onScrollCapturePassive:Ye},[e.createVNode(at,e.mergeProps(t.$attrs,{headers:J.value,items:l.items,loading:l.loading,"items-length":l.totalItems,"items-per-page":T.value,"onUpdate:itemsPerPage":o[3]||(o[3]=n=>T.value=n),search:l.search,"sort-by":H.value,"onUpdate:sortBy":o[4]||(o[4]=n=>H.value=n),page:O.value,"onUpdate:page":o[5]||(o[5]=n=>O.value=n),"item-value":l.itemValue,"show-expand":l.showExpand,"show-select":l.showSelect,"select-strategy":l.selectStrategy,modelValue:N.value,"onUpdate:modelValue":o[6]||(o[6]=n=>N.value=n),class:d.value}),e.createSlots({"item.data-table-expand":e.withCtx(({internalItem:n,isExpanded:c,toggleExpand:x})=>[e.renderSlot(t.$slots,"item.data-table-expand",{internalItem:n,isExpanded:c,toggleExpand:x},()=>[e.createVNode(a,{onClick:re=>x(n),rounded:""},{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c(n)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])])]),"expanded-row":e.withCtx(({columns:n,item:c})=>[e.renderSlot(t.$slots,"expanded-row",{columns:n,item:c})]),"item.actions":e.withCtx(({item:n})=>[e.renderSlot(t.$slots,"before-actions",{item:n}),l.showViewButton?(e.openBlock(),e.createBlock(q,{key:0,text:l.viewButtonText},{activator:e.withCtx(({props:c})=>{var x;return[e.createVNode(a,e.mergeProps({icon:"",flat:"",onClick:re=>Xe(n)},c,{disabled:(x=l.disableView)==null?void 0:x.call(l,n)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"view-icon",{},()=>[g(V.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V.value),e.mergeProps({key:0,size:20,class:"text-info"},S.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showEditButton?(e.openBlock(),e.createBlock(q,{key:1,text:l.editButtonText},{activator:e.withCtx(({props:c})=>{var x;return[e.createVNode(a,e.mergeProps({icon:"",flat:"",onClick:re=>Je(n)},c,{disabled:(x=l.disableEdit)==null?void 0:x.call(l,n)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"edit-icon",{},()=>[g(p.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),e.mergeProps({key:0,size:20,class:"text-primary"},S.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showDeleteButton?(e.openBlock(),e.createBlock(q,{key:2,text:l.deleteButtonText},{activator:e.withCtx(({props:c})=>{var x;return[e.createVNode(a,e.mergeProps({icon:"",flat:"",onClick:re=>Ze(n)},c,{disabled:(x=l.disableDelete)==null?void 0:x.call(l,n)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"delete-icon",{},()=>[g(B.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(B.value),e.mergeProps({key:0,size:20,class:"text-error"},S.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(B.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after-actions",{item:n})]),tfoot:e.withCtx(()=>[e.createElementVNode("tfoot",null,[e.renderSlot(t.$slots,"item.tfoot",{columns:J.value})])]),_:2},[l.showSelect?{name:"top",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"selection-actions",{selected:N.value,count:N.value.length,clear:Re})]),key:"0"}:void 0,e.renderList(ze.value,n=>({name:`item.${n.key}`,fn:e.withCtx(({item:c})=>[e.renderSlot(t.$slots,`item.${n.key}`,{item:c},()=>[e.createTextVNode(e.toDisplayString(c[n.key]),1)])])}))]),1040,["headers","items","loading","items-length","items-per-page","search","sort-by","page","item-value","show-expand","show-select","select-strategy","modelValue","class"]),o[9]||(o[9]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--left"},null,-1)),o[10]||(o[10]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--right"},null,-1)),le.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vdt-arrow vdt-arrow--left","aria-label":y("scrollLeft"),onClick:o[7]||(o[7]=n=>ye(-1))},[e.createVNode(h,{icon:He,size:"20"})],8,_e)):e.createCommentVNode("",!0),j.value?(e.openBlock(),e.createBlock(q,{key:1,text:y("scrollRight"),disabled:ge.value,location:"top"},{activator:e.withCtx(({props:n})=>[e.createElementVNode("button",e.mergeProps(n,{type:"button",class:"vdt-arrow vdt-arrow--right","aria-label":y("scrollRight"),onClick:o[8]||(o[8]=c=>ye(1))}),[e.createVNode(h,{icon:Oe,size:"20"})],16,Ee)]),_:1},8,["text","disabled"])):e.createCommentVNode("",!0),ge.value?(e.openBlock(),e.createElementBlock("span",Pe,e.toDisplayString(y("scrollHint")),1)):e.createCommentVNode("",!0)],544),e.createVNode(we,{show:A.value,title:l.deleteModalTitle,description:l.deleteModalMessage,confirmButtonText:l.deleteModalConfirmButtonText,cancelButtonText:l.deleteModalCancelButtonText,onClose:We,onConfirm:Qe},null,8,["show","title","description","confirmButtonText","cancelButtonText"])],6)}}}),Ae={install(l){l.component("DataTable",ie)}};v.DATA_TABLE_CONFIG_KEY=F,v.DataTable=ie,v.createDataTableConfig=ke,v.default=Ae,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(x,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(x=typeof globalThis<"u"?globalThis:x||self,e(x.VuetifyDatatable={},x.Vue))})(this,(function(x,e){"use strict";function xe(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var I={exports:{}},ce;function Ce(){if(ce)return I.exports;ce=1;function l(C,w=100,k={}){if(typeof C!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof C}\`.`);if(w<0)throw new RangeError("`wait` must not be negative.");const{immediate:m}=typeof k=="boolean"?{immediate:k}:k;let i,u,s,V,p;function S(){const g=i,N=u;return i=void 0,u=void 0,p=C.apply(g,N),p}function B(){const g=Date.now()-V;g<w&&g>=0?s=setTimeout(B,w-g):(s=void 0,m||(p=S()))}const d=function(...g){if(i&&this!==i&&Object.getPrototypeOf(this)===Object.getPrototypeOf(i))throw new Error("Debounced method called with different contexts of the same prototype.");i=this,u=g,V=Date.now();const N=m&&!s;return s||(s=setTimeout(B,w)),N&&(p=S()),p};return Object.defineProperty(d,"isPending",{get(){return s!==void 0}}),d.clear=()=>{s&&(clearTimeout(s),s=void 0)},d.flush=()=>{s&&d.trigger()},d.trigger=()=>{p=S(),d.clear()},d}return I.exports.debounce=l,I.exports=l,I.exports}var we=Ce();const ke=xe(we),Ve=e.defineComponent({__name:"ConfirmationModal",props:{show:Boolean,title:String,description:String,confirmButtonText:String,cancelButtonText:String},emits:["close","confirm"],setup(l){const C=l,w=e.computed({get:()=>C.show,set:()=>{}});return(k,m)=>{const i=e.resolveComponent("v-card-title"),u=e.resolveComponent("v-card-text"),s=e.resolveComponent("v-spacer"),V=e.resolveComponent("v-btn"),p=e.resolveComponent("v-card-actions"),S=e.resolveComponent("v-card"),B=e.resolveComponent("v-dialog");return e.openBlock(),e.createBlock(B,{modelValue:w.value,"onUpdate:modelValue":m[2]||(m[2]=d=>w.value=d),"max-width":"500px",persistent:"","no-click-animation":""},{default:e.withCtx(()=>[e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"text-h5 text-center py-6"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.title),1)]),_:1}),l.description?(e.openBlock(),e.createBlock(u,{key:0,class:"text-center px-0 py-0"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.description)+" ",1),e.renderSlot(k.$slots,"description")]),_:3})):e.createCommentVNode("",!0),e.createVNode(p,null,{default:e.withCtx(()=>[e.createVNode(s),e.createVNode(V,{color:"error",variant:"flat",dark:"",onClick:m[0]||(m[0]=d=>k.$emit("close"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.cancelButtonText),1)]),_:1}),e.createVNode(V,{color:"success",variant:"flat",dark:"",onClick:m[1]||(m[1]=d=>k.$emit("confirm"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.confirmButtonText),1)]),_:1}),e.createVNode(s)]),_:1})]),_:3})]),_:3},8,["modelValue"])}}}),G=Symbol("DataTableConfig");function Se(l){return{install(C){C.provide(G,l)}}}const Be='.vdt{position:relative;min-width:0}.vdt-toolbar{display:flex;justify-content:flex-start;padding-bottom:8px}.vdt-body{position:relative}.vdt--pinned .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{position:sticky;right:0;z-index:2;background:rgb(var(--v-theme-surface))}.vdt--pinned.vdt--can-right .v-table__wrapper>table>thead>tr>th:last-child,.vdt--pinned.vdt--can-right .v-table__wrapper>table>tbody>tr.v-data-table__tr>td:last-child{box-shadow:inset 1px 0 rgba(var(--v-border-color),var(--v-border-opacity)),-8px 0 12px -6px #00000026}.vdt-fade{position:absolute;top:var(--vdt-scroll-top, 0px);height:var(--vdt-scroll-h, 100%);width:56px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:3}.vdt-fade--left{left:0;background:linear-gradient(to left,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt-fade--right{right:var(--vdt-pinned-w, 0px);background:linear-gradient(to right,rgba(var(--v-theme-surface),0),rgb(var(--v-theme-surface)))}.vdt--can-left .vdt-fade--left,.vdt--can-right .vdt-fade--right{opacity:1}.vdt-arrow{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 16px);z-index:4;display:flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:thin solid rgba(var(--v-border-color),var(--v-border-opacity));border-radius:50%;background:rgb(var(--v-theme-surface));color:rgb(var(--v-theme-primary));box-shadow:0 4px 12px #00000026;cursor:pointer}.vdt-arrow:focus-visible{outline:2px solid rgb(var(--v-theme-primary));outline-offset:2px}.vdt-arrow--left{left:8px}.vdt-arrow--right{right:calc(var(--vdt-pinned-w, 0px) + 8px)}.vdt-hint{position:absolute;top:calc(var(--vdt-scroll-top, 0px) + var(--vdt-head-h, 48px) / 2 - 24px);right:calc(var(--vdt-pinned-w, 0px) + 8px);z-index:5;transform:translateY(-100%);padding:5px 10px;border-radius:4px;background:rgb(var(--v-theme-surface-variant));color:rgb(var(--v-theme-on-surface-variant));font-size:12px;white-space:nowrap;pointer-events:none}.vdt-hint:after{content:"";position:absolute;top:100%;right:11px;border:5px solid transparent;border-top-color:rgb(var(--v-theme-surface-variant))}.vdt-columns__actions{display:flex;justify-content:space-between;margin:4px 0}.vdt-columns__list{max-height:320px;margin:0;padding:0;overflow-y:auto;list-style:none}.vdt-columns__item{display:flex;align-items:center;gap:4px;border-radius:4px}.vdt-columns__item--over{background:rgba(var(--v-theme-primary),.08)}.vdt-columns__handle{display:flex;padding:4px;border:0;border-radius:4px;background:none;color:rgba(var(--v-theme-on-surface),var(--v-medium-emphasis-opacity));cursor:grab}.vdt-columns__handle:focus-visible{outline:2px solid rgb(var(--v-theme-primary))}',Ne={class:"vdt-toolbar"},De={class:"vdt-columns__actions"},Te={class:"vdt-columns__list"},_e=["onDragstart","onDragover","onDrop"],Ee=["aria-label","title","onKeydown"],Pe=["aria-label"],Me=["aria-label"],$e={key:2,class:"vdt-hint"},H="actions",Le=300,Y=2,Ie="vuetify-datatable:columns:",He="svg:M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z",Oe="svg:M9,3H11V5H9V3M13,3H15V5H13V3M9,7H11V9H9V7M13,7H15V9H13V7M9,11H11V13H9V11M13,11H15V13H13V11M9,15H11V17H9V15M13,15H15V17H13V15M9,19H11V21H9V19M13,19H15V21H13V19Z",Ae="svg:M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",Re="svg:M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",de=e.defineComponent({inheritAttrs:!1,__name:"DataTable",props:{tableClass:{},headers:{default:()=>[]},items:{default:()=>[]},loading:{type:Boolean,default:!1},itemValue:{default:"id"},totalItems:{default:0},itemsPerPage:{default:10},search:{},showExpand:{type:Boolean,default:!1},showSelect:{type:Boolean,default:!1},selectStrategy:{default:"page"},modelValue:{default:()=>[]},showEditButton:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},showViewButton:{type:Boolean,default:!1},viewButtonText:{},deleteButtonText:{},deleteModalTitle:{},deleteModalMessage:{},deleteModalConfirmButtonText:{},deleteModalCancelButtonText:{},editButtonText:{},viewIcon:{},editIcon:{},deleteIcon:{},disableView:{},disableEdit:{},disableDelete:{}},emits:["onLoadData","editItem","deleteItem","viewItem","update:modelValue"],setup(l,{emit:C}){function w(){if(typeof document>"u"||document.getElementById("vuetify-datatable-styles"))return;const t=document.createElement("style");t.id="vuetify-datatable-styles",t.textContent=Be,document.head.appendChild(t)}w();const k=[H,"expanded-row","data-table-expand","data-table-select"],m={columns:"Columns",hiddenColumns:t=>`Columns · ${t} hidden`,searchColumns:"Search columns",showAllColumns:"Show all",hideAllColumns:"Hide all",resetColumns:"Reset",moveColumn:"Drag or use the arrow keys to reorder",scrollHint:"Scroll to see more columns",scrollLeft:"Previous columns",scrollRight:"More columns"},i=l,u=C,s=e.inject(G,{icons:{}}),V=e.computed(()=>{var t;return i.viewIcon??((t=s.icons)==null?void 0:t.view)??"mdi-eye-outline"}),p=e.computed(()=>{var t;return i.editIcon??((t=s.icons)==null?void 0:t.edit)??"mdi-pencil-outline"}),S=e.computed(()=>{var t;return i.deleteIcon??((t=s.icons)==null?void 0:t.delete)??"mdi-trash-can-outline"}),B=e.computed(()=>s.iconProps??{}),d=e.computed(()=>i.tableClass??s.tableClass??"border rounded-md");function g(t){return typeof t!="string"}const N=e.computed({get:()=>i.modelValue,set:t=>u("update:modelValue",t)});function Ke(){u("update:modelValue",[])}const T=e.ref(i.itemsPerPage),O=e.ref([]),A=e.ref(1),Z=e.ref(null),R=e.ref(!1),je=e.computed(()=>{var t;return((t=i.headers)==null?void 0:t.filter(o=>o.key!=="actions"&&o.key!=="expanded-row"&&o.key!=="data-table-expand"))||[]});function y(t){var n;const o=((n=s.texts)==null?void 0:n[t])??m[t];return typeof o=="function"?o():o}const W=e.ref(!1),J=e.ref(""),_=e.ref([]),f=e.ref([]),z=e.ref(null),K=e.ref(null),D=e.computed(()=>i.headers.filter(t=>!k.includes(t.key)&&!!t.title)),E=e.computed(()=>{const t=new Map(D.value.map(n=>[n.key,n]));return[..._.value.filter(n=>t.has(n)).map(n=>t.get(n)),...D.value.filter(n=>!_.value.includes(n.key))]}),Ue=e.computed(()=>{const t=(J.value??"").trim().toLowerCase();return t?E.value.filter(o=>{var n;return(n=o.title)==null?void 0:n.toLowerCase().includes(t)}):E.value}),X=e.computed(()=>new Set(D.value.filter(t=>t.locked).map(t=>t.key))),M=e.computed(()=>D.value.filter(t=>t.hidden&&!t.locked).map(t=>t.key)),P=e.computed(()=>D.value.filter(t=>f.value.includes(t.key)).length),qe=e.computed(()=>E.value.map(t=>({key:t.key,title:t.title??"",visible:!f.value.includes(t.key),locked:X.value.has(t.key)}))),me=e.computed(()=>i.headers.some(t=>t.key===H)),Q=e.computed(()=>{const t=new Set(D.value.map(r=>r.key)),o=[...E.value],n=i.headers.map(r=>t.has(r.key)?o.shift():r);return[...n.filter(r=>r.key!==H&&!f.value.includes(r.key)),...n.filter(r=>r.key===H)]}),ue=e.computed(()=>{var t;return P.value>0?(((t=s.texts)==null?void 0:t.hiddenColumns)??m.hiddenColumns)(P.value):y("columns")});function pe(t,o){X.value.has(t)||(f.value=o?f.value.filter(n=>n!==t):[...f.value,t])}function fe(){f.value=P.value===0?D.value.filter(t=>!t.locked).map(t=>t.key):[]}function he(){_.value=[],f.value=[...M.value]}function ee(t,o){const n=E.value.map(h=>h.key),r=n.indexOf(t),b=n.indexOf(o);r===-1||b===-1||r===b||(n.splice(b,0,...n.splice(r,1)),_.value=n)}function te(t,o){const n=E.value.map(b=>b.key),r=n[n.indexOf(t)+o];r&&ee(t,r)}function Fe(t,o){var n;z.value=o,(n=t.dataTransfer)==null||n.setData("text/plain",o)}function Ge(t){z.value&&ee(z.value,t),ge()}function ge(){z.value=null,K.value=null}const oe=e.computed(()=>{var o;const t=Ie+D.value.map(n=>n.key).sort().join(",");return((o=s.storageKey)==null?void 0:o.call(s,t))??t});e.watch(oe,t=>{try{const o=JSON.parse(localStorage.getItem(t)??"null");_.value=Array.isArray(o==null?void 0:o.order)?o.order:[],f.value=Array.isArray(o==null?void 0:o.hidden)?o.hidden.filter(n=>!X.value.has(n)):[...M.value]}catch{_.value=[],f.value=[...M.value]}},{immediate:!0}),e.watch([_,f],([t,o])=>{try{t.length===0&&o.length===M.value.length&&o.every(r=>M.value.includes(r))?localStorage.removeItem(oe.value):localStorage.setItem(oe.value,JSON.stringify({order:t,hidden:o}))}catch{}});const le=e.ref(null),ne=e.ref(null),j=e.ref(!1),ae=e.ref(!1),U=e.ref(!1),re=e.ref(!1),ye=e.ref({});let $=null;const Ye=e.computed(()=>j.value||P.value>0||W.value),be=e.computed(()=>U.value&&!re.value),Ze=e.computed(()=>({"vdt--pinned":me.value,"vdt--can-left":ae.value,"vdt--can-right":U.value}));function se(){var t;return((t=ne.value)==null?void 0:t.querySelector(".v-table__wrapper"))??null}function q(){const t=ne.value,o=se();if(!t||!o)return;const n=o.scrollWidth-o.clientWidth;j.value=n>Y,ae.value=j.value&&o.scrollLeft>Y,U.value=j.value&&o.scrollLeft<n-Y;const r=me.value?o.querySelector("thead > tr > th:last-child"):null,b=o.querySelector("thead"),h=o.getBoundingClientRect();ye.value={"--vdt-pinned-w":`${(r==null?void 0:r.offsetWidth)??0}px`,"--vdt-scroll-top":`${h.top-t.getBoundingClientRect().top}px`,"--vdt-scroll-h":`${h.height}px`,"--vdt-head-h":`${(b==null?void 0:b.offsetHeight)??48}px`}}function We(t){const o=se();!o||t.target!==o||(o.scrollLeft>10&&(re.value=!0),q())}function ve(t){var o;t===1&&(re.value=!0),(o=se())==null||o.scrollBy({left:t*Le,behavior:"smooth"})}e.watch([Q,()=>i.items,()=>i.loading],()=>e.nextTick(q)),e.onMounted(()=>{L({page:A.value,itemsPerPage:T.value}),typeof ResizeObserver<"u"&&le.value&&($=new ResizeObserver(()=>requestAnimationFrame(q)),$.observe(le.value)),q()}),e.onBeforeUnmount(()=>$==null?void 0:$.disconnect());const Je=t=>{Z.value=t,R.value=!0},Xe=()=>{Z.value=null,R.value=!1},Qe=t=>{u("editItem",t)},et=t=>{u("viewItem",t)},tt=()=>{u("deleteItem",Z.value),R.value=!1},L=({page:t,itemsPerPage:o})=>{const n=O.value.map(r=>({column:r.key,direction:r.order}));u("onLoadData",{page:t,itemsPerPage:o,search:i.search,sortBy:n})};function ot(){L({page:1,itemsPerPage:T.value})}const lt=ke(ot,400);return e.watch(()=>i.search,(t,o)=>{t!==o&&lt()}),e.watch(T,(t,o)=>{t!==o&&L({page:1,itemsPerPage:t})}),e.watch(O,()=>{L({page:1,itemsPerPage:T.value})}),e.watch(A,t=>{L({page:t,itemsPerPage:T.value})}),(t,o)=>{const n=e.resolveComponent("v-btn"),r=e.resolveComponent("v-text-field"),b=e.resolveComponent("v-checkbox-btn"),h=e.resolveComponent("v-icon"),nt=e.resolveComponent("v-card-text"),at=e.resolveComponent("v-card"),rt=e.resolveComponent("v-menu"),F=e.resolveComponent("v-tooltip"),st=e.resolveComponent("v-data-table-server");return e.openBlock(),e.createElementBlock("div",{ref_key:"rootRef",ref:le,class:e.normalizeClass(["vdt",Ze.value]),style:e.normalizeStyle(ye.value)},[e.withDirectives(e.createElementVNode("div",Ne,[e.renderSlot(t.$slots,"column-chooser",{columns:qe.value,hiddenCount:P.value,label:ue.value,setVisible:pe,toggleAll:fe,reset:he,move:te,place:ee},()=>[e.createVNode(rt,{modelValue:W.value,"onUpdate:modelValue":o[2]||(o[2]=a=>W.value=a),"close-on-content-click":!1,location:"bottom start"},{activator:e.withCtx(({props:a})=>[e.createVNode(n,e.mergeProps(a,{class:"vdt-columns__button",variant:"outlined",color:"primary",size:"small","prepend-icon":He}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(ue.value),1)]),_:1},16)]),default:e.withCtx(()=>[e.createVNode(at,{class:"vdt-columns","min-width":"280"},{default:e.withCtx(()=>[e.createVNode(nt,{class:"pa-3"},{default:e.withCtx(()=>[e.createVNode(r,{modelValue:J.value,"onUpdate:modelValue":o[0]||(o[0]=a=>J.value=a),placeholder:y("searchColumns"),density:"compact",variant:"outlined","hide-details":"",clearable:""},null,8,["modelValue","placeholder"]),e.createElementVNode("div",De,[e.createVNode(n,{variant:"text",size:"small",color:"primary",onClick:fe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(P.value===0?y("hideAllColumns"):y("showAllColumns")),1)]),_:1}),e.createVNode(n,{variant:"text",size:"small",onClick:he},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y("resetColumns")),1)]),_:1})]),e.createElementVNode("ul",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Ue.value,a=>(e.openBlock(),e.createElementBlock("li",{key:a.key,class:e.normalizeClass(["vdt-columns__item",{"vdt-columns__item--over":K.value===a.key}]),draggable:"true",onDragstart:c=>Fe(c,a.key),onDragover:e.withModifiers(c=>K.value=a.key,["prevent"]),onDragleave:o[1]||(o[1]=c=>K.value=null),onDrop:e.withModifiers(c=>Ge(a.key),["prevent"]),onDragend:ge},[e.createVNode(b,{"model-value":!f.value.includes(a.key),label:a.title,disabled:!!a.locked,density:"compact",class:"flex-grow-1","onUpdate:modelValue":c=>pe(a.key,!!c)},null,8,["model-value","label","disabled","onUpdate:modelValue"]),e.createElementVNode("button",{type:"button",class:"vdt-columns__handle","aria-label":`${y("moveColumn")}: ${a.title}`,title:y("moveColumn"),onKeydown:[e.withKeys(e.withModifiers(c=>te(a.key,-1),["prevent"]),["up"]),e.withKeys(e.withModifiers(c=>te(a.key,1),["prevent"]),["down"])]},[e.createVNode(h,{icon:Oe,size:"18"})],40,Ee)],42,_e))),128))])]),_:1})]),_:1})]),_:1},8,["modelValue"])])],512),[[e.vShow,Ye.value]]),e.createElementVNode("div",{ref_key:"bodyRef",ref:ne,class:"vdt-body",onScrollCapturePassive:We},[e.createVNode(st,e.mergeProps(t.$attrs,{headers:Q.value,items:l.items,loading:l.loading,"items-length":l.totalItems,"items-per-page":T.value,"onUpdate:itemsPerPage":o[3]||(o[3]=a=>T.value=a),search:l.search,"sort-by":O.value,"onUpdate:sortBy":o[4]||(o[4]=a=>O.value=a),page:A.value,"onUpdate:page":o[5]||(o[5]=a=>A.value=a),"item-value":l.itemValue,"show-expand":l.showExpand,"show-select":l.showSelect,"select-strategy":l.selectStrategy,modelValue:N.value,"onUpdate:modelValue":o[6]||(o[6]=a=>N.value=a),class:d.value}),e.createSlots({"item.data-table-expand":e.withCtx(({internalItem:a,isExpanded:c,toggleExpand:v})=>[e.renderSlot(t.$slots,"item.data-table-expand",{internalItem:a,isExpanded:c,toggleExpand:v},()=>[e.createVNode(n,{onClick:ie=>v(a),rounded:""},{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c(a)?"mdi-chevron-up":"mdi-chevron-down"),1)]),_:2},1024)]),_:2},1032,["onClick"])])]),"expanded-row":e.withCtx(({columns:a,item:c})=>[e.renderSlot(t.$slots,"expanded-row",{columns:a,item:c})]),"item.actions":e.withCtx(({item:a})=>[e.renderSlot(t.$slots,"before-actions",{item:a}),l.showViewButton?(e.openBlock(),e.createBlock(F,{key:0,text:l.viewButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>et(a)},c,{disabled:(v=l.disableView)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"view-icon",{},()=>[g(V.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V.value),e.mergeProps({key:0,size:20,class:"text-info"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-info"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showEditButton?(e.openBlock(),e.createBlock(F,{key:1,text:l.editButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>Qe(a)},c,{disabled:(v=l.disableEdit)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"edit-icon",{},()=>[g(p.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value),e.mergeProps({key:0,size:20,class:"text-primary"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),l.showDeleteButton?(e.openBlock(),e.createBlock(F,{key:2,text:l.deleteButtonText},{activator:e.withCtx(({props:c})=>{var v;return[e.createVNode(n,e.mergeProps({icon:"",flat:"",onClick:ie=>Je(a)},c,{disabled:(v=l.disableDelete)==null?void 0:v.call(l,a)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"delete-icon",{},()=>[g(S.value)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(S.value),e.mergeProps({key:0,size:20,class:"text-error"},B.value),null,16)):(e.openBlock(),e.createBlock(h,{key:1,size:"20",class:"text-error"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.value),1)]),_:1}))])]),_:3},16,["onClick","disabled"])]}),_:2},1032,["text"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"after-actions",{item:a})]),tfoot:e.withCtx(()=>[e.createElementVNode("tfoot",null,[e.renderSlot(t.$slots,"item.tfoot",{columns:Q.value})])]),_:2},[l.showSelect?{name:"top",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"selection-actions",{selected:N.value,count:N.value.length,clear:Ke})]),key:"0"}:void 0,e.renderList(je.value,a=>({name:`item.${a.key}`,fn:e.withCtx(({item:c})=>[e.renderSlot(t.$slots,`item.${a.key}`,{item:c},()=>[e.createTextVNode(e.toDisplayString(c[a.key]),1)])])}))]),1040,["headers","items","loading","items-length","items-per-page","search","sort-by","page","item-value","show-expand","show-select","select-strategy","modelValue","class"]),o[9]||(o[9]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--left"},null,-1)),o[10]||(o[10]=e.createElementVNode("div",{class:"vdt-fade vdt-fade--right"},null,-1)),ae.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vdt-arrow vdt-arrow--left","aria-label":y("scrollLeft"),onClick:o[7]||(o[7]=a=>ve(-1))},[e.createVNode(h,{icon:Ae,size:"20"})],8,Pe)):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createBlock(F,{key:1,text:y("scrollRight"),disabled:be.value,location:"top"},{activator:e.withCtx(({props:a})=>[e.createElementVNode("button",e.mergeProps(a,{type:"button",class:"vdt-arrow vdt-arrow--right","aria-label":y("scrollRight"),onClick:o[8]||(o[8]=c=>ve(1))}),[e.createVNode(h,{icon:Re,size:"20"})],16,Me)]),_:1},8,["text","disabled"])):e.createCommentVNode("",!0),be.value?(e.openBlock(),e.createElementBlock("span",$e,e.toDisplayString(y("scrollHint")),1)):e.createCommentVNode("",!0)],544),e.createVNode(Ve,{show:R.value,title:l.deleteModalTitle,description:l.deleteModalMessage,confirmButtonText:l.deleteModalConfirmButtonText,cancelButtonText:l.deleteModalCancelButtonText,onClose:Xe,onConfirm:tt},null,8,["show","title","description","confirmButtonText","cancelButtonText"])],6)}}}),ze={install(l){l.component("DataTable",de)}};x.DATA_TABLE_CONFIG_KEY=G,x.DataTable=de,x.createDataTableConfig=Se,x.default=ze,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazzadev/vuetify-datatable",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Reusable server-side DataTable component for Vuetify 3 and 4",
5
5
  "type": "module",
6
6
  "main": "./dist/vuetify-datatable.umd.cjs",