Tree Picker: Ensure min/max are numeric

There is a scenario where the `config.getValueByAlias('maxNumber')`
would return as a `string`. This would cause issues further down when
they are strongly-typed compared, e.g. `max === 1` would be false.

I experienced this issue with the Tree Picker, for setting the
`multiple` property value.
This commit is contained in:
leekelleher
2024-01-04 15:33:55 +00:00
committed by Jacob Overgaard
parent 35bbc472a6
commit 6c76b0292b

View File

@@ -45,8 +45,10 @@ export class UmbPropertyEditorUITreePickerElement extends UmbLitElement implemen
this.startNodeId = startNode.id;
}
this.min = config?.getValueByAlias('minNumber') || 0;
this.max = config?.getValueByAlias('maxNumber') || 0;
// TODO: The value from `config.getValueByAlias('maxNumber')` could be a `string`, can't be cast as a `number`. [LK]
// This causes issues when the `max` value is compared against other numbers, e.g. `max === 1` would be false.
this.min = Number(config?.getValueByAlias('minNumber')) || 0;
this.max = Number(config?.getValueByAlias('maxNumber')) || 0;
this.filter = config?.getValueByAlias('filter');
this.showOpenButton = config?.getValueByAlias('showOpenButton');