@megha-ui/react 1.2.696 → 1.2.699

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.
@@ -398,21 +398,34 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
398
398
  _groupedKeys.forEach((grouped) => {
399
399
  const { groupedKey, groupedValue } = grouped;
400
400
  const filterValue = _groupedKeys.length > 1 ? groupedValue : "";
401
+ const filterSegments = filterValue
402
+ ? filterValue
403
+ .split(">")
404
+ .map((v) => v.trim())
405
+ .filter((v) => v)
406
+ : [];
407
+ const matchesGroup = (item, group) => {
408
+ var _a, _b;
409
+ const raw = (_b = ((_a = item[group]) !== null && _a !== void 0 ? _a : {
410
+ value: "",
411
+ }).value) !== null && _b !== void 0 ? _b : "";
412
+ const valueSegments = String(raw)
413
+ .split(">>")
414
+ .map((v) => v.trim())
415
+ .filter((v) => v);
416
+ if (!filterSegments.length)
417
+ return true;
418
+ return filterSegments.some((segment) => valueSegments.includes(segment));
419
+ };
401
420
  const filteredValues = filteredData
402
421
  .filter((item) => filterValue
403
- ? filterValue.split(">").length > 1
404
- ? groupedKey.split(">").every((group) => {
405
- var _a, _b;
406
- return filterValue
407
- .split(">")
408
- .includes((_b = ((_a = item[group]) !== null && _a !== void 0 ? _a : { value: "" }).value) === null || _b === void 0 ? void 0 : _b.toString());
409
- })
410
- : groupedKey.split(">").some((group) => {
411
- var _a, _b;
412
- return filterValue
413
- .split(">")
414
- .includes((_b = ((_a = item[group]) !== null && _a !== void 0 ? _a : { value: "" }).value) === null || _b === void 0 ? void 0 : _b.toString());
415
- })
422
+ ? filterSegments.length > 1
423
+ ? groupedKey
424
+ .split(">")
425
+ .every((group) => matchesGroup(item, group))
426
+ : groupedKey
427
+ .split(">")
428
+ .some((group) => matchesGroup(item, group))
416
429
  : true)
417
430
  .map((item) => {
418
431
  var _a;
@@ -596,21 +609,28 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
596
609
  const groupedResult = [];
597
610
  const groupKey = keys[level];
598
611
  items.forEach((item) => {
599
- var _a;
600
- const groupValue = ((_a = item[groupKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
601
- let existingGroup = groupedResult.find((g) => g.value === groupValue);
602
- if (existingGroup) {
603
- existingGroup.values.push(item);
604
- }
605
- else {
606
- groupedResult.push({
607
- key: groupKey,
608
- value: groupValue,
609
- count: 0,
610
- subGroups: [],
611
- values: [item],
612
- });
613
- }
612
+ var _a, _b;
613
+ const rawGroupValue = (_b = (_a = item[groupKey]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
614
+ const splitValues = String(rawGroupValue)
615
+ .split(">>")
616
+ .map((v) => v.trim())
617
+ .filter((v) => v);
618
+ const groupValues = splitValues.length ? splitValues : [""];
619
+ groupValues.forEach((groupValue) => {
620
+ let existingGroup = groupedResult.find((g) => g.value === groupValue);
621
+ if (existingGroup) {
622
+ existingGroup.values.push(item);
623
+ }
624
+ else {
625
+ groupedResult.push({
626
+ key: groupKey,
627
+ value: groupValue,
628
+ count: 0,
629
+ subGroups: [],
630
+ values: [item],
631
+ });
632
+ }
633
+ });
614
634
  });
615
635
  groupedResult.forEach((group) => {
616
636
  group.count = group.values.length;
@@ -1432,21 +1452,24 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
1432
1452
  }, children: [_jsx("div", { title: "Clear All Groups", onClick: () => {
1433
1453
  // setChanged((prev) => [...prev, "groupBy"]);
1434
1454
  setGridGroupBy("");
1435
- }, style: { cursor: "pointer", marginRight: "0.5rem" }, children: _jsx(MdGroupOff, { size: 18 }) }), gridGroupBy.split(",").map((chip) => (_jsxs("div", { style: {
1436
- display: "inline-flex",
1437
- alignItems: "center",
1438
- padding: "0.25rem",
1439
- borderRadius: "0.25rem",
1440
- margin: "0 0.25rem",
1441
- backgroundColor: chipColor,
1442
- }, children: [_jsx("span", { children: chip }), _jsx("span", { style: {
1443
- display: "inline-block",
1444
- cursor: "pointer",
1445
- marginLeft: "0.5rem",
1446
- }, onClick: () => setGridGroupBy((prev) => prev
1447
- .split(",")
1448
- .filter((item) => item !== chip)
1449
- .join(",")), children: "\u00D7" })] }, chip)))] }))] }), _jsxs("div", { id: `grid-content`, style: {
1455
+ }, style: { cursor: "pointer", marginRight: "0.5rem" }, children: _jsx(MdGroupOff, { size: 18 }) }), gridGroupBy.split(",").map((chip) => {
1456
+ const column = columns.find(item => item.key === chip);
1457
+ return (_jsxs("div", { style: {
1458
+ display: "inline-flex",
1459
+ alignItems: "center",
1460
+ padding: "0.25rem",
1461
+ borderRadius: "0.25rem",
1462
+ margin: "0 0.25rem",
1463
+ backgroundColor: chipColor,
1464
+ }, children: [_jsx("span", { children: column === null || column === void 0 ? void 0 : column.label }), _jsx("span", { style: {
1465
+ display: "inline-block",
1466
+ cursor: "pointer",
1467
+ marginLeft: "0.5rem",
1468
+ }, onClick: () => setGridGroupBy((prev) => prev
1469
+ .split(",")
1470
+ .filter((item) => item !== chip)
1471
+ .join(",")), children: "\u00D7" })] }, chip));
1472
+ })] }))] }), _jsxs("div", { id: `grid-content`, style: {
1450
1473
  display: "block",
1451
1474
  border: gridBorder ? "1px solid #f0f0f0" : "none",
1452
1475
  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.696",
3
+ "version": "1.2.699",
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",