@hestia-earth/ui-components 0.1.5 → 0.1.6

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.
@@ -525,6 +525,7 @@
525
525
  var isEqual = function (a, b) { return JSON.stringify(a) === JSON.stringify(b); };
526
526
  exports.Repository = void 0;
527
527
  (function (Repository) {
528
+ Repository["frontend"] = "hestia-front-end";
528
529
  Repository["glossary"] = "hestia-glossary";
529
530
  Repository["models"] = "hestia-engine-models";
530
531
  Repository["orchestrator"] = "hestia-engine-orchestrator";
@@ -565,10 +566,16 @@
565
566
  var IssueConfirmComponent = /** @class */ (function () {
566
567
  function IssueConfirmComponent() {
567
568
  this.title = 'Submit Feedback';
569
+ this.isCommunity = false;
568
570
  this.closed = new i0.EventEmitter();
569
571
  this.Repository = exports.Repository;
570
572
  this.Template = exports.Template;
573
+ this.repositories = Object.values(exports.Repository);
571
574
  }
575
+ IssueConfirmComponent.prototype.ngOnChanges = function () {
576
+ var _this = this;
577
+ this.repositories = Object.values(exports.Repository).filter(function (value) { return value !== exports.Repository.community || _this.isCommunity; });
578
+ };
572
579
  Object.defineProperty(IssueConfirmComponent.prototype, "issueUrl", {
573
580
  get: function () {
574
581
  return this.repository && this.template ?
@@ -581,7 +588,7 @@
581
588
  return IssueConfirmComponent;
582
589
  }());
583
590
  IssueConfirmComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IssueConfirmComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
584
- IssueConfirmComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: IssueConfirmComponent, selector: "he-issue-confirm", inputs: { title: "title", repository: "repository", template: "template" }, outputs: { closed: "closed" }, ngImport: i0__namespace, template: "<div class=\"modal is-active\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">{{title}}</p>\n <button class=\"delete\" aria-label=\"close\" (click)=\"closed.next(false)\"></button>\n </header>\n <section class=\"modal-card-body\">\n <p class=\"mb-2\">Please select the type of issue from the list below to start:</p>\n\n <div class=\"field is-horizontal my-3\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"repository\">Category</label>\n </div>\n <div class=\"field-body\">\n <div class=\"field\">\n <div class=\"control is-expanded\">\n <div class=\"select is-multiple is-fullwidth\">\n <select [(ngModel)]=\"repository\" name=\"repository\" required>\n <option [ngValue]=\"undefined\">Select from the list</option>\n <option *ngFor=\"let r of Repository | keys\" [value]=\"r.value\">\n <ng-container [ngSwitch]=\"r.value\">\n <ng-container *ngSwitchCase=\"Repository.glossary\">Glossary of terms / lookup issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.models\">Calculation issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.orchestrator\">Orchestration issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.community\">UI/UX or API issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.poorenemeck\">Conversion from P&N Spreadsheet</ng-container>\n </ng-container>\n </option>\n </select>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"repository\" class=\"field is-horizontal my-3\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"template\">Issue</label>\n </div>\n <div class=\"field-body\">\n <div class=\"field\">\n <div class=\"control is-expanded\">\n <div class=\"select is-multiple is-fullwidth\">\n <select [(ngModel)]=\"template\" name=\"template\" required>\n <option [ngValue]=\"undefined\">Select from the list</option>\n <option *ngFor=\"let t of Template | keys\" [value]=\"t.value\">\n <ng-container [ngSwitch]=\"t.value\">\n <ng-container *ngSwitchCase=\"Template.bug\">I found a bug</ng-container>\n <ng-container *ngSwitchCase=\"Template.feature\">I would like a new feature</ng-container>\n </ng-container>\n </option>\n </select>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <p *ngIf=\"issueUrl\">\n <span>Please report the issue on Gitlab using</span>\n <a class=\"pl-1\" [href]=\"issueUrl\" target=\"_blank\">this link</a>.\n </p>\n </section>\n </div>\n</div>\n", styles: [""], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "keys": KeysPipe } });
591
+ IssueConfirmComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: IssueConfirmComponent, selector: "he-issue-confirm", inputs: { title: "title", repository: "repository", template: "template", isCommunity: "isCommunity" }, outputs: { closed: "closed" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"modal is-active\">\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">{{title}}</p>\n <button class=\"delete\" aria-label=\"close\" (click)=\"closed.next(false)\"></button>\n </header>\n <section class=\"modal-card-body\">\n <p class=\"mb-2\">Please select the type of issue from the list below to start:</p>\n\n <div class=\"field is-horizontal my-3\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"repository\">Category</label>\n </div>\n <div class=\"field-body\">\n <div class=\"field\">\n <div class=\"control is-expanded\">\n <div class=\"select is-multiple is-fullwidth\">\n <select [(ngModel)]=\"repository\" name=\"repository\" required>\n <option [ngValue]=\"undefined\">Select from the list</option>\n <option *ngFor=\"let repo of repositories\" [value]=\"repo\">\n <ng-container [ngSwitch]=\"repo\">\n <ng-container *ngSwitchCase=\"Repository.glossary\">Glossary of terms / lookup issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.models\">Calculation issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.orchestrator\">Orchestration issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.community\">UI/UX or API issues</ng-container>\n <ng-container *ngSwitchCase=\"Repository.poorenemeck\">Conversion from P&N Spreadsheet</ng-container>\n <ng-container *ngSwitchCase=\"Repository.frontend\">General website isssues (Download, Upload, etc.)</ng-container>\n </ng-container>\n </option>\n </select>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"repository\" class=\"field is-horizontal my-3\">\n <div class=\"field-label is-normal\">\n <label class=\"label\" for=\"template\">Issue</label>\n </div>\n <div class=\"field-body\">\n <div class=\"field\">\n <div class=\"control is-expanded\">\n <div class=\"select is-multiple is-fullwidth\">\n <select [(ngModel)]=\"template\" name=\"template\" required>\n <option [ngValue]=\"undefined\">Select from the list</option>\n <option *ngFor=\"let t of Template | keys\" [value]=\"t.value\">\n <ng-container [ngSwitch]=\"t.value\">\n <ng-container *ngSwitchCase=\"Template.bug\">I found a bug</ng-container>\n <ng-container *ngSwitchCase=\"Template.feature\">I would like a new feature</ng-container>\n </ng-container>\n </option>\n </select>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <p *ngIf=\"issueUrl\">\n <span>Please report the issue on Gitlab using</span>\n <a class=\"pl-1\" [href]=\"issueUrl\" target=\"_blank\">this link</a>.\n </p>\n </section>\n </div>\n</div>\n", styles: [""], directives: [{ type: i1__namespace$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { type: i1__namespace$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i1__namespace$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i1__namespace$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i2__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "keys": KeysPipe } });
585
592
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: IssueConfirmComponent, decorators: [{
586
593
  type: i0.Component,
587
594
  args: [{
@@ -595,6 +602,8 @@
595
602
  type: i0.Input
596
603
  }], template: [{
597
604
  type: i0.Input
605
+ }], isCommunity: [{
606
+ type: i0.Input
598
607
  }], closed: [{
599
608
  type: i0.Output
600
609
  }] } });
@@ -874,7 +883,6 @@
874
883
  children: termTypesToChildren([
875
884
  schema.TermTermType.animalManagement,
876
885
  schema.TermTermType.aquacultureManagement,
877
- schema.TermTermType.biodiversity,
878
886
  schema.TermTermType.cropEstablishment,
879
887
  schema.TermTermType.cropResidueManagement,
880
888
  schema.TermTermType.excretaManagement,
@@ -944,7 +952,6 @@
944
952
  schema.TermTermType.electricity,
945
953
  schema.TermTermType.fuel,
946
954
  schema.TermTermType.aquacultureManagement,
947
- schema.TermTermType.biodiversity,
948
955
  schema.TermTermType.cropResidueManagement,
949
956
  schema.TermTermType.animalManagement,
950
957
  schema.TermTermType.waterRegime,
@@ -7031,23 +7038,23 @@
7031
7038
  }]
7032
7039
  }] });
