@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.
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-Dq7AM0nW.js → DsgTablePerPage.vue_vue_type_style_index_0_lang-BIxdsbw_.js} +2421 -2406
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-B3Ew3xM2.cjs → DsgTablePerPage.vue_vue_type_style_index_0_lang-DU5GAN6E.cjs} +3 -3
- package/dist/components/Table/DsgTable.vue.d.ts +1 -0
- package/dist/components/Table/DsgTableFilter.vue.d.ts +1 -0
- package/dist/dsg-vue.cjs +1 -1
- package/dist/dsg-vue.esm.js +1 -1
- package/dist/dsg-vue.table.cjs +2 -2
- package/dist/dsg-vue.table.esm.js +168 -165
- package/package.json +6 -6
|
@@ -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
|
|
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-
|
|
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 = (
|
|
22
|
-
f("dsg-table:change-page",
|
|
23
|
-
}, u = (
|
|
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
|
|
26
|
+
}), ($, T) => ge((l(), i("div", Ze, [
|
|
27
27
|
e.showFirstLast ? (l(), i("a", {
|
|
28
28
|
key: 0,
|
|
29
|
-
onClick:
|
|
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
|
-
|
|
41
|
-
onClick:
|
|
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
|
-
|
|
64
|
-
onClick:
|
|
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:
|
|
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 =
|
|
122
|
+
const v = D(!1);
|
|
123
123
|
ye("dsgTableActions");
|
|
124
|
-
const r = Ie(), b =
|
|
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,
|
|
170
|
-
["edit", "view", "delete", "archive"].includes(String(
|
|
171
|
-
key:
|
|
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: (
|
|
174
|
+
onClick: (T) => q(u, String($), T)
|
|
175
175
|
}, [
|
|
176
|
-
|
|
177
|
-
class: B(["dsg-table--actions-menu-item", String(
|
|
176
|
+
P("div", {
|
|
177
|
+
class: B(["dsg-table--actions-menu-item", String($)])
|
|
178
178
|
}, [
|
|
179
179
|
R(z, {
|
|
180
|
-
icon: m(String(
|
|
180
|
+
icon: m(String($)),
|
|
181
181
|
size: "sm"
|
|
182
182
|
}, null, 8, ["icon"]),
|
|
183
|
-
|
|
183
|
+
P("span", {
|
|
184
184
|
class: "flex-1",
|
|
185
|
-
textContent: ae(O(Ge)(String(
|
|
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: (
|
|
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
|
-
|
|
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
|
-
|
|
217
|
-
|
|
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 =
|
|
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 =
|
|
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: (
|
|
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 =
|
|
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
|
|
512
|
-
typeof
|
|
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(
|
|
514
|
+
}) : Array.isArray(w) ? w.forEach((M) => {
|
|
515
515
|
typeof M == "string" && M.trim() && (x[M.trim()] = !0);
|
|
516
|
-
}) : typeof
|
|
517
|
-
} else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((
|
|
518
|
-
|
|
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 ?? [],
|
|
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
|
-
},
|
|
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
|
-
|
|
552
|
-
},
|
|
553
|
-
c(),
|
|
554
|
-
const d =
|
|
555
|
-
return s.signal = x.signal,
|
|
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
|
-
},
|
|
565
|
-
if (t._requestId && t._requestId !==
|
|
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
|
-
),
|
|
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 !==
|
|
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 =
|
|
588
|
-
const x = t ||
|
|
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
|
-
...
|
|
594
|
+
...o(),
|
|
595
595
|
...S.value
|
|
596
|
-
},
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
627
|
+
P("table", {
|
|
628
628
|
class: B(["dsg-table-main", W.value ? "fixed-header" : "", C.value.table, "table-" + e.tableLayout])
|
|
629
629
|
}, [
|
|
630
|
-
|
|
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
|
-
|
|
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
|
-
|
|
666
|
+
P("tbody", {
|
|
667
667
|
class: B(["dsg-table--body", C.value.tbody])
|
|
668
668
|
}, [
|
|
669
669
|
a.value ? (l(), i("tr", $t, [
|
|
670
|
-
|
|
671
|
-
|
|
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] =
|
|
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
|
-
|
|
687
|
+
P("tr", {
|
|
688
688
|
class: B(["dsg-table--tbody-row", oe(d, x)]),
|
|
689
|
-
onClick: (
|
|
690
|
-
onDblclick: (
|
|
691
|
-
onMouseover: (
|
|
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": [(
|
|
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, (
|
|
700
|
-
|
|
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",
|
|
703
|
-
style: Z({ width:
|
|
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(
|
|
708
|
+
F(t.$slots, ne(w), {
|
|
709
709
|
rowData: d,
|
|
710
710
|
rowIndex: x,
|
|
711
|
-
rowField:
|
|
711
|
+
rowField: w
|
|
712
712
|
}, () => [
|
|
713
|
-
|
|
714
|
-
innerHTML: se(
|
|
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
|
-
|
|
725
|
+
P("tr", {
|
|
726
726
|
class: "dsg-table--tbody-detail-row",
|
|
727
|
-
onClick: (
|
|
727
|
+
onClick: (w) => Be()
|
|
728
728
|
}, [
|
|
729
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = (
|
|
801
|
-
|
|
802
|
-
}, b =
|
|
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
|
|
805
|
-
return Ye().forEach((
|
|
806
|
-
if (
|
|
807
|
-
const c =
|
|
808
|
-
|
|
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
|
-
}),
|
|
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 =
|
|
817
|
-
a.value?.changePage(
|
|
818
|
-
}, E = (
|
|
819
|
-
f.value =
|
|
820
|
-
}, _ = ({ data:
|
|
821
|
-
A.value =
|
|
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 = (
|
|
825
|
-
a.value?.setLoading(
|
|
826
|
-
}, H = (
|
|
827
|
-
const
|
|
828
|
-
a.value?.setData(
|
|
829
|
-
}, se = (
|
|
830
|
-
const
|
|
831
|
-
a.value?.setData([...
|
|
832
|
-
}, ne = (
|
|
833
|
-
const
|
|
834
|
-
a.value?.setData(
|
|
835
|
-
}, oe = (
|
|
836
|
-
a.value?.setData(
|
|
837
|
-
}, ie = () => a.value?.getData() ?? [], de = (
|
|
838
|
-
const
|
|
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 = (
|
|
841
|
-
|
|
842
|
-
}, Y = (
|
|
843
|
-
const
|
|
844
|
-
!
|
|
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",
|
|
847
|
-
}, ue = (
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
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",
|
|
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
|
-
}), (
|
|
867
|
+
}), (n, o) => (l(), i("div", Ut, [
|
|
866
868
|
e.hasHeader ? (l(), i("div", qt, [
|
|
867
|
-
F(
|
|
868
|
-
|
|
869
|
-
F(
|
|
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
|
-
|
|
881
|
-
F(
|
|
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
|
-
|
|
887
|
-
F(
|
|
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":
|
|
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":
|
|
898
|
-
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
|
|
899
|
-
F(
|
|
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(
|
|
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":
|
|
908
|
-
"onUpdate:filterParams":
|
|
909
|
-
"per-page":
|
|
910
|
-
"onUpdate:perPage":
|
|
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":
|
|
922
|
-
"onDsgTable:loaded":
|
|
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":
|
|
926
|
-
"onDsgTable:rowClicked":
|
|
927
|
-
"onDsgTable:rowHover":
|
|
928
|
-
"onDsgTable:rowDblclick":
|
|
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(
|
|
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":
|
|
936
|
-
"onDsgTable:actionView":
|
|
937
|
-
"onDsgTable:actionDelete":
|
|
938
|
-
"onDsgTable:actionArchive":
|
|
939
|
-
"onDsgTable:linkClicked":
|
|
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,
|
|
946
|
-
name:
|
|
947
|
-
fn: te((
|
|
948
|
-
String(
|
|
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
|
-
|
|
954
|
-
F(
|
|
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":
|
|
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(
|
|
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
|
-
|
|
971
|
-
F(
|
|
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(
|
|
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
|
-
|
|
982
|
-
F(
|
|
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":
|
|
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(
|
|
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(
|
|
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))
|