|
1 | 1 | /*! |
2 | | - * vue-virtual-draglist v3.3.4 |
| 2 | + * vue-virtual-draglist v3.3.5 |
3 | 3 | * open source under the MIT license |
4 | 4 | * https://github.com/mfuu/vue3-virtual-drag-list#readme |
5 | 5 | */ |
|
104 | 104 | var sortableDnd_min = {exports: {}}; |
105 | 105 |
|
106 | 106 | /*! |
107 | | - * sortable-dnd v0.6.19 |
| 107 | + * sortable-dnd v0.6.20 |
108 | 108 | * open source under the MIT license |
109 | 109 | * https://github.com/mfuu/sortable-dnd#readme |
110 | 110 | */ |
|
291 | 291 | function N(t) { |
292 | 292 | this.options = t, this.stack = []; |
293 | 293 | } |
294 | | - function P(t) { |
| 294 | + function O(t) { |
295 | 295 | this.options = t || {}, this.selects = []; |
296 | 296 | } |
297 | 297 | window.requestAnimationFrame || (window.requestAnimationFrame = function (t) { |
|
377 | 377 | }, s); |
378 | 378 | } |
379 | 379 | } |
380 | | - }, P.prototype = { |
| 380 | + }, O.prototype = { |
381 | 381 | active: function () { |
382 | 382 | return !!D; |
383 | 383 | }, |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | }; |
477 | | - var A, |
| 477 | + var P, |
| 478 | + A, |
478 | 479 | H, |
479 | | - O, |
480 | 480 | k, |
481 | 481 | L, |
482 | 482 | X, |
|
543 | 543 | selectedClass: "", |
544 | 544 | placeholderClass: "", |
545 | 545 | swapOnDrop: !0, |
| 546 | + removeCloneOnDrop: !0, |
546 | 547 | fallbackOnBody: !1, |
547 | 548 | supportTouch: "ontouchstart" in window, |
548 | 549 | emptyInsertThreshold: -1 |
549 | 550 | }; |
550 | 551 | for (var i in o) !(i in this.options) && (this.options[i] = o[i]); |
551 | 552 | for (var r in et(n), this) "_" === r.charAt(0) && "function" == typeof this[r] && (this[r] = this[r].bind(this)); |
552 | | - c(t, this.options.supportTouch ? "touchstart" : "mousedown", this._onDrag), this.autoScroller = new M(this.options), this.multiplayer = new P(this.options), this.animator = new N(this.options), tt.push(t); |
| 553 | + c(t, this.options.supportTouch ? "touchstart" : "mousedown", this._onDrag), this.autoScroller = new M(this.options), this.multiplayer = new O(this.options), this.animator = new N(this.options), tt.push(t); |
553 | 554 | } |
554 | 555 | return ot.prototype = { |
555 | 556 | constructor: ot, |
|
588 | 589 | _onStart: function (t, e) { |
589 | 590 | x(e); |
590 | 591 | var n = g(k); |
591 | | - A = this.el, H = this.el, F = k, z = n, G = n, V = n, J = { |
| 592 | + P = this.el, A = this.el, F = k, z = n, G = n, V = n, J = { |
592 | 593 | to: this.el, |
593 | 594 | target: k, |
594 | 595 | newIndex: n, |
595 | 596 | relative: 0 |
596 | | - }, K = k, O = this.el, Y = k.cloneNode(!0), R = k.parentNode, W = this.options.group.pull, ot.clone = Y, ot.active = this, ot.dragged = k, this.multiplayer.onChoose(), w(k, this.options.chosenClass, !0), C({ |
| 597 | + }, K = k, H = this.el, Y = k.cloneNode(!0), R = k.parentNode, W = this.options.group.pull, ot.clone = Y, ot.active = this, ot.dragged = k, this.multiplayer.onChoose(), w(k, this.options.chosenClass, !0), C({ |
597 | 598 | sortable: this, |
598 | 599 | name: "onChoose", |
599 | 600 | params: this._getParams(e) |
|
696 | 697 | } |
697 | 698 | }, |
698 | 699 | _allowPut: function () { |
699 | | - if (O === this.el) return !0; |
| 700 | + if (H === this.el) return !0; |
700 | 701 | if (!this.options.group.put) return !1; |
701 | 702 | var t = this.options.group, |
702 | 703 | e = t.name, |
703 | 704 | n = t.put, |
704 | | - o = O[T].options.group; |
| 705 | + o = H[T].options.group; |
705 | 706 | return n.join && n.indexOf(o.name) > -1 || o.name && e && o.name === e; |
706 | 707 | }, |
707 | 708 | _getDirection: function () { |
|
734 | 735 | params: this._getParams(t, { |
735 | 736 | target: L |
736 | 737 | }) |
737 | | - }), this.options.sortable || this.el !== O) return this.el === H || e !== this.el && f(this.el) ? void (L && !L.animated && !m(L, Y) && this._allowSwap() && (L !== Y && X !== Y ? (this.el !== H ? this._onInsert(t) : L !== k && this._onChange(t), U = L) : U = L)) : (L = U = null, void this._onInsert(t)); |
738 | | - H !== O && (L = U = k, Z = 0, this._onInsert(t)); |
| 738 | + }), this.options.sortable || this.el !== H) return this.el === A || e !== this.el && f(this.el) ? void (L && !L.animated && !m(L, Y) && this._allowSwap() && (L !== Y && X !== Y ? (this.el !== A ? this._onInsert(t) : L !== k && this._onChange(t), U = L) : U = L)) : (L = U = null, void this._onInsert(t)); |
| 739 | + A !== H && (L = U = k, Z = 0, this._onInsert(t)); |
739 | 740 | } |
740 | 741 | }, |
741 | 742 | _onInsert: function (t) { |
742 | 743 | var e = L || Y, |
743 | | - n = "clone" === W && this.el !== O && H === O, |
744 | | - o = "clone" === W && this.el === O && H !== O, |
| 744 | + n = "clone" === W && this.el !== H && A === H, |
| 745 | + o = "clone" === W && this.el === H && A !== H, |
745 | 746 | i = m(L, document), |
746 | 747 | r = L === k && !i, |
747 | | - s = H[T], |
748 | | - a = O[T]; |
749 | | - A = this.el, z = g(Y), F = e, R = i ? L.parentNode : this.el, s.animator.collect(Y.parentNode), this.animator.collect(R), n && (J.target = K, J.newIndex = z, J.relative = K === k ? 0 : _(Y, K), S(k, "display", ""), a.multiplayer.toggleVisible(!0), a.options.group.revertDrag || Y.parentNode.insertBefore(k, Y)), o && (z = g(k), S(k, "display", "none"), this.multiplayer.toggleVisible(!1)), S(Y, "display", r ? "none" : ""), L && i ? R.insertBefore(Y, Z < 0 ? L : L.nextSibling) : R.appendChild(Y), G = r ? V : g(Y), n && a.options.group.revertDrag && (J.target = k, J.newIndex = V, J.relative = 0, C({ |
| 748 | + s = A[T], |
| 749 | + a = H[T]; |
| 750 | + P = this.el, z = g(Y), F = e, R = i ? L.parentNode : this.el, s.animator.collect(Y.parentNode), this.animator.collect(R), n && (J.target = K, J.newIndex = z, J.relative = K === k ? 0 : _(Y, K), S(k, "display", ""), a.multiplayer.toggleVisible(!0), a.options.group.revertDrag || Y.parentNode.insertBefore(k, Y)), o && (z = g(k), S(k, "display", "none"), this.multiplayer.toggleVisible(!1)), S(Y, "display", r ? "none" : ""), L && i ? R.insertBefore(Y, Z < 0 ? L : L.nextSibling) : R.appendChild(Y), G = r ? V : g(Y), n && a.options.group.revertDrag && (J.target = k, J.newIndex = V, J.relative = 0, C({ |
750 | 751 | sortable: a, |
751 | 752 | name: "onChange", |
752 | 753 | params: this._getParams(t, { |
753 | | - to: O, |
| 754 | + to: H, |
754 | 755 | target: k, |
755 | 756 | newIndex: V, |
756 | 757 | revertDrag: !0 |
|
765 | 766 | sortable: this, |
766 | 767 | name: "onChange", |
767 | 768 | params: this._getParams(t, { |
768 | | - from: O, |
| 769 | + from: H, |
769 | 770 | backToOrigin: !0 |
770 | 771 | }) |
771 | 772 | })), o || C({ |
|
774 | 775 | params: this._getParams(t, { |
775 | 776 | oldIndex: -1 |
776 | 777 | }) |
777 | | - }), s.animator.animate(), this.animator.animate(), H = this.el; |
| 778 | + }), s.animator.animate(), this.animator.animate(), A = this.el; |
778 | 779 | }, |
779 | 780 | _onChange: function (t) { |
780 | | - this.animator.collect(R), z = g(Y), R = L.parentNode, F = L, this.el === O && (K = L), R.insertBefore(Y, X), G = g(Y), C({ |
| 781 | + this.animator.collect(R), z = g(Y), R = L.parentNode, F = L, this.el === H && (K = L), R.insertBefore(Y, X), G = g(Y), C({ |
781 | 782 | sortable: this, |
782 | 783 | name: "onChange", |
783 | 784 | params: this._getParams(t) |
784 | | - }), this.animator.animate(), H = this.el; |
| 785 | + }), this.animator.animate(), A = this.el; |
785 | 786 | }, |
786 | 787 | _onDrop: function (t) { |
787 | | - this._cancelStart(), h(Q, "touchmove", this._nearestSortable), h(Q, "mousemove", this._nearestSortable), h(Q, "mouseup", this._onDrop), h(Q, "touchend", this._onDrop), h(Q, "touchcancel", this._onDrop), O && (H = O, z = V, F === Y && (F = k), this.animator.collect(R), this.multiplayer.toggleChosenClass(!1), w(k, this.options.chosenClass, !1), C({ |
| 788 | + this._cancelStart(), h(Q, "touchmove", this._nearestSortable), h(Q, "mousemove", this._nearestSortable), h(Q, "mouseup", this._onDrop), h(Q, "touchend", this._onDrop), h(Q, "touchcancel", this._onDrop), H && (A = H, z = V, F === Y && (F = k), this.animator.collect(R), this.multiplayer.toggleChosenClass(!1), w(k, this.options.chosenClass, !1), C({ |
788 | 789 | sortable: this, |
789 | 790 | name: "onUnchoose", |
790 | 791 | params: this._getParams(t) |
791 | | - }), q && this._onEnd(t), !q && this.animator.animate()), !nt(t.changedTouches ? t.changedTouches[0] : t) && this.multiplayer.onSelect(t, k, O, this), B && B.parentNode && B.parentNode.removeChild(B), this.autoScroller.stop(), this.multiplayer.nulling(), this._nulling(); |
| 792 | + }), q && this._onEnd(t), !q && this.animator.animate()), !nt(t.changedTouches ? t.changedTouches[0] : t) && this.multiplayer.onSelect(t, k, H, this), B && B.parentNode && B.parentNode.removeChild(B), this.autoScroller.stop(), this.multiplayer.nulling(), this._nulling(); |
792 | 793 | }, |
793 | 794 | _onEnd: function (t) { |
794 | 795 | w(Y, this.options.chosenClass, !1), w(Y, this.options.placeholderClass, !1); |
795 | 796 | var n = "clone" === W; |
796 | | - this.multiplayer.onDrop(H, A, n); |
| 797 | + this.multiplayer.onDrop(A, P, n); |
797 | 798 | var o = this._getParams(t), |
798 | | - i = this.options.swapOnDrop; |
799 | | - n && H !== A || !("function" == typeof i ? i(o) : i) || R.insertBefore(k, Y), n && H !== A && !this.multiplayer.active() || Y && Y.parentNode && Y.parentNode.removeChild(Y), S(k, "display", ""), this.animator.animate(), H !== A && C({ |
800 | | - sortable: H[T], |
| 799 | + i = this.options, |
| 800 | + r = i.swapOnDrop, |
| 801 | + s = i.removeCloneOnDrop; |
| 802 | + n && A !== P || !("function" == typeof r ? r(o) : r) || R.insertBefore(k, Y), n && A !== P && !this.multiplayer.active() || !("function" == typeof s ? s(o) : s) || Y && Y.parentNode && Y.parentNode.removeChild(Y), S(k, "display", ""), this.animator.animate(), A !== P && C({ |
| 803 | + sortable: A[T], |
801 | 804 | name: "onDrop", |
802 | 805 | params: e({}, o, n ? J : { |
803 | 806 | newIndex: -1 |
804 | 807 | }) |
805 | 808 | }), C({ |
806 | | - sortable: A[T], |
| 809 | + sortable: P[T], |
807 | 810 | name: "onDrop", |
808 | | - params: e({}, o, H === A ? {} : { |
| 811 | + params: e({}, o, A === P ? {} : { |
809 | 812 | oldIndex: -1 |
810 | 813 | }) |
811 | 814 | }); |
812 | 815 | }, |
813 | 816 | _getParams: function (t) { |
814 | 817 | var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, |
815 | 818 | o = {}; |
816 | | - return o.event = t, o.to = A, o.from = H, o.node = k, o.clone = Y, o.target = F, o.oldIndex = z, o.newIndex = G, o.pullMode = W, e(o, this.multiplayer.params(), n), o.relative = F === k ? 0 : _(Y, F), o; |
| 819 | + return o.event = t, o.to = P, o.from = A, o.node = k, o.clone = Y, o.target = F, o.oldIndex = z, o.newIndex = G, o.pullMode = W, e(o, this.multiplayer.params(), n), o.relative = F === k ? 0 : _(Y, F), o; |
817 | 820 | }, |
818 | 821 | _nulling: function () { |
819 | | - A = H = O = k = L = X = Y = B = F = R = W = z = G = V = j = q = U = J = K = Q = Z = $ = ot.clone = ot.ghost = ot.active = ot.dragged = null; |
| 822 | + P = A = H = k = L = X = Y = B = F = R = W = z = G = V = j = q = U = J = K = Q = Z = $ = ot.clone = ot.ghost = ot.active = ot.dragged = null; |
820 | 823 | }, |
821 | 824 | destroy: function () { |
822 | 825 | this._cancelStart(), this._nulling(), this.multiplayer.nulling(), this.autoScroller.stop(), h(this.el, "touchstart", this._onDrag), h(this.el, "mousedown", this._onDrag); |
|
887 | 890 | }, {}); |
888 | 891 | this.sortable = new Dnd(this.el, Object.assign(Object.assign({}, props), { |
889 | 892 | emptyInsertThreshold: 0, |
890 | | - swapOnDrop: function swapOnDrop(event) { |
891 | | - return event.from === event.to; |
892 | | - }, |
| 893 | + swapOnDrop: false, |
| 894 | + removeCloneOnDrop: false, |
893 | 895 | onDrag: function onDrag(event) { |
894 | 896 | return _this.onDrag(event); |
895 | 897 | }, |
|
959 | 961 | if (event.from === this.el && this.reRendered) { |
960 | 962 | (_b = Dnd.dragged) === null || _b === void 0 ? void 0 : _b.remove(); |
961 | 963 | } |
962 | | - if (event.from !== event.to && event.pullMode === 'clone') { |
963 | | - (_c = Dnd.clone) === null || _c === void 0 ? void 0 : _c.remove(); |
964 | | - } |
| 964 | + (_c = Dnd.clone) === null || _c === void 0 ? void 0 : _c.remove(); |
965 | 965 | this.reRendered = false; |
966 | 966 | } |
967 | 967 | }, { |
|
0 commit comments