Api: Fix nm autorefresh breaks in-progress drag & drop

This commit is contained in:
nathan 2024-07-03 10:50:47 -06:00
parent f60fd1a209
commit 615db7683b
3 changed files with 18 additions and 9 deletions

View File

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

View File

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

View File

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