@esfaenza/es-charts 11.2.22 → 11.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { Injectable, InjectionToken, Inject, EventEmitter, Directive, ElementRef, NgZone, Input, ContentChild, Output, Component, ChangeDetectionStrategy, PLATFORM_ID, NgModule } from '@angular/core';
1
+ import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject, Directive, ElementRef, NgZone, PLATFORM_ID, NgModule } from '@angular/core';
2
2
  import { isPlatformBrowser, CommonModule } from '@angular/common';
3
3
  import * as am4core from '@amcharts/amcharts4/core';
4
4
  import { DateService } from '@esfaenza/extensions';
@@ -287,6 +287,89 @@ class LineSerie {
287
287
  }
288
288
  }
289
289
 
290
+ /**
291
+ * Componente che si occupa della paginazione dei grafici qualora servisse
292
+ */
293
+ class PageChartSelector {
294
+ constructor() {
295
+ /**
296
+ * Indica un cambio di pagina ed emette un oggetto con i dati attuali e l'indice attuale.
297
+ *
298
+ * Qualora la proprietà **data** fosse null indica un evento di "loading"
299
+ */
300
+ this.onPageChange = new EventEmitter();
301
+ }
302
+ /**
303
+ * @ignore
304
+ */
305
+ ngOnChanges() {
306
+ if (!(this.Items || this.Dtos) || (this.Items || this.Dtos).length == 0)
307
+ throw new Error("Chart array cannot be empty!");
308
+ var idx = (this.StartIndex || 0);
309
+ this.currentindex = idx;
310
+ this.currentpage = idx + 1;
311
+ this.handlePageChange();
312
+ }
313
+ /**
314
+ * Gestisce un cambio pagina inviando al callback **onPageChange** i dati attuali (siano essi il Dto per il caricamento dati i
315
+ * o i dati già presenti) e l'indice di visualizzazione
316
+ */
317
+ handlePageChange() {
318
+ this.finalIndex = this.currentpage - 1;
319
+ this.currentindex = this.currentpage - 1;
320
+ let data = this.Items && this.Items.length > 0 ? this.Items[this.finalIndex].data : this.Dtos[this.finalIndex];
321
+ this.onPageChange.emit({ data: data, index: this.finalIndex });
322
+ }
323
+ /**
324
+ * Visualizza il grafico successivo
325
+ */
326
+ Next() {
327
+ // Per passare da page a index è sempre un -1
328
+ this.currentpage++;
329
+ this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
330
+ // Delay pseudo-intelligente per click compulsivi.
331
+ // Se dopo questo delay sono andato avanti solo di 1 effettuo il callback altrimenti incremento l'indice
332
+ setTimeout(() => {
333
+ if (this.currentindex == this.currentpage - 2)
334
+ this.handlePageChange();
335
+ else
336
+ this.currentindex++;
337
+ }, this.BrowseDelayMs);
338
+ }
339
+ /**
340
+ * Visualizza il grafico precedente
341
+ */
342
+ Previous() {
343
+ // Per passare da page a index è sempre un -1
344
+ this.currentpage--;
345
+ this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
346
+ // Delay pseudo-intelligente per click compulsivi.
347
+ // Se dopo questo delay sono andato indietro solo di 1 effettuo il callback altrimenti decremento l'indice
348
+ setTimeout(() => {
349
+ if (this.currentindex == this.currentpage)
350
+ this.handlePageChange();
351
+ else
352
+ this.currentindex--;
353
+ }, this.BrowseDelayMs);
354
+ }
355
+ }
356
+ PageChartSelector.decorators = [
357
+ { type: Component, args: [{
358
+ selector: "chart-pager",
359
+ template: "<div *ngIf=\"(Items || Dtos) && (Items || Dtos).length > 0\" class=\"pcs-no-selection\">\r\n <div class=\"pcs-button pcs-backward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"currentpage != 1 && Previous(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"currentpage == 1 ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-left\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div class=\"pcs-infos\">\r\n <ng-container *ngIf=\"headerInner_tr\">\r\n <ng-container *ngTemplateOutlet=\"headerInner_tr; context : {$implicit: (Items || Dtos)[currentpage - 1]}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"pcs-button pcs-forward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"(Items || Dtos).length != currentpage && Next(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"(Items || Dtos).length == currentpage ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-right\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div style=\"clear: both;\"></div>\r\n</div>",
360
+ changeDetection: ChangeDetectionStrategy.OnPush,
361
+ styles: [".pcs-button{width:60px}.pcs-forward{float:right;text-align:end}.pcs-backward{float:left}.pcs-svg-header{width:57px;height:40px}.pcs-svg-button-container{outline:medium none currentcolor}.pcs-svg-arrow{pointer-events:none;fill:#555}.pcs-svg-arrow-right{transform:translate(44px,36px) rotate(180deg)}.pcs-svg-arrow-left{transform:translate(13px,4px)}.pcs-svg-button{fill:#d9d9d9;stroke:#fff;fill-opacity:1;stroke-opacity:1}.pcs-svg-button:hover{fill:#a3a3a3;cursor:pointer}.pcs-infos{width:calc(100% - 120px);height:44px;float:left}.pcs-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}"]
362
+ },] }
363
+ ];
364
+ PageChartSelector.propDecorators = {
365
+ Items: [{ type: Input }],
366
+ Dtos: [{ type: Input }],
367
+ BrowseDelayMs: [{ type: Input }],
368
+ StartIndex: [{ type: Input }],
369
+ onPageChange: [{ type: Output }],
370
+ headerInner_tr: [{ type: ContentChild, args: ['header_inner', { static: false },] }]
371
+ };
372
+
290
373
  /** @ignore */
291
374
  const _spiritedaway = 'spiritedaway';
292
375
  /** @ignore */
@@ -2536,89 +2619,6 @@ class PagedChartData {
2536
2619
  }
2537
2620
  }
