1 line
19 KiB
Plaintext
1 line
19 KiB
Plaintext
|
{"version":3,"file":"primeng-styleclass.mjs","sources":["../../src/app/components/styleclass/styleclass.ts","../../src/app/components/styleclass/primeng-styleclass.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Directive, ElementRef, HostListener, Input, NgModule, NgZone, OnDestroy, Renderer2, booleanAttribute } from '@angular/core';\nimport { DomHandler } from 'primeng/dom';\nimport { VoidListener } from 'primeng/ts-helpers';\n/**\n * StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element.\n * @group Components\n */\n@Directive({\n selector: '[pStyleClass]',\n host: {\n class: 'p-element'\n }\n})\nexport class StyleClass implements OnDestroy {\n constructor(public el: ElementRef, public renderer: Renderer2, private zone: NgZone) {}\n /**\n * Selector to define the target element. Available selectors are '@next', '@prev', '@parent' and '@grandparent'.\n * @group Props\n */\n @Input('pStyleClass') selector: string | undefined;\n /**\n * Style class to add when item begins to get displayed.\n * @group Props\n * @deprecated Use enterFromClass instead\n */\n @Input() set enterClass(value: string) {\n this._enterClass = value;\n console.warn('enterClass is deprecated, use enterFromClass instead');\n }\n get enterClass() {\n return this._enterClass;\n }\n /**\n * Style class to add when item begins to get displayed.\n * @group Props\n */\n @Input() enterFromClass: string | undefined;\n /**\n * Style class to add during enter animation.\n * @group Props\n */\n @Input() enterActiveClass: string | undefined;\n /**\n * Style class to add when item begins to get displayed.\n * @group Props\n */\n @Input() enterToClass: string | undefined;\n /**\n * Style class to add when item begins to get hidden.\n * @group Props\n * @deprecated Use leaveFromClass instead\n */\n @Input() set leaveClass(value: string) {\n this._leaveClass = value;\n console.warn('leaveClass is deprecated, use leaveFromClass instead');\n }\n get leaveClass() {\n return this._leaveClass;\n }\n /**\n * Style class to add when item begins to get hidden.\n * @group Props\n */\n @Input() leaveFromClass: string | undefined;\n /**\n * Style class to add during leave animation.\n * @group Props\n */\n @Input() leaveActiveClass: string | undefined;\n /**\n * Style class to add when leave animation is completed.\n * @group Props\n */\n @Input() leaveToClass: string | undefined;\n /**\n * Whether to trigger leave animation when outside of the element is clicked.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) hideOnOutsideClick: boolean | undefined;\n /**\n * Adds or removes a class when no enter-leave animation is required.\n * @group Props\n */\n @Input() toggleClass: string | undefined;\n /**\n * Whether to trigger leave animation when escape key pressed.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) hideOnEscape: boolean | undefined;\n\n eventListener: VoidListener;\n\n documentClickListener: VoidListener;\n\n documentKeydownListener: VoidListener;\n\n target: HTMLElement | null | undefined;\n\n enterListener: VoidListener;\n\n leaveListener: VoidListener;\n\n animating: boolean | undefined;\n\n _enterClass: string | undefined;\n\n _leaveClass: string | undefined;\n\n @HostListener('click', ['$event'])\n clickListener() {\n this.target = this.resolveTarget();\n\n if (this.toggleClass) {\n this.toggle();\n } else {\n if ((this.target as HTMLElement).offsetParent === null) this.enter();\n else this.leave();\n }\n }\n\n toggle() {\n if (DomHandler.hasClass(this.target, this.toggleClass as string)) DomHandler.removeClass(this.target, this.togg
|