Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addDraggable(containers) {
this.dragula = dragula(containers, this.getRowDragulaOptions()).on('drop', this.onRowDrop.bind(this));
}
initDragula() {
const options = this.options;
if (this.dragula) {
this.dragula.destroy();
}
const containersArray = Array.prototype.slice.call(this.refs['sidebar-container']).filter(item => {
return item.id !== 'group-container-resource';
});
this.dragula = dragula(containersArray, {
moves(el) {
let moves = true;
const list = Array.from(el.classList).filter(item => item.indexOf('formio-component-') === 0);
list.forEach(item => {
const key = item.slice('formio-component-'.length);
if (options.disabled && options.disabled.includes(key)) {
moves = false;
}
});
if (el.classList.contains('no-drag')) {
moves = false;
}
return moves;
},