Comparing version 2.1.0 to 2.1.1
@@ -601,2 +601,8 @@ module.exports = | ||
methods: { | ||
resetSwipeStatus: function resetSwipeStatus() { | ||
this.swiping = false; | ||
this.opened = true; | ||
this.offsetLeft = 0; | ||
}, | ||
translate3d: function translate3d(offset) { | ||
@@ -624,4 +630,3 @@ return ("translate3d(" + offset + "px, 0, 0)"); | ||
this$1.swipeMove(-this$1.rightWidth); | ||
this$1.swiping = false; | ||
this$1.opened = true; | ||
this$1.resetSwipeStatus(); | ||
return; | ||
@@ -631,4 +636,3 @@ // right | ||
this$1.swipeMove(this$1.leftWidth); | ||
this$1.swiping = false; | ||
this$1.opened = true; | ||
this$1.resetSwipeStatus(); | ||
return; | ||
@@ -635,0 +639,0 @@ } |
@@ -268,3 +268,4 @@ module.exports = | ||
currentIndicator: '', | ||
currentHeight: this.height | ||
currentHeight: this.height, | ||
navOffsetX: 0 | ||
}; | ||
@@ -296,2 +297,3 @@ }, | ||
} | ||
this.navOffsetX = e.changedTouches[0].clientX; | ||
this.scrollList(e.changedTouches[0].clientY); | ||
@@ -323,3 +325,3 @@ if (this.indicatorTime) { | ||
scrollList: function scrollList(y) { | ||
var currentItem = document.elementFromPoint(document.body.clientWidth - 10, y); | ||
var currentItem = document.elementFromPoint(this.navOffsetX, y); | ||
if (!currentItem || !currentItem.classList.contains('mint-indexlist-navitem')) { | ||
@@ -326,0 +328,0 @@ return; |
@@ -123,4 +123,4 @@ module.exports = | ||
"animationend": _vm.onMainAnimationEnd, | ||
"webkitanimationend": _vm.onMainAnimationEnd, | ||
"mozanimationend": _vm.onMainAnimationEnd | ||
"webkitAnimationEnd": _vm.onMainAnimationEnd, | ||
"mozAnimationEnd": _vm.onMainAnimationEnd | ||
} | ||
@@ -181,2 +181,3 @@ }, [_c('div', { | ||
name: 'mt-palette-button', | ||
data: function() { | ||
@@ -188,2 +189,3 @@ return { | ||
}, | ||
props: { | ||
@@ -194,2 +196,3 @@ content: { | ||
}, | ||
offset: { | ||
@@ -199,2 +202,3 @@ type: Number, // 扇面偏移角,默认是四分之π,配合默认方向lt | ||
}, | ||
direction: { | ||
@@ -204,2 +208,3 @@ type: String, | ||
}, | ||
radius: { | ||
@@ -209,2 +214,3 @@ type: Number, | ||
}, | ||
mainButtonStyle: { | ||
@@ -225,2 +231,3 @@ type: String, // 应用到 mint-main-button 上的 class | ||
}, | ||
onMainAnimationEnd: function onMainAnimationEnd(event) { | ||
@@ -230,2 +237,3 @@ this.transforming = false; | ||
}, | ||
expand: function expand(event) { | ||
@@ -236,2 +244,3 @@ this.expanded = true; | ||
}, | ||
collapse: function collapse(event) { | ||
@@ -256,4 +265,4 @@ this.expanded = false; | ||
var arc = (Math.PI - this$1.offset * 2) / (this$1.slotChildren.length - 1) * i$1 + this$1.offset + direction_arc; | ||
var x = Math.cos(arc) * this$1.radius; | ||
var y = Math.sin(arc) * this$1.radius; | ||
var x = (Math.cos(arc) * this$1.radius).toFixed(2); | ||
var y = (Math.sin(arc) * this$1.radius).toFixed(2); | ||
var item_css = '.expand .palette-button-' + this$1._uid + '-sub-' + i$1 + '{transform:translate(' + x + 'px,' + y + 'px) rotate(720deg);transition-delay:' + 0.03 * i$1 + 's}'; | ||
@@ -272,2 +281,3 @@ css += item_css; | ||
}, | ||
destroyed: function destroyed() { | ||
@@ -274,0 +284,0 @@ if (this.styleNode) { |
@@ -378,3 +378,4 @@ module.exports = | ||
"divider": slot.divider, | ||
"content": slot.content | ||
"content": slot.content, | ||
"itemHeight": _vm.itemHeight | ||
}, | ||
@@ -397,3 +398,7 @@ domProps: { | ||
}), _vm._v(" "), _c('div', { | ||
staticClass: "picker-center-highlight" | ||
staticClass: "picker-center-highlight", | ||
style: ({ | ||
height: _vm.itemHeight + 'px', | ||
marginTop: -_vm.itemHeight / 2 + 'px' | ||
}) | ||
})], 2)]) | ||
@@ -426,3 +431,7 @@ },staticRenderFns: []} | ||
'picker-selected': itemValue === _vm.currentValue | ||
} | ||
}, | ||
style: ({ | ||
height: _vm.itemHeight + 'px', | ||
lineHeight: _vm.itemHeight + 'px' | ||
}) | ||
}, [_vm._v("\n " + _vm._s(typeof itemValue === 'object' && itemValue[_vm.valueKey] ? itemValue[_vm.valueKey] : itemValue) + "\n ")]) | ||
@@ -579,3 +588,2 @@ })) : _vm._e(), _vm._v(" "), (_vm.divider) ? _c('div', [_vm._v(_vm._s(_vm.content))]) : _vm._e()]) | ||
if (!__WEBPACK_IMPORTED_MODULE_4_vue___default.a.prototype.$isServer) { | ||
@@ -629,3 +637,7 @@ __webpack_require__(206); | ||
className: {}, | ||
content: {} | ||
content: {}, | ||
itemHeight: { | ||
type: Number, | ||
default: ITEM_HEIGHT | ||
} | ||
}, | ||
@@ -675,3 +687,3 @@ | ||
contentHeight: function contentHeight() { | ||
return ITEM_HEIGHT * this.visibleItemCount; | ||
return this.itemHeight * this.visibleItemCount; | ||
}, | ||
@@ -684,4 +696,5 @@ valueIndex: function valueIndex() { | ||
var visibleItemCount = this.visibleItemCount; | ||
var itemHeight = this.itemHeight; | ||
return [ -ITEM_HEIGHT * (values.length - Math.ceil(visibleItemCount / 2)), ITEM_HEIGHT * Math.floor(visibleItemCount / 2) ]; | ||
return [ -itemHeight * (values.length - Math.ceil(visibleItemCount / 2)), itemHeight * Math.floor(visibleItemCount / 2) ]; | ||
} | ||
@@ -695,5 +708,6 @@ }, | ||
var offset = Math.floor(this.visibleItemCount / 2); | ||
var itemHeight = this.itemHeight; | ||
if (valueIndex !== -1) { | ||
return (valueIndex - offset) * -ITEM_HEIGHT; | ||
return (valueIndex - offset) * -itemHeight; | ||
} | ||
@@ -703,4 +717,5 @@ }, | ||
translate2Value: function translate2Value(translate) { | ||
translate = Math.round(translate / ITEM_HEIGHT) * ITEM_HEIGHT; | ||
var index = -(translate - Math.floor(this.visibleItemCount / 2) * ITEM_HEIGHT) / ITEM_HEIGHT; | ||
var itemHeight = this.itemHeight; | ||
translate = Math.round(translate / itemHeight) * itemHeight; | ||
var index = -(translate - Math.floor(this.visibleItemCount / 2) * itemHeight) / itemHeight; | ||
@@ -711,2 +726,4 @@ return this.mutatingValues[index]; | ||
updateRotate: function(currentTranslate, pickerItems) { | ||
var this$1 = this; | ||
if (this.divider) return; | ||
@@ -728,6 +745,6 @@ var dragRange = this.dragRange; | ||
[].forEach.call(pickerItems, function (item, index) { | ||
var itemOffsetTop = index * ITEM_HEIGHT; | ||
var itemOffsetTop = index * this$1.itemHeight; | ||
var translateOffset = dragRange[1] - currentTranslate; | ||
var itemOffset = itemOffsetTop - translateOffset; | ||
var percentage = itemOffset / ITEM_HEIGHT; | ||
var percentage = itemOffset / this$1.itemHeight; | ||
@@ -822,6 +839,7 @@ var angle = angleUnit * percentage; | ||
var translate; | ||
var itemHeight = this$1.itemHeight; | ||
if (momentumTranslate) { | ||
translate = Math.round(momentumTranslate / ITEM_HEIGHT) * ITEM_HEIGHT; | ||
translate = Math.round(momentumTranslate / itemHeight) * itemHeight; | ||
} else { | ||
translate = Math.round(currentTranslate / ITEM_HEIGHT) * ITEM_HEIGHT; | ||
translate = Math.round(currentTranslate / itemHeight) * itemHeight; | ||
} | ||
@@ -853,6 +871,8 @@ | ||
doOnValuesChange: function doOnValuesChange() { | ||
var this$1 = this; | ||
var el = this.$el; | ||
var items = el.querySelectorAll('.picker-item'); | ||
[].forEach.call(items, function (item, index) { | ||
__WEBPACK_IMPORTED_MODULE_1__translate__["a" /* default */].translateElement(item, null, ITEM_HEIGHT * index); | ||
__WEBPACK_IMPORTED_MODULE_1__translate__["a" /* default */].translateElement(item, null, this$1.itemHeight * index); | ||
}); | ||
@@ -980,3 +1000,2 @@ if (this.rotateEffect) { | ||
// | ||
// | ||
@@ -1004,2 +1023,6 @@ /* harmony default export */ exports["default"] = { | ||
default: false | ||
}, | ||
itemHeight: { | ||
type: Number, | ||
default: 36 | ||
} | ||
@@ -1006,0 +1029,0 @@ }, |
@@ -821,2 +821,7 @@ module.exports = | ||
this.dragState = {}; | ||
}, | ||
clearTimer: function clearTimer() { | ||
clearInterval(this.timer); | ||
this.timer = null; | ||
} | ||
@@ -827,4 +832,3 @@ }, | ||
if (this.timer) { | ||
clearInterval(this.timer); | ||
this.timer = null; | ||
this.clearTimer(); | ||
} | ||
@@ -844,2 +848,5 @@ if (this.reInitTimer) { | ||
this.timer = setInterval(function () { | ||
if (!this$1.continuous && (this$1.index >= this$1.pages.length - 1)) { | ||
return this$1.clearTimer(); | ||
} | ||
if (!this$1.dragging && !this$1.animating) { | ||
@@ -846,0 +853,0 @@ this$1.next(); |
@@ -495,2 +495,3 @@ module.exports = | ||
startDrag: function startDrag(evt) { | ||
if (!this.swipeable) return; | ||
evt = evt.changedTouches ? evt.changedTouches[0] : evt; | ||
@@ -497,0 +498,0 @@ this.dragging = true; |
{ | ||
"name": "mint-ui", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Mobile UI elements for vue.js", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"dev": "npm run bootstrap && npm run build:entry && cooking watch -c build/cooking.demo.js -p", | ||
"bootstrap": "yarn", | ||
"bootstrap": "yarn || npm i", | ||
"dist": "npm run clean && npm run build:entry && npm run lint && cooking build -c build/cooking.conf.js,build/cooking.common.js,build/cooking.component.js -p", | ||
@@ -23,0 +23,0 @@ "deploy": "npm run build:entry && cooking build -c build/cooking.demo.js -p && gh-pages -d example/dist --remote eleme", |
@@ -78,2 +78,3 @@ # Overview | ||
| rotateEffect | Boolean(default: false) use rotate effect on picker item when rotateEffect is true. | | ||
| itemHeight | Number(default: 36) height of each slot. | | ||
@@ -80,0 +81,0 @@ Picker Methods: |
@@ -36,3 +36,3 @@ import Header from '../packages/header'; | ||
const version = '2.1.0'; | ||
const version = '2.1.1'; | ||
const install = function(Vue) { | ||
@@ -39,0 +39,0 @@ if (install.installed) return; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1121336
27493