|
1 | 1 | import { DOCUMENT } from '@angular/common'; |
2 | | -import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Output, QueryList, booleanAttribute, forwardRef } from '@angular/core'; |
| 2 | +import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, NgZone, Output, QueryList, booleanAttribute, forwardRef } from '@angular/core'; |
3 | 3 | import { DragDirection, IDragMoveEventArgs, IDragStartEventArgs, IgxDragDirective, IgxDragIgnoreDirective } from '../directives/drag-drop/drag-drop.directive'; |
4 | 4 | import { IgxSplitterPaneComponent } from './splitter-pane/splitter-pane.component'; |
| 5 | +import { take } from 'rxjs'; |
5 | 6 |
|
6 | 7 | /** |
7 | 8 | * An enumeration that defines the `SplitterComponent` panes orientation. |
@@ -155,7 +156,7 @@ export class IgxSplitterComponent implements AfterContentInit { |
155 | 156 | */ |
156 | 157 | private sibling!: IgxSplitterPaneComponent; |
157 | 158 |
|
158 | | - constructor(@Inject(DOCUMENT) public document, private elementRef: ElementRef) { } |
| 159 | + constructor(@Inject(DOCUMENT) public document, private elementRef: ElementRef, private zone: NgZone) { } |
159 | 160 | /** |
160 | 161 | * Gets/Sets the splitter orientation. |
161 | 162 | * |
@@ -198,7 +199,9 @@ export class IgxSplitterComponent implements AfterContentInit { |
198 | 199 |
|
199 | 200 | /** @hidden @internal */ |
200 | 201 | public ngAfterContentInit(): void { |
201 | | - this.initPanes(); |
| 202 | + this.zone.onStable.pipe(take(1)).subscribe(() => { |
| 203 | + this.initPanes(); |
| 204 | + }); |
202 | 205 | this.panes.changes.subscribe(() => { |
203 | 206 | this.initPanes(); |
204 | 207 | }); |
@@ -473,7 +476,7 @@ export class IgxSplitBarComponent { |
473 | 476 | * @hidden @internal |
474 | 477 | */ |
475 | 478 | public get prevButtonHidden() { |
476 | | - return this.siblings[0].collapsed && !this.siblings[1].collapsed; |
| 479 | + return this.siblings[0]?.collapsed && !this.siblings[1]?.collapsed; |
477 | 480 | } |
478 | 481 |
|
479 | 482 | /** |
@@ -560,7 +563,7 @@ export class IgxSplitBarComponent { |
560 | 563 | * @hidden @internal |
561 | 564 | */ |
562 | 565 | public get nextButtonHidden() { |
563 | | - return this.siblings[1].collapsed && !this.siblings[0].collapsed; |
| 566 | + return this.siblings[1]?.collapsed && !this.siblings[0]?.collapsed; |
564 | 567 | } |
565 | 568 |
|
566 | 569 | /** |
@@ -600,7 +603,7 @@ export class IgxSplitBarComponent { |
600 | 603 |
|
601 | 604 | protected get resizeDisallowed() { |
602 | 605 | const relatedTabs = this.siblings; |
603 | | - return !!relatedTabs.find(x => x.resizable === false || x.collapsed === true); |
| 606 | + return !!relatedTabs.find(x => x?.resizable === false || x?.collapsed === true); |
604 | 607 | } |
605 | 608 |
|
606 | 609 | /** |
|
0 commit comments