sag_components 2.0.0-beta245 → 2.0.0-beta247
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 +157 -244
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +157 -244
- package/dist/index.js.map +1 -1
- package/dist/types/components/Table/TableHeader.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9453,27 +9453,26 @@ const IconContainer$4 = styled.div`
|
|
|
9453
9453
|
cursor: pointer;
|
|
9454
9454
|
`;
|
|
9455
9455
|
|
|
9456
|
-
const DropdownMultiNew =
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
} = _ref;
|
|
9456
|
+
const DropdownMultiNew = ({
|
|
9457
|
+
label,
|
|
9458
|
+
labelEmptyValue,
|
|
9459
|
+
options,
|
|
9460
|
+
selectedValue,
|
|
9461
|
+
onChange,
|
|
9462
|
+
required,
|
|
9463
|
+
disabled,
|
|
9464
|
+
width,
|
|
9465
|
+
height,
|
|
9466
|
+
withMarginBottom = true,
|
|
9467
|
+
error,
|
|
9468
|
+
errorMessage,
|
|
9469
|
+
labelColor,
|
|
9470
|
+
xIconShow,
|
|
9471
|
+
checkBoxColor,
|
|
9472
|
+
showLabelOnTop,
|
|
9473
|
+
orderBy,
|
|
9474
|
+
elementType
|
|
9475
|
+
}) => {
|
|
9477
9476
|
const [isFocused, setIsFocused] = useState(false);
|
|
9478
9477
|
const [showOptions, setShowOptions] = useState(false);
|
|
9479
9478
|
const [showAbove, setShowAbove] = useState(false);
|
|
@@ -10582,24 +10581,23 @@ const QuarterPopupPicker = ({
|
|
|
10582
10581
|
};
|
|
10583
10582
|
|
|
10584
10583
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10585
|
-
const QuarterPicker =
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
} = _ref;
|
|
10584
|
+
const QuarterPicker = ({
|
|
10585
|
+
availableQuarters,
|
|
10586
|
+
// ["Q1-2024"]
|
|
10587
|
+
label,
|
|
10588
|
+
onChange,
|
|
10589
|
+
borderRadius,
|
|
10590
|
+
required,
|
|
10591
|
+
width,
|
|
10592
|
+
height,
|
|
10593
|
+
placeholder,
|
|
10594
|
+
disabled,
|
|
10595
|
+
borderColor,
|
|
10596
|
+
borderColorFocus,
|
|
10597
|
+
textColor,
|
|
10598
|
+
selectedValue,
|
|
10599
|
+
startYear
|
|
10600
|
+
}) => {
|
|
10603
10601
|
const [isFocused, setIsFocused] = useState(false);
|
|
10604
10602
|
const [isOpen, setIsOpen] = useState(false);
|
|
10605
10603
|
const [value, setValue] = useState('');
|
|
@@ -11041,23 +11039,22 @@ const MonthPopupPicker = ({
|
|
|
11041
11039
|
};
|
|
11042
11040
|
|
|
11043
11041
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
11044
|
-
const MonthPicker =
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
} = _ref;
|
|
11042
|
+
const MonthPicker = ({
|
|
11043
|
+
availableMonths,
|
|
11044
|
+
label,
|
|
11045
|
+
onChange,
|
|
11046
|
+
borderRadius,
|
|
11047
|
+
required,
|
|
11048
|
+
width,
|
|
11049
|
+
height,
|
|
11050
|
+
placeholder,
|
|
11051
|
+
disabled,
|
|
11052
|
+
borderColor,
|
|
11053
|
+
borderColorFocus,
|
|
11054
|
+
textColor,
|
|
11055
|
+
selectedValue,
|
|
11056
|
+
startYear
|
|
11057
|
+
}) => {
|
|
11061
11058
|
const [isFocused, setIsFocused] = useState(false);
|
|
11062
11059
|
const [isOpen, setIsOpen] = useState(false);
|
|
11063
11060
|
const [value, setValue] = useState('');
|
|
@@ -24168,22 +24165,21 @@ const DeleteIcon = styled.div`
|
|
|
24168
24165
|
position: absolute;
|
|
24169
24166
|
`;
|
|
24170
24167
|
|
|
24171
|
-
const QuickFilterDropdownSingle =
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
24177
|
-
|
|
24178
|
-
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
} = _ref;
|
|
24168
|
+
const QuickFilterDropdownSingle = ({
|
|
24169
|
+
label,
|
|
24170
|
+
hoverColor,
|
|
24171
|
+
options,
|
|
24172
|
+
selectedValue,
|
|
24173
|
+
placeHolder,
|
|
24174
|
+
onChange,
|
|
24175
|
+
disabled,
|
|
24176
|
+
width,
|
|
24177
|
+
error,
|
|
24178
|
+
errorMessage,
|
|
24179
|
+
xIconShow,
|
|
24180
|
+
labelColor,
|
|
24181
|
+
showLabelOnTop
|
|
24182
|
+
}) => {
|
|
24187
24183
|
const [isFocused, setIsFocused] = useState(false);
|
|
24188
24184
|
const [showOptions, setShowOptions] = useState(false);
|
|
24189
24185
|
const [inputValue, setInputValue] = useState("");
|
|
@@ -24640,26 +24636,25 @@ const IconContainer$2 = styled.div`
|
|
|
24640
24636
|
cursor: pointer;
|
|
24641
24637
|
`;
|
|
24642
24638
|
|
|
24643
|
-
const QuickFilterDropdownMultiSelection =
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
} = _ref;
|
|
24639
|
+
const QuickFilterDropdownMultiSelection = ({
|
|
24640
|
+
label,
|
|
24641
|
+
labelEmptyValue,
|
|
24642
|
+
options,
|
|
24643
|
+
selectedValue,
|
|
24644
|
+
placeHolder,
|
|
24645
|
+
onChange,
|
|
24646
|
+
required,
|
|
24647
|
+
disabled,
|
|
24648
|
+
width,
|
|
24649
|
+
height,
|
|
24650
|
+
error,
|
|
24651
|
+
errorMessage,
|
|
24652
|
+
labelColor,
|
|
24653
|
+
xIconShow,
|
|
24654
|
+
checkBoxColor,
|
|
24655
|
+
showLabelOnTop,
|
|
24656
|
+
dropdownHeight
|
|
24657
|
+
}) => {
|
|
24663
24658
|
const [isFocused, setIsFocused] = useState(false);
|
|
24664
24659
|
const [showOptions, setShowOptions] = useState(false);
|
|
24665
24660
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -35323,21 +35318,26 @@ const WeeksPicker = _ref => {
|
|
|
35323
35318
|
}
|
|
35324
35319
|
}, [allowedWeekRange, restrictToRange]);
|
|
35325
35320
|
useEffect(() => {
|
|
35326
|
-
if (previousText !== text
|
|
35321
|
+
if (previousText !== text) {
|
|
35322
|
+
setPreviousText(text);
|
|
35323
|
+
}
|
|
35324
|
+
const currentValue = value || selectedValue;
|
|
35325
|
+
if (currentValue) {
|
|
35327
35326
|
const {
|
|
35328
35327
|
startWeek,
|
|
35329
35328
|
endWeek
|
|
35330
|
-
} = parseValueToWeeks(
|
|
35329
|
+
} = parseValueToWeeks(currentValue);
|
|
35331
35330
|
if (startWeek && endWeek) {
|
|
35332
35331
|
const newValue = endWeek === startWeek ? text === 'Week' ? `${text} ${startWeek}` : `${text}${startWeek}` : text === 'Week' ? `${text}s ${startWeek} - ${endWeek}` : `${text}${startWeek} - ${endWeek}`;
|
|
35333
|
-
|
|
35334
|
-
|
|
35335
|
-
onChange
|
|
35332
|
+
if (newValue !== value) {
|
|
35333
|
+
setValue(newValue);
|
|
35334
|
+
if (onChange) {
|
|
35335
|
+
onChange(newValue);
|
|
35336
|
+
}
|
|
35336
35337
|
}
|
|
35337
35338
|
}
|
|
35338
|
-
setPreviousText(text);
|
|
35339
35339
|
}
|
|
35340
|
-
}, [text, value, previousText, onChange]);
|
|
35340
|
+
}, [text, value, selectedValue, previousText, onChange]);
|
|
35341
35341
|
const handleToggle = () => {
|
|
35342
35342
|
setIsOpen(!isOpen);
|
|
35343
35343
|
};
|
|
@@ -35358,11 +35358,6 @@ const WeeksPicker = _ref => {
|
|
|
35358
35358
|
onChange(newValue);
|
|
35359
35359
|
setValue(newValue);
|
|
35360
35360
|
};
|
|
35361
|
-
useEffect(() => {
|
|
35362
|
-
if (selectedValue !== undefined) {
|
|
35363
|
-
setValue(selectedValue);
|
|
35364
|
-
}
|
|
35365
|
-
}, [selectedValue]);
|
|
35366
35361
|
const handleApply = () => {
|
|
35367
35362
|
setIsOpen(false);
|
|
35368
35363
|
};
|
|
@@ -36171,9 +36166,9 @@ const ToggleSlider = styled.span`
|
|
|
36171
36166
|
}
|
|
36172
36167
|
`;
|
|
36173
36168
|
|
|
36174
|
-
/**
|
|
36175
|
-
* ToggleSwitch component for on/off states.
|
|
36176
|
-
* Supports small/large sizes and disabled state.
|
|
36169
|
+
/**
|
|
36170
|
+
* ToggleSwitch component for on/off states.
|
|
36171
|
+
* Supports small/large sizes and disabled state.
|
|
36177
36172
|
*/
|
|
36178
36173
|
function ToggleSwitch(_ref) {
|
|
36179
36174
|
let {
|
|
@@ -40791,7 +40786,8 @@ const TableHeader = ({
|
|
|
40791
40786
|
activeSorts = [],
|
|
40792
40787
|
expandable = false,
|
|
40793
40788
|
onHeaderCheckboxClick = () => {},
|
|
40794
|
-
headerCheckboxStates = {}
|
|
40789
|
+
headerCheckboxStates = {},
|
|
40790
|
+
resetFiltersKey = 0 // NEW: Add this prop
|
|
40795
40791
|
}) => {
|
|
40796
40792
|
const [focusedFilter, setFocusedFilter] = useState(null);
|
|
40797
40793
|
const [focusedSort, setFocusedSort] = useState(null);
|
|
@@ -40802,21 +40798,46 @@ const TableHeader = ({
|
|
|
40802
40798
|
left: 0
|
|
40803
40799
|
});
|
|
40804
40800
|
const [filterState, setFilterState] = useState({});
|
|
40805
|
-
|
|
40806
|
-
// Add persistent filter selections state
|
|
40807
40801
|
const [filterSelections, setFilterSelections] = useState({});
|
|
40802
|
+
const [activeSortColumn, setActiveSortColumn] = useState(null);
|
|
40803
|
+
const [activeSortValue, setActiveSortValue] = useState(null);
|
|
40804
|
+
const iconRefs = useRef({});
|
|
40805
|
+
const popupRef = useRef(null);
|
|
40806
|
+
|
|
40807
|
+
// NEW: Reset internal state when resetFiltersKey changes
|
|
40808
|
+
useEffect(() => {
|
|
40809
|
+
if (resetFiltersKey > 0) {
|
|
40810
|
+
// Reset filter selections to default (all selected)
|
|
40811
|
+
const resetSelections = {};
|
|
40812
|
+
columns.forEach(column => {
|
|
40813
|
+
if (column.filter && column.filterOptions) {
|
|
40814
|
+
const initialState = {};
|
|
40815
|
+
const fullList = [{
|
|
40816
|
+
value: 'All',
|
|
40817
|
+
label: 'Select All'
|
|
40818
|
+
}, ...column.filterOptions];
|
|
40819
|
+
fullList.forEach(item => {
|
|
40820
|
+
initialState[item.value] = true;
|
|
40821
|
+
});
|
|
40822
|
+
resetSelections[column.key] = initialState;
|
|
40823
|
+
}
|
|
40824
|
+
});
|
|
40825
|
+
setFilterSelections(resetSelections);
|
|
40808
40826
|
|
|
40809
|
-
|
|
40810
|
-
|
|
40811
|
-
const [activeSortValue, setActiveSortValue] = useState(null); // Only one sort value
|
|
40827
|
+
// Reset filter state
|
|
40828
|
+
setFilterState({});
|
|
40812
40829
|
|
|
40813
|
-
|
|
40814
|
-
|
|
40830
|
+
// Reset sort state
|
|
40831
|
+
setActiveSortColumn(null);
|
|
40832
|
+
setActiveSortValue(null);
|
|
40815
40833
|
|
|
40816
|
-
|
|
40817
|
-
|
|
40834
|
+
// Close any open popups
|
|
40835
|
+
setVisibleFilterPopWrapper(null);
|
|
40836
|
+
setVisibleSortPopWrapper(null);
|
|
40837
|
+
}
|
|
40838
|
+
}, [resetFiltersKey, columns]);
|
|
40818
40839
|
|
|
40819
|
-
//
|
|
40840
|
+
// Initialize filter selections for new columns
|
|
40820
40841
|
useEffect(() => {
|
|
40821
40842
|
setFilterSelections(prevSelections => {
|
|
40822
40843
|
const newSelections = {
|
|
@@ -40824,7 +40845,6 @@ const TableHeader = ({
|
|
|
40824
40845
|
};
|
|
40825
40846
|
let hasChanges = false;
|
|
40826
40847
|
columns.forEach(column => {
|
|
40827
|
-
// Only initialize if column doesn't exist in state yet
|
|
40828
40848
|
if (column.filter && column.filterOptions && !newSelections[column.key]) {
|
|
40829
40849
|
const initialState = {};
|
|
40830
40850
|
const fullList = [{
|
|
@@ -40837,69 +40857,48 @@ const TableHeader = ({
|
|
|
40837
40857
|
newSelections[column.key] = initialState;
|
|
40838
40858
|
hasChanges = true;
|
|
40839
40859
|
} else if (column.filter && column.filterOptions && newSelections[column.key]) {
|
|
40840
|
-
// Column exists - check if we need to add new options that appeared
|
|
40841
40860
|
const currentSelections = newSelections[column.key];
|
|
40842
40861
|
const newOptions = column.filterOptions.filter(opt => currentSelections[opt.value] === undefined);
|
|
40843
|
-
|
|
40844
|
-
// Only update if there are genuinely new options
|
|
40845
40862
|
if (newOptions.length > 0) {
|
|
40846
40863
|
const updatedSelections = {
|
|
40847
40864
|
...currentSelections
|
|
40848
40865
|
};
|
|
40849
40866
|
newOptions.forEach(opt => {
|
|
40850
|
-
updatedSelections[opt.value] = true;
|
|
40867
|
+
updatedSelections[opt.value] = true;
|
|
40851
40868
|
});
|
|
40852
40869
|
newSelections[column.key] = updatedSelections;
|
|
40853
40870
|
hasChanges = true;
|
|
40854
40871
|
}
|
|
40855
40872
|
}
|
|
40856
40873
|
});
|
|
40857
|
-
|
|
40858
|
-
// Only return new object if there were actual changes
|
|
40859
40874
|
return hasChanges ? newSelections : prevSelections;
|
|
40860
40875
|
});
|
|
40861
40876
|
}, [columns]);
|
|
40862
|
-
|
|
40863
|
-
// Helper function to check if filter is in default state (all items selected)
|
|
40864
40877
|
const isFilterInDefaultState = columnKey => {
|
|
40865
40878
|
const filterData = filterState[columnKey];
|
|
40866
40879
|
if (!filterData) {
|
|
40867
|
-
return true;
|
|
40880
|
+
return true;
|
|
40868
40881
|
}
|
|
40869
|
-
|
|
40870
|
-
// For range filters, check if "All weeks" is selected
|
|
40871
40882
|
if (filterData.selectedRadio) {
|
|
40872
40883
|
return filterData.selectedRadio === 'all weeks';
|
|
40873
40884
|
}
|
|
40874
|
-
|
|
40875
|
-
// Check if it's in "select all" state with no exclusions
|
|
40876
40885
|
return filterData.isSelectAll && filterData.excluded?.length === 0 && filterData.included?.length === 0;
|
|
40877
40886
|
};
|
|
40878
|
-
|
|
40879
|
-
// Helper function to determine filter icon state
|
|
40880
40887
|
const getFilterIconState = columnKey => {
|
|
40881
40888
|
const isFocused = focusedFilter === columnKey;
|
|
40882
40889
|
const isActive = activeFilters.includes(columnKey);
|
|
40883
40890
|
const isDefault = isFilterInDefaultState(columnKey);
|
|
40884
|
-
|
|
40885
|
-
// If it's in default state (all selected), show as default
|
|
40886
40891
|
if (isDefault) {
|
|
40887
40892
|
return 'default';
|
|
40888
40893
|
}
|
|
40889
|
-
|
|
40890
|
-
// If focused or active and not in default state, show as active
|
|
40891
40894
|
if (isFocused || isActive) {
|
|
40892
40895
|
return 'active';
|
|
40893
40896
|
}
|
|
40894
|
-
|
|
40895
|
-
// If has filter applied but not default, show as active
|
|
40896
40897
|
if (filterState[columnKey]) {
|
|
40897
40898
|
return 'active';
|
|
40898
40899
|
}
|
|
40899
40900
|
return 'default';
|
|
40900
40901
|
};
|
|
40901
|
-
|
|
40902
|
-
// Enhanced function to calculate position with viewport boundary detection
|
|
40903
40902
|
const calculatePopPosition = (iconElement, popupWidth = 300, popupHeight = 400) => {
|
|
40904
40903
|
if (!iconElement) return {
|
|
40905
40904
|
top: 0,
|
|
@@ -40910,32 +40909,20 @@ const TableHeader = ({
|
|
|
40910
40909
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
40911
40910
|
const viewportWidth = window.innerWidth;
|
|
40912
40911
|
const viewportHeight = window.innerHeight;
|
|
40913
|
-
let top = rect.bottom + scrollTop + 4;
|
|
40912
|
+
let top = rect.bottom + scrollTop + 4;
|
|
40914
40913
|
let left = rect.left + scrollLeft;
|
|
40915
|
-
|
|
40916
|
-
// Check if popup would overflow right edge of viewport
|
|
40917
40914
|
if (left + popupWidth > viewportWidth) {
|
|
40918
|
-
// Position to the left of the icon instead
|
|
40919
40915
|
left = rect.right + scrollLeft - popupWidth;
|
|
40920
|
-
|
|
40921
|
-
// If it still overflows on the left, clamp to viewport
|
|
40922
40916
|
if (left < 0) {
|
|
40923
|
-
left = 8;
|
|
40917
|
+
left = 8;
|
|
40924
40918
|
}
|
|
40925
40919
|
}
|
|
40926
|
-
|
|
40927
|
-
// Check if popup would overflow bottom edge of viewport
|
|
40928
40920
|
if (rect.bottom + popupHeight > viewportHeight) {
|
|
40929
|
-
|
|
40930
|
-
top = rect.top + scrollTop - popupHeight - 4; // 4px gap above the icon
|
|
40931
|
-
|
|
40932
|
-
// If it still overflows on the top, clamp to viewport
|
|
40921
|
+
top = rect.top + scrollTop - popupHeight - 4;
|
|
40933
40922
|
if (top < scrollTop) {
|
|
40934
|
-
top = scrollTop + 8;
|
|
40923
|
+
top = scrollTop + 8;
|
|
40935
40924
|
}
|
|
40936
40925
|
}
|
|
40937
|
-
|
|
40938
|
-
// Ensure left position doesn't go negative
|
|
40939
40926
|
if (left < 0) {
|
|
40940
40927
|
left = 8;
|
|
40941
40928
|
}
|
|
@@ -40944,16 +40931,12 @@ const TableHeader = ({
|
|
|
40944
40931
|
left
|
|
40945
40932
|
};
|
|
40946
40933
|
};
|
|
40947
|
-
|
|
40948
|
-
// Function to estimate popup dimensions based on content type
|
|
40949
40934
|
const getEstimatedPopupDimensions = columnKey => {
|
|
40950
40935
|
const column = columns.find(col => col.key === columnKey);
|
|
40951
40936
|
if (!column) return {
|
|
40952
40937
|
width: 300,
|
|
40953
40938
|
height: 400
|
|
40954
40939
|
};
|
|
40955
|
-
|
|
40956
|
-
// Default dimensions
|
|
40957
40940
|
let width = 300;
|
|
40958
40941
|
let height = 400;
|
|
40959
40942
|
if (column.freeTextFilter) {
|
|
@@ -40963,8 +40946,7 @@ const TableHeader = ({
|
|
|
40963
40946
|
width = 300;
|
|
40964
40947
|
height = 300;
|
|
40965
40948
|
} else if (column.filterOptions) {
|
|
40966
|
-
|
|
40967
|
-
const optionCount = column.filterOptions.length + 1; // +1 for "Select All"
|
|
40949
|
+
const optionCount = column.filterOptions.length + 1;
|
|
40968
40950
|
height = Math.min(Math.max(optionCount * 32 + 100, 200), 500);
|
|
40969
40951
|
} else if (column.sortOptions) {
|
|
40970
40952
|
const optionCount = column.sortOptions.length;
|
|
@@ -40975,8 +40957,6 @@ const TableHeader = ({
|
|
|
40975
40957
|
height
|
|
40976
40958
|
};
|
|
40977
40959
|
};
|
|
40978
|
-
|
|
40979
|
-
// Update handleSort to remove onSort call (only opens/closes popup)
|
|
40980
40960
|
const handleSort = key => {
|
|
40981
40961
|
const iconElement = iconRefs.current[`sort-${key}`];
|
|
40982
40962
|
if (iconElement) {
|
|
@@ -40984,7 +40964,7 @@ const TableHeader = ({
|
|
|
40984
40964
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
40985
40965
|
}
|
|
40986
40966
|
setVisibleSortPopWrapper(prevKey => prevKey === key ? null : key);
|
|
40987
|
-
setVisibleFilterPopWrapper(null);
|
|
40967
|
+
setVisibleFilterPopWrapper(null);
|
|
40988
40968
|
};
|
|
40989
40969
|
useEffect(() => {
|
|
40990
40970
|
if (Object.keys(filterState).length > 0) {
|
|
@@ -40998,46 +40978,29 @@ const TableHeader = ({
|
|
|
40998
40978
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
40999
40979
|
}
|
|
41000
40980
|
setVisibleFilterPopWrapper(prevKey => prevKey === key ? null : key);
|
|
41001
|
-
setVisibleSortPopWrapper(null);
|
|
40981
|
+
setVisibleSortPopWrapper(null);
|
|
41002
40982
|
};
|
|
41003
|
-
|
|
41004
|
-
// MODIFIED: Handle sort selection - Reset previous sort and apply new one
|
|
41005
40983
|
const handleSortSelectionChange = (columnKey, sortValue) => {
|
|
41006
|
-
// If selecting a new column, reset the previous sort
|
|
41007
40984
|
if (activeSortColumn && activeSortColumn !== columnKey) {
|
|
41008
|
-
// Clear the previous sort
|
|
41009
40985
|
setActiveSortColumn(columnKey);
|
|
41010
40986
|
setActiveSortValue(sortValue);
|
|
41011
40987
|
} else {
|
|
41012
|
-
// Same column or first sort
|
|
41013
40988
|
setActiveSortColumn(columnKey);
|
|
41014
40989
|
setActiveSortValue(sortValue);
|
|
41015
40990
|
}
|
|
41016
|
-
|
|
41017
|
-
// Close the popup after selection
|
|
41018
40991
|
setVisibleSortPopWrapper(null);
|
|
41019
|
-
|
|
41020
|
-
// Call onSort with both column key and selected sort value
|
|
41021
40992
|
if (onSort) {
|
|
41022
40993
|
onSort(columnKey, sortValue);
|
|
41023
40994
|
}
|
|
41024
40995
|
};
|
|
41025
|
-
|
|
41026
|
-
// MODIFIED: Handle sort reset - Clear the active sort
|
|
41027
40996
|
const handleSortReset = columnKey => {
|
|
41028
|
-
// Clear the active sort state
|
|
41029
40997
|
setActiveSortColumn(null);
|
|
41030
40998
|
setActiveSortValue(null);
|
|
41031
|
-
|
|
41032
|
-
// Call onSort to notify that sort was reset
|
|
41033
40999
|
if (onSort) {
|
|
41034
41000
|
onSort(columnKey, null);
|
|
41035
41001
|
}
|
|
41036
41002
|
};
|
|
41037
|
-
|
|
41038
|
-
// Handle filter selection changes - Updated to work with stateless FilterPop
|
|
41039
41003
|
const handleFilterSelectionChange = (columnKey, selectionData) => {
|
|
41040
|
-
// Force immediate synchronous update using callback form
|
|
41041
41004
|
setFilterSelections(prev => {
|
|
41042
41005
|
const updated = {
|
|
41043
41006
|
...prev,
|
|
@@ -41045,15 +41008,11 @@ const TableHeader = ({
|
|
|
41045
41008
|
};
|
|
41046
41009
|
return updated;
|
|
41047
41010
|
});
|
|
41048
|
-
|
|
41049
|
-
// Also update filter state
|
|
41050
41011
|
setFilterState(prev => ({
|
|
41051
41012
|
...prev,
|
|
41052
41013
|
[columnKey]: selectionData.filterData
|
|
41053
41014
|
}));
|
|
41054
41015
|
};
|
|
41055
|
-
|
|
41056
|
-
// Handle filter reset - Updated to work with stateless FilterPop
|
|
41057
41016
|
const handleFilterReset = columnKey => {
|
|
41058
41017
|
const column = columns.find(col => col.key === columnKey);
|
|
41059
41018
|
if (column && column.filterOptions) {
|
|
@@ -41065,14 +41024,10 @@ const TableHeader = ({
|
|
|
41065
41024
|
fullList.forEach(item => {
|
|
41066
41025
|
resetState[item.value] = true;
|
|
41067
41026
|
});
|
|
41068
|
-
|
|
41069
|
-
// Update filter selections immediately
|
|
41070
41027
|
setFilterSelections(prev => ({
|
|
41071
41028
|
...prev,
|
|
41072
41029
|
[columnKey]: resetState
|
|
41073
41030
|
}));
|
|
41074
|
-
|
|
41075
|
-
// Set filter state to "select all" structure
|
|
41076
41031
|
const resetFilterData = {
|
|
41077
41032
|
excluded: [],
|
|
41078
41033
|
included: [],
|
|
@@ -41084,8 +41039,6 @@ const TableHeader = ({
|
|
|
41084
41039
|
}));
|
|
41085
41040
|
}
|
|
41086
41041
|
};
|
|
41087
|
-
|
|
41088
|
-
// Update the click outside handlers
|
|
41089
41042
|
useEffect(() => {
|
|
41090
41043
|
const handleClickOutside = event => {
|
|
41091
41044
|
if (!event.target.closest(`[data-column="${visibleFilterPopWrapper}"]`) && !event.target.closest('.pop-wrapper')) {
|
|
@@ -41108,8 +41061,6 @@ const TableHeader = ({
|
|
|
41108
41061
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
41109
41062
|
};
|
|
41110
41063
|
}, [visibleSortPopWrapper]);
|
|
41111
|
-
|
|
41112
|
-
// Enhanced position update with better dimension handling
|
|
41113
41064
|
useEffect(() => {
|
|
41114
41065
|
const updatePosition = () => {
|
|
41115
41066
|
if (visibleSortPopWrapper) {
|
|
@@ -41126,12 +41077,10 @@ const TableHeader = ({
|
|
|
41126
41077
|
}
|
|
41127
41078
|
}
|
|
41128
41079
|
};
|
|
41129
|
-
|
|
41130
|
-
// Debounce the position update for better performance
|
|
41131
41080
|
let timeoutId;
|
|
41132
41081
|
const debouncedUpdatePosition = () => {
|
|
41133
41082
|
clearTimeout(timeoutId);
|
|
41134
|
-
timeoutId = setTimeout(updatePosition, 16);
|
|
41083
|
+
timeoutId = setTimeout(updatePosition, 16);
|
|
41135
41084
|
};
|
|
41136
41085
|
window.addEventListener('scroll', debouncedUpdatePosition, {
|
|
41137
41086
|
passive: true
|
|
@@ -41159,21 +41108,14 @@ const TableHeader = ({
|
|
|
41159
41108
|
const shouldShowActiveIcon = key => {
|
|
41160
41109
|
return isFilterActive(key) || isFilterFocused(key);
|
|
41161
41110
|
};
|
|
41162
|
-
|
|
41163
|
-
// MODIFIED: Check if THIS specific column has an active sort
|
|
41164
41111
|
const shouldShowActiveSortIcon = key => {
|
|
41165
41112
|
const isFocused = focusedSort === key;
|
|
41166
41113
|
const isActive = activeSorts.includes(key);
|
|
41167
41114
|
const hasSelection = activeSortColumn === key && activeSortValue !== null;
|
|
41168
41115
|
return isFocused || isActive || hasSelection;
|
|
41169
41116
|
};
|
|
41170
|
-
|
|
41171
|
-
// Handle header checkbox click
|
|
41172
41117
|
const handleHeaderCheckboxClick = (columnKey, event) => {
|
|
41173
|
-
// Don't prevent the default checkbox behavior
|
|
41174
41118
|
const newValue = event.target.checked;
|
|
41175
|
-
|
|
41176
|
-
// Fire the callback with column info and new value - let parent handle state
|
|
41177
41119
|
if (onHeaderCheckboxClick) {
|
|
41178
41120
|
onHeaderCheckboxClick({
|
|
41179
41121
|
columnName: columnKey,
|
|
@@ -41181,8 +41123,6 @@ const TableHeader = ({
|
|
|
41181
41123
|
});
|
|
41182
41124
|
}
|
|
41183
41125
|
};
|
|
41184
|
-
|
|
41185
|
-
// UPDATED: showColumnFilter with fixed RangePop integration
|
|
41186
41126
|
const showColumnFilter = column => {
|
|
41187
41127
|
const {
|
|
41188
41128
|
key,
|
|
@@ -41217,7 +41157,6 @@ const TableHeader = ({
|
|
|
41217
41157
|
}
|
|
41218
41158
|
});
|
|
41219
41159
|
} else if (rangeFilter) {
|
|
41220
|
-
// Get the current filter state for this column to persist values
|
|
41221
41160
|
const currentFilterState = filterState[key];
|
|
41222
41161
|
return /*#__PURE__*/React$1.createElement(RangePop, {
|
|
41223
41162
|
menuName: title,
|
|
@@ -41261,8 +41200,6 @@ const TableHeader = ({
|
|
|
41261
41200
|
});
|
|
41262
41201
|
}
|
|
41263
41202
|
};
|
|
41264
|
-
|
|
41265
|
-
// MODIFIED: Pass the selected value only for the active sort column
|
|
41266
41203
|
const showColumnSort = column => {
|
|
41267
41204
|
const {
|
|
41268
41205
|
key,
|
|
@@ -41272,8 +41209,6 @@ const TableHeader = ({
|
|
|
41272
41209
|
if (!sortOptions || sortOptions.length === 0) {
|
|
41273
41210
|
return null;
|
|
41274
41211
|
}
|
|
41275
|
-
|
|
41276
|
-
// Only show selected value if this is the active sort column
|
|
41277
41212
|
const selectedValue = activeSortColumn === key ? activeSortValue : null;
|
|
41278
41213
|
return /*#__PURE__*/React$1.createElement(SortPop, {
|
|
41279
41214
|
width: "300px",
|
|
@@ -46920,7 +46855,6 @@ const Table = props => {
|
|
|
46920
46855
|
noDataInSearchMessage = "Try to refine your query and search again",
|
|
46921
46856
|
noDataIcon = "Plus",
|
|
46922
46857
|
noDataSearchIcon = "Plus",
|
|
46923
|
-
// NEW: Props for NoEventsParent section
|
|
46924
46858
|
noEventsTitle = "You haven't created any events yet",
|
|
46925
46859
|
noEventsSubtitle = "Let's get started and create your first one!",
|
|
46926
46860
|
noEventsButtonText = "New Event",
|
|
@@ -46932,17 +46866,14 @@ const Table = props => {
|
|
|
46932
46866
|
changeFocusIndex,
|
|
46933
46867
|
onTableFocusChange = () => {},
|
|
46934
46868
|
clearFocusOnOutsideClick = true,
|
|
46935
|
-
// NEW: Props for edit mode focus management
|
|
46936
46869
|
isEditMode = false,
|
|
46937
46870
|
editRowIndex = -1,
|
|
46938
46871
|
onCommentSave = () => {},
|
|
46939
|
-
// NEW: Props for expand functionality
|
|
46940
46872
|
expandable = false,
|
|
46941
46873
|
expandedRows = {},
|
|
46942
46874
|
expandedContent = {},
|
|
46943
46875
|
onExpandRow = () => {},
|
|
46944
46876
|
expandedBackgroundColor = '#E6F0F0',
|
|
46945
|
-
// New prop
|
|
46946
46877
|
onDropdownSelected = () => {},
|
|
46947
46878
|
onCheckboxClick = () => {},
|
|
46948
46879
|
onHeaderCheckboxClick = () => {},
|
|
@@ -46950,32 +46881,25 @@ const Table = props => {
|
|
|
46950
46881
|
onHeroClick = () => {},
|
|
46951
46882
|
dotIndicatorColor = '#34D399',
|
|
46952
46883
|
onEditableClick = () => {},
|
|
46953
|
-
|
|
46884
|
+
resetFiltersKey = 0,
|
|
46885
|
+
// NEW: Add this prop
|
|
46954
46886
|
ref = null
|
|
46955
46887
|
} = props;
|
|
46956
46888
|
const scrollWrapperRef = useRef(null);
|
|
46957
46889
|
const tableBodyRef = useRef(null);
|
|
46958
46890
|
const tableContainerRef = useRef(null);
|
|
46959
46891
|
const [hasTriggered, setHasTriggered] = useState(false);
|
|
46960
|
-
|
|
46961
|
-
// Expose method to clear table focus to parent components
|
|
46962
46892
|
const clearTableFocus = () => {
|
|
46963
46893
|
if (tableBodyRef.current) {
|
|
46964
46894
|
tableBodyRef.current.clearFocus();
|
|
46965
46895
|
}
|
|
46966
46896
|
};
|
|
46967
|
-
|
|
46968
|
-
// Handle focus change from TableBody
|
|
46969
46897
|
const handleTableFocusChange = focusedRowIndex => {
|
|
46970
46898
|
onTableFocusChange(focusedRowIndex);
|
|
46971
46899
|
};
|
|
46972
|
-
|
|
46973
|
-
// Handle comment save - pass through to parent
|
|
46974
46900
|
const handleCommentSave = (rowIndex, commentText) => {
|
|
46975
46901
|
onCommentSave(rowIndex, commentText);
|
|
46976
46902
|
};
|
|
46977
|
-
|
|
46978
|
-
// Expose methods to parent components via ref (if ref is provided)
|
|
46979
46903
|
useImperativeHandle(ref, () => ({
|
|
46980
46904
|
clearTableFocus,
|
|
46981
46905
|
getTableBodyRef: () => tableBodyRef.current
|
|
@@ -46989,17 +46913,13 @@ const Table = props => {
|
|
|
46989
46913
|
scrollHeight,
|
|
46990
46914
|
clientHeight
|
|
46991
46915
|
} = scrollWrapper;
|
|
46992
|
-
|
|
46993
|
-
// Calculate if we're near the bottom
|
|
46994
46916
|
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
|
|
46995
46917
|
if (isNearBottom && data.length > 0) {
|
|
46996
|
-
// Trigger event only if it hasn't been triggered yet
|
|
46997
46918
|
if (!hasTriggered) {
|
|
46998
46919
|
onLastRowsReached();
|
|
46999
46920
|
setHasTriggered(true);
|
|
47000
46921
|
}
|
|
47001
46922
|
} else {
|
|
47002
|
-
// Reset trigger when user scrolls back up outside the threshold
|
|
47003
46923
|
if (hasTriggered) {
|
|
47004
46924
|
setHasTriggered(false);
|
|
47005
46925
|
}
|
|
@@ -47008,14 +46928,10 @@ const Table = props => {
|
|
|
47008
46928
|
scrollWrapper.addEventListener('scroll', handleScroll);
|
|
47009
46929
|
return () => scrollWrapper.removeEventListener('scroll', handleScroll);
|
|
47010
46930
|
}, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
|
|
47011
|
-
|
|
47012
|
-
// Handle outside click to clear focus - UPDATED to respect edit mode
|
|
47013
46931
|
useEffect(() => {
|
|
47014
|
-
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47015
|
-
|
|
46932
|
+
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47016
46933
|
const handleOutsideClick = event => {
|
|
47017
46934
|
if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
|
|
47018
|
-
// Click is outside the table container
|
|
47019
46935
|
if (tableBodyRef.current) {
|
|
47020
46936
|
tableBodyRef.current.clearFocus();
|
|
47021
46937
|
}
|
|
@@ -47025,8 +46941,7 @@ const Table = props => {
|
|
|
47025
46941
|
return () => {
|
|
47026
46942
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
47027
46943
|
};
|
|
47028
|
-
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47029
|
-
|
|
46944
|
+
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47030
46945
|
const getNoDataIcon = icon => {
|
|
47031
46946
|
switch (icon) {
|
|
47032
46947
|
case "Event":
|
|
@@ -47044,7 +46959,6 @@ const Table = props => {
|
|
|
47044
46959
|
case "Upc":
|
|
47045
46960
|
return /*#__PURE__*/React$1.createElement(NoSearchUpcIcon, null);
|
|
47046
46961
|
case "Ntt":
|
|
47047
|
-
// Nothing to Track
|
|
47048
46962
|
return /*#__PURE__*/React$1.createElement(NothingToTrackIcon, null);
|
|
47049
46963
|
default:
|
|
47050
46964
|
return null;
|
|
@@ -47078,7 +46992,8 @@ const Table = props => {
|
|
|
47078
46992
|
onSelectAll: onSelectAll,
|
|
47079
46993
|
expandable: expandable,
|
|
47080
46994
|
onHeaderCheckboxClick: onHeaderCheckboxClick,
|
|
47081
|
-
headerCheckboxStates: headerCheckboxStates
|
|
46995
|
+
headerCheckboxStates: headerCheckboxStates,
|
|
46996
|
+
resetFiltersKey: resetFiltersKey
|
|
47082
46997
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
|
|
47083
46998
|
ref: tableBodyRef,
|
|
47084
46999
|
columns: columns,
|
|
@@ -47129,8 +47044,6 @@ const Table = props => {
|
|
|
47129
47044
|
id: "LoaderWrapper"
|
|
47130
47045
|
}, /*#__PURE__*/React$1.createElement(Loader, null)))));
|
|
47131
47046
|
};
|
|
47132
|
-
|
|
47133
|
-
// Add displayName for better debugging
|
|
47134
47047
|
Table.displayName = 'Table';
|
|
47135
47048
|
|
|
47136
47049
|
const Card = styled$1.div`
|
|
@@ -48205,8 +48118,8 @@ const NewSubitem = ({
|
|
|
48205
48118
|
}, [packageObject]);
|
|
48206
48119
|
useEffect(() => {
|
|
48207
48120
|
if (packageObject && packageObject.brands === negotiatedBrands) return;
|
|
48208
|
-
setIsPackageDuplicated(vendor.packages
|
|
48209
|
-
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages
|
|
48121
|
+
setIsPackageDuplicated(itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
|
|
48122
|
+
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && !itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
|
|
48210
48123
|
}, [negotiatedBrands]);
|
|
48211
48124
|
return /*#__PURE__*/React$1.createElement(NewSubitemContainer, null, /*#__PURE__*/React$1.createElement(Header, null, /*#__PURE__*/React$1.createElement(BackButton, {
|
|
48212
48125
|
onClick: onBack
|