ng2-nouislider
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -1,11 +0,5 @@ | ||
import {bootstrap} from '@angular/platform-browser-dynamic'; | ||
import {disableDeprecatedForms, provideForms} from '@angular/forms'; | ||
import {App} from './app'; | ||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
document.addEventListener('DOMContentLoaded', function main() { | ||
bootstrap(App, [ | ||
disableDeprecatedForms(), | ||
provideForms() | ||
]) | ||
.catch(err => console.error(err)); | ||
}); | ||
import { AppModule } from './app.module'; | ||
platformBrowserDynamic().bootstrapModule(AppModule); |
{ | ||
"name": "ng2-nouislider", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Angular2 noUiSlider directive", | ||
@@ -8,6 +8,5 @@ "main": "src/nouislider.js", | ||
"scripts": { | ||
"typings": "typings", | ||
"build": "typings install && tslint src/*.ts && tsc", | ||
"start": "webpack-dev-server --host 0.0.0.0", | ||
"start:demo": "webpack && http-server ./demo" | ||
"lint": "tslint src/nouislider.ts", | ||
"build": "typings install && npm run lint && tsc", | ||
"start": "npm run build && webpack-dev-server --host 0.0.0.0" | ||
}, | ||
@@ -32,8 +31,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"@angular/common": "^2.0.0-rc.3", | ||
"@angular/compiler": "^2.0.0-rc.3", | ||
"@angular/core": "^2.0.0-rc.3", | ||
"@angular/forms": "0.1.1", | ||
"@angular/platform-browser": "^2.0.0-rc.3", | ||
"@angular/platform-browser-dynamic": "^2.0.0-rc.3", | ||
"@angular/common": "2.0.0-rc.6", | ||
"@angular/compiler": "2.0.0-rc.6", | ||
"@angular/core": "2.0.0-rc.6", | ||
"@angular/forms": "2.0.0-rc.6", | ||
"@angular/platform-browser": "2.0.0-rc.6", | ||
"@angular/platform-browser-dynamic": "2.0.0-rc.6", | ||
"css-loader": "^0.23.1", | ||
@@ -46,3 +45,3 @@ "es6-shim": "^0.35.0", | ||
"reflect-metadata": "^0.1.3", | ||
"rxjs": "5.0.0-beta.6", | ||
"rxjs": "5.0.0-beta.11", | ||
"sass-loader": "^3.2.0", | ||
@@ -57,9 +56,9 @@ "style-loader": "^0.13.1", | ||
"webpack-dev-server": "^1.14.1", | ||
"zone.js": "^0.6.12" | ||
"zone.js": "^0.6.17" | ||
}, | ||
"peerDependencies": { | ||
"@angular/common": "^2.0.0-rc.3", | ||
"@angular/core": "^2.0.0-rc.3", | ||
"@angular/common": "^2.0.0-rc.6", | ||
"@angular/core": "^2.0.0-rc.6", | ||
"nouislider": "^8.4.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # ng2-nouislider | ||
Note: `ng2-nouislider` is RC3 compatible using the new Forms API (@angular/forms) | ||
Note: `ng2-nouislider` is RC6 compatible using the new Forms API (@angular/forms) | ||
@@ -29,5 +29,6 @@ ## Install | ||
git clone --recursive https://github.com/tb/ng2-nouislider.git | ||
cd ng2-nouislider | ||
npm install | ||
npm build | ||
npm start # check http://localhost:8080 in browser | ||
npm start | ||
# check http://localhost:8080 in browser | ||
@@ -34,0 +35,0 @@ ## License |
@@ -1,25 +0,25 @@ | ||
import { ElementRef, EventEmitter, OnInit } from '@angular/core'; | ||
import { ElementRef, OnInit } from '@angular/core'; | ||
import { ControlValueAccessor } from '@angular/forms'; | ||
export declare function toValue(value: string[]): number | number[]; | ||
export declare class Nouislider implements ControlValueAccessor, OnInit { | ||
el: ElementRef; | ||
slider: any; | ||
value: any; | ||
onChange: any; | ||
onTouched: any; | ||
name: string; | ||
behaviour: string; | ||
connect: boolean; | ||
limit: number; | ||
min: number; | ||
max: number; | ||
step: number; | ||
config: any; | ||
ngModel: number | number[]; | ||
ngModelChange: EventEmitter<any>; | ||
private el; | ||
private behaviour; | ||
private connect; | ||
private limit; | ||
private min; | ||
private max; | ||
private step; | ||
private config; | ||
private ngModel; | ||
private ngModelChange; | ||
private change; | ||
private slider; | ||
private value; | ||
private onChange; | ||
private onTouched; | ||
constructor(el: ElementRef); | ||
ngOnInit(): void; | ||
writeValue(value: any): void; | ||
registerOnChange(fn: (_: any) => {}): void; | ||
registerOnChange(fn: (value: any) => void): void; | ||
registerOnTouched(fn: () => {}): void; | ||
} |
@@ -26,13 +26,15 @@ "use strict"; | ||
exports.toValue = toValue; | ||
var NOUISLIDER_CONTROL_VALUE_ACCESSOR = new core_1.Provider(forms_1.NG_VALUE_ACCESSOR, { | ||
var NOUISLIDER_CONTROL_VALUE_ACCESSOR = { | ||
provide: forms_1.NG_VALUE_ACCESSOR, | ||
useExisting: core_1.forwardRef(function () { return Nouislider; }), | ||
multi: true | ||
}); | ||
}; | ||
var Nouislider = (function () { | ||
function Nouislider(el) { | ||
this.el = el; | ||
this.config = {}; | ||
this.ngModelChange = new core_1.EventEmitter(true); | ||
this.onChange = Function.prototype; | ||
this.onTouched = Function.prototype; | ||
this.config = {}; | ||
this.ngModelChange = new core_1.EventEmitter(true); | ||
this.el = el; | ||
this.change = this.ngModelChange; | ||
} | ||
@@ -58,3 +60,6 @@ Nouislider.prototype.ngOnInit = function () { | ||
} | ||
this.ngModelChange.emit(value); | ||
// avoid triggering change event on slider initialization | ||
if (!!this.value) { | ||
this.ngModelChange.emit(value); | ||
} | ||
this.value = value; | ||
@@ -66,3 +71,3 @@ if (this.slider) { | ||
Nouislider.prototype.registerOnChange = function (fn) { | ||
this.onTouched = fn; | ||
this.onChange = fn; | ||
}; | ||
@@ -75,6 +80,2 @@ Nouislider.prototype.registerOnTouched = function (fn) { | ||
__metadata('design:type', String) | ||
], Nouislider.prototype, "name", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', String) | ||
], Nouislider.prototype, "behaviour", void 0); | ||
@@ -113,2 +114,6 @@ __decorate([ | ||
], Nouislider.prototype, "ngModelChange", void 0); | ||
__decorate([ | ||
core_1.Output(), | ||
__metadata('design:type', core_1.EventEmitter) | ||
], Nouislider.prototype, "change", void 0); | ||
Nouislider = __decorate([ | ||
@@ -124,2 +129,2 @@ core_1.Directive({ | ||
exports.Nouislider = Nouislider; | ||
//# sour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ICB9KTtcbiAgfVxuXG4gIHdyaXRlVmFsdWUodmFsdWU6IGFueSk6IHZvaWQge1xuICAgIGlmICh0aGlzLnZhbHVlID09IHZhbHVlIHx8IFN0cmluZyh0aGlzLnZhbHVlKSA9PSBTdHJpbmcodmFsdWUpKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgLy8gYXZvaWQgdHJpZ2dlcmluZyBjaGFuZ2UgZXZlbnQgb24gc2xpZGVyIGluaXRpYWxpemF0aW9uXG4gICAgaWYgKCEhdGhpcy52YWx1ZSkge1xuICAgICAgdGhpcy5uZ01vZGVsQ2hhbmdlLmVtaXQodmFsdWUpO1xuICAgIH1cblxuICAgIHRoaXMudmFsdWUgPSB2YWx1ZTtcblxuICAgIGlmICh0aGlzLnNsaWRlcikge1xuICAgICAgdGhpcy5zbGlkZXIuc2V0KHZhbHVlKTtcbiAgICB9XG4gIH1cblxuICByZWdpc3Rlck9uQ2hhbmdlKGZuOiAodmFsdWU6IGFueSkgPT4gdm9pZCkge1xuICAgIHRoaXMub25DaGFuZ2UgPSBmbjtcbiAgfVxuXG4gIHJlZ2lzdGVyT25Ub3VjaGVkKGZuOiAoKSA9PiB7fSk6IHZvaWQge1xuICAgIHRoaXMub25Ub3VjaGVkID0gZm47XG4gIH1cbn1cbiJdfQ== |
@@ -9,4 +9,3 @@ import * as noUiSlider from 'nouislider'; | ||
OnInit, | ||
Output, | ||
Provider | ||
Output | ||
} from '@angular/core'; | ||
@@ -28,7 +27,7 @@ import { | ||
const NOUISLIDER_CONTROL_VALUE_ACCESSOR = new Provider( | ||
NG_VALUE_ACCESSOR, { | ||
useExisting: forwardRef(() => Nouislider), | ||
multi: true | ||
}); | ||
const NOUISLIDER_CONTROL_VALUE_ACCESSOR: any = { | ||
provide: NG_VALUE_ACCESSOR, | ||
useExisting: forwardRef(() => Nouislider), | ||
multi: true | ||
}; | ||
@@ -40,22 +39,20 @@ @Directive({ | ||
export class Nouislider implements ControlValueAccessor, OnInit { | ||
public el: ElementRef; | ||
public slider: any; | ||
public value: any; | ||
public onChange: any = Function.prototype; | ||
public onTouched: any = Function.prototype; | ||
@Input() private behaviour: string; | ||
@Input() private connect: boolean; | ||
@Input() private limit: number; | ||
@Input() private min: number; | ||
@Input() private max: number; | ||
@Input() private step: number; | ||
@Input() private config: any = {}; | ||
@Input() private ngModel: number | number[]; | ||
@Output() private ngModelChange: EventEmitter<any> = new EventEmitter(true); | ||
@Output() private change: EventEmitter<any>; | ||
@Input() name: string; | ||
private slider: any; | ||
private value: any; | ||
private onChange: any = Function.prototype; | ||
private onTouched: any = Function.prototype; | ||
@Input() behaviour: string; | ||
@Input() connect: boolean; | ||
@Input() limit: number; | ||
@Input() min: number; | ||
@Input() max: number; | ||
@Input() step: number; | ||
@Input() config: any = {}; | ||
@Input() ngModel: number | number[]; | ||
@Output() ngModelChange: EventEmitter<any> = new EventEmitter(true); | ||
public constructor(el: ElementRef) { | ||
this.el = el; | ||
constructor(private el: ElementRef) { | ||
this.change = this.ngModelChange; | ||
} | ||
@@ -83,3 +80,3 @@ | ||
public writeValue(value: any): void { | ||
writeValue(value: any): void { | ||
if (this.value == value || String(this.value) == String(value)) { | ||
@@ -89,4 +86,9 @@ return; | ||
this.ngModelChange.emit(value); | ||
// avoid triggering change event on slider initialization | ||
if (!!this.value) { | ||
this.ngModelChange.emit(value); | ||
} | ||
this.value = value; | ||
if (this.slider) { | ||
@@ -97,9 +99,9 @@ this.slider.set(value); | ||
public registerOnChange(fn: (_: any) => {}): void { | ||
this.onTouched = fn; | ||
registerOnChange(fn: (value: any) => void) { | ||
this.onChange = fn; | ||
} | ||
public registerOnTouched(fn: () => {}): void { | ||
registerOnTouched(fn: () => {}): void { | ||
this.onTouched = fn; | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6369161
22
3878
36