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