forked from craftbeerpi/craftbeerpi4-ui
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I can't say for sure if it's a feature request or a bug report. When creating an extension, I use Property. The Number and Text class methods have a default_value property. But I don't see it being used anywhere. So it should be for user information, but I don't see it being used in the ui code either. I see that the PropsEdit component is used to manage the properties of actors, sensors, etc. The default_value comes there, and it can be used there. As an example, I wrote a simple monkey-patch function for TextField fields, and it seems to work. But of course you know how to do it correctly.
export const patchTextField = (item, data) => {
const result = {}
if (
data[item.label] === undefined &&
item.default_value !== undefined &&
item.default_value !== null
) {
result.sx = {
input: {
color: '#999999'
}
}
}
result.value = data[item.label] ?? item.default_value
return result
}Metadata
Metadata
Assignees
Labels
No labels