@open-rlb/ng-bootstrap 2.3.4 → 2.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.
@@ -5,7 +5,7 @@ import * as i1 from '@angular/common';
5
5
  import { formatDate, CommonModule } from '@angular/common';
6
6
  import * as i2 from '@angular/router';
7
7
  import { RouterModule } from '@angular/router';
8
- import { Subject, of, take, filter, switchMap, map, Observable, lastValueFrom, takeUntil } from 'rxjs';
8
+ import { Subject, of, take, filter, switchMap, map, startWith, takeUntil, Observable, lastValueFrom } from 'rxjs';
9
9
  import * as i2$1 from '@angular/cdk/layout';
10
10
  import * as i2$2 from '@angular/forms';
11
11
  import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
@@ -4440,14 +4440,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
4440
4440
  class NavbarItemsComponent {
4441
4441
  constructor(viewContainerRef) {
4442
4442
  this.viewContainerRef = viewContainerRef;
4443
+ this.click = new EventEmitter();
4444
+ this.destroy$ = new Subject();
4443
4445
  }
4444
4446
  ngOnInit() {
4445
4447
  const templateView = this.viewContainerRef.createEmbeddedView(this.template);
4446
4448
  this.element = templateView.rootNodes[0];
4447
4449
  this.viewContainerRef.element.nativeElement.remove();
4448
4450
  }
4451
+ ngAfterContentInit() {
4452
+ this.menuItems.changes.pipe(startWith(this.menuItems), // handles initial list
4453
+ takeUntil(this.destroy$)).subscribe((items) => {
4454
+ items.forEach(item => {
4455
+ item.click.pipe(takeUntil(this.destroy$)).subscribe(event => this.click.emit(event));
4456
+ });
4457
+ });
4458
+ }
4459
+ ngOnDestroy() {
4460
+ this.destroy$.next();
4461
+ this.destroy$.complete();
4462
+ }
4449
4463
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: NavbarItemsComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
4450
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: NavbarItemsComponent, isStandalone: false, selector: "rlb-navbar-items", inputs: { scroll: "scroll", cssClass: ["class", "cssClass"] }, viewQueries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, static: true }], ngImport: i0, template: ` <ng-template #template>
4464
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: NavbarItemsComponent, isStandalone: false, selector: "rlb-navbar-items", inputs: { scroll: "scroll", cssClass: ["class", "cssClass"] }, outputs: { click: "click" }, queries: [{ propertyName: "menuItems", predicate: NavbarItemComponent, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, static: true }], ngImport: i0, template: ` <ng-template #template>
4451
4465
  <ul
4452
4466
  class="navbar-nav {{ cssClass }}"
4453
4467
  [class.navbar-nav-scroll]="scroll"
@@ -4485,6 +4499,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
4485
4499
  }], template: [{
4486
4500
  type: ViewChild,
4487
4501
  args: ['template', { static: true }]
4502
+ }], menuItems: [{
4503
+ type: ContentChildren,
4504
+ args: [NavbarItemComponent, { descendants: true }]
4505
+ }], click: [{
4506
+ type: Output
4488
4507
  }] } });
4489
4508
 
4490
4509
  class NavbarSeparatorComponent {
@@ -4570,6 +4589,7 @@ class NavbarComponent {
4570
4589
  constructor(idService, viewContainerRef) {
4571
4590
  this.idService = idService;
4572
4591
  this.viewContainerRef = viewContainerRef;
4592
+ this.destroy$ = new Subject();
4573
4593
  this.cssClass = '';
4574
4594
  this.enableDropdownToggler = true;
4575
4595
  this._navId = `nav${this.idService.id}`;
@@ -4579,8 +4599,26 @@ class NavbarComponent {
4579
4599
  this.element = templateView.rootNodes[0];
4580
4600
  this.viewContainerRef.element.nativeElement.remove();
4581
4601
  }
4602
+ ngAfterContentInit() {
4603
+ this.navbarItemsGroups.changes.pipe(startWith(this.navbarItemsGroups), takeUntil(this.destroy$)).subscribe((groups) => {
4604
+ groups.forEach(group => {
4605
+ group.click.pipe(takeUntil(this.destroy$)).subscribe(() => this.closeMobileMenu());
4606
+ });
4607
+ });
4608
+ }
4609
+ ngOnDestroy() {
4610
+ this.destroy$.next();
4611
+ this.destroy$.complete();
4612
+ }
4613
+ closeMobileMenu() {
4614
+ const collapseEl = this.element?.querySelector('.navbar-collapse');
4615
+ if (collapseEl && collapseEl.classList.contains('show')) {
4616
+ const bsCollapse = Collapse.getOrCreateInstance(collapseEl);
4617
+ bsCollapse.hide();
4618
+ }
4619
+ }
4582
4620
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: NavbarComponent, deps: [{ token: UniqueIdService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
4583
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.15", type: NavbarComponent, isStandalone: false, selector: "rlb-navbar", inputs: { dark: ["dark", "dark", booleanAttribute], color: "color", placement: "placement", expand: "expand", cssClass: ["class", "cssClass"], enableDropdownToggler: ["enable-dropdown-toggler", "enableDropdownToggler", booleanAttribute] }, viewQueries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, static: true }], ngImport: i0, template: ` <ng-template #template>
4621
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.15", type: NavbarComponent, isStandalone: false, selector: "rlb-navbar", inputs: { dark: ["dark", "dark", booleanAttribute], color: "color", placement: "placement", expand: "expand", cssClass: ["class", "cssClass"], enableDropdownToggler: ["enable-dropdown-toggler", "enableDropdownToggler", booleanAttribute] }, queries: [{ propertyName: "navbarItemsGroups", predicate: NavbarItemsComponent, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, static: true }], ngImport: i0, template: ` <ng-template #template>
4584
4622
  <nav
4585
4623
  class="navbar px-2 bg-{{ color }} {{ placement }} {{ _navExpand }} {{ cssClass }}"
4586
4624
  [attr.data-bs-theme]="dark"
@@ -4650,6 +4688,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
4650
4688
  }], ctorParameters: () => [{ type: UniqueIdService }, { type: i0.ViewContainerRef }], propDecorators: { template: [{
4651
4689
  type: ViewChild,
4652
4690
  args: ['template', { static: true }]
4691
+ }], navbarItemsGroups: [{
4692
+ type: ContentChildren,
4693
+ args: [NavbarItemsComponent, { descendants: true }]
4653
4694
  }], dark: [{
4654
4695
  type: Input,
4655
4696
  args: [{ alias: 'dark', transform: booleanAttribute }]