@kareemelbalshe/any-table 1.1.0 → 1.3.0
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/CHANGELOG.md +87 -0
- package/README.md +191 -3
- package/dist/columns/index.d.ts +1 -0
- package/dist/columns/pinningUtils.d.ts +17 -0
- package/dist/components/TableBody.d.ts +7 -1
- package/dist/components/TableEmptyState.d.ts +3 -1
- package/dist/components/TableErrorState.d.ts +3 -1
- package/dist/components/TableHeader.d.ts +8 -1
- package/dist/components/TablePagination.d.ts +4 -1
- package/dist/components/TableToolbar.d.ts +9 -1
- package/dist/export/exportEngine.d.ts +26 -0
- package/dist/export/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useAnyTable.d.ts +64 -0
- package/dist/hooks/useAnyTableController.d.ts +4 -2
- package/dist/hooks/useAnyTableData.d.ts +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/messages.d.ts +36 -0
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2096 -1202
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/column.types.d.ts +16 -0
- package/dist/types/table.types.d.ts +77 -1
- package/dist/types/theme.types.d.ts +1 -0
- package/package.json +18 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { useMemo as
|
|
2
|
-
function
|
|
3
|
-
if (e == null) return
|
|
1
|
+
import r, { useMemo as D, useState as $, useEffect as we, useCallback as B, useRef as ve, useImperativeHandle as Ar, createContext as Pr, useContext as Wt } from "react";
|
|
2
|
+
function L(e, t, n = void 0) {
|
|
3
|
+
if (e == null) return n;
|
|
4
4
|
if (!t || typeof t != "string") return e;
|
|
5
5
|
if (t in e && e[t] !== void 0)
|
|
6
6
|
return e[t];
|
|
@@ -9,326 +9,23 @@ function A(e, t, o = void 0) {
|
|
|
9
9
|
for (let l = 0; l < i.length; l++) {
|
|
10
10
|
const m = i[l];
|
|
11
11
|
if (a == null)
|
|
12
|
-
return
|
|
12
|
+
return n;
|
|
13
13
|
a = a[m];
|
|
14
14
|
}
|
|
15
|
-
return a !== void 0 ? a :
|
|
15
|
+
return a !== void 0 ? a : n;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Cr(e) {
|
|
18
18
|
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ot(e) {
|
|
21
21
|
if (!e || typeof e != "string") return "";
|
|
22
22
|
let t = e.replace(/[._\-]+/g, " ");
|
|
23
|
-
return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((
|
|
24
|
-
const s =
|
|
25
|
-
return
|
|
23
|
+
return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((n) => {
|
|
24
|
+
const s = n.toLowerCase();
|
|
25
|
+
return n.length <= 3 && n === n.toUpperCase() ? n : s.charAt(0).toUpperCase() + s.slice(1);
|
|
26
26
|
}).join(" ");
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function ie(e, t) {
|
|
30
|
-
const o = e.toLowerCase();
|
|
31
|
-
if (It.some((a) => o.includes(a)))
|
|
32
|
-
return "image";
|
|
33
|
-
if (Ut.some((a) => o.includes(a)))
|
|
34
|
-
return "currency";
|
|
35
|
-
if (Vt.some((a) => o.includes(a)))
|
|
36
|
-
return "status";
|
|
37
|
-
const s = t.filter((a) => a != null && a !== "");
|
|
38
|
-
if (s.length === 0)
|
|
39
|
-
return "string";
|
|
40
|
-
const i = s[0];
|
|
41
|
-
if (typeof i == "boolean" || o.startsWith("is") || o.startsWith("has"))
|
|
42
|
-
return "boolean";
|
|
43
|
-
if (Array.isArray(i))
|
|
44
|
-
return "array";
|
|
45
|
-
if (typeof i == "object")
|
|
46
|
-
return i.url && typeof i.url == "string" && Ue(i.url) ? "image" : "object";
|
|
47
|
-
if (typeof i == "number")
|
|
48
|
-
return "number";
|
|
49
|
-
if (typeof i == "string") {
|
|
50
|
-
const a = i.trim();
|
|
51
|
-
if (Ue(a))
|
|
52
|
-
return "image";
|
|
53
|
-
const l = o.includes("date") || o.includes("time") || o.endsWith("_at") || o.includes("_at_") || /(?:created|updated|deleted|modified|published)at$/i.test(o);
|
|
54
|
-
if (Yt(a) || l && a.length >= 8 && !isNaN(Date.parse(a)))
|
|
55
|
-
return a.includes("T") || a.includes(":") ? "datetime" : "date";
|
|
56
|
-
if (a.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))
|
|
57
|
-
return "email";
|
|
58
|
-
if (a.startsWith("http://") || a.startsWith("https://"))
|
|
59
|
-
return "url";
|
|
60
|
-
if (o.includes("phone") || o.includes("mobile") || o.includes("tel"))
|
|
61
|
-
return "phone";
|
|
62
|
-
}
|
|
63
|
-
return "string";
|
|
64
|
-
}
|
|
65
|
-
function Ue(e) {
|
|
66
|
-
if (!e || typeof e != "string") return !1;
|
|
67
|
-
if (e.startsWith("data:image/")) return !0;
|
|
68
|
-
const t = e.toLowerCase().split("?")[0];
|
|
69
|
-
return Ot.some((o) => t.endsWith(o));
|
|
70
|
-
}
|
|
71
|
-
function Yt(e) {
|
|
72
|
-
return !e || typeof e != "string" || e.length < 10 ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e);
|
|
73
|
-
}
|
|
74
|
-
const Gt = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
|
|
75
|
-
function Kt(e, t = Gt, o = 2) {
|
|
76
|
-
if (!e || !e.length)
|
|
77
|
-
return [];
|
|
78
|
-
const s = /* @__PURE__ */ new Map(), i = e.slice(0, 10);
|
|
79
|
-
for (const a of i)
|
|
80
|
-
!a || typeof a != "object" || Xe(a, "", s, i, t, 0, o);
|
|
81
|
-
return Array.from(s.values());
|
|
82
|
-
}
|
|
83
|
-
function Xe(e, t, o, s, i, a, l) {
|
|
84
|
-
if (!(!e || typeof e != "object" || a > l))
|
|
85
|
-
for (const m of Object.keys(e)) {
|
|
86
|
-
if (i.includes(m)) continue;
|
|
87
|
-
const d = t ? `${t}.${m}` : m, c = e[m];
|
|
88
|
-
if (Lt(c) && !Zt(c) && a < l) {
|
|
89
|
-
Xe(c, d, o, s, i, a + 1, l);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (!o.has(d)) {
|
|
93
|
-
const n = s.map((g) => A(g, d)), f = ie(d, n);
|
|
94
|
-
o.set(d, {
|
|
95
|
-
key: d,
|
|
96
|
-
title: le(d),
|
|
97
|
-
type: f,
|
|
98
|
-
sortable: !0,
|
|
99
|
-
searchable: !0,
|
|
100
|
-
align: f === "number" || f === "currency" ? "right" : "left"
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function Zt(e, t) {
|
|
106
|
-
return "en" in e && "ar" in e && Object.keys(e).length <= 3 ? !1 : "url" in e && typeof e.url == "string" || "coordinates" in e || "lat" in e && "lng" in e;
|
|
107
|
-
}
|
|
108
|
-
function Jt(e) {
|
|
109
|
-
const { data: t = [], columns: o, autoColumns: s = !0, thead: i, headerData: a } = e;
|
|
110
|
-
return a && Array.isArray(a) && a.length > 0 ? a.map((l, m) => {
|
|
111
|
-
const d = i && i[m] ? i[m] : le(l), c = t.map((f) => A(f, l)), n = ie(l, c);
|
|
112
|
-
return {
|
|
113
|
-
key: l,
|
|
114
|
-
title: d,
|
|
115
|
-
type: n,
|
|
116
|
-
sortable: !0,
|
|
117
|
-
searchable: !0,
|
|
118
|
-
align: n === "number" || n === "currency" ? "right" : "left"
|
|
119
|
-
};
|
|
120
|
-
}) : o && Array.isArray(o) && o.length > 0 ? o.map((l) => {
|
|
121
|
-
if (typeof l == "string") {
|
|
122
|
-
const n = t.map((g) => A(g, l)), f = ie(l, n);
|
|
123
|
-
return {
|
|
124
|
-
key: l,
|
|
125
|
-
title: le(l),
|
|
126
|
-
type: f,
|
|
127
|
-
sortable: !0,
|
|
128
|
-
searchable: !0,
|
|
129
|
-
align: f === "number" || f === "currency" ? "right" : "left"
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
const m = String(l.key), d = l.title !== void 0 ? l.title : le(m), c = l.type || ie(m, t.map((n) => A(n, m)));
|
|
133
|
-
return {
|
|
134
|
-
...l,
|
|
135
|
-
title: d,
|
|
136
|
-
type: c,
|
|
137
|
-
sortable: l.sortable !== void 0 ? l.sortable : !0,
|
|
138
|
-
searchable: l.searchable !== void 0 ? l.searchable : !0,
|
|
139
|
-
align: l.align || (c === "number" || c === "currency" ? "right" : "left")
|
|
140
|
-
};
|
|
141
|
-
}) : s && t && t.length > 0 ? Kt(t) : [];
|
|
142
|
-
}
|
|
143
|
-
function qt(e) {
|
|
144
|
-
const {
|
|
145
|
-
explicitActions: t,
|
|
146
|
-
buttons: o,
|
|
147
|
-
block: s,
|
|
148
|
-
handleBlock: i,
|
|
149
|
-
view: a,
|
|
150
|
-
linkView: l,
|
|
151
|
-
viewHandler: m,
|
|
152
|
-
edit: d,
|
|
153
|
-
linkEdit: c,
|
|
154
|
-
editHandler: n,
|
|
155
|
-
del: f,
|
|
156
|
-
handleDelete: g
|
|
157
|
-
} = e, u = [...t || []];
|
|
158
|
-
return o && Array.isArray(o) && o.forEach((b, y) => {
|
|
159
|
-
u.push({
|
|
160
|
-
id: `legacy-btn-${y}`,
|
|
161
|
-
label: b.label,
|
|
162
|
-
icon: b.icon,
|
|
163
|
-
className: b.className,
|
|
164
|
-
show: b.show,
|
|
165
|
-
hide: b.hide,
|
|
166
|
-
onClick: (v) => b.onClick(v)
|
|
167
|
-
});
|
|
168
|
-
}), s && i && u.push({
|
|
169
|
-
id: "legacy-block",
|
|
170
|
-
label: (b) => b.isBanned || !b.isActive ? "Unblock" : "Block",
|
|
171
|
-
variant: (b) => b.isBanned || !b.isActive ? "success" : "danger",
|
|
172
|
-
onClick: (b) => i(b?._id || b?.id)
|
|
173
|
-
}), a && (m || l) && u.push({
|
|
174
|
-
id: "legacy-view",
|
|
175
|
-
label: "View",
|
|
176
|
-
variant: "primary",
|
|
177
|
-
onClick: (b) => {
|
|
178
|
-
const y = b?._id || b?.id;
|
|
179
|
-
m ? m(y) : l && typeof window < "u" && (window.location.href = `${l}/${y}`);
|
|
180
|
-
}
|
|
181
|
-
}), d && (n || c) && u.push({
|
|
182
|
-
id: "legacy-edit",
|
|
183
|
-
label: "Edit",
|
|
184
|
-
variant: "info",
|
|
185
|
-
onClick: (b) => {
|
|
186
|
-
const y = b?._id || b?.id;
|
|
187
|
-
n ? n(y) : c && typeof window < "u" && (window.location.href = `${c}/${y}`);
|
|
188
|
-
}
|
|
189
|
-
}), f && g && u.push({
|
|
190
|
-
id: "legacy-del",
|
|
191
|
-
label: "Delete",
|
|
192
|
-
variant: "danger",
|
|
193
|
-
confirmation: {
|
|
194
|
-
title: "Delete Item",
|
|
195
|
-
message: "Are you sure you want to delete this record?"
|
|
196
|
-
},
|
|
197
|
-
onClick: (b) => g(b?._id || b?.id)
|
|
198
|
-
}), u;
|
|
199
|
-
}
|
|
200
|
-
function Xt({
|
|
201
|
-
config: e,
|
|
202
|
-
onSearchChange: t
|
|
203
|
-
}) {
|
|
204
|
-
const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.debounce ?? 350, [a, l] = P(""), [m, d] = P(""), [c, n] = P(!1);
|
|
205
|
-
G(() => {
|
|
206
|
-
if (!s) return;
|
|
207
|
-
if (a === "") {
|
|
208
|
-
d(""), n(!1), t?.("");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
n(!0);
|
|
212
|
-
const u = setTimeout(() => {
|
|
213
|
-
d(a), n(!1), t?.(a);
|
|
214
|
-
}, i);
|
|
215
|
-
return () => {
|
|
216
|
-
clearTimeout(u);
|
|
217
|
-
};
|
|
218
|
-
}, [a, i, s, t]);
|
|
219
|
-
const f = S((u) => {
|
|
220
|
-
l(u);
|
|
221
|
-
}, []), g = S(() => {
|
|
222
|
-
l(""), d(""), n(!1), t?.("");
|
|
223
|
-
}, [t]);
|
|
224
|
-
return {
|
|
225
|
-
enabled: s,
|
|
226
|
-
search: a,
|
|
227
|
-
debouncedSearch: m,
|
|
228
|
-
isDebouncing: c,
|
|
229
|
-
setSearch: f,
|
|
230
|
-
clearSearch: g,
|
|
231
|
-
searchConfig: o
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function Qt({
|
|
235
|
-
config: e,
|
|
236
|
-
onSortChange: t
|
|
237
|
-
}) {
|
|
238
|
-
const o = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = o.enabled !== !1 && !!e, i = o.allowUnsort ?? !0, [a, l] = P(
|
|
239
|
-
o.defaultSortBy || null
|
|
240
|
-
), [m, d] = P(
|
|
241
|
-
o.defaultSortOrder || null
|
|
242
|
-
), c = S(
|
|
243
|
-
(g) => {
|
|
244
|
-
if (s) {
|
|
245
|
-
if (a !== g) {
|
|
246
|
-
l(g), d("asc"), t?.(g, "asc");
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
m === "asc" ? (d("desc"), t?.(g, "desc")) : m === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(g, "asc"));
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
[s, a, m, i, t]
|
|
253
|
-
), n = S(
|
|
254
|
-
(g, u) => {
|
|
255
|
-
l(g), d(u), t?.(g, u);
|
|
256
|
-
},
|
|
257
|
-
[t]
|
|
258
|
-
), f = S(() => {
|
|
259
|
-
l(null), d(null), t?.(null, null);
|
|
260
|
-
}, [t]);
|
|
261
|
-
return {
|
|
262
|
-
enabled: s,
|
|
263
|
-
sortBy: a,
|
|
264
|
-
sortOrder: m,
|
|
265
|
-
toggleSort: c,
|
|
266
|
-
setSorting: n,
|
|
267
|
-
resetSorting: f,
|
|
268
|
-
sortingConfig: o
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function er({
|
|
272
|
-
config: e,
|
|
273
|
-
totalRecords: t,
|
|
274
|
-
onPageChange: o
|
|
275
|
-
}) {
|
|
276
|
-
const s = $(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), i = s.enabled !== !1 && !!e, a = s.defaultPage || 1, l = s.defaultPageSize || 10, m = s.pageSizeOptions || [5, 10, 20, 50, 100], [d, c] = P(a), [n, f] = P(l), g = Math.max(1, Math.ceil(t / Math.max(1, n))), u = S(
|
|
277
|
-
(p) => {
|
|
278
|
-
const x = Math.max(1, Math.min(p, g));
|
|
279
|
-
c(x), o?.(x, n);
|
|
280
|
-
},
|
|
281
|
-
[g, n, o]
|
|
282
|
-
), b = S(
|
|
283
|
-
(p) => {
|
|
284
|
-
f(p), c(1), o?.(1, p);
|
|
285
|
-
},
|
|
286
|
-
[o]
|
|
287
|
-
), y = S(() => {
|
|
288
|
-
d < g && u(d + 1);
|
|
289
|
-
}, [d, g, u]), v = S(() => {
|
|
290
|
-
d > 1 && u(d - 1);
|
|
291
|
-
}, [d, u]), T = S(() => {
|
|
292
|
-
c(1), f(l), o?.(1, l);
|
|
293
|
-
}, [l, o]), B = S(
|
|
294
|
-
(p = 5) => {
|
|
295
|
-
const x = Math.max(
|
|
296
|
-
1,
|
|
297
|
-
Math.min(d - Math.floor(p / 2), g - p + 1)
|
|
298
|
-
), k = Math.min(g, x + p - 1), w = [];
|
|
299
|
-
for (let D = x; D <= k; D++)
|
|
300
|
-
w.push(D);
|
|
301
|
-
return w;
|
|
302
|
-
},
|
|
303
|
-
[d, g]
|
|
304
|
-
), E = S(
|
|
305
|
-
(p) => {
|
|
306
|
-
if (!i) return p;
|
|
307
|
-
const x = (d - 1) * n;
|
|
308
|
-
return p.slice(x, x + n);
|
|
309
|
-
},
|
|
310
|
-
[i, d, n]
|
|
311
|
-
);
|
|
312
|
-
return {
|
|
313
|
-
enabled: i,
|
|
314
|
-
page: d,
|
|
315
|
-
pageSize: n,
|
|
316
|
-
totalRecords: t,
|
|
317
|
-
totalPages: g,
|
|
318
|
-
pageSizeOptions: m,
|
|
319
|
-
hasNextPage: d < g,
|
|
320
|
-
hasPrevPage: d > 1,
|
|
321
|
-
setPage: u,
|
|
322
|
-
setPageSize: b,
|
|
323
|
-
nextPage: y,
|
|
324
|
-
prevPage: v,
|
|
325
|
-
resetPagination: T,
|
|
326
|
-
getPageWindow: B,
|
|
327
|
-
sliceData: E,
|
|
328
|
-
paginationConfig: s
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
const tr = [
|
|
28
|
+
const Tr = [
|
|
332
29
|
"total",
|
|
333
30
|
"totalCount",
|
|
334
31
|
"count",
|
|
@@ -344,7 +41,7 @@ const tr = [
|
|
|
344
41
|
"pageInfo.total",
|
|
345
42
|
"pageInfo.totalCount",
|
|
346
43
|
"paging.total"
|
|
347
|
-
],
|
|
44
|
+
], Rr = [
|
|
348
45
|
"page",
|
|
349
46
|
"currentPage",
|
|
350
47
|
"pageNumber",
|
|
@@ -354,7 +51,7 @@ const tr = [
|
|
|
354
51
|
"pagination.page",
|
|
355
52
|
"pagination.currentPage",
|
|
356
53
|
"pageInfo.page"
|
|
357
|
-
],
|
|
54
|
+
], Br = [
|
|
358
55
|
"pageSize",
|
|
359
56
|
"limit",
|
|
360
57
|
"perPage",
|
|
@@ -365,7 +62,7 @@ const tr = [
|
|
|
365
62
|
"pagination.pageSize",
|
|
366
63
|
"pagination.limit",
|
|
367
64
|
"pagination.perPage"
|
|
368
|
-
],
|
|
65
|
+
], $r = [
|
|
369
66
|
"totalPages",
|
|
370
67
|
"pageCount",
|
|
371
68
|
"lastPage",
|
|
@@ -376,82 +73,82 @@ const tr = [
|
|
|
376
73
|
"pagination.totalPages",
|
|
377
74
|
"pagination.lastPage"
|
|
378
75
|
];
|
|
379
|
-
function
|
|
76
|
+
function We(e, t, n = 1, s = 10, i) {
|
|
380
77
|
if (!e || typeof e != "object") {
|
|
381
|
-
const
|
|
78
|
+
const u = i !== void 0 ? i : 0;
|
|
382
79
|
return {
|
|
383
|
-
page:
|
|
80
|
+
page: n,
|
|
384
81
|
pageSize: s,
|
|
385
|
-
total:
|
|
386
|
-
totalPages: Math.max(1, Math.ceil(
|
|
82
|
+
total: u,
|
|
83
|
+
totalPages: Math.max(1, Math.ceil(u / Math.max(1, s))),
|
|
387
84
|
hasNextPage: !1,
|
|
388
85
|
hasPrevPage: !1
|
|
389
86
|
};
|
|
390
87
|
}
|
|
391
88
|
let a;
|
|
392
89
|
if (t?.totalPath) {
|
|
393
|
-
const
|
|
394
|
-
typeof
|
|
90
|
+
const u = L(e, t.totalPath);
|
|
91
|
+
typeof u == "number" ? a = u : typeof u == "string" && !isNaN(Number(u)) && (a = Number(u));
|
|
395
92
|
}
|
|
396
93
|
if (a === void 0)
|
|
397
|
-
for (const
|
|
398
|
-
const
|
|
399
|
-
if (typeof
|
|
400
|
-
a =
|
|
94
|
+
for (const u of Tr) {
|
|
95
|
+
const o = L(e, u);
|
|
96
|
+
if (typeof o == "number" && !isNaN(o)) {
|
|
97
|
+
a = o;
|
|
401
98
|
break;
|
|
402
99
|
}
|
|
403
|
-
if (typeof
|
|
404
|
-
a = Number(
|
|
100
|
+
if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
|
|
101
|
+
a = Number(o);
|
|
405
102
|
break;
|
|
406
103
|
}
|
|
407
104
|
}
|
|
408
105
|
a === void 0 && (a = i !== void 0 ? i : 0);
|
|
409
106
|
let l;
|
|
410
107
|
if (t?.pagePath) {
|
|
411
|
-
const
|
|
412
|
-
typeof
|
|
108
|
+
const u = L(e, t.pagePath);
|
|
109
|
+
typeof u == "number" ? l = u : typeof u == "string" && !isNaN(Number(u)) && (l = Number(u));
|
|
413
110
|
}
|
|
414
111
|
if (l === void 0)
|
|
415
|
-
for (const
|
|
416
|
-
const
|
|
417
|
-
if (typeof
|
|
418
|
-
l =
|
|
112
|
+
for (const u of Rr) {
|
|
113
|
+
const o = L(e, u);
|
|
114
|
+
if (typeof o == "number" && !isNaN(o)) {
|
|
115
|
+
l = o;
|
|
419
116
|
break;
|
|
420
117
|
}
|
|
421
|
-
if (typeof
|
|
422
|
-
l = Number(
|
|
118
|
+
if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
|
|
119
|
+
l = Number(o);
|
|
423
120
|
break;
|
|
424
121
|
}
|
|
425
122
|
}
|
|
426
|
-
l === void 0 && (l =
|
|
123
|
+
l === void 0 && (l = n);
|
|
427
124
|
let m;
|
|
428
125
|
if (t?.pageSizePath) {
|
|
429
|
-
const
|
|
430
|
-
typeof
|
|
126
|
+
const u = L(e, t.pageSizePath);
|
|
127
|
+
typeof u == "number" ? m = u : typeof u == "string" && !isNaN(Number(u)) && (m = Number(u));
|
|
431
128
|
}
|
|
432
129
|
if (m === void 0)
|
|
433
|
-
for (const
|
|
434
|
-
const
|
|
435
|
-
if (typeof
|
|
436
|
-
m =
|
|
130
|
+
for (const u of Br) {
|
|
131
|
+
const o = L(e, u);
|
|
132
|
+
if (typeof o == "number" && !isNaN(o)) {
|
|
133
|
+
m = o;
|
|
437
134
|
break;
|
|
438
135
|
}
|
|
439
|
-
if (typeof
|
|
440
|
-
m = Number(
|
|
136
|
+
if (typeof o == "string" && o.trim() !== "" && !isNaN(Number(o))) {
|
|
137
|
+
m = Number(o);
|
|
441
138
|
break;
|
|
442
139
|
}
|
|
443
140
|
}
|
|
444
141
|
m === void 0 && (m = s);
|
|
445
142
|
let d;
|
|
446
143
|
if (t?.totalPagesPath) {
|
|
447
|
-
const
|
|
448
|
-
typeof
|
|
144
|
+
const u = L(e, t.totalPagesPath);
|
|
145
|
+
typeof u == "number" ? d = u : typeof u == "string" && !isNaN(Number(u)) && (d = Number(u));
|
|
449
146
|
}
|
|
450
147
|
if (d === void 0)
|
|
451
|
-
for (const
|
|
452
|
-
const
|
|
453
|
-
if (typeof
|
|
454
|
-
d =
|
|
148
|
+
for (const u of $r) {
|
|
149
|
+
const o = L(e, u);
|
|
150
|
+
if (typeof o == "number" && !isNaN(o)) {
|
|
151
|
+
d = o;
|
|
455
152
|
break;
|
|
456
153
|
}
|
|
457
154
|
}
|
|
@@ -464,7 +161,7 @@ function q(e, t, o = 1, s = 10, i) {
|
|
|
464
161
|
hasPrevPage: l > 1
|
|
465
162
|
};
|
|
466
163
|
}
|
|
467
|
-
const
|
|
164
|
+
const zr = [
|
|
468
165
|
"data",
|
|
469
166
|
"items",
|
|
470
167
|
"results",
|
|
@@ -485,14 +182,14 @@ const or = [
|
|
|
485
182
|
"subscriptions",
|
|
486
183
|
"deadLetters.items"
|
|
487
184
|
];
|
|
488
|
-
function
|
|
489
|
-
const s =
|
|
185
|
+
function wt(e, t, n) {
|
|
186
|
+
const s = n?.page || 1, i = n?.pageSize || 10;
|
|
490
187
|
if (t?.transformResponse && typeof t.transformResponse == "function") {
|
|
491
188
|
const a = t.transformResponse(e);
|
|
492
189
|
if (Array.isArray(a))
|
|
493
190
|
return {
|
|
494
191
|
data: a,
|
|
495
|
-
meta:
|
|
192
|
+
meta: We(e, t.response, s, i, a.length),
|
|
496
193
|
raw: e
|
|
497
194
|
};
|
|
498
195
|
if (a && typeof a == "object") {
|
|
@@ -501,7 +198,7 @@ function sr(e, t, o) {
|
|
|
501
198
|
page: a.meta.page !== void 0 ? a.meta.page : s,
|
|
502
199
|
pageSize: a.meta.pageSize !== void 0 ? a.meta.pageSize : i,
|
|
503
200
|
totalPages: a.meta.totalPages !== void 0 ? a.meta.totalPages : Math.max(1, Math.ceil((a.meta.total || l.length) / (a.meta.pageSize || i)))
|
|
504
|
-
} :
|
|
201
|
+
} : We(e, t.response, s, i, l.length);
|
|
505
202
|
return { data: l, meta: m, raw: e };
|
|
506
203
|
}
|
|
507
204
|
}
|
|
@@ -519,14 +216,14 @@ function sr(e, t, o) {
|
|
|
519
216
|
raw: e
|
|
520
217
|
};
|
|
521
218
|
if (t?.response?.dataPath) {
|
|
522
|
-
const a =
|
|
219
|
+
const a = L(e, t.response.dataPath), l = Array.isArray(a) ? a : [], m = We(e, t.response, s, i, l.length);
|
|
523
220
|
return { data: l, meta: m, raw: e };
|
|
524
221
|
}
|
|
525
222
|
if (e && typeof e == "object") {
|
|
526
|
-
for (const a of
|
|
527
|
-
const l =
|
|
223
|
+
for (const a of zr) {
|
|
224
|
+
const l = L(e, a);
|
|
528
225
|
if (Array.isArray(l)) {
|
|
529
|
-
const m =
|
|
226
|
+
const m = We(e, t?.response, s, i, l.length);
|
|
530
227
|
return {
|
|
531
228
|
data: l,
|
|
532
229
|
meta: m,
|
|
@@ -536,7 +233,7 @@ function sr(e, t, o) {
|
|
|
536
233
|
}
|
|
537
234
|
for (const a in e)
|
|
538
235
|
if (Array.isArray(e[a])) {
|
|
539
|
-
const l =
|
|
236
|
+
const l = We(e, t?.response, s, i, e[a].length);
|
|
540
237
|
return {
|
|
541
238
|
data: e[a],
|
|
542
239
|
meta: l,
|
|
@@ -573,7 +270,346 @@ function sr(e, t, o) {
|
|
|
573
270
|
raw: e
|
|
574
271
|
};
|
|
575
272
|
}
|
|
576
|
-
|
|
273
|
+
const jr = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], Mr = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Dr = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], Lr = ["status", "state", "phase", "condition"];
|
|
274
|
+
function st(e, t) {
|
|
275
|
+
const n = e.toLowerCase();
|
|
276
|
+
if (Mr.some((a) => n.includes(a)))
|
|
277
|
+
return "image";
|
|
278
|
+
if (Dr.some((a) => n.includes(a)))
|
|
279
|
+
return "currency";
|
|
280
|
+
if (Lr.some((a) => n.includes(a)))
|
|
281
|
+
return "status";
|
|
282
|
+
const s = t.filter((a) => a != null && a !== "");
|
|
283
|
+
if (s.length === 0)
|
|
284
|
+
return "string";
|
|
285
|
+
const i = s[0];
|
|
286
|
+
if (typeof i == "boolean" || n.startsWith("is") || n.startsWith("has"))
|
|
287
|
+
return "boolean";
|
|
288
|
+
if (Array.isArray(i))
|
|
289
|
+
return "array";
|
|
290
|
+
if (typeof i == "object")
|
|
291
|
+
return i.url && typeof i.url == "string" && Bt(i.url) ? "image" : "object";
|
|
292
|
+
if (typeof i == "number")
|
|
293
|
+
return "number";
|
|
294
|
+
if (typeof i == "string") {
|
|
295
|
+
const a = i.trim();
|
|
296
|
+
if (Bt(a))
|
|
297
|
+
return "image";
|
|
298
|
+
const l = n.includes("date") || n.includes("time") || n.endsWith("_at") || n.includes("_at_") || /(?:created|updated|deleted|modified|published)at$/i.test(n);
|
|
299
|
+
if (Wr(a) || l && a.length >= 8 && !isNaN(Date.parse(a)))
|
|
300
|
+
return a.includes("T") || a.includes(":") ? "datetime" : "date";
|
|
301
|
+
if (a.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a))
|
|
302
|
+
return "email";
|
|
303
|
+
if (a.startsWith("http://") || a.startsWith("https://"))
|
|
304
|
+
return "url";
|
|
305
|
+
if (n.includes("phone") || n.includes("mobile") || n.includes("tel"))
|
|
306
|
+
return "phone";
|
|
307
|
+
}
|
|
308
|
+
return "string";
|
|
309
|
+
}
|
|
310
|
+
function Bt(e) {
|
|
311
|
+
if (!e || typeof e != "string") return !1;
|
|
312
|
+
if (e.startsWith("data:image/")) return !0;
|
|
313
|
+
const t = e.toLowerCase().split("?")[0];
|
|
314
|
+
return jr.some((n) => t.endsWith(n));
|
|
315
|
+
}
|
|
316
|
+
function Wr(e) {
|
|
317
|
+
return !e || typeof e != "string" || e.length < 10 ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e);
|
|
318
|
+
}
|
|
319
|
+
const _r = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
|
|
320
|
+
function Or(e, t = _r, n = 2) {
|
|
321
|
+
if (!e || !e.length)
|
|
322
|
+
return [];
|
|
323
|
+
const s = /* @__PURE__ */ new Map(), i = e.slice(0, 10);
|
|
324
|
+
for (const a of i)
|
|
325
|
+
!a || typeof a != "object" || _t(a, "", s, i, t, 0, n);
|
|
326
|
+
return Array.from(s.values());
|
|
327
|
+
}
|
|
328
|
+
function _t(e, t, n, s, i, a, l) {
|
|
329
|
+
if (!(!e || typeof e != "object" || a > l))
|
|
330
|
+
for (const m of Object.keys(e)) {
|
|
331
|
+
if (i.includes(m)) continue;
|
|
332
|
+
const d = t ? `${t}.${m}` : m, u = e[m];
|
|
333
|
+
if (Cr(u) && !Fr(u) && a < l) {
|
|
334
|
+
_t(u, d, n, s, i, a + 1, l);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (!n.has(d)) {
|
|
338
|
+
const o = s.map((c) => L(c, d)), p = st(d, o);
|
|
339
|
+
n.set(d, {
|
|
340
|
+
key: d,
|
|
341
|
+
title: ot(d),
|
|
342
|
+
type: p,
|
|
343
|
+
sortable: !0,
|
|
344
|
+
searchable: !0,
|
|
345
|
+
align: p === "number" || p === "currency" ? "right" : "left"
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function Fr(e, t) {
|
|
351
|
+
return "en" in e && "ar" in e && Object.keys(e).length <= 3 ? !1 : "url" in e && typeof e.url == "string" || "coordinates" in e || "lat" in e && "lng" in e;
|
|
352
|
+
}
|
|
353
|
+
function Ot(e) {
|
|
354
|
+
const { data: t = [], columns: n, autoColumns: s = !0, thead: i, headerData: a } = e;
|
|
355
|
+
return a && Array.isArray(a) && a.length > 0 ? a.map((l, m) => {
|
|
356
|
+
const d = i && i[m] ? i[m] : ot(l), u = t.map((p) => L(p, l)), o = st(l, u);
|
|
357
|
+
return {
|
|
358
|
+
key: l,
|
|
359
|
+
title: d,
|
|
360
|
+
type: o,
|
|
361
|
+
sortable: !0,
|
|
362
|
+
searchable: !0,
|
|
363
|
+
align: o === "number" || o === "currency" ? "right" : "left"
|
|
364
|
+
};
|
|
365
|
+
}) : n && Array.isArray(n) && n.length > 0 ? n.map((l) => {
|
|
366
|
+
if (typeof l == "string") {
|
|
367
|
+
const o = t.map((c) => L(c, l)), p = st(l, o);
|
|
368
|
+
return {
|
|
369
|
+
key: l,
|
|
370
|
+
title: ot(l),
|
|
371
|
+
type: p,
|
|
372
|
+
sortable: !0,
|
|
373
|
+
searchable: !0,
|
|
374
|
+
align: p === "number" || p === "currency" ? "right" : "left"
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
const m = String(l.key), d = l.title !== void 0 ? l.title : ot(m), u = l.type || st(m, t.map((o) => L(o, m)));
|
|
378
|
+
return {
|
|
379
|
+
...l,
|
|
380
|
+
title: d,
|
|
381
|
+
type: u,
|
|
382
|
+
sortable: l.sortable !== void 0 ? l.sortable : !0,
|
|
383
|
+
searchable: l.searchable !== void 0 ? l.searchable : !0,
|
|
384
|
+
align: l.align || (u === "number" || u === "currency" ? "right" : "left")
|
|
385
|
+
};
|
|
386
|
+
}) : s && t && t.length > 0 ? Or(t) : [];
|
|
387
|
+
}
|
|
388
|
+
function yt(e) {
|
|
389
|
+
if (typeof e == "number") return e;
|
|
390
|
+
if (typeof e == "string") {
|
|
391
|
+
const t = parseInt(e, 10);
|
|
392
|
+
if (!isNaN(t)) return t;
|
|
393
|
+
}
|
|
394
|
+
return 150;
|
|
395
|
+
}
|
|
396
|
+
function Hr(e, t = {}) {
|
|
397
|
+
const {
|
|
398
|
+
selectable: n = !1,
|
|
399
|
+
hasActions: s = !1,
|
|
400
|
+
actionsWidth: i = 100,
|
|
401
|
+
columnWidths: a = {},
|
|
402
|
+
isRtl: l = !1
|
|
403
|
+
} = t, m = {};
|
|
404
|
+
let d = n ? 44 : 0;
|
|
405
|
+
for (let o = 0; o < e.length; o++) {
|
|
406
|
+
const p = e[o], c = String(p.key), g = a[c] ?? yt(p.width);
|
|
407
|
+
p.pinned === "left" && (m[c] = {
|
|
408
|
+
position: "sticky",
|
|
409
|
+
[l ? "right" : "left"]: `${d}px`,
|
|
410
|
+
zIndex: 5
|
|
411
|
+
}, d += g);
|
|
412
|
+
}
|
|
413
|
+
let u = s ? yt(i) : 0;
|
|
414
|
+
for (let o = e.length - 1; o >= 0; o--) {
|
|
415
|
+
const p = e[o], c = String(p.key), g = a[c] ?? yt(p.width);
|
|
416
|
+
p.pinned === "right" && (m[c] = {
|
|
417
|
+
position: "sticky",
|
|
418
|
+
[l ? "left" : "right"]: `${u}px`,
|
|
419
|
+
zIndex: 5
|
|
420
|
+
}, u += g);
|
|
421
|
+
}
|
|
422
|
+
return m;
|
|
423
|
+
}
|
|
424
|
+
function Kr(e) {
|
|
425
|
+
const {
|
|
426
|
+
explicitActions: t,
|
|
427
|
+
buttons: n,
|
|
428
|
+
block: s,
|
|
429
|
+
handleBlock: i,
|
|
430
|
+
view: a,
|
|
431
|
+
linkView: l,
|
|
432
|
+
viewHandler: m,
|
|
433
|
+
edit: d,
|
|
434
|
+
linkEdit: u,
|
|
435
|
+
editHandler: o,
|
|
436
|
+
del: p,
|
|
437
|
+
handleDelete: c
|
|
438
|
+
} = e, g = [...t || []];
|
|
439
|
+
return n && Array.isArray(n) && n.forEach((f, b) => {
|
|
440
|
+
g.push({
|
|
441
|
+
id: `legacy-btn-${b}`,
|
|
442
|
+
label: f.label,
|
|
443
|
+
icon: f.icon,
|
|
444
|
+
className: f.className,
|
|
445
|
+
show: f.show,
|
|
446
|
+
hide: f.hide,
|
|
447
|
+
onClick: (S) => f.onClick(S)
|
|
448
|
+
});
|
|
449
|
+
}), s && i && g.push({
|
|
450
|
+
id: "legacy-block",
|
|
451
|
+
label: (f) => f.isBanned || !f.isActive ? "Unblock" : "Block",
|
|
452
|
+
variant: (f) => f.isBanned || !f.isActive ? "success" : "danger",
|
|
453
|
+
onClick: (f) => i(f?._id || f?.id)
|
|
454
|
+
}), a && (m || l) && g.push({
|
|
455
|
+
id: "legacy-view",
|
|
456
|
+
label: "View",
|
|
457
|
+
variant: "primary",
|
|
458
|
+
onClick: (f) => {
|
|
459
|
+
const b = f?._id || f?.id;
|
|
460
|
+
m ? m(b) : l && typeof window < "u" && (window.location.href = `${l}/${b}`);
|
|
461
|
+
}
|
|
462
|
+
}), d && (o || u) && g.push({
|
|
463
|
+
id: "legacy-edit",
|
|
464
|
+
label: "Edit",
|
|
465
|
+
variant: "info",
|
|
466
|
+
onClick: (f) => {
|
|
467
|
+
const b = f?._id || f?.id;
|
|
468
|
+
o ? o(b) : u && typeof window < "u" && (window.location.href = `${u}/${b}`);
|
|
469
|
+
}
|
|
470
|
+
}), p && c && g.push({
|
|
471
|
+
id: "legacy-del",
|
|
472
|
+
label: "Delete",
|
|
473
|
+
variant: "danger",
|
|
474
|
+
confirmation: {
|
|
475
|
+
title: "Delete Item",
|
|
476
|
+
message: "Are you sure you want to delete this record?"
|
|
477
|
+
},
|
|
478
|
+
onClick: (f) => c(f?._id || f?.id)
|
|
479
|
+
}), g;
|
|
480
|
+
}
|
|
481
|
+
function Ft({
|
|
482
|
+
config: e,
|
|
483
|
+
onSearchChange: t
|
|
484
|
+
}) {
|
|
485
|
+
const n = D(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, i = n.debounce ?? 350, [a, l] = $(""), [m, d] = $(""), [u, o] = $(!1);
|
|
486
|
+
we(() => {
|
|
487
|
+
if (!s) return;
|
|
488
|
+
if (a === "") {
|
|
489
|
+
d(""), o(!1), t?.("");
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
o(!0);
|
|
493
|
+
const g = setTimeout(() => {
|
|
494
|
+
d(a), o(!1), t?.(a);
|
|
495
|
+
}, i);
|
|
496
|
+
return () => {
|
|
497
|
+
clearTimeout(g);
|
|
498
|
+
};
|
|
499
|
+
}, [a, i, s, t]);
|
|
500
|
+
const p = B((g) => {
|
|
501
|
+
l(g);
|
|
502
|
+
}, []), c = B(() => {
|
|
503
|
+
l(""), d(""), o(!1), t?.("");
|
|
504
|
+
}, [t]);
|
|
505
|
+
return {
|
|
506
|
+
enabled: s,
|
|
507
|
+
search: a,
|
|
508
|
+
debouncedSearch: m,
|
|
509
|
+
isDebouncing: u,
|
|
510
|
+
setSearch: p,
|
|
511
|
+
clearSearch: c,
|
|
512
|
+
searchConfig: n
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function Ht({
|
|
516
|
+
config: e,
|
|
517
|
+
onSortChange: t
|
|
518
|
+
}) {
|
|
519
|
+
const n = D(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), s = n.enabled !== !1 && !!e, i = n.allowUnsort ?? !0, [a, l] = $(
|
|
520
|
+
n.defaultSortBy || null
|
|
521
|
+
), [m, d] = $(
|
|
522
|
+
n.defaultSortOrder || null
|
|
523
|
+
), u = B(
|
|
524
|
+
(c) => {
|
|
525
|
+
if (s) {
|
|
526
|
+
if (a !== c) {
|
|
527
|
+
l(c), d("asc"), t?.(c, "asc");
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
m === "asc" ? (d("desc"), t?.(c, "desc")) : m === "desc" && i ? (l(null), d(null), t?.(null, null)) : (d("asc"), t?.(c, "asc"));
|
|
531
|
+
}
|
|
532
|
+
},
|
|
533
|
+
[s, a, m, i, t]
|
|
534
|
+
), o = B(
|
|
535
|
+
(c, g) => {
|
|
536
|
+
l(c), d(g), t?.(c, g);
|
|
537
|
+
},
|
|
538
|
+
[t]
|
|
539
|
+
), p = B(() => {
|
|
540
|
+
l(null), d(null), t?.(null, null);
|
|
541
|
+
}, [t]);
|
|
542
|
+
return {
|
|
543
|
+
enabled: s,
|
|
544
|
+
sortBy: a,
|
|
545
|
+
sortOrder: m,
|
|
546
|
+
toggleSort: u,
|
|
547
|
+
setSorting: o,
|
|
548
|
+
resetSorting: p,
|
|
549
|
+
sortingConfig: n
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
function Kt({
|
|
553
|
+
config: e,
|
|
554
|
+
totalRecords: t,
|
|
555
|
+
onPageChange: n
|
|
556
|
+
}) {
|
|
557
|
+
const s = D(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), i = s.enabled !== !1 && !!e, a = s.defaultPage || 1, l = s.defaultPageSize || 10, m = s.pageSizeOptions || [5, 10, 20, 50, 100], [d, u] = $(a), [o, p] = $(l), c = Math.max(1, Math.ceil(t / Math.max(1, o))), g = B(
|
|
558
|
+
(y) => {
|
|
559
|
+
const x = Math.max(1, Math.min(y, c));
|
|
560
|
+
u(x), n?.(x, o);
|
|
561
|
+
},
|
|
562
|
+
[c, o, n]
|
|
563
|
+
), f = B(
|
|
564
|
+
(y) => {
|
|
565
|
+
p(y), u(1), n?.(1, y);
|
|
566
|
+
},
|
|
567
|
+
[n]
|
|
568
|
+
), b = B(() => {
|
|
569
|
+
d < c && g(d + 1);
|
|
570
|
+
}, [d, c, g]), S = B(() => {
|
|
571
|
+
d > 1 && g(d - 1);
|
|
572
|
+
}, [d, g]), z = B(() => {
|
|
573
|
+
u(1), p(l), n?.(1, l);
|
|
574
|
+
}, [l, n]), W = B(
|
|
575
|
+
(y = 5) => {
|
|
576
|
+
const x = Math.max(
|
|
577
|
+
1,
|
|
578
|
+
Math.min(d - Math.floor(y / 2), c - y + 1)
|
|
579
|
+
), k = Math.min(c, x + y - 1), h = [];
|
|
580
|
+
for (let j = x; j <= k; j++)
|
|
581
|
+
h.push(j);
|
|
582
|
+
return h;
|
|
583
|
+
},
|
|
584
|
+
[d, c]
|
|
585
|
+
), E = B(
|
|
586
|
+
(y) => {
|
|
587
|
+
if (!i) return y;
|
|
588
|
+
const x = (d - 1) * o;
|
|
589
|
+
return y.slice(x, x + o);
|
|
590
|
+
},
|
|
591
|
+
[i, d, o]
|
|
592
|
+
);
|
|
593
|
+
return {
|
|
594
|
+
enabled: i,
|
|
595
|
+
page: d,
|
|
596
|
+
pageSize: o,
|
|
597
|
+
totalRecords: t,
|
|
598
|
+
totalPages: c,
|
|
599
|
+
pageSizeOptions: m,
|
|
600
|
+
hasNextPage: d < c,
|
|
601
|
+
hasPrevPage: d > 1,
|
|
602
|
+
setPage: g,
|
|
603
|
+
setPageSize: f,
|
|
604
|
+
nextPage: b,
|
|
605
|
+
prevPage: S,
|
|
606
|
+
resetPagination: z,
|
|
607
|
+
getPageWindow: W,
|
|
608
|
+
sliceData: E,
|
|
609
|
+
paginationConfig: s
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function Ir(e, t, n, s) {
|
|
577
613
|
if (!e || !e.length) return [];
|
|
578
614
|
if (!t || typeof t != "string" || !t.trim()) return e;
|
|
579
615
|
const i = t.trim().toLowerCase();
|
|
@@ -583,149 +619,154 @@ function lr(e, t, o, s) {
|
|
|
583
619
|
return e.filter((l) => {
|
|
584
620
|
if (!l || typeof l != "object") return !1;
|
|
585
621
|
const m = [];
|
|
586
|
-
if (
|
|
587
|
-
for (const
|
|
588
|
-
const
|
|
589
|
-
|
|
622
|
+
if (n && n.length > 0)
|
|
623
|
+
for (const u of n) {
|
|
624
|
+
const o = L(l, u);
|
|
625
|
+
o != null && (typeof o == "object" ? m.push(JSON.stringify(o).toLowerCase()) : m.push(String(o).toLowerCase()));
|
|
590
626
|
}
|
|
591
627
|
else
|
|
592
|
-
|
|
628
|
+
ht(l, m);
|
|
593
629
|
const d = m.join(" ");
|
|
594
|
-
return a.every((
|
|
630
|
+
return a.every((u) => d.includes(u));
|
|
595
631
|
});
|
|
596
632
|
}
|
|
597
|
-
function
|
|
598
|
-
if (!(
|
|
633
|
+
function ht(e, t, n = 0) {
|
|
634
|
+
if (!(n > 4 || e === null || e === void 0)) {
|
|
599
635
|
if (typeof e != "object") {
|
|
600
636
|
t.push(String(e).toLowerCase());
|
|
601
637
|
return;
|
|
602
638
|
}
|
|
603
639
|
if (Array.isArray(e)) {
|
|
604
640
|
for (const s of e)
|
|
605
|
-
|
|
641
|
+
ht(s, t, n + 1);
|
|
606
642
|
return;
|
|
607
643
|
}
|
|
608
644
|
for (const s in e)
|
|
609
645
|
if (Object.prototype.hasOwnProperty.call(e, s)) {
|
|
610
646
|
if (s.startsWith("__") || s.toLowerCase().includes("password")) continue;
|
|
611
|
-
|
|
647
|
+
ht(e[s], t, n + 1);
|
|
612
648
|
}
|
|
613
649
|
}
|
|
614
650
|
}
|
|
615
|
-
function
|
|
616
|
-
if (!e || !e.length || !t || !
|
|
651
|
+
function Ur(e, t, n, s) {
|
|
652
|
+
if (!e || !e.length || !t || !n)
|
|
617
653
|
return e;
|
|
618
654
|
const i = [...e];
|
|
619
655
|
return s && typeof s == "function" ? (i.sort((a, l) => {
|
|
620
|
-
const m =
|
|
656
|
+
const m = L(a, t), d = L(l, t);
|
|
621
657
|
if (m == null)
|
|
622
658
|
return d == null ? 0 : 1;
|
|
623
659
|
if (d == null) return -1;
|
|
624
|
-
const
|
|
625
|
-
return
|
|
660
|
+
const u = s(a, l);
|
|
661
|
+
return n === "desc" ? -u : u;
|
|
626
662
|
}), i) : (i.sort((a, l) => {
|
|
627
|
-
const m =
|
|
663
|
+
const m = L(a, t), d = L(l, t);
|
|
628
664
|
if (m == null)
|
|
629
665
|
return d == null ? 0 : 1;
|
|
630
666
|
if (d == null)
|
|
631
667
|
return -1;
|
|
632
|
-
let
|
|
668
|
+
let u = 0;
|
|
633
669
|
if (typeof m == "number" && typeof d == "number")
|
|
634
|
-
|
|
670
|
+
u = m - d;
|
|
635
671
|
else if (typeof m == "boolean" && typeof d == "boolean")
|
|
636
|
-
|
|
672
|
+
u = m === d ? 0 : m ? -1 : 1;
|
|
637
673
|
else if (m instanceof Date && d instanceof Date)
|
|
638
|
-
|
|
639
|
-
else if (typeof m == "string" && typeof d == "string" &&
|
|
640
|
-
|
|
674
|
+
u = m.getTime() - d.getTime();
|
|
675
|
+
else if (typeof m == "string" && typeof d == "string" && $t(m) && $t(d))
|
|
676
|
+
u = new Date(m).getTime() - new Date(d).getTime();
|
|
641
677
|
else {
|
|
642
|
-
const
|
|
643
|
-
|
|
678
|
+
const o = String(m), p = String(d);
|
|
679
|
+
u = o.localeCompare(p, void 0, {
|
|
644
680
|
numeric: !0,
|
|
645
681
|
sensitivity: "base"
|
|
646
682
|
});
|
|
647
683
|
}
|
|
648
|
-
return
|
|
684
|
+
return n === "desc" ? -u : u;
|
|
649
685
|
}), i);
|
|
650
686
|
}
|
|
651
|
-
function
|
|
687
|
+
function $t(e) {
|
|
652
688
|
return e.length < 10 ? !1 : /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(e);
|
|
653
689
|
}
|
|
654
|
-
function
|
|
690
|
+
function It({
|
|
655
691
|
data: e,
|
|
656
692
|
api: t,
|
|
657
|
-
columns:
|
|
693
|
+
columns: n,
|
|
658
694
|
searchQuery: s,
|
|
659
695
|
sortBy: i,
|
|
660
696
|
sortOrder: a,
|
|
661
697
|
page: l,
|
|
662
698
|
pageSize: m,
|
|
663
699
|
paginationEnabled: d = !0,
|
|
664
|
-
manualLoading:
|
|
700
|
+
manualLoading: u
|
|
665
701
|
}) {
|
|
666
|
-
const
|
|
667
|
-
|
|
702
|
+
const o = !!(t && typeof t.fetcher == "function"), p = o && t?.mode !== "client", [c, g] = $([]), [f, b] = $(0), [S, z] = $(!1), [W, E] = $(null), [y, x] = $(0), k = ve(null), h = ve(t);
|
|
703
|
+
h.current = t;
|
|
704
|
+
const j = B(async () => {
|
|
705
|
+
const P = h.current;
|
|
706
|
+
if (!o || !P?.fetcher) return;
|
|
668
707
|
k.current && k.current.abort();
|
|
669
|
-
const
|
|
670
|
-
k.current =
|
|
671
|
-
const
|
|
672
|
-
[
|
|
673
|
-
[
|
|
708
|
+
const H = new AbortController();
|
|
709
|
+
k.current = H, z(!0), E(null);
|
|
710
|
+
const N = P.paramNames || {}, U = N.pageParam || "page", G = N.pageSizeParam || "limit", R = N.searchParam || "q", V = N.sortByParam || "sortBy", C = N.sortOrderParam || "sortOrder", J = {
|
|
711
|
+
[U]: l,
|
|
712
|
+
[G]: m,
|
|
674
713
|
page: l,
|
|
675
714
|
pageSize: m,
|
|
676
|
-
...s ? { [
|
|
677
|
-
...i ? { [
|
|
678
|
-
...a ? { [
|
|
679
|
-
...
|
|
715
|
+
...s ? { [R]: s, search: s, q: s } : {},
|
|
716
|
+
...i ? { [V]: i, sortBy: i } : {},
|
|
717
|
+
...a ? { [C]: a, sortOrder: a } : {},
|
|
718
|
+
...P.params || {}
|
|
680
719
|
};
|
|
681
720
|
try {
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
721
|
+
const se = await P.fetcher(J, H.signal);
|
|
722
|
+
if (H.signal.aborted) return;
|
|
723
|
+
const ce = wt(
|
|
724
|
+
se,
|
|
725
|
+
P,
|
|
726
|
+
J
|
|
688
727
|
);
|
|
689
|
-
|
|
690
|
-
} catch (
|
|
691
|
-
if (
|
|
728
|
+
g(ce.data), b(ce.meta.total), P.onSuccess?.(ce);
|
|
729
|
+
} catch (se) {
|
|
730
|
+
if (se?.name === "AbortError" || se?.name === "CanceledError")
|
|
692
731
|
return;
|
|
693
|
-
E(
|
|
732
|
+
E(se), P.onError?.(se);
|
|
694
733
|
} finally {
|
|
695
|
-
|
|
734
|
+
H.signal.aborted || z(!1);
|
|
696
735
|
}
|
|
697
|
-
}, [
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}, [
|
|
736
|
+
}, [o, l, m, s, i, a]);
|
|
737
|
+
we(() => {
|
|
738
|
+
o && j();
|
|
739
|
+
}, [j, y]), we(() => () => {
|
|
701
740
|
k.current && k.current.abort();
|
|
702
741
|
}, []);
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
}, [
|
|
706
|
-
if (
|
|
742
|
+
const v = B(async () => {
|
|
743
|
+
o && x((P) => P + 1);
|
|
744
|
+
}, [o]), { displayRows: F, allFilteredRows: w, finalTotal: T } = D(() => {
|
|
745
|
+
if (p)
|
|
707
746
|
return {
|
|
708
|
-
displayRows:
|
|
709
|
-
|
|
747
|
+
displayRows: c,
|
|
748
|
+
allFilteredRows: c,
|
|
749
|
+
finalTotal: f
|
|
710
750
|
};
|
|
711
|
-
const
|
|
712
|
-
let
|
|
751
|
+
const P = o ? c : e || [], H = n.filter((C) => C.searchable !== !1).map((C) => C.key), N = Ir(P, s, H), G = n.find((C) => C.key === i)?.comparator, R = Ur(N, i, a, G);
|
|
752
|
+
let V;
|
|
713
753
|
if (d) {
|
|
714
|
-
const
|
|
715
|
-
|
|
754
|
+
const C = (l - 1) * m;
|
|
755
|
+
V = R.slice(C, C + m);
|
|
716
756
|
} else
|
|
717
|
-
|
|
757
|
+
V = R;
|
|
718
758
|
return {
|
|
719
|
-
displayRows:
|
|
720
|
-
|
|
759
|
+
displayRows: V,
|
|
760
|
+
allFilteredRows: R,
|
|
761
|
+
finalTotal: N.length
|
|
721
762
|
};
|
|
722
763
|
}, [
|
|
764
|
+
p,
|
|
765
|
+
o,
|
|
766
|
+
c,
|
|
767
|
+
e,
|
|
723
768
|
f,
|
|
724
769
|
n,
|
|
725
|
-
g,
|
|
726
|
-
e,
|
|
727
|
-
b,
|
|
728
|
-
o,
|
|
729
770
|
s,
|
|
730
771
|
i,
|
|
731
772
|
a,
|
|
@@ -734,120 +775,127 @@ function dr({
|
|
|
734
775
|
d
|
|
735
776
|
]);
|
|
736
777
|
return {
|
|
737
|
-
rows:
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
778
|
+
rows: F,
|
|
779
|
+
allFilteredRows: w,
|
|
780
|
+
totalRecords: T,
|
|
781
|
+
loading: u !== void 0 ? u : S,
|
|
782
|
+
error: W,
|
|
783
|
+
refresh: v,
|
|
784
|
+
isServerMode: p,
|
|
785
|
+
rawRemoteData: c
|
|
744
786
|
};
|
|
745
787
|
}
|
|
746
|
-
function
|
|
788
|
+
function Vr({
|
|
747
789
|
tableRef: e,
|
|
748
790
|
refresh: t,
|
|
749
|
-
resetPagination:
|
|
791
|
+
resetPagination: n,
|
|
750
792
|
resetSearch: s,
|
|
751
793
|
resetSorting: i,
|
|
752
794
|
setPage: a,
|
|
753
795
|
setPageSize: l,
|
|
754
796
|
setSearch: m,
|
|
755
797
|
setSorting: d,
|
|
756
|
-
selectedRows:
|
|
757
|
-
clearSelection:
|
|
758
|
-
getState:
|
|
759
|
-
scrollToIndex:
|
|
798
|
+
selectedRows: u,
|
|
799
|
+
clearSelection: o,
|
|
800
|
+
getState: p,
|
|
801
|
+
scrollToIndex: c,
|
|
802
|
+
exportData: g,
|
|
803
|
+
isExporting: f
|
|
760
804
|
}) {
|
|
761
|
-
|
|
805
|
+
Ar(
|
|
762
806
|
e,
|
|
763
807
|
() => ({
|
|
764
808
|
refresh: t,
|
|
765
809
|
reset: () => {
|
|
766
|
-
|
|
810
|
+
n(), s(), i(), o();
|
|
767
811
|
},
|
|
768
812
|
resetSearch: s,
|
|
769
813
|
resetSorting: i,
|
|
770
|
-
resetPagination:
|
|
814
|
+
resetPagination: n,
|
|
771
815
|
setPage: a,
|
|
772
816
|
setPageSize: l,
|
|
773
817
|
setSearch: m,
|
|
774
818
|
setSorting: d,
|
|
775
|
-
getSelectedRows: () =>
|
|
776
|
-
clearSelection:
|
|
777
|
-
getState:
|
|
778
|
-
scrollToIndex:
|
|
819
|
+
getSelectedRows: () => u,
|
|
820
|
+
clearSelection: o,
|
|
821
|
+
getState: p,
|
|
822
|
+
scrollToIndex: c,
|
|
823
|
+
exportData: g,
|
|
824
|
+
isExporting: f
|
|
779
825
|
}),
|
|
780
826
|
[
|
|
781
827
|
t,
|
|
782
|
-
|
|
828
|
+
n,
|
|
783
829
|
s,
|
|
784
830
|
i,
|
|
785
831
|
a,
|
|
786
832
|
l,
|
|
787
833
|
m,
|
|
788
834
|
d,
|
|
835
|
+
u,
|
|
836
|
+
o,
|
|
837
|
+
p,
|
|
789
838
|
c,
|
|
790
|
-
|
|
791
|
-
f
|
|
792
|
-
g
|
|
839
|
+
g,
|
|
840
|
+
f
|
|
793
841
|
]
|
|
794
842
|
);
|
|
795
843
|
}
|
|
796
|
-
function
|
|
844
|
+
function Ut({
|
|
797
845
|
rows: e,
|
|
798
846
|
rowKeyResolver: t,
|
|
799
|
-
onSelectionChange:
|
|
847
|
+
onSelectionChange: n
|
|
800
848
|
}) {
|
|
801
|
-
const [s, i] =
|
|
802
|
-
|
|
803
|
-
e && e.length > 0 && e.forEach((
|
|
804
|
-
const
|
|
805
|
-
s.has(
|
|
849
|
+
const [s, i] = $(/* @__PURE__ */ new Set()), a = ve(/* @__PURE__ */ new Map());
|
|
850
|
+
we(() => {
|
|
851
|
+
e && e.length > 0 && e.forEach((c, g) => {
|
|
852
|
+
const f = t(c, g);
|
|
853
|
+
s.has(f) && a.current.set(f, c);
|
|
806
854
|
});
|
|
807
855
|
}, [e, s, t]);
|
|
808
|
-
const l =
|
|
809
|
-
(
|
|
810
|
-
i((
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
(
|
|
856
|
+
const l = B(
|
|
857
|
+
(c, g) => {
|
|
858
|
+
i((f) => {
|
|
859
|
+
const b = new Set(f);
|
|
860
|
+
b.has(c) ? (b.delete(c), a.current.delete(c)) : (b.add(c), a.current.set(c, g));
|
|
861
|
+
const S = Array.from(b).map(
|
|
862
|
+
(z) => a.current.get(z) || e.find((W, E) => t(W, E) === z)
|
|
815
863
|
).filter(Boolean);
|
|
816
|
-
return
|
|
864
|
+
return n?.(S, Array.from(b)), b;
|
|
817
865
|
});
|
|
818
866
|
},
|
|
819
|
-
[e, t,
|
|
820
|
-
), m =
|
|
867
|
+
[e, t, n]
|
|
868
|
+
), m = B(() => {
|
|
821
869
|
if (s.size === e.length && e.length > 0)
|
|
822
|
-
i(/* @__PURE__ */ new Set()), a.current.clear(),
|
|
870
|
+
i(/* @__PURE__ */ new Set()), a.current.clear(), n?.([], []);
|
|
823
871
|
else {
|
|
824
|
-
const
|
|
825
|
-
e.forEach((
|
|
826
|
-
a.current.set(t(
|
|
827
|
-
}), i(
|
|
872
|
+
const c = new Set(e.map((g, f) => t(g, f)));
|
|
873
|
+
e.forEach((g, f) => {
|
|
874
|
+
a.current.set(t(g, f), g);
|
|
875
|
+
}), i(c), n?.(e, Array.from(c));
|
|
828
876
|
}
|
|
829
|
-
}, [e, s.size, t,
|
|
830
|
-
i(/* @__PURE__ */ new Set()), a.current.clear(),
|
|
831
|
-
}, [
|
|
832
|
-
(
|
|
877
|
+
}, [e, s.size, t, n]), d = B(() => {
|
|
878
|
+
i(/* @__PURE__ */ new Set()), a.current.clear(), n?.([], []);
|
|
879
|
+
}, [n]), u = e.length > 0 && s.size === e.length, o = s.size > 0 && s.size < e.length, p = D(() => Array.from(s).map(
|
|
880
|
+
(c) => a.current.get(c) || e.find((g, f) => t(g, f) === c)
|
|
833
881
|
).filter(Boolean), [e, s, t]);
|
|
834
882
|
return {
|
|
835
883
|
selectedKeys: s,
|
|
836
884
|
setSelectedKeys: i,
|
|
837
|
-
selectedRows:
|
|
885
|
+
selectedRows: p,
|
|
838
886
|
onToggleSelectRow: l,
|
|
839
887
|
handleToggleSelectAll: m,
|
|
840
888
|
clearSelection: d,
|
|
841
|
-
allSelected:
|
|
842
|
-
isIndeterminate:
|
|
889
|
+
allSelected: u,
|
|
890
|
+
isIndeterminate: o
|
|
843
891
|
};
|
|
844
892
|
}
|
|
845
|
-
function
|
|
893
|
+
function Jr({
|
|
846
894
|
config: e,
|
|
847
895
|
totalCount: t,
|
|
848
|
-
scrollContainerRef:
|
|
896
|
+
scrollContainerRef: n
|
|
849
897
|
}) {
|
|
850
|
-
const s =
|
|
898
|
+
const s = D(() => typeof e == "object" && e !== null ? {
|
|
851
899
|
enabled: e.enabled !== !1,
|
|
852
900
|
rowHeight: e.rowHeight ?? 48,
|
|
853
901
|
maxHeight: e.maxHeight ?? 520,
|
|
@@ -857,31 +905,31 @@ function gr({
|
|
|
857
905
|
rowHeight: 48,
|
|
858
906
|
maxHeight: 520,
|
|
859
907
|
overscan: 10
|
|
860
|
-
}, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d,
|
|
908
|
+
}, [e]), i = !!(s.enabled && t > 0), a = s.rowHeight || 48, l = s.maxHeight || 520, m = s.overscan ?? 10, [d, u] = $(0), [o, p] = $(
|
|
861
909
|
typeof l == "number" ? l : 520
|
|
862
|
-
),
|
|
863
|
-
|
|
910
|
+
), c = ve(null);
|
|
911
|
+
we(() => {
|
|
864
912
|
if (!i) return;
|
|
865
|
-
const
|
|
866
|
-
if (!
|
|
867
|
-
|
|
913
|
+
const y = n.current;
|
|
914
|
+
if (!y) return;
|
|
915
|
+
y.clientHeight > 0 && p(y.clientHeight);
|
|
868
916
|
const x = () => {
|
|
869
|
-
|
|
870
|
-
|
|
917
|
+
c.current !== null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
|
|
918
|
+
y && u(y.scrollTop);
|
|
871
919
|
});
|
|
872
920
|
};
|
|
873
|
-
|
|
921
|
+
y.addEventListener("scroll", x, { passive: !0 });
|
|
874
922
|
let k = null;
|
|
875
|
-
return typeof ResizeObserver < "u" && (k = new ResizeObserver((
|
|
876
|
-
for (const
|
|
877
|
-
const
|
|
878
|
-
|
|
923
|
+
return typeof ResizeObserver < "u" && (k = new ResizeObserver((h) => {
|
|
924
|
+
for (const j of h) {
|
|
925
|
+
const v = j.contentRect;
|
|
926
|
+
v.height > 0 && p(v.height);
|
|
879
927
|
}
|
|
880
|
-
}), k.observe(
|
|
881
|
-
|
|
928
|
+
}), k.observe(y)), () => {
|
|
929
|
+
y.removeEventListener("scroll", x), c.current !== null && cancelAnimationFrame(c.current), k && k.disconnect();
|
|
882
930
|
};
|
|
883
|
-
}, [i,
|
|
884
|
-
const
|
|
931
|
+
}, [i, n]);
|
|
932
|
+
const g = t * a, { startIndex: f, endIndex: b, paddingTop: S, paddingBottom: z } = D(() => {
|
|
885
933
|
if (!i || t === 0)
|
|
886
934
|
return {
|
|
887
935
|
startIndex: 0,
|
|
@@ -889,56 +937,56 @@ function gr({
|
|
|
889
937
|
paddingTop: 0,
|
|
890
938
|
paddingBottom: 0
|
|
891
939
|
};
|
|
892
|
-
const
|
|
940
|
+
const y = Math.floor(d / a), x = Math.ceil(o / a), k = Math.max(0, y - m), h = Math.min(t - 1, y + x + m), j = k * a, v = Math.max(0, (t - 1 - h) * a);
|
|
893
941
|
return {
|
|
894
942
|
startIndex: k,
|
|
895
|
-
endIndex:
|
|
896
|
-
paddingTop:
|
|
897
|
-
paddingBottom:
|
|
943
|
+
endIndex: h,
|
|
944
|
+
paddingTop: j,
|
|
945
|
+
paddingBottom: v
|
|
898
946
|
};
|
|
899
|
-
}, [i, t, a, d,
|
|
900
|
-
(
|
|
901
|
-
const k =
|
|
947
|
+
}, [i, t, a, d, o, m]), W = B(
|
|
948
|
+
(y, x = "auto") => {
|
|
949
|
+
const k = n.current;
|
|
902
950
|
if (!k) return;
|
|
903
|
-
const
|
|
904
|
-
let
|
|
951
|
+
const h = y * a, j = k.scrollTop, v = k.clientHeight || (typeof l == "number" ? l : 520);
|
|
952
|
+
let F = h;
|
|
905
953
|
if (x === "start")
|
|
906
|
-
|
|
954
|
+
F = h;
|
|
907
955
|
else if (x === "end")
|
|
908
|
-
|
|
956
|
+
F = h - v + a;
|
|
909
957
|
else if (x === "center")
|
|
910
|
-
|
|
911
|
-
else if (
|
|
912
|
-
|
|
913
|
-
else if (
|
|
914
|
-
|
|
958
|
+
F = h - v / 2 + a / 2;
|
|
959
|
+
else if (h < j)
|
|
960
|
+
F = h;
|
|
961
|
+
else if (h + a > j + v)
|
|
962
|
+
F = h - v + a;
|
|
915
963
|
else
|
|
916
964
|
return;
|
|
917
|
-
const
|
|
965
|
+
const w = Math.max(0, Math.min(F, g - v));
|
|
918
966
|
typeof k.scrollTo == "function" ? k.scrollTo({
|
|
919
|
-
top:
|
|
967
|
+
top: w,
|
|
920
968
|
behavior: "smooth"
|
|
921
|
-
}) : k.scrollTop =
|
|
969
|
+
}) : k.scrollTop = w;
|
|
922
970
|
},
|
|
923
|
-
[a, l,
|
|
924
|
-
), E =
|
|
925
|
-
(
|
|
926
|
-
[i,
|
|
971
|
+
[a, l, g, n]
|
|
972
|
+
), E = B(
|
|
973
|
+
(y) => i ? y.slice(f, b + 1) : y,
|
|
974
|
+
[i, f, b]
|
|
927
975
|
);
|
|
928
976
|
return {
|
|
929
977
|
isVirtualized: i,
|
|
930
|
-
totalHeight:
|
|
931
|
-
paddingTop:
|
|
932
|
-
paddingBottom:
|
|
933
|
-
startIndex:
|
|
934
|
-
endIndex:
|
|
978
|
+
totalHeight: g,
|
|
979
|
+
paddingTop: S,
|
|
980
|
+
paddingBottom: z,
|
|
981
|
+
startIndex: f,
|
|
982
|
+
endIndex: b,
|
|
935
983
|
rowHeight: a,
|
|
936
984
|
maxHeight: l,
|
|
937
|
-
scrollToIndex:
|
|
985
|
+
scrollToIndex: W,
|
|
938
986
|
sliceRows: E
|
|
939
987
|
};
|
|
940
988
|
}
|
|
941
|
-
const
|
|
989
|
+
const Vt = {
|
|
942
990
|
primary: "#2667EC",
|
|
943
991
|
primaryHover: "#1E54C6",
|
|
944
992
|
primaryLight: "#397FF6",
|
|
@@ -957,9 +1005,9 @@ const Qe = {
|
|
|
957
1005
|
inputBg: "#1E293B",
|
|
958
1006
|
rowHover: "rgba(38, 103, 236, 0.04)",
|
|
959
1007
|
rowSelected: "rgba(38, 103, 236, 0.08)"
|
|
960
|
-
},
|
|
1008
|
+
}, zt = {
|
|
961
1009
|
default: {
|
|
962
|
-
colors:
|
|
1010
|
+
colors: Vt,
|
|
963
1011
|
borderRadius: "1rem",
|
|
964
1012
|
density: "normal",
|
|
965
1013
|
classes: {
|
|
@@ -1091,9 +1139,9 @@ const Qe = {
|
|
|
1091
1139
|
paginationButtonActive: "bg-blue-800 text-white font-bold"
|
|
1092
1140
|
}
|
|
1093
1141
|
}
|
|
1094
|
-
},
|
|
1142
|
+
}, Jt = {
|
|
1095
1143
|
mode: "auto",
|
|
1096
|
-
colors:
|
|
1144
|
+
colors: Vt,
|
|
1097
1145
|
borderRadius: "1rem",
|
|
1098
1146
|
fontFamily: "'Alexandria', system-ui, -apple-system, sans-serif",
|
|
1099
1147
|
density: "normal",
|
|
@@ -1113,13 +1161,13 @@ const Qe = {
|
|
|
1113
1161
|
paginationButtonActive: "bg-primary text-white hover:bg-primary-soft shadow-md shadow-primary/30",
|
|
1114
1162
|
paginationSelect: "h-9 px-3 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-sm font-medium text-gray-700 dark:text-gray-300 focus:outline-none focus:border-primary cursor-pointer"
|
|
1115
1163
|
}
|
|
1116
|
-
},
|
|
1164
|
+
}, kt = Pr(Jt), qr = ({
|
|
1117
1165
|
theme: e,
|
|
1118
1166
|
preset: t,
|
|
1119
|
-
children:
|
|
1167
|
+
children: n
|
|
1120
1168
|
}) => {
|
|
1121
|
-
const s =
|
|
1122
|
-
const a = s ||
|
|
1169
|
+
const s = Wt(kt), i = D(() => {
|
|
1170
|
+
const a = s || Jt, l = t && zt[t] ? zt[t] : {};
|
|
1123
1171
|
return {
|
|
1124
1172
|
...a,
|
|
1125
1173
|
...l,
|
|
@@ -1136,19 +1184,19 @@ const Qe = {
|
|
|
1136
1184
|
}
|
|
1137
1185
|
};
|
|
1138
1186
|
}, [s, t, e]);
|
|
1139
|
-
return /* @__PURE__ */ r.createElement(
|
|
1187
|
+
return /* @__PURE__ */ r.createElement(kt.Provider, { value: i }, n);
|
|
1140
1188
|
};
|
|
1141
|
-
function
|
|
1142
|
-
return
|
|
1189
|
+
function _e() {
|
|
1190
|
+
return Wt(kt);
|
|
1143
1191
|
}
|
|
1144
|
-
function
|
|
1192
|
+
function Yr({
|
|
1145
1193
|
value: e,
|
|
1146
1194
|
onChange: t,
|
|
1147
|
-
onClear:
|
|
1195
|
+
onClear: n,
|
|
1148
1196
|
isDebouncing: s = !1,
|
|
1149
1197
|
placeholder: i = "Search records..."
|
|
1150
1198
|
}) {
|
|
1151
|
-
const a =
|
|
1199
|
+
const a = _e();
|
|
1152
1200
|
return /* @__PURE__ */ r.createElement("div", { className: a.classes?.searchContainer || "w-full sm:max-w-md relative flex items-center" }, /* @__PURE__ */ r.createElement("span", { className: "absolute left-3.5 text-gray-400 dark:text-gray-500 pointer-events-none flex items-center" }, /* @__PURE__ */ r.createElement(
|
|
1153
1201
|
"svg",
|
|
1154
1202
|
{
|
|
@@ -1180,7 +1228,7 @@ function br({
|
|
|
1180
1228
|
"button",
|
|
1181
1229
|
{
|
|
1182
1230
|
type: "button",
|
|
1183
|
-
onClick:
|
|
1231
|
+
onClick: n,
|
|
1184
1232
|
className: "p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",
|
|
1185
1233
|
title: "Clear search"
|
|
1186
1234
|
},
|
|
@@ -1195,132 +1243,465 @@ function br({
|
|
|
1195
1243
|
},
|
|
1196
1244
|
/* @__PURE__ */ r.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })
|
|
1197
1245
|
)
|
|
1198
|
-
)));
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1246
|
+
)));
|
|
1247
|
+
}
|
|
1248
|
+
const Ee = {
|
|
1249
|
+
searchPlaceholder: "Search records...",
|
|
1250
|
+
noRecordsTitle: "No records found",
|
|
1251
|
+
noRecordsDescription: "Try adjusting your search query or clear active filters.",
|
|
1252
|
+
errorTitle: "Unable to load data",
|
|
1253
|
+
errorDescription: "An unexpected error occurred while fetching the records.",
|
|
1254
|
+
retry: "Retry Request",
|
|
1255
|
+
showing: "Showing",
|
|
1256
|
+
to: "to",
|
|
1257
|
+
of: "of",
|
|
1258
|
+
results: "results",
|
|
1259
|
+
page: "Page",
|
|
1260
|
+
rowsPerPage: "Rows / page",
|
|
1261
|
+
actions: "Actions",
|
|
1262
|
+
export: "Export",
|
|
1263
|
+
exportCsv: "Export CSV",
|
|
1264
|
+
exportJson: "Export JSON",
|
|
1265
|
+
exportSuccess: "Export completed successfully",
|
|
1266
|
+
exporting: "Exporting...",
|
|
1267
|
+
exportAll: "Export All Filtered",
|
|
1268
|
+
exportCurrentPage: "Export Current Page",
|
|
1269
|
+
exportSelected: "Export Selected Rows",
|
|
1270
|
+
selectAll: "Select all rows",
|
|
1271
|
+
selectRow: "Select row",
|
|
1272
|
+
prevPage: "Previous page",
|
|
1273
|
+
nextPage: "Next page",
|
|
1274
|
+
confirmTitle: "Are you sure?",
|
|
1275
|
+
confirmButton: "Confirm",
|
|
1276
|
+
cancelButton: "Cancel",
|
|
1277
|
+
addRecord: "Add",
|
|
1278
|
+
clearSearch: "Clear search",
|
|
1279
|
+
loading: "Loading..."
|
|
1280
|
+
}, Gr = {
|
|
1281
|
+
searchPlaceholder: "بحث في السجلات...",
|
|
1282
|
+
noRecordsTitle: "لا توجد سجلات",
|
|
1283
|
+
noRecordsDescription: "جرّب تغيير عبارة البحث أو إعادة تعيين الفلاتر.",
|
|
1284
|
+
errorTitle: "تعذر تحميل بيانات الجدول",
|
|
1285
|
+
errorDescription: "حدث خطأ غير متوقع أثناء جلب السجلات من الخادم.",
|
|
1286
|
+
retry: "إعادة المحاولة",
|
|
1287
|
+
showing: "عرض",
|
|
1288
|
+
to: "إلى",
|
|
1289
|
+
of: "من إجمالي",
|
|
1290
|
+
results: "سجل",
|
|
1291
|
+
page: "صفحة",
|
|
1292
|
+
rowsPerPage: "سجل لكل صفحة",
|
|
1293
|
+
actions: "الإجراءات",
|
|
1294
|
+
export: "تصدير",
|
|
1295
|
+
exportCsv: "تصدير CSV (Excel)",
|
|
1296
|
+
exportJson: "تصدير JSON",
|
|
1297
|
+
exportSuccess: "تم تصدير البيانات بنجاح",
|
|
1298
|
+
exporting: "جاري التصدير...",
|
|
1299
|
+
exportAll: "تصدير كل السجلات (المفلترة)",
|
|
1300
|
+
exportCurrentPage: "تصدير الصفحة الحالية فقط",
|
|
1301
|
+
exportSelected: "تصدير السجلات المحددة",
|
|
1302
|
+
selectAll: "تحديد جميع الصفوف",
|
|
1303
|
+
selectRow: "تحديد الصف",
|
|
1304
|
+
prevPage: "الصفحة السابقة",
|
|
1305
|
+
nextPage: "الصفحة التالية",
|
|
1306
|
+
confirmTitle: "هل أنت متأكد؟",
|
|
1307
|
+
confirmButton: "تأكيد",
|
|
1308
|
+
cancelButton: "إلغاء",
|
|
1309
|
+
addRecord: "إضافة",
|
|
1310
|
+
clearSearch: "مسح البحث",
|
|
1311
|
+
loading: "جاري التحميل..."
|
|
1312
|
+
};
|
|
1313
|
+
function Xr(e = "en", t) {
|
|
1314
|
+
const s = e.toLowerCase().startsWith("ar") ? Gr : Ee;
|
|
1315
|
+
return t ? { ...s, ...t } : s;
|
|
1316
|
+
}
|
|
1317
|
+
function Zr({
|
|
1318
|
+
displayTitle: e,
|
|
1319
|
+
subtitle: t,
|
|
1320
|
+
isSearchEnabled: n,
|
|
1321
|
+
searchQuery: s = "",
|
|
1322
|
+
setSearch: i,
|
|
1323
|
+
clearSearch: a,
|
|
1324
|
+
isDebouncing: l = !1,
|
|
1325
|
+
searchPlaceholder: m,
|
|
1326
|
+
headerActions: d,
|
|
1327
|
+
add: u,
|
|
1328
|
+
linkAdd: o,
|
|
1329
|
+
addHandler: p,
|
|
1330
|
+
messages: c = Ee,
|
|
1331
|
+
exportable: g = !1,
|
|
1332
|
+
onExport: f,
|
|
1333
|
+
isExporting: b = !1,
|
|
1334
|
+
hasSelectedRows: S = !1,
|
|
1335
|
+
dir: z = "ltr"
|
|
1336
|
+
}) {
|
|
1337
|
+
const W = z === "rtl", [E, y] = $(!1), x = ve(null), k = !!(g && f), h = typeof g == "object" ? g.csv !== !1 : !0, j = typeof g == "object" ? g.json === !0 : !1, v = typeof g == "object" ? !!g.showScopeOptions : !1, F = h && j || v;
|
|
1338
|
+
return we(() => {
|
|
1339
|
+
function T(P) {
|
|
1340
|
+
x.current && !x.current.contains(P.target) && y(!1);
|
|
1341
|
+
}
|
|
1342
|
+
return E && document.addEventListener("mousedown", T), () => {
|
|
1343
|
+
document.removeEventListener("mousedown", T);
|
|
1344
|
+
};
|
|
1345
|
+
}, [E]), !!(e || t || n || d || u || k) ? /* @__PURE__ */ r.createElement(
|
|
1346
|
+
"div",
|
|
1347
|
+
{
|
|
1348
|
+
dir: z,
|
|
1349
|
+
className: `w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1 ${W ? "text-right" : "text-left"}`
|
|
1350
|
+
},
|
|
1351
|
+
(e || t) && /* @__PURE__ */ r.createElement("div", { className: "flex flex-col" }, e && /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold tracking-tight text-gray-900 dark:text-white flex items-center gap-2" }, e), t && /* @__PURE__ */ r.createElement("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5" }, t)),
|
|
1352
|
+
/* @__PURE__ */ r.createElement(
|
|
1353
|
+
"div",
|
|
1354
|
+
{
|
|
1355
|
+
className: `flex flex-wrap items-center gap-3 w-full sm:w-auto ${W ? "justify-start sm:justify-start mr-auto" : "justify-start sm:justify-end ml-auto"}`
|
|
1356
|
+
},
|
|
1357
|
+
n && i && a && /* @__PURE__ */ r.createElement(
|
|
1358
|
+
Yr,
|
|
1359
|
+
{
|
|
1360
|
+
value: s,
|
|
1361
|
+
onChange: i,
|
|
1362
|
+
onClear: a,
|
|
1363
|
+
isDebouncing: l,
|
|
1364
|
+
placeholder: m || c.searchPlaceholder
|
|
1365
|
+
}
|
|
1366
|
+
),
|
|
1367
|
+
k && /* @__PURE__ */ r.createElement("div", { className: "relative inline-block", ref: x }, F ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1368
|
+
"button",
|
|
1369
|
+
{
|
|
1370
|
+
type: "button",
|
|
1371
|
+
disabled: b,
|
|
1372
|
+
onClick: () => y((T) => !T),
|
|
1373
|
+
className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",
|
|
1374
|
+
title: b ? c.exporting : c.export
|
|
1375
|
+
},
|
|
1376
|
+
b ? /* @__PURE__ */ r.createElement(
|
|
1377
|
+
"svg",
|
|
1378
|
+
{
|
|
1379
|
+
className: "w-4 h-4 animate-spin text-primary",
|
|
1380
|
+
viewBox: "0 0 24 24",
|
|
1381
|
+
fill: "none"
|
|
1382
|
+
},
|
|
1383
|
+
/* @__PURE__ */ r.createElement(
|
|
1384
|
+
"circle",
|
|
1385
|
+
{
|
|
1386
|
+
className: "opacity-25",
|
|
1387
|
+
cx: "12",
|
|
1388
|
+
cy: "12",
|
|
1389
|
+
r: "10",
|
|
1390
|
+
stroke: "currentColor",
|
|
1391
|
+
strokeWidth: "4"
|
|
1392
|
+
}
|
|
1393
|
+
),
|
|
1394
|
+
/* @__PURE__ */ r.createElement(
|
|
1395
|
+
"path",
|
|
1396
|
+
{
|
|
1397
|
+
className: "opacity-75",
|
|
1398
|
+
fill: "currentColor",
|
|
1399
|
+
d: "M4 12a8 8 0 018-8v8H4z"
|
|
1400
|
+
}
|
|
1401
|
+
)
|
|
1402
|
+
) : /* @__PURE__ */ r.createElement(
|
|
1403
|
+
"svg",
|
|
1404
|
+
{
|
|
1405
|
+
className: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
1406
|
+
fill: "none",
|
|
1407
|
+
viewBox: "0 0 24 24",
|
|
1408
|
+
stroke: "currentColor",
|
|
1409
|
+
strokeWidth: 2
|
|
1410
|
+
},
|
|
1411
|
+
/* @__PURE__ */ r.createElement(
|
|
1412
|
+
"path",
|
|
1413
|
+
{
|
|
1414
|
+
strokeLinecap: "round",
|
|
1415
|
+
strokeLinejoin: "round",
|
|
1416
|
+
d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
|
|
1417
|
+
}
|
|
1418
|
+
)
|
|
1419
|
+
),
|
|
1420
|
+
/* @__PURE__ */ r.createElement("span", null, b ? c.exporting : c.export),
|
|
1421
|
+
/* @__PURE__ */ r.createElement("span", { className: "text-[10px] opacity-70" }, "▼")
|
|
1422
|
+
), E && /* @__PURE__ */ r.createElement(
|
|
1423
|
+
"div",
|
|
1424
|
+
{
|
|
1425
|
+
className: `absolute mt-1.5 w-48 rounded-xl border border-gray-100 dark:border-gray-800 bg-white dark:bg-slate-800 shadow-xl z-30 py-1 overflow-hidden any-table-fade-in ${W ? "left-0" : "right-0"}`
|
|
1426
|
+
},
|
|
1427
|
+
h && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1428
|
+
"button",
|
|
1429
|
+
{
|
|
1430
|
+
type: "button",
|
|
1431
|
+
disabled: b,
|
|
1432
|
+
onClick: () => {
|
|
1433
|
+
f?.("csv", "all"), y(!1);
|
|
1434
|
+
},
|
|
1435
|
+
className: "w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer disabled:opacity-50"
|
|
1436
|
+
},
|
|
1437
|
+
/* @__PURE__ */ r.createElement("span", { className: "text-emerald-500 font-bold" }, "📊"),
|
|
1438
|
+
/* @__PURE__ */ r.createElement("span", null, v ? c.exportAll : c.exportCsv)
|
|
1439
|
+
), v && /* @__PURE__ */ r.createElement(
|
|
1440
|
+
"button",
|
|
1441
|
+
{
|
|
1442
|
+
type: "button",
|
|
1443
|
+
disabled: b,
|
|
1444
|
+
onClick: () => {
|
|
1445
|
+
f?.("csv", "current-page"), y(!1);
|
|
1446
|
+
},
|
|
1447
|
+
className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
|
|
1448
|
+
},
|
|
1449
|
+
/* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportCurrentPage)
|
|
1450
|
+
), v && S && /* @__PURE__ */ r.createElement(
|
|
1451
|
+
"button",
|
|
1452
|
+
{
|
|
1453
|
+
type: "button",
|
|
1454
|
+
disabled: b,
|
|
1455
|
+
onClick: () => {
|
|
1456
|
+
f?.("csv", "selected"), y(!1);
|
|
1457
|
+
},
|
|
1458
|
+
className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
|
|
1459
|
+
},
|
|
1460
|
+
/* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportSelected)
|
|
1461
|
+
)),
|
|
1462
|
+
j && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
1463
|
+
"button",
|
|
1464
|
+
{
|
|
1465
|
+
type: "button",
|
|
1466
|
+
disabled: b,
|
|
1467
|
+
onClick: () => {
|
|
1468
|
+
f?.("json", "all"), y(!1);
|
|
1469
|
+
},
|
|
1470
|
+
className: `w-full text-left rtl:text-right px-3 py-2 text-xs font-medium text-gray-700 dark:text-gray-200 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer disabled:opacity-50 ${h ? "border-t border-gray-100 dark:border-gray-800" : ""}`
|
|
1471
|
+
},
|
|
1472
|
+
/* @__PURE__ */ r.createElement("span", { className: "text-amber-500 font-bold" }, "{ }"),
|
|
1473
|
+
/* @__PURE__ */ r.createElement("span", null, v ? `${c.exportJson} (${c.exportAll})` : c.exportJson)
|
|
1474
|
+
), v && /* @__PURE__ */ r.createElement(
|
|
1475
|
+
"button",
|
|
1476
|
+
{
|
|
1477
|
+
type: "button",
|
|
1478
|
+
disabled: b,
|
|
1479
|
+
onClick: () => {
|
|
1480
|
+
f?.("json", "current-page"), y(!1);
|
|
1481
|
+
},
|
|
1482
|
+
className: "w-full text-left rtl:text-right px-3 py-1.5 text-[11px] text-gray-500 dark:text-gray-400 hover:bg-primary/10 hover:text-primary transition flex items-center gap-2 cursor-pointer ps-7 disabled:opacity-50"
|
|
1483
|
+
},
|
|
1484
|
+
/* @__PURE__ */ r.createElement("span", null, "↳ ", c.exportCurrentPage)
|
|
1485
|
+
))
|
|
1486
|
+
)) : /* @__PURE__ */ r.createElement(
|
|
1487
|
+
"button",
|
|
1488
|
+
{
|
|
1489
|
+
type: "button",
|
|
1490
|
+
disabled: b,
|
|
1491
|
+
onClick: () => f?.(h ? "csv" : "json", "all"),
|
|
1492
|
+
className: "inline-flex items-center gap-1.5 px-3 py-2 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-gray-700 dark:text-gray-200 text-xs font-semibold hover:bg-gray-50 dark:hover:bg-slate-700 transition shadow-sm active:scale-95 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed",
|
|
1493
|
+
title: b ? c.exporting : c.export
|
|
1494
|
+
},
|
|
1495
|
+
b ? /* @__PURE__ */ r.createElement(
|
|
1496
|
+
"svg",
|
|
1497
|
+
{
|
|
1498
|
+
className: "w-4 h-4 animate-spin text-primary",
|
|
1499
|
+
viewBox: "0 0 24 24",
|
|
1500
|
+
fill: "none"
|
|
1501
|
+
},
|
|
1502
|
+
/* @__PURE__ */ r.createElement(
|
|
1503
|
+
"circle",
|
|
1504
|
+
{
|
|
1505
|
+
className: "opacity-25",
|
|
1506
|
+
cx: "12",
|
|
1507
|
+
cy: "12",
|
|
1508
|
+
r: "10",
|
|
1509
|
+
stroke: "currentColor",
|
|
1510
|
+
strokeWidth: "4"
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
/* @__PURE__ */ r.createElement(
|
|
1514
|
+
"path",
|
|
1515
|
+
{
|
|
1516
|
+
className: "opacity-75",
|
|
1517
|
+
fill: "currentColor",
|
|
1518
|
+
d: "M4 12a8 8 0 018-8v8H4z"
|
|
1519
|
+
}
|
|
1520
|
+
)
|
|
1521
|
+
) : /* @__PURE__ */ r.createElement(
|
|
1522
|
+
"svg",
|
|
1523
|
+
{
|
|
1524
|
+
className: "w-4 h-4 text-gray-500 dark:text-gray-400",
|
|
1525
|
+
fill: "none",
|
|
1526
|
+
viewBox: "0 0 24 24",
|
|
1527
|
+
stroke: "currentColor",
|
|
1528
|
+
strokeWidth: 2
|
|
1529
|
+
},
|
|
1530
|
+
/* @__PURE__ */ r.createElement(
|
|
1531
|
+
"path",
|
|
1532
|
+
{
|
|
1533
|
+
strokeLinecap: "round",
|
|
1534
|
+
strokeLinejoin: "round",
|
|
1535
|
+
d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
|
|
1536
|
+
}
|
|
1537
|
+
)
|
|
1538
|
+
),
|
|
1539
|
+
/* @__PURE__ */ r.createElement("span", null, b ? c.exporting : h ? c.exportCsv : c.exportJson)
|
|
1540
|
+
)),
|
|
1541
|
+
d,
|
|
1542
|
+
u && /* @__PURE__ */ r.createElement(
|
|
1543
|
+
"button",
|
|
1544
|
+
{
|
|
1545
|
+
type: "button",
|
|
1546
|
+
onClick: () => {
|
|
1547
|
+
p ? p() : o && typeof window < "u" && (window.location.href = o);
|
|
1548
|
+
},
|
|
1549
|
+
className: "inline-flex items-center gap-2 px-4 py-2.5 rounded-xl bg-primary text-white text-xs sm:text-sm font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 whitespace-nowrap cursor-pointer"
|
|
1550
|
+
},
|
|
1551
|
+
/* @__PURE__ */ r.createElement("span", null, "+"),
|
|
1552
|
+
/* @__PURE__ */ r.createElement("span", null, c.addRecord, " ", e || "")
|
|
1553
|
+
)
|
|
1554
|
+
)
|
|
1555
|
+
) : null;
|
|
1235
1556
|
}
|
|
1236
|
-
function
|
|
1557
|
+
function Qr({
|
|
1237
1558
|
columns: e,
|
|
1238
1559
|
hasActions: t,
|
|
1239
|
-
actionsTitle:
|
|
1560
|
+
actionsTitle: n,
|
|
1240
1561
|
actionsWidth: s,
|
|
1241
1562
|
sortBy: i,
|
|
1242
1563
|
sortOrder: a,
|
|
1243
1564
|
onSort: l,
|
|
1244
1565
|
selectable: m,
|
|
1245
1566
|
allSelected: d,
|
|
1246
|
-
isIndeterminate:
|
|
1247
|
-
onToggleSelectAll:
|
|
1248
|
-
headerClassName:
|
|
1249
|
-
sticky:
|
|
1567
|
+
isIndeterminate: u,
|
|
1568
|
+
onToggleSelectAll: o,
|
|
1569
|
+
headerClassName: p = "",
|
|
1570
|
+
sticky: c = !1,
|
|
1571
|
+
messages: g = Ee,
|
|
1572
|
+
dir: f = "ltr",
|
|
1573
|
+
resizableColumns: b = !1,
|
|
1574
|
+
columnWidths: S = {},
|
|
1575
|
+
onResizeColumn: z,
|
|
1576
|
+
pinnedStyles: W = {}
|
|
1250
1577
|
}) {
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1578
|
+
const E = _e(), y = f === "rtl", x = ve(null), [k, h] = $(null), j = B(
|
|
1579
|
+
(w, T, P) => {
|
|
1580
|
+
w.preventDefault(), w.stopPropagation(), x.current = {
|
|
1581
|
+
key: T,
|
|
1582
|
+
startX: w.clientX,
|
|
1583
|
+
startWidth: P
|
|
1584
|
+
}, h(T);
|
|
1585
|
+
const H = (U) => {
|
|
1586
|
+
if (!x.current) return;
|
|
1587
|
+
const G = (U.clientX - x.current.startX) * (y ? -1 : 1), R = Math.max(50, x.current.startWidth + G);
|
|
1588
|
+
z?.(x.current.key, R);
|
|
1589
|
+
}, N = () => {
|
|
1590
|
+
x.current = null, h(null), document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", N);
|
|
1591
|
+
};
|
|
1592
|
+
document.addEventListener("mousemove", H), document.addEventListener("mouseup", N);
|
|
1593
|
+
},
|
|
1594
|
+
[y, z]
|
|
1595
|
+
), v = {};
|
|
1596
|
+
c && (v.position = "sticky", v.top = 0, v.zIndex = 10), E.colors?.theadBg && (v.backgroundColor = E.colors.theadBg), E.colors?.theadText && (v.color = E.colors.theadText);
|
|
1597
|
+
const F = n || g.actions;
|
|
1598
|
+
return /* @__PURE__ */ r.createElement(
|
|
1253
1599
|
"thead",
|
|
1254
1600
|
{
|
|
1255
|
-
style:
|
|
1256
|
-
className: `${
|
|
1601
|
+
style: v,
|
|
1602
|
+
className: `${E.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${p}`
|
|
1257
1603
|
},
|
|
1258
|
-
/* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement(
|
|
1259
|
-
"
|
|
1604
|
+
/* @__PURE__ */ r.createElement("tr", null, m && /* @__PURE__ */ r.createElement(
|
|
1605
|
+
"th",
|
|
1260
1606
|
{
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1607
|
+
style: {
|
|
1608
|
+
width: 44,
|
|
1609
|
+
minWidth: 44,
|
|
1610
|
+
backgroundColor: E.colors?.theadBg || void 0
|
|
1265
1611
|
},
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1612
|
+
className: "w-11 px-4 py-3.5 text-center align-middle"
|
|
1613
|
+
},
|
|
1614
|
+
/* @__PURE__ */ r.createElement(
|
|
1615
|
+
"input",
|
|
1616
|
+
{
|
|
1617
|
+
type: "checkbox",
|
|
1618
|
+
checked: d,
|
|
1619
|
+
title: g.selectAll,
|
|
1620
|
+
"aria-label": g.selectAll,
|
|
1621
|
+
ref: (w) => {
|
|
1622
|
+
w && (w.indeterminate = !!u);
|
|
1623
|
+
},
|
|
1624
|
+
onChange: o,
|
|
1625
|
+
className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
|
|
1626
|
+
}
|
|
1627
|
+
)
|
|
1628
|
+
), e.map((w) => {
|
|
1629
|
+
const T = String(w.key), P = i === T, H = w.sortable !== !1 && !!l, N = W[T], U = !!N, G = S[T] ?? (typeof w.width == "number" ? w.width : typeof w.width == "string" && parseInt(w.width, 10) || 150), R = {
|
|
1630
|
+
width: S[T] ?? w.width,
|
|
1631
|
+
minWidth: w.minWidth,
|
|
1632
|
+
maxWidth: w.maxWidth,
|
|
1633
|
+
...U ? N : {},
|
|
1634
|
+
zIndex: U ? c ? 15 : 8 : c ? 10 : void 0,
|
|
1635
|
+
backgroundColor: U ? E.colors?.theadBg || (E.colors?.tableBg ?? void 0) : void 0
|
|
1636
|
+
}, V = w.align === "center" ? "text-center" : w.align === "right" ? "text-right" : w.align === "left" ? "text-left" : y ? "text-right" : "text-left", C = b && w.resizable !== !1;
|
|
1271
1637
|
return /* @__PURE__ */ r.createElement(
|
|
1272
1638
|
"th",
|
|
1273
1639
|
{
|
|
1274
|
-
key:
|
|
1275
|
-
style:
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
maxWidth: y.maxWidth
|
|
1279
|
-
},
|
|
1280
|
-
onClick: () => T && l?.(String(y.key)),
|
|
1281
|
-
className: `${u.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${B} ${y.headerClassName || ""} ${T ? "cursor-pointer hover:text-primary transition-colors group" : ""}`
|
|
1640
|
+
key: T,
|
|
1641
|
+
style: R,
|
|
1642
|
+
onClick: () => H && l?.(T),
|
|
1643
|
+
className: `relative ${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${V} ${w.headerClassName || ""} ${H ? "cursor-pointer hover:text-primary transition-colors group" : ""} ${U ? y ? "border-l border-gray-200/80 dark:border-gray-700/80 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/80 dark:border-gray-700/80 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
|
|
1282
1644
|
},
|
|
1283
1645
|
/* @__PURE__ */ r.createElement(
|
|
1284
1646
|
"div",
|
|
1285
1647
|
{
|
|
1286
|
-
className: `inline-flex items-center gap-1.5 ${
|
|
1648
|
+
className: `inline-flex items-center gap-1.5 ${w.align === "center" ? "justify-center" : w.align === "right" ? "justify-end" : "justify-start"}`
|
|
1287
1649
|
},
|
|
1288
|
-
/* @__PURE__ */ r.createElement("span", null,
|
|
1289
|
-
|
|
1650
|
+
/* @__PURE__ */ r.createElement("span", null, w.title),
|
|
1651
|
+
H && /* @__PURE__ */ r.createElement(
|
|
1290
1652
|
"span",
|
|
1291
1653
|
{
|
|
1292
|
-
className: `inline-flex flex-col text-[10px] transition-transform ${
|
|
1654
|
+
className: `inline-flex flex-col text-[10px] transition-transform ${P ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`
|
|
1293
1655
|
},
|
|
1294
|
-
|
|
1656
|
+
P ? a === "asc" ? "▲" : "▼" : /* @__PURE__ */ r.createElement("span", { className: "text-[9px] leading-none opacity-50" }, "▲▼")
|
|
1657
|
+
)
|
|
1658
|
+
),
|
|
1659
|
+
C && /* @__PURE__ */ r.createElement(
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
onMouseDown: (J) => j(J, T, G),
|
|
1663
|
+
onClick: (J) => J.stopPropagation(),
|
|
1664
|
+
className: `absolute top-0 bottom-0 w-2 cursor-col-resize select-none z-20 group/handle ${y ? "left-0" : "right-0"}`,
|
|
1665
|
+
title: "Resize column"
|
|
1666
|
+
},
|
|
1667
|
+
/* @__PURE__ */ r.createElement(
|
|
1668
|
+
"div",
|
|
1669
|
+
{
|
|
1670
|
+
className: `w-0.5 h-full mx-auto transition-colors ${k === T ? "bg-primary w-1" : "bg-transparent group-hover/handle:bg-primary/60"}`
|
|
1671
|
+
}
|
|
1295
1672
|
)
|
|
1296
1673
|
)
|
|
1297
1674
|
);
|
|
1298
1675
|
}), t && /* @__PURE__ */ r.createElement(
|
|
1299
1676
|
"th",
|
|
1300
1677
|
{
|
|
1301
|
-
style: {
|
|
1302
|
-
|
|
1678
|
+
style: {
|
|
1679
|
+
width: s || "auto",
|
|
1680
|
+
minWidth: typeof s == "number" ? s : void 0,
|
|
1681
|
+
backgroundColor: E.colors?.theadBg || void 0
|
|
1682
|
+
},
|
|
1683
|
+
className: `${E.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${y ? "text-left pl-6" : "text-right pr-6"}`
|
|
1303
1684
|
},
|
|
1304
|
-
|
|
1685
|
+
F
|
|
1305
1686
|
))
|
|
1306
1687
|
);
|
|
1307
1688
|
}
|
|
1308
|
-
const
|
|
1309
|
-
function
|
|
1689
|
+
const Q = () => /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm" }, "—");
|
|
1690
|
+
function qt({ value: e }) {
|
|
1310
1691
|
if (e == null || e === "")
|
|
1311
|
-
return /* @__PURE__ */ r.createElement(
|
|
1692
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1312
1693
|
const t = String(e);
|
|
1313
1694
|
return /* @__PURE__ */ r.createElement("span", { className: "truncate block max-w-xs font-normal text-sm", title: t }, t);
|
|
1314
1695
|
}
|
|
1315
|
-
function
|
|
1696
|
+
function ea({ value: e }) {
|
|
1316
1697
|
if (e == null || isNaN(Number(e)))
|
|
1317
|
-
return /* @__PURE__ */ r.createElement(
|
|
1698
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1318
1699
|
const t = Number(e);
|
|
1319
1700
|
return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-medium" }, t.toLocaleString());
|
|
1320
1701
|
}
|
|
1321
|
-
function
|
|
1702
|
+
function ta({ value: e }) {
|
|
1322
1703
|
if (e == null)
|
|
1323
|
-
return /* @__PURE__ */ r.createElement(
|
|
1704
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1324
1705
|
const t = !!e;
|
|
1325
1706
|
return /* @__PURE__ */ r.createElement(
|
|
1326
1707
|
"span",
|
|
@@ -1331,34 +1712,34 @@ function xr({ value: e }) {
|
|
|
1331
1712
|
t ? "Yes" : "No"
|
|
1332
1713
|
);
|
|
1333
1714
|
}
|
|
1334
|
-
function
|
|
1335
|
-
if (!e) return /* @__PURE__ */ r.createElement(
|
|
1336
|
-
const
|
|
1337
|
-
return isNaN(
|
|
1715
|
+
function jt({ value: e, isDateTime: t = !1 }) {
|
|
1716
|
+
if (!e) return /* @__PURE__ */ r.createElement(Q, null);
|
|
1717
|
+
const n = e instanceof Date ? e : new Date(e);
|
|
1718
|
+
return isNaN(n.getTime()) ? /* @__PURE__ */ r.createElement(qt, { value: e, column: { key: "" } }) : /* @__PURE__ */ r.createElement("span", { className: "whitespace-nowrap text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300" }, n.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }), t && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 dark:text-gray-500 ml-1.5" }, n.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" })));
|
|
1338
1719
|
}
|
|
1339
|
-
function
|
|
1720
|
+
function ra({ value: e, column: t }) {
|
|
1340
1721
|
if (e == null || isNaN(Number(e)))
|
|
1341
|
-
return /* @__PURE__ */ r.createElement(
|
|
1342
|
-
const
|
|
1343
|
-
return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white" },
|
|
1722
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1723
|
+
const n = Number(e), s = t.currency || "EGP";
|
|
1724
|
+
return /* @__PURE__ */ r.createElement("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white" }, n.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), " ", /* @__PURE__ */ r.createElement("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400" }, s));
|
|
1344
1725
|
}
|
|
1345
|
-
const
|
|
1346
|
-
function
|
|
1726
|
+
const Mt = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E";
|
|
1727
|
+
function aa({ value: e }) {
|
|
1347
1728
|
let t = "";
|
|
1348
|
-
return typeof e == "string" ? t = e : Array.isArray(e) && e.length > 0 ? t = typeof e[0] == "string" ? e[0] : e[0]?.url || "" : e && typeof e == "object" && (t = e.url || ""), t || (t =
|
|
1729
|
+
return typeof e == "string" ? t = e : Array.isArray(e) && e.length > 0 ? t = typeof e[0] == "string" ? e[0] : e[0]?.url || "" : e && typeof e == "object" && (t = e.url || ""), t || (t = Mt), /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ r.createElement(
|
|
1349
1730
|
"img",
|
|
1350
1731
|
{
|
|
1351
1732
|
src: t,
|
|
1352
1733
|
alt: "Thumbnail",
|
|
1353
1734
|
className: "w-10 h-10 rounded-full object-cover border border-gray-200 dark:border-gray-700 bg-gray-100 dark:bg-gray-800 shadow-sm",
|
|
1354
1735
|
loading: "lazy",
|
|
1355
|
-
onError: (
|
|
1356
|
-
|
|
1736
|
+
onError: (n) => {
|
|
1737
|
+
n.target.src = Mt;
|
|
1357
1738
|
}
|
|
1358
1739
|
}
|
|
1359
1740
|
));
|
|
1360
1741
|
}
|
|
1361
|
-
const
|
|
1742
|
+
const na = {
|
|
1362
1743
|
active: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
1363
1744
|
delivered: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
1364
1745
|
completed: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
@@ -1375,12 +1756,12 @@ const wr = {
|
|
|
1375
1756
|
offline: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" },
|
|
1376
1757
|
closed: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" }
|
|
1377
1758
|
};
|
|
1378
|
-
function
|
|
1759
|
+
function oa({ value: e, column: t }) {
|
|
1379
1760
|
if (e == null || e === "")
|
|
1380
|
-
return /* @__PURE__ */ r.createElement(
|
|
1381
|
-
const
|
|
1382
|
-
if (t.statusMap && t.statusMap[
|
|
1383
|
-
const a = t.statusMap[
|
|
1761
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1762
|
+
const n = String(e), s = n.toLowerCase();
|
|
1763
|
+
if (t.statusMap && t.statusMap[n]) {
|
|
1764
|
+
const a = t.statusMap[n];
|
|
1384
1765
|
return /* @__PURE__ */ r.createElement(
|
|
1385
1766
|
"span",
|
|
1386
1767
|
{
|
|
@@ -1388,10 +1769,10 @@ function vr({ value: e, column: t }) {
|
|
|
1388
1769
|
style: { color: a.color, backgroundColor: a.bg }
|
|
1389
1770
|
},
|
|
1390
1771
|
/* @__PURE__ */ r.createElement("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: a.color } }),
|
|
1391
|
-
a.label ||
|
|
1772
|
+
a.label || n
|
|
1392
1773
|
);
|
|
1393
1774
|
}
|
|
1394
|
-
const i =
|
|
1775
|
+
const i = na[s] || {
|
|
1395
1776
|
bg: "bg-gray-500/10 border-gray-500/20",
|
|
1396
1777
|
text: "text-gray-700 dark:text-gray-300",
|
|
1397
1778
|
dot: "bg-gray-400"
|
|
@@ -1402,24 +1783,24 @@ function vr({ value: e, column: t }) {
|
|
|
1402
1783
|
className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border ${i.bg} ${i.text}`
|
|
1403
1784
|
},
|
|
1404
1785
|
/* @__PURE__ */ r.createElement("span", { className: `w-1.5 h-1.5 rounded-full ${i.dot}` }),
|
|
1405
|
-
|
|
1786
|
+
n
|
|
1406
1787
|
);
|
|
1407
1788
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(
|
|
1789
|
+
function sa({ value: e }) {
|
|
1790
|
+
return !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ r.createElement(Q, null) : /* @__PURE__ */ r.createElement("div", { className: "flex flex-wrap gap-1 items-center" }, e.slice(0, 3).map((t, n) => /* @__PURE__ */ r.createElement(
|
|
1410
1791
|
"span",
|
|
1411
1792
|
{
|
|
1412
|
-
key:
|
|
1793
|
+
key: n,
|
|
1413
1794
|
className: "inline-block px-2 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700"
|
|
1414
1795
|
},
|
|
1415
1796
|
typeof t == "object" ? JSON.stringify(t) : String(t)
|
|
1416
1797
|
)), e.length > 3 && /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-400 font-medium" }, "+", e.length - 3));
|
|
1417
1798
|
}
|
|
1418
|
-
function
|
|
1419
|
-
return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(
|
|
1799
|
+
function la({ value: e }) {
|
|
1800
|
+
return !e || typeof e != "object" ? /* @__PURE__ */ r.createElement(Q, null) : "en" in e || "ar" in e ? /* @__PURE__ */ r.createElement("span", { className: "font-medium text-sm" }, e.en || e.ar || "") : /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs text-gray-500 dark:text-gray-400 truncate block max-w-xs", title: JSON.stringify(e) }, JSON.stringify(e));
|
|
1420
1801
|
}
|
|
1421
|
-
function
|
|
1422
|
-
if (!e) return /* @__PURE__ */ r.createElement(
|
|
1802
|
+
function ia({ value: e }) {
|
|
1803
|
+
if (!e) return /* @__PURE__ */ r.createElement(Q, null);
|
|
1423
1804
|
const t = String(e);
|
|
1424
1805
|
return /* @__PURE__ */ r.createElement(
|
|
1425
1806
|
"a",
|
|
@@ -1433,8 +1814,8 @@ function Ar({ value: e }) {
|
|
|
1433
1814
|
/* @__PURE__ */ r.createElement("span", { className: "text-xs" }, "↗")
|
|
1434
1815
|
);
|
|
1435
1816
|
}
|
|
1436
|
-
function
|
|
1437
|
-
if (!e) return /* @__PURE__ */ r.createElement(
|
|
1817
|
+
function da({ value: e }) {
|
|
1818
|
+
if (!e) return /* @__PURE__ */ r.createElement(Q, null);
|
|
1438
1819
|
const t = String(e);
|
|
1439
1820
|
return /* @__PURE__ */ r.createElement(
|
|
1440
1821
|
"a",
|
|
@@ -1445,8 +1826,8 @@ function Tr({ value: e }) {
|
|
|
1445
1826
|
t
|
|
1446
1827
|
);
|
|
1447
1828
|
}
|
|
1448
|
-
function
|
|
1449
|
-
if (!e) return /* @__PURE__ */ r.createElement(
|
|
1829
|
+
function ca({ value: e }) {
|
|
1830
|
+
if (!e) return /* @__PURE__ */ r.createElement(Q, null);
|
|
1450
1831
|
const t = String(e);
|
|
1451
1832
|
return /* @__PURE__ */ r.createElement(
|
|
1452
1833
|
"a",
|
|
@@ -1457,79 +1838,79 @@ function Sr({ value: e }) {
|
|
|
1457
1838
|
t
|
|
1458
1839
|
);
|
|
1459
1840
|
}
|
|
1460
|
-
function
|
|
1841
|
+
function ua({ value: e }) {
|
|
1461
1842
|
if (e == null || isNaN(Number(e)))
|
|
1462
|
-
return /* @__PURE__ */ r.createElement(
|
|
1463
|
-
const t = Math.min(100, Math.max(0, Math.round(Number(e)))),
|
|
1843
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1844
|
+
const t = Math.min(100, Math.max(0, Math.round(Number(e)))), n = t >= 80 ? "bg-emerald-500" : t >= 50 ? "bg-blue-500" : t >= 30 ? "bg-amber-500" : "bg-rose-500";
|
|
1464
1845
|
return /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2.5 min-w-[120px]" }, /* @__PURE__ */ r.createElement("div", { className: "flex-1 h-2 rounded-full bg-gray-200 dark:bg-slate-700 overflow-hidden" }, /* @__PURE__ */ r.createElement(
|
|
1465
1846
|
"div",
|
|
1466
1847
|
{
|
|
1467
|
-
className: `h-full rounded-full ${
|
|
1848
|
+
className: `h-full rounded-full ${n} transition-all duration-500`,
|
|
1468
1849
|
style: { width: `${t}%` }
|
|
1469
1850
|
}
|
|
1470
1851
|
)), /* @__PURE__ */ r.createElement("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right" }, t, "%"));
|
|
1471
1852
|
}
|
|
1472
|
-
function
|
|
1853
|
+
function ma({ value: e }) {
|
|
1473
1854
|
if (e == null || isNaN(Number(e)))
|
|
1474
|
-
return /* @__PURE__ */ r.createElement(
|
|
1855
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1475
1856
|
const t = Number(e);
|
|
1476
1857
|
return /* @__PURE__ */ r.createElement("div", { className: "inline-flex items-center gap-1.5 font-medium text-xs text-amber-500" }, /* @__PURE__ */ r.createElement("span", { className: "text-sm" }, "★"), /* @__PURE__ */ r.createElement("span", { className: "font-bold text-gray-900 dark:text-gray-100" }, t.toFixed(1)), /* @__PURE__ */ r.createElement("span", { className: "text-gray-400 dark:text-gray-500 text-[10px]" }, "/ 5"));
|
|
1477
1858
|
}
|
|
1478
|
-
function
|
|
1859
|
+
function ga({ value: e }) {
|
|
1479
1860
|
if (e == null || e === "")
|
|
1480
|
-
return /* @__PURE__ */ r.createElement(
|
|
1861
|
+
return /* @__PURE__ */ r.createElement(Q, null);
|
|
1481
1862
|
const t = String(e);
|
|
1482
1863
|
return /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-lg text-xs font-bold bg-primary/10 text-primary border border-primary/20" }, t);
|
|
1483
1864
|
}
|
|
1484
|
-
function
|
|
1865
|
+
function fa({
|
|
1485
1866
|
row: e,
|
|
1486
1867
|
column: t,
|
|
1487
|
-
rowIndex:
|
|
1868
|
+
rowIndex: n
|
|
1488
1869
|
}) {
|
|
1489
|
-
const s =
|
|
1870
|
+
const s = L(e, t.key);
|
|
1490
1871
|
if (t.render && typeof t.render == "function")
|
|
1491
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, t.render(s, e,
|
|
1872
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, t.render(s, e, n));
|
|
1492
1873
|
if (t.formatter && typeof t.formatter == "function")
|
|
1493
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, t.formatter(s, e,
|
|
1874
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, t.formatter(s, e, n));
|
|
1494
1875
|
switch (t.type) {
|
|
1495
1876
|
case "boolean":
|
|
1496
|
-
return /* @__PURE__ */ r.createElement(
|
|
1877
|
+
return /* @__PURE__ */ r.createElement(ta, { value: s, column: t });
|
|
1497
1878
|
case "number":
|
|
1498
|
-
return /* @__PURE__ */ r.createElement(
|
|
1879
|
+
return /* @__PURE__ */ r.createElement(ea, { value: s, column: t });
|
|
1499
1880
|
case "currency":
|
|
1500
|
-
return /* @__PURE__ */ r.createElement(
|
|
1881
|
+
return /* @__PURE__ */ r.createElement(ra, { value: s, column: t });
|
|
1501
1882
|
case "date":
|
|
1502
|
-
return /* @__PURE__ */ r.createElement(
|
|
1883
|
+
return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !1 });
|
|
1503
1884
|
case "datetime":
|
|
1504
|
-
return /* @__PURE__ */ r.createElement(
|
|
1885
|
+
return /* @__PURE__ */ r.createElement(jt, { value: s, column: t, isDateTime: !0 });
|
|
1505
1886
|
case "image":
|
|
1506
|
-
return /* @__PURE__ */ r.createElement(
|
|
1887
|
+
return /* @__PURE__ */ r.createElement(aa, { value: s, column: t });
|
|
1507
1888
|
case "status":
|
|
1508
|
-
return /* @__PURE__ */ r.createElement(
|
|
1889
|
+
return /* @__PURE__ */ r.createElement(oa, { value: s, column: t });
|
|
1509
1890
|
case "progress":
|
|
1510
|
-
return /* @__PURE__ */ r.createElement(
|
|
1891
|
+
return /* @__PURE__ */ r.createElement(ua, { value: s, column: t });
|
|
1511
1892
|
case "rating":
|
|
1512
|
-
return /* @__PURE__ */ r.createElement(
|
|
1893
|
+
return /* @__PURE__ */ r.createElement(ma, { value: s, column: t });
|
|
1513
1894
|
case "badge":
|
|
1514
|
-
return /* @__PURE__ */ r.createElement(
|
|
1895
|
+
return /* @__PURE__ */ r.createElement(ga, { value: s, column: t });
|
|
1515
1896
|
case "array":
|
|
1516
|
-
return /* @__PURE__ */ r.createElement(
|
|
1897
|
+
return /* @__PURE__ */ r.createElement(sa, { value: s, column: t });
|
|
1517
1898
|
case "object":
|
|
1518
|
-
return /* @__PURE__ */ r.createElement(
|
|
1899
|
+
return /* @__PURE__ */ r.createElement(la, { value: s, column: t });
|
|
1519
1900
|
case "url":
|
|
1520
|
-
return /* @__PURE__ */ r.createElement(
|
|
1901
|
+
return /* @__PURE__ */ r.createElement(ia, { value: s, column: t });
|
|
1521
1902
|
case "email":
|
|
1522
|
-
return /* @__PURE__ */ r.createElement(
|
|
1903
|
+
return /* @__PURE__ */ r.createElement(da, { value: s, column: t });
|
|
1523
1904
|
case "phone":
|
|
1524
|
-
return /* @__PURE__ */ r.createElement(
|
|
1905
|
+
return /* @__PURE__ */ r.createElement(ca, { value: s, column: t });
|
|
1525
1906
|
default:
|
|
1526
|
-
return /* @__PURE__ */ r.createElement(
|
|
1907
|
+
return /* @__PURE__ */ r.createElement(qt, { value: s, column: t });
|
|
1527
1908
|
}
|
|
1528
1909
|
}
|
|
1529
|
-
function
|
|
1910
|
+
function pa({
|
|
1530
1911
|
isOpen: e,
|
|
1531
1912
|
title: t,
|
|
1532
|
-
message:
|
|
1913
|
+
message: n,
|
|
1533
1914
|
confirmText: s = "Confirm",
|
|
1534
1915
|
cancelText: i = "Cancel",
|
|
1535
1916
|
type: a = "danger",
|
|
@@ -1537,11 +1918,11 @@ function Dr({
|
|
|
1537
1918
|
onConfirm: m,
|
|
1538
1919
|
isLoading: d = !1
|
|
1539
1920
|
}) {
|
|
1540
|
-
return
|
|
1541
|
-
const
|
|
1542
|
-
|
|
1921
|
+
return we(() => {
|
|
1922
|
+
const u = (o) => {
|
|
1923
|
+
o.key === "Escape" && l();
|
|
1543
1924
|
};
|
|
1544
|
-
return e && window.addEventListener("keydown",
|
|
1925
|
+
return e && window.addEventListener("keydown", u), () => window.removeEventListener("keydown", u);
|
|
1545
1926
|
}, [e, l]), e ? /* @__PURE__ */ r.createElement(
|
|
1546
1927
|
"div",
|
|
1547
1928
|
{
|
|
@@ -1552,7 +1933,7 @@ function Dr({
|
|
|
1552
1933
|
"div",
|
|
1553
1934
|
{
|
|
1554
1935
|
className: "bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 w-full max-w-md rounded-2xl p-6 shadow-2xl transform transition-all text-center",
|
|
1555
|
-
onClick: (
|
|
1936
|
+
onClick: (u) => u.stopPropagation(),
|
|
1556
1937
|
role: "dialog"
|
|
1557
1938
|
},
|
|
1558
1939
|
/* @__PURE__ */ r.createElement(
|
|
@@ -1563,7 +1944,7 @@ function Dr({
|
|
|
1563
1944
|
a === "danger" ? "⚠️" : a === "warning" ? "⚡" : "ℹ️"
|
|
1564
1945
|
),
|
|
1565
1946
|
/* @__PURE__ */ r.createElement("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2" }, t),
|
|
1566
|
-
/* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" },
|
|
1947
|
+
/* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed" }, n),
|
|
1567
1948
|
/* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-center gap-3" }, /* @__PURE__ */ r.createElement(
|
|
1568
1949
|
"button",
|
|
1569
1950
|
{
|
|
@@ -1586,7 +1967,7 @@ function Dr({
|
|
|
1586
1967
|
)
|
|
1587
1968
|
) : null;
|
|
1588
1969
|
}
|
|
1589
|
-
function
|
|
1970
|
+
function Yt(e, t) {
|
|
1590
1971
|
if (!e) return null;
|
|
1591
1972
|
if (r.isValidElement(e))
|
|
1592
1973
|
return e;
|
|
@@ -1595,22 +1976,22 @@ function rt(e, t) {
|
|
|
1595
1976
|
const i = e;
|
|
1596
1977
|
return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
|
|
1597
1978
|
}
|
|
1598
|
-
const
|
|
1599
|
-
if (/^[A-Z]/.test(
|
|
1979
|
+
const n = e.displayName || e.name || "";
|
|
1980
|
+
if (/^[A-Z]/.test(n)) {
|
|
1600
1981
|
const i = e;
|
|
1601
1982
|
return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
|
|
1602
1983
|
}
|
|
1603
1984
|
try {
|
|
1604
1985
|
const i = e(t);
|
|
1605
|
-
return
|
|
1986
|
+
return Yt(i, t);
|
|
1606
1987
|
} catch {
|
|
1607
1988
|
const i = e;
|
|
1608
1989
|
return /* @__PURE__ */ r.createElement(i, { className: "w-4 h-4 shrink-0" });
|
|
1609
1990
|
}
|
|
1610
1991
|
}
|
|
1611
1992
|
if (typeof e == "object" && e !== null && (e.$$typeof || e.render)) {
|
|
1612
|
-
const
|
|
1613
|
-
return /* @__PURE__ */ r.createElement(
|
|
1993
|
+
const n = e;
|
|
1994
|
+
return /* @__PURE__ */ r.createElement(n, { className: "w-4 h-4 shrink-0" });
|
|
1614
1995
|
}
|
|
1615
1996
|
return typeof e == "string" ? e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("data:image/") || /\.(png|jpe?g|svg|webp|gif|ico)$/i.test(e) ? /* @__PURE__ */ r.createElement(
|
|
1616
1997
|
"img",
|
|
@@ -1621,7 +2002,7 @@ function rt(e, t) {
|
|
|
1621
2002
|
}
|
|
1622
2003
|
) : /* @__PURE__ */ r.createElement("span", { className: "inline-flex items-center justify-center leading-none text-base" }, e) : e;
|
|
1623
2004
|
}
|
|
1624
|
-
const
|
|
2005
|
+
const Dt = {
|
|
1625
2006
|
primary: "bg-primary text-white hover:bg-primary-soft shadow-sm shadow-primary/20",
|
|
1626
2007
|
secondary: "bg-emerald-600 text-white hover:bg-emerald-700 shadow-sm shadow-emerald-600/20",
|
|
1627
2008
|
success: "bg-emerald-500 text-white hover:bg-emerald-600 shadow-sm shadow-emerald-500/20",
|
|
@@ -1631,73 +2012,73 @@ const Ze = {
|
|
|
1631
2012
|
neutral: "bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-700 border border-gray-200 dark:border-gray-700",
|
|
1632
2013
|
ghost: "bg-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white"
|
|
1633
2014
|
};
|
|
1634
|
-
function
|
|
2015
|
+
function ba({
|
|
1635
2016
|
row: e,
|
|
1636
2017
|
actions: t,
|
|
1637
|
-
context:
|
|
2018
|
+
context: n
|
|
1638
2019
|
}) {
|
|
1639
|
-
const [s, i] =
|
|
2020
|
+
const [s, i] = $(null), [a, l] = $({});
|
|
1640
2021
|
if (!t || !t.length)
|
|
1641
2022
|
return null;
|
|
1642
|
-
const m = async (
|
|
1643
|
-
if (
|
|
1644
|
-
const
|
|
2023
|
+
const m = async (o) => {
|
|
2024
|
+
if (o.confirmation) {
|
|
2025
|
+
const p = typeof o.confirmation.title == "function" ? o.confirmation.title(e) : o.confirmation.title || "Confirm Action", c = typeof o.confirmation.message == "function" ? o.confirmation.message(e) : o.confirmation.message || "Are you sure you want to perform this action?";
|
|
1645
2026
|
i({
|
|
1646
2027
|
isOpen: !0,
|
|
1647
|
-
title:
|
|
1648
|
-
message:
|
|
1649
|
-
confirmText:
|
|
1650
|
-
cancelText:
|
|
1651
|
-
type:
|
|
2028
|
+
title: p,
|
|
2029
|
+
message: c,
|
|
2030
|
+
confirmText: o.confirmation.confirmText || "Confirm",
|
|
2031
|
+
cancelText: o.confirmation.cancelText || "Cancel",
|
|
2032
|
+
type: o.confirmation.type || "danger",
|
|
1652
2033
|
onConfirm: async () => {
|
|
1653
|
-
i(null), await d(
|
|
2034
|
+
i(null), await d(o);
|
|
1654
2035
|
}
|
|
1655
2036
|
});
|
|
1656
2037
|
return;
|
|
1657
2038
|
}
|
|
1658
|
-
await d(
|
|
1659
|
-
}, d = async (
|
|
1660
|
-
if (
|
|
1661
|
-
l((
|
|
2039
|
+
await d(o);
|
|
2040
|
+
}, d = async (o) => {
|
|
2041
|
+
if (o.type === "button" || !o.type) {
|
|
2042
|
+
l((p) => ({ ...p, [o.id]: !0 }));
|
|
1662
2043
|
try {
|
|
1663
|
-
await
|
|
2044
|
+
await o.onClick(e, n);
|
|
1664
2045
|
} finally {
|
|
1665
|
-
l((
|
|
2046
|
+
l((p) => ({ ...p, [o.id]: !1 }));
|
|
1666
2047
|
}
|
|
1667
2048
|
}
|
|
1668
|
-
},
|
|
1669
|
-
const
|
|
1670
|
-
l((
|
|
2049
|
+
}, u = async (o, p) => {
|
|
2050
|
+
const c = !p;
|
|
2051
|
+
l((g) => ({ ...g, [o.id]: !0 }));
|
|
1671
2052
|
try {
|
|
1672
|
-
await
|
|
2053
|
+
await o.onChange(e, c, n);
|
|
1673
2054
|
} finally {
|
|
1674
|
-
l((
|
|
2055
|
+
l((g) => ({ ...g, [o.id]: !1 }));
|
|
1675
2056
|
}
|
|
1676
2057
|
};
|
|
1677
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2" }, t.map((
|
|
1678
|
-
if (typeof
|
|
1679
|
-
const
|
|
1680
|
-
if (
|
|
1681
|
-
return /* @__PURE__ */ r.createElement(r.Fragment, { key:
|
|
1682
|
-
if (
|
|
1683
|
-
const
|
|
2058
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "flex items-center justify-end gap-2 pr-2 whitespace-nowrap" }, t.map((o) => {
|
|
2059
|
+
if (typeof o.hide == "function" && o.hide(e) || typeof o.show == "function" && !o.show(e)) return null;
|
|
2060
|
+
const p = typeof o.disabled == "function" ? o.disabled(e) : !!o.disabled, c = a[o.id] || (typeof o.loading == "function" ? o.loading(e) : !!o.loading), g = typeof o.label == "function" ? o.label(e) : o.label, f = Yt(o.icon, e), b = typeof o.tooltip == "function" ? o.tooltip(e) : o.tooltip, S = typeof o.className == "function" ? o.className(e) : o.className || "";
|
|
2061
|
+
if (o.type === "custom" && o.render)
|
|
2062
|
+
return /* @__PURE__ */ r.createElement(r.Fragment, { key: o.id }, o.render(e, n));
|
|
2063
|
+
if (o.type === "switch") {
|
|
2064
|
+
const y = o, x = y.checked(e);
|
|
1684
2065
|
return /* @__PURE__ */ r.createElement(
|
|
1685
2066
|
"div",
|
|
1686
2067
|
{
|
|
1687
|
-
key:
|
|
1688
|
-
className: "flex items-center gap-2",
|
|
1689
|
-
title:
|
|
2068
|
+
key: o.id,
|
|
2069
|
+
className: "flex items-center gap-2 shrink-0",
|
|
2070
|
+
title: b || g
|
|
1690
2071
|
},
|
|
1691
|
-
|
|
2072
|
+
g && /* @__PURE__ */ r.createElement("span", { className: "text-xs font-semibold text-gray-500" }, g, ":"),
|
|
1692
2073
|
/* @__PURE__ */ r.createElement(
|
|
1693
2074
|
"button",
|
|
1694
2075
|
{
|
|
1695
2076
|
type: "button",
|
|
1696
2077
|
role: "switch",
|
|
1697
2078
|
"aria-checked": x,
|
|
1698
|
-
disabled:
|
|
1699
|
-
onClick: () =>
|
|
1700
|
-
className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${
|
|
2079
|
+
disabled: p || c,
|
|
2080
|
+
onClick: () => u(y, x),
|
|
2081
|
+
className: `relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${x ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${S}`
|
|
1701
2082
|
},
|
|
1702
2083
|
/* @__PURE__ */ r.createElement(
|
|
1703
2084
|
"span",
|
|
@@ -1705,28 +2086,28 @@ function Mr({
|
|
|
1705
2086
|
"aria-hidden": "true",
|
|
1706
2087
|
className: `pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out flex items-center justify-center ${x ? "translate-x-5" : "translate-x-0"}`
|
|
1707
2088
|
},
|
|
1708
|
-
|
|
2089
|
+
c && /* @__PURE__ */ r.createElement("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
|
|
1709
2090
|
)
|
|
1710
2091
|
)
|
|
1711
2092
|
);
|
|
1712
2093
|
}
|
|
1713
|
-
const
|
|
2094
|
+
const z = typeof o.variant == "function" ? o.variant(e) : o.variant || "neutral", W = Dt[z] || Dt.neutral, E = !g && f ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
|
|
1714
2095
|
return /* @__PURE__ */ r.createElement(
|
|
1715
2096
|
"button",
|
|
1716
2097
|
{
|
|
1717
|
-
key:
|
|
2098
|
+
key: o.id,
|
|
1718
2099
|
type: "button",
|
|
1719
|
-
disabled:
|
|
1720
|
-
onClick: () => m(
|
|
1721
|
-
title:
|
|
1722
|
-
style:
|
|
1723
|
-
className: `inline-flex items-center justify-center gap-1.5 ${E} rounded-xl text-xs font-bold transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${
|
|
2100
|
+
disabled: p || c,
|
|
2101
|
+
onClick: () => m(o),
|
|
2102
|
+
title: b,
|
|
2103
|
+
style: o.color ? { backgroundColor: o.color, color: "#ffffff" } : void 0,
|
|
2104
|
+
className: `inline-flex items-center justify-center gap-1.5 ${E} rounded-xl text-xs font-bold shrink-0 transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${W} ${S}`
|
|
1724
2105
|
},
|
|
1725
|
-
|
|
1726
|
-
|
|
2106
|
+
c ? /* @__PURE__ */ r.createElement("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : f && /* @__PURE__ */ r.createElement("span", { className: "text-sm flex items-center justify-center shrink-0" }, f),
|
|
2107
|
+
g && /* @__PURE__ */ r.createElement("span", null, g)
|
|
1727
2108
|
);
|
|
1728
2109
|
})), s && /* @__PURE__ */ r.createElement(
|
|
1729
|
-
|
|
2110
|
+
pa,
|
|
1730
2111
|
{
|
|
1731
2112
|
isOpen: s.isOpen,
|
|
1732
2113
|
title: s.title,
|
|
@@ -1739,178 +2120,227 @@ function Mr({
|
|
|
1739
2120
|
}
|
|
1740
2121
|
));
|
|
1741
2122
|
}
|
|
1742
|
-
function
|
|
2123
|
+
function ya({
|
|
1743
2124
|
rows: e,
|
|
1744
2125
|
columns: t,
|
|
1745
|
-
actions:
|
|
2126
|
+
actions: n,
|
|
1746
2127
|
actionContext: s,
|
|
1747
2128
|
rowKeyResolver: i,
|
|
1748
2129
|
selectable: a,
|
|
1749
2130
|
selectedKeys: l,
|
|
1750
2131
|
onToggleSelectRow: m,
|
|
1751
2132
|
onRowClick: d,
|
|
1752
|
-
striped:
|
|
1753
|
-
hoverable:
|
|
1754
|
-
rowClassName:
|
|
1755
|
-
isVirtualized:
|
|
1756
|
-
paddingTop:
|
|
1757
|
-
paddingBottom:
|
|
1758
|
-
startIndex:
|
|
2133
|
+
striped: u = !1,
|
|
2134
|
+
hoverable: o = !0,
|
|
2135
|
+
rowClassName: p,
|
|
2136
|
+
isVirtualized: c = !1,
|
|
2137
|
+
paddingTop: g = 0,
|
|
2138
|
+
paddingBottom: f = 0,
|
|
2139
|
+
startIndex: b = 0,
|
|
2140
|
+
pinnedStyles: S = {},
|
|
2141
|
+
columnWidths: z = {},
|
|
2142
|
+
dir: W = "ltr",
|
|
2143
|
+
actionsWidth: E,
|
|
2144
|
+
messages: y = Ee
|
|
1759
2145
|
}) {
|
|
1760
|
-
const
|
|
1761
|
-
return /* @__PURE__ */ r.createElement(
|
|
1762
|
-
"
|
|
2146
|
+
const x = _e(), k = W === "rtl", h = !!(n && n.length > 0), j = t.length + (a ? 1 : 0) + (h ? 1 : 0);
|
|
2147
|
+
return /* @__PURE__ */ r.createElement(
|
|
2148
|
+
"tbody",
|
|
1763
2149
|
{
|
|
1764
|
-
|
|
1765
|
-
"aria-hidden": "true",
|
|
1766
|
-
className: "pointer-events-none"
|
|
2150
|
+
className: x.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900"
|
|
1767
2151
|
},
|
|
1768
|
-
/* @__PURE__ */ r.createElement(
|
|
1769
|
-
"td",
|
|
1770
|
-
{
|
|
1771
|
-
colSpan: B,
|
|
1772
|
-
style: { height: `${u}px`, padding: 0, border: 0 }
|
|
1773
|
-
}
|
|
1774
|
-
)
|
|
1775
|
-
), e.map((E, p) => {
|
|
1776
|
-
const x = y + p, k = i(E, x), w = l?.has(k), D = typeof f == "function" ? f(E, x) : f || "";
|
|
1777
|
-
return /* @__PURE__ */ r.createElement(
|
|
2152
|
+
c && g > 0 && /* @__PURE__ */ r.createElement(
|
|
1778
2153
|
"tr",
|
|
1779
2154
|
{
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
className:
|
|
2155
|
+
style: { height: `${g}px`, border: 0 },
|
|
2156
|
+
"aria-hidden": "true",
|
|
2157
|
+
className: "pointer-events-none"
|
|
1783
2158
|
},
|
|
1784
|
-
|
|
2159
|
+
/* @__PURE__ */ r.createElement(
|
|
1785
2160
|
"td",
|
|
1786
2161
|
{
|
|
1787
|
-
|
|
1788
|
-
|
|
2162
|
+
colSpan: j,
|
|
2163
|
+
style: { height: `${g}px`, padding: 0, border: 0 }
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
),
|
|
2167
|
+
e.map((v, F) => {
|
|
2168
|
+
const w = b + F, T = i(v, w), P = l?.has(T), H = typeof p == "function" ? p(v, w) : p || "";
|
|
2169
|
+
return /* @__PURE__ */ r.createElement(
|
|
2170
|
+
"tr",
|
|
2171
|
+
{
|
|
2172
|
+
key: String(T),
|
|
2173
|
+
onClick: (N) => d?.(v, w, N),
|
|
2174
|
+
className: `${x.classes?.tr || "transition-colors duration-150"} ${u && w % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${o ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${P ? "bg-primary/5 dark:bg-primary/10" : ""} ${d ? "cursor-pointer" : ""} ${H}`
|
|
1789
2175
|
},
|
|
1790
|
-
/* @__PURE__ */ r.createElement(
|
|
1791
|
-
"
|
|
2176
|
+
a && /* @__PURE__ */ r.createElement(
|
|
2177
|
+
"td",
|
|
1792
2178
|
{
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
2179
|
+
style: {
|
|
2180
|
+
width: 44,
|
|
2181
|
+
minWidth: 44,
|
|
2182
|
+
backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
|
|
2183
|
+
},
|
|
2184
|
+
className: "w-11 px-4 py-3 text-center align-middle",
|
|
2185
|
+
onClick: (N) => N.stopPropagation()
|
|
2186
|
+
},
|
|
2187
|
+
/* @__PURE__ */ r.createElement(
|
|
2188
|
+
"input",
|
|
2189
|
+
{
|
|
2190
|
+
type: "checkbox",
|
|
2191
|
+
checked: P,
|
|
2192
|
+
title: y.selectRow,
|
|
2193
|
+
"aria-label": y.selectRow,
|
|
2194
|
+
onChange: () => m?.(T, v),
|
|
2195
|
+
className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
|
|
2196
|
+
}
|
|
2197
|
+
)
|
|
2198
|
+
),
|
|
2199
|
+
t.map((N) => {
|
|
2200
|
+
const U = String(N.key), G = S[U], R = !!G, V = N.align === "center" ? "text-center" : N.align === "right" ? "text-right" : N.align === "left" ? "text-left" : k ? "text-right" : "text-left", C = typeof N.className == "function" ? N.className(v?.[N.key], v, w) : N.className || "", J = {
|
|
2201
|
+
width: z[U] ?? N.width,
|
|
2202
|
+
minWidth: N.minWidth,
|
|
2203
|
+
maxWidth: N.maxWidth,
|
|
2204
|
+
...R ? G : {},
|
|
2205
|
+
backgroundColor: R ? P ? void 0 : x.colors?.tableBg || "inherit" : void 0
|
|
2206
|
+
};
|
|
2207
|
+
return /* @__PURE__ */ r.createElement(
|
|
2208
|
+
"td",
|
|
2209
|
+
{
|
|
2210
|
+
key: U,
|
|
2211
|
+
style: J,
|
|
2212
|
+
className: `${x.classes?.td || "py-3 px-4 text-sm align-middle"} ${V} ${C} ${R ? k ? "border-l border-gray-200/60 dark:border-gray-800/60 shadow-[-2px_0_4px_rgba(0,0,0,0.03)]" : "border-r border-gray-200/60 dark:border-gray-800/60 shadow-[2px_0_4px_rgba(0,0,0,0.03)]" : ""}`
|
|
2213
|
+
},
|
|
2214
|
+
/* @__PURE__ */ r.createElement(fa, { row: v, column: N, rowIndex: w })
|
|
2215
|
+
);
|
|
2216
|
+
}),
|
|
2217
|
+
h && /* @__PURE__ */ r.createElement(
|
|
1803
2218
|
"td",
|
|
1804
2219
|
{
|
|
1805
|
-
key: String(h.key),
|
|
1806
2220
|
style: {
|
|
1807
|
-
width:
|
|
1808
|
-
minWidth:
|
|
1809
|
-
|
|
2221
|
+
width: E || "auto",
|
|
2222
|
+
minWidth: typeof E == "number" ? E : void 0,
|
|
2223
|
+
backgroundColor: P ? void 0 : x.colors?.tableBg || void 0
|
|
1810
2224
|
},
|
|
1811
|
-
className: `${
|
|
2225
|
+
className: `${x.classes?.td || "py-3 px-4 text-sm align-middle"} ${k ? "text-left pl-6" : "text-right pr-6"} whitespace-nowrap`,
|
|
2226
|
+
onClick: (N) => N.stopPropagation()
|
|
1812
2227
|
},
|
|
1813
|
-
/* @__PURE__ */ r.createElement(
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
2228
|
+
/* @__PURE__ */ r.createElement(
|
|
2229
|
+
ba,
|
|
2230
|
+
{
|
|
2231
|
+
row: v,
|
|
2232
|
+
actions: n || [],
|
|
2233
|
+
context: s
|
|
2234
|
+
}
|
|
2235
|
+
)
|
|
2236
|
+
)
|
|
2237
|
+
);
|
|
2238
|
+
}),
|
|
2239
|
+
c && f > 0 && /* @__PURE__ */ r.createElement(
|
|
2240
|
+
"tr",
|
|
2241
|
+
{
|
|
2242
|
+
style: { height: `${f}px`, border: 0 },
|
|
2243
|
+
"aria-hidden": "true",
|
|
2244
|
+
className: "pointer-events-none"
|
|
2245
|
+
},
|
|
2246
|
+
/* @__PURE__ */ r.createElement(
|
|
1817
2247
|
"td",
|
|
1818
2248
|
{
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
}
|
|
1822
|
-
/* @__PURE__ */ r.createElement(
|
|
1823
|
-
Mr,
|
|
1824
|
-
{
|
|
1825
|
-
row: E,
|
|
1826
|
-
actions: o || [],
|
|
1827
|
-
context: s
|
|
1828
|
-
}
|
|
1829
|
-
)
|
|
2249
|
+
colSpan: j,
|
|
2250
|
+
style: { height: `${f}px`, padding: 0, border: 0 }
|
|
2251
|
+
}
|
|
1830
2252
|
)
|
|
1831
|
-
);
|
|
1832
|
-
}), g && b > 0 && /* @__PURE__ */ r.createElement(
|
|
1833
|
-
"tr",
|
|
1834
|
-
{
|
|
1835
|
-
style: { height: `${b}px`, border: 0 },
|
|
1836
|
-
"aria-hidden": "true",
|
|
1837
|
-
className: "pointer-events-none"
|
|
1838
|
-
},
|
|
1839
|
-
/* @__PURE__ */ r.createElement(
|
|
1840
|
-
"td",
|
|
1841
|
-
{
|
|
1842
|
-
colSpan: B,
|
|
1843
|
-
style: { height: `${b}px`, padding: 0, border: 0 }
|
|
1844
|
-
}
|
|
1845
2253
|
)
|
|
1846
|
-
)
|
|
2254
|
+
);
|
|
1847
2255
|
}
|
|
1848
|
-
function
|
|
2256
|
+
function xa({
|
|
1849
2257
|
page: e,
|
|
1850
2258
|
pageSize: t,
|
|
1851
|
-
totalRecords:
|
|
2259
|
+
totalRecords: n,
|
|
1852
2260
|
totalPages: s,
|
|
1853
2261
|
pageSizeOptions: i = [5, 10, 20, 50, 100],
|
|
1854
2262
|
onPageChange: a,
|
|
1855
2263
|
onPageSizeChange: l,
|
|
1856
2264
|
showPageSizeSelector: m = !0,
|
|
1857
2265
|
showTotalCount: d = !0,
|
|
1858
|
-
pageWindow:
|
|
2266
|
+
pageWindow: u,
|
|
2267
|
+
messages: o = Ee,
|
|
2268
|
+
dir: p = "ltr"
|
|
1859
2269
|
}) {
|
|
1860
|
-
const
|
|
2270
|
+
const c = _e(), g = p === "rtl", f = Math.min((e - 1) * t + 1, n), b = Math.min(e * t, n);
|
|
1861
2271
|
return /* @__PURE__ */ r.createElement(
|
|
1862
2272
|
"div",
|
|
1863
2273
|
{
|
|
1864
|
-
|
|
2274
|
+
dir: p,
|
|
2275
|
+
className: c.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400"
|
|
1865
2276
|
},
|
|
1866
|
-
/* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-3" }, d &&
|
|
2277
|
+
/* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-3" }, d && n > 0 ? /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, o.showing, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, f), " ", o.to, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, b), " ", o.of, " ", /* @__PURE__ */ r.createElement("strong", { className: "text-gray-900 dark:text-white font-bold" }, n.toLocaleString()), " ", o.results) : /* @__PURE__ */ r.createElement("span", { className: "text-xs sm:text-sm font-medium" }, o.page, " ", e, " ", o.of, " ", s), m && /* @__PURE__ */ r.createElement("div", { className: "flex items-center gap-2 ml-2 rtl:ml-0 rtl:mr-2" }, /* @__PURE__ */ r.createElement("span", { className: "text-xs text-gray-500 hidden sm:inline" }, o.rowsPerPage, ":"), /* @__PURE__ */ r.createElement(
|
|
1867
2278
|
"select",
|
|
1868
2279
|
{
|
|
1869
2280
|
value: t,
|
|
1870
|
-
onChange: (
|
|
1871
|
-
|
|
2281
|
+
onChange: (S) => l(Number(S.target.value)),
|
|
2282
|
+
"aria-label": o.rowsPerPage,
|
|
2283
|
+
className: c.classes?.paginationSelect || "h-8 px-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-xs font-semibold text-gray-800 dark:text-gray-200 focus:outline-none focus:border-primary cursor-pointer"
|
|
1872
2284
|
},
|
|
1873
|
-
i.map((
|
|
2285
|
+
i.map((S) => /* @__PURE__ */ r.createElement(
|
|
2286
|
+
"option",
|
|
2287
|
+
{
|
|
2288
|
+
key: S,
|
|
2289
|
+
value: S,
|
|
2290
|
+
className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white"
|
|
2291
|
+
},
|
|
2292
|
+
S
|
|
2293
|
+
))
|
|
1874
2294
|
))),
|
|
1875
|
-
/* @__PURE__ */ r.createElement(
|
|
1876
|
-
"
|
|
2295
|
+
/* @__PURE__ */ r.createElement(
|
|
2296
|
+
"div",
|
|
1877
2297
|
{
|
|
1878
|
-
|
|
1879
|
-
disabled: e <= 1,
|
|
1880
|
-
onClick: () => a(e - 1),
|
|
1881
|
-
"aria-label": "Previous Page",
|
|
1882
|
-
className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40"}`
|
|
2298
|
+
className: `flex items-center gap-1.5 ${g ? "mr-auto" : "ml-auto"}`
|
|
1883
2299
|
},
|
|
1884
|
-
|
|
1885
|
-
), c.map((u) => {
|
|
1886
|
-
const b = u === e;
|
|
1887
|
-
return /* @__PURE__ */ r.createElement(
|
|
2300
|
+
/* @__PURE__ */ r.createElement(
|
|
1888
2301
|
"button",
|
|
1889
2302
|
{
|
|
1890
|
-
key: u,
|
|
1891
2303
|
type: "button",
|
|
1892
|
-
|
|
1893
|
-
|
|
2304
|
+
disabled: e <= 1,
|
|
2305
|
+
onClick: () => a(e - 1),
|
|
2306
|
+
"aria-label": o.prevPage,
|
|
2307
|
+
title: o.prevPage,
|
|
2308
|
+
className: `${c.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed"}`
|
|
1894
2309
|
},
|
|
1895
|
-
|
|
1896
|
-
)
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
2310
|
+
g ? "›" : "‹"
|
|
2311
|
+
),
|
|
2312
|
+
u.map((S) => {
|
|
2313
|
+
const z = S === e;
|
|
2314
|
+
return /* @__PURE__ */ r.createElement(
|
|
2315
|
+
"button",
|
|
2316
|
+
{
|
|
2317
|
+
key: S,
|
|
2318
|
+
type: "button",
|
|
2319
|
+
onClick: () => a(S),
|
|
2320
|
+
className: `${c.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs transition shadow-sm cursor-pointer"} ${z ? "bg-primary text-white shadow-primary/20 scale-105" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`
|
|
2321
|
+
},
|
|
2322
|
+
S
|
|
2323
|
+
);
|
|
2324
|
+
}),
|
|
2325
|
+
/* @__PURE__ */ r.createElement(
|
|
2326
|
+
"button",
|
|
2327
|
+
{
|
|
2328
|
+
type: "button",
|
|
2329
|
+
disabled: e >= s,
|
|
2330
|
+
onClick: () => a(e + 1),
|
|
2331
|
+
"aria-label": o.nextPage,
|
|
2332
|
+
title: o.nextPage,
|
|
2333
|
+
className: `${c.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700 disabled:opacity-40 cursor-pointer disabled:cursor-not-allowed"}`
|
|
2334
|
+
},
|
|
2335
|
+
g ? "‹" : "›"
|
|
2336
|
+
)
|
|
2337
|
+
)
|
|
1908
2338
|
);
|
|
1909
2339
|
}
|
|
1910
|
-
function
|
|
2340
|
+
function ha({
|
|
1911
2341
|
columnsCount: e = 5,
|
|
1912
2342
|
rowsCount: t = 5,
|
|
1913
|
-
hasActions:
|
|
2343
|
+
hasActions: n = !0
|
|
1914
2344
|
}) {
|
|
1915
2345
|
return /* @__PURE__ */ r.createElement("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900" }, Array.from({ length: t }).map((s, i) => /* @__PURE__ */ r.createElement("tr", { key: i, className: "any-table-pulse" }, Array.from({ length: e }).map((a, l) => /* @__PURE__ */ r.createElement("td", { key: l, className: "py-4 px-4 align-middle" }, /* @__PURE__ */ r.createElement(
|
|
1916
2346
|
"div",
|
|
@@ -1920,434 +2350,898 @@ function jr({
|
|
|
1920
2350
|
width: `${Math.floor(40 + (l * 19 + i * 13) % 45)}%`
|
|
1921
2351
|
}
|
|
1922
2352
|
}
|
|
1923
|
-
))),
|
|
2353
|
+
))), n && /* @__PURE__ */ r.createElement("td", { className: "py-4 px-4 text-right align-middle pr-6" }, /* @__PURE__ */ r.createElement("div", { className: "inline-flex gap-2 justify-end" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }), /* @__PURE__ */ r.createElement("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }))))));
|
|
1924
2354
|
}
|
|
1925
|
-
function
|
|
2355
|
+
function ka({
|
|
1926
2356
|
title: e,
|
|
1927
2357
|
description: t,
|
|
1928
|
-
isSearchActive:
|
|
2358
|
+
isSearchActive: n = !1,
|
|
1929
2359
|
onClearSearch: s,
|
|
1930
|
-
colSpan: i
|
|
2360
|
+
colSpan: i,
|
|
2361
|
+
messages: a = Ee
|
|
1931
2362
|
}) {
|
|
1932
|
-
const
|
|
2363
|
+
const l = a.noRecordsTitle, m = a.noRecordsDescription, d = /* @__PURE__ */ r.createElement("div", { className: "w-full py-16 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-16 h-16 mb-4 rounded-2xl bg-gray-100 dark:bg-slate-800 text-gray-400 dark:text-gray-500 flex items-center justify-center text-3xl shadow-inner" }, n ? "🔍" : "📂"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, e || l), /* @__PURE__ */ r.createElement("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed" }, t || m), n && s && /* @__PURE__ */ r.createElement(
|
|
1933
2364
|
"button",
|
|
1934
2365
|
{
|
|
1935
2366
|
type: "button",
|
|
1936
2367
|
onClick: s,
|
|
1937
|
-
className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95"
|
|
2368
|
+
className: "px-4 py-2 rounded-xl bg-primary text-white text-xs font-bold hover:bg-primary-soft transition-all shadow-sm shadow-primary/20 active:scale-95 cursor-pointer"
|
|
1938
2369
|
},
|
|
1939
|
-
|
|
2370
|
+
a.clearSearch
|
|
1940
2371
|
));
|
|
1941
|
-
return i !== void 0 ? /* @__PURE__ */ r.createElement("tbody", null, /* @__PURE__ */ r.createElement("tr", null, /* @__PURE__ */ r.createElement("td", { colSpan: i, className: "p-0" },
|
|
2372
|
+
return i !== void 0 ? /* @__PURE__ */ r.createElement("tbody", null, /* @__PURE__ */ r.createElement("tr", null, /* @__PURE__ */ r.createElement("td", { colSpan: i, className: "p-0" }, d))) : d;
|
|
1942
2373
|
}
|
|
1943
|
-
function
|
|
1944
|
-
|
|
1945
|
-
|
|
2374
|
+
function wa({
|
|
2375
|
+
error: e,
|
|
2376
|
+
onRetry: t,
|
|
2377
|
+
messages: n = Ee
|
|
2378
|
+
}) {
|
|
2379
|
+
const s = typeof e == "string" ? e : e?.message || e?.response?.data?.message || n.errorDescription;
|
|
2380
|
+
return /* @__PURE__ */ r.createElement("div", { className: "w-full py-14 px-6 flex flex-col items-center justify-center text-center any-table-fade-in" }, /* @__PURE__ */ r.createElement("div", { className: "w-14 h-14 mb-4 rounded-2xl bg-rose-500/10 text-rose-500 flex items-center justify-center text-2xl border border-rose-500/20" }, "⚠️"), /* @__PURE__ */ r.createElement("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1" }, n.errorTitle), /* @__PURE__ */ r.createElement("p", { className: "text-xs sm:text-sm text-rose-600 dark:text-rose-400 font-medium max-w-md mb-5 leading-relaxed bg-rose-500/5 px-3 py-1.5 rounded-lg border border-rose-500/10" }, s), t && /* @__PURE__ */ r.createElement(
|
|
1946
2381
|
"button",
|
|
1947
2382
|
{
|
|
1948
2383
|
type: "button",
|
|
1949
2384
|
onClick: t,
|
|
1950
|
-
className: "inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-bold hover:bg-gray-800 dark:hover:bg-gray-100 transition-all shadow-md active:scale-95"
|
|
2385
|
+
className: "inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-bold hover:bg-gray-800 dark:hover:bg-gray-100 transition-all shadow-md active:scale-95 cursor-pointer"
|
|
1951
2386
|
},
|
|
1952
2387
|
/* @__PURE__ */ r.createElement("span", null, "🔄"),
|
|
1953
|
-
/* @__PURE__ */ r.createElement("span", null,
|
|
2388
|
+
/* @__PURE__ */ r.createElement("span", null, n.retry)
|
|
1954
2389
|
));
|
|
1955
2390
|
}
|
|
1956
|
-
function
|
|
2391
|
+
function xt(e) {
|
|
2392
|
+
if (e == null) return "";
|
|
2393
|
+
const t = String(e);
|
|
2394
|
+
return t.includes(",") || t.includes('"') || t.includes(`
|
|
2395
|
+
`) || t.includes("\r") ? `"${t.replace(/"/g, '""')}"` : t;
|
|
2396
|
+
}
|
|
2397
|
+
function va(e, t) {
|
|
2398
|
+
const n = t.filter(
|
|
2399
|
+
(a) => !a.hidden && a.key && a.exportable !== !1
|
|
2400
|
+
), i = [n.map((a) => {
|
|
2401
|
+
const l = typeof a.title == "string" ? a.title : String(a.key);
|
|
2402
|
+
return xt(l);
|
|
2403
|
+
}).join(",")];
|
|
2404
|
+
for (let a = 0; a < e.length; a++) {
|
|
2405
|
+
const l = e[a], m = n.map((d) => {
|
|
2406
|
+
const u = L(l, String(d.key));
|
|
2407
|
+
let o = u;
|
|
2408
|
+
if (typeof d.exportFormatter == "function")
|
|
2409
|
+
o = d.exportFormatter(u, l, a);
|
|
2410
|
+
else if (typeof d.formatter == "function") {
|
|
2411
|
+
const p = d.formatter(u, l, a);
|
|
2412
|
+
(typeof p == "string" || typeof p == "number") && (o = p);
|
|
2413
|
+
}
|
|
2414
|
+
if (o == null) return "";
|
|
2415
|
+
if (typeof o == "object")
|
|
2416
|
+
try {
|
|
2417
|
+
return xt(JSON.stringify(o));
|
|
2418
|
+
} catch {
|
|
2419
|
+
return "";
|
|
2420
|
+
}
|
|
2421
|
+
return xt(o);
|
|
2422
|
+
});
|
|
2423
|
+
i.push(m.join(","));
|
|
2424
|
+
}
|
|
2425
|
+
return "\uFEFF" + i.join(`\r
|
|
2426
|
+
`);
|
|
2427
|
+
}
|
|
2428
|
+
function Gt(e, t, n) {
|
|
2429
|
+
if (typeof window > "u" || typeof document > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function")
|
|
2430
|
+
return;
|
|
2431
|
+
const s = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(s), a = document.createElement("a");
|
|
2432
|
+
a.href = i, a.download = t, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
2433
|
+
}
|
|
2434
|
+
function ne(e, t, n = "table-export") {
|
|
2435
|
+
const s = va(e, t), i = n.endsWith(".csv") ? n : `${n}.csv`;
|
|
2436
|
+
Gt(s, i, "text/csv;charset=utf-8;");
|
|
2437
|
+
}
|
|
2438
|
+
function oe(e, t = "table-export") {
|
|
2439
|
+
const n = JSON.stringify(e, null, 2), s = t.endsWith(".json") ? t : `${t}.json`;
|
|
2440
|
+
Gt(n, s, "application/json;charset=utf-8;");
|
|
2441
|
+
}
|
|
2442
|
+
function Lt(e) {
|
|
1957
2443
|
const {
|
|
1958
2444
|
data: t,
|
|
1959
|
-
api:
|
|
2445
|
+
api: n,
|
|
1960
2446
|
columns: s,
|
|
1961
2447
|
autoColumns: i = !0,
|
|
1962
2448
|
rowKey: a,
|
|
1963
2449
|
title: l,
|
|
1964
2450
|
subtitle: m,
|
|
1965
2451
|
actions: d,
|
|
1966
|
-
actionsTitle:
|
|
1967
|
-
actionsWidth:
|
|
1968
|
-
search:
|
|
1969
|
-
sorting:
|
|
1970
|
-
pagination:
|
|
1971
|
-
virtualized:
|
|
1972
|
-
selectable:
|
|
1973
|
-
onSelectionChange:
|
|
1974
|
-
onRowClick:
|
|
1975
|
-
loading:
|
|
2452
|
+
actionsTitle: u,
|
|
2453
|
+
actionsWidth: o,
|
|
2454
|
+
search: p = !0,
|
|
2455
|
+
sorting: c = !0,
|
|
2456
|
+
pagination: g,
|
|
2457
|
+
virtualized: f = !1,
|
|
2458
|
+
selectable: b = !1,
|
|
2459
|
+
onSelectionChange: S,
|
|
2460
|
+
onRowClick: z,
|
|
2461
|
+
loading: W,
|
|
1976
2462
|
loadingComponent: E,
|
|
1977
|
-
emptyComponent:
|
|
2463
|
+
emptyComponent: y,
|
|
1978
2464
|
emptyTitle: x,
|
|
1979
2465
|
emptyDescription: k,
|
|
1980
|
-
errorComponent:
|
|
1981
|
-
className:
|
|
1982
|
-
tableClassName:
|
|
1983
|
-
headerClassName:
|
|
1984
|
-
rowClassName:
|
|
1985
|
-
headerActions:
|
|
1986
|
-
showHeader:
|
|
1987
|
-
bordered:
|
|
1988
|
-
striped:
|
|
2466
|
+
errorComponent: h,
|
|
2467
|
+
className: j = "",
|
|
2468
|
+
tableClassName: v = "",
|
|
2469
|
+
headerClassName: F = "",
|
|
2470
|
+
rowClassName: w,
|
|
2471
|
+
headerActions: T,
|
|
2472
|
+
showHeader: P = !0,
|
|
2473
|
+
bordered: H = !0,
|
|
2474
|
+
striped: N = !1,
|
|
1989
2475
|
hoverable: U = !0,
|
|
1990
|
-
compact:
|
|
1991
|
-
stickyHeader:
|
|
1992
|
-
tableRef:
|
|
2476
|
+
compact: G = !1,
|
|
2477
|
+
stickyHeader: R = !1,
|
|
2478
|
+
tableRef: V,
|
|
2479
|
+
// Internationalization & Features
|
|
2480
|
+
dir: C,
|
|
2481
|
+
locale: J = "en",
|
|
2482
|
+
messages: se,
|
|
2483
|
+
exportable: ce = !1,
|
|
2484
|
+
resizableColumns: Ne = !1,
|
|
1993
2485
|
// Legacy Wasel Props
|
|
1994
|
-
thead:
|
|
1995
|
-
headerData:
|
|
1996
|
-
tbodys:
|
|
1997
|
-
titleHeader:
|
|
1998
|
-
add:
|
|
1999
|
-
linkAdd:
|
|
2000
|
-
addHandler:
|
|
2001
|
-
view:
|
|
2002
|
-
linkView:
|
|
2003
|
-
viewHandler:
|
|
2004
|
-
edit:
|
|
2005
|
-
linkEdit:
|
|
2006
|
-
editHandler:
|
|
2007
|
-
del:
|
|
2008
|
-
handleDelete:
|
|
2009
|
-
block:
|
|
2010
|
-
handleBlock:
|
|
2011
|
-
buttons:
|
|
2012
|
-
} = e,
|
|
2013
|
-
|
|
2486
|
+
thead: Oe,
|
|
2487
|
+
headerData: Fe,
|
|
2488
|
+
tbodys: He,
|
|
2489
|
+
titleHeader: lt,
|
|
2490
|
+
add: it,
|
|
2491
|
+
linkAdd: dt,
|
|
2492
|
+
addHandler: ct,
|
|
2493
|
+
view: Se,
|
|
2494
|
+
linkView: Ke,
|
|
2495
|
+
viewHandler: Ae,
|
|
2496
|
+
edit: me,
|
|
2497
|
+
linkEdit: Ie,
|
|
2498
|
+
editHandler: Ue,
|
|
2499
|
+
del: Pe,
|
|
2500
|
+
handleDelete: Ve,
|
|
2501
|
+
block: Je,
|
|
2502
|
+
handleBlock: qe,
|
|
2503
|
+
buttons: xe
|
|
2504
|
+
} = e, _ = _e(), pe = D(
|
|
2505
|
+
() => Xr(J, se),
|
|
2506
|
+
[J, se]
|
|
2507
|
+
), M = D(() => C === "ltr" || C === "rtl" ? C : J?.toLowerCase().startsWith("ar") ? "rtl" : "ltr", [C, J]), le = D(() => t || He || void 0, [t, He]), O = D(() => Ot({
|
|
2508
|
+
data: le,
|
|
2014
2509
|
columns: s,
|
|
2015
2510
|
autoColumns: i,
|
|
2016
|
-
thead:
|
|
2017
|
-
headerData:
|
|
2018
|
-
}).filter((
|
|
2019
|
-
(
|
|
2511
|
+
thead: Oe,
|
|
2512
|
+
headerData: Fe
|
|
2513
|
+
}).filter((ae) => typeof ae.hidden == "function" ? !ae.hidden({ data: le || [] }) : !ae.hidden), [le, s, i, Oe, Fe]), [K, ee] = $({}), be = B((A, ae) => {
|
|
2514
|
+
ee((ke) => ({ ...ke, [A]: ae }));
|
|
2515
|
+
}, []), te = B(
|
|
2516
|
+
(A, ae) => {
|
|
2020
2517
|
if (typeof a == "function")
|
|
2021
|
-
return a(
|
|
2518
|
+
return a(A, ae);
|
|
2022
2519
|
if (typeof a == "string") {
|
|
2023
|
-
const
|
|
2024
|
-
if (
|
|
2520
|
+
const X = L(A, a);
|
|
2521
|
+
if (X != null) return X;
|
|
2025
2522
|
}
|
|
2026
|
-
const
|
|
2027
|
-
return
|
|
2523
|
+
const ke = A?._id ?? A?.id ?? A?.key;
|
|
2524
|
+
return ke ?? ae;
|
|
2028
2525
|
},
|
|
2029
2526
|
[a]
|
|
2030
2527
|
), {
|
|
2031
|
-
enabled:
|
|
2032
|
-
search:
|
|
2033
|
-
debouncedSearch:
|
|
2034
|
-
isDebouncing:
|
|
2035
|
-
setSearch:
|
|
2036
|
-
clearSearch:
|
|
2037
|
-
searchConfig:
|
|
2038
|
-
} =
|
|
2039
|
-
enabled:
|
|
2040
|
-
sortBy:
|
|
2041
|
-
sortOrder:
|
|
2042
|
-
toggleSort:
|
|
2043
|
-
setSorting:
|
|
2044
|
-
resetSorting:
|
|
2045
|
-
} =
|
|
2046
|
-
() =>
|
|
2528
|
+
enabled: q,
|
|
2529
|
+
search: I,
|
|
2530
|
+
debouncedSearch: ye,
|
|
2531
|
+
isDebouncing: je,
|
|
2532
|
+
setSearch: Ce,
|
|
2533
|
+
clearSearch: Te,
|
|
2534
|
+
searchConfig: Re
|
|
2535
|
+
} = Ft({ config: p }), {
|
|
2536
|
+
enabled: ut,
|
|
2537
|
+
sortBy: re,
|
|
2538
|
+
sortOrder: ie,
|
|
2539
|
+
toggleSort: Xt,
|
|
2540
|
+
setSorting: Zt,
|
|
2541
|
+
resetSorting: Qt
|
|
2542
|
+
} = Ht({ config: c }), vt = D(
|
|
2543
|
+
() => Kr({
|
|
2047
2544
|
explicitActions: d,
|
|
2048
|
-
buttons:
|
|
2049
|
-
block:
|
|
2050
|
-
handleBlock:
|
|
2051
|
-
view:
|
|
2052
|
-
linkView:
|
|
2053
|
-
viewHandler:
|
|
2054
|
-
edit:
|
|
2055
|
-
linkEdit:
|
|
2056
|
-
editHandler:
|
|
2057
|
-
del:
|
|
2058
|
-
handleDelete:
|
|
2545
|
+
buttons: xe,
|
|
2546
|
+
block: Je,
|
|
2547
|
+
handleBlock: qe,
|
|
2548
|
+
view: Se,
|
|
2549
|
+
linkView: Ke,
|
|
2550
|
+
viewHandler: Ae,
|
|
2551
|
+
edit: me,
|
|
2552
|
+
linkEdit: Ie,
|
|
2553
|
+
editHandler: Ue,
|
|
2554
|
+
del: Pe,
|
|
2555
|
+
handleDelete: Ve
|
|
2059
2556
|
}),
|
|
2060
2557
|
[
|
|
2061
2558
|
d,
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
we,
|
|
2066
|
-
ve,
|
|
2067
|
-
Ee,
|
|
2068
|
-
Ne,
|
|
2069
|
-
Ae,
|
|
2070
|
-
Te,
|
|
2559
|
+
xe,
|
|
2560
|
+
Je,
|
|
2561
|
+
qe,
|
|
2071
2562
|
Se,
|
|
2072
|
-
|
|
2563
|
+
Ke,
|
|
2564
|
+
Ae,
|
|
2565
|
+
me,
|
|
2566
|
+
Ie,
|
|
2567
|
+
Ue,
|
|
2568
|
+
Pe,
|
|
2569
|
+
Ve
|
|
2073
2570
|
]
|
|
2074
|
-
), [
|
|
2075
|
-
rows:
|
|
2571
|
+
), er = typeof g == "object" && g !== null && g.defaultPageSize ? g.defaultPageSize : 10, tr = typeof g == "object" && g !== null && g.defaultPage ? g.defaultPage : 1, [rr, ar] = $(tr), [nr, or] = $(er), Et = D(() => typeof f == "object" && f !== null ? f.enabled !== !1 : !!f, [f]), Be = D(() => g !== void 0 ? g : !Et, [Et, g]), sr = D(() => typeof Be == "object" && Be !== null ? Be.enabled !== !1 : !!Be, [Be]), {
|
|
2572
|
+
rows: Y,
|
|
2573
|
+
allFilteredRows: Ye,
|
|
2076
2574
|
totalRecords: ge,
|
|
2077
|
-
loading:
|
|
2078
|
-
error:
|
|
2079
|
-
refresh:
|
|
2080
|
-
isServerMode:
|
|
2081
|
-
} =
|
|
2082
|
-
data:
|
|
2083
|
-
api:
|
|
2084
|
-
columns:
|
|
2085
|
-
searchQuery:
|
|
2086
|
-
sortBy:
|
|
2087
|
-
sortOrder:
|
|
2088
|
-
page:
|
|
2089
|
-
pageSize:
|
|
2090
|
-
paginationEnabled:
|
|
2091
|
-
manualLoading:
|
|
2575
|
+
loading: Ge,
|
|
2576
|
+
error: Xe,
|
|
2577
|
+
refresh: Me,
|
|
2578
|
+
isServerMode: Ze
|
|
2579
|
+
} = It({
|
|
2580
|
+
data: le,
|
|
2581
|
+
api: n,
|
|
2582
|
+
columns: O,
|
|
2583
|
+
searchQuery: ye,
|
|
2584
|
+
sortBy: re,
|
|
2585
|
+
sortOrder: ie,
|
|
2586
|
+
page: rr,
|
|
2587
|
+
pageSize: nr,
|
|
2588
|
+
paginationEnabled: sr,
|
|
2589
|
+
manualLoading: W
|
|
2092
2590
|
}), {
|
|
2093
|
-
enabled:
|
|
2094
|
-
page:
|
|
2095
|
-
pageSize:
|
|
2096
|
-
totalPages:
|
|
2097
|
-
pageSizeOptions:
|
|
2098
|
-
setPage:
|
|
2099
|
-
setPageSize:
|
|
2100
|
-
resetPagination:
|
|
2101
|
-
getPageWindow:
|
|
2102
|
-
paginationConfig:
|
|
2103
|
-
} =
|
|
2104
|
-
config:
|
|
2591
|
+
enabled: lr,
|
|
2592
|
+
page: Qe,
|
|
2593
|
+
pageSize: mt,
|
|
2594
|
+
totalPages: Nt,
|
|
2595
|
+
pageSizeOptions: ir,
|
|
2596
|
+
setPage: et,
|
|
2597
|
+
setPageSize: St,
|
|
2598
|
+
resetPagination: dr,
|
|
2599
|
+
getPageWindow: cr,
|
|
2600
|
+
paginationConfig: At
|
|
2601
|
+
} = Kt({
|
|
2602
|
+
config: Be,
|
|
2105
2603
|
totalRecords: ge,
|
|
2106
|
-
onPageChange: (
|
|
2107
|
-
|
|
2604
|
+
onPageChange: (A, ae) => {
|
|
2605
|
+
ar(A), or(ae);
|
|
2108
2606
|
}
|
|
2109
|
-
}),
|
|
2110
|
-
isVirtualized:
|
|
2111
|
-
paddingTop:
|
|
2112
|
-
paddingBottom:
|
|
2113
|
-
startIndex:
|
|
2114
|
-
maxHeight:
|
|
2115
|
-
scrollToIndex:
|
|
2116
|
-
sliceRows:
|
|
2117
|
-
} =
|
|
2118
|
-
config:
|
|
2119
|
-
totalCount:
|
|
2120
|
-
scrollContainerRef:
|
|
2121
|
-
}),
|
|
2122
|
-
selectedKeys:
|
|
2123
|
-
selectedRows:
|
|
2124
|
-
onToggleSelectRow:
|
|
2125
|
-
handleToggleSelectAll:
|
|
2126
|
-
clearSelection:
|
|
2127
|
-
allSelected:
|
|
2128
|
-
isIndeterminate:
|
|
2129
|
-
} =
|
|
2130
|
-
rows:
|
|
2131
|
-
rowKeyResolver:
|
|
2132
|
-
onSelectionChange:
|
|
2133
|
-
}),
|
|
2607
|
+
}), Pt = ve(null), {
|
|
2608
|
+
isVirtualized: he,
|
|
2609
|
+
paddingTop: ur,
|
|
2610
|
+
paddingBottom: mr,
|
|
2611
|
+
startIndex: gr,
|
|
2612
|
+
maxHeight: tt,
|
|
2613
|
+
scrollToIndex: fr,
|
|
2614
|
+
sliceRows: Ct
|
|
2615
|
+
} = Jr({
|
|
2616
|
+
config: f,
|
|
2617
|
+
totalCount: Y.length,
|
|
2618
|
+
scrollContainerRef: Pt
|
|
2619
|
+
}), pr = D(() => he ? Ct(Y) : Y, [he, Y, Ct]), {
|
|
2620
|
+
selectedKeys: rt,
|
|
2621
|
+
selectedRows: ue,
|
|
2622
|
+
onToggleSelectRow: br,
|
|
2623
|
+
handleToggleSelectAll: yr,
|
|
2624
|
+
clearSelection: xr,
|
|
2625
|
+
allSelected: hr,
|
|
2626
|
+
isIndeterminate: kr
|
|
2627
|
+
} = Ut({
|
|
2628
|
+
rows: Y,
|
|
2629
|
+
rowKeyResolver: te,
|
|
2630
|
+
onSelectionChange: S
|
|
2631
|
+
}), wr = D(
|
|
2134
2632
|
() => ({
|
|
2135
|
-
refresh:
|
|
2136
|
-
loading:
|
|
2137
|
-
page:
|
|
2138
|
-
selectedRows:
|
|
2139
|
-
setPage:
|
|
2633
|
+
refresh: Me,
|
|
2634
|
+
loading: Ge,
|
|
2635
|
+
page: Qe,
|
|
2636
|
+
selectedRows: ue,
|
|
2637
|
+
setPage: et
|
|
2140
2638
|
}),
|
|
2141
|
-
[
|
|
2639
|
+
[Me, Ge, Qe, ue, et]
|
|
2640
|
+
), De = vt.length > 0, Tt = D(() => Hr(O, {
|
|
2641
|
+
selectable: b,
|
|
2642
|
+
hasActions: De,
|
|
2643
|
+
actionsWidth: o,
|
|
2644
|
+
columnWidths: K,
|
|
2645
|
+
isRtl: M === "rtl"
|
|
2646
|
+
}), [
|
|
2647
|
+
O,
|
|
2648
|
+
b,
|
|
2649
|
+
De,
|
|
2650
|
+
o,
|
|
2651
|
+
K,
|
|
2652
|
+
M
|
|
2653
|
+
]), [gt, at] = $(!1), Rt = B(
|
|
2654
|
+
async (A = "csv", ae, ke) => {
|
|
2655
|
+
const X = typeof ce == "object" ? ce : {}, de = X.filename || ae || (typeof l == "string" ? l.toLowerCase().replace(/\s+/g, "-") : "table-export");
|
|
2656
|
+
let $e = ke || X.scope || "auto";
|
|
2657
|
+
if ($e === "auto" && (Ze ? $e = X.fetchAllRows || X.onExport ? "all" : "current-page" : $e = "all"), typeof X.onExport == "function") {
|
|
2658
|
+
at(!0);
|
|
2659
|
+
try {
|
|
2660
|
+
const fe = {
|
|
2661
|
+
format: A,
|
|
2662
|
+
scope: $e,
|
|
2663
|
+
search: I,
|
|
2664
|
+
sortBy: re,
|
|
2665
|
+
sortOrder: ie,
|
|
2666
|
+
params: n?.params,
|
|
2667
|
+
currentPageRows: Y,
|
|
2668
|
+
selectedRows: ue,
|
|
2669
|
+
selectedKeys: Array.from(rt),
|
|
2670
|
+
totalRecords: ge,
|
|
2671
|
+
columns: O,
|
|
2672
|
+
defaultExport: (Z, Le) => {
|
|
2673
|
+
const ze = Le || de;
|
|
2674
|
+
A === "json" ? oe(Z, ze) : ne(Z, O, ze);
|
|
2675
|
+
}
|
|
2676
|
+
};
|
|
2677
|
+
await X.onExport(A, fe);
|
|
2678
|
+
} finally {
|
|
2679
|
+
at(!1);
|
|
2680
|
+
}
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
if ($e === "selected" && ue.length > 0) {
|
|
2684
|
+
A === "json" ? oe(ue, de) : ne(ue, O, de);
|
|
2685
|
+
return;
|
|
2686
|
+
}
|
|
2687
|
+
if ($e === "current-page") {
|
|
2688
|
+
A === "json" ? oe(Y, de) : ne(Y, O, de);
|
|
2689
|
+
return;
|
|
2690
|
+
}
|
|
2691
|
+
if (!Ze) {
|
|
2692
|
+
const fe = Ye && Ye.length > 0 ? Ye : Y;
|
|
2693
|
+
A === "json" ? oe(fe, de) : ne(fe, O, de);
|
|
2694
|
+
return;
|
|
2695
|
+
}
|
|
2696
|
+
if (X.fetchAllRows) {
|
|
2697
|
+
at(!0);
|
|
2698
|
+
try {
|
|
2699
|
+
let fe = [];
|
|
2700
|
+
if (typeof X.fetchAllRows == "function") {
|
|
2701
|
+
const Z = n?.paramNames || {}, Le = Z.pageParam || "page", ze = Z.pageSizeParam || "limit", ft = Z.searchParam || "q", pt = Z.sortByParam || "sortBy", bt = Z.sortOrderParam || "sortOrder", nt = {
|
|
2702
|
+
[Le]: 1,
|
|
2703
|
+
[ze]: ge || 999999,
|
|
2704
|
+
page: 1,
|
|
2705
|
+
pageSize: ge || 999999,
|
|
2706
|
+
...I ? { [ft]: I, search: I, q: I } : {},
|
|
2707
|
+
...re ? { [pt]: re, sortBy: re } : {},
|
|
2708
|
+
...ie ? { [bt]: ie, sortOrder: ie } : {},
|
|
2709
|
+
...n?.params || {},
|
|
2710
|
+
all: !0
|
|
2711
|
+
};
|
|
2712
|
+
fe = await X.fetchAllRows(nt);
|
|
2713
|
+
} else if (X.fetchAllRows === !0 && n?.fetcher) {
|
|
2714
|
+
const Z = n.paramNames || {}, Le = Z.pageParam || "page", ze = Z.pageSizeParam || "limit", ft = Z.searchParam || "q", pt = Z.sortByParam || "sortBy", bt = Z.sortOrderParam || "sortOrder", nt = {
|
|
2715
|
+
[Le]: 1,
|
|
2716
|
+
[ze]: ge || 999999,
|
|
2717
|
+
page: 1,
|
|
2718
|
+
pageSize: ge || 999999,
|
|
2719
|
+
...I ? { [ft]: I, search: I, q: I } : {},
|
|
2720
|
+
...re ? { [pt]: re, sortBy: re } : {},
|
|
2721
|
+
...ie ? { [bt]: ie, sortOrder: ie } : {},
|
|
2722
|
+
...n.params || {},
|
|
2723
|
+
all: !0
|
|
2724
|
+
}, Sr = await n.fetcher(nt);
|
|
2725
|
+
fe = wt(Sr, n, nt).data;
|
|
2726
|
+
}
|
|
2727
|
+
A === "json" ? oe(fe, de) : ne(fe, O, de);
|
|
2728
|
+
} finally {
|
|
2729
|
+
at(!1);
|
|
2730
|
+
}
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
console.warn(
|
|
2734
|
+
"AnyTable: Exporting current page only. For server-side pagination, configure 'exportable.fetchAllRows' or 'exportable.onExport' to fetch all filtered records."
|
|
2735
|
+
), A === "json" ? oe(Y, de) : ne(Y, O, de);
|
|
2736
|
+
},
|
|
2737
|
+
[
|
|
2738
|
+
ce,
|
|
2739
|
+
l,
|
|
2740
|
+
Ze,
|
|
2741
|
+
I,
|
|
2742
|
+
re,
|
|
2743
|
+
ie,
|
|
2744
|
+
n,
|
|
2745
|
+
Y,
|
|
2746
|
+
Ye,
|
|
2747
|
+
ue,
|
|
2748
|
+
rt,
|
|
2749
|
+
ge,
|
|
2750
|
+
O
|
|
2751
|
+
]
|
|
2142
2752
|
);
|
|
2143
|
-
|
|
2144
|
-
tableRef:
|
|
2145
|
-
refresh:
|
|
2146
|
-
resetPagination:
|
|
2147
|
-
resetSearch:
|
|
2148
|
-
resetSorting:
|
|
2149
|
-
setPage:
|
|
2150
|
-
setPageSize:
|
|
2151
|
-
setSearch:
|
|
2152
|
-
setSorting:
|
|
2153
|
-
selectedRows:
|
|
2154
|
-
clearSelection:
|
|
2155
|
-
scrollToIndex:
|
|
2753
|
+
Vr({
|
|
2754
|
+
tableRef: V,
|
|
2755
|
+
refresh: Me,
|
|
2756
|
+
resetPagination: dr,
|
|
2757
|
+
resetSearch: Te,
|
|
2758
|
+
resetSorting: Qt,
|
|
2759
|
+
setPage: et,
|
|
2760
|
+
setPageSize: St,
|
|
2761
|
+
setSearch: Ce,
|
|
2762
|
+
setSorting: Zt,
|
|
2763
|
+
selectedRows: ue,
|
|
2764
|
+
clearSelection: xr,
|
|
2765
|
+
scrollToIndex: fr,
|
|
2766
|
+
exportData: Rt,
|
|
2767
|
+
isExporting: gt,
|
|
2156
2768
|
getState: () => ({
|
|
2157
|
-
data:
|
|
2158
|
-
loading:
|
|
2159
|
-
error:
|
|
2160
|
-
page:
|
|
2161
|
-
pageSize:
|
|
2769
|
+
data: Y,
|
|
2770
|
+
loading: Ge,
|
|
2771
|
+
error: Xe,
|
|
2772
|
+
page: Qe,
|
|
2773
|
+
pageSize: mt,
|
|
2162
2774
|
total: ge,
|
|
2163
|
-
totalPages:
|
|
2164
|
-
search:
|
|
2165
|
-
sortBy:
|
|
2166
|
-
sortOrder:
|
|
2167
|
-
selectedRowKeys: Array.from(
|
|
2168
|
-
selectedRows:
|
|
2169
|
-
isServerMode:
|
|
2775
|
+
totalPages: Nt,
|
|
2776
|
+
search: I,
|
|
2777
|
+
sortBy: re,
|
|
2778
|
+
sortOrder: ie,
|
|
2779
|
+
selectedRowKeys: Array.from(rt),
|
|
2780
|
+
selectedRows: ue,
|
|
2781
|
+
isServerMode: Ze,
|
|
2782
|
+
isExporting: gt
|
|
2170
2783
|
})
|
|
2171
2784
|
});
|
|
2172
|
-
const
|
|
2173
|
-
const
|
|
2174
|
-
return
|
|
2175
|
-
}, [
|
|
2176
|
-
const
|
|
2177
|
-
return
|
|
2178
|
-
}, [
|
|
2785
|
+
const vr = l || lt, Er = D(() => {
|
|
2786
|
+
const A = {};
|
|
2787
|
+
return _.borderRadius && (A["--any-table-radius"] = _.borderRadius), _.fontFamily && (A["--any-table-font"] = _.fontFamily, A.fontFamily = _.fontFamily), _.colors?.primary && (A["--any-table-primary"] = _.colors.primary), _.colors?.primaryHover && (A["--any-table-primary-hover"] = _.colors.primaryHover), _.colors?.border && (A["--any-table-border"] = _.colors.border), A;
|
|
2788
|
+
}, [_]), Nr = D(() => {
|
|
2789
|
+
const A = {};
|
|
2790
|
+
return _.borderRadius && (A.borderRadius = _.borderRadius), he && (A.maxHeight = typeof tt == "number" ? `${tt}px` : tt, A.overflowY = "auto", A.position = "relative"), A;
|
|
2791
|
+
}, [_.borderRadius, he, tt]);
|
|
2179
2792
|
return /* @__PURE__ */ r.createElement(
|
|
2180
2793
|
"div",
|
|
2181
2794
|
{
|
|
2182
|
-
|
|
2183
|
-
|
|
2795
|
+
dir: M,
|
|
2796
|
+
lang: J,
|
|
2797
|
+
style: Er,
|
|
2798
|
+
className: `any-table-wrapper ${_.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${j}`
|
|
2184
2799
|
},
|
|
2185
2800
|
/* @__PURE__ */ r.createElement(
|
|
2186
|
-
|
|
2801
|
+
Zr,
|
|
2187
2802
|
{
|
|
2188
|
-
displayTitle:
|
|
2803
|
+
displayTitle: vr,
|
|
2189
2804
|
subtitle: m,
|
|
2190
|
-
isSearchEnabled:
|
|
2191
|
-
searchQuery:
|
|
2192
|
-
setSearch:
|
|
2193
|
-
clearSearch:
|
|
2194
|
-
isDebouncing:
|
|
2195
|
-
searchPlaceholder:
|
|
2196
|
-
headerActions:
|
|
2197
|
-
add:
|
|
2198
|
-
linkAdd:
|
|
2199
|
-
addHandler:
|
|
2805
|
+
isSearchEnabled: q,
|
|
2806
|
+
searchQuery: I,
|
|
2807
|
+
setSearch: Ce,
|
|
2808
|
+
clearSearch: Te,
|
|
2809
|
+
isDebouncing: je,
|
|
2810
|
+
searchPlaceholder: Re.placeholder,
|
|
2811
|
+
headerActions: T,
|
|
2812
|
+
add: it,
|
|
2813
|
+
linkAdd: dt,
|
|
2814
|
+
addHandler: ct,
|
|
2815
|
+
messages: pe,
|
|
2816
|
+
exportable: ce,
|
|
2817
|
+
onExport: Rt,
|
|
2818
|
+
isExporting: gt,
|
|
2819
|
+
hasSelectedRows: ue.length > 0,
|
|
2820
|
+
dir: M
|
|
2200
2821
|
}
|
|
2201
2822
|
),
|
|
2202
2823
|
/* @__PURE__ */ r.createElement(
|
|
2203
2824
|
"div",
|
|
2204
2825
|
{
|
|
2205
|
-
ref:
|
|
2206
|
-
style:
|
|
2207
|
-
className: `${
|
|
2826
|
+
ref: Pt,
|
|
2827
|
+
style: Nr,
|
|
2828
|
+
className: `${_.classes?.tableWrapper || "w-full overflow-x-auto rounded-2xl border border-gray-200 dark:border-gray-800 bg-white dark:bg-slate-900 shadow-sm transition-colors"} ${H ? "" : "border-0 shadow-none"}`
|
|
2208
2829
|
},
|
|
2209
|
-
|
|
2830
|
+
Xe ? typeof h == "function" ? h(Xe, Me) : h || /* @__PURE__ */ r.createElement(
|
|
2831
|
+
wa,
|
|
2832
|
+
{
|
|
2833
|
+
error: Xe,
|
|
2834
|
+
onRetry: Me,
|
|
2835
|
+
messages: pe
|
|
2836
|
+
}
|
|
2837
|
+
) : /* @__PURE__ */ r.createElement(
|
|
2210
2838
|
"table",
|
|
2211
2839
|
{
|
|
2212
|
-
className: `${
|
|
2840
|
+
className: `${_.classes?.table || "w-full border-collapse text-left rtl:text-right text-sm"} ${G || _.density === "compact" ? "text-xs" : ""} ${R || he ? "relative" : ""} ${v}`
|
|
2213
2841
|
},
|
|
2214
|
-
|
|
2215
|
-
|
|
2842
|
+
P && /* @__PURE__ */ r.createElement(
|
|
2843
|
+
Qr,
|
|
2216
2844
|
{
|
|
2217
|
-
columns:
|
|
2218
|
-
hasActions:
|
|
2219
|
-
actionsTitle:
|
|
2220
|
-
actionsWidth:
|
|
2221
|
-
sortBy:
|
|
2222
|
-
sortOrder:
|
|
2223
|
-
onSort:
|
|
2224
|
-
selectable:
|
|
2225
|
-
allSelected:
|
|
2226
|
-
isIndeterminate:
|
|
2227
|
-
onToggleSelectAll:
|
|
2228
|
-
headerClassName:
|
|
2229
|
-
sticky:
|
|
2845
|
+
columns: O,
|
|
2846
|
+
hasActions: De,
|
|
2847
|
+
actionsTitle: u,
|
|
2848
|
+
actionsWidth: o,
|
|
2849
|
+
sortBy: re,
|
|
2850
|
+
sortOrder: ie,
|
|
2851
|
+
onSort: ut ? Xt : void 0,
|
|
2852
|
+
selectable: b,
|
|
2853
|
+
allSelected: hr,
|
|
2854
|
+
isIndeterminate: kr,
|
|
2855
|
+
onToggleSelectAll: yr,
|
|
2856
|
+
headerClassName: F,
|
|
2857
|
+
sticky: R || he,
|
|
2858
|
+
messages: pe,
|
|
2859
|
+
dir: M,
|
|
2860
|
+
resizableColumns: Ne,
|
|
2861
|
+
columnWidths: K,
|
|
2862
|
+
onResizeColumn: be,
|
|
2863
|
+
pinnedStyles: Tt
|
|
2230
2864
|
}
|
|
2231
2865
|
),
|
|
2232
|
-
|
|
2233
|
-
|
|
2866
|
+
Ge && Y.length === 0 ? E || /* @__PURE__ */ r.createElement(
|
|
2867
|
+
ha,
|
|
2234
2868
|
{
|
|
2235
|
-
columnsCount:
|
|
2236
|
-
rowsCount:
|
|
2869
|
+
columnsCount: O.length + (b ? 1 : 0) + (De ? 1 : 0),
|
|
2870
|
+
rowsCount: mt || 5
|
|
2237
2871
|
}
|
|
2238
|
-
) :
|
|
2872
|
+
) : Y.length === 0 ? (
|
|
2239
2873
|
// Empty State
|
|
2240
|
-
|
|
2241
|
-
|
|
2874
|
+
y || /* @__PURE__ */ r.createElement(
|
|
2875
|
+
ka,
|
|
2242
2876
|
{
|
|
2243
2877
|
title: x,
|
|
2244
2878
|
description: k,
|
|
2245
|
-
colSpan:
|
|
2879
|
+
colSpan: O.length + (b ? 1 : 0) + (De ? 1 : 0),
|
|
2880
|
+
messages: pe
|
|
2246
2881
|
}
|
|
2247
2882
|
)
|
|
2248
2883
|
) : (
|
|
2249
2884
|
// Table Body
|
|
2250
2885
|
/* @__PURE__ */ r.createElement(
|
|
2251
|
-
|
|
2886
|
+
ya,
|
|
2252
2887
|
{
|
|
2253
|
-
rows:
|
|
2254
|
-
columns:
|
|
2255
|
-
actions:
|
|
2256
|
-
actionContext:
|
|
2257
|
-
rowKeyResolver:
|
|
2258
|
-
selectable:
|
|
2259
|
-
selectedKeys:
|
|
2260
|
-
onToggleSelectRow:
|
|
2261
|
-
onRowClick:
|
|
2262
|
-
striped:
|
|
2888
|
+
rows: pr,
|
|
2889
|
+
columns: O,
|
|
2890
|
+
actions: vt,
|
|
2891
|
+
actionContext: wr,
|
|
2892
|
+
rowKeyResolver: te,
|
|
2893
|
+
selectable: b,
|
|
2894
|
+
selectedKeys: rt,
|
|
2895
|
+
onToggleSelectRow: br,
|
|
2896
|
+
onRowClick: z,
|
|
2897
|
+
striped: N,
|
|
2263
2898
|
hoverable: U,
|
|
2264
|
-
rowClassName:
|
|
2265
|
-
isVirtualized:
|
|
2266
|
-
paddingTop:
|
|
2267
|
-
paddingBottom:
|
|
2268
|
-
startIndex:
|
|
2899
|
+
rowClassName: w,
|
|
2900
|
+
isVirtualized: he,
|
|
2901
|
+
paddingTop: ur,
|
|
2902
|
+
paddingBottom: mr,
|
|
2903
|
+
startIndex: gr,
|
|
2904
|
+
pinnedStyles: Tt,
|
|
2905
|
+
columnWidths: K,
|
|
2906
|
+
dir: M,
|
|
2907
|
+
actionsWidth: o,
|
|
2908
|
+
messages: pe
|
|
2269
2909
|
}
|
|
2270
2910
|
)
|
|
2271
2911
|
)
|
|
2272
2912
|
)
|
|
2273
2913
|
),
|
|
2274
|
-
|
|
2275
|
-
|
|
2914
|
+
lr && /* @__PURE__ */ r.createElement(
|
|
2915
|
+
xa,
|
|
2276
2916
|
{
|
|
2277
|
-
page:
|
|
2278
|
-
pageSize:
|
|
2917
|
+
page: Qe,
|
|
2918
|
+
pageSize: mt,
|
|
2279
2919
|
totalRecords: ge,
|
|
2280
|
-
totalPages:
|
|
2281
|
-
pageSizeOptions:
|
|
2282
|
-
onPageChange:
|
|
2283
|
-
onPageSizeChange:
|
|
2284
|
-
showPageSizeSelector:
|
|
2285
|
-
showTotalCount:
|
|
2286
|
-
pageWindow:
|
|
2920
|
+
totalPages: Nt,
|
|
2921
|
+
pageSizeOptions: ir,
|
|
2922
|
+
onPageChange: et,
|
|
2923
|
+
onPageSizeChange: St,
|
|
2924
|
+
showPageSizeSelector: At.showPageSizeSelector,
|
|
2925
|
+
showTotalCount: At.showTotalCount,
|
|
2926
|
+
pageWindow: cr(5),
|
|
2927
|
+
messages: pe,
|
|
2928
|
+
dir: M
|
|
2287
2929
|
}
|
|
2288
2930
|
)
|
|
2289
2931
|
);
|
|
2290
2932
|
}
|
|
2291
|
-
const
|
|
2292
|
-
const s =
|
|
2293
|
-
return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(
|
|
2933
|
+
const Sa = r.forwardRef(function(t, n) {
|
|
2934
|
+
const s = n || t.tableRef;
|
|
2935
|
+
return !t.theme && !t.preset ? /* @__PURE__ */ r.createElement(Lt, { ...t, tableRef: s }) : /* @__PURE__ */ r.createElement(qr, { theme: t.theme, preset: t.preset }, /* @__PURE__ */ r.createElement(Lt, { ...t, tableRef: s }));
|
|
2294
2936
|
});
|
|
2937
|
+
function Aa(e = {}) {
|
|
2938
|
+
const {
|
|
2939
|
+
data: t,
|
|
2940
|
+
api: n,
|
|
2941
|
+
columns: s,
|
|
2942
|
+
autoColumns: i = !0,
|
|
2943
|
+
rowKey: a,
|
|
2944
|
+
search: l = !0,
|
|
2945
|
+
sorting: m = !0,
|
|
2946
|
+
pagination: d = !0,
|
|
2947
|
+
manualLoading: u,
|
|
2948
|
+
onSelectionChange: o,
|
|
2949
|
+
exportable: p
|
|
2950
|
+
} = e, c = D(() => Ot({
|
|
2951
|
+
data: t,
|
|
2952
|
+
columns: s,
|
|
2953
|
+
autoColumns: i
|
|
2954
|
+
}), [t, s, i]), g = B(
|
|
2955
|
+
(M, le) => {
|
|
2956
|
+
if (typeof a == "function")
|
|
2957
|
+
return a(M, le);
|
|
2958
|
+
if (typeof a == "string") {
|
|
2959
|
+
const K = L(M, a);
|
|
2960
|
+
if (K != null) return K;
|
|
2961
|
+
}
|
|
2962
|
+
const O = M?._id ?? M?.id ?? M?.key;
|
|
2963
|
+
return O ?? le;
|
|
2964
|
+
},
|
|
2965
|
+
[a]
|
|
2966
|
+
), {
|
|
2967
|
+
enabled: f,
|
|
2968
|
+
search: b,
|
|
2969
|
+
debouncedSearch: S,
|
|
2970
|
+
isDebouncing: z,
|
|
2971
|
+
setSearch: W,
|
|
2972
|
+
clearSearch: E,
|
|
2973
|
+
searchConfig: y
|
|
2974
|
+
} = Ft({ config: l }), {
|
|
2975
|
+
enabled: x,
|
|
2976
|
+
sortBy: k,
|
|
2977
|
+
sortOrder: h,
|
|
2978
|
+
toggleSort: j,
|
|
2979
|
+
setSorting: v,
|
|
2980
|
+
resetSorting: F
|
|
2981
|
+
} = Ht({ config: m }), w = typeof d == "object" && d !== null && d.defaultPageSize ? d.defaultPageSize : 10, T = typeof d == "object" && d !== null && d.defaultPage ? d.defaultPage : 1, [P, H] = $(T), [N, U] = $(w), G = D(() => typeof d == "object" && d !== null ? d.enabled !== !1 : !!d, [d]), {
|
|
2982
|
+
rows: R,
|
|
2983
|
+
allFilteredRows: V,
|
|
2984
|
+
totalRecords: C,
|
|
2985
|
+
loading: J,
|
|
2986
|
+
error: se,
|
|
2987
|
+
refresh: ce,
|
|
2988
|
+
isServerMode: Ne
|
|
2989
|
+
} = It({
|
|
2990
|
+
data: t,
|
|
2991
|
+
api: n,
|
|
2992
|
+
columns: c,
|
|
2993
|
+
searchQuery: S,
|
|
2994
|
+
sortBy: k,
|
|
2995
|
+
sortOrder: h,
|
|
2996
|
+
page: P,
|
|
2997
|
+
pageSize: N,
|
|
2998
|
+
paginationEnabled: G,
|
|
2999
|
+
manualLoading: u
|
|
3000
|
+
}), {
|
|
3001
|
+
enabled: Oe,
|
|
3002
|
+
page: Fe,
|
|
3003
|
+
pageSize: He,
|
|
3004
|
+
totalPages: lt,
|
|
3005
|
+
pageSizeOptions: it,
|
|
3006
|
+
setPage: dt,
|
|
3007
|
+
setPageSize: ct,
|
|
3008
|
+
resetPagination: Se,
|
|
3009
|
+
getPageWindow: Ke
|
|
3010
|
+
} = Kt({
|
|
3011
|
+
config: d,
|
|
3012
|
+
totalRecords: C,
|
|
3013
|
+
onPageChange: (M, le) => {
|
|
3014
|
+
H(M), U(le);
|
|
3015
|
+
}
|
|
3016
|
+
}), {
|
|
3017
|
+
selectedKeys: Ae,
|
|
3018
|
+
selectedRows: me,
|
|
3019
|
+
onToggleSelectRow: Ie,
|
|
3020
|
+
handleToggleSelectAll: Ue,
|
|
3021
|
+
clearSelection: Pe,
|
|
3022
|
+
allSelected: Ve,
|
|
3023
|
+
isIndeterminate: Je
|
|
3024
|
+
} = Ut({
|
|
3025
|
+
rows: R,
|
|
3026
|
+
rowKeyResolver: g,
|
|
3027
|
+
onSelectionChange: o
|
|
3028
|
+
}), [qe, xe] = $(!1), _ = B(
|
|
3029
|
+
async (M = "csv", le, O) => {
|
|
3030
|
+
const K = typeof p == "object" ? p : {}, ee = K.filename || le || "table-export";
|
|
3031
|
+
let be = O || K.scope || "auto";
|
|
3032
|
+
if (be === "auto" && (Ne ? be = K.fetchAllRows || K.onExport ? "all" : "current-page" : be = "all"), typeof K.onExport == "function") {
|
|
3033
|
+
xe(!0);
|
|
3034
|
+
try {
|
|
3035
|
+
const te = {
|
|
3036
|
+
format: M,
|
|
3037
|
+
scope: be,
|
|
3038
|
+
search: b,
|
|
3039
|
+
sortBy: k,
|
|
3040
|
+
sortOrder: h,
|
|
3041
|
+
params: n?.params,
|
|
3042
|
+
currentPageRows: R,
|
|
3043
|
+
selectedRows: me,
|
|
3044
|
+
selectedKeys: Array.from(Ae),
|
|
3045
|
+
totalRecords: C,
|
|
3046
|
+
columns: c,
|
|
3047
|
+
defaultExport: (q, I) => {
|
|
3048
|
+
const ye = I || ee;
|
|
3049
|
+
M === "json" ? oe(q, ye) : ne(q, c, ye);
|
|
3050
|
+
}
|
|
3051
|
+
};
|
|
3052
|
+
await K.onExport(M, te);
|
|
3053
|
+
} finally {
|
|
3054
|
+
xe(!1);
|
|
3055
|
+
}
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
if (be === "selected" && me.length > 0) {
|
|
3059
|
+
M === "json" ? oe(me, ee) : ne(me, c, ee);
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
if (be === "current-page") {
|
|
3063
|
+
M === "json" ? oe(R, ee) : ne(R, c, ee);
|
|
3064
|
+
return;
|
|
3065
|
+
}
|
|
3066
|
+
if (!Ne) {
|
|
3067
|
+
const te = V && V.length > 0 ? V : R;
|
|
3068
|
+
M === "json" ? oe(te, ee) : ne(te, c, ee);
|
|
3069
|
+
return;
|
|
3070
|
+
}
|
|
3071
|
+
if (K.fetchAllRows) {
|
|
3072
|
+
xe(!0);
|
|
3073
|
+
try {
|
|
3074
|
+
let te = [];
|
|
3075
|
+
if (typeof K.fetchAllRows == "function") {
|
|
3076
|
+
const q = n?.paramNames || {}, I = q.pageParam || "page", ye = q.pageSizeParam || "limit", je = q.searchParam || "q", Ce = q.sortByParam || "sortBy", Te = q.sortOrderParam || "sortOrder", Re = {
|
|
3077
|
+
[I]: 1,
|
|
3078
|
+
[ye]: C || 999999,
|
|
3079
|
+
page: 1,
|
|
3080
|
+
pageSize: C || 999999,
|
|
3081
|
+
...b ? { [je]: b, search: b, q: b } : {},
|
|
3082
|
+
...k ? { [Ce]: k, sortBy: k } : {},
|
|
3083
|
+
...h ? { [Te]: h, sortOrder: h } : {},
|
|
3084
|
+
...n?.params || {},
|
|
3085
|
+
all: !0
|
|
3086
|
+
};
|
|
3087
|
+
te = await K.fetchAllRows(Re);
|
|
3088
|
+
} else if (K.fetchAllRows === !0 && n?.fetcher) {
|
|
3089
|
+
const q = n.paramNames || {}, I = q.pageParam || "page", ye = q.pageSizeParam || "limit", je = q.searchParam || "q", Ce = q.sortByParam || "sortBy", Te = q.sortOrderParam || "sortOrder", Re = {
|
|
3090
|
+
[I]: 1,
|
|
3091
|
+
[ye]: C || 999999,
|
|
3092
|
+
page: 1,
|
|
3093
|
+
pageSize: C || 999999,
|
|
3094
|
+
...b ? { [je]: b, search: b, q: b } : {},
|
|
3095
|
+
...k ? { [Ce]: k, sortBy: k } : {},
|
|
3096
|
+
...h ? { [Te]: h, sortOrder: h } : {},
|
|
3097
|
+
...n.params || {},
|
|
3098
|
+
all: !0
|
|
3099
|
+
}, ut = await n.fetcher(Re);
|
|
3100
|
+
te = wt(ut, n, Re).data;
|
|
3101
|
+
}
|
|
3102
|
+
M === "json" ? oe(te, ee) : ne(te, c, ee);
|
|
3103
|
+
} finally {
|
|
3104
|
+
xe(!1);
|
|
3105
|
+
}
|
|
3106
|
+
return;
|
|
3107
|
+
}
|
|
3108
|
+
console.warn(
|
|
3109
|
+
"AnyTable: Exporting current page only. For server-side pagination, configure 'exportable.fetchAllRows' or 'exportable.onExport' to fetch all filtered records."
|
|
3110
|
+
), M === "json" ? oe(R, ee) : ne(R, c, ee);
|
|
3111
|
+
},
|
|
3112
|
+
[
|
|
3113
|
+
p,
|
|
3114
|
+
Ne,
|
|
3115
|
+
b,
|
|
3116
|
+
k,
|
|
3117
|
+
h,
|
|
3118
|
+
n,
|
|
3119
|
+
R,
|
|
3120
|
+
V,
|
|
3121
|
+
me,
|
|
3122
|
+
Ae,
|
|
3123
|
+
C,
|
|
3124
|
+
c
|
|
3125
|
+
]
|
|
3126
|
+
), pe = B(() => {
|
|
3127
|
+
Se(), E(), F(), Pe();
|
|
3128
|
+
}, [Se, E, F, Pe]);
|
|
3129
|
+
return {
|
|
3130
|
+
rows: R,
|
|
3131
|
+
columns: c,
|
|
3132
|
+
totalRecords: C,
|
|
3133
|
+
loading: J,
|
|
3134
|
+
error: se,
|
|
3135
|
+
isServerMode: Ne,
|
|
3136
|
+
isExporting: qe,
|
|
3137
|
+
refresh: ce,
|
|
3138
|
+
reset: pe,
|
|
3139
|
+
search: {
|
|
3140
|
+
enabled: f,
|
|
3141
|
+
query: b,
|
|
3142
|
+
isDebouncing: z,
|
|
3143
|
+
setSearch: W,
|
|
3144
|
+
clearSearch: E,
|
|
3145
|
+
placeholder: y.placeholder
|
|
3146
|
+
},
|
|
3147
|
+
sorting: {
|
|
3148
|
+
enabled: x,
|
|
3149
|
+
sortBy: k,
|
|
3150
|
+
sortOrder: h,
|
|
3151
|
+
toggleSort: j,
|
|
3152
|
+
setSorting: v,
|
|
3153
|
+
resetSorting: F
|
|
3154
|
+
},
|
|
3155
|
+
pagination: {
|
|
3156
|
+
enabled: Oe,
|
|
3157
|
+
page: Fe,
|
|
3158
|
+
pageSize: He,
|
|
3159
|
+
totalPages: lt,
|
|
3160
|
+
pageSizeOptions: it,
|
|
3161
|
+
setPage: dt,
|
|
3162
|
+
setPageSize: ct,
|
|
3163
|
+
resetPagination: Se,
|
|
3164
|
+
getPageWindow: Ke
|
|
3165
|
+
},
|
|
3166
|
+
selection: {
|
|
3167
|
+
selectedKeys: Ae,
|
|
3168
|
+
selectedRows: me,
|
|
3169
|
+
toggleSelectRow: Ie,
|
|
3170
|
+
toggleSelectAll: Ue,
|
|
3171
|
+
clearSelection: Pe,
|
|
3172
|
+
allSelected: Ve,
|
|
3173
|
+
isIndeterminate: Je
|
|
3174
|
+
},
|
|
3175
|
+
exportData: _
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
2295
3178
|
export {
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
3179
|
+
ba as ActionRenderer,
|
|
3180
|
+
Sa as AnyTable,
|
|
3181
|
+
Lt as AnyTableInner,
|
|
3182
|
+
qr as AnyTableThemeProvider,
|
|
3183
|
+
sa as ArrayRenderer,
|
|
3184
|
+
ga as BadgeRenderer,
|
|
3185
|
+
ta as BooleanRenderer,
|
|
3186
|
+
fa as CellRenderer,
|
|
3187
|
+
pa as ConfirmModal,
|
|
3188
|
+
ra as CurrencyRenderer,
|
|
3189
|
+
Vt as DEFAULT_THEME_COLORS,
|
|
3190
|
+
jt as DateRenderer,
|
|
3191
|
+
da as EmailRenderer,
|
|
3192
|
+
Q as FallbackPlaceholder,
|
|
3193
|
+
aa as ImageRenderer,
|
|
3194
|
+
ea as NumberRenderer,
|
|
3195
|
+
la as ObjectRenderer,
|
|
3196
|
+
ca as PhoneRenderer,
|
|
3197
|
+
ua as ProgressRenderer,
|
|
3198
|
+
ma as RatingRenderer,
|
|
3199
|
+
oa as StatusRenderer,
|
|
3200
|
+
qt as StringRenderer,
|
|
3201
|
+
zt as TABLE_PRESETS,
|
|
3202
|
+
ya as TableBody,
|
|
3203
|
+
ka as TableEmptyState,
|
|
3204
|
+
wa as TableErrorState,
|
|
3205
|
+
Qr as TableHeader,
|
|
3206
|
+
xa as TablePagination,
|
|
3207
|
+
Yr as TableSearch,
|
|
3208
|
+
ha as TableSkeleton,
|
|
3209
|
+
Zr as TableToolbar,
|
|
3210
|
+
ia as UrlRenderer,
|
|
3211
|
+
Gr as arMessages,
|
|
3212
|
+
Hr as computePinnedStyles,
|
|
3213
|
+
Sa as default,
|
|
3214
|
+
Jt as defaultAnyTableTheme,
|
|
3215
|
+
Ee as enMessages,
|
|
3216
|
+
xt as escapeCsvValue,
|
|
3217
|
+
ne as exportToCsv,
|
|
3218
|
+
oe as exportToJson,
|
|
3219
|
+
We as extractPaginationMeta,
|
|
3220
|
+
Ir as filterRowsBySearch,
|
|
3221
|
+
Or as generateAutoColumns,
|
|
3222
|
+
va as generateCsvContent,
|
|
3223
|
+
L as getNestedValue,
|
|
3224
|
+
st as inferColumnType,
|
|
3225
|
+
Bt as isImageUrl,
|
|
3226
|
+
Wr as isIsoDate,
|
|
3227
|
+
Cr as isPlainObject,
|
|
3228
|
+
wt as normalizeApiResponse,
|
|
3229
|
+
yt as parsePixelWidth,
|
|
3230
|
+
Yt as renderActionIcon,
|
|
3231
|
+
Ot as resolveColumns,
|
|
3232
|
+
Xr as resolveMessages,
|
|
3233
|
+
Kr as resolveTableActions,
|
|
3234
|
+
Ur as sortRows,
|
|
3235
|
+
ot as toTitleCase,
|
|
3236
|
+
Gt as triggerDownload,
|
|
3237
|
+
Aa as useAnyTable,
|
|
3238
|
+
Vr as useAnyTableController,
|
|
3239
|
+
It as useAnyTableData,
|
|
3240
|
+
Kt as useAnyTablePagination,
|
|
3241
|
+
Ft as useAnyTableSearch,
|
|
3242
|
+
Ut as useAnyTableSelection,
|
|
3243
|
+
Ht as useAnyTableSorting,
|
|
3244
|
+
_e as useAnyTableTheme,
|
|
3245
|
+
Jr as useAnyTableVirtualizer
|
|
2352
3246
|
};
|
|
2353
3247
|
//# sourceMappingURL=index.js.map
|