sag_components 2.0.0-beta189 → 2.0.0-beta190
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 +241 -168
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +240 -167
- 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
|
@@ -39788,9 +39788,9 @@ const ChromeShimmerText = ({
|
|
|
39788
39788
|
};
|
|
39789
39789
|
|
|
39790
39790
|
// TableBody.jsx
|
|
39791
|
-
const TableBody = ({
|
|
39792
|
-
columns,
|
|
39793
|
-
data,
|
|
39791
|
+
const TableBody = /*#__PURE__*/React$1.forwardRef(({
|
|
39792
|
+
columns = [],
|
|
39793
|
+
data = [],
|
|
39794
39794
|
onRowClick,
|
|
39795
39795
|
onSendClick,
|
|
39796
39796
|
buttonColor,
|
|
@@ -39824,9 +39824,8 @@ const TableBody = ({
|
|
|
39824
39824
|
// New prop with default
|
|
39825
39825
|
onDropdownSelected = () => {},
|
|
39826
39826
|
onCheckboxClick = () => {},
|
|
39827
|
-
onHeaderCheckboxClick = () => {}
|
|
39828
|
-
|
|
39829
|
-
}) => {
|
|
39827
|
+
onHeaderCheckboxClick = () => {}
|
|
39828
|
+
}, ref) => {
|
|
39830
39829
|
const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
|
|
39831
39830
|
const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
|
|
39832
39831
|
const [isCommentModalOpen, setIsCommentModalOpen] = React$1.useState(false);
|
|
@@ -39838,8 +39837,14 @@ const TableBody = ({
|
|
|
39838
39837
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
39839
39838
|
const [hasUserInteracted, setHasUserInteracted] = React$1.useState(false);
|
|
39840
39839
|
const [hasInitialValue, setHasInitialValue] = React$1.useState(false);
|
|
39840
|
+
|
|
39841
|
+
// Early return for invalid data
|
|
39842
|
+
if (!Array.isArray(data) || !Array.isArray(columns)) {
|
|
39843
|
+
console.warn("TableBody: Invalid data or columns prop");
|
|
39844
|
+
return null;
|
|
39845
|
+
}
|
|
39841
39846
|
React$1.useEffect(() => {
|
|
39842
|
-
if (isCommentModalOpen && currentCommentRow !== null) {
|
|
39847
|
+
if (isCommentModalOpen && currentCommentRow !== null && data[currentCommentRow]) {
|
|
39843
39848
|
const initialText = data[currentCommentRow]?.Comments || "";
|
|
39844
39849
|
setCommentText(initialText);
|
|
39845
39850
|
setHasInitialValue(Boolean(initialText.trim()));
|
|
@@ -39852,7 +39857,7 @@ const TableBody = ({
|
|
|
39852
39857
|
}
|
|
39853
39858
|
}, [resetFocusIndex]);
|
|
39854
39859
|
React$1.useEffect(() => {
|
|
39855
|
-
if (changeFocusIndex) {
|
|
39860
|
+
if (changeFocusIndex !== undefined && changeFocusIndex !== null) {
|
|
39856
39861
|
setFocusedRowIndex(changeFocusIndex);
|
|
39857
39862
|
}
|
|
39858
39863
|
}, [changeFocusIndex]);
|
|
@@ -39904,41 +39909,46 @@ const TableBody = ({
|
|
|
39904
39909
|
|
|
39905
39910
|
// Helper function to format tag text
|
|
39906
39911
|
const formatTagText = tag => {
|
|
39907
|
-
if (typeof tag !== "string") return tag;
|
|
39912
|
+
if (typeof tag !== "string") return String(tag || "");
|
|
39908
39913
|
return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
|
|
39909
39914
|
};
|
|
39910
39915
|
const formatValue = (value, column, row, rowIndex) => {
|
|
39911
|
-
if ((value === null || value === undefined) && column
|
|
39916
|
+
if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
|
|
39912
39917
|
return "";
|
|
39913
39918
|
}
|
|
39914
39919
|
|
|
39915
39920
|
// Find the tooltip text for the current value - can be used for different fieldTypes
|
|
39916
39921
|
const getTooltipText = value => {
|
|
39917
|
-
if (column
|
|
39922
|
+
if (column?.tooltipText && Array.isArray(column.tooltipText)) {
|
|
39918
39923
|
const tooltipItem = column.tooltipText.find(item => item.value === value);
|
|
39919
39924
|
return tooltipItem ? tooltipItem.label : null;
|
|
39920
39925
|
}
|
|
39921
39926
|
return null;
|
|
39922
39927
|
};
|
|
39923
|
-
switch (column
|
|
39928
|
+
switch (column?.fieldType?.toLowerCase()) {
|
|
39924
39929
|
case "currency":
|
|
39925
39930
|
if (column.format === "$0.00") {
|
|
39926
|
-
return `$${parseFloat(value).toFixed(2)}`;
|
|
39931
|
+
return `$${parseFloat(value || 0).toFixed(2)}`;
|
|
39927
39932
|
}
|
|
39928
39933
|
return value;
|
|
39929
39934
|
case "text":
|
|
39930
39935
|
return value?.toString() || "";
|
|
39931
39936
|
case "number":
|
|
39932
39937
|
if (column.format && column.format.includes(",")) {
|
|
39933
|
-
return value.toLocaleString();
|
|
39938
|
+
return (value || 0).toLocaleString();
|
|
39934
39939
|
}
|
|
39935
39940
|
return value;
|
|
39936
39941
|
case "percentage":
|
|
39937
|
-
return `${value}%`;
|
|
39942
|
+
return `${value || 0}%`;
|
|
39938
39943
|
case "date":
|
|
39939
|
-
if (column.format === "MM/DD/YYYY") {
|
|
39940
|
-
|
|
39941
|
-
|
|
39944
|
+
if (column.format === "MM/DD/YYYY" && value) {
|
|
39945
|
+
try {
|
|
39946
|
+
const date = new Date(value);
|
|
39947
|
+
return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
|
|
39948
|
+
} catch (e) {
|
|
39949
|
+
console.warn("Invalid date format:", value);
|
|
39950
|
+
return value;
|
|
39951
|
+
}
|
|
39942
39952
|
}
|
|
39943
39953
|
return value;
|
|
39944
39954
|
case "boolean":
|
|
@@ -39997,17 +40007,21 @@ const TableBody = ({
|
|
|
39997
40007
|
// Helper function to apply tooltip logic
|
|
39998
40008
|
const applyTooltipLogic = (element, tooltipText) => {
|
|
39999
40009
|
if (element && tooltipText && tooltipText.trim() !== "") {
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
|
|
40003
|
-
|
|
40004
|
-
|
|
40005
|
-
|
|
40006
|
-
|
|
40007
|
-
|
|
40008
|
-
|
|
40009
|
-
|
|
40010
|
-
|
|
40010
|
+
try {
|
|
40011
|
+
const rect = element.getBoundingClientRect();
|
|
40012
|
+
const {
|
|
40013
|
+
offset,
|
|
40014
|
+
height
|
|
40015
|
+
} = calculateTooltipOffset(tooltipText);
|
|
40016
|
+
element.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40017
|
+
element.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40018
|
+
element.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40019
|
+
element.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40020
|
+
element.style.setProperty("--tooltip-height", `${height}px`);
|
|
40021
|
+
element.setAttribute("data-tooltip", tooltipText);
|
|
40022
|
+
} catch (e) {
|
|
40023
|
+
console.warn("Error applying tooltip:", e);
|
|
40024
|
+
}
|
|
40011
40025
|
}
|
|
40012
40026
|
};
|
|
40013
40027
|
const tooltipText = getTooltipText(value);
|
|
@@ -40065,7 +40079,7 @@ const TableBody = ({
|
|
|
40065
40079
|
return value;
|
|
40066
40080
|
case "status":
|
|
40067
40081
|
const statusObj = statuses.find(status => status.status === value) || {};
|
|
40068
|
-
const [palette0, palette1] = statusObj.palette;
|
|
40082
|
+
const [palette0, palette1] = statusObj.palette || ["#F3F4F6", "#374151"];
|
|
40069
40083
|
return /*#__PURE__*/React__default["default"].createElement(StatusCell$1, {
|
|
40070
40084
|
color: palette1
|
|
40071
40085
|
}, /*#__PURE__*/React__default["default"].createElement(StatusCellCircle, {
|
|
@@ -40081,27 +40095,31 @@ const TableBody = ({
|
|
|
40081
40095
|
$buttonColor: buttonColor,
|
|
40082
40096
|
ref: el => {
|
|
40083
40097
|
if (el) {
|
|
40084
|
-
|
|
40085
|
-
|
|
40086
|
-
|
|
40087
|
-
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40092
|
-
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40099
|
-
|
|
40100
|
-
|
|
40101
|
-
|
|
40102
|
-
|
|
40103
|
-
|
|
40104
|
-
|
|
40098
|
+
try {
|
|
40099
|
+
if (hasComments) {
|
|
40100
|
+
// Add tooltip if there are comments
|
|
40101
|
+
const rect = el.getBoundingClientRect();
|
|
40102
|
+
const {
|
|
40103
|
+
offset,
|
|
40104
|
+
height
|
|
40105
|
+
} = calculateTooltipOffset(commentTooltipText);
|
|
40106
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40107
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40108
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40109
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40110
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40111
|
+
el.setAttribute("data-tooltip", commentTooltipText);
|
|
40112
|
+
} else {
|
|
40113
|
+
// Remove tooltip if there are no comments
|
|
40114
|
+
el.removeAttribute("data-tooltip");
|
|
40115
|
+
el.style.removeProperty("--tooltip-top");
|
|
40116
|
+
el.style.removeProperty("--tooltip-left");
|
|
40117
|
+
el.style.removeProperty("--tooltip-width");
|
|
40118
|
+
el.style.removeProperty("--tooltip-offset");
|
|
40119
|
+
el.style.removeProperty("--tooltip-height");
|
|
40120
|
+
}
|
|
40121
|
+
} catch (e) {
|
|
40122
|
+
console.warn("Error handling comment tooltip:", e);
|
|
40105
40123
|
}
|
|
40106
40124
|
}
|
|
40107
40125
|
},
|
|
@@ -40125,17 +40143,21 @@ const TableBody = ({
|
|
|
40125
40143
|
$buttonColor: buttonColor,
|
|
40126
40144
|
ref: el => {
|
|
40127
40145
|
if (el && trashTooltipText) {
|
|
40128
|
-
|
|
40129
|
-
|
|
40130
|
-
|
|
40131
|
-
|
|
40132
|
-
|
|
40133
|
-
|
|
40134
|
-
|
|
40135
|
-
|
|
40136
|
-
|
|
40137
|
-
|
|
40138
|
-
|
|
40146
|
+
try {
|
|
40147
|
+
const rect = el.getBoundingClientRect();
|
|
40148
|
+
const {
|
|
40149
|
+
offset,
|
|
40150
|
+
height
|
|
40151
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40152
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40153
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40154
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40155
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40156
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40157
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40158
|
+
} catch (e) {
|
|
40159
|
+
console.warn("Error handling trash tooltip:", e);
|
|
40160
|
+
}
|
|
40139
40161
|
}
|
|
40140
40162
|
},
|
|
40141
40163
|
onClick: e => {
|
|
@@ -40150,17 +40172,21 @@ const TableBody = ({
|
|
|
40150
40172
|
return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
|
|
40151
40173
|
ref: el => {
|
|
40152
40174
|
if (el && trashTooltipText) {
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
|
|
40156
|
-
|
|
40157
|
-
|
|
40158
|
-
|
|
40159
|
-
|
|
40160
|
-
|
|
40161
|
-
|
|
40162
|
-
|
|
40163
|
-
|
|
40175
|
+
try {
|
|
40176
|
+
const rect = el.getBoundingClientRect();
|
|
40177
|
+
const {
|
|
40178
|
+
offset,
|
|
40179
|
+
height
|
|
40180
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40181
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40182
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40183
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40184
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40185
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40186
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40187
|
+
} catch (e) {
|
|
40188
|
+
console.warn("Error handling disabled trash tooltip:", e);
|
|
40189
|
+
}
|
|
40164
40190
|
}
|
|
40165
40191
|
}
|
|
40166
40192
|
}, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
|
|
@@ -40170,13 +40196,14 @@ const TableBody = ({
|
|
|
40170
40196
|
}
|
|
40171
40197
|
return null;
|
|
40172
40198
|
case "dropdown":
|
|
40199
|
+
if (!column) return null;
|
|
40173
40200
|
const dropdownKey = `${rowIndex}-${column.key}`;
|
|
40174
40201
|
const isOpen = openDropdowns[dropdownKey] || false;
|
|
40175
40202
|
const dropdownOptions = column.dropdownOptions || [];
|
|
40176
40203
|
const maxDropdownHeight = column.maxDropdownHeight || "200px";
|
|
40177
|
-
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40178
|
-
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40179
|
-
const placeholder = column.placeholder || "Select...";
|
|
40204
|
+
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40205
|
+
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40206
|
+
const placeholder = column.placeholder || "Select...";
|
|
40180
40207
|
|
|
40181
40208
|
// Find the current selected option to display its label
|
|
40182
40209
|
const currentOption = dropdownOptions.find(option => option.value === value);
|
|
@@ -40197,8 +40224,7 @@ const TableBody = ({
|
|
|
40197
40224
|
selectedColor: selectedColor
|
|
40198
40225
|
});
|
|
40199
40226
|
case "checkbox":
|
|
40200
|
-
const isChecked = Boolean(value);
|
|
40201
|
-
|
|
40227
|
+
const isChecked = Boolean(value);
|
|
40202
40228
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
40203
40229
|
style: {
|
|
40204
40230
|
display: "flex",
|
|
@@ -40211,13 +40237,12 @@ const TableBody = ({
|
|
|
40211
40237
|
type: "checkbox",
|
|
40212
40238
|
checked: isChecked,
|
|
40213
40239
|
onChange: e => handleCheckboxClick(row, column.key, e),
|
|
40214
|
-
onClick: e => e.stopPropagation()
|
|
40215
|
-
,
|
|
40240
|
+
onClick: e => e.stopPropagation(),
|
|
40216
40241
|
style: {
|
|
40217
40242
|
width: "18px",
|
|
40218
40243
|
height: "18px",
|
|
40219
40244
|
cursor: "pointer",
|
|
40220
|
-
accentColor: buttonColor
|
|
40245
|
+
accentColor: buttonColor
|
|
40221
40246
|
}
|
|
40222
40247
|
}));
|
|
40223
40248
|
default:
|
|
@@ -40233,7 +40258,6 @@ const TableBody = ({
|
|
|
40233
40258
|
const handleExpandClick = (row, rowIndex, event) => {
|
|
40234
40259
|
event.stopPropagation();
|
|
40235
40260
|
if (onExpandRow) {
|
|
40236
|
-
// Determine the expand status based on current state
|
|
40237
40261
|
const expandStatus = expandedRows[rowIndex] ? "isClosed" : "isOpen";
|
|
40238
40262
|
onExpandRow(row, rowIndex, expandStatus);
|
|
40239
40263
|
}
|
|
@@ -40243,15 +40267,11 @@ const TableBody = ({
|
|
|
40243
40267
|
const handleCheckboxClick = (row, columnKey, event) => {
|
|
40244
40268
|
event.stopPropagation();
|
|
40245
40269
|
const currentValue = row[columnKey];
|
|
40246
|
-
const newValue = !currentValue;
|
|
40247
|
-
|
|
40248
|
-
// Create updated row with new checkbox value
|
|
40270
|
+
const newValue = !currentValue;
|
|
40249
40271
|
const updatedRow = {
|
|
40250
40272
|
...row,
|
|
40251
40273
|
[columnKey]: newValue
|
|
40252
40274
|
};
|
|
40253
|
-
|
|
40254
|
-
// Fire the onCheckboxClick event with updated row
|
|
40255
40275
|
if (onCheckboxClick) {
|
|
40256
40276
|
onCheckboxClick({
|
|
40257
40277
|
fullRow: updatedRow,
|
|
@@ -40275,14 +40295,10 @@ const TableBody = ({
|
|
|
40275
40295
|
const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
|
|
40276
40296
|
event.stopPropagation();
|
|
40277
40297
|
const dropdownKey = `${rowIndex}-${columnKey}`;
|
|
40278
|
-
|
|
40279
|
-
// Close the dropdown
|
|
40280
40298
|
setOpenDropdowns(prev => ({
|
|
40281
40299
|
...prev,
|
|
40282
40300
|
[dropdownKey]: false
|
|
40283
40301
|
}));
|
|
40284
|
-
|
|
40285
|
-
// Fire the onDropdownSelected event with columnKey instead of columnName
|
|
40286
40302
|
if (onDropdownSelected) {
|
|
40287
40303
|
onDropdownSelected(row, selectedOption, columnKey);
|
|
40288
40304
|
}
|
|
@@ -40298,72 +40314,109 @@ const TableBody = ({
|
|
|
40298
40314
|
document.removeEventListener("click", handleClickOutside);
|
|
40299
40315
|
};
|
|
40300
40316
|
}, []);
|
|
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
|
-
|
|
40317
|
+
|
|
40318
|
+
// Return null if no data
|
|
40319
|
+
if (data.length === 0) {
|
|
40320
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
|
|
40321
|
+
ref: ref
|
|
40322
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableRow, null, /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40323
|
+
colSpan: columns.length
|
|
40324
|
+
}, "No data available")));
|
|
40325
|
+
}
|
|
40326
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
|
|
40327
|
+
ref: ref
|
|
40328
|
+
}, data.map((row, rowIndex) => {
|
|
40329
|
+
// Skip invalid rows
|
|
40330
|
+
if (!row || typeof row !== 'object') {
|
|
40331
|
+
console.warn(`Invalid row at index ${rowIndex}:`, row);
|
|
40332
|
+
return null;
|
|
40333
|
+
}
|
|
40334
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
40335
|
+
key: row.id || `row-${rowIndex}`
|
|
40336
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableRow, {
|
|
40337
|
+
"data-row-index": rowIndex,
|
|
40338
|
+
className: indexToShimmer === rowIndex ? "shimmer-row" : "",
|
|
40339
|
+
isFocused: focusedRowIndex === rowIndex,
|
|
40340
|
+
selectedColor: selectedColor,
|
|
40341
|
+
onMouseEnter: () => setHoveredRowIndex(rowIndex),
|
|
40342
|
+
onMouseLeave: () => setHoveredRowIndex(null),
|
|
40343
|
+
onClick: () => handleRowClick(row, rowIndex)
|
|
40344
|
+
}, expandable && expandedContent[rowIndex] !== undefined && expandedContent[rowIndex] !== null ? /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40345
|
+
$fieldType: "expand",
|
|
40346
|
+
$minWidth: "16px",
|
|
40347
|
+
$maxWidth: "16px"
|
|
40348
|
+
}, /*#__PURE__*/React__default["default"].createElement(ExpandIcon, {
|
|
40349
|
+
onClick: e => handleExpandClick(row, rowIndex, e),
|
|
40350
|
+
$isExpanded: expandedRows[rowIndex] || false
|
|
40351
|
+
}, expandedRows[rowIndex] ? /*#__PURE__*/React__default["default"].createElement(MenuItemOpenIcon, {
|
|
40352
|
+
width: "12",
|
|
40353
|
+
height: "12",
|
|
40354
|
+
color: "#666"
|
|
40355
|
+
}) : /*#__PURE__*/React__default["default"].createElement(ChervronRightIcon, {
|
|
40356
|
+
width: "12",
|
|
40357
|
+
height: "12",
|
|
40358
|
+
fill: "#666"
|
|
40359
|
+
}))) : expandable === true ? /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40360
|
+
$fieldType: "expand",
|
|
40361
|
+
$minWidth: "16px",
|
|
40362
|
+
$maxWidth: "16px"
|
|
40363
|
+
}) : null, columns.map((column, columnIndex) => {
|
|
40364
|
+
if (!column || !column.key) {
|
|
40365
|
+
console.warn(`Invalid column at index ${columnIndex}:`, column);
|
|
40366
|
+
return null;
|
|
40367
|
+
}
|
|
40368
|
+
const value = row[column.key];
|
|
40369
|
+
const formattedValue = formatValue(value, column, row, rowIndex);
|
|
40370
|
+
|
|
40371
|
+
// Use the chrome shimmer hook safely
|
|
40372
|
+
let shimmerText = formattedValue;
|
|
40373
|
+
let isShimmering = false;
|
|
40374
|
+
try {
|
|
40375
|
+
const shimmerResult = useShimmerChromeEffect(formattedValue, rowIndex, indexToShimmer, columnIndex, columns.length);
|
|
40376
|
+
if (shimmerResult) {
|
|
40377
|
+
shimmerText = shimmerResult.text || formattedValue;
|
|
40378
|
+
isShimmering = shimmerResult.isShimmering || false;
|
|
40350
40379
|
}
|
|
40351
|
-
}
|
|
40352
|
-
|
|
40353
|
-
|
|
40354
|
-
|
|
40355
|
-
|
|
40356
|
-
|
|
40357
|
-
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40361
|
-
|
|
40362
|
-
|
|
40363
|
-
|
|
40364
|
-
|
|
40365
|
-
|
|
40366
|
-
|
|
40380
|
+
} catch (e) {
|
|
40381
|
+
console.warn("Error with shimmer effect:", e);
|
|
40382
|
+
}
|
|
40383
|
+
return /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40384
|
+
key: `${column.key}-${rowIndex}`,
|
|
40385
|
+
ref: el => {
|
|
40386
|
+
if (el && shouldShowTooltip(el)) {
|
|
40387
|
+
try {
|
|
40388
|
+
const rect = el.getBoundingClientRect();
|
|
40389
|
+
const {
|
|
40390
|
+
offset,
|
|
40391
|
+
height
|
|
40392
|
+
} = calculateTooltipOffset(formattedValue.toString(), true);
|
|
40393
|
+
el.style.setProperty("--cell-top", `${rect.top}px`);
|
|
40394
|
+
el.style.setProperty("--cell-left", `${rect.left}px`);
|
|
40395
|
+
el.style.setProperty("--cell-width", `${rect.width}px`);
|
|
40396
|
+
el.style.setProperty("--cell-offset", `${offset}px`);
|
|
40397
|
+
el.style.setProperty("--cell-height", `${height}px`);
|
|
40398
|
+
el.setAttribute("data-tooltip", formattedValue);
|
|
40399
|
+
} catch (e) {
|
|
40400
|
+
console.warn("Error setting cell tooltip:", e);
|
|
40401
|
+
}
|
|
40402
|
+
}
|
|
40403
|
+
},
|
|
40404
|
+
$fieldType: column.fieldType?.toLowerCase(),
|
|
40405
|
+
$color: column.color,
|
|
40406
|
+
$minWidth: column.minWidth,
|
|
40407
|
+
$maxWidth: column.maxWidth
|
|
40408
|
+
}, 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, {
|
|
40409
|
+
text: shimmerText,
|
|
40410
|
+
isShimmering: isShimmering
|
|
40411
|
+
}) : formattedValue);
|
|
40412
|
+
})), expandable && expandedRows[rowIndex] && /*#__PURE__*/React__default["default"].createElement(ExpandedRow, {
|
|
40413
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40414
|
+
}, /*#__PURE__*/React__default["default"].createElement(TableCell, {
|
|
40415
|
+
colSpan: columns.length + 1
|
|
40416
|
+
}, /*#__PURE__*/React__default["default"].createElement(ExpandedContent, {
|
|
40417
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40418
|
+
}, expandedContent[rowIndex] || null))));
|
|
40419
|
+
})), /*#__PURE__*/React__default["default"].createElement(MessageBox, {
|
|
40367
40420
|
title: "Add Comment",
|
|
40368
40421
|
isOpen: isCommentModalOpen,
|
|
40369
40422
|
onClose: handleCommentModalClose,
|
|
@@ -40388,7 +40441,7 @@ const TableBody = ({
|
|
|
40388
40441
|
onBlur: handleBlur,
|
|
40389
40442
|
onFocus: handleFocus
|
|
40390
40443
|
}), /*#__PURE__*/React__default["default"].createElement(CharacterCount, null, commentText.length, "/", commentTextLimit))));
|
|
40391
|
-
};
|
|
40444
|
+
});
|
|
40392
40445
|
TableBody.propTypes = {
|
|
40393
40446
|
columns: PropTypes.array.isRequired,
|
|
40394
40447
|
data: PropTypes.array.isRequired,
|
|
@@ -40405,10 +40458,14 @@ TableBody.propTypes = {
|
|
|
40405
40458
|
statuses: PropTypes.array,
|
|
40406
40459
|
onCommentSave: PropTypes.func,
|
|
40407
40460
|
commentTextLimit: PropTypes.number,
|
|
40461
|
+
expandable: PropTypes.bool,
|
|
40462
|
+
expandedRows: PropTypes.object,
|
|
40463
|
+
expandedContent: PropTypes.object,
|
|
40464
|
+
onExpandRow: PropTypes.func,
|
|
40465
|
+
expandedBackgroundColor: PropTypes.string,
|
|
40408
40466
|
onDropdownSelected: PropTypes.func,
|
|
40409
40467
|
onCheckboxClick: PropTypes.func,
|
|
40410
|
-
onHeaderCheckboxClick: PropTypes.func
|
|
40411
|
-
ref: PropTypes.object
|
|
40468
|
+
onHeaderCheckboxClick: PropTypes.func
|
|
40412
40469
|
};
|
|
40413
40470
|
TableBody.displayName = "TableBody";
|
|
40414
40471
|
|
|
@@ -44825,6 +44882,15 @@ const SelectionTitle = styled__default["default"].span`
|
|
|
44825
44882
|
font-weight: 700;
|
|
44826
44883
|
line-height: normal;
|
|
44827
44884
|
`;
|
|
44885
|
+
const ErrorLabel = styled__default["default"].div`
|
|
44886
|
+
color: red;
|
|
44887
|
+
font-family: Poppins;
|
|
44888
|
+
font-size: 12px;
|
|
44889
|
+
height: 12px;
|
|
44890
|
+
font-style: normal;
|
|
44891
|
+
font-weight: 400;
|
|
44892
|
+
line-height: normal;
|
|
44893
|
+
`;
|
|
44828
44894
|
const BackTitle = styled__default["default"].span`
|
|
44829
44895
|
margin-left: 4px;
|
|
44830
44896
|
color: #212121;
|
|
@@ -44962,19 +45028,26 @@ const NewSubitem = ({
|
|
|
44962
45028
|
vendor,
|
|
44963
45029
|
onBack,
|
|
44964
45030
|
addNewPackage,
|
|
45031
|
+
updateExistingPackage,
|
|
44965
45032
|
componentText = "Scale"
|
|
44966
45033
|
}) => {
|
|
44967
45034
|
const [negotiatedBrands, setNegotiatedBrands] = React$1.useState("");
|
|
44968
45035
|
const [negotiatedComponent, setNegotiatedComponent] = React$1.useState(componentText);
|
|
44969
|
-
|
|
45036
|
+
const [isPackageDuplicated, setIsPackageDuplicated] = React$1.useState(false);
|
|
44970
45037
|
// Form state
|
|
44971
|
-
const isApplyEnabled = negotiatedBrands.trim().length > 2;
|
|
45038
|
+
const [isApplyEnabled, setIsApplyEnabled] = React$1.useState(negotiatedBrands.trim().length > 2);
|
|
44972
45039
|
React$1.useEffect(() => {
|
|
45040
|
+
console.log("packageObject", vendor);
|
|
44973
45041
|
if (!packageObject) return;
|
|
44974
45042
|
if (!packageObject.brands) return;
|
|
44975
45043
|
setNegotiatedBrands(packageObject.brands);
|
|
44976
45044
|
setNegotiatedComponent(packageObject.component);
|
|
44977
45045
|
}, [packageObject]);
|
|
45046
|
+
React$1.useEffect(() => {
|
|
45047
|
+
if (packageObject && packageObject.brands === negotiatedBrands) return;
|
|
45048
|
+
setIsPackageDuplicated(vendor.packages.some(pkg => pkg.brands === negotiatedBrands));
|
|
45049
|
+
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages.some(pkg => pkg.brands === negotiatedBrands) === false);
|
|
45050
|
+
}, [negotiatedBrands]);
|
|
44978
45051
|
return /*#__PURE__*/React__default["default"].createElement(NewSubitemContainer, null, /*#__PURE__*/React__default["default"].createElement(Header, null, /*#__PURE__*/React__default["default"].createElement(BackButton, {
|
|
44979
45052
|
onClick: onBack
|
|
44980
45053
|
}, /*#__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 +45065,11 @@ const NewSubitem = ({
|
|
|
44992
45065
|
}), /*#__PURE__*/React__default["default"].createElement(Button$1, {
|
|
44993
45066
|
leftIcon: "none",
|
|
44994
45067
|
onClick: () => {
|
|
44995
|
-
|
|
45068
|
+
if (packageObject) {
|
|
45069
|
+
updateExistingPackage(vendor.name, packageObject, negotiatedBrands, negotiatedComponent);
|
|
45070
|
+
} else {
|
|
45071
|
+
addNewPackage(vendor.name, negotiatedBrands, negotiatedComponent);
|
|
45072
|
+
}
|
|
44996
45073
|
},
|
|
44997
45074
|
rightIcon: "none",
|
|
44998
45075
|
size: "small",
|
|
@@ -45013,7 +45090,7 @@ const NewSubitem = ({
|
|
|
45013
45090
|
onChange: e => setNegotiatedBrands(e.target.value),
|
|
45014
45091
|
required: true,
|
|
45015
45092
|
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", {
|
|
45093
|
+
}), 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
45094
|
style: {
|
|
45018
45095
|
color: "red"
|
|
45019
45096
|
}
|
|
@@ -53697,10 +53774,6 @@ const ItemManagerPanel = _ref => {
|
|
|
53697
53774
|
const [trashIsHovered, setTrashIsHovered] = React$1.useState(false);
|
|
53698
53775
|
const [headerHeight, setHeaderHeight] = React$1.useState(0);
|
|
53699
53776
|
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
53777
|
React$1.useEffect(() => {
|
|
53705
53778
|
if (headerRef.current) {
|
|
53706
53779
|
setHeaderHeight(headerRef.current.offsetHeight);
|