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