@mintplayer/ng-bootstrap 13.3.2 → 13.3.6

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.
@@ -2907,10 +2907,10 @@ class BsNavbarComponent {
2907
2907
  }
2908
2908
  }
2909
2909
  BsNavbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: BsNavbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2910
- BsNavbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: BsNavbarComponent, selector: "bs-navbar", inputs: { autoclose: "autoclose" }, viewQueries: [{ propertyName: "nav", first: true, predicate: ["nav"], descendants: true }], ngImport: i0, template: "<nav #nav class=\"navbar navbar-expand-md position-fixed navbar-dark bg-dark\">\n <div class=\"container-fluid\">\n <div class=\"d-flex w-100 w-md-auto\">\n <ng-content select=\"bs-navbar-brand\"></ng-content>\n <div class=\"flex-end d-md-none d-flex tw\">\n <button (click)=\"toggleExpanded()\" title=\"Expand/collapse menu\" class=\"align-self-center\" [class.navbar-toggler]=\"!expandButtonTemplate\" [class.bg-transparent]=\"expandButtonTemplate\" [class.shadow-none]=\"expandButtonTemplate\" [class.border-0]=\"expandButtonTemplate\" type=\"button\">\n <ng-container *ngTemplateOutlet=\"expandButtonTemplate ?? defaultExpandButton; context: { $implicit: (isExpanded$ | async) ? 'open' : 'closed' }\"></ng-container>\n </button>\n </div>\n </div>\n <ng-content></ng-content>\n </div>\n</nav>\n\n<ng-template #defaultExpandButton>\n <span class=\"navbar-toggler-icon\"></span>\n</ng-template>", styles: [":host ::ng-deep+*{padding-top:56px}nav{left:0;top:0;right:0;z-index:10}@media (min-width: 768px){.mx-md-unset{margin-left:0!important;margin-right:0!important}.w-md-auto{width:auto!important}}.tw{margin:-.5rem -.6666666667rem}\n"], directives: [{ type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i1.AsyncPipe } });
2910
+ BsNavbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.0", type: BsNavbarComponent, selector: "bs-navbar", inputs: { autoclose: "autoclose" }, viewQueries: [{ propertyName: "nav", first: true, predicate: ["nav"], descendants: true }], ngImport: i0, template: "<nav #nav class=\"navbar navbar-expand-md position-fixed navbar-dark bg-dark\">\n <div class=\"container-fluid\">\n <div class=\"d-flex w-100 w-md-auto\">\n <ng-content select=\"bs-navbar-brand\"></ng-content>\n <div class=\"flex-end d-md-none d-flex tw\">\n <button (click)=\"toggleExpanded()\" title=\"Expand/collapse menu\" class=\"align-self-center\" [class.navbar-toggler]=\"!expandButtonTemplate\" [class.bg-transparent]=\"expandButtonTemplate\" [class.shadow-none]=\"expandButtonTemplate\" [class.border-0]=\"expandButtonTemplate\" type=\"button\">\n <ng-container *ngTemplateOutlet=\"expandButtonTemplate ?? defaultExpandButton; context: { $implicit: (isExpanded$ | async) ? 'open' : 'closed' }\"></ng-container>\n </button>\n </div>\n </div>\n <ng-content></ng-content>\n </div>\n</nav>\n\n<ng-template #defaultExpandButton>\n <span class=\"navbar-toggler-icon\"></span>\n</ng-template>", styles: ["nav{left:0;top:0;right:0;z-index:10}@media (min-width: 768px){.mx-md-unset{margin-left:0!important;margin-right:0!important}.w-md-auto{width:auto!important}}.tw{margin:-.5rem -.6666666667rem}\n"], directives: [{ type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "async": i1.AsyncPipe } });
2911
2911
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: BsNavbarComponent, decorators: [{
2912
2912
  type: Component,
2913
- args: [{ selector: 'bs-navbar', template: "<nav #nav class=\"navbar navbar-expand-md position-fixed navbar-dark bg-dark\">\n <div class=\"container-fluid\">\n <div class=\"d-flex w-100 w-md-auto\">\n <ng-content select=\"bs-navbar-brand\"></ng-content>\n <div class=\"flex-end d-md-none d-flex tw\">\n <button (click)=\"toggleExpanded()\" title=\"Expand/collapse menu\" class=\"align-self-center\" [class.navbar-toggler]=\"!expandButtonTemplate\" [class.bg-transparent]=\"expandButtonTemplate\" [class.shadow-none]=\"expandButtonTemplate\" [class.border-0]=\"expandButtonTemplate\" type=\"button\">\n <ng-container *ngTemplateOutlet=\"expandButtonTemplate ?? defaultExpandButton; context: { $implicit: (isExpanded$ | async) ? 'open' : 'closed' }\"></ng-container>\n </button>\n </div>\n </div>\n <ng-content></ng-content>\n </div>\n</nav>\n\n<ng-template #defaultExpandButton>\n <span class=\"navbar-toggler-icon\"></span>\n</ng-template>", styles: [":host ::ng-deep+*{padding-top:56px}nav{left:0;top:0;right:0;z-index:10}@media (min-width: 768px){.mx-md-unset{margin-left:0!important;margin-right:0!important}.w-md-auto{width:auto!important}}.tw{margin:-.5rem -.6666666667rem}\n"] }]
2913
+ args: [{ selector: 'bs-navbar', template: "<nav #nav class=\"navbar navbar-expand-md position-fixed navbar-dark bg-dark\">\n <div class=\"container-fluid\">\n <div class=\"d-flex w-100 w-md-auto\">\n <ng-content select=\"bs-navbar-brand\"></ng-content>\n <div class=\"flex-end d-md-none d-flex tw\">\n <button (click)=\"toggleExpanded()\" title=\"Expand/collapse menu\" class=\"align-self-center\" [class.navbar-toggler]=\"!expandButtonTemplate\" [class.bg-transparent]=\"expandButtonTemplate\" [class.shadow-none]=\"expandButtonTemplate\" [class.border-0]=\"expandButtonTemplate\" type=\"button\">\n <ng-container *ngTemplateOutlet=\"expandButtonTemplate ?? defaultExpandButton; context: { $implicit: (isExpanded$ | async) ? 'open' : 'closed' }\"></ng-container>\n </button>\n </div>\n </div>\n <ng-content></ng-content>\n </div>\n</nav>\n\n<ng-template #defaultExpandButton>\n <span class=\"navbar-toggler-icon\"></span>\n</ng-template>", styles: ["nav{left:0;top:0;right:0;z-index:10}@media (min-width: 768px){.mx-md-unset{margin-left:0!important;margin-right:0!important}.w-md-auto{width:auto!important}}.tw{margin:-.5rem -.6666666667rem}\n"] }]
2914
2914
  }], propDecorators: { nav: [{
2915
2915
  type: ViewChild,
2916
2916
  args: ['nav']
@@ -2992,8 +2992,9 @@ class BsNavbarItemComponent {
2992
2992
  this.anchorTag = this.element.nativeElement.querySelector('li a');
2993
2993
  if (this.hasDropdown) {
2994
2994
  (this.anchorTag) && this.anchorTag.classList.add('dropdown-toggle');
2995
- if (this.anchorTag && !this.anchorTag.onclick) {
2996
- this.anchorTag.onclick = (ev) => {
2995
+ if (this.anchorTag && !this.anchorTag.getAttribute('close-init-b')) {
2996
+ this.anchorTag.setAttribute('close-init-b', '1');
2997
+ this.anchorTag.addEventListener('click', (ev) => {
2997
2998
  ev.preventDefault();
2998
2999
  // Normally there should be only one dropdown in this list
2999
3000
  this.dropdowns.forEach((dropdown) => {
@@ -3004,24 +3005,23 @@ class BsNavbarItemComponent {
3004
3005
  }
3005
3006
  });
3006
3007
  return false;
3007
- };
3008
+ });
3008
3009
  }
3009
3010
  }
3010
3011
  else {
3011
3012
  // Close if this is a link
3012
- if (this.dropdowns.length === 0) {
3013
- if (this.anchorTag && !this.anchorTag.onclick) {
3014
- this.anchorTag.onclick = (ev) => {
3015
- let d = this.parentDropdown;
3016
- while (d && d.autoclose) {
3017
- d.isVisible = false;
3018
- d = d.parentDropdown;
3019
- }
3020
- if (this.navbar.autoclose) {
3021
- this.navbar.isExpanded$.next(false);
3022
- }
3023
- };
3024
- }
3013
+ if ((this.dropdowns.length === 0) && this.anchorTag && !this.anchorTag.getAttribute('close-init-a')) {
3014
+ this.anchorTag.setAttribute('close-init-a', '1');
3015
+ this.anchorTag.addEventListener('click', (ev) => {
3016
+ let d = this.parentDropdown;
3017
+ while (d && d.autoclose) {
3018
+ d.isVisible = false;
3019
+ d = d.parentDropdown;
3020
+ }
3021
+ if (this.navbar.autoclose) {
3022
+ this.navbar.isExpanded$.next(false);
3023
+ }
3024
+ });
3025
3025
  }
3026
3026
  }
3027
3027
  }
@@ -3133,28 +3133,49 @@ 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
- if (!isPlatformServer(platformId)) {
3138
- this.resizeObserver = new ResizeObserver((entries) => {
3139
- const height = entries[0].contentRect.height;
3140
- this.element.nativeElement.style.paddingTop = (this.initialPadding + height) + 'px';
3141
- });
3142
- }
3143
- else {
3144
- this.resizeObserver = null;
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 = navbar
3152
+ ? navbar.nav.nativeElement.offsetHeight
3153
+ : entries[0].contentRect.height;
3154
+ this.element.nativeElement.style.paddingTop = (this.initialPadding + height) + 'px';
3155
+ });
3156
+ // Monitor the size
3157
+ const px = getComputedStyle(this.element.nativeElement).getPropertyValue('padding-top');
3158
+ const pt = parseInt(px.replace(/px$/, ''));
3159
+ this.initialPadding = isNaN(pt) ? 0 : pt;
3160
+ if (this.resizeObserver && navbar) {
3161
+ this.resizeObserver.observe(navbar.nav.nativeElement);
3162
+ }
3163
+ }
3164
+ });
3165
+ this.destroyed$
3166
+ .pipe(filter(d => !!d))
3167
+ .subscribe(() => {
3168
+ this.resizeObserver?.unobserve(this.navbar$.value?.nav.nativeElement);
3169
+ });
3170
+ }
3171
+ set navbar(value) {
3172
+ this.navbar$.next(value);
3146
3173
  }
3147
3174
  ngAfterViewInit() {
3148
- const pt = parseInt(this.element.nativeElement.style.paddingTop.replace(/px$/, ''));
3149
- this.initialPadding = isNaN(pt) ? 0 : pt;
3150
- if (this.resizeObserver) {
3151
- this.resizeObserver.observe(this.navbar.nav.nativeElement);
3152
- }
3175
+ this.viewInit$.next(true);
3153
3176
  }
3154
3177
  ngOnDestroy() {
3155
- if (this.resizeObserver) {
3156
- this.resizeObserver.unobserve(this.navbar.nav.nativeElement);
3157
- }
3178
+ this.destroyed$.next(true);
3158
3179
  }
3159
3180
  }
3160
3181
  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 });