@dolphinweex/weex-vue-render 0.2.38 → 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.
Files changed (2) hide show
  1. package/dist/index.common.js +124 -84
  2. package/package.json +1 -1
@@ -3367,7 +3367,18 @@ function watchAppear (context, fireNow) {
3367
3367
  var el = watchAppearList[i];
3368
3368
  var appearOffset = getAppearOffset(el);
3369
3369
  var visibleData = isElementVisible(el, container, dir, appearOffset);
3370
- detectAppear(el, visibleData, dir);
3370
+ /**
3371
+ * BUG2025052771230
3372
+ * triggerAppearEvent 执行过快可能会导致AI对话聊天窗口重叠问题
3373
+ * 此处延时执行是临时规避措施,后续需要优化
3374
+ */
3375
+ if (i == 0) {
3376
+ setTimeout(() => {
3377
+ detectAppear(el, visibleData, dir);
3378
+ }, 1);
3379
+ } else {
3380
+ detectAppear(el, visibleData, dir);
3381
+ }
3371
3382
  }
3372
3383
  };
3373
3384
  container.addEventListener('scroll', throttle(scrollHandler, 100, true));
@@ -6054,7 +6065,11 @@ var scrollable$1 = {
6054
6065
 
6055
6066
  reachTop: function reachTop () {
6056
6067
  var wrapper = this.$refs.wrapper;
6057
- 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
6058
6073
  },
6059
6074
 
6060
6075
  reachBottom: function reachBottom (offset) {
@@ -6095,7 +6110,6 @@ var scrollable$1 = {
6095
6110
  if (!this.scrollable) {
6096
6111
  return
6097
6112
  }
6098
-
6099
6113
  var tp = this._touchParams;
6100
6114
  if (!tp) { return }
6101
6115
 
@@ -6115,19 +6129,7 @@ var scrollable$1 = {
6115
6129
  // 如果是水平滚动,并且手势是水平方向,则阻止冒泡
6116
6130
  // 如果是垂直滚动,并且手势是垂直方向,则阻止冒泡
6117
6131
  var isScrollHorizontal = this.$el.classList.value.indexOf("weex-scroller-horizontal") > -1 || this.$el.classList.value.indexOf("weex-recycle-horizontal") > -1
6118
- console.log("dom", this.$el.classList.value)
6119
- if (isScrollHorizontal) {
6120
- if (!isV) {
6121
- // 水平
6122
- event.stopPropagation();
6123
- return;
6124
- }
6125
- return;
6126
- }else {
6127
- if (!isV) {
6128
- return;
6129
- }
6130
- }
6132
+
6131
6133
 
6132
6134
  if (!this._refresh && !this._loading) {
6133
6135
  return
@@ -6148,6 +6150,23 @@ var scrollable$1 = {
6148
6150
  }
6149
6151
  else if (this._loading && (dir === 'up') && reachBottom) {
6150
6152
  this._loading.pullingUp(-offsetY);
6153
+ var wrapper = this.$refs.wrapper;
6154
+ if (wrapper) {
6155
+ // 增加 1 像素,强制 scroll 区域“撑开”
6156
+ wrapper.scrollTop = wrapper.scrollTop + 5;
6157
+ }
6158
+ }
6159
+ }
6160
+ if (isScrollHorizontal) {
6161
+ if (!isV) {
6162
+ // 水平
6163
+ event.stopPropagation();
6164
+ return;
6165
+ }
6166
+ return;
6167
+ }else {
6168
+ if (!isV) {
6169
+ return;
6151
6170
  }
6152
6171
  }
6153
6172
  },
@@ -7044,7 +7063,6 @@ function getLoading () {
7044
7063
  methods: {
7045
7064
  pulling: function pulling (offsetY) {
7046
7065
  if ( offsetY === void 0 ) offsetY = 0;
7047
-
7048
7066
  this.height = offsetY;
7049
7067
  },
7050
7068
  pullingUp: function pullingUp (offsetY) {
@@ -7053,7 +7071,7 @@ function getLoading () {
7053
7071
  },
7054
7072
  pullingEnd: function pullingEnd () {
7055
7073
  this.$el && (this.$el.style.transition = "height .2s");
7056
- if (this.height >= this.viewHeight) {
7074
+ if ( this.height >= Math.max(this.viewHeight, 200)) {
7057
7075
  this.pulling(this.viewHeight);
7058
7076
  if (this.$el) {
7059
7077
  dispatchNativeEvent(this.$el, 'loading');
@@ -7145,6 +7163,7 @@ function getRefresh (weex) {
7145
7163
  },
7146
7164
  watch: {
7147
7165
  height: function height (val) {
7166
+ if(val >150) val = 150
7148
7167
  this.$el.style.height = val + "px";
7149
7168
  },
7150
7169
  display: function display (val) {
@@ -7733,123 +7752,117 @@ var slideMixin = {
7733
7752
  return;
7734
7753
  }
7735
7754
  }
7736
-
7755
+
7737
7756
  if (!this._preIndex && this._preIndex !== 0) {
7738
7757
  this._preIndex = this.currentIndex || 0;
7739
7758
  }
7740
-
7759
+
7741
7760
  if (this._sliding) {
7742
7761
  return;
7743
7762
  }
7744
7763
  this._sliding = true;
7745
-
7764
+
7746
7765
  var inner = this.$refs.inner;
7747
7766
  var step = this._step = this.frameCount <= 1 ? 0 : this._preIndex - index;
7748
-
7767
+
7749
7768
  if (inner) {
7750
7769
  this._prepareNodes();
7751
- var innerX = parseFloat(inner.style.left) || 0;
7752
- var dist = innerX - this.innerOffset + step;
7753
-
7754
- // 处理无限轮播的边界情况 将目标元素先定位到目的地 动画结束后再回归原位
7770
+ var currentX = this._getPosition(inner);
7771
+ var dist = currentX - this.innerOffset + step;
7772
+
7773
+ // 处理无限轮播的边界情况
7755
7774
  if (this.infinite && this.infinite !== 'false') {
7756
7775
  if (index < 0) {
7757
7776
  // 从第一张向左滑
7758
7777
  var lastIndex = this.frameCount - 1;
7759
-
7760
- // 先将最后一张放到左侧
7761
7778
  var lastNode = this._cells[lastIndex].elm;
7762
7779
  lastNode.style.position = 'absolute';
7763
- lastNode.style.left = `-${this._wrapperWidth}px`;
7780
+ this._setPosition(lastNode, -this._wrapperWidth);
7764
7781
  lastNode.style.opacity = '1';
7765
7782
  lastNode.style.zIndex = '10';
7783
+
7766
7784
  // 执行向左滑动动画
7767
- 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`;
7768
7786
  this.innerOffset += this._wrapperWidth;
7769
- inner.style.left = `${this.innerOffset}px`;
7770
-
7771
- // 动画结束后第一张在充值回原先位置
7772
- setTimeout(() => {
7773
- inner.style.transition = 'none';
7787
+ this._setPosition(inner, this.innerOffset);
7788
+
7789
+ // 动画结束后重置回原先位置
7790
+ setTimeout(() => {
7791
+ inner.style.transition = 'none';
7774
7792
  lastNode.style.position = '';
7775
- lastNode.style.left = '';
7793
+ this._setPosition(lastNode, 0);
7776
7794
  this.innerOffset = -lastIndex * this._wrapperWidth;
7777
- inner.style.left = `${this.innerOffset}px`;
7778
-
7795
+ this._setPosition(inner, this.innerOffset);
7796
+
7779
7797
  setTimeout(() => {
7780
- 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`;
7781
7799
  }, 50);
7782
- }, TRANSITION_TIME);
7783
-
7800
+ }, TRANSITION_TIME);
7801
+
7784
7802
  index = lastIndex;
7785
7803
  } else if (index >= this.frameCount) {
7786
7804
  // 从最后一张向右滑
7787
- // 克隆第一张图片并放置在适当位置
7788
7805
  var firstNode = this._cells[0].elm;
7789
7806
  var cloneNode = firstNode.cloneNode(true);
7790
7807
  cloneNode.style.position = 'absolute';
7791
- cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
7808
+ this._setPosition(cloneNode, this.frameCount * this._wrapperWidth);
7792
7809
  cloneNode.style.width = `${this._wrapperWidth}px`;
7793
7810
  cloneNode.style.zIndex = '10';
7794
7811
  inner.appendChild(cloneNode);
7795
-
7812
+
7796
7813
  // 执行向右滑动动画
7797
- 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`;
7798
7815
  this.innerOffset -= this._wrapperWidth;
7799
- inner.style.left = `${this.innerOffset}px`;
7800
-
7816
+ this._setPosition(inner, this.innerOffset);
7817
+
7801
7818
  // 动画结束后重置位置
7802
- setTimeout(() => {
7803
- // 移除过渡效果
7804
- inner.style.transition = 'none';
7805
-
7806
- // 移除克隆节点
7819
+ setTimeout(() => {
7820
+ inner.style.transition = 'none';
7821
+
7807
7822
  if (cloneNode.parentNode) {
7808
7823
  inner.removeChild(cloneNode);
7809
7824
  }
7810
-
7811
- // 重置位置到第一张
7825
+
7812
7826
  this.innerOffset = 0;
7813
- inner.style.left = '0px';
7814
-
7815
- // 短暂延迟后恢复过渡效果
7827
+ this._setPosition(inner, 0);
7828
+
7816
7829
  setTimeout(() => {
7817
- 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`;
7818
7831
  }, 50);
7819
- }, TRANSITION_TIME);
7820
-
7832
+ }, TRANSITION_TIME);
7833
+
7821
7834
  index = 0;
7822
- } else {
7823
- // 正常切换
7835
+ } else {
7836
+ // 正常切换
7824
7837
  this.innerOffset = -index * this._wrapperWidth;
7825
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7826
- 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);
7827
7840
  }
