@dolphinweex/weex-vue-render 0.2.39 → 0.2.40

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.
@@ -3372,9 +3372,13 @@ function watchAppear (context, fireNow) {
3372
3372
  * triggerAppearEvent 执行过快可能会导致AI对话聊天窗口重叠问题
3373
3373
  * 此处延时执行是临时规避措施,后续需要优化
3374
3374
  */
3375
- setTimeout(() => {
3375
+ if (i == 0) {
3376
+ setTimeout(() => {
3377
+ detectAppear(el, visibleData, dir);
3378
+ }, 1);
3379
+ } else {
3376
3380
  detectAppear(el, visibleData, dir);
3377
- }, i);
3381
+ }
3378
3382
  }
3379
3383
  };
3380
3384
  container.addEventListener('scroll', throttle(scrollHandler, 100, true));
@@ -6061,7 +6065,11 @@ var scrollable$1 = {
6061
6065
 
6062
6066
  reachTop: function reachTop () {
6063
6067
  var wrapper = this.$refs.wrapper;
6064
- return (!!wrapper) && (wrapper.scrollTop <= 0)
6068
+ let flag = (!!wrapper) && (wrapper.scrollTop <= 0)
6069
+ if (wrapper.style.transform === 'rotate(180deg)') {
6070
+ return flag | this.reachBottom()
6071
+ }
6072
+ return flag
6065
6073
  },
6066
6074
 
6067
6075
  reachBottom: function reachBottom (offset) {
@@ -7063,7 +7071,7 @@ function getLoading () {
7063
7071
  },
7064
7072
  pullingEnd: function pullingEnd () {
7065
7073
  this.$el && (this.$el.style.transition = "height .2s");
7066
- if ( this.height >= Math.max(this.viewHeight, 150)) {
7074
+ if ( this.height >= Math.max(this.viewHeight, 200)) {
7067
7075
  this.pulling(this.viewHeight);
7068
7076
  if (this.$el) {
7069
7077
  dispatchNativeEvent(this.$el, 'loading');
@@ -7744,123 +7752,117 @@ var slideMixin = {
7744
7752
  return;
7745
7753
  }
7746
7754
  }
7747
-
7755
+
7748
7756
  if (!this._preIndex && this._preIndex !== 0) {
7749
7757
  this._preIndex = this.currentIndex || 0;
7750
7758
  }
7751
-
7759
+
7752
7760
  if (this._sliding) {
7753
7761
  return;
7754
7762
  }
7755
7763
  this._sliding = true;
7756
-
7764
+
7757
7765
  var inner = this.$refs.inner;
7758
7766
  var step = this._step = this.frameCount <= 1 ? 0 : this._preIndex - index;
7759
-
7767
+
7760
7768
  if (inner) {
7761
7769
  this._prepareNodes();
7762
- var innerX = parseFloat(inner.style.left) || 0;
7763
- var dist = innerX - this.innerOffset + step;
7764
-
7765
- // 处理无限轮播的边界情况 将目标元素先定位到目的地 动画结束后再回归原位
7770
+ var currentX = this._getPosition(inner);
7771
+ var dist = currentX - this.innerOffset + step;
7772
+
7773
+ // 处理无限轮播的边界情况
7766
7774
  if (this.infinite && this.infinite !== 'false') {
7767
7775
  if (index < 0) {
7768
7776
  // 从第一张向左滑
7769
7777
  var lastIndex = this.frameCount - 1;
7770
-
7771
- // 先将最后一张放到左侧
7772
7778
  var lastNode = this._cells[lastIndex].elm;
7773
7779
  lastNode.style.position = 'absolute';
7774
- lastNode.style.left = `-${this._wrapperWidth}px`;
7780
+ this._setPosition(lastNode, -this._wrapperWidth);
7775
7781
  lastNode.style.opacity = '1';
7776
7782
  lastNode.style.zIndex = '10';
7783
+
7777
7784
  // 执行向左滑动动画
7778
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7785
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7779
7786
  this.innerOffset += this._wrapperWidth;
7780
- inner.style.left = `${this.innerOffset}px`;
7781
-
7782
- // 动画结束后第一张在充值回原先位置
7783
- setTimeout(() => {
7784
- inner.style.transition = 'none';
7787
+ this._setPosition(inner, this.innerOffset);
7788
+
7789
+ // 动画结束后重置回原先位置
7790
+ setTimeout(() => {
7791
+ inner.style.transition = 'none';
7785
7792
  lastNode.style.position = '';
7786
- lastNode.style.left = '';
7793
+ this._setPosition(lastNode, 0);
7787
7794
  this.innerOffset = -lastIndex * this._wrapperWidth;
7788
- inner.style.left = `${this.innerOffset}px`;
7789
-
7795
+ this._setPosition(inner, this.innerOffset);
7796
+
7790
7797
  setTimeout(() => {
7791
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7798
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7792
7799
  }, 50);
7793
- }, TRANSITION_TIME);
7794
-
7800
+ }, TRANSITION_TIME);
7801
+
7795
7802
  index = lastIndex;
7796
7803
  } else if (index >= this.frameCount) {
7797
7804
  // 从最后一张向右滑
7798
- // 克隆第一张图片并放置在适当位置
7799
7805
  var firstNode = this._cells[0].elm;
7800
7806
  var cloneNode = firstNode.cloneNode(true);
7801
7807
  cloneNode.style.position = 'absolute';
7802
- cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
7808
+ this._setPosition(cloneNode, this.frameCount * this._wrapperWidth);
7803
7809
  cloneNode.style.width = `${this._wrapperWidth}px`;
7804
7810
  cloneNode.style.zIndex = '10';
7805
7811
  inner.appendChild(cloneNode);
7806
-
7812
+
7807
7813
  // 执行向右滑动动画
7808
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7814
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7809
7815
  this.innerOffset -= this._wrapperWidth;
7810
- inner.style.left = `${this.innerOffset}px`;
7811
-
7816
+ this._setPosition(inner, this.innerOffset);
7817
+
7812
7818
  // 动画结束后重置位置
7813
- setTimeout(() => {
7814
- // 移除过渡效果
7815
- inner.style.transition = 'none';
7816
-
7817
- // 移除克隆节点
7819
+ setTimeout(() => {
7820
+ inner.style.transition = 'none';
7821
+
7818
7822
  if (cloneNode.parentNode) {
7819
7823
  inner.removeChild(cloneNode);
7820
7824
  }
7821
-
7822
- // 重置位置到第一张
7825
+
7823
7826
  this.innerOffset = 0;
7824
- inner.style.left = '0px';
7825
-
7826
- // 短暂延迟后恢复过渡效果
7827
+ this._setPosition(inner, 0);
7828
+
7827
7829
  setTimeout(() => {
7828
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7830
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7829
7831
  }, 50);
7830
- }, TRANSITION_TIME);
7831
-
7832
+ }, TRANSITION_TIME);
7833
+
7832
7834
  index = 0;
7833
- } else {
7834
- // 正常切换
7835
+ } else {
7836
+ // 正常切换
7835
7837
  this.innerOffset = -index * this._wrapperWidth;
7836
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7837
- inner.style.left = `${this.innerOffset}px`;
7838
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7839
+ this._setPosition(inner, this.innerOffset);
7838
7840
  }
7839
7841
  } else {
7840
7842
  // 非无限轮播的正常切换
7841
7843
  this.innerOffset = -index * this._wrapperWidth;
7842
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7843
- inner.style.left = `${this.innerOffset}px`;
7844
+ inner.style.transition = this.isTransform ? `transform ${TRANSITION_TIME / 1000}s ease-in-out` : `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7845
+ this._setPosition(inner, this.innerOffset);
7844
7846
  }
7845
-
7847
+
7846
7848
  // 触发滚动事件
7847
7849
  if (!isTouchScroll) {
7848
7850
  this._emitScrollEvent('scrollstart');
7849
7851
  }
7850
-
7852
+
7851
7853
  setTimeout(() => {
7852
7854
  this$1._throttleEmitScroll(dist, () => {
7853
7855
  this$1._emitScrollEvent('scrollend');
7854
7856
  });
7855
7857
  }, THROTTLE_SCROLL_TIME);
7856
-
7858
+
7857
7859
  this._loopShowNodes(step);
7858
-
7860
+
7859
7861
  setTimeout(() => {
7860
7862
  if (this$1.isNeighbor) {
7861
7863
  this$1._setNeighbors();
7862
7864
  }
7863
-
7865
+
7864
7866
  setTimeout(() => {
7865
7867
  inner.style.transition = '';
7866
7868
  for (var i = this$1._showStartIdx; i <= this$1._showEndIdx; i++) {
@@ -7874,13 +7876,13 @@ var slideMixin = {
7874
7876
  }, NEIGHBOR_SCALE_TIME);
7875
7877
  }, TRANSITION_TIME);
7876
7878
  }
7877
-
7879
+
7878
7880
  if (index !== this._preIndex) {
7879
7881
  weex.utils.dispatchNativeEvent(this.$el, 'change', {
7880
7882
  index: index
7881
7883
  });
7882
7884
  }
7883
-
7885
+
7884
7886
  this.currentIndex = index;
7885
7887
  this._preIndex = index;
7886
7888
  },
@@ -8267,16 +8269,32 @@ var slideMixin = {
8267
8269
  timeStamp: event.timeStamp
8268
8270
  };
8269
8271
  },
8270
-
8272
+ _setPosition(element, offset) {
8273
+ if (this.isTransform) {
8274
+ element.style.transform = `translateX(${offset}px)`;
8275
+ } else {
8276
+ element.style.left = `${offset}px`;
8277
+ }
8278
+ },
8279
+
8280
+ _getPosition(element) {
8281
+ if (this.isTransform) {
8282
+ const currentTransform = getComputedStyle(element).transform;
8283
+ const matrix = new WebKitCSSMatrix(currentTransform);
8284
+ return matrix.m41;
8285
+ } else {
8286
+ return parseFloat(element.style.left) || 0;
8287
+ }
8288
+ },
8271
8289
  _handleTouchMove: function _handleTouchMove (event) {
8272
8290
  var tp = this._touchParams;
8273
8291
  if (!tp) { return }
8274
-
8292
+
8275
8293
  // 如果子view已经处在swipe事件中,并切不允许事件冒泡则不处理当前的事件
8276
8294
  if (weex.gestureAleadyHandleSwipeOnce && !weex.gestureHandleSwipeCanPropagation) {
8277
8295
  return;
8278
8296
  }
8279
-
8297
+
8280
8298
  var ref = this._touchParams;
8281
8299
  var startX = ref.startX;
8282
8300
  var startY = ref.startY;
@@ -8312,14 +8330,14 @@ var slideMixin = {
8312
8330
  var lastIndex = this.frameCount - 1;
8313
8331
  var lastNode = this._cells[lastIndex].elm;
8314
8332
  lastNode.style.position = 'absolute';
8315
- lastNode.style.left = `-${this._wrapperWidth}px`;
8333
+ this._setPosition(lastNode, -this._wrapperWidth);
8316
8334
  lastNode.style.opacity = '1';
8317
8335
  } else if (atLast && isLeftSwipe) {
8318
8336
  // 从最后一张向左滑到第一张
8319
8337
  var firstNode = this._cells[0].elm;
8320
8338
  var cloneNode = firstNode.cloneNode(true);
8321
8339
  cloneNode.style.position = 'absolute';
8322
- cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
8340
+ this._setPosition(cloneNode, this.frameCount * this._wrapperWidth);
8323
8341
  cloneNode.style.width = `${this._wrapperWidth}px`;
8324
8342
  inner.appendChild(cloneNode);
8325
8343
  tp.cloneNode = cloneNode;
@@ -8335,19 +8353,19 @@ var slideMixin = {
8335
8353
  event.stopPropagation();
8336
8354
  return
8337
8355
  }
8338
-
8356
+
8339
8357
  var inner = this.$refs.inner;
8340
8358
  // 如果已经有一个激活的slider,则不再处理其他slider
8341
8359
  if (touchSliderInstance && touchSliderInstance != inner) {
8342
8360
  event.stopPropagation();
8343
8361
  return;
8344
8362
  }
8345
-
8363
+
8346
8364
  // horizontal scroll. trigger scroll event.
8347
8365
  event.stopPropagation()
8348
-
8366
+
8349
8367
  touchSliderInstance = inner;
8350
-
8368
+
8351
8369
  if (!this.autoPlay && !this.infinite) {
8352
8370
  // 如果不是自动播放,则当滚动到最后一页时,offsetX不能 < 0
8353
8371
  // 如果不是自动播放,则当滚动到第一页时,offsetX不能 > 0
@@ -8358,7 +8376,7 @@ var slideMixin = {
8358
8376
  offsetX = Math.min(offsetX, 0)
8359
8377
  }
8360
8378
  }
8361
-
8379
+
8362
8380
  if (inner && offsetX) {
8363
8381
  if (!this._nodesOffsetCleared) {
8364
8382
  this._nodesOffsetCleared = true;
@@ -8367,7 +8385,7 @@ var slideMixin = {
8367
8385
  this._emitScrollEvent('weex$scroll', {
8368
8386
  offsetXRatio: offsetX / this._wrapperWidth
8369
8387
  });
8370
- inner.style.left = (this .innerOffset + offsetX) + 'px'
8388
+ this._setPosition(inner, this.innerOffset + offsetX);
8371
8389
  }
8372
8390
  },
8373
8391
 
@@ -8481,6 +8499,10 @@ var slider$1 = {
8481
8499
  infinite: {
8482
8500
  type: [String, Boolean],
8483
8501
  default: true
8502
+ },
8503
+ isTransform:{
8504
+ type: Boolean,
8505
+ default: false
8484
8506
  }
8485
8507
  },
8486
8508
 
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "git+ssh://git@github.com/weexteam/weex-vue-render.git"
51
51
  },
52
- "version": "0.2.39"
52
+ "version": "0.2.40"
53
53
  }