Add a Option, to mark the "default" Binding Property or Attribute (low prio)
jogibear9988 opened this issue · 5 comments
I use the CustomElement Manifest in a designer app. In this designer app you can Drag&Drop Properties from your DataModel to an Element. It will then create automaticly a default Binding. For example if you drag on a "input" it will automaticly bind to "value" property.
it would be nice if we could create a "hint" wich you could add to the spec to allow define a default.
While my usage of the manifest currently gives defaults where available: https://unpkg.com/browse/@spectrum-web-components/textfield@0.10.1/custom-elements.json#L385 I can see how "hints" would be quite different and useful in the right context. Before thinking about what that might look like within the manifest context, how might you expect a developer to provide those to a consumer through code today?
I don't want the default value. I want to know wich is the default property.
Maybe we could add a additional decorator, so the customer could add that to typescript code...
I've created a UI for "iobroker" with my designer. Now the Customer add's a custom Slider to the UI. When he now selects a Signal from the "objects" view on the left side, and drop's it to the control, I need to know for wich property I should create a Binding. The customer can modify this later, but I'd like to have a usefull default.
I think I understand the request here even less in that case. Could you share some examples of components you've seen in the wild and what you think the "default property" for those elements might be? It would seem that you're making some inference here that could be built into an editor (e.g. this value is a string
and I have only one (or a constrained number of) string
property), but I'm currently having trouble seeing the value of this in the schema to the element itself and/or other consumption contexts.
for example in your spectrum components
sp-checkbox => default should be checked property
sp-color-area => color property
sp-meter => progress property
sp-switch => value property
...
other examples:
iron-list => items or selectedItem
maybe we could also have multiple defaults (per property type one). So if I bind a iron-list to a array, as standard the "items" is used, if I bind to an object "selectedItem" is use.
This as a whole should only be an hint.
If you'd like to bind a "range" silder to a "sp-meter" I'd like that the designer automaticaly suggest the user to bind "value" of range to "progress" of meter.