@hestia-earth/ui-components 0.41.8 → 0.41.9
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.
|
@@ -506,6 +506,15 @@ const ignoreTermTypes = [
|
|
|
506
506
|
TermTermType.characterisedIndicator
|
|
507
507
|
];
|
|
508
508
|
const isTermTypeAllowed = (termType) => !termType || !ignoreTermTypes.includes(termType);
|
|
509
|
+
const transformFormula = (text) => text
|
|
510
|
+
.replace(/([A-Z]+[\d]+)([\d]{1}[-+])/g, '$1<sup>$2</sup>')
|
|
511
|
+
.replace(/([A-Z]+)([\d]{1})([-+])/g, '$1<sub>$2</sub><sup>$3</sup>')
|
|
512
|
+
.replace(/([A-LN-Za-ln-z])(\d+)/g, '$1<sub>$2</sub>')
|
|
513
|
+
.replace(/([A-L])([-+])/g, '$1<sup>$2</sup>')
|
|
514
|
+
.replace(/(Ox)([^A-Za-z]|$)/g, 'O<sub>x</sub>$2')
|
|
515
|
+
// handle m2, m3, etc.
|
|
516
|
+
.replace(/([m])([\d]{1})\s/g, '$1<sup>$2</sup> ')
|
|
517
|
+
.replace(/([m])([\d]{1})$/g, '$1<sup>$2</sup>');
|
|
509
518
|
/**
|
|
510
519
|
* Handles <sup> and <sub> html tags for compounds.
|
|
511
520
|
*
|
|
@@ -513,18 +522,20 @@ const isTermTypeAllowed = (termType) => !termType || !ignoreTermTypes.includes(t
|
|
|
513
522
|
* @param termType Optionally use a `TermType` to restrict the conversion further.
|
|
514
523
|
* @returns HTML version with subscript and superscript tags.
|
|
515
524
|
*/
|
|
516
|
-
const compoundToHtml = (value, termType) => isTermTypeAllowed(termType)
|
|
517
|
-
?
|
|
525
|
+
const compoundToHtml = (value, termType) => !isTermTypeAllowed(termType) || ignoreCompounds(value)
|
|
526
|
+
? value
|
|
527
|
+
: (value || '')
|
|
518
528
|
.trim()
|
|
519
|
-
.
|
|
520
|
-
.
|
|
521
|
-
.
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
529
|
+
.split(/(\[[^\]]+\]\([^)]+\))/)
|
|
530
|
+
.map(part => {
|
|
531
|
+
const match = part.match(/\[([^\]]+)\]\(([^)]+)\)/);
|
|
532
|
+
if (match) {
|
|
533
|
+
const [, linkText, url] = match;
|
|
534
|
+
return `[${transformFormula(linkText)}](${url})`;
|
|
535
|
+
}
|
|
536
|
+
return transformFormula(part);
|
|
537
|
+
})
|
|
538
|
+
.join('');
|
|
528
539
|
|
|
529
540
|
class ControlValueAccessor {
|
|
530
541
|
constructor() {
|
|
@@ -1842,11 +1853,11 @@ class ClipboardComponent {
|
|
|
1842
1853
|
}
|
|
1843
1854
|
}
|
|
1844
1855
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ClipboardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1845
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ClipboardComponent, isStandalone: true, selector: "he-clipboard", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hideText: { classPropertyName: "hideText", publicName: "hideText", isSignal: true, isRequired: false, transformFunction: null }, hideIcon: { classPropertyName: "hideIcon", publicName: "hideIcon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, clipboardClass: { classPropertyName: "clipboardClass", publicName: "clipboardClass", isSignal: true, isRequired: false, transformFunction: null }, tooltipPlacement: { classPropertyName: "tooltipPlacement", publicName: "tooltipPlacement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:copy": "onCopy($event)" } }, viewQueries: [{ propertyName: "valueNode", first: true, predicate: ["valueNode"], descendants: true, isSignal: true }, { propertyName: "tooltip", first: true, predicate: ["t"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"is-inline-block\"\n [class.is-clickable]=\"!disabled()\"\n (click)=\"onClick($event)\"\n ngbTooltip=\"Copied!\"\n triggers=\"manual\"\n [placement]=\"tooltipPlacement()\"\n container=\"body\"\n #t=\"ngbTooltip\">\n <span #valueNode [class.is-hidden]=\"hideText()\">{{ value() }}</span>\n\n @if (!hideIcon()) {\n <he-svg-icon [name]=\"icon()\" [size]=\"size()\"
|
|
1856
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: ClipboardComponent, isStandalone: true, selector: "he-clipboard", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hideText: { classPropertyName: "hideText", publicName: "hideText", isSignal: true, isRequired: false, transformFunction: null }, hideIcon: { classPropertyName: "hideIcon", publicName: "hideIcon", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, clipboardClass: { classPropertyName: "clipboardClass", publicName: "clipboardClass", isSignal: true, isRequired: false, transformFunction: null }, tooltipPlacement: { classPropertyName: "tooltipPlacement", publicName: "tooltipPlacement", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:copy": "onCopy($event)" } }, viewQueries: [{ propertyName: "valueNode", first: true, predicate: ["valueNode"], descendants: true, isSignal: true }, { propertyName: "tooltip", first: true, predicate: ["t"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"is-inline-block\"\n [class.is-clickable]=\"!disabled()\"\n (click)=\"onClick($event)\"\n ngbTooltip=\"Copied!\"\n triggers=\"manual\"\n [placement]=\"tooltipPlacement()\"\n container=\"body\"\n #t=\"ngbTooltip\">\n <span #valueNode [class.is-hidden]=\"hideText()\">{{ value() }}</span>\n\n @if (!hideIcon()) {\n <span [class]=\"clipboardClass()\">\n <he-svg-icon [name]=\"icon()\" [size]=\"size()\" />\n </span>\n }\n</div>\n", styles: [":host{display:inline-block}.is-small he-svg-icon{height:16px!important;width:16px!important}\n"], dependencies: [{ kind: "directive", type: NgbTooltip, selector: "[ngbTooltip]", inputs: ["animation", "autoClose", "placement", "popperOptions", "triggers", "positionTarget", "container", "disableTooltip", "tooltipClass", "tooltipContext", "openDelay", "closeDelay", "ngbTooltip"], outputs: ["shown", "hidden"], exportAs: ["ngbTooltip"] }, { kind: "component", type: HESvgIconComponent, selector: "he-svg-icon", inputs: ["name", "size", "animation"] }] }); }
|
|
1846
1857
|
}
|
|
1847
1858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ClipboardComponent, decorators: [{
|
|
1848
1859
|
type: Component$1,
|
|
1849
|
-
args: [{ selector: 'he-clipboard', imports: [NgbTooltip, HESvgIconComponent], template: "<div\n class=\"is-inline-block\"\n [class.is-clickable]=\"!disabled()\"\n (click)=\"onClick($event)\"\n ngbTooltip=\"Copied!\"\n triggers=\"manual\"\n [placement]=\"tooltipPlacement()\"\n container=\"body\"\n #t=\"ngbTooltip\">\n <span #valueNode [class.is-hidden]=\"hideText()\">{{ value() }}</span>\n\n @if (!hideIcon()) {\n <he-svg-icon [name]=\"icon()\" [size]=\"size()\"
|
|
1860
|
+
args: [{ selector: 'he-clipboard', imports: [NgbTooltip, HESvgIconComponent], template: "<div\n class=\"is-inline-block\"\n [class.is-clickable]=\"!disabled()\"\n (click)=\"onClick($event)\"\n ngbTooltip=\"Copied!\"\n triggers=\"manual\"\n [placement]=\"tooltipPlacement()\"\n container=\"body\"\n #t=\"ngbTooltip\">\n <span #valueNode [class.is-hidden]=\"hideText()\">{{ value() }}</span>\n\n @if (!hideIcon()) {\n <span [class]=\"clipboardClass()\">\n <he-svg-icon [name]=\"icon()\" [size]=\"size()\" />\n </span>\n }\n</div>\n", styles: [":host{display:inline-block}.is-small he-svg-icon{height:16px!important;width:16px!important}\n"] }]
|
|
1850
1861
|
}], propDecorators: { valueNode: [{ type: i0.ViewChild, args: ['valueNode', { isSignal: true }] }], tooltip: [{ type: i0.ViewChild, args: ['t', { isSignal: true }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], hideText: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideText", required: false }] }], hideIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideIcon", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], clipboardClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "clipboardClass", required: false }] }], tooltipPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPlacement", required: false }] }], onCopy: [{
|
|
1851
1862
|
type: HostListener,
|
|
1852
1863
|
args: ['window:copy', ['$event']]
|
|
@@ -8135,14 +8146,13 @@ class NodeLogsModelsComponent {
|
|
|
8135
8146
|
params: () => ({
|
|
8136
8147
|
ids: unique(this.cycle()
|
|
8137
8148
|
?.inputs?.filter((value) => inputGroupsTermTypes.includes(value?.term?.termType))
|
|
8138
|
-
?.map(v => v.term['@id'])
|
|
8139
|
-
?.filter(Boolean) ?? [])
|
|
8149
|
+
?.map(v => v.term['@id']) ?? []).filter(Boolean)
|
|
8140
8150
|
}),
|
|
8141
8151
|
stream: ({ params: { ids } }) => from(ids).pipe(mergeMap((id) => this.nodeService.get$({ '@type': NodeType.Term, '@id': id })), mergeMap(term => term.defaultProperties?.map(v => ({ id: v.key?.['@id'], group: term['@id'] }))), filter(v => !!v.id), reduce((prev, curr) => {
|
|
8142
8152
|
prev[curr.id] = prev[curr.id] || [];
|
|
8143
8153
|
prev[curr.id].push(curr.group);
|
|
8144
8154
|
return prev;
|
|
8145
|
-
}, {}))
|
|
8155
|
+
}, {}), catchError(() => of({})))
|
|
8146
8156
|
});
|
|
8147
8157
|
this.animalGroups = computed(() => (this.cycle()?.animals?.flatMap(animal => animal.inputs?.map(input => ({ id: input.term['@id'], group: animal.animalId }))) ?? [])
|
|
8148
8158
|
.filter(Boolean)
|
|
@@ -8166,7 +8176,7 @@ class NodeLogsModelsComponent {
|
|
|
8166
8176
|
? this.searchTerms({
|
|
8167
8177
|
bool: {
|
|
8168
8178
|
must: [matchType(NodeType.Term)],
|
|
8169
|
-
should: values.map(matchId),
|
|
8179
|
+
should: values.filter(Boolean).map(matchId),
|
|
8170
8180
|
minimum_should_match: 1
|
|
8171
8181
|
}
|
|
8172
8182
|
})
|
|
@@ -8226,7 +8236,7 @@ class NodeLogsModelsComponent {
|
|
|
8226
8236
|
? this.searchTerms({
|
|
8227
8237
|
bool: {
|
|
8228
8238
|
must: [matchType(NodeType.Term)],
|
|
8229
|
-
should: ids.map(
|
|
8239
|
+
should: ids.filter(Boolean).map(matchId),
|
|
8230
8240
|
minimum_should_match: 1
|
|
8231
8241
|
}
|
|
8232
8242
|
}).pipe(map(groupTerms))
|
|
@@ -10083,7 +10093,7 @@ class EngineOrchestratorEditComponent {
|
|
|
10083
10093
|
query: {
|
|
10084
10094
|
bool: {
|
|
10085
10095
|
must: [matchType(NodeType.Term)],
|
|
10086
|
-
should: ids.map(matchId),
|
|
10096
|
+
should: ids.filter(Boolean).map(matchId),
|
|
10087
10097
|
minimum_should_match: 1
|
|
10088
10098
|
}
|
|
10089
10099
|
}
|
|
@@ -10723,6 +10733,11 @@ const customErrorMessage = {
|
|
|
10723
10733
|
If it is more than 7305 days, consider using the term ${code('Other natural vegetation')} instead.`,
|
|
10724
10734
|
'must not add the feed input to the Cycle as well': ({ params: { term } = {} }) => `You have added the animal feed Input ${code(term['@id'])} to the Cycle inputs as well, which might lead to double counting.
|
|
10725
10735
|
If you do not know the amount of ${code(term['@id'])} given to each Animal, please add the Input to the Cycle only.`,
|
|
10736
|
+
'must provide value or min and max': ({ params }) => `You have provided only a ${code('max')} without a ${code('min')} or a ${code('value')}${params.term ? ` for ${termLink(params.term)}` : ''}.
|
|
10737
|
+
${params?.term?.termType === TermTermType.measurement
|
|
10738
|
+
? `This Measurement has additional restrictions and needs either a ${code('value')} or both a ${code('min')} and ${code('max')} specified.
|
|
10739
|
+
Please consider adding both the ${code('min')} and the ${code('max')}, or delete the Measurement.`
|
|
10740
|
+
: ''}`,
|
|
10726
10741
|
'must specify water type for ponds': ({ params }) => `For Sites with ${schemaLink('Site#siteType', 'siteType')} = ${code('pond')}, you must specify the ${externalNodeLink({
|
|
10727
10742
|
'@type': NodeType.Term,
|
|
10728
10743
|
'@id': 'waterSalinity',
|