@megha-ui/react 1.2.593 → 1.2.595

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.
@@ -358,14 +358,6 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
358
358
  });
359
359
  }
360
360
  }
361
- console.log(_filteredData.map((item) => Object.keys(item)
362
- .filter((key) => Object.keys(searchQueries).includes(key))
363
- .reduce((acc, key) => {
364
- if (searchQueries[key].type === "startsWith") {
365
- acc.value = item[key].value;
366
- }
367
- return acc;
368
- }, {})).map(item => item.value));
369
361
  return _filteredData;
370
362
  }, [
371
363
  data,
@@ -826,7 +818,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
826
818
  }, 1000);
827
819
  setPrevRenderedData(filteredData);
828
820
  }
829
- }, [filteredData, gridGroupBy, gridColumns]);
821
+ }, [filteredData, sortQueries, gridGroupBy, gridColumns]);
830
822
  const handleSearch = (key, value, type) => {
831
823
  setSearchQueries((prev) => (Object.assign(Object.assign({}, prev), { [key]: { text: value, type, operation: "and" } })));
832
824
  setUniqueSearch((prev) => {
@@ -1384,7 +1376,62 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1384
1376
  cursor: "pointer",
1385
1377
  marginLeft: 10,
1386
1378
  color: "var(--clear-color)",
1387
- }, children: _jsx(TbCalculatorOff, {}) }))] }), _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [isSummarise && (_jsx("div", { onClick: () => setSummariseAvailable((prev) => !prev), style: {
1379
+ }, children: _jsx(TbCalculatorOff, {}) })), fixedColumns.map((column) => {
1380
+ const selectedValues = fixedFilterValues[column.key]
1381
+ ? fixedFilterValues[column.key].map((item) => item.toString())
1382
+ : [];
1383
+ let options = [
1384
+ ...data
1385
+ .filter((item) => item[column.key])
1386
+ .map((data) => {
1387
+ var _a;
1388
+ return data[column.key] && data[column.key].value
1389
+ ? (_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()
1390
+ : "";
1391
+ }),
1392
+ ].sort((a, b) => {
1393
+ var _a, _b;
1394
+ return comparator(a, b, (_a = column.dataType) !== null && _a !== void 0 ? _a : "", (_b = column.fixedFilterOrder) !== null && _b !== void 0 ? _b : "asc");
1395
+ });
1396
+ selectedValues.forEach((item) => {
1397
+ if (!options.includes(item)) {
1398
+ options.push(item);
1399
+ }
1400
+ });
1401
+ options = [...new Set(options)];
1402
+ if (!column.hidden) {
1403
+ return (_jsx("div", { style: {
1404
+ position: "relative",
1405
+ width: "18rem",
1406
+ }, children: _jsx(Dropdown, { options: options.map((option) => ({
1407
+ label: option,
1408
+ value: option,
1409
+ })), label: column.label, placeholder: "Select", selectedValues: selectedValues, onChange: (selected) => {
1410
+ if (column.fixedFilter !== "multi-select") {
1411
+ const values = selected
1412
+ .filter((item) => item)
1413
+ .map((item) => item.toString());
1414
+ const updatedValues = Object.assign(Object.assign({}, fixedFilterValues), { [column.key]: values });
1415
+ setFixedFilterValues(updatedValues);
1416
+ updateFixedFilterValues &&
1417
+ updateFixedFilterValues(updatedValues);
1418
+ }
1419
+ }, onApplyChange: column.fixedFilter === "multi-select"
1420
+ ? (selected) => {
1421
+ if (column.fixedFilter === "multi-select") {
1422
+ const values = selected
1423
+ .filter((item) => item)
1424
+ .map((item) => item.toString());
1425
+ const updatedValues = Object.assign(Object.assign({}, fixedFilterValues), { [column.key]: values });
1426
+ setFixedFilterValues(updatedValues);
1427
+ updateFixedFilterValues &&
1428
+ updateFixedFilterValues(updatedValues);
1429
+ }
1430
+ }
1431
+ : undefined, isSort: column.fixedFilterOrder ? false : undefined, isClear: true, searchEnabled: true, dropdownListWidth: "max-content", className: "h-8 mt-2", isMultiple: column.fixedFilter === "multi-select" }) }, column.key));
1432
+ }
1433
+ return null;
1434
+ })] }), _jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [isSummarise && (_jsx("div", { onClick: () => setSummariseAvailable((prev) => !prev), style: {
1388
1435
  cursor: "pointer",
1389
1436
  marginLeft: 10,
1390
1437
  }, children: SummariseIcon ? (SummariseIcon) : summariseAvailable ? (_jsx(TbCalculatorFilled, { color: summarizeColor, size: 18 })) : (_jsx(TbCalculator, { size: 18 })) })), showHideAvailable && (_jsx("div", { onClick: openSetting, style: { cursor: "pointer", marginLeft: 10 }, children: SettingIcon ? SettingIcon : _jsx(FiEye, { size: 18 }) })), exportAvailable && (_jsx("div", { onClick: handleExport, style: { cursor: "pointer", marginLeft: 10 }, children: ExportIcon ? ExportIcon : _jsx(FiShare, { size: 16 }) })), _jsx("div", { onClick: () => setHideDuplicates((prev) => !prev), style: { cursor: "pointer", marginLeft: 10 }, title: hideDuplicates ? "Show Duplicates" : "Hide Duplicates", children: hideDuplicates ? _jsx(TbCopyOff, { size: 18 }) : _jsx(TbCopy, { size: 18 }) }), fullScreen && (_jsx("div", { onClick: toggleFullScreen, style: { cursor: "pointer", marginLeft: 10 }, children: isFullScreen ? (_jsx(MdFullscreenExit, { size: 20 })) : (_jsx(MdFullscreen, { size: 20 })) })), freezeColumnsAvailable && (_jsx("div", { onClick: toggleCollapse, style: { cursor: "pointer", marginLeft: 10 }, children: isCollapsed ? (_jsx(FiChevronsRight, { size: 20 })) : (_jsx(FiChevronsLeft, { size: 20 })) })), (filterDetails.filtersUpdated ||
@@ -1443,67 +1490,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1443
1490
  }, onClick: () => setGridGroupBy((prev) => prev
1444
1491
  .split(",")
1445
1492
  .filter((item) => item !== chip)
1446
- .join(",")), children: "\u00D7" })] }, chip)))] }))] }), _jsx("div", { id: "fixed-filters", style: {
1447
- display: "flex",
1448
- alignItems: "center",
1449
- gap: "0.5rem",
1450
- padding: "0.25rem 0.5rem",
1451
- }, children: fixedColumns.map((column) => {
1452
- const selectedValues = fixedFilterValues[column.key]
1453
- ? fixedFilterValues[column.key].map((item) => item.toString())
1454
- : [];
1455
- let options = [
1456
- ...data
1457
- .filter((item) => item[column.key])
1458
- .map((data) => {
1459
- var _a;
1460
- return data[column.key] && data[column.key].value
1461
- ? (_a = data[column.key].value) === null || _a === void 0 ? void 0 : _a.toString()
1462
- : "";
1463
- }),
1464
- ].sort((a, b) => {
1465
- var _a, _b;
1466
- return comparator(a, b, (_a = column.dataType) !== null && _a !== void 0 ? _a : "", (_b = column.fixedFilterOrder) !== null && _b !== void 0 ? _b : "asc");
1467
- });
1468
- selectedValues.forEach((item) => {
1469
- if (!options.includes(item)) {
1470
- options.push(item);
1471
- }
1472
- });
1473
- options = [...new Set(options)];
1474
- if (!column.hidden) {
1475
- return (_jsx("div", { style: {
1476
- position: "relative",
1477
- width: "18rem",
1478
- }, children: _jsx(Dropdown, { options: options.map((option) => ({
1479
- label: option,
1480
- value: option,
1481
- })), label: column.label, placeholder: "Select", selectedValues: selectedValues, onChange: (selected) => {
1482
- if (column.fixedFilter !== "multi-select") {
1483
- const values = selected
1484
- .filter((item) => item)
1485
- .map((item) => item.toString());
1486
- const updatedValues = Object.assign(Object.assign({}, fixedFilterValues), { [column.key]: values });
1487
- setFixedFilterValues(updatedValues);
1488
- updateFixedFilterValues &&
1489
- updateFixedFilterValues(updatedValues);
1490
- }
1491
- }, onApplyChange: column.fixedFilter === "multi-select"
1492
- ? (selected) => {
1493
- if (column.fixedFilter === "multi-select") {
1494
- const values = selected
1495
- .filter((item) => item)
1496
- .map((item) => item.toString());
1497
- const updatedValues = Object.assign(Object.assign({}, fixedFilterValues), { [column.key]: values });
1498
- setFixedFilterValues(updatedValues);
1499
- updateFixedFilterValues &&
1500
- updateFixedFilterValues(updatedValues);
1501
- }
1502
- }
1503
- : undefined, isSort: column.fixedFilterOrder ? false : undefined, isClear: true, searchEnabled: true, dropdownListWidth: "max-content", className: "h-8 mt-2", isMultiple: column.fixedFilter === "multi-select" }) }, column.key));
1504
- }
1505
- return null;
1506
- }) }), _jsxs("div", { id: `grid-content`, style: {
1493
+ .join(",")), children: "\u00D7" })] }, chip)))] }))] }), _jsxs("div", { id: `grid-content`, style: {
1507
1494
  display: "block",
1508
1495
  border: gridBorder ? "1px solid #f0f0f0" : "none",
1509
1496
  overflow: calculateVisible && gridGroupBy ? "visible" : "auto",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.593",
3
+ "version": "1.2.595",
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",