1 | import { NgModule, Component, Input, Output, EventEmitter, forwardRef, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
---|
4 | import * as i0 from "@angular/core";
|
---|
5 | import * as i1 from "@angular/common";
|
---|
6 | export const RATING_VALUE_ACCESSOR = {
|
---|
7 | provide: NG_VALUE_ACCESSOR,
|
---|
8 | useExisting: forwardRef(() => Rating),
|
---|
9 | multi: true
|
---|
10 | };
|
---|
11 | export class Rating {
|
---|
12 | constructor(cd) {
|
---|
13 | this.cd = cd;
|
---|
14 | this.stars = 5;
|
---|
15 | this.cancel = true;
|
---|
16 | this.iconOnClass = 'pi pi-star-fill';
|
---|
17 | this.iconOffClass = 'pi pi-star';
|
---|
18 | this.iconCancelClass = 'pi pi-ban';
|
---|
19 | this.onRate = new EventEmitter();
|
---|
20 | this.onCancel = new EventEmitter();
|
---|
21 | this.onModelChange = () => { };
|
---|
22 | this.onModelTouched = () => { };
|
---|
23 | }
|
---|
24 | ngOnInit() {
|
---|
25 | this.starsArray = [];
|
---|
26 | for (let i = 0; i < this.stars; i++) {
|
---|
27 | this.starsArray[i] = i;
|
---|
28 | }
|
---|
29 | }
|
---|
30 | rate(event, i) {
|
---|
31 | if (!this.readonly && !this.disabled) {
|
---|
32 | this.value = (i + 1);
|
---|
33 | this.onModelChange(this.value);
|
---|
34 | this.onModelTouched();
|
---|
35 | this.onRate.emit({
|
---|
36 | originalEvent: event,
|
---|
37 | value: (i + 1)
|
---|
38 | });
|
---|
39 | }
|
---|
40 | event.preventDefault();
|
---|
41 | }
|
---|
42 | clear(event) {
|
---|
43 | if (!this.readonly && !this.disabled) {
|
---|
44 | this.value = null;
|
---|
45 | this.onModelChange(this.value);
|
---|
46 | this.onModelTouched();
|
---|
47 | this.onCancel.emit(event);
|
---|
48 | }
|
---|
49 | event.preventDefault();
|
---|
50 | }
|
---|
51 | writeValue(value) {
|
---|
52 | this.value = value;
|
---|
53 | this.cd.detectChanges();
|
---|
54 | }
|
---|
55 | registerOnChange(fn) {
|
---|
56 | this.onModelChange = fn;
|
---|
57 | }
|
---|
58 | registerOnTouched(fn) {
|
---|
59 | this.onModelTouched = fn;
|
---|
60 | }
|
---|
61 | setDisabledState(val) {
|
---|
62 | this.disabled = val;
|
---|
63 | this.cd.markForCheck();
|
---|
64 | }
|
---|
65 | }
|
---|
66 | Rating.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Rating, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
67 | Rating.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Rating, selector: "p-rating", inputs: { disabled: "disabled", readonly: "readonly", stars: "stars", cancel: "cancel", iconOnClass: "iconOnClass", iconOnStyle: "iconOnStyle", iconOffClass: "iconOffClass", iconOffStyle: "iconOffStyle", iconCancelClass: "iconCancelClass", iconCancelStyle: "iconCancelStyle" }, outputs: { onRate: "onRate", onCancel: "onCancel" }, host: { classAttribute: "p-element" }, providers: [RATING_VALUE_ACCESSOR], ngImport: i0, template: `
|
---|
68 | <div class="p-rating" [ngClass]="{'p-readonly': readonly, 'p-disabled': disabled}">
|
---|
69 | <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>
|
---|
70 | <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)"
|
---|
71 | [ngClass]="(!value || i >= value) ? iconOffClass : iconOnClass"
|
---|
72 | [ngStyle]="(!value || i >= value) ? iconOffStyle : iconOnStyle"></span>
|
---|
73 | </div>
|
---|
74 | `, isInline: true, styles: [".p-rating-icon{cursor:pointer}.p-rating.p-rating-readonly .p-rating-icon{cursor:default}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
75 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Rating, decorators: [{
|
---|
76 | type: Component,
|
---|
77 | args: [{ selector: 'p-rating', template: `
|
---|
78 | <div class="p-rating" [ngClass]="{'p-readonly': readonly, 'p-disabled': disabled}">
|
---|
79 | <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>
|
---|
80 | <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)"
|
---|
81 | [ngClass]="(!value || i >= value) ? iconOffClass : iconOnClass"
|
---|
82 | [ngStyle]="(!value || i >= value) ? iconOffStyle : iconOnStyle"></span>
|
---|
83 | </div>
|
---|
84 | `, providers: [RATING_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
85 | 'class': 'p-element'
|
---|
86 | }, styles: [".p-rating-icon{cursor:pointer}.p-rating.p-rating-readonly .p-rating-icon{cursor:default}\n"] }]
|
---|
87 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
|
---|
88 | type: Input
|
---|
89 | }], readonly: [{
|
---|
90 | type: Input
|
---|
91 | }], stars: [{
|
---|
92 | type: Input
|
---|
93 | }], cancel: [{
|
---|
94 | type: Input
|
---|
95 | }], iconOnClass: [{
|
---|
96 | type: Input
|
---|
97 | }], iconOnStyle: [{
|
---|
98 | type: Input
|
---|
99 | }], iconOffClass: [{
|
---|
100 | type: Input
|
---|
101 | }], iconOffStyle: [{
|
---|
102 | type: Input
|
---|
103 | }], iconCancelClass: [{
|
---|
104 | type: Input
|
---|
105 | }], iconCancelStyle: [{
|
---|
106 | type: Input
|
---|
107 | }], onRate: [{
|
---|
108 | type: Output
|
---|
109 | }], onCancel: [{
|
---|
110 | type: Output
|
---|
111 | }] } });
|
---|
112 | export class RatingModule {
|
---|
113 | }
|
---|
114 | RatingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RatingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
115 | RatingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RatingModule, declarations: [Rating], imports: [CommonModule], exports: [Rating] });
|
---|
116 | RatingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RatingModule, imports: [[CommonModule]] });
|
---|
117 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: RatingModule, decorators: [{
|
---|
118 | type: NgModule,
|
---|
119 | args: [{
|
---|
120 | imports: [CommonModule],
|
---|
121 | exports: [Rating],
|
---|
122 | declarations: [Rating]
|
---|
123 | }]
|
---|
124 | }] });
|
---|
125 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmF0aW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL3JhdGluZy9yYXRpbmcudHMiXSwibmFtZXM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