@arco-design/mobile-react 2.22.3 → 2.24.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 (236) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/render.d.ts +3 -1
  5. package/cjs/_helpers/render.js +10 -3
  6. package/cjs/action-sheet/index.d.ts +5 -5
  7. package/cjs/action-sheet/index.js +4 -3
  8. package/cjs/action-sheet/methods.d.ts +1 -1
  9. package/cjs/badge/style/css/index.css +1 -2
  10. package/cjs/checkbox/checkbox.js +4 -0
  11. package/cjs/circle-progress/index.js +4 -0
  12. package/cjs/context-provider/index.d.ts +4 -0
  13. package/cjs/context-provider/index.js +14 -2
  14. package/cjs/dialog/index.d.ts +8 -8
  15. package/cjs/dialog/index.js +3 -2
  16. package/cjs/dialog/methods.d.ts +3 -3
  17. package/cjs/dialog/style/css/index.css +1 -2
  18. package/cjs/image-picker/index.js +18 -12
  19. package/cjs/image-picker/type.d.ts +10 -0
  20. package/cjs/image-preview/index.d.ts +3 -3
  21. package/cjs/image-preview/index.js +3 -2
  22. package/cjs/image-preview/methods.d.ts +2 -1
  23. package/cjs/image-preview/methods.js +2 -2
  24. package/cjs/index.d.ts +1 -0
  25. package/cjs/index.js +5 -1
  26. package/cjs/input/hooks.js +1 -0
  27. package/cjs/input/index.d.ts +5 -0
  28. package/cjs/input/index.js +6 -2
  29. package/cjs/input/style/css/index.css +1 -0
  30. package/cjs/input/style/index.less +1 -0
  31. package/cjs/masking/index.d.ts +4 -14
  32. package/cjs/masking/index.js +3 -2
  33. package/cjs/masking/methods.d.ts +3 -2
  34. package/cjs/masking/methods.js +2 -2
  35. package/cjs/nav-bar/index.d.ts +12 -0
  36. package/cjs/nav-bar/index.js +8 -2
  37. package/cjs/notify/index.d.ts +12 -12
  38. package/cjs/notify/index.js +3 -2
  39. package/cjs/notify/methods.d.ts +2 -1
  40. package/cjs/notify/methods.js +2 -2
  41. package/cjs/picker-view/components/picker-cell.js +3 -1
  42. package/cjs/popup/index.d.ts +4 -4
  43. package/cjs/popup/index.js +3 -2
  44. package/cjs/popup/methods.d.ts +1 -1
  45. package/cjs/popup-swiper/index.d.ts +12 -6
  46. package/cjs/popup-swiper/index.js +3 -2
  47. package/cjs/popup-swiper/methods.d.ts +1 -1
  48. package/cjs/progress/index.js +4 -0
  49. package/cjs/rate/index.js +5 -0
  50. package/cjs/slider/index.js +6 -1
  51. package/cjs/stepper/demo/style/css/mobile.css +4 -0
  52. package/cjs/stepper/demo/style/mobile.less +10 -0
  53. package/cjs/stepper/hooks/useButtonClick.d.ts +11 -0
  54. package/cjs/stepper/hooks/useButtonClick.js +74 -0
  55. package/cjs/stepper/hooks/useInputEvent.d.ts +9 -0
  56. package/cjs/stepper/hooks/useInputEvent.js +59 -0
  57. package/cjs/stepper/hooks/useValue.d.ts +6 -0
  58. package/cjs/stepper/hooks/useValue.js +44 -0
  59. package/cjs/stepper/index.d.ts +13 -0
  60. package/cjs/stepper/index.js +190 -0
  61. package/cjs/stepper/style/css/index.css +76 -0
  62. package/cjs/stepper/style/css/index.d.ts +2 -0
  63. package/cjs/stepper/style/css/index.js +5 -0
  64. package/cjs/stepper/style/index.d.ts +2 -0
  65. package/cjs/stepper/style/index.js +5 -0
  66. package/cjs/stepper/style/index.less +80 -0
  67. package/cjs/stepper/type.d.ts +159 -0
  68. package/cjs/stepper/type.js +3 -0
  69. package/cjs/style.d.ts +1 -0
  70. package/cjs/style.js +2 -0
  71. package/cjs/swipe-action/index.d.ts +1 -0
  72. package/cjs/swipe-action/index.js +10 -0
  73. package/cjs/switch/index.js +4 -0
  74. package/cjs/toast/index.d.ts +18 -18
  75. package/cjs/toast/index.js +3 -2
  76. package/cjs/toast/methods.d.ts +2 -1
  77. package/cjs/toast/methods.js +2 -2
  78. package/dist/index.js +463 -52
  79. package/dist/index.min.js +3 -3
  80. package/dist/style.css +77 -113
  81. package/dist/style.min.css +1 -1
  82. package/esm/_helpers/render.d.ts +3 -1
  83. package/esm/_helpers/render.js +10 -3
  84. package/esm/action-sheet/index.d.ts +5 -5
  85. package/esm/action-sheet/index.js +4 -3
  86. package/esm/action-sheet/methods.d.ts +1 -1
  87. package/esm/badge/style/css/index.css +1 -2
  88. package/esm/checkbox/checkbox.js +4 -0
  89. package/esm/circle-progress/index.js +4 -0
  90. package/esm/context-provider/index.d.ts +4 -0
  91. package/esm/context-provider/index.js +13 -2
  92. package/esm/dialog/index.d.ts +8 -8
  93. package/esm/dialog/index.js +3 -2
  94. package/esm/dialog/methods.d.ts +3 -3
  95. package/esm/dialog/style/css/index.css +1 -2
  96. package/esm/image-picker/index.js +18 -12
  97. package/esm/image-picker/type.d.ts +10 -0
  98. package/esm/image-preview/index.d.ts +3 -3
  99. package/esm/image-preview/index.js +3 -2
  100. package/esm/image-preview/methods.d.ts +2 -1
  101. package/esm/image-preview/methods.js +2 -2
  102. package/esm/index.d.ts +1 -0
  103. package/esm/index.js +1 -0
  104. package/esm/input/hooks.js +1 -0
  105. package/esm/input/index.d.ts +5 -0
  106. package/esm/input/index.js +6 -2
  107. package/esm/input/style/css/index.css +1 -0
  108. package/esm/input/style/index.less +1 -0
  109. package/esm/masking/index.d.ts +4 -14
  110. package/esm/masking/index.js +3 -2
  111. package/esm/masking/methods.d.ts +3 -2
  112. package/esm/masking/methods.js +2 -2
  113. package/esm/nav-bar/index.d.ts +12 -0
  114. package/esm/nav-bar/index.js +8 -2
  115. package/esm/notify/index.d.ts +12 -12
  116. package/esm/notify/index.js +3 -2
  117. package/esm/notify/methods.d.ts +2 -1
  118. package/esm/notify/methods.js +2 -2
  119. package/esm/picker-view/components/picker-cell.js +3 -1
  120. package/esm/popup/index.d.ts +4 -4
  121. package/esm/popup/index.js +3 -2
  122. package/esm/popup/methods.d.ts +1 -1
  123. package/esm/popup-swiper/index.d.ts +12 -6
  124. package/esm/popup-swiper/index.js +3 -2
  125. package/esm/popup-swiper/methods.d.ts +1 -1
  126. package/esm/progress/index.js +4 -0
  127. package/esm/rate/index.js +5 -0
  128. package/esm/slider/index.js +6 -1
  129. package/esm/stepper/demo/style/css/mobile.css +4 -0
  130. package/esm/stepper/demo/style/mobile.less +10 -0
  131. package/esm/stepper/hooks/useButtonClick.d.ts +11 -0
  132. package/esm/stepper/hooks/useButtonClick.js +69 -0
  133. package/esm/stepper/hooks/useInputEvent.d.ts +9 -0
  134. package/esm/stepper/hooks/useInputEvent.js +53 -0
  135. package/esm/stepper/hooks/useValue.d.ts +6 -0
  136. package/esm/stepper/hooks/useValue.js +38 -0
  137. package/esm/stepper/index.d.ts +13 -0
  138. package/esm/stepper/index.js +163 -0
  139. package/esm/stepper/style/css/index.css +76 -0
  140. package/esm/stepper/style/css/index.d.ts +2 -0
  141. package/esm/stepper/style/css/index.js +2 -0
  142. package/esm/stepper/style/index.d.ts +2 -0
  143. package/esm/stepper/style/index.js +2 -0
  144. package/esm/stepper/style/index.less +80 -0
  145. package/esm/stepper/type.d.ts +159 -0
  146. package/esm/stepper/type.js +1 -0
  147. package/esm/style.d.ts +1 -0
  148. package/esm/style.js +1 -0
  149. package/esm/swipe-action/index.d.ts +1 -0
  150. package/esm/swipe-action/index.js +1 -0
  151. package/esm/switch/index.js +4 -0
  152. package/esm/toast/index.d.ts +18 -18
  153. package/esm/toast/index.js +3 -2
  154. package/esm/toast/methods.d.ts +2 -1
  155. package/esm/toast/methods.js +2 -2
  156. package/package.json +3 -3
  157. package/style/css/public.css +4 -4
  158. package/tokens/app/arcodesign/default/css-variables.less +15 -0
  159. package/tokens/app/arcodesign/default/index.d.ts +15 -0
  160. package/tokens/app/arcodesign/default/index.js +16 -1
  161. package/tokens/app/arcodesign/default/index.json +180 -0
  162. package/tokens/app/arcodesign/default/index.less +15 -0
  163. package/umd/_helpers/render.d.ts +3 -1
  164. package/umd/_helpers/render.js +13 -7
  165. package/umd/action-sheet/index.d.ts +5 -5
  166. package/umd/action-sheet/index.js +4 -3
  167. package/umd/action-sheet/methods.d.ts +1 -1
  168. package/umd/badge/style/css/index.css +1 -2
  169. package/umd/checkbox/checkbox.js +4 -0
  170. package/umd/circle-progress/index.js +4 -0
  171. package/umd/context-provider/index.d.ts +4 -0
  172. package/umd/context-provider/index.js +13 -1
  173. package/umd/dialog/index.d.ts +8 -8
  174. package/umd/dialog/index.js +3 -2
  175. package/umd/dialog/methods.d.ts +3 -3
  176. package/umd/dialog/style/css/index.css +1 -2
  177. package/umd/image-picker/index.js +18 -12
  178. package/umd/image-picker/type.d.ts +10 -0
  179. package/umd/image-preview/index.d.ts +3 -3
  180. package/umd/image-preview/index.js +3 -2
  181. package/umd/image-preview/methods.d.ts +2 -1
  182. package/umd/image-preview/methods.js +2 -2
  183. package/umd/index.d.ts +1 -0
  184. package/umd/index.js +7 -5
  185. package/umd/input/hooks.js +1 -0
  186. package/umd/input/index.d.ts +5 -0
  187. package/umd/input/index.js +6 -2
  188. package/umd/input/style/css/index.css +1 -0
  189. package/umd/input/style/index.less +1 -0
  190. package/umd/masking/index.d.ts +4 -14
  191. package/umd/masking/index.js +3 -2
  192. package/umd/masking/methods.d.ts +3 -2
  193. package/umd/masking/methods.js +2 -2
  194. package/umd/nav-bar/index.d.ts +12 -0
  195. package/umd/nav-bar/index.js +8 -2
  196. package/umd/notify/index.d.ts +12 -12
  197. package/umd/notify/index.js +3 -2
  198. package/umd/notify/methods.d.ts +2 -1
  199. package/umd/notify/methods.js +2 -2
  200. package/umd/picker-view/components/picker-cell.js +3 -1
  201. package/umd/popup/index.d.ts +4 -4
  202. package/umd/popup/index.js +3 -2
  203. package/umd/popup/methods.d.ts +1 -1
  204. package/umd/popup-swiper/index.d.ts +12 -6
  205. package/umd/popup-swiper/index.js +3 -2
  206. package/umd/popup-swiper/methods.d.ts +1 -1
  207. package/umd/progress/index.js +4 -0
  208. package/umd/rate/index.js +5 -0
  209. package/umd/slider/index.js +6 -1
  210. package/umd/stepper/demo/style/css/mobile.css +4 -0
  211. package/umd/stepper/demo/style/mobile.less +10 -0
  212. package/umd/stepper/hooks/useButtonClick.d.ts +11 -0
  213. package/umd/stepper/hooks/useButtonClick.js +86 -0
  214. package/umd/stepper/hooks/useInputEvent.d.ts +9 -0
  215. package/umd/stepper/hooks/useInputEvent.js +71 -0
  216. package/umd/stepper/hooks/useValue.d.ts +6 -0
  217. package/umd/stepper/hooks/useValue.js +56 -0
  218. package/umd/stepper/index.d.ts +13 -0
  219. package/umd/stepper/index.js +191 -0
  220. package/umd/stepper/style/css/index.css +76 -0
  221. package/umd/stepper/style/css/index.d.ts +2 -0
  222. package/umd/stepper/style/css/index.js +15 -0
  223. package/umd/stepper/style/index.d.ts +2 -0
  224. package/umd/stepper/style/index.js +15 -0
  225. package/umd/stepper/style/index.less +80 -0
  226. package/umd/stepper/type.d.ts +159 -0
  227. package/umd/stepper/type.js +17 -0
  228. package/umd/style.d.ts +1 -0
  229. package/umd/style.js +4 -4
  230. package/umd/swipe-action/index.d.ts +1 -0
  231. package/umd/swipe-action/index.js +11 -4
  232. package/umd/switch/index.js +4 -0
  233. package/umd/toast/index.d.ts +18 -18
  234. package/umd/toast/index.js +3 -2
  235. package/umd/toast/methods.d.ts +2 -1
  236. package/umd/toast/methods.js +2 -2
