@arco-design/mobile-react 2.27.0 → 2.27.1
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/CHANGELOG.md +11 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/index-bar/index.js +7 -9
- package/dist/index.js +127 -709
- package/dist/index.min.js +5 -5
- package/esm/index-bar/index.js +1 -2
- package/package.json +3 -3
- package/umd/index-bar/index.js +10 -10
package/esm/index-bar/index.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
2
|
-
import { scrollWithAnimation } from '@arco-design/mobile-utils/utils';
|
1
|
+
import { cls, componentWrapper, scrollWithAnimation } from '@arco-design/mobile-utils';
|
3
2
|
import lodashThrottle from 'lodash.throttle';
|
4
3
|
import React, { useRef, forwardRef, useImperativeHandle, useMemo, useState, useEffect } from 'react';
|
5
4
|
import { ContextLayout } from '../context-provider';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arco-design/mobile-react",
|
3
|
-
"version": "2.27.
|
3
|
+
"version": "2.27.1",
|
4
4
|
"description": "",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "esm/index.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"author": "taoyiyue@bytedance.com",
|
16
16
|
"license": "ISC",
|
17
17
|
"dependencies": {
|
18
|
-
"@arco-design/mobile-utils": "2.15.
|
18
|
+
"@arco-design/mobile-utils": "2.15.1",
|
19
19
|
"@arco-design/transformable": "^1.0.0",
|
20
20
|
"lodash.throttle": "^4.1.1",
|
21
21
|
"resize-observer-polyfill": "^1.5.1"
|
@@ -35,5 +35,5 @@
|
|
35
35
|
"publishConfig": {
|
36
36
|
"access": "public"
|
37
37
|
},
|
38
|
-
"gitHead": "
|
38
|
+
"gitHead": "9c06acb2cc9341ee12843d1720e9b796cbbc2ac5"
|
39
39
|
}
|
package/umd/index-bar/index.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports", "@arco-design/mobile-utils", "
|
3
|
+
define(["exports", "@arco-design/mobile-utils", "lodash.throttle", "react", "../context-provider", "./context", "./group", "./side-bar", "./utils"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("@arco-design/mobile-utils"), require("
|
5
|
+
factory(exports, require("@arco-design/mobile-utils"), require("lodash.throttle"), require("react"), require("../context-provider"), require("./context"), require("./group"), require("./side-bar"), require("./utils"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports, global.mobileUtils, global.
|
10
|
+
factory(mod.exports, global.mobileUtils, global.lodash, global.react, global.contextProvider, global.context, global.group, global.sideBar, global.utils);
|
11
11
|
global.index = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _mobileUtils,
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _mobileUtils, _lodash, _react, _contextProvider, _context, _group, _sideBar, _utils) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
@@ -53,7 +53,7 @@
|
|
53
53
|
|
54
54
|
var containerRef = (0, _react.useRef)(null); // 过滤掉jsx写法中,奇怪的child
|
55
55
|
|
56
|
-
var formatChildren = (0,
|
56
|
+
var formatChildren = (0, _utils.filterValidIndexBarChild)(children); // 所有的索引内容,优先从props.groups中获取,再从formatChildren中获取
|
57
57
|
|
58
58
|
var indexes = (0, _react.useMemo)(function () {
|
59
59
|
if (groups.length) {
|
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
var handleChangeActiveIndex = function handleChangeActiveIndex(index, type) {
|
94
94
|
setActiveIndex(function (oldActiveIndex) {
|
95
|
-
var newActiveIndex = (0,
|
95
|
+
var newActiveIndex = (0, _utils.getFormatIndex)(index, oldActiveIndex); // 和上一次激活的acitveIndex不同,再触发onChange事件
|
96
96
|
|
97
97
|
if (newActiveIndex !== oldActiveIndex) {
|
98
98
|
onChange == null ? void 0 : onChange(newActiveIndex, type);
|
@@ -112,12 +112,12 @@
|
|
112
112
|
var formatIndex = index != null ? index : indexes == null ? void 0 : indexes[0];
|
113
113
|
var containerDom = containerRef.current;
|
114
114
|
|
115
|
-
if (!(0,
|
115
|
+
if (!(0, _utils.isValidIndex)(index) || !containerDom) {
|
116
116
|
return;
|
117
117
|
} // 寻找Index对应的groupDom
|
118
118
|
|
119
119
|
|
120
|
-
var groupDom = (0,
|
120
|
+
var groupDom = (0, _utils.getGroupDomFromIndex)(containerDom, formatIndex);
|
121
121
|
|
122
122
|
if (groupDom) {
|
123
123
|
handleChangeActiveIndex(formatIndex, type);
|
@@ -133,7 +133,7 @@
|
|
133
133
|
}
|
134
134
|
|
135
135
|
if (duration > 0) {
|
136
|
-
(0,
|
136
|
+
(0, _mobileUtils.scrollWithAnimation)(containerDom.scrollTop, targetScrollTop, function (top) {
|
137
137
|
return containerDom.scrollTop = top;
|
138
138
|
}, duration, scrollBezier);
|
139
139
|
} else {
|
@@ -146,7 +146,7 @@
|
|
146
146
|
return {
|
147
147
|
dom: domRef.current,
|
148
148
|
scrollToIndex: function scrollToIndex(index, rightNow) {
|
149
|
-
if ((0,
|
149
|
+
if ((0, _utils.isValidIndex)(index)) {
|
150
150
|
handleScrollIntoIndex({
|
151
151
|
index: index,
|
152
152
|
rightNow: rightNow,
|