solid-widget

Take a name as an attribute and a HTML template, and create an HTML custom element you can use as a widget. i.e.

<!-- Your custom widget to display a customer... -->
<solid-widget name="my-custom-widget">
  <template>
    <h2>Customer name: ${value.name}</h2>
  </template>
</solid-widget>

<!-- ... used in a solid-display -->
<solid-display
  data-src="http://server/projects/"
  fields="name, customer"
  widget-customer="my-custom-widget"
></solid-display>

In a solid-widget, you have access to these values:

  • id: id of the displayed resource

  • value: all the values of the current resources

  • name: name of the current field

  • label: if defined, label of the current field

  • range: if defined, range of the current field

NB: Do not forget to define your custom template in a <template> tag. Otherwise, your widget will not be declared properly.