@wavelengthusaf/components 3.0.3 → 3.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 +15 -0
- package/dist/cjs/index.cjs +649 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +68 -4
- package/dist/esm/index.d.ts +68 -4
- package/dist/esm/index.js +653 -7
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -206,7 +206,7 @@ var require_react_is_development = __commonJS({
|
|
|
206
206
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
207
207
|
var Element = REACT_ELEMENT_TYPE;
|
|
208
208
|
var ForwardRef2 = REACT_FORWARD_REF_TYPE;
|
|
209
|
-
var
|
|
209
|
+
var Fragment18 = REACT_FRAGMENT_TYPE;
|
|
210
210
|
var Lazy = REACT_LAZY_TYPE;
|
|
211
211
|
var Memo2 = REACT_MEMO_TYPE;
|
|
212
212
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -265,7 +265,7 @@ var require_react_is_development = __commonJS({
|
|
|
265
265
|
exports.ContextProvider = ContextProvider;
|
|
266
266
|
exports.Element = Element;
|
|
267
267
|
exports.ForwardRef = ForwardRef2;
|
|
268
|
-
exports.Fragment =
|
|
268
|
+
exports.Fragment = Fragment18;
|
|
269
269
|
exports.Lazy = Lazy;
|
|
270
270
|
exports.Memo = Memo2;
|
|
271
271
|
exports.Portal = Portal;
|
|
@@ -7342,32 +7342,678 @@ var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages }) => {
|
|
|
7342
7342
|
] });
|
|
7343
7343
|
};
|
|
7344
7344
|
|
|
7345
|
+
// src/components/DataTable/SubRowTable/ChildSubTable.tsx
|
|
7346
|
+
import { useMemo as useMemo3, useState as useState11, Fragment as Fragment14 } from "react";
|
|
7347
|
+
import styled12, { keyframes as keyframes2 } from "styled-components";
|
|
7348
|
+
import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
7349
|
+
var downWardAnimation = keyframes2`
|
|
7350
|
+
0% { top: -122px; }
|
|
7351
|
+
100% { top: 0px; }
|
|
7352
|
+
`;
|
|
7353
|
+
var disSubTableAnim = keyframes2`
|
|
7354
|
+
0% { opacity: 0; }
|
|
7355
|
+
25% { opacity: 0; }
|
|
7356
|
+
50% { opacity: 0; }
|
|
7357
|
+
60% { opacity: 0.2; }
|
|
7358
|
+
75% { opacity: 0.8; }
|
|
7359
|
+
100% { opacity: 1; }
|
|
7360
|
+
`;
|
|
7361
|
+
var TableContainer = styled12.div`
|
|
7362
|
+
background-color: white;
|
|
7363
|
+
width: 1200px;
|
|
7364
|
+
border-radius: 16px;
|
|
7365
|
+
`;
|
|
7366
|
+
var TableRow = styled12.div`
|
|
7367
|
+
display: grid;
|
|
7368
|
+
grid-template-columns: ${({ $amountofColumns }) => `repeat(${$amountofColumns}, 1fr)`};
|
|
7369
|
+
`;
|
|
7370
|
+
var TablePrimaryRow = styled12.div`
|
|
7371
|
+
display: grid;
|
|
7372
|
+
grid-template-columns: ${({ $amountofColumns }) => `repeat(${$amountofColumns}, 1fr)`};
|
|
7373
|
+
margin-bottom: 25px;
|
|
7374
|
+
`;
|
|
7375
|
+
var BodyRowContainer = styled12.div`
|
|
7376
|
+
border: 1px solid black;
|
|
7377
|
+
background-color: white;
|
|
7378
|
+
border-radius: 16px;
|
|
7379
|
+
overflow: hidden;
|
|
7380
|
+
margin-bottom: 10px;
|
|
7381
|
+
`;
|
|
7382
|
+
var TableHeaderCell = styled12.div`
|
|
7383
|
+
padding-left: 12px;
|
|
7384
|
+
padding-right: 25px;
|
|
7385
|
+
`;
|
|
7386
|
+
var TableBodyCell = styled12.div`
|
|
7387
|
+
background-color: #fff;
|
|
7388
|
+
color: black;
|
|
7389
|
+
position: relative;
|
|
7390
|
+
padding: 10px 5px 0px 20px;
|
|
7391
|
+
text-wrap: balance;
|
|
7392
|
+
font-size: ${(props) => props.$primaryBoldState ? "24px" : "16px"};
|
|
7393
|
+
font-weight: ${(props) => props.$primaryBoldState ? "bold" : "normal"};
|
|
7394
|
+
`;
|
|
7395
|
+
var ButtonStylingRow = styled12.div`
|
|
7396
|
+
display: flex;
|
|
7397
|
+
flex-direction: row;
|
|
7398
|
+
`;
|
|
7399
|
+
var BottomArrowBar = styled12.div`
|
|
7400
|
+
background-color: #e9e9e9;
|
|
7401
|
+
text-align: center;
|
|
7402
|
+
`;
|
|
7403
|
+
var BottomUpArrowBar = styled12.div`
|
|
7404
|
+
background-color: #e9e9e9;
|
|
7405
|
+
text-align: center;
|
|
7406
|
+
position: relative;
|
|
7407
|
+
animation: ${downWardAnimation} 1.5s;
|
|
7408
|
+
`;
|
|
7409
|
+
var SubDataTable = styled12.table`
|
|
7410
|
+
background-color: white;
|
|
7411
|
+
color: black;
|
|
7412
|
+
width: 100%;
|
|
7413
|
+
border-collapse: collapse;
|
|
7414
|
+
animation: ${disSubTableAnim} 1.5s;
|
|
7415
|
+
|
|
7416
|
+
line-height: 1.2;
|
|
7417
|
+
`;
|
|
7418
|
+
var SubDataTableHeaderRow = styled12.tr`
|
|
7419
|
+
height: 50px;
|
|
7420
|
+
background-color: #304359;
|
|
7421
|
+
color: white;
|
|
7422
|
+
font-size: 16px;
|
|
7423
|
+
font-weight: bold;
|
|
7424
|
+
|
|
7425
|
+
th {
|
|
7426
|
+
white-space: nowrap;
|
|
7427
|
+
}
|
|
7428
|
+
`;
|
|
7429
|
+
var SubDataTableBodyRow = styled12.tbody`
|
|
7430
|
+
font-size: 14px;
|
|
7431
|
+
`;
|
|
7432
|
+
var SubDataTableBodyRowContainer = styled12.tr`
|
|
7433
|
+
td {
|
|
7434
|
+
padding: 10px 25px 10px 20px;
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7437
|
+
&:nth-child(even) {
|
|
7438
|
+
background-color: #96e0e5;
|
|
7439
|
+
}
|
|
7440
|
+
`;
|
|
7441
|
+
var SubDataTableCell = styled12.td`
|
|
7442
|
+
text-align: center;
|
|
7443
|
+
`;
|
|
7444
|
+
var SubDataHeaderColumn = styled12.thead`
|
|
7445
|
+
background-color: #304359;
|
|
7446
|
+
`;
|
|
7447
|
+
var SortButton = styled12.button`
|
|
7448
|
+
font-size: 16px;
|
|
7449
|
+
font-weight: bold;
|
|
7450
|
+
color: ${(props) => props.$sortColor};
|
|
7451
|
+
background-color: #11ffee00;
|
|
7452
|
+
border: none;
|
|
7453
|
+
white-space: nowrap;
|
|
7454
|
+
`;
|
|
7455
|
+
var DownloadMissionButton = styled12.button`
|
|
7456
|
+
width: 217px;
|
|
7457
|
+
height: 45px;
|
|
7458
|
+
padding: 12px 32px 12px 32px;
|
|
7459
|
+
background-color: #1a8083cc;
|
|
7460
|
+
color: white;
|
|
7461
|
+
|
|
7462
|
+
margin-left: 22px;
|
|
7463
|
+
margin-bottom: 15px;
|
|
7464
|
+
margin-top: 10px;
|
|
7465
|
+
white-space: nowrap;
|
|
7466
|
+
border: none;
|
|
7467
|
+
border-radius: 8px;
|
|
7468
|
+
gap: 4px;
|
|
7469
|
+
|
|
7470
|
+
font-weight: 600;
|
|
7471
|
+
font-size: 16px;
|
|
7472
|
+
|
|
7473
|
+
&:hover {
|
|
7474
|
+
background-color: rgba(38, 186, 190, 1);
|
|
7475
|
+
color: rgba(247, 247, 249, 1);
|
|
7476
|
+
cursor: pointer;
|
|
7477
|
+
}
|
|
7478
|
+
|
|
7479
|
+
&:active {
|
|
7480
|
+
background-color: #67a8aa;
|
|
7481
|
+
transition: background-color 0.2s ease;
|
|
7482
|
+
}
|
|
7483
|
+
`;
|
|
7484
|
+
var AddButton = styled12.button`
|
|
7485
|
+
width: 130px;
|
|
7486
|
+
height: 45px;
|
|
7487
|
+
border: 1px solid #1a8083;
|
|
7488
|
+
|
|
7489
|
+
padding: 12px 32px 12px 32px;
|
|
7490
|
+
gap: 4px;
|
|
7491
|
+
background-color: white;
|
|
7492
|
+
color: #1a8083cc;
|
|
7493
|
+
|
|
7494
|
+
margin-left: 22px;
|
|
7495
|
+
margin-bottom: 15px;
|
|
7496
|
+
margin-top: 10px;
|
|
7497
|
+
white-space: nowrap;
|
|
7498
|
+
border-radius: 8px;
|
|
7499
|
+
|
|
7500
|
+
font-weight: 600;
|
|
7501
|
+
font-size: 16px;
|
|
7502
|
+
|
|
7503
|
+
&:hover {
|
|
7504
|
+
background-color: rgba(26, 128, 131, 0.1);
|
|
7505
|
+
color: rgba(26, 128, 131, 1);
|
|
7506
|
+
cursor: pointer;
|
|
7507
|
+
}
|
|
7508
|
+
|
|
7509
|
+
&:active {
|
|
7510
|
+
background-color: #bad7da;
|
|
7511
|
+
transition: background-color 0.2s ease;
|
|
7512
|
+
}
|
|
7513
|
+
`;
|
|
7514
|
+
var DownloadArrow = styled12.button`
|
|
7515
|
+
background-color: transparent;
|
|
7516
|
+
border: none;
|
|
7517
|
+
|
|
7518
|
+
&:active {
|
|
7519
|
+
transform: scale(0.95);
|
|
7520
|
+
}
|
|
7521
|
+
`;
|
|
7522
|
+
var ChildDataTable = ({ data, columns, downloadArrowOnClick, downloadMissionOnClick, addFilesOnClick }) => {
|
|
7523
|
+
const HeadColumns = columns.filter((col) => col.subDataTableColumn === false);
|
|
7524
|
+
const SubDataColumns = columns.filter((col) => col.subDataTableColumn === true);
|
|
7525
|
+
const [openRow, setOpenRow] = useState11(null);
|
|
7526
|
+
const [sortOrder, setSortOrder] = useState11("asc");
|
|
7527
|
+
const [sortKey, setSortKey] = useState11("");
|
|
7528
|
+
const [sortSubOrder, setSortSubOrder] = useState11("asc");
|
|
7529
|
+
const [sortSubKey, setSortSubKey] = useState11("");
|
|
7530
|
+
const toggleSortOrder = (key) => {
|
|
7531
|
+
setSortOrder(sortOrder === "asc" ? "desc" : "asc");
|
|
7532
|
+
setSortKey(key);
|
|
7533
|
+
};
|
|
7534
|
+
const toggleSubSortOrder = (key) => {
|
|
7535
|
+
setSortSubOrder(sortSubOrder === "asc" ? "desc" : "asc");
|
|
7536
|
+
setSortSubKey(key);
|
|
7537
|
+
};
|
|
7538
|
+
const toggleDropdown = (id) => {
|
|
7539
|
+
setOpenRow(openRow === id ? null : id);
|
|
7540
|
+
};
|
|
7541
|
+
const toggleUpward = () => {
|
|
7542
|
+
setOpenRow(null);
|
|
7543
|
+
};
|
|
7544
|
+
function trimBeforePeriod2(text) {
|
|
7545
|
+
const index = text.indexOf(".");
|
|
7546
|
+
return index === -1 ? text : text.substring(index + 1);
|
|
7547
|
+
}
|
|
7548
|
+
const processedRowData = useMemo3(() => {
|
|
7549
|
+
const result = [...data ?? []];
|
|
7550
|
+
if (sortOrder) {
|
|
7551
|
+
result.sort((a, b) => {
|
|
7552
|
+
const valueA = a[sortKey];
|
|
7553
|
+
const valueB = b[sortKey];
|
|
7554
|
+
if (typeof valueA === "string" && typeof valueB === "string") {
|
|
7555
|
+
if (sortOrder === "asc") {
|
|
7556
|
+
return valueA.localeCompare(valueB);
|
|
7557
|
+
} else {
|
|
7558
|
+
return valueB.localeCompare(valueA);
|
|
7559
|
+
}
|
|
7560
|
+
} else if (typeof valueA === "number" && typeof valueB === "number") {
|
|
7561
|
+
if (sortOrder === "asc") {
|
|
7562
|
+
return valueA - valueB;
|
|
7563
|
+
} else {
|
|
7564
|
+
return valueB - valueA;
|
|
7565
|
+
}
|
|
7566
|
+
} else {
|
|
7567
|
+
return 0;
|
|
7568
|
+
}
|
|
7569
|
+
});
|
|
7570
|
+
}
|
|
7571
|
+
if (sortSubOrder) {
|
|
7572
|
+
result.map(
|
|
7573
|
+
(item) => item.Details?.fileObjects.sort((c, d) => {
|
|
7574
|
+
const valueC = c[sortSubKey];
|
|
7575
|
+
const valueD = d[sortSubKey];
|
|
7576
|
+
if (typeof valueC === "string" && typeof valueD === "string") {
|
|
7577
|
+
if (sortSubOrder === "asc") {
|
|
7578
|
+
return valueC.localeCompare(valueD);
|
|
7579
|
+
} else {
|
|
7580
|
+
return valueD.localeCompare(valueC);
|
|
7581
|
+
}
|
|
7582
|
+
} else if (typeof valueC === "number" && typeof valueD === "number") {
|
|
7583
|
+
if (sortSubOrder === "asc") {
|
|
7584
|
+
return valueC - valueD;
|
|
7585
|
+
} else {
|
|
7586
|
+
return valueD - valueC;
|
|
7587
|
+
}
|
|
7588
|
+
} else {
|
|
7589
|
+
return 0;
|
|
7590
|
+
}
|
|
7591
|
+
})
|
|
7592
|
+
);
|
|
7593
|
+
}
|
|
7594
|
+
return result;
|
|
7595
|
+
}, [data, sortKey, sortOrder, sortSubKey, sortSubOrder]);
|
|
7596
|
+
const renderSortButton = (column, sortOrder2, sortKey2) => {
|
|
7597
|
+
return sortKey2 === column.key ? sortOrder2 === "asc" ? /* @__PURE__ */ jsx42(Fragment15, { children: /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "black", onClick: () => toggleSortOrder(column.key), children: [
|
|
7598
|
+
column.title,
|
|
7599
|
+
" ",
|
|
7600
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 0.368774L7.5 6.09377L1.7625 0.368774L0 2.13127L7.5 9.63127L15 2.13127L13.2375 0.368774Z", fill: "black" }) })
|
|
7601
|
+
] }) }) : /* @__PURE__ */ jsx42(Fragment15, { children: /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "black", onClick: () => toggleSortOrder(column.key), children: [
|
|
7602
|
+
column.title,
|
|
7603
|
+
" ",
|
|
7604
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 9.2627L7.5 3.5377L1.7625 9.2627L0 7.5002L7.5 0.000196457L15 7.5002L13.2375 9.2627Z", fill: "black" }) })
|
|
7605
|
+
] }) }) : /* @__PURE__ */ jsx42(Fragment15, { children: /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "black", onClick: () => toggleSortOrder(column.key), children: [
|
|
7606
|
+
column.title,
|
|
7607
|
+
" ",
|
|
7608
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 0.368774L7.5 6.09377L1.7625 0.368774L0 2.13127L7.5 9.63127L15 2.13127L13.2375 0.368774Z", fill: "black" }) })
|
|
7609
|
+
] }) });
|
|
7610
|
+
};
|
|
7611
|
+
const renderSortSubButton = (column, sortSubOrder2, sortSubKey2) => {
|
|
7612
|
+
const columnKey = trimBeforePeriod2(column.key);
|
|
7613
|
+
return sortSubKey2 === columnKey ? sortSubOrder2 === "asc" ? /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "white", onClick: () => toggleSubSortOrder(columnKey), children: [
|
|
7614
|
+
column.title,
|
|
7615
|
+
" ",
|
|
7616
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 0.368774L7.5 6.09377L1.7625 0.368774L0 2.13127L7.5 9.63127L15 2.13127L13.2375 0.368774Z", fill: "white" }) })
|
|
7617
|
+
] }) : /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "white", onClick: () => toggleSubSortOrder(columnKey), children: [
|
|
7618
|
+
column.title,
|
|
7619
|
+
" ",
|
|
7620
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 9.2627L7.5 3.5377L1.7625 9.2627L0 7.5002L7.5 0.000196457L15 7.5002L13.2375 9.2627Z", fill: "white" }) })
|
|
7621
|
+
] }) : /* @__PURE__ */ jsxs32(SortButton, { $sortColor: "white", onClick: () => toggleSubSortOrder(columnKey), children: [
|
|
7622
|
+
column.title,
|
|
7623
|
+
" ",
|
|
7624
|
+
/* @__PURE__ */ jsx42("svg", { width: "15", height: "10", viewBox: "0 0 15 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M13.2375 0.368774L7.5 6.09377L1.7625 0.368774L0 2.13127L7.5 9.63127L15 2.13127L13.2375 0.368774Z", fill: "white" }) })
|
|
7625
|
+
] });
|
|
7626
|
+
};
|
|
7627
|
+
const headers = HeadColumns.map((column) => {
|
|
7628
|
+
return /* @__PURE__ */ jsx42(TableHeaderCell, { children: renderSortButton(column, sortOrder, sortKey) }, `HeaderCell-${column.key}`);
|
|
7629
|
+
});
|
|
7630
|
+
const SubDataHeaders = SubDataColumns.map((column, index) => {
|
|
7631
|
+
return /* @__PURE__ */ jsx42("th", { children: renderSortSubButton(column, sortSubOrder, sortSubKey) }, `SubHeadCell-${index}`);
|
|
7632
|
+
});
|
|
7633
|
+
const subDataRows = (itemId) => {
|
|
7634
|
+
return processedRowData.filter((item) => item.Details?.relationId === itemId).map((item) => /* @__PURE__ */ jsx42(Fragment14, { children: item.Details?.fileObjects.map((fileItem, index) => /* @__PURE__ */ jsxs32(SubDataTableBodyRowContainer, { children: [
|
|
7635
|
+
/* @__PURE__ */ jsx42("td", { children: /* @__PURE__ */ jsx42(DownloadArrow, { onClick: downloadArrowOnClick, children: /* @__PURE__ */ jsx42("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42(
|
|
7636
|
+
"path",
|
|
7637
|
+
{
|
|
7638
|
+
d: "M8.5 12L3.5 7L4.9 5.55L7.5 8.15V0H9.5V8.15L12.1 5.55L13.5 7L8.5 12ZM2.5 16C1.95 16 1.47917 15.8042 1.0875 15.4125C0.695833 15.0208 0.5 14.55 0.5 14V11H2.5V14H14.5V11H16.5V14C16.5 14.55 16.3042 15.0208 15.9125 15.4125C15.5208 15.8042 15.05 16 14.5 16H2.5Z",
|
|
7639
|
+
fill: "#1C1B1F"
|
|
7640
|
+
}
|
|
7641
|
+
) }) }) }, `td-${item.Details?.relationId}-${fileItem.id}`),
|
|
7642
|
+
SubDataColumns.map((column) => {
|
|
7643
|
+
const columnKey = trimBeforePeriod2(column.key);
|
|
7644
|
+
const value = fileItem[columnKey];
|
|
7645
|
+
if (value !== void 0) {
|
|
7646
|
+
return /* @__PURE__ */ jsx42(SubDataTableCell, { children: /* @__PURE__ */ jsx42("span", { children: value }, `span-${item.Details?.relationId}-${fileItem.id}-${index}-${column.title}`) }, `fileitem-${item}-${item.Details?.relationId}-${fileItem.id}-${index}-${column.title}`);
|
|
7647
|
+
}
|
|
7648
|
+
})
|
|
7649
|
+
] }, `${item}-${item.Details?.relationId}-${fileItem.id}-${index}`)) }, `SDR-${item.id}-${item.Details?.relationId}`));
|
|
7650
|
+
};
|
|
7651
|
+
const dataRows = processedRowData?.map((item, index) => /* @__PURE__ */ jsxs32(BodyRowContainer, { children: [
|
|
7652
|
+
/* @__PURE__ */ jsx42(TableRow, { $amountofColumns: HeadColumns.length, children: HeadColumns.map((column) => /* @__PURE__ */ jsx42(TableBodyCell, { $primaryBoldState: column.PrimaryBoldText, children: item[column.key] }, `TableBodycell-${item.id}-${column.key}`)) }),
|
|
7653
|
+
/* @__PURE__ */ jsxs32(ButtonStylingRow, { children: [
|
|
7654
|
+
/* @__PURE__ */ jsx42(DownloadMissionButton, { onClick: downloadMissionOnClick, children: "Download Mission" }),
|
|
7655
|
+
/* @__PURE__ */ jsx42(AddButton, { onClick: addFilesOnClick, children: "Add files" })
|
|
7656
|
+
] }),
|
|
7657
|
+
openRow !== item.id && /* @__PURE__ */ jsx42(BottomArrowBar, { onClick: () => toggleDropdown(item.id), children: /* @__PURE__ */ jsx42("svg", { width: "92", height: "14", viewBox: "0 0 92 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M64 0L44 6L24 0H0L44 14L92 0H64Z", fill: "#7A7A7A" }) }) }),
|
|
7658
|
+
openRow === item.id && /* @__PURE__ */ jsxs32("div", { children: [
|
|
7659
|
+
/* @__PURE__ */ jsxs32(SubDataTable, { children: [
|
|
7660
|
+
/* @__PURE__ */ jsx42(SubDataHeaderColumn, { children: /* @__PURE__ */ jsxs32(SubDataTableHeaderRow, { children: [
|
|
7661
|
+
/* @__PURE__ */ jsx42("th", {}),
|
|
7662
|
+
SubDataHeaders
|
|
7663
|
+
] }) }),
|
|
7664
|
+
/* @__PURE__ */ jsx42(SubDataTableBodyRow, { children: subDataRows(item.id) })
|
|
7665
|
+
] }),
|
|
7666
|
+
/* @__PURE__ */ jsx42(BottomUpArrowBar, { onClick: () => toggleUpward(), children: /* @__PURE__ */ jsx42("svg", { width: "92", height: "14", viewBox: "0 0 92 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M64 14L44 8L24 14H0L44 0L92 14H64Z", fill: "#7A7A7A" }) }) })
|
|
7667
|
+
] })
|
|
7668
|
+
] }, `Bodycontainer-${item.id}-${index}`));
|
|
7669
|
+
return /* @__PURE__ */ jsxs32(TableContainer, { children: [
|
|
7670
|
+
/* @__PURE__ */ jsx42(TablePrimaryRow, { $amountofColumns: HeadColumns.length, children: headers }),
|
|
7671
|
+
/* @__PURE__ */ jsx42("div", { title: "tablebodies", children: dataRows })
|
|
7672
|
+
] });
|
|
7673
|
+
};
|
|
7674
|
+
|
|
7675
|
+
// src/components/DataTable/NestedDataTable/NestedDataTable.tsx
|
|
7676
|
+
import { useState as useState12 } from "react";
|
|
7677
|
+
import styled13 from "styled-components";
|
|
7678
|
+
import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7679
|
+
var TableStyle = styled13.table`
|
|
7680
|
+
width: 100%;
|
|
7681
|
+
height: 100%;
|
|
7682
|
+
border-collapse: collapse;
|
|
7683
|
+
color: black;
|
|
7684
|
+
text-align: center;
|
|
7685
|
+
|
|
7686
|
+
thead {
|
|
7687
|
+
background-color: black;
|
|
7688
|
+
color: white;
|
|
7689
|
+
}
|
|
7690
|
+
|
|
7691
|
+
margin-left: auto;
|
|
7692
|
+
margin-right: auto;
|
|
7693
|
+
position: absolute;
|
|
7694
|
+
`;
|
|
7695
|
+
var MainThHeaders = styled13.th`
|
|
7696
|
+
&:not(:last-child) {
|
|
7697
|
+
border-right: 1px solid #c6c7cc;
|
|
7698
|
+
}
|
|
7699
|
+
`;
|
|
7700
|
+
var SubDataTr = styled13.tr`
|
|
7701
|
+
background-color: white;
|
|
7702
|
+
|
|
7703
|
+
&:nth-child(even) {
|
|
7704
|
+
background-color: #e0ffff;
|
|
7705
|
+
}
|
|
7706
|
+
`;
|
|
7707
|
+
var PrimaryTrRows = styled13.tr`
|
|
7708
|
+
background-color: ${(props) => props.$index % 2 === 0 ? "white" : "#e0ffff"};
|
|
7709
|
+
`;
|
|
7710
|
+
var SubTrRows = styled13.tr`
|
|
7711
|
+
background-color: ${(props) => props.$index % 2 === 0 ? "white" : "#e0ffff"};
|
|
7712
|
+
height: 120px;
|
|
7713
|
+
`;
|
|
7714
|
+
var SubTableStyle = styled13.table`
|
|
7715
|
+
width: 95%;
|
|
7716
|
+
border-collapse: collapse;
|
|
7717
|
+
margin-top: -15px;
|
|
7718
|
+
margin-left: auto;
|
|
7719
|
+
margin-right: auto;
|
|
7720
|
+
|
|
7721
|
+
td {
|
|
7722
|
+
&:not(:last-child) {
|
|
7723
|
+
border-right: 1px solid black;
|
|
7724
|
+
}
|
|
7725
|
+
}
|
|
7726
|
+
|
|
7727
|
+
th {
|
|
7728
|
+
background-color: #065465;
|
|
7729
|
+
&:not(:last-child) {
|
|
7730
|
+
border-right: 1px solid #c6c7cc;
|
|
7731
|
+
}
|
|
7732
|
+
}
|
|
7733
|
+
`;
|
|
7734
|
+
var DropdownButton = styled13.button`
|
|
7735
|
+
background-color: transparent;
|
|
7736
|
+
background-repeat: no-repeat;
|
|
7737
|
+
border: none;
|
|
7738
|
+
cursor: pointer;
|
|
7739
|
+
overflow: hidden;
|
|
7740
|
+
outline: none;
|
|
7741
|
+
font-weight: bold; /* This makes the UTF symbols bold */
|
|
7742
|
+
font-size: 20px;
|
|
7743
|
+
`;
|
|
7744
|
+
var PrimaryTdSpan = styled13.td`
|
|
7745
|
+
&:not(:last-child) {
|
|
7746
|
+
border-right: 1px solid black;
|
|
7747
|
+
}
|
|
7748
|
+
`;
|
|
7749
|
+
function trimBeforePeriod(text) {
|
|
7750
|
+
const index = text.indexOf(".");
|
|
7751
|
+
return index === -1 ? text : text.substring(index + 1);
|
|
7752
|
+
}
|
|
7753
|
+
var NestedDataTable = ({ data, columns }) => {
|
|
7754
|
+
const HeadColumns = columns.filter((col) => col.subDataTableColumn === false);
|
|
7755
|
+
const SubDataColumns = columns.filter((col) => col.subDataTableColumn === true);
|
|
7756
|
+
const [isOpen, setIsOpen] = useState12(false);
|
|
7757
|
+
const [isAscending, setIsAscending] = useState12(false);
|
|
7758
|
+
const [primaryRowIndex, setPrimaryRowIndex] = useState12(null);
|
|
7759
|
+
const toggleDropdown = (rowIndex) => {
|
|
7760
|
+
setIsOpen(!isOpen);
|
|
7761
|
+
setIsAscending(!isAscending);
|
|
7762
|
+
setPrimaryRowIndex(rowIndex);
|
|
7763
|
+
};
|
|
7764
|
+
const headers = HeadColumns.map((column, index) => {
|
|
7765
|
+
return /* @__PURE__ */ jsx43(MainThHeaders, { children: column.title }, `headCell-${index}`);
|
|
7766
|
+
});
|
|
7767
|
+
const SubDataHeaders = SubDataColumns.map((column, index) => {
|
|
7768
|
+
return /* @__PURE__ */ jsx43("th", { children: column.title }, `SubHeadCell-${index}`);
|
|
7769
|
+
});
|
|
7770
|
+
const subDataRows = !data?.length ? /* @__PURE__ */ jsx43("tr", { children: /* @__PURE__ */ jsx43("td", { title: "NoSubDataRows", colSpan: columns.length, children: "No data" }) }) : data.map((item, index) => /* @__PURE__ */ jsx43(Fragment16, { children: /* @__PURE__ */ jsx43(SubDataTr, { children: SubDataColumns.map((column, colIndex) => {
|
|
7771
|
+
const columnKey = trimBeforePeriod(column.key);
|
|
7772
|
+
const value = item.Details?.[columnKey];
|
|
7773
|
+
console.log("value: ", value);
|
|
7774
|
+
if (value !== void 0) {
|
|
7775
|
+
return /* @__PURE__ */ jsx43("td", { children: /* @__PURE__ */ jsx43("span", { children: value }) }, `Span-${item.id}-${colIndex}`);
|
|
7776
|
+
}
|
|
7777
|
+
}) }, `Sub-${item.id}-${index}`) }));
|
|
7778
|
+
const childRows = /* @__PURE__ */ jsxs33(SubTableStyle, { children: [
|
|
7779
|
+
/* @__PURE__ */ jsx43("thead", { children: /* @__PURE__ */ jsx43("tr", { children: SubDataHeaders }) }),
|
|
7780
|
+
/* @__PURE__ */ jsx43("tbody", { children: subDataRows })
|
|
7781
|
+
] });
|
|
7782
|
+
const rows = !data?.length ? /* @__PURE__ */ jsx43("tr", { children: /* @__PURE__ */ jsx43("td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : data?.map((item, index) => /* @__PURE__ */ jsxs33(Fragment16, { children: [
|
|
7783
|
+
/* @__PURE__ */ jsxs33(PrimaryTrRows, { $index: index, children: [
|
|
7784
|
+
/* @__PURE__ */ jsx43(DropdownButton, { onClick: () => toggleDropdown(index), children: isAscending && isOpen && primaryRowIndex === index ? /* @__PURE__ */ jsx43(Fragment16, { children: "\u2227" }) : /* @__PURE__ */ jsx43(Fragment16, { children: "\u2228" }) }),
|
|
7785
|
+
HeadColumns.map((column, index2) => {
|
|
7786
|
+
return /* @__PURE__ */ jsx43(PrimaryTdSpan, { children: /* @__PURE__ */ jsx43("span", { title: `spanRow-${item.id}-${column.key}-${index2}`, children: item[column.key] }) }, `${item.id}-${index}=${index2}`);
|
|
7787
|
+
})
|
|
7788
|
+
] }, index),
|
|
7789
|
+
isOpen && primaryRowIndex === index && /* @__PURE__ */ jsx43(SubTrRows, { $index: index, children: /* @__PURE__ */ jsx43("td", { colSpan: HeadColumns.length + 1, children: childRows }) }, index)
|
|
7790
|
+
] }));
|
|
7791
|
+
return /* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsxs33(TableStyle, { children: [
|
|
7792
|
+
/* @__PURE__ */ jsx43("thead", { children: /* @__PURE__ */ jsxs33("tr", { children: [
|
|
7793
|
+
/* @__PURE__ */ jsx43("th", { title: "dropdownth" }),
|
|
7794
|
+
headers
|
|
7795
|
+
] }) }),
|
|
7796
|
+
/* @__PURE__ */ jsx43("tbody", { children: rows })
|
|
7797
|
+
] }) });
|
|
7798
|
+
};
|
|
7799
|
+
|
|
7800
|
+
// src/components/AutoComplete/WlAutoComplete.tsx
|
|
7801
|
+
import { useEffect as useEffect9, useRef as useRef9, useState as useState13 } from "react";
|
|
7802
|
+
import styled14 from "styled-components";
|
|
7803
|
+
import { Fragment as Fragment17, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7804
|
+
var AutoContainer = styled14.div`
|
|
7805
|
+
border-top: 10px solid ${(props) => props.$primary !== void 0 ? props.$primary : "#FFFFFF"};
|
|
7806
|
+
border-radius: 6px;
|
|
7807
|
+
`;
|
|
7808
|
+
var InputWrapper2 = styled14.div`
|
|
7809
|
+
position: relative;
|
|
7810
|
+
width: ${(props) => props.$inputwidth || "320px"};
|
|
7811
|
+
height: ${(props) => props.$inputheight || "51px"};
|
|
7812
|
+
background: linear-gradient(
|
|
7813
|
+
to bottom,
|
|
7814
|
+
${(props) => props.$primary !== null ? props.$primary : "#FFFFFF"},
|
|
7815
|
+
${(props) => props.$primary !== null ? props.$primary : "#FFFFFF"} 50%,
|
|
7816
|
+
transparent 50%,
|
|
7817
|
+
transparent 100%
|
|
7818
|
+
);
|
|
7819
|
+
`;
|
|
7820
|
+
var Label = styled14.label`
|
|
7821
|
+
position: absolute;
|
|
7822
|
+
top: 50%;
|
|
7823
|
+
left: 10px;
|
|
7824
|
+
transform: translateY(-50%);
|
|
7825
|
+
color: ${(props) => props.$primary || "#ccc"};
|
|
7826
|
+
font-size: 16px;
|
|
7827
|
+
pointer-events: none;
|
|
7828
|
+
transition: 0.3s ease all;
|
|
7829
|
+
z-index: 2;
|
|
7830
|
+
padding: 0 5px;
|
|
7831
|
+
`;
|
|
7832
|
+
var Input = styled14.input`
|
|
7833
|
+
width: inherit;
|
|
7834
|
+
height: inherit;
|
|
7835
|
+
padding: 0.5rem 0.75rem;
|
|
7836
|
+
border: ${(props) => props.$inputBorderStyling || "2px solid #ccc"};
|
|
7837
|
+
border-radius: 4px;
|
|
7838
|
+
box-sizing: border-box;
|
|
7839
|
+
z-index: 1;
|
|
7840
|
+
background-color: ${(props) => props.$primary !== null ? props.$primary : "#FFFFFF"};
|
|
7841
|
+
|
|
7842
|
+
&:focus {
|
|
7843
|
+
border-color: ${(props) => props.$focusBorderColor || "#4a90e2"};
|
|
7844
|
+
outline: none;
|
|
7845
|
+
background-color: ${(props) => props.$primary !== null ? props.$primary : "#FFFFFF"};
|
|
7846
|
+
}
|
|
7847
|
+
|
|
7848
|
+
&:focus + ${Label} {
|
|
7849
|
+
top: 0;
|
|
7850
|
+
left: 10px;
|
|
7851
|
+
padding: 0 2px;
|
|
7852
|
+
color: #4a90e2;
|
|
7853
|
+
background-color: ${(props) => props.$primary || "#FFFFFF"};
|
|
7854
|
+
}
|
|
7855
|
+
`;
|
|
7856
|
+
var DropDownList = styled14.ul`
|
|
7857
|
+
background-color: white;
|
|
7858
|
+
border: 1px solid #ccc;
|
|
7859
|
+
margin-top: 0px;
|
|
7860
|
+
color: black;
|
|
7861
|
+
list-style: none;
|
|
7862
|
+
padding: 0;
|
|
7863
|
+
border-radius: 8px;
|
|
7864
|
+
`;
|
|
7865
|
+
var ActiveListItem = styled14.li`
|
|
7866
|
+
padding: 10px;
|
|
7867
|
+
cursor: pointer;
|
|
7868
|
+
border-radius: 8px;
|
|
7869
|
+
|
|
7870
|
+
&:hover {
|
|
7871
|
+
background-color: #f0f0f0;
|
|
7872
|
+
}
|
|
7873
|
+
|
|
7874
|
+
&:active {
|
|
7875
|
+
background-color: #d8d8d8;
|
|
7876
|
+
}
|
|
7877
|
+
`;
|
|
7878
|
+
var NoHoverListItem = styled14.li`
|
|
7879
|
+
padding: 10px;
|
|
7880
|
+
cursor: pointer;
|
|
7881
|
+
background-color: white;
|
|
7882
|
+
color: #d8d8d8;
|
|
7883
|
+
border-radius: 8px;
|
|
7884
|
+
|
|
7885
|
+
&:hover {
|
|
7886
|
+
background-color: white;
|
|
7887
|
+
}
|
|
7888
|
+
|
|
7889
|
+
&:active {
|
|
7890
|
+
background-color: white;
|
|
7891
|
+
}
|
|
7892
|
+
`;
|
|
7893
|
+
var WLAutoComplete = ({ variant, data, height: height2, width: width2, inputBorderStyle, inputFocusBorderColor, onDataChange, autoBackGroundColor, labelColor }) => {
|
|
7894
|
+
const inputRef = useRef9(null);
|
|
7895
|
+
const listRef = useRef9(null);
|
|
7896
|
+
const noItemListRef = useRef9(null);
|
|
7897
|
+
const [inputValue, setInputValue] = useState13("");
|
|
7898
|
+
const [suggestions, setSuggestions] = useState13([]);
|
|
7899
|
+
const [isDropdownVisible, setIsDropdownVisible] = useState13(false);
|
|
7900
|
+
useEffect9(() => {
|
|
7901
|
+
const handleClickOutside = (event) => {
|
|
7902
|
+
const node = event.target;
|
|
7903
|
+
if (inputRef.current && !inputRef.current?.contains(node) && !listRef.current?.contains(node) && !noItemListRef.current?.contains(node)) {
|
|
7904
|
+
inputRef.current.blur();
|
|
7905
|
+
setInputValue("");
|
|
7906
|
+
}
|
|
7907
|
+
if (noItemListRef.current && noItemListRef.current?.contains(node)) {
|
|
7908
|
+
inputRef.current?.focus();
|
|
7909
|
+
}
|
|
7910
|
+
};
|
|
7911
|
+
const handleClickOutsideList = (event) => {
|
|
7912
|
+
if (listRef.current && !listRef.current.contains(event.target)) {
|
|
7913
|
+
setIsDropdownVisible(false);
|
|
7914
|
+
}
|
|
7915
|
+
};
|
|
7916
|
+
const handleClickonListElement = (event) => {
|
|
7917
|
+
const node = event.target;
|
|
7918
|
+
if (listRef.current?.contains(node)) {
|
|
7919
|
+
inputRef.current?.focus();
|
|
7920
|
+
}
|
|
7921
|
+
};
|
|
7922
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
7923
|
+
document.addEventListener("mousedown", handleClickOutsideList);
|
|
7924
|
+
document.addEventListener("mousedown", handleClickonListElement);
|
|
7925
|
+
return () => {
|
|
7926
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
7927
|
+
document.removeEventListener("mousedown", handleClickOutsideList);
|
|
7928
|
+
document.removeEventListener("mousedown", handleClickonListElement);
|
|
7929
|
+
};
|
|
7930
|
+
}, []);
|
|
7931
|
+
useEffect9(() => {
|
|
7932
|
+
if (inputRef.current && inputValue) {
|
|
7933
|
+
inputRef.current.focus();
|
|
7934
|
+
}
|
|
7935
|
+
}, [inputValue]);
|
|
7936
|
+
const handleChange = (event) => {
|
|
7937
|
+
const value = event.target.value;
|
|
7938
|
+
setInputValue(value);
|
|
7939
|
+
if (value.length > 0) {
|
|
7940
|
+
const filtered = data.filter((option) => option.toLowerCase().includes(value.toLowerCase()));
|
|
7941
|
+
if (filtered.length > 0) {
|
|
7942
|
+
setSuggestions(filtered);
|
|
7943
|
+
setIsDropdownVisible(true);
|
|
7944
|
+
} else {
|
|
7945
|
+
setSuggestions([]);
|
|
7946
|
+
setIsDropdownVisible(true);
|
|
7947
|
+
}
|
|
7948
|
+
} else {
|
|
7949
|
+
setIsDropdownVisible(false);
|
|
7950
|
+
}
|
|
7951
|
+
};
|
|
7952
|
+
const handleInputClick = () => {
|
|
7953
|
+
setSuggestions(data);
|
|
7954
|
+
setIsDropdownVisible(true);
|
|
7955
|
+
};
|
|
7956
|
+
const handleListClick = (suggestValue) => {
|
|
7957
|
+
setInputValue(suggestValue);
|
|
7958
|
+
setIsDropdownVisible(false);
|
|
7959
|
+
};
|
|
7960
|
+
const handleKeyDown = (event) => {
|
|
7961
|
+
if (event.key === "Enter") {
|
|
7962
|
+
onDataChange(inputValue);
|
|
7963
|
+
}
|
|
7964
|
+
};
|
|
7965
|
+
return /* @__PURE__ */ jsx44(Fragment17, { children: /* @__PURE__ */ jsxs34(AutoContainer, { $primary: autoBackGroundColor, children: [
|
|
7966
|
+
/* @__PURE__ */ jsxs34(InputWrapper2, { $primary: autoBackGroundColor, $inputheight: height2, $inputwidth: width2, children: [
|
|
7967
|
+
/* @__PURE__ */ jsx44(
|
|
7968
|
+
Input,
|
|
7969
|
+
{
|
|
7970
|
+
type: "text",
|
|
7971
|
+
$primary: autoBackGroundColor,
|
|
7972
|
+
$inputBorderStyling: inputBorderStyle,
|
|
7973
|
+
$focusBorderColor: inputFocusBorderColor,
|
|
7974
|
+
value: inputValue,
|
|
7975
|
+
ref: inputRef,
|
|
7976
|
+
onClick: handleInputClick,
|
|
7977
|
+
onInput: handleChange,
|
|
7978
|
+
onKeyDown: handleKeyDown,
|
|
7979
|
+
placeholder: ""
|
|
7980
|
+
}
|
|
7981
|
+
),
|
|
7982
|
+
/* @__PURE__ */ jsx44(Label, { $primary: labelColor, children: variant })
|
|
7983
|
+
] }),
|
|
7984
|
+
isDropdownVisible && /* @__PURE__ */ jsx44(DropDownList, { ref: listRef, children: suggestions.length > 0 ? suggestions.map((item, index) => /* @__PURE__ */ jsx44(ActiveListItem, { onMouseDown: (e) => e.preventDefault(), onClick: () => handleListClick(item), children: item }, index)) : /* @__PURE__ */ jsx44(NoHoverListItem, { ref: noItemListRef, id: "No-Option-List-item", onMouseDown: (e) => e.preventDefault(), children: "No Options found" }) })
|
|
7985
|
+
] }) });
|
|
7986
|
+
};
|
|
7987
|
+
|
|
7345
7988
|
// src/components/samples/SampleComponent.tsx
|
|
7346
|
-
import { useRef as
|
|
7347
|
-
import { jsx as
|
|
7989
|
+
import { useRef as useRef10, useEffect as useEffect10 } from "react";
|
|
7990
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
7348
7991
|
var SampleComponent2 = ({
|
|
7349
7992
|
testProp,
|
|
7350
7993
|
children,
|
|
7351
7994
|
...rest
|
|
7352
7995
|
// This rest operator includes className, style, onClick, etc.
|
|
7353
7996
|
}) => {
|
|
7354
|
-
const ref =
|
|
7355
|
-
|
|
7997
|
+
const ref = useRef10(null);
|
|
7998
|
+
useEffect10(() => {
|
|
7356
7999
|
const el = ref.current;
|
|
7357
8000
|
if (!el) return;
|
|
7358
8001
|
if (testProp !== void 0) {
|
|
7359
8002
|
el.setAttribute("test-prop", testProp);
|
|
7360
8003
|
}
|
|
7361
8004
|
}, [testProp]);
|
|
7362
|
-
return /* @__PURE__ */
|
|
8005
|
+
return /* @__PURE__ */ jsx45("sample-component", { ref, ...rest, children });
|
|
7363
8006
|
};
|
|
7364
8007
|
export {
|
|
7365
8008
|
ButtonIcon,
|
|
7366
8009
|
ButtonMenu,
|
|
8010
|
+
ChildDataTable,
|
|
7367
8011
|
DefaultCarousel,
|
|
7368
8012
|
DefaultPagination,
|
|
8013
|
+
NestedDataTable,
|
|
7369
8014
|
SampleComponent2 as SampleComponent,
|
|
7370
8015
|
SliderCardCarousel,
|
|
8016
|
+
WLAutoComplete,
|
|
7371
8017
|
WavelengthAccessAlert,
|
|
7372
8018
|
WavelengthAlert,
|
|
7373
8019
|
WavelengthAppLogo,
|