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