1 line
15 KiB
Plaintext
1 line
15 KiB
Plaintext
{"version":3,"file":"primeng-fieldset.mjs","sources":["../../src/app/components/fieldset/fieldset.ts","../../src/app/components/fieldset/primeng-fieldset.ts"],"sourcesContent":["import { animate, state, style, transition, trigger } from '@angular/animations';\nimport { CommonModule } from '@angular/common';\nimport { AfterContentInit, ChangeDetectionStrategy, Component, ContentChildren, ElementRef, EventEmitter, Input, NgModule, Output, QueryList, TemplateRef, ViewEncapsulation, booleanAttribute } from '@angular/core';\nimport { BlockableUI, PrimeTemplate, SharedModule } from 'primeng/api';\nimport { MinusIcon } from 'primeng/icons/minus';\nimport { PlusIcon } from 'primeng/icons/plus';\nimport { RippleModule } from 'primeng/ripple';\nimport { Nullable } from 'primeng/ts-helpers';\nimport { UniqueComponentId } from 'primeng/utils';\nimport { FieldsetAfterToggleEvent, FieldsetBeforeToggleEvent } from './fieldset.interface';\n\n/**\n * Fieldset is a grouping component with the optional content toggle feature.\n * @group Components\n */\n@Component({\n selector: 'p-fieldset',\n template: `\n <fieldset\n [attr.id]=\"id\"\n [ngClass]=\"{ 'p-fieldset p-component': true, 'p-fieldset-toggleable': toggleable, 'p-fieldset-expanded': !collapsed && toggleable }\"\n [ngStyle]=\"style\"\n [class]=\"styleClass\"\n [attr.data-pc-name]=\"'fieldset'\"\n [attr.data-pc-section]=\"'root'\"\n >\n <legend class=\"p-fieldset-legend\" [attr.data-pc-section]=\"'legend'\">\n <ng-container *ngIf=\"toggleable; else legendContent\">\n <a [attr.id]=\"id + '_header'\" pRipple tabindex=\"0\" role=\"button\" [attr.aria-controls]=\"id + '_content'\" [attr.aria-expanded]=\"!collapsed\" [attr.aria-label]=\"buttonAriaLabel\" (click)=\"toggle($event)\" (keydown)=\"onKeyDown($event)\">\n <ng-container *ngIf=\"collapsed\">\n <PlusIcon *ngIf=\"!expandIconTemplate\" [styleClass]=\"'p-fieldset-toggler'\" [attr.data-pc-section]=\"'togglericon'\" />\n <span *ngIf=\"expandIconTemplate\" class=\"p-fieldset-toggler\" [attr.data-pc-section]=\"'togglericon'\">\n <ng-container *ngTemplateOutlet=\"expandIconTemplate\"></ng-container>\n </span>\n </ng-container>\n <ng-container *ngIf=\"!collapsed\">\n <MinusIcon *ngIf=\"!collapseIconTemplate\" [styleClass]=\"'p-fieldset-toggler'\" [attr.aria-hidden]=\"true\" [attr.data-pc-section]=\"'togglericon'\" />\n <span *ngIf=\"collapseIconTemplate\" class=\"p-fieldset-toggler\" [attr.data-pc-section]=\"'togglericon'\">\n <ng-container *ngTemplateOutlet=\"collapseIconTemplate\"></ng-container>\n </span>\n </ng-container>\n <ng-container *ngTemplateOutlet=\"legendContent\"></ng-container>\n </a>\n </ng-container>\n <ng-template #legendContent>\n <span class=\"p-fieldset-legend-text\" [attr.data-pc-section]=\"'legendtitle'\">{{ legend }}</span>\n <ng-content select=\"p-header\"></ng-content>\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-template>\n </legend>\n <div\n [attr.id]=\"id + '_content'\"\n role=\"region\"\n class=\"p-toggleable-content\"\n [@fieldsetContent]=\"collapsed ? { value: 'hidden', params: { transitionParams: transitionOptions, height: '0' } } : { value: 'visible', params: { transitionParams: animating ? transitionOptions : '0ms', height: '*' } }\"\n [attr.aria-labelledby]=\"id + '_header'\"\n [attr.aria-hidden]=\"collapsed\"\n [attr.data-pc-section]=\"'toggleablecontent'\"\n (@fieldsetContent.done)=\"onToggleDone()\"\n >\n <div class=\"p-fieldset-content\" [attr.data-pc-section]=\"'content'\">\n <ng-content></ng-content>\n <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n </div>\n </div>\n </fieldset>\n `,\n animations: [\n trigger('fieldsetContent', [\n state(\n 'hidden',\n style({\n height: '0'\n })\n ),\n state(\n 'visible',\n style({\n height: '*'\n })\n ),\n transition('visible <=> hidden', [animate('{{transitionParams}}')]),\n transition('void => *', animate(0))\n ])\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./fieldset.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class Fieldset implements AfterContentInit, BlockableUI {\n /**\n * Header text of the fieldset.\n * @group Props\n */\n @Input() legend: string | undefined;\n /**\n * When specified, content can toggled by clicking the legend.\n * @group Props\n * @defaultValue false\n */\n @Input({ transform: booleanAttribute }) toggleable: boolean | undefined;\n /**\n * Defines the default visibility state of the content.\n * * @group Props\n */\n @Input({ transform: booleanAttribute }) collapsed: boolean | undefined = false;\n /**\n * Inline style of the component.\n * @group Props\n */\n @Input() style: { [klass: string]: any } | null | undefined;\n /**\n * Style class of the component.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n /**\n * Transition options of the panel animation.\n * @group Props\n */\n @Input() transitionOptions: string = '400ms cubic-bezier(0.86, 0, 0.07, 1)';\n /**\n * Emits when the collapsed state changes.\n * @param {boolean} value - New value.\n * @group Emits\n */\n @Output() collapsedChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n /**\n * Callback to invoke before panel toggle.\n * @param {PanelBeforeToggleEvent} event - Custom toggle event\n * @group Emits\n */\n @Output() onBeforeToggle: EventEmitter<FieldsetBeforeToggleEvent> = new EventEmitter<FieldsetBeforeToggleEvent>();\n /**\n * Callback to invoke after panel toggle.\n * @param {PanelAfterToggleEvent} event - Custom toggle event\n * @group Emits\n */\n @Output() onAfterToggle: EventEmitter<FieldsetAfterToggleEvent> = new EventEmitter<FieldsetAfterToggleEvent>();\n\n @ContentChildren(PrimeTemplate) templates!: QueryList<PrimeTemplate>;\n\n get id() {\n return UniqueComponentId();\n }\n\n get buttonAriaLabel() {\n return this.legend;\n }\n\n public animating: Nullable<boolean>;\n\n headerTemplate: Nullable<TemplateRef<any>>;\n\n contentTemplate: Nullable<TemplateRef<any>>;\n\n collapseIconTemplate: Nullable<TemplateRef<any>>;\n\n expandIconTemplate: Nullable<TemplateRef<any>>;\n\n constructor(private el: ElementRef) {}\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'header':\n this.headerTemplate = item.template;\n break;\n\n case 'expandicon':\n this.expandIconTemplate = item.template;\n break;\n\n case 'collapseicon':\n this.collapseIconTemplate = item.template;\n break;\n\n case 'content':\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n toggle(event: MouseEvent) {\n if (this.animating) {\n return false;\n }\n\n this.animating = true;\n this.onBeforeToggle.emit({ originalEvent: event, collapsed: this.collapsed });\n\n if (this.collapsed) this.expand();\n else this.collapse();\n\n this.onAfterToggle.emit({ originalEvent: event, collapsed: this.collapsed });\n event.preventDefault();\n }\n\n onKeyDown(event) {\n if (event.code === 'Enter' || event.code === 'Space') {\n this.toggle(event);\n event.preventDefault();\n }\n }\n\n expand() {\n this.collapsed = false;\n this.collapsedChange.emit(this.collapsed);\n }\n\n collapse() {\n this.collapsed = true;\n this.collapsedChange.emit(this.collapsed);\n }\n\n getBlockableElement(): HTMLElement {\n return this.el.nativeElement.children[0];\n }\n\n onToggleDone() {\n this.animating = false;\n }\n}\n\n@NgModule({\n imports: [CommonModule, RippleModule, MinusIcon, PlusIcon],\n exports: [Fieldset, SharedModule],\n declarations: [Fieldset]\n})\nexport class FieldsetModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAWA;;;AAGG;MA8EU,QAAQ,CAAA;AAuEG,IAAA,EAAA,CAAA;AAtEpB;;;AAGG;AACM,IAAA,MAAM,CAAqB;AACpC;;;;AAIG;AACqC,IAAA,UAAU,CAAsB;AACxE;;;AAGG;IACqC,SAAS,GAAwB,KAAK,CAAC;AAC/E;;;AAGG;AACM,IAAA,KAAK,CAA8C;AAC5D;;;AAGG;AACM,IAAA,UAAU,CAAqB;AACxC;;;AAGG;IACM,iBAAiB,GAAW,sCAAsC,CAAC;AAC5E;;;;AAIG;AACO,IAAA,eAAe,GAA0B,IAAI,YAAY,EAAW,CAAC;AAC/E;;;;AAIG;AACO,IAAA,cAAc,GAA4C,IAAI,YA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