This commit is contained in:
Michael (mcm) 2021-11-26 13:18:44 +01:00
parent 0ea53d6a0d
commit 055c4aab2c

View File

@ -45,37 +45,37 @@ The component of a field receives several props:
- Description
* - `archs`
- `object?`
- description...
-
* - `attrs`
- `object`
- description...
-
* - `id`
- `string?`
- description...
-
* - `name`
- `string`
- The field's name
* - `options`
- `object`
- description...
-
* - `readonly`
- `boolean`
- description...
-
* - `required`
- `boolean`
- description...
-
* - `record`
- `DataPoint`
- description...
-
* - `type`
- `string`
- The field's base type.
* - `update`
- `function`
- description...
-
* - `value`
- `any`
- description...
-
How to use a field
@ -99,7 +99,7 @@ Reference List
* - :ref:`BooleanFavoriteField <frontend/fields/boolean_favorite_field>`
- `boolean_favorite`
- `boolean`
- description...
-
* - :ref:`BooleanField <frontend/fields/boolean_field>`
- `boolean`
- `boolean`
@ -107,89 +107,89 @@ Reference List
* - :ref:`BooleanToggleField <frontend/fields/boolean_toggle_field>`
- `boolean_toggle`
- `boolean`
- description...
-
* - :ref:`CharField <frontend/fields/char_field>`
- `char`
- `char`
- description...
-
* - :ref:`ColorField <frontend/fields/color_field>`
- `color`
- `char`
- description...
-
* - :ref:`ColorPickerField <frontend/fields/color_picker_field>`
- `color_picker`
- `integer`
- description...
-
* - :ref:`DateField <frontend/fields/date_field>`
- `date`
- `date`, `datetime`
- description...
-
* - :ref:`DateTimeField <frontend/fields/datetime_field>`
- `datetime`
- `datetime`
- description...
-
* - :ref:`EmailField <frontend/fields/email_field>`
- `text`
- `email`
- `char`
- display email addresses
* - :ref:`HandleField <frontend/fields/handle_field>`
- `handle`
- `integer`
- description...
-
* - :ref:`ImageField <frontend/fields/image_field>`
- `image`
- `binary`
- description...
-
* - :ref:`Many2ManyCheckboxesField <frontend/fields/many2many_checkboxes_field>`
- `many2many_checkboxes`
- `many2many`
- description...
-
* - :ref:`Many2ManyTagsField <frontend/fields/many2many_tags_field>`
- `many2many_tags`
- `many2many`
- description...
-
* - :ref:`Many2oneField <frontend/fields/many2one_field>`
- `many2one`
- `many2one`
- description...
-
* - :ref:`PercentageField <frontend/fields/percentage_field>`
- `text`
- `percentage`
- `float`
- display percentages
* - :ref:`PhoneField <frontend/fields/phone_field>`
- `text`
- `phone`
- `char`, `integer`
- display phone numbers
* - :ref:`PriorityField <frontend/fields/priority_field>`
- `priority`
- `selection`
- description...
-
* - :ref:`RadioField <frontend/fields/radio_field>`
- `radio`
- `many2one`, `selection`
- description...
-
* - :ref:`RemainingDaysField <frontend/fields/remaining_days_field>`
- `remaining_days`
- `date`, `datetime`
- description...
-
* - :ref:`SelectionField <frontend/fields/selection_field>`
- `selection`
- `selection`
- description...
-
* - :ref:`StatInfoField <frontend/fields/stat_info_field>`
- `statinfo`
- `float`, `integer`
- description...
-
* - :ref:`StatusBarField <frontend/fields/statusbar_field>`
- `statusbar`
- `many2one`, `selection`
- description...
-
* - :ref:`TextField <frontend/fields/text_field>`
- `text`
- `html`, `text`
- description...
-
* - :ref:`UrlField <frontend/fields/url_field>`
- `text`
- `url`
- `char`
- display URLs
@ -203,9 +203,11 @@ BooleanFavoriteField
- Technical name: `boolean_favorite`
- Supported types: `boolean`
The `BooleanFavoriteField` is displayed as an empty (or not) star depending on a boolean value.
.. code-block:: xml
<field name="my_field" widget="boolean_favorite" />
<field name="is_favorite" widget="boolean_favorite" />
.. _frontend/fields/boolean_field:
@ -217,12 +219,11 @@ BooleanField
- Technical name: `boolean`
- Supported types: `boolean`
The `BooleanField` component represents a boolean value. It is the default field
for all fields of type `boolean`.
The `BooleanField` component represents a boolean value. It is the default field for all fields of type `boolean`.
.. code-block:: xml
<field name="my_field" widget="boolean" />
<field name="is_checked" widget="boolean" />
.. _frontend/fields/boolean_toggle_field:
@ -234,6 +235,12 @@ BooleanToggleField
- Technical name: `boolean_toggle`
- Supported types: `boolean`
The `BooleanToggleField` component displays a toggle switch to represent a boolean.
.. code-block:: xml
<field name="switch" widget="boolean_toggle" />
.. _frontend/fields/char_field:
@ -244,6 +251,27 @@ CharField
- Technical name: `char`
- Supported types: `char`
The `CharField` represents a single line text value. It is the default field for all fields of type `char`.
.. code-block:: xml
<field name="display_name" widget="char" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `autocomplete`
-
* - `password`
- if defined then displays "*" instead of the characters.
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/color_field:
@ -254,6 +282,10 @@ ColorField
- Technical name: `color`
- Supported types: `char`
.. code-block:: xml
<field name="color" widget="color" />
.. _frontend/fields/color_picker_field:
@ -264,6 +296,10 @@ ColorPickerField
- Technical name: `color_picker`
- Supported types: `integer`
.. code-block:: xml
<field name="color" widget="color_picker" />
.. _frontend/fields/date_field:
@ -274,6 +310,10 @@ DateField
- Technical name: `date`
- Supported types: `date`, `datetime`
.. code-block:: xml
<field name="invoice_date" widget="date" />
.. _frontend/fields/datetime_field:
@ -284,6 +324,11 @@ DateTimeField
- Technical name: `datetime`
- Supported types: `datetime`
.. code-block:: xml
<field name="now" widget="datetime" />
.. _frontend/fields/email_field:
EmailField
@ -297,6 +342,7 @@ The `EmailField` component represents a textual value containing an email addres
is an input with the `email` type in edit mode, and a link with an `href` in readonly mode with
the `mailto:` prefix. It opens an email application if available whenever a click is made by the user.
.. _frontend/fields/handle_field:
HandleField
@ -306,6 +352,10 @@ HandleField
- Technical name: `handle`
- Supported types: `integer`
.. code-block:: xml
<field name="sequence" widget="handle" />
.. _frontend/fields/image_field:
@ -316,6 +366,10 @@ ImageField
- Technical name: `image`
- Supported types: `binary`
.. code-block:: xml
<field name="picture" widget="image" />
.. _frontend/fields/many2many_checkboxes_field:
@ -326,6 +380,10 @@ Many2ManyCheckboxesField
- Technical name: `many2many_checkboxes`
- Supported types: `many2many`
.. code-block:: xml
<field name="options" widget="many2many_checkboxes" />
.. _frontend/fields/many2many_tags_field:
@ -336,6 +394,10 @@ Many2ManyTagsField
- Technical name: `many2many_tags`
- Supported types: `many2many`
.. code-block:: xml
<field name="tags" widget="many2many_tags" />
.. _frontend/fields/many2one_field:
@ -346,6 +408,22 @@ Many2OneField
- Technical name: `many2one`
- Supported types: `many2one`
.. code-block:: xml
<field name="currency_id" widget="many2one" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/percentage_field:
PercentageField
@ -361,6 +439,7 @@ decimal (e.g. `0.5671` would be converted to `56.7%`). When the user enters the
value is still visible as a percentage, but the inner value is not rounded this time. In the
end, the value is always saved as a float value.
.. _frontend/fields/phone_field:
PhoneField
@ -375,6 +454,7 @@ an input with the `phone` type in edit mode, and a link with an `href` in readon
The link contains the `tel:` prefix which means that it starts a call to the given number
whenever a user clicks on it.
.. _frontend/fields/priority_field:
PriorityField
@ -384,6 +464,10 @@ PriorityField
- Technical name: `priority`
- Supported types: `selection`
.. code-block:: xml
<field name="priority_level" widget="priority" />
.. _frontend/fields/radio_field:
@ -394,6 +478,21 @@ RadioField
- Technical name: `radio`
- Supported types: `many2one`, `selection`
.. code-block:: xml
<field name="question_type" widget="radio" />
`options` attribute supports the following properties:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `horizontal`
-
.. _frontend/fields/remaining_days_field:
@ -404,6 +503,21 @@ RemainingDaysField
- Technical name: `remaining_days`
- Supported types: `date`, `datetime`
.. code-block:: xml
<field name="meeting_date" widget="remaining_days" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/selection_field:
@ -412,7 +526,24 @@ SelectionField
- Location: `@web/fields/selection_field`
- Technical name: `selection`
- Supported types: `selection`
- Supported types: `many2one`, `selection`
The `SelectionField` component displays a `<select>` html tag.
.. code-block:: xml
<field name="taxes" widget="selection" placeholder="Select a tax" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/stat_info_field:
@ -424,6 +555,21 @@ StatInfoField
- Technical name: `statinfo`
- Supported types: `float`, `integer`
.. code-block:: xml
<field name="meeting_count" widget="statinfo" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/statusbar_field:
@ -434,6 +580,21 @@ StatusBarField
- Technical name: `statusbar`
- Supported types: `many2one`, `selection`
.. code-block:: xml
<field name="status" widget="statusbar" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/text_field:
@ -444,6 +605,22 @@ TextField
- Technical name: `text`
- Supported types: `html`, `text`
.. code-block:: xml
<field name="description" widget="text" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/url_field:
UrlField