7033
7040
 
7034
- var _f;
7041
+ var _g;
7035
7042
  var mapErrorMessage = 'does not contain latitude and longitude';
7036
7043
  var parseDataPath = function (dataPath) {
7037
7044
  if (dataPath === void 0) { dataPath = ''; }
7038
- var _f = __read(dataPath.split('.')), _ = _f[0], paths = _f.slice(1);
7045
+ var _g = __read(dataPath.split('.')), _ = _g[0], paths = _g.slice(1);
7039
7046
  return paths.map(function (path) { return ({ path: path, label: utils.keyToLabel(path.replace(/\[\d+\]/g, '')) }); });
7040
7047
  };
7041
7048
  var contactUsEmail = 'community@hestia.earth';
7042
7049
  var externalLink = function (href, text) { return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>"; };
7043
7050
  var glossaryLink = function (text) { return externalLink(baseUrl() + "/glossary", text); };
7044
7051
  var glossaryTypeLink = function (type) { return externalLink(baseUrl() + "/glossary?termType=" + type, termTypeLabel(type)); };
7045
- var termLink = function (_f) {
7046
- var id = _f.id, name = _f.name;
7052
+ var termLink = function (_g) {
7053
+ var id = _g.id, name = _g.name;
7047
7054
  return externalLink(baseUrl() + "/term/" + id, name);
7048
7055
  };
7049
- var nodeLink = function (_f) {
7050
- var type = _f["@type"], id = _f["@id"], name = _f.name;
7056
+ var nodeLink = function (_g) {
7057
+ var type = _g["@type"], id = _g["@id"], name = _g.name;
7051
7058
  return type && id ? "<a href=\"/" + type.toLowerCase() + "/" + id + "\" target=\"_blank\">" + (name || id) + "</a>" : null;
7052
7059
  };
7053
7060
  var schemaLink = function (type, title) {
@@ -7063,21 +7070,21 @@
7063
7070
  var modelLink = function (term, model) { return "\n <a href=\"" + pathToApiDocsPath(model['@id'], term['@id']) + "\" target=\"_blank\">\n <span class=\"pr-1\">" + model.name + "</span>\n <span>(View Docs)</span>\n </a>\n"; };
7064
7071
  var threshold = function (value) { return code(value * 100 + "%"); };
7065
7072
  var noTillage = { id: 'noTillage', name: 'No tillage' };
7066
- var missingNodeErrorMessage = function (_f) {
7067
- var _t = _f["@type"], type = _f.type, name = _f.name;
7073
+ var missingNodeErrorMessage = function (_g) {
7074
+ var _t = _g["@type"], type = _g.type, name = _g.name;
7068
7075
  return (_t || type) === 'Term' ?
7069
7076
  (name ? "The term \"" + name + "\"" : 'This term') + " doesn't match a term in the " + glossaryLink('Glossary of Terms') + ".\n Please check the " + glossaryLink('Glossary') + " for the correct " + code('@id') + " or " + code('name') + " and spelling."
7070
7077
  : "This " + schemaLink(_t || type) + " does not exist in Hestia. If you are trying to link to an existing\n " + schemaLink(_t || type) + " in Hestia, please check the " + code('name') + " or " + code('@id') + " is correct.\n If you are trying to create a new " + schemaLink(_t || type) + ", please identify it with an " + code('id') + " field.";
7071
7078
  };
7072
7079
  // set message as empty to not display it
7073
- var customErrorMessage = (_f = {
7080
+ var customErrorMessage = (_g = {
7074
7081
  'should have required property \'@id\'': function () { return 'does not exist in Hestia.'; },
7075
7082
  'should have required property \'@type\'': function () { return ''; },
7076
7083
  'should have required property \'id\'': function () { return 'does not exist in Hestia.'; },
7077
7084
  'should match exactly one schema in oneOf': function () { return ''; },
7078
7085
  'should match some schema in anyOf': function () { return ''; },
7079
- 'should NOT have additional properties': function (_f, errorCount) {
7080
- var params = _f.params;
7086
+ 'should NOT have additional properties': function (_g, errorCount) {
7087
+ var params = _g.params;
7081
7088
  return errorCount === 1 ?
7082
7089
  "The following field does not exist: " + (params === null || params === void 0 ? void 0 : params.additionalProperty) :
7083
7090
  "should not have additional properties";
@@ -7086,16 +7093,21 @@
7086
7093
  'should match pattern "^[0-9]{4}(-[0-9]{2})?(-[0-9]{2})?$"': function () { return dateFormatMessage; },
7087
7094
  'should match pattern "^([0-9]{4}|-)(-[0-9]{2})?(-[0-9]{2})?$"': function () { return dateFormatMessage; },
7088
7095
  'should match pattern "^([0-9]{4}|-)(-[0-9]{2})?(-[0-9]{2})?([T][0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]((\+|\-)[0-1][0-9]:[0-5][0-9])?)?$"': function () { return dateFormatMessage; },
7096
+ 'should be linked to an existing node': function (_g) {
7097
+ var params = _g.params;
7098
+ var _a, _b, _c, _d, _e, _f;
7099
+ return "Your submission does not contain the " + ((_a = params === null || params === void 0 ? void 0 : params.node) === null || _a === void 0 ? void 0 : _a.type) + " with " + code("id=" + ((_b = params === null || params === void 0 ? void 0 : params.node) === null || _b === void 0 ? void 0 : _b.id)) + ".\n If you are trying to link to an existing " + ((_c = params === null || params === void 0 ? void 0 : params.node) === null || _c === void 0 ? void 0 : _c.type) + " on the Hestia platform, you must use " + code("@id=" + ((_d = params === null || params === void 0 ? void 0 : params.node) === null || _d === void 0 ? void 0 : _d.id)) + " instead.\n Otherwise you must include a full " + ((_e = params === null || params === void 0 ? void 0 : params.node) === null || _e === void 0 ? void 0 : _e.type) + " with id " + code((_f = params === null || params === void 0 ? void 0 : params.node) === null || _f === void 0 ? void 0 : _f.id) + ".";
7100
+ },
7089
7101
  'must be within the country': function () { return "The country provided does not contain the region provided. Please check\n the country for errors or the region for errors, and reference the " + glossaryLink('Glossary of Terms') + "."; }
7090
7102
  },
7091
- _f[mapErrorMessage] = function (_f) {
7092
- var dataPath = _f.dataPath;
7103
+ _g[mapErrorMessage] = function (_g) {
7104
+ var dataPath = _g.dataPath;
7093
7105
  return dataPath === '.region' ? "The region provided does not contain the longitude and latitude provided. Please check the\n longitude and latitude for errors or the region for error, and reference the " + glossaryLink('Glossary of Terms') + "." :
7094
7106
  "The country provided does not contain the longitude and latitude provided. Please check the longitude and latitude\n for errors or the country for errors, and reference the " + glossaryLink('Glossary of Terms') + ".";
7095
7107
  },
7096
- _f['sum not equal to 100% for sandContent, siltContent, clayContent'] = function () { return "The sum of Sand, Silt, and Clay content should equal 100% for each soil depth interval."; },
7097
- _f['is outside the allowed range'] = function (_f, errorCount) {
7098
- var params = _f.params;
7108
+ _g['sum not equal to 100% for sandContent, siltContent, clayContent'] = function () { return "The sum of Sand, Silt, and Clay content should equal 100% for each soil depth interval."; },
7109
+ _g['is outside the allowed range'] = function (_g, errorCount) {
7110
+ var params = _g.params;
7099
7111
  var _a, _b;
7100
7112
  return errorCount === 1 ?
7101
7113
  ((params === null || params === void 0 ? void 0 : params.term) ?
@@ -7103,111 +7115,112 @@
7103
7115
  "does not match the possible ranges of sand, silt and clay content.\n Please check the measurement, its depth intervals, and the dates of the measurement.") :
7104
7116
  "Each soil texture has a maximum and minimum value for sand, silt, and clay content.\n At least one measurement of sand, silt, or clay content does not match the possible range for the specified soil texture.\n Please check your measurements, their depth intervals, and the dates of the measurements.";
7105
7117
  },
7106
- _f['should be equal to one of the allowed values'] = function (_f) {
7107
- var params = _f.params;
7118
+ _g['should be equal to one of the allowed values'] = function (_g) {
7119
+ var params = _g.params;
7108
7120
  return "must have one of these values: " + (params === null || params === void 0 ? void 0 : params.allowedValues.join(', '));
7109
7121
  },
7110
- _f['is not allowed for this characterisedIndicator'] = function (_f, errorCount) {
7111
- var params = _f.params;
7122
+ _g['is not allowed for this characterisedIndicator'] = function (_g, errorCount) {
7123
+ var params = _g.params;
7112
7124
  return (errorCount === 1 ?
7113
7125
  ((params === null || params === void 0 ? void 0 : params.allowedValues.length) ?
7114
7126
  "can only be used with one of these methods: " + (params === null || params === void 0 ? void 0 : params.allowedValues.join(', ')) :
7115
7127
  "does not currently have any method allowed. Please " + contactUs() + " to change this.") + "." :
7116
7128
  "Some Terms are not allowed with the method you selected.") + "\n You can find the list of allowed methods for each Term by clicking on them.";
7117
7129
  },
7118
- _f['should contain a valid item'] = function (_f) {
7119
- var dataPath = _f.dataPath;
7130
+ _g['should contain a valid item'] = function (_g) {
7131
+ var dataPath = _g.dataPath;
7120
7132
  var paths = parseDataPath(dataPath);
7121
7133
  return paths.length >= 2 ?
7122
7134
  "The " + paths[paths.length - 1].path + " related to this " + pluralize__namespace(paths[paths.length - 2].label, 1) + " are invalid" :
7123
7135
  "The " + paths[0].path + " are invalid";
7124
7136
  },
7125
- _f['may be between 0 and 100'] = function () { return 'percentages should be between 0 and 100, not 0 and 1. This may be an error.'; },
7126
- _f['may not all be set to false'] = function () { return "Every value in the data completeness assessment is " + code('false') + ". You may have forgotten to fill it in.\n For information on how to fill it in, please see the " + schemaLink('Cycle#dataCompleteness', 'schema') + "."; },
7127
- _f['may not be empty'] = function () { return 'if this value signifies no data, Hestia only accepts "-" or empty for no data'; },
7128
- _f['may not be 0'] = function (_f, errorCount) {
7129
- var dataPath = _f.dataPath;
7137
+ _g['may be between 0 and 100'] = function () { return 'percentages should be between 0 and 100, not 0 and 1. This may be an error.'; },
7138
+ _g['may not all be set to false'] = function () { return "Every value in the data completeness assessment is " + code('false') + ". You may have forgotten to fill it in.\n For information on how to fill it in, please see the " + schemaLink('Cycle#dataCompleteness', 'schema') + "."; },
7139
+ _g['may not be empty'] = function () { return 'if this value signifies no data, Hestia only accepts "-" or empty for no data'; },
7140
+ _g['may not be 0'] = function (_g, errorCount) {
7141
+ var dataPath = _g.dataPath;
7130
7142
  var paths = parseDataPath(dataPath);
7131
7143
  return "adding a value " + (errorCount === 1 ? " to every " + paths[0].label + " " : ' ') + " is highly recommended\n as without this it is not possible to calculate the Impact Assessment.\n If the amount produced is zero, we recommend setting value to 0.";
7132
7144
  },
7133
- _f['the sum of above ground crop residue and below ground crop residue must be greater than zero'] = function () { return "For sites of type " + code(schema.SiteSiteType.cropland) + " or " + code(schema.SiteSiteType['permanent pasture']) + ",\n if data completeness is marked true for crop residue,\n the sum of the Above ground crop residue terms should be greater than zero,\n and Below ground crop residue should be greater than zero."; },
7134
- _f['longFallowPeriod must be lower than 5 years'] = function () { return "Your longFallowPeriod is greater than five years.\n Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,\n and this definition is used for Hestia also."; },
7135
- _f['should be within percentage of default value'] = function (_f, errorCount) {
7136
- var params = _f.params;
7145
+ _g['the sum of above ground crop residue and below ground crop residue must be greater than zero'] = function () { return "For sites of type " + code(schema.SiteSiteType.cropland) + " or " + code(schema.SiteSiteType['permanent pasture']) + ",\n if data completeness is marked true for crop residue,\n the sum of the Above ground crop residue terms should be greater than zero,\n and Below ground crop residue should be greater than zero."; },
7146
+ _g['longFallowPeriod must be lower than 5 years'] = function () { return "Your longFallowPeriod is greater than five years.\n Fallow is defined by FAOSTAT as land left uncultivated for between 1 and 5 years,\n and this definition is used for Hestia also."; },
7147
+ _g['should be within percentage of default value'] = function (_g, errorCount) {
7148
+ var params = _g.params;
7137
7149
  return errorCount === 1 ?
7138
7150
  "is \u00B1" + threshold(params === null || params === void 0 ? void 0 : params.threshold) + " different to our default value which is " + (params === null || params === void 0 ? void 0 : params.default) + ".\n Please check your uploaded data as this may be an error." :
7139
7151
  "is substantially different than our default value. Please check your uploaded data as this may be an error.";
7140
7152
  },
7141
- _f['the value provided is not consistent with the model result'] = function (_f, errorCount) {
7142
- var params = _f.params;
7153
+ _g['the value provided is not consistent with the model result'] = function (_g, errorCount) {
7154
+ var params = _g.params;
7143
7155
  var _a;
7144
7156
  return "The expected result for " + code(params === null || params === void 0 ? void 0 : params.term.name) + "\n " + (((_a = params === null || params === void 0 ? void 0 : params.model) === null || _a === void 0 ? void 0 : _a.name) ? "using " + modelLink(params === null || params === void 0 ? void 0 : params.term, params === null || params === void 0 ? void 0 : params.model) + " " : '') + "\n from the data provided in the upload is " + (errorCount === 1 ?
7145
7157
  code(utils.toPrecision(params === null || params === void 0 ? void 0 : params.expected, 3)) + ", but the value in the upload is " + code(utils.toPrecision(params === null || params === void 0 ? void 0 : params.current, 3)) + ".\n " + ((params === null || params === void 0 ? void 0 : params.threshold) ? "Our threshold is \u00B1" + threshold(params === null || params === void 0 ? void 0 : params.threshold) + "." : '') + "\n Please either:\n 1) check the " + (params === null || params === void 0 ? void 0 : params.term.termType) + " value you provided;\n 2) check the data you provided which is the input into this model;\n 3) carefully read the documentation to understand if we used a default property as part of the calculations." :
7146
7158
  "not consistent with the model result.");
7147
7159
  },
7148
- _f['the measurement provided might be in error'] = function (_f, errorCount) {
7149
- var params = _f.params;
7160
+ _g['the measurement provided might be in error'] = function (_g, errorCount) {
7161
+ var params = _g.params;
7150
7162
  return "The expected value for " + code(params === null || params === void 0 ? void 0 : params.term.name) + " from the data provided in the upload is " + (errorCount === 1 ?
7151
7163
  code(utils.toPrecision(params === null || params === void 0 ? void 0 : params.expected, 3)) + ", but the value in the upload is " + code(utils.toPrecision(params === null || params === void 0 ? void 0 : params.current, 3)) + ".\n " + ((params === null || params === void 0 ? void 0 : params.threshold) ? "Our threshold is \u00B1" + threshold(params === null || params === void 0 ? void 0 : params.threshold) + "." : '') :
7152
7164
  "not consistent with the model result.");
7153
7165
  },
7154
- _f['must be equal to previous product multiplied by the share'] = function () { return "Products from a transformation which are an Input in to the next transformation must follow the following rule:\n " + code('previous.product.value * current.previousTransformationShare / 100 == current.input.value'); },
7155
- _f['must have only one entry with the same term.termType = excretaManagement'] = function () { return "There can only be one Practice of type excretaManagement in a Cycle.\n To represent multiple excreta management systems either use multiple Cycles and link them together,\n or use Transformations within a Cycle and link those together."; },
7156
- _f['every item in the list should be unique'] = function (_f) {
7157
- var params = _f.params;
7166
+ _g['must be equal to previous product multiplied by the share'] = function () { return "Products from a transformation which are an Input in to the next transformation must follow the following rule:\n " + code('previous.product.value * current.previousTransformationShare / 100 == current.input.value'); },
7167
+ _g['at least one Input must be a Product of the Cycle'] = function () { return "A Transformation converts a Product from a Cycle into another Product.\n Therefore, at least one Input into the Transformation must be a Product of the Cycle."; },
7168
+ _g['must have only one entry with the same term.termType = excretaManagement'] = function () { return "There can only be one Practice of type excretaManagement in a Cycle.\n To represent multiple excreta management systems either use multiple Cycles and link them together,\n or use Transformations within a Cycle and link those together."; },
7169
+ _g['every item in the list should be unique'] = function (_g) {
7170
+ var params = _g.params;
7158
7171
  return "This Blank Node is duplicated. Every Blank Node should be unique.\n Uniqueness is determined by the following fields: " + ((params === null || params === void 0 ? void 0 : params.keys) || []).map(code).join(', ');
7159
7172
  },
7160
- _f['must contain as many items as values'] = function (_f) {
7161
- var params = _f.params, dataPath = _f.dataPath;
7173
+ _g['must contain as many items as values'] = function (_g) {
7174
+ var params = _g.params, dataPath = _g.dataPath;
7162
7175
  return "The number of " + code(dataPath.split('.').pop()) + " must match the number of " + code('value') + ".\n Currently there are " + (params === null || params === void 0 ? void 0 : params.current) + " " + code(dataPath.split('.').pop()) + " but " + (params === null || params === void 0 ? void 0 : params.expected) + " " + code('value') + ".";
7163
7176
  },
7164
- _f['is too generic'] = function (_f) {
7165
- var params = _f.params;
7177
+ _g['is too generic'] = function (_g) {
7178
+ var params = _g.params;
7166
7179
  var _a, _b, _c, _d, _e;
7167
7180
  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) + ".";
7168
7181
  },
7169
- _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'); },
7170
- _f['should be lower than max size'] = function (_f) {
7171
- var params = _f.params;
7182
+ _g['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'); },
7183
+ _g['should be lower than max size'] = function (_g) {
7184
+ var params = _g.params;
7172
7185
  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.";
7173
7186
  },
7174
- _f['an excreta input is required when using an excretaManagement practice'] = function (_f) {
7175
- var dataPath = _f.dataPath;
7187
+ _g['an excreta input is required when using an excretaManagement practice'] = function (_g) {
7188
+ var dataPath = _g.dataPath;
7176
7189
  var paths = parseDataPath(dataPath);
7177
7190
  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.";
7178
7191
  },
7179
- _f['only 1 primary product allowed'] = function () { return 'There can only be one primary product in each Cycle.'; },
7180
- _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."; },
7181
- _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."; },
7182
- _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."; },
7183
- _f['sum not equal to 100% for tillage practices'] = function () { return "The sum of " + glossaryTypeLink(schema.TermTermType.tillage) + " practices must equal 100%."; },
7184
- _f['can only have 1 tillage practice without a value'] = function (_f) {
7185
- var params = _f.params;
7192
+ _g['only 1 primary product allowed'] = function () { return 'There can only be one primary product in each Cycle.'; },
7193
+ _g['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."; },
7194
+ _g['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."; },
7195
+ _g['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."; },
7196
+ _g['sum not equal to 100% for tillage practices'] = function () { return "The sum of " + glossaryTypeLink(schema.TermTermType.tillage) + " practices must equal 100%."; },
7197
+ _g['can only have 1 tillage practice without a value'] = function (_g) {
7198
+ var params = _g.params;
7186
7199
  var _a;
7187
- 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) {
7188
- var name = _f.name;
7200
+ 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 (_g) {
7201
+ var name = _g.name;
7189
7202
  return name;
7190
7203
  }).join(' and ') + " at the same time.\n If multiple tillage practices did occur, please specify the percentage of area they occurred on.";
7191
7204
  },
7192
- _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.'; },
7205
+ _g['can not be linked to the same Cycle'] = function () { return 'You can not link an Input to the Impact Assessment of the same Cycle.'; },
7193
7206
  // deprecated, remove when message is not being used anymore
7194
- _f['must be 0 for product value 0'] = function (_f, errorCount) {
7195
- var dataPath = _f.dataPath, params = _f.params;
7207
+ _g['must be 0 for product value 0'] = function (_g, errorCount) {
7208
+ var dataPath = _g.dataPath, params = _g.params;
7196
7209
  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.";
7197
7210
  },
7198
- _f['economicValueShare must be 0 for product value 0'] = function (_f, errorCount) {
7199
- var params = _f.params;
7211
+ _g['economicValueShare must be 0 for product value 0'] = function (_g, errorCount) {
7212
+ var params = _g.params;
7200
7213
  return "If the amount produced is zero, the economicValueShare of " + (errorCount === 1 ? code(params === null || params === void 0 ? void 0 : params.term.name) : 'that product') + " must also be zero.";
7201
7214
  },
7202
- _f['revenue must be 0 for product value 0'] = function (_f, errorCount) {
7203
- var params = _f.params;
7215
+ _g['revenue must be 0 for product value 0'] = function (_g, errorCount) {
7216
+ var params = _g.params;
7204
7217
  return "If the amount produced is zero, the revenue of " + (errorCount === 1 ? code(params === null || params === void 0 ? void 0 : params.term.name) : 'that product') + " must also be zero.";
7205
7218
  },
7206
- _f['should add a source'] = function (_f) {
7207
- var params = _f.params;
7219
+ _g['should add a source'] = function (_g) {
7220
+ var params = _g.params;
7208
7221
  return "We recommend adding a Source to all data items.\n This can be done by adding the " + code(params === null || params === void 0 ? void 0 : params.current) + " field.\n Sources can also be specified for each data item (i.e., each Input, Emission, Product, Practice, Measurement, or Infrastructure).";
7209
7222
  },
7210
- _f);
7223
+ _g);
7211
7224
  var formatCustomErrorMessage = function (message, error, errorCount) {
7212
7225
  if (errorCount === void 0) { errorCount = 1; }
7213
7226
  var formattedMessage = message && message in customErrorMessage ?
@@ -7221,23 +7234,23 @@
7221
7234
  };
7222
7235
  var errorHasError = function (error) { return error && (error.level === 'error' || !error.level); };
7223
7236
  var errorHasWarning = function (error) { return error && error.level === 'warning'; };
7224
- var isMissingPropertyError = function (_f) {
7225
- var params = _f.params;
7237
+ var isMissingPropertyError = function (_g) {
7238
+ var params = _g.params;
7226
7239
  return !!params && 'missingProperty' in params;
7227
7240
  };
7228
- var isMissingOneOfError = function (_f) {
7229
- var keyword = _f.keyword, schemaPath = _f.schemaPath;
7241
+ var isMissingOneOfError = function (_g) {
7242
+ var keyword = _g.keyword, schemaPath = _g.schemaPath;
7230
7243
  return keyword === 'required' && (schemaPath || '').includes('oneOf');
7231
7244
  };
7232
- var isFailingKeywordError = function (_f) {
7233
- var params = _f.params;
7245
+ var isFailingKeywordError = function (_g) {
7246
+ var params = _g.params;
7234
7247
  return !!params && 'failingKeyword' in params;
7235
7248
  };
7236
7249
  var filterError = function (error) { return [
7237
7250
  isFailingKeywordError
7238
7251
  ].every(function (func) { return !func(error); }); };
7239
- var missingNodeErrors = function (errors) { return errors.filter(function (_f) {
7240
- var keyword = _f.keyword, params = _f.params;
7252
+ var missingNodeErrors = function (errors) { return errors.filter(function (_g) {
7253
+ var keyword = _g.keyword, params = _g.params;
7241
7254
  return keyword === 'required' && ((params === null || params === void 0 ? void 0 : params.missingProperty) === '@type' || (params === null || params === void 0 ? void 0 : params.missingProperty) === '@id');
7242
7255
  }); };
7243
7256