ionic2-rating
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -9,2 +9,3 @@ import { ControlValueAccessor } from '@angular/forms'; | ||
_starIconName: string; | ||
_nullable: boolean; | ||
max: any; | ||
@@ -15,2 +16,3 @@ readOnly: any; | ||
starIconName: any; | ||
nullable: any; | ||
innerValue: any; | ||
@@ -17,0 +19,0 @@ starIndexes: Array<number>; |
@@ -17,2 +17,3 @@ import { Component, forwardRef, Input } from '@angular/core'; | ||
this._starIconName = 'star'; | ||
this._nullable = false; | ||
this.onChangeCallback = noop; | ||
@@ -70,2 +71,12 @@ } | ||
}); | ||
Object.defineProperty(Ionic2Rating.prototype, "nullable", { | ||
get: function () { | ||
return this._nullable; | ||
}, | ||
set: function (val) { | ||
this._nullable = this.isTrueProperty(val); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Ionic2Rating.prototype.ngOnInit = function () { | ||
@@ -123,5 +134,9 @@ // ngFor needs an array | ||
Ionic2Rating.prototype.rate = function (value) { | ||
if (!this.readOnly && value >= 0 && value <= this.max) { | ||
this.value = value; | ||
if (this.readOnly || value < 0 || value > this.max) { | ||
return; | ||
} | ||
if (value === this.value && this.nullable) { | ||
value = null; | ||
} | ||
this.value = value; | ||
}; | ||
@@ -157,2 +172,3 @@ Ionic2Rating.prototype.isTrueProperty = function (val) { | ||
'starIconName': [{ type: Input },], | ||
'nullable': [{ type: Input },], | ||
}; | ||
@@ -159,0 +175,0 @@ return Ionic2Rating; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"RATING_CONTROL_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"Ionic2Rating"},"multi":true},"Ionic2Rating":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"rating","styles":["\n ul.rating li {\n display: inline;\n border: 0px;\n background: none;\n padding: 5px 10px;\n }\n ul.rating li i {\n font-size: 30px;\n }\n "],"template":"\n <ul class=\"rating\" (keydown)=\"onKeyDown($event)\">\n <li *ngFor=\"let starIndex of starIndexes\" tappable (click)=\"rate(starIndex + 1)\">\n <ion-icon [name]=\"getStarIconName(starIndex)\">\n </ion-icon>\n </li>\n </ul>","providers":[{"__symbolic":"reference","name":"RATING_CONTROL_VALUE_ACCESSOR"}]}]}],"members":{"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"readOnly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"emptyStarIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"halfStarIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"starIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ngOnInit":[{"__symbolic":"method"}],"getStarIconName":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"onKeyDown":[{"__symbolic":"method"}],"rate":[{"__symbolic":"method"}],"isTrueProperty":[{"__symbolic":"method"}],"getNumberPropertyValue":[{"__symbolic":"method"}]}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"RATING_CONTROL_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR"},"useExisting":{"__symbolic":"reference","name":"Ionic2Rating"},"multi":true},"Ionic2Rating":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"rating","styles":["\n ul.rating li {\n display: inline;\n border: 0px;\n background: none;\n padding: 5px 10px;\n }\n ul.rating li i {\n font-size: 30px;\n }\n "],"template":"\n <ul class=\"rating\" (keydown)=\"onKeyDown($event)\">\n <li *ngFor=\"let starIndex of starIndexes\" tappable (click)=\"rate(starIndex + 1)\">\n <ion-icon [name]=\"getStarIconName(starIndex)\">\n </ion-icon>\n </li>\n </ul>","providers":[{"__symbolic":"reference","name":"RATING_CONTROL_VALUE_ACCESSOR"}]}]}],"members":{"max":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"readOnly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"emptyStarIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"halfStarIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"starIconName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"nullable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"ngOnInit":[{"__symbolic":"method"}],"getStarIconName":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"onKeyDown":[{"__symbolic":"method"}],"rate":[{"__symbolic":"method"}],"isTrueProperty":[{"__symbolic":"method"}],"getNumberPropertyValue":[{"__symbolic":"method"}]}}}} |
{ | ||
"name": "ionic2-rating", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An Angular2 component to visualize a star rating bar, built for Ionic 2.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -57,2 +57,3 @@ ionic2-rating | ||
starIconName="star" // default value | ||
nullable="false" // default value | ||
(ngModelChange)="onModelChange($event)"></rating> | ||
@@ -59,0 +60,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32921
241
88
0