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