@dolphinweex/weex-vue-render 0.2.1 → 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 +149 -77
- 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;
|
|
@@ -5946,23 +5931,59 @@ var scrollable$1 = {
|
|
|
5946
5931
|
},
|
|
5947
5932
|
|
|
5948
5933
|
handleTouchStart: function handleTouchStart (event) {
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
this.
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
};
|
|
5959
|
-
}
|
|
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
|
+
};
|
|
5960
5943
|
},
|
|
5961
5944
|
|
|
5962
5945
|
handleTouchMove: function handleTouchMove (event) {
|
|
5963
|
-
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) {
|
|
5964
5984
|
return
|
|
5965
5985
|
}
|
|
5986
|
+
|
|
5966
5987
|
var inner = this.$refs.inner;
|
|
5967
5988
|
var ref = this._touchParams;
|
|
5968
5989
|
var startY = ref.startY;
|
|
@@ -5986,6 +6007,18 @@ var scrollable$1 = {
|
|
|
5986
6007
|
if (!this._touchParams || !this._refresh && !this._loading) {
|
|
5987
6008
|
return
|
|
5988
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
|
+
|
|
5989
6022
|
var inner = this.$refs.inner;
|
|
5990
6023
|
var ref = this._touchParams;
|
|
5991
6024
|
var startY = ref.startY;
|
|
@@ -6061,9 +6094,6 @@ function getList (weex) {
|
|
|
6061
6094
|
},
|
|
6062
6095
|
mounted: function mounted () {
|
|
6063
6096
|
var this$1 = this;
|
|
6064
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
6065
|
-
this$1.$el.classList.remove("height-0");
|
|
6066
|
-
}
|
|
6067
6097
|
setTimeout(() => {
|
|
6068
6098
|
if (this$1.$el.clientHeight == 0) {
|
|
6069
6099
|
this$1.$el.classList.remove("height-0");
|
|
@@ -6102,7 +6132,7 @@ function getList (weex) {
|
|
|
6102
6132
|
on: {
|
|
6103
6133
|
scroll: this.handleScroll,
|
|
6104
6134
|
touchstart: this.handleTouchStart,
|
|
6105
|
-
touchmove: this.handleTouchMove,
|
|
6135
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6106
6136
|
touchend: this.handleTouchEnd
|
|
6107
6137
|
},
|
|
6108
6138
|
staticStyle: extractComponentStyle(this)
|
|
@@ -6157,9 +6187,6 @@ function getScroller (weex) {
|
|
|
6157
6187
|
},
|
|
6158
6188
|
mounted: function mounted () {
|
|
6159
6189
|
var this$1 = this;
|
|
6160
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
6161
|
-
this$1.$el.classList.remove("height-0");
|
|
6162
|
-
}
|
|
6163
6190
|
setTimeout(() => {
|
|
6164
6191
|
if (this$1.$el.clientHeight == 0) {
|
|
6165
6192
|
this$1.$el.classList.remove("height-0");
|
|
@@ -6220,7 +6247,7 @@ function getScroller (weex) {
|
|
|
6220
6247
|
on: {
|
|
6221
6248
|
scroll: this.handleScroll,
|
|
6222
6249
|
touchstart: this.handleTouchStart,
|
|
6223
|
-
touchmove: this.handleTouchMove,
|
|
6250
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6224
6251
|
touchend: this.handleTouchEnd
|
|
6225
6252
|
},
|
|
6226
6253
|
staticClass: this.wrapperClass,
|
|
@@ -6611,7 +6638,7 @@ function getWaterfall (weex) {
|
|
|
6611
6638
|
on: {
|
|
6612
6639
|
scroll: this.handleScroll,
|
|
6613
6640
|
touchstart: this.handleTouchStart,
|
|
6614
|
-
touchmove: this.handleTouchMove,
|
|
6641
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
6615
6642
|
touchend: this.handleTouchEnd
|
|
6616
6643
|
},
|
|
6617
6644
|
staticClass: 'weex-waterfall weex-waterfall-wrapper weex-ct',
|
|
@@ -7073,9 +7100,6 @@ function getList$1 (weex) {
|
|
|
7073
7100
|
},
|
|
7074
7101
|
mounted: function mounted () {
|
|
7075
7102
|
var this$1 = this;
|
|
7076
|
-
if (isAbsoluteOrFixedPositioned(this$1.$el)) {
|
|
7077
|
-
this$1.$el.classList.remove("height-0");
|
|
7078
|
-
}
|
|
7079
7103
|
setTimeout(() => {
|
|
7080
7104
|
if (this$1.$el.clientHeight == 0) {
|
|
7081
7105
|
this$1.$el.classList.remove("height-0");
|
|
@@ -7143,7 +7167,7 @@ function getList$1 (weex) {
|
|
|
7143
7167
|
on: {
|
|
7144
7168
|
scroll: this.handleScroll,
|
|
7145
7169
|
touchstart: this.handleTouchStart,
|
|
7146
|
-
touchmove: this.handleTouchMove,
|
|
7170
|
+
touchmove: this.handleTouchMove.bind(this),
|
|
7147
7171
|
touchend: this.handleTouchEnd
|
|
7148
7172
|
},
|
|
7149
7173
|
staticStyle: extractComponentStyle(this)
|
|
@@ -7224,6 +7248,8 @@ var MAIN_SLIDE_OPACITY = 1;
|
|
|
7224
7248
|
var THROTTLE_SCROLL_TIME = 25;
|
|
7225
7249
|
var INTERVAL_MINIMUM = 200;
|
|
7226
7250
|
|
|
7251
|
+
var touchSliderInstance = null;
|
|
7252
|
+
|
|
7227
7253
|
var slideMixin = {
|
|
7228
7254
|
created: function created () {
|
|
7229
7255
|
this._clones = [];
|
|
@@ -7335,7 +7361,7 @@ var slideMixin = {
|
|
|
7335
7361
|
attrs: { 'weex-type': this.isNeighbor ? 'slider-neighbor' : 'slider' },
|
|
7336
7362
|
on: {
|
|
7337
7363
|
touchstart: this._handleTouchStart,
|
|
7338
|
-
touchmove: weex.utils.throttle(weex.utils.bind(this._handleTouchMove, this),
|
|
7364
|
+
touchmove: weex.utils.throttle(weex.utils.bind(this._handleTouchMove, this), 10),
|
|
7339
7365
|
touchend: this._handleTouchEnd,
|
|
7340
7366
|
touchcancel: this._handleTouchCancel
|
|
7341
7367
|
},
|
|
@@ -7412,16 +7438,19 @@ var slideMixin = {
|
|
|
7412
7438
|
this._prepareNodes();
|
|
7413
7439
|
var translate = weex.utils.getTransformObj(inner).translate;
|
|
7414
7440
|
var match = translate && translate.match(/translate[^(]+\(([+-\d.]+)/);
|
|
7415
|
-
var innerX = match && match[1] || 0;
|
|
7441
|
+
var innerX = parseFloat(inner.style.left); //match && match[1] || 0;
|
|
7416
7442
|
var dist = innerX - this.innerOffset;
|
|
7417
7443
|
this.innerOffset += step * this._wrapperWidth;
|
|
7418
7444
|
// transform the whole slides group.
|
|
7419
|
-
|
|
7420
|
-
inner.style.
|
|
7421
|
-
inner.style.
|
|
7422
|
-
inner.style.
|
|
7423
|
-
inner.style.
|
|
7424
|
-
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
|
+
|
|
7425
7454
|
|
|
7426
7455
|
// emit scroll events.
|
|
7427
7456
|
if (!isTouchScroll) {
|
|
@@ -7473,9 +7502,11 @@ var slideMixin = {
|
|
|
7473
7502
|
var node = this$1._showNodes[i];
|
|
7474
7503
|
node = node && node.firstElementChild;
|
|
7475
7504
|
if (!node) { continue }
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
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'
|
|
7479
7510
|
}
|
|
7480
7511
|
},
|
|
7481
7512
|
|
|
@@ -7591,9 +7622,12 @@ var slideMixin = {
|
|
|
7591
7622
|
|
|
7592
7623
|
node._inShow = true;
|
|
7593
7624
|
var translateX = index * this._wrapperWidth - this.innerOffset;
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7625
|
+
// ddd
|
|
7626
|
+
// weex.utils.addTransform(node, {
|
|
7627
|
+
// translate: ("translate3d(" + translateX + "px, 0px, 0px)")
|
|
7628
|
+
// });
|
|
7629
|
+
node.style.left = translateX + 'px'
|
|
7630
|
+
|
|
7597
7631
|
node.style.zIndex = 99 - Math.abs(index);
|
|
7598
7632
|
node.style.opacity = 1;
|
|
7599
7633
|
node._showIndex = index;
|
|
@@ -7681,15 +7715,18 @@ var slideMixin = {
|
|
|
7681
7715
|
if ( transformExtra === void 0 ) transformExtra = {};
|
|
7682
7716
|
|
|
7683
7717
|
weex.utils.extendKeys(to.style, from.style, styles);
|
|
7718
|
+
to.style.left = from.style.left;
|
|
7684
7719
|
var transObj = weex.utils.getTransformObj(from);
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
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
|
+
}
|
|
7693
7730
|
},
|
|
7694
7731
|
|
|
7695
7732
|
/**
|
|
@@ -7707,7 +7744,7 @@ var slideMixin = {
|
|
|
7707
7744
|
return
|
|
7708
7745
|
}
|
|
7709
7746
|
var origShowIndex = origNode._showIndex;
|
|
7710
|
-
var styleProps = ['opacity', 'zIndex'];
|
|
7747
|
+
var styleProps = ['opacity', 'zIndex', 'left'];
|
|
7711
7748
|
var cl;
|
|
7712
7749
|
if (Math.abs(origShowIndex) <= 1) {
|
|
7713
7750
|
// leave a clone to replace the origNode in the show zone(-1 ~ 1).
|
|
@@ -7717,9 +7754,12 @@ var slideMixin = {
|
|
|
7717
7754
|
}
|
|
7718
7755
|
origNode._inShow = true;
|
|
7719
7756
|
var transObj = weex.utils.getTransformObj(clone);
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
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
|
+
|
|
7723
7763
|
this._copyStyle(clone, origNode, styleProps, transObj);
|
|
7724
7764
|
this._removeClone(clone);
|
|
7725
7765
|
if (!cl) {
|
|
@@ -7802,7 +7842,11 @@ var slideMixin = {
|
|
|
7802
7842
|
translateX = 0;
|
|
7803
7843
|
}
|
|
7804
7844
|
transObj.translate = "translate3d(" + translateX + "px, 0px, 0px)";
|
|
7805
|
-
|
|
7845
|
+
|
|
7846
|
+
// ddd
|
|
7847
|
+
// weex.utils.addTransform(elm, transObj);
|
|
7848
|
+
elm.style.left = translateX + 'px'
|
|
7849
|
+
|
|
7806
7850
|
elm.style.opacity = i === 0 ? MAIN_SLIDE_OPACITY : this$1.neighborAlpha;
|
|
7807
7851
|
}
|
|
7808
7852
|
},
|
|
@@ -7841,9 +7885,7 @@ var slideMixin = {
|
|
|
7841
7885
|
_handleTouchMove: function _handleTouchMove (event) {
|
|
7842
7886
|
var tp = this._touchParams;
|
|
7843
7887
|
if (!tp) { return }
|
|
7844
|
-
|
|
7845
|
-
return
|
|
7846
|
-
}
|
|
7888
|
+
|
|
7847
7889
|
var ref = this._touchParams;
|
|
7848
7890
|
var startX = ref.startX;
|
|
7849
7891
|
var startY = ref.startY;
|
|
@@ -7863,9 +7905,24 @@ var slideMixin = {
|
|
|
7863
7905
|
if (isV) {
|
|
7864
7906
|
return
|
|
7865
7907
|
}
|
|
7866
|
-
|
|
7867
|
-
|
|
7908
|
+
|
|
7909
|
+
if (this._sliding) {
|
|
7910
|
+
event.stopPropagation();
|
|
7911
|
+
return
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7868
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
|
+
|
|
7869
7926
|
if (inner && offsetX) {
|
|
7870
7927
|
if (!this._nodesOffsetCleared) {
|
|
7871
7928
|
this._nodesOffsetCleared = true;
|
|
@@ -7874,21 +7931,31 @@ var slideMixin = {
|
|
|
7874
7931
|
this._emitScrollEvent('weex$scroll', {
|
|
7875
7932
|
offsetXRatio: offsetX / this._wrapperWidth
|
|
7876
7933
|
});
|
|
7877
|
-
|
|
7878
|
-
inner.style.
|
|
7879
|
-
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'
|
|
7880
7939
|
}
|
|
7881
7940
|
},
|
|
7882
7941
|
|
|
7883
7942
|
_handleTouchEnd: function _handleTouchEnd (event) {
|
|
7943
|
+
var inner = this.$refs.inner;
|
|
7944
|
+
if (touchSliderInstance == inner) {
|
|
7945
|
+
touchSliderInstance= null;
|
|
7946
|
+
} else {
|
|
7947
|
+
return;
|
|
7948
|
+
}
|
|
7949
|
+
|
|
7884
7950
|
this._startAutoPlay();
|
|
7885
7951
|
var tp = this._touchParams;
|
|
7886
7952
|
if (!tp) { return }
|
|
7887
7953
|
var isV = tp.isVertical;
|
|
7888
|
-
if (typeof isV === 'undefined') {
|
|
7954
|
+
if (typeof isV === 'undefined' || isV) {
|
|
7889
7955
|
return
|
|
7890
7956
|
}
|
|
7891
|
-
|
|
7957
|
+
|
|
7958
|
+
event.stopPropagation();
|
|
7892
7959
|
var offsetX = tp.offsetX;
|
|
7893
7960
|
if (inner) {
|
|
7894
7961
|
this._nodesOffsetCleared = false;
|
|
@@ -7902,6 +7969,11 @@ var slideMixin = {
|
|
|
7902
7969
|
},
|
|
7903
7970
|
|
|
7904
7971
|
_handleTouchCancel: function _handleTouchCancel (event) {
|
|
7972
|
+
var inner = this.$refs.inner;
|
|
7973
|
+
if (touchSliderInstance == inner) {
|
|
7974
|
+
touchSliderInstance= null;
|
|
7975
|
+
}
|
|
7976
|
+
|
|
7905
7977
|
return this._handleTouchEnd(event)
|
|
7906
7978
|
},
|
|
7907
7979
|
|
package/package.json
CHANGED