Source
xxxxxxxxxx
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* Since function addPopupValues can be defined by several dashboard widgets, the variable addPopupValues should be
* defined in global scope and always re-written with function right before usage. Do this in all widgets where it is
* needed.
*/
let old_addPopupValues = null;
if (typeof addPopupValues === 'undefined') {
window.addPopupValues = null;
}
(function($) {
$.widget('zbx.sortable_tree', $.extend({}, $.ui.sortable.prototype, {
options: {
// jQuery UI sortable options:
cursor: 'grabbing',
placeholder: 'placeholder',
forcePlaceholderSize: true,
toleranceElement: '> div',
forceHelperSize: true,
tolerance: 'intersect',
handle: '.drag-icon',
items: '.tree-item',
helper: 'clone',
revert: 10,
opacity: .75,
scrollSpeed: 20,
// Custom options:
parent_change_delay: 0,
parent_expand_delay: 600,
indent_size: 15,
max_depth: 10
},
_create: function() {
$.ui.sortable.prototype._create.apply(this, arguments);
},
_mouseDrag: function(event) {
const opt = this.options;
// Compute the helpers position.