@wavelengthusaf/components 2.7.3 → 2.8.1
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 +4 -0
- package/dist/cjs/index.cjs +381 -18
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +21 -2
- package/dist/esm/index.d.ts +21 -2
- package/dist/esm/index.js +367 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { TextFieldVariants, SxProps as SxProps$1, Theme as Theme$1 } from '@mui/material';
|
|
@@ -507,4 +507,23 @@ interface TextFieldProps {
|
|
|
507
507
|
}
|
|
508
508
|
declare function WavelengthTextField(props: TextFieldProps): react_jsx_runtime.JSX.Element | null;
|
|
509
509
|
|
|
510
|
-
|
|
510
|
+
interface DataType {
|
|
511
|
+
id: number;
|
|
512
|
+
[key: string]: any;
|
|
513
|
+
}
|
|
514
|
+
interface ColumnProps<T> {
|
|
515
|
+
key: string;
|
|
516
|
+
title: string | ReactElement;
|
|
517
|
+
width?: string;
|
|
518
|
+
editable?: boolean;
|
|
519
|
+
render?: (column: ColumnProps<T>, item: T) => ReactElement;
|
|
520
|
+
}
|
|
521
|
+
type Props<T> = {
|
|
522
|
+
columns: Array<ColumnProps<T>>;
|
|
523
|
+
data?: T[] | undefined;
|
|
524
|
+
itemsPerPage: number;
|
|
525
|
+
totalPages: number;
|
|
526
|
+
};
|
|
527
|
+
declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
|
|
528
|
+
|
|
529
|
+
export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { TextFieldVariants, SxProps as SxProps$1, Theme as Theme$1 } from '@mui/material';
|
|
@@ -507,4 +507,23 @@ interface TextFieldProps {
|
|
|
507
507
|
}
|
|
508
508
|
declare function WavelengthTextField(props: TextFieldProps): react_jsx_runtime.JSX.Element | null;
|
|
509
509
|
|
|
510
|
-
|
|
510
|
+
interface DataType {
|
|
511
|
+
id: number;
|
|
512
|
+
[key: string]: any;
|
|
513
|
+
}
|
|
514
|
+
interface ColumnProps<T> {
|
|
515
|
+
key: string;
|
|
516
|
+
title: string | ReactElement;
|
|
517
|
+
width?: string;
|
|
518
|
+
editable?: boolean;
|
|
519
|
+
render?: (column: ColumnProps<T>, item: T) => ReactElement;
|
|
520
|
+
}
|
|
521
|
+
type Props<T> = {
|
|
522
|
+
columns: Array<ColumnProps<T>>;
|
|
523
|
+
data?: T[] | undefined;
|
|
524
|
+
itemsPerPage: number;
|
|
525
|
+
totalPages: number;
|
|
526
|
+
};
|
|
527
|
+
declare const WavelengthDataTable: <T extends DataType>({ data, columns, itemsPerPage, totalPages }: Props<T>) => react_jsx_runtime.JSX.Element;
|
|
528
|
+
|
|
529
|
+
export { AppLogo, ButtonIcon, ButtonMenu, DefaultCarousel, DefaultIcon, DefaultPagination, ManyPlanesComponent, NotAvailablePage, type SearchProps, type SearchResult, SearchTextField, SliderCardCarousel, type StyledButtonPropsTwo, TestSnackbar, type ThemeProperties, WavelengthAppTheme, WavelengthAutocomplete, WavelengthBanner, WavelengthBox, WavelengthButton, WavelengthCommentDisplay, WavelengthConfirmationModal, WavelengthContentModal, WavelengthContentPlaceholder, WavelengthDataTable, WavelengthDragAndDrop, WavelengthDropdown, WavelengthDropdownButton, WavelengthExampleComponent, WavelengthFileDownloader, WavelengthFooter, WavelengthPlaneTrail, WavelengthPopUpMenu, WavelengthProgressBar, WavelengthSearch, WavelengthSideBar, WavelengthSlider, WavelengthSnackbar, WavelengthSpinningLogo, WavelengthSpinningOuterCircle, WavelengthStandardSnackbar, WavelengthStyledButton, WavelengthTextField, WavelengthTitleBar, add, ascendingRange, concat, findBestStringMatch, type menuItemProps, range, useOutsideClick, useThemeContext };
|
package/dist/esm/index.js
CHANGED
|
@@ -4743,9 +4743,9 @@ function WavelengthCommentDisplay(props) {
|
|
|
4743
4743
|
!selected && /* @__PURE__ */ jsx17(
|
|
4744
4744
|
IconButton2,
|
|
4745
4745
|
{
|
|
4746
|
-
onClick: () => {
|
|
4746
|
+
onClick: (e) => {
|
|
4747
4747
|
setSelected(!selected);
|
|
4748
|
-
props.onClick;
|
|
4748
|
+
props.onClick?.(e);
|
|
4749
4749
|
},
|
|
4750
4750
|
style: { padding: "0px" },
|
|
4751
4751
|
children: /* @__PURE__ */ jsx17(CheckCircleOutlineIcon, { fontSize: "small" })
|
|
@@ -4754,9 +4754,9 @@ function WavelengthCommentDisplay(props) {
|
|
|
4754
4754
|
selected && /* @__PURE__ */ jsx17(
|
|
4755
4755
|
IconButton2,
|
|
4756
4756
|
{
|
|
4757
|
-
onClick: () => {
|
|
4757
|
+
onClick: (e) => {
|
|
4758
4758
|
setSelected(!selected);
|
|
4759
|
-
props.onClick;
|
|
4759
|
+
props.onClick?.(e);
|
|
4760
4760
|
},
|
|
4761
4761
|
style: { padding: "0px" },
|
|
4762
4762
|
children: /* @__PURE__ */ jsx17(CheckCircleIcon, { fontSize: "small", sx: { color: props.iconSelectedColor || "rgba(209, 106, 47, 1)" } })
|
|
@@ -6114,6 +6114,7 @@ function DefaultPagination({ totalPages, currentPageNumber, siblingCount = 1, bo
|
|
|
6114
6114
|
);
|
|
6115
6115
|
}
|
|
6116
6116
|
}
|
|
6117
|
+
var WavelengthPagination_default = DefaultPagination;
|
|
6117
6118
|
|
|
6118
6119
|
// src/components/TextField/WavelengthTextField.tsx
|
|
6119
6120
|
import { useCallback, useState as useState9 } from "react";
|
|
@@ -6246,6 +6247,367 @@ function WavelengthTextField(props) {
|
|
|
6246
6247
|
}
|
|
6247
6248
|
return null;
|
|
6248
6249
|
}
|
|
6250
|
+
|
|
6251
|
+
// src/components/DataTable/WavelengthDataTable.tsx
|
|
6252
|
+
import { useEffect as useEffect6, useRef as useRef5, useState as useState10 } from "react";
|
|
6253
|
+
import styled11 from "styled-components";
|
|
6254
|
+
import { jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6255
|
+
var ModalInputDiv = styled11.div`
|
|
6256
|
+
display: flex;
|
|
6257
|
+
flex-direction: column; /* Corrected this line */
|
|
6258
|
+
gap: 3px;
|
|
6259
|
+
margin: 3px;
|
|
6260
|
+
|
|
6261
|
+
label {
|
|
6262
|
+
align-self: flex-start;
|
|
6263
|
+
color: #c6c7cc;
|
|
6264
|
+
}
|
|
6265
|
+
|
|
6266
|
+
input,
|
|
6267
|
+
select {
|
|
6268
|
+
width: 100%;
|
|
6269
|
+
padding: 12px 20px;
|
|
6270
|
+
margin: 8px 0;
|
|
6271
|
+
box-sizing: border-box;
|
|
6272
|
+
border: none;
|
|
6273
|
+
outline: none;
|
|
6274
|
+
border-bottom: 2px solid #c6c7cc;
|
|
6275
|
+
|
|
6276
|
+
&:hover {
|
|
6277
|
+
border-bottom: 2px solid black;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
&:focus {
|
|
6281
|
+
border-bottom: 2px solid #8fd8ff;
|
|
6282
|
+
}
|
|
6283
|
+
}
|
|
6284
|
+
`;
|
|
6285
|
+
var ModalOverlay = styled11.div`
|
|
6286
|
+
position: fixed;
|
|
6287
|
+
bottom: 19%;
|
|
6288
|
+
right: 15%;
|
|
6289
|
+
width: 100%;
|
|
6290
|
+
height: 100%;
|
|
6291
|
+
background-color: rgba(0, 0, 0, 0);
|
|
6292
|
+
display: flex;
|
|
6293
|
+
justify-content: center;
|
|
6294
|
+
align-items: center;
|
|
6295
|
+
z-index: 1;
|
|
6296
|
+
`;
|
|
6297
|
+
var ModalWrapper = styled11.div`
|
|
6298
|
+
background-color: white;
|
|
6299
|
+
border-radius: 8px;
|
|
6300
|
+
padding: 20px;
|
|
6301
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
|
6302
|
+
position: relative;
|
|
6303
|
+
min-width: 300px;
|
|
6304
|
+
z-index: 1;
|
|
6305
|
+
display: flex;
|
|
6306
|
+
align-items: center;
|
|
6307
|
+
`;
|
|
6308
|
+
var ModalClose = styled11.button`
|
|
6309
|
+
position: absolute;
|
|
6310
|
+
top: 10px;
|
|
6311
|
+
right: 10px;
|
|
6312
|
+
font-size: 20px;
|
|
6313
|
+
cursor: pointer;
|
|
6314
|
+
border: none;
|
|
6315
|
+
background: none;
|
|
6316
|
+
z-index: 2;
|
|
6317
|
+
`;
|
|
6318
|
+
var TableHeadStyle = styled11.th`
|
|
6319
|
+
position: relative;
|
|
6320
|
+
`;
|
|
6321
|
+
var KebabMenu = styled11.div`
|
|
6322
|
+
display: inline-block;
|
|
6323
|
+
position: absolute;
|
|
6324
|
+
right: 0;
|
|
6325
|
+
top: 2px;
|
|
6326
|
+
`;
|
|
6327
|
+
var KebabIcon = styled11.div`
|
|
6328
|
+
cursor: pointer;
|
|
6329
|
+
font-size: 20px;
|
|
6330
|
+
padding: 5px;
|
|
6331
|
+
|
|
6332
|
+
&:hover,
|
|
6333
|
+
&:focus {
|
|
6334
|
+
color: #45beff;
|
|
6335
|
+
}
|
|
6336
|
+
&:active {
|
|
6337
|
+
color: #8fd8ff;
|
|
6338
|
+
}
|
|
6339
|
+
`;
|
|
6340
|
+
var MenuOptions = styled11.ul`
|
|
6341
|
+
position: absolute;
|
|
6342
|
+
right: 0;
|
|
6343
|
+
top: 100%;
|
|
6344
|
+
background-color: #f9f9f9;
|
|
6345
|
+
min-width: 160px;
|
|
6346
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
6347
|
+
z-index: 1;
|
|
6348
|
+
list-style: none;
|
|
6349
|
+
padding: 0;
|
|
6350
|
+
margin: 0;
|
|
6351
|
+
|
|
6352
|
+
li {
|
|
6353
|
+
padding: 10px;
|
|
6354
|
+
text-decoration: none;
|
|
6355
|
+
display: block;
|
|
6356
|
+
cursor: pointer;
|
|
6357
|
+
|
|
6358
|
+
&:hover {
|
|
6359
|
+
background-color: #ddd;
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
`;
|
|
6363
|
+
var StyledBoxDiv = styled11.div`
|
|
6364
|
+
background-color: white;
|
|
6365
|
+
width: 700px;
|
|
6366
|
+
height: 480px;
|
|
6367
|
+
position: relative;
|
|
6368
|
+
border-top-left-radius: 10px;
|
|
6369
|
+
border-top-right-radius: 10px;
|
|
6370
|
+
`;
|
|
6371
|
+
var StyledNavBoxDiv = styled11.div`
|
|
6372
|
+
background-color: white;
|
|
6373
|
+
width: 700px;
|
|
6374
|
+
display: flex; /* Make parent a flex-container */
|
|
6375
|
+
justify-content: center;
|
|
6376
|
+
border-bottom-left-radius: 10px;
|
|
6377
|
+
border-bottom-right-radius: 10px;
|
|
6378
|
+
|
|
6379
|
+
box-shadow: 0.5px 3px 5px black;
|
|
6380
|
+
`;
|
|
6381
|
+
var StyledTd = styled11.td`
|
|
6382
|
+
border-top: 1px solid #c6c7cc;
|
|
6383
|
+
border-bottom: 1px solid #c6c7cc;
|
|
6384
|
+
padding: 10px 15px;
|
|
6385
|
+
vertical-align: middle;
|
|
6386
|
+
`;
|
|
6387
|
+
var StyledTableTwo = styled11.table`
|
|
6388
|
+
width: 95%;
|
|
6389
|
+
height: 95%;
|
|
6390
|
+
border-collapse: collapse;
|
|
6391
|
+
background-color: white;
|
|
6392
|
+
color: black;
|
|
6393
|
+
|
|
6394
|
+
margin-left: auto;
|
|
6395
|
+
margin-right: auto;
|
|
6396
|
+
|
|
6397
|
+
th {
|
|
6398
|
+
position: relative; /* Enable absolute positioning of pseudo-elements */
|
|
6399
|
+
padding: 10px 15px;
|
|
6400
|
+
|
|
6401
|
+
/* Create the partial right border */
|
|
6402
|
+
&:not(:last-child):after {
|
|
6403
|
+
content: ""; /* Ensure the pseudo-element is visible */
|
|
6404
|
+
position: absolute;
|
|
6405
|
+
right: 0; /* Position it on the right side of the th */
|
|
6406
|
+
top: 50%; /* Position it in the vertical center */
|
|
6407
|
+
height: 50%; /* Set the height of the border to be half the height of th */
|
|
6408
|
+
border-right: 1px solid #c6c7cc;
|
|
6409
|
+
transform: translateY(-50%); /* Center it vertically */
|
|
6410
|
+
}
|
|
6411
|
+
}
|
|
6412
|
+
`;
|
|
6413
|
+
var StyledInput = styled11.input`
|
|
6414
|
+
height: 100%;
|
|
6415
|
+
width: 100%;
|
|
6416
|
+
outline: none;
|
|
6417
|
+
border: none;
|
|
6418
|
+
color: #8fd8ff;
|
|
6419
|
+
`;
|
|
6420
|
+
var WavelengthDataTable = ({ data, columns, itemsPerPage, totalPages }) => {
|
|
6421
|
+
const [localData, setLocalData] = useState10(data || []);
|
|
6422
|
+
const copiedArray = [...data || []];
|
|
6423
|
+
const [editingId, setEditingId] = useState10(null);
|
|
6424
|
+
const [editedColumnKey, setEditedColumnKey] = useState10(null);
|
|
6425
|
+
const [editedValue, setEditedValue] = useState10("");
|
|
6426
|
+
const [noRowsOpen, setNoRowsOpen] = useState10(false);
|
|
6427
|
+
const [isModalOpen, setIsModalOpen] = useState10(false);
|
|
6428
|
+
const [searchItem, setSearchItem] = useState10("");
|
|
6429
|
+
const [selectedValue, setSelectedValue] = useState10(columns[0]?.key || "");
|
|
6430
|
+
const [currentPage, setCurrentPage] = useState10(1);
|
|
6431
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
6432
|
+
const [editingMenuKey, setEditingMenuKey] = useState10(null);
|
|
6433
|
+
const menuRef = useRef5(null);
|
|
6434
|
+
const modalRef = useRef5(null);
|
|
6435
|
+
function isNumeric(value) {
|
|
6436
|
+
return /^\d+$/.test(value);
|
|
6437
|
+
}
|
|
6438
|
+
const handleChange = (event) => {
|
|
6439
|
+
setSelectedValue(event.target.value);
|
|
6440
|
+
setLocalData(copiedArray);
|
|
6441
|
+
};
|
|
6442
|
+
useEffect6(() => {
|
|
6443
|
+
if (!selectedValue || searchItem === "") {
|
|
6444
|
+
setLocalData(copiedArray);
|
|
6445
|
+
setNoRowsOpen(false);
|
|
6446
|
+
return;
|
|
6447
|
+
}
|
|
6448
|
+
if (isNumeric(searchItem)) {
|
|
6449
|
+
const filteredItems = localData.filter((item) => item[selectedValue].toString().includes(searchItem));
|
|
6450
|
+
setLocalData(filteredItems);
|
|
6451
|
+
if (filteredItems.length === 0) {
|
|
6452
|
+
setNoRowsOpen(true);
|
|
6453
|
+
} else {
|
|
6454
|
+
setNoRowsOpen(false);
|
|
6455
|
+
}
|
|
6456
|
+
} else {
|
|
6457
|
+
const filteredItems = localData.filter((item) => item[selectedValue].toString().toLowerCase().includes(searchItem.toLowerCase()));
|
|
6458
|
+
if (filteredItems.length === 0) {
|
|
6459
|
+
setNoRowsOpen(true);
|
|
6460
|
+
} else {
|
|
6461
|
+
setLocalData(filteredItems);
|
|
6462
|
+
setNoRowsOpen(false);
|
|
6463
|
+
}
|
|
6464
|
+
}
|
|
6465
|
+
}, [selectedValue, searchItem]);
|
|
6466
|
+
const openModal = () => {
|
|
6467
|
+
setIsModalOpen(true);
|
|
6468
|
+
};
|
|
6469
|
+
const closeModal = () => {
|
|
6470
|
+
setIsModalOpen(false);
|
|
6471
|
+
};
|
|
6472
|
+
useEffect6(() => {
|
|
6473
|
+
const handleClickOutside = (event) => {
|
|
6474
|
+
if (isModalOpen && modalRef.current && !modalRef.current.contains(event.target)) {
|
|
6475
|
+
closeModal();
|
|
6476
|
+
}
|
|
6477
|
+
};
|
|
6478
|
+
if (isOpen) {
|
|
6479
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
6480
|
+
}
|
|
6481
|
+
return () => {
|
|
6482
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
6483
|
+
};
|
|
6484
|
+
}, [isModalOpen]);
|
|
6485
|
+
const toggleMenu = (key) => {
|
|
6486
|
+
setIsOpen(!isOpen);
|
|
6487
|
+
setEditingMenuKey(key);
|
|
6488
|
+
};
|
|
6489
|
+
const indexOfLastItem = currentPage * itemsPerPage;
|
|
6490
|
+
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
|
|
6491
|
+
const currentPageData = localData.filter((_, index) => index >= indexOfFirstItem && index < indexOfLastItem);
|
|
6492
|
+
const [sortOrder, setSortOrder] = useState10("asc");
|
|
6493
|
+
const handleSort = (column, sortType) => {
|
|
6494
|
+
const sortedItems = [...localData].sort((a, b) => {
|
|
6495
|
+
const valueA = a[column];
|
|
6496
|
+
const valueB = b[column];
|
|
6497
|
+
if (typeof valueA === "string" && typeof valueB === "string") {
|
|
6498
|
+
if (sortType === "asc") {
|
|
6499
|
+
return valueA.localeCompare(valueB);
|
|
6500
|
+
} else {
|
|
6501
|
+
return valueB.localeCompare(valueA);
|
|
6502
|
+
}
|
|
6503
|
+
} else if (typeof valueA === "number" && typeof valueB === "number") {
|
|
6504
|
+
if (sortType === "asc") {
|
|
6505
|
+
return valueA - valueB;
|
|
6506
|
+
} else {
|
|
6507
|
+
return valueB - valueA;
|
|
6508
|
+
}
|
|
6509
|
+
} else {
|
|
6510
|
+
return 0;
|
|
6511
|
+
}
|
|
6512
|
+
});
|
|
6513
|
+
setLocalData(sortedItems);
|
|
6514
|
+
setSortOrder(sortOrder === "asc" ? "desc" : "asc");
|
|
6515
|
+
};
|
|
6516
|
+
const handleEdit = (id, value, columnKey) => {
|
|
6517
|
+
setEditingId(id);
|
|
6518
|
+
setEditedValue(value);
|
|
6519
|
+
setEditedColumnKey(columnKey);
|
|
6520
|
+
};
|
|
6521
|
+
const saveEdit = (id, editedValue2, columnKey) => {
|
|
6522
|
+
setLocalData(localData.map((item) => id === item.id ? { ...item, [columnKey]: editedValue2 } : item));
|
|
6523
|
+
setEditingId(null);
|
|
6524
|
+
};
|
|
6525
|
+
const handleCancel = () => {
|
|
6526
|
+
setEditingId(null);
|
|
6527
|
+
};
|
|
6528
|
+
const headers = columns.map((column, index) => {
|
|
6529
|
+
return /* @__PURE__ */ jsxs29(TableHeadStyle, { children: [
|
|
6530
|
+
column.title,
|
|
6531
|
+
/* @__PURE__ */ jsxs29(KebabMenu, { ref: menuRef, children: [
|
|
6532
|
+
/* @__PURE__ */ jsx38(
|
|
6533
|
+
KebabIcon,
|
|
6534
|
+
{
|
|
6535
|
+
title: `KebabIcon-${index}`,
|
|
6536
|
+
onClick: () => {
|
|
6537
|
+
toggleMenu(column.key);
|
|
6538
|
+
},
|
|
6539
|
+
children: "\u22EE"
|
|
6540
|
+
}
|
|
6541
|
+
),
|
|
6542
|
+
isOpen && editingMenuKey === column.key && /* @__PURE__ */ jsxs29(MenuOptions, { children: [
|
|
6543
|
+
sortOrder === "asc" ? /* @__PURE__ */ jsxs29("li", { title: `MenuListASC-${index}`, onClick: () => handleSort(column.key, "asc"), children: [
|
|
6544
|
+
/* @__PURE__ */ jsx38("span", { children: "\u2B06" }),
|
|
6545
|
+
" Sort ASC"
|
|
6546
|
+
] }) : /* @__PURE__ */ jsxs29("li", { title: `MenuListDES-${index}`, onClick: () => handleSort(column.key, "desc"), children: [
|
|
6547
|
+
/* @__PURE__ */ jsx38("span", { children: "\u2B07" }),
|
|
6548
|
+
" Sort DESC"
|
|
6549
|
+
] }),
|
|
6550
|
+
/* @__PURE__ */ jsxs29("li", { title: `MenuListFilterButton-${index}`, onClick: openModal, children: [
|
|
6551
|
+
/* @__PURE__ */ jsx38("span", { children: "\u23F7" }),
|
|
6552
|
+
" Filter"
|
|
6553
|
+
] }),
|
|
6554
|
+
isModalOpen && /* @__PURE__ */ jsx38(ModalOverlay, { children: /* @__PURE__ */ jsxs29(ModalWrapper, { ref: modalRef, children: [
|
|
6555
|
+
/* @__PURE__ */ jsx38(ModalClose, { title: `ModalClose-${index}`, onClick: closeModal, children: "\xD7" }),
|
|
6556
|
+
/* @__PURE__ */ jsxs29(ModalInputDiv, { children: [
|
|
6557
|
+
/* @__PURE__ */ jsx38("label", { htmlFor: "filterSelectId", children: "Columns: " }),
|
|
6558
|
+
/* @__PURE__ */ jsx38("select", { title: `filterSelect-${index}`, id: "filterSelectId", value: selectedValue, onChange: handleChange, children: columns.map((item) => /* @__PURE__ */ jsx38("option", { children: item.key }, item.key)) })
|
|
6559
|
+
] }),
|
|
6560
|
+
/* @__PURE__ */ jsxs29(ModalInputDiv, { children: [
|
|
6561
|
+
/* @__PURE__ */ jsx38("label", { htmlFor: "filterInputId", children: "Values: " }),
|
|
6562
|
+
/* @__PURE__ */ jsx38(
|
|
6563
|
+
"input",
|
|
6564
|
+
{
|
|
6565
|
+
title: `Inputfiltertest-${index}`,
|
|
6566
|
+
id: "filterInputId",
|
|
6567
|
+
type: isNumeric(searchItem) ? "number" : "text",
|
|
6568
|
+
value: searchItem,
|
|
6569
|
+
onKeyDown: (e) => {
|
|
6570
|
+
if (e.key === "Backspace") {
|
|
6571
|
+
setLocalData(copiedArray);
|
|
6572
|
+
}
|
|
6573
|
+
},
|
|
6574
|
+
onChange: (e) => setSearchItem(e.target.value)
|
|
6575
|
+
}
|
|
6576
|
+
)
|
|
6577
|
+
] })
|
|
6578
|
+
] }) })
|
|
6579
|
+
] })
|
|
6580
|
+
] }, index)
|
|
6581
|
+
] }, `headCell-${index}`);
|
|
6582
|
+
});
|
|
6583
|
+
const rows = !currentPageData?.length || noRowsOpen ? /* @__PURE__ */ jsx38("tr", { children: /* @__PURE__ */ jsx38("td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : currentPageData?.map((item) => /* @__PURE__ */ jsx38("tr", { children: columns.map((column, index2) => {
|
|
6584
|
+
return /* @__PURE__ */ jsx38(StyledTd, { children: editingId === item.id && editedColumnKey === column.key ? /* @__PURE__ */ jsx38(
|
|
6585
|
+
StyledInput,
|
|
6586
|
+
{
|
|
6587
|
+
title: `styledRow-${item.id}-${column.key}-${index2}`,
|
|
6588
|
+
type: "text",
|
|
6589
|
+
value: editedValue,
|
|
6590
|
+
onChange: (e) => setEditedValue(e.target.value),
|
|
6591
|
+
onBlur: () => saveEdit(item.id, editedValue, column.key),
|
|
6592
|
+
onKeyDown: (e) => {
|
|
6593
|
+
if (e.key === "Enter") {
|
|
6594
|
+
saveEdit(item.id, editedValue, column.key);
|
|
6595
|
+
} else if (e.key === "Escape") {
|
|
6596
|
+
handleCancel();
|
|
6597
|
+
}
|
|
6598
|
+
},
|
|
6599
|
+
autoFocus: true
|
|
6600
|
+
}
|
|
6601
|
+
) : /* @__PURE__ */ jsx38("span", { title: `spanRow-${item.id}-${column.key}-${index2}`, onDoubleClick: () => handleEdit(item.id, item[column.key], column.key), children: item[column.key] }) }, index2);
|
|
6602
|
+
}) }, item.id));
|
|
6603
|
+
return /* @__PURE__ */ jsxs29("div", { children: [
|
|
6604
|
+
/* @__PURE__ */ jsx38(StyledBoxDiv, { title: "StyledBoxDiv", children: /* @__PURE__ */ jsxs29(StyledTableTwo, { title: "StyledTable", children: [
|
|
6605
|
+
/* @__PURE__ */ jsx38("thead", { children: /* @__PURE__ */ jsx38("tr", { children: headers }) }),
|
|
6606
|
+
/* @__PURE__ */ jsx38("tbody", { children: rows })
|
|
6607
|
+
] }) }),
|
|
6608
|
+
/* @__PURE__ */ jsx38(StyledNavBoxDiv, { children: /* @__PURE__ */ jsx38(WavelengthPagination_default, { totalPages, currentPageNumber: currentPage, onPageChange: setCurrentPage, style: "circular" }) })
|
|
6609
|
+
] });
|
|
6610
|
+
};
|
|
6249
6611
|
export {
|
|
6250
6612
|
AppLogo,
|
|
6251
6613
|
ButtonIcon,
|
|
@@ -6267,6 +6629,7 @@ export {
|
|
|
6267
6629
|
WavelengthConfirmationModal,
|
|
6268
6630
|
WavelengthContentModal,
|
|
6269
6631
|
WavelengthContentPlaceholder,
|
|
6632
|
+
WavelengthDataTable,
|
|
6270
6633
|
WavelengthDragAndDrop,
|
|
6271
6634
|
WavelengthDropdown,
|
|
6272
6635
|
WavelengthDropdownButton,
|