From 615db7683b63a0d3067250143bed0070722e1b29 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 3 Jul 2024 10:50:47 -0600 Subject: [PATCH] Api: Fix nm autorefresh breaks in-progress drag & drop --- .../egw_action/egwDragActionImplementation.ts | 7 +++++++ api/js/egw_action/egw_action_constants.ts | 2 ++ api/js/etemplate/et2_dataview_view_aoi.ts | 18 +++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/api/js/egw_action/egwDragActionImplementation.ts b/api/js/egw_action/egwDragActionImplementation.ts index 750b71c5b6..dcf099f48d 100644 --- a/api/js/egw_action/egwDragActionImplementation.ts +++ b/api/js/egw_action/egwDragActionImplementation.ts @@ -11,6 +11,7 @@ import {EgwActionImplementation} from "./EgwActionImplementation"; import {egw} from "../jsapi/egw_global"; import {EgwActionObjectInterface} from "./EgwActionObjectInterface"; +import {EGW_AO_STATE_DRAGGING} from "./egw_action_constants"; export class EgwDragActionImplementation implements EgwActionImplementation { type = "drag"; @@ -228,6 +229,12 @@ export class EgwDragActionImplementation implements EgwActionImplementation { // Add a basic class to the helper in order to standardize the background layout ai.helper.classList.add('et2_egw_action_ddHelper', 'ui-draggable-dragging'); document.body.append(ai.helper); + + // Set a dragging state + ai.selected.forEach((item) => + { + item.iface?.setState(ai.selected[0].iface.getState() | EGW_AO_STATE_DRAGGING); + }); this.classList.add('drag--moving'); event.dataTransfer.setData('application/json', JSON.stringify(data)) diff --git a/api/js/egw_action/egw_action_constants.ts b/api/js/egw_action/egw_action_constants.ts index fb30165f10..31986944cc 100755 --- a/api/js/egw_action/egw_action_constants.ts +++ b/api/js/egw_action/egw_action_constants.ts @@ -17,11 +17,13 @@ export const EGW_AO_STATE_NORMAL = 0x00; export const EGW_AO_STATE_SELECTED = 0x01; export const EGW_AO_STATE_FOCUSED = 0x02; export const EGW_AO_STATE_VISIBLE = 0x04; //< Can only be set by the AOI, means that the object is attached to the DOM-Tree and visible +export const EGW_AO_STATE_DRAGGING = 0x08; export type EGW_AO_STATES = typeof EGW_AO_STATE_NORMAL | typeof EGW_AO_STATE_SELECTED | typeof EGW_AO_STATE_FOCUSED | typeof EGW_AO_STATE_VISIBLE + | typeof EGW_AO_STATE_DRAGGING export const EGW_AO_EVENT_DRAG_OVER_ENTER = 0x00; export const EGW_AO_EVENT_DRAG_OVER_LEAVE = 0x01; diff --git a/api/js/etemplate/et2_dataview_view_aoi.ts b/api/js/etemplate/et2_dataview_view_aoi.ts index 3b2708d5f3..24755c7e8e 100644 --- a/api/js/etemplate/et2_dataview_view_aoi.ts +++ b/api/js/etemplate/et2_dataview_view_aoi.ts @@ -15,13 +15,14 @@ /vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js; */ +import {egwActionObjectInterface} from "../egw_action/egw_action"; import { - egwActionObjectInterface -} from "../egw_action/egw_action"; -import {EGW_AO_SHIFT_STATE_MULTI, + EGW_AO_SHIFT_STATE_MULTI, + EGW_AO_STATE_DRAGGING, EGW_AO_STATE_FOCUSED, - EGW_AO_STATE_SELECTED} from '../egw_action/egw_action_constants'; -import {egwBitIsSet, egwGetShiftState, egwPreventSelect, egwSetBit, egwUnfocus, egwIsMobile} from "../egw_action/egw_action_common"; + EGW_AO_STATE_SELECTED +} from '../egw_action/egw_action_constants'; +import {egwBitIsSet, egwGetShiftState, egwIsMobile, egwSetBit, egwUnfocus} from "../egw_action/egw_action_common"; import {_egw_active_menu} from "../egw_action/egw_menu"; import {tapAndSwipe} from "../tapandswipe"; @@ -148,10 +149,9 @@ export function et2_dataview_rowAOI(_node) this.checkBox.checked = selected; } - jQuery(this.node).toggleClass('focused', - egwBitIsSet(_state, EGW_AO_STATE_FOCUSED)); - jQuery(this.node).toggleClass('selected', - selected); + this.node.classList.toggle('focused', egwBitIsSet(_state, EGW_AO_STATE_FOCUSED)); + this.node.classList.toggle('selected', selected); + this.node.classList.toggle('drag--moving', egwBitIsSet(_state, EGW_AO_STATE_DRAGGING)); }; return aoi;