react-admin-crud-manager 1.0.24 → 1.0.25
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 +32 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +902 -877
- package/dist/index.es.js.map +1 -1
- package/dist/tailwind.css +21 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { jsx as e, Fragment as
|
|
1
|
+
import { jsx as e, Fragment as $, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import Oe, { useState as R, useRef as ae, useEffect as z, useMemo as Le } from "react";
|
|
3
|
-
import { ChevronDown as Be, Search as Ae, Check as
|
|
4
|
-
import { createPortal as
|
|
3
|
+
import { Info as Ve, ChevronDown as Be, Search as Ae, Check as We, X as Se, Plus as qe, Filter as Ze, ChevronLeft as Je, ChevronRight as Qe, EllipsisVertical as Xe, User as Ue, Music as ea } from "lucide-react";
|
|
4
|
+
import { createPortal as aa } from "react-dom";
|
|
5
5
|
import { Icon as re } from "@iconify/react";
|
|
6
|
-
import { Editor as
|
|
7
|
-
import { SnackbarProvider as
|
|
6
|
+
import { Editor as ta } from "@tinymce/tinymce-react";
|
|
7
|
+
import { SnackbarProvider as ra, enqueueSnackbar as Me } from "notistack";
|
|
8
8
|
import r from "prop-types";
|
|
9
|
-
const je = (
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
if (isNaN(
|
|
13
|
-
const
|
|
14
|
-
YYYY:
|
|
15
|
-
YY: String(
|
|
16
|
-
MMMM:
|
|
17
|
-
MMM:
|
|
18
|
-
MM:
|
|
19
|
-
M:
|
|
20
|
-
DD:
|
|
21
|
-
D:
|
|
22
|
-
dddd:
|
|
23
|
-
ddd:
|
|
24
|
-
HH:
|
|
25
|
-
hh:
|
|
26
|
-
mm:
|
|
27
|
-
ss:
|
|
28
|
-
A:
|
|
9
|
+
const je = (h, o = "DD MMM YYYY") => {
|
|
10
|
+
if (!h) return "N/A";
|
|
11
|
+
const l = new Date(h);
|
|
12
|
+
if (isNaN(l)) return "Invalid Date";
|
|
13
|
+
const i = (n) => String(n).padStart(2, "0"), s = {
|
|
14
|
+
YYYY: l.getFullYear(),
|
|
15
|
+
YY: String(l.getFullYear()).slice(-2),
|
|
16
|
+
MMMM: l.toLocaleString("en-US", { month: "long" }),
|
|
17
|
+
MMM: l.toLocaleString("en-US", { month: "short" }),
|
|
18
|
+
MM: i(l.getMonth() + 1),
|
|
19
|
+
M: l.getMonth() + 1,
|
|
20
|
+
DD: i(l.getDate()),
|
|
21
|
+
D: l.getDate(),
|
|
22
|
+
dddd: l.toLocaleString("en-US", { weekday: "long" }),
|
|
23
|
+
ddd: l.toLocaleString("en-US", { weekday: "short" }),
|
|
24
|
+
HH: i(l.getHours()),
|
|
25
|
+
hh: i(l.getHours() % 12 || 12),
|
|
26
|
+
mm: i(l.getMinutes()),
|
|
27
|
+
ss: i(l.getSeconds()),
|
|
28
|
+
A: l.getHours() >= 12 ? "PM" : "AM"
|
|
29
29
|
};
|
|
30
|
-
return
|
|
30
|
+
return o.replace(
|
|
31
31
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
|
-
(n) =>
|
|
32
|
+
(n) => s[n]
|
|
33
33
|
);
|
|
34
|
-
},
|
|
35
|
-
if (!(
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
n[S] !== void 0 &&
|
|
41
|
-
}) :
|
|
42
|
-
(S) => S.toLowerCase().includes(
|
|
34
|
+
}, na = (h, o, l = []) => {
|
|
35
|
+
if (!(o != null && o.trim())) return h;
|
|
36
|
+
const i = o.toLowerCase(), s = (n) => n == null ? [] : typeof n == "object" ? Object.values(n).flatMap(s) : [String(n)];
|
|
37
|
+
return h.filter((n) => {
|
|
38
|
+
let p = [];
|
|
39
|
+
return l.length > 0 ? l.forEach((S) => {
|
|
40
|
+
n[S] !== void 0 && p.push(...s(n[S]));
|
|
41
|
+
}) : p = s(n), p.some(
|
|
42
|
+
(S) => S.toLowerCase().includes(i)
|
|
43
43
|
);
|
|
44
44
|
});
|
|
45
45
|
}, Q = Oe.forwardRef(
|
|
46
46
|
({
|
|
47
|
-
className:
|
|
48
|
-
variant:
|
|
49
|
-
color:
|
|
50
|
-
size:
|
|
51
|
-
fullWidth:
|
|
47
|
+
className: h = "",
|
|
48
|
+
variant: o = "contained",
|
|
49
|
+
color: l = "default",
|
|
50
|
+
size: i = "default",
|
|
51
|
+
fullWidth: s = !1,
|
|
52
52
|
children: n,
|
|
53
|
-
...
|
|
53
|
+
...p
|
|
54
54
|
}, S) => {
|
|
55
|
-
var
|
|
56
|
-
const
|
|
55
|
+
var u;
|
|
56
|
+
const D = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", d = {
|
|
57
57
|
sm: "h-8 px-3 rounded-md text-sm",
|
|
58
58
|
md: "h-9 px-4 rounded-md text-sm",
|
|
59
59
|
lg: "h-11 px-6 rounded-md text-base",
|
|
60
60
|
xl: "h-12 px-8 rounded-lg text-lg",
|
|
61
61
|
default: "h-9 px-4 rounded-md text-sm"
|
|
62
|
-
},
|
|
62
|
+
}, f = {
|
|
63
63
|
primary: {
|
|
64
64
|
contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
|
|
65
65
|
outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
|
|
@@ -80,76 +80,90 @@ const je = (u, l = "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
|
-
}, a = ((
|
|
84
|
-
${
|
|
83
|
+
}, a = ((u = f[l]) == null ? void 0 : u[o]) || f.default.contained, m = d[i], v = `
|
|
84
|
+
${D}
|
|
85
85
|
${a}
|
|
86
|
-
${
|
|
87
|
-
${
|
|
88
|
-
${
|
|
86
|
+
${m}
|
|
87
|
+
${s ? "w-full" : ""}
|
|
88
|
+
${h}
|
|
89
89
|
`.trim();
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
91
|
"button",
|
|
92
92
|
{
|
|
93
93
|
ref: S,
|
|
94
|
-
type:
|
|
95
|
-
className:
|
|
96
|
-
...
|
|
94
|
+
type: p.type || "button",
|
|
95
|
+
className: v,
|
|
96
|
+
...p,
|
|
97
97
|
children: n
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
Q.displayName = "Button";
|
|
103
|
-
function
|
|
104
|
-
return /* @__PURE__ */ e(
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
function q({ label: h, required: o = !1, infoText: l = "" }) {
|
|
104
|
+
return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("label", { className: "flex text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
|
+
h,
|
|
106
|
+
o && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" }),
|
|
107
|
+
l && /* @__PURE__ */ c("span", { className: "ml-2 relative group inline-flex items-center cursor-pointer", children: [
|
|
108
|
+
/* @__PURE__ */ e(Ve, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" }),
|
|
109
|
+
/* @__PURE__ */ e(
|
|
110
|
+
"span",
|
|
111
|
+
{
|
|
112
|
+
className: `absolute left-1/2 top-full mt-2\r
|
|
113
|
+
w-max max-w-xs bg-white text-black dark:bg-black dark:text-white text-xs\r
|
|
114
|
+
rounded px-2 py-1 opacity-0 shadow-lg\r
|
|
115
|
+
group-hover:opacity-100 transition-opacity\r
|
|
116
|
+
duration-200 pointer-events-none z-50`,
|
|
117
|
+
children: l
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
107
121
|
] }) });
|
|
108
122
|
}
|
|
109
|
-
const
|
|
110
|
-
options:
|
|
111
|
-
value:
|
|
112
|
-
defaultValue:
|
|
113
|
-
onChange:
|
|
114
|
-
placeholder:
|
|
123
|
+
const la = ({
|
|
124
|
+
options: h = [],
|
|
125
|
+
value: o = "",
|
|
126
|
+
defaultValue: l = "",
|
|
127
|
+
onChange: i,
|
|
128
|
+
placeholder: s = "Select option",
|
|
115
129
|
className: n = "",
|
|
116
|
-
disabled:
|
|
130
|
+
disabled: p = !1,
|
|
117
131
|
search: S = !1,
|
|
118
|
-
label:
|
|
119
|
-
required:
|
|
120
|
-
name:
|
|
132
|
+
label: D = "",
|
|
133
|
+
required: d = !1,
|
|
134
|
+
name: f = "",
|
|
121
135
|
parentClass: a = "",
|
|
122
|
-
multiple:
|
|
136
|
+
multiple: m = !1,
|
|
123
137
|
// ✅ NEW
|
|
124
|
-
dropdownMaxHeight:
|
|
125
|
-
formData:
|
|
126
|
-
dependencyKey:
|
|
138
|
+
dropdownMaxHeight: v = "",
|
|
139
|
+
formData: u = {},
|
|
140
|
+
dependencyKey: y = ""
|
|
127
141
|
}) => {
|
|
128
142
|
var _;
|
|
129
|
-
const [x, N] = R(!1), [
|
|
130
|
-
let G =
|
|
131
|
-
const
|
|
143
|
+
const [x, N] = R(!1), [I, P] = R(""), [M, L] = R(!0), B = ae(null), F = ae(null), [C, E] = R([]);
|
|
144
|
+
let G = o || o === !1 ? o : l;
|
|
145
|
+
const Y = (k) => k == null || k === "" ? "" : String(typeof k == "boolean" ? k : k ?? "");
|
|
132
146
|
z(
|
|
133
147
|
() => {
|
|
134
148
|
(async () => {
|
|
135
|
-
if (typeof
|
|
136
|
-
const
|
|
137
|
-
j
|
|
149
|
+
if (typeof h == "function") {
|
|
150
|
+
const j = await h(u);
|
|
151
|
+
E(j);
|
|
138
152
|
} else
|
|
139
|
-
|
|
153
|
+
E(h || []);
|
|
140
154
|
})();
|
|
141
155
|
},
|
|
142
|
-
|
|
156
|
+
y ? [h, u == null ? void 0 : u[y]] : [h]
|
|
143
157
|
);
|
|
144
|
-
const
|
|
145
|
-
(k) => k.label.toLowerCase().includes(
|
|
146
|
-
),
|
|
147
|
-
const
|
|
148
|
-
return
|
|
158
|
+
const W = m ? (G || []).map(Y) : Y(G), U = C.filter(
|
|
159
|
+
(k) => k.label.toLowerCase().includes(I.toLowerCase())
|
|
160
|
+
), K = (k) => {
|
|
161
|
+
const j = Y(k);
|
|
162
|
+
return m ? W.includes(j) : j === W;
|
|
149
163
|
};
|
|
150
164
|
z(() => {
|
|
151
|
-
const k = (
|
|
152
|
-
B.current && !B.current.contains(
|
|
165
|
+
const k = (j) => {
|
|
166
|
+
B.current && !B.current.contains(j.target) && (N(!1), P(""));
|
|
153
167
|
};
|
|
154
168
|
return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
|
|
155
169
|
}, []), z(() => {
|
|
@@ -158,49 +172,49 @@ const na = ({
|
|
|
158
172
|
L(X < 200);
|
|
159
173
|
}
|
|
160
174
|
}, [x]), z(() => {
|
|
161
|
-
x &&
|
|
175
|
+
x && F.current && F.current.focus();
|
|
162
176
|
}, [x]);
|
|
163
|
-
const
|
|
164
|
-
let
|
|
165
|
-
if (k === "true" ?
|
|
166
|
-
const X =
|
|
177
|
+
const Z = (k) => {
|
|
178
|
+
let j = k;
|
|
179
|
+
if (k === "true" ? j = !0 : k === "false" && (j = !1), m) {
|
|
180
|
+
const X = W.includes(Y(k));
|
|
167
181
|
let J;
|
|
168
|
-
X ? J =
|
|
169
|
-
(ee) =>
|
|
170
|
-
) : J = [...
|
|
182
|
+
X ? J = o.filter(
|
|
183
|
+
(ee) => Y(ee) !== Y(k)
|
|
184
|
+
) : J = [...o || [], j], i(J);
|
|
171
185
|
} else
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
},
|
|
186
|
+
i(j), N(!1);
|
|
187
|
+
P("");
|
|
188
|
+
}, O = m ? C.filter((k) => K(k.value)).map((k) => k.label).join(", ") : (_ = C.find((k) => K(k.value))) == null ? void 0 : _.label;
|
|
175
189
|
return z(() => {
|
|
176
190
|
(G || G === !1) && setTimeout(() => {
|
|
177
|
-
|
|
191
|
+
i(G);
|
|
178
192
|
}, 100);
|
|
179
|
-
}, []), /* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */ e(
|
|
181
|
-
/* @__PURE__ */
|
|
193
|
+
}, []), /* @__PURE__ */ c("div", { className: a || "col-span-12", children: [
|
|
194
|
+
/* @__PURE__ */ e(q, { label: D, required: d }),
|
|
195
|
+
/* @__PURE__ */ c("div", { className: `relative ${n}`, ref: B, children: [
|
|
182
196
|
/* @__PURE__ */ e(
|
|
183
197
|
"select",
|
|
184
198
|
{
|
|
185
199
|
name: "hidden_select_for_validation",
|
|
186
|
-
value:
|
|
187
|
-
required:
|
|
188
|
-
multiple:
|
|
200
|
+
value: O || "",
|
|
201
|
+
required: d,
|
|
202
|
+
multiple: m,
|
|
189
203
|
className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
|
|
190
|
-
children: /* @__PURE__ */ e("option", { hidden: !0, value:
|
|
204
|
+
children: /* @__PURE__ */ e("option", { hidden: !0, value: O, children: O })
|
|
191
205
|
}
|
|
192
206
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ c(
|
|
194
208
|
"button",
|
|
195
209
|
{
|
|
196
210
|
type: "button",
|
|
197
|
-
onClick: () => !
|
|
198
|
-
disabled:
|
|
211
|
+
onClick: () => !p && N(!x),
|
|
212
|
+
disabled: p,
|
|
199
213
|
className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
|
|
200
|
-
${
|
|
201
|
-
${
|
|
214
|
+
${O ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
|
|
215
|
+
${p ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
|
|
202
216
|
children: [
|
|
203
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
217
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: O || s }),
|
|
204
218
|
/* @__PURE__ */ e(
|
|
205
219
|
Be,
|
|
206
220
|
{
|
|
@@ -210,21 +224,21 @@ const na = ({
|
|
|
210
224
|
]
|
|
211
225
|
}
|
|
212
226
|
),
|
|
213
|
-
x && /* @__PURE__ */
|
|
227
|
+
x && /* @__PURE__ */ c(
|
|
214
228
|
"div",
|
|
215
229
|
{
|
|
216
230
|
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
217
231
|
${M ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
218
232
|
children: [
|
|
219
|
-
S && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */
|
|
233
|
+
S && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
220
234
|
/* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
221
235
|
/* @__PURE__ */ e(
|
|
222
236
|
"input",
|
|
223
237
|
{
|
|
224
|
-
ref:
|
|
238
|
+
ref: F,
|
|
225
239
|
type: "text",
|
|
226
|
-
value:
|
|
227
|
-
onChange: (k) =>
|
|
240
|
+
value: I,
|
|
241
|
+
onChange: (k) => P(k.target.value),
|
|
228
242
|
placeholder: "Search...",
|
|
229
243
|
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
|
|
230
244
|
}
|
|
@@ -235,18 +249,18 @@ const na = ({
|
|
|
235
249
|
{
|
|
236
250
|
className: "max-h-40 overflow-y-auto",
|
|
237
251
|
style: {
|
|
238
|
-
maxHeight:
|
|
252
|
+
maxHeight: v || ""
|
|
239
253
|
},
|
|
240
|
-
children:
|
|
254
|
+
children: U.length > 0 ? U.map((k) => /* @__PURE__ */ c(
|
|
241
255
|
"button",
|
|
242
256
|
{
|
|
243
257
|
type: "button",
|
|
244
|
-
onClick: () =>
|
|
258
|
+
onClick: () => Z(String(k.value)),
|
|
245
259
|
className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
|
|
246
|
-
${
|
|
260
|
+
${K(k.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
247
261
|
children: [
|
|
248
262
|
/* @__PURE__ */ e("span", { children: k.label }),
|
|
249
|
-
|
|
263
|
+
m && K(k.value) && /* @__PURE__ */ e(We, { className: "w-4 h-4" })
|
|
250
264
|
]
|
|
251
265
|
},
|
|
252
266
|
String(k.value)
|
|
@@ -257,27 +271,27 @@ const na = ({
|
|
|
257
271
|
}
|
|
258
272
|
)
|
|
259
273
|
] })
|
|
260
|
-
] },
|
|
261
|
-
},
|
|
262
|
-
value:
|
|
263
|
-
onChange:
|
|
264
|
-
text:
|
|
265
|
-
options:
|
|
266
|
-
label:
|
|
274
|
+
] }, f);
|
|
275
|
+
}, oa = ({
|
|
276
|
+
value: h = !0,
|
|
277
|
+
onChange: o,
|
|
278
|
+
text: l,
|
|
279
|
+
options: i = [],
|
|
280
|
+
label: s,
|
|
267
281
|
required: n,
|
|
268
|
-
name:
|
|
282
|
+
name: p = "",
|
|
269
283
|
disabled: S = !1,
|
|
270
|
-
parentClass:
|
|
284
|
+
parentClass: D = ""
|
|
271
285
|
}) => {
|
|
272
|
-
const
|
|
286
|
+
const d = i.length > 0 ? i : [
|
|
273
287
|
{ label: "Active", value: !0 },
|
|
274
288
|
{ label: "Inactive", value: !1 }
|
|
275
289
|
];
|
|
276
|
-
return /* @__PURE__ */ e(
|
|
277
|
-
/* @__PURE__ */ e(
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children:
|
|
290
|
+
return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: D || "col-span-12", children: [
|
|
291
|
+
/* @__PURE__ */ e(q, { label: s, required: n }),
|
|
292
|
+
/* @__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: [
|
|
293
|
+
l && /* @__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: l }),
|
|
294
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: d.map((f, a) => /* @__PURE__ */ c(
|
|
281
295
|
"label",
|
|
282
296
|
{
|
|
283
297
|
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
@@ -288,20 +302,20 @@ const na = ({
|
|
|
288
302
|
type: "radio",
|
|
289
303
|
name: "switch-field",
|
|
290
304
|
required: n && a === 0,
|
|
291
|
-
value:
|
|
305
|
+
value: f.value,
|
|
292
306
|
disabled: S,
|
|
293
|
-
checked:
|
|
294
|
-
onChange: () =>
|
|
307
|
+
checked: h === f.value,
|
|
308
|
+
onChange: () => o(f.value),
|
|
295
309
|
className: "w-4 h-4 border-gray-300 cursor-pointer"
|
|
296
310
|
}
|
|
297
311
|
),
|
|
298
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children:
|
|
312
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: f.label })
|
|
299
313
|
]
|
|
300
314
|
},
|
|
301
315
|
a
|
|
302
316
|
)) })
|
|
303
317
|
] })
|
|
304
|
-
] },
|
|
318
|
+
] }, p) });
|
|
305
319
|
}, ke = [
|
|
306
320
|
{ label: "Afghanistan", code: "AF", phone: "93" },
|
|
307
321
|
{ label: "Aland Islands", code: "AX", phone: "358" },
|
|
@@ -554,58 +568,58 @@ const na = ({
|
|
|
554
568
|
{ label: "Zambia", code: "ZM", phone: "260" },
|
|
555
569
|
{ label: "Zimbabwe", code: "ZW", phone: "263" }
|
|
556
570
|
];
|
|
557
|
-
function
|
|
558
|
-
label:
|
|
559
|
-
value:
|
|
560
|
-
name:
|
|
561
|
-
parentClass:
|
|
562
|
-
onChange:
|
|
571
|
+
function ia({
|
|
572
|
+
label: h = "",
|
|
573
|
+
value: o = "",
|
|
574
|
+
name: l = "",
|
|
575
|
+
parentClass: i = "",
|
|
576
|
+
onChange: s,
|
|
563
577
|
disabled: n = !1,
|
|
564
|
-
required:
|
|
578
|
+
required: p = !1,
|
|
565
579
|
placeholder: S = "Phone number",
|
|
566
|
-
search:
|
|
567
|
-
countriesList:
|
|
568
|
-
defaultCountry:
|
|
580
|
+
search: D = !1,
|
|
581
|
+
countriesList: d = !1,
|
|
582
|
+
defaultCountry: f = ""
|
|
569
583
|
}) {
|
|
570
|
-
const a = (C) => ke.find((
|
|
571
|
-
a(
|
|
572
|
-
), [
|
|
584
|
+
const a = (C) => ke.find((E) => E.code == C), [m, v] = R(
|
|
585
|
+
a(f) || ke[0]
|
|
586
|
+
), [u, y] = R(""), [x, N] = R(!1), [I, P] = R(""), M = ae();
|
|
573
587
|
z(() => {
|
|
574
|
-
if (typeof
|
|
575
|
-
const C = ke.filter((
|
|
588
|
+
if (typeof o == "string" && o.startsWith("+")) {
|
|
589
|
+
const C = ke.filter((E) => o.startsWith("+" + E.phone)).sort((E, G) => G.phone.length - E.phone.length)[0];
|
|
576
590
|
if (C) {
|
|
577
|
-
|
|
591
|
+
v(C), y(o.replace("+" + C.phone, ""));
|
|
578
592
|
return;
|
|
579
593
|
}
|
|
580
594
|
}
|
|
581
|
-
|
|
582
|
-
}, [
|
|
595
|
+
y(o);
|
|
596
|
+
}, [o]);
|
|
583
597
|
const L = (C) => {
|
|
584
|
-
const
|
|
585
|
-
|
|
598
|
+
const E = C.target.value.replace(/\D/g, "");
|
|
599
|
+
y(E), m && s && s("+" + m.phone + E);
|
|
586
600
|
}, B = (C) => {
|
|
587
|
-
|
|
601
|
+
v(C), s && s("+" + C.phone + u), N(!1), P("");
|
|
588
602
|
};
|
|
589
603
|
z(() => {
|
|
590
|
-
const C = (
|
|
591
|
-
M.current && !M.current.contains(
|
|
604
|
+
const C = (E) => {
|
|
605
|
+
M.current && !M.current.contains(E.target) && N(!1);
|
|
592
606
|
};
|
|
593
607
|
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
594
608
|
}, []);
|
|
595
|
-
const
|
|
596
|
-
(C) => C.label.toLowerCase().includes(
|
|
609
|
+
const F = ke.filter(
|
|
610
|
+
(C) => C.label.toLowerCase().includes(I.toLowerCase()) || C.phone.includes(I)
|
|
597
611
|
);
|
|
598
|
-
return
|
|
599
|
-
/* @__PURE__ */ e(
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
612
|
+
return d ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
613
|
+
/* @__PURE__ */ e(q, { label: h, required: p }),
|
|
614
|
+
/* @__PURE__ */ c("div", { className: "relative ", ref: M, children: [
|
|
615
|
+
/* @__PURE__ */ c(
|
|
602
616
|
"div",
|
|
603
617
|
{
|
|
604
618
|
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
605
619
|
${x ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
606
620
|
${n ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
607
621
|
children: [
|
|
608
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ c(
|
|
609
623
|
"button",
|
|
610
624
|
{
|
|
611
625
|
type: "button",
|
|
@@ -613,11 +627,11 @@ function oa({
|
|
|
613
627
|
onClick: () => N(!x),
|
|
614
628
|
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
615
629
|
children: [
|
|
616
|
-
|
|
630
|
+
m ? /* @__PURE__ */ e(
|
|
617
631
|
"img",
|
|
618
632
|
{
|
|
619
|
-
src: `https://flagcdn.com/w20/${
|
|
620
|
-
alt:
|
|
633
|
+
src: `https://flagcdn.com/w20/${m.code.toLowerCase()}.png`,
|
|
634
|
+
alt: m.code,
|
|
621
635
|
className: "w-5 h-3 object-cover"
|
|
622
636
|
}
|
|
623
637
|
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
@@ -625,19 +639,19 @@ function oa({
|
|
|
625
639
|
]
|
|
626
640
|
}
|
|
627
641
|
),
|
|
628
|
-
|
|
642
|
+
m && /* @__PURE__ */ c("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
|
|
629
643
|
"+",
|
|
630
|
-
|
|
644
|
+
m.phone
|
|
631
645
|
] }),
|
|
632
646
|
/* @__PURE__ */ e(
|
|
633
647
|
"input",
|
|
634
648
|
{
|
|
635
649
|
type: "tel",
|
|
636
|
-
value:
|
|
650
|
+
value: u,
|
|
637
651
|
onChange: L,
|
|
638
|
-
required:
|
|
639
|
-
disabled: n || !
|
|
640
|
-
placeholder:
|
|
652
|
+
required: p,
|
|
653
|
+
disabled: n || !m,
|
|
654
|
+
placeholder: m ? S : "Select a country",
|
|
641
655
|
className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
|
|
642
656
|
}
|
|
643
657
|
),
|
|
@@ -645,10 +659,10 @@ function oa({
|
|
|
645
659
|
"input",
|
|
646
660
|
{
|
|
647
661
|
type: "tel",
|
|
648
|
-
required:
|
|
662
|
+
required: p,
|
|
649
663
|
tabIndex: -1,
|
|
650
664
|
readOnly: !0,
|
|
651
|
-
value:
|
|
665
|
+
value: m && u ? "+" + m.phone + u : "",
|
|
652
666
|
style: {
|
|
653
667
|
position: "absolute",
|
|
654
668
|
opacity: 0,
|
|
@@ -660,21 +674,21 @@ function oa({
|
|
|
660
674
|
]
|
|
661
675
|
}
|
|
662
676
|
),
|
|
663
|
-
x && /* @__PURE__ */
|
|
664
|
-
|
|
677
|
+
x && /* @__PURE__ */ c("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
|
|
678
|
+
D && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
665
679
|
/* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
666
680
|
/* @__PURE__ */ e(
|
|
667
681
|
"input",
|
|
668
682
|
{
|
|
669
683
|
type: "text",
|
|
670
|
-
value:
|
|
671
|
-
onChange: (C) =>
|
|
684
|
+
value: I,
|
|
685
|
+
onChange: (C) => P(C.target.value),
|
|
672
686
|
placeholder: "Search country...",
|
|
673
687
|
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
|
|
674
688
|
}
|
|
675
689
|
)
|
|
676
690
|
] }) }),
|
|
677
|
-
|
|
691
|
+
F.map((C) => /* @__PURE__ */ c(
|
|
678
692
|
"button",
|
|
679
693
|
{
|
|
680
694
|
type: "button",
|
|
@@ -689,7 +703,7 @@ function oa({
|
|
|
689
703
|
className: "w-5 h-3 object-cover"
|
|
690
704
|
}
|
|
691
705
|
),
|
|
692
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ c("span", { children: [
|
|
693
707
|
C.label,
|
|
694
708
|
" (+",
|
|
695
709
|
C.phone,
|
|
@@ -701,20 +715,20 @@ function oa({
|
|
|
701
715
|
))
|
|
702
716
|
] })
|
|
703
717
|
] })
|
|
704
|
-
] },
|
|
705
|
-
/* @__PURE__ */ e(
|
|
718
|
+
] }, l) }) : /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
|
|
719
|
+
/* @__PURE__ */ e(q, { label: h, required: p }),
|
|
706
720
|
/* @__PURE__ */ e(
|
|
707
721
|
"input",
|
|
708
722
|
{
|
|
709
723
|
type: "text",
|
|
710
|
-
value:
|
|
711
|
-
onChange: (
|
|
712
|
-
const G =
|
|
713
|
-
|
|
724
|
+
value: o,
|
|
725
|
+
onChange: (E) => {
|
|
726
|
+
const G = E.target.value.replace(/[^+\d]/g, ""), Y = G.startsWith("+") ? "+" + G.replace(/[+]/g, "").slice(0) : G;
|
|
727
|
+
s(Y);
|
|
714
728
|
},
|
|
715
729
|
placeholder: S,
|
|
716
730
|
disabled: n,
|
|
717
|
-
required:
|
|
731
|
+
required: p,
|
|
718
732
|
className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
|
|
719
733
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
|
|
720
734
|
focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
|
|
@@ -722,103 +736,103 @@ function oa({
|
|
|
722
736
|
pattern: "^\\+\\d{1,15}$"
|
|
723
737
|
}
|
|
724
738
|
)
|
|
725
|
-
] },
|
|
739
|
+
] }, l) });
|
|
726
740
|
}
|
|
727
741
|
const Ee = Oe.forwardRef(
|
|
728
|
-
({ className:
|
|
742
|
+
({ className: h = "", label: o, required: l, ...i }, s) => {
|
|
729
743
|
const n = `
|
|
730
744
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
731
|
-
${
|
|
745
|
+
${h}
|
|
732
746
|
`.trim();
|
|
733
|
-
return /* @__PURE__ */ e(
|
|
734
|
-
/* @__PURE__ */ e(
|
|
747
|
+
return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: i.parentClass || "col-span-12", children: [
|
|
748
|
+
/* @__PURE__ */ e(q, { label: o, required: l }),
|
|
735
749
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
736
750
|
"textarea",
|
|
737
751
|
{
|
|
738
752
|
className: n,
|
|
739
|
-
ref:
|
|
740
|
-
required:
|
|
741
|
-
...
|
|
753
|
+
ref: s,
|
|
754
|
+
required: l,
|
|
755
|
+
...i
|
|
742
756
|
}
|
|
743
757
|
) })
|
|
744
|
-
] },
|
|
758
|
+
] }, i.name) });
|
|
745
759
|
}
|
|
746
760
|
);
|
|
747
761
|
Ee.displayName = "TextArea";
|
|
748
|
-
const
|
|
749
|
-
label:
|
|
750
|
-
value:
|
|
751
|
-
onChange:
|
|
752
|
-
required:
|
|
753
|
-
accept:
|
|
762
|
+
const sa = ({
|
|
763
|
+
label: h = "",
|
|
764
|
+
value: o = null,
|
|
765
|
+
onChange: l,
|
|
766
|
+
required: i = !1,
|
|
767
|
+
accept: s = "image/*",
|
|
754
768
|
id: n,
|
|
755
|
-
dragDrop:
|
|
769
|
+
dragDrop: p = !1,
|
|
756
770
|
name: S = "",
|
|
757
|
-
parentClass:
|
|
771
|
+
parentClass: D = ""
|
|
758
772
|
}) => {
|
|
759
|
-
const [
|
|
760
|
-
z(() => (
|
|
761
|
-
|
|
762
|
-
}), [
|
|
763
|
-
const
|
|
773
|
+
const [d, f] = R(o), [a, m] = R(!1), v = ae(null);
|
|
774
|
+
z(() => (o instanceof File ? f({ file: o, preview: URL.createObjectURL(o) }) : (o != null && o.preview, f(o)), () => {
|
|
775
|
+
d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview);
|
|
776
|
+
}), [o]);
|
|
777
|
+
const u = (M) => {
|
|
764
778
|
if (!M || M.length === 0)
|
|
765
779
|
return;
|
|
766
|
-
const L = M[0], B = URL.createObjectURL(L),
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
M && M.stopPropagation(),
|
|
780
|
+
const L = M[0], B = URL.createObjectURL(L), F = { file: L, preview: B };
|
|
781
|
+
d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview), f(F), l == null || l(L);
|
|
782
|
+
}, y = (M) => {
|
|
783
|
+
M && M.stopPropagation(), d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview), f(null), l == null || l(null), v.current && (v.current.value = "");
|
|
770
784
|
}, x = (M) => {
|
|
771
|
-
|
|
785
|
+
p && (M.preventDefault(), m(!0));
|
|
772
786
|
}, N = (M) => {
|
|
773
|
-
|
|
774
|
-
},
|
|
775
|
-
|
|
776
|
-
},
|
|
777
|
-
|
|
787
|
+
p && (M.preventDefault(), m(!1));
|
|
788
|
+
}, I = (M) => {
|
|
789
|
+
p && (M.preventDefault(), m(!1), u(M.dataTransfer.files));
|
|
790
|
+
}, P = () => {
|
|
791
|
+
v.current.click();
|
|
778
792
|
};
|
|
779
|
-
return /* @__PURE__ */ e(
|
|
780
|
-
/* @__PURE__ */ e(
|
|
781
|
-
/* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: D || "col-span-12", children: [
|
|
794
|
+
/* @__PURE__ */ e(q, { label: h, required: i }),
|
|
795
|
+
/* @__PURE__ */ c(
|
|
782
796
|
"div",
|
|
783
797
|
{
|
|
784
798
|
className: `relative rounded-md p-2 transition-all ${a ? "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"}`,
|
|
785
799
|
onDragOver: x,
|
|
786
800
|
onDragLeave: N,
|
|
787
|
-
onDrop:
|
|
801
|
+
onDrop: I,
|
|
788
802
|
children: [
|
|
789
803
|
/* @__PURE__ */ e(
|
|
790
804
|
"input",
|
|
791
805
|
{
|
|
792
|
-
ref:
|
|
806
|
+
ref: v,
|
|
793
807
|
id: n,
|
|
794
808
|
type: "file",
|
|
795
|
-
accept:
|
|
796
|
-
onChange: (M) =>
|
|
797
|
-
required:
|
|
809
|
+
accept: s,
|
|
810
|
+
onChange: (M) => u(M.target.files),
|
|
811
|
+
required: i && !d,
|
|
798
812
|
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
799
813
|
}
|
|
800
814
|
),
|
|
801
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ c(
|
|
802
816
|
"div",
|
|
803
817
|
{
|
|
804
818
|
className: `flex items-center space-x-4 transition-all ${a ? "opacity-50" : ""}`,
|
|
805
819
|
children: [
|
|
806
|
-
|
|
820
|
+
d ? (
|
|
807
821
|
// Image preview with close button
|
|
808
|
-
/* @__PURE__ */
|
|
822
|
+
/* @__PURE__ */ c("div", { className: "relative group", children: [
|
|
809
823
|
/* @__PURE__ */ e(
|
|
810
824
|
"img",
|
|
811
825
|
{
|
|
812
|
-
src:
|
|
826
|
+
src: d.preview || d,
|
|
813
827
|
alt: "preview",
|
|
814
828
|
className: "object-cover w-20 h-20 rounded-full shadow-md"
|
|
815
829
|
}
|
|
816
830
|
),
|
|
817
|
-
!
|
|
831
|
+
!i && /* @__PURE__ */ e(
|
|
818
832
|
"button",
|
|
819
833
|
{
|
|
820
834
|
type: "button",
|
|
821
|
-
onClick:
|
|
835
|
+
onClick: y,
|
|
822
836
|
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
|
|
823
837
|
"aria-label": "Remove image",
|
|
824
838
|
children: /* @__PURE__ */ e(re, { icon: "mdi:close", className: "w-3 h-3" })
|
|
@@ -835,135 +849,143 @@ const ia = ({
|
|
|
835
849
|
}
|
|
836
850
|
) })
|
|
837
851
|
),
|
|
838
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col items-center space-y-1", children: [
|
|
839
853
|
/* @__PURE__ */ e(
|
|
840
854
|
Q,
|
|
841
855
|
{
|
|
842
856
|
type: "button",
|
|
843
|
-
onClick:
|
|
857
|
+
onClick: P,
|
|
844
858
|
variant: "outlined",
|
|
845
859
|
color: "default",
|
|
846
|
-
children:
|
|
860
|
+
children: d ? "Change Image" : "Select Image"
|
|
847
861
|
}
|
|
848
862
|
),
|
|
849
|
-
|
|
863
|
+
p && !d && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
|
|
850
864
|
] })
|
|
851
865
|
]
|
|
852
866
|
}
|
|
853
867
|
),
|
|
854
|
-
|
|
868
|
+
p && a && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
|
|
855
869
|
]
|
|
856
870
|
}
|
|
857
871
|
)
|
|
858
872
|
] }, S) });
|
|
859
873
|
}, $e = Oe.forwardRef(
|
|
860
874
|
({
|
|
861
|
-
label:
|
|
862
|
-
required:
|
|
863
|
-
parentClass:
|
|
864
|
-
className:
|
|
865
|
-
type:
|
|
875
|
+
label: h,
|
|
876
|
+
required: o,
|
|
877
|
+
parentClass: l = "",
|
|
878
|
+
className: i = "",
|
|
879
|
+
type: s = "text",
|
|
866
880
|
onKeyDown: n,
|
|
867
|
-
negativeNumberAllow:
|
|
881
|
+
negativeNumberAllow: p = !0,
|
|
868
882
|
defaultValue: S = "",
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
883
|
+
field: D = {},
|
|
884
|
+
...d
|
|
885
|
+
}, f) => {
|
|
886
|
+
const [a, m] = R(!1), v = (y) => {
|
|
887
|
+
if (s === "number") {
|
|
888
|
+
if (["e", "E", "+"].includes(y.key)) {
|
|
889
|
+
y.preventDefault();
|
|
875
890
|
return;
|
|
876
891
|
}
|
|
877
|
-
if (
|
|
878
|
-
|
|
892
|
+
if (p == !1 && y.key === "-") {
|
|
893
|
+
y.preventDefault();
|
|
879
894
|
return;
|
|
880
895
|
}
|
|
881
|
-
if (["ArrowUp", "ArrowDown"].includes(
|
|
882
|
-
|
|
896
|
+
if (["ArrowUp", "ArrowDown"].includes(y.key)) {
|
|
897
|
+
y.preventDefault();
|
|
883
898
|
return;
|
|
884
899
|
}
|
|
885
900
|
}
|
|
886
|
-
n == null || n(
|
|
887
|
-
},
|
|
901
|
+
n == null || n(y);
|
|
902
|
+
}, u = `
|
|
888
903
|
h-10 placeholder-gray-400 dark:placeholder-gray-400
|
|
889
|
-
${
|
|
890
|
-
${
|
|
891
|
-
${
|
|
904
|
+
${s === "password" ? "pr-10" : ""}
|
|
905
|
+
${s === "number" ? "no-spinner" : ""}
|
|
906
|
+
${i}
|
|
892
907
|
`.trim();
|
|
893
908
|
return z(() => {
|
|
894
909
|
if (S) {
|
|
895
|
-
let
|
|
910
|
+
let y = d.value || S;
|
|
896
911
|
setTimeout(() => {
|
|
897
|
-
var
|
|
898
|
-
(
|
|
912
|
+
var x;
|
|
913
|
+
(x = d.onChange) == null || x.call(d, { target: { value: y } });
|
|
899
914
|
}, 100);
|
|
900
915
|
}
|
|
901
|
-
}, [S]), /* @__PURE__ */ e(
|
|
902
|
-
/* @__PURE__ */ e(
|
|
903
|
-
|
|
916
|
+
}, [S]), /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: l || "col-span-12", children: [
|
|
917
|
+
/* @__PURE__ */ e(
|
|
918
|
+
q,
|
|
919
|
+
{
|
|
920
|
+
label: h,
|
|
921
|
+
required: o,
|
|
922
|
+
infoText: D.infoText
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
904
926
|
/* @__PURE__ */ e(
|
|
905
927
|
"input",
|
|
906
928
|
{
|
|
907
|
-
type:
|
|
908
|
-
ref:
|
|
909
|
-
required:
|
|
910
|
-
onKeyDown:
|
|
911
|
-
className:
|
|
912
|
-
...
|
|
929
|
+
type: s === "password" && a ? "text" : s,
|
|
930
|
+
ref: f,
|
|
931
|
+
required: o,
|
|
932
|
+
onKeyDown: v,
|
|
933
|
+
className: u,
|
|
934
|
+
...d
|
|
913
935
|
}
|
|
914
936
|
),
|
|
915
|
-
|
|
937
|
+
s === "password" && /* @__PURE__ */ e(
|
|
916
938
|
"button",
|
|
917
939
|
{
|
|
918
940
|
type: "button",
|
|
919
941
|
tabIndex: -1,
|
|
920
|
-
onClick: () =>
|
|
942
|
+
onClick: () => m((y) => !y),
|
|
921
943
|
className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
|
|
922
944
|
children: /* @__PURE__ */ e(
|
|
923
945
|
re,
|
|
924
946
|
{
|
|
925
|
-
icon:
|
|
947
|
+
icon: a ? "mdi:eye-outline" : "mdi:eye-off-outline",
|
|
926
948
|
className: "w-5 h-5"
|
|
927
949
|
}
|
|
928
950
|
)
|
|
929
951
|
}
|
|
930
952
|
)
|
|
931
953
|
] })
|
|
932
|
-
] },
|
|
954
|
+
] }, d.name) });
|
|
933
955
|
}
|
|
934
956
|
);
|
|
935
957
|
$e.displayName = "Input";
|
|
936
|
-
const
|
|
937
|
-
key:
|
|
938
|
-
editorKey:
|
|
939
|
-
value:
|
|
940
|
-
onChange:
|
|
941
|
-
label:
|
|
958
|
+
const da = ({
|
|
959
|
+
key: h,
|
|
960
|
+
editorKey: o = "",
|
|
961
|
+
value: l = "",
|
|
962
|
+
onChange: i,
|
|
963
|
+
label: s = "",
|
|
942
964
|
required: n = !1,
|
|
943
|
-
placeholder:
|
|
965
|
+
placeholder: p = "",
|
|
944
966
|
parentClass: S = "col-span-12",
|
|
945
|
-
height:
|
|
946
|
-
inline:
|
|
947
|
-
disabled:
|
|
967
|
+
height: D = 400,
|
|
968
|
+
inline: d = !1,
|
|
969
|
+
disabled: f = !1,
|
|
948
970
|
plugins: a,
|
|
949
|
-
toolbar:
|
|
950
|
-
menubar:
|
|
951
|
-
fontFamily:
|
|
952
|
-
initConfig:
|
|
971
|
+
toolbar: m,
|
|
972
|
+
menubar: v = !1,
|
|
973
|
+
fontFamily: u = "Inter, sans-serif",
|
|
974
|
+
initConfig: y = {},
|
|
953
975
|
imageUploadHandler: x
|
|
954
976
|
// ✅ Promise function passed from parent
|
|
955
|
-
}) => /* @__PURE__ */
|
|
956
|
-
|
|
977
|
+
}) => /* @__PURE__ */ c("div", { className: S, children: [
|
|
978
|
+
s && /* @__PURE__ */ e(q, { label: s, required: n }),
|
|
957
979
|
/* @__PURE__ */ e(
|
|
958
|
-
|
|
980
|
+
ta,
|
|
959
981
|
{
|
|
960
|
-
apiKey:
|
|
961
|
-
value:
|
|
962
|
-
disabled:
|
|
982
|
+
apiKey: o,
|
|
983
|
+
value: l,
|
|
984
|
+
disabled: f,
|
|
963
985
|
init: {
|
|
964
|
-
height:
|
|
965
|
-
inline:
|
|
966
|
-
menubar:
|
|
986
|
+
height: D,
|
|
987
|
+
inline: d,
|
|
988
|
+
menubar: v,
|
|
967
989
|
branding: !1,
|
|
968
990
|
statusbar: !0,
|
|
969
991
|
automatic_uploads: !0,
|
|
@@ -972,11 +994,11 @@ const sa = ({
|
|
|
972
994
|
L(`data:${M.blob().type};base64,${M.base64()}`);
|
|
973
995
|
return;
|
|
974
996
|
}
|
|
975
|
-
x(M).then((
|
|
976
|
-
|
|
977
|
-
}).catch((
|
|
997
|
+
x(M).then((F) => {
|
|
998
|
+
F ? L(F) : B("Upload failed: No URL returned");
|
|
999
|
+
}).catch((F) => {
|
|
978
1000
|
B(
|
|
979
|
-
typeof
|
|
1001
|
+
typeof F == "string" ? F : (F == null ? void 0 : F.message) || "Image upload failed"
|
|
980
1002
|
);
|
|
981
1003
|
});
|
|
982
1004
|
}),
|
|
@@ -999,162 +1021,162 @@ const sa = ({
|
|
|
999
1021
|
"help",
|
|
1000
1022
|
"wordcount"
|
|
1001
1023
|
],
|
|
1002
|
-
toolbar:
|
|
1003
|
-
placeholder:
|
|
1024
|
+
toolbar: m ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
|
|
1025
|
+
placeholder: p,
|
|
1004
1026
|
content_style: `
|
|
1005
1027
|
body {
|
|
1006
|
-
font-family: ${
|
|
1028
|
+
font-family: ${u};
|
|
1007
1029
|
}
|
|
1008
1030
|
`,
|
|
1009
|
-
...
|
|
1031
|
+
...y
|
|
1010
1032
|
},
|
|
1011
1033
|
onEditorChange: (M) => {
|
|
1012
|
-
|
|
1034
|
+
i && i(M);
|
|
1013
1035
|
}
|
|
1014
1036
|
}
|
|
1015
1037
|
)
|
|
1016
|
-
] },
|
|
1017
|
-
name:
|
|
1018
|
-
label:
|
|
1038
|
+
] }, h), ca = ({
|
|
1039
|
+
name: h = "",
|
|
1040
|
+
label: o = "",
|
|
1019
1041
|
// label for single checkbox
|
|
1020
|
-
options:
|
|
1042
|
+
options: l = [],
|
|
1021
1043
|
// array of { label, value } for multiple
|
|
1022
|
-
value:
|
|
1044
|
+
value: i = null,
|
|
1023
1045
|
// boolean for single, array for multiple, or string for single select
|
|
1024
|
-
onChange:
|
|
1046
|
+
onChange: s,
|
|
1025
1047
|
disabled: n = !1,
|
|
1026
|
-
required:
|
|
1048
|
+
required: p = !1,
|
|
1027
1049
|
parentClass: S = "col-span-12",
|
|
1028
|
-
className:
|
|
1029
|
-
multiSelect:
|
|
1050
|
+
className: D = "",
|
|
1051
|
+
multiSelect: d = !1
|
|
1030
1052
|
// ✅ if true, only one option can be selected (like radio)
|
|
1031
1053
|
}) => {
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1034
|
-
},
|
|
1035
|
-
if (
|
|
1036
|
-
if (!
|
|
1037
|
-
|
|
1054
|
+
const f = Array.isArray(l) && l.length > 0, a = (u) => f ? d ? Array.isArray(i) && i.includes(u) : i === u : !!i, m = (u) => {
|
|
1055
|
+
s == null || s(u.target.checked, h);
|
|
1056
|
+
}, v = (u, y) => {
|
|
1057
|
+
if (s)
|
|
1058
|
+
if (!d)
|
|
1059
|
+
s(y ? u : "", h);
|
|
1038
1060
|
else {
|
|
1039
|
-
const x = Array.isArray(
|
|
1040
|
-
if (
|
|
1041
|
-
x.includes(
|
|
1061
|
+
const x = Array.isArray(i) ? [...i] : [];
|
|
1062
|
+
if (y)
|
|
1063
|
+
x.includes(u) || x.push(u);
|
|
1042
1064
|
else {
|
|
1043
|
-
const N = x.indexOf(
|
|
1065
|
+
const N = x.indexOf(u);
|
|
1044
1066
|
N > -1 && x.splice(N, 1);
|
|
1045
1067
|
}
|
|
1046
|
-
|
|
1068
|
+
s(x, h);
|
|
1047
1069
|
}
|
|
1048
1070
|
};
|
|
1049
|
-
return
|
|
1050
|
-
/* @__PURE__ */ e(
|
|
1051
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children:
|
|
1071
|
+
return f ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ c("div", { className: `${S}`, children: [
|
|
1072
|
+
/* @__PURE__ */ e(q, { label: o, required: p }),
|
|
1073
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: l.map((u, y) => /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1052
1074
|
/* @__PURE__ */ e(
|
|
1053
1075
|
"input",
|
|
1054
1076
|
{
|
|
1055
1077
|
type: "checkbox",
|
|
1056
|
-
name:
|
|
1057
|
-
value:
|
|
1058
|
-
checked: a(
|
|
1059
|
-
disabled: n ||
|
|
1060
|
-
required:
|
|
1061
|
-
onChange: (x) =>
|
|
1062
|
-
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 ${
|
|
1078
|
+
name: h,
|
|
1079
|
+
value: u.value,
|
|
1080
|
+
checked: a(u.value),
|
|
1081
|
+
disabled: n || u.disabled,
|
|
1082
|
+
required: p && y === 0,
|
|
1083
|
+
onChange: (x) => v(u.value, x.target.checked),
|
|
1084
|
+
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 ${D}`
|
|
1063
1085
|
},
|
|
1064
|
-
|
|
1086
|
+
h
|
|
1065
1087
|
),
|
|
1066
|
-
|
|
1088
|
+
u.label && /* @__PURE__ */ e(
|
|
1067
1089
|
"label",
|
|
1068
1090
|
{
|
|
1069
|
-
htmlFor:
|
|
1091
|
+
htmlFor: h,
|
|
1070
1092
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1071
|
-
children:
|
|
1093
|
+
children: u.label
|
|
1072
1094
|
}
|
|
1073
1095
|
)
|
|
1074
|
-
] },
|
|
1075
|
-
] }) }) : /* @__PURE__ */
|
|
1096
|
+
] }, u.value || u.label)) })
|
|
1097
|
+
] }) }) : /* @__PURE__ */ c("div", { className: `flex items-center ${S}`, children: [
|
|
1076
1098
|
/* @__PURE__ */ e(
|
|
1077
1099
|
"input",
|
|
1078
1100
|
{
|
|
1079
1101
|
type: "checkbox",
|
|
1080
|
-
name:
|
|
1102
|
+
name: h,
|
|
1081
1103
|
checked: a(),
|
|
1082
1104
|
disabled: n,
|
|
1083
|
-
required:
|
|
1084
|
-
onChange:
|
|
1085
|
-
className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${
|
|
1105
|
+
required: p,
|
|
1106
|
+
onChange: m,
|
|
1107
|
+
className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${D}`
|
|
1086
1108
|
}
|
|
1087
1109
|
),
|
|
1088
|
-
|
|
1110
|
+
o && /* @__PURE__ */ e(
|
|
1089
1111
|
"label",
|
|
1090
1112
|
{
|
|
1091
|
-
htmlFor:
|
|
1113
|
+
htmlFor: h,
|
|
1092
1114
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1093
|
-
children:
|
|
1115
|
+
children: o
|
|
1094
1116
|
}
|
|
1095
1117
|
)
|
|
1096
1118
|
] });
|
|
1097
|
-
},
|
|
1098
|
-
label:
|
|
1099
|
-
value:
|
|
1100
|
-
onChange:
|
|
1101
|
-
required:
|
|
1102
|
-
accept:
|
|
1119
|
+
}, ha = ({
|
|
1120
|
+
label: h = "",
|
|
1121
|
+
value: o = null,
|
|
1122
|
+
onChange: l,
|
|
1123
|
+
required: i = !1,
|
|
1124
|
+
accept: s = "audio/*",
|
|
1103
1125
|
id: n,
|
|
1104
|
-
dragDrop:
|
|
1126
|
+
dragDrop: p = !1,
|
|
1105
1127
|
name: S = "",
|
|
1106
|
-
parentClass:
|
|
1128
|
+
parentClass: D = ""
|
|
1107
1129
|
}) => {
|
|
1108
|
-
const [
|
|
1130
|
+
const [d, f] = R(null), [a, m] = R(!1), v = ae(null);
|
|
1109
1131
|
z(() => {
|
|
1110
|
-
if (!
|
|
1111
|
-
|
|
1132
|
+
if (!o) {
|
|
1133
|
+
u(), f(null);
|
|
1112
1134
|
return;
|
|
1113
1135
|
}
|
|
1114
|
-
if (
|
|
1115
|
-
const L = URL.createObjectURL(
|
|
1116
|
-
return
|
|
1136
|
+
if (o instanceof File) {
|
|
1137
|
+
const L = URL.createObjectURL(o);
|
|
1138
|
+
return f({ file: o, preview: L }), () => {
|
|
1117
1139
|
URL.revokeObjectURL(L);
|
|
1118
1140
|
};
|
|
1119
|
-
} else typeof
|
|
1120
|
-
}, [
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1123
|
-
},
|
|
1141
|
+
} else typeof o == "string" ? f({ preview: o }) : o != null && o.preview && f(o);
|
|
1142
|
+
}, [o]);
|
|
1143
|
+
const u = () => {
|
|
1144
|
+
d != null && d.preview && d.preview.startsWith("blob:") && URL.revokeObjectURL(d.preview);
|
|
1145
|
+
}, y = (L) => {
|
|
1124
1146
|
if (!L || L.length === 0)
|
|
1125
1147
|
return;
|
|
1126
|
-
const B = L[0],
|
|
1127
|
-
|
|
1148
|
+
const B = L[0], F = URL.createObjectURL(B);
|
|
1149
|
+
u(), f({ file: B, preview: F }), l == null || l(B);
|
|
1128
1150
|
}, x = (L) => {
|
|
1129
|
-
L && L.stopPropagation(),
|
|
1151
|
+
L && L.stopPropagation(), u(), f(null), l == null || l(null), v.current && (v.current.value = "");
|
|
1130
1152
|
}, N = (L) => {
|
|
1131
|
-
|
|
1153
|
+
p && (L.preventDefault(), m(!0));
|
|
1154
|
+
}, I = (L) => {
|
|
1155
|
+
p && (L.preventDefault(), m(!1));
|
|
1132
1156
|
}, P = (L) => {
|
|
1133
|
-
|
|
1134
|
-
}, F = (L) => {
|
|
1135
|
-
b && (L.preventDefault(), f(!1), w(L.dataTransfer.files));
|
|
1157
|
+
p && (L.preventDefault(), m(!1), y(L.dataTransfer.files));
|
|
1136
1158
|
}, M = () => {
|
|
1137
|
-
|
|
1159
|
+
v.current.click();
|
|
1138
1160
|
};
|
|
1139
|
-
return /* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */ e(
|
|
1141
|
-
/* @__PURE__ */
|
|
1161
|
+
return /* @__PURE__ */ c("div", { className: D || "col-span-12", children: [
|
|
1162
|
+
/* @__PURE__ */ e(q, { label: h, required: i }),
|
|
1163
|
+
/* @__PURE__ */ c(
|
|
1142
1164
|
"div",
|
|
1143
1165
|
{
|
|
1144
1166
|
className: `relative rounded-lg p-2 transition-all ${a ? "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"}`,
|
|
1145
1167
|
onDragOver: N,
|
|
1146
|
-
onDragLeave:
|
|
1147
|
-
onDrop:
|
|
1168
|
+
onDragLeave: I,
|
|
1169
|
+
onDrop: P,
|
|
1148
1170
|
children: [
|
|
1149
1171
|
/* @__PURE__ */ e(
|
|
1150
1172
|
"input",
|
|
1151
1173
|
{
|
|
1152
|
-
ref:
|
|
1174
|
+
ref: v,
|
|
1153
1175
|
id: n,
|
|
1154
1176
|
type: "file",
|
|
1155
|
-
accept:
|
|
1156
|
-
onChange: (L) =>
|
|
1157
|
-
required:
|
|
1177
|
+
accept: s,
|
|
1178
|
+
onChange: (L) => y(L.target.files),
|
|
1179
|
+
required: i && !d,
|
|
1158
1180
|
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
1159
1181
|
}
|
|
1160
1182
|
),
|
|
@@ -1162,11 +1184,11 @@ const sa = ({
|
|
|
1162
1184
|
"div",
|
|
1163
1185
|
{
|
|
1164
1186
|
className: `flex items-center space-x-4 transition-all ${a ? "opacity-50" : ""}`,
|
|
1165
|
-
children:
|
|
1187
|
+
children: d ? (
|
|
1166
1188
|
// Audio player with close button and change button
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
!
|
|
1189
|
+
/* @__PURE__ */ c("div", { className: "flex items-center space-x-4", children: [
|
|
1190
|
+
/* @__PURE__ */ c("div", { className: "relative w-full", children: [
|
|
1191
|
+
!i && /* @__PURE__ */ e(
|
|
1170
1192
|
"button",
|
|
1171
1193
|
{
|
|
1172
1194
|
type: "button",
|
|
@@ -1179,18 +1201,18 @@ const sa = ({
|
|
|
1179
1201
|
/* @__PURE__ */ e(
|
|
1180
1202
|
"audio",
|
|
1181
1203
|
{
|
|
1182
|
-
src:
|
|
1204
|
+
src: d.preview,
|
|
1183
1205
|
controls: !0,
|
|
1184
1206
|
controlsList: "nodownload"
|
|
1185
1207
|
},
|
|
1186
|
-
|
|
1208
|
+
d.preview
|
|
1187
1209
|
)
|
|
1188
1210
|
] }),
|
|
1189
1211
|
/* @__PURE__ */ e(Q, { type: "button", onClick: M, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1190
1212
|
] })
|
|
1191
1213
|
) : (
|
|
1192
1214
|
// Empty state with upload button
|
|
1193
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-center space-x-4", children: [
|
|
1194
1216
|
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(re, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
|
|
1195
1217
|
/* @__PURE__ */ e(
|
|
1196
1218
|
Q,
|
|
@@ -1201,117 +1223,118 @@ const sa = ({
|
|
|
1201
1223
|
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1202
1224
|
}
|
|
1203
1225
|
),
|
|
1204
|
-
|
|
1226
|
+
p && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
|
|
1205
1227
|
] })
|
|
1206
1228
|
)
|
|
1207
1229
|
}
|
|
1208
1230
|
),
|
|
1209
|
-
|
|
1231
|
+
p && a && !d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
|
|
1210
1232
|
]
|
|
1211
1233
|
}
|
|
1212
1234
|
)
|
|
1213
1235
|
] }, S);
|
|
1214
|
-
}, Ge = ({ field:
|
|
1236
|
+
}, Ge = ({ field: h, formData: o, handleChange: l }) => {
|
|
1215
1237
|
const {
|
|
1216
|
-
key:
|
|
1217
|
-
label:
|
|
1238
|
+
key: i,
|
|
1239
|
+
label: s,
|
|
1218
1240
|
type: n,
|
|
1219
|
-
options:
|
|
1241
|
+
options: p,
|
|
1220
1242
|
placeholder: S,
|
|
1221
|
-
rows:
|
|
1222
|
-
inputClass:
|
|
1223
|
-
search:
|
|
1243
|
+
rows: D,
|
|
1244
|
+
inputClass: d,
|
|
1245
|
+
search: f,
|
|
1224
1246
|
accept: a,
|
|
1225
|
-
text:
|
|
1226
|
-
required:
|
|
1227
|
-
minLength:
|
|
1228
|
-
dragDrop:
|
|
1247
|
+
text: m,
|
|
1248
|
+
required: v = !1,
|
|
1249
|
+
minLength: u,
|
|
1250
|
+
dragDrop: y,
|
|
1229
1251
|
parentClass: x,
|
|
1230
1252
|
countriesList: N,
|
|
1231
|
-
defaultCountry:
|
|
1232
|
-
multiple:
|
|
1253
|
+
defaultCountry: I,
|
|
1254
|
+
multiple: P,
|
|
1233
1255
|
dropdownMaxHeight: M,
|
|
1234
1256
|
editorKey: L,
|
|
1235
1257
|
fontFamily: B,
|
|
1236
|
-
disabled:
|
|
1258
|
+
disabled: F,
|
|
1237
1259
|
negativeNumberAllow: C,
|
|
1238
|
-
defaultValue:
|
|
1260
|
+
defaultValue: E,
|
|
1239
1261
|
renderCondition: G,
|
|
1240
|
-
optionDependencyKey:
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1262
|
+
optionDependencyKey: Y,
|
|
1263
|
+
pattern: W
|
|
1264
|
+
} = h;
|
|
1265
|
+
let U = o == null ? void 0 : o[i];
|
|
1266
|
+
U == null && (U = "");
|
|
1267
|
+
const K = S || (n === "select" ? `Select ${s}` : `Enter ${s}`), Z = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
|
|
1268
|
+
if (G && typeof G == "function" && !G(o))
|
|
1246
1269
|
return null;
|
|
1247
1270
|
switch (n) {
|
|
1248
1271
|
case "select":
|
|
1249
1272
|
return /* @__PURE__ */ e(
|
|
1250
|
-
|
|
1273
|
+
la,
|
|
1251
1274
|
{
|
|
1252
|
-
options:
|
|
1253
|
-
value:
|
|
1254
|
-
formData:
|
|
1255
|
-
dependencyKey:
|
|
1256
|
-
onChange: (
|
|
1257
|
-
placeholder:
|
|
1258
|
-
className:
|
|
1259
|
-
search:
|
|
1260
|
-
required:
|
|
1261
|
-
defaultValue:
|
|
1262
|
-
label:
|
|
1263
|
-
name:
|
|
1264
|
-
disabled:
|
|
1275
|
+
options: p || [],
|
|
1276
|
+
value: U,
|
|
1277
|
+
formData: o,
|
|
1278
|
+
dependencyKey: Y,
|
|
1279
|
+
onChange: (O) => l(i, O),
|
|
1280
|
+
placeholder: K,
|
|
1281
|
+
className: d || "",
|
|
1282
|
+
search: f,
|
|
1283
|
+
required: v,
|
|
1284
|
+
defaultValue: E,
|
|
1285
|
+
label: s,
|
|
1286
|
+
name: i,
|
|
1287
|
+
disabled: F,
|
|
1265
1288
|
parentClass: x,
|
|
1266
|
-
multiple:
|
|
1289
|
+
multiple: P,
|
|
1267
1290
|
dropdownMaxHeight: M
|
|
1268
1291
|
}
|
|
1269
1292
|
);
|
|
1270
1293
|
case "checkbox":
|
|
1271
1294
|
return /* @__PURE__ */ e(
|
|
1272
|
-
|
|
1295
|
+
ca,
|
|
1273
1296
|
{
|
|
1274
|
-
name:
|
|
1275
|
-
label:
|
|
1276
|
-
options:
|
|
1277
|
-
value:
|
|
1278
|
-
onChange: (
|
|
1279
|
-
required:
|
|
1297
|
+
name: i,
|
|
1298
|
+
label: s,
|
|
1299
|
+
options: p || [],
|
|
1300
|
+
value: U,
|
|
1301
|
+
onChange: (O) => l(i, O),
|
|
1302
|
+
required: v,
|
|
1280
1303
|
parentClass: x,
|
|
1281
|
-
className:
|
|
1282
|
-
multiSelect:
|
|
1283
|
-
disabled:
|
|
1304
|
+
className: d || "",
|
|
1305
|
+
multiSelect: P,
|
|
1306
|
+
disabled: F
|
|
1284
1307
|
}
|
|
1285
1308
|
);
|
|
1286
1309
|
case "switch":
|
|
1287
1310
|
return /* @__PURE__ */ e(
|
|
1288
|
-
|
|
1311
|
+
oa,
|
|
1289
1312
|
{
|
|
1290
|
-
value:
|
|
1291
|
-
onChange: (
|
|
1292
|
-
text:
|
|
1293
|
-
options:
|
|
1294
|
-
label:
|
|
1295
|
-
required:
|
|
1296
|
-
name:
|
|
1297
|
-
disabled:
|
|
1313
|
+
value: U,
|
|
1314
|
+
onChange: (O) => l(i, O),
|
|
1315
|
+
text: m,
|
|
1316
|
+
options: p || [],
|
|
1317
|
+
label: s,
|
|
1318
|
+
required: v,
|
|
1319
|
+
name: i,
|
|
1320
|
+
disabled: F,
|
|
1298
1321
|
parentClass: x
|
|
1299
1322
|
}
|
|
1300
1323
|
);
|
|
1301
1324
|
case "phone":
|
|
1302
1325
|
return /* @__PURE__ */ e(
|
|
1303
|
-
|
|
1326
|
+
ia,
|
|
1304
1327
|
{
|
|
1305
|
-
value:
|
|
1306
|
-
onChange: (
|
|
1328
|
+
value: U,
|
|
1329
|
+
onChange: (O) => l(i, O),
|
|
1307
1330
|
countriesList: N,
|
|
1308
|
-
defaultCountry:
|
|
1309
|
-
required:
|
|
1310
|
-
placeholder:
|
|
1311
|
-
search:
|
|
1312
|
-
label:
|
|
1313
|
-
name:
|
|
1314
|
-
disabled:
|
|
1331
|
+
defaultCountry: I,
|
|
1332
|
+
required: v,
|
|
1333
|
+
placeholder: K,
|
|
1334
|
+
search: f,
|
|
1335
|
+
label: s,
|
|
1336
|
+
name: i,
|
|
1337
|
+
disabled: F,
|
|
1315
1338
|
parentClass: x
|
|
1316
1339
|
}
|
|
1317
1340
|
);
|
|
@@ -1319,130 +1342,132 @@ const sa = ({
|
|
|
1319
1342
|
return /* @__PURE__ */ e(
|
|
1320
1343
|
Ee,
|
|
1321
1344
|
{
|
|
1322
|
-
value:
|
|
1323
|
-
onChange: (
|
|
1324
|
-
placeholder:
|
|
1325
|
-
rows:
|
|
1326
|
-
className: `${
|
|
1327
|
-
required:
|
|
1328
|
-
name:
|
|
1329
|
-
label:
|
|
1330
|
-
disabled:
|
|
1345
|
+
value: U,
|
|
1346
|
+
onChange: (O) => l(i, O.target.value),
|
|
1347
|
+
placeholder: K,
|
|
1348
|
+
rows: D || 3,
|
|
1349
|
+
className: `${Z} ${d || ""}`,
|
|
1350
|
+
required: v,
|
|
1351
|
+
name: i,
|
|
1352
|
+
label: s,
|
|
1353
|
+
disabled: F,
|
|
1331
1354
|
parentClass: x
|
|
1332
1355
|
}
|
|
1333
1356
|
);
|
|
1334
1357
|
case "image":
|
|
1335
1358
|
return /* @__PURE__ */ e(
|
|
1336
|
-
|
|
1359
|
+
sa,
|
|
1337
1360
|
{
|
|
1338
|
-
value:
|
|
1339
|
-
onChange: (
|
|
1340
|
-
required:
|
|
1361
|
+
value: U,
|
|
1362
|
+
onChange: (O) => l(i, O),
|
|
1363
|
+
required: v,
|
|
1341
1364
|
accept: a || "image/*",
|
|
1342
|
-
id: `file-${
|
|
1343
|
-
dragDrop:
|
|
1344
|
-
label:
|
|
1345
|
-
name:
|
|
1365
|
+
id: `file-${i}`,
|
|
1366
|
+
dragDrop: y,
|
|
1367
|
+
label: s,
|
|
1368
|
+
name: i,
|
|
1346
1369
|
parentClass: x
|
|
1347
1370
|
}
|
|
1348
1371
|
);
|
|
1349
1372
|
case "audio":
|
|
1350
1373
|
return /* @__PURE__ */ e(
|
|
1351
|
-
|
|
1374
|
+
ha,
|
|
1352
1375
|
{
|
|
1353
|
-
value:
|
|
1354
|
-
onChange: (
|
|
1355
|
-
required:
|
|
1376
|
+
value: U,
|
|
1377
|
+
onChange: (O) => l(i, O),
|
|
1378
|
+
required: v,
|
|
1356
1379
|
accept: a || "audio/*",
|
|
1357
|
-
id: `file-${
|
|
1358
|
-
dragDrop:
|
|
1359
|
-
label:
|
|
1360
|
-
name:
|
|
1380
|
+
id: `file-${i}`,
|
|
1381
|
+
dragDrop: y,
|
|
1382
|
+
label: s,
|
|
1383
|
+
name: i,
|
|
1361
1384
|
parentClass: x
|
|
1362
1385
|
}
|
|
1363
1386
|
);
|
|
1364
1387
|
case "tinyEditor":
|
|
1365
1388
|
return /* @__PURE__ */ e(
|
|
1366
|
-
|
|
1389
|
+
da,
|
|
1367
1390
|
{
|
|
1368
|
-
value:
|
|
1369
|
-
onChange: (
|
|
1370
|
-
required:
|
|
1371
|
-
placeholder:
|
|
1372
|
-
label:
|
|
1391
|
+
value: U,
|
|
1392
|
+
onChange: (O) => l(i, O),
|
|
1393
|
+
required: v,
|
|
1394
|
+
placeholder: K,
|
|
1395
|
+
label: s,
|
|
1373
1396
|
parentClass: x,
|
|
1374
1397
|
fontFamily: B,
|
|
1375
1398
|
editorKey: L,
|
|
1376
|
-
disabled:
|
|
1399
|
+
disabled: F
|
|
1377
1400
|
},
|
|
1378
|
-
`editor-${
|
|
1401
|
+
`editor-${i}`
|
|
1379
1402
|
);
|
|
1380
1403
|
default:
|
|
1381
1404
|
return /* @__PURE__ */ e(
|
|
1382
1405
|
$e,
|
|
1383
1406
|
{
|
|
1407
|
+
field: h,
|
|
1384
1408
|
type: n || "text",
|
|
1385
|
-
defaultValue:
|
|
1386
|
-
value:
|
|
1387
|
-
onChange: (
|
|
1388
|
-
placeholder:
|
|
1389
|
-
className: `${
|
|
1390
|
-
required:
|
|
1391
|
-
name:
|
|
1392
|
-
minLength:
|
|
1393
|
-
label:
|
|
1409
|
+
defaultValue: E,
|
|
1410
|
+
value: U,
|
|
1411
|
+
onChange: (O) => l(i, O.target.value),
|
|
1412
|
+
placeholder: K,
|
|
1413
|
+
className: `${Z} ${d || ""}`,
|
|
1414
|
+
required: v,
|
|
1415
|
+
name: i,
|
|
1416
|
+
minLength: u,
|
|
1417
|
+
label: s,
|
|
1394
1418
|
negativeNumberAllow: C,
|
|
1395
1419
|
parentClass: x,
|
|
1396
|
-
disabled:
|
|
1420
|
+
disabled: F,
|
|
1421
|
+
pattern: W
|
|
1397
1422
|
}
|
|
1398
1423
|
);
|
|
1399
1424
|
}
|
|
1400
|
-
},
|
|
1401
|
-
var
|
|
1402
|
-
const [
|
|
1403
|
-
n((
|
|
1425
|
+
}, ua = ({ isOpen: h, onClose: o, config: l, onApply: i }) => {
|
|
1426
|
+
var d;
|
|
1427
|
+
const [s, n] = R({}), p = (f, a) => {
|
|
1428
|
+
n((m) => ({ ...m, [f]: a }));
|
|
1404
1429
|
}, S = () => {
|
|
1405
|
-
|
|
1406
|
-
},
|
|
1407
|
-
n({}),
|
|
1430
|
+
i == null || i(s), o();
|
|
1431
|
+
}, D = () => {
|
|
1432
|
+
n({}), i == null || i({}), o();
|
|
1408
1433
|
};
|
|
1409
|
-
return /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ c($, { children: [
|
|
1410
1435
|
/* @__PURE__ */ e(
|
|
1411
1436
|
"div",
|
|
1412
1437
|
{
|
|
1413
|
-
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${
|
|
1414
|
-
onClick:
|
|
1438
|
+
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
|
|
1439
|
+
onClick: o
|
|
1415
1440
|
}
|
|
1416
1441
|
),
|
|
1417
|
-
/* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ c(
|
|
1418
1443
|
"div",
|
|
1419
1444
|
{
|
|
1420
1445
|
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
|
|
1421
1446
|
transform transition-transform duration-300 ease-in-out
|
|
1422
|
-
${
|
|
1447
|
+
${h ? "translate-x-0" : "translate-x-full"}
|
|
1423
1448
|
`,
|
|
1424
1449
|
children: [
|
|
1425
|
-
/* @__PURE__ */
|
|
1450
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
|
|
1426
1451
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
|
|
1427
1452
|
/* @__PURE__ */ e(
|
|
1428
1453
|
"button",
|
|
1429
1454
|
{
|
|
1430
|
-
onClick:
|
|
1455
|
+
onClick: o,
|
|
1431
1456
|
className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
|
|
1432
1457
|
children: /* @__PURE__ */ e(Se, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
|
|
1433
1458
|
}
|
|
1434
1459
|
)
|
|
1435
1460
|
] }),
|
|
1436
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children:
|
|
1461
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: l != null && l.component ? /* @__PURE__ */ e(l.component, { filters: s, onFilterChange: p }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (d = l == null ? void 0 : l.fields) == null ? void 0 : d.map((f) => /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1437
1462
|
Ge,
|
|
1438
1463
|
{
|
|
1439
|
-
field:
|
|
1440
|
-
formData:
|
|
1441
|
-
handleChange:
|
|
1464
|
+
field: f,
|
|
1465
|
+
formData: s,
|
|
1466
|
+
handleChange: p
|
|
1442
1467
|
},
|
|
1443
|
-
|
|
1468
|
+
f.key
|
|
1444
1469
|
) })) }) }),
|
|
1445
|
-
/* @__PURE__ */
|
|
1470
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
|
|
1446
1471
|
/* @__PURE__ */ e(
|
|
1447
1472
|
Q,
|
|
1448
1473
|
{
|
|
@@ -1456,7 +1481,7 @@ const sa = ({
|
|
|
1456
1481
|
/* @__PURE__ */ e(
|
|
1457
1482
|
Q,
|
|
1458
1483
|
{
|
|
1459
|
-
onClick:
|
|
1484
|
+
onClick: D,
|
|
1460
1485
|
variant: "contained",
|
|
1461
1486
|
className: "min-w-[150px]",
|
|
1462
1487
|
children: "Reset"
|
|
@@ -1501,56 +1526,56 @@ const sa = ({
|
|
|
1501
1526
|
outline: "border !bg-transparent",
|
|
1502
1527
|
soft: "bg opacity-90"
|
|
1503
1528
|
}, Ke = ({
|
|
1504
|
-
label:
|
|
1505
|
-
variant:
|
|
1529
|
+
label: h,
|
|
1530
|
+
variant: o = "contained",
|
|
1506
1531
|
// contained | outline | soft
|
|
1507
|
-
color:
|
|
1508
|
-
className:
|
|
1532
|
+
color: l = "green",
|
|
1533
|
+
className: i = ""
|
|
1509
1534
|
}) => {
|
|
1510
|
-
const
|
|
1535
|
+
const s = Fe[l] || Fe.green, n = Pe[o] || Pe.contained, p = o === "outline" ? s.border : s.bg;
|
|
1511
1536
|
return /* @__PURE__ */ e(
|
|
1512
1537
|
"span",
|
|
1513
1538
|
{
|
|
1514
1539
|
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1515
|
-
${
|
|
1540
|
+
${p}
|
|
1516
1541
|
${n}
|
|
1517
|
-
${
|
|
1518
|
-
children:
|
|
1542
|
+
${i}`,
|
|
1543
|
+
children: h
|
|
1519
1544
|
}
|
|
1520
1545
|
);
|
|
1521
|
-
},
|
|
1546
|
+
}, pa = ({ rows: h = 5, columns: o = 5 }) => /* @__PURE__ */ c($, { children: [
|
|
1522
1547
|
/* @__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" }) }),
|
|
1523
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length:
|
|
1525
|
-
/* @__PURE__ */ e("tbody", { children: Array.from({ length:
|
|
1548
|
+
/* @__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: [
|
|
1549
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: o }).map((l, 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)) }) }),
|
|
1550
|
+
/* @__PURE__ */ e("tbody", { children: Array.from({ length: h }).map((l, i) => /* @__PURE__ */ e(
|
|
1526
1551
|
"tr",
|
|
1527
1552
|
{
|
|
1528
1553
|
className: "border-t border-gray-200 dark:border-gray-800",
|
|
1529
|
-
children: Array.from({ length:
|
|
1554
|
+
children: Array.from({ length: o }).map((s, n) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, n))
|
|
1530
1555
|
},
|
|
1531
|
-
|
|
1556
|
+
i
|
|
1532
1557
|
)) })
|
|
1533
1558
|
] }) })
|
|
1534
|
-
] }), _e = ({ src:
|
|
1535
|
-
const
|
|
1559
|
+
] }), _e = ({ src: h, alt: o = "preview", isOpen: l, setIsOpen: i }) => {
|
|
1560
|
+
const s = () => i(!1);
|
|
1536
1561
|
return z(() => {
|
|
1537
|
-
const n = (
|
|
1538
|
-
|
|
1562
|
+
const n = (p) => {
|
|
1563
|
+
p.key === "Escape" && s();
|
|
1539
1564
|
};
|
|
1540
|
-
return
|
|
1565
|
+
return l && (document.body.style.overflow = "hidden", document.addEventListener("keydown", n)), () => {
|
|
1541
1566
|
document.body.style.overflow = "", document.removeEventListener("keydown", n);
|
|
1542
1567
|
};
|
|
1543
|
-
}, [
|
|
1568
|
+
}, [l]), /* @__PURE__ */ e($, { children: /* @__PURE__ */ c(
|
|
1544
1569
|
"div",
|
|
1545
1570
|
{
|
|
1546
1571
|
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
1547
1572
|
backdrop-blur-sm animate-in fade-in duration-200`,
|
|
1548
|
-
onClick:
|
|
1573
|
+
onClick: s,
|
|
1549
1574
|
children: [
|
|
1550
1575
|
/* @__PURE__ */ e(
|
|
1551
1576
|
"button",
|
|
1552
1577
|
{
|
|
1553
|
-
onClick:
|
|
1578
|
+
onClick: s,
|
|
1554
1579
|
className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
|
|
1555
1580
|
hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
|
|
1556
1581
|
children: /* @__PURE__ */ e(Se, { size: 20 })
|
|
@@ -1564,8 +1589,8 @@ const sa = ({
|
|
|
1564
1589
|
children: /* @__PURE__ */ e(
|
|
1565
1590
|
"img",
|
|
1566
1591
|
{
|
|
1567
|
-
src:
|
|
1568
|
-
alt:
|
|
1592
|
+
src: h,
|
|
1593
|
+
alt: o,
|
|
1569
1594
|
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1570
1595
|
}
|
|
1571
1596
|
)
|
|
@@ -1575,23 +1600,23 @@ const sa = ({
|
|
|
1575
1600
|
}
|
|
1576
1601
|
) });
|
|
1577
1602
|
}, ba = ({
|
|
1578
|
-
config:
|
|
1579
|
-
setShowAdd:
|
|
1580
|
-
title:
|
|
1581
|
-
buttonText:
|
|
1582
|
-
description:
|
|
1603
|
+
config: h,
|
|
1604
|
+
setShowAdd: o,
|
|
1605
|
+
title: l,
|
|
1606
|
+
buttonText: i,
|
|
1607
|
+
description: s,
|
|
1583
1608
|
showAddButton: n
|
|
1584
1609
|
}) => {
|
|
1585
1610
|
const {
|
|
1586
|
-
data:
|
|
1611
|
+
data: p = [],
|
|
1587
1612
|
table_head: S = [],
|
|
1588
|
-
loading:
|
|
1589
|
-
search:
|
|
1613
|
+
loading: D = !1,
|
|
1614
|
+
search: d = {
|
|
1590
1615
|
enabled: !1,
|
|
1591
1616
|
placeholder: "Search...",
|
|
1592
1617
|
useServerSideSearch: !1
|
|
1593
1618
|
},
|
|
1594
|
-
filter:
|
|
1619
|
+
filter: f = {
|
|
1595
1620
|
enabled: !1,
|
|
1596
1621
|
useServerSideFilters: !1
|
|
1597
1622
|
},
|
|
@@ -1600,21 +1625,21 @@ const sa = ({
|
|
|
1600
1625
|
rows_per_page: 10,
|
|
1601
1626
|
useServerSidePagination: !1
|
|
1602
1627
|
},
|
|
1603
|
-
emptyMessage:
|
|
1604
|
-
onMenuAction:
|
|
1605
|
-
setServerSidePaginationData:
|
|
1628
|
+
emptyMessage: m = "No data available",
|
|
1629
|
+
onMenuAction: v,
|
|
1630
|
+
setServerSidePaginationData: u = () => {
|
|
1606
1631
|
},
|
|
1607
|
-
onFilterApply:
|
|
1632
|
+
onFilterApply: y,
|
|
1608
1633
|
filterConfig: x = null,
|
|
1609
1634
|
rowClick: N = null
|
|
1610
|
-
} =
|
|
1611
|
-
if (a.useServerSidePagination) return
|
|
1612
|
-
const t = (_ - 1) *
|
|
1613
|
-
return
|
|
1614
|
-
}, [
|
|
1615
|
-
|
|
1635
|
+
} = h, [I, P] = R(""), [M, L] = R(null), [B, F] = R([]), [C, E] = R({}), [G, Y] = R(!1), [W, U] = R(null), [K, Z] = R(!1), O = Le(() => !d.enabled || !I.trim() || d.useServerSideSearch ? p : na(p, I, d.searchKeys || []), [p, I, d]), [_, k] = R(1), [j, X] = R((a == null ? void 0 : a.rows_per_page) || 50), [J, ee] = R(O.length || 0), ne = a != null && a.useServerSidePagination ? a.total_pages : Math.ceil(O.length / j), ce = Le(() => {
|
|
1636
|
+
if (a.useServerSidePagination) return O;
|
|
1637
|
+
const t = (_ - 1) * j;
|
|
1638
|
+
return O.slice(t, t + j);
|
|
1639
|
+
}, [O, _, j]), le = ae(null), oe = ae({}), te = ae(null), he = (t) => {
|
|
1640
|
+
P(t), k(1), d.useServerSideSearch && (te.current && clearTimeout(te.current), te.current = setTimeout(async () => {
|
|
1616
1641
|
try {
|
|
1617
|
-
await
|
|
1642
|
+
await u((g) => ({
|
|
1618
1643
|
...g,
|
|
1619
1644
|
search: t,
|
|
1620
1645
|
current_page: 1
|
|
@@ -1623,20 +1648,20 @@ const sa = ({
|
|
|
1623
1648
|
console.error("Search error:", g);
|
|
1624
1649
|
}
|
|
1625
1650
|
}, 800));
|
|
1626
|
-
}, ue = (t, g,
|
|
1627
|
-
|
|
1628
|
-
},
|
|
1629
|
-
g.stopPropagation(), T
|
|
1630
|
-
const
|
|
1631
|
-
oe.current[t] =
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1634
|
-
top: Math.max(8, Math.min(Ye, Te -
|
|
1635
|
-
left: Math.max(8, Math.min(He,
|
|
1651
|
+
}, ue = (t, g, T) => {
|
|
1652
|
+
T.stopPropagation(), L(null), v == null || v(t.type, g);
|
|
1653
|
+
}, pe = (t, g, T) => {
|
|
1654
|
+
g.stopPropagation(), F(T);
|
|
1655
|
+
const b = g.currentTarget;
|
|
1656
|
+
oe.current[t] = b;
|
|
1657
|
+
const w = b.getBoundingClientRect(), A = 192, V = T.length * 40, H = window.innerWidth, Te = window.innerHeight, He = H - w.right < A ? w.left - A + w.width : w.left, Ye = Te - w.bottom < V && w.top > V ? w.top - V - 2 : w.bottom + 2;
|
|
1658
|
+
E({
|
|
1659
|
+
top: Math.max(8, Math.min(Ye, Te - V - 8)),
|
|
1660
|
+
left: Math.max(8, Math.min(He, H - A - 8))
|
|
1636
1661
|
}), L(M === t ? null : t);
|
|
1637
|
-
},
|
|
1638
|
-
t && t.src instanceof File && (t = { ...t, src: URL.createObjectURL(t.src) }),
|
|
1639
|
-
}, ie = (t, g,
|
|
1662
|
+
}, be = (t) => (_ - 1) * j + t + 1, ge = (t) => {
|
|
1663
|
+
t && t.src instanceof File && (t = { ...t, src: URL.createObjectURL(t.src) }), U(t), Z(!0);
|
|
1664
|
+
}, ie = (t, g, T, b = null, w = null) => /* @__PURE__ */ e($, { children: t ? /* @__PURE__ */ e(
|
|
1640
1665
|
"img",
|
|
1641
1666
|
{
|
|
1642
1667
|
src: t instanceof File ? URL.createObjectURL(t) : t,
|
|
@@ -1644,32 +1669,32 @@ const sa = ({
|
|
|
1644
1669
|
onClick: (A) => {
|
|
1645
1670
|
A.stopPropagation(), A.preventDefault(), ge({ src: t, alt: g });
|
|
1646
1671
|
},
|
|
1647
|
-
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${
|
|
1672
|
+
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${T || ""}`
|
|
1648
1673
|
}
|
|
1649
|
-
) : /* @__PURE__ */ e(
|
|
1674
|
+
) : /* @__PURE__ */ e($, { children: b ? typeof b == "function" ? b(w) : b : /* @__PURE__ */ e(
|
|
1650
1675
|
"div",
|
|
1651
1676
|
{
|
|
1652
|
-
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 ${
|
|
1677
|
+
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 || ""}`,
|
|
1653
1678
|
children: /* @__PURE__ */ e(Ue, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1654
1679
|
}
|
|
1655
|
-
) }) }), me = (t, g) => /* @__PURE__ */ e(
|
|
1680
|
+
) }) }), me = (t, g) => /* @__PURE__ */ e($, { children: t ? /* @__PURE__ */ e(
|
|
1656
1681
|
"audio",
|
|
1657
1682
|
{
|
|
1658
1683
|
controls: !0,
|
|
1659
1684
|
src: t instanceof File ? URL.createObjectURL(t) : t,
|
|
1660
|
-
onClick: (
|
|
1661
|
-
|
|
1685
|
+
onClick: (T) => {
|
|
1686
|
+
T.stopPropagation();
|
|
1662
1687
|
},
|
|
1663
1688
|
className: `w-64 cursor-pointer ${g || ""}`
|
|
1664
1689
|
},
|
|
1665
1690
|
t instanceof File ? URL.createObjectURL(t) : t
|
|
1666
|
-
) : /* @__PURE__ */ e(
|
|
1691
|
+
) : /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1667
1692
|
"div",
|
|
1668
1693
|
{
|
|
1669
1694
|
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 || ""}`,
|
|
1670
|
-
children: /* @__PURE__ */ e(
|
|
1695
|
+
children: /* @__PURE__ */ e(ea, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1671
1696
|
}
|
|
1672
|
-
) }) }), fe = (t, g) => /* @__PURE__ */
|
|
1697
|
+
) }) }), fe = (t, g) => /* @__PURE__ */ c("div", { className: `flex items-center space-x-4 ${g.className || ""}`, children: [
|
|
1673
1698
|
g.imageKey ? ie(
|
|
1674
1699
|
t[g.imageKey],
|
|
1675
1700
|
t[g.titleKey],
|
|
@@ -1677,53 +1702,53 @@ const sa = ({
|
|
|
1677
1702
|
g.fallback_icon,
|
|
1678
1703
|
t
|
|
1679
1704
|
) : "",
|
|
1680
|
-
/* @__PURE__ */
|
|
1705
|
+
/* @__PURE__ */ c("div", { children: [
|
|
1681
1706
|
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: t[g.titleKey] || "" }),
|
|
1682
1707
|
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: t[g.subtitleKey] || "" })
|
|
1683
1708
|
] })
|
|
1684
1709
|
] }), ye = (t, g) => {
|
|
1685
1710
|
var A;
|
|
1686
|
-
let
|
|
1687
|
-
const
|
|
1688
|
-
let
|
|
1711
|
+
let T = String(t);
|
|
1712
|
+
const b = g.variant || "contained";
|
|
1713
|
+
let w = g.defaultColor;
|
|
1689
1714
|
if (((A = g == null ? void 0 : g.chipOptions) == null ? void 0 : A.length) > 0) {
|
|
1690
|
-
let
|
|
1691
|
-
|
|
1715
|
+
let V = g == null ? void 0 : g.chipOptions.find((H) => H.value == t);
|
|
1716
|
+
V && (T = V.label, w = V.color);
|
|
1692
1717
|
}
|
|
1693
1718
|
return /* @__PURE__ */ e(
|
|
1694
1719
|
Ke,
|
|
1695
1720
|
{
|
|
1696
|
-
label:
|
|
1697
|
-
variant:
|
|
1698
|
-
color:
|
|
1721
|
+
label: T,
|
|
1722
|
+
variant: b,
|
|
1723
|
+
color: w,
|
|
1699
1724
|
className: g.className || ""
|
|
1700
1725
|
}
|
|
1701
1726
|
);
|
|
1702
|
-
}, xe = (t, g,
|
|
1703
|
-
const
|
|
1727
|
+
}, xe = (t, g, T) => {
|
|
1728
|
+
const b = g[t.key];
|
|
1704
1729
|
return t.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${t.className || ""}`, children: /* @__PURE__ */ e(
|
|
1705
1730
|
"button",
|
|
1706
1731
|
{
|
|
1707
|
-
ref: (
|
|
1708
|
-
onClick: (
|
|
1732
|
+
ref: (w) => oe.current[g.id || g._id] = w,
|
|
1733
|
+
onClick: (w) => pe(g.id || g._id, w, t.menuList),
|
|
1709
1734
|
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",
|
|
1710
|
-
children: /* @__PURE__ */ e(
|
|
1735
|
+
children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4" })
|
|
1711
1736
|
}
|
|
1712
|
-
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children:
|
|
1713
|
-
|
|
1737
|
+
) }) : t.type === "index" ? /* @__PURE__ */ e("span", { className: t.className || "", children: be(T) }) : t.type === "group" ? fe(g, t) : t.type === "chip" ? /* @__PURE__ */ e($, { children: ye(b, t) }) : t.type === "date" ? /* @__PURE__ */ e("span", { className: t.className || "", children: je(b, t.format || "DD MMM YYYY") }) : t.type === "avatar" ? /* @__PURE__ */ e($, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(
|
|
1738
|
+
b,
|
|
1714
1739
|
t.alt,
|
|
1715
1740
|
t.className,
|
|
1716
1741
|
t.fallback_icon,
|
|
1717
1742
|
g
|
|
1718
|
-
) }) }) : t.type === "audio" ? /* @__PURE__ */ e(
|
|
1743
|
+
) }) }) : t.type === "audio" ? /* @__PURE__ */ e($, { children: me(b, t.className) }) : /* @__PURE__ */ e("span", { className: t.className || "", children: b || "N/A" });
|
|
1719
1744
|
}, ve = (t) => {
|
|
1720
1745
|
if (typeof N == "function")
|
|
1721
1746
|
return N(t);
|
|
1722
1747
|
if (N)
|
|
1723
|
-
return
|
|
1748
|
+
return v == null ? void 0 : v("view", t);
|
|
1724
1749
|
}, we = (t, g) => {
|
|
1725
1750
|
if (t.onClickDetails)
|
|
1726
|
-
return
|
|
1751
|
+
return v == null ? void 0 : v("view", g);
|
|
1727
1752
|
if (typeof t.handleClick == "function")
|
|
1728
1753
|
return t.handleClick(g);
|
|
1729
1754
|
}, se = () => N || typeof N == "function", de = (t) => t.onClickDetails || typeof t.handleClick == "function";
|
|
@@ -1747,54 +1772,54 @@ const sa = ({
|
|
|
1747
1772
|
a.current_page
|
|
1748
1773
|
]), z(() => {
|
|
1749
1774
|
ee(
|
|
1750
|
-
a != null && a.useServerSidePagination ? a.total_records :
|
|
1751
|
-
),
|
|
1775
|
+
a != null && a.useServerSidePagination ? a.total_records : O.length
|
|
1776
|
+
), O.length <= j * (_ - 1) && !(a != null && a.useServerSidePagination) && k((t) => t - 1 || 1);
|
|
1752
1777
|
}, [
|
|
1753
|
-
|
|
1778
|
+
O.length,
|
|
1754
1779
|
a.total_records,
|
|
1755
1780
|
a == null ? void 0 : a.useServerSidePagination
|
|
1756
|
-
]),
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children:
|
|
1760
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children:
|
|
1781
|
+
]), D ? /* @__PURE__ */ e(pa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c($, { children: [
|
|
1782
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
|
|
1783
|
+
/* @__PURE__ */ c("div", { children: [
|
|
1784
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: l }),
|
|
1785
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s })
|
|
1761
1786
|
] }),
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
n && /* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ c("div", { className: "flex flex-col justify-end items-end gap-2", children: [
|
|
1788
|
+
n && /* @__PURE__ */ c(
|
|
1764
1789
|
Q,
|
|
1765
1790
|
{
|
|
1766
|
-
onClick: () =>
|
|
1791
|
+
onClick: () => o(!0),
|
|
1767
1792
|
variant: "contained",
|
|
1768
1793
|
color: "primary",
|
|
1769
1794
|
children: [
|
|
1770
|
-
/* @__PURE__ */ e(
|
|
1771
|
-
|
|
1795
|
+
/* @__PURE__ */ e(qe, { className: "w-4 h-4 mr-2" }),
|
|
1796
|
+
i || "Add New"
|
|
1772
1797
|
]
|
|
1773
1798
|
}
|
|
1774
1799
|
),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
|
|
1800
|
+
/* @__PURE__ */ c("div", { className: "flex justify-end items-center gap-2", children: [
|
|
1801
|
+
d.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ c("div", { className: "relative min-w-[300px]", children: [
|
|
1777
1802
|
/* @__PURE__ */ e(Ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
1778
1803
|
/* @__PURE__ */ e(
|
|
1779
1804
|
"input",
|
|
1780
1805
|
{
|
|
1781
1806
|
type: "text",
|
|
1782
|
-
placeholder:
|
|
1783
|
-
value:
|
|
1807
|
+
placeholder: d.placeholder || "Search...",
|
|
1808
|
+
value: I,
|
|
1784
1809
|
onChange: (t) => he(t.target.value),
|
|
1785
1810
|
className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
|
|
1786
1811
|
}
|
|
1787
1812
|
)
|
|
1788
1813
|
] }) }),
|
|
1789
|
-
x &&
|
|
1790
|
-
/* @__PURE__ */ e(
|
|
1814
|
+
x && f.enabled && /* @__PURE__ */ c(Q, { onClick: () => Y(!0), variant: "contained", children: [
|
|
1815
|
+
/* @__PURE__ */ e(Ze, { className: "w-4 h-4 mr-2" }),
|
|
1791
1816
|
"Filters"
|
|
1792
1817
|
] })
|
|
1793
1818
|
] })
|
|
1794
1819
|
] })
|
|
1795
1820
|
] }),
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ c("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
|
|
1822
|
+
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ c("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
|
|
1798
1823
|
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: S.map((t) => /* @__PURE__ */ e(
|
|
1799
1824
|
"th",
|
|
1800
1825
|
{
|
|
@@ -1808,54 +1833,54 @@ const sa = ({
|
|
|
1808
1833
|
{
|
|
1809
1834
|
colSpan: S.length,
|
|
1810
1835
|
className: "text-center py-10 text-gray-500 dark:text-gray-400",
|
|
1811
|
-
children:
|
|
1836
|
+
children: m
|
|
1812
1837
|
}
|
|
1813
1838
|
) }) : ce.map((t, g) => /* @__PURE__ */ e(
|
|
1814
1839
|
"tr",
|
|
1815
1840
|
{
|
|
1816
1841
|
className: `hover:bg-gray-50 dark:hover:bg-blue-800/10 transition ${se() ? "cursor-pointer" : ""}`,
|
|
1817
|
-
onClick: (
|
|
1842
|
+
onClick: (T) => {
|
|
1818
1843
|
se() && ve(t);
|
|
1819
1844
|
},
|
|
1820
|
-
children: S.map((
|
|
1845
|
+
children: S.map((T) => /* @__PURE__ */ e(
|
|
1821
1846
|
"td",
|
|
1822
1847
|
{
|
|
1823
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${
|
|
1824
|
-
title: String(t[
|
|
1825
|
-
onClick: (
|
|
1826
|
-
de(
|
|
1848
|
+
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${T.type == "audio" ? "" : "max-w-[300px]"} truncate ${de(T) ? "cursor-pointer" : ""}`,
|
|
1849
|
+
title: String(t[T.key] ?? ""),
|
|
1850
|
+
onClick: (b) => {
|
|
1851
|
+
de(T) && (b.stopPropagation(), b.preventDefault(), we(T, t));
|
|
1827
1852
|
},
|
|
1828
|
-
children:
|
|
1853
|
+
children: T.render ? T.render(t, g) : xe(T, t, g)
|
|
1829
1854
|
},
|
|
1830
|
-
|
|
1855
|
+
T.key
|
|
1831
1856
|
))
|
|
1832
1857
|
},
|
|
1833
1858
|
t.id || t._id || g
|
|
1834
1859
|
)) })
|
|
1835
1860
|
] }) }),
|
|
1836
|
-
(a == null ? void 0 : a.enabled) &&
|
|
1837
|
-
/* @__PURE__ */
|
|
1861
|
+
(a == null ? void 0 : a.enabled) && O.length > 0 && /* @__PURE__ */ c("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: [
|
|
1862
|
+
/* @__PURE__ */ c("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1838
1863
|
"Showing ",
|
|
1839
|
-
(_ - 1) *
|
|
1864
|
+
(_ - 1) * j + 1,
|
|
1840
1865
|
" to",
|
|
1841
1866
|
" ",
|
|
1842
|
-
Math.min(_ *
|
|
1867
|
+
Math.min(_ * j, J),
|
|
1843
1868
|
" of ",
|
|
1844
1869
|
J,
|
|
1845
1870
|
" ",
|
|
1846
1871
|
"results"
|
|
1847
1872
|
] }),
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
1873
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
|
|
1874
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1850
1875
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
|
|
1851
1876
|
/* @__PURE__ */ e(
|
|
1852
1877
|
"select",
|
|
1853
1878
|
{
|
|
1854
|
-
value:
|
|
1879
|
+
value: j,
|
|
1855
1880
|
onChange: (t) => {
|
|
1856
1881
|
const g = Number(t.target.value);
|
|
1857
|
-
X(g), k(1), a.useServerSidePagination &&
|
|
1858
|
-
...
|
|
1882
|
+
X(g), k(1), a.useServerSidePagination && u((T) => ({
|
|
1883
|
+
...T,
|
|
1859
1884
|
current_page: 1,
|
|
1860
1885
|
rows_per_page: g
|
|
1861
1886
|
}));
|
|
@@ -1865,14 +1890,14 @@ const sa = ({
|
|
|
1865
1890
|
}
|
|
1866
1891
|
)
|
|
1867
1892
|
] }),
|
|
1868
|
-
/* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1869
1894
|
/* @__PURE__ */ e(
|
|
1870
1895
|
"button",
|
|
1871
1896
|
{
|
|
1872
1897
|
onClick: () => {
|
|
1873
1898
|
if (_ > 1) {
|
|
1874
1899
|
const t = _ - 1;
|
|
1875
|
-
k(t), a.useServerSidePagination &&
|
|
1900
|
+
k(t), a.useServerSidePagination && u((g) => ({
|
|
1876
1901
|
...g,
|
|
1877
1902
|
current_page: t
|
|
1878
1903
|
}));
|
|
@@ -1880,10 +1905,10 @@ const sa = ({
|
|
|
1880
1905
|
},
|
|
1881
1906
|
disabled: _ === 1,
|
|
1882
1907
|
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",
|
|
1883
|
-
children: /* @__PURE__ */ e(
|
|
1908
|
+
children: /* @__PURE__ */ e(Je, { className: "h-4 w-4" })
|
|
1884
1909
|
}
|
|
1885
1910
|
),
|
|
1886
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
|
|
1887
1912
|
"Page ",
|
|
1888
1913
|
_,
|
|
1889
1914
|
" of ",
|
|
@@ -1895,7 +1920,7 @@ const sa = ({
|
|
|
1895
1920
|
onClick: () => {
|
|
1896
1921
|
if (_ < ne) {
|
|
1897
1922
|
const t = _ + 1;
|
|
1898
|
-
k(t), a.useServerSidePagination &&
|
|
1923
|
+
k(t), a.useServerSidePagination && u((g) => ({
|
|
1899
1924
|
...g,
|
|
1900
1925
|
current_page: t
|
|
1901
1926
|
}));
|
|
@@ -1903,14 +1928,14 @@ const sa = ({
|
|
|
1903
1928
|
},
|
|
1904
1929
|
disabled: _ === ne,
|
|
1905
1930
|
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",
|
|
1906
|
-
children: /* @__PURE__ */ e(
|
|
1931
|
+
children: /* @__PURE__ */ e(Qe, { className: "h-4 w-4" })
|
|
1907
1932
|
}
|
|
1908
1933
|
)
|
|
1909
1934
|
] })
|
|
1910
1935
|
] })
|
|
1911
1936
|
] })
|
|
1912
1937
|
] }),
|
|
1913
|
-
M &&
|
|
1938
|
+
M && aa(
|
|
1914
1939
|
/* @__PURE__ */ e(
|
|
1915
1940
|
"div",
|
|
1916
1941
|
{
|
|
@@ -1922,15 +1947,15 @@ const sa = ({
|
|
|
1922
1947
|
zIndex: 9999
|
|
1923
1948
|
},
|
|
1924
1949
|
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1925
|
-
children: B.map((t, g) => /* @__PURE__ */
|
|
1950
|
+
children: B.map((t, g) => /* @__PURE__ */ c(
|
|
1926
1951
|
"button",
|
|
1927
1952
|
{
|
|
1928
|
-
onClick: (
|
|
1953
|
+
onClick: (T) => ue(
|
|
1929
1954
|
t,
|
|
1930
|
-
|
|
1931
|
-
(
|
|
1955
|
+
p.find(
|
|
1956
|
+
(b) => b.id === M || b._id == M
|
|
1932
1957
|
),
|
|
1933
|
-
|
|
1958
|
+
T
|
|
1934
1959
|
),
|
|
1935
1960
|
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"}`,
|
|
1936
1961
|
children: [
|
|
@@ -1945,45 +1970,45 @@ const sa = ({
|
|
|
1945
1970
|
document.body
|
|
1946
1971
|
),
|
|
1947
1972
|
x && /* @__PURE__ */ e(
|
|
1948
|
-
|
|
1973
|
+
ua,
|
|
1949
1974
|
{
|
|
1950
1975
|
isOpen: G,
|
|
1951
|
-
onClose: () =>
|
|
1976
|
+
onClose: () => Y(!1),
|
|
1952
1977
|
config: x,
|
|
1953
|
-
onApply:
|
|
1978
|
+
onApply: y
|
|
1954
1979
|
}
|
|
1955
1980
|
),
|
|
1956
|
-
|
|
1981
|
+
K && /* @__PURE__ */ e(
|
|
1957
1982
|
_e,
|
|
1958
1983
|
{
|
|
1959
|
-
src:
|
|
1960
|
-
alt:
|
|
1961
|
-
isOpen:
|
|
1962
|
-
setIsOpen:
|
|
1984
|
+
src: W.src,
|
|
1985
|
+
alt: W.alt,
|
|
1986
|
+
isOpen: K,
|
|
1987
|
+
setIsOpen: Z
|
|
1963
1988
|
}
|
|
1964
1989
|
)
|
|
1965
1990
|
] });
|
|
1966
1991
|
}, Ne = ({
|
|
1967
|
-
isOpen:
|
|
1968
|
-
onClose:
|
|
1969
|
-
icon:
|
|
1970
|
-
title:
|
|
1971
|
-
children:
|
|
1992
|
+
isOpen: h,
|
|
1993
|
+
onClose: o,
|
|
1994
|
+
icon: l,
|
|
1995
|
+
title: i,
|
|
1996
|
+
children: s,
|
|
1972
1997
|
size: n = "md",
|
|
1973
|
-
actionButtons:
|
|
1998
|
+
actionButtons: p = [],
|
|
1974
1999
|
actions: S,
|
|
1975
|
-
showDefaultClose:
|
|
1976
|
-
footerConfig:
|
|
1977
|
-
hideFooter:
|
|
2000
|
+
showDefaultClose: D = !0,
|
|
2001
|
+
footerConfig: d = null,
|
|
2002
|
+
hideFooter: f = !1,
|
|
1978
2003
|
onFormSubmit: a = () => {
|
|
1979
2004
|
},
|
|
1980
|
-
onCancel:
|
|
1981
|
-
loadingBtn:
|
|
1982
|
-
executeFunction:
|
|
2005
|
+
onCancel: m,
|
|
2006
|
+
loadingBtn: v = !1,
|
|
2007
|
+
executeFunction: u = () => {
|
|
1983
2008
|
},
|
|
1984
|
-
selectedItem:
|
|
2009
|
+
selectedItem: y = null
|
|
1985
2010
|
}) => {
|
|
1986
|
-
if (!
|
|
2011
|
+
if (!h) return null;
|
|
1987
2012
|
const x = {
|
|
1988
2013
|
sm: "max-w-md",
|
|
1989
2014
|
md: "max-w-lg",
|
|
@@ -1991,52 +2016,52 @@ const sa = ({
|
|
|
1991
2016
|
xl: "max-w-4xl",
|
|
1992
2017
|
full: "max-w-full"
|
|
1993
2018
|
};
|
|
1994
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ c("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
1995
2020
|
/* @__PURE__ */ e(
|
|
1996
2021
|
"div",
|
|
1997
2022
|
{
|
|
1998
2023
|
className: "fixed inset-0 bg-gray-500 opacity-75",
|
|
1999
|
-
onClick: () =>
|
|
2024
|
+
onClick: () => o()
|
|
2000
2025
|
}
|
|
2001
2026
|
),
|
|
2002
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ c(
|
|
2003
2028
|
"div",
|
|
2004
2029
|
{
|
|
2005
2030
|
className: `relative bg-white rounded-lg shadow-xl w-full ${x[n] || x.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
2006
2031
|
children: [
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
|
|
2010
|
-
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children:
|
|
2032
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
2033
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
2034
|
+
l && /* @__PURE__ */ e("span", { children: l }),
|
|
2035
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: i })
|
|
2011
2036
|
] }),
|
|
2012
2037
|
/* @__PURE__ */ e(
|
|
2013
2038
|
"button",
|
|
2014
2039
|
{
|
|
2015
|
-
onClick: () =>
|
|
2040
|
+
onClick: () => o(),
|
|
2016
2041
|
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
2017
2042
|
children: /* @__PURE__ */ e(Se, { className: "w-6 h-6" })
|
|
2018
2043
|
}
|
|
2019
2044
|
)
|
|
2020
2045
|
] }),
|
|
2021
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children:
|
|
2022
|
-
|
|
2046
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: s }),
|
|
2047
|
+
p.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: p.map((N) => /* @__PURE__ */ e(
|
|
2023
2048
|
Q,
|
|
2024
2049
|
{
|
|
2025
|
-
onClick: (
|
|
2026
|
-
N.type == "submit" ? a(
|
|
2050
|
+
onClick: (I) => {
|
|
2051
|
+
N.type == "submit" ? a(I) : u(
|
|
2027
2052
|
() => {
|
|
2028
|
-
var
|
|
2029
|
-
return (
|
|
2053
|
+
var P;
|
|
2054
|
+
return (P = N == null ? void 0 : N.onClick) == null ? void 0 : P.call(N, I, y);
|
|
2030
2055
|
},
|
|
2031
|
-
(
|
|
2056
|
+
(P) => o == null ? void 0 : o(P)
|
|
2032
2057
|
);
|
|
2033
2058
|
},
|
|
2034
|
-
disabled:
|
|
2059
|
+
disabled: v || N.disabled,
|
|
2035
2060
|
variant: N.variant || "contained",
|
|
2036
2061
|
color: N.color || "primary",
|
|
2037
2062
|
className: `min-w-[100px] ${N.className}`,
|
|
2038
2063
|
type: N.type || "button",
|
|
2039
|
-
children:
|
|
2064
|
+
children: v ? /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
2040
2065
|
/* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
|
|
2041
2066
|
N.label || "Submit",
|
|
2042
2067
|
"..."
|
|
@@ -2047,230 +2072,230 @@ const sa = ({
|
|
|
2047
2072
|
}
|
|
2048
2073
|
)
|
|
2049
2074
|
] });
|
|
2050
|
-
}, Ie = ({ config:
|
|
2051
|
-
const { formClass:
|
|
2075
|
+
}, Ie = ({ config: h, onSubmit: o, initialData: l = {}, type: i = "add" }) => {
|
|
2076
|
+
const { formClass: s = "grid grid-cols-12 gap-4", formFields: n = [] } = h || {}, [p, S] = R(l);
|
|
2052
2077
|
z(() => {
|
|
2053
|
-
S(
|
|
2078
|
+
S(l);
|
|
2054
2079
|
}, []);
|
|
2055
|
-
const
|
|
2056
|
-
S((
|
|
2057
|
-
},
|
|
2058
|
-
|
|
2059
|
-
const a =
|
|
2080
|
+
const D = (f, a) => {
|
|
2081
|
+
S((m) => ({ ...m, [f]: a }));
|
|
2082
|
+
}, d = (f) => {
|
|
2083
|
+
f.preventDefault();
|
|
2084
|
+
const a = f.target;
|
|
2060
2085
|
if (!a.checkValidity()) {
|
|
2061
2086
|
a.reportValidity();
|
|
2062
2087
|
return;
|
|
2063
2088
|
}
|
|
2064
|
-
|
|
2089
|
+
o(p);
|
|
2065
2090
|
};
|
|
2066
2091
|
return /* @__PURE__ */ e(
|
|
2067
2092
|
"form",
|
|
2068
2093
|
{
|
|
2069
|
-
id:
|
|
2070
|
-
onSubmit:
|
|
2071
|
-
className:
|
|
2094
|
+
id: i == "add" ? "addForm" : i == "edit" ? "editForm" : "defaultForm",
|
|
2095
|
+
onSubmit: d,
|
|
2096
|
+
className: s,
|
|
2072
2097
|
noValidate: !1,
|
|
2073
|
-
children: n.map((
|
|
2098
|
+
children: n.map((f) => /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
2074
2099
|
Ge,
|
|
2075
2100
|
{
|
|
2076
|
-
field:
|
|
2077
|
-
formData:
|
|
2078
|
-
handleChange:
|
|
2101
|
+
field: f,
|
|
2102
|
+
formData: p,
|
|
2103
|
+
handleChange: D
|
|
2079
2104
|
},
|
|
2080
|
-
|
|
2105
|
+
f.key
|
|
2081
2106
|
) }))
|
|
2082
2107
|
}
|
|
2083
2108
|
);
|
|
2084
2109
|
};
|
|
2085
|
-
function
|
|
2086
|
-
const { fields:
|
|
2110
|
+
function ga({ data: h, config: o }) {
|
|
2111
|
+
const { fields: l, containerClass: i } = o, [s, n] = R(null), [p, S] = R(!1), D = (a) => {
|
|
2087
2112
|
a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), n(a), S(!0);
|
|
2088
|
-
},
|
|
2089
|
-
var
|
|
2090
|
-
let
|
|
2091
|
-
if (
|
|
2092
|
-
let
|
|
2093
|
-
|
|
2113
|
+
}, d = ({ col: a }) => {
|
|
2114
|
+
var I;
|
|
2115
|
+
let m = a == null ? void 0 : a.icon, v = a.label, u = h[a.key], y = a.type, x = a.variant || "outline", N = a.defaultColor;
|
|
2116
|
+
if (y === "chip" && ((I = a.chipOptions) == null ? void 0 : I.length) > 0) {
|
|
2117
|
+
let P = a == null ? void 0 : a.chipOptions.find((M) => M.value == u);
|
|
2118
|
+
P && (u = P.label, N = P.color);
|
|
2094
2119
|
}
|
|
2095
|
-
return /* @__PURE__ */
|
|
2120
|
+
return /* @__PURE__ */ c(
|
|
2096
2121
|
"div",
|
|
2097
2122
|
{
|
|
2098
2123
|
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2099
2124
|
bg-gray-100 dark:bg-gray-900 ${a.blockClass || ""}`,
|
|
2100
2125
|
children: [
|
|
2101
|
-
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children:
|
|
2104
|
-
|
|
2126
|
+
m && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: m }),
|
|
2127
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
2128
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: v }),
|
|
2129
|
+
y === "chip" ? /* @__PURE__ */ e(
|
|
2105
2130
|
Ke,
|
|
2106
2131
|
{
|
|
2107
|
-
label:
|
|
2132
|
+
label: u,
|
|
2108
2133
|
variant: x,
|
|
2109
2134
|
color: N,
|
|
2110
2135
|
className: "mt-1"
|
|
2111
2136
|
}
|
|
2112
2137
|
) : (
|
|
2113
2138
|
/* TINY EDITOR */
|
|
2114
|
-
|
|
2139
|
+
y === "tinyEditor" ? /* @__PURE__ */ e(
|
|
2115
2140
|
"p",
|
|
2116
2141
|
{
|
|
2117
2142
|
className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
|
|
2118
2143
|
dangerouslySetInnerHTML: {
|
|
2119
|
-
__html:
|
|
2144
|
+
__html: u
|
|
2120
2145
|
}
|
|
2121
2146
|
}
|
|
2122
|
-
) :
|
|
2147
|
+
) : y === "audio" ? u ? /* @__PURE__ */ e(
|
|
2123
2148
|
"audio",
|
|
2124
2149
|
{
|
|
2125
2150
|
controls: !0,
|
|
2126
|
-
src:
|
|
2127
|
-
onClick: (
|
|
2151
|
+
src: u instanceof File ? URL.createObjectURL(u) : u,
|
|
2152
|
+
onClick: (P) => P.stopPropagation(),
|
|
2128
2153
|
className: "shadow-md rounded-full mt-1"
|
|
2129
2154
|
},
|
|
2130
|
-
|
|
2155
|
+
u instanceof File ? URL.createObjectURL(u) : u
|
|
2131
2156
|
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
|
|
2132
2157
|
/* DEFAULT */
|
|
2133
|
-
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children:
|
|
2158
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: y == "date" ? /* @__PURE__ */ e("span", { children: je(u, a.format || "DD MMM YYYY") }) : u || "N/A" })
|
|
2134
2159
|
)
|
|
2135
2160
|
)
|
|
2136
2161
|
] })
|
|
2137
2162
|
]
|
|
2138
2163
|
}
|
|
2139
2164
|
);
|
|
2140
|
-
},
|
|
2141
|
-
let
|
|
2142
|
-
return /* @__PURE__ */
|
|
2165
|
+
}, f = ({ col: a }) => {
|
|
2166
|
+
let m = h[a.titleKey], v = h[a.subtitleKey], u = h[a.imageKey], y = a.fallback_icon;
|
|
2167
|
+
return /* @__PURE__ */ c(
|
|
2143
2168
|
"div",
|
|
2144
2169
|
{
|
|
2145
2170
|
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2146
2171
|
bg-gray-100 dark:bg-gray-900
|
|
2147
2172
|
${a.blockClass}`,
|
|
2148
2173
|
children: [
|
|
2149
|
-
|
|
2174
|
+
u ? /* @__PURE__ */ e(
|
|
2150
2175
|
"img",
|
|
2151
2176
|
{
|
|
2152
|
-
src:
|
|
2153
|
-
alt:
|
|
2154
|
-
onClick: () =>
|
|
2177
|
+
src: u instanceof File ? URL.createObjectURL(u) : u,
|
|
2178
|
+
alt: m,
|
|
2179
|
+
onClick: () => D({ src: u, alt: m }),
|
|
2155
2180
|
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2156
2181
|
}
|
|
2157
|
-
) :
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children:
|
|
2160
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children:
|
|
2182
|
+
) : y ? y instanceof Function ? y(h) : y : /* @__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(Ue, { className: "w-8 h-8 text-gray-400" }) }),
|
|
2183
|
+
/* @__PURE__ */ c("div", { children: [
|
|
2184
|
+
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: m }),
|
|
2185
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: v })
|
|
2161
2186
|
] })
|
|
2162
2187
|
]
|
|
2163
2188
|
}
|
|
2164
2189
|
);
|
|
2165
2190
|
};
|
|
2166
|
-
return /* @__PURE__ */
|
|
2167
|
-
|
|
2191
|
+
return /* @__PURE__ */ c($, { children: [
|
|
2192
|
+
p && /* @__PURE__ */ e(
|
|
2168
2193
|
_e,
|
|
2169
2194
|
{
|
|
2170
|
-
src:
|
|
2171
|
-
alt:
|
|
2172
|
-
isOpen:
|
|
2195
|
+
src: s.src,
|
|
2196
|
+
alt: s.alt,
|
|
2197
|
+
isOpen: p,
|
|
2173
2198
|
setIsOpen: S
|
|
2174
2199
|
}
|
|
2175
2200
|
),
|
|
2176
|
-
/* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${
|
|
2201
|
+
/* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: l.map((a) => a.renderCondition && typeof a.renderCondition == "function" && !a.renderCondition(h) ? null : a.type == "group" ? /* @__PURE__ */ e(f, { col: a }) : /* @__PURE__ */ e(d, { col: a })) })
|
|
2177
2202
|
] });
|
|
2178
2203
|
}
|
|
2179
|
-
const ze = ({ config:
|
|
2180
|
-
var oe, te, he, ue,
|
|
2204
|
+
const ze = ({ config: h }) => {
|
|
2205
|
+
var oe, te, he, ue, pe, be, ge, ie, me, fe, ye, xe, ve, we, se, de, t, g, T;
|
|
2181
2206
|
const {
|
|
2182
|
-
title:
|
|
2183
|
-
fetchData:
|
|
2207
|
+
title: o,
|
|
2208
|
+
fetchData: l = async () => {
|
|
2184
2209
|
},
|
|
2185
|
-
isStaticData:
|
|
2186
|
-
tableConfig:
|
|
2210
|
+
isStaticData: i = !1,
|
|
2211
|
+
tableConfig: s = {},
|
|
2187
2212
|
modalConfig: n = {},
|
|
2188
|
-
filterConfig:
|
|
2189
|
-
} =
|
|
2213
|
+
filterConfig: p
|
|
2214
|
+
} = h, [S, D] = R(!0), [d, f] = R(!1), [a, m] = R([]), [v, u] = R(null), [y, x] = R({
|
|
2190
2215
|
search: "",
|
|
2191
2216
|
rows_per_page: 50,
|
|
2192
2217
|
current_page: 1
|
|
2193
|
-
}), [N,
|
|
2194
|
-
|
|
2195
|
-
},
|
|
2196
|
-
|
|
2218
|
+
}), [N, I] = R({}), [P, M] = R(!1), [L, B] = R(!1), [F, C] = R(!1), [E, G] = R(!1), [Y, W] = R(!1), [U, K] = R(null), Z = (b, w) => {
|
|
2219
|
+
b === "edit" ? (K(w), C(!0)) : b === "view" ? (K(w), W(!0)) : b === "delete" && (K(w), G(!0));
|
|
2220
|
+
}, O = async (b, w, A = "", V = "") => {
|
|
2221
|
+
f(!0);
|
|
2197
2222
|
try {
|
|
2198
|
-
const
|
|
2199
|
-
(A ||
|
|
2223
|
+
const H = await (b == null ? void 0 : b());
|
|
2224
|
+
(A || H.message) && Me(A || H.message, {
|
|
2200
2225
|
variant: "success"
|
|
2201
|
-
}),
|
|
2202
|
-
} catch (
|
|
2203
|
-
(
|
|
2226
|
+
}), w == null || w(H);
|
|
2227
|
+
} catch (H) {
|
|
2228
|
+
(V || H.message) && Me(V || H.message, { variant: "error" });
|
|
2204
2229
|
} finally {
|
|
2205
|
-
|
|
2230
|
+
f(!1);
|
|
2206
2231
|
}
|
|
2207
|
-
}, _ = (
|
|
2208
|
-
let
|
|
2209
|
-
|
|
2232
|
+
}, _ = (b) => {
|
|
2233
|
+
let w = b.newObject;
|
|
2234
|
+
i ? (m((A) => [w, ...A]), u((A) => ({
|
|
2210
2235
|
...A,
|
|
2211
2236
|
current_page: 1
|
|
2212
2237
|
}))) : (x((A) => ({
|
|
2213
2238
|
...A,
|
|
2214
2239
|
current_page: 1
|
|
2215
|
-
})),
|
|
2216
|
-
}, k = (
|
|
2217
|
-
let
|
|
2218
|
-
|
|
2219
|
-
(
|
|
2220
|
-
(
|
|
2240
|
+
})), y.current_page == 1 && ee()), B(!1);
|
|
2241
|
+
}, k = (b) => {
|
|
2242
|
+
let w = b.newObject, A = b.targetObject;
|
|
2243
|
+
i ? m(
|
|
2244
|
+
(V) => V.map(
|
|
2245
|
+
(H) => H.id === A.id ? { ...H, ...w } : H
|
|
2221
2246
|
)
|
|
2222
2247
|
) : ee(), C(!1);
|
|
2223
|
-
},
|
|
2224
|
-
if (!
|
|
2225
|
-
G(!1),
|
|
2248
|
+
}, j = (b) => {
|
|
2249
|
+
if (!b) {
|
|
2250
|
+
G(!1), K(null);
|
|
2226
2251
|
return;
|
|
2227
2252
|
}
|
|
2228
|
-
|
|
2229
|
-
(
|
|
2230
|
-
) : a.length == 1 &&
|
|
2231
|
-
...
|
|
2232
|
-
current_page:
|
|
2233
|
-
})) : ee(), G(!1),
|
|
2234
|
-
}, X = (
|
|
2253
|
+
i ? m(
|
|
2254
|
+
(w) => w.filter((A) => A.id !== b.targetObject.id)
|
|
2255
|
+
) : a.length == 1 && y.current_page > 1 ? x((w) => ({
|
|
2256
|
+
...w,
|
|
2257
|
+
current_page: w.current_page - 1
|
|
2258
|
+
})) : ee(), G(!1), K(null);
|
|
2259
|
+
}, X = (b) => O(
|
|
2235
2260
|
() => {
|
|
2236
|
-
var
|
|
2237
|
-
return (A = (
|
|
2261
|
+
var w, A;
|
|
2262
|
+
return (A = (w = n == null ? void 0 : n.addModal) == null ? void 0 : w.handleSubmit) == null ? void 0 : A.call(w, b);
|
|
2238
2263
|
},
|
|
2239
2264
|
_
|
|
2240
|
-
), J = (
|
|
2265
|
+
), J = (b) => O(
|
|
2241
2266
|
() => {
|
|
2242
|
-
var
|
|
2243
|
-
return (A = (
|
|
2267
|
+
var w, A;
|
|
2268
|
+
return (A = (w = n == null ? void 0 : n.editModal) == null ? void 0 : w.handleSubmit) == null ? void 0 : A.call(w, b, U);
|
|
2244
2269
|
},
|
|
2245
2270
|
k
|
|
2246
2271
|
), ee = async () => {
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
}).catch((
|
|
2250
|
-
Me(
|
|
2272
|
+
D(!0), l == null || l({ ...y, ...N }).then((b) => {
|
|
2273
|
+
m(b.data), u(b.pagination);
|
|
2274
|
+
}).catch((b) => {
|
|
2275
|
+
Me(b.message, { variant: "error" });
|
|
2251
2276
|
}).finally(() => {
|
|
2252
|
-
|
|
2277
|
+
D(!1);
|
|
2253
2278
|
});
|
|
2254
|
-
}, ne = (
|
|
2255
|
-
var
|
|
2256
|
-
|
|
2257
|
-
...
|
|
2258
|
-
})), (
|
|
2259
|
-
}, ce = (
|
|
2260
|
-
(A) => Object.entries(
|
|
2279
|
+
}, ne = (b) => {
|
|
2280
|
+
var w;
|
|
2281
|
+
I((A) => ({
|
|
2282
|
+
...b
|
|
2283
|
+
})), (w = s == null ? void 0 : s.filter) != null && w.useServerSideFilters && M((A) => !A);
|
|
2284
|
+
}, ce = (b, w) => b.filter(
|
|
2285
|
+
(A) => Object.entries(w).every(([V, H]) => A[V] === H)
|
|
2261
2286
|
), le = Le(() => {
|
|
2262
|
-
var
|
|
2263
|
-
return (
|
|
2287
|
+
var b;
|
|
2288
|
+
return (b = s == null ? void 0 : s.filter) != null && b.useServerSideFilters ? a : ce(a, N);
|
|
2264
2289
|
}, [a, N]);
|
|
2265
2290
|
return z(() => {
|
|
2266
2291
|
ee();
|
|
2267
2292
|
}, [
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2293
|
+
y.search,
|
|
2294
|
+
y.rows_per_page,
|
|
2295
|
+
y.current_page,
|
|
2296
|
+
P
|
|
2272
2297
|
]), /* @__PURE__ */ e(
|
|
2273
|
-
|
|
2298
|
+
ra,
|
|
2274
2299
|
{
|
|
2275
2300
|
maxSnack: 3,
|
|
2276
2301
|
anchorOrigin: {
|
|
@@ -2278,37 +2303,37 @@ const ze = ({ config: u }) => {
|
|
|
2278
2303
|
horizontal: "right"
|
|
2279
2304
|
},
|
|
2280
2305
|
autoHideDuration: 3e3,
|
|
2281
|
-
action: (
|
|
2306
|
+
action: (b) => /* @__PURE__ */ e(
|
|
2282
2307
|
"button",
|
|
2283
2308
|
{
|
|
2284
2309
|
onClick: () => {
|
|
2285
2310
|
window.dispatchEvent(
|
|
2286
|
-
new CustomEvent("closeSnackbar", { detail:
|
|
2311
|
+
new CustomEvent("closeSnackbar", { detail: b })
|
|
2287
2312
|
);
|
|
2288
2313
|
},
|
|
2289
2314
|
className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
|
|
2290
2315
|
children: /* @__PURE__ */ e(Se, { className: "h-4 w-4" })
|
|
2291
2316
|
}
|
|
2292
2317
|
),
|
|
2293
|
-
children: /* @__PURE__ */
|
|
2318
|
+
children: /* @__PURE__ */ c("div", { children: [
|
|
2294
2319
|
/* @__PURE__ */ e(
|
|
2295
2320
|
ba,
|
|
2296
2321
|
{
|
|
2297
|
-
title:
|
|
2322
|
+
title: o,
|
|
2298
2323
|
setShowAdd: B,
|
|
2299
|
-
description:
|
|
2300
|
-
buttonText:
|
|
2324
|
+
description: h.description,
|
|
2325
|
+
buttonText: h.buttonText,
|
|
2301
2326
|
showAddButton: !!n.addModal,
|
|
2302
2327
|
config: {
|
|
2303
|
-
...
|
|
2328
|
+
...s,
|
|
2304
2329
|
pagination: {
|
|
2305
|
-
...
|
|
2306
|
-
...
|
|
2330
|
+
...s.pagination,
|
|
2331
|
+
...v
|
|
2307
2332
|
},
|
|
2308
2333
|
data: le,
|
|
2309
2334
|
setServerSidePaginationData: x,
|
|
2310
|
-
onMenuAction:
|
|
2311
|
-
filterConfig:
|
|
2335
|
+
onMenuAction: Z,
|
|
2336
|
+
filterConfig: p,
|
|
2312
2337
|
onFilterApply: ne,
|
|
2313
2338
|
loading: S
|
|
2314
2339
|
}
|
|
@@ -2319,16 +2344,16 @@ const ze = ({ config: u }) => {
|
|
|
2319
2344
|
{
|
|
2320
2345
|
isOpen: L,
|
|
2321
2346
|
onClose: () => {
|
|
2322
|
-
|
|
2347
|
+
d || B(!1);
|
|
2323
2348
|
},
|
|
2324
2349
|
icon: (oe = n.addModal) == null ? void 0 : oe.icon,
|
|
2325
2350
|
title: ((te = n.addModal) == null ? void 0 : te.title) || "Add New",
|
|
2326
2351
|
size: ((he = n.addModal) == null ? void 0 : he.size) || "md",
|
|
2327
2352
|
onFormSubmit: () => {
|
|
2328
|
-
var
|
|
2329
|
-
return (
|
|
2353
|
+
var b;
|
|
2354
|
+
return (b = document.querySelector("#addForm")) == null ? void 0 : b.requestSubmit();
|
|
2330
2355
|
},
|
|
2331
|
-
loadingBtn:
|
|
2356
|
+
loadingBtn: d,
|
|
2332
2357
|
actionButtons: ((ue = n == null ? void 0 : n.addModal) == null ? void 0 : ue.actionButtons) || [],
|
|
2333
2358
|
children: /* @__PURE__ */ e(
|
|
2334
2359
|
Ie,
|
|
@@ -2337,7 +2362,7 @@ const ze = ({ config: u }) => {
|
|
|
2337
2362
|
onSubmit: X,
|
|
2338
2363
|
initialData: {},
|
|
2339
2364
|
type: "add",
|
|
2340
|
-
loading:
|
|
2365
|
+
loading: d
|
|
2341
2366
|
}
|
|
2342
2367
|
)
|
|
2343
2368
|
}
|
|
@@ -2345,66 +2370,66 @@ const ze = ({ config: u }) => {
|
|
|
2345
2370
|
/* @__PURE__ */ e(
|
|
2346
2371
|
Ne,
|
|
2347
2372
|
{
|
|
2348
|
-
isOpen:
|
|
2373
|
+
isOpen: F,
|
|
2349
2374
|
onClose: () => {
|
|
2350
|
-
|
|
2375
|
+
d || C(!1);
|
|
2351
2376
|
},
|
|
2352
|
-
icon: (
|
|
2353
|
-
title: ((
|
|
2377
|
+
icon: (pe = n.editModal) == null ? void 0 : pe.icon,
|
|
2378
|
+
title: ((be = n.editModal) == null ? void 0 : be.title) || "Edit",
|
|
2354
2379
|
size: ((ge = n.editModal) == null ? void 0 : ge.size) || "md",
|
|
2355
2380
|
onFormSubmit: () => {
|
|
2356
|
-
var
|
|
2357
|
-
return (
|
|
2381
|
+
var b;
|
|
2382
|
+
return (b = document.querySelector("#editForm")) == null ? void 0 : b.requestSubmit();
|
|
2358
2383
|
},
|
|
2359
2384
|
actionButtons: ((ie = n == null ? void 0 : n.editModal) == null ? void 0 : ie.actionButtons) || [],
|
|
2360
|
-
loadingBtn:
|
|
2385
|
+
loadingBtn: d,
|
|
2361
2386
|
children: /* @__PURE__ */ e(
|
|
2362
2387
|
Ie,
|
|
2363
2388
|
{
|
|
2364
2389
|
config: n.editModal || {},
|
|
2365
2390
|
onSubmit: J,
|
|
2366
|
-
initialData:
|
|
2391
|
+
initialData: U,
|
|
2367
2392
|
type: "edit",
|
|
2368
|
-
loading:
|
|
2393
|
+
loading: d
|
|
2369
2394
|
}
|
|
2370
2395
|
)
|
|
2371
2396
|
}
|
|
2372
2397
|
),
|
|
2373
|
-
|
|
2398
|
+
E && /* @__PURE__ */ e(
|
|
2374
2399
|
Ne,
|
|
2375
2400
|
{
|
|
2376
|
-
isOpen:
|
|
2377
|
-
onClose: (
|
|
2378
|
-
|
|
2401
|
+
isOpen: E,
|
|
2402
|
+
onClose: (b) => {
|
|
2403
|
+
j(b);
|
|
2379
2404
|
},
|
|
2380
2405
|
icon: ((me = n.deleteModal) == null ? void 0 : me.icon) || /* @__PURE__ */ e(re, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2381
2406
|
title: ((fe = n.deleteModal) == null ? void 0 : fe.title) || "Confirm Delete",
|
|
2382
2407
|
size: ((ye = n.deleteModal) == null ? void 0 : ye.size) || "md",
|
|
2383
|
-
loading:
|
|
2408
|
+
loading: d,
|
|
2384
2409
|
actionButtons: ((xe = n == null ? void 0 : n.deleteModal) == null ? void 0 : xe.actionButtons) || [],
|
|
2385
|
-
executeFunction:
|
|
2386
|
-
selectedItem:
|
|
2387
|
-
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */
|
|
2410
|
+
executeFunction: O,
|
|
2411
|
+
selectedItem: U,
|
|
2412
|
+
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ c("div", { children: [
|
|
2388
2413
|
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((ve = n.deleteModal) == null ? void 0 : ve.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2389
|
-
((we = n.deleteModal) == null ? void 0 : we.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children:
|
|
2414
|
+
((we = n.deleteModal) == null ? void 0 : we.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: U[(se = n.deleteModal) == null ? void 0 : se.referenceKey] })
|
|
2390
2415
|
] }) })
|
|
2391
2416
|
}
|
|
2392
2417
|
),
|
|
2393
2418
|
n.viewModal && /* @__PURE__ */ e(
|
|
2394
2419
|
Ne,
|
|
2395
2420
|
{
|
|
2396
|
-
isOpen:
|
|
2421
|
+
isOpen: Y,
|
|
2397
2422
|
onClose: () => {
|
|
2398
|
-
|
|
2423
|
+
W(!1), K(null);
|
|
2399
2424
|
},
|
|
2400
2425
|
icon: (de = n.viewModal) == null ? void 0 : de.icon,
|
|
2401
2426
|
title: ((t = n.viewModal) == null ? void 0 : t.title) || "View Details",
|
|
2402
2427
|
size: ((g = n.viewModal) == null ? void 0 : g.size) || "lg",
|
|
2403
2428
|
footerConfig: n == null ? void 0 : n.viewModal.footer,
|
|
2404
|
-
children: (
|
|
2405
|
-
|
|
2429
|
+
children: (T = n.viewModal) != null && T.component ? /* @__PURE__ */ e(n.viewModal.component, { data: U }) : /* @__PURE__ */ e(
|
|
2430
|
+
ga,
|
|
2406
2431
|
{
|
|
2407
|
-
data:
|
|
2432
|
+
data: U,
|
|
2408
2433
|
config: n.viewModal || {}
|
|
2409
2434
|
}
|
|
2410
2435
|
)
|
|
@@ -2427,12 +2452,12 @@ const ze = ({ config: u }) => {
|
|
|
2427
2452
|
color: r.string,
|
|
2428
2453
|
variant: r.string,
|
|
2429
2454
|
onClick: r.func
|
|
2430
|
-
}),
|
|
2455
|
+
}), ma = r.shape({
|
|
2431
2456
|
title: r.string.isRequired,
|
|
2432
2457
|
type: r.string.isRequired,
|
|
2433
2458
|
variant: r.string,
|
|
2434
2459
|
icon: r.node
|
|
2435
|
-
}),
|
|
2460
|
+
}), fa = r.shape({
|
|
2436
2461
|
key: r.string.isRequired,
|
|
2437
2462
|
title: r.string,
|
|
2438
2463
|
type: r.string,
|
|
@@ -2445,7 +2470,7 @@ const ze = ({ config: u }) => {
|
|
|
2445
2470
|
defaultColor: r.string,
|
|
2446
2471
|
className: r.string,
|
|
2447
2472
|
format: r.string,
|
|
2448
|
-
menuList: r.arrayOf(
|
|
2473
|
+
menuList: r.arrayOf(ma)
|
|
2449
2474
|
}), Re = r.shape({
|
|
2450
2475
|
key: r.string.isRequired,
|
|
2451
2476
|
label: r.string,
|
|
@@ -2464,7 +2489,7 @@ const ze = ({ config: u }) => {
|
|
|
2464
2489
|
text: r.string,
|
|
2465
2490
|
editorKey: r.string,
|
|
2466
2491
|
options: r.arrayOf(De)
|
|
2467
|
-
}),
|
|
2492
|
+
}), ya = r.shape({
|
|
2468
2493
|
key: r.string,
|
|
2469
2494
|
label: r.string,
|
|
2470
2495
|
type: r.string,
|
|
@@ -2488,7 +2513,7 @@ ze.propTypes = {
|
|
|
2488
2513
|
isStaticData: r.bool,
|
|
2489
2514
|
/* ================= TABLE CONFIG ================= */
|
|
2490
2515
|
tableConfig: r.shape({
|
|
2491
|
-
table_head: r.arrayOf(
|
|
2516
|
+
table_head: r.arrayOf(fa).isRequired,
|
|
2492
2517
|
search: r.shape({
|
|
2493
2518
|
enabled: r.bool,
|
|
2494
2519
|
useServerSideSearch: r.bool,
|
|
@@ -2534,7 +2559,7 @@ ze.propTypes = {
|
|
|
2534
2559
|
// 👇 This covers your commented code:
|
|
2535
2560
|
component: r.elementType,
|
|
2536
2561
|
// for custom component like TeamMemberDetail
|
|
2537
|
-
fields: r.arrayOf(
|
|
2562
|
+
fields: r.arrayOf(ya),
|
|
2538
2563
|
footer: r.shape({
|
|
2539
2564
|
cancelButton: r.bool,
|
|
2540
2565
|
cancelText: r.string
|
|
@@ -2547,11 +2572,11 @@ ze.propTypes = {
|
|
|
2547
2572
|
})
|
|
2548
2573
|
}).isRequired
|
|
2549
2574
|
};
|
|
2550
|
-
const
|
|
2575
|
+
const xa = () => {
|
|
2551
2576
|
if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
|
|
2552
|
-
const
|
|
2553
|
-
|
|
2554
|
-
const
|
|
2577
|
+
const h = document.createElement("style");
|
|
2578
|
+
h.id = "react-admin-crud-manager-styles";
|
|
2579
|
+
const o = `
|
|
2555
2580
|
.no-spinner::-webkit-outer-spin-button,
|
|
2556
2581
|
.no-spinner::-webkit-inner-spin-button {
|
|
2557
2582
|
-webkit-appearance: none;
|
|
@@ -2567,14 +2592,14 @@ const ya = () => {
|
|
|
2567
2592
|
box-shadow: none !important;
|
|
2568
2593
|
}
|
|
2569
2594
|
`;
|
|
2570
|
-
|
|
2595
|
+
h.textContent = o, document.head.appendChild(h);
|
|
2571
2596
|
};
|
|
2572
|
-
function
|
|
2597
|
+
function Aa(h) {
|
|
2573
2598
|
return z(() => {
|
|
2574
|
-
|
|
2575
|
-
}, []), /* @__PURE__ */ e(
|
|
2599
|
+
xa();
|
|
2600
|
+
}, []), /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(ze, { config: h.config }) });
|
|
2576
2601
|
}
|
|
2577
2602
|
export {
|
|
2578
|
-
|
|
2603
|
+
Aa as default
|
|
2579
2604
|
};
|
|
2580
2605
|
//# sourceMappingURL=index.es.js.map
|