@hestia-earth/ui-components 0.0.5 → 0.0.8
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.
- package/auth/{public-api.d.ts → index.d.ts} +0 -0
- package/bibliographies/{public-api.d.ts → index.d.ts} +0 -0
- package/bundles/hestia-earth-ui-components.umd.js +1202 -1148
- package/bundles/hestia-earth-ui-components.umd.js.map +1 -1
- package/common/blank-node-state/blank-node-state.component.d.ts +1 -1
- package/common/blank-node-value-delta/blank-node-value-delta.component.d.ts +2 -2
- package/common/delta-utils.d.ts +20 -0
- package/common/{public-api.d.ts → index.d.ts} +1 -0
- package/common/utils.d.ts +5 -15
- package/cycles/{public-api.d.ts → index.d.ts} +0 -0
- package/engine/aggregation-engine.service.d.ts +5 -5
- package/engine/engine.service.d.ts +2 -1
- package/engine/index.d.ts +2 -0
- package/esm2015/auth/index.js +2 -0
- package/esm2015/bibliographies/index.js +3 -0
- package/esm2015/common/blank-node-diffs/blank-node-diffs.component.js +3 -4
- package/esm2015/common/blank-node-value-delta/blank-node-value-delta.component.js +4 -4
- package/esm2015/common/delta-utils.js +54 -0
- package/esm2015/common/index.js +33 -0
- package/esm2015/common/utils.js +18 -24
- package/esm2015/cycles/index.js +12 -0
- package/esm2015/engine/aggregation-engine.service.js +1 -1
- package/esm2015/engine/engine.service.js +10 -6
- package/esm2015/engine/index.js +3 -0
- package/esm2015/files/index.js +5 -0
- package/esm2015/fontawesome/index.js +2 -0
- package/esm2015/impact-assessments/index.js +7 -0
- package/esm2015/mendeley/index.js +2 -0
- package/esm2015/node/index.js +14 -0
- package/esm2015/node/node-diffs/node-diffs.component.js +5 -5
- package/esm2015/node/node-diffs/node-diffs.model.js +6 -6
- package/esm2015/public-api.js +16 -16
- package/esm2015/schema/index.js +2 -0
- package/esm2015/search/index.js +4 -0
- package/esm2015/sites/index.js +6 -0
- package/esm2015/terms/index.js +2 -0
- package/esm2015/users/index.js +2 -0
- package/fesm2015/hestia-earth-ui-components.js +362 -359
- package/fesm2015/hestia-earth-ui-components.js.map +1 -1
- package/files/{public-api.d.ts → index.d.ts} +2 -0
- package/fontawesome/{public-api.d.ts → index.d.ts} +0 -0
- package/impact-assessments/{public-api.d.ts → index.d.ts} +0 -0
- package/mendeley/{public-api.d.ts → index.d.ts} +0 -0
- package/node/{public-api.d.ts → index.d.ts} +1 -0
- package/node/node-diffs/node-diffs.component.d.ts +3 -3
- package/node/node-diffs/node-diffs.model.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +15 -15
- package/schema/{public-api.d.ts → index.d.ts} +0 -0
- package/search/{public-api.d.ts → index.d.ts} +0 -0
- package/sites/{public-api.d.ts → index.d.ts} +0 -0
- package/terms/{public-api.d.ts → index.d.ts} +0 -0
- package/users/{public-api.d.ts → index.d.ts} +0 -0
- package/common/blank-node-diffs/blank-node-diffs.service.d.ts +0 -5
- package/common/blank-node-value-delta/blank-node-value-delta.service.d.ts +0 -6
- package/engine/public-api.d.ts +0 -2
- package/esm2015/auth/public-api.js +0 -2
- package/esm2015/bibliographies/public-api.js +0 -3
- package/esm2015/common/blank-node-diffs/blank-node-diffs.service.js +0 -20
- package/esm2015/common/blank-node-value-delta/blank-node-value-delta.service.js +0 -31
- package/esm2015/common/public-api.js +0 -32
- package/esm2015/cycles/public-api.js +0 -12
- package/esm2015/engine/public-api.js +0 -3
- package/esm2015/files/public-api.js +0 -3
- package/esm2015/fontawesome/public-api.js +0 -2
- package/esm2015/impact-assessments/public-api.js +0 -7
- package/esm2015/mendeley/public-api.js +0 -2
- package/esm2015/node/public-api.js +0 -13
- package/esm2015/schema/public-api.js +0 -2
- package/esm2015/search/public-api.js +0 -4
- package/esm2015/sites/public-api.js +0 -6
- package/esm2015/terms/public-api.js +0 -2
- package/esm2015/users/public-api.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@ng-bootstrap/ng-bootstrap'), require('@angular/google-maps'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-regular-svg-icons'), require('@fortawesome/free-solid-svg-icons'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@hestia-earth/ui-components', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@ng-bootstrap/ng-bootstrap', '@angular/google-maps', '@fortawesome/angular-fontawesome', '@fortawesome/free-regular-svg-icons', '@fortawesome/free-solid-svg-icons', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["hestia-earth"] = global["hestia-earth"] || {}, global["hestia-earth"]["ui-components"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.i10, global.ng.googleMaps, global.i1, global.freeRegularSvgIcons, global.freeSolidSvgIcons, global.
|
|
5
|
-
})(this, (function (exports, i0, i3, i1$4, i4, i10, i1$2, i1, freeRegularSvgIcons, freeSolidSvgIcons,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/router'), require('@ng-bootstrap/ng-bootstrap'), require('@angular/google-maps'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-regular-svg-icons'), require('@fortawesome/free-solid-svg-icons'), require('random-material-color'), require('@hestia-earth/schema'), require('@hestia-earth/api'), require('@hestia-earth/utils'), require('rxjs'), require('rxjs/operators'), require('csvtojson'), require('@angular/common/http'), require('@angular/platform-browser'), require('pluralize'), require('@hestia-earth/bulma-tagsinput'), require('json-2-csv'), require('@angular/cdk/drag-drop'), require('@hestia-earth/schema-convert'), require('@hestia-earth/json-schema/schema-utils'), require('jsondiffpatch'), require('chart.js'), require('moment'), require('moment/locale/en-gb'), require('uuid'), require('@google/markerclustererplus'), require('chartjs-plugin-datalabels')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@hestia-earth/ui-components', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/router', '@ng-bootstrap/ng-bootstrap', '@angular/google-maps', '@fortawesome/angular-fontawesome', '@fortawesome/free-regular-svg-icons', '@fortawesome/free-solid-svg-icons', 'random-material-color', '@hestia-earth/schema', '@hestia-earth/api', '@hestia-earth/utils', 'rxjs', 'rxjs/operators', 'csvtojson', '@angular/common/http', '@angular/platform-browser', 'pluralize', '@hestia-earth/bulma-tagsinput', 'json-2-csv', '@angular/cdk/drag-drop', '@hestia-earth/schema-convert', '@hestia-earth/json-schema/schema-utils', 'jsondiffpatch', 'chart.js', 'moment', 'moment/locale/en-gb', 'uuid', '@google/markerclustererplus', 'chartjs-plugin-datalabels'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["hestia-earth"] = global["hestia-earth"] || {}, global["hestia-earth"]["ui-components"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.router, global.i10, global.ng.googleMaps, global.i1, global.freeRegularSvgIcons, global.freeSolidSvgIcons, global.randomMaterialColor, global.schema, global.api, global.utils, global.rxjs, global.rxjs.operators, global.csvtojson, global.ng.common.http, global.ng.platformBrowser, global.pluralize, global.BulmaTagsInput, global.json2Csv, global.ng.cdk.dragDrop, global.schemaConvert, global.schemaUtils, global.jsondiffpatch, global.chart_js, global.moment, null, global.uuid, global.MarkerClusterer, global.ChartDataLabels));
|
|
5
|
+
})(this, (function (exports, i0, i3, i1$4, i4, i10, i1$2, i1, freeRegularSvgIcons, freeSolidSvgIcons, randomMaterialColor, schema, api, utils, rxjs, operators, csvtojson, i1$1, i1$3, pluralize, BulmaTagsInput, json2Csv, i6, schemaConvert, schemaUtils, jsondiffpatch, chart_js, moment, enGb, uuid, MarkerClusterer, ChartDataLabels) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
var pluralize__namespace = /*#__PURE__*/_interopNamespace(pluralize);
|
|
38
38
|
var BulmaTagsInput__default = /*#__PURE__*/_interopDefaultLegacy(BulmaTagsInput);
|
|
39
39
|
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
40
|
-
var MarkerClusterer__default = /*#__PURE__*/_interopDefaultLegacy(MarkerClusterer);
|
|
41
40
|
var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
|
|
41
|
+
var MarkerClusterer__default = /*#__PURE__*/_interopDefaultLegacy(MarkerClusterer);
|
|
42
42
|
var ChartDataLabels__default = /*#__PURE__*/_interopDefaultLegacy(ChartDataLabels);
|
|
43
43
|
|
|
44
44
|
var HeAuthService = /** @class */ (function () {
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
}]
|
|
418
418
|
}], ctorParameters: function () { return [{ type: i1__namespace.FaIconLibrary }]; } });
|
|
419
419
|
|
|
420
|
-
var _a$6
|
|
420
|
+
var _a$6;
|
|
421
421
|
var get$4 = require('lodash.get');
|
|
422
422
|
var gitHome = 'https://gitlab.com/hestia-earth';
|
|
423
423
|
var gitRawBaseUrl = 'https://glcdn.githack.com/hestia-earth';
|
|
@@ -592,44 +592,8 @@
|
|
|
592
592
|
var defaultLabel = function (node) { return node ? (node['@type'] in nodeDefaultLabel ? nodeDefaultLabel[node['@type']](node) : node.name) || node['@id'] || node.id : ''; };
|
|
593
593
|
var itemColor = function (index) { return randomMaterialColor.getColor({ text: "" + index }); };
|
|
594
594
|
var listColor = function (_v, index) { return itemColor(index); };
|
|
595
|
-
exports.DeltaDisplayType = void 0;
|
|
596
|
-
(function (DeltaDisplayType) {
|
|
597
|
-
DeltaDisplayType["absolute"] = "absolute";
|
|
598
|
-
DeltaDisplayType["percent"] = "percent";
|
|
599
|
-
})(exports.DeltaDisplayType || (exports.DeltaDisplayType = {}));
|
|
600
|
-
var deltaPerType = (_b$3 = {},
|
|
601
|
-
_b$3[exports.DeltaDisplayType.absolute] = function (value, original) { return value - original; },
|
|
602
|
-
_b$3[exports.DeltaDisplayType.percent] = function (value, original) { return ((value - original) / original) * 100; },
|
|
603
|
-
_b$3);
|
|
604
|
-
var roundValue = function (value) { return +("" + value).substring(0, 10); };
|
|
605
|
-
var delta = function (value, originalValue, displayType, customDeltaFuncs) {
|
|
606
|
-
if (displayType === void 0) { displayType = exports.DeltaDisplayType.percent; }
|
|
607
|
-
var vvalue = roundValue(propertyValue$1(value));
|
|
608
|
-
var voriginalValue = roundValue(propertyValue$1(originalValue));
|
|
609
|
-
var deltaFuncs = Object.assign(Object.assign({}, deltaPerType), customDeltaFuncs);
|
|
610
|
-
var diff = vvalue === voriginalValue ? 0 : deltaFuncs[displayType](vvalue, voriginalValue);
|
|
611
|
-
return Number.isFinite(diff) ? (diff === -0 ? 0 : diff) : 0;
|
|
612
|
-
};
|
|
613
|
-
exports.DeltaColour = void 0;
|
|
614
|
-
(function (DeltaColour) {
|
|
615
|
-
DeltaColour["Success"] = "success";
|
|
616
|
-
DeltaColour["Warning"] = "warning";
|
|
617
|
-
DeltaColour["Danger"] = "danger";
|
|
618
|
-
})(exports.DeltaColour || (exports.DeltaColour = {}));
|
|
619
|
-
var emptyValue = function (value) { return utils.isEmpty(value) || isNaN(propertyValue$1(value)); };
|
|
620
|
-
var repeat = function (times) {
|
|
621
|
-
if (times === void 0) { times = 0; }
|
|
622
|
-
return (Array.from(Array(times), Math.random));
|
|
623
|
-
};
|
|
624
|
-
var filenameWithoutExt = function (filename) {
|
|
625
|
-
if (filename === void 0) { filename = ''; }
|
|
626
|
-
var file = api.fileToExt(filename, '');
|
|
627
|
-
// remove last .
|
|
628
|
-
return file.endsWith('.') ? file.substring(0, file.length - 1) : file;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
595
|
var reduceValues$1 = function (values) { return values.length ? values.reduce(function (p, v) { return p + propertyValue$1(v.value); }, 0) : undefined; };
|
|
632
|
-
var
|
|
596
|
+
var formatDiffValues = function (originalValues, recalculatedValues) {
|
|
633
597
|
if (originalValues === void 0) { originalValues = []; }
|
|
634
598
|
if (recalculatedValues === void 0) { recalculatedValues = []; }
|
|
635
599
|
var originalValuesFiltered = originalValues.filter(function (value) { return !value.deleted; });
|
|
@@ -647,35 +611,70 @@
|
|
|
647
611
|
});
|
|
648
612
|
return values;
|
|
649
613
|
};
|
|
614
|
+
var emptyValue = function (value) { return utils.isEmpty(value) || isNaN(propertyValue$1(value)); };
|
|
615
|
+
var repeat = function (times) {
|
|
616
|
+
if (times === void 0) { times = 0; }
|
|
617
|
+
return (Array.from(Array(times), Math.random));
|
|
618
|
+
};
|
|
619
|
+
var filenameWithoutExt = function (filename) {
|
|
620
|
+
if (filename === void 0) { filename = ''; }
|
|
621
|
+
var file = api.fileToExt(filename, '');
|
|
622
|
+
// remove last .
|
|
623
|
+
return file.endsWith('.') ? file.substring(0, file.length - 1) : file;
|
|
624
|
+
};
|
|
650
625
|
|
|
651
|
-
var _a$5, _b$2, _c$2;
|
|
626
|
+
var _a$5, _b$2, _c$2, _d$2;
|
|
652
627
|
var SUCCESS_CRITERION_MAX_DELTA_PERCENT = 5;
|
|
653
628
|
var WARNING_CRITERION_MAX_DELTA_PERCENT = 20;
|
|
629
|
+
exports.DeltaColour = void 0;
|
|
630
|
+
(function (DeltaColour) {
|
|
631
|
+
DeltaColour["Success"] = "success";
|
|
632
|
+
DeltaColour["Warning"] = "warning";
|
|
633
|
+
DeltaColour["Danger"] = "danger";
|
|
634
|
+
})(exports.DeltaColour || (exports.DeltaColour = {}));
|
|
635
|
+
exports.DeltaDisplayType = void 0;
|
|
636
|
+
(function (DeltaDisplayType) {
|
|
637
|
+
DeltaDisplayType["absolute"] = "absolute";
|
|
638
|
+
DeltaDisplayType["percent"] = "percent";
|
|
639
|
+
})(exports.DeltaDisplayType || (exports.DeltaDisplayType = {}));
|
|
640
|
+
var deltaPerType = (_a$5 = {},
|
|
641
|
+
_a$5[exports.DeltaDisplayType.absolute] = function (value, original) { return value - original; },
|
|
642
|
+
_a$5[exports.DeltaDisplayType.percent] = function (value, original) { return ((value - original) / original) * 100; },
|
|
643
|
+
_a$5);
|
|
644
|
+
var roundValue = function (value) { return +("" + value).substring(0, 10); };
|
|
645
|
+
var delta = function (value, originalValue, displayType, mapping) {
|
|
646
|
+
if (displayType === void 0) { displayType = exports.DeltaDisplayType.percent; }
|
|
647
|
+
var vvalue = roundValue(propertyValue$1(value));
|
|
648
|
+
var voriginalValue = roundValue(propertyValue$1(originalValue));
|
|
649
|
+
var deltaFuncs = Object.assign(Object.assign({}, deltaPerType), mapping);
|
|
650
|
+
var diff = vvalue === voriginalValue ? 0 : deltaFuncs[displayType](vvalue, voriginalValue);
|
|
651
|
+
return Number.isFinite(diff) ? (diff === -0 ? 0 : diff) : 0;
|
|
652
|
+
};
|
|
654
653
|
var PercentDeltaConditions;
|
|
655
654
|
(function (PercentDeltaConditions) {
|
|
656
655
|
PercentDeltaConditions["recalculated0"] = "recalculated should be 0";
|
|
657
656
|
PercentDeltaConditions["original0"] = "original is 0";
|
|
658
657
|
})(PercentDeltaConditions || (PercentDeltaConditions = {}));
|
|
659
|
-
var calculatePercentDeltaConditions = (
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
_a$5);
|
|
663
|
-
var calculatePercentDeltaResult = (_b$2 = {},
|
|
664
|
-
_b$2[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return (recalculated - original) / (original + 1); },
|
|
665
|
-
// Always considered an error so deliberately exceed SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
666
|
-
_b$2[PercentDeltaConditions.original0] = function (original, recalculated) { return Math.sign(recalculated - original); },
|
|
667
|
-
_b$2.default = function (original, recalculated) { return (recalculated - original) / original; },
|
|
658
|
+
var calculatePercentDeltaConditions = (_b$2 = {},
|
|
659
|
+
_b$2[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return original > 0 && recalculated === 0; },
|
|
660
|
+
_b$2[PercentDeltaConditions.original0] = function (original, recalculated) { return original === 0 && recalculated > 0; },
|
|
668
661
|
_b$2);
|
|
662
|
+
var calculatePercentDeltaResult = (_c$2 = {},
|
|
663
|
+
_c$2[PercentDeltaConditions.recalculated0] = function (original, recalculated) { return (recalculated - original) / (original + 1); },
|
|
664
|
+
// Always considered an error so deliberately exceed SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
665
|
+
_c$2[PercentDeltaConditions.original0] = function (original, recalculated) { return Math.sign(recalculated - original); },
|
|
666
|
+
_c$2.default = function (original, recalculated) { return (recalculated - original) / original; },
|
|
667
|
+
_c$2);
|
|
669
668
|
var calculatePercentDelta = function (recalculated, original) {
|
|
670
669
|
var matchingCondition = Object.values(PercentDeltaConditions).find(function (value) { return calculatePercentDeltaConditions[value](original, recalculated); }) || 'default';
|
|
671
670
|
return calculatePercentDeltaResult[matchingCondition](original, recalculated) * 100;
|
|
672
671
|
};
|
|
673
|
-
var customDeltaFuncs = (
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
var evaluateSuccess = function (
|
|
672
|
+
var customDeltaFuncs = (_d$2 = {},
|
|
673
|
+
_d$2[exports.DeltaDisplayType.percent] = calculatePercentDelta,
|
|
674
|
+
_d$2);
|
|
675
|
+
var evaluateSuccess = function (deltaValue) { return Math.abs(deltaValue) < SUCCESS_CRITERION_MAX_DELTA_PERCENT
|
|
677
676
|
? exports.DeltaColour.Success
|
|
678
|
-
: Math.abs(
|
|
677
|
+
: Math.abs(deltaValue) < WARNING_CRITERION_MAX_DELTA_PERCENT
|
|
679
678
|
? exports.DeltaColour.Warning
|
|
680
679
|
: exports.DeltaColour.Danger; };
|
|
681
680
|
|
|
@@ -774,7 +773,7 @@
|
|
|
774
773
|
this.values = [];
|
|
775
774
|
}
|
|
776
775
|
BlankNodeDiffsComponent.prototype.ngOnInit = function () {
|
|
777
|
-
this.values =
|
|
776
|
+
this.values = formatDiffValues(this.originalValues, this.recalculatedValues);
|
|
778
777
|
};
|
|
779
778
|
return BlankNodeDiffsComponent;
|
|
780
779
|
}());
|
|
@@ -1273,7 +1272,8 @@
|
|
|
1273
1272
|
].filter(Boolean).join('-')
|
|
1274
1273
|
].join('/'); };
|
|
1275
1274
|
var HeEngineService = /** @class */ (function () {
|
|
1276
|
-
function HeEngineService(http) {
|
|
1275
|
+
function HeEngineService(_orchestratorBaseUrl, http) {
|
|
1276
|
+
this._orchestratorBaseUrl = _orchestratorBaseUrl;
|
|
1277
1277
|
this.http = http;
|
|
1278
1278
|
this.modelsLoading = false;
|
|
1279
1279
|
this.modelsLoaded = false;
|
|
@@ -1323,20 +1323,25 @@
|
|
|
1323
1323
|
return this.model$(model).pipe(operators.take(1)).toPromise();
|
|
1324
1324
|
};
|
|
1325
1325
|
HeEngineService.prototype.ochestratorConfig = function (type) {
|
|
1326
|
-
return this.http.get(
|
|
1326
|
+
return this.http.get(this._orchestratorBaseUrl + "/" + type + ".json", {
|
|
1327
1327
|
params: { inline: false }
|
|
1328
1328
|
}).toPromise();
|
|
1329
1329
|
};
|
|
1330
1330
|
return HeEngineService;
|
|
1331
1331
|
}());
|
|
1332
|
-
HeEngineService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, deps: [{ token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1332
|
+
HeEngineService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, deps: [{ token: HE_ORCHESTRATOR_BASE_URL }, { token: i1__namespace$1.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1333
1333
|
HeEngineService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, providedIn: 'root' });
|
|
1334
1334
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeEngineService, decorators: [{
|
|
1335
1335
|
type: i0.Injectable,
|
|
1336
1336
|
args: [{
|
|
1337
1337
|
providedIn: 'root'
|
|
1338
1338
|
}]
|
|
1339
|
-
}], ctorParameters: function () {
|
|
1339
|
+
}], ctorParameters: function () {
|
|
1340
|
+
return [{ type: undefined, decorators: [{
|
|
1341
|
+
type: i0.Inject,
|
|
1342
|
+
args: [HE_ORCHESTRATOR_BASE_URL]
|
|
1343
|
+
}] }, { type: i1__namespace$1.HttpClient }];
|
|
1344
|
+
} });
|
|
1340
1345
|
|
|
1341
1346
|
var NodeKeyState;
|
|
1342
1347
|
(function (NodeKeyState) {
|
|
@@ -3526,11 +3531,11 @@
|
|
|
3526
3531
|
type: i0.Output
|
|
3527
3532
|
}] } });
|
|
3528
3533
|
|
|
3529
|
-
|
|
3530
|
-
(function (
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
})(
|
|
3534
|
+
exports.DiffsDisplayType = void 0;
|
|
3535
|
+
(function (DiffsDisplayType) {
|
|
3536
|
+
DiffsDisplayType["diffs"] = "diffs";
|
|
3537
|
+
DiffsDisplayType["sideBySide"] = "side-by-side";
|
|
3538
|
+
})(exports.DiffsDisplayType || (exports.DiffsDisplayType = {}));
|
|
3534
3539
|
|
|
3535
3540
|
var omit = require('lodash.omit');
|
|
3536
3541
|
var ignoreProperties = [
|
|
@@ -3546,9 +3551,9 @@
|
|
|
3546
3551
|
var NodeDiffsComponent = /** @class */ (function () {
|
|
3547
3552
|
function NodeDiffsComponent(nodeService) {
|
|
3548
3553
|
this.nodeService = nodeService;
|
|
3549
|
-
this.displayType =
|
|
3554
|
+
this.displayType = exports.DiffsDisplayType.diffs;
|
|
3550
3555
|
this.diffsLoaded = new i0.EventEmitter();
|
|
3551
|
-
this.
|
|
3556
|
+
this.DiffsDisplayType = exports.DiffsDisplayType;
|
|
3552
3557
|
this.loading = true;
|
|
3553
3558
|
}
|
|
3554
3559
|
NodeDiffsComponent.prototype.ngOnInit = function () {
|
|
@@ -3582,7 +3587,7 @@
|
|
|
3582
3587
|
return NodeDiffsComponent;
|
|
3583
3588
|
}());
|
|
3584
3589
|
NodeDiffsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeDiffsComponent, deps: [{ token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
3585
|
-
NodeDiffsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeDiffsComponent, selector: "he-node-diffs", inputs: { data: "data", id: "id", type: "type", displayType: "displayType" }, outputs: { diffsLoaded: "diffsLoaded" }, ngImport: i0__namespace, template: "<div *ngIf=\"loading\" class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n</div>\n\n<ng-container *ngIf=\"left && right\">\n <ng-container [ngSwitch]=\"displayType\">\n <div *ngSwitchCase=\"
|
|
3590
|
+
NodeDiffsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: NodeDiffsComponent, selector: "he-node-diffs", inputs: { data: "data", id: "id", type: "type", displayType: "displayType" }, outputs: { diffsLoaded: "diffsLoaded" }, ngImport: i0__namespace, template: "<div *ngIf=\"loading\" class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n</div>\n\n<ng-container *ngIf=\"left && right\">\n <ng-container [ngSwitch]=\"displayType\">\n <div *ngSwitchCase=\"DiffsDisplayType.diffs\" [innerHTML]=\"diffHtml\"></div>\n\n <div *ngSwitchCase=\"DiffsDisplayType.sideBySide\" class=\"columns\">\n <div class=\"column is-6\">\n <pre class=\"has-background-black has-text-white\"><code>{{left | json}}</code></pre>\n </div>\n <div class=\"column is-6\">\n <pre class=\"has-background-black has-text-white\"><code>{{right | json}}</code></pre>\n </div>\n </div>\n </ng-container>\n</ng-container>\n", styles: [""], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "json": i3__namespace.JsonPipe } });
|
|
3586
3591
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: NodeDiffsComponent, decorators: [{
|
|
3587
3592
|
type: i0.Component,
|
|
3588
3593
|
args: [{
|
|
@@ -4782,459 +4787,27 @@
|
|
|
4782
4787
|
}]
|
|
4783
4788
|
}] });
|
|
4784
4789
|
|
|
4785
|
-
var
|
|
4786
|
-
|
|
4787
|
-
|
|
4790
|
+
var _f;
|
|
4791
|
+
var mapErrorMessage = 'does not contain latitude and longitude';
|
|
4792
|
+
var parseDataPath = function (dataPath) {
|
|
4793
|
+
var _f = __read(dataPath.split('.')), _ = _f[0], paths = _f.slice(1);
|
|
4794
|
+
return paths.map(function (path) { return ({ path: path, label: keyToLabel(path.replace(/\[\d+\]/g, '')) }); });
|
|
4788
4795
|
};
|
|
4789
|
-
var
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4796
|
+
var contactUsEmail = 'community@hestia.earth';
|
|
4797
|
+
var externalLink = function (href, text) { return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>"; };
|
|
4798
|
+
var glossaryLink = function (text) { return externalLink(baseUrl() + "/glossary", text); };
|
|
4799
|
+
var glossaryTypeLink = function (type) { return externalLink(baseUrl() + "/glossary?termType=" + type, termTypeLabel(type)); };
|
|
4800
|
+
var termLink = function (_f) {
|
|
4801
|
+
var id = _f.id, name = _f.name;
|
|
4802
|
+
return externalLink(baseUrl() + "/term/" + id, name);
|
|
4795
4803
|
};
|
|
4796
|
-
var
|
|
4797
|
-
var
|
|
4798
|
-
|
|
4799
|
-
region ? createMarker(termLocation(region), termLocationName(region).name, undefined, 20) : undefined,
|
|
4800
|
-
country ? createMarker(termLocation(country), termLocationName(country).name, undefined, 40) : undefined
|
|
4801
|
-
].filter(Boolean);
|
|
4802
|
-
return (markers.length ? markers[0] : undefined);
|
|
4804
|
+
var nodeLink = function (_f) {
|
|
4805
|
+
var type = _f["@type"], id = _f["@id"], name = _f.name;
|
|
4806
|
+
return type && id ? "<a href=\"/" + type.toLowerCase() + "/" + id + "\" target=\"_blank\">" + (name || id) + "</a>" : null;
|
|
4803
4807
|
};
|
|
4804
|
-
var
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
return (boundary ? polygonsFromFeature(boundary) : undefined);
|
|
4808
|
-
};
|
|
4809
|
-
var regions = function (sites) { return utils.unique(sites.map(function (_a) {
|
|
4810
|
-
var country = _a.country, region = _a.region;
|
|
4811
|
-
return region ? region['@id'] : (country ? country['@id'] : null);
|
|
4812
|
-
}).filter(Boolean)); };
|
|
4813
|
-
var defaultCenter = { lat: 0, lng: 0 };
|
|
4814
|
-
var SitesMapsComponent = /** @class */ (function () {
|
|
4815
|
-
function SitesMapsComponent(nodeService) {
|
|
4816
|
-
this.nodeService = nodeService;
|
|
4817
|
-
this.loaded = false;
|
|
4818
|
-
this.loadPolygons = true;
|
|
4819
|
-
this.sites = [];
|
|
4820
|
-
this.nodes = [];
|
|
4821
|
-
this.center = defaultCenter;
|
|
4822
|
-
this.zoom = 2;
|
|
4823
|
-
this.showNotice = true;
|
|
4824
|
-
this.googleLoaded = false;
|
|
4825
|
-
this.showNoLocation = false;
|
|
4826
|
-
}
|
|
4827
|
-
SitesMapsComponent.prototype.ngOnInit = function () {
|
|
4828
|
-
var _this = this;
|
|
4829
|
-
waitFor('google', function () {
|
|
4830
|
-
_this.googleLoaded = true;
|
|
4831
|
-
setTimeout(function () { return !_this.loaded && _this.loadData(); });
|
|
4832
|
-
});
|
|
4833
|
-
};
|
|
4834
|
-
SitesMapsComponent.prototype.ngAfterViewInit = function () {
|
|
4835
|
-
return this.googleLoaded && this.loadData();
|
|
4836
|
-
};
|
|
4837
|
-
SitesMapsComponent.prototype.loadData = function () {
|
|
4838
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4839
|
-
var sites, markers, polygons, termPolygons;
|
|
4840
|
-
var _this = this;
|
|
4841
|
-
return __generator(this, function (_a) {
|
|
4842
|
-
switch (_a.label) {
|
|
4843
|
-
case 0:
|
|
4844
|
-
// loaded data as geojson
|
|
4845
|
-
this.map.googleMap.data.setStyle(function () { return (Object.assign(Object.assign({}, strokeStyle), { strokeOpacity: 0.1 })); });
|
|
4846
|
-
return [4 /*yield*/, this.getSites()];
|
|
4847
|
-
case 1:
|
|
4848
|
-
sites = _a.sent();
|
|
4849
|
-
markers = this.addSiteMarkers(sites);
|
|
4850
|
-
polygons = sites.flatMap(sitePolygon).filter(Boolean);
|
|
4851
|
-
polygons.map(function (polygon) { return polygon === null || polygon === void 0 ? void 0 : polygon.setMap(_this.map.googleMap); });
|
|
4852
|
-
this.loaded = true;
|
|
4853
|
-
return [4 /*yield*/, Promise.all(regions(sites).map(function (v) { return _this.addTermsPolygons(v); }))];
|
|
4854
|
-
case 2:
|
|
4855
|
-
termPolygons = (_a.sent()).flat();
|
|
4856
|
-
this.showNoLocation = markers.length === 0 && polygons.length === 0 && termPolygons.length === 0;
|
|
4857
|
-
return [2 /*return*/, markers.length ?
|
|
4858
|
-
this.centerMarker(markers[0]) :
|
|
4859
|
-
this.centerPolygons(polygons.length ? polygons : termPolygons)];
|
|
4860
|
-
}
|
|
4861
|
-
});
|
|
4862
|
-
});
|
|
4863
|
-
};
|
|
4864
|
-
SitesMapsComponent.prototype.addMarkers = function (markers, cluster) {
|
|
4865
|
-
var _this = this;
|
|
4866
|
-
if (cluster === void 0) { cluster = false; }
|
|
4867
|
-
return cluster ?
|
|
4868
|
-
new MarkerClusterer__default["default"](this.map.googleMap, markers, { imagePath: clustererImage }) :
|
|
4869
|
-
markers.map(function (marker) { return marker.setMap(_this.map.googleMap); });
|
|
4870
|
-
};
|
|
4871
|
-
SitesMapsComponent.prototype.addTermsPolygons = function (id) {
|
|
4872
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4873
|
-
var _a;
|
|
4874
|
-
return __generator(this, function (_b) {
|
|
4875
|
-
switch (_b.label) {
|
|
4876
|
-
case 0:
|
|
4877
|
-
if (!this.loadPolygons) return [3 /*break*/, 2];
|
|
4878
|
-
return [4 /*yield*/, this.termPolygons(id)];
|
|
4879
|
-
case 1:
|
|
4880
|
-
_a = _b.sent();
|
|
4881
|
-
return [3 /*break*/, 3];
|
|
4882
|
-
case 2:
|
|
4883
|
-
_a = [];
|
|
4884
|
-
_b.label = 3;
|
|
4885
|
-
case 3: return [2 /*return*/, _a];
|
|
4886
|
-
}
|
|
4887
|
-
});
|
|
4888
|
-
});
|
|
4889
|
-
};
|
|
4890
|
-
SitesMapsComponent.prototype.centerMarker = function (marker) {
|
|
4891
|
-
var center = marker.getPosition();
|
|
4892
|
-
this.center = center ? { lat: center.lat(), lng: center.lng() } : defaultCenter;
|
|
4893
|
-
};
|
|
4894
|
-
SitesMapsComponent.prototype.centerPolygons = function (polygons) {
|
|
4895
|
-
try {
|
|
4896
|
-
return polygons.length ? this.map.googleMap.fitBounds(polygonBounds(polygons)) : null;
|
|
4897
|
-
}
|
|
4898
|
-
catch (err) {
|
|
4899
|
-
if (polygons.length) {
|
|
4900
|
-
this.map.googleMap.fitBounds(polygonBounds(polygons[0]));
|
|
4901
|
-
this.zoom = 3;
|
|
4902
|
-
}
|
|
4903
|
-
}
|
|
4904
|
-
};
|
|
4905
|
-
SitesMapsComponent.prototype.addSiteMarkers = function (sites) {
|
|
4906
|
-
var siteMarkers = sites.map(siteMarker).filter(Boolean);
|
|
4907
|
-
var markers = siteMarkers.length ? siteMarkers : sites.map(siteDefaultLocation).filter(Boolean);
|
|
4908
|
-
this.addMarkers(markers, !!siteMarkers.length);
|
|
4909
|
-
return markers;
|
|
4910
|
-
};
|
|
4911
|
-
SitesMapsComponent.prototype.loadSite = function (node) {
|
|
4912
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4913
|
-
var _a;
|
|
4914
|
-
return __generator(this, function (_b) {
|
|
4915
|
-
switch (_b.label) {
|
|
4916
|
-
case 0:
|
|
4917
|
-
if (!('schemaVersion' in node)) return [3 /*break*/, 1];
|
|
4918
|
-
_a = node;
|
|
4919
|
-
return [3 /*break*/, 3];
|
|
4920
|
-
case 1: return [4 /*yield*/, this.nodeService.get(node)];
|
|
4921
|
-
case 2:
|
|
4922
|
-
_a = _b.sent();
|
|
4923
|
-
_b.label = 3;
|
|
4924
|
-
case 3:
|
|
4925
|
-
// means the site was already downloaded
|
|
4926
|
-
return [2 /*return*/, _a];
|
|
4927
|
-
}
|
|
4928
|
-
});
|
|
4929
|
-
});
|
|
4930
|
-
};
|
|
4931
|
-
SitesMapsComponent.prototype.siteData = function (node) {
|
|
4932
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4933
|
-
var _a, _b, _c, _d;
|
|
4934
|
-
return __generator(this, function (_e) {
|
|
4935
|
-
switch (_e.label) {
|
|
4936
|
-
case 0:
|
|
4937
|
-
if (![
|
|
4938
|
-
schema.NodeType.Site,
|
|
4939
|
-
schema.NodeType.Organisation
|
|
4940
|
-
].includes(node.type)) return [3 /*break*/, 1];
|
|
4941
|
-
_a = node;
|
|
4942
|
-
return [3 /*break*/, 7];
|
|
4943
|
-
case 1:
|
|
4944
|
-
if (!isSite(node)) return [3 /*break*/, 2];
|
|
4945
|
-
_b = this.loadSite(node);
|
|
4946
|
-
return [3 /*break*/, 6];
|
|
4947
|
-
case 2:
|
|
4948
|
-
if (!('site' in node && isSite(node.site))) return [3 /*break*/, 3];
|
|
4949
|
-
_c = this.loadSite(node.site);
|
|
4950
|
-
return [3 /*break*/, 5];
|
|
4951
|
-
case 3:
|
|
4952
|
-
_d = this.siteData;
|
|
4953
|
-
return [4 /*yield*/, this.loadSite(node)];
|
|
4954
|
-
case 4:
|
|
4955
|
-
_c = _d.apply(this, [_e.sent()]);
|
|
4956
|
-
_e.label = 5;
|
|
4957
|
-
case 5:
|
|
4958
|
-
_b = (_c);
|
|
4959
|
-
_e.label = 6;
|
|
4960
|
-
case 6:
|
|
4961
|
-
_a = (_b);
|
|
4962
|
-
_e.label = 7;
|
|
4963
|
-
case 7: return [2 /*return*/, _a];
|
|
4964
|
-
}
|
|
4965
|
-
});
|
|
4966
|
-
});
|
|
4967
|
-
};
|
|
4968
|
-
SitesMapsComponent.prototype.getSites = function () {
|
|
4969
|
-
var _this = this;
|
|
4970
|
-
var nodes = this.sites && this.sites.length ? this.sites : this.nodes;
|
|
4971
|
-
return Promise.all(nodes.map(function (node) { return _this.siteData(node); }));
|
|
4972
|
-
};
|
|
4973
|
-
SitesMapsComponent.prototype.termPolygons = function (id) {
|
|
4974
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4975
|
-
var data, polygons, _err_1;
|
|
4976
|
-
var _this = this;
|
|
4977
|
-
return __generator(this, function (_a) {
|
|
4978
|
-
switch (_a.label) {
|
|
4979
|
-
case 0:
|
|
4980
|
-
_a.trys.push([0, 2, , 3]);
|
|
4981
|
-
return [4 /*yield*/, this.nodeService.downloadRaw(baseUrl() + "/gadm/" + id + ".geojson")];
|
|
4982
|
-
case 1:
|
|
4983
|
-
data = _a.sent();
|
|
4984
|
-
polygons = polygonsFromFeature(data);
|
|
4985
|
-
polygons.map(function (polygon) { return polygon.setMap(_this.map.googleMap); });
|
|
4986
|
-
return [2 /*return*/, polygons];
|
|
4987
|
-
case 2:
|
|
4988
|
-
_err_1 = _a.sent();
|
|
4989
|
-
// ignore error if the file does not exist
|
|
4990
|
-
return [2 /*return*/, []];
|
|
4991
|
-
case 3: return [2 /*return*/];
|
|
4992
|
-
}
|
|
4993
|
-
});
|
|
4994
|
-
});
|
|
4995
|
-
};
|
|
4996
|
-
return SitesMapsComponent;
|
|
4997
|
-
}());
|
|
4998
|
-
SitesMapsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, deps: [{ token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
4999
|
-
SitesMapsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMapsComponent, selector: "he-sites-maps", inputs: { loadPolygons: "loadPolygons", sites: "sites", nodes: "nodes", center: "center", zoom: "zoom", showNotice: "showNotice" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$2.GoogleMap, descendants: true }], ngImport: i0__namespace, template: "<google-map *ngIf=\"googleLoaded\"\n height=\"100%\"\n width=\"100%\"\n [zoom]=\"zoom\"\n [center]=\"center\"\n></google-map>\n\n<p *ngIf=\"showNotice\" class=\"mt-2 is-italic is-size-7\">The information provided might not be complete</p>\n\n<div class=\"no-location has-text-center has-text-light\" *ngIf=\"showNoLocation\">\n <span>No precise location data</span>\n</div>\n", styles: [":host{display:block;height:100%;position:relative;width:100%}.no-location{background-color:#0000004d;left:0;height:100%;position:absolute;top:0;width:100%;z-index:9}.no-location>span{display:inline-block;margin-top:12%}\n"], components: [{ type: i1__namespace$2.GoogleMap, selector: "google-map", inputs: ["height", "width", "center", "zoom", "options", "mapTypeId"], outputs: ["authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
5000
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, decorators: [{
|
|
5001
|
-
type: i0.Component,
|
|
5002
|
-
args: [{
|
|
5003
|
-
selector: 'he-sites-maps',
|
|
5004
|
-
templateUrl: './sites-maps.component.html',
|
|
5005
|
-
styleUrls: ['./sites-maps.component.scss']
|
|
5006
|
-
}]
|
|
5007
|
-
}], ctorParameters: function () { return [{ type: HeNodeService }]; }, propDecorators: { map: [{
|
|
5008
|
-
type: i0.ViewChild,
|
|
5009
|
-
args: [i1$2.GoogleMap]
|
|
5010
|
-
}], loadPolygons: [{
|
|
5011
|
-
type: i0.Input
|
|
5012
|
-
}], sites: [{
|
|
5013
|
-
type: i0.Input
|
|
5014
|
-
}], nodes: [{
|
|
5015
|
-
type: i0.Input
|
|
5016
|
-
}], center: [{
|
|
5017
|
-
type: i0.Input
|
|
5018
|
-
}], zoom: [{
|
|
5019
|
-
type: i0.Input
|
|
5020
|
-
}], showNotice: [{
|
|
5021
|
-
type: i0.Input
|
|
5022
|
-
}] } });
|
|
5023
|
-
|
|
5024
|
-
var maxAreaSize = 5000;
|
|
5025
|
-
var siteTooBig = function (_a) {
|
|
5026
|
-
var area = _a.area;
|
|
5027
|
-
return area && area / 100 > maxAreaSize;
|
|
5028
|
-
};
|
|
5029
|
-
var hasMultipleValues = function (values) { return (values || []).length > 1; };
|
|
5030
|
-
var weighedAverage = function (_a) {
|
|
5031
|
-
var value = _a.value, depthLower = _a.depthLower, depthUpper = _a.depthUpper;
|
|
5032
|
-
return value.reduce(function (prev, curr, index) { return prev + (curr * (depthLower[index] - depthUpper[index])); }, 0) /
|
|
5033
|
-
value.reduce(function (prev, _curr, index) { return prev + (depthLower[index] - depthUpper[index]); }, 0);
|
|
5034
|
-
};
|
|
5035
|
-
var measurementValue = function (_a) {
|
|
5036
|
-
var value = _a.value, depthLower = _a.depthLower, depthUpper = _a.depthUpper;
|
|
5037
|
-
return hasMultipleValues(value) && hasMultipleValues(depthLower) && hasMultipleValues(depthUpper) ?
|
|
5038
|
-
weighedAverage({ value: value, depthLower: depthLower, depthUpper: depthUpper }) :
|
|
5039
|
-
propertyValue$1(value);
|
|
5040
|
-
};
|
|
5041
|
-
|
|
5042
|
-
var SitesMeasurementsLogsComponent = /** @class */ (function () {
|
|
5043
|
-
function SitesMeasurementsLogsComponent(searchService, nodeService) {
|
|
5044
|
-
this.searchService = searchService;
|
|
5045
|
-
this.nodeService = nodeService;
|
|
5046
|
-
this.originalValues = [];
|
|
5047
|
-
this.recalculatedValues = [];
|
|
5048
|
-
this.loading = true;
|
|
5049
|
-
this.NodeType = schema.NodeType;
|
|
5050
|
-
this.models = [];
|
|
5051
|
-
this.measurements = [];
|
|
5052
|
-
}
|
|
5053
|
-
SitesMeasurementsLogsComponent.prototype.ngOnInit = function () {
|
|
5054
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
5055
|
-
var _a, measurements;
|
|
5056
|
-
return __generator(this, function (_b) {
|
|
5057
|
-
switch (_b.label) {
|
|
5058
|
-
case 0:
|
|
5059
|
-
this.logsUrl = this.nodeService.nodeLogsUrl(this.node);
|
|
5060
|
-
_a = this;
|
|
5061
|
-
return [4 /*yield*/, this.nodeService.getModelsLog(this.node)];
|
|
5062
|
-
case 1:
|
|
5063
|
-
_a.logs = _b.sent();
|
|
5064
|
-
return [4 /*yield*/, this.searchService.search({
|
|
5065
|
-
fields: ['@type', '@id', 'name'],
|
|
5066
|
-
limit: 1000,
|
|
5067
|
-
query: {
|
|
5068
|
-
bool: {
|
|
5069
|
-
must: [
|
|
5070
|
-
matchType(schema.NodeType.Term),
|
|
5071
|
-
matchTermType(schema.TermTermType.measurement)
|
|
5072
|
-
]
|
|
5073
|
-
}
|
|
5074
|
-
}
|
|
5075
|
-
})];
|
|
5076
|
-
case 2:
|
|
5077
|
-
measurements = (_b.sent()).results;
|
|
5078
|
-
this.measurements = measurements;
|
|
5079
|
-
this.loading = false;
|
|
5080
|
-
return [2 /*return*/];
|
|
5081
|
-
}
|
|
5082
|
-
});
|
|
5083
|
-
});
|
|
5084
|
-
};
|
|
5085
|
-
Object.defineProperty(SitesMeasurementsLogsComponent.prototype, "node", {
|
|
5086
|
-
get: function () {
|
|
5087
|
-
return Object.assign(Object.assign({}, this.site), { dataState: api.DataState.recalculated });
|
|
5088
|
-
},
|
|
5089
|
-
enumerable: false,
|
|
5090
|
-
configurable: true
|
|
5091
|
-
});
|
|
5092
|
-
return SitesMeasurementsLogsComponent;
|
|
5093
|
-
}());
|
|
5094
|
-
SitesMeasurementsLogsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsLogsComponent, deps: [{ token: HeSearchService }, { token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5095
|
-
SitesMeasurementsLogsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMeasurementsLogsComponent, selector: "he-sites-measurements-logs", inputs: { site: "site", originalValues: "originalValues", recalculatedValues: "recalculatedValues" }, ngImport: i0__namespace, template: "<he-node-logs-models *ngIf=\"!loading; else loader\"\n [logsUrl]=\"logsUrl\"\n [nodeType]=\"NodeType.Site\"\n [originalValues]=\"originalValues\"\n [recalculatedValues]=\"recalculatedValues\"\n [terms]=\"measurements\"\n [logs]=\"logs\"\n filteredType=\"Measurement\"\n></he-node-logs-models>\n\n<ng-template #loader>\n <div class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n </div>\n</ng-template>\n", styles: [""], components: [{ type: NodeLogsModelsComponent, selector: "he-node-logs-models", inputs: ["nodeType", "nodeKey", "logsUrl", "originalValues", "recalculatedValues", "terms", "logs", "filteredType"] }, { type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
5096
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsLogsComponent, decorators: [{
|
|
5097
|
-
type: i0.Component,
|
|
5098
|
-
args: [{
|
|
5099
|
-
selector: 'he-sites-measurements-logs',
|
|
5100
|
-
templateUrl: './sites-measurements-logs.component.html',
|
|
5101
|
-
styleUrls: ['./sites-measurements-logs.component.scss']
|
|
5102
|
-
}]
|
|
5103
|
-
}], ctorParameters: function () { return [{ type: HeSearchService }, { type: HeNodeService }]; }, propDecorators: { site: [{
|
|
5104
|
-
type: i0.Input
|
|
5105
|
-
}], originalValues: [{
|
|
5106
|
-
type: i0.Input
|
|
5107
|
-
}], recalculatedValues: [{
|
|
5108
|
-
type: i0.Input
|
|
5109
|
-
}] } });
|
|
5110
|
-
|
|
5111
|
-
var orderBy$1 = require('lodash.orderby');
|
|
5112
|
-
var View$1;
|
|
5113
|
-
(function (View) {
|
|
5114
|
-
View["table"] = "table";
|
|
5115
|
-
View["logs"] = "logs";
|
|
5116
|
-
})(View$1 || (View$1 = {}));
|
|
5117
|
-
var SitesMeasurementsComponent = /** @class */ (function () {
|
|
5118
|
-
function SitesMeasurementsComponent() {
|
|
5119
|
-
this.originalValues = [];
|
|
5120
|
-
this.sites = [];
|
|
5121
|
-
this.showDownload = false;
|
|
5122
|
-
this.View = View$1;
|
|
5123
|
-
this.selectedView = View$1.table;
|
|
5124
|
-
this.maxAreaSize = maxAreaSize;
|
|
5125
|
-
this.siteTooBig = siteTooBig;
|
|
5126
|
-
this.defaultLabel = defaultLabel;
|
|
5127
|
-
this.measurementValue = measurementValue;
|
|
5128
|
-
this.measurements = [];
|
|
5129
|
-
}
|
|
5130
|
-
SitesMeasurementsComponent.prototype.ngOnChanges = function (changes) {
|
|
5131
|
-
if ('sites' in changes) {
|
|
5132
|
-
return this.update();
|
|
5133
|
-
}
|
|
5134
|
-
if ('dataState' in changes) {
|
|
5135
|
-
this.selectedView = View$1.table;
|
|
5136
|
-
}
|
|
5137
|
-
};
|
|
5138
|
-
SitesMeasurementsComponent.prototype.trackById = function (_index, item) {
|
|
5139
|
-
return item['@id'];
|
|
5140
|
-
};
|
|
5141
|
-
Object.defineProperty(SitesMeasurementsComponent.prototype, "isOriginal", {
|
|
5142
|
-
get: function () {
|
|
5143
|
-
return this.dataState === api.DataState.original;
|
|
5144
|
-
},
|
|
5145
|
-
enumerable: false,
|
|
5146
|
-
configurable: true
|
|
5147
|
-
});
|
|
5148
|
-
SitesMeasurementsComponent.prototype.update = function () {
|
|
5149
|
-
var measurementsPerSite = groupNodesByTerm(this.sites, 'measurements', this.originalValues);
|
|
5150
|
-
this.measurements = orderBy$1(grouppedKeys(measurementsPerSite), ['key'], ['asc']);
|
|
5151
|
-
};
|
|
5152
|
-
SitesMeasurementsComponent.prototype.togglePopover = function (popover, context) {
|
|
5153
|
-
return popover.isOpen() ? popover.close() : popover.open(context);
|
|
5154
|
-
};
|
|
5155
|
-
Object.defineProperty(SitesMeasurementsComponent.prototype, "showAreaTooBig", {
|
|
5156
|
-
get: function () {
|
|
5157
|
-
return this.dataState === api.DataState.recalculated && (this.sites || []).some(siteTooBig);
|
|
5158
|
-
},
|
|
5159
|
-
enumerable: false,
|
|
5160
|
-
configurable: true
|
|
5161
|
-
});
|
|
5162
|
-
return SitesMeasurementsComponent;
|
|
5163
|
-
}());
|
|
5164
|
-
SitesMeasurementsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5165
|
-
SitesMeasurementsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMeasurementsComponent, selector: "he-sites-measurements", inputs: { originalValues: "originalValues", sites: "sites", dataState: "dataState" }, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container *ngIf=\"measurements.length; else emptyTable\">\n <div class=\"columns is-variable is-2 m-0\">\n <div class=\"column is-hidden-mobile\"></div>\n <div class=\"column is-narrow\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.table\" (click)=\"selectedView = View.table\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Table view</span>\n </button>\n </div>\n <div class=\"control\" *ngIf=\"!isOriginal && sites.length === 1\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.logs\" (click)=\"selectedView = View.logs\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"calculator\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Recalculations logs</span>\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"px-3 pb-3\" [class.is-hidden]=\"selectedView !== View.table\">\n <div class=\"has-text-right mb-2\">\n <button class=\"button is-dark is-outlined is-small\" (click)=\"showDownload = true\">\n <fa-icon icon=\"download\"></fa-icon>\n <span class=\"pl-2\">Download (CSV)</span>\n </button>\n </div>\n\n <div class=\"table-container data-table-container mb-1\">\n <table class=\"table is-narrow data-table has-children-{{measurements.length}}\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th *ngFor=\"let measurement of measurements\"\n [attr.title]=\"measurement.value.term.name\"\n >\n <he-node-link [node]=\"measurement.value.term\">\n <span>{{measurement.value.term.name | ellipsis:30}}</span>\n </he-node-link>\n </th>\n </tr>\n <tr>\n <th class=\"width-auto\"></th>\n <th *ngFor=\"let measurement of measurements\"\n [attr.title]=\"measurement.value.term.units\"\n >{{measurement.value.term.units}}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let site of sites; trackBy: trackById; let i = index\">\n <td class=\"width-auto\" [attr.title]=\"defaultLabel(site)\">\n <he-node-link [node]=\"site\">\n <span class=\"is-nowrap has-text-ellipsis\">{{i + 1}}. {{defaultLabel(site)}}</span>\n </he-node-link>\n </td>\n <td class=\"is-nowrap\" *ngFor=\"let measurement of measurements\">\n <span *ngIf=\"measurement.value.values[site['@id']]\"\n class=\"trigger-popover\"\n [ngbPopover]=\"details\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"togglePopover(p, { data: measurement.value.values[site['@id']], site: site, key: 'measurements' })\"\n >\n <span pointer>{{measurementValue(measurement.value.values[site['@id']]) | precision:3 | default:'-'}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"measurement.value.values[site['@id']].nodes[0]\"\n key=\"value\"\n ></he-blank-node-state>\n </span>\n <span *ngIf=\"!measurement.value.values[site['@id']]\">\n <span>-</span>\n <sup class=\"pl-1\" *ngIf=\"siteTooBig(site)\">(1)</sup>\n </span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <he-blank-node-state-notice [dataState]=\"dataState\"></he-blank-node-state-notice>\n\n <p class=\"is-size-7 is-italic\" *ngIf=\"showAreaTooBig\">\n (1) This region is >{{maxAreaSize}}km2 and is too large to reliably gap fill Measurements.\n </p>\n </div>\n\n <he-sites-measurements-logs *ngIf=\"selectedView === View.logs && !isOriginal\"\n [site]=\"sites[0]\"\n [originalValues]=\"originalValues[0].measurements\"\n [recalculatedValues]=\"sites[0].measurements\"\n ></he-sites-measurements-logs>\n</ng-container>\n\n<he-node-csv-export-confirm *ngIf=\"showDownload\"\n [nodes]=\"sites\" filename=\"site-measurements.csv\" [isUpload]=\"false\"\n [headerKeys]=\"['site.id', 'site.@id', 'site.measurements.']\"\n (closed)=\"showDownload = false\"\n></he-node-csv-export-confirm>\n\n<ng-template #emptyTable>\n <div class=\"panel-block\">\n <span>No data</span>\n </div>\n</ng-template>\n\n<ng-template #emptyValue>\n <span>-</span>\n</ng-template>\n\n<ng-template #details let-node=\"site\" let-data=\"data\" let-key=\"key\">\n <p><b>{{node.name}}</b></p>\n <he-node-value-details\n [data]=\"data\" [nodeType]=\"node['@type']\" [dataKey]=\"key\"\n ></he-node-value-details>\n</ng-template>\n", styles: ["fa-icon{display:inline-block;width:10px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }, { type: BlankNodeStateNoticeComponent, selector: "he-blank-node-state-notice", inputs: ["dataState", "showDeleted"] }, { type: SitesMeasurementsLogsComponent, selector: "he-sites-measurements-logs", inputs: ["site", "originalValues", "recalculatedValues"] }, { type: NodeCsvExportConfirmComponent, selector: "he-node-csv-export-confirm", inputs: ["nodes", "filename", "headerKeys", "extension", "isUpload"], outputs: ["closed"] }, { type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: ["data", "nodeType", "dataKey"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "ellipsis": EllipsisPipe, "default": DefaultPipe, "precision": PrecisionPipe } });
|
|
5166
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsComponent, decorators: [{
|
|
5167
|
-
type: i0.Component,
|
|
5168
|
-
args: [{
|
|
5169
|
-
selector: 'he-sites-measurements',
|
|
5170
|
-
templateUrl: './sites-measurements.component.html',
|
|
5171
|
-
styleUrls: ['./sites-measurements.component.scss']
|
|
5172
|
-
}]
|
|
5173
|
-
}], propDecorators: { originalValues: [{
|
|
5174
|
-
type: i0.Input
|
|
5175
|
-
}], sites: [{
|
|
5176
|
-
type: i0.Input
|
|
5177
|
-
}], dataState: [{
|
|
5178
|
-
type: i0.Input
|
|
5179
|
-
}] } });
|
|
5180
|
-
|
|
5181
|
-
var components$2 = [
|
|
5182
|
-
SitesMapsComponent,
|
|
5183
|
-
SitesMeasurementsComponent,
|
|
5184
|
-
SitesMeasurementsLogsComponent
|
|
5185
|
-
];
|
|
5186
|
-
var HeSitesModule = /** @class */ (function () {
|
|
5187
|
-
function HeSitesModule() {
|
|
5188
|
-
}
|
|
5189
|
-
return HeSitesModule;
|
|
5190
|
-
}());
|
|
5191
|
-
HeSitesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
5192
|
-
HeSitesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, declarations: [SitesMapsComponent,
|
|
5193
|
-
SitesMeasurementsComponent,
|
|
5194
|
-
SitesMeasurementsLogsComponent], imports: [i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
5195
|
-
HeCommonModule,
|
|
5196
|
-
HeNodeModule], exports: [SitesMapsComponent,
|
|
5197
|
-
SitesMeasurementsComponent,
|
|
5198
|
-
SitesMeasurementsLogsComponent] });
|
|
5199
|
-
HeSitesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, imports: [[
|
|
5200
|
-
i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
5201
|
-
HeCommonModule,
|
|
5202
|
-
HeNodeModule
|
|
5203
|
-
]] });
|
|
5204
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, decorators: [{
|
|
5205
|
-
type: i0.NgModule,
|
|
5206
|
-
args: [{
|
|
5207
|
-
declarations: components$2,
|
|
5208
|
-
exports: components$2,
|
|
5209
|
-
imports: [
|
|
5210
|
-
i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
5211
|
-
HeCommonModule,
|
|
5212
|
-
HeNodeModule
|
|
5213
|
-
]
|
|
5214
|
-
}]
|
|
5215
|
-
}] });
|
|
5216
|
-
|
|
5217
|
-
var _f;
|
|
5218
|
-
var mapErrorMessage = 'does not contain latitude and longitude';
|
|
5219
|
-
var parseDataPath = function (dataPath) {
|
|
5220
|
-
var _f = __read(dataPath.split('.')), _ = _f[0], paths = _f.slice(1);
|
|
5221
|
-
return paths.map(function (path) { return ({ path: path, label: keyToLabel(path.replace(/\[\d+\]/g, '')) }); });
|
|
5222
|
-
};
|
|
5223
|
-
var contactUsEmail = 'community@hestia.earth';
|
|
5224
|
-
var externalLink = function (href, text) { return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>"; };
|
|
5225
|
-
var glossaryLink = function (text) { return externalLink(baseUrl() + "/glossary", text); };
|
|
5226
|
-
var glossaryTypeLink = function (type) { return externalLink(baseUrl() + "/glossary?termType=" + type, termTypeLabel(type)); };
|
|
5227
|
-
var termLink = function (_f) {
|
|
5228
|
-
var id = _f.id, name = _f.name;
|
|
5229
|
-
return externalLink(baseUrl() + "/term/" + id, name);
|
|
5230
|
-
};
|
|
5231
|
-
var nodeLink = function (_f) {
|
|
5232
|
-
var type = _f["@type"], id = _f["@id"], name = _f.name;
|
|
5233
|
-
return type && id ? "<a href=\"/" + type.toLowerCase() + "/" + id + "\" target=\"_blank\">" + (name || id) + "</a>" : null;
|
|
5234
|
-
};
|
|
5235
|
-
var schemaLink = function (type, title) {
|
|
5236
|
-
if (title === void 0) { title = type; }
|
|
5237
|
-
return "<a href=\"" + baseUrl() + "/schema/" + type + "\" target=\"_blank\">" + title + "</a>";
|
|
4808
|
+
var schemaLink = function (type, title) {
|
|
4809
|
+
if (title === void 0) { title = type; }
|
|
4810
|
+
return "<a href=\"" + baseUrl() + "/schema/" + type + "\" target=\"_blank\">" + title + "</a>";
|
|
5238
4811
|
};
|
|
5239
4812
|
var code = function (text) { return "<code>" + text + "</code>"; };
|
|
5240
4813
|
var dateFormatMessage = "should follow the ISO 8601 date format, e.g. " + code(2000) + ", or " + code('2000-12') + ", or " + code('2000-12-30');
|
|
@@ -5347,671 +4920,1103 @@
|
|
|
5347
4920
|
var _a, _b, _c, _d, _e;
|
|
5348
4921
|
return "You have the following Product " + code((_a = params === null || params === void 0 ? void 0 : params.product) === null || _a === void 0 ? void 0 : _a.name) + " however,\n you have used a generic " + glossaryTypeLink((_b = params === null || params === void 0 ? void 0 : params.term) === null || _b === void 0 ? void 0 : _b.termType) + " term " + code((_c = params === null || params === void 0 ? void 0 : params.term) === null || _c === void 0 ? void 0 : _c.name) + ".\n Use a more specific term for the " + glossaryTypeLink((_d = params === null || params === void 0 ? void 0 : params.term) === null || _d === void 0 ? void 0 : _d.termType) + " which reflects the specific " + glossaryTypeLink((_e = params === null || params === void 0 ? void 0 : params.product) === null || _e === void 0 ? void 0 : _e.termType) + ".";
|
|
5349
4922
|
},
|
|
5350
|
-
_f['is missing required bibliographic information'] = function () { return "The automatic bibliography search failed for this Bibliography. Either:\n 1) manually fill-in the <b>required</b> bibliographic information as per\n " + schemaLink(schema.SchemaType.Bibliography, 'our schema') + ".\n 2) provide the " + code('documentDOI') + " as well as the " + code('title') + "\n 3) check the " + code('documentDOI') + " and " + code('title') + " for typos against the\n " + externalLink('https://www.mendeley.com', 'Mendeley catalogue'); },
|
|
5351
|
-
_f['should be lower than max size'] = function (_f) {
|
|
5352
|
-
var params = _f.params;
|
|
5353
|
-
return "The boundary or region is >" + (params === null || params === void 0 ? void 0 : params.expected) + "km2 and is too large to reliably gap fill Measurements.";
|
|
4923
|
+
_f['is missing required bibliographic information'] = function () { return "The automatic bibliography search failed for this Bibliography. Either:\n 1) manually fill-in the <b>required</b> bibliographic information as per\n " + schemaLink(schema.SchemaType.Bibliography, 'our schema') + ".\n 2) provide the " + code('documentDOI') + " as well as the " + code('title') + "\n 3) check the " + code('documentDOI') + " and " + code('title') + " for typos against the\n " + externalLink('https://www.mendeley.com', 'Mendeley catalogue'); },
|
|
4924
|
+
_f['should be lower than max size'] = function (_f) {
|
|
4925
|
+
var params = _f.params;
|
|
4926
|
+
return "The boundary or region is >" + (params === null || params === void 0 ? void 0 : params.expected) + "km2 and is too large to reliably gap fill Measurements.";
|
|
4927
|
+
},
|
|
4928
|
+
_f['an excreta input is required when using an excretaManagement practice'] = function (_f) {
|
|
4929
|
+
var dataPath = _f.dataPath;
|
|
4930
|
+
var paths = parseDataPath(dataPath);
|
|
4931
|
+
return "Excreta management is the conversion of excreta to another type of excreta.\n You have added an excretaManagement Practice to this " + paths[0].label + " but there is no excreta Input.\n To represent excreta management, use a " + paths[0].label + " with excreta as an Input and excretaManagement as a Practice.";
|
|
4932
|
+
},
|
|
4933
|
+
_f['only 1 primary product allowed'] = function () { return 'There can only be one primary product in each Cycle.'; },
|
|
4934
|
+
_f['is not allowed in combination with noTillage'] = function () { return "This operation involves tillage, yet you have specified the Practice " + termLink(noTillage) + ".\n Either change this operation or the Practice."; },
|
|
4935
|
+
_f['should contain a tillage practice'] = function () { return "We recommend specifying the type of tillage used for this Cycle.\n Please see the " + glossaryTypeLink(schema.TermTermType.tillage) + " glossary."; },
|
|
4936
|
+
_f['must set value for every tillage practice'] = function () { return "Either specify a single " + glossaryTypeLink(schema.TermTermType.tillage) + " practice or add a value to all practices."; },
|
|
4937
|
+
_f['sum not equal to 100% for tillage practices'] = function () { return "The sum of " + glossaryTypeLink(schema.TermTermType.tillage) + " practices must equal 100%."; },
|
|
4938
|
+
_f['can only have 1 tillage practice without a value'] = function (_f) {
|
|
4939
|
+
var params = _f.params;
|
|
4940
|
+
var _a;
|
|
4941
|
+
return "It is not possible for a Cycle to have the following tillage Practices:\n " + ((_a = params === null || params === void 0 ? void 0 : params.current) !== null && _a !== void 0 ? _a : []).map(function (_f) {
|
|
4942
|
+
var name = _f.name;
|
|
4943
|
+
return name;
|
|
4944
|
+
}).join(' and ') + " at the same time.\n If multiple tillage practices did occur, please specify the percentage of area they occurred on.";
|
|
4945
|
+
},
|
|
4946
|
+
_f['can not be linked to the same Cycle'] = function () { return 'You can not link an Input to the Impact Assessment of the same Cycle.'; },
|
|
4947
|
+
_f['must be 0 for product value 0'] = function (_f, errorCount) {
|
|
4948
|
+
var dataPath = _f.dataPath, params = _f.params;
|
|
4949
|
+
return "If the amount produced is zero, the " + code(dataPath === null || dataPath === void 0 ? void 0 : dataPath.split('.').pop()) + " of " + (errorCount === 1 ? code(params === null || params === void 0 ? void 0 : params.term.name) : 'that product') + " must also be zero.";
|
|
4950
|
+
},
|
|
4951
|
+
_f);
|
|
4952
|
+
var formatCustomErrorMessage = function (message, error, errorCount) {
|
|
4953
|
+
if (errorCount === void 0) { errorCount = 1; }
|
|
4954
|
+
var formattedMessage = message && message in customErrorMessage ?
|
|
4955
|
+
customErrorMessage[message](error, errorCount) :
|
|
4956
|
+
message;
|
|
4957
|
+
return formattedMessage ? "<p class=\"is-normal\">" + formattedMessage + "</p>" : '';
|
|
4958
|
+
};
|
|
4959
|
+
var formatError = function (error, errorCount) {
|
|
4960
|
+
if (errorCount === void 0) { errorCount = 1; }
|
|
4961
|
+
return error ? (Object.assign(Object.assign({ level: 'error' }, error), { mapError: error.message === mapErrorMessage, message: formatCustomErrorMessage(error.message, error, errorCount) })) : undefined;
|
|
4962
|
+
};
|
|
4963
|
+
var errorHasError = function (error) { return error && (error.level === 'error' || !error.level); };
|
|
4964
|
+
var errorHasWarning = function (error) { return error && error.level === 'warning'; };
|
|
4965
|
+
var isMissingPropertyError = function (_f) {
|
|
4966
|
+
var params = _f.params;
|
|
4967
|
+
return !!params && 'missingProperty' in params;
|
|
4968
|
+
};
|
|
4969
|
+
var isMissingOneOfError = function (_f) {
|
|
4970
|
+
var keyword = _f.keyword, schemaPath = _f.schemaPath;
|
|
4971
|
+
return keyword === 'required' && (schemaPath || '').includes('oneOf');
|
|
4972
|
+
};
|
|
4973
|
+
var isFailingKeywordError = function (_f) {
|
|
4974
|
+
var params = _f.params;
|
|
4975
|
+
return !!params && 'failingKeyword' in params;
|
|
4976
|
+
};
|
|
4977
|
+
var filterError = function (error) { return [
|
|
4978
|
+
isFailingKeywordError
|
|
4979
|
+
].every(function (func) { return !func(error); }); };
|
|
4980
|
+
var missingNodeErrors = function (errors) { return errors.filter(function (_f) {
|
|
4981
|
+
var keyword = _f.keyword, params = _f.params;
|
|
4982
|
+
return keyword === 'required' && ((params === null || params === void 0 ? void 0 : params.missingProperty) === '@type' || (params === null || params === void 0 ? void 0 : params.missingProperty) === '@id');
|
|
4983
|
+
}); };
|
|
4984
|
+
|
|
4985
|
+
var _d;
|
|
4986
|
+
/* eslint-disable complexity */
|
|
4987
|
+
var get$1 = require('lodash.get');
|
|
4988
|
+
var ARRAY_DELIMITER = ';';
|
|
4989
|
+
var privateKeys = [
|
|
4990
|
+
'filepath'
|
|
4991
|
+
];
|
|
4992
|
+
var defaultSuggestionType = 'default';
|
|
4993
|
+
var stringValue = function (value) { return (typeof value === 'undefined' || value === null ? '' : value).toString(); };
|
|
4994
|
+
var nonExpandableArrayDataPath = function (key) { return key.replace(/\[\d+\]$/, ''); };
|
|
4995
|
+
var keyToDataPath = function (key) { return (key === null || key === void 0 ? void 0 : key.length) ? "." + key : ''; };
|
|
4996
|
+
var dataPathToKey = function (dataPath, trimArray) {
|
|
4997
|
+
if (trimArray === void 0) { trimArray = false; }
|
|
4998
|
+
return trimArray ? nonExpandableArrayDataPath(dataPath.substring(1)) : dataPath.substring(1);
|
|
4999
|
+
};
|
|
5000
|
+
var parentKey = function (key) {
|
|
5001
|
+
var keys = (key.startsWith('.') ? key.substring(1) : key).split('.');
|
|
5002
|
+
keys.pop();
|
|
5003
|
+
return keys.join('.');
|
|
5004
|
+
};
|
|
5005
|
+
/**
|
|
5006
|
+
* Sort properties having errors, type, id, ...properties (simple), and finally the groups
|
|
5007
|
+
*
|
|
5008
|
+
* @param a {INodeProperty}
|
|
5009
|
+
* @param b {INodeProperty}
|
|
5010
|
+
*/
|
|
5011
|
+
var sortProperties = function (a, b) {
|
|
5012
|
+
if (utils.isNumber(a.key) && utils.isNumber(b.key)) {
|
|
5013
|
+
return +a.key - +b.key;
|
|
5014
|
+
}
|
|
5015
|
+
if (a.isExpandable) {
|
|
5016
|
+
return b.isExpandable ? a.key.localeCompare(b.key) : 1;
|
|
5017
|
+
}
|
|
5018
|
+
if (b.isExpandable) {
|
|
5019
|
+
return -1;
|
|
5020
|
+
}
|
|
5021
|
+
if (!a.key) {
|
|
5022
|
+
return -1;
|
|
5023
|
+
}
|
|
5024
|
+
var aKey = a.key.replace('@', '');
|
|
5025
|
+
var bKey = b.key.replace('@', '');
|
|
5026
|
+
if (aKey === 'type') {
|
|
5027
|
+
return -1;
|
|
5028
|
+
}
|
|
5029
|
+
if (bKey === 'type') {
|
|
5030
|
+
return 1;
|
|
5031
|
+
}
|
|
5032
|
+
if (aKey === 'id' && bKey !== 'type') {
|
|
5033
|
+
return -1;
|
|
5034
|
+
}
|
|
5035
|
+
if (a.hasError || a.hasWarning) {
|
|
5036
|
+
return -1;
|
|
5037
|
+
}
|
|
5038
|
+
return a.key.localeCompare(b.key);
|
|
5039
|
+
};
|
|
5040
|
+
var defaultPropertyError = {
|
|
5041
|
+
max: function (_d) {
|
|
5042
|
+
var max = _d.max;
|
|
5043
|
+
return "should be <= " + max;
|
|
5044
|
+
},
|
|
5045
|
+
min: function (_d) {
|
|
5046
|
+
var min = _d.min;
|
|
5047
|
+
return "should be >= " + min;
|
|
5048
|
+
},
|
|
5049
|
+
pattern: function (_d) {
|
|
5050
|
+
var requiredPattern = _d.requiredPattern;
|
|
5051
|
+
return "should match pattern \"" + requiredPattern + "\"";
|
|
5052
|
+
},
|
|
5053
|
+
required: function (_e, _d) {
|
|
5054
|
+
var schemaType = _d.schemaType;
|
|
5055
|
+
return schemaType ? "should be set or linked to another " + schemaType : undefined;
|
|
5056
|
+
}
|
|
5057
|
+
};
|
|
5058
|
+
var formatPropertyError = function (errors, property) {
|
|
5059
|
+
var key = Object.keys(errors)[0];
|
|
5060
|
+
return key in defaultPropertyError ? formatCustomErrorMessage(defaultPropertyError[key](errors[key], property)) : '';
|
|
5061
|
+
};
|
|
5062
|
+
var hasError = function (value) { return Array.isArray(value) ? value.some(hasError) : value.hasError; };
|
|
5063
|
+
var hasWarning = function (value) { return Array.isArray(value) ? value.some(hasWarning) : value.hasWarning; };
|
|
5064
|
+
var compileSuggestionQueries = function (key, allOf) {
|
|
5065
|
+
var conditions = (allOf || [])
|
|
5066
|
+
.filter(function (v) { var _c; return (((_c = v.if) === null || _c === void 0 ? void 0 : _c.required) || []).includes(key); })
|
|
5067
|
+
.map(function (v) { var _c; return (_c = v.then) === null || _c === void 0 ? void 0 : _c.properties[key]; })
|
|
5068
|
+
.map(function (v) { var _c; return ((_c = v === null || v === void 0 ? void 0 : v.items) === null || _c === void 0 ? void 0 : _c.properties) || (v === null || v === void 0 ? void 0 : v.properties); })
|
|
5069
|
+
.filter(Boolean);
|
|
5070
|
+
return conditions.length ? [{
|
|
5071
|
+
bool: {
|
|
5072
|
+
should: conditions.flatMap(function (cond) { return Object.keys(cond).flatMap(function (k) { return (cond[k].enum || []).map(function (v) {
|
|
5073
|
+
var _d;
|
|
5074
|
+
return ({
|
|
5075
|
+
match: (_d = {}, _d[k] = v, _d)
|
|
5076
|
+
});
|
|
5077
|
+
}); }); }),
|
|
5078
|
+
minimum_should_match: 1
|
|
5079
|
+
}
|
|
5080
|
+
}] : [];
|
|
5081
|
+
};
|
|
5082
|
+
// default suggest for linking nodes together using the `id` field
|
|
5083
|
+
var suggestLinkNodes = function (type, fullKey) {
|
|
5084
|
+
var keys = fullKey.split('.');
|
|
5085
|
+
var key = keys.pop();
|
|
5086
|
+
return key === 'id' && keys.length >= 1 ? { type: type, isLinkNode: true } : undefined;
|
|
5087
|
+
};
|
|
5088
|
+
var suggestExistingNode = function (type, fullKey) {
|
|
5089
|
+
var keys = fullKey.split('.');
|
|
5090
|
+
var key = keys.pop();
|
|
5091
|
+
return keys.length >= 1 && ['@id', 'openLCAId'].includes(key) ? { type: type, isUniqueKey: '@id' } : undefined;
|
|
5092
|
+
};
|
|
5093
|
+
var defaultNodeTypeSuggestion = function (type) { return function (fullKey) { return suggestLinkNodes(type, fullKey) || suggestExistingNode(type, fullKey); }; };
|
|
5094
|
+
var termSuggestions = function (parent, _d) {
|
|
5095
|
+
var allOf = _d.allOf;
|
|
5096
|
+
return ({
|
|
5097
|
+
type: schema.NodeType.Term,
|
|
5098
|
+
queries: __spreadArray(__spreadArray([], __read(compileSuggestionQueries(nonExpandableArrayDataPath(parent), allOf))), __read((['country'].includes(parent) ? [matchCountry] : [])))
|
|
5099
|
+
});
|
|
5100
|
+
};
|
|
5101
|
+
var formatLinkNodesSuggestions = function (nodeMap, type) { return (nodeMap[type] || []).map(function (id) { return ({ type: type, id: id, name: "Link with " + type + ": " + id }); }); };
|
|
5102
|
+
var typeToSuggestion = (_d = {},
|
|
5103
|
+
_d[schema.NodeType.Actor] = defaultNodeTypeSuggestion(schema.NodeType.Actor),
|
|
5104
|
+
_d[schema.NodeType.Cycle] = defaultNodeTypeSuggestion(schema.NodeType.Cycle),
|
|
5105
|
+
_d[schema.NodeType.ImpactAssessment] = defaultNodeTypeSuggestion(schema.NodeType.ImpactAssessment),
|
|
5106
|
+
_d[schema.NodeType.Organisation] = defaultNodeTypeSuggestion(schema.NodeType.Organisation),
|
|
5107
|
+
_d[schema.NodeType.Site] = defaultNodeTypeSuggestion(schema.NodeType.Site),
|
|
5108
|
+
_d[schema.NodeType.Source] = defaultNodeTypeSuggestion(schema.NodeType.Source),
|
|
5109
|
+
_d[schema.NodeType.Term] = function (fullKey, parentSchema) {
|
|
5110
|
+
var keys = fullKey.split('.');
|
|
5111
|
+
var key = keys.pop();
|
|
5112
|
+
return ['name'].includes(key) && keys.length >= 1 ?
|
|
5113
|
+
termSuggestions(keys.pop(), parentSchema) :
|
|
5114
|
+
defaultNodeTypeSuggestion(schema.NodeType.Term)(fullKey);
|
|
5115
|
+
},
|
|
5116
|
+
_d[schema.SchemaType.Bibliography] = function (fullKey) {
|
|
5117
|
+
var keys = fullKey.split('.');
|
|
5118
|
+
var key = keys.pop();
|
|
5119
|
+
var parent = keys.pop();
|
|
5120
|
+
// prevent replacing a top-level source
|
|
5121
|
+
return ['title', 'documentDOI', 'scopus'].includes(key) && parent === 'bibliography' && keys.length >= 1 ? {
|
|
5122
|
+
type: schema.NodeType.Source,
|
|
5123
|
+
parentLevel: 1
|
|
5124
|
+
} : null;
|
|
5354
5125
|
},
|
|
5355
|
-
|
|
5356
|
-
var
|
|
5357
|
-
|
|
5358
|
-
|
|
5126
|
+
_d.number = function (_a, _b, schema) {
|
|
5127
|
+
var values = schema.const ? [schema.const] : [];
|
|
5128
|
+
return {
|
|
5129
|
+
type: values.length > 0 ? 'select' : defaultSuggestionType,
|
|
5130
|
+
// exclude suggesting SchemaType
|
|
5131
|
+
values: values
|
|
5132
|
+
};
|
|
5359
5133
|
},
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
var _a;
|
|
5368
|
-
return "It is not possible for a Cycle to have the following tillage Practices:\n " + ((_a = params === null || params === void 0 ? void 0 : params.current) !== null && _a !== void 0 ? _a : []).map(function (_f) {
|
|
5369
|
-
var name = _f.name;
|
|
5370
|
-
return name;
|
|
5371
|
-
}).join(' and ') + " at the same time.\n If multiple tillage practices did occur, please specify the percentage of area they occurred on.";
|
|
5134
|
+
_d.integer = function (_a, _b, schema) {
|
|
5135
|
+
var values = schema.const ? [schema.const] : [];
|
|
5136
|
+
return {
|
|
5137
|
+
type: values.length > 0 ? 'select' : defaultSuggestionType,
|
|
5138
|
+
// exclude suggesting SchemaType
|
|
5139
|
+
values: values
|
|
5140
|
+
};
|
|
5372
5141
|
},
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
var
|
|
5376
|
-
|
|
5142
|
+
_d.string = function (fullKey, _b, schema$1) {
|
|
5143
|
+
// exclude suggesting SchemaType
|
|
5144
|
+
var values = schema$1.const ?
|
|
5145
|
+
[schema$1.const] :
|
|
5146
|
+
(schema$1.enum || []).filter(function (val) { return !Object.values(schema.SchemaType).includes(val); });
|
|
5147
|
+
var key = fullKey.split('.').pop();
|
|
5148
|
+
return {
|
|
5149
|
+
type: values.length > 0 && key !== 'type' ? 'select' : defaultSuggestionType,
|
|
5150
|
+
values: values
|
|
5151
|
+
};
|
|
5377
5152
|
},
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5153
|
+
_d.boolean = function (_a) { return ({
|
|
5154
|
+
type: 'select',
|
|
5155
|
+
values: ['true', 'false']
|
|
5156
|
+
}); },
|
|
5157
|
+
_d);
|
|
5158
|
+
var enableSuggestions = function (parentSchema, type, fullKey, schema) {
|
|
5159
|
+
var suggestion = type in typeToSuggestion ? typeToSuggestion[type](fullKey, parentSchema) : null;
|
|
5160
|
+
return suggestion !== null ? suggestion : (schema && schema.type in typeToSuggestion ?
|
|
5161
|
+
typeToSuggestion[schema.type](fullKey, parentSchema, schema) :
|
|
5162
|
+
null);
|
|
5385
5163
|
};
|
|
5386
|
-
var
|
|
5387
|
-
|
|
5388
|
-
|
|
5164
|
+
var formatProperty = function (prop) { return (Object.assign(Object.assign({ '@type': schema.SchemaType.Property }, prop), { term: Object.assign({ '@type': schema.NodeType.Term }, prop.term) })); };
|
|
5165
|
+
var formatSuggestion = function (_c) {
|
|
5166
|
+
var defaultProperties = _c.defaultProperties, node = __rest(_c, ["defaultProperties"]);
|
|
5167
|
+
return (Object.assign(Object.assign({}, node), (defaultProperties ? { defaultProperties: defaultProperties.map(formatProperty) } : {})));
|
|
5389
5168
|
};
|
|
5390
|
-
var
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
var params = _f.params;
|
|
5394
|
-
return !!params && 'missingProperty' in params;
|
|
5169
|
+
var nodeAvailableProperties = function (node, _d) {
|
|
5170
|
+
var fullKey = _d.fullKey, schema = _d.schema, schemaType = _d.schemaType;
|
|
5171
|
+
return availableProperties(schema, schemaType, fullKey ? get$1(node, fullKey, {}) : node, fullKey.length > 0);
|
|
5395
5172
|
};
|
|
5396
|
-
var
|
|
5397
|
-
|
|
5398
|
-
return
|
|
5173
|
+
var isAddPropertyEnabled = function (node, schemaType, schema, fullKey) {
|
|
5174
|
+
if (fullKey === void 0) { fullKey = ''; }
|
|
5175
|
+
return !!schema &&
|
|
5176
|
+
!!Object.keys(nodeAvailableProperties(node, { fullKey: fullKey, schema: schema })).length &&
|
|
5177
|
+
(!fullKey || nestingTypeEnabled(schemaType));
|
|
5399
5178
|
};
|
|
5400
|
-
var
|
|
5401
|
-
|
|
5402
|
-
|
|
5179
|
+
var editableKey = function (key) { return !['type', '@type', 'termType'].includes(key); };
|
|
5180
|
+
var propertyId = function () { return uuid.v4(); };
|
|
5181
|
+
var propertyUrl = function (node, key) { return ['@id', 'name'].includes(key) && linkTypeEnabled(node['@type']) ?
|
|
5182
|
+
{
|
|
5183
|
+
url: baseUrl() + "/" + node['@type'].toLowerCase() + "/" + node['@id'],
|
|
5184
|
+
title: 'Open'
|
|
5185
|
+
} :
|
|
5186
|
+
(node.type === schema.SchemaType.Term && ['name'].includes(key) ? {
|
|
5187
|
+
url: baseUrl() + "/glossary?query=",
|
|
5188
|
+
urlParamValue: true,
|
|
5189
|
+
title: 'Search in Glossary'
|
|
5190
|
+
} : undefined); };
|
|
5191
|
+
var propertyMapsUrl = function (node, key, value) { return ['type'].includes(key) && [
|
|
5192
|
+
schema.SchemaType.Site.toString(),
|
|
5193
|
+
schema.SchemaType.Organisation.toString()
|
|
5194
|
+
].includes(stringValue(value) || node.type) ?
|
|
5195
|
+
{
|
|
5196
|
+
url: mapsUrl({ lat: node.latitude, lng: node.longitude }),
|
|
5197
|
+
title: 'View on maps',
|
|
5198
|
+
icon: 'map'
|
|
5199
|
+
} :
|
|
5200
|
+
undefined; };
|
|
5201
|
+
var propertyExternalUrl = function (node, key, value) { return propertyUrl(node, key) ||
|
|
5202
|
+
propertyMapsUrl(node, key, value); };
|
|
5203
|
+
var arrayPlaceholder = function (valueType) { return "Type a " + valueType + " then press Enter"; };
|
|
5204
|
+
var defaultPlaceholder = function (_d, valueType) {
|
|
5205
|
+
var type = _d.type, examples = _d.examples;
|
|
5206
|
+
return (examples === null || examples === void 0 ? void 0 : examples.length) ? (Array.isArray(examples[0]) ? arrayPlaceholder(valueType) : examples[0]) : "Must be of type " + (type || valueType);
|
|
5207
|
+
};
|
|
5208
|
+
var schemaPlacholder = function (schema, fullKey) {
|
|
5209
|
+
var _d = __read(fullKey.split('.')), parent = _d[0], keys = _d.slice(1);
|
|
5210
|
+
var properties = schema.properties || {};
|
|
5211
|
+
var examples = (parent in properties ? properties[parent] : { examples: [] }).examples;
|
|
5212
|
+
return (examples === null || examples === void 0 ? void 0 : examples.length) && typeof examples[0] === 'object' ? get$1(examples[0], keys.join('.'), null) : null;
|
|
5213
|
+
};
|
|
5214
|
+
var propertyPlaceholder = function (schema, valueType, fullKey, parentSchema) {
|
|
5215
|
+
if (fullKey === void 0) { fullKey = ''; }
|
|
5216
|
+
return schema.type === 'array' ?
|
|
5217
|
+
arrayPlaceholder(valueType) : (parentSchema && (fullKey === null || fullKey === void 0 ? void 0 : fullKey.length) ? schemaPlacholder(parentSchema, fullKey) : null) || defaultPlaceholder(schema, valueType);
|
|
5218
|
+
};
|
|
5219
|
+
var propertyTypeValue = {
|
|
5220
|
+
object: function (val) { return safeJSONStringify(val); },
|
|
5221
|
+
array: function (val, schema) {
|
|
5222
|
+
var items = schema.items;
|
|
5223
|
+
return '$ref' in items ? val : (Array.isArray(val) ?
|
|
5224
|
+
val.map(function (value) { return propertyValue(items, value); }).join(ARRAY_DELIMITER) :
|
|
5225
|
+
val);
|
|
5226
|
+
},
|
|
5227
|
+
json: function (val) { return val || ''; },
|
|
5228
|
+
string: function (val) { return ("" + val || '').trim(); },
|
|
5229
|
+
number: function (val) { return +("" + val || '0'); },
|
|
5230
|
+
integer: function (val) { return +("" + val || '0'); },
|
|
5231
|
+
boolean: function (val) { return ("" + val || '').toLowerCase() === 'true'; }
|
|
5232
|
+
};
|
|
5233
|
+
var propertyValue = function (schema, value) { return schema.type ? (Array.isArray(schema.type) ?
|
|
5234
|
+
propertyTypeValue[typeof value](value, schema) :
|
|
5235
|
+
propertyTypeValue[schema.type](value, schema)) :
|
|
5236
|
+
safeJSONStringify(value); };
|
|
5237
|
+
var propertyValueType = function (schema, value) { return (schema.type ? (Array.isArray(schema.type) ?
|
|
5238
|
+
schema.type[0] :
|
|
5239
|
+
schema.type === 'array' ?
|
|
5240
|
+
propertyValueType(Object.assign(Object.assign({}, schema), { type: [schema.items.type] })) :
|
|
5241
|
+
schema.type) : typeof value); };
|
|
5242
|
+
var propertyTypeParseValue = {
|
|
5243
|
+
object: function (val) { return safeJSONParse(val); },
|
|
5244
|
+
array: function (val, schema) {
|
|
5245
|
+
var items = schema.items;
|
|
5246
|
+
return '$ref' in items ? val : (!val || Array.isArray(val) ? val : val.split(ARRAY_DELIMITER).map(function (value) { return parseNewValue(items, value); }));
|
|
5247
|
+
},
|
|
5248
|
+
json: function (val) { return val || ''; },
|
|
5249
|
+
string: function (val) { return ("" + val || '').trim(); },
|
|
5250
|
+
number: function (val) { return +("" + val || '0'); },
|
|
5251
|
+
integer: function (val) { return +("" + val || '0'); },
|
|
5252
|
+
boolean: function (val) { return ("" + val || '').toLowerCase() === 'true'; }
|
|
5253
|
+
};
|
|
5254
|
+
/**
|
|
5255
|
+
* Convert value to the final type in the schema.
|
|
5256
|
+
*
|
|
5257
|
+
* @param schema Definition of the value.
|
|
5258
|
+
* @param value
|
|
5259
|
+
* @returns Value in the correct format.
|
|
5260
|
+
*/
|
|
5261
|
+
var parseNewValue = function (schema, value) { return schema.type ? (Array.isArray(schema.type) ?
|
|
5262
|
+
propertyTypeParseValue[typeof value](value, schema) :
|
|
5263
|
+
propertyTypeParseValue[schema.type](value, schema)) : value; };
|
|
5264
|
+
var isOpenDefault = function (schemaType) { return [
|
|
5265
|
+
schema.SchemaType.Term
|
|
5266
|
+
].includes(schemaType); };
|
|
5267
|
+
// can the property be seen when the group is closed
|
|
5268
|
+
var isKeyClosedVisible = function (key) { return ['type', 'id', '@type', '@id'].includes(key); };
|
|
5269
|
+
var isKeyHidden = function (key) { return ['type', '@type'].includes(key); };
|
|
5270
|
+
var isKeyRequired = function (key, def) { return ['type', 'id'].includes(key) || ((def === null || def === void 0 ? void 0 : def.required) || []).includes(key); };
|
|
5271
|
+
var propertyError = function (errors) { return function (dataPath, nonExpandableArray) {
|
|
5272
|
+
if (nonExpandableArray === void 0) { nonExpandableArray = false; }
|
|
5273
|
+
return errors.find(function (error) { return (error.dataPath === dataPath || (nonExpandableArray && nonExpandableArrayDataPath(error.dataPath) === nonExpandableArrayDataPath(dataPath))) && (dataPath.length > 0 || !isMissingPropertyError(error)); });
|
|
5274
|
+
}; };
|
|
5275
|
+
var missingPropertyErrors = function (node, errors, parent) {
|
|
5276
|
+
if (parent === void 0) { parent = ''; }
|
|
5277
|
+
var allErrors = errors.filter(function (error) { return error.dataPath === keyToDataPath(parent) && isMissingPropertyError(error); });
|
|
5278
|
+
// check for node not found errors
|
|
5279
|
+
var missingNode = missingNodeErrors(allErrors);
|
|
5280
|
+
return missingNode.length === 2 ? [{
|
|
5281
|
+
id: propertyId(),
|
|
5282
|
+
schemaType: node.type,
|
|
5283
|
+
suggestions: { type: defaultSuggestionType },
|
|
5284
|
+
key: '',
|
|
5285
|
+
fullKey: parent,
|
|
5286
|
+
value: '',
|
|
5287
|
+
error: {
|
|
5288
|
+
level: 'error',
|
|
5289
|
+
message: missingNodeErrorMessage(node)
|
|
5290
|
+
},
|
|
5291
|
+
hasError: true,
|
|
5292
|
+
properties: [],
|
|
5293
|
+
addPropertyEnabled: false
|
|
5294
|
+
}] : allErrors.map(function (error) {
|
|
5295
|
+
var missingProperty = error.params.missingProperty;
|
|
5296
|
+
var fullKey = parent ? parent + "." + missingProperty : missingProperty;
|
|
5297
|
+
var missingOneOf = isMissingOneOfError(error);
|
|
5298
|
+
return {
|
|
5299
|
+
id: propertyId(),
|
|
5300
|
+
schemaType: node.type,
|
|
5301
|
+
suggestions: { type: defaultSuggestionType },
|
|
5302
|
+
key: missingProperty,
|
|
5303
|
+
fullKey: fullKey,
|
|
5304
|
+
value: 'Add field to fix',
|
|
5305
|
+
editable: false,
|
|
5306
|
+
error: formatError(error),
|
|
5307
|
+
hasError: missingOneOf ? false : errorHasError(error),
|
|
5308
|
+
hasWarning: missingOneOf || errorHasWarning(error),
|
|
5309
|
+
properties: [],
|
|
5310
|
+
addPropertyEnabled: true
|
|
5311
|
+
};
|
|
5312
|
+
});
|
|
5403
5313
|
};
|
|
5404
|
-
var
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5314
|
+
var propertyFromNode = function (schemas, errors, nodeSchema, deepEditable, parent, node) {
|
|
5315
|
+
if (parent === void 0) { parent = ''; }
|
|
5316
|
+
return function (key) {
|
|
5317
|
+
var value = node[key];
|
|
5318
|
+
var expandable = schema.isExpandable(value);
|
|
5319
|
+
var isArray = Array.isArray(value);
|
|
5320
|
+
var nonExpandableArray = isArray && !expandable;
|
|
5321
|
+
var fullKey = Array.isArray(node) ? parent + "[" + key + "]" : [
|
|
5322
|
+
parent,
|
|
5323
|
+
key
|
|
5324
|
+
].filter(Boolean).join('.');
|
|
5325
|
+
var nodeType = node.type || node['@type'];
|
|
5326
|
+
var schemaType = expandable ? (isArray && value.length ? value[0].type || value[0]['@type'] : value.type || value['@type']) : nodeType;
|
|
5327
|
+
var schema$1 = (schemas && schema.isTypeValid({ type: schemaType }) ? (expandable ? schemas[schemaType] : schemas[schemaType].properties[key]) : null) || {};
|
|
5328
|
+
var isIri = isSchemaIri(schema$1);
|
|
5329
|
+
var error = propertyError(errors)(keyToDataPath(fullKey), nonExpandableArray);
|
|
5330
|
+
var parentSchema = expandable ? (
|
|
5331
|
+
// TODO: for non-array, should be schema unless last recursion
|
|
5332
|
+
isArray ? schema$1 : nodeSchema) : nodeSchema;
|
|
5333
|
+
var properties = expandable || isIri ?
|
|
5334
|
+
recursiveProperties(schemas, errors, parentSchema, deepEditable, fullKey)(value) : [];
|
|
5335
|
+
var inError = errorHasError(error) || hasError(properties);
|
|
5336
|
+
var inWarning = errorHasWarning(error) || hasWarning(properties);
|
|
5337
|
+
var editable = schema.isTypeNode(node['@type']) || (expandable && schema.isTypeNode(value['@type'])) ?
|
|
5338
|
+
false :
|
|
5339
|
+
(
|
|
5340
|
+
// prevent editing/adding new properties on existing sub-nodes
|
|
5341
|
+
!deepEditable && schema.isTypeNode(schemaType) && (expandable ? value.type !== schema.NodeType.Term : parent && node.type !== schema.NodeType.Term) ?
|
|
5342
|
+
false :
|
|
5343
|
+
// handle IRI
|
|
5344
|
+
(!schemaType && key === '@id') || editableKey(key));
|
|
5345
|
+
var valueType = propertyValueType(schema$1, value);
|
|
5346
|
+
return {
|
|
5347
|
+
id: propertyId(),
|
|
5348
|
+
schemaType: isIri ? null : schemaType,
|
|
5349
|
+
schema: schema$1,
|
|
5350
|
+
key: key,
|
|
5351
|
+
fullKey: fullKey,
|
|
5352
|
+
value: propertyValue(schema$1, value),
|
|
5353
|
+
editable: inError || editable,
|
|
5354
|
+
suggestions: enableSuggestions(nodeSchema, node.type, fullKey, schema$1),
|
|
5355
|
+
addPropertyEnabled: isAddPropertyEnabled(node, schemaType, schema$1, fullKey),
|
|
5356
|
+
newProperty: {},
|
|
5357
|
+
newError: { level: 'warning' },
|
|
5358
|
+
error: formatError(error),
|
|
5359
|
+
isHidden: parent && isKeyHidden(key),
|
|
5360
|
+
closedVisible: isKeyClosedVisible(key),
|
|
5361
|
+
hasError: inError,
|
|
5362
|
+
hasWarning: inWarning,
|
|
5363
|
+
isRequired: isKeyRequired(key, schemas[nodeType]),
|
|
5364
|
+
isArray: isArray,
|
|
5365
|
+
isExpandable: expandable,
|
|
5366
|
+
isOpen: isOpenDefault(schemaType),
|
|
5367
|
+
properties: properties,
|
|
5368
|
+
placeholder: propertyPlaceholder(schema$1, valueType, fullKey, parentSchema),
|
|
5369
|
+
externalUrl: propertyExternalUrl(node, key, value)
|
|
5370
|
+
};
|
|
5371
|
+
};
|
|
5426
5372
|
};
|
|
5427
|
-
var
|
|
5428
|
-
var
|
|
5429
|
-
keys.pop();
|
|
5430
|
-
|
|
5373
|
+
var singleProperty = function (schemas, errors, node, fullKey) {
|
|
5374
|
+
var _d = __read(fullKey.split('.')), _t = _d[0], keys = _d.slice(1);
|
|
5375
|
+
var key = keys.pop();
|
|
5376
|
+
var parent = keys.join('.');
|
|
5377
|
+
var parentNode = parent.length ? get$1(node, parent) : node;
|
|
5378
|
+
var schemaType = schema.typeToSchemaType(parentNode.type || parentNode['@type']);
|
|
5379
|
+
var parentSchema = schemas[schemaType];
|
|
5380
|
+
return propertyFromNode(schemas, errors, parentSchema, true, parent, parentNode)(key);
|
|
5431
5381
|
};
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
}
|
|
5442
|
-
if (a.isExpandable) {
|
|
5443
|
-
return b.isExpandable ? a.key.localeCompare(b.key) : 1;
|
|
5444
|
-
}
|
|
5445
|
-
if (b.isExpandable) {
|
|
5446
|
-
return -1;
|
|
5447
|
-
}
|
|
5448
|
-
if (!a.key) {
|
|
5449
|
-
return -1;
|
|
5450
|
-
}
|
|
5451
|
-
var aKey = a.key.replace('@', '');
|
|
5452
|
-
var bKey = b.key.replace('@', '');
|
|
5453
|
-
if (aKey === 'type') {
|
|
5454
|
-
return -1;
|
|
5455
|
-
}
|
|
5456
|
-
if (bKey === 'type') {
|
|
5457
|
-
return 1;
|
|
5458
|
-
}
|
|
5459
|
-
if (aKey === 'id' && bKey !== 'type') {
|
|
5460
|
-
return -1;
|
|
5461
|
-
}
|
|
5462
|
-
if (a.hasError || a.hasWarning) {
|
|
5463
|
-
return -1;
|
|
5464
|
-
}
|
|
5465
|
-
return a.key.localeCompare(b.key);
|
|
5382
|
+
var recursiveProperties = function (schemas, errors, nodeSchema, deepEditable, parent) {
|
|
5383
|
+
if (parent === void 0) { parent = ''; }
|
|
5384
|
+
return function (node) {
|
|
5385
|
+
var _d;
|
|
5386
|
+
return (_d = Object.keys(node)
|
|
5387
|
+
.filter(function (key) { return !privateKeys.includes(key); })
|
|
5388
|
+
.map(propertyFromNode(schemas, errors, nodeSchema, deepEditable, parent, node)))
|
|
5389
|
+
.concat.apply(_d, __spreadArray([], __read(missingPropertyErrors(node, errors, parent)))).sort(sortProperties);
|
|
5390
|
+
};
|
|
5466
5391
|
};
|
|
5467
|
-
var
|
|
5468
|
-
|
|
5469
|
-
var
|
|
5470
|
-
return
|
|
5471
|
-
},
|
|
5472
|
-
min: function (_d) {
|
|
5473
|
-
var min = _d.min;
|
|
5474
|
-
return "should be >= " + min;
|
|
5475
|
-
},
|
|
5476
|
-
pattern: function (_d) {
|
|
5477
|
-
var requiredPattern = _d.requiredPattern;
|
|
5478
|
-
return "should match pattern \"" + requiredPattern + "\"";
|
|
5479
|
-
},
|
|
5480
|
-
required: function (_e, _d) {
|
|
5481
|
-
var schemaType = _d.schemaType;
|
|
5482
|
-
return schemaType ? "should be set or linked to another " + schemaType : undefined;
|
|
5392
|
+
var fullKeyParts = function (fullKey) { return fullKey.split('.').flatMap(function (val) {
|
|
5393
|
+
if (val.endsWith(']')) {
|
|
5394
|
+
var _d = __read(val.split('['), 2), key = _d[0], index = _d[1];
|
|
5395
|
+
return [key, index.replace(']', '')];
|
|
5483
5396
|
}
|
|
5397
|
+
return val;
|
|
5398
|
+
}); };
|
|
5399
|
+
var updateProperties = function (_d, updater) {
|
|
5400
|
+
var properties = _d.properties;
|
|
5401
|
+
return (properties || []).map(function (prop) { return updateProperties(updater(prop), updater); });
|
|
5484
5402
|
};
|
|
5485
|
-
var
|
|
5486
|
-
var key =
|
|
5487
|
-
|
|
5403
|
+
var typeToNewProperty = function (schemas, schema, nodeSchema, node, fullKey) {
|
|
5404
|
+
var key = fullKeyParts(fullKey).pop();
|
|
5405
|
+
var mappings = {
|
|
5406
|
+
object: function () {
|
|
5407
|
+
var _d = schemaRequiredProperties(schemas, schema), schemaType = _d.schemaType, properties = _d.properties;
|
|
5408
|
+
node[key] = node[key] || {};
|
|
5409
|
+
node[key].type = schemaType;
|
|
5410
|
+
// TODO: handle load schemas from http source
|
|
5411
|
+
if (schemaType.startsWith('http')) {
|
|
5412
|
+
return typeToNewProperty(schemas, { type: 'json' }, nodeSchema, node, fullKey);
|
|
5413
|
+
}
|
|
5414
|
+
// TODO: handle nodeSchema should be schema unless last recursion
|
|
5415
|
+
var props = properties
|
|
5416
|
+
.filter(function (prop) { return nestingEnabled(schemaType, prop.key) && !!prop.value; })
|
|
5417
|
+
.map(function (v) { return (Object.assign(Object.assign({}, typeToNewProperty(schemas, v.value, nodeSchema, node[key], fullKey + "." + v.key)), { isRequired: true })); });
|
|
5418
|
+
var value = props.reduce(function (prev, curr) {
|
|
5419
|
+
var _d;
|
|
5420
|
+
return (Object.assign(Object.assign({}, prev), (_d = {}, _d[curr.key] = curr.value, _d)));
|
|
5421
|
+
}, {});
|
|
5422
|
+
return {
|
|
5423
|
+
id: propertyId(),
|
|
5424
|
+
isAdded: true,
|
|
5425
|
+
schema: schemas[schemaType],
|
|
5426
|
+
schemaType: schemaType,
|
|
5427
|
+
key: key,
|
|
5428
|
+
fullKey: fullKey,
|
|
5429
|
+
value: value,
|
|
5430
|
+
editable: editableKey(key),
|
|
5431
|
+
isHidden: isKeyHidden(key),
|
|
5432
|
+
closedVisible: isKeyClosedVisible(key),
|
|
5433
|
+
suggestions: enableSuggestions(nodeSchema, schemaType, fullKey),
|
|
5434
|
+
properties: props.sort(sortProperties),
|
|
5435
|
+
addPropertyEnabled: isAddPropertyEnabled(node, schemaType, schemas[schemaType], key),
|
|
5436
|
+
newProperty: {},
|
|
5437
|
+
newError: { level: 'warning' },
|
|
5438
|
+
isRequired: isKeyRequired(key, schema),
|
|
5439
|
+
isArray: false,
|
|
5440
|
+
isExpandable: true,
|
|
5441
|
+
isOpen: isOpenDefault(schemaType)
|
|
5442
|
+
};
|
|
5443
|
+
},
|
|
5444
|
+
array: function () {
|
|
5445
|
+
var items = schema.items;
|
|
5446
|
+
// array of string, number and boolean
|
|
5447
|
+
if (items.type) {
|
|
5448
|
+
return mappings.default();
|
|
5449
|
+
}
|
|
5450
|
+
var schemaType = definitionToSchemaType(items);
|
|
5451
|
+
node[key] = node[key] || [];
|
|
5452
|
+
node[key].push({});
|
|
5453
|
+
var property = typeToNewProperty(schemas, items, schemas[schemaType], node[key][0], fullKey + "[0]");
|
|
5454
|
+
return {
|
|
5455
|
+
id: propertyId(),
|
|
5456
|
+
isAdded: true,
|
|
5457
|
+
schema: schema,
|
|
5458
|
+
schemaType: schemaType,
|
|
5459
|
+
key: key,
|
|
5460
|
+
fullKey: fullKey,
|
|
5461
|
+
value: [property.value],
|
|
5462
|
+
editable: editableKey(key),
|
|
5463
|
+
isHidden: isKeyHidden(key),
|
|
5464
|
+
closedVisible: isKeyClosedVisible(key),
|
|
5465
|
+
suggestions: undefined,
|
|
5466
|
+
properties: [property],
|
|
5467
|
+
newProperty: {},
|
|
5468
|
+
newError: { level: 'warning' },
|
|
5469
|
+
isArray: true,
|
|
5470
|
+
isExpandable: true,
|
|
5471
|
+
addPropertyEnabled: false
|
|
5472
|
+
};
|
|
5473
|
+
},
|
|
5474
|
+
default: function () {
|
|
5475
|
+
var valueType = propertyValueType(schema);
|
|
5476
|
+
var value = schema.default || schema.const || valueTypeToDefault[valueType];
|
|
5477
|
+
node[key] = value;
|
|
5478
|
+
return {
|
|
5479
|
+
id: propertyId(),
|
|
5480
|
+
isAdded: true,
|
|
5481
|
+
schema: schema,
|
|
5482
|
+
schemaType: node.type,
|
|
5483
|
+
key: key,
|
|
5484
|
+
fullKey: fullKey,
|
|
5485
|
+
value: propertyValue(schema, value),
|
|
5486
|
+
editable: editableKey(key),
|
|
5487
|
+
isHidden: isKeyHidden(key),
|
|
5488
|
+
closedVisible: isKeyClosedVisible(key),
|
|
5489
|
+
suggestions: enableSuggestions(nodeSchema, node.type, fullKey, schema),
|
|
5490
|
+
placeholder: propertyPlaceholder(schema, valueType, fullKey, nodeSchema),
|
|
5491
|
+
externalUrl: propertyExternalUrl(node, key, value),
|
|
5492
|
+
properties: [],
|
|
5493
|
+
addPropertyEnabled: false
|
|
5494
|
+
};
|
|
5495
|
+
}
|
|
5496
|
+
};
|
|
5497
|
+
var mapped = !schema.type ? mappings.object : (schema.type in mappings ? mappings[schema.type] : mappings.default);
|
|
5498
|
+
return mapped();
|
|
5488
5499
|
};
|
|
5489
|
-
var
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
.filter(Boolean);
|
|
5497
|
-
return conditions.length ? [{
|
|
5498
|
-
bool: {
|
|
5499
|
-
should: conditions.flatMap(function (cond) { return Object.keys(cond).flatMap(function (k) { return (cond[k].enum || []).map(function (v) {
|
|
5500
|
-
var _d;
|
|
5501
|
-
return ({
|
|
5502
|
-
match: (_d = {}, _d[k] = v, _d)
|
|
5503
|
-
});
|
|
5504
|
-
}); }); }),
|
|
5505
|
-
minimum_should_match: 1
|
|
5500
|
+
var findProperty = function (properties, fullKey) {
|
|
5501
|
+
var e_1, _d;
|
|
5502
|
+
try {
|
|
5503
|
+
for (var properties_1 = __values(properties), properties_1_1 = properties_1.next(); !properties_1_1.done; properties_1_1 = properties_1.next()) {
|
|
5504
|
+
var p = properties_1_1.value;
|
|
5505
|
+
if (p.fullKey === fullKey) {
|
|
5506
|
+
return p;
|
|
5506
5507
|
}
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5508
|
+
var childP = findProperty(p.properties, fullKey);
|
|
5509
|
+
if (childP) {
|
|
5510
|
+
return childP;
|
|
5511
|
+
}
|
|
5512
|
+
}
|
|
5513
|
+
}
|
|
5514
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
5515
|
+
finally {
|
|
5516
|
+
try {
|
|
5517
|
+
if (properties_1_1 && !properties_1_1.done && (_d = properties_1.return)) _d.call(properties_1);
|
|
5518
|
+
}
|
|
5519
|
+
finally { if (e_1) throw e_1.error; }
|
|
5520
|
+
}
|
|
5521
|
+
return null;
|
|
5514
5522
|
};
|
|
5515
|
-
var
|
|
5516
|
-
var
|
|
5517
|
-
var
|
|
5518
|
-
|
|
5523
|
+
var parentProperty = function (properties, property) {
|
|
5524
|
+
var _c;
|
|
5525
|
+
var allKeys = property.fullKey.split('.');
|
|
5526
|
+
__spreadArray([], __read(new Array(((_c = property.suggestions) === null || _c === void 0 ? void 0 : _c.parentLevel) || 0))).map(function () { return allKeys.pop(); });
|
|
5527
|
+
var parentKeys = fullKeyParts(allKeys.join('.'));
|
|
5528
|
+
parentKeys.pop();
|
|
5529
|
+
var parent = parentKeys.reduce(function (prev, curr, currIndex) {
|
|
5530
|
+
var prop = prev.find(function (v) { return v.key === curr; });
|
|
5531
|
+
return currIndex === parentKeys.length - 1 ? (prop || {}) : (prop.properties || []);
|
|
5532
|
+
}, properties);
|
|
5533
|
+
return Array.isArray(parent) ? property : parent;
|
|
5519
5534
|
};
|
|
5520
|
-
var
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
queries: __spreadArray(__spreadArray([], __read(compileSuggestionQueries(nonExpandableArrayDataPath(parent), allOf))), __read((['country'].includes(parent) ? [matchCountry] : [])))
|
|
5535
|
+
var nestedProperty = function (_d, nestedKey) {
|
|
5536
|
+
var properties = _d.properties;
|
|
5537
|
+
return properties.find(function (_d) {
|
|
5538
|
+
var key = _d.key;
|
|
5539
|
+
return key === nestedKey;
|
|
5526
5540
|
});
|
|
5527
5541
|
};
|
|
5528
|
-
var
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
_d[schema.NodeType.ImpactAssessment] = defaultNodeTypeSuggestion(schema.NodeType.ImpactAssessment),
|
|
5533
|
-
_d[schema.NodeType.Organisation] = defaultNodeTypeSuggestion(schema.NodeType.Organisation),
|
|
5534
|
-
_d[schema.NodeType.Site] = defaultNodeTypeSuggestion(schema.NodeType.Site),
|
|
5535
|
-
_d[schema.NodeType.Source] = defaultNodeTypeSuggestion(schema.NodeType.Source),
|
|
5536
|
-
_d[schema.NodeType.Term] = function (fullKey, parentSchema) {
|
|
5537
|
-
var keys = fullKey.split('.');
|
|
5538
|
-
var key = keys.pop();
|
|
5539
|
-
return ['name'].includes(key) && keys.length >= 1 ?
|
|
5540
|
-
termSuggestions(keys.pop(), parentSchema) :
|
|
5541
|
-
defaultNodeTypeSuggestion(schema.NodeType.Term)(fullKey);
|
|
5542
|
-
},
|
|
5543
|
-
_d[schema.SchemaType.Bibliography] = function (fullKey) {
|
|
5544
|
-
var keys = fullKey.split('.');
|
|
5545
|
-
var key = keys.pop();
|
|
5546
|
-
var parent = keys.pop();
|
|
5547
|
-
// prevent replacing a top-level source
|
|
5548
|
-
return ['title', 'documentDOI', 'scopus'].includes(key) && parent === 'bibliography' && keys.length >= 1 ? {
|
|
5549
|
-
type: schema.NodeType.Source,
|
|
5550
|
-
parentLevel: 1
|
|
5551
|
-
} : null;
|
|
5552
|
-
},
|
|
5553
|
-
_d.number = function (_a, _b, schema) {
|
|
5554
|
-
var values = schema.const ? [schema.const] : [];
|
|
5555
|
-
return {
|
|
5556
|
-
type: values.length > 0 ? 'select' : defaultSuggestionType,
|
|
5557
|
-
// exclude suggesting SchemaType
|
|
5558
|
-
values: values
|
|
5559
|
-
};
|
|
5560
|
-
},
|
|
5561
|
-
_d.integer = function (_a, _b, schema) {
|
|
5562
|
-
var values = schema.const ? [schema.const] : [];
|
|
5563
|
-
return {
|
|
5564
|
-
type: values.length > 0 ? 'select' : defaultSuggestionType,
|
|
5565
|
-
// exclude suggesting SchemaType
|
|
5566
|
-
values: values
|
|
5567
|
-
};
|
|
5568
|
-
},
|
|
5569
|
-
_d.string = function (fullKey, _b, schema$1) {
|
|
5570
|
-
// exclude suggesting SchemaType
|
|
5571
|
-
var values = schema$1.const ?
|
|
5572
|
-
[schema$1.const] :
|
|
5573
|
-
(schema$1.enum || []).filter(function (val) { return !Object.values(schema.SchemaType).includes(val); });
|
|
5574
|
-
var key = fullKey.split('.').pop();
|
|
5575
|
-
return {
|
|
5576
|
-
type: values.length > 0 && key !== 'type' ? 'select' : defaultSuggestionType,
|
|
5577
|
-
values: values
|
|
5578
|
-
};
|
|
5579
|
-
},
|
|
5580
|
-
_d.boolean = function (_a) { return ({
|
|
5581
|
-
type: 'select',
|
|
5582
|
-
values: ['true', 'false']
|
|
5583
|
-
}); },
|
|
5584
|
-
_d);
|
|
5585
|
-
var enableSuggestions = function (parentSchema, type, fullKey, schema) {
|
|
5586
|
-
var suggestion = type in typeToSuggestion ? typeToSuggestion[type](fullKey, parentSchema) : null;
|
|
5587
|
-
return suggestion !== null ? suggestion : (schema && schema.type in typeToSuggestion ?
|
|
5588
|
-
typeToSuggestion[schema.type](fullKey, parentSchema, schema) :
|
|
5589
|
-
null);
|
|
5590
|
-
};
|
|
5591
|
-
var formatProperty = function (prop) { return (Object.assign(Object.assign({ '@type': schema.SchemaType.Property }, prop), { term: Object.assign({ '@type': schema.NodeType.Term }, prop.term) })); };
|
|
5592
|
-
var formatSuggestion = function (_c) {
|
|
5593
|
-
var defaultProperties = _c.defaultProperties, node = __rest(_c, ["defaultProperties"]);
|
|
5594
|
-
return (Object.assign(Object.assign({}, node), (defaultProperties ? { defaultProperties: defaultProperties.map(formatProperty) } : {})));
|
|
5595
|
-
};
|
|
5596
|
-
var nodeAvailableProperties = function (node, _d) {
|
|
5597
|
-
var fullKey = _d.fullKey, schema = _d.schema, schemaType = _d.schemaType;
|
|
5598
|
-
return availableProperties(schema, schemaType, fullKey ? get$1(node, fullKey, {}) : node, fullKey.length > 0);
|
|
5599
|
-
};
|
|
5600
|
-
var isAddPropertyEnabled = function (node, schemaType, schema, fullKey) {
|
|
5601
|
-
if (fullKey === void 0) { fullKey = ''; }
|
|
5602
|
-
return !!schema &&
|
|
5603
|
-
!!Object.keys(nodeAvailableProperties(node, { fullKey: fullKey, schema: schema })).length &&
|
|
5604
|
-
(!fullKey || nestingTypeEnabled(schemaType));
|
|
5542
|
+
var siblingProperty = function (properties, property, siblingKey) {
|
|
5543
|
+
var parent = parentProperty(properties, property);
|
|
5544
|
+
var parentProperties = parent === property ? properties : parent.properties;
|
|
5545
|
+
return parentProperties.find(function (prop) { return prop.key === siblingKey; });
|
|
5605
5546
|
};
|
|
5606
|
-
var
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
].includes(stringValue(value) || node.type) ?
|
|
5622
|
-
{
|
|
5623
|
-
url: mapsUrl({ lat: node.latitude, lng: node.longitude }),
|
|
5624
|
-
title: 'View on maps',
|
|
5625
|
-
icon: 'map'
|
|
5626
|
-
} :
|
|
5627
|
-
undefined; };
|
|
5628
|
-
var propertyExternalUrl = function (node, key, value) { return propertyUrl(node, key) ||
|
|
5629
|
-
propertyMapsUrl(node, key, value); };
|
|
5630
|
-
var arrayPlaceholder = function (valueType) { return "Type a " + valueType + " then press Enter"; };
|
|
5631
|
-
var defaultPlaceholder = function (_d, valueType) {
|
|
5632
|
-
var type = _d.type, examples = _d.examples;
|
|
5633
|
-
return (examples === null || examples === void 0 ? void 0 : examples.length) ? (Array.isArray(examples[0]) ? arrayPlaceholder(valueType) : examples[0]) : "Must be of type " + (type || valueType);
|
|
5547
|
+
var groupChanged = function (properties, key, value) {
|
|
5548
|
+
try {
|
|
5549
|
+
var parentKeys_1 = fullKeyParts(key);
|
|
5550
|
+
parentKeys_1.reduce(function (prev, curr, currIndex) {
|
|
5551
|
+
if (currIndex === parentKeys_1.length - 1 && value === null) {
|
|
5552
|
+
return prev.splice(prev.findIndex(function (v) { return v.key === curr; }), 1);
|
|
5553
|
+
}
|
|
5554
|
+
else {
|
|
5555
|
+
var prop = prev.find(function (v) { return v.key === curr; });
|
|
5556
|
+
prop.changed = true;
|
|
5557
|
+
return prop.properties;
|
|
5558
|
+
}
|
|
5559
|
+
}, properties);
|
|
5560
|
+
}
|
|
5561
|
+
catch (_err) { }
|
|
5634
5562
|
};
|
|
5635
|
-
var
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5563
|
+
var refreshPropertyKeys = function (property) { return property.properties.map(function (prop, i) {
|
|
5564
|
+
prop.fullKey = "" + property.fullKey + (property.isArray ? "[" + i + "]" : "." + prop.key);
|
|
5565
|
+
prop.key = property.isArray ? "" + i : prop.key;
|
|
5566
|
+
return refreshPropertyKeys(prop);
|
|
5567
|
+
}); };
|
|
5568
|
+
var calculateCycleDurationEnabled = function (properties, property) {
|
|
5569
|
+
var startDate = siblingProperty(properties, property, 'startDate');
|
|
5570
|
+
var endDate = siblingProperty(properties, property, 'endDate');
|
|
5571
|
+
return !!(startDate === null || startDate === void 0 ? void 0 : startDate.value) && !!(endDate === null || endDate === void 0 ? void 0 : endDate.value);
|
|
5640
5572
|
};
|
|
5641
|
-
var
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5573
|
+
var calculateCycleDuration = function (properties, property) {
|
|
5574
|
+
var startDate = siblingProperty(properties, property, 'startDate');
|
|
5575
|
+
var endDate = siblingProperty(properties, property, 'endDate');
|
|
5576
|
+
return utils.diffInDays(startDate.value, endDate.value);
|
|
5645
5577
|
};
|
|
5646
|
-
var
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
return '$ref' in items ? val : (Array.isArray(val) ?
|
|
5651
|
-
val.map(function (value) { return propertyValue(items, value); }).join(ARRAY_DELIMITER) :
|
|
5652
|
-
val);
|
|
5653
|
-
},
|
|
5654
|
-
json: function (val) { return val || ''; },
|
|
5655
|
-
string: function (val) { return ("" + val || '').trim(); },
|
|
5656
|
-
number: function (val) { return +("" + val || '0'); },
|
|
5657
|
-
integer: function (val) { return +("" + val || '0'); },
|
|
5658
|
-
boolean: function (val) { return ("" + val || '').toLowerCase() === 'true'; }
|
|
5578
|
+
var calculateCycleStartDateEnabled = function (properties, property) {
|
|
5579
|
+
var cycleDuration = siblingProperty(properties, property, 'cycleDuration');
|
|
5580
|
+
var endDate = siblingProperty(properties, property, 'endDate');
|
|
5581
|
+
return !!(cycleDuration === null || cycleDuration === void 0 ? void 0 : cycleDuration.value) && !!(endDate === null || endDate === void 0 ? void 0 : endDate.value);
|
|
5659
5582
|
};
|
|
5660
|
-
var
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
var propertyValueType = function (schema, value) { return (schema.type ? (Array.isArray(schema.type) ?
|
|
5665
|
-
schema.type[0] :
|
|
5666
|
-
schema.type === 'array' ?
|
|
5667
|
-
propertyValueType(Object.assign(Object.assign({}, schema), { type: [schema.items.type] })) :
|
|
5668
|
-
schema.type) : typeof value); };
|
|
5669
|
-
var propertyTypeParseValue = {
|
|
5670
|
-
object: function (val) { return safeJSONParse(val); },
|
|
5671
|
-
array: function (val, schema) {
|
|
5672
|
-
var items = schema.items;
|
|
5673
|
-
return '$ref' in items ? val : (!val || Array.isArray(val) ? val : val.split(ARRAY_DELIMITER).map(function (value) { return parseNewValue(items, value); }));
|
|
5674
|
-
},
|
|
5675
|
-
json: function (val) { return val || ''; },
|
|
5676
|
-
string: function (val) { return ("" + val || '').trim(); },
|
|
5677
|
-
number: function (val) { return +("" + val || '0'); },
|
|
5678
|
-
integer: function (val) { return +("" + val || '0'); },
|
|
5679
|
-
boolean: function (val) { return ("" + val || '').toLowerCase() === 'true'; }
|
|
5583
|
+
var calculateCycleStartDate = function (properties, property) {
|
|
5584
|
+
var cycleDuration = siblingProperty(properties, property, 'cycleDuration');
|
|
5585
|
+
var endDate = siblingProperty(properties, property, 'endDate');
|
|
5586
|
+
return moment__namespace(endDate.value).locale('en-gb').subtract(cycleDuration.value, 'days').format('YYYY-MM-DD');
|
|
5680
5587
|
};
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
* @param value
|
|
5686
|
-
* @returns Value in the correct format.
|
|
5687
|
-
*/
|
|
5688
|
-
var parseNewValue = function (schema, value) { return schema.type ? (Array.isArray(schema.type) ?
|
|
5689
|
-
propertyTypeParseValue[typeof value](value, schema) :
|
|
5690
|
-
propertyTypeParseValue[schema.type](value, schema)) : value; };
|
|
5691
|
-
var isOpenDefault = function (schemaType) { return [
|
|
5692
|
-
schema.SchemaType.Term
|
|
5693
|
-
].includes(schemaType); };
|
|
5694
|
-
// can the property be seen when the group is closed
|
|
5695
|
-
var isKeyClosedVisible = function (key) { return ['type', 'id', '@type', '@id'].includes(key); };
|
|
5696
|
-
var isKeyHidden = function (key) { return ['type', '@type'].includes(key); };
|
|
5697
|
-
var isKeyRequired = function (key, def) { return ['type', 'id'].includes(key) || ((def === null || def === void 0 ? void 0 : def.required) || []).includes(key); };
|
|
5698
|
-
var propertyError = function (errors) { return function (dataPath, nonExpandableArray) {
|
|
5699
|
-
if (nonExpandableArray === void 0) { nonExpandableArray = false; }
|
|
5700
|
-
return errors.find(function (error) { return (error.dataPath === dataPath || (nonExpandableArray && nonExpandableArrayDataPath(error.dataPath) === nonExpandableArrayDataPath(dataPath))) && (dataPath.length > 0 || !isMissingPropertyError(error)); });
|
|
5701
|
-
}; };
|
|
5702
|
-
var missingPropertyErrors = function (node, errors, parent) {
|
|
5703
|
-
if (parent === void 0) { parent = ''; }
|
|
5704
|
-
var allErrors = errors.filter(function (error) { return error.dataPath === keyToDataPath(parent) && isMissingPropertyError(error); });
|
|
5705
|
-
// check for node not found errors
|
|
5706
|
-
var missingNode = missingNodeErrors(allErrors);
|
|
5707
|
-
return missingNode.length === 2 ? [{
|
|
5708
|
-
id: propertyId(),
|
|
5709
|
-
schemaType: node.type,
|
|
5710
|
-
suggestions: { type: defaultSuggestionType },
|
|
5711
|
-
key: '',
|
|
5712
|
-
fullKey: parent,
|
|
5713
|
-
value: '',
|
|
5714
|
-
error: {
|
|
5715
|
-
level: 'error',
|
|
5716
|
-
message: missingNodeErrorMessage(node)
|
|
5717
|
-
},
|
|
5718
|
-
hasError: true,
|
|
5719
|
-
properties: [],
|
|
5720
|
-
addPropertyEnabled: false
|
|
5721
|
-
}] : allErrors.map(function (error) {
|
|
5722
|
-
var missingProperty = error.params.missingProperty;
|
|
5723
|
-
var fullKey = parent ? parent + "." + missingProperty : missingProperty;
|
|
5724
|
-
var missingOneOf = isMissingOneOfError(error);
|
|
5725
|
-
return {
|
|
5726
|
-
id: propertyId(),
|
|
5727
|
-
schemaType: node.type,
|
|
5728
|
-
suggestions: { type: defaultSuggestionType },
|
|
5729
|
-
key: missingProperty,
|
|
5730
|
-
fullKey: fullKey,
|
|
5731
|
-
value: 'Add field to fix',
|
|
5732
|
-
editable: false,
|
|
5733
|
-
error: formatError(error),
|
|
5734
|
-
hasError: missingOneOf ? false : errorHasError(error),
|
|
5735
|
-
hasWarning: missingOneOf || errorHasWarning(error),
|
|
5736
|
-
properties: [],
|
|
5737
|
-
addPropertyEnabled: true
|
|
5738
|
-
};
|
|
5739
|
-
});
|
|
5588
|
+
|
|
5589
|
+
var isSite = function (_a) {
|
|
5590
|
+
var type = _a["@type"], id = _a["@id"];
|
|
5591
|
+
return type === schema.NodeType.Site && !!id;
|
|
5740
5592
|
};
|
|
5741
|
-
var
|
|
5742
|
-
|
|
5743
|
-
return
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
var nonExpandableArray = isArray && !expandable;
|
|
5748
|
-
var fullKey = Array.isArray(node) ? parent + "[" + key + "]" : [
|
|
5749
|
-
parent,
|
|
5750
|
-
key
|
|
5751
|
-
].filter(Boolean).join('.');
|
|
5752
|
-
var nodeType = node.type || node['@type'];
|
|
5753
|
-
var schemaType = expandable ? (isArray && value.length ? value[0].type || value[0]['@type'] : value.type || value['@type']) : nodeType;
|
|
5754
|
-
var schema$1 = (schemas && schema.isTypeValid({ type: schemaType }) ? (expandable ? schemas[schemaType] : schemas[schemaType].properties[key]) : null) || {};
|
|
5755
|
-
var isIri = isSchemaIri(schema$1);
|
|
5756
|
-
var error = propertyError(errors)(keyToDataPath(fullKey), nonExpandableArray);
|
|
5757
|
-
var parentSchema = expandable ? (
|
|
5758
|
-
// TODO: for non-array, should be schema unless last recursion
|
|
5759
|
-
isArray ? schema$1 : nodeSchema) : nodeSchema;
|
|
5760
|
-
var properties = expandable || isIri ?
|
|
5761
|
-
recursiveProperties(schemas, errors, parentSchema, deepEditable, fullKey)(value) : [];
|
|
5762
|
-
var inError = errorHasError(error) || hasError(properties);
|
|
5763
|
-
var inWarning = errorHasWarning(error) || hasWarning(properties);
|
|
5764
|
-
var editable = schema.isTypeNode(node['@type']) || (expandable && schema.isTypeNode(value['@type'])) ?
|
|
5765
|
-
false :
|
|
5766
|
-
(
|
|
5767
|
-
// prevent editing/adding new properties on existing sub-nodes
|
|
5768
|
-
!deepEditable && schema.isTypeNode(schemaType) && (expandable ? value.type !== schema.NodeType.Term : parent && node.type !== schema.NodeType.Term) ?
|
|
5769
|
-
false :
|
|
5770
|
-
// handle IRI
|
|
5771
|
-
(!schemaType && key === '@id') || editableKey(key));
|
|
5772
|
-
var valueType = propertyValueType(schema$1, value);
|
|
5773
|
-
return {
|
|
5774
|
-
id: propertyId(),
|
|
5775
|
-
schemaType: isIri ? null : schemaType,
|
|
5776
|
-
schema: schema$1,
|
|
5777
|
-
key: key,
|
|
5778
|
-
fullKey: fullKey,
|
|
5779
|
-
value: propertyValue(schema$1, value),
|
|
5780
|
-
editable: inError || editable,
|
|
5781
|
-
suggestions: enableSuggestions(nodeSchema, node.type, fullKey, schema$1),
|
|
5782
|
-
addPropertyEnabled: isAddPropertyEnabled(node, schemaType, schema$1, fullKey),
|
|
5783
|
-
newProperty: {},
|
|
5784
|
-
newError: { level: 'warning' },
|
|
5785
|
-
error: formatError(error),
|
|
5786
|
-
isHidden: parent && isKeyHidden(key),
|
|
5787
|
-
closedVisible: isKeyClosedVisible(key),
|
|
5788
|
-
hasError: inError,
|
|
5789
|
-
hasWarning: inWarning,
|
|
5790
|
-
isRequired: isKeyRequired(key, schemas[nodeType]),
|
|
5791
|
-
isArray: isArray,
|
|
5792
|
-
isExpandable: expandable,
|
|
5793
|
-
isOpen: isOpenDefault(schemaType),
|
|
5794
|
-
properties: properties,
|
|
5795
|
-
placeholder: propertyPlaceholder(schema$1, valueType, fullKey, parentSchema),
|
|
5796
|
-
externalUrl: propertyExternalUrl(node, key, value)
|
|
5797
|
-
};
|
|
5798
|
-
};
|
|
5593
|
+
var siteLocation = function (_a) {
|
|
5594
|
+
var latitude = _a.latitude, longitude = _a.longitude;
|
|
5595
|
+
return latitude && longitude ? ({
|
|
5596
|
+
lat: latitude,
|
|
5597
|
+
lng: longitude
|
|
5598
|
+
}) : undefined;
|
|
5799
5599
|
};
|
|
5800
|
-
var
|
|
5801
|
-
var
|
|
5802
|
-
var
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
return propertyFromNode(schemas, errors, parentSchema, true, parent, parentNode)(key);
|
|
5600
|
+
var siteDefaultLocation = function (_a) {
|
|
5601
|
+
var region = _a.region, country = _a.country;
|
|
5602
|
+
var markers = [
|
|
5603
|
+
region ? createMarker(termLocation(region), termLocationName(region).name, undefined, 20) : undefined,
|
|
5604
|
+
country ? createMarker(termLocation(country), termLocationName(country).name, undefined, 40) : undefined
|
|
5605
|
+
].filter(Boolean);
|
|
5606
|
+
return (markers.length ? markers[0] : undefined);
|
|
5808
5607
|
};
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5608
|
+
var siteMarker = function (site) { return createMarker(site ? siteLocation(site) : undefined, site.name); };
|
|
5609
|
+
var sitePolygon = function (_a) {
|
|
5610
|
+
var boundary = _a.boundary;
|
|
5611
|
+
return (boundary ? polygonsFromFeature(boundary) : undefined);
|
|
5612
|
+
};
|
|
5613
|
+
var regions = function (sites) { return utils.unique(sites.map(function (_a) {
|
|
5614
|
+
var country = _a.country, region = _a.region;
|
|
5615
|
+
return region ? region['@id'] : (country ? country['@id'] : null);
|
|
5616
|
+
}).filter(Boolean)); };
|
|
5617
|
+
var defaultCenter = { lat: 0, lng: 0 };
|
|
5618
|
+
var SitesMapsComponent = /** @class */ (function () {
|
|
5619
|
+
function SitesMapsComponent(nodeService) {
|
|
5620
|
+
this.nodeService = nodeService;
|
|
5621
|
+
this.loaded = false;
|
|
5622
|
+
this.loadPolygons = true;
|
|
5623
|
+
this.sites = [];
|
|
5624
|
+
this.nodes = [];
|
|
5625
|
+
this.center = defaultCenter;
|
|
5626
|
+
this.zoom = 2;
|
|
5627
|
+
this.showNotice = true;
|
|
5628
|
+
this.googleLoaded = false;
|
|
5629
|
+
this.showNoLocation = false;
|
|
5630
|
+
}
|
|
5631
|
+
SitesMapsComponent.prototype.ngOnInit = function () {
|
|
5632
|
+
var _this = this;
|
|
5633
|
+
waitFor('google', function () {
|
|
5634
|
+
_this.googleLoaded = true;
|
|
5635
|
+
setTimeout(function () { return !_this.loaded && _this.loadData(); });
|
|
5636
|
+
});
|
|
5637
|
+
};
|
|
5638
|
+
SitesMapsComponent.prototype.ngAfterViewInit = function () {
|
|
5639
|
+
return this.googleLoaded && this.loadData();
|
|
5640
|
+
};
|
|
5641
|
+
SitesMapsComponent.prototype.loadData = function () {
|
|
5642
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5643
|
+
var sites, markers, polygons, termPolygons;
|
|
5644
|
+
var _this = this;
|
|
5645
|
+
return __generator(this, function (_a) {
|
|
5646
|
+
switch (_a.label) {
|
|
5647
|
+
case 0:
|
|
5648
|
+
// loaded data as geojson
|
|
5649
|
+
this.map.googleMap.data.setStyle(function () { return (Object.assign(Object.assign({}, strokeStyle), { strokeOpacity: 0.1 })); });
|
|
5650
|
+
return [4 /*yield*/, this.getSites()];
|
|
5651
|
+
case 1:
|
|
5652
|
+
sites = _a.sent();
|
|
5653
|
+
markers = this.addSiteMarkers(sites);
|
|
5654
|
+
polygons = sites.flatMap(sitePolygon).filter(Boolean);
|
|
5655
|
+
polygons.map(function (polygon) { return polygon === null || polygon === void 0 ? void 0 : polygon.setMap(_this.map.googleMap); });
|
|
5656
|
+
this.loaded = true;
|
|
5657
|
+
return [4 /*yield*/, Promise.all(regions(sites).map(function (v) { return _this.addTermsPolygons(v); }))];
|
|
5658
|
+
case 2:
|
|
5659
|
+
termPolygons = (_a.sent()).flat();
|
|
5660
|
+
this.showNoLocation = markers.length === 0 && polygons.length === 0 && termPolygons.length === 0;
|
|
5661
|
+
return [2 /*return*/, markers.length ?
|
|
5662
|
+
this.centerMarker(markers[0]) :
|
|
5663
|
+
this.centerPolygons(polygons.length ? polygons : termPolygons)];
|
|
5664
|
+
}
|
|
5665
|
+
});
|
|
5666
|
+
});
|
|
5667
|
+
};
|
|
5668
|
+
SitesMapsComponent.prototype.addMarkers = function (markers, cluster) {
|
|
5669
|
+
var _this = this;
|
|
5670
|
+
if (cluster === void 0) { cluster = false; }
|
|
5671
|
+
return cluster ?
|
|
5672
|
+
new MarkerClusterer__default["default"](this.map.googleMap, markers, { imagePath: clustererImage }) :
|
|
5673
|
+
markers.map(function (marker) { return marker.setMap(_this.map.googleMap); });
|
|
5674
|
+
};
|
|
5675
|
+
SitesMapsComponent.prototype.addTermsPolygons = function (id) {
|
|
5676
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5677
|
+
var _a;
|
|
5678
|
+
return __generator(this, function (_b) {
|
|
5679
|
+
switch (_b.label) {
|
|
5680
|
+
case 0:
|
|
5681
|
+
if (!this.loadPolygons) return [3 /*break*/, 2];
|
|
5682
|
+
return [4 /*yield*/, this.termPolygons(id)];
|
|
5683
|
+
case 1:
|
|
5684
|
+
_a = _b.sent();
|
|
5685
|
+
return [3 /*break*/, 3];
|
|
5686
|
+
case 2:
|
|
5687
|
+
_a = [];
|
|
5688
|
+
_b.label = 3;
|
|
5689
|
+
case 3: return [2 /*return*/, _a];
|
|
5690
|
+
}
|
|
5691
|
+
});
|
|
5692
|
+
});
|
|
5817
5693
|
};
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
var typeToNewProperty = function (schemas, schema, nodeSchema, node, fullKey) {
|
|
5831
|
-
var key = fullKeyParts(fullKey).pop();
|
|
5832
|
-
var mappings = {
|
|
5833
|
-
object: function () {
|
|
5834
|
-
var _d = schemaRequiredProperties(schemas, schema), schemaType = _d.schemaType, properties = _d.properties;
|
|
5835
|
-
node[key] = node[key] || {};
|
|
5836
|
-
node[key].type = schemaType;
|
|
5837
|
-
// TODO: handle load schemas from http source
|
|
5838
|
-
if (schemaType.startsWith('http')) {
|
|
5839
|
-
return typeToNewProperty(schemas, { type: 'json' }, nodeSchema, node, fullKey);
|
|
5840
|
-
}
|
|
5841
|
-
// TODO: handle nodeSchema should be schema unless last recursion
|
|
5842
|
-
var props = properties
|
|
5843
|
-
.filter(function (prop) { return nestingEnabled(schemaType, prop.key) && !!prop.value; })
|
|
5844
|
-
.map(function (v) { return (Object.assign(Object.assign({}, typeToNewProperty(schemas, v.value, nodeSchema, node[key], fullKey + "." + v.key)), { isRequired: true })); });
|
|
5845
|
-
var value = props.reduce(function (prev, curr) {
|
|
5846
|
-
var _d;
|
|
5847
|
-
return (Object.assign(Object.assign({}, prev), (_d = {}, _d[curr.key] = curr.value, _d)));
|
|
5848
|
-
}, {});
|
|
5849
|
-
return {
|
|
5850
|
-
id: propertyId(),
|
|
5851
|
-
isAdded: true,
|
|
5852
|
-
schema: schemas[schemaType],
|
|
5853
|
-
schemaType: schemaType,
|
|
5854
|
-
key: key,
|
|
5855
|
-
fullKey: fullKey,
|
|
5856
|
-
value: value,
|
|
5857
|
-
editable: editableKey(key),
|
|
5858
|
-
isHidden: isKeyHidden(key),
|
|
5859
|
-
closedVisible: isKeyClosedVisible(key),
|
|
5860
|
-
suggestions: enableSuggestions(nodeSchema, schemaType, fullKey),
|
|
5861
|
-
properties: props.sort(sortProperties),
|
|
5862
|
-
addPropertyEnabled: isAddPropertyEnabled(node, schemaType, schemas[schemaType], key),
|
|
5863
|
-
newProperty: {},
|
|
5864
|
-
newError: { level: 'warning' },
|
|
5865
|
-
isRequired: isKeyRequired(key, schema),
|
|
5866
|
-
isArray: false,
|
|
5867
|
-
isExpandable: true,
|
|
5868
|
-
isOpen: isOpenDefault(schemaType)
|
|
5869
|
-
};
|
|
5870
|
-
},
|
|
5871
|
-
array: function () {
|
|
5872
|
-
var items = schema.items;
|
|
5873
|
-
// array of string, number and boolean
|
|
5874
|
-
if (items.type) {
|
|
5875
|
-
return mappings.default();
|
|
5694
|
+
SitesMapsComponent.prototype.centerMarker = function (marker) {
|
|
5695
|
+
var center = marker.getPosition();
|
|
5696
|
+
this.center = center ? { lat: center.lat(), lng: center.lng() } : defaultCenter;
|
|
5697
|
+
};
|
|
5698
|
+
SitesMapsComponent.prototype.centerPolygons = function (polygons) {
|
|
5699
|
+
try {
|
|
5700
|
+
return polygons.length ? this.map.googleMap.fitBounds(polygonBounds(polygons)) : null;
|
|
5701
|
+
}
|
|
5702
|
+
catch (err) {
|
|
5703
|
+
if (polygons.length) {
|
|
5704
|
+
this.map.googleMap.fitBounds(polygonBounds(polygons[0]));
|
|
5705
|
+
this.zoom = 3;
|
|
5876
5706
|
}
|
|
5877
|
-
var schemaType = definitionToSchemaType(items);
|
|
5878
|
-
node[key] = node[key] || [];
|
|
5879
|
-
node[key].push({});
|
|
5880
|
-
var property = typeToNewProperty(schemas, items, schemas[schemaType], node[key][0], fullKey + "[0]");
|
|
5881
|
-
return {
|
|
5882
|
-
id: propertyId(),
|
|
5883
|
-
isAdded: true,
|
|
5884
|
-
schema: schema,
|
|
5885
|
-
schemaType: schemaType,
|
|
5886
|
-
key: key,
|
|
5887
|
-
fullKey: fullKey,
|
|
5888
|
-
value: [property.value],
|
|
5889
|
-
editable: editableKey(key),
|
|
5890
|
-
isHidden: isKeyHidden(key),
|
|
5891
|
-
closedVisible: isKeyClosedVisible(key),
|
|
5892
|
-
suggestions: undefined,
|
|
5893
|
-
properties: [property],
|
|
5894
|
-
newProperty: {},
|
|
5895
|
-
newError: { level: 'warning' },
|
|
5896
|
-
isArray: true,
|
|
5897
|
-
isExpandable: true,
|
|
5898
|
-
addPropertyEnabled: false
|
|
5899
|
-
};
|
|
5900
|
-
},
|
|
5901
|
-
default: function () {
|
|
5902
|
-
var valueType = propertyValueType(schema);
|
|
5903
|
-
var value = schema.default || schema.const || valueTypeToDefault[valueType];
|
|
5904
|
-
node[key] = value;
|
|
5905
|
-
return {
|
|
5906
|
-
id: propertyId(),
|
|
5907
|
-
isAdded: true,
|
|
5908
|
-
schema: schema,
|
|
5909
|
-
schemaType: node.type,
|
|
5910
|
-
key: key,
|
|
5911
|
-
fullKey: fullKey,
|
|
5912
|
-
value: propertyValue(schema, value),
|
|
5913
|
-
editable: editableKey(key),
|
|
5914
|
-
isHidden: isKeyHidden(key),
|
|
5915
|
-
closedVisible: isKeyClosedVisible(key),
|
|
5916
|
-
suggestions: enableSuggestions(nodeSchema, node.type, fullKey, schema),
|
|
5917
|
-
placeholder: propertyPlaceholder(schema, valueType, fullKey, nodeSchema),
|
|
5918
|
-
externalUrl: propertyExternalUrl(node, key, value),
|
|
5919
|
-
properties: [],
|
|
5920
|
-
addPropertyEnabled: false
|
|
5921
|
-
};
|
|
5922
5707
|
}
|
|
5923
5708
|
};
|
|
5924
|
-
|
|
5925
|
-
|
|
5709
|
+
SitesMapsComponent.prototype.addSiteMarkers = function (sites) {
|
|
5710
|
+
var siteMarkers = sites.map(siteMarker).filter(Boolean);
|
|
5711
|
+
var markers = siteMarkers.length ? siteMarkers : sites.map(siteDefaultLocation).filter(Boolean);
|
|
5712
|
+
this.addMarkers(markers, !!siteMarkers.length);
|
|
5713
|
+
return markers;
|
|
5714
|
+
};
|
|
5715
|
+
SitesMapsComponent.prototype.loadSite = function (node) {
|
|
5716
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5717
|
+
var _a;
|
|
5718
|
+
return __generator(this, function (_b) {
|
|
5719
|
+
switch (_b.label) {
|
|
5720
|
+
case 0:
|
|
5721
|
+
if (!('schemaVersion' in node)) return [3 /*break*/, 1];
|
|
5722
|
+
_a = node;
|
|
5723
|
+
return [3 /*break*/, 3];
|
|
5724
|
+
case 1: return [4 /*yield*/, this.nodeService.get(node)];
|
|
5725
|
+
case 2:
|
|
5726
|
+
_a = _b.sent();
|
|
5727
|
+
_b.label = 3;
|
|
5728
|
+
case 3:
|
|
5729
|
+
// means the site was already downloaded
|
|
5730
|
+
return [2 /*return*/, _a];
|
|
5731
|
+
}
|
|
5732
|
+
});
|
|
5733
|
+
});
|
|
5734
|
+
};
|
|
5735
|
+
SitesMapsComponent.prototype.siteData = function (node) {
|
|
5736
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5737
|
+
var _a, _b, _c, _d;
|
|
5738
|
+
return __generator(this, function (_e) {
|
|
5739
|
+
switch (_e.label) {
|
|
5740
|
+
case 0:
|
|
5741
|
+
if (![
|
|
5742
|
+
schema.NodeType.Site,
|
|
5743
|
+
schema.NodeType.Organisation
|
|
5744
|
+
].includes(node.type)) return [3 /*break*/, 1];
|
|
5745
|
+
_a = node;
|
|
5746
|
+
return [3 /*break*/, 7];
|
|
5747
|
+
case 1:
|
|
5748
|
+
if (!isSite(node)) return [3 /*break*/, 2];
|
|
5749
|
+
_b = this.loadSite(node);
|
|
5750
|
+
return [3 /*break*/, 6];
|
|
5751
|
+
case 2:
|
|
5752
|
+
if (!('site' in node && isSite(node.site))) return [3 /*break*/, 3];
|
|
5753
|
+
_c = this.loadSite(node.site);
|
|
5754
|
+
return [3 /*break*/, 5];
|
|
5755
|
+
case 3:
|
|
5756
|
+
_d = this.siteData;
|
|
5757
|
+
return [4 /*yield*/, this.loadSite(node)];
|
|
5758
|
+
case 4:
|
|
5759
|
+
_c = _d.apply(this, [_e.sent()]);
|
|
5760
|
+
_e.label = 5;
|
|
5761
|
+
case 5:
|
|
5762
|
+
_b = (_c);
|
|
5763
|
+
_e.label = 6;
|
|
5764
|
+
case 6:
|
|
5765
|
+
_a = (_b);
|
|
5766
|
+
_e.label = 7;
|
|
5767
|
+
case 7: return [2 /*return*/, _a];
|
|
5768
|
+
}
|
|
5769
|
+
});
|
|
5770
|
+
});
|
|
5771
|
+
};
|
|
5772
|
+
SitesMapsComponent.prototype.getSites = function () {
|
|
5773
|
+
var _this = this;
|
|
5774
|
+
var nodes = this.sites && this.sites.length ? this.sites : this.nodes;
|
|
5775
|
+
return Promise.all(nodes.map(function (node) { return _this.siteData(node); }));
|
|
5776
|
+
};
|
|
5777
|
+
SitesMapsComponent.prototype.termPolygons = function (id) {
|
|
5778
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5779
|
+
var data, polygons, _err_1;
|
|
5780
|
+
var _this = this;
|
|
5781
|
+
return __generator(this, function (_a) {
|
|
5782
|
+
switch (_a.label) {
|
|
5783
|
+
case 0:
|
|
5784
|
+
_a.trys.push([0, 2, , 3]);
|
|
5785
|
+
return [4 /*yield*/, this.nodeService.downloadRaw(baseUrl() + "/gadm/" + id + ".geojson")];
|
|
5786
|
+
case 1:
|
|
5787
|
+
data = _a.sent();
|
|
5788
|
+
polygons = polygonsFromFeature(data);
|
|
5789
|
+
polygons.map(function (polygon) { return polygon.setMap(_this.map.googleMap); });
|
|
5790
|
+
return [2 /*return*/, polygons];
|
|
5791
|
+
case 2:
|
|
5792
|
+
_err_1 = _a.sent();
|
|
5793
|
+
// ignore error if the file does not exist
|
|
5794
|
+
return [2 /*return*/, []];
|
|
5795
|
+
case 3: return [2 /*return*/];
|
|
5796
|
+
}
|
|
5797
|
+
});
|
|
5798
|
+
});
|
|
5799
|
+
};
|
|
5800
|
+
return SitesMapsComponent;
|
|
5801
|
+
}());
|
|
5802
|
+
SitesMapsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, deps: [{ token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5803
|
+
SitesMapsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMapsComponent, selector: "he-sites-maps", inputs: { loadPolygons: "loadPolygons", sites: "sites", nodes: "nodes", center: "center", zoom: "zoom", showNotice: "showNotice" }, viewQueries: [{ propertyName: "map", first: true, predicate: i1$2.GoogleMap, descendants: true }], ngImport: i0__namespace, template: "<google-map *ngIf=\"googleLoaded\"\n height=\"100%\"\n width=\"100%\"\n [zoom]=\"zoom\"\n [center]=\"center\"\n></google-map>\n\n<p *ngIf=\"showNotice\" class=\"mt-2 is-italic is-size-7\">The information provided might not be complete</p>\n\n<div class=\"no-location has-text-center has-text-light\" *ngIf=\"showNoLocation\">\n <span>No precise location data</span>\n</div>\n", styles: [":host{display:block;height:100%;position:relative;width:100%}.no-location{background-color:#0000004d;left:0;height:100%;position:absolute;top:0;width:100%;z-index:9}.no-location>span{display:inline-block;margin-top:12%}\n"], components: [{ type: i1__namespace$2.GoogleMap, selector: "google-map", inputs: ["height", "width", "center", "zoom", "options", "mapTypeId"], outputs: ["authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
5804
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMapsComponent, decorators: [{
|
|
5805
|
+
type: i0.Component,
|
|
5806
|
+
args: [{
|
|
5807
|
+
selector: 'he-sites-maps',
|
|
5808
|
+
templateUrl: './sites-maps.component.html',
|
|
5809
|
+
styleUrls: ['./sites-maps.component.scss']
|
|
5810
|
+
}]
|
|
5811
|
+
}], ctorParameters: function () { return [{ type: HeNodeService }]; }, propDecorators: { map: [{
|
|
5812
|
+
type: i0.ViewChild,
|
|
5813
|
+
args: [i1$2.GoogleMap]
|
|
5814
|
+
}], loadPolygons: [{
|
|
5815
|
+
type: i0.Input
|
|
5816
|
+
}], sites: [{
|
|
5817
|
+
type: i0.Input
|
|
5818
|
+
}], nodes: [{
|
|
5819
|
+
type: i0.Input
|
|
5820
|
+
}], center: [{
|
|
5821
|
+
type: i0.Input
|
|
5822
|
+
}], zoom: [{
|
|
5823
|
+
type: i0.Input
|
|
5824
|
+
}], showNotice: [{
|
|
5825
|
+
type: i0.Input
|
|
5826
|
+
}] } });
|
|
5827
|
+
|
|
5828
|
+
var maxAreaSize = 5000;
|
|
5829
|
+
var siteTooBig = function (_a) {
|
|
5830
|
+
var area = _a.area;
|
|
5831
|
+
return area && area / 100 > maxAreaSize;
|
|
5832
|
+
};
|
|
5833
|
+
var hasMultipleValues = function (values) { return (values || []).length > 1; };
|
|
5834
|
+
var weighedAverage = function (_a) {
|
|
5835
|
+
var value = _a.value, depthLower = _a.depthLower, depthUpper = _a.depthUpper;
|
|
5836
|
+
return value.reduce(function (prev, curr, index) { return prev + (curr * (depthLower[index] - depthUpper[index])); }, 0) /
|
|
5837
|
+
value.reduce(function (prev, _curr, index) { return prev + (depthLower[index] - depthUpper[index]); }, 0);
|
|
5838
|
+
};
|
|
5839
|
+
var measurementValue = function (_a) {
|
|
5840
|
+
var value = _a.value, depthLower = _a.depthLower, depthUpper = _a.depthUpper;
|
|
5841
|
+
return hasMultipleValues(value) && hasMultipleValues(depthLower) && hasMultipleValues(depthUpper) ?
|
|
5842
|
+
weighedAverage({ value: value, depthLower: depthLower, depthUpper: depthUpper }) :
|
|
5843
|
+
propertyValue$1(value);
|
|
5926
5844
|
};
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
}
|
|
5939
|
-
}
|
|
5845
|
+
|
|
5846
|
+
var SitesMeasurementsLogsComponent = /** @class */ (function () {
|
|
5847
|
+
function SitesMeasurementsLogsComponent(searchService, nodeService) {
|
|
5848
|
+
this.searchService = searchService;
|
|
5849
|
+
this.nodeService = nodeService;
|
|
5850
|
+
this.originalValues = [];
|
|
5851
|
+
this.recalculatedValues = [];
|
|
5852
|
+
this.loading = true;
|
|
5853
|
+
this.NodeType = schema.NodeType;
|
|
5854
|
+
this.models = [];
|
|
5855
|
+
this.measurements = [];
|
|
5940
5856
|
}
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5857
|
+
SitesMeasurementsLogsComponent.prototype.ngOnInit = function () {
|
|
5858
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5859
|
+
var _a, measurements;
|
|
5860
|
+
return __generator(this, function (_b) {
|
|
5861
|
+
switch (_b.label) {
|
|
5862
|
+
case 0:
|
|
5863
|
+
this.logsUrl = this.nodeService.nodeLogsUrl(this.node);
|
|
5864
|
+
_a = this;
|
|
5865
|
+
return [4 /*yield*/, this.nodeService.getModelsLog(this.node)];
|
|
5866
|
+
case 1:
|
|
5867
|
+
_a.logs = _b.sent();
|
|
5868
|
+
return [4 /*yield*/, this.searchService.search({
|
|
5869
|
+
fields: ['@type', '@id', 'name'],
|
|
5870
|
+
limit: 1000,
|
|
5871
|
+
query: {
|
|
5872
|
+
bool: {
|
|
5873
|
+
must: [
|
|
5874
|
+
matchType(schema.NodeType.Term),
|
|
5875
|
+
matchTermType(schema.TermTermType.measurement)
|
|
5876
|
+
]
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
})];
|
|
5880
|
+
case 2:
|
|
5881
|
+
measurements = (_b.sent()).results;
|
|
5882
|
+
this.measurements = measurements;
|
|
5883
|
+
this.loading = false;
|
|
5884
|
+
return [2 /*return*/];
|
|
5885
|
+
}
|
|
5886
|
+
});
|
|
5887
|
+
});
|
|
5888
|
+
};
|
|
5889
|
+
Object.defineProperty(SitesMeasurementsLogsComponent.prototype, "node", {
|
|
5890
|
+
get: function () {
|
|
5891
|
+
return Object.assign(Object.assign({}, this.site), { dataState: api.DataState.recalculated });
|
|
5892
|
+
},
|
|
5893
|
+
enumerable: false,
|
|
5894
|
+
configurable: true
|
|
5895
|
+
});
|
|
5896
|
+
return SitesMeasurementsLogsComponent;
|
|
5897
|
+
}());
|
|
5898
|
+
SitesMeasurementsLogsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsLogsComponent, deps: [{ token: HeSearchService }, { token: HeNodeService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5899
|
+
SitesMeasurementsLogsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMeasurementsLogsComponent, selector: "he-sites-measurements-logs", inputs: { site: "site", originalValues: "originalValues", recalculatedValues: "recalculatedValues" }, ngImport: i0__namespace, template: "<he-node-logs-models *ngIf=\"!loading; else loader\"\n [logsUrl]=\"logsUrl\"\n [nodeType]=\"NodeType.Site\"\n [originalValues]=\"originalValues\"\n [recalculatedValues]=\"recalculatedValues\"\n [terms]=\"measurements\"\n [logs]=\"logs\"\n filteredType=\"Measurement\"\n></he-node-logs-models>\n\n<ng-template #loader>\n <div class=\"has-text-center py-3\">\n <fa-icon icon=\"spinner\" [pulse]=\"true\" size=\"lg\"></fa-icon>\n </div>\n</ng-template>\n", styles: [""], components: [{ type: NodeLogsModelsComponent, selector: "he-node-logs-models", inputs: ["nodeType", "nodeKey", "logsUrl", "originalValues", "recalculatedValues", "terms", "logs", "filteredType"] }, { type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
5900
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsLogsComponent, decorators: [{
|
|
5901
|
+
type: i0.Component,
|
|
5902
|
+
args: [{
|
|
5903
|
+
selector: 'he-sites-measurements-logs',
|
|
5904
|
+
templateUrl: './sites-measurements-logs.component.html',
|
|
5905
|
+
styleUrls: ['./sites-measurements-logs.component.scss']
|
|
5906
|
+
}]
|
|
5907
|
+
}], ctorParameters: function () { return [{ type: HeSearchService }, { type: HeNodeService }]; }, propDecorators: { site: [{
|
|
5908
|
+
type: i0.Input
|
|
5909
|
+
}], originalValues: [{
|
|
5910
|
+
type: i0.Input
|
|
5911
|
+
}], recalculatedValues: [{
|
|
5912
|
+
type: i0.Input
|
|
5913
|
+
}] } });
|
|
5914
|
+
|
|
5915
|
+
var orderBy$1 = require('lodash.orderby');
|
|
5916
|
+
var View$1;
|
|
5917
|
+
(function (View) {
|
|
5918
|
+
View["table"] = "table";
|
|
5919
|
+
View["logs"] = "logs";
|
|
5920
|
+
})(View$1 || (View$1 = {}));
|
|
5921
|
+
var SitesMeasurementsComponent = /** @class */ (function () {
|
|
5922
|
+
function SitesMeasurementsComponent() {
|
|
5923
|
+
this.originalValues = [];
|
|
5924
|
+
this.sites = [];
|
|
5925
|
+
this.showDownload = false;
|
|
5926
|
+
this.View = View$1;
|
|
5927
|
+
this.selectedView = View$1.table;
|
|
5928
|
+
this.maxAreaSize = maxAreaSize;
|
|
5929
|
+
this.siteTooBig = siteTooBig;
|
|
5930
|
+
this.defaultLabel = defaultLabel;
|
|
5931
|
+
this.measurementValue = measurementValue;
|
|
5932
|
+
this.measurements = [];
|
|
5947
5933
|
}
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
var key = _d.key;
|
|
5966
|
-
return key === nestedKey;
|
|
5934
|
+
SitesMeasurementsComponent.prototype.ngOnChanges = function (changes) {
|
|
5935
|
+
if ('sites' in changes) {
|
|
5936
|
+
return this.update();
|
|
5937
|
+
}
|
|
5938
|
+
if ('dataState' in changes) {
|
|
5939
|
+
this.selectedView = View$1.table;
|
|
5940
|
+
}
|
|
5941
|
+
};
|
|
5942
|
+
SitesMeasurementsComponent.prototype.trackById = function (_index, item) {
|
|
5943
|
+
return item['@id'];
|
|
5944
|
+
};
|
|
5945
|
+
Object.defineProperty(SitesMeasurementsComponent.prototype, "isOriginal", {
|
|
5946
|
+
get: function () {
|
|
5947
|
+
return this.dataState === api.DataState.original;
|
|
5948
|
+
},
|
|
5949
|
+
enumerable: false,
|
|
5950
|
+
configurable: true
|
|
5967
5951
|
});
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
}
|
|
5986
|
-
|
|
5952
|
+
SitesMeasurementsComponent.prototype.update = function () {
|
|
5953
|
+
var measurementsPerSite = groupNodesByTerm(this.sites, 'measurements', this.originalValues);
|
|
5954
|
+
this.measurements = orderBy$1(grouppedKeys(measurementsPerSite), ['key'], ['asc']);
|
|
5955
|
+
};
|
|
5956
|
+
SitesMeasurementsComponent.prototype.togglePopover = function (popover, context) {
|
|
5957
|
+
return popover.isOpen() ? popover.close() : popover.open(context);
|
|
5958
|
+
};
|
|
5959
|
+
Object.defineProperty(SitesMeasurementsComponent.prototype, "showAreaTooBig", {
|
|
5960
|
+
get: function () {
|
|
5961
|
+
return this.dataState === api.DataState.recalculated && (this.sites || []).some(siteTooBig);
|
|
5962
|
+
},
|
|
5963
|
+
enumerable: false,
|
|
5964
|
+
configurable: true
|
|
5965
|
+
});
|
|
5966
|
+
return SitesMeasurementsComponent;
|
|
5967
|
+
}());
|
|
5968
|
+
SitesMeasurementsComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
5969
|
+
SitesMeasurementsComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SitesMeasurementsComponent, selector: "he-sites-measurements", inputs: { originalValues: "originalValues", sites: "sites", dataState: "dataState" }, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container *ngIf=\"measurements.length; else emptyTable\">\n <div class=\"columns is-variable is-2 m-0\">\n <div class=\"column is-hidden-mobile\"></div>\n <div class=\"column is-narrow\">\n <div class=\"field has-addons\">\n <div class=\"control\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.table\" (click)=\"selectedView = View.table\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"list\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Table view</span>\n </button>\n </div>\n <div class=\"control\" *ngIf=\"!isOriginal && sites.length === 1\">\n <button class=\"button is-small\" [class.is-active]=\"selectedView === View.logs\" (click)=\"selectedView = View.logs\">\n <span class=\"icon is-small\">\n <fa-icon icon=\"calculator\" aria-hidden=\"true\"></fa-icon>\n </span>\n <span>Recalculations logs</span>\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"px-3 pb-3\" [class.is-hidden]=\"selectedView !== View.table\">\n <div class=\"has-text-right mb-2\">\n <button class=\"button is-dark is-outlined is-small\" (click)=\"showDownload = true\">\n <fa-icon icon=\"download\"></fa-icon>\n <span class=\"pl-2\">Download (CSV)</span>\n </button>\n </div>\n\n <div class=\"table-container data-table-container mb-1\">\n <table class=\"table is-narrow data-table has-children-{{measurements.length}}\">\n <thead>\n <tr>\n <th class=\"width-auto\"></th>\n <th *ngFor=\"let measurement of measurements\"\n [attr.title]=\"measurement.value.term.name\"\n >\n <he-node-link [node]=\"measurement.value.term\">\n <span>{{measurement.value.term.name | ellipsis:30}}</span>\n </he-node-link>\n </th>\n </tr>\n <tr>\n <th class=\"width-auto\"></th>\n <th *ngFor=\"let measurement of measurements\"\n [attr.title]=\"measurement.value.term.units\"\n >{{measurement.value.term.units}}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let site of sites; trackBy: trackById; let i = index\">\n <td class=\"width-auto\" [attr.title]=\"defaultLabel(site)\">\n <he-node-link [node]=\"site\">\n <span class=\"is-nowrap has-text-ellipsis\">{{i + 1}}. {{defaultLabel(site)}}</span>\n </he-node-link>\n </td>\n <td class=\"is-nowrap\" *ngFor=\"let measurement of measurements\">\n <span *ngIf=\"measurement.value.values[site['@id']]\"\n class=\"trigger-popover\"\n [ngbPopover]=\"details\" [autoClose]=\"'outside'\"\n triggers=\"manual\" #p=\"ngbPopover\" placement=\"left\" container=\"body\"\n (click)=\"togglePopover(p, { data: measurement.value.values[site['@id']], site: site, key: 'measurements' })\"\n >\n <span pointer>{{measurementValue(measurement.value.values[site['@id']]) | precision:3 | default:'-'}}</span>\n <he-blank-node-state class=\"ml-1\"\n [node]=\"measurement.value.values[site['@id']].nodes[0]\"\n key=\"value\"\n ></he-blank-node-state>\n </span>\n <span *ngIf=\"!measurement.value.values[site['@id']]\">\n <span>-</span>\n <sup class=\"pl-1\" *ngIf=\"siteTooBig(site)\">(1)</sup>\n </span>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <he-blank-node-state-notice [dataState]=\"dataState\"></he-blank-node-state-notice>\n\n <p class=\"is-size-7 is-italic\" *ngIf=\"showAreaTooBig\">\n (1) This region is >{{maxAreaSize}}km2 and is too large to reliably gap fill Measurements.\n </p>\n </div>\n\n <he-sites-measurements-logs *ngIf=\"selectedView === View.logs && !isOriginal\"\n [site]=\"sites[0]\"\n [originalValues]=\"originalValues[0].measurements\"\n [recalculatedValues]=\"sites[0].measurements\"\n ></he-sites-measurements-logs>\n</ng-container>\n\n<he-node-csv-export-confirm *ngIf=\"showDownload\"\n [nodes]=\"sites\" filename=\"site-measurements.csv\" [isUpload]=\"false\"\n [headerKeys]=\"['site.id', 'site.@id', 'site.measurements.']\"\n (closed)=\"showDownload = false\"\n></he-node-csv-export-confirm>\n\n<ng-template #emptyTable>\n <div class=\"panel-block\">\n <span>No data</span>\n </div>\n</ng-template>\n\n<ng-template #emptyValue>\n <span>-</span>\n</ng-template>\n\n<ng-template #details let-node=\"site\" let-data=\"data\" let-key=\"key\">\n <p><b>{{node.name}}</b></p>\n <he-node-value-details\n [data]=\"data\" [nodeType]=\"node['@type']\" [dataKey]=\"key\"\n ></he-node-value-details>\n</ng-template>\n", styles: ["fa-icon{display:inline-block;width:10px}\n"], components: [{ type: i1__namespace.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { type: NodeLinkComponent, selector: "he-node-link", inputs: ["node", "showExternalLink"] }, { type: BlankNodeStateComponent, selector: "he-blank-node-state", inputs: ["nodeType", "dataKey", "key", "node", "state"] }, { type: BlankNodeStateNoticeComponent, selector: "he-blank-node-state-notice", inputs: ["dataState", "showDeleted"] }, { type: SitesMeasurementsLogsComponent, selector: "he-sites-measurements-logs", inputs: ["site", "originalValues", "recalculatedValues"] }, { type: NodeCsvExportConfirmComponent, selector: "he-node-csv-export-confirm", inputs: ["nodes", "filename", "headerKeys", "extension", "isUpload"], outputs: ["closed"] }, { type: NodeValueDetailsComponent, selector: "he-node-value-details", inputs: ["data", "nodeType", "dataKey"] }], directives: [{ type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i10__namespace.NgbPopover, selector: "[ngbPopover]", inputs: ["animation", "autoClose", "placement", "triggers", "container", "disablePopover", "popoverClass", "openDelay", "closeDelay", "ngbPopover", "popoverTitle"], outputs: ["shown", "hidden"], exportAs: ["ngbPopover"] }], pipes: { "ellipsis": EllipsisPipe, "default": DefaultPipe, "precision": PrecisionPipe } });
|
|
5970
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SitesMeasurementsComponent, decorators: [{
|
|
5971
|
+
type: i0.Component,
|
|
5972
|
+
args: [{
|
|
5973
|
+
selector: 'he-sites-measurements',
|
|
5974
|
+
templateUrl: './sites-measurements.component.html',
|
|
5975
|
+
styleUrls: ['./sites-measurements.component.scss']
|
|
5976
|
+
}]
|
|
5977
|
+
}], propDecorators: { originalValues: [{
|
|
5978
|
+
type: i0.Input
|
|
5979
|
+
}], sites: [{
|
|
5980
|
+
type: i0.Input
|
|
5981
|
+
}], dataState: [{
|
|
5982
|
+
type: i0.Input
|
|
5983
|
+
}] } });
|
|
5984
|
+
|
|
5985
|
+
var components$2 = [
|
|
5986
|
+
SitesMapsComponent,
|
|
5987
|
+
SitesMeasurementsComponent,
|
|
5988
|
+
SitesMeasurementsLogsComponent
|
|
5989
|
+
];
|
|
5990
|
+
var HeSitesModule = /** @class */ (function () {
|
|
5991
|
+
function HeSitesModule() {
|
|
5987
5992
|
}
|
|
5988
|
-
|
|
5989
|
-
};
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
5993
|
+
return HeSitesModule;
|
|
5994
|
+
}());
|
|
5995
|
+
HeSitesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
5996
|
+
HeSitesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, declarations: [SitesMapsComponent,
|
|
5997
|
+
SitesMeasurementsComponent,
|
|
5998
|
+
SitesMeasurementsLogsComponent], imports: [i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
5999
|
+
HeCommonModule,
|
|
6000
|
+
HeNodeModule], exports: [SitesMapsComponent,
|
|
6001
|
+
SitesMeasurementsComponent,
|
|
6002
|
+
SitesMeasurementsLogsComponent] });
|
|
6003
|
+
HeSitesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, imports: [[
|
|
6004
|
+
i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
6005
|
+
HeCommonModule,
|
|
6006
|
+
HeNodeModule
|
|
6007
|
+
]] });
|
|
6008
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: HeSitesModule, decorators: [{
|
|
6009
|
+
type: i0.NgModule,
|
|
6010
|
+
args: [{
|
|
6011
|
+
declarations: components$2,
|
|
6012
|
+
exports: components$2,
|
|
6013
|
+
imports: [
|
|
6014
|
+
i3.CommonModule, i1$4.ReactiveFormsModule,
|
|
6015
|
+
HeCommonModule,
|
|
6016
|
+
HeNodeModule
|
|
6017
|
+
]
|
|
6018
|
+
}]
|
|
6019
|
+
}] });
|
|
6015
6020
|
|
|
6016
6021
|
var user = {};
|
|
6017
6022
|
var HeUsersService = /** @class */ (function () {
|
|
@@ -7309,6 +7314,7 @@
|
|
|
7309
7314
|
* Generated bundle index. Do not edit.
|
|
7310
7315
|
*/
|
|
7311
7316
|
|
|
7317
|
+
exports.ARRAY_DELIMITER = ARRAY_DELIMITER;
|
|
7312
7318
|
exports.BibliographiesSearchConfirmComponent = BibliographiesSearchConfirmComponent;
|
|
7313
7319
|
exports.BindOnceDirective = BindOnceDirective;
|
|
7314
7320
|
exports.BlankNodeDiffsComponent = BlankNodeDiffsComponent;
|
|
@@ -7391,43 +7397,72 @@
|
|
|
7391
7397
|
exports.availableProperties = availableProperties;
|
|
7392
7398
|
exports.baseUrl = baseUrl;
|
|
7393
7399
|
exports.bottom = bottom;
|
|
7400
|
+
exports.calculateCycleDuration = calculateCycleDuration;
|
|
7401
|
+
exports.calculateCycleDurationEnabled = calculateCycleDurationEnabled;
|
|
7402
|
+
exports.calculateCycleStartDate = calculateCycleStartDate;
|
|
7403
|
+
exports.calculateCycleStartDateEnabled = calculateCycleStartDateEnabled;
|
|
7404
|
+
exports.calculatePercentDelta = calculatePercentDelta;
|
|
7394
7405
|
exports.clustererImage = clustererImage;
|
|
7406
|
+
exports.code = code;
|
|
7395
7407
|
exports.coordinatesToPoint = coordinatesToPoint;
|
|
7396
7408
|
exports.countriesQuery = countriesQuery;
|
|
7397
7409
|
exports.createMarker = createMarker;
|
|
7398
7410
|
exports.cropsQuery = cropsQuery;
|
|
7411
|
+
exports.customDeltaFuncs = customDeltaFuncs;
|
|
7412
|
+
exports.dataPathToKey = dataPathToKey;
|
|
7399
7413
|
exports.dataValue = dataValue;
|
|
7400
7414
|
exports.defaultFeature = defaultFeature;
|
|
7401
7415
|
exports.defaultLabel = defaultLabel;
|
|
7416
|
+
exports.defaultSuggestionType = defaultSuggestionType;
|
|
7402
7417
|
exports.definitionToSchemaType = definitionToSchemaType;
|
|
7403
7418
|
exports.delta = delta;
|
|
7404
7419
|
exports.deserializeSearchFilters = deserializeSearchFilters;
|
|
7405
7420
|
exports.ellipsis = ellipsis;
|
|
7406
7421
|
exports.emptyValue = emptyValue;
|
|
7422
|
+
exports.errorHasError = errorHasError;
|
|
7423
|
+
exports.errorHasWarning = errorHasWarning;
|
|
7407
7424
|
exports.errorText = errorText;
|
|
7425
|
+
exports.evaluateSuccess = evaluateSuccess;
|
|
7408
7426
|
exports.filenameWithoutExt = filenameWithoutExt;
|
|
7409
7427
|
exports.fillColor = fillColor;
|
|
7410
7428
|
exports.fillStyle = fillStyle;
|
|
7429
|
+
exports.filterError = filterError;
|
|
7411
7430
|
exports.filterParams = filterParams;
|
|
7431
|
+
exports.findConfigModels = findConfigModels;
|
|
7432
|
+
exports.findProperty = findProperty;
|
|
7412
7433
|
exports.findPropertyById = findPropertyById;
|
|
7434
|
+
exports.formatCustomErrorMessage = formatCustomErrorMessage;
|
|
7435
|
+
exports.formatDiffValues = formatDiffValues;
|
|
7436
|
+
exports.formatError = formatError;
|
|
7437
|
+
exports.formatLinkNodesSuggestions = formatLinkNodesSuggestions;
|
|
7438
|
+
exports.formatPropertyError = formatPropertyError;
|
|
7439
|
+
exports.formatSuggestion = formatSuggestion;
|
|
7413
7440
|
exports.gitBranch = gitBranch;
|
|
7414
7441
|
exports.gitHome = gitHome;
|
|
7415
7442
|
exports.gitRawBaseUrl = gitRawBaseUrl;
|
|
7443
|
+
exports.groupChanged = groupChanged;
|
|
7416
7444
|
exports.groupNodesByTerm = groupNodesByTerm;
|
|
7417
7445
|
exports.grouppedKeys = grouppedKeys;
|
|
7418
7446
|
exports.grouppedValueKeys = grouppedValueKeys;
|
|
7419
7447
|
exports.handleAPIError = handleAPIError;
|
|
7448
|
+
exports.hasError = hasError;
|
|
7449
|
+
exports.hasWarning = hasWarning;
|
|
7450
|
+
exports.isAddPropertyEnabled = isAddPropertyEnabled;
|
|
7420
7451
|
exports.isChrome = isChrome;
|
|
7421
7452
|
exports.isExternal = isExternal;
|
|
7453
|
+
exports.isMissingOneOfError = isMissingOneOfError;
|
|
7454
|
+
exports.isMissingPropertyError = isMissingPropertyError;
|
|
7422
7455
|
exports.isSchemaIri = isSchemaIri;
|
|
7423
7456
|
exports.isScrolledBelow = isScrolledBelow;
|
|
7424
7457
|
exports.itemColor = itemColor;
|
|
7458
|
+
exports.keyToDataPath = keyToDataPath;
|
|
7425
7459
|
exports.keyToLabel = keyToLabel;
|
|
7426
7460
|
exports.levels = levels;
|
|
7427
7461
|
exports.linkTypeEnabled = linkTypeEnabled;
|
|
7428
7462
|
exports.listColor = listColor;
|
|
7429
7463
|
exports.locationQuery = locationQuery;
|
|
7430
7464
|
exports.lookupUrl = lookupUrl;
|
|
7465
|
+
exports.lookups = lookups;
|
|
7431
7466
|
exports.mapsUrl = mapsUrl;
|
|
7432
7467
|
exports.markerIcon = markerIcon;
|
|
7433
7468
|
exports.markerPie = markerPie;
|
|
@@ -7447,22 +7482,36 @@
|
|
|
7447
7482
|
exports.matchType = matchType;
|
|
7448
7483
|
exports.maxAreaSize = maxAreaSize;
|
|
7449
7484
|
exports.measurementValue = measurementValue;
|
|
7485
|
+
exports.missingNodeErrorMessage = missingNodeErrorMessage;
|
|
7486
|
+
exports.missingNodeErrors = missingNodeErrors;
|
|
7450
7487
|
exports.multiMatchQuery = multiMatchQuery;
|
|
7488
|
+
exports.nestedProperty = nestedProperty;
|
|
7451
7489
|
exports.nestingEnabled = nestingEnabled;
|
|
7452
7490
|
exports.nestingTypeEnabled = nestingTypeEnabled;
|
|
7491
|
+
exports.nodeAvailableProperties = nodeAvailableProperties;
|
|
7492
|
+
exports.nodeLink = nodeLink;
|
|
7453
7493
|
exports.nodeLogsUrl = nodeLogsUrl;
|
|
7454
7494
|
exports.nodeUrl = nodeUrl;
|
|
7455
7495
|
exports.numberGte = numberGte;
|
|
7496
|
+
exports.parentKey = parentKey;
|
|
7497
|
+
exports.parentProperty = parentProperty;
|
|
7456
7498
|
exports.parseData = parseData;
|
|
7499
|
+
exports.parseDataPath = parseDataPath;
|
|
7457
7500
|
exports.parseLines = parseLines;
|
|
7458
7501
|
exports.parseMessage = parseMessage;
|
|
7502
|
+
exports.parseNewValue = parseNewValue;
|
|
7503
|
+
exports.pathToApiDocsPath = pathToApiDocsPath;
|
|
7459
7504
|
exports.pointToCoordinates = pointToCoordinates;
|
|
7460
7505
|
exports.polygonBounds = polygonBounds;
|
|
7461
7506
|
exports.polygonToCoordinates = polygonToCoordinates;
|
|
7462
7507
|
exports.polygonsFromFeature = polygonsFromFeature;
|
|
7463
7508
|
exports.primaryProduct = primaryProduct;
|
|
7509
|
+
exports.propertyError = propertyError;
|
|
7510
|
+
exports.propertyId = propertyId;
|
|
7464
7511
|
exports.propertyValue = propertyValue$1;
|
|
7512
|
+
exports.recursiveProperties = recursiveProperties;
|
|
7465
7513
|
exports.refToSchemaType = refToSchemaType;
|
|
7514
|
+
exports.refreshPropertyKeys = refreshPropertyKeys;
|
|
7466
7515
|
exports.regionsQuery = regionsQuery;
|
|
7467
7516
|
exports.repeat = repeat;
|
|
7468
7517
|
exports.roundValue = roundValue;
|
|
@@ -7476,8 +7525,11 @@
|
|
|
7476
7525
|
exports.searchResultsFields = searchResultsFields;
|
|
7477
7526
|
exports.searchableTypes = searchableTypes;
|
|
7478
7527
|
exports.serializeSearchFilters = serializeSearchFilters;
|
|
7528
|
+
exports.siblingProperty = siblingProperty;
|
|
7529
|
+
exports.singleProperty = singleProperty;
|
|
7479
7530
|
exports.siteTooBig = siteTooBig;
|
|
7480
7531
|
exports.sortOrder = sortOrder;
|
|
7532
|
+
exports.sortProperties = sortProperties;
|
|
7481
7533
|
exports.strokeColor = strokeColor;
|
|
7482
7534
|
exports.strokeStyle = strokeStyle;
|
|
7483
7535
|
exports.suggestMatchQuery = suggestMatchQuery;
|
|
@@ -7491,6 +7543,8 @@
|
|
|
7491
7543
|
exports.termTypeLookupUrl = termTypeLookupUrl;
|
|
7492
7544
|
exports.toCsv = toCsv$1;
|
|
7493
7545
|
exports.toDashCase = toDashCase;
|
|
7546
|
+
exports.typeToNewProperty = typeToNewProperty;
|
|
7547
|
+
exports.updateProperties = updateProperties;
|
|
7494
7548
|
exports.valueTypeToDefault = valueTypeToDefault;
|
|
7495
7549
|
exports.waitFor = waitFor;
|
|
7496
7550
|
exports.wildcardQuery = wildcardQuery;
|