[FIX] web: mobile: scroll in selection mode
This is a port of https://github.com/odoo/enterprise/pull/30046 for wowl Steps to reproduce: On a mobile device: - Go to Inventory > Product Variants - Switch to the list view - Long press on a record -> We can't scroll to select records below the current screen closes odoo/odoo#105545 X-original-commit: cd874593b2390efba8e92228f85e9cf07c0e1a8c Related: odoo/enterprise#33861 Signed-off-by: Pierre Paridans (app) <app@odoo.com> Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
This commit is contained in:
@@ -1695,17 +1695,14 @@ export class ListRenderer extends Component {
|
||||
return;
|
||||
}
|
||||
if (this.props.list.selection.length) {
|
||||
// in selection mode, only selection is allowed.
|
||||
ev.preventDefault();
|
||||
this.toggleRecordSelection(record);
|
||||
} else {
|
||||
this.touchStartMs = Date.now();
|
||||
if (this.longTouchTimer === null) {
|
||||
this.longTouchTimer = browser.setTimeout(() => {
|
||||
this.toggleRecordSelection(record);
|
||||
this.resetLongTouchTimer();
|
||||
}, this.constructor.LONG_TOUCH_THRESHOLD);
|
||||
}
|
||||
ev.stopPropagation(); // This is done in order to prevent the tooltip from showing up
|
||||
}
|
||||
this.touchStartMs = Date.now();
|
||||
if (this.longTouchTimer === null) {
|
||||
this.longTouchTimer = browser.setTimeout(() => {
|
||||
this.toggleRecordSelection(record);
|
||||
this.resetLongTouchTimer();
|
||||
}, this.constructor.LONG_TOUCH_THRESHOLD);
|
||||
}
|
||||
}
|
||||
onRowTouchEnd(record) {
|
||||
@@ -1753,6 +1750,24 @@ export class ListRenderer extends Component {
|
||||
* @param {HTMLElement} [params.group]
|
||||
*/
|
||||
sortStop() {}
|
||||
|
||||
ignoreEventInSelectionMode(ev) {
|
||||
const { list } = this.props;
|
||||
if (this.env.isSmall && list.selection && list.selection.length) {
|
||||
// in selection mode, only selection is allowed.
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
onClickCapture(record, ev) {
|
||||
const { list } = this.props;
|
||||
if (this.env.isSmall && list.selection && list.selection.length) {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
this.toggleRecordSelection(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListRenderer.template = "web.ListRenderer";
|
||||
|
||||
@@ -209,6 +209,10 @@
|
||||
<tr class="o_data_row"
|
||||
t-att-class="getRowClass(record)"
|
||||
t-att-data-id="record.id"
|
||||
t-on-click.capture="(ev) => this.onClickCapture(record, ev)"
|
||||
t-on-mouseover.capture="(ev) => this.ignoreEventInSelectionMode(ev)"
|
||||
t-on-mouseout.capture="(ev) => this.ignoreEventInSelectionMode(ev)"
|
||||
t-on-mouseenter.capture="(ev) => this.ignoreEventInSelectionMode(ev)"
|
||||
t-on-touchstart="(ev) => this.onRowTouchStart(record, ev)"
|
||||
t-on-touchend="() => this.onRowTouchEnd(record)"
|
||||
t-on-touchmove="() => this.onRowTouchMove(record)"
|
||||
|
||||
Reference in New Issue
Block a user