Merge PR #2694 into 16.0

Signed-off-by yajo
pull/2696/head
OCA-git-bot 2023-12-14 13:58:40 +00:00
commit 9258758cf7
6 changed files with 35 additions and 20 deletions

View File

@ -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:a92ee94458249bb7f5306ec54ef8f048f2fe887791c948e533c958d1cffe87f3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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.

View File

@ -12,10 +12,10 @@
"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,
}

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@ -366,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:672d53d5bf482d0938c82f0a39d665f9f5d133fe3dd5401bcb9488ac95797c12
!! source digest: sha256:a92ee94458249bb7f5306ec54ef8f048f2fe887791c948e533c958d1cffe87f3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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&amp;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 +460,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>

View File

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

View 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;
}
}

View File

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