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