@honed/table 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -145,9 +145,8 @@ export declare function useTable<Props extends object, Key extends Props[keyof P
145
145
  modelValue: unknown;
146
146
  } | undefined;
147
147
  type: string;
148
- value: FilterValue;
148
+ value: FilterValue; /** Determine if the record is selected */
149
149
  options: Option_2[];
150
- multiple: boolean;
151
150
  name: string;
152
151
  label: string;
153
152
  active: boolean;
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as _, computed as p, toValue as J, reactive as Q } from "vue";
1
+ import { ref as _, computed as g, toValue as J, reactive as Q } from "vue";
2
2
  import { router as x } from "@inertiajs/vue3";
3
3
  function X() {
4
4
  const o = _({
@@ -9,29 +9,29 @@ function X() {
9
9
  function m() {
10
10
  o.value.all = !0, o.value.only.clear(), o.value.except.clear();
11
11
  }
12
- function d() {
12
+ function v() {
13
13
  o.value.all = !1, o.value.only.clear(), o.value.except.clear();
14
14
  }
15
15
  function l(...c) {
16
- c.forEach((g) => o.value.except.delete(g)), c.forEach((g) => o.value.only.add(g));
16
+ c.forEach((p) => o.value.except.delete(p)), c.forEach((p) => o.value.only.add(p));
17
17
  }
18
18
  function i(...c) {
19
- c.forEach((g) => o.value.except.add(g)), c.forEach((g) => o.value.only.delete(g));
19
+ c.forEach((p) => o.value.except.add(p)), c.forEach((p) => o.value.only.delete(p));
20
20
  }
21
- function u(c, g) {
22
- if (b(c) || g === !1)
21
+ function u(c, p) {
22
+ if (b(c) || p === !1)
23
23
  return i(c);
24
- if (!b(c) || g === !0)
24
+ if (!b(c) || p === !0)
25
25
  return l(c);
26
26
  }
27
27
  function b(c) {
28
28
  return o.value.all ? !o.value.except.has(c) : o.value.only.has(c);
29
29
  }
30
- const f = p(() => o.value.all && o.value.except.size === 0), A = p(() => o.value.only.size > 0 || f.value);
30
+ const f = g(() => o.value.all && o.value.except.size === 0), A = g(() => o.value.only.size > 0 || f.value);
31
31
  function S(c) {
32
32
  return {
33
- "onUpdate:modelValue": (g) => {
34
- g ? l(c) : i(c);
33
+ "onUpdate:modelValue": (p) => {
34
+ p ? l(c) : i(c);
35
35
  },
36
36
  modelValue: b(c),
37
37
  value: c
@@ -40,7 +40,7 @@ function X() {
40
40
  function k() {
41
41
  return {
42
42
  "onUpdate:modelValue": (c) => {
43
- c ? m() : d();
43
+ c ? m() : v();
44
44
  },
45
45
  modelValue: f.value,
46
46
  value: f.value
@@ -51,7 +51,7 @@ function X() {
51
51
  selection: o,
52
52
  hasSelected: A,
53
53
  selectAll: m,
54
- deselectAll: d,
54
+ deselectAll: v,
55
55
  select: l,
56
56
  deselect: i,
57
57
  toggle: u,
@@ -60,14 +60,14 @@ function X() {
60
60
  bindAll: k
61
61
  };
62
62
  }
63
- function I(o, m, d = {}, l = {}) {
63
+ function I(o, m, v = {}, l = {}) {
64
64
  return o.route ? (x.visit(o.route.url, {
65
65
  ...l,
66
66
  method: o.route.method
67
67
  }), !0) : o.action && m ? (x.post(
68
68
  m,
69
69
  {
70
- ...d,
70
+ ...v,
71
71
  name: o.name,
72
72
  type: o.type
73
73
  },
@@ -78,58 +78,58 @@ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
78
78
  const Y = () => {
79
79
  };
80
80
  function Z(o, m) {
81
- function d(...l) {
81
+ function v(...l) {
82
82
  return new Promise((i, u) => {
83
83
  Promise.resolve(o(() => m.apply(this, l), { fn: m, thisArg: this, args: l })).then(i).catch(u);
84
84
  });
85
85
  }
86
- return d;
86
+ return v;
87
87
  }
88
88
  function O(o, m = {}) {
89
- let d, l, i = Y;
89
+ let v, l, i = Y;
90
90
  const u = (f) => {
91
91
  clearTimeout(f), i(), i = Y;
92
92
  };
93
93
  let b;
94
94
  return (f) => {
95
95
  const A = J(o), S = J(m.maxWait);
96
- return d && u(d), A <= 0 || S !== void 0 && S <= 0 ? (l && (u(l), l = null), Promise.resolve(f())) : new Promise((k, c) => {
96
+ return v && u(v), A <= 0 || S !== void 0 && S <= 0 ? (l && (u(l), l = null), Promise.resolve(f())) : new Promise((k, c) => {
97
97
  i = m.rejectOnCancel ? c : k, b = f, S && !l && (l = setTimeout(() => {
98
- d && u(d), l = null, k(b());
99
- }, S)), d = setTimeout(() => {
98
+ v && u(v), l = null, k(b());
99
+ }, S)), v = setTimeout(() => {
100
100
  l && u(l), l = null, k(f());
101
101
  }, A);
102
102
  });
103
103
  };
104
104
  }
105
- function q(o, m = 200, d = {}) {
105
+ function q(o, m = 200, v = {}) {
106
106
  return Z(
107
- O(m, d),
107
+ O(m, v),
108
108
  o
109
109
  );
110
110
  }
111
- function ee(o, m, d = {}) {
112
- const l = p(() => o[m]), i = p(
111
+ function ee(o, m, v = {}) {
112
+ const l = g(() => o[m]), i = g(
113
113
  () => {
114
114
  var e;
115
115
  return ((e = l.value.filters) == null ? void 0 : e.map((n) => ({
116
116
  ...n,
117
- apply: (r, v = {}) => L(n, r, v),
117
+ apply: (r, d = {}) => L(n, r, d),
118
118
  clear: (r = {}) => N(n, r),
119
119
  bind: () => a(n.name)
120
120
  }))) ?? [];
121
121
  }
122
- ), u = p(
122
+ ), u = g(
123
123
  () => {
124
124
  var e;
125
125
  return ((e = l.value.sorts) == null ? void 0 : e.map((n) => ({
126
126
  ...n,
127
127
  apply: (r = {}) => M(n, n.direction, r),
128
- clear: (r = {}) => G(r),
128
+ clear: (r = {}) => W(r),
129
129
  bind: () => s(n)
130
130
  }))) ?? [];
131
131
  }
132
- ), b = p(
132
+ ), b = g(
133
133
  () => {
134
134
  var e;
135
135
  return (e = l.value.searches) == null ? void 0 : e.map((n) => ({
@@ -139,17 +139,17 @@ function ee(o, m, d = {}) {
139
139
  bind: () => F(n)
140
140
  }));
141
141
  }
142
- ), f = p(
142
+ ), f = g(
143
143
  () => {
144
144
  var e;
145
145
  return ((e = l.value.filters) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
146
146
  }
147
- ), A = p(
147
+ ), A = g(
148
148
  () => {
149
149
  var e;
150
150
  return (e = l.value.sorts) == null ? void 0 : e.find(({ active: n }) => n);
151
151
  }
152
- ), S = p(
152
+ ), S = g(
153
153
  () => {
154
154
  var e;
155
155
  return ((e = l.value.searches) == null ? void 0 : e.filter(({ active: n }) => n)) ?? [];
@@ -161,27 +161,27 @@ function ee(o, m, d = {}) {
161
161
  function c(e) {
162
162
  return typeof e != "string" ? e : e.trim().replace(/\s+/g, "+");
163
163
  }
164
- function g(e) {
164
+ function p(e) {
165
165
  if (!["", null, void 0, []].includes(e))
166
166
  return e;
167
167
  }
168
- function B(e) {
169
- return [k, c, g].reduce(
168
+ function G(e) {
169
+ return [k, c, p].reduce(
170
170
  (n, r) => r(n),
171
171
  e
172
172
  );
173
173
  }
174
- function j(e, n) {
174
+ function B(e, n) {
175
175
  return n = Array.isArray(n) ? n : [n], n.includes(e) ? n.filter((r) => r !== e) : [...n, e];
176
176
  }
177
- function C(e) {
177
+ function j(e) {
178
178
  var n;
179
179
  return (n = l.value.filters) == null ? void 0 : n.find((r) => r.name === e);
180
180
  }
181
181
  function h(e, n = null) {
182
182
  var r;
183
183
  return (r = l.value.sorts) == null ? void 0 : r.find(
184
- (v) => v.name === e && v.direction === n
184
+ (d) => d.name === e && d.direction === n
185
185
  );
186
186
  }
187
187
  function E(e) {
@@ -195,54 +195,54 @@ function ee(o, m, d = {}) {
195
195
  var n;
196
196
  return e ? typeof e == "string" ? ((n = A.value) == null ? void 0 : n.name) === e : e.active : !!A.value;
197
197
  }
198
- function V(e) {
198
+ function P(e) {
199
199
  var n;
200
200
  return e ? typeof e == "string" ? (n = S.value) == null ? void 0 : n.some((r) => r.name === e) : e.active : !!l.value.config.term;
201
201
  }
202
- function z(e, n = {}) {
202
+ function C(e, n = {}) {
203
203
  const r = Object.fromEntries(
204
- Object.entries(e).map(([v, P]) => [v, B(P)])
204
+ Object.entries(e).map(([d, V]) => [d, G(V)])
205
205
  );
206
206
  x.reload({
207
- ...d,
207
+ ...v,
208
208
  ...n,
209
209
  data: r
210
210
  });
211
211
  }
212
212
  function L(e, n, r = {}) {
213
- const v = typeof e == "string" ? C(e) : e;
214
- if (!v) {
213
+ const d = typeof e == "string" ? j(e) : e;
214
+ if (!d) {
215
215
  console.warn(`Filter [${e}] does not exist.`);
216
216
  return;
217
217
  }
218
- "multiple" in v && v.multiple && n !== void 0 && (n = j(n, v.value)), x.reload({
219
- ...d,
218
+ x.reload({
219
+ ...v,
220
220
  ...r,
221
221
  data: {
222
- [v.name]: B(n)
222
+ [d.name]: G(n)
223
223
  }
224
224
  });
225
225
  }
226
226
  function M(e, n = null, r = {}) {
227
- const v = typeof e == "string" ? h(e, n) : e;
228
- if (!v) {
227
+ const d = typeof e == "string" ? h(e, n) : e;
228
+ if (!d) {
229
229
  console.warn(`Sort [${e}] does not exist.`);
230
230
  return;
231
231
  }
232
232
  x.reload({
233
- ...d,
233
+ ...v,
234
234
  ...r,
235
235
  data: {
236
- [l.value.config.sort]: g(v.next)
236
+ [l.value.config.sort]: p(d.next)
237
237
  }
238
238
  });
239
239
  }
240
240
  function T(e, n = {}) {
241
- e = [c, g].reduce(
242
- (r, v) => v(r),
241
+ e = [c, p].reduce(
242
+ (r, d) => d(r),
243
243
  e
244
244
  ), x.reload({
245
- ...d,
245
+ ...v,
246
246
  ...n,
247
247
  data: {
248
248
  [l.value.config.search]: e
@@ -255,24 +255,24 @@ function ee(o, m, d = {}) {
255
255
  console.warn(`Match [${e}] does not exist.`);
256
256
  return;
257
257
  }
258
- const v = j(
258
+ const d = B(
259
259
  r.name,
260
- S.value.map(({ name: P }) => P)
260
+ S.value.map(({ name: V }) => V)
261
261
  );
262
262
  x.reload({
263
- ...d,
263
+ ...v,
264
264
  ...n,
265
265
  data: {
266
- [l.value.config.match]: k(v)
266
+ [l.value.config.match]: k(d)
267
267
  }
268
268
  });
269
269
  }
270
270
  function N(e, n = {}) {
271
271
  L(e, void 0, n);
272
272
  }
273
- function G(e = {}) {
273
+ function W(e = {}) {
274
274
  x.reload({
275
- ...d,
275
+ ...v,
276
276
  ...e,
277
277
  data: {
278
278
  [l.value.config.sort]: void 0
@@ -288,7 +288,7 @@ function ee(o, m, d = {}) {
288
288
  return;
289
289
  }
290
290
  x.reload({
291
- ...d,
291
+ ...v,
292
292
  ...e,
293
293
  data: {
294
294
  [l.value.config.match]: void 0
@@ -298,7 +298,7 @@ function ee(o, m, d = {}) {
298
298
  function t(e = {}) {
299
299
  var n;
300
300
  x.reload({
301
- ...d,
301
+ ...v,
302
302
  ...e,
303
303
  data: {
304
304
  [l.value.config.search]: void 0,
@@ -314,21 +314,21 @@ function ee(o, m, d = {}) {
314
314
  });
315
315
  }
316
316
  function a(e, n = {}) {
317
- const r = typeof e == "string" ? C(e) : e;
317
+ const r = typeof e == "string" ? j(e) : e;
318
318
  if (!r) {
319
319
  console.warn(`Filter [${e}] does not exist.`);
320
320
  return;
321
321
  }
322
- const v = r.value, {
323
- debounce: P = 250,
324
- transform: W = (H) => H,
322
+ const d = r.value, {
323
+ debounce: V = 250,
324
+ transform: z = (H) => H,
325
325
  ...$
326
326
  } = n;
327
327
  return {
328
328
  "onUpdate:modelValue": q((H) => {
329
- L(r, W(H), $);
330
- }, P),
331
- modelValue: v
329
+ L(r, z(H), $);
330
+ }, V),
331
+ modelValue: d
332
332
  };
333
333
  }
334
334
  function s(e, n = {}) {
@@ -337,24 +337,24 @@ function ee(o, m, d = {}) {
337
337
  console.warn(`Sort [${e}] does not exist.`);
338
338
  return;
339
339
  }
340
- const { debounce: v = 0, transform: P, ...W } = n;
340
+ const { debounce: d = 0, transform: V, ...z } = n;
341
341
  return {
342
342
  onClick: q(() => {
343
343
  var $;
344
- M(r, ($ = A.value) == null ? void 0 : $.direction, W);
345
- }, v)
344
+ M(r, ($ = A.value) == null ? void 0 : $.direction, z);
345
+ }, d)
346
346
  };
347
347
  }
348
348
  function w(e = {}) {
349
- const { debounce: n = 700, transform: r, ...v } = e;
349
+ const { debounce: n = 700, transform: r, ...d } = e;
350
350
  return {
351
351
  "onUpdate:modelValue": q(
352
- (P) => {
353
- T(P, v);
352
+ (V) => {
353
+ T(V, d);
354
354
  },
355
355
  n
356
356
  ),
357
- modelValue: l.value.config.search ?? ""
357
+ modelValue: l.value.config.term ?? ""
358
358
  };
359
359
  }
360
360
  function F(e, n = {}) {
@@ -363,12 +363,12 @@ function ee(o, m, d = {}) {
363
363
  console.warn(`Match [${e}] does not exist.`);
364
364
  return;
365
365
  }
366
- const { debounce: v = 0, transform: P, ...W } = n;
366
+ const { debounce: d = 0, transform: V, ...z } = n;
367
367
  return {
368
368
  "onUpdate:modelValue": q(($) => {
369
- U($, W);
370
- }, v),
371
- modelValue: V(r),
369
+ U($, z);
370
+ }, d),
371
+ modelValue: P(r),
372
372
  value: r.name
373
373
  };
374
374
  }
@@ -376,7 +376,7 @@ function ee(o, m, d = {}) {
376
376
  filters: i,
377
377
  sorts: u,
378
378
  searches: b,
379
- getFilter: C,
379
+ getFilter: j,
380
380
  getSort: h,
381
381
  getSearch: E,
382
382
  currentFilters: f,
@@ -384,14 +384,14 @@ function ee(o, m, d = {}) {
384
384
  currentSearches: S,
385
385
  isFiltering: y,
386
386
  isSorting: K,
387
- isSearching: V,
388
- apply: z,
387
+ isSearching: P,
388
+ apply: C,
389
389
  applyFilter: L,
390
390
  applySort: M,
391
391
  applySearch: T,
392
392
  applyMatch: U,
393
393
  clearFilter: N,
394
- clearSort: G,
394
+ clearSort: W,
395
395
  clearSearch: R,
396
396
  clearMatch: D,
397
397
  reset: t,
@@ -400,19 +400,19 @@ function ee(o, m, d = {}) {
400
400
  bindSearch: w,
401
401
  bindMatch: F,
402
402
  stringValue: c,
403
- omitValue: g,
404
- toggleValue: j,
403
+ omitValue: p,
404
+ toggleValue: B,
405
405
  delimitArray: k
406
406
  };
407
407
  }
408
- function le(o, m, d = {}, l = {}) {
408
+ function le(o, m, v = {}, l = {}) {
409
409
  if (!o || !m || !o[m])
410
410
  throw new Error("Table has not been provided with valid props and key.");
411
411
  l = {
412
412
  ...l,
413
413
  only: [...l.only ?? [], m.toString()]
414
414
  };
415
- const i = p(() => o[m]), u = X(), b = ee(o, m, l), f = p(() => i.value.config), A = p(() => i.value.meta), S = p(
415
+ const i = g(() => o[m]), u = X(), b = ee(o, m, l), f = g(() => i.value.config), A = g(() => i.value.meta), S = g(
416
416
  () => {
417
417
  var t;
418
418
  return ((t = i.value.columns) == null ? void 0 : t.filter(({ active: a, hidden: s }) => a && !s).map((a) => {
@@ -424,7 +424,7 @@ function le(o, m, d = {}, l = {}) {
424
424
  };
425
425
  })) ?? [];
426
426
  }
427
- ), k = p(
427
+ ), k = g(
428
428
  () => {
429
429
  var t;
430
430
  return ((t = i.value.columns) == null ? void 0 : t.filter(({ hidden: a }) => !a).map((a) => ({
@@ -432,7 +432,7 @@ function le(o, m, d = {}, l = {}) {
432
432
  toggle: (s = {}) => N(a, s)
433
433
  }))) ?? [];
434
434
  }
435
- ), c = p(
435
+ ), c = g(
436
436
  () => i.value.records.map((t) => ({
437
437
  record: (({ actions: a, ...s }) => s)(t),
438
438
  /** Perform this action when the record is clicked */
@@ -440,13 +440,13 @@ function le(o, m, d = {}, l = {}) {
440
440
  const s = t.actions.find(
441
441
  (w) => w.default
442
442
  );
443
- s && z(s, t, a);
443
+ s && C(s, t, a);
444
444
  },
445
445
  /** The actions available for the record */
446
446
  actions: t.actions.map((a) => ({
447
447
  ...a,
448
448
  /** Executes this action */
449
- execute: (s = {}) => z(a, t, s)
449
+ execute: (s = {}) => C(a, t, s)
450
450
  })),
451
451
  /** Selects this record */
452
452
  select: () => u.select(y(t)),
@@ -469,19 +469,19 @@ function le(o, m, d = {}, l = {}) {
469
469
  return s in t ? t[s].extra : null;
470
470
  }
471
471
  }))
472
- ), g = p(
472
+ ), p = g(
473
473
  () => i.value.actions.bulk.map((t) => ({
474
474
  ...t,
475
475
  /** Executes this bulk action */
476
476
  execute: (a = {}) => L(t, a)
477
477
  }))
478
- ), B = p(
478
+ ), G = g(
479
479
  () => i.value.actions.page.map((t) => ({
480
480
  ...t,
481
481
  /** Executes this page action */
482
482
  execute: (a = {}) => M(t, a)
483
483
  }))
484
- ), j = p(
484
+ ), B = g(
485
485
  () => {
486
486
  var t;
487
487
  return ((t = i.value.recordsPerPage) == null ? void 0 : t.map((a) => ({
@@ -490,32 +490,32 @@ function le(o, m, d = {}, l = {}) {
490
490
  apply: (s = {}) => T(a, s)
491
491
  }))) ?? [];
492
492
  }
493
- ), C = p(
493
+ ), j = g(
494
494
  () => {
495
495
  var t;
496
496
  return (t = i.value.recordsPerPage) == null ? void 0 : t.find(({ active: a }) => a);
497
497
  }
498
- ), h = p(() => ({
498
+ ), h = g(() => ({
499
499
  ...i.value.paginator,
500
500
  next: (t = {}) => {
501
- "nextLink" in h.value && h.value.nextLink && V(h.value.nextLink, t);
501
+ "nextLink" in h.value && h.value.nextLink && P(h.value.nextLink, t);
502
502
  },
503
503
  previous: (t = {}) => {
504
- "prevLink" in h.value && h.value.prevLink && V(h.value.prevLink, t);
504
+ "prevLink" in h.value && h.value.prevLink && P(h.value.prevLink, t);
505
505
  },
506
506
  first: (t = {}) => {
507
- "firstLink" in h.value && h.value.firstLink && V(h.value.firstLink, t);
507
+ "firstLink" in h.value && h.value.firstLink && P(h.value.firstLink, t);
508
508
  },
509
509
  last: (t = {}) => {
510
- "lastLink" in h.value && h.value.lastLink && V(h.value.lastLink, t);
510
+ "lastLink" in h.value && h.value.lastLink && P(h.value.lastLink, t);
511
511
  },
512
512
  ..."links" in i.value.paginator && i.value.paginator.links ? {
513
513
  links: i.value.paginator.links.map((t) => ({
514
514
  ...t,
515
- navigate: (a = {}) => t.url && V(t.url, a)
515
+ navigate: (a = {}) => t.url && P(t.url, a)
516
516
  }))
517
517
  } : {}
518
- })), E = p(
518
+ })), E = g(
519
519
  () => i.value.records.length > 0 && i.value.records.every(
520
520
  (t) => u.selected(y(t))
521
521
  )
@@ -526,7 +526,7 @@ function le(o, m, d = {}, l = {}) {
526
526
  function K(t) {
527
527
  return typeof t == "string" ? t : t.name;
528
528
  }
529
- function V(t, a = {}) {
529
+ function P(t, a = {}) {
530
530
  x.visit(t, {
531
531
  preserveScroll: !0,
532
532
  preserveState: !0,
@@ -535,7 +535,7 @@ function le(o, m, d = {}, l = {}) {
535
535
  method: "get"
536
536
  });
537
537
  }
538
- function z(t, a, s = {}) {
538
+ function C(t, a, s = {}) {
539
539
  var F, e;
540
540
  I(
541
541
  t,
@@ -545,7 +545,7 @@ function le(o, m, d = {}, l = {}) {
545
545
  id: y(a)
546
546
  },
547
547
  s
548
- ) || (e = (F = d.recordActions) == null ? void 0 : F[t.name]) == null || e.call(F, a);
548
+ ) || (e = (F = v.recordActions) == null ? void 0 : F[t.name]) == null || e.call(F, a);
549
549
  }
550
550
  function L(t, a = {}) {
551
551
  I(
@@ -602,7 +602,7 @@ function le(o, m, d = {}, l = {}) {
602
602
  }
603
603
  });
604
604
  }
605
- function G() {
605
+ function W() {
606
606
  u.select(
607
607
  ...i.value.records.map(
608
608
  (t) => y(t)
@@ -619,7 +619,7 @@ function le(o, m, d = {}, l = {}) {
619
619
  function D() {
620
620
  return {
621
621
  "onUpdate:modelValue": (t) => {
622
- t ? G() : R();
622
+ t ? W() : R();
623
623
  },
624
624
  modelValue: E.value
625
625
  };
@@ -636,17 +636,17 @@ function le(o, m, d = {}, l = {}) {
636
636
  /** The records of the table */
637
637
  records: c,
638
638
  /** The available bulk actions */
639
- bulkActions: g,
639
+ bulkActions: p,
640
640
  /** The available page actions */
641
- pageActions: B,
641
+ pageActions: G,
642
642
  /** The available number of records to display per page */
643
- rowsPerPage: j,
643
+ rowsPerPage: B,
644
644
  /** The current record per page item */
645
- currentPage: C,
645
+ currentPage: j,
646
646
  /** The pagination metadata */
647
647
  paginator: h,
648
648
  /** Execute an inline action */
649
- executeInlineAction: z,
649
+ executeInlineAction: C,
650
650
  /** Execute a bulk action */
651
651
  executeBulkAction: L,
652
652
  /** Execute a page action */
@@ -660,7 +660,7 @@ function le(o, m, d = {}, l = {}) {
660
660
  /** Deselect the given records */
661
661
  deselect: (t) => u.deselect(y(t)),
662
662
  /** Select records on the current page */
663
- selectPage: G,
663
+ selectPage: W,
664
664
  /** Deselect records on the current page */
665
665
  deselectPage: R,
666
666
  /** Toggle the selection of the given records */
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(P,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],c):(P=typeof globalThis<"u"?globalThis:P||self,c(P["@honed/table"]={},P.Vue,P.Inertia))})(this,function(P,c,b){"use strict";function _(){const r=c.ref({all:!1,only:new Set,except:new Set});function p(){r.value.all=!0,r.value.only.clear(),r.value.except.clear()}function v(){r.value.all=!1,r.value.only.clear(),r.value.except.clear()}function l(...s){s.forEach(g=>r.value.except.delete(g)),s.forEach(g=>r.value.only.add(g))}function i(...s){s.forEach(g=>r.value.except.add(g)),s.forEach(g=>r.value.only.delete(g))}function u(s,g){if(x(s)||g===!1)return i(s);if(!x(s)||g===!0)return l(s)}function x(s){return r.value.all?!r.value.except.has(s):r.value.only.has(s)}const m=c.computed(()=>r.value.all&&r.value.except.size===0),A=c.computed(()=>r.value.only.size>0||m.value);function S(s){return{"onUpdate:modelValue":g=>{g?l(s):i(s)},modelValue:x(s),value:s}}function k(){return{"onUpdate:modelValue":s=>{s?p():v()},modelValue:m.value,value:m.value}}return{allSelected:m,selection:r,hasSelected:A,selectAll:p,deselectAll:v,select:l,deselect:i,toggle:u,selected:x,bind:S,bindAll:k}}function D(r,p,v={},l={}){return r.route?(b.router.visit(r.route.url,{...l,method:r.route.method}),!0):r.action&&p?(b.router.post(p,{...v,name:r.name,type:r.type},l),!0):!1}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Y=()=>{};function Q(r,p){function v(...l){return new Promise((i,u)=>{Promise.resolve(r(()=>p.apply(this,l),{fn:p,thisArg:this,args:l})).then(i).catch(u)})}return v}function X(r,p={}){let v,l,i=Y;const u=m=>{clearTimeout(m),i(),i=Y};let x;return m=>{const A=c.toValue(r),S=c.toValue(p.maxWait);return v&&u(v),A<=0||S!==void 0&&S<=0?(l&&(u(l),l=null),Promise.resolve(m())):new Promise((k,s)=>{i=p.rejectOnCancel?s:k,x=m,S&&!l&&(l=setTimeout(()=>{v&&u(v),l=null,k(x())},S)),v=setTimeout(()=>{l&&u(l),l=null,k(m())},A)})}}function B(r,p=200,v={}){return Q(X(p,v),r)}function Z(r,p,v={}){const l=c.computed(()=>r[p]),i=c.computed(()=>{var e;return((e=l.value.filters)==null?void 0:e.map(n=>({...n,apply:(o,f={})=>T(n,o,f),clear:(o={})=>N(n,o),bind:()=>a(n.name)})))??[]}),u=c.computed(()=>{var e;return((e=l.value.sorts)==null?void 0:e.map(n=>({...n,apply:(o={})=>E(n,n.direction,o),clear:(o={})=>G(o),bind:()=>d(n)})))??[]}),x=c.computed(()=>{var e;return(e=l.value.searches)==null?void 0:e.map(n=>({...n,apply:(o={})=>U(n,o),clear:(o={})=>U(n,o),bind:()=>j(n)}))}),m=c.computed(()=>{var e;return((e=l.value.filters)==null?void 0:e.filter(({active:n})=>n))??[]}),A=c.computed(()=>{var e;return(e=l.value.sorts)==null?void 0:e.find(({active:n})=>n)}),S=c.computed(()=>{var e;return((e=l.value.searches)==null?void 0:e.filter(({active:n})=>n))??[]});function k(e){return Array.isArray(e)?e.join(l.value.config.delimiter):e}function s(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function g(e){if(!["",null,void 0,[]].includes(e))return e}function I(e){return[k,s,g].reduce((n,o)=>o(n),e)}function C(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(o=>o!==e):[...n,e]}function q(e){var n;return(n=l.value.filters)==null?void 0:n.find(o=>o.name===e)}function h(e,n=null){var o;return(o=l.value.sorts)==null?void 0:o.find(f=>f.name===e&&f.direction===n)}function F(e){var n;return(n=l.value.searches)==null?void 0:n.find(o=>o.name===e)}function y(e){return e?typeof e=="string"?m.value.some(n=>n.name===e):e.active:!!m.value.length}function K(e){var n;return e?typeof e=="string"?((n=A.value)==null?void 0:n.name)===e:e.active:!!A.value}function w(e){var n;return e?typeof e=="string"?(n=S.value)==null?void 0:n.some(o=>o.name===e):e.active:!!l.value.config.term}function z(e,n={}){const o=Object.fromEntries(Object.entries(e).map(([f,V])=>[f,I(V)]));b.router.reload({...v,...n,data:o})}function T(e,n,o={}){const f=typeof e=="string"?q(e):e;if(!f){console.warn(`Filter [${e}] does not exist.`);return}"multiple"in f&&f.multiple&&n!==void 0&&(n=C(n,f.value)),b.router.reload({...v,...o,data:{[f.name]:I(n)}})}function E(e,n=null,o={}){const f=typeof e=="string"?h(e,n):e;if(!f){console.warn(`Sort [${e}] does not exist.`);return}b.router.reload({...v,...o,data:{[l.value.config.sort]:g(f.next)}})}function M(e,n={}){e=[s,g].reduce((o,f)=>f(o),e),b.router.reload({...v,...n,data:{[l.value.config.search]:e}})}function U(e,n={}){const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const f=C(o.name,S.value.map(({name:V})=>V));b.router.reload({...v,...n,data:{[l.value.config.match]:k(f)}})}function N(e,n={}){T(e,void 0,n)}function G(e={}){b.router.reload({...v,...e,data:{[l.value.config.sort]:void 0}})}function R(e={}){M(void 0,e)}function H(e={}){if(!l.value.config.match){console.warn("Matches key is not set.");return}b.router.reload({...v,...e,data:{[l.value.config.match]:void 0}})}function t(e={}){var n;b.router.reload({...v,...e,data:{[l.value.config.search]:void 0,[l.value.config.sort]:void 0,[l.value.config.match]:void 0,...Object.fromEntries(((n=l.value.filters)==null?void 0:n.map(o=>[o.name,void 0]))??[])}})}function a(e,n={}){const o=typeof e=="string"?q(e):e;if(!o){console.warn(`Filter [${e}] does not exist.`);return}const f=o.value,{debounce:V=250,transform:W=J=>J,...$}=n;return{"onUpdate:modelValue":B(J=>{T(o,W(J),$)},V),modelValue:f}}function d(e,n={}){const o=typeof e=="string"?h(e):e;if(!o){console.warn(`Sort [${e}] does not exist.`);return}const{debounce:f=0,transform:V,...W}=n;return{onClick:B(()=>{var $;E(o,($=A.value)==null?void 0:$.direction,W)},f)}}function L(e={}){const{debounce:n=700,transform:o,...f}=e;return{"onUpdate:modelValue":B(V=>{M(V,f)},n),modelValue:l.value.config.search??""}}function j(e,n={}){const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const{debounce:f=0,transform:V,...W}=n;return{"onUpdate:modelValue":B($=>{U($,W)},f),modelValue:w(o),value:o.name}}return{filters:i,sorts:u,searches:x,getFilter:q,getSort:h,getSearch:F,currentFilters:m,currentSort:A,currentSearches:S,isFiltering:y,isSorting:K,isSearching:w,apply:z,applyFilter:T,applySort:E,applySearch:M,applyMatch:U,clearFilter:N,clearSort:G,clearSearch:R,clearMatch:H,reset:t,bindFilter:a,bindSort:d,bindSearch:L,bindMatch:j,stringValue:s,omitValue:g,toggleValue:C,delimitArray:k}}function O(r,p,v={},l={}){if(!r||!p||!r[p])throw new Error("Table has not been provided with valid props and key.");l={...l,only:[...l.only??[],p.toString()]};const i=c.computed(()=>r[p]),u=_(),x=Z(r,p,l),m=c.computed(()=>i.value.config),A=c.computed(()=>i.value.meta),S=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({active:a,hidden:d})=>a&&!d).map(a=>{var d;return{...a,isSorting:(d=a.sort)==null?void 0:d.active,toggleSort:(L={})=>U(a,L)}}))??[]}),k=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({hidden:a})=>!a).map(a=>({...a,toggle:(d={})=>N(a,d)})))??[]}),s=c.computed(()=>i.value.records.map(t=>({record:(({actions:a,...d})=>d)(t),default:(a={})=>{const d=t.actions.find(L=>L.default);d&&z(d,t,a)},actions:t.actions.map(a=>({...a,execute:(d={})=>z(a,t,d)})),select:()=>u.select(y(t)),deselect:()=>u.deselect(y(t)),toggle:()=>u.toggle(y(t)),selected:u.selected(y(t)),bind:()=>u.bind(y(t)),value:a=>{const d=K(a);return d in t?t[d].value:null},extra:a=>{const d=K(a);return d in t?t[d].extra:null}}))),g=c.computed(()=>i.value.actions.bulk.map(t=>({...t,execute:(a={})=>T(t,a)}))),I=c.computed(()=>i.value.actions.page.map(t=>({...t,execute:(a={})=>E(t,a)}))),C=c.computed(()=>{var t;return((t=i.value.recordsPerPage)==null?void 0:t.map(a=>({...a,apply:(d={})=>M(a,d)})))??[]}),q=c.computed(()=>{var t;return(t=i.value.recordsPerPage)==null?void 0:t.find(({active:a})=>a)}),h=c.computed(()=>({...i.value.paginator,next:(t={})=>{"nextLink"in h.value&&h.value.nextLink&&w(h.value.nextLink,t)},previous:(t={})=>{"prevLink"in h.value&&h.value.prevLink&&w(h.value.prevLink,t)},first:(t={})=>{"firstLink"in h.value&&h.value.firstLink&&w(h.value.firstLink,t)},last:(t={})=>{"lastLink"in h.value&&h.value.lastLink&&w(h.value.lastLink,t)},..."links"in i.value.paginator&&i.value.paginator.links?{links:i.value.paginator.links.map(t=>({...t,navigate:(a={})=>t.url&&w(t.url,a)}))}:{}})),F=c.computed(()=>i.value.records.length>0&&i.value.records.every(t=>u.selected(y(t))));function y(t){return t[m.value.key].value}function K(t){return typeof t=="string"?t:t.name}function w(t,a={}){b.router.visit(t,{preserveScroll:!0,preserveState:!0,...l,...a,method:"get"})}function z(t,a,d={}){var j,e;D(t,m.value.endpoint,{table:i.value.id,id:y(a)},d)||(e=(j=v.recordActions)==null?void 0:j[t.name])==null||e.call(j,a)}function T(t,a={}){D(t,m.value.endpoint,{table:i.value.id,all:u.selection.value.all,only:Array.from(u.selection.value.only),except:Array.from(u.selection.value.except)},a)}function E(t,a={}){D(t,m.value.endpoint,{table:i.value.id},a)}function M(t,a={}){b.router.reload({...l,...a,data:{[m.value.record]:t.value,[m.value.page]:void 0}})}function U(t,a={}){t.sort&&b.router.reload({...l,...a,data:{[m.value.sort]:x.omitValue(t.sort.next)}})}function N(t,a={}){const d=x.toggleValue(t.name,S.value.map(({name:L})=>L));b.router.reload({...l,...a,data:{[m.value.column]:x.delimitArray(d)}})}function G(){u.select(...i.value.records.map(t=>y(t)))}function R(){u.deselect(...i.value.records.map(t=>y(t)))}function H(){return{"onUpdate:modelValue":t=>{t?G():R()},modelValue:F.value}}return c.reactive({getRecordKey:y,meta:A,headings:S,columns:k,records:s,bulkActions:g,pageActions:I,rowsPerPage:C,currentPage:q,paginator:h,executeInlineAction:z,executeBulkAction:T,executePageAction:E,applyPage:M,selection:u.selection,select:t=>u.select(y(t)),deselect:t=>u.deselect(y(t)),selectPage:G,deselectPage:R,toggle:t=>u.toggle(y(t)),selected:t=>u.selected(y(t)),selectAll:u.selectAll,deselectAll:u.deselectAll,isPageSelected:F,hasSelected:u.hasSelected,bindCheckbox:t=>u.bind(y(t)),bindPage:H,bindAll:u.bindAll,...x})}P.useTable=O,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
1
+ (function(P,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue"),require("@inertiajs/vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@inertiajs/vue3"],c):(P=typeof globalThis<"u"?globalThis:P||self,c(P["@honed/table"]={},P.Vue,P.Inertia))})(this,function(P,c,b){"use strict";function _(){const r=c.ref({all:!1,only:new Set,except:new Set});function p(){r.value.all=!0,r.value.only.clear(),r.value.except.clear()}function f(){r.value.all=!1,r.value.only.clear(),r.value.except.clear()}function a(...s){s.forEach(g=>r.value.except.delete(g)),s.forEach(g=>r.value.only.add(g))}function i(...s){s.forEach(g=>r.value.except.add(g)),s.forEach(g=>r.value.only.delete(g))}function u(s,g){if(x(s)||g===!1)return i(s);if(!x(s)||g===!0)return a(s)}function x(s){return r.value.all?!r.value.except.has(s):r.value.only.has(s)}const m=c.computed(()=>r.value.all&&r.value.except.size===0),A=c.computed(()=>r.value.only.size>0||m.value);function S(s){return{"onUpdate:modelValue":g=>{g?a(s):i(s)},modelValue:x(s),value:s}}function k(){return{"onUpdate:modelValue":s=>{s?p():f()},modelValue:m.value,value:m.value}}return{allSelected:m,selection:r,hasSelected:A,selectAll:p,deselectAll:f,select:a,deselect:i,toggle:u,selected:x,bind:S,bindAll:k}}function D(r,p,f={},a={}){return r.route?(b.router.visit(r.route.url,{...a,method:r.route.method}),!0):r.action&&p?(b.router.post(p,{...f,name:r.name,type:r.type},a),!0):!1}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Y=()=>{};function Q(r,p){function f(...a){return new Promise((i,u)=>{Promise.resolve(r(()=>p.apply(this,a),{fn:p,thisArg:this,args:a})).then(i).catch(u)})}return f}function X(r,p={}){let f,a,i=Y;const u=m=>{clearTimeout(m),i(),i=Y};let x;return m=>{const A=c.toValue(r),S=c.toValue(p.maxWait);return f&&u(f),A<=0||S!==void 0&&S<=0?(a&&(u(a),a=null),Promise.resolve(m())):new Promise((k,s)=>{i=p.rejectOnCancel?s:k,x=m,S&&!a&&(a=setTimeout(()=>{f&&u(f),a=null,k(x())},S)),f=setTimeout(()=>{a&&u(a),a=null,k(m())},A)})}}function G(r,p=200,f={}){return Q(X(p,f),r)}function Z(r,p,f={}){const a=c.computed(()=>r[p]),i=c.computed(()=>{var e;return((e=a.value.filters)==null?void 0:e.map(n=>({...n,apply:(o,v={})=>T(n,o,v),clear:(o={})=>N(n,o),bind:()=>l(n.name)})))??[]}),u=c.computed(()=>{var e;return((e=a.value.sorts)==null?void 0:e.map(n=>({...n,apply:(o={})=>E(n,n.direction,o),clear:(o={})=>q(o),bind:()=>d(n)})))??[]}),x=c.computed(()=>{var e;return(e=a.value.searches)==null?void 0:e.map(n=>({...n,apply:(o={})=>U(n,o),clear:(o={})=>U(n,o),bind:()=>j(n)}))}),m=c.computed(()=>{var e;return((e=a.value.filters)==null?void 0:e.filter(({active:n})=>n))??[]}),A=c.computed(()=>{var e;return(e=a.value.sorts)==null?void 0:e.find(({active:n})=>n)}),S=c.computed(()=>{var e;return((e=a.value.searches)==null?void 0:e.filter(({active:n})=>n))??[]});function k(e){return Array.isArray(e)?e.join(a.value.config.delimiter):e}function s(e){return typeof e!="string"?e:e.trim().replace(/\s+/g,"+")}function g(e){if(!["",null,void 0,[]].includes(e))return e}function B(e){return[k,s,g].reduce((n,o)=>o(n),e)}function I(e,n){return n=Array.isArray(n)?n:[n],n.includes(e)?n.filter(o=>o!==e):[...n,e]}function C(e){var n;return(n=a.value.filters)==null?void 0:n.find(o=>o.name===e)}function h(e,n=null){var o;return(o=a.value.sorts)==null?void 0:o.find(v=>v.name===e&&v.direction===n)}function F(e){var n;return(n=a.value.searches)==null?void 0:n.find(o=>o.name===e)}function y(e){return e?typeof e=="string"?m.value.some(n=>n.name===e):e.active:!!m.value.length}function K(e){var n;return e?typeof e=="string"?((n=A.value)==null?void 0:n.name)===e:e.active:!!A.value}function w(e){var n;return e?typeof e=="string"?(n=S.value)==null?void 0:n.some(o=>o.name===e):e.active:!!a.value.config.term}function W(e,n={}){const o=Object.fromEntries(Object.entries(e).map(([v,V])=>[v,B(V)]));b.router.reload({...f,...n,data:o})}function T(e,n,o={}){const v=typeof e=="string"?C(e):e;if(!v){console.warn(`Filter [${e}] does not exist.`);return}b.router.reload({...f,...o,data:{[v.name]:B(n)}})}function E(e,n=null,o={}){const v=typeof e=="string"?h(e,n):e;if(!v){console.warn(`Sort [${e}] does not exist.`);return}b.router.reload({...f,...o,data:{[a.value.config.sort]:g(v.next)}})}function M(e,n={}){e=[s,g].reduce((o,v)=>v(o),e),b.router.reload({...f,...n,data:{[a.value.config.search]:e}})}function U(e,n={}){const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const v=I(o.name,S.value.map(({name:V})=>V));b.router.reload({...f,...n,data:{[a.value.config.match]:k(v)}})}function N(e,n={}){T(e,void 0,n)}function q(e={}){b.router.reload({...f,...e,data:{[a.value.config.sort]:void 0}})}function R(e={}){M(void 0,e)}function H(e={}){if(!a.value.config.match){console.warn("Matches key is not set.");return}b.router.reload({...f,...e,data:{[a.value.config.match]:void 0}})}function t(e={}){var n;b.router.reload({...f,...e,data:{[a.value.config.search]:void 0,[a.value.config.sort]:void 0,[a.value.config.match]:void 0,...Object.fromEntries(((n=a.value.filters)==null?void 0:n.map(o=>[o.name,void 0]))??[])}})}function l(e,n={}){const o=typeof e=="string"?C(e):e;if(!o){console.warn(`Filter [${e}] does not exist.`);return}const v=o.value,{debounce:V=250,transform:z=J=>J,...$}=n;return{"onUpdate:modelValue":G(J=>{T(o,z(J),$)},V),modelValue:v}}function d(e,n={}){const o=typeof e=="string"?h(e):e;if(!o){console.warn(`Sort [${e}] does not exist.`);return}const{debounce:v=0,transform:V,...z}=n;return{onClick:G(()=>{var $;E(o,($=A.value)==null?void 0:$.direction,z)},v)}}function L(e={}){const{debounce:n=700,transform:o,...v}=e;return{"onUpdate:modelValue":G(V=>{M(V,v)},n),modelValue:a.value.config.term??""}}function j(e,n={}){const o=typeof e=="string"?F(e):e;if(!o){console.warn(`Match [${e}] does not exist.`);return}const{debounce:v=0,transform:V,...z}=n;return{"onUpdate:modelValue":G($=>{U($,z)},v),modelValue:w(o),value:o.name}}return{filters:i,sorts:u,searches:x,getFilter:C,getSort:h,getSearch:F,currentFilters:m,currentSort:A,currentSearches:S,isFiltering:y,isSorting:K,isSearching:w,apply:W,applyFilter:T,applySort:E,applySearch:M,applyMatch:U,clearFilter:N,clearSort:q,clearSearch:R,clearMatch:H,reset:t,bindFilter:l,bindSort:d,bindSearch:L,bindMatch:j,stringValue:s,omitValue:g,toggleValue:I,delimitArray:k}}function O(r,p,f={},a={}){if(!r||!p||!r[p])throw new Error("Table has not been provided with valid props and key.");a={...a,only:[...a.only??[],p.toString()]};const i=c.computed(()=>r[p]),u=_(),x=Z(r,p,a),m=c.computed(()=>i.value.config),A=c.computed(()=>i.value.meta),S=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({active:l,hidden:d})=>l&&!d).map(l=>{var d;return{...l,isSorting:(d=l.sort)==null?void 0:d.active,toggleSort:(L={})=>U(l,L)}}))??[]}),k=c.computed(()=>{var t;return((t=i.value.columns)==null?void 0:t.filter(({hidden:l})=>!l).map(l=>({...l,toggle:(d={})=>N(l,d)})))??[]}),s=c.computed(()=>i.value.records.map(t=>({record:(({actions:l,...d})=>d)(t),default:(l={})=>{const d=t.actions.find(L=>L.default);d&&W(d,t,l)},actions:t.actions.map(l=>({...l,execute:(d={})=>W(l,t,d)})),select:()=>u.select(y(t)),deselect:()=>u.deselect(y(t)),toggle:()=>u.toggle(y(t)),selected:u.selected(y(t)),bind:()=>u.bind(y(t)),value:l=>{const d=K(l);return d in t?t[d].value:null},extra:l=>{const d=K(l);return d in t?t[d].extra:null}}))),g=c.computed(()=>i.value.actions.bulk.map(t=>({...t,execute:(l={})=>T(t,l)}))),B=c.computed(()=>i.value.actions.page.map(t=>({...t,execute:(l={})=>E(t,l)}))),I=c.computed(()=>{var t;return((t=i.value.recordsPerPage)==null?void 0:t.map(l=>({...l,apply:(d={})=>M(l,d)})))??[]}),C=c.computed(()=>{var t;return(t=i.value.recordsPerPage)==null?void 0:t.find(({active:l})=>l)}),h=c.computed(()=>({...i.value.paginator,next:(t={})=>{"nextLink"in h.value&&h.value.nextLink&&w(h.value.nextLink,t)},previous:(t={})=>{"prevLink"in h.value&&h.value.prevLink&&w(h.value.prevLink,t)},first:(t={})=>{"firstLink"in h.value&&h.value.firstLink&&w(h.value.firstLink,t)},last:(t={})=>{"lastLink"in h.value&&h.value.lastLink&&w(h.value.lastLink,t)},..."links"in i.value.paginator&&i.value.paginator.links?{links:i.value.paginator.links.map(t=>({...t,navigate:(l={})=>t.url&&w(t.url,l)}))}:{}})),F=c.computed(()=>i.value.records.length>0&&i.value.records.every(t=>u.selected(y(t))));function y(t){return t[m.value.key].value}function K(t){return typeof t=="string"?t:t.name}function w(t,l={}){b.router.visit(t,{preserveScroll:!0,preserveState:!0,...a,...l,method:"get"})}function W(t,l,d={}){var j,e;D(t,m.value.endpoint,{table:i.value.id,id:y(l)},d)||(e=(j=f.recordActions)==null?void 0:j[t.name])==null||e.call(j,l)}function T(t,l={}){D(t,m.value.endpoint,{table:i.value.id,all:u.selection.value.all,only:Array.from(u.selection.value.only),except:Array.from(u.selection.value.except)},l)}function E(t,l={}){D(t,m.value.endpoint,{table:i.value.id},l)}function M(t,l={}){b.router.reload({...a,...l,data:{[m.value.record]:t.value,[m.value.page]:void 0}})}function U(t,l={}){t.sort&&b.router.reload({...a,...l,data:{[m.value.sort]:x.omitValue(t.sort.next)}})}function N(t,l={}){const d=x.toggleValue(t.name,S.value.map(({name:L})=>L));b.router.reload({...a,...l,data:{[m.value.column]:x.delimitArray(d)}})}function q(){u.select(...i.value.records.map(t=>y(t)))}function R(){u.deselect(...i.value.records.map(t=>y(t)))}function H(){return{"onUpdate:modelValue":t=>{t?q():R()},modelValue:F.value}}return c.reactive({getRecordKey:y,meta:A,headings:S,columns:k,records:s,bulkActions:g,pageActions:B,rowsPerPage:I,currentPage:C,paginator:h,executeInlineAction:W,executeBulkAction:T,executePageAction:E,applyPage:M,selection:u.selection,select:t=>u.select(y(t)),deselect:t=>u.deselect(y(t)),selectPage:q,deselectPage:R,toggle:t=>u.toggle(y(t)),selected:t=>u.selected(y(t)),selectAll:u.selectAll,deselectAll:u.deselectAll,isPageSelected:F,hasSelected:u.hasSelected,bindCheckbox:t=>u.bind(y(t)),bindPage:H,bindAll:u.bindAll,...x})}P.useTable=O,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@honed/table",
3
3
  "private": false,
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "license": "MIT",
6
6
  "description": "-",
7
7
  "keywords": [
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@honed/action": "^0.5.0",
61
- "@honed/refine": "^0.5.0",
61
+ "@honed/refine": "^0.5.3",
62
62
  "@inertiajs/vue3": "^1.2.0||^2.0.0",
63
63
  "@vueuse/core": "^11.0.0||^12.0.0",
64
64
  "axios": "^1.2.0",