@dcodegroup-au/dsg-vue 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-Dq7AM0nW.js → DsgTablePerPage.vue_vue_type_style_index_0_lang-BIxdsbw_.js} +2421 -2406
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-B3Ew3xM2.cjs → DsgTablePerPage.vue_vue_type_style_index_0_lang-DU5GAN6E.cjs} +3 -3
- package/dist/components/Table/DsgTable.vue.d.ts +4 -0
- package/dist/components/Table/DsgTableFilter.vue.d.ts +1 -0
- package/dist/dsg-vue.cjs +1 -1
- package/dist/dsg-vue.esm.js +1 -1
- package/dist/dsg-vue.table.cjs +2 -2
- package/dist/dsg-vue.table.esm.js +326 -315
- package/dist/table.d.ts +18 -0
- package/package.json +7 -7
|
@@ -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 P, normalizeClass as B, createVNode as R, Fragment as I, renderList as N, vShow as Re, ref as D, useTemplateRef as ye, useAttrs as Ie, unref as O, withCtx as te, renderSlot as F, toDisplayString as ae, createBlock as j, resolveDynamicComponent as Ae, onMounted as we, normalizeStyle as Z, watch as ee, Transition as He, createTextVNode as Ue, useSlots as qe, createSlots as Ve, normalizeProps as ze, mergeProps as Oe, nextTick as he, vModelSelect as Ne } from "vue";
|
|
2
|
+
import { _ as z, k as We, v as je, f as Ke, u as Qe, c as ke, e as me, i as Pe, j as Ye } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-BIxdsbw_.js";
|
|
3
3
|
import { ucfirst as Ge, ucwords as Je, toSnakeCase as Xe } from "./dsg-vue.helpers-string.esm.js";
|
|
4
|
-
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 =
|
|
22
|
-
f("dsg-table:change-page",
|
|
23
|
-
}, u = (
|
|
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 = ($) => {
|
|
22
|
+
f("dsg-table:change-page", $);
|
|
23
|
+
}, u = ($) => $ === 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: T[0] || (T[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
|
}, [
|
|
@@ -37,10 +37,10 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
|
|
|
37
37
|
size: "sm"
|
|
38
38
|
}, null, 8, ["icon"])
|
|
39
39
|
], 10, _e)) : p("", !0),
|
|
40
|
-
|
|
41
|
-
onClick:
|
|
42
|
-
class: B([[
|
|
43
|
-
disabled:
|
|
40
|
+
P("a", {
|
|
41
|
+
onClick: T[1] || (T[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
|
-
|
|
64
|
-
onClick:
|
|
63
|
+
P("a", {
|
|
64
|
+
onClick: T[2] || (T[2] = (S) => a("next")),
|
|
65
65
|
class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
66
66
|
disabled: m.value,
|
|
67
67
|
title: "Next",
|
|
@@ -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: T[3] || (T[3] = (S) => a(h.value)),
|
|
78
78
|
class: B([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
79
79
|
disabled: m.value,
|
|
80
80
|
title: "Last",
|
|
@@ -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 =
|
|
122
|
+
const v = D(!1);
|
|
123
|
+
ye("dsgTableActions");
|
|
124
|
+
const r = Ie(), b = D(r.data.rowData?.actions ?? null), h = D(r.data.rowData?.links ?? null), g = D(r.data.rowData ?? null), m = (f) => {
|
|
125
125
|
switch (f) {
|
|
126
126
|
case "edit":
|
|
127
127
|
return "edit-05";
|
|
@@ -137,89 +137,89 @@ 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(
|
|
171
|
-
key:
|
|
167
|
+
popper: te(() => [
|
|
168
|
+
v.value ? (l(), i("div", dt, [
|
|
169
|
+
(l(!0), i(I, null, N(b.value, (u, $) => (l(), i(I, null, [
|
|
170
|
+
["edit", "view", "delete", "archive"].includes(String($)) ? (l(), i("a", {
|
|
171
|
+
key: $,
|
|
172
172
|
href: b.value?.link,
|
|
173
173
|
target: b.value?.target || "_self",
|
|
174
|
-
onClick: (
|
|
174
|
+
onClick: (T) => q(u, String($), T)
|
|
175
175
|
}, [
|
|
176
|
-
|
|
177
|
-
class: B(["dsg-table--actions-menu-item", String(
|
|
176
|
+
P("div", {
|
|
177
|
+
class: B(["dsg-table--actions-menu-item", String($)])
|
|
178
178
|
}, [
|
|
179
179
|
R(z, {
|
|
180
|
-
icon: m(String(
|
|
180
|
+
icon: m(String($)),
|
|
181
181
|
size: "sm"
|
|
182
182
|
}, null, 8, ["icon"]),
|
|
183
|
-
|
|
183
|
+
P("span", {
|
|
184
184
|
class: "flex-1",
|
|
185
|
-
textContent:
|
|
185
|
+
textContent: ae(O(Ge)(String($)))
|
|
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",
|
|
202
202
|
class: B(["dsg-table--actions-menu-item", u.class]),
|
|
203
|
-
onClick: (
|
|
203
|
+
onClick: ($) => A(u, $)
|
|
204
204
|
}, [
|
|
205
205
|
u.icon ? (l(), j(z, {
|
|
206
206
|
key: 0,
|
|
207
207
|
icon: u.icon,
|
|
208
208
|
size: "sm"
|
|
209
209
|
}, null, 8, ["icon"])) : p("", !0),
|
|
210
|
-
|
|
210
|
+
P("span", bt, ae(u.label), 1)
|
|
211
211
|
], 10, vt))
|
|
212
212
|
], 64))), 128)) : p("", !0)
|
|
213
213
|
])) : p("", !0)
|
|
214
214
|
]),
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
default: te(() => [
|
|
216
|
+
P("div", it, [
|
|
217
|
+
P("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 = D("");
|
|
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 = D("17px"), g = (C) => {
|
|
319
319
|
b.value && r.value.length > 0 && r.value.length !== e.tableDataLength ? (b.value = !0, m("dsg-table:on-select-all")) : !b.value && r.value.length === 0 ? (b.value = !1, m("dsg-table:on-select-all")) : m("dsg-table:on-deselect-all");
|
|
320
320
|
}, m = L, q = (C, f) => [
|
|
321
321
|
C,
|
|
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
|
-
onClick: (
|
|
352
|
+
onClick: ($) => 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 =
|
|
472
|
-
|
|
471
|
+
})), b = D(r(e.fields)), h = D(e.data), g = D(null), m = D(e.initialPage), q = D("17px"), A = D(!1), C = D({}), f = D(0), a = D(!0), u = D(null), $ = D(null), T = D(0), S = J(e, "filterParams"), U = J(e, "perPage"), E = D([]), _ = D(!1), W = V(() => e.tableHeight != null), Q = V(() => b.value.filter((t) => t.visible).length);
|
|
472
|
+
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,
|
|
@@ -508,17 +508,17 @@ const Ze = { class: "dsg-table--pagination" }, _e = ["disabled"], et = ["disable
|
|
|
508
508
|
return d;
|
|
509
509
|
let x = {};
|
|
510
510
|
if (typeof e.rowClass == "function") {
|
|
511
|
-
const
|
|
512
|
-
typeof
|
|
511
|
+
const w = e.rowClass(t, s);
|
|
512
|
+
typeof w == "string" ? w.split(" ").forEach((M) => {
|
|
513
513
|
M.trim() && (x[M.trim()] = !0);
|
|
514
|
-
}) : Array.isArray(
|
|
514
|
+
}) : Array.isArray(w) ? w.forEach((M) => {
|
|
515
515
|
typeof M == "string" && M.trim() && (x[M.trim()] = !0);
|
|
516
|
-
}) : typeof
|
|
517
|
-
} else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((
|
|
518
|
-
|
|
516
|
+
}) : typeof w == "object" && w !== null && (x = w);
|
|
517
|
+
} else typeof e.rowClass == "string" && e.rowClass.split(" ").forEach((w) => {
|
|
518
|
+
w.trim() && (x[w.trim()] = !0);
|
|
519
519
|
});
|
|
520
520
|
return { ...d, ...x };
|
|
521
|
-
},
|
|
521
|
+
}, ie = (t) => {
|
|
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 ?? [], n = (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
|
+
}, o = () => ({
|
|
546
546
|
[e.queryParams?.sort]: u.value ? (u.value?.direction === "desc" ? "-" : "") + u.value?.field : void 0,
|
|
547
547
|
[e.queryParams?.order]: u.value?.direction,
|
|
548
548
|
[e.queryParams?.page]: m.value,
|
|
549
549
|
[e.queryParams?.perPage]: U.value
|
|
550
|
-
}),
|
|
551
|
-
|
|
552
|
-
},
|
|
553
|
-
|
|
554
|
-
const d =
|
|
555
|
-
return s.signal = x.signal,
|
|
550
|
+
}), c = () => {
|
|
551
|
+
$.value && ($.value.abort(), $.value = null);
|
|
552
|
+
}, y = (t, s) => {
|
|
553
|
+
c(), T.value++;
|
|
554
|
+
const d = T.value, x = new AbortController();
|
|
555
|
+
return s.signal = x.signal, $.value = x, (e.httpMethod.toLowerCase() === "get" ? me.get(t, s) : (() => {
|
|
556
556
|
const M = s.params;
|
|
557
|
-
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
|
+
}, k = (t) => {
|
|
565
|
+
if (t._requestId && t._requestId !== T.value || t._apiUrl && t._apiUrl !== e.apiUrl)
|
|
566
566
|
return;
|
|
567
567
|
H("dsg-table:load-success", t);
|
|
568
568
|
const s = e.transform ? e.transform(t.data) : t.data;
|
|
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
|
-
),
|
|
575
|
-
},
|
|
576
|
-
t._requestId && t._requestId !==
|
|
577
|
-
},
|
|
574
|
+
), $.value = null, H("dsg-table:pagination-data", g.value), m.value > (g.value?.last_page || 0) && h.value?.length === 0 && (m.value = e.initialPage, G()), H("dsg-table:loaded"), a.value = !1;
|
|
575
|
+
}, le = (t) => {
|
|
576
|
+
t._requestId && t._requestId !== T.value || t._apiUrl && t._apiUrl !== e.apiUrl || t._cancelled || (console.error("load-error", t), $.value = null, H("dsg-table:load-error", t), H("dsg-table:loaded"), a.value = !1);
|
|
577
|
+
}, 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 = k, s = le, d = {}) => {
|
|
588
|
+
const x = t || k, w = s || le;
|
|
589
589
|
if (!e.apiMode) {
|
|
590
|
-
|
|
590
|
+
ve();
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
593
|
return a.value = !0, H("dsg-table:loading", a.value), e.httpOptions.params = {
|
|
594
|
-
|
|
594
|
+
...o(),
|
|
595
595
|
...S.value
|
|
596
|
-
},
|
|
596
|
+
}, y(e.apiUrl, e.httpOptions).then(x).catch((M) => w(M));
|
|
597
597
|
}, Se = (t, s, d) => {
|
|
598
598
|
H("dsg-table:row-clicked", t, s, d);
|
|
599
599
|
}, xe = (t, s, d) => {
|
|
@@ -604,71 +604,71 @@ 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: n,
|
|
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(),
|
|
622
|
-
|
|
621
|
+
}), (t, s) => (l(), i("div", pt, [
|
|
622
|
+
P("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
|
+
P("table", {
|
|
628
628
|
class: B(["dsg-table-main", W.value ? "fixed-header" : "", C.value.table, "table-" + e.tableLayout])
|
|
629
629
|
}, [
|
|
630
|
-
|
|
631
|
-
(l(!0),
|
|
632
|
-
d?.visible ? (l(),
|
|
630
|
+
P("colgroup", { span: Q.value }, [
|
|
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,
|
|
644
|
-
|
|
643
|
+
], 8, Ct),
|
|
644
|
+
P("thead", {
|
|
645
645
|
class: B([[C.value.thead, { sticky: W.value, "top-0": W.value }], "dsg-table--head"])
|
|
646
646
|
}, [
|
|
647
647
|
F(t.$slots, "tableHeader", { fields: b.value }, () => [
|
|
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
|
+
P("tbody", {
|
|
667
667
|
class: B(["dsg-table--body", C.value.tbody])
|
|
668
668
|
}, [
|
|
669
|
-
a.value ? (l(),
|
|
670
|
-
|
|
671
|
-
|
|
669
|
+
a.value ? (l(), i("tr", $t, [
|
|
670
|
+
P("td", { colspan: Q.value }, [
|
|
671
|
+
P("div", {
|
|
672
672
|
"aria-label": "Loading...",
|
|
673
673
|
role: "status",
|
|
674
674
|
class: "flex items-center space-x-3 h-12 w-full justify-center",
|
|
@@ -679,39 +679,39 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
679
679
|
icon: "loading-02",
|
|
680
680
|
class: "animate-spin"
|
|
681
681
|
}),
|
|
682
|
-
s[4] || (s[4] =
|
|
682
|
+
s[4] || (s[4] = P("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
|
|
683
683
|
])
|
|
684
684
|
], 8, St)
|
|
685
685
|
], 8, Tt)
|
|
686
|
-
])) : (l(!0),
|
|
687
|
-
|
|
686
|
+
])) : (l(!0), i(I, { key: 1 }, N(h.value, (d, x) => (l(), i(I, { key: x }, [
|
|
687
|
+
P("tr", {
|
|
688
688
|
class: B(["dsg-table--tbody-row", oe(d, x)]),
|
|
689
|
-
onClick: (
|
|
690
|
-
onDblclick: (
|
|
691
|
-
onMouseover: (
|
|
689
|
+
onClick: (w) => Se(w, x, d),
|
|
690
|
+
onDblclick: (w) => xe(w, x, d),
|
|
691
|
+
onMouseover: (w) => Fe()
|
|
692
692
|
}, [
|
|
693
|
-
e.selectable ? (l(),
|
|
694
|
-
R(
|
|
693
|
+
e.selectable ? (l(), i("td", Ft, [
|
|
694
|
+
R(ke, {
|
|
695
695
|
modelValue: d.selected,
|
|
696
|
-
"onUpdate:modelValue": [(
|
|
696
|
+
"onUpdate:modelValue": [(w) => d.selected = w, (w) => ie(d)]
|
|
697
697
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
698
698
|
])) : p("", !0),
|
|
699
|
-
(l(!0),
|
|
700
|
-
|
|
699
|
+
(l(!0), i(I, null, N(b.value, (w, M) => (l(), i(I, { key: M }, [
|
|
700
|
+
w.visible ? (l(), i("td", {
|
|
701
701
|
key: 0,
|
|
702
|
-
class: B(["dsg-table--tbody-cell",
|
|
703
|
-
style:
|
|
704
|
-
onClick: (
|
|
705
|
-
onDblclick: (
|
|
706
|
-
onContextmenu: (
|
|
702
|
+
class: B(["dsg-table--tbody-cell", w.dataClass]),
|
|
703
|
+
style: Z({ width: w.width || void 0 }),
|
|
704
|
+
onClick: (fe) => Me(),
|
|
705
|
+
onDblclick: (fe) => Le(),
|
|
706
|
+
onContextmenu: (fe) => Ee()
|
|
707
707
|
}, [
|
|
708
|
-
F(t.$slots, ne(
|
|
708
|
+
F(t.$slots, ne(w), {
|
|
709
709
|
rowData: d,
|
|
710
710
|
rowIndex: x,
|
|
711
|
-
rowField:
|
|
711
|
+
rowField: w
|
|
712
712
|
}, () => [
|
|
713
|
-
|
|
714
|
-
innerHTML: se(
|
|
713
|
+
P("span", {
|
|
714
|
+
innerHTML: se(w, d)
|
|
715
715
|
}, null, 8, Lt)
|
|
716
716
|
])
|
|
717
717
|
], 46, Mt)) : p("", !0)
|
|
@@ -721,12 +721,12 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
721
721
|
key: 0,
|
|
722
722
|
name: e.detailRowTransition
|
|
723
723
|
}, {
|
|
724
|
-
default:
|
|
725
|
-
|
|
724
|
+
default: te(() => [
|
|
725
|
+
P("tr", {
|
|
726
726
|
class: "dsg-table--tbody-detail-row",
|
|
727
|
-
onClick: (
|
|
727
|
+
onClick: (w) => Be()
|
|
728
728
|
}, [
|
|
729
|
-
|
|
729
|
+
P("td", { colspan: Q.value }, [
|
|
730
730
|
F(t.$slots, "dsg-table-detail-row", {
|
|
731
731
|
rowData: d,
|
|
732
732
|
rowIndex: x,
|
|
@@ -738,18 +738,18 @@ 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(),
|
|
742
|
-
|
|
741
|
+
!a.value && !h.value?.length && e.noDataTemplate.length ? (l(), i("tr", Rt, [
|
|
742
|
+
P("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)
|
|
751
751
|
], 2),
|
|
752
|
-
|
|
752
|
+
P("tfoot", At, [
|
|
753
753
|
F(t.$slots, "dsg-table-footer", {
|
|
754
754
|
fields: b.value,
|
|
755
755
|
data: h.value
|
|
@@ -788,6 +788,7 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
788
788
|
filterEndpoint: { default: "" },
|
|
789
789
|
filterSearchEndpoint: { default: "" },
|
|
790
790
|
tableLayout: { default: "fixed" },
|
|
791
|
+
autoSortFilters: { type: Boolean, default: !0 },
|
|
791
792
|
data: { default: null },
|
|
792
793
|
hasHeader: { type: Boolean, default: !0 },
|
|
793
794
|
hasFooter: { type: Boolean, default: !0 },
|
|
@@ -796,193 +797,203 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
796
797
|
apiMode: { type: Boolean, default: !0 }
|
|
797
798
|
},
|
|
798
799
|
emits: ["dsg-table:action-edit", "dsg-table:action-view", "dsg-table:action-delete", "dsg-table:action-archive", "dsg-table:link-clicked", "dsg-table:rows-selected", "dsg-table:row-clicked", "dsg-table:row-hover", "dsg-table:row-dblclick", "dsg-table:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded"],
|
|
799
|
-
setup(e, { expose: L, emit:
|
|
800
|
-
const r = (
|
|
801
|
-
|
|
802
|
-
}, b =
|
|
800
|
+
setup(e, { expose: L, emit: v }) {
|
|
801
|
+
const r = (n) => {
|
|
802
|
+
$.value = n;
|
|
803
|
+
}, b = D(e.apiMode && !!(e.filterEntity || e.filterEndpoint || e.getUrl)), h = () => {
|
|
803
804
|
if (b.value) {
|
|
804
|
-
let
|
|
805
|
-
return Ye().forEach((
|
|
806
|
-
if (
|
|
807
|
-
const
|
|
808
|
-
|
|
805
|
+
let n = {};
|
|
806
|
+
return Ye().forEach((o) => {
|
|
807
|
+
if (o.key.startsWith("filter[")) {
|
|
808
|
+
const c = o.key.replace("filter[", "").replace("]", ""), y = o.value;
|
|
809
|
+
n[`filter[${c}]`] = y.join(",");
|
|
809
810
|
}
|
|
810
|
-
}),
|
|
811
|
+
}), n;
|
|
811
812
|
} else
|
|
812
813
|
return {};
|
|
813
|
-
},
|
|
814
|
+
}, g = V(() => ({
|
|
814
815
|
...e.css,
|
|
815
816
|
tableWrapper: "border-b " + (e.css?.tableWrapper || "")
|
|
816
|
-
})), m = qe(), q =
|
|
817
|
-
a.value?.changePage(
|
|
818
|
-
}, E = (
|
|
819
|
-
f.value =
|
|
820
|
-
},
|
|
821
|
-
A.value =
|
|
817
|
+
})), m = qe(), q = D(!0), A = D(null), C = D("<p>Showing {from} to {to} of {total}</p>"), f = D(null), a = ye("dsgTable"), u = D({ perPage: 20, change: r }), $ = D(20), T = D({ ...h(), ...e.initialFilters }), S = v, U = (n) => {
|
|
818
|
+
a.value?.changePage(n);
|
|
819
|
+
}, E = (n) => {
|
|
820
|
+
f.value = n;
|
|
821
|
+
}, _ = ({ data: n }) => {
|
|
822
|
+
A.value = n, S("dsg-table:data-loaded", n);
|
|
822
823
|
}, W = () => {
|
|
823
824
|
a.value?.reload();
|
|
824
|
-
}, Q = (
|
|
825
|
-
a.value?.setLoading(
|
|
826
|
-
}, H = (
|
|
827
|
-
const
|
|
828
|
-
a.value?.setData(
|
|
829
|
-
}, se = (
|
|
830
|
-
const
|
|
831
|
-
a.value?.setData([...
|
|
832
|
-
}, ne = (
|
|
833
|
-
const
|
|
834
|
-
a.value?.setData(
|
|
835
|
-
}, oe = (
|
|
836
|
-
|
|
837
|
-
},
|
|
838
|
-
const
|
|
839
|
-
|
|
825
|
+
}, Q = (n) => {
|
|
826
|
+
a.value?.setLoading(n);
|
|
827
|
+
}, H = (n) => {
|
|
828
|
+
const o = a.value?.getData?.() ?? [];
|
|
829
|
+
a.value?.setData(o.map((c) => c.id === n.id ? n : c));
|
|
830
|
+
}, se = (n) => {
|
|
831
|
+
const o = a.value?.getData?.() ?? [];
|
|
832
|
+
a.value?.setData([...o, n]);
|
|
833
|
+
}, ne = (n) => {
|
|
834
|
+
const o = a.value?.getData?.() ?? [];
|
|
835
|
+
a.value?.setData(o.filter((c) => c.id !== n.id));
|
|
836
|
+
}, oe = (n) => {
|
|
837
|
+
a.value?.setData(n);
|
|
838
|
+
}, ie = () => a.value?.getData() ?? [], de = (n) => {
|
|
839
|
+
const o = a.value?.getData() ?? [], c = n(o);
|
|
840
|
+
c && a.value?.setData(c);
|
|
841
|
+
}, re = (n) => {
|
|
842
|
+
T.value = n;
|
|
843
|
+
}, Y = (n) => {
|
|
844
|
+
const o = { ...T.value };
|
|
845
|
+
!n || n.trim() === "" ? delete o["filter[term]"] : o["filter[term]"] = n, T.value = o, he(() => {
|
|
840
846
|
W();
|
|
841
|
-
}), S("dsg-table:term-changed",
|
|
842
|
-
},
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
847
|
+
}), S("dsg-table:term-changed", n);
|
|
848
|
+
}, ue = (n, o, c) => {
|
|
849
|
+
let y = {};
|
|
850
|
+
T.value["filter[term]"] && (y["filter[term]"] = T.value["filter[term]"]), Object.keys(n).forEach((k) => {
|
|
851
|
+
n[k] !== null && n[k] !== void 0 && n[k] !== "" && (y[k] = n[k]);
|
|
852
|
+
}), T.value = y, he(() => {
|
|
846
853
|
W();
|
|
847
|
-
}), S("dsg-table:filter-updated",
|
|
854
|
+
}), S("dsg-table:filter-updated", T.value, o, c);
|
|
848
855
|
};
|
|
849
856
|
return L({
|
|
850
857
|
reloadTable: W,
|
|
851
858
|
updateRowTable: H,
|
|
852
859
|
addRowTable: se,
|
|
853
860
|
deleteRowTable: ne,
|
|
854
|
-
|
|
855
|
-
|
|
861
|
+
setData: oe,
|
|
862
|
+
getData: ie,
|
|
863
|
+
mutateData: de,
|
|
864
|
+
termChanged: Y,
|
|
865
|
+
setFilters: re,
|
|
856
866
|
setLoading: Q
|
|
857
|
-
}), (
|
|
858
|
-
e.hasHeader ? (l(),
|
|
859
|
-
F(
|
|
860
|
-
|
|
861
|
-
F(
|
|
867
|
+
}), (n, o) => (l(), i("div", Ut, [
|
|
868
|
+
e.hasHeader ? (l(), i("div", qt, [
|
|
869
|
+
F(n.$slots, "dsg-table--pre-header", {}, () => [
|
|
870
|
+
P("div", Vt, [
|
|
871
|
+
F(n.$slots, "dsg-table--page-title", {
|
|
862
872
|
data: A.value,
|
|
863
873
|
title: e.title
|
|
864
874
|
}, () => [
|
|
865
|
-
e.title.length > 0 ? (l(),
|
|
875
|
+
e.title.length > 0 ? (l(), i("h1", {
|
|
866
876
|
key: 0,
|
|
867
877
|
class: "dsg-table--title",
|
|
868
|
-
textContent:
|
|
878
|
+
textContent: ae(e.title)
|
|
869
879
|
}, null, 8, zt)) : p("", !0)
|
|
870
880
|
])
|
|
871
881
|
]),
|
|
872
|
-
|
|
873
|
-
F(
|
|
882
|
+
P("div", Ot, [
|
|
883
|
+
F(n.$slots, "dsg-table--page-actions", { data: A.value })
|
|
874
884
|
])
|
|
875
885
|
])
|
|
876
886
|
])) : p("", !0),
|
|
877
|
-
e.displayPaginationInfo ? (l(),
|
|
878
|
-
|
|
879
|
-
F(
|
|
880
|
-
R(
|
|
887
|
+
e.displayPaginationInfo ? (l(), i("div", Nt, [
|
|
888
|
+
P("div", Wt, [
|
|
889
|
+
F(n.$slots, "dsg-table--search-header", { data: A.value }, () => [
|
|
890
|
+
R($e, {
|
|
881
891
|
name: "term",
|
|
882
|
-
"onDsgTable:termChanged":
|
|
892
|
+
"onDsgTable:termChanged": o[0] || (o[0] = (c) => Y(c))
|
|
883
893
|
}),
|
|
884
|
-
R(
|
|
894
|
+
R(Pe, {
|
|
885
895
|
entity: e.filterEntity,
|
|
886
896
|
"filter-endpoint": e.filterEndpoint,
|
|
887
897
|
"search-endpoint": e.filterSearchEndpoint,
|
|
898
|
+
"auto-sort": e.autoSortFilters,
|
|
888
899
|
filters: e.filters,
|
|
889
|
-
"onDsgTable:filterUpdated":
|
|
890
|
-
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
|
|
891
|
-
F(
|
|
900
|
+
"onDsgTable:filterUpdated": o[1] || (o[1] = (c, y, k) => ue(c, y, k))
|
|
901
|
+
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "auto-sort", "filters"]),
|
|
902
|
+
F(n.$slots, "dsg-table--search-actions", { data: A.value })
|
|
892
903
|
])
|
|
893
904
|
]),
|
|
894
|
-
F(
|
|
905
|
+
F(n.$slots, "dsg-table--search-navigation")
|
|
895
906
|
], 512)) : p("", !0),
|
|
896
907
|
R(Ht, {
|
|
897
908
|
ref: "dsgTable",
|
|
898
909
|
"api-url": e.getUrl,
|
|
899
|
-
"filter-params":
|
|
900
|
-
"onUpdate:filterParams":
|
|
901
|
-
"per-page":
|
|
902
|
-
"onUpdate:perPage":
|
|
910
|
+
"filter-params": T.value,
|
|
911
|
+
"onUpdate:filterParams": o[7] || (o[7] = (c) => T.value = c),
|
|
912
|
+
"per-page": $.value,
|
|
913
|
+
"onUpdate:perPage": o[8] || (o[8] = (c) => $.value = c),
|
|
903
914
|
fields: e.fields,
|
|
904
915
|
"load-on-start": e.loadOnStart,
|
|
905
916
|
"pagination-path": "meta",
|
|
906
917
|
selectable: e.selectable,
|
|
907
918
|
"track-by": e.trackBy,
|
|
908
919
|
"table-layout": e.tableLayout,
|
|
909
|
-
css:
|
|
920
|
+
css: g.value,
|
|
910
921
|
data: e.data,
|
|
911
922
|
"row-class": e.rowClass,
|
|
912
923
|
"api-mode": b.value,
|
|
913
|
-
"onDsgTable:loading":
|
|
914
|
-
"onDsgTable:loaded":
|
|
924
|
+
"onDsgTable:loading": o[9] || (o[9] = (c) => q.value = !0),
|
|
925
|
+
"onDsgTable:loaded": o[10] || (o[10] = (c) => q.value = !1),
|
|
915
926
|
"onDsgTable:paginationData": E,
|
|
916
|
-
"onDsgTable:loadSuccess":
|
|
917
|
-
"onDsgTable:rowsSelected":
|
|
918
|
-
"onDsgTable:rowClicked":
|
|
919
|
-
"onDsgTable:rowHover":
|
|
920
|
-
"onDsgTable:rowDblclick":
|
|
927
|
+
"onDsgTable:loadSuccess": _,
|
|
928
|
+
"onDsgTable:rowsSelected": o[11] || (o[11] = (c) => S("dsg-table:rows-selected", c)),
|
|
929
|
+
"onDsgTable:rowClicked": o[12] || (o[12] = (c, y, k) => S("dsg-table:row-clicked", c, y, k)),
|
|
930
|
+
"onDsgTable:rowHover": o[13] || (o[13] = (c, y, k) => S("dsg-table:row-hover", c, y, k)),
|
|
931
|
+
"onDsgTable:rowDblclick": o[14] || (o[14] = (c, y, k) => S("dsg-table:row-dblclick", c, y, k))
|
|
921
932
|
}, Ve({
|
|
922
|
-
"dsg-field--actions":
|
|
923
|
-
F(
|
|
933
|
+
"dsg-field--actions": te((c) => [
|
|
934
|
+
F(n.$slots, "dsg-table-actions", { data: c }, () => [
|
|
924
935
|
(l(), j(Ce, {
|
|
925
|
-
key:
|
|
926
|
-
data:
|
|
927
|
-
"onDsgTable:actionEdit":
|
|
928
|
-
"onDsgTable:actionView":
|
|
929
|
-
"onDsgTable:actionDelete":
|
|
930
|
-
"onDsgTable:actionArchive":
|
|
931
|
-
"onDsgTable:linkClicked":
|
|
936
|
+
key: c.rowIndex,
|
|
937
|
+
data: c,
|
|
938
|
+
"onDsgTable:actionEdit": o[2] || (o[2] = (y, k) => S("dsg-table:action-edit", y, k)),
|
|
939
|
+
"onDsgTable:actionView": o[3] || (o[3] = (y, k) => S("dsg-table:action-view", y, k)),
|
|
940
|
+
"onDsgTable:actionDelete": o[4] || (o[4] = (y, k) => S("dsg-table:action-delete", y, k)),
|
|
941
|
+
"onDsgTable:actionArchive": o[5] || (o[5] = (y, k) => S("dsg-table:action-archive", y, k)),
|
|
942
|
+
"onDsgTable:linkClicked": o[6] || (o[6] = (y, k, le) => S("dsg-table:link-clicked", y, k, le))
|
|
932
943
|
}, null, 8, ["data"]))
|
|
933
944
|
])
|
|
934
945
|
]),
|
|
935
946
|
_: 2
|
|
936
947
|
}, [
|
|
937
|
-
N(O(m), (
|
|
938
|
-
name:
|
|
939
|
-
fn:
|
|
940
|
-
String(
|
|
948
|
+
N(O(m), (c, y) => ({
|
|
949
|
+
name: y,
|
|
950
|
+
fn: te((k) => [
|
|
951
|
+
String(y) !== "dsg-field--actions" ? F(n.$slots, y, ze(Oe({ key: 0 }, k))) : p("", !0)
|
|
941
952
|
])
|
|
942
953
|
}))
|
|
943
954
|
]), 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(),
|
|
945
|
-
|
|
946
|
-
F(
|
|
955
|
+
e.hasFooter ? (l(), i("div", jt, [
|
|
956
|
+
P("div", Kt, [
|
|
957
|
+
F(n.$slots, "dsg-table--footer-left", {
|
|
947
958
|
data: f.value,
|
|
948
959
|
perPage: u.value
|
|
949
960
|
}, () => [
|
|
950
961
|
R(pe, {
|
|
951
962
|
ref: "paginationInfoStart",
|
|
952
963
|
pagination: f.value,
|
|
953
|
-
"onUpdate:pagination":
|
|
964
|
+
"onUpdate:pagination": o[15] || (o[15] = (c) => f.value = c),
|
|
954
965
|
"info-template": C.value
|
|
955
966
|
}, null, 8, ["pagination", "info-template"]),
|
|
956
|
-
F(
|
|
967
|
+
F(n.$slots, "dsg-table--footer-left-extras", {
|
|
957
968
|
data: f.value,
|
|
958
969
|
perPage: u.value
|
|
959
970
|
})
|
|
960
971
|
])
|
|
961
972
|
]),
|
|
962
|
-
|
|
963
|
-
F(
|
|
973
|
+
P("div", Qt, [
|
|
974
|
+
F(n.$slots, "dsg-table--footer-center", {
|
|
964
975
|
data: f.value,
|
|
965
976
|
perPage: u.value
|
|
966
977
|
}, () => [
|
|
967
|
-
F(
|
|
978
|
+
F(n.$slots, "dsg-table--footer-center-extras", {
|
|
968
979
|
data: f.value,
|
|
969
980
|
perPage: u.value
|
|
970
981
|
})
|
|
971
982
|
])
|
|
972
983
|
]),
|
|
973
|
-
|
|
974
|
-
F(
|
|
984
|
+
P("div", Yt, [
|
|
985
|
+
F(n.$slots, "dsg-table--footer-right", {
|
|
975
986
|
data: f.value,
|
|
976
987
|
perPage: u.value
|
|
977
988
|
}, () => [
|
|
978
|
-
q.value === !1 ? (l(), j(
|
|
989
|
+
q.value === !1 ? (l(), j(De, {
|
|
979
990
|
key: 0,
|
|
980
991
|
ref: "pagination",
|
|
981
992
|
pagination: f.value,
|
|
982
|
-
"onUpdate:pagination":
|
|
993
|
+
"onUpdate:pagination": o[16] || (o[16] = (c) => f.value = c),
|
|
983
994
|
"onDsgTable:changePage": U
|
|
984
995
|
}, null, 8, ["pagination"])) : p("", !0),
|
|
985
|
-
F(
|
|
996
|
+
F(n.$slots, "dsg-table--footer-right-extras", {
|
|
986
997
|
data: f.value,
|
|
987
998
|
perPage: u.value
|
|
988
999
|
})
|
|
@@ -998,23 +1009,23 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
998
1009
|
perPage: {}
|
|
999
1010
|
},
|
|
1000
1011
|
setup(e) {
|
|
1001
|
-
return (L,
|
|
1002
|
-
|
|
1003
|
-
"onUpdate:modelValue":
|
|
1012
|
+
return (L, v) => (l(), i("div", Jt, [
|
|
1013
|
+
ge(P("select", {
|
|
1014
|
+
"onUpdate:modelValue": v[0] || (v[0] = (r) => e.perPage.perPage = r),
|
|
1004
1015
|
class: "dsg-table--per-page-select",
|
|
1005
|
-
onChange:
|
|
1016
|
+
onChange: v[1] || (v[1] = (r) => e.perPage.change(e.perPage.perPage))
|
|
1006
1017
|
}, [
|
|
1007
|
-
(l(!0),
|
|
1018
|
+
(l(!0), i(I, null, N(e.perPageOptions, (r) => (l(), i("option", {
|
|
1008
1019
|
key: r,
|
|
1009
1020
|
value: r,
|
|
1010
|
-
textContent:
|
|
1021
|
+
textContent: ae(r)
|
|
1011
1022
|
}, null, 8, Xt))), 128))
|
|
1012
1023
|
], 544), [
|
|
1013
1024
|
[Ne, e.perPage.perPage]
|
|
1014
1025
|
])
|
|
1015
1026
|
]));
|
|
1016
1027
|
}
|
|
1017
|
-
}), _t = Gt, ea = Ce, ta = Zt, aa =
|
|
1028
|
+
}), _t = Gt, ea = Ce, ta = Zt, aa = Pe, la = De, sa = pe, na = $e, oa = Te, ga = {
|
|
1018
1029
|
DsgTable: _t,
|
|
1019
1030
|
DsgTableActions: ea,
|
|
1020
1031
|
DsgTablePerPage: ta,
|