@mintplayer/ng-bootstrap 13.3.3 → 13.3.4
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.
- package/esm2020/lib/components/navbar/navbar-content/navbar-content.directive.mjs +37 -18
- package/fesm2015/mintplayer-ng-bootstrap.mjs +36 -17
- package/fesm2015/mintplayer-ng-bootstrap.mjs.map +1 -1
- package/fesm2020/mintplayer-ng-bootstrap.mjs +35 -17
- package/fesm2020/mintplayer-ng-bootstrap.mjs.map +1 -1
- package/lib/components/navbar/navbar-content/navbar-content.directive.d.ts +4 -1
- package/package.json +1 -1
|
@@ -3133,28 +3133,46 @@ class NavbarContentDirective {
|
|
|
3133
3133
|
constructor(element, platformId) {
|
|
3134
3134
|
this.element = element;
|
|
3135
3135
|
this.platformId = platformId;
|
|
3136
|
+
this.destroyed$ = new Subject();
|
|
3137
|
+
this.viewInit$ = new BehaviorSubject(false);
|
|
3138
|
+
this.navbar$ = new BehaviorSubject(null);
|
|
3139
|
+
this.resizeObserver = null;
|
|
3136
3140
|
this.initialPadding = 0;
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3141
|
+
combineLatest([this.viewInit$, this.navbar$])
|
|
3142
|
+
.pipe(filter(([viewInit, navbar]) => {
|
|
3143
|
+
return viewInit && !!navbar;
|
|
3144
|
+
}))
|
|
3145
|
+
.pipe(take(1))
|
|
3146
|
+
.pipe(takeUntil(this.destroyed$))
|
|
3147
|
+
.subscribe(([viewInit, navbar]) => {
|
|
3148
|
+
if (!isPlatformServer(platformId)) {
|
|
3149
|
+
// Initialize the ResizeObserver
|
|
3150
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
3151
|
+
const height = entries[0].contentRect.height;
|
|
3152
|
+
this.element.nativeElement.style.paddingTop = (this.initialPadding + height) + 'px';
|
|
3153
|
+
});
|
|
3154
|
+
// Monitor the size
|
|
3155
|
+
const pt = parseInt(this.element.nativeElement.style.paddingTop.replace(/px$/, ''));
|
|
3156
|
+
this.initialPadding = isNaN(pt) ? 0 : pt;
|
|
3157
|
+
if (this.resizeObserver && navbar) {
|
|
3158
|
+
this.resizeObserver.observe(navbar.nav.nativeElement);
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
});
|
|
3162
|
+
this.destroyed$
|
|
3163
|
+
.pipe(filter(d => !!d))
|
|
3164
|
+
.subscribe(() => {
|
|
3165
|
+
this.resizeObserver?.unobserve(this.navbar$.value?.nav.nativeElement);
|
|
3166
|
+
});
|
|
3167
|
+
}
|
|
3168
|
+
set navbar(value) {
|
|
3169
|
+
this.navbar$.next(value);
|
|
3146
3170
|
}
|
|
3147
3171
|
ngAfterViewInit() {
|
|
3148
|
-
|
|
3149
|
-
this.initialPadding = isNaN(pt) ? 0 : pt;
|
|
3150
|
-
if (this.resizeObserver) {
|
|
3151
|
-
this.resizeObserver.observe(this.navbar.nav.nativeElement);
|
|
3152
|
-
}
|
|
3172
|
+
this.viewInit$.next(true);
|
|
3153
3173
|
}
|
|
3154
3174
|
ngOnDestroy() {
|
|
3155
|
-
|
|
3156
|
-
this.resizeObserver.unobserve(this.navbar.nav.nativeElement);
|
|
3157
|
-
}
|
|
3175
|
+
this.destroyed$.next(true);
|
|
3158
3176
|
}
|
|
3159
3177
|
}
|
|
3160
3178
|
NavbarContentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: NavbarContentDirective, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
|