@hestia-earth/ui-components 0.41.54 → 0.41.55

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.
@@ -6064,10 +6064,17 @@ const drawText = (ctx, { text, font, fillStyle, placement, xPos, yPos, maxWidth
6064
6064
  ctx.fillText(text, xPos, yPos, maxWidth);
6065
6065
  }
6066
6066
  };
6067
+ const calculateNextData = (currentData, newData, hasExistingData) => isUndefined(newData)
6068
+ ? currentData
6069
+ : hasExistingData
6070
+ ? typeof newData === 'number' && typeof currentData === 'number'
6071
+ ? currentData + newData
6072
+ : newData
6073
+ : newData;
6067
6074
  const afterBarDrawPlugin = settings => ({
6068
6075
  id: ['afterBarDrawPlugin', settings?.placement].filter(Boolean).join('-'),
6069
6076
  afterDatasetsDraw: (chart) => {
6070
- if (!chart.data.datasets?.length) {
6077
+ if (!chart.data.datasets?.length || !chart.data.labels?.length) {
6071
6078
  return;
6072
6079
  }
6073
6080
  const { placement, xPosFn, yPosFn, colorFn, textFn, maxWidth, font, emptyValueLabel } = {
@@ -6076,31 +6083,55 @@ const afterBarDrawPlugin = settings => ({
6076
6083
  };
6077
6084
  const { ctx, width, height } = chart;
6078
6085
  ctx.save();
6079
- const meta = chart.getDatasetMeta(0);
6080
- const dataset = chart.data.datasets[0];
6081
- const elements = meta.data;
6082
- elements
6083
- .filter(element => !element.skip)
6084
- .forEach((element, index) => {
6085
- const { x, y, base } = element;
6086
- const label = chart.data.labels?.[index] ?? '';
6087
- const data = dataset.data[index];
6088
- // use min/max as both negative values would inverse the positions
6089
- const anchorX = placement === 'left' ? Math.min(base, x) : Math.max(base, x);
6090
- const xPos = xPosFn(anchorX, index, width, chart, data, placement);
6091
- const yPos = yPosFn(y, index, height, chart, data, placement);
6092
- const text = isUndefined(data) ? emptyValueLabel : textFn({ label, data }, index, chart);
6093
- text &&
6086
+ const getStackItems = (index) => chart.data.datasets
6087
+ .map((dataset, dsIndex) => ({ dataset, meta: chart.getDatasetMeta(dsIndex) }))
6088
+ .filter(({ meta }) => !meta.hidden)
6089
+ .map(({ dataset, meta }) => ({
6090
+ element: meta.data[index],
6091
+ dataVal: dataset.data[index]
6092
+ }))
6093
+ .filter(({ element }) => element && !element.skip);
6094
+ const aggregateStackItems = (stackItems) => stackItems.reduce((acc, { element, dataVal }) => ({
6095
+ finalData: calculateNextData(acc.finalData, dataVal, acc.hasData),
6096
+ hasData: acc.hasData || !isUndefined(dataVal),
6097
+ minX: Math.min(acc.minX, element.base, element.x),
6098
+ maxX: Math.max(acc.maxX, element.base, element.x),
6099
+ lastVisibleElement: element
6100
+ }), {
6101
+ finalData: undefined,
6102
+ hasData: false,
6103
+ minX: Infinity,
6104
+ maxX: -Infinity,
6105
+ lastVisibleElement: stackItems[0].element
6106
+ });
6107
+ const getLabel = (index) => chart.data.labels?.[index] ?? '';
6108
+ const getXPos = (anchorX, index, dataToPass) => xPosFn(anchorX, index, width, chart, dataToPass, placement);
6109
+ const getYPos = (y, index, dataToPass) => yPosFn(y, index, height, chart, dataToPass, placement);
6110
+ const getAnchorX = (minX, maxX) => (placement === 'left' ? minX : maxX);
6111
+ const processIndex = (index) => {
6112
+ const stackItems = getStackItems(index);
6113
+ if (!stackItems.length) {
6114
+ return;
6115
+ }
6116
+ const { finalData, hasData, minX, maxX, lastVisibleElement } = aggregateStackItems(stackItems);
6117
+ const dataToPass = hasData ? finalData : undefined;
6118
+ const text = !hasData
6119
+ ? emptyValueLabel
6120
+ : textFn({ label: getLabel(index), data: dataToPass }, index, chart);
6121
+ if (text) {
6094
6122
  drawText(ctx, {
6095
6123
  text,
6096
- font,
6097
- fillStyle: colorFn(element.options, index, chart, data),
6098
- placement,
6099
- xPos,
6100
- yPos,
6101
- maxWidth
6124
+ font: font,
6125
+ fillStyle: colorFn(lastVisibleElement.options, index, chart, dataToPass),
6126
+ placement: placement,
6127
+ xPos: getXPos(getAnchorX(minX, maxX), index, dataToPass),
6128
+ yPos: getYPos(lastVisibleElement.y, index, dataToPass),
6129
+ maxWidth: maxWidth
6102
6130
  });
6103
- });
6131
+ }
6132
+ };
6133
+ const indices = Array.from({ length: chart.data.labels.length }, (_, i) => i);
6134
+ indices.forEach(processIndex);
6104
6135
  ctx.restore();
6105
6136
  }
6106
6137
  });
@@ -6798,18 +6829,18 @@ const tooltipFn = ({ label, selectedLabel, units, values }) => `
6798
6829
  <div class="is-align-self-stretch has-text-right is-p-1 has-text-secondary has-text-weight-semibold is-size-7 with-border-secondary-accent" style="border-top-width:1px">Total</div>
6799
6830
  </div>
6800
6831
  <div class="is-flex is-flex-direction-column is-align-items-center is-align-self-stretch h-100 is-pl-1">
6801
- <div class="is-align-self-stretch is-p-1 has-text-secondary has-text-weight-bold is-size-7 with-border-secondary-accent" style="border-bottom-width:1px">${units}</div>
6832
+ <div class="is-align-self-stretch is-p-1 has-text-secondary has-text-weight-bold is-size-7 with-border-secondary-accent" style="border-bottom-width:1px">${units || '&nbsp;'}</div>
6802
6833
 
6803
6834
  ${values
6804
6835
  .map(value => `
6805
6836
  <div class="is-flex is-flex-direction-column is-align-self-stretch">
6806
6837
  <div class="is-flex is-align-items-center is-gap-4 is-p-1 has-text-grey-dark is-size-7" style="height:21px">
6807
- <span class="${value.label === selectedLabel ? 'has-text-weight-bold' : ''}">${transform(value.value) || 0}</span>
6838
+ <span class="${value.label === selectedLabel ? 'has-text-weight-bold' : ''}">${transform(value.value) || '-'}</span>
6808
6839
  </div>
6809
6840
  ${((value.label === selectedLabel ? value.includedItems : []) || [])
6810
6841
  .map(included => `
6811
6842
  <div class="is-flex is-align-items-center is-gap-4 is-p-1 has-text-grey-dark is-size-7" style="height:21px">
6812
- <span>${transform(included.value) || 0}</span>
6843
+ <span>${transform(included.value) || '-'}</span>
6813
6844
  </div>
6814
6845
  `)
6815
6846
  .join('')}
@@ -6924,7 +6955,13 @@ class ContributionChartComponent {
6924
6955
  }
6925
6956
  }
6926
6957
  },
6927
- plugins: [backgroundHoverPlugin({ threshold: hoverHeight })]
6958
+ plugins: [
6959
+ backgroundHoverPlugin({ threshold: hoverHeight }),
6960
+ afterBarDrawPlugin({
6961
+ placement: 'right',
6962
+ textFn: ({ data }) => (isUndefined(data) ? 'No data' : '')
6963
+ })
6964
+ ]
6928
6965
  }), ...(ngDevMode ? [{ debugName: "defaultConfig" }] : []));
