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