@dcodegroup-au/dsg-vue 0.1.15 → 0.1.17

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,10 +1,10 @@
1
- import { defineComponent as K, mergeModels as J, useModel as G, computed as V, withDirectives as re, createElementBlock as o, openBlock as l, createCommentVNode as p, createElementVNode as w, normalizeClass as B, createVNode as R, Fragment as I, renderList as N, vShow as Re, ref as k, useTemplateRef as me, useAttrs as Ie, unref as O, withCtx as ee, renderSlot as F, toDisplayString as te, createBlock as j, resolveDynamicComponent as Ae, onMounted as ye, normalizeStyle as X, watch as _, Transition as He, createTextVNode as Ue, useSlots as qe, createSlots as Ve, normalizeProps as ze, mergeProps as Oe, nextTick as fe, vModelSelect as Ne } from "vue";
2
- import { _ as z, k as We, v as je, f as Ke, u as Qe, c as we, e as he, i as ke, j as Ye } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-Dq7AM0nW.js";
1
+ import { defineComponent as K, mergeModels as X, useModel as J, computed as V, withDirectives as ge, createElementBlock as i, openBlock as l, createCommentVNode as p, createElementVNode as P, normalizeClass as B, createVNode as R, Fragment as I, renderList as N, vShow as Re, ref as D, useTemplateRef as ye, useAttrs as Ie, unref as O, withCtx as te, renderSlot as F, toDisplayString as ae, createBlock as j, resolveDynamicComponent as Ae, onMounted as we, normalizeStyle as Z, watch as ee, Transition as He, createTextVNode as Ue, useSlots as qe, createSlots as Ve, normalizeProps as ze, mergeProps as Oe, nextTick as he, vModelSelect as Ne } from "vue";
2
+ import { _ as z, k as We, v as je, f as Ke, u as Qe, c as ke, e as me, i as Pe, j as Ye } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-BIxdsbw_.js";
3
3
  import { ucfirst as Ge, ucwords as Je, toSnakeCase as Xe } from "./dsg-vue.helpers-string.esm.js";
4
- import { data_get as de } from "./dsg-vue.helpers-object.esm.js";
5
- const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disabled"], tt = ["onClick", "innerHTML"], at = ["onClick", "innerHTML"], lt = ["disabled"], st = ["disabled"], Pe = /* @__PURE__ */ K({
4
+ import { data_get as ce } from "./dsg-vue.helpers-object.esm.js";
5
+ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disabled"], tt = ["onClick", "innerHTML"], at = ["onClick", "innerHTML"], lt = ["disabled"], st = ["disabled"], De = /* @__PURE__ */ K({
6
6
  __name: "DsgTablePagination",
