@honed/table 0.1.0 → 0.2.1
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/index.d.ts +330 -0
- package/dist/index.es.js +430 -303
- package/dist/index.umd.js +1 -1
- package/package.json +11 -11
package/dist/index.es.js
CHANGED
|
@@ -1,211 +1,245 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as _, computed as h, toValue as N, reactive as Q } from "vue";
|
|
2
2
|
import { router as S } from "@inertiajs/vue3";
|
|
3
|
-
function
|
|
4
|
-
const
|
|
3
|
+
function X() {
|
|
4
|
+
const o = _({
|
|
5
5
|
all: !1,
|
|
6
6
|
only: /* @__PURE__ */ new Set(),
|
|
7
7
|
except: /* @__PURE__ */ new Set()
|
|
8
8
|
});
|
|
9
|
-
function
|
|
10
|
-
|
|
9
|
+
function f() {
|
|
10
|
+
o.value.all = !0, o.value.only.clear(), o.value.except.clear();
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
12
|
+
function v() {
|
|
13
|
+
o.value.all = !1, o.value.only.clear(), o.value.except.clear();
|
|
14
14
|
}
|
|
15
|
-
function l(...
|
|
16
|
-
|
|
15
|
+
function l(...s) {
|
|
16
|
+
s.forEach((m) => o.value.except.delete(m)), s.forEach((m) => o.value.only.add(m));
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function i(...s) {
|
|
19
|
+
s.forEach((m) => o.value.except.add(m)), s.forEach((m) => o.value.only.delete(m));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
24
|
-
if (!
|
|
25
|
-
return l(
|
|
21
|
+
function u(s, m) {
|
|
22
|
+
if (b(s) || m === !1)
|
|
23
|
+
return i(s);
|
|
24
|
+
if (!b(s) || m === !0)
|
|
25
|
+
return l(s);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function b(s) {
|
|
28
|
+
return o.value.all ? !o.value.except.has(s) : o.value.only.has(s);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
function x(
|
|
30
|
+
const d = h(() => o.value.all && o.value.except.size === 0), A = h(() => o.value.only.size > 0 || d.value);
|
|
31
|
+
function x(s) {
|
|
32
32
|
return {
|
|
33
|
-
"onUpdate:modelValue": (
|
|
34
|
-
|
|
33
|
+
"onUpdate:modelValue": (m) => {
|
|
34
|
+
m ? l(s) : i(s);
|
|
35
35
|
},
|
|
36
|
-
modelValue:
|
|
37
|
-
value:
|
|
36
|
+
modelValue: b(s),
|
|
37
|
+
value: s
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function k() {
|
|
41
41
|
return {
|
|
42
|
-
"onUpdate:modelValue": (
|
|
43
|
-
|
|
42
|
+
"onUpdate:modelValue": (s) => {
|
|
43
|
+
s ? f() : v();
|
|
44
44
|
},
|
|
45
|
-
modelValue:
|
|
45
|
+
modelValue: d.value,
|
|
46
|
+
value: d.value
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
return {
|
|
49
|
-
allSelected:
|
|
50
|
-
selection:
|
|
51
|
-
hasSelected:
|
|
52
|
-
selectAll:
|
|
53
|
-
deselectAll:
|
|
50
|
+
allSelected: d,
|
|
51
|
+
selection: o,
|
|
52
|
+
hasSelected: A,
|
|
53
|
+
selectAll: f,
|
|
54
|
+
deselectAll: v,
|
|
54
55
|
select: l,
|
|
55
|
-
deselect:
|
|
56
|
-
toggle:
|
|
57
|
-
selected:
|
|
56
|
+
deselect: i,
|
|
57
|
+
toggle: u,
|
|
58
|
+
selected: b,
|
|
58
59
|
bind: x,
|
|
59
|
-
bindAll:
|
|
60
|
+
bindAll: k
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
63
|
+
function J(o, f, v = {}, l = {}) {
|
|
64
|
+
return o.route ? (S.visit(o.route.href, {
|
|
64
65
|
...l,
|
|
65
|
-
method:
|
|
66
|
-
}), !0) :
|
|
67
|
-
|
|
66
|
+
method: o.route.method
|
|
67
|
+
}), !0) : o.action && f ? (S.post(
|
|
68
|
+
f,
|
|
68
69
|
{
|
|
69
|
-
...
|
|
70
|
-
name:
|
|
71
|
-
type:
|
|
70
|
+
...v,
|
|
71
|
+
name: o.name,
|
|
72
|
+
type: o.type
|
|
72
73
|
},
|
|
73
74
|
l
|
|
74
75
|
), !0) : !1;
|
|
75
76
|
}
|
|
76
77
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
77
|
-
const
|
|
78
|
+
const Y = () => {
|
|
78
79
|
};
|
|
79
|
-
function
|
|
80
|
-
function
|
|
81
|
-
return new Promise((
|
|
82
|
-
Promise.resolve(
|
|
80
|
+
function Z(o, f) {
|
|
81
|
+
function v(...l) {
|
|
82
|
+
return new Promise((i, u) => {
|
|
83
|
+
Promise.resolve(o(() => f.apply(this, l), { fn: f, thisArg: this, args: l })).then(i).catch(u);
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
return
|
|
86
|
+
return v;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
-
let
|
|
89
|
-
const
|
|
90
|
-
clearTimeout(
|
|
88
|
+
function O(o, f = {}) {
|
|
89
|
+
let v, l, i = Y;
|
|
90
|
+
const u = (d) => {
|
|
91
|
+
clearTimeout(d), i(), i = Y;
|
|
91
92
|
};
|
|
92
|
-
let
|
|
93
|
-
return (
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, x)),
|
|
99
|
-
l &&
|
|
100
|
-
},
|
|
93
|
+
let b;
|
|
94
|
+
return (d) => {
|
|
95
|
+
const A = N(o), x = N(f.maxWait);
|
|
96
|
+
return v && u(v), A <= 0 || x !== void 0 && x <= 0 ? (l && (u(l), l = null), Promise.resolve(d())) : new Promise((k, s) => {
|
|
97
|
+
i = f.rejectOnCancel ? s : k, b = d, x && !l && (l = setTimeout(() => {
|
|
98
|
+
v && u(v), l = null, k(b());
|
|
99
|
+
}, x)), v = setTimeout(() => {
|
|
100
|
+
l && u(l), l = null, k(d());
|
|
101
|
+
}, A);
|
|
101
102
|
});
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
function D(o, f = 200, v = {}) {
|
|
106
|
+
return Z(
|
|
107
|
+
O(f, v),
|
|
108
|
+
o
|
|
108
109
|
);
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
-
const l =
|
|
112
|
-
() =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
function ee(o, f, v = {}) {
|
|
112
|
+
const l = h(() => o[f]), i = h(
|
|
113
|
+
() => {
|
|
114
|
+
var e;
|
|
115
|
+
return ((e = l.value.filters) == null ? void 0 : e.map((n) => ({
|
|
116
|
+
...n,
|
|
117
|
+
apply: (a, c = {}) => L(n, a, c),
|
|
118
|
+
clear: (a = {}) => W(n, a),
|
|
119
|
+
bind: () => g(n.name)
|
|
120
|
+
}))) ?? [];
|
|
121
|
+
}
|
|
122
|
+
), u = h(
|
|
123
|
+
() => {
|
|
124
|
+
var e;
|
|
125
|
+
return ((e = l.value.sorts) == null ? void 0 : e.map((n) => ({
|
|
126
|
+
...n,
|
|
127
|
+
apply: (a = {}) => M(n, n.direction, a),
|
|
128
|
+
clear: (a = {}) => B(a),
|
|
129
|
+
bind: () => P(n)
|
|
130
|
+
}))) ?? [];
|
|
131
|
+
}
|
|
132
|
+
), b = h(
|
|
133
|
+
() => {
|
|
134
|
+
var e;
|
|
135
|
+
return (e = l.value.searches) == null ? void 0 : e.map((n) => ({
|
|
136
|
+
...n,
|
|
137
|
+
apply: (a = {}) => U(n, a),
|
|
138
|
+
clear: (a = {}) => U(n, a),
|
|
139
|
+
bind: () => K(n)
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
125
142
|
);
|
|
126
|
-
function
|
|
143
|
+
function d(e) {
|
|
127
144
|
return Array.isArray(e) ? e.join(l.value.config.delimiter) : e;
|
|
128
145
|
}
|
|
129
|
-
function
|
|
146
|
+
function A(e) {
|
|
130
147
|
return typeof e != "string" ? e : e.trim().replace(/\s+/g, "+");
|
|
131
148
|
}
|
|
132
|
-
function
|
|
149
|
+
function x(e) {
|
|
133
150
|
if (!["", null, void 0, []].includes(e))
|
|
134
151
|
return e;
|
|
135
152
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return l.value.sorts.find(
|
|
141
|
-
(r) => r.name === e && r.direction === n
|
|
153
|
+
function k(e) {
|
|
154
|
+
return [d, A, x].reduce(
|
|
155
|
+
(n, a) => a(n),
|
|
156
|
+
e
|
|
142
157
|
);
|
|
143
158
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
159
|
+
function s(e, n) {
|
|
160
|
+
return n = Array.isArray(n) ? n : [n], n.includes(e) ? n.filter((a) => a !== e) : [...n, e];
|
|
146
161
|
}
|
|
147
|
-
function
|
|
162
|
+
function m(e) {
|
|
148
163
|
var n;
|
|
149
|
-
return (n = l.value.
|
|
164
|
+
return (n = l.value.filters) == null ? void 0 : n.find((a) => a.name === e);
|
|
150
165
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
166
|
+
function T(e, n = null) {
|
|
167
|
+
var a;
|
|
168
|
+
return (a = l.value.sorts) == null ? void 0 : a.find(
|
|
169
|
+
(c) => c.name === e && c.direction === n
|
|
170
|
+
);
|
|
153
171
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
172
|
+
function C(e) {
|
|
173
|
+
var n;
|
|
174
|
+
return (n = l.value.searches) == null ? void 0 : n.find((a) => a.name === e);
|
|
156
175
|
}
|
|
157
|
-
function
|
|
176
|
+
function z() {
|
|
177
|
+
var e;
|
|
178
|
+
return ((e = l.value.filters) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
179
|
+
}
|
|
180
|
+
function p() {
|
|
181
|
+
var e;
|
|
182
|
+
return (e = l.value.sorts) == null ? void 0 : e.find(({ active: n }) => n);
|
|
183
|
+
}
|
|
184
|
+
function V() {
|
|
158
185
|
var e;
|
|
159
186
|
return ((e = l.value.searches) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
|
|
160
187
|
}
|
|
161
|
-
function
|
|
188
|
+
function y(e) {
|
|
189
|
+
return e ? typeof e == "string" ? z().some((n) => n.name === e) : e.active : !!z().length;
|
|
190
|
+
}
|
|
191
|
+
function w(e) {
|
|
162
192
|
var n;
|
|
163
|
-
return e ? ((n =
|
|
193
|
+
return e ? typeof e == "string" ? ((n = p()) == null ? void 0 : n.name) === e : e.active : !!p();
|
|
164
194
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
195
|
+
function E(e) {
|
|
196
|
+
var n, a;
|
|
197
|
+
return e ? typeof e == "string" ? (a = V()) == null ? void 0 : a.some((c) => c.name === e) : e.active : !!((n = V()) != null && n.length);
|
|
167
198
|
}
|
|
168
|
-
function
|
|
169
|
-
|
|
170
|
-
|
|
199
|
+
function q(e, n = {}) {
|
|
200
|
+
const a = Object.fromEntries(
|
|
201
|
+
Object.entries(e).map(([c, F]) => [c, k(F)])
|
|
202
|
+
);
|
|
203
|
+
S.reload({
|
|
204
|
+
...v,
|
|
205
|
+
...n,
|
|
206
|
+
data: a
|
|
207
|
+
});
|
|
171
208
|
}
|
|
172
|
-
function
|
|
173
|
-
const c = typeof e == "string" ?
|
|
209
|
+
function L(e, n, a = {}) {
|
|
210
|
+
const c = typeof e == "string" ? m(e) : e;
|
|
174
211
|
if (!c) {
|
|
175
212
|
console.warn(`Filter [${e}] does not exist.`);
|
|
176
213
|
return;
|
|
177
214
|
}
|
|
178
|
-
"multiple" in c && c.multiple && (n =
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
), console.log(n), S.reload({
|
|
182
|
-
...s,
|
|
183
|
-
...r,
|
|
215
|
+
"multiple" in c && c.multiple && (n = s(n, c.value)), S.reload({
|
|
216
|
+
...v,
|
|
217
|
+
...a,
|
|
184
218
|
data: {
|
|
185
|
-
[c.name]: n
|
|
219
|
+
[c.name]: k(n)
|
|
186
220
|
}
|
|
187
221
|
});
|
|
188
222
|
}
|
|
189
|
-
function
|
|
190
|
-
const c = typeof e == "string" ?
|
|
223
|
+
function M(e, n = null, a = {}) {
|
|
224
|
+
const c = typeof e == "string" ? T(e, n) : e;
|
|
191
225
|
if (!c) {
|
|
192
226
|
console.warn(`Sort [${e}] does not exist.`);
|
|
193
227
|
return;
|
|
194
228
|
}
|
|
195
229
|
S.reload({
|
|
196
|
-
...
|
|
197
|
-
...
|
|
230
|
+
...v,
|
|
231
|
+
...a,
|
|
198
232
|
data: {
|
|
199
|
-
[l.value.config.sorts]:
|
|
233
|
+
[l.value.config.sorts]: x(c.next)
|
|
200
234
|
}
|
|
201
235
|
});
|
|
202
236
|
}
|
|
203
|
-
function
|
|
204
|
-
e = [
|
|
205
|
-
(
|
|
237
|
+
function G(e, n = {}) {
|
|
238
|
+
e = [A, x].reduce(
|
|
239
|
+
(a, c) => c(a),
|
|
206
240
|
e
|
|
207
241
|
), S.reload({
|
|
208
|
-
...
|
|
242
|
+
...v,
|
|
209
243
|
...n,
|
|
210
244
|
data: {
|
|
211
245
|
[l.value.config.searches]: e
|
|
@@ -213,323 +247,416 @@ function N(a, v, s = {}) {
|
|
|
213
247
|
});
|
|
214
248
|
}
|
|
215
249
|
function U(e, n = {}) {
|
|
216
|
-
|
|
250
|
+
if (!l.value.config.matches) {
|
|
251
|
+
console.warn("Matches key is not set.");
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (!(typeof e == "string" ? C(e) : e)) {
|
|
255
|
+
console.warn(`Match [${e}] does not exist.`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const a = s(
|
|
259
|
+
e,
|
|
260
|
+
V().filter(({ active: c }) => c).map(({ name: c }) => c)
|
|
261
|
+
);
|
|
262
|
+
S.reload({
|
|
263
|
+
...v,
|
|
264
|
+
...n,
|
|
265
|
+
data: {
|
|
266
|
+
[l.value.config.matches]: d(a)
|
|
267
|
+
}
|
|
268
|
+
});
|
|
217
269
|
}
|
|
218
|
-
function
|
|
270
|
+
function W(e, n = {}) {
|
|
271
|
+
L(e, void 0, n);
|
|
272
|
+
}
|
|
273
|
+
function B(e = {}) {
|
|
219
274
|
S.reload({
|
|
220
|
-
...
|
|
275
|
+
...v,
|
|
221
276
|
...e,
|
|
222
277
|
data: {
|
|
223
278
|
[l.value.config.sorts]: null
|
|
224
279
|
}
|
|
225
280
|
});
|
|
226
281
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
282
|
+
function H(e = {}) {
|
|
283
|
+
G(void 0, e);
|
|
229
284
|
}
|
|
230
|
-
function
|
|
285
|
+
function t(e = {}) {
|
|
286
|
+
if (!l.value.config.matches) {
|
|
287
|
+
console.warn("Matches key is not set.");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
231
290
|
S.reload({
|
|
232
|
-
...
|
|
291
|
+
...v,
|
|
292
|
+
...e,
|
|
293
|
+
data: {
|
|
294
|
+
[l.value.config.matches]: null
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function r(e = {}) {
|
|
299
|
+
var n;
|
|
300
|
+
S.reload({
|
|
301
|
+
...v,
|
|
233
302
|
...e,
|
|
234
303
|
data: {
|
|
235
304
|
[l.value.config.searches]: void 0,
|
|
236
305
|
[l.value.config.sorts]: void 0,
|
|
237
306
|
...Object.fromEntries(
|
|
238
|
-
l.value.filters.map((
|
|
307
|
+
((n = l.value.filters) == null ? void 0 : n.map((a) => [
|
|
308
|
+
a.name,
|
|
309
|
+
void 0
|
|
310
|
+
])) ?? []
|
|
239
311
|
),
|
|
240
312
|
...l.value.config.matches ? { [l.value.config.matches]: void 0 } : {}
|
|
241
313
|
}
|
|
242
314
|
});
|
|
243
315
|
}
|
|
244
|
-
function
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
316
|
+
function g(e, n = {}) {
|
|
317
|
+
const a = typeof e == "string" ? m(e) : e;
|
|
318
|
+
if (!a) {
|
|
247
319
|
console.warn(`Filter [${e}] does not exist.`);
|
|
248
320
|
return;
|
|
249
321
|
}
|
|
250
|
-
const c =
|
|
251
|
-
debounce:
|
|
252
|
-
transform:
|
|
253
|
-
...
|
|
322
|
+
const c = a.value, {
|
|
323
|
+
debounce: F = 250,
|
|
324
|
+
transform: R = (I) => I,
|
|
325
|
+
...j
|
|
254
326
|
} = n;
|
|
255
327
|
return {
|
|
256
|
-
"onUpdate:modelValue":
|
|
257
|
-
|
|
258
|
-
},
|
|
328
|
+
"onUpdate:modelValue": D((I) => {
|
|
329
|
+
L(a, R(I), j);
|
|
330
|
+
}, F),
|
|
259
331
|
modelValue: c,
|
|
260
332
|
value: c
|
|
261
333
|
};
|
|
262
334
|
}
|
|
263
|
-
function
|
|
264
|
-
const
|
|
265
|
-
if (!
|
|
335
|
+
function P(e, n = {}) {
|
|
336
|
+
const a = typeof e == "string" ? T(e) : e;
|
|
337
|
+
if (!a) {
|
|
266
338
|
console.warn(`Sort [${e}] does not exist.`);
|
|
267
339
|
return;
|
|
268
340
|
}
|
|
269
|
-
const { debounce: c = 0, transform:
|
|
341
|
+
const { debounce: c = 0, transform: F, ...R } = n;
|
|
270
342
|
return {
|
|
271
|
-
onClick:
|
|
272
|
-
var
|
|
273
|
-
|
|
343
|
+
onClick: D(() => {
|
|
344
|
+
var j;
|
|
345
|
+
M(a, (j = p()) == null ? void 0 : j.direction, R);
|
|
274
346
|
}, c)
|
|
275
347
|
};
|
|
276
348
|
}
|
|
277
|
-
function
|
|
278
|
-
const { debounce: n = 700, transform:
|
|
349
|
+
function $(e = {}) {
|
|
350
|
+
const { debounce: n = 700, transform: a, ...c } = e;
|
|
279
351
|
return {
|
|
280
|
-
"onUpdate:modelValue":
|
|
281
|
-
F
|
|
352
|
+
"onUpdate:modelValue": D((F) => {
|
|
353
|
+
G(F, c);
|
|
282
354
|
}, n),
|
|
283
355
|
modelValue: l.value.config.search ?? ""
|
|
284
356
|
};
|
|
285
357
|
}
|
|
358
|
+
function K(e, n = {}) {
|
|
359
|
+
const a = typeof e == "string" ? C(e) : e;
|
|
360
|
+
if (!a) {
|
|
361
|
+
console.warn(`Match [${e}] does not exist.`);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const { debounce: c = 0, transform: F, ...R } = n;
|
|
365
|
+
return {
|
|
366
|
+
"onUpdate:modelValue": D((j) => {
|
|
367
|
+
U(j, R);
|
|
368
|
+
}, c),
|
|
369
|
+
modelValue: E(a)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
286
372
|
return {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
getSort:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
currentSort:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
isSorting:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
applyFilter:
|
|
301
|
-
applySort:
|
|
302
|
-
applySearch:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
373
|
+
filters: i,
|
|
374
|
+
sorts: u,
|
|
375
|
+
searches: b,
|
|
376
|
+
getFilter: m,
|
|
377
|
+
getSort: T,
|
|
378
|
+
getSearch: C,
|
|
379
|
+
currentFilters: z,
|
|
380
|
+
currentSort: p,
|
|
381
|
+
currentSearches: V,
|
|
382
|
+
isFiltering: y,
|
|
383
|
+
isSorting: w,
|
|
384
|
+
isSearching: E,
|
|
385
|
+
apply: q,
|
|
386
|
+
applyFilter: L,
|
|
387
|
+
applySort: M,
|
|
388
|
+
applySearch: G,
|
|
389
|
+
applyMatch: U,
|
|
390
|
+
clearFilter: W,
|
|
391
|
+
clearSort: B,
|
|
392
|
+
clearSearch: H,
|
|
393
|
+
clearMatch: t,
|
|
394
|
+
reset: r,
|
|
395
|
+
bindFilter: g,
|
|
396
|
+
bindSort: P,
|
|
397
|
+
bindSearch: $,
|
|
398
|
+
bindMatch: K,
|
|
399
|
+
stringValue: A,
|
|
400
|
+
omitValue: x,
|
|
401
|
+
toggleValue: s,
|
|
402
|
+
delimitArray: d
|
|
316
403
|
};
|
|
317
404
|
}
|
|
318
|
-
function
|
|
405
|
+
function le(o, f, v = {}, l = {}) {
|
|
319
406
|
l = {
|
|
320
407
|
...l,
|
|
321
|
-
only: [...l.only ?? [],
|
|
408
|
+
only: [...l.only ?? [], f.toString()]
|
|
322
409
|
};
|
|
323
|
-
const
|
|
324
|
-
() =>
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
410
|
+
const i = h(() => o[f]), u = X(), b = ee(o, f, l), d = h(() => i.value.config), A = h(() => i.value.meta), x = h(
|
|
411
|
+
() => {
|
|
412
|
+
var t;
|
|
413
|
+
return ((t = i.value.columns) == null ? void 0 : t.filter(({ active: r, hidden: g }) => r && !g).map((r) => {
|
|
414
|
+
var g;
|
|
415
|
+
return {
|
|
416
|
+
...r,
|
|
417
|
+
isSorting: (g = r.sort) == null ? void 0 : g.active,
|
|
418
|
+
toggleSort: (P = {}) => G(r, P)
|
|
419
|
+
};
|
|
420
|
+
})) ?? [];
|
|
421
|
+
}
|
|
422
|
+
), k = h(
|
|
423
|
+
() => {
|
|
424
|
+
var t;
|
|
425
|
+
return ((t = i.value.columns) == null ? void 0 : t.filter(({ hidden: r }) => !r).map((r) => ({
|
|
426
|
+
...r,
|
|
427
|
+
toggle: (g = {}) => U(r, g)
|
|
428
|
+
}))) ?? [];
|
|
429
|
+
}
|
|
430
|
+
), s = h(
|
|
431
|
+
() => i.value.records.map((t) => ({
|
|
335
432
|
...t,
|
|
336
433
|
/** Perform this action when the record is clicked */
|
|
337
|
-
default: (
|
|
338
|
-
const
|
|
339
|
-
(
|
|
434
|
+
default: (r = {}) => {
|
|
435
|
+
const g = t.actions.find(
|
|
436
|
+
(P) => P.default
|
|
340
437
|
);
|
|
341
|
-
|
|
438
|
+
g && E(g, t, r);
|
|
342
439
|
},
|
|
343
440
|
/** The actions available for the record */
|
|
344
|
-
actions: t.actions.map((
|
|
345
|
-
...
|
|
441
|
+
actions: t.actions.map((r) => ({
|
|
442
|
+
...r,
|
|
346
443
|
/** Executes this action */
|
|
347
|
-
execute: (
|
|
444
|
+
execute: (g = {}) => E(r, t, g)
|
|
348
445
|
})),
|
|
349
446
|
/** Selects this record */
|
|
350
|
-
select: () =>
|
|
447
|
+
select: () => u.select(y(t)),
|
|
351
448
|
/** Deselects this record */
|
|
352
|
-
deselect: () =>
|
|
449
|
+
deselect: () => u.deselect(y(t)),
|
|
353
450
|
/** Toggles the selection of this record */
|
|
354
|
-
toggle: () =>
|
|
451
|
+
toggle: () => u.toggle(y(t)),
|
|
355
452
|
/** Determine if the record is selected */
|
|
356
|
-
selected:
|
|
453
|
+
selected: u.selected(y(t)),
|
|
357
454
|
/** Bind the record to a checkbox */
|
|
358
|
-
bind: () =>
|
|
455
|
+
bind: () => u.bind(y(t))
|
|
359
456
|
}))
|
|
360
|
-
),
|
|
361
|
-
() =>
|
|
457
|
+
), m = h(
|
|
458
|
+
() => i.value.actions.bulk.map((t) => ({
|
|
362
459
|
...t,
|
|
363
460
|
/** Executes this bulk action */
|
|
364
|
-
execute: (
|
|
461
|
+
execute: (r = {}) => q(t, r)
|
|
365
462
|
}))
|
|
366
|
-
),
|
|
367
|
-
() =>
|
|
463
|
+
), T = h(
|
|
464
|
+
() => i.value.actions.page.map((t) => ({
|
|
368
465
|
...t,
|
|
369
466
|
/** Executes this page action */
|
|
370
|
-
execute: (
|
|
467
|
+
execute: (r = {}) => L(t, r)
|
|
371
468
|
}))
|
|
372
|
-
),
|
|
373
|
-
() =>
|
|
469
|
+
), C = h(
|
|
470
|
+
() => i.value.recordsPerPage.map((t) => ({
|
|
374
471
|
...t,
|
|
375
472
|
/** Changes the number of records to display per page */
|
|
376
|
-
apply: (
|
|
473
|
+
apply: (r = {}) => M(t, r)
|
|
377
474
|
}))
|
|
378
|
-
),
|
|
379
|
-
() =>
|
|
380
|
-
),
|
|
381
|
-
...
|
|
475
|
+
), z = h(
|
|
476
|
+
() => i.value.recordsPerPage.find(({ active: t }) => t)
|
|
477
|
+
), p = h(() => ({
|
|
478
|
+
...i.value.paginator,
|
|
382
479
|
next: (t = {}) => {
|
|
383
|
-
"nextLink" in
|
|
480
|
+
"nextLink" in p.value && p.value.nextLink && w(p.value.nextLink, t);
|
|
384
481
|
},
|
|
385
482
|
previous: (t = {}) => {
|
|
386
|
-
"prevLink" in
|
|
483
|
+
"prevLink" in p.value && p.value.prevLink && w(p.value.prevLink, t);
|
|
387
484
|
},
|
|
388
485
|
first: (t = {}) => {
|
|
389
|
-
"firstLink" in
|
|
486
|
+
"firstLink" in p.value && p.value.firstLink && w(p.value.firstLink, t);
|
|
390
487
|
},
|
|
391
488
|
last: (t = {}) => {
|
|
392
|
-
"lastLink" in
|
|
489
|
+
"lastLink" in p.value && p.value.lastLink && w(p.value.lastLink, t);
|
|
393
490
|
},
|
|
394
|
-
..."links" in
|
|
395
|
-
links:
|
|
491
|
+
..."links" in i.value.paginator && i.value.paginator.links ? {
|
|
492
|
+
links: i.value.paginator.links.map((t) => ({
|
|
396
493
|
...t,
|
|
397
|
-
navigate: (
|
|
494
|
+
navigate: (r = {}) => t.url && w(t.url, r)
|
|
398
495
|
}))
|
|
399
496
|
} : {}
|
|
400
|
-
})),
|
|
401
|
-
() =>
|
|
402
|
-
(t) =>
|
|
497
|
+
})), V = h(
|
|
498
|
+
() => i.value.records.length > 0 && i.value.records.every(
|
|
499
|
+
(t) => u.selected(y(t))
|
|
403
500
|
)
|
|
404
501
|
);
|
|
405
|
-
function
|
|
406
|
-
return t[
|
|
502
|
+
function y(t) {
|
|
503
|
+
return t[d.value.record];
|
|
407
504
|
}
|
|
408
|
-
function
|
|
505
|
+
function w(t, r = {}) {
|
|
409
506
|
S.visit(t, {
|
|
410
|
-
|
|
411
|
-
...e,
|
|
507
|
+
preserveScroll: !0,
|
|
412
508
|
preserveState: !0,
|
|
509
|
+
...l,
|
|
510
|
+
...r,
|
|
413
511
|
method: "get"
|
|
414
512
|
});
|
|
415
513
|
}
|
|
416
|
-
function
|
|
417
|
-
var
|
|
418
|
-
|
|
514
|
+
function E(t, r, g = {}) {
|
|
515
|
+
var $, K;
|
|
516
|
+
J(
|
|
419
517
|
t,
|
|
420
|
-
|
|
518
|
+
d.value.endpoint,
|
|
421
519
|
{
|
|
422
|
-
table:
|
|
423
|
-
id:
|
|
520
|
+
table: i.value.id,
|
|
521
|
+
id: y(r)
|
|
424
522
|
},
|
|
425
|
-
|
|
426
|
-
) || (
|
|
523
|
+
g
|
|
524
|
+
) || (K = ($ = v.recordActions) == null ? void 0 : $[t.name]) == null || K.call($, r);
|
|
427
525
|
}
|
|
428
|
-
function
|
|
429
|
-
|
|
526
|
+
function q(t, r = {}) {
|
|
527
|
+
J(
|
|
430
528
|
t,
|
|
431
|
-
|
|
529
|
+
d.value.endpoint,
|
|
432
530
|
{
|
|
433
|
-
table:
|
|
434
|
-
all:
|
|
435
|
-
only: Array.from(
|
|
436
|
-
except: Array.from(
|
|
531
|
+
table: i.value.id,
|
|
532
|
+
all: u.selection.value.all,
|
|
533
|
+
only: Array.from(u.selection.value.only),
|
|
534
|
+
except: Array.from(u.selection.value.except)
|
|
437
535
|
},
|
|
438
|
-
|
|
536
|
+
r
|
|
439
537
|
);
|
|
440
538
|
}
|
|
441
|
-
function
|
|
442
|
-
|
|
539
|
+
function L(t, r = {}) {
|
|
540
|
+
J(
|
|
443
541
|
t,
|
|
444
|
-
|
|
542
|
+
d.value.endpoint,
|
|
445
543
|
{
|
|
446
|
-
table:
|
|
544
|
+
table: i.value.id
|
|
447
545
|
},
|
|
448
|
-
|
|
546
|
+
r
|
|
449
547
|
);
|
|
450
548
|
}
|
|
451
|
-
function
|
|
549
|
+
function M(t, r = {}) {
|
|
452
550
|
S.reload({
|
|
453
551
|
...l,
|
|
454
|
-
...
|
|
552
|
+
...r,
|
|
455
553
|
data: {
|
|
456
|
-
[
|
|
457
|
-
[
|
|
554
|
+
[d.value.records]: t.value,
|
|
555
|
+
[d.value.pages]: void 0
|
|
458
556
|
}
|
|
459
557
|
});
|
|
460
558
|
}
|
|
461
|
-
function
|
|
559
|
+
function G(t, r = {}) {
|
|
462
560
|
t.sort && S.reload({
|
|
463
561
|
...l,
|
|
464
|
-
...
|
|
562
|
+
...r,
|
|
465
563
|
data: {
|
|
466
|
-
[
|
|
564
|
+
[d.value.sorts]: b.omitValue(t.sort.next)
|
|
467
565
|
}
|
|
468
566
|
});
|
|
469
567
|
}
|
|
470
|
-
function
|
|
471
|
-
const
|
|
568
|
+
function U(t, r = {}) {
|
|
569
|
+
const g = b.toggleValue(
|
|
472
570
|
t.name,
|
|
473
|
-
|
|
571
|
+
x.value.map(({ name: P }) => P)
|
|
474
572
|
);
|
|
475
573
|
S.reload({
|
|
476
574
|
...l,
|
|
477
|
-
...
|
|
575
|
+
...r,
|
|
478
576
|
data: {
|
|
479
|
-
[
|
|
577
|
+
[d.value.columns]: b.delimitArray(g)
|
|
480
578
|
}
|
|
481
579
|
});
|
|
482
580
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
485
|
-
...
|
|
581
|
+
function W() {
|
|
582
|
+
u.select(
|
|
583
|
+
...i.value.records.map((t) => y(t))
|
|
486
584
|
);
|
|
487
585
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
490
|
-
...
|
|
586
|
+
function B() {
|
|
587
|
+
u.deselect(
|
|
588
|
+
...i.value.records.map((t) => y(t))
|
|
491
589
|
);
|
|
492
590
|
}
|
|
493
|
-
function
|
|
591
|
+
function H() {
|
|
494
592
|
return {
|
|
495
593
|
"onUpdate:modelValue": (t) => {
|
|
496
|
-
t ?
|
|
594
|
+
t ? W() : B();
|
|
497
595
|
},
|
|
498
|
-
modelValue:
|
|
596
|
+
modelValue: V.value
|
|
499
597
|
};
|
|
500
598
|
}
|
|
501
|
-
return
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
599
|
+
return Q({
|
|
600
|
+
/** Retrieve a record's identifier */
|
|
601
|
+
getRecordKey: y,
|
|
602
|
+
/** Table-specific metadata */
|
|
603
|
+
meta: A,
|
|
604
|
+
/** The heading columns for the table */
|
|
605
|
+
headings: x,
|
|
606
|
+
/** All of the table's columns */
|
|
607
|
+
columns: k,
|
|
608
|
+
/** The records of the table */
|
|
609
|
+
records: s,
|
|
610
|
+
/** The available bulk actions */
|
|
611
|
+
bulkActions: m,
|
|
612
|
+
/** The available page actions */
|
|
613
|
+
pageActions: T,
|
|
614
|
+
/** The available number of records to display per page */
|
|
615
|
+
rowsPerPage: C,
|
|
616
|
+
/** The current record per page item */
|
|
617
|
+
currentPage: z,
|
|
618
|
+
/** The pagination metadata */
|
|
619
|
+
paginator: p,
|
|
620
|
+
/** Execute an inline action */
|
|
621
|
+
executeInlineAction: E,
|
|
622
|
+
/** Execute a bulk action */
|
|
623
|
+
executeBulkAction: q,
|
|
624
|
+
/** Execute a page action */
|
|
625
|
+
executePageAction: L,
|
|
626
|
+
/** Apply a new page by changing the number of records to display */
|
|
627
|
+
applyPage: M,
|
|
513
628
|
/** The current selection of records */
|
|
514
|
-
selection:
|
|
629
|
+
selection: u.selection,
|
|
515
630
|
/** Select the given records */
|
|
516
|
-
select: (t) =>
|
|
631
|
+
select: (t) => u.select(y(t)),
|
|
517
632
|
/** Deselect the given records */
|
|
518
|
-
deselect: (t) =>
|
|
633
|
+
deselect: (t) => u.deselect(y(t)),
|
|
634
|
+
/** Select records on the current page */
|
|
635
|
+
selectPage: W,
|
|
636
|
+
/** Deselect records on the current page */
|
|
637
|
+
deselectPage: B,
|
|
519
638
|
/** Toggle the selection of the given records */
|
|
520
|
-
toggle: (t) =>
|
|
639
|
+
toggle: (t) => u.toggle(y(t)),
|
|
521
640
|
/** Determine if the given record is selected */
|
|
522
|
-
selected: (t) =>
|
|
641
|
+
selected: (t) => u.selected(y(t)),
|
|
642
|
+
/** Select all records */
|
|
643
|
+
selectAll: u.selectAll,
|
|
644
|
+
/** Deselect all records */
|
|
645
|
+
deselectAll: u.deselectAll,
|
|
646
|
+
/** Whether all records on the current page are selected */
|
|
647
|
+
isPageSelected: V,
|
|
523
648
|
/** Determine if any records are selected */
|
|
524
|
-
hasSelected:
|
|
525
|
-
/** Bind the select all checkbox to the current page */
|
|
526
|
-
bindPage: z,
|
|
649
|
+
hasSelected: u.hasSelected,
|
|
527
650
|
/** Bind the given record to a checkbox */
|
|
528
|
-
|
|
651
|
+
bindCheckbox: (t) => u.bind(y(t)),
|
|
652
|
+
/** Bind the select all checkbox to the current page */
|
|
653
|
+
bindPage: H,
|
|
654
|
+
/** Bind select all records to the checkbox */
|
|
655
|
+
bindAll: u.bindAll,
|
|
529
656
|
/** Include the sorts, filters, and search query */
|
|
530
|
-
...
|
|
657
|
+
...b
|
|
531
658
|
});
|
|
532
659
|
}
|
|
533
660
|
export {
|
|
534
|
-
|
|
661
|
+
le as useTable
|
|
535
662
|
};
|