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