jcicl 0.0.301 → 0.0.303
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/Table/Table.js +58 -56
- package/package.json +1 -1
package/Table/Table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import ke, { forwardRef as J, createElement as E, useState as
|
|
2
|
+
import ke, { forwardRef as J, createElement as E, useState as m, useMemo as _ } from "react";
|
|
3
3
|
import { n as i } from "../.chunks/emotion-styled.browser.esm.js";
|
|
4
4
|
import { Button as Se } from "../Button/Button.js";
|
|
5
5
|
/**
|
|
@@ -48,7 +48,7 @@ const Be = J(
|
|
|
48
48
|
size: r = 24,
|
|
49
49
|
strokeWidth: l = 2,
|
|
50
50
|
absoluteStrokeWidth: u,
|
|
51
|
-
className:
|
|
51
|
+
className: C = "",
|
|
52
52
|
children: b,
|
|
53
53
|
iconNode: s,
|
|
54
54
|
...x
|
|
@@ -61,7 +61,7 @@ const Be = J(
|
|
|
61
61
|
height: r,
|
|
62
62
|
stroke: n,
|
|
63
63
|
strokeWidth: u ? Number(l) * 24 / Number(r) : l,
|
|
64
|
-
className: Q("lucide",
|
|
64
|
+
className: Q("lucide", C),
|
|
65
65
|
...!b && !Ae(x) && { "aria-hidden": "true" },
|
|
66
66
|
...x
|
|
67
67
|
},
|
|
@@ -79,7 +79,7 @@ const Be = J(
|
|
|
79
79
|
*/
|
|
80
80
|
const z = (n, r) => {
|
|
81
81
|
const l = J(
|
|
82
|
-
({ className: u, ...
|
|
82
|
+
({ className: u, ...C }, b) => E(Be, {
|
|
83
83
|
ref: b,
|
|
84
84
|
iconNode: r,
|
|
85
85
|
className: Q(
|
|
@@ -87,7 +87,7 @@ const z = (n, r) => {
|
|
|
87
87
|
`lucide-${n}`,
|
|
88
88
|
u
|
|
89
89
|
),
|
|
90
|
-
...
|
|
90
|
+
...C
|
|
91
91
|
})
|
|
92
92
|
);
|
|
93
93
|
return l.displayName = Y(n), l;
|
|
@@ -152,17 +152,17 @@ const Te = [
|
|
|
152
152
|
* This source code is licensed under the ISC license.
|
|
153
153
|
* See the LICENSE file in the root directory of this source tree.
|
|
154
154
|
*/
|
|
155
|
-
const
|
|
155
|
+
const Re = [
|
|
156
156
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
157
157
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
158
|
-
], G = z("search",
|
|
158
|
+
], G = z("search", Re);
|
|
159
159
|
/**
|
|
160
160
|
* @license lucide-react v0.525.0 - ISC
|
|
161
161
|
*
|
|
162
162
|
* This source code is licensed under the ISC license.
|
|
163
163
|
* See the LICENSE file in the root directory of this source tree.
|
|
164
164
|
*/
|
|
165
|
-
const
|
|
165
|
+
const We = [
|
|
166
166
|
[
|
|
167
167
|
"path",
|
|
168
168
|
{
|
|
@@ -171,17 +171,17 @@ const Re = [
|
|
|
171
171
|
}
|
|
172
172
|
],
|
|
173
173
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
174
|
-
], $e = z("settings",
|
|
174
|
+
], $e = z("settings", We);
|
|
175
175
|
let v = "";
|
|
176
176
|
const Ue = ({
|
|
177
177
|
data: n = [],
|
|
178
178
|
columnTitles: r = {},
|
|
179
179
|
rowsPerPage: l = 19,
|
|
180
180
|
title: u = "Data Table",
|
|
181
|
-
onRowClick:
|
|
181
|
+
onRowClick: C,
|
|
182
182
|
hiddenColumns: b = []
|
|
183
183
|
}) => {
|
|
184
|
-
const [s, x] =
|
|
184
|
+
const [s, x] = m(1), [, D] = m(""), [d, M] = m({ key: "", direction: "asc" }), [w, B] = m(/* @__PURE__ */ new Set()), [T, N] = m(/* @__PURE__ */ new Set()), [V, X] = m(!1), [F, P] = m(!1), p = _(() => n.length === 0 ? [] : Object.keys(n[0]).filter((e) => !b.includes(e)), [n]);
|
|
185
185
|
ke.useEffect(() => {
|
|
186
186
|
p.length > 0 && (N(new Set(p)), B(new Set(p)));
|
|
187
187
|
}, [p]);
|
|
@@ -189,25 +189,25 @@ const Ue = ({
|
|
|
189
189
|
if (!v) return n;
|
|
190
190
|
const e = w.size > 0 ? w : new Set(p);
|
|
191
191
|
return n.filter((o) => Array.from(e).some((a) => {
|
|
192
|
-
const
|
|
193
|
-
return
|
|
192
|
+
const h = o[a];
|
|
193
|
+
return h && h.toString().toLowerCase().includes(v.toLowerCase());
|
|
194
194
|
}));
|
|
195
195
|
}, [n, v, w, p]), g = _(() => d.key ? [...L].sort((e, o) => e[d.key] < o[d.key] ? d.direction === "asc" ? -1 : 1 : e[d.key] > o[d.key] ? d.direction === "asc" ? 1 : -1 : 0) : L, [L, d]), I = p.filter((e) => T.has(e)), ee = () => {
|
|
196
196
|
if (!Array.isArray(g) || g.length === 0) return;
|
|
197
197
|
const e = I.map((S) => r[S] || S), o = (S) => {
|
|
198
198
|
const j = String(S ?? "");
|
|
199
199
|
return /[",\n]/.test(j) ? `"${j.replace(/"/g, '""')}"` : j;
|
|
200
|
-
},
|
|
200
|
+
}, h = [
|
|
201
201
|
e.join(","),
|
|
202
202
|
// header row
|
|
203
203
|
...g.map((S) => I.map((j) => o(S[j])).join(","))
|
|
204
204
|
].join(`
|
|
205
|
-
`), we = new Blob([
|
|
205
|
+
`), we = new Blob([h], { type: "text/csv;charset=utf-8;" }), A = document.createElement("a");
|
|
206
206
|
A.href = URL.createObjectURL(we), A.download = "data.csv", document.body.appendChild(A), A.click(), document.body.removeChild(A);
|
|
207
207
|
}, te = _(() => {
|
|
208
208
|
const e = (s - 1) * l;
|
|
209
209
|
return g.slice(e, e + l);
|
|
210
|
-
}, [g, s, l]),
|
|
210
|
+
}, [g, s, l]), f = Math.ceil(g.length / l), oe = (e) => {
|
|
211
211
|
M((o) => ({
|
|
212
212
|
key: e,
|
|
213
213
|
direction: o.key === e && o.direction === "asc" ? "desc" : "asc"
|
|
@@ -228,7 +228,7 @@ const Ue = ({
|
|
|
228
228
|
v = e;
|
|
229
229
|
}, U = () => {
|
|
230
230
|
D(v);
|
|
231
|
-
},
|
|
231
|
+
}, y = {
|
|
232
232
|
thActive: {
|
|
233
233
|
backgroundColor: "#009200",
|
|
234
234
|
color: "#ffffff"
|
|
@@ -281,12 +281,12 @@ const Ue = ({
|
|
|
281
281
|
gap: "15px",
|
|
282
282
|
alignItems: "center",
|
|
283
283
|
flexWrap: "wrap"
|
|
284
|
-
}),
|
|
284
|
+
}), fe = i("div")({
|
|
285
285
|
position: "relative",
|
|
286
286
|
display: "flex",
|
|
287
287
|
alignItems: "center",
|
|
288
288
|
flexGrow: 1
|
|
289
|
-
}),
|
|
289
|
+
}), he = i(G)({
|
|
290
290
|
position: "absolute",
|
|
291
291
|
left: "13px",
|
|
292
292
|
top: "10px",
|
|
@@ -345,7 +345,7 @@ const Ue = ({
|
|
|
345
345
|
minWidth: "200px",
|
|
346
346
|
maxHeight: "300px",
|
|
347
347
|
overflowY: "auto"
|
|
348
|
-
}),
|
|
348
|
+
}), R = i("div")({
|
|
349
349
|
padding: "12px 16px",
|
|
350
350
|
display: "flex",
|
|
351
351
|
alignItems: "center",
|
|
@@ -358,7 +358,7 @@ const Ue = ({
|
|
|
358
358
|
backgroundColor: "#f0f8f0",
|
|
359
359
|
color: "#005c00"
|
|
360
360
|
}
|
|
361
|
-
}),
|
|
361
|
+
}), W = i("input")({
|
|
362
362
|
width: "16px",
|
|
363
363
|
height: "16px",
|
|
364
364
|
accentColor: "#009200"
|
|
@@ -395,13 +395,15 @@ const Ue = ({
|
|
|
395
395
|
}), Ce = i("span")({
|
|
396
396
|
marginLeft: "8px",
|
|
397
397
|
opacity: 0.6
|
|
398
|
-
}), q = i("tr")({
|
|
398
|
+
}), q = i("tr")(({ interactableRow: e }) => ({
|
|
399
399
|
transition: "all 0.2s ease",
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
...e && {
|
|
401
|
+
"&:focus, &:hover, &:focus-within": {
|
|
402
|
+
backgroundColor: "#f8fff8",
|
|
403
|
+
cursor: "pointer"
|
|
404
|
+
}
|
|
403
405
|
}
|
|
404
|
-
}), ye = i("div")({
|
|
406
|
+
})), ye = i("div")({
|
|
405
407
|
display: "flex",
|
|
406
408
|
justifyContent: "center",
|
|
407
409
|
alignItems: "center",
|
|
@@ -443,8 +445,8 @@ const Ue = ({
|
|
|
443
445
|
/* @__PURE__ */ t(Se, { onClick: ee, children: "Export to CSV" })
|
|
444
446
|
] }),
|
|
445
447
|
/* @__PURE__ */ c(pe, { children: [
|
|
446
|
-
/* @__PURE__ */ c(
|
|
447
|
-
/* @__PURE__ */ t(
|
|
448
|
+
/* @__PURE__ */ c(fe, { children: [
|
|
449
|
+
/* @__PURE__ */ t(he, { onClick: U }),
|
|
448
450
|
/* @__PURE__ */ t(
|
|
449
451
|
ue,
|
|
450
452
|
{
|
|
@@ -465,9 +467,9 @@ const Ue = ({
|
|
|
465
467
|
/* @__PURE__ */ t($, { size: 16 })
|
|
466
468
|
] }),
|
|
467
469
|
F && /* @__PURE__ */ c(H, { children: [
|
|
468
|
-
/* @__PURE__ */ c(
|
|
470
|
+
/* @__PURE__ */ c(R, { onClick: re, children: [
|
|
469
471
|
/* @__PURE__ */ t(
|
|
470
|
-
|
|
472
|
+
W,
|
|
471
473
|
{
|
|
472
474
|
type: "checkbox",
|
|
473
475
|
checked: w.size === p.length,
|
|
@@ -478,8 +480,8 @@ const Ue = ({
|
|
|
478
480
|
/* @__PURE__ */ t("span", { style: { fontWeight: "bold" }, children: "All" })
|
|
479
481
|
] }),
|
|
480
482
|
/* @__PURE__ */ t("div", { style: { height: "1px", backgroundColor: "#e0e0e0", margin: "4px 0" } }),
|
|
481
|
-
p.map((e) => /* @__PURE__ */ c(
|
|
482
|
-
/* @__PURE__ */ t(
|
|
483
|
+
p.map((e) => /* @__PURE__ */ c(R, { onClick: () => ne(e), children: [
|
|
484
|
+
/* @__PURE__ */ t(W, { type: "checkbox", checked: w.has(e), onChange: () => {
|
|
483
485
|
} }),
|
|
484
486
|
/* @__PURE__ */ t("span", { children: r[e] || e })
|
|
485
487
|
] }, e))
|
|
@@ -491,8 +493,8 @@ const Ue = ({
|
|
|
491
493
|
"Columns",
|
|
492
494
|
/* @__PURE__ */ t($, { size: 16 })
|
|
493
495
|
] }),
|
|
494
|
-
V && /* @__PURE__ */ t(H, { children: p.map((e) => /* @__PURE__ */ c(
|
|
495
|
-
/* @__PURE__ */ t(
|
|
496
|
+
V && /* @__PURE__ */ t(H, { children: p.map((e) => /* @__PURE__ */ c(R, { onClick: () => ie(e), children: [
|
|
497
|
+
/* @__PURE__ */ t(W, { type: "checkbox", checked: T.has(e), onChange: () => {
|
|
496
498
|
} }),
|
|
497
499
|
T.has(e) ? /* @__PURE__ */ t(Le, { size: 16 }) : /* @__PURE__ */ t(Me, { size: 16 }),
|
|
498
500
|
/* @__PURE__ */ t("span", { children: r[e] || e })
|
|
@@ -501,10 +503,10 @@ const Ue = ({
|
|
|
501
503
|
] })
|
|
502
504
|
] }),
|
|
503
505
|
/* @__PURE__ */ c(xe, { children: [
|
|
504
|
-
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t(q, { children: I.map((e) => /* @__PURE__ */ c(
|
|
506
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t(q, { interactableRow: !1, children: I.map((e) => /* @__PURE__ */ c(
|
|
505
507
|
ge,
|
|
506
508
|
{
|
|
507
|
-
style: d.key === e ?
|
|
509
|
+
style: d.key === e ? y.thActive : {},
|
|
508
510
|
onClick: () => oe(e),
|
|
509
511
|
children: [
|
|
510
512
|
r[e] || e,
|
|
@@ -513,13 +515,13 @@ const Ue = ({
|
|
|
513
515
|
},
|
|
514
516
|
e
|
|
515
517
|
)) }) }),
|
|
516
|
-
/* @__PURE__ */ t("tbody", { children: te.map((e, o) => /* @__PURE__ */ t(q, { onClick: () =>
|
|
518
|
+
/* @__PURE__ */ t("tbody", { children: te.map((e, o) => /* @__PURE__ */ t(q, { onClick: () => C && C(e), interactableRow: !!C, children: I.map((a) => /* @__PURE__ */ t(be, { children: e[a] }, a)) }, o)) })
|
|
517
519
|
] }),
|
|
518
520
|
/* @__PURE__ */ c(ye, { children: [
|
|
519
521
|
/* @__PURE__ */ t(
|
|
520
522
|
k,
|
|
521
523
|
{
|
|
522
|
-
style: s === 1 ?
|
|
524
|
+
style: s === 1 ? y.paginationButtonDisabled : {},
|
|
523
525
|
onClick: () => x(Math.max(1, s - 1)),
|
|
524
526
|
disabled: s === 1,
|
|
525
527
|
children: "Previous"
|
|
@@ -527,13 +529,13 @@ const Ue = ({
|
|
|
527
529
|
),
|
|
528
530
|
(() => {
|
|
529
531
|
const e = [];
|
|
530
|
-
if (
|
|
531
|
-
for (let o = 1; o <=
|
|
532
|
+
if (f <= 5)
|
|
533
|
+
for (let o = 1; o <= f; o++)
|
|
532
534
|
e.push(
|
|
533
535
|
/* @__PURE__ */ t(
|
|
534
536
|
k,
|
|
535
537
|
{
|
|
536
|
-
style: s === o ?
|
|
538
|
+
style: s === o ? y.paginationButtonActive : {},
|
|
537
539
|
onClick: () => x(o),
|
|
538
540
|
children: o
|
|
539
541
|
},
|
|
@@ -545,35 +547,35 @@ const Ue = ({
|
|
|
545
547
|
/* @__PURE__ */ t(
|
|
546
548
|
k,
|
|
547
549
|
{
|
|
548
|
-
style: s === 1 ?
|
|
550
|
+
style: s === 1 ? y.paginationButtonActive : {},
|
|
549
551
|
onClick: () => x(1),
|
|
550
552
|
children: "1"
|
|
551
553
|
},
|
|
552
554
|
1
|
|
553
555
|
)
|
|
554
556
|
), s > 3 && e.push(/* @__PURE__ */ t(K, { children: "..." }, "ellipsis1"));
|
|
555
|
-
const o = Math.max(2, s - 1), a = Math.min(
|
|
556
|
-
for (let
|
|
557
|
+
const o = Math.max(2, s - 1), a = Math.min(f - 1, s + 1);
|
|
558
|
+
for (let h = o; h <= a; h++)
|
|
557
559
|
e.push(
|
|
558
560
|
/* @__PURE__ */ t(
|
|
559
561
|
k,
|
|
560
562
|
{
|
|
561
|
-
style: s ===
|
|
562
|
-
onClick: () => x(
|
|
563
|
-
children:
|
|
563
|
+
style: s === h ? y.paginationButtonActive : {},
|
|
564
|
+
onClick: () => x(h),
|
|
565
|
+
children: h
|
|
564
566
|
},
|
|
565
|
-
|
|
567
|
+
h
|
|
566
568
|
)
|
|
567
569
|
);
|
|
568
|
-
s <
|
|
570
|
+
s < f - 2 && e.push(/* @__PURE__ */ t(K, { children: "..." }, "ellipsis2")), f > 1 && e.push(
|
|
569
571
|
/* @__PURE__ */ t(
|
|
570
572
|
k,
|
|
571
573
|
{
|
|
572
|
-
style: s ===
|
|
573
|
-
onClick: () => x(
|
|
574
|
-
children:
|
|
574
|
+
style: s === f ? y.paginationButtonActive : {},
|
|
575
|
+
onClick: () => x(f),
|
|
576
|
+
children: f
|
|
575
577
|
},
|
|
576
|
-
|
|
578
|
+
f
|
|
577
579
|
)
|
|
578
580
|
);
|
|
579
581
|
}
|
|
@@ -582,9 +584,9 @@ const Ue = ({
|
|
|
582
584
|
/* @__PURE__ */ t(
|
|
583
585
|
k,
|
|
584
586
|
{
|
|
585
|
-
style: s ===
|
|
586
|
-
onClick: () => x(Math.min(
|
|
587
|
-
disabled: s ===
|
|
587
|
+
style: s === f ? y.paginationButtonDisabled : {},
|
|
588
|
+
onClick: () => x(Math.min(f, s + 1)),
|
|
589
|
+
disabled: s === f,
|
|
588
590
|
children: "Next"
|
|
589
591
|
}
|
|
590
592
|
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcicl",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.303",
|
|
5
5
|
"description": "Component library for the websites of Johnson County Iowa",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://devops.jc.net/JCIT/Business%20Solutions%20Delivery/_git/JCComponentLibrary?path=%2FREADME.md&version=GBmaster",
|