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