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