@megha-ui/react 1.2.696 → 1.2.698

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,27 @@ 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.split(">").map((v) => v.trim()).filter((v) => v)
403
+ : [];
404
+ const matchesGroup = (item, group) => {
405
+ var _a, _b;
406
+ const raw = (_b = ((_a = item[group]) !== null && _a !== void 0 ? _a : {
407
+ value: "",
408
+ }).value) !== null && _b !== void 0 ? _b : "";
409
+ const valueSegments = String(raw)
410
+ .split(">>")
411
+ .map((v) => v.trim())
412
+ .filter((v) => v);
413
+ if (!filterSegments.length)
414
+ return true;
415
+ return filterSegments.some((segment) => valueSegments.includes(segment));
416
+ };
401
417
  const filteredValues = filteredData
402
418
  .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
- })
419
+ ? filterSegments.length > 1
420
+ ? groupedKey.split(">").every((group) => matchesGroup(item, group))
421
+ : groupedKey.split(">").some((group) => matchesGroup(item, group))
416
422
  : true)
417
423
  .map((item) => {
418
424
  var _a;
@@ -596,21 +602,28 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
596
602
  const groupedResult = [];
597
603
  const groupKey = keys[level];
598
604
  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
- }
605
+ var _a, _b;
606
+ const rawGroupValue = (_b = (_a = item[groupKey]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
607
+ const splitValues = String(rawGroupValue)
608
+ .split(">>")
609
+ .map((v) => v.trim())
610
+ .filter((v) => v);
611
+ const groupValues = splitValues.length ? splitValues : [""];
612
+ groupValues.forEach((groupValue) => {
613
+ let existingGroup = groupedResult.find((g) => g.value === groupValue);
614
+ if (existingGroup) {
615
+ existingGroup.values.push(item);
616
+ }
617
+ else {
618
+ groupedResult.push({
619
+ key: groupKey,
620
+ value: groupValue,
621
+ count: 0,
622
+ subGroups: [],
623
+ values: [item],
624
+ });
625
+ }
626
+ });
614
627
  });
615
628
  groupedResult.forEach((group) => {
616
629
  group.count = group.values.length;
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.698",
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",