@megha-ui/react 1.2.353 → 1.2.354
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 +21 -29
- package/package.json +1 -1
|
@@ -363,40 +363,32 @@ 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
|
: [];
|
|
372
376
|
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;
|
|
377
|
+
.filter((row) => {
|
|
378
|
+
var _a, _b, _c, _d;
|
|
379
|
+
if (!filterValue)
|
|
380
|
+
return true;
|
|
381
|
+
const n = Math.min(expandedColumnTokens.length, filterTokens.length);
|
|
382
|
+
for (let i = 0; i < n; i++) {
|
|
383
|
+
const col = expandedColumnTokens[i];
|
|
384
|
+
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 : "";
|
|
385
|
+
const expected = (_d = filterTokens[i]) !== null && _d !== void 0 ? _d : "";
|
|
386
|
+
if (value !== expected)
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
return true;
|
|
395
390
|
})
|
|
396
|
-
.map((
|
|
397
|
-
var _a;
|
|
398
|
-
return ((_a = item[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || "";
|
|
399
|
-
});
|
|
391
|
+
.map((row) => { var _a; return ((_a = row[columnKey]) === null || _a === void 0 ? void 0 : _a.value) || ""; });
|
|
400
392
|
let value = "";
|
|
401
393
|
const column = gridColumns.find((item) => item.key === columnKey);
|
|
402
394
|
const nonEmptyValues = filteredValues
|
package/package.json
CHANGED