@@ -9,7 +9,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
9
9
  * @param {string | NotifyProps} config
10
10
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
11
11
  */
12
- info: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>) => {
12
+ info: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
13
13
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
14
14
  close: () => void;
15
15
  };
@@ -19,7 +19,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
19
19
  * @param {string | NotifyProps} config
20
20
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
21
21
  */
22
- success: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>) => {
22
+ success: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
23
23
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
24
24
  close: () => void;
25
25
  };
@@ -29,7 +29,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
29
29
  * @param {string | NotifyProps} config
30
30
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
31
31
  */
32
- error: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>) => {
32
+ error: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
33
33
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
34
34
  close: () => void;
35
35
  };
@@ -39,7 +39,7 @@ export declare function methodsGenerator<P extends NotifyBaseProps>(Comp: React.
39
39
  * @param {string | NotifyProps} config
40
40
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
41
41
  */
42
- warn: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>) => {
42
+ warn: (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: import("../context-provider").GlobalContextParams | undefined) => {
43
43
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
44
44
  close: () => void;
45
45
  };
@@ -51,8 +51,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
51
51
  * @param {string | NotifyProps} config
52
52
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
53
53
  */
54
- info: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => {
55
- update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
54
+ info: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
55
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
56
56
  close: () => void;
57
57
  };
58
58
  /**
@@ -61,8 +61,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
61
61
  * @param {string | NotifyProps} config
62
62
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
63
63
  */
64
- success: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => {
65
- update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
64
+ success: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
65
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
66
66
  close: () => void;
67
67
  };
68
68
  /**
@@ -71,8 +71,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
71
71
  * @param {string | NotifyProps} config
72
72
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
73
73
  */
74
- error: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => {
75
- update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
74
+ error: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
75
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
76
76
  close: () => void;
77
77
  };
78
78
  /**
@@ -81,8 +81,8 @@ declare const _default: React.ForwardRefExoticComponent<NotifyProps & React.RefA
81
81
  * @param {string | NotifyProps} config
82
82
  * @returns {{ update: (config: NotifyProps) => void; close: () => void }}
83
83
  */
84
- warn: (originConfig: string | Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => {
85
- update: (newConfig: Pick<NotifyProps & React.RefAttributes<NotifyRef>, "style" | "content" | "transitionDuration" | "ref" | "key" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
84
+ warn: (originConfig: string | Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">, context?: import("../context-provider").GlobalContextParams | undefined) => {
85
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<NotifyProps & React.RefAttributes<NotifyRef>>, "style" | "content" | "transitionDuration" | "ref" | "key" | "context" | "getContainer" | "type" | "className" | "duration" | "onClose">) => void;
86
86
  close: () => void;
87
87
  };
88
88
  };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useRef, forwardRef, useImperativeHandle, useEffect, useState } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
4
  import { componentWrapper, nextTick } from '@arco-design/mobile-utils';
5
- import { ContextLayout } from '../context-provider';
5
+ import { ContextLayout, CompWithGlobalContext } from '../context-provider';
6
6
  import { getStyleWithVendor, useUpdateEffect } from '../_helpers';
7
7
  import { notify } from './methods';
8
8
  export * from './type';
@@ -145,6 +145,7 @@ export function methodsGenerator(Comp) {
145
145
  warn: notify(Comp, 'warn')
146
146
  };
147
147
  }
