@wavelengthusaf/components 2.7.2 → 2.8.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 +19 -9
- package/dist/cjs/index.cjs +431 -43
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +25 -5
- package/dist/esm/index.d.ts +25 -5
- package/dist/esm/index.js +437 -49
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,44 +14,54 @@ npm install @wavelengthusaf/components
|
|
|
14
14
|
|
|
15
15
|
## Release Notes
|
|
16
16
|
|
|
17
|
+
### 2.7.3
|
|
18
|
+
|
|
19
|
+
- 4/8/2025
|
|
20
|
+
- Updated `WavelengthBanner` with various tweaks; added several props
|
|
21
|
+
|
|
22
|
+
### 2.7.2
|
|
23
|
+
|
|
24
|
+
- 4/4/2025
|
|
25
|
+
- Updated `WavelengthTitleBar` to be a standard `<div>` instead of an svg. Also added several props for further customization.
|
|
26
|
+
|
|
17
27
|
### 2.7.1
|
|
18
28
|
|
|
19
29
|
- 4/1/2025
|
|
20
|
-
- Updated WavelengthTextField component to have another variant.
|
|
30
|
+
- Updated `WavelengthTextField` component to have another variant.
|
|
21
31
|
|
|
22
32
|
### 2.7.0
|
|
23
33
|
|
|
24
34
|
- 3/24/2025
|
|
25
|
-
- Added
|
|
35
|
+
- Added the `WavelengthCommentDisplay` component
|
|
26
36
|
|
|
27
37
|
### 2.6.0
|
|
28
38
|
|
|
29
|
-
- Added a new component, WavelengthProgressBar
|
|
39
|
+
- Added a new component, `WavelengthProgressBar`
|
|
30
40
|
|
|
31
41
|
### 2.5.1
|
|
32
42
|
|
|
33
43
|
- 03/12/2025
|
|
34
|
-
- Added shrink prop to
|
|
44
|
+
- Added shrink prop to `WavelengthTextField` component
|
|
35
45
|
- Changed message prop in the snackbar component to be a react or jsx element
|
|
36
46
|
|
|
37
47
|
### 2.5.0
|
|
38
48
|
|
|
39
49
|
- 03/06/2025
|
|
40
|
-
- Added a new component, WavelengthDragAndDrop
|
|
41
|
-
- Updated WavelengthTextField component to take in a prop called type
|
|
50
|
+
- Added a new component, `WavelengthDragAndDrop`
|
|
51
|
+
- Updated `WavelengthTextField` component to take in a prop called type
|
|
42
52
|
|
|
43
53
|
### 2.4.0
|
|
44
54
|
|
|
45
55
|
- 03/03/2025
|
|
46
|
-
- Added 2 new components, WavelengthStyledButton
|
|
56
|
+
- Added 2 new components, `WavelengthStyledButton`, and `WavelengthTextField`
|
|
47
57
|
- Updated the confirmation modal to include more props making it more customizable
|
|
48
58
|
- Updated documentation to reflect these changes
|
|
49
59
|
|
|
50
60
|
### 2.3.5
|
|
51
61
|
|
|
52
|
-
- Updated WavelengthDropdown by adding default values to some of the props
|
|
62
|
+
- Updated `WavelengthDropdown` by adding default values to some of the props
|
|
53
63
|
- Fixed bugs related to WavelengthSearchbar, no longer 2 closing icons for some configurations
|
|
54
|
-
- Updated WavelengthPopupMenu
|
|
64
|
+
- Updated `WavelengthPopupMenu`, each list item can have a hover color for text, also fixed underlining of link type issue
|
|
55
65
|
- Standard Snackbar is not aligned properly, the Snackbars with icons are also aligned properly
|
|
56
66
|
|
|
57
67
|
### 2.3.4
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -4989,50 +4989,75 @@ function WavelengthTitleBar2({ titleText, subtitleText, textColor, textShadow })
|
|
|
4989
4989
|
|
|
4990
4990
|
// src/components/headers/WavelengthTitleBar/WavelengthBanner.tsx
|
|
4991
4991
|
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
textColor = textColor ? textColor : "white";
|
|
4998
|
-
}
|
|
4999
|
-
headerColor = headerColor ? headerColor : "#007a33";
|
|
5000
|
-
textColor = textColor ? textColor : "white";
|
|
5001
|
-
} else if (classification === "controlled" || classification === "controlled unclassified information" || classification === "cui" || classification === "u") {
|
|
5002
|
-
headerColor = headerColor ? headerColor : "#502b85";
|
|
5003
|
-
textColor = textColor ? textColor : "white";
|
|
5004
|
-
} else if (classification === "confidential" || classification === "c") {
|
|
5005
|
-
headerColor = headerColor ? headerColor : "#0033a0";
|
|
5006
|
-
textColor = textColor ? textColor : "white";
|
|
5007
|
-
} else if (classification === "secret" || classification === "s") {
|
|
5008
|
-
headerColor = headerColor ? headerColor : "#c8102e";
|
|
5009
|
-
textColor = textColor ? textColor : "white";
|
|
5010
|
-
} else if (classification === "top secret" || classification === "ts") {
|
|
5011
|
-
if (control && control.includes("sci")) {
|
|
5012
|
-
headerColor = headerColor ? headerColor : "#fce83a";
|
|
5013
|
-
textColor = textColor ? textColor : "black";
|
|
5014
|
-
}
|
|
5015
|
-
headerColor = headerColor ? headerColor : "#ff8c00";
|
|
5016
|
-
textColor = textColor ? textColor : "black";
|
|
5017
|
-
} else if (classification === "" || classification === null || classification === void 0) {
|
|
5018
|
-
classification = "CLASSIFICATION//CONTROL";
|
|
5019
|
-
headerColor = palette2.primary;
|
|
5020
|
-
textColor = palette2.secondary;
|
|
5021
|
-
} else {
|
|
5022
|
-
headerColor = headerColor ? headerColor : palette2.primary;
|
|
5023
|
-
textColor = textColor ? textColor : palette2.secondary;
|
|
4992
|
+
|
|
4993
|
+
// src/web-components/wavelength-banner.tsx
|
|
4994
|
+
var WavelengthBanner = class extends HTMLElement {
|
|
4995
|
+
static get observedAttributes() {
|
|
4996
|
+
return ["header-text", "header-color", "text-color", "opacity", "z-index", "id"];
|
|
5024
4997
|
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
4998
|
+
constructor() {
|
|
4999
|
+
super();
|
|
5000
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
5001
|
+
const style3 = document.createElement("style");
|
|
5002
|
+
style3.textContent = `
|
|
5003
|
+
:host {
|
|
5004
|
+
display: block;
|
|
5005
|
+
width: 100%;
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
.banner {
|
|
5009
|
+
width: 100%;
|
|
5010
|
+
text-align: center;
|
|
5011
|
+
font-weight: normal;
|
|
5012
|
+
font-family: sans-serif;
|
|
5013
|
+
font-size: 1rem;
|
|
5014
|
+
}
|
|
5015
|
+
`;
|
|
5016
|
+
this.container = document.createElement("div");
|
|
5017
|
+
this.container.classList.add("banner");
|
|
5018
|
+
this.textElement = document.createElement("p");
|
|
5019
|
+
this.container.appendChild(this.textElement);
|
|
5020
|
+
shadow.appendChild(style3);
|
|
5021
|
+
shadow.appendChild(this.container);
|
|
5022
|
+
}
|
|
5023
|
+
connectedCallback() {
|
|
5024
|
+
this.updateAttributes();
|
|
5025
|
+
}
|
|
5026
|
+
attributeChangedCallback() {
|
|
5027
|
+
this.updateAttributes();
|
|
5028
|
+
}
|
|
5029
|
+
updateAttributes() {
|
|
5030
|
+
const headerText = this.getAttribute("header-text") || "CLASSIFICATION//CONTROL";
|
|
5031
|
+
const headerColor = this.getAttribute("header-color") || "#4373aa";
|
|
5032
|
+
const textColor = this.getAttribute("text-color") || "#ffffff";
|
|
5033
|
+
const opacity = this.getAttribute("opacity") || "1";
|
|
5034
|
+
const zIndex = this.getAttribute("z-index") || "10";
|
|
5035
|
+
const id = this.getAttribute("id");
|
|
5036
|
+
this.container.style.backgroundColor = headerColor;
|
|
5037
|
+
this.container.style.opacity = opacity;
|
|
5038
|
+
this.container.style.zIndex = zIndex;
|
|
5039
|
+
if (id) this.container.id = id;
|
|
5040
|
+
this.textElement.textContent = headerText.toUpperCase();
|
|
5041
|
+
this.textElement.style.color = textColor;
|
|
5034
5042
|
}
|
|
5035
|
-
|
|
5043
|
+
};
|
|
5044
|
+
customElements.define("wavelength-banner", WavelengthBanner);
|
|
5045
|
+
|
|
5046
|
+
// src/components/headers/WavelengthTitleBar/WavelengthBanner.tsx
|
|
5047
|
+
|
|
5048
|
+
function WavelengthBanner2({ headerText = "CLASSIFICATION//CONTROL", headerColor = "#000000", textColor = "#FFFFFF", opacity = 1, zIndex = 10, id }) {
|
|
5049
|
+
const ref = _react.useRef.call(void 0, null);
|
|
5050
|
+
_react.useEffect.call(void 0, () => {
|
|
5051
|
+
if (ref.current) {
|
|
5052
|
+
ref.current.setAttribute("header-text", headerText);
|
|
5053
|
+
ref.current.setAttribute("header-color", headerColor);
|
|
5054
|
+
ref.current.setAttribute("text-color", textColor);
|
|
5055
|
+
ref.current.setAttribute("opacity", String(opacity));
|
|
5056
|
+
ref.current.setAttribute("z-index", String(zIndex));
|
|
5057
|
+
if (id) ref.current.setAttribute("id", id);
|
|
5058
|
+
}
|
|
5059
|
+
}, [headerText, headerColor, textColor, opacity, zIndex, id]);
|
|
5060
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "wavelength-banner", { ref });
|
|
5036
5061
|
}
|
|
5037
5062
|
|
|
5038
5063
|
// src/components/CSFD/ManyPlanes.tsx
|
|
@@ -6089,6 +6114,7 @@ function DefaultPagination({ totalPages, currentPageNumber, siblingCount = 1, bo
|
|
|
6089
6114
|
);
|
|
6090
6115
|
}
|
|
6091
6116
|
}
|
|
6117
|
+
var WavelengthPagination_default = DefaultPagination;
|
|
6092
6118
|
|
|
6093
6119
|
// src/components/TextField/WavelengthTextField.tsx
|
|
6094
6120
|
|
|
@@ -6222,6 +6248,368 @@ function WavelengthTextField(props) {
|
|
|
6222
6248
|
return null;
|
|
6223
6249
|
}
|
|
6224
6250
|
|
|
6251
|
+
// src/components/DataTable/WavelengthDataTable.tsx
|
|
6252
|
+
|
|
6253
|
+
|
|
6254
|
+
|
|
6255
|
+
var ModalInputDiv = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.th`
|
|
6319
|
+
position: relative;
|
|
6320
|
+
`;
|
|
6321
|
+
var KebabMenu = _styledcomponents2.default.div`
|
|
6322
|
+
display: inline-block;
|
|
6323
|
+
position: absolute;
|
|
6324
|
+
right: 0;
|
|
6325
|
+
top: 2px;
|
|
6326
|
+
`;
|
|
6327
|
+
var KebabIcon = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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 = _styledcomponents2.default.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] = _react.useState.call(void 0, data || []);
|
|
6422
|
+
const copiedArray = [...data || []];
|
|
6423
|
+
const [editingId, setEditingId] = _react.useState.call(void 0, null);
|
|
6424
|
+
const [editedColumnKey, setEditedColumnKey] = _react.useState.call(void 0, null);
|
|
6425
|
+
const [editedValue, setEditedValue] = _react.useState.call(void 0, "");
|
|
6426
|
+
const [noRowsOpen, setNoRowsOpen] = _react.useState.call(void 0, false);
|
|
6427
|
+
const [isModalOpen, setIsModalOpen] = _react.useState.call(void 0, false);
|
|
6428
|
+
const [searchItem, setSearchItem] = _react.useState.call(void 0, "");
|
|
6429
|
+
const [selectedValue, setSelectedValue] = _react.useState.call(void 0, _optionalChain([columns, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.key]) || "");
|
|
6430
|
+
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
6431
|
+
const [isOpen, setIsOpen] = _react.useState.call(void 0, false);
|
|
6432
|
+
const [editingMenuKey, setEditingMenuKey] = _react.useState.call(void 0, null);
|
|
6433
|
+
const menuRef = _react.useRef.call(void 0, null);
|
|
6434
|
+
const modalRef = _react.useRef.call(void 0, 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
|
+
_react.useEffect.call(void 0, () => {
|
|
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
|
+
_react.useEffect.call(void 0, () => {
|
|
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] = _react.useState.call(void 0, "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__ */ _jsxruntime.jsxs.call(void 0, TableHeadStyle, { children: [
|
|
6530
|
+
column.title,
|
|
6531
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, KebabMenu, { ref: menuRef, children: [
|
|
6532
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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__ */ _jsxruntime.jsxs.call(void 0, MenuOptions, { children: [
|
|
6543
|
+
sortOrder === "asc" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { title: `MenuListASC-${index}`, onClick: () => handleSort(column.key, "asc"), children: [
|
|
6544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2B06" }),
|
|
6545
|
+
" Sort ASC"
|
|
6546
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { title: `MenuListDES-${index}`, onClick: () => handleSort(column.key, "desc"), children: [
|
|
6547
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u2B07" }),
|
|
6548
|
+
" Sort DESC"
|
|
6549
|
+
] }),
|
|
6550
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { title: `MenuListFilterButton-${index}`, onClick: openModal, children: [
|
|
6551
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "\u23F7" }),
|
|
6552
|
+
" Filter"
|
|
6553
|
+
] }),
|
|
6554
|
+
isModalOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalOverlay, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ModalWrapper, { ref: modalRef, children: [
|
|
6555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ModalClose, { title: `ModalClose-${index}`, onClick: closeModal, children: "\xD7" }),
|
|
6556
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ModalInputDiv, { children: [
|
|
6557
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { htmlFor: "filterSelectId", children: "Columns: " }),
|
|
6558
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "select", { title: `filterSelect-${index}`, id: "filterSelectId", value: selectedValue, onChange: handleChange, children: columns.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { children: item.key }, item.key)) })
|
|
6559
|
+
] }),
|
|
6560
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, ModalInputDiv, { children: [
|
|
6561
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { htmlFor: "filterInputId", children: "Values: " }),
|
|
6562
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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 = !_optionalChain([currentPageData, 'optionalAccess', _39 => _39.length]) || noRowsOpen ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { title: "NoDataRows", colSpan: columns.length, children: "No data" }) }) : _optionalChain([currentPageData, 'optionalAccess', _40 => _40.map, 'call', _41 => _41((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: columns.map((column, index2) => {
|
|
6584
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledTd, { children: editingId === item.id && editedColumnKey === column.key ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, "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__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
6604
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledBoxDiv, { title: "StyledBoxDiv", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, StyledTableTwo, { title: "StyledTable", children: [
|
|
6605
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: headers }) }),
|
|
6606
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: rows })
|
|
6607
|
+
] }) }),
|
|
6608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledNavBoxDiv, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WavelengthPagination_default, { totalPages, currentPageNumber: currentPage, onPageChange: setCurrentPage, style: "circular" }) })
|
|
6609
|
+
] });
|
|
6610
|
+
};
|
|
6611
|
+
|
|
6612
|
+
|
|
6225
6613
|
|
|
6226
6614
|
|
|
6227
6615
|
|
|
@@ -6268,7 +6656,7 @@ function WavelengthTextField(props) {
|
|
|
6268
6656
|
|
|
6269
6657
|
|
|
6270
6658
|
|
|
6271
|
-
exports.AppLogo = AppLogo; exports.ButtonIcon = ButtonIcon; exports.ButtonMenu = ButtonMenu; exports.DefaultCarousel = DefaultCarousel; exports.DefaultIcon = DefaultIcon; exports.DefaultPagination = DefaultPagination; exports.ManyPlanesComponent = ManyPlanesComponent; exports.NotAvailablePage = NotAvailablePage; exports.SearchTextField = SearchTextField; exports.SliderCardCarousel = SliderCardCarousel; exports.TestSnackbar = TestSnackbar; exports.WavelengthAppTheme = WavelengthAppTheme; exports.WavelengthAutocomplete = WavelengthAutocomplete; exports.WavelengthBanner =
|
|
6659
|
+
exports.AppLogo = AppLogo; exports.ButtonIcon = ButtonIcon; exports.ButtonMenu = ButtonMenu; exports.DefaultCarousel = DefaultCarousel; exports.DefaultIcon = DefaultIcon; exports.DefaultPagination = DefaultPagination; exports.ManyPlanesComponent = ManyPlanesComponent; exports.NotAvailablePage = NotAvailablePage; exports.SearchTextField = SearchTextField; exports.SliderCardCarousel = SliderCardCarousel; exports.TestSnackbar = TestSnackbar; exports.WavelengthAppTheme = WavelengthAppTheme; exports.WavelengthAutocomplete = WavelengthAutocomplete; exports.WavelengthBanner = WavelengthBanner2; exports.WavelengthBox = WavelengthBox; exports.WavelengthButton = WavelengthButton; exports.WavelengthCommentDisplay = WavelengthCommentDisplay; exports.WavelengthConfirmationModal = WavelengthConfirmationModal; exports.WavelengthContentModal = WavelengthContentModal; exports.WavelengthContentPlaceholder = WavelengthContentPlaceholder; exports.WavelengthDataTable = WavelengthDataTable; exports.WavelengthDragAndDrop = WavelengthDragAndDrop; exports.WavelengthDropdown = WavelengthDropdown; exports.WavelengthDropdownButton = WavelengthDropdownButton; exports.WavelengthExampleComponent = WavelengthExampleComponent; exports.WavelengthFileDownloader = WavelengthFileDownloader; exports.WavelengthFooter = WavelengthFooter; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthPopUpMenu = WavelengthPopUpMenu; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthSearch = WavelengthSearch; exports.WavelengthSideBar = WavelengthSideBar; exports.WavelengthSlider = WavelengthSlider; exports.WavelengthSnackbar = WavelengthSnackbar; exports.WavelengthSpinningLogo = WavelengthSpinningLogo; exports.WavelengthSpinningOuterCircle = WavelengthSpinningOuterCircle; exports.WavelengthStandardSnackbar = WavelengthStandardSnackbar; exports.WavelengthStyledButton = WavelengthStyledButton; exports.WavelengthTextField = WavelengthTextField; exports.WavelengthTitleBar = WavelengthTitleBar2; exports.add = add; exports.ascendingRange = ascendingRange; exports.concat = concat; exports.findBestStringMatch = findBestStringMatch; exports.range = range; exports.useOutsideClick = useOutsideClick; exports.useThemeContext = useThemeContext;
|
|
6272
6660
|
/*! Bundled license information:
|
|
6273
6661
|
|
|
6274
6662
|
react-is/cjs/react-is.production.min.js:
|