forked from extern/egroupware
Get fw sidebox sortable items working with sortablejs and removes the jquery.sortable
This commit is contained in:
parent
90b737bc18
commit
24d5f01719
@ -25,7 +25,7 @@ import './fw_browser.js';
|
|||||||
import './fw_ui.js';
|
import './fw_ui.js';
|
||||||
import './fw_classes.js';
|
import './fw_classes.js';
|
||||||
import '../jsapi/egw_inheritance.js';
|
import '../jsapi/egw_inheritance.js';
|
||||||
|
import "sortablejs/Sortable.min.js";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {DOMWindow} window
|
* @param {DOMWindow} window
|
||||||
@ -48,31 +48,15 @@ import '../jsapi/egw_inheritance.js';
|
|||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
this._super.apply(this,arguments);
|
this._super.apply(this,arguments);
|
||||||
|
let self = this;
|
||||||
this.setBottomLine(this.parent.entries);
|
this.setBottomLine(this.parent.entries);
|
||||||
//Make the base Div sortable. Set all elements with the style "egw_fw_ui_sidemenu_entry_header"
|
|
||||||
//as handle
|
Sortable.create(this.elemDiv,{
|
||||||
if(jQuery(this.elemDiv).data('uiSortable'))
|
onSort: function (evt) {
|
||||||
{
|
self.parent.isDraged = true;
|
||||||
jQuery(this.elemDiv).sortable("destroy");
|
self.parent.refreshSort();
|
||||||
}
|
|
||||||
jQuery(this.elemDiv).sortable({
|
|
||||||
handle: ".egw_fw_ui_sidemenu_entry_header",
|
|
||||||
distance: 15,
|
|
||||||
start: function(event, ui)
|
|
||||||
{
|
|
||||||
var parent = ui.item.context._parent;
|
|
||||||
parent.isDraged = true;
|
|
||||||
parent.parent.startDrag.call(parent.parent);
|
|
||||||
},
|
},
|
||||||
stop: function(event, ui)
|
direction: 'vertical'
|
||||||
{
|
|
||||||
var parent = ui.item.context._parent;
|
|
||||||
parent.parent.stopDrag.call(parent.parent);
|
|
||||||
parent.parent.refreshSort.call(parent.parent);
|
|
||||||
},
|
|
||||||
opacity: 0.7,
|
|
||||||
axis: 'y'
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -107,31 +91,6 @@ import '../jsapi/egw_inheritance.js';
|
|||||||
this._super.apply(this,arguments);
|
this._super.apply(this,arguments);
|
||||||
this.sortCallback = _sortCallback;
|
this.sortCallback = _sortCallback;
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
startDrag: function()
|
|
||||||
{
|
|
||||||
if (this.activeEntry)
|
|
||||||
{
|
|
||||||
jQuery(this.activeEntry.marker).show();
|
|
||||||
jQuery(this.elemDiv).sortable("refresh");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
stopDrag: function()
|
|
||||||
{
|
|
||||||
if (this.activeEntry)
|
|
||||||
{
|
|
||||||
jQuery(this.activeEntry.marker).hide();
|
|
||||||
jQuery(this.elemDiv).sortable("refresh");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the sidemenu elements whenever they were sorted. An array containing
|
* Called by the sidemenu elements whenever they were sorted. An array containing
|
||||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -12,7 +12,8 @@
|
|||||||
"carbon-components": "^10.37.0",
|
"carbon-components": "^10.37.0",
|
||||||
"carbon-web-components": "^1.14.1",
|
"carbon-web-components": "^1.14.1",
|
||||||
"lit-element": "^2.5.1",
|
"lit-element": "^2.5.1",
|
||||||
"lit-html": "^1.4.1"
|
"lit-html": "^1.4.1",
|
||||||
|
"sortablejs": "^1.14.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.14.6",
|
"@babel/core": "^7.14.6",
|
||||||
@ -31,6 +32,9 @@
|
|||||||
"rollup-plugin-terser": "^7.0.2",
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"terser": "^4.8.0",
|
"terser": "^4.8.0",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
@ -2994,6 +2998,11 @@
|
|||||||
"is-arrayish": "^0.3.1"
|
"is-arrayish": "^0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sortablejs": {
|
||||||
|
"version": "1.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.14.0.tgz",
|
||||||
|
"integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w=="
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.5.7",
|
"version": "0.5.7",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||||
@ -5704,6 +5713,11 @@
|
|||||||
"is-arrayish": "^0.3.1"
|
"is-arrayish": "^0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sortablejs": {
|
||||||
|
"version": "1.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.14.0.tgz",
|
||||||
|
"integrity": "sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w=="
|
||||||
|
},
|
||||||
"source-map": {
|
"source-map": {
|
||||||
"version": "0.5.7",
|
"version": "0.5.7",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
"carbon-components": "^10.37.0",
|
"carbon-components": "^10.37.0",
|
||||||
"carbon-web-components": "^1.14.1",
|
"carbon-web-components": "^1.14.1",
|
||||||
"lit-element": "^2.5.1",
|
"lit-element": "^2.5.1",
|
||||||
"lit-html": "^1.4.1"
|
"lit-html": "^1.4.1",
|
||||||
|
"sortablejs": "^1.14.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user