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