@eqproject/eqp-dynamic-module 2.4.12 → 2.4.13

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,7 +1,7 @@
1
1
  import * as i2$2 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, EventEmitter, Component, Input, ViewChild, Output, ViewChildren, NgModule, Inject } from '@angular/core';
4
+ import { Injectable, EventEmitter, Component, Input, ViewChild, Output, ViewChildren, HostListener, NgModule, Inject } from '@angular/core';
5
5
  import * as i5 from '@angular/forms';
6
6
  import { Validators, UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
7
  import Swal from 'sweetalert2';
@@ -51,6 +51,7 @@ import { MatNativeDateModule } from '@angular/material/core';
51
51
  import * as i5$3 from '@angular/material/select';
52
52
  import { MatSelectModule } from '@angular/material/select';
53
53
  import * as i2$5 from '@angular/platform-browser';
54
+ import * as ss from 'simple-statistics';
54
55
  import * as i2$6 from '@canvasjs/angular-stockcharts';
55
56
  import { CanvasJSAngularStockChartsModule, CanvasJSChart, CanvasJSStockChart } from '@canvasjs/angular-stockcharts';
56
57
  import * as i8 from '@angular/material/autocomplete';
@@ -3181,7 +3182,8 @@ class ImageFieldSelectorTemplateComponent {
3181
3182
  this.recordChange = new EventEmitter();
3182
3183
  }
3183
3184
  ngOnInit() {
3184
- console.log("RECORD ngOnInit()", this.record[this.field.Name], this.field);
3185
+ GlobalService.debugLog("ImageFieldSelectorTemplateComponent - RECORD ngOnInit() - record", this.record[this.field.Name]);
3186
+ GlobalService.debugLog("ImageFieldSelectorTemplateComponent - RECORD ngOnInit() - field", this.field);
3185
3187
  this.initStyles();
3186
3188
  this.initializeAttachments();
3187
3189
  }
@@ -4770,10 +4772,15 @@ class Coords {
4770
4772
  }
4771
4773
 
4772
4774
  class GraphComponent {
4775
+ onResize() {
4776
+ this.loaded = false;
4777
+ this.loadGraph(Math.floor(window.innerWidth / 2));
4778
+ }
4773
4779
  constructor(datePipe) {
4774
4780
  this.datePipe = datePipe;
4775
4781
  this.data = new Array();
4776
4782
  this.title = "";
4783
+ this.trendColor = '#EB0102';
4777
4784
  this.loaded = false;
4778
4785
  this.counter = 0;
4779
4786
  }
@@ -4781,48 +4788,92 @@ class GraphComponent {
4781
4788
  var self = this;
4782
4789
  // Aggiustamento e scrittura dati
4783
4790
  if (this.data.length > 0) {
4784
- var lastvalue = this.data[0];
4785
- var firstvalue = this.data[this.data.length - 1];
4786
- var stockChartMinimum = new Date(firstvalue.x);
4787
- var stockChartMaximum = new Date(lastvalue.x);
4788
- var stockChartTitleText = this.title;
4789
- var stockChartdataPoints = this.data;
4790
- this.stockChartOptions = {
4791
- theme: 'light2',
4792
- animationEnabled: true,
4793
- width: 1000,
4794
- height: 500,
4795
- creditText: "",
4796
- creditHref: "",
4797
- title: {
4798
- text: stockChartTitleText
4799
- },
4800
- charts: [{
4801
- axisX: {
4802
- labelFormatter: this.labelFormatterFunction,
4791
+ this.loadGraph(Math.floor(window.innerWidth / 2));
4792
+ }
4793
+ }
4794
+ loadGraph(width) {
4795
+ var lastvalue = this.data[0];
4796
+ var firstvalue = this.data[this.data.length - 1];
4797
+ var stockChartMinimum = new Date(firstvalue.x);
4798
+ var stockChartMaximum = new Date(lastvalue.x);
4799
+ var stockChartTitleText = this.title;
4800
+ var stockChartdataPoints = this.data;
4801
+ this.linearRegression = new Array();
4802
+ this.trend = "";
4803
+ stockChartdataPoints.reverse();
4804
+ if (stockChartdataPoints.length > 2) {
4805
+ let x = [];
4806
+ for (let i = 0; i < stockChartdataPoints.length; i++) {
4807
+ x.push([i, stockChartdataPoints[i].y]);
4808
+ }
4809
+ let parameters = ss.linearRegression(x);
4810
+ this.m = parameters.m;
4811
+ this.q = parameters.b;
4812
+ if (this.m > 0) {
4813
+ this.trend += " ↗";
4814
+ }
4815
+ else if (this.m < 0) {
4816
+ this.trend += " ↘";
4817
+ }
4818
+ // console.log(x);
4819
+ // console.log(stockChartdataPoints);
4820
+ for (let i = 0; i < stockChartdataPoints.length; i++) {
4821
+ this.linearRegression.push({ x: stockChartdataPoints[i].x,
4822
+ y: this.m * i + this.q,
4823
+ label: stockChartdataPoints[i].label,
4824
+ name: stockChartdataPoints[i].name
4825
+ });
4826
+ }
4827
+ //this.linearRegression.reverse();
4828
+ // console.log(this.linearRegression);
4829
+ // console.log(this.m);
4830
+ // console.log(this.q);
4831
+ }
4832
+ this.stockChartOptions = {
4833
+ theme: 'light2',
4834
+ animationEnabled: true,
4835
+ width: width,
4836
+ height: 500,
4837
+ creditText: "",
4838
+ creditHref: "",
4839
+ title: {
4840
+ text: stockChartTitleText
4841
+ },
4842
+ charts: [{
4843
+ axisX: {
4844
+ labelFormatter: this.labelFormatterFunction,
4845
+ },
4846
+ data: [{
4847
+ type: "spline",
4848
+ dataPoints: stockChartdataPoints
4803
4849
  },
4804
- data: [{
4805
- type: "line",
4806
- dataPoints: stockChartdataPoints
4807
- }],
4808
- culture: "it"
4809
- }],
4810
- rangeSelector: {
4811
- enabled: false
4812
- },
4813
- navigator: {
4814
- slider: {
4815
- minimum: stockChartMinimum,
4816
- maximum: stockChartMaximum
4817
- }
4818
- },
4819
- options: {
4820
- responsive: true,
4821
- maintainAspectRatio: false
4850
+ {
4851
+ //toolTipContent: null,
4852
+ type: 'line',
4853
+ color: this.trendColor,
4854
+ showInLegend: true,
4855
+ legendMarkerType: "none",
4856
+ markerType: "none",
4857
+ legendText: "Trend" + this.trend,
4858
+ dataPoints: this.linearRegression
4859
+ }],
4860
+ culture: "it"
4861
+ }],
4862
+ rangeSelector: {
4863
+ enabled: false
4864
+ },
4865
+ navigator: {
4866
+ slider: {
4867
+ minimum: stockChartMinimum,
4868
+ maximum: stockChartMaximum
4822
4869
  }
4823
- };
4824
- this.loaded = true;
4825
- }
4870
+ },
4871
+ options: {
4872
+ responsive: true,
4873
+ maintainAspectRatio: false
4874
+ }
4875
+ };
4876
+ this.loaded = true;
4826
4877
  }
4827
4878
  labelFormatterFunction(e) {
4828
4879
  let label = "";
@@ -4874,11 +4925,14 @@ class GraphComponent {
4874
4925
  }
4875
4926
  }
4876
4927
  GraphComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GraphComponent, deps: [{ token: i2$2.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
4877
- GraphComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GraphComponent, selector: "graph", inputs: { data: "data", title: "title" }, ngImport: i0, template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$6.CanvasJSStockChart, selector: "canvasjs-stockchart", inputs: ["options", "styles"], outputs: ["stockChartInstance"] }] });
4928
+ GraphComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GraphComponent, selector: "graph", inputs: { data: "data", title: "title" }, host: { listeners: { "window:resize": "onResize($event)" } }, ngImport: i0, template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$6.CanvasJSStockChart, selector: "canvasjs-stockchart", inputs: ["options", "styles"], outputs: ["stockChartInstance"] }] });
4878
4929
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GraphComponent, decorators: [{
4879
4930
  type: Component,
4880
4931
  args: [{ selector: 'graph', template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>" }]
4881
- }], ctorParameters: function () { return [{ type: i2$2.DatePipe }]; }, propDecorators: { data: [{
4932
+ }], ctorParameters: function () { return [{ type: i2$2.DatePipe }]; }, propDecorators: { onResize: [{
4933
+ type: HostListener,
4934
+ args: ['window:resize', ['$event']]
4935
+ }], data: [{
4882
4936
  type: Input,
4883
4937
  args: ["data"]
4884
4938
  }], title: [{