148
+ var NotifyWithGlobalContext = CompWithGlobalContext(Notify);
148
149
  /**
149
150
  * 主动操作后显示的反馈信息横条,可采用方法调用或者组件调用的方式
150
151
  * @en The feedback information bar displayed after active operation can be called by method or by component.
@@ -154,4 +155,4 @@ export function methodsGenerator(Comp) {
154
155
  * @name_en Notify
155
156
  */
156
157
 
157
- export default componentWrapper(Notify, methodsGenerator(Notify));
158
+ export default componentWrapper(Notify, methodsGenerator(NotifyWithGlobalContext));
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { GlobalContextParams } from '../context-provider';
2
3
  export interface NotifyBaseProps {
3
4
  getContainer?: () => HTMLElement;
4
5
  onClose?: (scene?: string) => void;
@@ -7,7 +8,7 @@ export interface NotifyBaseProps {
7
8
  close?: (e: any) => void;
8
9
  type?: string;
9
10
  }
10
- export declare function notify<P extends NotifyBaseProps>(Component: React.FC<P>, type?: string): (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>) => {
11
+ export declare function notify<P extends NotifyBaseProps>(Component: React.FC<P>, type?: string): (originConfig: string | Pick<P, Exclude<keyof P, "visible" | "close">>, context?: GlobalContextParams | undefined) => {
11
12
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">>) => void;
12
13
  close: () => void;
13
14
  };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import { nextTick } from '@arco-design/mobile-utils';
3
3
  import { ReactDOMRender } from '../_helpers/render';
4
4
  export function notify(Component, type) {
5
- return function (originConfig) {
5
+ return function (originConfig, context) {
6
6
  var config = typeof originConfig === 'string' ? {
7
7
  content: originConfig,
8
8
  type: 'info'
@@ -21,7 +21,7 @@ export function notify(Component, type) {
21
21
  document.body.appendChild(div);
22
22
  }
23
23
 
24
- var _ReactDOMRender = new ReactDOMRender(Component, div),
24
+ var _ReactDOMRender = new ReactDOMRender(Component, div, context),
25
25
  render = _ReactDOMRender.render,
26
26
  unmount = _ReactDOMRender.unmount;
27
27
 
@@ -346,12 +346,14 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
346
346
  ref: wrapRef,
347
347
  onTouchStart: _handleItemTouchStart,
348
348
  onTouchEnd: _handleColumnTouchEnd,
349
- onTouchCancel: _handleColumnTouchEnd
349
+ onTouchCancel: _handleColumnTouchEnd,
350
+ "aria-disabled": disabled
350
351
  }, data.map(function (item, index) {
351
352
  var _cls;
352
353
 
353
354
  var dis = Math.abs(index - currentIndex);
354
355
  return /*#__PURE__*/React.createElement("div", {
356
+ "aria-label": index === currentIndex ? "" + item.value : '',
355
357
  key: index + "_" + item.value,
356
358
  className: cls(prefixCls + "-column-item", (_cls = {
357
359
  selected: index === currentIndex
@@ -52,7 +52,7 @@ export declare function methodsGenerator<P extends OpenBaseProps>(Comp: React.Fu
52
52
  */
53
53
  open: (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
54
54
  key?: string | undefined;
55
- }) => {
55
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
56
56
  close: () => void;
57
57
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
58
58
  key?: string | undefined;
@@ -66,11 +66,11 @@ declare const _default: React.ForwardRefExoticComponent<PopupProps & React.RefAt
66
66
  * @param {PopupProps} config Configuration
67
67
  * @returns {{ close: () => void; update: (newConfig: PopupProps) => void; }}
68
68
  */
69
- open: (config: Pick<PopupProps & React.RefAttributes<PopupRef>, "direction" | "ref" | "children" | "key" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
69
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
70
70
  key?: string | undefined;
71
- }) => {
71
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
72
72
  close: () => void;
73
- update: (newConfig: Pick<PopupProps & React.RefAttributes<PopupRef>, "direction" | "ref" | "children" | "key" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
73
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
74
74
  key?: string | undefined;
75
75
  }) => void;
76
76
  };
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
3
3
  var _excluded = ["children", "maskClass", "contentClass", "contentTransitionType", "className", "direction", "needBottomOffset", "translateZ", "maskTransitionTimeout", "contentTransitionTimeout"];
4
4
  import React, { useRef, forwardRef, useImperativeHandle } from 'react';
5
5
  import { cls, componentWrapper } from '@arco-design/mobile-utils';
6
- import { ContextLayout } from '../context-provider';
6
+ import { ContextLayout, CompWithGlobalContext } from '../context-provider';
7
7
  import Masking from '../masking';
8
8
  import { open } from './methods';
9
9
  export * from './methods';
@@ -69,6 +69,7 @@ export function methodsGenerator(Comp) {
69
69
  open: open(Comp)
70
70
  };
71
71
  }
72
+ var PopupWithGlobalContext = CompWithGlobalContext(Popup);
72
73
  /**
73
74
  * 基于模态弹窗的的全屏菜单,支持各个方向。默认做了防滚动穿透处理,如果弹层内容中需要滚动,则需将滚动容器传入`getScrollContainer`属性以在未滚动到顶部或底部时释放滚动。
74
75
  * @en A full-screen menu based on a modal popup, supporting all directions. By default, anti-scroll penetration processing is performed. If scrolling is required in the content of the popup layer, you need to pass the scroll container to the `getScrollContainer` property to release scrolling when it is not scrolled to the top or bottom.
@@ -78,4 +79,4 @@ export function methodsGenerator(Comp) {
78
79
  * @name_en Popup
79
80
  */
80
81
 
81
- export default componentWrapper(Popup, methodsGenerator(Popup));
82
+ export default componentWrapper(Popup, methodsGenerator(PopupWithGlobalContext));
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { OpenBaseProps } from '../masking/methods';
3
3
  export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>): (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
4
4
  key?: string | undefined;
5
- }) => {
5
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
6
6
  close: () => void;
7
7
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
8
8
  key?: string | undefined;
@@ -59,11 +59,14 @@ export declare function methodsGenerator<P extends OpenBaseProps>(Comp: React.Fu
59
59
  */
60
60
  open: (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
61
61
  key?: string | undefined;
62
- }) => {
62
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
63
63
  close: () => void;
64
64
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
65
65
  key?: string | undefined;
66
- }) => void;
66
+ }) => void; /**
67
+ * 内容面板 touchstart 事件,返回true时表示阻止本组件内部处理事件
68
+ * @en The touchstart callback of content panel. When it returns true, it means that the event is prevented from being processed inside the component
69
+ */
67
70
  };
68
71
  };
69
72
  declare const _default: React.ForwardRefExoticComponent<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>> & {
@@ -73,13 +76,16 @@ declare const _default: React.ForwardRefExoticComponent<PopupSwiperProps & React
73
76
  * @param {string | PopupSwiperProps} config Configuration
74
77
  * @returns {{ close: () => void; update: (newConfig: PopupSwiperProps) => void; }}
75
78
  */
76
- open: (config: Pick<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>, "direction" | "ref" | "children" | "key" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
79
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
77
80
  key?: string | undefined;
78
- }) => {
81
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
79
82
  close: () => void;
80
- update: (newConfig: Pick<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>, "direction" | "ref" | "children" | "key" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
83
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
81
84
  key?: string | undefined;
82
- }) => void;
85
+ }) => void; /**
86
+ * 内容面板 touchstart 事件,返回true时表示阻止本组件内部处理事件
87
+ * @en The touchstart callback of content panel. When it returns true, it means that the event is prevented from being processed inside the component
88
+ */
83
89
  };
84
90
  };
