Skip to content

Commit 6281d2b

Browse files
committed
chore(*): Apply review comments.
1 parent ad14b90 commit 6281d2b

3 files changed

Lines changed: 29 additions & 22 deletions

File tree

projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,6 @@
278278
}
279279

280280
<!-- Lifecycle placeholder used to determine when the grid gets connected/disconnected from the DOM, for example as a result of virtualization or caching. -->
281-
<igc-hgrid-lifecycle-placeholder (igcConnected)="onLifecyclePlaceholderConnected()"
281+
<igc-lifecycle-placeholder (igcConnected)="onLifecyclePlaceholderConnected()"
282282
(igcDisconnected)="onLifecyclePlaceholderDisconnected()">
283-
</igc-hgrid-lifecycle-placeholder>
283+
</igc-lifecycle-placeholder>

projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.component.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ import { IgxIconComponent } from 'igniteui-angular/icon';
3636
import { EntityType, FieldType, IFilteringExpressionsTree, IgxActionStripToken, IgxOverlayOutletDirective, flatten, IGridResourceStrings } from 'igniteui-angular/core';
3737
import { IgxPaginatorToken } from 'igniteui-angular/paginator';
3838
import { IgxGridCellMergePipe, IgxGridComponent, IgxGridFilteringPipe, IgxGridSortingPipe, IgxGridUnmergeActivePipe } from 'igniteui-angular/grids/grid';
39+
import { registerLifecyclePlaceholderElement } from './lifecycle-placeholder-element';
3940

4041
let NEXT_ID = 0;
41-
const HGRID_LIFECYCLE_PLACEHOLDER_TAG = 'igc-hgrid-lifecycle-placeholder';
4242

4343
/**
4444
* @hidden @internal
@@ -663,7 +663,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
663663
* @hidden
664664
*/
665665
public override ngOnInit() {
666-
this.registerLifecyclePlaceholderElement();
666+
if (this.platform.isBrowser) {
667+
registerLifecyclePlaceholderElement();
668+
}
667669
// this.expansionStatesChange.pipe(takeUntil(this.destroy$)).subscribe((value: Map<any, boolean>) => {
668670
// const res = Array.from(value.entries()).filter(({1: v}) => v === true).map(([k]) => k);
669671
// });
@@ -742,24 +744,6 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
742744
this.parentIsland.showExpandAll : this.rootGrid.showExpandAll;
743745
}
744746

745-
private registerLifecyclePlaceholderElement(): void {
746-
if (!this.platform.isBrowser || typeof customElements === 'undefined' || customElements.get(HGRID_LIFECYCLE_PLACEHOLDER_TAG)) {
747-
return;
748-
}
749-
750-
class IgxHierarchicalGridLifecyclePlaceholderElement extends HTMLElement {
751-
public connectedCallback(): void {
752-
this.dispatchEvent(new CustomEvent('igcConnected', { bubbles: true, composed: true }));
753-
}
754-
755-
public disconnectedCallback(): void {
756-
this.dispatchEvent(new CustomEvent('igcDisconnected', { bubbles: true, composed: true }));
757-
}
758-
}
759-
760-
customElements.define(HGRID_LIFECYCLE_PLACEHOLDER_TAG, IgxHierarchicalGridLifecyclePlaceholderElement);
761-
}
762-
763747
/**
764748
* @hidden
765749
*/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const LIFECYCLE_PLACEHOLDER_TAG = 'igc-lifecycle-placeholder';
2+
const LIFECYCLE_CONNECTED_EVENT = 'igcConnected';
3+
const LIFECYCLE_DISCONNECTED_EVENT = 'igcDisconnected';
4+
5+
/** @hidden @internal */
6+
export function registerLifecyclePlaceholderElement(): void {
7+
if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined' ||
8+
typeof CustomEvent === 'undefined' || customElements.get(LIFECYCLE_PLACEHOLDER_TAG)) {
9+
return;
10+
}
11+
12+
class LifecyclePlaceholderElement extends HTMLElement {
13+
public connectedCallback(): void {
14+
this.dispatchEvent(new CustomEvent(LIFECYCLE_CONNECTED_EVENT));
15+
}
16+
17+
public disconnectedCallback(): void {
18+
this.dispatchEvent(new CustomEvent(LIFECYCLE_DISCONNECTED_EVENT));
19+
}
20+
}
21+
22+
customElements.define(LIFECYCLE_PLACEHOLDER_TAG, LifecyclePlaceholderElement);
23+
}

0 commit comments

Comments
 (0)