|
1 | 1 | /*! |
2 | | - * vue-virtual-drag-list v2.9.3 |
| 2 | + * vue-virtual-drag-list v2.9.4 |
3 | 3 | * open source under the MIT license |
4 | 4 | * https://github.com/mfuu/vue-virtual-drag-list#readme |
5 | 5 | */ |
|
260 | 260 | var sortableDnd_min = {exports: {}}; |
261 | 261 |
|
262 | 262 | /*! |
263 | | - * sortable-dnd v0.6.19 |
| 263 | + * sortable-dnd v0.6.20 |
264 | 264 | * open source under the MIT license |
265 | 265 | * https://github.com/mfuu/sortable-dnd#readme |
266 | 266 | */ |
|
448 | 448 | function N(t) { |
449 | 449 | this.options = t, this.stack = []; |
450 | 450 | } |
451 | | - function P(t) { |
| 451 | + function O(t) { |
452 | 452 | this.options = t || {}, this.selects = []; |
453 | 453 | } |
454 | 454 | window.requestAnimationFrame || (window.requestAnimationFrame = function (t) { |
|
534 | 534 | }, s); |
535 | 535 | } |
536 | 536 | } |
537 | | - }, P.prototype = { |
| 537 | + }, O.prototype = { |
538 | 538 | active: function () { |
539 | 539 | return !!D; |
540 | 540 | }, |
|
631 | 631 | } |
632 | 632 | } |
633 | 633 | }; |
634 | | - var A, |
| 634 | + var P, |
| 635 | + A, |
635 | 636 | H, |
636 | | - O, |
637 | 637 | k, |
638 | 638 | L, |
639 | 639 | X, |
|
700 | 700 | selectedClass: "", |
701 | 701 | placeholderClass: "", |
702 | 702 | swapOnDrop: !0, |
| 703 | + removeCloneOnDrop: !0, |
703 | 704 | fallbackOnBody: !1, |
704 | 705 | supportTouch: "ontouchstart" in window, |
705 | 706 | emptyInsertThreshold: -1 |
706 | 707 | }; |
707 | 708 | for (var i in o) !(i in this.options) && (this.options[i] = o[i]); |
708 | 709 | for (var r in et(n), this) "_" === r.charAt(0) && "function" == typeof this[r] && (this[r] = this[r].bind(this)); |
709 | | - 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); |
| 710 | + 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); |
710 | 711 | } |
711 | 712 | return ot.prototype = { |
712 | 713 | constructor: ot, |
|
745 | 746 | _onStart: function (t, e) { |
746 | 747 | x(e); |
747 | 748 | var n = g(k); |
748 | | - A = this.el, H = this.el, F = k, z = n, G = n, V = n, J = { |
| 749 | + P = this.el, A = this.el, F = k, z = n, G = n, V = n, J = { |
749 | 750 | to: this.el, |
750 | 751 | target: k, |
751 | 752 | newIndex: n, |
752 | 753 | relative: 0 |
753 | | - }, 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({ |
| 754 | + }, 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({ |
754 | 755 | sortable: this, |
755 | 756 | name: "onChoose", |
756 | 757 | params: this._getParams(e) |
|
853 | 854 | } |
854 | 855 | }, |
855 | 856 | _allowPut: function () { |
856 | | - if (O === this.el) return !0; |
| 857 | + if (H === this.el) return !0; |
857 | 858 | if (!this.options.group.put) return !1; |
858 | 859 | var t = this.options.group, |
859 | 860 | e = t.name, |
860 | 861 | n = t.put, |
861 | | - o = O[T].options.group; |
| 862 | + o = H[T].options.group; |
862 | 863 | return n.join && n.indexOf(o.name) > -1 || o.name && e && o.name === e; |
863 | 864 | }, |
864 | 865 | _getDirection: function () { |
|
891 | 892 | params: this._getParams(t, { |
892 | 893 | target: L |
893 | 894 | }) |
894 | | - }), 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)); |
895 | | - H !== O && (L = U = k, Z = 0, this._onInsert(t)); |
| 895 | + }), 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)); |
| 896 | + A !== H && (L = U = k, Z = 0, this._onInsert(t)); |
896 | 897 | } |
897 | 898 | }, |
898 | 899 | _onInsert: function (t) { |
899 | 900 | var e = L || Y, |
900 | | - n = "clone" === W && this.el !== O && H === O, |
901 | | - o = "clone" === W && this.el === O && H !== O, |
| 901 | + n = "clone" === W && this.el !== H && A === H, |
| 902 | + o = "clone" === W && this.el === H && A !== H, |
902 | 903 | i = m(L, document), |
903 | 904 | r = L === k && !i, |
904 | | - s = H[T], |
905 | | - a = O[T]; |
906 | | - 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({ |
| 905 | + s = A[T], |
| 906 | + a = H[T]; |
| 907 | + 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({ |
907 | 908 | sortable: a, |
908 | 909 | name: "onChange", |
909 | 910 | params: this._getParams(t, { |
910 | | - to: O, |
| 911 | + to: H, |
911 | 912 | target: k, |
912 | 913 | newIndex: V, |
913 | 914 | revertDrag: !0 |
|
922 | 923 | sortable: this, |
923 | 924 | name: "onChange", |
924 | 925 | params: this._getParams(t, { |
925 | | - from: O, |
| 926 | + from: H, |
926 | 927 | backToOrigin: !0 |
927 | 928 | }) |
928 | 929 | })), o || C({ |
|
931 | 932 | params: this._getParams(t, { |
932 | 933 | oldIndex: -1 |
933 | 934 | }) |
934 | | - }), s.animator.animate(), this.animator.animate(), H = this.el; |
| 935 | + }), s.animator.animate(), this.animator.animate(), A = this.el; |
935 | 936 | }, |
936 | 937 | _onChange: function (t) { |
937 | | - 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({ |
| 938 | + 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({ |
938 | 939 | sortable: this, |
939 | 940 | name: "onChange", |
940 | 941 | params: this._getParams(t) |
941 | | - }), this.animator.animate(), H = this.el; |
| 942 | + }), this.animator.animate(), A = this.el; |
942 | 943 | }, |
943 | 944 | _onDrop: function (t) { |
944 | | - 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({ |
| 945 | + 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({ |
945 | 946 | sortable: this, |
946 | 947 | name: "onUnchoose", |
947 | 948 | params: this._getParams(t) |
948 | | - }), 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(); |
| 949 | + }), 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(); |
949 | 950 | }, |
950 | 951 | _onEnd: function (t) { |
951 | 952 | w(Y, this.options.chosenClass, !1), w(Y, this.options.placeholderClass, !1); |
952 | 953 | var n = "clone" === W; |
953 | | - this.multiplayer.onDrop(H, A, n); |
| 954 | + this.multiplayer.onDrop(A, P, n); |
954 | 955 | var o = this._getParams(t), |
955 | | - i = this.options.swapOnDrop; |
956 | | - 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({ |
957 | | - sortable: H[T], |
| 956 | + i = this.options, |
| 957 | + r = i.swapOnDrop, |
| 958 | + s = i.removeCloneOnDrop; |
| 959 | + 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({ |
| 960 | + sortable: A[T], |
958 | 961 | name: "onDrop", |
959 | 962 | params: e({}, o, n ? J : { |
960 | 963 | newIndex: -1 |
961 | 964 | }) |
962 | 965 | }), C({ |
963 | | - sortable: A[T], |
| 966 | + sortable: P[T], |
964 | 967 | name: "onDrop", |
965 | | - params: e({}, o, H === A ? {} : { |
| 968 | + params: e({}, o, A === P ? {} : { |
966 | 969 | oldIndex: -1 |
967 | 970 | }) |
968 | 971 | }); |
969 | 972 | }, |
970 | 973 | _getParams: function (t) { |
971 | 974 | var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, |
972 | 975 | o = {}; |
973 | | - 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; |
| 976 | + 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; |
974 | 977 | }, |
975 | 978 | _nulling: function () { |
976 | | - 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; |
| 979 | + 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; |
977 | 980 | }, |
978 | 981 | destroy: function () { |
979 | 982 | this._cancelStart(), this._nulling(), this.multiplayer.nulling(), this.autoScroller.stop(), h(this.el, "touchstart", this._onDrag), h(this.el, "mousedown", this._onDrag); |
|
1045 | 1048 | }, {}); |
1046 | 1049 | this.sortable = new Dnd(this.el, Object.assign(Object.assign({}, props), { |
1047 | 1050 | emptyInsertThreshold: 0, |
1048 | | - swapOnDrop: function swapOnDrop(event) { |
1049 | | - return event.from === event.to; |
1050 | | - }, |
| 1051 | + swapOnDrop: false, |
| 1052 | + removeCloneOnDrop: false, |
1051 | 1053 | onDrag: function onDrag(event) { |
1052 | 1054 | return _this.onDrag(event); |
1053 | 1055 | }, |
|
1117 | 1119 | if (event.from === this.el && this.reRendered) { |
1118 | 1120 | (_b = Dnd.dragged) === null || _b === void 0 ? void 0 : _b.remove(); |
1119 | 1121 | } |
1120 | | - if (event.from !== event.to && event.pullMode === 'clone') { |
1121 | | - (_c = Dnd.clone) === null || _c === void 0 ? void 0 : _c.remove(); |
1122 | | - } |
| 1122 | + (_c = Dnd.clone) === null || _c === void 0 ? void 0 : _c.remove(); |
1123 | 1123 | this.reRendered = false; |
1124 | 1124 | } |
1125 | 1125 | }, { |
|
0 commit comments