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