react-admin-crud-manager 1.0.12 → 1.0.13
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 +36 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +249 -225
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/style.css +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
1
|
+
import { jsx as e, Fragment as E, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import Me, { useState as S, useRef as X, useEffect as z, useMemo as Se } from "react";
|
|
3
|
-
import { ChevronDown as
|
|
3
|
+
import { ChevronDown as Ie, Search as Ce, Check as _e, X as fe, Filter as je, ChevronLeft as ze, ChevronRight as He, EllipsisVertical as Ue, User as Pe, Plus as Ye } from "lucide-react";
|
|
4
4
|
import { createPortal as Ve } from "react-dom";
|
|
5
5
|
import { Icon as De } from "@iconify/react";
|
|
6
6
|
import { Editor as qe } from "@tinymce/tinymce-react";
|
|
7
7
|
import { SnackbarProvider as We, enqueueSnackbar as we } from "notistack";
|
|
8
8
|
import a from "prop-types";
|
|
9
|
-
const Oe = (
|
|
10
|
-
if (!
|
|
11
|
-
const n = new Date(
|
|
9
|
+
const Oe = (s, d = "DD MMM YYYY") => {
|
|
10
|
+
if (!s) return "N/A";
|
|
11
|
+
const n = new Date(s);
|
|
12
12
|
if (isNaN(n)) return "Invalid Date";
|
|
13
13
|
const i = (r) => String(r).padStart(2, "0"), o = {
|
|
14
14
|
YYYY: n.getFullYear(),
|
|
@@ -31,10 +31,10 @@ const Oe = (c, d = "DD MMM YYYY") => {
|
|
|
31
31
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
32
|
(r) => o[r]
|
|
33
33
|
);
|
|
34
|
-
}, Ze = (
|
|
35
|
-
if (!(d != null && d.trim())) return
|
|
34
|
+
}, Ze = (s, d, n = []) => {
|
|
35
|
+
if (!(d != null && d.trim())) return s;
|
|
36
36
|
const i = d.toLowerCase(), o = (r) => r == null ? [] : typeof r == "object" ? Object.values(r).flatMap(o) : [String(r)];
|
|
37
|
-
return
|
|
37
|
+
return s.filter((r) => {
|
|
38
38
|
let l = [];
|
|
39
39
|
return n.length > 0 ? n.forEach((N) => {
|
|
40
40
|
r[N] !== void 0 && l.push(...o(r[N]));
|
|
@@ -44,7 +44,7 @@ const Oe = (c, d = "DD MMM YYYY") => {
|
|
|
44
44
|
});
|
|
45
45
|
}, ae = Me.forwardRef(
|
|
46
46
|
({
|
|
47
|
-
className:
|
|
47
|
+
className: s = "",
|
|
48
48
|
variant: d = "contained",
|
|
49
49
|
color: n = "default",
|
|
50
50
|
size: i = "default",
|
|
@@ -80,12 +80,12 @@ const Oe = (c, d = "DD MMM YYYY") => {
|
|
|
80
80
|
outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
|
|
81
81
|
text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, c = ((u = f[n]) == null ? void 0 : u[d]) || f.default.contained, g = y[i], m = `
|
|
84
84
|
${M}
|
|
85
|
-
${
|
|
85
|
+
${c}
|
|
86
86
|
${g}
|
|
87
87
|
${o ? "w-full" : ""}
|
|
88
|
-
${
|
|
88
|
+
${s}
|
|
89
89
|
`.trim();
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
91
|
"button",
|
|
@@ -100,14 +100,14 @@ const Oe = (c, d = "DD MMM YYYY") => {
|
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
ae.displayName = "Button";
|
|
103
|
-
function W({ label:
|
|
104
|
-
return /* @__PURE__ */ e(
|
|
105
|
-
|
|
103
|
+
function W({ label: s, required: d = !1 }) {
|
|
104
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
|
+
s,
|
|
106
106
|
d && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
|
|
107
107
|
] }) });
|
|
108
108
|
}
|
|
109
109
|
const Je = ({
|
|
110
|
-
options:
|
|
110
|
+
options: s = [],
|
|
111
111
|
value: d,
|
|
112
112
|
onChange: n,
|
|
113
113
|
placeholder: i = "Select option",
|
|
@@ -118,45 +118,45 @@ const Je = ({
|
|
|
118
118
|
required: M = !1,
|
|
119
119
|
name: y = "",
|
|
120
120
|
parentClass: f = "",
|
|
121
|
-
multiple:
|
|
121
|
+
multiple: c = !1,
|
|
122
122
|
// ✅ NEW
|
|
123
123
|
dropdownMaxHeight: g = ""
|
|
124
124
|
}) => {
|
|
125
125
|
var B;
|
|
126
|
-
const [m, u] = S(!1), [k, w] = S(""), [C, D] = S(!0),
|
|
126
|
+
const [m, u] = S(!1), [k, w] = S(""), [C, D] = S(!0), A = X(null), G = X(null), K = (b) => String(typeof b == "boolean" ? b : b ?? ""), j = c ? (d || []).map(K) : K(d), O = s.filter(
|
|
127
127
|
(b) => b.label.toLowerCase().includes(k.toLowerCase())
|
|
128
128
|
), v = (b) => {
|
|
129
|
-
const
|
|
130
|
-
return
|
|
129
|
+
const I = K(b);
|
|
130
|
+
return c ? j.includes(I) : I === j;
|
|
131
131
|
};
|
|
132
132
|
z(() => {
|
|
133
|
-
const b = (
|
|
134
|
-
|
|
133
|
+
const b = (I) => {
|
|
134
|
+
A.current && !A.current.contains(I.target) && (u(!1), w(""));
|
|
135
135
|
};
|
|
136
136
|
return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
|
|
137
137
|
}, []), z(() => {
|
|
138
|
-
if (m &&
|
|
139
|
-
const b =
|
|
138
|
+
if (m && A.current) {
|
|
139
|
+
const b = A.current.getBoundingClientRect(), H = window.innerHeight - b.bottom;
|
|
140
140
|
D(H < 200);
|
|
141
141
|
}
|
|
142
142
|
}, [m]), z(() => {
|
|
143
|
-
m &&
|
|
143
|
+
m && G.current && G.current.focus();
|
|
144
144
|
}, [m]);
|
|
145
145
|
const L = (b) => {
|
|
146
|
-
let
|
|
147
|
-
if (b === "true" ?
|
|
148
|
-
const H = j.includes(
|
|
146
|
+
let I = b;
|
|
147
|
+
if (b === "true" ? I = !0 : b === "false" && (I = !1), c) {
|
|
148
|
+
const H = j.includes(K(b));
|
|
149
149
|
let V;
|
|
150
150
|
H ? V = d.filter(
|
|
151
|
-
(J) =>
|
|
152
|
-
) : V = [...d || [],
|
|
151
|
+
(J) => K(J) !== K(b)
|
|
152
|
+
) : V = [...d || [], I], n(V);
|
|
153
153
|
} else
|
|
154
|
-
n(
|
|
154
|
+
n(I), u(!1);
|
|
155
155
|
w("");
|
|
156
|
-
}, T =
|
|
156
|
+
}, T = c ? s.filter((b) => v(b.value)).map((b) => b.label).join(", ") : (B = s.find((b) => v(b.value))) == null ? void 0 : B.label;
|
|
157
157
|
return /* @__PURE__ */ h("div", { className: f || "col-span-12", children: [
|
|
158
158
|
/* @__PURE__ */ e(W, { label: N, required: M }),
|
|
159
|
-
/* @__PURE__ */ h("div", { className: `relative ${o}`, ref:
|
|
159
|
+
/* @__PURE__ */ h("div", { className: `relative ${o}`, ref: A, children: [
|
|
160
160
|
/* @__PURE__ */ h(
|
|
161
161
|
"button",
|
|
162
162
|
{
|
|
@@ -169,7 +169,7 @@ const Je = ({
|
|
|
169
169
|
children: [
|
|
170
170
|
/* @__PURE__ */ e("span", { className: "truncate", children: T || i }),
|
|
171
171
|
/* @__PURE__ */ e(
|
|
172
|
-
|
|
172
|
+
Ie,
|
|
173
173
|
{
|
|
174
174
|
className: `w-4 h-4 transition-transform ${m ? "rotate-180" : ""}`
|
|
175
175
|
}
|
|
@@ -188,7 +188,7 @@ const Je = ({
|
|
|
188
188
|
/* @__PURE__ */ e(
|
|
189
189
|
"input",
|
|
190
190
|
{
|
|
191
|
-
ref:
|
|
191
|
+
ref: G,
|
|
192
192
|
type: "text",
|
|
193
193
|
value: k,
|
|
194
194
|
onChange: (b) => w(b.target.value),
|
|
@@ -213,7 +213,7 @@ const Je = ({
|
|
|
213
213
|
${v(b.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
214
214
|
children: [
|
|
215
215
|
/* @__PURE__ */ e("span", { children: b.label }),
|
|
216
|
-
|
|
216
|
+
c && v(b.value) && /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
|
|
217
217
|
]
|
|
218
218
|
},
|
|
219
219
|
String(b.value)
|
|
@@ -226,7 +226,7 @@ const Je = ({
|
|
|
226
226
|
] })
|
|
227
227
|
] }, y);
|
|
228
228
|
}, Qe = ({
|
|
229
|
-
value:
|
|
229
|
+
value: s = !0,
|
|
230
230
|
onChange: d,
|
|
231
231
|
text: n,
|
|
232
232
|
options: i = [],
|
|
@@ -240,11 +240,11 @@ const Je = ({
|
|
|
240
240
|
{ label: "Active", value: !0 },
|
|
241
241
|
{ label: "Inactive", value: !1 }
|
|
242
242
|
];
|
|
243
|
-
return /* @__PURE__ */ e(
|
|
243
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: M || "col-span-12", children: [
|
|
244
244
|
/* @__PURE__ */ e(W, { label: o, required: r }),
|
|
245
245
|
/* @__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: [
|
|
246
246
|
n && /* @__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: n }),
|
|
247
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: y.map((f,
|
|
247
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: y.map((f, c) => /* @__PURE__ */ h(
|
|
248
248
|
"label",
|
|
249
249
|
{
|
|
250
250
|
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
@@ -254,10 +254,10 @@ const Je = ({
|
|
|
254
254
|
{
|
|
255
255
|
type: "radio",
|
|
256
256
|
name: "switch-field",
|
|
257
|
-
required: r &&
|
|
257
|
+
required: r && c === 0,
|
|
258
258
|
value: f.value,
|
|
259
259
|
disabled: N,
|
|
260
|
-
checked:
|
|
260
|
+
checked: s === f.value,
|
|
261
261
|
onChange: () => d(f.value),
|
|
262
262
|
className: "w-4 h-4 border-gray-300 cursor-pointer"
|
|
263
263
|
}
|
|
@@ -265,7 +265,7 @@ const Je = ({
|
|
|
265
265
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: f.label })
|
|
266
266
|
]
|
|
267
267
|
},
|
|
268
|
-
|
|
268
|
+
c
|
|
269
269
|
)) })
|
|
270
270
|
] })
|
|
271
271
|
] }, l) });
|
|
@@ -522,7 +522,7 @@ const Je = ({
|
|
|
522
522
|
{ label: "Zimbabwe", code: "ZW", phone: "263" }
|
|
523
523
|
];
|
|
524
524
|
function Xe({
|
|
525
|
-
label:
|
|
525
|
+
label: s = "",
|
|
526
526
|
value: d = "",
|
|
527
527
|
name: n = "",
|
|
528
528
|
parentClass: i = "",
|
|
@@ -534,9 +534,9 @@ function Xe({
|
|
|
534
534
|
countriesList: y = !1,
|
|
535
535
|
defaultCountry: f = ""
|
|
536
536
|
}) {
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
), [u, k] = S(""), [w, C] = S(!1), [D,
|
|
537
|
+
const c = (v) => ge.find((L) => L.code == v), [g, m] = S(
|
|
538
|
+
c(f) || ge[0]
|
|
539
|
+
), [u, k] = S(""), [w, C] = S(!1), [D, A] = S(""), G = X();
|
|
540
540
|
z(() => {
|
|
541
541
|
if (typeof d == "string" && d.startsWith("+")) {
|
|
542
542
|
const v = ge.filter((L) => d.startsWith("+" + L.phone)).sort((L, T) => T.phone.length - L.phone.length)[0];
|
|
@@ -547,24 +547,24 @@ function Xe({
|
|
|
547
547
|
}
|
|
548
548
|
k(d);
|
|
549
549
|
}, [d]);
|
|
550
|
-
const
|
|
550
|
+
const K = (v) => {
|
|
551
551
|
const L = v.target.value.replace(/\D/g, "");
|
|
552
552
|
k(L), g && o && o("+" + g.phone + L);
|
|
553
553
|
}, j = (v) => {
|
|
554
|
-
m(v), o && o("+" + v.phone + u), C(!1),
|
|
554
|
+
m(v), o && o("+" + v.phone + u), C(!1), A("");
|
|
555
555
|
};
|
|
556
556
|
z(() => {
|
|
557
557
|
const v = (L) => {
|
|
558
|
-
|
|
558
|
+
G.current && !G.current.contains(L.target) && C(!1);
|
|
559
559
|
};
|
|
560
560
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
561
561
|
}, []);
|
|
562
562
|
const O = ge.filter(
|
|
563
563
|
(v) => v.label.toLowerCase().includes(D.toLowerCase()) || v.phone.includes(D)
|
|
564
564
|
);
|
|
565
|
-
return y ? /* @__PURE__ */ e(
|
|
566
|
-
/* @__PURE__ */ e(W, { label:
|
|
567
|
-
/* @__PURE__ */ h("div", { className: "relative ", ref:
|
|
565
|
+
return y ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
|
|
566
|
+
/* @__PURE__ */ e(W, { label: s, required: l }),
|
|
567
|
+
/* @__PURE__ */ h("div", { className: "relative ", ref: G, children: [
|
|
568
568
|
/* @__PURE__ */ h(
|
|
569
569
|
"div",
|
|
570
570
|
{
|
|
@@ -588,7 +588,7 @@ function Xe({
|
|
|
588
588
|
className: "w-5 h-3 object-cover"
|
|
589
589
|
}
|
|
590
590
|
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
591
|
-
/* @__PURE__ */ e(
|
|
591
|
+
/* @__PURE__ */ e(Ie, { className: "w-3 h-3 text-gray-500" })
|
|
592
592
|
]
|
|
593
593
|
}
|
|
594
594
|
),
|
|
@@ -601,7 +601,7 @@ function Xe({
|
|
|
601
601
|
{
|
|
602
602
|
type: "tel",
|
|
603
603
|
value: u,
|
|
604
|
-
onChange:
|
|
604
|
+
onChange: K,
|
|
605
605
|
required: l,
|
|
606
606
|
disabled: r || !g,
|
|
607
607
|
placeholder: g ? N : "Select a country",
|
|
@@ -635,7 +635,7 @@ function Xe({
|
|
|
635
635
|
{
|
|
636
636
|
type: "text",
|
|
637
637
|
value: D,
|
|
638
|
-
onChange: (v) =>
|
|
638
|
+
onChange: (v) => A(v.target.value),
|
|
639
639
|
placeholder: "Search country...",
|
|
640
640
|
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 "
|
|
641
641
|
}
|
|
@@ -668,8 +668,8 @@ function Xe({
|
|
|
668
668
|
))
|
|
669
669
|
] })
|
|
670
670
|
] })
|
|
671
|
-
] }, n) }) : /* @__PURE__ */ e(
|
|
672
|
-
/* @__PURE__ */ e(W, { label:
|
|
671
|
+
] }, n) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i || "col-span-12", children: [
|
|
672
|
+
/* @__PURE__ */ e(W, { label: s, required: l }),
|
|
673
673
|
/* @__PURE__ */ e(
|
|
674
674
|
"input",
|
|
675
675
|
{
|
|
@@ -692,12 +692,12 @@ function Xe({
|
|
|
692
692
|
] }, n) });
|
|
693
693
|
}
|
|
694
694
|
const Fe = Me.forwardRef(
|
|
695
|
-
({ className:
|
|
695
|
+
({ className: s = "", label: d, required: n, ...i }, o) => {
|
|
696
696
|
const r = `
|
|
697
697
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
698
|
-
${
|
|
698
|
+
${s}
|
|
699
699
|
`.trim();
|
|
700
|
-
return /* @__PURE__ */ e(
|
|
700
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: i.parentClass || "col-span-12", children: [
|
|
701
701
|
/* @__PURE__ */ e(W, { label: d, required: n }),
|
|
702
702
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
703
703
|
"textarea",
|
|
@@ -713,7 +713,7 @@ const Fe = Me.forwardRef(
|
|
|
713
713
|
);
|
|
714
714
|
Fe.displayName = "TextArea";
|
|
715
715
|
const ea = ({
|
|
716
|
-
label:
|
|
716
|
+
label: s = "",
|
|
717
717
|
value: d = null,
|
|
718
718
|
onChange: n,
|
|
719
719
|
required: i = !1,
|
|
@@ -723,24 +723,24 @@ const ea = ({
|
|
|
723
723
|
name: N = "",
|
|
724
724
|
parentClass: M = ""
|
|
725
725
|
}) => {
|
|
726
|
-
const [y, f] = S(d), [
|
|
726
|
+
const [y, f] = S(d), [c, g] = S(!1), m = X(null);
|
|
727
727
|
z(() => {
|
|
728
|
-
f(d);
|
|
728
|
+
f(d instanceof File ? URL.createObjectURL(d) : d);
|
|
729
729
|
}, [d]);
|
|
730
730
|
const u = (D) => {
|
|
731
731
|
if (!D || D.length === 0) {
|
|
732
732
|
f(null), n == null || n(null);
|
|
733
733
|
return;
|
|
734
734
|
}
|
|
735
|
-
const
|
|
736
|
-
f({ file:
|
|
735
|
+
const A = D[0], G = URL.createObjectURL(A);
|
|
736
|
+
f({ file: A, preview: G }), n == null || n(A);
|
|
737
737
|
};
|
|
738
|
-
return /* @__PURE__ */ e(
|
|
739
|
-
/* @__PURE__ */ e(W, { label:
|
|
738
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: M || "col-span-12", children: [
|
|
739
|
+
/* @__PURE__ */ e(W, { label: s, required: i }),
|
|
740
740
|
/* @__PURE__ */ h(
|
|
741
741
|
"div",
|
|
742
742
|
{
|
|
743
|
-
className: `relative rounded-md p-2 transition-all ${
|
|
743
|
+
className: `relative rounded-md p-2 transition-all ${c ? "border border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900" : "border bg-gray-50 dark:bg-gray-700"}`,
|
|
744
744
|
onDragOver: (D) => {
|
|
745
745
|
l && (D.preventDefault(), g(!0));
|
|
746
746
|
},
|
|
@@ -754,7 +754,7 @@ const ea = ({
|
|
|
754
754
|
/* @__PURE__ */ h(
|
|
755
755
|
"div",
|
|
756
756
|
{
|
|
757
|
-
className: `flex items-center space-x-3 transition-all ${
|
|
757
|
+
className: `flex items-center space-x-3 transition-all ${c ? "filter blur-sm" : ""}`,
|
|
758
758
|
children: [
|
|
759
759
|
/* @__PURE__ */ e(
|
|
760
760
|
"div",
|
|
@@ -768,7 +768,7 @@ const ea = ({
|
|
|
768
768
|
alt: "preview",
|
|
769
769
|
className: "object-cover w-20 h-20 rounded-full"
|
|
770
770
|
}
|
|
771
|
-
) : /* @__PURE__ */ e(
|
|
771
|
+
) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-200 dark:bg-gray-800 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
772
772
|
De,
|
|
773
773
|
{
|
|
774
774
|
icon: "ri:image-add-fill",
|
|
@@ -792,14 +792,14 @@ const ea = ({
|
|
|
792
792
|
]
|
|
793
793
|
}
|
|
794
794
|
),
|
|
795
|
-
l &&
|
|
795
|
+
l && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ e("span", { className: "text-blue-500 font-semibold text-xl", children: "Drop here" }) })
|
|
796
796
|
]
|
|
797
797
|
}
|
|
798
798
|
)
|
|
799
799
|
] }, N) });
|
|
800
800
|
}, Be = Me.forwardRef(
|
|
801
801
|
({
|
|
802
|
-
label:
|
|
802
|
+
label: s,
|
|
803
803
|
required: d,
|
|
804
804
|
parentClass: n = "",
|
|
805
805
|
className: i = "",
|
|
@@ -808,7 +808,7 @@ const ea = ({
|
|
|
808
808
|
negativeNumberAllow: l = !0,
|
|
809
809
|
...N
|
|
810
810
|
}, M) => {
|
|
811
|
-
const [y, f] = S(!1),
|
|
811
|
+
const [y, f] = S(!1), c = (m) => {
|
|
812
812
|
if (o === "number") {
|
|
813
813
|
if (["e", "E", "+"].includes(m.key)) {
|
|
814
814
|
m.preventDefault();
|
|
@@ -830,8 +830,8 @@ const ea = ({
|
|
|
830
830
|
${o === "number" ? "no-spinner" : ""}
|
|
831
831
|
${i}
|
|
832
832
|
`.trim();
|
|
833
|
-
return /* @__PURE__ */ e(
|
|
834
|
-
/* @__PURE__ */ e(W, { label:
|
|
833
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: n || "col-span-12", children: [
|
|
834
|
+
/* @__PURE__ */ e(W, { label: s, required: d }),
|
|
835
835
|
/* @__PURE__ */ h("div", { className: "relative", children: [
|
|
836
836
|
/* @__PURE__ */ e(
|
|
837
837
|
"input",
|
|
@@ -839,7 +839,7 @@ const ea = ({
|
|
|
839
839
|
type: o === "password" && y ? "text" : o,
|
|
840
840
|
ref: M,
|
|
841
841
|
required: d,
|
|
842
|
-
onKeyDown:
|
|
842
|
+
onKeyDown: c,
|
|
843
843
|
className: g,
|
|
844
844
|
...N
|
|
845
845
|
}
|
|
@@ -866,7 +866,7 @@ const ea = ({
|
|
|
866
866
|
);
|
|
867
867
|
Be.displayName = "Input";
|
|
868
868
|
const aa = ({
|
|
869
|
-
key:
|
|
869
|
+
key: s,
|
|
870
870
|
editorKey: d = "",
|
|
871
871
|
value: n = "",
|
|
872
872
|
onChange: i,
|
|
@@ -877,7 +877,7 @@ const aa = ({
|
|
|
877
877
|
height: M = 400,
|
|
878
878
|
inline: y = !1,
|
|
879
879
|
disabled: f = !1,
|
|
880
|
-
plugins:
|
|
880
|
+
plugins: c,
|
|
881
881
|
toolbar: g,
|
|
882
882
|
menubar: m = !1,
|
|
883
883
|
fontFamily: u = "Inter, sans-serif",
|
|
@@ -899,20 +899,20 @@ const aa = ({
|
|
|
899
899
|
branding: !1,
|
|
900
900
|
statusbar: !0,
|
|
901
901
|
automatic_uploads: !0,
|
|
902
|
-
images_upload_handler: (
|
|
902
|
+
images_upload_handler: (G) => new Promise((K, j) => {
|
|
903
903
|
if (!w) {
|
|
904
|
-
|
|
904
|
+
K(`data:${G.blob().type};base64,${G.base64()}`);
|
|
905
905
|
return;
|
|
906
906
|
}
|
|
907
|
-
w(
|
|
908
|
-
O ?
|
|
907
|
+
w(G).then((O) => {
|
|
908
|
+
O ? K(O) : j("Upload failed: No URL returned");
|
|
909
909
|
}).catch((O) => {
|
|
910
910
|
j(
|
|
911
911
|
typeof O == "string" ? O : (O == null ? void 0 : O.message) || "Image upload failed"
|
|
912
912
|
);
|
|
913
913
|
});
|
|
914
914
|
}),
|
|
915
|
-
plugins:
|
|
915
|
+
plugins: c ?? [
|
|
916
916
|
"advlist",
|
|
917
917
|
"autolink",
|
|
918
918
|
"lists",
|
|
@@ -940,13 +940,13 @@ const aa = ({
|
|
|
940
940
|
`,
|
|
941
941
|
...k
|
|
942
942
|
},
|
|
943
|
-
onEditorChange: (
|
|
944
|
-
i && i(
|
|
943
|
+
onEditorChange: (G) => {
|
|
944
|
+
i && i(G);
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
)
|
|
948
|
-
] },
|
|
949
|
-
name:
|
|
948
|
+
] }, s), ra = ({
|
|
949
|
+
name: s = "",
|
|
950
950
|
label: d = "",
|
|
951
951
|
// label for single checkbox
|
|
952
952
|
options: n = [],
|
|
@@ -961,12 +961,12 @@ const aa = ({
|
|
|
961
961
|
multiSelect: y = !1
|
|
962
962
|
// ✅ if true, only one option can be selected (like radio)
|
|
963
963
|
}) => {
|
|
964
|
-
const f = Array.isArray(n) && n.length > 0,
|
|
965
|
-
o == null || o(u.target.checked,
|
|
964
|
+
const f = Array.isArray(n) && n.length > 0, c = (u) => f ? y ? Array.isArray(i) && i.includes(u) : i === u : !!i, g = (u) => {
|
|
965
|
+
o == null || o(u.target.checked, s);
|
|
966
966
|
}, m = (u, k) => {
|
|
967
967
|
if (o)
|
|
968
968
|
if (!y)
|
|
969
|
-
o(k ? u : "",
|
|
969
|
+
o(k ? u : "", s);
|
|
970
970
|
else {
|
|
971
971
|
const w = Array.isArray(i) ? [...i] : [];
|
|
972
972
|
if (k)
|
|
@@ -975,30 +975,30 @@ const aa = ({
|
|
|
975
975
|
const C = w.indexOf(u);
|
|
976
976
|
C > -1 && w.splice(C, 1);
|
|
977
977
|
}
|
|
978
|
-
o(w,
|
|
978
|
+
o(w, s);
|
|
979
979
|
}
|
|
980
980
|
};
|
|
981
|
-
return f ? /* @__PURE__ */ e(
|
|
981
|
+
return f ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h("div", { className: `${N}`, children: [
|
|
982
982
|
/* @__PURE__ */ e(W, { label: d, required: l }),
|
|
983
983
|
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: n.map((u, k) => /* @__PURE__ */ h("div", { className: "flex items-center", children: [
|
|
984
984
|
/* @__PURE__ */ e(
|
|
985
985
|
"input",
|
|
986
986
|
{
|
|
987
987
|
type: "checkbox",
|
|
988
|
-
name:
|
|
988
|
+
name: s,
|
|
989
989
|
value: u.value,
|
|
990
|
-
checked:
|
|
990
|
+
checked: c(u.value),
|
|
991
991
|
disabled: r || u.disabled,
|
|
992
992
|
required: l && k === 0,
|
|
993
993
|
onChange: (w) => m(u.value, w.target.checked),
|
|
994
994
|
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 ${M}`
|
|
995
995
|
},
|
|
996
|
-
|
|
996
|
+
s
|
|
997
997
|
),
|
|
998
998
|
u.label && /* @__PURE__ */ e(
|
|
999
999
|
"label",
|
|
1000
1000
|
{
|
|
1001
|
-
htmlFor:
|
|
1001
|
+
htmlFor: s,
|
|
1002
1002
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1003
1003
|
children: u.label
|
|
1004
1004
|
}
|
|
@@ -1009,8 +1009,8 @@ const aa = ({
|
|
|
1009
1009
|
"input",
|
|
1010
1010
|
{
|
|
1011
1011
|
type: "checkbox",
|
|
1012
|
-
name:
|
|
1013
|
-
checked:
|
|
1012
|
+
name: s,
|
|
1013
|
+
checked: c(),
|
|
1014
1014
|
disabled: r,
|
|
1015
1015
|
required: l,
|
|
1016
1016
|
onChange: g,
|
|
@@ -1020,13 +1020,13 @@ const aa = ({
|
|
|
1020
1020
|
d && /* @__PURE__ */ e(
|
|
1021
1021
|
"label",
|
|
1022
1022
|
{
|
|
1023
|
-
htmlFor:
|
|
1023
|
+
htmlFor: s,
|
|
1024
1024
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1025
1025
|
children: d
|
|
1026
1026
|
}
|
|
1027
1027
|
)
|
|
1028
1028
|
] });
|
|
1029
|
-
}, Ee = ({ field:
|
|
1029
|
+
}, Ee = ({ field: s, formData: d, handleChange: n }) => {
|
|
1030
1030
|
const {
|
|
1031
1031
|
key: i,
|
|
1032
1032
|
label: o,
|
|
@@ -1036,7 +1036,7 @@ const aa = ({
|
|
|
1036
1036
|
rows: M,
|
|
1037
1037
|
inputClass: y,
|
|
1038
1038
|
search: f,
|
|
1039
|
-
accept:
|
|
1039
|
+
accept: c,
|
|
1040
1040
|
text: g,
|
|
1041
1041
|
required: m = !1,
|
|
1042
1042
|
minLength: u,
|
|
@@ -1044,13 +1044,13 @@ const aa = ({
|
|
|
1044
1044
|
parentClass: w,
|
|
1045
1045
|
countriesList: C,
|
|
1046
1046
|
defaultCountry: D,
|
|
1047
|
-
multiple:
|
|
1048
|
-
dropdownMaxHeight:
|
|
1049
|
-
editorKey:
|
|
1047
|
+
multiple: A,
|
|
1048
|
+
dropdownMaxHeight: G,
|
|
1049
|
+
editorKey: K,
|
|
1050
1050
|
fontFamily: j,
|
|
1051
1051
|
disabled: O,
|
|
1052
1052
|
negativeNumberAllow: v
|
|
1053
|
-
} =
|
|
1053
|
+
} = s;
|
|
1054
1054
|
let L = d == null ? void 0 : d[i];
|
|
1055
1055
|
L == null && (L = "");
|
|
1056
1056
|
const T = N || (r === "select" ? `Select ${o}` : `Enter ${o}`), B = "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";
|
|
@@ -1070,8 +1070,8 @@ const aa = ({
|
|
|
1070
1070
|
name: i,
|
|
1071
1071
|
disabled: O,
|
|
1072
1072
|
parentClass: w,
|
|
1073
|
-
multiple:
|
|
1074
|
-
dropdownMaxHeight:
|
|
1073
|
+
multiple: A,
|
|
1074
|
+
dropdownMaxHeight: G
|
|
1075
1075
|
}
|
|
1076
1076
|
);
|
|
1077
1077
|
case "checkbox":
|
|
@@ -1086,7 +1086,7 @@ const aa = ({
|
|
|
1086
1086
|
required: m,
|
|
1087
1087
|
parentClass: w,
|
|
1088
1088
|
className: y || "",
|
|
1089
|
-
multiSelect:
|
|
1089
|
+
multiSelect: A,
|
|
1090
1090
|
disabled: O
|
|
1091
1091
|
}
|
|
1092
1092
|
);
|
|
@@ -1145,7 +1145,7 @@ const aa = ({
|
|
|
1145
1145
|
value: L,
|
|
1146
1146
|
onChange: (b) => n(i, b),
|
|
1147
1147
|
required: m,
|
|
1148
|
-
accept:
|
|
1148
|
+
accept: c || "image/*",
|
|
1149
1149
|
id: `file-${i}`,
|
|
1150
1150
|
dragDrop: k,
|
|
1151
1151
|
label: o,
|
|
@@ -1164,7 +1164,7 @@ const aa = ({
|
|
|
1164
1164
|
label: o,
|
|
1165
1165
|
parentClass: w,
|
|
1166
1166
|
fontFamily: j,
|
|
1167
|
-
editorKey:
|
|
1167
|
+
editorKey: K,
|
|
1168
1168
|
disabled: O
|
|
1169
1169
|
},
|
|
1170
1170
|
`editor-${i}`
|
|
@@ -1188,20 +1188,20 @@ const aa = ({
|
|
|
1188
1188
|
}
|
|
1189
1189
|
);
|
|
1190
1190
|
}
|
|
1191
|
-
}, ta = ({ isOpen:
|
|
1191
|
+
}, ta = ({ isOpen: s, onClose: d, config: n, onApply: i }) => {
|
|
1192
1192
|
var y;
|
|
1193
|
-
const [o, r] = S({}), l = (f,
|
|
1194
|
-
r((g) => ({ ...g, [f]:
|
|
1193
|
+
const [o, r] = S({}), l = (f, c) => {
|
|
1194
|
+
r((g) => ({ ...g, [f]: c }));
|
|
1195
1195
|
}, N = () => {
|
|
1196
1196
|
i == null || i(o), d();
|
|
1197
1197
|
}, M = () => {
|
|
1198
1198
|
r({}), i == null || i({}), d();
|
|
1199
1199
|
};
|
|
1200
|
-
return /* @__PURE__ */ h(
|
|
1200
|
+
return /* @__PURE__ */ h(E, { children: [
|
|
1201
1201
|
/* @__PURE__ */ e(
|
|
1202
1202
|
"div",
|
|
1203
1203
|
{
|
|
1204
|
-
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${
|
|
1204
|
+
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${s ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
|
|
1205
1205
|
onClick: d
|
|
1206
1206
|
}
|
|
1207
1207
|
),
|
|
@@ -1210,7 +1210,7 @@ const aa = ({
|
|
|
1210
1210
|
{
|
|
1211
1211
|
className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
|
|
1212
1212
|
transform transition-transform duration-300 ease-in-out
|
|
1213
|
-
${
|
|
1213
|
+
${s ? "translate-x-0" : "translate-x-full"}
|
|
1214
1214
|
`,
|
|
1215
1215
|
children: [
|
|
1216
1216
|
/* @__PURE__ */ h("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
|
|
@@ -1224,7 +1224,7 @@ const aa = ({
|
|
|
1224
1224
|
}
|
|
1225
1225
|
)
|
|
1226
1226
|
] }),
|
|
1227
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: n != null && n.component ? /* @__PURE__ */ e(n.component, { filters: o, onFilterChange: l }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (y = n == null ? void 0 : n.fields) == null ? void 0 : y.map((f) => /* @__PURE__ */ e(
|
|
1227
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: n != null && n.component ? /* @__PURE__ */ e(n.component, { filters: o, onFilterChange: l }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (y = n == null ? void 0 : n.fields) == null ? void 0 : y.map((f) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1228
1228
|
Ee,
|
|
1229
1229
|
{
|
|
1230
1230
|
field: f,
|
|
@@ -1292,7 +1292,7 @@ const aa = ({
|
|
|
1292
1292
|
outline: "border !bg-transparent",
|
|
1293
1293
|
soft: "bg opacity-90"
|
|
1294
1294
|
}, Ge = ({
|
|
1295
|
-
label:
|
|
1295
|
+
label: s,
|
|
1296
1296
|
variant: d = "contained",
|
|
1297
1297
|
// contained | outline | soft
|
|
1298
1298
|
color: n = "green",
|
|
@@ -1306,14 +1306,14 @@ const aa = ({
|
|
|
1306
1306
|
${l}
|
|
1307
1307
|
${r}
|
|
1308
1308
|
${i}`,
|
|
1309
|
-
children:
|
|
1309
|
+
children: s
|
|
1310
1310
|
}
|
|
1311
1311
|
);
|
|
1312
|
-
}, la = ({ rows:
|
|
1312
|
+
}, la = ({ rows: s = 5, columns: d = 5 }) => /* @__PURE__ */ h(E, { children: [
|
|
1313
1313
|
/* @__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" }) }),
|
|
1314
1314
|
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse", children: [
|
|
1315
1315
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: d }).map((n, 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)) }) }),
|
|
1316
|
-
/* @__PURE__ */ e("tbody", { children: Array.from({ length:
|
|
1316
|
+
/* @__PURE__ */ e("tbody", { children: Array.from({ length: s }).map((n, i) => /* @__PURE__ */ e(
|
|
1317
1317
|
"tr",
|
|
1318
1318
|
{
|
|
1319
1319
|
className: "border-t border-gray-200 dark:border-gray-800",
|
|
@@ -1322,7 +1322,7 @@ const aa = ({
|
|
|
1322
1322
|
i
|
|
1323
1323
|
)) })
|
|
1324
1324
|
] }) })
|
|
1325
|
-
] }),
|
|
1325
|
+
] }), $e = ({ src: s, alt: d = "preview", isOpen: n, setIsOpen: i }) => {
|
|
1326
1326
|
const o = () => i(!1);
|
|
1327
1327
|
return z(() => {
|
|
1328
1328
|
const r = (l) => {
|
|
@@ -1331,7 +1331,7 @@ const aa = ({
|
|
|
1331
1331
|
return n && (document.body.style.overflow = "hidden", document.addEventListener("keydown", r)), () => {
|
|
1332
1332
|
document.body.style.overflow = "", document.removeEventListener("keydown", r);
|
|
1333
1333
|
};
|
|
1334
|
-
}, [n]), /* @__PURE__ */ e(
|
|
1334
|
+
}, [n]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ h(
|
|
1335
1335
|
"div",
|
|
1336
1336
|
{
|
|
1337
1337
|
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
@@ -1355,7 +1355,7 @@ const aa = ({
|
|
|
1355
1355
|
children: /* @__PURE__ */ e(
|
|
1356
1356
|
"img",
|
|
1357
1357
|
{
|
|
1358
|
-
src:
|
|
1358
|
+
src: s,
|
|
1359
1359
|
alt: d,
|
|
1360
1360
|
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1361
1361
|
}
|
|
@@ -1365,7 +1365,7 @@ const aa = ({
|
|
|
1365
1365
|
]
|
|
1366
1366
|
}
|
|
1367
1367
|
) });
|
|
1368
|
-
}, na = ({ config:
|
|
1368
|
+
}, na = ({ config: s }) => {
|
|
1369
1369
|
const {
|
|
1370
1370
|
data: d = [],
|
|
1371
1371
|
table_head: n = [],
|
|
@@ -1389,12 +1389,12 @@ const aa = ({
|
|
|
1389
1389
|
setServerSidePaginationData: y = () => {
|
|
1390
1390
|
},
|
|
1391
1391
|
onFilterApply: f,
|
|
1392
|
-
filterConfig:
|
|
1393
|
-
} =
|
|
1392
|
+
filterConfig: c = null
|
|
1393
|
+
} = s, [g, m] = S(""), [u, k] = S(null), [w, C] = S([]), [D, A] = S({}), [G, K] = S(!1), [j, O] = S(null), [v, L] = S(!1), T = Se(() => !o.enabled || !g.trim() || o.useServerSideSearch ? d : Ze(d, g, o.searchKeys || []), [d, g, o]), [B, b] = S(1), [I, H] = S((l == null ? void 0 : l.rows_per_page) || 50), [V, J] = S(T.length || 0), re = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(T.length / I), ie = Se(() => {
|
|
1394
1394
|
if (l.useServerSidePagination) return T;
|
|
1395
|
-
const t = (B - 1) *
|
|
1396
|
-
return T.slice(t, t +
|
|
1397
|
-
}, [T, B,
|
|
1395
|
+
const t = (B - 1) * I;
|
|
1396
|
+
return T.slice(t, t + I);
|
|
1397
|
+
}, [T, B, I]), te = X(null), de = X({}), le = X(null), ee = (t) => {
|
|
1398
1398
|
m(t), b(1), o.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
|
|
1399
1399
|
try {
|
|
1400
1400
|
await y((p) => ({
|
|
@@ -1412,28 +1412,28 @@ const aa = ({
|
|
|
1412
1412
|
p.stopPropagation(), C(P);
|
|
1413
1413
|
const _ = p.currentTarget;
|
|
1414
1414
|
de.current[t] = _;
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
top: Math.max(8, Math.min(Z, oe -
|
|
1415
|
+
const $ = _.getBoundingClientRect(), q = 192, Y = P.length * 40, Q = window.innerWidth, oe = window.innerHeight, R = Q - $.right < q ? $.left - q + $.width : $.left, Z = oe - $.bottom < Y && $.top > Y ? $.top - Y - 2 : $.bottom + 2;
|
|
1416
|
+
A({
|
|
1417
|
+
top: Math.max(8, Math.min(Z, oe - Y - 8)),
|
|
1418
1418
|
left: Math.max(8, Math.min(R, Q - q - 8))
|
|
1419
1419
|
}), k(u === t ? null : t);
|
|
1420
|
-
}, ve = (t) => (B - 1) *
|
|
1420
|
+
}, ve = (t) => (B - 1) * I + t + 1, se = (t) => {
|
|
1421
1421
|
O(t), L(!0);
|
|
1422
|
-
}, ne = (t, p, P, _ = null) => /* @__PURE__ */ e(
|
|
1422
|
+
}, ne = (t, p, P, _ = null) => /* @__PURE__ */ e(E, { children: t ? /* @__PURE__ */ e(
|
|
1423
1423
|
"img",
|
|
1424
1424
|
{
|
|
1425
1425
|
src: t,
|
|
1426
1426
|
alt: p || "Avatar",
|
|
1427
|
-
onClick: (
|
|
1428
|
-
|
|
1427
|
+
onClick: ($) => {
|
|
1428
|
+
$.stopPropagation(), $.preventDefault(), se({ src: t, alt: p });
|
|
1429
1429
|
},
|
|
1430
1430
|
className: `w-10 h-10 cursor-pointer rounded-full object-cover border border-gray-200 dark:border-gray-700 ${P || ""}`
|
|
1431
1431
|
}
|
|
1432
|
-
) : /* @__PURE__ */ e(
|
|
1432
|
+
) : /* @__PURE__ */ e(E, { children: _ || /* @__PURE__ */ e(
|
|
1433
1433
|
"div",
|
|
1434
1434
|
{
|
|
1435
1435
|
className: `w-10 h-10 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${P || ""}`,
|
|
1436
|
-
children: /* @__PURE__ */ e(
|
|
1436
|
+
children: /* @__PURE__ */ e(Pe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1437
1437
|
}
|
|
1438
1438
|
) }) }), ce = (t, p) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${p.className || ""}`, children: [
|
|
1439
1439
|
p.imageKey ? ne(t[p.imageKey], t[p.titleKey], "group-avatar") : "",
|
|
@@ -1445,17 +1445,17 @@ const aa = ({
|
|
|
1445
1445
|
var q;
|
|
1446
1446
|
let P = String(t);
|
|
1447
1447
|
const _ = p.variant || "contained";
|
|
1448
|
-
let
|
|
1448
|
+
let $ = p.defaultColor;
|
|
1449
1449
|
if (((q = p == null ? void 0 : p.chipOptions) == null ? void 0 : q.length) > 0) {
|
|
1450
|
-
let
|
|
1451
|
-
|
|
1450
|
+
let Y = p == null ? void 0 : p.chipOptions.find((Q) => Q.value == t);
|
|
1451
|
+
Y && (P = Y.label, $ = Y.color);
|
|
1452
1452
|
}
|
|
1453
1453
|
return /* @__PURE__ */ e(
|
|
1454
1454
|
Ge,
|
|
1455
1455
|
{
|
|
1456
1456
|
label: P,
|
|
1457
1457
|
variant: _,
|
|
1458
|
-
color:
|
|
1458
|
+
color: $,
|
|
1459
1459
|
className: p.className || ""
|
|
1460
1460
|
}
|
|
1461
1461
|
);
|
|
@@ -1464,12 +1464,12 @@ const aa = ({
|
|
|
1464
1464
|
return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
|
|
1465
1465
|
"button",
|
|
1466
1466
|
{
|
|
1467
|
-
ref: (
|
|
1468
|
-
onClick: (
|
|
1467
|
+
ref: ($) => de.current[p.id || p._id] = $,
|
|
1468
|
+
onClick: ($) => xe(p.id || p._id, $, t.menuList),
|
|
1469
1469
|
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",
|
|
1470
|
-
children: /* @__PURE__ */ e(
|
|
1470
|
+
children: /* @__PURE__ */ e(Ue, { className: "h-4 w-4" })
|
|
1471
1471
|
}
|
|
1472
|
-
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: ve(P) }) : t.type === "group" ? ce(p, t) : t.type === "chip" ? /* @__PURE__ */ e(
|
|
1472
|
+
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: ve(P) }) : t.type === "group" ? ce(p, t) : t.type === "chip" ? /* @__PURE__ */ e(E, { children: he(_, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: Oe(_, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e(E, { children: ne(_, t.alt, t.className, t.fallback_icon) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: _ || "N/A" });
|
|
1473
1473
|
}, be = (t, p) => {
|
|
1474
1474
|
if (t.onClickDetails)
|
|
1475
1475
|
return M == null ? void 0 : M("view", p);
|
|
@@ -1497,12 +1497,12 @@ const aa = ({
|
|
|
1497
1497
|
]), z(() => {
|
|
1498
1498
|
J(
|
|
1499
1499
|
l != null && l.useServerSidePagination ? l.total_records : T.length
|
|
1500
|
-
), T.length <=
|
|
1500
|
+
), T.length <= I * (B - 1) && !(l != null && l.useServerSidePagination) && b((t) => t - 1 || 1);
|
|
1501
1501
|
}, [
|
|
1502
1502
|
T.length,
|
|
1503
1503
|
l.total_records,
|
|
1504
1504
|
l == null ? void 0 : l.useServerSidePagination
|
|
1505
|
-
]), i ? /* @__PURE__ */ e(la, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(
|
|
1505
|
+
]), i ? /* @__PURE__ */ e(la, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(E, { children: [
|
|
1506
1506
|
/* @__PURE__ */ h("div", { className: "flex justify-end items-center mb-4 gap-2", children: [
|
|
1507
1507
|
o.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ h("div", { className: "relative min-w-[300px]", children: [
|
|
1508
1508
|
/* @__PURE__ */ e(Ce, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
@@ -1517,7 +1517,7 @@ const aa = ({
|
|
|
1517
1517
|
}
|
|
1518
1518
|
)
|
|
1519
1519
|
] }) }),
|
|
1520
|
-
|
|
1520
|
+
c && r.enabled && /* @__PURE__ */ h(ae, { onClick: () => K(!0), variant: "contained", children: [
|
|
1521
1521
|
/* @__PURE__ */ e(je, { className: "w-4 h-4 mr-2" }),
|
|
1522
1522
|
"Filters"
|
|
1523
1523
|
] })
|
|
@@ -1527,7 +1527,7 @@ const aa = ({
|
|
|
1527
1527
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: n.map((t) => /* @__PURE__ */ e(
|
|
1528
1528
|
"th",
|
|
1529
1529
|
{
|
|
1530
|
-
className:
|
|
1530
|
+
className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${t.headClass || ""}`,
|
|
1531
1531
|
children: t.title
|
|
1532
1532
|
},
|
|
1533
1533
|
t.key
|
|
@@ -1560,10 +1560,10 @@ const aa = ({
|
|
|
1560
1560
|
(l == null ? void 0 : l.enabled) && T.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: [
|
|
1561
1561
|
/* @__PURE__ */ h("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1562
1562
|
"Showing ",
|
|
1563
|
-
(B - 1) *
|
|
1563
|
+
(B - 1) * I + 1,
|
|
1564
1564
|
" to",
|
|
1565
1565
|
" ",
|
|
1566
|
-
Math.min(B *
|
|
1566
|
+
Math.min(B * I, V),
|
|
1567
1567
|
" of ",
|
|
1568
1568
|
V,
|
|
1569
1569
|
" ",
|
|
@@ -1575,7 +1575,7 @@ const aa = ({
|
|
|
1575
1575
|
/* @__PURE__ */ e(
|
|
1576
1576
|
"select",
|
|
1577
1577
|
{
|
|
1578
|
-
value:
|
|
1578
|
+
value: I,
|
|
1579
1579
|
onChange: (t) => {
|
|
1580
1580
|
const p = Number(t.target.value);
|
|
1581
1581
|
H(p), b(1), l.useServerSidePagination && y((P) => ({
|
|
@@ -1604,7 +1604,7 @@ const aa = ({
|
|
|
1604
1604
|
},
|
|
1605
1605
|
disabled: B === 1,
|
|
1606
1606
|
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1607
|
-
children: /* @__PURE__ */ e(
|
|
1607
|
+
children: /* @__PURE__ */ e(ze, { className: "h-4 w-4" })
|
|
1608
1608
|
}
|
|
1609
1609
|
),
|
|
1610
1610
|
/* @__PURE__ */ h("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
|
|
@@ -1627,7 +1627,7 @@ const aa = ({
|
|
|
1627
1627
|
},
|
|
1628
1628
|
disabled: B === re,
|
|
1629
1629
|
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1630
|
-
children: /* @__PURE__ */ e(
|
|
1630
|
+
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
1631
1631
|
}
|
|
1632
1632
|
)
|
|
1633
1633
|
] })
|
|
@@ -1668,17 +1668,17 @@ const aa = ({
|
|
|
1668
1668
|
),
|
|
1669
1669
|
document.body
|
|
1670
1670
|
),
|
|
1671
|
-
|
|
1671
|
+
c && /* @__PURE__ */ e(
|
|
1672
1672
|
ta,
|
|
1673
1673
|
{
|
|
1674
|
-
isOpen:
|
|
1675
|
-
onClose: () =>
|
|
1676
|
-
config:
|
|
1674
|
+
isOpen: G,
|
|
1675
|
+
onClose: () => K(!1),
|
|
1676
|
+
config: c,
|
|
1677
1677
|
onApply: f
|
|
1678
1678
|
}
|
|
1679
1679
|
),
|
|
1680
1680
|
v && /* @__PURE__ */ e(
|
|
1681
|
-
|
|
1681
|
+
$e,
|
|
1682
1682
|
{
|
|
1683
1683
|
src: j.src,
|
|
1684
1684
|
alt: j.alt,
|
|
@@ -1688,7 +1688,7 @@ const aa = ({
|
|
|
1688
1688
|
)
|
|
1689
1689
|
] });
|
|
1690
1690
|
}, me = ({
|
|
1691
|
-
isOpen:
|
|
1691
|
+
isOpen: s,
|
|
1692
1692
|
onClose: d,
|
|
1693
1693
|
icon: n,
|
|
1694
1694
|
title: i,
|
|
@@ -1699,7 +1699,7 @@ const aa = ({
|
|
|
1699
1699
|
showDefaultClose: M = !0,
|
|
1700
1700
|
footerConfig: y = null,
|
|
1701
1701
|
hideFooter: f = !1,
|
|
1702
|
-
onFormSubmit:
|
|
1702
|
+
onFormSubmit: c = () => {
|
|
1703
1703
|
},
|
|
1704
1704
|
onCancel: g,
|
|
1705
1705
|
loadingBtn: m = !1,
|
|
@@ -1707,7 +1707,7 @@ const aa = ({
|
|
|
1707
1707
|
},
|
|
1708
1708
|
selectedItem: k = null
|
|
1709
1709
|
}) => {
|
|
1710
|
-
if (!
|
|
1710
|
+
if (!s) return null;
|
|
1711
1711
|
const w = {
|
|
1712
1712
|
sm: "max-w-md",
|
|
1713
1713
|
md: "max-w-lg",
|
|
@@ -1747,12 +1747,12 @@ const aa = ({
|
|
|
1747
1747
|
ae,
|
|
1748
1748
|
{
|
|
1749
1749
|
onClick: (D) => {
|
|
1750
|
-
C.type == "submit" ?
|
|
1750
|
+
C.type == "submit" ? c(D) : u(
|
|
1751
1751
|
() => {
|
|
1752
|
-
var
|
|
1753
|
-
return (
|
|
1752
|
+
var A;
|
|
1753
|
+
return (A = C == null ? void 0 : C.onClick) == null ? void 0 : A.call(C, D, k);
|
|
1754
1754
|
},
|
|
1755
|
-
(
|
|
1755
|
+
(A) => d == null ? void 0 : d(A)
|
|
1756
1756
|
);
|
|
1757
1757
|
},
|
|
1758
1758
|
disabled: m || C.disabled,
|
|
@@ -1771,19 +1771,19 @@ const aa = ({
|
|
|
1771
1771
|
}
|
|
1772
1772
|
)
|
|
1773
1773
|
] });
|
|
1774
|
-
}, Ae = ({ config:
|
|
1774
|
+
}, Ae = ({ config: s, onSubmit: d, initialData: n = {} }) => {
|
|
1775
1775
|
var y;
|
|
1776
|
-
const { formClass: i = "grid grid-cols-12 gap-4", formFields: o = [] } =
|
|
1776
|
+
const { formClass: i = "grid grid-cols-12 gap-4", formFields: o = [] } = s || {}, [r, l] = S(n);
|
|
1777
1777
|
z(() => {
|
|
1778
1778
|
l(n);
|
|
1779
1779
|
}, []);
|
|
1780
|
-
const N = (f,
|
|
1781
|
-
l((g) => ({ ...g, [f]:
|
|
1780
|
+
const N = (f, c) => {
|
|
1781
|
+
l((g) => ({ ...g, [f]: c }));
|
|
1782
1782
|
}, M = (f) => {
|
|
1783
1783
|
f.preventDefault();
|
|
1784
|
-
const
|
|
1785
|
-
if (!
|
|
1786
|
-
|
|
1784
|
+
const c = f.target;
|
|
1785
|
+
if (!c.checkValidity()) {
|
|
1786
|
+
c.reportValidity();
|
|
1787
1787
|
return;
|
|
1788
1788
|
}
|
|
1789
1789
|
d(r);
|
|
@@ -1791,11 +1791,11 @@ const aa = ({
|
|
|
1791
1791
|
return /* @__PURE__ */ e(
|
|
1792
1792
|
"form",
|
|
1793
1793
|
{
|
|
1794
|
-
id: (y =
|
|
1794
|
+
id: (y = s.title) != null && y.toLowerCase().includes("edit") ? "editForm" : "addForm",
|
|
1795
1795
|
onSubmit: M,
|
|
1796
1796
|
className: i,
|
|
1797
1797
|
noValidate: !1,
|
|
1798
|
-
children: o.map((f) => /* @__PURE__ */ e(
|
|
1798
|
+
children: o.map((f) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1799
1799
|
Ee,
|
|
1800
1800
|
{
|
|
1801
1801
|
field: f,
|
|
@@ -1807,25 +1807,25 @@ const aa = ({
|
|
|
1807
1807
|
}
|
|
1808
1808
|
);
|
|
1809
1809
|
};
|
|
1810
|
-
function oa({ data:
|
|
1811
|
-
const { fields: n, containerClass: i } = d, [o, r] = S(null), [l, N] = S(!1), M = (
|
|
1812
|
-
r(
|
|
1813
|
-
}, y = ({ col:
|
|
1814
|
-
let g =
|
|
1815
|
-
if (k == "chip" &&
|
|
1816
|
-
let D =
|
|
1810
|
+
function oa({ data: s, config: d }) {
|
|
1811
|
+
const { fields: n, containerClass: i } = d, [o, r] = S(null), [l, N] = S(!1), M = (c) => {
|
|
1812
|
+
r(c), N(!0);
|
|
1813
|
+
}, y = ({ col: c }) => {
|
|
1814
|
+
let g = c == null ? void 0 : c.icon, m = c.label, u = s[c.key], k = c.type, w = c.variant || "outline", C = c.defaultColor;
|
|
1815
|
+
if (k == "chip" && c.chipOptions.length > 0) {
|
|
1816
|
+
let D = c == null ? void 0 : c.chipOptions.find((A) => A.value == u);
|
|
1817
1817
|
D && (u = D.label, C = D.color);
|
|
1818
1818
|
}
|
|
1819
1819
|
return /* @__PURE__ */ h(
|
|
1820
1820
|
"div",
|
|
1821
1821
|
{
|
|
1822
1822
|
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
1823
|
-
bg-gray-100 dark:bg-gray-900 ${
|
|
1823
|
+
bg-gray-100 dark:bg-gray-900 ${c.blockClass}`,
|
|
1824
1824
|
children: [
|
|
1825
1825
|
g && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g }),
|
|
1826
1826
|
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
1827
1827
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: m }),
|
|
1828
|
-
k == "chip" ? /* @__PURE__ */ e(
|
|
1828
|
+
k == "chip" ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1829
1829
|
Ge,
|
|
1830
1830
|
{
|
|
1831
1831
|
label: u,
|
|
@@ -1841,19 +1841,19 @@ function oa({ data: c, config: d }) {
|
|
|
1841
1841
|
__html: u
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: k == "date" ? /* @__PURE__ */ e("span", { children: Oe(u,
|
|
1844
|
+
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: k == "date" ? /* @__PURE__ */ e("span", { children: Oe(u, c.format || "DD MMM YYYY") }) : u || "N/A" })
|
|
1845
1845
|
] })
|
|
1846
1846
|
]
|
|
1847
1847
|
}
|
|
1848
1848
|
);
|
|
1849
|
-
}, f = ({ col:
|
|
1850
|
-
let g = c
|
|
1849
|
+
}, f = ({ col: c }) => {
|
|
1850
|
+
let g = s[c.titleKey], m = s[c.subtitleKey], u = s[c.imageKey], k = s[c.fallback_icon];
|
|
1851
1851
|
return /* @__PURE__ */ h(
|
|
1852
1852
|
"div",
|
|
1853
1853
|
{
|
|
1854
1854
|
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
1855
1855
|
bg-gray-100 dark:bg-gray-900
|
|
1856
|
-
${
|
|
1856
|
+
${c.blockClass}`,
|
|
1857
1857
|
children: [
|
|
1858
1858
|
u ? /* @__PURE__ */ e(
|
|
1859
1859
|
"img",
|
|
@@ -1863,7 +1863,7 @@ function oa({ data: c, config: d }) {
|
|
|
1863
1863
|
onClick: () => M({ src: u, alt: g }),
|
|
1864
1864
|
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
1865
1865
|
}
|
|
1866
|
-
) : k || /* @__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(
|
|
1866
|
+
) : k || /* @__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(Pe, { className: "w-8 h-8 text-gray-400" }) }),
|
|
1867
1867
|
/* @__PURE__ */ h("div", { children: [
|
|
1868
1868
|
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
|
|
1869
1869
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: m })
|
|
@@ -1872,9 +1872,9 @@ function oa({ data: c, config: d }) {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
);
|
|
1874
1874
|
};
|
|
1875
|
-
return /* @__PURE__ */ h(
|
|
1875
|
+
return /* @__PURE__ */ h(E, { children: [
|
|
1876
1876
|
l && /* @__PURE__ */ e(
|
|
1877
|
-
|
|
1877
|
+
$e,
|
|
1878
1878
|
{
|
|
1879
1879
|
src: o.src,
|
|
1880
1880
|
alt: o.alt,
|
|
@@ -1883,12 +1883,12 @@ function oa({ data: c, config: d }) {
|
|
|
1883
1883
|
}
|
|
1884
1884
|
),
|
|
1885
1885
|
/* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: n.map(
|
|
1886
|
-
(
|
|
1886
|
+
(c) => c.type == "group" ? /* @__PURE__ */ e(f, { col: c }) : /* @__PURE__ */ e(y, { col: c })
|
|
1887
1887
|
) })
|
|
1888
1888
|
] });
|
|
1889
1889
|
}
|
|
1890
|
-
const
|
|
1891
|
-
var se, ne, ce, he, ue, be, pe, t, p, P, _,
|
|
1890
|
+
const Ke = ({ config: s }) => {
|
|
1891
|
+
var se, ne, ce, he, ue, be, pe, t, p, P, _, $, q, Y, Q, oe;
|
|
1892
1892
|
const {
|
|
1893
1893
|
title: d,
|
|
1894
1894
|
fetchData: n = async () => {
|
|
@@ -1897,21 +1897,21 @@ const $e = ({ config: c }) => {
|
|
|
1897
1897
|
tableConfig: o = {},
|
|
1898
1898
|
modalConfig: r = {},
|
|
1899
1899
|
filterConfig: l
|
|
1900
|
-
} =
|
|
1900
|
+
} = s, [N, M] = S(!0), [y, f] = S(!1), [c, g] = S([]), [m, u] = S(null), [k, w] = S({
|
|
1901
1901
|
search: "",
|
|
1902
1902
|
rows_per_page: 50,
|
|
1903
1903
|
current_page: 1
|
|
1904
|
-
}), [C, D] = S({}), [
|
|
1904
|
+
}), [C, D] = S({}), [A, G] = S(!1), [K, j] = S(!1), [O, v] = S(!1), [L, T] = S(!1), [B, b] = S(!1), [I, H] = S(null), V = (x, R) => {
|
|
1905
1905
|
x === "edit" ? (H(R), v(!0)) : x === "view" ? (H(R), b(!0)) : x === "delete" && (H(R), T(!0));
|
|
1906
1906
|
}, J = async (x, R, F = "", Z = "") => {
|
|
1907
1907
|
f(!0);
|
|
1908
1908
|
try {
|
|
1909
|
-
const
|
|
1910
|
-
(F ||
|
|
1909
|
+
const U = await (x == null ? void 0 : x());
|
|
1910
|
+
(F || U.message) && we(F || U.message, {
|
|
1911
1911
|
variant: "success"
|
|
1912
|
-
}), R == null || R(
|
|
1913
|
-
} catch (
|
|
1914
|
-
(Z ||
|
|
1912
|
+
}), R == null || R(U);
|
|
1913
|
+
} catch (U) {
|
|
1914
|
+
(Z || U.message) && we(Z || U.message, { variant: "error" });
|
|
1915
1915
|
} finally {
|
|
1916
1916
|
f(!1);
|
|
1917
1917
|
}
|
|
@@ -1928,7 +1928,7 @@ const $e = ({ config: c }) => {
|
|
|
1928
1928
|
let R = x.newObject, F = x.targetObject;
|
|
1929
1929
|
i ? g(
|
|
1930
1930
|
(Z) => Z.map(
|
|
1931
|
-
(
|
|
1931
|
+
(U) => U.id === F.id ? { ...U, ...R } : U
|
|
1932
1932
|
)
|
|
1933
1933
|
) : ee(), v(!1);
|
|
1934
1934
|
}, te = (x) => {
|
|
@@ -1938,7 +1938,7 @@ const $e = ({ config: c }) => {
|
|
|
1938
1938
|
}
|
|
1939
1939
|
i ? g(
|
|
1940
1940
|
(R) => R.filter((F) => F.id !== x.targetObject.id)
|
|
1941
|
-
) :
|
|
1941
|
+
) : c.length == 1 && k.current_page > 1 ? w((R) => ({
|
|
1942
1942
|
...R,
|
|
1943
1943
|
current_page: R.current_page - 1
|
|
1944
1944
|
})) : ee(), T(!1), H(null);
|
|
@@ -1951,7 +1951,7 @@ const $e = ({ config: c }) => {
|
|
|
1951
1951
|
), le = (x) => J(
|
|
1952
1952
|
() => {
|
|
1953
1953
|
var R, F;
|
|
1954
|
-
return (F = (R = r == null ? void 0 : r.editModal) == null ? void 0 : R.handleSubmit) == null ? void 0 : F.call(R, x,
|
|
1954
|
+
return (F = (R = r == null ? void 0 : r.editModal) == null ? void 0 : R.handleSubmit) == null ? void 0 : F.call(R, x, I);
|
|
1955
1955
|
},
|
|
1956
1956
|
ie
|
|
1957
1957
|
), ee = async () => {
|
|
@@ -1966,20 +1966,20 @@ const $e = ({ config: c }) => {
|
|
|
1966
1966
|
var R;
|
|
1967
1967
|
D((F) => ({
|
|
1968
1968
|
...x
|
|
1969
|
-
})), (R = o == null ? void 0 : o.filter) != null && R.useServerSideFilters &&
|
|
1969
|
+
})), (R = o == null ? void 0 : o.filter) != null && R.useServerSideFilters && G((F) => !F);
|
|
1970
1970
|
}, xe = (x, R) => x.filter(
|
|
1971
|
-
(F) => Object.entries(R).every(([Z,
|
|
1971
|
+
(F) => Object.entries(R).every(([Z, U]) => F[Z] === U)
|
|
1972
1972
|
), ve = Se(() => {
|
|
1973
1973
|
var x;
|
|
1974
|
-
return (x = o == null ? void 0 : o.filter) != null && x.useServerSideFilters ?
|
|
1975
|
-
}, [
|
|
1974
|
+
return (x = o == null ? void 0 : o.filter) != null && x.useServerSideFilters ? c : xe(c, C);
|
|
1975
|
+
}, [c, C]);
|
|
1976
1976
|
return z(() => {
|
|
1977
1977
|
ee();
|
|
1978
1978
|
}, [
|
|
1979
1979
|
k.search,
|
|
1980
1980
|
k.rows_per_page,
|
|
1981
1981
|
k.current_page,
|
|
1982
|
-
|
|
1982
|
+
A
|
|
1983
1983
|
]), /* @__PURE__ */ e(
|
|
1984
1984
|
We,
|
|
1985
1985
|
{
|
|
@@ -2005,7 +2005,7 @@ const $e = ({ config: c }) => {
|
|
|
2005
2005
|
/* @__PURE__ */ h("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-3", children: [
|
|
2006
2006
|
/* @__PURE__ */ h("div", { children: [
|
|
2007
2007
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: d }),
|
|
2008
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children:
|
|
2008
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s == null ? void 0 : s.description })
|
|
2009
2009
|
] }),
|
|
2010
2010
|
/* @__PURE__ */ e("div", { className: "flex items-center space-x-3", children: /* @__PURE__ */ h(
|
|
2011
2011
|
ae,
|
|
@@ -2014,8 +2014,8 @@ const $e = ({ config: c }) => {
|
|
|
2014
2014
|
variant: "contained",
|
|
2015
2015
|
color: "primary",
|
|
2016
2016
|
children: [
|
|
2017
|
-
/* @__PURE__ */ e(
|
|
2018
|
-
|
|
2017
|
+
/* @__PURE__ */ e(Ye, { className: "w-4 h-4 mr-2" }),
|
|
2018
|
+
s.buttonText || "Add New"
|
|
2019
2019
|
]
|
|
2020
2020
|
}
|
|
2021
2021
|
) })
|
|
@@ -2041,7 +2041,7 @@ const $e = ({ config: c }) => {
|
|
|
2041
2041
|
/* @__PURE__ */ e(
|
|
2042
2042
|
me,
|
|
2043
2043
|
{
|
|
2044
|
-
isOpen:
|
|
2044
|
+
isOpen: K,
|
|
2045
2045
|
onClose: () => j(!1),
|
|
2046
2046
|
icon: (se = r.addModal) == null ? void 0 : se.icon,
|
|
2047
2047
|
title: ((ne = r.addModal) == null ? void 0 : ne.title) || "Add New",
|
|
@@ -2082,7 +2082,7 @@ const $e = ({ config: c }) => {
|
|
|
2082
2082
|
{
|
|
2083
2083
|
config: r.editModal || [],
|
|
2084
2084
|
onSubmit: le,
|
|
2085
|
-
initialData:
|
|
2085
|
+
initialData: I,
|
|
2086
2086
|
loading: y
|
|
2087
2087
|
}
|
|
2088
2088
|
)
|
|
@@ -2101,10 +2101,10 @@ const $e = ({ config: c }) => {
|
|
|
2101
2101
|
loading: y,
|
|
2102
2102
|
actionButtons: r.deleteModal.actionButtons,
|
|
2103
2103
|
executeFunction: J,
|
|
2104
|
-
selectedItem:
|
|
2104
|
+
selectedItem: I,
|
|
2105
2105
|
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ h("div", { children: [
|
|
2106
2106
|
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((P = r.deleteModal) == null ? void 0 : P.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2107
|
-
((_ = r.deleteModal) == null ? void 0 : _.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children:
|
|
2107
|
+
((_ = r.deleteModal) == null ? void 0 : _.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: I[($ = r.deleteModal) == null ? void 0 : $.referenceKey] })
|
|
2108
2108
|
] }) })
|
|
2109
2109
|
}
|
|
2110
2110
|
),
|
|
@@ -2116,13 +2116,13 @@ const $e = ({ config: c }) => {
|
|
|
2116
2116
|
b(!1), H(null);
|
|
2117
2117
|
},
|
|
2118
2118
|
icon: (q = r.viewModal) == null ? void 0 : q.icon,
|
|
2119
|
-
title: ((
|
|
2119
|
+
title: ((Y = r.viewModal) == null ? void 0 : Y.title) || "View Details",
|
|
2120
2120
|
size: ((Q = r.viewModal) == null ? void 0 : Q.size) || "lg",
|
|
2121
2121
|
footerConfig: r == null ? void 0 : r.viewModal.footer,
|
|
2122
|
-
children: (oe = r.viewModal) != null && oe.component ? /* @__PURE__ */ e(r.viewModal.component, { data:
|
|
2122
|
+
children: (oe = r.viewModal) != null && oe.component ? /* @__PURE__ */ e(r.viewModal.component, { data: I }) : /* @__PURE__ */ e(
|
|
2123
2123
|
oa,
|
|
2124
2124
|
{
|
|
2125
|
-
data:
|
|
2125
|
+
data: I,
|
|
2126
2126
|
config: r.viewModal || {}
|
|
2127
2127
|
}
|
|
2128
2128
|
)
|
|
@@ -2197,7 +2197,7 @@ const $e = ({ config: c }) => {
|
|
|
2197
2197
|
className: a.string,
|
|
2198
2198
|
format: a.string
|
|
2199
2199
|
});
|
|
2200
|
-
|
|
2200
|
+
Ke.propTypes = {
|
|
2201
2201
|
config: a.shape({
|
|
2202
2202
|
title: a.string.isRequired,
|
|
2203
2203
|
description: a.string,
|
|
@@ -2265,10 +2265,34 @@ $e.propTypes = {
|
|
|
2265
2265
|
})
|
|
2266
2266
|
}).isRequired
|
|
2267
2267
|
};
|
|
2268
|
-
|
|
2269
|
-
|
|
2268
|
+
const ca = () => {
|
|
2269
|
+
if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
|
|
2270
|
+
const s = document.createElement("style");
|
|
2271
|
+
s.id = "react-admin-crud-manager-styles";
|
|
2272
|
+
const d = `
|
|
2273
|
+
.no-spinner::-webkit-outer-spin-button,
|
|
2274
|
+
.no-spinner::-webkit-inner-spin-button {
|
|
2275
|
+
-webkit-appearance: none;
|
|
2276
|
+
margin: 0;
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
.no-spinner {
|
|
2280
|
+
-moz-appearance: textfield;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
.tox.tox-tinymce .tox-edit-area::before {
|
|
2284
|
+
border: 0 !important;
|
|
2285
|
+
box-shadow: none !important;
|
|
2286
|
+
}
|
|
2287
|
+
`;
|
|
2288
|
+
s.textContent = d, document.head.appendChild(s);
|
|
2289
|
+
};
|
|
2290
|
+
function xa(s) {
|
|
2291
|
+
return z(() => {
|
|
2292
|
+
ca();
|
|
2293
|
+
}, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(Ke, { config: s.config }) });
|
|
2270
2294
|
}
|
|
2271
2295
|
export {
|
|
2272
|
-
|
|
2296
|
+
xa as default
|
|
2273
2297
|
};
|
|
2274
2298
|
//# sourceMappingURL=index.es.js.map
|