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