@open-rlb/ng-bootstrap 3.1.25 → 3.1.27

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Component, input, booleanAttribute, effect, Host, Self, Optional, Directive, Injectable, output, contentChild, computed, contentChildren, viewChild, numberAttribute, model, ViewChild, isSignal, Pipe, ChangeDetectionStrategy, inject, ViewContainerRef, Renderer2, DestroyRef, DOCUMENT, Inject, HostListener, InjectionToken, viewChildren, untracked, EventEmitter, Output, NgModule } from '@angular/core';
2
+ import { signal, Component, input, booleanAttribute, effect, Host, Self, Optional, Directive, Injectable, output, contentChild, computed, contentChildren, viewChild, numberAttribute, model, ViewChild, isSignal, Pipe, ChangeDetectionStrategy, inject, ViewContainerRef, Renderer2, DOCUMENT, Inject, HostListener, InjectionToken, viewChildren, untracked, EventEmitter, Output, NgModule } from '@angular/core';
3
3
  import { Collapse, Carousel, Dropdown, Modal, Toast, Offcanvas, ScrollSpy, Popover, Tooltip } from 'bootstrap';
4
4
  import * as i2 from '@angular/router';
5
5
  import { RouterModule } from '@angular/router';
@@ -4212,10 +4212,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
4212
4212
 
4213
4213
  class NavbarDropdownItemComponent {
4214
4214
  constructor() {
4215
- this.viewContainerRef = inject(ViewContainerRef);
4216
- this.renderer = inject(Renderer2);
4217
- this.destroyRef = inject(DestroyRef);
4218
- this.template = viewChild.required('template');
4215
+ this.listeners = [];
4219
4216
  this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), alias: 'disabled', transform: booleanAttribute });
4220
4217
  this.dropdown = input(false, { ...(ngDevMode ? { debugName: "dropdown" } : {}), alias: 'dropdown', transform: booleanAttribute });
4221
4218
  this.href = input(undefined, ...(ngDevMode ? [{ debugName: "href" }] : []));
