|
| 1 | +(function (global, factory) { |
| 2 | + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) : |
| 3 | + typeof define === 'function' && define.amd ? define(['exports', '@angular/core'], factory) : |
| 4 | + (factory((global.ng = global.ng || {}, global.ng['angular2-fusioncharts'] = {}),global.ng.core)); |
| 5 | +}(this, (function (exports,_angular_core) { 'use strict'; |
| 6 | + |
| 7 | +var FusionChartsStatic = (function () { |
| 8 | + function FusionChartsStatic() { |
| 9 | + } |
| 10 | + return FusionChartsStatic; |
| 11 | +}()); |
| 12 | +FusionChartsStatic.decorators = [ |
| 13 | + { type: _angular_core.Injectable }, |
| 14 | +]; |
| 15 | +/** @nocollapse */ |
| 16 | +FusionChartsStatic.ctorParameters = function () { return []; }; |
| 17 | +var FusionChartsService = (function () { |
| 18 | + function FusionChartsService(FCStatic) { |
| 19 | + /* TODO: Need to remove this when FusionCharts becomes ES6 modules */ |
| 20 | + if (FCStatic.core && FCStatic.core.getCurrentRenderer && |
| 21 | + FCStatic.core.getCurrentRenderer() === 'javascript') { |
| 22 | + this._fusionchartsStatice = FCStatic.core; |
| 23 | + } |
| 24 | + else { |
| 25 | + this._fusionchartsStatice = FCStatic.core(); |
| 26 | + } |
| 27 | + if (FCStatic && FCStatic.modules) { |
| 28 | + FCStatic.modules.forEach(function (FusionChartsModules) { |
| 29 | + FusionChartsModules(FCStatic.core); |
| 30 | + }); |
| 31 | + } |
| 32 | + } |
| 33 | + FusionChartsService.prototype.getFusionChartsStatic = function () { |
| 34 | + return this._fusionchartsStatice; |
| 35 | + }; |
| 36 | + return FusionChartsService; |
| 37 | +}()); |
| 38 | +FusionChartsService.decorators = [ |
| 39 | + { type: _angular_core.Injectable }, |
| 40 | +]; |
| 41 | +/** @nocollapse */ |
| 42 | +FusionChartsService.ctorParameters = function () { return [ |
| 43 | + { type: FusionChartsStatic, }, |
| 44 | +]; }; |
| 45 | + |
| 46 | +function FusionChartsConstructor(fusionchartsService, chartConfig) { |
| 47 | + var FusionCharts = fusionchartsService.getFusionChartsStatic(); |
| 48 | + return new FusionCharts(chartConfig); |
| 49 | +} |
| 50 | + |
| 51 | +var FusionChartsComponent = (function () { |
| 52 | + function FusionChartsComponent(element, fusionchartsService, differs, zone) { |
| 53 | + this.differs = differs; |
| 54 | + this.zone = zone; |
| 55 | + this.oldDataSource = this.dataSource; |
| 56 | + this.constructerParams = { |
| 57 | + type: true, |
| 58 | + id: true, |
| 59 | + width: true, |
| 60 | + height: true, |
| 61 | + renderAt: true, |
| 62 | + dataFormat: true, |
| 63 | + dataSource: true, |
| 64 | + events: true, |
| 65 | + link: true, |
| 66 | + showDataLoadingMessage: true, |
| 67 | + showChartLoadingMessage: true, |
| 68 | + baseChartMessageFont: true, |
| 69 | + baseChartMessageFontSize: true, |
| 70 | + baseChartMessageColor: true, |
| 71 | + dataLoadStartMessage: true, |
| 72 | + dataLoadErrorMessage: true, |
| 73 | + dataInvalidMessage: true, |
| 74 | + dataEmptyMessage: true, |
| 75 | + typeNotSupportedMessage: true, |
| 76 | + loadMessage: true, |
| 77 | + renderErrorMessage: true, |
| 78 | + containerBackgroundColor: true, |
| 79 | + containerBackgroundOpacity: true, |
| 80 | + containerClassName: true, |
| 81 | + baseChartMessageImageHAlign: true, |
| 82 | + baseChartMessageImageVAlign: true, |
| 83 | + baseChartMessageImageAlpha: true, |
| 84 | + baseChartMessageImageScale: true, |
| 85 | + typeNotSupportedMessageImageHAlign: true, |
| 86 | + typeNotSupportedMessageImageVAlign: true, |
| 87 | + typeNotSupportedMessageImageAlpha: true, |
| 88 | + typeNotSupportedMessageImageScale: true, |
| 89 | + dataLoadErrorMessageImageHAlign: true, |
| 90 | + dataLoadErrorMessageImageVAlign: true, |
| 91 | + dataLoadErrorMessageImageAlpha: true, |
| 92 | + dataLoadErrorMessageImageScale: true, |
| 93 | + dataLoadStartMessageImageHAlign: true, |
| 94 | + dataLoadStartMessageImageVAlign: true, |
| 95 | + dataLoadStartMessageImageAlpha: true, |
| 96 | + dataLoadStartMessageImageScale: true, |
| 97 | + dataInvalidMessageImageHAlign: true, |
| 98 | + dataInvalidMessageImageVAlign: true, |
| 99 | + dataInvalidMessageImageAlpha: true, |
| 100 | + dataInvalidMessageImageScale: true, |
| 101 | + dataEmptyMessageImageHAlign: true, |
| 102 | + dataEmptyMessageImageVAlign: true, |
| 103 | + dataEmptyMessageImageAlpha: true, |
| 104 | + dataEmptyMessageImageScale: true, |
| 105 | + renderErrorMessageImageHAlign: true, |
| 106 | + renderErrorMessageImageVAlign: true, |
| 107 | + renderErrorMessageImageAlpha: true, |
| 108 | + renderErrorMessageImageScale: true, |
| 109 | + loadMessageImageHAlign: true, |
| 110 | + loadMessageImageVAlign: true, |
| 111 | + loadMessageImageAlpha: true, |
| 112 | + loadMessageImageScale: true, |
| 113 | + chartConfig: true |
| 114 | + }; |
| 115 | + this.element = element; |
| 116 | + this.fusionchartsService = fusionchartsService; |
| 117 | + } |
| 118 | + // @ViewChild('samplediv') chartContainer: ElementRef; |
| 119 | + FusionChartsComponent.prototype.ngOnInit = function () { |
| 120 | + this.oldDataSource = JSON.stringify(this.dataSource); |
| 121 | + this.placeholder = this.placeholder || 'FusionCharts will render here'; |
| 122 | + }; |
| 123 | + FusionChartsComponent.prototype.ngOnChanges = function (changes) { |
| 124 | + for (var _i = 0, _a = Object.keys(changes); _i < _a.length; _i++) { |
| 125 | + var i = _a[_i]; |
| 126 | + var key = i.charAt(0).toUpperCase() + i.slice(1), THIS = this, fnName = "update" + key; |
| 127 | + if (THIS[fnName]) { |
| 128 | + THIS[fnName](); |
| 129 | + } |
| 130 | + } |
| 131 | + }; |
| 132 | + FusionChartsComponent.prototype.ngDoCheck = function () { |
| 133 | + var data = JSON.stringify(this.dataSource); |
| 134 | + if (this.oldDataSource === data) { |
| 135 | + } |
| 136 | + else { |
| 137 | + this.updateChartData(); |
| 138 | + this.oldDataSource = data; |
| 139 | + } |
| 140 | + }; |
| 141 | + FusionChartsComponent.prototype.updateChartData = function () { |
| 142 | + var dataFormat = this.configObj.dataFormat || 'json', data = this.dataSource; |
| 143 | + if (this.chartObj) { |
| 144 | + this.chartObj.setChartData(data, dataFormat); |
| 145 | + } |
| 146 | + }; |
| 147 | + FusionChartsComponent.prototype.updateWidth = function () { |
| 148 | + if (this.chartObj) { |
| 149 | + this.chartObj.resizeTo({ |
| 150 | + w: this.width |
| 151 | + }); |
| 152 | + } |
| 153 | + }; |
| 154 | + FusionChartsComponent.prototype.updateHeight = function () { |
| 155 | + if (this.chartObj) { |
| 156 | + this.chartObj.resizeTo({ |
| 157 | + h: this.height |
| 158 | + }); |
| 159 | + } |
| 160 | + }; |
| 161 | + FusionChartsComponent.prototype.updateType = function () { |
| 162 | + if (this.chartObj) { |
| 163 | + this.chartObj.chartType(this.type); |
| 164 | + } |
| 165 | + }; |
| 166 | + FusionChartsComponent.prototype.ngAfterViewInit = function () { |
| 167 | + var _this = this, params = _this.constructerParams, configObj = _this.configObj || (_this.configObj = {}); |
| 168 | + var _chartConfig = _this.chartConfig || {}; |
| 169 | + if (typeof _chartConfig === 'string') { |
| 170 | + _chartConfig = JSON.parse(_chartConfig); |
| 171 | + } |
| 172 | + for (var _i = 0, _a = Object.keys(params); _i < _a.length; _i++) { |
| 173 | + var i = _a[_i]; |
| 174 | + var value = _this[i] || _chartConfig[i]; |
| 175 | + if (value) { |
| 176 | + configObj[i] = value; |
| 177 | + } |
| 178 | + } |
| 179 | + if (configObj['type']) { |
| 180 | + _this.chartObj = FusionChartsConstructor(_this.fusionchartsService, configObj); |
| 181 | + // configObj['renderAt'] = 'container-' + _this.chartObj.id; |
| 182 | + // _this.containerId = _this.chartObj.id; |
| 183 | + this.zone.runOutsideAngular(function () { |
| 184 | + setTimeout(function () { |
| 185 | + _this.chartObj.render(_this.element.nativeElement.querySelector('div')); |
| 186 | + }, 1); |
| 187 | + }); |
| 188 | + } |
| 189 | + }; |
| 190 | + FusionChartsComponent.prototype.ngOnDestroy = function () { |
| 191 | + this.chartObj.dispose(); |
| 192 | + }; |
| 193 | + return FusionChartsComponent; |
| 194 | +}()); |
| 195 | +FusionChartsComponent.decorators = [ |
| 196 | + { type: _angular_core.Component, args: [{ |
| 197 | + selector: 'fusioncharts', |
| 198 | + template: "<div attr.id=\"container-{{containerId}}\" >{{placeholder}}</div>\n ", |
| 199 | + providers: [FusionChartsService], |
| 200 | + },] }, |
| 201 | +]; |
| 202 | +/** @nocollapse */ |
| 203 | +FusionChartsComponent.ctorParameters = function () { return [ |
| 204 | + { type: _angular_core.ElementRef, }, |
| 205 | + { type: FusionChartsService, }, |
| 206 | + { type: _angular_core.KeyValueDiffers, }, |
| 207 | + { type: _angular_core.NgZone, }, |
| 208 | +]; }; |
| 209 | +FusionChartsComponent.propDecorators = { |
| 210 | + 'placeholder': [{ type: _angular_core.Input },], |
| 211 | + 'dataSource': [{ type: _angular_core.Input },], |
| 212 | + 'type': [{ type: _angular_core.Input },], |
| 213 | + 'id': [{ type: _angular_core.Input },], |
| 214 | + 'width': [{ type: _angular_core.Input },], |
| 215 | + 'height': [{ type: _angular_core.Input },], |
| 216 | + 'renderAt': [{ type: _angular_core.Input },], |
| 217 | + 'dataFormat': [{ type: _angular_core.Input },], |
| 218 | + 'events': [{ type: _angular_core.Input },], |
| 219 | + 'link': [{ type: _angular_core.Input },], |
| 220 | + 'showDataLoadingMessage': [{ type: _angular_core.Input },], |
| 221 | + 'showChartLoadingMessage': [{ type: _angular_core.Input },], |
| 222 | + 'baseChartMessageFont': [{ type: _angular_core.Input },], |
| 223 | + 'baseChartMessageFontSize': [{ type: _angular_core.Input },], |
| 224 | + 'baseChartMessageColor': [{ type: _angular_core.Input },], |
| 225 | + 'dataLoadStartMessage': [{ type: _angular_core.Input },], |
| 226 | + 'dataLoadErrorMessage': [{ type: _angular_core.Input },], |
| 227 | + 'dataInvalidMessage': [{ type: _angular_core.Input },], |
| 228 | + 'dataEmptyMessage': [{ type: _angular_core.Input },], |
| 229 | + 'typeNotSupportedMessage': [{ type: _angular_core.Input },], |
| 230 | + 'loadMessage': [{ type: _angular_core.Input },], |
| 231 | + 'renderErrorMessage': [{ type: _angular_core.Input },], |
| 232 | + 'containerBackgroundColor': [{ type: _angular_core.Input },], |
| 233 | + 'containerBackgroundOpacity': [{ type: _angular_core.Input },], |
| 234 | + 'containerClassName': [{ type: _angular_core.Input },], |
| 235 | + 'baseChartMessageImageHAlign': [{ type: _angular_core.Input },], |
| 236 | + 'baseChartMessageImageVAlign': [{ type: _angular_core.Input },], |
| 237 | + 'baseChartMessageImageAlpha': [{ type: _angular_core.Input },], |
| 238 | + 'baseChartMessageImageScale': [{ type: _angular_core.Input },], |
| 239 | + 'typeNotSupportedMessageImageHAlign': [{ type: _angular_core.Input },], |
| 240 | + 'typeNotSupportedMessageImageVAlign': [{ type: _angular_core.Input },], |
| 241 | + 'typeNotSupportedMessageImageAlpha': [{ type: _angular_core.Input },], |
| 242 | + 'typeNotSupportedMessageImageScale': [{ type: _angular_core.Input },], |
| 243 | + 'dataLoadErrorMessageImageHAlign': [{ type: _angular_core.Input },], |
| 244 | + 'dataLoadErrorMessageImageVAlign': [{ type: _angular_core.Input },], |
| 245 | + 'dataLoadErrorMessageImageAlpha': [{ type: _angular_core.Input },], |
| 246 | + 'dataLoadErrorMessageImageScale': [{ type: _angular_core.Input },], |
| 247 | + 'dataLoadStartMessageImageHAlign': [{ type: _angular_core.Input },], |
| 248 | + 'dataLoadStartMessageImageVAlign': [{ type: _angular_core.Input },], |
| 249 | + 'dataLoadStartMessageImageAlpha': [{ type: _angular_core.Input },], |
| 250 | + 'dataLoadStartMessageImageScale': [{ type: _angular_core.Input },], |
| 251 | + 'dataInvalidMessageImageHAlign': [{ type: _angular_core.Input },], |
| 252 | + 'dataInvalidMessageImageVAlign': [{ type: _angular_core.Input },], |
| 253 | + 'dataInvalidMessageImageAlpha': [{ type: _angular_core.Input },], |
| 254 | + 'dataInvalidMessageImageScale': [{ type: _angular_core.Input },], |
| 255 | + 'dataEmptyMessageImageHAlign': [{ type: _angular_core.Input },], |
| 256 | + 'dataEmptyMessageImageVAlign': [{ type: _angular_core.Input },], |
| 257 | + 'dataEmptyMessageImageAlpha': [{ type: _angular_core.Input },], |
| 258 | + 'dataEmptyMessageImageScale': [{ type: _angular_core.Input },], |
| 259 | + 'renderErrorMessageImageHAlign': [{ type: _angular_core.Input },], |
| 260 | + 'renderErrorMessageImageVAlign': [{ type: _angular_core.Input },], |
| 261 | + 'renderErrorMessageImageAlpha': [{ type: _angular_core.Input },], |
| 262 | + 'renderErrorMessageImageScale': [{ type: _angular_core.Input },], |
| 263 | + 'loadMessageImageHAlign': [{ type: _angular_core.Input },], |
| 264 | + 'loadMessageImageVAlign': [{ type: _angular_core.Input },], |
| 265 | + 'loadMessageImageAlpha': [{ type: _angular_core.Input },], |
| 266 | + 'loadMessageImageScale': [{ type: _angular_core.Input },], |
| 267 | + 'chartConfig': [{ type: _angular_core.Input },], |
| 268 | +}; |
| 269 | + |
| 270 | +var FusionChartsDirective = (function () { |
| 271 | + function FusionChartsDirective(el) { |
| 272 | + this.el = el; |
| 273 | + } |
| 274 | + return FusionChartsDirective; |
| 275 | +}()); |
| 276 | +FusionChartsDirective.decorators = [ |
| 277 | + { type: _angular_core.Directive, args: [{ |
| 278 | + selector: '[appFusionchartsDirective]' |
| 279 | + },] }, |
| 280 | +]; |
| 281 | +/** @nocollapse */ |
| 282 | +FusionChartsDirective.ctorParameters = function () { return [ |
| 283 | + { type: _angular_core.ElementRef, }, |
| 284 | +]; }; |
| 285 | + |
| 286 | +/** |
| 287 | + * Transforms any input value |
| 288 | + */ |
| 289 | +var FusionChartsPipe = (function () { |
| 290 | + function FusionChartsPipe() { |
| 291 | + } |
| 292 | + FusionChartsPipe.prototype.transform = function (value, args) { |
| 293 | + return value; |
| 294 | + }; |
| 295 | + return FusionChartsPipe; |
| 296 | +}()); |
| 297 | +FusionChartsPipe.decorators = [ |
| 298 | + { type: _angular_core.Pipe, args: [{ |
| 299 | + name: 'fusionchartsPipe' |
| 300 | + },] }, |
| 301 | + { type: _angular_core.Injectable }, |
| 302 | +]; |
| 303 | +/** @nocollapse */ |
| 304 | +FusionChartsPipe.ctorParameters = function () { return []; }; |
| 305 | + |
| 306 | +var FusionChartsModule = (function () { |
| 307 | + function FusionChartsModule() { |
| 308 | + } |
| 309 | + FusionChartsModule.forRoot = function (fcCore) { |
| 310 | + var fcModules = []; |
| 311 | + for (var _i = 1; _i < arguments.length; _i++) { |
| 312 | + fcModules[_i - 1] = arguments[_i]; |
| 313 | + } |
| 314 | + return { |
| 315 | + ngModule: FusionChartsModule, |
| 316 | + providers: [{ |
| 317 | + provide: FusionChartsStatic, |
| 318 | + useValue: { |
| 319 | + core: fcCore, |
| 320 | + modules: fcModules |
| 321 | + } |
| 322 | + }] |
| 323 | + }; |
| 324 | + }; |
| 325 | + return FusionChartsModule; |
| 326 | +}()); |
| 327 | +FusionChartsModule.decorators = [ |
| 328 | + { type: _angular_core.NgModule, args: [{ |
| 329 | + declarations: [ |
| 330 | + FusionChartsComponent, |
| 331 | + FusionChartsDirective, |
| 332 | + FusionChartsPipe |
| 333 | + ], |
| 334 | + exports: [ |
| 335 | + FusionChartsComponent, |
| 336 | + FusionChartsDirective, |
| 337 | + FusionChartsPipe |
| 338 | + ] |
| 339 | + },] }, |
| 340 | +]; |
| 341 | +/** @nocollapse */ |
| 342 | +FusionChartsModule.ctorParameters = function () { return []; }; |
| 343 | + |
| 344 | +exports.FusionChartsComponent = FusionChartsComponent; |
| 345 | +exports.FusionChartsDirective = FusionChartsDirective; |
| 346 | +exports.FusionChartsPipe = FusionChartsPipe; |
| 347 | +exports.FusionChartsStatic = FusionChartsStatic; |
| 348 | +exports.FusionChartsModule = FusionChartsModule; |
| 349 | + |
| 350 | +Object.defineProperty(exports, '__esModule', { value: true }); |
| 351 | + |
| 352 | +}))); |
0 commit comments