@megha-ui/react 1.2.256 → 1.2.257
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 +38 -19
- package/package.json +1 -1
|
@@ -353,26 +353,43 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
353
353
|
}
|
|
354
354
|
const _groupedKeys = groupedKeys.length > 0
|
|
355
355
|
? groupedKeys
|
|
356
|
-
: [
|
|
356
|
+
: [
|
|
357
|
+
{
|
|
358
|
+
groupedKey: "",
|
|
359
|
+
groupedValue: columnKey,
|
|
360
|
+
groupedColumns: columnKey,
|
|
361
|
+
},
|
|
362
|
+
];
|
|
357
363
|
_groupedKeys.forEach((grouped) => {
|
|
358
|
-
const {
|
|
364
|
+
const { groupedValue, groupedColumns } = grouped;
|
|
359
365
|
const filterValue = _groupedKeys.length > 1 ? groupedValue : "";
|
|
366
|
+
const columnTokens = groupedColumns
|
|
367
|
+
? groupedColumns.split(">").filter((item) => item)
|
|
368
|
+
: [];
|
|
369
|
+
const filterTokens = filterValue
|
|
370
|
+
? filterValue.split(">").filter((item) => item)
|
|
371
|
+
: [];
|
|
360
372
|
const filteredValues = filteredData
|
|
361
|
-
.filter((item) =>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
373
|
+
.filter((item) => {
|
|
374
|
+
var _a, _b, _c;
|
|
375
|
+
return filterValue
|
|
376
|
+
? columnTokens.length > 1
|
|
377
|
+
? columnTokens.every((group) => {
|
|
378
|
+
var _a, _b;
|
|
379
|
+
const value = (_b = (_a = item[group]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
380
|
+
return value ? filterTokens.includes(value) : false;
|
|
381
|
+
})
|
|
382
|
+
: columnTokens.length === 1
|
|
383
|
+
? columnTokens.some((group) => {
|
|
384
|
+
var _a, _b;
|
|
385
|
+
const value = (_b = (_a = item[group]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
386
|
+
return value ? filterTokens.includes(value) : false;
|
|
387
|
+
})
|
|
388
|
+
: filterTokens.length
|
|
389
|
+
? filterTokens.includes((_c = (_b = (_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "")
|
|
390
|
+
: true
|
|
391
|
+
: true;
|
|
392
|
+
})
|
|
376
393
|
.map((item) => {
|
|
377
394
|
var _a;
|
|
378
395
|
return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
|
|
@@ -619,12 +636,13 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
619
636
|
const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
|
|
620
637
|
const currentKeys = (group.allKeys ? group.allKeys : [...parentKeys, group.key]).filter((item) => item);
|
|
621
638
|
const groupedValue = _groupedValues.join(">");
|
|
622
|
-
const
|
|
639
|
+
const groupedColumns = currentKeys.join(">");
|
|
623
640
|
if (group.values) {
|
|
624
641
|
flatArray.push({
|
|
625
642
|
type: "main",
|
|
626
643
|
key: group.key || "",
|
|
627
|
-
groupedKey:
|
|
644
|
+
groupedKey: groupedValue,
|
|
645
|
+
groupedColumns,
|
|
628
646
|
level,
|
|
629
647
|
value: group.value || "",
|
|
630
648
|
groupedValue,
|
|
@@ -700,6 +718,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
700
718
|
.map((item) => ({
|
|
701
719
|
groupedKey: item.groupedKey,
|
|
702
720
|
groupedValue: item.groupedValue,
|
|
721
|
+
groupedColumns: item.groupedColumns || "",
|
|
703
722
|
}));
|
|
704
723
|
setGroupedKeys(grouped);
|
|
705
724
|
}
|
package/package.json
CHANGED