@kareemelbalshe/any-table 1.0.0 → 1.0.2
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/README.md +751 -33
- package/dist/components/TableBody.d.ts +1 -0
- package/dist/components/TableHeader.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1166 -943
- package/dist/index.js.map +1 -1
- package/dist/renderers/ActionRenderer.d.ts +9 -0
- package/dist/renderers/DefaultRenderers.d.ts +12 -0
- package/dist/style.css +1 -1
- package/dist/theme/defaultTheme.d.ts +1 -0
- package/dist/theme/themeContext.d.ts +2 -1
- package/dist/types/column.types.d.ts +1 -1
- package/dist/types/table.types.d.ts +13 -1
- package/dist/types/theme.types.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
if (e == null) return
|
|
1
|
+
import { jsx as a, jsxs as y, Fragment as Ce } from "react/jsx-runtime";
|
|
2
|
+
import Xe, { useMemo as W, useState as S, useEffect as fe, useCallback as A, useRef as $t, useImperativeHandle as Dt, createContext as Mt, useContext as Qe } from "react";
|
|
3
|
+
function P(e, t, s = void 0) {
|
|
4
|
+
if (e == null) return s;
|
|
5
5
|
if (!t || typeof t != "string") return e;
|
|
6
6
|
if (t in e && e[t] !== void 0)
|
|
7
7
|
return e[t];
|
|
8
8
|
const l = t.replace(/\[(\w+)\]/g, ".$1").split(".");
|
|
9
|
-
let
|
|
9
|
+
let r = e;
|
|
10
10
|
for (let i = 0; i < l.length; i++) {
|
|
11
11
|
const g = l[i];
|
|
12
|
-
if (
|
|
13
|
-
return
|
|
14
|
-
|
|
12
|
+
if (r == null)
|
|
13
|
+
return s;
|
|
14
|
+
r = r[g];
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return r !== void 0 ? r : s;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _t(e) {
|
|
19
19
|
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function ue(e) {
|
|
22
22
|
if (!e || typeof e != "string") return "";
|
|
23
23
|
let t = e.replace(/[._\-]+/g, " ");
|
|
24
|
-
return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((
|
|
25
|
-
const o =
|
|
26
|
-
return
|
|
24
|
+
return t = t.replace(/([a-z])([A-Z])/g, "$1 $2"), t.split(" ").filter(Boolean).map((s) => {
|
|
25
|
+
const o = s.toLowerCase();
|
|
26
|
+
return s.length <= 3 && s === s.toUpperCase() ? s : o.charAt(0).toUpperCase() + o.slice(1);
|
|
27
27
|
}).join(" ");
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const jt = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp", ".avif"], Ft = ["image", "avatar", "photo", "logo", "picture", "thumbnail", "banner", "img", "icon"], Wt = ["price", "spend", "cost", "amount", "total", "fee", "rate", "salary", "balance", "deposit", "commission", "charge"], Rt = ["status", "state", "phase", "condition"];
|
|
30
30
|
function be(e, t) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
31
|
+
const s = e.toLowerCase();
|
|
32
|
+
if (Ft.some((r) => s.includes(r)))
|
|
33
33
|
return "image";
|
|
34
|
-
if (
|
|
34
|
+
if (Wt.some((r) => s.includes(r)))
|
|
35
35
|
return "currency";
|
|
36
|
-
if (
|
|
36
|
+
if (Rt.some((r) => s.includes(r)))
|
|
37
37
|
return "status";
|
|
38
|
-
const o = t.filter((
|
|
38
|
+
const o = t.filter((r) => r != null && r !== "");
|
|
39
39
|
if (o.length === 0)
|
|
40
40
|
return "string";
|
|
41
41
|
const l = o[0];
|
|
42
|
-
if (typeof l == "boolean" ||
|
|
42
|
+
if (typeof l == "boolean" || s.startsWith("is") || s.startsWith("has"))
|
|
43
43
|
return "boolean";
|
|
44
44
|
if (Array.isArray(l))
|
|
45
45
|
return "array";
|
|
46
46
|
if (typeof l == "object")
|
|
47
|
-
return l.url && typeof l.url == "string" &&
|
|
47
|
+
return l.url && typeof l.url == "string" && Ie(l.url) ? "image" : "object";
|
|
48
48
|
if (typeof l == "number")
|
|
49
49
|
return "number";
|
|
50
50
|
if (typeof l == "string") {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
51
|
+
const r = l.trim();
|
|
52
|
+
if (Ie(r))
|
|
53
53
|
return "image";
|
|
54
|
-
if ((
|
|
55
|
-
return
|
|
56
|
-
if (
|
|
54
|
+
if ((zt(r) || s.includes("date") || s.includes("at") || s.includes("time")) && !isNaN(Date.parse(r)))
|
|
55
|
+
return r.includes("T") || r.includes(":") ? "datetime" : "date";
|
|
56
|
+
if (r.includes("@") && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r))
|
|
57
57
|
return "email";
|
|
58
|
-
if (
|
|
58
|
+
if (r.startsWith("http://") || r.startsWith("https://"))
|
|
59
59
|
return "url";
|
|
60
|
-
if (
|
|
60
|
+
if (s.includes("phone") || s.includes("mobile") || s.includes("tel"))
|
|
61
61
|
return "phone";
|
|
62
62
|
}
|
|
63
63
|
return "string";
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Ie(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 jt.some((s) => t.endsWith(s));
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function zt(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 Lt = ["__v", "password", "token", "refreshToken", "secret", "hash", "salt"];
|
|
75
|
+
function Ot(e, t = Lt, s = 2) {
|
|
76
76
|
if (!e || !e.length)
|
|
77
77
|
return [];
|
|
78
78
|
const o = /* @__PURE__ */ new Map(), l = e.slice(0, 10);
|
|
79
|
-
for (const
|
|
80
|
-
!
|
|
79
|
+
for (const r of l)
|
|
80
|
+
!r || typeof r != "object" || et(r, "", o, l, t, 0, s);
|
|
81
81
|
return Array.from(o.values());
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
if (!(!e || typeof e != "object" ||
|
|
83
|
+
function et(e, t, s, o, l, r, i) {
|
|
84
|
+
if (!(!e || typeof e != "object" || r > i))
|
|
85
85
|
for (const g of Object.keys(e)) {
|
|
86
86
|
if (l.includes(g)) continue;
|
|
87
87
|
const c = t ? `${t}.${g}` : g, d = e[g];
|
|
88
|
-
if (
|
|
89
|
-
|
|
88
|
+
if (_t(d) && !Ht(d) && r < i) {
|
|
89
|
+
et(d, c, s, o, l, r + 1, i);
|
|
90
90
|
continue;
|
|
91
91
|
}
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
|
|
92
|
+
if (!s.has(c)) {
|
|
93
|
+
const n = o.map((m) => P(m, c)), u = be(c, n);
|
|
94
|
+
s.set(c, {
|
|
95
95
|
key: c,
|
|
96
|
-
title:
|
|
97
|
-
type:
|
|
96
|
+
title: ue(c),
|
|
97
|
+
type: u,
|
|
98
98
|
sortable: !0,
|
|
99
99
|
searchable: !0,
|
|
100
|
-
align:
|
|
100
|
+
align: u === "number" || u === "currency" ? "right" : "left"
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Ht(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
|
|
109
|
-
const { data: t = [], columns:
|
|
110
|
-
return
|
|
111
|
-
const c = l && l[g] ? l[g] :
|
|
108
|
+
function Ut(e) {
|
|
109
|
+
const { data: t = [], columns: s, autoColumns: o = !0, thead: l, headerData: r } = e;
|
|
110
|
+
return r && Array.isArray(r) && r.length > 0 ? r.map((i, g) => {
|
|
111
|
+
const c = l && l[g] ? l[g] : ue(i), d = t.map((u) => u?.[i]), n = be(i, d);
|
|
112
112
|
return {
|
|
113
113
|
key: i,
|
|
114
114
|
title: c,
|
|
115
|
-
type:
|
|
115
|
+
type: n,
|
|
116
116
|
sortable: !0,
|
|
117
117
|
searchable: !0,
|
|
118
|
-
align:
|
|
118
|
+
align: n === "number" || n === "currency" ? "right" : "left"
|
|
119
119
|
};
|
|
120
|
-
}) :
|
|
120
|
+
}) : s && Array.isArray(s) && s.length > 0 ? s.map((i) => {
|
|
121
121
|
if (typeof i == "string") {
|
|
122
|
-
const
|
|
122
|
+
const n = t.map((m) => m?.[i]), u = be(i, n);
|
|
123
123
|
return {
|
|
124
124
|
key: i,
|
|
125
|
-
title:
|
|
126
|
-
type:
|
|
125
|
+
title: ue(i),
|
|
126
|
+
type: u,
|
|
127
127
|
sortable: !0,
|
|
128
128
|
searchable: !0,
|
|
129
|
-
align:
|
|
129
|
+
align: u === "number" || u === "currency" ? "right" : "left"
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
const g = String(i.key), c = i.title !== void 0 ? i.title :
|
|
132
|
+
const g = String(i.key), c = i.title !== void 0 ? i.title : ue(g), d = i.type || be(g, t.map((n) => n?.[g]));
|
|
133
133
|
return {
|
|
134
134
|
...i,
|
|
135
135
|
title: c,
|
|
@@ -138,140 +138,140 @@ function jt(e) {
|
|
|
138
138
|
searchable: i.searchable !== void 0 ? i.searchable : !0,
|
|
139
139
|
align: i.align || (d === "number" || d === "currency" ? "right" : "left")
|
|
140
140
|
};
|
|
141
|
-
}) : o && t && t.length > 0 ?
|
|
141
|
+
}) : o && t && t.length > 0 ? Ot(t) : [];
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Kt({
|
|
144
144
|
config: e,
|
|
145
145
|
onSearchChange: t
|
|
146
146
|
}) {
|
|
147
|
-
const
|
|
148
|
-
|
|
147
|
+
const s = W(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), o = s.enabled !== !1 && !!e, l = s.debounce ?? 350, [r, i] = S(""), [g, c] = S(""), [d, n] = S(!1);
|
|
148
|
+
fe(() => {
|
|
149
149
|
if (!o) return;
|
|
150
|
-
if (
|
|
151
|
-
c(""),
|
|
150
|
+
if (r === "") {
|
|
151
|
+
c(""), n(!1), t?.("");
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
c(
|
|
154
|
+
n(!0);
|
|
155
|
+
const b = setTimeout(() => {
|
|
156
|
+
c(r), n(!1), t?.(r);
|
|
157
157
|
}, l);
|
|
158
158
|
return () => {
|
|
159
|
-
clearTimeout(
|
|
159
|
+
clearTimeout(b);
|
|
160
160
|
};
|
|
161
|
-
}, [
|
|
162
|
-
const
|
|
163
|
-
i(
|
|
164
|
-
}, []),
|
|
165
|
-
i(""), c(""),
|
|
161
|
+
}, [r, l, o, t]);
|
|
162
|
+
const u = A((b) => {
|
|
163
|
+
i(b);
|
|
164
|
+
}, []), m = A(() => {
|
|
165
|
+
i(""), c(""), n(!1), t?.("");
|
|
166
166
|
}, [t]);
|
|
167
167
|
return {
|
|
168
168
|
enabled: o,
|
|
169
|
-
search:
|
|
169
|
+
search: r,
|
|
170
170
|
debouncedSearch: g,
|
|
171
171
|
isDebouncing: d,
|
|
172
|
-
setSearch:
|
|
173
|
-
clearSearch:
|
|
174
|
-
searchConfig:
|
|
172
|
+
setSearch: u,
|
|
173
|
+
clearSearch: m,
|
|
174
|
+
searchConfig: s
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function It({
|
|
178
178
|
config: e,
|
|
179
179
|
onSortChange: t
|
|
180
180
|
}) {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
), [g, c] =
|
|
184
|
-
|
|
185
|
-
), d =
|
|
186
|
-
(
|
|
181
|
+
const s = W(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), o = s.enabled !== !1 && !!e, l = s.allowUnsort ?? !0, [r, i] = S(
|
|
182
|
+
s.defaultSortBy || null
|
|
183
|
+
), [g, c] = S(
|
|
184
|
+
s.defaultSortOrder || null
|
|
185
|
+
), d = A(
|
|
186
|
+
(m) => {
|
|
187
187
|
if (o) {
|
|
188
|
-
if (
|
|
189
|
-
i(
|
|
188
|
+
if (r !== m) {
|
|
189
|
+
i(m), c("asc"), t?.(m, "asc");
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
g === "asc" ? (c("desc"), t?.(
|
|
192
|
+
g === "asc" ? (c("desc"), t?.(m, "desc")) : g === "desc" && l ? (i(null), c(null), t?.(null, null)) : (c("asc"), t?.(m, "asc"));
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
[o,
|
|
196
|
-
),
|
|
197
|
-
(
|
|
198
|
-
i(
|
|
195
|
+
[o, r, g, l, t]
|
|
196
|
+
), n = A(
|
|
197
|
+
(m, b) => {
|
|
198
|
+
i(m), c(b), t?.(m, b);
|
|
199
199
|
},
|
|
200
200
|
[t]
|
|
201
|
-
),
|
|
201
|
+
), u = A(() => {
|
|
202
202
|
i(null), c(null), t?.(null, null);
|
|
203
203
|
}, [t]);
|
|
204
204
|
return {
|
|
205
205
|
enabled: o,
|
|
206
|
-
sortBy:
|
|
206
|
+
sortBy: r,
|
|
207
207
|
sortOrder: g,
|
|
208
208
|
toggleSort: d,
|
|
209
|
-
setSorting:
|
|
210
|
-
resetSorting:
|
|
211
|
-
sortingConfig:
|
|
209
|
+
setSorting: n,
|
|
210
|
+
resetSorting: u,
|
|
211
|
+
sortingConfig: s
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Gt({
|
|
215
215
|
config: e,
|
|
216
216
|
totalRecords: t,
|
|
217
|
-
onPageChange:
|
|
217
|
+
onPageChange: s
|
|
218
218
|
}) {
|
|
219
|
-
const o =
|
|
219
|
+
const o = W(() => typeof e == "object" && e !== null ? e : { enabled: !!e }, [e]), l = o.enabled !== !1 && !!e, r = o.defaultPage || 1, i = o.defaultPageSize || 10, g = o.pageSizeOptions || [5, 10, 20, 50, 100], [c, d] = S(r), [n, u] = S(i), m = Math.max(1, Math.ceil(t / Math.max(1, n))), b = A(
|
|
220
220
|
(N) => {
|
|
221
|
-
const
|
|
222
|
-
d(
|
|
221
|
+
const w = Math.max(1, Math.min(N, m));
|
|
222
|
+
d(w), s?.(w, n);
|
|
223
223
|
},
|
|
224
|
-
[
|
|
225
|
-
),
|
|
224
|
+
[m, n, s]
|
|
225
|
+
), f = A(
|
|
226
226
|
(N) => {
|
|
227
|
-
|
|
227
|
+
u(N), d(1), s?.(1, N);
|
|
228
228
|
},
|
|
229
|
-
[
|
|
230
|
-
), k =
|
|
231
|
-
c <
|
|
232
|
-
}, [c,
|
|
233
|
-
c > 1 &&
|
|
234
|
-
}, [c,
|
|
235
|
-
d(1),
|
|
236
|
-
}, [i,
|
|
229
|
+
[s]
|
|
230
|
+
), k = A(() => {
|
|
231
|
+
c < m && b(c + 1);
|
|
232
|
+
}, [c, m, b]), C = A(() => {
|
|
233
|
+
c > 1 && b(c - 1);
|
|
234
|
+
}, [c, b]), D = A(() => {
|
|
235
|
+
d(1), u(i), s?.(1, i);
|
|
236
|
+
}, [i, s]), _ = A(
|
|
237
237
|
(N = 5) => {
|
|
238
|
-
const
|
|
238
|
+
const w = Math.max(
|
|
239
239
|
1,
|
|
240
|
-
Math.min(c - Math.floor(N / 2),
|
|
241
|
-
),
|
|
242
|
-
for (let
|
|
243
|
-
H.push(
|
|
240
|
+
Math.min(c - Math.floor(N / 2), m - N + 1)
|
|
241
|
+
), R = Math.min(m, w + N - 1), H = [];
|
|
242
|
+
for (let L = w; L <= R; L++)
|
|
243
|
+
H.push(L);
|
|
244
244
|
return H;
|
|
245
245
|
},
|
|
246
|
-
[c,
|
|
247
|
-
),
|
|
246
|
+
[c, m]
|
|
247
|
+
), x = A(
|
|
248
248
|
(N) => {
|
|
249
249
|
if (!l) return N;
|
|
250
|
-
const
|
|
251
|
-
return N.slice(
|
|
250
|
+
const w = (c - 1) * n;
|
|
251
|
+
return N.slice(w, w + n);
|
|
252
252
|
},
|
|
253
|
-
[l, c,
|
|
253
|
+
[l, c, n]
|
|
254
254
|
);
|
|
255
255
|
return {
|
|
256
256
|
enabled: l,
|
|
257
257
|
page: c,
|
|
258
|
-
pageSize:
|
|
258
|
+
pageSize: n,
|
|
259
259
|
totalRecords: t,
|
|
260
|
-
totalPages:
|
|
260
|
+
totalPages: m,
|
|
261
261
|
pageSizeOptions: g,
|
|
262
|
-
hasNextPage: c <
|
|
262
|
+
hasNextPage: c < m,
|
|
263
263
|
hasPrevPage: c > 1,
|
|
264
|
-
setPage:
|
|
265
|
-
setPageSize:
|
|
264
|
+
setPage: b,
|
|
265
|
+
setPageSize: f,
|
|
266
266
|
nextPage: k,
|
|
267
|
-
prevPage:
|
|
268
|
-
resetPagination:
|
|
269
|
-
getPageWindow:
|
|
270
|
-
sliceData:
|
|
267
|
+
prevPage: C,
|
|
268
|
+
resetPagination: D,
|
|
269
|
+
getPageWindow: _,
|
|
270
|
+
sliceData: x,
|
|
271
271
|
paginationConfig: o
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
-
const
|
|
274
|
+
const Vt = [
|
|
275
275
|
"total",
|
|
276
276
|
"totalCount",
|
|
277
277
|
"count",
|
|
@@ -287,7 +287,7 @@ const Wt = [
|
|
|
287
287
|
"pageInfo.total",
|
|
288
288
|
"pageInfo.totalCount",
|
|
289
289
|
"paging.total"
|
|
290
|
-
],
|
|
290
|
+
], Yt = [
|
|
291
291
|
"page",
|
|
292
292
|
"currentPage",
|
|
293
293
|
"pageNumber",
|
|
@@ -297,7 +297,7 @@ const Wt = [
|
|
|
297
297
|
"pagination.page",
|
|
298
298
|
"pagination.currentPage",
|
|
299
299
|
"pageInfo.page"
|
|
300
|
-
],
|
|
300
|
+
], Zt = [
|
|
301
301
|
"pageSize",
|
|
302
302
|
"limit",
|
|
303
303
|
"perPage",
|
|
@@ -308,7 +308,7 @@ const Wt = [
|
|
|
308
308
|
"pagination.pageSize",
|
|
309
309
|
"pagination.limit",
|
|
310
310
|
"pagination.perPage"
|
|
311
|
-
],
|
|
311
|
+
], Jt = [
|
|
312
312
|
"totalPages",
|
|
313
313
|
"pageCount",
|
|
314
314
|
"lastPage",
|
|
@@ -319,11 +319,11 @@ const Wt = [
|
|
|
319
319
|
"pagination.totalPages",
|
|
320
320
|
"pagination.lastPage"
|
|
321
321
|
];
|
|
322
|
-
function
|
|
322
|
+
function Q(e, t, s = 1, o = 10, l) {
|
|
323
323
|
if (!e || typeof e != "object") {
|
|
324
324
|
const d = l !== void 0 ? l : 0;
|
|
325
325
|
return {
|
|
326
|
-
page:
|
|
326
|
+
page: s,
|
|
327
327
|
pageSize: o,
|
|
328
328
|
total: d,
|
|
329
329
|
totalPages: Math.max(1, Math.ceil(d / Math.max(1, o))),
|
|
@@ -331,75 +331,75 @@ function X(e, t, n = 1, o = 10, l) {
|
|
|
331
331
|
hasPrevPage: !1
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
let
|
|
334
|
+
let r;
|
|
335
335
|
if (t?.totalPath) {
|
|
336
|
-
const d =
|
|
337
|
-
typeof d == "number" ?
|
|
336
|
+
const d = P(e, t.totalPath);
|
|
337
|
+
typeof d == "number" ? r = d : typeof d == "string" && !isNaN(Number(d)) && (r = Number(d));
|
|
338
338
|
}
|
|
339
|
-
if (
|
|
340
|
-
for (const d of
|
|
341
|
-
const
|
|
342
|
-
if (typeof
|
|
343
|
-
|
|
339
|
+
if (r === void 0)
|
|
340
|
+
for (const d of Vt) {
|
|
341
|
+
const n = P(e, d);
|
|
342
|
+
if (typeof n == "number" && !isNaN(n)) {
|
|
343
|
+
r = n;
|
|
344
344
|
break;
|
|
345
345
|
}
|
|
346
|
-
if (typeof
|
|
347
|
-
|
|
346
|
+
if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
|
|
347
|
+
r = Number(n);
|
|
348
348
|
break;
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
r === void 0 && (r = l !== void 0 ? l : 0);
|
|
352
352
|
let i;
|
|
353
353
|
if (t?.pagePath) {
|
|
354
|
-
const d =
|
|
354
|
+
const d = P(e, t.pagePath);
|
|
355
355
|
typeof d == "number" ? i = d : typeof d == "string" && !isNaN(Number(d)) && (i = Number(d));
|
|
356
356
|
}
|
|
357
357
|
if (i === void 0)
|
|
358
|
-
for (const d of
|
|
359
|
-
const
|
|
360
|
-
if (typeof
|
|
361
|
-
i =
|
|
358
|
+
for (const d of Yt) {
|
|
359
|
+
const n = P(e, d);
|
|
360
|
+
if (typeof n == "number" && !isNaN(n)) {
|
|
361
|
+
i = n;
|
|
362
362
|
break;
|
|
363
363
|
}
|
|
364
|
-
if (typeof
|
|
365
|
-
i = Number(
|
|
364
|
+
if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
|
|
365
|
+
i = Number(n);
|
|
366
366
|
break;
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
i === void 0 && (i =
|
|
369
|
+
i === void 0 && (i = s);
|
|
370
370
|
let g;
|
|
371
371
|
if (t?.pageSizePath) {
|
|
372
|
-
const d =
|
|
372
|
+
const d = P(e, t.pageSizePath);
|
|
373
373
|
typeof d == "number" ? g = d : typeof d == "string" && !isNaN(Number(d)) && (g = Number(d));
|
|
374
374
|
}
|
|
375
375
|
if (g === void 0)
|
|
376
|
-
for (const d of
|
|
377
|
-
const
|
|
378
|
-
if (typeof
|
|
379
|
-
g =
|
|
376
|
+
for (const d of Zt) {
|
|
377
|
+
const n = P(e, d);
|
|
378
|
+
if (typeof n == "number" && !isNaN(n)) {
|
|
379
|
+
g = n;
|
|
380
380
|
break;
|
|
381
381
|
}
|
|
382
|
-
if (typeof
|
|
383
|
-
g = Number(
|
|
382
|
+
if (typeof n == "string" && n.trim() !== "" && !isNaN(Number(n))) {
|
|
383
|
+
g = Number(n);
|
|
384
384
|
break;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
g === void 0 && (g = o);
|
|
388
388
|
let c;
|
|
389
389
|
if (t?.totalPagesPath) {
|
|
390
|
-
const d =
|
|
390
|
+
const d = P(e, t.totalPagesPath);
|
|
391
391
|
typeof d == "number" ? c = d : typeof d == "string" && !isNaN(Number(d)) && (c = Number(d));
|
|
392
392
|
}
|
|
393
393
|
if (c === void 0)
|
|
394
|
-
for (const d of
|
|
395
|
-
const
|
|
396
|
-
if (typeof
|
|
397
|
-
c =
|
|
394
|
+
for (const d of Jt) {
|
|
395
|
+
const n = P(e, d);
|
|
396
|
+
if (typeof n == "number" && !isNaN(n)) {
|
|
397
|
+
c = n;
|
|
398
398
|
break;
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
return (c === void 0 || c <= 0) && (c = Math.max(1, Math.ceil(
|
|
402
|
-
total:
|
|
401
|
+
return (c === void 0 || c <= 0) && (c = Math.max(1, Math.ceil(r / Math.max(1, g)))), {
|
|
402
|
+
total: r,
|
|
403
403
|
page: i,
|
|
404
404
|
pageSize: g,
|
|
405
405
|
totalPages: c,
|
|
@@ -407,7 +407,7 @@ function X(e, t, n = 1, o = 10, l) {
|
|
|
407
407
|
hasPrevPage: i > 1
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
const
|
|
410
|
+
const qt = [
|
|
411
411
|
"data",
|
|
412
412
|
"items",
|
|
413
413
|
"results",
|
|
@@ -428,23 +428,23 @@ const Rt = [
|
|
|
428
428
|
"subscriptions",
|
|
429
429
|
"deadLetters.items"
|
|
430
430
|
];
|
|
431
|
-
function
|
|
432
|
-
const o =
|
|
431
|
+
function Xt(e, t, s) {
|
|
432
|
+
const o = s?.page || 1, l = s?.pageSize || 10;
|
|
433
433
|
if (t?.transformResponse && typeof t.transformResponse == "function") {
|
|
434
|
-
const
|
|
435
|
-
if (Array.isArray(
|
|
434
|
+
const r = t.transformResponse(e);
|
|
435
|
+
if (Array.isArray(r))
|
|
436
436
|
return {
|
|
437
|
-
data:
|
|
438
|
-
meta:
|
|
437
|
+
data: r,
|
|
438
|
+
meta: Q(e, t.response, o, l, r.length),
|
|
439
439
|
raw: e
|
|
440
440
|
};
|
|
441
|
-
if (
|
|
442
|
-
const i = Array.isArray(
|
|
443
|
-
total:
|
|
444
|
-
page:
|
|
445
|
-
pageSize:
|
|
446
|
-
totalPages:
|
|
447
|
-
} :
|
|
441
|
+
if (r && typeof r == "object") {
|
|
442
|
+
const i = Array.isArray(r.data) ? r.data : [], g = r.meta ? {
|
|
443
|
+
total: r.meta.total !== void 0 ? r.meta.total : i.length,
|
|
444
|
+
page: r.meta.page !== void 0 ? r.meta.page : o,
|
|
445
|
+
pageSize: r.meta.pageSize !== void 0 ? r.meta.pageSize : l,
|
|
446
|
+
totalPages: r.meta.totalPages !== void 0 ? r.meta.totalPages : Math.max(1, Math.ceil((r.meta.total || i.length) / (r.meta.pageSize || l)))
|
|
447
|
+
} : Q(e, t.response, o, l, i.length);
|
|
448
448
|
return { data: i, meta: g, raw: e };
|
|
449
449
|
}
|
|
450
450
|
}
|
|
@@ -462,14 +462,14 @@ function Ut(e, t, n) {
|
|
|
462
462
|
raw: e
|
|
463
463
|
};
|
|
464
464
|
if (t?.response?.dataPath) {
|
|
465
|
-
const
|
|
465
|
+
const r = P(e, t.response.dataPath), i = Array.isArray(r) ? r : [], g = Q(e, t.response, o, l, i.length);
|
|
466
466
|
return { data: i, meta: g, raw: e };
|
|
467
467
|
}
|
|
468
468
|
if (e && typeof e == "object") {
|
|
469
|
-
for (const
|
|
470
|
-
const i =
|
|
469
|
+
for (const r of qt) {
|
|
470
|
+
const i = P(e, r);
|
|
471
471
|
if (Array.isArray(i)) {
|
|
472
|
-
const g =
|
|
472
|
+
const g = Q(e, t?.response, o, l, i.length);
|
|
473
473
|
return {
|
|
474
474
|
data: i,
|
|
475
475
|
meta: g,
|
|
@@ -477,20 +477,20 @@ function Ut(e, t, n) {
|
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
for (const
|
|
481
|
-
if (Array.isArray(e[
|
|
482
|
-
const i =
|
|
480
|
+
for (const r in e)
|
|
481
|
+
if (Array.isArray(e[r])) {
|
|
482
|
+
const i = Q(e, t?.response, o, l, e[r].length);
|
|
483
483
|
return {
|
|
484
|
-
data: e[
|
|
484
|
+
data: e[r],
|
|
485
485
|
meta: i,
|
|
486
486
|
raw: e
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
if (Object.keys(e).length > 0 && !Array.isArray(e)) {
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
490
|
+
const r = e.user || e.order || e.item || e.data || e;
|
|
491
|
+
if (r && typeof r == "object" && !Array.isArray(r))
|
|
492
492
|
return {
|
|
493
|
-
data: [
|
|
493
|
+
data: [r],
|
|
494
494
|
meta: {
|
|
495
495
|
total: 1,
|
|
496
496
|
page: 1,
|
|
@@ -516,54 +516,54 @@ function Ut(e, t, n) {
|
|
|
516
516
|
raw: e
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Qt(e, t, s, o) {
|
|
520
520
|
if (!e || !e.length) return [];
|
|
521
521
|
if (!t || typeof t != "string" || !t.trim()) return e;
|
|
522
522
|
const l = t.trim().toLowerCase();
|
|
523
523
|
if (o && typeof o == "function")
|
|
524
524
|
return e.filter((i) => o(i, l));
|
|
525
|
-
const
|
|
525
|
+
const r = l.split(/\s+/).filter(Boolean);
|
|
526
526
|
return e.filter((i) => {
|
|
527
527
|
if (!i || typeof i != "object") return !1;
|
|
528
528
|
const g = [];
|
|
529
|
-
if (
|
|
530
|
-
for (const d of
|
|
531
|
-
const
|
|
532
|
-
|
|
529
|
+
if (s && s.length > 0)
|
|
530
|
+
for (const d of s) {
|
|
531
|
+
const n = P(i, d);
|
|
532
|
+
n != null && (typeof n == "object" ? g.push(JSON.stringify(n).toLowerCase()) : g.push(String(n).toLowerCase()));
|
|
533
533
|
}
|
|
534
534
|
else
|
|
535
|
-
|
|
535
|
+
Se(i, g);
|
|
536
536
|
const c = g.join(" ");
|
|
537
|
-
return
|
|
537
|
+
return r.every((d) => c.includes(d));
|
|
538
538
|
});
|
|
539
539
|
}
|
|
540
|
-
function
|
|
541
|
-
if (!(
|
|
540
|
+
function Se(e, t, s = 0) {
|
|
541
|
+
if (!(s > 4 || e === null || e === void 0)) {
|
|
542
542
|
if (typeof e != "object") {
|
|
543
543
|
t.push(String(e).toLowerCase());
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
546
|
if (Array.isArray(e)) {
|
|
547
547
|
for (const o of e)
|
|
548
|
-
|
|
548
|
+
Se(o, t, s + 1);
|
|
549
549
|
return;
|
|
550
550
|
}
|
|
551
551
|
for (const o in e)
|
|
552
552
|
if (Object.prototype.hasOwnProperty.call(e, o)) {
|
|
553
553
|
if (o.startsWith("__") || o.toLowerCase().includes("password")) continue;
|
|
554
|
-
|
|
554
|
+
Se(e[o], t, s + 1);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
function
|
|
559
|
-
if (!e || !e.length || !t || !
|
|
558
|
+
function er(e, t, s, o) {
|
|
559
|
+
if (!e || !e.length || !t || !s)
|
|
560
560
|
return e;
|
|
561
561
|
const l = [...e];
|
|
562
|
-
return o && typeof o == "function" ? (l.sort((
|
|
563
|
-
const g = o(
|
|
564
|
-
return
|
|
565
|
-
}), l) : (l.sort((
|
|
566
|
-
const g =
|
|
562
|
+
return o && typeof o == "function" ? (l.sort((r, i) => {
|
|
563
|
+
const g = o(r, i);
|
|
564
|
+
return s === "desc" ? -g : g;
|
|
565
|
+
}), l) : (l.sort((r, i) => {
|
|
566
|
+
const g = P(r, t), c = P(i, t);
|
|
567
567
|
if (g == null)
|
|
568
568
|
return c == null ? 0 : 1;
|
|
569
569
|
if (c == null)
|
|
@@ -575,153 +575,153 @@ function Gt(e, t, n, o) {
|
|
|
575
575
|
d = g === c ? 0 : g ? -1 : 1;
|
|
576
576
|
else if (g instanceof Date && c instanceof Date)
|
|
577
577
|
d = g.getTime() - c.getTime();
|
|
578
|
-
else if (typeof g == "string" && typeof c == "string" &&
|
|
578
|
+
else if (typeof g == "string" && typeof c == "string" && Ge(g) && Ge(c))
|
|
579
579
|
d = new Date(g).getTime() - new Date(c).getTime();
|
|
580
580
|
else {
|
|
581
|
-
const
|
|
582
|
-
d =
|
|
581
|
+
const n = String(g), u = String(c);
|
|
582
|
+
d = n.localeCompare(u, void 0, {
|
|
583
583
|
numeric: !0,
|
|
584
584
|
sensitivity: "base"
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
return
|
|
587
|
+
return s === "desc" ? -d : d;
|
|
588
588
|
}), l);
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function Ge(e) {
|
|
591
591
|
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);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function tr({
|
|
594
594
|
data: e,
|
|
595
595
|
api: t,
|
|
596
|
-
columns:
|
|
596
|
+
columns: s,
|
|
597
597
|
searchQuery: o,
|
|
598
598
|
sortBy: l,
|
|
599
|
-
sortOrder:
|
|
599
|
+
sortOrder: r,
|
|
600
600
|
page: i,
|
|
601
601
|
pageSize: g,
|
|
602
602
|
manualLoading: c
|
|
603
603
|
}) {
|
|
604
|
-
const d = !!(t && typeof t.fetcher == "function"),
|
|
604
|
+
const d = !!(t && typeof t.fetcher == "function"), n = d && t?.mode !== "client", [u, m] = S([]), [b, f] = S(0), [k, C] = S(!1), [D, _] = S(null), [x, N] = S(0), w = $t(null), R = A(async () => {
|
|
605
605
|
if (!d || !t?.fetcher) return;
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
const
|
|
610
|
-
[
|
|
611
|
-
[
|
|
606
|
+
w.current && w.current.abort();
|
|
607
|
+
const j = new AbortController();
|
|
608
|
+
w.current = j, C(!0), _(null);
|
|
609
|
+
const F = t.paramNames || {}, U = F.pageParam || "page", te = F.pageSizeParam || "limit", V = F.searchParam || "q", Y = F.sortByParam || "sortBy", K = F.sortOrderParam || "sortOrder", Z = {
|
|
610
|
+
[U]: i,
|
|
611
|
+
[te]: g,
|
|
612
612
|
page: i,
|
|
613
613
|
pageSize: g,
|
|
614
|
-
...o ? { [
|
|
614
|
+
...o ? { [V]: o, search: o, q: o } : {},
|
|
615
615
|
...l ? { [Y]: l, sortBy: l } : {},
|
|
616
|
-
...
|
|
616
|
+
...r ? { [K]: r, sortOrder: r } : {},
|
|
617
617
|
...t.params || {}
|
|
618
618
|
};
|
|
619
619
|
try {
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
const
|
|
623
|
-
|
|
620
|
+
const B = await t.fetcher(Z, j.signal);
|
|
621
|
+
if (j.signal.aborted) return;
|
|
622
|
+
const I = Xt(
|
|
623
|
+
B,
|
|
624
624
|
t,
|
|
625
|
-
|
|
625
|
+
Z
|
|
626
626
|
);
|
|
627
|
-
|
|
628
|
-
} catch (
|
|
629
|
-
if (
|
|
627
|
+
m(I.data), f(I.meta.total), t.onSuccess?.(I);
|
|
628
|
+
} catch (B) {
|
|
629
|
+
if (B?.name === "AbortError" || B?.name === "CanceledError")
|
|
630
630
|
return;
|
|
631
|
-
|
|
631
|
+
_(B), t.onError?.(B);
|
|
632
632
|
} finally {
|
|
633
|
-
|
|
633
|
+
j.signal.aborted || C(!1);
|
|
634
634
|
}
|
|
635
|
-
}, [d, t, i, g, o, l,
|
|
636
|
-
|
|
637
|
-
d &&
|
|
638
|
-
}, [
|
|
639
|
-
|
|
635
|
+
}, [d, t, i, g, o, l, r]);
|
|
636
|
+
fe(() => {
|
|
637
|
+
d && R();
|
|
638
|
+
}, [R, x]), fe(() => () => {
|
|
639
|
+
w.current && w.current.abort();
|
|
640
640
|
}, []);
|
|
641
|
-
const H =
|
|
642
|
-
d && N((
|
|
643
|
-
}, [d]), { displayRows:
|
|
644
|
-
if (
|
|
641
|
+
const H = A(async () => {
|
|
642
|
+
d && N((j) => j + 1);
|
|
643
|
+
}, [d]), { displayRows: L, finalTotal: ye } = W(() => {
|
|
644
|
+
if (n)
|
|
645
645
|
return {
|
|
646
|
-
displayRows:
|
|
647
|
-
finalTotal:
|
|
646
|
+
displayRows: u,
|
|
647
|
+
finalTotal: b
|
|
648
648
|
};
|
|
649
|
-
const
|
|
649
|
+
const j = d ? u : e || [], F = s.filter((B) => B.searchable !== !1).map((B) => B.key), U = Qt(j, o, F), V = s.find((B) => B.key === l)?.comparator, Y = er(U, l, r, V), K = (i - 1) * g;
|
|
650
650
|
return {
|
|
651
|
-
displayRows: Y.slice(
|
|
652
|
-
finalTotal:
|
|
651
|
+
displayRows: Y.slice(K, K + g),
|
|
652
|
+
finalTotal: U.length
|
|
653
653
|
};
|
|
654
654
|
}, [
|
|
655
|
-
|
|
655
|
+
n,
|
|
656
656
|
d,
|
|
657
|
-
|
|
657
|
+
u,
|
|
658
658
|
e,
|
|
659
|
-
|
|
660
|
-
|
|
659
|
+
b,
|
|
660
|
+
s,
|
|
661
661
|
o,
|
|
662
662
|
l,
|
|
663
|
-
|
|
663
|
+
r,
|
|
664
664
|
i,
|
|
665
665
|
g
|
|
666
666
|
]);
|
|
667
667
|
return {
|
|
668
|
-
rows:
|
|
669
|
-
totalRecords:
|
|
668
|
+
rows: L,
|
|
669
|
+
totalRecords: ye,
|
|
670
670
|
loading: c !== void 0 ? c : k,
|
|
671
|
-
error:
|
|
671
|
+
error: D,
|
|
672
672
|
refresh: H,
|
|
673
|
-
isServerMode:
|
|
674
|
-
rawRemoteData:
|
|
673
|
+
isServerMode: n,
|
|
674
|
+
rawRemoteData: u
|
|
675
675
|
};
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function rr({
|
|
678
678
|
tableRef: e,
|
|
679
679
|
refresh: t,
|
|
680
|
-
resetPagination:
|
|
680
|
+
resetPagination: s,
|
|
681
681
|
resetSearch: o,
|
|
682
682
|
resetSorting: l,
|
|
683
|
-
setPage:
|
|
683
|
+
setPage: r,
|
|
684
684
|
setPageSize: i,
|
|
685
685
|
setSearch: g,
|
|
686
686
|
setSorting: c,
|
|
687
687
|
selectedRows: d,
|
|
688
|
-
clearSelection:
|
|
689
|
-
getState:
|
|
688
|
+
clearSelection: n,
|
|
689
|
+
getState: u
|
|
690
690
|
}) {
|
|
691
|
-
|
|
691
|
+
Dt(
|
|
692
692
|
e,
|
|
693
693
|
() => ({
|
|
694
694
|
refresh: t,
|
|
695
695
|
reset: () => {
|
|
696
|
-
|
|
696
|
+
s(), o(), l(), n();
|
|
697
697
|
},
|
|
698
698
|
resetSearch: o,
|
|
699
699
|
resetSorting: l,
|
|
700
|
-
resetPagination:
|
|
701
|
-
setPage:
|
|
700
|
+
resetPagination: s,
|
|
701
|
+
setPage: r,
|
|
702
702
|
setPageSize: i,
|
|
703
703
|
setSearch: g,
|
|
704
704
|
setSorting: c,
|
|
705
705
|
getSelectedRows: () => d,
|
|
706
|
-
clearSelection:
|
|
707
|
-
getState:
|
|
706
|
+
clearSelection: n,
|
|
707
|
+
getState: u
|
|
708
708
|
}),
|
|
709
709
|
[
|
|
710
710
|
t,
|
|
711
|
-
|
|
711
|
+
s,
|
|
712
712
|
o,
|
|
713
713
|
l,
|
|
714
|
-
|
|
714
|
+
r,
|
|
715
715
|
i,
|
|
716
716
|
g,
|
|
717
717
|
c,
|
|
718
718
|
d,
|
|
719
|
-
|
|
720
|
-
|
|
719
|
+
n,
|
|
720
|
+
u
|
|
721
721
|
]
|
|
722
722
|
);
|
|
723
723
|
}
|
|
724
|
-
const
|
|
724
|
+
const tt = {
|
|
725
725
|
primary: "#2667EC",
|
|
726
726
|
primaryHover: "#1E54C6",
|
|
727
727
|
primaryLight: "#397FF6",
|
|
@@ -740,9 +740,9 @@ const Jt = {
|
|
|
740
740
|
inputBg: "#1E293B",
|
|
741
741
|
rowHover: "rgba(38, 103, 236, 0.04)",
|
|
742
742
|
rowSelected: "rgba(38, 103, 236, 0.08)"
|
|
743
|
-
},
|
|
743
|
+
}, rt = {
|
|
744
744
|
mode: "auto",
|
|
745
|
-
colors:
|
|
745
|
+
colors: tt,
|
|
746
746
|
borderRadius: "1rem",
|
|
747
747
|
fontFamily: "'Alexandria', system-ui, -apple-system, sans-serif",
|
|
748
748
|
density: "normal",
|
|
@@ -762,37 +762,169 @@ const Jt = {
|
|
|
762
762
|
paginationButtonActive: "bg-primary text-white hover:bg-primary-soft shadow-md shadow-primary/30",
|
|
763
763
|
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"
|
|
764
764
|
}
|
|
765
|
-
},
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
765
|
+
}, Ve = {
|
|
766
|
+
default: {
|
|
767
|
+
colors: tt,
|
|
768
|
+
borderRadius: "1rem",
|
|
769
|
+
density: "normal"
|
|
770
|
+
},
|
|
771
|
+
midnight: {
|
|
772
|
+
colors: {
|
|
773
|
+
primary: "#6366F1",
|
|
774
|
+
primaryHover: "#4F46E5",
|
|
775
|
+
primaryLight: "#818CF8",
|
|
776
|
+
rowHover: "rgba(99, 102, 241, 0.08)",
|
|
777
|
+
rowSelected: "rgba(99, 102, 241, 0.16)",
|
|
778
|
+
theadBg: "#0F172A",
|
|
779
|
+
theadText: "#C7D2FE"
|
|
780
|
+
},
|
|
781
|
+
borderRadius: "1.25rem",
|
|
782
|
+
classes: {
|
|
783
|
+
tableWrapper: "w-full overflow-x-auto rounded-2xl border border-indigo-200 dark:border-indigo-950/70 bg-indigo-50/30 dark:bg-[#090D16] shadow-xl shadow-indigo-500/5 dark:shadow-indigo-950/30 transition-colors",
|
|
784
|
+
thead: "bg-indigo-100/60 dark:bg-[#0F172A]/90 backdrop-blur-md border-b border-indigo-200 dark:border-indigo-950/80 text-indigo-900 dark:text-indigo-200 font-bold uppercase text-xs tracking-wider",
|
|
785
|
+
searchInput: "w-full pl-10 pr-10 py-2.5 rounded-xl border border-indigo-200 dark:border-indigo-900/50 bg-white dark:bg-[#111827] text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/40 focus:border-indigo-500",
|
|
786
|
+
paginationButtonActive: "bg-indigo-600 text-white shadow-lg shadow-indigo-600/30"
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
emerald: {
|
|
790
|
+
colors: {
|
|
791
|
+
primary: "#10B981",
|
|
792
|
+
primaryHover: "#059669",
|
|
793
|
+
primaryLight: "#34D399",
|
|
794
|
+
border: "#10B98125",
|
|
795
|
+
rowHover: "rgba(16, 185, 129, 0.06)",
|
|
796
|
+
rowSelected: "rgba(16, 185, 129, 0.12)",
|
|
797
|
+
theadBg: "rgba(16, 185, 129, 0.08)",
|
|
798
|
+
theadText: "#065F46"
|
|
799
|
+
},
|
|
800
|
+
borderRadius: "1rem",
|
|
801
|
+
classes: {
|
|
802
|
+
tableWrapper: "w-full overflow-x-auto rounded-2xl border border-emerald-500/20 bg-white dark:bg-slate-900 shadow-lg shadow-emerald-500/5 transition-colors",
|
|
803
|
+
thead: "bg-emerald-500/10 dark:bg-emerald-950/30 border-b border-emerald-500/20 text-emerald-800 dark:text-emerald-300 font-bold uppercase text-xs",
|
|
804
|
+
searchInput: "w-full pl-10 pr-10 py-2.5 rounded-xl border border-emerald-500/30 bg-white dark:bg-slate-800 text-gray-900 dark:text-white focus:ring-emerald-500/40 focus:border-emerald-500",
|
|
805
|
+
paginationButtonActive: "bg-emerald-600 text-white shadow-md shadow-emerald-600/30"
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
ocean: {
|
|
809
|
+
colors: {
|
|
810
|
+
primary: "#0EA5E9",
|
|
811
|
+
primaryHover: "#0284C7",
|
|
812
|
+
primaryLight: "#38BDF8",
|
|
813
|
+
secondary: "#06B6D4",
|
|
814
|
+
rowHover: "rgba(14, 165, 233, 0.06)",
|
|
815
|
+
rowSelected: "rgba(14, 165, 233, 0.12)",
|
|
816
|
+
theadBg: "rgba(14, 165, 233, 0.08)",
|
|
817
|
+
theadText: "#0369A1"
|
|
818
|
+
},
|
|
819
|
+
borderRadius: "1rem",
|
|
820
|
+
classes: {
|
|
821
|
+
tableWrapper: "w-full overflow-x-auto rounded-2xl border border-sky-500/20 bg-white dark:bg-slate-900 shadow-lg shadow-sky-500/5 transition-colors",
|
|
822
|
+
thead: "bg-sky-500/10 dark:bg-sky-950/30 border-b border-sky-500/20 text-sky-800 dark:text-sky-300 font-bold uppercase text-xs",
|
|
823
|
+
searchInput: "w-full pl-10 pr-10 py-2.5 rounded-xl border border-sky-500/30 bg-white dark:bg-slate-800 text-gray-900 dark:text-white focus:ring-sky-500/40 focus:border-sky-500",
|
|
824
|
+
paginationButtonActive: "bg-sky-500 text-white shadow-md shadow-sky-500/30"
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
luxury: {
|
|
828
|
+
colors: {
|
|
829
|
+
primary: "#D97706",
|
|
830
|
+
primaryHover: "#B45309",
|
|
831
|
+
primaryLight: "#F59E0B",
|
|
832
|
+
rowHover: "rgba(245, 158, 11, 0.06)",
|
|
833
|
+
rowSelected: "rgba(245, 158, 11, 0.14)",
|
|
834
|
+
theadBg: "rgba(245, 158, 11, 0.08)",
|
|
835
|
+
theadText: "#78350F"
|
|
836
|
+
},
|
|
837
|
+
borderRadius: "1.25rem",
|
|
838
|
+
classes: {
|
|
839
|
+
tableWrapper: "w-full overflow-x-auto rounded-3xl border border-amber-300/60 dark:border-amber-500/30 bg-amber-50/30 dark:bg-[#120F0B] shadow-xl shadow-amber-500/10 transition-colors",
|
|
840
|
+
thead: "bg-amber-100/70 dark:bg-amber-950/30 border-b border-amber-300/60 dark:border-amber-500/20 text-amber-900 dark:text-amber-300 font-bold uppercase text-xs tracking-wider",
|
|
841
|
+
searchInput: "w-full pl-10 pr-10 py-2.5 rounded-xl border border-amber-300/60 dark:border-amber-500/30 bg-white dark:bg-[#1A1612] text-gray-900 dark:text-amber-100 focus:ring-amber-500/40 focus:border-amber-500",
|
|
842
|
+
paginationButtonActive: "bg-gradient-to-r from-amber-500 to-yellow-500 text-white shadow-md shadow-amber-500/30 font-black"
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
crimson: {
|
|
846
|
+
colors: {
|
|
847
|
+
primary: "#F43F5E",
|
|
848
|
+
primaryHover: "#E11D48",
|
|
849
|
+
primaryLight: "#FB7185",
|
|
850
|
+
rowHover: "rgba(244, 63, 94, 0.06)",
|
|
851
|
+
rowSelected: "rgba(244, 63, 94, 0.12)",
|
|
852
|
+
theadBg: "rgba(244, 63, 94, 0.08)",
|
|
853
|
+
theadText: "#881337"
|
|
854
|
+
},
|
|
855
|
+
borderRadius: "1rem",
|
|
856
|
+
classes: {
|
|
857
|
+
tableWrapper: "w-full overflow-x-auto rounded-2xl border border-rose-500/20 bg-white dark:bg-slate-900 shadow-lg shadow-rose-500/5",
|
|
858
|
+
thead: "bg-rose-500/10 dark:bg-rose-950/30 border-b border-rose-500/20 text-rose-800 dark:text-rose-300 font-bold uppercase text-xs",
|
|
859
|
+
searchInput: "w-full pl-10 pr-10 py-2.5 rounded-xl border border-rose-500/30 bg-white dark:bg-slate-800 text-gray-900 dark:text-white focus:ring-rose-500/40 focus:border-rose-500",
|
|
860
|
+
paginationButtonActive: "bg-rose-500 text-white shadow-md shadow-rose-500/30"
|
|
861
|
+
}
|
|
862
|
+
},
|
|
863
|
+
minimal: {
|
|
864
|
+
borderRadius: "0.5rem",
|
|
865
|
+
density: "spacious",
|
|
866
|
+
classes: {
|
|
867
|
+
tableWrapper: "w-full overflow-x-auto rounded-lg border-0 bg-transparent shadow-none",
|
|
868
|
+
thead: "bg-transparent border-b border-gray-200 dark:border-gray-800 text-gray-500 dark:text-gray-400 font-semibold text-xs tracking-wider",
|
|
869
|
+
tbody: "divide-y divide-gray-100 dark:divide-gray-800/40 bg-transparent",
|
|
870
|
+
tr: "hover:bg-gray-500/5 transition-colors",
|
|
871
|
+
searchInput: "w-full pl-10 pr-10 py-2 rounded-lg border border-gray-200 dark:border-gray-800 bg-transparent text-sm focus:border-gray-400",
|
|
872
|
+
paginationButtonActive: "bg-gray-900 dark:bg-white text-white dark:text-gray-900 font-bold"
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
corporate: {
|
|
772
876
|
colors: {
|
|
773
|
-
|
|
774
|
-
|
|
877
|
+
primary: "#1E40AF",
|
|
878
|
+
primaryHover: "#1E3A8A",
|
|
879
|
+
primaryLight: "#3B82F6"
|
|
775
880
|
},
|
|
881
|
+
borderRadius: "0.375rem",
|
|
882
|
+
density: "compact",
|
|
776
883
|
classes: {
|
|
777
|
-
|
|
778
|
-
|
|
884
|
+
tableWrapper: "w-full overflow-x-auto rounded-md border border-gray-300 dark:border-gray-700 bg-white dark:bg-slate-900 shadow-sm",
|
|
885
|
+
thead: "bg-gray-100 dark:bg-slate-800 border-b border-gray-300 dark:border-gray-700 text-gray-700 dark:text-gray-300 font-bold uppercase text-xs",
|
|
886
|
+
searchInput: "w-full pl-9 pr-8 py-1.5 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-slate-800 text-xs",
|
|
887
|
+
paginationButtonActive: "bg-blue-800 text-white"
|
|
779
888
|
}
|
|
780
|
-
}
|
|
781
|
-
|
|
889
|
+
}
|
|
890
|
+
}, Te = Mt(rt), ar = ({
|
|
891
|
+
theme: e,
|
|
892
|
+
preset: t,
|
|
893
|
+
children: s
|
|
894
|
+
}) => {
|
|
895
|
+
const o = Qe(Te), l = W(() => {
|
|
896
|
+
const r = o || rt, i = t && Ve[t] ? Ve[t] : {};
|
|
897
|
+
return {
|
|
898
|
+
...r,
|
|
899
|
+
...i,
|
|
900
|
+
...e || {},
|
|
901
|
+
colors: {
|
|
902
|
+
...r.colors,
|
|
903
|
+
...i.colors || {},
|
|
904
|
+
...e?.colors || {}
|
|
905
|
+
},
|
|
906
|
+
classes: {
|
|
907
|
+
...r.classes,
|
|
908
|
+
...i.classes || {},
|
|
909
|
+
...e?.classes || {}
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
}, [o, t, e]);
|
|
913
|
+
return /* @__PURE__ */ a(Te.Provider, { value: l, children: s });
|
|
782
914
|
};
|
|
783
915
|
function ee() {
|
|
784
|
-
return
|
|
916
|
+
return Qe(Te);
|
|
785
917
|
}
|
|
786
|
-
const
|
|
918
|
+
const nr = ({
|
|
787
919
|
value: e,
|
|
788
920
|
onChange: t,
|
|
789
|
-
onClear:
|
|
921
|
+
onClear: s,
|
|
790
922
|
isDebouncing: o = !1,
|
|
791
923
|
placeholder: l = "Search records..."
|
|
792
924
|
}) => {
|
|
793
|
-
const
|
|
794
|
-
return /* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
925
|
+
const r = ee();
|
|
926
|
+
return /* @__PURE__ */ y("div", { className: r.classes?.searchContainer || "w-full sm:max-w-md relative flex items-center", children: [
|
|
927
|
+
/* @__PURE__ */ a("span", { className: "absolute left-3.5 text-gray-400 dark:text-gray-500 pointer-events-none flex items-center", children: /* @__PURE__ */ a(
|
|
796
928
|
"svg",
|
|
797
929
|
{
|
|
798
930
|
className: "w-4 h-4",
|
|
@@ -800,7 +932,7 @@ const qt = ({
|
|
|
800
932
|
stroke: "currentColor",
|
|
801
933
|
viewBox: "0 0 24 24",
|
|
802
934
|
xmlns: "http://www.w3.org/2000/svg",
|
|
803
|
-
children: /* @__PURE__ */
|
|
935
|
+
children: /* @__PURE__ */ a(
|
|
804
936
|
"path",
|
|
805
937
|
{
|
|
806
938
|
strokeLinecap: "round",
|
|
@@ -811,26 +943,26 @@ const qt = ({
|
|
|
811
943
|
)
|
|
812
944
|
}
|
|
813
945
|
) }),
|
|
814
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ a(
|
|
815
947
|
"input",
|
|
816
948
|
{
|
|
817
949
|
type: "text",
|
|
818
950
|
value: e,
|
|
819
951
|
onChange: (i) => t(i.target.value),
|
|
820
952
|
placeholder: l,
|
|
821
|
-
className:
|
|
953
|
+
className: r.classes?.searchInput || "w-full pl-10 pr-10 py-2.5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-800 text-sm font-medium text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-500 focus:outline-none focus:ring-2 focus:ring-primary/40 focus:border-primary transition-all"
|
|
822
954
|
}
|
|
823
955
|
),
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
o && /* @__PURE__ */
|
|
826
|
-
e && /* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ y("div", { className: "absolute right-3 flex items-center gap-1.5", children: [
|
|
957
|
+
o && /* @__PURE__ */ a("span", { className: "w-3.5 h-3.5 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
|
|
958
|
+
e && /* @__PURE__ */ a(
|
|
827
959
|
"button",
|
|
828
960
|
{
|
|
829
961
|
type: "button",
|
|
830
|
-
onClick:
|
|
962
|
+
onClick: s,
|
|
831
963
|
className: "p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded-full hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",
|
|
832
964
|
title: "Clear search",
|
|
833
|
-
children: /* @__PURE__ */
|
|
965
|
+
children: /* @__PURE__ */ a(
|
|
834
966
|
"svg",
|
|
835
967
|
{
|
|
836
968
|
className: "w-3.5 h-3.5",
|
|
@@ -838,139 +970,147 @@ const qt = ({
|
|
|
838
970
|
stroke: "currentColor",
|
|
839
971
|
viewBox: "0 0 24 24",
|
|
840
972
|
xmlns: "http://www.w3.org/2000/svg",
|
|
841
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })
|
|
842
974
|
}
|
|
843
975
|
)
|
|
844
976
|
}
|
|
845
977
|
)
|
|
846
978
|
] })
|
|
847
979
|
] });
|
|
848
|
-
},
|
|
980
|
+
}, sr = ({
|
|
849
981
|
columns: e,
|
|
850
982
|
hasActions: t,
|
|
851
|
-
actionsTitle:
|
|
983
|
+
actionsTitle: s = "Actions",
|
|
852
984
|
actionsWidth: o,
|
|
853
985
|
sortBy: l,
|
|
854
|
-
sortOrder:
|
|
986
|
+
sortOrder: r,
|
|
855
987
|
onSort: i,
|
|
856
988
|
selectable: g,
|
|
857
989
|
allSelected: c,
|
|
858
990
|
isIndeterminate: d,
|
|
859
|
-
onToggleSelectAll:
|
|
991
|
+
onToggleSelectAll: n,
|
|
992
|
+
headerClassName: u = ""
|
|
860
993
|
}) => {
|
|
861
|
-
const m = ee();
|
|
862
|
-
return
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
},
|
|
885
|
-
onClick: () => p && i?.(String(u.key)),
|
|
886
|
-
className: `${m.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${k} ${u.headerClassName || ""} ${p ? "cursor-pointer hover:text-primary transition-colors group" : ""}`,
|
|
887
|
-
children: /* @__PURE__ */ b(
|
|
888
|
-
"div",
|
|
994
|
+
const m = ee(), b = {};
|
|
995
|
+
return m.colors?.theadBg && (b.backgroundColor = m.colors.theadBg), m.colors?.theadText && (b.color = m.colors.theadText), /* @__PURE__ */ a(
|
|
996
|
+
"thead",
|
|
997
|
+
{
|
|
998
|
+
style: b,
|
|
999
|
+
className: `${m.classes?.thead || "bg-gray-50/80 dark:bg-slate-800/80 border-b border-gray-200 dark:border-gray-800"} ${u}`,
|
|
1000
|
+
children: /* @__PURE__ */ y("tr", { children: [
|
|
1001
|
+
g && /* @__PURE__ */ a("th", { className: "w-10 px-4 py-3 text-center align-middle", children: /* @__PURE__ */ a(
|
|
1002
|
+
"input",
|
|
1003
|
+
{
|
|
1004
|
+
type: "checkbox",
|
|
1005
|
+
checked: c,
|
|
1006
|
+
ref: (f) => {
|
|
1007
|
+
f && (f.indeterminate = !!d);
|
|
1008
|
+
},
|
|
1009
|
+
onChange: n,
|
|
1010
|
+
className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
|
|
1011
|
+
}
|
|
1012
|
+
) }),
|
|
1013
|
+
e.map((f) => {
|
|
1014
|
+
const k = l === f.key, C = f.sortable !== !1 && !!i, D = f.align === "center" ? "text-center" : f.align === "right" ? "text-right" : "text-left";
|
|
1015
|
+
return /* @__PURE__ */ a(
|
|
1016
|
+
"th",
|
|
889
1017
|
{
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
1018
|
+
style: {
|
|
1019
|
+
width: f.width,
|
|
1020
|
+
minWidth: f.minWidth,
|
|
1021
|
+
maxWidth: f.maxWidth
|
|
1022
|
+
},
|
|
1023
|
+
onClick: () => C && i?.(String(f.key)),
|
|
1024
|
+
className: `${m.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} ${D} ${f.headerClassName || ""} ${C ? "cursor-pointer hover:text-primary transition-colors group" : ""}`,
|
|
1025
|
+
children: /* @__PURE__ */ y(
|
|
1026
|
+
"div",
|
|
1027
|
+
{
|
|
1028
|
+
className: `inline-flex items-center gap-1.5 ${f.align === "center" ? "justify-center" : f.align === "right" ? "justify-end" : "justify-start"}`,
|
|
1029
|
+
children: [
|
|
1030
|
+
/* @__PURE__ */ a("span", { children: f.title }),
|
|
1031
|
+
C && /* @__PURE__ */ a(
|
|
1032
|
+
"span",
|
|
1033
|
+
{
|
|
1034
|
+
className: `inline-flex flex-col text-[10px] transition-transform ${k ? "text-primary scale-110" : "text-gray-400 opacity-40 group-hover:opacity-100"}`,
|
|
1035
|
+
children: k ? r === "asc" ? "▲" : "▼" : /* @__PURE__ */ a("span", { className: "text-[9px] leading-none opacity-50", children: "▲▼" })
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1038
|
+
]
|
|
1039
|
+
}
|
|
1040
|
+
)
|
|
1041
|
+
},
|
|
1042
|
+
String(f.key)
|
|
1043
|
+
);
|
|
1044
|
+
}),
|
|
1045
|
+
t && /* @__PURE__ */ a(
|
|
1046
|
+
"th",
|
|
1047
|
+
{
|
|
1048
|
+
style: { width: o || "auto" },
|
|
1049
|
+
className: `${m.classes?.th || "py-3.5 px-4 font-bold select-none whitespace-nowrap text-xs uppercase tracking-wider"} text-right pr-6`,
|
|
1050
|
+
children: s
|
|
1051
|
+
}
|
|
1052
|
+
)
|
|
1053
|
+
] })
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1056
|
+
}, $ = () => /* @__PURE__ */ a("span", { className: "text-gray-400 dark:text-gray-500 font-mono text-sm", children: "—" }), at = ({ value: e }) => {
|
|
917
1057
|
if (e == null || e === "")
|
|
918
|
-
return /* @__PURE__ */
|
|
1058
|
+
return /* @__PURE__ */ a($, {});
|
|
919
1059
|
const t = String(e);
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
},
|
|
1060
|
+
return /* @__PURE__ */ a("span", { className: "truncate block max-w-xs font-normal text-sm", title: t, children: t });
|
|
1061
|
+
}, or = ({ value: e }) => {
|
|
922
1062
|
if (e == null || isNaN(Number(e)))
|
|
923
|
-
return /* @__PURE__ */
|
|
1063
|
+
return /* @__PURE__ */ a($, {});
|
|
924
1064
|
const t = Number(e);
|
|
925
|
-
return /* @__PURE__ */
|
|
926
|
-
},
|
|
1065
|
+
return /* @__PURE__ */ a("span", { className: "font-mono text-sm font-medium", children: t.toLocaleString() });
|
|
1066
|
+
}, ir = ({ value: e }) => {
|
|
927
1067
|
if (e == null)
|
|
928
|
-
return /* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ a($, {});
|
|
929
1069
|
const t = !!e;
|
|
930
|
-
return /* @__PURE__ */
|
|
1070
|
+
return /* @__PURE__ */ y(
|
|
931
1071
|
"span",
|
|
932
1072
|
{
|
|
933
1073
|
className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-semibold tracking-wide ${t ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20" : "bg-rose-500/10 text-rose-600 dark:text-rose-400 border border-rose-500/20"}`,
|
|
934
1074
|
children: [
|
|
935
|
-
/* @__PURE__ */
|
|
1075
|
+
/* @__PURE__ */ a("span", { className: `w-1.5 h-1.5 rounded-full ${t ? "bg-emerald-500" : "bg-rose-500"}` }),
|
|
936
1076
|
t ? "Yes" : "No"
|
|
937
1077
|
]
|
|
938
1078
|
}
|
|
939
1079
|
);
|
|
940
|
-
},
|
|
1080
|
+
}, Ye = ({
|
|
941
1081
|
value: e,
|
|
942
1082
|
isDateTime: t = !1
|
|
943
1083
|
}) => {
|
|
944
|
-
if (!e) return /* @__PURE__ */
|
|
945
|
-
const
|
|
946
|
-
return isNaN(
|
|
947
|
-
|
|
948
|
-
t && /* @__PURE__ */
|
|
1084
|
+
if (!e) return /* @__PURE__ */ a($, {});
|
|
1085
|
+
const s = e instanceof Date ? e : new Date(e);
|
|
1086
|
+
return isNaN(s.getTime()) ? /* @__PURE__ */ a(at, { value: e, column: { key: "" } }) : /* @__PURE__ */ y("span", { className: "whitespace-nowrap text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
1087
|
+
s.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" }),
|
|
1088
|
+
t && /* @__PURE__ */ a("span", { className: "text-xs text-gray-400 dark:text-gray-500 ml-1.5", children: s.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" }) })
|
|
949
1089
|
] });
|
|
950
|
-
},
|
|
1090
|
+
}, lr = ({ value: e, column: t }) => {
|
|
951
1091
|
if (e == null || isNaN(Number(e)))
|
|
952
|
-
return /* @__PURE__ */
|
|
953
|
-
const
|
|
954
|
-
return /* @__PURE__ */
|
|
955
|
-
|
|
1092
|
+
return /* @__PURE__ */ a($, {});
|
|
1093
|
+
const s = Number(e), o = t.currency || "EGP";
|
|
1094
|
+
return /* @__PURE__ */ y("span", { className: "font-mono text-sm font-bold text-gray-900 dark:text-white", children: [
|
|
1095
|
+
s.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }),
|
|
956
1096
|
" ",
|
|
957
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ a("span", { className: "text-xs font-normal text-gray-500 dark:text-gray-400", children: o })
|
|
958
1098
|
] });
|
|
959
|
-
},
|
|
1099
|
+
}, Ze = "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", dr = ({ value: e }) => {
|
|
960
1100
|
let t = "";
|
|
961
|
-
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 =
|
|
1101
|
+
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 = Ze), /* @__PURE__ */ a("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ a(
|
|
962
1102
|
"img",
|
|
963
1103
|
{
|
|
964
1104
|
src: t,
|
|
965
1105
|
alt: "Thumbnail",
|
|
966
1106
|
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",
|
|
967
1107
|
loading: "lazy",
|
|
968
|
-
onError: (
|
|
969
|
-
|
|
1108
|
+
onError: (s) => {
|
|
1109
|
+
s.target.src = Ze;
|
|
970
1110
|
}
|
|
971
1111
|
}
|
|
972
1112
|
) });
|
|
973
|
-
},
|
|
1113
|
+
}, cr = {
|
|
974
1114
|
active: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
975
1115
|
delivered: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
976
1116
|
completed: { bg: "bg-emerald-500/10 border-emerald-500/20", text: "text-emerald-600 dark:text-emerald-400", dot: "bg-emerald-500" },
|
|
@@ -986,56 +1126,56 @@ const qt = ({
|
|
|
986
1126
|
cancelled: { bg: "bg-rose-500/10 border-rose-500/20", text: "text-rose-600 dark:text-rose-400", dot: "bg-rose-500" },
|
|
987
1127
|
offline: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" },
|
|
988
1128
|
closed: { bg: "bg-gray-500/10 border-gray-500/20", text: "text-gray-600 dark:text-gray-400", dot: "bg-gray-500" }
|
|
989
|
-
},
|
|
1129
|
+
}, gr = ({ value: e, column: t }) => {
|
|
990
1130
|
if (e == null || e === "")
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
-
const
|
|
993
|
-
if (t.statusMap && t.statusMap[
|
|
994
|
-
const
|
|
995
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ a($, {});
|
|
1132
|
+
const s = String(e), o = s.toLowerCase();
|
|
1133
|
+
if (t.statusMap && t.statusMap[s]) {
|
|
1134
|
+
const r = t.statusMap[s];
|
|
1135
|
+
return /* @__PURE__ */ y(
|
|
996
1136
|
"span",
|
|
997
1137
|
{
|
|
998
1138
|
className: "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border",
|
|
999
|
-
style: { color:
|
|
1139
|
+
style: { color: r.color, backgroundColor: r.bg },
|
|
1000
1140
|
children: [
|
|
1001
|
-
/* @__PURE__ */
|
|
1002
|
-
|
|
1141
|
+
/* @__PURE__ */ a("span", { className: "w-1.5 h-1.5 rounded-full", style: { backgroundColor: r.color } }),
|
|
1142
|
+
r.label || s
|
|
1003
1143
|
]
|
|
1004
1144
|
}
|
|
1005
1145
|
);
|
|
1006
1146
|
}
|
|
1007
|
-
const l =
|
|
1147
|
+
const l = cr[o] || {
|
|
1008
1148
|
bg: "bg-gray-500/10 border-gray-500/20",
|
|
1009
1149
|
text: "text-gray-700 dark:text-gray-300",
|
|
1010
1150
|
dot: "bg-gray-400"
|
|
1011
1151
|
};
|
|
1012
|
-
return /* @__PURE__ */
|
|
1152
|
+
return /* @__PURE__ */ y(
|
|
1013
1153
|
"span",
|
|
1014
1154
|
{
|
|
1015
1155
|
className: `inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-bold uppercase tracking-wider border ${l.bg} ${l.text}`,
|
|
1016
1156
|
children: [
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
|
|
1157
|
+
/* @__PURE__ */ a("span", { className: `w-1.5 h-1.5 rounded-full ${l.dot}` }),
|
|
1158
|
+
s
|
|
1019
1159
|
]
|
|
1020
1160
|
}
|
|
1021
1161
|
);
|
|
1022
|
-
},
|
|
1023
|
-
e.slice(0, 3).map((t,
|
|
1162
|
+
}, mr = ({ value: e }) => !Array.isArray(e) || e.length === 0 ? /* @__PURE__ */ a($, {}) : /* @__PURE__ */ y("div", { className: "flex flex-wrap gap-1 items-center", children: [
|
|
1163
|
+
e.slice(0, 3).map((t, s) => /* @__PURE__ */ a(
|
|
1024
1164
|
"span",
|
|
1025
1165
|
{
|
|
1026
1166
|
className: "inline-block px-2 py-0.5 text-xs rounded bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-gray-700",
|
|
1027
1167
|
children: typeof t == "object" ? JSON.stringify(t) : String(t)
|
|
1028
1168
|
},
|
|
1029
|
-
|
|
1169
|
+
s
|
|
1030
1170
|
)),
|
|
1031
|
-
e.length > 3 && /* @__PURE__ */
|
|
1171
|
+
e.length > 3 && /* @__PURE__ */ y("span", { className: "text-xs text-gray-400 font-medium", children: [
|
|
1032
1172
|
"+",
|
|
1033
1173
|
e.length - 3
|
|
1034
1174
|
] })
|
|
1035
|
-
] }),
|
|
1036
|
-
if (!e) return /* @__PURE__ */
|
|
1175
|
+
] }), ur = ({ value: e }) => !e || typeof e != "object" ? /* @__PURE__ */ a($, {}) : "en" in e || "ar" in e ? /* @__PURE__ */ a("span", { className: "font-medium text-sm", children: e.en || e.ar || "" }) : /* @__PURE__ */ a("span", { className: "font-mono text-xs text-gray-500 dark:text-gray-400 truncate block max-w-xs", title: JSON.stringify(e), children: JSON.stringify(e) }), br = ({ value: e }) => {
|
|
1176
|
+
if (!e) return /* @__PURE__ */ a($, {});
|
|
1037
1177
|
const t = String(e);
|
|
1038
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ y(
|
|
1039
1179
|
"a",
|
|
1040
1180
|
{
|
|
1041
1181
|
href: t,
|
|
@@ -1043,15 +1183,15 @@ const qt = ({
|
|
|
1043
1183
|
rel: "noopener noreferrer",
|
|
1044
1184
|
className: "text-primary hover:underline text-sm font-medium inline-flex items-center gap-1",
|
|
1045
1185
|
children: [
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1186
|
+
/* @__PURE__ */ a("span", { className: "truncate max-w-[150px]", children: t }),
|
|
1187
|
+
/* @__PURE__ */ a("span", { className: "text-xs", children: "↗" })
|
|
1048
1188
|
]
|
|
1049
1189
|
}
|
|
1050
1190
|
);
|
|
1051
|
-
},
|
|
1052
|
-
if (!e) return /* @__PURE__ */
|
|
1191
|
+
}, fr = ({ value: e }) => {
|
|
1192
|
+
if (!e) return /* @__PURE__ */ a($, {});
|
|
1053
1193
|
const t = String(e);
|
|
1054
|
-
return /* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ a(
|
|
1055
1195
|
"a",
|
|
1056
1196
|
{
|
|
1057
1197
|
href: `mailto:${t}`,
|
|
@@ -1059,10 +1199,10 @@ const qt = ({
|
|
|
1059
1199
|
children: t
|
|
1060
1200
|
}
|
|
1061
1201
|
);
|
|
1062
|
-
},
|
|
1063
|
-
if (!e) return /* @__PURE__ */
|
|
1202
|
+
}, yr = ({ value: e }) => {
|
|
1203
|
+
if (!e) return /* @__PURE__ */ a($, {});
|
|
1064
1204
|
const t = String(e);
|
|
1065
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ a(
|
|
1066
1206
|
"a",
|
|
1067
1207
|
{
|
|
1068
1208
|
href: `tel:${t}`,
|
|
@@ -1070,78 +1210,115 @@ const qt = ({
|
|
|
1070
1210
|
children: t
|
|
1071
1211
|
}
|
|
1072
1212
|
);
|
|
1073
|
-
},
|
|
1074
|
-
|
|
1213
|
+
}, hr = ({ value: e }) => {
|
|
1214
|
+
if (e == null || isNaN(Number(e)))
|
|
1215
|
+
return /* @__PURE__ */ a($, {});
|
|
1216
|
+
const t = Math.min(100, Math.max(0, Math.round(Number(e)))), s = t >= 80 ? "bg-emerald-500" : t >= 50 ? "bg-blue-500" : t >= 30 ? "bg-amber-500" : "bg-rose-500";
|
|
1217
|
+
return /* @__PURE__ */ y("div", { className: "flex items-center gap-2.5 min-w-[120px]", children: [
|
|
1218
|
+
/* @__PURE__ */ a("div", { className: "flex-1 h-2 rounded-full bg-gray-200 dark:bg-slate-700 overflow-hidden", children: /* @__PURE__ */ a(
|
|
1219
|
+
"div",
|
|
1220
|
+
{
|
|
1221
|
+
className: `h-full rounded-full ${s} transition-all duration-500`,
|
|
1222
|
+
style: { width: `${t}%` }
|
|
1223
|
+
}
|
|
1224
|
+
) }),
|
|
1225
|
+
/* @__PURE__ */ y("span", { className: "font-mono text-xs font-bold text-gray-700 dark:text-gray-300 w-9 text-right", children: [
|
|
1226
|
+
t,
|
|
1227
|
+
"%"
|
|
1228
|
+
] })
|
|
1229
|
+
] });
|
|
1230
|
+
}, pr = ({ value: e }) => {
|
|
1231
|
+
if (e == null || isNaN(Number(e)))
|
|
1232
|
+
return /* @__PURE__ */ a($, {});
|
|
1233
|
+
const t = Number(e);
|
|
1234
|
+
return /* @__PURE__ */ y("div", { className: "inline-flex items-center gap-1.5 font-medium text-xs text-amber-500", children: [
|
|
1235
|
+
/* @__PURE__ */ a("span", { className: "text-sm", children: "★" }),
|
|
1236
|
+
/* @__PURE__ */ a("span", { className: "font-bold text-gray-900 dark:text-gray-100", children: t.toFixed(1) }),
|
|
1237
|
+
/* @__PURE__ */ a("span", { className: "text-gray-400 dark:text-gray-500 text-[10px]", children: "/ 5" })
|
|
1238
|
+
] });
|
|
1239
|
+
}, xr = ({ value: e }) => {
|
|
1240
|
+
if (e == null || e === "")
|
|
1241
|
+
return /* @__PURE__ */ a($, {});
|
|
1242
|
+
const t = String(e);
|
|
1243
|
+
return /* @__PURE__ */ a("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", children: t });
|
|
1244
|
+
}, kr = ({ row: e, column: t, rowIndex: s }) => {
|
|
1245
|
+
const o = P(e, t.key);
|
|
1075
1246
|
if (t.render && typeof t.render == "function")
|
|
1076
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ a(Ce, { children: t.render(o, e, s) });
|
|
1077
1248
|
if (t.formatter && typeof t.formatter == "function")
|
|
1078
|
-
return /* @__PURE__ */
|
|
1249
|
+
return /* @__PURE__ */ a(Ce, { children: t.formatter(o, e, s) });
|
|
1079
1250
|
switch (t.type) {
|
|
1080
1251
|
case "boolean":
|
|
1081
|
-
return /* @__PURE__ */
|
|
1252
|
+
return /* @__PURE__ */ a(ir, { value: o, column: t });
|
|
1082
1253
|
case "number":
|
|
1083
|
-
return /* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */ a(or, { value: o, column: t });
|
|
1084
1255
|
case "currency":
|
|
1085
|
-
return /* @__PURE__ */
|
|
1256
|
+
return /* @__PURE__ */ a(lr, { value: o, column: t });
|
|
1086
1257
|
case "date":
|
|
1087
|
-
return /* @__PURE__ */
|
|
1258
|
+
return /* @__PURE__ */ a(Ye, { value: o, column: t, isDateTime: !1 });
|
|
1088
1259
|
case "datetime":
|
|
1089
|
-
return /* @__PURE__ */
|
|
1260
|
+
return /* @__PURE__ */ a(Ye, { value: o, column: t, isDateTime: !0 });
|
|
1090
1261
|
case "image":
|
|
1091
|
-
return /* @__PURE__ */
|
|
1262
|
+
return /* @__PURE__ */ a(dr, { value: o, column: t });
|
|
1092
1263
|
case "status":
|
|
1093
|
-
return /* @__PURE__ */
|
|
1264
|
+
return /* @__PURE__ */ a(gr, { value: o, column: t });
|
|
1265
|
+
case "progress":
|
|
1266
|
+
return /* @__PURE__ */ a(hr, { value: o, column: t });
|
|
1267
|
+
case "rating":
|
|
1268
|
+
return /* @__PURE__ */ a(pr, { value: o, column: t });
|
|
1269
|
+
case "badge":
|
|
1270
|
+
return /* @__PURE__ */ a(xr, { value: o, column: t });
|
|
1094
1271
|
case "array":
|
|
1095
|
-
return /* @__PURE__ */
|
|
1272
|
+
return /* @__PURE__ */ a(mr, { value: o, column: t });
|
|
1096
1273
|
case "object":
|
|
1097
|
-
return /* @__PURE__ */
|
|
1274
|
+
return /* @__PURE__ */ a(ur, { value: o, column: t });
|
|
1098
1275
|
case "url":
|
|
1099
|
-
return /* @__PURE__ */
|
|
1276
|
+
return /* @__PURE__ */ a(br, { value: o, column: t });
|
|
1100
1277
|
case "email":
|
|
1101
|
-
return /* @__PURE__ */
|
|
1278
|
+
return /* @__PURE__ */ a(fr, { value: o, column: t });
|
|
1102
1279
|
case "phone":
|
|
1103
|
-
return /* @__PURE__ */
|
|
1280
|
+
return /* @__PURE__ */ a(yr, { value: o, column: t });
|
|
1104
1281
|
default:
|
|
1105
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ a(at, { value: o, column: t });
|
|
1106
1283
|
}
|
|
1107
|
-
},
|
|
1284
|
+
}, wr = ({
|
|
1108
1285
|
isOpen: e,
|
|
1109
1286
|
title: t,
|
|
1110
|
-
message:
|
|
1287
|
+
message: s,
|
|
1111
1288
|
confirmText: o = "Confirm",
|
|
1112
1289
|
cancelText: l = "Cancel",
|
|
1113
|
-
type:
|
|
1290
|
+
type: r = "danger",
|
|
1114
1291
|
onClose: i,
|
|
1115
1292
|
onConfirm: g,
|
|
1116
1293
|
isLoading: c = !1
|
|
1117
|
-
}) => (
|
|
1118
|
-
const d = (
|
|
1119
|
-
|
|
1294
|
+
}) => (fe(() => {
|
|
1295
|
+
const d = (n) => {
|
|
1296
|
+
n.key === "Escape" && i();
|
|
1120
1297
|
};
|
|
1121
1298
|
return e && window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
|
|
1122
|
-
}, [e, i]), e ? /* @__PURE__ */
|
|
1299
|
+
}, [e, i]), e ? /* @__PURE__ */ a(
|
|
1123
1300
|
"div",
|
|
1124
1301
|
{
|
|
1125
1302
|
className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm any-table-fade-in",
|
|
1126
1303
|
onClick: i,
|
|
1127
|
-
children: /* @__PURE__ */
|
|
1304
|
+
children: /* @__PURE__ */ y(
|
|
1128
1305
|
"div",
|
|
1129
1306
|
{
|
|
1130
1307
|
className: "bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 w-full max-w-md rounded-2xl p-6 shadow-2xl transform transition-all text-center",
|
|
1131
1308
|
onClick: (d) => d.stopPropagation(),
|
|
1132
1309
|
role: "dialog",
|
|
1133
1310
|
children: [
|
|
1134
|
-
/* @__PURE__ */
|
|
1311
|
+
/* @__PURE__ */ a(
|
|
1135
1312
|
"div",
|
|
1136
1313
|
{
|
|
1137
|
-
className: `mx-auto mb-4 w-14 h-14 rounded-full flex items-center justify-center text-2xl ${
|
|
1138
|
-
children:
|
|
1314
|
+
className: `mx-auto mb-4 w-14 h-14 rounded-full flex items-center justify-center text-2xl ${r === "danger" ? "bg-rose-500/10 text-rose-500" : r === "warning" ? "bg-amber-500/10 text-amber-500" : "bg-blue-500/10 text-blue-500"}`,
|
|
1315
|
+
children: r === "danger" ? "⚠️" : r === "warning" ? "⚡" : "ℹ️"
|
|
1139
1316
|
}
|
|
1140
1317
|
),
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1144
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ a("h3", { className: "text-xl font-black text-gray-900 dark:text-white mb-2", children: t }),
|
|
1319
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-gray-600 dark:text-gray-400 mb-6 leading-relaxed", children: s }),
|
|
1320
|
+
/* @__PURE__ */ y("div", { className: "flex items-center justify-center gap-3", children: [
|
|
1321
|
+
/* @__PURE__ */ a(
|
|
1145
1322
|
"button",
|
|
1146
1323
|
{
|
|
1147
1324
|
type: "button",
|
|
@@ -1151,13 +1328,13 @@ const qt = ({
|
|
|
1151
1328
|
children: l
|
|
1152
1329
|
}
|
|
1153
1330
|
),
|
|
1154
|
-
/* @__PURE__ */
|
|
1331
|
+
/* @__PURE__ */ a(
|
|
1155
1332
|
"button",
|
|
1156
1333
|
{
|
|
1157
1334
|
type: "button",
|
|
1158
1335
|
disabled: c,
|
|
1159
1336
|
onClick: g,
|
|
1160
|
-
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 ${
|
|
1337
|
+
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 ${r === "danger" ? "bg-rose-600 hover:bg-rose-700 shadow-rose-600/30" : "bg-primary hover:bg-primary-soft shadow-primary/30"}`,
|
|
1161
1338
|
children: c ? "Processing..." : o
|
|
1162
1339
|
}
|
|
1163
1340
|
)
|
|
@@ -1166,7 +1343,34 @@ const qt = ({
|
|
|
1166
1343
|
}
|
|
1167
1344
|
)
|
|
1168
1345
|
}
|
|
1169
|
-
) : null)
|
|
1346
|
+
) : null);
|
|
1347
|
+
function nt(e, t) {
|
|
1348
|
+
if (!e) return null;
|
|
1349
|
+
if (Xe.isValidElement(e))
|
|
1350
|
+
return e;
|
|
1351
|
+
if (typeof e == "function") {
|
|
1352
|
+
if (e.prototype && e.prototype.isReactComponent)
|
|
1353
|
+
return /* @__PURE__ */ a(e, { className: "w-4 h-4 shrink-0" });
|
|
1354
|
+
const s = e.displayName || e.name || "";
|
|
1355
|
+
if (/^[A-Z]/.test(s))
|
|
1356
|
+
return /* @__PURE__ */ a(e, { className: "w-4 h-4 shrink-0" });
|
|
1357
|
+
try {
|
|
1358
|
+
const l = e(t);
|
|
1359
|
+
return nt(l, t);
|
|
1360
|
+
} catch {
|
|
1361
|
+
return /* @__PURE__ */ a(e, { className: "w-4 h-4 shrink-0" });
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
return typeof e == "object" && e !== null && (e.$$typeof || e.render) ? /* @__PURE__ */ a(e, { className: "w-4 h-4 shrink-0" }) : typeof e == "string" ? e.startsWith("http://") || e.startsWith("https://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("data:image/") || /\.(png|jpe?g|svg|webp|gif|ico)$/i.test(e) ? /* @__PURE__ */ a(
|
|
1365
|
+
"img",
|
|
1366
|
+
{
|
|
1367
|
+
src: e,
|
|
1368
|
+
alt: "action-icon",
|
|
1369
|
+
className: "w-4 h-4 object-contain shrink-0 inline-block"
|
|
1370
|
+
}
|
|
1371
|
+
) : /* @__PURE__ */ a("span", { className: "inline-flex items-center justify-center leading-none text-base", children: e }) : e;
|
|
1372
|
+
}
|
|
1373
|
+
const Je = {
|
|
1170
1374
|
primary: "bg-primary text-white hover:bg-primary-soft shadow-sm shadow-primary/20",
|
|
1171
1375
|
secondary: "bg-emerald-600 text-white hover:bg-emerald-700 shadow-sm shadow-emerald-600/20",
|
|
1172
1376
|
success: "bg-emerald-500 text-white hover:bg-emerald-600 shadow-sm shadow-emerald-500/20",
|
|
@@ -1175,107 +1379,107 @@ const qt = ({
|
|
|
1175
1379
|
info: "bg-sky-500 text-white hover:bg-sky-600 shadow-sm shadow-sky-500/20",
|
|
1176
1380
|
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",
|
|
1177
1381
|
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"
|
|
1178
|
-
},
|
|
1179
|
-
const [o, l] =
|
|
1382
|
+
}, Nr = ({ row: e, actions: t, context: s }) => {
|
|
1383
|
+
const [o, l] = S(null), [r, i] = S({});
|
|
1180
1384
|
if (!t || !t.length)
|
|
1181
1385
|
return null;
|
|
1182
|
-
const g = async (
|
|
1183
|
-
if (
|
|
1184
|
-
const
|
|
1386
|
+
const g = async (n) => {
|
|
1387
|
+
if (n.confirmation) {
|
|
1388
|
+
const u = typeof n.confirmation.title == "function" ? n.confirmation.title(e) : n.confirmation.title || "Confirm Action", m = typeof n.confirmation.message == "function" ? n.confirmation.message(e) : n.confirmation.message || "Are you sure you want to perform this action?";
|
|
1185
1389
|
l({
|
|
1186
1390
|
isOpen: !0,
|
|
1187
|
-
title:
|
|
1188
|
-
message:
|
|
1189
|
-
confirmText:
|
|
1190
|
-
cancelText:
|
|
1191
|
-
type:
|
|
1391
|
+
title: u,
|
|
1392
|
+
message: m,
|
|
1393
|
+
confirmText: n.confirmation.confirmText || "Confirm",
|
|
1394
|
+
cancelText: n.confirmation.cancelText || "Cancel",
|
|
1395
|
+
type: n.confirmation.type || "danger",
|
|
1192
1396
|
onConfirm: async () => {
|
|
1193
|
-
l(null), await c(
|
|
1397
|
+
l(null), await c(n);
|
|
1194
1398
|
}
|
|
1195
1399
|
});
|
|
1196
1400
|
return;
|
|
1197
1401
|
}
|
|
1198
|
-
await c(
|
|
1199
|
-
}, c = async (
|
|
1200
|
-
if (
|
|
1201
|
-
i((
|
|
1402
|
+
await c(n);
|
|
1403
|
+
}, c = async (n) => {
|
|
1404
|
+
if (n.type === "button" || !n.type) {
|
|
1405
|
+
i((u) => ({ ...u, [n.id]: !0 }));
|
|
1202
1406
|
try {
|
|
1203
|
-
await
|
|
1407
|
+
await n.onClick(e, s);
|
|
1204
1408
|
} finally {
|
|
1205
|
-
i((
|
|
1409
|
+
i((u) => ({ ...u, [n.id]: !1 }));
|
|
1206
1410
|
}
|
|
1207
1411
|
}
|
|
1208
|
-
}, d = async (
|
|
1209
|
-
const
|
|
1210
|
-
i((
|
|
1412
|
+
}, d = async (n, u) => {
|
|
1413
|
+
const m = !u;
|
|
1414
|
+
i((b) => ({ ...b, [n.id]: !0 }));
|
|
1211
1415
|
try {
|
|
1212
|
-
await
|
|
1416
|
+
await n.onChange(e, m, s);
|
|
1213
1417
|
} finally {
|
|
1214
|
-
i((
|
|
1418
|
+
i((b) => ({ ...b, [n.id]: !1 }));
|
|
1215
1419
|
}
|
|
1216
1420
|
};
|
|
1217
|
-
return /* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
if (typeof
|
|
1220
|
-
const
|
|
1221
|
-
if (
|
|
1222
|
-
return /* @__PURE__ */
|
|
1223
|
-
if (
|
|
1224
|
-
const
|
|
1225
|
-
return /* @__PURE__ */
|
|
1421
|
+
return /* @__PURE__ */ y(Ce, { children: [
|
|
1422
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 pr-2", children: t.map((n) => {
|
|
1423
|
+
if (typeof n.hide == "function" && n.hide(e) || typeof n.show == "function" && !n.show(e)) return null;
|
|
1424
|
+
const u = typeof n.disabled == "function" ? n.disabled(e) : !!n.disabled, m = r[n.id] || (typeof n.loading == "function" ? n.loading(e) : !!n.loading), b = typeof n.label == "function" ? n.label(e) : n.label, f = nt(n.icon, e), k = typeof n.tooltip == "function" ? n.tooltip(e) : n.tooltip, C = typeof n.className == "function" ? n.className(e) : n.className || "";
|
|
1425
|
+
if (n.type === "custom" && n.render)
|
|
1426
|
+
return /* @__PURE__ */ a(Xe.Fragment, { children: n.render(e, s) }, n.id);
|
|
1427
|
+
if (n.type === "switch") {
|
|
1428
|
+
const N = n, w = N.checked(e);
|
|
1429
|
+
return /* @__PURE__ */ y(
|
|
1226
1430
|
"div",
|
|
1227
1431
|
{
|
|
1228
1432
|
className: "flex items-center gap-2",
|
|
1229
|
-
title: k ||
|
|
1433
|
+
title: k || b,
|
|
1230
1434
|
children: [
|
|
1231
|
-
|
|
1232
|
-
|
|
1435
|
+
b && /* @__PURE__ */ y("span", { className: "text-xs font-semibold text-gray-500", children: [
|
|
1436
|
+
b,
|
|
1233
1437
|
":"
|
|
1234
1438
|
] }),
|
|
1235
|
-
/* @__PURE__ */
|
|
1439
|
+
/* @__PURE__ */ a(
|
|
1236
1440
|
"button",
|
|
1237
1441
|
{
|
|
1238
1442
|
type: "button",
|
|
1239
1443
|
role: "switch",
|
|
1240
|
-
"aria-checked":
|
|
1241
|
-
disabled:
|
|
1242
|
-
onClick: () => d(
|
|
1243
|
-
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 ${
|
|
1244
|
-
children: /* @__PURE__ */
|
|
1444
|
+
"aria-checked": w,
|
|
1445
|
+
disabled: u || m,
|
|
1446
|
+
onClick: () => d(N, w),
|
|
1447
|
+
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 ${w ? "bg-emerald-500" : "bg-gray-300 dark:bg-gray-700"} ${C}`,
|
|
1448
|
+
children: /* @__PURE__ */ a(
|
|
1245
1449
|
"span",
|
|
1246
1450
|
{
|
|
1247
1451
|
"aria-hidden": "true",
|
|
1248
|
-
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 ${
|
|
1249
|
-
children:
|
|
1452
|
+
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 ${w ? "translate-x-5" : "translate-x-0"}`,
|
|
1453
|
+
children: m && /* @__PURE__ */ a("span", { className: "w-2.5 h-2.5 border-2 border-primary border-t-transparent rounded-full animate-spin" })
|
|
1250
1454
|
}
|
|
1251
1455
|
)
|
|
1252
1456
|
}
|
|
1253
1457
|
)
|
|
1254
1458
|
]
|
|
1255
1459
|
},
|
|
1256
|
-
|
|
1460
|
+
n.id
|
|
1257
1461
|
);
|
|
1258
1462
|
}
|
|
1259
|
-
const
|
|
1260
|
-
return /* @__PURE__ */
|
|
1463
|
+
const D = typeof n.variant == "function" ? n.variant(e) : n.variant || "neutral", _ = Je[D] || Je.neutral, x = !b && f ? "p-2 min-w-[2rem]" : "px-3 py-1.5";
|
|
1464
|
+
return /* @__PURE__ */ y(
|
|
1261
1465
|
"button",
|
|
1262
1466
|
{
|
|
1263
1467
|
type: "button",
|
|
1264
|
-
disabled:
|
|
1265
|
-
onClick: () => g(
|
|
1468
|
+
disabled: u || m,
|
|
1469
|
+
onClick: () => g(n),
|
|
1266
1470
|
title: k,
|
|
1267
|
-
style:
|
|
1268
|
-
className: `inline-flex items-center justify-center gap-1.5
|
|
1471
|
+
style: n.color ? { backgroundColor: n.color, color: "#ffffff" } : void 0,
|
|
1472
|
+
className: `inline-flex items-center justify-center gap-1.5 ${x} rounded-xl text-xs font-bold transition-all duration-200 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100 ${_} ${C}`,
|
|
1269
1473
|
children: [
|
|
1270
|
-
|
|
1271
|
-
|
|
1474
|
+
m ? /* @__PURE__ */ a("span", { className: "w-3.5 h-3.5 border-2 border-current border-t-transparent rounded-full animate-spin" }) : f && /* @__PURE__ */ a("span", { className: "text-sm flex items-center justify-center shrink-0", children: f }),
|
|
1475
|
+
b && /* @__PURE__ */ a("span", { children: b })
|
|
1272
1476
|
]
|
|
1273
1477
|
},
|
|
1274
|
-
|
|
1478
|
+
n.id
|
|
1275
1479
|
);
|
|
1276
1480
|
}) }),
|
|
1277
|
-
o && /* @__PURE__ */
|
|
1278
|
-
|
|
1481
|
+
o && /* @__PURE__ */ a(
|
|
1482
|
+
wr,
|
|
1279
1483
|
{
|
|
1280
1484
|
isOpen: o.isOpen,
|
|
1281
1485
|
title: o.title,
|
|
@@ -1288,70 +1492,71 @@ const qt = ({
|
|
|
1288
1492
|
}
|
|
1289
1493
|
)
|
|
1290
1494
|
] });
|
|
1291
|
-
},
|
|
1495
|
+
}, vr = ({
|
|
1292
1496
|
rows: e,
|
|
1293
1497
|
columns: t,
|
|
1294
|
-
actions:
|
|
1498
|
+
actions: s,
|
|
1295
1499
|
actionContext: o,
|
|
1296
1500
|
rowKeyResolver: l,
|
|
1297
|
-
selectable:
|
|
1501
|
+
selectable: r,
|
|
1298
1502
|
selectedKeys: i,
|
|
1299
1503
|
onToggleSelectRow: g,
|
|
1300
1504
|
onRowClick: c,
|
|
1301
1505
|
striped: d = !1,
|
|
1302
|
-
hoverable:
|
|
1506
|
+
hoverable: n = !0,
|
|
1507
|
+
rowClassName: u
|
|
1303
1508
|
}) => {
|
|
1304
|
-
const m = ee(),
|
|
1305
|
-
return /* @__PURE__ */
|
|
1306
|
-
const
|
|
1307
|
-
return /* @__PURE__ */
|
|
1509
|
+
const m = ee(), b = !!(s && s.length > 0);
|
|
1510
|
+
return /* @__PURE__ */ a("tbody", { className: m.classes?.tbody || "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900", children: e.map((f, k) => {
|
|
1511
|
+
const C = l(f, k), D = i?.has(C), _ = typeof u == "function" ? u(f, k) : u || "";
|
|
1512
|
+
return /* @__PURE__ */ y(
|
|
1308
1513
|
"tr",
|
|
1309
1514
|
{
|
|
1310
|
-
onClick: (
|
|
1311
|
-
className: `${m.classes?.tr || "transition-colors duration-150"} ${d &&
|
|
1515
|
+
onClick: (x) => c?.(f, k, x),
|
|
1516
|
+
className: `${m.classes?.tr || "transition-colors duration-150"} ${d && k % 2 === 1 ? "bg-gray-50/40 dark:bg-slate-800/20" : ""} ${n ? "hover:bg-gray-50/70 dark:hover:bg-slate-800/50" : ""} ${D ? "bg-primary/5 dark:bg-primary/10" : ""} ${c ? "cursor-pointer" : ""} ${_}`,
|
|
1312
1517
|
children: [
|
|
1313
|
-
|
|
1518
|
+
r && /* @__PURE__ */ a(
|
|
1314
1519
|
"td",
|
|
1315
1520
|
{
|
|
1316
1521
|
className: "w-10 px-4 py-3 text-center align-middle",
|
|
1317
|
-
onClick: (
|
|
1318
|
-
children: /* @__PURE__ */
|
|
1522
|
+
onClick: (x) => x.stopPropagation(),
|
|
1523
|
+
children: /* @__PURE__ */ a(
|
|
1319
1524
|
"input",
|
|
1320
1525
|
{
|
|
1321
1526
|
type: "checkbox",
|
|
1322
|
-
checked:
|
|
1323
|
-
onChange: () => g?.(
|
|
1527
|
+
checked: D,
|
|
1528
|
+
onChange: () => g?.(C, f),
|
|
1324
1529
|
className: "w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary focus:ring-primary/30 cursor-pointer"
|
|
1325
1530
|
}
|
|
1326
1531
|
)
|
|
1327
1532
|
}
|
|
1328
1533
|
),
|
|
1329
|
-
t.map((
|
|
1330
|
-
const
|
|
1331
|
-
return /* @__PURE__ */
|
|
1534
|
+
t.map((x) => {
|
|
1535
|
+
const N = x.align === "center" ? "text-center" : x.align === "right" ? "text-right" : "text-left", w = typeof x.className == "function" ? x.className(f?.[x.key], f, k) : x.className || "";
|
|
1536
|
+
return /* @__PURE__ */ a(
|
|
1332
1537
|
"td",
|
|
1333
1538
|
{
|
|
1334
1539
|
style: {
|
|
1335
|
-
width:
|
|
1336
|
-
minWidth:
|
|
1337
|
-
maxWidth:
|
|
1540
|
+
width: x.width,
|
|
1541
|
+
minWidth: x.minWidth,
|
|
1542
|
+
maxWidth: x.maxWidth
|
|
1338
1543
|
},
|
|
1339
|
-
className: `${m.classes?.td || "py-3 px-4 text-sm align-middle"} ${
|
|
1340
|
-
children: /* @__PURE__ */
|
|
1544
|
+
className: `${m.classes?.td || "py-3 px-4 text-sm align-middle"} ${N} ${w}`,
|
|
1545
|
+
children: /* @__PURE__ */ a(kr, { row: f, column: x, rowIndex: k })
|
|
1341
1546
|
},
|
|
1342
|
-
String(
|
|
1547
|
+
String(x.key)
|
|
1343
1548
|
);
|
|
1344
1549
|
}),
|
|
1345
|
-
|
|
1550
|
+
b && /* @__PURE__ */ a(
|
|
1346
1551
|
"td",
|
|
1347
1552
|
{
|
|
1348
1553
|
className: `${m.classes?.td || "py-3 px-4 text-sm align-middle"} text-right`,
|
|
1349
|
-
onClick: (
|
|
1350
|
-
children: /* @__PURE__ */
|
|
1351
|
-
|
|
1554
|
+
onClick: (x) => x.stopPropagation(),
|
|
1555
|
+
children: /* @__PURE__ */ a(
|
|
1556
|
+
Nr,
|
|
1352
1557
|
{
|
|
1353
1558
|
row: f,
|
|
1354
|
-
actions:
|
|
1559
|
+
actions: s || [],
|
|
1355
1560
|
context: o
|
|
1356
1561
|
}
|
|
1357
1562
|
)
|
|
@@ -1359,93 +1564,93 @@ const qt = ({
|
|
|
1359
1564
|
)
|
|
1360
1565
|
]
|
|
1361
1566
|
},
|
|
1362
|
-
String(
|
|
1567
|
+
String(C)
|
|
1363
1568
|
);
|
|
1364
1569
|
}) });
|
|
1365
|
-
},
|
|
1570
|
+
}, Ar = ({
|
|
1366
1571
|
page: e,
|
|
1367
1572
|
pageSize: t,
|
|
1368
|
-
totalRecords:
|
|
1573
|
+
totalRecords: s,
|
|
1369
1574
|
totalPages: o,
|
|
1370
1575
|
pageSizeOptions: l = [5, 10, 20, 50, 100],
|
|
1371
|
-
onPageChange:
|
|
1576
|
+
onPageChange: r,
|
|
1372
1577
|
onPageSizeChange: i,
|
|
1373
1578
|
showPageSizeSelector: g = !0,
|
|
1374
1579
|
showTotalCount: c = !0,
|
|
1375
1580
|
pageWindow: d
|
|
1376
1581
|
}) => {
|
|
1377
|
-
const
|
|
1378
|
-
return /* @__PURE__ */
|
|
1582
|
+
const n = ee(), u = Math.min((e - 1) * t + 1, s), m = Math.min(e * t, s);
|
|
1583
|
+
return /* @__PURE__ */ y(
|
|
1379
1584
|
"div",
|
|
1380
1585
|
{
|
|
1381
|
-
className:
|
|
1586
|
+
className: n.classes?.paginationContainer || "w-full flex flex-wrap items-center justify-between gap-4 pt-4 text-sm text-gray-600 dark:text-gray-400",
|
|
1382
1587
|
children: [
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
c &&
|
|
1588
|
+
/* @__PURE__ */ y("div", { className: "flex items-center gap-3", children: [
|
|
1589
|
+
c && s > 0 ? /* @__PURE__ */ y("span", { className: "text-xs sm:text-sm font-medium", children: [
|
|
1385
1590
|
"Showing ",
|
|
1386
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ a("strong", { className: "text-gray-900 dark:text-white font-bold", children: u }),
|
|
1387
1592
|
" to",
|
|
1388
1593
|
" ",
|
|
1389
|
-
/* @__PURE__ */
|
|
1594
|
+
/* @__PURE__ */ a("strong", { className: "text-gray-900 dark:text-white font-bold", children: m }),
|
|
1390
1595
|
" of",
|
|
1391
1596
|
" ",
|
|
1392
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ a("strong", { className: "text-gray-900 dark:text-white font-bold", children: s.toLocaleString() }),
|
|
1393
1598
|
" results"
|
|
1394
|
-
] }) : /* @__PURE__ */
|
|
1599
|
+
] }) : /* @__PURE__ */ y("span", { className: "text-xs sm:text-sm font-medium", children: [
|
|
1395
1600
|
"Page ",
|
|
1396
1601
|
e,
|
|
1397
1602
|
" of ",
|
|
1398
1603
|
o
|
|
1399
1604
|
] }),
|
|
1400
|
-
g && /* @__PURE__ */
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1605
|
+
g && /* @__PURE__ */ y("div", { className: "flex items-center gap-2 ml-2", children: [
|
|
1606
|
+
/* @__PURE__ */ a("span", { className: "text-xs text-gray-500 hidden sm:inline", children: "Rows:" }),
|
|
1607
|
+
/* @__PURE__ */ a(
|
|
1403
1608
|
"select",
|
|
1404
1609
|
{
|
|
1405
1610
|
value: t,
|
|
1406
|
-
onChange: (
|
|
1407
|
-
className:
|
|
1408
|
-
children: l.map((
|
|
1409
|
-
|
|
1611
|
+
onChange: (b) => i(Number(b.target.value)),
|
|
1612
|
+
className: n.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",
|
|
1613
|
+
children: l.map((b) => /* @__PURE__ */ y("option", { value: b, className: "bg-white dark:bg-slate-800 text-gray-900 dark:text-white", children: [
|
|
1614
|
+
b,
|
|
1410
1615
|
" / page"
|
|
1411
|
-
] },
|
|
1616
|
+
] }, b))
|
|
1412
1617
|
}
|
|
1413
1618
|
)
|
|
1414
1619
|
] })
|
|
1415
1620
|
] }),
|
|
1416
|
-
/* @__PURE__ */
|
|
1417
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ y("div", { className: "flex items-center gap-1.5 ml-auto", children: [
|
|
1622
|
+
/* @__PURE__ */ a(
|
|
1418
1623
|
"button",
|
|
1419
1624
|
{
|
|
1420
1625
|
type: "button",
|
|
1421
1626
|
disabled: e <= 1,
|
|
1422
|
-
onClick: () =>
|
|
1627
|
+
onClick: () => r(e - 1),
|
|
1423
1628
|
"aria-label": "Previous Page",
|
|
1424
|
-
className: `${
|
|
1629
|
+
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"}`,
|
|
1425
1630
|
children: "‹"
|
|
1426
1631
|
}
|
|
1427
1632
|
),
|
|
1428
|
-
d.map((
|
|
1429
|
-
const
|
|
1430
|
-
return /* @__PURE__ */
|
|
1633
|
+
d.map((b) => {
|
|
1634
|
+
const f = b === e;
|
|
1635
|
+
return /* @__PURE__ */ a(
|
|
1431
1636
|
"button",
|
|
1432
1637
|
{
|
|
1433
1638
|
type: "button",
|
|
1434
|
-
onClick: () =>
|
|
1435
|
-
className: `${
|
|
1436
|
-
children:
|
|
1639
|
+
onClick: () => r(b),
|
|
1640
|
+
className: `${n.classes?.paginationButton || "h-8 min-w-[32px] px-2.5 flex items-center justify-center rounded-xl font-bold text-xs"} ${f ? n.classes?.paginationButtonActive || "bg-primary text-white shadow-sm shadow-primary/30" : "bg-gray-100 dark:bg-slate-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-slate-700"}`,
|
|
1641
|
+
children: b
|
|
1437
1642
|
},
|
|
1438
|
-
|
|
1643
|
+
b
|
|
1439
1644
|
);
|
|
1440
1645
|
}),
|
|
1441
|
-
/* @__PURE__ */
|
|
1646
|
+
/* @__PURE__ */ a(
|
|
1442
1647
|
"button",
|
|
1443
1648
|
{
|
|
1444
1649
|
type: "button",
|
|
1445
1650
|
disabled: e >= o,
|
|
1446
|
-
onClick: () =>
|
|
1651
|
+
onClick: () => r(e + 1),
|
|
1447
1652
|
"aria-label": "Next Page",
|
|
1448
|
-
className: `${
|
|
1653
|
+
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"}`,
|
|
1449
1654
|
children: "›"
|
|
1450
1655
|
}
|
|
1451
1656
|
)
|
|
@@ -1453,12 +1658,12 @@ const qt = ({
|
|
|
1453
1658
|
]
|
|
1454
1659
|
}
|
|
1455
1660
|
);
|
|
1456
|
-
},
|
|
1661
|
+
}, Cr = ({
|
|
1457
1662
|
columnsCount: e = 5,
|
|
1458
1663
|
rowsCount: t = 5,
|
|
1459
|
-
hasActions:
|
|
1460
|
-
}) => /* @__PURE__ */
|
|
1461
|
-
Array.from({ length: e }).map((
|
|
1664
|
+
hasActions: s = !0
|
|
1665
|
+
}) => /* @__PURE__ */ a("tbody", { className: "divide-y divide-gray-100 dark:divide-gray-800/60 bg-white dark:bg-slate-900", children: Array.from({ length: t }).map((o, l) => /* @__PURE__ */ y("tr", { className: "any-table-pulse", children: [
|
|
1666
|
+
Array.from({ length: e }).map((r, i) => /* @__PURE__ */ a("td", { className: "py-4 px-4 align-middle", children: /* @__PURE__ */ a(
|
|
1462
1667
|
"div",
|
|
1463
1668
|
{
|
|
1464
1669
|
className: "h-4 bg-gray-200 dark:bg-slate-700/60 rounded-md",
|
|
@@ -1467,20 +1672,20 @@ const qt = ({
|
|
|
1467
1672
|
}
|
|
1468
1673
|
}
|
|
1469
1674
|
) }, i)),
|
|
1470
|
-
|
|
1471
|
-
/* @__PURE__ */
|
|
1472
|
-
/* @__PURE__ */
|
|
1675
|
+
s && /* @__PURE__ */ a("td", { className: "py-4 px-4 text-right align-middle pr-6", children: /* @__PURE__ */ y("div", { className: "inline-flex gap-2 justify-end", children: [
|
|
1676
|
+
/* @__PURE__ */ a("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" }),
|
|
1677
|
+
/* @__PURE__ */ a("div", { className: "w-14 h-7 bg-gray-200 dark:bg-slate-700/60 rounded-xl" })
|
|
1473
1678
|
] }) })
|
|
1474
|
-
] }, l)) }),
|
|
1679
|
+
] }, l)) }), Sr = ({
|
|
1475
1680
|
title: e,
|
|
1476
1681
|
description: t,
|
|
1477
|
-
isSearchActive:
|
|
1682
|
+
isSearchActive: s = !1,
|
|
1478
1683
|
onClearSearch: o
|
|
1479
|
-
}) => /* @__PURE__ */
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
|
|
1684
|
+
}) => /* @__PURE__ */ y("div", { className: "w-full py-16 px-6 flex flex-col items-center justify-center text-center any-table-fade-in", children: [
|
|
1685
|
+
/* @__PURE__ */ a("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", children: s ? "🔍" : "📂" }),
|
|
1686
|
+
/* @__PURE__ */ a("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1", children: e || (s ? "No matching records found" : "No data available") }),
|
|
1687
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-sm mb-5 leading-relaxed", children: t || (s ? "Try adjusting your search criteria or clear the search filter." : "There are currently no records to display.") }),
|
|
1688
|
+
s && o && /* @__PURE__ */ a(
|
|
1484
1689
|
"button",
|
|
1485
1690
|
{
|
|
1486
1691
|
type: "button",
|
|
@@ -1489,145 +1694,148 @@ const qt = ({
|
|
|
1489
1694
|
children: "Clear Search Filter"
|
|
1490
1695
|
}
|
|
1491
1696
|
)
|
|
1492
|
-
] }),
|
|
1493
|
-
const
|
|
1494
|
-
return /* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
t && /* @__PURE__ */
|
|
1697
|
+
] }), Tr = ({ error: e, onRetry: t }) => {
|
|
1698
|
+
const s = typeof e == "string" ? e : e?.message || e?.response?.data?.message || "Failed to load table data.";
|
|
1699
|
+
return /* @__PURE__ */ y("div", { className: "w-full py-14 px-6 flex flex-col items-center justify-center text-center any-table-fade-in", children: [
|
|
1700
|
+
/* @__PURE__ */ a("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", children: "⚠️" }),
|
|
1701
|
+
/* @__PURE__ */ a("h3", { className: "text-lg font-bold text-gray-800 dark:text-gray-200 mb-1", children: "Unable to load data" }),
|
|
1702
|
+
/* @__PURE__ */ a("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", children: s }),
|
|
1703
|
+
t && /* @__PURE__ */ y(
|
|
1499
1704
|
"button",
|
|
1500
1705
|
{
|
|
1501
1706
|
type: "button",
|
|
1502
1707
|
onClick: t,
|
|
1503
1708
|
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",
|
|
1504
1709
|
children: [
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1710
|
+
/* @__PURE__ */ a("span", { children: "🔄" }),
|
|
1711
|
+
/* @__PURE__ */ a("span", { children: "Retry Request" })
|
|
1507
1712
|
]
|
|
1508
1713
|
}
|
|
1509
1714
|
)
|
|
1510
1715
|
] });
|
|
1511
1716
|
};
|
|
1512
|
-
function
|
|
1717
|
+
function qe(e) {
|
|
1513
1718
|
const {
|
|
1514
1719
|
data: t,
|
|
1515
|
-
api:
|
|
1720
|
+
api: s,
|
|
1516
1721
|
columns: o,
|
|
1517
1722
|
autoColumns: l = !0,
|
|
1518
|
-
rowKey:
|
|
1723
|
+
rowKey: r,
|
|
1519
1724
|
title: i,
|
|
1520
1725
|
subtitle: g,
|
|
1521
1726
|
actions: c,
|
|
1522
1727
|
actionsTitle: d = "Actions",
|
|
1523
|
-
actionsWidth:
|
|
1524
|
-
search:
|
|
1525
|
-
sorting:
|
|
1526
|
-
pagination:
|
|
1527
|
-
selectable:
|
|
1728
|
+
actionsWidth: n,
|
|
1729
|
+
search: u = !0,
|
|
1730
|
+
sorting: m = !0,
|
|
1731
|
+
pagination: b = !0,
|
|
1732
|
+
selectable: f = !1,
|
|
1528
1733
|
onSelectionChange: k,
|
|
1529
|
-
onRowClick:
|
|
1530
|
-
loading:
|
|
1531
|
-
loadingComponent:
|
|
1532
|
-
emptyComponent:
|
|
1734
|
+
onRowClick: C,
|
|
1735
|
+
loading: D,
|
|
1736
|
+
loadingComponent: _,
|
|
1737
|
+
emptyComponent: x,
|
|
1533
1738
|
emptyTitle: N,
|
|
1534
|
-
emptyDescription:
|
|
1535
|
-
errorComponent:
|
|
1739
|
+
emptyDescription: w,
|
|
1740
|
+
errorComponent: R,
|
|
1536
1741
|
className: H = "",
|
|
1537
|
-
tableClassName:
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1742
|
+
tableClassName: L = "",
|
|
1743
|
+
headerClassName: ye = "",
|
|
1744
|
+
rowClassName: j,
|
|
1745
|
+
headerActions: F,
|
|
1746
|
+
showHeader: U = !0,
|
|
1747
|
+
bordered: te = !0,
|
|
1748
|
+
striped: V = !1,
|
|
1749
|
+
hoverable: Y = !0,
|
|
1750
|
+
compact: K = !1,
|
|
1751
|
+
stickyHeader: Z = !1,
|
|
1752
|
+
tableRef: B,
|
|
1545
1753
|
// Legacy Wasel Props
|
|
1546
1754
|
thead: I,
|
|
1547
|
-
headerData:
|
|
1548
|
-
tbodys:
|
|
1549
|
-
titleHeader:
|
|
1550
|
-
add:
|
|
1551
|
-
linkAdd:
|
|
1552
|
-
addHandler:
|
|
1553
|
-
view:
|
|
1554
|
-
linkView:
|
|
1555
|
-
viewHandler:
|
|
1556
|
-
edit:
|
|
1557
|
-
linkEdit:
|
|
1558
|
-
editHandler:
|
|
1559
|
-
del:
|
|
1755
|
+
headerData: Pe,
|
|
1756
|
+
tbodys: Ee,
|
|
1757
|
+
titleHeader: st,
|
|
1758
|
+
add: Be,
|
|
1759
|
+
linkAdd: $e,
|
|
1760
|
+
addHandler: De,
|
|
1761
|
+
view: Me,
|
|
1762
|
+
linkView: re,
|
|
1763
|
+
viewHandler: ae,
|
|
1764
|
+
edit: _e,
|
|
1765
|
+
linkEdit: ne,
|
|
1766
|
+
editHandler: se,
|
|
1767
|
+
del: je,
|
|
1560
1768
|
handleDelete: he,
|
|
1561
|
-
block:
|
|
1769
|
+
block: Fe,
|
|
1562
1770
|
handleBlock: pe,
|
|
1563
|
-
buttons:
|
|
1564
|
-
} = e,
|
|
1565
|
-
data:
|
|
1771
|
+
buttons: oe
|
|
1772
|
+
} = e, v = ee(), ie = W(() => t || Ee || void 0, [t, Ee]), G = W(() => Ut({
|
|
1773
|
+
data: ie,
|
|
1566
1774
|
columns: o,
|
|
1567
1775
|
autoColumns: l,
|
|
1568
1776
|
thead: I,
|
|
1569
|
-
headerData:
|
|
1570
|
-
}).filter((
|
|
1571
|
-
(
|
|
1572
|
-
if (typeof
|
|
1573
|
-
return
|
|
1574
|
-
if (typeof
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1777
|
+
headerData: Pe
|
|
1778
|
+
}).filter((h) => typeof h.hidden == "function" ? !h.hidden({ data: ie || [] }) : !h.hidden), [ie, o, l, I, Pe]), O = A(
|
|
1779
|
+
(p, h) => {
|
|
1780
|
+
if (typeof r == "function")
|
|
1781
|
+
return r(p, h);
|
|
1782
|
+
if (typeof r == "string") {
|
|
1783
|
+
const M = P(p, r);
|
|
1784
|
+
if (M != null) return M;
|
|
1577
1785
|
}
|
|
1578
|
-
const
|
|
1579
|
-
return
|
|
1786
|
+
const E = p?._id ?? p?.id ?? p?.key;
|
|
1787
|
+
return E ?? h;
|
|
1580
1788
|
},
|
|
1581
|
-
[
|
|
1789
|
+
[r]
|
|
1582
1790
|
), {
|
|
1583
|
-
enabled:
|
|
1584
|
-
search:
|
|
1585
|
-
debouncedSearch:
|
|
1586
|
-
isDebouncing:
|
|
1587
|
-
setSearch:
|
|
1588
|
-
clearSearch:
|
|
1589
|
-
searchConfig:
|
|
1590
|
-
} =
|
|
1591
|
-
enabled:
|
|
1592
|
-
sortBy:
|
|
1791
|
+
enabled: We,
|
|
1792
|
+
search: Re,
|
|
1793
|
+
debouncedSearch: ze,
|
|
1794
|
+
isDebouncing: ot,
|
|
1795
|
+
setSearch: Le,
|
|
1796
|
+
clearSearch: xe,
|
|
1797
|
+
searchConfig: it
|
|
1798
|
+
} = Kt({ config: u }), {
|
|
1799
|
+
enabled: lt,
|
|
1800
|
+
sortBy: ke,
|
|
1593
1801
|
sortOrder: we,
|
|
1594
|
-
toggleSort:
|
|
1595
|
-
setSorting:
|
|
1596
|
-
resetSorting:
|
|
1597
|
-
} =
|
|
1598
|
-
const
|
|
1599
|
-
return
|
|
1600
|
-
|
|
1601
|
-
id: `legacy-btn-${
|
|
1602
|
-
label:
|
|
1603
|
-
icon:
|
|
1604
|
-
className:
|
|
1605
|
-
show:
|
|
1606
|
-
hide:
|
|
1607
|
-
onClick: (
|
|
1802
|
+
toggleSort: dt,
|
|
1803
|
+
setSorting: ct,
|
|
1804
|
+
resetSorting: gt
|
|
1805
|
+
} = It({ config: m }), Oe = W(() => {
|
|
1806
|
+
const p = [...c || []];
|
|
1807
|
+
return oe && Array.isArray(oe) && oe.forEach((h, E) => {
|
|
1808
|
+
p.push({
|
|
1809
|
+
id: `legacy-btn-${E}`,
|
|
1810
|
+
label: h.label,
|
|
1811
|
+
icon: h.icon,
|
|
1812
|
+
className: h.className,
|
|
1813
|
+
show: h.show,
|
|
1814
|
+
hide: h.hide,
|
|
1815
|
+
onClick: (M) => h.onClick(M)
|
|
1608
1816
|
});
|
|
1609
|
-
}),
|
|
1817
|
+
}), Fe && pe && p.push({
|
|
1610
1818
|
id: "legacy-block",
|
|
1611
|
-
label: (
|
|
1612
|
-
variant: (
|
|
1613
|
-
onClick: (
|
|
1614
|
-
}),
|
|
1819
|
+
label: (h) => h.isBanned || !h.isActive ? "Unblock" : "Block",
|
|
1820
|
+
variant: (h) => h.isBanned || !h.isActive ? "success" : "danger",
|
|
1821
|
+
onClick: (h) => pe(h?._id || h?.id)
|
|
1822
|
+
}), Me && (ae || re) && p.push({
|
|
1615
1823
|
id: "legacy-view",
|
|
1616
1824
|
label: "View",
|
|
1617
1825
|
variant: "primary",
|
|
1618
|
-
onClick: (
|
|
1619
|
-
const
|
|
1620
|
-
|
|
1826
|
+
onClick: (h) => {
|
|
1827
|
+
const E = h?._id || h?.id;
|
|
1828
|
+
ae ? ae(E) : re && typeof window < "u" && (window.location.href = `${re}/${E}`);
|
|
1621
1829
|
}
|
|
1622
|
-
}),
|
|
1830
|
+
}), _e && (se || ne) && p.push({
|
|
1623
1831
|
id: "legacy-edit",
|
|
1624
1832
|
label: "Edit",
|
|
1625
1833
|
variant: "info",
|
|
1626
|
-
onClick: (
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1834
|
+
onClick: (h) => {
|
|
1835
|
+
const E = h?._id || h?.id;
|
|
1836
|
+
se ? se(E) : ne && typeof window < "u" && (window.location.href = `${ne}/${E}`);
|
|
1629
1837
|
}
|
|
1630
|
-
}),
|
|
1838
|
+
}), je && he && p.push({
|
|
1631
1839
|
id: "legacy-del",
|
|
1632
1840
|
label: "Delete",
|
|
1633
1841
|
variant: "danger",
|
|
@@ -1635,296 +1843,311 @@ function pr(e) {
|
|
|
1635
1843
|
title: "Delete Item",
|
|
1636
1844
|
message: "Are you sure you want to delete this record?"
|
|
1637
1845
|
},
|
|
1638
|
-
onClick: (
|
|
1639
|
-
}),
|
|
1846
|
+
onClick: (h) => he(h?._id || h?.id)
|
|
1847
|
+
}), p;
|
|
1640
1848
|
}, [
|
|
1641
1849
|
c,
|
|
1642
|
-
|
|
1643
|
-
|
|
1850
|
+
oe,
|
|
1851
|
+
Fe,
|
|
1644
1852
|
pe,
|
|
1645
|
-
|
|
1853
|
+
Me,
|
|
1854
|
+
re,
|
|
1646
1855
|
ae,
|
|
1856
|
+
_e,
|
|
1647
1857
|
ne,
|
|
1648
|
-
Me,
|
|
1649
1858
|
se,
|
|
1650
|
-
|
|
1651
|
-
_e,
|
|
1859
|
+
je,
|
|
1652
1860
|
he
|
|
1653
|
-
]), [
|
|
1654
|
-
rows:
|
|
1655
|
-
totalRecords:
|
|
1656
|
-
loading:
|
|
1861
|
+
]), [mt, ut] = S(1), [bt, ft] = S(10), {
|
|
1862
|
+
rows: T,
|
|
1863
|
+
totalRecords: Ne,
|
|
1864
|
+
loading: le,
|
|
1657
1865
|
error: J,
|
|
1658
|
-
refresh:
|
|
1659
|
-
isServerMode:
|
|
1660
|
-
} =
|
|
1661
|
-
data:
|
|
1662
|
-
api:
|
|
1663
|
-
columns:
|
|
1664
|
-
searchQuery:
|
|
1665
|
-
sortBy:
|
|
1866
|
+
refresh: q,
|
|
1867
|
+
isServerMode: yt
|
|
1868
|
+
} = tr({
|
|
1869
|
+
data: ie,
|
|
1870
|
+
api: s,
|
|
1871
|
+
columns: G,
|
|
1872
|
+
searchQuery: ze,
|
|
1873
|
+
sortBy: ke,
|
|
1666
1874
|
sortOrder: we,
|
|
1667
|
-
page:
|
|
1668
|
-
pageSize:
|
|
1669
|
-
manualLoading:
|
|
1875
|
+
page: mt,
|
|
1876
|
+
pageSize: bt,
|
|
1877
|
+
manualLoading: D
|
|
1670
1878
|
}), {
|
|
1671
|
-
enabled:
|
|
1672
|
-
page:
|
|
1673
|
-
pageSize:
|
|
1674
|
-
totalPages:
|
|
1675
|
-
pageSizeOptions:
|
|
1676
|
-
setPage:
|
|
1677
|
-
setPageSize:
|
|
1678
|
-
resetPagination:
|
|
1679
|
-
getPageWindow:
|
|
1680
|
-
paginationConfig:
|
|
1681
|
-
} =
|
|
1682
|
-
config:
|
|
1683
|
-
totalRecords:
|
|
1684
|
-
onPageChange: (
|
|
1685
|
-
|
|
1879
|
+
enabled: ht,
|
|
1880
|
+
page: de,
|
|
1881
|
+
pageSize: ve,
|
|
1882
|
+
totalPages: He,
|
|
1883
|
+
pageSizeOptions: pt,
|
|
1884
|
+
setPage: ce,
|
|
1885
|
+
setPageSize: Ue,
|
|
1886
|
+
resetPagination: xt,
|
|
1887
|
+
getPageWindow: kt,
|
|
1888
|
+
paginationConfig: Ke
|
|
1889
|
+
} = Gt({
|
|
1890
|
+
config: b,
|
|
1891
|
+
totalRecords: Ne,
|
|
1892
|
+
onPageChange: (p, h) => {
|
|
1893
|
+
ut(p), ft(h);
|
|
1686
1894
|
}
|
|
1687
|
-
}), [
|
|
1688
|
-
(
|
|
1689
|
-
|
|
1690
|
-
const
|
|
1691
|
-
if (
|
|
1692
|
-
const
|
|
1693
|
-
k(
|
|
1895
|
+
}), [z, ge] = S(/* @__PURE__ */ new Set()), wt = A(
|
|
1896
|
+
(p, h) => {
|
|
1897
|
+
ge((E) => {
|
|
1898
|
+
const M = new Set(E);
|
|
1899
|
+
if (M.has(p) ? M.delete(p) : M.add(p), k) {
|
|
1900
|
+
const Pt = T.filter((Et, Bt) => M.has(O(Et, Bt)));
|
|
1901
|
+
k(Pt, Array.from(M));
|
|
1694
1902
|
}
|
|
1695
|
-
return
|
|
1903
|
+
return M;
|
|
1696
1904
|
});
|
|
1697
1905
|
},
|
|
1698
|
-
[
|
|
1699
|
-
),
|
|
1700
|
-
if (
|
|
1701
|
-
|
|
1906
|
+
[T, O, k]
|
|
1907
|
+
), Nt = A(() => {
|
|
1908
|
+
if (z.size === T.length && T.length > 0)
|
|
1909
|
+
ge(/* @__PURE__ */ new Set()), k?.([], []);
|
|
1702
1910
|
else {
|
|
1703
|
-
const
|
|
1704
|
-
|
|
1911
|
+
const p = new Set(T.map((h, E) => O(h, E)));
|
|
1912
|
+
ge(p), k?.(T, Array.from(p));
|
|
1705
1913
|
}
|
|
1706
|
-
}, [
|
|
1707
|
-
|
|
1708
|
-
}, [k]),
|
|
1914
|
+
}, [T, z.size, O, k]), vt = A(() => {
|
|
1915
|
+
ge(/* @__PURE__ */ new Set()), k?.([], []);
|
|
1916
|
+
}, [k]), At = T.length > 0 && z.size === T.length, Ct = z.size > 0 && z.size < T.length, Ae = W(
|
|
1709
1917
|
() => ({
|
|
1710
|
-
refresh:
|
|
1711
|
-
loading:
|
|
1712
|
-
page:
|
|
1713
|
-
selectedRows:
|
|
1714
|
-
setPage:
|
|
1918
|
+
refresh: q,
|
|
1919
|
+
loading: le,
|
|
1920
|
+
page: de,
|
|
1921
|
+
selectedRows: T.filter((p, h) => z.has(O(p, h))),
|
|
1922
|
+
setPage: ce
|
|
1715
1923
|
}),
|
|
1716
|
-
[
|
|
1924
|
+
[q, le, de, T, z, O, ce]
|
|
1717
1925
|
);
|
|
1718
|
-
|
|
1719
|
-
tableRef:
|
|
1720
|
-
refresh:
|
|
1721
|
-
resetPagination:
|
|
1722
|
-
resetSearch:
|
|
1723
|
-
resetSorting:
|
|
1724
|
-
setPage:
|
|
1725
|
-
setPageSize:
|
|
1726
|
-
setSearch:
|
|
1727
|
-
setSorting:
|
|
1728
|
-
selectedRows:
|
|
1729
|
-
clearSelection:
|
|
1926
|
+
rr({
|
|
1927
|
+
tableRef: B,
|
|
1928
|
+
refresh: q,
|
|
1929
|
+
resetPagination: xt,
|
|
1930
|
+
resetSearch: xe,
|
|
1931
|
+
resetSorting: gt,
|
|
1932
|
+
setPage: ce,
|
|
1933
|
+
setPageSize: Ue,
|
|
1934
|
+
setSearch: Le,
|
|
1935
|
+
setSorting: ct,
|
|
1936
|
+
selectedRows: Ae.selectedRows,
|
|
1937
|
+
clearSelection: vt,
|
|
1730
1938
|
getState: () => ({
|
|
1731
|
-
data:
|
|
1732
|
-
loading:
|
|
1939
|
+
data: T,
|
|
1940
|
+
loading: le,
|
|
1733
1941
|
error: J,
|
|
1734
|
-
page:
|
|
1735
|
-
pageSize:
|
|
1736
|
-
total:
|
|
1737
|
-
totalPages:
|
|
1738
|
-
search:
|
|
1739
|
-
sortBy:
|
|
1942
|
+
page: de,
|
|
1943
|
+
pageSize: ve,
|
|
1944
|
+
total: Ne,
|
|
1945
|
+
totalPages: He,
|
|
1946
|
+
search: Re,
|
|
1947
|
+
sortBy: ke,
|
|
1740
1948
|
sortOrder: we,
|
|
1741
|
-
selectedRowKeys: Array.from(
|
|
1742
|
-
selectedRows:
|
|
1743
|
-
isServerMode:
|
|
1949
|
+
selectedRowKeys: Array.from(z),
|
|
1950
|
+
selectedRows: Ae.selectedRows,
|
|
1951
|
+
isServerMode: yt
|
|
1744
1952
|
})
|
|
1745
1953
|
});
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1954
|
+
const X = i || st, me = Oe.length > 0, St = !!(X || g || We || F || Be), Tt = W(() => {
|
|
1955
|
+
const p = {};
|
|
1956
|
+
return v.borderRadius && (p["--any-table-radius"] = v.borderRadius), v.fontFamily && (p["--any-table-font"] = v.fontFamily, p.fontFamily = v.fontFamily), v.colors?.primary && (p["--any-table-primary"] = v.colors.primary), v.colors?.primaryHover && (p["--any-table-primary-hover"] = v.colors.primaryHover), v.colors?.border && (p["--any-table-border"] = v.colors.border), p;
|
|
1957
|
+
}, [v]);
|
|
1958
|
+
return /* @__PURE__ */ y(
|
|
1959
|
+
"div",
|
|
1960
|
+
{
|
|
1961
|
+
style: Tt,
|
|
1962
|
+
className: `any-table-wrapper ${v.classes?.container || "w-full flex flex-col gap-4 font-sans text-gray-900 dark:text-gray-100"} ${H}`,
|
|
1963
|
+
children: [
|
|
1964
|
+
St && /* @__PURE__ */ y("div", { className: "w-full flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-1", children: [
|
|
1965
|
+
(X || g) && /* @__PURE__ */ y("div", { className: "flex flex-col", children: [
|
|
1966
|
+
X && /* @__PURE__ */ a("h3", { className: "text-lg font-bold tracking-tight text-gray-900 dark:text-white flex items-center gap-2", children: X }),
|
|
1967
|
+
g && /* @__PURE__ */ a("p", { className: "text-xs text-gray-500 dark:text-gray-400 mt-0.5", children: g })
|
|
1968
|
+
] }),
|
|
1969
|
+
/* @__PURE__ */ y("div", { className: "flex flex-wrap items-center gap-3 w-full sm:w-auto justify-start sm:justify-end ml-auto", children: [
|
|
1970
|
+
We && /* @__PURE__ */ a(
|
|
1971
|
+
nr,
|
|
1972
|
+
{
|
|
1973
|
+
value: Re,
|
|
1974
|
+
onChange: Le,
|
|
1975
|
+
onClear: xe,
|
|
1976
|
+
isDebouncing: ot,
|
|
1977
|
+
placeholder: it.placeholder
|
|
1978
|
+
}
|
|
1979
|
+
),
|
|
1980
|
+
F,
|
|
1981
|
+
Be && /* @__PURE__ */ y(
|
|
1982
|
+
"button",
|
|
1983
|
+
{
|
|
1984
|
+
type: "button",
|
|
1985
|
+
onClick: () => {
|
|
1986
|
+
De ? De() : $e && typeof window < "u" && (window.location.href = $e);
|
|
1987
|
+
},
|
|
1988
|
+
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",
|
|
1989
|
+
children: [
|
|
1990
|
+
/* @__PURE__ */ a("span", { children: "+" }),
|
|
1991
|
+
/* @__PURE__ */ y("span", { children: [
|
|
1992
|
+
"Add ",
|
|
1993
|
+
X || "Record"
|
|
1994
|
+
] })
|
|
1995
|
+
]
|
|
1996
|
+
}
|
|
1997
|
+
)
|
|
1998
|
+
] })
|
|
1753
1999
|
] }),
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
/* @__PURE__ */ b("div", { className: "flex flex-wrap items-center gap-3 w-full sm:w-auto justify-start sm:justify-end ml-auto", children: [
|
|
1757
|
-
je && /* @__PURE__ */ s(
|
|
1758
|
-
qt,
|
|
1759
|
-
{
|
|
1760
|
-
value: ze,
|
|
1761
|
-
onChange: Oe,
|
|
1762
|
-
onClear: ke,
|
|
1763
|
-
isDebouncing: qe,
|
|
1764
|
-
placeholder: Xe.placeholder
|
|
1765
|
-
}
|
|
1766
|
-
),
|
|
1767
|
-
te,
|
|
1768
|
-
Pe && /* @__PURE__ */ b(
|
|
1769
|
-
"button",
|
|
1770
|
-
{
|
|
1771
|
-
type: "button",
|
|
1772
|
-
onClick: () => {
|
|
1773
|
-
$e ? $e() : Ee && typeof window < "u" && (window.location.href = Ee);
|
|
1774
|
-
},
|
|
1775
|
-
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",
|
|
1776
|
-
children: [
|
|
1777
|
-
/* @__PURE__ */ s("span", { children: "+" }),
|
|
1778
|
-
/* @__PURE__ */ b("span", { children: [
|
|
1779
|
-
"Add ",
|
|
1780
|
-
q || "Record"
|
|
1781
|
-
] })
|
|
1782
|
-
]
|
|
1783
|
-
}
|
|
1784
|
-
)
|
|
1785
|
-
] })
|
|
1786
|
-
] }),
|
|
1787
|
-
/* @__PURE__ */ s(
|
|
1788
|
-
"div",
|
|
1789
|
-
{
|
|
1790
|
-
className: `${xe.classes?.tableWrapper || "w-full overflow-x-auto rounded-2xl border bg-white dark:bg-slate-900"} ${z ? "border border-gray-200 dark:border-gray-800" : ""}`,
|
|
1791
|
-
children: J ? typeof j == "function" ? j(J, Z) : j || /* @__PURE__ */ s(hr, { error: J, onRetry: Z }) : /* @__PURE__ */ b(
|
|
1792
|
-
"table",
|
|
2000
|
+
/* @__PURE__ */ a(
|
|
2001
|
+
"div",
|
|
1793
2002
|
{
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2003
|
+
style: v.borderRadius ? { borderRadius: v.borderRadius } : void 0,
|
|
2004
|
+
className: `${v.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"} ${te ? "border border-gray-200 dark:border-gray-800" : "border-0 shadow-none"}`,
|
|
2005
|
+
children: J ? typeof R == "function" ? R(J, q) : R || /* @__PURE__ */ a(Tr, { error: J, onRetry: q }) : /* @__PURE__ */ y(
|
|
2006
|
+
"table",
|
|
2007
|
+
{
|
|
2008
|
+
className: `${v.classes?.table || "w-full border-collapse text-left text-sm"} ${K || v.density === "compact" ? "text-xs" : ""} ${Z ? "relative" : ""} ${L}`,
|
|
2009
|
+
children: [
|
|
2010
|
+
U && /* @__PURE__ */ a(
|
|
2011
|
+
sr,
|
|
2012
|
+
{
|
|
2013
|
+
columns: G,
|
|
2014
|
+
hasActions: me,
|
|
2015
|
+
actionsTitle: d,
|
|
2016
|
+
actionsWidth: n,
|
|
2017
|
+
sortBy: ke,
|
|
2018
|
+
sortOrder: we,
|
|
2019
|
+
onSort: lt ? dt : void 0,
|
|
2020
|
+
selectable: f,
|
|
2021
|
+
allSelected: At,
|
|
2022
|
+
isIndeterminate: Ct,
|
|
2023
|
+
onToggleSelectAll: Nt,
|
|
2024
|
+
headerClassName: ye
|
|
2025
|
+
}
|
|
2026
|
+
),
|
|
2027
|
+
le && T.length === 0 ? _ ? /* @__PURE__ */ a("tbody", { children: /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: G.length + (f ? 1 : 0) + (me ? 1 : 0), children: _ }) }) }) : /* @__PURE__ */ a(
|
|
2028
|
+
Cr,
|
|
2029
|
+
{
|
|
2030
|
+
columnsCount: G.length + (f ? 1 : 0),
|
|
2031
|
+
rowsCount: ve || 5,
|
|
2032
|
+
hasActions: me
|
|
2033
|
+
}
|
|
2034
|
+
) : T.length === 0 ? (
|
|
2035
|
+
/* Empty State */
|
|
2036
|
+
/* @__PURE__ */ a("tbody", { children: /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
|
|
2037
|
+
"td",
|
|
1828
2038
|
{
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
2039
|
+
colSpan: G.length + (f ? 1 : 0) + (me ? 1 : 0),
|
|
2040
|
+
className: "p-0",
|
|
2041
|
+
children: x || /* @__PURE__ */ a(
|
|
2042
|
+
Sr,
|
|
2043
|
+
{
|
|
2044
|
+
title: N,
|
|
2045
|
+
description: w,
|
|
2046
|
+
isSearchActive: !!ze,
|
|
2047
|
+
onClearSearch: xe
|
|
2048
|
+
}
|
|
2049
|
+
)
|
|
2050
|
+
}
|
|
2051
|
+
) }) })
|
|
2052
|
+
) : (
|
|
2053
|
+
/* Body Rows */
|
|
2054
|
+
/* @__PURE__ */ a(
|
|
2055
|
+
vr,
|
|
2056
|
+
{
|
|
2057
|
+
rows: T,
|
|
2058
|
+
columns: G,
|
|
2059
|
+
actions: Oe,
|
|
2060
|
+
actionContext: Ae,
|
|
2061
|
+
rowKeyResolver: O,
|
|
2062
|
+
selectable: f,
|
|
2063
|
+
selectedKeys: z,
|
|
2064
|
+
onToggleSelectRow: wt,
|
|
2065
|
+
onRowClick: C,
|
|
2066
|
+
striped: V,
|
|
2067
|
+
hoverable: Y,
|
|
2068
|
+
rowClassName: j
|
|
1833
2069
|
}
|
|
1834
2070
|
)
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
)
|
|
1855
|
-
)
|
|
1856
|
-
]
|
|
2071
|
+
)
|
|
2072
|
+
]
|
|
2073
|
+
}
|
|
2074
|
+
)
|
|
2075
|
+
}
|
|
2076
|
+
),
|
|
2077
|
+
ht && !J && /* @__PURE__ */ a(
|
|
2078
|
+
Ar,
|
|
2079
|
+
{
|
|
2080
|
+
page: de,
|
|
2081
|
+
pageSize: ve,
|
|
2082
|
+
totalRecords: Ne,
|
|
2083
|
+
totalPages: He,
|
|
2084
|
+
pageSizeOptions: pt,
|
|
2085
|
+
onPageChange: ce,
|
|
2086
|
+
onPageSizeChange: Ue,
|
|
2087
|
+
showPageSizeSelector: Ke.showPageSizeSelector,
|
|
2088
|
+
showTotalCount: Ke.showTotalCount,
|
|
2089
|
+
pageWindow: kt(5)
|
|
1857
2090
|
}
|
|
1858
2091
|
)
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
fr,
|
|
1863
|
-
{
|
|
1864
|
-
page: ce,
|
|
1865
|
-
pageSize: Ae,
|
|
1866
|
-
totalRecords: ve,
|
|
1867
|
-
totalPages: Ie,
|
|
1868
|
-
pageSizeOptions: dt,
|
|
1869
|
-
onPageChange: ge,
|
|
1870
|
-
onPageSizeChange: Fe,
|
|
1871
|
-
showPageSizeSelector: He.showPageSizeSelector,
|
|
1872
|
-
showTotalCount: He.showTotalCount,
|
|
1873
|
-
pageWindow: gt(5)
|
|
1874
|
-
}
|
|
1875
|
-
)
|
|
1876
|
-
] });
|
|
2092
|
+
]
|
|
2093
|
+
}
|
|
2094
|
+
);
|
|
1877
2095
|
}
|
|
1878
|
-
function
|
|
1879
|
-
return /* @__PURE__ */
|
|
2096
|
+
function Br(e) {
|
|
2097
|
+
return !e.theme && !e.preset ? /* @__PURE__ */ a(qe, { ...e }) : /* @__PURE__ */ a(ar, { theme: e.theme, preset: e.preset, children: /* @__PURE__ */ a(qe, { ...e }) });
|
|
1880
2098
|
}
|
|
1881
2099
|
export {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
or as
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2100
|
+
Nr as ActionRenderer,
|
|
2101
|
+
Br as AnyTable,
|
|
2102
|
+
qe as AnyTableInner,
|
|
2103
|
+
ar as AnyTableThemeProvider,
|
|
2104
|
+
mr as ArrayRenderer,
|
|
2105
|
+
xr as BadgeRenderer,
|
|
2106
|
+
ir as BooleanRenderer,
|
|
2107
|
+
kr as CellRenderer,
|
|
2108
|
+
wr as ConfirmModal,
|
|
2109
|
+
lr as CurrencyRenderer,
|
|
2110
|
+
tt as DEFAULT_THEME_COLORS,
|
|
2111
|
+
Ye as DateRenderer,
|
|
2112
|
+
fr as EmailRenderer,
|
|
2113
|
+
$ as FallbackPlaceholder,
|
|
2114
|
+
dr as ImageRenderer,
|
|
2115
|
+
or as NumberRenderer,
|
|
2116
|
+
ur as ObjectRenderer,
|
|
2117
|
+
yr as PhoneRenderer,
|
|
2118
|
+
hr as ProgressRenderer,
|
|
2119
|
+
pr as RatingRenderer,
|
|
2120
|
+
gr as StatusRenderer,
|
|
2121
|
+
at as StringRenderer,
|
|
2122
|
+
Ve as TABLE_PRESETS,
|
|
2123
|
+
vr as TableBody,
|
|
2124
|
+
Sr as TableEmptyState,
|
|
2125
|
+
Tr as TableErrorState,
|
|
2126
|
+
sr as TableHeader,
|
|
2127
|
+
Ar as TablePagination,
|
|
2128
|
+
nr as TableSearch,
|
|
2129
|
+
Cr as TableSkeleton,
|
|
2130
|
+
br as UrlRenderer,
|
|
2131
|
+
Br as default,
|
|
2132
|
+
rt as defaultAnyTableTheme,
|
|
2133
|
+
Q as extractPaginationMeta,
|
|
2134
|
+
Qt as filterRowsBySearch,
|
|
2135
|
+
Ot as generateAutoColumns,
|
|
2136
|
+
P as getNestedValue,
|
|
1915
2137
|
be as inferColumnType,
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
2138
|
+
Ie as isImageUrl,
|
|
2139
|
+
zt as isIsoDate,
|
|
2140
|
+
_t as isPlainObject,
|
|
2141
|
+
Xt as normalizeApiResponse,
|
|
2142
|
+
nt as renderActionIcon,
|
|
2143
|
+
Ut as resolveColumns,
|
|
2144
|
+
er as sortRows,
|
|
2145
|
+
ue as toTitleCase,
|
|
2146
|
+
rr as useAnyTableController,
|
|
2147
|
+
tr as useAnyTableData,
|
|
2148
|
+
Gt as useAnyTablePagination,
|
|
2149
|
+
Kt as useAnyTableSearch,
|
|
2150
|
+
It as useAnyTableSorting,
|
|
1928
2151
|
ee as useAnyTableTheme
|
|
1929
2152
|
};
|
|
1930
2153
|
//# sourceMappingURL=index.js.map
|