@megha-ui/react 1.3.120 → 1.3.121

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.
@@ -1025,6 +1025,107 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1025
1025
  setRowOpened(updatedRowOpened);
1026
1026
  setOpenedRows && setOpenedRows(updatedRowOpened);
1027
1027
  };
1028
+ const filterDetails = useMemo(() => {
1029
+ const filterColumn = gridColumns.reduce((acc, column) => {
1030
+ const query = searchQueries[column.key];
1031
+ const uniqeValues = [
1032
+ ...new Set(filteredData.map((data) => { var _a; return data[column.key] && ((_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()); })),
1033
+ ].sort();
1034
+ if (query &&
1035
+ (query.text !== "" || query.type !== defaultSearchOperation)) {
1036
+ acc[column.key] = query.text;
1037
+ }
1038
+ else if (uniqueSearch[column.key] &&
1039
+ uniqeValues.toString() !== uniqueSearch[column.key].sort().toString()) {
1040
+ acc[column.key] = uniqueSearch[column.key].join(",");
1041
+ }
1042
+ return acc;
1043
+ }, {});
1044
+ const fixedFilterColumn = fixedColumns.reduce((acc, column) => {
1045
+ const values = fixedFilterValues[column.key] || [];
1046
+ if (values.length > 0) {
1047
+ acc[column.key] = values;
1048
+ }
1049
+ return acc;
1050
+ }, {});
1051
+ const propFilterColumn = gridColumns.reduce((acc, column) => {
1052
+ if (filterData) {
1053
+ const { searchQueries, uniqueSearch } = filterData;
1054
+ const query = searchQueries[column.key];
1055
+ const uniqeValues = [
1056
+ ...new Set(filteredData.map((data) => { var _a; return data[column.key] && ((_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()); })),
1057
+ ].sort();
1058
+ if (query &&
1059
+ (query.text !== "" || query.type !== defaultSearchOperation)) {
1060
+ acc[column.key] = query.text;
1061
+ }
1062
+ else if (uniqueSearch[column.key] &&
1063
+ uniqeValues.toString() !==
1064
+ uniqueSearch[column.key].sort().toString()) {
1065
+ acc[column.key] = uniqueSearch[column.key].join(",");
1066
+ }
1067
+ }
1068
+ return acc;
1069
+ }, {});
1070
+ const propFixedFilterColumn = fixedColumns.reduce((acc, column) => {
1071
+ var _a;
1072
+ const values = (filterData && ((_a = filterData.fixedFilterValues) === null || _a === void 0 ? void 0 : _a[column.key])) || [];
1073
+ if (values.length > 0) {
1074
+ acc[column.key] = values;
1075
+ }
1076
+ return acc;
1077
+ }, {});
1078
+ const sortColumn = gridColumns.reduce((acc, column) => {
1079
+ const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
1080
+ if (query) {
1081
+ acc[column.key] = query;
1082
+ }
1083
+ return acc;
1084
+ }, {});
1085
+ const propSortColumn = gridColumns.reduce((acc, column) => {
1086
+ const query = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort[column.key];
1087
+ if (query) {
1088
+ acc[column.key] = query;
1089
+ }
1090
+ return acc;
1091
+ }, {});
1092
+ const hasFilters = Object.keys(filterColumn).length > 0 ||
1093
+ globalInputSearch !== "" ||
1094
+ Object.keys(fixedFilterColumn).length > 0;
1095
+ return {
1096
+ hasFilters,
1097
+ filtersUpdated: Object.keys(filterColumn).sort().toString() !==
1098
+ Object.keys(propFilterColumn).sort().toString() ||
1099
+ Object.values(filterColumn).sort().toString() !==
1100
+ Object.values(propFilterColumn).sort().toString() ||
1101
+ Object.keys(sortColumn).sort().toString() !==
1102
+ Object.keys(propSortColumn).sort().toString() ||
1103
+ Object.values(sortColumn).sort().toString() !==
1104
+ Object.values(propSortColumn).sort().toString() ||
1105
+ normalizeFixedFilters(fixedFilterColumn) !==
1106
+ normalizeFixedFilters(propFixedFilterColumn) ||
1107
+ (filterData === null || filterData === void 0 ? void 0 : filterData.globalInputSearch) !== globalInputSearch,
1108
+ };
1109
+ }, [
1110
+ searchQueries,
1111
+ globalInputSearch,
1112
+ uniqueSearch,
1113
+ gridColumns,
1114
+ filteredData,
1115
+ fixedFilterValues,
1116
+ fixedColumns,
1117
+ sortQueries,
1118
+ defaultSort,
1119
+ filterData,
1120
+ ]);
1121
+ const shouldShowHeaderActionsSpacer = isSummarise ||
1122
+ showHideAvailable ||
1123
+ exportAvailable ||
1124
+ isHideDupsAvailable ||
1125
+ fullScreen ||
1126
+ freezeColumnsAvailable ||
1127
+ filterDetails.filtersUpdated ||
1128
+ hasCustomOperation;
1028
1129
  useEffect(() => {
1029
1130
  if (showHideAvailable ||
1030
1131
  exportAvailable ||
@@ -1128,99 +1229,6 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1128
1229
  .sort()
1129
1230
  .join("|");
1130
1231
  };
1131
- const filterDetails = useMemo(() => {
1132
- const filterColumn = gridColumns.reduce((acc, column) => {
1133
- const query = searchQueries[column.key];
1134
- const uniqeValues = [
1135
- ...new Set(filteredData.map((data) => { var _a; return data[column.key] && ((_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()); })),
1136
- ].sort();
1137
- if (query &&
1138
- (query.text !== "" || query.type !== defaultSearchOperation)) {
1139
- acc[column.key] = query.text;
1140
- }
1141
- else if (uniqueSearch[column.key] &&
1142
- uniqeValues.toString() !== uniqueSearch[column.key].sort().toString()) {
1143
- acc[column.key] = uniqueSearch[column.key].join(",");
1144
- }
1145
- return acc;
1146
- }, {});
1147
- const fixedFilterColumn = fixedColumns.reduce((acc, column) => {
1148
- const values = fixedFilterValues[column.key] || [];
1149
- if (values.length > 0) {
1150
- acc[column.key] = values;
1151
- }
1152
- return acc;
1153
- }, {});
1154
- const propFilterColumn = gridColumns.reduce((acc, column) => {
1155
- if (filterData) {
1156
- const { searchQueries, uniqueSearch } = filterData;
1157
- const query = searchQueries[column.key];
1158
- const uniqeValues = [
1159
- ...new Set(filteredData.map((data) => { var _a; return data[column.key] && ((_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()); })),
1160
- ].sort();
1161
- if (query &&
1162
- (query.text !== "" || query.type !== defaultSearchOperation)) {
1163
- acc[column.key] = query.text;
1164
- }
1165
- else if (uniqueSearch[column.key] &&
1166
- uniqeValues.toString() !==
1167
- uniqueSearch[column.key].sort().toString()) {
1168
- acc[column.key] = uniqueSearch[column.key].join(",");
1169
- }
1170
- }
1171
- return acc;
1172
- }, {});
1173
- const propFixedFilterColumn = fixedColumns.reduce((acc, column) => {
1174
- var _a;
1175
- const values = (filterData && ((_a = filterData.fixedFilterValues) === null || _a === void 0 ? void 0 : _a[column.key])) || [];
1176
- if (values.length > 0) {
1177
- acc[column.key] = values;
1178
- }
1179
- return acc;
1180
- }, {});
1181
- const sortColumn = gridColumns.reduce((acc, column) => {
1182
- const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
1183
- if (query) {
1184
- acc[column.key] = query;
1185
- }
1186
- return acc;
1187
- }, {});
1188
- const propSortColumn = gridColumns.reduce((acc, column) => {
1189
- const query = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort[column.key];
1190
- if (query) {
1191
- acc[column.key] = query;
1192
- }
1193
- return acc;
1194
- }, {});
1195
- const hasFilters = Object.keys(filterColumn).length > 0 ||
1196
- globalInputSearch !== "" ||
1197
- Object.keys(fixedFilterColumn).length > 0;
1198
- return {
1199
- hasFilters,
1200
- filtersUpdated: Object.keys(filterColumn).sort().toString() !==
1201
- Object.keys(propFilterColumn).sort().toString() ||
1202
- Object.values(filterColumn).sort().toString() !==
1203
- Object.values(propFilterColumn).sort().toString() ||
1204
- Object.keys(sortColumn).sort().toString() !==
1205
- Object.keys(propSortColumn).sort().toString() ||
1206
- Object.values(sortColumn).sort().toString() !==
1207
- Object.values(propSortColumn).sort().toString() ||
1208
- normalizeFixedFilters(fixedFilterColumn) !==
1209
- normalizeFixedFilters(propFixedFilterColumn) ||
1210
- (filterData === null || filterData === void 0 ? void 0 : filterData.globalInputSearch) !== globalInputSearch,
1211
- };
1212
- }, [
1213
- searchQueries,
1214
- globalInputSearch,
1215
- uniqueSearch,
1216
- gridColumns,
1217
- filteredData,
1218
- fixedFilterValues,
1219
- fixedColumns,
1220
- sortQueries,
1221
- defaultSort,
1222
- filterData,
1223
- ]);
1224
1232
  const sortDetails = useMemo(() => {
1225
1233
  const sortColumn = gridColumns.reduce((acc, column) => {
1226
1234
  const query = sortQueries === null || sortQueries === void 0 ? void 0 : sortQueries[column.key];
@@ -1332,7 +1340,6 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1332
1340
  // setGridGroupBy(groupBy);
1333
1341
  // }
1334
1342
  // };
1335
- console.log({ isHideDupsAvailable });
1336
1343
  const gridBody = (_jsxs("div", { style: {
1337
1344
  height: withCard ? "100%" : height,
1338
1345
  backgroundColor: isFullScreen ? "var(--background)" : "transparent",
@@ -1493,7 +1500,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1493
1500
  : undefined, isSort: column.fixedFilterOrder ? false : undefined, isClear: true, searchEnabled: true, dropdownListWidth: "max-content", className: "h-8 flex-1", isMultiple: column.fixedFilter === "multi-select" }) }, column.key));
1494
1501
  }
1495
1502
  return null;
1496
- }), _jsx("div", { className: "flex-1 h-2" }), isSummarise && (_jsx("div", { onClick: () => setSummariseAvailable((prev) => !prev), style: {
1503
+ }), shouldShowHeaderActionsSpacer && _jsx("div", { className: "flex-1 h-2" }), isSummarise && (_jsx("div", { onClick: () => setSummariseAvailable((prev) => !prev), style: {
1497
1504
  cursor: "pointer",
1498
1505
  marginLeft: "0.75rem",
1499
1506
  }, children: SummariseIcon ? (SummariseIcon) : summariseAvailable ? (_jsx(TbCalculatorFilled, { color: summarizeColor, size: 18 })) : (_jsx(TbCalculator, { size: 18 })) })), showHideAvailable && (_jsx("div", { onClick: openSetting, style: { cursor: "pointer", marginLeft: "0.75rem" }, children: SettingIcon ? SettingIcon : _jsx(FiEye, { size: 18 }) })), exportAvailable && (_jsx("div", { onClick: handleExport, style: { cursor: "pointer", marginLeft: "0.75rem" }, children: ExportIcon ? ExportIcon : _jsx(FiShare, { size: 16 }) })), isHideDupsAvailable && (_jsx("div", { onClick: () => setHideDuplicates((prev) => !prev), style: { cursor: "pointer", marginLeft: "0.75rem" }, title: hideDuplicates ? "Show Duplicates" : "Hide Duplicates", children: hideDuplicates ? (_jsx(MdLayers, { size: 18 })) : (_jsx(MdLayersClear, { size: 18 })) })), fullScreen && (_jsx("div", { onClick: toggleFullScreen, style: { cursor: "pointer", marginLeft: "0.75rem" }, children: isFullScreen ? (_jsx(MdFullscreenExit, { size: 20 })) : (_jsx(MdFullscreen, { size: 20 })) })), freezeColumnsAvailable && (_jsx("div", { onClick: toggleCollapse, style: { cursor: "pointer", marginLeft: "0.75rem" }, children: isCollapsed ? (_jsx(FiChevronsRight, { size: 20 })) : (_jsx(FiChevronsLeft, { size: 20 })) })), (filterDetails.filtersUpdated ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.3.120",
3
+ "version": "1.3.121",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",