react-admin-crud-manager 1.0.22 → 1.0.23
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 +7 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +316 -316
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -2,15 +2,15 @@ import { jsx as e, Fragment as j, jsxs as h } from "react/jsx-runtime";
|
|
|
2
2
|
import Le, { useState as R, useRef as ee, useEffect as K, useMemo as Re } from "react";
|
|
3
3
|
import { ChevronDown as Ie, Search as Oe, Check as Ye, X as Ne, Plus as Ve, Filter as We, ChevronLeft as qe, ChevronRight as Ze, EllipsisVertical as Je, User as Be, Music as Qe } from "lucide-react";
|
|
4
4
|
import { createPortal as Xe } from "react-dom";
|
|
5
|
-
import { Icon as
|
|
5
|
+
import { Icon as re } from "@iconify/react";
|
|
6
6
|
import { Editor as ea } from "@tinymce/tinymce-react";
|
|
7
7
|
import { SnackbarProvider as aa, enqueueSnackbar as Se } from "notistack";
|
|
8
|
-
import
|
|
8
|
+
import r from "prop-types";
|
|
9
9
|
const Ue = (b, o = "DD MMM YYYY") => {
|
|
10
10
|
if (!b) return "N/A";
|
|
11
11
|
const s = new Date(b);
|
|
12
12
|
if (isNaN(s)) return "Invalid Date";
|
|
13
|
-
const i = (
|
|
13
|
+
const i = (t) => String(t).padStart(2, "0"), d = {
|
|
14
14
|
YYYY: s.getFullYear(),
|
|
15
15
|
YY: String(s.getFullYear()).slice(-2),
|
|
16
16
|
MMMM: s.toLocaleString("en-US", { month: "long" }),
|
|
@@ -29,16 +29,16 @@ const Ue = (b, o = "DD MMM YYYY") => {
|
|
|
29
29
|
};
|
|
30
30
|
return o.replace(
|
|
31
31
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
|
-
(
|
|
32
|
+
(t) => d[t]
|
|
33
33
|
);
|
|
34
|
-
},
|
|
34
|
+
}, ra = (b, o, s = []) => {
|
|
35
35
|
if (!(o != null && o.trim())) return b;
|
|
36
|
-
const i = o.toLowerCase(), d = (
|
|
37
|
-
return b.filter((
|
|
36
|
+
const i = o.toLowerCase(), d = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(d) : [String(t)];
|
|
37
|
+
return b.filter((t) => {
|
|
38
38
|
let g = [];
|
|
39
39
|
return s.length > 0 ? s.forEach((M) => {
|
|
40
|
-
|
|
41
|
-
}) : g = d(
|
|
40
|
+
t[M] !== void 0 && g.push(...d(t[M]));
|
|
41
|
+
}) : g = d(t), g.some(
|
|
42
42
|
(M) => M.toLowerCase().includes(i)
|
|
43
43
|
);
|
|
44
44
|
});
|
|
@@ -49,7 +49,7 @@ const Ue = (b, o = "DD MMM YYYY") => {
|
|
|
49
49
|
color: s = "default",
|
|
50
50
|
size: i = "default",
|
|
51
51
|
fullWidth: d = !1,
|
|
52
|
-
children:
|
|
52
|
+
children: t,
|
|
53
53
|
...g
|
|
54
54
|
}, M) => {
|
|
55
55
|
var c;
|
|
@@ -94,7 +94,7 @@ const Ue = (b, o = "DD MMM YYYY") => {
|
|
|
94
94
|
type: g.type || "button",
|
|
95
95
|
className: v,
|
|
96
96
|
...g,
|
|
97
|
-
children:
|
|
97
|
+
children: t
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
}
|
|
@@ -106,13 +106,13 @@ function q({ label: b, required: o = !1 }) {
|
|
|
106
106
|
o && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
|
|
107
107
|
] }) });
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const ta = ({
|
|
110
110
|
options: b = [],
|
|
111
111
|
value: o = "",
|
|
112
112
|
defaultValue: s = "",
|
|
113
113
|
onChange: i,
|
|
114
114
|
placeholder: d = "Select option",
|
|
115
|
-
className:
|
|
115
|
+
className: t = "",
|
|
116
116
|
disabled: g = !1,
|
|
117
117
|
search: M = !1,
|
|
118
118
|
label: S = "",
|
|
@@ -126,7 +126,7 @@ const ra = ({
|
|
|
126
126
|
dependencyKey: w = ""
|
|
127
127
|
}) => {
|
|
128
128
|
var V;
|
|
129
|
-
const [y, k] = R(!1), [I,
|
|
129
|
+
const [y, k] = R(!1), [I, A] = R(""), [C, O] = R(!0), F = ee(null), T = ee(null), [L, B] = R([]);
|
|
130
130
|
let E = o || o === !1 ? o : s;
|
|
131
131
|
const Y = (x) => x == null || x === "" ? "" : String(typeof x == "boolean" ? x : x ?? "");
|
|
132
132
|
K(
|
|
@@ -149,7 +149,7 @@ const ra = ({
|
|
|
149
149
|
};
|
|
150
150
|
K(() => {
|
|
151
151
|
const x = (H) => {
|
|
152
|
-
F.current && !F.current.contains(H.target) && (k(!1),
|
|
152
|
+
F.current && !F.current.contains(H.target) && (k(!1), A(""));
|
|
153
153
|
};
|
|
154
154
|
return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
|
|
155
155
|
}, []), K(() => {
|
|
@@ -158,9 +158,9 @@ const ra = ({
|
|
|
158
158
|
O(J < 200);
|
|
159
159
|
}
|
|
160
160
|
}, [y]), K(() => {
|
|
161
|
-
y &&
|
|
161
|
+
y && T.current && T.current.focus();
|
|
162
162
|
}, [y]);
|
|
163
|
-
const
|
|
163
|
+
const D = (x) => {
|
|
164
164
|
let H = x;
|
|
165
165
|
if (x === "true" ? H = !0 : x === "false" && (H = !1), m) {
|
|
166
166
|
const J = $.includes(Y(x));
|
|
@@ -170,7 +170,7 @@ const ra = ({
|
|
|
170
170
|
) : Q = [...o || [], H], i(Q);
|
|
171
171
|
} else
|
|
172
172
|
i(H), k(!1);
|
|
173
|
-
|
|
173
|
+
A("");
|
|
174
174
|
}, U = m ? L.filter((x) => z(x.value)).map((x) => x.label).join(", ") : (V = L.find((x) => z(x.value))) == null ? void 0 : V.label;
|
|
175
175
|
return K(() => {
|
|
176
176
|
(E || E === !1) && setTimeout(() => {
|
|
@@ -178,7 +178,7 @@ const ra = ({
|
|
|
178
178
|
}, 100);
|
|
179
179
|
}, []), /* @__PURE__ */ h("div", { className: u || "col-span-12", children: [
|
|
180
180
|
/* @__PURE__ */ e(q, { label: S, required: p }),
|
|
181
|
-
/* @__PURE__ */ h("div", { className: `relative ${
|
|
181
|
+
/* @__PURE__ */ h("div", { className: `relative ${t}`, ref: F, children: [
|
|
182
182
|
/* @__PURE__ */ e(
|
|
183
183
|
"select",
|
|
184
184
|
{
|
|
@@ -221,10 +221,10 @@ const ra = ({
|
|
|
221
221
|
/* @__PURE__ */ e(
|
|
222
222
|
"input",
|
|
223
223
|
{
|
|
224
|
-
ref:
|
|
224
|
+
ref: T,
|
|
225
225
|
type: "text",
|
|
226
226
|
value: I,
|
|
227
|
-
onChange: (x) =>
|
|
227
|
+
onChange: (x) => A(x.target.value),
|
|
228
228
|
placeholder: "Search...",
|
|
229
229
|
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"
|
|
230
230
|
}
|
|
@@ -241,7 +241,7 @@ const ra = ({
|
|
|
241
241
|
"button",
|
|
242
242
|
{
|
|
243
243
|
type: "button",
|
|
244
|
-
onClick: () =>
|
|
244
|
+
onClick: () => D(String(x.value)),
|
|
245
245
|
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
|
|
246
246
|
${z(x.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
247
247
|
children: [
|
|
@@ -264,7 +264,7 @@ const ra = ({
|
|
|
264
264
|
text: s,
|
|
265
265
|
options: i = [],
|
|
266
266
|
label: d,
|
|
267
|
-
required:
|
|
267
|
+
required: t,
|
|
268
268
|
name: g = "",
|
|
269
269
|
disabled: M = !1,
|
|
270
270
|
parentClass: S = ""
|
|
@@ -274,7 +274,7 @@ const ra = ({
|
|
|
274
274
|
{ label: "Inactive", value: !1 }
|
|
275
275
|
];
|
|
276
276
|
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
|
|
277
|
-
/* @__PURE__ */ e(q, { label: d, required:
|
|
277
|
+
/* @__PURE__ */ e(q, { label: d, required: t }),
|
|
278
278
|
/* @__PURE__ */ h("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: [
|
|
279
279
|
s && /* @__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: s }),
|
|
280
280
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: p.map((l, u) => /* @__PURE__ */ h(
|
|
@@ -287,7 +287,7 @@ const ra = ({
|
|
|
287
287
|
{
|
|
288
288
|
type: "radio",
|
|
289
289
|
name: "switch-field",
|
|
290
|
-
required:
|
|
290
|
+
required: t && u === 0,
|
|
291
291
|
value: l.value,
|
|
292
292
|
disabled: M,
|
|
293
293
|
checked: b === l.value,
|
|
@@ -560,7 +560,7 @@ function la({
|
|
|
560
560
|
name: s = "",
|
|
561
561
|
parentClass: i = "",
|
|
562
562
|
onChange: d,
|
|
563
|
-
disabled:
|
|
563
|
+
disabled: t = !1,
|
|
564
564
|
required: g = !1,
|
|
565
565
|
placeholder: M = "Phone number",
|
|
566
566
|
search: S = !1,
|
|
@@ -569,7 +569,7 @@ function la({
|
|
|
569
569
|
}) {
|
|
570
570
|
const u = (L) => we.find((B) => B.code == L), [m, v] = R(
|
|
571
571
|
u(l) || we[0]
|
|
572
|
-
), [c, w] = R(""), [y, k] = R(!1), [I,
|
|
572
|
+
), [c, w] = R(""), [y, k] = R(!1), [I, A] = R(""), C = ee();
|
|
573
573
|
K(() => {
|
|
574
574
|
if (typeof o == "string" && o.startsWith("+")) {
|
|
575
575
|
const L = we.filter((B) => o.startsWith("+" + B.phone)).sort((B, E) => E.phone.length - B.phone.length)[0];
|
|
@@ -584,7 +584,7 @@ function la({
|
|
|
584
584
|
const B = L.target.value.replace(/\D/g, "");
|
|
585
585
|
w(B), m && d && d("+" + m.phone + B);
|
|
586
586
|
}, F = (L) => {
|
|
587
|
-
v(L), d && d("+" + L.phone + c), k(!1),
|
|
587
|
+
v(L), d && d("+" + L.phone + c), k(!1), A("");
|
|
588
588
|
};
|
|
589
589
|
K(() => {
|
|
590
590
|
const L = (B) => {
|
|
@@ -592,7 +592,7 @@ function la({
|
|
|
592
592
|
};
|
|
593
593
|
return document.addEventListener("mousedown", L), () => document.removeEventListener("mousedown", L);
|
|
594
594
|
}, []);
|
|
595
|
-
const
|
|
595
|
+
const T = we.filter(
|
|
596
596
|
(L) => L.label.toLowerCase().includes(I.toLowerCase()) || L.phone.includes(I)
|
|
597
597
|
);
|
|
598
598
|
return p ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
|
|
@@ -603,13 +603,13 @@ function la({
|
|
|
603
603
|
{
|
|
604
604
|
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
605
605
|
${y ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
606
|
-
${
|
|
606
|
+
${t ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
607
607
|
children: [
|
|
608
608
|
/* @__PURE__ */ h(
|
|
609
609
|
"button",
|
|
610
610
|
{
|
|
611
611
|
type: "button",
|
|
612
|
-
disabled:
|
|
612
|
+
disabled: t,
|
|
613
613
|
onClick: () => k(!y),
|
|
614
614
|
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
615
615
|
children: [
|
|
@@ -636,7 +636,7 @@ function la({
|
|
|
636
636
|
value: c,
|
|
637
637
|
onChange: O,
|
|
638
638
|
required: g,
|
|
639
|
-
disabled:
|
|
639
|
+
disabled: t || !m,
|
|
640
640
|
placeholder: m ? M : "Select a country",
|
|
641
641
|
className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
|
|
642
642
|
}
|
|
@@ -668,13 +668,13 @@ function la({
|
|
|
668
668
|
{
|
|
669
669
|
type: "text",
|
|
670
670
|
value: I,
|
|
671
|
-
onChange: (L) =>
|
|
671
|
+
onChange: (L) => A(L.target.value),
|
|
672
672
|
placeholder: "Search country...",
|
|
673
673
|
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 "
|
|
674
674
|
}
|
|
675
675
|
)
|
|
676
676
|
] }) }),
|
|
677
|
-
|
|
677
|
+
T.map((L) => /* @__PURE__ */ h(
|
|
678
678
|
"button",
|
|
679
679
|
{
|
|
680
680
|
type: "button",
|
|
@@ -713,7 +713,7 @@ function la({
|
|
|
713
713
|
d(Y);
|
|
714
714
|
},
|
|
715
715
|
placeholder: M,
|
|
716
|
-
disabled:
|
|
716
|
+
disabled: t,
|
|
717
717
|
required: g,
|
|
718
718
|
className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
|
|
719
719
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
|
|
@@ -726,7 +726,7 @@ function la({
|
|
|
726
726
|
}
|
|
727
727
|
const je = Le.forwardRef(
|
|
728
728
|
({ className: b = "", label: o, required: s, ...i }, d) => {
|
|
729
|
-
const
|
|
729
|
+
const t = `
|
|
730
730
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
731
731
|
${b}
|
|
732
732
|
`.trim();
|
|
@@ -735,7 +735,7 @@ const je = Le.forwardRef(
|
|
|
735
735
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
736
736
|
"textarea",
|
|
737
737
|
{
|
|
738
|
-
className:
|
|
738
|
+
className: t,
|
|
739
739
|
ref: d,
|
|
740
740
|
required: s,
|
|
741
741
|
...i
|
|
@@ -751,7 +751,7 @@ const oa = ({
|
|
|
751
751
|
onChange: s,
|
|
752
752
|
required: i = !1,
|
|
753
753
|
accept: d = "image/*",
|
|
754
|
-
id:
|
|
754
|
+
id: t,
|
|
755
755
|
dragDrop: g = !1,
|
|
756
756
|
name: M = "",
|
|
757
757
|
parentClass: S = ""
|
|
@@ -763,8 +763,8 @@ const oa = ({
|
|
|
763
763
|
const c = (C) => {
|
|
764
764
|
if (!C || C.length === 0)
|
|
765
765
|
return;
|
|
766
|
-
const O = C[0], F = URL.createObjectURL(O),
|
|
767
|
-
p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview), l(
|
|
766
|
+
const O = C[0], F = URL.createObjectURL(O), T = { file: O, preview: F };
|
|
767
|
+
p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview), l(T), s == null || s(O);
|
|
768
768
|
}, w = (C) => {
|
|
769
769
|
C && C.stopPropagation(), p != null && p.preview && p.preview.startsWith("blob:") && URL.revokeObjectURL(p.preview), l(null), s == null || s(null), v.current && (v.current.value = "");
|
|
770
770
|
}, y = (C) => {
|
|
@@ -773,7 +773,7 @@ const oa = ({
|
|
|
773
773
|
g && (C.preventDefault(), m(!1));
|
|
774
774
|
}, I = (C) => {
|
|
775
775
|
g && (C.preventDefault(), m(!1), c(C.dataTransfer.files));
|
|
776
|
-
},
|
|
776
|
+
}, A = () => {
|
|
777
777
|
v.current.click();
|
|
778
778
|
};
|
|
779
779
|
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
|
|
@@ -790,7 +790,7 @@ const oa = ({
|
|
|
790
790
|
"input",
|
|
791
791
|
{
|
|
792
792
|
ref: v,
|
|
793
|
-
id:
|
|
793
|
+
id: t,
|
|
794
794
|
type: "file",
|
|
795
795
|
accept: d,
|
|
796
796
|
onChange: (C) => c(C.target.files),
|
|
@@ -821,14 +821,14 @@ const oa = ({
|
|
|
821
821
|
onClick: w,
|
|
822
822
|
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
|
|
823
823
|
"aria-label": "Remove image",
|
|
824
|
-
children: /* @__PURE__ */ e(
|
|
824
|
+
children: /* @__PURE__ */ e(re, { icon: "mdi:close", className: "w-3 h-3" })
|
|
825
825
|
}
|
|
826
826
|
)
|
|
827
827
|
] })
|
|
828
828
|
) : (
|
|
829
829
|
// Placeholder icon
|
|
830
830
|
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
831
|
-
|
|
831
|
+
re,
|
|
832
832
|
{
|
|
833
833
|
icon: "ri:image-add-fill",
|
|
834
834
|
className: "text-gray-400 w-10 h-10"
|
|
@@ -840,7 +840,7 @@ const oa = ({
|
|
|
840
840
|
Z,
|
|
841
841
|
{
|
|
842
842
|
type: "button",
|
|
843
|
-
onClick:
|
|
843
|
+
onClick: A,
|
|
844
844
|
variant: "outlined",
|
|
845
845
|
color: "default",
|
|
846
846
|
children: p ? "Change Image" : "Select Image"
|
|
@@ -863,7 +863,7 @@ const oa = ({
|
|
|
863
863
|
parentClass: s = "",
|
|
864
864
|
className: i = "",
|
|
865
865
|
type: d = "text",
|
|
866
|
-
onKeyDown:
|
|
866
|
+
onKeyDown: t,
|
|
867
867
|
negativeNumberAllow: g = !0,
|
|
868
868
|
defaultValue: M = "",
|
|
869
869
|
...S
|
|
@@ -883,7 +883,7 @@ const oa = ({
|
|
|
883
883
|
return;
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
|
|
886
|
+
t == null || t(c);
|
|
887
887
|
}, v = `
|
|
888
888
|
h-10 placeholder-gray-400 dark:placeholder-gray-400
|
|
889
889
|
${d === "password" ? "pr-10" : ""}
|
|
@@ -917,7 +917,7 @@ const oa = ({
|
|
|
917
917
|
onClick: () => u((c) => !c),
|
|
918
918
|
className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
|
|
919
919
|
children: /* @__PURE__ */ e(
|
|
920
|
-
|
|
920
|
+
re,
|
|
921
921
|
{
|
|
922
922
|
icon: l ? "mdi:eye-outline" : "mdi:eye-off-outline",
|
|
923
923
|
className: "w-5 h-5"
|
|
@@ -936,7 +936,7 @@ const ia = ({
|
|
|
936
936
|
value: s = "",
|
|
937
937
|
onChange: i,
|
|
938
938
|
label: d = "",
|
|
939
|
-
required:
|
|
939
|
+
required: t = !1,
|
|
940
940
|
placeholder: g = "",
|
|
941
941
|
parentClass: M = "col-span-12",
|
|
942
942
|
height: S = 400,
|
|
@@ -950,7 +950,7 @@ const ia = ({
|
|
|
950
950
|
imageUploadHandler: y
|
|
951
951
|
// ✅ Promise function passed from parent
|
|
952
952
|
}) => /* @__PURE__ */ h("div", { className: M, children: [
|
|
953
|
-
d && /* @__PURE__ */ e(q, { label: d, required:
|
|
953
|
+
d && /* @__PURE__ */ e(q, { label: d, required: t }),
|
|
954
954
|
/* @__PURE__ */ e(
|
|
955
955
|
ea,
|
|
956
956
|
{
|
|
@@ -969,11 +969,11 @@ const ia = ({
|
|
|
969
969
|
O(`data:${C.blob().type};base64,${C.base64()}`);
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
|
-
y(C).then((
|
|
973
|
-
|
|
974
|
-
}).catch((
|
|
972
|
+
y(C).then((T) => {
|
|
973
|
+
T ? O(T) : F("Upload failed: No URL returned");
|
|
974
|
+
}).catch((T) => {
|
|
975
975
|
F(
|
|
976
|
-
typeof
|
|
976
|
+
typeof T == "string" ? T : (T == null ? void 0 : T.message) || "Image upload failed"
|
|
977
977
|
);
|
|
978
978
|
});
|
|
979
979
|
}),
|
|
@@ -1019,7 +1019,7 @@ const ia = ({
|
|
|
1019
1019
|
value: i = null,
|
|
1020
1020
|
// boolean for single, array for multiple, or string for single select
|
|
1021
1021
|
onChange: d,
|
|
1022
|
-
disabled:
|
|
1022
|
+
disabled: t = !1,
|
|
1023
1023
|
required: g = !1,
|
|
1024
1024
|
parentClass: M = "col-span-12",
|
|
1025
1025
|
className: S = "",
|
|
@@ -1053,7 +1053,7 @@ const ia = ({
|
|
|
1053
1053
|
name: b,
|
|
1054
1054
|
value: c.value,
|
|
1055
1055
|
checked: u(c.value),
|
|
1056
|
-
disabled:
|
|
1056
|
+
disabled: t || c.disabled,
|
|
1057
1057
|
required: g && w === 0,
|
|
1058
1058
|
onChange: (y) => v(c.value, y.target.checked),
|
|
1059
1059
|
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 ${S}`
|
|
@@ -1076,7 +1076,7 @@ const ia = ({
|
|
|
1076
1076
|
type: "checkbox",
|
|
1077
1077
|
name: b,
|
|
1078
1078
|
checked: u(),
|
|
1079
|
-
disabled:
|
|
1079
|
+
disabled: t,
|
|
1080
1080
|
required: g,
|
|
1081
1081
|
onChange: m,
|
|
1082
1082
|
className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${S}`
|
|
@@ -1097,7 +1097,7 @@ const ia = ({
|
|
|
1097
1097
|
onChange: s,
|
|
1098
1098
|
required: i = !1,
|
|
1099
1099
|
accept: d = "audio/*",
|
|
1100
|
-
id:
|
|
1100
|
+
id: t,
|
|
1101
1101
|
dragDrop: g = !1,
|
|
1102
1102
|
name: M = "",
|
|
1103
1103
|
parentClass: S = ""
|
|
@@ -1120,15 +1120,15 @@ const ia = ({
|
|
|
1120
1120
|
}, w = (O) => {
|
|
1121
1121
|
if (!O || O.length === 0)
|
|
1122
1122
|
return;
|
|
1123
|
-
const F = O[0],
|
|
1124
|
-
c(), l({ file: F, preview:
|
|
1123
|
+
const F = O[0], T = URL.createObjectURL(F);
|
|
1124
|
+
c(), l({ file: F, preview: T }), s == null || s(F);
|
|
1125
1125
|
}, y = (O) => {
|
|
1126
1126
|
O && O.stopPropagation(), c(), l(null), s == null || s(null), v.current && (v.current.value = "");
|
|
1127
1127
|
}, k = (O) => {
|
|
1128
1128
|
g && (O.preventDefault(), m(!0));
|
|
1129
1129
|
}, I = (O) => {
|
|
1130
1130
|
g && (O.preventDefault(), m(!1));
|
|
1131
|
-
},
|
|
1131
|
+
}, A = (O) => {
|
|
1132
1132
|
g && (O.preventDefault(), m(!1), w(O.dataTransfer.files));
|
|
1133
1133
|
}, C = () => {
|
|
1134
1134
|
v.current.click();
|
|
@@ -1141,13 +1141,13 @@ const ia = ({
|
|
|
1141
1141
|
className: `relative rounded-lg p-2 transition-all ${u ? "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"}`,
|
|
1142
1142
|
onDragOver: k,
|
|
1143
1143
|
onDragLeave: I,
|
|
1144
|
-
onDrop:
|
|
1144
|
+
onDrop: A,
|
|
1145
1145
|
children: [
|
|
1146
1146
|
/* @__PURE__ */ e(
|
|
1147
1147
|
"input",
|
|
1148
1148
|
{
|
|
1149
1149
|
ref: v,
|
|
1150
|
-
id:
|
|
1150
|
+
id: t,
|
|
1151
1151
|
type: "file",
|
|
1152
1152
|
accept: d,
|
|
1153
1153
|
onChange: (O) => w(O.target.files),
|
|
@@ -1170,7 +1170,7 @@ const ia = ({
|
|
|
1170
1170
|
onClick: y,
|
|
1171
1171
|
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",
|
|
1172
1172
|
"aria-label": "Remove audio",
|
|
1173
|
-
children: /* @__PURE__ */ e(
|
|
1173
|
+
children: /* @__PURE__ */ e(re, { icon: "mdi:close", className: "w-3 h-3" })
|
|
1174
1174
|
}
|
|
1175
1175
|
),
|
|
1176
1176
|
/* @__PURE__ */ e(
|
|
@@ -1188,7 +1188,7 @@ const ia = ({
|
|
|
1188
1188
|
) : (
|
|
1189
1189
|
// Empty state with upload button
|
|
1190
1190
|
/* @__PURE__ */ h("div", { className: "flex items-center justify-center space-x-4", children: [
|
|
1191
|
-
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
1191
|
+
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(re, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
|
|
1192
1192
|
/* @__PURE__ */ e(
|
|
1193
1193
|
Z,
|
|
1194
1194
|
{
|
|
@@ -1212,7 +1212,7 @@ const ia = ({
|
|
|
1212
1212
|
const {
|
|
1213
1213
|
key: i,
|
|
1214
1214
|
label: d,
|
|
1215
|
-
type:
|
|
1215
|
+
type: t,
|
|
1216
1216
|
options: g,
|
|
1217
1217
|
placeholder: M,
|
|
1218
1218
|
rows: S,
|
|
@@ -1226,11 +1226,11 @@ const ia = ({
|
|
|
1226
1226
|
parentClass: y,
|
|
1227
1227
|
countriesList: k,
|
|
1228
1228
|
defaultCountry: I,
|
|
1229
|
-
multiple:
|
|
1229
|
+
multiple: A,
|
|
1230
1230
|
dropdownMaxHeight: C,
|
|
1231
1231
|
editorKey: O,
|
|
1232
1232
|
fontFamily: F,
|
|
1233
|
-
disabled:
|
|
1233
|
+
disabled: T,
|
|
1234
1234
|
negativeNumberAllow: L,
|
|
1235
1235
|
defaultValue: B,
|
|
1236
1236
|
renderCondition: E,
|
|
@@ -1238,19 +1238,19 @@ const ia = ({
|
|
|
1238
1238
|
} = b;
|
|
1239
1239
|
let $ = o == null ? void 0 : o[i];
|
|
1240
1240
|
$ == null && ($ = "");
|
|
1241
|
-
const _ = M || (
|
|
1241
|
+
const _ = M || (t === "select" ? `Select ${d}` : `Enter ${d}`), z = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
|
|
1242
1242
|
if (E && typeof E == "function" && !E(o))
|
|
1243
1243
|
return null;
|
|
1244
|
-
switch (
|
|
1244
|
+
switch (t) {
|
|
1245
1245
|
case "select":
|
|
1246
1246
|
return /* @__PURE__ */ e(
|
|
1247
|
-
|
|
1247
|
+
ta,
|
|
1248
1248
|
{
|
|
1249
1249
|
options: g || [],
|
|
1250
1250
|
value: $,
|
|
1251
1251
|
formData: o,
|
|
1252
1252
|
dependencyKey: Y,
|
|
1253
|
-
onChange: (
|
|
1253
|
+
onChange: (D) => s(i, D),
|
|
1254
1254
|
placeholder: _,
|
|
1255
1255
|
className: p || "",
|
|
1256
1256
|
search: l,
|
|
@@ -1258,9 +1258,9 @@ const ia = ({
|
|
|
1258
1258
|
defaultValue: B,
|
|
1259
1259
|
label: d,
|
|
1260
1260
|
name: i,
|
|
1261
|
-
disabled:
|
|
1261
|
+
disabled: T,
|
|
1262
1262
|
parentClass: y,
|
|
1263
|
-
multiple:
|
|
1263
|
+
multiple: A,
|
|
1264
1264
|
dropdownMaxHeight: C
|
|
1265
1265
|
}
|
|
1266
1266
|
);
|
|
@@ -1272,12 +1272,12 @@ const ia = ({
|
|
|
1272
1272
|
label: d,
|
|
1273
1273
|
options: g || [],
|
|
1274
1274
|
value: $,
|
|
1275
|
-
onChange: (
|
|
1275
|
+
onChange: (D) => s(i, D),
|
|
1276
1276
|
required: v,
|
|
1277
1277
|
parentClass: y,
|
|
1278
1278
|
className: p || "",
|
|
1279
|
-
multiSelect:
|
|
1280
|
-
disabled:
|
|
1279
|
+
multiSelect: A,
|
|
1280
|
+
disabled: T
|
|
1281
1281
|
}
|
|
1282
1282
|
);
|
|
1283
1283
|
case "switch":
|
|
@@ -1285,13 +1285,13 @@ const ia = ({
|
|
|
1285
1285
|
na,
|
|
1286
1286
|
{
|
|
1287
1287
|
value: $,
|
|
1288
|
-
onChange: (
|
|
1288
|
+
onChange: (D) => s(i, D),
|
|
1289
1289
|
text: m,
|
|
1290
1290
|
options: g || [],
|
|
1291
1291
|
label: d,
|
|
1292
1292
|
required: v,
|
|
1293
1293
|
name: i,
|
|
1294
|
-
disabled:
|
|
1294
|
+
disabled: T,
|
|
1295
1295
|
parentClass: y
|
|
1296
1296
|
}
|
|
1297
1297
|
);
|
|
@@ -1300,7 +1300,7 @@ const ia = ({
|
|
|
1300
1300
|
la,
|
|
1301
1301
|
{
|
|
1302
1302
|
value: $,
|
|
1303
|
-
onChange: (
|
|
1303
|
+
onChange: (D) => s(i, D),
|
|
1304
1304
|
countriesList: k,
|
|
1305
1305
|
defaultCountry: I,
|
|
1306
1306
|
required: v,
|
|
@@ -1308,7 +1308,7 @@ const ia = ({
|
|
|
1308
1308
|
search: l,
|
|
1309
1309
|
label: d,
|
|
1310
1310
|
name: i,
|
|
1311
|
-
disabled:
|
|
1311
|
+
disabled: T,
|
|
1312
1312
|
parentClass: y
|
|
1313
1313
|
}
|
|
1314
1314
|
);
|
|
@@ -1317,14 +1317,14 @@ const ia = ({
|
|
|
1317
1317
|
je,
|
|
1318
1318
|
{
|
|
1319
1319
|
value: $,
|
|
1320
|
-
onChange: (
|
|
1320
|
+
onChange: (D) => s(i, D.target.value),
|
|
1321
1321
|
placeholder: _,
|
|
1322
1322
|
rows: S || 3,
|
|
1323
1323
|
className: `${z} ${p || ""}`,
|
|
1324
1324
|
required: v,
|
|
1325
1325
|
name: i,
|
|
1326
1326
|
label: d,
|
|
1327
|
-
disabled:
|
|
1327
|
+
disabled: T,
|
|
1328
1328
|
parentClass: y
|
|
1329
1329
|
}
|
|
1330
1330
|
);
|
|
@@ -1333,7 +1333,7 @@ const ia = ({
|
|
|
1333
1333
|
oa,
|
|
1334
1334
|
{
|
|
1335
1335
|
value: $,
|
|
1336
|
-
onChange: (
|
|
1336
|
+
onChange: (D) => s(i, D),
|
|
1337
1337
|
required: v,
|
|
1338
1338
|
accept: u || "image/*",
|
|
1339
1339
|
id: `file-${i}`,
|
|
@@ -1348,7 +1348,7 @@ const ia = ({
|
|
|
1348
1348
|
da,
|
|
1349
1349
|
{
|
|
1350
1350
|
value: $,
|
|
1351
|
-
onChange: (
|
|
1351
|
+
onChange: (D) => s(i, D),
|
|
1352
1352
|
required: v,
|
|
1353
1353
|
accept: u || "audio/*",
|
|
1354
1354
|
id: `file-${i}`,
|
|
@@ -1363,14 +1363,14 @@ const ia = ({
|
|
|
1363
1363
|
ia,
|
|
1364
1364
|
{
|
|
1365
1365
|
value: $,
|
|
1366
|
-
onChange: (
|
|
1366
|
+
onChange: (D) => s(i, D),
|
|
1367
1367
|
required: v,
|
|
1368
1368
|
placeholder: _,
|
|
1369
1369
|
label: d,
|
|
1370
1370
|
parentClass: y,
|
|
1371
1371
|
fontFamily: F,
|
|
1372
1372
|
editorKey: O,
|
|
1373
|
-
disabled:
|
|
1373
|
+
disabled: T
|
|
1374
1374
|
},
|
|
1375
1375
|
`editor-${i}`
|
|
1376
1376
|
);
|
|
@@ -1378,10 +1378,10 @@ const ia = ({
|
|
|
1378
1378
|
return /* @__PURE__ */ e(
|
|
1379
1379
|
Ee,
|
|
1380
1380
|
{
|
|
1381
|
-
type:
|
|
1381
|
+
type: t || "text",
|
|
1382
1382
|
defaultValue: B,
|
|
1383
1383
|
value: $,
|
|
1384
|
-
onChange: (
|
|
1384
|
+
onChange: (D) => s(i, D.target.value),
|
|
1385
1385
|
placeholder: _,
|
|
1386
1386
|
className: `${z} ${p || ""}`,
|
|
1387
1387
|
required: v,
|
|
@@ -1390,18 +1390,18 @@ const ia = ({
|
|
|
1390
1390
|
label: d,
|
|
1391
1391
|
negativeNumberAllow: L,
|
|
1392
1392
|
parentClass: y,
|
|
1393
|
-
disabled:
|
|
1393
|
+
disabled: T
|
|
1394
1394
|
}
|
|
1395
1395
|
);
|
|
1396
1396
|
}
|
|
1397
1397
|
}, ca = ({ isOpen: b, onClose: o, config: s, onApply: i }) => {
|
|
1398
1398
|
var p;
|
|
1399
|
-
const [d,
|
|
1400
|
-
|
|
1399
|
+
const [d, t] = R({}), g = (l, u) => {
|
|
1400
|
+
t((m) => ({ ...m, [l]: u }));
|
|
1401
1401
|
}, M = () => {
|
|
1402
1402
|
i == null || i(d), o();
|
|
1403
1403
|
}, S = () => {
|
|
1404
|
-
|
|
1404
|
+
t({}), i == null || i({}), o();
|
|
1405
1405
|
};
|
|
1406
1406
|
return /* @__PURE__ */ h(j, { children: [
|
|
1407
1407
|
/* @__PURE__ */ e(
|
|
@@ -1464,7 +1464,7 @@ const ia = ({
|
|
|
1464
1464
|
}
|
|
1465
1465
|
)
|
|
1466
1466
|
] });
|
|
1467
|
-
},
|
|
1467
|
+
}, Te = {
|
|
1468
1468
|
blue: {
|
|
1469
1469
|
bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
1470
1470
|
border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
|
|
@@ -1493,7 +1493,7 @@ const ia = ({
|
|
|
1493
1493
|
bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
|
|
1494
1494
|
border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
|
|
1495
1495
|
}
|
|
1496
|
-
},
|
|
1496
|
+
}, Pe = {
|
|
1497
1497
|
contained: "bg",
|
|
1498
1498
|
outline: "border !bg-transparent",
|
|
1499
1499
|
soft: "bg opacity-90"
|
|
@@ -1504,13 +1504,13 @@ const ia = ({
|
|
|
1504
1504
|
color: s = "green",
|
|
1505
1505
|
className: i = ""
|
|
1506
1506
|
}) => {
|
|
1507
|
-
const d =
|
|
1507
|
+
const d = Te[s] || Te.green, t = Pe[o] || Pe.contained, g = o === "outline" ? d.border : d.bg;
|
|
1508
1508
|
return /* @__PURE__ */ e(
|
|
1509
1509
|
"span",
|
|
1510
1510
|
{
|
|
1511
1511
|
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1512
1512
|
${g}
|
|
1513
|
-
${
|
|
1513
|
+
${t}
|
|
1514
1514
|
${i}`,
|
|
1515
1515
|
children: b
|
|
1516
1516
|
}
|
|
@@ -1523,7 +1523,7 @@ const ia = ({
|
|
|
1523
1523
|
"tr",
|
|
1524
1524
|
{
|
|
1525
1525
|
className: "border-t border-gray-200 dark:border-gray-800",
|
|
1526
|
-
children: Array.from({ length: o }).map((d,
|
|
1526
|
+
children: Array.from({ length: o }).map((d, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
|
|
1527
1527
|
},
|
|
1528
1528
|
i
|
|
1529
1529
|
)) })
|
|
@@ -1531,11 +1531,11 @@ const ia = ({
|
|
|
1531
1531
|
] }), _e = ({ src: b, alt: o = "preview", isOpen: s, setIsOpen: i }) => {
|
|
1532
1532
|
const d = () => i(!1);
|
|
1533
1533
|
return K(() => {
|
|
1534
|
-
const
|
|
1534
|
+
const t = (g) => {
|
|
1535
1535
|
g.key === "Escape" && d();
|
|
1536
1536
|
};
|
|
1537
|
-
return s && (document.body.style.overflow = "hidden", document.addEventListener("keydown",
|
|
1538
|
-
document.body.style.overflow = "", document.removeEventListener("keydown",
|
|
1537
|
+
return s && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
|
|
1538
|
+
document.body.style.overflow = "", document.removeEventListener("keydown", t);
|
|
1539
1539
|
};
|
|
1540
1540
|
}, [s]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h(
|
|
1541
1541
|
"div",
|
|
@@ -1557,7 +1557,7 @@ const ia = ({
|
|
|
1557
1557
|
"div",
|
|
1558
1558
|
{
|
|
1559
1559
|
className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
|
|
1560
|
-
onClick: (
|
|
1560
|
+
onClick: (t) => t.stopPropagation(),
|
|
1561
1561
|
children: /* @__PURE__ */ e(
|
|
1562
1562
|
"img",
|
|
1563
1563
|
{
|
|
@@ -1573,7 +1573,7 @@ const ia = ({
|
|
|
1573
1573
|
) });
|
|
1574
1574
|
}, ua = ({ config: b, setShowAdd: o, title: s, buttonText: i, description: d }) => {
|
|
1575
1575
|
const {
|
|
1576
|
-
data:
|
|
1576
|
+
data: t = [],
|
|
1577
1577
|
table_head: g = [],
|
|
1578
1578
|
loading: M = !1,
|
|
1579
1579
|
search: S = {
|
|
@@ -1597,11 +1597,11 @@ const ia = ({
|
|
|
1597
1597
|
onFilterApply: c,
|
|
1598
1598
|
filterConfig: w = null,
|
|
1599
1599
|
rowClick: y = null
|
|
1600
|
-
} = b, [k, I] = R(""), [
|
|
1601
|
-
if (l.useServerSidePagination) return
|
|
1600
|
+
} = b, [k, I] = R(""), [A, C] = R(null), [O, F] = R([]), [T, L] = R({}), [B, E] = R(!1), [Y, $] = R(null), [_, z] = R(!1), D = Re(() => !S.enabled || !k.trim() || S.useServerSideSearch ? t : ra(t, k, S.searchKeys || []), [t, k, S]), [U, V] = R(1), [x, H] = R((l == null ? void 0 : l.rows_per_page) || 50), [J, Q] = R(D.length || 0), W = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(D.length / x), ie = Re(() => {
|
|
1601
|
+
if (l.useServerSidePagination) return D;
|
|
1602
1602
|
const a = (U - 1) * x;
|
|
1603
|
-
return
|
|
1604
|
-
}, [
|
|
1603
|
+
return D.slice(a, a + x);
|
|
1604
|
+
}, [D, U, x]), te = ee(null), se = ee({}), ae = ee(null), de = (a) => {
|
|
1605
1605
|
I(a), V(1), S.useServerSideSearch && (ae.current && clearTimeout(ae.current), ae.current = setTimeout(async () => {
|
|
1606
1606
|
try {
|
|
1607
1607
|
await v((n) => ({
|
|
@@ -1613,26 +1613,26 @@ const ia = ({
|
|
|
1613
1613
|
console.error("Search error:", n);
|
|
1614
1614
|
}
|
|
1615
1615
|
}, 800));
|
|
1616
|
-
}, de = (a, n, f) => {
|
|
1617
|
-
f.stopPropagation(), C(null), m == null || m(a.type, n);
|
|
1618
1616
|
}, ce = (a, n, f) => {
|
|
1617
|
+
f.stopPropagation(), C(null), m == null || m(a.type, n);
|
|
1618
|
+
}, he = (a, n, f) => {
|
|
1619
1619
|
n.stopPropagation(), F(f);
|
|
1620
1620
|
const N = n.currentTarget;
|
|
1621
|
-
|
|
1622
|
-
const
|
|
1621
|
+
se.current[a] = N;
|
|
1622
|
+
const P = N.getBoundingClientRect(), G = 192, X = f.length * 40, ve = window.innerWidth, De = window.innerHeight, ze = ve - P.right < G ? P.left - G + P.width : P.left, He = De - P.bottom < X && P.top > X ? P.top - X - 2 : P.bottom + 2;
|
|
1623
1623
|
L({
|
|
1624
|
-
top: Math.max(8, Math.min(He,
|
|
1624
|
+
top: Math.max(8, Math.min(He, De - X - 8)),
|
|
1625
1625
|
left: Math.max(8, Math.min(ze, ve - G - 8))
|
|
1626
|
-
}), C(
|
|
1627
|
-
},
|
|
1626
|
+
}), C(A === a ? null : a);
|
|
1627
|
+
}, ue = (a) => (U - 1) * x + a + 1, be = (a) => {
|
|
1628
1628
|
a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), $(a), z(!0);
|
|
1629
1629
|
}, ne = (a, n, f, N = null) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
|
|
1630
1630
|
"img",
|
|
1631
1631
|
{
|
|
1632
1632
|
src: a instanceof File ? URL.createObjectURL(a) : a,
|
|
1633
1633
|
alt: n || "Avatar",
|
|
1634
|
-
onClick: (
|
|
1635
|
-
|
|
1634
|
+
onClick: (P) => {
|
|
1635
|
+
P.stopPropagation(), P.preventDefault(), be({ src: a, alt: n });
|
|
1636
1636
|
},
|
|
1637
1637
|
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${f || ""}`
|
|
1638
1638
|
}
|
|
@@ -1642,7 +1642,7 @@ const ia = ({
|
|
|
1642
1642
|
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 ${f || ""}`,
|
|
1643
1643
|
children: /* @__PURE__ */ e(Be, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1644
1644
|
}
|
|
1645
|
-
) }) }),
|
|
1645
|
+
) }) }), pe = (a, n) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
|
|
1646
1646
|
"audio",
|
|
1647
1647
|
{
|
|
1648
1648
|
controls: !0,
|
|
@@ -1659,62 +1659,62 @@ const ia = ({
|
|
|
1659
1659
|
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 ${n || ""}`,
|
|
1660
1660
|
children: /* @__PURE__ */ e(Qe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1661
1661
|
}
|
|
1662
|
-
) }) }),
|
|
1662
|
+
) }) }), ge = (a, n) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${n.className || ""}`, children: [
|
|
1663
1663
|
n.imageKey ? ne(a[n.imageKey], a[n.titleKey], "group-avatar") : "",
|
|
1664
1664
|
/* @__PURE__ */ h("div", { children: [
|
|
1665
1665
|
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: a[n.titleKey] || "" }),
|
|
1666
1666
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: a[n.subtitleKey] || "" })
|
|
1667
1667
|
] })
|
|
1668
|
-
] }),
|
|
1668
|
+
] }), me = (a, n) => {
|
|
1669
1669
|
var G;
|
|
1670
1670
|
let f = String(a);
|
|
1671
1671
|
const N = n.variant || "contained";
|
|
1672
|
-
let
|
|
1672
|
+
let P = n.defaultColor;
|
|
1673
1673
|
if (((G = n == null ? void 0 : n.chipOptions) == null ? void 0 : G.length) > 0) {
|
|
1674
1674
|
let X = n == null ? void 0 : n.chipOptions.find((ve) => ve.value == a);
|
|
1675
|
-
X && (f = X.label,
|
|
1675
|
+
X && (f = X.label, P = X.color);
|
|
1676
1676
|
}
|
|
1677
1677
|
return /* @__PURE__ */ e(
|
|
1678
1678
|
Ge,
|
|
1679
1679
|
{
|
|
1680
1680
|
label: f,
|
|
1681
1681
|
variant: N,
|
|
1682
|
-
color:
|
|
1682
|
+
color: P,
|
|
1683
1683
|
className: n.className || ""
|
|
1684
1684
|
}
|
|
1685
1685
|
);
|
|
1686
|
-
},
|
|
1686
|
+
}, fe = (a, n, f) => {
|
|
1687
1687
|
const N = n[a.key];
|
|
1688
1688
|
return a.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${a.className || ""}`, children: /* @__PURE__ */ e(
|
|
1689
1689
|
"button",
|
|
1690
1690
|
{
|
|
1691
|
-
ref: (
|
|
1692
|
-
onClick: (
|
|
1691
|
+
ref: (P) => se.current[n.id || n._id] = P,
|
|
1692
|
+
onClick: (P) => he(n.id || n._id, P, a.menuList),
|
|
1693
1693
|
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",
|
|
1694
1694
|
children: /* @__PURE__ */ e(Je, { className: "h-4 w-4" })
|
|
1695
1695
|
}
|
|
1696
|
-
) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children:
|
|
1697
|
-
},
|
|
1696
|
+
) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children: ue(f) }) : a.type === "group" ? ge(n, a) : a.type === "chip" ? /* @__PURE__ */ e(j, { children: me(N, a) }) : a.type === "date" ? /* @__PURE__ */ e("span", { className: a.className || "", children: Ue(N, a.format || "DD MMM YYYY") }) : a.type === "avatar" ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ne(N, a.alt, a.className, a.fallback_icon) }) }) : a.type === "audio" ? /* @__PURE__ */ e(j, { children: pe(N, a.className) }) : /* @__PURE__ */ e("span", { className: a.className || "", children: N || "N/A" });
|
|
1697
|
+
}, ye = (a) => {
|
|
1698
1698
|
if (typeof y == "function")
|
|
1699
1699
|
return y(a);
|
|
1700
1700
|
if (y)
|
|
1701
1701
|
return m == null ? void 0 : m("view", a);
|
|
1702
|
-
},
|
|
1702
|
+
}, xe = (a, n) => {
|
|
1703
1703
|
if (a.onClickDetails)
|
|
1704
1704
|
return m == null ? void 0 : m("view", n);
|
|
1705
1705
|
if (typeof a.handleClick == "function")
|
|
1706
1706
|
return a.handleClick(n);
|
|
1707
|
-
}, le = () => y || typeof y == "function",
|
|
1707
|
+
}, le = () => y || typeof y == "function", oe = (a) => a.onClickDetails || typeof a.handleClick == "function";
|
|
1708
1708
|
return K(() => {
|
|
1709
1709
|
const a = () => {
|
|
1710
|
-
|
|
1710
|
+
A && C(null);
|
|
1711
1711
|
};
|
|
1712
1712
|
return window.addEventListener("scroll", a, !0), () => {
|
|
1713
1713
|
window.removeEventListener("scroll", a, !0);
|
|
1714
1714
|
};
|
|
1715
|
-
}, [
|
|
1715
|
+
}, [A]), K(() => {
|
|
1716
1716
|
const a = (n) => {
|
|
1717
|
-
|
|
1717
|
+
te.current && !te.current.contains(n.target) && C(null);
|
|
1718
1718
|
};
|
|
1719
1719
|
return document.addEventListener("click", a), () => document.removeEventListener("click", a);
|
|
1720
1720
|
}, []), K(() => {
|
|
@@ -1725,10 +1725,10 @@ const ia = ({
|
|
|
1725
1725
|
l.current_page
|
|
1726
1726
|
]), K(() => {
|
|
1727
1727
|
Q(
|
|
1728
|
-
l != null && l.useServerSidePagination ? l.total_records :
|
|
1729
|
-
),
|
|
1728
|
+
l != null && l.useServerSidePagination ? l.total_records : D.length
|
|
1729
|
+
), D.length <= x * (U - 1) && !(l != null && l.useServerSidePagination) && V((a) => a - 1 || 1);
|
|
1730
1730
|
}, [
|
|
1731
|
-
|
|
1731
|
+
D.length,
|
|
1732
1732
|
l.total_records,
|
|
1733
1733
|
l == null ? void 0 : l.useServerSidePagination
|
|
1734
1734
|
]), M ? /* @__PURE__ */ e(ha, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(j, { children: [
|
|
@@ -1759,7 +1759,7 @@ const ia = ({
|
|
|
1759
1759
|
type: "text",
|
|
1760
1760
|
placeholder: S.placeholder || "Search...",
|
|
1761
1761
|
value: k,
|
|
1762
|
-
onChange: (a) =>
|
|
1762
|
+
onChange: (a) => de(a.target.value),
|
|
1763
1763
|
className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
|
|
1764
1764
|
}
|
|
1765
1765
|
)
|
|
@@ -1781,29 +1781,29 @@ const ia = ({
|
|
|
1781
1781
|
},
|
|
1782
1782
|
a.key
|
|
1783
1783
|
)) }) }),
|
|
1784
|
-
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children:
|
|
1784
|
+
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ie.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
1785
1785
|
"td",
|
|
1786
1786
|
{
|
|
1787
1787
|
colSpan: g.length,
|
|
1788
1788
|
className: "text-center py-10 text-gray-500 dark:text-gray-400",
|
|
1789
1789
|
children: u
|
|
1790
1790
|
}
|
|
1791
|
-
) }) :
|
|
1791
|
+
) }) : ie.map((a, n) => /* @__PURE__ */ e(
|
|
1792
1792
|
"tr",
|
|
1793
1793
|
{
|
|
1794
1794
|
className: `hover:bg-gray-50 dark:hover:bg-blue-800/10 transition ${le() ? "cursor-pointer" : ""}`,
|
|
1795
1795
|
onClick: (f) => {
|
|
1796
|
-
|
|
1796
|
+
le() && ye(a);
|
|
1797
1797
|
},
|
|
1798
1798
|
children: g.map((f) => /* @__PURE__ */ e(
|
|
1799
1799
|
"td",
|
|
1800
1800
|
{
|
|
1801
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${f.type == "audio" ? "" : "max-w-[300px]"} truncate ${
|
|
1801
|
+
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${f.type == "audio" ? "" : "max-w-[300px]"} truncate ${oe(f) ? "cursor-pointer" : ""}`,
|
|
1802
1802
|
title: String(a[f.key] ?? ""),
|
|
1803
1803
|
onClick: (N) => {
|
|
1804
|
-
N.stopPropagation(), N.preventDefault(),
|
|
1804
|
+
oe(f) && (N.stopPropagation(), N.preventDefault(), xe(f, a));
|
|
1805
1805
|
},
|
|
1806
|
-
children: f.render ? f.render(a, n) :
|
|
1806
|
+
children: f.render ? f.render(a, n) : fe(f, a, n)
|
|
1807
1807
|
},
|
|
1808
1808
|
f.key
|
|
1809
1809
|
))
|
|
@@ -1811,7 +1811,7 @@ const ia = ({
|
|
|
1811
1811
|
a.id || a._id || n
|
|
1812
1812
|
)) })
|
|
1813
1813
|
] }) }),
|
|
1814
|
-
(l == null ? void 0 : l.enabled) &&
|
|
1814
|
+
(l == null ? void 0 : l.enabled) && D.length > 0 && /* @__PURE__ */ h("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
|
|
1815
1815
|
/* @__PURE__ */ h("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1816
1816
|
"Showing ",
|
|
1817
1817
|
(U - 1) * x + 1,
|
|
@@ -1888,25 +1888,25 @@ const ia = ({
|
|
|
1888
1888
|
] })
|
|
1889
1889
|
] })
|
|
1890
1890
|
] }),
|
|
1891
|
-
|
|
1891
|
+
A && Xe(
|
|
1892
1892
|
/* @__PURE__ */ e(
|
|
1893
1893
|
"div",
|
|
1894
1894
|
{
|
|
1895
|
-
ref:
|
|
1895
|
+
ref: te,
|
|
1896
1896
|
style: {
|
|
1897
1897
|
position: "fixed",
|
|
1898
|
-
top: `${
|
|
1899
|
-
left: `${
|
|
1898
|
+
top: `${T.top}px`,
|
|
1899
|
+
left: `${T.left}px`,
|
|
1900
1900
|
zIndex: 9999
|
|
1901
1901
|
},
|
|
1902
1902
|
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1903
1903
|
children: O.map((a, n) => /* @__PURE__ */ h(
|
|
1904
1904
|
"button",
|
|
1905
1905
|
{
|
|
1906
|
-
onClick: (f) =>
|
|
1906
|
+
onClick: (f) => ce(
|
|
1907
1907
|
a,
|
|
1908
|
-
|
|
1909
|
-
(N) => N.id ===
|
|
1908
|
+
t.find(
|
|
1909
|
+
(N) => N.id === A || N._id == A
|
|
1910
1910
|
),
|
|
1911
1911
|
f
|
|
1912
1912
|
),
|
|
@@ -1947,7 +1947,7 @@ const ia = ({
|
|
|
1947
1947
|
icon: s,
|
|
1948
1948
|
title: i,
|
|
1949
1949
|
children: d,
|
|
1950
|
-
size:
|
|
1950
|
+
size: t = "md",
|
|
1951
1951
|
actionButtons: g = [],
|
|
1952
1952
|
actions: M,
|
|
1953
1953
|
showDefaultClose: S = !0,
|
|
@@ -1980,7 +1980,7 @@ const ia = ({
|
|
|
1980
1980
|
/* @__PURE__ */ h(
|
|
1981
1981
|
"div",
|
|
1982
1982
|
{
|
|
1983
|
-
className: `relative bg-white rounded-lg shadow-xl w-full ${y[
|
|
1983
|
+
className: `relative bg-white rounded-lg shadow-xl w-full ${y[t] || y.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
1984
1984
|
children: [
|
|
1985
1985
|
/* @__PURE__ */ h("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
1986
1986
|
/* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
|
|
@@ -2003,10 +2003,10 @@ const ia = ({
|
|
|
2003
2003
|
onClick: (I) => {
|
|
2004
2004
|
k.type == "submit" ? u(I) : c(
|
|
2005
2005
|
() => {
|
|
2006
|
-
var
|
|
2007
|
-
return (
|
|
2006
|
+
var A;
|
|
2007
|
+
return (A = k == null ? void 0 : k.onClick) == null ? void 0 : A.call(k, I, w);
|
|
2008
2008
|
},
|
|
2009
|
-
(
|
|
2009
|
+
(A) => o == null ? void 0 : o(A)
|
|
2010
2010
|
);
|
|
2011
2011
|
},
|
|
2012
2012
|
disabled: v || k.disabled,
|
|
@@ -2026,7 +2026,7 @@ const ia = ({
|
|
|
2026
2026
|
)
|
|
2027
2027
|
] });
|
|
2028
2028
|
}, Fe = ({ config: b, onSubmit: o, initialData: s = {}, type: i = "add" }) => {
|
|
2029
|
-
const { formClass: d = "grid grid-cols-12 gap-4", formFields:
|
|
2029
|
+
const { formClass: d = "grid grid-cols-12 gap-4", formFields: t = [] } = b || {}, [g, M] = R(s);
|
|
2030
2030
|
K(() => {
|
|
2031
2031
|
M(s);
|
|
2032
2032
|
}, []);
|
|
@@ -2048,7 +2048,7 @@ const ia = ({
|
|
|
2048
2048
|
onSubmit: p,
|
|
2049
2049
|
className: d,
|
|
2050
2050
|
noValidate: !1,
|
|
2051
|
-
children:
|
|
2051
|
+
children: t.map((l) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
2052
2052
|
$e,
|
|
2053
2053
|
{
|
|
2054
2054
|
field: l,
|
|
@@ -2061,14 +2061,14 @@ const ia = ({
|
|
|
2061
2061
|
);
|
|
2062
2062
|
};
|
|
2063
2063
|
function ba({ data: b, config: o }) {
|
|
2064
|
-
const { fields: s, containerClass: i } = o, [d,
|
|
2065
|
-
u && u.src instanceof File && (u = { ...u, src: URL.createObjectURL(u.src) }),
|
|
2064
|
+
const { fields: s, containerClass: i } = o, [d, t] = R(null), [g, M] = R(!1), S = (u) => {
|
|
2065
|
+
u && u.src instanceof File && (u = { ...u, src: URL.createObjectURL(u.src) }), t(u), M(!0);
|
|
2066
2066
|
}, p = ({ col: u }) => {
|
|
2067
2067
|
var I;
|
|
2068
2068
|
let m = u == null ? void 0 : u.icon, v = u.label, c = b[u.key], w = u.type, y = u.variant || "outline", k = u.defaultColor;
|
|
2069
2069
|
if (w === "chip" && ((I = u.chipOptions) == null ? void 0 : I.length) > 0) {
|
|
2070
|
-
let
|
|
2071
|
-
|
|
2070
|
+
let A = u == null ? void 0 : u.chipOptions.find((C) => C.value == c);
|
|
2071
|
+
A && (c = A.label, k = A.color);
|
|
2072
2072
|
}
|
|
2073
2073
|
return /* @__PURE__ */ h(
|
|
2074
2074
|
"div",
|
|
@@ -2102,7 +2102,7 @@ function ba({ data: b, config: o }) {
|
|
|
2102
2102
|
{
|
|
2103
2103
|
controls: !0,
|
|
2104
2104
|
src: c instanceof File ? URL.createObjectURL(c) : c,
|
|
2105
|
-
onClick: (
|
|
2105
|
+
onClick: (A) => A.stopPropagation(),
|
|
2106
2106
|
className: "shadow-md rounded-full"
|
|
2107
2107
|
},
|
|
2108
2108
|
c instanceof File ? URL.createObjectURL(c) : c
|
|
@@ -2157,22 +2157,22 @@ function ba({ data: b, config: o }) {
|
|
|
2157
2157
|
] });
|
|
2158
2158
|
}
|
|
2159
2159
|
const Ke = ({ config: b }) => {
|
|
2160
|
-
var ae,
|
|
2160
|
+
var ae, de, ce, he, ue, be, ne, pe, ge, me, fe, ye, xe, le, oe, a;
|
|
2161
2161
|
const {
|
|
2162
2162
|
title: o,
|
|
2163
2163
|
fetchData: s = async () => {
|
|
2164
2164
|
},
|
|
2165
2165
|
isStaticData: i = !1,
|
|
2166
2166
|
tableConfig: d = {},
|
|
2167
|
-
modalConfig:
|
|
2167
|
+
modalConfig: t = {},
|
|
2168
2168
|
filterConfig: g
|
|
2169
2169
|
} = b, [M, S] = R(!0), [p, l] = R(!1), [u, m] = R([]), [v, c] = R(null), [w, y] = R({
|
|
2170
2170
|
search: "",
|
|
2171
2171
|
rows_per_page: 50,
|
|
2172
2172
|
current_page: 1
|
|
2173
|
-
}), [k, I] = R({}), [
|
|
2173
|
+
}), [k, I] = R({}), [A, C] = R(!1), [O, F] = R(!1), [T, L] = R(!1), [B, E] = R(!1), [Y, $] = R(!1), [_, z] = R(null), D = (n, f) => {
|
|
2174
2174
|
n === "edit" ? (z(f), L(!0)) : n === "view" ? (z(f), $(!0)) : n === "delete" && (z(f), E(!0));
|
|
2175
|
-
}, U = async (n, f, N = "",
|
|
2175
|
+
}, U = async (n, f, N = "", P = "") => {
|
|
2176
2176
|
l(!0);
|
|
2177
2177
|
try {
|
|
2178
2178
|
const G = await (n == null ? void 0 : n());
|
|
@@ -2180,7 +2180,7 @@ const Ke = ({ config: b }) => {
|
|
|
2180
2180
|
variant: "success"
|
|
2181
2181
|
}), f == null || f(G);
|
|
2182
2182
|
} catch (G) {
|
|
2183
|
-
(
|
|
2183
|
+
(P || G.message) && Se(P || G.message, { variant: "error" });
|
|
2184
2184
|
} finally {
|
|
2185
2185
|
l(!1);
|
|
2186
2186
|
}
|
|
@@ -2196,7 +2196,7 @@ const Ke = ({ config: b }) => {
|
|
|
2196
2196
|
}, x = (n) => {
|
|
2197
2197
|
let f = n.newObject, N = n.targetObject;
|
|
2198
2198
|
i ? m(
|
|
2199
|
-
(
|
|
2199
|
+
(P) => P.map(
|
|
2200
2200
|
(G) => G.id === N.id ? { ...G, ...f } : G
|
|
2201
2201
|
)
|
|
2202
2202
|
) : W(), L(!1);
|
|
@@ -2214,13 +2214,13 @@ const Ke = ({ config: b }) => {
|
|
|
2214
2214
|
}, J = (n) => U(
|
|
2215
2215
|
() => {
|
|
2216
2216
|
var f, N;
|
|
2217
|
-
return (N = (f =
|
|
2217
|
+
return (N = (f = t == null ? void 0 : t.addModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : N.call(f, n);
|
|
2218
2218
|
},
|
|
2219
2219
|
V
|
|
2220
2220
|
), Q = (n) => U(
|
|
2221
2221
|
() => {
|
|
2222
2222
|
var f, N;
|
|
2223
|
-
return (N = (f =
|
|
2223
|
+
return (N = (f = t == null ? void 0 : t.editModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : N.call(f, n, _);
|
|
2224
2224
|
},
|
|
2225
2225
|
x
|
|
2226
2226
|
), W = async () => {
|
|
@@ -2231,16 +2231,16 @@ const Ke = ({ config: b }) => {
|
|
|
2231
2231
|
}).finally(() => {
|
|
2232
2232
|
S(!1);
|
|
2233
2233
|
});
|
|
2234
|
-
},
|
|
2234
|
+
}, ie = (n) => {
|
|
2235
2235
|
var f;
|
|
2236
2236
|
I((N) => ({
|
|
2237
2237
|
...n
|
|
2238
2238
|
})), (f = d == null ? void 0 : d.filter) != null && f.useServerSideFilters && C((N) => !N);
|
|
2239
|
-
},
|
|
2240
|
-
(N) => Object.entries(f).every(([
|
|
2241
|
-
),
|
|
2239
|
+
}, te = (n, f) => n.filter(
|
|
2240
|
+
(N) => Object.entries(f).every(([P, G]) => N[P] === G)
|
|
2241
|
+
), se = Re(() => {
|
|
2242
2242
|
var n;
|
|
2243
|
-
return (n = d == null ? void 0 : d.filter) != null && n.useServerSideFilters ? u :
|
|
2243
|
+
return (n = d == null ? void 0 : d.filter) != null && n.useServerSideFilters ? u : te(u, k);
|
|
2244
2244
|
}, [u, k]);
|
|
2245
2245
|
return K(() => {
|
|
2246
2246
|
W();
|
|
@@ -2248,7 +2248,7 @@ const Ke = ({ config: b }) => {
|
|
|
2248
2248
|
w.search,
|
|
2249
2249
|
w.rows_per_page,
|
|
2250
2250
|
w.current_page,
|
|
2251
|
-
|
|
2251
|
+
A
|
|
2252
2252
|
]), /* @__PURE__ */ e(
|
|
2253
2253
|
aa,
|
|
2254
2254
|
{
|
|
@@ -2284,11 +2284,11 @@ const Ke = ({ config: b }) => {
|
|
|
2284
2284
|
...d.pagination,
|
|
2285
2285
|
...v
|
|
2286
2286
|
},
|
|
2287
|
-
data:
|
|
2287
|
+
data: se,
|
|
2288
2288
|
setServerSidePaginationData: y,
|
|
2289
|
-
onMenuAction:
|
|
2289
|
+
onMenuAction: D,
|
|
2290
2290
|
filterConfig: g,
|
|
2291
|
-
onFilterApply:
|
|
2291
|
+
onFilterApply: ie,
|
|
2292
2292
|
loading: M
|
|
2293
2293
|
}
|
|
2294
2294
|
}
|
|
@@ -2300,19 +2300,19 @@ const Ke = ({ config: b }) => {
|
|
|
2300
2300
|
onClose: () => {
|
|
2301
2301
|
p || F(!1);
|
|
2302
2302
|
},
|
|
2303
|
-
icon: (ae =
|
|
2304
|
-
title: ((
|
|
2305
|
-
size: ((
|
|
2303
|
+
icon: (ae = t.addModal) == null ? void 0 : ae.icon,
|
|
2304
|
+
title: ((de = t.addModal) == null ? void 0 : de.title) || "Add New",
|
|
2305
|
+
size: ((ce = t.addModal) == null ? void 0 : ce.size) || "md",
|
|
2306
2306
|
onFormSubmit: () => {
|
|
2307
2307
|
var n;
|
|
2308
2308
|
return (n = document.querySelector("#addForm")) == null ? void 0 : n.requestSubmit();
|
|
2309
2309
|
},
|
|
2310
2310
|
loadingBtn: p,
|
|
2311
|
-
actionButtons:
|
|
2311
|
+
actionButtons: t.addModal.actionButtons,
|
|
2312
2312
|
children: /* @__PURE__ */ e(
|
|
2313
2313
|
Fe,
|
|
2314
2314
|
{
|
|
2315
|
-
config: (
|
|
2315
|
+
config: (t == null ? void 0 : t.addModal) || [],
|
|
2316
2316
|
onSubmit: J,
|
|
2317
2317
|
initialData: {},
|
|
2318
2318
|
type: "add",
|
|
@@ -2324,23 +2324,23 @@ const Ke = ({ config: b }) => {
|
|
|
2324
2324
|
/* @__PURE__ */ e(
|
|
2325
2325
|
ke,
|
|
2326
2326
|
{
|
|
2327
|
-
isOpen:
|
|
2327
|
+
isOpen: T,
|
|
2328
2328
|
onClose: () => {
|
|
2329
2329
|
p || L(!1);
|
|
2330
2330
|
},
|
|
2331
|
-
icon: (
|
|
2332
|
-
title: ((
|
|
2333
|
-
size: ((
|
|
2331
|
+
icon: (he = t.editModal) == null ? void 0 : he.icon,
|
|
2332
|
+
title: ((ue = t.editModal) == null ? void 0 : ue.title) || "Edit",
|
|
2333
|
+
size: ((be = t.editModal) == null ? void 0 : be.size) || "md",
|
|
2334
2334
|
onFormSubmit: () => {
|
|
2335
2335
|
var n;
|
|
2336
2336
|
return (n = document.querySelector("#editForm")) == null ? void 0 : n.requestSubmit();
|
|
2337
2337
|
},
|
|
2338
|
-
actionButtons:
|
|
2338
|
+
actionButtons: t.editModal.actionButtons,
|
|
2339
2339
|
loadingBtn: p,
|
|
2340
2340
|
children: /* @__PURE__ */ e(
|
|
2341
2341
|
Fe,
|
|
2342
2342
|
{
|
|
2343
|
-
config:
|
|
2343
|
+
config: t.editModal || [],
|
|
2344
2344
|
onSubmit: Q,
|
|
2345
2345
|
initialData: _,
|
|
2346
2346
|
type: "edit",
|
|
@@ -2356,35 +2356,35 @@ const Ke = ({ config: b }) => {
|
|
|
2356
2356
|
onClose: (n) => {
|
|
2357
2357
|
H(n);
|
|
2358
2358
|
},
|
|
2359
|
-
icon: ((ne =
|
|
2360
|
-
title: ((
|
|
2361
|
-
size: ((
|
|
2359
|
+
icon: ((ne = t.deleteModal) == null ? void 0 : ne.icon) || /* @__PURE__ */ e(re, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2360
|
+
title: ((pe = t.deleteModal) == null ? void 0 : pe.title) || "Confirm Delete",
|
|
2361
|
+
size: ((ge = t.deleteModal) == null ? void 0 : ge.size) || "md",
|
|
2362
2362
|
loading: p,
|
|
2363
|
-
actionButtons:
|
|
2363
|
+
actionButtons: t.deleteModal.actionButtons,
|
|
2364
2364
|
executeFunction: U,
|
|
2365
2365
|
selectedItem: _,
|
|
2366
2366
|
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ h("div", { children: [
|
|
2367
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((
|
|
2368
|
-
((
|
|
2367
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((me = t.deleteModal) == null ? void 0 : me.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2368
|
+
((fe = t.deleteModal) == null ? void 0 : fe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: _[(ye = t.deleteModal) == null ? void 0 : ye.referenceKey] })
|
|
2369
2369
|
] }) })
|
|
2370
2370
|
}
|
|
2371
2371
|
),
|
|
2372
|
-
|
|
2372
|
+
t.viewModal && /* @__PURE__ */ e(
|
|
2373
2373
|
ke,
|
|
2374
2374
|
{
|
|
2375
2375
|
isOpen: Y,
|
|
2376
2376
|
onClose: () => {
|
|
2377
2377
|
$(!1), z(null);
|
|
2378
2378
|
},
|
|
2379
|
-
icon: (
|
|
2380
|
-
title: ((le =
|
|
2381
|
-
size: ((
|
|
2382
|
-
footerConfig:
|
|
2383
|
-
children: (a =
|
|
2379
|
+
icon: (xe = t.viewModal) == null ? void 0 : xe.icon,
|
|
2380
|
+
title: ((le = t.viewModal) == null ? void 0 : le.title) || "View Details",
|
|
2381
|
+
size: ((oe = t.viewModal) == null ? void 0 : oe.size) || "lg",
|
|
2382
|
+
footerConfig: t == null ? void 0 : t.viewModal.footer,
|
|
2383
|
+
children: (a = t.viewModal) != null && a.component ? /* @__PURE__ */ e(t.viewModal.component, { data: _ }) : /* @__PURE__ */ e(
|
|
2384
2384
|
ba,
|
|
2385
2385
|
{
|
|
2386
2386
|
data: _,
|
|
2387
|
-
config:
|
|
2387
|
+
config: t.viewModal || {}
|
|
2388
2388
|
}
|
|
2389
2389
|
)
|
|
2390
2390
|
}
|
|
@@ -2392,137 +2392,137 @@ const Ke = ({ config: b }) => {
|
|
|
2392
2392
|
] })
|
|
2393
2393
|
}
|
|
2394
2394
|
);
|
|
2395
|
-
},
|
|
2396
|
-
value:
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2395
|
+
}, Ae = r.shape({
|
|
2396
|
+
value: r.oneOfType([
|
|
2397
|
+
r.string,
|
|
2398
|
+
r.number,
|
|
2399
|
+
r.bool
|
|
2400
2400
|
]).isRequired,
|
|
2401
|
-
label:
|
|
2402
|
-
color:
|
|
2403
|
-
}), Me =
|
|
2404
|
-
type:
|
|
2405
|
-
label:
|
|
2406
|
-
color:
|
|
2407
|
-
variant:
|
|
2408
|
-
onClick:
|
|
2409
|
-
}), pa =
|
|
2410
|
-
title:
|
|
2411
|
-
type:
|
|
2412
|
-
variant:
|
|
2413
|
-
icon:
|
|
2414
|
-
}), ga =
|
|
2415
|
-
key:
|
|
2416
|
-
title:
|
|
2417
|
-
type:
|
|
2418
|
-
imageKey:
|
|
2419
|
-
titleKey:
|
|
2420
|
-
subtitleKey:
|
|
2421
|
-
onClickDetails:
|
|
2422
|
-
variant:
|
|
2423
|
-
chipOptions:
|
|
2424
|
-
defaultColor:
|
|
2425
|
-
className:
|
|
2426
|
-
format:
|
|
2427
|
-
menuList:
|
|
2428
|
-
}), Ce =
|
|
2429
|
-
key:
|
|
2430
|
-
label:
|
|
2431
|
-
type:
|
|
2432
|
-
required:
|
|
2433
|
-
minLength:
|
|
2434
|
-
parentClass:
|
|
2435
|
-
search:
|
|
2436
|
-
multiple:
|
|
2437
|
-
dropdownMaxHeight:
|
|
2438
|
-
dragDrop:
|
|
2439
|
-
countriesList:
|
|
2440
|
-
defaultCountry:
|
|
2441
|
-
placeholder:
|
|
2442
|
-
rows:
|
|
2443
|
-
text:
|
|
2444
|
-
editorKey:
|
|
2445
|
-
options:
|
|
2446
|
-
}), ma =
|
|
2447
|
-
key:
|
|
2448
|
-
label:
|
|
2449
|
-
type:
|
|
2450
|
-
imageKey:
|
|
2451
|
-
titleKey:
|
|
2452
|
-
subtitleKey:
|
|
2453
|
-
blockClass:
|
|
2454
|
-
icon:
|
|
2455
|
-
variant:
|
|
2456
|
-
chipOptions:
|
|
2457
|
-
defaultColor:
|
|
2458
|
-
className:
|
|
2459
|
-
format:
|
|
2401
|
+
label: r.string.isRequired,
|
|
2402
|
+
color: r.string
|
|
2403
|
+
}), Me = r.shape({
|
|
2404
|
+
type: r.string.isRequired,
|
|
2405
|
+
label: r.string.isRequired,
|
|
2406
|
+
color: r.string,
|
|
2407
|
+
variant: r.string,
|
|
2408
|
+
onClick: r.func
|
|
2409
|
+
}), pa = r.shape({
|
|
2410
|
+
title: r.string.isRequired,
|
|
2411
|
+
type: r.string.isRequired,
|
|
2412
|
+
variant: r.string,
|
|
2413
|
+
icon: r.node
|
|
2414
|
+
}), ga = r.shape({
|
|
2415
|
+
key: r.string.isRequired,
|
|
2416
|
+
title: r.string,
|
|
2417
|
+
type: r.string,
|
|
2418
|
+
imageKey: r.string,
|
|
2419
|
+
titleKey: r.string,
|
|
2420
|
+
subtitleKey: r.string,
|
|
2421
|
+
onClickDetails: r.bool,
|
|
2422
|
+
variant: r.string,
|
|
2423
|
+
chipOptions: r.arrayOf(Ae),
|
|
2424
|
+
defaultColor: r.string,
|
|
2425
|
+
className: r.string,
|
|
2426
|
+
format: r.string,
|
|
2427
|
+
menuList: r.arrayOf(pa)
|
|
2428
|
+
}), Ce = r.shape({
|
|
2429
|
+
key: r.string.isRequired,
|
|
2430
|
+
label: r.string,
|
|
2431
|
+
type: r.string.isRequired,
|
|
2432
|
+
required: r.bool,
|
|
2433
|
+
minLength: r.number,
|
|
2434
|
+
parentClass: r.string,
|
|
2435
|
+
search: r.bool,
|
|
2436
|
+
multiple: r.bool,
|
|
2437
|
+
dropdownMaxHeight: r.string,
|
|
2438
|
+
dragDrop: r.bool,
|
|
2439
|
+
countriesList: r.bool,
|
|
2440
|
+
defaultCountry: r.string,
|
|
2441
|
+
placeholder: r.string,
|
|
2442
|
+
rows: r.number,
|
|
2443
|
+
text: r.string,
|
|
2444
|
+
editorKey: r.string,
|
|
2445
|
+
options: r.arrayOf(Ae)
|
|
2446
|
+
}), ma = r.shape({
|
|
2447
|
+
key: r.string,
|
|
2448
|
+
label: r.string,
|
|
2449
|
+
type: r.string,
|
|
2450
|
+
imageKey: r.string,
|
|
2451
|
+
titleKey: r.string,
|
|
2452
|
+
subtitleKey: r.string,
|
|
2453
|
+
blockClass: r.string,
|
|
2454
|
+
icon: r.node,
|
|
2455
|
+
variant: r.string,
|
|
2456
|
+
chipOptions: r.arrayOf(Ae),
|
|
2457
|
+
defaultColor: r.string,
|
|
2458
|
+
className: r.string,
|
|
2459
|
+
format: r.string
|
|
2460
2460
|
});
|
|
2461
2461
|
Ke.propTypes = {
|
|
2462
|
-
config:
|
|
2463
|
-
title:
|
|
2464
|
-
description:
|
|
2465
|
-
buttonText:
|
|
2466
|
-
fetchData:
|
|
2467
|
-
isStaticData:
|
|
2462
|
+
config: r.shape({
|
|
2463
|
+
title: r.string.isRequired,
|
|
2464
|
+
description: r.string,
|
|
2465
|
+
buttonText: r.string,
|
|
2466
|
+
fetchData: r.func.isRequired,
|
|
2467
|
+
isStaticData: r.bool,
|
|
2468
2468
|
/* ================= TABLE CONFIG ================= */
|
|
2469
|
-
tableConfig:
|
|
2470
|
-
table_head:
|
|
2471
|
-
search:
|
|
2472
|
-
enabled:
|
|
2473
|
-
useServerSideSearch:
|
|
2474
|
-
searchKeys:
|
|
2469
|
+
tableConfig: r.shape({
|
|
2470
|
+
table_head: r.arrayOf(ga).isRequired,
|
|
2471
|
+
search: r.shape({
|
|
2472
|
+
enabled: r.bool,
|
|
2473
|
+
useServerSideSearch: r.bool,
|
|
2474
|
+
searchKeys: r.arrayOf(r.string)
|
|
2475
2475
|
}),
|
|
2476
|
-
pagination:
|
|
2477
|
-
enabled:
|
|
2478
|
-
useServerSidePagination:
|
|
2476
|
+
pagination: r.shape({
|
|
2477
|
+
enabled: r.bool,
|
|
2478
|
+
useServerSidePagination: r.bool
|
|
2479
2479
|
}),
|
|
2480
|
-
filter:
|
|
2481
|
-
enabled:
|
|
2482
|
-
useServerSideFilters:
|
|
2480
|
+
filter: r.shape({
|
|
2481
|
+
enabled: r.bool,
|
|
2482
|
+
useServerSideFilters: r.bool
|
|
2483
2483
|
})
|
|
2484
2484
|
}).isRequired,
|
|
2485
2485
|
/* ================= MODAL CONFIG ================= */
|
|
2486
|
-
modalConfig:
|
|
2487
|
-
addModal:
|
|
2488
|
-
title:
|
|
2489
|
-
size:
|
|
2490
|
-
formClass:
|
|
2491
|
-
formFields:
|
|
2492
|
-
handleSubmit:
|
|
2493
|
-
actionButtons:
|
|
2486
|
+
modalConfig: r.shape({
|
|
2487
|
+
addModal: r.shape({
|
|
2488
|
+
title: r.string.isRequired,
|
|
2489
|
+
size: r.string,
|
|
2490
|
+
formClass: r.string,
|
|
2491
|
+
formFields: r.arrayOf(Ce),
|
|
2492
|
+
handleSubmit: r.func.isRequired,
|
|
2493
|
+
actionButtons: r.arrayOf(Me)
|
|
2494
2494
|
}),
|
|
2495
|
-
editModal:
|
|
2496
|
-
title:
|
|
2497
|
-
size:
|
|
2498
|
-
formClass:
|
|
2499
|
-
formFields:
|
|
2500
|
-
handleSubmit:
|
|
2501
|
-
actionButtons:
|
|
2495
|
+
editModal: r.shape({
|
|
2496
|
+
title: r.string.isRequired,
|
|
2497
|
+
size: r.string,
|
|
2498
|
+
formClass: r.string,
|
|
2499
|
+
formFields: r.arrayOf(Ce),
|
|
2500
|
+
handleSubmit: r.func.isRequired,
|
|
2501
|
+
actionButtons: r.arrayOf(Me)
|
|
2502
2502
|
}),
|
|
2503
|
-
deleteModal:
|
|
2504
|
-
title:
|
|
2505
|
-
size:
|
|
2506
|
-
confirmText:
|
|
2507
|
-
referenceKey:
|
|
2508
|
-
actionButtons:
|
|
2503
|
+
deleteModal: r.shape({
|
|
2504
|
+
title: r.string.isRequired,
|
|
2505
|
+
size: r.string,
|
|
2506
|
+
confirmText: r.string,
|
|
2507
|
+
referenceKey: r.string,
|
|
2508
|
+
actionButtons: r.arrayOf(Me)
|
|
2509
2509
|
}),
|
|
2510
|
-
viewModal:
|
|
2511
|
-
title:
|
|
2512
|
-
size:
|
|
2510
|
+
viewModal: r.shape({
|
|
2511
|
+
title: r.string.isRequired,
|
|
2512
|
+
size: r.string,
|
|
2513
2513
|
// 👇 This covers your commented code:
|
|
2514
|
-
component:
|
|
2514
|
+
component: r.elementType,
|
|
2515
2515
|
// for custom component like TeamMemberDetail
|
|
2516
|
-
fields:
|
|
2517
|
-
footer:
|
|
2518
|
-
cancelButton:
|
|
2519
|
-
cancelText:
|
|
2516
|
+
fields: r.arrayOf(ma),
|
|
2517
|
+
footer: r.shape({
|
|
2518
|
+
cancelButton: r.bool,
|
|
2519
|
+
cancelText: r.string
|
|
2520
2520
|
})
|
|
2521
2521
|
})
|
|
2522
2522
|
}),
|
|
2523
2523
|
/* ================= FILTER CONFIG ================= */
|
|
2524
|
-
filterConfig:
|
|
2525
|
-
fields:
|
|
2524
|
+
filterConfig: r.shape({
|
|
2525
|
+
fields: r.arrayOf(Ce)
|
|
2526
2526
|
})
|
|
2527
2527
|
}).isRequired
|
|
2528
2528
|
};
|