sag_components 2.0.0-beta188 → 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 +309 -240
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +308 -239
- 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.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1, { useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
|
|
1
|
+
import React$1, { useState, useRef, useEffect, useMemo, useCallback, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import styled, { keyframes, css, styled as styled$1 } from 'styled-components';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip as Tooltip$3, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Bar, LabelList, ReferenceLine, LineChart, Line, AreaChart as AreaChart$1, Legend, Area, ScatterChart, ZAxis, Scatter, Brush, ComposedChart } from 'recharts';
|
|
@@ -10579,24 +10579,23 @@ const QuarterPopupPicker = ({
|
|
|
10579
10579
|
};
|
|
10580
10580
|
|
|
10581
10581
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10582
|
-
const QuarterPicker =
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
} = _ref;
|
|
10582
|
+
const QuarterPicker = ({
|
|
10583
|
+
availableQuarters,
|
|
10584
|
+
// ["Q1-2024"]
|
|
10585
|
+
label,
|
|
10586
|
+
onChange,
|
|
10587
|
+
borderRadius,
|
|
10588
|
+
required,
|
|
10589
|
+
width,
|
|
10590
|
+
height,
|
|
10591
|
+
placeholder,
|
|
10592
|
+
disabled,
|
|
10593
|
+
borderColor,
|
|
10594
|
+
borderColorFocus,
|
|
10595
|
+
textColor,
|
|
10596
|
+
selectedValue,
|
|
10597
|
+
startYear
|
|
10598
|
+
}) => {
|
|
10600
10599
|
const [isFocused, setIsFocused] = useState(false);
|
|
10601
10600
|
const [isOpen, setIsOpen] = useState(false);
|
|
10602
10601
|
const [value, setValue] = useState('');
|
|
@@ -11038,23 +11037,22 @@ const MonthPopupPicker = ({
|
|
|
11038
11037
|
};
|
|
11039
11038
|
|
|
11040
11039
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
11041
|
-
const MonthPicker =
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
} = _ref;
|
|
11040
|
+
const MonthPicker = ({
|
|
11041
|
+
availableMonths,
|
|
11042
|
+
label,
|
|
11043
|
+
onChange,
|
|
11044
|
+
borderRadius,
|
|
11045
|
+
required,
|
|
11046
|
+
width,
|
|
11047
|
+
height,
|
|
11048
|
+
placeholder,
|
|
11049
|
+
disabled,
|
|
11050
|
+
borderColor,
|
|
11051
|
+
borderColorFocus,
|
|
11052
|
+
textColor,
|
|
11053
|
+
selectedValue,
|
|
11054
|
+
startYear
|
|
11055
|
+
}) => {
|
|
11058
11056
|
const [isFocused, setIsFocused] = useState(false);
|
|
11059
11057
|
const [isOpen, setIsOpen] = useState(false);
|
|
11060
11058
|
const [value, setValue] = useState('');
|
|
@@ -24165,22 +24163,21 @@ const DeleteIcon = styled.div`
|
|
|
24165
24163
|
position: absolute;
|
|
24166
24164
|
`;
|
|
24167
24165
|
|
|
24168
|
-
const QuickFilterDropdownSingle =
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
24177
|
-
|
|
24178
|
-
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
} = _ref;
|
|
24166
|
+
const QuickFilterDropdownSingle = ({
|
|
24167
|
+
label,
|
|
24168
|
+
hoverColor,
|
|
24169
|
+
options,
|
|
24170
|
+
selectedValue,
|
|
24171
|
+
placeHolder,
|
|
24172
|
+
onChange,
|
|
24173
|
+
disabled,
|
|
24174
|
+
width,
|
|
24175
|
+
error,
|
|
24176
|
+
errorMessage,
|
|
24177
|
+
xIconShow,
|
|
24178
|
+
labelColor,
|
|
24179
|
+
showLabelOnTop
|
|
24180
|
+
}) => {
|
|
24184
24181
|
const [isFocused, setIsFocused] = useState(false);
|
|
24185
24182
|
const [showOptions, setShowOptions] = useState(false);
|
|
24186
24183
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -24577,24 +24574,23 @@ const IconContainer$2 = styled.div`
|
|
|
24577
24574
|
cursor: pointer;
|
|
24578
24575
|
`;
|
|
24579
24576
|
|
|
24580
|
-
const QuickFilterDropdownMultiSelection =
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
} = _ref;
|
|
24577
|
+
const QuickFilterDropdownMultiSelection = ({
|
|
24578
|
+
label,
|
|
24579
|
+
labelEmptyValue,
|
|
24580
|
+
options,
|
|
24581
|
+
selectedValue,
|
|
24582
|
+
placeHolder,
|
|
24583
|
+
onChange,
|
|
24584
|
+
required,
|
|
24585
|
+
disabled,
|
|
24586
|
+
width,
|
|
24587
|
+
error,
|
|
24588
|
+
errorMessage,
|
|
24589
|
+
labelColor,
|
|
24590
|
+
xIconShow,
|
|
24591
|
+
checkBoxColor,
|
|
24592
|
+
showLabelOnTop
|
|
24593
|
+
}) => {
|
|
24598
24594
|
const [isFocused, setIsFocused] = useState(false);
|
|
24599
24595
|
const [showOptions, setShowOptions] = useState(false);
|
|
24600
24596
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -39742,11 +39738,11 @@ const ChromeShimmerText = ({
|
|
|
39742
39738
|
transition: 'all 0.3s ease'
|
|
39743
39739
|
};
|
|
39744
39740
|
if (!isShimmering) {
|
|
39745
|
-
return /*#__PURE__*/React.createElement("span", null, text);
|
|
39741
|
+
return /*#__PURE__*/React$1.createElement("span", null, text);
|
|
39746
39742
|
}
|
|
39747
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
39743
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("span", {
|
|
39748
39744
|
style: shimmerStyle
|
|
39749
|
-
}, text), /*#__PURE__*/React.createElement("style", {
|
|
39745
|
+
}, text), /*#__PURE__*/React$1.createElement("style", {
|
|
39750
39746
|
jsx: true
|
|
39751
39747
|
}, `
|
|
39752
39748
|
@-webkit-keyframes chromeShine {
|
|
@@ -39782,9 +39778,9 @@ const ChromeShimmerText = ({
|
|
|
39782
39778
|
};
|
|
39783
39779
|
|
|
39784
39780
|
// TableBody.jsx
|
|
39785
|
-
const TableBody = ({
|
|
39786
|
-
columns,
|
|
39787
|
-
data,
|
|
39781
|
+
const TableBody = /*#__PURE__*/forwardRef(({
|
|
39782
|
+
columns = [],
|
|
39783
|
+
data = [],
|
|
39788
39784
|
onRowClick,
|
|
39789
39785
|
onSendClick,
|
|
39790
39786
|
buttonColor,
|
|
@@ -39818,9 +39814,8 @@ const TableBody = ({
|
|
|
39818
39814
|
// New prop with default
|
|
39819
39815
|
onDropdownSelected = () => {},
|
|
39820
39816
|
onCheckboxClick = () => {},
|
|
39821
|
-
onHeaderCheckboxClick = () => {}
|
|
39822
|
-
|
|
39823
|
-
}) => {
|
|
39817
|
+
onHeaderCheckboxClick = () => {}
|
|
39818
|
+
}, ref) => {
|
|
39824
39819
|
const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
|
|
39825
39820
|
const [focusedRowIndex, setFocusedRowIndex] = useState(null);
|
|
39826
39821
|
const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
|
|
@@ -39832,8 +39827,14 @@ const TableBody = ({
|
|
|
39832
39827
|
const [isFocused, setIsFocused] = useState(false);
|
|
39833
39828
|
const [hasUserInteracted, setHasUserInteracted] = useState(false);
|
|
39834
39829
|
const [hasInitialValue, setHasInitialValue] = useState(false);
|
|
39830
|
+
|
|
39831
|
+
// Early return for invalid data
|
|
39832
|
+
if (!Array.isArray(data) || !Array.isArray(columns)) {
|
|
39833
|
+
console.warn("TableBody: Invalid data or columns prop");
|
|
39834
|
+
return null;
|
|
39835
|
+
}
|
|
39835
39836
|
useEffect(() => {
|
|
39836
|
-
if (isCommentModalOpen && currentCommentRow !== null) {
|
|
39837
|
+
if (isCommentModalOpen && currentCommentRow !== null && data[currentCommentRow]) {
|
|
39837
39838
|
const initialText = data[currentCommentRow]?.Comments || "";
|
|
39838
39839
|
setCommentText(initialText);
|
|
39839
39840
|
setHasInitialValue(Boolean(initialText.trim()));
|
|
@@ -39846,7 +39847,7 @@ const TableBody = ({
|
|
|
39846
39847
|
}
|
|
39847
39848
|
}, [resetFocusIndex]);
|
|
39848
39849
|
useEffect(() => {
|
|
39849
|
-
if (changeFocusIndex) {
|
|
39850
|
+
if (changeFocusIndex !== undefined && changeFocusIndex !== null) {
|
|
39850
39851
|
setFocusedRowIndex(changeFocusIndex);
|
|
39851
39852
|
}
|
|
39852
39853
|
}, [changeFocusIndex]);
|
|
@@ -39898,41 +39899,46 @@ const TableBody = ({
|
|
|
39898
39899
|
|
|
39899
39900
|
// Helper function to format tag text
|
|
39900
39901
|
const formatTagText = tag => {
|
|
39901
|
-
if (typeof tag !== "string") return tag;
|
|
39902
|
+
if (typeof tag !== "string") return String(tag || "");
|
|
39902
39903
|
return tag.replace(/-/g, " ").replace(/\b\w/g, l => l.toUpperCase());
|
|
39903
39904
|
};
|
|
39904
39905
|
const formatValue = (value, column, row, rowIndex) => {
|
|
39905
|
-
if ((value === null || value === undefined) && column
|
|
39906
|
+
if ((value === null || value === undefined) && column?.fieldType?.toLowerCase() !== "comments") {
|
|
39906
39907
|
return "";
|
|
39907
39908
|
}
|
|
39908
39909
|
|
|
39909
39910
|
// Find the tooltip text for the current value - can be used for different fieldTypes
|
|
39910
39911
|
const getTooltipText = value => {
|
|
39911
|
-
if (column
|
|
39912
|
+
if (column?.tooltipText && Array.isArray(column.tooltipText)) {
|
|
39912
39913
|
const tooltipItem = column.tooltipText.find(item => item.value === value);
|
|
39913
39914
|
return tooltipItem ? tooltipItem.label : null;
|
|
39914
39915
|
}
|
|
39915
39916
|
return null;
|
|
39916
39917
|
};
|
|
39917
|
-
switch (column
|
|
39918
|
+
switch (column?.fieldType?.toLowerCase()) {
|
|
39918
39919
|
case "currency":
|
|
39919
39920
|
if (column.format === "$0.00") {
|
|
39920
|
-
return `$${parseFloat(value).toFixed(2)}`;
|
|
39921
|
+
return `$${parseFloat(value || 0).toFixed(2)}`;
|
|
39921
39922
|
}
|
|
39922
39923
|
return value;
|
|
39923
39924
|
case "text":
|
|
39924
39925
|
return value?.toString() || "";
|
|
39925
39926
|
case "number":
|
|
39926
39927
|
if (column.format && column.format.includes(",")) {
|
|
39927
|
-
return value.toLocaleString();
|
|
39928
|
+
return (value || 0).toLocaleString();
|
|
39928
39929
|
}
|
|
39929
39930
|
return value;
|
|
39930
39931
|
case "percentage":
|
|
39931
|
-
return `${value}%`;
|
|
39932
|
+
return `${value || 0}%`;
|
|
39932
39933
|
case "date":
|
|
39933
|
-
if (column.format === "MM/DD/YYYY") {
|
|
39934
|
-
|
|
39935
|
-
|
|
39934
|
+
if (column.format === "MM/DD/YYYY" && value) {
|
|
39935
|
+
try {
|
|
39936
|
+
const date = new Date(value);
|
|
39937
|
+
return `${(date.getMonth() + 1)?.toString().padStart(2, "0")}/${date.getDate()?.toString().padStart(2, "0")}/${date.getFullYear()}`;
|
|
39938
|
+
} catch (e) {
|
|
39939
|
+
console.warn("Invalid date format:", value);
|
|
39940
|
+
return value;
|
|
39941
|
+
}
|
|
39936
39942
|
}
|
|
39937
39943
|
return value;
|
|
39938
39944
|
case "boolean":
|
|
@@ -39991,17 +39997,21 @@ const TableBody = ({
|
|
|
39991
39997
|
// Helper function to apply tooltip logic
|
|
39992
39998
|
const applyTooltipLogic = (element, tooltipText) => {
|
|
39993
39999
|
if (element && tooltipText && tooltipText.trim() !== "") {
|
|
39994
|
-
|
|
39995
|
-
|
|
39996
|
-
|
|
39997
|
-
|
|
39998
|
-
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
|
|
40002
|
-
|
|
40003
|
-
|
|
40004
|
-
|
|
40000
|
+
try {
|
|
40001
|
+
const rect = element.getBoundingClientRect();
|
|
40002
|
+
const {
|
|
40003
|
+
offset,
|
|
40004
|
+
height
|
|
40005
|
+
} = calculateTooltipOffset(tooltipText);
|
|
40006
|
+
element.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40007
|
+
element.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40008
|
+
element.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40009
|
+
element.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40010
|
+
element.style.setProperty("--tooltip-height", `${height}px`);
|
|
40011
|
+
element.setAttribute("data-tooltip", tooltipText);
|
|
40012
|
+
} catch (e) {
|
|
40013
|
+
console.warn("Error applying tooltip:", e);
|
|
40014
|
+
}
|
|
40005
40015
|
}
|
|
40006
40016
|
};
|
|
40007
40017
|
const tooltipText = getTooltipText(value);
|
|
@@ -40059,7 +40069,7 @@ const TableBody = ({
|
|
|
40059
40069
|
return value;
|
|
40060
40070
|
case "status":
|
|
40061
40071
|
const statusObj = statuses.find(status => status.status === value) || {};
|
|
40062
|
-
const [palette0, palette1] = statusObj.palette;
|
|
40072
|
+
const [palette0, palette1] = statusObj.palette || ["#F3F4F6", "#374151"];
|
|
40063
40073
|
return /*#__PURE__*/React$1.createElement(StatusCell$1, {
|
|
40064
40074
|
color: palette1
|
|
40065
40075
|
}, /*#__PURE__*/React$1.createElement(StatusCellCircle, {
|
|
@@ -40075,27 +40085,31 @@ const TableBody = ({
|
|
|
40075
40085
|
$buttonColor: buttonColor,
|
|
40076
40086
|
ref: el => {
|
|
40077
40087
|
if (el) {
|
|
40078
|
-
|
|
40079
|
-
|
|
40080
|
-
|
|
40081
|
-
|
|
40082
|
-
|
|
40083
|
-
|
|
40084
|
-
|
|
40085
|
-
|
|
40086
|
-
|
|
40087
|
-
|
|
40088
|
-
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40092
|
-
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
|
|
40096
|
-
|
|
40097
|
-
|
|
40098
|
-
|
|
40088
|
+
try {
|
|
40089
|
+
if (hasComments) {
|
|
40090
|
+
// Add tooltip if there are comments
|
|
40091
|
+
const rect = el.getBoundingClientRect();
|
|
40092
|
+
const {
|
|
40093
|
+
offset,
|
|
40094
|
+
height
|
|
40095
|
+
} = calculateTooltipOffset(commentTooltipText);
|
|
40096
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40097
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40098
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40099
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40100
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40101
|
+
el.setAttribute("data-tooltip", commentTooltipText);
|
|
40102
|
+
} else {
|
|
40103
|
+
// Remove tooltip if there are no comments
|
|
40104
|
+
el.removeAttribute("data-tooltip");
|
|
40105
|
+
el.style.removeProperty("--tooltip-top");
|
|
40106
|
+
el.style.removeProperty("--tooltip-left");
|
|
40107
|
+
el.style.removeProperty("--tooltip-width");
|
|
40108
|
+
el.style.removeProperty("--tooltip-offset");
|
|
40109
|
+
el.style.removeProperty("--tooltip-height");
|
|
40110
|
+
}
|
|
40111
|
+
} catch (e) {
|
|
40112
|
+
console.warn("Error handling comment tooltip:", e);
|
|
40099
40113
|
}
|
|
40100
40114
|
}
|
|
40101
40115
|
},
|
|
@@ -40119,17 +40133,21 @@ const TableBody = ({
|
|
|
40119
40133
|
$buttonColor: buttonColor,
|
|
40120
40134
|
ref: el => {
|
|
40121
40135
|
if (el && trashTooltipText) {
|
|
40122
|
-
|
|
40123
|
-
|
|
40124
|
-
|
|
40125
|
-
|
|
40126
|
-
|
|
40127
|
-
|
|
40128
|
-
|
|
40129
|
-
|
|
40130
|
-
|
|
40131
|
-
|
|
40132
|
-
|
|
40136
|
+
try {
|
|
40137
|
+
const rect = el.getBoundingClientRect();
|
|
40138
|
+
const {
|
|
40139
|
+
offset,
|
|
40140
|
+
height
|
|
40141
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40142
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40143
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40144
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40145
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40146
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40147
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40148
|
+
} catch (e) {
|
|
40149
|
+
console.warn("Error handling trash tooltip:", e);
|
|
40150
|
+
}
|
|
40133
40151
|
}
|
|
40134
40152
|
},
|
|
40135
40153
|
onClick: e => {
|
|
@@ -40144,17 +40162,21 @@ const TableBody = ({
|
|
|
40144
40162
|
return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper$1, {
|
|
40145
40163
|
ref: el => {
|
|
40146
40164
|
if (el && trashTooltipText) {
|
|
40147
|
-
|
|
40148
|
-
|
|
40149
|
-
|
|
40150
|
-
|
|
40151
|
-
|
|
40152
|
-
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
|
|
40156
|
-
|
|
40157
|
-
|
|
40165
|
+
try {
|
|
40166
|
+
const rect = el.getBoundingClientRect();
|
|
40167
|
+
const {
|
|
40168
|
+
offset,
|
|
40169
|
+
height
|
|
40170
|
+
} = calculateTooltipOffset(trashTooltipText);
|
|
40171
|
+
el.style.setProperty("--tooltip-top", `${rect.top}px`);
|
|
40172
|
+
el.style.setProperty("--tooltip-left", `${rect.left}px`);
|
|
40173
|
+
el.style.setProperty("--tooltip-width", `${rect.width}px`);
|
|
40174
|
+
el.style.setProperty("--tooltip-offset", `${offset}px`);
|
|
40175
|
+
el.style.setProperty("--tooltip-height", `${height}px`);
|
|
40176
|
+
el.setAttribute("data-tooltip", trashTooltipText);
|
|
40177
|
+
} catch (e) {
|
|
40178
|
+
console.warn("Error handling disabled trash tooltip:", e);
|
|
40179
|
+
}
|
|
40158
40180
|
}
|
|
40159
40181
|
}
|
|
40160
40182
|
}, /*#__PURE__*/React$1.createElement(DisabledTrashIcon, {
|
|
@@ -40164,13 +40186,14 @@ const TableBody = ({
|
|
|
40164
40186
|
}
|
|
40165
40187
|
return null;
|
|
40166
40188
|
case "dropdown":
|
|
40189
|
+
if (!column) return null;
|
|
40167
40190
|
const dropdownKey = `${rowIndex}-${column.key}`;
|
|
40168
40191
|
const isOpen = openDropdowns[dropdownKey] || false;
|
|
40169
40192
|
const dropdownOptions = column.dropdownOptions || [];
|
|
40170
40193
|
const maxDropdownHeight = column.maxDropdownHeight || "200px";
|
|
40171
|
-
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40172
|
-
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40173
|
-
const placeholder = column.placeholder || "Select...";
|
|
40194
|
+
const dropdownOptionsWidth = column.dropdownOptionsWidth;
|
|
40195
|
+
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || "right";
|
|
40196
|
+
const placeholder = column.placeholder || "Select...";
|
|
40174
40197
|
|
|
40175
40198
|
// Find the current selected option to display its label
|
|
40176
40199
|
const currentOption = dropdownOptions.find(option => option.value === value);
|
|
@@ -40191,8 +40214,7 @@ const TableBody = ({
|
|
|
40191
40214
|
selectedColor: selectedColor
|
|
40192
40215
|
});
|
|
40193
40216
|
case "checkbox":
|
|
40194
|
-
const isChecked = Boolean(value);
|
|
40195
|
-
|
|
40217
|
+
const isChecked = Boolean(value);
|
|
40196
40218
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
40197
40219
|
style: {
|
|
40198
40220
|
display: "flex",
|
|
@@ -40205,13 +40227,12 @@ const TableBody = ({
|
|
|
40205
40227
|
type: "checkbox",
|
|
40206
40228
|
checked: isChecked,
|
|
40207
40229
|
onChange: e => handleCheckboxClick(row, column.key, e),
|
|
40208
|
-
onClick: e => e.stopPropagation()
|
|
40209
|
-
,
|
|
40230
|
+
onClick: e => e.stopPropagation(),
|
|
40210
40231
|
style: {
|
|
40211
40232
|
width: "18px",
|
|
40212
40233
|
height: "18px",
|
|
40213
40234
|
cursor: "pointer",
|
|
40214
|
-
accentColor: buttonColor
|
|
40235
|
+
accentColor: buttonColor
|
|
40215
40236
|
}
|
|
40216
40237
|
}));
|
|
40217
40238
|
default:
|
|
@@ -40227,7 +40248,6 @@ const TableBody = ({
|
|
|
40227
40248
|
const handleExpandClick = (row, rowIndex, event) => {
|
|
40228
40249
|
event.stopPropagation();
|
|
40229
40250
|
if (onExpandRow) {
|
|
40230
|
-
// Determine the expand status based on current state
|
|
40231
40251
|
const expandStatus = expandedRows[rowIndex] ? "isClosed" : "isOpen";
|
|
40232
40252
|
onExpandRow(row, rowIndex, expandStatus);
|
|
40233
40253
|
}
|
|
@@ -40237,15 +40257,11 @@ const TableBody = ({
|
|
|
40237
40257
|
const handleCheckboxClick = (row, columnKey, event) => {
|
|
40238
40258
|
event.stopPropagation();
|
|
40239
40259
|
const currentValue = row[columnKey];
|
|
40240
|
-
const newValue = !currentValue;
|
|
40241
|
-
|
|
40242
|
-
// Create updated row with new checkbox value
|
|
40260
|
+
const newValue = !currentValue;
|
|
40243
40261
|
const updatedRow = {
|
|
40244
40262
|
...row,
|
|
40245
40263
|
[columnKey]: newValue
|
|
40246
40264
|
};
|
|
40247
|
-
|
|
40248
|
-
// Fire the onCheckboxClick event with updated row
|
|
40249
40265
|
if (onCheckboxClick) {
|
|
40250
40266
|
onCheckboxClick({
|
|
40251
40267
|
fullRow: updatedRow,
|
|
@@ -40269,14 +40285,10 @@ const TableBody = ({
|
|
|
40269
40285
|
const handleDropdownOptionClick = (row, rowIndex, columnKey, selectedOption, event) => {
|
|
40270
40286
|
event.stopPropagation();
|
|
40271
40287
|
const dropdownKey = `${rowIndex}-${columnKey}`;
|
|
40272
|
-
|
|
40273
|
-
// Close the dropdown
|
|
40274
40288
|
setOpenDropdowns(prev => ({
|
|
40275
40289
|
...prev,
|
|
40276
40290
|
[dropdownKey]: false
|
|
40277
40291
|
}));
|
|
40278
|
-
|
|
40279
|
-
// Fire the onDropdownSelected event with columnKey instead of columnName
|
|
40280
40292
|
if (onDropdownSelected) {
|
|
40281
40293
|
onDropdownSelected(row, selectedOption, columnKey);
|
|
40282
40294
|
}
|
|
@@ -40292,72 +40304,109 @@ const TableBody = ({
|
|
|
40292
40304
|
document.removeEventListener("click", handleClickOutside);
|
|
40293
40305
|
};
|
|
40294
40306
|
}, []);
|
|
40295
|
-
|
|
40296
|
-
|
|
40297
|
-
|
|
40298
|
-
|
|
40299
|
-
|
|
40300
|
-
|
|
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
|
-
|
|
40307
|
+
|
|
40308
|
+
// Return null if no data
|
|
40309
|
+
if (data.length === 0) {
|
|
40310
|
+
return /*#__PURE__*/React$1.createElement(StyledTableBody, {
|
|
40311
|
+
ref: ref
|
|
40312
|
+
}, /*#__PURE__*/React$1.createElement(TableRow, null, /*#__PURE__*/React$1.createElement(TableCell, {
|
|
40313
|
+
colSpan: columns.length
|
|
40314
|
+
}, "No data available")));
|
|
40315
|
+
}
|
|
40316
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(StyledTableBody, {
|
|
40317
|
+
ref: ref
|
|
40318
|
+
}, data.map((row, rowIndex) => {
|
|
40319
|
+
// Skip invalid rows
|
|
40320
|
+
if (!row || typeof row !== 'object') {
|
|
40321
|
+
console.warn(`Invalid row at index ${rowIndex}:`, row);
|
|
40322
|
+
return null;
|
|
40323
|
+
}
|
|
40324
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
|
|
40325
|
+
key: row.id || `row-${rowIndex}`
|
|
40326
|
+
}, /*#__PURE__*/React$1.createElement(TableRow, {
|
|
40327
|
+
"data-row-index": rowIndex,
|
|
40328
|
+
className: indexToShimmer === rowIndex ? "shimmer-row" : "",
|
|
40329
|
+
isFocused: focusedRowIndex === rowIndex,
|
|
40330
|
+
selectedColor: selectedColor,
|
|
40331
|
+
onMouseEnter: () => setHoveredRowIndex(rowIndex),
|
|
40332
|
+
onMouseLeave: () => setHoveredRowIndex(null),
|
|
40333
|
+
onClick: () => handleRowClick(row, rowIndex)
|
|
40334
|
+
}, expandable && expandedContent[rowIndex] !== undefined && expandedContent[rowIndex] !== null ? /*#__PURE__*/React$1.createElement(TableCell, {
|
|
40335
|
+
$fieldType: "expand",
|
|
40336
|
+
$minWidth: "16px",
|
|
40337
|
+
$maxWidth: "16px"
|
|
40338
|
+
}, /*#__PURE__*/React$1.createElement(ExpandIcon, {
|
|
40339
|
+
onClick: e => handleExpandClick(row, rowIndex, e),
|
|
40340
|
+
$isExpanded: expandedRows[rowIndex] || false
|
|
40341
|
+
}, expandedRows[rowIndex] ? /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
|
|
40342
|
+
width: "12",
|
|
40343
|
+
height: "12",
|
|
40344
|
+
color: "#666"
|
|
40345
|
+
}) : /*#__PURE__*/React$1.createElement(ChervronRightIcon, {
|
|
40346
|
+
width: "12",
|
|
40347
|
+
height: "12",
|
|
40348
|
+
fill: "#666"
|
|
40349
|
+
}))) : expandable === true ? /*#__PURE__*/React$1.createElement(TableCell, {
|
|
40350
|
+
$fieldType: "expand",
|
|
40351
|
+
$minWidth: "16px",
|
|
40352
|
+
$maxWidth: "16px"
|
|
40353
|
+
}) : null, columns.map((column, columnIndex) => {
|
|
40354
|
+
if (!column || !column.key) {
|
|
40355
|
+
console.warn(`Invalid column at index ${columnIndex}:`, column);
|
|
40356
|
+
return null;
|
|
40357
|
+
}
|
|
40358
|
+
const value = row[column.key];
|
|
40359
|
+
const formattedValue = formatValue(value, column, row, rowIndex);
|
|
40360
|
+
|
|
40361
|
+
// Use the chrome shimmer hook safely
|
|
40362
|
+
let shimmerText = formattedValue;
|
|
40363
|
+
let isShimmering = false;
|
|
40364
|
+
try {
|
|
40365
|
+
const shimmerResult = useShimmerChromeEffect(formattedValue, rowIndex, indexToShimmer, columnIndex, columns.length);
|
|
40366
|
+
if (shimmerResult) {
|
|
40367
|
+
shimmerText = shimmerResult.text || formattedValue;
|
|
40368
|
+
isShimmering = shimmerResult.isShimmering || false;
|
|
40344
40369
|
}
|
|
40345
|
-
}
|
|
40346
|
-
|
|
40347
|
-
|
|
40348
|
-
$
|
|
40349
|
-
|
|
40350
|
-
|
|
40351
|
-
|
|
40352
|
-
|
|
40353
|
-
|
|
40354
|
-
|
|
40355
|
-
|
|
40356
|
-
|
|
40357
|
-
|
|
40358
|
-
|
|
40359
|
-
|
|
40360
|
-
|
|
40370
|
+
} catch (e) {
|
|
40371
|
+
console.warn("Error with shimmer effect:", e);
|
|
40372
|
+
}
|
|
40373
|
+
return /*#__PURE__*/React$1.createElement(TableCell, {
|
|
40374
|
+
key: `${column.key}-${rowIndex}`,
|
|
40375
|
+
ref: el => {
|
|
40376
|
+
if (el && shouldShowTooltip(el)) {
|
|
40377
|
+
try {
|
|
40378
|
+
const rect = el.getBoundingClientRect();
|
|
40379
|
+
const {
|
|
40380
|
+
offset,
|
|
40381
|
+
height
|
|
40382
|
+
} = calculateTooltipOffset(formattedValue.toString(), true);
|
|
40383
|
+
el.style.setProperty("--cell-top", `${rect.top}px`);
|
|
40384
|
+
el.style.setProperty("--cell-left", `${rect.left}px`);
|
|
40385
|
+
el.style.setProperty("--cell-width", `${rect.width}px`);
|
|
40386
|
+
el.style.setProperty("--cell-offset", `${offset}px`);
|
|
40387
|
+
el.style.setProperty("--cell-height", `${height}px`);
|
|
40388
|
+
el.setAttribute("data-tooltip", formattedValue);
|
|
40389
|
+
} catch (e) {
|
|
40390
|
+
console.warn("Error setting cell tooltip:", e);
|
|
40391
|
+
}
|
|
40392
|
+
}
|
|
40393
|
+
},
|
|
40394
|
+
$fieldType: column.fieldType?.toLowerCase(),
|
|
40395
|
+
$color: column.color,
|
|
40396
|
+
$minWidth: column.minWidth,
|
|
40397
|
+
$maxWidth: column.maxWidth
|
|
40398
|
+
}, column.fieldType?.toLowerCase() === "text" || column.fieldType?.toLowerCase() === "currency" || column.fieldType?.toLowerCase() === "number" || column.fieldType?.toLowerCase() === "percentage" || column.fieldType?.toLowerCase() === "date" || !column.fieldType ? /*#__PURE__*/React$1.createElement(ChromeShimmerText, {
|
|
40399
|
+
text: shimmerText,
|
|
40400
|
+
isShimmering: isShimmering
|
|
40401
|
+
}) : formattedValue);
|
|
40402
|
+
})), expandable && expandedRows[rowIndex] && /*#__PURE__*/React$1.createElement(ExpandedRow, {
|
|
40403
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40404
|
+
}, /*#__PURE__*/React$1.createElement(TableCell, {
|
|
40405
|
+
colSpan: columns.length + 1
|
|
40406
|
+
}, /*#__PURE__*/React$1.createElement(ExpandedContent, {
|
|
40407
|
+
$expandedBackgroundColor: expandedBackgroundColor
|
|
40408
|
+
}, expandedContent[rowIndex] || null))));
|
|
40409
|
+
})), /*#__PURE__*/React$1.createElement(MessageBox, {
|
|
40361
40410
|
title: "Add Comment",
|
|
40362
40411
|
isOpen: isCommentModalOpen,
|
|
40363
40412
|
onClose: handleCommentModalClose,
|
|
@@ -40382,7 +40431,7 @@ const TableBody = ({
|
|
|
40382
40431
|
onBlur: handleBlur,
|
|
40383
40432
|
onFocus: handleFocus
|
|
40384
40433
|
}), /*#__PURE__*/React$1.createElement(CharacterCount, null, commentText.length, "/", commentTextLimit))));
|
|
40385
|
-
};
|
|
40434
|
+
});
|
|
40386
40435
|
TableBody.propTypes = {
|
|
40387
40436
|
columns: PropTypes.array.isRequired,
|
|
40388
40437
|
data: PropTypes.array.isRequired,
|
|
@@ -40399,10 +40448,14 @@ TableBody.propTypes = {
|
|
|
40399
40448
|
statuses: PropTypes.array,
|
|
40400
40449
|
onCommentSave: PropTypes.func,
|
|
40401
40450
|
commentTextLimit: PropTypes.number,
|
|
40451
|
+
expandable: PropTypes.bool,
|
|
40452
|
+
expandedRows: PropTypes.object,
|
|
40453
|
+
expandedContent: PropTypes.object,
|
|
40454
|
+
onExpandRow: PropTypes.func,
|
|
40455
|
+
expandedBackgroundColor: PropTypes.string,
|
|
40402
40456
|
onDropdownSelected: PropTypes.func,
|
|
40403
40457
|
onCheckboxClick: PropTypes.func,
|
|
40404
|
-
onHeaderCheckboxClick: PropTypes.func
|
|
40405
|
-
ref: PropTypes.object
|
|
40458
|
+
onHeaderCheckboxClick: PropTypes.func
|
|
40406
40459
|
};
|
|
40407
40460
|
TableBody.displayName = "TableBody";
|
|
40408
40461
|
|
|
@@ -44819,6 +44872,15 @@ const SelectionTitle = styled.span`
|
|
|
44819
44872
|
font-weight: 700;
|
|
44820
44873
|
line-height: normal;
|
|
44821
44874
|
`;
|
|
44875
|
+
const ErrorLabel = styled.div`
|
|
44876
|
+
color: red;
|
|
44877
|
+
font-family: Poppins;
|
|
44878
|
+
font-size: 12px;
|
|
44879
|
+
height: 12px;
|
|
44880
|
+
font-style: normal;
|
|
44881
|
+
font-weight: 400;
|
|
44882
|
+
line-height: normal;
|
|
44883
|
+
`;
|
|
44822
44884
|
const BackTitle = styled.span`
|
|
44823
44885
|
margin-left: 4px;
|
|
44824
44886
|
color: #212121;
|
|
@@ -44956,19 +45018,26 @@ const NewSubitem = ({
|
|
|
44956
45018
|
vendor,
|
|
44957
45019
|
onBack,
|
|
44958
45020
|
addNewPackage,
|
|
45021
|
+
updateExistingPackage,
|
|
44959
45022
|
componentText = "Scale"
|
|
44960
45023
|
}) => {
|
|
44961
45024
|
const [negotiatedBrands, setNegotiatedBrands] = useState("");
|
|
44962
45025
|
const [negotiatedComponent, setNegotiatedComponent] = useState(componentText);
|
|
44963
|
-
|
|
45026
|
+
const [isPackageDuplicated, setIsPackageDuplicated] = useState(false);
|
|
44964
45027
|
// Form state
|
|
44965
|
-
const isApplyEnabled = negotiatedBrands.trim().length > 2;
|
|
45028
|
+
const [isApplyEnabled, setIsApplyEnabled] = useState(negotiatedBrands.trim().length > 2);
|
|
44966
45029
|
useEffect(() => {
|
|
45030
|
+
console.log("packageObject", vendor);
|
|
44967
45031
|
if (!packageObject) return;
|
|
44968
45032
|
if (!packageObject.brands) return;
|
|
44969
45033
|
setNegotiatedBrands(packageObject.brands);
|
|
44970
45034
|
setNegotiatedComponent(packageObject.component);
|
|
44971
45035
|
}, [packageObject]);
|
|
45036
|
+
useEffect(() => {
|
|
45037
|
+
if (packageObject && packageObject.brands === negotiatedBrands) return;
|
|
45038
|
+
setIsPackageDuplicated(vendor.packages.some(pkg => pkg.brands === negotiatedBrands));
|
|
45039
|
+
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages.some(pkg => pkg.brands === negotiatedBrands) === false);
|
|
45040
|
+
}, [negotiatedBrands]);
|
|
44972
45041
|
return /*#__PURE__*/React$1.createElement(NewSubitemContainer, null, /*#__PURE__*/React$1.createElement(Header, null, /*#__PURE__*/React$1.createElement(BackButton, {
|
|
44973
45042
|
onClick: onBack
|
|
44974
45043
|
}, /*#__PURE__*/React$1.createElement(ArrowLeftIcon, null)), /*#__PURE__*/React$1.createElement(BackTitle, null, vendor.name)), /*#__PURE__*/React$1.createElement(SelectionTitle, null, "Add Package"), /*#__PURE__*/React$1.createElement(ButtonsContainer, null, /*#__PURE__*/React$1.createElement(Button$1, {
|
|
@@ -44986,7 +45055,11 @@ const NewSubitem = ({
|
|
|
44986
45055
|
}), /*#__PURE__*/React$1.createElement(Button$1, {
|
|
44987
45056
|
leftIcon: "none",
|
|
44988
45057
|
onClick: () => {
|
|
44989
|
-
|
|
45058
|
+
if (packageObject) {
|
|
45059
|
+
updateExistingPackage(vendor.name, packageObject, negotiatedBrands, negotiatedComponent);
|
|
45060
|
+
} else {
|
|
45061
|
+
addNewPackage(vendor.name, negotiatedBrands, negotiatedComponent);
|
|
45062
|
+
}
|
|
44990
45063
|
},
|
|
44991
45064
|
rightIcon: "none",
|
|
44992
45065
|
size: "small",
|
|
@@ -45007,7 +45080,7 @@ const NewSubitem = ({
|
|
|
45007
45080
|
onChange: e => setNegotiatedBrands(e.target.value),
|
|
45008
45081
|
required: true,
|
|
45009
45082
|
placeholder: "Specify by text the participated brands, divided by commas"
|
|
45010
|
-
})), /*#__PURE__*/React$1.createElement(NegotiatedContainer, null, /*#__PURE__*/React$1.createElement(AddNegotiatedBrand, null, "Component ", /*#__PURE__*/React$1.createElement("span", {
|
|
45083
|
+
}), isPackageDuplicated ? /*#__PURE__*/React$1.createElement(ErrorLabel, null, "Package already exists for that vendor, Please enter a unique package.") : /*#__PURE__*/React$1.createElement(ErrorLabel, null)), /*#__PURE__*/React$1.createElement(NegotiatedContainer, null, /*#__PURE__*/React$1.createElement(AddNegotiatedBrand, null, "Component ", /*#__PURE__*/React$1.createElement("span", {
|
|
45011
45084
|
style: {
|
|
45012
45085
|
color: "red"
|
|
45013
45086
|
}
|
|
@@ -53691,10 +53764,6 @@ const ItemManagerPanel = _ref => {
|
|
|
53691
53764
|
const [trashIsHovered, setTrashIsHovered] = useState(false);
|
|
53692
53765
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
53693
53766
|
const headerRef = useRef(null);
|
|
53694
|
-
useEffect(() => {
|
|
53695
|
-
console.log("Screen changed to:", screen);
|
|
53696
|
-
console.log("Selected Vendor:", selectedVendor);
|
|
53697
|
-
}, [screen, selectedVendor]);
|
|
53698
53767
|
useEffect(() => {
|
|
53699
53768
|
if (headerRef.current) {
|
|
53700
53769
|
setHeaderHeight(headerRef.current.offsetHeight);
|