7
- props: /* @__PURE__ */ J({
7
+ props: /* @__PURE__ */ X({
8
8
  onEachSide: { default: 3 },
9
9
  firstPage: { default: 1 },
10
10
  showFirstLast: { type: Boolean, default: !0 },
@@ -16,19 +16,19 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
16
16
  pagination: { default: null },
17
17
  paginationModifiers: {}
18
18
  }),
19
- emits: /* @__PURE__ */ J(["dsg-table:change-page"], ["update:pagination"]),
20
- setup(e, { expose: L, emit: g }) {
21
- const r = G(e, "pagination"), b = V(() => r.value === null ? 0 : r.value?.last_page - e.firstPage + 1), h = V(() => r.value === null ? 0 : r.value?.last_page), c = V(() => r.value === null ? !1 : r.value?.current_page === e.firstPage), m = V(() => r.value === null ? !1 : r.value?.current_page === h.value), q = V(() => b.value < e.onEachSide * 2 + 4), A = V(() => e.onEachSide * 2 + 1), C = V(() => !r.value || r.value?.current_page <= e.onEachSide ? 1 : r.value?.current_page >= b.value - e.onEachSide ? b.value - e.onEachSide * 2 : r.value?.current_page - e.onEachSide), f = g, a = (T) => {
22
- f("dsg-table:change-page", T);
23
- }, u = (T) => T === r.value?.current_page;
19
+ emits: /* @__PURE__ */ X(["dsg-table:change-page"], ["update:pagination"]),
20
+ setup(e, { expose: L, emit: v }) {
21
+ const r = J(e, "pagination"), b = V(() => r.value === null ? 0 : r.value?.last_page - e.firstPage + 1), h = V(() => r.value === null ? 0 : r.value?.last_page), g = V(() => r.value === null ? !1 : r.value?.current_page === e.firstPage), m = V(() => r.value === null ? !1 : r.value?.current_page === h.value), q = V(() => b.value < e.onEachSide * 2 + 4), A = V(() => e.onEachSide * 2 + 1), C = V(() => !r.value || r.value?.current_page <= e.onEachSide ? 1 : r.value?.current_page >= b.value - e.onEachSide ? b.value - e.onEachSide * 2 : r.value?.current_page - e.onEachSide), f = v, a = ($) => {
22
+ f("dsg-table:change-page", $);
23
+ }, u = ($) => $ === r.value?.current_page;
24
24
  return L({
25
25
  loadPage: a
26
- }), (T, D) => re((l(), o("div", Ze, [
27
- e.showFirstLast ? (l(), o("a", {
26
+ }), ($, T) => ge((l(), i("div", Ze, [
27
+ e.showFirstLast ? (l(), i("a", {
28
28
  key: 0,
29
- onClick: D[0] || (D[0] = (S) => a(e.firstPage)),
30
- class: B([[c.value ? "disabled" : ""], "dsg-table--pagination-link"]),
31
- disabled: c.value,
29
+ onClick: T[0] || (T[0] = (S) => a(e.firstPage)),
30
+ class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
31
+ disabled: g.value,
32
32
  title: "First",
33
33
  "aria-label": "First"
34
34
  }, [
@@ -37,10 +37,10 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
37
37
  size: "sm"
38
38
  }, null, 8, ["icon"])
39
39
  ], 10, _e)) : p("", !0),
40
- w("a", {
41
- onClick: D[1] || (D[1] = (S) => a("prev")),
42
- class: B([[c.value ? "disabled" : ""], "dsg-table--pagination-link"]),
43
- disabled: c.value,
40
+ P("a", {
41
+ onClick: T[1] || (T[1] = (S) => a("prev")),
42
+ class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
43
+ disabled: g.value,
44
44
  title: "Previous",
45
45
  "aria-label": "Previous"
46
46
  }, [
@@ -49,19 +49,19 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
49
49
  size: "sm"
50
50
  }, null, 8, ["icon"])
51
51
  ], 10, et),
52
- q.value ? (l(!0), o(I, { key: 1 }, N(b.value, (S, U) => (l(), o("a", {
52
+ q.value ? (l(!0), i(I, { key: 1 }, N(b.value, (S, U) => (l(), i("a", {
53
53
  key: U,
54
54
  onClick: (E) => a(U + e.firstPage),
55
55
  class: B([[u(U + e.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
56
56
  innerHTML: S
57
- }, null, 10, tt))), 128)) : (l(!0), o(I, { key: 2 }, N(A.value, (S, U) => (l(), o("a", {
57
+ }, null, 10, tt))), 128)) : (l(!0), i(I, { key: 2 }, N(A.value, (S, U) => (l(), i("a", {
58
58
  key: U,
59
59
  onClick: (E) => a(C.value + U + e.firstPage - 1),
60
60
  class: B([[u(C.value + U + e.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
61
61
  innerHTML: C.value + S - 1
62
62
  }, null, 10, at))), 128)),
63
- w("a", {
64
- onClick: D[2] || (D[2] = (S) => a("next")),
63
+ P("a", {
64
+ onClick: T[2] || (T[2] = (S) => a("next")),
65
65
  class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
66
66
  disabled: m.value,
67
67
  title: "Next",
@@ -72,9 +72,9 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
72
72
  size: "sm"
73
73
  }, null, 8, ["icon"])
74
74
  ], 10, lt),
75
- e.showFirstLast ? (l(), o("a", {
75
+ e.showFirstLast ? (l(), i("a", {
76
76
  key: 3,
77
- onClick: D[3] || (D[3] = (S) => a(h.value)),
77
+ onClick: T[3] || (T[3] = (S) => a(h.value)),
78
78
  class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
79
79
  disabled: m.value,
80
80
  title: "Last",
@@ -91,7 +91,7 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
91
91
  }
92
92
  }), nt = ["innerHTML"], pe = /* @__PURE__ */ K({
93
93
  __name: "DsgTablePaginationInfo",
94
- props: /* @__PURE__ */ J({
94
+ props: /* @__PURE__ */ X({
95
95
  infoTemplate: { default: "Displaying {from} to {to} of {total} items" },
96
96
  noDataTemplate: { default: "No relevant data" }
97
97
  }, {
@@ -100,10 +100,10 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
100
100
  }),
101
101
  emits: ["update:pagination"],
102
102
  setup(e) {
103
- const L = G(e, "pagination"), g = V(() => 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()));
104
- return (r, b) => (l(), o("div", {
103
+ const L = J(e, "pagination"), v = V(() => 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()));
104
+ return (r, b) => (l(), i("div", {
105
105
  class: "dsg-table--pagination-info",
106
- innerHTML: g.value
106
+ innerHTML: v.value
107
107
  }, null, 8, nt));
108
108
  }
109
109
  }), ot = {
@@ -119,9 +119,9 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
119
119
  },
120
120
  emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked"],
121
121
  setup(e, { emit: L }) {
122
- const g = k(!1);
123
- me("dsgTableActions");
124
- const r = Ie(), b = k(r.data.rowData?.actions ?? null), h = k(r.data.rowData?.links ?? null), c = k(r.data.rowData ?? null), m = (f) => {
122
+ const v = D(!1);
123
+ ye("dsgTableActions");
124
+ const r = Ie(), b = D(r.data.rowData?.actions ?? null), h = D(r.data.rowData?.links ?? null), g = D(r.data.rowData ?? null), m = (f) => {
125
125
  switch (f) {
126
126
  case "edit":
127
127
  return "edit-05";
@@ -137,89 +137,89 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
137
137
  }, q = (f, a, u) => {
138
138
  switch (a) {
139
139
  case "edit":
140
- C("dsg-table:action-edit", u, c.value);
140
+ C("dsg-table:action-edit", u, g.value);
141
141
  break;
142
142
  case "view":
143
- C("dsg-table:action-view", u, c.value);
143
+ C("dsg-table:action-view", u, g.value);
144
144
  break;
145
145
  case "delete":
146
- C("dsg-table:action-delete", u, c.value);
146
+ C("dsg-table:action-delete", u, g.value);
147
147
  break;
148
148
  case "archive":
149
- C("dsg-table:action-archive", u, c.value);
149
+ C("dsg-table:action-archive", u, g.value);
150
150
  break;
151
151
  }
152
152
  }, A = (f, a) => {
153
153
  const u = f.actionId || f.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
154
- C("dsg-table:link-clicked", a, u, c.value);
154
+ C("dsg-table:link-clicked", a, u, g.value);
155
155
  }, C = L;
156
- return (f, a) => re((l(), o("div", ot, [
156
+ return (f, a) => ge((l(), i("div", ot, [
157
157
  R(O(We), {
158
158
  triggers: [],
159
159
  placement: e.placement,
160
160
  "handle-resize": !0,
161
161
  strategy: "absolute",
162
- shown: g.value,
162
+ shown: v.value,
163
163
  class: "dsg-table--actions__popper",
164
- onHide: a[1] || (a[1] = (u) => g.value = !1),
164
+ onHide: a[1] || (a[1] = (u) => v.value = !1),
165
165
  ref: "floatingVueFilterDropdown"
166
166
  }, {
167
- popper: ee(() => [
168
- g.value ? (l(), o("div", dt, [
169
- (l(!0), o(I, null, N(b.value, (u, T) => (l(), o(I, null, [
170
- ["edit", "view", "delete", "archive"].includes(String(T)) ? (l(), o("a", {
171
- key: T,
167
+ popper: te(() => [
168
+ v.value ? (l(), i("div", dt, [
169
+ (l(!0), i(I, null, N(b.value, (u, $) => (l(), i(I, null, [
170
+ ["edit", "view", "delete", "archive"].includes(String($)) ? (l(), i("a", {
171
+ key: $,
172
172
  href: b.value?.link,
173
173
  target: b.value?.target || "_self",
174
- onClick: (D) => q(u, String(T), D)
174
+ onClick: (T) => q(u, String($), T)
175
175
  }, [
176
- w("div", {
177
- class: B(["dsg-table--actions-menu-item", String(T)])
176
+ P("div", {
177
+ class: B(["dsg-table--actions-menu-item", String($)])
178
178
  }, [
179
179
  R(z, {
180
- icon: m(String(T)),
180
+ icon: m(String($)),
181
181
  size: "sm"
182
182
  }, null, 8, ["icon"]),
183
- w("span", {
183
+ P("span", {
184
184
  class: "flex-1",
185
- textContent: te(O(Ge)(String(T)))
185
+ textContent: ae(O(Ge)(String($)))
186
186
  }, null, 8, ut)
187
187
  ], 2)
188
188
  ], 8, rt)) : p("", !0)
189
189
  ], 64))), 256)),
190
- b.value && h.value ? (l(), o("hr", ct)) : p("", !0),
191
- h.value ? (l(!0), o(I, { key: 1 }, N(h.value, (u) => (l(), o(I, {
190
+ b.value && h.value ? (l(), i("hr", ct)) : p("", !0),
191
+ h.value ? (l(!0), i(I, { key: 1 }, N(h.value, (u) => (l(), i(I, {
192
192
  key: u.label
193
193
  }, [
194
194
  u.hasOwnProperty("component") ? (l(), j(Ae(u.component), {
195
195
  key: 0,
196
196
  quote: O(r).data.data.rowData,
197
197
  "row-data": O(r).data.data.rowData
198
- }, null, 8, ["quote", "row-data"])) : u.hasOwnProperty("type") && u.type == "break" ? (l(), o("hr", gt)) : (l(), o("a", {
198
+ }, null, 8, ["quote", "row-data"])) : u.hasOwnProperty("type") && u.type == "break" ? (l(), i("hr", gt)) : (l(), i("a", {
199
199
  key: 2,
200
200
  href: u.link,
201
201
  target: u.target || "_self",
202
202
  class: B(["dsg-table--actions-menu-item", u.class]),
203
- onClick: (T) => A(u, T)
203
+ onClick: ($) => A(u, $)
204
204
  }, [
205
205
  u.icon ? (l(), j(z, {
206
206
  key: 0,
207
207
  icon: u.icon,
208
208
  size: "sm"
209
209
  }, null, 8, ["icon"])) : p("", !0),
210
- w("span", bt, te(u.label), 1)
210
+ P("span", bt, ae(u.label), 1)
211
211
  ], 10, vt))
212
212
  ], 64))), 128)) : p("", !0)
213
213
  ])) : p("", !0)
214
214
  ]),
215
- default: ee(() => [
216
- w("div", it, [
217
- w("button", {
215
+ default: te(() => [
216
+ P("div", it, [
217
+ P("button", {
218
218
  type: "button",
219
219
  class: "dsg-table--actions-button",
220
220
  "aria-expanded": "false",
221
221
  "aria-haspopup": "true",
222
- onClick: a[0] || (a[0] = (u) => g.value = !g.value)
222
+ onClick: a[0] || (a[0] = (u) => v.value = !v.value)
223
223
  }, [
224
224
  F(f.$slots, "dsg-table-action-button-content", {}, () => [
225
225
  R(z, {
@@ -233,10 +233,10 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
233
233
  _: 3
234
234
  }, 8, ["placement", "shown"])
235
235
  ])), [
236
- [O(je), () => g.value = !1]
236
+ [O(je), () => v.value = !1]
237
237
  ]);
238
238
  }
239
- }), ft = { class: "dsg-table--search" }, De = /* @__PURE__ */ K({
239
+ }), ft = { class: "dsg-table--search" }, $e = /* @__PURE__ */ K({
240
240
  __name: "DsgTableSearch",
241
241
  props: {
242
242
  name: {},
@@ -252,22 +252,22 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
252
252
  },
253
253
  emits: ["dsg-table:term-changed"],
254
254
  setup(e, { emit: L }) {
255
- const g = k("");
256
- ye(() => {
257
- const c = new URL(window.location.href).searchParams.get("term");
258
- c && (g.value = c, r("dsg-table:term-changed", c));
255
+ const v = D("");
256
+ we(() => {
257
+ const g = new URL(window.location.href).searchParams.get("term");
258
+ g && (v.value = g, r("dsg-table:term-changed", g));
259
259
  });
260
260
  const r = L, b = Qe((h) => {
261
- if (g.value = h, e.replaceState) {
262
- const c = new URL(window.location.href);
263
- g.value ? c.searchParams.set("term", g.value) : c.searchParams.delete("term"), window.history.pushState({}, "", c.toString());
261
+ if (v.value = h, e.replaceState) {
262
+ const g = new URL(window.location.href);
263
+ v.value ? g.searchParams.set("term", v.value) : g.searchParams.delete("term"), window.history.pushState({}, "", g.toString());
264
264
  }
265
- r("dsg-table:term-changed", g.value);
265
+ r("dsg-table:term-changed", v.value);
266
266
  }, 300);
267
- return (h, c) => (l(), o("div", ft, [
267
+ return (h, g) => (l(), i("div", ft, [
268
268
  R(Ke, {
269
- modelValue: g.value,
270
- "onUpdate:modelValue": c[0] || (c[0] = (m) => g.value = m),
269
+ modelValue: v.value,
270
+ "onUpdate:modelValue": g[0] || (g[0] = (m) => v.value = m),
271
271
  name: e.name,
272
272
  id: e.id || e.name,
273
273
  placeholder: e.placeholder,
@@ -280,9 +280,9 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
280
280
  size: "sm",
281
281
  icon: "search-sm",
282
282
  "icon-clickable": !0,
283
- onIconClicked: c[1] || (c[1] = (m) => O(b)(m)),
284
- onEnterPressed: c[2] || (c[2] = (m) => O(b)(m)),
285
- onOnClear: c[3] || (c[3] = () => O(b)(""))
283
+ onIconClicked: g[1] || (g[1] = (m) => O(b)(m)),
284
+ onEnterPressed: g[2] || (g[2] = (m) => O(b)(m)),
285
+ onOnClear: g[3] || (g[3] = () => O(b)(""))
286
286
  }, null, 8, ["modelValue", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
287
287
  ]));
288
288
  }
@@ -297,9 +297,9 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
297
297
  }, wt = ["title", "id", "onClick"], kt = {
298
298
  key: 0,
299
299
  class: "dsg-table--th-sort-icon"
300
- }, Pt = ["innerHTML"], pt = ["innerHTML"], $e = /* @__PURE__ */ K({
300
+ }, Pt = ["innerHTML"], Dt = ["innerHTML"], Te = /* @__PURE__ */ K({
301
301
  __name: "DsgTableRowHeader",
302
- props: /* @__PURE__ */ J({
302
+ props: /* @__PURE__ */ X({
303
303
  fields: {},
304
304
  scrollVisible: { type: Boolean },
305
305
  hasSelectAll: { type: Boolean, default: !1 },
@@ -313,84 +313,84 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
313
313
  hasSelected: { type: Boolean, default: !1 },
314
314
  hasSelectedModifiers: {}
315
315
  }),
316
- emits: /* @__PURE__ */ J(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
316
+ emits: /* @__PURE__ */ X(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
317
317
  setup(e, { emit: L }) {
318
- const g = G(e, "sortField"), r = G(e, "selectedRows"), b = G(e, "hasSelected"), h = k("17px"), c = (C) => {
318
+ const v = J(e, "sortField"), r = J(e, "selectedRows"), b = J(e, "hasSelected"), h = D("17px"), g = (C) => {
319
319
  b.value && r.value.length > 0 && r.value.length !== e.tableDataLength ? (b.value = !0, m("dsg-table:on-select-all")) : !b.value && r.value.length === 0 ? (b.value = !1, m("dsg-table:on-select-all")) : m("dsg-table:on-deselect-all");
320
320
  }, m = L, q = (C, f) => [
321
321
  C,
322
322
  C + "-" + Xe(String(f?.name)),
323
323
  f.titleClass || "",
324
324
  { sortable: f.sortable },
325
- { "sort-active": g.value?.name === f.name }
325
+ { "sort-active": v.value?.name === f.name }
326
326
  ], A = (C) => {
327
- C.sortable && (g.value = {
327
+ C.sortable && (v.value = {
328
328
  name: String(C?.name),
329
329
  field: String(C?.sortField),
330
- direction: g.value?.name === C.name && g.value?.direction === "asc" ? "desc" : "asc"
330
+ direction: v.value?.name === C.name && v.value?.direction === "asc" ? "desc" : "asc"
331
331
  }, m("dsg-table:sort-field", C));
332
332
  };
333
- return (C, f) => (l(), o("tr", ht, [
334
- e.hasSelectAll ? (l(), o("th", mt, [
335
- R(we, {
333
+ return (C, f) => (l(), i("tr", ht, [
334
+ e.hasSelectAll ? (l(), i("th", mt, [
335
+ R(ke, {
336
336
  modelValue: b.value,
337
337
  "onUpdate:modelValue": [
338
338
  f[0] || (f[0] = (a) => b.value = a),
339
- c
339
+ g
340
340
  ],
341
341
  indeterminate: r.value.length > 0 && r.value.length !== e.tableDataLength
342
342
  }, null, 8, ["modelValue", "indeterminate"])
343
343
  ])) : p("", !0),
344
- e.showExpandDetail ? (l(), o("th", yt)) : p("", !0),
345
- (l(!0), o(I, null, N(e.fields, (a, u) => (l(), o(I, null, [
346
- a?.visible ? (l(), o("th", {
344
+ e.showExpandDetail ? (l(), i("th", yt)) : p("", !0),
345
+ (l(!0), i(I, null, N(e.fields, (a, u) => (l(), i(I, null, [
346
+ a?.visible ? (l(), i("th", {
347
347
  key: u,
348
348
  class: B(q("dsg-table--th", a)),
349
- style: X([{ width: a.width || void 0 }, a.style]),
349
+ style: Z([{ width: a.width || void 0 }, a.style]),
350
350
  title: a.title + (a.sortable ? " Sort" : ""),
351
351
  id: "_" + a.name,
352
- onClick: (T) => A(a),
352
+ onClick: ($) => A(a),
353
353
  scope: "col"
354
354
  }, [
355
- a.sortable ? (l(), o("div", kt, [
356
- a.title ? (l(), o("span", {
355
+ a.sortable ? (l(), i("div", kt, [
356
+ a.title ? (l(), i("span", {
357
357
  key: 0,
358
358
  class: "dsg-table--th-title",
359
359
  innerHTML: a.title
360
360
  }, null, 8, Pt)) : p("", !0),
361
- a.sortable && g.value?.name !== a.name ? (l(), j(z, {
361
+ a.sortable && v.value?.name !== a.name ? (l(), j(z, {
362
362
  key: 1,
363
363
  icon: "chevron-selector-vertical",
364
364
  class: "inline-flex",
365
365
  size: "xs"
366
366
  })) : p("", !0),
367
- a.sortable && g.value?.name === a.name && g.value?.direction === "asc" ? (l(), j(z, {
367
+ a.sortable && v.value?.name === a.name && v.value?.direction === "asc" ? (l(), j(z, {
368
368
  key: 2,
369
369
  icon: "chevron-down",
370
370
  class: "inline-flex",
371
371
  size: "xs"
372
372
  })) : p("", !0),
373
- a.sortable && g.value?.name === a.name && g.value?.direction === "desc" ? (l(), j(z, {
373
+ a.sortable && v.value?.name === a.name && v.value?.direction === "desc" ? (l(), j(z, {
374
374
  key: 3,
375
375
  icon: "chevron-up",
376
376
  class: "inline-flex",
377
377
  size: "xs"
378
378
  })) : p("", !0)
379
- ])) : (l(), o("span", {
379
+ ])) : (l(), i("span", {
380
380
  key: 1,
381
381
  class: "dsg-table--th-title",
382
382
  innerHTML: O(Je)(String(a?.title))
383
- }, null, 8, pt))
383
+ }, null, 8, Dt))
384
384
  ], 14, wt)) : p("", !0)
385
385
  ], 64))), 256)),
386
- e.scrollVisible ? (l(), o("th", {
386
+ e.scrollVisible ? (l(), i("th", {
387
387
  key: 2,
388
- style: X({ width: h.value }),
388
+ style: Z({ width: h.value }),
389
389
  class: "dsg-table--th-col-gutter"
390
390
  }, null, 4)) : p("", !0)
391
391
  ]));
392
392
  }
393
- }), Ct = { class: "dsg-table--wrapper" }, Dt = ["span"], $t = {
393
+ }), pt = { class: "dsg-table--wrapper" }, Ct = ["span"], $t = {
394
394
  key: 0,
395
395
  class: "dsg-table--loading"
396
396
  }, Tt = ["colspan"], St = ["colspan"], xt = ["onClick", "onDblclick", "onMouseover"], Ft = {
@@ -398,7 +398,7 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
398
398
  class: "dsg-table--tbody-cell dsg-table--tbody-cell-checkbox"
399
399
  }, Mt = ["onClick", "onDblclick", "onContextmenu"], Lt = ["innerHTML"], Et = ["onClick"], Bt = ["colspan"], Rt = { key: 2 }, It = ["colspan"], At = { class: "dsg-table--footer" }, Ht = /* @__PURE__ */ K({
400
400
  __name: "DsgTableComponent",
401
- props: /* @__PURE__ */ J({
401
+ props: /* @__PURE__ */ X({
402
402
  fields: { default: () => [] },
403
403
  isDraggable: { type: Boolean, default: !1 },
404
404
  dragApi: { default: "" },
@@ -454,8 +454,8 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
454
454
  perPage: { default: 20 },
455
455
  perPageModifiers: {}
456
456
  }),
457
- 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"]),
458
- setup(e, { expose: L, emit: g }) {
457
+ emits: /* @__PURE__ */ X(["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"]),
458
+ setup(e, { expose: L, emit: v }) {
459
459
  const r = (t) => t.map((s, d) => ({
460
460
  field: s.field || "",
461
461
  title: s.title || "",
@@ -468,37 +468,37 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
468
468
  sortable: s.sortField,
469
469
  formatter: s.formatter || null,
470
470
  $_index: d
471
- })), b = k(r(e.fields)), h = k(e.data), c = k(null), m = k(e.initialPage), q = k("17px"), A = k(!1), C = k({}), f = k(0), a = k(!0), u = k(null), T = k(null), D = k(0), S = G(e, "filterParams"), U = G(e, "perPage"), E = k([]), Z = k(!1), W = V(() => e.tableHeight != null), Q = V(() => b.value.filter((t) => t.visible).length);
472
- _(
471
+ })), b = D(r(e.fields)), h = D(e.data), g = D(null), m = D(e.initialPage), q = D("17px"), A = D(!1), C = D({}), f = D(0), a = D(!0), u = D(null), $ = D(null), T = D(0), S = J(e, "filterParams"), U = J(e, "perPage"), E = D([]), _ = D(!1), W = V(() => e.tableHeight != null), Q = V(() => b.value.filter((t) => t.visible).length);
472
+ ee(
473
473
  () => E.value.length,
474
474
  (t) => {
475
- Z.value = e.selectable && t > 0;
475
+ _.value = e.selectable && t > 0;
476
476
  },
477
477
  { immediate: !0 }
478
- ), _(
478
+ ), ee(
479
479
  () => e.fields,
480
480
  (t) => {
481
481
  b.value = r(t);
482
482
  },
483
483
  { immediate: !0, deep: !0 }
484
- ), _(
484
+ ), ee(
485
485
  () => S.value,
486
486
  (t) => {
487
- Y();
487
+ G();
488
488
  },
489
489
  { deep: !0 }
490
- ), _(
490
+ ), ee(
491
491
  () => U.value,
492
492
  () => {
493
- Y();
493
+ G();
494
494
  }
495
- ), _(
495
+ ), ee(
496
496
  () => e.apiUrl,
497
497
  (t, s) => {
498
- e.apiMode && t !== s && t && Y();
498
+ e.apiMode && t !== s && t && G();
499
499
  }
500
500
  );
501
- const H = g, se = (t, s) => t.formatter && typeof t.formatter == "function" ? t.formatter(t, s) : de(s, String(t?.name), ""), ne = (t) => "dsg-field--" + t.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), oe = (t, s) => {
501
+ const H = v, se = (t, s) => t.formatter && typeof t.formatter == "function" ? t.formatter(t, s) : ce(s, String(t?.name), ""), ne = (t) => "dsg-field--" + t.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), oe = (t, s) => {
502
502
  const d = {
503
503
  odd: s % 2 === 0,
504
504
  even: s % 2 !== 0,
@@ -508,17 +508,17 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
508
508
  return d;
509
509
  let x = {};
510
510
  if (typeof e.rowClass == "function") {
511
- const y = e.rowClass(t, s);
512
- typeof y == "string" ? y.split(" ").forEach((M) => {
511
+ const w = e.rowClass(t, s);
512
+ typeof w == "string" ? w.split(" ").forEach((M) => {
513
513
  M.trim() && (x[M.trim()] = !0);
514
- }) : Array.isArray(y) ? y.forEach((M) => {
514
+ }) : Array.isArray(w) ? w.forEach((M) => {
515
515
  typeof M == "string" && M.trim() && (x[M.trim()] = !0);
516
- }) : typeof y == "object" && y !== null && (x = y);
517
- } else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((y) => {
518
- y.trim() && (x[y.trim()] = !0);
516
+ }) : typeof w == "object" && w !== null && (x = w);
517
+ } else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((w) => {
518
+ w.trim() && (x[w.trim()] = !0);
519
519
  });
520
520
  return { ...d, ...x };
521
- }, ae = (t) => {
521
+ }, ie = (t) => {
522
522
  if (e.selectable) {
523
523
  if (t.selected)
524
524
  E.value.push(t);
@@ -528,72 +528,72 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
528
528
  }
529
529
  H("dsg-table:rows-selected", E.value);
530
530
  }
531
- }, ie = () => {
531
+ }, de = () => {
532
532
  e.selectable && (h.value?.forEach((t) => {
533
533
  t.selected = !0;
534
534
  }), E.value = h.value?.filter((t) => t.selected) ?? [], H("dsg-table:rows-selected", E.value));
535
- }, i = () => {
535
+ }, re = () => {
536
536
  e.selectable && (h.value?.forEach((t) => {
537
537
  t.selected = !1;
538
538
  }), E.value = [], H("dsg-table:rows-selected", E.value));
539
- }, n = (t) => {
539
+ }, Y = (t) => {
540
540
  h.value = Array.isArray(t) ? t : [], e.selectable && h.value.forEach((s) => {
541
541
  s.selected = s.selected ?? !1;
542
542
  });
543
- }, v = () => h.value ?? [], P = (t) => {
544
- t === "prev" ? m.value > e.firstPage && m.value-- : t === "next" ? m.value < (c.value?.last_page ?? 0) && m.value++ : t != m.value && t >= e.firstPage && t <= (c.value?.last_page ?? 0) && (m.value = t), Y();
545
- }, $ = () => ({
543
+ }, ue = () => h.value ?? [], n = (t) => {
544
+ t === "prev" ? m.value > e.firstPage && m.value-- : t === "next" ? m.value < (g.value?.last_page ?? 0) && m.value++ : t != m.value && t >= e.firstPage && t <= (g.value?.last_page ?? 0) && (m.value = t), G();
545
+ }, o = () => ({
546
546
  [e.queryParams?.sort]: u.value ? (u.value?.direction === "desc" ? "-" : "") + u.value?.field : void 0,
547
547
  [e.queryParams?.order]: u.value?.direction,
548
548
  [e.queryParams?.page]: m.value,
549
549
  [e.queryParams?.perPage]: U.value
550
- }), le = () => {
551
- T.value && (T.value.abort(), T.value = null);
552
- }, Te = (t, s) => {
553
- le(), D.value++;
554
- const d = D.value, x = new AbortController();
555
- return s.signal = x.signal, T.value = x, (e.httpMethod.toLowerCase() === "get" ? he.get(t, s) : (() => {
550
+ }), c = () => {
551
+ $.value && ($.value.abort(), $.value = null);
552
+ }, y = (t, s) => {
553
+ c(), T.value++;
554
+ const d = T.value, x = new AbortController();
555
+ return s.signal = x.signal, $.value = x, (e.httpMethod.toLowerCase() === "get" ? me.get(t, s) : (() => {
556
556
  const M = s.params;
557
- return delete s.params, he.post(t, M, s);
557
+ return delete s.params, me.post(t, M, s);
558
558
  })()).then(
559
559
  (M) => ({ ...M, _requestId: d, _apiUrl: t }),
560
560
  (M) => {
561
561
  throw M.name === "AbortError" || M.code === "ERR_CANCELED" ? { ...M, _requestId: d, _cancelled: !0 } : { ...M, _requestId: d };
562
562
  }
563
563
  );
564
- }, ue = (t) => {
565
- if (t._requestId && t._requestId !== D.value || t._apiUrl && t._apiUrl !== e.apiUrl)
564
+ }, k = (t) => {
565
+ if (t._requestId && t._requestId !== T.value || t._apiUrl && t._apiUrl !== e.apiUrl)
566
566
  return;
567
567
  H("dsg-table:load-success", t);
568
568
  const s = e.transform ? e.transform(t.data) : t.data;
569
- h.value = de(s, e.dataPath, null), e.selectable && h.value?.forEach((d) => {
569
+ h.value = ce(s, e.dataPath, null), e.selectable && h.value?.forEach((d) => {
570
570
  d.selected = d.selected ?? !1;
571
- }), c.value = de(s, e.paginationPath, null) ?? null, f.value = h.value?.length ? h.value[0].order : f, c.value === null && console.warn(
571
+ }), g.value = ce(s, e.paginationPath, null) ?? null, f.value = h.value?.length ? h.value[0].order : f, g.value === null && console.warn(
572
572
  '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.
573
573
  You can explicitly suppress this warning by setting pagination-path="".`
574
- ), T.value = null, H("dsg-table:pagination-data", c.value), m.value > (c.value?.last_page || 0) && h.value?.length === 0 && (m.value = e.initialPage, Y()), H("dsg-table:loaded"), a.value = !1;
575
- }, ce = (t) => {
576
- t._requestId && t._requestId !== D.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), T.value = null, H("dsg-table:load-error", t), H("dsg-table:loaded"), a.value = !1);
577
- }, ge = () => {
574
+ ), $.value = null, H("dsg-table:pagination-data", g.value), m.value > (g.value?.last_page || 0) && h.value?.length === 0 && (m.value = e.initialPage, G()), H("dsg-table:loaded"), a.value = !1;
575
+ }, le = (t) => {
576
+ t._requestId && t._requestId !== T.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), $.value = null, H("dsg-table:load-error", t), H("dsg-table:loaded"), a.value = !1);
577
+ }, ve = () => {
578
578
  if (e.data !== null && Array.isArray(e.data)) {
579
- n(e.data), a.value = !1;
579
+ Y(e.data), a.value = !1;
580
580
  return;
581
581
  }
582
582
  if (e.dataManager && typeof e.dataManager == "function") {
583
583
  const t = e.dataManager();
584
- n(t), a.value = !1;
584
+ Y(t), a.value = !1;
585
585
  } else
586
- n(e.data), a.value = !1;
587
- }, Y = (t = ue, s = ce, d = {}) => {
588
- const x = t || ue, y = s || ce;
586
+ Y(e.data), a.value = !1;
587
+ }, G = (t = k, s = le, d = {}) => {
588
+ const x = t || k, w = s || le;
589
589
  if (!e.apiMode) {
590
- ge();
590
+ ve();
591
591
  return;
592
592
  }
593
593
  return a.value = !0, H("dsg-table:loading", a.value), e.httpOptions.params = {
594
- ...$(),
594
+ ...o(),
595
595
  ...S.value
596
- }, Te(e.apiUrl, e.httpOptions).then(x).catch((M) => y(M));
596
+ }, y(e.apiUrl, e.httpOptions).then(x).catch((M) => w(M));
597
597
  }, Se = (t, s, d) => {
598
598
  H("dsg-table:row-clicked", t, s, d);
599
599
  }, xe = (t, s, d) => {
@@ -604,71 +604,71 @@ You can explicitly suppress this warning by setting pagination-path="".`
604
604
  }, Ee = (t, s, d, x) => {
605
605
  }, Be = (t, s, d) => {
606
606
  };
607
- ye(() => {
608
- e.apiMode === !0 ? Y() : ge();
607
+ we(() => {
608
+ e.apiMode === !0 ? G() : ve();
609
609
  });
610
- const ve = () => {
611
- e.apiMode && (E.value = [], le(), Y());
610
+ const be = () => {
611
+ e.apiMode && (E.value = [], c(), G());
612
612
  };
613
613
  return L({
614
- changePage: P,
615
- reload: ve,
616
- getData: v,
617
- setData: n,
614
+ changePage: n,
615
+ reload: be,
616
+ getData: ue,
617
+ setData: Y,
618
618
  setLoading: (t) => {
619
619
  a.value = t, H("dsg-table:loading", a.value);
620
620
  }
621
- }), (t, s) => (l(), o("div", Ct, [
622
- w("div", {
621
+ }), (t, s) => (l(), i("div", pt, [
622
+ P("div", {
623
623
  ref: "dsgTableBodyWrapper",
624
624
  class: B(["dsg-table-body-wrapper", { "fixed-header": W.value }]),
625
- style: X({ height: e.tableHeight || void 0 })
625
+ style: Z({ height: e.tableHeight || void 0 })
626
626
  }, [
627
- w("table", {
627
+ P("table", {
628
628
  class: B(["dsg-table-main", W.value ? "fixed-header" : "", C.value.table, "table-" + e.tableLayout])
629
629
  }, [
630
- w("colgroup", { span: Q.value }, [
631
- (l(!0), o(I, null, N(b.value, (d, x) => (l(), o(I, null, [
632
- d?.visible ? (l(), o("col", {
630
+ P("colgroup", { span: Q.value }, [
631
+ (l(!0), i(I, null, N(b.value, (d, x) => (l(), i(I, null, [
632
+ d?.visible ? (l(), i("col", {
633
633
  key: x,
634
- style: X({ width: d.width || void 0 }),
634
+ style: Z({ width: d.width || void 0 }),
635
635
  class: B("dsg-table--col-" + d.name + " " + d.titleClass)
636
636
  }, null, 6)) : p("", !0)
637
637
  ], 64))), 256)),
638
- !W.value && A.value ? (l(), o("col", {
638
+ !W.value && A.value ? (l(), i("col", {
639
639
  key: 0,
640
- style: X({ width: q.value }),
640
+ style: Z({ width: q.value }),
641
641
  class: "dsg-table--col-gutter"
642
642
  }, null, 4)) : p("", !0)
643
- ], 8, Dt),
644
- w("thead", {
643
+ ], 8, Ct),
644
+ P("thead", {
645
645
  class: B([[C.value.thead, { sticky: W.value, "top-0": W.value }], "dsg-table--head"])
646
646
  }, [
647
647
  F(t.$slots, "tableHeader", { fields: b.value }, () => [
648
- R($e, {
648
+ R(Te, {
649
649
  fields: b.value,
650
650
  "has-select-all": e.selectable,
651
651
  "selected-rows": E.value,
652
652
  "onUpdate:selectedRows": s[0] || (s[0] = (d) => E.value = d),
653
- "has-selected": Z.value,
654
- "onUpdate:hasSelected": s[1] || (s[1] = (d) => Z.value = d),
653
+ "has-selected": _.value,
654
+ "onUpdate:hasSelected": s[1] || (s[1] = (d) => _.value = d),
655
655
  "scroll-visible": A.value,
656
656
  "show-expand-detail": e.hasDetailRow && e.showExpandDetail,
657
657
  "table-data-length": h.value?.length,
658
658
  "sort-field": u.value,
659
659
  "onUpdate:sortField": s[2] || (s[2] = (d) => u.value = d),
660
- "onDsgTable:sortField": s[3] || (s[3] = (d) => ve()),
661
- "onDsgTable:onSelectAll": ie,
662
- "onDsgTable:onDeselectAll": i
660
+ "onDsgTable:sortField": s[3] || (s[3] = (d) => be()),
661
+ "onDsgTable:onSelectAll": de,
662
+ "onDsgTable:onDeselectAll": re
663
663
  }, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
664
664
  ])
665
665
  ], 2),
666
- w("tbody", {
666
+ P("tbody", {
667
667
  class: B(["dsg-table--body", C.value.tbody])
668
668
  }, [
669
- a.value ? (l(), o("tr", $t, [
670
- w("td", { colspan: Q.value }, [
671
- w("div", {
669
+ a.value ? (l(), i("tr", $t, [
670
+ P("td", { colspan: Q.value }, [
671
+ P("div", {
672
672
  "aria-label": "Loading...",
673
673
  role: "status",
674
674
  class: "flex items-center space-x-3 h-12 w-full justify-center",
@@ -679,39 +679,39 @@ You can explicitly suppress this warning by setting pagination-path="".`
679
679
  icon: "loading-02",
680
680
  class: "animate-spin"
681
681
  }),
682
- s[4] || (s[4] = w("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
682
+ s[4] || (s[4] = P("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
683
683
  ])
684
684
  ], 8, St)
685
685
  ], 8, Tt)
686
- ])) : (l(!0), o(I, { key: 1 }, N(h.value, (d, x) => (l(), o(I, { key: x }, [
687
- w("tr", {
686
+ ])) : (l(!0), i(I, { key: 1 }, N(h.value, (d, x) => (l(), i(I, { key: x }, [
687
+ P("tr", {
688
688
  class: B(["dsg-table--tbody-row", oe(d, x)]),
689
- onClick: (y) => Se(y, x, d),
690
- onDblclick: (y) => xe(y, x, d),
691
- onMouseover: (y) => Fe()
689
+ onClick: (w) => Se(w, x, d),
690
+ onDblclick: (w) => xe(w, x, d),
691
+ onMouseover: (w) => Fe()
692
692
  }, [
693
- e.selectable ? (l(), o("td", Ft, [
694
- R(we, {
693
+ e.selectable ? (l(), i("td", Ft, [
694
+ R(ke, {
695
695
  modelValue: d.selected,
696
- "onUpdate:modelValue": [(y) => d.selected = y, (y) => ae(d)]
696
+ "onUpdate:modelValue": [(w) => d.selected = w, (w) => ie(d)]
697
697
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
698
698
  ])) : p("", !0),
699
- (l(!0), o(I, null, N(b.value, (y, M) => (l(), o(I, { key: M }, [
700
- y.visible ? (l(), o("td", {
699
+ (l(!0), i(I, null, N(b.value, (w, M) => (l(), i(I, { key: M }, [
700
+ w.visible ? (l(), i("td", {
701
701
  key: 0,
702
- class: B(["dsg-table--tbody-cell", y.dataClass]),
703
- style: X({ width: y.width || void 0 }),
704
- onClick: (be) => Me(),
705
- onDblclick: (be) => Le(),
706
- onContextmenu: (be) => Ee()
702
+ class: B(["dsg-table--tbody-cell", w.dataClass]),
703
+ style: Z({ width: w.width || void 0 }),
704
+ onClick: (fe) => Me(),
705
+ onDblclick: (fe) => Le(),
706
+ onContextmenu: (fe) => Ee()
707
707
  }, [
708
- F(t.$slots, ne(y), {
708
+ F(t.$slots, ne(w), {
709
709
  rowData: d,
710
710
  rowIndex: x,
711
- rowField: y
711
+ rowField: w
712
712
  }, () => [
713
- w("span", {
714
- innerHTML: se(y, d)
713
+ P("span", {
714
+ innerHTML: se(w, d)
715
715
  }, null, 8, Lt)
716
716
  ])
717
717
  ], 46, Mt)) : p("", !0)
@@ -721,12 +721,12 @@ You can explicitly suppress this warning by setting pagination-path="".`
721
721
  key: 0,
722
722
  name: e.detailRowTransition
723
723
  }, {
724
- default: ee(() => [
725
- w("tr", {
724
+ default: te(() => [
725
+ P("tr", {
726
726
  class: "dsg-table--tbody-detail-row",
727
- onClick: (y) => Be()
727
+ onClick: (w) => Be()
728
728
  }, [
729
- w("td", { colspan: Q.value }, [
729
+ P("td", { colspan: Q.value }, [
730
730
  F(t.$slots, "dsg-table-detail-row", {
731
731
  rowData: d,
732
732
  rowIndex: x,
@@ -738,18 +738,18 @@ You can explicitly suppress this warning by setting pagination-path="".`
738
738
  _: 2
739
739
  }, 1032, ["name"])) : p("", !0)
740
740
  ], 64))), 128)),
741
- !a.value && !h.value?.length && e.noDataTemplate.length ? (l(), o("tr", Rt, [
742
- w("td", {
741
+ !a.value && !h.value?.length && e.noDataTemplate.length ? (l(), i("tr", Rt, [
742
+ P("td", {
743
743
  colspan: Q.value,
744
744
  class: "dsg-table--empty-result"
745
745
  }, [
746
746
  F(t.$slots, "dsg-table-empty-result", {}, () => [
747
- Ue(te(e.noDataTemplate), 1)
747
+ Ue(ae(e.noDataTemplate), 1)
748
748
  ])
749
749
  ], 8, It)
750
750
  ])) : p("", !0)
751
751
  ], 2),
752
- w("tfoot", At, [
752
+ P("tfoot", At, [
753
753
  F(t.$slots, "dsg-table-footer", {
754
754
  fields: b.value,
755
755
  data: h.value
@@ -788,6 +788,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
788
788
  filterEndpoint: { default: "" },
789
789
  filterSearchEndpoint: { default: "" },
790
790
  tableLayout: { default: "fixed" },
791
+ autoSortFilters: { type: Boolean, default: !0 },
791
792
  data: { default: null },
792
793
  hasHeader: { type: Boolean, default: !0 },
793
794
  hasFooter: { type: Boolean, default: !0 },
@@ -796,193 +797,203 @@ You can explicitly suppress this warning by setting pagination-path="".`
796
797
  apiMode: { type: Boolean, default: !0 }
797
798
  },
798
799
  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"],
799
- setup(e, { expose: L, emit: g }) {
800
- const r = (i) => {
801
- T.value = i;
802
- }, b = k(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), h = () => {
800
+ setup(e, { expose: L, emit: v }) {
801
+ const r = (n) => {
802
+ $.value = n;
803
+ }, b = D(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), h = () => {
803
804
  if (b.value) {
804
- let i = {};
805
- return Ye().forEach((n) => {
806
- if (n.key.startsWith("filter[")) {
807
- const v = n.key.replace("filter[", "").replace("]", ""), P = n.value;
808
- i[`filter[${v}]`] = P.join(",");
805
+ let n = {};
806
+ return Ye().forEach((o) => {
807
+ if (o.key.startsWith("filter[")) {
808
+ const c = o.key.replace("filter[", "").replace("]", ""), y = o.value;
809
+ n[`filter[${c}]`] = y.join(",");
809
810
  }
810
- }), i;
811
+ }), n;
811
812
  } else
812
813
  return {};
813
- }, c = V(() => ({
814
+ }, g = V(() => ({
814
815
  ...e.css,
815
816
  tableWrapper: "border-b " + (e.css?.tableWrapper || "")
816
- })), m = qe(), q = k(!0), A = k(null), C = k("<p>Showing {from} to {to} of {total}</p>"), f = k(null), a = me("dsgTable"), u = k({ perPage: 20, change: r }), T = k(20), D = k({ ...h(), ...e.initialFilters }), S = g, U = (i) => {
817
- a.value?.changePage(i);
818
- }, E = (i) => {
819
- f.value = i;
820
- }, Z = ({ data: i }) => {
821
- A.value = i, S("dsg-table:data-loaded", i);
817
+ })), m = qe(), q = D(!0), A = D(null), C = D("<p>Showing {from} to {to} of {total}</p>"), f = D(null), a = ye("dsgTable"), u = D({ perPage: 20, change: r }), $ = D(20), T = D({ ...h(), ...e.initialFilters }), S = v, U = (n) => {
818
+ a.value?.changePage(n);
819
+ }, E = (n) => {
820
+ f.value = n;
821
+ }, _ = ({ data: n }) => {
822
+ A.value = n, S("dsg-table:data-loaded", n);
822
823
  }, W = () => {
823
824
  a.value?.reload();
824
- }, Q = (i) => {
825
- a.value?.setLoading(i);
826
- }, H = (i) => {
827
- const n = a.value?.getData?.() ?? [];
828
- a.value?.setData(n.map((v) => v.id === i.id ? i : v));
829
- }, se = (i) => {
830
- const n = a.value?.getData?.() ?? [];
831
- a.value?.setData([...n, i]);
832
- }, ne = (i) => {
833
- const n = a.value?.getData?.() ?? [];
834
- a.value?.setData(n.filter((v) => v.id !== i.id));
835
- }, oe = (i) => {
836
- D.value = i;
837
- }, ae = (i) => {
838
- const n = { ...D.value };
839
- !i || i.trim() === "" ? delete n["filter[term]"] : n["filter[term]"] = i, D.value = n, fe(() => {
825
+ }, Q = (n) => {
826
+ a.value?.setLoading(n);
827
+ }, H = (n) => {
828
+ const o = a.value?.getData?.() ?? [];
829
+ a.value?.setData(o.map((c) => c.id === n.id ? n : c));
830
+ }, se = (n) => {
831
+ const o = a.value?.getData?.() ?? [];
832
+ a.value?.setData([...o, n]);
833
+ }, ne = (n) => {
834
+ const o = a.value?.getData?.() ?? [];
835
+ a.value?.setData(o.filter((c) => c.id !== n.id));
836
+ }, oe = (n) => {
837
+ a.value?.setData(n);
838
+ }, ie = () => a.value?.getData() ?? [], de = (n) => {
839
+ const o = a.value?.getData() ?? [], c = n(o);
840
+ c && a.value?.setData(c);
841
+ }, re = (n) => {
842
+ T.value = n;
843
+ }, Y = (n) => {
844
+ const o = { ...T.value };
845
+ !n || n.trim() === "" ? delete o["filter[term]"] : o["filter[term]"] = n, T.value = o, he(() => {
840
846
  W();
841
- }), S("dsg-table:term-changed", i);
842
- }, ie = (i, n, v) => {
843
- const P = Object.keys(i).length === 0;
844
- let $;
845
- P ? ($ = {}, D.value["filter[term]"] && ($["filter[term]"] = D.value["filter[term]"])) : $ = { ...D.value, ...i }, D.value = $, fe(() => {
847
+ }), S("dsg-table:term-changed", n);
848
+ }, ue = (n, o, c) => {
849
+ let y = {};
850
+ T.value["filter[term]"] && (y["filter[term]"] = T.value["filter[term]"]), Object.keys(n).forEach((k) => {
851
+ n[k] !== null && n[k] !== void 0 && n[k] !== "" && (y[k] = n[k]);
852
+ }), T.value = y, he(() => {
846
853
  W();
847
- }), S("dsg-table:filter-updated", D.value, n, v);
854
+ }), S("dsg-table:filter-updated", T.value, o, c);
848
855
  };
849
856
  return L({
850
857
  reloadTable: W,
851
858
  updateRowTable: H,
852
859
  addRowTable: se,
853
860
  deleteRowTable: ne,
854
- termChanged: ae,
855
- setFilters: oe,
861
+ setData: oe,
862
+ getData: ie,
863
+ mutateData: de,
864
+ termChanged: Y,
865
+ setFilters: re,
856
866
  setLoading: Q
857
- }), (i, n) => (l(), o("div", Ut, [
858
- e.hasHeader ? (l(), o("div", qt, [
859
- F(i.$slots, "dsg-table--pre-header", {}, () => [
860
- w("div", Vt, [
861
- F(i.$slots, "dsg-table--page-title", {
867
+ }), (n, o) => (l(), i("div", Ut, [
868
+ e.hasHeader ? (l(), i("div", qt, [
869
+ F(n.$slots, "dsg-table--pre-header", {}, () => [
870
+ P("div", Vt, [
871
+ F(n.$slots, "dsg-table--page-title", {
862
872
  data: A.value,
863
873
  title: e.title
864
874
  }, () => [
865
- e.title.length > 0 ? (l(), o("h1", {
875
+ e.title.length > 0 ? (l(), i("h1", {
866
876
  key: 0,
867
877
  class: "dsg-table--title",
868
- textContent: te(e.title)
878
+ textContent: ae(e.title)
869
879
  }, null, 8, zt)) : p("", !0)
870
880
  ])
871
881
  ]),
872
- w("div", Ot, [
873
- F(i.$slots, "dsg-table--page-actions", { data: A.value })
882
+ P("div", Ot, [
883
+ F(n.$slots, "dsg-table--page-actions", { data: A.value })
874
884
  ])
875
885
  ])
876
886
  ])) : p("", !0),
877
- e.displayPaginationInfo ? (l(), o("div", Nt, [
878
- w("div", Wt, [
879
- F(i.$slots, "dsg-table--search-header", { data: A.value }, () => [
880
- R(De, {
887
+ e.displayPaginationInfo ? (l(), i("div", Nt, [
888
+ P("div", Wt, [
889
+ F(n.$slots, "dsg-table--search-header", { data: A.value }, () => [
890
+ R($e, {
881
891
  name: "term",
882
- "onDsgTable:termChanged": n[0] || (n[0] = (v) => ae(v))
892
+ "onDsgTable:termChanged": o[0] || (o[0] = (c) => Y(c))
883
893
  }),
884
- R(ke, {
894
+ R(Pe, {
885
895
  entity: e.filterEntity,
886
896
  "filter-endpoint": e.filterEndpoint,
887
897
  "search-endpoint": e.filterSearchEndpoint,
898
+ "auto-sort": e.autoSortFilters,
888
899
  filters: e.filters,
889
- "onDsgTable:filterUpdated": n[1] || (n[1] = (v, P, $) => ie(v, P, $))
890
- }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
891
- F(i.$slots, "dsg-table--search-actions", { data: A.value })
900
+ "onDsgTable:filterUpdated": o[1] || (o[1] = (c, y, k) => ue(c, y, k))
901
+ }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "auto-sort", "filters"]),
902
+ F(n.$slots, "dsg-table--search-actions", { data: A.value })
892
903
  ])
893
904
  ]),
894
- F(i.$slots, "dsg-table--search-navigation")
905
+ F(n.$slots, "dsg-table--search-navigation")
895
906
  ], 512)) : p("", !0),
896
907
  R(Ht, {
897
908
  ref: "dsgTable",
898
909
  "api-url": e.getUrl,
899
- "filter-params": D.value,
900
- "onUpdate:filterParams": n[7] || (n[7] = (v) => D.value = v),
901
- "per-page": T.value,
902
- "onUpdate:perPage": n[8] || (n[8] = (v) => T.value = v),
910
+ "filter-params": T.value,
911
+ "onUpdate:filterParams": o[7] || (o[7] = (c) => T.value = c),
912
+ "per-page": $.value,
913
+ "onUpdate:perPage": o[8] || (o[8] = (c) => $.value = c),
903
914
  fields: e.fields,
904
915
  "load-on-start": e.loadOnStart,
905
916
  "pagination-path": "meta",
906
917
  selectable: e.selectable,
907
918
  "track-by": e.trackBy,
908
919
  "table-layout": e.tableLayout,
909
- css: c.value,
920
+ css: g.value,
910
921
  data: e.data,
911
922
  "row-class": e.rowClass,
912
923
  "api-mode": b.value,
913
- "onDsgTable:loading": n[9] || (n[9] = (v) => q.value = !0),
914
- "onDsgTable:loaded": n[10] || (n[10] = (v) => q.value = !1),
924
+ "onDsgTable:loading": o[9] || (o[9] = (c) => q.value = !0),
925
+ "onDsgTable:loaded": o[10] || (o[10] = (c) => q.value = !1),
915
926
  "onDsgTable:paginationData": E,
916
- "onDsgTable:loadSuccess": Z,
917
- "onDsgTable:rowsSelected": n[11] || (n[11] = (v) => S("dsg-table:rows-selected", v)),
918
- "onDsgTable:rowClicked": n[12] || (n[12] = (v, P, $) => S("dsg-table:row-clicked", v, P, $)),
919
- "onDsgTable:rowHover": n[13] || (n[13] = (v, P, $) => S("dsg-table:row-hover", v, P, $)),
920
- "onDsgTable:rowDblclick": n[14] || (n[14] = (v, P, $) => S("dsg-table:row-dblclick", v, P, $))
927
+ "onDsgTable:loadSuccess": _,
928
+ "onDsgTable:rowsSelected": o[11] || (o[11] = (c) => S("dsg-table:rows-selected", c)),
929
+ "onDsgTable:rowClicked": o[12] || (o[12] = (c, y, k) => S("dsg-table:row-clicked", c, y, k)),
930
+ "onDsgTable:rowHover": o[13] || (o[13] = (c, y, k) => S("dsg-table:row-hover", c, y, k)),
931
+ "onDsgTable:rowDblclick": o[14] || (o[14] = (c, y, k) => S("dsg-table:row-dblclick", c, y, k))
921
932
  }, Ve({
922
- "dsg-field--actions": ee((v) => [
923
- F(i.$slots, "dsg-table-actions", { data: v }, () => [
933
+ "dsg-field--actions": te((c) => [
934
+ F(n.$slots, "dsg-table-actions", { data: c }, () => [
924
935
  (l(), j(Ce, {
925
- key: v.rowIndex,
926
- data: v,
927
- "onDsgTable:actionEdit": n[2] || (n[2] = (P, $) => S("dsg-table:action-edit", P, $)),
928
- "onDsgTable:actionView": n[3] || (n[3] = (P, $) => S("dsg-table:action-view", P, $)),
929
- "onDsgTable:actionDelete": n[4] || (n[4] = (P, $) => S("dsg-table:action-delete", P, $)),
930
- "onDsgTable:actionArchive": n[5] || (n[5] = (P, $) => S("dsg-table:action-archive", P, $)),
931
- "onDsgTable:linkClicked": n[6] || (n[6] = (P, $, le) => S("dsg-table:link-clicked", P, $, le))
936
+ key: c.rowIndex,
937
+ data: c,
938
+ "onDsgTable:actionEdit": o[2] || (o[2] = (y, k) => S("dsg-table:action-edit", y, k)),
939
+ "onDsgTable:actionView": o[3] || (o[3] = (y, k) => S("dsg-table:action-view", y, k)),
940
+ "onDsgTable:actionDelete": o[4] || (o[4] = (y, k) => S("dsg-table:action-delete", y, k)),
941
+ "onDsgTable:actionArchive": o[5] || (o[5] = (y, k) => S("dsg-table:action-archive", y, k)),
942
+ "onDsgTable:linkClicked": o[6] || (o[6] = (y, k, le) => S("dsg-table:link-clicked", y, k, le))
932
943
  }, null, 8, ["data"]))
933
944
  ])
934
945
  ]),
935
946
  _: 2
936
947
  }, [
937
- N(O(m), (v, P) => ({
938
- name: P,
939
- fn: ee(($) => [
940
- String(P) !== "dsg-field--actions" ? F(i.$slots, P, ze(Oe({ key: 0 }, $))) : p("", !0)
948
+ N(O(m), (c, y) => ({
949
+ name: y,
950
+ fn: te((k) => [
951
+ String(y) !== "dsg-field--actions" ? F(n.$slots, y, ze(Oe({ key: 0 }, k))) : p("", !0)
941
952
  ])
942
953
  }))
943
954
  ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "css", "data", "row-class", "api-mode"]),
944
- e.hasFooter ? (l(), o("div", jt, [
945
- w("div", Kt, [
946
- F(i.$slots, "dsg-table--footer-left", {
955
+ e.hasFooter ? (l(), i("div", jt, [
956
+ P("div", Kt, [
957
+ F(n.$slots, "dsg-table--footer-left", {
947
958
  data: f.value,
948
959
  perPage: u.value
949
960
  }, () => [
950
961
  R(pe, {
951
962
  ref: "paginationInfoStart",
952
963
  pagination: f.value,
953
- "onUpdate:pagination": n[15] || (n[15] = (v) => f.value = v),
964
+ "onUpdate:pagination": o[15] || (o[15] = (c) => f.value = c),
954
965
  "info-template": C.value
955
966
  }, null, 8, ["pagination", "info-template"]),
956
- F(i.$slots, "dsg-table--footer-left-extras", {
967
+ F(n.$slots, "dsg-table--footer-left-extras", {
957
968
  data: f.value,
958
969
  perPage: u.value
959
970
  })
960
971
  ])
961
972
  ]),
962
- w("div", Qt, [
963
- F(i.$slots, "dsg-table--footer-center", {
973
+ P("div", Qt, [
974
+ F(n.$slots, "dsg-table--footer-center", {
964
975
  data: f.value,
965
976
  perPage: u.value
966
977
  }, () => [
967
- F(i.$slots, "dsg-table--footer-center-extras", {
978
+ F(n.$slots, "dsg-table--footer-center-extras", {
968
979
  data: f.value,
969
980
  perPage: u.value
970
981
  })
971
982
  ])
972
983
  ]),
973
- w("div", Yt, [
974
- F(i.$slots, "dsg-table--footer-right", {
984
+ P("div", Yt, [
985
+ F(n.$slots, "dsg-table--footer-right", {
975
986
  data: f.value,
976
987
  perPage: u.value
977
988
  }, () => [
978
- q.value === !1 ? (l(), j(Pe, {
989
+ q.value === !1 ? (l(), j(De, {
979
990
  key: 0,
980
991
  ref: "pagination",
981
992
  pagination: f.value,
982
- "onUpdate:pagination": n[16] || (n[16] = (v) => f.value = v),
993
+ "onUpdate:pagination": o[16] || (o[16] = (c) => f.value = c),
983
994
  "onDsgTable:changePage": U
984
995
  }, null, 8, ["pagination"])) : p("", !0),
985
- F(i.$slots, "dsg-table--footer-right-extras", {
996
+ F(n.$slots, "dsg-table--footer-right-extras", {
986
997
  data: f.value,
987
998
  perPage: u.value
988
999
  })
@@ -998,23 +1009,23 @@ You can explicitly suppress this warning by setting pagination-path="".`
998
1009
  perPage: {}
999
1010
  },
1000
1011
  setup(e) {
1001
- return (L, g) => (l(), o("div", Jt, [
1002
- re(w("select", {
1003
- "onUpdate:modelValue": g[0] || (g[0] = (r) => e.perPage.perPage = r),
1012
+ return (L, v) => (l(), i("div", Jt, [
1013
+ ge(P("select", {
1014
+ "onUpdate:modelValue": v[0] || (v[0] = (r) => e.perPage.perPage = r),
1004
1015
  class: "dsg-table--per-page-select",
1005
- onChange: g[1] || (g[1] = (r) => e.perPage.change(e.perPage.perPage))
1016
+ onChange: v[1] || (v[1] = (r) => e.perPage.change(e.perPage.perPage))
1006
1017
  }, [
1007
- (l(!0), o(I, null, N(e.perPageOptions, (r) => (l(), o("option", {
1018
+ (l(!0), i(I, null, N(e.perPageOptions, (r) => (l(), i("option", {
1008
1019
  key: r,
1009
1020
  value: r,
1010
- textContent: te(r)
1021
+ textContent: ae(r)
1011
1022
  }, null, 8, Xt))), 128))
1012
1023
  ], 544), [
1013
1024
  [Ne, e.perPage.perPage]
1014
1025
  ])
1015
1026
  ]));
1016
1027
  }
1017
- }), _t = Gt, ea = Ce, ta = Zt, aa = ke, la = Pe, sa = pe, na = De, oa = $e, ga = {
1028
+ }), _t = Gt, ea = Ce, ta = Zt, aa = Pe, la = De, sa = pe, na = $e, oa = Te, ga = {
1018
1029
  DsgTable: _t,
1019
1030
  DsgTableActions: ea,
1020
1031
  DsgTablePerPage: ta,