@pravinrd/awesome-grid 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -0
- package/dist-lib/awesome-grid.css +1 -0
- package/dist-lib/html2canvas.esm-CUkZERmf.cjs +22 -0
- package/dist-lib/html2canvas.esm-Dmi1NfiH.js +4871 -0
- package/dist-lib/index.cjs +25 -0
- package/dist-lib/index.es-DQYViHdZ.js +6682 -0
- package/dist-lib/index.es-DSWSDLnm.cjs +18 -0
- package/dist-lib/index.js +1467 -0
- package/dist-lib/jspdf.es.min-C0D3oDUy.cjs +193 -0
- package/dist-lib/jspdf.es.min-DVZuwoNv.js +9965 -0
- package/dist-lib/jspdf.plugin.autotable-A1eGW8GI.cjs +2 -0
- package/dist-lib/jspdf.plugin.autotable-D7eVZU2H.js +1084 -0
- package/dist-lib/purify.es-BpFm6ZGf.js +553 -0
- package/dist-lib/purify.es-Cv8QDpGd.cjs +2 -0
- package/dist-lib/vite.svg +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,1467 @@
|
|
|
1
|
+
import Mt, { useRef as ae, useState as y, useDeferredValue as Pt, useTransition as It, useMemo as H, useEffect as $, useCallback as we, useLayoutEffect as ut } from "react";
|
|
2
|
+
var Fe = { exports: {} }, Se = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var dt;
|
|
13
|
+
function $t() {
|
|
14
|
+
if (dt) return Se;
|
|
15
|
+
dt = 1;
|
|
16
|
+
var u = Symbol.for("react.transitional.element"), x = Symbol.for("react.fragment");
|
|
17
|
+
function v(O, j, N) {
|
|
18
|
+
var z = null;
|
|
19
|
+
if (N !== void 0 && (z = "" + N), j.key !== void 0 && (z = "" + j.key), "key" in j) {
|
|
20
|
+
N = {};
|
|
21
|
+
for (var Y in j)
|
|
22
|
+
Y !== "key" && (N[Y] = j[Y]);
|
|
23
|
+
} else N = j;
|
|
24
|
+
return j = N.ref, {
|
|
25
|
+
$$typeof: u,
|
|
26
|
+
type: O,
|
|
27
|
+
key: z,
|
|
28
|
+
ref: j !== void 0 ? j : null,
|
|
29
|
+
props: N
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return Se.Fragment = x, Se.jsx = v, Se.jsxs = v, Se;
|
|
33
|
+
}
|
|
34
|
+
var Ce = {};
|
|
35
|
+
/**
|
|
36
|
+
* @license React
|
|
37
|
+
* react-jsx-runtime.development.js
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the MIT license found in the
|
|
42
|
+
* LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
var ht;
|
|
45
|
+
function Lt() {
|
|
46
|
+
return ht || (ht = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
+
function u(o) {
|
|
48
|
+
if (o == null) return null;
|
|
49
|
+
if (typeof o == "function")
|
|
50
|
+
return o.$$typeof === S ? null : o.displayName || o.name || null;
|
|
51
|
+
if (typeof o == "string") return o;
|
|
52
|
+
switch (o) {
|
|
53
|
+
case be:
|
|
54
|
+
return "Fragment";
|
|
55
|
+
case Ge:
|
|
56
|
+
return "Profiler";
|
|
57
|
+
case g:
|
|
58
|
+
return "StrictMode";
|
|
59
|
+
case xe:
|
|
60
|
+
return "Suspense";
|
|
61
|
+
case X:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case Ve:
|
|
64
|
+
return "Activity";
|
|
65
|
+
}
|
|
66
|
+
if (typeof o == "object")
|
|
67
|
+
switch (typeof o.tag == "number" && console.error(
|
|
68
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
+
), o.$$typeof) {
|
|
70
|
+
case ie:
|
|
71
|
+
return "Portal";
|
|
72
|
+
case te:
|
|
73
|
+
return o.displayName || "Context";
|
|
74
|
+
case L:
|
|
75
|
+
return (o._context.displayName || "Context") + ".Consumer";
|
|
76
|
+
case ye:
|
|
77
|
+
var c = o.render;
|
|
78
|
+
return o = o.displayName, o || (o = c.displayName || c.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
79
|
+
case G:
|
|
80
|
+
return c = o.displayName || null, c !== null ? c : u(o.type) || "Memo";
|
|
81
|
+
case re:
|
|
82
|
+
c = o._payload, o = o._init;
|
|
83
|
+
try {
|
|
84
|
+
return u(o(c));
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function x(o) {
|
|
91
|
+
return "" + o;
|
|
92
|
+
}
|
|
93
|
+
function v(o) {
|
|
94
|
+
try {
|
|
95
|
+
x(o);
|
|
96
|
+
var c = !1;
|
|
97
|
+
} catch {
|
|
98
|
+
c = !0;
|
|
99
|
+
}
|
|
100
|
+
if (c) {
|
|
101
|
+
c = console;
|
|
102
|
+
var f = c.error, _ = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
103
|
+
return f.call(
|
|
104
|
+
c,
|
|
105
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
+
_
|
|
107
|
+
), x(o);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function O(o) {
|
|
111
|
+
if (o === be) return "<>";
|
|
112
|
+
if (typeof o == "object" && o !== null && o.$$typeof === re)
|
|
113
|
+
return "<...>";
|
|
114
|
+
try {
|
|
115
|
+
var c = u(o);
|
|
116
|
+
return c ? "<" + c + ">" : "<...>";
|
|
117
|
+
} catch {
|
|
118
|
+
return "<...>";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function j() {
|
|
122
|
+
var o = ve.A;
|
|
123
|
+
return o === null ? null : o.getOwner();
|
|
124
|
+
}
|
|
125
|
+
function N() {
|
|
126
|
+
return Error("react-stack-top-frame");
|
|
127
|
+
}
|
|
128
|
+
function z(o) {
|
|
129
|
+
if (Oe.call(o, "key")) {
|
|
130
|
+
var c = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
131
|
+
if (c && c.isReactWarning) return !1;
|
|
132
|
+
}
|
|
133
|
+
return o.key !== void 0;
|
|
134
|
+
}
|
|
135
|
+
function Y(o, c) {
|
|
136
|
+
function f() {
|
|
137
|
+
ne || (ne = !0, console.error(
|
|
138
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
+
c
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
f.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
143
|
+
get: f,
|
|
144
|
+
configurable: !0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function _e() {
|
|
148
|
+
var o = u(this.type);
|
|
149
|
+
return ce[o] || (ce[o] = !0, console.error(
|
|
150
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
|
+
)), o = this.props.ref, o !== void 0 ? o : null;
|
|
152
|
+
}
|
|
153
|
+
function se(o, c, f, _, B, de) {
|
|
154
|
+
var b = f.ref;
|
|
155
|
+
return o = {
|
|
156
|
+
$$typeof: Ee,
|
|
157
|
+
type: o,
|
|
158
|
+
key: c,
|
|
159
|
+
props: f,
|
|
160
|
+
_owner: _
|
|
161
|
+
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(o, "ref", {
|
|
162
|
+
enumerable: !1,
|
|
163
|
+
get: _e
|
|
164
|
+
}) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: 0
|
|
169
|
+
}), Object.defineProperty(o, "_debugInfo", {
|
|
170
|
+
configurable: !1,
|
|
171
|
+
enumerable: !1,
|
|
172
|
+
writable: !0,
|
|
173
|
+
value: null
|
|
174
|
+
}), Object.defineProperty(o, "_debugStack", {
|
|
175
|
+
configurable: !1,
|
|
176
|
+
enumerable: !1,
|
|
177
|
+
writable: !0,
|
|
178
|
+
value: B
|
|
179
|
+
}), Object.defineProperty(o, "_debugTask", {
|
|
180
|
+
configurable: !1,
|
|
181
|
+
enumerable: !1,
|
|
182
|
+
writable: !0,
|
|
183
|
+
value: de
|
|
184
|
+
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
185
|
+
}
|
|
186
|
+
function ee(o, c, f, _, B, de) {
|
|
187
|
+
var b = c.children;
|
|
188
|
+
if (b !== void 0)
|
|
189
|
+
if (_)
|
|
190
|
+
if (Ae(b)) {
|
|
191
|
+
for (_ = 0; _ < b.length; _++)
|
|
192
|
+
le(b[_]);
|
|
193
|
+
Object.freeze && Object.freeze(b);
|
|
194
|
+
} else
|
|
195
|
+
console.error(
|
|
196
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
|
+
);
|
|
198
|
+
else le(b);
|
|
199
|
+
if (Oe.call(c, "key")) {
|
|
200
|
+
b = u(o);
|
|
201
|
+
var C = Object.keys(c).filter(function(U) {
|
|
202
|
+
return U !== "key";
|
|
203
|
+
});
|
|
204
|
+
_ = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", oe[b + _] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
206
|
+
let props = %s;
|
|
207
|
+
<%s {...props} />
|
|
208
|
+
React keys must be passed directly to JSX without using spread:
|
|
209
|
+
let props = %s;
|
|
210
|
+
<%s key={someKey} {...props} />`,
|
|
211
|
+
_,
|
|
212
|
+
b,
|
|
213
|
+
C,
|
|
214
|
+
b
|
|
215
|
+
), oe[b + _] = !0);
|
|
216
|
+
}
|
|
217
|
+
if (b = null, f !== void 0 && (v(f), b = "" + f), z(c) && (v(c.key), b = "" + c.key), "key" in c) {
|
|
218
|
+
f = {};
|
|
219
|
+
for (var ke in c)
|
|
220
|
+
ke !== "key" && (f[ke] = c[ke]);
|
|
221
|
+
} else f = c;
|
|
222
|
+
return b && Y(
|
|
223
|
+
f,
|
|
224
|
+
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
|
|
225
|
+
), se(
|
|
226
|
+
o,
|
|
227
|
+
b,
|
|
228
|
+
f,
|
|
229
|
+
j(),
|
|
230
|
+
B,
|
|
231
|
+
de
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
function le(o) {
|
|
235
|
+
Re(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === re && (o._payload.status === "fulfilled" ? Re(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
|
|
236
|
+
}
|
|
237
|
+
function Re(o) {
|
|
238
|
+
return typeof o == "object" && o !== null && o.$$typeof === Ee;
|
|
239
|
+
}
|
|
240
|
+
var J = Mt, Ee = Symbol.for("react.transitional.element"), ie = Symbol.for("react.portal"), be = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), Ge = Symbol.for("react.profiler"), L = Symbol.for("react.consumer"), te = Symbol.for("react.context"), ye = Symbol.for("react.forward_ref"), xe = Symbol.for("react.suspense"), X = Symbol.for("react.suspense_list"), G = Symbol.for("react.memo"), re = Symbol.for("react.lazy"), Ve = Symbol.for("react.activity"), S = Symbol.for("react.client.reference"), ve = J.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Oe = Object.prototype.hasOwnProperty, Ae = Array.isArray, R = console.createTask ? console.createTask : function() {
|
|
241
|
+
return null;
|
|
242
|
+
};
|
|
243
|
+
J = {
|
|
244
|
+
react_stack_bottom_frame: function(o) {
|
|
245
|
+
return o();
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var ne, ce = {}, ue = J.react_stack_bottom_frame.bind(
|
|
249
|
+
J,
|
|
250
|
+
N
|
|
251
|
+
)(), V = R(O(N)), oe = {};
|
|
252
|
+
Ce.Fragment = be, Ce.jsx = function(o, c, f) {
|
|
253
|
+
var _ = 1e4 > ve.recentlyCreatedOwnerStacks++;
|
|
254
|
+
return ee(
|
|
255
|
+
o,
|
|
256
|
+
c,
|
|
257
|
+
f,
|
|
258
|
+
!1,
|
|
259
|
+
_ ? Error("react-stack-top-frame") : ue,
|
|
260
|
+
_ ? R(O(o)) : V
|
|
261
|
+
);
|
|
262
|
+
}, Ce.jsxs = function(o, c, f) {
|
|
263
|
+
var _ = 1e4 > ve.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return ee(
|
|
265
|
+
o,
|
|
266
|
+
c,
|
|
267
|
+
f,
|
|
268
|
+
!0,
|
|
269
|
+
_ ? Error("react-stack-top-frame") : ue,
|
|
270
|
+
_ ? R(O(o)) : V
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
})()), Ce;
|
|
274
|
+
}
|
|
275
|
+
var mt;
|
|
276
|
+
function Bt() {
|
|
277
|
+
return mt || (mt = 1, process.env.NODE_ENV === "production" ? Fe.exports = $t() : Fe.exports = Lt()), Fe.exports;
|
|
278
|
+
}
|
|
279
|
+
var r = Bt();
|
|
280
|
+
const Ft = "_container_dihwe_1", Wt = "_themeLight_dihwe_10", zt = "_themeDark_dihwe_29", Gt = "_themePurple_dihwe_48", Vt = "_headerRow_dihwe_67", Ut = "_flexRow_dihwe_76", Ht = "_toolbarGroup_dihwe_82", Yt = "_dropdown_dihwe_86", Jt = "_buttonBase_dihwe_90", Xt = "_buttonPrimary_dihwe_101", qt = "_buttonDanger_dihwe_111", Kt = "_buttonMuted_dihwe_121", Zt = "_dropdownToggle_dihwe_142", Qt = "_dropdownMenu_dihwe_147", er = "_dropdownMenuOpen_dihwe_163", tr = "_menuItemButton_dihwe_167", rr = "_labelMuted_dihwe_185", nr = "_selectSmall_dihwe_190", or = "_selectAuto_dihwe_199", ar = "_switchRow_dihwe_203", sr = "_groupingSummary_dihwe_210", lr = "_relative_dihwe_217", ir = "_overlay_dihwe_221", cr = "_overlayInner_dihwe_229", ur = "_spinner_dihwe_236", dr = "_tableWrap_dihwe_252", hr = "_tableWrapAll_dihwe_256", mr = "_table_dihwe_252", pr = "_tableHead_dihwe_278", gr = "_thCellTop_dihwe_282", fr = "_thCellFilter_dihwe_290", wr = "_thInner_dihwe_297", _r = "_resizeHandle_dihwe_303", br = "_sortButton_dihwe_328", yr = "_iconMuted_dihwe_338", xr = "_inlineGroup_dihwe_342", vr = "_input_dihwe_350", kr = "_rowInteractive_dihwe_362", jr = "_groupRow_dihwe_375", Nr = "_groupRowAnimated_dihwe_382", Sr = "_groupChildRow_dihwe_386", Cr = "_groupToggle_dihwe_390", Tr = "_groupMeta_dihwe_430", Rr = "_checkbox_dihwe_438", Er = "_dangerText_dihwe_443", Or = "_tfoot_dihwe_447", Ar = "_textCenter_dihwe_455", Dr = "_paginationWrap_dihwe_459", Mr = "_pagination_dihwe_459", Pr = "_pageButton_dihwe_473", Ir = "_pageButtonActive_dihwe_488", $r = "_backdrop_dihwe_494", Lr = "_drawer_dihwe_500", Br = "_drawerTitle_dihwe_515", Fr = "_drawerSection_dihwe_521", Wr = "_drawerSubtitle_dihwe_527", zr = "_sectionToggle_dihwe_534", Gr = "_sectionBody_dihwe_547", Vr = "_drawerRow_dihwe_551", Ur = "_spacerAuto_dihwe_558", Hr = "_successText_dihwe_562", Yr = "_srOnly_dihwe_570", a = {
|
|
281
|
+
container: Ft,
|
|
282
|
+
themeLight: Wt,
|
|
283
|
+
themeDark: zt,
|
|
284
|
+
themePurple: Gt,
|
|
285
|
+
headerRow: Vt,
|
|
286
|
+
flexRow: Ut,
|
|
287
|
+
toolbarGroup: Ht,
|
|
288
|
+
dropdown: Yt,
|
|
289
|
+
buttonBase: Jt,
|
|
290
|
+
buttonPrimary: Xt,
|
|
291
|
+
buttonDanger: qt,
|
|
292
|
+
buttonMuted: Kt,
|
|
293
|
+
dropdownToggle: Zt,
|
|
294
|
+
dropdownMenu: Qt,
|
|
295
|
+
dropdownMenuOpen: er,
|
|
296
|
+
menuItemButton: tr,
|
|
297
|
+
labelMuted: rr,
|
|
298
|
+
selectSmall: nr,
|
|
299
|
+
selectAuto: or,
|
|
300
|
+
switchRow: ar,
|
|
301
|
+
groupingSummary: sr,
|
|
302
|
+
relative: lr,
|
|
303
|
+
overlay: ir,
|
|
304
|
+
overlayInner: cr,
|
|
305
|
+
spinner: ur,
|
|
306
|
+
tableWrap: dr,
|
|
307
|
+
tableWrapAll: hr,
|
|
308
|
+
table: mr,
|
|
309
|
+
tableHead: pr,
|
|
310
|
+
thCellTop: gr,
|
|
311
|
+
thCellFilter: fr,
|
|
312
|
+
thInner: wr,
|
|
313
|
+
resizeHandle: _r,
|
|
314
|
+
sortButton: br,
|
|
315
|
+
iconMuted: yr,
|
|
316
|
+
inlineGroup: xr,
|
|
317
|
+
input: vr,
|
|
318
|
+
rowInteractive: kr,
|
|
319
|
+
groupRow: jr,
|
|
320
|
+
groupRowAnimated: Nr,
|
|
321
|
+
groupChildRow: Sr,
|
|
322
|
+
groupToggle: Cr,
|
|
323
|
+
groupMeta: Tr,
|
|
324
|
+
checkbox: Rr,
|
|
325
|
+
dangerText: Er,
|
|
326
|
+
tfoot: Or,
|
|
327
|
+
textCenter: Ar,
|
|
328
|
+
paginationWrap: Dr,
|
|
329
|
+
pagination: Mr,
|
|
330
|
+
pageButton: Pr,
|
|
331
|
+
pageButtonActive: Ir,
|
|
332
|
+
backdrop: $r,
|
|
333
|
+
drawer: Lr,
|
|
334
|
+
drawerTitle: Br,
|
|
335
|
+
drawerSection: Fr,
|
|
336
|
+
drawerSubtitle: Wr,
|
|
337
|
+
sectionToggle: zr,
|
|
338
|
+
sectionBody: Gr,
|
|
339
|
+
drawerRow: Vr,
|
|
340
|
+
spacerAuto: Ur,
|
|
341
|
+
successText: Hr,
|
|
342
|
+
srOnly: Yr
|
|
343
|
+
}, E = (...u) => u.filter(Boolean).join(" ");
|
|
344
|
+
function pt({ label: u, children: x }) {
|
|
345
|
+
const [v, O] = y(!1), j = ae(null);
|
|
346
|
+
return $(() => {
|
|
347
|
+
const N = (z) => {
|
|
348
|
+
j.current && !j.current.contains(z.target) && O(!1);
|
|
349
|
+
};
|
|
350
|
+
return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
|
|
351
|
+
}, []), /* @__PURE__ */ r.jsxs("div", { className: a.dropdown, ref: j, children: [
|
|
352
|
+
/* @__PURE__ */ r.jsx(
|
|
353
|
+
"button",
|
|
354
|
+
{
|
|
355
|
+
className: E(
|
|
356
|
+
a.buttonBase,
|
|
357
|
+
a.buttonPrimary,
|
|
358
|
+
a.dropdownToggle
|
|
359
|
+
),
|
|
360
|
+
type: "button",
|
|
361
|
+
"aria-haspopup": "menu",
|
|
362
|
+
"aria-expanded": v,
|
|
363
|
+
onClick: () => O(!v),
|
|
364
|
+
children: u
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
/* @__PURE__ */ r.jsx(
|
|
368
|
+
"ul",
|
|
369
|
+
{
|
|
370
|
+
className: E(a.dropdownMenu, v && a.dropdownMenuOpen),
|
|
371
|
+
role: "menu",
|
|
372
|
+
onClick: () => O(!1),
|
|
373
|
+
children: x
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
const Xe = (u, x = "14px system-ui") => {
|
|
379
|
+
const O = (Xe.canvas || (Xe.canvas = document.createElement("canvas"))).getContext("2d");
|
|
380
|
+
return O.font = x, O.measureText(u).width;
|
|
381
|
+
}, Te = (u) => u.toLowerCase().replace(/[_\s]+(.)?/g, (x, v) => v ? v.toUpperCase() : "").replace(/^(.)/, (x) => x.toLowerCase()), Jr = (u) => {
|
|
382
|
+
if (!u || typeof u != "object") return u;
|
|
383
|
+
const x = {};
|
|
384
|
+
return Object.keys(u).forEach((v) => {
|
|
385
|
+
x[Te(v)] = u[v];
|
|
386
|
+
}), x;
|
|
387
|
+
}, Z = 0, We = 38, gt = 10, Xr = [], ze = 80;
|
|
388
|
+
function Kr({
|
|
389
|
+
apiEndpoint: u,
|
|
390
|
+
rowKey: x,
|
|
391
|
+
theme: v = "light",
|
|
392
|
+
computedColumns: O = Xr,
|
|
393
|
+
currency: j = "INR",
|
|
394
|
+
dateFormat: N = {
|
|
395
|
+
locale: "en-US",
|
|
396
|
+
options: { year: "numeric", month: "2-digit", day: "2-digit" }
|
|
397
|
+
},
|
|
398
|
+
dateSeparator: z = "/",
|
|
399
|
+
pageSizeOptions: Y = [50, 100, 500, 1e3, 0],
|
|
400
|
+
defaultPageSize: _e
|
|
401
|
+
}) {
|
|
402
|
+
const se = ae(!1), ee = ae(!1), le = ae(!1), Re = 50, [J, Ee] = y(!0), [ie, be] = y([]), [g, Ge] = y([]), [L, te] = y([]), [ye, xe] = y(!1), [X, G] = y(1), re = Array.isArray(Y) && Y.length > 0 ? Y : [50, 100, 500, 1e3, 0], Ve = _e !== void 0 && re.includes(_e) ? _e : re[0] || 50, [S, ve] = y(Ve), [Oe, Ae] = y(!1), [R, ne] = y([]), [ce, ue] = y({}), [V, oe] = y([]), [o, c] = y(() => {
|
|
403
|
+
const e = String(v || "light").toLowerCase();
|
|
404
|
+
return e === "dark" || e === "purple" ? e : "light";
|
|
405
|
+
}), [f, _] = y({
|
|
406
|
+
groupBy: !1,
|
|
407
|
+
aggregates: !1
|
|
408
|
+
}), [B, de] = y({}), b = Pt(B), [C, ke] = y({ key: null, direction: "asc" }), [U, je] = y([]), [De, Me] = y({}), [ft, I] = It(), qe = ae(null), [wt, _t] = y(0), Pe = ae(null), [Ke, Ze] = y(0), [Qe, bt] = y(0), he = ae(null), [yt, et] = y(() => typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(max-width: 767.98px)").matches), Ue = String(j || "INR").toUpperCase() === "USD" ? "USD" : "INR", tt = Ue === "USD" ? "en-US" : "en-IN", rt = N?.locale || "en-US", nt = H(
|
|
409
|
+
() => N?.options || {
|
|
410
|
+
year: "numeric",
|
|
411
|
+
month: "2-digit",
|
|
412
|
+
day: "2-digit"
|
|
413
|
+
},
|
|
414
|
+
[N]
|
|
415
|
+
);
|
|
416
|
+
$(() => {
|
|
417
|
+
S > 100 && xe(!0);
|
|
418
|
+
}, [S]), $(() => {
|
|
419
|
+
let e = !0;
|
|
420
|
+
const t = new AbortController();
|
|
421
|
+
return (async () => {
|
|
422
|
+
try {
|
|
423
|
+
xe(!0);
|
|
424
|
+
const n = new URLSearchParams({
|
|
425
|
+
page: String(X),
|
|
426
|
+
pageSize: String(S)
|
|
427
|
+
}), s = await fetch(`${u}?${n.toString()}`, {
|
|
428
|
+
signal: t.signal
|
|
429
|
+
});
|
|
430
|
+
if (!s.ok)
|
|
431
|
+
throw new Error(`Request failed: ${s.status} ${s.statusText}`);
|
|
432
|
+
const l = await s.json();
|
|
433
|
+
if (!e) return;
|
|
434
|
+
const i = (Array.isArray(l?.data) ? l.data : []).map((m) => Jr(m)), p = l?.columns || [], w = O.filter((m) => m && m.key && typeof m.formula == "function").map((m) => ({
|
|
435
|
+
key: Te(m.key),
|
|
436
|
+
label: m.label || m.key,
|
|
437
|
+
formula: m.formula
|
|
438
|
+
})), h = p.map((m) => {
|
|
439
|
+
const T = typeof m == "string" ? m : m.key;
|
|
440
|
+
return {
|
|
441
|
+
key: Te(T),
|
|
442
|
+
label: m.label || T.replace(/_/g, " ").replace(/\b\w/g, (W) => W.toUpperCase())
|
|
443
|
+
};
|
|
444
|
+
}), k = [
|
|
445
|
+
...h,
|
|
446
|
+
...w.filter((m) => !h.some((T) => T.key === m.key)).map(({ key: m, label: T }) => ({ key: m, label: T }))
|
|
447
|
+
], A = i.map((m) => {
|
|
448
|
+
const T = { ...m };
|
|
449
|
+
return w.forEach((W) => {
|
|
450
|
+
try {
|
|
451
|
+
T[W.key] = W.formula(m);
|
|
452
|
+
} catch (fe) {
|
|
453
|
+
T[W.key] = "", console.error(`Failed computed column formula for '${W.key}'`, fe);
|
|
454
|
+
}
|
|
455
|
+
}), T;
|
|
456
|
+
});
|
|
457
|
+
if (be(A), Ge(k), !se.current) {
|
|
458
|
+
const m = k.map((T) => T.key);
|
|
459
|
+
te(m), je(m), se.current = !0;
|
|
460
|
+
}
|
|
461
|
+
} catch (n) {
|
|
462
|
+
if (n?.name === "AbortError") return;
|
|
463
|
+
console.error("Failed to load grid data", n);
|
|
464
|
+
} finally {
|
|
465
|
+
e && xe(!1);
|
|
466
|
+
}
|
|
467
|
+
})(), () => {
|
|
468
|
+
e = !1, t.abort();
|
|
469
|
+
};
|
|
470
|
+
}, [u, X, S, O]), $(() => {
|
|
471
|
+
if (g.length > 0 && L.length === 0) {
|
|
472
|
+
const e = g.map((t) => t.key);
|
|
473
|
+
te(e), je(e), se.current = !0;
|
|
474
|
+
}
|
|
475
|
+
}, [g, L]), $(() => {
|
|
476
|
+
if (!g.length) return;
|
|
477
|
+
const e = g.map((t) => t.key);
|
|
478
|
+
je((t) => {
|
|
479
|
+
const n = t.filter((l) => e.includes(l)), s = e.filter((l) => !n.includes(l));
|
|
480
|
+
return [...n, ...s];
|
|
481
|
+
}), te((t) => {
|
|
482
|
+
if (!t.length) return e;
|
|
483
|
+
const n = t.filter((l) => e.includes(l)), s = e.filter((l) => !n.includes(l));
|
|
484
|
+
return [...n, ...s];
|
|
485
|
+
});
|
|
486
|
+
}, [g]), $(() => {
|
|
487
|
+
if (!g.length) return;
|
|
488
|
+
const e = new Set(g.map((t) => t.key));
|
|
489
|
+
ne((t) => t.filter((n) => e.has(n)));
|
|
490
|
+
}, [g]), $(() => {
|
|
491
|
+
const e = () => G(1);
|
|
492
|
+
return window.addEventListener("refreshTable", e), () => window.removeEventListener("refreshTable", e);
|
|
493
|
+
}, []), $(() => {
|
|
494
|
+
if (!u) return;
|
|
495
|
+
ee.current = !1, le.current = !1;
|
|
496
|
+
const e = localStorage.getItem(`columnOrder_${u}`), t = localStorage.getItem(`visibleColumns_${u}`), n = localStorage.getItem(`groupByColumns_${u}`), s = localStorage.getItem(`totalColumns_${u}`), l = localStorage.getItem(`theme_${u}`), d = localStorage.getItem(`columnWidths_${u}`);
|
|
497
|
+
if (e && (je(JSON.parse(e)), se.current = !0), t && te(JSON.parse(t)), n && ne(JSON.parse(n)), s && (oe(JSON.parse(s)), ee.current = !0), d && Me(JSON.parse(d)), l === "light" || l === "dark" || l === "purple")
|
|
498
|
+
c(l);
|
|
499
|
+
else {
|
|
500
|
+
const i = String(v || "light").toLowerCase();
|
|
501
|
+
c(
|
|
502
|
+
i === "dark" || i === "purple" ? i : "light"
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
le.current = !0;
|
|
506
|
+
}, [u, v]), $(() => {
|
|
507
|
+
u && le.current && (U.length > 0 && localStorage.setItem(
|
|
508
|
+
`columnOrder_${u}`,
|
|
509
|
+
JSON.stringify(U)
|
|
510
|
+
), L.length > 0 && localStorage.setItem(
|
|
511
|
+
`visibleColumns_${u}`,
|
|
512
|
+
JSON.stringify(L)
|
|
513
|
+
), localStorage.setItem(
|
|
514
|
+
`groupByColumns_${u}`,
|
|
515
|
+
JSON.stringify(R)
|
|
516
|
+
), localStorage.setItem(
|
|
517
|
+
`totalColumns_${u}`,
|
|
518
|
+
JSON.stringify(V)
|
|
519
|
+
), localStorage.setItem(`theme_${u}`, o), localStorage.setItem(
|
|
520
|
+
`columnWidths_${u}`,
|
|
521
|
+
JSON.stringify(De)
|
|
522
|
+
));
|
|
523
|
+
}, [
|
|
524
|
+
u,
|
|
525
|
+
U,
|
|
526
|
+
L,
|
|
527
|
+
R,
|
|
528
|
+
V,
|
|
529
|
+
o,
|
|
530
|
+
De
|
|
531
|
+
]);
|
|
532
|
+
const q = (e, t) => e[t] ?? "", me = we(
|
|
533
|
+
(e) => {
|
|
534
|
+
const t = Number(e);
|
|
535
|
+
return Number.isNaN(t) ? "" : new Intl.NumberFormat(tt, {
|
|
536
|
+
style: "currency",
|
|
537
|
+
currency: Ue,
|
|
538
|
+
maximumFractionDigits: 2
|
|
539
|
+
}).format(t);
|
|
540
|
+
},
|
|
541
|
+
[tt, Ue]
|
|
542
|
+
), xt = we(
|
|
543
|
+
(e) => {
|
|
544
|
+
const t = new Date(e);
|
|
545
|
+
return Number.isNaN(t.getTime()) ? e ?? "" : new Intl.DateTimeFormat(rt, nt).formatToParts(t).filter((s) => s.type === "year" || s.type === "month" || s.type === "day").map((s) => s.value).join(z);
|
|
546
|
+
},
|
|
547
|
+
[rt, nt, z]
|
|
548
|
+
), K = we(
|
|
549
|
+
(e) => {
|
|
550
|
+
const t = ie[0]?.[e];
|
|
551
|
+
return t == null ? "text" : isNaN(Number(t)) ? isNaN(Date.parse(t)) ? "text" : "date" : "number";
|
|
552
|
+
},
|
|
553
|
+
[ie]
|
|
554
|
+
), ot = (e) => {
|
|
555
|
+
const t = new Date(e);
|
|
556
|
+
return Number.isNaN(t.getTime()) ? null : `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(
|
|
557
|
+
t.getDate()
|
|
558
|
+
).padStart(2, "0")}`;
|
|
559
|
+
}, Ie = H(() => g.filter((e) => K(e.key) === "number"), [g, K]);
|
|
560
|
+
$(() => {
|
|
561
|
+
if (!g.length) return;
|
|
562
|
+
const e = Ie.map((t) => t.key);
|
|
563
|
+
if (!e.length) {
|
|
564
|
+
oe([]);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
oe((t) => {
|
|
568
|
+
const n = new Set(e);
|
|
569
|
+
return ee.current ? t.filter((s) => n.has(s)) : (ee.current = !0, e);
|
|
570
|
+
});
|
|
571
|
+
}, [g.length, Ie]);
|
|
572
|
+
const Ne = (e, t) => {
|
|
573
|
+
I(() => {
|
|
574
|
+
de((n) => ({
|
|
575
|
+
...n,
|
|
576
|
+
[e]: { ...n[e], ...t }
|
|
577
|
+
})), G(1);
|
|
578
|
+
});
|
|
579
|
+
}, vt = () => {
|
|
580
|
+
I(() => {
|
|
581
|
+
de({}), G(1);
|
|
582
|
+
});
|
|
583
|
+
}, He = H(() => ie.filter(
|
|
584
|
+
(e) => Object.entries(b).every(([t, n]) => {
|
|
585
|
+
if (!(n?.value !== void 0 && n?.value !== null && String(n.value).trim() !== "")) return !0;
|
|
586
|
+
const l = q(e, t);
|
|
587
|
+
if (n.type === "number") {
|
|
588
|
+
const d = Number(l), i = Number(n.value), p = n.op || "=";
|
|
589
|
+
return Number.isNaN(d) || Number.isNaN(i) ? !0 : p === "=" ? d === i : p === ">" ? d > i : p === "<" ? d < i : p === "!=" ? d !== i : !0;
|
|
590
|
+
}
|
|
591
|
+
if (n.type === "date") {
|
|
592
|
+
const d = ot(l), i = ot(n.value), p = n.op || "=";
|
|
593
|
+
return !d || !i ? !0 : p === "=" ? d === i : p === ">" ? d > i : p === "<" ? d < i : p === "!=" ? d !== i : !0;
|
|
594
|
+
}
|
|
595
|
+
return String(l).toLowerCase().includes(String(n.value).toLowerCase());
|
|
596
|
+
})
|
|
597
|
+
), [ie, b]), kt = (e) => {
|
|
598
|
+
I(() => {
|
|
599
|
+
ke((t) => ({
|
|
600
|
+
key: e,
|
|
601
|
+
direction: t.key === e && t.direction === "asc" ? "desc" : "asc"
|
|
602
|
+
}));
|
|
603
|
+
});
|
|
604
|
+
}, D = H(() => {
|
|
605
|
+
if (!C.key) return He;
|
|
606
|
+
const e = K(C.key);
|
|
607
|
+
return [...He].sort((t, n) => {
|
|
608
|
+
const s = q(t, C.key), l = q(n, C.key), d = e === "date" ? new Date(s).getTime() : isNaN(Number(s)) ? s : Number(s), i = e === "date" ? new Date(l).getTime() : isNaN(Number(l)) ? l : Number(l);
|
|
609
|
+
return d < i ? C.direction === "asc" ? -1 : 1 : d > i ? C.direction === "asc" ? 1 : -1 : 0;
|
|
610
|
+
});
|
|
611
|
+
}, [He, C, K]), $e = H(() => {
|
|
612
|
+
if (!J) return null;
|
|
613
|
+
const e = {};
|
|
614
|
+
return g.forEach((t) => {
|
|
615
|
+
K(t.key) === "number" && V.includes(t.key) && (e[t.key] = D.reduce(
|
|
616
|
+
(n, s) => n + Number(s[t.key] || 0),
|
|
617
|
+
0
|
|
618
|
+
));
|
|
619
|
+
}), e;
|
|
620
|
+
}, [J, D, g, K, V]), Le = S === Z ? D.length : Math.min(S, Re), Ye = S === Z ? 1 : Math.ceil(D.length / Le), Q = H(() => {
|
|
621
|
+
if (S === Z) return D;
|
|
622
|
+
const e = (X - 1) * Le;
|
|
623
|
+
return D.slice(e, e + Le);
|
|
624
|
+
}, [D, X, S, Le]), M = R.length > 0, F = !M && S === Z && !yt, jt = (e) => {
|
|
625
|
+
I(() => {
|
|
626
|
+
ne(
|
|
627
|
+
(t) => t.includes(e) ? t.filter((n) => n !== e) : [...t, e]
|
|
628
|
+
), ue({}), G(1);
|
|
629
|
+
});
|
|
630
|
+
}, Nt = (e) => {
|
|
631
|
+
ue((t) => ({
|
|
632
|
+
...t,
|
|
633
|
+
[e]: !t[e]
|
|
634
|
+
}));
|
|
635
|
+
}, St = (e) => {
|
|
636
|
+
I(() => {
|
|
637
|
+
oe(
|
|
638
|
+
(t) => t.includes(e) ? t.filter((n) => n !== e) : [...t, e]
|
|
639
|
+
);
|
|
640
|
+
});
|
|
641
|
+
}, at = we(
|
|
642
|
+
(e) => {
|
|
643
|
+
const t = {};
|
|
644
|
+
return V.forEach((n) => {
|
|
645
|
+
const s = e.map((w) => Number(w[n])).filter((w) => !Number.isNaN(w));
|
|
646
|
+
if (!s.length) return;
|
|
647
|
+
const l = s.reduce((w, h) => w + h, 0), d = Math.min(...s), i = Math.max(...s), p = l / s.length;
|
|
648
|
+
t[n] = {
|
|
649
|
+
count: s.length,
|
|
650
|
+
sum: l,
|
|
651
|
+
avg: p,
|
|
652
|
+
min: d,
|
|
653
|
+
max: i
|
|
654
|
+
};
|
|
655
|
+
}), t;
|
|
656
|
+
},
|
|
657
|
+
[V]
|
|
658
|
+
), Be = H(() => {
|
|
659
|
+
if (!M) return [];
|
|
660
|
+
const e = [], t = D, n = (s, l, d) => {
|
|
661
|
+
const i = R[l], p = /* @__PURE__ */ new Map();
|
|
662
|
+
s.forEach((w) => {
|
|
663
|
+
const h = q(w, i), k = h == null || h === "" ? "(Blank)" : String(h);
|
|
664
|
+
p.has(k) || p.set(k, []), p.get(k).push(w);
|
|
665
|
+
}), Array.from(p.entries()).forEach(([w, h], k) => {
|
|
666
|
+
const A = `${d}${i}:${w}:${k}`;
|
|
667
|
+
if (e.push({
|
|
668
|
+
type: "group",
|
|
669
|
+
id: A,
|
|
670
|
+
groupKey: i,
|
|
671
|
+
groupValue: w,
|
|
672
|
+
level: l,
|
|
673
|
+
count: h.length,
|
|
674
|
+
aggregates: at(h)
|
|
675
|
+
}), !ce[A]) {
|
|
676
|
+
if (l < R.length - 1) {
|
|
677
|
+
n(h, l + 1, `${A}|`);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
h.forEach((m, T) => {
|
|
681
|
+
const W = m[Te(x)] ?? m[x] ?? T;
|
|
682
|
+
e.push({
|
|
683
|
+
type: "row",
|
|
684
|
+
id: `${A}|row:${W}:${T}`,
|
|
685
|
+
row: m
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
return n(t, 0, ""), e;
|
|
692
|
+
}, [
|
|
693
|
+
M,
|
|
694
|
+
D,
|
|
695
|
+
R,
|
|
696
|
+
ce,
|
|
697
|
+
at,
|
|
698
|
+
x
|
|
699
|
+
]), Ct = we(
|
|
700
|
+
(e) => {
|
|
701
|
+
F && Ze(e.currentTarget.scrollTop);
|
|
702
|
+
},
|
|
703
|
+
[F]
|
|
704
|
+
);
|
|
705
|
+
ut(() => {
|
|
706
|
+
if (!F) return;
|
|
707
|
+
const e = Pe.current;
|
|
708
|
+
if (!e) return;
|
|
709
|
+
const t = () => bt(e.clientHeight || 0);
|
|
710
|
+
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
711
|
+
}, [F]), $(() => {
|
|
712
|
+
Ze(0), Pe.current && (Pe.current.scrollTop = 0);
|
|
713
|
+
}, [F, D.length]);
|
|
714
|
+
const pe = H(() => {
|
|
715
|
+
if (!F)
|
|
716
|
+
return {
|
|
717
|
+
start: 0,
|
|
718
|
+
end: Q.length,
|
|
719
|
+
rows: Q,
|
|
720
|
+
topSpacer: 0,
|
|
721
|
+
bottomSpacer: 0
|
|
722
|
+
};
|
|
723
|
+
const e = Q.length, t = Math.ceil((Qe || 1) / We), n = Math.max(
|
|
724
|
+
0,
|
|
725
|
+
Math.floor(Ke / We) - gt
|
|
726
|
+
), s = Math.min(
|
|
727
|
+
e,
|
|
728
|
+
n + t + gt * 2
|
|
729
|
+
);
|
|
730
|
+
return {
|
|
731
|
+
start: n,
|
|
732
|
+
end: s,
|
|
733
|
+
rows: Q.slice(n, s),
|
|
734
|
+
topSpacer: n * We,
|
|
735
|
+
bottomSpacer: Math.max(0, (e - s) * We)
|
|
736
|
+
};
|
|
737
|
+
}, [F, Q, Ke, Qe]), Je = we(
|
|
738
|
+
(e) => Object.entries(e || {}).map(([t, n]) => `${g.find((l) => l.key === t)?.label || t}: Σ ${me(n.sum)} | Avg ${me(n.avg)} | Min ${me(n.min)} | Max ${me(n.max)}`),
|
|
739
|
+
[g, me]
|
|
740
|
+
), Tt = () => {
|
|
741
|
+
try {
|
|
742
|
+
const e = P.filter(
|
|
743
|
+
(h) => L.includes(h.key)
|
|
744
|
+
), t = (h) => {
|
|
745
|
+
const A = String(h ?? "").replace(/"/g, '""');
|
|
746
|
+
return /[",\n\r]/.test(A) ? `"${A}"` : A;
|
|
747
|
+
}, n = M ? Be.map((h) => {
|
|
748
|
+
if (h.type === "group") {
|
|
749
|
+
const m = g.find((fe) => fe.key === h.groupKey)?.label || h.groupKey, T = Je(h.aggregates).join(" || "), W = {};
|
|
750
|
+
return e.forEach((fe, ct) => {
|
|
751
|
+
if (ct === 0) {
|
|
752
|
+
W[fe.key] = `GROUP ${m}: ${h.groupValue} (${h.count})`;
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
W[fe.key] = ct === 1 ? T : "";
|
|
756
|
+
}), W;
|
|
757
|
+
}
|
|
758
|
+
const k = {}, A = h.row;
|
|
759
|
+
return e.forEach((m) => {
|
|
760
|
+
k[m.key] = q(A, m.key);
|
|
761
|
+
}), k;
|
|
762
|
+
}) : D.map((h) => {
|
|
763
|
+
const k = {};
|
|
764
|
+
return e.forEach((A) => {
|
|
765
|
+
k[A.key] = q(h, A.key);
|
|
766
|
+
}), k;
|
|
767
|
+
}), s = e.map((h) => t(h.label)).join(","), l = n.map(
|
|
768
|
+
(h) => e.map((k) => t(h[k.key])).join(",")
|
|
769
|
+
).join(`\r
|
|
770
|
+
`), d = `\uFEFF${s}\r
|
|
771
|
+
${l}`, i = new Blob([d], { type: "text/csv;charset=utf-8;" }), p = URL.createObjectURL(i), w = document.createElement("a");
|
|
772
|
+
w.href = p, w.download = "TableData.csv", document.body.appendChild(w), w.click(), document.body.removeChild(w), URL.revokeObjectURL(p);
|
|
773
|
+
} catch (e) {
|
|
774
|
+
console.error("Failed to export CSV", e);
|
|
775
|
+
}
|
|
776
|
+
}, Rt = () => {
|
|
777
|
+
(async () => {
|
|
778
|
+
const [{ default: e }, { default: t }] = await Promise.all([
|
|
779
|
+
import("./jspdf.es.min-DVZuwoNv.js").then((i) => i.j),
|
|
780
|
+
import("./jspdf.plugin.autotable-D7eVZU2H.js")
|
|
781
|
+
]), n = new e({
|
|
782
|
+
orientation: "landscape",
|
|
783
|
+
// better for wide tables
|
|
784
|
+
unit: "pt",
|
|
785
|
+
format: "A4"
|
|
786
|
+
}), s = P.filter((i) => L.includes(i.key)), l = [s.map((i) => i.label)], d = M ? Be.map((i) => {
|
|
787
|
+
if (i.type === "group") {
|
|
788
|
+
const p = g.find((k) => k.key === i.groupKey)?.label || i.groupKey, w = Je(i.aggregates);
|
|
789
|
+
return [
|
|
790
|
+
{
|
|
791
|
+
content: [
|
|
792
|
+
`GROUP ${p}: ${i.groupValue} (${i.count})`,
|
|
793
|
+
...w
|
|
794
|
+
].join(`
|
|
795
|
+
`),
|
|
796
|
+
colSpan: Math.max(1, s.length),
|
|
797
|
+
styles: {
|
|
798
|
+
fontStyle: "bold",
|
|
799
|
+
fillColor: [235, 240, 250],
|
|
800
|
+
textColor: [20, 40, 80],
|
|
801
|
+
overflow: "linebreak",
|
|
802
|
+
cellWidth: "wrap"
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
];
|
|
806
|
+
}
|
|
807
|
+
return s.map((p) => String(q(i.row, p.key) ?? ""));
|
|
808
|
+
}) : D.map(
|
|
809
|
+
(i) => s.map((p) => String(q(i, p.key) ?? ""))
|
|
810
|
+
);
|
|
811
|
+
t(n, {
|
|
812
|
+
head: l,
|
|
813
|
+
body: d,
|
|
814
|
+
styles: {
|
|
815
|
+
fontSize: 9,
|
|
816
|
+
cellPadding: 4,
|
|
817
|
+
halign: "left",
|
|
818
|
+
valign: "middle"
|
|
819
|
+
},
|
|
820
|
+
headStyles: {
|
|
821
|
+
fillColor: [22, 160, 133],
|
|
822
|
+
textColor: [255, 255, 255],
|
|
823
|
+
fontStyle: "bold"
|
|
824
|
+
},
|
|
825
|
+
margin: { top: 40 },
|
|
826
|
+
didDrawPage: (i) => {
|
|
827
|
+
n.setFontSize(12), n.text("Table Data Export", i.settings.margin.left, 30);
|
|
828
|
+
}
|
|
829
|
+
}), n.save("TableData.pdf");
|
|
830
|
+
})().catch((e) => {
|
|
831
|
+
console.error("Failed to export PDF", e);
|
|
832
|
+
});
|
|
833
|
+
}, st = (e, t) => {
|
|
834
|
+
e.dataTransfer.setData("colKey", t);
|
|
835
|
+
}, lt = (e, t) => {
|
|
836
|
+
const n = e.dataTransfer.getData("colKey");
|
|
837
|
+
!n || n === t || I(() => {
|
|
838
|
+
je((s) => {
|
|
839
|
+
const l = [...s], d = l.indexOf(n), i = l.indexOf(t);
|
|
840
|
+
return l.splice(d, 1), l.splice(i, 0, n), l;
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
}, it = (e) => e.preventDefault(), P = H(() => U.map((e) => g.find((t) => t.key === e)).filter((e) => e && L.includes(e.key)), [g, U, L]), ge = H(() => {
|
|
844
|
+
const s = "14px system-ui", l = {};
|
|
845
|
+
return P.forEach((d) => {
|
|
846
|
+
const i = Xe(d.label, s), p = Math.min(
|
|
847
|
+
320,
|
|
848
|
+
Math.max(ze, i + 32 + 48)
|
|
849
|
+
);
|
|
850
|
+
l[d.key] = Math.max(
|
|
851
|
+
ze,
|
|
852
|
+
De[d.key] ?? p
|
|
853
|
+
);
|
|
854
|
+
}), l;
|
|
855
|
+
}, [P, De]);
|
|
856
|
+
$(() => {
|
|
857
|
+
if (!g.length) return;
|
|
858
|
+
const e = new Set(g.map((t) => t.key));
|
|
859
|
+
Me((t) => {
|
|
860
|
+
const n = {};
|
|
861
|
+
return Object.entries(t).forEach(([s, l]) => {
|
|
862
|
+
e.has(s) && (n[s] = l);
|
|
863
|
+
}), n;
|
|
864
|
+
});
|
|
865
|
+
}, [g]);
|
|
866
|
+
const Et = (e, t) => {
|
|
867
|
+
if (e.preventDefault(), e.stopPropagation(), e.button !== void 0 && e.button !== 0) return;
|
|
868
|
+
const n = e.clientX, s = ge[t] || ze;
|
|
869
|
+
he.current = { key: t, startX: n, startWidth: s }, document.body.style.cursor = "col-resize";
|
|
870
|
+
const l = (i) => {
|
|
871
|
+
if (!he.current) return;
|
|
872
|
+
const p = i.clientX - he.current.startX, w = Math.max(
|
|
873
|
+
ze,
|
|
874
|
+
he.current.startWidth + p
|
|
875
|
+
);
|
|
876
|
+
Me((h) => ({
|
|
877
|
+
...h,
|
|
878
|
+
[he.current.key]: w
|
|
879
|
+
}));
|
|
880
|
+
}, d = () => {
|
|
881
|
+
he.current = null, document.body.style.cursor = "", window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", d);
|
|
882
|
+
};
|
|
883
|
+
window.addEventListener("pointermove", l), window.addEventListener("pointerup", d);
|
|
884
|
+
}, Ot = (e, t) => {
|
|
885
|
+
e.preventDefault(), e.stopPropagation(), Me((n) => {
|
|
886
|
+
const s = { ...n };
|
|
887
|
+
return delete s[t], s;
|
|
888
|
+
});
|
|
889
|
+
}, At = ye || ft, Dt = o === "dark" ? a.themeDark : o === "purple" ? a.themePurple : a.themeLight;
|
|
890
|
+
return ut(() => {
|
|
891
|
+
const e = () => {
|
|
892
|
+
_t(qe.current?.offsetHeight || 0);
|
|
893
|
+
};
|
|
894
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
895
|
+
}, [P.length]), $(() => {
|
|
896
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
897
|
+
const e = window.matchMedia("(max-width: 767.98px)"), t = (n) => et(n.matches);
|
|
898
|
+
return et(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
899
|
+
}, []), /* @__PURE__ */ r.jsxs("div", { className: E(a.container, Dt), children: [
|
|
900
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.headerRow, children: [
|
|
901
|
+
/* @__PURE__ */ r.jsxs("div", { className: E(a.flexRow, a.toolbarGroup), children: [
|
|
902
|
+
/* @__PURE__ */ r.jsx("label", { className: a.labelMuted, children: "Rows:" }),
|
|
903
|
+
/* @__PURE__ */ r.jsx(
|
|
904
|
+
"select",
|
|
905
|
+
{
|
|
906
|
+
className: E(a.selectSmall, a.selectAuto),
|
|
907
|
+
value: S,
|
|
908
|
+
onChange: (e) => I(() => {
|
|
909
|
+
ve(Number(e.target.value)), G(1);
|
|
910
|
+
}),
|
|
911
|
+
children: re.map((e) => /* @__PURE__ */ r.jsx("option", { value: e, children: e === Z ? "All" : e }, e))
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.switchRow, children: [
|
|
915
|
+
/* @__PURE__ */ r.jsx(
|
|
916
|
+
"input",
|
|
917
|
+
{
|
|
918
|
+
className: a.checkbox,
|
|
919
|
+
type: "checkbox",
|
|
920
|
+
checked: J,
|
|
921
|
+
onChange: (e) => I(() => Ee(e.target.checked))
|
|
922
|
+
}
|
|
923
|
+
),
|
|
924
|
+
/* @__PURE__ */ r.jsx("label", { className: a.labelMuted, children: "Show Totals" })
|
|
925
|
+
] }),
|
|
926
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.groupingSummary, children: [
|
|
927
|
+
/* @__PURE__ */ r.jsxs("span", { className: a.labelMuted, children: [
|
|
928
|
+
"Group By:",
|
|
929
|
+
" ",
|
|
930
|
+
R.length ? R.map((e) => g.find((t) => t.key === e)?.label || e).join(" > ") : "None"
|
|
931
|
+
] }),
|
|
932
|
+
R.length > 0 && /* @__PURE__ */ r.jsx(
|
|
933
|
+
"button",
|
|
934
|
+
{
|
|
935
|
+
className: E(a.buttonBase, a.buttonMuted),
|
|
936
|
+
onClick: () => {
|
|
937
|
+
I(() => {
|
|
938
|
+
ne([]), ue({});
|
|
939
|
+
});
|
|
940
|
+
},
|
|
941
|
+
children: "Clear Groups"
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
] })
|
|
945
|
+
] }),
|
|
946
|
+
/* @__PURE__ */ r.jsxs("div", { className: E(a.flexRow, a.toolbarGroup), children: [
|
|
947
|
+
/* @__PURE__ */ r.jsxs(
|
|
948
|
+
"button",
|
|
949
|
+
{
|
|
950
|
+
className: E(a.buttonBase, a.buttonDanger),
|
|
951
|
+
disabled: !Object.values(B).some((e) => e?.value),
|
|
952
|
+
onClick: vt,
|
|
953
|
+
children: [
|
|
954
|
+
"✕",
|
|
955
|
+
" ",
|
|
956
|
+
"Clear Filters"
|
|
957
|
+
]
|
|
958
|
+
}
|
|
959
|
+
),
|
|
960
|
+
/* @__PURE__ */ r.jsxs(
|
|
961
|
+
pt,
|
|
962
|
+
{
|
|
963
|
+
label: /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
964
|
+
"⬇",
|
|
965
|
+
" Export"
|
|
966
|
+
] }),
|
|
967
|
+
children: [
|
|
968
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsxs("button", { className: a.menuItemButton, onClick: Tt, children: [
|
|
969
|
+
/* @__PURE__ */ r.jsx("span", { className: a.successText, children: "CSV" }),
|
|
970
|
+
" Export to CSV"
|
|
971
|
+
] }) }),
|
|
972
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsxs("button", { className: a.menuItemButton, onClick: Rt, children: [
|
|
973
|
+
/* @__PURE__ */ r.jsx("span", { className: a.dangerText, children: "PDF" }),
|
|
974
|
+
" ",
|
|
975
|
+
"Export to PDF"
|
|
976
|
+
] }) })
|
|
977
|
+
]
|
|
978
|
+
}
|
|
979
|
+
),
|
|
980
|
+
/* @__PURE__ */ r.jsxs(
|
|
981
|
+
"button",
|
|
982
|
+
{
|
|
983
|
+
className: E(a.buttonBase, a.buttonMuted),
|
|
984
|
+
onClick: () => Ae(!0),
|
|
985
|
+
children: [
|
|
986
|
+
"☰",
|
|
987
|
+
" ",
|
|
988
|
+
"Columns"
|
|
989
|
+
]
|
|
990
|
+
}
|
|
991
|
+
),
|
|
992
|
+
/* @__PURE__ */ r.jsxs(
|
|
993
|
+
pt,
|
|
994
|
+
{
|
|
995
|
+
label: /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
996
|
+
"▣",
|
|
997
|
+
" Theme"
|
|
998
|
+
] }),
|
|
999
|
+
children: [
|
|
1000
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1001
|
+
"button",
|
|
1002
|
+
{
|
|
1003
|
+
className: a.menuItemButton,
|
|
1004
|
+
onClick: () => c("light"),
|
|
1005
|
+
children: "Light"
|
|
1006
|
+
}
|
|
1007
|
+
) }),
|
|
1008
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1009
|
+
"button",
|
|
1010
|
+
{
|
|
1011
|
+
className: a.menuItemButton,
|
|
1012
|
+
onClick: () => c("dark"),
|
|
1013
|
+
children: "Dark"
|
|
1014
|
+
}
|
|
1015
|
+
) }),
|
|
1016
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1017
|
+
"button",
|
|
1018
|
+
{
|
|
1019
|
+
className: a.menuItemButton,
|
|
1020
|
+
onClick: () => c("purple"),
|
|
1021
|
+
children: "Purple"
|
|
1022
|
+
}
|
|
1023
|
+
) })
|
|
1024
|
+
]
|
|
1025
|
+
}
|
|
1026
|
+
)
|
|
1027
|
+
] })
|
|
1028
|
+
] }),
|
|
1029
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.relative, children: [
|
|
1030
|
+
/* @__PURE__ */ r.jsx("div", { className: a.srOnly, "aria-live": "polite", children: ye ? "Loading table data" : "Table updated" }),
|
|
1031
|
+
At && /* @__PURE__ */ r.jsx("div", { className: a.overlay, children: /* @__PURE__ */ r.jsxs(
|
|
1032
|
+
"div",
|
|
1033
|
+
{
|
|
1034
|
+
className: a.overlayInner,
|
|
1035
|
+
style: { top: "15%" },
|
|
1036
|
+
children: [
|
|
1037
|
+
/* @__PURE__ */ r.jsx("div", { className: a.spinner, role: "status" }),
|
|
1038
|
+
/* @__PURE__ */ r.jsx("div", { className: a.labelMuted, children: ye ? "Loading data..." : "Updating..." })
|
|
1039
|
+
]
|
|
1040
|
+
}
|
|
1041
|
+
) }),
|
|
1042
|
+
/* @__PURE__ */ r.jsx(
|
|
1043
|
+
"div",
|
|
1044
|
+
{
|
|
1045
|
+
className: E(
|
|
1046
|
+
a.tableWrap,
|
|
1047
|
+
S === Z && a.tableWrapAll
|
|
1048
|
+
),
|
|
1049
|
+
ref: Pe,
|
|
1050
|
+
style: S === Z ? { maxHeight: "70vh", overflowY: "auto" } : {},
|
|
1051
|
+
onScroll: Ct,
|
|
1052
|
+
children: /* @__PURE__ */ r.jsxs(
|
|
1053
|
+
"table",
|
|
1054
|
+
{
|
|
1055
|
+
className: a.table,
|
|
1056
|
+
style: { tableLayout: "fixed" },
|
|
1057
|
+
role: "grid",
|
|
1058
|
+
"aria-rowcount": M ? Be.length : Q.length,
|
|
1059
|
+
"aria-colcount": P.length,
|
|
1060
|
+
children: [
|
|
1061
|
+
/* @__PURE__ */ r.jsxs("thead", { className: a.tableHead, children: [
|
|
1062
|
+
/* @__PURE__ */ r.jsx("tr", { ref: qe, children: P.map((e) => {
|
|
1063
|
+
const t = C.key === e.key, n = t ? C.direction === "asc" ? "↑" : "↓" : "⇅";
|
|
1064
|
+
return /* @__PURE__ */ r.jsxs(
|
|
1065
|
+
"th",
|
|
1066
|
+
{
|
|
1067
|
+
scope: "col",
|
|
1068
|
+
"aria-sort": t ? C.direction === "asc" ? "ascending" : "descending" : "none",
|
|
1069
|
+
draggable: !0,
|
|
1070
|
+
onDragStart: (s) => st(s, e.key),
|
|
1071
|
+
onDragOver: it,
|
|
1072
|
+
onDrop: (s) => lt(s, e.key),
|
|
1073
|
+
style: {
|
|
1074
|
+
width: ge[e.key]
|
|
1075
|
+
},
|
|
1076
|
+
className: a.thCellTop,
|
|
1077
|
+
children: [
|
|
1078
|
+
/* @__PURE__ */ r.jsx("div", { className: a.thInner, children: /* @__PURE__ */ r.jsxs(
|
|
1079
|
+
"button",
|
|
1080
|
+
{
|
|
1081
|
+
type: "button",
|
|
1082
|
+
className: a.sortButton,
|
|
1083
|
+
"aria-label": `Sort by ${e.label}`,
|
|
1084
|
+
onClick: () => kt(e.key),
|
|
1085
|
+
children: [
|
|
1086
|
+
e.label,
|
|
1087
|
+
/* @__PURE__ */ r.jsxs("span", { className: a.iconMuted, children: [
|
|
1088
|
+
" ",
|
|
1089
|
+
n
|
|
1090
|
+
] })
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1093
|
+
) }),
|
|
1094
|
+
/* @__PURE__ */ r.jsx(
|
|
1095
|
+
"span",
|
|
1096
|
+
{
|
|
1097
|
+
className: a.resizeHandle,
|
|
1098
|
+
role: "separator",
|
|
1099
|
+
"aria-orientation": "vertical",
|
|
1100
|
+
"aria-label": `Resize ${e.label} column`,
|
|
1101
|
+
tabIndex: 0,
|
|
1102
|
+
onPointerDown: (s) => Et(s, e.key),
|
|
1103
|
+
onDoubleClick: (s) => Ot(s, e.key)
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
]
|
|
1107
|
+
},
|
|
1108
|
+
e.key
|
|
1109
|
+
);
|
|
1110
|
+
}) }),
|
|
1111
|
+
/* @__PURE__ */ r.jsx("tr", { children: P.map((e) => /* @__PURE__ */ r.jsx(
|
|
1112
|
+
"th",
|
|
1113
|
+
{
|
|
1114
|
+
style: {
|
|
1115
|
+
top: wt
|
|
1116
|
+
},
|
|
1117
|
+
className: a.thCellFilter,
|
|
1118
|
+
children: K(e.key) === "number" ? /* @__PURE__ */ r.jsxs("div", { className: a.inlineGroup, children: [
|
|
1119
|
+
/* @__PURE__ */ r.jsxs(
|
|
1120
|
+
"select",
|
|
1121
|
+
{
|
|
1122
|
+
className: E(a.selectSmall, a.selectAuto),
|
|
1123
|
+
value: B[e.key]?.op || "=",
|
|
1124
|
+
onChange: (t) => Ne(e.key, {
|
|
1125
|
+
type: "number",
|
|
1126
|
+
op: t.target.value
|
|
1127
|
+
}),
|
|
1128
|
+
children: [
|
|
1129
|
+
/* @__PURE__ */ r.jsx("option", { value: "=", children: "=" }),
|
|
1130
|
+
/* @__PURE__ */ r.jsx("option", { value: ">", children: ">" }),
|
|
1131
|
+
/* @__PURE__ */ r.jsx("option", { value: "<", children: "<" }),
|
|
1132
|
+
/* @__PURE__ */ r.jsx("option", { value: "!=", children: "!=" })
|
|
1133
|
+
]
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
1136
|
+
/* @__PURE__ */ r.jsx(
|
|
1137
|
+
"input",
|
|
1138
|
+
{
|
|
1139
|
+
type: "number",
|
|
1140
|
+
className: a.input,
|
|
1141
|
+
value: B[e.key]?.value || "",
|
|
1142
|
+
onChange: (t) => Ne(e.key, {
|
|
1143
|
+
type: "number",
|
|
1144
|
+
value: t.target.value
|
|
1145
|
+
})
|
|
1146
|
+
}
|
|
1147
|
+
)
|
|
1148
|
+
] }) : K(e.key) === "date" ? /* @__PURE__ */ r.jsxs("div", { className: a.inlineGroup, children: [
|
|
1149
|
+
/* @__PURE__ */ r.jsxs(
|
|
1150
|
+
"select",
|
|
1151
|
+
{
|
|
1152
|
+
className: E(a.selectSmall, a.selectAuto),
|
|
1153
|
+
value: B[e.key]?.op || "=",
|
|
1154
|
+
onChange: (t) => Ne(e.key, {
|
|
1155
|
+
type: "date",
|
|
1156
|
+
op: t.target.value
|
|
1157
|
+
}),
|
|
1158
|
+
children: [
|
|
1159
|
+
/* @__PURE__ */ r.jsx("option", { value: "=", children: "=" }),
|
|
1160
|
+
/* @__PURE__ */ r.jsx("option", { value: ">", children: ">" }),
|
|
1161
|
+
/* @__PURE__ */ r.jsx("option", { value: "<", children: "<" }),
|
|
1162
|
+
/* @__PURE__ */ r.jsx("option", { value: "!=", children: "!=" })
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ r.jsx(
|
|
1167
|
+
"input",
|
|
1168
|
+
{
|
|
1169
|
+
type: "date",
|
|
1170
|
+
className: a.input,
|
|
1171
|
+
value: B[e.key]?.value || "",
|
|
1172
|
+
onChange: (t) => Ne(e.key, {
|
|
1173
|
+
type: "date",
|
|
1174
|
+
value: t.target.value
|
|
1175
|
+
})
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
] }) : /* @__PURE__ */ r.jsx(
|
|
1179
|
+
"input",
|
|
1180
|
+
{
|
|
1181
|
+
type: "text",
|
|
1182
|
+
className: a.input,
|
|
1183
|
+
placeholder: "Filter...",
|
|
1184
|
+
value: B[e.key]?.value || "",
|
|
1185
|
+
onChange: (t) => Ne(e.key, {
|
|
1186
|
+
type: "text",
|
|
1187
|
+
value: t.target.value
|
|
1188
|
+
})
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
},
|
|
1192
|
+
e.key
|
|
1193
|
+
)) })
|
|
1194
|
+
] }),
|
|
1195
|
+
/* @__PURE__ */ r.jsxs("tbody", { children: [
|
|
1196
|
+
F && pe.topSpacer > 0 && /* @__PURE__ */ r.jsx("tr", { "aria-hidden": "true", children: /* @__PURE__ */ r.jsx(
|
|
1197
|
+
"td",
|
|
1198
|
+
{
|
|
1199
|
+
colSpan: P.length,
|
|
1200
|
+
style: { height: `${pe.topSpacer}px`, padding: 0 }
|
|
1201
|
+
}
|
|
1202
|
+
) }),
|
|
1203
|
+
(M ? Be : F ? pe.rows : Q).map((e) => {
|
|
1204
|
+
if (M && e.type === "group") {
|
|
1205
|
+
const n = g.find((d) => d.key === e.groupKey)?.label || e.groupKey, s = !!ce[e.id], l = Je(e.aggregates).join(" || ");
|
|
1206
|
+
return /* @__PURE__ */ r.jsx("tr", { className: E(a.groupRow, a.groupRowAnimated), children: /* @__PURE__ */ r.jsx("td", { colSpan: P.length, children: /* @__PURE__ */ r.jsxs(
|
|
1207
|
+
"button",
|
|
1208
|
+
{
|
|
1209
|
+
type: "button",
|
|
1210
|
+
className: a.groupToggle,
|
|
1211
|
+
onClick: () => Nt(e.id),
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ r.jsxs("span", { style: { paddingLeft: `${e.level * 18}px` }, children: [
|
|
1214
|
+
s ? "▶" : "▼",
|
|
1215
|
+
" ",
|
|
1216
|
+
n,
|
|
1217
|
+
": ",
|
|
1218
|
+
e.groupValue,
|
|
1219
|
+
" (",
|
|
1220
|
+
e.count,
|
|
1221
|
+
")"
|
|
1222
|
+
] }),
|
|
1223
|
+
l && /* @__PURE__ */ r.jsxs("span", { className: a.groupMeta, children: [
|
|
1224
|
+
" ",
|
|
1225
|
+
l
|
|
1226
|
+
] })
|
|
1227
|
+
]
|
|
1228
|
+
}
|
|
1229
|
+
) }) }, e.id);
|
|
1230
|
+
}
|
|
1231
|
+
const t = M ? e.row : e;
|
|
1232
|
+
return /* @__PURE__ */ r.jsx(
|
|
1233
|
+
"tr",
|
|
1234
|
+
{
|
|
1235
|
+
className: E(
|
|
1236
|
+
a.rowInteractive,
|
|
1237
|
+
M && a.groupChildRow
|
|
1238
|
+
),
|
|
1239
|
+
tabIndex: 0,
|
|
1240
|
+
children: P.map((n) => {
|
|
1241
|
+
const s = q(t, n.key);
|
|
1242
|
+
return typeof s == "boolean" ? /* @__PURE__ */ r.jsx(
|
|
1243
|
+
"td",
|
|
1244
|
+
{
|
|
1245
|
+
"data-label": n.label,
|
|
1246
|
+
style: { width: ge[n.key] },
|
|
1247
|
+
children: /* @__PURE__ */ r.jsx(
|
|
1248
|
+
"input",
|
|
1249
|
+
{
|
|
1250
|
+
type: "checkbox",
|
|
1251
|
+
checked: s,
|
|
1252
|
+
disabled: !0,
|
|
1253
|
+
className: a.checkbox
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
},
|
|
1257
|
+
n.key
|
|
1258
|
+
) : K(n.key) === "date" ? /* @__PURE__ */ r.jsx(
|
|
1259
|
+
"td",
|
|
1260
|
+
{
|
|
1261
|
+
"data-label": n.label,
|
|
1262
|
+
style: { width: ge[n.key] },
|
|
1263
|
+
children: xt(s)
|
|
1264
|
+
},
|
|
1265
|
+
n.key
|
|
1266
|
+
) : /* @__PURE__ */ r.jsx(
|
|
1267
|
+
"td",
|
|
1268
|
+
{
|
|
1269
|
+
"data-label": n.label,
|
|
1270
|
+
style: { width: ge[n.key] },
|
|
1271
|
+
children: s
|
|
1272
|
+
},
|
|
1273
|
+
n.key
|
|
1274
|
+
);
|
|
1275
|
+
})
|
|
1276
|
+
},
|
|
1277
|
+
M ? e.id : t[Te(x)] ?? t[x]
|
|
1278
|
+
);
|
|
1279
|
+
}),
|
|
1280
|
+
F && pe.bottomSpacer > 0 && /* @__PURE__ */ r.jsx("tr", { "aria-hidden": "true", children: /* @__PURE__ */ r.jsx(
|
|
1281
|
+
"td",
|
|
1282
|
+
{
|
|
1283
|
+
colSpan: P.length,
|
|
1284
|
+
style: { height: `${pe.bottomSpacer}px`, padding: 0 }
|
|
1285
|
+
}
|
|
1286
|
+
) })
|
|
1287
|
+
] }),
|
|
1288
|
+
J && $e && Object.keys($e).length > 0 && /* @__PURE__ */ r.jsxs("tfoot", { className: a.tfoot, children: [
|
|
1289
|
+
/* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx("td", { colSpan: P.length, className: a.textCenter, children: "Totals" }) }),
|
|
1290
|
+
/* @__PURE__ */ r.jsx("tr", { children: P.map((e) => /* @__PURE__ */ r.jsx(
|
|
1291
|
+
"td",
|
|
1292
|
+
{
|
|
1293
|
+
"data-label": e.label,
|
|
1294
|
+
style: { width: ge[e.key] },
|
|
1295
|
+
children: $e[e.key] !== void 0 ? me($e[e.key]) : ""
|
|
1296
|
+
},
|
|
1297
|
+
e.key
|
|
1298
|
+
)) })
|
|
1299
|
+
] })
|
|
1300
|
+
]
|
|
1301
|
+
}
|
|
1302
|
+
)
|
|
1303
|
+
}
|
|
1304
|
+
)
|
|
1305
|
+
] }),
|
|
1306
|
+
!M && S !== Z && Ye > 1 && /* @__PURE__ */ r.jsx("div", { className: a.paginationWrap, children: /* @__PURE__ */ r.jsxs("ul", { className: a.pagination, children: [
|
|
1307
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1308
|
+
"button",
|
|
1309
|
+
{
|
|
1310
|
+
className: a.pageButton,
|
|
1311
|
+
disabled: X === 1,
|
|
1312
|
+
onClick: () => I(() => G((e) => e - 1)),
|
|
1313
|
+
children: "Prev"
|
|
1314
|
+
}
|
|
1315
|
+
) }),
|
|
1316
|
+
Array.from({ length: Ye }, (e, t) => /* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1317
|
+
"button",
|
|
1318
|
+
{
|
|
1319
|
+
className: E(
|
|
1320
|
+
a.pageButton,
|
|
1321
|
+
X === t + 1 && a.pageButtonActive
|
|
1322
|
+
),
|
|
1323
|
+
onClick: () => I(() => G(t + 1)),
|
|
1324
|
+
children: t + 1
|
|
1325
|
+
}
|
|
1326
|
+
) }, t)),
|
|
1327
|
+
/* @__PURE__ */ r.jsx("li", { children: /* @__PURE__ */ r.jsx(
|
|
1328
|
+
"button",
|
|
1329
|
+
{
|
|
1330
|
+
className: a.pageButton,
|
|
1331
|
+
disabled: X === Ye,
|
|
1332
|
+
onClick: () => I(() => G((e) => e + 1)),
|
|
1333
|
+
children: "Next"
|
|
1334
|
+
}
|
|
1335
|
+
) })
|
|
1336
|
+
] }) }),
|
|
1337
|
+
!M && S === Z && /* @__PURE__ */ r.jsxs("div", { className: a.labelMuted, children: [
|
|
1338
|
+
"Showing",
|
|
1339
|
+
" ",
|
|
1340
|
+
(F ? pe.end : Q.length).toLocaleString(),
|
|
1341
|
+
" of",
|
|
1342
|
+
" ",
|
|
1343
|
+
D.length.toLocaleString(),
|
|
1344
|
+
" rows",
|
|
1345
|
+
F ? " (virtualized)" : ""
|
|
1346
|
+
] }),
|
|
1347
|
+
M && /* @__PURE__ */ r.jsxs("div", { className: a.labelMuted, children: [
|
|
1348
|
+
"Grouped view: ",
|
|
1349
|
+
D.length.toLocaleString(),
|
|
1350
|
+
" rows across",
|
|
1351
|
+
" ",
|
|
1352
|
+
R.length,
|
|
1353
|
+
" level",
|
|
1354
|
+
R.length > 1 ? "s" : ""
|
|
1355
|
+
] }),
|
|
1356
|
+
Oe && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
1357
|
+
/* @__PURE__ */ r.jsx("div", { className: a.backdrop, onClick: () => Ae(!1) }),
|
|
1358
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.drawer, children: [
|
|
1359
|
+
/* @__PURE__ */ r.jsx("h6", { className: a.drawerTitle, children: "Column Settings" }),
|
|
1360
|
+
/* @__PURE__ */ r.jsx("h6", { className: a.drawerSubtitle, children: "Visible Columns" }),
|
|
1361
|
+
U.map((e) => {
|
|
1362
|
+
const t = g.find((n) => n.key === e);
|
|
1363
|
+
return t ? /* @__PURE__ */ r.jsxs(
|
|
1364
|
+
"div",
|
|
1365
|
+
{
|
|
1366
|
+
className: a.drawerRow,
|
|
1367
|
+
draggable: !0,
|
|
1368
|
+
onDragStart: (n) => st(n, t.key),
|
|
1369
|
+
onDragOver: it,
|
|
1370
|
+
onDrop: (n) => lt(n, t.key),
|
|
1371
|
+
children: [
|
|
1372
|
+
/* @__PURE__ */ r.jsx(
|
|
1373
|
+
"input",
|
|
1374
|
+
{
|
|
1375
|
+
type: "checkbox",
|
|
1376
|
+
className: a.checkbox,
|
|
1377
|
+
checked: L.includes(t.key),
|
|
1378
|
+
onChange: () => I(
|
|
1379
|
+
() => te(
|
|
1380
|
+
(n) => n.includes(t.key) ? n.filter((s) => s !== t.key) : [...n, t.key]
|
|
1381
|
+
)
|
|
1382
|
+
)
|
|
1383
|
+
}
|
|
1384
|
+
),
|
|
1385
|
+
/* @__PURE__ */ r.jsx("label", { children: t.label }),
|
|
1386
|
+
/* @__PURE__ */ r.jsx("span", { className: E(a.spacerAuto, a.iconMuted), children: "⋮" })
|
|
1387
|
+
]
|
|
1388
|
+
},
|
|
1389
|
+
t.key
|
|
1390
|
+
) : null;
|
|
1391
|
+
}),
|
|
1392
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.drawerSection, children: [
|
|
1393
|
+
/* @__PURE__ */ r.jsxs(
|
|
1394
|
+
"button",
|
|
1395
|
+
{
|
|
1396
|
+
type: "button",
|
|
1397
|
+
className: a.sectionToggle,
|
|
1398
|
+
"aria-expanded": f.groupBy,
|
|
1399
|
+
onClick: () => _((e) => ({
|
|
1400
|
+
...e,
|
|
1401
|
+
groupBy: !e.groupBy
|
|
1402
|
+
})),
|
|
1403
|
+
children: [
|
|
1404
|
+
/* @__PURE__ */ r.jsx("span", { children: "Group By Columns" }),
|
|
1405
|
+
/* @__PURE__ */ r.jsx("span", { className: a.iconMuted, children: f.groupBy ? "▲" : "▼" })
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
),
|
|
1409
|
+
f.groupBy && /* @__PURE__ */ r.jsx("div", { className: a.sectionBody, children: U.map((e) => {
|
|
1410
|
+
const t = g.find((n) => n.key === e);
|
|
1411
|
+
return t ? /* @__PURE__ */ r.jsxs("div", { className: a.drawerRow, children: [
|
|
1412
|
+
/* @__PURE__ */ r.jsx(
|
|
1413
|
+
"input",
|
|
1414
|
+
{
|
|
1415
|
+
type: "checkbox",
|
|
1416
|
+
className: a.checkbox,
|
|
1417
|
+
checked: R.includes(t.key),
|
|
1418
|
+
onChange: () => jt(t.key)
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1421
|
+
/* @__PURE__ */ r.jsx("label", { children: t.label })
|
|
1422
|
+
] }, `group-${t.key}`) : null;
|
|
1423
|
+
}) })
|
|
1424
|
+
] }),
|
|
1425
|
+
/* @__PURE__ */ r.jsxs("div", { className: a.drawerSection, children: [
|
|
1426
|
+
/* @__PURE__ */ r.jsxs(
|
|
1427
|
+
"button",
|
|
1428
|
+
{
|
|
1429
|
+
type: "button",
|
|
1430
|
+
className: a.sectionToggle,
|
|
1431
|
+
"aria-expanded": f.aggregates,
|
|
1432
|
+
onClick: () => _((e) => ({
|
|
1433
|
+
...e,
|
|
1434
|
+
aggregates: !e.aggregates
|
|
1435
|
+
})),
|
|
1436
|
+
children: [
|
|
1437
|
+
/* @__PURE__ */ r.jsx("span", { children: "Show Total/Aggregate For" }),
|
|
1438
|
+
/* @__PURE__ */ r.jsx("span", { className: a.iconMuted, children: f.aggregates ? "▲" : "▼" })
|
|
1439
|
+
]
|
|
1440
|
+
}
|
|
1441
|
+
),
|
|
1442
|
+
f.aggregates && /* @__PURE__ */ r.jsxs("div", { className: a.sectionBody, children: [
|
|
1443
|
+
Ie.length === 0 && /* @__PURE__ */ r.jsx("div", { className: a.labelMuted, children: "No numeric columns available." }),
|
|
1444
|
+
U.map((e) => {
|
|
1445
|
+
const t = Ie.find((n) => n.key === e);
|
|
1446
|
+
return t ? /* @__PURE__ */ r.jsxs("div", { className: a.drawerRow, children: [
|
|
1447
|
+
/* @__PURE__ */ r.jsx(
|
|
1448
|
+
"input",
|
|
1449
|
+
{
|
|
1450
|
+
type: "checkbox",
|
|
1451
|
+
className: a.checkbox,
|
|
1452
|
+
checked: V.includes(t.key),
|
|
1453
|
+
onChange: () => St(t.key)
|
|
1454
|
+
}
|
|
1455
|
+
),
|
|
1456
|
+
/* @__PURE__ */ r.jsx("label", { children: t.label })
|
|
1457
|
+
] }, `total-${t.key}`) : null;
|
|
1458
|
+
})
|
|
1459
|
+
] })
|
|
1460
|
+
] })
|
|
1461
|
+
] })
|
|
1462
|
+
] })
|
|
1463
|
+
] });
|
|
1464
|
+
}
|
|
1465
|
+
export {
|
|
1466
|
+
Kr as AwesomeGrid
|
|
1467
|
+
};
|