diff --git a/content/developer/reference/frontend/fields.rst b/content/developer/reference/frontend/fields.rst index eb6620ef4..5ac24d1f7 100644 --- a/content/developer/reference/frontend/fields.rst +++ b/content/developer/reference/frontend/fields.rst @@ -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 ` - `boolean_favorite` - `boolean` - - description... + - * - :ref:`BooleanField ` - `boolean` - `boolean` @@ -107,89 +107,89 @@ Reference List * - :ref:`BooleanToggleField ` - `boolean_toggle` - `boolean` - - description... + - * - :ref:`CharField ` - `char` - `char` - - description... + - * - :ref:`ColorField ` - `color` - `char` - - description... + - * - :ref:`ColorPickerField ` - `color_picker` - `integer` - - description... + - * - :ref:`DateField ` - `date` - `date`, `datetime` - - description... + - * - :ref:`DateTimeField ` - `datetime` - `datetime` - - description... + - * - :ref:`EmailField ` - - `text` + - `email` - `char` - display email addresses * - :ref:`HandleField ` - `handle` - `integer` - - description... + - * - :ref:`ImageField ` - `image` - `binary` - - description... + - * - :ref:`Many2ManyCheckboxesField ` - `many2many_checkboxes` - `many2many` - - description... + - * - :ref:`Many2ManyTagsField ` - `many2many_tags` - `many2many` - - description... + - * - :ref:`Many2oneField ` - `many2one` - `many2one` - - description... + - * - :ref:`PercentageField ` - - `text` + - `percentage` - `float` - display percentages * - :ref:`PhoneField ` - - `text` + - `phone` - `char`, `integer` - display phone numbers * - :ref:`PriorityField ` - `priority` - `selection` - - description... + - * - :ref:`RadioField ` - `radio` - `many2one`, `selection` - - description... + - * - :ref:`RemainingDaysField ` - `remaining_days` - `date`, `datetime` - - description... + - * - :ref:`SelectionField ` - `selection` - `selection` - - description... + - * - :ref:`StatInfoField ` - `statinfo` - `float`, `integer` - - description... + - * - :ref:`StatusBarField ` - `statusbar` - `many2one`, `selection` - - description... + - * - :ref:`TextField ` - `text` - `html`, `text` - - description... + - * - :ref:`UrlField ` - - `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 - + .. _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 - + .. _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 + + + .. _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 + + + +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 + + + .. _frontend/fields/color_picker_field: @@ -264,6 +296,10 @@ ColorPickerField - Technical name: `color_picker` - Supported types: `integer` +.. code-block:: xml + + + .. _frontend/fields/date_field: @@ -274,6 +310,10 @@ DateField - Technical name: `date` - Supported types: `date`, `datetime` +.. code-block:: xml + + + .. _frontend/fields/datetime_field: @@ -284,6 +324,11 @@ DateTimeField - Technical name: `datetime` - Supported types: `datetime` +.. code-block:: xml + + + + .. _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 + + + .. _frontend/fields/image_field: @@ -316,6 +366,10 @@ ImageField - Technical name: `image` - Supported types: `binary` +.. code-block:: xml + + + .. _frontend/fields/many2many_checkboxes_field: @@ -326,6 +380,10 @@ Many2ManyCheckboxesField - Technical name: `many2many_checkboxes` - Supported types: `many2many` +.. code-block:: xml + + + .. _frontend/fields/many2many_tags_field: @@ -336,6 +394,10 @@ Many2ManyTagsField - Technical name: `many2many_tags` - Supported types: `many2many` +.. code-block:: xml + + + .. _frontend/fields/many2one_field: @@ -346,6 +408,22 @@ Many2OneField - Technical name: `many2one` - Supported types: `many2one` +.. code-block:: xml + + + +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 @@ -355,12 +433,13 @@ PercentageField - Technical name: `percentage` - Supported types: `float` -The `PercentageField` component represents a percentage. To use the field, you must give a +The `PercentageField` component represents a percentage. To use the field, you must give a float value. Then, the field will format and display the value to a percentage, using a single decimal (e.g. `0.5671` would be converted to `56.7%`). When the user enters the edit mode, the -value is still visible as a percentage, but the inner value is not rounded this time. In 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 + + + .. _frontend/fields/radio_field: @@ -394,6 +478,21 @@ RadioField - Technical name: `radio` - Supported types: `many2one`, `selection` +.. code-block:: xml + + + +`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 + + + +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 `