@honed/table 0.8.0 → 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 +80 -118
- package/dist/index.es.js +397 -405
- package/dist/index.umd.js +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,685 +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
|
-
...f
|
|
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
|
|
158
|
+
function M(e) {
|
|
159
|
+
return Array.isArray(e) ? e.join(a.value.delimiter) : e;
|
|
161
160
|
}
|
|
162
|
-
|
|
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
|
-
), R = p(
|
|
170
|
-
() => x(l.value.searches)
|
|
171
|
-
);
|
|
172
|
-
function U(e) {
|
|
173
|
-
return Array.isArray(e) ? e.join(l.value.delimiter) : e;
|
|
174
|
-
}
|
|
175
|
-
function C(e) {
|
|
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 (!f.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 {
|
|
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: (
|
|
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
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
423
|
+
), M = d(
|
|
424
|
+
() => o.value.records.map((t) => ({
|
|
425
|
+
/** The operations available for the record */
|
|
426
|
+
operations: P(t.operations),
|
|
427
|
+
/** Perform this operation when the record is clicked */
|
|
428
|
+
default: (u = {}) => {
|
|
429
|
+
const f = t.operations.find(
|
|
430
|
+
({ default: e }) => e
|
|
431
|
+
);
|
|
432
|
+
f && j(f, t, u);
|
|
449
433
|
},
|
|
450
434
|
/** Selects this record */
|
|
451
|
-
select: () =>
|
|
435
|
+
select: () => i.select(b(t)),
|
|
452
436
|
/** Deselects this record */
|
|
453
|
-
deselect: () =>
|
|
437
|
+
deselect: () => i.deselect(b(t)),
|
|
454
438
|
/** Toggles the selection of this record */
|
|
455
|
-
toggle: () =>
|
|
439
|
+
toggle: () => i.toggle(b(t)),
|
|
456
440
|
/** Determine if the record is selected */
|
|
457
|
-
selected:
|
|
441
|
+
selected: i.selected(b(t)),
|
|
458
442
|
/** Bind the record to a checkbox */
|
|
459
|
-
bind: () =>
|
|
443
|
+
bind: () => i.bind(b(t)),
|
|
444
|
+
/** Get the entry of the record for the column */
|
|
445
|
+
entry: (u) => F(t, u),
|
|
460
446
|
/** Get the value of the record for the column */
|
|
461
|
-
value: (
|
|
462
|
-
|
|
463
|
-
return
|
|
447
|
+
value: (u) => {
|
|
448
|
+
var f;
|
|
449
|
+
return ((f = F(t, u)) == null ? void 0 : f.v) ?? null;
|
|
464
450
|
},
|
|
465
451
|
/** Get the extra data of the record for the column */
|
|
466
|
-
extra: (
|
|
467
|
-
|
|
468
|
-
return
|
|
452
|
+
extra: (u) => {
|
|
453
|
+
var f;
|
|
454
|
+
return ((f = F(t, u)) == null ? void 0 : f.e) ?? null;
|
|
469
455
|
}
|
|
470
456
|
}))
|
|
471
|
-
), R =
|
|
472
|
-
() => o.value.pages.find(({ active:
|
|
473
|
-
),
|
|
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(() => ({
|
|
474
460
|
...o.value.paginate,
|
|
475
|
-
next: (
|
|
476
|
-
"nextLink" in
|
|
461
|
+
next: (t = {}) => {
|
|
462
|
+
"nextLink" in y.value && y.value.nextLink && A(y.value.nextLink, t);
|
|
477
463
|
},
|
|
478
|
-
previous: (
|
|
479
|
-
"prevLink" in
|
|
464
|
+
previous: (t = {}) => {
|
|
465
|
+
"prevLink" in y.value && y.value.prevLink && A(y.value.prevLink, t);
|
|
480
466
|
},
|
|
481
|
-
first: (
|
|
482
|
-
"firstLink" in
|
|
467
|
+
first: (t = {}) => {
|
|
468
|
+
"firstLink" in y.value && y.value.firstLink && A(y.value.firstLink, t);
|
|
483
469
|
},
|
|
484
|
-
last: (
|
|
485
|
-
"lastLink" in
|
|
470
|
+
last: (t = {}) => {
|
|
471
|
+
"lastLink" in y.value && y.value.lastLink && A(y.value.lastLink, t);
|
|
486
472
|
},
|
|
487
473
|
..."links" in o.value.paginate && o.value.paginate.links ? {
|
|
488
|
-
links: o.value.paginate.links.map((
|
|
489
|
-
...
|
|
490
|
-
navigate: (
|
|
474
|
+
links: o.value.paginate.links.map((t) => ({
|
|
475
|
+
...t,
|
|
476
|
+
navigate: (u = {}) => t.url && A(t.url, u)
|
|
491
477
|
}))
|
|
492
478
|
} : {}
|
|
493
|
-
})),
|
|
479
|
+
})), T = d(
|
|
494
480
|
() => o.value.records.length > 0 && o.value.records.every(
|
|
495
|
-
(
|
|
481
|
+
(t) => i.selected(b(t))
|
|
496
482
|
)
|
|
497
483
|
);
|
|
498
|
-
function
|
|
499
|
-
return
|
|
484
|
+
function b(t) {
|
|
485
|
+
return t[o.value.key].v;
|
|
486
|
+
}
|
|
487
|
+
function G(t) {
|
|
488
|
+
return typeof t == "string" ? t : t.name;
|
|
500
489
|
}
|
|
501
|
-
function
|
|
502
|
-
|
|
490
|
+
function F(t, u) {
|
|
491
|
+
const f = G(u);
|
|
492
|
+
return f in t ? t[f] : null;
|
|
503
493
|
}
|
|
504
|
-
function
|
|
505
|
-
return
|
|
506
|
-
|
|
494
|
+
function C(t, u = {}, f = {}) {
|
|
495
|
+
return X(
|
|
496
|
+
t,
|
|
507
497
|
o.value.endpoint,
|
|
508
498
|
o.value.id,
|
|
509
|
-
|
|
499
|
+
u,
|
|
510
500
|
{
|
|
511
|
-
...
|
|
512
|
-
...
|
|
501
|
+
...m,
|
|
502
|
+
...f
|
|
513
503
|
}
|
|
514
504
|
);
|
|
515
505
|
}
|
|
516
|
-
function
|
|
517
|
-
return
|
|
518
|
-
|
|
506
|
+
function P(t) {
|
|
507
|
+
return ee(
|
|
508
|
+
t,
|
|
519
509
|
o.value.endpoint,
|
|
520
510
|
o.value.id,
|
|
521
|
-
|
|
511
|
+
m
|
|
522
512
|
);
|
|
523
513
|
}
|
|
524
|
-
function
|
|
525
|
-
S.visit(
|
|
514
|
+
function A(t, u = {}) {
|
|
515
|
+
S.visit(t, {
|
|
526
516
|
preserveScroll: !0,
|
|
527
517
|
preserveState: !0,
|
|
528
|
-
...
|
|
529
|
-
...
|
|
518
|
+
...m,
|
|
519
|
+
...u,
|
|
530
520
|
method: "get"
|
|
531
521
|
});
|
|
532
522
|
}
|
|
533
|
-
function
|
|
534
|
-
var
|
|
535
|
-
|
|
536
|
-
|
|
523
|
+
function j(t, u, f = {}) {
|
|
524
|
+
var n;
|
|
525
|
+
C(
|
|
526
|
+
t,
|
|
537
527
|
{
|
|
538
|
-
record:
|
|
528
|
+
record: b(u)
|
|
539
529
|
},
|
|
540
|
-
|
|
541
|
-
) || (
|
|
530
|
+
f
|
|
531
|
+
) || (n = a == null ? void 0 : a[t.name]) == null || n.call(a, u);
|
|
542
532
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
|
|
533
|
+
function $(t, u = {}) {
|
|
534
|
+
C(
|
|
535
|
+
t,
|
|
546
536
|
{
|
|
547
|
-
all:
|
|
548
|
-
only: Array.from(
|
|
549
|
-
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)
|
|
550
540
|
},
|
|
551
541
|
{
|
|
552
|
-
...
|
|
553
|
-
onSuccess: (
|
|
554
|
-
var
|
|
555
|
-
(
|
|
542
|
+
...u,
|
|
543
|
+
onSuccess: (f) => {
|
|
544
|
+
var e;
|
|
545
|
+
(e = u.onSuccess) == null || e.call(u, f), t.keepSelected || i.deselectAll();
|
|
556
546
|
}
|
|
557
547
|
}
|
|
558
548
|
);
|
|
559
549
|
}
|
|
560
|
-
function
|
|
561
|
-
return
|
|
550
|
+
function B(t, u = {}, f = {}) {
|
|
551
|
+
return C(t, u, f);
|
|
562
552
|
}
|
|
563
|
-
function
|
|
564
|
-
if (!
|
|
553
|
+
function I(t, u = {}) {
|
|
554
|
+
if (!x.value)
|
|
565
555
|
return console.warn("The table does not support pagination changes.");
|
|
566
556
|
S.reload({
|
|
567
|
-
...
|
|
568
|
-
...
|
|
557
|
+
...m,
|
|
558
|
+
...u,
|
|
569
559
|
data: {
|
|
570
|
-
[o.value.record]:
|
|
560
|
+
[o.value.record]: t.value,
|
|
571
561
|
[o.value.page]: void 0
|
|
572
562
|
}
|
|
573
563
|
});
|
|
574
564
|
}
|
|
575
|
-
function
|
|
565
|
+
function H(t, u = {}) {
|
|
576
566
|
if (!w.value)
|
|
577
567
|
return console.warn("The table does not support column toggling.");
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
568
|
+
const f = G(t);
|
|
569
|
+
if (!f) return console.log(`Column [${t}] does not exist.`);
|
|
570
|
+
const e = g.toggleValue(
|
|
571
|
+
f,
|
|
572
|
+
s.value.map(({ name: n }) => n)
|
|
583
573
|
);
|
|
584
574
|
S.reload({
|
|
585
|
-
...
|
|
586
|
-
...
|
|
575
|
+
...m,
|
|
576
|
+
...u,
|
|
587
577
|
data: {
|
|
588
|
-
[o.value.column]:
|
|
578
|
+
[o.value.column]: g.delimitArray(e)
|
|
589
579
|
}
|
|
590
580
|
});
|
|
591
581
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
582
|
+
function K() {
|
|
583
|
+
i.select(
|
|
594
584
|
...o.value.records.map(
|
|
595
|
-
(
|
|
585
|
+
(t) => b(t)
|
|
596
586
|
)
|
|
597
587
|
);
|
|
598
588
|
}
|
|
599
|
-
function
|
|
600
|
-
|
|
589
|
+
function N() {
|
|
590
|
+
i.deselect(
|
|
601
591
|
...o.value.records.map(
|
|
602
|
-
(
|
|
592
|
+
(t) => b(t)
|
|
603
593
|
)
|
|
604
594
|
);
|
|
605
595
|
}
|
|
606
|
-
function
|
|
596
|
+
function q() {
|
|
607
597
|
return {
|
|
608
|
-
"onUpdate:modelValue": (
|
|
609
|
-
|
|
598
|
+
"onUpdate:modelValue": (t) => {
|
|
599
|
+
t ? K() : N();
|
|
610
600
|
},
|
|
611
|
-
modelValue:
|
|
601
|
+
modelValue: T.value
|
|
612
602
|
};
|
|
613
603
|
}
|
|
614
604
|
return Z({
|
|
615
|
-
/** The table's configuration */
|
|
616
|
-
table: o,
|
|
617
|
-
/** Retrieve a record's identifier */
|
|
618
|
-
getRecordKey: y,
|
|
619
605
|
/** Table-specific metadata */
|
|
620
|
-
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,
|
|
621
613
|
/** The heading columns for the table */
|
|
622
|
-
headings:
|
|
614
|
+
headings: s,
|
|
623
615
|
/** All of the table's columns */
|
|
624
|
-
columns:
|
|
616
|
+
columns: h,
|
|
625
617
|
/** The records of the table */
|
|
626
|
-
records:
|
|
627
|
-
/** Whether the table has record
|
|
628
|
-
inline:
|
|
629
|
-
/** The available bulk
|
|
630
|
-
bulk:
|
|
631
|
-
/** The available page
|
|
632
|
-
page:
|
|
618
|
+
records: M,
|
|
619
|
+
/** Whether the table has record operations */
|
|
620
|
+
inline: R,
|
|
621
|
+
/** The available bulk operations */
|
|
622
|
+
bulk: E,
|
|
623
|
+
/** The available page operations */
|
|
624
|
+
page: W,
|
|
633
625
|
/** The available number of records to display per page */
|
|
634
|
-
pages:
|
|
626
|
+
pages: U,
|
|
635
627
|
/** The current record per page item */
|
|
636
|
-
currentPage:
|
|
628
|
+
currentPage: z,
|
|
637
629
|
/** The pagination metadata */
|
|
638
|
-
paginator:
|
|
639
|
-
/** Execute an inline
|
|
640
|
-
executeInline:
|
|
641
|
-
/** Execute a bulk
|
|
642
|
-
executeBulk:
|
|
643
|
-
/** Execute a page
|
|
644
|
-
executePage:
|
|
630
|
+
paginator: y,
|
|
631
|
+
/** Execute an inline operation */
|
|
632
|
+
executeInline: j,
|
|
633
|
+
/** Execute a bulk operation */
|
|
634
|
+
executeBulk: $,
|
|
635
|
+
/** Execute a page operation */
|
|
636
|
+
executePage: B,
|
|
645
637
|
/** Apply a new page by changing the number of records to display */
|
|
646
|
-
applyPage:
|
|
638
|
+
applyPage: I,
|
|
647
639
|
/** The current selection of records */
|
|
648
|
-
selection:
|
|
640
|
+
selection: i.selection,
|
|
649
641
|
/** Select the given records */
|
|
650
|
-
select: (
|
|
642
|
+
select: (t) => i.select(b(t)),
|
|
651
643
|
/** Deselect the given records */
|
|
652
|
-
deselect: (
|
|
644
|
+
deselect: (t) => i.deselect(b(t)),
|
|
653
645
|
/** Select records on the current page */
|
|
654
|
-
selectPage:
|
|
646
|
+
selectPage: K,
|
|
655
647
|
/** Deselect records on the current page */
|
|
656
|
-
deselectPage:
|
|
648
|
+
deselectPage: N,
|
|
657
649
|
/** Toggle the selection of the given records */
|
|
658
|
-
toggle: (
|
|
650
|
+
toggle: (t) => i.toggle(b(t)),
|
|
659
651
|
/** Determine if the given record is selected */
|
|
660
|
-
selected: (
|
|
652
|
+
selected: (t) => i.selected(b(t)),
|
|
661
653
|
/** Select all records */
|
|
662
|
-
selectAll:
|
|
654
|
+
selectAll: i.selectAll,
|
|
663
655
|
/** Deselect all records */
|
|
664
|
-
deselectAll:
|
|
656
|
+
deselectAll: i.deselectAll,
|
|
665
657
|
/** Whether all records on the current page are selected */
|
|
666
|
-
isPageSelected:
|
|
658
|
+
isPageSelected: T,
|
|
667
659
|
/** Determine if any records are selected */
|
|
668
|
-
hasSelected:
|
|
660
|
+
hasSelected: i.hasSelected,
|
|
669
661
|
/** Bind the given record to a checkbox */
|
|
670
|
-
bindCheckbox: (
|
|
662
|
+
bindCheckbox: (t) => i.bind(b(t)),
|
|
671
663
|
/** Bind the select all checkbox to the current page */
|
|
672
|
-
bindPage:
|
|
664
|
+
bindPage: q,
|
|
673
665
|
/** Bind select all records to the checkbox */
|
|
674
|
-
bindAll:
|
|
666
|
+
bindAll: i.bindAll,
|
|
675
667
|
/** Include the sorts, filters, and search query */
|
|
676
|
-
...
|
|
668
|
+
...g
|
|
677
669
|
});
|
|
678
670
|
}
|
|
679
|
-
function
|
|
680
|
-
return
|
|
671
|
+
function ie(l, v) {
|
|
672
|
+
return l ? typeof l == "object" ? l.type === v : l === v : !1;
|
|
681
673
|
}
|
|
682
674
|
export {
|
|
683
|
-
|
|
684
|
-
|
|
675
|
+
ie as is,
|
|
676
|
+
ue as useTable
|
|
685
677
|
};
|