mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_widget_numeric_step: always display on touch screens; avoid layout jumping otherwise
Before this patch: - On a tablet, buttons wouldn't display (big screen; can't hover). - On a PC, fields would make layout jumps while hovering. @moduon MT-4472
This commit is contained in:
committed by
Carlos Roca
parent
2b7d748937
commit
0d3ab6c305
@@ -7,7 +7,7 @@ Web Widget Numeric Step
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:672d53d5bf482d0938c82f0a39d665f9f5d133fe3dd5401bcb9488ac95797c12
|
||||
!! source digest: sha256:404b377c03eeead0eb7b1dd03b17ecff3a4b72aff56decfdccd33e5bbcf1b8b5
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -126,6 +126,17 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
|
||||
:target: https://github.com/rafaelbn
|
||||
:alt: rafaelbn
|
||||
.. |maintainer-yajo| image:: https://github.com/yajo.png?size=40px
|
||||
:target: https://github.com/yajo
|
||||
:alt: yajo
|
||||
|
||||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-rafaelbn| |maintainer-yajo|
|
||||
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_widget_numeric_step>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
{
|
||||
"name": "Web Widget Numeric Step",
|
||||
"category": "web",
|
||||
"version": "16.0.1.0.2",
|
||||
"version": "16.0.1.1.0",
|
||||
"author": "GRAP, Tecnativa, " "Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": ["web"],
|
||||
"assets": {
|
||||
"web.assets_backend": [
|
||||
"web_widget_numeric_step/static/src/xml/numeric_step.xml",
|
||||
"web_widget_numeric_step/static/src/js/numeric_step.esm.js",
|
||||
"web_widget_numeric_step/static/src/*",
|
||||
],
|
||||
},
|
||||
"maintainers": ["rafaelbn", "yajo"],
|
||||
"auto_install": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -18,21 +18,21 @@ msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Minus"
|
||||
msgstr "Minus"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/js/numeric_step.esm.js:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.esm.js:0
|
||||
#, python-format
|
||||
msgid "Numeric Step"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Plus"
|
||||
msgstr "Plus"
|
||||
|
||||
@@ -18,21 +18,21 @@ msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Minus"
|
||||
msgstr "Menos"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/js/numeric_step.esm.js:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.esm.js:0
|
||||
#, python-format
|
||||
msgid "Numeric Step"
|
||||
msgstr "Paso Numérico"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Plus"
|
||||
msgstr "Más"
|
||||
|
||||
@@ -18,21 +18,21 @@ msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Minus"
|
||||
msgstr "Moins"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/js/numeric_step.esm.js:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.esm.js:0
|
||||
#, python-format
|
||||
msgid "Numeric Step"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Plus"
|
||||
msgstr "Plus"
|
||||
|
||||
@@ -18,21 +18,21 @@ msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Minus"
|
||||
msgstr "Meno"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/js/numeric_step.esm.js:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.esm.js:0
|
||||
#, python-format
|
||||
msgid "Numeric Step"
|
||||
msgstr "Passo numerico"
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Plus"
|
||||
msgstr "Più"
|
||||
|
||||
@@ -15,23 +15,23 @@ msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Minus"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/js/numeric_step.esm.js:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.esm.js:0
|
||||
#, python-format
|
||||
msgid "Numeric Step"
|
||||
msgstr ""
|
||||
|
||||
#. module: web_widget_numeric_step
|
||||
#. odoo-javascript
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/xml/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#: code:addons/web_widget_numeric_step/static/src/numeric_step.xml:0
|
||||
#, python-format
|
||||
msgid "Plus"
|
||||
msgstr ""
|
||||
|
||||
@@ -366,7 +366,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:672d53d5bf482d0938c82f0a39d665f9f5d133fe3dd5401bcb9488ac95797c12
|
||||
!! source digest: sha256:404b377c03eeead0eb7b1dd03b17ecff3a4b72aff56decfdccd33e5bbcf1b8b5
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/16.0/web_widget_numeric_step"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_numeric_step"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This widget changes input number field and make it easier to increment the number thanks to 2 buttons (+ and -).
|
||||
@@ -459,6 +459,8 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/rafaelbn"><img alt="rafaelbn" src="https://github.com/rafaelbn.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/16.0/web_widget_numeric_step">OCA/web</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
|
||||
@@ -9,14 +9,6 @@ export class NumericStep extends FloatField {
|
||||
setup() {
|
||||
super.setup();
|
||||
}
|
||||
_onFocusInput(ev) {
|
||||
const $el = $(ev.target).parent().find(".widget_numeric_step_btn");
|
||||
$el.removeClass("d-lg-none");
|
||||
}
|
||||
_onFocusOutInput(ev) {
|
||||
const $el = $(ev.target).find(".widget_numeric_step_btn");
|
||||
$el.addClass("d-lg-none");
|
||||
}
|
||||
_onStepClick(ev) {
|
||||
const $el = $(ev.target).parent().parent().find("input");
|
||||
$el.focus();
|
||||
@@ -65,7 +57,6 @@ export class NumericStep extends FloatField {
|
||||
NumericStep.template = "web_widget_numeric_step";
|
||||
NumericStep.props = {
|
||||
...standardFieldProps,
|
||||
name: {type: String, optional: true},
|
||||
inputType: {type: String, optional: true},
|
||||
step: {type: Number, optional: true},
|
||||
min: {type: Number, optional: true},
|
||||
14
web_widget_numeric_step/static/src/numeric_step.scss
Normal file
14
web_widget_numeric_step/static/src/numeric_step.scss
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2023 Moduon Team S.L.
|
||||
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
.widget_numeric_step {
|
||||
// Hide the buttons until the user hovers if possible
|
||||
@media (hover: hover) {
|
||||
.btn_numeric_step {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
&:hover .btn_numeric_step {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,8 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
-->
|
||||
<template>
|
||||
<t t-name="web_widget_numeric_step" owl="1">
|
||||
<div
|
||||
class="d-flex widget_numeric_step"
|
||||
t-on-mouseleave="_onFocusOutInput"
|
||||
t-on-mouseenter="_onFocusInput"
|
||||
>
|
||||
<div class="input-group-prepend d-lg-none widget_numeric_step_btn">
|
||||
<div class="d-flex widget_numeric_step">
|
||||
<div class="input-group-prepend widget_numeric_step_btn">
|
||||
<button
|
||||
class="fa fa-minus btn btn-default btn_numeric_step"
|
||||
aria-label="Minus"
|
||||
@@ -33,7 +29,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
t-on-keydown="_onKeyDown"
|
||||
t-on-wheel="_onWheel"
|
||||
/>
|
||||
<div class="input-group-append d-lg-none widget_numeric_step_btn">
|
||||
<div class="input-group-append widget_numeric_step_btn">
|
||||
<button
|
||||
class="fa fa-plus btn btn-default btn_numeric_step"
|
||||
aria-label="Plus"
|
||||
Reference in New Issue
Block a user