@dcodegroup-au/dsg-vue 0.0.32 → 0.0.34
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-BZcdFc4A.js → DsgTablePerPage.vue_vue_type_style_index_0_lang-B8_U5eht.js} +1776 -1755
- package/dist/{DsgTablePerPage.vue_vue_type_style_index_0_lang-CW51CLZ4.cjs → DsgTablePerPage.vue_vue_type_style_index_0_lang-DsjXXvFV.cjs} +146 -146
- package/dist/components/Elements/DsgInput.vue.d.ts +1 -0
- package/dist/components/Elements/DsgInputSelect.vue.d.ts +2 -1
- package/dist/components/Elements/DsgProgress.vue.d.ts +1 -0
- package/dist/components/Table/DsgTable.vue.d.ts +13 -18
- package/dist/dsg-vue.cjs +10 -10
- package/dist/dsg-vue.css +1 -1
- package/dist/dsg-vue.esm.js +1963 -1944
- package/dist/dsg-vue.table.cjs +2 -2
- package/dist/dsg-vue.table.esm.js +403 -398
- package/dist/main.d.ts +4 -2
- package/dist/table.d.ts +28 -86
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as W, mergeModels as G, useModel as Y, computed as
|
|
2
|
-
import { _ as
|
|
1
|
+
import { defineComponent as W, mergeModels as G, useModel as Y, computed as V, withDirectives as oe, createElementBlock as s, openBlock as a, createCommentVNode as w, createElementVNode as y, normalizeClass as M, createVNode as L, Fragment as R, renderList as q, vShow as Se, ref as k, useTemplateRef as ge, useAttrs as Fe, unref as U, withCtx as Z, renderSlot as T, toDisplayString as x, createBlock as N, resolveDynamicComponent as Be, normalizeStyle as J, watch as ee, onMounted as Me, Transition as Le, createTextVNode as Ee, useSlots as Re, createSlots as He, normalizeProps as Ie, mergeProps as ze, vModelSelect as Ae } from "vue";
|
|
2
|
+
import { _ as O, k as Ve, v as Oe, g as Ue, u as qe, c as ve, e as ce, i as be, j as Ne } from "./DsgTablePerPage.vue_vue_type_style_index_0_lang-B8_U5eht.js";
|
|
3
3
|
import { ucfirst as We, ucwords as je, toSnakeCase as Ke } from "./dsg-vue.helpers-string.esm.js";
|
|
4
4
|
import { data_get as ne } from "./dsg-vue.helpers-object.esm.js";
|
|
5
5
|
const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disabled"], Je = ["onClick", "innerHTML"], Xe = ["onClick", "innerHTML"], Ze = ["disabled"], xe = ["disabled"], fe = /* @__PURE__ */ W({
|
|
@@ -17,76 +17,76 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
17
17
|
paginationModifiers: {}
|
|
18
18
|
}),
|
|
19
19
|
emits: /* @__PURE__ */ G(["dsg-table:change-page"], ["update:pagination"]),
|
|
20
|
-
setup(t, { expose: $, emit:
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
},
|
|
20
|
+
setup(t, { expose: $, emit: g }) {
|
|
21
|
+
const r = Y(t, "pagination"), f = V(() => r.value === null ? 0 : r.value?.last_page - t.firstPage + 1), v = V(() => r.value === null ? 0 : r.value?.last_page), h = V(() => r.value === null ? !1 : r.value?.current_page === t.firstPage), m = V(() => r.value === null ? !1 : r.value?.current_page === v.value), z = V(() => f.value < t.onEachSide * 2 + 4), H = V(() => t.onEachSide * 2 + 1), p = V(() => !r.value || r.value?.current_page <= t.onEachSide ? 1 : r.value?.current_page >= f.value - t.onEachSide ? f.value - t.onEachSide * 2 : r.value?.current_page - t.onEachSide), b = g, n = (c) => {
|
|
22
|
+
b("dsg-table:change-page", c);
|
|
23
|
+
}, i = (c) => c === r.value?.current_page;
|
|
24
24
|
return $({
|
|
25
|
-
loadPage:
|
|
26
|
-
}), (
|
|
27
|
-
|
|
25
|
+
loadPage: n
|
|
26
|
+
}), (c, D) => oe((a(), s("div", Qe, [
|
|
27
|
+
c.showFirstLast ? (a(), s("a", {
|
|
28
28
|
key: 0,
|
|
29
|
-
onClick:
|
|
30
|
-
class:
|
|
29
|
+
onClick: D[0] || (D[0] = (S) => n(c.firstPage)),
|
|
30
|
+
class: M([[h.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
31
31
|
disabled: h.value,
|
|
32
32
|
title: "First",
|
|
33
33
|
"aria-label": "First"
|
|
34
34
|
}, [
|
|
35
|
-
|
|
36
|
-
icon:
|
|
35
|
+
L(O, {
|
|
36
|
+
icon: c.firstIcon,
|
|
37
37
|
size: "sm"
|
|
38
38
|
}, null, 8, ["icon"])
|
|
39
|
-
], 10, Ye)) :
|
|
40
|
-
|
|
41
|
-
onClick:
|
|
42
|
-
class:
|
|
39
|
+
], 10, Ye)) : w("", !0),
|
|
40
|
+
y("a", {
|
|
41
|
+
onClick: D[1] || (D[1] = (S) => n("prev")),
|
|
42
|
+
class: M([[h.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
43
43
|
disabled: h.value,
|
|
44
44
|
title: "Previous",
|
|
45
45
|
"aria-label": "Previous"
|
|
46
46
|
}, [
|
|
47
|
-
|
|
48
|
-
icon:
|
|
47
|
+
L(O, {
|
|
48
|
+
icon: c.prevIcon,
|
|
49
49
|
size: "sm"
|
|
50
50
|
}, null, 8, ["icon"])
|
|
51
51
|
], 10, Ge),
|
|
52
|
-
|
|
53
|
-
key:
|
|
54
|
-
onClick: (j) =>
|
|
55
|
-
class:
|
|
56
|
-
innerHTML:
|
|
57
|
-
}, null, 10, Je))), 128)) : (a(!0),
|
|
58
|
-
key:
|
|
59
|
-
onClick: (j) =>
|
|
60
|
-
class:
|
|
61
|
-
innerHTML:
|
|
52
|
+
z.value ? (a(!0), s(R, { key: 1 }, q(f.value, (S, C) => (a(), s("a", {
|
|
53
|
+
key: C,
|
|
54
|
+
onClick: (j) => n(C + c.firstPage),
|
|
55
|
+
class: M([[i(C + c.firstPage) ? "active" : ""], "dsg-table--pagination-link"]),
|
|
56
|
+
innerHTML: S
|
|
57
|
+
}, null, 10, Je))), 128)) : (a(!0), s(R, { key: 2 }, q(H.value, (S, C) => (a(), s("a", {
|
|
58
|
+
key: C,
|
|
59
|
+
onClick: (j) => n(p.value + C + c.firstPage - 1),
|
|
60
|
+
class: M([[i(p.value + C + c.firstPage - 1) ? "active" : ""], "dsg-table--pagination-link"]),
|
|
61
|
+
innerHTML: p.value + S - 1
|
|
62
62
|
}, null, 10, Xe))), 128)),
|
|
63
|
-
|
|
64
|
-
onClick:
|
|
65
|
-
class:
|
|
66
|
-
disabled:
|
|
63
|
+
y("a", {
|
|
64
|
+
onClick: D[2] || (D[2] = (S) => n("next")),
|
|
65
|
+
class: M([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
66
|
+
disabled: m.value,
|
|
67
67
|
title: "Next",
|
|
68
68
|
"aria-label": "Next"
|
|
69
69
|
}, [
|
|
70
|
-
|
|
71
|
-
icon:
|
|
70
|
+
L(O, {
|
|
71
|
+
icon: c.nextIcon,
|
|
72
72
|
size: "sm"
|
|
73
73
|
}, null, 8, ["icon"])
|
|
74
74
|
], 10, Ze),
|
|
75
|
-
|
|
75
|
+
c.showFirstLast ? (a(), s("a", {
|
|
76
76
|
key: 3,
|
|
77
|
-
onClick:
|
|
78
|
-
class:
|
|
79
|
-
disabled:
|
|
77
|
+
onClick: D[3] || (D[3] = (S) => n(v.value)),
|
|
78
|
+
class: M([[m.value ? "disabled" : ""], "dsg-table--pagination-link"]),
|
|
79
|
+
disabled: m.value,
|
|
80
80
|
title: "Last",
|
|
81
81
|
"aria-label": "Last"
|
|
82
82
|
}, [
|
|
83
|
-
|
|
84
|
-
icon:
|
|
83
|
+
L(O, {
|
|
84
|
+
icon: c.lastIcon,
|
|
85
85
|
size: "sm"
|
|
86
86
|
}, null, 8, ["icon"])
|
|
87
|
-
], 10, xe)) :
|
|
87
|
+
], 10, xe)) : w("", !0)
|
|
88
88
|
], 512)), [
|
|
89
|
-
[Se,
|
|
89
|
+
[Se, r.value && v.value > c.firstPage]
|
|
90
90
|
]);
|
|
91
91
|
}
|
|
92
92
|
}), _e = ["innerHTML"], pe = /* @__PURE__ */ W({
|
|
@@ -100,10 +100,10 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
100
100
|
}),
|
|
101
101
|
emits: ["update:pagination"],
|
|
102
102
|
setup(t) {
|
|
103
|
-
const $ = Y(t, "pagination"),
|
|
104
|
-
return (
|
|
103
|
+
const $ = Y(t, "pagination"), g = V(() => $.value == null || $.value.total == 0 ? t.noDataTemplate : t.infoTemplate.replace("{from}", ($.value?.from || 0).toString()).replace("{to}", ($.value?.to || 0).toString()).replace("{total}", ($.value?.total || 0).toString()));
|
|
104
|
+
return (r, f) => (a(), s("div", {
|
|
105
105
|
class: "dsg-table--pagination-info",
|
|
106
|
-
innerHTML:
|
|
106
|
+
innerHTML: g.value
|
|
107
107
|
}, null, 8, _e));
|
|
108
108
|
}
|
|
109
109
|
}), et = {
|
|
@@ -119,10 +119,10 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["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(t, { emit: $ }) {
|
|
122
|
-
const
|
|
122
|
+
const g = k(!1);
|
|
123
123
|
ge("dsgTableActions");
|
|
124
|
-
const
|
|
125
|
-
switch (
|
|
124
|
+
const r = Fe(), f = k(r.data.rowData?.actions ?? null), v = k(r.data.rowData?.links ?? null), h = k(r.data.rowData ?? null), m = (b) => {
|
|
125
|
+
switch (b) {
|
|
126
126
|
case "edit":
|
|
127
127
|
return "edit-05";
|
|
128
128
|
case "view":
|
|
@@ -134,95 +134,95 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
134
134
|
default:
|
|
135
135
|
return "dots-horizontal";
|
|
136
136
|
}
|
|
137
|
-
},
|
|
138
|
-
switch (
|
|
137
|
+
}, z = (b, n, i) => {
|
|
138
|
+
switch (n) {
|
|
139
139
|
case "edit":
|
|
140
|
-
|
|
140
|
+
p("dsg-table:action-edit", i, h.value);
|
|
141
141
|
break;
|
|
142
142
|
case "view":
|
|
143
|
-
|
|
143
|
+
p("dsg-table:action-view", i, h.value);
|
|
144
144
|
break;
|
|
145
145
|
case "delete":
|
|
146
|
-
|
|
146
|
+
p("dsg-table:action-delete", i, h.value);
|
|
147
147
|
break;
|
|
148
148
|
case "archive":
|
|
149
|
-
|
|
149
|
+
p("dsg-table:action-archive", i, h.value);
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
|
-
},
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
return (
|
|
157
|
-
|
|
152
|
+
}, H = (b, n) => {
|
|
153
|
+
const i = b.actionId || b.label.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
|
|
154
|
+
p("dsg-table:link-clicked", n, i, h.value);
|
|
155
|
+
}, p = $;
|
|
156
|
+
return (b, n) => oe((a(), s("div", et, [
|
|
157
|
+
L(U(Ve), {
|
|
158
158
|
triggers: [],
|
|
159
|
-
placement:
|
|
159
|
+
placement: b.placement,
|
|
160
160
|
"handle-resize": !0,
|
|
161
161
|
strategy: "absolute",
|
|
162
|
-
shown:
|
|
162
|
+
shown: g.value,
|
|
163
163
|
class: "dsg-table--actions__popper",
|
|
164
|
-
onHide:
|
|
164
|
+
onHide: n[1] || (n[1] = (i) => g.value = !1),
|
|
165
165
|
ref: "floatingVueFilterDropdown"
|
|
166
166
|
}, {
|
|
167
|
-
popper:
|
|
168
|
-
|
|
169
|
-
(a(!0),
|
|
170
|
-
["edit", "view", "delete", "archive"].includes(String(
|
|
171
|
-
key:
|
|
167
|
+
popper: Z(() => [
|
|
168
|
+
g.value ? (a(), s("div", at, [
|
|
169
|
+
(a(!0), s(R, null, q(f.value, (i, c) => (a(), s(R, null, [
|
|
170
|
+
["edit", "view", "delete", "archive"].includes(String(c)) ? (a(), s("a", {
|
|
171
|
+
key: c,
|
|
172
172
|
href: f.value?.link,
|
|
173
173
|
target: f.value?.target || "_self",
|
|
174
|
-
onClick: (
|
|
174
|
+
onClick: (D) => z(i, String(c), D)
|
|
175
175
|
}, [
|
|
176
|
-
|
|
177
|
-
class:
|
|
176
|
+
y("div", {
|
|
177
|
+
class: M(["dsg-table--actions-menu-item", String(c)])
|
|
178
178
|
}, [
|
|
179
|
-
|
|
180
|
-
icon:
|
|
179
|
+
L(O, {
|
|
180
|
+
icon: m(String(c)),
|
|
181
181
|
size: "sm"
|
|
182
182
|
}, null, 8, ["icon"]),
|
|
183
|
-
|
|
183
|
+
y("span", {
|
|
184
184
|
class: "flex-1",
|
|
185
|
-
textContent:
|
|
185
|
+
textContent: x(U(We)(String(c)))
|
|
186
186
|
}, null, 8, st)
|
|
187
187
|
], 2)
|
|
188
|
-
], 8, lt)) :
|
|
188
|
+
], 8, lt)) : w("", !0)
|
|
189
189
|
], 64))), 256)),
|
|
190
|
-
f.value &&
|
|
191
|
-
|
|
192
|
-
key:
|
|
190
|
+
f.value && v.value ? (a(), s("hr", nt)) : w("", !0),
|
|
191
|
+
v.value ? (a(!0), s(R, { key: 1 }, q(v.value, (i) => (a(), s(R, {
|
|
192
|
+
key: i.label
|
|
193
193
|
}, [
|
|
194
|
-
|
|
194
|
+
i.hasOwnProperty("component") ? (a(), N(Be(i.component), {
|
|
195
195
|
key: 0,
|
|
196
|
-
quote: U(
|
|
197
|
-
"row-data": U(
|
|
198
|
-
}, null, 8, ["quote", "row-data"])) :
|
|
196
|
+
quote: U(r).data.data.rowData,
|
|
197
|
+
"row-data": U(r).data.data.rowData
|
|
198
|
+
}, null, 8, ["quote", "row-data"])) : i.hasOwnProperty("type") && i.type == "break" ? (a(), s("hr", ot)) : (a(), s("a", {
|
|
199
199
|
key: 2,
|
|
200
|
-
href:
|
|
201
|
-
target:
|
|
202
|
-
class:
|
|
203
|
-
onClick: (
|
|
200
|
+
href: i.link,
|
|
201
|
+
target: i.target || "_self",
|
|
202
|
+
class: M(["dsg-table--actions-menu-item", i.class]),
|
|
203
|
+
onClick: (c) => H(i, c)
|
|
204
204
|
}, [
|
|
205
|
-
|
|
205
|
+
i.icon ? (a(), N(O, {
|
|
206
206
|
key: 0,
|
|
207
|
-
icon:
|
|
207
|
+
icon: i.icon,
|
|
208
208
|
size: "sm"
|
|
209
|
-
}, null, 8, ["icon"])) :
|
|
210
|
-
|
|
209
|
+
}, null, 8, ["icon"])) : w("", !0),
|
|
210
|
+
y("span", rt, x(i.label), 1)
|
|
211
211
|
], 10, it))
|
|
212
|
-
], 64))), 128)) :
|
|
213
|
-
])) :
|
|
212
|
+
], 64))), 128)) : w("", !0)
|
|
213
|
+
])) : w("", !0)
|
|
214
214
|
]),
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
default: Z(() => [
|
|
216
|
+
y("div", tt, [
|
|
217
|
+
y("button", {
|
|
218
218
|
type: "button",
|
|
219
219
|
class: "dsg-table--actions-button",
|
|
220
220
|
"aria-expanded": "false",
|
|
221
221
|
"aria-haspopup": "true",
|
|
222
|
-
onClick:
|
|
222
|
+
onClick: n[0] || (n[0] = (i) => g.value = !g.value)
|
|
223
223
|
}, [
|
|
224
|
-
T(
|
|
225
|
-
|
|
224
|
+
T(b.$slots, "dsg-table-action-button-content", {}, () => [
|
|
225
|
+
L(O, {
|
|
226
226
|
icon: "dots-vertical",
|
|
227
227
|
size: "sm"
|
|
228
228
|
})
|
|
@@ -233,7 +233,7 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
233
233
|
_: 3
|
|
234
234
|
}, 8, ["placement", "shown"])
|
|
235
235
|
])), [
|
|
236
|
-
[U(Oe), () =>
|
|
236
|
+
[U(Oe), () => g.value = !1]
|
|
237
237
|
]);
|
|
238
238
|
}
|
|
239
239
|
}), dt = { class: "dsg-table--search" }, me = /* @__PURE__ */ W({
|
|
@@ -251,27 +251,27 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
251
251
|
},
|
|
252
252
|
emits: ["dsg-table:term-changed"],
|
|
253
253
|
setup(t, { emit: $ }) {
|
|
254
|
-
const
|
|
255
|
-
|
|
254
|
+
const g = k(""), r = $, f = qe((v) => {
|
|
255
|
+
g.value = v, r("dsg-table:term-changed", g.value);
|
|
256
256
|
}, 300);
|
|
257
|
-
return (
|
|
258
|
-
|
|
259
|
-
value:
|
|
260
|
-
"onUpdate:value": h[0] || (h[0] = (
|
|
261
|
-
name:
|
|
262
|
-
id:
|
|
263
|
-
placeholder:
|
|
264
|
-
disabled:
|
|
265
|
-
required:
|
|
266
|
-
readonly:
|
|
267
|
-
hidden:
|
|
257
|
+
return (v, h) => (a(), s("div", dt, [
|
|
258
|
+
L(Ue, {
|
|
259
|
+
value: g.value,
|
|
260
|
+
"onUpdate:value": h[0] || (h[0] = (m) => g.value = m),
|
|
261
|
+
name: v.name,
|
|
262
|
+
id: v.id || v.name,
|
|
263
|
+
placeholder: v.placeholder,
|
|
264
|
+
disabled: v.disabled,
|
|
265
|
+
required: v.required,
|
|
266
|
+
readonly: v.readonly,
|
|
267
|
+
hidden: v.hidden,
|
|
268
268
|
"has-clear-button": !0,
|
|
269
269
|
autocomplete: "off",
|
|
270
270
|
size: "sm",
|
|
271
271
|
icon: "search-sm",
|
|
272
272
|
"icon-clickable": !0,
|
|
273
|
-
onIconClicked: h[1] || (h[1] = (
|
|
274
|
-
onEnterPressed: h[2] || (h[2] = (
|
|
273
|
+
onIconClicked: h[1] || (h[1] = (m) => U(f)(m)),
|
|
274
|
+
onEnterPressed: h[2] || (h[2] = (m) => U(f)(m)),
|
|
275
275
|
onOnClear: h[3] || (h[3] = () => U(f)(""))
|
|
276
276
|
}, null, 8, ["value", "name", "id", "placeholder", "disabled", "required", "readonly", "hidden"])
|
|
277
277
|
]));
|
|
@@ -305,79 +305,79 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
305
305
|
}),
|
|
306
306
|
emits: /* @__PURE__ */ G(["dsg-table:sort-field", "dsg-table:on-select-all", "dsg-table:on-deselect-all"], ["update:sortField", "update:selectedRows", "update:hasSelected"]),
|
|
307
307
|
setup(t, { emit: $ }) {
|
|
308
|
-
const
|
|
309
|
-
f.value &&
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
{ sortable:
|
|
315
|
-
{ "sort-active":
|
|
316
|
-
],
|
|
317
|
-
|
|
318
|
-
name: String(
|
|
319
|
-
field: String(
|
|
320
|
-
direction:
|
|
321
|
-
},
|
|
308
|
+
const g = Y(t, "sortField"), r = Y(t, "selectedRows"), f = Y(t, "hasSelected"), v = k("17px"), h = (p) => {
|
|
309
|
+
f.value && r.value.length > 0 && r.value.length !== t.tableDataLength ? (f.value = !0, m("dsg-table:on-select-all")) : !f.value && r.value.length === 0 ? (f.value = !1, m("dsg-table:on-select-all")) : m("dsg-table:on-deselect-all");
|
|
310
|
+
}, m = $, z = (p, b) => [
|
|
311
|
+
p,
|
|
312
|
+
p + "-" + Ke(String(b?.name)),
|
|
313
|
+
b.titleClass || "",
|
|
314
|
+
{ sortable: b.sortable },
|
|
315
|
+
{ "sort-active": g.value?.name === b.name }
|
|
316
|
+
], H = (p) => {
|
|
317
|
+
p.sortable && (g.value = {
|
|
318
|
+
name: String(p?.name),
|
|
319
|
+
field: String(p?.sortField),
|
|
320
|
+
direction: g.value?.name === p.name && g.value?.direction === "asc" ? "desc" : "asc"
|
|
321
|
+
}, m("dsg-table:sort-field", p));
|
|
322
322
|
};
|
|
323
|
-
return (
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
return (p, b) => (a(), s("tr", ut, [
|
|
324
|
+
p.hasSelectAll ? (a(), s("th", ct, [
|
|
325
|
+
L(ve, {
|
|
326
326
|
modelValue: f.value,
|
|
327
327
|
"onUpdate:modelValue": [
|
|
328
|
-
|
|
328
|
+
b[0] || (b[0] = (n) => f.value = n),
|
|
329
329
|
h
|
|
330
330
|
],
|
|
331
|
-
indeterminate:
|
|
331
|
+
indeterminate: r.value.length > 0 && r.value.length !== p.tableDataLength
|
|
332
332
|
}, null, 8, ["modelValue", "indeterminate"])
|
|
333
|
-
])) :
|
|
334
|
-
|
|
335
|
-
(a(!0),
|
|
336
|
-
|
|
337
|
-
key:
|
|
338
|
-
class:
|
|
339
|
-
style:
|
|
340
|
-
title:
|
|
341
|
-
id: "_" +
|
|
342
|
-
onClick: (
|
|
333
|
+
])) : w("", !0),
|
|
334
|
+
p.showExpandDetail ? (a(), s("th", gt)) : w("", !0),
|
|
335
|
+
(a(!0), s(R, null, q(p.fields, (n, i) => (a(), s(R, null, [
|
|
336
|
+
n?.visible ? (a(), s("th", {
|
|
337
|
+
key: i,
|
|
338
|
+
class: M(z("dsg-table--th", n)),
|
|
339
|
+
style: J([{ width: n.width || void 0 }, n.style]),
|
|
340
|
+
title: n.title + (n.sortable ? " Sort" : ""),
|
|
341
|
+
id: "_" + n.name,
|
|
342
|
+
onClick: (c) => H(n),
|
|
343
343
|
scope: "col"
|
|
344
344
|
}, [
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
n.sortable ? (a(), s("div", bt, [
|
|
346
|
+
n.title ? (a(), s("span", {
|
|
347
347
|
key: 0,
|
|
348
348
|
class: "dsg-table--th-title",
|
|
349
|
-
innerHTML:
|
|
350
|
-
}, null, 8, ft)) :
|
|
351
|
-
|
|
349
|
+
innerHTML: n.title
|
|
350
|
+
}, null, 8, ft)) : w("", !0),
|
|
351
|
+
n.sortable && g.value?.name !== n.name ? (a(), N(O, {
|
|
352
352
|
key: 1,
|
|
353
353
|
icon: "chevron-selector-vertical",
|
|
354
354
|
class: "inline-flex",
|
|
355
355
|
size: "xs"
|
|
356
|
-
})) :
|
|
357
|
-
|
|
356
|
+
})) : w("", !0),
|
|
357
|
+
n.sortable && g.value?.name === n.name && g.value?.direction === "asc" ? (a(), N(O, {
|
|
358
358
|
key: 2,
|
|
359
359
|
icon: "chevron-down",
|
|
360
360
|
class: "inline-flex",
|
|
361
361
|
size: "xs"
|
|
362
|
-
})) :
|
|
363
|
-
|
|
362
|
+
})) : w("", !0),
|
|
363
|
+
n.sortable && g.value?.name === n.name && g.value?.direction === "desc" ? (a(), N(O, {
|
|
364
364
|
key: 3,
|
|
365
365
|
icon: "chevron-up",
|
|
366
366
|
class: "inline-flex",
|
|
367
367
|
size: "xs"
|
|
368
|
-
})) :
|
|
369
|
-
])) : (a(),
|
|
368
|
+
})) : w("", !0)
|
|
369
|
+
])) : (a(), s("span", {
|
|
370
370
|
key: 1,
|
|
371
371
|
class: "dsg-table--th-title",
|
|
372
|
-
innerHTML: U(je)(String(
|
|
372
|
+
innerHTML: U(je)(String(n?.title))
|
|
373
373
|
}, null, 8, pt))
|
|
374
|
-
], 14, vt)) :
|
|
374
|
+
], 14, vt)) : w("", !0)
|
|
375
375
|
], 64))), 256)),
|
|
376
|
-
|
|
376
|
+
p.scrollVisible ? (a(), s("th", {
|
|
377
377
|
key: 2,
|
|
378
|
-
style:
|
|
378
|
+
style: J({ width: v.value }),
|
|
379
379
|
class: "dsg-table--th-col-gutter"
|
|
380
|
-
}, null, 4)) :
|
|
380
|
+
}, null, 4)) : w("", !0)
|
|
381
381
|
]));
|
|
382
382
|
}
|
|
383
383
|
}), ht = { class: "dsg-table--wrapper" }, mt = ["span"], yt = {
|
|
@@ -445,8 +445,8 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
445
445
|
perPageModifiers: {}
|
|
446
446
|
}),
|
|
447
447
|
emits: /* @__PURE__ */ G(["dsg-table:loading", "dsg-table:loaded", "dsg-table:load-success", "dsg-table:load-error", "dsg-table:pagination-data", "dsg-table:rows-selected"], ["update:filterParams", "update:perPage"]),
|
|
448
|
-
setup(t, { expose: $, emit:
|
|
449
|
-
const
|
|
448
|
+
setup(t, { expose: $, emit: g }) {
|
|
449
|
+
const r = (e) => e.map((o, u) => ({
|
|
450
450
|
field: o.field || "",
|
|
451
451
|
title: o.title || "",
|
|
452
452
|
name: o.name || "",
|
|
@@ -457,238 +457,238 @@ const Qe = { class: "dsg-table--pagination" }, Ye = ["disabled"], Ge = ["disable
|
|
|
457
457
|
sortField: o.sortField || null,
|
|
458
458
|
sortable: o.sortField,
|
|
459
459
|
formatter: o.formatter || null,
|
|
460
|
-
$_index:
|
|
461
|
-
})), f =
|
|
462
|
-
|
|
463
|
-
() =>
|
|
460
|
+
$_index: u
|
|
461
|
+
})), f = k(r(t.fields)), v = k(t.data), h = k(null), m = k(t.initialPage), z = k("17px"), H = k(!1), p = k({}), b = k(0), n = k(!0), i = k(null), c = k(null), D = Y(t, "filterParams"), S = Y(t, "perPage"), C = k([]), j = k(!1), K = V(() => t.tableHeight != null), Q = V(() => f.value.filter((e) => e.visible).length);
|
|
462
|
+
ee(
|
|
463
|
+
() => C.value.length,
|
|
464
464
|
(e) => {
|
|
465
465
|
j.value = t.selectable && e > 0;
|
|
466
466
|
},
|
|
467
467
|
{ immediate: !0 }
|
|
468
|
-
),
|
|
468
|
+
), ee(
|
|
469
469
|
() => t.fields,
|
|
470
470
|
(e) => {
|
|
471
|
-
f.value =
|
|
471
|
+
f.value = r(e);
|
|
472
472
|
},
|
|
473
473
|
{ immediate: !0 }
|
|
474
|
-
),
|
|
475
|
-
() =>
|
|
474
|
+
), ee(
|
|
475
|
+
() => D.value,
|
|
476
476
|
() => {
|
|
477
|
-
|
|
477
|
+
X();
|
|
478
478
|
},
|
|
479
479
|
{ deep: !0 }
|
|
480
|
-
),
|
|
481
|
-
() =>
|
|
480
|
+
), ee(
|
|
481
|
+
() => S.value,
|
|
482
482
|
() => {
|
|
483
|
-
|
|
483
|
+
X();
|
|
484
484
|
}
|
|
485
485
|
);
|
|
486
|
-
const
|
|
486
|
+
const A = g, te = (e, o) => e.formatter && typeof e.formatter == "function" ? e.formatter(e, o) : ne(o, String(e?.name), ""), _ = (e) => "dsg-field--" + e.name?.toLowerCase().replaceAll(/[_ ]/g, "-"), ae = (e) => {
|
|
487
487
|
if (t.selectable) {
|
|
488
488
|
if (e.selected)
|
|
489
|
-
|
|
489
|
+
C.value.push(e);
|
|
490
490
|
else {
|
|
491
|
-
const o =
|
|
492
|
-
o !== -1 &&
|
|
491
|
+
const o = C.value.findIndex((u) => u[t.trackBy] === e[t.trackBy]);
|
|
492
|
+
o !== -1 && C.value.splice(o, 1);
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
A("dsg-table:rows-selected", C.value);
|
|
495
495
|
}
|
|
496
|
-
},
|
|
497
|
-
t.selectable && (
|
|
496
|
+
}, l = () => {
|
|
497
|
+
t.selectable && (v.value?.forEach((e) => {
|
|
498
498
|
e.selected = !0;
|
|
499
|
-
}),
|
|
500
|
-
},
|
|
501
|
-
t.selectable && (
|
|
499
|
+
}), C.value = v.value?.filter((e) => e.selected) ?? [], A("dsg-table:rows-selected", C.value));
|
|
500
|
+
}, d = () => {
|
|
501
|
+
t.selectable && (v.value?.forEach((e) => {
|
|
502
502
|
e.selected = !1;
|
|
503
|
-
}),
|
|
504
|
-
},
|
|
505
|
-
e === "prev" ?
|
|
506
|
-
},
|
|
507
|
-
[t.queryParams?.sort]:
|
|
508
|
-
[t.queryParams?.order]:
|
|
509
|
-
[t.queryParams?.page]:
|
|
510
|
-
[t.queryParams?.perPage]:
|
|
511
|
-
}),
|
|
512
|
-
|
|
503
|
+
}), C.value = [], A("dsg-table:rows-selected", C.value));
|
|
504
|
+
}, P = (e) => {
|
|
505
|
+
e === "prev" ? m.value > t.firstPage && m.value-- : e === "next" ? m.value < (h.value?.last_page ?? 0) && m.value++ : e != m.value && e >= t.firstPage && e <= (h.value?.last_page ?? 0) && (m.value = e), X();
|
|
506
|
+
}, F = () => ({
|
|
507
|
+
[t.queryParams?.sort]: i.value ? (i.value?.direction === "desc" ? "-" : "") + i.value?.field : void 0,
|
|
508
|
+
[t.queryParams?.order]: i.value?.direction,
|
|
509
|
+
[t.queryParams?.page]: m.value,
|
|
510
|
+
[t.queryParams?.perPage]: S.value
|
|
511
|
+
}), B = () => {
|
|
512
|
+
c.value && (c.value.abort(), c.value = null);
|
|
513
513
|
}, le = async (e, o) => {
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
if (o.signal =
|
|
514
|
+
B();
|
|
515
|
+
const u = new AbortController();
|
|
516
|
+
if (o.signal = u.signal, c.value = u, t.httpMethod.toLowerCase() === "get")
|
|
517
517
|
return await ce.get(e, o);
|
|
518
518
|
{
|
|
519
|
-
const
|
|
520
|
-
return delete o.params, await ce.post(e,
|
|
519
|
+
const I = o.params;
|
|
520
|
+
return delete o.params, await ce.post(e, I, o);
|
|
521
521
|
}
|
|
522
522
|
}, ie = (e) => {
|
|
523
|
-
|
|
523
|
+
A("dsg-table:load-success", e);
|
|
524
524
|
const o = t.transform ? t.transform(e.data) : e.data;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}), h.value = ne(o, t.paginationPath, null) ?? null,
|
|
525
|
+
v.value = ne(o, t.dataPath, null), t.selectable && v.value?.forEach((u) => {
|
|
526
|
+
u.selected = u.selected ?? !1;
|
|
527
|
+
}), h.value = ne(o, t.paginationPath, null) ?? null, b.value = v.value?.length ? v.value[0].order : b, h.value === null && console.warn(
|
|
528
528
|
'DsgTable: pagination-path "' + t.paginationPath + `" not found. It looks like the data returned from the server does not have pagination information or you may have set it incorrectly.
|
|
529
529
|
You can explicitly suppress this warning by setting pagination-path="".`
|
|
530
|
-
),
|
|
530
|
+
), A("dsg-table:pagination-data", h.value), m.value > (h.value?.to || 0) && (m.value = t.initialPage), A("dsg-table:loaded"), n.value = !1;
|
|
531
531
|
}, re = (e) => {
|
|
532
|
-
console.error("load-error", e),
|
|
533
|
-
},
|
|
534
|
-
const
|
|
532
|
+
console.error("load-error", e), A("dsg-table:load-error", e), A("dsg-table:loaded"), n.value = !1;
|
|
533
|
+
}, X = (e = ie, o = re, u = {}) => {
|
|
534
|
+
const I = e || ie, E = o || re;
|
|
535
535
|
if (t.apiMode)
|
|
536
|
-
return
|
|
537
|
-
...
|
|
538
|
-
...
|
|
539
|
-
}, le(t.apiUrl, t.httpOptions).then(
|
|
540
|
-
}, ke = (e, o,
|
|
541
|
-
}, we = (e, o,
|
|
542
|
-
}, Pe = (e, o,
|
|
543
|
-
}, $e = (e, o,
|
|
544
|
-
}, Ce = (e, o,
|
|
545
|
-
}, De = (e, o,
|
|
546
|
-
}, Te = (e, o,
|
|
536
|
+
return n.value = !0, A("dsg-table:loading", n.value), t.httpOptions.params = {
|
|
537
|
+
...F(),
|
|
538
|
+
...D.value
|
|
539
|
+
}, le(t.apiUrl, t.httpOptions).then(I).catch((se) => E(se));
|
|
540
|
+
}, ke = (e, o, u) => {
|
|
541
|
+
}, we = (e, o, u) => {
|
|
542
|
+
}, Pe = (e, o, u) => {
|
|
543
|
+
}, $e = (e, o, u, I) => {
|
|
544
|
+
}, Ce = (e, o, u, I) => {
|
|
545
|
+
}, De = (e, o, u, I) => {
|
|
546
|
+
}, Te = (e, o, u) => {
|
|
547
547
|
};
|
|
548
548
|
Me(() => {
|
|
549
|
-
t.apiMode === !0 &&
|
|
549
|
+
t.apiMode === !0 && X();
|
|
550
550
|
});
|
|
551
551
|
const de = () => {
|
|
552
|
-
t.apiMode && (
|
|
552
|
+
t.apiMode && (C.value = [], B(), X());
|
|
553
553
|
};
|
|
554
554
|
return $({
|
|
555
|
-
changePage:
|
|
555
|
+
changePage: P,
|
|
556
556
|
reload: de
|
|
557
|
-
}), (e, o) => (a(),
|
|
558
|
-
|
|
557
|
+
}), (e, o) => (a(), s("div", ht, [
|
|
558
|
+
y("div", {
|
|
559
559
|
ref: "dsgTableBodyWrapper",
|
|
560
|
-
class:
|
|
561
|
-
style:
|
|
560
|
+
class: M(["dsg-table-body-wrapper", { "fixed-header": K.value }]),
|
|
561
|
+
style: J({ height: e.tableHeight || void 0 })
|
|
562
562
|
}, [
|
|
563
|
-
|
|
564
|
-
class:
|
|
563
|
+
y("table", {
|
|
564
|
+
class: M(["dsg-table-main", K.value ? "fixed-header" : "", p.value.table, "table-" + e.tableLayout])
|
|
565
565
|
}, [
|
|
566
|
-
|
|
567
|
-
(a(!0),
|
|
568
|
-
|
|
569
|
-
key:
|
|
570
|
-
style:
|
|
571
|
-
class:
|
|
572
|
-
}, null, 6)) :
|
|
566
|
+
y("colgroup", { span: Q.value }, [
|
|
567
|
+
(a(!0), s(R, null, q(f.value, (u, I) => (a(), s(R, null, [
|
|
568
|
+
u?.visible ? (a(), s("col", {
|
|
569
|
+
key: I,
|
|
570
|
+
style: J({ width: u.width || void 0 }),
|
|
571
|
+
class: M("dsg-table--col-" + u.name + " " + u.titleClass)
|
|
572
|
+
}, null, 6)) : w("", !0)
|
|
573
573
|
], 64))), 256)),
|
|
574
|
-
!K.value &&
|
|
574
|
+
!K.value && H.value ? (a(), s("col", {
|
|
575
575
|
key: 0,
|
|
576
|
-
style:
|
|
576
|
+
style: J({ width: z.value }),
|
|
577
577
|
class: "dsg-table--col-gutter"
|
|
578
|
-
}, null, 4)) :
|
|
578
|
+
}, null, 4)) : w("", !0)
|
|
579
579
|
], 8, mt),
|
|
580
|
-
|
|
581
|
-
class:
|
|
580
|
+
y("thead", {
|
|
581
|
+
class: M([[p.value.thead, { sticky: K.value, "top-0": K.value }], "dsg-table--head"])
|
|
582
582
|
}, [
|
|
583
583
|
T(e.$slots, "tableHeader", { fields: f.value }, () => [
|
|
584
|
-
|
|
584
|
+
L(ye, {
|
|
585
585
|
fields: f.value,
|
|
586
586
|
"has-select-all": e.selectable,
|
|
587
|
-
"selected-rows":
|
|
588
|
-
"onUpdate:selectedRows": o[0] || (o[0] = (
|
|
587
|
+
"selected-rows": C.value,
|
|
588
|
+
"onUpdate:selectedRows": o[0] || (o[0] = (u) => C.value = u),
|
|
589
589
|
"has-selected": j.value,
|
|
590
|
-
"onUpdate:hasSelected": o[1] || (o[1] = (
|
|
591
|
-
"scroll-visible":
|
|
590
|
+
"onUpdate:hasSelected": o[1] || (o[1] = (u) => j.value = u),
|
|
591
|
+
"scroll-visible": H.value,
|
|
592
592
|
"show-expand-detail": e.hasDetailRow && e.showExpandDetail,
|
|
593
|
-
"table-data-length":
|
|
594
|
-
"sort-field":
|
|
595
|
-
"onUpdate:sortField": o[2] || (o[2] = (
|
|
596
|
-
"onDsgTable:sortField": o[3] || (o[3] = (
|
|
597
|
-
"onDsgTable:onSelectAll":
|
|
598
|
-
"onDsgTable:onDeselectAll":
|
|
593
|
+
"table-data-length": v.value?.length,
|
|
594
|
+
"sort-field": i.value,
|
|
595
|
+
"onUpdate:sortField": o[2] || (o[2] = (u) => i.value = u),
|
|
596
|
+
"onDsgTable:sortField": o[3] || (o[3] = (u) => de()),
|
|
597
|
+
"onDsgTable:onSelectAll": l,
|
|
598
|
+
"onDsgTable:onDeselectAll": d
|
|
599
599
|
}, null, 8, ["fields", "has-select-all", "selected-rows", "has-selected", "scroll-visible", "show-expand-detail", "table-data-length", "sort-field"])
|
|
600
600
|
])
|
|
601
601
|
], 2),
|
|
602
|
-
|
|
603
|
-
class:
|
|
602
|
+
y("tbody", {
|
|
603
|
+
class: M(["dsg-table--body", p.value.tbody])
|
|
604
604
|
}, [
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
605
|
+
n.value ? (a(), s("tr", yt, [
|
|
606
|
+
y("td", { colspan: Q.value }, [
|
|
607
|
+
y("div", {
|
|
608
608
|
"aria-label": "Loading...",
|
|
609
609
|
role: "status",
|
|
610
610
|
class: "flex items-center space-x-3 h-12 w-full justify-center",
|
|
611
611
|
colspan: Q.value
|
|
612
612
|
}, [
|
|
613
613
|
T(e.$slots, "dsg-table-loading", {}, () => [
|
|
614
|
-
|
|
614
|
+
L(O, {
|
|
615
615
|
icon: "loading-02",
|
|
616
616
|
class: "animate-spin"
|
|
617
617
|
}),
|
|
618
|
-
o[4] || (o[4] =
|
|
618
|
+
o[4] || (o[4] = y("span", { class: "text-xs font-medium text-gray-500" }, "Loading...", -1))
|
|
619
619
|
])
|
|
620
620
|
], 8, wt)
|
|
621
621
|
], 8, kt)
|
|
622
|
-
])) : (a(!0),
|
|
623
|
-
|
|
624
|
-
class:
|
|
625
|
-
onClick: (
|
|
626
|
-
onDblclick: (
|
|
627
|
-
onMouseover: (
|
|
622
|
+
])) : (a(!0), s(R, { key: 1 }, q(v.value, (u, I) => (a(), s(R, { key: I }, [
|
|
623
|
+
y("tr", {
|
|
624
|
+
class: M(["dsg-table--tbody-row", { odd: I % 2 === 0, even: I % 2 !== 0, "row-selected": u.selected }]),
|
|
625
|
+
onClick: (E) => ke(),
|
|
626
|
+
onDblclick: (E) => we(),
|
|
627
|
+
onMouseover: (E) => Pe()
|
|
628
628
|
}, [
|
|
629
|
-
e.selectable ? (a(),
|
|
630
|
-
|
|
631
|
-
modelValue:
|
|
632
|
-
"onUpdate:modelValue": [(
|
|
629
|
+
e.selectable ? (a(), s("td", $t, [
|
|
630
|
+
L(ve, {
|
|
631
|
+
modelValue: u.selected,
|
|
632
|
+
"onUpdate:modelValue": [(E) => u.selected = E, (E) => ae(u)]
|
|
633
633
|
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
634
|
-
])) :
|
|
635
|
-
(a(!0),
|
|
636
|
-
|
|
634
|
+
])) : w("", !0),
|
|
635
|
+
(a(!0), s(R, null, q(f.value, (E, se) => (a(), s(R, { key: se }, [
|
|
636
|
+
E.visible ? (a(), s("td", {
|
|
637
637
|
key: 0,
|
|
638
|
-
class:
|
|
639
|
-
style:
|
|
638
|
+
class: M(["dsg-table--tbody-cell", E.dataClass]),
|
|
639
|
+
style: J({ width: E.width || void 0 }),
|
|
640
640
|
onClick: (ue) => $e(),
|
|
641
641
|
onDblclick: (ue) => Ce(),
|
|
642
642
|
onContextmenu: (ue) => De()
|
|
643
643
|
}, [
|
|
644
|
-
T(e.$slots,
|
|
645
|
-
rowData:
|
|
646
|
-
rowIndex:
|
|
647
|
-
rowField:
|
|
644
|
+
T(e.$slots, _(E), {
|
|
645
|
+
rowData: u,
|
|
646
|
+
rowIndex: I,
|
|
647
|
+
rowField: E
|
|
648
648
|
}, () => [
|
|
649
|
-
|
|
650
|
-
innerHTML:
|
|
649
|
+
y("span", {
|
|
650
|
+
innerHTML: te(E, u)
|
|
651
651
|
}, null, 8, Dt)
|
|
652
652
|
])
|
|
653
|
-
], 46, Ct)) :
|
|
653
|
+
], 46, Ct)) : w("", !0)
|
|
654
654
|
], 64))), 128))
|
|
655
655
|
], 42, Pt),
|
|
656
656
|
e.hasDetailRow ? (a(), N(Le, {
|
|
657
657
|
key: 0,
|
|
658
658
|
name: e.detailRowTransition
|
|
659
659
|
}, {
|
|
660
|
-
default:
|
|
661
|
-
|
|
660
|
+
default: Z(() => [
|
|
661
|
+
y("tr", {
|
|
662
662
|
class: "dsg-table--tbody-detail-row",
|
|
663
|
-
onClick: (
|
|
663
|
+
onClick: (E) => Te()
|
|
664
664
|
}, [
|
|
665
|
-
|
|
665
|
+
y("td", { colspan: Q.value }, [
|
|
666
666
|
T(e.$slots, "dsg-table-detail-row", {
|
|
667
|
-
rowData:
|
|
668
|
-
rowIndex:
|
|
667
|
+
rowData: u,
|
|
668
|
+
rowIndex: I,
|
|
669
669
|
options: e.detailRowOptions
|
|
670
670
|
})
|
|
671
671
|
], 8, St)
|
|
672
672
|
], 8, Tt)
|
|
673
673
|
]),
|
|
674
674
|
_: 2
|
|
675
|
-
}, 1032, ["name"])) :
|
|
675
|
+
}, 1032, ["name"])) : w("", !0)
|
|
676
676
|
], 64))), 128)),
|
|
677
|
-
!
|
|
678
|
-
|
|
677
|
+
!v.value?.length && e.noDataTemplate.length ? (a(), s("tr", Ft, [
|
|
678
|
+
y("td", {
|
|
679
679
|
colspan: Q.value,
|
|
680
680
|
class: "dsg-table--empty-result"
|
|
681
681
|
}, [
|
|
682
682
|
T(e.$slots, "dsg-table-empty-result", {}, () => [
|
|
683
|
-
Ee(
|
|
683
|
+
Ee(x(e.noDataTemplate), 1)
|
|
684
684
|
])
|
|
685
685
|
], 8, Bt)
|
|
686
|
-
])) :
|
|
686
|
+
])) : w("", !0)
|
|
687
687
|
], 2),
|
|
688
|
-
|
|
688
|
+
y("tfoot", Mt, [
|
|
689
689
|
T(e.$slots, "dsg-table-footer", {
|
|
690
690
|
fields: f.value,
|
|
691
|
-
data:
|
|
691
|
+
data: v.value
|
|
692
692
|
})
|
|
693
693
|
])
|
|
694
694
|
], 2)
|
|
@@ -700,10 +700,12 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
700
700
|
class: "dsg-table--pre-header"
|
|
701
701
|
}, Ht = { class: "dsg-table--pre-header-left" }, It = ["textContent"], zt = { class: "dsg-table--pre-header-right" }, At = {
|
|
702
702
|
key: 1,
|
|
703
|
-
class: "dsg-table--search-header"
|
|
703
|
+
class: "dsg-table--search-header",
|
|
704
|
+
ref: "dsgTableSearchHeaderEl"
|
|
704
705
|
}, Vt = { class: "dsg-table--search-top" }, Ot = {
|
|
705
706
|
key: 2,
|
|
706
|
-
class: "dsg-table--footer"
|
|
707
|
+
class: "dsg-table--footer",
|
|
708
|
+
ref: "dsgTableFooterEl"
|
|
707
709
|
}, Ut = { class: "dsg-table--footer-left" }, qt = { class: "dsg-table--footer-center" }, Nt = { class: "dsg-table--footer-right" }, Wt = /* @__PURE__ */ W({
|
|
708
710
|
__name: "DsgTable",
|
|
709
711
|
props: {
|
|
@@ -724,178 +726,181 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
724
726
|
tableLayout: { default: "fixed" },
|
|
725
727
|
data: { default: null },
|
|
726
728
|
hasHeader: { type: Boolean, default: !0 },
|
|
727
|
-
hasFooter: { type: Boolean, default: !0 }
|
|
729
|
+
hasFooter: { type: Boolean, default: !0 },
|
|
730
|
+
css: { default: () => ({ tableWrapper: "border-b" }) }
|
|
728
731
|
},
|
|
729
|
-
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:filter-updated", "dsg-table:term-changed"],
|
|
730
|
-
setup(t, { expose: $, emit:
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
}, f =
|
|
732
|
+
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:filter-updated", "dsg-table:term-changed", "dsg-table:data-loaded"],
|
|
733
|
+
setup(t, { expose: $, emit: g }) {
|
|
734
|
+
const r = (l) => {
|
|
735
|
+
c.value = l;
|
|
736
|
+
}, f = k(!!(t.filterEntity || t.filterEndpoint)), v = () => {
|
|
734
737
|
if (f.value) {
|
|
735
738
|
let l = {};
|
|
736
|
-
return Ne().forEach((
|
|
737
|
-
if (
|
|
738
|
-
const P =
|
|
739
|
-
l[`filter[${P}]`] =
|
|
739
|
+
return Ne().forEach((d) => {
|
|
740
|
+
if (d.key.startsWith("filter[")) {
|
|
741
|
+
const P = d.key.replace("filter[", "").replace("]", ""), F = d.value;
|
|
742
|
+
l[`filter[${P}]`] = F.join(",");
|
|
740
743
|
}
|
|
741
744
|
}), l;
|
|
742
745
|
} else
|
|
743
746
|
return {};
|
|
744
|
-
}, h =
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
747
|
+
}, h = V(() => ({
|
|
748
|
+
...t.css,
|
|
749
|
+
tableWrapper: "border-b " + (t.css?.tableWrapper || "")
|
|
750
|
+
})), m = Re(), z = k(!0), H = k(null), p = k("<p>Showing {from} to {to} of {total}</p>"), b = k(null), n = ge("dsgTable"), i = k({ perPage: 20, change: r }), c = k(20), D = k({ ...v(), ...t.initialFilters }), S = g, C = (l) => {
|
|
751
|
+
n.value?.changePage(l);
|
|
752
|
+
}, j = (l) => {
|
|
753
|
+
b.value = l;
|
|
754
|
+
}, K = ({ data: l }) => {
|
|
755
|
+
H.value = l, S("dsg-table:data-loaded", l);
|
|
756
|
+
}, Q = () => {
|
|
757
|
+
z.value === !1 && n.value?.reload();
|
|
758
|
+
}, A = (l) => {
|
|
759
|
+
n.value?.setData(
|
|
760
|
+
n.value?.tableData.map((d) => d.id === l.id ? l : d)
|
|
755
761
|
);
|
|
756
|
-
},
|
|
757
|
-
|
|
758
|
-
},
|
|
759
|
-
|
|
760
|
-
}, ae = (l,
|
|
761
|
-
|
|
762
|
+
}, te = (l) => {
|
|
763
|
+
D.value = l;
|
|
764
|
+
}, _ = (l) => {
|
|
765
|
+
D.value["filter[term]"] = l, S("dsg-table:term-changed", l);
|
|
766
|
+
}, ae = (l, d, P) => {
|
|
767
|
+
D.value = { "filter[term]": D.value["filter[term]"], ...l }, S("dsg-table:filter-updated", D.value, d, P);
|
|
762
768
|
};
|
|
763
769
|
return $({
|
|
764
|
-
reloadTable:
|
|
765
|
-
updateRowTable:
|
|
766
|
-
termChanged:
|
|
767
|
-
setFilters:
|
|
768
|
-
}), (l,
|
|
769
|
-
l.hasHeader ? (a(),
|
|
770
|
+
reloadTable: Q,
|
|
771
|
+
updateRowTable: A,
|
|
772
|
+
termChanged: _,
|
|
773
|
+
setFilters: te
|
|
774
|
+
}), (l, d) => (a(), s("div", Et, [
|
|
775
|
+
l.hasHeader ? (a(), s("div", Rt, [
|
|
770
776
|
T(l.$slots, "dsg-table--pre-header", {}, () => [
|
|
771
|
-
|
|
777
|
+
y("div", Ht, [
|
|
772
778
|
T(l.$slots, "dsg-table--page-title", {
|
|
773
779
|
data: H.value,
|
|
774
780
|
title: l.title
|
|
775
781
|
}, () => [
|
|
776
|
-
l.title.length > 0 ? (a(),
|
|
782
|
+
l.title.length > 0 ? (a(), s("h1", {
|
|
777
783
|
key: 0,
|
|
778
784
|
class: "dsg-table--title",
|
|
779
|
-
textContent:
|
|
780
|
-
}, null, 8, It)) :
|
|
785
|
+
textContent: x(l.title)
|
|
786
|
+
}, null, 8, It)) : w("", !0)
|
|
781
787
|
])
|
|
782
788
|
]),
|
|
783
|
-
|
|
789
|
+
y("div", zt, [
|
|
784
790
|
T(l.$slots, "dsg-table--page-actions", { data: H.value })
|
|
785
791
|
])
|
|
786
792
|
])
|
|
787
|
-
])) :
|
|
788
|
-
l.displayPaginationInfo ? (a(),
|
|
789
|
-
|
|
793
|
+
])) : w("", !0),
|
|
794
|
+
l.displayPaginationInfo ? (a(), s("div", At, [
|
|
795
|
+
y("div", Vt, [
|
|
790
796
|
T(l.$slots, "dsg-table--search-header", { data: H.value }, () => [
|
|
791
|
-
|
|
797
|
+
L(me, {
|
|
792
798
|
name: "term",
|
|
793
|
-
"onDsgTable:termChanged":
|
|
799
|
+
"onDsgTable:termChanged": d[0] || (d[0] = (P) => _(P))
|
|
794
800
|
}),
|
|
795
|
-
|
|
801
|
+
L(be, {
|
|
796
802
|
entity: l.filterEntity,
|
|
797
803
|
"filter-endpoint": l.filterEndpoint,
|
|
798
804
|
"search-endpoint": l.filterSearchEndpoint,
|
|
799
805
|
filters: l.filters,
|
|
800
|
-
"onDsgTable:filterUpdated":
|
|
806
|
+
"onDsgTable:filterUpdated": d[1] || (d[1] = (P, F, B) => ae(P, F, B))
|
|
801
807
|
}, null, 8, ["entity", "filter-endpoint", "search-endpoint", "filters"]),
|
|
802
808
|
T(l.$slots, "dsg-table--search-actions", { data: H.value })
|
|
803
809
|
])
|
|
804
810
|
]),
|
|
805
811
|
T(l.$slots, "dsg-table--search-navigation")
|
|
806
|
-
])) :
|
|
807
|
-
|
|
812
|
+
], 512)) : w("", !0),
|
|
813
|
+
L(Lt, {
|
|
808
814
|
ref: "dsgTable",
|
|
809
815
|
"api-url": l.getUrl,
|
|
810
|
-
"filter-params":
|
|
811
|
-
"onUpdate:filterParams":
|
|
812
|
-
"per-page":
|
|
813
|
-
"onUpdate:perPage":
|
|
816
|
+
"filter-params": D.value,
|
|
817
|
+
"onUpdate:filterParams": d[7] || (d[7] = (P) => D.value = P),
|
|
818
|
+
"per-page": c.value,
|
|
819
|
+
"onUpdate:perPage": d[8] || (d[8] = (P) => c.value = P),
|
|
814
820
|
fields: l.fields,
|
|
815
821
|
"load-on-start": l.loadOnStart,
|
|
816
822
|
"pagination-path": "meta",
|
|
817
823
|
selectable: l.selectable,
|
|
818
824
|
"track-by": l.trackBy,
|
|
819
825
|
"table-layout": l.tableLayout,
|
|
820
|
-
css:
|
|
826
|
+
css: h.value,
|
|
821
827
|
data: l.data,
|
|
822
|
-
"onDsgTable:loading":
|
|
823
|
-
"onDsgTable:loaded":
|
|
824
|
-
"onDsgTable:paginationData":
|
|
825
|
-
"onDsgTable:loadSuccess":
|
|
826
|
-
"onDsgTable:rowsSelected":
|
|
828
|
+
"onDsgTable:loading": d[9] || (d[9] = (P) => z.value = !0),
|
|
829
|
+
"onDsgTable:loaded": d[10] || (d[10] = (P) => z.value = !1),
|
|
830
|
+
"onDsgTable:paginationData": j,
|
|
831
|
+
"onDsgTable:loadSuccess": K,
|
|
832
|
+
"onDsgTable:rowsSelected": d[11] || (d[11] = (P) => S("dsg-table:rows-selected", P))
|
|
827
833
|
}, He({
|
|
828
|
-
"dsg-field--actions":
|
|
834
|
+
"dsg-field--actions": Z((P) => [
|
|
829
835
|
T(l.$slots, "dsg-table-actions", { data: P }, () => [
|
|
830
836
|
(a(), N(he, {
|
|
831
837
|
key: P.rowIndex,
|
|
832
838
|
data: P,
|
|
833
|
-
"onDsgTable:actionEdit":
|
|
834
|
-
"onDsgTable:actionView":
|
|
835
|
-
"onDsgTable:actionDelete":
|
|
836
|
-
"onDsgTable:actionArchive":
|
|
837
|
-
"onDsgTable:linkClicked":
|
|
839
|
+
"onDsgTable:actionEdit": d[2] || (d[2] = (F, B) => S("dsg-table:action-edit", F, B)),
|
|
840
|
+
"onDsgTable:actionView": d[3] || (d[3] = (F, B) => S("dsg-table:action-view", F, B)),
|
|
841
|
+
"onDsgTable:actionDelete": d[4] || (d[4] = (F, B) => S("dsg-table:action-delete", F, B)),
|
|
842
|
+
"onDsgTable:actionArchive": d[5] || (d[5] = (F, B) => S("dsg-table:action-archive", F, B)),
|
|
843
|
+
"onDsgTable:linkClicked": d[6] || (d[6] = (F, B, le) => S("dsg-table:link-clicked", F, B, le))
|
|
838
844
|
}, null, 8, ["data"]))
|
|
839
845
|
])
|
|
840
846
|
]),
|
|
841
847
|
_: 2
|
|
842
848
|
}, [
|
|
843
|
-
q(U(
|
|
844
|
-
name:
|
|
845
|
-
fn:
|
|
846
|
-
String(
|
|
849
|
+
q(U(m), (P, F) => ({
|
|
850
|
+
name: F,
|
|
851
|
+
fn: Z((B) => [
|
|
852
|
+
String(F) !== "dsg-field--actions" ? T(l.$slots, F, Ie(ze({ key: 0 }, B))) : w("", !0)
|
|
847
853
|
])
|
|
848
854
|
}))
|
|
849
|
-
]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "data"]),
|
|
850
|
-
l.hasFooter ? (a(),
|
|
851
|
-
|
|
855
|
+
]), 1032, ["api-url", "filter-params", "per-page", "fields", "load-on-start", "selectable", "track-by", "table-layout", "css", "data"]),
|
|
856
|
+
l.hasFooter ? (a(), s("div", Ot, [
|
|
857
|
+
y("div", Ut, [
|
|
852
858
|
T(l.$slots, "dsg-table--footer-left", {
|
|
853
|
-
data:
|
|
854
|
-
perPage:
|
|
859
|
+
data: b.value,
|
|
860
|
+
perPage: i.value
|
|
855
861
|
}, () => [
|
|
856
|
-
|
|
857
|
-
"no-data-template": "",
|
|
862
|
+
L(pe, {
|
|
858
863
|
ref: "paginationInfoStart",
|
|
859
|
-
pagination:
|
|
860
|
-
"onUpdate:pagination":
|
|
861
|
-
"info-template":
|
|
864
|
+
pagination: b.value,
|
|
865
|
+
"onUpdate:pagination": d[12] || (d[12] = (P) => b.value = P),
|
|
866
|
+
"info-template": p.value
|
|
862
867
|
}, null, 8, ["pagination", "info-template"]),
|
|
863
868
|
T(l.$slots, "dsg-table--footer-left-extras", {
|
|
864
|
-
data:
|
|
865
|
-
perPage:
|
|
869
|
+
data: b.value,
|
|
870
|
+
perPage: i.value
|
|
866
871
|
})
|
|
867
872
|
])
|
|
868
873
|
]),
|
|
869
|
-
|
|
874
|
+
y("div", qt, [
|
|
870
875
|
T(l.$slots, "dsg-table--footer-center", {
|
|
871
|
-
data:
|
|
872
|
-
perPage:
|
|
876
|
+
data: b.value,
|
|
877
|
+
perPage: i.value
|
|
873
878
|
}, () => [
|
|
874
879
|
T(l.$slots, "dsg-table--footer-center-extras", {
|
|
875
|
-
data:
|
|
876
|
-
perPage:
|
|
880
|
+
data: b.value,
|
|
881
|
+
perPage: i.value
|
|
877
882
|
})
|
|
878
883
|
])
|
|
879
884
|
]),
|
|
880
|
-
|
|
885
|
+
y("div", Nt, [
|
|
881
886
|
T(l.$slots, "dsg-table--footer-right", {
|
|
882
|
-
data:
|
|
883
|
-
perPage:
|
|
887
|
+
data: b.value,
|
|
888
|
+
perPage: i.value
|
|
884
889
|
}, () => [
|
|
885
|
-
|
|
890
|
+
z.value === !1 ? (a(), N(fe, {
|
|
886
891
|
key: 0,
|
|
887
892
|
ref: "pagination",
|
|
888
|
-
pagination:
|
|
889
|
-
"onUpdate:pagination":
|
|
890
|
-
"onDsgTable:changePage":
|
|
891
|
-
}, null, 8, ["pagination"])) :
|
|
893
|
+
pagination: b.value,
|
|
894
|
+
"onUpdate:pagination": d[13] || (d[13] = (P) => b.value = P),
|
|
895
|
+
"onDsgTable:changePage": C
|
|
896
|
+
}, null, 8, ["pagination"])) : w("", !0),
|
|
892
897
|
T(l.$slots, "dsg-table--footer-right-extras", {
|
|
893
|
-
data:
|
|
894
|
-
perPage:
|
|
898
|
+
data: b.value,
|
|
899
|
+
perPage: i.value
|
|
895
900
|
})
|
|
896
901
|
])
|
|
897
902
|
])
|
|
898
|
-
])) :
|
|
903
|
+
], 512)) : w("", !0)
|
|
899
904
|
]));
|
|
900
905
|
}
|
|
901
906
|
}), jt = { class: "dsg-table--per-page" }, Kt = ["value", "textContent"], Qt = /* @__PURE__ */ W({
|
|
@@ -905,16 +910,16 @@ You can explicitly suppress this warning by setting pagination-path="".`
|
|
|
905
910
|
perPage: {}
|
|
906
911
|
},
|
|
907
912
|
setup(t) {
|
|
908
|
-
return ($,
|
|
909
|
-
oe(
|
|
910
|
-
"onUpdate:modelValue":
|
|
913
|
+
return ($, g) => (a(), s("div", jt, [
|
|
914
|
+
oe(y("select", {
|
|
915
|
+
"onUpdate:modelValue": g[0] || (g[0] = (r) => $.perPage.perPage = r),
|
|
911
916
|
class: "dsg-table--per-page-select",
|
|
912
|
-
onChange:
|
|
917
|
+
onChange: g[1] || (g[1] = (r) => $.perPage.change($.perPage.perPage))
|
|
913
918
|
}, [
|
|
914
|
-
(a(!0),
|
|
915
|
-
key:
|
|
916
|
-
value:
|
|
917
|
-
textContent:
|
|
919
|
+
(a(!0), s(R, null, q($.perPageOptions, (r) => (a(), s("option", {
|
|
920
|
+
key: r,
|
|
921
|
+
value: r,
|
|
922
|
+
textContent: x(r)
|
|
918
923
|
}, null, 8, Kt))), 128))
|
|
919
924
|
], 544), [
|
|
920
925
|
[Ae, $.perPage.perPage]
|