@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.
- package/dist/components/grid/index.js +66 -43
- package/package.json +1 -1
|
@@ -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
|
-
?
|
|
404
|
-
? groupedKey
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
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
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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) =>
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
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