2538
2621
 
2539
- /**
2540
- * Componente che si occupa della paginazione dei grafici qualora servisse
2541
- */
2542
- class PageChartSelector {
2543
- constructor() {
2544
- /**
2545
- * Indica un cambio di pagina ed emette un oggetto con i dati attuali e l'indice attuale.
2546
- *
2547
- * Qualora la proprietà **data** fosse null indica un evento di "loading"
2548
- */
2549
- this.onPageChange = new EventEmitter();
2550
- }
2551
- /**
2552
- * @ignore
2553
- */
2554
- ngOnChanges() {
2555
- if (!(this.Items || this.Dtos) || (this.Items || this.Dtos).length == 0)
2556
- throw new Error("Chart array cannot be empty!");
2557
- var idx = (this.StartIndex || 0);
2558
- this.currentindex = idx;
2559
- this.currentpage = idx + 1;
2560
- this.handlePageChange();
2561
- }
2562
- /**
2563
- * Gestisce un cambio pagina inviando al callback **onPageChange** i dati attuali (siano essi il Dto per il caricamento dati i
2564
- * o i dati già presenti) e l'indice di visualizzazione
2565
- */
2566
- handlePageChange() {
2567
- this.finalIndex = this.currentpage - 1;
2568
- this.currentindex = this.currentpage - 1;
2569
- let data = this.Items && this.Items.length > 0 ? this.Items[this.finalIndex].data : this.Dtos[this.finalIndex];
2570
- this.onPageChange.emit({ data: data, index: this.finalIndex });
2571
- }
2572
- /**
2573
- * Visualizza il grafico successivo
2574
- */
2575
- Next() {
2576
- // Per passare da page a index è sempre un -1
2577
- this.currentpage++;
2578
- this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
2579
- // Delay pseudo-intelligente per click compulsivi.
2580
- // Se dopo questo delay sono andato avanti solo di 1 effettuo il callback altrimenti incremento l'indice
2581
- setTimeout(() => {
2582
- if (this.currentindex == this.currentpage - 2)
2583
- this.handlePageChange();
2584
- else
2585
- this.currentindex++;
2586
- }, this.BrowseDelayMs);
2587
- }
2588
- /**
2589
- * Visualizza il grafico precedente
2590
- */
2591
- Previous() {
2592
- // Per passare da page a index è sempre un -1
2593
- this.currentpage--;
2594
- this.onPageChange.emit({ data: null, index: this.currentpage - 1 });
2595
- // Delay pseudo-intelligente per click compulsivi.
2596
- // Se dopo questo delay sono andato indietro solo di 1 effettuo il callback altrimenti decremento l'indice
2597
- setTimeout(() => {
2598
- if (this.currentindex == this.currentpage)
2599
- this.handlePageChange();
2600
- else
2601
- this.currentindex--;
2602
- }, this.BrowseDelayMs);
2603
- }
2604
- }
2605
- PageChartSelector.decorators = [
2606
- { type: Component, args: [{
2607
- selector: "chart-pager",
2608
- template: "<div *ngIf=\"(Items || Dtos) && (Items || Dtos).length > 0\" class=\"pcs-no-selection\">\r\n <div class=\"pcs-button pcs-backward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"currentpage != 1 && Previous(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"currentpage == 1 ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-left\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div class=\"pcs-infos\">\r\n <ng-container *ngIf=\"headerInner_tr\">\r\n <ng-container *ngTemplateOutlet=\"headerInner_tr; context : {$implicit: (Items || Dtos)[currentpage - 1]}\"></ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"pcs-button pcs-forward\">\r\n <svg class=\"pcs-svg-header\">\r\n <g class=\"pcs-svg-button-container\" role=\"button\" (click)=\"(Items || Dtos).length != currentpage && Next(); $event.stopPropagation(); $event.preventDefault();\">\r\n <!--Pulsante e freccettina all'interno-->\r\n <g class=\"pcs-svg-button\" [style.cursor]=\"(Items || Dtos).length == currentpage ? 'not-allowed' : 'pointer'\"><path d=\"M3,0 L53.027,0 a3,3 0 0 1 3,3 L56.027,36.817 a3,3 0 0 1 -3,3 L3,39.817 a3,3 0 0 1 -3,-3 L0,3 a3,3 0 0 1 3,-3 Z\"></path></g>\r\n <g class=\"pcs-svg-arrow pcs-svg-arrow-right\"><path d=\"M26,14H10l5.17-6.79A2,2,0,0,0,12,4.79l-7.62,10a2,2,0,0,0,0,2.42l7.62,10a2,2,0,0,0,3.18-2.42L10,18H26a2,2,0,0,0,0-4Z\"></path></g>\r\n </g>\r\n </svg>\r\n </div>\r\n <div style=\"clear: both;\"></div>\r\n</div>",
2609
- changeDetection: ChangeDetectionStrategy.OnPush,
2610
- styles: [".pcs-button{width:60px}.pcs-forward{float:right;text-align:end}.pcs-backward{float:left}.pcs-svg-header{width:57px;height:40px}.pcs-svg-button-container{outline:medium none currentcolor}.pcs-svg-arrow{pointer-events:none;fill:#555}.pcs-svg-arrow-right{transform:translate(44px,36px) rotate(180deg)}.pcs-svg-arrow-left{transform:translate(13px,4px)}.pcs-svg-button{fill:#d9d9d9;stroke:#fff;fill-opacity:1;stroke-opacity:1}.pcs-svg-button:hover{fill:#a3a3a3;cursor:pointer}.pcs-infos{width:calc(100% - 120px);height:44px;float:left}.pcs-no-selection{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none}"]
2611
- },] }
2612
- ];
2613
- PageChartSelector.propDecorators = {
2614
- Items: [{ type: Input }],
2615
- Dtos: [{ type: Input }],
2616
- BrowseDelayMs: [{ type: Input }],
2617
- StartIndex: [{ type: Input }],
2618
- onPageChange: [{ type: Output }],
2619
- headerInner_tr: [{ type: ContentChild, args: ['header_inner', { static: false },] }]
2620
- };
2621
-
2622
2622
  /** Componenti esportati dal modulo */
2623
2623
  const COMPONENTS = [
2624
2624
  EsChartComponent,
@@ -2663,5 +2663,5 @@ EsChartsModule.decorators = [
2663
2663
  * Generated bundle index. Do not edit.
2664
2664
  */
2665
2665
 
2666
- export { AreaChartData, AreaChartSettings, BaseAdapter, BaseChartComponent, BaseInterval, BaseSettings, ChartThemes, DateValue, EsAreaChartComponent, EsChartComponent, EsChartsModule, EsLineChartComponent, EsPieChartComponent, EsVertical2DChartComponent, EsVerticalChartComponent, EsVerticalStackedChartComponent, KeyValue, KeyValueColor, LegendPad, Limit, LineChartData, LineChartSettings, LineSerie, PagedChartData, PieChartData, PieChartSettings, Vertical2DChartData, Vertical2DChartSettings, VerticalChartData, VerticalChartSettings, VerticalStackedChartData, VerticalStackedChartSettings, ChartLoader as ɵa, ChartDispatcher as ɵb, ESC_LOCALE as ɵc, ESC_ANIMATIONS as ɵd, ESC_THEME as ɵe, ESC_LOGS as ɵf, PageChartSelector as ɵg };
2666
+ export { AreaChartData, AreaChartSettings, BaseAdapter, BaseChartComponent, BaseInterval, BaseSettings, ChartThemes, DateValue, EsAreaChartComponent, EsChartComponent, EsChartsModule, EsLineChartComponent, EsPieChartComponent, EsVertical2DChartComponent, EsVerticalChartComponent, EsVerticalStackedChartComponent, KeyValue, KeyValueColor, LegendPad, Limit, LineChartData, LineChartSettings, LineSerie, PageChartSelector, PagedChartData, PieChartData, PieChartSettings, Vertical2DChartData, Vertical2DChartSettings, VerticalChartData, VerticalChartSettings, VerticalStackedChartData, VerticalStackedChartSettings, ChartLoader as ɵa, ChartDispatcher as ɵb, ESC_LOCALE as ɵc, ESC_ANIMATIONS as ɵd, ESC_THEME as ɵe, ESC_LOGS as ɵf };
2667
2667
  //# sourceMappingURL=esfaenza-es-charts.js.map