|
|
@ -220,26 +220,27 @@ module.exports = Backbone.View.extend({ |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Picking component to move |
|
|
* Picking component to move |
|
|
* @param {HTMLElement} trg |
|
|
* @param {HTMLElement} src |
|
|
* */ |
|
|
* */ |
|
|
startSort(trg) { |
|
|
startSort(src) { |
|
|
this.dropModel = null; |
|
|
this.dropModel = null; |
|
|
this.moved = 0; |
|
|
this.moved = 0; |
|
|
|
|
|
//this.$document = $([document, trg.ownerDocument]);
|
|
|
|
|
|
|
|
|
if(trg && !this.matches(trg, this.itemSel + ',' + this.containerSel)) |
|
|
if(src && !this.matches(src, this.itemSel + ',' + this.containerSel)) |
|
|
trg = this.closest(trg, this.itemSel); |
|
|
src = this.closest(src, this.itemSel); |
|
|
|
|
|
|
|
|
this.eV = trg; |
|
|
this.eV = src; |
|
|
|
|
|
|
|
|
// Create placeholder if not exists
|
|
|
// Create placeholder if not exists
|
|
|
if(!this.plh) { |
|
|
if (!this.plh) { |
|
|
this.plh = this.createPlaceholder(); |
|
|
this.plh = this.createPlaceholder(); |
|
|
this.getContainerEl().appendChild(this.plh); |
|
|
this.getContainerEl().appendChild(this.plh); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(trg) { |
|
|
if (src) { |
|
|
var className = trg.getAttribute('class'); |
|
|
var srcModel = this.getSourceModel(); |
|
|
trg.setAttribute('class', `${className} ${this.freezeClass}`); |
|
|
srcModel.set('status', 'freezed'); |
|
|
this.$document.on('mouseup', this.endMove); |
|
|
this.$document.on('mouseup', this.endMove); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -728,15 +729,15 @@ module.exports = Backbone.View.extend({ |
|
|
this.$document.off('keydown', this.rollback); |
|
|
this.$document.off('keydown', this.rollback); |
|
|
this.plh.style.display = 'none'; |
|
|
this.plh.style.display = 'none'; |
|
|
var clsReg = new RegExp('(?:^|\\s)'+this.freezeClass+'(?!\\S)', 'gi'); |
|
|
var clsReg = new RegExp('(?:^|\\s)'+this.freezeClass+'(?!\\S)', 'gi'); |
|
|
let trg = this.eV; |
|
|
let src = this.eV; |
|
|
|
|
|
|
|
|
if (trg) { |
|
|
if (src) { |
|
|
var className = (trg.getAttribute('class')+'').replace(clsReg, ''); |
|
|
var srcModel = this.getSourceModel(); |
|
|
trg.setAttribute('class', className); |
|
|
srcModel.set('status', 'selected'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(this.moved) |
|
|
if(this.moved) |
|
|
created = this.move(this.target, trg, this.lastPos); |
|
|
created = this.move(this.target, src, this.lastPos); |
|
|
if(this.plh) |
|
|
if(this.plh) |
|
|
this.plh.style.display = 'none'; |
|
|
this.plh.style.display = 'none'; |
|
|
|
|
|
|
|
|
|