@coreui/angular-pro 4.5.28 → 4.5.29

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,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, Input, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, booleanAttribute, ContentChildren, HostListener, Pipe, ViewChildren, Inject, ViewChild, forwardRef, Optional, ElementRef, ContentChild, inject, DestroyRef, ChangeDetectionStrategy, signal, computed, effect, PLATFORM_ID, TemplateRef, ViewContainerRef, numberAttribute } from '@angular/core';
2
+ import { Directive, Input, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, booleanAttribute, ContentChildren, HostListener, inject, RendererFactory2, Pipe, ViewChildren, Inject, ViewChild, forwardRef, Optional, ElementRef, ContentChild, DestroyRef, ChangeDetectionStrategy, signal, computed, NgZone, effect, PLATFORM_ID, TemplateRef, ViewContainerRef, numberAttribute } from '@angular/core';
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
4
4
  import * as i1$2 from '@angular/common';
5
- import { NgTemplateOutlet, NgIf, NgClass, NgForOf, AsyncPipe, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, DOCUMENT, CommonModule, formatDate, I18nPluralPipe, isPlatformBrowser } from '@angular/common';
5
+ import { NgTemplateOutlet, NgIf, NgClass, DOCUMENT, NgForOf, AsyncPipe, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, CommonModule, formatDate, I18nPluralPipe, isPlatformBrowser } from '@angular/common';
6
6
  import * as i1 from '@angular/animations';
7
7
  import { animation, animate, style, useAnimation, trigger, state, transition, group, query } from '@angular/animations';
8
+ import { Subject, BehaviorSubject, Observable, fromEvent, zipWith, withLatestFrom, skip, distinctUntilChanged as distinctUntilChanged$1, map as map$1, debounceTime as debounceTime$1 } from 'rxjs';
8
9
  import * as i1$1 from '@angular/router';
9
10
  import { RouterModule, NavigationEnd, RouterLink } from '@angular/router';
10
- import { BehaviorSubject, Observable, fromEvent, zipWith, withLatestFrom, Subject, skip, distinctUntilChanged as distinctUntilChanged$1, map as map$1, debounceTime as debounceTime$1 } from 'rxjs';
11
11
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
12
  import { filter, tap, distinctUntilChanged, debounceTime, map, delay, combineLatestWith, take } from 'rxjs/operators';
13
13
  import * as i1$3 from '@angular/forms';
@@ -15,7 +15,7 @@ import { FormGroup, FormControl, Validators, NG_VALUE_ACCESSOR, ReactiveFormsMod
15
15
  import { createPopper } from '@popperjs/core';
16
16
  import * as i1$4 from '@angular/cdk/layout';
17
17
  import * as i1$5 from '@angular/cdk/a11y';
18
- import { FocusKeyManager, A11yModule } from '@angular/cdk/a11y';
18
+ import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
19
19
  import { SelectionModel } from '@angular/cdk/collections';
20
20
  import { CdkFixedSizeVirtualScroll, CdkVirtualScrollViewport, CdkVirtualForOf } from '@angular/cdk/scrolling';
21
21
  import { IconDirective } from '@coreui/icons-angular';
@@ -1069,6 +1069,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1069
1069
  }]
1070
1070
  }] });
1071
1071
 
1072
+ class BackdropService {
1073
+ constructor() {
1074
+ this.#backdropClick = new Subject();
1075
+ this.backdropClick$ = this.#backdropClick.asObservable();
1076
+ this.#document = inject(DOCUMENT);
1077
+ this.#rendererFactory = inject(RendererFactory2);
1078
+ this.#renderer = this.#rendererFactory.createRenderer(null, null);
1079
+ this.scrollbarWidth = this.#scrollbarWidth;
1080
+ this.#scrollBarVisible = true;
1081
+ }
1082
+ #backdropClick;
1083
+ #document;
1084
+ #rendererFactory;
1085
+ #renderer;
1086
+ #unListen;
1087
+ get #scrollbarWidth() {
1088
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
1089
+ const documentWidth = this.#document.documentElement.clientWidth;
1090
+ const scrollbarWidth = Math.abs((window?.innerWidth ?? documentWidth) - documentWidth);
1091
+ return `${scrollbarWidth}px`;
1092
+ }
1093
+ setBackdrop(type = 'modal') {
1094
+ const backdropElement = this.#renderer.createElement('div');
1095
+ this.#renderer.addClass(backdropElement, `${type}-backdrop`);
1096
+ this.#renderer.addClass(backdropElement, 'fade');
1097
+ this.#renderer.appendChild(this.#document.body, backdropElement);
1098
+ this.#unListen = this.#renderer.listen(backdropElement, 'click', (e) => {
1099
+ this.onClickHandler();
1100
+ });
1101
+ this.scrollbarWidth = this.#scrollbarWidth;
1102
+ setTimeout(() => {
1103
+ this.#renderer.addClass(backdropElement, 'show');
1104
+ // this.hideScrollbar();
1105
+ });
1106
+ this.activeBackdrop = backdropElement;
1107
+ return backdropElement;
1108
+ }
1109
+ clearBackdrop(backdropElement) {
1110
+ if (backdropElement) {
1111
+ this.#unListen();
1112
+ this.#renderer.removeClass(backdropElement, 'show');
1113
+ setTimeout(() => {
1114
+ this.#renderer.removeChild(this.#document.body, backdropElement);
1115
+ if (this.activeBackdrop === backdropElement) {
1116
+ this.resetScrollbar();
1117
+ }
1118
+ backdropElement = undefined;
1119
+ }, 300);
1120
+ }
1121
+ return undefined;
1122
+ }
1123
+ get #isRTL() { return this.#document.documentElement.dir === 'rtl' || this.#document.body.dir === 'rtl'; }
1124
+ #scrollBarVisible;
1125
+ hideScrollbar() {
1126
+ if (this.#scrollBarVisible) {
1127
+ this.#renderer.setStyle(this.#document.body, 'overflow', 'hidden');
1128
+ this.#renderer.setStyle(this.#document.body, `padding-${this.#isRTL ? 'left' : 'right'}`, this.scrollbarWidth);
1129
+ this.#scrollBarVisible = false;
1130
+ }
1131
+ }
1132
+ resetScrollbar() {
1133
+ this.#renderer.removeStyle(this.#document.body, 'overflow');
1134
+ this.#renderer.removeStyle(this.#document.body, `padding-${this.#isRTL ? 'left' : 'right'}`);
1135
+ this.#scrollBarVisible = true;
1136
+ }
1137
+ onClickHandler() {
1138
+ this.#backdropClick.next(true);
1139
+ }
1140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1141
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, providedIn: 'root' }); }
1142
+ }
1143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, decorators: [{
1144
+ type: Injectable,
1145
+ args: [{
1146
+ providedIn: 'root'
1147
+ }]
1148
+ }] });
1149
+
1072
1150
  class BreadcrumbItemComponent {
1073
1151
  get ariaCurrent() {
1074
1152
  return this.active ? 'page' : null;
@@ -8416,12 +8494,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8416
8494
 
8417
8495
  class MultiSelectOptionComponent {
8418
8496
  #destroyRef;
8497
+ #ngZone;
8419
8498
  constructor(elementRef, changeDetectorRef, focusMonitor, multiSelectService) {
8420
8499
  this.elementRef = elementRef;
8421
8500
  this.changeDetectorRef = changeDetectorRef;
8422
8501
  this.focusMonitor = focusMonitor;
8423
8502
  this.multiSelectService = multiSelectService;
8424
8503
  this.#destroyRef = inject(DestroyRef);
8504
+ this.#ngZone = inject(NgZone);
8425
8505
  /**
8426
8506
  * Option style
8427
8507
  * @type ('checkbox' | 'text')
@@ -8429,34 +8509,37 @@ class MultiSelectOptionComponent {
8429
8509
  */
8430
8510
  this.optionsStyle = this.multiSelectService.optionsStyle;
8431
8511
  this.#visible = signal(true);
8432
- this.#disabled = false;
8512
+ /**
8513
+ * Option disabled.
8514
+ * @type boolean
8515
+ * @default false
8516
+ */
8517
+ this.disabled = false;
8433
8518
  this.#selected = signal(undefined);
8434
- this.#selectedEffect = effect(() => {
8435
- const value = this.#value();
8436
- const selected = this.#selected();
8437
- if ((value !== undefined) && (selected !== undefined)) {
8438
- selected ? this.multiSelectService.selectionModel?.select(value) : this.multiSelectService.selectionModel?.deselect(value);
8439
- this.ariaSelected = selected;
8440
- this.selectedChange.emit(selected);
8441
- this.changeDetectorRef.markForCheck();
8442
- }
8443
- });
8444
8519
  /**
8445
8520
  * Emits option selected change
8446
8521
  * @type boolean
8447
8522
  */
8448
8523
  this.selectedChange = new EventEmitter();
8449
8524
  this.#value = signal(undefined);
8450
- this.hasContent = true;
8525
+ this.hasContent = signal(true);
8451
8526
  this.#dropdownVisible = signal(false);
8452
8527
  this.#active = signal(false);
8453
- this.#activeEffect = effect(() => {
8454
- this.tabIndex = this.#active() && this.#visible() ? 0 : -1;
8455
- });
8456
8528
  this.#focused = false;
