@megha-ui/react 1.2.257 → 1.2.259

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.
@@ -353,43 +353,26 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
353
353
  }
354
354
  const _groupedKeys = groupedKeys.length > 0
355
355
  ? groupedKeys
356
- : [
357
- {
358
- groupedKey: "",
359
- groupedValue: columnKey,
360
- groupedColumns: columnKey,
361
- },
362
- ];
356
+ : [{ groupedKey: "", groupedValue: columnKey }];
363
357
  _groupedKeys.forEach((grouped) => {
364
- const { groupedValue, groupedColumns } = grouped;
358
+ const { groupedKey, groupedValue } = grouped;
365
359
  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
- : [];
372
360
  const filteredValues = filteredData
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
- })
361
+ .filter((item) => filterValue
362
+ ? filterValue.split(">").length > 1
363
+ ? groupedKey.split(">").every((group) => {
364
+ var _a;
365
+ return filterValue
366
+ .split(">")
367
+ .includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.toString());
368
+ })
369
+ : groupedKey.split(">").some((group) => {
370
+ var _a;
371
+ return filterValue
372
+ .split(">")
373
+ .includes((_a = item[group].value) === null || _a === void 0 ? void 0 : _a.toString());
374
+ })
375
+ : true)
393
376
  .map((item) => {
394
377
  var _a;
395
378
  return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
@@ -632,17 +615,15 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
632
615
  const flatArray = [];
633
616
  if (groupedData) {
634
617
  groupedData.forEach((group) => {
635
- console.log({ flatArray });
636
618
  const _groupedValues = [...groupedValues, group.value].map((item) => item ? item : "row");
637
619
  const currentKeys = (group.allKeys ? group.allKeys : [...parentKeys, group.key]).filter((item) => item);
638
620
  const groupedValue = _groupedValues.join(">");
639
- const groupedColumns = currentKeys.join(">");
621
+ const groupedKey = currentKeys.join(">");
640
622
  if (group.values) {
641
623
  flatArray.push({
642
624
  type: "main",
643
625
  key: group.key || "",
644
- groupedKey: groupedValue,
645
- groupedColumns,
626
+ groupedKey: groupedKey,
646
627
  level,
647
628
  value: group.value || "",
648
629
  groupedValue,
@@ -711,6 +692,7 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
711
692
  .map((k) => k.trim())
712
693
  .filter((k) => k));
713
694
  const groupedArray = sets.length ? groupBySets(sortedData, sets) : [];
695
+ console.log(groupedArray);
714
696
  const flatGroupedArray = flattenGroupedData(groupedArray, 1);
715
697
  setGroupedData(flatGroupedArray);
716
698
  const grouped = flatGroupedArray
@@ -718,7 +700,6 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
718
700
  .map((item) => ({
719
701
  groupedKey: item.groupedKey,
720
702
  groupedValue: item.groupedValue,
721
- groupedColumns: item.groupedColumns || "",
722
703
  }));
723
704
  setGroupedKeys(grouped);
724
705
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.257",
3
+ "version": "1.2.259",
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",