85
91
  /**
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
3
3
  var _excluded = ["className", "visible", "children", "maskStyle", "contentStyle", "direction", "percentToClose", "distanceToClose", "speedToClose", "allowSwipeDirections", "exitDirection", "onTouchMove", "onTouchStart", "onTouchEnd", "onOpen", "onClose", "close"];
4
4
  import React, { useRef, forwardRef, useImperativeHandle, useCallback, useState, useEffect, useMemo } from 'react';
5
5
  import { cls, componentWrapper, nextTick } from '@arco-design/mobile-utils';
6
- import { ContextLayout } from '../context-provider';
6
+ import { ContextLayout, CompWithGlobalContext } from '../context-provider';
7
7
  import Popup from '../popup';
8
8
  import { open } from './methods';
9
9
  import { getStyleWithVendor, useRefState } from '../_helpers';
@@ -258,6 +258,7 @@ export function methodsGenerator(Comp) {
258
258
  open: open(Comp)
259
259
  };
260
260
  }
261
+ var PopupSwiperWithGlobalContext = CompWithGlobalContext(PopupSwiper);
261
262
  /**
262
263
  * 基于弹出层(Popup)封装的具有手势关闭功能的弹出层组件,拥有 Popup 组件的其他能力。
263
264
  * @en The popup with gesture closing function based on the popup encapsulation, has other capabilities of the Popup component.
@@ -267,4 +268,4 @@ export function methodsGenerator(Comp) {
267
268
  * @name_en PopupSwiper
268
269
  */
