sag_components 2.0.0-beta238 → 2.0.0-beta239
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 +43 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40807,25 +40807,48 @@ const TableHeader = ({
|
|
|
40807
40807
|
// Ref for the popup content to measure its dimensions
|
|
40808
40808
|
const popupRef = React$1.useRef(null);
|
|
40809
40809
|
|
|
40810
|
-
// Initialize filter selections for
|
|
40810
|
+
// FIXED: Initialize filter selections ONLY for new columns, preserve existing selections
|
|
40811
40811
|
React$1.useEffect(() => {
|
|
40812
|
-
|
|
40813
|
-
|
|
40814
|
-
|
|
40815
|
-
|
|
40816
|
-
|
|
40817
|
-
|
|
40818
|
-
|
|
40819
|
-
|
|
40820
|
-
|
|
40821
|
-
|
|
40822
|
-
|
|
40823
|
-
|
|
40824
|
-
|
|
40825
|
-
|
|
40826
|
-
|
|
40812
|
+
setFilterSelections(prevSelections => {
|
|
40813
|
+
const newSelections = {
|
|
40814
|
+
...prevSelections
|
|
40815
|
+
};
|
|
40816
|
+
let hasChanges = false;
|
|
40817
|
+
columns.forEach(column => {
|
|
40818
|
+
// Only initialize if column doesn't exist in state yet
|
|
40819
|
+
if (column.filter && column.filterOptions && !newSelections[column.key]) {
|
|
40820
|
+
const initialState = {};
|
|
40821
|
+
const fullList = [{
|
|
40822
|
+
value: 'All',
|
|
40823
|
+
label: 'Select All'
|
|
40824
|
+
}, ...column.filterOptions];
|
|
40825
|
+
fullList.forEach(item => {
|
|
40826
|
+
initialState[item.value] = true;
|
|
40827
|
+
});
|
|
40828
|
+
newSelections[column.key] = initialState;
|
|
40829
|
+
hasChanges = true;
|
|
40830
|
+
} else if (column.filter && column.filterOptions && newSelections[column.key]) {
|
|
40831
|
+
// Column exists - check if we need to add new options that appeared
|
|
40832
|
+
const currentSelections = newSelections[column.key];
|
|
40833
|
+
const newOptions = column.filterOptions.filter(opt => currentSelections[opt.value] === undefined);
|
|
40834
|
+
|
|
40835
|
+
// Only update if there are genuinely new options
|
|
40836
|
+
if (newOptions.length > 0) {
|
|
40837
|
+
const updatedSelections = {
|
|
40838
|
+
...currentSelections
|
|
40839
|
+
};
|
|
40840
|
+
newOptions.forEach(opt => {
|
|
40841
|
+
updatedSelections[opt.value] = true; // New options start selected
|
|
40842
|
+
});
|
|
40843
|
+
newSelections[column.key] = updatedSelections;
|
|
40844
|
+
hasChanges = true;
|
|
40845
|
+
}
|
|
40846
|
+
}
|
|
40847
|
+
});
|
|
40848
|
+
|
|
40849
|
+
// Only return new object if there were actual changes
|
|
40850
|
+
return hasChanges ? newSelections : prevSelections;
|
|
40827
40851
|
});
|
|
40828
|
-
setFilterSelections(initialFilterSelections);
|
|
40829
40852
|
}, [columns]);
|
|
40830
40853
|
|
|
40831
40854
|
// Helper function to check if filter is in default state (all items selected)
|
|
@@ -41196,26 +41219,21 @@ const TableHeader = ({
|
|
|
41196
41219
|
paramType: "Week",
|
|
41197
41220
|
params: [{
|
|
41198
41221
|
label: 'From',
|
|
41199
|
-
type: 'week'
|
|
41222
|
+
type: 'week'
|
|
41200
41223
|
}, {
|
|
41201
41224
|
label: 'To',
|
|
41202
|
-
type: 'week'
|
|
41225
|
+
type: 'week'
|
|
41203
41226
|
}],
|
|
41204
|
-
radioOptions: ['All weeks', 'Custom Range']
|
|
41205
|
-
// ADDED: Pass initialValues for persistence
|
|
41206
|
-
,
|
|
41227
|
+
radioOptions: ['All weeks', 'Custom Range'],
|
|
41207
41228
|
initialValues: currentFilterState ? {
|
|
41208
41229
|
selectedRadio: currentFilterState.selectedRadio,
|
|
41209
41230
|
fields: currentFilterState.fields
|
|
41210
41231
|
} : null,
|
|
41211
41232
|
onApply: data => {
|
|
41212
|
-
// data contains: { selectedRadio, fields }
|
|
41213
41233
|
setFilterState(prev => ({
|
|
41214
41234
|
...prev,
|
|
41215
41235
|
[key]: data
|
|
41216
41236
|
}));
|
|
41217
|
-
|
|
41218
|
-
// Close the popup after applying
|
|
41219
41237
|
setVisibleFilterPopWrapper(null);
|
|
41220
41238
|
}
|
|
41221
41239
|
});
|