@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/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.27.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.27.0...@arco-design/mobile-react@2.27.1) (2023-04-26)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* `IndexBar` modify utils deps ([#115](https://github.com/arco-design/arco-design-mobile/issues/115)) ([b322d71](https://github.com/arco-design/arco-design-mobile/commit/b322d716e8dc6a107afb2a8b84edfcc0f5daddc2))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
6
17
|
# [2.27.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.26.0...@arco-design/mobile-react@2.27.0) (2023-04-25)
|
7
18
|
|
8
19
|
|
package/README.en-US.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.0/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.0/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## Full import
|
package/README.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.27.0/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.27.0/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
package/cjs/index-bar/index.js
CHANGED
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
7
7
|
|
8
8
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
9
9
|
|
10
|
-
var _utils = require("@arco-design/mobile-utils/utils");
|
11
|
-
|
12
10
|
var _lodash = _interopRequireDefault(require("lodash.throttle"));
|
13
11
|
|
14
12
|
var _react = _interopRequireWildcard(require("react"));
|
@@ -21,7 +19,7 @@ var _group = require("./group");
|
|
21
19
|
|
22
20
|
var _sideBar = require("./side-bar");
|
23
21
|
|
24
|
-
var
|
22
|
+
var _utils = require("./utils");
|
25
23
|
|
26
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
27
25
|
|
@@ -56,7 +54,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
56
54
|
|
57
55
|
var containerRef = (0, _react.useRef)(null); // 过滤掉jsx写法中,奇怪的child
|
58
56
|
|
59
|
-
var formatChildren = (0,
|
57
|
+
var formatChildren = (0, _utils.filterValidIndexBarChild)(children); // 所有的索引内容,优先从props.groups中获取,再从formatChildren中获取
|
60
58
|
|
61
59
|
var indexes = (0, _react.useMemo)(function () {
|
62
60
|
if (groups.length) {
|
@@ -95,7 +93,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
95
93
|
|
96
94
|
var handleChangeActiveIndex = function handleChangeActiveIndex(index, type) {
|
97
95
|
setActiveIndex(function (oldActiveIndex) {
|
98
|
-
var newActiveIndex = (0,
|
96
|
+
var newActiveIndex = (0, _utils.getFormatIndex)(index, oldActiveIndex); // 和上一次激活的acitveIndex不同,再触发onChange事件
|
99
97
|
|
100
98
|
if (newActiveIndex !== oldActiveIndex) {
|
101
99
|
onChange == null ? void 0 : onChange(newActiveIndex, type);
|
@@ -115,12 +113,12 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
115
113
|
var formatIndex = index != null ? index : indexes == null ? void 0 : indexes[0];
|
116
114
|
var containerDom = containerRef.current;
|
117
115
|
|
118
|
-
if (!(0,
|
116
|
+
if (!(0, _utils.isValidIndex)(index) || !containerDom) {
|
119
117
|
return;
|
120
118
|
} // 寻找Index对应的groupDom
|
121
119
|
|
122
120
|
|
123
|
-
var groupDom = (0,
|
121
|
+
var groupDom = (0, _utils.getGroupDomFromIndex)(containerDom, formatIndex);
|
124
122
|
|
125
123
|
if (groupDom) {
|
126
124
|
handleChangeActiveIndex(formatIndex, type);
|
@@ -136,7 +134,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
136
134
|
}
|
137
135
|
|
138
136
|
if (duration > 0) {
|
139
|
-
(0,
|
137
|
+
(0, _mobileUtils.scrollWithAnimation)(containerDom.scrollTop, targetScrollTop, function (top) {
|
140
138
|
return containerDom.scrollTop = top;
|
141
139
|
}, duration, scrollBezier);
|
142
140
|
} else {
|
@@ -149,7 +147,7 @@ var IndexBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
149
147
|
return {
|
150
148
|
dom: domRef.current,
|
151
149
|
scrollToIndex: function scrollToIndex(index, rightNow) {
|
152
|
-
if ((0,
|
150
|
+
if ((0, _utils.isValidIndex)(index)) {
|
153
151
|
handleScrollIntoIndex({
|
154
152
|
index: index,
|
155
153
|
rightNow: rightNow,
|