269
270
 
270
- export default componentWrapper(PopupSwiper, methodsGenerator(PopupSwiper));
271
+ export default componentWrapper(PopupSwiper, methodsGenerator(PopupSwiperWithGlobalContext));
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { OpenBaseProps } from '../masking/methods';
3
3
  export declare function open<P extends OpenBaseProps>(Component: React.FunctionComponent<P>): (config: Pick<P, Exclude<keyof P, "visible" | "close">> & {
4
4
  key?: string | undefined;
5
- }) => {
5
+ }, context?: import("../context-provider").GlobalContextParams | undefined) => {
6
6
  close: () => void;
7
7
  update: (newConfig: Pick<P, Exclude<keyof P, "visible" | "close">> & {
8
8
  key?: string | undefined;
@@ -86,6 +86,10 @@ var Progress = /*#__PURE__*/forwardRef(function (props, ref) {
86
86
  function renderBarProgress(_ref) {
87
87
  var prefixCls = _ref.prefixCls;
88
88
  return /*#__PURE__*/React.createElement("div", {
89
+ role: "progressbar",
90
+ "aria-valuenow": percentage,
91
+ "aria-valuemax": 100,
92
+ "aria-valuemin": 0,
89
93
  className: cls(prefixCls + "-progress", {
90
94
  'progress-fixed': mode === 'nav'
91
95
  }, {
package/esm/rate/index.js CHANGED
@@ -144,6 +144,11 @@ var Rate = /*#__PURE__*/forwardRef(function (props, ref) {
144
144
  return /*#__PURE__*/React.createElement(ContextLayout, null, function (_ref2) {
145
145
  var prefixCls = _ref2.prefixCls;
146
146
  return /*#__PURE__*/React.createElement("div", {
147
+ role: "slider",
148
+ "aria-valuemin": 0,
149
+ "aria-valuemax": count,
150
+ "aria-valuenow": innerValue,
151
+ "aria-disabled": disabled,
147
152
  className: cls(prefixCls + "-rate", className, {
148
153
  disabled: disabled
149
154
  }),
@@ -126,7 +126,12 @@ var Slider = /*#__PURE__*/forwardRef(function (_, ref) {
126
126
  'show-marks': showMarks
127
127
  }),
128
128
  style: style,
129
- ref: domRef
129
+ ref: domRef,
130
+ role: "slider",
131
+ "aria-valuemin": min,
132
+ "aria-valuemax": max,
133
+ "aria-valuenow": Array.isArray(valueGroup) ? valueGroup[0] : valueGroup,
134
+ "aria-disabled": disabled
130
135
  }, isHorizontal ? renderPrefixLabel : renderSuffixLabel, /*#__PURE__*/React.createElement("div", {
131
136
  className: prefixCls + "-slider-wrapper"
132
137
  }, /*#__PURE__*/React.createElement(Marks, {
@@ -0,0 +1,4 @@
1
+ #demo-stepper .arcodesign-mobile-demo-content {
2
+ padding: 0;
3
+ background: transparent;
4
+ }
@@ -0,0 +1,10 @@
1
+ @import "../../../../style/mixin.less";
2
+
3
+ #demo-stepper {
4
+
5
+ .arcodesign-mobile-demo-content {
6
+ padding: 0;
7
+ background: transparent;
8
+ }
9
+
10
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { StepperProps } from '../type';
3
+ export default function useButtonClick(params: Required<Pick<StepperProps, 'min' | 'max' | 'step' | 'disabled' | 'digits' | 'digits' | 'equalLimitDisabled'>> & Pick<StepperProps, 'onAddButtonClick' | 'onMinusButtonClick'> & {
4
+ actualInputValue: number;
5
+ updateValue: (updater: number | ((oldValue: number) => number)) => void;
6
+ }): {
7
+ minusButtonDisable: boolean;
8
+ addButtonDisable: boolean;
9
+ handleMinusButtonClick: (e: React.MouseEvent) => void;
10
+ handleAddButtonClick: (e: React.MouseEvent) => void;
11
+ };
@@ -0,0 +1,69 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ function correctCalculation(leftNumber, rightNumber, operator) {
4
+ var magnification = 1e17;
5
+ var left = leftNumber * magnification;
6
+ var right = rightNumber * magnification;
7
+ return operator === '-' ? (left - right) / magnification : (left + right) / magnification;
8
+ }
9
+
10
+ export default function useButtonClick(params) {
11
+ var actualInputValue = params.actualInputValue,
12
+ min = params.min,
13
+ max = params.max,
14
+ step = params.step,
15
+ disabled = params.disabled,
16
+ equalLimitDisabled = params.equalLimitDisabled,
17
+ updateValue = params.updateValue,
18
+ onAddButtonClick = params.onAddButtonClick,
19
+ onMinusButtonClick = params.onMinusButtonClick;
20
+
21
+ var _useState = useState(function () {
22
+ return actualInputValue === min || disabled;
23
+ }),
24
+ minusButtonDisable = _useState[0],
25
+ setMinusButtonDisable = _useState[1];
26
+
27
+ var _useState2 = useState(function () {
28
+ return actualInputValue === max || disabled;
29
+ }),
30
+ addButtonDisable = _useState2[0],
31
+ setAddButtonDisable = _useState2[1];
32
+
33
+ var handleMinusButtonClick = function handleMinusButtonClick(e) {
34
+ if (minusButtonDisable) {
35
+ return;
36
+ }
37
+
38
+ updateValue(function (oldValue) {
39
+ var result = correctCalculation(oldValue, step, '-');
40
+ return result < min ? equalLimitDisabled ? oldValue : min : result;
41
+ });
42
+ onMinusButtonClick && onMinusButtonClick(e);
43
+ };
44
+
45
+ var handleAddButtonClick = function handleAddButtonClick(e) {
46
+ if (addButtonDisable) {
47
+ return;
48
+ }
49
+
50
+ updateValue(function (oldValue) {
51
+ var result = correctCalculation(Number(oldValue), step, '+');
52
+ return result > max ? equalLimitDisabled ? oldValue : max : result;
53
+ });
54
+ onAddButtonClick && onAddButtonClick(e);
55
+ }; // 当前值改变时,更新按钮状态
56
+ // Changes button status when value changed
57
+
58
+
59
+ useEffect(function () {
60
+ setMinusButtonDisable(actualInputValue <= min);
61
+ setAddButtonDisable(actualInputValue >= max);
62
+ }, [actualInputValue]);
63
+ return {
64
+ minusButtonDisable: minusButtonDisable,
65
+ addButtonDisable: addButtonDisable,
66
+ handleMinusButtonClick: handleMinusButtonClick,
67
+ handleAddButtonClick: handleAddButtonClick
68
+ };
69
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { StepperProps } from '../type';
3
+ export default function useInputEvent(params: Required<Pick<StepperProps, 'defaultValue' | 'min' | 'max' | 'digits' | 'allowEmpty'>> & Pick<StepperProps, 'onBlur' | 'onChange' | 'onInput'> & {
4
+ actualInputValue: number;
5
+ updateValue: (updater: number | ((oldValue: number) => number)) => void;
6
+ }): {
7
+ handleInput: (e: React.FocusEvent<HTMLInputElement>) => void;
8
+ handleBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
9
+ };
@@ -0,0 +1,53 @@
1
+ import { useUpdateEffect } from '../../_helpers';
2
+ export default function useInputEvent(params) {
3
+ var defaultValue = params.defaultValue,
4
+ min = params.min,
5
+ max = params.max,
6
+ digits = params.digits,
7
+ actualInputValue = params.actualInputValue,
8
+ allowEmpty = params.allowEmpty,
9
+ updateValue = params.updateValue,
10
+ onBlur = params.onBlur,
11
+ onChange = params.onChange,
12
+ onInput = params.onInput;
13
+
14
+ var handleInput = function handleInput(e) {
15
+ var targetValue = e.target.value;
16
+ var numberValue = Number(targetValue);
17
+ var pointIndex = targetValue.indexOf('.');
18
+
19
+ if (digits > 0 && pointIndex !== -1) {
20
+ var decimalLength = targetValue.slice(pointIndex + 1).length;
21
+ updateValue(decimalLength > digits ? actualInputValue : numberValue);
22
+ } else if (allowEmpty && targetValue === '') {
23
+ updateValue(Number.MIN_VALUE);
24
+ } else {
25
+ updateValue(numberValue);
26
+ }
27
+
28
+ onInput && onInput(e);
29
+ };
30
+
31
+ var handleBlur = function handleBlur(e) {
32
+ var targetValue = e.target.value;
33
+ var numberValue = Number(targetValue);
34
+
35
+ if (allowEmpty && targetValue === '') {
36
+ updateValue(Number.MIN_VALUE);
37
+ } else if (!allowEmpty && targetValue === '') {
38
+ updateValue(defaultValue);
39
+ } else {
40
+ updateValue(Math.max(min, Math.min(max, numberValue)));
41
+ }
42
+
43
+ onBlur && onBlur(e);
44
+ };
45
+
46
+ useUpdateEffect(function () {
47
+ onChange && onChange(actualInputValue);
48
+ }, [actualInputValue]);
49
+ return {
50
+ handleInput: handleInput,
51
+ handleBlur: handleBlur
52
+ };
53
+ }
@@ -0,0 +1,6 @@
1
+ import { StepperProps } from '..';
2
+ export default function useValue(params: Required<Pick<StepperProps, 'defaultValue' | 'min' | 'max' | 'digits'>> & Pick<StepperProps, 'formatter' | 'value'>): {
3
+ updateValue: (updater: number | ((oldValue: number) => number)) => void;
4
+ actualInputValue: number;
5
+ showValue: string | number;
6
+ };
@@ -0,0 +1,38 @@
1
+ import { useState } from 'react';
2
+ export default function useValue(params) {
3
+ var defaultValue = params.defaultValue,
4
+ formatter = params.formatter,
5
+ max = params.max,
6
+ min = params.min,
7
+ value = params.value,
8
+ digits = params.digits;
9
+
10
+ var _useState = useState(defaultValue),
11
+ innerValue = _useState[0],
12
+ setInnerValue = _useState[1];
13
+
14
+ var updateValue = function updateValue(updater) {
15
+ var tempValue = typeof updater === 'function' ? updater(innerValue) : updater;
16
+
17
+ if (formatter) {
18
+ new Promise(function (resolve) {
19
+ resolve(formatter(Number(tempValue)));
20
+ }).then(function (result) {
21
+ var res = Math.max(min, Math.min(max, result));
22
+ setInnerValue(res);
23
+ });
24
+ } else {
25
+ setInnerValue(tempValue);
26
+ }
27
+ };
28
+
29
+ var actualInputValue = value !== undefined ? value : innerValue; // 将actualInputValue等于Number.MIN_VALUE的情况视为空值
30
+ // @en If actualInputValue equal Number.MIN_VALUE, actualInputValue equal ''
31
+
32
+ var showValue = actualInputValue === Number.MIN_VALUE ? '' : digits > 0 ? parseFloat(String(actualInputValue)).toFixed(digits) : actualInputValue;
33
+ return {
34
+ updateValue: updateValue,
35
+ actualInputValue: actualInputValue,
36
+ showValue: showValue
37
+ };
38
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StepperProps, StepperRef } from './type';
3
+ export * from './type';
4
+ /**
5
+ * 步进器组件,支持受控模式
6
+ * @en Stepper component, provide controlled mode
7
+ * @type 数据录入
8
+ * @type_en Data Entry
9
+ * @name 步进器
10
+ * @name_en Stepper
11
+ */
12
+ declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<StepperRef>>;
13
+ export default Stepper;