sag_components 2.0.0-beta246 → 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 +140 -235
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +140 -235
- 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.js
CHANGED
|
@@ -10591,24 +10591,23 @@ const QuarterPopupPicker = ({
|
|
|
10591
10591
|
};
|
|
10592
10592
|
|
|
10593
10593
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10594
|
-
const QuarterPicker =
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
} = _ref;
|
|
10594
|
+
const QuarterPicker = ({
|
|
10595
|
+
availableQuarters,
|
|
10596
|
+
// ["Q1-2024"]
|
|
10597
|
+
label,
|
|
10598
|
+
onChange,
|
|
10599
|
+
borderRadius,
|
|
10600
|
+
required,
|
|
10601
|
+
width,
|
|
10602
|
+
height,
|
|
10603
|
+
placeholder,
|
|
10604
|
+
disabled,
|
|
10605
|
+
borderColor,
|
|
10606
|
+
borderColorFocus,
|
|
10607
|
+
textColor,
|
|
10608
|
+
selectedValue,
|
|
10609
|
+
startYear
|
|
10610
|
+
}) => {
|
|
10612
10611
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
10613
10612
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
10614
10613
|
const [value, setValue] = React$1.useState('');
|
|
@@ -11050,23 +11049,22 @@ const MonthPopupPicker = ({
|
|
|
11050
11049
|
};
|
|
11051
11050
|
|
|
11052
11051
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
11053
|
-
const MonthPicker =
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
} = _ref;
|
|
11052
|
+
const MonthPicker = ({
|
|
11053
|
+
availableMonths,
|
|
11054
|
+
label,
|
|
11055
|
+
onChange,
|
|
11056
|
+
borderRadius,
|
|
11057
|
+
required,
|
|
11058
|
+
width,
|
|
11059
|
+
height,
|
|
11060
|
+
placeholder,
|
|
11061
|
+
disabled,
|
|
11062
|
+
borderColor,
|
|
11063
|
+
borderColorFocus,
|
|
11064
|
+
textColor,
|
|
11065
|
+
selectedValue,
|
|
11066
|
+
startYear
|
|
11067
|
+
}) => {
|
|
11070
11068
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
11071
11069
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
11072
11070
|
const [value, setValue] = React$1.useState('');
|
|
@@ -24177,22 +24175,21 @@ const DeleteIcon = styled__default["default"].div`
|
|
|
24177
24175
|
position: absolute;
|
|
24178
24176
|
`;
|
|
24179
24177
|
|
|
24180
|
-
const QuickFilterDropdownSingle =
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
} = _ref;
|
|
24178
|
+
const QuickFilterDropdownSingle = ({
|
|
24179
|
+
label,
|
|
24180
|
+
hoverColor,
|
|
24181
|
+
options,
|
|
24182
|
+
selectedValue,
|
|
24183
|
+
placeHolder,
|
|
24184
|
+
onChange,
|
|
24185
|
+
disabled,
|
|
24186
|
+
width,
|
|
24187
|
+
error,
|
|
24188
|
+
errorMessage,
|
|
24189
|
+
xIconShow,
|
|
24190
|
+
labelColor,
|
|
24191
|
+
showLabelOnTop
|
|
24192
|
+
}) => {
|
|
24196
24193
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24197
24194
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24198
24195
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
@@ -24649,26 +24646,25 @@ const IconContainer$2 = styled__default["default"].div`
|
|
|
24649
24646
|
cursor: pointer;
|
|
24650
24647
|
`;
|
|
24651
24648
|
|
|
24652
|
-
const QuickFilterDropdownMultiSelection =
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
} = _ref;
|
|
24649
|
+
const QuickFilterDropdownMultiSelection = ({
|
|
24650
|
+
label,
|
|
24651
|
+
labelEmptyValue,
|
|
24652
|
+
options,
|
|
24653
|
+
selectedValue,
|
|
24654
|
+
placeHolder,
|
|
24655
|
+
onChange,
|
|
24656
|
+
required,
|
|
24657
|
+
disabled,
|
|
24658
|
+
width,
|
|
24659
|
+
height,
|
|
24660
|
+
error,
|
|
24661
|
+
errorMessage,
|
|
24662
|
+
labelColor,
|
|
24663
|
+
xIconShow,
|
|
24664
|
+
checkBoxColor,
|
|
24665
|
+
showLabelOnTop,
|
|
24666
|
+
dropdownHeight
|
|
24667
|
+
}) => {
|
|
24672
24668
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24673
24669
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24674
24670
|
const [inputValue, setInputValue] = React$1.useState('');
|
|
@@ -36122,19 +36118,15 @@ const ToggleInput = styled__default["default"].input`
|
|
|
36122
36118
|
const ToggleSlider = styled__default["default"].span`
|
|
36123
36119
|
display: block;
|
|
36124
36120
|
position: relative;
|
|
36125
|
-
background: ${
|
|
36126
|
-
|
|
36127
|
-
|
|
36128
|
-
|
|
36129
|
-
} = _ref;
|
|
36130
|
-
return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
|
|
36131
|
-
}};
|
|
36121
|
+
background: ${({
|
|
36122
|
+
checked,
|
|
36123
|
+
disabled
|
|
36124
|
+
}) => checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0"};
|
|
36132
36125
|
border-radius: 999px;
|
|
36133
36126
|
transition: background 0.2s;
|
|
36134
|
-
${
|
|
36135
|
-
|
|
36136
|
-
|
|
36137
|
-
} = _ref2;
|
|
36127
|
+
${({
|
|
36128
|
+
size
|
|
36129
|
+
}) => {
|
|
36138
36130
|
switch (size) {
|
|
36139
36131
|
case "s":
|
|
36140
36132
|
return styled.css`width: 40px; height: 20px;`;
|
|
@@ -36150,18 +36142,14 @@ const ToggleSlider = styled__default["default"].span`
|
|
|
36150
36142
|
left: 3px;
|
|
36151
36143
|
top: 50%;
|
|
36152
36144
|
transform: translateY(-50%);
|
|
36153
|
-
background: ${
|
|
36154
|
-
|
|
36155
|
-
|
|
36156
|
-
} = _ref3;
|
|
36157
|
-
return disabled ? "#D0D0D0" : "#fff";
|
|
36158
|
-
}};
|
|
36145
|
+
background: ${({
|
|
36146
|
+
disabled
|
|
36147
|
+
}) => disabled ? "#D0D0D0" : "#fff"};
|
|
36159
36148
|
border-radius: 50%;
|
|
36160
36149
|
transition: left 0.2s, width 0.2s, height 0.2s;
|
|
36161
|
-
${
|
|
36162
|
-
|
|
36163
|
-
|
|
36164
|
-
} = _ref4;
|
|
36150
|
+
${({
|
|
36151
|
+
size
|
|
36152
|
+
}) => {
|
|
36165
36153
|
switch (size) {
|
|
36166
36154
|
case "s":
|
|
36167
36155
|
return styled.css`width: 14px; height: 14px;`;
|
|
@@ -36171,11 +36159,10 @@ const ToggleSlider = styled__default["default"].span`
|
|
|
36171
36159
|
return styled.css`width: 20px; height: 20px;`;
|
|
36172
36160
|
}
|
|
36173
36161
|
}}
|
|
36174
|
-
left: ${
|
|
36175
|
-
|
|
36176
|
-
|
|
36177
|
-
|
|
36178
|
-
} = _ref5;
|
|
36162
|
+
left: ${({
|
|
36163
|
+
checked,
|
|
36164
|
+
size
|
|
36165
|
+
}) => {
|
|
36179
36166
|
if (!checked) return "3px";
|
|
36180
36167
|
switch (size) {
|
|
36181
36168
|
case "s":
|
|
@@ -36189,9 +36176,9 @@ const ToggleSlider = styled__default["default"].span`
|
|
|
36189
36176
|
}
|
|
36190
36177
|
`;
|
|
36191
36178
|
|
|
36192
|
-
/**
|
|
36193
|
-
* ToggleSwitch component for on/off states.
|
|
36194
|
-
* Supports small/large sizes and disabled state.
|
|
36179
|
+
/**
|
|
36180
|
+
* ToggleSwitch component for on/off states.
|
|
36181
|
+
* Supports small/large sizes and disabled state.
|
|
36195
36182
|
*/
|
|
36196
36183
|
function ToggleSwitch(_ref) {
|
|
36197
36184
|
let {
|
|
@@ -40809,7 +40796,8 @@ const TableHeader = ({
|
|
|
40809
40796
|
activeSorts = [],
|
|
40810
40797
|
expandable = false,
|
|
40811
40798
|
onHeaderCheckboxClick = () => {},
|
|
40812
|
-
headerCheckboxStates = {}
|
|
40799
|
+
headerCheckboxStates = {},
|
|
40800
|
+
resetFiltersKey = 0 // NEW: Add this prop
|
|
40813
40801
|
}) => {
|
|
40814
40802
|
const [focusedFilter, setFocusedFilter] = React$1.useState(null);
|
|
40815
40803
|
const [focusedSort, setFocusedSort] = React$1.useState(null);
|
|
@@ -40820,21 +40808,46 @@ const TableHeader = ({
|
|
|
40820
40808
|
left: 0
|
|
40821
40809
|
});
|
|
40822
40810
|
const [filterState, setFilterState] = React$1.useState({});
|
|
40823
|
-
|
|
40824
|
-
// Add persistent filter selections state
|
|
40825
40811
|
const [filterSelections, setFilterSelections] = React$1.useState({});
|
|
40812
|
+
const [activeSortColumn, setActiveSortColumn] = React$1.useState(null);
|
|
40813
|
+
const [activeSortValue, setActiveSortValue] = React$1.useState(null);
|
|
40814
|
+
const iconRefs = React$1.useRef({});
|
|
40815
|
+
const popupRef = React$1.useRef(null);
|
|
40826
40816
|
|
|
40827
|
-
//
|
|
40828
|
-
|
|
40829
|
-
|
|
40817
|
+
// NEW: Reset internal state when resetFiltersKey changes
|
|
40818
|
+
React$1.useEffect(() => {
|
|
40819
|
+
if (resetFiltersKey > 0) {
|
|
40820
|
+
// Reset filter selections to default (all selected)
|
|
40821
|
+
const resetSelections = {};
|
|
40822
|
+
columns.forEach(column => {
|
|
40823
|
+
if (column.filter && column.filterOptions) {
|
|
40824
|
+
const initialState = {};
|
|
40825
|
+
const fullList = [{
|
|
40826
|
+
value: 'All',
|
|
40827
|
+
label: 'Select All'
|
|
40828
|
+
}, ...column.filterOptions];
|
|
40829
|
+
fullList.forEach(item => {
|
|
40830
|
+
initialState[item.value] = true;
|
|
40831
|
+
});
|
|
40832
|
+
resetSelections[column.key] = initialState;
|
|
40833
|
+
}
|
|
40834
|
+
});
|
|
40835
|
+
setFilterSelections(resetSelections);
|
|
40830
40836
|
|
|
40831
|
-
|
|
40832
|
-
|
|
40837
|
+
// Reset filter state
|
|
40838
|
+
setFilterState({});
|
|
40833
40839
|
|
|
40834
|
-
|
|
40835
|
-
|
|
40840
|
+
// Reset sort state
|
|
40841
|
+
setActiveSortColumn(null);
|
|
40842
|
+
setActiveSortValue(null);
|
|
40843
|
+
|
|
40844
|
+
// Close any open popups
|
|
40845
|
+
setVisibleFilterPopWrapper(null);
|
|
40846
|
+
setVisibleSortPopWrapper(null);
|
|
40847
|
+
}
|
|
40848
|
+
}, [resetFiltersKey, columns]);
|
|
40836
40849
|
|
|
40837
|
-
//
|
|
40850
|
+
// Initialize filter selections for new columns
|
|
40838
40851
|
React$1.useEffect(() => {
|
|
40839
40852
|
setFilterSelections(prevSelections => {
|
|
40840
40853
|
const newSelections = {
|
|
@@ -40842,7 +40855,6 @@ const TableHeader = ({
|
|
|
40842
40855
|
};
|
|
40843
40856
|
let hasChanges = false;
|
|
40844
40857
|
columns.forEach(column => {
|
|
40845
|
-
// Only initialize if column doesn't exist in state yet
|
|
40846
40858
|
if (column.filter && column.filterOptions && !newSelections[column.key]) {
|
|
40847
40859
|
const initialState = {};
|
|
40848
40860
|
const fullList = [{
|
|
@@ -40855,69 +40867,48 @@ const TableHeader = ({
|
|
|
40855
40867
|
newSelections[column.key] = initialState;
|
|
40856
40868
|
hasChanges = true;
|
|
40857
40869
|
} else if (column.filter && column.filterOptions && newSelections[column.key]) {
|
|
40858
|
-
// Column exists - check if we need to add new options that appeared
|
|
40859
40870
|
const currentSelections = newSelections[column.key];
|
|
40860
40871
|
const newOptions = column.filterOptions.filter(opt => currentSelections[opt.value] === undefined);
|
|
40861
|
-
|
|
40862
|
-
// Only update if there are genuinely new options
|
|
40863
40872
|
if (newOptions.length > 0) {
|
|
40864
40873
|
const updatedSelections = {
|
|
40865
40874
|
...currentSelections
|
|
40866
40875
|
};
|
|
40867
40876
|
newOptions.forEach(opt => {
|
|
40868
|
-
updatedSelections[opt.value] = true;
|
|
40877
|
+
updatedSelections[opt.value] = true;
|
|
40869
40878
|
});
|
|
40870
40879
|
newSelections[column.key] = updatedSelections;
|
|
40871
40880
|
hasChanges = true;
|
|
40872
40881
|
}
|
|
40873
40882
|
}
|
|
40874
40883
|
});
|
|
40875
|
-
|
|
40876
|
-
// Only return new object if there were actual changes
|
|
40877
40884
|
return hasChanges ? newSelections : prevSelections;
|
|
40878
40885
|
});
|
|
40879
40886
|
}, [columns]);
|
|
40880
|
-
|
|
40881
|
-
// Helper function to check if filter is in default state (all items selected)
|
|
40882
40887
|
const isFilterInDefaultState = columnKey => {
|
|
40883
40888
|
const filterData = filterState[columnKey];
|
|
40884
40889
|
if (!filterData) {
|
|
40885
|
-
return true;
|
|
40890
|
+
return true;
|
|
40886
40891
|
}
|
|
40887
|
-
|
|
40888
|
-
// For range filters, check if "All weeks" is selected
|
|
40889
40892
|
if (filterData.selectedRadio) {
|
|
40890
40893
|
return filterData.selectedRadio === 'all weeks';
|
|
40891
40894
|
}
|
|
40892
|
-
|
|
40893
|
-
// Check if it's in "select all" state with no exclusions
|
|
40894
40895
|
return filterData.isSelectAll && filterData.excluded?.length === 0 && filterData.included?.length === 0;
|
|
40895
40896
|
};
|
|
40896
|
-
|
|
40897
|
-
// Helper function to determine filter icon state
|
|
40898
40897
|
const getFilterIconState = columnKey => {
|
|
40899
40898
|
const isFocused = focusedFilter === columnKey;
|
|
40900
40899
|
const isActive = activeFilters.includes(columnKey);
|
|
40901
40900
|
const isDefault = isFilterInDefaultState(columnKey);
|
|
40902
|
-
|
|
40903
|
-
// If it's in default state (all selected), show as default
|
|
40904
40901
|
if (isDefault) {
|
|
40905
40902
|
return 'default';
|
|
40906
40903
|
}
|
|
40907
|
-
|
|
40908
|
-
// If focused or active and not in default state, show as active
|
|
40909
40904
|
if (isFocused || isActive) {
|
|
40910
40905
|
return 'active';
|
|
40911
40906
|
}
|
|
40912
|
-
|
|
40913
|
-
// If has filter applied but not default, show as active
|
|
40914
40907
|
if (filterState[columnKey]) {
|
|
40915
40908
|
return 'active';
|
|
40916
40909
|
}
|
|
40917
40910
|
return 'default';
|
|
40918
40911
|
};
|
|
40919
|
-
|
|
40920
|
-
// Enhanced function to calculate position with viewport boundary detection
|
|
40921
40912
|
const calculatePopPosition = (iconElement, popupWidth = 300, popupHeight = 400) => {
|
|
40922
40913
|
if (!iconElement) return {
|
|
40923
40914
|
top: 0,
|
|
@@ -40928,32 +40919,20 @@ const TableHeader = ({
|
|
|
40928
40919
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
40929
40920
|
const viewportWidth = window.innerWidth;
|
|
40930
40921
|
const viewportHeight = window.innerHeight;
|
|
40931
|
-
let top = rect.bottom + scrollTop + 4;
|
|
40922
|
+
let top = rect.bottom + scrollTop + 4;
|
|
40932
40923
|
let left = rect.left + scrollLeft;
|
|
40933
|
-
|
|
40934
|
-
// Check if popup would overflow right edge of viewport
|
|
40935
40924
|
if (left + popupWidth > viewportWidth) {
|
|
40936
|
-
// Position to the left of the icon instead
|
|
40937
40925
|
left = rect.right + scrollLeft - popupWidth;
|
|
40938
|
-
|
|
40939
|
-
// If it still overflows on the left, clamp to viewport
|
|
40940
40926
|
if (left < 0) {
|
|
40941
|
-
left = 8;
|
|
40927
|
+
left = 8;
|
|
40942
40928
|
}
|
|
40943
40929
|
}
|
|
40944
|
-
|
|
40945
|
-
// Check if popup would overflow bottom edge of viewport
|
|
40946
40930
|
if (rect.bottom + popupHeight > viewportHeight) {
|
|
40947
|
-
|
|
40948
|
-
top = rect.top + scrollTop - popupHeight - 4; // 4px gap above the icon
|
|
40949
|
-
|
|
40950
|
-
// If it still overflows on the top, clamp to viewport
|
|
40931
|
+
top = rect.top + scrollTop - popupHeight - 4;
|
|
40951
40932
|
if (top < scrollTop) {
|
|
40952
|
-
top = scrollTop + 8;
|
|
40933
|
+
top = scrollTop + 8;
|
|
40953
40934
|
}
|
|
40954
40935
|
}
|
|
40955
|
-
|
|
40956
|
-
// Ensure left position doesn't go negative
|
|
40957
40936
|
if (left < 0) {
|
|
40958
40937
|
left = 8;
|
|
40959
40938
|
}
|
|
@@ -40962,16 +40941,12 @@ const TableHeader = ({
|
|
|
40962
40941
|
left
|
|
40963
40942
|
};
|
|
40964
40943
|
};
|
|
40965
|
-
|
|
40966
|
-
// Function to estimate popup dimensions based on content type
|
|
40967
40944
|
const getEstimatedPopupDimensions = columnKey => {
|
|
40968
40945
|
const column = columns.find(col => col.key === columnKey);
|
|
40969
40946
|
if (!column) return {
|
|
40970
40947
|
width: 300,
|
|
40971
40948
|
height: 400
|
|
40972
40949
|
};
|
|
40973
|
-
|
|
40974
|
-
// Default dimensions
|
|
40975
40950
|
let width = 300;
|
|
40976
40951
|
let height = 400;
|
|
40977
40952
|
if (column.freeTextFilter) {
|
|
@@ -40981,8 +40956,7 @@ const TableHeader = ({
|
|
|
40981
40956
|
width = 300;
|
|
40982
40957
|
height = 300;
|
|
40983
40958
|
} else if (column.filterOptions) {
|
|
40984
|
-
|
|
40985
|
-
const optionCount = column.filterOptions.length + 1; // +1 for "Select All"
|
|
40959
|
+
const optionCount = column.filterOptions.length + 1;
|
|
40986
40960
|
height = Math.min(Math.max(optionCount * 32 + 100, 200), 500);
|
|
40987
40961
|
} else if (column.sortOptions) {
|
|
40988
40962
|
const optionCount = column.sortOptions.length;
|
|
@@ -40993,8 +40967,6 @@ const TableHeader = ({
|
|
|
40993
40967
|
height
|
|
40994
40968
|
};
|
|
40995
40969
|
};
|
|
40996
|
-
|
|
40997
|
-
// Update handleSort to remove onSort call (only opens/closes popup)
|
|
40998
40970
|
const handleSort = key => {
|
|
40999
40971
|
const iconElement = iconRefs.current[`sort-${key}`];
|
|
41000
40972
|
if (iconElement) {
|
|
@@ -41002,7 +40974,7 @@ const TableHeader = ({
|
|
|
41002
40974
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
41003
40975
|
}
|
|
41004
40976
|
setVisibleSortPopWrapper(prevKey => prevKey === key ? null : key);
|
|
41005
|
-
setVisibleFilterPopWrapper(null);
|
|
40977
|
+
setVisibleFilterPopWrapper(null);
|
|
41006
40978
|
};
|
|
41007
40979
|
React$1.useEffect(() => {
|
|
41008
40980
|
if (Object.keys(filterState).length > 0) {
|
|
@@ -41016,46 +40988,29 @@ const TableHeader = ({
|
|
|
41016
40988
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
41017
40989
|
}
|
|
41018
40990
|
setVisibleFilterPopWrapper(prevKey => prevKey === key ? null : key);
|
|
41019
|
-
setVisibleSortPopWrapper(null);
|
|
40991
|
+
setVisibleSortPopWrapper(null);
|
|
41020
40992
|
};
|
|
41021
|
-
|
|
41022
|
-
// MODIFIED: Handle sort selection - Reset previous sort and apply new one
|
|
41023
40993
|
const handleSortSelectionChange = (columnKey, sortValue) => {
|
|
41024
|
-
// If selecting a new column, reset the previous sort
|
|
41025
40994
|
if (activeSortColumn && activeSortColumn !== columnKey) {
|
|
41026
|
-
// Clear the previous sort
|
|
41027
40995
|
setActiveSortColumn(columnKey);
|
|
41028
40996
|
setActiveSortValue(sortValue);
|
|
41029
40997
|
} else {
|
|
41030
|
-
// Same column or first sort
|
|
41031
40998
|
setActiveSortColumn(columnKey);
|
|
41032
40999
|
setActiveSortValue(sortValue);
|
|
41033
41000
|
}
|
|
41034
|
-
|
|
41035
|
-
// Close the popup after selection
|
|
41036
41001
|
setVisibleSortPopWrapper(null);
|
|
41037
|
-
|
|
41038
|
-
// Call onSort with both column key and selected sort value
|
|
41039
41002
|
if (onSort) {
|
|
41040
41003
|
onSort(columnKey, sortValue);
|
|
41041
41004
|
}
|
|
41042
41005
|
};
|
|
41043
|
-
|
|
41044
|
-
// MODIFIED: Handle sort reset - Clear the active sort
|
|
41045
41006
|
const handleSortReset = columnKey => {
|
|
41046
|
-
// Clear the active sort state
|
|
41047
41007
|
setActiveSortColumn(null);
|
|
41048
41008
|
setActiveSortValue(null);
|
|
41049
|
-
|
|
41050
|
-
// Call onSort to notify that sort was reset
|
|
41051
41009
|
if (onSort) {
|
|
41052
41010
|
onSort(columnKey, null);
|
|
41053
41011
|
}
|
|
41054
41012
|
};
|
|
41055
|
-
|
|
41056
|
-
// Handle filter selection changes - Updated to work with stateless FilterPop
|
|
41057
41013
|
const handleFilterSelectionChange = (columnKey, selectionData) => {
|
|
41058
|
-
// Force immediate synchronous update using callback form
|
|
41059
41014
|
setFilterSelections(prev => {
|
|
41060
41015
|
const updated = {
|
|
41061
41016
|
...prev,
|
|
@@ -41063,15 +41018,11 @@ const TableHeader = ({
|
|
|
41063
41018
|
};
|
|
41064
41019
|
return updated;
|
|
41065
41020
|
});
|
|
41066
|
-
|
|
41067
|
-
// Also update filter state
|
|
41068
41021
|
setFilterState(prev => ({
|
|
41069
41022
|
...prev,
|
|
41070
41023
|
[columnKey]: selectionData.filterData
|
|
41071
41024
|
}));
|
|
41072
41025
|
};
|
|
41073
|
-
|
|
41074
|
-
// Handle filter reset - Updated to work with stateless FilterPop
|
|
41075
41026
|
const handleFilterReset = columnKey => {
|
|
41076
41027
|
const column = columns.find(col => col.key === columnKey);
|
|
41077
41028
|
if (column && column.filterOptions) {
|
|
@@ -41083,14 +41034,10 @@ const TableHeader = ({
|
|
|
41083
41034
|
fullList.forEach(item => {
|
|
41084
41035
|
resetState[item.value] = true;
|
|
41085
41036
|
});
|
|
41086
|
-
|
|
41087
|
-
// Update filter selections immediately
|
|
41088
41037
|
setFilterSelections(prev => ({
|
|
41089
41038
|
...prev,
|
|
41090
41039
|
[columnKey]: resetState
|
|
41091
41040
|
}));
|
|
41092
|
-
|
|
41093
|
-
// Set filter state to "select all" structure
|
|
41094
41041
|
const resetFilterData = {
|
|
41095
41042
|
excluded: [],
|
|
41096
41043
|
included: [],
|
|
@@ -41102,8 +41049,6 @@ const TableHeader = ({
|
|
|
41102
41049
|
}));
|
|
41103
41050
|
}
|
|
41104
41051
|
};
|
|
41105
|
-
|
|
41106
|
-
// Update the click outside handlers
|
|
41107
41052
|
React$1.useEffect(() => {
|
|
41108
41053
|
const handleClickOutside = event => {
|
|
41109
41054
|
if (!event.target.closest(`[data-column="${visibleFilterPopWrapper}"]`) && !event.target.closest('.pop-wrapper')) {
|
|
@@ -41126,8 +41071,6 @@ const TableHeader = ({
|
|
|
41126
41071
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
41127
41072
|
};
|
|
41128
41073
|
}, [visibleSortPopWrapper]);
|
|
41129
|
-
|
|
41130
|
-
// Enhanced position update with better dimension handling
|
|
41131
41074
|
React$1.useEffect(() => {
|
|
41132
41075
|
const updatePosition = () => {
|
|
41133
41076
|
if (visibleSortPopWrapper) {
|
|
@@ -41144,12 +41087,10 @@ const TableHeader = ({
|
|
|
41144
41087
|
}
|
|
41145
41088
|
}
|
|
41146
41089
|
};
|
|
41147
|
-
|
|
41148
|
-
// Debounce the position update for better performance
|
|
41149
41090
|
let timeoutId;
|
|
41150
41091
|
const debouncedUpdatePosition = () => {
|
|
41151
41092
|
clearTimeout(timeoutId);
|
|
41152
|
-
timeoutId = setTimeout(updatePosition, 16);
|
|
41093
|
+
timeoutId = setTimeout(updatePosition, 16);
|
|
41153
41094
|
};
|
|
41154
41095
|
window.addEventListener('scroll', debouncedUpdatePosition, {
|
|
41155
41096
|
passive: true
|
|
@@ -41177,21 +41118,14 @@ const TableHeader = ({
|
|
|
41177
41118
|
const shouldShowActiveIcon = key => {
|
|
41178
41119
|
return isFilterActive(key) || isFilterFocused(key);
|
|
41179
41120
|
};
|
|
41180
|
-
|
|
41181
|
-
// MODIFIED: Check if THIS specific column has an active sort
|
|
41182
41121
|
const shouldShowActiveSortIcon = key => {
|
|
41183
41122
|
const isFocused = focusedSort === key;
|
|
41184
41123
|
const isActive = activeSorts.includes(key);
|
|
41185
41124
|
const hasSelection = activeSortColumn === key && activeSortValue !== null;
|
|
41186
41125
|
return isFocused || isActive || hasSelection;
|
|
41187
41126
|
};
|
|
41188
|
-
|
|
41189
|
-
// Handle header checkbox click
|
|
41190
41127
|
const handleHeaderCheckboxClick = (columnKey, event) => {
|
|
41191
|
-
// Don't prevent the default checkbox behavior
|
|
41192
41128
|
const newValue = event.target.checked;
|
|
41193
|
-
|
|
41194
|
-
// Fire the callback with column info and new value - let parent handle state
|
|
41195
41129
|
if (onHeaderCheckboxClick) {
|
|
41196
41130
|
onHeaderCheckboxClick({
|
|
41197
41131
|
columnName: columnKey,
|
|
@@ -41199,8 +41133,6 @@ const TableHeader = ({
|
|
|
41199
41133
|
});
|
|
41200
41134
|
}
|
|
41201
41135
|
};
|
|
41202
|
-
|
|
41203
|
-
// UPDATED: showColumnFilter with fixed RangePop integration
|
|
41204
41136
|
const showColumnFilter = column => {
|
|
41205
41137
|
const {
|
|
41206
41138
|
key,
|
|
@@ -41235,7 +41167,6 @@ const TableHeader = ({
|
|
|
41235
41167
|
}
|
|
41236
41168
|
});
|
|
41237
41169
|
} else if (rangeFilter) {
|
|
41238
|
-
// Get the current filter state for this column to persist values
|
|
41239
41170
|
const currentFilterState = filterState[key];
|
|
41240
41171
|
return /*#__PURE__*/React__default["default"].createElement(RangePop, {
|
|
41241
41172
|
menuName: title,
|
|
@@ -41279,8 +41210,6 @@ const TableHeader = ({
|
|
|
41279
41210
|
});
|
|
41280
41211
|
}
|
|
41281
41212
|
};
|
|
41282
|
-
|
|
41283
|
-
// MODIFIED: Pass the selected value only for the active sort column
|
|
41284
41213
|
const showColumnSort = column => {
|
|
41285
41214
|
const {
|
|
41286
41215
|
key,
|
|
@@ -41290,8 +41219,6 @@ const TableHeader = ({
|
|
|
41290
41219
|
if (!sortOptions || sortOptions.length === 0) {
|
|
41291
41220
|
return null;
|
|
41292
41221
|
}
|
|
41293
|
-
|
|
41294
|
-
// Only show selected value if this is the active sort column
|
|
41295
41222
|
const selectedValue = activeSortColumn === key ? activeSortValue : null;
|
|
41296
41223
|
return /*#__PURE__*/React__default["default"].createElement(SortPop, {
|
|
41297
41224
|
width: "300px",
|
|
@@ -46938,7 +46865,6 @@ const Table = props => {
|
|
|
46938
46865
|
noDataInSearchMessage = "Try to refine your query and search again",
|
|
46939
46866
|
noDataIcon = "Plus",
|
|
46940
46867
|
noDataSearchIcon = "Plus",
|
|
46941
|
-
// NEW: Props for NoEventsParent section
|
|
46942
46868
|
noEventsTitle = "You haven't created any events yet",
|
|
46943
46869
|
noEventsSubtitle = "Let's get started and create your first one!",
|
|
46944
46870
|
noEventsButtonText = "New Event",
|
|
@@ -46950,17 +46876,14 @@ const Table = props => {
|
|
|
46950
46876
|
changeFocusIndex,
|
|
46951
46877
|
onTableFocusChange = () => {},
|
|
46952
46878
|
clearFocusOnOutsideClick = true,
|
|
46953
|
-
// NEW: Props for edit mode focus management
|
|
46954
46879
|
isEditMode = false,
|
|
46955
46880
|
editRowIndex = -1,
|
|
46956
46881
|
onCommentSave = () => {},
|
|
46957
|
-
// NEW: Props for expand functionality
|
|
46958
46882
|
expandable = false,
|
|
46959
46883
|
expandedRows = {},
|
|
46960
46884
|
expandedContent = {},
|
|
46961
46885
|
onExpandRow = () => {},
|
|
46962
46886
|
expandedBackgroundColor = '#E6F0F0',
|
|
46963
|
-
// New prop
|
|
46964
46887
|
onDropdownSelected = () => {},
|
|
46965
46888
|
onCheckboxClick = () => {},
|
|
46966
46889
|
onHeaderCheckboxClick = () => {},
|
|
@@ -46968,32 +46891,25 @@ const Table = props => {
|
|
|
46968
46891
|
onHeroClick = () => {},
|
|
46969
46892
|
dotIndicatorColor = '#34D399',
|
|
46970
46893
|
onEditableClick = () => {},
|
|
46971
|
-
|
|
46894
|
+
resetFiltersKey = 0,
|
|
46895
|
+
// NEW: Add this prop
|
|
46972
46896
|
ref = null
|
|
46973
46897
|
} = props;
|
|
46974
46898
|
const scrollWrapperRef = React$1.useRef(null);
|
|
46975
46899
|
const tableBodyRef = React$1.useRef(null);
|
|
46976
46900
|
const tableContainerRef = React$1.useRef(null);
|
|
46977
46901
|
const [hasTriggered, setHasTriggered] = React$1.useState(false);
|
|
46978
|
-
|
|
46979
|
-
// Expose method to clear table focus to parent components
|
|
46980
46902
|
const clearTableFocus = () => {
|
|
46981
46903
|
if (tableBodyRef.current) {
|
|
46982
46904
|
tableBodyRef.current.clearFocus();
|
|
46983
46905
|
}
|
|
46984
46906
|
};
|
|
46985
|
-
|
|
46986
|
-
// Handle focus change from TableBody
|
|
46987
46907
|
const handleTableFocusChange = focusedRowIndex => {
|
|
46988
46908
|
onTableFocusChange(focusedRowIndex);
|
|
46989
46909
|
};
|
|
46990
|
-
|
|
46991
|
-
// Handle comment save - pass through to parent
|
|
46992
46910
|
const handleCommentSave = (rowIndex, commentText) => {
|
|
46993
46911
|
onCommentSave(rowIndex, commentText);
|
|
46994
46912
|
};
|
|
46995
|
-
|
|
46996
|
-
// Expose methods to parent components via ref (if ref is provided)
|
|
46997
46913
|
React$1.useImperativeHandle(ref, () => ({
|
|
46998
46914
|
clearTableFocus,
|
|
46999
46915
|
getTableBodyRef: () => tableBodyRef.current
|
|
@@ -47007,17 +46923,13 @@ const Table = props => {
|
|
|
47007
46923
|
scrollHeight,
|
|
47008
46924
|
clientHeight
|
|
47009
46925
|
} = scrollWrapper;
|
|
47010
|
-
|
|
47011
|
-
// Calculate if we're near the bottom
|
|
47012
46926
|
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
|
|
47013
46927
|
if (isNearBottom && data.length > 0) {
|
|
47014
|
-
// Trigger event only if it hasn't been triggered yet
|
|
47015
46928
|
if (!hasTriggered) {
|
|
47016
46929
|
onLastRowsReached();
|
|
47017
46930
|
setHasTriggered(true);
|
|
47018
46931
|
}
|
|
47019
46932
|
} else {
|
|
47020
|
-
// Reset trigger when user scrolls back up outside the threshold
|
|
47021
46933
|
if (hasTriggered) {
|
|
47022
46934
|
setHasTriggered(false);
|
|
47023
46935
|
}
|
|
@@ -47026,14 +46938,10 @@ const Table = props => {
|
|
|
47026
46938
|
scrollWrapper.addEventListener('scroll', handleScroll);
|
|
47027
46939
|
return () => scrollWrapper.removeEventListener('scroll', handleScroll);
|
|
47028
46940
|
}, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
|
|
47029
|
-
|
|
47030
|
-
// Handle outside click to clear focus - UPDATED to respect edit mode
|
|
47031
46941
|
React$1.useEffect(() => {
|
|
47032
|
-
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47033
|
-
|
|
46942
|
+
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47034
46943
|
const handleOutsideClick = event => {
|
|
47035
46944
|
if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
|
|
47036
|
-
// Click is outside the table container
|
|
47037
46945
|
if (tableBodyRef.current) {
|
|
47038
46946
|
tableBodyRef.current.clearFocus();
|
|
47039
46947
|
}
|
|
@@ -47043,8 +46951,7 @@ const Table = props => {
|
|
|
47043
46951
|
return () => {
|
|
47044
46952
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
47045
46953
|
};
|
|
47046
|
-
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47047
|
-
|
|
46954
|
+
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47048
46955
|
const getNoDataIcon = icon => {
|
|
47049
46956
|
switch (icon) {
|
|
47050
46957
|
case "Event":
|
|
@@ -47062,7 +46969,6 @@ const Table = props => {
|
|
|
47062
46969
|
case "Upc":
|
|
47063
46970
|
return /*#__PURE__*/React__default["default"].createElement(NoSearchUpcIcon, null);
|
|
47064
46971
|
case "Ntt":
|
|
47065
|
-
// Nothing to Track
|
|
47066
46972
|
return /*#__PURE__*/React__default["default"].createElement(NothingToTrackIcon, null);
|
|
47067
46973
|
default:
|
|
47068
46974
|
return null;
|
|
@@ -47096,7 +47002,8 @@ const Table = props => {
|
|
|
47096
47002
|
onSelectAll: onSelectAll,
|
|
47097
47003
|
expandable: expandable,
|
|
47098
47004
|
onHeaderCheckboxClick: onHeaderCheckboxClick,
|
|
47099
|
-
headerCheckboxStates: headerCheckboxStates
|
|
47005
|
+
headerCheckboxStates: headerCheckboxStates,
|
|
47006
|
+
resetFiltersKey: resetFiltersKey
|
|
47100
47007
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React__default["default"].createElement(TableBody, {
|
|
47101
47008
|
ref: tableBodyRef,
|
|
47102
47009
|
columns: columns,
|
|
@@ -47147,8 +47054,6 @@ const Table = props => {
|
|
|
47147
47054
|
id: "LoaderWrapper"
|
|
47148
47055
|
}, /*#__PURE__*/React__default["default"].createElement(Loader, null)))));
|
|
47149
47056
|
};
|
|
47150
|
-
|
|
47151
|
-
// Add displayName for better debugging
|
|
47152
47057
|
Table.displayName = 'Table';
|
|
47153
47058
|
|
|
47154
47059
|
const Card = styled.styled.div`
|