From eaacaf122dff62adcdf885f0ffdcb4a506bded27 Mon Sep 17 00:00:00 2001 From: "Julien Carion (juca)" Date: Fri, 31 Mar 2023 12:59:21 +0000 Subject: [PATCH] [IMP] web, *: Add autoresize hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds two autoresize hooks for text inputs and textareas to make it adapt their size (width for text inputs, height for textareas) depending on their content. The commit therefore solves the issue of several form view task titles being restricted to 1 line while it can be annoying if the title is too long. The autoresizeTextarea feature was moved from TextField to the autoresizeTextarea hook and the autoresizeInput feature was moved from the AutoresizeInput mail component to the autoresizeInput hook. The TextField component has a new option for disabling linebreaks. task-3138826 closes odoo/odoo#117355 Related: odoo/enterprise#39493 Signed-off-by: Géry Debongnie --- addons/crm/views/crm_lead_views.xml | 2 +- addons/event/views/event_event_views.xml | 2 +- addons/hr/views/hr_job_views.xml | 2 +- .../views/hr_applicant_views.xml | 2 +- .../static/src/discuss/autoresize_input.js | 24 +---- addons/product/views/product_views.xml | 2 +- .../project/views/project_project_views.xml | 2 +- addons/project/views/project_task_views.xml | 2 +- .../static/tests/tours/sale_timesheet_tour.js | 2 +- .../survey/static/tests/tours/survey_form.js | 2 +- addons/survey/views/survey_survey_views.xml | 2 +- .../web/static/src/core/utils/autoresize.js | 85 +++++++++++++++++ .../src/views/fields/char/char_field.js | 5 +- addons/web/static/src/views/fields/field.js | 1 - .../src/views/fields/input_field_hook.js | 4 + .../src/views/fields/text/text_field.js | 51 +++-------- .../src/views/fields/text/text_field.xml | 1 - .../tests/views/fields/char_field_tests.js | 91 ++++++++++--------- .../views/slide_channel_views.xml | 2 +- odoo/addons/base/views/res_partner_views.xml | 4 +- .../static/tests/tours/main_flow.js | 10 +- 21 files changed, 172 insertions(+), 126 deletions(-) create mode 100644 addons/web/static/src/core/utils/autoresize.js diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index 5fc4ed48247..de85328986e 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -49,7 +49,7 @@
-

+