@tuya-miniapp/smart-ui 2.12.1-beta-7 → 2.13.0

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.
@@ -26,6 +26,10 @@ SmartComponent({
26
26
  type: Boolean,
27
27
  value: true,
28
28
  },
29
+ stickyPush: {
30
+ type: Boolean,
31
+ value: true,
32
+ },
29
33
  sidebarFontSize: {
30
34
  type: String,
31
35
  },
@@ -234,11 +238,8 @@ SmartComponent({
234
238
  return;
235
239
  }
236
240
  // lowestActiveIndex 已改为在 setRect 后由 computeLowestActiveIndex() 几何计算,此处不再根据滚动推断
237
- const { sticky, stickyOffsetTop, zIndex, highlightColor } = this.data;
241
+ const { sticky, stickyOffsetTop, zIndex, highlightColor, stickyPush } = this.data;
238
242
  const activeData = hasIndex ? controlActiveIndexData : scrollChildrenGetIndexData;
239
- if (activeData === undefined) {
240
- return;
241
- }
242
243
  const activeIndex = this.children.findIndex(item => item.data.index === activeData);
243
244
  const preActiveData = (_c = (_b = this.children[activeIndex - 1]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.index;
244
245
  this.setDiffData({
@@ -262,7 +263,7 @@ SmartComponent({
262
263
  let anchorStyle = `
263
264
  color: ${highlightColor};
264
265
  `;
265
- if (isActiveAnchorSticky) {
266
+ if (isActiveAnchorSticky || !stickyPush) {
266
267
  wrapperStyle = `
267
268
  height: ${children[index].height}px;
268
269
  `;
@@ -281,9 +282,9 @@ SmartComponent({
281
282
  wrapperStyle,
282
283
  },
283
284
  });
284
- // 滚动模式时 上一个tab 要有种慢慢被滚动切换的效果
285
+ // 滚动模式时,上一个 tab 默认会有被逐步上推切换的过渡效果
285
286
  }
286
- else if (preActiveData === itemData && !hasIndex) {
287
+ else if (stickyPush && preActiveData === itemData && !hasIndex) {
287
288
  const currentAnchor = children[index];
288
289
  const currentOffsetTop = currentAnchor.top;
289
290
  const targetOffsetTop = index === children.length - 1 ? this.top : children[index + 1].top;
@@ -31,6 +31,10 @@ var indexList = function () {
31
31
  type: Boolean,
32
32
  value: true,
33
33
  },
34
+ stickyPush: {
35
+ type: Boolean,
36
+ value: true,
37
+ },
34
38
  sidebarFontSize: {
35
39
  type: String,
36
40
  },
@@ -248,11 +252,8 @@ var indexList = function () {
248
252
  return;
249
253
  }
250
254
  // lowestActiveIndex 已改为在 setRect 后由 computeLowestActiveIndex() 几何计算,此处不再根据滚动推断
251
- var _g = this.data, sticky = _g.sticky, stickyOffsetTop = _g.stickyOffsetTop, zIndex = _g.zIndex, highlightColor = _g.highlightColor;
255
+ var _g = this.data, sticky = _g.sticky, stickyOffsetTop = _g.stickyOffsetTop, zIndex = _g.zIndex, highlightColor = _g.highlightColor, stickyPush = _g.stickyPush;
252
256
  var activeData = hasIndex ? controlActiveIndexData : scrollChildrenGetIndexData;
253
- if (activeData === undefined) {
254
- return;
255
- }
256
257
  var activeIndex = this.children.findIndex(function (item) { return item.data.index === activeData; });
257
258
  var preActiveData = (_c = (_b = this.children[activeIndex - 1]) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.index;
258
259
  this.setDiffData({
@@ -274,7 +275,7 @@ var indexList = function () {
274
275
  if (itemData === activeData) {
275
276
  var wrapperStyle = '';
276
277
  var anchorStyle = "\n color: ".concat(highlightColor, ";\n ");
277
- if (isActiveAnchorSticky_1) {
278
+ if (isActiveAnchorSticky_1 || !stickyPush) {
278
279
  wrapperStyle = "\n height: ".concat(children[index].height, "px;\n ");
279
280
  anchorStyle = "\n position: fixed;\n top: ".concat(stickyOffsetTop, "px;\n z-index: ").concat(zIndex, ";\n color: ").concat(highlightColor, ";\n ");
280
281
  }
@@ -286,9 +287,9 @@ var indexList = function () {
286
287
  wrapperStyle: wrapperStyle,
287
288
  },
288
289
  });
289
- // 滚动模式时 上一个tab 要有种慢慢被滚动切换的效果
290
+ // 滚动模式时,上一个 tab 默认会有被逐步上推切换的过渡效果
290
291
  }
291
- else if (preActiveData === itemData && !hasIndex) {
292
+ else if (stickyPush && preActiveData === itemData && !hasIndex) {
292
293
  var currentAnchor = children[index];
293
294
  var currentOffsetTop = currentAnchor.top;
294
295
  var targetOffsetTop = index === children.length - 1 ? _this.top : children[index + 1].top;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.12.1-beta-7",
3
+ "version": "2.13.0",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",