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
@@ -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