@megha-ui/react 1.2.353 → 1.2.355
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 +22 -29
- package/package.json +1 -1
|
@@ -363,40 +363,33 @@ const Grid = ({ columns, wrapperClass, updateGridColumns, data, height, sortable
|
|
|
363
363
|
_groupedKeys.forEach((grouped) => {
|
|
364
364
|
const { groupedValue, groupedColumns } = grouped;
|
|
365
365
|
const filterValue = _groupedKeys.length > 1 ? groupedValue : "";
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
// Expand groupedColumns to handle composite levels like "col1+col2>col3"
|
|
367
|
+
const columnLevelTokens = groupedColumns
|
|
368
|
+
? groupedColumns.split(">").filter(Boolean)
|
|
368
369
|
: [];
|
|
370
|
+
const expandedColumnTokens = columnLevelTokens
|
|
371
|
+
.flatMap((tok) => tok.split("+").map((s) => s.trim()).filter(Boolean));
|
|
372
|
+
// Values are always flattened and separated by '>'
|
|
369
373
|
const filterTokens = filterValue
|
|
370
|
-
? filterValue.split(">").filter(
|
|
374
|
+
? filterValue.split(">").filter(Boolean)
|
|
371
375
|
: [];
|
|
376
|
+
console.log({ filterTokens, expandedColumnTokens });
|
|
372
377
|
const filteredValues = filteredData
|
|
373
|
-
.filter((
|
|
374
|
-
var _a, _b, _c;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
const columnKey = columnTokens[0];
|
|
387
|
-
const value = (_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 : "";
|
|
388
|
-
const expectedValue = (_e = (_d = filterTokens[0]) !== null && _d !== void 0 ? _d : filterValue) !== null && _e !== void 0 ? _e : "";
|
|
389
|
-
return value === expectedValue;
|
|
390
|
-
})()
|
|
391
|
-
: filterTokens.length
|
|
392
|
-
? 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 : "")
|
|
393
|
-
: true
|
|
394
|
-
: true;
|
|
378
|
+
.filter((row) => {
|
|
379
|
+
var _a, _b, _c, _d;
|
|
380
|
+
if (!filterValue)
|
|
381
|
+
return true;
|
|
382
|
+
const n = Math.min(expandedColumnTokens.length, filterTokens.length);
|
|
383
|
+
for (let i = 0; i < n; i++) {
|
|
384
|
+
const col = expandedColumnTokens[i];
|
|
385
|
+
const value = (_c = (_b = (_a = row[col]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : "";
|
|
386
|
+
const expected = (_d = filterTokens[i]) !== null && _d !== void 0 ? _d : "";
|
|
387
|
+
if (value !== expected)
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
395
391
|
})
|
|
396
|
-
.map((
|
|
397
|
-
var _a;
|
|
398
|
-
return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
|
|
399
|
-
});
|
|
392
|
+
.map((row) => { var _a; return ((_a = row[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || ""; });
|
|
400
393
|
let value = "";
|
|
401
394
|
const column = gridColumns.find((item) => item.key === columnKey);
|
|
402
395
|
const nonEmptyValues = filteredValues
|
package/package.json
CHANGED