@messaia/cdk 21.0.0-rc.21 → 21.0.0-rc.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.
@@ -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 => {