@coreui/angular-pro 5.7.19 → 5.7.20

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,7 +10,7 @@ import * as i1$2 from '@angular/cdk/a11y';
10
10
  import { FocusKeyManager, FocusMonitor, A11yModule } from '@angular/cdk/a11y';
11
11
  import { createPopper } from '@popperjs/core';
12
12
  import { SelectionModel } from '@angular/cdk/collections';
13
- import { DomPortal, CdkPortalOutlet } from '@angular/cdk/portal';
13
+ import { DomPortal, CdkPortalOutlet, DomPortalOutlet } from '@angular/cdk/portal';
14
14
  import { DomSanitizer } from '@angular/platform-browser';
15
15
  import * as i1$1 from '@angular/router';
16
16
  import { RouterModule, Router, ActivatedRoute, NavigationEnd, RouterLink } from '@angular/router';
@@ -13363,6 +13363,14 @@ class ModalComponent {
13363
13363
  */
13364
13364
  backdrop = input(true, /* @ts-ignore */
13365
13365
  ...(ngDevMode ? [{ debugName: "backdrop" }] : /* istanbul ignore next */ []));
13366
+ /**
13367
+ * 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`.
13368
+ * @since 5.7.20
13369
+ * @returns Element | (() => Element | null) | null
13370
+ * @default document.body
13371
+ */
13372
+ container = input(this.#document.body, /* @ts-ignore */
13373
+ ...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
13366
13374
  /**
13367
13375
  * Set modal to cover the entire user viewport.
13368
13376
  * @returns {boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'}
@@ -13377,13 +13385,20 @@ class ModalComponent {
13377
13385
  */
13378
13386
  keyboard = input(true, { ...(ngDevMode ? { debugName: "keyboard" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
13379
13387
  /**
13380
- * Html id attribute, required for programmatic visibility change.
13388
+ * HTML id attribute, required for programmatic visibility change.
13381
13389
  * @returns string
13382
13390
  */
13383
13391
  attrId = input(undefined, { ...(ngDevMode ? { debugName: "attrId" } : /* istanbul ignore next */ {}), alias: 'id' });
13384
13392
  get id() {
13385
13393
  return this.attrId();
13386
13394
  }
13395
+ /**
13396
+ * Generates modal using a portal
13397
+ * @since 5.7.20
13398
+ * @returns boolean
13399
+ * @default false
13400
+ */
13401
+ portal = input(false, { ...(ngDevMode ? { debugName: "portal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
13387
13402
  /**
13388
13403
  * Size the component small, large, or extra large.
13389
13404
  * @returns {'sm' | 'lg' | 'xl'}
@@ -13426,6 +13441,30 @@ class ModalComponent {
13426
13441
  visibleInput = input(false, { ...(ngDevMode ? { debugName: "visibleInput" } : /* istanbul ignore next */ {}), transform: booleanAttribute, alias: 'visible' });
13427
13442
  visible = linkedSignal(this.visibleInput, /* @ts-ignore */
13428
13443
  ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
13444
+ domPortal = new DomPortal(this.#hostElement.nativeElement);
13445
+ domPortalOutlet;
13446
+ domPortalCleanup = () => {
13447
+ if (this.domPortalOutlet?.hasAttached()) {
13448
+ this.domPortalOutlet.detach();
13449
+ }
13450
+ };
13451
+ #portalEffect = effect(() => {
13452
+ const visible = this.visible();
13453
+ const containerInput = this.container();
13454
+ const portalEnabled = this.portal();
13455
+ untracked(() => {
13456
+ if (!visible) {
13457
+ return;
13458
+ }
13459
+ const container = typeof containerInput === 'function' ? containerInput() : containerInput;
13460
+ this.domPortalCleanup();
13461
+ if (container && portalEnabled) {
13462
+ this.domPortalOutlet = new DomPortalOutlet(container);
13463
+ this.domPortalOutlet.attach(this.domPortal);
13464
+ }
13465
+ });
13466
+ }, /* @ts-ignore */
13467
+ ...(ngDevMode ? [{ debugName: "#portalEffect" }] : /* istanbul ignore next */ []));
13429
13468
  #visibleInputEffect = effect(() => {
13430
13469
  const visible = this.visible();
13431
13470
  untracked(() => {
@@ -13470,9 +13509,6 @@ class ModalComponent {
13470
13509
  * @returns boolean
13471
13510
  */
13472
13511
  visibleChange = output();
13473
- // @ViewChild(ModalContentComponent, { read: ElementRef }) modalContent!: ElementRef;
13474
- // @ViewChild('modalContentRef', { read: ElementRef }) modalContentRef!: ElementRef;
13475
- // readonly modalContentRef = viewChild(ModalContentComponent, { read: ElementRef });
13476
13512
  modalContentRef = viewChild('modalContentRef', { ...(ngDevMode ? { debugName: "modalContentRef" } : /* istanbul ignore next */ {}), read: ElementRef });
13477
13513
  modalDialogRef = viewChild.required(ModalDialogComponent, { ...(ngDevMode ? { debugName: "modalDialogRef" } : /* istanbul ignore next */ {}), read: ElementRef });
13478
13514
  #modalDialogEffect = effect((OnCleanup) => {
@@ -13488,6 +13524,7 @@ class ModalComponent {
13488
13524
  const modalDialogElement = this.modalDialogRef().nativeElement;
13489
13525
  if (event.target === modalDialogElement && event.propertyName === 'transform') {
13490
13526
  if (!this.visible()) {
13527
+ this.domPortalCleanup();
13491
13528
  this.#renderer.setStyle(this.#hostElement.nativeElement, 'display', 'none');
13492
13529
  }
13493
13530
  }
@@ -13521,6 +13558,7 @@ class ModalComponent {
13521
13558
  }
13522
13559
  else {
13523
13560
  if (!this.transition()) {
13561
+ this.domPortalCleanup();
13524
13562
  this.#renderer.setStyle(this.#hostElement.nativeElement, 'display', 'none');
13525
13563
  }
13526
13564
  }
@@ -13568,6 +13606,7 @@ class ModalComponent {
13568
13606
  this.#modalService.toggle({ show: false, modal: this });
13569
13607
  this.#afterViewInit.set(false);
13570
13608
  this.setBackdrop(false);
13609
+ this.domPortalCleanup();
13571
13610
  }
13572
13611
  stateToggleSubscribe() {
13573
13612
  this.#modalService.modalState$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((action) => {
@@ -13609,7 +13648,7 @@ class ModalComponent {
13609
13648
  }
13610
13649
  }
13611
13650
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
13612
- 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$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
13651
+ 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$2.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] });
13613
13652
  }
13614
13653
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalComponent, decorators: [{
13615
13654
  type: Component,
@@ -13626,7 +13665,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
13626
13665
  '(click)': 'onClickHandler($event)',
13627
13666
  '(document:keydown)': 'onKeyDownHandler($event)'
13628
13667
  }, 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" }]
13629
- }], 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 }] }] } });
13668
+ }], 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 }] }] } });
13630
13669
 
13631
13670
  class ModalModule {
13632
13671
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: ModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });