@webilio-xyz/webilio-vue 1.1.17 → 1.1.18
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/Table.js +293 -261
- package/package.json +1 -1
package/dist/Table.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { usePage as
|
|
3
|
-
import { C as
|
|
4
|
-
import { AkChevronLeft as
|
|
5
|
-
import { e as
|
|
6
|
-
import { i as
|
|
7
|
-
import { a as
|
|
8
|
-
import { t as
|
|
9
|
-
import { f as
|
|
10
|
-
var
|
|
11
|
-
function
|
|
1
|
+
import { computed as x, ref as T, openBlock as s, createElementBlock as o, renderSlot as h, createElementVNode as g, normalizeClass as v, createVNode as F, unref as $, Fragment as y, toDisplayString as C, renderList as P, createCommentVNode as M, withDirectives as Y, withKeys as J, vModelText as Q, nextTick as W, createTextVNode as K, createBlock as q, resolveDynamicComponent as _, watch as B } from "vue";
|
|
2
|
+
import { usePage as ee, router as te } from "@inertiajs/vue3";
|
|
3
|
+
import { C as ne, a as L } from "./ColumnDefinition-DMr-A-Xx.js";
|
|
4
|
+
import { AkChevronLeft as ae, AkChevronRight as se, AkArrowForward as oe } from "@kalimahapps/vue-icons";
|
|
5
|
+
import { e as le, b as E, g as V } from "./_baseIteratee-B9n7IWT3.js";
|
|
6
|
+
import { i as G, a as re, k as ie } from "./_baseEach-BeZ5ghU7.js";
|
|
7
|
+
import { a as ue } from "./isObject-BD_iszZg.js";
|
|
8
|
+
import { t as ce, d as de } from "./debounce-Cx8aOQWk.js";
|
|
9
|
+
import { f as ve } from "./forEach-DN2We3cJ.js";
|
|
10
|
+
var z = 1 / 0, ge = 17976931348623157e292;
|
|
11
|
+
function H(e) {
|
|
12
12
|
if (!e)
|
|
13
13
|
return e === 0 ? e : 0;
|
|
14
|
-
if (e =
|
|
14
|
+
if (e = ce(e), e === z || e === -z) {
|
|
15
15
|
var n = e < 0 ? -1 : 1;
|
|
16
|
-
return n *
|
|
16
|
+
return n * ge;
|
|
17
17
|
}
|
|
18
18
|
return e === e ? e : 0;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
var n =
|
|
20
|
+
function me(e) {
|
|
21
|
+
var n = H(e), a = n % 1;
|
|
22
22
|
return n === n ? a ? n - a : n : 0;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
for (var
|
|
26
|
-
if (n(e[
|
|
27
|
-
return
|
|
24
|
+
function fe(e, n, a, t) {
|
|
25
|
+
for (var i = e.length, l = a + -1; ++l < i; )
|
|
26
|
+
if (n(e[l], l, e))
|
|
27
|
+
return l;
|
|
28
28
|
return -1;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
if (!
|
|
30
|
+
function pe(e, n, a) {
|
|
31
|
+
if (!ue(a))
|
|
32
32
|
return !1;
|
|
33
33
|
var t = typeof n;
|
|
34
|
-
return (t == "number" ?
|
|
34
|
+
return (t == "number" ? G(a) && re(n, a.length) : t == "string" && n in a) ? le(a[n], e) : !1;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ye(e) {
|
|
37
37
|
return function(n, a, t) {
|
|
38
|
-
var
|
|
39
|
-
if (!
|
|
40
|
-
var
|
|
41
|
-
n =
|
|
42
|
-
return
|
|
38
|
+
var i = Object(n);
|
|
39
|
+
if (!G(n)) {
|
|
40
|
+
var l = E(a);
|
|
41
|
+
n = ie(n), a = function(d) {
|
|
42
|
+
return l(i[d], d, i);
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
return
|
|
45
|
+
var m = e(n, a, t);
|
|
46
|
+
return m > -1 ? i[l ? n[m] : m] : void 0;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
49
|
+
var be = Math.max;
|
|
50
|
+
function D(e, n, a) {
|
|
51
51
|
var t = e == null ? 0 : e.length;
|
|
52
52
|
if (!t)
|
|
53
53
|
return -1;
|
|
54
|
-
var
|
|
55
|
-
return
|
|
54
|
+
var i = a == null ? 0 : me(a);
|
|
55
|
+
return i < 0 && (i = be(t + i, 0)), fe(e, E(n), i);
|
|
56
56
|
}
|
|
57
|
-
var
|
|
58
|
-
function
|
|
59
|
-
for (var
|
|
60
|
-
|
|
61
|
-
return
|
|
57
|
+
var Ce = ye(D), ke = Math.ceil, we = Math.max;
|
|
58
|
+
function he(e, n, a, t) {
|
|
59
|
+
for (var i = -1, l = we(ke((n - e) / (a || 1)), 0), m = Array(l); l--; )
|
|
60
|
+
m[++i] = e, e += a;
|
|
61
|
+
return m;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function $e(e) {
|
|
64
64
|
return function(n, a, t) {
|
|
65
|
-
return t && typeof t != "number" &&
|
|
65
|
+
return t && typeof t != "number" && pe(n, a, t) && (a = t = void 0), n = H(n), a === void 0 ? (a = n, n = 0) : a = H(a), t = t === void 0 ? n < a ? 1 : -1 : H(t), he(n, a, t);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
var
|
|
69
|
-
const
|
|
68
|
+
var R = $e();
|
|
69
|
+
const xe = { class: "flex space-x-1.5" }, Se = ["disabled"], Pe = ["onClick"], Te = ["onClick"], Ve = ["onClick"], Ae = ["onClick"], Ne = {
|
|
70
70
|
key: 0,
|
|
71
71
|
class: "wv-pagination-dot py-2"
|
|
72
|
-
},
|
|
72
|
+
}, Re = ["onClick"], Me = ["onClick"], Fe = {
|
|
73
73
|
key: 0,
|
|
74
74
|
class: "wv-pagination-dot py-2"
|
|
75
|
-
},
|
|
75
|
+
}, Le = ["disabled"], Be = ["max"], O = {
|
|
76
76
|
__name: "TablePaginationComponent",
|
|
77
77
|
props: {
|
|
78
78
|
modelValue: {
|
|
@@ -94,125 +94,157 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
94
94
|
buttonPageClass: {
|
|
95
95
|
type: String,
|
|
96
96
|
default: ""
|
|
97
|
+
},
|
|
98
|
+
goto: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: !0
|
|
97
101
|
}
|
|
98
102
|
},
|
|
99
103
|
emits: ["update:modelValue"],
|
|
100
104
|
setup(e, { emit: n }) {
|
|
101
|
-
const a = e, t =
|
|
102
|
-
|
|
105
|
+
const a = e, t = x(() => a.modelValue), i = x(() => `${a.buttonClass} ${a.buttonLrClass}`), l = x(() => `${a.buttonClass} ${a.buttonPageClass}`), m = n, d = (b) => {
|
|
106
|
+
m("update:modelValue", b);
|
|
107
|
+
}, f = T(!1), c = T(t.value), k = T(null), A = async () => {
|
|
108
|
+
var b, p;
|
|
109
|
+
c.value = t.value, f.value = !0, await W(), (b = k.value) == null || b.focus(), (p = k.value) == null || p.select();
|
|
110
|
+
}, N = () => {
|
|
111
|
+
const b = Math.min(Math.max(Math.round(Number(c.value)) || 1, 1), a.lastPage);
|
|
112
|
+
d(b), f.value = !1;
|
|
103
113
|
};
|
|
104
|
-
return (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
class:
|
|
114
|
+
return (b, p) => (s(), o("div", xe, [
|
|
115
|
+
h(b.$slots, "before", {}, () => [
|
|
116
|
+
g("button", {
|
|
117
|
+
class: v([i.value, "wv-pagination-button wv-pagination-before"]),
|
|
108
118
|
disabled: t.value === 1,
|
|
109
|
-
onClick:
|
|
119
|
+
onClick: p[0] || (p[0] = (r) => d(t.value - 1))
|
|
110
120
|
}, [
|
|
111
|
-
|
|
112
|
-
], 10,
|
|
121
|
+
F($(ae), { class: "w-5 h-5" })
|
|
122
|
+
], 10, Se)
|
|
113
123
|
]),
|
|
114
|
-
t.value === 1 ? (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
class:
|
|
124
|
+
t.value === 1 ? (s(), o(y, { key: 0 }, [
|
|
125
|
+
h(b.$slots, "current", {}, () => [
|
|
126
|
+
g("button", {
|
|
127
|
+
class: v([l.value, "wv-pagination-button wv-pagination-current"]),
|
|
118
128
|
disabled: ""
|
|
119
|
-
},
|
|
129
|
+
}, C(t.value), 3)
|
|
120
130
|
]),
|
|
121
|
-
|
|
122
|
-
e.lastPage < 5 ? (
|
|
123
|
-
class:
|
|
124
|
-
key:
|
|
125
|
-
onClick: (
|
|
126
|
-
},
|
|
127
|
-
(
|
|
128
|
-
class:
|
|
129
|
-
key:
|
|
130
|
-
onClick: (
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class:
|
|
135
|
-
onClick:
|
|
136
|
-
},
|
|
131
|
+
h(b.$slots, "next", {}, () => [
|
|
132
|
+
e.lastPage < 5 ? (s(!0), o(y, { key: 0 }, P($(R)(t.value + 1, e.lastPage + 1), (r) => (s(), o("button", {
|
|
133
|
+
class: v([l.value, "wv-pagination-button wv-pagination-next"]),
|
|
134
|
+
key: r,
|
|
135
|
+
onClick: (u) => d(r)
|
|
136
|
+
}, C(r), 11, Pe))), 128)) : (s(), o(y, { key: 1 }, [
|
|
137
|
+
(s(!0), o(y, null, P($(R)(t.value + 1, t.value + 3), (r) => (s(), o("button", {
|
|
138
|
+
class: v([l.value, "wv-pagination-button wv-pagination-next"]),
|
|
139
|
+
key: r,
|
|
140
|
+
onClick: (u) => d(r)
|
|
141
|
+
}, C(r), 11, Te))), 128)),
|
|
142
|
+
p[7] || (p[7] = g("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
|
|
143
|
+
g("button", {
|
|
144
|
+
class: v([l.value, "wv-pagination-button wv-pagination-next"]),
|
|
145
|
+
onClick: p[1] || (p[1] = (r) => d(e.lastPage))
|
|
146
|
+
}, C(e.lastPage), 3)
|
|
137
147
|
], 64))
|
|
138
148
|
])
|
|
139
|
-
], 64)) : t.value === e.lastPage ? (
|
|
140
|
-
|
|
141
|
-
e.lastPage < 5 ? (
|
|
142
|
-
class:
|
|
143
|
-
key:
|
|
144
|
-
onClick: (
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
class:
|
|
148
|
-
onClick:
|
|
149
|
+
], 64)) : t.value === e.lastPage ? (s(), o(y, { key: 1 }, [
|
|
150
|
+
h(b.$slots, "previous", {}, () => [
|
|
151
|
+
e.lastPage < 5 ? (s(!0), o(y, { key: 0 }, P($(R)(1, e.lastPage), (r) => (s(), o("button", {
|
|
152
|
+
class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
|
|
153
|
+
key: r,
|
|
154
|
+
onClick: (u) => d(r)
|
|
155
|
+
}, C(r), 11, Ve))), 128)) : (s(), o(y, { key: 1 }, [
|
|
156
|
+
g("button", {
|
|
157
|
+
class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
|
|
158
|
+
onClick: p[2] || (p[2] = (r) => d(1))
|
|
149
159
|
}, " 1 ", 2),
|
|
150
|
-
|
|
151
|
-
(
|
|
152
|
-
class:
|
|
153
|
-
key:
|
|
154
|
-
onClick: (
|
|
155
|
-
},
|
|
160
|
+
p[8] || (p[8] = g("span", { class: "wv-pagination-dot py-2" }, "...", -1)),
|
|
161
|
+
(s(!0), o(y, null, P($(R)(t.value - 2, t.value), (r) => (s(), o("button", {
|
|
162
|
+
class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
|
|
163
|
+
key: r,
|
|
164
|
+
onClick: (u) => d(r)
|
|
165
|
+
}, C(r), 11, Ae))), 128))
|
|
156
166
|
], 64))
|
|
157
167
|
]),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
class:
|
|
168
|
+
h(b.$slots, "current", {}, () => [
|
|
169
|
+
g("button", {
|
|
170
|
+
class: v([l.value, "wv-pagination-button wv-pagination-current"]),
|
|
161
171
|
disabled: ""
|
|
162
|
-
},
|
|
172
|
+
}, C(t.value), 3)
|
|
163
173
|
])
|
|
164
|
-
], 64)) : (
|
|
165
|
-
|
|
166
|
-
t.value > 2 ? (
|
|
167
|
-
|
|
168
|
-
class:
|
|
169
|
-
onClick:
|
|
174
|
+
], 64)) : (s(), o(y, { key: 2 }, [
|
|
175
|
+
h(b.$slots, "previous", {}, () => [
|
|
176
|
+
t.value > 2 ? (s(), o(y, { key: 0 }, [
|
|
177
|
+
g("button", {
|
|
178
|
+
class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
|
|
179
|
+
onClick: p[3] || (p[3] = (r) => d(1))
|
|
170
180
|
}, " 1 ", 2),
|
|
171
|
-
t.value > 3 ? (
|
|
172
|
-
], 64)) :
|
|
173
|
-
(
|
|
174
|
-
class:
|
|
175
|
-
key:
|
|
176
|
-
onClick: (
|
|
177
|
-
},
|
|
181
|
+
t.value > 3 ? (s(), o("span", Ne, "...")) : M("", !0)
|
|
182
|
+
], 64)) : M("", !0),
|
|
183
|
+
(s(!0), o(y, null, P($(R)(t.value - 1, t.value), (r) => (s(), o("button", {
|
|
184
|
+
class: v([l.value, "wv-pagination-button wv-pagination-previous"]),
|
|
185
|
+
key: r,
|
|
186
|
+
onClick: (u) => d(r)
|
|
187
|
+
}, C(r), 11, Re))), 128))
|
|
178
188
|
]),
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
class:
|
|
189
|
+
h(b.$slots, "current", {}, () => [
|
|
190
|
+
g("button", {
|
|
191
|
+
class: v([l.value, "wv-pagination-button wv-pagination-current"]),
|
|
182
192
|
disabled: ""
|
|
183
|
-
},
|
|
193
|
+
}, C(t.value), 3)
|
|
184
194
|
]),
|
|
185
|
-
|
|
186
|
-
(
|
|
187
|
-
class:
|
|
188
|
-
key:
|
|
189
|
-
onClick: (
|
|
190
|
-
},
|
|
191
|
-
t.value < e.lastPage - 1 ? (
|
|
192
|
-
t.value < e.lastPage - 2 ? (
|
|
193
|
-
|
|
194
|
-
class:
|
|
195
|
-
onClick:
|
|
196
|
-
},
|
|
197
|
-
], 64)) :
|
|
195
|
+
h(b.$slots, "next", {}, () => [
|
|
196
|
+
(s(!0), o(y, null, P($(R)(t.value + 1, t.value + 2), (r) => (s(), o("button", {
|
|
197
|
+
class: v([l.value, "wv-pagination-button wv-pagination-next"]),
|
|
198
|
+
key: r,
|
|
199
|
+
onClick: (u) => d(r)
|
|
200
|
+
}, C(r), 11, Me))), 128)),
|
|
201
|
+
t.value < e.lastPage - 1 ? (s(), o(y, { key: 0 }, [
|
|
202
|
+
t.value < e.lastPage - 2 ? (s(), o("span", Fe, "...")) : M("", !0),
|
|
203
|
+
g("button", {
|
|
204
|
+
class: v([l.value, "wv-pagination-button wv-pagination-next"]),
|
|
205
|
+
onClick: p[4] || (p[4] = (r) => d(e.lastPage))
|
|
206
|
+
}, C(e.lastPage), 3)
|
|
207
|
+
], 64)) : M("", !0)
|
|
198
208
|
])
|
|
199
209
|
], 64)),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
class:
|
|
210
|
+
h(b.$slots, "after", {}, () => [
|
|
211
|
+
g("button", {
|
|
212
|
+
class: v([i.value, "wv-pagination-button wv-pagination-after"]),
|
|
203
213
|
disabled: t.value === e.lastPage,
|
|
204
|
-
onClick:
|
|
214
|
+
onClick: p[5] || (p[5] = (r) => d(t.value + 1))
|
|
205
215
|
}, [
|
|
206
|
-
|
|
207
|
-
], 10,
|
|
208
|
-
])
|
|
216
|
+
F($(se), { class: "w-5 h-5" })
|
|
217
|
+
], 10, Le)
|
|
218
|
+
]),
|
|
219
|
+
e.goto ? (s(), o(y, { key: 3 }, [
|
|
220
|
+
f.value ? Y((s(), o("input", {
|
|
221
|
+
key: 0,
|
|
222
|
+
ref_key: "gotoInput",
|
|
223
|
+
ref: k,
|
|
224
|
+
"onUpdate:modelValue": p[6] || (p[6] = (r) => c.value = r),
|
|
225
|
+
type: "number",
|
|
226
|
+
min: 1,
|
|
227
|
+
max: e.lastPage,
|
|
228
|
+
class: "wv-pagination-goto-input",
|
|
229
|
+
onKeyup: J(N, ["enter"]),
|
|
230
|
+
onBlur: N
|
|
231
|
+
}, null, 40, Be)), [
|
|
232
|
+
[Q, c.value]
|
|
233
|
+
]) : (s(), o("button", {
|
|
234
|
+
key: 1,
|
|
235
|
+
class: v([i.value, "wv-pagination-button wv-pagination-goto"]),
|
|
236
|
+
onClick: A
|
|
237
|
+
}, [
|
|
238
|
+
F($(oe), { class: "w-5 h-5" })
|
|
239
|
+
], 2))
|
|
240
|
+
], 64)) : M("", !0)
|
|
209
241
|
]));
|
|
210
242
|
}
|
|
211
|
-
},
|
|
243
|
+
}, I = {
|
|
212
244
|
__name: "TableCellComponent",
|
|
213
245
|
props: {
|
|
214
246
|
column: {
|
|
215
|
-
type:
|
|
247
|
+
type: ne,
|
|
216
248
|
default: () => {
|
|
217
249
|
}
|
|
218
250
|
},
|
|
@@ -223,24 +255,24 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
223
255
|
}
|
|
224
256
|
},
|
|
225
257
|
setup(e) {
|
|
226
|
-
const n = e, a =
|
|
258
|
+
const n = e, a = x(() => !!n.column.formatter && typeof n.column.formatter == "function"), t = x(() => typeof n.column.render == "function"), i = x(() => a.value ? n.column.formatter(n.data, n.column) : t.value ? n.column.render(n.data, n.column) : V(n.data, n.column.key, null)), l = x(() => [
|
|
227
259
|
`w-${n.column.size ?? "auto"}`,
|
|
228
260
|
n.column.className
|
|
229
261
|
]);
|
|
230
|
-
return (
|
|
231
|
-
class:
|
|
262
|
+
return (m, d) => (s(), o("td", {
|
|
263
|
+
class: v(["px-6 py-4 whitespace-nowrap text-sm font-medium", l.value])
|
|
232
264
|
}, [
|
|
233
|
-
t.value ? (
|
|
234
|
-
|
|
265
|
+
t.value ? (s(), q(_(i.value), { key: 1 })) : (s(), o(y, { key: 0 }, [
|
|
266
|
+
K(C(i.value), 1)
|
|
235
267
|
], 64))
|
|
236
268
|
], 2));
|
|
237
269
|
}
|
|
238
|
-
},
|
|
270
|
+
}, He = { class: "border-0 border-b" }, j = {
|
|
239
271
|
__name: "TableRowComponent",
|
|
240
272
|
props: {
|
|
241
273
|
columns: {
|
|
242
|
-
type:
|
|
243
|
-
default: () => new
|
|
274
|
+
type: L,
|
|
275
|
+
default: () => new L()
|
|
244
276
|
},
|
|
245
277
|
data: {
|
|
246
278
|
type: Object,
|
|
@@ -249,15 +281,15 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
249
281
|
}
|
|
250
282
|
},
|
|
251
283
|
setup(e) {
|
|
252
|
-
return (n, a) => (
|
|
253
|
-
(
|
|
284
|
+
return (n, a) => (s(), o("tr", He, [
|
|
285
|
+
(s(!0), o(y, null, P(e.columns.columns, (t) => (s(), q(I, {
|
|
254
286
|
key: t.key,
|
|
255
287
|
column: t,
|
|
256
288
|
data: e.data
|
|
257
289
|
}, null, 8, ["column", "data"]))), 128))
|
|
258
290
|
]));
|
|
259
291
|
}
|
|
260
|
-
},
|
|
292
|
+
}, De = ["onClick"], Ke = {
|
|
261
293
|
key: 0,
|
|
262
294
|
class: "ms-1",
|
|
263
295
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -265,11 +297,11 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
265
297
|
height: "15",
|
|
266
298
|
fill: "#000000",
|
|
267
299
|
viewBox: "0 0 256 256"
|
|
268
|
-
},
|
|
300
|
+
}, qe = ["d"], U = {
|
|
269
301
|
__name: "TableHeaderComponent",
|
|
270
302
|
props: {
|
|
271
303
|
columns: {
|
|
272
|
-
type:
|
|
304
|
+
type: L,
|
|
273
305
|
default: () => []
|
|
274
306
|
},
|
|
275
307
|
trClass: {
|
|
@@ -287,9 +319,9 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
287
319
|
},
|
|
288
320
|
emits: ["setSort", "addSort"],
|
|
289
321
|
setup(e, { emit: n }) {
|
|
290
|
-
const a = e, t =
|
|
291
|
-
var
|
|
292
|
-
switch ((
|
|
322
|
+
const a = e, t = x(() => a.columns.columns.filter((f) => f.visible).sort((f, c) => f.order >= c.order ? 1 : -1)), i = n, l = (f) => f.sortable ? Ce(a.sorting, (c) => c.key === f.key) : !1, m = (f) => {
|
|
323
|
+
var c;
|
|
324
|
+
switch ((c = l(f)) == null ? void 0 : c.direction) {
|
|
293
325
|
case "asc":
|
|
294
326
|
return "asc";
|
|
295
327
|
case "desc":
|
|
@@ -297,43 +329,43 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
297
329
|
default:
|
|
298
330
|
return !1;
|
|
299
331
|
}
|
|
300
|
-
}, d = (
|
|
301
|
-
if (!
|
|
332
|
+
}, d = (f, c) => {
|
|
333
|
+
if (!f.sortable)
|
|
302
334
|
return "";
|
|
303
|
-
|
|
335
|
+
c.shiftKey ? i("addSort", f) : i("setSort", f);
|
|
304
336
|
};
|
|
305
|
-
return (
|
|
306
|
-
class:
|
|
337
|
+
return (f, c) => (s(), o("thead", {
|
|
338
|
+
class: v(e.headerClass)
|
|
307
339
|
}, [
|
|
308
|
-
|
|
309
|
-
class:
|
|
340
|
+
g("tr", {
|
|
341
|
+
class: v(e.trClass)
|
|
310
342
|
}, [
|
|
311
|
-
(
|
|
312
|
-
key:
|
|
343
|
+
(s(!0), o(y, null, P(t.value, (k) => (s(), o("th", {
|
|
344
|
+
key: k.key,
|
|
313
345
|
scope: "col",
|
|
314
|
-
class:
|
|
346
|
+
class: v(["px-6 py-3 text-start", [k.thClassName, { "cursor-pointer": k.sortable }]])
|
|
315
347
|
}, [
|
|
316
|
-
|
|
348
|
+
g("div", {
|
|
317
349
|
class: "flex items-center",
|
|
318
|
-
onClick: (
|
|
350
|
+
onClick: (A) => d(k, A)
|
|
319
351
|
}, [
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
d:
|
|
324
|
-
}, null, 8,
|
|
325
|
-
])) :
|
|
326
|
-
], 8,
|
|
352
|
+
K(C(k.name) + " ", 1),
|
|
353
|
+
m(k) ? (s(), o("svg", Ke, [
|
|
354
|
+
g("path", {
|
|
355
|
+
d: m(k) === "asc" ? "M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z" : "M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"
|
|
356
|
+
}, null, 8, qe)
|
|
357
|
+
])) : M("", !0)
|
|
358
|
+
], 8, De)
|
|
327
359
|
], 2))), 128))
|
|
328
360
|
], 2)
|
|
329
361
|
], 2));
|
|
330
362
|
}
|
|
331
|
-
},
|
|
363
|
+
}, ze = { class: "overflow-x-auto table w-full relative" }, Ee = { key: 1 }, Ge = ["colspan"], Oe = { class: "flex items-center justify-center" }, Ie = { key: 2 }, je = ["colspan"], Z = {
|
|
332
364
|
__name: "TableComponent",
|
|
333
365
|
props: {
|
|
334
366
|
columns: {
|
|
335
|
-
type:
|
|
336
|
-
default: () => new
|
|
367
|
+
type: L,
|
|
368
|
+
default: () => new L()
|
|
337
369
|
},
|
|
338
370
|
data: {
|
|
339
371
|
type: Array,
|
|
@@ -359,37 +391,37 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
359
391
|
emits: ["setSort", "addSort"],
|
|
360
392
|
setup(e, { emit: n }) {
|
|
361
393
|
const a = n;
|
|
362
|
-
return (t,
|
|
363
|
-
var
|
|
364
|
-
return
|
|
365
|
-
|
|
394
|
+
return (t, i) => {
|
|
395
|
+
var l;
|
|
396
|
+
return s(), o("table", ze, [
|
|
397
|
+
F(U, {
|
|
366
398
|
columns: e.columns,
|
|
367
399
|
headerClass: e.headerClass,
|
|
368
400
|
trClass: e.trHeadClass,
|
|
369
401
|
sorting: e.sorting,
|
|
370
|
-
onSetSort:
|
|
371
|
-
onAddSort:
|
|
402
|
+
onSetSort: i[0] || (i[0] = (m) => a("setSort", m)),
|
|
403
|
+
onAddSort: i[1] || (i[1] = (m) => a("addSort", m))
|
|
372
404
|
}, null, 8, ["columns", "headerClass", "trClass", "sorting"]),
|
|
373
|
-
(
|
|
405
|
+
(l = e.data) != null && l.length && !e.isLoading ? (s(!0), o(y, { key: 0 }, P(e.data, (m, d) => (s(), q(j, {
|
|
374
406
|
key: d,
|
|
375
407
|
columns: e.columns,
|
|
376
|
-
data:
|
|
377
|
-
class:
|
|
378
|
-
}, null, 8, ["columns", "data", "class"]))), 128)) : e.isLoading ? (
|
|
379
|
-
|
|
408
|
+
data: m,
|
|
409
|
+
class: v(m == null ? void 0 : m.trClassName)
|
|
410
|
+
}, null, 8, ["columns", "data", "class"]))), 128)) : e.isLoading ? (s(), o("tr", Ee, [
|
|
411
|
+
g("td", {
|
|
380
412
|
colspan: e.columns.columns.length,
|
|
381
413
|
class: "text-center py-4"
|
|
382
414
|
}, [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
415
|
+
g("div", Oe, [
|
|
416
|
+
K(C(t.$t("text.loading")) + " ", 1),
|
|
417
|
+
i[2] || (i[2] = g("div", { class: "mx-1" }, [
|
|
418
|
+
g("svg", {
|
|
387
419
|
class: "animate-spin h-5 w-5",
|
|
388
420
|
fill: "none",
|
|
389
421
|
viewBox: "0 0 24 24",
|
|
390
422
|
xmlns: "http://www.w3.org/2000/svg"
|
|
391
423
|
}, [
|
|
392
|
-
|
|
424
|
+
g("circle", {
|
|
393
425
|
class: "opacity-25",
|
|
394
426
|
cx: "12",
|
|
395
427
|
cy: "12",
|
|
@@ -397,7 +429,7 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
397
429
|
stroke: "currentColor",
|
|
398
430
|
"stroke-width": "4"
|
|
399
431
|
}),
|
|
400
|
-
|
|
432
|
+
g("path", {
|
|
401
433
|
class: "opacity-75",
|
|
402
434
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
403
435
|
fill: "currentColor"
|
|
@@ -405,21 +437,21 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
405
437
|
])
|
|
406
438
|
], -1))
|
|
407
439
|
])
|
|
408
|
-
], 8,
|
|
409
|
-
])) : (
|
|
410
|
-
|
|
440
|
+
], 8, Ge)
|
|
441
|
+
])) : (s(), o("tr", Ie, [
|
|
442
|
+
g("td", {
|
|
411
443
|
colspan: e.columns.columns.length,
|
|
412
444
|
class: "text-center pt-4 text-gray-500"
|
|
413
|
-
},
|
|
445
|
+
}, C(t.$t("text.no_results")), 9, je)
|
|
414
446
|
]))
|
|
415
447
|
]);
|
|
416
448
|
};
|
|
417
449
|
}
|
|
418
|
-
},
|
|
450
|
+
}, Ue = { class: "flex-grow flex" }, Ze = { class: "py-2" }, Xe = {
|
|
419
451
|
__name: "InertiaTableComponent",
|
|
420
452
|
props: {
|
|
421
453
|
columns: {
|
|
422
|
-
type:
|
|
454
|
+
type: L,
|
|
423
455
|
required: !0
|
|
424
456
|
},
|
|
425
457
|
additionalFilters: {
|
|
@@ -460,30 +492,30 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
460
492
|
}
|
|
461
493
|
},
|
|
462
494
|
setup(e, { expose: n }) {
|
|
463
|
-
const a =
|
|
495
|
+
const a = ee(), t = e, i = T({}), l = T(V(a.props, t.inertiaKey, {})), m = x(() => V(l.value, "data", [])), d = T(!1), f = T(V(l, "current_page", t.currentPage)), c = T(t.sorting);
|
|
464
496
|
n({
|
|
465
|
-
getData:
|
|
497
|
+
getData: A
|
|
466
498
|
});
|
|
467
|
-
const
|
|
468
|
-
let
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
-
}),
|
|
499
|
+
const k = x(() => {
|
|
500
|
+
let u = {};
|
|
501
|
+
return ve(c.value, (w, S) => {
|
|
502
|
+
u[S] = { key: w.key, direction: w.direction };
|
|
503
|
+
}), u;
|
|
472
504
|
});
|
|
473
|
-
function
|
|
474
|
-
d.value = !0,
|
|
505
|
+
function A() {
|
|
506
|
+
d.value = !0, te.get(
|
|
475
507
|
window.location.pathname,
|
|
476
508
|
{
|
|
477
|
-
filters: { ...t.additionalFilters, ...
|
|
478
|
-
sort:
|
|
479
|
-
page:
|
|
509
|
+
filters: { ...t.additionalFilters, ...i.value },
|
|
510
|
+
sort: k.value,
|
|
511
|
+
page: f.value
|
|
480
512
|
},
|
|
481
513
|
{
|
|
482
514
|
preserveState: !0,
|
|
483
515
|
preserveScroll: !0,
|
|
484
516
|
only: [t.inertiaKey],
|
|
485
|
-
onSuccess: (
|
|
486
|
-
|
|
517
|
+
onSuccess: (u) => {
|
|
518
|
+
l.value = V(u.props, t.inertiaKey);
|
|
487
519
|
},
|
|
488
520
|
onFinish: () => {
|
|
489
521
|
d.value = !1;
|
|
@@ -491,31 +523,31 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
491
523
|
}
|
|
492
524
|
);
|
|
493
525
|
}
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}),
|
|
498
|
-
|
|
499
|
-
}),
|
|
500
|
-
|
|
526
|
+
const N = de(A, 500);
|
|
527
|
+
B(t, N, { deep: !0 }), B(f, N), B(() => t.currentPage, (u) => {
|
|
528
|
+
f.value = u;
|
|
529
|
+
}), B(() => t.sorting, (u) => {
|
|
530
|
+
c.value = u;
|
|
531
|
+
}), B(c, () => {
|
|
532
|
+
N();
|
|
501
533
|
}, { deep: !0 });
|
|
502
|
-
const
|
|
503
|
-
let
|
|
504
|
-
|
|
505
|
-
key:
|
|
506
|
-
direction:
|
|
507
|
-
} :
|
|
508
|
-
key:
|
|
509
|
-
direction:
|
|
510
|
-
}) : delete
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
key:
|
|
514
|
-
direction:
|
|
534
|
+
const b = (u) => {
|
|
535
|
+
let w = r(u), S = D(c.value, (X) => X.key === u.key);
|
|
536
|
+
w ? S > -1 ? c.value[S] = {
|
|
537
|
+
key: u.key,
|
|
538
|
+
direction: w
|
|
539
|
+
} : c.value.push({
|
|
540
|
+
key: u.key,
|
|
541
|
+
direction: w
|
|
542
|
+
}) : delete c.value[S];
|
|
543
|
+
}, p = (u) => {
|
|
544
|
+
c.value = [{
|
|
545
|
+
key: u.key,
|
|
546
|
+
direction: r(u)
|
|
515
547
|
}];
|
|
516
|
-
},
|
|
517
|
-
let
|
|
518
|
-
switch (
|
|
548
|
+
}, r = (u) => {
|
|
549
|
+
let w = D(c.value, (S) => S.key === u.key);
|
|
550
|
+
switch (V(c.value, `${w}.direction`, !1)) {
|
|
519
551
|
case "asc":
|
|
520
552
|
return "desc";
|
|
521
553
|
case "desc":
|
|
@@ -524,50 +556,50 @@ const Ce = { class: "flex space-x-1.5" }, ke = ["disabled"], we = ["onClick"], h
|
|
|
524
556
|
return "asc";
|
|
525
557
|
}
|
|
526
558
|
};
|
|
527
|
-
return (
|
|
528
|
-
|
|
559
|
+
return (u, w) => (s(), o(y, null, [
|
|
560
|
+
F(Z, {
|
|
529
561
|
ref: "props.table",
|
|
530
562
|
"is-loading": d.value,
|
|
531
|
-
data:
|
|
563
|
+
data: m.value,
|
|
532
564
|
columns: e.columns,
|
|
533
|
-
class:
|
|
565
|
+
class: v(e.tableClass),
|
|
534
566
|
headerClass: e.headerClass,
|
|
535
567
|
trHeadClass: e.trHeadClass,
|
|
536
|
-
sorting:
|
|
537
|
-
onSetSort:
|
|
538
|
-
onAddSort:
|
|
568
|
+
sorting: c.value,
|
|
569
|
+
onSetSort: p,
|
|
570
|
+
onAddSort: b
|
|
539
571
|
}, null, 8, ["is-loading", "data", "columns", "class", "headerClass", "trHeadClass", "sorting"]),
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
class:
|
|
572
|
+
h(u.$slots, "pagination", {}, () => [
|
|
573
|
+
g("div", {
|
|
574
|
+
class: v(["flex items-center", e.footerClass])
|
|
543
575
|
}, [
|
|
544
|
-
|
|
545
|
-
|
|
576
|
+
g("div", Ue, [
|
|
577
|
+
g("span", Ze, C(u.$t("table.nbResults", { total: $(V)(l.value, "total", 0) })), 1)
|
|
546
578
|
]),
|
|
547
|
-
|
|
548
|
-
"last-page":
|
|
549
|
-
modelValue:
|
|
550
|
-
"onUpdate:modelValue":
|
|
551
|
-
class:
|
|
579
|
+
F(O, {
|
|
580
|
+
"last-page": l.value.last_page,
|
|
581
|
+
modelValue: f.value,
|
|
582
|
+
"onUpdate:modelValue": w[0] || (w[0] = (S) => f.value = S),
|
|
583
|
+
class: v(e.footerClass)
|
|
552
584
|
}, null, 8, ["last-page", "modelValue", "class"])
|
|
553
585
|
], 2)
|
|
554
586
|
])
|
|
555
587
|
], 64));
|
|
556
588
|
}
|
|
557
|
-
},
|
|
558
|
-
InertiaTableComponent:
|
|
559
|
-
TableComponent:
|
|
560
|
-
TableCellComponent:
|
|
589
|
+
}, st = {
|
|
590
|
+
InertiaTableComponent: Xe,
|
|
591
|
+
TableComponent: Z,
|
|
592
|
+
TableCellComponent: I,
|
|
561
593
|
TableRowComponent: j,
|
|
562
|
-
TableHeaderComponent:
|
|
563
|
-
TablePaginationComponent:
|
|
594
|
+
TableHeaderComponent: U,
|
|
595
|
+
TablePaginationComponent: O
|
|
564
596
|
};
|
|
565
597
|
export {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
598
|
+
Xe as InertiaTableComponent,
|
|
599
|
+
I as TableCellComponent,
|
|
600
|
+
Z as TableComponent,
|
|
601
|
+
U as TableHeaderComponent,
|
|
602
|
+
O as TablePaginationComponent,
|
|
571
603
|
j as TableRowComponent,
|
|
572
|
-
|
|
604
|
+
st as default
|
|
573
605
|
};
|