Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-06-19 01:33:41 +02:00
commit 5ead6c6e37
5 changed files with 14 additions and 8 deletions

View file

@ -2403,7 +2403,8 @@
"de": "Wie lange darf man hier maximal parken?"
},
"freeform": {
"key": "maxstay"
"key": "maxstay",
"type": "pfloat"
},
"render": {
"en": "One can stay at most <b>{canonical(maxstay)}</b>",
@ -3329,4 +3330,4 @@
},
"neededChangesets": 10
}
}
}

View file

@ -564,7 +564,8 @@
"nl": "Hoelang mag een voertuig hier blijven staan?"
},
"freeform": {
"key": "maxstay"
"key": "maxstay",
"type": "pfloat"
},
"render": {
"en": "One can stay at most <b>{canonical(maxstay)}</b>",
@ -1049,4 +1050,4 @@
},
"neededChangesets": 10
}
}
}

View file

@ -515,7 +515,8 @@
"cs": "Jaká je šířka těchto dveří/vchodu?"
},
"freeform": {
"key": "width"
"key": "width",
"type": "pfloat"
}
},
{

View file

@ -277,10 +277,9 @@ export default class LayerConfig extends WithContextLoader {
".units: the 'units'-section should be a list; you probably have an object there"
)
}
this.units = [].concat(
...(json.units ?? []).map((unitJson, i) =>
this.units = (json.units ?? []).flatMap((unitJson, i) =>
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
)
)
if (

View file

@ -27,6 +27,10 @@ export class Unit {
) {
this.quantity = quantity
this._validator = validator
if(!inverted && ["string","text","key","icon","translation","fediverse","id"].indexOf(validator.name) >= 0){
console.trace("Unit error")
throw "Invalid unit configuration. The validator is of a forbidden type: "+validator.name+"; set a (number) type to your freeform key or set inverted. Hint: this unit is applied onto keys: "+appliesToKeys.join("; ")
}
this.inverted = inverted
this.appliesToKeys = new Set(appliesToKeys)
this.denominations = applicableDenominations