6929
6966
  this.dataConfig = computed(() => ({
6930
6967
  datasets: this.displayData().map(item => ({
@@ -6969,11 +7006,11 @@ class ContributionChartComponent {
6969
7006
  return downloadFile(this.csvContent(), `${title}-contribution.csv`);
6970
7007
  }
6971
7008
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ContributionChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6972
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ContributionChartComponent, isStandalone: true, selector: "he-contribution-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showExportButton: { classPropertyName: "showExportButton", publicName: "showExportButton", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, category: { classPropertyName: "category", publicName: "category", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ChartComponent, descendants: true, isSignal: true }, { propertyName: "tooltip", first: true, predicate: ChartTooltipComponent, descendants: true, isSignal: true }], exportAs: ["contributionChart"], ngImport: i0, template: "<div [class.chart-area-border]=\"showLegend()\">\n <he-chart\n [data]=\"dataConfig()\"\n [config]=\"configuration()\"\n [showExportButton]=\"showExportButton()\"\n [style.height.px]=\"chartHeight()\">\n <he-chart-tooltip [tooltipFn]=\"tooltipFn\" />\n </he-chart>\n</div>\n\n@if (showLegend()) {\n <he-bar-chart-legend [data]=\"displayData()\" />\n}\n", styles: [":host{display:block}he-chart{height:400px}he-bar-chart-legend ::ng-deep .breakdown-legend--color{border-radius:3px}\n"], dependencies: [{ kind: "component", type: ChartComponent, selector: "he-chart", inputs: ["data", "config", "showExportButton"], exportAs: ["chart"] }, { kind: "component", type: ChartTooltipComponent, selector: "he-chart-tooltip", inputs: ["tooltipFn"], exportAs: ["chartTooltip"] }, { kind: "component", type: BarChartLegendComponent, selector: "he-bar-chart-legend", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7009
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ContributionChartComponent, isStandalone: true, selector: "he-contribution-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, showExportButton: { classPropertyName: "showExportButton", publicName: "showExportButton", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, category: { classPropertyName: "category", publicName: "category", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ChartComponent, descendants: true, isSignal: true }, { propertyName: "tooltip", first: true, predicate: ChartTooltipComponent, descendants: true, isSignal: true }], exportAs: ["contributionChart"], ngImport: i0, template: "<div class=\"is-relative\" [class.chart-area-border]=\"showLegend()\">\n <he-chart\n [data]=\"dataConfig()\"\n [config]=\"configuration()\"\n [showExportButton]=\"showExportButton()\"\n [style.height.px]=\"chartHeight()\">\n <he-chart-tooltip [tooltipFn]=\"tooltipFn\" />\n </he-chart>\n\n @if (!data()?.length) {\n <div class=\"is-absolute w-100 h-100 | no-data\">\n <div class=\"is-flex is-justify-content-center is-align-items-center w-100 h-100\">\n <span class=\"is-size-7\">No contribution available.</span>\n </div>\n </div>\n }\n</div>\n\n@if (showLegend()) {\n <he-bar-chart-legend [data]=\"displayData()\" />\n}\n", styles: [":host{display:block}he-chart{height:400px}he-bar-chart-legend ::ng-deep .breakdown-legend--color{border-radius:3px}.no-data{top:0;background-color:#0000004d}\n"], dependencies: [{ kind: "component", type: ChartComponent, selector: "he-chart", inputs: ["data", "config", "showExportButton"], exportAs: ["chart"] }, { kind: "component", type: ChartTooltipComponent, selector: "he-chart-tooltip", inputs: ["tooltipFn"], exportAs: ["chartTooltip"] }, { kind: "component", type: BarChartLegendComponent, selector: "he-bar-chart-legend", inputs: ["data"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6973
7010
  }
6974
7011
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ContributionChartComponent, decorators: [{
6975
7012
  type: Component$1,
6976
- args: [{ selector: 'he-contribution-chart', exportAs: 'contributionChart', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ChartComponent, ChartTooltipComponent, BarChartLegendComponent], template: "<div [class.chart-area-border]=\"showLegend()\">\n <he-chart\n [data]=\"dataConfig()\"\n [config]=\"configuration()\"\n [showExportButton]=\"showExportButton()\"\n [style.height.px]=\"chartHeight()\">\n <he-chart-tooltip [tooltipFn]=\"tooltipFn\" />\n </he-chart>\n</div>\n\n@if (showLegend()) {\n <he-bar-chart-legend [data]=\"displayData()\" />\n}\n", styles: [":host{display:block}he-chart{height:400px}he-bar-chart-legend ::ng-deep .breakdown-legend--color{border-radius:3px}\n"] }]
7013
+ args: [{ selector: 'he-contribution-chart', exportAs: 'contributionChart', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ChartComponent, ChartTooltipComponent, BarChartLegendComponent], template: "<div class=\"is-relative\" [class.chart-area-border]=\"showLegend()\">\n <he-chart\n [data]=\"dataConfig()\"\n [config]=\"configuration()\"\n [showExportButton]=\"showExportButton()\"\n [style.height.px]=\"chartHeight()\">\n <he-chart-tooltip [tooltipFn]=\"tooltipFn\" />\n </he-chart>\n\n @if (!data()?.length) {\n <div class=\"is-absolute w-100 h-100 | no-data\">\n <div class=\"is-flex is-justify-content-center is-align-items-center w-100 h-100\">\n <span class=\"is-size-7\">No contribution available.</span>\n </div>\n </div>\n }\n</div>\n\n@if (showLegend()) {\n <he-bar-chart-legend [data]=\"displayData()\" />\n}\n", styles: [":host{display:block}he-chart{height:400px}he-bar-chart-legend ::ng-deep .breakdown-legend--color{border-radius:3px}.no-data{top:0;background-color:#0000004d}\n"] }]
6977
7014
  }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], showExportButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showExportButton", required: false }] }], showLegend: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLegend", required: false }] }], config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], category: [{ type: i0.Input, args: [{ isSignal: true, alias: "category", required: false }] }], chart: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ChartComponent), { isSignal: true }] }], tooltip: [{ type: i0.ViewChild, args: [i0.forwardRef(() => ChartTooltipComponent), { isSignal: true }] }] } });
