ng-chartist
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/willsoto/ng-chartist/compare/v1.0.0...v1.1.0) (2017-03-11) | ||
### Features | ||
* **chartist:** throw error when invalid chart type is passed ([a1637cf](https://github.com/willsoto/ng-chartist/commit/a1637cf)), closes [#97](https://github.com/willsoto/ng-chartist/issues/97) | ||
<a name="1.0.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.0.0](https://github.com/willsoto/ng-chartist/compare/v0.12.2...v1.0.0) (2017-03-11) |
@@ -48,2 +48,5 @@ "use strict"; | ||
var type = values[0], args = values.slice(1); | ||
if (!(type in Chartist)) { | ||
throw new Error(type + " is not a valid chart type"); | ||
} | ||
_this.chart = (_a = Chartist)[type].apply(_a, args); | ||
@@ -50,0 +53,0 @@ return _this.chart; |
@@ -143,2 +143,5 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var type = values[0], args = values.slice(1); | ||
if (!(type in Chartist)) { | ||
throw new Error(type + " is not a valid chart type"); | ||
} | ||
_this.chart = (_a = Chartist)[type].apply(_a, args); | ||
@@ -145,0 +148,0 @@ return _this.chart; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("chartist"),require("@angular/core")):"function"==typeof define&&define.amd?define(["chartist","@angular/core"],e):"object"==typeof exports?exports.ngChartist=e(require("chartist"),require("@angular/core")):t.ngChartist=e(t.chartist,t.ng.core)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=n(1),a=n(0),s=function(){function t(t){this.element=t.nativeElement}return t.prototype.ngOnInit=function(){var t=this;return this.type&&this.data||Promise.reject("Expected at least type and data."),this.renderChart().then(function(e){return void 0!==t.events&&t.bindEvents(e),e})},t.prototype.ngOnChanges=function(t){this.update(t)},t.prototype.ngOnDestroy=function(){this.chart&&this.chart.detach()},t.prototype.renderChart=function(){var t=this,e=[this.type,this.element,this.data,this.options,this.responsiveOptions];return Promise.all(e).then(function(e){var n=e[0],r=e.slice(1);return t.chart=(o=a)[n].apply(o,r),t.chart;var o})},t.prototype.update=function(t){!this.chart||"type"in t?this.renderChart():(t.data&&(this.data=t.data.currentValue),t.options&&(this.options=t.options.currentValue),this.chart.update(this.data,this.options))},t.prototype.bindEvents=function(t){for(var e=0,n=Object.keys(this.events);e<n.length;e++){var r=n[e];t.on(r,this.events[r])}},t}();r([i.Input(),o("design:type",Object)],s.prototype,"data",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"type",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"options",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"responsiveOptions",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"events",void 0),s=r([i.Component({selector:"x-chartist",template:"<ng-content></ng-content>"}),o("design:paramtypes",[i.ElementRef])],s),e.ChartistComponent=s;var c=function(){function t(){}return t}();c=r([i.NgModule({declarations:[s],exports:[s]})],c),e.ChartistModule=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default={directives:[s]}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("chartist"),require("@angular/core")):"function"==typeof define&&define.amd?define(["chartist","@angular/core"],e):"object"==typeof exports?exports.ngChartist=e(require("chartist"),require("@angular/core")):t.ngChartist=e(t.chartist,t.ng.core)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},i=n(1),a=n(0),s=function(){function t(t){this.element=t.nativeElement}return t.prototype.ngOnInit=function(){var t=this;return this.type&&this.data||Promise.reject("Expected at least type and data."),this.renderChart().then(function(e){return void 0!==t.events&&t.bindEvents(e),e})},t.prototype.ngOnChanges=function(t){this.update(t)},t.prototype.ngOnDestroy=function(){this.chart&&this.chart.detach()},t.prototype.renderChart=function(){var t=this,e=[this.type,this.element,this.data,this.options,this.responsiveOptions];return Promise.all(e).then(function(e){var n=e[0],r=e.slice(1);if(!(n in a))throw new Error(n+" is not a valid chart type");return t.chart=(o=a)[n].apply(o,r),t.chart;var o})},t.prototype.update=function(t){!this.chart||"type"in t?this.renderChart():(t.data&&(this.data=t.data.currentValue),t.options&&(this.options=t.options.currentValue),this.chart.update(this.data,this.options))},t.prototype.bindEvents=function(t){for(var e=0,n=Object.keys(this.events);e<n.length;e++){var r=n[e];t.on(r,this.events[r])}},t}();r([i.Input(),o("design:type",Object)],s.prototype,"data",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"type",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"options",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"responsiveOptions",void 0),r([i.Input(),o("design:type",Object)],s.prototype,"events",void 0),s=r([i.Component({selector:"x-chartist",template:"<ng-content></ng-content>"}),o("design:paramtypes",[i.ElementRef])],s),e.ChartistComponent=s;var c=function(){function t(){}return t}();c=r([i.NgModule({declarations:[s],exports:[s]})],c),e.ChartistModule=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default={directives:[s]}}])}); |
{ | ||
"name": "ng-chartist", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Chartist component for Angular", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ng-chartist.js", |
@@ -88,2 +88,6 @@ import { | ||
if (!(type in Chartist)) { | ||
throw new Error(`${type} is not a valid chart type`); | ||
} | ||
this.chart = (<any>Chartist)[type](...args); | ||
@@ -90,0 +94,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59555
494