forked from extern/egroupware
fix ESM module import (no currly brackets) as suggested by Guy Bedford
This commit is contained in:
parent
23c27659fc
commit
72699fad30
@ -67,6 +67,7 @@ import {et2_template} from "./et2_widget_template";
|
|||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {et2_compileLegacyJS} from "./et2_core_legacyJSFunctions";
|
import {et2_compileLegacyJS} from "./et2_core_legacyJSFunctions";
|
||||||
import {egwIsMobile} from "../egw_action/egw_action_common.js";
|
import {egwIsMobile} from "../egw_action/egw_action_common.js";
|
||||||
|
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||||
|
|
||||||
//import {et2_selectAccount} from "./et2_widget_SelectAccount";
|
//import {et2_selectAccount} from "./et2_widget_SelectAccount";
|
||||||
|
|
||||||
@ -2079,17 +2080,13 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
};
|
};
|
||||||
const $select = jQuery(select.getDOMNode());
|
const $select = jQuery(select.getDOMNode());
|
||||||
|
|
||||||
//todo (todo-jquery-ui): fix the sortable import statement
|
let sortablejs = Sortable.create(select.getDOMNode().getElementsByClassName('ui-multiselect-checkboxes')[0], {
|
||||||
import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
|
ghostClass: 'ui-fav-sortable-placeholder',
|
||||||
let sortablejs = Sortable.create(select.getDOMNode().getElementsByClassName('ui-multiselect-checkboxes')[0], {
|
draggable: 'li[class^="selcolumn_sortable_col"]',
|
||||||
ghostClass: 'ui-fav-sortable-placeholder',
|
filter: 'li[class^="selcolumn_sortable_#"]',
|
||||||
draggable: 'li[class^="selcolumn_sortable_col"]',
|
direction: 'vertical',
|
||||||
filter: 'li[class^="selcolumn_sortable_#"]',
|
delay: 25,
|
||||||
direction: 'vertical',
|
});
|
||||||
delay: 25,
|
|
||||||
|
|
||||||
});
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
$select.disableSelection();
|
$select.disableSelection();
|
||||||
$select.find('li[class^="selcolumn_sortable_"]').each(function(i,v){
|
$select.find('li[class^="selcolumn_sortable_"]').each(function(i,v){
|
||||||
|
@ -19,6 +19,7 @@ import {et2_INextmatchHeader} from "./et2_extension_nextmatch";
|
|||||||
import {et2_dropdown_button} from "./et2_widget_dropdown_button";
|
import {et2_dropdown_button} from "./et2_widget_dropdown_button";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {egw, egw_getFramework} from "../jsapi/egw_global";
|
import {egw, egw_getFramework} from "../jsapi/egw_global";
|
||||||
|
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Favorites widget, designed for use with a nextmatch widget
|
* Favorites widget, designed for use with a nextmatch widget
|
||||||
@ -177,25 +178,22 @@ export class et2_favorites extends et2_dropdown_button implements et2_INextmatch
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//todo (@todo-jquery-ui): replace the import statement
|
|
||||||
/**
|
/**
|
||||||
* todo (@todo-jquery-ui): the sorting does not work at the moment becuase of jquery-ui menu being used in order to create dropdown
|
* todo (@todo-jquery-ui): the sorting does not work at the moment becuase of jquery-ui menu being used in order to create dropdown
|
||||||
* buttons menu. Once we replace the et2_widget_dropdown_button with web component this should be adapted
|
* buttons menu. Once we replace the et2_widget_dropdown_button with web component this should be adapted
|
||||||
* and working again.
|
* and working again.
|
||||||
**/
|
**/
|
||||||
import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
|
let sortablejs = Sortable.create(this.menu[0], {
|
||||||
let sortablejs = Sortable.create(this.menu[0], {
|
ghostClass: 'ui-fav-sortable-placeholder',
|
||||||
ghostClass: 'ui-fav-sortable-placeholder',
|
draggable: 'li:not([data-id$="add"])',
|
||||||
draggable: 'li:not([data-id$="add"])',
|
delay: 25,
|
||||||
delay: 25,
|
dataIdAttr:'data-id',
|
||||||
dataIdAttr:'data-id',
|
onSort: function(event){
|
||||||
onSort: function(event){
|
self.favSortedList = sortablejs.toArray();
|
||||||
self.favSortedList = sortablejs.toArray();
|
self.egw.set_preference(self.options.app,'fav_sort_pref', self.favSortedList );
|
||||||
self.egw.set_preference(self.options.app,'fav_sort_pref', self.favSortedList );
|
sideBoxDOMNodeSort(self.favSortedList);
|
||||||
sideBoxDOMNodeSort(self.favSortedList);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
// Add a listener on the delete to remove
|
// Add a listener on the delete to remove
|
||||||
this.menu.on("click","div.ui-icon-trash", app[self.options.app], function() {
|
this.menu.on("click","div.ui-icon-trash", app[self.options.app], function() {
|
||||||
|
@ -23,6 +23,7 @@ import {et2_action_object_impl, et2_DOMWidget} from "./et2_core_DOMWidget";
|
|||||||
import {egw_getAppObjectManager, egwActionObject} from '../egw_action/egw_action.js';
|
import {egw_getAppObjectManager, egwActionObject} from '../egw_action/egw_action.js';
|
||||||
import {et2_directChildrenByTagName, et2_filteredNodeIterator, et2_readAttrWithDefault} from "./et2_core_xml";
|
import {et2_directChildrenByTagName, et2_filteredNodeIterator, et2_readAttrWithDefault} from "./et2_core_xml";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
|
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -961,37 +962,33 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sortablejs = new Sortable(tbody,{
|
||||||
//todo (todo-jquery-ui): fix the sortable import statement
|
group: this.options.sortable_connectWith,
|
||||||
import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
|
draggable: "tr:not(.th)",
|
||||||
this.sortablejs = new Sortable(tbody,{
|
filter: this.options.sortable_cancel,
|
||||||
group: this.options.sortable_connectWith,
|
ghostClass: this.options.sortable_placeholder,
|
||||||
draggable: "tr:not(.th)",
|
dataIdAttr: 'id',
|
||||||
filter: this.options.sortable_cancel,
|
onAdd:function (event) {
|
||||||
ghostClass: this.options.sortable_placeholder,
|
if (typeof self.options.sortable_recieveCallback == 'function') {
|
||||||
dataIdAttr: 'id',
|
self.options.sortable_recieveCallback.call(self, event, this, self.id);
|
||||||
onAdd:function (event) {
|
}
|
||||||
if (typeof self.options.sortable_recieveCallback == 'function') {
|
},
|
||||||
self.options.sortable_recieveCallback.call(self, event, this, self.id);
|
onStart: function (event, ui) {
|
||||||
}
|
if (typeof self.options.sortable_startCallback == 'function') {
|
||||||
},
|
self.options.sortable_startCallback.call(self, event, this, self.id);
|
||||||
onStart: function (event, ui) {
|
}
|
||||||
if (typeof self.options.sortable_startCallback == 'function') {
|
},
|
||||||
self.options.sortable_startCallback.call(self, event, this, self.id);
|
onSort: function (event) {
|
||||||
}
|
self.egw().json(sortable,[
|
||||||
},
|
self.getInstanceManager().etemplate_exec_id,
|
||||||
onSort: function (event) {
|
self.sortablejs.toArray(),
|
||||||
self.egw().json(sortable,[
|
self.id],
|
||||||
self.getInstanceManager().etemplate_exec_id,
|
null,
|
||||||
self.sortablejs.toArray(),
|
self,
|
||||||
self.id],
|
true
|
||||||
null,
|
).sendRequest();
|
||||||
self,
|
},
|
||||||
true
|
});
|
||||||
).sendRequest();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +17,7 @@ import {et2_dialog} from "../etemplate/et2_widget_dialog";
|
|||||||
import {et2_createWidget} from "../etemplate/et2_core_widget";
|
import {et2_createWidget} from "../etemplate/et2_core_widget";
|
||||||
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
||||||
import type {IegwAppLocal} from "./egw_global";
|
import type {IegwAppLocal} from "./egw_global";
|
||||||
|
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type for push-message
|
* Type for push-message
|
||||||
@ -781,21 +782,18 @@ export abstract class EgwApp
|
|||||||
})
|
})
|
||||||
.addClass("ui-helper-clearfix");
|
.addClass("ui-helper-clearfix");
|
||||||
|
|
||||||
//todo (@todo-jquery-ui): replace the import statement
|
let el = document.getElementById('favorite_sidebox_'+this.appname).getElementsByTagName('ul')[0];
|
||||||
import('../../../node_modules/sortablejs/Sortable.min.js').then(function(){
|
let sortablejs = Sortable.create(el, {
|
||||||
let el = document.getElementById('favorite_sidebox_'+this.appname).getElementsByTagName('ul')[0];
|
ghostClass: 'ui-fav-sortable-placeholder',
|
||||||
let sortablejs = Sortable.create(el, {
|
draggable: 'li:not([data-id$="add"])',
|
||||||
ghostClass: 'ui-fav-sortable-placeholder',
|
delay: 25,
|
||||||
draggable: 'li:not([data-id$="add"])',
|
dataIdAttr:'data-id',
|
||||||
delay: 25,
|
onSort: function(event){
|
||||||
dataIdAttr:'data-id',
|
let favSortedList = sortablejs.toArray();
|
||||||
onSort: function(event){
|
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
||||||
let favSortedList = sortablejs.toArray();
|
self._refresh_fav_nm();
|
||||||
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
}
|
||||||
self._refresh_fav_nm();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
// Bind favorite de-select
|
// Bind favorite de-select
|
||||||
var egw_fw = egw_getFramework();
|
var egw_fw = egw_getFramework();
|
||||||
|
Loading…
Reference in New Issue
Block a user