@megha-ui/react 1.2.690 → 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.
- package/dist/components/grid/index.js +41 -28
- package/package.json +1 -1
|
@@ -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
|
-
?
|
|
404
|
-
? groupedKey.split(">").every((group) =>
|
|
405
|
-
|
|
406
|
-
return filterValue
|
|
407
|
-
.split(">")
|
|
408
|
-
.includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.toString());
|
|
409
|
-
})
|
|
410
|
-
: groupedKey.split(">").some((group) => {
|
|
411
|
-
var _a;
|
|
412
|
-
return filterValue
|
|
413
|
-
.split(">")
|
|
414
|
-
.includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.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
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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