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