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