@hestia-earth/ui-components 0.42.30 → 0.42.31
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.
|
@@ -16,7 +16,9 @@ import { select, selectAll } from 'd3-selection';
|
|
|
16
16
|
import { isEmpty, unique, monthsBefore, toPrecision, isNumber, isUndefined, toComma, duration, keyToLabel, sum, min, max, mean, median, ellipsis as ellipsis$1, getPercentileValue, isEqual as isEqual$2, diffInDays } from '@hestia-earth/utils';
|
|
17
17
|
import { json2csv } from 'json-2-csv';
|
|
18
18
|
import { propertyValue as propertyValue$1, emptyValue } from '@hestia-earth/utils/term';
|
|
19
|
-
import
|
|
19
|
+
import defaultModelId from '@hestia-earth/glossary/resources/defaultModelId.json';
|
|
20
|
+
import modelGroups from '@hestia-earth/glossary/resources/modelGroups.json';
|
|
21
|
+
import inHestiaDefaultSystemBoundary from '@hestia-earth/glossary/resources/inHestiaDefaultSystemBoundary.json';
|
|
20
22
|
import isEqual$1 from 'lodash.isequal';
|
|
21
23
|
import { DataState, filenameWithoutExt, nodeTypeToParam, allowedDataStates, SupportedExtensions, fileToExt, fileExt, maxFileSizeMb } from '@hestia-earth/api';
|
|
22
24
|
import { models as models$1, loadConfig, getFormulas, renderFormula, getMaxStage } from '@hestia-earth/engine-models';
|
|
@@ -46,6 +48,7 @@ import { ScrollStrategyOptions, CdkOverlayOrigin, CdkConnectedOverlay } from '@a
|
|
|
46
48
|
import { ResizableDirective, ResizeHandleDirective } from 'angular-resizable-element';
|
|
47
49
|
import set from 'lodash.set';
|
|
48
50
|
import { MarkdownComponent } from 'ngx-markdown';
|
|
51
|
+
import arrayTreatment from '@hestia-earth/glossary/resources/arrayTreatment.json';
|
|
49
52
|
import * as semver from 'semver';
|
|
50
53
|
import { parse } from 'papaparse';
|
|
51
54
|
import omit from 'lodash.omit';
|
|
@@ -896,6 +899,17 @@ const polygonBounds = (polygon) => {
|
|
|
896
899
|
return paths.reduce((prev, curr) => prev.extend(curr), new google.maps.LatLngBounds());
|
|
897
900
|
};
|
|
898
901
|
|
|
902
|
+
// Local re-implementations of the `@hestia-earth/glossary` getters that read the resources directly
|
|
903
|
+
// instead of via the glossary barrel. Importing the barrel pulls its module into the bundle and can
|
|
904
|
+
// duplicate a resource when another consumer imports the same file by subpath; going straight to the
|
|
905
|
+
// resource avoids both. Keep these in sync with the getters in `@hestia-earth/glossary/index.mjs`.
|
|
906
|
+
const getDefaultModelId = (id) => defaultModelId[id];
|
|
907
|
+
const getModelGroup = (id, modelId) => (modelGroups[id] || {})[modelId];
|
|
908
|
+
const isInSystemBoundary = (id) => {
|
|
909
|
+
const value = inHestiaDefaultSystemBoundary[id];
|
|
910
|
+
return !value || value === 'true';
|
|
911
|
+
};
|
|
912
|
+
|
|
899
913
|
const maxAreaSize = 5000;
|
|
900
914
|
const siteTooBig = ({ area }) => area && area / 100 > maxAreaSize;
|
|
901
915
|
const hasMultipleValues = (values) => (values || []).length > 1;
|
|
@@ -10585,7 +10599,7 @@ const measurementFormula = (values, termId, total) => {
|
|
|
10585
10599
|
const arrayTreatmentFormula = (numbers, termId, total) => {
|
|
10586
10600
|
const list = numbers.map(formatFormulaValue);
|
|
10587
10601
|
const count = numbers.length;
|
|
10588
|
-
switch (
|
|
10602
|
+
switch (arrayTreatment[termId] || 'sum') {
|
|
10589
10603
|
case 'mean':
|
|
10590
10604
|
return `Average of ${count} values: (${list.join(' + ')}) / ${count} = ${total}`;
|
|
10591
10605
|
case 'mode':
|