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