@skyux/popovers 5.9.1 → 5.9.4
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-popovers-testing.umd.js +12 -6
- package/bundles/skyux-popovers.umd.js +397 -69
- package/documentation.json +422 -334
- package/esm2015/index.js +1 -0
- package/esm2015/index.js.map +1 -1
- package/esm2015/lib/modules/dropdown/dropdown-item.component.js.map +1 -1
- package/esm2015/lib/modules/dropdown/dropdown-menu.component.js +1 -4
- package/esm2015/lib/modules/dropdown/dropdown-menu.component.js.map +1 -1
- package/esm2015/lib/modules/dropdown/dropdown.component.js +10 -7
- package/esm2015/lib/modules/dropdown/dropdown.component.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-content.component.js +19 -42
- package/esm2015/lib/modules/popover/popover-content.component.js.map +1 -1
- package/esm2015/lib/modules/popover/popover-context.js.map +1 -1
- package/esm2015/lib/modules/popover/popover.component.js +13 -6
- package/esm2015/lib/modules/popover/popover.component.js.map +1 -1
- package/esm2015/lib/modules/popover/popover.directive.js +29 -10
- package/esm2015/lib/modules/popover/popover.directive.js.map +1 -1
- package/esm2015/lib/modules/popover/types/popover-type.js +2 -0
- package/esm2015/lib/modules/popover/types/popover-type.js.map +1 -0
- package/esm2015/testing/dropdown/dropdown-fixture.js +7 -1
- package/esm2015/testing/dropdown/dropdown-fixture.js.map +1 -1
- package/esm2015/testing/dropdown/popovers-fixture-dropdown.js.map +1 -1
- package/esm2015/testing/popover/popover-fixture.js +8 -8
- package/esm2015/testing/popover/popover-fixture.js.map +1 -1
- package/fesm2015/skyux-popovers-testing.js +15 -9
- package/fesm2015/skyux-popovers-testing.js.map +1 -1
- package/fesm2015/skyux-popovers.js +71 -69
- package/fesm2015/skyux-popovers.js.map +1 -1
- package/index.d.ts +1 -0
- package/lib/modules/dropdown/dropdown-item.component.d.ts +1 -1
- package/lib/modules/dropdown/dropdown-menu.component.d.ts +3 -3
- package/lib/modules/dropdown/dropdown.component.d.ts +12 -12
- package/lib/modules/popover/popover-content.component.d.ts +13 -12
- package/lib/modules/popover/popover-context.d.ts +2 -2
- package/lib/modules/popover/popover.component.d.ts +9 -9
- package/lib/modules/popover/popover.directive.d.ts +10 -9
- package/lib/modules/popover/types/popover-type.d.ts +4 -0
- package/package.json +6 -6
- package/testing/dropdown/dropdown-fixture.d.ts +7 -7
- package/testing/dropdown/popovers-fixture-dropdown.d.ts +2 -2
- package/testing/popover/popover-fixture.d.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-content.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-content.component.ts","../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-content.component.html"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,UAAU,EAGV,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EAEtB,eAAe,EAEf,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAc,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;;;;;;;AAI9B;;GAEG;AAQH,MAAM,OAAO,0BAA0B;IAmErC,YACU,cAAiC,EACjC,UAAsB,EACtB,YAA6B,EAC7B,kBAAyC,EACzC,cAAwC,EAC5B,OAA2B,EAC3B,QAA0B;QANtC,mBAA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AAC;wBACvB,KAAK,CAAC,eAAe,EAAE,CAAC;qBACzB;oBACD,MAAM;aACT;QACH,CAAC,CAAC,CAAC;IACP,CAAC;;wHAjUU,0BAA0B;4GAA1B,0BAA0B,8CAF1B,CAAC,wBAAwB,CAAC,2GA0C7B,UAAU,iHAMV,UAAU,uHAMV,gBAAgB,2CChG1B,2kDA2DA,y+QDlBc,CAAC,mBAAmB,CAAC;4FAGtB,0BAA0B;kBAPtC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,WAAW,EAAE,kCAAkC;oBAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;oBAC/C,UAAU,EAAE,CAAC,mBAAmB,CAAC;oBACjC,SAAS,EAAE,CAAC,wBAAwB,CAAC;iBACtC;;0BA0EI,QAAQ;;0BACR,QAAQ;4CA/BH,QAAQ;sBAJf,SAAS;uBAAC,UAAU,EAAE;wBACrB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBAOO,UAAU;sBAJjB,SAAS;uBAAC,YAAY,EAAE;wBACvB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBAOO,aAAa;sBAJpB,SAAS;uBAAC,eAAe,EAAE;wBAC1B,IAAI,EAAE,gBAAgB;wBACtB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import { AnimationEvent } from '@angular/animations';\nimport {\n ChangeDetectorRef,\n Component,\n ElementRef,\n OnDestroy,\n OnInit,\n Optional,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport {\n SkyAffixAutoFitContext,\n SkyAffixConfig,\n SkyAffixService,\n SkyAffixer,\n SkyCoreAdapterService,\n} from '@skyux/core';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Observable, Subject, fromEvent as observableFromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverAdapterService } from './popover-adapter.service';\nimport { skyPopoverAnimation } from './popover-animation';\nimport { SkyPopoverAnimationState } from './popover-animation-state';\nimport { SkyPopoverContext } from './popover-context';\nimport {\n parseAffixHorizontalAlignment,\n parseAffixPlacement,\n} from './popover-extensions';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverPlacement } from './types/popover-placement';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-popover-content',\n templateUrl: './popover-content.component.html',\n styleUrls: ['./popover-content.component.scss'],\n animations: [skyPopoverAnimation],\n providers: [SkyPopoverAdapterService],\n})\nexport class SkyPopoverContentComponent implements OnInit, OnDestroy {\n public get animationState(): SkyPopoverAnimationState {\n return this.isOpen ? 'open' : 'closed';\n }\n\n public get closed(): Observable<void> {\n return this._closed.asObservable();\n }\n\n public get opened(): Observable<void> {\n return this._opened.asObservable();\n }\n\n public get isMouseEnter(): Observable<boolean> {\n return this._isMouseEnter.asObservable();\n }\n\n public affixer: SkyAffixer;\n\n public arrowLeft: number;\n\n public arrowTop: number;\n\n public dismissOnBlur = true;\n\n public enableAnimations = true;\n\n public horizontalAlignment: SkyPopoverAlignment;\n\n public isOpen = false;\n\n public placement: SkyPopoverPlacement;\n\n public popoverTitle: string;\n\n public popoverType: 'danger' | 'info' = 'info';\n\n public themeName: string;\n\n @ViewChild('arrowRef', {\n read: ElementRef,\n static: true,\n })\n private arrowRef: ElementRef;\n\n @ViewChild('popoverRef', {\n read: ElementRef,\n static: true,\n })\n private popoverRef: ElementRef;\n\n @ViewChild('contentTarget', {\n read: ViewContainerRef,\n static: true,\n })\n private contentTarget: ViewContainerRef;\n\n private caller: ElementRef;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _closed = new Subject<void>();\n\n private _isMouseEnter = new Subject<boolean>();\n\n private _opened = new Subject<void>();\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private elementRef: ElementRef,\n private affixService: SkyAffixService,\n private coreAdapterService: SkyCoreAdapterService,\n private adapterService: SkyPopoverAdapterService,\n @Optional() private context?: SkyPopoverContext,\n @Optional() private themeSvc?: SkyThemeService\n ) {}\n\n public ngOnInit(): void {\n /*istanbul ignore next*/\n this.contentTarget.createEmbeddedView(this.context?.contentTemplateRef);\n this.addEventListeners();\n\n /*istanbul ignore else*/\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((themeSettings) => {\n /*istanbul ignore next*/\n this.themeName = themeSettings.currentSettings?.theme?.name;\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n this._closed.complete();\n this._isMouseEnter.complete();\n this._opened.complete();\n\n /* istanbul ignore else */\n if (this.affixer) {\n this.affixer.destroy();\n }\n\n this._closed =\n this._isMouseEnter =\n this._opened =\n this.affixer =\n this.ngUnsubscribe =\n undefined;\n }\n\n public onAnimationEvent(event: AnimationEvent): void {\n if (event.fromState === 'void') {\n return;\n }\n\n if (event.phaseName === 'done') {\n if (event.toState === 'open') {\n /*istanbul ignore next*/\n this._opened?.next();\n } else {\n /*istanbul ignore next*/\n this._closed?.next();\n }\n }\n }\n\n public open(\n caller: ElementRef,\n config: {\n dismissOnBlur: boolean;\n enableAnimations: boolean;\n horizontalAlignment: SkyPopoverAlignment;\n isStatic: boolean;\n placement: SkyPopoverPlacement;\n popoverTitle: string;\n popoverType?: 'danger' | 'info';\n }\n ): void {\n this.caller = caller;\n this.dismissOnBlur = config.dismissOnBlur;\n this.enableAnimations = config.enableAnimations;\n this.horizontalAlignment = config.horizontalAlignment;\n this.placement = config.placement;\n this.popoverTitle = config.popoverTitle;\n if (config.popoverType) {\n this.popoverType = config.popoverType;\n }\n\n this.changeDetector.markForCheck();\n\n // Indicates if the popover should be displayed statically.\n // Please note: This feature is internal-only and used by the visual tests to capture multiple\n // states simultaneously without the overhead of event listeners.\n /* istanbul ignore if */\n if (config.isStatic) {\n this.isOpen = true;\n this.changeDetector.markForCheck();\n return;\n }\n\n // Let the styles render before gauging the affix dimensions.\n setTimeout(() => {\n /*istanbul ignore next*/\n if (\n !this.popoverRef?.nativeElement ||\n !this.ngUnsubscribe ||\n this.ngUnsubscribe.isStopped\n ) {\n return;\n }\n\n if (!this.affixer) {\n this.setupAffixer();\n }\n\n const affixOptions: SkyAffixConfig = {\n autoFitContext: SkyAffixAutoFitContext.Viewport,\n enableAutoFit: true,\n horizontalAlignment: parseAffixHorizontalAlignment(\n this.horizontalAlignment\n ),\n isSticky: true,\n placement: parseAffixPlacement(this.placement),\n };\n\n // Ensure that we are positioning the vertical alginment correctly. These\n // are the default alignments for all popovers but ensure that we are future proof here.\n if (\n affixOptions.placement === 'left' ||\n affixOptions.placement === 'right'\n ) {\n affixOptions.verticalAlignment = 'middle';\n } else if (affixOptions.placement === 'above') {\n affixOptions.verticalAlignment = 'bottom';\n } else {\n affixOptions.verticalAlignment = 'top';\n }\n\n this.affixer.affixTo(this.caller.nativeElement, affixOptions);\n\n this.updateArrowOffset();\n\n this.isOpen = true;\n this.changeDetector.markForCheck();\n });\n }\n\n public close(): void {\n this.isOpen = false;\n this.changeDetector.markForCheck();\n }\n\n public applyFocus(): void {\n if (this.isOpen) {\n this.coreAdapterService.getFocusableChildrenAndApplyFocus(\n this.popoverRef,\n '.sky-popover',\n true\n );\n }\n }\n\n private setupAffixer(): void {\n const affixer = this.affixService.createAffixer(this.popoverRef);\n\n affixer.offsetChange.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.updateArrowOffset();\n this.changeDetector.markForCheck();\n });\n\n affixer.overflowScroll.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.updateArrowOffset();\n this.changeDetector.markForCheck();\n });\n\n affixer.placementChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((change) => {\n this.placement = change.placement;\n this.changeDetector.markForCheck();\n });\n\n this.affixer = affixer;\n }\n\n private updateArrowOffset(): void {\n const { top, left } = this.adapterService.getArrowCoordinates(\n {\n caller: this.caller,\n popover: this.popoverRef,\n popoverArrow: this.arrowRef,\n },\n this.placement,\n this.themeName\n );\n\n this.arrowTop = top;\n this.arrowLeft = left;\n }\n\n private isFocusLeavingElement(event: KeyboardEvent): boolean {\n const focusableItems = this.coreAdapterService.getFocusableChildren(\n this.elementRef.nativeElement\n );\n\n const isFirstItem = focusableItems[0] === event.target && event.shiftKey;\n\n const isLastItem =\n focusableItems[focusableItems.length - 1] === event.target &&\n !event.shiftKey;\n\n return focusableItems.length === 0 || isFirstItem || isLastItem;\n }\n\n private addEventListeners(): void {\n const hostElement = this.elementRef.nativeElement;\n\n observableFromEvent(hostElement, 'mouseenter')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => this._isMouseEnter.next(true));\n\n observableFromEvent(hostElement, 'mouseleave')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => this._isMouseEnter.next(false));\n\n observableFromEvent(hostElement, 'keydown')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((event: KeyboardEvent) => {\n const key = event.key.toLowerCase();\n\n /* tslint:disable-next-line:switch-default */\n switch (key) {\n case 'escape':\n this.close();\n this.caller.nativeElement.focus();\n event.preventDefault();\n event.stopPropagation();\n break;\n\n // Since the popover now lives in an overlay at the bottom of the document body, we need\n // to handle the tab key ourselves. Otherwise, focus would be moved to the browser's\n // search bar.\n case 'tab':\n if (!this.dismissOnBlur) {\n return;\n }\n\n /*istanbul ignore else*/\n if (this.isFocusLeavingElement(event)) {\n this.close();\n this.caller.nativeElement.focus();\n event.preventDefault();\n event.stopPropagation();\n }\n break;\n }\n });\n }\n}\n","<div\n class=\"sky-popover-container sky-popover-max-height\"\n [@.disabled]=\"!enableAnimations\"\n [@skyPopoverAnimation]=\"animationState\"\n [class.sky-popover-hidden]=\"!placement\"\n [ngClass]=\"[\n 'sky-popover-alignment-' + horizontalAlignment,\n 'sky-popover-placement-' + placement,\n 'sky-popover-' + popoverType\n ]\"\n (@skyPopoverAnimation.done)=\"onAnimationEvent($event)\"\n (@skyPopoverAnimation.start)=\"onAnimationEvent($event)\"\n #popoverRef\n>\n <div\n class=\"sky-popover\"\n tabindex=\"-1\"\n [skyThemeClass]=\"{\n 'sky-rounded-corners sky-shadow': 'default',\n 'sky-elevation-4': 'modern'\n }\"\n >\n <header\n *ngIf=\"popoverTitle\"\n class=\"sky-popover-header\"\n [skyThemeClass]=\"{\n 'sky-padding-even-default': 'default',\n 'sky-padding-even-lg sky-margin-stacked-lg': 'modern'\n }\"\n >\n <h1\n *ngIf=\"popoverTitle\"\n class=\"sky-popover-title\"\n [skyThemeClass]=\"{\n 'sky-emphasized': 'default',\n 'sky-font-emphasized': 'modern'\n }\"\n >\n {{ popoverTitle }}\n </h1>\n </header>\n <div\n class=\"sky-popover-body\"\n [skyThemeClass]=\"{\n 'sky-padding-even-default': 'default',\n 'sky-padding-even-lg': 'modern'\n }\"\n >\n <ng-container #contentTarget></ng-container>\n </div>\n <span\n aria-hidden=\"true\"\n class=\"sky-popover-arrow\"\n [style.left.px]=\"arrowLeft\"\n [style.top.px]=\"arrowTop\"\n #arrowRef\n ></span>\n </div>\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"popover-content.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-content.component.ts","../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-content.component.html"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,UAAU,EAGV,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,sBAAsB,EAEtB,eAAe,EAEf,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAc,OAAO,EAAE,SAAS,IAAI,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,mB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C;;wHA9SU,0BAA0B;4GAA1B,0BAA0B,8CAF1B,CAAC,wBAAwB,CAAC,2GA0C7B,UAAU,iHAMV,UAAU,uHAMV,gBAAgB,2CCjG1B,2kDA2DA,y+QDjBc,CAAC,mBAAmB,CAAC;4FAGtB,0BAA0B;kBAPtC,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,WAAW,EAAE,kCAAkC;oBAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;oBAC/C,UAAU,EAAE,CAAC,mBAAmB,CAAC;oBACjC,SAAS,EAAE,CAAC,wBAAwB,CAAC;iBACtC;;0BA2EI,QAAQ;4CA/BH,QAAQ;sBAJf,SAAS;uBAAC,UAAU,EAAE;wBACrB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBAOO,UAAU;sBAJjB,SAAS;uBAAC,YAAY,EAAE;wBACvB,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE,IAAI;qBACb;gBAOO,aAAa;sBAJpB,SAAS;uBAAC,eAAe,EAAE;wBAC1B,IAAI,EAAE,gBAAgB;wBACtB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import { AnimationEvent } from '@angular/animations';\nimport {\n ChangeDetectorRef,\n Component,\n ElementRef,\n OnDestroy,\n OnInit,\n Optional,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport {\n SkyAffixAutoFitContext,\n SkyAffixConfig,\n SkyAffixService,\n SkyAffixer,\n SkyCoreAdapterService,\n} from '@skyux/core';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport { Observable, Subject, fromEvent as observableFromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverAdapterService } from './popover-adapter.service';\nimport { skyPopoverAnimation } from './popover-animation';\nimport { SkyPopoverAnimationState } from './popover-animation-state';\nimport { SkyPopoverContext } from './popover-context';\nimport {\n parseAffixHorizontalAlignment,\n parseAffixPlacement,\n} from './popover-extensions';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverPlacement } from './types/popover-placement';\nimport { SkyPopoverType } from './types/popover-type';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-popover-content',\n templateUrl: './popover-content.component.html',\n styleUrls: ['./popover-content.component.scss'],\n animations: [skyPopoverAnimation],\n providers: [SkyPopoverAdapterService],\n})\nexport class SkyPopoverContentComponent implements OnInit, OnDestroy {\n public get animationState(): SkyPopoverAnimationState {\n return this.isOpen ? 'open' : 'closed';\n }\n\n public get closed(): Observable<void> {\n return this._closed.asObservable();\n }\n\n public get opened(): Observable<void> {\n return this._opened.asObservable();\n }\n\n public get isMouseEnter(): Observable<boolean> {\n return this._isMouseEnter.asObservable();\n }\n\n public affixer: SkyAffixer | undefined;\n\n public arrowLeft: number | undefined;\n\n public arrowTop: number | undefined;\n\n public dismissOnBlur = true;\n\n public enableAnimations = true;\n\n public horizontalAlignment!: SkyPopoverAlignment;\n\n public isOpen = false;\n\n public placement: SkyPopoverPlacement | null = null;\n\n public popoverTitle: string | undefined;\n\n public popoverType!: SkyPopoverType;\n\n public themeName: string | undefined;\n\n @ViewChild('arrowRef', {\n read: ElementRef,\n static: true,\n })\n private arrowRef!: ElementRef;\n\n @ViewChild('popoverRef', {\n read: ElementRef,\n static: true,\n })\n private popoverRef!: ElementRef;\n\n @ViewChild('contentTarget', {\n read: ViewContainerRef,\n static: true,\n })\n private contentTarget!: ViewContainerRef;\n\n private caller!: ElementRef;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _closed = new Subject<void>();\n\n private _isMouseEnter = new Subject<boolean>();\n\n private _opened = new Subject<void>();\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private elementRef: ElementRef,\n private affixService: SkyAffixService,\n private coreAdapterService: SkyCoreAdapterService,\n private adapterService: SkyPopoverAdapterService,\n private context: SkyPopoverContext,\n @Optional() private themeSvc?: SkyThemeService\n ) {}\n\n public ngOnInit(): void {\n this.contentTarget.createEmbeddedView(this.context.contentTemplateRef);\n this.addEventListeners();\n\n /*istanbul ignore else*/\n if (this.themeSvc) {\n this.themeSvc.settingsChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((themeSettings) => {\n /*istanbul ignore next*/\n this.themeName = themeSettings.currentSettings?.theme?.name;\n });\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n this._closed.complete();\n this._isMouseEnter.complete();\n this._opened.complete();\n\n /* istanbul ignore else */\n if (this.affixer) {\n this.affixer.destroy();\n this.affixer = undefined;\n }\n }\n\n public onAnimationEvent(event: AnimationEvent): void {\n if (event.fromState === 'void') {\n return;\n }\n\n if (event.phaseName === 'done') {\n if (event.toState === 'open') {\n this._opened.next();\n } else {\n this._closed.next();\n }\n }\n }\n\n public open(\n caller: ElementRef,\n config: {\n dismissOnBlur: boolean;\n enableAnimations: boolean;\n horizontalAlignment: SkyPopoverAlignment;\n isStatic: boolean;\n placement: SkyPopoverPlacement;\n popoverTitle?: string;\n popoverType: SkyPopoverType;\n }\n ): void {\n this.caller = caller;\n this.dismissOnBlur = config.dismissOnBlur;\n this.enableAnimations = config.enableAnimations;\n this.horizontalAlignment = config.horizontalAlignment;\n this.placement = config.placement;\n this.popoverTitle = config.popoverTitle;\n this.popoverType = config.popoverType;\n\n this.changeDetector.markForCheck();\n\n // Indicates if the popover should be displayed statically.\n // Please note: This feature is internal-only and used by the visual tests to capture multiple\n // states simultaneously without the overhead of event listeners.\n /* istanbul ignore if */\n if (config.isStatic) {\n this.isOpen = true;\n this.changeDetector.markForCheck();\n return;\n }\n\n // Let the styles render before gauging the affix dimensions.\n setTimeout(() => {\n if (!this.popoverRef.nativeElement || this.ngUnsubscribe.isStopped) {\n return;\n }\n\n if (!this.affixer) {\n this.setupAffixer();\n }\n\n const affixOptions: SkyAffixConfig = {\n autoFitContext: SkyAffixAutoFitContext.Viewport,\n enableAutoFit: true,\n horizontalAlignment: parseAffixHorizontalAlignment(\n this.horizontalAlignment\n ),\n isSticky: true,\n placement: parseAffixPlacement(this.placement as SkyPopoverPlacement),\n };\n\n // Ensure vertical alignment is set according to the popover's placement value.\n if (\n affixOptions.placement === 'left' ||\n affixOptions.placement === 'right'\n ) {\n affixOptions.verticalAlignment = 'middle';\n }\n\n this.affixer!.affixTo(this.caller.nativeElement, affixOptions);\n\n this.updateArrowOffset();\n\n this.isOpen = true;\n this.changeDetector.markForCheck();\n });\n }\n\n public close(): void {\n this.isOpen = false;\n this.changeDetector.markForCheck();\n }\n\n public applyFocus(): void {\n if (this.isOpen) {\n this.coreAdapterService.getFocusableChildrenAndApplyFocus(\n this.popoverRef,\n '.sky-popover',\n true\n );\n }\n }\n\n private setupAffixer(): void {\n const affixer = this.affixService.createAffixer(this.popoverRef);\n\n affixer.offsetChange.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.updateArrowOffset();\n this.changeDetector.markForCheck();\n });\n\n affixer.overflowScroll.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.updateArrowOffset();\n this.changeDetector.markForCheck();\n });\n\n affixer.placementChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((change) => {\n this.placement = change.placement;\n this.changeDetector.markForCheck();\n });\n\n this.affixer = affixer;\n }\n\n private updateArrowOffset(): void {\n if (this.placement) {\n const { top, left } = this.adapterService.getArrowCoordinates(\n {\n caller: this.caller,\n popover: this.popoverRef,\n popoverArrow: this.arrowRef,\n },\n this.placement,\n this.themeName\n );\n\n this.arrowTop = top;\n this.arrowLeft = left;\n }\n }\n\n private isFocusLeavingElement(event: KeyboardEvent): boolean {\n const focusableItems = this.coreAdapterService.getFocusableChildren(\n this.elementRef.nativeElement\n );\n\n const isFirstItem = focusableItems[0] === event.target && event.shiftKey;\n\n const isLastItem =\n focusableItems[focusableItems.length - 1] === event.target &&\n !event.shiftKey;\n\n return focusableItems.length === 0 || isFirstItem || isLastItem;\n }\n\n private addEventListeners(): void {\n const hostElement = this.elementRef.nativeElement;\n\n observableFromEvent(hostElement, 'mouseenter')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => this._isMouseEnter.next(true));\n\n observableFromEvent(hostElement, 'mouseleave')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => this._isMouseEnter.next(false));\n\n observableFromEvent<KeyboardEvent>(hostElement, 'keydown')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((event) => {\n const key = event.key.toLowerCase();\n\n /* tslint:disable-next-line:switch-default */\n switch (key) {\n case 'escape':\n this.close();\n this.caller.nativeElement.focus();\n event.preventDefault();\n event.stopPropagation();\n break;\n\n // Since the popover now lives in an overlay at the bottom of the document body, we need\n // to handle the tab key ourselves. Otherwise, focus would be moved to the browser's\n // search bar.\n case 'tab':\n if (!this.dismissOnBlur) {\n return;\n }\n\n /*istanbul ignore else*/\n if (this.isFocusLeavingElement(event)) {\n this.close();\n this.caller.nativeElement.focus();\n event.preventDefault();\n event.stopPropagation();\n }\n break;\n }\n });\n }\n}\n","<div\n class=\"sky-popover-container sky-popover-max-height\"\n [@.disabled]=\"!enableAnimations\"\n [@skyPopoverAnimation]=\"animationState\"\n [class.sky-popover-hidden]=\"!placement\"\n [ngClass]=\"[\n 'sky-popover-alignment-' + horizontalAlignment,\n 'sky-popover-placement-' + placement,\n 'sky-popover-' + popoverType\n ]\"\n (@skyPopoverAnimation.done)=\"onAnimationEvent($event)\"\n (@skyPopoverAnimation.start)=\"onAnimationEvent($event)\"\n #popoverRef\n>\n <div\n class=\"sky-popover\"\n tabindex=\"-1\"\n [skyThemeClass]=\"{\n 'sky-rounded-corners sky-shadow': 'default',\n 'sky-elevation-4': 'modern'\n }\"\n >\n <header\n *ngIf=\"popoverTitle\"\n class=\"sky-popover-header\"\n [skyThemeClass]=\"{\n 'sky-padding-even-default': 'default',\n 'sky-padding-even-lg sky-margin-stacked-lg': 'modern'\n }\"\n >\n <h1\n *ngIf=\"popoverTitle\"\n class=\"sky-popover-title\"\n [skyThemeClass]=\"{\n 'sky-emphasized': 'default',\n 'sky-font-emphasized': 'modern'\n }\"\n >\n {{ popoverTitle }}\n </h1>\n </header>\n <div\n class=\"sky-popover-body\"\n [skyThemeClass]=\"{\n 'sky-padding-even-default': 'default',\n 'sky-padding-even-lg': 'modern'\n }\"\n >\n <ng-container #contentTarget></ng-container>\n </div>\n <span\n aria-hidden=\"true\"\n class=\"sky-popover-arrow\"\n [style.left.px]=\"arrowLeft\"\n [style.top.px]=\"arrowTop\"\n #arrowRef\n ></span>\n </div>\n</div>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-context.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-context.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAG5B,YAAY,
|
|
1
|
+
{"version":3,"file":"popover-context.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover-context.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAG5B,YAAY,IAAkD;QAC5D,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC;IACpD,CAAC;CACF","sourcesContent":["import { TemplateRef } from '@angular/core';\n\n/**\n * @dynamic\n * @internal\n */\nexport class SkyPopoverContext {\n public readonly contentTemplateRef: TemplateRef<unknown>;\n\n constructor(args: { contentTemplateRef: TemplateRef<unknown> }) {\n this.contentTemplateRef = args.contentTemplateRef;\n }\n}\n"]}
|
|
@@ -34,8 +34,7 @@ export class SkyPopoverComponent {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Specifies the horizontal alignment of the popover in relation to the trigger element.
|
|
37
|
-
* The `skyPopoverAlignment` property on the popover directive
|
|
38
|
-
* Options include:`"center"`, `"right"`, and `'"left"`.
|
|
37
|
+
* The `skyPopoverAlignment` property on the popover directive takes precedence over this property when specified.
|
|
39
38
|
* @default "center"
|
|
40
39
|
*/
|
|
41
40
|
set alignment(value) {
|
|
@@ -60,8 +59,7 @@ export class SkyPopoverComponent {
|
|
|
60
59
|
}
|
|
61
60
|
/**
|
|
62
61
|
* Specifies the placement of the popover in relation to the trigger element.
|
|
63
|
-
* The `skyPopoverPlacement` property on the popover directive
|
|
64
|
-
* Options include:`"above"`, `"below"`, `"right"`, and `"left"`.
|
|
62
|
+
* The `skyPopoverPlacement` property on the popover directive takes precedence over this property when specified.
|
|
65
63
|
* @default "above"
|
|
66
64
|
*/
|
|
67
65
|
set placement(value) {
|
|
@@ -70,10 +68,19 @@ export class SkyPopoverComponent {
|
|
|
70
68
|
get placement() {
|
|
71
69
|
return this._placement || 'above';
|
|
72
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Specifies the type of popover.
|
|
73
|
+
* @default "info"
|
|
74
|
+
*/
|
|
75
|
+
set popoverType(value) {
|
|
76
|
+
this._popoverType = value;
|
|
77
|
+
}
|
|
78
|
+
get popoverType() {
|
|
79
|
+
return this._popoverType || 'info';
|
|
80
|
+
}
|
|
73
81
|
ngOnDestroy() {
|
|
74
82
|
this.ngUnsubscribe.next();
|
|
75
83
|
this.ngUnsubscribe.complete();
|
|
76
|
-
this.ngUnsubscribe = undefined;
|
|
77
84
|
if (this.overlay) {
|
|
78
85
|
this.overlayService.close(this.overlay);
|
|
79
86
|
this.overlay = undefined;
|
|
@@ -151,7 +158,7 @@ export class SkyPopoverComponent {
|
|
|
151
158
|
});
|
|
152
159
|
contentRef.closed.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
153
160
|
/*istanbul ignore else*/
|
|
154
|
-
if (this.isActive) {
|
|
161
|
+
if (this.isActive && this.overlay) {
|
|
155
162
|
this.overlayService.close(this.overlay);
|
|
156
163
|
this.overlay = undefined;
|
|
157
164
|
this.isActive = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover.component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'@angular/core';\nimport { SkyOverlayInstance, SkyOverlayService } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverContentComponent } from './popover-content.component';\nimport { SkyPopoverContext } from './popover-context';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverPlacement } from './types/popover-placement';\n\n@Component({\n selector: 'sky-popover',\n templateUrl: './popover.component.html',\n})\nexport class SkyPopoverComponent implements OnDestroy {\n /**\n * Specifies the horizontal alignment of the popover in relation to the trigger element.\n * The `skyPopoverAlignment` property on the popover directive overwrites this property.\n * Options include:`\"center\"`, `\"right\"`, and `'\"left\"`.\n * @default \"center\"\n */\n @Input()\n public set alignment(value: SkyPopoverAlignment) {\n this._alignment = value;\n }\n\n public get alignment(): SkyPopoverAlignment {\n return this._alignment || 'center';\n }\n\n /**\n * Indicates whether to close the popover when it loses focus.\n * To require users to click a trigger button to close the popover, set this input to false.\n * @default true\n */\n @Input()\n public set dismissOnBlur(value: boolean) {\n this._dismissOnBlur = value;\n }\n\n public get dismissOnBlur(): boolean {\n if (this._dismissOnBlur === undefined) {\n return true;\n }\n\n return this._dismissOnBlur;\n }\n\n /**\n * Specifies the placement of the popover in relation to the trigger element.\n * The `skyPopoverPlacement` property on the popover directive overwrites this property.\n * Options include:`\"above\"`, `\"below\"`, `\"right\"`, and `\"left\"`.\n * @default \"above\"\n */\n @Input()\n public set placement(value: SkyPopoverPlacement) {\n this._placement = value;\n }\n\n public get placement(): SkyPopoverPlacement {\n return this._placement || 'above';\n }\n\n /**\n * Specifies a title for the popover.\n */\n @Input()\n public popoverTitle: string;\n\n /**\n * Specifies the type of popover.\n * Options include `\"info\"` and `\"danger\"`.\n * @default \"info\"\n */\n @Input()\n public popoverType: 'danger' | 'info';\n\n /**\n * Fires when users close the popover.\n */\n @Output()\n public popoverClosed = new EventEmitter<SkyPopoverComponent>();\n\n /**\n * Fires when users open the popover.\n */\n @Output()\n public popoverOpened = new EventEmitter<SkyPopoverComponent>();\n\n /**\n * Indicates that the popover is in the process of being opened or closed.\n * @internal\n */\n public isActive = false;\n\n /**\n * Used by unit tests to disable animations since the component is injected at the bottom of the\n * document body.\n * @internal\n */\n public enableAnimations = true;\n\n public isMouseEnter = false;\n\n @ViewChild('templateRef', {\n read: TemplateRef,\n static: true,\n })\n private templateRef: TemplateRef<any>;\n\n private contentRef: SkyPopoverContentComponent;\n\n private isMarkedForCloseOnMouseLeave = false;\n\n private ngUnsubscribe = new Subject<void>();\n\n private overlay: SkyOverlayInstance;\n\n private _alignment: SkyPopoverAlignment;\n\n private _dismissOnBlur: boolean;\n\n private _placement: SkyPopoverPlacement;\n\n constructor(private overlayService: SkyOverlayService) {}\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.ngUnsubscribe = undefined;\n\n if (this.overlay) {\n this.overlayService.close(this.overlay);\n this.overlay = undefined;\n }\n }\n\n /**\n * Positions the popover next to a given caller element.\n * @param caller The element that opened the popover.\n * @param placement The placement of the popover.\n * @param alignment The horizontal alignment of the popover.\n * @internal\n */\n public positionNextTo(\n caller: ElementRef,\n placement?: SkyPopoverPlacement,\n alignment?: SkyPopoverAlignment\n ): void {\n if (!this.overlay) {\n this.setupOverlay();\n }\n\n this.placement = placement ?? this.placement;\n this.alignment = alignment ?? this.alignment;\n this.isActive = true;\n\n this.contentRef.open(caller, {\n dismissOnBlur: this.dismissOnBlur,\n enableAnimations: this.enableAnimations,\n horizontalAlignment: this.alignment,\n isStatic: false,\n placement: this.placement,\n popoverTitle: this.popoverTitle,\n popoverType: this.popoverType,\n });\n }\n\n /**\n * Closes the popover.\n * @internal\n */\n public close(): void {\n /*istanbul ignore next*/\n this.contentRef?.close();\n }\n\n /**\n * Brings focus to the popover element if its open.\n * @internal\n */\n public applyFocus(): void {\n /*istanbul ignore next*/\n this.contentRef?.applyFocus();\n }\n\n /**\n * Adds a flag to the popover to close when the mouse leaves the popover's bounds.\n * @internal\n */\n public markForCloseOnMouseLeave(): void {\n this.isMarkedForCloseOnMouseLeave = true;\n }\n\n private setupOverlay(): void {\n const overlay = this.overlayService.create({\n enableScroll: true,\n enablePointerEvents: true,\n });\n\n overlay.backdropClick.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n if (this.dismissOnBlur) {\n this.close();\n }\n });\n\n const contentRef = overlay.attachComponent(SkyPopoverContentComponent, [\n {\n provide: SkyPopoverContext,\n useValue: new SkyPopoverContext({\n contentTemplateRef: this.templateRef,\n }),\n },\n ]);\n\n contentRef.opened.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.popoverOpened.emit(this);\n });\n\n contentRef.closed.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n /*istanbul ignore else*/\n if (this.isActive) {\n this.overlayService.close(this.overlay);\n this.overlay = undefined;\n this.isActive = false;\n this.popoverClosed.emit(this);\n }\n });\n\n contentRef.isMouseEnter\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((isMouseEnter) => {\n this.isMouseEnter = isMouseEnter;\n if (this.isMarkedForCloseOnMouseLeave) {\n this.isMarkedForCloseOnMouseLeave = false;\n this.close();\n }\n });\n\n this.overlay = overlay;\n this.contentRef = contentRef;\n }\n}\n","<ng-template #templateRef>\n <ng-content></ng-content>\n</ng-template>\n"]}
|
|
1
|
+
{"version":3,"file":"popover.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover.component.ts","../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,YAAY,EACZ,KAAK,EAEL,MAAM,EACN,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAsB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C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AAK,CAAC;gBACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,YAAY;aACpB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACnC,SAAS,CAAC,CAAC,YAAY,EAAE,EAAE;YAC1B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;YACjC,IAAI,IAAI,CAAC,4BAA4B,EAAE;gBACrC,IAAI,CAAC,4BAA4B,GAAG,KAAK,CAAC;gBAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;aACd;QACH,CAAC,CAAC,CAAC;QAEL,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;;iHAvOU,mBAAmB;qGAAnB,mBAAmB,6WA8FtB,WAAW,2CCvHrB,2EAGA;4FDsBa,mBAAmB;kBAJ/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,WAAW,EAAE,0BAA0B;iBACxC;wGAQY,SAAS;sBADnB,KAAK;gBAeK,aAAa;sBADvB,KAAK;gBAmBK,SAAS;sBADnB,KAAK;gBAaC,YAAY;sBADlB,KAAK;gBAQK,WAAW;sBADrB,KAAK;gBAaC,aAAa;sBADnB,MAAM;gBAOA,aAAa;sBADnB,MAAM;gBAsBC,WAAW;sBAJlB,SAAS;uBAAC,aAAa,EAAE;wBACxB,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n TemplateRef,\n ViewChild,\n} from '@angular/core';\nimport { SkyOverlayInstance, SkyOverlayService } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverContentComponent } from './popover-content.component';\nimport { SkyPopoverContext } from './popover-context';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverPlacement } from './types/popover-placement';\nimport { SkyPopoverType } from './types/popover-type';\n\n@Component({\n selector: 'sky-popover',\n templateUrl: './popover.component.html',\n})\nexport class SkyPopoverComponent implements OnDestroy {\n /**\n * Specifies the horizontal alignment of the popover in relation to the trigger element.\n * The `skyPopoverAlignment` property on the popover directive takes precedence over this property when specified.\n * @default \"center\"\n */\n @Input()\n public set alignment(value: SkyPopoverAlignment | undefined) {\n this._alignment = value;\n }\n\n public get alignment(): SkyPopoverAlignment {\n return this._alignment || 'center';\n }\n\n /**\n * Indicates whether to close the popover when it loses focus.\n * To require users to click a trigger button to close the popover, set this input to false.\n * @default true\n */\n @Input()\n public set dismissOnBlur(value: boolean | undefined) {\n this._dismissOnBlur = value;\n }\n\n public get dismissOnBlur(): boolean {\n if (this._dismissOnBlur === undefined) {\n return true;\n }\n\n return this._dismissOnBlur;\n }\n\n /**\n * Specifies the placement of the popover in relation to the trigger element.\n * The `skyPopoverPlacement` property on the popover directive takes precedence over this property when specified.\n * @default \"above\"\n */\n @Input()\n public set placement(value: SkyPopoverPlacement) {\n this._placement = value;\n }\n\n public get placement(): SkyPopoverPlacement {\n return this._placement || 'above';\n }\n\n /**\n * Specifies a title for the popover.\n */\n @Input()\n public popoverTitle: string | undefined;\n\n /**\n * Specifies the type of popover.\n * @default \"info\"\n */\n @Input()\n public set popoverType(value: SkyPopoverType | undefined) {\n this._popoverType = value;\n }\n\n public get popoverType(): SkyPopoverType {\n return this._popoverType || 'info';\n }\n\n /**\n * Fires when users close the popover.\n */\n @Output()\n public popoverClosed = new EventEmitter<SkyPopoverComponent>();\n\n /**\n * Fires when users open the popover.\n */\n @Output()\n public popoverOpened = new EventEmitter<SkyPopoverComponent>();\n\n /**\n * Indicates that the popover is in the process of being opened or closed.\n * @internal\n */\n public isActive = false;\n\n /**\n * Used by unit tests to disable animations since the component is injected at the bottom of the\n * document body.\n * @internal\n */\n public enableAnimations = true;\n\n public isMouseEnter = false;\n\n @ViewChild('templateRef', {\n read: TemplateRef,\n static: true,\n })\n private templateRef!: TemplateRef<unknown>;\n\n private contentRef!: SkyPopoverContentComponent;\n\n private isMarkedForCloseOnMouseLeave = false;\n\n private ngUnsubscribe = new Subject<void>();\n\n private overlay: SkyOverlayInstance | undefined;\n\n private _alignment: SkyPopoverAlignment | undefined;\n\n private _dismissOnBlur: boolean | undefined;\n\n private _placement: SkyPopoverPlacement | undefined;\n\n private _popoverType: SkyPopoverType | undefined;\n\n constructor(private overlayService: SkyOverlayService) {}\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n\n if (this.overlay) {\n this.overlayService.close(this.overlay);\n this.overlay = undefined;\n }\n }\n\n /**\n * Positions the popover next to a given caller element.\n * @param caller The element that opened the popover.\n * @param placement The placement of the popover.\n * @param alignment The horizontal alignment of the popover.\n * @internal\n */\n public positionNextTo(\n caller: ElementRef,\n placement?: SkyPopoverPlacement,\n alignment?: SkyPopoverAlignment\n ): void {\n if (!this.overlay) {\n this.setupOverlay();\n }\n\n this.placement = placement ?? this.placement;\n this.alignment = alignment ?? this.alignment;\n this.isActive = true;\n\n this.contentRef.open(caller, {\n dismissOnBlur: this.dismissOnBlur,\n enableAnimations: this.enableAnimations,\n horizontalAlignment: this.alignment,\n isStatic: false,\n placement: this.placement,\n popoverTitle: this.popoverTitle,\n popoverType: this.popoverType,\n });\n }\n\n /**\n * Closes the popover.\n * @internal\n */\n public close(): void {\n /*istanbul ignore next*/\n this.contentRef?.close();\n }\n\n /**\n * Brings focus to the popover element if its open.\n * @internal\n */\n public applyFocus(): void {\n /*istanbul ignore next*/\n this.contentRef?.applyFocus();\n }\n\n /**\n * Adds a flag to the popover to close when the mouse leaves the popover's bounds.\n * @internal\n */\n public markForCloseOnMouseLeave(): void {\n this.isMarkedForCloseOnMouseLeave = true;\n }\n\n private setupOverlay(): void {\n const overlay = this.overlayService.create({\n enableScroll: true,\n enablePointerEvents: true,\n });\n\n overlay.backdropClick.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n if (this.dismissOnBlur) {\n this.close();\n }\n });\n\n const contentRef = overlay.attachComponent(SkyPopoverContentComponent, [\n {\n provide: SkyPopoverContext,\n useValue: new SkyPopoverContext({\n contentTemplateRef: this.templateRef,\n }),\n },\n ]);\n\n contentRef.opened.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.popoverOpened.emit(this);\n });\n\n contentRef.closed.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n /*istanbul ignore else*/\n if (this.isActive && this.overlay) {\n this.overlayService.close(this.overlay);\n this.overlay = undefined;\n this.isActive = false;\n this.popoverClosed.emit(this);\n }\n });\n\n contentRef.isMouseEnter\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((isMouseEnter) => {\n this.isMouseEnter = isMouseEnter;\n if (this.isMarkedForCloseOnMouseLeave) {\n this.isMarkedForCloseOnMouseLeave = false;\n this.close();\n }\n });\n\n this.overlay = overlay;\n this.contentRef = contentRef;\n }\n}\n","<ng-template #templateRef>\n <ng-content></ng-content>\n</ng-template>\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var _SkyPopoverDirective_messageStreamSub;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
1
3
|
import { Directive, ElementRef, Input } from '@angular/core';
|
|
2
4
|
import { Subject, fromEvent as observableFromEvent } from 'rxjs';
|
|
3
5
|
import { takeUntil } from 'rxjs/operators';
|
|
@@ -7,11 +9,20 @@ import * as i0 from "@angular/core";
|
|
|
7
9
|
export class SkyPopoverDirective {
|
|
8
10
|
constructor(elementRef) {
|
|
9
11
|
this.elementRef = elementRef;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
this.skyPopoverMessageStream = new Subject();
|
|
12
|
+
this._skyPopoverMessageStream = new Subject();
|
|
13
|
+
_SkyPopoverDirective_messageStreamSub.set(this, void 0);
|
|
14
14
|
this.ngUnsubscribe = new Subject();
|
|
15
|
+
this.subscribeMessageStream();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Provides an RxJS `Subject` to send commands to the popover that respect the `SkyPopoverMessage` type.
|
|
19
|
+
*/
|
|
20
|
+
set skyPopoverMessageStream(value) {
|
|
21
|
+
this._skyPopoverMessageStream = value !== null && value !== void 0 ? value : new Subject();
|
|
22
|
+
this.subscribeMessageStream();
|
|
23
|
+
}
|
|
24
|
+
get skyPopoverMessageStream() {
|
|
25
|
+
return this._skyPopoverMessageStream;
|
|
15
26
|
}
|
|
16
27
|
/**
|
|
17
28
|
* Specifies the user action that displays the popover.
|
|
@@ -27,6 +38,7 @@ export class SkyPopoverDirective {
|
|
|
27
38
|
}
|
|
28
39
|
ngOnDestroy() {
|
|
29
40
|
this.removeEventListeners();
|
|
41
|
+
this.unsubscribeMessageStream();
|
|
30
42
|
}
|
|
31
43
|
togglePopover() {
|
|
32
44
|
if (this.skyPopover.isActive) {
|
|
@@ -51,11 +63,6 @@ export class SkyPopoverDirective {
|
|
|
51
63
|
}
|
|
52
64
|
addEventListeners() {
|
|
53
65
|
const element = this.elementRef.nativeElement;
|
|
54
|
-
this.skyPopoverMessageStream
|
|
55
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
56
|
-
.subscribe((message) => {
|
|
57
|
-
this.handleIncomingMessages(message);
|
|
58
|
-
});
|
|
59
66
|
observableFromEvent(element, 'keydown')
|
|
60
67
|
.pipe(takeUntil(this.ngUnsubscribe))
|
|
61
68
|
.subscribe((event) => {
|
|
@@ -126,7 +133,6 @@ export class SkyPopoverDirective {
|
|
|
126
133
|
removeEventListeners() {
|
|
127
134
|
this.ngUnsubscribe.next();
|
|
128
135
|
this.ngUnsubscribe.complete();
|
|
129
|
-
this.ngUnsubscribe = undefined;
|
|
130
136
|
}
|
|
131
137
|
handleIncomingMessages(message) {
|
|
132
138
|
/* tslint:disable-next-line:switch-default */
|
|
@@ -154,7 +160,20 @@ export class SkyPopoverDirective {
|
|
|
154
160
|
sendMessage(messageType) {
|
|
155
161
|
this.skyPopoverMessageStream.next({ type: messageType });
|
|
156
162
|
}
|
|
163
|
+
subscribeMessageStream() {
|
|
164
|
+
this.unsubscribeMessageStream();
|
|
165
|
+
__classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, this.skyPopoverMessageStream.subscribe((message) => {
|
|
166
|
+
this.handleIncomingMessages(message);
|
|
167
|
+
}), "f");
|
|
168
|
+
}
|
|
169
|
+
unsubscribeMessageStream() {
|
|
170
|
+
if (__classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f")) {
|
|
171
|
+
__classPrivateFieldGet(this, _SkyPopoverDirective_messageStreamSub, "f").unsubscribe();
|
|
172
|
+
__classPrivateFieldSet(this, _SkyPopoverDirective_messageStreamSub, undefined, "f");
|
|
173
|
+
}
|
|
174
|
+
}
|
|
157
175
|
}
|
|
176
|
+
_SkyPopoverDirective_messageStreamSub = new WeakMap();
|
|
158
177
|
SkyPopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyPopoverDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
159
178
|
SkyPopoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: SkyPopoverDirective, selector: "[skyPopover]", inputs: { skyPopover: "skyPopover", skyPopoverAlignment: "skyPopoverAlignment", skyPopoverMessageStream: "skyPopoverMessageStream", skyPopoverPlacement: "skyPopoverPlacement", skyPopoverTrigger: "skyPopoverTrigger" }, ngImport: i0 });
|
|
160
179
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyPopoverDirective, decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover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GAOQ,UAAU;sBADhB,KAAK;gBASC,mBAAmB;sBADzB,KAAK;gBAOC,uBAAuB;sBAD7B,KAAK;gBASC,mBAAmB;sBADzB,KAAK;gBAOK,iBAAiB;sBAD3B,KAAK","sourcesContent":["import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';\n\nimport { Subject, fromEvent as observableFromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverComponent } from './popover.component';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverMessage } from './types/popover-message';\nimport { SkyPopoverMessageType } from './types/popover-message-type';\nimport { SkyPopoverPlacement } from './types/popover-placement';\nimport { SkyPopoverTrigger } from './types/popover-trigger';\n\n@Directive({\n selector: '[skyPopover]',\n})\nexport class SkyPopoverDirective implements OnInit, OnDestroy {\n /**\n * References the popover component to display. Add this directive to the trigger element that opens the popover.\n * @required\n */\n @Input()\n public skyPopover: SkyPopoverComponent;\n\n /**\n * Specifies the horizontal alignment of the popover in relation to the trigger element.\n * Options include:`\"center\"`, `\"right\"`, and `\"left\"`.\n * @default \"center\"\n */\n @Input()\n public skyPopoverAlignment: SkyPopoverAlignment;\n\n /**\n * Provides an observable to send commands to the popover that respect the `SkyPopoverMessage` type.\n */\n @Input()\n public skyPopoverMessageStream = new Subject<SkyPopoverMessage>();\n\n /**\n * Specifies the placement of the popover in relation to the trigger element.\n * Options include:`\"above\"`, `\"below\"`, `\"right\"`, and `\"left\"`.\n * @default \"above\"\n */\n @Input()\n public skyPopoverPlacement: SkyPopoverPlacement;\n\n /**\n * Specifies the user action that displays the popover.\n */\n @Input()\n public set skyPopoverTrigger(value: SkyPopoverTrigger) {\n this._trigger = value;\n }\n\n public get skyPopoverTrigger(): SkyPopoverTrigger {\n return this._trigger || 'click';\n }\n\n private ngUnsubscribe = new Subject<void>();\n\n private _trigger: SkyPopoverTrigger;\n\n constructor(private elementRef: ElementRef) {}\n\n public ngOnInit(): void {\n this.addEventListeners();\n }\n\n public ngOnDestroy(): void {\n this.removeEventListeners();\n }\n\n public togglePopover(): void {\n if (this.skyPopover.isActive) {\n this.sendMessage(SkyPopoverMessageType.Close);\n return;\n }\n\n this.sendMessage(SkyPopoverMessageType.Open);\n }\n\n private positionPopover(): void {\n this.skyPopover.positionNextTo(\n this.elementRef,\n this.skyPopoverPlacement,\n this.skyPopoverAlignment\n );\n }\n\n private closePopover(): void {\n this.skyPopover.close();\n }\n\n private closePopoverOrMarkForClose(): void {\n if (this.skyPopover.isMouseEnter) {\n this.skyPopover.markForCloseOnMouseLeave();\n } else {\n this.sendMessage(SkyPopoverMessageType.Close);\n }\n }\n\n private addEventListeners(): void {\n const element = this.elementRef.nativeElement;\n\n this.skyPopoverMessageStream\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((message) => {\n this.handleIncomingMessages(message);\n });\n\n observableFromEvent(element, 'keydown')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((event: KeyboardEvent) => {\n if (!this.skyPopover.isActive) {\n return;\n }\n\n const key = event.key.toLowerCase();\n\n /* tslint:disable-next-line:switch-default */\n switch (key) {\n case 'escape':\n this.sendMessage(SkyPopoverMessageType.Close);\n event.preventDefault();\n event.stopPropagation();\n break;\n\n case 'tab':\n if (this.skyPopover.dismissOnBlur) {\n this.sendMessage(SkyPopoverMessageType.Close);\n }\n break;\n\n case 'arrowdown':\n case 'arrowleft':\n case 'arrowright':\n case 'arrowup':\n case 'down':\n case 'left':\n case 'right':\n case 'up':\n this.sendMessage(SkyPopoverMessageType.Focus);\n event.stopPropagation();\n event.preventDefault();\n break;\n }\n });\n\n observableFromEvent(element, 'click')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.togglePopover();\n }\n });\n\n observableFromEvent(element, 'mouseenter')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.skyPopover.isMouseEnter = true;\n if (\n !this.skyPopover.isActive &&\n this.skyPopoverTrigger === 'mouseenter'\n ) {\n this.sendMessage(SkyPopoverMessageType.Open);\n }\n }\n });\n\n observableFromEvent(element, 'mouseleave')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.skyPopover.isMouseEnter = false;\n if (\n this.skyPopover.isActive &&\n this.skyPopoverTrigger === 'mouseenter'\n ) {\n // Give the popover a chance to set its isMouseEnter flag before checking to see\n // if it should be closed.\n setTimeout(() => {\n this.closePopoverOrMarkForClose();\n });\n }\n }\n });\n }\n\n private removeEventListeners(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n this.ngUnsubscribe = undefined;\n }\n\n private handleIncomingMessages(message: SkyPopoverMessage): void {\n /* tslint:disable-next-line:switch-default */\n switch (message.type) {\n case SkyPopoverMessageType.Open:\n this.positionPopover();\n break;\n\n case SkyPopoverMessageType.Close:\n /*istanbul ignore else*/\n if (this.skyPopover.isActive) {\n this.closePopover();\n }\n break;\n\n case SkyPopoverMessageType.Reposition:\n // Only reposition the popover if it is already open.\n if (this.skyPopover.isActive) {\n this.positionPopover();\n }\n break;\n\n case SkyPopoverMessageType.Focus:\n this.skyPopover.applyFocus();\n break;\n }\n }\n\n private sendMessage(messageType: SkyPopoverMessageType): void {\n this.skyPopoverMessageStream.next({ type: messageType });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"popover.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/popovers/src/lib/modules/popover/popover.directive.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAgB,SAAS,IAAI,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EA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AAC,WAAW,EAAE,CAAC;YACrC,uBAAA,IAAI,yCAAqB,SAAS,MAAA,CAAC;SACpC;IACH,CAAC;;;iHAtOU,mBAAmB;qGAAnB,mBAAmB;4FAAnB,mBAAmB;kBAH/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;iBACzB;iGAOQ,UAAU;sBADhB,KAAK;gBAOC,mBAAmB;sBADzB,KAAK;gBAOK,uBAAuB;sBADjC,KAAK;gBAoBC,mBAAmB;sBADzB,KAAK;gBAOK,iBAAiB;sBAD3B,KAAK","sourcesContent":["import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';\n\nimport { Subject, Subscription, fromEvent as observableFromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyPopoverComponent } from './popover.component';\nimport { SkyPopoverAlignment } from './types/popover-alignment';\nimport { SkyPopoverMessage } from './types/popover-message';\nimport { SkyPopoverMessageType } from './types/popover-message-type';\nimport { SkyPopoverPlacement } from './types/popover-placement';\nimport { SkyPopoverTrigger } from './types/popover-trigger';\n\n@Directive({\n selector: '[skyPopover]',\n})\nexport class SkyPopoverDirective implements OnInit, OnDestroy {\n /**\n * References the popover component to display. Add this directive to the trigger element that opens the popover.\n * @required\n */\n @Input()\n public skyPopover!: SkyPopoverComponent;\n\n /**\n * Specifies the horizontal alignment of the popover in relation to the trigger element.\n */\n @Input()\n public skyPopoverAlignment: SkyPopoverAlignment | undefined;\n\n /**\n * Provides an RxJS `Subject` to send commands to the popover that respect the `SkyPopoverMessage` type.\n */\n @Input()\n public set skyPopoverMessageStream(\n value: Subject<SkyPopoverMessage> | undefined\n ) {\n this._skyPopoverMessageStream = value ?? new Subject<SkyPopoverMessage>();\n this.subscribeMessageStream();\n }\n\n public get skyPopoverMessageStream(): Subject<SkyPopoverMessage> {\n return this._skyPopoverMessageStream;\n }\n\n private _skyPopoverMessageStream = new Subject<SkyPopoverMessage>();\n\n #messageStreamSub: Subscription | undefined;\n\n /**\n * Specifies the placement of the popover in relation to the trigger element.\n */\n @Input()\n public skyPopoverPlacement: SkyPopoverPlacement | undefined;\n\n /**\n * Specifies the user action that displays the popover.\n */\n @Input()\n public set skyPopoverTrigger(value: SkyPopoverTrigger | undefined) {\n this._trigger = value;\n }\n\n public get skyPopoverTrigger(): SkyPopoverTrigger {\n return this._trigger || 'click';\n }\n\n private ngUnsubscribe = new Subject<void>();\n\n private _trigger: SkyPopoverTrigger | undefined;\n\n constructor(private elementRef: ElementRef) {\n this.subscribeMessageStream();\n }\n\n public ngOnInit(): void {\n this.addEventListeners();\n }\n\n public ngOnDestroy(): void {\n this.removeEventListeners();\n this.unsubscribeMessageStream();\n }\n\n public togglePopover(): void {\n if (this.skyPopover.isActive) {\n this.sendMessage(SkyPopoverMessageType.Close);\n return;\n }\n\n this.sendMessage(SkyPopoverMessageType.Open);\n }\n\n private positionPopover(): void {\n this.skyPopover.positionNextTo(\n this.elementRef,\n this.skyPopoverPlacement,\n this.skyPopoverAlignment\n );\n }\n\n private closePopover(): void {\n this.skyPopover.close();\n }\n\n private closePopoverOrMarkForClose(): void {\n if (this.skyPopover.isMouseEnter) {\n this.skyPopover.markForCloseOnMouseLeave();\n } else {\n this.sendMessage(SkyPopoverMessageType.Close);\n }\n }\n\n private addEventListeners(): void {\n const element = this.elementRef.nativeElement;\n\n observableFromEvent<KeyboardEvent>(element, 'keydown')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((event) => {\n if (!this.skyPopover.isActive) {\n return;\n }\n\n const key = event.key.toLowerCase();\n\n /* tslint:disable-next-line:switch-default */\n switch (key) {\n case 'escape':\n this.sendMessage(SkyPopoverMessageType.Close);\n event.preventDefault();\n event.stopPropagation();\n break;\n\n case 'tab':\n if (this.skyPopover.dismissOnBlur) {\n this.sendMessage(SkyPopoverMessageType.Close);\n }\n break;\n\n case 'arrowdown':\n case 'arrowleft':\n case 'arrowright':\n case 'arrowup':\n case 'down':\n case 'left':\n case 'right':\n case 'up':\n this.sendMessage(SkyPopoverMessageType.Focus);\n event.stopPropagation();\n event.preventDefault();\n break;\n }\n });\n\n observableFromEvent(element, 'click')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.togglePopover();\n }\n });\n\n observableFromEvent(element, 'mouseenter')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.skyPopover.isMouseEnter = true;\n if (\n !this.skyPopover.isActive &&\n this.skyPopoverTrigger === 'mouseenter'\n ) {\n this.sendMessage(SkyPopoverMessageType.Open);\n }\n }\n });\n\n observableFromEvent(element, 'mouseleave')\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n if (this.skyPopover) {\n this.skyPopover.isMouseEnter = false;\n if (\n this.skyPopover.isActive &&\n this.skyPopoverTrigger === 'mouseenter'\n ) {\n // Give the popover a chance to set its isMouseEnter flag before checking to see\n // if it should be closed.\n setTimeout(() => {\n this.closePopoverOrMarkForClose();\n });\n }\n }\n });\n }\n\n private removeEventListeners(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n private handleIncomingMessages(message: SkyPopoverMessage): void {\n /* tslint:disable-next-line:switch-default */\n switch (message.type) {\n case SkyPopoverMessageType.Open:\n this.positionPopover();\n break;\n\n case SkyPopoverMessageType.Close:\n /*istanbul ignore else*/\n if (this.skyPopover.isActive) {\n this.closePopover();\n }\n break;\n\n case SkyPopoverMessageType.Reposition:\n // Only reposition the popover if it is already open.\n if (this.skyPopover.isActive) {\n this.positionPopover();\n }\n break;\n\n case SkyPopoverMessageType.Focus:\n this.skyPopover.applyFocus();\n break;\n }\n }\n\n private sendMessage(messageType: SkyPopoverMessageType): void {\n this.skyPopoverMessageStream.next({ type: messageType });\n }\n\n private subscribeMessageStream(): void {\n this.unsubscribeMessageStream();\n\n this.#messageStreamSub = this.skyPopoverMessageStream.subscribe(\n (message) => {\n this.handleIncomingMessages(message);\n }\n );\n }\n\n private unsubscribeMessageStream(): void {\n if (this.#messageStreamSub) {\n this.#messageStreamSub.unsubscribe();\n this.#messageStreamSub = undefined;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover-type.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/popovers/src/lib/modules/popover/types/popover-type.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The style type of the popover.\n */\nexport type SkyPopoverType = 'danger' | 'info';\n"]}
|
|
@@ -71,6 +71,9 @@ export class SkyDropdownFixture {
|
|
|
71
71
|
clickDropdownItem(index) {
|
|
72
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
73
|
const itemEls = this.getDropdownItemEls();
|
|
74
|
+
if (!itemEls) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
74
77
|
if (index >= itemEls.length) {
|
|
75
78
|
throw new Error(`There is no dropdown item at index ${index}.`);
|
|
76
79
|
}
|
|
@@ -84,6 +87,9 @@ export class SkyDropdownFixture {
|
|
|
84
87
|
*/
|
|
85
88
|
getDropdownItem(index) {
|
|
86
89
|
const itemEls = this.getDropdownItemEls();
|
|
90
|
+
if (!itemEls) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
87
93
|
if (index >= itemEls.length) {
|
|
88
94
|
throw new Error(`There is no dropdown item at index ${index}.`);
|
|
89
95
|
}
|
|
@@ -125,7 +131,7 @@ export class SkyDropdownFixture {
|
|
|
125
131
|
}
|
|
126
132
|
getButtonType(classNames) {
|
|
127
133
|
const prefix = 'sky-dropdown-button-type-';
|
|
128
|
-
for (
|
|
134
|
+
for (const i in classNames) {
|
|
129
135
|
if (classNames[i]) {
|
|
130
136
|
if (i.indexOf(prefix) > -1) {
|
|
131
137
|
return i.replace(prefix, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAuD7B,YAAoB,
|
|
1
|
+
{"version":3,"file":"dropdown-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/dropdown-fixture.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAuD7B,YAAoB,OAAkC,EAAE,SAAiB;QAArD,YAAO,GAAP,OAAO,CAA2B;QACpD,IAAI,CAAC,OAAO,GAAG,iBAAiB,CAAC,uBAAuB,CACtD,OAAO,EACP,SAAS,EACT,cAAc,CACf,CAAC;IACJ,CAAC;IA5DD;;OAEG;IACH,IAAW,QAAQ;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC;QAEvC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;YAChD,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;YAC9C,QAAQ,EAAE,MAAM,CAAC,aAAa,CAAC,QAAQ;YACvC,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,YAAY,CAAC;YACtD,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC;SAClD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAW,kBAAkB;QAC3B,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,MAAM,I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BAC1B,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;iBAC9B;aACF;SACF;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyPopoversFixtureDropdown } from './popovers-fixture-dropdown';\nimport { SkyPopoversFixtureDropdownItem } from './popovers-fixture-dropdown-item';\nimport { SkyPopoversFixtureDropdownMenu } from './popovers-fixture-dropdown-menu';\n\n/**\n * Provides information for and interaction with a SKY UX dropdown component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyDropdownFixture {\n /**\n * Returns information about the dropdown component.\n */\n public get dropdown(): SkyPopoversFixtureDropdown | undefined {\n const button = this.buttonDebugElement;\n\n if (!button) {\n return;\n }\n\n return {\n buttonStyle: this.getButtonStyle(button.classes),\n buttonType: this.getButtonType(button.classes),\n disabled: button.nativeElement.disabled,\n label: button.nativeElement.getAttribute('aria-label'),\n title: button.nativeElement.getAttribute('title'),\n };\n }\n\n /**\n * Returns the dropdown button's text.\n */\n public get dropdownButtonText(): string | undefined {\n return SkyAppTestUtility.getText(this.buttonDebugElement.nativeElement);\n }\n\n /**\n * Returns information about the dropdown menu component.\n */\n public get dropdownMenu(): SkyPopoversFixtureDropdownMenu | undefined {\n const menu = this.getDropdownMenuContent();\n if (!menu) {\n return;\n }\n\n return {\n ariaLabelledBy: menu.getAttribute('aria-labelledby'),\n ariaRole: menu.getAttribute('role'),\n };\n }\n\n /**\n * Indicates if the dropdown menu is open and visible.\n */\n public get dropdownMenuIsVisible(): boolean {\n return this.getDropdownMenuContent() !== undefined;\n }\n\n private get buttonDebugElement(): DebugElement {\n return this.debugEl.query(By.css('.sky-dropdown-button'));\n }\n\n private debugEl: DebugElement;\n\n constructor(private fixture: ComponentFixture<unknown>, skyTestId: string) {\n this.debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-dropdown'\n );\n }\n\n /**\n * Click the dropdown button to open or close the dropdown menu.\n */\n public async clickDropdownButton(): Promise<unknown> {\n this.buttonDebugElement.nativeElement.click();\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Click the dropdown item at the provided index.\n */\n public async clickDropdownItem(index: number): Promise<unknown> {\n const itemEls = this.getDropdownItemEls();\n\n if (!itemEls) {\n return;\n }\n\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n itemEls[index].querySelector('button,a').click();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns information about the dropdown item at the provided index.\n */\n public getDropdownItem(\n index: number\n ): SkyPopoversFixtureDropdownItem | undefined {\n const itemEls = this.getDropdownItemEls();\n\n if (!itemEls) {\n return;\n }\n\n if (index >= itemEls.length) {\n throw new Error(`There is no dropdown item at index ${index}.`);\n }\n\n const item = itemEls[index];\n if (!item) {\n return;\n }\n\n return {\n ariaRole: item.getAttribute('role'),\n };\n }\n\n /**\n * Returns the contents of the dropdown menu.\n */\n public getDropdownMenuContent(): any {\n const overlay = this.getOverlay();\n if (!overlay) {\n return;\n }\n\n return overlay.querySelector('.sky-dropdown-menu');\n }\n\n private getDropdownItemEls(): NodeListOf<any> | undefined {\n const overlay = this.getOverlay();\n\n if (!overlay) {\n return;\n }\n\n return overlay.querySelectorAll('.sky-dropdown-item');\n }\n\n private getOverlay(): HTMLElement | null {\n return document.querySelector('sky-overlay');\n }\n\n private getButtonStyle(classNames: {\n [key: string]: boolean;\n }): string | undefined {\n if (classNames['sky-btn-primary']) {\n return 'primary';\n }\n if (classNames['sky-btn-default']) {\n return 'default';\n }\n }\n\n private getButtonType(classNames: {\n [key: string]: boolean;\n }): string | undefined {\n const prefix = 'sky-dropdown-button-type-';\n\n for (const i in classNames) {\n if (classNames[i]) {\n if (i.indexOf(prefix) > -1) {\n return i.replace(prefix, '');\n }\n }\n }\n\n return undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popovers-fixture-dropdown.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/popovers-fixture-dropdown.ts"],"names":[],"mappings":"","sourcesContent":["export interface SkyPopoversFixtureDropdown {\n buttonStyle
|
|
1
|
+
{"version":3,"file":"popovers-fixture-dropdown.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/dropdown/popovers-fixture-dropdown.ts"],"names":[],"mappings":"","sourcesContent":["export interface SkyPopoversFixtureDropdown {\n buttonStyle?: string;\n buttonType?: string;\n disabled: boolean;\n label: string;\n title: string;\n}\n"]}
|
|
@@ -49,23 +49,23 @@ export class SkyPopoverFixture {
|
|
|
49
49
|
}
|
|
50
50
|
//#region helpers
|
|
51
51
|
get contentElement() {
|
|
52
|
-
return this.queryOverlay('sky-popover-content');
|
|
52
|
+
return this.queryOverlay('sky-popover-content') || undefined;
|
|
53
53
|
}
|
|
54
54
|
get containerElement() {
|
|
55
|
-
return this.queryOverlay('.sky-popover-container');
|
|
55
|
+
return this.queryOverlay('.sky-popover-container') || undefined;
|
|
56
56
|
}
|
|
57
57
|
get titleElement() {
|
|
58
|
-
return this.queryOverlay('.sky-popover-title');
|
|
58
|
+
return this.queryOverlay('.sky-popover-title') || undefined;
|
|
59
59
|
}
|
|
60
60
|
get bodyElement() {
|
|
61
|
-
return this.queryOverlay('.sky-popover-body');
|
|
61
|
+
return this.queryOverlay('.sky-popover-body') || undefined;
|
|
62
62
|
}
|
|
63
63
|
getOverlay() {
|
|
64
|
-
return document.querySelector('sky-overlay');
|
|
64
|
+
return document.querySelector('sky-overlay') || undefined;
|
|
65
65
|
}
|
|
66
66
|
queryOverlay(query) {
|
|
67
67
|
const overlay = this.getOverlay();
|
|
68
|
-
return !overlay ?
|
|
68
|
+
return !overlay ? null : overlay.querySelector(query);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Searches the element's class names for a class which matches a given prefix.
|
|
@@ -78,8 +78,8 @@ export class SkyPopoverFixture {
|
|
|
78
78
|
* @param prefix
|
|
79
79
|
*/
|
|
80
80
|
getClassSuffixByClassPrefix(element, prefix) {
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
const containerClasses = element === null || element === void 0 ? void 0 : element.className.split(' ');
|
|
82
|
+
const prefixedClass = containerClasses === null || containerClasses === void 0 ? void 0 : containerClasses.find((x) => x.startsWith(prefix));
|
|
83
83
|
return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IA0C5B,YAAoB,
|
|
1
|
+
{"version":3,"file":"popover-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/popovers/testing/src/popover/popover-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IA0C5B,YAAoB,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;IAAG,CAAC;IAzC1D;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,2BAA2B,CACrC,IAAI,CAAC,gBAAgB,EACrB,wBAAwB,CACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,2BAA2B,CACrC,IAAI,CAAC,gBAAgB,EACrB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MAAc;QAEd,MAAM,gBAAgB,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,aAAa,GAAG,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAE1E,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;CAEF","sourcesContent":["import { ComponentFixture } from '@angular/core/testing';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\n/**\n * Provides information for and interaction with a SKY UX popover component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPopoverFixture {\n /**\n * Returns the popover alignment if the popover is open, otherwise undefined.\n */\n public get alignment(): string | undefined {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-alignment-'\n );\n }\n\n /**\n * Returns the popover body element if the popover is open, otherwise undefined.\n */\n public get body(): HTMLElement | undefined {\n return this.bodyElement;\n }\n\n /**\n * Returns the popover position if the popover is open, otherwise undefined.\n */\n public get placement(): string | undefined {\n return this.getClassSuffixByClassPrefix(\n this.containerElement,\n 'sky-popover-placement-'\n );\n }\n\n /**\n * Returns the popover title text if the popover is open, otherwise undefined.\n */\n public get popoverTitle(): string | undefined {\n return SkyAppTestUtility.getText(this.titleElement);\n }\n\n /**\n * Indicates if the popover is open and visible.\n */\n public get popoverIsVisible(): boolean {\n return this.contentElement !== undefined;\n }\n\n constructor(private fixture: ComponentFixture<unknown>) {}\n\n /**\n * Triggers the blur event for the popover.\n */\n public blur(): Promise<unknown> {\n // close the popover by changing focus to the body element\n SkyAppTestUtility.fireDomEvent(window.document.body, 'click');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n //#region helpers\n private get contentElement(): HTMLElement | undefined {\n return this.queryOverlay('sky-popover-content') || undefined;\n }\n\n private get containerElement(): HTMLElement | undefined {\n return this.queryOverlay('.sky-popover-container') || undefined;\n }\n\n private get titleElement(): HTMLElement | undefined {\n return this.queryOverlay('.sky-popover-title') || undefined;\n }\n\n private get bodyElement(): HTMLElement | undefined {\n return this.queryOverlay('.sky-popover-body') || undefined;\n }\n\n private getOverlay(): Element | undefined {\n return document.querySelector('sky-overlay') || undefined;\n }\n\n private queryOverlay(query: string): HTMLElement | null {\n const overlay = this.getOverlay();\n\n return !overlay ? null : overlay.querySelector(query);\n }\n\n /**\n * Searches the element's class names for a class which matches a given prefix.\n * If a match is found, the prefix is trimmed from the class name and the suffix is returned.\n * If no class matching the prefix is found, undefined is returned.\n *\n * Example:\n * For a class 'sky-popover-placement-right', passing the prefix 'sky-popover-placement-'\n * should return the value 'right'.\n * @param prefix\n */\n private getClassSuffixByClassPrefix(\n element: HTMLElement | undefined,\n prefix: string\n ): string | undefined {\n const containerClasses = element?.className.split(' ');\n const prefixedClass = containerClasses?.find((x) => x.startsWith(prefix));\n\n return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);\n }\n //#endregion\n}\n"]}
|
|
@@ -89,6 +89,9 @@ class SkyDropdownFixture {
|
|
|
89
89
|
clickDropdownItem(index) {
|
|
90
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
const itemEls = this.getDropdownItemEls();
|
|
92
|
+
if (!itemEls) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
92
95
|
if (index >= itemEls.length) {
|
|
93
96
|
throw new Error(`There is no dropdown item at index ${index}.`);
|
|
94
97
|
}
|
|
@@ -102,6 +105,9 @@ class SkyDropdownFixture {
|
|
|
102
105
|
*/
|
|
103
106
|
getDropdownItem(index) {
|
|
104
107
|
const itemEls = this.getDropdownItemEls();
|
|
108
|
+
if (!itemEls) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
105
111
|
if (index >= itemEls.length) {
|
|
106
112
|
throw new Error(`There is no dropdown item at index ${index}.`);
|
|
107
113
|
}
|
|
@@ -143,7 +149,7 @@ class SkyDropdownFixture {
|
|
|
143
149
|
}
|
|
144
150
|
getButtonType(classNames) {
|
|
145
151
|
const prefix = 'sky-dropdown-button-type-';
|
|
146
|
-
for (
|
|
152
|
+
for (const i in classNames) {
|
|
147
153
|
if (classNames[i]) {
|
|
148
154
|
if (i.indexOf(prefix) > -1) {
|
|
149
155
|
return i.replace(prefix, '');
|
|
@@ -228,23 +234,23 @@ class SkyPopoverFixture {
|
|
|
228
234
|
}
|
|
229
235
|
//#region helpers
|
|
230
236
|
get contentElement() {
|
|
231
|
-
return this.queryOverlay('sky-popover-content');
|
|
237
|
+
return this.queryOverlay('sky-popover-content') || undefined;
|
|
232
238
|
}
|
|
233
239
|
get containerElement() {
|
|
234
|
-
return this.queryOverlay('.sky-popover-container');
|
|
240
|
+
return this.queryOverlay('.sky-popover-container') || undefined;
|
|
235
241
|
}
|
|
236
242
|
get titleElement() {
|
|
237
|
-
return this.queryOverlay('.sky-popover-title');
|
|
243
|
+
return this.queryOverlay('.sky-popover-title') || undefined;
|
|
238
244
|
}
|
|
239
245
|
get bodyElement() {
|
|
240
|
-
return this.queryOverlay('.sky-popover-body');
|
|
246
|
+
return this.queryOverlay('.sky-popover-body') || undefined;
|
|
241
247
|
}
|
|
242
248
|
getOverlay() {
|
|
243
|
-
return document.querySelector('sky-overlay');
|
|
249
|
+
return document.querySelector('sky-overlay') || undefined;
|
|
244
250
|
}
|
|
245
251
|
queryOverlay(query) {
|
|
246
252
|
const overlay = this.getOverlay();
|
|
247
|
-
return !overlay ?
|
|
253
|
+
return !overlay ? null : overlay.querySelector(query);
|
|
248
254
|
}
|
|
249
255
|
/**
|
|
250
256
|
* Searches the element's class names for a class which matches a given prefix.
|
|
@@ -257,8 +263,8 @@ class SkyPopoverFixture {
|
|
|
257
263
|
* @param prefix
|
|
258
264
|
*/
|
|
259
265
|
getClassSuffixByClassPrefix(element, prefix) {
|
|
260
|
-
|
|
261
|
-
|
|
266
|
+
const containerClasses = element === null || element === void 0 ? void 0 : element.className.split(' ');
|
|
267
|
+
const prefixedClass = containerClasses === null || containerClasses === void 0 ? void 0 : containerClasses.find((x) => x.startsWith(prefix));
|
|
262
268
|
return !prefixedClass ? undefined : prefixedClass.slice(prefix.length);
|
|
263
269
|
}
|
|
264
270
|
}
|