@coreui/angular 5.7.19 → 5.7.21
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.
|
@@ -10,6 +10,7 @@ import { createPopper } from '@popperjs/core';
|
|
|
10
10
|
import * as i1$1 from '@angular/cdk/a11y';
|
|
11
11
|
import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
|
|
12
12
|
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
13
|
+
import { DomPortal, DomPortalOutlet } from '@angular/cdk/portal';
|
|
13
14
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
14
15
|
import { IconDirective } from '@coreui/icons-angular';
|
|
15
16
|
|
|
@@ -5493,6 +5494,14 @@ class ModalComponent {
|
|
|
5493
5494
|
*/
|
|
5494
5495
|
backdrop = input(true, /* @ts-ignore */
|
|
5495
5496
|
...(ngDevMode ? [{ debugName: "backdrop" }] : /* istanbul ignore next */ []));
|
|
5497
|
+
/**
|
|
5498
|
+
* Appends the angular modal to a specific element. You can pass an HTML element or function that returns a single element. By default, `document.body`.
|
|
5499
|
+
* @since 5.7.20
|
|
5500
|
+
* @returns Element | (() => Element | null) | null
|
|
5501
|
+
* @default document.body
|
|
5502
|
+
*/
|
|
5503
|
+
container = input(this.#document.body, /* @ts-ignore */
|
|
5504
|
+
...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
5496
5505
|
/**
|
|
5497
5506
|
* Set modal to cover the entire user viewport.
|
|
5498
5507
|
* @returns {boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'}
|
|
@@ -5507,13 +5516,20 @@ class ModalComponent {
|
|
|
5507
5516
|
*/
|
|
5508
5517
|
keyboard = input(true, { ...(ngDevMode ? { debugName: "keyboard" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5509
5518
|
/**
|
|
5510
|
-
*
|
|
5519
|
+
* HTML id attribute, required for programmatic visibility change.
|
|
5511
5520
|
* @returns string
|
|
5512
5521
|
*/
|
|
5513
5522
|
attrId = input(undefined, { ...(ngDevMode ? { debugName: "attrId" } : /* istanbul ignore next */ {}), alias: 'id' });
|
|
5514
5523
|
get id() {
|
|
5515
5524
|
return this.attrId();
|
|
5516
5525
|
}
|
|
5526
|
+
/**
|
|
5527
|
+
* Generates modal using a portal
|
|
5528
|
+
* @since 5.7.20
|
|
5529
|
+
* @returns boolean
|
|
5530
|
+
* @default false
|
|
5531
|
+
*/
|
|
5532
|
+
portal = input(false, { ...(ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5517
5533
|
/**
|
|
5518
5534
|
* Size the component small, large, or extra large.
|
|
5519
5535
|
* @returns {'sm' | 'lg' | 'xl'}
|
|
@@ -5556,6 +5572,30 @@ class ModalComponent {
|
|
|
5556
5572
|
visibleInput = input(false, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
|
|
5557
5573
|
visible = linkedSignal(this.visibleInput, /* @ts-ignore */
|
|
5558
5574
|
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
5575
|
+
domPortal = new DomPortal(this.#hostElement.nativeElement);
|
|
5576
|
+
domPortalOutlet;
|
|
5577
|
+
domPortalCleanup = () => {
|
|
5578
|
+
if (this.domPortalOutlet?.hasAttached()) {
|
|
5579
|
+
this.domPortalOutlet.detach();
|
|
5580
|
+
}
|
|
5581
|
+
};
|
|
5582
|
+
#portalEffect = effect(() => {
|
|
5583
|
+
const visible = this.visible();
|
|
5584
|
+
const containerInput = this.container();
|
|
5585
|
+
const portalEnabled = this.portal();
|
|
5586
|
+
untracked(() => {
|
|
5587
|
+
if (!visible) {
|
|
5588
|
+
return;
|
|
5589
|
+
}
|
|
5590
|
+
const container = typeof containerInput === 'function' ? containerInput() : containerInput;
|
|
5591
|
+
this.domPortalCleanup();
|
|
5592
|
+
if (container && portalEnabled) {
|
|
5593
|
+
this.domPortalOutlet = new DomPortalOutlet(container);
|
|
5594
|
+
this.domPortalOutlet.attach(this.domPortal);
|
|
5595
|
+
}
|
|
5596
|
+
});
|
|
5597
|
+
}, /* @ts-ignore */
|
|
5598
|
+
...(ngDevMode ? [{ debugName: "#portalEffect" }] : /* istanbul ignore next */ []));
|
|
5559
5599
|
#visibleInputEffect = effect(() => {
|
|
5560
5600
|
const visible = this.visible();
|
|
5561
5601
|
untracked(() => {
|
|
@@ -5600,9 +5640,6 @@ class ModalComponent {
|
|
|
5600
5640
|
* @returns boolean
|
|
5601
5641
|
*/
|
|
5602
5642
|
visibleChange = output();
|
|
5603
|
-
// @ViewChild(ModalContentComponent, { read: ElementRef }) modalContent!: ElementRef;
|
|
5604
|
-
// @ViewChild('modalContentRef', { read: ElementRef }) modalContentRef!: ElementRef;
|
|
5605
|
-
// readonly modalContentRef = viewChild(ModalContentComponent, { read: ElementRef });
|
|
5606
5643
|
modalContentRef = viewChild('modalContentRef', { ...(ngDevMode ? { debugName: "modalContentRef" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
5607
5644
|
modalDialogRef = viewChild.required(ModalDialogComponent, { ...(ngDevMode ? { debugName: "modalDialogRef" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
5608
5645
|
#modalDialogEffect = effect((OnCleanup) => {
|
|
@@ -5618,6 +5655,7 @@ class ModalComponent {
|
|
|
5618
5655
|
const modalDialogElement = this.modalDialogRef().nativeElement;
|
|
5619
5656
|
if (event.target === modalDialogElement && event.propertyName === 'transform') {
|
|
5620
5657
|
if (!this.visible()) {
|
|
5658
|
+
this.domPortalCleanup();
|
|
5621
5659
|
this.#renderer.setStyle(this.#hostElement.nativeElement, 'display', 'none');
|
|
5622
5660
|
}
|
|
5623
5661
|
}
|
|
@@ -5651,6 +5689,7 @@ class ModalComponent {
|
|
|
5651
5689
|
}
|
|
5652
5690
|
else {
|
|
5653
5691
|
if (!this.transition()) {
|
|
5692
|
+
this.domPortalCleanup();
|
|
5654
5693
|
this.#renderer.setStyle(this.#hostElement.nativeElement, 'display', 'none');
|
|
5655
5694
|
}
|
|
5656
5695
|
}
|
|
@@ -5698,6 +5737,7 @@ class ModalComponent {
|
|
|
5698
5737
|
this.#modalService.toggle({ show: false, modal: this });
|
|
5699
5738
|
this.#afterViewInit.set(false);
|
|
5700
5739
|
this.setBackdrop(false);
|
|
5740
|
+
this.domPortalCleanup();
|
|
5701
5741
|
}
|
|
5702
5742
|
stateToggleSubscribe() {
|
|
5703
5743
|
this.#modalService.modalState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((action) => {
|
|
@@ -5739,7 +5779,7 @@ class ModalComponent {
|
|
|
5739
5779
|
}
|
|
5740
5780
|
}
|
|
5741
5781
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5742
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, fullscreen: { classPropertyName: "fullscreen", publicName: "fullscreen", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, attrId: { classPropertyName: "attrId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModalInput: { classPropertyName: "ariaModalInput", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "class": "hostClasses()", "attr.role": "visible() ? role() : null", "attr.inert": "ariaHidden()", "attr.id": "id", "attr.aria-modal": "ariaModal()", "attr.aria-hidden": "ariaHidden()", "attr.tabindex": "-1" }, classAttribute: "modal" }, viewQueries: [{ propertyName: "modalContentRef", first: true, predicate: ["modalContentRef"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "modalDialogRef", first: true, predicate: ModalDialogComponent, descendants: true, read: ElementRef, isSignal: true }], exportAs: ["cModal"], ngImport: i0, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <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$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
|
|
5782
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: ModalComponent, isStandalone: true, selector: "c-modal", inputs: { alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, fullscreen: { classPropertyName: "fullscreen", publicName: "fullscreen", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, attrId: { classPropertyName: "attrId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, portal: { classPropertyName: "portal", publicName: "portal", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, transition: { classPropertyName: "transition", publicName: "transition", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModalInput: { classPropertyName: "ariaModalInput", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scrollable: { classPropertyName: "scrollable", publicName: "scrollable", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "mousedown": "onMouseDownHandler($event)", "click": "onClickHandler($event)", "document:keydown": "onKeyDownHandler($event)" }, properties: { "class": "hostClasses()", "attr.role": "visible() ? role() : null", "attr.inert": "ariaHidden()", "attr.id": "id", "attr.aria-modal": "ariaModal()", "attr.aria-hidden": "ariaHidden()", "attr.tabindex": "-1" }, classAttribute: "modal" }, viewQueries: [{ propertyName: "modalContentRef", first: true, predicate: ["modalContentRef"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "modalDialogRef", first: true, predicate: ModalDialogComponent, descendants: true, read: ElementRef, isSignal: true }], exportAs: ["cModal"], ngImport: i0, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <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$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
|
|
5743
5783
|
}
|
|
5744
5784
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalComponent, decorators: [{
|
|
5745
5785
|
type: Component,
|
|
@@ -5756,7 +5796,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
5756
5796
|
'(click)': 'onClickHandler($event)',
|
|
5757
5797
|
'(document:keydown)': 'onKeyDownHandler($event)'
|
|
5758
5798
|
}, template: "@let isVisible = visible();\n<c-modal-dialog\n [alignment]=\"alignment()\"\n [fullscreen]=\"fullscreen()\"\n [scrollable]=\"scrollable()\"\n [size]=\"size()\">\n <c-modal-content>\n <div #modalContentRef [cdkTrapFocusAutoCapture]=\"isVisible\" [cdkTrapFocus]=\"isVisible\" style=\"display: contents;\">\n <ng-content />\n </div>\n </c-modal-content>\n</c-modal-dialog>\n" }]
|
|
5759
|
-
}], propDecorators: { alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], backdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "backdrop", required: false }] }], fullscreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullscreen", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], attrId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaModalInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaModal", required: false }] }], scrollable: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollable", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], modalContentRef: [{ type: i0.ViewChild, args: ['modalContentRef', { ...{ read: ElementRef }, isSignal: true }] }], modalDialogRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ModalDialogComponent), { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
5799
|
+
}], propDecorators: { alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], backdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "backdrop", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], fullscreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullscreen", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], attrId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], portal: [{ type: i0.Input, args: [{ isSignal: true, alias: "portal", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], transition: [{ type: i0.Input, args: [{ isSignal: true, alias: "transition", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaModalInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaModal", required: false }] }], scrollable: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollable", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }], modalContentRef: [{ type: i0.ViewChild, args: ['modalContentRef', { ...{ read: ElementRef }, isSignal: true }] }], modalDialogRef: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ModalDialogComponent), { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
5760
5800
|
|
|
5761
5801
|
class ModalModule {
|
|
5762
5802
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -5842,6 +5882,14 @@ class OffcanvasComponent {
|
|
|
5842
5882
|
*/
|
|
5843
5883
|
backdrop = input(true, /* @ts-ignore */
|
|
5844
5884
|
...(ngDevMode ? [{ debugName: "backdrop" }] : /* istanbul ignore next */ []));
|
|
5885
|
+
/**
|
|
5886
|
+
* Appends the offcanvas to a specific element. You can pass an HTML element or function that returns a single element. By default, `document.body`.
|
|
5887
|
+
* @since 5.7.21
|
|
5888
|
+
* @returns Element | (() => Element | null) | null
|
|
5889
|
+
* @default document.body
|
|
5890
|
+
*/
|
|
5891
|
+
container = input(this.#document.body, /* @ts-ignore */
|
|
5892
|
+
...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
5845
5893
|
/**
|
|
5846
5894
|
* Closes the offcanvas when the escape key is pressed
|
|
5847
5895
|
* @returns boolean
|
|
@@ -5855,6 +5903,13 @@ class OffcanvasComponent {
|
|
|
5855
5903
|
*/
|
|
5856
5904
|
placement = input('start', /* @ts-ignore */
|
|
5857
5905
|
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
5906
|
+
/**
|
|
5907
|
+
* Generates offcanvas using a portal
|
|
5908
|
+
* @since 5.7.21
|
|
5909
|
+
* @returns boolean
|
|
5910
|
+
* @default false
|
|
5911
|
+
*/
|
|
5912
|
+
portal = input(false, { ...(ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5858
5913
|
/**
|
|
5859
5914
|
* Responsive offcanvas property hides content outside the viewport from a specified breakpoint and down.
|
|
5860
5915
|
* @returns boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
@@ -5885,6 +5940,8 @@ class OffcanvasComponent {
|
|
|
5885
5940
|
#activeBackdrop;
|
|
5886
5941
|
#backdropClickSubscription;
|
|
5887
5942
|
#layoutChangeSubscription;
|
|
5943
|
+
#hideFallbackId;
|
|
5944
|
+
#isShown = false;
|
|
5888
5945
|
/**
|
|
5889
5946
|
* Allow body scrolling while offcanvas is visible.
|
|
5890
5947
|
* @returns boolean
|
|
@@ -5899,6 +5956,33 @@ class OffcanvasComponent {
|
|
|
5899
5956
|
visibleInput = input(false, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
|
|
5900
5957
|
visible = linkedSignal({ ...(ngDevMode ? { debugName: "visible" } : /* istanbul ignore next */ {}), source: this.visibleInput,
|
|
5901
5958
|
computation: (value) => value });
|
|
5959
|
+
domPortal = new DomPortal(this.#hostElement.nativeElement);
|
|
5960
|
+
domPortalOutlet;
|
|
5961
|
+
domPortalCleanup = () => {
|
|
5962
|
+
if (this.domPortalOutlet?.hasAttached()) {
|
|
5963
|
+
this.domPortalOutlet.detach();
|
|
5964
|
+
}
|
|
5965
|
+
};
|
|
5966
|
+
#portalEffect = effect(() => {
|
|
5967
|
+
const visible = this.visible();
|
|
5968
|
+
const containerInput = this.container();
|
|
5969
|
+
const portalEnabled = this.portal();
|
|
5970
|
+
untracked(() => {
|
|
5971
|
+
if (!visible) {
|
|
5972
|
+
return;
|
|
5973
|
+
}
|
|
5974
|
+
const container = typeof containerInput === 'function' ? containerInput() : containerInput;
|
|
5975
|
+
this.domPortalCleanup();
|
|
5976
|
+
if (container && portalEnabled) {
|
|
5977
|
+
this.domPortalOutlet = new DomPortalOutlet(container);
|
|
5978
|
+
this.domPortalOutlet.attach(this.domPortal);
|
|
5979
|
+
// Re-inserting the host drops its computed style, so the show classes applied later in
|
|
5980
|
+
// this same cycle would have no starting point to animate from. Force a reflow to commit it.
|
|
5981
|
+
void this.#hostElement.nativeElement.offsetHeight;
|
|
5982
|
+
}
|
|
5983
|
+
});
|
|
5984
|
+
}, /* @ts-ignore */
|
|
5985
|
+
...(ngDevMode ? [{ debugName: "#portalEffect" }] : /* istanbul ignore next */ []));
|
|
5902
5986
|
visibleEffect = effect(() => {
|
|
5903
5987
|
const visible = this.visible();
|
|
5904
5988
|
this.animateStart(visible);
|
|
@@ -5955,6 +6039,9 @@ class OffcanvasComponent {
|
|
|
5955
6039
|
return breakpointValue ? `${parseFloat(breakpointValue.trim()) - 0.02}px` : false;
|
|
5956
6040
|
}
|
|
5957
6041
|
animateStart(visible = this.visible()) {
|
|
6042
|
+
const wasShown = this.#isShown;
|
|
6043
|
+
this.#isShown = visible;
|
|
6044
|
+
this.#clearHideFallback();
|
|
5958
6045
|
if (visible) {
|
|
5959
6046
|
if (!this.scroll()) {
|
|
5960
6047
|
this.#backdropService.hideScrollbar();
|
|
@@ -5965,6 +6052,9 @@ class OffcanvasComponent {
|
|
|
5965
6052
|
else {
|
|
5966
6053
|
this.#renderer.removeClass(this.#hostElement.nativeElement, 'showing');
|
|
5967
6054
|
this.#renderer.addClass(this.#hostElement.nativeElement, 'hiding');
|
|
6055
|
+
if (wasShown) {
|
|
6056
|
+
this.#scheduleHideFallback();
|
|
6057
|
+
}
|
|
5968
6058
|
}
|
|
5969
6059
|
}
|
|
5970
6060
|
onKeyDownHandler(event) {
|
|
@@ -5983,6 +6073,8 @@ class OffcanvasComponent {
|
|
|
5983
6073
|
ngOnDestroy() {
|
|
5984
6074
|
this.#offcanvasService.toggle({ show: false, id: this.id() });
|
|
5985
6075
|
this.#removeEventListeners();
|
|
6076
|
+
this.#clearHideFallback();
|
|
6077
|
+
this.domPortalCleanup();
|
|
5986
6078
|
}
|
|
5987
6079
|
#removeEventListeners = () => {
|
|
5988
6080
|
this.#hostElement.nativeElement.removeEventListener('transitionend', this.#handleTransitionEnd);
|
|
@@ -5994,12 +6086,30 @@ class OffcanvasComponent {
|
|
|
5994
6086
|
this.#renderer.removeClass(offcanvasElement, 'showing');
|
|
5995
6087
|
}
|
|
5996
6088
|
else {
|
|
5997
|
-
this.#
|
|
5998
|
-
this.#renderer.removeStyle(this.#document.body, 'overflow');
|
|
5999
|
-
this.#renderer.removeStyle(this.#document.body, 'paddingRight');
|
|
6089
|
+
this.#completeHide();
|
|
6000
6090
|
}
|
|
6001
6091
|
}
|
|
6002
6092
|
};
|
|
6093
|
+
#completeHide() {
|
|
6094
|
+
this.#clearHideFallback();
|
|
6095
|
+
this.#renderer.removeClass(this.#hostElement.nativeElement, 'hiding');
|
|
6096
|
+
this.#renderer.removeStyle(this.#document.body, 'overflow');
|
|
6097
|
+
this.#renderer.removeStyle(this.#document.body, 'paddingRight');
|
|
6098
|
+
this.domPortalCleanup();
|
|
6099
|
+
}
|
|
6100
|
+
// `transitionend` never fires when there is nothing to animate — reduced motion, or a responsive
|
|
6101
|
+
// offcanvas above its breakpoint — which would leave the body scroll-locked and the host parked
|
|
6102
|
+
// in the portal container.
|
|
6103
|
+
#scheduleHideFallback() {
|
|
6104
|
+
const style = this.#document.defaultView?.getComputedStyle(this.#hostElement.nativeElement);
|
|
6105
|
+
const duration = Number.parseFloat(style?.transitionDuration ?? '') || 0;
|
|
6106
|
+
const delay = Number.parseFloat(style?.transitionDelay ?? '') || 0;
|
|
6107
|
+
this.#hideFallbackId = setTimeout(() => this.#completeHide(), (duration + delay) * 1000 + 5);
|
|
6108
|
+
}
|
|
6109
|
+
#clearHideFallback() {
|
|
6110
|
+
clearTimeout(this.#hideFallbackId);
|
|
6111
|
+
this.#hideFallbackId = undefined;
|
|
6112
|
+
}
|
|
6003
6113
|
setFocus() {
|
|
6004
6114
|
if (isPlatformBrowser(this.#platformId)) {
|
|
6005
6115
|
setTimeout(() => this.#hostElement.nativeElement.focus());
|
|
@@ -6050,12 +6160,11 @@ class OffcanvasComponent {
|
|
|
6050
6160
|
}
|
|
6051
6161
|
}
|
|
6052
6162
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: OffcanvasComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
6053
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModal: { classPropertyName: "ariaModal", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scroll: { classPropertyName: "scroll", publicName: "scroll", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: {
|
|
6163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.3", type: OffcanvasComponent, isStandalone: true, selector: "c-offcanvas", inputs: { backdrop: { classPropertyName: "backdrop", publicName: "backdrop", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, portal: { classPropertyName: "portal", publicName: "portal", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaModal: { classPropertyName: "ariaModal", publicName: "ariaModal", isSignal: true, isRequired: false, transformFunction: null }, scroll: { classPropertyName: "scroll", publicName: "scroll", isSignal: true, isRequired: false, transformFunction: null }, visibleInput: { classPropertyName: "visibleInput", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visibleChange: "visibleChange" }, host: { listeners: { "document:keydown": "onKeyDownHandler($event)" }, properties: { "attr.id": "id()", "attr.inert": "ariaHidden() || null", "attr.role": "role()", "attr.aria-modal": "ariaModal()", "attr.tabindex": "tabIndex", "class": "hostClasses()" } }, exportAs: ["cOffcanvas"], hostDirectives: [{ directive: ThemeDirective, inputs: ["dark", "dark"] }], ngImport: i0, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content />\n</div>\n\n", styles: [":host{display:none}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
|
|
6054
6164
|
}
|
|
6055
6165
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: OffcanvasComponent, decorators: [{
|
|
6056
6166
|
type: Component,
|
|
6057
6167
|
args: [{ selector: 'c-offcanvas', exportAs: 'cOffcanvas', imports: [A11yModule], hostDirectives: [{ directive: ThemeDirective, inputs: ['dark'] }], host: {
|
|
6058
|
-
ngSkipHydration: 'true',
|
|
6059
6168
|
'[attr.id]': 'id()',
|
|
6060
6169
|
'[attr.inert]': 'ariaHidden() || null',
|
|
6061
6170
|
'[attr.role]': 'role()',
|
|
@@ -6064,7 +6173,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
6064
6173
|
'[class]': 'hostClasses()',
|
|
6065
6174
|
'(document:keydown)': 'onKeyDownHandler($event)'
|
|
6066
6175
|
}, template: "<div cdkTrapFocus cdkTrapFocusAutoCapture>\n <ng-content />\n</div>\n\n", styles: [":host{display:none}\n"] }]
|
|
6067
|
-
}], propDecorators: { backdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "backdrop", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaModal", required: false }] }], scroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "scroll", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }] } });
|
|
6176
|
+
}], propDecorators: { backdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "backdrop", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], portal: [{ type: i0.Input, args: [{ isSignal: true, alias: "portal", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaModal: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaModal", required: false }] }], scroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "scroll", required: false }] }], visibleInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], visibleChange: [{ type: i0.Output, args: ["visibleChange"] }] } });
|
|
6068
6177
|
|
|
6069
6178
|
class OffcanvasBodyComponent {
|
|
6070
6179
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: OffcanvasBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|