|
|
|
|
|
### `sib-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.
|
|
|
|
|
|
```html
|
|
|
<!-- Your custom widget to display a customer... -->
|
|
|
<sib-widget name="my-custom-widget">
|
|
|
<template>
|
|
|
<h2>Customer name: ${value.name}</h2>
|
|
|
</template>
|
|
|
</sib-widget>
|
|
|
|
|
|
<!-- ... used in a sib-display -->
|
|
|
<sib-display
|
|
|
data-src="http://server/projects/"
|
|
|
fields="name, customer"
|
|
|
widget-customer="my-custom-widget"
|
|
|
></sib-display>
|
|
|
```
|
|
|
|
|
|
In a `sib-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. |
|
|
\ No newline at end of file |