forked from extern/egroupware
Replace jquery-ui dnd with egw-touch-dnd package
This commit is contained in:
parent
8ca0d0c197
commit
19cf0faf60
@ -19,7 +19,7 @@
|
||||
import {egwAction,egwActionImplementation} from "./egw_action.js";
|
||||
import {getPopupImplementation} from "./egw_action_popup.js";
|
||||
import {EGW_AI_DRAG_OUT, EGW_AI_DRAG_OVER, EGW_AO_EXEC_THIS} from "./egw_action_constants.js";
|
||||
|
||||
import 'egw-touch-dnd/touch-dnd.js';
|
||||
/**
|
||||
* Register the drag and drop handlers
|
||||
*/
|
||||
@ -317,12 +317,9 @@ export function egwDragActionImplementation()
|
||||
}
|
||||
});
|
||||
}
|
||||
jQuery(node).draggable(
|
||||
{
|
||||
"distance": 20,
|
||||
"cursor": "move",
|
||||
"cursorAt": { top: -12, left: -12 },
|
||||
"helper": function(e) {
|
||||
let $draggable = jQuery(node).draggable({
|
||||
delay: 250,
|
||||
clone: function(e) {
|
||||
// The helper function is called before the start function
|
||||
// is evoked. Call the given callback function. The callback
|
||||
// function will gather the selected elements and action links
|
||||
@ -351,9 +348,6 @@ export function egwDragActionImplementation()
|
||||
// Return an empty div if the helper dom node is not set
|
||||
return ai.defaultDDHelper(ai.selected);//jQuery(document.createElement("div")).addClass('et2_egw_action_ddHelper');
|
||||
},
|
||||
"start": function(e) {
|
||||
return ai.helper != null;
|
||||
},
|
||||
revert: function(valid)
|
||||
{
|
||||
var dTarget = this;
|
||||
@ -388,14 +382,11 @@ export function egwDragActionImplementation()
|
||||
},
|
||||
// Solves problem with scroll position changing in the grid
|
||||
// component
|
||||
"refreshPositions": true,
|
||||
"scroll": false,
|
||||
//"containment": "document",
|
||||
"iframeFix": true,
|
||||
"delay": 300
|
||||
}
|
||||
);
|
||||
|
||||
// "refreshPositions": true,
|
||||
});
|
||||
$draggable.on('draggable:start', function(e) {
|
||||
return ai.helper != null;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -550,19 +541,18 @@ export function egwDropActionImplementation()
|
||||
|
||||
if (node)
|
||||
{
|
||||
jQuery(node).droppable(
|
||||
{
|
||||
"accept": function(_draggable) {
|
||||
let $droppable = jQuery(node).droppable({
|
||||
accept: function(_draggable) {
|
||||
if (typeof _draggable.data("ddTypes") != "undefined")
|
||||
{
|
||||
var accepted = self._fetchAccepted(
|
||||
let accepted = self._fetchAccepted(
|
||||
_callback.call(_context, "links", self, EGW_AO_EXEC_THIS));
|
||||
|
||||
// Check whether all drag types of the selected objects
|
||||
// are accepted
|
||||
var ddTypes = _draggable.data("ddTypes");
|
||||
let ddTypes = _draggable.data("ddTypes");
|
||||
|
||||
for (var i = 0; i < ddTypes.length; i++)
|
||||
for (let i = 0; i < ddTypes.length; i++)
|
||||
{
|
||||
if (accepted.indexOf(ddTypes[i]) != -1)
|
||||
{
|
||||
@ -573,21 +563,23 @@ export function egwDropActionImplementation()
|
||||
return false;
|
||||
}
|
||||
},
|
||||
"drop": function(event, ui) {
|
||||
var draggable = ui.draggable;
|
||||
var ddTypes = draggable.data("ddTypes");
|
||||
var selected = draggable.data("selected");
|
||||
hoverClass: "drop-hover",
|
||||
});
|
||||
$droppable.on('droppable:drop', function(event, ui) {
|
||||
let draggable = ui.item;
|
||||
let ddTypes = draggable.data("ddTypes");
|
||||
let selected = draggable.data("selected");
|
||||
|
||||
var links = _callback.call(_context, "links", self, EGW_AO_EXEC_THIS);
|
||||
let links = _callback.call(_context, "links", self, EGW_AO_EXEC_THIS);
|
||||
|
||||
// Disable all links which only accept types which are not
|
||||
// inside ddTypes
|
||||
for (var k in links)
|
||||
for (let k in links)
|
||||
{
|
||||
var accepted = links[k].actionObj.acceptedTypes;
|
||||
let accepted = links[k].actionObj.acceptedTypes;
|
||||
|
||||
var enabled = false;
|
||||
for (var i = 0; i < ddTypes.length; i++)
|
||||
let enabled = false;
|
||||
for (let i = 0; i < ddTypes.length; i++)
|
||||
{
|
||||
if (accepted.indexOf(ddTypes[i]) != -1)
|
||||
{
|
||||
@ -608,9 +600,9 @@ export function egwDropActionImplementation()
|
||||
}
|
||||
|
||||
// Check whether there is only one link
|
||||
var cnt = 0;
|
||||
var lnk = null;
|
||||
for (var k in links)
|
||||
let cnt = 0;
|
||||
let lnk = null;
|
||||
for (let k in links)
|
||||
{
|
||||
if (links[k].enabled && links[k].visible)
|
||||
{
|
||||
@ -638,8 +630,8 @@ export function egwDropActionImplementation()
|
||||
// This is possible as the popup and the popup action
|
||||
// object and the drop action object share same
|
||||
// set of properties.
|
||||
var popup = getPopupImplementation();
|
||||
var pos = popup._getPageXY(event.originalEvent);
|
||||
let popup = getPopupImplementation();
|
||||
let pos = popup._getPageXY(event);
|
||||
|
||||
// Don't add paste actions, this is a drop
|
||||
popup.auto_paste = false;
|
||||
@ -653,21 +645,14 @@ export function egwDropActionImplementation()
|
||||
}
|
||||
// Set cursor back to auto. Seems FF can't handle cursor reversion
|
||||
jQuery('body').css({cursor:'auto'});
|
||||
|
||||
_aoi.triggerEvent(EGW_AI_DRAG_OUT,{event: event,ui:ui});
|
||||
},
|
||||
"over": function(event, ui) {
|
||||
});
|
||||
$droppable.on('droppable:out', function(event,ui) {
|
||||
_aoi.triggerEvent(EGW_AI_DRAG_OUT,{event: event,ui:ui});
|
||||
});
|
||||
$droppable.on('droppable:over', function(event, ui) {
|
||||
_aoi.triggerEvent(EGW_AI_DRAG_OVER,{event: event,ui:ui});
|
||||
},
|
||||
"out": function(event,ui) {
|
||||
_aoi.triggerEvent(EGW_AI_DRAG_OUT,{event: event,ui:ui});
|
||||
},
|
||||
"tolerance": "pointer",
|
||||
hoverClass: "drop-hover",
|
||||
// Greedy is for nested droppables - children consume the action
|
||||
greedy: true
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -241,7 +241,6 @@ class Bundle
|
||||
// generate api bundle
|
||||
$inc_mgr->include_js_file('/vendor/bower-asset/jquery/dist/jquery.js');
|
||||
$inc_mgr->include_js_file('/api/js/jquery/jquery.noconflict.js');
|
||||
$inc_mgr->include_js_file('/vendor/bower-asset/jquery-ui/jquery-ui.js');
|
||||
$inc_mgr->include_js_file('/api/js/jsapi/jsapi.js');
|
||||
$inc_mgr->include_js_file('/api/js/egw_json.js');
|
||||
$inc_mgr->include_js_file('/api/js/jsapi/egw.js');
|
||||
|
3500
package-lock.json
generated
3500
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
||||
"@rollup/plugin-typescript": "^8.2.1",
|
||||
"@types/jquery": "^3.5.5",
|
||||
"@types/jqueryui": "^1.12.14",
|
||||
"@types/sortablejs": "1.10.0",
|
||||
"grunt": "^1.3.0",
|
||||
"grunt-contrib-cssmin": "^2.2.1",
|
||||
"grunt-newer": "^1.3.0",
|
||||
@ -49,7 +50,8 @@
|
||||
"carbon-web-components": "^1.14.1",
|
||||
"lit-element": "^2.5.1",
|
||||
"lit-html": "^1.4.1",
|
||||
"sortablejs": "^1.14.0"
|
||||
"sortablejs": "^1.14.0",
|
||||
"egw-touch-dnd": "^1.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user