@dolphinweex/weex-vue-render 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.common.js +249 -91
- package/package.json +1 -1
package/dist/index.common.js
CHANGED
|
@@ -8,21 +8,6 @@ console.log('START WEEX VUE RENDER: 1.0.36, Build 2018-12-29 17:52.');
|
|
|
8
8
|
(global.WeexVueRender = factory());
|
|
9
9
|
}(this, (function () { 'use strict';
|
|
10
10
|
|
|
11
|
-
function isAbsoluteOrFixedPositioned(element, deep=2) {
|
|
12
|
-
let currentElement = element;
|
|
13
|
-
|
|
14
|
-
let deep_ = 0;
|
|
15
|
-
while (currentElement && deep_ <= deep) {
|
|
16
|
-
deep_++;
|
|
17
|
-
const position = window.getComputedStyle(currentElement).position;
|
|
18
|
-
if (position === 'absolute' || position === 'fixed') {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
currentElement = currentElement.parentElement;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
11
|
function __$styleInject(css, returnValue) {
|
|
27
12
|
if (typeof document === 'undefined') {
|
|
28
13
|
return returnValue;
|
|
@@ -2966,33 +2951,68 @@ var scaleStyles = [
|
|
|
2966
2951
|
'bottom',
|
|
2967
2952
|
'border',
|
|
2968
2953
|
'borderRadius',
|
|
2954
|
+
'border-radius',
|
|
2969
2955
|
'borderWidth',
|
|
2956
|
+
'border-width',
|
|
2970
2957
|
'borderLeft',
|
|
2958
|
+
'border-left',
|
|
2971
2959
|
'borderRight',
|
|
2960
|
+
'border-right',
|
|
2972
2961
|
'borderTop',
|
|
2962
|
+
'border-top',
|
|
2973
2963
|
'borderBottom',
|
|
2964
|
+
'border-bottom',
|
|
2974
2965
|
'borderLeftWidth',
|
|
2966
|
+
'border-left-width',
|
|
2975
2967
|
'borderRightWidth',
|
|
2968
|
+
'border-right-width',
|
|
2976
2969
|
'borderTopWidth',
|
|
2970
|
+
'border-top-width',
|
|
2977
2971
|
'borderBottomWidth',
|
|
2972
|
+
'border-bottom-width',
|
|
2973
|
+
'borderTopLeftRadius',
|
|
2974
|
+
'border-top-left-radius',
|
|
2975
|
+
'borderTopRightRadius',
|
|
2976
|
+
'border-top-right-radius',
|
|
2977
|
+
'borderBottomLeftRadius',
|
|
2978
|
+
'border-bottom-left-radius' ,
|
|
2979
|
+
'borderBottomRightRadius',
|
|
2980
|
+
'border-bottom-right-radius',
|
|
2978
2981
|
'margin',
|
|
2979
2982
|
'marginLeft',
|
|
2983
|
+
'margin-left',
|
|
2980
2984
|
'marginRight',
|
|
2985
|
+
'margin-right',
|
|
2981
2986
|
'marginTop',
|
|
2987
|
+
'margin-top',
|
|
2982
2988
|
'marginBottom',
|
|
2989
|
+
'margin-bottom',
|
|
2983
2990
|
'padding',
|
|
2984
2991
|
'paddingLeft',
|
|
2992
|
+
'padding-left',
|
|
2985
2993
|
'paddingRight',
|
|
2994
|
+
'padding-right',
|
|
2986
2995
|
'paddingTop',
|
|
2996
|
+
'padding-top',
|
|
2987
2997
|
'paddingBottom',
|
|
2988
|
-
'
|
|
2998
|
+
'padding-bottom',
|
|
2999
|
+
'fontSize',
|
|
3000
|
+
'font-size',
|
|
2989
3001
|
'lineHeight',
|
|
3002
|
+
'line-height',
|
|
2990
3003
|
'transform',
|
|
2991
3004
|
'webkitTransform',
|
|
3005
|
+
'webkit-transform',
|
|
2992
3006
|
'WebkitTransform',
|
|
2993
3007
|
'mozTransform',
|
|
3008
|
+
'moz-transform',
|
|
2994
3009
|
'MozTransform',
|
|
2995
|
-
'itemSize'
|
|
3010
|
+
'itemSize',
|
|
3011
|
+
'item-size',
|
|
3012
|
+
'min-height',
|
|
3013
|
+
'minHeight',
|
|
3014
|
+
'max-height',
|
|
3015
|
+
'maxHeight'
|
|
2996
3016
|
];
|
|
2997
3017
|
|
|
2998
3018
|
var vendorReg = /webkit|moz/i;
|
|
@@ -3034,7 +3054,37 @@ var config = {
|
|
|
3034
3054
|
'a'
|
|
3035
3055
|
],
|
|
3036
3056
|
bindingStyleNamesForPx2Rem: allStyles,
|
|
3037
|
-
|
|
3057
|
+
|
|
3058
|
+
bindingStyleNamesForPv2Px: ["fontSize", "lineHeight", "letterSpacing"],
|
|
3059
|
+
|
|
3060
|
+
bindingStyleNamesForNumber2Px: [
|
|
3061
|
+
"top",
|
|
3062
|
+
"left",
|
|
3063
|
+
"right",
|
|
3064
|
+
"bottom",
|
|
3065
|
+
"width",
|
|
3066
|
+
"height",
|
|
3067
|
+
"minWidth",
|
|
3068
|
+
"minHeight",
|
|
3069
|
+
"maxWidth",
|
|
3070
|
+
"maxHeight",
|
|
3071
|
+
"margin",
|
|
3072
|
+
"marginTop",
|
|
3073
|
+
"marginBottom",
|
|
3074
|
+
"marginRight",
|
|
3075
|
+
"marginLeft",
|
|
3076
|
+
"borderWidth",
|
|
3077
|
+
"borderTopWidth",
|
|
3078
|
+
"borderLeftWidth",
|
|
3079
|
+
"borderBottomWidth",
|
|
3080
|
+
"borderRightWidth",
|
|
3081
|
+
"padding",
|
|
3082
|
+
"paddingTop",
|
|
3083
|
+
"paddingLeft",
|
|
3084
|
+
"paddingBottom",
|
|
3085
|
+
"paddingRight",
|
|
3086
|
+
|
|
3087
|
+
]
|
|
3038
3088
|
};
|
|
3039
3089
|
|
|
3040
3090
|
/*
|
|
@@ -3410,7 +3460,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3410
3460
|
* 1. apply src immediately in case javscript blocks the image loading
|
|
3411
3461
|
* before next tick.
|
|
3412
3462
|
*/
|
|
3413
|
-
item.style.backgroundImage = "url(" + (src
|
|
3463
|
+
item.style.backgroundImage = "url(" + (src ? encodeURI(src) : '') + ")";
|
|
3414
3464
|
item.removeAttribute(lazyloadAttr);
|
|
3415
3465
|
/**
|
|
3416
3466
|
* 2. then load the img src with Image constructor (but would not post
|
|
@@ -3418,7 +3468,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3418
3468
|
*/
|
|
3419
3469
|
item._src_loading = src;
|
|
3420
3470
|
preLoadImg(src, function (evt) {
|
|
3421
|
-
item.style.backgroundImage = "url(" + (src
|
|
3471
|
+
item.style.backgroundImage = "url(" + (src ? encodeURI(src) : '') + ")";
|
|
3422
3472
|
var ref = this;
|
|
3423
3473
|
var naturalWidth = ref.width;
|
|
3424
3474
|
var naturalHeight = ref.height;
|
|
@@ -3436,7 +3486,7 @@ function applySrc (item, src, placeholderSrc) {
|
|
|
3436
3486
|
dispatchNativeEvent(item, 'load', params);
|
|
3437
3487
|
if (placeholderSrc) {
|
|
3438
3488
|
preLoadImg(placeholderSrc, function () {
|
|
3439
|
-
item.style.backgroundImage = "url(" + (placeholderSrc
|
|
3489
|
+
item.style.backgroundImage = "url(" + (placeholderSrc ? encodeURI(placeholderSrc) : '') + ")";
|
|
3440
3490
|
});
|
|
3441
3491
|
}
|
|
3442
3492
|
finallCb();
|
|
@@ -3535,6 +3585,7 @@ function getThrottleLazyload (wait, el) {
|
|
|
3535
3585
|
|
|
3536
3586
|
var bindingStyleNamesForPx2Rem = config.bindingStyleNamesForPx2Rem;
|
|
3537
3587
|
var bindingStyleNamesForPv2Px = config.bindingStyleNamesForPv2Px;
|
|
3588
|
+
var bindingStyleNamesForNumber2Px = config.bindingStyleNamesForNumber2Px;
|
|
3538
3589
|
|
|
3539
3590
|
// whether to support using 0.5px to paint 1px width border.
|
|
3540
3591
|
var _supportHairlines;
|
|
@@ -3741,11 +3792,11 @@ function styleObject2rem (style, rootValue) {
|
|
|
3741
3792
|
var camK = camelize(k);
|
|
3742
3793
|
|
|
3743
3794
|
if (bindingStyleNamesForPv2Px.indexOf(camK) > -1 && typeof obj[camK] =='string'
|
|
3744
|
-
&& obj[camK].endsWith('wx')
|
|
3795
|
+
&& obj[camK].endsWith('wx')) {
|
|
3745
3796
|
|
|
3746
3797
|
obj[camK] = px2px(style[k]);
|
|
3747
3798
|
} else if (bindingStyleNamesForPx2Rem.indexOf(camK) > -1) {
|
|
3748
|
-
|
|
3799
|
+
obj[camK] = px2rem(style[k] + '', rootValue);
|
|
3749
3800
|
}
|
|
3750
3801
|
else {
|
|
3751
3802
|
obj[camK] = style[k];
|
|
@@ -3917,16 +3968,31 @@ function initEnv (viewportInfo, envInfo) {
|
|
|
3917
3968
|
osName = 'android';
|
|
3918
3969
|
}
|
|
3919
3970
|
var osVersion = envInfo.os.version.val;
|
|
3971
|
+
|
|
3972
|
+
var device_display = $midea_harmony_native.getHarmoryDeviceDisplay() || {};
|
|
3973
|
+
|
|
3974
|
+
|
|
3920
3975
|
var env = {
|
|
3921
3976
|
platform: 'harmony',
|
|
3922
3977
|
weexVersion: '1.0.36',
|
|
3923
3978
|
layoutDirection: 'ltr',
|
|
3924
3979
|
userAgent: navigator.userAgent,
|
|
3925
3980
|
appName: browserName,
|
|
3926
|
-
appVersion:
|
|
3981
|
+
appVersion: device_display.appVersion,
|
|
3927
3982
|
osName: osName,
|
|
3928
3983
|
osVersion: osVersion,
|
|
3929
|
-
|
|
3984
|
+
|
|
3985
|
+
deviceModel: device_display.deviceModel || null,
|
|
3986
|
+
appEnv: device_display.appEnv,
|
|
3987
|
+
versionCode: device_display.versionCode,
|
|
3988
|
+
idfa: device_display.idfa,
|
|
3989
|
+
isFullScreen: device_display.isFullScreen,
|
|
3990
|
+
weexVersion: device_display.weexVersion,
|
|
3991
|
+
osName: device_display.osName,
|
|
3992
|
+
statusBarHeight: device_display.statusBarHeight,
|
|
3993
|
+
safeAreaBottomHeight: device_display.safeAreaBottomHeight,
|
|
3994
|
+
isImmersion: device_display.isImmersion,
|
|
3995
|
+
|
|
3930
3996
|
};
|
|
3931
3997
|
/**
|
|
3932
3998
|
* viewportInfo: scale, deviceWidth, deviceHeight. dpr
|
|
@@ -4890,7 +4956,7 @@ var style = {
|
|
|
4890
4956
|
}
|
|
4891
4957
|
return t;
|
|
4892
4958
|
},
|
|
4893
|
-
_px2rem: function _px2rem (value, rootValue) {
|
|
4959
|
+
_px2rem: function _px2rem (value, rootValue, propKey) {
|
|
4894
4960
|
var this$1 = this;
|
|
4895
4961
|
if (typeof value === 'string') {
|
|
4896
4962
|
return (value + '').replace(/[+-]?\d+(?:.\d*)?[pw]x/gi, function ($0) {
|
|
@@ -4898,20 +4964,25 @@ var style = {
|
|
|
4898
4964
|
})
|
|
4899
4965
|
}
|
|
4900
4966
|
if (typeof value === 'number') {
|
|
4901
|
-
|
|
4967
|
+
if (bindingStyleNamesForNumber2Px.indexOf(propKey) > -1) {
|
|
4968
|
+
const scale = weex.config.env.scale
|
|
4969
|
+
return (scale * value) + 'px';
|
|
4970
|
+
}else{
|
|
4971
|
+
return weex.utils.px2rem(value + '', rootValue)
|
|
4972
|
+
}
|
|
4902
4973
|
}
|
|
4903
4974
|
if (isPlainObject(value)) {
|
|
4904
4975
|
let cloneObj = this._deepClone(value)
|
|
4905
4976
|
for (var k in cloneObj) {
|
|
4906
4977
|
// 如果是"fontSize", "lineHeight", "letterSpacing"并且值包含wx则按照vp来转化为px使用
|
|
4907
4978
|
if (
|
|
4908
|
-
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof cloneObj[k] == "string" && cloneObj[k].endsWith('wx')
|
|
4979
|
+
bindingStyleNamesForPv2Px$1.indexOf(k) > -1 &&typeof cloneObj[k] == "string" && cloneObj[k].endsWith('wx')) {
|
|
4909
4980
|
cloneObj[k] = px2px(cloneObj[k]);
|
|
4910
4981
|
}else if (
|
|
4911
4982
|
cloneObj.hasOwnProperty(k)
|
|
4912
4983
|
&& bindingStyleNamesForPx2Rem$1.indexOf(k) > -1
|
|
4913
4984
|
) {
|
|
4914
|
-
|
|
4985
|
+
cloneObj[k] = weex.utils.px2rem(cloneObj[k] + '', rootValue);
|
|
4915
4986
|
}
|
|
4916
4987
|
}
|
|
4917
4988
|
return cloneObj
|
|
@@ -5860,23 +5931,59 @@ var scrollable$1 = {
|
|
|
5860
5931
|
},
|
|
5861
5932
|
|
|
5862
5933
|
handleTouchStart: function handleTouchStart (event) {
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
this.
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
};
|
|
5873
|
-
}
|
|
5934
|
+
var touch = event.changedTouches[0];
|
|
5935
|
+
this._touchParams = {
|
|
5936
|
+
reachTop: this.reachTop(),
|
|
5937
|
+
reachBottom: this.reachBottom(),
|
|
5938
|
+
startTouchEvent: touch,
|
|
5939
|
+
startX: touch.pageX,
|
|
5940
|
+
startY: touch.pageY,
|
|
5941
|
+
timeStamp: event.timeStamp
|
|
5942
|
+
};
|
|
5874
5943
|
},
|
|
5875
5944
|
|
|
5876
5945
|
handleTouchMove: function handleTouchMove (event) {
|
|
5877
|
-
if (!this._touchParams
|
|
5946
|
+
if (!this._touchParams) {
|
|
5947
|
+
return
|
|
5948
|
+
}
|
|
5949
|
+
|
|
5950
|
+
var tp = this._touchParams;
|
|
5951
|
+
if (!tp) { return }
|
|
5952
|
+
|
|
5953
|
+
var ref = this._touchParams;
|
|
5954
|
+
var startX = ref.startX;
|
|
5955
|
+
var startY = ref.startY;
|
|
5956
|
+
var touch = event.changedTouches[0];
|
|
5957
|
+
var offsetX = touch.pageX - startX;
|
|
5958
|
+
var offsetY = touch.pageY - startY;
|
|
5959
|
+
tp.offsetX = offsetX;
|
|
5960
|
+
tp.offsetY = offsetY;
|
|
5961
|
+
var isV = tp.isVertical;
|
|
5962
|
+
if (typeof isV === 'undefined') {
|
|
5963
|
+
isV = tp.isVertical = Math.abs(offsetX) < Math.abs(offsetY);
|
|
5964
|
+
}
|
|
5965
|
+
|
|
5966
|
+
// 如果是水平滚动,并且手势是水平方向,则阻止冒泡
|
|
5967
|
+
// 如果是垂直滚动,并且手势是垂直方向,则阻止冒泡
|
|
5968
|
+
var isScrollHorizontal = this.$el.classList.value.indexOf("weex-scroller-horizontal") > -1 || this.$el.classList.value.indexOf("weex-recycle-horizontal") > -1
|
|
5969
|
+
console.log("dom", this.$el.classList.value)
|
|
5970
|
+
if (isScrollHorizontal) {
|
|
5971
|
+
if (!isV) {
|
|
5972
|
+
// 水平
|
|
5973
|
+
event.stopPropagation();
|
|
5974
|
+
return;
|
|
5975
|
+
}
|
|
5976
|
+
return;
|
|
5977
|
+
}else {
|
|
5978
|
+
if (!isV) {
|
|
5979
|
+
return;
|
|
5980
|
+
}
|
|
5981
|
+
}
|
|
5982
|
+
|
|
5983
|
+
if (!this._refresh && !this._loading) {
|
|
5878
5984
|
return
|
|
5879
5985
|
}
|
|
5986
|
+
|
|
5880
5987
|
var inner = this.$refs.inner;
|
|
5881
5988
|
var ref = this._touchParams;
|
|
5882
5989
|
var startY = ref.startY;
|
|
@@ -5900,6 +6007,18 @@ var scrollable$1 = {
|
|
|
5900
6007
|
if (!this._touchParams || !this._refresh && !this._loading) {
|
|
5901
6008
|
return
|
|
5902
6009
|
}
|
|
6010
|
+
var tp = this._touchParams;
|
|
6011
|
+
var isV = tp.isVertical;
|
|
6012
|
+
if (this.scrollDirection === 'horizontal' && !isV) {
|
|
6013
|
+
// 水平
|
|
6014
|
+
event.stopPropagation();
|
|
6015
|
+
}else if (isV) {
|
|
6016
|
+
// 垂直
|
|
6017
|
+
event.stopPropagation();
|
|
6018
|
+
}else {
|
|
6019
|
+
return;
|
|
6020
|
+
}
|
|
6021
|
+
|
|
5903
6022
|
var inner = this.$refs.inner;
|
|
5904
6023
|
var ref = this._touchParams;
|
|
5905
6024
|
var startY = ref.startY;
|
|
@@ -5975,9 +6094,6 @@ function getList (weex) {
|
|
|
5975
6094
|
},
|
|
5976
6095
|
mounted: function mounted () {
|
|
5977
6096
|
var this$1 = this;
|
|
5978
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
5979
|
-
this$1.$el.classList.remove("height-0");
|
|
5980
|
-
}
|
|
5981
6097
|
setTimeout(() => {
|
|
5982
6098
|
if (this$1.$el.clientHeight == 0) {
|
|
5983
6099
|
this$1.$el.classList.remove("height-0");
|
|
@@ -6016,7 +6132,7 @@ function getList (weex) {
|
|
|
6016
6132
|
on: {
|
|
6017
6133
|
scroll: this.handleScroll,
|
|
6018
6134
|
touchstart: this.handleTouchStart,
|
|
6019
|
-
touchmove: this.handleTouchMove,
|
|
6135
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6020
6136
|
touchend: this.handleTouchEnd
|
|
6021
6137
|
},
|
|
6022
6138
|
staticStyle: extractComponentStyle(this)
|
|
@@ -6071,9 +6187,6 @@ function getScroller (weex) {
|
|
|
6071
6187
|
},
|
|
6072
6188
|
mounted: function mounted () {
|
|
6073
6189
|
var this$1 = this;
|
|
6074
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
6075
|
-
this$1.$el.classList.remove("height-0");
|
|
6076
|
-
}
|
|
6077
6190
|
setTimeout(() => {
|
|
6078
6191
|
if (this$1.$el.clientHeight == 0) {
|
|
6079
6192
|
this$1.$el.classList.remove("height-0");
|
|
@@ -6134,7 +6247,7 @@ function getScroller (weex) {
|
|
|
6134
6247
|
on: {
|
|
6135
6248
|
scroll: this.handleScroll,
|
|
6136
6249
|
touchstart: this.handleTouchStart,
|
|
6137
|
-
touchmove: this.handleTouchMove,
|
|
6250
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6138
6251
|
touchend: this.handleTouchEnd
|
|
6139
6252
|
},
|
|
6140
6253
|
staticClass: this.wrapperClass,
|
|
@@ -6525,7 +6638,7 @@ function getWaterfall (weex) {
|
|
|
6525
6638
|
on: {
|
|
6526
6639
|
scroll: this.handleScroll,
|
|
6527
6640
|
touchstart: this.handleTouchStart,
|
|
6528
|
-
touchmove: this.handleTouchMove,
|
|
6641
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6529
6642
|
touchend: this.handleTouchEnd
|
|
6530
6643
|
},
|
|
6531
6644
|
staticClass: 'weex-waterfall weex-waterfall-wrapper weex-ct',
|
|
@@ -6987,9 +7100,6 @@ function getList$1 (weex) {
|
|
|
6987
7100
|
},
|
|
6988
7101
|
mounted: function mounted () {
|
|
6989
7102
|
var this$1 = this;
|
|
6990
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
6991
|
-
this$1.$el.classList.remove("height-0");
|
|
6992
|
-
}
|
|
6993
7103
|
setTimeout(() => {
|
|
6994
7104
|
if (this$1.$el.clientHeight == 0) {
|
|
6995
7105
|
this$1.$el.classList.remove("height-0");
|
|
@@ -7057,7 +7167,7 @@ function getList$1 (weex) {
|
|
|
7057
7167
|
on: {
|
|
7058
7168
|
scroll: this.handleScroll,
|
|
7059
7169
|
touchstart: this.handleTouchStart,
|
|
7060
|
-
touchmove: this.handleTouchMove,
|
|
7170
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
7061
7171
|
touchend: this.handleTouchEnd
|
|
7062
7172
|
},
|
|
7063
7173
|
staticStyle: extractComponentStyle(this)
|
|
@@ -7138,6 +7248,8 @@ var MAIN_SLIDE_OPACITY = 1;
|
|
|
7138
7248
|
var THROTTLE_SCROLL_TIME = 25;
|
|
7139
7249
|
var INTERVAL_MINIMUM = 200;
|
|
7140
7250
|
|
|
7251
|
+
var touchSliderInstance = null;
|
|
7252
|
+
|
|
7141
7253
|
var slideMixin = {
|
|
7142
7254
|
created: function created () {
|
|
7143
7255
|
this._clones = [];
|
|
@@ -7249,7 +7361,7 @@ var slideMixin = {
|
|
|
7249
7361
|
attrs: { 'weex-type': this.isNeighbor ? 'slider-neighbor' : 'slider' },
|
|
7250
7362
|
on: {
|
|
7251
7363
|
touchstart: this._handleTouchStart,
|
|
7252
|
-
touchmove: weex.utils.throttle(weex.utils.bind(this._handleTouchMove, this),
|
|
7364
|
+
touchmove: weex.utils.throttle(weex.utils.bind(this._handleTouchMove, this), 10),
|
|
7253
7365
|
touchend: this._handleTouchEnd,
|
|
7254
7366
|
touchcancel: this._handleTouchCancel
|
|
7255
7367
|
},
|
|
@@ -7326,16 +7438,19 @@ var slideMixin = {
|
|
|
7326
7438
|
this._prepareNodes();
|
|
7327
7439
|
var translate = weex.utils.getTransformObj(inner).translate;
|
|
7328
7440
|
var match = translate && translate.match(/translate[^(]+\(([+-\d.]+)/);
|
|
7329
|
-
var innerX = match && match[1] || 0;
|
|
7441
|
+
var innerX = parseFloat(inner.style.left); //match && match[1] || 0;
|
|
7330
7442
|
var dist = innerX - this.innerOffset;
|
|
7331
7443
|
this.innerOffset += step * this._wrapperWidth;
|
|
7332
7444
|
// transform the whole slides group.
|
|
7333
|
-
|
|
7334
|
-
inner.style.
|
|
7335
|
-
inner.style.
|
|
7336
|
-
inner.style.
|
|
7337
|
-
inner.style.
|
|
7338
|
-
inner.style.
|
|
7445
|
+
|
|
7446
|
+
inner.style.webkitTransition = "left " + (TRANSITION_TIME / 1000) + "s ease-in-out";
|
|
7447
|
+
inner.style.mozTransition = "left " + (TRANSITION_TIME / 1000) + "s ease-in-out";
|
|
7448
|
+
inner.style.transition = "left " + (TRANSITION_TIME / 1000) + "s ease-in-out";
|
|
7449
|
+
// inner.style.webkitTransform = "translate3d(" + (this.innerOffset) + "px, 0, 0)";
|
|
7450
|
+
// inner.style.mozTransform = "translate3d(" + (this.innerOffset) + "px, 0, 0)";
|
|
7451
|
+
// inner.style.transform = "translate3d(" + (this.innerOffset) + "px, 0, 0)";
|
|
7452
|
+
inner.style.left = this.innerOffset + 'px'
|
|
7453
|
+
|
|
7339
7454
|
|
|
7340
7455
|
// emit scroll events.
|
|
7341
7456
|
if (!isTouchScroll) {
|
|
@@ -7387,9 +7502,11 @@ var slideMixin = {
|
|
|
7387
7502
|
var node = this$1._showNodes[i];
|
|
7388
7503
|
node = node && node.firstElementChild;
|
|
7389
7504
|
if (!node) { continue }
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7505
|
+
// ddd
|
|
7506
|
+
// weex.utils.addTransform(this$1._showNodes[i].firstElementChild, {
|
|
7507
|
+
// translate: 'translate3d(0px, 0px, 0px)'
|
|
7508
|
+
// });
|
|
7509
|
+
this$1._showNodes[i].firstElementChild.left = '0px'
|
|
7393
7510
|
}
|
|
7394
7511
|
},
|
|
7395
7512
|
|
|
@@ -7505,9 +7622,12 @@ var slideMixin = {
|
|
|
7505
7622
|
|
|
7506
7623
|
node._inShow = true;
|
|
7507
7624
|
var translateX = index * this._wrapperWidth - this.innerOffset;
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7625
|
+
// ddd
|
|
7626
|
+
// weex.utils.addTransform(node, {
|
|
7627
|
+
// translate: ("translate3d(" + translateX + "px, 0px, 0px)")
|
|
7628
|
+
// });
|
|
7629
|
+
node.style.left = translateX + 'px'
|
|
7630
|
+
|
|
7511
7631
|
node.style.zIndex = 99 - Math.abs(index);
|
|
7512
7632
|
node.style.opacity = 1;
|
|
7513
7633
|
node._showIndex = index;
|
|
@@ -7595,15 +7715,18 @@ var slideMixin = {
|
|
|
7595
7715
|
if ( transformExtra === void 0 ) transformExtra = {};
|
|
7596
7716
|
|
|
7597
7717
|
weex.utils.extendKeys(to.style, from.style, styles);
|
|
7718
|
+
to.style.left = from.style.left;
|
|
7598
7719
|
var transObj = weex.utils.getTransformObj(from);
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7720
|
+
if (transObj) {
|
|
7721
|
+
for (var k in transformExtra) {
|
|
7722
|
+
transObj[k] = transformExtra[k];
|
|
7723
|
+
}
|
|
7724
|
+
weex.utils.addTransform(to, transObj);
|
|
7725
|
+
var fromInner = from.firstElementChild;
|
|
7726
|
+
var toInner = to.firstElementChild;
|
|
7727
|
+
toInner.style.opacity = fromInner.style.opacity;
|
|
7728
|
+
weex.utils.copyTransform(fromInner, toInner);
|
|
7729
|
+
}
|
|
7607
7730
|
},
|
|
7608
7731
|
|
|
7609
7732
|
/**
|
|
@@ -7621,7 +7744,7 @@ var slideMixin = {
|
|
|
7621
7744
|
return
|
|
7622
7745
|
}
|
|
7623
7746
|
var origShowIndex = origNode._showIndex;
|
|
7624
|
-
var styleProps = ['opacity', 'zIndex'];
|
|
7747
|
+
var styleProps = ['opacity', 'zIndex', 'left'];
|
|
7625
7748
|
var cl;
|
|
7626
7749
|
if (Math.abs(origShowIndex) <= 1) {
|
|
7627
7750
|
// leave a clone to replace the origNode in the show zone(-1 ~ 1).
|
|
@@ -7631,9 +7754,12 @@ var slideMixin = {
|
|
|
7631
7754
|
}
|
|
7632
7755
|
origNode._inShow = true;
|
|
7633
7756
|
var transObj = weex.utils.getTransformObj(clone);
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7757
|
+
if (transObj.translate) {
|
|
7758
|
+
transObj.translate = transObj.translate.replace(/[+-\d.]+[pw]x/, function ($0) {
|
|
7759
|
+
return pos * this$1._wrapperWidth - this$1.innerOffset + 'px'
|
|
7760
|
+
});
|
|
7761
|
+
}
|
|
7762
|
+
|
|
7637
7763
|
this._copyStyle(clone, origNode, styleProps, transObj);
|
|
7638
7764
|
this._removeClone(clone);
|
|
7639
7765
|
if (!cl) {
|
|
@@ -7716,7 +7842,11 @@ var slideMixin = {
|
|
|
7716
7842
|
translateX = 0;
|
|
7717
7843
|
}
|
|
7718
7844
|
transObj.translate = "translate3d(" + translateX + "px, 0px, 0px)";
|
|
7719
|
-
|
|
7845
|
+
|
|
7846
|
+
// ddd
|
|
7847
|
+
// weex.utils.addTransform(elm, transObj);
|
|
7848
|
+
elm.style.left = translateX + 'px'
|
|
7849
|
+
|
|
7720
7850
|
elm.style.opacity = i === 0 ? MAIN_SLIDE_OPACITY : this$1.neighborAlpha;
|
|
7721
7851
|
}
|
|
7722
7852
|
},
|
|
@@ -7755,9 +7885,7 @@ var slideMixin = {
|
|
|
7755
7885
|
_handleTouchMove: function _handleTouchMove (event) {
|
|
7756
7886
|
var tp = this._touchParams;
|
|
7757
7887
|
if (!tp) { return }
|
|
7758
|
-
|
|
7759
|
-
return
|
|
7760
|
-
}
|
|
7888
|
+
|
|
7761
7889
|
var ref = this._touchParams;
|
|
7762
7890
|
var startX = ref.startX;
|
|
7763
7891
|
var startY = ref.startY;
|
|
@@ -7777,9 +7905,24 @@ var slideMixin = {
|
|
|
7777
7905
|
if (isV) {
|
|
7778
7906
|
return
|
|
7779
7907
|
}
|
|
7780
|
-
|
|
7781
|
-
|
|
7908
|
+
|
|
7909
|
+
if (this._sliding) {
|
|
7910
|
+
event.stopPropagation();
|
|
7911
|
+
return
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7782
7914
|
var inner = this.$refs.inner;
|
|
7915
|
+
// 如果已经有一个激活的slider,则不再处理其他slider
|
|
7916
|
+
if (touchSliderInstance && touchSliderInstance != inner) {
|
|
7917
|
+
event.stopPropagation();
|
|
7918
|
+
return;
|
|
7919
|
+
}
|
|
7920
|
+
|
|
7921
|
+
// horizontal scroll. trigger scroll event.
|
|
7922
|
+
event.stopPropagation()
|
|
7923
|
+
|
|
7924
|
+
touchSliderInstance = inner;
|
|
7925
|
+
|
|
7783
7926
|
if (inner && offsetX) {
|
|
7784
7927
|
if (!this._nodesOffsetCleared) {
|
|
7785
7928
|
this._nodesOffsetCleared = true;
|
|
@@ -7788,21 +7931,31 @@ var slideMixin = {
|
|
|
7788
7931
|
this._emitScrollEvent('weex$scroll', {
|
|
7789
7932
|
offsetXRatio: offsetX / this._wrapperWidth
|
|
7790
7933
|
});
|
|
7791
|
-
|
|
7792
|
-
inner.style.
|
|
7793
|
-
inner.style.
|
|
7934
|
+
// ddd
|
|
7935
|
+
// inner.style.webkitTransform = "translate3d(" + (this.innerOffset + offsetX) + "px, 0, 0)";
|
|
7936
|
+
// inner.style.mozTransform = "translate3d(" + (this.innerOffset + offsetX) + "px, 0, 0)";
|
|
7937
|
+
// inner.style.transform = "translate3d(" + (this.innerOffset + offsetX) + "px, 0, 0)";
|
|
7938
|
+
inner.style.left = (this .innerOffset + offsetX) + 'px'
|
|
7794
7939
|
}
|
|
7795
7940
|
},
|
|
7796
7941
|
|
|
7797
7942
|
_handleTouchEnd: function _handleTouchEnd (event) {
|
|
7943
|
+
var inner = this.$refs.inner;
|
|
7944
|
+
if (touchSliderInstance == inner) {
|
|
7945
|
+
touchSliderInstance= null;
|
|
7946
|
+
} else {
|
|
7947
|
+
return;
|
|
7948
|
+
}
|
|
7949
|
+
|
|
7798
7950
|
this._startAutoPlay();
|
|
7799
7951
|
var tp = this._touchParams;
|
|
7800
7952
|
if (!tp) { return }
|
|
7801
7953
|
var isV = tp.isVertical;
|
|
7802
|
-
if (typeof isV === 'undefined') {
|
|
7954
|
+
if (typeof isV === 'undefined' || isV) {
|
|
7803
7955
|
return
|
|
7804
7956
|
}
|
|
7805
|
-
|
|
7957
|
+
|
|
7958
|
+
event.stopPropagation();
|
|
7806
7959
|
var offsetX = tp.offsetX;
|
|
7807
7960
|
if (inner) {
|
|
7808
7961
|
this._nodesOffsetCleared = false;
|
|
@@ -7816,6 +7969,11 @@ var slideMixin = {
|
|
|
7816
7969
|
},
|
|
7817
7970
|
|
|
7818
7971
|
_handleTouchCancel: function _handleTouchCancel (event) {
|
|
7972
|
+
var inner = this.$refs.inner;
|
|
7973
|
+
if (touchSliderInstance == inner) {
|
|
7974
|
+
touchSliderInstance= null;
|
|
7975
|
+
}
|
|
7976
|
+
|
|
7819
7977
|
return this._handleTouchEnd(event)
|
|
7820
7978
|
},
|
|
7821
7979
|
|
package/package.json
CHANGED