@hestia-earth/ui-components 0.6.2 → 0.6.3

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.
@@ -6863,23 +6863,26 @@
6863
6863
  return this.selectedTerm ? this.updateChart() : null;
6864
6864
  };
6865
6865
  CyclesEmissionsChartComponent.prototype.initChart = function () {
6866
+ var _this = this;
6866
6867
  var _a, _b;
6867
- var termId = this.selectedTerm['@id'];
6868
- var values = (this.emissionPerCycle[termId] || { value: {} }).values;
6868
+ var termName = (_a = this.selectedTerm) === null || _a === void 0 ? void 0 : _a.name;
6869
+ var values = (this.emissionPerCycle[termName] || { values: {} }).values;
6870
+ var labels = this.cycles.map(cycleName);
6869
6871
  var colors = this.cycles.map(function (impact, index) { return itemColor(index); });
6872
+ var datasets = [{
6873
+ label: termName || '',
6874
+ data: this.cycles.map(function (cycle) { var _a; return term.propertyValue(cycleValue(cycle, values), (_a = _this.selectedTerm) === null || _a === void 0 ? void 0 : _a['@id']); }),
6875
+ backgroundColor: colors,
6876
+ borderColor: colors
6877
+ }];
6870
6878
  if (this.chart) {
6871
6879
  this.chart.destroy();
6872
6880
  }
6873
- this.chart = new chart_js.Chart((_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.nativeElement, {
6881
+ this.chart = new chart_js.Chart((_b = this.chartRef) === null || _b === void 0 ? void 0 : _b.nativeElement, {
6874
6882
  type: 'bar',
6875
6883
  data: {
6876
- labels: this.cycles.map(cycleName),
6877
- datasets: [{
6878
- label: ((_b = this.selectedTerm) === null || _b === void 0 ? void 0 : _b.name) || '',
6879
- data: this.cycles.map(function (cycle) { return term.propertyValue(cycleValue(cycle, values), termId); }),
6880
- backgroundColor: colors,
6881
- borderColor: colors
6882
- }]
6884
+ labels: labels,
6885
+ datasets: datasets
6883
6886
  },
6884
6887
  plugins: [ChartDataLabels__default["default"]],
6885
6888
  options: {
@@ -6917,7 +6920,7 @@
6917
6920
  return CyclesEmissionsChartComponent;
6918
6921
  }());
6919
6922
  CyclesEmissionsChartComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesEmissionsChartComponent, deps: [{ token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
6920
- CyclesEmissionsChartComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesEmissionsChartComponent, selector: "he-cycles-emissions-chart", inputs: { cycles: "cycles" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"p-3\" [class.is-hidden]=\"!terms?.length\">\n <div class=\"field is-horizontal\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"selectedTerm\">\n <span>Select a column</span>\n </label>\n </div>\n <div class=\"field-body\">\n <div class=\"control\">\n <div class=\"select is-small\">\n <select (change)=\"updateChart()\" [(ngModel)]=\"selectedTerm\" id=\"selectedTerm\">\n <option *ngFor=\"let term of terms\" [ngValue]=\"term\">{{term.name}} ({{term.units}})</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"mt-1\">\n <div class=\"chart-container\">\n <canvas #chart></canvas>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;overflow:visible}.chart-container{height:400px;position:relative}\n"], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] });
6923
+ CyclesEmissionsChartComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CyclesEmissionsChartComponent, selector: "he-cycles-emissions-chart", inputs: { cycles: "cycles" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"p-3\" [class.is-hidden]=\"!terms?.length\">\n <div class=\"field is-horizontal\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"selectedTerm\">\n <span>Select an Emission</span>\n </label>\n </div>\n <div class=\"field-body\">\n <div class=\"control\">\n <div class=\"select is-small\">\n <select (change)=\"updateChart()\" [(ngModel)]=\"selectedTerm\" id=\"selectedTerm\">\n <option *ngFor=\"let term of terms\" [ngValue]=\"term\">{{term.name}} ({{term.units}})</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"mt-1\">\n <div class=\"chart-container\">\n <canvas #chart></canvas>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;overflow:visible}.chart-container{height:400px;position:relative}\n"], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] });
6921
6924
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: CyclesEmissionsChartComponent, decorators: [{
6922
6925
  type: i0.Component,
6923
6926
  args: [{
@@ -9871,21 +9874,24 @@
9871
9874
  };
9872
9875
  ImpactAssessmentsIndicatorsChartComponent.prototype.initChart = function () {
9873
9876
  var _a, _b;
9874
- var values = (this.indicatorPerImpactAssessment[this.selectedTerm['@id']] || { values: {} }).values;
9877
+ var termName = (_a = this.selectedTerm) === null || _a === void 0 ? void 0 : _a.name;
9878
+ var values = (this.indicatorPerImpactAssessment[termName] || { values: {} }).values;
9879
+ var labels = this.impactAssessments.map(impactName);
9875
9880
  var colors = this.impactAssessments.map(function (impact, index) { return itemColor(index); });
9881
+ var datasets = [{
9882
+ label: termName || '',
9883
+ data: this.impactAssessments.map(function (impact) { return impactValue(impact, values); }),
9884
+ backgroundColor: colors,
9885
+ borderColor: colors
9886
+ }];
9876
9887
  if (this.chart) {
9877
9888
  this.chart.destroy();
9878
9889
  }
9879
- this.chart = new chart_js.Chart((_a = this.chartRef) === null || _a === void 0 ? void 0 : _a.nativeElement, {
9890
+ this.chart = new chart_js.Chart((_b = this.chartRef) === null || _b === void 0 ? void 0 : _b.nativeElement, {
9880
9891
  type: 'bar',
9881
9892
  data: {
9882
- labels: this.impactAssessments.map(impactName),
9883
- datasets: [{
9884
- label: ((_b = this.selectedTerm) === null || _b === void 0 ? void 0 : _b.name) || '',
9885
- data: this.impactAssessments.map(function (impact) { return impactValue(impact, values); }),
9886
- backgroundColor: colors,
9887
- borderColor: colors
9888
- }]
9893
+ labels: labels,
9894
+ datasets: datasets
9889
9895
  },
9890
9896
  plugins: [ChartDataLabels__default["default"]],
9891
9897
  options: {
@@ -9926,7 +9932,7 @@
9926
9932
  return ImpactAssessmentsIndicatorsChartComponent;
9927
9933
  }());
9928
9934
  ImpactAssessmentsIndicatorsChartComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ImpactAssessmentsIndicatorsChartComponent, deps: [{ token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
9929
- ImpactAssessmentsIndicatorsChartComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ImpactAssessmentsIndicatorsChartComponent, selector: "he-impact-assessments-indicators-chart", inputs: { impactAssessments: "impactAssessments", key: "key", filterTermTypes: "filterTermTypes" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"p-3\" [class.is-hidden]=\"!terms?.length\">\n <div class=\"field is-horizontal\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"selectedTerm\">\n <span>Select a column</span>\n </label>\n </div>\n <div class=\"field-body\">\n <div class=\"control\">\n <div class=\"select is-small\">\n <select (change)=\"updateChart()\" [(ngModel)]=\"selectedTerm\" id=\"selectedTerm\">\n <option *ngFor=\"let term of terms\" [ngValue]=\"term\">{{term.name}} ({{term.units}})</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"mt-1\">\n <div class=\"chart-container\">\n <canvas #chart></canvas>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;overflow:visible}.chart-container{height:400px;position:relative}\n"], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] });
9935
+ ImpactAssessmentsIndicatorsChartComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ImpactAssessmentsIndicatorsChartComponent, selector: "he-impact-assessments-indicators-chart", inputs: { impactAssessments: "impactAssessments", key: "key", filterTermTypes: "filterTermTypes" }, viewQueries: [{ propertyName: "chartRef", first: true, predicate: ["chart"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"p-3\" [class.is-hidden]=\"!terms?.length\">\n <div class=\"field is-horizontal\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"selectedTerm\">\n <span>Select an Indicator</span>\n </label>\n </div>\n <div class=\"field-body\">\n <div class=\"control\">\n <div class=\"select is-small\">\n <select (change)=\"updateChart()\" [(ngModel)]=\"selectedTerm\" id=\"selectedTerm\">\n <option *ngFor=\"let term of terms\" [ngValue]=\"term\">{{term.name}} ({{term.units}})</option>\n </select>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"mt-1\">\n <div class=\"chart-container\">\n <canvas #chart></canvas>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;overflow:visible}.chart-container{height:400px;position:relative}\n"], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }] });
9930
9936
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ImpactAssessmentsIndicatorsChartComponent, decorators: [{
9931
9937
  type: i0.Component,
9932
9938
  args: [{