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.js
CHANGED
|
@@ -9463,27 +9463,26 @@ const IconContainer$4 = styled__default["default"].div`
|
|
|
9463
9463
|
cursor: pointer;
|
|
9464
9464
|
`;
|
|
9465
9465
|
|
|
9466
|
-
const DropdownMultiNew =
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
} = _ref;
|
|
9466
|
+
const DropdownMultiNew = ({
|
|
9467
|
+
label,
|
|
9468
|
+
labelEmptyValue,
|
|
9469
|
+
options,
|
|
9470
|
+
selectedValue,
|
|
9471
|
+
onChange,
|
|
9472
|
+
required,
|
|
9473
|
+
disabled,
|
|
9474
|
+
width,
|
|
9475
|
+
height,
|
|
9476
|
+
withMarginBottom = true,
|
|
9477
|
+
error,
|
|
9478
|
+
errorMessage,
|
|
9479
|
+
labelColor,
|
|
9480
|
+
xIconShow,
|
|
9481
|
+
checkBoxColor,
|
|
9482
|
+
showLabelOnTop,
|
|
9483
|
+
orderBy,
|
|
9484
|
+
elementType
|
|
9485
|
+
}) => {
|
|
9487
9486
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
9488
9487
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
9489
9488
|
const [showAbove, setShowAbove] = React$1.useState(false);
|
|
@@ -10592,24 +10591,23 @@ const QuarterPopupPicker = ({
|
|
|
10592
10591
|
};
|
|
10593
10592
|
|
|
10594
10593
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10595
|
-
const QuarterPicker =
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
|
-
} = _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
|
+
}) => {
|
|
10613
10611
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
10614
10612
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
10615
10613
|
const [value, setValue] = React$1.useState('');
|
|
@@ -11051,23 +11049,22 @@ const MonthPopupPicker = ({
|
|
|
11051
11049
|
};
|
|
11052
11050
|
|
|
11053
11051
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
11054
|
-
const MonthPicker =
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
} = _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
|
+
}) => {
|
|
11071
11068
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
11072
11069
|
const [isOpen, setIsOpen] = React$1.useState(false);
|
|
11073
11070
|
const [value, setValue] = React$1.useState('');
|
|
@@ -24178,22 +24175,21 @@ const DeleteIcon = styled__default["default"].div`
|
|
|
24178
24175
|
position: absolute;
|
|
24179
24176
|
`;
|
|
24180
24177
|
|
|
24181
|
-
const QuickFilterDropdownSingle =
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
|
|
24196
|
-
} = _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
|
+
}) => {
|
|
24197
24193
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24198
24194
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24199
24195
|
const [inputValue, setInputValue] = React$1.useState("");
|
|
@@ -24650,26 +24646,25 @@ const IconContainer$2 = styled__default["default"].div`
|
|
|
24650
24646
|
cursor: pointer;
|
|
24651
24647
|
`;
|
|
24652
24648
|
|
|
24653
|
-
const QuickFilterDropdownMultiSelection =
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
} = _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
|
+
}) => {
|
|
24673
24668
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
24674
24669
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
24675
24670
|
const [inputValue, setInputValue] = React$1.useState('');
|
|
@@ -35333,21 +35328,26 @@ const WeeksPicker = _ref => {
|
|
|
35333
35328
|
}
|
|
35334
35329
|
}, [allowedWeekRange, restrictToRange]);
|
|
35335
35330
|
React$1.useEffect(() => {
|
|
35336
|
-
if (previousText !== text
|
|
35331
|
+
if (previousText !== text) {
|
|
35332
|
+
setPreviousText(text);
|
|
35333
|
+
}
|
|
35334
|
+
const currentValue = value || selectedValue;
|
|
35335
|
+
if (currentValue) {
|
|
35337
35336
|
const {
|
|
35338
35337
|
startWeek,
|
|
35339
35338
|
endWeek
|
|
35340
|
-
} = parseValueToWeeks(
|
|
35339
|
+
} = parseValueToWeeks(currentValue);
|
|
35341
35340
|
if (startWeek && endWeek) {
|
|
35342
35341
|
const newValue = endWeek === startWeek ? text === 'Week' ? `${text} ${startWeek}` : `${text}${startWeek}` : text === 'Week' ? `${text}s ${startWeek} - ${endWeek}` : `${text}${startWeek} - ${endWeek}`;
|
|
35343
|
-
|
|
35344
|
-
|
|
35345
|
-
onChange
|
|
35342
|
+
if (newValue !== value) {
|
|
35343
|
+
setValue(newValue);
|
|
35344
|
+
if (onChange) {
|
|
35345
|
+
onChange(newValue);
|
|
35346
|
+
}
|
|
35346
35347
|
}
|
|
35347
35348
|
}
|
|
35348
|
-
setPreviousText(text);
|
|
35349
35349
|
}
|
|
35350
|
-
}, [text, value, previousText, onChange]);
|
|
35350
|
+
}, [text, value, selectedValue, previousText, onChange]);
|
|
35351
35351
|
const handleToggle = () => {
|
|
35352
35352
|
setIsOpen(!isOpen);
|
|
35353
35353
|
};
|
|
@@ -35368,11 +35368,6 @@ const WeeksPicker = _ref => {
|
|
|
35368
35368
|
onChange(newValue);
|
|
35369
35369
|
setValue(newValue);
|
|
35370
35370
|
};
|
|
35371
|
-
React$1.useEffect(() => {
|
|
35372
|
-
if (selectedValue !== undefined) {
|
|
35373
|
-
setValue(selectedValue);
|
|
35374
|
-
}
|
|
35375
|
-
}, [selectedValue]);
|
|
35376
35371
|
const handleApply = () => {
|
|
35377
35372
|
setIsOpen(false);
|
|
35378
35373
|
};
|
|
@@ -36181,9 +36176,9 @@ const ToggleSlider = styled__default["default"].span`
|
|
|
36181
36176
|
}
|
|
36182
36177
|
`;
|
|
36183
36178
|
|
|
36184
|
-
/**
|
|
36185
|
-
* ToggleSwitch component for on/off states.
|
|
36186
|
-
* Supports small/large sizes and disabled state.
|
|
36179
|
+
/**
|
|
36180
|
+
* ToggleSwitch component for on/off states.
|
|
36181
|
+
* Supports small/large sizes and disabled state.
|
|
36187
36182
|
*/
|
|
36188
36183
|
function ToggleSwitch(_ref) {
|
|
36189
36184
|
let {
|
|
@@ -40801,7 +40796,8 @@ const TableHeader = ({
|
|
|
40801
40796
|
activeSorts = [],
|
|
40802
40797
|
expandable = false,
|
|
40803
40798
|
onHeaderCheckboxClick = () => {},
|
|
40804
|
-
headerCheckboxStates = {}
|
|
40799
|
+
headerCheckboxStates = {},
|
|
40800
|
+
resetFiltersKey = 0 // NEW: Add this prop
|
|
40805
40801
|
}) => {
|
|
40806
40802
|
const [focusedFilter, setFocusedFilter] = React$1.useState(null);
|
|
40807
40803
|
const [focusedSort, setFocusedSort] = React$1.useState(null);
|
|
@@ -40812,21 +40808,46 @@ const TableHeader = ({
|
|
|
40812
40808
|
left: 0
|
|
40813
40809
|
});
|
|
40814
40810
|
const [filterState, setFilterState] = React$1.useState({});
|
|
40815
|
-
|
|
40816
|
-
// Add persistent filter selections state
|
|
40817
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);
|
|
40816
|
+
|
|
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);
|
|
40818
40836
|
|
|
40819
|
-
|
|
40820
|
-
|
|
40821
|
-
const [activeSortValue, setActiveSortValue] = React$1.useState(null); // Only one sort value
|
|
40837
|
+
// Reset filter state
|
|
40838
|
+
setFilterState({});
|
|
40822
40839
|
|
|
40823
|
-
|
|
40824
|
-
|
|
40840
|
+
// Reset sort state
|
|
40841
|
+
setActiveSortColumn(null);
|
|
40842
|
+
setActiveSortValue(null);
|
|
40825
40843
|
|
|
40826
|
-
|
|
40827
|
-
|
|
40844
|
+
// Close any open popups
|
|
40845
|
+
setVisibleFilterPopWrapper(null);
|
|
40846
|
+
setVisibleSortPopWrapper(null);
|
|
40847
|
+
}
|
|
40848
|
+
}, [resetFiltersKey, columns]);
|
|
40828
40849
|
|
|
40829
|
-
//
|
|
40850
|
+
// Initialize filter selections for new columns
|
|
40830
40851
|
React$1.useEffect(() => {
|
|
40831
40852
|
setFilterSelections(prevSelections => {
|
|
40832
40853
|
const newSelections = {
|
|
@@ -40834,7 +40855,6 @@ const TableHeader = ({
|
|
|
40834
40855
|
};
|
|
40835
40856
|
let hasChanges = false;
|
|
40836
40857
|
columns.forEach(column => {
|
|
40837
|
-
// Only initialize if column doesn't exist in state yet
|
|
40838
40858
|
if (column.filter && column.filterOptions && !newSelections[column.key]) {
|
|
40839
40859
|
const initialState = {};
|
|
40840
40860
|
const fullList = [{
|
|
@@ -40847,69 +40867,48 @@ const TableHeader = ({
|
|
|
40847
40867
|
newSelections[column.key] = initialState;
|
|
40848
40868
|
hasChanges = true;
|
|
40849
40869
|
} else if (column.filter && column.filterOptions && newSelections[column.key]) {
|
|
40850
|
-
// Column exists - check if we need to add new options that appeared
|
|
40851
40870
|
const currentSelections = newSelections[column.key];
|
|
40852
40871
|
const newOptions = column.filterOptions.filter(opt => currentSelections[opt.value] === undefined);
|
|
40853
|
-
|
|
40854
|
-
// Only update if there are genuinely new options
|
|
40855
40872
|
if (newOptions.length > 0) {
|
|
40856
40873
|
const updatedSelections = {
|
|
40857
40874
|
...currentSelections
|
|
40858
40875
|
};
|
|
40859
40876
|
newOptions.forEach(opt => {
|
|
40860
|
-
updatedSelections[opt.value] = true;
|
|
40877
|
+
updatedSelections[opt.value] = true;
|
|
40861
40878
|
});
|
|
40862
40879
|
newSelections[column.key] = updatedSelections;
|
|
40863
40880
|
hasChanges = true;
|
|
40864
40881
|
}
|
|
40865
40882
|
}
|
|
40866
40883
|
});
|
|
40867
|
-
|
|
40868
|
-
// Only return new object if there were actual changes
|
|
40869
40884
|
return hasChanges ? newSelections : prevSelections;
|
|
40870
40885
|
});
|
|
40871
40886
|
}, [columns]);
|
|
40872
|
-
|
|
40873
|
-
// Helper function to check if filter is in default state (all items selected)
|
|
40874
40887
|
const isFilterInDefaultState = columnKey => {
|
|
40875
40888
|
const filterData = filterState[columnKey];
|
|
40876
40889
|
if (!filterData) {
|
|
40877
|
-
return true;
|
|
40890
|
+
return true;
|
|
40878
40891
|
}
|
|
40879
|
-
|
|
40880
|
-
// For range filters, check if "All weeks" is selected
|
|
40881
40892
|
if (filterData.selectedRadio) {
|
|
40882
40893
|
return filterData.selectedRadio === 'all weeks';
|
|
40883
40894
|
}
|
|
40884
|
-
|
|
40885
|
-
// Check if it's in "select all" state with no exclusions
|
|
40886
40895
|
return filterData.isSelectAll && filterData.excluded?.length === 0 && filterData.included?.length === 0;
|
|
40887
40896
|
};
|
|
40888
|
-
|
|
40889
|
-
// Helper function to determine filter icon state
|
|
40890
40897
|
const getFilterIconState = columnKey => {
|
|
40891
40898
|
const isFocused = focusedFilter === columnKey;
|
|
40892
40899
|
const isActive = activeFilters.includes(columnKey);
|
|
40893
40900
|
const isDefault = isFilterInDefaultState(columnKey);
|
|
40894
|
-
|
|
40895
|
-
// If it's in default state (all selected), show as default
|
|
40896
40901
|
if (isDefault) {
|
|
40897
40902
|
return 'default';
|
|
40898
40903
|
}
|
|
40899
|
-
|
|
40900
|
-
// If focused or active and not in default state, show as active
|
|
40901
40904
|
if (isFocused || isActive) {
|
|
40902
40905
|
return 'active';
|
|
40903
40906
|
}
|
|
40904
|
-
|
|
40905
|
-
// If has filter applied but not default, show as active
|
|
40906
40907
|
if (filterState[columnKey]) {
|
|
40907
40908
|
return 'active';
|
|
40908
40909
|
}
|
|
40909
40910
|
return 'default';
|
|
40910
40911
|
};
|
|
40911
|
-
|
|
40912
|
-
// Enhanced function to calculate position with viewport boundary detection
|
|
40913
40912
|
const calculatePopPosition = (iconElement, popupWidth = 300, popupHeight = 400) => {
|
|
40914
40913
|
if (!iconElement) return {
|
|
40915
40914
|
top: 0,
|
|
@@ -40920,32 +40919,20 @@ const TableHeader = ({
|
|
|
40920
40919
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
40921
40920
|
const viewportWidth = window.innerWidth;
|
|
40922
40921
|
const viewportHeight = window.innerHeight;
|
|
40923
|
-
let top = rect.bottom + scrollTop + 4;
|
|
40922
|
+
let top = rect.bottom + scrollTop + 4;
|
|
40924
40923
|
let left = rect.left + scrollLeft;
|
|
40925
|
-
|
|
40926
|
-
// Check if popup would overflow right edge of viewport
|
|
40927
40924
|
if (left + popupWidth > viewportWidth) {
|
|
40928
|
-
// Position to the left of the icon instead
|
|
40929
40925
|
left = rect.right + scrollLeft - popupWidth;
|
|
40930
|
-
|
|
40931
|
-
// If it still overflows on the left, clamp to viewport
|
|
40932
40926
|
if (left < 0) {
|
|
40933
|
-
left = 8;
|
|
40927
|
+
left = 8;
|
|
40934
40928
|
}
|
|
40935
40929
|
}
|
|
40936
|
-
|
|
40937
|
-
// Check if popup would overflow bottom edge of viewport
|
|
40938
40930
|
if (rect.bottom + popupHeight > viewportHeight) {
|
|
40939
|
-
|
|
40940
|
-
top = rect.top + scrollTop - popupHeight - 4; // 4px gap above the icon
|
|
40941
|
-
|
|
40942
|
-
// If it still overflows on the top, clamp to viewport
|
|
40931
|
+
top = rect.top + scrollTop - popupHeight - 4;
|
|
40943
40932
|
if (top < scrollTop) {
|
|
40944
|
-
top = scrollTop + 8;
|
|
40933
|
+
top = scrollTop + 8;
|
|
40945
40934
|
}
|
|
40946
40935
|
}
|
|
40947
|
-
|
|
40948
|
-
// Ensure left position doesn't go negative
|
|
40949
40936
|
if (left < 0) {
|
|
40950
40937
|
left = 8;
|
|
40951
40938
|
}
|
|
@@ -40954,16 +40941,12 @@ const TableHeader = ({
|
|
|
40954
40941
|
left
|
|
40955
40942
|
};
|
|
40956
40943
|
};
|
|
40957
|
-
|
|
40958
|
-
// Function to estimate popup dimensions based on content type
|
|
40959
40944
|
const getEstimatedPopupDimensions = columnKey => {
|
|
40960
40945
|
const column = columns.find(col => col.key === columnKey);
|
|
40961
40946
|
if (!column) return {
|
|
40962
40947
|
width: 300,
|
|
40963
40948
|
height: 400
|
|
40964
40949
|
};
|
|
40965
|
-
|
|
40966
|
-
// Default dimensions
|
|
40967
40950
|
let width = 300;
|
|
40968
40951
|
let height = 400;
|
|
40969
40952
|
if (column.freeTextFilter) {
|
|
@@ -40973,8 +40956,7 @@ const TableHeader = ({
|
|
|
40973
40956
|
width = 300;
|
|
40974
40957
|
height = 300;
|
|
40975
40958
|
} else if (column.filterOptions) {
|
|
40976
|
-
|
|
40977
|
-
const optionCount = column.filterOptions.length + 1; // +1 for "Select All"
|
|
40959
|
+
const optionCount = column.filterOptions.length + 1;
|
|
40978
40960
|
height = Math.min(Math.max(optionCount * 32 + 100, 200), 500);
|
|
40979
40961
|
} else if (column.sortOptions) {
|
|
40980
40962
|
const optionCount = column.sortOptions.length;
|
|
@@ -40985,8 +40967,6 @@ const TableHeader = ({
|
|
|
40985
40967
|
height
|
|
40986
40968
|
};
|
|
40987
40969
|
};
|
|
40988
|
-
|
|
40989
|
-
// Update handleSort to remove onSort call (only opens/closes popup)
|
|
40990
40970
|
const handleSort = key => {
|
|
40991
40971
|
const iconElement = iconRefs.current[`sort-${key}`];
|
|
40992
40972
|
if (iconElement) {
|
|
@@ -40994,7 +40974,7 @@ const TableHeader = ({
|
|
|
40994
40974
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
40995
40975
|
}
|
|
40996
40976
|
setVisibleSortPopWrapper(prevKey => prevKey === key ? null : key);
|
|
40997
|
-
setVisibleFilterPopWrapper(null);
|
|
40977
|
+
setVisibleFilterPopWrapper(null);
|
|
40998
40978
|
};
|
|
40999
40979
|
React$1.useEffect(() => {
|
|
41000
40980
|
if (Object.keys(filterState).length > 0) {
|
|
@@ -41008,46 +40988,29 @@ const TableHeader = ({
|
|
|
41008
40988
|
setPopPosition(calculatePopPosition(iconElement, dimensions.width, dimensions.height));
|
|
41009
40989
|
}
|
|
41010
40990
|
setVisibleFilterPopWrapper(prevKey => prevKey === key ? null : key);
|
|
41011
|
-
setVisibleSortPopWrapper(null);
|
|
40991
|
+
setVisibleSortPopWrapper(null);
|
|
41012
40992
|
};
|
|
41013
|
-
|
|
41014
|
-
// MODIFIED: Handle sort selection - Reset previous sort and apply new one
|
|
41015
40993
|
const handleSortSelectionChange = (columnKey, sortValue) => {
|
|
41016
|
-
// If selecting a new column, reset the previous sort
|
|
41017
40994
|
if (activeSortColumn && activeSortColumn !== columnKey) {
|
|
41018
|
-
// Clear the previous sort
|
|
41019
40995
|
setActiveSortColumn(columnKey);
|
|
41020
40996
|
setActiveSortValue(sortValue);
|
|
41021
40997
|
} else {
|
|
41022
|
-
// Same column or first sort
|
|
41023
40998
|
setActiveSortColumn(columnKey);
|
|
41024
40999
|
setActiveSortValue(sortValue);
|
|
41025
41000
|
}
|
|
41026
|
-
|
|
41027
|
-
// Close the popup after selection
|
|
41028
41001
|
setVisibleSortPopWrapper(null);
|
|
41029
|
-
|
|
41030
|
-
// Call onSort with both column key and selected sort value
|
|
41031
41002
|
if (onSort) {
|
|
41032
41003
|
onSort(columnKey, sortValue);
|
|
41033
41004
|
}
|
|
41034
41005
|
};
|
|
41035
|
-
|
|
41036
|
-
// MODIFIED: Handle sort reset - Clear the active sort
|
|
41037
41006
|
const handleSortReset = columnKey => {
|
|
41038
|
-
// Clear the active sort state
|
|
41039
41007
|
setActiveSortColumn(null);
|
|
41040
41008
|
setActiveSortValue(null);
|
|
41041
|
-
|
|
41042
|
-
// Call onSort to notify that sort was reset
|
|
41043
41009
|
if (onSort) {
|
|
41044
41010
|
onSort(columnKey, null);
|
|
41045
41011
|
}
|
|
41046
41012
|
};
|
|
41047
|
-
|
|
41048
|
-
// Handle filter selection changes - Updated to work with stateless FilterPop
|
|
41049
41013
|
const handleFilterSelectionChange = (columnKey, selectionData) => {
|
|
41050
|
-
// Force immediate synchronous update using callback form
|
|
41051
41014
|
setFilterSelections(prev => {
|
|
41052
41015
|
const updated = {
|
|
41053
41016
|
...prev,
|
|
@@ -41055,15 +41018,11 @@ const TableHeader = ({
|
|
|
41055
41018
|
};
|
|
41056
41019
|
return updated;
|
|
41057
41020
|
});
|
|
41058
|
-
|
|
41059
|
-
// Also update filter state
|
|
41060
41021
|
setFilterState(prev => ({
|
|
41061
41022
|
...prev,
|
|
41062
41023
|
[columnKey]: selectionData.filterData
|
|
41063
41024
|
}));
|
|
41064
41025
|
};
|
|
41065
|
-
|
|
41066
|
-
// Handle filter reset - Updated to work with stateless FilterPop
|
|
41067
41026
|
const handleFilterReset = columnKey => {
|
|
41068
41027
|
const column = columns.find(col => col.key === columnKey);
|
|
41069
41028
|
if (column && column.filterOptions) {
|
|
@@ -41075,14 +41034,10 @@ const TableHeader = ({
|
|
|
41075
41034
|
fullList.forEach(item => {
|
|
41076
41035
|
resetState[item.value] = true;
|
|
41077
41036
|
});
|
|
41078
|
-
|
|
41079
|
-
// Update filter selections immediately
|
|
41080
41037
|
setFilterSelections(prev => ({
|
|
41081
41038
|
...prev,
|
|
41082
41039
|
[columnKey]: resetState
|
|
41083
41040
|
}));
|
|
41084
|
-
|
|
41085
|
-
// Set filter state to "select all" structure
|
|
41086
41041
|
const resetFilterData = {
|
|
41087
41042
|
excluded: [],
|
|
41088
41043
|
included: [],
|
|
@@ -41094,8 +41049,6 @@ const TableHeader = ({
|
|
|
41094
41049
|
}));
|
|
41095
41050
|
}
|
|
41096
41051
|
};
|
|
41097
|
-
|
|
41098
|
-
// Update the click outside handlers
|
|
41099
41052
|
React$1.useEffect(() => {
|
|
41100
41053
|
const handleClickOutside = event => {
|
|
41101
41054
|
if (!event.target.closest(`[data-column="${visibleFilterPopWrapper}"]`) && !event.target.closest('.pop-wrapper')) {
|
|
@@ -41118,8 +41071,6 @@ const TableHeader = ({
|
|
|
41118
41071
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
41119
41072
|
};
|
|
41120
41073
|
}, [visibleSortPopWrapper]);
|
|
41121
|
-
|
|
41122
|
-
// Enhanced position update with better dimension handling
|
|
41123
41074
|
React$1.useEffect(() => {
|
|
41124
41075
|
const updatePosition = () => {
|
|
41125
41076
|
if (visibleSortPopWrapper) {
|
|
@@ -41136,12 +41087,10 @@ const TableHeader = ({
|
|
|
41136
41087
|
}
|
|
41137
41088
|
}
|
|
41138
41089
|
};
|
|
41139
|
-
|
|
41140
|
-
// Debounce the position update for better performance
|
|
41141
41090
|
let timeoutId;
|
|
41142
41091
|
const debouncedUpdatePosition = () => {
|
|
41143
41092
|
clearTimeout(timeoutId);
|
|
41144
|
-
timeoutId = setTimeout(updatePosition, 16);
|
|
41093
|
+
timeoutId = setTimeout(updatePosition, 16);
|
|
41145
41094
|
};
|
|
41146
41095
|
window.addEventListener('scroll', debouncedUpdatePosition, {
|
|
41147
41096
|
passive: true
|
|
@@ -41169,21 +41118,14 @@ const TableHeader = ({
|
|
|
41169
41118
|
const shouldShowActiveIcon = key => {
|
|
41170
41119
|
return isFilterActive(key) || isFilterFocused(key);
|
|
41171
41120
|
};
|
|
41172
|
-
|
|
41173
|
-
// MODIFIED: Check if THIS specific column has an active sort
|
|
41174
41121
|
const shouldShowActiveSortIcon = key => {
|
|
41175
41122
|
const isFocused = focusedSort === key;
|
|
41176
41123
|
const isActive = activeSorts.includes(key);
|
|
41177
41124
|
const hasSelection = activeSortColumn === key && activeSortValue !== null;
|
|
41178
41125
|
return isFocused || isActive || hasSelection;
|
|
41179
41126
|
};
|
|
41180
|
-
|
|
41181
|
-
// Handle header checkbox click
|
|
41182
41127
|
const handleHeaderCheckboxClick = (columnKey, event) => {
|
|
41183
|
-
// Don't prevent the default checkbox behavior
|
|
41184
41128
|
const newValue = event.target.checked;
|
|
41185
|
-
|
|
41186
|
-
// Fire the callback with column info and new value - let parent handle state
|
|
41187
41129
|
if (onHeaderCheckboxClick) {
|
|
41188
41130
|
onHeaderCheckboxClick({
|
|
41189
41131
|
columnName: columnKey,
|
|
@@ -41191,8 +41133,6 @@ const TableHeader = ({
|
|
|
41191
41133
|
});
|
|
41192
41134
|
}
|
|
41193
41135
|
};
|
|
41194
|
-
|
|
41195
|
-
// UPDATED: showColumnFilter with fixed RangePop integration
|
|
41196
41136
|
const showColumnFilter = column => {
|
|
41197
41137
|
const {
|
|
41198
41138
|
key,
|
|
@@ -41227,7 +41167,6 @@ const TableHeader = ({
|
|
|
41227
41167
|
}
|
|
41228
41168
|
});
|
|
41229
41169
|
} else if (rangeFilter) {
|
|
41230
|
-
// Get the current filter state for this column to persist values
|
|
41231
41170
|
const currentFilterState = filterState[key];
|
|
41232
41171
|
return /*#__PURE__*/React__default["default"].createElement(RangePop, {
|
|
41233
41172
|
menuName: title,
|
|
@@ -41271,8 +41210,6 @@ const TableHeader = ({
|
|
|
41271
41210
|
});
|
|
41272
41211
|
}
|
|
41273
41212
|
};
|
|
41274
|
-
|
|
41275
|
-
// MODIFIED: Pass the selected value only for the active sort column
|
|
41276
41213
|
const showColumnSort = column => {
|
|
41277
41214
|
const {
|
|
41278
41215
|
key,
|
|
@@ -41282,8 +41219,6 @@ const TableHeader = ({
|
|
|
41282
41219
|
if (!sortOptions || sortOptions.length === 0) {
|
|
41283
41220
|
return null;
|
|
41284
41221
|
}
|
|
41285
|
-
|
|
41286
|
-
// Only show selected value if this is the active sort column
|
|
41287
41222
|
const selectedValue = activeSortColumn === key ? activeSortValue : null;
|
|
41288
41223
|
return /*#__PURE__*/React__default["default"].createElement(SortPop, {
|
|
41289
41224
|
width: "300px",
|
|
@@ -46930,7 +46865,6 @@ const Table = props => {
|
|
|
46930
46865
|
noDataInSearchMessage = "Try to refine your query and search again",
|
|
46931
46866
|
noDataIcon = "Plus",
|
|
46932
46867
|
noDataSearchIcon = "Plus",
|
|
46933
|
-
// NEW: Props for NoEventsParent section
|
|
46934
46868
|
noEventsTitle = "You haven't created any events yet",
|
|
46935
46869
|
noEventsSubtitle = "Let's get started and create your first one!",
|
|
46936
46870
|
noEventsButtonText = "New Event",
|
|
@@ -46942,17 +46876,14 @@ const Table = props => {
|
|
|
46942
46876
|
changeFocusIndex,
|
|
46943
46877
|
onTableFocusChange = () => {},
|
|
46944
46878
|
clearFocusOnOutsideClick = true,
|
|
46945
|
-
// NEW: Props for edit mode focus management
|
|
46946
46879
|
isEditMode = false,
|
|
46947
46880
|
editRowIndex = -1,
|
|
46948
46881
|
onCommentSave = () => {},
|
|
46949
|
-
// NEW: Props for expand functionality
|
|
46950
46882
|
expandable = false,
|
|
46951
46883
|
expandedRows = {},
|
|
46952
46884
|
expandedContent = {},
|
|
46953
46885
|
onExpandRow = () => {},
|
|
46954
46886
|
expandedBackgroundColor = '#E6F0F0',
|
|
46955
|
-
// New prop
|
|
46956
46887
|
onDropdownSelected = () => {},
|
|
46957
46888
|
onCheckboxClick = () => {},
|
|
46958
46889
|
onHeaderCheckboxClick = () => {},
|
|
@@ -46960,32 +46891,25 @@ const Table = props => {
|
|
|
46960
46891
|
onHeroClick = () => {},
|
|
46961
46892
|
dotIndicatorColor = '#34D399',
|
|
46962
46893
|
onEditableClick = () => {},
|
|
46963
|
-
|
|
46894
|
+
resetFiltersKey = 0,
|
|
46895
|
+
// NEW: Add this prop
|
|
46964
46896
|
ref = null
|
|
46965
46897
|
} = props;
|
|
46966
46898
|
const scrollWrapperRef = React$1.useRef(null);
|
|
46967
46899
|
const tableBodyRef = React$1.useRef(null);
|
|
46968
46900
|
const tableContainerRef = React$1.useRef(null);
|
|
46969
46901
|
const [hasTriggered, setHasTriggered] = React$1.useState(false);
|
|
46970
|
-
|
|
46971
|
-
// Expose method to clear table focus to parent components
|
|
46972
46902
|
const clearTableFocus = () => {
|
|
46973
46903
|
if (tableBodyRef.current) {
|
|
46974
46904
|
tableBodyRef.current.clearFocus();
|
|
46975
46905
|
}
|
|
46976
46906
|
};
|
|
46977
|
-
|
|
46978
|
-
// Handle focus change from TableBody
|
|
46979
46907
|
const handleTableFocusChange = focusedRowIndex => {
|
|
46980
46908
|
onTableFocusChange(focusedRowIndex);
|
|
46981
46909
|
};
|
|
46982
|
-
|
|
46983
|
-
// Handle comment save - pass through to parent
|
|
46984
46910
|
const handleCommentSave = (rowIndex, commentText) => {
|
|
46985
46911
|
onCommentSave(rowIndex, commentText);
|
|
46986
46912
|
};
|
|
46987
|
-
|
|
46988
|
-
// Expose methods to parent components via ref (if ref is provided)
|
|
46989
46913
|
React$1.useImperativeHandle(ref, () => ({
|
|
46990
46914
|
clearTableFocus,
|
|
46991
46915
|
getTableBodyRef: () => tableBodyRef.current
|
|
@@ -46999,17 +46923,13 @@ const Table = props => {
|
|
|
46999
46923
|
scrollHeight,
|
|
47000
46924
|
clientHeight
|
|
47001
46925
|
} = scrollWrapper;
|
|
47002
|
-
|
|
47003
|
-
// Calculate if we're near the bottom
|
|
47004
46926
|
const isNearBottom = scrollTop + clientHeight >= scrollHeight - 56 * lastRowsThreshold;
|
|
47005
46927
|
if (isNearBottom && data.length > 0) {
|
|
47006
|
-
// Trigger event only if it hasn't been triggered yet
|
|
47007
46928
|
if (!hasTriggered) {
|
|
47008
46929
|
onLastRowsReached();
|
|
47009
46930
|
setHasTriggered(true);
|
|
47010
46931
|
}
|
|
47011
46932
|
} else {
|
|
47012
|
-
// Reset trigger when user scrolls back up outside the threshold
|
|
47013
46933
|
if (hasTriggered) {
|
|
47014
46934
|
setHasTriggered(false);
|
|
47015
46935
|
}
|
|
@@ -47018,14 +46938,10 @@ const Table = props => {
|
|
|
47018
46938
|
scrollWrapper.addEventListener('scroll', handleScroll);
|
|
47019
46939
|
return () => scrollWrapper.removeEventListener('scroll', handleScroll);
|
|
47020
46940
|
}, [onLastRowsReached, data.length, lastRowsThreshold, hasTriggered]);
|
|
47021
|
-
|
|
47022
|
-
// Handle outside click to clear focus - UPDATED to respect edit mode
|
|
47023
46941
|
React$1.useEffect(() => {
|
|
47024
|
-
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47025
|
-
|
|
46942
|
+
if (!clearFocusOnOutsideClick || isEditMode) return;
|
|
47026
46943
|
const handleOutsideClick = event => {
|
|
47027
46944
|
if (tableContainerRef.current && !tableContainerRef.current.contains(event.target)) {
|
|
47028
|
-
// Click is outside the table container
|
|
47029
46945
|
if (tableBodyRef.current) {
|
|
47030
46946
|
tableBodyRef.current.clearFocus();
|
|
47031
46947
|
}
|
|
@@ -47035,8 +46951,7 @@ const Table = props => {
|
|
|
47035
46951
|
return () => {
|
|
47036
46952
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
47037
46953
|
};
|
|
47038
|
-
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47039
|
-
|
|
46954
|
+
}, [clearFocusOnOutsideClick, isEditMode]);
|
|
47040
46955
|
const getNoDataIcon = icon => {
|
|
47041
46956
|
switch (icon) {
|
|
47042
46957
|
case "Event":
|
|
@@ -47054,7 +46969,6 @@ const Table = props => {
|
|
|
47054
46969
|
case "Upc":
|
|
47055
46970
|
return /*#__PURE__*/React__default["default"].createElement(NoSearchUpcIcon, null);
|
|
47056
46971
|
case "Ntt":
|
|
47057
|
-
// Nothing to Track
|
|
47058
46972
|
return /*#__PURE__*/React__default["default"].createElement(NothingToTrackIcon, null);
|
|
47059
46973
|
default:
|
|
47060
46974
|
return null;
|
|
@@ -47088,7 +47002,8 @@ const Table = props => {
|
|
|
47088
47002
|
onSelectAll: onSelectAll,
|
|
47089
47003
|
expandable: expandable,
|
|
47090
47004
|
onHeaderCheckboxClick: onHeaderCheckboxClick,
|
|
47091
|
-
headerCheckboxStates: headerCheckboxStates
|
|
47005
|
+
headerCheckboxStates: headerCheckboxStates,
|
|
47006
|
+
resetFiltersKey: resetFiltersKey
|
|
47092
47007
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React__default["default"].createElement(TableBody, {
|
|
47093
47008
|
ref: tableBodyRef,
|
|
47094
47009
|
columns: columns,
|
|
@@ -47139,8 +47054,6 @@ const Table = props => {
|
|
|
47139
47054
|
id: "LoaderWrapper"
|
|
47140
47055
|
}, /*#__PURE__*/React__default["default"].createElement(Loader, null)))));
|
|
47141
47056
|
};
|
|
47142
|
-
|
|
47143
|
-
// Add displayName for better debugging
|
|
47144
47057
|
Table.displayName = 'Table';
|
|
47145
47058
|
|
|
47146
47059
|
const Card = styled.styled.div`
|
|
@@ -48215,8 +48128,8 @@ const NewSubitem = ({
|
|
|
48215
48128
|
}, [packageObject]);
|
|
48216
48129
|
React$1.useEffect(() => {
|
|
48217
48130
|
if (packageObject && packageObject.brands === negotiatedBrands) return;
|
|
48218
|
-
setIsPackageDuplicated(vendor.packages
|
|
48219
|
-
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && vendor.packages
|
|
48131
|
+
setIsPackageDuplicated(itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
|
|
48132
|
+
setIsApplyEnabled(negotiatedBrands.trim().length > 2 && !itemAndPackage.some(obj => obj.name === vendor.name && obj.packages?.some(pkg => pkg.brands === negotiatedBrands)));
|
|
48220
48133
|
}, [negotiatedBrands]);
|
|
48221
48134
|
return /*#__PURE__*/React__default["default"].createElement(NewSubitemContainer, null, /*#__PURE__*/React__default["default"].createElement(Header, null, /*#__PURE__*/React__default["default"].createElement(BackButton, {
|
|
48222
48135
|
onClick: onBack
|