@skyux/modals 5.5.0 → 5.6.0
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/bundles/skyux-modals.umd.js +25 -25
- package/documentation.json +65 -65
- package/esm2015/lib/modules/confirm/confirm-config.js.map +1 -1
- package/esm2015/lib/modules/confirm/confirm-modal-context.js.map +1 -1
- package/esm2015/lib/modules/confirm/confirm.component.js +1 -1
- package/esm2015/lib/modules/confirm/confirm.component.js.map +1 -1
- package/esm2015/lib/modules/confirm/confirm.module.js +1 -1
- package/esm2015/lib/modules/confirm/confirm.module.js.map +1 -1
- package/esm2015/lib/modules/confirm/confirm.service.js +1 -1
- package/esm2015/lib/modules/confirm/confirm.service.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-component-adapter.service.js +11 -11
- package/esm2015/lib/modules/modal/modal-component-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-host.component.js +3 -3
- package/esm2015/lib/modules/modal/modal-host.component.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-host.service.js +1 -1
- package/esm2015/lib/modules/modal/modal-host.service.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-instance.js +1 -1
- package/esm2015/lib/modules/modal/modal-instance.js.map +1 -1
- package/esm2015/lib/modules/modal/modal-scroll-shadow.directive.js +3 -3
- package/esm2015/lib/modules/modal/modal-scroll-shadow.directive.js.map +1 -1
- package/esm2015/lib/modules/modal/modal.component.js +6 -6
- package/esm2015/lib/modules/modal/modal.component.js.map +1 -1
- package/esm2015/lib/modules/modal/modal.module.js +1 -1
- package/esm2015/lib/modules/modal/modal.module.js.map +1 -1
- package/esm2015/lib/modules/modal/modal.service.js +4 -4
- package/esm2015/lib/modules/modal/modal.service.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-modals-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-modals-resources.module.js.map +1 -1
- package/fesm2015/skyux-modals.js +42 -42
- package/fesm2015/skyux-modals.js.map +1 -1
- package/lib/modules/confirm/confirm-config.d.ts +1 -1
- package/lib/modules/modal/modal-instance.d.ts +1 -1
- package/lib/modules/modal/modal-scroll-shadow.directive.d.ts +1 -1
- package/lib/modules/modal/modal.component.d.ts +2 -2
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"confirm.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,eAAe,EAAc,GAAG,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;;;;;;;;;AAOhD,MAAM,OAAO,mBAAmB;IAM9B,YACU,MAA8B,EAC9B,KAAuB,EACX,gBAAwC;QAFpD,WAAM,GAAN,MAAM,CAAwB;QAC9B,UAAK,GAAL,KAAK,CAAkB;QACX,qBAAgB,GAAhB,gBAAgB,CAAwB;QALvD,uBAAkB,GAAG,KAAK,CAAC;IAM/B,CAAC;IAEG,QAAQ;QACb,IACE,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc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CAAC;IAEO,gBAAgB,CACtB,YAAsC;QAEtC,MAAM,OAAO,GAAuB,EAAE,CAAC;QAEvC,YAAY,CAAC,OAAO,CAAC,CAAC,MAA8B,EAAE,EAAE;YACtD,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,SAAS;gBACxC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,KAAK;aACjB,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;;iHAtIU,mBAAmB;qGAAnB,mBAAmB,mDClBhC,iwCA6CA;4FD3Ba,mBAAmB;kBAL/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,WAAW,EAAE,0BAA0B;oBACvC,SAAS,EAAE,CAAC,0BAA0B,CAAC;iBACxC;;0BAUI,QAAQ","sourcesContent":["import { Component, OnInit, Optional } from '@angular/core';\nimport { SkyLibResourcesService } from '@skyux/i18n';\n\nimport { BehaviorSubject, Observable, zip as observableZip } from 'rxjs';\n\nimport { SkyModalInstance } from '../modal/modal-instance';\n\nimport { SkyConfirmButton } from './confirm-button';\nimport { SkyConfirmButtonConfig } from './confirm-button-config';\nimport { SkyConfirmCloseEventArgs } from './confirm-closed-event-args';\nimport { SkyConfirmModalContext } from './confirm-modal-context';\nimport { SkyConfirmType } from './confirm-type';\n\n@Component({\n selector: 'sky-confirm',\n templateUrl: './confirm.component.html',\n styleUrls: ['./confirm.component.scss'],\n})\nexport class SkyConfirmComponent implements OnInit {\n public buttons: SkyConfirmButton[];\n public message: string;\n public body: string;\n public preserveWhiteSpace = false;\n\n constructor(\n private config: SkyConfirmModalContext,\n private modal: SkyModalInstance,\n @Optional() private resourcesService: SkyLibResourcesService\n ) {}\n\n public ngOnInit() {\n if (\n this.config.type === SkyConfirmType.Custom &&\n this.config.buttons.length > 0\n ) {\n this.buttons = this.getCustomButtons(this.config.buttons);\n } else {\n this.getPresetButtons().subscribe((buttons: SkyConfirmButton[]) => {\n this.buttons = buttons;\n });\n }\n\n this.message = this.config.message;\n this.body = this.config.body;\n this.preserveWhiteSpace = this.config.preserveWhiteSpace || false;\n }\n\n public close(button: SkyConfirmButton) {\n const result: SkyConfirmCloseEventArgs = {\n action: button.action,\n };\n\n this.modal.close(result);\n }\n\n private getPresetButtons(): Observable<SkyConfirmButton[]> {\n const emitter = new BehaviorSubject<SkyConfirmButton[]>([]);\n\n switch (this.config.type) {\n default:\n case SkyConfirmType.OK:\n this.resourcesService\n .getString('skyux_confirm_dialog_default_ok_text')\n .subscribe((value: string) => {\n emitter.next([\n {\n text: value,\n autofocus: true,\n styleType: 'primary',\n action: 'ok',\n },\n ]);\n });\n break;\n\n case SkyConfirmType.YesNoCancel:\n observableZip(\n this.resourcesService.getString(\n 'skyux_confirm_dialog_default_yes_text'\n ),\n this.resourcesService.getString(\n 'skyux_confirm_dialog_default_no_text'\n ),\n this.resourcesService.getString(\n 'skyux_confirm_dialog_default_cancel_text'\n )\n ).subscribe((values: any) => {\n emitter.next([\n {\n text: values[0],\n autofocus: true,\n styleType: 'primary',\n action: 'yes',\n },\n {\n text: values[1],\n styleType: 'default',\n action: 'no',\n },\n {\n text: values[2],\n styleType: 'link',\n action: 'cancel',\n },\n ]);\n });\n break;\n\n case SkyConfirmType.YesCancel:\n observableZip(\n this.resourcesService.getString(\n 'skyux_confirm_dialog_default_yes_text'\n ),\n this.resourcesService.getString(\n 'skyux_confirm_dialog_default_cancel_text'\n )\n ).subscribe((values: any) => {\n emitter.next([\n {\n text: values[0],\n autofocus: true,\n styleType: 'primary',\n action: 'yes',\n },\n {\n text: values[1],\n styleType: 'link',\n action: 'cancel',\n },\n ]);\n });\n break;\n }\n\n return emitter;\n }\n\n private getCustomButtons(\n buttonConfig: SkyConfirmButtonConfig[]\n ): SkyConfirmButton[] {\n const buttons: SkyConfirmButton[] = [];\n\n buttonConfig.forEach((config: SkyConfirmButtonConfig) => {\n buttons.push({\n text: config.text,\n action: config.action,\n styleType: config.styleType || 'default',\n autofocus: config.autofocus || false,\n } as SkyConfirmButton);\n });\n\n return buttons;\n }\n}\n","<div class=\"sky-confirm\">\n <sky-modal ariaRole=\"alertdialog\">\n <sky-modal-content class=\"sky-confirm-content\">\n <div\n class=\"sky-confirm-message\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n [skyThemeClass]=\"{\n 'sky-emphasized': 'default',\n 'sky-font-heading-1 sky-font-display-3': 'modern'\n }\"\n >\n {{ message }}\n </div>\n\n <div\n *ngIf=\"body\"\n class=\"sky-confirm-body\"\n [ngClass]=\"{\n 'sky-confirm-preserve-white-space': preserveWhiteSpace\n }\"\n >\n {{ body }}\n </div>\n\n <div class=\"sky-confirm-buttons\">\n <button\n *ngFor=\"let button of buttons\"\n type=\"button\"\n class=\"sky-btn\"\n [ngClass]=\"['sky-btn-' + button.styleType]\"\n [skyThemeClass]=\"{\n 'sky-margin-inline-sm': 'modern',\n 'sky-margin-inline-compact': 'default'\n }\"\n (click)=\"close(button)\"\n [attr.autofocus]=\"button.autofocus ? 'autofocus' : null\"\n >\n {{ button.text }}\n </button>\n </div>\n </sky-modal-content>\n </sky-modal>\n</div>\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
1
|
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
3
|
import { SkyThemeModule } from '@skyux/theme';
|
|
4
4
|
import { SkyModalModule } from '../modal/modal.module';
|
|
5
5
|
import { SkyModalsResourcesModule } from '../shared/sky-modals-resources.module';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"confirm.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;;AAa1D,MAAM,OAAO,gBAAgB;;8GAAhB,gBAAgB;+GAAhB,gBAAgB,iBAVZ,mBAAmB,aAEhC,YAAY;QACZ,cAAc;QACd,wBAAwB;QACxB,cAAc,aAEN,mBAAmB;+GAGlB,gBAAgB,YATlB;YACP,YAAY;YACZ,cAAc;YACd,wBAAwB;YACxB,cAAc;SACf;4FAIU,gBAAgB;kBAX5B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,mBAAmB,CAAC;oBACnC,OAAO,EAAE;wBACP,YAAY;wBACZ,cAAc;wBACd,wBAAwB;wBACxB,cAAc;qBACf;oBACD,OAAO,EAAE,CAAC,mBAAmB,CAAC;oBAC9B,eAAe,EAAE,CAAC,mBAAmB,CAAC;iBACvC","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyModalModule } from '../modal/modal.module';\nimport { SkyModalsResourcesModule } from '../shared/sky-modals-resources.module';\n\nimport { SkyConfirmComponent } from './confirm.component';\n\n@NgModule({\n declarations: [SkyConfirmComponent],\n imports: [\n CommonModule,\n SkyModalModule,\n SkyModalsResourcesModule,\n SkyThemeModule,\n ],\n exports: [SkyConfirmComponent],\n entryComponents: [SkyConfirmComponent],\n})\nexport class SkyConfirmModule {}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { SkyModalService } from '../modal/modal.service';
|
|
3
|
+
import { SkyConfirmInstance } from './confirm-instance';
|
|
3
4
|
import { SkyConfirmModalContext } from './confirm-modal-context';
|
|
4
5
|
import { SkyConfirmComponent } from './confirm.component';
|
|
5
|
-
import { SkyConfirmInstance } from './confirm-instance';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
import * as i1 from "../modal/modal.service";
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"confirm.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/confirm/confirm.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;;;AAE1D;;;GAGG;AAOH,MAAM,OAAO,iBAAiB;IAC5B,YAAoB,YAA6B;QAA7B,iBAAY,GAAZ,YAAY,CAAiB;IAAG,CAAC;IAErD;;;OAGG;IACI,IAAI,CAAC,MAAwB;QAClC,MAAM,aAAa,GAAqB,IAAI,CAAC,YAAY,CAAC,IAAI,CAC5D,mBAAmB,EACnB;YACE,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,QAAQ,EAAE,MAAM;iBACjB;aACF;SACF,CACF,CAAC;QAEF,MAAM,eAAe,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAEjD,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAuB,EAAE,EAAE;YACzD,IAAI,MAAM,GAA6B,IAAI,CAAC,IAAI,CAAC;YAEjD,0CAA0C;YAC1C,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,MAAM,GAAG;oBACP,MAAM,EAAE,QAAQ;iBACjB,CAAC;aACH;YAED,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpC,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACzB,CAAC;;+GArCU,iBAAiB;mHAAjB,iBAAiB,cAFhB,KAAK;4FAEN,iBAAiB;kBAN7B,UAAU;mBAAC;oBACV,gGAAgG;oBAChG,8FAA8F;oBAC9F,2FAA2F;oBAC3F,UAAU,EAAE,KAAK;iBAClB","sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { SkyModalCloseArgs } from '../modal/modal-close-args';\nimport { SkyModalInstance } from '../modal/modal-instance';\nimport { SkyModalService } from '../modal/modal.service';\n\nimport { SkyConfirmCloseEventArgs } from './confirm-closed-event-args';\nimport { SkyConfirmConfig } from './confirm-config';\nimport { SkyConfirmInstance } from './confirm-instance';\nimport { SkyConfirmModalContext } from './confirm-modal-context';\nimport { SkyConfirmComponent } from './confirm.component';\n\n/**\n * The `SkyConfirmService` provider launches the confirmation dialog.\n * Within the service, you can specify the dialog's message and customize the button text.\n */\n@Injectable({\n // Must be 'any' so that the modal component is created in the context of its module's injector.\n // If set to 'root', the component's dependency injections would only be derived from the root\n // injector and may loose context if the modal was opened from within a lazy-loaded module.\n providedIn: 'any',\n})\nexport class SkyConfirmService {\n constructor(private modalService: SkyModalService) {}\n\n /**\n * Opens a confirmation dialog and passes the `config` parameter of type `SkyConfirmConfig`\n * to the component's constructor. This method returns an object of type `SkyConfirmInstance`.\n */\n public open(config: SkyConfirmConfig): SkyConfirmInstance {\n const modalInstance: SkyModalInstance = this.modalService.open(\n SkyConfirmComponent,\n {\n providers: [\n {\n provide: SkyConfirmModalContext,\n useValue: config,\n },\n ],\n }\n );\n\n const confirmInstance = new SkyConfirmInstance();\n\n modalInstance.closed.subscribe((args: SkyModalCloseArgs) => {\n let result: SkyConfirmCloseEventArgs = args.data;\n\n // The modal was closed using the ESC key.\n if (result === undefined) {\n result = {\n action: 'cancel',\n };\n }\n\n confirmInstance.closed.emit(result);\n confirmInstance.closed.complete();\n });\n\n return confirmInstance;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"modal-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;;;AAE9C;;GAEG;AAEH,MAAM,OAAO,sBAAsB;IAOjC,YAAoB,SAA0B;QAA1B,cAAS,GAAT,SAAS,CAAiB;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC1D,CAAC;IAEM,wBAAwB,CAAC,SAAkB;QAChD,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;SACnE;aAAM;YACL,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;SACxE;IACH,CAAC;IAEM,aAAa,CAAC,KAAc;QACjC,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;SAC9D;aAAM;YACL,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;SACnE;IACH,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IACnC,CAAC;IAEO,cAAc,CAAC,SAAiB;QACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAEO,mBAAmB,CAAC,SAAiB;QAC3C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;;AArCuB,4CAAqB,GAAG,0BAA0B,CAAC;AACnD,uCAAgB,GAAG,qBAAqB,CAAC;oHAFtD,sBAAsB;wHAAtB,sBAAsB;4FAAtB,sBAAsB;kBADlC,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\nimport { SkyAppWindowRef } from '@skyux/core';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyModalAdapterService {\n private static readonly MODAL_BODY_FULL_CLASS = 'sky-modal-body-full-page';\n private static readonly MODAL_BODY_CLASS = 'sky-modal-body-open';\n\n private docRef: any;\n private bodyEl: HTMLElement;\n\n constructor(private windowRef: SkyAppWindowRef) {\n this.docRef = this.windowRef.nativeWindow.document;\n this.bodyEl = this.windowRef.nativeWindow.document.body;\n }\n\n public toggleFullPageModalClass(isAddFull: boolean): void {\n if (isAddFull) {\n this.addClassToBody(SkyModalAdapterService.MODAL_BODY_FULL_CLASS);\n } else {\n this.removeClassFromBody(SkyModalAdapterService.MODAL_BODY_FULL_CLASS);\n }\n }\n\n public setPageScroll(isAdd: boolean): void {\n if (isAdd) {\n this.addClassToBody(SkyModalAdapterService.MODAL_BODY_CLASS);\n } else {\n this.removeClassFromBody(SkyModalAdapterService.MODAL_BODY_CLASS);\n }\n }\n\n public getModalOpener(): HTMLElement {\n return this.docRef.activeElement;\n }\n\n private addClassToBody(className: string): void {\n this.bodyEl.classList.add(className);\n }\n\n private removeClassFromBody(className: string): void {\n this.bodyEl.classList.remove(className);\n }\n}\n"]}
|
|
@@ -10,12 +10,12 @@ export class SkyModalComponentAdapterService {
|
|
|
10
10
|
this.coreAdapter = coreAdapter;
|
|
11
11
|
}
|
|
12
12
|
handleWindowChange(modalEl) {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');
|
|
14
|
+
const fullPageModalEl = modalEl.nativeElement.querySelector('.sky-modal-full-page');
|
|
15
15
|
/*
|
|
16
16
|
Set modal height equal to max height of window (accounting for padding above and below modal)
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
const newHeight = window.innerHeight - 40;
|
|
19
19
|
boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';
|
|
20
20
|
if (fullPageModalEl) {
|
|
21
21
|
this.setFullPageHeight(fullPageModalEl);
|
|
@@ -25,27 +25,27 @@ export class SkyModalComponentAdapterService {
|
|
|
25
25
|
IE11 doesn't handle flex and max-height correctly so we have to explicitly add
|
|
26
26
|
max-height to the content that accounts for standard header and footer height.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const modalContentEl = modalEl.nativeElement.querySelector('.sky-modal-content');
|
|
29
|
+
const contentHeight = newHeight - 114;
|
|
30
30
|
modalContentEl.style.maxHeight = contentHeight.toString() + 'px';
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
isFocusInFirstItem(event, list) {
|
|
34
34
|
/* istanbul ignore next */
|
|
35
35
|
/* sanity check */
|
|
36
|
-
|
|
36
|
+
const eventTarget = event.target || event.srcElement;
|
|
37
37
|
return list.length > 0 && eventTarget === list[0];
|
|
38
38
|
}
|
|
39
39
|
isFocusInLastItem(event, list) {
|
|
40
40
|
/* istanbul ignore next */
|
|
41
41
|
/* sanity check */
|
|
42
|
-
|
|
42
|
+
const eventTarget = event.target || event.srcElement;
|
|
43
43
|
return list.length > 0 && eventTarget === list[list.length - 1];
|
|
44
44
|
}
|
|
45
45
|
isModalFocused(event, modalEl) {
|
|
46
46
|
/* istanbul ignore next */
|
|
47
47
|
/* sanity check */
|
|
48
|
-
|
|
48
|
+
const eventTarget = event.target || event.srcElement;
|
|
49
49
|
return (modalEl &&
|
|
50
50
|
eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog'));
|
|
51
51
|
}
|
|
@@ -68,9 +68,9 @@ export class SkyModalComponentAdapterService {
|
|
|
68
68
|
/* handle the case where somehow there is a focused element already in the modal */
|
|
69
69
|
if (!(document.activeElement &&
|
|
70
70
|
modalEl.nativeElement.contains(document.activeElement))) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const currentScrollX = window.pageXOffset;
|
|
72
|
+
const currentScrollY = window.pageYOffset;
|
|
73
|
+
const inputWithAutofocus = modalEl.nativeElement.querySelector('[autofocus]');
|
|
74
74
|
if (inputWithAutofocus) {
|
|
75
75
|
inputWithAutofocus.focus();
|
|
76
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-component-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-component-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"modal-component-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-component-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;;;AAEpD;;GAEG;AAEH,MAAM,OAAO,+BAA+B;IAC1C,YAAoB,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CA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C;SACjD;IACH,CAAC;IAEO,iBAAiB,CAAC,eAA4B;QACpD,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC;QACxC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;QAE7D,MAAM,eAAe,GACnB,QAAQ,CAAC,kBAAkB,CAAC,SAAS,EAAE,EAAE,CAAC;YAC1C,QAAQ,CAAC,kBAAkB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAEhD,MAAM,mBAAmB,GAAG,YAAY,GAAG,eAAe,GAAG,IAAI,CAAC;QAElE,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,mBAAmB,CAAC;QACnD,eAAe,CAAC,KAAK,CAAC,SAAS,GAAG,mBAAmB,CAAC;IACxD,CAAC;;6HAlHU,+BAA+B;iIAA/B,+BAA+B;4FAA/B,+BAA+B;kBAD3C,UAAU","sourcesContent":["import { ElementRef, Injectable } from '@angular/core';\nimport { SkyCoreAdapterService } from '@skyux/core';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyModalComponentAdapterService {\n constructor(private coreAdapter: SkyCoreAdapterService) {}\n\n public handleWindowChange(modalEl: ElementRef): void {\n const boundedHeightEl = modalEl.nativeElement.querySelector('.sky-modal');\n const fullPageModalEl = modalEl.nativeElement.querySelector(\n '.sky-modal-full-page'\n );\n /*\n Set modal height equal to max height of window (accounting for padding above and below modal)\n */\n const newHeight = window.innerHeight - 40;\n\n boundedHeightEl.style.maxHeight = newHeight.toString() + 'px';\n if (fullPageModalEl) {\n this.setFullPageHeight(fullPageModalEl);\n } else {\n /*\n IE11 doesn't handle flex and max-height correctly so we have to explicitly add\n max-height to the content that accounts for standard header and footer height.\n */\n const modalContentEl =\n modalEl.nativeElement.querySelector('.sky-modal-content');\n const contentHeight = newHeight - 114;\n modalContentEl.style.maxHeight = contentHeight.toString() + 'px';\n }\n }\n\n public isFocusInFirstItem(\n event: KeyboardEvent,\n list: Array<HTMLElement>\n ): boolean {\n /* istanbul ignore next */\n /* sanity check */\n const eventTarget = event.target || event.srcElement;\n return list.length > 0 && eventTarget === list[0];\n }\n\n public isFocusInLastItem(\n event: KeyboardEvent,\n list: Array<HTMLElement>\n ): boolean {\n /* istanbul ignore next */\n /* sanity check */\n const eventTarget = event.target || event.srcElement;\n return list.length > 0 && eventTarget === list[list.length - 1];\n }\n\n public isModalFocused(event: KeyboardEvent, modalEl: ElementRef): boolean {\n /* istanbul ignore next */\n /* sanity check */\n const eventTarget = event.target || event.srcElement;\n return (\n modalEl &&\n eventTarget === modalEl.nativeElement.querySelector('.sky-modal-dialog')\n );\n }\n\n public focusLastElement(list: Array<HTMLElement>): boolean {\n if (list.length > 0) {\n list[list.length - 1].focus();\n return true;\n }\n return false;\n }\n\n public focusFirstElement(list: Array<HTMLElement>): boolean {\n if (list.length > 0) {\n list[0].focus();\n return true;\n }\n return false;\n }\n\n public modalOpened(modalEl: ElementRef): void {\n /* istanbul ignore else */\n /* handle the case where somehow there is a focused element already in the modal */\n if (\n !(\n document.activeElement &&\n modalEl.nativeElement.contains(document.activeElement)\n )\n ) {\n const currentScrollX = window.pageXOffset;\n const currentScrollY = window.pageYOffset;\n\n const inputWithAutofocus =\n modalEl.nativeElement.querySelector('[autofocus]');\n\n if (inputWithAutofocus) {\n inputWithAutofocus.focus();\n } else {\n this.coreAdapter.getFocusableChildrenAndApplyFocus(\n modalEl,\n '.sky-modal-content',\n true\n );\n }\n window.scrollTo(currentScrollX, currentScrollY);\n }\n }\n\n private setFullPageHeight(fullPageModalEl: HTMLElement): void {\n const windowHeight = window.innerHeight;\n const fullPageModalStyle = getComputedStyle(fullPageModalEl);\n\n const marginTopBottom =\n parseInt(fullPageModalStyle.marginTop, 10) +\n parseInt(fullPageModalStyle.marginBottom, 10);\n\n const fullPageModalHeight = windowHeight - marginTopBottom + 'px';\n\n fullPageModalEl.style.height = fullPageModalHeight;\n fullPageModalEl.style.maxHeight = fullPageModalHeight;\n }\n}\n"]}
|
|
@@ -2,8 +2,8 @@ import { ChangeDetectorRef, Component, ComponentFactoryResolver, Injector, ViewC
|
|
|
2
2
|
import { NavigationStart, Router } from '@angular/router';
|
|
3
3
|
import { takeWhile } from 'rxjs/operators';
|
|
4
4
|
import { SkyModalAdapterService } from './modal-adapter.service';
|
|
5
|
-
import { SkyModalHostService } from './modal-host.service';
|
|
6
5
|
import { SkyModalConfiguration } from './modal-configuration';
|
|
6
|
+
import { SkyModalHostService } from './modal-host.service';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
import * as i1 from "./modal-adapter.service";
|
|
9
9
|
import * as i2 from "@angular/router";
|
|
@@ -43,12 +43,12 @@ export class SkyModalHostComponent {
|
|
|
43
43
|
});
|
|
44
44
|
adapter.setPageScroll(SkyModalHostService.openModalCount > 0);
|
|
45
45
|
adapter.toggleFullPageModalClass(SkyModalHostService.fullPageModalCount > 0);
|
|
46
|
-
|
|
46
|
+
const providers = params.providers || /* istanbul ignore next */ [];
|
|
47
47
|
const injector = Injector.create({
|
|
48
48
|
providers,
|
|
49
49
|
parent: this.injector,
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
const modalComponentRef = this.target.createComponent(factory, undefined, injector);
|
|
52
52
|
modalInstance.componentInstance = modalComponentRef.instance;
|
|
53
53
|
function closeModal() {
|
|
54
54
|
hostService.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-host.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-host.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-host.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,wBAAwB,EACxB,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"modal-host.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-host.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/modal/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W,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAgB,EAAE,EAAE;YAClD,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAC/B,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACnE,0BAA0B;YAC1B,IAAI,KAAK,YAAY,eAAe,EAAE;gBACpC,aAAa,CAAC,KAAK,EAAE,CAAC;aACvB;QACH,CAAC,CAAC,CAAC;QAEH,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE;YAClC,MAAM,GAAG,KAAK,CAAC;YACf,UAAU,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,qFAAqF;QACrF,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;;mHA7GU,qBAAqB;uGAArB,qBAAqB,mIAgBxB,gBAAgB,2CC3C1B,0JAQA,kNDiBiB,CAAC,sBAAsB,CAAC;4FAE5B,qBAAqB;kBANjC,SAAS;mBAAC;oBACT,QAAQ,EAAE,gBAAgB;oBAC1B,WAAW,EAAE,6BAA6B;oBAC1C,SAAS,EAAE,CAAC,6BAA6B,CAAC;oBAC1C,aAAa,EAAE,CAAC,sBAAsB,CAAC;iBACxC;gOAoBQ,MAAM;sBAJZ,SAAS;uBAAC,QAAQ,EAAE;wBACnB,IAAI,EAAE,gBAAgB;wBACtB,MAAM,EAAE,IAAI;qBACN","sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n ComponentFactoryResolver,\n Injector,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport { NavigationStart, Router } from '@angular/router';\n\nimport { takeWhile } from 'rxjs/operators';\n\nimport { SkyModalAdapterService } from './modal-adapter.service';\nimport { SkyModalConfiguration } from './modal-configuration';\nimport { SkyModalHostService } from './modal-host.service';\nimport { SkyModalInstance } from './modal-instance';\nimport { SkyModalConfigurationInterface } from './modal.interface';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-modal-host',\n templateUrl: './modal-host.component.html',\n styleUrls: ['./modal-host.component.scss'],\n viewProviders: [SkyModalAdapterService],\n})\nexport class SkyModalHostComponent {\n public get modalOpen() {\n return SkyModalHostService.openModalCount > 0;\n }\n\n public get backdropZIndex() {\n return SkyModalHostService.backdropZIndex;\n }\n\n /**\n * Use `any` for backwards-compatibility with Angular 4-7.\n * See: https://github.com/angular/angular/issues/30654\n * TODO: Remove the `any` in a breaking change.\n * @internal\n */\n @ViewChild('target', {\n read: ViewContainerRef,\n static: true,\n } as any)\n public target: ViewContainerRef;\n\n constructor(\n private resolver: ComponentFactoryResolver,\n private adapter: SkyModalAdapterService,\n private injector: Injector,\n private router: Router,\n private changeDetector: ChangeDetectorRef\n ) {}\n\n public open(\n modalInstance: SkyModalInstance,\n component: any,\n config?: SkyModalConfigurationInterface\n ) {\n const params: SkyModalConfigurationInterface = Object.assign({}, config);\n const factory = this.resolver.resolveComponentFactory(component);\n\n const hostService = new SkyModalHostService();\n hostService.fullPage = !!params.fullPage;\n\n const adapter = this.adapter;\n const modalOpener: HTMLElement = adapter.getModalOpener();\n\n let isOpen = true;\n\n params.providers.push({\n provide: SkyModalHostService,\n useValue: hostService,\n });\n params.providers.push({\n provide: SkyModalConfiguration,\n useValue: params,\n });\n\n adapter.setPageScroll(SkyModalHostService.openModalCount > 0);\n adapter.toggleFullPageModalClass(\n SkyModalHostService.fullPageModalCount > 0\n );\n\n const providers = params.providers || /* istanbul ignore next */ [];\n const injector = Injector.create({\n providers,\n parent: this.injector,\n });\n\n const modalComponentRef = this.target.createComponent(\n factory,\n undefined,\n injector\n );\n\n modalInstance.componentInstance = modalComponentRef.instance;\n\n function closeModal() {\n hostService.destroy();\n adapter.setPageScroll(SkyModalHostService.openModalCount > 0);\n adapter.toggleFullPageModalClass(\n SkyModalHostService.fullPageModalCount > 0\n );\n /* istanbul ignore else */\n /* sanity check */\n if (modalOpener && modalOpener.focus) {\n modalOpener.focus();\n }\n modalComponentRef.destroy();\n }\n\n hostService.openHelp.subscribe((helpKey?: string) => {\n modalInstance.openHelp(helpKey);\n });\n\n hostService.close.subscribe(() => {\n modalInstance.close();\n });\n\n this.router.events.pipe(takeWhile(() => isOpen)).subscribe((event) => {\n /* istanbul ignore else */\n if (event instanceof NavigationStart) {\n modalInstance.close();\n }\n });\n\n modalInstance.closed.subscribe(() => {\n isOpen = false;\n closeModal();\n });\n\n // Necessary if the host was created via a consumer's lifecycle hook such as ngOnInit\n this.changeDetector.detectChanges();\n }\n}\n","<div\n class=\"sky-modal-host-backdrop\"\n [hidden]=\"!modalOpen\"\n [ngStyle]=\"{\n zIndex: backdropZIndex\n }\"\n></div>\n<div #target></div>\n"]}
|
|
@@ -15,7 +15,7 @@ export class SkyModalHostService {
|
|
|
15
15
|
return SkyModalHostService.modalHosts.length;
|
|
16
16
|
}
|
|
17
17
|
static get fullPageModalCount() {
|
|
18
|
-
|
|
18
|
+
const fullPageModals = SkyModalHostService.modalHosts.filter((modal) => modal.fullPage);
|
|
19
19
|
return fullPageModals.length;
|
|
20
20
|
}
|
|
21
21
|
static get BASE_Z_INDEX() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-host.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-host.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAEzD;;;GAGG;AAIH,MAAM,OAAO,mBAAmB;IAmC9B;QAJO,UAAK,GAAG,IAAI,YAAY,EAAQ,CAAC;QACjC,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QAGxC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IApCM,MAAM,KAAK,cAAc;QAC9B,OAAO,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;IAC/C,CAAC;IAEM,MAAM,KAAK,kBAAkB;QAClC,
|
|
1
|
+
{"version":3,"file":"modal-host.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-host.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAEzD;;;GAGG;AAIH,MAAM,OAAO,mBAAmB;IAmC9B;QAJO,UAAK,GAAG,IAAI,YAAY,EAAQ,CAAC;QACjC,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,IAAI,YAAY,EAAO,CAAC;QAGxC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IApCM,MAAM,KAAK,cAAc;QAC9B,OAAO,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;IAC/C,CAAC;IAEM,MAAM,KAAK,kBAAkB;QAClC,MAAM,cAAc,GAAG,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAC1D,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAC1B,CAAC;QACF,OAAO,cAAc,CAAC,MAAM,CAAC;IAC/B,CAAC;IAEO,MAAM,KAAK,YAAY;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,KAAK,cAAc;QAC9B,OAAO,CACL,mBAAmB,CAAC,YAAY;YAChC,mBAAmB,CAAC,UAAU,CAAC,MAAM,GAAG,EAAE,CAC3C,CAAC;IACJ,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,OAAO,mBAAmB,CAAC,UAAU,CACnC,mBAAmB,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAC1C,CAAC;IACJ,CAAC;IAYM,cAAc;QACnB,IAAI,MAAM,GAAG,mBAAmB,CAAC,YAAY,GAAG,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAEM,UAAU,CAAC,OAAgB;QAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,OAAO;QACZ,mBAAmB,CAAC,UAAU,CAAC,MAAM,CACnC,mBAAmB,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAC5C,CAAC,CACF,CAAC;IACJ,CAAC;;AA7Bc,8BAAU,GAA0B,EAAE,CAAC;iHA7B3C,mBAAmB;qHAAnB,mBAAmB,cAFlB,MAAM;4FAEP,mBAAmB;kBAH/B,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { EventEmitter, Injectable } from '@angular/core';\n\n/**\n * @internal\n * @dynamic\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyModalHostService {\n public static get openModalCount(): number {\n return SkyModalHostService.modalHosts.length;\n }\n\n public static get fullPageModalCount(): number {\n const fullPageModals = SkyModalHostService.modalHosts.filter(\n (modal) => modal.fullPage\n );\n return fullPageModals.length;\n }\n\n private static get BASE_Z_INDEX(): number {\n return 1040;\n }\n\n public static get backdropZIndex(): number {\n return (\n SkyModalHostService.BASE_Z_INDEX +\n SkyModalHostService.modalHosts.length * 10\n );\n }\n\n public static get topModal(): SkyModalHostService {\n return SkyModalHostService.modalHosts[\n SkyModalHostService.modalHosts.length - 1\n ];\n }\n\n private static modalHosts: SkyModalHostService[] = [];\n\n public close = new EventEmitter<void>();\n public fullPage = false;\n public openHelp = new EventEmitter<any>();\n\n constructor() {\n SkyModalHostService.modalHosts.push(this);\n }\n\n public getModalZIndex(): number {\n let zIndex = SkyModalHostService.BASE_Z_INDEX + 1;\n zIndex += (SkyModalHostService.modalHosts.indexOf(this) + 1) * 10;\n return zIndex;\n }\n\n public onClose(): void {\n this.close.emit();\n }\n\n public onOpenHelp(helpKey?: string) {\n this.openHelp.emit(helpKey);\n }\n\n public destroy(): void {\n SkyModalHostService.modalHosts.splice(\n SkyModalHostService.modalHosts.indexOf(this),\n 1\n );\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
|
-
import { SkyModalCloseArgs } from './modal-close-args';
|
|
3
2
|
import { SkyModalBeforeCloseHandler } from './modal-before-close-handler';
|
|
3
|
+
import { SkyModalCloseArgs } from './modal-close-args';
|
|
4
4
|
// TODO: this class won't show in the generated docs until this work is done:
|
|
5
5
|
// https://github.com/blackbaud/skyux-docs-tools/issues/30
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-instance.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"modal-instance.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,6EAA6E;AAC7E,0DAA0D;AAE1D;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QAqCU,iBAAY,GAAG,IAAI,OAAO,EAA8B,CAAC;QAEz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AAC,CAAC;SACzB;aAAM;YACL,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,IAAI,0BAA0B,CAAC,GAAG,EAAE;gBAClC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC,EAAE,IAAI,CAAC,CACT,CAAC;SACH;IACH,CAAC;IAEO,YAAY,CAAC,IAAuB;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF","sourcesContent":["import { Observable, Subject } from 'rxjs';\n\nimport { SkyModalBeforeCloseHandler } from './modal-before-close-handler';\nimport { SkyModalCloseArgs } from './modal-close-args';\n\n// TODO: this class won't show in the generated docs until this work is done:\n// https://github.com/blackbaud/skyux-docs-tools/issues/30\n\n/**\n * Allows you to close the modal and return data from the launched modal.\n */\nexport class SkyModalInstance {\n /**\n * An event that the modal instance emits when it is about to close.\n * It emits a `SkyModalBeforeCloseHandler` object with a `closeModal` method\n * that closes the modal. If a subscription exists for this event,\n * the modal does not close until the subscriber calls the `closeModal` method.\n */\n public get beforeClose(): Observable<SkyModalBeforeCloseHandler> {\n return this._beforeClose;\n }\n\n /**\n * An event that the modal instance emits when it closes.\n * It emits a `SkyCloseModalArgs` object with a `data` property that includes\n * data passed from users on close or save and a `reason` property that indicates\n * whether the modal was saved or closed without saving.\n * The `reason` property accepts any string value.\n * Common examples include `cancel`, `close`, and `save`.\n */\n public get closed(): Observable<SkyModalCloseArgs> {\n return this._closed;\n }\n\n /**\n * An event that the modal instance emits when users click\n * the <i class=\"fa fa-question-circle\" aria-hidden=\"true\"></i> button.\n * If a `helpKey` parameter was specified, the `helpOpened` event broadcasts the `helpKey`.\n */\n public get helpOpened(): Observable<string> {\n return this._helpOpened;\n }\n\n /**\n * A direct reference to the provided component's class.\n */\n public componentInstance: any;\n\n private _beforeClose = new Subject<SkyModalBeforeCloseHandler>();\n\n private _closed = new Subject<SkyModalCloseArgs>();\n\n private _helpOpened = new Subject<string>();\n\n /**\n * Closes the modal instance.\n * @param result Specifies an object to emit to subscribers of the `closed` event of the\n * modal instance. The `SkyModalInstance` provider can be injected into a component's constructor\n * so that this `close` function can be called from a button in the `sky-modal-footer`.\n * @param reason Specifies the reason for the modal closing, with the default reason of `close`.\n * @param ignoreBeforeClose Indicates whether to ignore the modal instance's `beforeClose` event.\n */\n public close(\n result?: any,\n reason?: string,\n ignoreBeforeClose?: boolean\n ): void {\n if (reason === undefined) {\n reason = 'close';\n }\n\n this.closeModal(reason, result, ignoreBeforeClose);\n }\n\n /**\n * Closes the modal instance with `reason=cancel`.\n * @param result Specifies an object to emit to subscribers of the `closed` event of the modal\n * instance. The `SkyModalInstance` provider can be injected into a component's constructor so\n * that this cancel function can be called from a button in the `sky-modal-footer`.\n */\n public cancel(result?: any): void {\n this.closeModal('cancel', result);\n }\n\n /**\n * Closes the modal instance with `reason=save`.\n * @param result Specifies an object to emit to subscribers of the `closed` event of the modal\n * instance. The `SkyModalInstance` provider can be injected into a component's constructor so\n * that this `save` function can be called from a button in `the sky-modal-footer`.\n */\n public save(result?: any): void {\n this.closeModal('save', result);\n }\n\n /**\n * Triggers the `helpOpened` event that broadcasts a `helpKey` parameter to open\n * when users click the <i class=\"fa fa-question-circle\" aria-hidden=\"true\"></i> button.\n * @param helpKey Specifies a string to emit to subscribers of\n * the modal instance's `helpOpened` event. Consumers can inject the `SkyModalInstance` provider\n * into a component's constructor to call the `openHelp` function in the modal template.\n */\n public openHelp(helpKey?: string): void {\n this._helpOpened.next(helpKey);\n }\n\n private closeModal(\n type: string,\n result?: any,\n ignoreBeforeClose = false\n ): void {\n const args = new SkyModalCloseArgs();\n\n args.reason = type;\n args.data = result;\n\n if (this._beforeClose.observers.length === 0 || ignoreBeforeClose) {\n this.notifyClosed(args);\n } else {\n this._beforeClose.next(\n new SkyModalBeforeCloseHandler(() => {\n this.notifyClosed(args);\n }, args)\n );\n }\n }\n\n private notifyClosed(args: SkyModalCloseArgs): void {\n this._closed.next(args);\n this._closed.complete();\n this._beforeClose.complete();\n this._helpOpened.complete();\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Directive, ElementRef, EventEmitter, HostListener, Optional, Output,
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
|
-
import { takeUntil } from 'rxjs/operators';
|
|
1
|
+
import { Directive, ElementRef, EventEmitter, HostListener, NgZone, Optional, Output, } from '@angular/core';
|
|
4
2
|
import { MutationObserverService } from '@skyux/core';
|
|
5
3
|
import { SkyTheme, SkyThemeService } from '@skyux/theme';
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
|
+
import { takeUntil } from 'rxjs/operators';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
import * as i1 from "@skyux/theme";
|
|
8
8
|
import * as i2 from "@skyux/core";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-scroll-shadow.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-scroll-shadow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"modal-scroll-shadow.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal-scroll-shadow.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,MAAM,EAGN,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,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;SACJ;IACH,CAAC;IAEO,gBAAgB,CAAC,aAAqB;QAC5C,0FAA0F;QAC1F,wDAAwD;QACxD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC;QAEtD,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,iCAAiC,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5E,CAAC;IAEO,UAAU,CAAC,MAAqC;QACtD,IACE,CAAC,IAAI,CAAC,aAAa;YACnB,IAAI,CAAC,aAAa,CAAC,YAAY,KAAK,MAAM,CAAC,YAAY;YACvD,IAAI,CAAC,aAAa,CAAC,SAAS,KAAK,MAAM,CAAC,SAAS,EACjD;YACA,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;SAC7B;IACH,CAAC;;2HAxHU,6BAA6B;+GAA7B,6BAA6B;4FAA7B,6BAA6B;kBAHzC,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;iBACnC;;0BAeI,QAAQ;uGAZJ,oBAAoB;sBAD1B,MAAM;gBAmBA,YAAY;sBADlB,YAAY;uBAAC,eAAe;gBAMtB,MAAM;sBADZ,YAAY;uBAAC,QAAQ","sourcesContent":["import {\n Directive,\n ElementRef,\n EventEmitter,\n HostListener,\n NgZone,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n} from '@angular/core';\nimport { MutationObserverService } from '@skyux/core';\nimport { SkyTheme, SkyThemeService } from '@skyux/theme';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyModalScrollShadowEventArgs } from './modal-scroll-shadow-event-args';\n\n/**\n * Raises an event when the box shadow for the modal header or footer should be adjusted\n * based on the scroll position of the host element.\n * @internal\n */\n@Directive({\n selector: '[skyModalScrollShadow]',\n})\nexport class SkyModalScrollShadowDirective implements OnInit, OnDestroy {\n @Output()\n public skyModalScrollShadow = new EventEmitter<SkyModalScrollShadowEventArgs>();\n\n private currentShadow: SkyModalScrollShadowEventArgs;\n\n private currentTheme: SkyTheme;\n\n private mutationObserver: MutationObserver;\n\n private ngUnsubscribe = new Subject<any>();\n\n constructor(\n private elRef: ElementRef,\n @Optional() private themeSvc: SkyThemeService,\n private mutationObserverSvc: MutationObserverService,\n private ngZone: NgZone\n ) {}\n\n @HostListener('window:resize')\n public windowResize(): void {\n this.checkForShadow();\n }\n\n @HostListener('scroll')\n public scroll(): void {\n this.checkForShadow();\n }\n\n public ngOnInit(): void {\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((themeSettings) => {\n this.currentTheme = themeSettings.currentSettings.theme;\n\n if (this.currentTheme === SkyTheme.presets.modern) {\n this.initMutationObserver();\n } else {\n this.emitShadow({\n bottomShadow: 'none',\n topShadow: 'none',\n });\n\n this.destroyMutationObserver();\n }\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n this.destroyMutationObserver();\n }\n\n private initMutationObserver(): void {\n if (!this.mutationObserver) {\n const el = this.elRef.nativeElement;\n\n // MutationObserver is patched by Zone.js and therefore becomes part of the\n // Angular change detection cycle, but this can lead to infinite loops in some\n // secnarios. This will keep MutationObserver from triggering change detection.\n this.ngZone.runOutsideAngular(() => {\n this.mutationObserver = this.mutationObserverSvc.create(() => {\n this.checkForShadow();\n });\n\n this.mutationObserver.observe(el, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n });\n }\n }\n\n private destroyMutationObserver(): void {\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n private checkForShadow(): void {\n if (this.currentTheme === SkyTheme.presets.modern) {\n const el = this.elRef.nativeElement;\n\n const topShadow = this.buildShadowStyle(el.scrollTop);\n\n const bottomShadow = this.buildShadowStyle(\n el.scrollHeight - el.scrollTop - el.clientHeight\n );\n\n this.emitShadow({\n bottomShadow,\n topShadow,\n });\n }\n }\n\n private buildShadowStyle(pixelsFromEnd: number): string {\n // Progressively darken the shadow until the user scrolls 30 pixels from the top or bottom\n // of the scrollable element, with a max opacity of 0.3.\n const opacity = Math.min(pixelsFromEnd / 30, 1) * 0.3;\n\n return opacity > 0 ? `0px 1px 8px 0px rgba(0, 0, 0, ${opacity})` : 'none';\n }\n\n private emitShadow(shadow: SkyModalScrollShadowEventArgs): void {\n if (\n !this.currentShadow ||\n this.currentShadow.bottomShadow !== shadow.bottomShadow ||\n this.currentShadow.topShadow !== shadow.topShadow\n ) {\n this.skyModalScrollShadow.emit(shadow);\n this.currentShadow = shadow;\n }\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ElementRef, Host, HostBinding, HostListener, Input, ViewChild, } from '@angular/core';
|
|
2
2
|
import { SkyAppWindowRef, SkyCoreAdapterService, SkyDockLocation, SkyDockService, } from '@skyux/core';
|
|
3
|
-
import { SkyModalHostService } from './modal-host.service';
|
|
4
|
-
import { SkyModalConfiguration } from './modal-configuration';
|
|
5
3
|
import { SkyModalComponentAdapterService } from './modal-component-adapter.service';
|
|
4
|
+
import { SkyModalConfiguration } from './modal-configuration';
|
|
5
|
+
import { SkyModalHostService } from './modal-host.service';
|
|
6
6
|
import { skyAnimationModalState } from './modal-state-animation';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
8
|
import * as i1 from "./modal-host.service";
|
|
@@ -82,7 +82,7 @@ export class SkyModalComponent {
|
|
|
82
82
|
/* istanbul ignore else */
|
|
83
83
|
/* sanity check */
|
|
84
84
|
if (SkyModalHostService.openModalCount > 0) {
|
|
85
|
-
|
|
85
|
+
const topModal = SkyModalHostService.topModal;
|
|
86
86
|
if (topModal && topModal === this.hostService) {
|
|
87
87
|
if (event.which === 27) {
|
|
88
88
|
// Escape key up
|
|
@@ -96,12 +96,12 @@ export class SkyModalComponent {
|
|
|
96
96
|
/* istanbul ignore else */
|
|
97
97
|
/* sanity check */
|
|
98
98
|
if (SkyModalHostService.openModalCount > 0) {
|
|
99
|
-
|
|
99
|
+
const topModal = SkyModalHostService.topModal;
|
|
100
100
|
if (topModal && topModal === this.hostService) {
|
|
101
101
|
if (event.which === 9) {
|
|
102
102
|
// Tab pressed
|
|
103
103
|
let focusChanged = false;
|
|
104
|
-
|
|
104
|
+
const focusElementList = this.coreAdapter.getFocusableChildren(this.elRef.nativeElement);
|
|
105
105
|
if (event.shiftKey &&
|
|
106
106
|
(this.componentAdapter.isFocusInFirstItem(event, focusElementList) ||
|
|
107
107
|
this.componentAdapter.isModalFocused(event, this.elRef))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,EACL,UAAU,EACV,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAIpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;;;;;;;;;;AAEjE,IAAI,wBAAwB,GAAW,CAAC,CAAC;AAEzC;;;;;GAKG;AAQH,MAAM,OAAO,iBAAiB;IA0E5B,YACU,WAAgC,EAChC,MAA6B,EAC7B,KAAiB,EACjB,SAA0B,EAC1B,gBAAiD,EACjD,WAAkC,EA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ViewInit,\n Component,\n Input,\n ElementRef,\n Host,\n HostBinding,\n HostListener,\n ViewChild,\n} from '@angular/core';\n\nimport {\n SkyAppWindowRef,\n SkyCoreAdapterService,\n SkyDockLocation,\n SkyDockService,\n} from '@skyux/core';\n\nimport { SkyModalHostService } from './modal-host.service';\n\nimport { SkyModalConfiguration } from './modal-configuration';\n\nimport { SkyModalComponentAdapterService } from './modal-component-adapter.service';\n\nimport { SkyModalScrollShadowEventArgs } from './modal-scroll-shadow-event-args';\n\nimport { skyAnimationModalState } from './modal-state-animation';\n\nlet skyModalUniqueIdentifier: number = 0;\n\n/**\n * Provides a common look-and-feel for modal content with options to display\n * a common modal header, specify body content, and display a common modal footer\n * and buttons. For information about how to test modals in SKY UX, see\n * [write unit tests for modals](https://developer.blackbaud.com/skyux/learn/get-started/advanced/unit-test-modals).\n */\n@Component({\n selector: 'sky-modal',\n templateUrl: './modal.component.html',\n styleUrls: ['./modal.component.scss'],\n animations: [skyAnimationModalState],\n providers: [SkyModalComponentAdapterService, SkyDockService],\n})\nexport class SkyModalComponent implements AfterViewInit {\n @HostBinding('class')\n public get wrapperClass(): string {\n return this.config.wrapperClass;\n }\n\n /**\n * @internal\n */\n @Input()\n public get ariaRole() {\n return this.config.ariaRole || 'dialog';\n }\n public set ariaRole(value: string) {\n this.config.ariaRole = value;\n }\n\n /**\n * @internal\n */\n @Input()\n public set tiledBody(value: boolean) {\n this.config.tiledBody = value;\n }\n\n public get modalZIndex() {\n return this.hostService.getModalZIndex();\n }\n\n public get modalFullPage() {\n return this.config.fullPage;\n }\n\n public get isSmallSize() {\n return !this.modalFullPage && this.isSizeEqual(this.config.size, 'small');\n }\n\n public get isMediumSize() {\n return !this.modalFullPage && !(this.isSmallSize || this.isLargeSize);\n }\n\n public get isLargeSize() {\n return !this.modalFullPage && this.isSizeEqual(this.config.size, 'large');\n }\n\n public get isTiledBody() {\n return this.config.tiledBody;\n }\n\n public get ariaDescribedBy() {\n return this.config.ariaDescribedBy || this.modalContentId;\n }\n\n public get ariaLabelledBy() {\n return this.config.ariaLabelledBy || this.modalHeaderId;\n }\n\n public get helpKey() {\n return this.config.helpKey;\n }\n\n public modalState = 'in';\n\n public modalContentId: string =\n 'sky-modal-content-id-' + skyModalUniqueIdentifier.toString();\n\n public modalHeaderId: string =\n 'sky-modal-header-id-' + skyModalUniqueIdentifier.toString();\n\n public scrollShadow: SkyModalScrollShadowEventArgs;\n\n @ViewChild('modalContentWrapper', { read: ElementRef })\n private modalContentWrapperElement: ElementRef;\n\n constructor(\n private hostService: SkyModalHostService,\n private config: SkyModalConfiguration,\n private elRef: ElementRef,\n private windowRef: SkyAppWindowRef,\n private componentAdapter: SkyModalComponentAdapterService,\n private coreAdapter: SkyCoreAdapterService,\n @Host() private dockService: SkyDockService\n ) {}\n\n @HostListener('document:keyup', ['$event'])\n public onDocumentKeyUp(event: KeyboardEvent) {\n /* istanbul ignore else */\n /* sanity check */\n if (SkyModalHostService.openModalCount > 0) {\n let topModal = SkyModalHostService.topModal;\n if (topModal && topModal === this.hostService) {\n if (event.which === 27) {\n // Escape key up\n event.preventDefault();\n this.closeButtonClick();\n }\n }\n }\n }\n\n @HostListener('document:keydown', ['$event'])\n public onDocumentKeyDown(event: KeyboardEvent) {\n /* istanbul ignore else */\n /* sanity check */\n if (SkyModalHostService.openModalCount > 0) {\n let topModal = SkyModalHostService.topModal;\n if (topModal && topModal === this.hostService) {\n if (event.which === 9) {\n // Tab pressed\n let focusChanged = false;\n\n let focusElementList = this.coreAdapter.getFocusableChildren(\n this.elRef.nativeElement\n );\n\n if (\n event.shiftKey &&\n (this.componentAdapter.isFocusInFirstItem(\n event,\n focusElementList\n ) ||\n this.componentAdapter.isModalFocused(event, this.elRef))\n ) {\n focusChanged =\n this.componentAdapter.focusLastElement(focusElementList);\n } else if (\n !event.shiftKey &&\n this.componentAdapter.isFocusInLastItem(event, focusElementList)\n ) {\n focusChanged =\n this.componentAdapter.focusFirstElement(focusElementList);\n }\n\n if (focusChanged) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n }\n\n public ngAfterViewInit() {\n skyModalUniqueIdentifier++;\n this.componentAdapter.handleWindowChange(this.elRef);\n\n // Adding a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.\n // https://stackoverflow.com/questions/40562845\n this.windowRef.nativeWindow.setTimeout(() => {\n this.componentAdapter.modalOpened(this.elRef);\n });\n\n this.dockService.setDockOptions({\n location: SkyDockLocation.ElementBottom,\n referenceEl: this.modalContentWrapperElement.nativeElement,\n zIndex: 5,\n });\n }\n\n public helpButtonClick() {\n this.hostService.onOpenHelp(this.helpKey);\n }\n\n public closeButtonClick() {\n this.hostService.onClose();\n }\n\n public windowResize() {\n this.componentAdapter.handleWindowChange(this.elRef);\n }\n\n public scrollShadowChange(args: SkyModalScrollShadowEventArgs): void {\n this.scrollShadow = args;\n }\n\n private isSizeEqual(actualSize: string, size: string) {\n return actualSize && actualSize.toLowerCase() === size;\n }\n}\n","<!--\n Animations are broken in Chrome v52. Angular 2 RC5 will fix it.\n https://github.com/angular/angular/issues/10245\n-->\n<!--<div @modalState=\"modalState\">-->\n\n<div\n class=\"sky-modal-dialog\"\n aria-modal=\"true\"\n [attr.aria-describedby]=\"ariaDescribedBy\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.role]=\"ariaRole\"\n (window:resize)=\"windowResize()\"\n>\n <div\n class=\"sky-modal sky-shadow sky-box sky-elevation-16\"\n tabindex=\"-1\"\n [ngClass]=\"{\n 'sky-modal-full-page': modalFullPage,\n 'sky-modal-small': isSmallSize,\n 'sky-modal-medium': isMediumSize,\n 'sky-modal-large': isLargeSize,\n 'sky-modal-tiled': isTiledBody\n }\"\n [ngStyle]=\"{\n zIndex: modalZIndex\n }\"\n >\n <div\n class=\"sky-modal-header\"\n [hidden]=\"!headerContent || !headerContent.children || headerContent.children.length < 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n [attr.id]=\"modalHeaderId\"\n [ngClass]=\"{\n 'sky-section-heading': modalFullPage\n }\"\n #headerContent\n >\n <ng-content select=\"sky-modal-header\"></ng-content>\n </div>\n <div class=\"sky-modal-header-buttons\">\n <button\n *ngIf=\"helpKey\"\n class=\"sky-btn sky-modal-btn-help\"\n name=\"help-button\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_modal_open_help' | skyLibResources\"\n (click)=\"helpButtonClick()\"\n >\n <sky-icon icon=\"question-circle\"></sky-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"sky-btn sky-modal-btn-close\"\n [attr.aria-label]=\"'skyux_modal_close' | skyLibResources\"\n (click)=\"closeButtonClick()\"\n >\n <sky-icon icon=\"close\"></sky-icon>\n </button>\n </div>\n </div>\n <div\n class=\"sky-modal-content sky-padding-even-large\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-labelledby]=\"modalHeaderId\"\n [attr.id]=\"modalContentId\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\n #modalContentWrapper\n >\n <ng-content select=\"sky-modal-content\"></ng-content>\n </div>\n <div\n class=\"sky-modal-footer\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.bottomShadow\n }\"\n >\n <ng-content select=\"sky-modal-footer\"></ng-content>\n </div>\n </div>\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"modal.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.component.ts","../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,KAAK,EACL,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,qBAAq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YAAY;sBADtB,WAAW;uBAAC,OAAO;gBAST,QAAQ;sBADlB,KAAK;gBAYK,SAAS;sBADnB,KAAK;gBAoDE,0BAA0B;sBADjC,SAAS;uBAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;gBAc/C,eAAe;sBADrB,YAAY;uBAAC,gBAAgB,EAAE,CAAC,QAAQ,CAAC;gBAiBnC,iBAAiB;sBADvB,YAAY;uBAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n Host,\n HostBinding,\n HostListener,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {\n SkyAppWindowRef,\n SkyCoreAdapterService,\n SkyDockLocation,\n SkyDockService,\n} from '@skyux/core';\n\nimport { SkyModalComponentAdapterService } from './modal-component-adapter.service';\nimport { SkyModalConfiguration } from './modal-configuration';\nimport { SkyModalHostService } from './modal-host.service';\nimport { SkyModalScrollShadowEventArgs } from './modal-scroll-shadow-event-args';\nimport { skyAnimationModalState } from './modal-state-animation';\n\nlet skyModalUniqueIdentifier = 0;\n\n/**\n * Provides a common look-and-feel for modal content with options to display\n * a common modal header, specify body content, and display a common modal footer\n * and buttons. For information about how to test modals in SKY UX, see\n * [write unit tests for modals](https://developer.blackbaud.com/skyux/learn/get-started/advanced/unit-test-modals).\n */\n@Component({\n selector: 'sky-modal',\n templateUrl: './modal.component.html',\n styleUrls: ['./modal.component.scss'],\n animations: [skyAnimationModalState],\n providers: [SkyModalComponentAdapterService, SkyDockService],\n})\nexport class SkyModalComponent implements AfterViewInit {\n @HostBinding('class')\n public get wrapperClass(): string {\n return this.config.wrapperClass;\n }\n\n /**\n * @internal\n */\n @Input()\n public get ariaRole() {\n return this.config.ariaRole || 'dialog';\n }\n public set ariaRole(value: string) {\n this.config.ariaRole = value;\n }\n\n /**\n * @internal\n */\n @Input()\n public set tiledBody(value: boolean) {\n this.config.tiledBody = value;\n }\n\n public get modalZIndex() {\n return this.hostService.getModalZIndex();\n }\n\n public get modalFullPage() {\n return this.config.fullPage;\n }\n\n public get isSmallSize() {\n return !this.modalFullPage && this.isSizeEqual(this.config.size, 'small');\n }\n\n public get isMediumSize() {\n return !this.modalFullPage && !(this.isSmallSize || this.isLargeSize);\n }\n\n public get isLargeSize() {\n return !this.modalFullPage && this.isSizeEqual(this.config.size, 'large');\n }\n\n public get isTiledBody() {\n return this.config.tiledBody;\n }\n\n public get ariaDescribedBy() {\n return this.config.ariaDescribedBy || this.modalContentId;\n }\n\n public get ariaLabelledBy() {\n return this.config.ariaLabelledBy || this.modalHeaderId;\n }\n\n public get helpKey() {\n return this.config.helpKey;\n }\n\n public modalState = 'in';\n\n public modalContentId: string =\n 'sky-modal-content-id-' + skyModalUniqueIdentifier.toString();\n\n public modalHeaderId: string =\n 'sky-modal-header-id-' + skyModalUniqueIdentifier.toString();\n\n public scrollShadow: SkyModalScrollShadowEventArgs;\n\n @ViewChild('modalContentWrapper', { read: ElementRef })\n private modalContentWrapperElement: ElementRef;\n\n constructor(\n private hostService: SkyModalHostService,\n private config: SkyModalConfiguration,\n private elRef: ElementRef,\n private windowRef: SkyAppWindowRef,\n private componentAdapter: SkyModalComponentAdapterService,\n private coreAdapter: SkyCoreAdapterService,\n @Host() private dockService: SkyDockService\n ) {}\n\n @HostListener('document:keyup', ['$event'])\n public onDocumentKeyUp(event: KeyboardEvent) {\n /* istanbul ignore else */\n /* sanity check */\n if (SkyModalHostService.openModalCount > 0) {\n const topModal = SkyModalHostService.topModal;\n if (topModal && topModal === this.hostService) {\n if (event.which === 27) {\n // Escape key up\n event.preventDefault();\n this.closeButtonClick();\n }\n }\n }\n }\n\n @HostListener('document:keydown', ['$event'])\n public onDocumentKeyDown(event: KeyboardEvent) {\n /* istanbul ignore else */\n /* sanity check */\n if (SkyModalHostService.openModalCount > 0) {\n const topModal = SkyModalHostService.topModal;\n if (topModal && topModal === this.hostService) {\n if (event.which === 9) {\n // Tab pressed\n let focusChanged = false;\n\n const focusElementList = this.coreAdapter.getFocusableChildren(\n this.elRef.nativeElement\n );\n\n if (\n event.shiftKey &&\n (this.componentAdapter.isFocusInFirstItem(\n event,\n focusElementList\n ) ||\n this.componentAdapter.isModalFocused(event, this.elRef))\n ) {\n focusChanged =\n this.componentAdapter.focusLastElement(focusElementList);\n } else if (\n !event.shiftKey &&\n this.componentAdapter.isFocusInLastItem(event, focusElementList)\n ) {\n focusChanged =\n this.componentAdapter.focusFirstElement(focusElementList);\n }\n\n if (focusChanged) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n }\n\n public ngAfterViewInit() {\n skyModalUniqueIdentifier++;\n this.componentAdapter.handleWindowChange(this.elRef);\n\n // Adding a timeout to avoid ExpressionChangedAfterItHasBeenCheckedError.\n // https://stackoverflow.com/questions/40562845\n this.windowRef.nativeWindow.setTimeout(() => {\n this.componentAdapter.modalOpened(this.elRef);\n });\n\n this.dockService.setDockOptions({\n location: SkyDockLocation.ElementBottom,\n referenceEl: this.modalContentWrapperElement.nativeElement,\n zIndex: 5,\n });\n }\n\n public helpButtonClick() {\n this.hostService.onOpenHelp(this.helpKey);\n }\n\n public closeButtonClick() {\n this.hostService.onClose();\n }\n\n public windowResize() {\n this.componentAdapter.handleWindowChange(this.elRef);\n }\n\n public scrollShadowChange(args: SkyModalScrollShadowEventArgs): void {\n this.scrollShadow = args;\n }\n\n private isSizeEqual(actualSize: string, size: string) {\n return actualSize && actualSize.toLowerCase() === size;\n }\n}\n","<!--\n Animations are broken in Chrome v52. Angular 2 RC5 will fix it.\n https://github.com/angular/angular/issues/10245\n-->\n<!--<div @modalState=\"modalState\">-->\n\n<div\n class=\"sky-modal-dialog\"\n aria-modal=\"true\"\n [attr.aria-describedby]=\"ariaDescribedBy\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.role]=\"ariaRole\"\n (window:resize)=\"windowResize()\"\n>\n <div\n class=\"sky-modal sky-shadow sky-box sky-elevation-16\"\n tabindex=\"-1\"\n [ngClass]=\"{\n 'sky-modal-full-page': modalFullPage,\n 'sky-modal-small': isSmallSize,\n 'sky-modal-medium': isMediumSize,\n 'sky-modal-large': isLargeSize,\n 'sky-modal-tiled': isTiledBody\n }\"\n [ngStyle]=\"{\n zIndex: modalZIndex\n }\"\n >\n <div\n class=\"sky-modal-header\"\n [hidden]=\"!headerContent || !headerContent.children || headerContent.children.length < 1\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.topShadow\n }\"\n >\n <div\n class=\"sky-modal-header-content\"\n [attr.id]=\"modalHeaderId\"\n [ngClass]=\"{\n 'sky-section-heading': modalFullPage\n }\"\n #headerContent\n >\n <ng-content select=\"sky-modal-header\"></ng-content>\n </div>\n <div class=\"sky-modal-header-buttons\">\n <button\n *ngIf=\"helpKey\"\n class=\"sky-btn sky-modal-btn-help\"\n name=\"help-button\"\n type=\"button\"\n [attr.aria-label]=\"'skyux_modal_open_help' | skyLibResources\"\n (click)=\"helpButtonClick()\"\n >\n <sky-icon icon=\"question-circle\"></sky-icon>\n </button>\n\n <button\n type=\"button\"\n class=\"sky-btn sky-modal-btn-close\"\n [attr.aria-label]=\"'skyux_modal_close' | skyLibResources\"\n (click)=\"closeButtonClick()\"\n >\n <sky-icon icon=\"close\"></sky-icon>\n </button>\n </div>\n </div>\n <div\n class=\"sky-modal-content sky-padding-even-large\"\n role=\"region\"\n tabindex=\"0\"\n [attr.aria-labelledby]=\"modalHeaderId\"\n [attr.id]=\"modalContentId\"\n (skyModalScrollShadow)=\"scrollShadowChange($event)\"\n #modalContentWrapper\n >\n <ng-content select=\"sky-modal-content\"></ng-content>\n </div>\n <div\n class=\"sky-modal-footer\"\n [ngStyle]=\"{\n 'box-shadow': scrollShadow?.bottomShadow\n }\"\n >\n <ng-content select=\"sky-modal-footer\"></ng-content>\n </div>\n </div>\n</div>\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
1
|
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
3
|
import { RouterModule } from '@angular/router';
|
|
4
4
|
import { SkyIconModule } from '@skyux/indicators';
|
|
5
5
|
import { SkyThemeModule } from '@skyux/theme';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"modal.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/modals/src/lib/modules/modal/modal.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;;AA0BtD,MAAM,OAAO,cAAc;;4GAAd,cAAc;6GAAd,cAAc,iBAtBvB,iBAAiB;QACjB,wBAAwB;QACxB,uBAAuB;QACvB,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B,aAG7B,YAAY;QACZ,YAAY;QACZ,aAAa;QACb,wBAAwB;QACxB,cAAc,aAGd,iBAAiB;QACjB,wBAAwB;QACxB,uBAAuB;QACvB,uBAAuB;6GAId,cAAc,YAfhB;YACP,YAAY;YACZ,YAAY;YACZ,aAAa;YACb,wBAAwB;YACxB,cAAc;SACf;4FASU,cAAc;kBAxB1B,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,iBAAiB;wBACjB,wBAAwB;wBACxB,uBAAuB;wBACvB,uBAAuB;wBACvB,qBAAqB;wBACrB,6BAA6B;qBAC9B;oBACD,OAAO,EAAE;wBACP,YAAY;wBACZ,YAAY;wBACZ,aAAa;wBACb,wBAAwB;wBACxB,cAAc;qBACf;oBACD,OAAO,EAAE;wBACP,iBAAiB;wBACjB,wBAAwB;wBACxB,uBAAuB;wBACvB,uBAAuB;qBACxB;oBACD,eAAe,EAAE,CAAC,qBAAqB,CAAC;iBACzC","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { SkyIconModule } from '@skyux/indicators';\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyModalsResourcesModule } from '../shared/sky-modals-resources.module';\n\nimport { SkyModalContentComponent } from './modal-content.component';\nimport { SkyModalFooterComponent } from './modal-footer.component';\nimport { SkyModalHeaderComponent } from './modal-header.component';\nimport { SkyModalHostComponent } from './modal-host.component';\nimport { SkyModalScrollShadowDirective } from './modal-scroll-shadow.directive';\nimport { SkyModalComponent } from './modal.component';\n\n@NgModule({\n declarations: [\n SkyModalComponent,\n SkyModalContentComponent,\n SkyModalFooterComponent,\n SkyModalHeaderComponent,\n SkyModalHostComponent,\n SkyModalScrollShadowDirective,\n ],\n imports: [\n CommonModule,\n RouterModule,\n SkyIconModule,\n SkyModalsResourcesModule,\n SkyThemeModule,\n ],\n exports: [\n SkyModalComponent,\n SkyModalContentComponent,\n SkyModalFooterComponent,\n SkyModalHeaderComponent,\n ],\n entryComponents: [SkyModalHostComponent],\n})\nexport class SkyModalModule {}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { SkyDynamicComponentService } from '@skyux/core';
|
|
3
|
-
import { SkyModalInstance } from './modal-instance';
|
|
4
3
|
import { SkyModalHostComponent } from './modal-host.component';
|
|
4
|
+
import { SkyModalInstance } from './modal-instance';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
import * as i1 from "@skyux/core";
|
|
7
7
|
/**
|
|
@@ -31,9 +31,9 @@ export class SkyModalService {
|
|
|
31
31
|
* @param {SkyModalConfigurationInterface} config Populates the modal based on the `SkyModalConfigurationInterface` object.
|
|
32
32
|
*/
|
|
33
33
|
open(component, config) {
|
|
34
|
-
|
|
34
|
+
const modalInstance = new SkyModalInstance();
|
|
35
35
|
this.createHostComponent();
|
|
36
|
-
|
|
36
|
+
const params = this.getConfigFromParameter(config);
|
|
37
37
|
params.providers.push({
|
|
38
38
|
provide: SkyModalInstance,
|
|
39
39
|
useValue: modalInstance,
|
|
@@ -42,7 +42,7 @@ export class SkyModalService {
|
|
|
42
42
|
return modalInstance;
|
|
43
43
|
}
|
|
44
44
|
getConfigFromParameter(providersOrConfig) {
|
|
45
|
-
|
|
45
|
+
const defaultParams = {
|
|
46
46
|
providers: [],
|
|
47
47
|
fullPage: false,
|
|
48
48
|
size: 'medium',
|