@coreui/angular 5.7.37 → 5.7.40
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/fesm2022/coreui-angular.mjs +395 -286
- package/fesm2022/coreui-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/types/coreui-angular.d.ts +91 -58
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ApplicationRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, DOCUMENT, DestroyRef, Directive, ElementRef, HostBinding, HostListener, Injectable, Injector, Input, MAX_ANIMATION_TIMEOUT, NgModule, NgZone, PLATFORM_ID, Pipe, Renderer2, RendererFactory2, TemplateRef, ViewContainerRef, ViewEncapsulation, afterEveryRender, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, contentChildren, effect, forwardRef, inject, input, linkedSignal, model, numberAttribute, output, runInInjectionContext, signal, untracked, viewChild } from "@angular/core";
|
|
2
|
+
import { ApplicationRef, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, DOCUMENT, DestroyRef, Directive, ElementRef, HostAttributeToken, HostBinding, HostListener, Injectable, Injector, Input, MAX_ANIMATION_TIMEOUT, NgModule, NgZone, PLATFORM_ID, Pipe, Renderer2, RendererFactory2, TemplateRef, ViewContainerRef, ViewEncapsulation, afterEveryRender, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, contentChildren, effect, forwardRef, inject, input, linkedSignal, model, numberAttribute, output, runInInjectionContext, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { DOCUMENT as DOCUMENT$1, NgTemplateOutlet, isPlatformBrowser, isPlatformServer } from "@angular/common";
|
|
4
4
|
import { BehaviorSubject, EMPTY, Subject, fromEvent, merge, skipWhile, take, takeWhile } from "rxjs";
|
|
5
5
|
import * as i1$1 from "@angular/router";
|
|
@@ -8,7 +8,7 @@ import { takeUntilDestroyed, toObservable, toSignal } from "@angular/core/rxjs-i
|
|
|
8
8
|
import { debounceTime, filter, finalize, map, switchMap, take as take$1, tap } from "rxjs/operators";
|
|
9
9
|
import { NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgModel } from "@angular/forms";
|
|
10
10
|
import * as i1 from "@angular/cdk/a11y";
|
|
11
|
-
import { A11yModule, CdkTrapFocus, FocusKeyManager, FocusMonitor } from "@angular/cdk/a11y";
|
|
11
|
+
import { A11yModule, CdkTrapFocus, FocusKeyManager, FocusMonitor, addAriaReferencedId, getAriaReferenceIds, removeAriaReferencedId } from "@angular/cdk/a11y";
|
|
12
12
|
import { createPopper } from "@popperjs/core";
|
|
13
13
|
import { BreakpointObserver } from "@angular/cdk/layout";
|
|
14
14
|
import { DomPortal, DomPortalOutlet } from "@angular/cdk/portal";
|
|
@@ -2703,67 +2703,74 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2703
2703
|
}]
|
|
2704
2704
|
}]
|
|
2705
2705
|
});
|
|
2706
|
+
const afterTransitions = async (element) => {
|
|
2707
|
+
const running = () => element.getAnimations?.().filter((animation) => "transitionProperty" in animation) ?? [];
|
|
2708
|
+
for (let transitions = running(); transitions.length;) transitions = (await Promise.allSettled(transitions.map((transition) => transition.finished))).some(({ status }) => status === "rejected") ? running() : [];
|
|
2709
|
+
};
|
|
2706
2710
|
var BackdropService = class BackdropService {
|
|
2707
2711
|
#backdropClick = new Subject();
|
|
2708
2712
|
backdropClick$ = this.#backdropClick.asObservable();
|
|
2709
2713
|
#document = inject(DOCUMENT);
|
|
2710
2714
|
activeBackdrop;
|
|
2711
|
-
#
|
|
2712
|
-
#
|
|
2715
|
+
#backdrops = /* @__PURE__ */ new Map();
|
|
2716
|
+
#clickHandler = () => this.onClickHandler();
|
|
2713
2717
|
get #scrollbarWidth() {
|
|
2714
2718
|
const documentWidth = this.#document.documentElement.clientWidth;
|
|
2715
2719
|
return `${Math.abs((this.#document.defaultView?.innerWidth ?? documentWidth) - documentWidth)}px`;
|
|
2716
2720
|
}
|
|
2717
2721
|
scrollbarWidth = this.#scrollbarWidth;
|
|
2718
|
-
setBackdrop(type = "modal") {
|
|
2719
|
-
this.#
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2722
|
+
setBackdrop(type = "modal", fade = true) {
|
|
2723
|
+
const existing = this.#backdrops.get(type);
|
|
2724
|
+
const backdrop = existing?.element.isConnected ? existing : this.#createBackdrop(type);
|
|
2725
|
+
const fading = backdrop.fading;
|
|
2726
|
+
backdrop.users++;
|
|
2727
|
+
backdrop.element.classList.toggle("fade", fade);
|
|
2728
|
+
if (fading) {
|
|
2729
|
+
backdrop.fading = void 0;
|
|
2730
|
+
backdrop.element.addEventListener("click", this.#clickHandler);
|
|
2731
|
+
}
|
|
2732
|
+
if (fading && backdrop.shown || !fade) this.#show(backdrop);
|
|
2733
|
+
this.activeBackdrop = backdrop.element;
|
|
2734
|
+
return backdrop.element;
|
|
2735
|
+
}
|
|
2736
|
+
clearBackdrop(backdropElement) {
|
|
2737
|
+
const backdrop = [...this.#backdrops.values()].find(({ element }) => element === backdropElement);
|
|
2738
|
+
if (backdrop?.users && --backdrop.users === 0) this.#fadeOut(backdrop);
|
|
2739
|
+
}
|
|
2740
|
+
#createBackdrop(type) {
|
|
2741
|
+
const element = this.#document.createElement("div");
|
|
2742
|
+
const backdrop = {
|
|
2743
|
+
type,
|
|
2744
|
+
element,
|
|
2745
|
+
users: 0
|
|
2726
2746
|
};
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2747
|
+
element.classList.add(`${type}-backdrop`);
|
|
2748
|
+
this.#document.body.appendChild(element);
|
|
2749
|
+
element.addEventListener("click", this.#clickHandler);
|
|
2750
|
+
this.#backdrops.set(type, backdrop);
|
|
2730
2751
|
setTimeout(() => {
|
|
2731
|
-
|
|
2752
|
+
if (backdrop.users && !backdrop.fading) this.#show(backdrop);
|
|
2732
2753
|
});
|
|
2733
|
-
|
|
2734
|
-
return backdropElement;
|
|
2754
|
+
return backdrop;
|
|
2735
2755
|
}
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
if (storedHandler) {
|
|
2740
|
-
backdropElement.removeEventListener("click", storedHandler);
|
|
2741
|
-
delete backdropElement.__backdropClickHandler;
|
|
2742
|
-
}
|
|
2743
|
-
backdropElement.classList.remove("show");
|
|
2744
|
-
this.#flushClearBackdrop();
|
|
2745
|
-
this.#pendingBackdrop = backdropElement;
|
|
2746
|
-
this.#clearBackdropId = setTimeout(() => {
|
|
2747
|
-
this.#clearBackdropId = void 0;
|
|
2748
|
-
this.#pendingBackdrop = void 0;
|
|
2749
|
-
if (this.activeBackdrop === backdropElement) {
|
|
2750
|
-
this.resetScrollbar();
|
|
2751
|
-
this.activeBackdrop = void 0;
|
|
2752
|
-
}
|
|
2753
|
-
this.#removeBackdrop(backdropElement);
|
|
2754
|
-
}, 300);
|
|
2755
|
-
}
|
|
2756
|
+
#show(backdrop) {
|
|
2757
|
+
backdrop.element.classList.add("show");
|
|
2758
|
+
backdrop.shown = true;
|
|
2756
2759
|
}
|
|
2757
|
-
#
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
this.#
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2760
|
+
#fadeOut(backdrop) {
|
|
2761
|
+
const fading = {};
|
|
2762
|
+
backdrop.fading = fading;
|
|
2763
|
+
backdrop.element.removeEventListener("click", this.#clickHandler);
|
|
2764
|
+
queueMicrotask(() => {
|
|
2765
|
+
if (backdrop.fading !== fading) return;
|
|
2766
|
+
backdrop.element.classList.remove("show");
|
|
2767
|
+
afterTransitions(backdrop.element).then(() => {
|
|
2768
|
+
if (backdrop.fading !== fading) return;
|
|
2769
|
+
if (this.#backdrops.get(backdrop.type) === backdrop) this.#backdrops.delete(backdrop.type);
|
|
2770
|
+
backdrop.element.remove();
|
|
2771
|
+
if (this.activeBackdrop === backdrop.element) this.activeBackdrop = void 0;
|
|
2772
|
+
});
|
|
2773
|
+
});
|
|
2767
2774
|
}
|
|
2768
2775
|
get #isRTL() {
|
|
2769
2776
|
return [this.#document.documentElement.dir, this.#document.body.dir].includes("rtl");
|
|
@@ -2771,18 +2778,29 @@ var BackdropService = class BackdropService {
|
|
|
2771
2778
|
get #padding() {
|
|
2772
2779
|
return `padding-${this.#isRTL ? "left" : "right"}`;
|
|
2773
2780
|
}
|
|
2774
|
-
#
|
|
2775
|
-
|
|
2776
|
-
|
|
2781
|
+
#scrollLockOwners = /* @__PURE__ */ new Set();
|
|
2782
|
+
#lockedPadding = "";
|
|
2783
|
+
lockScroll(owner) {
|
|
2784
|
+
if (this.#scrollLockOwners.has(owner)) return;
|
|
2785
|
+
this.#scrollLockOwners.add(owner);
|
|
2786
|
+
if (this.#scrollLockOwners.size === 1) {
|
|
2787
|
+
this.scrollbarWidth = this.#scrollbarWidth;
|
|
2788
|
+
this.#lockedPadding = this.#padding;
|
|
2777
2789
|
this.#document.body.style.setProperty("overflow", "hidden");
|
|
2778
|
-
this.#document.body.style.setProperty(this.#
|
|
2779
|
-
|
|
2790
|
+
this.#document.body.style.setProperty(this.#lockedPadding, this.scrollbarWidth);
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
unlockScroll(owner) {
|
|
2794
|
+
if (this.#scrollLockOwners.delete(owner) && this.#scrollLockOwners.size === 0) {
|
|
2795
|
+
this.#document.body.style.removeProperty("overflow");
|
|
2796
|
+
this.#document.body.style.removeProperty(this.#lockedPadding);
|
|
2780
2797
|
}
|
|
2781
2798
|
}
|
|
2799
|
+
hideScrollbar() {
|
|
2800
|
+
this.lockScroll(this);
|
|
2801
|
+
}
|
|
2782
2802
|
resetScrollbar() {
|
|
2783
|
-
this
|
|
2784
|
-
this.#document.body.style.removeProperty(this.#padding);
|
|
2785
|
-
this.#scrollBarVisible = true;
|
|
2803
|
+
this.unlockScroll(this);
|
|
2786
2804
|
}
|
|
2787
2805
|
onClickHandler() {
|
|
2788
2806
|
this.#backdropClick.next(true);
|
|
@@ -4519,11 +4537,15 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
4519
4537
|
});
|
|
4520
4538
|
var UIDService = class UIDService {
|
|
4521
4539
|
#document = inject(DOCUMENT);
|
|
4540
|
+
#infix = Math.floor(Math.random() * 36 ** 5).toString(36).padStart(5, "0");
|
|
4541
|
+
#counters = /* @__PURE__ */ new Map();
|
|
4522
4542
|
getUID(prefix = "random-id") {
|
|
4523
|
-
let uid
|
|
4524
|
-
do
|
|
4525
|
-
|
|
4526
|
-
|
|
4543
|
+
let uid;
|
|
4544
|
+
do {
|
|
4545
|
+
const count = (this.#counters.get(prefix) ?? 0) + 1;
|
|
4546
|
+
this.#counters.set(prefix, count);
|
|
4547
|
+
uid = `${prefix}-${this.#infix}-${count}`;
|
|
4548
|
+
} while (this.#document.getElementById(uid));
|
|
4527
4549
|
return uid;
|
|
4528
4550
|
}
|
|
4529
4551
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -8029,6 +8051,17 @@ const isEditableTarget$1 = (target) => {
|
|
|
8029
8051
|
};
|
|
8030
8052
|
const clicksOnEnter = (element) => element instanceof HTMLButtonElement || element instanceof HTMLInputElement && /^(button|image|reset|submit)$/.test(element.type) || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element.tagName === "SUMMARY";
|
|
8031
8053
|
const clicksOnSpace = (element) => element instanceof HTMLButtonElement || element instanceof HTMLInputElement && /^(button|checkbox|image|radio|reset|submit)$/.test(element.type) || element.tagName === "SUMMARY";
|
|
8054
|
+
const restoreFocus = (overlay, candidates, focus = (target) => target.focus({ preventScroll: true })) => {
|
|
8055
|
+
const document = overlay.ownerDocument;
|
|
8056
|
+
const held = overlay.getRootNode().activeElement;
|
|
8057
|
+
const active = document.activeElement;
|
|
8058
|
+
if (!(held && overlay.contains(held)) && active && active !== document.body) return false;
|
|
8059
|
+
for (const target of candidates) if (target?.isConnected && !overlay.contains(target)) {
|
|
8060
|
+
focus(target);
|
|
8061
|
+
if (target.getRootNode().activeElement === target) return true;
|
|
8062
|
+
}
|
|
8063
|
+
return false;
|
|
8064
|
+
};
|
|
8032
8065
|
var DropdownMenuDirective = class DropdownMenuDirective {
|
|
8033
8066
|
#destroyRef = inject(DestroyRef);
|
|
8034
8067
|
#injector = inject(Injector);
|
|
@@ -8209,7 +8242,10 @@ const alignmentClasses = (alignment) => {
|
|
|
8209
8242
|
return Object.fromEntries(Object.entries(alignment).map(([breakpoint, direction]) => [`dropdown-menu${breakpoint === BreakpointInfix.xs ? "" : `-${breakpoint}`}-${direction}`, true]));
|
|
8210
8243
|
};
|
|
8211
8244
|
const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex]";
|
|
8245
|
+
const FORM_TAG = /^(form|input|option|select|textarea)$/;
|
|
8246
|
+
const TEXT_INPUT_TYPE = /^(email|number|password|search|tel|text|url)$/;
|
|
8212
8247
|
var DropdownToken = class {};
|
|
8248
|
+
var DropdownFocusReturn = class {};
|
|
8213
8249
|
var DropdownToggleDirective = class DropdownToggleDirective {
|
|
8214
8250
|
elementRef = inject(ElementRef);
|
|
8215
8251
|
#renderer = inject(Renderer2);
|
|
@@ -8248,6 +8284,10 @@ var DropdownToggleDirective = class DropdownToggleDirective {
|
|
|
8248
8284
|
}
|
|
8249
8285
|
onKeyDown($event) {
|
|
8250
8286
|
if (this.disabled() || isReplayedEvent($event) || isEditableTarget$1($event.target)) return;
|
|
8287
|
+
if ($event.repeat && $event.key === "Enter") {
|
|
8288
|
+
$event.preventDefault();
|
|
8289
|
+
return;
|
|
8290
|
+
}
|
|
8251
8291
|
const element = this.elementRef.nativeElement;
|
|
8252
8292
|
if ($event.target === element && element.tagName === "A" && ($event.key === " " || $event.key === "Enter" && !clicksOnEnter(element))) {
|
|
8253
8293
|
$event.preventDefault();
|
|
@@ -8398,6 +8438,10 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8398
8438
|
#destroyRef = inject(DestroyRef);
|
|
8399
8439
|
#document = inject(DOCUMENT);
|
|
8400
8440
|
#elementRef = inject(ElementRef);
|
|
8441
|
+
#focusReturn = inject(DropdownFocusReturn, {
|
|
8442
|
+
host: true,
|
|
8443
|
+
optional: true
|
|
8444
|
+
});
|
|
8401
8445
|
#injector = inject(Injector);
|
|
8402
8446
|
#renderer = inject(Renderer2);
|
|
8403
8447
|
#rtlService = inject(RtlService);
|
|
@@ -8465,10 +8509,12 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8465
8509
|
#visibleEffect = effect(() => {
|
|
8466
8510
|
const visible = this.visible();
|
|
8467
8511
|
untracked(() => {
|
|
8512
|
+
const closed = this.activeTrap && !visible;
|
|
8468
8513
|
this.activeTrap = visible;
|
|
8469
8514
|
visible ? this.createPopperInstance() : this.destroyPopperInstance();
|
|
8470
8515
|
this.setVisibleState(visible);
|
|
8471
8516
|
this.visibleChange?.emit(visible);
|
|
8517
|
+
if (closed) afterNextRender(() => this.#returnFocus(false), { injector: this.#injector });
|
|
8472
8518
|
});
|
|
8473
8519
|
}, ...ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []);
|
|
8474
8520
|
visibleChange = output();
|
|
@@ -8483,6 +8529,7 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8483
8529
|
activeTrap = false;
|
|
8484
8530
|
popperInstance;
|
|
8485
8531
|
listeners = [];
|
|
8532
|
+
#menuInteraction;
|
|
8486
8533
|
hostClasses = computed(() => {
|
|
8487
8534
|
const direction = this.direction();
|
|
8488
8535
|
const variant = this.variant();
|
|
@@ -8497,10 +8544,6 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8497
8544
|
hostStyle = computed(() => {
|
|
8498
8545
|
return this.variant() === "input-group" ? { display: "contents" } : {};
|
|
8499
8546
|
}, ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
8500
|
-
clickedTarget;
|
|
8501
|
-
onHostClick($event) {
|
|
8502
|
-
this.clickedTarget = $event.target;
|
|
8503
|
-
}
|
|
8504
8547
|
dropdownStateSubscribe() {
|
|
8505
8548
|
this.dropdownService.dropdownState$.pipe(filter((state) => {
|
|
8506
8549
|
return this === state.dropdown;
|
|
@@ -8553,39 +8596,44 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8553
8596
|
this.#changeDetectorRef.markForCheck();
|
|
8554
8597
|
}
|
|
8555
8598
|
setListeners() {
|
|
8599
|
+
this.#menuInteraction = void 0;
|
|
8600
|
+
const menu = this._menuElementRef()?.nativeElement;
|
|
8601
|
+
if (menu) this.#ngZone.runOutsideAngular(() => {
|
|
8602
|
+
for (const type of [
|
|
8603
|
+
"focusin",
|
|
8604
|
+
"keydown",
|
|
8605
|
+
"pointerdown"
|
|
8606
|
+
]) this.listeners.push(this.#renderer.listen(menu, type, this.#trackMenuInteraction, { capture: true }));
|
|
8607
|
+
});
|
|
8556
8608
|
this.listeners.push(this.#renderer.listen(this.#document, "click", (event) => {
|
|
8557
|
-
const
|
|
8558
|
-
if (this
|
|
8559
|
-
if (this.#togglerElement()?.contains(event.target)) return;
|
|
8609
|
+
const part = this.#eventPart(event);
|
|
8610
|
+
if (part === "toggler" || part === "menu" && this.#isFormInteraction(event)) return;
|
|
8560
8611
|
const autoClose = this.autoClose();
|
|
8561
|
-
if (autoClose === true)
|
|
8562
|
-
this.setVisibleState(false);
|
|
8563
|
-
return;
|
|
8564
|
-
}
|
|
8565
|
-
if (this.clickedTarget === target && autoClose === "inside") {
|
|
8566
|
-
this.setVisibleState(false);
|
|
8567
|
-
return;
|
|
8568
|
-
}
|
|
8569
|
-
if (this.clickedTarget !== target && autoClose === "outside") {
|
|
8570
|
-
this.setVisibleState(false);
|
|
8571
|
-
return;
|
|
8572
|
-
}
|
|
8612
|
+
if (autoClose === true || autoClose === "inside" && part === "menu" || autoClose === "outside" && part !== "menu") this.setVisibleState(false);
|
|
8573
8613
|
}));
|
|
8574
8614
|
this.listeners.push(this.#renderer.listen(this.#elementRef.nativeElement, "keydown", this.#onEscape));
|
|
8575
8615
|
const toggler = this.#togglerElement();
|
|
8576
8616
|
if (toggler && !this.#elementRef.nativeElement.contains(toggler)) this.listeners.push(this.#renderer.listen(toggler, "keydown", this.#onEscape));
|
|
8577
8617
|
this.listeners.push(this.#renderer.listen(this.#document, "keyup", (event) => {
|
|
8578
|
-
|
|
8579
|
-
const toggler = this.#togglerElement();
|
|
8580
|
-
if (event.key === "Tab" && this.autoClose() !== false && !path.includes(this.#elementRef.nativeElement) && !(toggler && path.includes(toggler))) this.setVisibleState(false);
|
|
8618
|
+
if (event.key === "Tab" && this.autoClose() !== false && !this.#eventPart(event)) this.setVisibleState(false);
|
|
8581
8619
|
}));
|
|
8582
8620
|
}
|
|
8583
8621
|
#onEscape = (event) => {
|
|
8584
8622
|
if (event.key !== "Escape" || event.defaultPrevented || this.autoClose() === false) return;
|
|
8585
8623
|
event.preventDefault();
|
|
8586
|
-
const focusInMenu = this._menuElementRef()?.nativeElement.contains(event.target);
|
|
8587
8624
|
this.setVisibleState(false);
|
|
8588
|
-
|
|
8625
|
+
this.#returnFocus(true);
|
|
8626
|
+
};
|
|
8627
|
+
#trackMenuInteraction = (event) => {
|
|
8628
|
+
switch (event.type) {
|
|
8629
|
+
case "pointerdown":
|
|
8630
|
+
this.#menuInteraction = event.pointerType || "pointer";
|
|
8631
|
+
break;
|
|
8632
|
+
case "keydown":
|
|
8633
|
+
this.#menuInteraction = "keyboard";
|
|
8634
|
+
break;
|
|
8635
|
+
default: this.#menuInteraction ??= "focus";
|
|
8636
|
+
}
|
|
8589
8637
|
};
|
|
8590
8638
|
#directionPlacement() {
|
|
8591
8639
|
const rtl = this.#rtlService.isRTL(this.#elementRef.nativeElement);
|
|
@@ -8602,16 +8650,35 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8602
8650
|
#togglerElement() {
|
|
8603
8651
|
return (this._toggler() ?? this.toggler)?.elementRef.nativeElement;
|
|
8604
8652
|
}
|
|
8605
|
-
#
|
|
8653
|
+
#eventPart(event) {
|
|
8654
|
+
const path = event.composedPath();
|
|
8606
8655
|
const toggler = this.#togglerElement();
|
|
8607
|
-
if (
|
|
8608
|
-
const
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8656
|
+
if (toggler && path.includes(toggler)) return "toggler";
|
|
8657
|
+
const menu = this._menuElementRef()?.nativeElement;
|
|
8658
|
+
return menu && path.includes(menu) ? "menu" : void 0;
|
|
8659
|
+
}
|
|
8660
|
+
#isFormInteraction(event) {
|
|
8661
|
+
const path = event.composedPath();
|
|
8662
|
+
return path.slice(0, path.indexOf(this._menuElementRef()?.nativeElement) + 1).some((node) => node instanceof Element && FORM_TAG.test(node.localName));
|
|
8663
|
+
}
|
|
8664
|
+
#returnFocus(escape) {
|
|
8665
|
+
const menu = this._menuElementRef()?.nativeElement;
|
|
8666
|
+
if (!menu || !this.#menuInteraction || !menu.ownerDocument.hasFocus()) return;
|
|
8667
|
+
restoreFocus(menu, this.#focusTargets(escape), (target) => this.#injector.get(FocusMonitor).focusVia(target, "program", { preventScroll: !escape }));
|
|
8668
|
+
}
|
|
8669
|
+
#focusTargets(escape) {
|
|
8670
|
+
const targets = this.#focusReturn?.focusReturnTargets() ?? this.#togglerTargets(escape);
|
|
8671
|
+
return this.#menuInteraction === "touch" || this.#menuInteraction === "pen" ? targets.filter((target) => !target || !this.#opensKeyboard(target)) : targets;
|
|
8672
|
+
}
|
|
8673
|
+
#togglerTargets(escape) {
|
|
8674
|
+
const toggler = this.#togglerElement();
|
|
8675
|
+
if (!toggler || !escape) return toggler ? [toggler] : [];
|
|
8676
|
+
return [toggler, ...toggler.querySelectorAll(FOCUSABLE_SELECTOR)].filter((candidate) => candidate === toggler || candidate.tabIndex >= 0 && !candidate.closest("[aria-hidden=\"true\"]"));
|
|
8677
|
+
}
|
|
8678
|
+
#opensKeyboard(target) {
|
|
8679
|
+
if (target instanceof HTMLInputElement) return TEXT_INPUT_TYPE.test(target.type) && !target.readOnly;
|
|
8680
|
+
if (target instanceof HTMLTextAreaElement) return !target.readOnly;
|
|
8681
|
+
return !(target instanceof HTMLSelectElement) && isEditableTarget$1(target);
|
|
8615
8682
|
}
|
|
8616
8683
|
clearListeners() {
|
|
8617
8684
|
this.listeners.forEach((unListen) => {
|
|
@@ -8693,13 +8760,10 @@ var DropdownComponent = class DropdownComponent {
|
|
|
8693
8760
|
}
|
|
8694
8761
|
},
|
|
8695
8762
|
outputs: { visibleChange: "visibleChange" },
|
|
8696
|
-
host: {
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
"style": "hostStyle()"
|
|
8701
|
-
}
|
|
8702
|
-
},
|
|
8763
|
+
host: { properties: {
|
|
8764
|
+
"class": "hostClasses()",
|
|
8765
|
+
"style": "hostStyle()"
|
|
8766
|
+
} },
|
|
8703
8767
|
providers: [DropdownService],
|
|
8704
8768
|
queries: [
|
|
8705
8769
|
{
|
|
@@ -8754,8 +8818,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8754
8818
|
}],
|
|
8755
8819
|
host: {
|
|
8756
8820
|
"[class]": "hostClasses()",
|
|
8757
|
-
"[style]": "hostStyle()"
|
|
8758
|
-
"(click)": "onHostClick($event)"
|
|
8821
|
+
"[style]": "hostStyle()"
|
|
8759
8822
|
},
|
|
8760
8823
|
styles: [":host-context(.dropdown,.dropup):not(.btn-group){display:block}:host-context(.dropstart,.dropend):not(.btn-group){display:inline-flex}:host-context(.input-group) :host.dropdown:first-child::ng-deep :first-child{border-start-end-radius:0;border-end-end-radius:0}:host-context(.input-group) :host.dropdown:first-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-start-start-radius:0;border-end-start-radius:0}:host-context(.input-group) :host.dropdown:first-child::ng-deep :not(:first-child):not(.dropdown-menu):not(:only-of-type){border-start-end-radius:0;border-end-end-radius:0}:host-context(.input-group) :host.dropdown:last-child::ng-deep :first-child{border-start-start-radius:0;border-end-start-radius:0}:host-context(.input-group) :host.dropdown:last-child::ng-deep :first-child:not(:only-of-type){border-start-end-radius:0;border-end-end-radius:0}:host-context(.input-group) :host.dropdown:last-child::ng-deep :not(:first-child):not(.dropdown-menu){margin-left:-1px;border-start-start-radius:0;border-end-start-radius:0}\n"]
|
|
8761
8824
|
}]
|
|
@@ -8892,7 +8955,7 @@ var DropdownItemDirective = class DropdownItemDirective {
|
|
|
8892
8955
|
};
|
|
8893
8956
|
}, ...ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []);
|
|
8894
8957
|
onClick($event) {
|
|
8895
|
-
this.handleInteraction();
|
|
8958
|
+
if ($event.target === this.elementRef.nativeElement || !isEditableTarget$1($event.target)) this.handleInteraction();
|
|
8896
8959
|
}
|
|
8897
8960
|
onKeyUp($event) {
|
|
8898
8961
|
const target = $event.target;
|
|
@@ -8900,7 +8963,7 @@ var DropdownItemDirective = class DropdownItemDirective {
|
|
|
8900
8963
|
}
|
|
8901
8964
|
handleInteraction() {
|
|
8902
8965
|
if (this.autoClose()) this.#dropdownService.toggle({
|
|
8903
|
-
visible:
|
|
8966
|
+
visible: false,
|
|
8904
8967
|
dropdown: this.dropdown
|
|
8905
8968
|
});
|
|
8906
8969
|
}
|
|
@@ -9630,6 +9693,31 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
9630
9693
|
}]
|
|
9631
9694
|
}
|
|
9632
9695
|
});
|
|
9696
|
+
const TYPES_WITHOUT_ARIA_INVALID = [
|
|
9697
|
+
"button",
|
|
9698
|
+
"color",
|
|
9699
|
+
"hidden",
|
|
9700
|
+
"image",
|
|
9701
|
+
"reset",
|
|
9702
|
+
"submit"
|
|
9703
|
+
];
|
|
9704
|
+
const bindAriaInvalid = (valid, type) => {
|
|
9705
|
+
const host = inject(ElementRef).nativeElement;
|
|
9706
|
+
const renderer = inject(Renderer2);
|
|
9707
|
+
const templateValue = inject(new HostAttributeToken("aria-invalid"), { optional: true });
|
|
9708
|
+
let invalidated = false;
|
|
9709
|
+
return effect(() => {
|
|
9710
|
+
if (valid() === false && !TYPES_WITHOUT_ARIA_INVALID.includes(String(type?.() ?? "").toLowerCase())) {
|
|
9711
|
+
const current = host.getAttribute("aria-invalid");
|
|
9712
|
+
if (!current || current.toLowerCase() === "false") renderer.setAttribute(host, "aria-invalid", "true");
|
|
9713
|
+
invalidated = true;
|
|
9714
|
+
} else if (invalidated) {
|
|
9715
|
+
if (templateValue === null) renderer.removeAttribute(host, "aria-invalid");
|
|
9716
|
+
else renderer.setAttribute(host, "aria-invalid", templateValue);
|
|
9717
|
+
invalidated = false;
|
|
9718
|
+
}
|
|
9719
|
+
});
|
|
9720
|
+
};
|
|
9633
9721
|
var FormControlDirective = class FormControlDirective {
|
|
9634
9722
|
#hostElement = inject(ElementRef);
|
|
9635
9723
|
sizing = input(...ngDevMode ? [void 0, { debugName: "sizing" }] : /* istanbul ignore next */ []);
|
|
@@ -9639,6 +9727,7 @@ var FormControlDirective = class FormControlDirective {
|
|
|
9639
9727
|
...ngDevMode ? { debugName: "plaintext" } : /* istanbul ignore next */ {},
|
|
9640
9728
|
transform: booleanAttribute
|
|
9641
9729
|
});
|
|
9730
|
+
#ariaInvalidEffect = bindAriaInvalid(this.valid, this.type);
|
|
9642
9731
|
hostClasses = computed(() => {
|
|
9643
9732
|
const type = this.type();
|
|
9644
9733
|
const isRange = type === "range";
|
|
@@ -9785,6 +9874,7 @@ var FormCheckInputDirective = class FormCheckInputDirective {
|
|
|
9785
9874
|
return this.#indeterminate();
|
|
9786
9875
|
}
|
|
9787
9876
|
valid = input(...ngDevMode ? [void 0, { debugName: "valid" }] : /* istanbul ignore next */ []);
|
|
9877
|
+
#ariaInvalidEffect = bindAriaInvalid(this.valid);
|
|
9788
9878
|
hostClasses = computed(() => {
|
|
9789
9879
|
const valid = this.valid();
|
|
9790
9880
|
return {
|
|
@@ -10104,6 +10194,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
10104
10194
|
var FormSelectDirective = class FormSelectDirective {
|
|
10105
10195
|
sizing = input(...ngDevMode ? [void 0, { debugName: "sizing" }] : /* istanbul ignore next */ []);
|
|
10106
10196
|
valid = input(...ngDevMode ? [void 0, { debugName: "valid" }] : /* istanbul ignore next */ []);
|
|
10197
|
+
#ariaInvalidEffect = bindAriaInvalid(this.valid);
|
|
10107
10198
|
hostClasses = computed(() => {
|
|
10108
10199
|
const sizing = this.sizing();
|
|
10109
10200
|
const valid = this.valid();
|
|
@@ -13600,14 +13691,31 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
13600
13691
|
}
|
|
13601
13692
|
});
|
|
13602
13693
|
var ModalService = class ModalService {
|
|
13694
|
+
#document = inject(DOCUMENT);
|
|
13603
13695
|
#modalState = new Subject();
|
|
13604
13696
|
modalState$ = this.#modalState.asObservable();
|
|
13697
|
+
#opened = new Subject();
|
|
13698
|
+
opened$ = this.#opened.asObservable();
|
|
13699
|
+
#openClassHolders = /* @__PURE__ */ new Set();
|
|
13605
13700
|
toggle(action) {
|
|
13606
13701
|
this.#modalState.next({
|
|
13607
13702
|
...action,
|
|
13608
13703
|
focusFallback: [...action.focusFallback ?? []]
|
|
13609
13704
|
});
|
|
13610
13705
|
}
|
|
13706
|
+
announceOpened(modal, focusFallback) {
|
|
13707
|
+
this.#opened.next({
|
|
13708
|
+
modal,
|
|
13709
|
+
focusFallback
|
|
13710
|
+
});
|
|
13711
|
+
}
|
|
13712
|
+
addOpenClass(modal) {
|
|
13713
|
+
this.#openClassHolders.add(modal);
|
|
13714
|
+
this.#document.body.classList.add("modal-open");
|
|
13715
|
+
}
|
|
13716
|
+
removeOpenClass(modal) {
|
|
13717
|
+
if (this.#openClassHolders.delete(modal) && this.#openClassHolders.size === 0) this.#document.body.classList.remove("modal-open");
|
|
13718
|
+
}
|
|
13611
13719
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
13612
13720
|
minVersion: "12.0.0",
|
|
13613
13721
|
version: "22.2.3",
|
|
@@ -13797,16 +13905,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
13797
13905
|
}]
|
|
13798
13906
|
}]
|
|
13799
13907
|
});
|
|
13800
|
-
const restoreFocus = (overlay, candidates) => {
|
|
13801
|
-
const document = overlay.ownerDocument;
|
|
13802
|
-
const active = document.activeElement;
|
|
13803
|
-
if (active && active !== document.body && !overlay.contains(active)) return false;
|
|
13804
|
-
for (const target of candidates) if (target?.isConnected && !overlay.contains(target)) {
|
|
13805
|
-
target.focus({ preventScroll: true });
|
|
13806
|
-
if (document.activeElement === target) return true;
|
|
13807
|
-
}
|
|
13808
|
-
return false;
|
|
13809
|
-
};
|
|
13810
13908
|
var ModalComponent = class ModalComponent {
|
|
13811
13909
|
#document = inject(DOCUMENT);
|
|
13812
13910
|
#renderer = inject(Renderer2);
|
|
@@ -13815,6 +13913,7 @@ var ModalComponent = class ModalComponent {
|
|
|
13815
13913
|
#backdropService = inject(BackdropService);
|
|
13816
13914
|
#destroyRef = inject(DestroyRef);
|
|
13817
13915
|
#platformId = inject(PLATFORM_ID);
|
|
13916
|
+
#generatedId = inject(UIDService).getUID("modal");
|
|
13818
13917
|
alignment = input("top", ...ngDevMode ? [{ debugName: "alignment" }] : /* istanbul ignore next */ []);
|
|
13819
13918
|
backdrop = input(true, ...ngDevMode ? [{ debugName: "backdrop" }] : /* istanbul ignore next */ []);
|
|
13820
13919
|
container = input(this.#document.body, ...ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []);
|
|
@@ -13828,7 +13927,7 @@ var ModalComponent = class ModalComponent {
|
|
|
13828
13927
|
alias: "id"
|
|
13829
13928
|
});
|
|
13830
13929
|
get id() {
|
|
13831
|
-
return this.attrId();
|
|
13930
|
+
return this.attrId() || this.#generatedId;
|
|
13832
13931
|
}
|
|
13833
13932
|
portal = input(false, {
|
|
13834
13933
|
...ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {},
|
|
@@ -13895,7 +13994,7 @@ var ModalComponent = class ModalComponent {
|
|
|
13895
13994
|
untracked(() => {
|
|
13896
13995
|
if (visible && afterViewInit) {
|
|
13897
13996
|
this.#focusBeforeShow = this.#document.activeElement;
|
|
13898
|
-
setTimeout(() => {
|
|
13997
|
+
if (isPlatformBrowser(this.#platformId)) setTimeout(() => {
|
|
13899
13998
|
if (!this.focusTrap()?.focusTrap.focusInitialElement()) this.#hostElement.nativeElement.focus();
|
|
13900
13999
|
});
|
|
13901
14000
|
} else this.#restoreFocus();
|
|
@@ -13911,24 +14010,16 @@ var ModalComponent = class ModalComponent {
|
|
|
13911
14010
|
...ngDevMode ? { debugName: "modalDialogRef" } : /* istanbul ignore next */ {},
|
|
13912
14011
|
read: ElementRef
|
|
13913
14012
|
});
|
|
13914
|
-
#
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
}, ...ngDevMode ? [{ debugName: "#
|
|
13922
|
-
#handleTransitionEnd = (event) => {
|
|
13923
|
-
const modalDialogElement = this.modalDialogRef().nativeElement;
|
|
13924
|
-
if (event.target === modalDialogElement && event.propertyName === "transform") {
|
|
13925
|
-
if (!this.visible()) {
|
|
13926
|
-
this.domPortalCleanup();
|
|
13927
|
-
this.#renderer.setStyle(this.#hostElement.nativeElement, "display", "none");
|
|
13928
|
-
}
|
|
13929
|
-
}
|
|
13930
|
-
};
|
|
14013
|
+
#hideEffect = afterRenderEffect({ read: (onCleanup) => {
|
|
14014
|
+
if (this.visible() || this.#hidden) return;
|
|
14015
|
+
let cancelled = false;
|
|
14016
|
+
onCleanup(() => cancelled = true);
|
|
14017
|
+
Promise.all([afterTransitions(this.#hostElement.nativeElement), afterTransitions(this.modalDialogRef().nativeElement)]).then(() => {
|
|
14018
|
+
if (!cancelled && !this.visible()) this.#completeHide();
|
|
14019
|
+
});
|
|
14020
|
+
} }, ...ngDevMode ? [{ debugName: "#hideEffect" }] : /* istanbul ignore next */ []);
|
|
13931
14021
|
#activeBackdrop;
|
|
14022
|
+
#hidden = true;
|
|
13932
14023
|
hostClasses = computed(() => {
|
|
13933
14024
|
return {
|
|
13934
14025
|
modal: true,
|
|
@@ -13948,16 +14039,23 @@ var ModalComponent = class ModalComponent {
|
|
|
13948
14039
|
#show = signal(false, ...ngDevMode ? [{ debugName: "#show" }] : /* istanbul ignore next */ []);
|
|
13949
14040
|
animateStart() {
|
|
13950
14041
|
if (this.visible()) {
|
|
13951
|
-
this.#
|
|
14042
|
+
this.#hidden = false;
|
|
13952
14043
|
this.#renderer.setStyle(this.#hostElement.nativeElement, "display", "block");
|
|
13953
|
-
} else if (!this
|
|
13954
|
-
this.domPortalCleanup();
|
|
13955
|
-
this.#renderer.setStyle(this.#hostElement.nativeElement, "display", "none");
|
|
13956
|
-
}
|
|
14044
|
+
} else if (!this.#hidden && !isPlatformBrowser(this.#platformId)) this.#completeHide();
|
|
13957
14045
|
setTimeout(() => {
|
|
13958
14046
|
this.show = this.visible();
|
|
13959
14047
|
});
|
|
13960
14048
|
}
|
|
14049
|
+
#completeHide() {
|
|
14050
|
+
this.#hidden = true;
|
|
14051
|
+
this.domPortalCleanup();
|
|
14052
|
+
this.#renderer.setStyle(this.#hostElement.nativeElement, "display", "none");
|
|
14053
|
+
this.#releaseBody();
|
|
14054
|
+
}
|
|
14055
|
+
#releaseBody() {
|
|
14056
|
+
this.#backdropService.unlockScroll(this);
|
|
14057
|
+
this.#modalService.removeOpenClass(this);
|
|
14058
|
+
}
|
|
13961
14059
|
onKeyDownHandler(event) {
|
|
13962
14060
|
if (event.key === "Escape" && !event.defaultPrevented && this.keyboard() && this.visible()) {
|
|
13963
14061
|
if (this.backdrop() === "static") this.setStaticBackdrop();
|
|
@@ -14003,24 +14101,32 @@ var ModalComponent = class ModalComponent {
|
|
|
14003
14101
|
this.#afterViewInit.set(false);
|
|
14004
14102
|
this.setBackdrop(false);
|
|
14005
14103
|
this.domPortalCleanup();
|
|
14104
|
+
this.#releaseBody();
|
|
14006
14105
|
}
|
|
14007
14106
|
stateToggleSubscribe() {
|
|
14008
14107
|
this.#modalService.modalState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((action) => {
|
|
14009
|
-
if (
|
|
14108
|
+
if (!action.modal && !action.id) this.#closeFor(action.focusFallback);
|
|
14109
|
+
else if (this === action.modal || this.id === action.id) {
|
|
14010
14110
|
if ("show" in action) {
|
|
14011
14111
|
const visible = this.visible();
|
|
14012
14112
|
const show = action?.show === "toggle" ? !visible : !!action.show;
|
|
14013
14113
|
if (show && !visible) {
|
|
14014
14114
|
this.#trigger = action.trigger ?? null;
|
|
14015
14115
|
this.#openAction = action;
|
|
14016
|
-
|
|
14017
|
-
|
|
14116
|
+
this.visible.set(true);
|
|
14117
|
+
this.#modalService.announceOpened(this, action.focusFallback);
|
|
14118
|
+
} else this.visible.set(show);
|
|
14018
14119
|
}
|
|
14019
|
-
} else if (this.visible()) {
|
|
14020
|
-
for (const target of this.#focusCandidates()) if (!action.focusFallback?.includes(target)) action.focusFallback?.push(target);
|
|
14021
|
-
this.visible.set(false);
|
|
14022
14120
|
}
|
|
14023
14121
|
});
|
|
14122
|
+
this.#modalService.opened$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(({ modal, focusFallback }) => {
|
|
14123
|
+
if (modal !== this) this.#closeFor(focusFallback);
|
|
14124
|
+
});
|
|
14125
|
+
}
|
|
14126
|
+
#closeFor(focusFallback) {
|
|
14127
|
+
if (!this.visible()) return;
|
|
14128
|
+
for (const target of this.#focusCandidates()) if (!focusFallback.includes(target)) focusFallback.push(target);
|
|
14129
|
+
this.visible.set(false);
|
|
14024
14130
|
}
|
|
14025
14131
|
#focusCandidates() {
|
|
14026
14132
|
return [
|
|
@@ -14037,12 +14143,14 @@ var ModalComponent = class ModalComponent {
|
|
|
14037
14143
|
if (isPlatformBrowser(this.#platformId)) restoreFocus(this.#hostElement.nativeElement, candidates);
|
|
14038
14144
|
}
|
|
14039
14145
|
setBackdrop(setBackdrop) {
|
|
14040
|
-
this.#activeBackdrop
|
|
14146
|
+
if (setBackdrop) this.#activeBackdrop ??= this.#backdropService.setBackdrop("modal", this.transition());
|
|
14147
|
+
else this.#activeBackdrop = this.#backdropService.clearBackdrop(this.#activeBackdrop);
|
|
14041
14148
|
}
|
|
14042
14149
|
setBodyStyles(open) {
|
|
14043
|
-
if (open)
|
|
14044
|
-
|
|
14045
|
-
|
|
14150
|
+
if (!open) return;
|
|
14151
|
+
this.#backdropService.lockScroll(this);
|
|
14152
|
+
if (this.backdrop() !== false) this.#modalService.addOpenClass(this);
|
|
14153
|
+
else this.#modalService.removeOpenClass(this);
|
|
14046
14154
|
}
|
|
14047
14155
|
setStaticBackdrop() {
|
|
14048
14156
|
if (this.transition()) {
|
|
@@ -14172,7 +14280,7 @@ var ModalComponent = class ModalComponent {
|
|
|
14172
14280
|
"class": "hostClasses()",
|
|
14173
14281
|
"attr.role": "visible() ? role() : null",
|
|
14174
14282
|
"inert": "ariaHidden()",
|
|
14175
|
-
"attr.id": "
|
|
14283
|
+
"attr.id": "attrId()",
|
|
14176
14284
|
"aria-modal": "ariaModal()",
|
|
14177
14285
|
"attr.tabindex": "-1"
|
|
14178
14286
|
},
|
|
@@ -14257,7 +14365,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
14257
14365
|
"[class]": "hostClasses()",
|
|
14258
14366
|
"[attr.role]": "visible() ? role() : null",
|
|
14259
14367
|
"[inert]": "ariaHidden()",
|
|
14260
|
-
"[attr.id]": "
|
|
14368
|
+
"[attr.id]": "attrId()",
|
|
14261
14369
|
"[aria-modal]": "ariaModal()",
|
|
14262
14370
|
"[attr.tabindex]": "-1",
|
|
14263
14371
|
"(mousedown)": "onMouseDownHandler($event)",
|
|
@@ -14436,7 +14544,6 @@ var ModalModule = class ModalModule {
|
|
|
14436
14544
|
version: "22.2.3",
|
|
14437
14545
|
ngImport: i0,
|
|
14438
14546
|
type: ModalModule,
|
|
14439
|
-
providers: [ModalService],
|
|
14440
14547
|
imports: [ModalComponent]
|
|
14441
14548
|
});
|
|
14442
14549
|
};
|
|
@@ -14467,8 +14574,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
14467
14574
|
ModalHeaderComponent,
|
|
14468
14575
|
ModalTitleDirective,
|
|
14469
14576
|
ModalToggleDirective
|
|
14470
|
-
]
|
|
14471
|
-
providers: [ModalService]
|
|
14577
|
+
]
|
|
14472
14578
|
}]
|
|
14473
14579
|
}]
|
|
14474
14580
|
});
|
|
@@ -14535,10 +14641,11 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14535
14641
|
#activeBackdrop;
|
|
14536
14642
|
#backdropClickSubscription;
|
|
14537
14643
|
#layoutChangeSubscription;
|
|
14538
|
-
#hideFallbackId;
|
|
14539
14644
|
#focusBeforeShow = null;
|
|
14645
|
+
#hidden = signal(true, ...ngDevMode ? [{ debugName: "#hidden" }] : /* istanbul ignore next */ []);
|
|
14540
14646
|
#isShown = false;
|
|
14541
14647
|
#shownAsPanel = false;
|
|
14648
|
+
#transitionWait;
|
|
14542
14649
|
#trigger = null;
|
|
14543
14650
|
#inPlace = signal(false, ...ngDevMode ? [{ debugName: "#inPlace" }] : /* istanbul ignore next */ []);
|
|
14544
14651
|
scroll = input(false, {
|
|
@@ -14574,20 +14681,36 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14574
14681
|
#afterEveryRenderFn = afterEveryRender({ read: () => this.#readPosition() });
|
|
14575
14682
|
visibleEffect = effect(() => {
|
|
14576
14683
|
const visible = this.visible();
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
if (
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
this.visibleChange?.emit(visible);
|
|
14684
|
+
untracked(() => {
|
|
14685
|
+
const wasShown = this.#isShown;
|
|
14686
|
+
this.animateStart(visible);
|
|
14687
|
+
if (visible) {
|
|
14688
|
+
if (!wasShown) this.#focusBeforeShow = this.#document.activeElement;
|
|
14689
|
+
this.setFocus();
|
|
14690
|
+
} else {
|
|
14691
|
+
this.#shownAsPanel = false;
|
|
14692
|
+
this.#restoreFocus();
|
|
14693
|
+
}
|
|
14694
|
+
this.visibleChange?.emit(visible);
|
|
14695
|
+
});
|
|
14590
14696
|
}, ...ngDevMode ? [{ debugName: "visibleEffect" }] : /* istanbul ignore next */ []);
|
|
14697
|
+
#backdropEffect = effect(() => {
|
|
14698
|
+
const backdrop = this.visible() && this.backdrop();
|
|
14699
|
+
untracked(() => this.setBackdrop(backdrop));
|
|
14700
|
+
}, ...ngDevMode ? [{ debugName: "#backdropEffect" }] : /* istanbul ignore next */ []);
|
|
14701
|
+
#scrollLockEffect = effect(() => {
|
|
14702
|
+
const visible = this.visible();
|
|
14703
|
+
const scroll = this.scroll();
|
|
14704
|
+
untracked(() => {
|
|
14705
|
+
if (!visible) return;
|
|
14706
|
+
if (scroll) this.#backdropService.unlockScroll(this);
|
|
14707
|
+
else this.#backdropService.lockScroll(this);
|
|
14708
|
+
});
|
|
14709
|
+
}, ...ngDevMode ? [{ debugName: "#scrollLockEffect" }] : /* istanbul ignore next */ []);
|
|
14710
|
+
#layoutEffect = effect(() => {
|
|
14711
|
+
const breakpoint = this.visible() && this.responsiveBreakpoint;
|
|
14712
|
+
untracked(() => this.layoutChangeSubscribe(breakpoint));
|
|
14713
|
+
}, ...ngDevMode ? [{ debugName: "#layoutEffect" }] : /* istanbul ignore next */ []);
|
|
14591
14714
|
visibleChange = output();
|
|
14592
14715
|
hostClasses = computed(() => {
|
|
14593
14716
|
const responsive = this.responsive();
|
|
@@ -14603,6 +14726,9 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14603
14726
|
ariaHidden = computed(() => {
|
|
14604
14727
|
return this.visible() || this.#inPlace() ? null : true;
|
|
14605
14728
|
}, ...ngDevMode ? [{ debugName: "ariaHidden" }] : /* istanbul ignore next */ []);
|
|
14729
|
+
hostInert = computed(() => {
|
|
14730
|
+
return this.#hidden() ? this.ariaHidden() : null;
|
|
14731
|
+
}, ...ngDevMode ? [{ debugName: "hostInert" }] : /* istanbul ignore next */ []);
|
|
14606
14732
|
get tabIndex() {
|
|
14607
14733
|
return "-1";
|
|
14608
14734
|
}
|
|
@@ -14620,20 +14746,24 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14620
14746
|
return breakpointValue ? `${parseFloat(breakpointValue.trim()) - .02}px` : false;
|
|
14621
14747
|
}
|
|
14622
14748
|
animateStart(visible = this.visible()) {
|
|
14623
|
-
const
|
|
14749
|
+
const host = this.#hostElement.nativeElement;
|
|
14624
14750
|
this.#isShown = visible;
|
|
14625
|
-
this.#clearHideFallback();
|
|
14626
14751
|
if (visible) {
|
|
14627
|
-
|
|
14628
|
-
this.#renderer.removeClass(
|
|
14629
|
-
this.#renderer.addClass(
|
|
14752
|
+
this.#hidden.set(false);
|
|
14753
|
+
this.#renderer.removeClass(host, "hiding");
|
|
14754
|
+
this.#renderer.addClass(host, "showing");
|
|
14630
14755
|
} else {
|
|
14631
|
-
this.#renderer.removeClass(
|
|
14632
|
-
if (
|
|
14633
|
-
|
|
14634
|
-
this.#scheduleHideFallback();
|
|
14635
|
-
}
|
|
14756
|
+
this.#renderer.removeClass(host, "showing");
|
|
14757
|
+
if (this.#hidden()) return;
|
|
14758
|
+
this.#renderer.addClass(host, "hiding");
|
|
14636
14759
|
}
|
|
14760
|
+
const transitionWait = {};
|
|
14761
|
+
this.#transitionWait = transitionWait;
|
|
14762
|
+
afterTransitions(host).then(() => {
|
|
14763
|
+
if (this.#transitionWait !== transitionWait || this.visible() !== visible) return;
|
|
14764
|
+
if (visible) this.#renderer.removeClass(host, "showing");
|
|
14765
|
+
else this.#completeHide();
|
|
14766
|
+
});
|
|
14637
14767
|
}
|
|
14638
14768
|
onKeyDownHandler(event) {
|
|
14639
14769
|
if (event.key === "Escape" && !event.defaultPrevented && this.keyboard() && this.visible() && this.backdrop() !== "static") this.#offcanvasService.toggle({
|
|
@@ -14653,7 +14783,6 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14653
14783
|
setTimeout(() => {
|
|
14654
14784
|
this.#renderer.setStyle(this.#hostElement.nativeElement, "display", "flex");
|
|
14655
14785
|
});
|
|
14656
|
-
this.#hostElement.nativeElement.addEventListener("transitionend", this.#handleTransitionEnd);
|
|
14657
14786
|
}
|
|
14658
14787
|
ngOnDestroy() {
|
|
14659
14788
|
if (this.#trigger || this.#focusBeforeShow) this.#restoreFocus();
|
|
@@ -14661,38 +14790,17 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14661
14790
|
show: false,
|
|
14662
14791
|
id: this.id()
|
|
14663
14792
|
});
|
|
14664
|
-
this.#
|
|
14665
|
-
this.#clearHideFallback();
|
|
14793
|
+
this.#transitionWait = void 0;
|
|
14666
14794
|
this.setBackdrop(false);
|
|
14795
|
+
this.#backdropService.unlockScroll(this);
|
|
14667
14796
|
this.domPortalCleanup();
|
|
14668
14797
|
}
|
|
14669
|
-
#removeEventListeners = () => {
|
|
14670
|
-
this.#hostElement.nativeElement.removeEventListener("transitionend", this.#handleTransitionEnd);
|
|
14671
|
-
};
|
|
14672
|
-
#handleTransitionEnd = (event) => {
|
|
14673
|
-
const offcanvasElement = this.#hostElement.nativeElement;
|
|
14674
|
-
if (event.target === offcanvasElement && event.propertyName === "transform") {
|
|
14675
|
-
if (this.visible()) this.#renderer.removeClass(offcanvasElement, "showing");
|
|
14676
|
-
else this.#completeHide();
|
|
14677
|
-
}
|
|
14678
|
-
};
|
|
14679
14798
|
#completeHide() {
|
|
14680
|
-
this.#
|
|
14799
|
+
this.#hidden.set(true);
|
|
14681
14800
|
this.#renderer.removeClass(this.#hostElement.nativeElement, "hiding");
|
|
14682
|
-
this.#
|
|
14683
|
-
this.#renderer.removeStyle(this.#document.body, "paddingRight");
|
|
14801
|
+
this.#backdropService.unlockScroll(this);
|
|
14684
14802
|
this.domPortalCleanup();
|
|
14685
14803
|
}
|
|
14686
|
-
#scheduleHideFallback() {
|
|
14687
|
-
const style = this.#document.defaultView?.getComputedStyle(this.#hostElement.nativeElement);
|
|
14688
|
-
const duration = Number.parseFloat(style?.transitionDuration ?? "") || 0;
|
|
14689
|
-
const delay = Number.parseFloat(style?.transitionDelay ?? "") || 0;
|
|
14690
|
-
this.#hideFallbackId = setTimeout(() => this.#completeHide(), (duration + delay) * 1e3 + 5);
|
|
14691
|
-
}
|
|
14692
|
-
#clearHideFallback() {
|
|
14693
|
-
clearTimeout(this.#hideFallbackId);
|
|
14694
|
-
this.#hideFallbackId = void 0;
|
|
14695
|
-
}
|
|
14696
14804
|
#readPosition() {
|
|
14697
14805
|
const position = this.#document.defaultView?.getComputedStyle(this.#hostElement.nativeElement).position;
|
|
14698
14806
|
this.#inPlace.set(!!position && position !== "fixed");
|
|
@@ -14720,27 +14828,26 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14720
14828
|
});
|
|
14721
14829
|
}
|
|
14722
14830
|
backdropClickSubscribe(subscribe = true) {
|
|
14831
|
+
this.#backdropClickSubscription?.unsubscribe();
|
|
14723
14832
|
if (subscribe) this.#backdropClickSubscription = this.#backdropService.backdropClick$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((clicked) => {
|
|
14724
14833
|
this.#offcanvasService.toggle({
|
|
14725
14834
|
show: !clicked,
|
|
14726
14835
|
id: this.id()
|
|
14727
14836
|
});
|
|
14728
14837
|
});
|
|
14729
|
-
else this.#backdropClickSubscription?.unsubscribe();
|
|
14730
14838
|
}
|
|
14731
14839
|
setBackdrop(setBackdrop) {
|
|
14732
|
-
|
|
14733
|
-
|
|
14840
|
+
if (!setBackdrop) this.#activeBackdrop = this.#backdropService.clearBackdrop(this.#activeBackdrop);
|
|
14841
|
+
else if (!this.#activeBackdrop) this.#activeBackdrop = this.#backdropService.setBackdrop("offcanvas");
|
|
14842
|
+
this.backdropClickSubscribe(setBackdrop === true);
|
|
14734
14843
|
}
|
|
14735
|
-
layoutChangeSubscribe(
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
this
|
|
14741
|
-
|
|
14742
|
-
});
|
|
14743
|
-
} else this.#layoutChangeSubscription?.unsubscribe();
|
|
14844
|
+
layoutChangeSubscribe(breakpoint) {
|
|
14845
|
+
this.#layoutChangeSubscription?.unsubscribe();
|
|
14846
|
+
if (!breakpoint) return;
|
|
14847
|
+
const layoutChanges = this.#breakpointObserver.observe([`(max-width: ${breakpoint})`]);
|
|
14848
|
+
this.#layoutChangeSubscription = layoutChanges.pipe(filter((breakpointState) => !breakpointState.matches), takeUntilDestroyed(this.#destroyRef)).subscribe((breakpointState) => {
|
|
14849
|
+
this.visible.set(breakpointState.matches);
|
|
14850
|
+
});
|
|
14744
14851
|
}
|
|
14745
14852
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
14746
14853
|
minVersion: "12.0.0",
|
|
@@ -14843,10 +14950,10 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14843
14950
|
},
|
|
14844
14951
|
properties: {
|
|
14845
14952
|
"attr.id": "id()",
|
|
14846
|
-
"inert": "
|
|
14953
|
+
"inert": "hostInert()",
|
|
14847
14954
|
"attr.role": "visible() ? role() : null",
|
|
14848
14955
|
"aria-modal": "visible() ? ariaModal() : null",
|
|
14849
|
-
"attr.tabindex": "tabIndex",
|
|
14956
|
+
"attr.tabindex": "ariaHidden() ? null : tabIndex",
|
|
14850
14957
|
"class": "hostClasses()"
|
|
14851
14958
|
}
|
|
14852
14959
|
},
|
|
@@ -14856,7 +14963,7 @@ var OffcanvasComponent = class OffcanvasComponent {
|
|
|
14856
14963
|
inputs: ["dark", "dark"]
|
|
14857
14964
|
}],
|
|
14858
14965
|
ngImport: i0,
|
|
14859
|
-
template: "<div [cdkTrapFocus]=\"visible()\">\n <ng-content />\n</div>\n",
|
|
14966
|
+
template: "<div [cdkTrapFocus]=\"visible()\" [inert]=\"ariaHidden()\">\n <ng-content />\n</div>\n",
|
|
14860
14967
|
styles: [":host{display:none}\n"],
|
|
14861
14968
|
dependencies: [{
|
|
14862
14969
|
kind: "ngmodule",
|
|
@@ -14887,15 +14994,15 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
14887
14994
|
}],
|
|
14888
14995
|
host: {
|
|
14889
14996
|
"[attr.id]": "id()",
|
|
14890
|
-
"[inert]": "
|
|
14997
|
+
"[inert]": "hostInert()",
|
|
14891
14998
|
"[attr.role]": "visible() ? role() : null",
|
|
14892
14999
|
"[aria-modal]": "visible() ? ariaModal() : null",
|
|
14893
|
-
"[attr.tabindex]": "tabIndex",
|
|
15000
|
+
"[attr.tabindex]": "ariaHidden() ? null : tabIndex",
|
|
14894
15001
|
"[class]": "hostClasses()",
|
|
14895
15002
|
"(document:keydown)": "onKeyDownHandler($event)",
|
|
14896
15003
|
"(window:resize)": "onResizeHandler()"
|
|
14897
15004
|
},
|
|
14898
|
-
template: "<div [cdkTrapFocus]=\"visible()\">\n <ng-content />\n</div>\n",
|
|
15005
|
+
template: "<div [cdkTrapFocus]=\"visible()\" [inert]=\"ariaHidden()\">\n <ng-content />\n</div>\n",
|
|
14899
15006
|
styles: [":host{display:none}\n"]
|
|
14900
15007
|
}]
|
|
14901
15008
|
}],
|
|
@@ -15193,7 +15300,6 @@ var OffcanvasModule = class OffcanvasModule {
|
|
|
15193
15300
|
version: "22.2.3",
|
|
15194
15301
|
ngImport: i0,
|
|
15195
15302
|
type: OffcanvasModule,
|
|
15196
|
-
providers: [OffcanvasService, BackdropService],
|
|
15197
15303
|
imports: [OffcanvasComponent]
|
|
15198
15304
|
});
|
|
15199
15305
|
};
|
|
@@ -15218,8 +15324,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
15218
15324
|
OffcanvasHeaderComponent,
|
|
15219
15325
|
OffcanvasTitleDirective,
|
|
15220
15326
|
OffcanvasToggleDirective
|
|
15221
|
-
]
|
|
15222
|
-
providers: [OffcanvasService, BackdropService]
|
|
15327
|
+
]
|
|
15223
15328
|
}]
|
|
15224
15329
|
}]
|
|
15225
15330
|
});
|
|
@@ -15971,10 +16076,11 @@ var PopoverDirective = class PopoverDirective {
|
|
|
15971
16076
|
#hostElement = inject(ElementRef);
|
|
15972
16077
|
#viewContainerRef = inject(ViewContainerRef);
|
|
15973
16078
|
#listenersService = inject(ListenersService);
|
|
15974
|
-
#changeDetectorRef = inject(ChangeDetectorRef);
|
|
15975
16079
|
#intersectionService = inject(IntersectionService);
|
|
15976
16080
|
#destroyRef = inject(DestroyRef);
|
|
15977
16081
|
#document = inject(DOCUMENT);
|
|
16082
|
+
#isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
16083
|
+
#tooltipId = inject(UIDService).getUID("popover");
|
|
15978
16084
|
#timerId1;
|
|
15979
16085
|
#timerId2;
|
|
15980
16086
|
content = input(void 0, {
|
|
@@ -16018,13 +16124,16 @@ var PopoverDirective = class PopoverDirective {
|
|
|
16018
16124
|
...ngDevMode ? { debugName: "visible" } : /* istanbul ignore next */ {},
|
|
16019
16125
|
alias: "cPopoverVisible"
|
|
16020
16126
|
});
|
|
16127
|
+
#shown = computed(() => !this.#isServer && this.visible() && !!this.content(), ...ngDevMode ? [{ debugName: "#shown" }] : /* istanbul ignore next */ []);
|
|
16021
16128
|
#visibleEffect = afterRenderEffect({ write: () => {
|
|
16022
16129
|
this.visible() ? this.addTooltipElement() : this.removeTooltipElement();
|
|
16023
16130
|
} }, ...ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []);
|
|
16024
16131
|
#handleEscapeKey = (event) => {
|
|
16025
16132
|
if (event.key !== "Escape") return;
|
|
16026
|
-
|
|
16027
|
-
|
|
16133
|
+
if (this.#shown()) {
|
|
16134
|
+
event.preventDefault();
|
|
16135
|
+
event.stopPropagation();
|
|
16136
|
+
}
|
|
16028
16137
|
this.visible.set(false);
|
|
16029
16138
|
};
|
|
16030
16139
|
#escapeEffect = effect((onCleanup) => {
|
|
@@ -16035,27 +16144,36 @@ var PopoverDirective = class PopoverDirective {
|
|
|
16035
16144
|
this.#document.removeEventListener("keydown", this.#handleEscapeKey, useCapture);
|
|
16036
16145
|
});
|
|
16037
16146
|
}, ...ngDevMode ? [{ debugName: "#escapeEffect" }] : /* istanbul ignore next */ []);
|
|
16147
|
+
#ariaDescribedByEffect = afterRenderEffect(() => this.#syncAriaDescribedBy(this.#shown()), ...ngDevMode ? [{ debugName: "#ariaDescribedByEffect" }] : /* istanbul ignore next */ []);
|
|
16038
16148
|
get ariaDescribedBy() {
|
|
16039
|
-
return this
|
|
16149
|
+
return this.#shown() ? this.#tooltipId : null;
|
|
16040
16150
|
}
|
|
16041
16151
|
tooltip;
|
|
16042
|
-
tooltipId;
|
|
16043
16152
|
tooltipRef;
|
|
16044
16153
|
popperInstance;
|
|
16045
16154
|
_popperOptions = { modifiers: [{
|
|
16046
16155
|
name: "offset",
|
|
16047
16156
|
options: { offset: [0, 9] }
|
|
16048
16157
|
}] };
|
|
16158
|
+
ngAfterViewChecked() {
|
|
16159
|
+
this.#syncAriaDescribedBy(this.#shown());
|
|
16160
|
+
}
|
|
16049
16161
|
ngAfterViewInit() {
|
|
16050
16162
|
this.intersectionServiceSubscribe();
|
|
16051
16163
|
}
|
|
16052
16164
|
ngOnDestroy() {
|
|
16053
16165
|
this.clearListeners();
|
|
16054
16166
|
this.destroyTooltipElement();
|
|
16167
|
+
this.#syncAriaDescribedBy(false);
|
|
16055
16168
|
}
|
|
16056
16169
|
ngOnInit() {
|
|
16057
16170
|
this.setListeners();
|
|
16058
16171
|
}
|
|
16172
|
+
#syncAriaDescribedBy(shown) {
|
|
16173
|
+
const host = this.#hostElement.nativeElement;
|
|
16174
|
+
if (shown) addAriaReferencedId(host, "aria-describedby", this.#tooltipId);
|
|
16175
|
+
else if (getAriaReferenceIds(host, "aria-describedby").includes(this.#tooltipId)) removeAriaReferencedId(host, "aria-describedby", this.#tooltipId);
|
|
16176
|
+
}
|
|
16059
16177
|
setListeners() {
|
|
16060
16178
|
const config = {
|
|
16061
16179
|
hostElement: this.#hostElement,
|
|
@@ -16083,23 +16201,20 @@ var PopoverDirective = class PopoverDirective {
|
|
|
16083
16201
|
this.visible.set(next.isIntersecting ? this.visible() : false);
|
|
16084
16202
|
});
|
|
16085
16203
|
}
|
|
16086
|
-
getUID(prefix) {
|
|
16087
|
-
let uid = prefix ?? "random-id";
|
|
16088
|
-
do
|
|
16089
|
-
uid = `${prefix}-${Math.floor(Math.random() * 1e6).toString(10)}`;
|
|
16090
|
-
while (this.#document.getElementById(uid));
|
|
16091
|
-
return uid;
|
|
16092
|
-
}
|
|
16093
16204
|
createTooltipElement() {
|
|
16094
|
-
if (!this.tooltipRef)
|
|
16205
|
+
if (!this.tooltipRef) {
|
|
16206
|
+
this.tooltipRef = this.#viewContainerRef.createComponent(PopoverComponent);
|
|
16207
|
+
this.tooltipRef.setInput("id", this.#tooltipId);
|
|
16208
|
+
}
|
|
16095
16209
|
}
|
|
16096
16210
|
destroyTooltipElement() {
|
|
16211
|
+
clearTimeout(this.#timerId1);
|
|
16212
|
+
clearTimeout(this.#timerId2);
|
|
16097
16213
|
this.tooltip?.remove();
|
|
16098
16214
|
this.tooltipRef?.destroy();
|
|
16099
16215
|
this.tooltipRef = void 0;
|
|
16100
16216
|
this.popperInstance?.destroy();
|
|
16101
|
-
this
|
|
16102
|
-
this.#viewContainerRef?.clear();
|
|
16217
|
+
this.popperInstance = void 0;
|
|
16103
16218
|
}
|
|
16104
16219
|
addTooltipElement() {
|
|
16105
16220
|
if (!this.content()) {
|
|
@@ -16115,33 +16230,27 @@ var PopoverDirective = class PopoverDirective {
|
|
|
16115
16230
|
this.#viewContainerRef.insert(this.tooltipRef.hostView);
|
|
16116
16231
|
this.#renderer.appendChild(this.#document.body, this.tooltip);
|
|
16117
16232
|
this.popperInstance = createPopper(this.referenceRef().nativeElement, this.tooltip, { ...this.popperOptionsComputed() });
|
|
16118
|
-
if (!this.visible()) {
|
|
16119
|
-
this.removeTooltipElement();
|
|
16120
|
-
return;
|
|
16121
|
-
}
|
|
16122
16233
|
clearTimeout(this.#timerId2);
|
|
16123
16234
|
clearTimeout(this.#timerId1);
|
|
16124
16235
|
this.#timerId1 = setTimeout(() => {
|
|
16125
|
-
this.tooltipId = this.getUID("popover");
|
|
16126
|
-
this.tooltipRef?.setInput("id", this.tooltipId);
|
|
16127
16236
|
this.#renderer.removeClass(this.tooltip, "d-none");
|
|
16128
16237
|
this.tooltipRef?.setInput("visible", this.visible());
|
|
16129
16238
|
this.popperInstance?.forceUpdate();
|
|
16130
|
-
this.#changeDetectorRef?.markForCheck();
|
|
16131
16239
|
this.#timerId1 = void 0;
|
|
16132
16240
|
}, 150);
|
|
16133
16241
|
}
|
|
16134
16242
|
removeTooltipElement() {
|
|
16135
|
-
this
|
|
16243
|
+
clearTimeout(this.#timerId1);
|
|
16136
16244
|
if (!this.tooltipRef) return;
|
|
16137
16245
|
clearTimeout(this.#timerId2);
|
|
16138
16246
|
this.#timerId2 = setTimeout(() => {
|
|
16139
|
-
this.#viewContainerRef
|
|
16247
|
+
const index = this.#viewContainerRef.indexOf(this.tooltipRef.hostView);
|
|
16248
|
+
if (index >= 0) this.#viewContainerRef.detach(index);
|
|
16249
|
+
this.popperInstance?.destroy();
|
|
16250
|
+
this.popperInstance = void 0;
|
|
16140
16251
|
this.#timerId2 = void 0;
|
|
16141
16252
|
}, 300);
|
|
16142
16253
|
this.tooltipRef.setInput("visible", false);
|
|
16143
|
-
this.tooltipRef.setInput("id", void 0);
|
|
16144
|
-
this.#changeDetectorRef.markForCheck();
|
|
16145
16254
|
}
|
|
16146
16255
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
16147
16256
|
minVersion: "12.0.0",
|
|
@@ -16202,7 +16311,6 @@ var PopoverDirective = class PopoverDirective {
|
|
|
16202
16311
|
}
|
|
16203
16312
|
},
|
|
16204
16313
|
outputs: { visible: "cPopoverVisibleChange" },
|
|
16205
|
-
host: { properties: { "aria-describedby": "ariaDescribedBy" } },
|
|
16206
16314
|
providers: [ListenersService, IntersectionService],
|
|
16207
16315
|
exportAs: ["cPopover"],
|
|
16208
16316
|
ngImport: i0
|
|
@@ -16218,8 +16326,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
16218
16326
|
args: [{
|
|
16219
16327
|
selector: "[cPopover]",
|
|
16220
16328
|
exportAs: "cPopover",
|
|
16221
|
-
providers: [ListenersService, IntersectionService]
|
|
16222
|
-
host: { "[aria-describedby]": "ariaDescribedBy" }
|
|
16329
|
+
providers: [ListenersService, IntersectionService]
|
|
16223
16330
|
}]
|
|
16224
16331
|
}],
|
|
16225
16332
|
propDecorators: {
|
|
@@ -22299,10 +22406,11 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22299
22406
|
#hostElement = inject(ElementRef);
|
|
22300
22407
|
#viewContainerRef = inject(ViewContainerRef);
|
|
22301
22408
|
#listenersService = inject(ListenersService);
|
|
22302
|
-
#changeDetectorRef = inject(ChangeDetectorRef);
|
|
22303
22409
|
#intersectionService = inject(IntersectionService);
|
|
22304
22410
|
#destroyRef = inject(DestroyRef);
|
|
22305
22411
|
#document = inject(DOCUMENT);
|
|
22412
|
+
#isServer = isPlatformServer(inject(PLATFORM_ID));
|
|
22413
|
+
#tooltipId = inject(UIDService).getUID("tooltip");
|
|
22306
22414
|
#timerId1;
|
|
22307
22415
|
#timerId2;
|
|
22308
22416
|
content = input(void 0, {
|
|
@@ -22346,13 +22454,16 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22346
22454
|
...ngDevMode ? { debugName: "visible" } : /* istanbul ignore next */ {},
|
|
22347
22455
|
alias: "cTooltipVisible"
|
|
22348
22456
|
});
|
|
22457
|
+
#shown = computed(() => !this.#isServer && this.visible() && !!this.content(), ...ngDevMode ? [{ debugName: "#shown" }] : /* istanbul ignore next */ []);
|
|
22349
22458
|
#visibleEffect = afterRenderEffect({ write: () => {
|
|
22350
22459
|
this.visible() ? this.addTooltipElement() : this.removeTooltipElement();
|
|
22351
22460
|
} }, ...ngDevMode ? [{ debugName: "#visibleEffect" }] : /* istanbul ignore next */ []);
|
|
22352
22461
|
#handleEscapeKey = (event) => {
|
|
22353
22462
|
if (event.key !== "Escape") return;
|
|
22354
|
-
|
|
22355
|
-
|
|
22463
|
+
if (this.#shown()) {
|
|
22464
|
+
event.preventDefault();
|
|
22465
|
+
event.stopPropagation();
|
|
22466
|
+
}
|
|
22356
22467
|
this.visible.set(false);
|
|
22357
22468
|
};
|
|
22358
22469
|
#escapeEffect = effect((onCleanup) => {
|
|
@@ -22361,27 +22472,36 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22361
22472
|
this.#document.addEventListener("keydown", this.#handleEscapeKey, useCapture);
|
|
22362
22473
|
onCleanup(() => this.#document.removeEventListener("keydown", this.#handleEscapeKey, useCapture));
|
|
22363
22474
|
}, ...ngDevMode ? [{ debugName: "#escapeEffect" }] : /* istanbul ignore next */ []);
|
|
22475
|
+
#ariaDescribedByEffect = afterRenderEffect(() => this.#syncAriaDescribedBy(this.#shown()), ...ngDevMode ? [{ debugName: "#ariaDescribedByEffect" }] : /* istanbul ignore next */ []);
|
|
22364
22476
|
get ariaDescribedBy() {
|
|
22365
|
-
return this
|
|
22477
|
+
return this.#shown() ? this.#tooltipId : null;
|
|
22366
22478
|
}
|
|
22367
22479
|
tooltip;
|
|
22368
|
-
tooltipId;
|
|
22369
22480
|
tooltipRef;
|
|
22370
22481
|
popperInstance;
|
|
22371
22482
|
_popperOptions = { modifiers: [{
|
|
22372
22483
|
name: "offset",
|
|
22373
22484
|
options: { offset: [0, 5] }
|
|
22374
22485
|
}] };
|
|
22486
|
+
ngAfterViewChecked() {
|
|
22487
|
+
this.#syncAriaDescribedBy(this.#shown());
|
|
22488
|
+
}
|
|
22375
22489
|
ngAfterViewInit() {
|
|
22376
22490
|
this.intersectionServiceSubscribe();
|
|
22377
22491
|
}
|
|
22378
22492
|
ngOnDestroy() {
|
|
22379
22493
|
this.clearListeners();
|
|
22380
22494
|
this.destroyTooltipElement();
|
|
22495
|
+
this.#syncAriaDescribedBy(false);
|
|
22381
22496
|
}
|
|
22382
22497
|
ngOnInit() {
|
|
22383
22498
|
this.setListeners();
|
|
22384
22499
|
}
|
|
22500
|
+
#syncAriaDescribedBy(shown) {
|
|
22501
|
+
const host = this.#hostElement.nativeElement;
|
|
22502
|
+
if (shown) addAriaReferencedId(host, "aria-describedby", this.#tooltipId);
|
|
22503
|
+
else if (getAriaReferenceIds(host, "aria-describedby").includes(this.#tooltipId)) removeAriaReferencedId(host, "aria-describedby", this.#tooltipId);
|
|
22504
|
+
}
|
|
22385
22505
|
setListeners() {
|
|
22386
22506
|
const config = {
|
|
22387
22507
|
hostElement: this.#hostElement,
|
|
@@ -22409,23 +22529,20 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22409
22529
|
this.visible.set(next.isIntersecting ? this.visible() : false);
|
|
22410
22530
|
});
|
|
22411
22531
|
}
|
|
22412
|
-
getUID(prefix) {
|
|
22413
|
-
let uid = prefix ?? "random-id";
|
|
22414
|
-
do
|
|
22415
|
-
uid = `${prefix}-${Math.floor(Math.random() * 1e6).toString(10)}`;
|
|
22416
|
-
while (this.#document.getElementById(uid));
|
|
22417
|
-
return uid;
|
|
22418
|
-
}
|
|
22419
22532
|
createTooltipElement() {
|
|
22420
|
-
if (!this.tooltipRef)
|
|
22533
|
+
if (!this.tooltipRef) {
|
|
22534
|
+
this.tooltipRef = this.#viewContainerRef.createComponent(TooltipComponent);
|
|
22535
|
+
this.tooltipRef.setInput("id", this.#tooltipId);
|
|
22536
|
+
}
|
|
22421
22537
|
}
|
|
22422
22538
|
destroyTooltipElement() {
|
|
22539
|
+
clearTimeout(this.#timerId1);
|
|
22540
|
+
clearTimeout(this.#timerId2);
|
|
22423
22541
|
this.tooltip?.remove();
|
|
22424
22542
|
this.tooltipRef?.destroy();
|
|
22425
22543
|
this.tooltipRef = void 0;
|
|
22426
22544
|
this.popperInstance?.destroy();
|
|
22427
|
-
this
|
|
22428
|
-
this.#viewContainerRef?.clear();
|
|
22545
|
+
this.popperInstance = void 0;
|
|
22429
22546
|
}
|
|
22430
22547
|
addTooltipElement() {
|
|
22431
22548
|
if (!this.content()) {
|
|
@@ -22441,33 +22558,27 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22441
22558
|
this.#viewContainerRef.insert(this.tooltipRef.hostView);
|
|
22442
22559
|
this.#renderer.appendChild(this.#document.body, this.tooltip);
|
|
22443
22560
|
this.popperInstance = createPopper(this.referenceRef().nativeElement, this.tooltip, { ...this.popperOptionsComputed() });
|
|
22444
|
-
if (!this.visible()) {
|
|
22445
|
-
this.removeTooltipElement();
|
|
22446
|
-
return;
|
|
22447
|
-
}
|
|
22448
22561
|
clearTimeout(this.#timerId2);
|
|
22449
22562
|
clearTimeout(this.#timerId1);
|
|
22450
22563
|
this.#timerId1 = setTimeout(() => {
|
|
22451
|
-
this.tooltipId = this.getUID("tooltip");
|
|
22452
|
-
this.tooltipRef?.setInput("id", this.tooltipId);
|
|
22453
22564
|
this.#renderer.removeClass(this.tooltip, "d-none");
|
|
22454
22565
|
this.tooltipRef?.setInput("visible", this.visible());
|
|
22455
22566
|
this.popperInstance?.forceUpdate();
|
|
22456
|
-
this.#changeDetectorRef?.markForCheck();
|
|
22457
22567
|
this.#timerId1 = void 0;
|
|
22458
22568
|
}, 150);
|
|
22459
22569
|
}
|
|
22460
22570
|
removeTooltipElement() {
|
|
22461
|
-
this
|
|
22571
|
+
clearTimeout(this.#timerId1);
|
|
22462
22572
|
if (!this.tooltipRef) return;
|
|
22463
22573
|
clearTimeout(this.#timerId2);
|
|
22464
22574
|
this.#timerId2 = setTimeout(() => {
|
|
22465
|
-
this.#viewContainerRef
|
|
22575
|
+
const index = this.#viewContainerRef.indexOf(this.tooltipRef.hostView);
|
|
22576
|
+
if (index >= 0) this.#viewContainerRef.detach(index);
|
|
22577
|
+
this.popperInstance?.destroy();
|
|
22578
|
+
this.popperInstance = void 0;
|
|
22466
22579
|
this.#timerId2 = void 0;
|
|
22467
22580
|
}, 300);
|
|
22468
22581
|
this.tooltipRef.setInput("visible", false);
|
|
22469
|
-
this.tooltipRef.setInput("id", void 0);
|
|
22470
|
-
this.#changeDetectorRef.markForCheck();
|
|
22471
22582
|
}
|
|
22472
22583
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
22473
22584
|
minVersion: "12.0.0",
|
|
@@ -22528,7 +22639,6 @@ var TooltipDirective = class TooltipDirective {
|
|
|
22528
22639
|
}
|
|
22529
22640
|
},
|
|
22530
22641
|
outputs: { visible: "cTooltipVisibleChange" },
|
|
22531
|
-
host: { properties: { "aria-describedby": "ariaDescribedBy" } },
|
|
22532
22642
|
providers: [ListenersService, IntersectionService],
|
|
22533
22643
|
exportAs: ["cTooltip"],
|
|
22534
22644
|
ngImport: i0
|
|
@@ -22544,8 +22654,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
22544
22654
|
args: [{
|
|
22545
22655
|
selector: "[cTooltip]",
|
|
22546
22656
|
exportAs: "cTooltip",
|
|
22547
|
-
providers: [ListenersService, IntersectionService]
|
|
22548
|
-
host: { "[aria-describedby]": "ariaDescribedBy" }
|
|
22657
|
+
providers: [ListenersService, IntersectionService]
|
|
22549
22658
|
}]
|
|
22550
22659
|
}],
|
|
22551
22660
|
propDecorators: {
|
|
@@ -23011,7 +23120,7 @@ var WidgetStatCComponent = class WidgetStatCComponent extends CardComponent {
|
|
|
23011
23120
|
exportAs: ["cWidgetStatC"],
|
|
23012
23121
|
usesInheritance: true,
|
|
23013
23122
|
ngImport: i0,
|
|
23014
|
-
template: "@let _templates = templates();\n<c-card-body>\n @if (icon() || _templates?.['widgetIconTemplate']) {\n <div [class]=\"iconClasses()\">\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetIconTemplate'] || defaultWidgetIconTemplate\" />\n </div>\n }\n @if (!!value()) {\n <div [class]=\"valueClasses()\">\n {{ value() }}\n </div>\n }\n @if (!!title()) {\n <div [class]=\"titleClasses()\">\n {{ title() }}\n </div>\n }\n @if (_templates?.['widgetProgressTemplate']) {\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetProgressTemplate']
|
|
23123
|
+
template: "@let _templates = templates();\n<c-card-body>\n @if (icon() || _templates?.['widgetIconTemplate']) {\n <div [class]=\"iconClasses()\">\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetIconTemplate'] || defaultWidgetIconTemplate\" />\n </div>\n }\n @if (!!value()) {\n <div [class]=\"valueClasses()\">\n {{ value() }}\n </div>\n }\n @if (!!title()) {\n <div [class]=\"titleClasses()\">\n {{ title() }}\n </div>\n }\n @if (_templates?.['widgetProgressTemplate']) {\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetProgressTemplate']\" />\n }\n</c-card-body>\n\n<ng-template #defaultWidgetIconTemplate>\n {{ icon() }}\n</ng-template>\n",
|
|
23015
23124
|
dependencies: [{
|
|
23016
23125
|
kind: "component",
|
|
23017
23126
|
type: CardBodyComponent,
|
|
@@ -23040,7 +23149,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
23040
23149
|
exportAs: "cWidgetStatC",
|
|
23041
23150
|
imports: [CardBodyComponent, NgTemplateOutlet],
|
|
23042
23151
|
host: { "[class]": "hostExtendedClass()" },
|
|
23043
|
-
template: "@let _templates = templates();\n<c-card-body>\n @if (icon() || _templates?.['widgetIconTemplate']) {\n <div [class]=\"iconClasses()\">\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetIconTemplate'] || defaultWidgetIconTemplate\" />\n </div>\n }\n @if (!!value()) {\n <div [class]=\"valueClasses()\">\n {{ value() }}\n </div>\n }\n @if (!!title()) {\n <div [class]=\"titleClasses()\">\n {{ title() }}\n </div>\n }\n @if (_templates?.['widgetProgressTemplate']) {\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetProgressTemplate']
|
|
23152
|
+
template: "@let _templates = templates();\n<c-card-body>\n @if (icon() || _templates?.['widgetIconTemplate']) {\n <div [class]=\"iconClasses()\">\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetIconTemplate'] || defaultWidgetIconTemplate\" />\n </div>\n }\n @if (!!value()) {\n <div [class]=\"valueClasses()\">\n {{ value() }}\n </div>\n }\n @if (!!title()) {\n <div [class]=\"titleClasses()\">\n {{ title() }}\n </div>\n }\n @if (_templates?.['widgetProgressTemplate']) {\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetProgressTemplate']\" />\n }\n</c-card-body>\n\n<ng-template #defaultWidgetIconTemplate>\n {{ icon() }}\n</ng-template>\n"
|
|
23044
23153
|
}]
|
|
23045
23154
|
}],
|
|
23046
23155
|
ctorParameters: () => [],
|
|
@@ -23392,7 +23501,7 @@ var WidgetStatFComponent = class WidgetStatFComponent extends CardComponent {
|
|
|
23392
23501
|
descendants: true,
|
|
23393
23502
|
isSignal: true
|
|
23394
23503
|
}],
|
|
23395
|
-
exportAs: ["cWidgetStatB"],
|
|
23504
|
+
exportAs: ["cWidgetStatF", "cWidgetStatB"],
|
|
23396
23505
|
usesInheritance: true,
|
|
23397
23506
|
ngImport: i0,
|
|
23398
23507
|
template: "@let _templates = templates();\n<ng-container>\n <c-card-body [class]=\"cardBodyClasses()\">\n <div [class]=\"iconClasses()\">\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetIconTemplate'] || defaultWidgetIconTemplate\" />\n </div>\n <div>\n <div [class]=\"valueClasses()\">{{ value() }}</div>\n <div [class]=\"titleClasses()\">{{ title() }}</div>\n </div>\n </c-card-body>\n @if (footer() || _templates?.['widgetFooterTemplate']) {\n <c-card-footer>\n <ng-container *ngTemplateOutlet=\"_templates?.['widgetFooterTemplate'] || defaultFooterIconTemplate\" />\n </c-card-footer>\n }\n</ng-container>\n\n<ng-template #defaultWidgetIconTemplate>\n <span>{{ icon() }}</span>\n</ng-template>\n\n<ng-template #defaultFooterIconTemplate>\n <span>{{ footer() }}</span>\n</ng-template>\n",
|
|
@@ -23429,7 +23538,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
23429
23538
|
type: Component,
|
|
23430
23539
|
args: [{
|
|
23431
23540
|
selector: "c-widget-stat-f",
|
|
23432
|
-
exportAs: "cWidgetStatB",
|
|
23541
|
+
exportAs: "cWidgetStatF, cWidgetStatB",
|
|
23433
23542
|
imports: [
|
|
23434
23543
|
CardBodyComponent,
|
|
23435
23544
|
CardFooterComponent,
|