1 line
20 KiB
Plaintext
1 line
20 KiB
Plaintext
|
{"version":3,"file":"primeng-rating.mjs","sources":["../../src/app/components/rating/rating.ts","../../src/app/components/rating/primeng-rating.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { booleanAttribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, EventEmitter, forwardRef, Input, NgModule, numberAttribute, OnInit, Output, QueryList, signal, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { PrimeNGConfig, PrimeTemplate, SharedModule } from 'primeng/api';\nimport { BanIcon } from 'primeng/icons/ban';\nimport { StarIcon } from 'primeng/icons/star';\nimport { StarFillIcon } from 'primeng/icons/starfill';\nimport { Nullable } from 'primeng/ts-helpers';\nimport { RatingRateEvent } from './rating.interface';\nimport { DomHandler } from 'primeng/dom';\nimport { UniqueComponentId } from 'primeng/utils';\nimport { AutoFocusModule } from 'primeng/autofocus';\n\nexport const RATING_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => Rating),\n multi: true\n};\n/**\n * Rating is an extension to standard radio button element with theming.\n * @group Components\n */\n@Component({\n selector: 'p-rating',\n template: `\n <div class=\"p-rating\" [ngClass]=\"{ 'p-readonly': readonly, 'p-disabled': disabled }\" [attr.data-pc-name]=\"'rating'\" [attr.data-pc-section]=\"'root'\">\n <ng-container *ngIf=\"!isCustomIcon; else customTemplate\">\n <div *ngIf=\"cancel\" [attr.data-pc-section]=\"'cancelItem'\" (click)=\"onOptionClick($event, 0)\" [ngClass]=\"{ 'p-focus': focusedOptionIndex() === 0 && isFocusVisibleItem }\" class=\"p-rating-item p-rating-cancel-item\">\n <span class=\"p-hidden-accessible\" [attr.data-p-hidden-accessible]=\"true\">\n <input\n type=\"radio\"\n value=\"0\"\n [name]=\"name\"\n [checked]=\"value === 0\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"cancelAriaLabel()\"\n (focus)=\"onInputFocus($event, 0)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"onChange($event, 0)\"\n pAutoFocus\n [autofocus]=\"autofocus\"\n />\n </span>\n <span *ngIf=\"iconCancelClass\" class=\"p-rating-icon p-rating-cancel\" [ngClass]=\"iconCancelClass\" [ngStyle]=\"iconCancelStyle\"></span>\n <BanIcon *ngIf=\"!iconCancelClass\" [styleClass]=\"'p-rating-icon p-rating-cancel'\" [ngStyle]=\"iconCancelStyle\" [attr.data-pc-section]=\"'cancelIcon'\" />\n </div>\n <ng-template ngFor [ngForOf]=\"starsArray\" let-star let-i=\"index\">\n <div class=\"p-rating-item\" [ngClass]=\"{ 'p-rating-item-active': star + 1 <= value, 'p-focus': star + 1 === focusedOptionIndex() && isFocusVisibleItem }\" (click)=\"onOptionClick($event, star + 1)\">\n <span class=\"p-hidden-accessible\" [attr.data-p-hidden-accessible]=\"true\">\n <input\n type=\"radio\"\n value=\"0\"\n [name]=\"name\"\n [checked]=\"value === 0\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [attr.aria-label]=\"starAriaLabel(star + 1)\"\n (focus)=\"onInputFocus($event, star + 1)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"onChange($event, star + 1)\"\n pAutoF
|