@dootix-developer/inertiajs-tables-laravel-query-builder
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -1,17 +0,17 @@ | ||
import { ref as S, onMounted as U, onBeforeUnmount as ve, openBlock as a, createElementBlock as h, renderSlot as b, watch as Y, createBlock as w, withCtx as $, createElementVNode as s, normalizeClass as _, withModifiers as B, withDirectives as z, vShow as D, resolveDynamicComponent as j, toDisplayString as p, createCommentVNode as k, computed as x, Fragment as P, renderList as O, unref as t, createVNode as M, createTextVNode as L, nextTick as me, getCurrentInstance as be, onUnmounted as ye, Transition as we } from "vue"; | ||
import { createPopper as ke } from "@popperjs/core/lib/popper-lite"; | ||
import xe from "@popperjs/core/lib/modifiers/preventOverflow"; | ||
import _e from "@popperjs/core/lib/modifiers/flip"; | ||
import $e from "lodash-es/uniq"; | ||
import { usePage as K, router as Ce } from "@inertiajs/vue3"; | ||
import Se from "lodash-es/find"; | ||
import { ref as C, onMounted as U, onBeforeUnmount as pe, openBlock as n, createElementBlock as d, renderSlot as m, watch as Y, createBlock as y, withCtx as _, createElementVNode as a, normalizeClass as k, withModifiers as q, withDirectives as z, vShow as D, resolveDynamicComponent as j, toDisplayString as f, createCommentVNode as w, computed as x, Fragment as F, renderList as P, unref as O, createVNode as M, createTextVNode as L, inject as me, nextTick as be, getCurrentInstance as ye, onUnmounted as we, Transition as ke } from "vue"; | ||
import { createPopper as xe } from "@popperjs/core/lib/popper-lite"; | ||
import _e from "@popperjs/core/lib/modifiers/preventOverflow"; | ||
import $e from "@popperjs/core/lib/modifiers/flip"; | ||
import Ce from "lodash-es/uniq"; | ||
import { usePage as K, router as Se } from "@inertiajs/vue3"; | ||
import qe from "lodash-es/find"; | ||
import Q from "qs"; | ||
import qe from "lodash-es/clone"; | ||
import Be from "lodash-es/filter"; | ||
import Fe from "lodash-es/findKey"; | ||
import Be from "lodash-es/clone"; | ||
import Fe from "lodash-es/filter"; | ||
import Pe from "lodash-es/findKey"; | ||
import T from "lodash-es/forEach"; | ||
import Pe from "lodash-es/isEqual"; | ||
import Oe from "lodash-es/map"; | ||
import Te from "lodash-es/pickBy"; | ||
const je = { | ||
import Oe from "lodash-es/isEqual"; | ||
import Te from "lodash-es/map"; | ||
import je from "lodash-es/pickBy"; | ||
const Ve = { | ||
__name: "OnClickOutside", | ||
@@ -25,17 +25,17 @@ props: { | ||
setup(e) { | ||
const o = e, i = S(null), r = S(null); | ||
const s = e, i = C(null), t = C(null); | ||
return U(() => { | ||
i.value = (l) => { | ||
l.target === r.value || r.value.contains(l.target) || o.do(); | ||
l.target === t.value || t.value.contains(l.target) || s.do(); | ||
}, document.addEventListener("click", i.value), document.addEventListener("touchstart", i.value); | ||
}), ve(() => { | ||
}), pe(() => { | ||
document.removeEventListener("click", i.value), document.removeEventListener("touchstart", i.value); | ||
}), (l, c) => (a(), h("div", { | ||
}), (l, o) => (n(), d("div", { | ||
ref_key: "root", | ||
ref: r | ||
ref: t | ||
}, [ | ||
b(l.$slots, "default") | ||
m(l.$slots, "default") | ||
], 512)); | ||
} | ||
}, Ie = { class: "relative" }, Ve = ["dusk", "disabled", "onClick"], Le = { class: "mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" }, J = { | ||
}, Ie = { class: "relative" }, Le = ["dusk", "disabled", "onClick"], Me = { class: "mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" }, J = { | ||
__name: "ButtonWithDropdown", | ||
@@ -64,44 +64,44 @@ props: { | ||
}, | ||
setup(e, { expose: o }) { | ||
const i = e, r = S(!1), l = S(null); | ||
function c() { | ||
r.value = !r.value; | ||
setup(e, { expose: s }) { | ||
const i = e, t = C(!1), l = C(null); | ||
function o() { | ||
t.value = !t.value; | ||
} | ||
function u() { | ||
r.value = !1; | ||
t.value = !1; | ||
} | ||
Y(r, () => { | ||
Y(t, () => { | ||
l.value.update(); | ||
}); | ||
const g = S(null), q = S(null); | ||
const v = C(null), S = C(null); | ||
return U(() => { | ||
l.value = ke(g.value, q.value, { | ||
l.value = xe(v.value, S.value, { | ||
placement: i.placement, | ||
modifiers: [_e, xe] | ||
modifiers: [$e, _e] | ||
}); | ||
}), o({ hide: u }), (F, C) => (a(), w(je, { do: u }, { | ||
default: $(() => [ | ||
s("div", Ie, [ | ||
s("button", { | ||
}), s({ hide: u }), (B, $) => (n(), y(Ve, { do: u }, { | ||
default: _(() => [ | ||
a("div", Ie, [ | ||
a("button", { | ||
ref_key: "button", | ||
ref: g, | ||
ref: v, | ||
type: "button", | ||
dusk: e.dusk, | ||
disabled: e.disabled, | ||
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-green-300": e.active, "border-gray-300": !e.active, "cursor-not-allowed": e.disabled }]), | ||
class: k(["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-green-300": e.active, "border-gray-300": !e.active, "cursor-not-allowed": e.disabled }]), | ||
"aria-haspopup": "true", | ||
onClick: B(c, ["prevent"]) | ||
onClick: q(o, ["prevent"]) | ||
}, [ | ||
b(F.$slots, "button") | ||
], 10, Ve), | ||
z(s("div", { | ||
m(B.$slots, "button") | ||
], 10, Le), | ||
z(a("div", { | ||
ref_key: "tooltip", | ||
ref: q, | ||
ref: S, | ||
class: "absolute z-10" | ||
}, [ | ||
s("div", Le, [ | ||
b(F.$slots, "default") | ||
a("div", Me, [ | ||
m(B.$slots, "default") | ||
]) | ||
], 512), [ | ||
[D, r.value] | ||
[D, t.value] | ||
]) | ||
@@ -113,15 +113,15 @@ ]) | ||
} | ||
}, Me = { class: "py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900" }, ze = { class: "flex flex-row items-center" }, De = { class: "uppercase" }, Re = ["sorted"], Ee = { | ||
}, ze = { class: "py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900" }, De = { class: "flex flex-row items-center" }, Re = { class: "uppercase" }, Ee = ["sorted"], We = { | ||
key: 0, | ||
fill: "currentColor", | ||
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" | ||
}, We = { | ||
}, Ne = { | ||
key: 1, | ||
fill: "currentColor", | ||
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" | ||
}, Ne = { | ||
}, Ae = { | ||
key: 2, | ||
fill: "currentColor", | ||
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" | ||
}, Ae = { | ||
}, He = { | ||
__name: "HeaderCell", | ||
@@ -135,22 +135,22 @@ props: { | ||
setup(e) { | ||
const o = e; | ||
const s = e; | ||
function i() { | ||
o.cell.sortable && o.cell.onSort(o.cell.key); | ||
s.cell.sortable && s.cell.onSort(s.cell.key); | ||
} | ||
return (r, l) => z((a(), h("th", Me, [ | ||
(a(), w(j(e.cell.sortable ? "button" : "div"), { | ||
return (t, l) => z((n(), d("th", ze, [ | ||
(n(), y(j(e.cell.sortable ? "button" : "div"), { | ||
class: "w-full", | ||
dusk: e.cell.sortable ? `sort-${e.cell.key}` : null, | ||
onClick: B(i, ["prevent"]) | ||
onClick: q(i, ["prevent"]) | ||
}, { | ||
default: $(() => [ | ||
s("span", ze, [ | ||
b(r.$slots, "label", {}, () => [ | ||
s("span", De, p(e.cell.label), 1) | ||
default: _(() => [ | ||
a("span", De, [ | ||
m(t.$slots, "label", {}, () => [ | ||
a("span", Re, f(e.cell.label), 1) | ||
]), | ||
b(r.$slots, "sort", {}, () => [ | ||
e.cell.sortable ? (a(), h("svg", { | ||
m(t.$slots, "sort", {}, () => [ | ||
e.cell.sortable ? (n(), d("svg", { | ||
key: 0, | ||
"aria-hidden": "true", | ||
class: _(["w-3 h-3 ml-2", { | ||
class: k(["w-3 h-3 ml-2", { | ||
"text-gray-400": !e.cell.sorted, | ||
@@ -163,6 +163,6 @@ "text-green-500": e.cell.sorted | ||
}, [ | ||
e.cell.sorted ? k("", !0) : (a(), h("path", Ee)), | ||
e.cell.sorted === "asc" ? (a(), h("path", We)) : k("", !0), | ||
e.cell.sorted === "desc" ? (a(), h("path", Ne)) : k("", !0) | ||
], 10, Re)) : k("", !0) | ||
e.cell.sorted ? w("", !0) : (n(), d("path", We)), | ||
e.cell.sorted === "asc" ? (n(), d("path", Ne)) : w("", !0), | ||
e.cell.sorted === "desc" ? (n(), d("path", Ae)) : w("", !0) | ||
], 10, Ee)) : w("", !0) | ||
]) | ||
@@ -191,9 +191,9 @@ ]) | ||
} | ||
function Br(e, o) { | ||
X.translations[e] = o; | ||
function Fl(e, s) { | ||
X.translations[e] = s; | ||
} | ||
function Fr(e) { | ||
function Pl(e) { | ||
X.translations = e; | ||
} | ||
const He = ["dusk", "value"], Ge = ["value"], ie = { | ||
const Ge = ["dusk", "value"], Ke = ["value"], ie = { | ||
__name: "PerPageSelector", | ||
@@ -224,7 +224,7 @@ props: { | ||
setup(e) { | ||
const o = e, i = ce(), r = x(() => { | ||
let l = [...o.options]; | ||
return l.push(parseInt(o.value)), $e(l).sort((c, u) => c - u); | ||
const s = e, i = ce(), t = x(() => { | ||
let l = [...s.options]; | ||
return l.push(parseInt(s.value)), Ce(l).sort((o, u) => o - u); | ||
}); | ||
return (l, c) => (a(), h("select", { | ||
return (l, o) => (n(), d("select", { | ||
name: "per_page", | ||
@@ -234,14 +234,14 @@ dusk: e.dusk, | ||
class: "block focus:ring-indigo-500 focus:border-indigo-500 min-w-max shadow-sm text-sm border-gray-300 rounded-md", | ||
onChange: c[0] || (c[0] = (u) => e.onChange(u.target.value)) | ||
onChange: o[0] || (o[0] = (u) => e.onChange(u.target.value)) | ||
}, [ | ||
(a(!0), h(P, null, O(t(r), (u) => (a(), h("option", { | ||
(n(!0), d(F, null, P(t.value, (u) => (n(), d("option", { | ||
key: u, | ||
value: u | ||
}, p(u) + " " + p(t(i).per_page), 9, Ge))), 128)) | ||
], 40, He)); | ||
}, f(u) + " " + f(O(i).per_page), 9, Ke))), 128)) | ||
], 40, Ge)); | ||
} | ||
}, Ke = { | ||
}, Qe = { | ||
key: 0, | ||
class: "bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6" | ||
}, Qe = { key: 0 }, Ue = /* @__PURE__ */ s("svg", { | ||
}, Ue = { key: 0 }, Ye = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -254,3 +254,3 @@ class: "h-5 w-5 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"stroke-linecap": "round", | ||
@@ -260,3 +260,3 @@ "stroke-linejoin": "round", | ||
}) | ||
], -1), Ye = { class: "hidden sm:inline ml-2" }, Je = { class: "hidden sm:inline mr-2" }, Xe = /* @__PURE__ */ s("svg", { | ||
], -1), Je = { class: "hidden sm:inline ml-2" }, Xe = { class: "hidden sm:inline mr-2" }, Ze = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -269,3 +269,3 @@ class: "h-5 w-5 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"stroke-linecap": "round", | ||
@@ -275,9 +275,9 @@ "stroke-linejoin": "round", | ||
}) | ||
], -1), Ze = { | ||
], -1), et = { | ||
key: 2, | ||
class: "hidden sm:flex-1 sm:flex sm:items-center sm:justify-between" | ||
}, et = { class: "flex flex-row space-x-4 items-center grow" }, tt = { class: "hidden lg:block text-sm text-gray-700 grow" }, rt = { class: "font-medium" }, lt = { class: "font-medium" }, nt = { class: "font-medium" }, st = { | ||
}, tt = { class: "flex flex-row space-x-4 items-center grow" }, lt = { class: "hidden lg:block text-sm text-gray-700 grow" }, rt = { class: "font-medium" }, at = { class: "font-medium" }, nt = { class: "font-medium" }, st = { | ||
class: "relative z-0 inline-flex rounded-md shadow-sm -space-x-px", | ||
"aria-label": "Pagination" | ||
}, at = { class: "sr-only" }, ot = /* @__PURE__ */ s("svg", { | ||
}, ot = { class: "sr-only" }, ut = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -288,3 +288,3 @@ class: "h-5 w-5", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -294,3 +294,3 @@ 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", | ||
}) | ||
], -1), ut = { class: "sr-only" }, it = /* @__PURE__ */ s("svg", { | ||
], -1), it = { class: "sr-only" }, ct = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -301,3 +301,3 @@ class: "h-5 w-5", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -307,3 +307,3 @@ 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", | ||
}) | ||
], -1), ct = { | ||
], -1), dt = { | ||
__name: "Pagination", | ||
@@ -340,21 +340,21 @@ props: { | ||
setup(e) { | ||
const o = e, i = ce(), r = x(() => "links" in c.value ? c.value.links.length > 0 : !1), l = x(() => Object.keys(c.value).length > 0), c = x(() => o.meta), u = x(() => "prev_page_url" in c.value ? c.value.prev_page_url : null), g = x(() => "next_page_url" in c.value ? c.value.next_page_url : null), q = x(() => parseInt(c.value.per_page)); | ||
return (F, C) => t(l) ? (a(), h("nav", Ke, [ | ||
!e.hasData || t(c).total < 1 ? (a(), h("p", Qe, p(t(i).no_results_found), 1)) : k("", !0), | ||
e.hasData ? (a(), h("div", { | ||
const s = e, i = ce(), t = x(() => "links" in o.value ? o.value.links.length > 0 : !1), l = x(() => Object.keys(o.value).length > 0), o = x(() => s.meta), u = x(() => "prev_page_url" in o.value ? o.value.prev_page_url : null), v = x(() => "next_page_url" in o.value ? o.value.next_page_url : null), S = x(() => parseInt(o.value.per_page)); | ||
return (B, $) => l.value ? (n(), d("nav", Qe, [ | ||
!e.hasData || o.value.total < 1 ? (n(), d("p", Ue, f(O(i).no_results_found), 1)) : w("", !0), | ||
e.hasData ? (n(), d("div", { | ||
key: 1, | ||
class: _(["flex-1 flex justify-between", { "sm:hidden": t(r) }]) | ||
class: k(["flex-1 flex justify-between", { "sm:hidden": t.value }]) | ||
}, [ | ||
(a(), w(j(t(u) ? "a" : "div"), { | ||
class: _([{ | ||
"cursor-not-allowed text-gray-400": !t(u), | ||
"text-gray-700 hover:text-gray-500": t(u) | ||
(n(), y(j(u.value ? "a" : "div"), { | ||
class: k([{ | ||
"cursor-not-allowed text-gray-400": !u.value, | ||
"text-gray-700 hover:text-gray-500": u.value | ||
}, "relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]), | ||
href: t(u), | ||
dusk: t(u) ? "pagination-simple-previous" : null, | ||
onClick: C[0] || (C[0] = B((y) => e.onClick(t(u)), ["prevent"])) | ||
href: u.value, | ||
dusk: u.value ? "pagination-simple-previous" : null, | ||
onClick: $[0] || ($[0] = q((b) => e.onClick(u.value), ["prevent"])) | ||
}, { | ||
default: $(() => [ | ||
Ue, | ||
s("span", Ye, p(t(i).previous), 1) | ||
default: _(() => [ | ||
Ye, | ||
a("span", Je, f(O(i).previous), 1) | ||
]), | ||
@@ -365,88 +365,88 @@ _: 1 | ||
dusk: "per-page-mobile", | ||
value: t(q), | ||
value: S.value, | ||
options: e.perPageOptions, | ||
"on-change": e.onPerPageChange | ||
}, null, 8, ["value", "options", "on-change"]), | ||
(a(), w(j(t(g) ? "a" : "div"), { | ||
class: _([{ | ||
"cursor-not-allowed text-gray-400": !t(g), | ||
"text-gray-700 hover:text-gray-500": t(g) | ||
(n(), y(j(v.value ? "a" : "div"), { | ||
class: k([{ | ||
"cursor-not-allowed text-gray-400": !v.value, | ||
"text-gray-700 hover:text-gray-500": v.value | ||
}, "ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]), | ||
href: t(g), | ||
dusk: t(g) ? "pagination-simple-next" : null, | ||
onClick: C[1] || (C[1] = B((y) => e.onClick(t(g)), ["prevent"])) | ||
href: v.value, | ||
dusk: v.value ? "pagination-simple-next" : null, | ||
onClick: $[1] || ($[1] = q((b) => e.onClick(v.value), ["prevent"])) | ||
}, { | ||
default: $(() => [ | ||
s("span", Je, p(t(i).next), 1), | ||
Xe | ||
default: _(() => [ | ||
a("span", Xe, f(O(i).next), 1), | ||
Ze | ||
]), | ||
_: 1 | ||
}, 8, ["class", "href", "dusk"])) | ||
], 2)) : k("", !0), | ||
e.hasData && t(r) ? (a(), h("div", Ze, [ | ||
s("div", et, [ | ||
], 2)) : w("", !0), | ||
e.hasData && t.value ? (n(), d("div", et, [ | ||
a("div", tt, [ | ||
M(ie, { | ||
dusk: "per-page-full", | ||
value: t(q), | ||
value: S.value, | ||
options: e.perPageOptions, | ||
"on-change": e.onPerPageChange | ||
}, null, 8, ["value", "options", "on-change"]), | ||
s("p", tt, [ | ||
s("span", rt, p(t(c).from), 1), | ||
L(" " + p(t(i).to) + " ", 1), | ||
s("span", lt, p(t(c).to), 1), | ||
L(" " + p(t(i).of) + " ", 1), | ||
s("span", nt, p(t(c).total), 1), | ||
L(" " + p(t(i).results), 1) | ||
a("p", lt, [ | ||
a("span", rt, f(o.value.from), 1), | ||
L(" " + f(O(i).to) + " ", 1), | ||
a("span", at, f(o.value.to), 1), | ||
L(" " + f(O(i).of) + " ", 1), | ||
a("span", nt, f(o.value.total), 1), | ||
L(" " + f(O(i).results), 1) | ||
]) | ||
]), | ||
s("div", null, [ | ||
s("nav", st, [ | ||
(a(), w(j(t(u) ? "a" : "div"), { | ||
class: _([{ | ||
"cursor-not-allowed text-gray-400": !t(u), | ||
"text-gray-500 hover:bg-gray-50": t(u) | ||
a("div", null, [ | ||
a("nav", st, [ | ||
(n(), y(j(u.value ? "a" : "div"), { | ||
class: k([{ | ||
"cursor-not-allowed text-gray-400": !u.value, | ||
"text-gray-500 hover:bg-gray-50": u.value | ||
}, "relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium"]), | ||
href: t(u), | ||
dusk: t(u) ? "pagination-previous" : null, | ||
onClick: C[2] || (C[2] = B((y) => e.onClick(t(u)), ["prevent"])) | ||
href: u.value, | ||
dusk: u.value ? "pagination-previous" : null, | ||
onClick: $[2] || ($[2] = q((b) => e.onClick(u.value), ["prevent"])) | ||
}, { | ||
default: $(() => [ | ||
s("span", at, p(t(i).previous), 1), | ||
ot | ||
default: _(() => [ | ||
a("span", ot, f(O(i).previous), 1), | ||
ut | ||
]), | ||
_: 1 | ||
}, 8, ["class", "href", "dusk"])), | ||
(a(!0), h(P, null, O(t(c).links, (y, E) => (a(), h("div", { key: E }, [ | ||
b(F.$slots, "link", {}, () => [ | ||
!isNaN(y.label) || y.label === "..." ? (a(), w(j(y.url ? "a" : "div"), { | ||
(n(!0), d(F, null, P(o.value.links, (b, E) => (n(), d("div", { key: E }, [ | ||
m(B.$slots, "link", {}, () => [ | ||
!isNaN(b.label) || b.label === "..." ? (n(), y(j(b.url ? "a" : "div"), { | ||
key: 0, | ||
href: y.url, | ||
dusk: y.url ? `pagination-${y.label}` : null, | ||
class: _(["relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700", { | ||
"cursor-not-allowed": !y.url, | ||
"hover:bg-gray-50": y.url, | ||
"bg-gray-100": y.active | ||
href: b.url, | ||
dusk: b.url ? `pagination-${b.label}` : null, | ||
class: k(["relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700", { | ||
"cursor-not-allowed": !b.url, | ||
"hover:bg-gray-50": b.url, | ||
"bg-gray-100": b.active | ||
}]), | ||
onClick: B((W) => e.onClick(y.url), ["prevent"]) | ||
onClick: q((W) => e.onClick(b.url), ["prevent"]) | ||
}, { | ||
default: $(() => [ | ||
L(p(y.label), 1) | ||
default: _(() => [ | ||
L(f(b.label), 1) | ||
]), | ||
_: 2 | ||
}, 1032, ["href", "dusk", "class", "onClick"])) : k("", !0) | ||
}, 1032, ["href", "dusk", "class", "onClick"])) : w("", !0) | ||
]) | ||
]))), 128)), | ||
(a(), w(j(t(g) ? "a" : "div"), { | ||
class: _([{ | ||
"cursor-not-allowed text-gray-400": !t(g), | ||
"text-gray-500 hover:bg-gray-50": t(g) | ||
(n(), y(j(v.value ? "a" : "div"), { | ||
class: k([{ | ||
"cursor-not-allowed text-gray-400": !v.value, | ||
"text-gray-500 hover:bg-gray-50": v.value | ||
}, "relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium"]), | ||
href: t(g), | ||
dusk: t(g) ? "pagination-next" : null, | ||
onClick: C[3] || (C[3] = B((y) => e.onClick(t(g)), ["prevent"])) | ||
href: v.value, | ||
dusk: v.value ? "pagination-next" : null, | ||
onClick: $[3] || ($[3] = q((b) => e.onClick(v.value), ["prevent"])) | ||
}, { | ||
default: $(() => [ | ||
s("span", ut, p(t(i).next), 1), | ||
it | ||
default: _(() => [ | ||
a("span", it, f(O(i).next), 1), | ||
ct | ||
]), | ||
@@ -457,6 +457,6 @@ _: 1 | ||
]) | ||
])) : k("", !0) | ||
])) : k("", !0); | ||
])) : w("", !0) | ||
])) : w("", !0); | ||
} | ||
}, dt = /* @__PURE__ */ s("svg", { | ||
}, ht = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -467,3 +467,3 @@ class: "h-5 w-5 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -473,3 +473,3 @@ 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", | ||
}) | ||
], -1), ht = { | ||
], -1), vt = { | ||
role: "menu", | ||
@@ -496,7 +496,7 @@ "aria-orientation": "horizontal", | ||
setup(e) { | ||
const o = e, i = S(null); | ||
function r(l) { | ||
o.onAdd(l), i.value.hide(); | ||
const s = e, i = C(null); | ||
function t(l) { | ||
s.onAdd(l), i.value.hide(); | ||
} | ||
return (l, c) => (a(), w(J, { | ||
return (l, o) => (n(), y(J, { | ||
ref_key: "dropdown", | ||
@@ -508,14 +508,14 @@ ref: i, | ||
}, { | ||
button: $(() => [ | ||
dt | ||
button: _(() => [ | ||
ht | ||
]), | ||
default: $(() => [ | ||
s("div", ht, [ | ||
(a(!0), h(P, null, O(e.searchInputs, (u, g) => (a(), h("button", { | ||
key: g, | ||
default: _(() => [ | ||
a("div", vt, [ | ||
(n(!0), d(F, null, P(e.searchInputs, (u, v) => (n(), d("button", { | ||
key: v, | ||
dusk: `add-search-row-${u.key}`, | ||
class: "text-left w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900", | ||
role: "menuitem", | ||
onClick: B((q) => r(u.key), ["prevent"]) | ||
}, p(u.label), 9, ft))), 128)) | ||
onClick: q((S) => t(u.key), ["prevent"]) | ||
}, f(u.label), 9, ft))), 128)) | ||
]) | ||
@@ -526,10 +526,10 @@ ]), | ||
} | ||
}, pt = /* @__PURE__ */ s("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }, null, -1), vt = /* @__PURE__ */ s("path", { | ||
}, pt = /* @__PURE__ */ a("path", { d: "M10 12a2 2 0 100-4 2 2 0 000 4z" }, null, -1), mt = /* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), mt = [ | ||
}, null, -1), bt = [ | ||
pt, | ||
vt | ||
], bt = { | ||
mt | ||
], yt = { | ||
role: "menu", | ||
@@ -539,3 +539,3 @@ "aria-orientation": "horizontal", | ||
class: "min-w-max" | ||
}, yt = { class: "px-2" }, wt = { class: "divide-y divide-gray-200" }, kt = { class: "text-sm text-gray-900" }, xt = ["aria-pressed", "aria-labelledby", "aria-describedby", "dusk", "onClick"], _t = /* @__PURE__ */ s("span", { class: "sr-only" }, "Column status", -1), $t = { | ||
}, wt = { class: "px-2" }, kt = { class: "divide-y divide-gray-200" }, xt = { class: "text-sm text-gray-900" }, _t = ["aria-pressed", "aria-labelledby", "aria-describedby", "dusk", "onClick"], $t = /* @__PURE__ */ a("span", { class: "sr-only" }, "Column status", -1), Ct = { | ||
__name: "TableColumns", | ||
@@ -557,4 +557,4 @@ props: { | ||
setup(e) { | ||
const o = e; | ||
return (i, r) => (a(), w(J, { | ||
const s = e; | ||
return (i, t) => (n(), y(J, { | ||
placement: "bottom-end", | ||
@@ -564,6 +564,6 @@ dusk: "columns-dropdown", | ||
}, { | ||
button: $(() => [ | ||
(a(), h("svg", { | ||
button: _(() => [ | ||
(n(), d("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: _(["h-5 w-5", { | ||
class: k(["h-5 w-5", { | ||
"text-gray-400": !e.hasHiddenColumns, | ||
@@ -574,16 +574,16 @@ "text-green-400": e.hasHiddenColumns | ||
fill: "currentColor" | ||
}, mt, 2)) | ||
}, bt, 2)) | ||
]), | ||
default: $(() => [ | ||
s("div", bt, [ | ||
s("div", yt, [ | ||
s("ul", wt, [ | ||
(a(!0), h(P, null, O(o.columns, (l, c) => z((a(), h("li", { | ||
key: c, | ||
default: _(() => [ | ||
a("div", yt, [ | ||
a("div", wt, [ | ||
a("ul", kt, [ | ||
(n(!0), d(F, null, P(s.columns, (l, o) => z((n(), d("li", { | ||
key: o, | ||
class: "py-2 flex items-center justify-between" | ||
}, [ | ||
s("p", kt, p(l.label), 1), | ||
s("button", { | ||
a("p", xt, f(l.label), 1), | ||
a("button", { | ||
type: "button", | ||
class: _(["ml-4 relative inline-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", { | ||
class: k(["ml-4 relative inline-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", { | ||
"bg-green-500": !l.hidden, | ||
@@ -596,8 +596,8 @@ "bg-gray-200": l.hidden | ||
dusk: `toggle-column-${l.key}`, | ||
onClick: B((u) => e.onChange(l.key, l.hidden), ["prevent"]) | ||
onClick: q((u) => e.onChange(l.key, l.hidden), ["prevent"]) | ||
}, [ | ||
_t, | ||
s("span", { | ||
$t, | ||
a("span", { | ||
"aria-hidden": "true", | ||
class: _([{ | ||
class: k([{ | ||
"translate-x-5": !l.hidden, | ||
@@ -607,3 +607,3 @@ "translate-x-0": l.hidden | ||
}, null, 2) | ||
], 10, xt) | ||
], 10, _t) | ||
])), [ | ||
@@ -619,9 +619,9 @@ [D, l.can_be_hidden] | ||
} | ||
}, Ct = /* @__PURE__ */ s("path", { | ||
}, St = /* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
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", | ||
"clip-rule": "evenodd" | ||
}, null, -1), St = [ | ||
Ct | ||
], qt = { | ||
}, null, -1), qt = [ | ||
St | ||
], Bt = { | ||
role: "menu", | ||
@@ -631,3 +631,3 @@ "aria-orientation": "horizontal", | ||
class: "min-w-max" | ||
}, Bt = { class: "text-xs uppercase tracking-wide bg-gray-100 p-3" }, Ft = { class: "p-2" }, Pt = ["name", "value", "onChange"], Ot = ["value"], Tt = { | ||
}, Ft = { class: "text-xs uppercase tracking-wide bg-gray-100 p-3" }, Pt = { class: "p-2" }, Ot = ["name", "value", "onChange"], Tt = ["value"], jt = { | ||
__name: "TableFilter", | ||
@@ -649,3 +649,3 @@ props: { | ||
setup(e) { | ||
return (o, i) => (a(), w(J, { | ||
return (s, i) => (n(), y(J, { | ||
placement: "bottom-end", | ||
@@ -655,6 +655,6 @@ dusk: "filters-dropdown", | ||
}, { | ||
button: $(() => [ | ||
(a(), h("svg", { | ||
button: _(() => [ | ||
(n(), d("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
class: _(["h-5 w-5", { | ||
class: k(["h-5 w-5", { | ||
"text-gray-400": !e.hasEnabledFilters, | ||
@@ -665,21 +665,21 @@ "text-green-400": e.hasEnabledFilters | ||
fill: "currentColor" | ||
}, St, 2)) | ||
}, qt, 2)) | ||
]), | ||
default: $(() => [ | ||
s("div", qt, [ | ||
(a(!0), h(P, null, O(e.filters, (r, l) => (a(), h("div", { key: l }, [ | ||
s("h3", Bt, p(r.label), 1), | ||
s("div", Ft, [ | ||
r.type === "select" ? (a(), h("select", { | ||
default: _(() => [ | ||
a("div", Bt, [ | ||
(n(!0), d(F, null, P(e.filters, (t, l) => (n(), d("div", { key: l }, [ | ||
a("h3", Ft, f(t.label), 1), | ||
a("div", Pt, [ | ||
t.type === "select" ? (n(), d("select", { | ||
key: 0, | ||
name: r.key, | ||
value: r.value, | ||
name: t.key, | ||
value: t.value, | ||
class: "block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm text-sm border-gray-300 rounded-md", | ||
onChange: (c) => e.onFilterChange(r.key, c.target.value) | ||
onChange: (o) => e.onFilterChange(t.key, o.target.value) | ||
}, [ | ||
(a(!0), h(P, null, O(r.options, (c, u) => (a(), h("option", { | ||
(n(!0), d(F, null, P(t.options, (o, u) => (n(), d("option", { | ||
key: u, | ||
value: u | ||
}, p(c), 9, Ot))), 128)) | ||
], 40, Pt)) : k("", !0) | ||
}, f(o), 9, Tt))), 128)) | ||
], 40, Ot)) : w("", !0) | ||
]) | ||
@@ -692,4 +692,4 @@ ]))), 128)) | ||
} | ||
}, jt = { class: "relative" }, It = ["placeholder", "value"], Vt = /* @__PURE__ */ s("div", { class: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" }, [ | ||
/* @__PURE__ */ s("svg", { | ||
}, Vt = { class: "relative" }, It = ["placeholder", "value"], Lt = /* @__PURE__ */ a("div", { class: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" }, [ | ||
/* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -700,3 +700,3 @@ class: "h-5 w-5 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -707,3 +707,3 @@ 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", | ||
]) | ||
], -1), Lt = { | ||
], -1), Mt = { | ||
__name: "TableGlobalSearch", | ||
@@ -724,8 +724,23 @@ props: { | ||
required: !0 | ||
}, | ||
preStyle: { | ||
type: String, | ||
default: "default", | ||
required: !1 | ||
} | ||
}, | ||
setup(e) { | ||
return (o, i) => (a(), h("div", jt, [ | ||
s("input", { | ||
class: "block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300", | ||
const s = { | ||
inertia_table: { | ||
global_search: { | ||
input: { | ||
default: "block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300", | ||
dootix: "block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-cyan-500 focus:border-blue-500 border-gray-300" | ||
} | ||
} | ||
} | ||
}, i = me("themeVariables"), t = (l, o) => "inertia_table" in i && "global_search" in i.inertia_table && l in i.inertia_table.global_search && o in i.inertia_table.global_search[l] ? i.inertia_table.global_search[l][o] : s.inertia_table.global_search[l][o]; | ||
return (l, o) => (n(), d("div", Vt, [ | ||
a("input", { | ||
class: k(t("input", e.preStyle)), | ||
placeholder: e.label, | ||
@@ -735,8 +750,8 @@ value: e.value, | ||
name: "global", | ||
onInput: i[0] || (i[0] = (r) => e.onChange(r.target.value)) | ||
}, null, 40, It), | ||
Vt | ||
onInput: o[0] || (o[0] = (u) => e.onChange(u.target.value)) | ||
}, null, 42, It), | ||
Lt | ||
])); | ||
} | ||
}, Mt = { class: "flex rounded-md shadow-sm relative mt-3" }, zt = ["for"], Dt = /* @__PURE__ */ s("svg", { | ||
}, zt = { class: "flex rounded-md shadow-sm relative mt-3" }, Dt = ["for"], Rt = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -747,3 +762,3 @@ class: "h-5 w-5 mr-2 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -753,3 +768,3 @@ 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", | ||
}) | ||
], -1), Rt = ["id", "name", "value", "onInput"], Et = { class: "absolute inset-y-0 right-0 pr-3 flex items-center" }, Wt = ["dusk", "onClick"], Nt = /* @__PURE__ */ s("span", { class: "sr-only" }, "Remove search", -1), At = /* @__PURE__ */ s("svg", { | ||
], -1), Et = ["id", "name", "value", "onInput"], Wt = { class: "absolute inset-y-0 right-0 pr-3 flex items-center" }, Nt = ["dusk", "onClick"], At = /* @__PURE__ */ a("span", { class: "sr-only" }, "Remove search", -1), Ht = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -761,3 +776,3 @@ class: "h-5 w-5", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"stroke-linecap": "round", | ||
@@ -768,6 +783,6 @@ "stroke-linejoin": "round", | ||
}) | ||
], -1), Ht = [ | ||
Nt, | ||
At | ||
], Gt = { | ||
], -1), Gt = [ | ||
At, | ||
Ht | ||
], Kt = { | ||
__name: "TableSearchRows", | ||
@@ -793,49 +808,49 @@ props: { | ||
setup(e) { | ||
const o = e, i = { el: S([]) }; | ||
let r = x(() => i.el.value); | ||
function l(c) { | ||
return o.forcedVisibleSearchInputs.includes(c); | ||
const s = e, i = { el: C([]) }; | ||
let t = x(() => i.el.value); | ||
function l(o) { | ||
return s.forcedVisibleSearchInputs.includes(o); | ||
} | ||
return Y(o.forcedVisibleSearchInputs, (c) => { | ||
const u = c.length > 0 ? c[c.length - 1] : null; | ||
!u || me().then(() => { | ||
const g = Se(r.value, (q) => q.__vnode.key === u); | ||
g && g.focus(); | ||
return Y(s.forcedVisibleSearchInputs, (o) => { | ||
const u = o.length > 0 ? o[o.length - 1] : null; | ||
!u || be().then(() => { | ||
const v = qe(t.value, (S) => S.__vnode.key === u); | ||
v && v.focus(); | ||
}); | ||
}, { immediate: !0 }), (c, u) => (a(!0), h(P, null, O(e.searchInputs, (g, q) => z((a(), h("div", { | ||
key: q, | ||
}, { immediate: !0 }), (o, u) => (n(!0), d(F, null, P(e.searchInputs, (v, S) => z((n(), d("div", { | ||
key: S, | ||
class: "px-4 sm:px-0" | ||
}, [ | ||
s("div", Mt, [ | ||
s("label", { | ||
for: g.key, | ||
a("div", zt, [ | ||
a("label", { | ||
for: v.key, | ||
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" | ||
}, [ | ||
Dt, | ||
s("span", null, p(g.label), 1) | ||
], 8, zt), | ||
(a(), h("input", { | ||
id: g.key, | ||
Rt, | ||
a("span", null, f(v.label), 1) | ||
], 8, Dt), | ||
(n(), d("input", { | ||
id: v.key, | ||
ref_for: !0, | ||
ref: i.el, | ||
key: g.key, | ||
name: g.key, | ||
value: g.value, | ||
key: v.key, | ||
name: v.key, | ||
value: v.value, | ||
type: "text", | ||
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", | ||
onInput: (F) => e.onChange(g.key, F.target.value) | ||
}, null, 40, Rt)), | ||
s("div", Et, [ | ||
s("button", { | ||
onInput: (B) => e.onChange(v.key, B.target.value) | ||
}, null, 40, Et)), | ||
a("div", Wt, [ | ||
a("button", { | ||
class: "rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", | ||
dusk: `remove-search-row-${g.key}`, | ||
onClick: B((F) => e.onRemove(g.key), ["prevent"]) | ||
}, Ht, 8, Wt) | ||
dusk: `remove-search-row-${v.key}`, | ||
onClick: q((B) => e.onRemove(v.key), ["prevent"]) | ||
}, Gt, 8, Nt) | ||
]) | ||
]) | ||
])), [ | ||
[D, g.value !== null || l(g.key)] | ||
[D, v.value !== null || l(v.key)] | ||
])), 128)); | ||
} | ||
}, Kt = /* @__PURE__ */ s("svg", { | ||
}, Qt = /* @__PURE__ */ a("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -846,3 +861,3 @@ class: "h-5 w-5 mr-2 text-gray-400", | ||
}, [ | ||
/* @__PURE__ */ s("path", { | ||
/* @__PURE__ */ a("path", { | ||
"fill-rule": "evenodd", | ||
@@ -852,6 +867,6 @@ 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", | ||
}) | ||
], -1), Qt = /* @__PURE__ */ s("span", null, "Reset", -1), Ut = [ | ||
Kt, | ||
Qt | ||
], Yt = { | ||
], -1), Ut = /* @__PURE__ */ a("span", null, "Reset", -1), Yt = [ | ||
Qt, | ||
Ut | ||
], Jt = { | ||
__name: "TableReset", | ||
@@ -865,3 +880,3 @@ props: { | ||
setup(e) { | ||
return (o, i) => (a(), h("button", { | ||
return (s, i) => (n(), d("button", { | ||
ref: "button", | ||
@@ -872,17 +887,17 @@ type: "button", | ||
"aria-haspopup": "true", | ||
onClick: i[0] || (i[0] = B((...r) => e.onClick && e.onClick(...r), ["prevent"])) | ||
}, Ut, 512)); | ||
onClick: i[0] || (i[0] = q((...t) => e.onClick && e.onClick(...t), ["prevent"])) | ||
}, Yt, 512)); | ||
} | ||
}, Jt = (e, o) => { | ||
}, Xt = (e, s) => { | ||
const i = e.__vccOpts || e; | ||
for (const [r, l] of o) | ||
i[r] = l; | ||
for (const [t, l] of s) | ||
i[t] = l; | ||
return i; | ||
}, Xt = {}, Zt = { class: "flow-root" }, er = { class: "-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8" }, tr = { class: "inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8" }, rr = { class: "overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg" }; | ||
function lr(e, o) { | ||
return a(), h("div", Zt, [ | ||
s("div", er, [ | ||
s("div", tr, [ | ||
s("div", rr, [ | ||
b(e.$slots, "default") | ||
}, Zt = {}, el = { class: "flow-root" }, tl = { class: "-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8" }, ll = { class: "inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8" }, rl = { class: "overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg" }; | ||
function al(e, s) { | ||
return n(), d("div", el, [ | ||
a("div", tl, [ | ||
a("div", ll, [ | ||
a("div", rl, [ | ||
m(e.$slots, "default") | ||
]) | ||
@@ -893,9 +908,9 @@ ]) | ||
} | ||
const nr = /* @__PURE__ */ Jt(Xt, [["render", lr]]), sr = ["dusk"], ar = { class: "flex flex-row flex-wrap sm:flex-nowrap justify-start px-4 sm:px-0" }, or = { class: "order-2 sm:order-1 mr-2 sm:mr-4" }, ur = { | ||
const nl = /* @__PURE__ */ Xt(Zt, [["render", al]]), sl = ["dusk"], ol = { class: "flex flex-row flex-wrap sm:flex-nowrap justify-start px-4 sm:px-0" }, ul = { class: "order-2 sm:order-1 mr-2 sm:mr-4" }, il = { | ||
key: 0, | ||
class: "flex flex-row w-full sm:w-auto sm:grow order-1 sm:order-2 mb-2 sm:mb-0 sm:mr-4" | ||
}, ir = { | ||
}, cl = { | ||
key: 0, | ||
class: "order-5 sm:order-3 sm:mr-4 ml-auto" | ||
}, cr = { class: "min-w-full divide-y divide-gray-300" }, dr = { class: "bg-gray-50" }, hr = { class: "divide-y divide-gray-200 bg-white" }, Pr = { | ||
}, dl = { class: "min-w-full divide-y divide-gray-300" }, hl = { class: "bg-gray-50" }, vl = { class: "divide-y divide-gray-200 bg-white" }, Ol = { | ||
__name: "Table", | ||
@@ -947,20 +962,25 @@ props: { | ||
required: !1 | ||
}, | ||
preStyle: { | ||
type: String, | ||
default: "default", | ||
required: !1 | ||
} | ||
}, | ||
setup(e) { | ||
const o = e; | ||
be(); | ||
const i = S(0), r = x(() => { | ||
let n = K().props.queryBuilderProps ? K().props.queryBuilderProps[o.name] || {} : {}; | ||
return n._updates = i.value, n; | ||
}), l = S(r.value), c = x(() => r.value.pageName), u = S([]), g = S(null), q = x(() => !(r.value.hasToggleableColumns || r.value.hasFilters || r.value.hasSearchInputs || r.value.globalSearch)), F = x(() => Object.keys(o.resource).length === 0 ? o.data : "data" in o.resource ? o.resource.data : o.resource), C = x(() => Object.keys(o.resource).length === 0 ? o.meta : "links" in o.resource && "meta" in o.resource && Object.keys(o.resource.links).length === 4 && "next" in o.resource.links && "prev" in o.resource.links ? { | ||
...o.resource.meta, | ||
next_page_url: o.resource.links.next, | ||
prev_page_url: o.resource.links.prev | ||
} : "meta" in o.resource ? o.resource.meta : o.resource), y = x(() => F.value.length > 0 || C.value.total > 0); | ||
function E(n) { | ||
u.value = u.value.filter((d) => d != n), R(n, null); | ||
const s = e; | ||
ye(); | ||
const i = C(0), t = x(() => { | ||
let r = K().props.queryBuilderProps ? K().props.queryBuilderProps[s.name] || {} : {}; | ||
return r._updates = i.value, r; | ||
}), l = C(t.value), o = x(() => t.value.pageName), u = C([]), v = C(null), S = x(() => !(t.value.hasToggleableColumns || t.value.hasFilters || t.value.hasSearchInputs || t.value.globalSearch)), B = x(() => Object.keys(s.resource).length === 0 ? s.data : "data" in s.resource ? s.resource.data : s.resource), $ = x(() => Object.keys(s.resource).length === 0 ? s.meta : "links" in s.resource && "meta" in s.resource && Object.keys(s.resource.links).length === 4 && "next" in s.resource.links && "prev" in s.resource.links ? { | ||
...s.resource.meta, | ||
next_page_url: s.resource.links.next, | ||
prev_page_url: s.resource.links.prev | ||
} : "meta" in s.resource ? s.resource.meta : s.resource), b = x(() => B.value.length > 0 || $.value.total > 0); | ||
function E(r) { | ||
u.value = u.value.filter((c) => c != r), R(r, null); | ||
} | ||
function W(n) { | ||
u.value.push(n); | ||
function W(r) { | ||
u.value.push(r); | ||
} | ||
@@ -970,75 +990,75 @@ const de = x(() => { | ||
return !0; | ||
const n = Q.parse(location.search.substring(1)); | ||
if (n[c.value] > 1) | ||
const r = Q.parse(location.search.substring(1)); | ||
if (r[o.value] > 1) | ||
return !0; | ||
const f = o.name === "default" ? "" : o.name + "_"; | ||
let v = !1; | ||
return T(["filter", "columns", "cursor", "sort"], (m) => { | ||
const V = n[f + m]; | ||
m === "sort" && V === r.value.defaultSort || V !== void 0 && (v = !0); | ||
}), v; | ||
const h = s.name === "default" ? "" : s.name + "_"; | ||
let g = !1; | ||
return T(["filter", "columns", "cursor", "sort"], (p) => { | ||
const I = r[h + p]; | ||
p === "sort" && I === t.value.defaultSort || I !== void 0 && (g = !0); | ||
}), g; | ||
}); | ||
function Z() { | ||
u.value = [], T(l.value.filters, (n, d) => { | ||
l.value.filters[d].value = null; | ||
}), T(l.value.searchInputs, (n, d) => { | ||
l.value.searchInputs[d].value = null; | ||
}), T(l.value.columns, (n, d) => { | ||
l.value.columns[d].hidden = n.can_be_hidden ? !r.value.defaultVisibleToggleableColumns.includes(n.key) : !1; | ||
u.value = [], T(l.value.filters, (r, c) => { | ||
l.value.filters[c].value = null; | ||
}), T(l.value.searchInputs, (r, c) => { | ||
l.value.searchInputs[c].value = null; | ||
}), T(l.value.columns, (r, c) => { | ||
l.value.columns[c].hidden = r.can_be_hidden ? !t.value.defaultVisibleToggleableColumns.includes(r.key) : !1; | ||
}), l.value.sort = null, l.value.cursor = null, l.value.page = 1; | ||
} | ||
const ee = {}; | ||
function R(n, d) { | ||
clearTimeout(ee[n]), ee[n] = setTimeout(() => { | ||
A.value && o.preventOverlappingRequests && A.value.cancel(); | ||
const f = I("searchInputs", n); | ||
l.value.searchInputs[f].value = d, l.value.cursor = null, l.value.page = 1; | ||
}, o.inputDebounceMs); | ||
function R(r, c) { | ||
clearTimeout(ee[r]), ee[r] = setTimeout(() => { | ||
A.value && s.preventOverlappingRequests && A.value.cancel(); | ||
const h = V("searchInputs", r); | ||
l.value.searchInputs[h].value = c, l.value.cursor = null, l.value.page = 1; | ||
}, s.inputDebounceMs); | ||
} | ||
function te(n) { | ||
R("global", n); | ||
function te(r) { | ||
R("global", r); | ||
} | ||
function re(n, d) { | ||
const f = I("filters", n); | ||
l.value.filters[f].value = d, l.value.cursor = null, l.value.page = 1; | ||
function le(r, c) { | ||
const h = V("filters", r); | ||
l.value.filters[h].value = c, l.value.cursor = null, l.value.page = 1; | ||
} | ||
function le(n) { | ||
l.value.cursor = null, l.value.perPage = n, l.value.page = 1; | ||
function re(r) { | ||
l.value.cursor = null, l.value.perPage = r, l.value.page = 1; | ||
} | ||
function I(n, d) { | ||
return Fe(l.value[n], (f) => f.key == d); | ||
function V(r, c) { | ||
return Pe(l.value[r], (h) => h.key == c); | ||
} | ||
function ne(n, d) { | ||
const f = I("columns", n); | ||
l.value.columns[f].hidden = !d; | ||
function ae(r, c) { | ||
const h = V("columns", r); | ||
l.value.columns[h].hidden = !c; | ||
} | ||
function he() { | ||
let n = {}; | ||
return T(l.value.searchInputs, (d) => { | ||
d.value !== null && (n[d.key] = d.value); | ||
}), T(l.value.filters, (d) => { | ||
d.value !== null && (n[d.key] = d.value); | ||
}), n; | ||
let r = {}; | ||
return T(l.value.searchInputs, (c) => { | ||
c.value !== null && (r[c.key] = c.value); | ||
}), T(l.value.filters, (c) => { | ||
c.value !== null && (r[c.key] = c.value); | ||
}), r; | ||
} | ||
function ve() { | ||
const r = l.value.columns; | ||
let c = Fe(r, (g) => !g.hidden), h = Te(c, (g) => g.key).sort(); | ||
return Oe(h, t.value.defaultVisibleToggleableColumns) ? {} : h; | ||
} | ||
function fe() { | ||
const n = l.value.columns; | ||
let d = Be(n, (v) => !v.hidden), f = Oe(d, (v) => v.key).sort(); | ||
return Pe(f, r.value.defaultVisibleToggleableColumns) ? {} : f; | ||
const r = he(), c = ve(), h = {}; | ||
Object.keys(r).length > 0 && (h.filter = r), Object.keys(c).length > 0 && (h.columns = c); | ||
const g = l.value.cursor, p = l.value.page, I = l.value.sort, ue = l.value.perPage; | ||
return g && (h.cursor = g), p > 1 && (h.page = p), ue > 1 && (h.perPage = ue), I && (h.sort = I), h; | ||
} | ||
function ge() { | ||
const n = he(), d = fe(), f = {}; | ||
Object.keys(n).length > 0 && (f.filter = n), Object.keys(d).length > 0 && (f.columns = d); | ||
const v = l.value.cursor, m = l.value.page, V = l.value.sort, ue = l.value.perPage; | ||
return v && (f.cursor = v), m > 1 && (f.page = m), ue > 1 && (f.perPage = ue), V && (f.sort = V), f; | ||
} | ||
function pe() { | ||
const n = Q.parse(location.search.substring(1)), d = o.name === "default" ? "" : o.name + "_"; | ||
T(["filter", "columns", "cursor", "sort"], (v) => { | ||
delete n[d + v]; | ||
}), delete n[c.value], T(ge(), (v, m) => { | ||
m === "page" ? n[c.value] = v : m === "perPage" ? n.perPage = v : n[d + m] = v; | ||
const r = Q.parse(location.search.substring(1)), c = s.name === "default" ? "" : s.name + "_"; | ||
T(["filter", "columns", "cursor", "sort"], (g) => { | ||
delete r[c + g]; | ||
}), delete r[o.value], T(fe(), (g, p) => { | ||
p === "page" ? r[o.value] = g : p === "perPage" ? r.perPage = g : r[c + p] = g; | ||
}); | ||
let f = Q.stringify(n, { | ||
filter(v, m) { | ||
return typeof m == "object" && m !== null ? Te(m) : m; | ||
let h = Q.stringify(r, { | ||
filter(g, p) { | ||
return typeof p == "object" && p !== null ? je(p) : p; | ||
}, | ||
@@ -1048,8 +1068,8 @@ skipNulls: !0, | ||
}); | ||
return (!f || f === c.value + "=1") && (f = ""), f; | ||
return (!h || h === o.value + "=1") && (h = ""), h; | ||
} | ||
const N = S(!1), A = S(null); | ||
function H(n) { | ||
!n || Ce.get( | ||
n, | ||
const N = C(!1), A = C(null); | ||
function H(r) { | ||
!r || Se.get( | ||
r, | ||
{}, | ||
@@ -1059,8 +1079,8 @@ { | ||
preserveState: !0, | ||
preserveScroll: o.preserveScroll !== !1, | ||
preserveScroll: s.preserveScroll !== !1, | ||
onBefore() { | ||
N.value = !0; | ||
}, | ||
onCancelToken(d) { | ||
A.value = d; | ||
onCancelToken(c) { | ||
A.value = c; | ||
}, | ||
@@ -1071,5 +1091,5 @@ onFinish() { | ||
onSuccess() { | ||
if ("queryBuilderProps" in K().props && (l.value.cursor = r.value.cursor, l.value.page = r.value.page), o.preserveScroll === "table-top") { | ||
const f = g.value.getBoundingClientRect().top + window.pageYOffset + -8; | ||
window.scrollTo({ top: f }); | ||
if ("queryBuilderProps" in K().props && (l.value.cursor = t.value.cursor, l.value.page = t.value.page), s.preserveScroll === "table-top") { | ||
const h = v.value.getBoundingClientRect().top + window.pageYOffset + -8; | ||
window.scrollTo({ top: h }); | ||
} | ||
@@ -1082,132 +1102,133 @@ i.value++; | ||
Y(l, () => { | ||
H(location.pathname + "?" + pe()); | ||
H(location.pathname + "?" + ge()); | ||
}, { deep: !0 }); | ||
const se = () => { | ||
const ne = () => { | ||
i.value++; | ||
}; | ||
U(() => { | ||
document.addEventListener("inertia:success", se); | ||
}), ye(() => { | ||
document.removeEventListener("inertia:success", se); | ||
document.addEventListener("inertia:success", ne); | ||
}), we(() => { | ||
document.removeEventListener("inertia:success", ne); | ||
}); | ||
function ae(n) { | ||
l.value.sort == n ? l.value.sort = `-${n}` : l.value.sort = n, l.value.cursor = null, l.value.page = 1; | ||
function se(r) { | ||
l.value.sort == r ? l.value.sort = `-${r}` : l.value.sort = r, l.value.cursor = null, l.value.page = 1; | ||
} | ||
function G(n) { | ||
const d = I("columns", n); | ||
return !l.value.columns[d].hidden; | ||
function G(r) { | ||
const c = V("columns", r); | ||
return !l.value.columns[c].hidden; | ||
} | ||
function oe(n) { | ||
const d = I("columns", n), f = qe(r.value.columns[d]); | ||
return f.onSort = ae, f; | ||
function oe(r) { | ||
const c = V("columns", r), h = Be(t.value.columns[c]); | ||
return h.onSort = se, h; | ||
} | ||
return (n, d) => (a(), w(we, null, { | ||
default: $(() => [ | ||
(a(), h("fieldset", { | ||
return (r, c) => (n(), y(ke, null, { | ||
default: _(() => [ | ||
(n(), d("fieldset", { | ||
ref_key: "tableFieldset", | ||
ref: g, | ||
ref: v, | ||
key: `table-${e.name}`, | ||
dusk: `table-${e.name}`, | ||
class: _(["min-w-0", { "opacity-75": N.value }]) | ||
class: k(["min-w-0", { "opacity-75": N.value }]) | ||
}, [ | ||
s("div", ar, [ | ||
s("div", or, [ | ||
b(n.$slots, "tableFilter", { | ||
hasFilters: t(r).hasFilters, | ||
hasEnabledFilters: t(r).hasEnabledFilters, | ||
filters: t(r).filters, | ||
onFilterChange: re | ||
a("div", ol, [ | ||
a("div", ul, [ | ||
m(r.$slots, "tableFilter", { | ||
hasFilters: t.value.hasFilters, | ||
hasEnabledFilters: t.value.hasEnabledFilters, | ||
filters: t.value.filters, | ||
onFilterChange: le | ||
}, () => [ | ||
t(r).hasFilters ? (a(), w(Tt, { | ||
t.value.hasFilters ? (n(), y(jt, { | ||
key: 0, | ||
"has-enabled-filters": t(r).hasEnabledFilters, | ||
filters: t(r).filters, | ||
"on-filter-change": re | ||
}, null, 8, ["has-enabled-filters", "filters"])) : k("", !0) | ||
"has-enabled-filters": t.value.hasEnabledFilters, | ||
filters: t.value.filters, | ||
"on-filter-change": le | ||
}, null, 8, ["has-enabled-filters", "filters"])) : w("", !0) | ||
]) | ||
]), | ||
t(r).globalSearch ? (a(), h("div", ur, [ | ||
b(n.$slots, "tableGlobalSearch", { | ||
hasGlobalSearch: t(r).globalSearch, | ||
label: t(r).globalSearch ? t(r).globalSearch.label : null, | ||
value: t(r).globalSearch ? t(r).globalSearch.value : null, | ||
t.value.globalSearch ? (n(), d("div", il, [ | ||
m(r.$slots, "tableGlobalSearch", { | ||
hasGlobalSearch: t.value.globalSearch, | ||
label: t.value.globalSearch ? t.value.globalSearch.label : null, | ||
value: t.value.globalSearch ? t.value.globalSearch.value : null, | ||
onChange: te | ||
}, () => [ | ||
t(r).globalSearch ? (a(), w(Lt, { | ||
t.value.globalSearch ? (n(), y(Mt, { | ||
key: 0, | ||
class: "grow", | ||
label: t(r).globalSearch.label, | ||
value: t(r).globalSearch.value, | ||
"on-change": te | ||
}, null, 8, ["label", "value"])) : k("", !0) | ||
label: t.value.globalSearch.label, | ||
value: t.value.globalSearch.value, | ||
"on-change": te, | ||
"pre-style": e.preStyle | ||
}, null, 8, ["label", "value", "pre-style"])) : w("", !0) | ||
]) | ||
])) : k("", !0), | ||
b(n.$slots, "tableReset", { | ||
])) : w("", !0), | ||
m(r.$slots, "tableReset", { | ||
canBeReset: "canBeReset", | ||
onClick: Z | ||
}, () => [ | ||
t(de) ? (a(), h("div", ir, [ | ||
M(Yt, { "on-click": Z }) | ||
])) : k("", !0) | ||
de.value ? (n(), d("div", cl, [ | ||
M(Jt, { "on-click": Z }) | ||
])) : w("", !0) | ||
]), | ||
b(n.$slots, "tableAddSearchRow", { | ||
hasSearchInputs: t(r).hasSearchInputs, | ||
hasSearchInputsWithoutValue: t(r).hasSearchInputsWithoutValue, | ||
searchInputs: t(r).searchInputsWithoutGlobal, | ||
m(r.$slots, "tableAddSearchRow", { | ||
hasSearchInputs: t.value.hasSearchInputs, | ||
hasSearchInputsWithoutValue: t.value.hasSearchInputsWithoutValue, | ||
searchInputs: t.value.searchInputsWithoutGlobal, | ||
onAdd: W | ||
}, () => [ | ||
t(r).hasSearchInputs ? (a(), w(gt, { | ||
t.value.hasSearchInputs ? (n(), y(gt, { | ||
key: 0, | ||
class: "order-3 sm:order-4 mr-2 sm:mr-4", | ||
"search-inputs": t(r).searchInputsWithoutGlobal, | ||
"has-search-inputs-without-value": t(r).hasSearchInputsWithoutValue, | ||
"search-inputs": t.value.searchInputsWithoutGlobal, | ||
"has-search-inputs-without-value": t.value.hasSearchInputsWithoutValue, | ||
"on-add": W | ||
}, null, 8, ["search-inputs", "has-search-inputs-without-value"])) : k("", !0) | ||
}, null, 8, ["search-inputs", "has-search-inputs-without-value"])) : w("", !0) | ||
]), | ||
b(n.$slots, "tableColumns", { | ||
hasColumns: t(r).hasToggleableColumns, | ||
columns: t(r).columns, | ||
hasHiddenColumns: t(r).hasHiddenColumns, | ||
onChange: ne | ||
m(r.$slots, "tableColumns", { | ||
hasColumns: t.value.hasToggleableColumns, | ||
columns: t.value.columns, | ||
hasHiddenColumns: t.value.hasHiddenColumns, | ||
onChange: ae | ||
}, () => [ | ||
t(r).hasToggleableColumns ? (a(), w($t, { | ||
t.value.hasToggleableColumns ? (n(), y(Ct, { | ||
key: 0, | ||
class: "order-4 mr-4 sm:mr-0 sm:order-5", | ||
columns: t(r).columns, | ||
"has-hidden-columns": t(r).hasHiddenColumns, | ||
"on-change": ne | ||
}, null, 8, ["columns", "has-hidden-columns"])) : k("", !0) | ||
columns: t.value.columns, | ||
"has-hidden-columns": t.value.hasHiddenColumns, | ||
"on-change": ae | ||
}, null, 8, ["columns", "has-hidden-columns"])) : w("", !0) | ||
]) | ||
]), | ||
b(n.$slots, "tableSearchRows", { | ||
hasSearchRowsWithValue: t(r).hasSearchInputsWithValue, | ||
searchInputs: t(r).searchInputsWithoutGlobal, | ||
m(r.$slots, "tableSearchRows", { | ||
hasSearchRowsWithValue: t.value.hasSearchInputsWithValue, | ||
searchInputs: t.value.searchInputsWithoutGlobal, | ||
forcedVisibleSearchInputs: u.value, | ||
onChange: R | ||
}, () => [ | ||
t(r).hasSearchInputsWithValue || u.value.length > 0 ? (a(), w(Gt, { | ||
t.value.hasSearchInputsWithValue || u.value.length > 0 ? (n(), y(Kt, { | ||
key: 0, | ||
"search-inputs": t(r).searchInputsWithoutGlobal, | ||
"search-inputs": t.value.searchInputsWithoutGlobal, | ||
"forced-visible-search-inputs": u.value, | ||
"on-change": R, | ||
"on-remove": E | ||
}, null, 8, ["search-inputs", "forced-visible-search-inputs"])) : k("", !0) | ||
}, null, 8, ["search-inputs", "forced-visible-search-inputs"])) : w("", !0) | ||
]), | ||
b(n.$slots, "tableWrapper", { meta: t(C) }, () => [ | ||
M(nr, { | ||
class: _({ "mt-3": !t(q) }) | ||
m(r.$slots, "tableWrapper", { meta: $.value }, () => [ | ||
M(nl, { | ||
class: k({ "mt-3": !S.value }) | ||
}, { | ||
default: $(() => [ | ||
b(n.$slots, "table", {}, () => [ | ||
s("table", cr, [ | ||
s("thead", dr, [ | ||
b(n.$slots, "head", { | ||
default: _(() => [ | ||
m(r.$slots, "table", {}, () => [ | ||
a("table", dl, [ | ||
a("thead", hl, [ | ||
m(r.$slots, "head", { | ||
show: G, | ||
sortBy: ae, | ||
sortBy: se, | ||
header: oe | ||
}, () => [ | ||
s("tr", null, [ | ||
(a(!0), h(P, null, O(t(r).columns, (f) => (a(), w(Ae, { | ||
key: `table-${e.name}-header-${f.key}`, | ||
cell: oe(f.key) | ||
a("tr", null, [ | ||
(n(!0), d(F, null, P(t.value.columns, (h) => (n(), y(He, { | ||
key: `table-${e.name}-header-${h.key}`, | ||
cell: oe(h.key) | ||
}, null, 8, ["cell"]))), 128)) | ||
@@ -1217,8 +1238,8 @@ ]) | ||
]), | ||
s("tbody", hr, [ | ||
b(n.$slots, "body", { show: G }, () => [ | ||
(a(!0), h(P, null, O(t(F), (f, v) => (a(), h("tr", { | ||
key: `table-${e.name}-row-${v}`, | ||
class: _(["", { | ||
"bg-gray-50": e.striped && v % 2, | ||
a("tbody", vl, [ | ||
m(r.$slots, "body", { show: G }, () => [ | ||
(n(!0), d(F, null, P(B.value, (h, g) => (n(), d("tr", { | ||
key: `table-${e.name}-row-${g}`, | ||
class: k(["", { | ||
"bg-gray-50": e.striped && g % 2, | ||
"hover:bg-gray-100": e.striped, | ||
@@ -1228,11 +1249,11 @@ "hover:bg-gray-50": !e.striped | ||
}, [ | ||
(a(!0), h(P, null, O(t(r).columns, (m) => z((a(), h("td", { | ||
key: `table-${e.name}-row-${v}-column-${m.key}`, | ||
(n(!0), d(F, null, P(t.value.columns, (p) => z((n(), d("td", { | ||
key: `table-${e.name}-row-${g}-column-${p.key}`, | ||
class: "whitespace-nowrap px-3 py-4 text-sm text-gray-500" | ||
}, [ | ||
b(n.$slots, `cell(${m.key})`, { item: f }, () => [ | ||
L(p(f[m.key]), 1) | ||
m(r.$slots, `cell(${p.key})`, { item: h }, () => [ | ||
L(f(h[p.key]), 1) | ||
]) | ||
])), [ | ||
[D, G(m.key)] | ||
[D, G(p.key)] | ||
])), 128)) | ||
@@ -1244,15 +1265,15 @@ ], 2))), 128)) | ||
]), | ||
b(n.$slots, "pagination", { | ||
m(r.$slots, "pagination", { | ||
onClick: H, | ||
hasData: t(y), | ||
meta: t(C), | ||
perPageOptions: t(r).perPageOptions, | ||
onPerPageChange: le | ||
hasData: b.value, | ||
meta: $.value, | ||
perPageOptions: t.value.perPageOptions, | ||
onPerPageChange: re | ||
}, () => [ | ||
M(ct, { | ||
M(dt, { | ||
"on-click": H, | ||
"has-data": t(y), | ||
meta: t(C), | ||
"per-page-options": t(r).perPageOptions, | ||
"on-per-page-change": le | ||
"has-data": b.value, | ||
meta: $.value, | ||
"per-page-options": t.value.perPageOptions, | ||
"on-per-page-change": re | ||
}, null, 8, ["has-data", "meta", "per-page-options"]) | ||
@@ -1264,3 +1285,3 @@ ]) | ||
]) | ||
], 10, sr)) | ||
], 10, sl)) | ||
]), | ||
@@ -1273,16 +1294,16 @@ _: 3 | ||
J as ButtonWithDropdown, | ||
Ae as HeaderCell, | ||
je as OnClickOutside, | ||
ct as Pagination, | ||
Pr as Table, | ||
He as HeaderCell, | ||
Ve as OnClickOutside, | ||
dt as Pagination, | ||
Ol as Table, | ||
gt as TableAddSearchRow, | ||
$t as TableColumns, | ||
Tt as TableFilter, | ||
Lt as TableGlobalSearch, | ||
Yt as TableReset, | ||
Gt as TableSearchRows, | ||
nr as TableWrapper, | ||
Ct as TableColumns, | ||
jt as TableFilter, | ||
Mt as TableGlobalSearch, | ||
Jt as TableReset, | ||
Kt as TableSearchRows, | ||
nl as TableWrapper, | ||
ce as getTranslations, | ||
Br as setTranslation, | ||
Fr as setTranslations | ||
Fl as setTranslation, | ||
Pl as setTranslations | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@popperjs/core/lib/popper-lite"),require("@popperjs/core/lib/modifiers/preventOverflow"),require("@popperjs/core/lib/modifiers/flip"),require("lodash-es/uniq"),require("@inertiajs/vue3"),require("lodash-es/find"),require("qs"),require("lodash-es/clone"),require("lodash-es/filter"),require("lodash-es/findKey"),require("lodash-es/forEach"),require("lodash-es/isEqual"),require("lodash-es/map"),require("lodash-es/pickBy")):typeof define=="function"&&define.amd?define(["exports","vue","@popperjs/core/lib/popper-lite","@popperjs/core/lib/modifiers/preventOverflow","@popperjs/core/lib/modifiers/flip","lodash-es/uniq","@inertiajs/vue3","lodash-es/find","qs","lodash-es/clone","lodash-es/filter","lodash-es/findKey","lodash-es/forEach","lodash-es/isEqual","lodash-es/map","lodash-es/pickBy"],e):(d=typeof globalThis<"u"?globalThis:d||self,e((d.Inertia=d.Inertia||{},d.Inertia["js Tables for Laravel Query Builder"]={}),d.Vue,d.popperLite,d.preventOverflow,d.flip,d.uniq,d.vue3,d.find,d.qs,d.clone,d.filter,d.findKey,d.forEach,d.isEqual,d.map,d.pickBy))})(this,function(d,e,re,ne,le,oe,B,ae,se,ie,ce,de,ue,fe,me,he){"use strict";const y=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},pe=y(ne),ge=y(le),ye=y(oe),ke=y(ae),$=y(se),be=y(ie),we=y(ce),_e=y(de),w=y(ue),xe=y(fe),Be=y(me),Ce=y(he),j={__name:"OnClickOutside",props:{do:{type:Function,required:!0}},setup(t){const o=t,s=e.ref(null),r=e.ref(null);return e.onMounted(()=>{s.value=n=>{n.target===r.value||r.value.contains(n.target)||o.do()},document.addEventListener("click",s.value),document.addEventListener("touchstart",s.value)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",s.value),document.removeEventListener("touchstart",s.value)}),(n,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"root",ref:r},[e.renderSlot(n.$slots,"default")],512))}},Ee={class:"relative"},$e=["dusk","disabled","onClick"],Ve={class:"mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5"},C={__name:"ButtonWithDropdown",props:{placement:{type:String,default:"bottom-start",required:!1},active:{type:Boolean,default:!1,required:!1},dusk:{type:String,default:null,required:!1},disabled:{type:Boolean,default:!1,required:!1}},setup(t,{expose:o}){const s=t,r=e.ref(!1),n=e.ref(null);function i(){r.value=!r.value}function a(){r.value=!1}e.watch(r,()=>{n.value.update()});const f=e.ref(null),k=e.ref(null);return e.onMounted(()=>{n.value=re.createPopper(f.value,k.value,{placement:s.placement,modifiers:[ge.default,pe.default]})}),o({hide:a}),(b,g)=>(e.openBlock(),e.createBlock(j,{do:a},{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[e.createElementVNode("button",{ref_key:"button",ref:f,type:"button",dusk:t.dusk,disabled:t.disabled,class:e.normalizeClass(["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-green-300":t.active,"border-gray-300":!t.active,"cursor-not-allowed":t.disabled}]),"aria-haspopup":"true",onClick:e.withModifiers(i,["prevent"])},[e.renderSlot(b.$slots,"button")],10,$e),e.withDirectives(e.createElementVNode("div",{ref_key:"tooltip",ref:k,class:"absolute z-10"},[e.createElementVNode("div",Ve,[e.renderSlot(b.$slots,"default")])],512),[[e.vShow,r.value]])])]),_:3}))}},Se={class:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900"},Ne={class:"flex flex-row items-center"},qe={class:"uppercase"},De=["sorted"],Fe={key:0,fill:"currentColor",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"},Te={key:1,fill:"currentColor",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"},Pe={key:2,fill:"currentColor",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"},M={__name:"HeaderCell",props:{cell:{type:Object,required:!0}},setup(t){const o=t;function s(){o.cell.sortable&&o.cell.onSort(o.cell.key)}return(r,n)=>e.withDirectives((e.openBlock(),e.createElementBlock("th",Se,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.cell.sortable?"button":"div"),{class:"w-full",dusk:t.cell.sortable?`sort-${t.cell.key}`:null,onClick:e.withModifiers(s,["prevent"])},{default:e.withCtx(()=>[e.createElementVNode("span",Ne,[e.renderSlot(r.$slots,"label",{},()=>[e.createElementVNode("span",qe,e.toDisplayString(t.cell.label),1)]),e.renderSlot(r.$slots,"sort",{},()=>[t.cell.sortable?(e.openBlock(),e.createElementBlock("svg",{key:0,"aria-hidden":"true",class:e.normalizeClass(["w-3 h-3 ml-2",{"text-gray-400":!t.cell.sorted,"text-green-500":t.cell.sorted}]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",sorted:t.cell.sorted},[t.cell.sorted?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("path",Fe)),t.cell.sorted==="asc"?(e.openBlock(),e.createElementBlock("path",Te)):e.createCommentVNode("",!0),t.cell.sorted==="desc"?(e.openBlock(),e.createElementBlock("path",Pe)):e.createCommentVNode("",!0)],10,De)):e.createCommentVNode("",!0)])])]),_:3},8,["dusk","onClick"]))],512)),[[e.vShow,!t.cell.hidden]])}},V={translations:{next:"Next",no_results_found:"No results found",of:"of",per_page:"per page",previous:"Previous",results:"results",to:"to"}};function S(){return V.translations}function je(t,o){V.translations[t]=o}function Me(t){V.translations=t}const Oe=["dusk","value"],ze=["value"],O={__name:"PerPageSelector",props:{dusk:{type:String,default:null,required:!1},value:{type:Number,default:15,required:!1},options:{type:Array,default(){return[15,30,50,100]},required:!1},onChange:{type:Function,required:!0}},setup(t){const o=t,s=S(),r=e.computed(()=>{let n=[...o.options];return n.push(parseInt(o.value)),ye.default(n).sort((i,a)=>i-a)});return(n,i)=>(e.openBlock(),e.createElementBlock("select",{name:"per_page",dusk:t.dusk,value:t.value,class:"block focus:ring-indigo-500 focus:border-indigo-500 min-w-max shadow-sm text-sm border-gray-300 rounded-md",onChange:i[0]||(i[0]=a=>t.onChange(a.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),a=>(e.openBlock(),e.createElementBlock("option",{key:a,value:a},e.toDisplayString(a)+" "+e.toDisplayString(e.unref(s).per_page),9,ze))),128))],40,Oe))}},Le={key:0,class:"bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"},Ie={key:0},Re=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 16l-4-4m0 0l4-4m-4 4h18"})],-1),We={class:"hidden sm:inline ml-2"},Ae={class:"hidden sm:inline mr-2"},He=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"})],-1),Ke={key:2,class:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"},Ge={class:"flex flex-row space-x-4 items-center grow"},Qe={class:"hidden lg:block text-sm text-gray-700 grow"},Ue={class:"font-medium"},Ye={class:"font-medium"},Je={class:"font-medium"},Xe={class:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination"},Ze={class:"sr-only"},ve=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),et={class:"sr-only"},tt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),z={__name:"Pagination",props:{onClick:{type:Function,required:!1},perPageOptions:{type:Array,default(){return()=>[15,30,50,100]},required:!1},onPerPageChange:{type:Function,default(){return()=>{}},required:!1},hasData:{type:Boolean,required:!0},meta:{type:Object,required:!1}},setup(t){const o=t,s=S(),r=e.computed(()=>"links"in i.value?i.value.links.length>0:!1),n=e.computed(()=>Object.keys(i.value).length>0),i=e.computed(()=>o.meta),a=e.computed(()=>"prev_page_url"in i.value?i.value.prev_page_url:null),f=e.computed(()=>"next_page_url"in i.value?i.value.next_page_url:null),k=e.computed(()=>parseInt(i.value.per_page));return(b,g)=>e.unref(n)?(e.openBlock(),e.createElementBlock("nav",Le,[!t.hasData||e.unref(i).total<1?(e.openBlock(),e.createElementBlock("p",Ie,e.toDisplayString(e.unref(s).no_results_found),1)):e.createCommentVNode("",!0),t.hasData?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["flex-1 flex justify-between",{"sm:hidden":e.unref(r)}])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a)?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!e.unref(a),"text-gray-700 hover:text-gray-500":e.unref(a)},"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),href:e.unref(a),dusk:e.unref(a)?"pagination-simple-previous":null,onClick:g[0]||(g[0]=e.withModifiers(p=>t.onClick(e.unref(a)),["prevent"]))},{default:e.withCtx(()=>[Re,e.createElementVNode("span",We,e.toDisplayString(e.unref(s).previous),1)]),_:1},8,["class","href","dusk"])),e.createVNode(O,{dusk:"per-page-mobile",value:e.unref(k),options:t.perPageOptions,"on-change":t.onPerPageChange},null,8,["value","options","on-change"]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(f)?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!e.unref(f),"text-gray-700 hover:text-gray-500":e.unref(f)},"ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),href:e.unref(f),dusk:e.unref(f)?"pagination-simple-next":null,onClick:g[1]||(g[1]=e.withModifiers(p=>t.onClick(e.unref(f)),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",Ae,e.toDisplayString(e.unref(s).next),1),He]),_:1},8,["class","href","dusk"]))],2)):e.createCommentVNode("",!0),t.hasData&&e.unref(r)?(e.openBlock(),e.createElementBlock("div",Ke,[e.createElementVNode("div",Ge,[e.createVNode(O,{dusk:"per-page-full",value:e.unref(k),options:t.perPageOptions,"on-change":t.onPerPageChange},null,8,["value","options","on-change"]),e.createElementVNode("p",Qe,[e.createElementVNode("span",Ue,e.toDisplayString(e.unref(i).from),1),e.createTextVNode(" "+e.toDisplayString(e.unref(s).to)+" ",1),e.createElementVNode("span",Ye,e.toDisplayString(e.unref(i).to),1),e.createTextVNode(" "+e.toDisplayString(e.unref(s).of)+" ",1),e.createElementVNode("span",Je,e.toDisplayString(e.unref(i).total),1),e.createTextVNode(" "+e.toDisplayString(e.unref(s).results),1)])]),e.createElementVNode("div",null,[e.createElementVNode("nav",Xe,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a)?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!e.unref(a),"text-gray-500 hover:bg-gray-50":e.unref(a)},"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium"]),href:e.unref(a),dusk:e.unref(a)?"pagination-previous":null,onClick:g[2]||(g[2]=e.withModifiers(p=>t.onClick(e.unref(a)),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",Ze,e.toDisplayString(e.unref(s).previous),1),ve]),_:1},8,["class","href","dusk"])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i).links,(p,N)=>(e.openBlock(),e.createElementBlock("div",{key:N},[e.renderSlot(b.$slots,"link",{},()=>[!isNaN(p.label)||p.label==="..."?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.url?"a":"div"),{key:0,href:p.url,dusk:p.url?`pagination-${p.label}`:null,class:e.normalizeClass(["relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700",{"cursor-not-allowed":!p.url,"hover:bg-gray-50":p.url,"bg-gray-100":p.active}]),onClick:e.withModifiers(q=>t.onClick(p.url),["prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label),1)]),_:2},1032,["href","dusk","class","onClick"])):e.createCommentVNode("",!0)])]))),128)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(f)?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!e.unref(f),"text-gray-500 hover:bg-gray-50":e.unref(f)},"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium"]),href:e.unref(f),dusk:e.unref(f)?"pagination-next":null,onClick:g[3]||(g[3]=e.withModifiers(p=>t.onClick(e.unref(f)),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",et,e.toDisplayString(e.unref(s).next),1),tt]),_:1},8,["class","href","dusk"]))])])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}},rt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),nt={role:"menu","aria-orientation":"horizontal","aria-labelledby":"add-search-input-menu",class:"min-w-max"},lt=["dusk","onClick"],L={__name:"TableAddSearchRow",props:{searchInputs:{type:Object,required:!0},hasSearchInputsWithoutValue:{type:Boolean,required:!0},onAdd:{type:Function,required:!0}},setup(t){const o=t,s=e.ref(null);function r(n){o.onAdd(n),s.value.hide()}return(n,i)=>(e.openBlock(),e.createBlock(C,{ref_key:"dropdown",ref:s,dusk:"add-search-row-dropdown",disabled:!t.hasSearchInputsWithoutValue,class:"w-auto"},{button:e.withCtx(()=>[rt]),default:e.withCtx(()=>[e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.searchInputs,(a,f)=>(e.openBlock(),e.createElementBlock("button",{key:f,dusk:`add-search-row-${a.key}`,class:"text-left w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900",role:"menuitem",onClick:e.withModifiers(k=>r(a.key),["prevent"])},e.toDisplayString(a.label),9,lt))),128))])]),_:1},8,["disabled"]))}},ot=[e.createElementVNode("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"},null,-1),e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"},null,-1)],at={role:"menu","aria-orientation":"horizontal","aria-labelledby":"toggle-columns-menu",class:"min-w-max"},st={class:"px-2"},it={class:"divide-y divide-gray-200"},ct={class:"text-sm text-gray-900"},dt=["aria-pressed","aria-labelledby","aria-describedby","dusk","onClick"],ut=e.createElementVNode("span",{class:"sr-only"},"Column status",-1),I={__name:"TableColumns",props:{columns:{type:Object,required:!0},hasHiddenColumns:{type:Boolean,required:!0},onChange:{type:Function,required:!0}},setup(t){const o=t;return(s,r)=>(e.openBlock(),e.createBlock(C,{placement:"bottom-end",dusk:"columns-dropdown",active:t.hasHiddenColumns},{button:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",class:e.normalizeClass(["h-5 w-5",{"text-gray-400":!t.hasHiddenColumns,"text-green-400":t.hasHiddenColumns}]),viewBox:"0 0 20 20",fill:"currentColor"},ot,2))]),default:e.withCtx(()=>[e.createElementVNode("div",at,[e.createElementVNode("div",st,[e.createElementVNode("ul",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columns,(n,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("li",{key:i,class:"py-2 flex items-center justify-between"},[e.createElementVNode("p",ct,e.toDisplayString(n.label),1),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ml-4 relative inline-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",{"bg-green-500":!n.hidden,"bg-gray-200":n.hidden}]),"aria-pressed":!n.hidden,"aria-labelledby":`toggle-column-${n.key}`,"aria-describedby":`toggle-column-${n.key}`,dusk:`toggle-column-${n.key}`,onClick:e.withModifiers(a=>t.onChange(n.key,n.hidden),["prevent"])},[ut,e.createElementVNode("span",{"aria-hidden":"true",class:e.normalizeClass([{"translate-x-5":!n.hidden,"translate-x-0":n.hidden},"inline-block h-5 w-5 rounded-full bg-white shadow ring-0 transition ease-in-out duration-200"])},null,2)],10,dt)])),[[e.vShow,n.can_be_hidden]])),128))])])])]),_:1},8,["active"]))}},ft=[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"},null,-1)],mt={role:"menu","aria-orientation":"horizontal","aria-labelledby":"filter-menu",class:"min-w-max"},ht={class:"text-xs uppercase tracking-wide bg-gray-100 p-3"},pt={class:"p-2"},gt=["name","value","onChange"],yt=["value"],R={__name:"TableFilter",props:{hasEnabledFilters:{type:Boolean,required:!0},filters:{type:Object,required:!0},onFilterChange:{type:Function,required:!0}},setup(t){return(o,s)=>(e.openBlock(),e.createBlock(C,{placement:"bottom-end",dusk:"filters-dropdown",active:t.hasEnabledFilters},{button:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",class:e.normalizeClass(["h-5 w-5",{"text-gray-400":!t.hasEnabledFilters,"text-green-400":t.hasEnabledFilters}]),viewBox:"0 0 20 20",fill:"currentColor"},ft,2))]),default:e.withCtx(()=>[e.createElementVNode("div",mt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filters,(r,n)=>(e.openBlock(),e.createElementBlock("div",{key:n},[e.createElementVNode("h3",ht,e.toDisplayString(r.label),1),e.createElementVNode("div",pt,[r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,name:r.key,value:r.value,class:"block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm text-sm border-gray-300 rounded-md",onChange:i=>t.onFilterChange(r.key,i.target.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(i,a)=>(e.openBlock(),e.createElementBlock("option",{key:a,value:a},e.toDisplayString(i),9,yt))),128))],40,gt)):e.createCommentVNode("",!0)])]))),128))])]),_:1},8,["active"]))}},kt={class:"relative"},bt=["placeholder","value"],wt=e.createElementVNode("div",{class:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})])],-1),W={__name:"TableGlobalSearch",props:{label:{type:String,default:"Search...",required:!1},value:{type:String,default:"",required:!1},onChange:{type:Function,required:!0}},setup(t){return(o,s)=>(e.openBlock(),e.createElementBlock("div",kt,[e.createElementVNode("input",{class:"block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300",placeholder:t.label,value:t.value,type:"text",name:"global",onInput:s[0]||(s[0]=r=>t.onChange(r.target.value))},null,40,bt),wt]))}},_t={class:"flex rounded-md shadow-sm relative mt-3"},xt=["for"],Bt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 mr-2 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),Ct=["id","name","value","onInput"],Et={class:"absolute inset-y-0 right-0 pr-3 flex items-center"},$t=["dusk","onClick"],Vt=[e.createElementVNode("span",{class:"sr-only"},"Remove search",-1),e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)],A={__name:"TableSearchRows",props:{searchInputs:{type:Object,required:!0},forcedVisibleSearchInputs:{type:Array,required:!0},onChange:{type:Function,required:!0},onRemove:{type:Function,required:!0}},setup(t){const o=t,s={el:e.ref([])};let r=e.computed(()=>s.el.value);function n(i){return o.forcedVisibleSearchInputs.includes(i)}return e.watch(o.forcedVisibleSearchInputs,i=>{const a=i.length>0?i[i.length-1]:null;!a||e.nextTick().then(()=>{const f=ke.default(r.value,k=>k.__vnode.key===a);f&&f.focus()})},{immediate:!0}),(i,a)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.searchInputs,(f,k)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:k,class:"px-4 sm:px-0"},[e.createElementVNode("div",_t,[e.createElementVNode("label",{for:f.key,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"},[Bt,e.createElementVNode("span",null,e.toDisplayString(f.label),1)],8,xt),(e.openBlock(),e.createElementBlock("input",{id:f.key,ref_for:!0,ref:s.el,key:f.key,name:f.key,value:f.value,type:"text",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",onInput:b=>t.onChange(f.key,b.target.value)},null,40,Ct)),e.createElementVNode("div",Et,[e.createElementVNode("button",{class:"rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",dusk:`remove-search-row-${f.key}`,onClick:e.withModifiers(b=>t.onRemove(f.key),["prevent"])},Vt,8,$t)])])])),[[e.vShow,f.value!==null||n(f.key)]])),128))}},St=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 mr-2 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),e.createElementVNode("span",null,"Reset",-1)],H={__name:"TableReset",props:{onClick:{type:Function,required:!0}},setup(t){return(o,s)=>(e.openBlock(),e.createElementBlock("button",{ref:"button",type:"button",dusk:"reset-table",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","aria-haspopup":"true",onClick:s[0]||(s[0]=e.withModifiers((...r)=>t.onClick&&t.onClick(...r),["prevent"]))},St,512))}},Nt=(t,o)=>{const s=t.__vccOpts||t;for(const[r,n]of o)s[r]=n;return s},qt={},Dt={class:"flow-root"},Ft={class:"-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"},Tt={class:"inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"},Pt={class:"overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg"};function jt(t,o){return e.openBlock(),e.createElementBlock("div",Dt,[e.createElementVNode("div",Ft,[e.createElementVNode("div",Tt,[e.createElementVNode("div",Pt,[e.renderSlot(t.$slots,"default")])])])])}const K=Nt(qt,[["render",jt]]),Mt=["dusk"],Ot={class:"flex flex-row flex-wrap sm:flex-nowrap justify-start px-4 sm:px-0"},zt={class:"order-2 sm:order-1 mr-2 sm:mr-4"},Lt={key:0,class:"flex flex-row w-full sm:w-auto sm:grow order-1 sm:order-2 mb-2 sm:mb-0 sm:mr-4"},It={key:0,class:"order-5 sm:order-3 sm:mr-4 ml-auto"},Rt={class:"min-w-full divide-y divide-gray-300"},Wt={class:"bg-gray-50"},At={class:"divide-y divide-gray-200 bg-white"},Ht={__name:"Table",props:{inertia:{type:Object,default:()=>({}),required:!1},name:{type:String,default:"default",required:!1},striped:{type:Boolean,default:!1,required:!1},preventOverlappingRequests:{type:Boolean,default:!0,required:!1},inputDebounceMs:{type:Number,default:350,required:!1},preserveScroll:{type:[Boolean,String],default:!1,required:!1},resource:{type:Object,default:()=>({}),required:!1},meta:{type:Object,default:()=>({}),required:!1},data:{type:Object,default:()=>({}),required:!1}},setup(t){const o=t;e.getCurrentInstance();const s=e.ref(0),r=e.computed(()=>{let l=B.usePage().props.queryBuilderProps?B.usePage().props.queryBuilderProps[o.name]||{}:{};return l._updates=s.value,l}),n=e.ref(r.value),i=e.computed(()=>r.value.pageName),a=e.ref([]),f=e.ref(null),k=e.computed(()=>!(r.value.hasToggleableColumns||r.value.hasFilters||r.value.hasSearchInputs||r.value.globalSearch)),b=e.computed(()=>Object.keys(o.resource).length===0?o.data:"data"in o.resource?o.resource.data:o.resource),g=e.computed(()=>Object.keys(o.resource).length===0?o.meta:"links"in o.resource&&"meta"in o.resource&&Object.keys(o.resource.links).length===4&&"next"in o.resource.links&&"prev"in o.resource.links?{...o.resource.meta,next_page_url:o.resource.links.next,prev_page_url:o.resource.links.prev}:"meta"in o.resource?o.resource.meta:o.resource),p=e.computed(()=>b.value.length>0||g.value.total>0);function N(l){a.value=a.value.filter(c=>c!=l),E(l,null)}function q(l){a.value.push(l)}const Kt=e.computed(()=>{if(a.value.length>0)return!0;const l=$.default.parse(location.search.substring(1));if(l[i.value]>1)return!0;const u=o.name==="default"?"":o.name+"_";let m=!1;return w.default(["filter","columns","cursor","sort"],h=>{const x=l[u+h];h==="sort"&&x===r.value.defaultSort||x!==void 0&&(m=!0)}),m});function G(){a.value=[],w.default(n.value.filters,(l,c)=>{n.value.filters[c].value=null}),w.default(n.value.searchInputs,(l,c)=>{n.value.searchInputs[c].value=null}),w.default(n.value.columns,(l,c)=>{n.value.columns[c].hidden=l.can_be_hidden?!r.value.defaultVisibleToggleableColumns.includes(l.key):!1}),n.value.sort=null,n.value.cursor=null,n.value.page=1}const Q={};function E(l,c){clearTimeout(Q[l]),Q[l]=setTimeout(()=>{F.value&&o.preventOverlappingRequests&&F.value.cancel();const u=_("searchInputs",l);n.value.searchInputs[u].value=c,n.value.cursor=null,n.value.page=1},o.inputDebounceMs)}function U(l){E("global",l)}function Y(l,c){const u=_("filters",l);n.value.filters[u].value=c,n.value.cursor=null,n.value.page=1}function J(l){n.value.cursor=null,n.value.perPage=l,n.value.page=1}function _(l,c){return _e.default(n.value[l],u=>u.key==c)}function X(l,c){const u=_("columns",l);n.value.columns[u].hidden=!c}function Gt(){let l={};return w.default(n.value.searchInputs,c=>{c.value!==null&&(l[c.key]=c.value)}),w.default(n.value.filters,c=>{c.value!==null&&(l[c.key]=c.value)}),l}function Qt(){const l=n.value.columns;let c=we.default(l,m=>!m.hidden),u=Be.default(c,m=>m.key).sort();return xe.default(u,r.value.defaultVisibleToggleableColumns)?{}:u}function Ut(){const l=Gt(),c=Qt(),u={};Object.keys(l).length>0&&(u.filter=l),Object.keys(c).length>0&&(u.columns=c);const m=n.value.cursor,h=n.value.page,x=n.value.sort,te=n.value.perPage;return m&&(u.cursor=m),h>1&&(u.page=h),te>1&&(u.perPage=te),x&&(u.sort=x),u}function Yt(){const l=$.default.parse(location.search.substring(1)),c=o.name==="default"?"":o.name+"_";w.default(["filter","columns","cursor","sort"],m=>{delete l[c+m]}),delete l[i.value],w.default(Ut(),(m,h)=>{h==="page"?l[i.value]=m:h==="perPage"?l.perPage=m:l[c+h]=m});let u=$.default.stringify(l,{filter(m,h){return typeof h=="object"&&h!==null?Ce.default(h):h},skipNulls:!0,strictNullHandling:!0});return(!u||u===i.value+"=1")&&(u=""),u}const D=e.ref(!1),F=e.ref(null);function T(l){!l||B.router.get(l,{},{replace:!0,preserveState:!0,preserveScroll:o.preserveScroll!==!1,onBefore(){D.value=!0},onCancelToken(c){F.value=c},onFinish(){D.value=!1},onSuccess(){if("queryBuilderProps"in B.usePage().props&&(n.value.cursor=r.value.cursor,n.value.page=r.value.page),o.preserveScroll==="table-top"){const u=f.value.getBoundingClientRect().top+window.pageYOffset+-8;window.scrollTo({top:u})}s.value++}})}e.watch(n,()=>{T(location.pathname+"?"+Yt())},{deep:!0});const Z=()=>{s.value++};e.onMounted(()=>{document.addEventListener("inertia:success",Z)}),e.onUnmounted(()=>{document.removeEventListener("inertia:success",Z)});function v(l){n.value.sort==l?n.value.sort=`-${l}`:n.value.sort=l,n.value.cursor=null,n.value.page=1}function P(l){const c=_("columns",l);return!n.value.columns[c].hidden}function ee(l){const c=_("columns",l),u=be.default(r.value.columns[c]);return u.onSort=v,u}return(l,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("fieldset",{ref_key:"tableFieldset",ref:f,key:`table-${t.name}`,dusk:`table-${t.name}`,class:e.normalizeClass(["min-w-0",{"opacity-75":D.value}])},[e.createElementVNode("div",Ot,[e.createElementVNode("div",zt,[e.renderSlot(l.$slots,"tableFilter",{hasFilters:e.unref(r).hasFilters,hasEnabledFilters:e.unref(r).hasEnabledFilters,filters:e.unref(r).filters,onFilterChange:Y},()=>[e.unref(r).hasFilters?(e.openBlock(),e.createBlock(R,{key:0,"has-enabled-filters":e.unref(r).hasEnabledFilters,filters:e.unref(r).filters,"on-filter-change":Y},null,8,["has-enabled-filters","filters"])):e.createCommentVNode("",!0)])]),e.unref(r).globalSearch?(e.openBlock(),e.createElementBlock("div",Lt,[e.renderSlot(l.$slots,"tableGlobalSearch",{hasGlobalSearch:e.unref(r).globalSearch,label:e.unref(r).globalSearch?e.unref(r).globalSearch.label:null,value:e.unref(r).globalSearch?e.unref(r).globalSearch.value:null,onChange:U},()=>[e.unref(r).globalSearch?(e.openBlock(),e.createBlock(W,{key:0,class:"grow",label:e.unref(r).globalSearch.label,value:e.unref(r).globalSearch.value,"on-change":U},null,8,["label","value"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"tableReset",{canBeReset:"canBeReset",onClick:G},()=>[e.unref(Kt)?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(H,{"on-click":G})])):e.createCommentVNode("",!0)]),e.renderSlot(l.$slots,"tableAddSearchRow",{hasSearchInputs:e.unref(r).hasSearchInputs,hasSearchInputsWithoutValue:e.unref(r).hasSearchInputsWithoutValue,searchInputs:e.unref(r).searchInputsWithoutGlobal,onAdd:q},()=>[e.unref(r).hasSearchInputs?(e.openBlock(),e.createBlock(L,{key:0,class:"order-3 sm:order-4 mr-2 sm:mr-4","search-inputs":e.unref(r).searchInputsWithoutGlobal,"has-search-inputs-without-value":e.unref(r).hasSearchInputsWithoutValue,"on-add":q},null,8,["search-inputs","has-search-inputs-without-value"])):e.createCommentVNode("",!0)]),e.renderSlot(l.$slots,"tableColumns",{hasColumns:e.unref(r).hasToggleableColumns,columns:e.unref(r).columns,hasHiddenColumns:e.unref(r).hasHiddenColumns,onChange:X},()=>[e.unref(r).hasToggleableColumns?(e.openBlock(),e.createBlock(I,{key:0,class:"order-4 mr-4 sm:mr-0 sm:order-5",columns:e.unref(r).columns,"has-hidden-columns":e.unref(r).hasHiddenColumns,"on-change":X},null,8,["columns","has-hidden-columns"])):e.createCommentVNode("",!0)])]),e.renderSlot(l.$slots,"tableSearchRows",{hasSearchRowsWithValue:e.unref(r).hasSearchInputsWithValue,searchInputs:e.unref(r).searchInputsWithoutGlobal,forcedVisibleSearchInputs:a.value,onChange:E},()=>[e.unref(r).hasSearchInputsWithValue||a.value.length>0?(e.openBlock(),e.createBlock(A,{key:0,"search-inputs":e.unref(r).searchInputsWithoutGlobal,"forced-visible-search-inputs":a.value,"on-change":E,"on-remove":N},null,8,["search-inputs","forced-visible-search-inputs"])):e.createCommentVNode("",!0)]),e.renderSlot(l.$slots,"tableWrapper",{meta:e.unref(g)},()=>[e.createVNode(K,{class:e.normalizeClass({"mt-3":!e.unref(k)})},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"table",{},()=>[e.createElementVNode("table",Rt,[e.createElementVNode("thead",Wt,[e.renderSlot(l.$slots,"head",{show:P,sortBy:v,header:ee},()=>[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r).columns,u=>(e.openBlock(),e.createBlock(M,{key:`table-${t.name}-header-${u.key}`,cell:ee(u.key)},null,8,["cell"]))),128))])])]),e.createElementVNode("tbody",At,[e.renderSlot(l.$slots,"body",{show:P},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(u,m)=>(e.openBlock(),e.createElementBlock("tr",{key:`table-${t.name}-row-${m}`,class:e.normalizeClass(["",{"bg-gray-50":t.striped&&m%2,"hover:bg-gray-100":t.striped,"hover:bg-gray-50":!t.striped}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r).columns,h=>e.withDirectives((e.openBlock(),e.createElementBlock("td",{key:`table-${t.name}-row-${m}-column-${h.key}`,class:"whitespace-nowrap px-3 py-4 text-sm text-gray-500"},[e.renderSlot(l.$slots,`cell(${h.key})`,{item:u},()=>[e.createTextVNode(e.toDisplayString(u[h.key]),1)])])),[[e.vShow,P(h.key)]])),128))],2))),128))])])])]),e.renderSlot(l.$slots,"pagination",{onClick:T,hasData:e.unref(p),meta:e.unref(g),perPageOptions:e.unref(r).perPageOptions,onPerPageChange:J},()=>[e.createVNode(z,{"on-click":T,"has-data":e.unref(p),meta:e.unref(g),"per-page-options":e.unref(r).perPageOptions,"on-per-page-change":J},null,8,["has-data","meta","per-page-options"])])]),_:3},8,["class"])])],10,Mt))]),_:3}))}};d.ButtonWithDropdown=C,d.HeaderCell=M,d.OnClickOutside=j,d.Pagination=z,d.Table=Ht,d.TableAddSearchRow=L,d.TableColumns=I,d.TableFilter=R,d.TableGlobalSearch=W,d.TableReset=H,d.TableSearchRows=A,d.TableWrapper=K,d.getTranslations=S,d.setTranslation=je,d.setTranslations=Me,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@popperjs/core/lib/popper-lite"),require("@popperjs/core/lib/modifiers/preventOverflow"),require("@popperjs/core/lib/modifiers/flip"),require("lodash-es/uniq"),require("@inertiajs/vue3"),require("lodash-es/find"),require("qs"),require("lodash-es/clone"),require("lodash-es/filter"),require("lodash-es/findKey"),require("lodash-es/forEach"),require("lodash-es/isEqual"),require("lodash-es/map"),require("lodash-es/pickBy")):typeof define=="function"&&define.amd?define(["exports","vue","@popperjs/core/lib/popper-lite","@popperjs/core/lib/modifiers/preventOverflow","@popperjs/core/lib/modifiers/flip","lodash-es/uniq","@inertiajs/vue3","lodash-es/find","qs","lodash-es/clone","lodash-es/filter","lodash-es/findKey","lodash-es/forEach","lodash-es/isEqual","lodash-es/map","lodash-es/pickBy"],e):(d=typeof globalThis<"u"?globalThis:d||self,e((d.Inertia=d.Inertia||{},d.Inertia["js Tables for Laravel Query Builder"]={}),d.Vue,d.popperLite,d.preventOverflow,d.flip,d.uniq,d.vue3,d.find,d.qs,d.clone,d.filter,d.findKey,d.forEach,d.isEqual,d.map,d.pickBy))})(this,function(d,e,le,re,ne,ae,B,oe,se,ie,ce,de,ue,me,fe,he){"use strict";const y=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},pe=y(re),ge=y(ne),ye=y(ae),ke=y(oe),$=y(se),be=y(ie),we=y(ce),_e=y(de),w=y(ue),xe=y(me),Be=y(fe),Ce=y(he),P={__name:"OnClickOutside",props:{do:{type:Function,required:!0}},setup(t){const a=t,i=e.ref(null),l=e.ref(null);return e.onMounted(()=>{i.value=r=>{r.target===l.value||l.value.contains(r.target)||a.do()},document.addEventListener("click",i.value),document.addEventListener("touchstart",i.value)}),e.onBeforeUnmount(()=>{document.removeEventListener("click",i.value),document.removeEventListener("touchstart",i.value)}),(r,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"root",ref:l},[e.renderSlot(r.$slots,"default")],512))}},Ee={class:"relative"},$e=["dusk","disabled","onClick"],Ve={class:"mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5"},C={__name:"ButtonWithDropdown",props:{placement:{type:String,default:"bottom-start",required:!1},active:{type:Boolean,default:!1,required:!1},dusk:{type:String,default:null,required:!1},disabled:{type:Boolean,default:!1,required:!1}},setup(t,{expose:a}){const i=t,l=e.ref(!1),r=e.ref(null);function o(){l.value=!l.value}function s(){l.value=!1}e.watch(l,()=>{r.value.update()});const m=e.ref(null),k=e.ref(null);return e.onMounted(()=>{r.value=le.createPopper(m.value,k.value,{placement:i.placement,modifiers:[ge.default,pe.default]})}),a({hide:s}),(b,g)=>(e.openBlock(),e.createBlock(P,{do:s},{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[e.createElementVNode("button",{ref_key:"button",ref:m,type:"button",dusk:t.dusk,disabled:t.disabled,class:e.normalizeClass(["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-green-300":t.active,"border-gray-300":!t.active,"cursor-not-allowed":t.disabled}]),"aria-haspopup":"true",onClick:e.withModifiers(o,["prevent"])},[e.renderSlot(b.$slots,"button")],10,$e),e.withDirectives(e.createElementVNode("div",{ref_key:"tooltip",ref:k,class:"absolute z-10"},[e.createElementVNode("div",Ve,[e.renderSlot(b.$slots,"default")])],512),[[e.vShow,l.value]])])]),_:3}))}},Se={class:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900"},Ne={class:"flex flex-row items-center"},qe={class:"uppercase"},ve=["sorted"],De={key:0,fill:"currentColor",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"},Fe={key:1,fill:"currentColor",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"},Te={key:2,fill:"currentColor",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"},j={__name:"HeaderCell",props:{cell:{type:Object,required:!0}},setup(t){const a=t;function i(){a.cell.sortable&&a.cell.onSort(a.cell.key)}return(l,r)=>e.withDirectives((e.openBlock(),e.createElementBlock("th",Se,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.cell.sortable?"button":"div"),{class:"w-full",dusk:t.cell.sortable?`sort-${t.cell.key}`:null,onClick:e.withModifiers(i,["prevent"])},{default:e.withCtx(()=>[e.createElementVNode("span",Ne,[e.renderSlot(l.$slots,"label",{},()=>[e.createElementVNode("span",qe,e.toDisplayString(t.cell.label),1)]),e.renderSlot(l.$slots,"sort",{},()=>[t.cell.sortable?(e.openBlock(),e.createElementBlock("svg",{key:0,"aria-hidden":"true",class:e.normalizeClass(["w-3 h-3 ml-2",{"text-gray-400":!t.cell.sorted,"text-green-500":t.cell.sorted}]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",sorted:t.cell.sorted},[t.cell.sorted?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("path",De)),t.cell.sorted==="asc"?(e.openBlock(),e.createElementBlock("path",Fe)):e.createCommentVNode("",!0),t.cell.sorted==="desc"?(e.openBlock(),e.createElementBlock("path",Te)):e.createCommentVNode("",!0)],10,ve)):e.createCommentVNode("",!0)])])]),_:3},8,["dusk","onClick"]))],512)),[[e.vShow,!t.cell.hidden]])}},V={translations:{next:"Next",no_results_found:"No results found",of:"of",per_page:"per page",previous:"Previous",results:"results",to:"to"}};function S(){return V.translations}function Pe(t,a){V.translations[t]=a}function je(t){V.translations=t}const Me=["dusk","value"],ze=["value"],M={__name:"PerPageSelector",props:{dusk:{type:String,default:null,required:!1},value:{type:Number,default:15,required:!1},options:{type:Array,default(){return[15,30,50,100]},required:!1},onChange:{type:Function,required:!0}},setup(t){const a=t,i=S(),l=e.computed(()=>{let r=[...a.options];return r.push(parseInt(a.value)),ye.default(r).sort((o,s)=>o-s)});return(r,o)=>(e.openBlock(),e.createElementBlock("select",{name:"per_page",dusk:t.dusk,value:t.value,class:"block focus:ring-indigo-500 focus:border-indigo-500 min-w-max shadow-sm text-sm border-gray-300 rounded-md",onChange:o[0]||(o[0]=s=>t.onChange(s.target.value))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,s=>(e.openBlock(),e.createElementBlock("option",{key:s,value:s},e.toDisplayString(s)+" "+e.toDisplayString(e.unref(i).per_page),9,ze))),128))],40,Me))}},Oe={key:0,class:"bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"},Le={key:0},Ie=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 16l-4-4m0 0l4-4m-4 4h18"})],-1),Re={class:"hidden sm:inline ml-2"},We={class:"hidden sm:inline mr-2"},Ae=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"})],-1),He={key:2,class:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between"},Ke={class:"flex flex-row space-x-4 items-center grow"},Ge={class:"hidden lg:block text-sm text-gray-700 grow"},Qe={class:"font-medium"},Ue={class:"font-medium"},Ye={class:"font-medium"},Je={class:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination"},Xe={class:"sr-only"},Ze=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),et={class:"sr-only"},tt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),z={__name:"Pagination",props:{onClick:{type:Function,required:!1},perPageOptions:{type:Array,default(){return()=>[15,30,50,100]},required:!1},onPerPageChange:{type:Function,default(){return()=>{}},required:!1},hasData:{type:Boolean,required:!0},meta:{type:Object,required:!1}},setup(t){const a=t,i=S(),l=e.computed(()=>"links"in o.value?o.value.links.length>0:!1),r=e.computed(()=>Object.keys(o.value).length>0),o=e.computed(()=>a.meta),s=e.computed(()=>"prev_page_url"in o.value?o.value.prev_page_url:null),m=e.computed(()=>"next_page_url"in o.value?o.value.next_page_url:null),k=e.computed(()=>parseInt(o.value.per_page));return(b,g)=>r.value?(e.openBlock(),e.createElementBlock("nav",Oe,[!t.hasData||o.value.total<1?(e.openBlock(),e.createElementBlock("p",Le,e.toDisplayString(e.unref(i).no_results_found),1)):e.createCommentVNode("",!0),t.hasData?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["flex-1 flex justify-between",{"sm:hidden":l.value}])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!s.value,"text-gray-700 hover:text-gray-500":s.value},"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),href:s.value,dusk:s.value?"pagination-simple-previous":null,onClick:g[0]||(g[0]=e.withModifiers(p=>t.onClick(s.value),["prevent"]))},{default:e.withCtx(()=>[Ie,e.createElementVNode("span",Re,e.toDisplayString(e.unref(i).previous),1)]),_:1},8,["class","href","dusk"])),e.createVNode(M,{dusk:"per-page-mobile",value:k.value,options:t.perPageOptions,"on-change":t.onPerPageChange},null,8,["value","options","on-change"]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!m.value,"text-gray-700 hover:text-gray-500":m.value},"ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md bg-white"]),href:m.value,dusk:m.value?"pagination-simple-next":null,onClick:g[1]||(g[1]=e.withModifiers(p=>t.onClick(m.value),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",We,e.toDisplayString(e.unref(i).next),1),Ae]),_:1},8,["class","href","dusk"]))],2)):e.createCommentVNode("",!0),t.hasData&&l.value?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",Ke,[e.createVNode(M,{dusk:"per-page-full",value:k.value,options:t.perPageOptions,"on-change":t.onPerPageChange},null,8,["value","options","on-change"]),e.createElementVNode("p",Ge,[e.createElementVNode("span",Qe,e.toDisplayString(o.value.from),1),e.createTextVNode(" "+e.toDisplayString(e.unref(i).to)+" ",1),e.createElementVNode("span",Ue,e.toDisplayString(o.value.to),1),e.createTextVNode(" "+e.toDisplayString(e.unref(i).of)+" ",1),e.createElementVNode("span",Ye,e.toDisplayString(o.value.total),1),e.createTextVNode(" "+e.toDisplayString(e.unref(i).results),1)])]),e.createElementVNode("div",null,[e.createElementVNode("nav",Je,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!s.value,"text-gray-500 hover:bg-gray-50":s.value},"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium"]),href:s.value,dusk:s.value?"pagination-previous":null,onClick:g[2]||(g[2]=e.withModifiers(p=>t.onClick(s.value),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",Xe,e.toDisplayString(e.unref(i).previous),1),Ze]),_:1},8,["class","href","dusk"])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value.links,(p,N)=>(e.openBlock(),e.createElementBlock("div",{key:N},[e.renderSlot(b.$slots,"link",{},()=>[!isNaN(p.label)||p.label==="..."?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.url?"a":"div"),{key:0,href:p.url,dusk:p.url?`pagination-${p.label}`:null,class:e.normalizeClass(["relative inline-flex items-center px-4 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-700",{"cursor-not-allowed":!p.url,"hover:bg-gray-50":p.url,"bg-gray-100":p.active}]),onClick:e.withModifiers(q=>t.onClick(p.url),["prevent"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label),1)]),_:2},1032,["href","dusk","class","onClick"])):e.createCommentVNode("",!0)])]))),128)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value?"a":"div"),{class:e.normalizeClass([{"cursor-not-allowed text-gray-400":!m.value,"text-gray-500 hover:bg-gray-50":m.value},"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium"]),href:m.value,dusk:m.value?"pagination-next":null,onClick:g[3]||(g[3]=e.withModifiers(p=>t.onClick(m.value),["prevent"]))},{default:e.withCtx(()=>[e.createElementVNode("span",et,e.toDisplayString(e.unref(i).next),1),tt]),_:1},8,["class","href","dusk"]))])])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}},lt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),rt={role:"menu","aria-orientation":"horizontal","aria-labelledby":"add-search-input-menu",class:"min-w-max"},nt=["dusk","onClick"],O={__name:"TableAddSearchRow",props:{searchInputs:{type:Object,required:!0},hasSearchInputsWithoutValue:{type:Boolean,required:!0},onAdd:{type:Function,required:!0}},setup(t){const a=t,i=e.ref(null);function l(r){a.onAdd(r),i.value.hide()}return(r,o)=>(e.openBlock(),e.createBlock(C,{ref_key:"dropdown",ref:i,dusk:"add-search-row-dropdown",disabled:!t.hasSearchInputsWithoutValue,class:"w-auto"},{button:e.withCtx(()=>[lt]),default:e.withCtx(()=>[e.createElementVNode("div",rt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.searchInputs,(s,m)=>(e.openBlock(),e.createElementBlock("button",{key:m,dusk:`add-search-row-${s.key}`,class:"text-left w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900",role:"menuitem",onClick:e.withModifiers(k=>l(s.key),["prevent"])},e.toDisplayString(s.label),9,nt))),128))])]),_:1},8,["disabled"]))}},at=[e.createElementVNode("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"},null,-1),e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"},null,-1)],ot={role:"menu","aria-orientation":"horizontal","aria-labelledby":"toggle-columns-menu",class:"min-w-max"},st={class:"px-2"},it={class:"divide-y divide-gray-200"},ct={class:"text-sm text-gray-900"},dt=["aria-pressed","aria-labelledby","aria-describedby","dusk","onClick"],ut=e.createElementVNode("span",{class:"sr-only"},"Column status",-1),L={__name:"TableColumns",props:{columns:{type:Object,required:!0},hasHiddenColumns:{type:Boolean,required:!0},onChange:{type:Function,required:!0}},setup(t){const a=t;return(i,l)=>(e.openBlock(),e.createBlock(C,{placement:"bottom-end",dusk:"columns-dropdown",active:t.hasHiddenColumns},{button:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",class:e.normalizeClass(["h-5 w-5",{"text-gray-400":!t.hasHiddenColumns,"text-green-400":t.hasHiddenColumns}]),viewBox:"0 0 20 20",fill:"currentColor"},at,2))]),default:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createElementVNode("div",st,[e.createElementVNode("ul",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columns,(r,o)=>e.withDirectives((e.openBlock(),e.createElementBlock("li",{key:o,class:"py-2 flex items-center justify-between"},[e.createElementVNode("p",ct,e.toDisplayString(r.label),1),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ml-4 relative inline-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",{"bg-green-500":!r.hidden,"bg-gray-200":r.hidden}]),"aria-pressed":!r.hidden,"aria-labelledby":`toggle-column-${r.key}`,"aria-describedby":`toggle-column-${r.key}`,dusk:`toggle-column-${r.key}`,onClick:e.withModifiers(s=>t.onChange(r.key,r.hidden),["prevent"])},[ut,e.createElementVNode("span",{"aria-hidden":"true",class:e.normalizeClass([{"translate-x-5":!r.hidden,"translate-x-0":r.hidden},"inline-block h-5 w-5 rounded-full bg-white shadow ring-0 transition ease-in-out duration-200"])},null,2)],10,dt)])),[[e.vShow,r.can_be_hidden]])),128))])])])]),_:1},8,["active"]))}},mt=[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"},null,-1)],ft={role:"menu","aria-orientation":"horizontal","aria-labelledby":"filter-menu",class:"min-w-max"},ht={class:"text-xs uppercase tracking-wide bg-gray-100 p-3"},pt={class:"p-2"},gt=["name","value","onChange"],yt=["value"],I={__name:"TableFilter",props:{hasEnabledFilters:{type:Boolean,required:!0},filters:{type:Object,required:!0},onFilterChange:{type:Function,required:!0}},setup(t){return(a,i)=>(e.openBlock(),e.createBlock(C,{placement:"bottom-end",dusk:"filters-dropdown",active:t.hasEnabledFilters},{button:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",class:e.normalizeClass(["h-5 w-5",{"text-gray-400":!t.hasEnabledFilters,"text-green-400":t.hasEnabledFilters}]),viewBox:"0 0 20 20",fill:"currentColor"},mt,2))]),default:e.withCtx(()=>[e.createElementVNode("div",ft,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filters,(l,r)=>(e.openBlock(),e.createElementBlock("div",{key:r},[e.createElementVNode("h3",ht,e.toDisplayString(l.label),1),e.createElementVNode("div",pt,[l.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,name:l.key,value:l.value,class:"block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm text-sm border-gray-300 rounded-md",onChange:o=>t.onFilterChange(l.key,o.target.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,(o,s)=>(e.openBlock(),e.createElementBlock("option",{key:s,value:s},e.toDisplayString(o),9,yt))),128))],40,gt)):e.createCommentVNode("",!0)])]))),128))])]),_:1},8,["active"]))}},kt={class:"relative"},bt=["placeholder","value"],wt=e.createElementVNode("div",{class:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})])],-1),R={__name:"TableGlobalSearch",props:{label:{type:String,default:"Search...",required:!1},value:{type:String,default:"",required:!1},onChange:{type:Function,required:!0},preStyle:{type:String,default:"default",required:!1}},setup(t){const a={inertia_table:{global_search:{input:{default:"block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300",dootix:"block w-full pl-9 text-sm rounded-md shadow-sm focus:ring-cyan-500 focus:border-blue-500 border-gray-300"}}}},i=e.inject("themeVariables"),l=(r,o)=>"inertia_table"in i&&"global_search"in i.inertia_table&&r in i.inertia_table.global_search&&o in i.inertia_table.global_search[r]?i.inertia_table.global_search[r][o]:a.inertia_table.global_search[r][o];return(r,o)=>(e.openBlock(),e.createElementBlock("div",kt,[e.createElementVNode("input",{class:e.normalizeClass(l("input",t.preStyle)),placeholder:t.label,value:t.value,type:"text",name:"global",onInput:o[0]||(o[0]=s=>t.onChange(s.target.value))},null,42,bt),wt]))}},_t={class:"flex rounded-md shadow-sm relative mt-3"},xt=["for"],Bt=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 mr-2 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),Ct=["id","name","value","onInput"],Et={class:"absolute inset-y-0 right-0 pr-3 flex items-center"},$t=["dusk","onClick"],Vt=[e.createElementVNode("span",{class:"sr-only"},"Remove search",-1),e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)],W={__name:"TableSearchRows",props:{searchInputs:{type:Object,required:!0},forcedVisibleSearchInputs:{type:Array,required:!0},onChange:{type:Function,required:!0},onRemove:{type:Function,required:!0}},setup(t){const a=t,i={el:e.ref([])};let l=e.computed(()=>i.el.value);function r(o){return a.forcedVisibleSearchInputs.includes(o)}return e.watch(a.forcedVisibleSearchInputs,o=>{const s=o.length>0?o[o.length-1]:null;!s||e.nextTick().then(()=>{const m=ke.default(l.value,k=>k.__vnode.key===s);m&&m.focus()})},{immediate:!0}),(o,s)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.searchInputs,(m,k)=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:k,class:"px-4 sm:px-0"},[e.createElementVNode("div",_t,[e.createElementVNode("label",{for:m.key,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"},[Bt,e.createElementVNode("span",null,e.toDisplayString(m.label),1)],8,xt),(e.openBlock(),e.createElementBlock("input",{id:m.key,ref_for:!0,ref:i.el,key:m.key,name:m.key,value:m.value,type:"text",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",onInput:b=>t.onChange(m.key,b.target.value)},null,40,Ct)),e.createElementVNode("div",Et,[e.createElementVNode("button",{class:"rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",dusk:`remove-search-row-${m.key}`,onClick:e.withModifiers(b=>t.onRemove(m.key),["prevent"])},Vt,8,$t)])])])),[[e.vShow,m.value!==null||r(m.key)]])),128))}},St=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5 mr-2 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor"},[e.createElementVNode("path",{"fill-rule":"evenodd",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","clip-rule":"evenodd"})],-1),e.createElementVNode("span",null,"Reset",-1)],A={__name:"TableReset",props:{onClick:{type:Function,required:!0}},setup(t){return(a,i)=>(e.openBlock(),e.createElementBlock("button",{ref:"button",type:"button",dusk:"reset-table",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","aria-haspopup":"true",onClick:i[0]||(i[0]=e.withModifiers((...l)=>t.onClick&&t.onClick(...l),["prevent"]))},St,512))}},Nt=(t,a)=>{const i=t.__vccOpts||t;for(const[l,r]of a)i[l]=r;return i},qt={},vt={class:"flow-root"},Dt={class:"-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"},Ft={class:"inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8"},Tt={class:"overflow-hidden shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg"};function Pt(t,a){return e.openBlock(),e.createElementBlock("div",vt,[e.createElementVNode("div",Dt,[e.createElementVNode("div",Ft,[e.createElementVNode("div",Tt,[e.renderSlot(t.$slots,"default")])])])])}const H=Nt(qt,[["render",Pt]]),jt=["dusk"],Mt={class:"flex flex-row flex-wrap sm:flex-nowrap justify-start px-4 sm:px-0"},zt={class:"order-2 sm:order-1 mr-2 sm:mr-4"},Ot={key:0,class:"flex flex-row w-full sm:w-auto sm:grow order-1 sm:order-2 mb-2 sm:mb-0 sm:mr-4"},Lt={key:0,class:"order-5 sm:order-3 sm:mr-4 ml-auto"},It={class:"min-w-full divide-y divide-gray-300"},Rt={class:"bg-gray-50"},Wt={class:"divide-y divide-gray-200 bg-white"},At={__name:"Table",props:{inertia:{type:Object,default:()=>({}),required:!1},name:{type:String,default:"default",required:!1},striped:{type:Boolean,default:!1,required:!1},preventOverlappingRequests:{type:Boolean,default:!0,required:!1},inputDebounceMs:{type:Number,default:350,required:!1},preserveScroll:{type:[Boolean,String],default:!1,required:!1},resource:{type:Object,default:()=>({}),required:!1},meta:{type:Object,default:()=>({}),required:!1},data:{type:Object,default:()=>({}),required:!1},preStyle:{type:String,default:"default",required:!1}},setup(t){const a=t;e.getCurrentInstance();const i=e.ref(0),l=e.computed(()=>{let n=B.usePage().props.queryBuilderProps?B.usePage().props.queryBuilderProps[a.name]||{}:{};return n._updates=i.value,n}),r=e.ref(l.value),o=e.computed(()=>l.value.pageName),s=e.ref([]),m=e.ref(null),k=e.computed(()=>!(l.value.hasToggleableColumns||l.value.hasFilters||l.value.hasSearchInputs||l.value.globalSearch)),b=e.computed(()=>Object.keys(a.resource).length===0?a.data:"data"in a.resource?a.resource.data:a.resource),g=e.computed(()=>Object.keys(a.resource).length===0?a.meta:"links"in a.resource&&"meta"in a.resource&&Object.keys(a.resource.links).length===4&&"next"in a.resource.links&&"prev"in a.resource.links?{...a.resource.meta,next_page_url:a.resource.links.next,prev_page_url:a.resource.links.prev}:"meta"in a.resource?a.resource.meta:a.resource),p=e.computed(()=>b.value.length>0||g.value.total>0);function N(n){s.value=s.value.filter(c=>c!=n),E(n,null)}function q(n){s.value.push(n)}const Ht=e.computed(()=>{if(s.value.length>0)return!0;const n=$.default.parse(location.search.substring(1));if(n[o.value]>1)return!0;const u=a.name==="default"?"":a.name+"_";let f=!1;return w.default(["filter","columns","cursor","sort"],h=>{const x=n[u+h];h==="sort"&&x===l.value.defaultSort||x!==void 0&&(f=!0)}),f});function K(){s.value=[],w.default(r.value.filters,(n,c)=>{r.value.filters[c].value=null}),w.default(r.value.searchInputs,(n,c)=>{r.value.searchInputs[c].value=null}),w.default(r.value.columns,(n,c)=>{r.value.columns[c].hidden=n.can_be_hidden?!l.value.defaultVisibleToggleableColumns.includes(n.key):!1}),r.value.sort=null,r.value.cursor=null,r.value.page=1}const G={};function E(n,c){clearTimeout(G[n]),G[n]=setTimeout(()=>{D.value&&a.preventOverlappingRequests&&D.value.cancel();const u=_("searchInputs",n);r.value.searchInputs[u].value=c,r.value.cursor=null,r.value.page=1},a.inputDebounceMs)}function Q(n){E("global",n)}function U(n,c){const u=_("filters",n);r.value.filters[u].value=c,r.value.cursor=null,r.value.page=1}function Y(n){r.value.cursor=null,r.value.perPage=n,r.value.page=1}function _(n,c){return _e.default(r.value[n],u=>u.key==c)}function J(n,c){const u=_("columns",n);r.value.columns[u].hidden=!c}function Kt(){let n={};return w.default(r.value.searchInputs,c=>{c.value!==null&&(n[c.key]=c.value)}),w.default(r.value.filters,c=>{c.value!==null&&(n[c.key]=c.value)}),n}function Gt(){const n=r.value.columns;let c=we.default(n,f=>!f.hidden),u=Be.default(c,f=>f.key).sort();return xe.default(u,l.value.defaultVisibleToggleableColumns)?{}:u}function Qt(){const n=Kt(),c=Gt(),u={};Object.keys(n).length>0&&(u.filter=n),Object.keys(c).length>0&&(u.columns=c);const f=r.value.cursor,h=r.value.page,x=r.value.sort,te=r.value.perPage;return f&&(u.cursor=f),h>1&&(u.page=h),te>1&&(u.perPage=te),x&&(u.sort=x),u}function Ut(){const n=$.default.parse(location.search.substring(1)),c=a.name==="default"?"":a.name+"_";w.default(["filter","columns","cursor","sort"],f=>{delete n[c+f]}),delete n[o.value],w.default(Qt(),(f,h)=>{h==="page"?n[o.value]=f:h==="perPage"?n.perPage=f:n[c+h]=f});let u=$.default.stringify(n,{filter(f,h){return typeof h=="object"&&h!==null?Ce.default(h):h},skipNulls:!0,strictNullHandling:!0});return(!u||u===o.value+"=1")&&(u=""),u}const v=e.ref(!1),D=e.ref(null);function F(n){!n||B.router.get(n,{},{replace:!0,preserveState:!0,preserveScroll:a.preserveScroll!==!1,onBefore(){v.value=!0},onCancelToken(c){D.value=c},onFinish(){v.value=!1},onSuccess(){if("queryBuilderProps"in B.usePage().props&&(r.value.cursor=l.value.cursor,r.value.page=l.value.page),a.preserveScroll==="table-top"){const u=m.value.getBoundingClientRect().top+window.pageYOffset+-8;window.scrollTo({top:u})}i.value++}})}e.watch(r,()=>{F(location.pathname+"?"+Ut())},{deep:!0});const X=()=>{i.value++};e.onMounted(()=>{document.addEventListener("inertia:success",X)}),e.onUnmounted(()=>{document.removeEventListener("inertia:success",X)});function Z(n){r.value.sort==n?r.value.sort=`-${n}`:r.value.sort=n,r.value.cursor=null,r.value.page=1}function T(n){const c=_("columns",n);return!r.value.columns[c].hidden}function ee(n){const c=_("columns",n),u=be.default(l.value.columns[c]);return u.onSort=Z,u}return(n,c)=>(e.openBlock(),e.createBlock(e.Transition,null,{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("fieldset",{ref_key:"tableFieldset",ref:m,key:`table-${t.name}`,dusk:`table-${t.name}`,class:e.normalizeClass(["min-w-0",{"opacity-75":v.value}])},[e.createElementVNode("div",Mt,[e.createElementVNode("div",zt,[e.renderSlot(n.$slots,"tableFilter",{hasFilters:l.value.hasFilters,hasEnabledFilters:l.value.hasEnabledFilters,filters:l.value.filters,onFilterChange:U},()=>[l.value.hasFilters?(e.openBlock(),e.createBlock(I,{key:0,"has-enabled-filters":l.value.hasEnabledFilters,filters:l.value.filters,"on-filter-change":U},null,8,["has-enabled-filters","filters"])):e.createCommentVNode("",!0)])]),l.value.globalSearch?(e.openBlock(),e.createElementBlock("div",Ot,[e.renderSlot(n.$slots,"tableGlobalSearch",{hasGlobalSearch:l.value.globalSearch,label:l.value.globalSearch?l.value.globalSearch.label:null,value:l.value.globalSearch?l.value.globalSearch.value:null,onChange:Q},()=>[l.value.globalSearch?(e.openBlock(),e.createBlock(R,{key:0,class:"grow",label:l.value.globalSearch.label,value:l.value.globalSearch.value,"on-change":Q,"pre-style":t.preStyle},null,8,["label","value","pre-style"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tableReset",{canBeReset:"canBeReset",onClick:K},()=>[Ht.value?(e.openBlock(),e.createElementBlock("div",Lt,[e.createVNode(A,{"on-click":K})])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"tableAddSearchRow",{hasSearchInputs:l.value.hasSearchInputs,hasSearchInputsWithoutValue:l.value.hasSearchInputsWithoutValue,searchInputs:l.value.searchInputsWithoutGlobal,onAdd:q},()=>[l.value.hasSearchInputs?(e.openBlock(),e.createBlock(O,{key:0,class:"order-3 sm:order-4 mr-2 sm:mr-4","search-inputs":l.value.searchInputsWithoutGlobal,"has-search-inputs-without-value":l.value.hasSearchInputsWithoutValue,"on-add":q},null,8,["search-inputs","has-search-inputs-without-value"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"tableColumns",{hasColumns:l.value.hasToggleableColumns,columns:l.value.columns,hasHiddenColumns:l.value.hasHiddenColumns,onChange:J},()=>[l.value.hasToggleableColumns?(e.openBlock(),e.createBlock(L,{key:0,class:"order-4 mr-4 sm:mr-0 sm:order-5",columns:l.value.columns,"has-hidden-columns":l.value.hasHiddenColumns,"on-change":J},null,8,["columns","has-hidden-columns"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"tableSearchRows",{hasSearchRowsWithValue:l.value.hasSearchInputsWithValue,searchInputs:l.value.searchInputsWithoutGlobal,forcedVisibleSearchInputs:s.value,onChange:E},()=>[l.value.hasSearchInputsWithValue||s.value.length>0?(e.openBlock(),e.createBlock(W,{key:0,"search-inputs":l.value.searchInputsWithoutGlobal,"forced-visible-search-inputs":s.value,"on-change":E,"on-remove":N},null,8,["search-inputs","forced-visible-search-inputs"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"tableWrapper",{meta:g.value},()=>[e.createVNode(H,{class:e.normalizeClass({"mt-3":!k.value})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"table",{},()=>[e.createElementVNode("table",It,[e.createElementVNode("thead",Rt,[e.renderSlot(n.$slots,"head",{show:T,sortBy:Z,header:ee},()=>[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.columns,u=>(e.openBlock(),e.createBlock(j,{key:`table-${t.name}-header-${u.key}`,cell:ee(u.key)},null,8,["cell"]))),128))])])]),e.createElementVNode("tbody",Wt,[e.renderSlot(n.$slots,"body",{show:T},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(u,f)=>(e.openBlock(),e.createElementBlock("tr",{key:`table-${t.name}-row-${f}`,class:e.normalizeClass(["",{"bg-gray-50":t.striped&&f%2,"hover:bg-gray-100":t.striped,"hover:bg-gray-50":!t.striped}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.columns,h=>e.withDirectives((e.openBlock(),e.createElementBlock("td",{key:`table-${t.name}-row-${f}-column-${h.key}`,class:"whitespace-nowrap px-3 py-4 text-sm text-gray-500"},[e.renderSlot(n.$slots,`cell(${h.key})`,{item:u},()=>[e.createTextVNode(e.toDisplayString(u[h.key]),1)])])),[[e.vShow,T(h.key)]])),128))],2))),128))])])])]),e.renderSlot(n.$slots,"pagination",{onClick:F,hasData:p.value,meta:g.value,perPageOptions:l.value.perPageOptions,onPerPageChange:Y},()=>[e.createVNode(z,{"on-click":F,"has-data":p.value,meta:g.value,"per-page-options":l.value.perPageOptions,"on-per-page-change":Y},null,8,["has-data","meta","per-page-options"])])]),_:3},8,["class"])])],10,jt))]),_:3}))}};d.ButtonWithDropdown=C,d.HeaderCell=j,d.OnClickOutside=P,d.Pagination=z,d.Table=At,d.TableAddSearchRow=O,d.TableColumns=L,d.TableFilter=I,d.TableGlobalSearch=R,d.TableReset=A,d.TableSearchRows=W,d.TableWrapper=H,d.getTranslations=S,d.setTranslation=Pe,d.setTranslations=je,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "@dootix-developer/inertiajs-tables-laravel-query-builder", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Inertia.js Front-end Components for Spatie's Laravel Query Builder", | ||
@@ -5,0 +5,0 @@ "private": false, |
97029
1384