@dcodegroup-au/dsg-vue 0.1.16 → 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,5 +1,5 @@
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 w, normalizeClass as B, createVNode as R, Fragment as I, renderList as N, vShow as Re, ref as k, 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-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
4
  import { data_get as ce } from "./dsg-vue.helpers-object.esm.js";
5
5
  const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disabled"], tt = ["onClick", "innerHTML"], at = ["onClick", "innerHTML"], lt = ["disabled"], st = ["disabled"], De = /* @__PURE__ */ K({
@@ -18,15 +18,15 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
18
18
  }),
19
19
  emits: /* @__PURE__ */ X(["dsg-table:change-page"], ["update:pagination"]),
20
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 = (T) => {
22
- f("dsg-table:change-page", T);
23
- }, u = (T) => T === r.value?.current_page;
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, $) => ge((l(), i("div", Ze, [
26
+ }), ($, T) => ge((l(), i("div", Ze, [
27
27
  e.showFirstLast ? (l(), i("a", {
28
28
  key: 0,
29
- onClick: $[0] || ($[0] = (S) => a(e.firstPage)),
29
+ onClick: T[0] || (T[0] = (S) => a(e.firstPage)),
30
30
  class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
31
31
  disabled: g.value,
32
32
  title: "First",
@@ -37,8 +37,8 @@ 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: $[1] || ($[1] = (S) => a("prev")),
40
+ P("a", {
41
+ onClick: T[1] || (T[1] = (S) => a("prev")),
42
42
  class: B([[g.value ? "disabled" : ""], "dsg-table--pagination-link"]),
43
43
  disabled: g.value,
44
44
  title: "Previous",
@@ -60,8 +60,8 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
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: $[2] || ($[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",
@@ -74,7 +74,7 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
74
74
  ], 10, lt),
75
75
  e.showFirstLast ? (l(), i("a", {
76
76
  key: 3,
77
- onClick: $[3] || ($[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",
@@ -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 v = k(!1);
122
+ const v = D(!1);
123
123
  ye("dsgTableActions");
124
- const r = Ie(), b = k(r.data.rowData?.actions ?? null), h = k(r.data.rowData?.links ?? null), g = k(r.data.rowData ?? null), m = (f) => {
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";
@@ -166,23 +166,23 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
166
166
  }, {
167
167
  popper: te(() => [
168
168
  v.value ? (l(), i("div", dt, [
169
- (l(!0), i(I, null, N(b.value, (u, T) => (l(), i(I, null, [
170
- ["edit", "view", "delete", "archive"].includes(String(T)) ? (l(), i("a", {
171
- key: T,
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: ($) => q(u, String(T), $)
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: ae(O(Ge)(String(T)))
185
+ textContent: ae(O(Ge)(String($)))
186
186
  }, null, 8, ut)
187
187
  ], 2)
188
188
  ], 8, rt)) : p("", !0)
@@ -200,21 +200,21 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
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, ae(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
215
  default: te(() => [
216
- w("div", it, [
217
- w("button", {
216
+ P("div", it, [
217
+ P("button", {
218
218
  type: "button",
219
219
  class: "dsg-table--actions-button",
220
220
  "aria-expanded": "false",
@@ -252,7 +252,7 @@ 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 v = k("");
255
+ const v = D("");
256
256
  we(() => {
257
257
  const g = new URL(window.location.href).searchParams.get("term");
258
258
  g && (v.value = g, r("dsg-table:term-changed", g));
@@ -315,7 +315,7 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
315
315
  }),
316
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 v = J(e, "sortField"), r = J(e, "selectedRows"), b = J(e, "hasSelected"), h = k("17px"), g = (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,
@@ -349,7 +349,7 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
349
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
355
  a.sortable ? (l(), i("div", kt, [
@@ -468,7 +468,7 @@ 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), g = 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), $ = k(0), S = J(e, "filterParams"), U = J(e, "perPage"), E = k([]), _ = k(!1), W = V(() => e.tableHeight != null), Q = V(() => b.value.filter((t) => t.visible).length);
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
472
  ee(
473
473
  () => E.value.length,
474
474
  (t) => {
@@ -508,14 +508,14 @@ 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
521
  }, ie = (t) => {
@@ -540,19 +540,19 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
540
540
  h.value = Array.isArray(t) ? t : [], e.selectable && h.value.forEach((s) => {
541
541
  s.selected = s.selected ?? !1;
542
542
  });
543
- }, ue = () => h.value ?? [], o = (t) => {
543
+ }, ue = () => h.value ?? [], n = (t) => {
544
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
- }, n = () => ({
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
550
  }), c = () => {
551
- T.value && (T.value.abort(), T.value = null);
552
- }, P = (t, s) => {
553
- c(), $.value++;
554
- const d = $.value, x = new AbortController();
555
- return s.signal = x.signal, T.value = x, (e.httpMethod.toLowerCase() === "get" ? me.get(t, s) : (() => {
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
557
  return delete s.params, me.post(t, M, s);
558
558
  })()).then(
@@ -561,8 +561,8 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
561
561
  throw M.name === "AbortError" || M.code === "ERR_CANCELED" ? { ...M, _requestId: d, _cancelled: !0 } : { ...M, _requestId: d };
562
562
  }
563
563
  );
564
- }, D = (t) => {
565
- if (t._requestId && t._requestId !== $.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;
@@ -571,9 +571,9 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
571
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", 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;
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
575
  }, le = (t) => {
576
- t._requestId && t._requestId !== $.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);
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
577
  }, ve = () => {
578
578
  if (e.data !== null && Array.isArray(e.data)) {
579
579
  Y(e.data), a.value = !1;
@@ -584,16 +584,16 @@ You can explicitly suppress this warning by setting pagination-path="".`
584
584
  Y(t), a.value = !1;
585
585
  } else
586
586
  Y(e.data), a.value = !1;
587
- }, G = (t = D, s = le, d = {}) => {
588
- const x = t || D, y = s || le;
587
+ }, G = (t = k, s = le, d = {}) => {
588
+ const x = t || k, w = s || le;
589
589
  if (!e.apiMode) {
590
590
  ve();
591
591
  return;
592
592
  }
593
593
  return a.value = !0, H("dsg-table:loading", a.value), e.httpOptions.params = {
594
- ...n(),
594
+ ...o(),
595
595
  ...S.value
596
- }, P(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) => {
@@ -611,7 +611,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
611
611
  e.apiMode && (E.value = [], c(), G());
612
612
  };
613
613
  return L({
614
- changePage: o,
614
+ changePage: n,
615
615
  reload: be,
616
616
  getData: ue,
617
617
  setData: Y,
@@ -619,15 +619,15 @@ You can explicitly suppress this warning by setting pagination-path="".`
619
619
  a.value = t, H("dsg-table:loading", a.value);
620
620
  }
621
621
  }), (t, s) => (l(), i("div", pt, [
622
- w("div", {
622
+ P("div", {
623
623
  ref: "dsgTableBodyWrapper",
624
624
  class: B(["dsg-table-body-wrapper", { "fixed-header": W.value }]),
625
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 }, [
630
+ P("colgroup", { span: Q.value }, [
631
631
  (l(!0), i(I, null, N(b.value, (d, x) => (l(), i(I, null, [
632
632
  d?.visible ? (l(), i("col", {
633
633
  key: x,
@@ -641,7 +641,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
641
641
  class: "dsg-table--col-gutter"
642
642
  }, null, 4)) : p("", !0)
643
643
  ], 8, Ct),
644
- w("thead", {
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 }, () => [
@@ -663,12 +663,12 @@ You can explicitly suppress this warning by setting pagination-path="".`
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
669
  a.value ? (l(), i("tr", $t, [
670
- w("td", { colspan: Q.value }, [
671
- w("div", {
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
686
  ])) : (l(!0), i(I, { key: 1 }, N(h.value, (d, x) => (l(), i(I, { key: x }, [
687
- w("tr", {
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
693
  e.selectable ? (l(), i("td", Ft, [
694
694
  R(ke, {
695
695
  modelValue: d.selected,
696
- "onUpdate:modelValue": [(y) => d.selected = y, (y) => ie(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), i(I, null, N(b.value, (y, M) => (l(), i(I, { key: M }, [
700
- y.visible ? (l(), i("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: Z({ width: y.width || void 0 }),
702
+ class: B(["dsg-table--tbody-cell", w.dataClass]),
703
+ style: Z({ width: w.width || void 0 }),
704
704
  onClick: (fe) => Me(),
705
705
  onDblclick: (fe) => Le(),
706
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)
@@ -722,11 +722,11 @@ You can explicitly suppress this warning by setting pagination-path="".`
722
722
  name: e.detailRowTransition
723
723
  }, {
724
724
  default: te(() => [
725
- w("tr", {
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,
@@ -739,7 +739,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
739
739
  }, 1032, ["name"])) : p("", !0)
740
740
  ], 64))), 128)),
741
741
  !a.value && !h.value?.length && e.noDataTemplate.length ? (l(), i("tr", Rt, [
742
- w("td", {
742
+ P("td", {
743
743
  colspan: Q.value,
744
744
  class: "dsg-table--empty-result"
745
745
  }, [
@@ -749,7 +749,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
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 },
@@ -797,59 +798,60 @@ You can explicitly suppress this warning by setting pagination-path="".`
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
800
  setup(e, { expose: L, emit: v }) {
800
- const r = (o) => {
801
- T.value = o;
802
- }, b = k(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), h = () => {
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 o = {};
805
- return Ye().forEach((n) => {
806
- if (n.key.startsWith("filter[")) {
807
- const c = n.key.replace("filter[", "").replace("]", ""), P = n.value;
808
- o[`filter[${c}]`] = 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
- }), o;
811
+ }), n;
811
812
  } else
812
813
  return {};
813
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 = ye("dsgTable"), u = k({ perPage: 20, change: r }), T = k(20), $ = k({ ...h(), ...e.initialFilters }), S = v, U = (o) => {
817
- a.value?.changePage(o);
818
- }, E = (o) => {
819
- f.value = o;
820
- }, _ = ({ data: o }) => {
821
- A.value = o, S("dsg-table:data-loaded", o);
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 = (o) => {
825
- a.value?.setLoading(o);
826
- }, H = (o) => {
827
- const n = a.value?.getData?.() ?? [];
828
- a.value?.setData(n.map((c) => c.id === o.id ? o : c));
829
- }, se = (o) => {
830
- const n = a.value?.getData?.() ?? [];
831
- a.value?.setData([...n, o]);
832
- }, ne = (o) => {
833
- const n = a.value?.getData?.() ?? [];
834
- a.value?.setData(n.filter((c) => c.id !== o.id));
835
- }, oe = (o) => {
836
- a.value?.setData(o);
837
- }, ie = () => a.value?.getData() ?? [], de = (o) => {
838
- const n = a.value?.getData() ?? [], c = o(n);
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);
839
840
  c && a.value?.setData(c);
840
- }, re = (o) => {
841
- $.value = o;
842
- }, Y = (o) => {
843
- const n = { ...$.value };
844
- !o || o.trim() === "" ? delete n["filter[term]"] : n["filter[term]"] = o, $.value = n, he(() => {
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(() => {
845
846
  W();
846
- }), S("dsg-table:term-changed", o);
847
- }, ue = (o, n, c) => {
848
- const P = Object.keys(o).length === 0;
849
- let D;
850
- P ? (D = {}, $.value["filter[term]"] && (D["filter[term]"] = $.value["filter[term]"])) : D = { ...$.value, ...o }, $.value = D, he(() => {
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(() => {
851
853
  W();
852
- }), S("dsg-table:filter-updated", $.value, n, c);
854
+ }), S("dsg-table:filter-updated", T.value, o, c);
853
855
  };
854
856
  return L({
855
857
  reloadTable: W,
@@ -862,11 +864,11 @@ You can explicitly suppress this warning by setting pagination-path="".`
862
864
  termChanged: Y,
863
865
  setFilters: re,
864
866
  setLoading: Q
865
- }), (o, n) => (l(), i("div", Ut, [
867
+ }), (n, o) => (l(), i("div", Ut, [
866
868
  e.hasHeader ? (l(), i("div", qt, [
867
- F(o.$slots, "dsg-table--pre-header", {}, () => [
868
- w("div", Vt, [
869
- F(o.$slots, "dsg-table--page-title", {
869
+ F(n.$slots, "dsg-table--pre-header", {}, () => [
870
+ P("div", Vt, [
871
+ F(n.$slots, "dsg-table--page-title", {
870
872
  data: A.value,
871
873
  title: e.title
872
874
  }, () => [
@@ -877,37 +879,38 @@ You can explicitly suppress this warning by setting pagination-path="".`
877
879
  }, null, 8, zt)) : p("", !0)
878
880
  ])
879
881
  ]),
880
- w("div", Ot, [
881
- F(o.$slots, "dsg-table--page-actions", { data: A.value })
882
+ P("div", Ot, [
883
+ F(n.$slots, "dsg-table--page-actions", { data: A.value })
882
884
  ])
883
885
  ])
884
886
  ])) : p("", !0),
885
887
  e.displayPaginationInfo ? (l(), i("div", Nt, [
886
- w("div", Wt, [
887
- F(o.$slots, "dsg-table--search-header", { data: A.value }, () => [
888
+ P("div", Wt, [
889
+ F(n.$slots, "dsg-table--search-header", { data: A.value }, () => [
888
890
  R($e, {
889
891
  name: "term",
890
- "onDsgTable:termChanged": n[0] || (n[0] = (c) => Y(c))
892
+ "onDsgTable:termChanged": o[0] || (o[0] = (c) => Y(c))
891
893
  }),
892
894
  R(Pe, {
893
895
  entity: e.filterEntity,
894
896
  "filter-endpoint": e.filterEndpoint,
895
897
  "search-endpoint": e.filterSearchEndpoint,
898
+ "auto-sort": e.autoSortFilters,
896
899
  filters: e.filters,
897
- "onDsgTable:filterUpdated": n[1] || (n[1] = (c, P, D) => ue(c, P, D))
898
- }, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
899
- F(o.$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 })
900
903
  ])
901
904
  ]),
902
- F(o.$slots, "dsg-table--search-navigation")
905
+ F(n.$slots, "dsg-table--search-navigation")
903
906
  ], 512)) : p("", !0),
904
907
  R(Ht, {
905
908
  ref: "dsgTable",
906
909
  "api-url": e.getUrl,
907
- "filter-params": $.value,
908
- "onUpdate:filterParams": n[7] || (n[7] = (c) => $.value = c),
909
- "per-page": T.value,
910
- "onUpdate:perPage": n[8] || (n[8] = (c) => T.value = c),
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),
911
914
  fields: e.fields,
912
915
  "load-on-start": e.loadOnStart,
913
916
  "pagination-path": "meta",
@@ -918,68 +921,68 @@ You can explicitly suppress this warning by setting pagination-path="".`
918
921
  data: e.data,
919
922
  "row-class": e.rowClass,
920
923
  "api-mode": b.value,
921
- "onDsgTable:loading": n[9] || (n[9] = (c) => q.value = !0),
922
- "onDsgTable:loaded": n[10] || (n[10] = (c) => 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),
923
926
  "onDsgTable:paginationData": E,
924
927
  "onDsgTable:loadSuccess": _,
925
- "onDsgTable:rowsSelected": n[11] || (n[11] = (c) => S("dsg-table:rows-selected", c)),
926
- "onDsgTable:rowClicked": n[12] || (n[12] = (c, P, D) => S("dsg-table:row-clicked", c, P, D)),
927
- "onDsgTable:rowHover": n[13] || (n[13] = (c, P, D) => S("dsg-table:row-hover", c, P, D)),
928
- "onDsgTable:rowDblclick": n[14] || (n[14] = (c, P, D) => S("dsg-table:row-dblclick", c, P, D))
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))
929
932
  }, Ve({
930
933
  "dsg-field--actions": te((c) => [
931
- F(o.$slots, "dsg-table-actions", { data: c }, () => [
934
+ F(n.$slots, "dsg-table-actions", { data: c }, () => [
932
935
  (l(), j(Ce, {
933
936
  key: c.rowIndex,
934
937
  data: c,
935
- "onDsgTable:actionEdit": n[2] || (n[2] = (P, D) => S("dsg-table:action-edit", P, D)),
936
- "onDsgTable:actionView": n[3] || (n[3] = (P, D) => S("dsg-table:action-view", P, D)),
937
- "onDsgTable:actionDelete": n[4] || (n[4] = (P, D) => S("dsg-table:action-delete", P, D)),
938
- "onDsgTable:actionArchive": n[5] || (n[5] = (P, D) => S("dsg-table:action-archive", P, D)),
939
- "onDsgTable:linkClicked": n[6] || (n[6] = (P, D, le) => S("dsg-table:link-clicked", P, D, le))
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))
940
943
  }, null, 8, ["data"]))
941
944
  ])
942
945
  ]),
943
946
  _: 2
944
947
  }, [
945
- N(O(m), (c, P) => ({
946
- name: P,
947
- fn: te((D) => [
948
- String(P) !== "dsg-field--actions" ? F(o.$slots, P, ze(Oe({ key: 0 }, D))) : 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)
949
952
  ])
950
953
  }))
951
954
  ]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "css", "data", "row-class", "api-mode"]),
952
955
  e.hasFooter ? (l(), i("div", jt, [
953
- w("div", Kt, [
954
- F(o.$slots, "dsg-table--footer-left", {
956
+ P("div", Kt, [
957
+ F(n.$slots, "dsg-table--footer-left", {
955
958
  data: f.value,
956
959
  perPage: u.value
957
960
  }, () => [
958
961
  R(pe, {
959
962
  ref: "paginationInfoStart",
960
963
  pagination: f.value,
961
- "onUpdate:pagination": n[15] || (n[15] = (c) => f.value = c),
964
+ "onUpdate:pagination": o[15] || (o[15] = (c) => f.value = c),
962
965
  "info-template": C.value
963
966
  }, null, 8, ["pagination", "info-template"]),
964
- F(o.$slots, "dsg-table--footer-left-extras", {
967
+ F(n.$slots, "dsg-table--footer-left-extras", {
965
968
  data: f.value,
966
969
  perPage: u.value
967
970
  })
968
971
  ])
969
972
  ]),
970
- w("div", Qt, [
971
- F(o.$slots, "dsg-table--footer-center", {
973
+ P("div", Qt, [
974
+ F(n.$slots, "dsg-table--footer-center", {
972
975
  data: f.value,
973
976
  perPage: u.value
974
977
  }, () => [
975
- F(o.$slots, "dsg-table--footer-center-extras", {
978
+ F(n.$slots, "dsg-table--footer-center-extras", {
976
979
  data: f.value,
977
980
  perPage: u.value
978
981
  })
979
982
  ])
980
983
  ]),
981
- w("div", Yt, [
982
- F(o.$slots, "dsg-table--footer-right", {
984
+ P("div", Yt, [
985
+ F(n.$slots, "dsg-table--footer-right", {
983
986
  data: f.value,
984
987
  perPage: u.value
985
988
  }, () => [
@@ -987,10 +990,10 @@ You can explicitly suppress this warning by setting pagination-path="".`
987
990
  key: 0,
988
991
  ref: "pagination",
989
992
  pagination: f.value,
990
- "onUpdate:pagination": n[16] || (n[16] = (c) => f.value = c),
993
+ "onUpdate:pagination": o[16] || (o[16] = (c) => f.value = c),
991
994
  "onDsgTable:changePage": U
992
995
  }, null, 8, ["pagination"])) : p("", !0),
993
- F(o.$slots, "dsg-table--footer-right-extras", {
996
+ F(n.$slots, "dsg-table--footer-right-extras", {
994
997
  data: f.value,
995
998
  perPage: u.value
996
999
  })
@@ -1007,7 +1010,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
1007
1010
  },
1008
1011
  setup(e) {
1009
1012
  return (L, v) => (l(), i("div", Jt, [
1010
- ge(w("select", {
1013
+ ge(P("select", {
1011
1014
  "onUpdate:modelValue": v[0] || (v[0] = (r) => e.perPage.perPage = r),
1012
1015
  class: "dsg-table--per-page-select",
1013
1016
  onChange: v[1] || (v[1] = (r) => e.perPage.change(e.perPage.perPage))