@acorex/platform 20.7.16 → 20.7.19

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.
@@ -1274,7 +1274,8 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
1274
1274
  const resetPagination = e.meta?.resetPagination === true;
1275
1275
  if (e.action == 'refresh') {
1276
1276
  if (refreshTargetId) {
1277
- this.grid()?.refreshItemChildren(refreshTargetId);
1277
+ await this.grid()?.refreshItemChildren(refreshTargetId);
1278
+ this.updateParentHasChildAfterRefresh(refreshTargetId);
1278
1279
  }
1279
1280
  else {
1280
1281
  this.grid()?.refresh({
@@ -1386,6 +1387,44 @@ class AXPEntityMasterListViewComponent extends AXPPageLayoutBaseComponent {
1386
1387
  async handleSelectedRowsChange(rows) {
1387
1388
  this.vm.selectedItems.set(rows);
1388
1389
  }
1390
+ /**
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. The list query sets hasChild from childrenCount only on
1393
+ * initial load; refreshItemChildren does not re-fetch the parent, so we patch it here.
1394
+ */
1395
+ updateParentHasChildAfterRefresh(parentId) {
1396
+ const gridRef = this.grid();
1397
+ const ds = gridRef?.dataSource;
1398
+ if (!ds?.cachedItems?.length) {
1399
+ return;
1400
+ }
1401
+ const key = ds.config?.key ?? 'id';
1402
+ const parent = this.findItemById(ds.cachedItems, String(parentId), key);
1403
+ if (parent && typeof parent === 'object') {
1404
+ parent['hasChild'] = true;
1405
+ }
1406
+ }
1407
+ findItemById(items, id, key) {
1408
+ for (const item of items) {
1409
+ if (item && typeof item === 'object' && String(item[key]) === id) {
1410
+ return item;
1411
+ }
1412
+ const rec = item;
1413
+ const metaChildren = rec?.['__meta__']?.['children'];
1414
+ const directChildren = rec?.['children'];
1415
+ const childArr = Array.isArray(metaChildren)
1416
+ ? metaChildren
1417
+ : Array.isArray(directChildren)
1418
+ ? directChildren
1419
+ : null;
1420
+ if (childArr?.length) {
1421
+ const found = this.findItemById(childArr, id, key);
1422
+ if (found)
1423
+ return found;
1424
+ }
1425
+ }
1426
+ return null;
1427
+ }
1389
1428
  makeResponsive(value) {
1390
1429
  if (this.platform.is('Mobile') || this.platform.is('SM')) {
1391
1430
  return '';
@@ -1555,4 +1594,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
1555
1594
  }], ctorParameters: () => [{ type: i1$1.AXPlatform }], propDecorators: { grid: [{ type: i0.ViewChild, args: ['grid', { isSignal: true }] }] } });
1556
1595
 
1557
1596
  export { AXPEntityMasterListViewComponent };
1558
- //# sourceMappingURL=acorex-platform-themes-default-entity-master-list-view.component-BQODc73e.mjs.map
1597
+ //# sourceMappingURL=acorex-platform-themes-default-entity-master-list-view.component-DDd7YryZ.mjs.map