mini-antui
Advanced tools
Comparing version 0.3.14-alpha.4 to 0.4.0
@@ -1,2 +0,2 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import fmtEvent from '../_util/fmtEvent'; | ||
@@ -31,18 +31,3 @@ Component({ | ||
}, | ||
didMount: function didMount() { | ||
this.dataset = {}; | ||
for (var key in this.props) { | ||
if (/data-/gi.test(key)) { | ||
this.dataset[key.replace(/data-/gi, '')] = this.props[key]; | ||
} | ||
} | ||
}, | ||
methods: { | ||
fmtEvent: function fmtEvent(e) { | ||
return _extends({}, e, { | ||
currentTarget: { dataset: this.dataset }, | ||
target: { dataset: this.dataset, targetDataset: this.dataset } | ||
}); | ||
}, | ||
onBlur: function onBlur(e) { | ||
@@ -52,7 +37,7 @@ this.setData({ | ||
}); | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onBlur(event); | ||
}, | ||
onConfirm: function onConfirm(e) { | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onConfirm(event); | ||
@@ -64,11 +49,11 @@ }, | ||
}); | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onFocus(event); | ||
}, | ||
onInput: function onInput(e) { | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onInput(event); | ||
}, | ||
onClear: function onClear(e) { | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onClear(event); | ||
@@ -75,0 +60,0 @@ } |
@@ -1,2 +0,2 @@ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import fmtEvent from '../_util/fmtEvent'; | ||
@@ -10,20 +10,5 @@ Component({ | ||
}, | ||
didMount: function didMount() { | ||
this.dataset = {}; | ||
for (var key in this.props) { | ||
if (/data-/gi.test(key)) { | ||
this.dataset[key.replace(/data-/gi, '')] = this.props[key]; | ||
} | ||
} | ||
}, | ||
methods: { | ||
fmtEvent: function fmtEvent(e) { | ||
return _extends({}, e, { | ||
currentTarget: { dataset: this.dataset }, | ||
target: { dataset: this.dataset, targetDataset: this.dataset } | ||
}); | ||
}, | ||
onPickerTap: function onPickerTap(e) { | ||
var event = this.fmtEvent(e); | ||
var event = fmtEvent(this.props, e); | ||
this.props.onPickerTap(event); | ||
@@ -30,0 +15,0 @@ } |
@@ -0,1 +1,4 @@ | ||
var windowWidth = my.getSystemInfoSync().windowWidth; | ||
var isV2 = +my.SDKVersion.split('.').join('') > 1112; | ||
Component({ | ||
@@ -5,3 +8,7 @@ data: { | ||
swiping: false, | ||
holdSwipe: true | ||
holdSwipe: true, | ||
viewWidth: windowWidth, | ||
x: 0, | ||
actionWidth: 0, | ||
transitionVal: 'none' | ||
}, | ||
@@ -12,11 +19,30 @@ props: { | ||
restore: false, | ||
index: null | ||
index: null, | ||
height: 52, | ||
enableNew: false | ||
}, | ||
didMount: function didMount() { | ||
var _this = this; | ||
var enableNew = this.props.enableNew; | ||
var useV2 = isV2 && enableNew; | ||
this.btnWidth = 0; | ||
this.setData({ | ||
useV2: useV2 | ||
}); | ||
this.setBtnWidth(); | ||
if (useV2) { | ||
setTimeout(function () { | ||
_this.setData({ | ||
transitionVal: 'transform 100ms' | ||
}); | ||
}, 500); | ||
} | ||
}, | ||
didUpdate: function didUpdate(_prevProps, prevData) { | ||
var restore = this.props.restore; | ||
var holdSwipe = this.data.holdSwipe; | ||
var _data = this.data, | ||
holdSwipe = _data.holdSwipe, | ||
useV2 = _data.useV2; | ||
@@ -26,7 +52,10 @@ if (restore === true && _prevProps.restore !== restore || prevData.holdSwipe === true && holdSwipe === false) { | ||
leftPos: 0, | ||
swiping: false | ||
swiping: false, | ||
x: this.btnWidth // V2 | ||
}); | ||
} | ||
this.setBtnWidth(); | ||
if (!useV2) { | ||
this.setBtnWidth(); | ||
} | ||
}, | ||
@@ -36,6 +65,12 @@ | ||
setBtnWidth: function setBtnWidth() { | ||
var _this = this; | ||
var _this2 = this; | ||
my.createSelectorQuery().select('.am-swipe-right-' + this.$id).boundingClientRect().exec(function (ret) { | ||
_this.btnWidth = ret && ret[0] && ret[0].width || 0; | ||
_this2.btnWidth = ret && ret[0] && ret[0].width || 0; | ||
if (isV2 && _this2.props.enableNew) { | ||
_this2.setData({ | ||
actionWidth: _this2.btnWidth, | ||
x: _this2.btnWidth | ||
}); | ||
} | ||
}); | ||
@@ -47,3 +82,4 @@ }, | ||
leftPos: 0, | ||
swiping: false | ||
swiping: false, | ||
x: 0 | ||
}); | ||
@@ -145,10 +181,32 @@ } | ||
}, | ||
onChange: function onChange() { | ||
if (!this.data.swiping) { | ||
this.setData({ | ||
swiping: true | ||
}); | ||
} | ||
}, | ||
onChangeEnd: function onChangeEnd(e) { | ||
var _this3 = this; | ||
var actionWidth = this.data.actionWidth; | ||
var x = e.detail.x; | ||
this.setData({ | ||
x: x < actionWidth / 2 ? -1 : actionWidth - 1, | ||
swiping: false | ||
}, function () { | ||
_this3.setData({ | ||
x: _this3.data.x === -1 ? 0 : actionWidth | ||
}); | ||
}); | ||
}, | ||
done: function done() { | ||
var _this2 = this; | ||
var _this4 = this; | ||
this.setData({ | ||
holdSwipe: false | ||
holdSwipe: true | ||
}, function () { | ||
_this2.setData({ | ||
holdSwipe: true | ||
_this4.setData({ | ||
holdSwipe: false | ||
}); | ||
@@ -158,3 +216,3 @@ }); | ||
onItemClick: function onItemClick(e) { | ||
var _this3 = this; | ||
var _this5 = this; | ||
@@ -177,5 +235,6 @@ var onRightItemClick = this.props.onRightItemClick; | ||
setTimeout(function () { | ||
_this3.setData({ | ||
_this5.setData({ | ||
leftPos: 0, | ||
swiping: false | ||
swiping: false, | ||
x: 0 | ||
}); | ||
@@ -182,0 +241,0 @@ }, 300); |
{ | ||
"component": true | ||
"component": true, | ||
"usingComponents": { | ||
"badge": "../badge/index" | ||
} | ||
} |
{ | ||
"component": true | ||
"component": true, | ||
"usingComponents": { | ||
"badge": "../badge/index" | ||
} | ||
} |
{ | ||
"name": "mini-antui", | ||
"version": "0.3.14-alpha.4", | ||
"version": "0.4.0", | ||
"description": "小程序版AntUI", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
123835
129
1673
1