@messaia/cdk 21.0.0-rc.22 → 21.0.0-rc.24

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.
@@ -1414,21 +1414,24 @@ class BaseComponent {
1414
1414
  }
1415
1415
  }
1416
1416
  /**
1417
- * Expands the specified expansion panel and collapses all others.
1418
- *
1419
- * @param panelId - The ID of the expansion panel to expand.
1420
- */
1421
- expandPanel(panelId) {
1422
- /* Get the panel ends with the ID 'new' */
1423
- var expansionPanelIndex = this.matExpansionPanelElementQueryList?.toArray()?.findIndex(x => x.nativeElement.id == panelId) ?? -1;
1424
- if (expansionPanelIndex >= 0) {
1425
- /* Close all panels */
1426
- this.matExpansionPanelQueryList?.first?.accordion?.closeAll();
1427
- /* Open the new panel */
1428
- this.matExpansionPanelQueryList?.toArray()[expansionPanelIndex]?.open();
1429
- /* Detect changes */
1430
- this.changeDetectorRef.detectChanges();
1431
- }
1417
+ * Expands the specified expansion panel path (supporting nested IDs) and collapses others.
1418
+ * @param panelPath - The dot-separated ID path (e.g., 'warehouse.orders.details').
1419
+ */
1420
+ expandPanelPath(panelId) {
1421
+ /* Split the panel ID into parts to handle nested panels */
1422
+ panelId?.split('.')
1423
+ /* Reduce the panel ID into an array of cumulative IDs to handle nested panels */
1424
+ ?.reduce((accumulator, currentValue, index) => accumulator.concat((index > 0 ? (accumulator.slice(-1).join('.') + '.') : '') + currentValue), [])
1425
+ ?.forEach((hash) => {
1426
+ /* Find the index of the panel with the specified element ID */
1427
+ var expansionPanelIndex = this.matExpansionPanelElementQueryList?.toArray()?.findIndex(x => x.nativeElement.id == hash) ?? -1;
1428
+ if (expansionPanelIndex >= 0) {
1429
+ /* Open the specified panel */
1430
+ this.matExpansionPanelQueryList?.toArray()[expansionPanelIndex]?.open();
1431
+ /* Detect changes */
1432
+ this.changeDetectorRef.detectChanges();
1433
+ }
1434
+ });
1432
1435
  }
1433
1436
  /*
1434
1437
  * Forces a new change detection cycle since change detections
@@ -1473,16 +1476,8 @@ class BaseComponent {
1473
1476
  this.changeDetectorRef.detectChanges();
1474
1477
  }
1475
1478
  else {
1476
- /* Find the index of the panel with the specified element ID */
1477
- this.urlHash?.split('.')
1478
- ?.reduce((accumulator, currentValue, index) => accumulator.concat((index > 0 ? (accumulator.slice(-1).join('.') + '.') : '') + currentValue), [])
1479
- ?.forEach((hash) => {
1480
- var expansionPanelIndex = this.matExpansionPanelElementQueryList?.toArray()?.findIndex(x => x.nativeElement.id == hash) ?? -1;
1481
- if (expansionPanelIndex >= 0) {
1482
- this.matExpansionPanelQueryList?.toArray()[expansionPanelIndex]?.open();
1483
- this.changeDetectorRef.detectChanges();
1484
- }
1485
- });
1479
+ /* Otherwise, expand the panel based on the URL hash if set */
1480
+ this.expandPanelPath(this.urlHash ?? '');
1486
1481
  }
1487
1482
  /* Detect changes for opened panels */
1488
1483
  this.matExpansionPanelQueryList?.forEach(y => {
@@ -20370,6 +20365,15 @@ class GenericFormBaseComponent extends BaseComponent {
20370
20365
  ctr.updateValueAndValidity();
20371
20366
  });
20372
20367
  }
20368
+ /**
20369
+ * Manually triggers the formInitialized event.
20370
+ * Useful when a parent component needs to access the form after asynchronous data has loaded.
20371
+ */
20372
+ triggerFormInitialized() {
20373
+ if (this.form) {
20374
+ this.formInitialized?.emit(this.form);
20375
+ }
20376
+ }
20373
20377
  /**
20374
20378
  * Invalidates controls recursively.
20375
20379
  * This method marks all controls in the group as dirty and touched if they are invalid.
@@ -20592,7 +20596,7 @@ class GenericFormBaseComponent extends BaseComponent {
20592
20596
  */
20593
20597
  onAfterFormBuild() {
20594
20598
  /* Emit form initialized event */
20595
- this.formInitialized?.emit(this.form);
20599
+ this.triggerFormInitialized();
20596
20600
  /* Disable the form if the 'disabled' property is set */
20597
20601
  if (this.form && this.disabled) {
20598
20602
  Object.keys(this.form.controls).forEach(key => {