sag_components 2.0.0-beta189 → 2.0.0-beta191
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/dist/index.esm.js +265 -176
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +264 -175
- package/dist/index.js.map +1 -1
- package/dist/types/components/ItemManagerPanel/NewSubitem/NewSubitem.d.ts +2 -1
- package/dist/types/components/ItemManagerPanel/NewSubitem/NewSubitem.style.d.ts +1 -0
- package/dist/types/components/Table/TableBody.d.ts +2 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12262,16 +12262,13 @@ const Td$1 = styled__default["default"].td`
|
|
|
12262
12262
|
`;
|
|
12263
12263
|
const Tr = styled__default["default"].tr`
|
|
12264
12264
|
border-bottom: 1px solid #f3f4f6;
|
|
12265
|
-
${
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
} = _ref;
|
|
12270
|
-
return enableHover && `&:hover {
|
|
12265
|
+
${({
|
|
12266
|
+
enableHover,
|
|
12267
|
+
selectHoverColor
|
|
12268
|
+
}) => enableHover && `&:hover {
|
|
12271
12269
|
background-color: ${selectHoverColor};
|
|
12272
12270
|
cursor: pointer;
|
|
12273
|
-
}
|
|
12274
|
-
}}
|
|
12271
|
+
}`}
|
|
12275
12272
|
`;
|
|
12276
12273
|
const InfoText = styled__default["default"].div`
|
|
12277
12274
|
font-weight: 400;
|
|
@@ -39788,9 +39785,9 @@ const ChromeShimmerText = ({
|
|
|
39788
39785
|
};
|
|
39789
39786
|
|
|
39790
39787
|
// TableBody.jsx
|
|
39791
|
-
const TableBody = ({
|
|
39792
|
-
columns,
|
|
39793
|
-
data,
|
|
39788
|
+
const TableBody = /*#__PURE__*/React$1.forwardRef(({
|
|
39789
|
+
columns = [],
|
|
39790
|
+
data = [],
|
|
39794
39791
|
onRowClick,
|
|
39795
39792
|
onSendClick,
|
|
39796
39793
|
buttonColor,
|
|
@@ -39824,9 +39821,8 @@ const TableBody = ({
|
|
|
39824
39821
|
// New prop with default
|
|
39825
39822
|
onDropdownSelected = () => {},
|
|
39826
39823
|
onCheckboxClick = () => {},
|
|
39827
|
-
onHeaderCheckboxClick = () => {}
|
|
39828
|
-
|
|
39829
|
-
}) => {
|
|
39824
|
+
onHeaderCheckboxClick = () => {}
|
|
39825
|
+
}, ref) => {
|
|
39830
39826
|
const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
|
|
39831
39827
|
const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
|
|
39832
39828
|
const [isCommentModalOpen, setIsCommentModalOpen] = React$1.useState(false);
|
|
@@ -39838,8 +39834,33 @@ const TableBody = ({
|
|
|
39838
39834
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
39839
39835
|
const [hasUserInteracted, setHasUserInteracted] = React$1.useState(false);
|
|
39840
39836
|
const [hasInitialValue, setHasInitialValue] = React$1.useState(false);
|
|
39837
|
+
|
|
39838
|
+
// Early return for invalid data
|
|
39839
|
+
if (!Array.isArray(data) || !Array.isArray(columns)) {
|
|
39840
|
+
console.warn("TableBody: Invalid data or columns prop");
|
|
39841
|
+
return null;
|
|
39842
|
+
}
|
|
39843
|
+
|
|
39844
|
+
// Expose methods to parent component via ref
|
|
39845
|
+
React$1.useImperativeHandle(ref, () => ({
|
|
39846
|
+
clearFocus: () => {
|
|
39847
|
+
setFocusedRowIndex(null);
|
|
39848
|
+
setHoveredRowIndex(null);
|
|
39849
|
+
},
|
|
39850
|
+
setFocus: index => {
|
|
39851
|
+
setFocusedRowIndex(index);
|
|
39852
|
+
},
|
|
39853
|
+
getFocusedIndex: () => {
|
|
39854
|
+
return focusedRowIndex;
|
|
39855
|
+
},
|
|
39856
|
+
clearSelection: () => {
|
|
39857
|
+
setFocusedRowIndex(null);
|
|
39858
|
+
setHoveredRowIndex(null);
|
|
39859
|
+
setOpenDropdowns({});
|
|
39860
|
+
}
|
|
39861
|
+
}), [focusedRowIndex]);
|
|
39841
39862
|
React$1.useEffect(() => {
|
|
39842
|
-
if (isCommentModalOpen && currentCommentRow !== null) {
|
|
39863
|
+
if (isCommentModalOpen && currentCommentRow !== null && data[currentCommentRow]) {
|
|
39843
39864
|
const initialText = data[currentCommentRow]?.Comments || "";
|
|
39844
39865
|
setCommentText(initialText);
|
|
39845
39866
|
setHasInitialValue(Boolean(initialText.trim()));
|
|
@@ -39852,7 +39873,7 @@ const TableBody = ({
|
|
|
39852
39873
|
}
|
|
39853
39874
|
}, [resetFocusIndex]);
|
|
39854
39875
|
React$1.useEffect(() => {
|
|
39855
|
-
if (changeFocusIndex) {
|
|
39876
|
+
if (changeFocusIndex !== undefined && changeFocusIndex !== null) {
|
|
39856
39877
|
setFocusedRowIndex(changeFocusIndex);
|
|
39857
39878
|
}
|
|
39858
39879
|
}, [changeFocusIndex]);
|
|
@@ -39904,41 +39925,46 @@ const TableBody = ({
|
|
|
39904
39925
|
|
|
39905
39926
|
// Helper function to format tag text
|
|
39906
39927
|
const formatTagText = tag => {
|
|
39907
|
-
if (typeof tag !== "string") return tag;
|
|
39928
|
+
if (typeof tag !== "string") return String(tag || "");
|
|
39908
39929
|
return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
|
|
39909
39930
|
};
|
|
39910
39931
|
const formatValue = (value, column, row, rowIndex) => {
|
|
39911
|
-
if ((value === null || value === undefined) && column
|
|
39932
|
+
if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
|
|
39912
39933
|
return "";
|
|
39913
39934
|
}
|
|
39914
39935
|
|
|
39915
39936
|
// Find the tooltip text for the current value - can be used for different fieldTypes
|
|
39916
39937
|
const getTooltipText = value => {
|
|
39917
|
-
if (column
|
|
39938
|
+
if (column?.tooltipText && Array.isArray(column.tooltipText)) {
|
|
39918
39939
|
const tooltipItem = column.tooltipText.find(item => item.value === value);
|
|
39919
39940
|
return tooltipItem ? tooltipItem.label : null;
|
|
39920
39941
|
}
|
|
39921
39942
|
return null;
|
|
39922
39943
|
};
|
|
39923
|
-
switch (column
|
|
39944
|
+
switch (column?.fieldType?.toLowerCase()) {
|
|
39924
39945
|
case "currency":
|
|
39925
39946
|
if (column.format === "$0.00") {
|
|
39926
|
-
return `$${parseFloat(value).toFixed(2)}`;
|
|
39947
|
+
return `$${parseFloat(value || 0).toFixed(2)}`;
|
|
39927
39948
|
}
|
|
39928
39949
|
return value;
|
|
39929
39950
|
case "text":
|
|
39930
39951
|
return value?.toString() || "";
|
|
39931
39952
|
case "number":
|
|
39932
39953
|
if (column.format && column.format.includes(",")) {
|
|
39933
|
-
return value.toLocaleString();
|
|
39954
|
+
return (value || 0).toLocaleString();
|
|
39934
39955
|
}
|
|
39935
39956
|
return value;
|
|
39936
39957
|
case "percentage":
|
|
39937
|
-
return `${value}%`;
|
|
39958
|
+
return `${value || 0}%`;
|
|
39938
39959
|
case "date":
|
|
39939
|
-
if (column.format === "MM/DD/YYYY") {
|
|
39940
|
-
|
|
39941
|
-
|
|
39960
|
+
if (column.format === "MM/DD/YYYY" && value) {
|
|
39961
|
+
try {
|
|
39962
|
+
const date = new Date(value);
|
|
39963
|
+
return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
|
|
39964
|
+
} catch (e) {
|
|
39965
|
+
console.warn("Invalid date format:", value);
|
|
39966
|
+
return value;
|
|
39967
|
+
}
|
|
39942
39968
|
}
|
|
39943
39969
|
return value;
|
|
39944
39970
|
case "boolean":
|
|
@@ -39997,17 +40023,21 @@ const TableBody = ({
|
|
|
39997
40023
|
// Helper function to apply tooltip logic
|
|
39998
40024
|
const applyTooltipLogic = (element, tooltipText) => {
|
|
39999
40025
|
if (element && tooltipText && tooltipText.trim() !== "") {
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
|
|
40003
|
-
|
|
40004
|
-
|
|
40005
|
-
|
|
40006
|
-
|
|
40007
|
-
|
|
40008
|
-
|
|
40009
|
-
|
|
40010
|
-
|
|
40026
|
+
try {
|
|
40027
|
+
const rect = element.getBoundingClientRect();
|
|
40028
|
+
const {
|
|
40029
|
+
offset,
|
|
40030
|
+
height
|
|
40031
|
+
} = calculateTooltipOffset(tooltipText);
|
|
40032
|
+
element.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40033
|
+
element.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40034
|
+
element.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40035
|
+
element.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40036
|
+
element.style.setProperty("--tooltip-height", `${height}px`);
|
|
40037
|
+
element.setAttribute("data-tooltip", tooltipText);
|
|
40038
|
+
} catch (e) {
|
|
40039
|
+
console.warn("Error applying tooltip:", e);
|
|
40040
|
+
}
|
|
40011
40041
|
}
|
|
40012
40042
|
};
|
|
40013
40043
|
const tooltipText = getTooltipText(value);
|
|
@@ -40065,7 +40095,7 @@ const TableBody = ({
|
|
|
40065
40095
|
return value;
|
|
40066
40096
|
case "status":
|
|
40067
40097
|
const statusObj = statuses.find(status => status.status === value) || {};
|
|
40068
|
-
const [palette0, palette1] = statusObj.palette;
|
|
40098
|
+
const [palette0, palette1] = statusObj.palette || ["#F3F4F6", "#374151"];
|
|
40069
40099
|
return /*#__PURE__*/React__default["default"].createElement(StatusCell$1, {
|
|
40070
40100
|
color: palette1
|
|
40071
40101
|
}, /*#__PURE__*/React__default["default"].createElement(StatusCellCircle, {
|
|
@@ -40081,27 +40111,31 @@ const TableBody = ({
|
|
|
40081
40111
|
$buttonColor: buttonColor,
|
|
40082
40112
|
ref: el => {
|
|
40083
40113
|
if (el) {
|
|
40084
|
-
|
|
40085
|
-
|
|
40086
|
-
|
|
40087
|
-
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40092
|
-
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
|
|
40100
|
-
|
|
40101
|
-
|
|
40102
|
-
|
|
40103
|
-
|
|
40104
|
-
|
|
40114
|
+
try {
|
|
40115
|
+
if (hasComments) {
|
|
40116
|
+
// Add tooltip if there are comments
|
|
40117
|
+
const rect = el.getBoundingClientRect();
|
|
40118
|
+
const {
|
|
40119
|
+
offset,
|
|
40120
|
+
height
|
|
40121
|
+
} = calculateTooltipOffset(commentTooltipText);
|
|
40122
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40123
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40124
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40125
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40126
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40127
|
+
el.setAttribute("data-tooltip", commentTooltipText);
|
|
40128
|
+
} else {
|
|
40129
|
+
// Remove tooltip if there are no comments
|
|
40130
|
+
el.removeAttribute("data-tooltip");
|
|
40131
|
+
el.style.removeProperty("--tooltip-top");
|
|
40132
|
+
el.style.removeProperty("--tooltip-left");
|
|
40133
|
+
el.style.removeProperty("--tooltip-width");
|
|
40134
|
+
el.style.removeProperty("--tooltip-offset");
|
|
40135
|
+
el.style.removeProperty("--tooltip-height");
|
|
40136
|
+
}
|
|
40137
|
+
} catch (e) {
|
|
40138
|
+
console.warn("Error handling comment tooltip:", e);
|
|
40105
40139
|
}
|
|
40106
40140
|
}
|
|
40107
40141
|
},
|
|
@@ -40125,17 +40159,21 @@ const TableBody = ({
|
|
|
40125
40159
|
$buttonColor: buttonColor,
|
|
40126
40160
|
ref: el => {
|
|
40127
40161
|
if (el && trashTooltipText) {
|
|
40128
|
-
|
|
40129
|
-
|
|
40130
|
-
|
|
40131
|
-
|
|
40132
|
-
|
|
40133
|
-
|
|
40134
|
-
|
|
40135
|
-
|
|
40136
|
-
|
|
40137
|
-
|
|
40138
|
-
|
|
40162
|
+
try {
|
|
40163
|
+
const rect = el.getBoundingClientRect();
|
|
40164
|
+
const {
|
|
40165
|
+
offset,
|
|
40166
|
+
height
|
|
40167
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40168
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40169
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40170
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40171
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40172
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40173
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40174
|
+
} catch (e) {
|
|
40175
|
+
console.warn("Error handling trash tooltip:", e);
|
|
40176
|
+
}
|
|
40139
40177
|
}
|
|
40140
40178
|
},
|
|
40141
40179
|
onClick: e => {
|
|
@@ -40150,17 +40188,21 @@ const TableBody = ({
|
|
|
40150
40188
|
return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
|
|
40151
40189
|
ref: el => {
|
|
40152
40190
|
if (el && trashTooltipText) {
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
|
|
40156
|
-
|
|
40157
|
-
|
|
40158
|
-
|
|
40159
|
-
|
|
40160
|
-
|
|
40161
|
-
|
|
40162
|
-
|
|
40163
|
-
|
|
40191
|
+
try {
|
|
40192
|
+
const rect = el.getBoundingClientRect();
|
|
40193
|
+
const {
|
|
40194
|
+
offset,
|
|
40195
|
+
height
|
|
40196
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40197
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40198
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40199
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40200
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40201
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40202
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40203
|
+
} catch (e) {
|
|
40204
|
+
console.warn("Error handling disabled trash tooltip:", e);
|
|
40205
|
+
}
|
|
40164
40206
|
}
|
|
40165
40207
|
}
|
|
40166
40208
|
}, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
|
|
@@ -40170,13 +40212,14 @@ const TableBody = ({
|
|
|
40170
40212
|
}
|
|
40171
40213
|
return null;
|
|
40172
40214
|
case "dropdown":
|
|
40215
|
+
if (!column) return null;
|
|
40173
40216
|
const dropdownKey = `${rowIndex}-${column.key}`;
|
|
40174
40217
|
const isOpen = openDropdowns[dropdownKey] || false;
|
|
40175
40218
|
const dropdownOptions = column.dropdownOptions || [];
|
|
40176
40219
|
const maxDropdownHeight = column.maxDropdownHeight || "200px";
|
|
40177
|
-
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40178
|
-
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40179
|
-
const placeholder = column.placeholder || "Select...";
|
|
40220
|
+
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40221
|
+
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40222
|
+
const placeholder = column.placeholder || "Select...";
|
|
40180
40223
|
|
|
40181
40224
|
// Find the current selected option to display its label
|
|
40182
40225
|
const currentOption = dropdownOptions.find(option => option.value === value);
|
|
@@ -40197,8 +40240,7 @@ const TableBody = ({
|
|
|
40197
40240
|
selectedColor: selectedColor
|
|
40198
40241
|
});
|
|
40199
40242
|
case "checkbox":
|
|
40200
|
-
const isChecked = Boolean(value);
|
|
40201
|
-
|
|
40243
|
+
const isChecked = Boolean(value);
|
|
40202
40244
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40203
40245
|
style: {
|
|
40204
40246
|
display: "flex",
|
|
@@ -40211,13 +40253,12 @@ const TableBody = ({
|
|
|
40211
40253
|
type: "checkbox",
|
|
40212
40254
|
checked: isChecked,
|
|
40213
40255
|
onChange: e => handleCheckboxClick(row, column.key, e),
|
|
40214
|
-
onClick: e => e.stopPropagation()
|
|
40215
|
-
,
|
|
40256
|
+
onClick: e => e.stopPropagation(),
|
|
40216
40257
|
style: {
|
|
40217
40258
|
width: "18px",
|
|
40218
40259
|
height: "18px",
|
|
40219
40260
|
cursor: "pointer",
|
|
40220
|
-
accentColor: buttonColor
|
|
40261
|
+
accentColor: buttonColor
|
|
40221
40262
|
}
|
|
40222
40263
|
}));
|
|
40223
40264
|
default:
|
|
@@ -40233,7 +40274,6 @@ const TableBody = ({
|
|
|
40233
40274
|
const handleExpandClick = (row, rowIndex, event) => {
|
|
40234
40275
|
event.stopPropagation();
|
|
40235
40276
|
if (onExpandRow) {
|
|
40236
|
-
// Determine the expand status based on current state
|
|
40237
40277
|
const expandStatus = expandedRows[rowIndex] ? "isClosed" : "isOpen";
|
|
40238
40278
|
onExpandRow(row, rowIndex, expandStatus);
|
|
40239
40279
|
}
|
|
@@ -40243,15 +40283,11 @@ const TableBody = ({
|
|
|
40243
40283
|
const handleCheckboxClick = (row, columnKey, event) => {
|
|
40244
40284
|
event.stopPropagation();
|
|
40245
40285
|
const currentValue = row[columnKey];
|
|
40246
|
-
const newValue = !currentValue;
|
|
40247
|
-
|
|
40248
|
-
// Create updated row with new checkbox value
|
|
40286
|
+
const newValue = !currentValue;
|
|
40249
40287
|
const updatedRow = {
|
|
40250
40288
|
...row,
|
|
40251
40289
|
[columnKey]: newValue
|
|
40252
40290
|
};
|
|
40253
|
-
|
|
40254
|
-
// Fire the onCheckboxClick event with updated row
|
|
40255
40291
|
if (onCheckboxClick) {
|
|
40256
40292
|
onCheckboxClick({
|
|
40257
40293
|
fullRow: updatedRow,
|
|
@@ -40275,14 +40311,10 @@ const TableBody = ({
|
|
|
40275
40311
|
const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
|
|
40276
40312
|
event.stopPropagation();
|
|
40277
40313
|
const dropdownKey = `${rowIndex}-${columnKey}`;
|
|
40278
|
-
|
|
40279
|
-
// Close the dropdown
|
|
40280
40314
|
setOpenDropdowns(prev => ({
|
|
40281
40315
|
...prev,
|
|
40282
40316
|
[dropdownKey]: false
|
|
40283
40317
|
}));
|
|
40284
|
-
|
|
40285
|
-
// Fire the onDropdownSelected event with columnKey instead of columnName
|
|
40286
40318
|
if (onDropdownSelected) {
|
|
40287
40319
|
onDropdownSelected(row, selectedOption, columnKey);
|
|
40288
40320
|
}
|
|
@@ -40298,72 +40330,109 @@ const TableBody = ({
|
|
|
40298
40330
|
document.removeEventListener("click", handleClickOutside);
|
|
40299
40331
|
};
|
|
40300
40332
|
}, []);
|
|
40301
|
-
|
|
40302
|
-
|
|
40303
|
-
|
|
40304
|
-
"
|
|
40305
|
-
|
|
40306
|
-
|
|
40307
|
-
|
|
40308
|
-
|
|
40309
|
-
|
|
40310
|
-
|
|
40311
|
-
|
|
40312
|
-
|
|
40313
|
-
|
|
40314
|
-
|
|
40315
|
-
|
|
40316
|
-
|
|
40317
|
-
|
|
40318
|
-
|
|
40319
|
-
|
|
40320
|
-
|
|
40321
|
-
|
|
40322
|
-
|
|
40323
|
-
|
|
40324
|
-
|
|
40325
|
-
|
|
40326
|
-
|
|
40327
|
-
|
|
40328
|
-
|
|
40329
|
-
|
|
40330
|
-
|
|
40331
|
-
|
|
40332
|
-
|
|
40333
|
-
|
|
40334
|
-
|
|
40335
|
-
|
|
40336
|
-
|
|
40337
|
-
|
|
40338
|
-
|
|
40339
|
-
|
|
40340
|
-
|
|
40341
|
-
|
|
40342
|
-
|
|
40343
|
-
|
|
40344
|
-
|
|
40345
|
-
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
|
|
40349
|
-
|
|
40333
|
+
|
|
40334
|
+
// Return null if no data
|
|
40335
|
+
if (data.length === 0) {
|
|
40336
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
|
|
40337
|
+
ref: ref
|
|
40338
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableRow, null, /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40339
|
+
colSpan: columns.length
|
|
40340
|
+
}, "No data available")));
|
|
40341
|
+
}
|
|
40342
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
|
|
40343
|
+
ref: ref
|
|
40344
|
+
}, data.map((row, rowIndex) => {
|
|
40345
|
+
// Skip invalid rows
|
|
40346
|
+
if (!row || typeof row !== 'object') {
|
|
40347
|
+
console.warn(`Invalid row at index ${rowIndex}:`, row);
|
|
40348
|
+
return null;
|
|
40349
|
+
}
|
|
40350
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
40351
|
+
key: row.id || `row-${rowIndex}`
|
|
40352
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableRow, {
|
|
40353
|
+
"data-row-index": rowIndex,
|
|
40354
|
+
className: indexToShimmer === rowIndex ? "shimmer-row" : "",
|
|
40355
|
+
isFocused: focusedRowIndex === rowIndex,
|
|
40356
|
+
selectedColor: selectedColor,
|
|
40357
|
+
onMouseEnter: () => setHoveredRowIndex(rowIndex),
|
|
40358
|
+
onMouseLeave: () => setHoveredRowIndex(null),
|
|
40359
|
+
onClick: () => handleRowClick(row, rowIndex)
|
|
40360
|
+
}, expandable && expandedContent[rowIndex] !== undefined && expandedContent[rowIndex] !== null ? /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40361
|
+
$fieldType: "expand",
|
|
40362
|
+
$minWidth: "16px",
|
|
40363
|
+
$maxWidth: "16px"
|
|
40364
|
+
}, /*#__PURE__*/React__default["default"].createElement(ExpandIcon, {
|
|
40365
|
+
onClick: e => handleExpandClick(row, rowIndex, e),
|
|
40366
|
+
$isExpanded: expandedRows[rowIndex] || false
|
|
40367
|
+
}, expandedRows[rowIndex] ? /*#__PURE__*/React__default["default"].createElement(MenuItemOpenIcon, {
|
|
40368
|
+
width: "12",
|
|
40369
|
+
height: "12",
|
|
40370
|
+
color: "#666"
|
|
40371
|
+
}) : /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
|
|
40372
|
+
width: "12",
|
|
40373
|
+
height: "12",
|
|
40374
|
+
fill: "#666"
|
|
40375
|
+
}))) : expandable === true ? /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40376
|
+
$fieldType: "expand",
|
|
40377
|
+
$minWidth: "16px",
|
|
40378
|
+
$maxWidth: "16px"
|
|
40379
|
+
}) : null, columns.map((column, columnIndex) => {
|
|
40380
|
+
if (!column || !column.key) {
|
|
40381
|
+
console.warn(`Invalid column at index ${columnIndex}:`, column);
|
|
40382
|
+
return null;
|
|
40383
|
+
}
|
|
40384
|
+
const value = row[column.key];
|
|
40385
|
+
const formattedValue = formatValue(value, column, row, rowIndex);
|
|
40386
|
+
|
|
40387
|
+
// Use the chrome shimmer hook safely
|
|
40388
|
+
let shimmerText = formattedValue;
|
|
40389
|
+
let isShimmering = false;
|
|
40390
|
+
try {
|
|
40391
|
+
const shimmerResult = useShimmerChromeEffect(formattedValue, rowIndex, indexToShimmer, columnIndex, columns.length);
|
|
40392
|
+
if (shimmerResult) {
|
|
40393
|
+
shimmerText = shimmerResult.text || formattedValue;
|
|
40394
|
+
isShimmering = shimmerResult.isShimmering || false;
|
|
40350
40395
|
}
|
|
40351
|
-
}
|
|
40352
|
-
|
|
40353
|
-
|
|
40354
|
-
|
|
40355
|
-
|
|
40356
|
-
|
|
40357
|
-
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40361
|
-
|
|
40362
|
-
|
|
40363
|
-
|
|
40364
|
-
|
|
40365
|
-
|
|
40366
|
-
|
|
40396
|
+
} catch (e) {
|
|
40397
|
+
console.warn("Error with shimmer effect:", e);
|
|
40398
|
+
}
|
|
40399
|
+
return /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40400
|
+
key: `${column.key}-${rowIndex}`,
|
|
40401
|
+
ref: el => {
|
|
40402
|
+
if (el && shouldShowTooltip(el)) {
|
|
40403
|
+
try {
|
|
40404
|
+
const rect = el.getBoundingClientRect();
|
|
40405
|
+
const {
|
|
40406
|
+
offset,
|
|
40407
|
+
height
|
|
40408
|
+
} = calculateTooltipOffset(formattedValue.toString(), true);
|
|
40409
|
+
el.style.setProperty("--cell-top", `${rect.top}px`);
|
|
40410
|
+
el.style.setProperty("--cell-left", `${rect.left}px`);
|
|
40411
|
+
el.style.setProperty("--cell-width", `${rect.width}px`);
|
|
40412
|
+
el.style.setProperty("--cell-offset", `${offset}px`);
|
|
40413
|
+
el.style.setProperty("--cell-height", `${height}px`);
|
|
40414
|
+
el.setAttribute("data-tooltip", formattedValue);
|
|
40415
|
+
} catch (e) {
|
|
40416
|
+
console.warn("Error setting cell tooltip:", e);
|
|
40417
|
+
}
|
|
40418
|
+
}
|
|
40419
|
+
},
|
|
40420
|
+
$fieldType: column.fieldType?.toLowerCase(),
|
|
40421
|
+
$color: column.color,
|
|
40422
|
+
$minWidth: column.minWidth,
|
|
40423
|
+
$maxWidth: column.maxWidth
|
|
40424
|
+
}, column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType ? /*#__PURE__*/React__default["default"].createElement(ChromeShimmerText, {
|
|
40425
|
+
text: shimmerText,
|
|
40426
|
+
isShimmering: isShimmering
|
|
40427
|
+
}) : formattedValue);
|
|
40428
|
+
})), expandable && expandedRows[rowIndex] && /*#__PURE__*/React__default["default"].createElement(ExpandedRow, {
|
|
40429
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40430
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40431
|
+
colSpan: columns.length + 1
|
|
40432
|
+
}, /*#__PURE__*/React__default["default"].createElement(ExpandedContent, {
|
|
40433
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40434
|
+
}, expandedContent[rowIndex] || null))));
|
|
40435
|
+
})), /*#__PURE__*/React__default["default"].createElement(MessageBox, {
|
|
40367
40436
|
title: "Add Comment",
|
|
40368
40437
|
isOpen: isCommentModalOpen,
|
|
40369
40438
|
onClose: handleCommentModalClose,
|
|
@@ -40388,7 +40457,7 @@ const TableBody = ({
|
|
|
40388
40457
|
onBlur: handleBlur,
|
|
40389
40458
|
onFocus: handleFocus
|
|
40390
40459
|
}), /*#__PURE__*/React__default["default"].createElement(CharacterCount, null, commentText.length, "/", commentTextLimit))));
|
|
40391
|
-
};
|
|
40460
|
+
});
|
|
40392
40461
|
TableBody.propTypes = {
|
|
40393
40462
|
columns: PropTypes.array.isRequired,
|
|
40394
40463
|
data: PropTypes.array.isRequired,
|
|
@@ -40405,10 +40474,14 @@ TableBody.propTypes = {
|
|
|
40405
40474
|
statuses: PropTypes.array,
|
|
40406
40475
|
onCommentSave: PropTypes.func,
|
|
40407
40476
|
commentTextLimit: PropTypes.number,
|
|
40477
|
+
expandable: PropTypes.bool,
|
|
40478
|
+
expandedRows: PropTypes.object,
|
|
40479
|
+
expandedContent: PropTypes.object,
|
|
40480
|
+
onExpandRow: PropTypes.func,
|
|
40481
|
+
expandedBackgroundColor: PropTypes.string,
|
|
40408
40482
|
onDropdownSelected: PropTypes.func,
|
|
40409
40483
|
onCheckboxClick: PropTypes.func,
|
|
40410
|
-
onHeaderCheckboxClick: PropTypes.func
|
|
40411
|
-
ref: PropTypes.object
|
|
40484
|
+
onHeaderCheckboxClick: PropTypes.func
|
|
40412
40485
|
};
|
|
40413
40486
|
TableBody.displayName = "TableBody";
|
|
40414
40487
|
|
|
@@ -44825,6 +44898,15 @@ const SelectionTitle = styled__default["default"].span`
|
|
|
44825
44898
|
font-weight: 700;
|
|
44826
44899
|
line-height: normal;
|
|
44827
44900
|
`;
|
|
44901
|
+
const ErrorLabel = styled__default["default"].div`
|
|
44902
|
+
color: red;
|
|
44903
|
+
font-family: Poppins;
|
|
44904
|
+
font-size: 12px;
|
|
44905
|
+
height: 12px;
|
|
44906
|
+
font-style: normal;
|
|
44907
|
+
font-weight: 400;
|
|
44908
|
+
line-height: normal;
|
|
44909
|
+
`;
|
|
44828
44910
|
const BackTitle = styled__default["default"].span`
|
|
44829
44911
|
margin-left: 4px;
|
|
44830
44912
|
color: #212121;
|
|
@@ -44962,19 +45044,26 @@ const NewSubitem = ({
|
|
|
44962
45044
|
vendor,
|
|
44963
45045
|
onBack,
|
|
44964
45046
|
addNewPackage,
|
|
45047
|
+
updateExistingPackage,
|
|
44965
45048
|
componentText = "Scale"
|
|
44966
45049
|
}) => {
|
|
44967
45050
|
const [negotiatedBrands, setNegotiatedBrands] = React$1.useState("");
|
|
44968
45051
|
const [negotiatedComponent, setNegotiatedComponent] = React$1.useState(componentText);
|
|
44969
|
-
|
|
45052
|
+
const [isPackageDuplicated, setIsPackageDuplicated] = React$1.useState(false);
|
|
44970
45053
|
// Form state
|
|
44971
|
-
const isApplyEnabled = negotiatedBrands.trim().length > 2;
|
|
45054
|
+
const [isApplyEnabled, setIsApplyEnabled] = React$1.useState(negotiatedBrands.trim().length > 2);
|
|
44972
45055
|
React$1.useEffect(() => {
|
|
45056
|
+
console.log("packageObject", vendor);
|
|
44973
45057
|
if (!packageObject) return;
|
|
44974
45058
|
if (!packageObject.brands) return;
|
|
44975
45059
|
setNegotiatedBrands(packageObject.brands);
|
|
44976
45060
|
setNegotiatedComponent(packageObject.component);
|
|
44977
45061
|
}, [packageObject]);
|
|
45062
|
+
React$1.useEffect(() => {
|
|
45063
|
+
if (packageObject && packageObject.brands === negotiatedBrands) return;
|
|
45064
|
+
setIsPackageDuplicated(vendor.packages.some(pkg => pkg.brands === negotiatedBrands));
|
|
45065
|
+
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages.some(pkg => pkg.brands === negotiatedBrands) === false);
|
|
45066
|
+
}, [negotiatedBrands]);
|
|
44978
45067
|
return /*#__PURE__*/React__default["default"].createElement(NewSubitemContainer, null, /*#__PURE__*/React__default["default"].createElement(Header, null, /*#__PURE__*/React__default["default"].createElement(BackButton, {
|
|
44979
45068
|
onClick: onBack
|
|
44980
45069
|
}, /*#__PURE__*/React__default["default"].createElement(ArrowLeftIcon, null)), /*#__PURE__*/React__default["default"].createElement(BackTitle, null, vendor.name)), /*#__PURE__*/React__default["default"].createElement(SelectionTitle, null, "Add Package"), /*#__PURE__*/React__default["default"].createElement(ButtonsContainer, null, /*#__PURE__*/React__default["default"].createElement(Button$1, {
|
|
@@ -44992,7 +45081,11 @@ const NewSubitem = ({
|
|
|
44992
45081
|
}), /*#__PURE__*/React__default["default"].createElement(Button$1, {
|
|
44993
45082
|
leftIcon: "none",
|
|
44994
45083
|
onClick: () => {
|
|
44995
|
-
|
|
45084
|
+
if (packageObject) {
|
|
45085
|
+
updateExistingPackage(vendor.name, packageObject, negotiatedBrands, negotiatedComponent);
|
|
45086
|
+
} else {
|
|
45087
|
+
addNewPackage(vendor.name, negotiatedBrands, negotiatedComponent);
|
|
45088
|
+
}
|
|
44996
45089
|
},
|
|
44997
45090
|
rightIcon: "none",
|
|
44998
45091
|
size: "small",
|
|
@@ -45013,7 +45106,7 @@ const NewSubitem = ({
|
|
|
45013
45106
|
onChange: e => setNegotiatedBrands(e.target.value),
|
|
45014
45107
|
required: true,
|
|
45015
45108
|
placeholder: "Specify by text the participated brands, divided by commas"
|
|
45016
|
-
})), /*#__PURE__*/React__default["default"].createElement(NegotiatedContainer, null, /*#__PURE__*/React__default["default"].createElement(AddNegotiatedBrand, null, "Component ", /*#__PURE__*/React__default["default"].createElement("span", {
|
|
45109
|
+
}), isPackageDuplicated ? /*#__PURE__*/React__default["default"].createElement(ErrorLabel, null, "Package already exists for that vendor, Please enter a unique package.") : /*#__PURE__*/React__default["default"].createElement(ErrorLabel, null)), /*#__PURE__*/React__default["default"].createElement(NegotiatedContainer, null, /*#__PURE__*/React__default["default"].createElement(AddNegotiatedBrand, null, "Component ", /*#__PURE__*/React__default["default"].createElement("span", {
|
|
45017
45110
|
style: {
|
|
45018
45111
|
color: "red"
|
|
45019
45112
|
}
|
|
@@ -53697,10 +53790,6 @@ const ItemManagerPanel = _ref => {
|
|
|
53697
53790
|
const [trashIsHovered, setTrashIsHovered] = React$1.useState(false);
|
|
53698
53791
|
const [headerHeight, setHeaderHeight] = React$1.useState(0);
|
|
53699
53792
|
const headerRef = React$1.useRef(null);
|
|
53700
|
-
React$1.useEffect(() => {
|
|
53701
|
-
console.log("Screen changed to:", screen);
|
|
53702
|
-
console.log("Selected Vendor:", selectedVendor);
|
|
53703
|
-
}, [screen, selectedVendor]);
|
|
53704
53793
|
React$1.useEffect(() => {
|
|
53705
53794
|
if (headerRef.current) {
|
|
53706
53795
|
setHeaderHeight(headerRef.current.offsetHeight);
|