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