@jdanino/inertiajs-tables-laravel-query-builder 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1319 @@
1
+ import { ref as F, onMounted as Y, onBeforeUnmount as we, openBlock as o, createElementBlock as u, renderSlot as b, watch as J, inject as I, createBlock as k, withCtx as S, createElementVNode as r, normalizeClass as y, unref as e, withModifiers as B, withDirectives as D, vShow as E, resolveDynamicComponent as L, toDisplayString as g, createCommentVNode as x, computed as _, Fragment as P, renderList as O, createVNode as V, createTextVNode as T, nextTick as xe, provide as ke, getCurrentInstance as _e, onUnmounted as $e, Transition as Ce } from "vue";
2
+ import { createPopper as Se } from "@popperjs/core/lib/popper-lite";
3
+ import qe from "@popperjs/core/lib/modifiers/preventOverflow";
4
+ import Fe from "@popperjs/core/lib/modifiers/flip";
5
+ import Be from "lodash-es/uniq";
6
+ import Pe from "lodash-es/find";
7
+ import U from "qs";
8
+ import Oe from "lodash-es/clone";
9
+ import je from "lodash-es/filter";
10
+ import Te from "lodash-es/findKey";
11
+ import j from "lodash-es/forEach";
12
+ import Le from "lodash-es/isEqual";
13
+ import Ve from "lodash-es/map";
14
+ import Ie from "lodash-es/pickBy";
15
+ const Me = {
16
+ __name: "OnClickOutside",
17
+ props: {
18
+ do: {
19
+ type: Function,
20
+ required: !0
21
+ }
22
+ },
23
+ setup(t) {
24
+ const p = t, n = F(null), f = F(null);
25
+ return Y(() => {
26
+ n.value = (d) => {
27
+ d.target === f.value || f.value.contains(d.target) || p.do();
28
+ }, document.addEventListener("click", n.value), document.addEventListener("touchstart", n.value);
29
+ }), we(() => {
30
+ document.removeEventListener("click", n.value), document.removeEventListener("touchstart", n.value);
31
+ }), (d, i) => (o(), u("div", {
32
+ ref_key: "root",
33
+ ref: f
34
+ }, [
35
+ b(d.$slots, "default")
36
+ ], 512));
37
+ }
38
+ }, ze = { class: "relative" }, Re = ["dusk", "disabled", "onClick"], De = { class: "mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" }, X = {
39
+ __name: "ButtonWithDropdown",
40
+ props: {
41
+ placement: {
42
+ type: String,
43
+ default: "bottom-start",
44
+ required: !1
45
+ },
46
+ active: {
47
+ type: Boolean,
48
+ default: !1,
49
+ required: !1
50
+ },
51
+ dusk: {
52
+ type: String,
53
+ default: null,
54
+ required: !1
55
+ },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: !1,
59
+ required: !1
60
+ }
61
+ },
62
+ setup(t, { expose: p }) {
63
+ const n = t, f = F(!1), d = F(null);
64
+ function i() {
65
+ f.value = !f.value;
66
+ }
67
+ function s() {
68
+ f.value = !1;
69
+ }
70
+ J(f, () => {
71
+ d.value.update();
72
+ });
73
+ const l = F(null), $ = F(null);
74
+ Y(() => {
75
+ d.value = Se(l.value, $.value, {
76
+ placement: n.placement,
77
+ modifiers: [Fe, qe]
78
+ });
79
+ }), p({ hide: s });
80
+ const C = I("activeClasses");
81
+ return (q, w) => (o(), k(Me, { do: s }, {
82
+ default: S(() => [
83
+ r("div", ze, [
84
+ r("button", {
85
+ ref_key: "button",
86
+ ref: l,
87
+ type: "button",
88
+ dusk: t.dusk,
89
+ disabled: t.disabled,
90
+ class: y(["w-full bg-white border rounded-md shadow-sm px-4 py-2 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", {
91
+ [e(C).border]: n.active,
92
+ "border-gray-300": !n.active,
93
+ "cursor-not-allowed": n.disabled
94
+ }]),
95
+ "aria-haspopup": "true",
96
+ onClick: B(i, ["prevent"])
97
+ }, [
98
+ b(q.$slots, "button")
99
+ ], 10, Re),
100
+ D(r("div", {
101
+ ref_key: "tooltip",
102
+ ref: $,
103
+ class: "absolute z-10"
104
+ }, [
105
+ r("div", De, [
106
+ b(q.$slots, "default")
107
+ ])
108
+ ], 512), [
109
+ [E, f.value]
110
+ ])
111
+ ])
112
+ ]),
113
+ _: 3
114
+ }));
115
+ }
116
+ }, Ee = { class: "flex flex-row items-center" }, Ae = { class: "uppercase" }, We = ["sorted"], Ne = {
117
+ key: 0,
118
+ fill: "currentColor",
119
+ d: "M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41zm255-105L177 64c-9.4-9.4-24.6-9.4-33.9 0L24 183c-15.1 15.1-4.4 41 17 41h238c21.4 0 32.1-25.9 17-41z"
120
+ }, He = {
121
+ key: 1,
122
+ fill: "currentColor",
123
+ d: "M279 224H41c-21.4 0-32.1-25.9-17-41L143 64c9.4-9.4 24.6-9.4 33.9 0l119 119c15.2 15.1 4.5 41-16.9 41z"
124
+ }, Ge = {
125
+ key: 2,
126
+ fill: "currentColor",
127
+ d: "M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"
128
+ }, Ke = {
129
+ __name: "HeaderCell",
130
+ props: {
131
+ cell: {
132
+ type: Object,
133
+ required: !0
134
+ }
135
+ },
136
+ setup(t) {
137
+ const p = t, n = I("activeClasses");
138
+ function f() {
139
+ p.cell.sortable && p.cell.onSort(p.cell.key);
140
+ }
141
+ return (d, i) => D((o(), u("th", null, [
142
+ (o(), k(L(t.cell.sortable ? "button" : "div"), {
143
+ class: "py-3 px-6 w-full",
144
+ dusk: t.cell.sortable ? `sort-${t.cell.key}` : null,
145
+ onClick: B(f, ["prevent"])
146
+ }, {
147
+ default: S(() => [
148
+ r("span", Ee, [
149
+ b(d.$slots, "label", {}, () => [
150
+ r("span", Ae, g(t.cell.label), 1)
151
+ ]),
152
+ b(d.$slots, "sort", {}, () => [
153
+ t.cell.sortable ? (o(), u("svg", {
154
+ key: 0,
155
+ "aria-hidden": "true",
156
+ class: y(["w-3 h-3 ml-2", {
157
+ "text-gray-400": !t.cell.sorted,
158
+ [e(n).text]: t.cell.sorted
159
+ }]),
160
+ xmlns: "http://www.w3.org/2000/svg",
161
+ viewBox: "0 0 320 512",
162
+ sorted: t.cell.sorted
163
+ }, [
164
+ t.cell.sorted ? x("", !0) : (o(), u("path", Ne)),
165
+ t.cell.sorted === "asc" ? (o(), u("path", He)) : x("", !0),
166
+ t.cell.sorted === "desc" ? (o(), u("path", Ge)) : x("", !0)
167
+ ], 10, We)) : x("", !0)
168
+ ])
169
+ ])
170
+ ]),
171
+ _: 3
172
+ }, 8, ["dusk", "onClick"]))
173
+ ], 512)), [
174
+ [E, !t.cell.hidden]
175
+ ]);
176
+ }
177
+ }, Z = {
178
+ translations: {
179
+ next: "Next",
180
+ no_results_found: "No results found",
181
+ of: "of",
182
+ per_page: "per page",
183
+ previous: "Previous",
184
+ results: "results",
185
+ to: "to"
186
+ }
187
+ };
188
+ function he() {
189
+ return Z.translations;
190
+ }
191
+ function As(t, p) {
192
+ Z.translations[t] = p;
193
+ }
194
+ function Ws(t) {
195
+ Z.translations = t;
196
+ }
197
+ const Qe = ["dusk", "value"], Ue = ["value"], de = {
198
+ __name: "PerPageSelector",
199
+ props: {
200
+ dusk: {
201
+ type: String,
202
+ default: null,
203
+ required: !1
204
+ },
205
+ value: {
206
+ type: Number,
207
+ default: 15,
208
+ required: !1
209
+ },
210
+ options: {
211
+ type: Array,
212
+ default() {
213
+ return [15, 30, 50, 100];
214
+ },
215
+ required: !1
216
+ },
217
+ onChange: {
218
+ type: Function,
219
+ required: !0
220
+ }
221
+ },
222
+ setup(t) {
223
+ const p = t, n = he(), f = _(() => {
224
+ let d = [...p.options];
225
+ return d.push(parseInt(p.value)), Be(d).sort((i, s) => i - s);
226
+ });
227
+ return (d, i) => (o(), u("select", {
228
+ name: "per_page",
229
+ dusk: t.dusk,
230
+ value: t.value,
231
+ class: "block focus:ring-indigo-500 focus:border-indigo-500 min-w-max shadow-sm text-sm border-gray-300 rounded-md",
232
+ onChange: i[0] || (i[0] = (s) => t.onChange(s.target.value))
233
+ }, [
234
+ (o(!0), u(P, null, O(e(f), (s) => (o(), u("option", {
235
+ key: s,
236
+ value: s
237
+ }, g(s) + " " + g(e(n).per_page), 9, Ue))), 128))
238
+ ], 40, Qe));
239
+ }
240
+ }, Ye = {
241
+ key: 0,
242
+ class: "bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"
243
+ }, Je = { key: 0 }, Xe = /* @__PURE__ */ r("svg", {
244
+ xmlns: "http://www.w3.org/2000/svg",
245
+ class: "h-5 w-5 text-gray-400",
246
+ fill: "none",
247
+ viewBox: "0 0 24 24",
248
+ stroke: "currentColor",
249
+ "stroke-width": "2"
250
+ }, [
251
+ /* @__PURE__ */ r("path", {
252
+ "stroke-linecap": "round",
253
+ "stroke-linejoin": "round",
254
+ d: "M7 16l-4-4m0 0l4-4m-4 4h18"
255
+ })
256
+ ], -1), Ze = { class: "hidden sm:inline ml-2" }, et = { class: "hidden sm:inline mr-2" }, tt = /* @__PURE__ */ r("svg", {
257
+ xmlns: "http://www.w3.org/2000/svg",
258
+ class: "h-5 w-5 text-gray-400",
259
+ fill: "none",
260
+ viewBox: "0 0 24 24",
261
+ stroke: "currentColor",
262
+ "stroke-width": "2"
263
+ }, [
264
+ /* @__PURE__ */ r("path", {
265
+ "stroke-linecap": "round",
266
+ "stroke-linejoin": "round",
267
+ d: "M17 8l4 4m0 0l-4 4m4-4H3"
268
+ })
269
+ ], -1), st = {
270
+ key: 2,
271
+ class: "hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"
272
+ }, lt = { class: "flex flex-row space-x-4 items-center flex-grow" }, rt = { class: "hidden lg:block text-sm text-gray-700 flex-grow" }, nt = { class: "font-medium" }, at = { class: "font-medium" }, ot = { class: "font-medium" }, it = {
273
+ class: "relative z-0 inline-flex rounded-md shadow-sm -space-x-px",
274
+ "aria-label": "Pagination"
275
+ }, ut = { class: "sr-only" }, ct = /* @__PURE__ */ r("svg", {
276
+ xmlns: "http://www.w3.org/2000/svg",
277
+ class: "h-5 w-5",
278
+ viewBox: "0 0 20 20",
279
+ fill: "currentColor"
280
+ }, [
281
+ /* @__PURE__ */ r("path", {
282
+ "fill-rule": "evenodd",
283
+ d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
284
+ "clip-rule": "evenodd"
285
+ })
286
+ ], -1), dt = { class: "sr-only" }, ht = /* @__PURE__ */ r("svg", {
287
+ xmlns: "http://www.w3.org/2000/svg",
288
+ class: "h-5 w-5",
289
+ viewBox: "0 0 20 20",
290
+ fill: "currentColor"
291
+ }, [
292
+ /* @__PURE__ */ r("path", {
293
+ "fill-rule": "evenodd",
294
+ d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
295
+ "clip-rule": "evenodd"
296
+ })
297
+ ], -1), ft = {
298
+ __name: "Pagination",
299
+ props: {
300
+ onClick: {
301
+ type: Function,
302
+ required: !1
303
+ },
304
+ perPageOptions: {
305
+ type: Array,
306
+ default() {
307
+ return () => [15, 30, 50, 100];
308
+ },
309
+ required: !1
310
+ },
311
+ onPerPageChange: {
312
+ type: Function,
313
+ default() {
314
+ return () => {
315
+ };
316
+ },
317
+ required: !1
318
+ },
319
+ hasData: {
320
+ type: Boolean,
321
+ required: !0
322
+ },
323
+ meta: {
324
+ type: Object,
325
+ required: !1
326
+ }
327
+ },
328
+ setup(t) {
329
+ const p = t, n = he(), f = _(() => "links" in i.value ? i.value.links.length > 0 : !1), d = _(() => Object.keys(i.value).length > 0), i = _(() => p.meta), s = _(() => "prev_page_url" in i.value ? i.value.prev_page_url : null), l = _(() => "next_page_url" in i.value ? i.value.next_page_url : null), $ = _(() => parseInt(i.value.per_page));
330
+ return (C, q) => e(d) ? (o(), u("nav", Ye, [
331
+ !t.hasData || e(i).total < 1 ? (o(), u("p", Je, g(e(n).no_results_found), 1)) : x("", !0),
332
+ t.hasData ? (o(), u("div", {
333
+ key: 1,
334
+ class: y(["flex-1 flex justify-between", { "sm:hidden": e(f) }])
335
+ }, [
336
+ (o(), k(L(e(s) ? "a" : "div"), {
337
+ class: y([{
338
+ "cursor-not-allowed text-gray-400": !e(s),
339
+ "text-gray-700 hover:text-gray-500": e(s)
340
+ }, "relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),
341
+ href: e(s),
342
+ dusk: e(s) ? "pagination-simple-previous" : null,
343
+ onClick: q[0] || (q[0] = B((w) => t.onClick(e(s)), ["prevent"]))
344
+ }, {
345
+ default: S(() => [
346
+ Xe,
347
+ r("span", Ze, g(e(n).previous), 1)
348
+ ]),
349
+ _: 1
350
+ }, 8, ["class", "href", "dusk"])),
351
+ V(de, {
352
+ dusk: "per-page-mobile",
353
+ value: e($),
354
+ options: t.perPageOptions,
355
+ "on-change": t.onPerPageChange
356
+ }, null, 8, ["value", "options", "on-change"]),
357
+ (o(), k(L(e(l) ? "a" : "div"), {
358
+ class: y([{
359
+ "cursor-not-allowed text-gray-400": !e(l),
360
+ "text-gray-700 hover:text-gray-500": e(l)
361
+ }, "ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),
362
+ href: e(l),
363
+ dusk: e(l) ? "pagination-simple-next" : null,
364
+ onClick: q[1] || (q[1] = B((w) => t.onClick(e(l)), ["prevent"]))
365
+ }, {
366
+ default: S(() => [
367
+ r("span", et, g(e(n).next), 1),
368
+ tt
369
+ ]),
370
+ _: 1
371
+ }, 8, ["class", "href", "dusk"]))
372
+ ], 2)) : x("", !0),
373
+ t.hasData && e(f) ? (o(), u("div", st, [
374
+ r("div", lt, [
375
+ V(de, {
376
+ dusk: "per-page-full",
377
+ value: e($),
378
+ options: t.perPageOptions,
379
+ "on-change": t.onPerPageChange
380
+ }, null, 8, ["value", "options", "on-change"]),
381
+ r("p", rt, [
382
+ r("span", nt, g(e(i).from), 1),
383
+ T(" " + g(e(n).to) + " ", 1),
384
+ r("span", at, g(e(i).to), 1),
385
+ T(" " + g(e(n).of) + " ", 1),
386
+ r("span", ot, g(e(i).total), 1),
387
+ T(" " + g(e(n).results), 1)
388
+ ])
389
+ ]),
390
+ r("div", null, [
391
+ r("nav", it, [
392
+ (o(), k(L(e(s) ? "a" : "div"), {
393
+ class: y([{
394
+ "cursor-not-allowed text-gray-400": !e(s),
395
+ "text-gray-500 hover:bg-gray-50": e(s)
396
+ }, "relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium"]),
397
+ href: e(s),
398
+ dusk: e(s) ? "pagination-previous" : null,
399
+ onClick: q[2] || (q[2] = B((w) => t.onClick(e(s)), ["prevent"]))
400
+ }, {
401
+ default: S(() => [
402
+ r("span", ut, g(e(n).previous), 1),
403
+ ct
404
+ ]),
405
+ _: 1
406
+ }, 8, ["class", "href", "dusk"])),
407
+ (o(!0), u(P, null, O(e(i).links, (w, A) => (o(), u("div", { key: A }, [
408
+ b(C.$slots, "link", {}, () => [
409
+ !isNaN(w.label) || w.label === "..." ? (o(), k(L(w.url ? "a" : "div"), {
410
+ key: 0,
411
+ href: w.url,
412
+ dusk: w.url ? `pagination-${w.label}` : null,
413
+ class: y(["relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700", {
414
+ "cursor-not-allowed": !w.url,
415
+ "hover:bg-gray-50": w.url,
416
+ "bg-gray-100": w.active
417
+ }]),
418
+ onClick: B((M) => t.onClick(w.url), ["prevent"])
419
+ }, {
420
+ default: S(() => [
421
+ T(g(w.label), 1)
422
+ ]),
423
+ _: 2
424
+ }, 1032, ["href", "dusk", "class", "onClick"])) : x("", !0)
425
+ ])
426
+ ]))), 128)),
427
+ (o(), k(L(e(l) ? "a" : "div"), {
428
+ class: y([{
429
+ "cursor-not-allowed text-gray-400": !e(l),
430
+ "text-gray-500 hover:bg-gray-50": e(l)
431
+ }, "relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium"]),
432
+ href: e(l),
433
+ dusk: e(l) ? "pagination-next" : null,
434
+ onClick: q[3] || (q[3] = B((w) => t.onClick(e(l)), ["prevent"]))
435
+ }, {
436
+ default: S(() => [
437
+ r("span", dt, g(e(n).next), 1),
438
+ ht
439
+ ]),
440
+ _: 1
441
+ }, 8, ["class", "href", "dusk"]))
442
+ ])
443
+ ])
444
+ ])) : x("", !0)
445
+ ])) : x("", !0);
446
+ }
447
+ }, pt = /* @__PURE__ */ r("svg", {
448
+ xmlns: "http://www.w3.org/2000/svg",
449
+ class: "h-5 w-5 text-gray-400",
450
+ viewBox: "0 0 20 20",
451
+ fill: "currentColor"
452
+ }, [
453
+ /* @__PURE__ */ r("path", {
454
+ "fill-rule": "evenodd",
455
+ d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",
456
+ "clip-rule": "evenodd"
457
+ })
458
+ ], -1), gt = {
459
+ role: "menu",
460
+ "aria-orientation": "horizontal",
461
+ "aria-labelledby": "add-search-input-menu",
462
+ class: "min-w-max"
463
+ }, vt = ["dusk", "onClick"], mt = {
464
+ __name: "TableAddSearchRow",
465
+ props: {
466
+ searchInputs: {
467
+ type: Object,
468
+ required: !0
469
+ },
470
+ hasSearchInputsWithoutValue: {
471
+ type: Boolean,
472
+ required: !0
473
+ },
474
+ onAdd: {
475
+ type: Function,
476
+ required: !0
477
+ }
478
+ },
479
+ setup(t) {
480
+ const p = t, n = F(null);
481
+ function f(d) {
482
+ p.onAdd(d), n.value.hide();
483
+ }
484
+ return (d, i) => (o(), k(X, {
485
+ ref_key: "dropdown",
486
+ ref: n,
487
+ dusk: "add-search-row-dropdown",
488
+ disabled: !t.hasSearchInputsWithoutValue,
489
+ class: "w-auto"
490
+ }, {
491
+ button: S(() => [
492
+ pt
493
+ ]),
494
+ default: S(() => [
495
+ r("div", gt, [
496
+ (o(!0), u(P, null, O(t.searchInputs, (s, l) => (o(), u("button", {
497
+ key: l,
498
+ dusk: `add-search-row-${s.key}`,
499
+ class: "text-left w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900",
500
+ role: "menuitem",
501
+ onClick: B(($) => f(s.key), ["prevent"])
502
+ }, g(s.label), 9, vt))), 128))
503
+ ])
504
+ ]),
505
+ _: 1
506
+ }, 8, ["disabled"]));
507
+ }
508
+ }, bt = /* @__PURE__ */ r("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }, null, -1), yt = /* @__PURE__ */ r("path", {
509
+ "fill-rule": "evenodd",
510
+ d: "M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",
511
+ "clip-rule": "evenodd"
512
+ }, null, -1), wt = [
513
+ bt,
514
+ yt
515
+ ], xt = {
516
+ role: "menu",
517
+ "aria-orientation": "horizontal",
518
+ "aria-labelledby": "toggle-columns-menu",
519
+ class: "min-w-max"
520
+ }, kt = { class: "px-2" }, _t = { class: "divide-y divide-gray-200" }, $t = { class: "text-sm text-gray-900" }, Ct = ["aria-pressed", "aria-labelledby", "aria-describedby", "dusk", "onClick"], St = /* @__PURE__ */ r("span", { class: "sr-only" }, "Column status", -1), qt = {
521
+ __name: "TableColumns",
522
+ props: {
523
+ columns: {
524
+ type: Object,
525
+ required: !0
526
+ },
527
+ hasHiddenColumns: {
528
+ type: Boolean,
529
+ required: !0
530
+ },
531
+ onChange: {
532
+ type: Function,
533
+ required: !0
534
+ }
535
+ },
536
+ setup(t) {
537
+ const p = t, n = I("activeClasses");
538
+ return (f, d) => (o(), k(X, {
539
+ placement: "bottom-end",
540
+ dusk: "columns-dropdown",
541
+ active: t.hasHiddenColumns
542
+ }, {
543
+ button: S(() => [
544
+ (o(), u("svg", {
545
+ xmlns: "http://www.w3.org/2000/svg",
546
+ class: y(["h-5 w-5", {
547
+ "text-gray-400": !t.hasHiddenColumns,
548
+ [e(n).text]: t.hasHiddenColumns
549
+ }]),
550
+ viewBox: "0 0 20 20",
551
+ fill: "currentColor"
552
+ }, wt, 2))
553
+ ]),
554
+ default: S(() => [
555
+ r("div", xt, [
556
+ r("div", kt, [
557
+ r("ul", _t, [
558
+ (o(!0), u(P, null, O(p.columns, (i, s) => D((o(), u("li", {
559
+ key: s,
560
+ class: "py-2 flex items-center justify-between"
561
+ }, [
562
+ r("p", $t, g(i.label), 1),
563
+ r("button", {
564
+ type: "button",
565
+ class: y(["ml-4 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-light-blue-500", {
566
+ "bg-green-500": !i.hidden,
567
+ "bg-gray-200": i.hidden
568
+ }]),
569
+ "aria-pressed": !i.hidden,
570
+ "aria-labelledby": `toggle-column-${i.key}`,
571
+ "aria-describedby": `toggle-column-${i.key}`,
572
+ dusk: `toggle-column-${i.key}`,
573
+ onClick: B((l) => t.onChange(i.key, i.hidden), ["prevent"])
574
+ }, [
575
+ St,
576
+ r("span", {
577
+ "aria-hidden": "true",
578
+ class: y([{
579
+ "translate-x-5": !i.hidden,
580
+ "translate-x-0": i.hidden
581
+ }, "inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"])
582
+ }, null, 2)
583
+ ], 10, Ct)
584
+ ])), [
585
+ [E, i.can_be_hidden]
586
+ ])), 128))
587
+ ])
588
+ ])
589
+ ])
590
+ ]),
591
+ _: 1
592
+ }, 8, ["active"]));
593
+ }
594
+ }, Ft = /* @__PURE__ */ r("path", {
595
+ "fill-rule": "evenodd",
596
+ d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z",
597
+ "clip-rule": "evenodd"
598
+ }, null, -1), Bt = [
599
+ Ft
600
+ ], Pt = {
601
+ role: "menu",
602
+ "aria-orientation": "horizontal",
603
+ "aria-labelledby": "filter-menu",
604
+ class: "min-w-max"
605
+ }, Ot = { class: "text-xs uppercase tracking-wide bg-gray-100 p-3" }, jt = { class: "p-2" }, Tt = ["name", "value", "onChange"], Lt = ["value"], Vt = {
606
+ __name: "TableFilter",
607
+ props: {
608
+ hasEnabledFilters: {
609
+ type: Boolean,
610
+ required: !0
611
+ },
612
+ filters: {
613
+ type: Object,
614
+ required: !0
615
+ },
616
+ onFilterChange: {
617
+ type: Function,
618
+ required: !0
619
+ }
620
+ },
621
+ setup(t) {
622
+ const p = I("activeClasses");
623
+ return (n, f) => (o(), k(X, {
624
+ placement: "bottom-end",
625
+ dusk: "filters-dropdown",
626
+ active: t.hasEnabledFilters
627
+ }, {
628
+ button: S(() => [
629
+ (o(), u("svg", {
630
+ xmlns: "http://www.w3.org/2000/svg",
631
+ class: y(["h-5 w-5", {
632
+ "text-gray-400": !t.hasEnabledFilters,
633
+ [e(p).text]: t.hasEnabledFilters
634
+ }]),
635
+ viewBox: "0 0 20 20",
636
+ fill: "currentColor"
637
+ }, Bt, 2))
638
+ ]),
639
+ default: S(() => [
640
+ r("div", Pt, [
641
+ (o(!0), u(P, null, O(t.filters, (d, i) => (o(), u("div", { key: i }, [
642
+ r("h3", Ot, g(d.label), 1),
643
+ r("div", jt, [
644
+ d.type === "select" ? (o(), u("select", {
645
+ key: 0,
646
+ name: d.key,
647
+ value: d.value,
648
+ class: "block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm text-sm border-gray-300 rounded-md",
649
+ onChange: (s) => t.onFilterChange(d.key, s.target.value)
650
+ }, [
651
+ (o(!0), u(P, null, O(d.options, (s, l) => (o(), u("option", {
652
+ key: l,
653
+ value: l
654
+ }, g(s), 9, Lt))), 128))
655
+ ], 40, Tt)) : x("", !0)
656
+ ])
657
+ ]))), 128))
658
+ ])
659
+ ]),
660
+ _: 1
661
+ }, 8, ["active"]));
662
+ }
663
+ }, It = { class: "flex items-center justify-start my-3 text-sm" }, Mt = { class: "flex items-center" }, zt = /* @__PURE__ */ r("svg", {
664
+ xmlns: "http://www.w3.org/2000/svg",
665
+ class: "h-5 w-5 text-gray-300",
666
+ viewBox: "0 0 20 20",
667
+ fill: "currentColor"
668
+ }, [
669
+ /* @__PURE__ */ r("path", {
670
+ "fill-rule": "evenodd",
671
+ d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z",
672
+ "clip-rule": "evenodd"
673
+ })
674
+ ], -1), Rt = { class: "text-gray-400 ml-1" }, Dt = ["textContent"], Et = ["onClick"], At = { class: "ml-1" }, Wt = /* @__PURE__ */ r("path", {
675
+ "fill-rule": "evenodd",
676
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
677
+ "clip-rule": "evenodd"
678
+ }, null, -1), Nt = [
679
+ Wt
680
+ ], Ht = {
681
+ __name: "TableActiveFilters",
682
+ props: {
683
+ filters: {
684
+ type: Object,
685
+ required: !0
686
+ },
687
+ onFilterChange: {
688
+ type: Function,
689
+ required: !0
690
+ }
691
+ },
692
+ setup(t) {
693
+ const p = t, n = I("activeClasses"), f = _(() => p.filters.filter((i) => i.value !== null)), d = _(() => f.value.length);
694
+ return (i, s) => (o(), u("div", It, [
695
+ r("div", Mt, [
696
+ zt,
697
+ r("span", Rt, [
698
+ T(g(e(d)) + " active ", 1),
699
+ r("span", {
700
+ textContent: g(e(d) === 1 ? "filter" : "filters")
701
+ }, null, 8, Dt),
702
+ T(":")
703
+ ])
704
+ ]),
705
+ (o(!0), u(P, null, O(e(f), (l) => (o(), u("button", {
706
+ key: l.label,
707
+ class: y(["block group ml-3 flex items-center justify-between px-2 py-1 rounded bg-gray-100", `hover:${e(n).text}`]),
708
+ onClick: ($) => t.onFilterChange(l.key, null)
709
+ }, [
710
+ r("span", {
711
+ class: y(["capitalize text-gray-500", `group-hover:${e(n).text}`])
712
+ }, g(l.label.replace("_", " ")), 3),
713
+ T(":"),
714
+ r("span", At, g(l.options[l.value]), 1),
715
+ (o(), u("svg", {
716
+ class: y([`group-hover:${e(n).text}`, "h-4 w-4 ml-1 text-gray-400"]),
717
+ xmlns: "http://www.w3.org/2000/svg",
718
+ viewBox: "0 0 20 20",
719
+ fill: "currentColor"
720
+ }, Nt, 2))
721
+ ], 10, Et))), 128))
722
+ ]));
723
+ }
724
+ }, Gt = { class: "relative" }, Kt = ["placeholder", "value"], Qt = /* @__PURE__ */ r("div", { class: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none" }, [
725
+ /* @__PURE__ */ r("svg", {
726
+ xmlns: "http://www.w3.org/2000/svg",
727
+ class: "w-5 h-5 text-gray-400",
728
+ viewBox: "0 0 20 20",
729
+ fill: "currentColor"
730
+ }, [
731
+ /* @__PURE__ */ r("path", {
732
+ "fill-rule": "evenodd",
733
+ d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",
734
+ "clip-rule": "evenodd"
735
+ })
736
+ ])
737
+ ], -1), Ut = {
738
+ __name: "TableGlobalSearch",
739
+ props: {
740
+ label: {
741
+ type: String,
742
+ default: "Search...",
743
+ required: !1
744
+ },
745
+ value: {
746
+ type: String,
747
+ default: "",
748
+ required: !1
749
+ },
750
+ onChange: {
751
+ type: Function,
752
+ required: !0
753
+ }
754
+ },
755
+ setup(t) {
756
+ const p = I("activeClasses");
757
+ return (n, f) => (o(), u("div", Gt, [
758
+ r("input", {
759
+ class: y(["block w-full text-sm border-gray-300 rounded-md shadow-sm pl-9", [e(p).focusRing, e(p).focusBorder]]),
760
+ placeholder: t.label,
761
+ value: t.value,
762
+ type: "text",
763
+ name: "global",
764
+ onInput: f[0] || (f[0] = (d) => t.onChange(d.target.value))
765
+ }, null, 42, Kt),
766
+ Qt
767
+ ]));
768
+ }
769
+ }, Yt = { class: "flex rounded-md shadow-sm relative mt-3" }, Jt = ["for"], Xt = /* @__PURE__ */ r("svg", {
770
+ xmlns: "http://www.w3.org/2000/svg",
771
+ class: "h-5 w-5 mr-2 text-gray-400",
772
+ viewBox: "0 0 20 20",
773
+ fill: "currentColor"
774
+ }, [
775
+ /* @__PURE__ */ r("path", {
776
+ "fill-rule": "evenodd",
777
+ d: "M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z",
778
+ "clip-rule": "evenodd"
779
+ })
780
+ ], -1), Zt = ["id", "name", "value", "onInput"], es = { class: "absolute inset-y-0 right-0 pr-3 flex items-center" }, ts = ["dusk", "onClick"], ss = /* @__PURE__ */ r("span", { class: "sr-only" }, "Remove search", -1), ls = /* @__PURE__ */ r("svg", {
781
+ xmlns: "http://www.w3.org/2000/svg",
782
+ class: "h-5 w-5",
783
+ fill: "none",
784
+ viewBox: "0 0 24 24",
785
+ stroke: "currentColor"
786
+ }, [
787
+ /* @__PURE__ */ r("path", {
788
+ "stroke-linecap": "round",
789
+ "stroke-linejoin": "round",
790
+ "stroke-width": "2",
791
+ d: "M6 18L18 6M6 6l12 12"
792
+ })
793
+ ], -1), rs = [
794
+ ss,
795
+ ls
796
+ ], ns = {
797
+ __name: "TableSearchRows",
798
+ props: {
799
+ searchInputs: {
800
+ type: Object,
801
+ required: !0
802
+ },
803
+ forcedVisibleSearchInputs: {
804
+ type: Array,
805
+ required: !0
806
+ },
807
+ onChange: {
808
+ type: Function,
809
+ required: !0
810
+ },
811
+ onRemove: {
812
+ type: Function,
813
+ required: !0
814
+ }
815
+ },
816
+ setup(t) {
817
+ const p = t, n = { el: F([]) };
818
+ let f = _(() => n.el.value);
819
+ function d(i) {
820
+ return p.forcedVisibleSearchInputs.includes(i);
821
+ }
822
+ return J(p.forcedVisibleSearchInputs, (i) => {
823
+ const s = i.length > 0 ? i[i.length - 1] : null;
824
+ !s || xe().then(() => {
825
+ const l = Pe(f.value, ($) => $.__vnode.key === s);
826
+ l && l.focus();
827
+ });
828
+ }, { immediate: !0 }), (i, s) => (o(!0), u(P, null, O(t.searchInputs, (l, $) => D((o(), u("div", {
829
+ key: $,
830
+ class: "px-4 sm:px-0"
831
+ }, [
832
+ r("div", Yt, [
833
+ r("label", {
834
+ for: l.key,
835
+ class: "inline-flex items-center px-4 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 text-sm"
836
+ }, [
837
+ Xt,
838
+ r("span", null, g(l.label), 1)
839
+ ], 8, Jt),
840
+ (o(), u("input", {
841
+ id: l.key,
842
+ ref_for: !0,
843
+ ref: n.el,
844
+ key: l.key,
845
+ name: l.key,
846
+ value: l.value,
847
+ type: "text",
848
+ class: "flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md focus:ring-indigo-500 focus:border-indigo-500 text-sm border-gray-300",
849
+ onInput: (C) => t.onChange(l.key, C.target.value)
850
+ }, null, 40, Zt)),
851
+ r("div", es, [
852
+ r("button", {
853
+ class: "rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",
854
+ dusk: `remove-search-row-${l.key}`,
855
+ onClick: B((C) => t.onRemove(l.key), ["prevent"])
856
+ }, rs, 8, ts)
857
+ ])
858
+ ])
859
+ ])), [
860
+ [E, l.value !== null || d(l.key)]
861
+ ])), 128));
862
+ }
863
+ }, as = /* @__PURE__ */ r("svg", {
864
+ xmlns: "http://www.w3.org/2000/svg",
865
+ class: "h-5 w-5 mr-2 text-gray-400",
866
+ viewBox: "0 0 20 20",
867
+ fill: "currentColor"
868
+ }, [
869
+ /* @__PURE__ */ r("path", {
870
+ "fill-rule": "evenodd",
871
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
872
+ "clip-rule": "evenodd"
873
+ })
874
+ ], -1), os = /* @__PURE__ */ r("span", null, "Reset", -1), is = [
875
+ as,
876
+ os
877
+ ], us = {
878
+ __name: "TableReset",
879
+ props: {
880
+ onClick: {
881
+ type: Function,
882
+ required: !0
883
+ }
884
+ },
885
+ setup(t) {
886
+ return (p, n) => (o(), u("button", {
887
+ ref: "button",
888
+ type: "button",
889
+ dusk: "reset-table",
890
+ class: "w-full bg-white border rounded-md shadow-sm px-4 py-2 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 border-gray-300",
891
+ "aria-haspopup": "true",
892
+ onClick: n[0] || (n[0] = B((...f) => t.onClick && t.onClick(...f), ["prevent"]))
893
+ }, is, 512));
894
+ }
895
+ }, cs = (t, p) => {
896
+ const n = t.__vccOpts || t;
897
+ for (const [f, d] of p)
898
+ n[f] = d;
899
+ return n;
900
+ }, ds = {}, hs = { class: "flex flex-col" }, fs = { class: "-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8" }, ps = { class: "py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8" }, gs = { class: "shadow border-b border-gray-200 relative" };
901
+ function vs(t, p) {
902
+ return o(), u("div", hs, [
903
+ r("div", fs, [
904
+ r("div", ps, [
905
+ r("div", gs, [
906
+ b(t.$slots, "default")
907
+ ])
908
+ ])
909
+ ])
910
+ ]);
911
+ }
912
+ const ms = /* @__PURE__ */ cs(ds, [["render", vs]]), bs = ["dusk"], ys = { class: "flex flex-row flex-wrap justify-start space-x-2 sm:flex-nowrap" }, ws = {
913
+ key: 0,
914
+ class: "order-2 sm:order-1"
915
+ }, xs = {
916
+ key: 1,
917
+ class: "flex flex-row order-1 w-full mb-2 sm:w-auto sm:flex-grow sm:order-2 sm:mb-0"
918
+ }, ks = {
919
+ key: 0,
920
+ class: "order-5 ml-auto sm:order-3"
921
+ }, _s = { class: "min-w-full bg-white divide-y divide-gray-200" }, $s = { class: "bg-gray-50" }, Cs = { class: "px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase" }, Ss = { class: "bg-white divide-y divide-gray-200" }, qs = ["onClick"], Ns = {
922
+ __name: "Table",
923
+ props: {
924
+ inertia: {
925
+ type: Object,
926
+ default: () => ({}),
927
+ required: !1
928
+ },
929
+ name: {
930
+ type: String,
931
+ default: "default",
932
+ required: !1
933
+ },
934
+ striped: {
935
+ type: Boolean,
936
+ default: !1,
937
+ required: !1
938
+ },
939
+ preventOverlappingRequests: {
940
+ type: Boolean,
941
+ default: !0,
942
+ required: !1
943
+ },
944
+ inputDebounceMs: {
945
+ type: Number,
946
+ default: 350,
947
+ required: !1
948
+ },
949
+ preserveScroll: {
950
+ type: [Boolean, String],
951
+ default: !1,
952
+ required: !1
953
+ },
954
+ resource: {
955
+ type: Object,
956
+ default: () => ({}),
957
+ required: !1
958
+ },
959
+ meta: {
960
+ type: Object,
961
+ default: () => ({}),
962
+ required: !1
963
+ },
964
+ data: {
965
+ type: Object,
966
+ default: () => ({}),
967
+ required: !1
968
+ },
969
+ activeClasses: {
970
+ type: Object,
971
+ required: !1,
972
+ default() {
973
+ return {
974
+ text: "text-green-400",
975
+ border: "border-green-300",
976
+ focusRing: "focus:ring-indigo-500",
977
+ focusBorder: "focus:border-indigo-500"
978
+ };
979
+ }
980
+ }
981
+ },
982
+ emits: ["rowClick"],
983
+ setup(t, { emit: p }) {
984
+ const n = t;
985
+ ke("activeClasses", n.activeClasses);
986
+ const f = _e(), d = f ? f.appContext.config.globalProperties.$inertia : n.inertia, i = F(0), s = _(() => {
987
+ let a = d.page.props.queryBuilderProps ? d.page.props.queryBuilderProps[n.name] || {} : {};
988
+ return a._updates = i.value, a;
989
+ }), l = F(s.value), $ = _(() => s.value.pageName), C = F([]), q = F(null), w = _(() => !(s.value.hasToggleableColumns || s.value.hasFilters || s.value.hasSearchInputs || s.value.globalSearch)), A = _(() => Object.keys(n.resource).length === 0 ? n.data : "data" in n.resource ? n.resource.data : n.resource), M = _(() => Object.keys(n.resource).length === 0 ? n.meta : "links" in n.resource && "meta" in n.resource && Object.keys(n.resource.links).length === 4 && "next" in n.resource.links && "prev" in n.resource.links ? {
990
+ ...n.resource.meta,
991
+ next_page_url: n.resource.links.next,
992
+ prev_page_url: n.resource.links.prev
993
+ } : "meta" in n.resource ? n.resource.meta : n.resource), ee = _(() => A.value.length > 0 || M.value.total > 0);
994
+ function fe(a, c) {
995
+ p("rowClick", a, c);
996
+ }
997
+ function pe(a) {
998
+ C.value = C.value.filter((c) => c != a), W(a, null);
999
+ }
1000
+ function te(a) {
1001
+ C.value.push(a);
1002
+ }
1003
+ const ge = _(() => {
1004
+ if (C.value.length > 0)
1005
+ return !0;
1006
+ const a = U.parse(location.search.substring(1));
1007
+ if (a[$.value] > 1)
1008
+ return !0;
1009
+ const h = n.name === "default" ? "" : n.name + "_";
1010
+ let v = !1;
1011
+ return j(["filter", "columns", "cursor", "sort"], (m) => {
1012
+ const R = a[h + m];
1013
+ m === "sort" && R === s.value.defaultSort || R !== void 0 && (v = !0);
1014
+ }), v;
1015
+ });
1016
+ function se() {
1017
+ C.value = [], j(l.value.filters, (a, c) => {
1018
+ l.value.filters[c].value = null;
1019
+ }), j(l.value.searchInputs, (a, c) => {
1020
+ l.value.searchInputs[c].value = null;
1021
+ }), j(l.value.columns, (a, c) => {
1022
+ l.value.columns[c].hidden = a.can_be_hidden ? !s.value.defaultVisibleToggleableColumns.includes(a.key) : !1;
1023
+ }), l.value.sort = null, l.value.cursor = null, l.value.page = 1;
1024
+ }
1025
+ const le = {};
1026
+ function W(a, c) {
1027
+ clearTimeout(le[a]), le[a] = setTimeout(() => {
1028
+ G.value && n.preventOverlappingRequests && G.value.cancel();
1029
+ const h = z("searchInputs", a);
1030
+ l.value.searchInputs[h].value = c, l.value.cursor = null, l.value.page = 1;
1031
+ }, n.inputDebounceMs);
1032
+ }
1033
+ function re(a) {
1034
+ W("global", a);
1035
+ }
1036
+ function N(a, c) {
1037
+ const h = z("filters", a);
1038
+ l.value.filters[h].value = c, l.value.cursor = null, l.value.page = 1;
1039
+ }
1040
+ function ne(a) {
1041
+ l.value.cursor = null, l.value.perPage = a, l.value.page = 1;
1042
+ }
1043
+ function z(a, c) {
1044
+ return Te(l.value[a], (h) => h.key == c);
1045
+ }
1046
+ function ae(a, c) {
1047
+ const h = z("columns", a);
1048
+ l.value.columns[h].hidden = !c;
1049
+ }
1050
+ function ve() {
1051
+ let a = {};
1052
+ return j(l.value.searchInputs, (c) => {
1053
+ c.value !== null && (a[c.key] = c.value);
1054
+ }), j(l.value.filters, (c) => {
1055
+ c.value !== null && (a[c.key] = c.value);
1056
+ }), a;
1057
+ }
1058
+ function me() {
1059
+ const a = l.value.columns;
1060
+ let c = je(a, (v) => !v.hidden), h = Ve(c, (v) => v.key).sort();
1061
+ return Le(h, s.value.defaultVisibleToggleableColumns) ? {} : h;
1062
+ }
1063
+ function be() {
1064
+ const a = ve(), c = me(), h = {};
1065
+ Object.keys(a).length > 0 && (h.filter = a), Object.keys(c).length > 0 && (h.columns = c);
1066
+ const v = l.value.cursor, m = l.value.page, R = l.value.sort, ce = l.value.perPage;
1067
+ return v && (h.cursor = v), m > 1 && (h.page = m), ce > 1 && (h.perPage = ce), R && (h.sort = R), h;
1068
+ }
1069
+ function ye() {
1070
+ const a = U.parse(location.search.substring(1)), c = n.name === "default" ? "" : n.name + "_";
1071
+ j(["filter", "columns", "cursor", "sort"], (v) => {
1072
+ delete a[c + v];
1073
+ }), delete a[$.value], j(be(), (v, m) => {
1074
+ m === "page" ? a[$.value] = v : m === "perPage" ? a.perPage = v : a[c + m] = v;
1075
+ });
1076
+ let h = U.stringify(a, {
1077
+ filter(v, m) {
1078
+ return typeof m == "object" && m !== null ? Ie(m) : m;
1079
+ },
1080
+ skipNulls: !0,
1081
+ strictNullHandling: !0
1082
+ });
1083
+ return (!h || h === $.value + "=1") && (h = ""), h;
1084
+ }
1085
+ const H = F(!1), G = F(null);
1086
+ function K(a) {
1087
+ !a || d.get(
1088
+ a,
1089
+ {},
1090
+ {
1091
+ replace: !0,
1092
+ preserveState: !0,
1093
+ preserveScroll: n.preserveScroll !== !1,
1094
+ onBefore() {
1095
+ H.value = !0;
1096
+ },
1097
+ onCancelToken(c) {
1098
+ G.value = c;
1099
+ },
1100
+ onFinish() {
1101
+ H.value = !1;
1102
+ },
1103
+ onSuccess() {
1104
+ if ("queryBuilderProps" in d.page.props && (l.value.cursor = s.value.cursor, l.value.page = s.value.page), n.preserveScroll === "table-top") {
1105
+ const h = q.value.getBoundingClientRect().top + window.pageYOffset + -8;
1106
+ window.scrollTo({ top: h });
1107
+ }
1108
+ i.value++;
1109
+ }
1110
+ }
1111
+ );
1112
+ }
1113
+ J(l, () => {
1114
+ K(location.pathname + "?" + ye());
1115
+ }, { deep: !0 });
1116
+ const oe = () => {
1117
+ i.value++;
1118
+ };
1119
+ Y(() => {
1120
+ document.addEventListener("inertia:success", oe);
1121
+ }), $e(() => {
1122
+ document.removeEventListener("inertia:success", oe);
1123
+ });
1124
+ function ie(a) {
1125
+ l.value.sort == a ? l.value.sort = `-${a}` : l.value.sort = a, l.value.cursor = null, l.value.page = 1;
1126
+ }
1127
+ function Q(a) {
1128
+ const c = z("columns", a);
1129
+ return !l.value.columns[c].hidden;
1130
+ }
1131
+ function ue(a) {
1132
+ const c = z("columns", a), h = Oe(s.value.columns[c]);
1133
+ return h.onSort = ie, h;
1134
+ }
1135
+ return (a, c) => (o(), k(Ce, null, {
1136
+ default: S(() => [
1137
+ (o(), u("fieldset", {
1138
+ ref_key: "tableFieldset",
1139
+ ref: q,
1140
+ key: `table-${t.name}`,
1141
+ dusk: `table-${t.name}`,
1142
+ class: y(["min-w-0", { "opacity-75": H.value }])
1143
+ }, [
1144
+ r("div", ys, [
1145
+ e(s).hasFilters ? (o(), u("div", ws, [
1146
+ b(a.$slots, "tableFilter", {
1147
+ hasFilters: e(s).hasFilters,
1148
+ hasEnabledFilters: e(s).hasEnabledFilters,
1149
+ filters: e(s).filters,
1150
+ onFilterChange: N
1151
+ }, () => [
1152
+ V(Vt, {
1153
+ "has-enabled-filters": e(s).hasEnabledFilters,
1154
+ filters: e(s).filters,
1155
+ "on-filter-change": N
1156
+ }, null, 8, ["has-enabled-filters", "filters"])
1157
+ ])
1158
+ ])) : x("", !0),
1159
+ e(s).globalSearch ? (o(), u("div", xs, [
1160
+ b(a.$slots, "tableGlobalSearch", {
1161
+ hasGlobalSearch: e(s).globalSearch,
1162
+ label: e(s).globalSearch ? e(s).globalSearch.label : null,
1163
+ value: e(s).globalSearch ? e(s).globalSearch.value : null,
1164
+ onChange: re
1165
+ }, () => [
1166
+ e(s).globalSearch ? (o(), k(Ut, {
1167
+ key: 0,
1168
+ class: "flex-grow",
1169
+ label: e(s).globalSearch.label,
1170
+ value: e(s).globalSearch.value,
1171
+ "on-change": re
1172
+ }, null, 8, ["label", "value"])) : x("", !0)
1173
+ ])
1174
+ ])) : x("", !0),
1175
+ b(a.$slots, "tableReset", {
1176
+ canBeReset: "canBeReset",
1177
+ onClick: se
1178
+ }, () => [
1179
+ e(ge) ? (o(), u("div", ks, [
1180
+ V(us, { "on-click": se })
1181
+ ])) : x("", !0)
1182
+ ]),
1183
+ b(a.$slots, "tableAddSearchRow", {
1184
+ hasSearchInputs: e(s).hasSearchInputs,
1185
+ hasSearchInputsWithoutValue: e(s).hasSearchInputsWithoutValue,
1186
+ searchInputs: e(s).searchInputsWithoutGlobal,
1187
+ onAdd: te
1188
+ }, () => [
1189
+ e(s).hasSearchInputs ? (o(), k(mt, {
1190
+ key: 0,
1191
+ class: "order-3 sm:order-4",
1192
+ "search-inputs": e(s).searchInputsWithoutGlobal,
1193
+ "has-search-inputs-without-value": e(s).hasSearchInputsWithoutValue,
1194
+ "on-add": te
1195
+ }, null, 8, ["search-inputs", "has-search-inputs-without-value"])) : x("", !0)
1196
+ ]),
1197
+ b(a.$slots, "tableColumns", {
1198
+ hasColumns: e(s).hasToggleableColumns,
1199
+ columns: e(s).columns,
1200
+ hasHiddenColumns: e(s).hasHiddenColumns,
1201
+ onChange: ae
1202
+ }, () => [
1203
+ e(s).hasToggleableColumns ? (o(), k(qt, {
1204
+ key: 0,
1205
+ class: "order-4 sm:order-5",
1206
+ columns: e(s).columns,
1207
+ "has-hidden-columns": e(s).hasHiddenColumns,
1208
+ "on-change": ae
1209
+ }, null, 8, ["columns", "has-hidden-columns"])) : x("", !0)
1210
+ ])
1211
+ ]),
1212
+ b(a.$slots, "tableSearchRows", {
1213
+ hasSearchRowsWithValue: e(s).hasSearchInputsWithValue,
1214
+ searchInputs: e(s).searchInputsWithoutGlobal,
1215
+ forcedVisibleSearchInputs: C.value,
1216
+ onChange: W
1217
+ }, () => [
1218
+ e(s).hasSearchInputsWithValue || C.value.length > 0 ? (o(), k(ns, {
1219
+ key: 0,
1220
+ "search-inputs": e(s).searchInputsWithoutGlobal,
1221
+ "forced-visible-search-inputs": C.value,
1222
+ "on-change": W,
1223
+ "on-remove": pe
1224
+ }, null, 8, ["search-inputs", "forced-visible-search-inputs"])) : x("", !0)
1225
+ ]),
1226
+ e(s).hasEnabledFilters ? (o(), k(Ht, {
1227
+ key: 0,
1228
+ filters: e(s).filters,
1229
+ "on-filter-change": N
1230
+ }, null, 8, ["filters"])) : x("", !0),
1231
+ b(a.$slots, "tableWrapper", { meta: e(M) }, () => [
1232
+ V(ms, {
1233
+ class: y({ "mt-3": !e(w) })
1234
+ }, {
1235
+ default: S(() => [
1236
+ b(a.$slots, "table", {}, () => [
1237
+ r("table", _s, [
1238
+ r("thead", $s, [
1239
+ b(a.$slots, "head", {
1240
+ show: Q,
1241
+ sortBy: ie,
1242
+ header: ue
1243
+ }, () => [
1244
+ r("tr", Cs, [
1245
+ (o(!0), u(P, null, O(e(s).columns, (h) => (o(), k(Ke, {
1246
+ key: `table-${t.name}-header-${h.key}`,
1247
+ cell: ue(h.key)
1248
+ }, null, 8, ["cell"]))), 128))
1249
+ ])
1250
+ ])
1251
+ ]),
1252
+ r("tbody", Ss, [
1253
+ b(a.$slots, "body", { show: Q }, () => [
1254
+ (o(!0), u(P, null, O(e(A), (h, v) => (o(), u("tr", {
1255
+ key: `table-${t.name}-row-${v}`,
1256
+ class: y(["", {
1257
+ "bg-gray-50": t.striped && v % 2,
1258
+ "hover:bg-gray-100": t.striped,
1259
+ "hover:bg-gray-50": !t.striped
1260
+ }]),
1261
+ onClick: (m) => fe(h, v)
1262
+ }, [
1263
+ (o(!0), u(P, null, O(e(s).columns, (m) => D((o(), u("td", {
1264
+ key: `table-${t.name}-row-${v}-column-${m.key}`,
1265
+ class: "px-6 py-4 text-sm text-gray-500 whitespace-nowrap"
1266
+ }, [
1267
+ b(a.$slots, `cell(${m.key})`, { item: h }, () => [
1268
+ T(g(h[m.key]), 1)
1269
+ ])
1270
+ ])), [
1271
+ [E, Q(m.key)]
1272
+ ])), 128))
1273
+ ], 10, qs))), 128))
1274
+ ])
1275
+ ])
1276
+ ])
1277
+ ]),
1278
+ b(a.$slots, "pagination", {
1279
+ onClick: K,
1280
+ hasData: e(ee),
1281
+ meta: e(M),
1282
+ perPageOptions: e(s).perPageOptions,
1283
+ onPerPageChange: ne
1284
+ }, () => [
1285
+ V(ft, {
1286
+ "on-click": K,
1287
+ "has-data": e(ee),
1288
+ meta: e(M),
1289
+ "per-page-options": e(s).perPageOptions,
1290
+ "on-per-page-change": ne
1291
+ }, null, 8, ["has-data", "meta", "per-page-options"])
1292
+ ])
1293
+ ]),
1294
+ _: 3
1295
+ }, 8, ["class"])
1296
+ ])
1297
+ ], 10, bs))
1298
+ ]),
1299
+ _: 3
1300
+ }));
1301
+ }
1302
+ };
1303
+ export {
1304
+ X as ButtonWithDropdown,
1305
+ Ke as HeaderCell,
1306
+ Me as OnClickOutside,
1307
+ ft as Pagination,
1308
+ Ns as Table,
1309
+ mt as TableAddSearchRow,
1310
+ qt as TableColumns,
1311
+ Vt as TableFilter,
1312
+ Ut as TableGlobalSearch,
1313
+ us as TableReset,
1314
+ ns as TableSearchRows,
1315
+ ms as TableWrapper,
1316
+ he as getTranslations,
1317
+ As as setTranslation,
1318
+ Ws as setTranslations
1319
+ };