6978
7015
 
6979
7016
  const colors = {
@@ -7332,6 +7369,27 @@ const keysFromLog = (impactAssessment, log) => {
7332
7369
  const contributionIndex = (isEmission ? emission : impact).toString();
7333
7370
  return { contributionKey, contributionIndex };
7334
7371
  };
7372
+ /**
7373
+ * Re-create the simplified version of the contributions loaded in the Data Explorer.
7374
+ *
7375
+ * @param impactAssessment
7376
+ * @param contributions
7377
+ * @returns
7378
+ */
7379
+ const simplifyContributions = (impactAssessment, contributions) => Object.entries(contributions).reduce((prev, [key, contribution]) => {
7380
+ const indicators = impactAssessment[key];
7381
+ indicators.forEach((indicator, index) => {
7382
+ const id = indicator.term['@id'];
7383
+ Object.entries(contribution?.[index] || {}).forEach(([termId, data]) => {
7384
+ Object.entries(data).forEach(([modelId, value]) => {
7385
+ prev[termId] = prev[termId] || {};
7386
+ prev[termId][modelId] = prev[termId][modelId] || {};
7387
+ prev[termId][modelId][id] = (prev[termId][modelId][id] || 0) + value;
7388
+ });
7389
+ });
7390
+ });
7391
+ return prev;
7392
+ }, {});
7335
7393
  class HeNodeService {
7336
7394
  constructor() {
7337
7395
  this.http = inject(HttpClient);
@@ -14632,18 +14690,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
14632
14690
  const impactValue = (impact, values) => (values[impact['@id']]?.nodes[0] || { value: 0 }).value;
14633
14691
  const impactName = (impact, index) => `${index + 1}. ${defaultLabel(impact)}`;
14634
14692
  const termAllowed$1 = (filterTermTypes = [], term) => !filterTermTypes?.length || (filterTermTypes || []).includes(term?.termType);
14635
- const impactContribution = (indicators, contributions, indicatorTerm, selectedTerm, selectedMethod) => {
14636
- // find all the indicators that have contribution factor
14637
- const filterdIndicators = indicators
14638
- .map((indicator, index) => ({
14639
- indicator,
14640
- index,
14641
- contribution: contributions?.[index]?.[selectedTerm['@id']]?.[selectedMethod?.['@id']] || 0
14642
- }))
14643
- .filter(({ indicator, contribution }) => indicator.term['@id'] === indicatorTerm['@id'] && contribution !== 0);
14644
- const value = sum(filterdIndicators.map(({ contribution }) => contribution));
14645
- return value || null;
14646
- };
14647
14693
  class ImpactAssessmentsIndicatorsChartComponent {
14648
14694
  constructor() {
14649
14695
  this.nodeStoreService = inject(HeNodeStoreService);
@@ -14659,26 +14705,21 @@ class ImpactAssessmentsIndicatorsChartComponent {
14659
14705
  this.impactAssessments = computed(() => this.nodeStoreService.findByState(NodeType.ImpactAssessment, DataState.recalculated), ...(ngDevMode ? [{ debugName: "impactAssessments" }] : []));
14660
14706
  this.contributionsResource = rxResource({
14661
14707
  params: () => ({ impactAssessments: this.impactAssessments() }),
14662
- stream: ({ params: { impactAssessments } }) => from(impactAssessments).pipe(mergeMap(impactAssessment => this.nodeService
14663
- .getContributions$(impactAssessment)
14664
- .pipe(map(contributions => ({ impactAssessment, contributions })))), reduce((prev, curr) => {
14708
+ stream: ({ params: { impactAssessments } }) => from(impactAssessments).pipe(mergeMap(impactAssessment => this.nodeService.getContributions$(impactAssessment).pipe(map(contributions => ({
14709
+ impactAssessment,
14710
+ contributions: simplifyContributions(impactAssessment, contributions)
14711
+ })))), reduce((prev, curr) => {
14665
14712
  prev[curr.impactAssessment['@id']] = curr.contributions;
14666
14713
  return prev;
14667
14714
  }, {}))
14668
14715
  });
14669
14716
  this.contributionsPerImpactAssessment = computed(() => this.contributionsResource.value() ?? {}, ...(ngDevMode ? [{ debugName: "contributionsPerImpactAssessment" }] : []));
14670
- this.contributionKey = computed(() => this.key() === 'impacts'
14671
- ? 'emissionsResourceUse'
14672
- : this.key() === 'endpoints'
14673
- ? 'impacts'
14674
- : null, ...(ngDevMode ? [{ debugName: "contributionKey" }] : []));
14675
- this.contributionTerms = computed(() => unique(this.contributionKey()
14676
- ? this.impactAssessments()
14677
- .flatMap(impact => impact[this.contributionKey()].map(v => v.term))
14678
- .filter(Boolean)
14679
- : []), ...(ngDevMode ? [{ debugName: "contributionTerms" }] : []));
14680
- this.enableContributions = computed(() => this.contributionKey() &&
14681
- Object.values(this.contributionsPerImpactAssessment())?.length === this.impactAssessments()?.length, ...(ngDevMode ? [{ debugName: "enableContributions" }] : []));
14717
+ this.termsMap = computed(() => this.impactAssessments()
14718
+ .flatMap(impact => [...impact.emissionsResourceUse, ...impact.impacts])
14719
+ .reduce((prev, curr) => {
14720
+ prev[curr.term['@id']] = curr.term;
14721
+ return prev;
14722
+ }, {}), ...(ngDevMode ? [{ debugName: "termsMap" }] : []));
14682
14723
  this.indicatorPerImpactAssessment = computed(() => groupNodesByTerm(this.impactAssessments(), this.key()), ...(ngDevMode ? [{ debugName: "indicatorPerImpactAssessment" }] : []));
14683
14724
  this.terms = computed(() => Object.values(this.indicatorPerImpactAssessment() ?? {})
14684
14725
  .filter(({ term, values }) => termAllowed$1(this.filterTermTypes(), term) &&
@@ -14699,14 +14740,18 @@ class ImpactAssessmentsIndicatorsChartComponent {
14699
14740
  this.methods = computed(() => unique(this.termToMethods()[this.selectedTerm()?.['@id']]), ...(ngDevMode ? [{ debugName: "methods" }] : []));
14700
14741
  this.selectedMethod = computed(() => this.methods().find(term => term['@id'] == this.selectedMethodId()), ...(ngDevMode ? [{ debugName: "selectedMethod" }] : []));
14701
14742
  this.groupedValues = computed(() => this.indicatorPerImpactAssessment()?.[this.selectedTerm()?.name]?.values || {}, ...(ngDevMode ? [{ debugName: "groupedValues" }] : []));
14702
- this.contributionData = computed(() => {
14703
- return this.contributionTerms().map((term, index) => ({
14704
- id: term['@id'],
14705
- label: term.name,
14706
- values: this.impactAssessments().map(impact => impactContribution(impact[this.contributionKey()], this.contributionsPerImpactAssessment()[impact['@id']][this.contributionKey()], term, this.selectedTerm(), this.selectedMethod())),
14707
- color: listColor(term, index)
14708
- }));
14709
- }, ...(ngDevMode ? [{ debugName: "contributionData" }] : []));
14743
+ this.selectedContributionData = computed(() => Object.fromEntries(Object.entries(this.contributionsPerImpactAssessment()).map(([id, contributions]) => [
14744
+ id,
14745
+ contributions?.[this.selectedTermId()]?.[this.selectedMethodId()] || {}
14746
+ ])), ...(ngDevMode ? [{ debugName: "selectedContributionData" }] : []));
14747
+ this.contributionTerms = computed(() => unique(Object.values(this.selectedContributionData()).flatMap(v => Object.keys(v))), ...(ngDevMode ? [{ debugName: "contributionTerms" }] : []));
14748
+ this.enableContributions = computed(() => Object.values(this.contributionsPerImpactAssessment())?.length === this.impactAssessments()?.length, ...(ngDevMode ? [{ debugName: "enableContributions" }] : []));
14749
+ this.contributionData = computed(() => this.contributionTerms().map((term, index) => ({
14750
+ id: term,
14751
+ label: this.termsMap()[term]?.name || term,
14752
+ values: this.impactAssessments().map(impact => this.selectedContributionData()[impact['@id']][term]),
14753
+ color: listColor(term, index)
14754
+ })), ...(ngDevMode ? [{ debugName: "contributionData" }] : []));
14710
14755
  this.chartData = computed(() => this.enableContributions()
14711
14756
  ? this.contributionData()
14712
14757
  .filter(({ values }) => !values.every(v => !v))
@@ -15595,5 +15640,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
15595
15640
  * Generated bundle index. Do not edit.
15596
15641
  */
15597
15642
 
15598
- export { ARRAY_DELIMITER, ApplyPurePipe, BarChartComponent, BibliographiesSearchConfirmComponent, BlankNodeStateComponent, BlankNodeStateNoticeComponent, BlankNodeValueDeltaComponent, CapitalizePipe, ChartComponent, ChartConfigurationDirective, ChartExportButtonComponent, ChartTooltipComponent, ClickOutsideDirective, ClipboardComponent, CollapsibleBoxComponent, CollapsibleBoxStyle, ColorPalette, CompoundDirective, CompoundPipe, ContributionChartComponent, ControlValueAccessor, CycleNodesKeyGroup, CyclesCompletenessComponent, CyclesEmissionsCategoryService, CyclesEmissionsChartComponent, CyclesFunctionalUnitMeasureComponent, CyclesMetadataComponent, CyclesNodesComponent, CyclesNodesTimelineComponent, CyclesResultComponent, DataTableComponent, DefaultPipe, DeltaColour, DistributionChartComponent, DrawerContainerComponent, DurationPipe, EllipsisPipe, EngineModelsLinkComponent, EngineModelsLookupInfoComponent, EngineModelsStageComponent, EngineModelsStageDeepComponent, EngineModelsStageDeepService, EngineModelsVersionInfoComponent, EngineModelsVersionLinkComponent, EngineOrchestratorEditComponent, EngineRequirementsFormComponent, FileSizePipe, FileUploadErrorKeys, FilesErrorSummaryComponent, FilesFormComponent, FilesFormEditableComponent, FilesUploadErrorsComponent, FilterAccordionComponent, GUIDE_ENABLED, GetPipe, GlossaryMigrationFormat, GuideOverlayComponent, HESvgIconComponent, HE_API_BASE_URL, HE_CALCULATIONS_BASE_URL, HE_MAP_LOADED, HeAuthService, HeCommonService, HeEngineService, HeGlossaryService, HeMendeleyService, HeNodeCsvService, HeNodeService, HeNodeStoreService, HeSchemaService, HeSearchService, HeToastService, HorizontalBarChartComponent, HorizontalButtonsGroupComponent, ImpactAssessmentsGraphComponent, ImpactAssessmentsIndicatorBreakdownChartComponent, ImpactAssessmentsIndicatorsChartComponent, ImpactAssessmentsProductsComponent, IsArrayPipe, IsObjectPipe, IssueConfirmComponent, KeyToLabelPipe, Level, LineChartComponent, LinkKeyValueComponent, LogStatus, LongPressDirective, MAX_RESULTS, MapsDrawingComponent, MapsDrawingConfirmComponent, MaxPipe, MeanPipe, MedianPipe, MendeleySearchResult, MinPipe, MobileShellComponent, NavigationMenuComponent, NoExtPipe, NodeAggregatedComponent, NodeAggregatedInfoComponent, NodeAggregatedQualityScoreComponent, NodeCsvExportConfirmComponent, NodeCsvPreviewComponent, NodeCsvSelectHeadersComponent, NodeIconComponent, NodeJsonldComponent, NodeJsonldSchemaComponent, NodeKeyState, NodeLinkComponent, NodeLogsFileComponent, NodeLogsModelsComponent, NodeLogsTimeComponent, NodeMissingLookupFactorsComponent, NodeQualityScore, NodeRecommendationsComponent, NodeSelectComponent, NodeValueDetailsComponent, PipelineStagesProgressComponent, PluralizePipe, PopoverComponent, PopoverConfirmComponent, PrecisionPipe, RelatedNodeResult, RemoveMarkdownPipe, RepeatPipe, Repository, ResizedDirective, ResizedEvent, ResponsiveService, SchemaInfoComponent, SchemaVersionLinkComponent, SearchExtendComponent, ShelfDialogComponent, ShellComponent, SitesManagementChartComponent, SitesMapsComponent, SitesNodesComponent, SkeletonTextComponent, SocialTagsComponent, SortByPipe, SortSelectComponent, SumPipe, TagsInputDirective, Template, TermsPropertyContentComponent, TermsSubClassOfContentComponent, TermsUnitsDescriptionComponent, ThousandSuffixesPipe, ThousandsPipe, TimesPipe, ToastComponent, UncapitalizePipe, addPolygonToFeature, afterBarDrawPlugin, allCountriesQuery, allGroups, allOptions, availableProperties, axisHoverPlugin, backgroundHoverPlugin, baseApiUrl, baseUrl, bottom, buildSummary, bytesSize, calculateCycleDuration, calculateCycleDurationEnabled, calculateCycleStartDate, calculateCycleStartDateEnabled, capitalize, changelogUrl, clustererImage, code, colorToRgba, compoundToHtml, computeKeys, computeTerms, contactUsEmail, contactUsLink, convertToSvg, coordinatesToPoint, copyObject, countGroupVisibleNodes, countriesQuery, createMarker, cropsQuery, d3ellipse, d3wrap, dataPathLabel, dataPathToKey, dataVersionHeader, dataVersionHeaderKey, defaultFeature, defaultLabel, defaultSuggestionType, defaultSvgIconSize, defaultTicksFont, definitionToSchemaType, distinctUntilChangedDeep, downloadFile, downloadPng, downloadSvg, ellipsis, engineGitBaseUrl, engineGitUrl, errorHasError, errorHasWarning, errorText, evaluateSuccess, exportAsSVG, exportFormats, externalLink, externalNodeLink, fillColor, fillStyle, filterBlankNode$1 as filterBlankNode, filterError, filterParams, findConfigModels, findMatchingModel, findModels, findNodeModel, findOrchestratorModel, findProperty, findPropertyById, flatFilterData, flatFilterNode, formatCustomErrorMessage, formatDate, formatError, formatPropertyError, formatter, getColor, getDatesBetween, gitBranch, gitHome, gitlabRawUrl, glossaryBaseUrl, glossaryLink, groupChanged, groupLogsByModel, groupLogsByTerm, groupNodesByTerm, groupdLogsByKey, grouppedKeys, grouppedValueKeys, groupsLogsByFields, guideModelUrl, guideNamespace, guidePageId, handleAPIError, handleGuideEvent, hasError, hasValidationError, hasWarning, hexToRgba, iconSizes, icons, ignoreKeys$2 as ignoreKeys, increaseScaleLimits, initialFilterState, injectResizeEvent$, inputGroupsTermTypes, isAddPropertyEnabled, isChrome, isDateBetween, isEqual, isExternal, isKeyClosedVisible, isKeyHidden, isMaxStage, isMethodModelAllowed, isMigrationError, isMissingOneOfError, isMissingPropertyError, isNonNodeModelKey, isSchemaIri, isScrolledBelow, isState, isTermTypeAllowed, isValidKey, keyToDataPath, levels, listColor, listColorContinuous, listColorWithAlpha, loadMapApi, loadSvgSprite, locationQuery, logToCsv$2 as logToCsv, logValueArray, logsKey, lollipopChartPlugin, lookupUrl, mapFilterData, mapsUrl, markerIcon, markerPie, matchAggregatedQuery, matchAggregatedValidatedQuery, matchBoolPrefixQuery, matchCountry, matchExactQuery, matchGlobalRegion, matchId, matchNameNormalized, matchNestedKey, matchPhrasePrefixQuery, matchPhraseQuery, matchPrimaryProductQuery, matchQuery, matchRegex, matchRegion, matchTermType, matchType, maxAreaSize, measurementValue, mergeDataWithHeaders, methodTierOrder, migrationErrorMessage, migrationsUrl, missingNodeErrors, modelCount, modelKeyParams, modelParams, models, multiMatchQuery, nestedProperty, nestingEnabled, nestingTypeEnabled, nodeAvailableProperties, nodeById, nodeColours$1 as nodeColours, nodeDataState, nodeDataStates, nodeId, nodeIds, nodeLink, nodeLinkEnabled, nodeLinkTypeEnabled, nodeLogsUrl, nodeQualityScoreColor, nodeQualityScoreLevel, nodeQualityScoreMaxDefault, nodeQualityScoreOrder, nodeSecondaryColours, nodeToAggregationFilename, nodeType, nodeTypeDataState, nodeTypeIcon, nodeTypeIconSchema, nodeUrl, nodeUrlParams, nodeVersion, nodesByState, nodesByType, numberGte, optionsFromGroup, parentKey, parentProperty, parseColor, parseData, parseDataPath, parseLines, parseLogMessage, parseMessage, parseNewValue, pluralize, pointToCoordinates, polygonBounds, polygonToCoordinates, polygonToMap, polygonsFromFeature, populateWithTrackIdsFilterData, postGuideEvent, primaryProduct, productsQuery, propertyError, propertyId, recursiveProperties, refToSchemaType, refreshPropertyKeys, regionsQuery, registerChart, repeat, reportIssueLink, reportIssueUrl, safeJSONParse, safeJSONStringify, schemaBaseUrl, schemaDataBaseUrl, schemaLink, schemaRequiredProperties, schemaTypeToDefaultValue, scrollToEl, scrollTop, searchFilterData, searchableTypes, siblingProperty, singleProperty, siteTooBig, siteTypeToColor, siteTypeToIcon, sortProperties, sortedDates, strokeColor, strokeStyle, suggestMatchQuery, suggestQuery, takeAfterViewInit, termLocation, termLocationName, termProperties, termTypeLabel, toSnakeCase, toThousands, typeToNewProperty, typeaheadFocus, uncapitalize, uniqueDatesBetween, updateProperties, valueLink, valueToString, valueTypeToDefault, valueValue, waitFor, wildcardQuery };
15643
+ export { ARRAY_DELIMITER, ApplyPurePipe, BarChartComponent, BibliographiesSearchConfirmComponent, BlankNodeStateComponent, BlankNodeStateNoticeComponent, BlankNodeValueDeltaComponent, CapitalizePipe, ChartComponent, ChartConfigurationDirective, ChartExportButtonComponent, ChartTooltipComponent, ClickOutsideDirective, ClipboardComponent, CollapsibleBoxComponent, CollapsibleBoxStyle, ColorPalette, CompoundDirective, CompoundPipe, ContributionChartComponent, ControlValueAccessor, CycleNodesKeyGroup, CyclesCompletenessComponent, CyclesEmissionsCategoryService, CyclesEmissionsChartComponent, CyclesFunctionalUnitMeasureComponent, CyclesMetadataComponent, CyclesNodesComponent, CyclesNodesTimelineComponent, CyclesResultComponent, DataTableComponent, DefaultPipe, DeltaColour, DistributionChartComponent, DrawerContainerComponent, DurationPipe, EllipsisPipe, EngineModelsLinkComponent, EngineModelsLookupInfoComponent, EngineModelsStageComponent, EngineModelsStageDeepComponent, EngineModelsStageDeepService, EngineModelsVersionInfoComponent, EngineModelsVersionLinkComponent, EngineOrchestratorEditComponent, EngineRequirementsFormComponent, FileSizePipe, FileUploadErrorKeys, FilesErrorSummaryComponent, FilesFormComponent, FilesFormEditableComponent, FilesUploadErrorsComponent, FilterAccordionComponent, GUIDE_ENABLED, GetPipe, GlossaryMigrationFormat, GuideOverlayComponent, HESvgIconComponent, HE_API_BASE_URL, HE_CALCULATIONS_BASE_URL, HE_MAP_LOADED, HeAuthService, HeCommonService, HeEngineService, HeGlossaryService, HeMendeleyService, HeNodeCsvService, HeNodeService, HeNodeStoreService, HeSchemaService, HeSearchService, HeToastService, HorizontalBarChartComponent, HorizontalButtonsGroupComponent, ImpactAssessmentsGraphComponent, ImpactAssessmentsIndicatorBreakdownChartComponent, ImpactAssessmentsIndicatorsChartComponent, ImpactAssessmentsProductsComponent, IsArrayPipe, IsObjectPipe, IssueConfirmComponent, KeyToLabelPipe, Level, LineChartComponent, LinkKeyValueComponent, LogStatus, LongPressDirective, MAX_RESULTS, MapsDrawingComponent, MapsDrawingConfirmComponent, MaxPipe, MeanPipe, MedianPipe, MendeleySearchResult, MinPipe, MobileShellComponent, NavigationMenuComponent, NoExtPipe, NodeAggregatedComponent, NodeAggregatedInfoComponent, NodeAggregatedQualityScoreComponent, NodeCsvExportConfirmComponent, NodeCsvPreviewComponent, NodeCsvSelectHeadersComponent, NodeIconComponent, NodeJsonldComponent, NodeJsonldSchemaComponent, NodeKeyState, NodeLinkComponent, NodeLogsFileComponent, NodeLogsModelsComponent, NodeLogsTimeComponent, NodeMissingLookupFactorsComponent, NodeQualityScore, NodeRecommendationsComponent, NodeSelectComponent, NodeValueDetailsComponent, PipelineStagesProgressComponent, PluralizePipe, PopoverComponent, PopoverConfirmComponent, PrecisionPipe, RelatedNodeResult, RemoveMarkdownPipe, RepeatPipe, Repository, ResizedDirective, ResizedEvent, ResponsiveService, SchemaInfoComponent, SchemaVersionLinkComponent, SearchExtendComponent, ShelfDialogComponent, ShellComponent, SitesManagementChartComponent, SitesMapsComponent, SitesNodesComponent, SkeletonTextComponent, SocialTagsComponent, SortByPipe, SortSelectComponent, SumPipe, TagsInputDirective, Template, TermsPropertyContentComponent, TermsSubClassOfContentComponent, TermsUnitsDescriptionComponent, ThousandSuffixesPipe, ThousandsPipe, TimesPipe, ToastComponent, UncapitalizePipe, addPolygonToFeature, afterBarDrawPlugin, allCountriesQuery, allGroups, allOptions, availableProperties, axisHoverPlugin, backgroundHoverPlugin, baseApiUrl, baseUrl, bottom, buildSummary, bytesSize, calculateCycleDuration, calculateCycleDurationEnabled, calculateCycleStartDate, calculateCycleStartDateEnabled, capitalize, changelogUrl, clustererImage, code, colorToRgba, compoundToHtml, computeKeys, computeTerms, contactUsEmail, contactUsLink, convertToSvg, coordinatesToPoint, copyObject, countGroupVisibleNodes, countriesQuery, createMarker, cropsQuery, d3ellipse, d3wrap, dataPathLabel, dataPathToKey, dataVersionHeader, dataVersionHeaderKey, defaultFeature, defaultLabel, defaultSuggestionType, defaultSvgIconSize, defaultTicksFont, definitionToSchemaType, distinctUntilChangedDeep, downloadFile, downloadPng, downloadSvg, ellipsis, engineGitBaseUrl, engineGitUrl, errorHasError, errorHasWarning, errorText, evaluateSuccess, exportAsSVG, exportFormats, externalLink, externalNodeLink, fillColor, fillStyle, filterBlankNode$1 as filterBlankNode, filterError, filterParams, findConfigModels, findMatchingModel, findModels, findNodeModel, findOrchestratorModel, findProperty, findPropertyById, flatFilterData, flatFilterNode, formatCustomErrorMessage, formatDate, formatError, formatPropertyError, formatter, getColor, getDatesBetween, gitBranch, gitHome, gitlabRawUrl, glossaryBaseUrl, glossaryLink, groupChanged, groupLogsByModel, groupLogsByTerm, groupNodesByTerm, groupdLogsByKey, grouppedKeys, grouppedValueKeys, groupsLogsByFields, guideModelUrl, guideNamespace, guidePageId, handleAPIError, handleGuideEvent, hasError, hasValidationError, hasWarning, hexToRgba, iconSizes, icons, ignoreKeys$2 as ignoreKeys, increaseScaleLimits, initialFilterState, injectResizeEvent$, inputGroupsTermTypes, isAddPropertyEnabled, isChrome, isDateBetween, isEqual, isExternal, isKeyClosedVisible, isKeyHidden, isMaxStage, isMethodModelAllowed, isMigrationError, isMissingOneOfError, isMissingPropertyError, isNonNodeModelKey, isSchemaIri, isScrolledBelow, isState, isTermTypeAllowed, isValidKey, keyToDataPath, levels, listColor, listColorContinuous, listColorWithAlpha, loadMapApi, loadSvgSprite, locationQuery, logToCsv$2 as logToCsv, logValueArray, logsKey, lollipopChartPlugin, lookupUrl, mapFilterData, mapsUrl, markerIcon, markerPie, matchAggregatedQuery, matchAggregatedValidatedQuery, matchBoolPrefixQuery, matchCountry, matchExactQuery, matchGlobalRegion, matchId, matchNameNormalized, matchNestedKey, matchPhrasePrefixQuery, matchPhraseQuery, matchPrimaryProductQuery, matchQuery, matchRegex, matchRegion, matchTermType, matchType, maxAreaSize, measurementValue, mergeDataWithHeaders, methodTierOrder, migrationErrorMessage, migrationsUrl, missingNodeErrors, modelCount, modelKeyParams, modelParams, models, multiMatchQuery, nestedProperty, nestingEnabled, nestingTypeEnabled, nodeAvailableProperties, nodeById, nodeColours$1 as nodeColours, nodeDataState, nodeDataStates, nodeId, nodeIds, nodeLink, nodeLinkEnabled, nodeLinkTypeEnabled, nodeLogsUrl, nodeQualityScoreColor, nodeQualityScoreLevel, nodeQualityScoreMaxDefault, nodeQualityScoreOrder, nodeSecondaryColours, nodeToAggregationFilename, nodeType, nodeTypeDataState, nodeTypeIcon, nodeTypeIconSchema, nodeUrl, nodeUrlParams, nodeVersion, nodesByState, nodesByType, numberGte, optionsFromGroup, parentKey, parentProperty, parseColor, parseData, parseDataPath, parseLines, parseLogMessage, parseMessage, parseNewValue, pluralize, pointToCoordinates, polygonBounds, polygonToCoordinates, polygonToMap, polygonsFromFeature, populateWithTrackIdsFilterData, postGuideEvent, primaryProduct, productsQuery, propertyError, propertyId, recursiveProperties, refToSchemaType, refreshPropertyKeys, regionsQuery, registerChart, repeat, reportIssueLink, reportIssueUrl, safeJSONParse, safeJSONStringify, schemaBaseUrl, schemaDataBaseUrl, schemaLink, schemaRequiredProperties, schemaTypeToDefaultValue, scrollToEl, scrollTop, searchFilterData, searchableTypes, siblingProperty, simplifyContributions, singleProperty, siteTooBig, siteTypeToColor, siteTypeToIcon, sortProperties, sortedDates, strokeColor, strokeStyle, suggestMatchQuery, suggestQuery, takeAfterViewInit, termLocation, termLocationName, termProperties, termTypeLabel, toSnakeCase, toThousands, typeToNewProperty, typeaheadFocus, uncapitalize, uniqueDatesBetween, updateProperties, valueLink, valueToString, valueTypeToDefault, valueValue, waitFor, wildcardQuery };
15599
15644
  //# sourceMappingURL=hestia-earth-ui-components.mjs.map