react-admin-crud-manager 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +11 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +262 -260
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
2
|
-
import Ce, { useState as R, useRef as X, useEffect as
|
|
3
|
-
import { ChevronDown as
|
|
1
|
+
import { jsx as e, Fragment as G, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import Ce, { useState as R, useRef as X, useEffect as z, useMemo as Me } from "react";
|
|
3
|
+
import { ChevronDown as Te, Search as Re, Check as _e, X as ye, Filter as Ke, ChevronLeft as Ue, ChevronRight as ze, EllipsisVertical as He, User as Ie, Music as Ye, Plus as Ve } from "lucide-react";
|
|
4
4
|
import { createPortal as We } from "react-dom";
|
|
5
5
|
import { Icon as le } from "@iconify/react";
|
|
6
6
|
import { Editor as qe } from "@tinymce/tinymce-react";
|
|
@@ -101,7 +101,7 @@ const Oe = (h, n = "DD MMM YYYY") => {
|
|
|
101
101
|
);
|
|
102
102
|
Q.displayName = "Button";
|
|
103
103
|
function q({ label: h, required: n = !1 }) {
|
|
104
|
-
return /* @__PURE__ */ e(
|
|
104
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
105
|
h,
|
|
106
106
|
n && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
|
|
107
107
|
] }) });
|
|
@@ -124,42 +124,44 @@ const Qe = ({
|
|
|
124
124
|
dropdownMaxHeight: m = ""
|
|
125
125
|
}) => {
|
|
126
126
|
var A;
|
|
127
|
-
const [u, x] = R(!1), [
|
|
128
|
-
let
|
|
129
|
-
const f = (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const z = f(N);
|
|
135
|
-
return p ? k.includes(z) : z === k;
|
|
127
|
+
const [u, x] = R(!1), [w, S] = R(""), [$, I] = R(!0), M = X(null), j = X(null);
|
|
128
|
+
let E = n || n === !1 ? n : o;
|
|
129
|
+
const f = (v) => v == null || v === "" ? "" : String(typeof v == "boolean" ? v : v ?? ""), N = p ? (E || []).map(f) : f(E), O = h.filter(
|
|
130
|
+
(v) => v.label.toLowerCase().includes(w.toLowerCase())
|
|
131
|
+
), D = (v) => {
|
|
132
|
+
const H = f(v);
|
|
133
|
+
return p ? N.includes(H) : H === N;
|
|
136
134
|
};
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
M.current && !M.current.contains(
|
|
135
|
+
z(() => {
|
|
136
|
+
const v = (H) => {
|
|
137
|
+
M.current && !M.current.contains(H.target) && (x(!1), S(""));
|
|
140
138
|
};
|
|
141
|
-
return document.addEventListener("mousedown",
|
|
142
|
-
}, []),
|
|
139
|
+
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
140
|
+
}, []), z(() => {
|
|
143
141
|
if (u && M.current) {
|
|
144
|
-
const
|
|
145
|
-
|
|
142
|
+
const v = M.current.getBoundingClientRect(), Z = window.innerHeight - v.bottom;
|
|
143
|
+
I(Z < 200);
|
|
146
144
|
}
|
|
147
|
-
}, [u]),
|
|
148
|
-
u &&
|
|
145
|
+
}, [u]), z(() => {
|
|
146
|
+
u && j.current && j.current.focus();
|
|
149
147
|
}, [u]);
|
|
150
|
-
const F = (
|
|
151
|
-
let
|
|
152
|
-
if (
|
|
153
|
-
const Z =
|
|
148
|
+
const F = (v) => {
|
|
149
|
+
let H = v;
|
|
150
|
+
if (v === "true" ? H = !0 : v === "false" && (H = !1), p) {
|
|
151
|
+
const Z = N.includes(f(v));
|
|
154
152
|
let W;
|
|
155
153
|
Z ? W = n.filter(
|
|
156
|
-
(re) => f(re) !== f(
|
|
157
|
-
) : W = [...n || [],
|
|
154
|
+
(re) => f(re) !== f(v)
|
|
155
|
+
) : W = [...n || [], H], i(W);
|
|
158
156
|
} else
|
|
159
|
-
i(
|
|
157
|
+
i(H), x(!1);
|
|
160
158
|
S("");
|
|
161
|
-
}, U = p ? h.filter((
|
|
162
|
-
return
|
|
159
|
+
}, U = p ? h.filter((v) => D(v.value)).map((v) => v.label).join(", ") : (A = h.find((v) => D(v.value))) == null ? void 0 : A.label;
|
|
160
|
+
return z(() => {
|
|
161
|
+
(E || E === !1) && setTimeout(() => {
|
|
162
|
+
i(E);
|
|
163
|
+
}, 100);
|
|
164
|
+
}, []), /* @__PURE__ */ c("div", { className: d || "col-span-12", children: [
|
|
163
165
|
/* @__PURE__ */ e(q, { label: L, required: b }),
|
|
164
166
|
/* @__PURE__ */ c("div", { className: `relative ${l}`, ref: M, children: [
|
|
165
167
|
/* @__PURE__ */ e(
|
|
@@ -185,7 +187,7 @@ const Qe = ({
|
|
|
185
187
|
children: [
|
|
186
188
|
/* @__PURE__ */ e("span", { className: "truncate", children: U || s }),
|
|
187
189
|
/* @__PURE__ */ e(
|
|
188
|
-
|
|
190
|
+
Te,
|
|
189
191
|
{
|
|
190
192
|
className: `w-4 h-4 transition-transform ${u ? "rotate-180" : ""}`
|
|
191
193
|
}
|
|
@@ -197,17 +199,17 @@ const Qe = ({
|
|
|
197
199
|
"div",
|
|
198
200
|
{
|
|
199
201
|
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
200
|
-
${
|
|
202
|
+
${$ ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
201
203
|
children: [
|
|
202
204
|
C && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
203
205
|
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
204
206
|
/* @__PURE__ */ e(
|
|
205
207
|
"input",
|
|
206
208
|
{
|
|
207
|
-
ref:
|
|
209
|
+
ref: j,
|
|
208
210
|
type: "text",
|
|
209
|
-
value:
|
|
210
|
-
onChange: (
|
|
211
|
+
value: w,
|
|
212
|
+
onChange: (v) => S(v.target.value),
|
|
211
213
|
placeholder: "Search...",
|
|
212
214
|
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
|
|
213
215
|
}
|
|
@@ -220,19 +222,19 @@ const Qe = ({
|
|
|
220
222
|
style: {
|
|
221
223
|
maxHeight: m || ""
|
|
222
224
|
},
|
|
223
|
-
children: O.length > 0 ? O.map((
|
|
225
|
+
children: O.length > 0 ? O.map((v) => /* @__PURE__ */ c(
|
|
224
226
|
"button",
|
|
225
227
|
{
|
|
226
228
|
type: "button",
|
|
227
|
-
onClick: () => F(String(
|
|
229
|
+
onClick: () => F(String(v.value)),
|
|
228
230
|
className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
|
|
229
|
-
${D(
|
|
231
|
+
${D(v.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
230
232
|
children: [
|
|
231
|
-
/* @__PURE__ */ e("span", { children:
|
|
232
|
-
p && D(
|
|
233
|
+
/* @__PURE__ */ e("span", { children: v.label }),
|
|
234
|
+
p && D(v.value) && /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
|
|
233
235
|
]
|
|
234
236
|
},
|
|
235
|
-
String(
|
|
237
|
+
String(v.value)
|
|
236
238
|
)) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
|
|
237
239
|
}
|
|
238
240
|
)
|
|
@@ -256,7 +258,7 @@ const Qe = ({
|
|
|
256
258
|
{ label: "Active", value: !0 },
|
|
257
259
|
{ label: "Inactive", value: !1 }
|
|
258
260
|
];
|
|
259
|
-
return /* @__PURE__ */ e(
|
|
261
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
260
262
|
/* @__PURE__ */ e(q, { label: s, required: l }),
|
|
261
263
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
|
|
262
264
|
o && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: o }),
|
|
@@ -550,42 +552,42 @@ function ea({
|
|
|
550
552
|
countriesList: b = !1,
|
|
551
553
|
defaultCountry: y = ""
|
|
552
554
|
}) {
|
|
553
|
-
const d = (
|
|
555
|
+
const d = (N) => me.find((O) => O.code == N), [p, m] = R(
|
|
554
556
|
d(y) || me[0]
|
|
555
|
-
), [u, x] = R(""), [
|
|
556
|
-
|
|
557
|
+
), [u, x] = R(""), [w, S] = R(!1), [$, I] = R(""), M = X();
|
|
558
|
+
z(() => {
|
|
557
559
|
if (typeof n == "string" && n.startsWith("+")) {
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
m(
|
|
560
|
+
const N = me.filter((O) => n.startsWith("+" + O.phone)).sort((O, D) => D.phone.length - O.phone.length)[0];
|
|
561
|
+
if (N) {
|
|
562
|
+
m(N), x(n.replace("+" + N.phone, ""));
|
|
561
563
|
return;
|
|
562
564
|
}
|
|
563
565
|
}
|
|
564
566
|
x(n);
|
|
565
567
|
}, [n]);
|
|
566
|
-
const
|
|
567
|
-
const O =
|
|
568
|
+
const j = (N) => {
|
|
569
|
+
const O = N.target.value.replace(/\D/g, "");
|
|
568
570
|
x(O), p && s && s("+" + p.phone + O);
|
|
569
|
-
},
|
|
570
|
-
m(
|
|
571
|
+
}, E = (N) => {
|
|
572
|
+
m(N), s && s("+" + N.phone + u), S(!1), I("");
|
|
571
573
|
};
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
+
z(() => {
|
|
575
|
+
const N = (O) => {
|
|
574
576
|
M.current && !M.current.contains(O.target) && S(!1);
|
|
575
577
|
};
|
|
576
|
-
return document.addEventListener("mousedown",
|
|
578
|
+
return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
|
|
577
579
|
}, []);
|
|
578
580
|
const f = me.filter(
|
|
579
|
-
(
|
|
581
|
+
(N) => N.label.toLowerCase().includes($.toLowerCase()) || N.phone.includes($)
|
|
580
582
|
);
|
|
581
|
-
return b ? /* @__PURE__ */ e(
|
|
583
|
+
return b ? /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
582
584
|
/* @__PURE__ */ e(q, { label: h, required: r }),
|
|
583
585
|
/* @__PURE__ */ c("div", { className: "relative ", ref: M, children: [
|
|
584
586
|
/* @__PURE__ */ c(
|
|
585
587
|
"div",
|
|
586
588
|
{
|
|
587
589
|
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
588
|
-
${
|
|
590
|
+
${w ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
589
591
|
${l ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
590
592
|
children: [
|
|
591
593
|
/* @__PURE__ */ c(
|
|
@@ -593,7 +595,7 @@ function ea({
|
|
|
593
595
|
{
|
|
594
596
|
type: "button",
|
|
595
597
|
disabled: l,
|
|
596
|
-
onClick: () => S(!
|
|
598
|
+
onClick: () => S(!w),
|
|
597
599
|
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
598
600
|
children: [
|
|
599
601
|
p ? /* @__PURE__ */ e(
|
|
@@ -604,7 +606,7 @@ function ea({
|
|
|
604
606
|
className: "w-5 h-3 object-cover"
|
|
605
607
|
}
|
|
606
608
|
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
607
|
-
/* @__PURE__ */ e(
|
|
609
|
+
/* @__PURE__ */ e(Te, { className: "w-3 h-3 text-gray-500" })
|
|
608
610
|
]
|
|
609
611
|
}
|
|
610
612
|
),
|
|
@@ -617,7 +619,7 @@ function ea({
|
|
|
617
619
|
{
|
|
618
620
|
type: "tel",
|
|
619
621
|
value: u,
|
|
620
|
-
onChange:
|
|
622
|
+
onChange: j,
|
|
621
623
|
required: r,
|
|
622
624
|
disabled: l || !p,
|
|
623
625
|
placeholder: p ? C : "Select a country",
|
|
@@ -643,48 +645,48 @@ function ea({
|
|
|
643
645
|
]
|
|
644
646
|
}
|
|
645
647
|
),
|
|
646
|
-
|
|
648
|
+
w && /* @__PURE__ */ c("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
|
|
647
649
|
L && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
648
650
|
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
649
651
|
/* @__PURE__ */ e(
|
|
650
652
|
"input",
|
|
651
653
|
{
|
|
652
654
|
type: "text",
|
|
653
|
-
value:
|
|
654
|
-
onChange: (
|
|
655
|
+
value: $,
|
|
656
|
+
onChange: (N) => I(N.target.value),
|
|
655
657
|
placeholder: "Search country...",
|
|
656
658
|
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
|
|
657
659
|
}
|
|
658
660
|
)
|
|
659
661
|
] }) }),
|
|
660
|
-
f.map((
|
|
662
|
+
f.map((N) => /* @__PURE__ */ c(
|
|
661
663
|
"button",
|
|
662
664
|
{
|
|
663
665
|
type: "button",
|
|
664
|
-
onClick: () =>
|
|
666
|
+
onClick: () => E(N),
|
|
665
667
|
className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
|
|
666
668
|
children: [
|
|
667
669
|
/* @__PURE__ */ e(
|
|
668
670
|
"img",
|
|
669
671
|
{
|
|
670
|
-
src: `https://flagcdn.com/w20/${
|
|
671
|
-
alt:
|
|
672
|
+
src: `https://flagcdn.com/w20/${N.code.toLowerCase()}.png`,
|
|
673
|
+
alt: N.code,
|
|
672
674
|
className: "w-5 h-3 object-cover"
|
|
673
675
|
}
|
|
674
676
|
),
|
|
675
677
|
/* @__PURE__ */ c("span", { children: [
|
|
676
|
-
|
|
678
|
+
N.label,
|
|
677
679
|
" (+",
|
|
678
|
-
|
|
680
|
+
N.phone,
|
|
679
681
|
")"
|
|
680
682
|
] })
|
|
681
683
|
]
|
|
682
684
|
},
|
|
683
|
-
|
|
685
|
+
N.code
|
|
684
686
|
))
|
|
685
687
|
] })
|
|
686
688
|
] })
|
|
687
|
-
] }, o) }) : /* @__PURE__ */ e(
|
|
689
|
+
] }, o) }) : /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
688
690
|
/* @__PURE__ */ e(q, { label: h, required: r }),
|
|
689
691
|
/* @__PURE__ */ e(
|
|
690
692
|
"input",
|
|
@@ -713,7 +715,7 @@ const Fe = Ce.forwardRef(
|
|
|
713
715
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
714
716
|
${h}
|
|
715
717
|
`.trim();
|
|
716
|
-
return /* @__PURE__ */ e(
|
|
718
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i.parentClass || "col-span-12", children: [
|
|
717
719
|
/* @__PURE__ */ e(q, { label: n, required: o }),
|
|
718
720
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
719
721
|
"textarea",
|
|
@@ -740,34 +742,34 @@ const aa = ({
|
|
|
740
742
|
parentClass: L = ""
|
|
741
743
|
}) => {
|
|
742
744
|
const [b, y] = R(n), [d, p] = R(!1), m = X(null);
|
|
743
|
-
|
|
745
|
+
z(() => (n instanceof File ? y({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, y(n)), () => {
|
|
744
746
|
b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview);
|
|
745
747
|
}), [n]);
|
|
746
748
|
const u = (M) => {
|
|
747
749
|
if (!M || M.length === 0)
|
|
748
750
|
return;
|
|
749
|
-
const
|
|
750
|
-
b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), y(f), o == null || o(
|
|
751
|
+
const j = M[0], E = URL.createObjectURL(j), f = { file: j, preview: E };
|
|
752
|
+
b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), y(f), o == null || o(j);
|
|
751
753
|
}, x = (M) => {
|
|
752
754
|
M && M.stopPropagation(), b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), y(null), o == null || o(null), m.current && (m.current.value = "");
|
|
753
|
-
},
|
|
755
|
+
}, w = (M) => {
|
|
754
756
|
r && (M.preventDefault(), p(!0));
|
|
755
757
|
}, S = (M) => {
|
|
756
758
|
r && (M.preventDefault(), p(!1));
|
|
757
|
-
},
|
|
759
|
+
}, $ = (M) => {
|
|
758
760
|
r && (M.preventDefault(), p(!1), u(M.dataTransfer.files));
|
|
759
|
-
},
|
|
761
|
+
}, I = () => {
|
|
760
762
|
m.current.click();
|
|
761
763
|
};
|
|
762
|
-
return /* @__PURE__ */ e(
|
|
764
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
763
765
|
/* @__PURE__ */ e(q, { label: h, required: i }),
|
|
764
766
|
/* @__PURE__ */ c(
|
|
765
767
|
"div",
|
|
766
768
|
{
|
|
767
769
|
className: `relative rounded-md p-2 transition-all ${d ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
768
|
-
onDragOver:
|
|
770
|
+
onDragOver: w,
|
|
769
771
|
onDragLeave: S,
|
|
770
|
-
onDrop:
|
|
772
|
+
onDrop: $,
|
|
771
773
|
children: [
|
|
772
774
|
/* @__PURE__ */ e(
|
|
773
775
|
"input",
|
|
@@ -823,7 +825,7 @@ const aa = ({
|
|
|
823
825
|
Q,
|
|
824
826
|
{
|
|
825
827
|
type: "button",
|
|
826
|
-
onClick:
|
|
828
|
+
onClick: I,
|
|
827
829
|
variant: "outlined",
|
|
828
830
|
color: "default",
|
|
829
831
|
children: b ? "Change Image" : "Select Image"
|
|
@@ -872,7 +874,7 @@ const aa = ({
|
|
|
872
874
|
${s === "number" ? "no-spinner" : ""}
|
|
873
875
|
${i}
|
|
874
876
|
`.trim();
|
|
875
|
-
return /* @__PURE__ */ e(
|
|
877
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: o || "col-span-12", children: [
|
|
876
878
|
/* @__PURE__ */ e(q, { label: h, required: n }),
|
|
877
879
|
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
878
880
|
/* @__PURE__ */ e(
|
|
@@ -924,7 +926,7 @@ const ra = ({
|
|
|
924
926
|
menubar: m = !1,
|
|
925
927
|
fontFamily: u = "Inter, sans-serif",
|
|
926
928
|
initConfig: x = {},
|
|
927
|
-
imageUploadHandler:
|
|
929
|
+
imageUploadHandler: w
|
|
928
930
|
// ✅ Promise function passed from parent
|
|
929
931
|
}) => /* @__PURE__ */ c("div", { className: C, children: [
|
|
930
932
|
s && /* @__PURE__ */ e(q, { label: s, required: l }),
|
|
@@ -941,15 +943,15 @@ const ra = ({
|
|
|
941
943
|
branding: !1,
|
|
942
944
|
statusbar: !0,
|
|
943
945
|
automatic_uploads: !0,
|
|
944
|
-
images_upload_handler: (M) => new Promise((
|
|
945
|
-
if (!
|
|
946
|
-
|
|
946
|
+
images_upload_handler: (M) => new Promise((j, E) => {
|
|
947
|
+
if (!w) {
|
|
948
|
+
j(`data:${M.blob().type};base64,${M.base64()}`);
|
|
947
949
|
return;
|
|
948
950
|
}
|
|
949
|
-
|
|
950
|
-
f ?
|
|
951
|
+
w(M).then((f) => {
|
|
952
|
+
f ? j(f) : E("Upload failed: No URL returned");
|
|
951
953
|
}).catch((f) => {
|
|
952
|
-
|
|
954
|
+
E(
|
|
953
955
|
typeof f == "string" ? f : (f == null ? void 0 : f.message) || "Image upload failed"
|
|
954
956
|
);
|
|
955
957
|
});
|
|
@@ -1010,17 +1012,17 @@ const ra = ({
|
|
|
1010
1012
|
if (!b)
|
|
1011
1013
|
s(x ? u : "", h);
|
|
1012
1014
|
else {
|
|
1013
|
-
const
|
|
1015
|
+
const w = Array.isArray(i) ? [...i] : [];
|
|
1014
1016
|
if (x)
|
|
1015
|
-
|
|
1017
|
+
w.includes(u) || w.push(u);
|
|
1016
1018
|
else {
|
|
1017
|
-
const S =
|
|
1018
|
-
S > -1 &&
|
|
1019
|
+
const S = w.indexOf(u);
|
|
1020
|
+
S > -1 && w.splice(S, 1);
|
|
1019
1021
|
}
|
|
1020
|
-
s(
|
|
1022
|
+
s(w, h);
|
|
1021
1023
|
}
|
|
1022
1024
|
};
|
|
1023
|
-
return y ? /* @__PURE__ */ e(
|
|
1025
|
+
return y ? /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: `${C}`, children: [
|
|
1024
1026
|
/* @__PURE__ */ e(q, { label: n, required: r }),
|
|
1025
1027
|
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: o.map((u, x) => /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1026
1028
|
/* @__PURE__ */ e(
|
|
@@ -1032,7 +1034,7 @@ const ra = ({
|
|
|
1032
1034
|
checked: d(u.value),
|
|
1033
1035
|
disabled: l || u.disabled,
|
|
1034
1036
|
required: r && x === 0,
|
|
1035
|
-
onChange: (
|
|
1037
|
+
onChange: (w) => m(u.value, w.target.checked),
|
|
1036
1038
|
className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${L}`
|
|
1037
1039
|
},
|
|
1038
1040
|
h
|
|
@@ -1082,9 +1084,9 @@ const ra = ({
|
|
|
1082
1084
|
buttonProps: y = {}
|
|
1083
1085
|
}) => {
|
|
1084
1086
|
const [d, p] = R(null), [m, u] = R(!1), x = X(null);
|
|
1085
|
-
|
|
1087
|
+
z(() => {
|
|
1086
1088
|
if (!n) {
|
|
1087
|
-
|
|
1089
|
+
w(), p(null);
|
|
1088
1090
|
return;
|
|
1089
1091
|
}
|
|
1090
1092
|
if (n instanceof File) {
|
|
@@ -1094,22 +1096,22 @@ const ra = ({
|
|
|
1094
1096
|
};
|
|
1095
1097
|
} else typeof n == "string" ? p({ preview: n }) : n != null && n.preview && p(n);
|
|
1096
1098
|
}, [n]);
|
|
1097
|
-
const
|
|
1099
|
+
const w = () => {
|
|
1098
1100
|
d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview);
|
|
1099
1101
|
}, S = (f) => {
|
|
1100
1102
|
if (!f || f.length === 0)
|
|
1101
1103
|
return;
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
f && f.stopPropagation(),
|
|
1106
|
-
},
|
|
1104
|
+
const N = f[0], O = URL.createObjectURL(N);
|
|
1105
|
+
w(), p({ file: N, preview: O }), o == null || o(N);
|
|
1106
|
+
}, $ = (f) => {
|
|
1107
|
+
f && f.stopPropagation(), w(), p(null), o == null || o(null), x.current && (x.current.value = "");
|
|
1108
|
+
}, I = (f) => {
|
|
1107
1109
|
r && (f.preventDefault(), u(!0));
|
|
1108
1110
|
}, M = (f) => {
|
|
1109
1111
|
r && (f.preventDefault(), u(!1));
|
|
1110
|
-
},
|
|
1112
|
+
}, j = (f) => {
|
|
1111
1113
|
r && (f.preventDefault(), u(!1), S(f.dataTransfer.files));
|
|
1112
|
-
},
|
|
1114
|
+
}, E = () => {
|
|
1113
1115
|
x.current.click();
|
|
1114
1116
|
};
|
|
1115
1117
|
return /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
@@ -1118,9 +1120,9 @@ const ra = ({
|
|
|
1118
1120
|
"div",
|
|
1119
1121
|
{
|
|
1120
1122
|
className: `relative rounded-lg p-2 transition-all ${m ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
1121
|
-
onDragOver:
|
|
1123
|
+
onDragOver: I,
|
|
1122
1124
|
onDragLeave: M,
|
|
1123
|
-
onDrop:
|
|
1125
|
+
onDrop: j,
|
|
1124
1126
|
children: [
|
|
1125
1127
|
/* @__PURE__ */ e(
|
|
1126
1128
|
"input",
|
|
@@ -1146,7 +1148,7 @@ const ra = ({
|
|
|
1146
1148
|
"button",
|
|
1147
1149
|
{
|
|
1148
1150
|
type: "button",
|
|
1149
|
-
onClick:
|
|
1151
|
+
onClick: $,
|
|
1150
1152
|
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
|
|
1151
1153
|
"aria-label": "Remove audio",
|
|
1152
1154
|
children: /* @__PURE__ */ e(le, { icon: "mdi:close", className: "w-3 h-3" })
|
|
@@ -1154,7 +1156,7 @@ const ra = ({
|
|
|
1154
1156
|
),
|
|
1155
1157
|
/* @__PURE__ */ e("audio", { src: d.preview, controls: !0 }, d.preview)
|
|
1156
1158
|
] }),
|
|
1157
|
-
/* @__PURE__ */ e(Q, { type: "button", onClick:
|
|
1159
|
+
/* @__PURE__ */ e(Q, { type: "button", onClick: E, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1158
1160
|
] })
|
|
1159
1161
|
) : (
|
|
1160
1162
|
// Empty state with upload button
|
|
@@ -1164,7 +1166,7 @@ const ra = ({
|
|
|
1164
1166
|
Q,
|
|
1165
1167
|
{
|
|
1166
1168
|
type: "button",
|
|
1167
|
-
onClick:
|
|
1169
|
+
onClick: E,
|
|
1168
1170
|
variant: "outlined",
|
|
1169
1171
|
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1170
1172
|
}
|
|
@@ -1194,15 +1196,15 @@ const ra = ({
|
|
|
1194
1196
|
required: m = !1,
|
|
1195
1197
|
minLength: u,
|
|
1196
1198
|
dragDrop: x,
|
|
1197
|
-
parentClass:
|
|
1199
|
+
parentClass: w,
|
|
1198
1200
|
countriesList: S,
|
|
1199
|
-
defaultCountry:
|
|
1200
|
-
multiple:
|
|
1201
|
+
defaultCountry: $,
|
|
1202
|
+
multiple: I,
|
|
1201
1203
|
dropdownMaxHeight: M,
|
|
1202
|
-
editorKey:
|
|
1203
|
-
fontFamily:
|
|
1204
|
+
editorKey: j,
|
|
1205
|
+
fontFamily: E,
|
|
1204
1206
|
disabled: f,
|
|
1205
|
-
negativeNumberAllow:
|
|
1207
|
+
negativeNumberAllow: N,
|
|
1206
1208
|
defaultValue: O
|
|
1207
1209
|
} = h;
|
|
1208
1210
|
let D = n == null ? void 0 : n[i];
|
|
@@ -1224,8 +1226,8 @@ const ra = ({
|
|
|
1224
1226
|
label: s,
|
|
1225
1227
|
name: i,
|
|
1226
1228
|
disabled: f,
|
|
1227
|
-
parentClass:
|
|
1228
|
-
multiple:
|
|
1229
|
+
parentClass: w,
|
|
1230
|
+
multiple: I,
|
|
1229
1231
|
dropdownMaxHeight: M
|
|
1230
1232
|
}
|
|
1231
1233
|
);
|
|
@@ -1239,9 +1241,9 @@ const ra = ({
|
|
|
1239
1241
|
value: D,
|
|
1240
1242
|
onChange: (A) => o(i, A),
|
|
1241
1243
|
required: m,
|
|
1242
|
-
parentClass:
|
|
1244
|
+
parentClass: w,
|
|
1243
1245
|
className: b || "",
|
|
1244
|
-
multiSelect:
|
|
1246
|
+
multiSelect: I,
|
|
1245
1247
|
disabled: f
|
|
1246
1248
|
}
|
|
1247
1249
|
);
|
|
@@ -1257,7 +1259,7 @@ const ra = ({
|
|
|
1257
1259
|
required: m,
|
|
1258
1260
|
name: i,
|
|
1259
1261
|
disabled: f,
|
|
1260
|
-
parentClass:
|
|
1262
|
+
parentClass: w
|
|
1261
1263
|
}
|
|
1262
1264
|
);
|
|
1263
1265
|
case "phone":
|
|
@@ -1267,14 +1269,14 @@ const ra = ({
|
|
|
1267
1269
|
value: D,
|
|
1268
1270
|
onChange: (A) => o(i, A),
|
|
1269
1271
|
countriesList: S,
|
|
1270
|
-
defaultCountry:
|
|
1272
|
+
defaultCountry: $,
|
|
1271
1273
|
required: m,
|
|
1272
1274
|
placeholder: F,
|
|
1273
1275
|
search: y,
|
|
1274
1276
|
label: s,
|
|
1275
1277
|
name: i,
|
|
1276
1278
|
disabled: f,
|
|
1277
|
-
parentClass:
|
|
1279
|
+
parentClass: w
|
|
1278
1280
|
}
|
|
1279
1281
|
);
|
|
1280
1282
|
case "textarea":
|
|
@@ -1290,7 +1292,7 @@ const ra = ({
|
|
|
1290
1292
|
name: i,
|
|
1291
1293
|
label: s,
|
|
1292
1294
|
disabled: f,
|
|
1293
|
-
parentClass:
|
|
1295
|
+
parentClass: w
|
|
1294
1296
|
}
|
|
1295
1297
|
);
|
|
1296
1298
|
case "image":
|
|
@@ -1305,7 +1307,7 @@ const ra = ({
|
|
|
1305
1307
|
dragDrop: x,
|
|
1306
1308
|
label: s,
|
|
1307
1309
|
name: i,
|
|
1308
|
-
parentClass:
|
|
1310
|
+
parentClass: w
|
|
1309
1311
|
}
|
|
1310
1312
|
);
|
|
1311
1313
|
case "audio":
|
|
@@ -1320,7 +1322,7 @@ const ra = ({
|
|
|
1320
1322
|
dragDrop: x,
|
|
1321
1323
|
label: s,
|
|
1322
1324
|
name: i,
|
|
1323
|
-
parentClass:
|
|
1325
|
+
parentClass: w
|
|
1324
1326
|
}
|
|
1325
1327
|
);
|
|
1326
1328
|
case "tinyEditor":
|
|
@@ -1332,9 +1334,9 @@ const ra = ({
|
|
|
1332
1334
|
required: m,
|
|
1333
1335
|
placeholder: F,
|
|
1334
1336
|
label: s,
|
|
1335
|
-
parentClass:
|
|
1336
|
-
fontFamily:
|
|
1337
|
-
editorKey:
|
|
1337
|
+
parentClass: w,
|
|
1338
|
+
fontFamily: E,
|
|
1339
|
+
editorKey: j,
|
|
1338
1340
|
disabled: f
|
|
1339
1341
|
},
|
|
1340
1342
|
`editor-${i}`
|
|
@@ -1352,8 +1354,8 @@ const ra = ({
|
|
|
1352
1354
|
name: i,
|
|
1353
1355
|
minLength: u,
|
|
1354
1356
|
label: s,
|
|
1355
|
-
negativeNumberAllow:
|
|
1356
|
-
parentClass:
|
|
1357
|
+
negativeNumberAllow: N,
|
|
1358
|
+
parentClass: w,
|
|
1357
1359
|
disabled: f
|
|
1358
1360
|
}
|
|
1359
1361
|
);
|
|
@@ -1367,7 +1369,7 @@ const ra = ({
|
|
|
1367
1369
|
}, L = () => {
|
|
1368
1370
|
l({}), i == null || i({}), n();
|
|
1369
1371
|
};
|
|
1370
|
-
return /* @__PURE__ */ c(
|
|
1372
|
+
return /* @__PURE__ */ c(G, { children: [
|
|
1371
1373
|
/* @__PURE__ */ e(
|
|
1372
1374
|
"div",
|
|
1373
1375
|
{
|
|
@@ -1394,7 +1396,7 @@ const ra = ({
|
|
|
1394
1396
|
}
|
|
1395
1397
|
)
|
|
1396
1398
|
] }),
|
|
1397
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: o != null && o.component ? /* @__PURE__ */ e(o.component, { filters: s, onFilterChange: r }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (b = o == null ? void 0 : o.fields) == null ? void 0 : b.map((y) => /* @__PURE__ */ e(
|
|
1399
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: o != null && o.component ? /* @__PURE__ */ e(o.component, { filters: s, onFilterChange: r }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (b = o == null ? void 0 : o.fields) == null ? void 0 : b.map((y) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
1398
1400
|
Ee,
|
|
1399
1401
|
{
|
|
1400
1402
|
field: y,
|
|
@@ -1479,7 +1481,7 @@ const ra = ({
|
|
|
1479
1481
|
children: h
|
|
1480
1482
|
}
|
|
1481
1483
|
);
|
|
1482
|
-
}, oa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ c(
|
|
1484
|
+
}, oa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ c(G, { children: [
|
|
1483
1485
|
/* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
|
|
1484
1486
|
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse", children: [
|
|
1485
1487
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: n }).map((o, i) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, i)) }) }),
|
|
@@ -1494,14 +1496,14 @@ const ra = ({
|
|
|
1494
1496
|
] }) })
|
|
1495
1497
|
] }), Ge = ({ src: h, alt: n = "preview", isOpen: o, setIsOpen: i }) => {
|
|
1496
1498
|
const s = () => i(!1);
|
|
1497
|
-
return
|
|
1499
|
+
return z(() => {
|
|
1498
1500
|
const l = (r) => {
|
|
1499
1501
|
r.key === "Escape" && s();
|
|
1500
1502
|
};
|
|
1501
1503
|
return o && (document.body.style.overflow = "hidden", document.addEventListener("keydown", l)), () => {
|
|
1502
1504
|
document.body.style.overflow = "", document.removeEventListener("keydown", l);
|
|
1503
1505
|
};
|
|
1504
|
-
}, [o]), /* @__PURE__ */ e(
|
|
1506
|
+
}, [o]), /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c(
|
|
1505
1507
|
"div",
|
|
1506
1508
|
{
|
|
1507
1509
|
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
@@ -1560,7 +1562,7 @@ const ra = ({
|
|
|
1560
1562
|
},
|
|
1561
1563
|
onFilterApply: y,
|
|
1562
1564
|
filterConfig: d = null
|
|
1563
|
-
} = h, [p, m] = R(""), [u, x] = R(null), [
|
|
1565
|
+
} = h, [p, m] = R(""), [u, x] = R(null), [w, S] = R([]), [$, I] = R({}), [M, j] = R(!1), [E, f] = R(null), [N, O] = R(!1), D = Me(() => !s.enabled || !p.trim() || s.useServerSideSearch ? n : Je(n, p, s.searchKeys || []), [n, p, s]), [F, U] = R(1), [A, v] = R((r == null ? void 0 : r.rows_per_page) || 50), [H, Z] = R(D.length || 0), W = r != null && r.useServerSidePagination ? r.total_pages : Math.ceil(D.length / A), re = Me(() => {
|
|
1564
1566
|
if (r.useServerSidePagination) return D;
|
|
1565
1567
|
const t = (F - 1) * A;
|
|
1566
1568
|
return D.slice(t, t + A);
|
|
@@ -1576,20 +1578,20 @@ const ra = ({
|
|
|
1576
1578
|
console.error("Search error:", g);
|
|
1577
1579
|
}
|
|
1578
1580
|
}, 800));
|
|
1579
|
-
}, xe = (t, g,
|
|
1580
|
-
|
|
1581
|
-
}, ve = (t, g,
|
|
1582
|
-
g.stopPropagation(), S(
|
|
1581
|
+
}, xe = (t, g, T) => {
|
|
1582
|
+
T.stopPropagation(), x(null), L == null || L(t.type, g);
|
|
1583
|
+
}, ve = (t, g, T) => {
|
|
1584
|
+
g.stopPropagation(), S(T);
|
|
1583
1585
|
const K = g.currentTarget;
|
|
1584
1586
|
se.current[t] = K;
|
|
1585
|
-
const _ = K.getBoundingClientRect(), J = 192, V =
|
|
1586
|
-
|
|
1587
|
-
top: Math.max(8, Math.min(Y,
|
|
1587
|
+
const _ = K.getBoundingClientRect(), J = 192, V = T.length * 40, ee = window.innerWidth, k = window.innerHeight, B = ee - _.right < J ? _.left - J + _.width : _.left, Y = k - _.bottom < V && _.top > V ? _.top - V - 2 : _.bottom + 2;
|
|
1588
|
+
I({
|
|
1589
|
+
top: Math.max(8, Math.min(Y, k - V - 8)),
|
|
1588
1590
|
left: Math.max(8, Math.min(B, ee - J - 8))
|
|
1589
1591
|
}), x(u === t ? null : t);
|
|
1590
1592
|
}, we = (t) => (F - 1) * A + t + 1, de = (t) => {
|
|
1591
1593
|
f(t), O(!0);
|
|
1592
|
-
}, ie = (t, g,
|
|
1594
|
+
}, ie = (t, g, T, K = null) => /* @__PURE__ */ e(G, { children: t ? /* @__PURE__ */ e(
|
|
1593
1595
|
"img",
|
|
1594
1596
|
{
|
|
1595
1597
|
src: t,
|
|
@@ -1597,26 +1599,26 @@ const ra = ({
|
|
|
1597
1599
|
onClick: (_) => {
|
|
1598
1600
|
_.stopPropagation(), _.preventDefault(), de({ src: t, alt: g });
|
|
1599
1601
|
},
|
|
1600
|
-
className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${
|
|
1602
|
+
className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${T || ""}`
|
|
1601
1603
|
}
|
|
1602
|
-
) : /* @__PURE__ */ e(
|
|
1604
|
+
) : /* @__PURE__ */ e(G, { children: K || /* @__PURE__ */ e(
|
|
1603
1605
|
"div",
|
|
1604
1606
|
{
|
|
1605
|
-
className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${
|
|
1606
|
-
children: /* @__PURE__ */ e(
|
|
1607
|
+
className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${T || ""}`,
|
|
1608
|
+
children: /* @__PURE__ */ e(Ie, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1607
1609
|
}
|
|
1608
|
-
) }) }), ce = (t, g) => /* @__PURE__ */ e(
|
|
1610
|
+
) }) }), ce = (t, g) => /* @__PURE__ */ e(G, { children: t ? /* @__PURE__ */ e(
|
|
1609
1611
|
"audio",
|
|
1610
1612
|
{
|
|
1611
1613
|
controls: !0,
|
|
1612
1614
|
src: t,
|
|
1613
|
-
onClick: (
|
|
1614
|
-
|
|
1615
|
+
onClick: (T) => {
|
|
1616
|
+
T.stopPropagation();
|
|
1615
1617
|
},
|
|
1616
1618
|
className: `w-64 cursor-pointer ${g || ""}`
|
|
1617
1619
|
},
|
|
1618
1620
|
t
|
|
1619
|
-
) : /* @__PURE__ */ e(
|
|
1621
|
+
) : /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
1620
1622
|
"div",
|
|
1621
1623
|
{
|
|
1622
1624
|
className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${g || ""}`,
|
|
@@ -1630,23 +1632,23 @@ const ra = ({
|
|
|
1630
1632
|
] })
|
|
1631
1633
|
] }), ue = (t, g) => {
|
|
1632
1634
|
var J;
|
|
1633
|
-
let
|
|
1635
|
+
let T = String(t);
|
|
1634
1636
|
const K = g.variant || "contained";
|
|
1635
1637
|
let _ = g.defaultColor;
|
|
1636
1638
|
if (((J = g == null ? void 0 : g.chipOptions) == null ? void 0 : J.length) > 0) {
|
|
1637
1639
|
let V = g == null ? void 0 : g.chipOptions.find((ee) => ee.value == t);
|
|
1638
|
-
V && (
|
|
1640
|
+
V && (T = V.label, _ = V.color);
|
|
1639
1641
|
}
|
|
1640
1642
|
return /* @__PURE__ */ e(
|
|
1641
1643
|
$e,
|
|
1642
1644
|
{
|
|
1643
|
-
label:
|
|
1645
|
+
label: T,
|
|
1644
1646
|
variant: K,
|
|
1645
1647
|
color: _,
|
|
1646
1648
|
className: g.className || ""
|
|
1647
1649
|
}
|
|
1648
1650
|
);
|
|
1649
|
-
}, be = (t, g,
|
|
1651
|
+
}, be = (t, g, T) => {
|
|
1650
1652
|
const K = g[t.key];
|
|
1651
1653
|
return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
|
|
1652
1654
|
"button",
|
|
@@ -1656,32 +1658,32 @@ const ra = ({
|
|
|
1656
1658
|
className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
|
|
1657
1659
|
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
1658
1660
|
}
|
|
1659
|
-
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: we(
|
|
1661
|
+
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: we(T) }) : t.type === "group" ? he(g, t) : t.type === "chip" ? /* @__PURE__ */ e(G, { children: ue(K, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: Oe(K, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(K, t.alt, t.className, t.fallback_icon) }) }) : t.type === "audio" ? /* @__PURE__ */ e(G, { children: ce(K, t.className) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: K || "N/A" });
|
|
1660
1662
|
}, pe = (t, g) => {
|
|
1661
1663
|
if (t.onClickDetails)
|
|
1662
1664
|
return L == null ? void 0 : L("view", g);
|
|
1663
1665
|
if (typeof t.handleClick == "function")
|
|
1664
1666
|
return t.handleClick(g);
|
|
1665
1667
|
}, ge = (t) => t.onClickDetails || typeof t.handleClick == "function";
|
|
1666
|
-
return
|
|
1668
|
+
return z(() => {
|
|
1667
1669
|
const t = () => {
|
|
1668
1670
|
u && x(null);
|
|
1669
1671
|
};
|
|
1670
1672
|
return window.addEventListener("scroll", t, !0), () => {
|
|
1671
1673
|
window.removeEventListener("scroll", t, !0);
|
|
1672
1674
|
};
|
|
1673
|
-
}, [u]),
|
|
1675
|
+
}, [u]), z(() => {
|
|
1674
1676
|
const t = (g) => {
|
|
1675
1677
|
ne.current && !ne.current.contains(g.target) && x(null);
|
|
1676
1678
|
};
|
|
1677
1679
|
return document.addEventListener("click", t), () => document.removeEventListener("click", t);
|
|
1678
|
-
}, []),
|
|
1679
|
-
r != null && r.rows_per_page && (r != null && r.useServerSidePagination) &&
|
|
1680
|
+
}, []), z(() => {
|
|
1681
|
+
r != null && r.rows_per_page && (r != null && r.useServerSidePagination) && v((r == null ? void 0 : r.rows_per_page) || 50), r.current_page && U(r.current_page);
|
|
1680
1682
|
}, [
|
|
1681
1683
|
r.rows_per_page,
|
|
1682
1684
|
r == null ? void 0 : r.useServerSidePagination,
|
|
1683
1685
|
r.current_page
|
|
1684
|
-
]),
|
|
1686
|
+
]), z(() => {
|
|
1685
1687
|
Z(
|
|
1686
1688
|
r != null && r.useServerSidePagination ? r.total_records : D.length
|
|
1687
1689
|
), D.length <= A * (F - 1) && !(r != null && r.useServerSidePagination) && U((t) => t - 1 || 1);
|
|
@@ -1689,7 +1691,7 @@ const ra = ({
|
|
|
1689
1691
|
D.length,
|
|
1690
1692
|
r.total_records,
|
|
1691
1693
|
r == null ? void 0 : r.useServerSidePagination
|
|
1692
|
-
]), i ? /* @__PURE__ */ e(oa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c(
|
|
1694
|
+
]), i ? /* @__PURE__ */ e(oa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c(G, { children: [
|
|
1693
1695
|
/* @__PURE__ */ c("div", { className: "flex justify-end items-center mb-4 gap-2", children: [
|
|
1694
1696
|
s.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ c("div", { className: "relative min-w-[300px]", children: [
|
|
1695
1697
|
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
@@ -1704,7 +1706,7 @@ const ra = ({
|
|
|
1704
1706
|
}
|
|
1705
1707
|
)
|
|
1706
1708
|
] }) }),
|
|
1707
|
-
d && l.enabled && /* @__PURE__ */ c(Q, { onClick: () =>
|
|
1709
|
+
d && l.enabled && /* @__PURE__ */ c(Q, { onClick: () => j(!0), variant: "contained", children: [
|
|
1708
1710
|
/* @__PURE__ */ e(Ke, { className: "w-4 h-4 mr-2" }),
|
|
1709
1711
|
"Filters"
|
|
1710
1712
|
] })
|
|
@@ -1730,15 +1732,15 @@ const ra = ({
|
|
|
1730
1732
|
"tr",
|
|
1731
1733
|
{
|
|
1732
1734
|
className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
|
|
1733
|
-
children: o.map((
|
|
1735
|
+
children: o.map((T) => /* @__PURE__ */ e(
|
|
1734
1736
|
"td",
|
|
1735
1737
|
{
|
|
1736
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${
|
|
1737
|
-
title: String(t[
|
|
1738
|
-
onClick: () => pe(
|
|
1739
|
-
children:
|
|
1738
|
+
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${T.type == "audio" ? "" : "max-w-[300px]"} truncate ${ge(T) ? "cursor-pointer" : ""}`,
|
|
1739
|
+
title: String(t[T.key] ?? ""),
|
|
1740
|
+
onClick: () => pe(T, t),
|
|
1741
|
+
children: T.render ? T.render(t, g) : be(T, t, g)
|
|
1740
1742
|
},
|
|
1741
|
-
|
|
1743
|
+
T.key
|
|
1742
1744
|
))
|
|
1743
1745
|
},
|
|
1744
1746
|
t.id || t._id || g
|
|
@@ -1750,9 +1752,9 @@ const ra = ({
|
|
|
1750
1752
|
(F - 1) * A + 1,
|
|
1751
1753
|
" to",
|
|
1752
1754
|
" ",
|
|
1753
|
-
Math.min(F * A,
|
|
1755
|
+
Math.min(F * A, H),
|
|
1754
1756
|
" of ",
|
|
1755
|
-
|
|
1757
|
+
H,
|
|
1756
1758
|
" ",
|
|
1757
1759
|
"results"
|
|
1758
1760
|
] }),
|
|
@@ -1765,8 +1767,8 @@ const ra = ({
|
|
|
1765
1767
|
value: A,
|
|
1766
1768
|
onChange: (t) => {
|
|
1767
1769
|
const g = Number(t.target.value);
|
|
1768
|
-
|
|
1769
|
-
...
|
|
1770
|
+
v(g), U(1), r.useServerSidePagination && b((T) => ({
|
|
1771
|
+
...T,
|
|
1770
1772
|
current_page: 1,
|
|
1771
1773
|
rows_per_page: g
|
|
1772
1774
|
}));
|
|
@@ -1828,20 +1830,20 @@ const ra = ({
|
|
|
1828
1830
|
ref: ne,
|
|
1829
1831
|
style: {
|
|
1830
1832
|
position: "fixed",
|
|
1831
|
-
top: `${
|
|
1832
|
-
left: `${
|
|
1833
|
+
top: `${$.top}px`,
|
|
1834
|
+
left: `${$.left}px`,
|
|
1833
1835
|
zIndex: 9999
|
|
1834
1836
|
},
|
|
1835
1837
|
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1836
|
-
children:
|
|
1838
|
+
children: w.map((t, g) => /* @__PURE__ */ c(
|
|
1837
1839
|
"button",
|
|
1838
1840
|
{
|
|
1839
|
-
onClick: (
|
|
1841
|
+
onClick: (T) => xe(
|
|
1840
1842
|
t,
|
|
1841
1843
|
n.find(
|
|
1842
1844
|
(K) => K.id === u || K._id == u
|
|
1843
1845
|
),
|
|
1844
|
-
|
|
1846
|
+
T
|
|
1845
1847
|
),
|
|
1846
1848
|
className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${t.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
|
|
1847
1849
|
children: [
|
|
@@ -1859,17 +1861,17 @@ const ra = ({
|
|
|
1859
1861
|
na,
|
|
1860
1862
|
{
|
|
1861
1863
|
isOpen: M,
|
|
1862
|
-
onClose: () =>
|
|
1864
|
+
onClose: () => j(!1),
|
|
1863
1865
|
config: d,
|
|
1864
1866
|
onApply: y
|
|
1865
1867
|
}
|
|
1866
1868
|
),
|
|
1867
|
-
|
|
1869
|
+
N && /* @__PURE__ */ e(
|
|
1868
1870
|
Ge,
|
|
1869
1871
|
{
|
|
1870
|
-
src:
|
|
1871
|
-
alt:
|
|
1872
|
-
isOpen:
|
|
1872
|
+
src: E.src,
|
|
1873
|
+
alt: E.alt,
|
|
1874
|
+
isOpen: N,
|
|
1873
1875
|
setIsOpen: O
|
|
1874
1876
|
}
|
|
1875
1877
|
)
|
|
@@ -1895,7 +1897,7 @@ const ra = ({
|
|
|
1895
1897
|
selectedItem: x = null
|
|
1896
1898
|
}) => {
|
|
1897
1899
|
if (!h) return null;
|
|
1898
|
-
const
|
|
1900
|
+
const w = {
|
|
1899
1901
|
sm: "max-w-md",
|
|
1900
1902
|
md: "max-w-lg",
|
|
1901
1903
|
lg: "max-w-2xl",
|
|
@@ -1913,7 +1915,7 @@ const ra = ({
|
|
|
1913
1915
|
/* @__PURE__ */ c(
|
|
1914
1916
|
"div",
|
|
1915
1917
|
{
|
|
1916
|
-
className: `relative bg-white rounded-lg shadow-xl w-full ${
|
|
1918
|
+
className: `relative bg-white rounded-lg shadow-xl w-full ${w[l] || w.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
1917
1919
|
children: [
|
|
1918
1920
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
1919
1921
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
@@ -1933,13 +1935,13 @@ const ra = ({
|
|
|
1933
1935
|
r.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: r.map((S) => /* @__PURE__ */ e(
|
|
1934
1936
|
Q,
|
|
1935
1937
|
{
|
|
1936
|
-
onClick: (
|
|
1937
|
-
S.type == "submit" ? d(
|
|
1938
|
+
onClick: ($) => {
|
|
1939
|
+
S.type == "submit" ? d($) : u(
|
|
1938
1940
|
() => {
|
|
1939
|
-
var
|
|
1940
|
-
return (
|
|
1941
|
+
var I;
|
|
1942
|
+
return (I = S == null ? void 0 : S.onClick) == null ? void 0 : I.call(S, $, x);
|
|
1941
1943
|
},
|
|
1942
|
-
(
|
|
1944
|
+
(I) => n == null ? void 0 : n(I)
|
|
1943
1945
|
);
|
|
1944
1946
|
},
|
|
1945
1947
|
disabled: m || S.disabled,
|
|
@@ -1960,7 +1962,7 @@ const ra = ({
|
|
|
1960
1962
|
] });
|
|
1961
1963
|
}, Pe = ({ config: h, onSubmit: n, initialData: o = {}, type: i = "add" }) => {
|
|
1962
1964
|
const { formClass: s = "grid grid-cols-12 gap-4", formFields: l = [] } = h || {}, [r, C] = R(o);
|
|
1963
|
-
|
|
1965
|
+
z(() => {
|
|
1964
1966
|
C(o);
|
|
1965
1967
|
}, []);
|
|
1966
1968
|
const L = (y, d) => {
|
|
@@ -1981,7 +1983,7 @@ const ra = ({
|
|
|
1981
1983
|
onSubmit: b,
|
|
1982
1984
|
className: s,
|
|
1983
1985
|
noValidate: !1,
|
|
1984
|
-
children: l.map((y) => /* @__PURE__ */ e(
|
|
1986
|
+
children: l.map((y) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
1985
1987
|
Ee,
|
|
1986
1988
|
{
|
|
1987
1989
|
field: y,
|
|
@@ -1997,11 +1999,11 @@ function sa({ data: h, config: n }) {
|
|
|
1997
1999
|
const { fields: o, containerClass: i } = n, [s, l] = R(null), [r, C] = R(!1), L = (d) => {
|
|
1998
2000
|
l(d), C(!0);
|
|
1999
2001
|
}, b = ({ col: d }) => {
|
|
2000
|
-
var
|
|
2001
|
-
let p = d == null ? void 0 : d.icon, m = d.label, u = h[d.key], x = d.type,
|
|
2002
|
-
if (x === "chip" && ((
|
|
2003
|
-
let
|
|
2004
|
-
|
|
2002
|
+
var $;
|
|
2003
|
+
let p = d == null ? void 0 : d.icon, m = d.label, u = h[d.key], x = d.type, w = d.variant || "outline", S = d.defaultColor;
|
|
2004
|
+
if (x === "chip" && (($ = d.chipOptions) == null ? void 0 : $.length) > 0) {
|
|
2005
|
+
let I = d == null ? void 0 : d.chipOptions.find((M) => M.value == u);
|
|
2006
|
+
I && (u = I.label, S = I.color);
|
|
2005
2007
|
}
|
|
2006
2008
|
return /* @__PURE__ */ c(
|
|
2007
2009
|
"div",
|
|
@@ -2016,7 +2018,7 @@ function sa({ data: h, config: n }) {
|
|
|
2016
2018
|
$e,
|
|
2017
2019
|
{
|
|
2018
2020
|
label: u,
|
|
2019
|
-
variant:
|
|
2021
|
+
variant: w,
|
|
2020
2022
|
color: S,
|
|
2021
2023
|
className: "mt-1"
|
|
2022
2024
|
}
|
|
@@ -2035,7 +2037,7 @@ function sa({ data: h, config: n }) {
|
|
|
2035
2037
|
{
|
|
2036
2038
|
controls: !0,
|
|
2037
2039
|
src: u,
|
|
2038
|
-
onClick: (
|
|
2040
|
+
onClick: (I) => I.stopPropagation(),
|
|
2039
2041
|
className: "shadow-md rounded-full"
|
|
2040
2042
|
},
|
|
2041
2043
|
u
|
|
@@ -2065,7 +2067,7 @@ function sa({ data: h, config: n }) {
|
|
|
2065
2067
|
onClick: () => L({ src: u, alt: p }),
|
|
2066
2068
|
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2067
2069
|
}
|
|
2068
|
-
) : x || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(
|
|
2070
|
+
) : x || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Ie, { className: "w-8 h-8 text-gray-400" }) }),
|
|
2069
2071
|
/* @__PURE__ */ c("div", { children: [
|
|
2070
2072
|
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: p }),
|
|
2071
2073
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: m })
|
|
@@ -2074,7 +2076,7 @@ function sa({ data: h, config: n }) {
|
|
|
2074
2076
|
}
|
|
2075
2077
|
);
|
|
2076
2078
|
};
|
|
2077
|
-
return /* @__PURE__ */ c(
|
|
2079
|
+
return /* @__PURE__ */ c(G, { children: [
|
|
2078
2080
|
r && /* @__PURE__ */ e(
|
|
2079
2081
|
Ge,
|
|
2080
2082
|
{
|
|
@@ -2090,7 +2092,7 @@ function sa({ data: h, config: n }) {
|
|
|
2090
2092
|
] });
|
|
2091
2093
|
}
|
|
2092
2094
|
const je = ({ config: h }) => {
|
|
2093
|
-
var de, ie, ce, he, ue, be, pe, ge, t, g,
|
|
2095
|
+
var de, ie, ce, he, ue, be, pe, ge, t, g, T, K, _, J, V, ee;
|
|
2094
2096
|
const {
|
|
2095
2097
|
title: n,
|
|
2096
2098
|
fetchData: o = async () => {
|
|
@@ -2099,16 +2101,16 @@ const je = ({ config: h }) => {
|
|
|
2099
2101
|
tableConfig: s = {},
|
|
2100
2102
|
modalConfig: l = {},
|
|
2101
2103
|
filterConfig: r
|
|
2102
|
-
} = h, [C, L] = R(!0), [b, y] = R(!1), [d, p] = R([]), [m, u] = R(null), [x,
|
|
2104
|
+
} = h, [C, L] = R(!0), [b, y] = R(!1), [d, p] = R([]), [m, u] = R(null), [x, w] = R({
|
|
2103
2105
|
search: "",
|
|
2104
2106
|
rows_per_page: 50,
|
|
2105
2107
|
current_page: 1
|
|
2106
|
-
}), [S,
|
|
2107
|
-
|
|
2108
|
-
}, Z = async (
|
|
2108
|
+
}), [S, $] = R({}), [I, M] = R(!1), [j, E] = R(!1), [f, N] = R(!1), [O, D] = R(!1), [F, U] = R(!1), [A, v] = R(null), H = (k, P) => {
|
|
2109
|
+
k === "edit" ? (v(P), N(!0)) : k === "view" ? (v(P), U(!0)) : k === "delete" && (v(P), D(!0));
|
|
2110
|
+
}, Z = async (k, P, B = "", ae = "") => {
|
|
2109
2111
|
y(!0);
|
|
2110
2112
|
try {
|
|
2111
|
-
const Y = await (
|
|
2113
|
+
const Y = await (k == null ? void 0 : k());
|
|
2112
2114
|
(B || Y.message) && ke(B || Y.message, {
|
|
2113
2115
|
variant: "success"
|
|
2114
2116
|
}), P == null || P(Y);
|
|
@@ -2117,71 +2119,71 @@ const je = ({ config: h }) => {
|
|
|
2117
2119
|
} finally {
|
|
2118
2120
|
y(!1);
|
|
2119
2121
|
}
|
|
2120
|
-
}, W = (
|
|
2121
|
-
let P =
|
|
2122
|
+
}, W = (k) => {
|
|
2123
|
+
let P = k.newObject;
|
|
2122
2124
|
i ? (p((B) => [P, ...B]), u((B) => ({
|
|
2123
2125
|
...B,
|
|
2124
2126
|
current_page: 1
|
|
2125
|
-
}))) : (
|
|
2127
|
+
}))) : (w((B) => ({
|
|
2126
2128
|
...B,
|
|
2127
2129
|
current_page: 1
|
|
2128
|
-
})), x.current_page == 1 && te()),
|
|
2129
|
-
}, re = (
|
|
2130
|
-
let P =
|
|
2130
|
+
})), x.current_page == 1 && te()), E(!1);
|
|
2131
|
+
}, re = (k) => {
|
|
2132
|
+
let P = k.newObject, B = k.targetObject;
|
|
2131
2133
|
i ? p(
|
|
2132
2134
|
(ae) => ae.map(
|
|
2133
2135
|
(Y) => Y.id === B.id ? { ...Y, ...P } : Y
|
|
2134
2136
|
)
|
|
2135
|
-
) : te(),
|
|
2136
|
-
}, ne = (
|
|
2137
|
-
if (!
|
|
2138
|
-
D(!1),
|
|
2137
|
+
) : te(), N(!1);
|
|
2138
|
+
}, ne = (k) => {
|
|
2139
|
+
if (!k) {
|
|
2140
|
+
D(!1), v(null);
|
|
2139
2141
|
return;
|
|
2140
2142
|
}
|
|
2141
2143
|
i ? p(
|
|
2142
|
-
(P) => P.filter((B) => B.id !==
|
|
2143
|
-
) : d.length == 1 && x.current_page > 1 ?
|
|
2144
|
+
(P) => P.filter((B) => B.id !== k.targetObject.id)
|
|
2145
|
+
) : d.length == 1 && x.current_page > 1 ? w((P) => ({
|
|
2144
2146
|
...P,
|
|
2145
2147
|
current_page: P.current_page - 1
|
|
2146
|
-
})) : te(), D(!1),
|
|
2147
|
-
}, se = (
|
|
2148
|
+
})) : te(), D(!1), v(null);
|
|
2149
|
+
}, se = (k) => Z(
|
|
2148
2150
|
() => {
|
|
2149
2151
|
var P, B;
|
|
2150
|
-
return (B = (P = l == null ? void 0 : l.addModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P,
|
|
2152
|
+
return (B = (P = l == null ? void 0 : l.addModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P, k);
|
|
2151
2153
|
},
|
|
2152
2154
|
W
|
|
2153
|
-
), oe = (
|
|
2155
|
+
), oe = (k) => Z(
|
|
2154
2156
|
() => {
|
|
2155
2157
|
var P, B;
|
|
2156
|
-
return (B = (P = l == null ? void 0 : l.editModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P,
|
|
2158
|
+
return (B = (P = l == null ? void 0 : l.editModal) == null ? void 0 : P.handleSubmit) == null ? void 0 : B.call(P, k, A);
|
|
2157
2159
|
},
|
|
2158
2160
|
re
|
|
2159
2161
|
), te = async () => {
|
|
2160
|
-
L(!0), o == null || o({ ...x, ...S }).then((
|
|
2161
|
-
p(
|
|
2162
|
-
}).catch((
|
|
2163
|
-
ke(
|
|
2162
|
+
L(!0), o == null || o({ ...x, ...S }).then((k) => {
|
|
2163
|
+
p(k.data), u(k.pagination);
|
|
2164
|
+
}).catch((k) => {
|
|
2165
|
+
ke(k.message, { variant: "error" });
|
|
2164
2166
|
}).finally(() => {
|
|
2165
2167
|
L(!1);
|
|
2166
2168
|
});
|
|
2167
|
-
}, xe = (
|
|
2169
|
+
}, xe = (k) => {
|
|
2168
2170
|
var P;
|
|
2169
|
-
|
|
2170
|
-
...
|
|
2171
|
+
$((B) => ({
|
|
2172
|
+
...k
|
|
2171
2173
|
})), (P = s == null ? void 0 : s.filter) != null && P.useServerSideFilters && M((B) => !B);
|
|
2172
|
-
}, ve = (
|
|
2174
|
+
}, ve = (k, P) => k.filter(
|
|
2173
2175
|
(B) => Object.entries(P).every(([ae, Y]) => B[ae] === Y)
|
|
2174
2176
|
), we = Me(() => {
|
|
2175
|
-
var
|
|
2176
|
-
return (
|
|
2177
|
+
var k;
|
|
2178
|
+
return (k = s == null ? void 0 : s.filter) != null && k.useServerSideFilters ? d : ve(d, S);
|
|
2177
2179
|
}, [d, S]);
|
|
2178
|
-
return
|
|
2180
|
+
return z(() => {
|
|
2179
2181
|
te();
|
|
2180
2182
|
}, [
|
|
2181
2183
|
x.search,
|
|
2182
2184
|
x.rows_per_page,
|
|
2183
2185
|
x.current_page,
|
|
2184
|
-
|
|
2186
|
+
I
|
|
2185
2187
|
]), /* @__PURE__ */ e(
|
|
2186
2188
|
Ze,
|
|
2187
2189
|
{
|
|
@@ -2191,12 +2193,12 @@ const je = ({ config: h }) => {
|
|
|
2191
2193
|
horizontal: "right"
|
|
2192
2194
|
},
|
|
2193
2195
|
autoHideDuration: 3e3,
|
|
2194
|
-
action: (
|
|
2196
|
+
action: (k) => /* @__PURE__ */ e(
|
|
2195
2197
|
"button",
|
|
2196
2198
|
{
|
|
2197
2199
|
onClick: () => {
|
|
2198
2200
|
window.dispatchEvent(
|
|
2199
|
-
new CustomEvent("closeSnackbar", { detail:
|
|
2201
|
+
new CustomEvent("closeSnackbar", { detail: k })
|
|
2200
2202
|
);
|
|
2201
2203
|
},
|
|
2202
2204
|
className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
|
|
@@ -2212,7 +2214,7 @@ const je = ({ config: h }) => {
|
|
|
2212
2214
|
/* @__PURE__ */ e("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ c(
|
|
2213
2215
|
Q,
|
|
2214
2216
|
{
|
|
2215
|
-
onClick: () =>
|
|
2217
|
+
onClick: () => E(!0),
|
|
2216
2218
|
variant: "contained",
|
|
2217
2219
|
color: "primary",
|
|
2218
2220
|
children: [
|
|
@@ -2232,8 +2234,8 @@ const je = ({ config: h }) => {
|
|
|
2232
2234
|
...m
|
|
2233
2235
|
},
|
|
2234
2236
|
data: we,
|
|
2235
|
-
setServerSidePaginationData:
|
|
2236
|
-
onMenuAction:
|
|
2237
|
+
setServerSidePaginationData: w,
|
|
2238
|
+
onMenuAction: H,
|
|
2237
2239
|
filterConfig: r,
|
|
2238
2240
|
onFilterApply: xe,
|
|
2239
2241
|
loading: C
|
|
@@ -2243,16 +2245,16 @@ const je = ({ config: h }) => {
|
|
|
2243
2245
|
/* @__PURE__ */ e(
|
|
2244
2246
|
fe,
|
|
2245
2247
|
{
|
|
2246
|
-
isOpen:
|
|
2248
|
+
isOpen: j,
|
|
2247
2249
|
onClose: () => {
|
|
2248
|
-
b ||
|
|
2250
|
+
b || E(!1);
|
|
2249
2251
|
},
|
|
2250
2252
|
icon: (de = l.addModal) == null ? void 0 : de.icon,
|
|
2251
2253
|
title: ((ie = l.addModal) == null ? void 0 : ie.title) || "Add New",
|
|
2252
2254
|
size: ((ce = l.addModal) == null ? void 0 : ce.size) || "md",
|
|
2253
2255
|
onFormSubmit: () => {
|
|
2254
|
-
var
|
|
2255
|
-
return (
|
|
2256
|
+
var k;
|
|
2257
|
+
return (k = document.querySelector("#addForm")) == null ? void 0 : k.requestSubmit();
|
|
2256
2258
|
},
|
|
2257
2259
|
loadingBtn: b,
|
|
2258
2260
|
actionButtons: l.addModal.actionButtons,
|
|
@@ -2273,14 +2275,14 @@ const je = ({ config: h }) => {
|
|
|
2273
2275
|
{
|
|
2274
2276
|
isOpen: f,
|
|
2275
2277
|
onClose: () => {
|
|
2276
|
-
b ||
|
|
2278
|
+
b || N(!1);
|
|
2277
2279
|
},
|
|
2278
2280
|
icon: (he = l.editModal) == null ? void 0 : he.icon,
|
|
2279
2281
|
title: ((ue = l.editModal) == null ? void 0 : ue.title) || "Edit",
|
|
2280
2282
|
size: ((be = l.editModal) == null ? void 0 : be.size) || "md",
|
|
2281
2283
|
onFormSubmit: () => {
|
|
2282
|
-
var
|
|
2283
|
-
return (
|
|
2284
|
+
var k;
|
|
2285
|
+
return (k = document.querySelector("#editForm")) == null ? void 0 : k.requestSubmit();
|
|
2284
2286
|
},
|
|
2285
2287
|
actionButtons: l.editModal.actionButtons,
|
|
2286
2288
|
loadingBtn: b,
|
|
@@ -2300,8 +2302,8 @@ const je = ({ config: h }) => {
|
|
|
2300
2302
|
fe,
|
|
2301
2303
|
{
|
|
2302
2304
|
isOpen: O,
|
|
2303
|
-
onClose: (
|
|
2304
|
-
ne(
|
|
2305
|
+
onClose: (k) => {
|
|
2306
|
+
ne(k);
|
|
2305
2307
|
},
|
|
2306
2308
|
icon: ((pe = l.deleteModal) == null ? void 0 : pe.icon) || /* @__PURE__ */ e(le, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2307
2309
|
title: ((ge = l.deleteModal) == null ? void 0 : ge.title) || "Confirm Delete",
|
|
@@ -2312,7 +2314,7 @@ const je = ({ config: h }) => {
|
|
|
2312
2314
|
selectedItem: A,
|
|
2313
2315
|
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ c("div", { children: [
|
|
2314
2316
|
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((g = l.deleteModal) == null ? void 0 : g.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2315
|
-
((
|
|
2317
|
+
((T = l.deleteModal) == null ? void 0 : T.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: A[(K = l.deleteModal) == null ? void 0 : K.referenceKey] })
|
|
2316
2318
|
] }) })
|
|
2317
2319
|
}
|
|
2318
2320
|
),
|
|
@@ -2321,7 +2323,7 @@ const je = ({ config: h }) => {
|
|
|
2321
2323
|
{
|
|
2322
2324
|
isOpen: F,
|
|
2323
2325
|
onClose: () => {
|
|
2324
|
-
U(!1),
|
|
2326
|
+
U(!1), v(null);
|
|
2325
2327
|
},
|
|
2326
2328
|
icon: (_ = l.viewModal) == null ? void 0 : _.icon,
|
|
2327
2329
|
title: ((J = l.viewModal) == null ? void 0 : J.title) || "View Details",
|
|
@@ -2496,9 +2498,9 @@ const ua = () => {
|
|
|
2496
2498
|
h.textContent = n, document.head.appendChild(h);
|
|
2497
2499
|
};
|
|
2498
2500
|
function wa(h) {
|
|
2499
|
-
return
|
|
2501
|
+
return z(() => {
|
|
2500
2502
|
ua();
|
|
2501
|
-
}, []), /* @__PURE__ */ e(
|
|
2503
|
+
}, []), /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(je, { config: h.config }) });
|
|
2502
2504
|
}
|
|
2503
2505
|
export {
|
|
2504
2506
|
wa as default
|