7828
7841
  } else {
7829
7842
  // 非无限轮播的正常切换
7830
7843
  this.innerOffset = -index * this._wrapperWidth;
7831
- inner.style.transition = `left ${TRANSITION_TIME / 1000}s ease-in-out`;
7832
- 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);
7833
7846
  }
7834
-
7847
+
7835
7848
  // 触发滚动事件
7836
7849
  if (!isTouchScroll) {
7837
7850
  this._emitScrollEvent('scrollstart');
7838
7851
  }
7839
-
7852
+
7840
7853
  setTimeout(() => {
7841
7854
  this$1._throttleEmitScroll(dist, () => {
7842
7855
  this$1._emitScrollEvent('scrollend');
7843
7856
  });
7844
7857
  }, THROTTLE_SCROLL_TIME);
7845
-
7858
+
7846
7859
  this._loopShowNodes(step);
7847
-
7860
+
7848
7861
  setTimeout(() => {
7849
7862
  if (this$1.isNeighbor) {
7850
7863
  this$1._setNeighbors();
7851
7864
  }
7852
-
7865
+
7853
7866
  setTimeout(() => {
7854
7867
  inner.style.transition = '';
7855
7868
  for (var i = this$1._showStartIdx; i <= this$1._showEndIdx; i++) {
@@ -7863,13 +7876,13 @@ var slideMixin = {
7863
7876
  }, NEIGHBOR_SCALE_TIME);
7864
7877
  }, TRANSITION_TIME);
7865
7878
  }
7866
-
7879
+
7867
7880
  if (index !== this._preIndex) {
7868
7881
  weex.utils.dispatchNativeEvent(this.$el, 'change', {
7869
7882
  index: index
7870
7883
  });
7871
7884
  }
7872
-
7885
+
7873
7886
  this.currentIndex = index;
7874
7887
  this._preIndex = index;
7875
7888
  },
