|
1 | 1 | /*! |
2 | | - * vue-virtual-drag-list v2.9.6 |
| 2 | + * vue-virtual-drag-list v2.9.7 |
3 | 3 | * open source under the MIT license |
4 | 4 | * https://github.com/mfuu/vue-virtual-drag-list#readme |
5 | 5 | */ |
|
79 | 79 | required: true |
80 | 80 | }, |
81 | 81 | scroller: { |
82 | | - type: [Document, HTMLElement] |
| 82 | + type: [Document, HTMLElement], |
| 83 | + "default": undefined |
83 | 84 | }, |
84 | 85 | direction: { |
85 | 86 | type: String, |
|
90 | 91 | "default": 30 |
91 | 92 | }, |
92 | 93 | size: { |
93 | | - type: Number |
| 94 | + type: Number, |
| 95 | + "default": undefined |
94 | 96 | }, |
95 | 97 | keepOffset: { |
96 | 98 | type: Boolean, |
|
113 | 115 | "default": true |
114 | 116 | }, |
115 | 117 | handle: { |
116 | | - type: [Function, String] |
| 118 | + type: [Function, String], |
| 119 | + "default": undefined |
117 | 120 | }, |
118 | 121 | group: { |
119 | | - type: [String, Object] |
| 122 | + type: [String, Object], |
| 123 | + "default": undefined |
120 | 124 | }, |
121 | 125 | lockAxis: { |
122 | 126 | type: String, |
|
206 | 210 | }; |
207 | 211 | var ItemProps = { |
208 | 212 | dataKey: { |
209 | | - type: [String, Number] |
| 213 | + type: [String, Number], |
| 214 | + "default": undefined |
210 | 215 | }, |
211 | 216 | sizeKey: { |
212 | | - type: String |
| 217 | + type: String, |
| 218 | + "default": undefined |
213 | 219 | } |
214 | 220 | }; |
215 | 221 |
|
|
1069 | 1075 | _classCallCheck(this, Sortable); |
1070 | 1076 | this.el = el; |
1071 | 1077 | this.options = options; |
1072 | | - this.reRendered = false; |
| 1078 | + this.rangeChanged = false; |
1073 | 1079 | this.installSortable(); |
1074 | 1080 | } |
1075 | 1081 | return _createClass(Sortable, [{ |
1076 | 1082 | key: "destroy", |
1077 | 1083 | value: function destroy() { |
1078 | 1084 | this.sortable.destroy(); |
1079 | | - this.reRendered = false; |
| 1085 | + this.rangeChanged = false; |
1080 | 1086 | } |
1081 | 1087 | }, { |
1082 | 1088 | key: "option", |
|
1169 | 1175 | this.handleDropEvent(event, params, index); |
1170 | 1176 | } |
1171 | 1177 | this.dispatchEvent('onDrop', params); |
1172 | | - if (event.from === this.el && this.reRendered) { |
| 1178 | + if (event.from === this.el && this.rangeChanged) { |
1173 | 1179 | (_b = Dnd.dragged) === null || _b === void 0 ? void 0 : _b.remove(); |
1174 | 1180 | } |
1175 | 1181 | if (event.from !== event.to) { |
1176 | 1182 | (_c = Dnd.clone) === null || _c === void 0 ? void 0 : _c.remove(); |
1177 | 1183 | } |
1178 | | - this.reRendered = false; |
| 1184 | + this.rangeChanged = false; |
1179 | 1185 | } |
1180 | 1186 | }, { |
1181 | 1187 | key: "handleDropEvent", |
|
1268 | 1274 | start: 0, |
1269 | 1275 | end: 0, |
1270 | 1276 | front: 0, |
1271 | | - behind: 0, |
1272 | | - total: 0 |
| 1277 | + behind: 0 |
1273 | 1278 | }; |
1274 | 1279 | this.offset = 0; |
1275 | 1280 | this.direction = 'STATIONARY'; |
|
1436 | 1441 | eventFn(scroller, 'touchmove', this.preventDefault); |
1437 | 1442 | eventFn(scroller, 'keydown', this.preventDefaultForKeyDown); |
1438 | 1443 | } |
1439 | | - // ========================================= Properties ========================================= |
1440 | 1444 | }, { |
1441 | 1445 | key: "preventDefault", |
1442 | 1446 | value: function preventDefault(e) { |
|
1581 | 1585 | this.range.end = this.getEndByStart(start); |
1582 | 1586 | this.range.front = this.getFrontOffset(); |
1583 | 1587 | this.range.behind = this.getBehindOffset(); |
1584 | | - this.range.total = this.getTotalOffset(); |
1585 | 1588 | this.options.onUpdate(Object.assign({}, this.range)); |
1586 | 1589 | } |
1587 | | - }, { |
1588 | | - key: "getTotalOffset", |
1589 | | - value: function getTotalOffset() { |
1590 | | - var offset = this.range.front + this.range.behind; |
1591 | | - offset += this.getOffsetByRange(this.range.start, this.range.end + 1); |
1592 | | - return offset; |
1593 | | - } |
1594 | 1590 | }, { |
1595 | 1591 | key: "getFrontOffset", |
1596 | 1592 | value: function getFrontOffset() { |
|
1846 | 1842 | return; |
1847 | 1843 | } |
1848 | 1844 | var range = Object.assign({}, this.range); |
1849 | | - if (newList.length > oldList.length && this.range.end === oldList.length - 1 && this._scrolledToBottom()) { |
| 1845 | + if (oldList.length > this.keeps && newList.length > oldList.length && this.range.end === oldList.length - 1 && this._scrolledToBottom()) { |
1850 | 1846 | range.start++; |
1851 | 1847 | } |
1852 | 1848 | (_a = this.virtualRef) === null || _a === void 0 ? void 0 : _a.updateRange(range); |
|
1877 | 1873 | var _a; |
1878 | 1874 | var rangeChanged = range.start !== _this4.range.start; |
1879 | 1875 | if (_this4.dragging && rangeChanged) { |
1880 | | - _this4.sortableRef.reRendered = true; |
| 1876 | + _this4.sortableRef.rangeChanged = true; |
1881 | 1877 | } |
1882 | 1878 | _this4.range = range; |
1883 | 1879 | (_a = _this4.sortableRef) === null || _a === void 0 ? void 0 : _a.option('range', range); |
|
0 commit comments