vue-virtual-draglist
Advanced tools
Comparing version 2.1.2 to 2.1.3
/*! | ||
* vue-virtual-drag-list v2.1.1 | ||
* vue-virtual-drag-list v2.1.3 | ||
* open source under the MIT license | ||
@@ -17,2 +17,43 @@ * https://github.com/mf-note/vue-virtual-drag-list#readme | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _toConsumableArray(arr) { | ||
@@ -174,3 +215,3 @@ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
document.body.style.cursor = 'unset'; | ||
document.body.style.cursor = ''; | ||
}; | ||
@@ -657,10 +698,8 @@ }, | ||
}, | ||
getItemIndex: function getItemIndex() { | ||
return function (item) { | ||
var _this4 = this; | ||
getItemIndex: function getItemIndex(item) { | ||
var _this4 = this; | ||
return this.list.findIndex(function (el) { | ||
return _this4.uniqueId(item) == _this4.uniqueId(el); | ||
}); | ||
}; | ||
this.list.findIndex(function (el) { | ||
return _this4.uniqueId(item) == _this4.uniqueId(el); | ||
}); | ||
}, | ||
@@ -687,3 +726,4 @@ // 获取每一项的高度 | ||
header = _this$$slots.header, | ||
footer = _this$$slots.footer; | ||
footer = _this$$slots.footer, | ||
item = _this$$slots.item; | ||
var height = this.height, | ||
@@ -720,3 +760,3 @@ padding = this.padding, | ||
attrs: { | ||
role: 'group' | ||
role: 'content' | ||
}, | ||
@@ -731,3 +771,3 @@ style: { | ||
return h(Items, { | ||
return item ? h(Items, { | ||
props: { | ||
@@ -746,3 +786,12 @@ tag: itemTag, | ||
uniqueKey: uniqueKey | ||
})); | ||
})) : h(itemTag, { | ||
key: uniqueKey, | ||
attrs: { | ||
'data-key': uniqueKey | ||
}, | ||
style: _objectSpread2({ | ||
height: "".concat(_this5.size, "px") | ||
}, itemStyle), | ||
"class": itemClass | ||
}, uniqueKey); | ||
})), // 底部插槽 | ||
@@ -749,0 +798,0 @@ footer ? h(Slots, { |
{ | ||
"name": "vue-virtual-draglist", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "一个支持拖拽排序和虚拟滚动的列表组件", | ||
@@ -21,5 +21,9 @@ "main": "dist/index.js", | ||
"vue", | ||
"sort", | ||
"drag", | ||
"list", | ||
"virtual" | ||
"virtual", | ||
"virtual-list", | ||
"big-data", | ||
"big-list", | ||
"infinite" | ||
], | ||
@@ -26,0 +30,0 @@ "author": "mf-note", |
可拖拽排序的虚拟滚动列表组件 | ||
## Simple usage | ||
@@ -74,3 +75,3 @@ | ||
|------------------|-------------|------------------| | ||
| `data-key` | String | 每一条数据的唯一标识 | | ||
| `data-key` | String | 每一条数据的唯一标识`'a.b.c'`形式 | | ||
| `data-source` | Array | 数据源 | | ||
@@ -77,0 +78,0 @@ |
@@ -320,3 +320,3 @@ import Vue from 'vue' | ||
render (h) { | ||
const { header, footer } = this.$slots | ||
const { header, footer, item } = this.$slots | ||
const { height, padding, headerTag, footerTag, itemTag, itemStyle, itemClass, dragStyle, list, start, end } = this | ||
@@ -342,3 +342,3 @@ return h('div', { | ||
attrs: { | ||
role: 'group' | ||
role: 'content' | ||
}, | ||
@@ -349,3 +349,3 @@ style: { padding: `${padding.front}px 0px ${padding.behind}px` } | ||
const uniqueKey = this.uniqueId(val) | ||
return ( | ||
return item ? ( | ||
h(Items, { | ||
@@ -362,2 +362,14 @@ props: { | ||
}, this.$scopedSlots.item({ source: val, index, uniqueKey })) | ||
) : ( | ||
h(itemTag, { | ||
key: uniqueKey, | ||
attrs: { | ||
'data-key': uniqueKey | ||
}, | ||
style: { | ||
height: `${this.size}px`, | ||
...itemStyle | ||
}, | ||
class: itemClass | ||
}, uniqueKey) | ||
) | ||
@@ -364,0 +376,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51827
1303
191