8457
8529
  this.focusChange = new EventEmitter();
8458
- this.#tabIndex = -1;
8459
- this.#ariaSelected = undefined;
8530
+ this.#tabIndex = computed(() => {
8531
+ return (this.#active() && this.#visible() ? 0 : -1);
8532
+ });
8533
+ this.#ariaSelected = computed(() => {
8534
+ const value = this.#value();
8535
+ const selected = this.#selected();
8536
+ if ((value !== undefined) && (selected !== undefined)) {
8537
+ selected ? this.multiSelectService.selectionModel?.select(value) : this.multiSelectService.selectionModel?.deselect(value);
8538
+ this.selectedChange.emit(selected);
8539
+ this.changeDetectorRef.markForCheck();
8540
+ }
8541
+ return selected;
8542
+ });
8460
8543
  }
8461
8544
  /**
8462
8545
  * Option visible.
@@ -8464,24 +8547,12 @@ class MultiSelectOptionComponent {
8464
8547
  * @default true
8465
8548
  */
8466
8549
  set visible(value) {
8467
- this.#visible.set(coerceBooleanProperty(value));
8550
+ this.#visible.set(value);
8468
8551
  }
8469
8552
  get visible() {
8470
8553
  return this.#visible();
8471
8554
  }
8472
8555
  #visible;
8473
- /**
8474
- * Option disabled.
8475
- * @type boolean
8476
- * @default false
8477
- */
8478
- set disabled(value) {
8479
- this.#disabled = coerceBooleanProperty(value);
8480
- }
8481
- get disabled() {
8482
- return this.#disabled;
8483
- }
8484
- #disabled;
8485
8556
  /**
8486
8557
  * Option selected.
8487
8558
  * @type boolean
@@ -8489,7 +8560,7 @@ class MultiSelectOptionComponent {
8489
8560
  */
