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