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