@@ -8256,16 +8269,32 @@ var slideMixin = {
8256
8269
  timeStamp: event.timeStamp
8257
8270
  };
8258
8271
  },
8259
-
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
+ },
8260
8289
  _handleTouchMove: function _handleTouchMove (event) {
8261
8290
  var tp = this._touchParams;
8262
8291
  if (!tp) { return }
8263
-
8292
+
8264
8293
  // 如果子view已经处在swipe事件中,并切不允许事件冒泡则不处理当前的事件
8265
8294
  if (weex.gestureAleadyHandleSwipeOnce && !weex.gestureHandleSwipeCanPropagation) {
8266
8295
  return;
8267
8296
  }
8268
-
8297
+
8269
8298
  var ref = this._touchParams;
8270
8299
  var startX = ref.startX;
8271
8300
  var startY = ref.startY;
@@ -8301,14 +8330,14 @@ var slideMixin = {
8301
8330
  var lastIndex = this.frameCount - 1;
8302
8331
  var lastNode = this._cells[lastIndex].elm;
8303
8332
  lastNode.style.position = 'absolute';
8304
- lastNode.style.left = `-${this._wrapperWidth}px`;
8333
+ this._setPosition(lastNode, -this._wrapperWidth);
8305
8334
  lastNode.style.opacity = '1';
8306
8335
  } else if (atLast && isLeftSwipe) {
8307
8336
  // 从最后一张向左滑到第一张
8308
8337
  var firstNode = this._cells[0].elm;
8309
8338
  var cloneNode = firstNode.cloneNode(true);
8310
8339
  cloneNode.style.position = 'absolute';
8311
- cloneNode.style.left = `${this.frameCount * this._wrapperWidth}px`;
8340
+ this._setPosition(cloneNode, this.frameCount * this._wrapperWidth);
8312
8341
  cloneNode.style.width = `${this._wrapperWidth}px`;
8313
8342
  inner.appendChild(cloneNode);
8314
8343
  tp.cloneNode = cloneNode;
@@ -8324,19 +8353,19 @@ var slideMixin = {
8324
8353
  event.stopPropagation();
8325
8354
  return
8326
8355
  }
8327
-
8356
+
8328
8357
  var inner = this.$refs.inner;
8329
8358
  // 如果已经有一个激活的slider,则不再处理其他slider
8330
8359
  if (touchSliderInstance && touchSliderInstance != inner) {
8331
8360
  event.stopPropagation();
8332
8361
  return;
8333
8362
  }
8334
-
8363
+
8335
8364
  // horizontal scroll. trigger scroll event.
8336
8365
  event.stopPropagation()
8337
-
8366
+
8338
8367
  touchSliderInstance = inner;
8339
-
8368
+
8340
8369
  if (!this.autoPlay && !this.infinite) {
8341
8370
  // 如果不是自动播放,则当滚动到最后一页时,offsetX不能 < 0
8342
8371
  // 如果不是自动播放,则当滚动到第一页时,offsetX不能 > 0
@@ -8347,7 +8376,7 @@ var slideMixin = {
8347
8376
  offsetX = Math.min(offsetX, 0)
8348
8377
  }
8349
8378
  }
8350
-
8379
+
8351
8380
  if (inner && offsetX) {
8352
8381
  if (!this._nodesOffsetCleared) {
8353
8382
  this._nodesOffsetCleared = true;
@@ -8356,7 +8385,7 @@ var slideMixin = {
8356
8385
  this._emitScrollEvent('weex$scroll', {
8357
8386
  offsetXRatio: offsetX / this._wrapperWidth
8358
8387
  });
8359
- inner.style.left = (this .innerOffset + offsetX) + 'px'
8388
+ this._setPosition(inner, this.innerOffset + offsetX);
8360
8389
  }
8361
8390
  },
8362
8391
 
@@ -8470,6 +8499,10 @@ var slider$1 = {
8470
8499
  infinite: {
8471
8500
  type: [String, Boolean],
8472
8501
  default: true
8502
+ },
8503
+ isTransform:{
8504
+ type: Boolean,
8505
+ default: false
8473
8506
  }
8474
8507
  },
8475
8508
 
@@ -10437,6 +10470,13 @@ var dom = {
10437
10470
  var offset = (isWindow ? 0 : ct[("scroll" + dSuffix)]) + elRect[dir] - ctRect[dir];
10438
10471
  if (options) {
10439
10472
  offset += options.offset && options.offset * weex.config.env.scale || 0;
10473
+ /**
10474
+ * 计算出的 offset 不适配 小美 AI 聊天框消息滑到底部; 通过传入的标志, 把计算出的 offset 重置为 0
10475
+ * 此为临时方案,后续需要优化
10476
+ */
10477
+ if(options.isReset){
10478
+ offset = 0
10479
+ }
10440
10480
  }
10441
10481
  else {}
10442
10482
  if (options && options.animated === false) {
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.38"
52
+ "version": "0.2.40"
53
53
  }