2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("primeng/rating",["exports","@angular/core","@angular/common","@angular/forms"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.rating={}),e.ng.core,e.ng.common,e.ng.forms)}(this,(function(e,n,t,i){"use strict";var o={provide:i.NG_VALUE_ACCESSOR,useExisting:n.forwardRef((function(){return a})),multi:!0},a=function(){function e(e){this.cd=e,this.stars=5,this.cancel=!0,this.iconOnClass="pi pi-star",this.iconOffClass="pi pi-star-o",this.iconCancelClass="pi pi-ban",this.onRate=new n.EventEmitter,this.onCancel=new n.EventEmitter,this.onModelChange=function(){},this.onModelTouched=function(){}}return e.prototype.ngOnInit=function(){this.starsArray=[];for(var e=0;e<this.stars;e++)this.starsArray[e]=e},e.prototype.rate=function(e,n){this.readonly||this.disabled||(this.value=n+1,this.onModelChange(this.value),this.onModelTouched(),this.onRate.emit({originalEvent:e,value:n+1})),e.preventDefault()},e.prototype.clear=function(e){this.readonly||this.disabled||(this.value=null,this.onModelChange(this.value),this.onModelTouched(),this.onCancel.emit(e)),e.preventDefault()},e.prototype.writeValue=function(e){this.value=e,this.cd.detectChanges()},e.prototype.registerOnChange=function(e){this.onModelChange=e},e.prototype.registerOnTouched=function(e){this.onModelTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e,this.cd.markForCheck()},e}();a.decorators=[{type:n.Component,args:[{selector:"p-rating",template:'\n <div class="p-rating" [ngClass]="{\'p-readonly\': readonly, \'p-disabled\': disabled}">\n <span [attr.tabindex]="(disabled || readonly) ? null : \'0\'" *ngIf="cancel" (click)="clear($event)" (keydown.enter)="clear($event)" class="p-rating-icon p-rating-cancel" [ngClass]="iconCancelClass" [ngStyle]="iconCancelStyle"></span>\n <span *ngFor="let star of starsArray;let i=index" class="p-rating-icon" [attr.tabindex]="(disabled || readonly) ? null : \'0\'" (click)="rate($event,i)" (keydown.enter)="rate($event,i)"\n [ngClass]="(!value || i >= value) ? iconOffClass : iconOnClass"\n [ngStyle]="(!value || i >= value) ? iconOffStyle : iconOnStyle"></span>\n </div>\n ',providers:[o],changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,styles:[".p-rating-icon{cursor:pointer}.p-rating.p-rating-readonly .p-rating-icon{cursor:default}"]}]}],a.ctorParameters=function(){return[{type:n.ChangeDetectorRef}]},a.propDecorators={disabled:[{type:n.Input}],readonly:[{type:n.Input}],stars:[{type:n.Input}],cancel:[{type:n.Input}],iconOnClass:[{type:n.Input}],iconOnStyle:[{type:n.Input}],iconOffClass:[{type:n.Input}],iconOffStyle:[{type:n.Input}],iconCancelClass:[{type:n.Input}],iconCancelStyle:[{type:n.Input}],onRate:[{type:n.Output}],onCancel:[{type:n.Output}]};var r=function(){};r.decorators=[{type:n.NgModule,args:[{imports:[t.CommonModule],exports:[a],declarations:[a]}]}],e.RATING_VALUE_ACCESSOR=o,e.Rating=a,e.RatingModule=r,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
//# sourceMappingURL=primeng-rating.umd.min.js.map
|