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