import { Component, ElementRef, OnInit, OnChanges, Input, Output, EventEmitter, ContentChildren, QueryList } from '@angular/core'; import { CfCoreComponent } from '../core/core.component'; import { RatingModel } from '../../models/rating/rating.model'; import { RatingStylingModel } from '../../models/rating/rating-styling.model'; /** *
Rating component which has vertical/horizontal icons, icon order changing and other basic functionality.
*Example of using Menu:
***/ @Component({ selector: 'cf-rating', template: "", styles: [".cf-rating { display: inline-flex; flex-direction: column; } .cf-rating-label { display: flex; color: rgba(0, 0, 0, 0.38); font-size: 12px; } .cf-rating-items { display: flex; align-items: center; justify-content: center; } .cf-rating-items.count-from-end:not(.icons-vertical) { flex-direction: row-reverse; } .cf-rating-items.count-from-end.icons-vertical { flex-direction: column; } .cf-rating-items.icons-vertical { flex-direction: column-reverse; } .cf-rating-item { display: flex; border-radius: 50%; } .cf-rating-item /deep/ md-icon { transition: ease 0.15s all; } .cf-rating-item.cf-rating-disabled:hover /deep/ md-icon { cursor: default !important; } .cf-rating-item:not(.cf-rating-disabled):hover /deep/ md-icon { transform: scale(1.1); } [hidden] { display: none !important; } "] }) export class CfRatingComponent extends CfCoreComponent implements OnInit { /** * It is an RatingModel object with options to be rendered into component template */ cfRating: RatingModel; /** * It is an array to be filled with items according to MAX property */ cfItems: number[] = []; /** * It is an attribute [properties] of directive cf-rating which take RatingModel object. *<cf-rating [properties]="myRating" [styling]="myRatingStyles"></cf-rating>*
Example of Rating json object:
*{
* label: 'Rating label',
* icon: 'stars',
* value: 1,
* max: 5,
* countFromEnd: false,
* iconsVertical: false
* disabled: false
* }
*