({ originalEvent: evt, rootEl, parentEl, sortable, dispatchSortableEvent, oldIndex, putSortable })
| 301 | }, |
| 302 | |
| 303 | drop({ originalEvent: evt, rootEl, parentEl, sortable, dispatchSortableEvent, oldIndex, putSortable }) { |
| 304 | let toSortable = (putSortable || this.sortable); |
| 305 | |
| 306 | if (!evt) return; |
| 307 | |
| 308 | let options = this.options, |
| 309 | children = parentEl.children; |
| 310 | |
| 311 | // Multi-drag selection |
| 312 | if (!dragStarted) { |
| 313 | if (options.multiDragKey && !this.multiDragKeyDown) { |
| 314 | this._deselectMultiDrag(); |
| 315 | } |
| 316 | toggleClass(dragEl, options.selectedClass, !~multiDragElements.indexOf(dragEl)); |
| 317 | |
| 318 | if (!~multiDragElements.indexOf(dragEl)) { |
| 319 | multiDragElements.push(dragEl); |
| 320 | dispatchEvent({ |
| 321 | sortable, |
| 322 | rootEl, |
| 323 | name: 'select', |
| 324 | targetEl: dragEl, |
| 325 | originalEvent: evt |
| 326 | }); |
| 327 | |
| 328 | // Modifier activated, select from last to dragEl |
| 329 | if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) { |
| 330 | let lastIndex = index(lastMultiDragSelect), |
| 331 | currentIndex = index(dragEl); |
| 332 | |
| 333 | if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { |
| 334 | // Must include lastMultiDragSelect (select it), in case modified selection from no selection |
| 335 | // (but previous selection existed) |
| 336 | let n, i; |
| 337 | if (currentIndex > lastIndex) { |
| 338 | i = lastIndex; |
| 339 | n = currentIndex; |
| 340 | } else { |
| 341 | i = currentIndex; |
| 342 | n = lastIndex + 1; |
| 343 | } |
| 344 | |
| 345 | const filter = options.filter; |
| 346 | |
| 347 | for (; i < n; i++) { |
| 348 | if (~multiDragElements.indexOf(children[i])) continue; |
| 349 | // Check if element is draggable |
| 350 | if (!closest(children[i], options.draggable, parentEl, false)) continue; |
| 351 | // Check if element is filtered |
| 352 | const filtered = filter && (typeof filter === 'function' ? |
| 353 | filter.call(sortable, evt, children[i], sortable) : |
| 354 | filter.split(',').some((criteria) => { |
| 355 | return closest(children[i], criteria.trim(), parentEl, false); |
| 356 | })); |
| 357 | if (filtered) continue; |
| 358 | toggleClass(children[i], options.selectedClass, true); |
| 359 | multiDragElements.push(children[i]); |
| 360 |
nothing calls this directly
no test coverage detected
searching dependent graphs…