@@ -4226,6 +4223,8 @@ class NavbarDropdownItemComponent {
4226
4223
  this.statusChanged = output({ alias: 'status-changed' });
4227
4224
  this._autoClose = computed(() => {
4228
4225
  switch (this.autoClose()) {
4226
+ case 'default':
4227
+ return 'true';
4229
4228
  case 'inside':
4230
4229
  return 'inside';
4231
4230
  case 'outside':
@@ -4236,28 +4235,20 @@ class NavbarDropdownItemComponent {
4236
4235
  return 'true';
4237
4236
  }
4238
4237
  }, ...(ngDevMode ? [{ debugName: "_autoClose" }] : []));
4239
- effect(() => {
4240
- const template = this.template();
4241
- const dropdownEnabled = this.dropdown();
4242
- const templateView = this.viewContainerRef.createEmbeddedView(template);
4243
- this.element = templateView.rootNodes[0];
4244
- this.viewContainerRef.element.nativeElement.remove();
4245
- const anchor = this.element.querySelector('a');
4246
- if (!anchor || !dropdownEnabled)
4247
- return;
4238
+ this.template = viewChild.required('template');
4239
+ this.viewContainerRef = inject(ViewContainerRef);
4240
+ this.renderer = inject(Renderer2);
4241
+ }
4242
+ ngOnInit() {
4243
+ const templateView = this.viewContainerRef.createEmbeddedView(this.template());
4244
+ this.element = templateView.rootNodes[0];
4245
+ this.viewContainerRef.element.nativeElement.remove();
4246
+ const anchor = this.element.querySelector('a');
4247
+ if (anchor && this.dropdown()) {
4248
+ anchor.setAttribute('data-bs-auto-close', this._autoClose());
4248
4249
  this.dropdownInstance = Dropdown.getOrCreateInstance(anchor);
4249
- const unsubShow = this.renderer.listen(anchor, 'show.bs.dropdown', () => this.statusChanged.emit('show'));
4250
- const unsubShown = this.renderer.listen(anchor, 'shown.bs.dropdown', () => this.statusChanged.emit('shown'));
4251
- const unsubHide = this.renderer.listen(anchor, 'hide.bs.dropdown', () => this.statusChanged.emit('hide'));
4252
- const unsubHidden = this.renderer.listen(anchor, 'hidden.bs.dropdown', () => this.statusChanged.emit('hidden'));
4253
- this.destroyRef.onDestroy(() => {
4254
- unsubShow();
4255
- unsubShown();
4256
- unsubHide();
4257
- unsubHidden();
4258
- this.dropdownInstance?.dispose();
4259
- });
4260
- });
4250
+ this.listeners.push(this.renderer.listen(anchor, 'show.bs.dropdown', () => this.statusChanged.emit('show')), this.renderer.listen(anchor, 'shown.bs.dropdown', () => this.statusChanged.emit('shown')), this.renderer.listen(anchor, 'hide.bs.dropdown', () => this.statusChanged.emit('hide')), this.renderer.listen(anchor, 'hidden.bs.dropdown', () => this.statusChanged.emit('hidden')));
4251
+ }
4261
4252
  }
4262
4253
  open() {
4263
4254
  this.dropdownInstance?.show();
@@ -4268,6 +4259,10 @@ class NavbarDropdownItemComponent {
4268
4259
  toggleDropdown() {
4269
4260
  this.dropdownInstance?.toggle();
4270
4261
  }
4262
+ ngOnDestroy() {
4263
+ this.listeners.forEach(unsub => unsub());
4264
+ this.listeners = [];
4265
+ }
4271
4266
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: NavbarDropdownItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4272
4267
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: NavbarDropdownItemComponent, isStandalone: false, selector: "rlb-navbar-dropdown-item", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dropdown: { classPropertyName: "dropdown", publicName: "dropdown", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, cssClass: { classPropertyName: "cssClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, autoClose: { classPropertyName: "autoClose", publicName: "auto-close", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { click: "click", statusChanged: "status-changed" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["template"], descendants: true, isSignal: true }], ngImport: i0, template: `
4273
4268
  <ng-template #template>
@@ -4287,7 +4282,6 @@ class NavbarDropdownItemComponent {
4287
4282
  >
4288
4283
  <ng-content select=":not(rlb-dropdown-container)"></ng-content>
4289
4284
  </a>
4290
-
4291
4285
  <ng-content select="rlb-dropdown-container"></ng-content>
4292
4286
  </li>
4293
4287
  </ng-template>
@@ -4315,14 +4309,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
4315
4309
  >
4316
4310
  <ng-content select=":not(rlb-dropdown-container)"></ng-content>
4317
4311
  </a>
4318
-
4319
4312
  <ng-content select="rlb-dropdown-container"></ng-content>
4320
4313
  </li>
4321
4314
  </ng-template>
4322
4315
  `,
4323
4316
  standalone: false,
4324
4317
  }]
4325
- }], ctorParameters: () => [], propDecorators: { template: [{ type: i0.ViewChild, args: ['template', { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dropdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdown", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], cssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], toggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggle", required: false }] }], autoClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "auto-close", required: false }] }], click: [{ type: i0.Output, args: ["click"] }], statusChanged: [{ type: i0.Output, args: ["status-changed"] }] } });
4318
+ }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dropdown: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdown", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], cssClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], toggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggle", required: false }] }], autoClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "auto-close", required: false }] }], click: [{ type: i0.Output, args: ["click"] }], statusChanged: [{ type: i0.Output, args: ["status-changed"] }], template: [{ type: i0.ViewChild, args: ['template', { isSignal: true }] }] } });
4326
4319
 
4327
4320
  class NavbarItemComponent {
4328
4321
  constructor(viewContainerRef) {