@dcodegroup-au/dsg-vue 0.1.29 → 0.1.31

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.
@@ -1,11 +1,11 @@
1
- import { defineComponent as j, useModel as G, computed as O, withDirectives as be, openBlock as s, createElementBlock as r, normalizeClass as U, createVNode as I, createCommentVNode as y, createElementVNode as P, Fragment as H, renderList as N, vShow as Ve, mergeModels as J, ref as D, useTemplateRef as De, useAttrs as ze, unref as W, withCtx as X, renderSlot as M, toDisplayString as se, createBlock as V, resolveDynamicComponent as Oe, onMounted as $e, normalizeStyle as ae, mergeProps as fe, watch as te, Transition as We, createTextVNode as Ne, useSlots as je, createSlots as Ke, normalizeProps as Qe, nextTick as we, vModelSelect as Ye } from "vue";
2
- import { _ as z, k as Ge, v as Je, f as Xe, u as Ze, c as Ce, b as ke, j as Se, e as Pe, i as Te } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-C44nlrX2.js";
3
- import { ucfirst as _e, ucwords as pe, toSnakeCase as et } from "./dsg-vue.helpers-string.esm.js";
4
- import { data_get as ve } from "./dsg-vue.helpers-object.esm.js";
5
- import { isEmpty as tt } from "./dsg-vue.helpers.esm.js";
6
- const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disabled"], nt = ["onClick", "innerHTML"], ot = ["onClick", "innerHTML"], it = ["disabled"], rt = ["disabled"], xe = /* @__PURE__ */ j({
1
+ import { defineComponent as Q, useModel as X, computed as W, withDirectives as ke, openBlock as s, createElementBlock as d, normalizeClass as B, createVNode as I, createCommentVNode as y, createElementVNode as k, Fragment as H, renderList as j, vShow as Ye, mergeModels as Z, ref as x, useTemplateRef as Fe, useAttrs as Ge, unref as N, withCtx as _, renderSlot as F, toDisplayString as ne, createBlock as O, resolveDynamicComponent as Je, onMounted as Me, normalizeStyle as le, mergeProps as pe, watch as ae, withModifiers as Xe, Transition as Ze, createTextVNode as _e, useSlots as et, createSlots as tt, normalizeProps as at, nextTick as $e, vModelSelect as lt } from "vue";
2
+ import { _ as z, k as st, v as nt, f as ot, u as it, c as Be, b as Se, j as Ee, e as Te, i as Le } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-C44nlrX2.js";
3
+ import { ucfirst as dt, ucwords as Re, toSnakeCase as rt } from "./dsg-vue.helpers-string.esm.js";
4
+ import { data_get as ye } from "./dsg-vue.helpers-object.esm.js";
5
+ import { isEmpty as ut } from "./dsg-vue.helpers.esm.js";
6
+ const ct = { class: "dsg-table--pagination" }, gt = ["disabled"], vt = ["disabled"], ft = ["onClick", "innerHTML"], bt = ["onClick", "innerHTML"], ht = ["disabled"], wt = ["disabled"], Ae = /* @__PURE__ */ Q({
7
7
  __name: "DsgTablePagination",
8
- props: /* @__PURE__ */ J({
8
+ props: /* @__PURE__ */ Z({
9
9
  onEachSide: { default: 3 },
10
10
  firstPage: { default: 1 },
11
11
  showFirstLast: { type: Boolean, default: !0 },
@@ -17,18 +17,18 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
17
17
  pagination: { default: null },
18
18
  paginationModifiers: {}
19
19
  }),
20
- emits: /* @__PURE__ */ J(["dsg-table:change-page"], ["update:pagination"]),
21
- setup(e, { expose: L, emit: v }) {
22
- const d = G(e, "pagination"), S = O(() => d.value === null ? 0 : d.value?.last_page - e.firstPage + 1), B = O(() => d.value === null ? 0 : d.value?.last_page), g = O(() => d.value === null ? !1 : d.value?.current_page === e.firstPage), b = O(() => d.value === null ? !1 : d.value?.current_page === B.value), E = O(() => S.value < e.onEachSide * 2 + 4), F = O(() => e.onEachSide * 2 + 1), T = O(() => !d.value || d.value?.current_page <= e.onEachSide ? 1 : d.value?.current_page >= S.value - e.onEachSide ? S.value - e.onEachSide * 2 : d.value?.current_page - e.onEachSide), h = v, a = (w) => {
23
- h("dsg-table:change-page", w);
24
- }, u = (w) => w === d.value?.current_page;
25
- return L({
26
- loadPage: a
27
- }), (w, m) => be((s(), r("div", at, [
28
- e.showFirstLast ? (s(), r("a", {
20
+ emits: /* @__PURE__ */ Z(["dsg-table:change-page"], ["update:pagination"]),
21
+ setup(e, { expose: M, emit: v }) {
22
+ const u = X(e, "pagination"), $ = W(() => u.value === null ? 0 : u.value?.last_page - e.firstPage + 1), E = W(() => u.value === null ? 0 : u.value?.last_page), g = W(() => u.value === null ? !1 : u.value?.current_page === e.firstPage), b = W(() => u.value === null ? !1 : u.value?.current_page === E.value), L = W(() => $.value < e.onEachSide * 2 + 4), R = W(() => e.onEachSide * 2 + 1), S = W(() => !u.value || u.value?.current_page <= e.onEachSide ? 1 : u.value?.current_page >= $.value - e.onEachSide ? $.value - e.onEachSide * 2 : u.value?.current_page - e.onEachSide), w = v, l = (p) => {
23
+ w("dsg-table:change-page", p);
24
+ }, c = (p) => p === u.value?.current_page;
25
+ return M({
26
+ loadPage: l
27
+ }), (p, m) => ke((s(), d("div", ct, [
28
+ e.showFirstLast ? (s(), d("a", {
29
29
  key: 0,
30
- onClick: m[0] || (m[0] = ($) => a(e.firstPage)),
31
- class: U([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
30
+ onClick: m[0] || (m[0] = (P) => l(e.firstPage)),
31
+ class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
32
32
  disabled: g.value,
33
33
  title: "First",
34
34
  "aria-label": "First"
@@ -37,10 +37,10 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
37
37
  icon: e.firstIcon,
38
38
  size: "sm"
39
39
  }, null, 8, ["icon"])
40
- ], 10, lt)) : y("", !0),
41
- P("a", {
42
- onClick: m[1] || (m[1] = ($) => a("prev")),
43
- class: U([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
40
+ ], 10, gt)) : y("", !0),
41
+ k("a", {
42
+ onClick: m[1] || (m[1] = (P) => l("prev")),
43
+ class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
44
44
  disabled: g.value,
45
45
  title: "Previous",
46
46
  "aria-label": "Previous"
@@ -49,21 +49,21 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
49
49
  icon: e.prevIcon,
50
50
  size: "sm"
51
51
  }, null, 8, ["icon"])
52
- ], 10, st),
53
- E.value ? (s(!0), r(H, { key: 1 }, N(S.value, ($, A) => (s(), r("a", {
54
- key: A,
55
- onClick: (Z) => a(A + e.firstPage),
56
- class: U([[u(A + e.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
57
- innerHTML: $
58
- }, null, 10, nt))), 128)) : (s(!0), r(H, { key: 2 }, N(F.value, ($, A) => (s(), r("a", {
59
- key: A,
60
- onClick: (Z) => a(T.value + A + e.firstPage - 1),
61
- class: U([[u(T.value + A + e.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
62
- innerHTML: T.value + $ - 1
63
- }, null, 10, ot))), 128)),
64
- P("a", {
65
- onClick: m[2] || (m[2] = ($) => a("next")),
66
- class: U([[b.value ? "disabled" : ""], "dsg-table--pagination-link"]),
52
+ ], 10, vt),
53
+ L.value ? (s(!0), d(H, { key: 1 }, j($.value, (P, q) => (s(), d("a", {
54
+ key: q,
55
+ onClick: (ee) => l(q + e.firstPage),
56
+ class: B([[c(q + e.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
57
+ innerHTML: P
58
+ }, null, 10, ft))), 128)) : (s(!0), d(H, { key: 2 }, j(R.value, (P, q) => (s(), d("a", {
59
+ key: q,
60
+ onClick: (ee) => l(S.value + q + e.firstPage - 1),
61
+ class: B([[c(S.value + q + e.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
62
+ innerHTML: S.value + P - 1
63
+ }, null, 10, bt))), 128)),
64
+ k("a", {
65
+ onClick: m[2] || (m[2] = (P) => l("next")),
66
+ class: B([[b.value ? "disabled" : ""], "dsg-table--pagination-link"]),
67
67
  disabled: b.value,
68
68
  title: "Next",
69
69
  "aria-label": "Next"
@@ -72,11 +72,11 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
72
72
  icon: e.nextIcon,
73
73
  size: "sm"
74
74
  }, null, 8, ["icon"])
75
- ], 10, it),
76
- e.showFirstLast ? (s(), r("a", {
75
+ ], 10, ht),
76
+ e.showFirstLast ? (s(), d("a", {
77
77
  key: 3,
78
- onClick: m[3] || (m[3] = ($) => a(B.value)),
79
- class: U([[b.value ? "disabled" : ""], "dsg-table--pagination-link"]),
78
+ onClick: m[3] || (m[3] = (P) => l(E.value)),
79
+ class: B([[b.value ? "disabled" : ""], "dsg-table--pagination-link"]),
80
80
  disabled: b.value,
81
81
  title: "Last",
82
82
  "aria-label": "Last"
@@ -85,14 +85,14 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
85
85
  icon: e.lastIcon,
86
86
  size: "sm"
87
87
  }, null, 8, ["icon"])
88
- ], 10, rt)) : y("", !0)
88
+ ], 10, wt)) : y("", !0)
89
89
  ], 512)), [
90
- [Ve, d.value && B.value > e.firstPage]
90
+ [Ye, u.value && E.value > e.firstPage]
91
91
  ]);
92
92
  }
93
- }), dt = ["innerHTML"], Fe = /* @__PURE__ */ j({
93
+ }), mt = ["innerHTML"], Ue = /* @__PURE__ */ Q({
94
94
  __name: "DsgTablePaginationInfo",
95
- props: /* @__PURE__ */ J({
95
+ props: /* @__PURE__ */ Z({
96
96
  infoTemplate: { default: "Displaying {from} to {to} of {total} items" },
97
97
  noDataTemplate: { default: "No relevant data" }
98
98
  }, {
@@ -101,29 +101,29 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
101
101
  }),
102
102
  emits: ["update:pagination"],
103
103
  setup(e) {
104
- const L = G(e, "pagination"), v = O(() => L.value == null || L.value.total == 0 ? e.noDataTemplate : e.infoTemplate.replace("{from}", (L.value?.from || 0).toString()).replace("{to}", (L.value?.to || 0).toString()).replace("{total}", (L.value?.total || 0).toString()));
105
- return (d, S) => (s(), r("div", {
104
+ const M = X(e, "pagination"), v = W(() => M.value == null || M.value.total == 0 ? e.noDataTemplate : e.infoTemplate.replace("{from}", (M.value?.from || 0).toString()).replace("{to}", (M.value?.to || 0).toString()).replace("{total}", (M.value?.total || 0).toString()));
105
+ return (u, $) => (s(), d("div", {
106
106
  class: "dsg-table--pagination-info",
107
107
  innerHTML: v.value
108
- }, null, 8, dt));
108
+ }, null, 8, mt));
109
109
  }
110
- }), ut = {
110
+ }), yt = {
111
111
  class: "dsg-table--actions",
112
112
  ref: "dsgTableActions"
113
- }, ct = { class: "dsg-table--action-trigger" }, gt = {
113
+ }, pt = { class: "dsg-table--action-trigger" }, kt = {
114
114
  key: 0,
115
115
  class: "dsg-table--actions-menu-wrapper"
116
- }, vt = ["href", "target", "onClick"], ft = ["textContent"], bt = { key: 0 }, ht = { key: 1 }, mt = ["href", "target", "onClick"], yt = { class: "flex-1" }, Me = /* @__PURE__ */ j({
116
+ }, Pt = ["href", "target", "onClick"], Dt = ["textContent"], xt = { key: 0 }, Ct = { key: 1 }, $t = ["href", "target", "onClick"], St = { class: "flex-1" }, He = /* @__PURE__ */ Q({
117
117
  __name: "DsgTableActions",
118
118
  props: {
119
119
  placement: { default: "auto" }
120
120
  },
121
121
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked"],
122
- setup(e, { emit: L }) {
123
- const v = D(!1);
124
- De("dsgTableActions");
125
- const d = ze(), S = D(d.data.rowData?.actions ?? null), B = D(d.data.rowData?.links ?? null), g = D(d.data.rowData ?? null), b = (h) => {
126
- switch (h) {
122
+ setup(e, { emit: M }) {
123
+ const v = x(!1);
124
+ Fe("dsgTableActions");
125
+ const u = Ge(), $ = x(u.data.rowData?.actions ?? null), E = x(u.data.rowData?.links ?? null), g = x(u.data.rowData ?? null), b = (w) => {
126
+ switch (w) {
127
127
  case "edit":
128
128
  return "edit-05";
129
129
  case "view":
@@ -135,94 +135,94 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
135
135
  default:
136
136
  return "dots-horizontal";
137
137
  }
138
- }, E = (h, a, u) => {
139
- switch (a) {
138
+ }, L = (w, l, c) => {
139
+ switch (l) {
140
140
  case "edit":
141
- T("dsg-table:action-edit", u, g.value);
141
+ S("dsg-table:action-edit", c, g.value);
142
142
  break;
143
143
  case "view":
144
- T("dsg-table:action-view", u, g.value);
144
+ S("dsg-table:action-view", c, g.value);
145
145
  break;
146
146
  case "delete":
147
- T("dsg-table:action-delete", u, g.value);
147
+ S("dsg-table:action-delete", c, g.value);
148
148
  break;
149
149
  case "archive":
150
- T("dsg-table:action-archive", u, g.value);
150
+ S("dsg-table:action-archive", c, g.value);
151
151
  break;
152
152
  }
153
- }, F = (h, a) => {
154
- const u = h.actionId || h.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
155
- T("dsg-table:link-clicked", a, u, g.value);
156
- }, T = L;
157
- return (h, a) => be((s(), r("div", ut, [
158
- I(W(Ge), {
153
+ }, R = (w, l) => {
154
+ const c = w.actionId || w.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
155
+ S("dsg-table:link-clicked", l, c, g.value);
156
+ }, S = M;
157
+ return (w, l) => ke((s(), d("div", yt, [
158
+ I(N(st), {
159
159
  triggers: [],
160
160
  placement: e.placement,
161
161
  "handle-resize": !0,
162
162
  strategy: "absolute",
163
163
  shown: v.value,
164
164
  class: "dsg-table--actions__popper",
165
- onHide: a[1] || (a[1] = (u) => v.value = !1),
165
+ onHide: l[1] || (l[1] = (c) => v.value = !1),
166
166
  ref: "floatingVueFilterDropdown"
167
167
  }, {
168
- popper: X(() => [
169
- v.value ? (s(), r("div", gt, [
170
- (s(!0), r(H, null, N(S.value, (u, w) => (s(), r(H, null, [
171
- ["edit", "view", "delete", "archive"].includes(String(w)) ? (s(), r("a", {
172
- key: w,
173
- href: u?.link,
174
- target: u?.target || "_self",
175
- onClick: (m) => E(u, String(w), m)
168
+ popper: _(() => [
169
+ v.value ? (s(), d("div", kt, [
170
+ (s(!0), d(H, null, j($.value, (c, p) => (s(), d(H, null, [
171
+ ["edit", "view", "delete", "archive"].includes(String(p)) ? (s(), d("a", {
172
+ key: p,
173
+ href: c?.link,
174
+ target: c?.target || "_self",
175
+ onClick: (m) => L(c, String(p), m)
176
176
  }, [
177
- P("div", {
178
- class: U(["dsg-table--actions-menu-item", String(w)])
177
+ k("div", {
178
+ class: B(["dsg-table--actions-menu-item", String(p)])
179
179
  }, [
180
180
  I(z, {
181
- icon: b(String(w)),
181
+ icon: b(String(p)),
182
182
  size: "sm"
183
183
  }, null, 8, ["icon"]),
184
- P("span", {
184
+ k("span", {
185
185
  class: "flex-1",
186
- textContent: se(W(_e)(String(w)))
187
- }, null, 8, ft)
186
+ textContent: ne(N(dt)(String(p)))
187
+ }, null, 8, Dt)
188
188
  ], 2)
189
- ], 8, vt)) : y("", !0)
189
+ ], 8, Pt)) : y("", !0)
190
190
  ], 64))), 256)),
191
- S.value && B.value ? (s(), r("hr", bt)) : y("", !0),
192
- B.value ? (s(!0), r(H, { key: 1 }, N(B.value, (u) => (s(), r(H, {
193
- key: u.label
191
+ $.value && E.value ? (s(), d("hr", xt)) : y("", !0),
192
+ E.value ? (s(!0), d(H, { key: 1 }, j(E.value, (c) => (s(), d(H, {
193
+ key: c.label
194
194
  }, [
195
- u.hasOwnProperty("component") ? (s(), V(Oe(u.component), {
195
+ c.hasOwnProperty("component") ? (s(), O(Je(c.component), {
196
196
  key: 0,
197
- quote: W(d).data.data.rowData,
198
- "row-data": W(d).data.data.rowData
199
- }, null, 8, ["quote", "row-data"])) : u.hasOwnProperty("type") && u.type == "break" ? (s(), r("hr", ht)) : (s(), r("a", {
197
+ quote: N(u).data.data.rowData,
198
+ "row-data": N(u).data.data.rowData
199
+ }, null, 8, ["quote", "row-data"])) : c.hasOwnProperty("type") && c.type == "break" ? (s(), d("hr", Ct)) : (s(), d("a", {
200
200
  key: 2,
201
- href: u.link,
202
- target: u.target || "_self",
203
- class: U(["dsg-table--actions-menu-item", u.class]),
204
- onClick: (w) => F(u, w)
201
+ href: c.link,
202
+ target: c.target || "_self",
203
+ class: B(["dsg-table--actions-menu-item", c.class]),
204
+ onClick: (p) => R(c, p)
205
205
  }, [
206
- u.icon ? (s(), V(z, {
206
+ c.icon ? (s(), O(z, {
207
207
  key: 0,
208
- icon: u.icon,
208
+ icon: c.icon,
209
209
  size: "sm"
210
210
  }, null, 8, ["icon"])) : y("", !0),
211
- P("span", yt, se(u.label), 1)
212
- ], 10, mt))
211
+ k("span", St, ne(c.label), 1)
212
+ ], 10, $t))
213
213
  ], 64))), 128)) : y("", !0)
214
214
  ])) : y("", !0)
215
215
  ]),
216
- default: X(() => [
217
- P("div", ct, [
218
- P("button", {
216
+ default: _(() => [
217
+ k("div", pt, [
218
+ k("button", {
219
219
  type: "button",
220
220
  class: "dsg-table--actions-button",
221
221
  "aria-expanded": "false",
222
222
  "aria-haspopup": "true",
223
- onClick: a[0] || (a[0] = (u) => v.value = !v.value)
223
+ onClick: l[0] || (l[0] = (c) => v.value = !v.value)
224
224
  }, [
225
- M(h.$slots, "dsg-table-action-button-content", {}, () => [
225
+ F(w.$slots, "dsg-table-action-button-content", {}, () => [
226
226
  I(z, {
227
227
  icon: "dots-vertical",
228
228
  size: "sm"
@@ -234,10 +234,10 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
234
234
  _: 3
235
235
  }, 8, ["placement", "shown"])
236
236
  ])), [
237
- [W(Je), () => v.value = !1]
237
+ [N(nt), () => v.value = !1]
238
238
  ]);
239
239
  }
240
- }), wt = { class: "dsg-table--search" }, Le = /* @__PURE__ */ j({
240
+ }), Tt = { class: "dsg-table--search" }, Ie = /* @__PURE__ */ Q({
241
241
  __name: "DsgTableSearch",
242
242
  props: {
243
243
  name: {},
@@ -252,21 +252,21 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
252
252
  replaceState: { type: Boolean, default: !0 }
253
253
  },
254
254
  emits: ["dsg-table:term-changed"],
255
- setup(e, { emit: L }) {
256
- const v = D("");
257
- $e(() => {
255
+ setup(e, { emit: M }) {
256
+ const v = x("");
257
+ Me(() => {
258
258
  const g = new URL(window.location.href).searchParams.get("term");
259
- g && (v.value = g, d("dsg-table:term-changed", g));
259
+ g && (v.value = g, u("dsg-table:term-changed", g));
260
260
  });
261
- const d = L, S = Ze((B) => {
262
- if (v.value = B, e.replaceState) {
261
+ const u = M, $ = it((E) => {
262
+ if (v.value = E, e.replaceState) {
263
263
  const g = new URL(window.location.href);
264
264
  v.value ? g.searchParams.set("term", v.value) : g.searchParams.delete("term"), window.history.pushState({}, "", g.toString());
265
265
  }
266
- d("dsg-table:term-changed", v.value);
266
+ u("dsg-table:term-changed", v.value);
267
267
  }, 300);
268
- return (B, g) => (s(), r("div", wt, [
269
- I(Xe, {
268
+ return (E, g) => (s(), d("div", Tt, [
269
+ I(ot, {
270
270
  modelValue: v.value,
271
271
  "onUpdate:modelValue": g[0] || (g[0] = (b) => v.value = b),
272
272
  name: e.name,
@@ -281,26 +281,26 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
281
281
  size: "sm",
282
282
  icon: "search-sm",
283
283
  "icon-clickable": !0,
284
- onIconClicked: g[1] || (g[1] = (b) => W(S)(b)),
285
- onEnterPressed: g[2] || (g[2] = (b) => W(S)(b)),
286
- onOnClear: g[3] || (g[3] = () => W(S)(""))
284
+ onIconClicked: g[1] || (g[1] = (b) => N($)(b)),
285
+ onEnterPressed: g[2] || (g[2] = (b) => N($)(b)),
286
+ onOnClear: g[3] || (g[3] = () => N($)(""))
287
287
  }, null, 8, ["modelValue", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
288
288
  ]));
289
289
  }
290
- }), kt = { class: "dsg-table--header-row" }, Pt = {
290
+ }), Rt = { class: "dsg-table--header-row" }, Ft = {
291
291
  key: 0,
292
292
  class: "dsg-table--th dsg-table--th-checkbox",
293
293
  scope: "col"
294
- }, pt = {
294
+ }, Mt = {
295
295
  key: 1,
296
296
  class: "dsg-table--th dsg-table--th-expand-detail",
297
297
  scope: "col"
298
- }, Dt = ["title", "id", "onClick"], $t = {
298
+ }, Bt = ["title", "id", "onClick"], Et = {
299
299
  key: 0,
300
300
  class: "dsg-table--th-sort-icon"
301
- }, Ct = ["innerHTML"], St = ["innerHTML"], Tt = ["innerHTML"], xt = ["innerHTML"], Be = /* @__PURE__ */ j({
301
+ }, Lt = ["innerHTML"], At = ["innerHTML"], Ut = ["innerHTML"], Ht = ["innerHTML"], qe = /* @__PURE__ */ Q({
302
302
  __name: "DsgTableRowHeader",
303
- props: /* @__PURE__ */ J({
303
+ props: /* @__PURE__ */ Z({
304
304
  fields: {},
305
305
  scrollVisible: { type: Boolean },
306
306
  hasSelectAll: { type: Boolean, default: !1 },
@@ -314,129 +314,132 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
314
314
  hasSelected: { type: Boolean, default: !1 },
315
315
  hasSelectedModifiers: {}
316
316
  }),
317
- emits: /* @__PURE__ */ J(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
318
- setup(e, { emit: L }) {
319
- const v = G(e, "sortField"), d = G(e, "selectedRows"), S = G(e, "hasSelected"), B = D("17px"), g = (T) => {
320
- S.value && d.value.length > 0 && d.value.length !== e.tableDataLength ? (S.value = !0, b("dsg-table:on-select-all")) : !S.value && d.value.length === 0 ? (S.value = !1, b("dsg-table:on-select-all")) : b("dsg-table:on-deselect-all");
321
- }, b = L, E = (T, h) => [
322
- T,
323
- T + "-" + et(String(h?.name)),
324
- h.titleClass || "",
325
- { sortable: h.sortable },
326
- { "sort-active": v.value?.name === h.name }
327
- ], F = (T) => {
328
- T.sortable && (v.value = {
329
- name: String(T?.name),
330
- field: String(T?.sortField),
331
- direction: v.value?.name === T.name && v.value?.direction === "asc" ? "desc" : "asc"
332
- }, b("dsg-table:sort-field", T));
317
+ emits: /* @__PURE__ */ Z(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
318
+ setup(e, { emit: M }) {
319
+ const v = X(e, "sortField"), u = X(e, "selectedRows"), $ = X(e, "hasSelected"), E = x("17px"), g = (S) => {
320
+ $.value && u.value.length > 0 && u.value.length !== e.tableDataLength ? ($.value = !0, b("dsg-table:on-select-all")) : !$.value && u.value.length === 0 ? ($.value = !1, b("dsg-table:on-select-all")) : b("dsg-table:on-deselect-all");
321
+ }, b = M, L = (S, w) => [
322
+ S,
323
+ S + "-" + rt(String(w?.name)),
324
+ w.titleClass || "",
325
+ { sortable: w.sortable },
326
+ { "sort-active": v.value?.name === w.name }
327
+ ], R = (S) => {
328
+ S.sortable && (v.value = {
329
+ name: String(S?.name),
330
+ field: String(S?.sortField),
331
+ direction: v.value?.name === S.name && v.value?.direction === "asc" ? "desc" : "asc"
332
+ }, b("dsg-table:sort-field", S));
333
333
  };
334
- return (T, h) => (s(), r("tr", kt, [
335
- e.hasSelectAll ? (s(), r("th", Pt, [
336
- I(Ce, {
337
- modelValue: S.value,
334
+ return (S, w) => (s(), d("tr", Rt, [
335
+ e.hasSelectAll ? (s(), d("th", Ft, [
336
+ I(Be, {
337
+ modelValue: $.value,
338
338
  "onUpdate:modelValue": [
339
- h[0] || (h[0] = (a) => S.value = a),
339
+ w[0] || (w[0] = (l) => $.value = l),
340
340
  g
341
341
  ],
342
- indeterminate: d.value.length > 0 && d.value.length !== e.tableDataLength
342
+ indeterminate: u.value.length > 0 && u.value.length !== e.tableDataLength
343
343
  }, null, 8, ["modelValue", "indeterminate"])
344
344
  ])) : y("", !0),
345
- e.showExpandDetail ? (s(), r("th", pt)) : y("", !0),
346
- (s(!0), r(H, null, N(e.fields, (a, u) => (s(), r(H, null, [
347
- a?.visible ? (s(), r("th", {
348
- key: u,
349
- class: U(E("dsg-table--th", a)),
350
- style: ae([{ width: a.width || void 0 }, a.style]),
351
- title: a.title + (a.sortable ? " Sort" : ""),
352
- id: "_" + a.name,
353
- onClick: (w) => F(a),
345
+ e.showExpandDetail ? (s(), d("th", Mt)) : y("", !0),
346
+ (s(!0), d(H, null, j(e.fields, (l, c) => (s(), d(H, null, [
347
+ l?.visible ? (s(), d("th", {
348
+ key: c,
349
+ class: B(L("dsg-table--th", l)),
350
+ style: le([{ width: l.width || void 0 }, l.style]),
351
+ title: l.title + (l.sortable ? " Sort" : ""),
352
+ id: "_" + l.name,
353
+ onClick: (p) => R(l),
354
354
  scope: "col"
355
355
  }, [
356
- a.sortable ? (s(), r("div", $t, [
357
- a.tooltip ? (s(), V(ke, fe({
356
+ l.sortable ? (s(), d("div", Et, [
357
+ l.tooltip ? (s(), O(Se, pe({
358
358
  key: 0,
359
359
  ref_for: !0
360
- }, a.tooltip, { class: "dsg-table--th-tooltip" }), {
361
- "dsg-tooltip--trigger": X(() => [
362
- a.title ? (s(), r("span", {
360
+ }, l.tooltip, { class: "dsg-table--th-tooltip" }), {
361
+ "dsg-tooltip--trigger": _(() => [
362
+ l.title ? (s(), d("span", {
363
363
  key: 0,
364
364
  class: "dsg-table--th-title",
365
- innerHTML: a.title
366
- }, null, 8, Ct)) : y("", !0),
367
- a.tooltip.icon ? (s(), V(z, {
365
+ innerHTML: l.title
366
+ }, null, 8, Lt)) : y("", !0),
367
+ l.tooltip.icon ? (s(), O(z, {
368
368
  key: 1,
369
- icon: a.tooltip.icon,
369
+ icon: l.tooltip.icon,
370
370
  class: "inline-flex",
371
371
  size: "xs"
372
372
  }, null, 8, ["icon"])) : y("", !0)
373
373
  ]),
374
374
  _: 2
375
- }, 1040)) : a.title ? (s(), r("span", {
375
+ }, 1040)) : l.title ? (s(), d("span", {
376
376
  key: 1,
377
377
  class: "dsg-table--th-title",
378
- innerHTML: a.title
379
- }, null, 8, St)) : y("", !0),
380
- a.sortable && v.value?.name !== a.name ? (s(), V(z, {
378
+ innerHTML: l.title
379
+ }, null, 8, At)) : y("", !0),
380
+ l.sortable && v.value?.name !== l.name ? (s(), O(z, {
381
381
  key: 2,
382
382
  icon: "chevron-selector-vertical",
383
383
  class: "inline-flex",
384
384
  size: "xs"
385
385
  })) : y("", !0),
386
- a.sortable && v.value?.name === a.name && v.value?.direction === "asc" ? (s(), V(z, {
386
+ l.sortable && v.value?.name === l.name && v.value?.direction === "asc" ? (s(), O(z, {
387
387
  key: 3,
388
388
  icon: "chevron-down",
389
389
  class: "inline-flex",
390
390
  size: "xs"
391
391
  })) : y("", !0),
392
- a.sortable && v.value?.name === a.name && v.value?.direction === "desc" ? (s(), V(z, {
392
+ l.sortable && v.value?.name === l.name && v.value?.direction === "desc" ? (s(), O(z, {
393
393
  key: 4,
394
394
  icon: "chevron-up",
395
395
  class: "inline-flex",
396
396
  size: "xs"
397
397
  })) : y("", !0)
398
- ])) : (s(), r(H, { key: 1 }, [
399
- a.tooltip ? (s(), V(ke, fe({
398
+ ])) : (s(), d(H, { key: 1 }, [
399
+ l.tooltip ? (s(), O(Se, pe({
400
400
  key: 0,
401
401
  ref_for: !0
402
- }, a.tooltip, { class: "dsg-table--th-tooltip" }), {
403
- "dsg-tooltip--trigger": X(() => [
404
- P("span", {
402
+ }, l.tooltip, { class: "dsg-table--th-tooltip" }), {
403
+ "dsg-tooltip--trigger": _(() => [
404
+ k("span", {
405
405
  class: "dsg-table--th-title",
406
- innerHTML: W(pe)(String(a?.title))
407
- }, null, 8, Tt),
408
- a.tooltip.icon ? (s(), V(z, {
406
+ innerHTML: N(Re)(String(l?.title))
407
+ }, null, 8, Ut),
408
+ l.tooltip.icon ? (s(), O(z, {
409
409
  key: 0,
410
- icon: a.tooltip.icon,
410
+ icon: l.tooltip.icon,
411
411
  class: "inline-flex",
412
412
  size: "xs"
413
413
  }, null, 8, ["icon"])) : y("", !0)
414
414
  ]),
415
415
  _: 2
416
- }, 1040)) : (s(), r("span", {
416
+ }, 1040)) : (s(), d("span", {
417
417
  key: 1,
418
418
  class: "dsg-table--th-title",
419
- innerHTML: W(pe)(String(a?.title))
420
- }, null, 8, xt))
419
+ innerHTML: N(Re)(String(l?.title))
420
+ }, null, 8, Ht))
421
421
  ], 64))
422
- ], 14, Dt)) : y("", !0)
422
+ ], 14, Bt)) : y("", !0)
423
423
  ], 64))), 256)),
424
- e.scrollVisible ? (s(), r("th", {
424
+ e.scrollVisible ? (s(), d("th", {
425
425
  key: 2,
426
- style: ae({ width: B.value }),
426
+ style: le({ width: E.value }),
427
427
  class: "dsg-table--th-col-gutter"
428
428
  }, null, 4)) : y("", !0)
429
429
  ]));
430
430
  }
431
- }), Ft = { class: "dsg-table--wrapper" }, Mt = ["span"], Lt = {
431
+ }), It = { class: "dsg-table--wrapper" }, qt = ["span"], Vt = {
432
432
  key: 0,
433
433
  class: "dsg-table--loading"
434
- }, Bt = ["colspan"], Et = ["colspan"], Rt = ["onClick", "onDblclick", "onMouseover"], Ut = {
434
+ }, zt = ["colspan"], Ot = ["colspan"], Wt = ["onClick", "onDblclick", "onMouseover"], Nt = {
435
435
  key: 0,
436
436
  class: "dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"
437
- }, Ht = ["onClick", "onDblclick", "onContextmenu"], It = ["innerHTML"], At = ["onClick"], qt = ["colspan"], Vt = { key: 2 }, zt = ["colspan"], Ot = { class: "dsg-table--footer" }, Wt = /* @__PURE__ */ j({
437
+ }, jt = {
438
+ key: 1,
439
+ class: "dsg-table--tbody-cell dsg-table--tbody-cell-expand"
440
+ }, Kt = ["aria-expanded", "onClick"], Qt = ["onClick", "onDblclick", "onContextmenu"], Yt = ["innerHTML"], Gt = ["onClick"], Jt = ["colspan"], Xt = { key: 2 }, Zt = ["colspan"], _t = { class: "dsg-table--footer" }, ea = /* @__PURE__ */ Q({
438
441
  __name: "DsgTableComponent",
439
- props: /* @__PURE__ */ J({
442
+ props: /* @__PURE__ */ Z({
440
443
  fields: { default: () => [] },
441
444
  isDraggable: { type: Boolean, default: !1 },
442
445
  dragApi: { default: "" },
@@ -459,6 +462,8 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
459
462
  httpOptions: { default: () => ({}) },
460
463
  hasDetailRow: { type: Boolean, default: !1 },
461
464
  showExpandDetail: { type: Boolean, default: !0 },
465
+ expandableRows: { type: Boolean, default: !1 },
466
+ expandMultiple: { type: Boolean, default: !1 },
462
467
  initialPage: { default: 1 },
463
468
  firstPage: { default: 1 },
464
469
  sortOrder: { default: () => [] },
@@ -494,338 +499,378 @@ const at = { class: "dsg-table--pagination" }, lt = ["disabled"], st = ["disable
494
499
  perPage: { default: 20 },
495
500
  perPageModifiers: {}
496
501
  }),
497
- emits: /* @__PURE__ */ J(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick"], ["update:filterParams", "update:perPage"]),
498
- setup(e, { expose: L, emit: v }) {
499
- const d = (t) => t.map((l, i) => ({
500
- field: l.field || "",
501
- title: l.title || "",
502
- name: l.name || "",
503
- titleClass: l.titleClass || "",
504
- dataClass: l.dataClass || "",
505
- visible: l.visible ?? !0,
506
- width: l.width || void 0,
507
- sortField: l.sortField || null,
508
- sortable: l.sortField,
509
- formatter: l.formatter || null,
510
- tooltip: l.tooltip ?? null,
511
- $_index: i
512
- })), S = () => {
502
+ emits: /* @__PURE__ */ Z(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:row-expanded", "dsg-table:row-collapsed"], ["update:filterParams", "update:perPage"]),
503
+ setup(e, { expose: M, emit: v }) {
504
+ const u = (t) => t.map((a, o) => ({
505
+ field: a.field || "",
506
+ title: a.title || "",
507
+ name: a.name || "",
508
+ titleClass: a.titleClass || "",
509
+ dataClass: a.dataClass || "",
510
+ visible: a.visible ?? !0,
511
+ width: a.width || void 0,
512
+ sortField: a.sortField || null,
513
+ sortable: a.sortField,
514
+ formatter: a.formatter || null,
515
+ tooltip: a.tooltip ?? null,
516
+ $_index: o
517
+ })), $ = () => {
513
518
  if (!e.apiMode) return null;
514
- const l = Se().find((i) => i.key === e.queryParams.sort);
515
- if (l && l.value.length > 0) {
516
- const i = l.value[0], p = i.startsWith("-"), f = p ? i.substring(1) : i, x = e.fields.find(
517
- (ee) => ee.sortField === f || ee.name === f || ee.field === f
519
+ const a = Ee().find((o) => o.key === e.queryParams.sort);
520
+ if (a && a.value.length > 0) {
521
+ const o = a.value[0], D = o.startsWith("-"), f = D ? o.substring(1) : o, T = e.fields.find(
522
+ (te) => te.sortField === f || te.name === f || te.field === f
518
523
  );
519
- return x ? {
520
- name: String(x.name || x.field),
524
+ return T ? {
525
+ name: String(T.name || T.field),
521
526
  field: f,
522
- direction: p ? "desc" : "asc"
527
+ direction: D ? "desc" : "asc"
523
528
  } : {
524
529
  name: f,
525
530
  field: f,
526
- direction: p ? "desc" : "asc"
531
+ direction: D ? "desc" : "asc"
527
532
  };
528
533
  }
529
534
  return null;
530
- }, B = () => {
535
+ }, E = () => {
531
536
  if (!(!e.apiMode || !e.replaceState) && e.replaceStrategy === "window") {
532
- const t = new URL(window.location.href), l = new URLSearchParams(t.search);
533
- if (l.delete(e.queryParams.sort), m.value) {
534
- const p = (m.value.direction === "desc" ? "-" : "") + m.value.field;
535
- l.set(e.queryParams.sort, p);
537
+ const t = new URL(window.location.href), a = new URLSearchParams(t.search);
538
+ if (a.delete(e.queryParams.sort), m.value) {
539
+ const D = (m.value.direction === "desc" ? "-" : "") + m.value.field;
540
+ a.set(e.queryParams.sort, D);
536
541
  }
537
- const i = `${t.pathname}${l.toString() ? "?" + l.toString() : ""}`;
538
- window.history.pushState({}, "", i);
542
+ const o = `${t.pathname}${a.toString() ? "?" + a.toString() : ""}`;
543
+ window.history.pushState({}, "", o);
539
544
  }
540
- }, g = D(d(e.fields)), b = D(e.data), E = D(null), F = D(e.initialPage), T = D("17px"), h = D(!1), a = D({}), u = D(0), w = D(!0), m = D(S()), $ = D(null), A = D(0), Z = G(e, "filterParams"), ne = G(e, "perPage"), R = D([]), le = D(!1), K = O(() => e.tableHeight != null), Q = O(() => g.value.filter((t) => t.visible).length);
541
- te(
542
- () => R.value.length,
545
+ }, g = x(u(e.fields)), b = x(e.data), L = x(null), R = x(e.initialPage), S = x("17px"), w = x(!1), l = x({}), c = x(0), p = x(!0), m = x($()), P = x(null), q = x(0), ee = X(e, "filterParams"), oe = X(e, "perPage"), A = x([]), se = x(!1), V = x(/* @__PURE__ */ new Set()), Y = W(() => e.tableHeight != null), G = W(() => {
546
+ let t = g.value.filter((a) => a.visible).length;
547
+ return e.selectable && t++, e.hasDetailRow && e.expandableRows && t++, t;
548
+ });
549
+ ae(
550
+ () => A.value.length,
543
551
  (t) => {
544
- le.value = e.selectable && t > 0;
552
+ se.value = e.selectable && t > 0;
545
553
  },
546
554
  { immediate: !0 }
547
- ), te(
555
+ ), ae(
548
556
  () => e.fields,
549
557
  (t) => {
550
- g.value = d(t);
558
+ g.value = u(t);
551
559
  },
552
560
  { immediate: !0, deep: !0 }
553
- ), te(
554
- () => Z.value,
561
+ ), ae(
562
+ () => ee.value,
555
563
  (t) => {
556
- Y();
564
+ J();
557
565
  },
558
566
  { deep: !0 }
559
- ), te(
560
- () => ne.value,
567
+ ), ae(
568
+ () => oe.value,
561
569
  () => {
562
- Y();
570
+ J();
563
571
  }
564
- ), te(
572
+ ), ae(
565
573
  () => e.apiUrl,
566
- (t, l) => {
567
- e.apiMode && t !== l && t && Y();
574
+ (t, a) => {
575
+ e.apiMode && t !== a && t && J();
568
576
  }
569
- ), te(
577
+ ), ae(
570
578
  () => m.value,
571
579
  () => {
572
- B();
580
+ E();
573
581
  },
574
582
  { deep: !0 }
575
583
  );
576
- const q = v, re = (t, l) => t.formatter && typeof t.formatter == "function" ? t.formatter(t, l) : ve(l, String(t?.name), ""), de = (t) => "dsg-field--" + t.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), ue = (t, l) => {
577
- const i = {
578
- odd: l % 2 === 0,
579
- even: l % 2 !== 0,
584
+ const U = v, ue = (t, a) => t.formatter && typeof t.formatter == "function" ? t.formatter(t, a) : ye(a, String(t?.name), ""), ce = (t) => "dsg-field--" + t.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), ge = (t, a) => {
585
+ const o = {
586
+ odd: a % 2 === 0,
587
+ even: a % 2 !== 0,
580
588
  "row-selected": t.selected
581
589
  };
582
590
  if (!e.rowClass)
583
- return i;
584
- let p = {};
591
+ return o;
592
+ let D = {};
585
593
  if (typeof e.rowClass == "function") {
586
- const f = e.rowClass(t, l);
587
- typeof f == "string" ? f.split(" ").forEach((x) => {
588
- x.trim() && (p[x.trim()] = !0);
589
- }) : Array.isArray(f) ? f.forEach((x) => {
590
- typeof x == "string" && x.trim() && (p[x.trim()] = !0);
591
- }) : typeof f == "object" && f !== null && (p = f);
594
+ const f = e.rowClass(t, a);
595
+ typeof f == "string" ? f.split(" ").forEach((T) => {
596
+ T.trim() && (D[T.trim()] = !0);
597
+ }) : Array.isArray(f) ? f.forEach((T) => {
598
+ typeof T == "string" && T.trim() && (D[T.trim()] = !0);
599
+ }) : typeof f == "object" && f !== null && (D = f);
592
600
  } else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((f) => {
593
- f.trim() && (p[f.trim()] = !0);
601
+ f.trim() && (D[f.trim()] = !0);
602
+ });
603
+ return { ...o, ...D };
604
+ }, K = (t) => V.value.has(t[e.trackBy]), ie = (t, a) => {
605
+ const o = t[e.trackBy];
606
+ V.value.has(o) ? (V.value.delete(o), U("dsg-table:row-collapsed", t, a)) : (e.expandMultiple || V.value.clear(), V.value.add(o), U("dsg-table:row-expanded", t, a));
607
+ }, ve = (t) => {
608
+ const a = t[e.trackBy];
609
+ V.value.has(a) || (e.expandMultiple || V.value.clear(), V.value.add(a));
610
+ }, fe = (t) => {
611
+ V.value.delete(t[e.trackBy]);
612
+ }, be = () => {
613
+ b.value?.forEach((t) => {
614
+ V.value.add(t[e.trackBy]);
594
615
  });
595
- return { ...i, ...p };
596
- }, ce = (t) => {
616
+ }, he = () => {
617
+ V.value.clear();
618
+ }, we = () => V.value, de = (t) => {
597
619
  if (e.selectable) {
598
620
  if (t.selected)
599
- R.value.push(t);
621
+ A.value.push(t);
600
622
  else {
601
- const l = R.value.findIndex((i) => i[e.trackBy] === t[e.trackBy]);
602
- l !== -1 && R.value.splice(l, 1);
623
+ const a = A.value.findIndex((o) => o[e.trackBy] === t[e.trackBy]);
624
+ a !== -1 && A.value.splice(a, 1);
603
625
  }
604
- q("dsg-table:rows-selected", R.value);
626
+ U("dsg-table:rows-selected", A.value);
605
627
  }
606
- }, ge = () => {
628
+ }, me = () => {
607
629
  e.selectable && (b.value?.forEach((t) => {
608
630
  t.selected = !0;
609
- }), R.value = b.value?.filter((t) => t.selected) ?? [], q("dsg-table:rows-selected", R.value));
610
- }, oe = () => {
631
+ }), A.value = b.value?.filter((t) => t.selected) ?? [], U("dsg-table:rows-selected", A.value));
632
+ }, i = () => {
611
633
  e.selectable && (b.value?.forEach((t) => {
612
634
  t.selected = !1;
613
- }), R.value = [], q("dsg-table:rows-selected", R.value));
614
- }, _ = (t) => {
615
- b.value = Array.isArray(t) ? t : [], e.selectable && b.value.forEach((l) => {
616
- l.selected = l.selected ?? !1;
635
+ }), A.value = [], U("dsg-table:rows-selected", A.value));
636
+ }, n = (t) => {
637
+ b.value = Array.isArray(t) ? t : [], e.selectable && b.value.forEach((a) => {
638
+ a.selected = a.selected ?? !1;
617
639
  });
618
- }, n = () => b.value ?? [], o = (t) => {
619
- t === "prev" ? F.value > e.firstPage && F.value-- : t === "next" ? F.value < (E.value?.last_page ?? 0) && F.value++ : t != F.value && t >= e.firstPage && t <= (E.value?.last_page ?? 0) && (F.value = t), Y();
620
- }, c = () => ({
640
+ }, r = () => b.value ?? [], h = (t) => {
641
+ t === "prev" ? R.value > e.firstPage && R.value-- : t === "next" ? R.value < (L.value?.last_page ?? 0) && R.value++ : t != R.value && t >= e.firstPage && t <= (L.value?.last_page ?? 0) && (R.value = t), J();
642
+ }, C = () => ({
621
643
  [e.queryParams?.sort]: m.value ? (m.value?.direction === "desc" ? "-" : "") + m.value?.field : void 0,
622
644
  [e.queryParams?.order]: m.value?.direction,
623
- [e.queryParams?.page]: F.value,
624
- [e.queryParams?.perPage]: ne.value
625
- }), k = () => {
626
- $.value && ($.value.abort(), $.value = null);
627
- }, C = (t, l) => {
628
- k(), A.value++;
629
- const i = A.value, p = new AbortController();
630
- return l.signal = p.signal, $.value = p, (e.httpMethod.toLowerCase() === "get" ? Pe.get(t, l) : (() => {
631
- const x = l.params;
632
- return delete l.params, Pe.post(t, x, l);
645
+ [e.queryParams?.page]: R.value,
646
+ [e.queryParams?.perPage]: oe.value
647
+ }), re = () => {
648
+ P.value && (P.value.abort(), P.value = null);
649
+ }, Ve = (t, a) => {
650
+ re(), q.value++;
651
+ const o = q.value, D = new AbortController();
652
+ return a.signal = D.signal, P.value = D, (e.httpMethod.toLowerCase() === "get" ? Te.get(t, a) : (() => {
653
+ const T = a.params;
654
+ return delete a.params, Te.post(t, T, a);
633
655
  })()).then(
634
- (x) => ({ ...x, _requestId: i, _apiUrl: t }),
635
- (x) => {
636
- throw x.name === "AbortError" || x.code === "ERR_CANCELED" ? { ...x, _requestId: i, _cancelled: !0 } : { ...x, _requestId: i };
656
+ (T) => ({ ...T, _requestId: o, _apiUrl: t }),
657
+ (T) => {
658
+ throw T.name === "AbortError" || T.code === "ERR_CANCELED" ? { ...T, _requestId: o, _cancelled: !0 } : { ...T, _requestId: o };
637
659
  }
638
660
  );
639
- }, ie = (t) => {
640
- if (t._requestId && t._requestId !== A.value || t._apiUrl && t._apiUrl !== e.apiUrl)
661
+ }, Pe = (t) => {
662
+ if (t._requestId && t._requestId !== q.value || t._apiUrl && t._apiUrl !== e.apiUrl)
641
663
  return;
642
- q("dsg-table:load-success", t);
643
- const l = e.transform ? e.transform(t.data) : t.data;
644
- b.value = ve(l, e.dataPath, null), e.selectable && b.value?.forEach((i) => {
645
- i.selected = i.selected ?? !1;
646
- }), E.value = ve(l, e.paginationPath, null) ?? null, u.value = b.value?.length ? b.value[0].order : u, !tt(e.paginationPath) && E.value === null && console.warn(
664
+ U("dsg-table:load-success", t);
665
+ const a = e.transform ? e.transform(t.data) : t.data;
666
+ b.value = ye(a, e.dataPath, null), e.selectable && b.value?.forEach((o) => {
667
+ o.selected = o.selected ?? !1;
668
+ }), L.value = ye(a, e.paginationPath, null) ?? null, c.value = b.value?.length ? b.value[0].order : c, !ut(e.paginationPath) && L.value === null && console.warn(
647
669
  'DsgTable: pagination-path "' + e.paginationPath + `" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
648
670
  You can explicitly suppress this warning by setting pagination-path="".`
649
- ), $.value = null, q("dsg-table:pagination-data", E.value), E.value && F.value > (E.value?.last_page || 0) && b.value?.length === 0 && (F.value = e.initialPage, Y()), q("dsg-table:loaded"), w.value = !1;
650
- }, he = (t) => {
651
- t._requestId && t._requestId !== A.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), $.value = null, q("dsg-table:load-error", t), q("dsg-table:loaded"), w.value = !1);
652
- }, me = () => {
671
+ ), P.value = null, U("dsg-table:pagination-data", L.value), L.value && R.value > (L.value?.last_page || 0) && b.value?.length === 0 && (R.value = e.initialPage, J()), U("dsg-table:loaded"), p.value = !1;
672
+ }, De = (t) => {
673
+ t._requestId && t._requestId !== q.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), P.value = null, U("dsg-table:load-error", t), U("dsg-table:loaded"), p.value = !1);
674
+ }, xe = () => {
653
675
  if (e.data !== null && Array.isArray(e.data)) {
654
- _(e.data), w.value = !1;
676
+ n(e.data), p.value = !1;
655
677
  return;
656
678
  }
657
679
  if (e.dataManager && typeof e.dataManager == "function") {
658
680
  const t = e.dataManager();
659
- _(t), w.value = !1;
681
+ n(t), p.value = !1;
660
682
  } else
661
- _(e.data), w.value = !1;
662
- }, Y = (t = ie, l = he, i = {}) => {
663
- const p = t || ie, f = l || he;
683
+ n(e.data), p.value = !1;
684
+ }, J = (t = Pe, a = De, o = {}) => {
685
+ const D = t || Pe, f = a || De;
664
686
  if (!e.apiMode) {
665
- me();
687
+ xe();
666
688
  return;
667
689
  }
668
- return w.value = !0, q("dsg-table:loading", w.value), e.httpOptions.params = {
669
- ...c(),
670
- ...Z.value
671
- }, C(e.apiUrl, e.httpOptions).then(p).catch((x) => f(x));
672
- }, Ee = (t, l, i) => {
673
- q("dsg-table:row-clicked", t, l, i);
674
- }, Re = (t, l, i) => {
675
- q("dsg-table:row-dblclick", t, l, i);
676
- }, Ue = (t, l, i) => {
677
- }, He = (t, l, i, p) => {
678
- }, Ie = (t, l, i, p) => {
679
- }, Ae = (t, l, i, p) => {
680
- }, qe = (t, l, i) => {
690
+ return p.value = !0, U("dsg-table:loading", p.value), e.httpOptions.params = {
691
+ ...C(),
692
+ ...ee.value
693
+ }, Ve(e.apiUrl, e.httpOptions).then(D).catch((T) => f(T));
694
+ }, ze = (t, a, o) => {
695
+ U("dsg-table:row-clicked", t, a, o);
696
+ }, Oe = (t, a, o) => {
697
+ U("dsg-table:row-dblclick", t, a, o);
698
+ }, We = (t, a, o) => {
699
+ }, Ne = (t, a, o, D) => {
700
+ }, je = (t, a, o, D) => {
701
+ }, Ke = (t, a, o, D) => {
702
+ }, Qe = (t, a, o) => {
681
703
  };
682
- $e(() => {
683
- e.apiMode === !0 ? Y() : me();
704
+ Me(() => {
705
+ e.apiMode === !0 ? J() : xe();
684
706
  });
685
- const ye = () => {
686
- e.apiMode && (R.value = [], k(), Y());
707
+ const Ce = () => {
708
+ e.apiMode && (A.value = [], re(), J());
687
709
  };
688
- return L({
689
- changePage: o,
690
- reload: ye,
691
- getData: n,
692
- setData: _,
710
+ return M({
711
+ changePage: h,
712
+ reload: Ce,
713
+ getData: r,
714
+ setData: n,
693
715
  setLoading: (t) => {
694
- w.value = t, q("dsg-table:loading", w.value);
695
- }
696
- }), (t, l) => (s(), r("div", Ft, [
697
- P("div", {
716
+ p.value = t, U("dsg-table:loading", p.value);
717
+ },
718
+ expandRow: ve,
719
+ collapseRow: fe,
720
+ toggleRowExpand: ie,
721
+ expandAllRows: be,
722
+ collapseAllRows: he,
723
+ getExpandedRows: we,
724
+ isRowExpanded: K
725
+ }), (t, a) => (s(), d("div", It, [
726
+ k("div", {
698
727
  ref: "dsgTableBodyWrapper",
699
- class: U(["dsg-table-body-wrapper", { "fixed-header": K.value }]),
700
- style: ae({ height: e.tableHeight || void 0 })
728
+ class: B(["dsg-table-body-wrapper", { "fixed-header": Y.value }]),
729
+ style: le({ height: e.tableHeight || void 0 })
701
730
  }, [
702
- P("table", {
703
- class: U(["dsg-table-main", K.value ? "fixed-header" : "", a.value.table, "table-" + e.tableLayout])
731
+ k("table", {
732
+ class: B(["dsg-table-main", Y.value ? "fixed-header" : "", l.value.table, "table-" + e.tableLayout])
704
733
  }, [
705
- P("colgroup", { span: Q.value }, [
706
- (s(!0), r(H, null, N(g.value, (i, p) => (s(), r(H, null, [
707
- i?.visible ? (s(), r("col", {
708
- key: p,
709
- style: ae({ width: i.width || void 0 }),
710
- class: U("dsg-table--col-" + i.name + " " + i.titleClass)
734
+ k("colgroup", { span: G.value }, [
735
+ (s(!0), d(H, null, j(g.value, (o, D) => (s(), d(H, null, [
736
+ o?.visible ? (s(), d("col", {
737
+ key: D,
738
+ style: le({ width: o.width || void 0 }),
739
+ class: B("dsg-table--col-" + o.name + " " + o.titleClass)
711
740
  }, null, 6)) : y("", !0)
712
741
  ], 64))), 256)),
713
- !K.value && h.value ? (s(), r("col", {
742
+ !Y.value && w.value ? (s(), d("col", {
714
743
  key: 0,
715
- style: ae({ width: T.value }),
744
+ style: le({ width: S.value }),
716
745
  class: "dsg-table--col-gutter"
717
746
  }, null, 4)) : y("", !0)
718
- ], 8, Mt),
719
- P("thead", {
720
- class: U([[a.value.thead, { sticky: K.value, "top-0": K.value }], "dsg-table--head"])
747
+ ], 8, qt),
748
+ k("thead", {
749
+ class: B([[l.value.thead, { sticky: Y.value, "top-0": Y.value }], "dsg-table--head"])
721
750
  }, [
722
- M(t.$slots, "tableHeader", { fields: g.value }, () => [
723
- I(Be, {
751
+ F(t.$slots, "tableHeader", { fields: g.value }, () => [
752
+ I(qe, {
724
753
  fields: g.value,
725
754
  "has-select-all": e.selectable,
726
- "selected-rows": R.value,
727
- "onUpdate:selectedRows": l[0] || (l[0] = (i) => R.value = i),
728
- "has-selected": le.value,
729
- "onUpdate:hasSelected": l[1] || (l[1] = (i) => le.value = i),
730
- "scroll-visible": h.value,
755
+ "selected-rows": A.value,
756
+ "onUpdate:selectedRows": a[0] || (a[0] = (o) => A.value = o),
757
+ "has-selected": se.value,
758
+ "onUpdate:hasSelected": a[1] || (a[1] = (o) => se.value = o),
759
+ "scroll-visible": w.value,
731
760
  "show-expand-detail": e.hasDetailRow && e.showExpandDetail,
732
761
  "table-data-length": b.value?.length,
733
762
  "sort-field": m.value,
734
- "onUpdate:sortField": l[2] || (l[2] = (i) => m.value = i),
735
- "onDsgTable:sortField": l[3] || (l[3] = (i) => ye()),
736
- "onDsgTable:onSelectAll": ge,
737
- "onDsgTable:onDeselectAll": oe
763
+ "onUpdate:sortField": a[2] || (a[2] = (o) => m.value = o),
764
+ "onDsgTable:sortField": a[3] || (a[3] = (o) => Ce()),
765
+ "onDsgTable:onSelectAll": me,
766
+ "onDsgTable:onDeselectAll": i
738
767
  }, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
739
768
  ])
740
769
  ], 2),
741
- P("tbody", {
742
- class: U(["dsg-table--body", a.value.tbody])
770
+ k("tbody", {
771
+ class: B(["dsg-table--body", l.value.tbody])
743
772
  }, [
744
- w.value ? (s(), r("tr", Lt, [
745
- P("td", { colspan: Q.value }, [
746
- P("div", {
773
+ p.value ? (s(), d("tr", Vt, [
774
+ k("td", { colspan: G.value }, [
775
+ k("div", {
747
776
  "aria-label": "Loading...",
748
777
  role: "status",
749
778
  class: "flex items-center space-x-3 h-12 w-full justify-center",
750
- colspan: Q.value
779
+ colspan: G.value
751
780
  }, [
752
- M(t.$slots, "dsg-table-loading", {}, () => [
781
+ F(t.$slots, "dsg-table-loading", {}, () => [
753
782
  I(z, {
754
783
  icon: "loading-02",
755
784
  class: "animate-spin"
756
785
  }),
757
- l[4] || (l[4] = P("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
786
+ a[4] || (a[4] = k("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
758
787
  ])
759
- ], 8, Et)
760
- ], 8, Bt)
761
- ])) : (s(!0), r(H, { key: 1 }, N(b.value, (i, p) => (s(), r(H, { key: p }, [
762
- P("tr", {
763
- class: U(["dsg-table--tbody-row", ue(i, p)]),
764
- onClick: (f) => Ee(f, p, i),
765
- onDblclick: (f) => Re(f, p, i),
766
- onMouseover: (f) => Ue()
788
+ ], 8, Ot)
789
+ ], 8, zt)
790
+ ])) : (s(!0), d(H, { key: 1 }, j(b.value, (o, D) => (s(), d(H, { key: D }, [
791
+ k("tr", {
792
+ class: B(["dsg-table--tbody-row", ge(o, D)]),
793
+ onClick: (f) => ze(f, D, o),
794
+ onDblclick: (f) => Oe(f, D, o),
795
+ onMouseover: (f) => We()
767
796
  }, [
768
- e.selectable ? (s(), r("td", Ut, [
769
- I(Ce, {
770
- modelValue: i.selected,
771
- "onUpdate:modelValue": [(f) => i.selected = f, (f) => ce(i)]
797
+ e.selectable ? (s(), d("td", Nt, [
798
+ I(Be, {
799
+ modelValue: o.selected,
800
+ "onUpdate:modelValue": [(f) => o.selected = f, (f) => de(o)]
772
801
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
773
802
  ])) : y("", !0),
774
- (s(!0), r(H, null, N(g.value, (f, x) => (s(), r(H, { key: x }, [
775
- f.visible ? (s(), r("td", {
803
+ e.hasDetailRow && e.expandableRows ? (s(), d("td", jt, [
804
+ k("button", {
805
+ type: "button",
806
+ class: B(["dsg-table--expand-toggle", { "is-expanded": K(o) }]),
807
+ "aria-expanded": K(o),
808
+ "aria-label": "Toggle row details",
809
+ onClick: Xe((f) => ie(o, D), ["stop"])
810
+ }, [
811
+ I(z, {
812
+ icon: "chevron-right",
813
+ size: "sm",
814
+ class: "dsg-table--expand-icon"
815
+ })
816
+ ], 10, Kt)
817
+ ])) : y("", !0),
818
+ (s(!0), d(H, null, j(g.value, (f, T) => (s(), d(H, { key: T }, [
819
+ f.visible ? (s(), d("td", {
776
820
  key: 0,
777
- class: U(["dsg-table--tbody-cell", f.dataClass]),
778
- style: ae({ width: f.width || void 0 }),
779
- onClick: (ee) => He(),
780
- onDblclick: (ee) => Ie(),
781
- onContextmenu: (ee) => Ae()
821
+ class: B(["dsg-table--tbody-cell", f.dataClass]),
822
+ style: le({ width: f.width || void 0 }),
823
+ onClick: (te) => Ne(),
824
+ onDblclick: (te) => je(),
825
+ onContextmenu: (te) => Ke()
782
826
  }, [
783
- M(t.$slots, de(f), {
784
- rowData: i,
785
- rowIndex: p,
827
+ F(t.$slots, ce(f), {
828
+ rowData: o,
829
+ rowIndex: D,
786
830
  rowField: f
787
831
  }, () => [
788
- P("span", {
789
- innerHTML: re(f, i)
790
- }, null, 8, It)
832
+ k("span", {
833
+ innerHTML: ue(f, o)
834
+ }, null, 8, Yt)
791
835
  ])
792
- ], 46, Ht)) : y("", !0)
836
+ ], 46, Qt)) : y("", !0)
793
837
  ], 64))), 128))
794
- ], 42, Rt),
795
- e.hasDetailRow ? (s(), V(We, {
838
+ ], 42, Wt),
839
+ e.hasDetailRow && (!e.expandableRows || K(o)) ? (s(), O(Ze, {
796
840
  key: 0,
797
841
  name: e.detailRowTransition
798
842
  }, {
799
- default: X(() => [
800
- P("tr", {
801
- class: "dsg-table--tbody-detail-row",
802
- onClick: (f) => qe()
843
+ default: _(() => [
844
+ k("tr", {
845
+ class: B(["dsg-table--tbody-detail-row", { "is-expanded": e.expandableRows && K(o) }]),
846
+ onClick: (f) => Qe()
803
847
  }, [
804
- P("td", { colspan: Q.value }, [
805
- M(t.$slots, "dsg-table-detail-row", {
806
- rowData: i,
807
- rowIndex: p,
808
- options: e.detailRowOptions
848
+ k("td", { colspan: G.value }, [
849
+ F(t.$slots, "dsg-table-detail-row", {
850
+ rowData: o,
851
+ rowIndex: D,
852
+ options: e.detailRowOptions,
853
+ isExpanded: e.expandableRows ? K(o) : !0
809
854
  })
810
- ], 8, qt)
811
- ], 8, At)
855
+ ], 8, Jt)
856
+ ], 10, Gt)
812
857
  ]),
813
858
  _: 2
814
859
  }, 1032, ["name"])) : y("", !0)
815
860
  ], 64))), 128)),
816
- !w.value && !b.value?.length && e.noDataTemplate.length ? (s(), r("tr", Vt, [
817
- P("td", {
818
- colspan: Q.value,
861
+ !p.value && !b.value?.length && e.noDataTemplate.length ? (s(), d("tr", Xt, [
862
+ k("td", {
863
+ colspan: G.value,
819
864
  class: "dsg-table--empty-result"
820
865
  }, [
821
- M(t.$slots, "dsg-table-empty-result", {}, () => [
822
- Ne(se(e.noDataTemplate), 1)
866
+ F(t.$slots, "dsg-table-empty-result", {}, () => [
867
+ _e(ne(e.noDataTemplate), 1)
823
868
  ])
824
- ], 8, zt)
869
+ ], 8, Zt)
825
870
  ])) : y("", !0)
826
871
  ], 2),
827
- P("tfoot", Ot, [
828
- M(t.$slots, "dsg-table-footer", {
872
+ k("tfoot", _t, [
873
+ F(t.$slots, "dsg-table-footer", {
829
874
  fields: g.value,
830
875
  data: b.value
831
876
  })
@@ -834,18 +879,18 @@ You can explicitly suppress this warning by setting pagination-path="".`
834
879
  ], 6)
835
880
  ]));
836
881
  }
837
- }), Nt = { class: "dsg-table" }, jt = {
882
+ }), ta = { class: "dsg-table" }, aa = {
838
883
  key: 0,
839
884
  class: "dsg-table--pre-header"
840
- }, Kt = { class: "dsg-table--pre-header-left" }, Qt = ["textContent"], Yt = { class: "dsg-table--pre-header-right" }, Gt = {
885
+ }, la = { class: "dsg-table--pre-header-left" }, sa = ["textContent"], na = { class: "dsg-table--pre-header-right" }, oa = {
841
886
  key: 1,
842
887
  class: "dsg-table--search-header",
843
888
  ref: "dsgTableSearchHeaderEl"
844
- }, Jt = { class: "dsg-table--search-top" }, Xt = {
889
+ }, ia = { class: "dsg-table--search-top" }, da = {
845
890
  key: 2,
846
891
  class: "dsg-table--footer",
847
892
  ref: "dsgTableFooterEl"
848
- }, Zt = { class: "dsg-table--footer-left" }, _t = { class: "dsg-table--footer-center" }, ea = { class: "dsg-table--footer-right" }, ta = /* @__PURE__ */ j({
893
+ }, ra = { class: "dsg-table--footer-left" }, ua = { class: "dsg-table--footer-center" }, ca = { class: "dsg-table--footer-right" }, ga = /* @__PURE__ */ Q({
849
894
  __name: "DsgTable",
850
895
  props: {
851
896
  getUrl: {},
@@ -874,124 +919,147 @@ You can explicitly suppress this warning by setting pagination-path="".`
874
919
  rowClass: { type: [String, Function], default: void 0 },
875
920
  apiMode: { type: Boolean, default: !0 },
876
921
  replaceState: { type: Boolean, default: !0 },
877
- replaceStrategy: { default: "window" }
922
+ replaceStrategy: { default: "window" },
923
+ hasDetailRow: { type: Boolean, default: !1 },
924
+ expandableRows: { type: Boolean, default: !1 },
925
+ expandMultiple: { type: Boolean, default: !1 },
926
+ showExpandDetail: { type: Boolean, default: !0 },
927
+ detailRowTransition: { default: "fade" },
928
+ detailRowOptions: { default: () => ({}) }
878
929
  },
879
- emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded"],
880
- setup(e, { expose: L, emit: v }) {
881
- const d = (n) => {
882
- w.value = n;
883
- }, S = D(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), B = () => {
884
- if (S.value) {
885
- let n = {};
886
- return Se().forEach((o) => {
887
- if (o.key.startsWith("filter[")) {
888
- const c = o.key.replace("filter[", "").replace("]", ""), k = o.value;
889
- n[`filter[${c}]`] = k.join(",");
930
+ emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded", "dsg-table:row-expanded", "dsg-table:row-collapsed"],
931
+ setup(e, { expose: M, emit: v }) {
932
+ const u = (i) => {
933
+ p.value = i;
934
+ }, $ = x(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), E = () => {
935
+ if ($.value) {
936
+ let i = {};
937
+ return Ee().forEach((n) => {
938
+ if (n.key.startsWith("filter[")) {
939
+ const r = n.key.replace("filter[", "").replace("]", ""), h = n.value;
940
+ i[`filter[${r}]`] = h.join(",");
890
941
  }
891
- }), n;
942
+ }), i;
892
943
  } else
893
944
  return {};
894
- }, g = O(() => ({
945
+ }, g = W(() => ({
895
946
  ...e.css,
896
947
  tableWrapper: "border-b " + (e.css?.tableWrapper || "")
897
- })), b = je(), E = D(!0), F = D(null), T = D("<p>Showing {from} to {to} of {total}</p>"), h = D(null), a = De("dsgTable"), u = D({ perPage: e.perPage, change: d }), w = D(e.perPage), m = D({ ...B(), ...e.initialFilters }), $ = v, A = (n) => {
898
- a.value?.changePage(n);
899
- }, Z = (n) => {
900
- h.value = n;
901
- }, ne = ({ data: n }) => {
902
- F.value = n, $("dsg-table:data-loaded", n);
903
- }, R = () => {
904
- a.value?.reload();
905
- }, le = (n) => {
906
- a.value?.setLoading(n);
907
- }, K = (n) => {
908
- const o = a.value?.getData?.() ?? [];
909
- a.value?.setData(o.map((c) => c.id === n.id ? n : c));
910
- }, Q = (n) => {
911
- const o = a.value?.getData?.() ?? [];
912
- a.value?.setData([...o, n]);
913
- }, q = (n) => {
914
- const o = a.value?.getData?.() ?? [];
915
- a.value?.setData(o.filter((c) => c.id !== n.id));
916
- }, re = (n) => {
917
- a.value?.setData(n);
918
- }, de = () => a.value?.getData() ?? [], ue = (n) => {
919
- const o = a.value?.getData() ?? [], c = n(o);
920
- c && a.value?.setData(c);
921
- }, ce = (n) => {
922
- m.value = n;
923
- }, ge = () => m.value ?? {}, oe = (n) => {
924
- const o = { ...m.value };
925
- !n || n.trim() === "" ? delete o["filter[term]"] : o["filter[term]"] = n, m.value = o, we(() => {
926
- R();
927
- }), $("dsg-table:term-changed", n);
928
- }, _ = (n, o, c) => {
929
- let k = {};
930
- m.value["filter[term]"] && (k["filter[term]"] = m.value["filter[term]"]), Object.keys(n).forEach((C) => {
931
- n[C] !== null && n[C] !== void 0 && n[C] !== "" && (k[C] = n[C]);
932
- }), m.value = k, we(() => {
933
- R();
934
- }), $("dsg-table:filter-updated", m.value, o, c);
948
+ })), b = et(), L = x(!0), R = x(null), S = x("<p>Showing {from} to {to} of {total}</p>"), w = x(null), l = Fe("dsgTable"), c = x({ perPage: e.perPage, change: u }), p = x(e.perPage), m = x({ ...E(), ...e.initialFilters }), P = v, q = (i) => {
949
+ l.value?.changePage(i);
950
+ }, ee = (i) => {
951
+ w.value = i;
952
+ }, oe = ({ data: i }) => {
953
+ R.value = i, P("dsg-table:data-loaded", i);
954
+ }, A = () => {
955
+ l.value?.reload();
956
+ }, se = (i) => {
957
+ l.value?.setLoading(i);
958
+ }, V = (i) => {
959
+ const n = l.value?.getData?.() ?? [];
960
+ l.value?.setData(n.map((r) => r.id === i.id ? i : r));
961
+ }, Y = (i) => {
962
+ const n = l.value?.getData?.() ?? [];
963
+ l.value?.setData([...n, i]);
964
+ }, G = (i) => {
965
+ const n = l.value?.getData?.() ?? [];
966
+ l.value?.setData(n.filter((r) => r.id !== i.id));
967
+ }, U = (i) => {
968
+ l.value?.setData(i);
969
+ }, ue = () => l.value?.getData() ?? [], ce = (i) => {
970
+ const n = l.value?.getData() ?? [], r = i(n);
971
+ r && l.value?.setData(r);
972
+ }, ge = (i) => {
973
+ l.value?.expandRow(i);
974
+ }, K = (i) => {
975
+ l.value?.collapseRow(i);
976
+ }, ie = (i, n) => {
977
+ l.value?.toggleRowExpand(i, n);
978
+ }, ve = () => {
979
+ l.value?.expandAllRows();
980
+ }, fe = () => {
981
+ l.value?.collapseAllRows();
982
+ }, be = () => l.value?.getExpandedRows() ?? /* @__PURE__ */ new Set(), he = (i) => {
983
+ m.value = i;
984
+ }, we = () => m.value ?? {}, de = (i) => {
985
+ const n = { ...m.value };
986
+ !i || i.trim() === "" ? delete n["filter[term]"] : n["filter[term]"] = i, m.value = n, $e(() => {
987
+ A();
988
+ }), P("dsg-table:term-changed", i);
989
+ }, me = (i, n, r) => {
990
+ let h = {};
991
+ m.value["filter[term]"] && (h["filter[term]"] = m.value["filter[term]"]), Object.keys(i).forEach((C) => {
992
+ i[C] !== null && i[C] !== void 0 && i[C] !== "" && (h[C] = i[C]);
993
+ }), m.value = h, $e(() => {
994
+ A();
995
+ }), P("dsg-table:filter-updated", m.value, n, r);
935
996
  };
936
- return L({
937
- reloadTable: R,
938
- updateRowTable: K,
939
- addRowTable: Q,
940
- deleteRowTable: q,
941
- setData: re,
942
- getData: de,
943
- mutateData: ue,
944
- termChanged: oe,
945
- setFilters: ce,
946
- getFilters: ge,
947
- setLoading: le
948
- }), (n, o) => (s(), r("div", Nt, [
949
- e.hasHeader ? (s(), r("div", jt, [
950
- M(n.$slots, "dsg-table--pre-header", {}, () => [
951
- P("div", Kt, [
952
- M(n.$slots, "dsg-table--page-title", {
953
- data: F.value,
997
+ return M({
998
+ reloadTable: A,
999
+ updateRowTable: V,
1000
+ addRowTable: Y,
1001
+ deleteRowTable: G,
1002
+ setData: U,
1003
+ getData: ue,
1004
+ mutateData: ce,
1005
+ termChanged: de,
1006
+ setFilters: he,
1007
+ getFilters: we,
1008
+ setLoading: se,
1009
+ expandRow: ge,
1010
+ collapseRow: K,
1011
+ toggleRowExpand: ie,
1012
+ expandAllRows: ve,
1013
+ collapseAllRows: fe,
1014
+ getExpandedRows: be,
1015
+ onChangePage: q
1016
+ }), (i, n) => (s(), d("div", ta, [
1017
+ e.hasHeader ? (s(), d("div", aa, [
1018
+ F(i.$slots, "dsg-table--pre-header", {}, () => [
1019
+ k("div", la, [
1020
+ F(i.$slots, "dsg-table--page-title", {
1021
+ data: R.value,
954
1022
  title: e.title
955
1023
  }, () => [
956
- e.title.length > 0 ? (s(), r("h1", {
1024
+ e.title.length > 0 ? (s(), d("h1", {
957
1025
  key: 0,
958
1026
  class: "dsg-table--title",
959
- textContent: se(e.title)
960
- }, null, 8, Qt)) : y("", !0)
1027
+ textContent: ne(e.title)
1028
+ }, null, 8, sa)) : y("", !0)
961
1029
  ])
962
1030
  ]),
963
- P("div", Yt, [
964
- M(n.$slots, "dsg-table--page-actions", { data: F.value })
1031
+ k("div", na, [
1032
+ F(i.$slots, "dsg-table--page-actions", { data: R.value })
965
1033
  ])
966
1034
  ])
967
1035
  ])) : y("", !0),
968
- e.displaySearch ? (s(), r("div", Gt, [
969
- P("div", Jt, [
970
- M(n.$slots, "dsg-table--search-header", { data: F.value }, () => [
971
- I(Le, {
1036
+ e.displaySearch ? (s(), d("div", oa, [
1037
+ k("div", ia, [
1038
+ F(i.$slots, "dsg-table--search-header", { data: R.value }, () => [
1039
+ I(Ie, {
972
1040
  name: "term",
973
- "onDsgTable:termChanged": o[0] || (o[0] = (c) => oe(c))
1041
+ "onDsgTable:termChanged": n[0] || (n[0] = (r) => de(r))
974
1042
  }),
975
- I(Te, {
1043
+ I(Le, {
976
1044
  entity: e.filterEntity,
977
1045
  "filter-endpoint": e.filterEndpoint,
978
1046
  "search-endpoint": e.filterSearchEndpoint,
979
1047
  "auto-sort": e.autoSortFilters,
980
1048
  filters: e.filters,
981
- "onDsgTable:filterUpdated": o[1] || (o[1] = (c, k, C) => _(c, k, C))
1049
+ "onDsgTable:filterUpdated": n[1] || (n[1] = (r, h, C) => me(r, h, C))
982
1050
  }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "auto-sort", "filters"]),
983
- M(n.$slots, "dsg-table--search-actions", { data: F.value })
1051
+ F(i.$slots, "dsg-table--search-actions", { data: R.value })
984
1052
  ])
985
1053
  ]),
986
- M(n.$slots, "dsg-table--search-navigation")
1054
+ F(i.$slots, "dsg-table--search-navigation")
987
1055
  ], 512)) : y("", !0),
988
- I(Wt, {
1056
+ I(ea, {
989
1057
  ref: "dsgTable",
990
1058
  "api-url": e.getUrl,
991
1059
  "filter-params": m.value,
992
- "onUpdate:filterParams": o[7] || (o[7] = (c) => m.value = c),
993
- "per-page": w.value,
994
- "onUpdate:perPage": o[8] || (o[8] = (c) => w.value = c),
1060
+ "onUpdate:filterParams": n[7] || (n[7] = (r) => m.value = r),
1061
+ "per-page": p.value,
1062
+ "onUpdate:perPage": n[8] || (n[8] = (r) => p.value = r),
995
1063
  fields: e.fields,
996
1064
  "load-on-start": e.loadOnStart,
997
1065
  "pagination-path": e.paginationPath,
@@ -1001,132 +1069,140 @@ You can explicitly suppress this warning by setting pagination-path="".`
1001
1069
  css: g.value,
1002
1070
  data: e.data,
1003
1071
  "row-class": e.rowClass,
1004
- "api-mode": S.value,
1072
+ "api-mode": $.value,
1005
1073
  "replace-state": e.replaceState,
1006
1074
  "replace-strategy": e.replaceStrategy,
1007
- "onDsgTable:loading": o[9] || (o[9] = (c) => E.value = !0),
1008
- "onDsgTable:loaded": o[10] || (o[10] = (c) => E.value = !1),
1009
- "onDsgTable:paginationData": Z,
1010
- "onDsgTable:loadSuccess": ne,
1011
- "onDsgTable:rowsSelected": o[11] || (o[11] = (c) => $("dsg-table:rows-selected", c)),
1012
- "onDsgTable:rowClicked": o[12] || (o[12] = (c, k, C) => $("dsg-table:row-clicked", c, k, C)),
1013
- "onDsgTable:rowHover": o[13] || (o[13] = (c, k, C) => $("dsg-table:row-hover", c, k, C)),
1014
- "onDsgTable:rowDblclick": o[14] || (o[14] = (c, k, C) => $("dsg-table:row-dblclick", c, k, C))
1015
- }, Ke({
1016
- "dsg-field--actions": X((c) => [
1017
- M(n.$slots, "dsg-table-actions", { data: c }, () => [
1018
- (s(), V(Me, {
1019
- key: c.rowIndex,
1020
- data: c,
1021
- "onDsgTable:actionEdit": o[2] || (o[2] = (k, C) => $("dsg-table:action-edit", k, C)),
1022
- "onDsgTable:actionView": o[3] || (o[3] = (k, C) => $("dsg-table:action-view", k, C)),
1023
- "onDsgTable:actionDelete": o[4] || (o[4] = (k, C) => $("dsg-table:action-delete", k, C)),
1024
- "onDsgTable:actionArchive": o[5] || (o[5] = (k, C) => $("dsg-table:action-archive", k, C)),
1025
- "onDsgTable:linkClicked": o[6] || (o[6] = (k, C, ie) => $("dsg-table:link-clicked", k, C, ie))
1075
+ "has-detail-row": e.hasDetailRow,
1076
+ "expandable-rows": e.expandableRows,
1077
+ "expand-multiple": e.expandMultiple,
1078
+ "show-expand-detail": e.showExpandDetail,
1079
+ "detail-row-transition": e.detailRowTransition,
1080
+ "detail-row-options": e.detailRowOptions,
1081
+ "onDsgTable:loading": n[9] || (n[9] = (r) => L.value = !0),
1082
+ "onDsgTable:loaded": n[10] || (n[10] = (r) => L.value = !1),
1083
+ "onDsgTable:paginationData": ee,
1084
+ "onDsgTable:loadSuccess": oe,
1085
+ "onDsgTable:rowsSelected": n[11] || (n[11] = (r) => P("dsg-table:rows-selected", r)),
1086
+ "onDsgTable:rowClicked": n[12] || (n[12] = (r, h, C) => P("dsg-table:row-clicked", r, h, C)),
1087
+ "onDsgTable:rowHover": n[13] || (n[13] = (r, h, C) => P("dsg-table:row-hover", r, h, C)),
1088
+ "onDsgTable:rowDblclick": n[14] || (n[14] = (r, h, C) => P("dsg-table:row-dblclick", r, h, C)),
1089
+ "onDsgTable:rowExpanded": n[15] || (n[15] = (r, h) => P("dsg-table:row-expanded", r, h)),
1090
+ "onDsgTable:rowCollapsed": n[16] || (n[16] = (r, h) => P("dsg-table:row-collapsed", r, h))
1091
+ }, tt({
1092
+ "dsg-field--actions": _((r) => [
1093
+ F(i.$slots, "dsg-table-actions", { data: r }, () => [
1094
+ (s(), O(He, {
1095
+ key: r.rowIndex,
1096
+ data: r,
1097
+ "onDsgTable:actionEdit": n[2] || (n[2] = (h, C) => P("dsg-table:action-edit", h, C)),
1098
+ "onDsgTable:actionView": n[3] || (n[3] = (h, C) => P("dsg-table:action-view", h, C)),
1099
+ "onDsgTable:actionDelete": n[4] || (n[4] = (h, C) => P("dsg-table:action-delete", h, C)),
1100
+ "onDsgTable:actionArchive": n[5] || (n[5] = (h, C) => P("dsg-table:action-archive", h, C)),
1101
+ "onDsgTable:linkClicked": n[6] || (n[6] = (h, C, re) => P("dsg-table:link-clicked", h, C, re))
1026
1102
  }, null, 8, ["data"]))
1027
1103
  ])
1028
1104
  ]),
1029
1105
  _: 2
1030
1106
  }, [
1031
- N(W(b), (c, k) => ({
1032
- name: k,
1033
- fn: X((C) => [
1034
- String(k) !== "dsg-field--actions" ? M(n.$slots, k, Qe(fe({ key: 0 }, C))) : y("", !0)
1107
+ j(N(b), (r, h) => ({
1108
+ name: h,
1109
+ fn: _((C) => [
1110
+ String(h) !== "dsg-field--actions" ? F(i.$slots, h, at(pe({ key: 0 }, C))) : y("", !0)
1035
1111
  ])
1036
1112
  }))
1037
- ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "pagination-path", "selectable", "track-by", "table-layout", "css", "data", "row-class", "api-mode", "replace-state", "replace-strategy"]),
1038
- e.hasFooter ? (s(), r("div", Xt, [
1039
- P("div", Zt, [
1040
- M(n.$slots, "dsg-table--footer-left", {
1041
- data: h.value,
1042
- perPage: u.value
1113
+ ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "pagination-path", "selectable", "track-by", "table-layout", "css", "data", "row-class", "api-mode", "replace-state", "replace-strategy", "has-detail-row", "expandable-rows", "expand-multiple", "show-expand-detail", "detail-row-transition", "detail-row-options"]),
1114
+ e.hasFooter ? (s(), d("div", da, [
1115
+ k("div", ra, [
1116
+ F(i.$slots, "dsg-table--footer-left", {
1117
+ data: w.value,
1118
+ perPage: c.value
1043
1119
  }, () => [
1044
- e.displayPaginationInfo ? (s(), V(Fe, {
1120
+ e.displayPaginationInfo ? (s(), O(Ue, {
1045
1121
  key: 0,
1046
1122
  ref: "paginationInfoStart",
1047
- pagination: h.value,
1048
- "onUpdate:pagination": o[15] || (o[15] = (c) => h.value = c),
1049
- "info-template": T.value
1123
+ pagination: w.value,
1124
+ "onUpdate:pagination": n[17] || (n[17] = (r) => w.value = r),
1125
+ "info-template": S.value
1050
1126
  }, null, 8, ["pagination", "info-template"])) : y("", !0),
1051
- M(n.$slots, "dsg-table--footer-left-extras", {
1052
- data: h.value,
1053
- perPage: u.value
1127
+ F(i.$slots, "dsg-table--footer-left-extras", {
1128
+ data: w.value,
1129
+ perPage: c.value
1054
1130
  })
1055
1131
  ])
1056
1132
  ]),
1057
- P("div", _t, [
1058
- M(n.$slots, "dsg-table--footer-center", {
1059
- data: h.value,
1060
- perPage: u.value
1133
+ k("div", ua, [
1134
+ F(i.$slots, "dsg-table--footer-center", {
1135
+ data: w.value,
1136
+ perPage: c.value
1061
1137
  }, () => [
1062
- M(n.$slots, "dsg-table--footer-center-extras", {
1063
- data: h.value,
1064
- perPage: u.value
1138
+ F(i.$slots, "dsg-table--footer-center-extras", {
1139
+ data: w.value,
1140
+ perPage: c.value
1065
1141
  })
1066
1142
  ])
1067
1143
  ]),
1068
- P("div", ea, [
1069
- M(n.$slots, "dsg-table--footer-right", {
1070
- data: h.value,
1071
- perPage: u.value
1144
+ k("div", ca, [
1145
+ F(i.$slots, "dsg-table--footer-right", {
1146
+ data: w.value,
1147
+ perPage: c.value
1072
1148
  }, () => [
1073
- E.value === !1 && e.displayPaginationInfo ? (s(), V(xe, {
1149
+ L.value === !1 && e.displayPaginationInfo ? (s(), O(Ae, {
1074
1150
  key: 0,
1075
1151
  ref: "pagination",
1076
- pagination: h.value,
1077
- "onUpdate:pagination": o[16] || (o[16] = (c) => h.value = c),
1078
- "onDsgTable:changePage": A
1152
+ pagination: w.value,
1153
+ "onUpdate:pagination": n[18] || (n[18] = (r) => w.value = r),
1154
+ "onDsgTable:changePage": q
1079
1155
  }, null, 8, ["pagination"])) : y("", !0),
1080
- M(n.$slots, "dsg-table--footer-right-extras", {
1081
- data: h.value,
1082
- perPage: u.value
1156
+ F(i.$slots, "dsg-table--footer-right-extras", {
1157
+ data: w.value,
1158
+ perPage: c.value
1083
1159
  })
1084
1160
  ])
1085
1161
  ])
1086
1162
  ], 512)) : y("", !0)
1087
1163
  ]));
1088
1164
  }
1089
- }), aa = { class: "dsg-table--per-page" }, la = ["value", "textContent"], sa = /* @__PURE__ */ j({
1165
+ }), va = { class: "dsg-table--per-page" }, fa = ["value", "textContent"], ba = /* @__PURE__ */ Q({
1090
1166
  __name: "DsgTablePerPage",
1091
1167
  props: {
1092
1168
  perPageOptions: { default: () => [10, 20, 30, 50, 100] },
1093
1169
  perPage: {}
1094
1170
  },
1095
1171
  setup(e) {
1096
- return (L, v) => (s(), r("div", aa, [
1097
- be(P("select", {
1098
- "onUpdate:modelValue": v[0] || (v[0] = (d) => e.perPage.perPage = d),
1172
+ return (M, v) => (s(), d("div", va, [
1173
+ ke(k("select", {
1174
+ "onUpdate:modelValue": v[0] || (v[0] = (u) => e.perPage.perPage = u),
1099
1175
  class: "dsg-table--per-page-select",
1100
- onChange: v[1] || (v[1] = (d) => e.perPage.change(e.perPage.perPage))
1176
+ onChange: v[1] || (v[1] = (u) => e.perPage.change(e.perPage.perPage))
1101
1177
  }, [
1102
- (s(!0), r(H, null, N(e.perPageOptions, (d) => (s(), r("option", {
1103
- key: d,
1104
- value: d,
1105
- textContent: se(d)
1106
- }, null, 8, la))), 128))
1178
+ (s(!0), d(H, null, j(e.perPageOptions, (u) => (s(), d("option", {
1179
+ key: u,
1180
+ value: u,
1181
+ textContent: ne(u)
1182
+ }, null, 8, fa))), 128))
1107
1183
  ], 544), [
1108
- [Ye, e.perPage.perPage]
1184
+ [lt, e.perPage.perPage]
1109
1185
  ])
1110
1186
  ]));
1111
1187
  }
1112
- }), na = ta, oa = Me, ia = sa, ra = Te, da = xe, ua = Fe, ca = Le, ga = Be, wa = {
1113
- DsgTable: na,
1114
- DsgTableActions: oa,
1115
- DsgTablePerPage: ia,
1116
- DsgTableFilter: ra,
1117
- DsgTablePagination: da,
1118
- DsgTablePaginationInfo: ua,
1119
- DsgTableSearch: ca,
1120
- DsgTableRowHeader: ga
1188
+ }), ha = ga, wa = He, ma = ba, ya = Le, pa = Ae, ka = Ue, Pa = Ie, Da = qe, Fa = {
1189
+ DsgTable: ha,
1190
+ DsgTableActions: wa,
1191
+ DsgTablePerPage: ma,
1192
+ DsgTableFilter: ya,
1193
+ DsgTablePagination: pa,
1194
+ DsgTablePaginationInfo: ka,
1195
+ DsgTableSearch: Pa,
1196
+ DsgTableRowHeader: Da
1121
1197
  };
1122
1198
  export {
1123
- na as DsgTable,
1124
- oa as DsgTableActions,
1125
- ra as DsgTableFilter,
1126
- da as DsgTablePagination,
1127
- ua as DsgTablePaginationInfo,
1128
- ia as DsgTablePerPage,
1129
- ga as DsgTableRowHeader,
1130
- ca as DsgTableSearch,
1131
- wa as default
1199
+ ha as DsgTable,
1200
+ wa as DsgTableActions,
1201
+ ya as DsgTableFilter,
1202
+ pa as DsgTablePagination,
1203
+ ka as DsgTablePaginationInfo,
1204
+ ma as DsgTablePerPage,
1205
+ Da as DsgTableRowHeader,
1206
+ Pa as DsgTableSearch,
1207
+ Fa as default
1132
1208
  };