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