8490
8561
  set selected(value) {
8491
8562
  if (value !== undefined) {
8492
- const selected = coerceBooleanProperty(value);
8563
+ const selected = booleanAttribute(value);
8493
8564
  if (this.#selected() !== selected) {
8494
8565
  this.#selected.set(selected);
8495
8566
  if (this.value !== undefined) {
@@ -8502,7 +8573,6 @@ class MultiSelectOptionComponent {
8502
8573
  return this.#selected();
8503
8574
  }
8504
8575
  #selected;
8505
- #selectedEffect;
8506
8576
  /**
8507
8577
  * Option value.
8508
8578
  * @type string
@@ -8519,7 +8589,7 @@ class MultiSelectOptionComponent {
8519
8589
  #value;
8520
8590
  #dropdownVisible;
8521
8591
  set active(value) {
8522
- const active = coerceBooleanProperty(value) && this.#visible() && !this.disabled;
8592
+ const active = value && this.#visible() && !this.disabled;
8523
8593
  if (this.#active() !== active) {
8524
8594
  this.#active.set(active);
8525
8595
  }
@@ -8528,7 +8598,6 @@ class MultiSelectOptionComponent {
8528
8598
  return this.#active() && this.#visible();
8529
8599
  }
8530
8600
  #active;
8531
- #activeEffect;
8532
8601
  #focused;
8533
8602
  get role() {
8534
8603
  return 'option';
@@ -8545,25 +8614,14 @@ class MultiSelectOptionComponent {
8545
8614
  };
8546
8615
  }
8547
8616
  get tabIndex() {
8548
- // return this.disabled || !this._active ? -1 : 0;
8549
- return (this.disabled || !this.#visible()) ? -1 : this.#tabIndex;
8550
- }
8551
- set tabIndex(tabindex) {
8552
- setTimeout(() => {
8553
- this.#tabIndex = tabindex;
8554
- });
8617
+ return (this.disabled || !this.#visible()) ? -1 : this.#tabIndex();
8555
8618
  }
8556
8619
  #tabIndex;
8557
8620
  get ariaDisabled() {
8558
8621
  return this.disabled || null;
8559
8622
  }
8560
8623
  get ariaSelected() {
8561
- return this.#ariaSelected;
8562
- }
8563
- set ariaSelected(selected) {
8564
- setTimeout(() => {
8565
- this.#ariaSelected = selected || undefined;
8566
- });
8624
+ return this.#ariaSelected() ?? false;
8567
8625
  }
8568
8626
  #ariaSelected;
8569
8627
  onKeyDown($event) {
@@ -8597,18 +8655,23 @@ class MultiSelectOptionComponent {
8597
8655
  }
8598
8656
  ngAfterViewInit() {
8599
8657
  this.setSubscriptions();
8600
- setTimeout(() => {
8601
- this.hasContent = !!this.contentDiv?.nativeElement.childNodes.length;
8602
- if (!this.hasContent) {
8603
- this.changeDetectorRef.markForCheck();
8604
- }
8605
- });
8658
+ const hasContent = !!this.contentDiv?.nativeElement.childNodes.length;
8659
+ if (!hasContent) {
8660
+ this.#ngZone.runOutsideAngular(() => {
8661
+ setTimeout(() => {
8662
+ this.hasContent.set(hasContent);
8663
+ // this.#ngZone.run(() => {
8664
+ // this.changeDetectorRef.markForCheck();
8665
+ // });
8666
+ });
8667
+ });
8668
+ }
8606
8669
  if (this.text === undefined) {
8607
8670
  const innerText = this.elementRef.nativeElement.textContent.trim() || this.elementRef.nativeElement.innerText.trim();
8608
- this.text = innerText || this.value?.trim() || '...';
8671
+ this.text = innerText || this.value?.trim();
8609
8672
  }
8610
8673
  if (this.label === undefined) {
8611
- this.label = this.text?.trim() || '...';
8674
+ this.label = this.text?.trim();
8612
8675
  }
8613
8676
  if (this.value === undefined) {
8614
8677
  this.value = this.label?.trim() || '...';
@@ -8657,11 +8720,11 @@ class MultiSelectOptionComponent {
8657
8720
  return (this.#selected() || this.multiSelectService.selectionModel?.isSelected(value)) ?? false;
8658
8721
  }
8659
8722
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MultiSelectOptionComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$5.FocusMonitor }, { token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component }); }
8660
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MultiSelectOptionComponent, isStandalone: true, selector: "c-multi-select-option", inputs: { optionsStyle: "optionsStyle", label: "label", text: "text", visible: "visible", disabled: "disabled", selected: "selected", value: "value", active: "active", role: "role" }, outputs: { selectedChange: "selectedChange", focusChange: "focusChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "blur": "onBlur()", "focus": "onFocus()", "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "role": "this.role", "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.ariaDisabled", "attr.aria-disabled": "this.ariaDisabled", "attr.aria-selected": "this.ariaSelected" } }, viewQueries: [{ propertyName: "contentDiv", first: true, predicate: ["contentDiv"], descendants: true }], exportAs: ["cMultiSelectOption"], ngImport: i0, template: "<div #contentDiv>\n <ng-content></ng-content>\n</div>\n<div *ngIf=\"!hasContent\">\n {{text ?? label ?? value}}\n</div>\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}:host.active{border-radius:var(--cui-form-multi-select-option-indicator-border-radius, .375rem);box-shadow:0 0 .125rem 0 var(--cui-gray-400)}:host.focused,:host :focus-visible{box-shadow:0 0 0 .125rem #321fdb40;outline:none}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8723
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "16.2.12", type: MultiSelectOptionComponent, isStandalone: true, selector: "c-multi-select-option", inputs: { optionsStyle: "optionsStyle", label: "label", text: "text", visible: ["visible", "visible", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], selected: "selected", value: "value", active: ["active", "active", booleanAttribute], role: "role" }, outputs: { selectedChange: "selectedChange", focusChange: "focusChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "blur": "onBlur()", "focus": "onFocus()", "keyup": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "role": "this.role", "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.ariaDisabled", "attr.aria-disabled": "this.ariaDisabled", "attr.aria-selected": "this.ariaSelected" } }, viewQueries: [{ propertyName: "contentDiv", first: true, predicate: ["contentDiv"], descendants: true }], exportAs: ["cMultiSelectOption"], ngImport: i0, template: "<div #contentDiv>\n <ng-content></ng-content>\n</div>\n<div *ngIf=\"!hasContent()\">\n {{text ?? label ?? value}}\n</div>\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}:host.active{border-radius:var(--cui-form-multi-select-option-indicator-border-radius, .375rem);box-shadow:0 0 .125rem 0 var(--cui-gray-400)}:host.focused,:host :focus-visible{box-shadow:0 0 0 .125rem #321fdb40;outline:none}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8661
8724
  }
8662
8725
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MultiSelectOptionComponent, decorators: [{
8663
8726
  type: Component,
8664
- args: [{ selector: 'c-multi-select-option', exportAs: 'cMultiSelectOption', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgIf], template: "<div #contentDiv>\n <ng-content></ng-content>\n</div>\n<div *ngIf=\"!hasContent\">\n {{text ?? label ?? value}}\n</div>\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}:host.active{border-radius:var(--cui-form-multi-select-option-indicator-border-radius, .375rem);box-shadow:0 0 .125rem 0 var(--cui-gray-400)}:host.focused,:host :focus-visible{box-shadow:0 0 0 .125rem #321fdb40;outline:none}\n"] }]
8727
+ args: [{ selector: 'c-multi-select-option', exportAs: 'cMultiSelectOption', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgIf], template: "<div #contentDiv>\n <ng-content></ng-content>\n</div>\n<div *ngIf=\"!hasContent()\">\n {{text ?? label ?? value}}\n</div>\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none;white-space:nowrap;overflow:hidden}:host.active{border-radius:var(--cui-form-multi-select-option-indicator-border-radius, .375rem);box-shadow:0 0 .125rem 0 var(--cui-gray-400)}:host.focused,:host :focus-visible{box-shadow:0 0 0 .125rem #321fdb40;outline:none}\n"] }]
8665
8728
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$5.FocusMonitor }, { type: MultiSelectService }]; }, propDecorators: { optionsStyle: [{
8666
8729
  type: Input
8667
8730
  }], label: [{
@@ -8669,9 +8732,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8669
8732
  }], text: [{
8670
8733
  type: Input
8671
8734
  }], visible: [{
8672
- type: Input
8735
+ type: Input,
8736
+ args: [{ transform: booleanAttribute }]
8673
8737
  }], disabled: [{
8674
- type: Input
8738
+ type: Input,
8739
+ args: [{ transform: booleanAttribute }]
8675
8740
  }], selected: [{
8676
8741
  type: Input
8677
8742
  }], selectedChange: [{
@@ -8682,7 +8747,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
8682
8747
  type: ViewChild,
8683
8748
  args: ['contentDiv']
8684
8749
  }], active: [{
8685
- type: Input
8750
+ type: Input,
8751
+ args: [{ transform: booleanAttribute }]
8686
8752
  }], focusChange: [{
8687
8753
  type: Output
8688
8754
  }], role: [{
@@ -8824,11 +8890,11 @@ class MultiSelectTagComponent {
8824
8890
  }
8825
8891
  }
8826
8892
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MultiSelectTagComponent, deps: [{ token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component }); }
8827
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MultiSelectTagComponent, isStandalone: true, selector: "c-multi-select-tag", inputs: { option: "option", disabled: "disabled", label: "label", value: "value" }, outputs: { remove: "remove" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "{{label ?? value ?? '???'}}\n<button (click)=\"handleRemove($event)\" *ngIf=\"!disabled\"\n [disabled]=\"((multiselectVisible$ | async) ?? true) === false\" aria-label=\"Clear\"\n class=\"form-multi-select-tag-delete close\" type=\"button\">\n <span aria-hidden=\"true\">\u00D7</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
8893
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MultiSelectTagComponent, isStandalone: true, selector: "c-multi-select-tag", inputs: { option: "option", disabled: "disabled", label: "label", value: "value" }, outputs: { remove: "remove" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "{{label ?? value ?? '???'}}\n<button (click)=\"handleRemove($event)\" *ngIf=\"!disabled\"\n [disabled]=\"((multiselectVisible$ | async) ?? true) === false\" aria-label=\"Clear\"\n class=\"form-multi-select-tag-delete close\" type=\"button\">\n <span aria-hidden=\"true\">\u00D7</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8828
8894
  }
8829
8895
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MultiSelectTagComponent, decorators: [{
8830
8896
  type: Component,
8831
- args: [{ selector: 'c-multi-select-tag', standalone: true, imports: [NgIf, AsyncPipe], template: "{{label ?? value ?? '???'}}\n<button (click)=\"handleRemove($event)\" *ngIf=\"!disabled\"\n [disabled]=\"((multiselectVisible$ | async) ?? true) === false\" aria-label=\"Clear\"\n class=\"form-multi-select-tag-delete close\" type=\"button\">\n <span aria-hidden=\"true\">\u00D7</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"] }]
8897
+ args: [{ selector: 'c-multi-select-tag', standalone: true, imports: [NgIf, AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "{{label ?? value ?? '???'}}\n<button (click)=\"handleRemove($event)\" *ngIf=\"!disabled\"\n [disabled]=\"((multiselectVisible$ | async) ?? true) === false\" aria-label=\"Clear\"\n class=\"form-multi-select-tag-delete close\" type=\"button\">\n <span aria-hidden=\"true\">\u00D7</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"] }]
8832
8898
  }], ctorParameters: function () { return [{ type: MultiSelectService }]; }, propDecorators: { option: [{
8833
8899
  type: Input
8834
8900
  }], disabled: [{
@@ -9445,9 +9511,9 @@ class MultiSelectComponent {
9445
9511
  this.setFocus('program', 'selectionModel.changed (single)');
9446
9512
  }), takeUntilDestroyed(this.destroyRef))
9447
9513
  .subscribe();
9448
- this.#optionsReady$.pipe(filter(() => !this.virtualScroller), takeUntilDestroyed(this.destroyRef), delay(0), tap(() => {
9514
+ this.#optionsReady$.pipe(filter(() => !this.virtualScroller), delay(0), tap(() => {
9449
9515
  this.setFocusKeyManager([...this.multiSelectOptionsContent, ...this.multiSelectOptionsView]);
9450
- })).subscribe();
9516
+ }), takeUntilDestroyed(this.destroyRef)).subscribe();
9451
9517
  this.multiSelectService.selectionModel.changed
9452
9518
  .pipe(tap(change => {
9453
9519
  const { added } = { ...change };
@@ -9872,9 +9938,9 @@ class MultiSelectComponent {
9872
9938
  setListKeyManager() {
9873
9939
  // run once on multiSelectOptionsContent first set
9874
9940
  this.multiSelectOptionsContent.changes
9875
- .pipe(filter((changes) => this.virtualScroller), take(1), takeUntilDestroyed(this.destroyRef), tap(() => {
9941
+ .pipe(filter((changes) => this.virtualScroller), take(1), tap(() => {
9876
9942
  this.setFocusKeyManager(this.multiSelectOptionsContent);
9877
- }))
9943
+ }), takeUntilDestroyed(this.destroyRef))
9878
9944
  .subscribe();
9879
9945
  }
9880
9946
  setFocusKeyManager(focusableOptions) {
@@ -10672,67 +10738,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10672
10738
  args: ['class']
10673
10739
  }] } });
10674
10740
 
10675
- class BackdropService {
10676
- constructor(document, rendererFactory) {
10677
- this.document = document;
10678
- this.rendererFactory = rendererFactory;
10679
- this.backdropClick = new Subject();
10680
- this.backdropClick$ = this.backdropClick.asObservable();
10681
- this.renderer = rendererFactory.createRenderer(null, null);
10682
- }
10683
- get scrollbarWidth() {
10684
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
10685
- const documentWidth = this.document.documentElement.clientWidth;
10686
- const scrollbarWidth = Math.abs((window?.innerWidth ?? documentWidth) - documentWidth);
10687
- return `${scrollbarWidth}px`;
10688
- }
10689
- setBackdrop(type = 'modal') {
10690
- const backdropElement = this.renderer.createElement('div');
10691
- this.renderer.addClass(backdropElement, `${type}-backdrop`);
10692
- this.renderer.addClass(backdropElement, 'fade');
10693
- this.renderer.appendChild(this.document.body, backdropElement);
10694
- this.unListen = this.renderer.listen(backdropElement, 'click', (e) => {
10695
- this.onClickHandler();
10696
- });
10697
- setTimeout(() => {
10698
- this.renderer.addClass(backdropElement, 'show');
10699
- });
10700
- return backdropElement;
10701
- }
10702
- clearBackdrop(backdrop) {
10703
- if (backdrop) {
10704
- this.unListen();
10705
- this.renderer.removeClass(backdrop, 'show');
10706
- setTimeout(() => {
10707
- this.renderer.removeChild(this.document.body, backdrop);
10708
- backdrop = undefined;
10709
- }, 300);
10710
- }
10711
- return backdrop;
10712
- }
10713
- onClickHandler() {
10714
- this.backdropClick.next(true);
10715
- }
10716
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, deps: [{ token: DOCUMENT }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable }); }
10717
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, providedIn: 'root' }); }
10718
- }
10719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BackdropService, decorators: [{
10720
- type: Injectable,
10721
- args: [{
10722
- providedIn: 'root'
10723
- }]
10724
- }], ctorParameters: function () { return [{ type: Document, decorators: [{
10725
- type: Inject,
10726
- args: [DOCUMENT]
10727
- }] }, { type: i0.RendererFactory2 }]; } });
10728
-
10729
10741
  class ModalComponent {
10742
+ #destroyRef;
10743
+ #focusMonitor;
10730
10744
  constructor(document, renderer, hostElement, modalService, backdropService) {
10731
10745
  this.document = document;
10732
10746
  this.renderer = renderer;
10733
10747
  this.hostElement = hostElement;
10734
10748
  this.modalService = modalService;
10735
10749
  this.backdropService = backdropService;
10750
+ this.#destroyRef = inject(DestroyRef);
10751
+ this.#focusMonitor = inject(FocusMonitor);
10736
10752
  /**
10737
10753
  * Align the modal in the center or top of the screen.
10738
10754
  * @type {'top' | 'center'}
@@ -10761,46 +10777,72 @@ class ModalComponent {
10761
10777
  * @default 'dialog'
10762
10778
  */
10763
10779
  this.role = 'dialog';
10780
+ this.#ariaModal = null;
10764
10781
  /**
10765
- * Set aria-modal html attr for modal. [docs]
10782
+ * Create a scrollable modal that allows scrolling the modal body.
10766
10783
  * @type boolean
10767
- * @default true
10768
10784
  */
10769
- this.ariaModal = true;
10770
- this._scrollable = false;
10785
+ this.scrollable = false;
10786
+ this.#visible = signal(false);
10787
+ this.#activeElement = null;
10788
+ this.#visibleEffect = effect(() => {
10789
+ if (this.#visible() && this.#afterViewInit()) {
10790
+ this.#activeElement = this.document.activeElement;
10791
+ // this.#activeElement?.blur();
10792
+ setTimeout(() => {
10793
+ const focusable = this.modalContentRef.nativeElement.querySelectorAll('[tabindex]:not([tabindex="-1"]), button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled])');
10794
+ this.#focusMonitor.focusVia(focusable[0], 'keyboard');
10795
+ });
10796
+ }
10797
+ else {
10798
+ if (this.document.contains(this.#activeElement)) {
10799
+ setTimeout(() => {
10800
+ this.#activeElement?.focus();
10801
+ this.#activeElement = null;
10802
+ });
10803
+ }
10804
+ }
10805
+ });
10771
10806
  /**
10772
10807
  * Event triggered on modal dismiss.
10773
10808
  */
10774
10809
  this.visibleChange = new EventEmitter();
10775
10810
  this._show = true;
10776
10811
  this.mouseDownTarget = null;
10812
+ this.#afterViewInit = signal(false);
10777
10813
  }
10778
10814
  /**
10779
- * Create a scrollable modal that allows scrolling the modal body.
10815
+ * Set aria-modal html attr for modal. [docs]
10780
10816
  * @type boolean
10817
+ * @default null
10781
10818
  */
10782
- set scrollable(value) {
10783
- this._scrollable = coerceBooleanProperty(value);
10819
+ set ariaModal(value) {
10820
+ this.#ariaModal = value;
10784
10821
  }
10785
- get scrollable() {
10786
- return this._scrollable;
10822
+ get ariaModal() {
10823
+ return this.visible || this.#ariaModal ? true : null;
10787
10824
  }
10825
+ ;
10826
+ #ariaModal;
10788
10827
  /**
10789
10828
  * Toggle the visibility of modal component.
10790
10829
  * @type boolean
10791
10830
  */
10792
10831
  set visible(value) {
10793
- const newValue = coerceBooleanProperty(value);
10794
- if (this._visible !== newValue) {
10795
- this._visible = newValue;
10796
- this.setBackdrop(this.backdrop !== false && newValue);
10797
- this.setBodyStyles(newValue);
10798
- this.visibleChange.emit(newValue);
10832
+ if (this.#visible() !== value) {
10833
+ this.#visible.set(value);
10834
+ this.setBackdrop(this.backdrop !== false && value);
10835
+ this.setBodyStyles(value);
10836
+ this.visibleChange.emit(value);
10799
10837
  }
10800
10838
  }
10801
10839
  get visible() {
10802
- return this._visible;
10840
+ return this.#visible();
10803
10841
  }
10842
+ #visible;
10843
+ #activeElement;
10844
+ #visibleEffect;
10845
+ #activeBackdrop;
10804
10846
  // private inBoundingClientRect!: boolean;
10805
10847
  get hostClasses() {
10806
10848
  return {
@@ -10826,10 +10868,8 @@ class ModalComponent {
10826
10868
  this._show = value;
10827
10869
  }
10828
10870
  animateStart(event) {
10829
- const scrollbarWidth = this.backdropService.scrollbarWidth;
10830
10871
  if (event.toState === 'visible') {
10831
- this.renderer.setStyle(this.document.body, 'overflow', 'hidden');
10832
- this.renderer.setStyle(this.document.body, 'padding-right', scrollbarWidth);
10872
+ this.backdropService.hideScrollbar();
10833
10873
  this.renderer.setStyle(this.hostElement.nativeElement, 'display', 'block');
10834
10874
  }
10835
10875
  else {
@@ -10842,8 +10882,6 @@ class ModalComponent {
10842
10882
  setTimeout(() => {
10843
10883
  if (event.toState === 'hidden') {
10844
10884
  this.renderer.setStyle(this.hostElement.nativeElement, 'display', 'none');
10845
- this.renderer.removeStyle(this.document.body, 'overflow');
10846
- this.renderer.removeStyle(this.document.body, 'padding-right');
10847
10885
  }
10848
10886
  });
10849
10887
  this.show = this.visible;
@@ -10878,36 +10916,32 @@ class ModalComponent {
10878
10916
  ngOnInit() {
10879
10917
  this.stateToggleSubscribe();
10880
10918
  }
10919
+ #afterViewInit;
10920
+ ngAfterViewInit() {
10921
+ this.#afterViewInit.set(true);
10922
+ }
10881
10923
  ngOnDestroy() {
10882
10924
  this.modalService.toggle({ show: false, modal: this });
10883
- this.stateToggleSubscribe(false);
10925
+ this.#afterViewInit.set(false);
10884
10926
  }
10885
- stateToggleSubscribe(subscribe = true) {
10886
- if (subscribe) {
10887
- this.stateToggleSubscription = this.modalService.modalState$.subscribe((action) => {
10888
- if (this === action.modal || this.id === action.id) {
10889
- if ('show' in action) {
10890
- this.visible = action?.show === 'toggle' ? !this.visible : action.show;
10891
- }
10927
+ stateToggleSubscribe() {
10928
+ this.modalService.modalState$
10929
+ .pipe(takeUntilDestroyed(this.#destroyRef))
10930
+ .subscribe((action) => {
10931
+ if (this === action.modal || this.id === action.id) {
10932
+ if ('show' in action) {
10933
+ this.visible = action?.show === 'toggle' ? !this.visible : action.show;
10892
10934
  }
10893
- else {
10894
- if (this.visible) {
10895
- this.visible = false;
10896
- }
10935
+ }
10936
+ else {
10937
+ if (this.visible) {
10938
+ this.visible = false;
10897
10939
  }
10898
- });
10899
- }
10900
- else {
10901
- this.stateToggleSubscription?.unsubscribe();
10902
- }
10940
+ }
10941
+ });
10903
10942
  }
10904
10943
  setBackdrop(setBackdrop) {
10905
- if (setBackdrop) {
10906
- this.activeBackdrop = this.backdropService.setBackdrop('modal');
10907
- }
10908
- else {
10909
- this.activeBackdrop = this.backdropService.clearBackdrop(this.activeBackdrop);
10910
- }
10944
+ this.#activeBackdrop = setBackdrop ? this.backdropService.setBackdrop('modal') : this.backdropService.clearBackdrop(this.#activeBackdrop);
10911
10945
  }
10912
10946
  setBodyStyles(open) {
10913
10947
  if (open) {
@@ -10930,7 +10964,7 @@ class ModalComponent {
10930
10964
  }
10931
10965
  }
10932
10966
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ModalComponent, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: ModalService }, { token: BackdropService }], target: i0.ɵɵFactoryTarget.Component }); }
10933
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: "alignment", backdrop: "backdrop", fullscreen: "fullscreen", keyboard: "keyboard", id: "id", size: "size", transition: "transition", role: "role", ariaModal: "ariaModal", scrollable: "scrollable", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keyup": "onKeyDownHandler($event)", "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, viewQueries: [{ propertyName: "modalContent", first: true, predicate: ModalContentComponent, descendants: true, read: ElementRef }], exportAs: ["cModal"], ngImport: i0, template: "<c-modal-dialog\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\n", dependencies: [{ kind: "component", type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { kind: "component", type: ModalContentComponent, selector: "c-modal-content" }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
10967
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "16.2.12", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: "alignment", backdrop: "backdrop", fullscreen: "fullscreen", keyboard: ["keyboard", "keyboard", booleanAttribute], id: "id", size: "size", transition: ["transition", "transition", booleanAttribute], role: "role", ariaModal: "ariaModal", scrollable: ["scrollable", "scrollable", booleanAttribute], visible: ["visible", "visible", booleanAttribute] }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keyup": "onKeyDownHandler($event)", "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, viewQueries: [{ propertyName: "modalContent", first: true, predicate: ModalContentComponent, descendants: true, read: ElementRef }, { propertyName: "modalContentRef", first: true, predicate: ["modalContentRef"], descendants: true, read: ElementRef }], exportAs: ["cModal"], ngImport: i0, template: "<c-modal-dialog\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\" #modalContentRef>\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\n", dependencies: [{ kind: "component", type: ModalDialogComponent, selector: "c-modal-dialog", inputs: ["alignment", "fullscreen", "scrollable", "size"] }, { kind: "component", type: ModalContentComponent, selector: "c-modal-content" }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
10934
10968
  trigger('showHide', [
10935
10969
  state('visible', style({
10936
10970
  // display: 'block'
@@ -10938,7 +10972,7 @@ class ModalComponent {
10938
10972
  state('hidden', style({
10939
10973
  // display: 'none'
10940
10974
  })),
10941
- transition('visible <=> *', [animate('300ms')])
10975
+ transition('visible <=> *', [animate('150ms')])
10942
10976
  ])
10943
10977
  ] }); }
10944
10978
  }
@@ -10952,9 +10986,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10952
10986
  state('hidden', style({
10953
10987
  // display: 'none'
10954
10988
  })),
10955
- transition('visible <=> *', [animate('300ms')])
10989
+ transition('visible <=> *', [animate('150ms')])
10956
10990
  ])
10957
- ], exportAs: 'cModal', standalone: true, imports: [ModalDialogComponent, ModalContentComponent, A11yModule], template: "<c-modal-dialog\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\">\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\n" }]
10991
+ ], exportAs: 'cModal', standalone: true, imports: [ModalDialogComponent, ModalContentComponent, A11yModule], template: "<c-modal-dialog\n [alignment]=\"alignment\"\n [fullscreen]=\"fullscreen\"\n [scrollable]=\"scrollable\"\n [size]=\"size\">\n <c-modal-content>\n <div [cdkTrapFocus]=\"visible\" [cdkTrapFocusAutoCapture]=\"visible\" style=\"display: contents;\" #modalContentRef>\n <ng-content></ng-content>\n </div>\n </c-modal-content>\n</c-modal-dialog>\n" }]
10958
10992
  }], ctorParameters: function () { return [{ type: Document, decorators: [{
10959
10993
  type: Inject,
10960
10994
  args: [DOCUMENT]
@@ -10965,13 +10999,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10965
10999
  }], fullscreen: [{
10966
11000
  type: Input
10967
11001
  }], keyboard: [{
10968
- type: Input
11002
+ type: Input,
11003
+ args: [{ transform: booleanAttribute }]
10969
11004
  }], id: [{
10970
11005
  type: Input
10971
11006
  }], size: [{
10972
11007
  type: Input
10973
11008
  }], transition: [{
10974
- type: Input
11009
+ type: Input,
11010
+ args: [{ transform: booleanAttribute }]
10975
11011
  }], role: [{
10976
11012
  type: Input
10977
11013
  }, {
@@ -10983,14 +11019,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
10983
11019
  type: HostBinding,
10984
11020
  args: ['attr.aria-modal']
10985
11021
  }], scrollable: [{
10986
- type: Input
11022
+ type: Input,
11023
+ args: [{ transform: booleanAttribute }]
10987
11024
  }], visible: [{
10988
- type: Input
11025
+ type: Input,
11026
+ args: [{ transform: booleanAttribute }]
10989
11027
  }], visibleChange: [{
10990
11028
  type: Output
10991
11029
  }], modalContent: [{
10992
11030
  type: ViewChild,
10993
11031
  args: [ModalContentComponent, { read: ElementRef }]
11032
+ }], modalContentRef: [{
11033
+ type: ViewChild,
11034
+ args: ['modalContentRef', { read: ElementRef }]
10994
11035
  }], hostClasses: [{
10995
11036
  type: HostBinding,
10996
11037
  args: ['class']
@@ -11086,6 +11127,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11086
11127
 
11087
11128
  let nextId = 0;
11088
11129
  class OffcanvasComponent {
11130
+ #destroyRef;
11089
11131
  constructor(document, platformId, renderer, hostElement, offcanvasService, backdropService, breakpointObserver) {
11090
11132
  this.document = document;
11091
11133
  this.platformId = platformId;
@@ -11094,6 +11136,7 @@ class OffcanvasComponent {
11094
11136
  this.offcanvasService = offcanvasService;
11095
11137
  this.backdropService = backdropService;
11096
11138
  this.breakpointObserver = breakpointObserver;
11139
+ this.#destroyRef = inject(DestroyRef);
11097
11140
  /**
11098
11141
  * Apply a backdrop on body while offcanvas is open.
11099
11142
  * @type boolean | 'static'
@@ -11132,43 +11175,31 @@ class OffcanvasComponent {
11132
11175
  * @default true
11133
11176
  */
11134
11177
  this.ariaModal = true;
11178
+ this.#show = false;
11179
+ /**
11180
+ * Allow body scrolling while offcanvas is visible.
11181
+ * @type boolean
11182
+ * @default false
11183
+ */
11184
+ this.scroll = false;
11185
+ this.#visible = false;
11135
11186
  /**
11136
11187
  * Event triggered on visible change.
11188
+ * @type EventEmitter<boolean>
11137
11189
  */
11138
11190
  this.visibleChange = new EventEmitter();
11139
- this.#scroll = false;
11140
- this.#visible = false;
11141
- this.#show = false;
11142
11191
  }
11143
- #scroll;
11144
- #visible;
11145
11192
  #activeBackdrop;
11146
- #scrollbarWidth;
11147
- #stateToggleSubscription;
11148
11193
  #backdropClickSubscription;
11149
11194
  #layoutChangeSubscription;
11150
11195
  #show;
11151
- get scroll() {
11152
- return this.#scroll;
11153
- }
11154
- /**
11155
- * Allow body scrolling while offcanvas is visible.
11156
- * @type boolean
11157
- * @default false
11158
- */
11159
- set scroll(value) {
11160
- this.#scroll = coerceBooleanProperty(value);
11161
- }
11162
- get visible() {
11163
- return this.#visible;
11164
- }
11165
11196
  /**
11166
11197
  * Toggle the visibility of offcanvas component.
11167
11198
  * @type boolean
11168
11199
  * @default false
11169
11200
  */
11170
11201
  set visible(value) {
11171
- this.#visible = coerceBooleanProperty(value);
11202
+ this.#visible = value;
11172
11203
  if (this.#visible) {
11173
11204
  this.setBackdrop(this.backdrop);
11174
11205
  this.setFocus();
@@ -11179,6 +11210,10 @@ class OffcanvasComponent {
11179
11210
  this.layoutChangeSubscribe(this.#visible);
11180
11211
  this.visibleChange.emit(value);
11181
11212
  }
11213
+ get visible() {
11214
+ return this.#visible;
11215
+ }
11216
+ #visible;
11182
11217
  get hostClasses() {
11183
11218
  return {
11184
11219
  offcanvas: typeof this.responsive === 'boolean',
@@ -11212,11 +11247,9 @@ class OffcanvasComponent {
11212
11247
  return breakpointValue ? `${parseFloat(breakpointValue.trim()) - 0.02}px` : false;
11213
11248
  }
11214
11249
  animateStart(event) {
11215
- const scrollbarWidth = this.#scrollbarWidth;
11216
11250
  if (event.toState === 'visible') {
11217
11251
  if (!this.scroll) {
11218
- this.renderer.setStyle(this.document.body, 'overflow', 'hidden');
11219
- this.renderer.setStyle(this.document.body, 'padding-right', scrollbarWidth);
11252
+ this.backdropService.hideScrollbar();
11220
11253
  }
11221
11254
  this.renderer.addClass(this.hostElement.nativeElement, 'showing');
11222
11255
  }
@@ -11246,7 +11279,6 @@ class OffcanvasComponent {
11246
11279
  }
11247
11280
  }
11248
11281
  ngOnInit() {
11249
- this.#scrollbarWidth = this.backdropService.scrollbarWidth;
11250
11282
  this.stateToggleSubscribe();
11251
11283
  setTimeout(() => {
11252
11284
  // hotfix to avoid offcanvas flicker on the first render
@@ -11255,33 +11287,30 @@ class OffcanvasComponent {
11255
11287
  }
11256
11288
  ngOnDestroy() {
11257
11289
  this.offcanvasService.toggle({ show: false, id: this.id });
11258
- this.stateToggleSubscribe(false);
11259
11290
  }
11260
11291
  setFocus() {
11261
11292
  if (isPlatformBrowser(this.platformId)) {
11262
11293
  setTimeout(() => this.hostElement.nativeElement.focus());
11263
11294
  }
11264
11295
  }
11265
- stateToggleSubscribe(subscribe = true) {
11266
- if (subscribe) {
11267
- this.#stateToggleSubscription =
11268
- this.offcanvasService.offcanvasState$.subscribe((action) => {
11269
- if (this === action.offcanvas || this.id === action.id) {
11270
- if ('show' in action) {
11271
- this.visible =
11272
- action?.show === 'toggle' ? !this.visible : action.show;
11273
- }
11274
- }
11275
- });
11276
- }
11277
- else {
11278
- this.#stateToggleSubscription?.unsubscribe();
11279
- }
11296
+ stateToggleSubscribe() {
11297
+ this.offcanvasService.offcanvasState$
11298
+ .pipe(takeUntilDestroyed(this.#destroyRef))
11299
+ .subscribe((action) => {
11300
+ if (this === action.offcanvas || this.id === action.id) {
11301
+ if ('show' in action) {
11302
+ this.visible =
11303
+ action?.show === 'toggle' ? !this.visible : action.show;
11304
+ }
11305
+ }
11306
+ });
11280
11307
  }
11281
11308
  backdropClickSubscribe(subscribe = true) {
11282
11309
  if (subscribe) {
11283
11310
  this.#backdropClickSubscription =
11284
- this.backdropService.backdropClick$.subscribe((clicked) => {
11311
+ this.backdropService.backdropClick$
11312
+ .pipe(takeUntilDestroyed(this.#destroyRef))
11313
+ .subscribe((clicked) => {
11285
11314
  this.offcanvasService.toggle({ show: !clicked, id: this.id });
11286
11315
  });
11287
11316
  }
@@ -11290,7 +11319,6 @@ class OffcanvasComponent {
11290
11319
  }
11291
11320
  }
11292
11321
  setBackdrop(setBackdrop) {
11293
- this.#scrollbarWidth = this.backdropService.scrollbarWidth;
11294
11322
  this.#activeBackdrop = !!setBackdrop ? this.backdropService.setBackdrop('offcanvas')
11295
11323
  : this.backdropService.clearBackdrop(this.#activeBackdrop);
11296
11324
  setBackdrop === true ? this.backdropClickSubscribe()
@@ -11304,7 +11332,7 @@ class OffcanvasComponent {
11304
11332
  const responsiveBreakpoint = `(max-width: ${this.responsiveBreakpoint})`;
11305
11333
  const layoutChanges = this.breakpointObserver.observe([responsiveBreakpoint]);
11306
11334
  this.#layoutChangeSubscription = layoutChanges
11307
- .pipe(filter(breakpointState => !breakpointState.matches))
11335
+ .pipe(filter(breakpointState => !breakpointState.matches), takeUntilDestroyed(this.#destroyRef))
11308
11336
  .subscribe((breakpointState) => {
11309
11337
  this.visible = breakpointState.matches;
11310
11338
  });
@@ -11314,7 +11342,7 @@ class OffcanvasComponent {
11314
11342
  }
11315
11343
  }
11316
11344
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OffcanvasComponent, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: OffcanvasService }, { token: BackdropService }, { token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
11317
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: "backdrop", keyboard: "keyboard", placement: "placement", responsive: "responsive", id: "id", role: "role", ariaModal: "ariaModal", scroll: "scroll", visible: "visible" }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, exportAs: ["cOffcanvas"], ngImport: i0, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
11345
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "16.2.12", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: "backdrop", keyboard: ["keyboard", "keyboard", booleanAttribute], placement: "placement", responsive: "responsive", id: "id", role: "role", ariaModal: ["ariaModal", "ariaModal", booleanAttribute], scroll: ["scroll", "scroll", booleanAttribute], visible: ["visible", "visible", booleanAttribute] }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "@showHide.start": "animateStart($event)", "@showHide.done": "animateDone($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "attr.role": "this.role", "attr.aria-modal": "this.ariaModal", "class": "this.hostClasses", "attr.aria-hidden": "this.ariaHidden", "attr.tabindex": "this.tabIndex", "@showHide": "this.animateTrigger" } }, exportAs: ["cOffcanvas"], ngImport: i0, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content></ng-content>\n</div>\n\n", styles: [":host{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$5.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }], animations: [
11318
11346
  trigger('showHide', [
11319
11347
  state('visible', style({
11320
11348
  // visibility: 'visible'
@@ -11348,7 +11376,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11348
11376
  }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: OffcanvasService }, { type: BackdropService }, { type: i1$4.BreakpointObserver }]; }, propDecorators: { backdrop: [{
11349
11377
  type: Input
11350
11378
  }], keyboard: [{
11351
- type: Input
11379
+ type: Input,
11380
+ args: [{ transform: booleanAttribute }]
11352
11381
  }], placement: [{
11353
11382
  type: Input
11354
11383
  }], responsive: [{
@@ -11361,16 +11390,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
11361
11390
  type: HostBinding,
11362
11391
  args: ['attr.role']
11363
11392
  }], ariaModal: [{
11364
- type: Input
11393
+ type: Input,
11394
+ args: [{ transform: booleanAttribute }]
11365
11395
  }, {
11366
11396
  type: HostBinding,
11367
11397
  args: ['attr.aria-modal']
11368
- }], visibleChange: [{
11369
- type: Output
11370
11398
  }], scroll: [{
11371
- type: Input
11399
+ type: Input,
11400
+ args: [{ transform: booleanAttribute }]
11372
11401
  }], visible: [{
11373
- type: Input
11402
+ type: Input,
11403
+ args: [{ transform: booleanAttribute }]
11404
+ }], visibleChange: [{
11405
+ type: Output
11374
11406
  }], hostClasses: [{
11375
11407
  type: HostBinding,
11376
11408
  args: ['class']
@@ -16421,5 +16453,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
16421
16453
  * Generated bundle index. Do not edit.
16422
16454
  */
16423
16455
 
16424
- export { AccordionButtonDirective, AccordionComponent, AccordionItemComponent, AccordionModule, AlertComponent, AlertHeadingDirective, AlertLinkDirective, AlertModule, AlignDirective, AvatarComponent, AvatarModule, BadgeComponent, BadgeModule, BgColorDirective, BorderDirective, BreadcrumbComponent, BreadcrumbItemComponent, BreadcrumbModule, BreadcrumbRouterComponent, BreadcrumbRouterService, BreakpointInfix, ButtonCloseDirective, ButtonDirective, ButtonGroupComponent, ButtonGroupModule, ButtonModule, ButtonToolbarComponent, CalendarComponent, CalendarModule, CalendarMonthComponent, CalendarNavigationComponent, CalloutComponent, CalloutModule, CardBodyComponent, CardComponent, CardFooterComponent, CardGroupComponent, CardHeaderActionsComponent, CardHeaderComponent, CardImgDirective, CardImgOverlayComponent, CardLinkDirective, CardModule, CardSubtitleDirective, CardTextDirective, CardTitleDirective, CarouselCaptionComponent, CarouselComponent, CarouselConfig, CarouselControlComponent, CarouselIndicatorsComponent, CarouselInnerComponent, CarouselItemComponent, CarouselModule, ClassToggleService, ColComponent, ColDirective, CollapseDirective, CollapseModule, ContainerComponent, DatePickerComponent, DatePickerModule, DateRangePickerComponent, DateRangePickerModule, DropdownCloseDirective, DropdownComponent, DropdownDividerDirective, DropdownHeaderDirective, DropdownItemDirective, DropdownItemPlainDirective, DropdownMenuDirective, DropdownModule, DropdownService, DropdownToggleDirective, ElementCoverComponent, ElementCoverModule, FooterComponent, FooterModule, FormCheckComponent, FormCheckInputDirective, FormCheckLabelDirective, FormControlDirective, FormDirective, FormFeedbackComponent, FormFloatingDirective, FormLabelDirective, FormModule, FormSelectDirective, FormTextDirective, GridModule, GutterDirective, HeaderBrandComponent, HeaderComponent, HeaderDividerComponent, HeaderModule, HeaderNavComponent, HeaderTextComponent, HeaderTogglerDirective, HtmlAttributesDirective, ImgDirective, ImgModule, InputGroupComponent, InputGroupTextDirective, IntersectionService, ListGroupDirective, ListGroupItemDirective, ListGroupModule, ListenersService, LoadingButtonComponent, LoadingButtonModule, ModalBodyComponent, ModalComponent, ModalContentComponent, ModalDialogComponent, ModalFooterComponent, ModalHeaderComponent, ModalModule, ModalService, ModalTitleDirective, ModalToggleDirective, MultiSelectComponent, MultiSelectModule, MultiSelectOptgroupComponent, MultiSelectOptgroupLabelComponent, MultiSelectOptionComponent, NavComponent, NavItemComponent, NavLinkDirective, NavModule, NavbarBrandDirective, NavbarComponent, NavbarModule, NavbarNavComponent, NavbarTextComponent, NavbarTogglerDirective, OffcanvasBodyComponent, OffcanvasComponent, OffcanvasHeaderComponent, OffcanvasModule, OffcanvasService, OffcanvasTitleDirective, OffcanvasToggleDirective, PageItemComponent, PageItemDirective, PageLinkDirective, PaginationComponent, PaginationModule, PlaceholderAnimationDirective, PlaceholderDirective, PlaceholderModule, PopoverComponent, PopoverDirective, PopoverModule, ProgressBarComponent, ProgressComponent, ProgressModule, RoundedDirective, RowComponent, RowDirective, SharedModule, SidebarBrandComponent, SidebarComponent, SidebarFooterComponent, SidebarHeaderComponent, SidebarModule, SidebarNavComponent, SidebarService, SidebarToggleDirective, SidebarTogglerComponent, SmartPaginationComponent, SmartPaginationModule, SmartTableComponent, SmartTableFilterComponent, SmartTableModule, SpinnerComponent, SpinnerModule, TabContentComponent, TabContentRefDirective, TabPaneComponent, TabService, TableActiveDirective, TableColorDirective, TableDirective, TableModule, TabsModule, TemplateIdDirective, TextColorDirective, TimePickerComponent, TimePickerModule, ToastBodyComponent, ToastCloseDirective, ToastComponent, ToastHeaderComponent, ToastModule, ToasterComponent, ToasterHostDirective, ToasterPlacement, ToasterService, TooltipComponent, TooltipDirective, TooltipModule, UtilitiesModule, WidgetModule, WidgetStatAComponent, WidgetStatBComponent, WidgetStatCComponent, WidgetStatDComponent, WidgetStatEComponent, WidgetStatFComponent };
16456
+ export { AccordionButtonDirective, AccordionComponent, AccordionItemComponent, AccordionModule, AlertComponent, AlertHeadingDirective, AlertLinkDirective, AlertModule, AlignDirective, AvatarComponent, AvatarModule, BackdropService, BadgeComponent, BadgeModule, BgColorDirective, BorderDirective, BreadcrumbComponent, BreadcrumbItemComponent, BreadcrumbModule, BreadcrumbRouterComponent, BreadcrumbRouterService, BreakpointInfix, ButtonCloseDirective, ButtonDirective, ButtonGroupComponent, ButtonGroupModule, ButtonModule, ButtonToolbarComponent, CalendarComponent, CalendarModule, CalendarMonthComponent, CalendarNavigationComponent, CalloutComponent, CalloutModule, CardBodyComponent, CardComponent, CardFooterComponent, CardGroupComponent, CardHeaderActionsComponent, CardHeaderComponent, CardImgDirective, CardImgOverlayComponent, CardLinkDirective, CardModule, CardSubtitleDirective, CardTextDirective, CardTitleDirective, CarouselCaptionComponent, CarouselComponent, CarouselConfig, CarouselControlComponent, CarouselIndicatorsComponent, CarouselInnerComponent, CarouselItemComponent, CarouselModule, ClassToggleService, ColComponent, ColDirective, CollapseDirective, CollapseModule, ContainerComponent, DatePickerComponent, DatePickerModule, DateRangePickerComponent, DateRangePickerModule, DropdownCloseDirective, DropdownComponent, DropdownDividerDirective, DropdownHeaderDirective, DropdownItemDirective, DropdownItemPlainDirective, DropdownMenuDirective, DropdownModule, DropdownService, DropdownToggleDirective, ElementCoverComponent, ElementCoverModule, FooterComponent, FooterModule, FormCheckComponent, FormCheckInputDirective, FormCheckLabelDirective, FormControlDirective, FormDirective, FormFeedbackComponent, FormFloatingDirective, FormLabelDirective, FormModule, FormSelectDirective, FormTextDirective, GridModule, GutterDirective, HeaderBrandComponent, HeaderComponent, HeaderDividerComponent, HeaderModule, HeaderNavComponent, HeaderTextComponent, HeaderTogglerDirective, HtmlAttributesDirective, ImgDirective, ImgModule, InputGroupComponent, InputGroupTextDirective, IntersectionService, ListGroupDirective, ListGroupItemDirective, ListGroupModule, ListenersService, LoadingButtonComponent, LoadingButtonModule, ModalBodyComponent, ModalComponent, ModalContentComponent, ModalDialogComponent, ModalFooterComponent, ModalHeaderComponent, ModalModule, ModalService, ModalTitleDirective, ModalToggleDirective, MultiSelectComponent, MultiSelectModule, MultiSelectOptgroupComponent, MultiSelectOptgroupLabelComponent, MultiSelectOptionComponent, NavComponent, NavItemComponent, NavLinkDirective, NavModule, NavbarBrandDirective, NavbarComponent, NavbarModule, NavbarNavComponent, NavbarTextComponent, NavbarTogglerDirective, OffcanvasBodyComponent, OffcanvasComponent, OffcanvasHeaderComponent, OffcanvasModule, OffcanvasService, OffcanvasTitleDirective, OffcanvasToggleDirective, PageItemComponent, PageItemDirective, PageLinkDirective, PaginationComponent, PaginationModule, PlaceholderAnimationDirective, PlaceholderDirective, PlaceholderModule, PopoverComponent, PopoverDirective, PopoverModule, ProgressBarComponent, ProgressComponent, ProgressModule, RoundedDirective, RowComponent, RowDirective, SharedModule, SidebarBrandComponent, SidebarComponent, SidebarFooterComponent, SidebarHeaderComponent, SidebarModule, SidebarNavComponent, SidebarService, SidebarToggleDirective, SidebarTogglerComponent, SmartPaginationComponent, SmartPaginationModule, SmartTableComponent, SmartTableFilterComponent, SmartTableModule, SpinnerComponent, SpinnerModule, TabContentComponent, TabContentRefDirective, TabPaneComponent, TabService, TableActiveDirective, TableColorDirective, TableDirective, TableModule, TabsModule, TemplateIdDirective, TextColorDirective, TimePickerComponent, TimePickerModule, ToastBodyComponent, ToastCloseDirective, ToastComponent, ToastHeaderComponent, ToastModule, ToasterComponent, ToasterHostDirective, ToasterPlacement, ToasterService, TooltipComponent, TooltipDirective, TooltipModule, UtilitiesModule, WidgetModule, WidgetStatAComponent, WidgetStatBComponent, WidgetStatCComponent, WidgetStatDComponent, WidgetStatEComponent, WidgetStatFComponent };
16425
16457
  //# sourceMappingURL=coreui-angular-pro.mjs.map