react-admin-crud-manager 1.0.16 → 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 +9 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +153 -149
- 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,40 +124,44 @@ const Qe = ({
|
|
|
124
124
|
dropdownMaxHeight: m = ""
|
|
125
125
|
}) => {
|
|
126
126
|
var A;
|
|
127
|
-
const [u, x] = R(!1), [w, S] = R(""), [
|
|
128
|
-
let
|
|
129
|
-
const f = (v) => v == null || v === "" ? "" : String(typeof v == "boolean" ? v : v ?? ""), N = p ? (
|
|
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
130
|
(v) => v.label.toLowerCase().includes(w.toLowerCase())
|
|
131
131
|
), D = (v) => {
|
|
132
|
-
const
|
|
133
|
-
return p ? N.includes(
|
|
132
|
+
const H = f(v);
|
|
133
|
+
return p ? N.includes(H) : H === N;
|
|
134
134
|
};
|
|
135
|
-
|
|
136
|
-
const v = (
|
|
137
|
-
M.current && !M.current.contains(
|
|
135
|
+
z(() => {
|
|
136
|
+
const v = (H) => {
|
|
137
|
+
M.current && !M.current.contains(H.target) && (x(!1), S(""));
|
|
138
138
|
};
|
|
139
139
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
140
|
-
}, []),
|
|
140
|
+
}, []), z(() => {
|
|
141
141
|
if (u && M.current) {
|
|
142
142
|
const v = M.current.getBoundingClientRect(), Z = window.innerHeight - v.bottom;
|
|
143
|
-
|
|
143
|
+
I(Z < 200);
|
|
144
144
|
}
|
|
145
|
-
}, [u]),
|
|
146
|
-
u &&
|
|
145
|
+
}, [u]), z(() => {
|
|
146
|
+
u && j.current && j.current.focus();
|
|
147
147
|
}, [u]);
|
|
148
148
|
const F = (v) => {
|
|
149
|
-
let
|
|
150
|
-
if (v === "true" ?
|
|
149
|
+
let H = v;
|
|
150
|
+
if (v === "true" ? H = !0 : v === "false" && (H = !1), p) {
|
|
151
151
|
const Z = N.includes(f(v));
|
|
152
152
|
let W;
|
|
153
153
|
Z ? W = n.filter(
|
|
154
154
|
(re) => f(re) !== f(v)
|
|
155
|
-
) : W = [...n || [],
|
|
155
|
+
) : W = [...n || [], H], i(W);
|
|
156
156
|
} else
|
|
157
|
-
i(
|
|
157
|
+
i(H), x(!1);
|
|
158
158
|
S("");
|
|
159
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
|
|
160
|
+
return z(() => {
|
|
161
|
+
(E || E === !1) && setTimeout(() => {
|
|
162
|
+
i(E);
|
|
163
|
+
}, 100);
|
|
164
|
+
}, []), /* @__PURE__ */ c("div", { className: d || "col-span-12", children: [
|
|
161
165
|
/* @__PURE__ */ e(q, { label: L, required: b }),
|
|
162
166
|
/* @__PURE__ */ c("div", { className: `relative ${l}`, ref: M, children: [
|
|
163
167
|
/* @__PURE__ */ e(
|
|
@@ -183,7 +187,7 @@ const Qe = ({
|
|
|
183
187
|
children: [
|
|
184
188
|
/* @__PURE__ */ e("span", { className: "truncate", children: U || s }),
|
|
185
189
|
/* @__PURE__ */ e(
|
|
186
|
-
|
|
190
|
+
Te,
|
|
187
191
|
{
|
|
188
192
|
className: `w-4 h-4 transition-transform ${u ? "rotate-180" : ""}`
|
|
189
193
|
}
|
|
@@ -195,14 +199,14 @@ const Qe = ({
|
|
|
195
199
|
"div",
|
|
196
200
|
{
|
|
197
201
|
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
198
|
-
${
|
|
202
|
+
${$ ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
199
203
|
children: [
|
|
200
204
|
C && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
201
205
|
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
202
206
|
/* @__PURE__ */ e(
|
|
203
207
|
"input",
|
|
204
208
|
{
|
|
205
|
-
ref:
|
|
209
|
+
ref: j,
|
|
206
210
|
type: "text",
|
|
207
211
|
value: w,
|
|
208
212
|
onChange: (v) => S(v.target.value),
|
|
@@ -254,7 +258,7 @@ const Qe = ({
|
|
|
254
258
|
{ label: "Active", value: !0 },
|
|
255
259
|
{ label: "Inactive", value: !1 }
|
|
256
260
|
];
|
|
257
|
-
return /* @__PURE__ */ e(
|
|
261
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
258
262
|
/* @__PURE__ */ e(q, { label: s, required: l }),
|
|
259
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: [
|
|
260
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,8 +554,8 @@ function ea({
|
|
|
550
554
|
}) {
|
|
551
555
|
const d = (N) => me.find((O) => O.code == N), [p, m] = R(
|
|
552
556
|
d(y) || me[0]
|
|
553
|
-
), [u, x] = R(""), [w, S] = R(!1), [
|
|
554
|
-
|
|
557
|
+
), [u, x] = R(""), [w, S] = R(!1), [$, I] = R(""), M = X();
|
|
558
|
+
z(() => {
|
|
555
559
|
if (typeof n == "string" && n.startsWith("+")) {
|
|
556
560
|
const N = me.filter((O) => n.startsWith("+" + O.phone)).sort((O, D) => D.phone.length - O.phone.length)[0];
|
|
557
561
|
if (N) {
|
|
@@ -561,22 +565,22 @@ function ea({
|
|
|
561
565
|
}
|
|
562
566
|
x(n);
|
|
563
567
|
}, [n]);
|
|
564
|
-
const
|
|
568
|
+
const j = (N) => {
|
|
565
569
|
const O = N.target.value.replace(/\D/g, "");
|
|
566
570
|
x(O), p && s && s("+" + p.phone + O);
|
|
567
|
-
},
|
|
568
|
-
m(N), s && s("+" + N.phone + u), S(!1),
|
|
571
|
+
}, E = (N) => {
|
|
572
|
+
m(N), s && s("+" + N.phone + u), S(!1), I("");
|
|
569
573
|
};
|
|
570
|
-
|
|
574
|
+
z(() => {
|
|
571
575
|
const N = (O) => {
|
|
572
576
|
M.current && !M.current.contains(O.target) && S(!1);
|
|
573
577
|
};
|
|
574
578
|
return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
|
|
575
579
|
}, []);
|
|
576
580
|
const f = me.filter(
|
|
577
|
-
(N) => N.label.toLowerCase().includes(
|
|
581
|
+
(N) => N.label.toLowerCase().includes($.toLowerCase()) || N.phone.includes($)
|
|
578
582
|
);
|
|
579
|
-
return b ? /* @__PURE__ */ e(
|
|
583
|
+
return b ? /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
580
584
|
/* @__PURE__ */ e(q, { label: h, required: r }),
|
|
581
585
|
/* @__PURE__ */ c("div", { className: "relative ", ref: M, children: [
|
|
582
586
|
/* @__PURE__ */ c(
|
|
@@ -602,7 +606,7 @@ function ea({
|
|
|
602
606
|
className: "w-5 h-3 object-cover"
|
|
603
607
|
}
|
|
604
608
|
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
605
|
-
/* @__PURE__ */ e(
|
|
609
|
+
/* @__PURE__ */ e(Te, { className: "w-3 h-3 text-gray-500" })
|
|
606
610
|
]
|
|
607
611
|
}
|
|
608
612
|
),
|
|
@@ -615,7 +619,7 @@ function ea({
|
|
|
615
619
|
{
|
|
616
620
|
type: "tel",
|
|
617
621
|
value: u,
|
|
618
|
-
onChange:
|
|
622
|
+
onChange: j,
|
|
619
623
|
required: r,
|
|
620
624
|
disabled: l || !p,
|
|
621
625
|
placeholder: p ? C : "Select a country",
|
|
@@ -648,8 +652,8 @@ function ea({
|
|
|
648
652
|
"input",
|
|
649
653
|
{
|
|
650
654
|
type: "text",
|
|
651
|
-
value:
|
|
652
|
-
onChange: (N) =>
|
|
655
|
+
value: $,
|
|
656
|
+
onChange: (N) => I(N.target.value),
|
|
653
657
|
placeholder: "Search country...",
|
|
654
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 "
|
|
655
659
|
}
|
|
@@ -659,7 +663,7 @@ function ea({
|
|
|
659
663
|
"button",
|
|
660
664
|
{
|
|
661
665
|
type: "button",
|
|
662
|
-
onClick: () =>
|
|
666
|
+
onClick: () => E(N),
|
|
663
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",
|
|
664
668
|
children: [
|
|
665
669
|
/* @__PURE__ */ e(
|
|
@@ -682,7 +686,7 @@ function ea({
|
|
|
682
686
|
))
|
|
683
687
|
] })
|
|
684
688
|
] })
|
|
685
|
-
] }, o) }) : /* @__PURE__ */ e(
|
|
689
|
+
] }, o) }) : /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
686
690
|
/* @__PURE__ */ e(q, { label: h, required: r }),
|
|
687
691
|
/* @__PURE__ */ e(
|
|
688
692
|
"input",
|
|
@@ -711,7 +715,7 @@ const Fe = Ce.forwardRef(
|
|
|
711
715
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
712
716
|
${h}
|
|
713
717
|
`.trim();
|
|
714
|
-
return /* @__PURE__ */ e(
|
|
718
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: i.parentClass || "col-span-12", children: [
|
|
715
719
|
/* @__PURE__ */ e(q, { label: n, required: o }),
|
|
716
720
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
717
721
|
"textarea",
|
|
@@ -738,26 +742,26 @@ const aa = ({
|
|
|
738
742
|
parentClass: L = ""
|
|
739
743
|
}) => {
|
|
740
744
|
const [b, y] = R(n), [d, p] = R(!1), m = X(null);
|
|
741
|
-
|
|
745
|
+
z(() => (n instanceof File ? y({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, y(n)), () => {
|
|
742
746
|
b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview);
|
|
743
747
|
}), [n]);
|
|
744
748
|
const u = (M) => {
|
|
745
749
|
if (!M || M.length === 0)
|
|
746
750
|
return;
|
|
747
|
-
const
|
|
748
|
-
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);
|
|
749
753
|
}, x = (M) => {
|
|
750
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 = "");
|
|
751
755
|
}, w = (M) => {
|
|
752
756
|
r && (M.preventDefault(), p(!0));
|
|
753
757
|
}, S = (M) => {
|
|
754
758
|
r && (M.preventDefault(), p(!1));
|
|
755
|
-
},
|
|
759
|
+
}, $ = (M) => {
|
|
756
760
|
r && (M.preventDefault(), p(!1), u(M.dataTransfer.files));
|
|
757
|
-
},
|
|
761
|
+
}, I = () => {
|
|
758
762
|
m.current.click();
|
|
759
763
|
};
|
|
760
|
-
return /* @__PURE__ */ e(
|
|
764
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
761
765
|
/* @__PURE__ */ e(q, { label: h, required: i }),
|
|
762
766
|
/* @__PURE__ */ c(
|
|
763
767
|
"div",
|
|
@@ -765,7 +769,7 @@ const aa = ({
|
|
|
765
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"}`,
|
|
766
770
|
onDragOver: w,
|
|
767
771
|
onDragLeave: S,
|
|
768
|
-
onDrop:
|
|
772
|
+
onDrop: $,
|
|
769
773
|
children: [
|
|
770
774
|
/* @__PURE__ */ e(
|
|
771
775
|
"input",
|
|
@@ -821,7 +825,7 @@ const aa = ({
|
|
|
821
825
|
Q,
|
|
822
826
|
{
|
|
823
827
|
type: "button",
|
|
824
|
-
onClick:
|
|
828
|
+
onClick: I,
|
|
825
829
|
variant: "outlined",
|
|
826
830
|
color: "default",
|
|
827
831
|
children: b ? "Change Image" : "Select Image"
|
|
@@ -870,7 +874,7 @@ const aa = ({
|
|
|
870
874
|
${s === "number" ? "no-spinner" : ""}
|
|
871
875
|
${i}
|
|
872
876
|
`.trim();
|
|
873
|
-
return /* @__PURE__ */ e(
|
|
877
|
+
return /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: o || "col-span-12", children: [
|
|
874
878
|
/* @__PURE__ */ e(q, { label: h, required: n }),
|
|
875
879
|
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
876
880
|
/* @__PURE__ */ e(
|
|
@@ -939,15 +943,15 @@ const ra = ({
|
|
|
939
943
|
branding: !1,
|
|
940
944
|
statusbar: !0,
|
|
941
945
|
automatic_uploads: !0,
|
|
942
|
-
images_upload_handler: (M) => new Promise((
|
|
946
|
+
images_upload_handler: (M) => new Promise((j, E) => {
|
|
943
947
|
if (!w) {
|
|
944
|
-
|
|
948
|
+
j(`data:${M.blob().type};base64,${M.base64()}`);
|
|
945
949
|
return;
|
|
946
950
|
}
|
|
947
951
|
w(M).then((f) => {
|
|
948
|
-
f ?
|
|
952
|
+
f ? j(f) : E("Upload failed: No URL returned");
|
|
949
953
|
}).catch((f) => {
|
|
950
|
-
|
|
954
|
+
E(
|
|
951
955
|
typeof f == "string" ? f : (f == null ? void 0 : f.message) || "Image upload failed"
|
|
952
956
|
);
|
|
953
957
|
});
|
|
@@ -1018,7 +1022,7 @@ const ra = ({
|
|
|
1018
1022
|
s(w, h);
|
|
1019
1023
|
}
|
|
1020
1024
|
};
|
|
1021
|
-
return y ? /* @__PURE__ */ e(
|
|
1025
|
+
return y ? /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c("div", { className: `${C}`, children: [
|
|
1022
1026
|
/* @__PURE__ */ e(q, { label: n, required: r }),
|
|
1023
1027
|
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: o.map((u, x) => /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1024
1028
|
/* @__PURE__ */ e(
|
|
@@ -1080,7 +1084,7 @@ const ra = ({
|
|
|
1080
1084
|
buttonProps: y = {}
|
|
1081
1085
|
}) => {
|
|
1082
1086
|
const [d, p] = R(null), [m, u] = R(!1), x = X(null);
|
|
1083
|
-
|
|
1087
|
+
z(() => {
|
|
1084
1088
|
if (!n) {
|
|
1085
1089
|
w(), p(null);
|
|
1086
1090
|
return;
|
|
@@ -1099,15 +1103,15 @@ const ra = ({
|
|
|
1099
1103
|
return;
|
|
1100
1104
|
const N = f[0], O = URL.createObjectURL(N);
|
|
1101
1105
|
w(), p({ file: N, preview: O }), o == null || o(N);
|
|
1102
|
-
},
|
|
1106
|
+
}, $ = (f) => {
|
|
1103
1107
|
f && f.stopPropagation(), w(), p(null), o == null || o(null), x.current && (x.current.value = "");
|
|
1104
|
-
},
|
|
1108
|
+
}, I = (f) => {
|
|
1105
1109
|
r && (f.preventDefault(), u(!0));
|
|
1106
1110
|
}, M = (f) => {
|
|
1107
1111
|
r && (f.preventDefault(), u(!1));
|
|
1108
|
-
},
|
|
1112
|
+
}, j = (f) => {
|
|
1109
1113
|
r && (f.preventDefault(), u(!1), S(f.dataTransfer.files));
|
|
1110
|
-
},
|
|
1114
|
+
}, E = () => {
|
|
1111
1115
|
x.current.click();
|
|
1112
1116
|
};
|
|
1113
1117
|
return /* @__PURE__ */ c("div", { className: L || "col-span-12", children: [
|
|
@@ -1116,9 +1120,9 @@ const ra = ({
|
|
|
1116
1120
|
"div",
|
|
1117
1121
|
{
|
|
1118
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"}`,
|
|
1119
|
-
onDragOver:
|
|
1123
|
+
onDragOver: I,
|
|
1120
1124
|
onDragLeave: M,
|
|
1121
|
-
onDrop:
|
|
1125
|
+
onDrop: j,
|
|
1122
1126
|
children: [
|
|
1123
1127
|
/* @__PURE__ */ e(
|
|
1124
1128
|
"input",
|
|
@@ -1144,7 +1148,7 @@ const ra = ({
|
|
|
1144
1148
|
"button",
|
|
1145
1149
|
{
|
|
1146
1150
|
type: "button",
|
|
1147
|
-
onClick:
|
|
1151
|
+
onClick: $,
|
|
1148
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",
|
|
1149
1153
|
"aria-label": "Remove audio",
|
|
1150
1154
|
children: /* @__PURE__ */ e(le, { icon: "mdi:close", className: "w-3 h-3" })
|
|
@@ -1152,7 +1156,7 @@ const ra = ({
|
|
|
1152
1156
|
),
|
|
1153
1157
|
/* @__PURE__ */ e("audio", { src: d.preview, controls: !0 }, d.preview)
|
|
1154
1158
|
] }),
|
|
1155
|
-
/* @__PURE__ */ e(Q, { type: "button", onClick:
|
|
1159
|
+
/* @__PURE__ */ e(Q, { type: "button", onClick: E, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1156
1160
|
] })
|
|
1157
1161
|
) : (
|
|
1158
1162
|
// Empty state with upload button
|
|
@@ -1162,7 +1166,7 @@ const ra = ({
|
|
|
1162
1166
|
Q,
|
|
1163
1167
|
{
|
|
1164
1168
|
type: "button",
|
|
1165
|
-
onClick:
|
|
1169
|
+
onClick: E,
|
|
1166
1170
|
variant: "outlined",
|
|
1167
1171
|
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1168
1172
|
}
|
|
@@ -1194,11 +1198,11 @@ const ra = ({
|
|
|
1194
1198
|
dragDrop: x,
|
|
1195
1199
|
parentClass: w,
|
|
1196
1200
|
countriesList: S,
|
|
1197
|
-
defaultCountry:
|
|
1198
|
-
multiple:
|
|
1201
|
+
defaultCountry: $,
|
|
1202
|
+
multiple: I,
|
|
1199
1203
|
dropdownMaxHeight: M,
|
|
1200
|
-
editorKey:
|
|
1201
|
-
fontFamily:
|
|
1204
|
+
editorKey: j,
|
|
1205
|
+
fontFamily: E,
|
|
1202
1206
|
disabled: f,
|
|
1203
1207
|
negativeNumberAllow: N,
|
|
1204
1208
|
defaultValue: O
|
|
@@ -1223,7 +1227,7 @@ const ra = ({
|
|
|
1223
1227
|
name: i,
|
|
1224
1228
|
disabled: f,
|
|
1225
1229
|
parentClass: w,
|
|
1226
|
-
multiple:
|
|
1230
|
+
multiple: I,
|
|
1227
1231
|
dropdownMaxHeight: M
|
|
1228
1232
|
}
|
|
1229
1233
|
);
|
|
@@ -1239,7 +1243,7 @@ const ra = ({
|
|
|
1239
1243
|
required: m,
|
|
1240
1244
|
parentClass: w,
|
|
1241
1245
|
className: b || "",
|
|
1242
|
-
multiSelect:
|
|
1246
|
+
multiSelect: I,
|
|
1243
1247
|
disabled: f
|
|
1244
1248
|
}
|
|
1245
1249
|
);
|
|
@@ -1265,7 +1269,7 @@ const ra = ({
|
|
|
1265
1269
|
value: D,
|
|
1266
1270
|
onChange: (A) => o(i, A),
|
|
1267
1271
|
countriesList: S,
|
|
1268
|
-
defaultCountry:
|
|
1272
|
+
defaultCountry: $,
|
|
1269
1273
|
required: m,
|
|
1270
1274
|
placeholder: F,
|
|
1271
1275
|
search: y,
|
|
@@ -1331,8 +1335,8 @@ const ra = ({
|
|
|
1331
1335
|
placeholder: F,
|
|
1332
1336
|
label: s,
|
|
1333
1337
|
parentClass: w,
|
|
1334
|
-
fontFamily:
|
|
1335
|
-
editorKey:
|
|
1338
|
+
fontFamily: E,
|
|
1339
|
+
editorKey: j,
|
|
1336
1340
|
disabled: f
|
|
1337
1341
|
},
|
|
1338
1342
|
`editor-${i}`
|
|
@@ -1365,7 +1369,7 @@ const ra = ({
|
|
|
1365
1369
|
}, L = () => {
|
|
1366
1370
|
l({}), i == null || i({}), n();
|
|
1367
1371
|
};
|
|
1368
|
-
return /* @__PURE__ */ c(
|
|
1372
|
+
return /* @__PURE__ */ c(G, { children: [
|
|
1369
1373
|
/* @__PURE__ */ e(
|
|
1370
1374
|
"div",
|
|
1371
1375
|
{
|
|
@@ -1392,7 +1396,7 @@ const ra = ({
|
|
|
1392
1396
|
}
|
|
1393
1397
|
)
|
|
1394
1398
|
] }),
|
|
1395
|
-
/* @__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(
|
|
1396
1400
|
Ee,
|
|
1397
1401
|
{
|
|
1398
1402
|
field: y,
|
|
@@ -1477,7 +1481,7 @@ const ra = ({
|
|
|
1477
1481
|
children: h
|
|
1478
1482
|
}
|
|
1479
1483
|
);
|
|
1480
|
-
}, oa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ c(
|
|
1484
|
+
}, oa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ c(G, { children: [
|
|
1481
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" }) }),
|
|
1482
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: [
|
|
1483
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)) }) }),
|
|
@@ -1492,14 +1496,14 @@ const ra = ({
|
|
|
1492
1496
|
] }) })
|
|
1493
1497
|
] }), Ge = ({ src: h, alt: n = "preview", isOpen: o, setIsOpen: i }) => {
|
|
1494
1498
|
const s = () => i(!1);
|
|
1495
|
-
return
|
|
1499
|
+
return z(() => {
|
|
1496
1500
|
const l = (r) => {
|
|
1497
1501
|
r.key === "Escape" && s();
|
|
1498
1502
|
};
|
|
1499
1503
|
return o && (document.body.style.overflow = "hidden", document.addEventListener("keydown", l)), () => {
|
|
1500
1504
|
document.body.style.overflow = "", document.removeEventListener("keydown", l);
|
|
1501
1505
|
};
|
|
1502
|
-
}, [o]), /* @__PURE__ */ e(
|
|
1506
|
+
}, [o]), /* @__PURE__ */ e(G, { children: /* @__PURE__ */ c(
|
|
1503
1507
|
"div",
|
|
1504
1508
|
{
|
|
1505
1509
|
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
@@ -1558,7 +1562,7 @@ const ra = ({
|
|
|
1558
1562
|
},
|
|
1559
1563
|
onFilterApply: y,
|
|
1560
1564
|
filterConfig: d = null
|
|
1561
|
-
} = h, [p, m] = R(""), [u, x] = R(null), [w, S] = R([]), [
|
|
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(() => {
|
|
1562
1566
|
if (r.useServerSidePagination) return D;
|
|
1563
1567
|
const t = (F - 1) * A;
|
|
1564
1568
|
return D.slice(t, t + A);
|
|
@@ -1574,20 +1578,20 @@ const ra = ({
|
|
|
1574
1578
|
console.error("Search error:", g);
|
|
1575
1579
|
}
|
|
1576
1580
|
}, 800));
|
|
1577
|
-
}, xe = (t, g,
|
|
1578
|
-
|
|
1579
|
-
}, ve = (t, g,
|
|
1580
|
-
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);
|
|
1581
1585
|
const K = g.currentTarget;
|
|
1582
1586
|
se.current[t] = K;
|
|
1583
|
-
const _ = K.getBoundingClientRect(), J = 192, V =
|
|
1584
|
-
|
|
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({
|
|
1585
1589
|
top: Math.max(8, Math.min(Y, k - V - 8)),
|
|
1586
1590
|
left: Math.max(8, Math.min(B, ee - J - 8))
|
|
1587
1591
|
}), x(u === t ? null : t);
|
|
1588
1592
|
}, we = (t) => (F - 1) * A + t + 1, de = (t) => {
|
|
1589
1593
|
f(t), O(!0);
|
|
1590
|
-
}, ie = (t, g,
|
|
1594
|
+
}, ie = (t, g, T, K = null) => /* @__PURE__ */ e(G, { children: t ? /* @__PURE__ */ e(
|
|
1591
1595
|
"img",
|
|
1592
1596
|
{
|
|
1593
1597
|
src: t,
|
|
@@ -1595,26 +1599,26 @@ const ra = ({
|
|
|
1595
1599
|
onClick: (_) => {
|
|
1596
1600
|
_.stopPropagation(), _.preventDefault(), de({ src: t, alt: g });
|
|
1597
1601
|
},
|
|
1598
|
-
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 || ""}`
|
|
1599
1603
|
}
|
|
1600
|
-
) : /* @__PURE__ */ e(
|
|
1604
|
+
) : /* @__PURE__ */ e(G, { children: K || /* @__PURE__ */ e(
|
|
1601
1605
|
"div",
|
|
1602
1606
|
{
|
|
1603
|
-
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 ${
|
|
1604
|
-
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" })
|
|
1605
1609
|
}
|
|
1606
|
-
) }) }), ce = (t, g) => /* @__PURE__ */ e(
|
|
1610
|
+
) }) }), ce = (t, g) => /* @__PURE__ */ e(G, { children: t ? /* @__PURE__ */ e(
|
|
1607
1611
|
"audio",
|
|
1608
1612
|
{
|
|
1609
1613
|
controls: !0,
|
|
1610
1614
|
src: t,
|
|
1611
|
-
onClick: (
|
|
1612
|
-
|
|
1615
|
+
onClick: (T) => {
|
|
1616
|
+
T.stopPropagation();
|
|
1613
1617
|
},
|
|
1614
1618
|
className: `w-64 cursor-pointer ${g || ""}`
|
|
1615
1619
|
},
|
|
1616
1620
|
t
|
|
1617
|
-
) : /* @__PURE__ */ e(
|
|
1621
|
+
) : /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
1618
1622
|
"div",
|
|
1619
1623
|
{
|
|
1620
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 || ""}`,
|
|
@@ -1628,23 +1632,23 @@ const ra = ({
|
|
|
1628
1632
|
] })
|
|
1629
1633
|
] }), ue = (t, g) => {
|
|
1630
1634
|
var J;
|
|
1631
|
-
let
|
|
1635
|
+
let T = String(t);
|
|
1632
1636
|
const K = g.variant || "contained";
|
|
1633
1637
|
let _ = g.defaultColor;
|
|
1634
1638
|
if (((J = g == null ? void 0 : g.chipOptions) == null ? void 0 : J.length) > 0) {
|
|
1635
1639
|
let V = g == null ? void 0 : g.chipOptions.find((ee) => ee.value == t);
|
|
1636
|
-
V && (
|
|
1640
|
+
V && (T = V.label, _ = V.color);
|
|
1637
1641
|
}
|
|
1638
1642
|
return /* @__PURE__ */ e(
|
|
1639
1643
|
$e,
|
|
1640
1644
|
{
|
|
1641
|
-
label:
|
|
1645
|
+
label: T,
|
|
1642
1646
|
variant: K,
|
|
1643
1647
|
color: _,
|
|
1644
1648
|
className: g.className || ""
|
|
1645
1649
|
}
|
|
1646
1650
|
);
|
|
1647
|
-
}, be = (t, g,
|
|
1651
|
+
}, be = (t, g, T) => {
|
|
1648
1652
|
const K = g[t.key];
|
|
1649
1653
|
return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
|
|
1650
1654
|
"button",
|
|
@@ -1654,32 +1658,32 @@ const ra = ({
|
|
|
1654
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",
|
|
1655
1659
|
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
1656
1660
|
}
|
|
1657
|
-
) }) : 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" });
|
|
1658
1662
|
}, pe = (t, g) => {
|
|
1659
1663
|
if (t.onClickDetails)
|
|
1660
1664
|
return L == null ? void 0 : L("view", g);
|
|
1661
1665
|
if (typeof t.handleClick == "function")
|
|
1662
1666
|
return t.handleClick(g);
|
|
1663
1667
|
}, ge = (t) => t.onClickDetails || typeof t.handleClick == "function";
|
|
1664
|
-
return
|
|
1668
|
+
return z(() => {
|
|
1665
1669
|
const t = () => {
|
|
1666
1670
|
u && x(null);
|
|
1667
1671
|
};
|
|
1668
1672
|
return window.addEventListener("scroll", t, !0), () => {
|
|
1669
1673
|
window.removeEventListener("scroll", t, !0);
|
|
1670
1674
|
};
|
|
1671
|
-
}, [u]),
|
|
1675
|
+
}, [u]), z(() => {
|
|
1672
1676
|
const t = (g) => {
|
|
1673
1677
|
ne.current && !ne.current.contains(g.target) && x(null);
|
|
1674
1678
|
};
|
|
1675
1679
|
return document.addEventListener("click", t), () => document.removeEventListener("click", t);
|
|
1676
|
-
}, []),
|
|
1680
|
+
}, []), z(() => {
|
|
1677
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);
|
|
1678
1682
|
}, [
|
|
1679
1683
|
r.rows_per_page,
|
|
1680
1684
|
r == null ? void 0 : r.useServerSidePagination,
|
|
1681
1685
|
r.current_page
|
|
1682
|
-
]),
|
|
1686
|
+
]), z(() => {
|
|
1683
1687
|
Z(
|
|
1684
1688
|
r != null && r.useServerSidePagination ? r.total_records : D.length
|
|
1685
1689
|
), D.length <= A * (F - 1) && !(r != null && r.useServerSidePagination) && U((t) => t - 1 || 1);
|
|
@@ -1687,7 +1691,7 @@ const ra = ({
|
|
|
1687
1691
|
D.length,
|
|
1688
1692
|
r.total_records,
|
|
1689
1693
|
r == null ? void 0 : r.useServerSidePagination
|
|
1690
|
-
]), i ? /* @__PURE__ */ e(oa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c(
|
|
1694
|
+
]), i ? /* @__PURE__ */ e(oa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c(G, { children: [
|
|
1691
1695
|
/* @__PURE__ */ c("div", { className: "flex justify-end items-center mb-4 gap-2", children: [
|
|
1692
1696
|
s.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ c("div", { className: "relative min-w-[300px]", children: [
|
|
1693
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" }),
|
|
@@ -1702,7 +1706,7 @@ const ra = ({
|
|
|
1702
1706
|
}
|
|
1703
1707
|
)
|
|
1704
1708
|
] }) }),
|
|
1705
|
-
d && l.enabled && /* @__PURE__ */ c(Q, { onClick: () =>
|
|
1709
|
+
d && l.enabled && /* @__PURE__ */ c(Q, { onClick: () => j(!0), variant: "contained", children: [
|
|
1706
1710
|
/* @__PURE__ */ e(Ke, { className: "w-4 h-4 mr-2" }),
|
|
1707
1711
|
"Filters"
|
|
1708
1712
|
] })
|
|
@@ -1728,15 +1732,15 @@ const ra = ({
|
|
|
1728
1732
|
"tr",
|
|
1729
1733
|
{
|
|
1730
1734
|
className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
|
|
1731
|
-
children: o.map((
|
|
1735
|
+
children: o.map((T) => /* @__PURE__ */ e(
|
|
1732
1736
|
"td",
|
|
1733
1737
|
{
|
|
1734
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${
|
|
1735
|
-
title: String(t[
|
|
1736
|
-
onClick: () => pe(
|
|
1737
|
-
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)
|
|
1738
1742
|
},
|
|
1739
|
-
|
|
1743
|
+
T.key
|
|
1740
1744
|
))
|
|
1741
1745
|
},
|
|
1742
1746
|
t.id || t._id || g
|
|
@@ -1748,9 +1752,9 @@ const ra = ({
|
|
|
1748
1752
|
(F - 1) * A + 1,
|
|
1749
1753
|
" to",
|
|
1750
1754
|
" ",
|
|
1751
|
-
Math.min(F * A,
|
|
1755
|
+
Math.min(F * A, H),
|
|
1752
1756
|
" of ",
|
|
1753
|
-
|
|
1757
|
+
H,
|
|
1754
1758
|
" ",
|
|
1755
1759
|
"results"
|
|
1756
1760
|
] }),
|
|
@@ -1763,8 +1767,8 @@ const ra = ({
|
|
|
1763
1767
|
value: A,
|
|
1764
1768
|
onChange: (t) => {
|
|
1765
1769
|
const g = Number(t.target.value);
|
|
1766
|
-
v(g), U(1), r.useServerSidePagination && b((
|
|
1767
|
-
...
|
|
1770
|
+
v(g), U(1), r.useServerSidePagination && b((T) => ({
|
|
1771
|
+
...T,
|
|
1768
1772
|
current_page: 1,
|
|
1769
1773
|
rows_per_page: g
|
|
1770
1774
|
}));
|
|
@@ -1826,20 +1830,20 @@ const ra = ({
|
|
|
1826
1830
|
ref: ne,
|
|
1827
1831
|
style: {
|
|
1828
1832
|
position: "fixed",
|
|
1829
|
-
top: `${
|
|
1830
|
-
left: `${
|
|
1833
|
+
top: `${$.top}px`,
|
|
1834
|
+
left: `${$.left}px`,
|
|
1831
1835
|
zIndex: 9999
|
|
1832
1836
|
},
|
|
1833
1837
|
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1834
1838
|
children: w.map((t, g) => /* @__PURE__ */ c(
|
|
1835
1839
|
"button",
|
|
1836
1840
|
{
|
|
1837
|
-
onClick: (
|
|
1841
|
+
onClick: (T) => xe(
|
|
1838
1842
|
t,
|
|
1839
1843
|
n.find(
|
|
1840
1844
|
(K) => K.id === u || K._id == u
|
|
1841
1845
|
),
|
|
1842
|
-
|
|
1846
|
+
T
|
|
1843
1847
|
),
|
|
1844
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"}`,
|
|
1845
1849
|
children: [
|
|
@@ -1857,7 +1861,7 @@ const ra = ({
|
|
|
1857
1861
|
na,
|
|
1858
1862
|
{
|
|
1859
1863
|
isOpen: M,
|
|
1860
|
-
onClose: () =>
|
|
1864
|
+
onClose: () => j(!1),
|
|
1861
1865
|
config: d,
|
|
1862
1866
|
onApply: y
|
|
1863
1867
|
}
|
|
@@ -1865,8 +1869,8 @@ const ra = ({
|
|
|
1865
1869
|
N && /* @__PURE__ */ e(
|
|
1866
1870
|
Ge,
|
|
1867
1871
|
{
|
|
1868
|
-
src:
|
|
1869
|
-
alt:
|
|
1872
|
+
src: E.src,
|
|
1873
|
+
alt: E.alt,
|
|
1870
1874
|
isOpen: N,
|
|
1871
1875
|
setIsOpen: O
|
|
1872
1876
|
}
|
|
@@ -1931,13 +1935,13 @@ const ra = ({
|
|
|
1931
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(
|
|
1932
1936
|
Q,
|
|
1933
1937
|
{
|
|
1934
|
-
onClick: (
|
|
1935
|
-
S.type == "submit" ? d(
|
|
1938
|
+
onClick: ($) => {
|
|
1939
|
+
S.type == "submit" ? d($) : u(
|
|
1936
1940
|
() => {
|
|
1937
|
-
var
|
|
1938
|
-
return (
|
|
1941
|
+
var I;
|
|
1942
|
+
return (I = S == null ? void 0 : S.onClick) == null ? void 0 : I.call(S, $, x);
|
|
1939
1943
|
},
|
|
1940
|
-
(
|
|
1944
|
+
(I) => n == null ? void 0 : n(I)
|
|
1941
1945
|
);
|
|
1942
1946
|
},
|
|
1943
1947
|
disabled: m || S.disabled,
|
|
@@ -1958,7 +1962,7 @@ const ra = ({
|
|
|
1958
1962
|
] });
|
|
1959
1963
|
}, Pe = ({ config: h, onSubmit: n, initialData: o = {}, type: i = "add" }) => {
|
|
1960
1964
|
const { formClass: s = "grid grid-cols-12 gap-4", formFields: l = [] } = h || {}, [r, C] = R(o);
|
|
1961
|
-
|
|
1965
|
+
z(() => {
|
|
1962
1966
|
C(o);
|
|
1963
1967
|
}, []);
|
|
1964
1968
|
const L = (y, d) => {
|
|
@@ -1979,7 +1983,7 @@ const ra = ({
|
|
|
1979
1983
|
onSubmit: b,
|
|
1980
1984
|
className: s,
|
|
1981
1985
|
noValidate: !1,
|
|
1982
|
-
children: l.map((y) => /* @__PURE__ */ e(
|
|
1986
|
+
children: l.map((y) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
1983
1987
|
Ee,
|
|
1984
1988
|
{
|
|
1985
1989
|
field: y,
|
|
@@ -1995,11 +1999,11 @@ function sa({ data: h, config: n }) {
|
|
|
1995
1999
|
const { fields: o, containerClass: i } = n, [s, l] = R(null), [r, C] = R(!1), L = (d) => {
|
|
1996
2000
|
l(d), C(!0);
|
|
1997
2001
|
}, b = ({ col: d }) => {
|
|
1998
|
-
var
|
|
2002
|
+
var $;
|
|
1999
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;
|
|
2000
|
-
if (x === "chip" && ((
|
|
2001
|
-
let
|
|
2002
|
-
|
|
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);
|
|
2003
2007
|
}
|
|
2004
2008
|
return /* @__PURE__ */ c(
|
|
2005
2009
|
"div",
|
|
@@ -2033,7 +2037,7 @@ function sa({ data: h, config: n }) {
|
|
|
2033
2037
|
{
|
|
2034
2038
|
controls: !0,
|
|
2035
2039
|
src: u,
|
|
2036
|
-
onClick: (
|
|
2040
|
+
onClick: (I) => I.stopPropagation(),
|
|
2037
2041
|
className: "shadow-md rounded-full"
|
|
2038
2042
|
},
|
|
2039
2043
|
u
|
|
@@ -2063,7 +2067,7 @@ function sa({ data: h, config: n }) {
|
|
|
2063
2067
|
onClick: () => L({ src: u, alt: p }),
|
|
2064
2068
|
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2065
2069
|
}
|
|
2066
|
-
) : 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" }) }),
|
|
2067
2071
|
/* @__PURE__ */ c("div", { children: [
|
|
2068
2072
|
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: p }),
|
|
2069
2073
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: m })
|
|
@@ -2072,7 +2076,7 @@ function sa({ data: h, config: n }) {
|
|
|
2072
2076
|
}
|
|
2073
2077
|
);
|
|
2074
2078
|
};
|
|
2075
|
-
return /* @__PURE__ */ c(
|
|
2079
|
+
return /* @__PURE__ */ c(G, { children: [
|
|
2076
2080
|
r && /* @__PURE__ */ e(
|
|
2077
2081
|
Ge,
|
|
2078
2082
|
{
|
|
@@ -2088,7 +2092,7 @@ function sa({ data: h, config: n }) {
|
|
|
2088
2092
|
] });
|
|
2089
2093
|
}
|
|
2090
2094
|
const je = ({ config: h }) => {
|
|
2091
|
-
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;
|
|
2092
2096
|
const {
|
|
2093
2097
|
title: n,
|
|
2094
2098
|
fetchData: o = async () => {
|
|
@@ -2101,7 +2105,7 @@ const je = ({ config: h }) => {
|
|
|
2101
2105
|
search: "",
|
|
2102
2106
|
rows_per_page: 50,
|
|
2103
2107
|
current_page: 1
|
|
2104
|
-
}), [S,
|
|
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) => {
|
|
2105
2109
|
k === "edit" ? (v(P), N(!0)) : k === "view" ? (v(P), U(!0)) : k === "delete" && (v(P), D(!0));
|
|
2106
2110
|
}, Z = async (k, P, B = "", ae = "") => {
|
|
2107
2111
|
y(!0);
|
|
@@ -2123,7 +2127,7 @@ const je = ({ config: h }) => {
|
|
|
2123
2127
|
}))) : (w((B) => ({
|
|
2124
2128
|
...B,
|
|
2125
2129
|
current_page: 1
|
|
2126
|
-
})), x.current_page == 1 && te()),
|
|
2130
|
+
})), x.current_page == 1 && te()), E(!1);
|
|
2127
2131
|
}, re = (k) => {
|
|
2128
2132
|
let P = k.newObject, B = k.targetObject;
|
|
2129
2133
|
i ? p(
|
|
@@ -2164,7 +2168,7 @@ const je = ({ config: h }) => {
|
|
|
2164
2168
|
});
|
|
2165
2169
|
}, xe = (k) => {
|
|
2166
2170
|
var P;
|
|
2167
|
-
|
|
2171
|
+
$((B) => ({
|
|
2168
2172
|
...k
|
|
2169
2173
|
})), (P = s == null ? void 0 : s.filter) != null && P.useServerSideFilters && M((B) => !B);
|
|
2170
2174
|
}, ve = (k, P) => k.filter(
|
|
@@ -2173,13 +2177,13 @@ const je = ({ config: h }) => {
|
|
|
2173
2177
|
var k;
|
|
2174
2178
|
return (k = s == null ? void 0 : s.filter) != null && k.useServerSideFilters ? d : ve(d, S);
|
|
2175
2179
|
}, [d, S]);
|
|
2176
|
-
return
|
|
2180
|
+
return z(() => {
|
|
2177
2181
|
te();
|
|
2178
2182
|
}, [
|
|
2179
2183
|
x.search,
|
|
2180
2184
|
x.rows_per_page,
|
|
2181
2185
|
x.current_page,
|
|
2182
|
-
|
|
2186
|
+
I
|
|
2183
2187
|
]), /* @__PURE__ */ e(
|
|
2184
2188
|
Ze,
|
|
2185
2189
|
{
|
|
@@ -2210,7 +2214,7 @@ const je = ({ config: h }) => {
|
|
|
2210
2214
|
/* @__PURE__ */ e("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ c(
|
|
2211
2215
|
Q,
|
|
2212
2216
|
{
|
|
2213
|
-
onClick: () =>
|
|
2217
|
+
onClick: () => E(!0),
|
|
2214
2218
|
variant: "contained",
|
|
2215
2219
|
color: "primary",
|
|
2216
2220
|
children: [
|
|
@@ -2231,7 +2235,7 @@ const je = ({ config: h }) => {
|
|
|
2231
2235
|
},
|
|
2232
2236
|
data: we,
|
|
2233
2237
|
setServerSidePaginationData: w,
|
|
2234
|
-
onMenuAction:
|
|
2238
|
+
onMenuAction: H,
|
|
2235
2239
|
filterConfig: r,
|
|
2236
2240
|
onFilterApply: xe,
|
|
2237
2241
|
loading: C
|
|
@@ -2241,9 +2245,9 @@ const je = ({ config: h }) => {
|
|
|
2241
2245
|
/* @__PURE__ */ e(
|
|
2242
2246
|
fe,
|
|
2243
2247
|
{
|
|
2244
|
-
isOpen:
|
|
2248
|
+
isOpen: j,
|
|
2245
2249
|
onClose: () => {
|
|
2246
|
-
b ||
|
|
2250
|
+
b || E(!1);
|
|
2247
2251
|
},
|
|
2248
2252
|
icon: (de = l.addModal) == null ? void 0 : de.icon,
|
|
2249
2253
|
title: ((ie = l.addModal) == null ? void 0 : ie.title) || "Add New",
|
|
@@ -2310,7 +2314,7 @@ const je = ({ config: h }) => {
|
|
|
2310
2314
|
selectedItem: A,
|
|
2311
2315
|
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ c("div", { children: [
|
|
2312
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?" }),
|
|
2313
|
-
((
|
|
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] })
|
|
2314
2318
|
] }) })
|
|
2315
2319
|
}
|
|
2316
2320
|
),
|
|
@@ -2494,9 +2498,9 @@ const ua = () => {
|
|
|
2494
2498
|
h.textContent = n, document.head.appendChild(h);
|
|
2495
2499
|
};
|
|
2496
2500
|
function wa(h) {
|
|
2497
|
-
return
|
|
2501
|
+
return z(() => {
|
|
2498
2502
|
ua();
|
|
2499
|
-
}, []), /* @__PURE__ */ e(
|
|
2503
|
+
}, []), /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(je, { config: h.config }) });
|
|
2500
2504
|
}
|
|
2501
2505
|
export {
|
|
2502
2506
|
wa as default
|