@megha-ui/react 1.3.44 → 1.3.45
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.
|
@@ -1118,6 +1118,12 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1118
1118
|
});
|
|
1119
1119
|
setSearchQueries((prev) => (Object.assign(Object.assign({}, prev), filterObj)));
|
|
1120
1120
|
};
|
|
1121
|
+
const normalizeFixedFilters = (filters) => {
|
|
1122
|
+
return Object.entries(filters)
|
|
1123
|
+
.map(([key, values]) => `${key}:${[...values].sort().join(",")}`)
|
|
1124
|
+
.sort()
|
|
1125
|
+
.join("|");
|
|
1126
|
+
};
|
|
1121
1127
|
const filterDetails = useMemo(() => {
|
|
1122
1128
|
const filterColumn = gridColumns.reduce((acc, column) => {
|
|
1123
1129
|
const query = searchQueries[column.key];
|
|
@@ -1134,6 +1140,13 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1134
1140
|
}
|
|
1135
1141
|
return acc;
|
|
1136
1142
|
}, {});
|
|
1143
|
+
const fixedFilterColumn = fixedColumns.reduce((acc, column) => {
|
|
1144
|
+
const values = fixedFilterValues[column.key] || [];
|
|
1145
|
+
if (values.length > 0) {
|
|
1146
|
+
acc[column.key] = values;
|
|
1147
|
+
}
|
|
1148
|
+
return acc;
|
|
1149
|
+
}, {});
|
|
1137
1150
|
const propFilterColumn = gridColumns.reduce((acc, column) => {
|
|
1138
1151
|
if (filterData) {
|
|
1139
1152
|
const { searchQueries, uniqueSearch } = filterData;
|
|
@@ -1153,6 +1166,14 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1153
1166
|
}
|
|
1154
1167
|
return acc;
|
|
1155
1168
|
}, {});
|
|
1169
|
+
const propFixedFilterColumn = fixedColumns.reduce((acc, column) => {
|
|
1170
|
+
var _a;
|
|
1171
|
+
const values = (filterData && ((_a = filterData.fixedFilterValues) === null || _a === void 0 ? void 0 : _a[column.key])) || [];
|
|
1172
|
+
if (values.length > 0) {
|
|
1173
|
+
acc[column.key] = values;
|
|
1174
|
+
}
|
|
1175
|
+
return acc;
|
|
1176
|
+
}, {});
|
|
1156
1177
|
const sortColumn = gridColumns.reduce((acc, column) => {
|
|
1157
1178
|
const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
|
|
1158
1179
|
if (query) {
|
|
@@ -1167,7 +1188,9 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1167
1188
|
}
|
|
1168
1189
|
return acc;
|
|
1169
1190
|
}, {});
|
|
1170
|
-
const hasFilters = Object.keys(filterColumn).length > 0 ||
|
|
1191
|
+
const hasFilters = Object.keys(filterColumn).length > 0 ||
|
|
1192
|
+
globalInputSearch !== "" ||
|
|
1193
|
+
Object.keys(fixedFilterColumn).length > 0;
|
|
1171
1194
|
return {
|
|
1172
1195
|
hasFilters,
|
|
1173
1196
|
filtersUpdated: Object.keys(filterColumn).sort().toString() !==
|
|
@@ -1178,9 +1201,22 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1178
1201
|
Object.keys(propSortColumn).sort().toString() ||
|
|
1179
1202
|
Object.values(sortColumn).sort().toString() !==
|
|
1180
1203
|
Object.values(propSortColumn).sort().toString() ||
|
|
1204
|
+
normalizeFixedFilters(fixedFilterColumn) !==
|
|
1205
|
+
normalizeFixedFilters(propFixedFilterColumn) ||
|
|
1181
1206
|
(filterData === null || filterData === void 0 ? void 0 : filterData.globalInputSearch) !== globalInputSearch,
|
|
1182
1207
|
};
|
|
1183
|
-
}, [
|
|
1208
|
+
}, [
|
|
1209
|
+
searchQueries,
|
|
1210
|
+
globalInputSearch,
|
|
1211
|
+
uniqueSearch,
|
|
1212
|
+
gridColumns,
|
|
1213
|
+
filteredData,
|
|
1214
|
+
fixedFilterValues,
|
|
1215
|
+
fixedColumns,
|
|
1216
|
+
sortQueries,
|
|
1217
|
+
defaultSort,
|
|
1218
|
+
filterData,
|
|
1219
|
+
]);
|
|
1184
1220
|
const sortDetails = useMemo(() => {
|
|
1185
1221
|
const sortColumn = gridColumns.reduce((acc, column) => {
|
|
1186
1222
|
const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
|
|
@@ -1469,6 +1505,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
|
|
|
1469
1505
|
groupBy: gridGroupBy,
|
|
1470
1506
|
sortQueries: sortQueries,
|
|
1471
1507
|
summariseKeys: summariseKeys,
|
|
1508
|
+
fixedFilterValues,
|
|
1472
1509
|
}), style: {
|
|
1473
1510
|
marginLeft: 6,
|
|
1474
1511
|
cursor: "pointer",
|
package/package.json
CHANGED