@arco-design/mobile-react 2.28.1 → 2.29.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.d.ts +7 -1
  5. package/cjs/_helpers/hooks.js +9 -5
  6. package/cjs/form/form-item.js +109 -108
  7. package/cjs/grid/style/css/index.css +4 -0
  8. package/cjs/grid/style/index.less +6 -0
  9. package/cjs/index.d.ts +1 -0
  10. package/cjs/index.js +5 -1
  11. package/cjs/nav-bar/index.d.ts +3 -3
  12. package/cjs/picker-view/components/picker-cell.js +20 -6
  13. package/cjs/skeleton/demo/style/css/mobile.css +7 -0
  14. package/cjs/skeleton/demo/style/mobile.less +13 -0
  15. package/cjs/skeleton/elements.d.ts +7 -0
  16. package/cjs/skeleton/elements.js +302 -0
  17. package/cjs/skeleton/index.d.ts +18 -0
  18. package/cjs/skeleton/index.js +100 -0
  19. package/cjs/skeleton/skeleton-context.d.ts +3 -0
  20. package/cjs/skeleton/skeleton-context.js +15 -0
  21. package/cjs/skeleton/style/css/index.css +180 -0
  22. package/cjs/skeleton/style/css/index.d.ts +3 -0
  23. package/cjs/skeleton/style/css/index.js +7 -0
  24. package/cjs/skeleton/style/index.d.ts +3 -0
  25. package/cjs/skeleton/style/index.js +7 -0
  26. package/cjs/skeleton/style/index.less +147 -0
  27. package/cjs/skeleton/type.d.ts +104 -0
  28. package/cjs/skeleton/type.js +3 -0
  29. package/cjs/style.d.ts +1 -0
  30. package/cjs/style.js +2 -0
  31. package/cjs/tabs/index.js +8 -2
  32. package/dist/index.js +532 -147
  33. package/dist/index.min.js +5 -5
  34. package/dist/style.css +123 -0
  35. package/dist/style.min.css +1 -1
  36. package/esm/_helpers/hooks.d.ts +7 -1
  37. package/esm/_helpers/hooks.js +8 -2
  38. package/esm/form/form-item.js +109 -108
  39. package/esm/grid/style/css/index.css +4 -0
  40. package/esm/grid/style/index.less +6 -0
  41. package/esm/index.d.ts +1 -0
  42. package/esm/index.js +1 -0
  43. package/esm/nav-bar/index.d.ts +3 -3
  44. package/esm/picker-view/components/picker-cell.js +20 -6
  45. package/esm/skeleton/demo/style/css/mobile.css +7 -0
  46. package/esm/skeleton/demo/style/mobile.less +13 -0
  47. package/esm/skeleton/elements.d.ts +7 -0
  48. package/esm/skeleton/elements.js +281 -0
  49. package/esm/skeleton/index.d.ts +18 -0
  50. package/esm/skeleton/index.js +82 -0
  51. package/esm/skeleton/skeleton-context.d.ts +3 -0
  52. package/esm/skeleton/skeleton-context.js +5 -0
  53. package/esm/skeleton/style/css/index.css +180 -0
  54. package/esm/skeleton/style/css/index.d.ts +3 -0
  55. package/esm/skeleton/style/css/index.js +3 -0
  56. package/esm/skeleton/style/index.d.ts +3 -0
  57. package/esm/skeleton/style/index.js +3 -0
  58. package/esm/skeleton/style/index.less +147 -0
  59. package/esm/skeleton/type.d.ts +104 -0
  60. package/esm/skeleton/type.js +1 -0
  61. package/esm/style.d.ts +1 -0
  62. package/esm/style.js +1 -0
  63. package/esm/tabs/index.js +9 -3
  64. package/package.json +3 -3
  65. package/tokens/app/arcodesign/default/css-variables.less +16 -0
  66. package/tokens/app/arcodesign/default/index.d.ts +16 -0
  67. package/tokens/app/arcodesign/default/index.js +17 -1
  68. package/tokens/app/arcodesign/default/index.json +190 -0
  69. package/tokens/app/arcodesign/default/index.less +16 -0
  70. package/umd/_helpers/hooks.d.ts +7 -1
  71. package/umd/_helpers/hooks.js +9 -5
  72. package/umd/form/form-item.js +109 -108
  73. package/umd/grid/style/css/index.css +4 -0
  74. package/umd/grid/style/index.less +6 -0
  75. package/umd/index.d.ts +1 -0
  76. package/umd/index.js +7 -5
  77. package/umd/nav-bar/index.d.ts +3 -3
  78. package/umd/picker-view/components/picker-cell.js +20 -6
  79. package/umd/skeleton/demo/style/css/mobile.css +7 -0
  80. package/umd/skeleton/demo/style/mobile.less +13 -0
  81. package/umd/skeleton/elements.d.ts +7 -0
  82. package/umd/skeleton/elements.js +306 -0
  83. package/umd/skeleton/index.d.ts +18 -0
  84. package/umd/skeleton/index.js +104 -0
  85. package/umd/skeleton/skeleton-context.d.ts +3 -0
  86. package/umd/skeleton/skeleton-context.js +28 -0
  87. package/umd/skeleton/style/css/index.css +180 -0
  88. package/umd/skeleton/style/css/index.d.ts +3 -0
  89. package/umd/skeleton/style/css/index.js +15 -0
  90. package/umd/skeleton/style/index.d.ts +3 -0
  91. package/umd/skeleton/style/index.js +15 -0
  92. package/umd/skeleton/style/index.less +147 -0
  93. package/umd/skeleton/type.d.ts +104 -0
  94. package/umd/skeleton/type.js +17 -0
  95. package/umd/style.d.ts +1 -0
  96. package/umd/style.js +4 -4
  97. package/umd/tabs/index.js +8 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,35 @@
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.29.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.2...@arco-design/mobile-react@2.29.0) (2023-08-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * compatibility between grid and image picker ([#151](https://github.com/arco-design/arco-design-mobile/issues/151)) ([28ae5b9](https://github.com/arco-design/arco-design-mobile/commit/28ae5b9a8eb6dd91422d50d3f2cfe8b0d7ccdfa4))
12
+
13
+
14
+ ### Features
15
+
16
+ * add new component `Skeleton` ([#136](https://github.com/arco-design/arco-design-mobile/issues/136)) ([49351f6](https://github.com/arco-design/arco-design-mobile/commit/49351f639b7a3272b55f189447d935946933ddd6))
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.28.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.1...@arco-design/mobile-react@2.28.2) (2023-08-07)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * `Form` bind this in form-item ([#148](https://github.com/arco-design/arco-design-mobile/issues/148)) ([5616d53](https://github.com/arco-design/arco-design-mobile/commit/5616d537b921b009df61addccf966c5e9363a0cb))
28
+ * `PickerView` flicker issue with picker off and on when momentum scrolling is not over ([#143](https://github.com/arco-design/arco-design-mobile/issues/143)) ([e91557f](https://github.com/arco-design/arco-design-mobile/commit/e91557fc1545dd6179329dc342de4967301a7d73))
29
+ * `Tabs` use boundingRect instead of offset when calc tabs wrap size ([#146](https://github.com/arco-design/arco-design-mobile/issues/146)) ([7ece3a9](https://github.com/arco-design/arco-design-mobile/commit/7ece3a9eb76abb010aa88678af47c15a0bd319dc))
30
+
31
+
32
+
33
+
34
+
6
35
  ## [2.28.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.0...@arco-design/mobile-react@2.28.1) (2023-08-02)
7
36
 
8
37
 
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.28.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.28.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.28.2/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.28.2/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.28.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.28.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.28.2/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.28.2/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -13,6 +13,12 @@ export declare function useListenResize(resizeHandler: () => void, deps?: any[],
13
13
  * @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
14
14
  * @param initialState 初始状态
15
15
  * @param initialState {en} Initial State
16
+ * @example
17
+ * ```
18
+ * import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
19
+ *
20
+ * const [scrollValue, setScrollValue] = useMountedState(value);
21
+ * ```
16
22
  */
17
23
  export declare function useMountedState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>];
18
24
  export declare function useSameRefState<T>(initialValue: T): [T, React.MutableRefObject<T>, (data: T) => void];
@@ -37,7 +43,7 @@ export declare function useAddListener(dom: HTMLDivElement | null, event: string
37
43
  capture: boolean;
38
44
  }): void;
39
45
  export declare function usePreventBodyScroll(visible: boolean, preventBodyScroll: boolean, initialBodyOverflow?: string): void;
40
- export declare const useProgress: (mountedTransition: boolean, percentage: number, duration: number, mountedBezier: BezierType, step: number) => [number, boolean];
46
+ export declare function useProgress(mountedTransition: boolean, percentage: number, duration: number, mountedBezier: BezierType, step: number): [number, boolean];
41
47
  export declare function useSingleAndDoubleClick(onClick: (e: React.MouseEvent) => void, onDoubleClick: (e: React.MouseEvent) => void, delay?: number): (e: React.MouseEvent) => void;
42
48
  export declare function useGenSvgKey(userSetSvgKey: string): {
43
49
  svgKey: string;
@@ -9,7 +9,7 @@ exports.useListenResize = useListenResize;
9
9
  exports.useMountedState = useMountedState;
10
10
  exports.usePopupScroll = usePopupScroll;
11
11
  exports.usePreventBodyScroll = usePreventBodyScroll;
12
- exports.useProgress = void 0;
12
+ exports.useProgress = useProgress;
13
13
  exports.useRefMountedState = useRefMountedState;
14
14
  exports.useRefState = useRefState;
15
15
  exports.useSameRefState = useSameRefState;
@@ -59,6 +59,12 @@ function useListenResize(resizeHandler, deps, needListen) {
59
59
  * @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
60
60
  * @param initialState 初始状态
61
61
  * @param initialState {en} Initial State
62
+ * @example
63
+ * ```
64
+ * import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
65
+ *
66
+ * const [scrollValue, setScrollValue] = useMountedState(value);
67
+ * ```
62
68
  */
63
69
 
64
70
 
@@ -487,7 +493,7 @@ function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow) {
487
493
  }, [visible]);
488
494
  }
489
495
 
490
- var useProgress = function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
496
+ function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
491
497
  var _useState8 = (0, _react.useState)(0),
492
498
  currentPercentage = _useState8[0],
493
499
  setCurrentPercentage = _useState8[1];
@@ -521,9 +527,7 @@ var useProgress = function useProgress(mountedTransition, percentage, duration,
521
527
  percentage === 100 ? setCurrentPercentage(100) : setCurrentPercentage(count * step);
522
528
  }, [count, percentage, step]);
523
529
  return [currentPercentage, transitionControl];
524
- };
525
-
526
- exports.useProgress = useProgress;
530
+ }
527
531
 
528
532
  function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
529
533
  if (delay === void 0) {
@@ -42,15 +42,96 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
42
42
  _this._errors = [];
43
43
  _this._touched = false;
44
44
 
45
+ _this.onValueChange = function (preStore, curStore) {
46
+ _this._touched = true;
47
+ var shouldUpdate = _this.props.shouldUpdate;
48
+
49
+ if (typeof shouldUpdate === 'function') {
50
+ shouldUpdate({
51
+ preStore: preStore,
52
+ curStore: curStore
53
+ }) && _this.forceUpdate();
54
+ return;
55
+ }
56
+
57
+ _this.forceUpdate();
58
+ };
59
+
60
+ _this.getFieldError = function () {
61
+ return _this._errors;
62
+ };
63
+
64
+ _this.isFieldTouched = function () {
65
+ return _this._touched;
66
+ };
67
+
68
+ _this.validateField = function () {
69
+ var validateMessages = _this.context.validateMessages;
70
+ var getFieldValue = _this.context.form.getFieldValue;
71
+ var _this$props = _this.props,
72
+ field = _this$props.field,
73
+ rules = _this$props.rules,
74
+ onValidateStatusChange = _this$props.onValidateStatusChange;
75
+ var value = getFieldValue(field);
76
+
77
+ if (rules != null && rules.length && field) {
78
+ var _Validator;
79
+
80
+ var fieldDom = _this.props.getFormItemRef();
81
+
82
+ var fieldValidator = new _mobileUtils.Validator((_Validator = {}, _Validator[field] = rules, _Validator), {
83
+ validateMessages: validateMessages
84
+ });
85
+ return new Promise(function (resolve) {
86
+ var _fieldValidator$valid;
87
+
88
+ fieldValidator.validate((_fieldValidator$valid = {}, _fieldValidator$valid[field] = value, _fieldValidator$valid), function (errorsMap) {
89
+ var _getErrorAndWarnings = (0, _utils.getErrorAndWarnings)((errorsMap == null ? void 0 : errorsMap[field]) || []),
90
+ errors = _getErrorAndWarnings.errors,
91
+ warnings = _getErrorAndWarnings.warnings;
92
+
93
+ _this._errors = errors;
94
+ onValidateStatusChange({
95
+ errors: _this._errors,
96
+ warnings: warnings
97
+ });
98
+ return resolve({
99
+ errors: _this._errors,
100
+ warnings: warnings,
101
+ value: value,
102
+ field: field,
103
+ dom: fieldDom
104
+ });
105
+ });
106
+ });
107
+ }
108
+
109
+ return Promise.resolve({
110
+ errors: [],
111
+ warnings: [],
112
+ value: value,
113
+ field: field,
114
+ dom: null
115
+ });
116
+ };
117
+
118
+ _this.setFieldData = function (value) {
119
+ var field = _this.props.field;
120
+ var setFieldValue = _this.context.form.setFieldValue;
121
+ setFieldValue(field, value);
122
+
123
+ _this.validateField();
124
+ };
125
+
45
126
  _this.innerTriggerFunction = function (_, value) {
46
127
  var _children$props;
47
128
 
48
129
  _this.setFieldData(value);
49
130
 
50
- var _this$props = _this.props,
51
- children = _this$props.children,
52
- _this$props$trigger = _this$props.trigger,
53
- trigger = _this$props$trigger === void 0 ? 'onChange' : _this$props$trigger;
131
+ var _this$props2 = _this.props,
132
+ children = _this$props2.children,
133
+ _this$props2$trigger = _this$props2.trigger,
134
+ trigger = _this$props2$trigger === void 0 ? 'onChange' : _this$props2$trigger;
54
135
 
55
136
  if (trigger && (_children$props = children.props) != null && _children$props[trigger]) {
56
137
  var _children$props2;
@@ -68,10 +149,10 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
68
149
 
69
150
  _this.setFieldData(value);
70
151
 
71
- var _this$props2 = _this.props,
72
- children = _this$props2.children,
73
- _this$props2$trigger = _this$props2.trigger,
74
- trigger = _this$props2$trigger === void 0 ? 'onChange' : _this$props2$trigger;
152
+ var _this$props3 = _this.props,
153
+ children = _this$props3.children,
154
+ _this$props3$trigger = _this$props3.trigger,
155
+ trigger = _this$props3$trigger === void 0 ? 'onChange' : _this$props3$trigger;
75
156
 
76
157
  if (trigger && (_children$props3 = children.props) != null && _children$props3[trigger]) {
77
158
  var _children$props4;
@@ -84,6 +165,24 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
84
165
  }
85
166
  };
86
167
 
168
+ _this.innerClearFunction = function () {
169
+ var _children$props5;
170
+
171
+ var children = _this.props.children;
172
+
173
+ _this.setFieldData('');
174
+
175
+ if ((_children$props5 = children.props) != null && _children$props5.onClear) {
176
+ var _children$props6;
177
+
178
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
179
+ args[_key3] = arguments[_key3];
180
+ }
181
+
182
+ (_children$props6 = children.props) == null ? void 0 : _children$props6.onClear.apply(_children$props6, args);
183
+ }
184
+ };
185
+
87
186
  _this.destroyField = function () {};
88
187
 
89
188
  if (props != null && props.initialValue && props.field) {
@@ -111,108 +210,10 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
111
210
  this.destroyField();
112
211
  };
113
212
 
114
- _proto.onValueChange = function onValueChange(preStore, curStore) {
115
- this._touched = true;
116
- var shouldUpdate = this.props.shouldUpdate;
117
-
118
- if (typeof shouldUpdate === 'function') {
119
- shouldUpdate({
120
- preStore: preStore,
121
- curStore: curStore
122
- }) && this.forceUpdate();
123
- return;
124
- }
125
-
126
- this.forceUpdate();
127
- };
128
-
129
- _proto.getFieldError = function getFieldError() {
130
- return this._errors;
131
- };
132
-
133
- _proto.isFieldTouched = function isFieldTouched() {
134
- return this._touched;
135
- };
136
-
137
- _proto.validateField = function validateField() {
138
- var _this2 = this;
139
-
140
- var validateMessages = this.context.validateMessages;
141
- var getFieldValue = this.context.form.getFieldValue;
142
- var _this$props3 = this.props,
143
- field = _this$props3.field,
144
- rules = _this$props3.rules,
145
- onValidateStatusChange = _this$props3.onValidateStatusChange;
146
- var value = getFieldValue(field);
147
-
148
- if (rules != null && rules.length && field) {
149
- var _Validator;
150
-
151
- var fieldDom = this.props.getFormItemRef();
152
- var fieldValidator = new _mobileUtils.Validator((_Validator = {}, _Validator[field] = rules, _Validator), {
153
- validateMessages: validateMessages
154
- });
155
- return new Promise(function (resolve) {
156
- var _fieldValidator$valid;
157
-
158
- fieldValidator.validate((_fieldValidator$valid = {}, _fieldValidator$valid[field] = value, _fieldValidator$valid), function (errorsMap) {
159
- var _getErrorAndWarnings = (0, _utils.getErrorAndWarnings)((errorsMap == null ? void 0 : errorsMap[field]) || []),
160
- errors = _getErrorAndWarnings.errors,
161
- warnings = _getErrorAndWarnings.warnings;
162
-
163
- _this2._errors = errors;
164
- onValidateStatusChange({
165
- errors: _this2._errors,
166
- warnings: warnings
167
- });
168
- return resolve({
169
- errors: _this2._errors,
170
- warnings: warnings,
171
- value: value,
172
- field: field,
173
- dom: fieldDom
174
- });
175
- });
176
- });
177
- }
178
-
179
- return Promise.resolve({
180
- errors: [],
181
- warnings: [],
182
- value: value,
183
- field: field,
184
- dom: null
185
- });
186
- };
187
-
188
- _proto.setFieldData = function setFieldData(value) {
189
- var field = this.props.field;
190
- var setFieldValue = this.context.form.setFieldValue;
191
- setFieldValue(field, value);
192
- this.validateField();
193
- };
194
-
195
- _proto.innerClearFunction = function innerClearFunction() {
196
- var _children$props5;
197
-
198
- var children = this.props.children;
199
- this.setFieldData('');
200
-
201
- if ((_children$props5 = children.props) != null && _children$props5.onClear) {
202
- var _children$props6;
203
-
204
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
205
- args[_key3] = arguments[_key3];
206
- }
207
-
208
- (_children$props6 = children.props) == null ? void 0 : _children$props6.onClear.apply(_children$props6, args);
209
- }
210
- };
211
-
212
213
  _proto.renderChildren = function renderChildren() {
213
214
  var _props,
214
215
  _children$type,
215
- _this3 = this;
216
+ _this2 = this;
216
217
 
217
218
  var _this$props4 = this.props,
218
219
  children = _this$props4.children,
@@ -287,7 +288,7 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
287
288
  props.error = this._errors;
288
289
 
289
290
  props[trigger] = function (newValue) {
290
- _this3.setFieldData(newValue);
291
+ _this2.setFieldData(newValue);
291
292
 
292
293
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
293
294
  args[_key4 - 1] = arguments[_key4];
@@ -113,3 +113,7 @@
113
113
  display: none;
114
114
  /* Chrome Safari */
115
115
  }
116
+ .arco-grid .arco-image-picker {
117
+ width: 100%;
118
+ /* 兼容grid和image-picker组合使用 */
119
+ }
@@ -101,3 +101,9 @@
101
101
  .@{prefix}-grid.sliding::-webkit-scrollbar {
102
102
  display: none; /* Chrome Safari */
103
103
  }
104
+
105
+ .@{prefix}-grid {
106
+ .@{prefix}-image-picker {
107
+ width: 100%; /* 兼容grid和image-picker组合使用 */
108
+ }
109
+ }
package/cjs/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export { default as PullRefresh } from './pull-refresh';
43
43
  export { default as Radio } from './radio';
44
44
  export { default as Rate } from './rate';
45
45
  export { default as SearchBar } from './search-bar';
46
+ export { default as Skeleton } from './skeleton';
46
47
  export { default as ShowMonitor } from './show-monitor';
47
48
  export { default as Slider } from './slider';
48
49
  export { default as Stepper } from './stepper';
package/cjs/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
5
  exports.__esModule = true;
6
- exports.Transition = exports.Toast = exports.Textarea = exports.Tag = exports.Tabs = exports.TabBar = exports.Switch = exports.SwipeLoad = exports.SwipeAction = exports.Sticky = exports.Steps = exports.Stepper = exports.Slider = exports.ShowMonitor = exports.SearchBar = exports.Rate = exports.Radio = exports.PullRefresh = exports.Progress = exports.Portal = exports.PopupSwiper = exports.Popup = exports.Popover = exports.PickerView = exports.Picker = exports.Pagination = exports.Notify = exports.NoticeBar = exports.NavBar = exports.Masking = exports.Loading = exports.LoadMore = exports.Keyboard = exports.Input = exports.IndexBar = exports.ImagePreview = exports.ImagePicker = exports.Image = exports.Grid = exports.Form = exports.Ellipsis = exports.DropdownMenu = exports.Dropdown = exports.Divider = exports.Dialog = exports.DatePicker = exports.CountDown = exports.ContextProvider = exports.Collapse = exports.CircleProgress = exports.Checkbox = exports.Cell = exports.Carousel = exports.Button = exports.Badge = exports.Avatar = exports.ActionSheet = void 0;
6
+ exports.Transition = exports.Toast = exports.Textarea = exports.Tag = exports.Tabs = exports.TabBar = exports.Switch = exports.SwipeLoad = exports.SwipeAction = exports.Sticky = exports.Steps = exports.Stepper = exports.Slider = exports.Skeleton = exports.ShowMonitor = exports.SearchBar = exports.Rate = exports.Radio = exports.PullRefresh = exports.Progress = exports.Portal = exports.PopupSwiper = exports.Popup = exports.Popover = exports.PickerView = exports.Picker = exports.Pagination = exports.Notify = exports.NoticeBar = exports.NavBar = exports.Masking = exports.Loading = exports.LoadMore = exports.Keyboard = exports.Input = exports.IndexBar = exports.ImagePreview = exports.ImagePicker = exports.Image = exports.Grid = exports.Form = exports.Ellipsis = exports.DropdownMenu = exports.Dropdown = exports.Divider = exports.Dialog = exports.DatePicker = exports.CountDown = exports.ContextProvider = exports.Collapse = exports.CircleProgress = exports.Checkbox = exports.Cell = exports.Carousel = exports.Button = exports.Badge = exports.Avatar = exports.ActionSheet = void 0;
7
7
 
8
8
  var _tabs = _interopRequireDefault(require("./tabs"));
9
9
 
@@ -185,6 +185,10 @@ var _searchBar = _interopRequireDefault(require("./search-bar"));
185
185
 
186
186
  exports.SearchBar = _searchBar.default;
187
187
 
188
+ var _skeleton = _interopRequireDefault(require("./skeleton"));
189
+
190
+ exports.Skeleton = _skeleton.default;
191
+
188
192
  var _showMonitor = _interopRequireDefault(require("./show-monitor"));
189
193
 
190
194
  exports.ShowMonitor = _showMonitor.default;
@@ -32,13 +32,13 @@ export interface NavBarProps {
32
32
  */
33
33
  rightContent?: React.ReactNode;
34
34
  /**
35
- * 自定义样式,背景和文字颜色可在此定义
35
+ * 自定义样式,最外层元素的背景文字颜色可在此定义
36
36
  * @en Custom stylesheet, background and text colors can be defined here
37
37
  */
38
38
  style?: React.CSSProperties;
39
39
  /**
40
- * 自定义类名
41
- * @en Custom classname
40
+ * 内层自定义类名
41
+ * @en Inner custom classname
42
42
  */
43
43
  className?: string;
44
44
  /**
@@ -68,6 +68,7 @@ var PickerCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
68
  var rowCount = Math.max(rows % 2 === 0 ? rows + 1 : rows, 3);
69
69
  var isTouchMoveRef = (0, _react.useRef)(false);
70
70
  var isTouchStopped = (0, _react.useRef)(false);
71
+ var unmountCallbackRef = (0, _react.useRef)();
71
72
  var timeRef = (0, _react.useRef)(null);
72
73
  var colStyle = (0, _react.useMemo)(function () {
73
74
  return (0, _helpers.getStyleWithVendor)((0, _extends2.default)({
@@ -109,20 +110,24 @@ var PickerCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
109
110
  }
110
111
 
111
112
  setTransitionDuration(transDuration ? transDuration + "ms" : '');
112
- setTransformY(transY); // 处理连续滑动的情况:
113
- // @en handle the case of continuous sliding:
114
- // 如果上一次callback还未执行,先cancel掉上一次回调,只执行最近的一次回调
115
- // @en If the last callback has not been executed, cancel the last callback first, and only execute the latest callback
113
+ setTransformY(transY); // 处理连续滑动的情况:如果上一次callback还未执行,先cancel掉上一次回调
114
+ // @en handle the case of continuous sliding: If the last callback has not been executed, cancel the last callback first
116
115
 
117
116
  if (latestCallbackTimer.current) {
118
117
  clearTimeout(latestCallbackTimer.current);
119
118
  }
120
119
 
121
- latestCallbackTimer.current = window.setTimeout(function () {
120
+ var setNormalStatus = function setNormalStatus() {
121
+ // 如果timer顺利执行,则在unmount时不再重复执行
122
+ // @en If the timer is successfully executed, it will not be repeated when unmounting
123
+ unmountCallbackRef.current = undefined;
122
124
  movingStatusRef.current = 'normal';
123
125
  setTransitionDuration('');
124
126
  callback();
125
- }, transDuration);
127
+ };
128
+
129
+ unmountCallbackRef.current = setNormalStatus;
130
+ latestCallbackTimer.current = window.setTimeout(setNormalStatus, transDuration);
126
131
  }
127
132
 
128
133
  function _scrollToIndex(itemIndex, transDuration, callback) {
@@ -320,6 +325,15 @@ var PickerCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
320
325
  _scrollToIndexWithChange(itemIndex, 200);
321
326
  }
322
327
 
328
+ (0, _react.useEffect)(function () {
329
+ return function () {
330
+ // 卸载组件时,如果timer中还有未执行的onchange操作,则立刻执行该操作并移除timer
331
+ // @en When unloading the component, if there is an unexecuted onchange operation in the timer, execute it immediately and remove the timer
332
+ var timerId = latestCallbackTimer.current;
333
+ unmountCallbackRef.current == null ? void 0 : unmountCallbackRef.current();
334
+ timerId && clearTimeout(timerId);
335
+ };
336
+ }, []);
323
337
  (0, _react.useEffect)(function () {
324
338
  if (wrapRef.current) {
325
339
  wrapRef.current.addEventListener('touchstart', _handleColumnTouchStart);
@@ -0,0 +1,7 @@
1
+ #demo-skeleton .arcodesign-mobile-demo-content .arco-cell-group {
2
+ margin-bottom: 0.32rem;
3
+ }
4
+ #demo-skeleton .arcodesign-mobile-demo-content .arco-cell {
5
+ margin-left: 0;
6
+ padding-right: 0;
7
+ }
@@ -0,0 +1,13 @@
1
+ @import '../../../../style/mixin.less';
2
+
3
+ #demo-skeleton {
4
+ .arcodesign-mobile-demo-content {
5
+ .arco-cell-group {
6
+ margin-bottom: 0.32rem;
7
+ }
8
+ .arco-cell {
9
+ margin-left: 0;
10
+ padding-right: 0;
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { SkeletonAvatarProps, SkeletonGridProps, SkeletonNodeProps, SkeletonParagraphProps, SkeletonRef, SkeletonTitleProps } from './type';
3
+ export declare const SkeletonNode: React.ForwardRefExoticComponent<SkeletonNodeProps & React.RefAttributes<SkeletonRef>>;
4
+ export declare const SkeletonTitle: React.ForwardRefExoticComponent<SkeletonTitleProps & React.RefAttributes<SkeletonRef>>;
5
+ export declare const SkeletonParagraph: React.ForwardRefExoticComponent<SkeletonParagraphProps & React.RefAttributes<SkeletonRef>>;
6
+ export declare const SkeletonAvatar: React.ForwardRefExoticComponent<SkeletonAvatarProps & React.RefAttributes<SkeletonRef>>;
7
+ export declare const SkeletonGrid: React.ForwardRefExoticComponent<SkeletonGridProps & React.RefAttributes<SkeletonRef>>;