@arco-design/mobile-react 2.30.5 → 2.30.7

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 CHANGED
@@ -3,6 +3,31 @@
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.30.7](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.30.6...@arco-design/mobile-react@2.30.7) (2023-12-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * `Ellipsis` html height calculation ([#218](https://github.com/arco-design/arco-design-mobile/issues/218)) ([6a73c43](https://github.com/arco-design/arco-design-mobile/commit/6a73c43c95d6bf6591c59fbbd67fa650a7059f91))
12
+ * style problem caused by the "tabIndex" attribute of lower versions of iOS ([#217](https://github.com/arco-design/arco-design-mobile/issues/217)) ([6a9406e](https://github.com/arco-design/arco-design-mobile/commit/6a9406ea0dfbdb50075a4c036757e6d7988c7d92))
13
+
14
+
15
+
16
+
17
+
18
+ ## [2.30.6](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.30.5...@arco-design/mobile-react@2.30.6) (2023-12-26)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * optimize `Ellipsis` height calculation ([#216](https://github.com/arco-design/arco-design-mobile/issues/216)) ([555723f](https://github.com/arco-design/arco-design-mobile/commit/555723f0091b6f0e28523a0aa37394bceacd6dc5))
24
+ * remove system default outline on iOS low-end machine of `Radio` & `Checkbox` ([#215](https://github.com/arco-design/arco-design-mobile/issues/215)) ([76dc29a](https://github.com/arco-design/arco-design-mobile/commit/76dc29ad26a1dcd37ab8935d8fbcebaa9ebe134f))
25
+ * resolve `DatePicker` rangeTs computed error ([#214](https://github.com/arco-design/arco-design-mobile/issues/214)) ([3dede0b](https://github.com/arco-design/arco-design-mobile/commit/3dede0bca7f0214d5e2b802038cafcc9390b2727))
26
+
27
+
28
+
29
+
30
+
6
31
  ## [2.30.5](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.30.4...@arco-design/mobile-react@2.30.5) (2023-12-19)
7
32
 
8
33
 
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.30.4/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.30.4/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.30.6/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.30.6/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.30.4/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.30.4/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.30.6/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.30.6/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -8,7 +8,7 @@ var _exportNames = {
8
8
  };
9
9
  exports.default = exports.YEAR = void 0;
10
10
 
11
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _extends4 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
12
 
13
13
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
14
14
 
@@ -100,10 +100,8 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
100
100
  });
101
101
 
102
102
  function _getColumns() {
103
- var dateObj = {};
104
- allTypes.forEach(function (type) {
105
- dateObj[type] = _getActualArray(type, currentDateObjRef.current);
106
- });
103
+ var dateObj = _getActualArray();
104
+
107
105
  var columns = keyOptions.map(function (opt) {
108
106
  return dateObj[opt];
109
107
  });
@@ -147,32 +145,51 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
147
145
  // @en Dynamically change the options of other columns based on the currently selected date
148
146
 
149
147
 
150
- function _getActualArray(type, nowDateObj) {
151
- var normalRange = _getNormalRange(type, nowDateObj);
152
-
153
- var range = [];
154
-
155
- switch (type) {
156
- case 'year':
157
- range = [minDateObjRef.current.year, maxDateObjRef.current.year];
158
- break;
159
-
160
- default:
161
- {
162
- var checkKeys = allTypes.slice(0, allTypes.indexOf(type));
163
- range = normalRange;
164
-
165
- if ((0, _helper.judgeObj)(nowDateObj, minDateObjRef.current, checkKeys)) {
166
- range[0] = minDateObjRef.current[type];
167
- }
148
+ function _getActualArray() {
149
+ var dateObj = {}; // 当前时间对象
150
+ // @en current Date object
168
151
 
169
- if ((0, _helper.judgeObj)(nowDateObj, maxDateObjRef.current, checkKeys)) {
170
- range[range.length - 1] = maxDateObjRef.current[type];
152
+ var currentDateObj = (0, _extends4.default)({}, currentDateObjRef.current);
153
+ allTypes.forEach(function (type) {
154
+ // 根据日期类型,计算出默认的日期范围
155
+ // @en According to the date type, calculate the default date range.
156
+ var normalRange = _getNormalRange(type, currentDateObj);
157
+
158
+ var range = [];
159
+
160
+ switch (type) {
161
+ case 'year':
162
+ // 默认使用minTs和maxTs年份区间
163
+ // @en Default use minTs and maxTs years.
164
+ range = [minDateObjRef.current.year, maxDateObjRef.current.year];
165
+ break;
166
+
167
+ default:
168
+ {
169
+ // 除了年份外,其他日期类型都需要判断上一级日期是否相同
170
+ // @en In addition to the year, other date types need to check if the upper-level date is the same.
171
+ var checkKeys = allTypes.slice(0, allTypes.indexOf(type));
172
+ range = normalRange;
173
+
174
+ if ((0, _helper.judgeObj)(currentDateObj, minDateObjRef.current, checkKeys)) {
175
+ var _extends2;
176
+
177
+ range[0] = minDateObjRef.current[type];
178
+ currentDateObj = (0, _extends4.default)({}, currentDateObj, (_extends2 = {}, _extends2[type] = Math.max(minDateObjRef.current[type], currentDateObj[type]), _extends2));
179
+ }
180
+
181
+ if ((0, _helper.judgeObj)(currentDateObj, maxDateObjRef.current, checkKeys)) {
182
+ var _extends3;
183
+
184
+ range[range.length - 1] = maxDateObjRef.current[type];
185
+ currentDateObj = (0, _extends4.default)({}, currentDateObj, (_extends3 = {}, _extends3[type] = Math.min(maxDateObjRef.current[type], currentDateObj[type]), _extends3));
186
+ }
171
187
  }
172
- }
173
- }
188
+ }
174
189
 
175
- return _convertRangeToArr(type, range);
190
+ dateObj[type] = _convertRangeToArr(type, range);
191
+ });
192
+ return dateObj;
176
193
  }
177
194
 
178
195
  function _convertRangeToArr(type, range) {
@@ -320,7 +337,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
320
337
  }, [visible]);
321
338
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
322
339
  var prefixCls = _ref.prefixCls;
323
- return /*#__PURE__*/_react.default.createElement(_picker.default, (0, _extends2.default)({}, otherProps, {
340
+ return /*#__PURE__*/_react.default.createElement(_picker.default, (0, _extends4.default)({}, otherProps, {
324
341
  ref: pickerRef,
325
342
  visible: visible,
326
343
  className: (0, _mobileUtils.cls)(className, prefixCls + "-date-picker"),
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import React from 'react';
2
2
  import { OptionsItem } from '../dropdown';
3
3
  import { CascadeOptions, ValueType } from './type';
4
4
  /**
@@ -11,11 +11,6 @@ export declare function isStringArray(options: string[] | OptionsItem[][] | Casc
11
11
  * @en Determine if it is a nested array
12
12
  * */
13
13
  export declare function isCascadeArray(options: string[] | OptionsItem[][] | CascadeOptions[]): options is CascadeOptions[];
14
- /**
15
- * 判断是否为string类型
16
- * @en Determine whether it is of type string
17
- */
18
- export declare function isString(icon: string | ReactNode): icon is string;
19
14
  /**
20
15
  * 格式化传入的数组
21
16
  * @en format the input array
@@ -6,7 +6,6 @@ exports.__esModule = true;
6
6
  exports.getFormattedOptions = void 0;
7
7
  exports.isCascadeArray = isCascadeArray;
8
8
  exports.isRefDom = exports.isClassNameDom = void 0;
9
- exports.isString = isString;
10
9
  exports.isStringArray = isStringArray;
11
10
 
12
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -29,15 +28,6 @@ function isStringArray(options) {
29
28
  function isCascadeArray(options) {
30
29
  return typeof options[0] === 'object' && !(0, _mobileUtils.isArray)(options[0]);
31
30
  }
32
- /**
33
- * 判断是否为string类型
34
- * @en Determine whether it is of type string
35
- */
36
-
37
-
38
- function isString(icon) {
39
- return typeof icon === 'string';
40
- }
41
31
  /**
42
32
  * 格式化传入的数组
43
33
  * @en format the input array
@@ -50,6 +50,13 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
50
50
  }
51
51
  }
52
52
 
53
+ function getActualHeight(container) {
54
+ var _container$getBoundin = container.getBoundingClientRect(),
55
+ height = _container$getBoundin.height;
56
+
57
+ return Math.round(height);
58
+ }
59
+
53
60
  function truncateText(container, textContainer, max) {
54
61
  var content = textContainer.textContent || '';
55
62
  var currentText = '';
@@ -65,11 +72,9 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
65
72
 
66
73
  var temp = content.slice(l, m);
67
74
  textContainer.innerText = currentText + temp;
75
+ var actualHeight = getActualHeight(container);
68
76
 
69
- var _container$getBoundin = container.getBoundingClientRect(),
70
- height = _container$getBoundin.height;
71
-
72
- if (height > max) {
77
+ if (actualHeight > max) {
73
78
  r = m;
74
79
  } else {
75
80
  currentText += temp;
@@ -100,11 +105,9 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
100
105
  var html = node.innerHTML; // clear content to determine whether the empty node can be placed.
101
106
 
102
107
  node.innerHTML = '';
108
+ var actualHeight = getActualHeight(container);
103
109
 
104
- var _container$getBoundin2 = container.getBoundingClientRect(),
105
- height = _container$getBoundin2.height;
106
-
107
- if (height > max) {
110
+ if (actualHeight > max) {
108
111
  // return after remove the node, if overflow with empty node.
109
112
  textContainer.removeChild(node);
110
113
  handleOnReflow(true, textContainer.innerHTML);
@@ -123,10 +126,9 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
123
126
  while (i < nodes.length) {
124
127
  textContainer.appendChild(nodes[i]);
125
128
 
126
- var _container$getBoundin3 = container.getBoundingClientRect(),
127
- _height = _container$getBoundin3.height;
129
+ var _actualHeight = getActualHeight(container);
128
130
 
129
- if (_height > max) {
131
+ if (_actualHeight > max) {
130
132
  if (nodes[i].childNodes && nodes[i].childNodes.length) {
131
133
  break;
132
134
  } else {
@@ -166,13 +168,10 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
166
168
  }
167
169
 
168
170
  textRef.current.classList.remove(prefixCls + "-js-content-text-pre");
169
-
170
- var _domRef$current$getBo = domRef.current.getBoundingClientRect(),
171
- height = _domRef$current$getBo.height;
172
-
171
+ var actualHeight = getActualHeight(domRef.current);
173
172
  var max = isNaN(Number(maxHeight)) ? lineHeightRef.current * maxLine : Number(maxHeight);
174
173
 
175
- if (height <= max) {
174
+ if (actualHeight <= max) {
176
175
  handleOnReflow(false, text);
177
176
  return;
178
177
  }
@@ -97,6 +97,11 @@ export interface ShowMonitorRef {
97
97
  * @en Ignore the state of the element before and after, manually check whether the element is in the viewport, trigger the onVisibleChange callback function
98
98
  */
99
99
  checkVisible: () => boolean;
100
+ /**
101
+ * 重置元素初始可见态为false,并重新对元素可见度发起检测,优先级低于disabled(通常用在对ShowMonitor内部元素变化时发起的重新监听)
102
+ * @en Reset the initial visible state of the element to false, and re-detect the visibility of the element, the priority is lower than 'disabled'(Usually used to re-listen when elements inside ShowMonitor change)
103
+ */
104
+ flushVisibleStatus: () => void;
100
105
  }
101
106
  /**
102
107
  * 通过滚动事件监测 children 是否进入视口或离开视口。
@@ -202,6 +202,7 @@ var ShowMonitor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
202
202
 
203
203
 
204
204
  curVisible !== preVisible && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
205
+ component.isVisible = curVisible;
205
206
  var key = wrapperKey.current;
206
207
  /**
207
208
  * 监听一次后加入 pendingList 队列,随后被 listeners 过滤掉
package/dist/index.js CHANGED
@@ -13446,10 +13446,8 @@
13446
13446
  });
13447
13447
 
13448
13448
  function _getColumns() {
13449
- var dateObj = {};
13450
- allTypes.forEach(function (type) {
13451
- dateObj[type] = _getActualArray(type, currentDateObjRef.current);
13452
- });
13449
+ var dateObj = _getActualArray();
13450
+
13453
13451
  var columns = keyOptions.map(function (opt) {
13454
13452
  return dateObj[opt];
13455
13453
  });
@@ -13492,32 +13490,50 @@
13492
13490
  // @en Dynamically change the options of other columns based on the currently selected date
13493
13491
 
13494
13492
 
13495
- function _getActualArray(type, nowDateObj) {
13496
- var normalRange = _getNormalRange(type, nowDateObj);
13493
+ function _getActualArray() {
13494
+ var dateObj = {}; // 当前时间对象
13495
+ // @en current Date object
13497
13496
 
13498
- var range = [];
13497
+ var currentDateObj = __assign$2({}, currentDateObjRef.current);
13499
13498
 
13500
- switch (type) {
13501
- case 'year':
13502
- range = [minDateObjRef.current.year, maxDateObjRef.current.year];
13503
- break;
13499
+ allTypes.forEach(function (type) {
13500
+ var _a, _b; // 根据日期类型,计算出默认的日期范围
13501
+ // @en According to the date type, calculate the default date range.
13504
13502
 
13505
- default:
13506
- {
13507
- var checkKeys = allTypes.slice(0, allTypes.indexOf(type));
13508
- range = normalRange;
13509
13503
 
13510
- if (judgeObj(nowDateObj, minDateObjRef.current, checkKeys)) {
13511
- range[0] = minDateObjRef.current[type];
13512
- }
13504
+ var normalRange = _getNormalRange(type, currentDateObj);
13513
13505
 
13514
- if (judgeObj(nowDateObj, maxDateObjRef.current, checkKeys)) {
13515
- range[range.length - 1] = maxDateObjRef.current[type];
13506
+ var range = [];
13507
+
13508
+ switch (type) {
13509
+ case 'year':
13510
+ // 默认使用minTs和maxTs年份区间
13511
+ // @en Default use minTs and maxTs years.
13512
+ range = [minDateObjRef.current.year, maxDateObjRef.current.year];
13513
+ break;
13514
+
13515
+ default:
13516
+ {
13517
+ // 除了年份外,其他日期类型都需要判断上一级日期是否相同
13518
+ // @en In addition to the year, other date types need to check if the upper-level date is the same.
13519
+ var checkKeys = allTypes.slice(0, allTypes.indexOf(type));
13520
+ range = normalRange;
13521
+
13522
+ if (judgeObj(currentDateObj, minDateObjRef.current, checkKeys)) {
13523
+ range[0] = minDateObjRef.current[type];
13524
+ currentDateObj = __assign$2(__assign$2({}, currentDateObj), (_a = {}, _a[type] = Math.max(minDateObjRef.current[type], currentDateObj[type]), _a));
13525
+ }
13526
+
13527
+ if (judgeObj(currentDateObj, maxDateObjRef.current, checkKeys)) {
13528
+ range[range.length - 1] = maxDateObjRef.current[type];
13529
+ currentDateObj = __assign$2(__assign$2({}, currentDateObj), (_b = {}, _b[type] = Math.min(maxDateObjRef.current[type], currentDateObj[type]), _b));
13530
+ }
13516
13531
  }
13517
- }
13518
- }
13532
+ }
13519
13533
 
13520
- return _convertRangeToArr(type, range);
13534
+ dateObj[type] = _convertRangeToArr(type, range);
13535
+ });
13536
+ return dateObj;
13521
13537
  }
13522
13538
 
13523
13539
  function _convertRangeToArr(type, range) {
@@ -15739,6 +15755,11 @@
15739
15755
  }
15740
15756
  }
15741
15757
 
15758
+ function getActualHeight(container) {
15759
+ var height = container.getBoundingClientRect().height;
15760
+ return Math.round(height);
15761
+ }
15762
+
15742
15763
  function truncateText(container, textContainer, max) {
15743
15764
  var content = textContainer.textContent || '';
15744
15765
  var currentText = '';
@@ -15754,9 +15775,9 @@
15754
15775
 
15755
15776
  var temp = content.slice(l, m);
15756
15777
  textContainer.innerText = currentText + temp;
15757
- var height = container.getBoundingClientRect().height;
15778
+ var actualHeight = getActualHeight(container);
15758
15779
 
15759
- if (height > max) {
15780
+ if (actualHeight > max) {
15760
15781
  r = m;
15761
15782
  } else {
15762
15783
  currentText += temp;
@@ -15787,9 +15808,9 @@
15787
15808
  var html = node.innerHTML; // clear content to determine whether the empty node can be placed.
15788
15809
 
15789
15810
  node.innerHTML = '';
15790
- var height = container.getBoundingClientRect().height;
15811
+ var actualHeight = getActualHeight(container);
15791
15812
 
15792
- if (height > max) {
15813
+ if (actualHeight > max) {
15793
15814
  // return after remove the node, if overflow with empty node.
15794
15815
  textContainer.removeChild(node);
15795
15816
  handleOnReflow(true, textContainer.innerHTML);
@@ -15807,9 +15828,9 @@
15807
15828
 
15808
15829
  while (i < nodes.length) {
15809
15830
  textContainer.appendChild(nodes[i]);
15810
- var height = container.getBoundingClientRect().height;
15831
+ var actualHeight = getActualHeight(container);
15811
15832
 
15812
- if (height > max) {
15833
+ if (actualHeight > max) {
15813
15834
  if (nodes[i].childNodes && nodes[i].childNodes.length) {
15814
15835
  break;
15815
15836
  } else {
@@ -15849,10 +15870,10 @@
15849
15870
  }
15850
15871
 
15851
15872
  textRef.current.classList.remove(prefixCls + "-js-content-text-pre");
15852
- var height = domRef.current.getBoundingClientRect().height;
15873
+ var actualHeight = getActualHeight(domRef.current);
15853
15874
  var max = isNaN(Number(maxHeight)) ? lineHeightRef.current * maxLine : Number(maxHeight);
15854
15875
 
15855
- if (height <= max) {
15876
+ if (actualHeight <= max) {
15856
15877
  handleOnReflow(false, text);
15857
15878
  return;
15858
15879
  }
@@ -18446,7 +18467,7 @@
18446
18467
  var index$g = componentWrapper(ImagePicker, 'ImagePicker');
18447
18468
 
18448
18469
  /*!
18449
- * @arco-design/transformable v1.0.1
18470
+ * @arco-design/transformable v1.0.2
18450
18471
  * (c) 2022 ludan.kibbon
18451
18472
  */
18452
18473
  function _defineProperty(obj, key, value) {
@@ -26767,6 +26788,7 @@
26767
26788
 
26768
26789
 
26769
26790
  curVisible !== preVisible && handleCheckChildrenExist() && onCompVisibleChange(curVisible, node);
26791
+ component.isVisible = curVisible;
26770
26792
  var key = wrapperKey.current;
26771
26793
  /**
26772
26794
  * 监听一次后加入 pendingList 队列,随后被 listeners 过滤掉