@acorex/platform 21.0.0-next.22 → 21.0.0-next.23
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/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-B_cHTtBF.mjs → acorex-platform-themes-default-entity-master-list-view.component-BDSvgZ3d.mjs} +50 -9
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-B_cHTtBF.mjs.map → acorex-platform-themes-default-entity-master-list-view.component-BDSvgZ3d.mjs.map} +1 -1
- package/fesm2022/acorex-platform-themes-default.mjs +2 -2
- package/package.json +1 -1
|
@@ -1389,20 +1389,61 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
/**
|
|
1391
1391
|
* After refreshing a row's children (e.g. when a new child was created), update the parent row's
|
|
1392
|
-
* hasChild so the expand icon is shown.
|
|
1393
|
-
*
|
|
1392
|
+
* hasChild so the expand icon is shown. Level 1 parents live in dataSource.cachedItems; level 2+
|
|
1393
|
+
* parents live only in the grid's internal flat rows, so we search both.
|
|
1394
1394
|
*/
|
|
1395
1395
|
updateParentHasChildAfterRefresh(parentId) {
|
|
1396
1396
|
const gridRef = this.grid();
|
|
1397
1397
|
const ds = gridRef?.dataSource;
|
|
1398
|
-
|
|
1399
|
-
|
|
1398
|
+
const key = ds?.config?.key ?? 'id';
|
|
1399
|
+
const idStr = String(parentId);
|
|
1400
|
+
const patchHasChild = (item) => {
|
|
1401
|
+
item['hasChild'] = true;
|
|
1402
|
+
};
|
|
1403
|
+
if (ds?.cachedItems?.length) {
|
|
1404
|
+
const parent = this.findItemById(ds.cachedItems, idStr, key);
|
|
1405
|
+
if (parent) {
|
|
1406
|
+
patchHasChild(parent);
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
const flatRows = this.getGridFlatRows(gridRef);
|
|
1411
|
+
const parentRow = flatRows.find((row) => row?.data != null &&
|
|
1412
|
+
String(row.data[key]) === idStr);
|
|
1413
|
+
if (parentRow?.data != null) {
|
|
1414
|
+
patchHasChild(parentRow.data);
|
|
1400
1415
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Gets a flat list of all row objects from the grid (all levels). The grid may store rows in
|
|
1419
|
+
* a nested structure (e.g. row.__meta__.children or row.children). Used to patch hasChild for
|
|
1420
|
+
* level 2+ parents that are not in dataSource.cachedItems.
|
|
1421
|
+
*/
|
|
1422
|
+
getGridFlatRows(gridRef) {
|
|
1423
|
+
const g = gridRef;
|
|
1424
|
+
if (!g)
|
|
1425
|
+
return [];
|
|
1426
|
+
const rows = (g['rows'] ?? g['_rows'] ?? g['flatRows'] ?? g['displayRows']);
|
|
1427
|
+
if (!Array.isArray(rows))
|
|
1428
|
+
return [];
|
|
1429
|
+
return this.flattenRowTree(rows);
|
|
1430
|
+
}
|
|
1431
|
+
flattenRowTree(rows) {
|
|
1432
|
+
const out = [];
|
|
1433
|
+
for (const row of rows) {
|
|
1434
|
+
out.push(row);
|
|
1435
|
+
const metaChildren = row['__meta__']?.['children'];
|
|
1436
|
+
const directChildren = row['children'];
|
|
1437
|
+
const childRows = Array.isArray(metaChildren)
|
|
1438
|
+
? metaChildren
|
|
1439
|
+
: Array.isArray(directChildren)
|
|
1440
|
+
? directChildren
|
|
1441
|
+
: [];
|
|
1442
|
+
if (childRows.length) {
|
|
1443
|
+
out.push(...this.flattenRowTree(childRows));
|
|
1444
|
+
}
|
|
1405
1445
|
}
|
|
1446
|
+
return out;
|
|
1406
1447
|
}
|
|
1407
1448
|
findItemById(items, id, key) {
|
|
1408
1449
|
for (const item of items) {
|
|
@@ -1594,4 +1635,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
1594
1635
|
}], ctorParameters: () => [{ type: i1$1.AXPlatform }] });
|
|
1595
1636
|
|
|
1596
1637
|
export { AXPEntityMasterListViewComponent };
|
|
1597
|
-
//# sourceMappingURL=acorex-platform-themes-default-entity-master-list-view.component-
|
|
1638
|
+
//# sourceMappingURL=acorex-platform-themes-default-entity-master-list-view.component-BDSvgZ3d.mjs.map
|