@arco-design/mobile-react 2.31.2 → 2.31.4

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 (228) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.en-US.md +3 -3
  3. package/README.md +3 -3
  4. package/cjs/action-sheet/style/css/index.css +2 -2
  5. package/cjs/avatar/style/css/index.css +2 -2
  6. package/cjs/badge/style/css/index.css +2 -2
  7. package/cjs/button/style/css/index.css +2 -2
  8. package/cjs/carousel/style/css/index.css +2 -2
  9. package/cjs/cell/style/css/index.css +2 -2
  10. package/cjs/checkbox/style/css/index.css +2 -2
  11. package/cjs/circle-progress/style/css/index.css +2 -2
  12. package/cjs/collapse/style/css/index.css +2 -2
  13. package/cjs/count-down/style/css/index.css +2 -2
  14. package/cjs/date-picker/index.js +7 -7
  15. package/cjs/date-picker/style/css/index.css +2 -2
  16. package/cjs/date-picker/type.d.ts +7 -1
  17. package/cjs/dialog/style/css/index.css +2 -2
  18. package/cjs/divider/style/css/index.css +2 -2
  19. package/cjs/dropdown/style/css/index.css +2 -2
  20. package/cjs/dropdown-menu/style/css/index.css +2 -2
  21. package/cjs/ellipsis/style/css/index.css +2 -2
  22. package/cjs/form/form-item.d.ts +0 -3
  23. package/cjs/form/form-item.js +19 -30
  24. package/cjs/form/index.js +6 -2
  25. package/cjs/form/linked-container.d.ts +8 -0
  26. package/cjs/form/linked-container.js +72 -0
  27. package/cjs/form/style/css/index.css +2 -2
  28. package/cjs/form/style/index.less +3 -3
  29. package/cjs/form/type.d.ts +7 -11
  30. package/cjs/form/useForm.js +36 -48
  31. package/cjs/grid/style/css/index.css +2 -2
  32. package/cjs/image/style/css/index.css +2 -2
  33. package/cjs/image-picker/style/css/index.css +2 -2
  34. package/cjs/image-preview/style/css/index.css +2 -2
  35. package/cjs/index-bar/style/css/index.css +2 -2
  36. package/cjs/input/style/css/index.css +2 -2
  37. package/cjs/keyboard/style/css/index.css +2 -2
  38. package/cjs/load-more/style/css/index.css +2 -2
  39. package/cjs/loading/style/css/index.css +2 -2
  40. package/cjs/masking/style/css/index.css +2 -2
  41. package/cjs/nav-bar/style/css/index.css +2 -2
  42. package/cjs/notice-bar/style/css/index.css +2 -2
  43. package/cjs/notify/style/css/index.css +2 -2
  44. package/cjs/pagination/style/css/index.css +2 -2
  45. package/cjs/picker/index.js +1 -1
  46. package/cjs/picker/style/css/index.css +2 -2
  47. package/cjs/picker-view/style/css/index.css +2 -2
  48. package/cjs/popover/style/css/index.css +2 -2
  49. package/cjs/popover/style/css/menu.css +2 -2
  50. package/cjs/popup/style/css/index.css +2 -2
  51. package/cjs/popup-swiper/style/css/index.css +2 -2
  52. package/cjs/progress/style/css/index.css +2 -2
  53. package/cjs/pull-refresh/style/css/index.css +2 -2
  54. package/cjs/radio/style/css/index.css +2 -2
  55. package/cjs/rate/style/css/index.css +2 -2
  56. package/cjs/search-bar/style/css/index.css +2 -2
  57. package/cjs/skeleton/style/css/index.css +2 -2
  58. package/cjs/slider/style/css/index.css +2 -2
  59. package/cjs/stepper/hooks/useInputEvent.d.ts +1 -0
  60. package/cjs/stepper/hooks/useInputEvent.js +3 -2
  61. package/cjs/stepper/hooks/useValue.d.ts +1 -0
  62. package/cjs/stepper/hooks/useValue.js +2 -1
  63. package/cjs/stepper/index.js +3 -1
  64. package/cjs/stepper/style/css/index.css +2 -2
  65. package/cjs/steps/style/css/index.css +2 -2
  66. package/cjs/sticky/style/css/index.css +2 -2
  67. package/cjs/swipe-action/style/css/index.css +2 -2
  68. package/cjs/swipe-load/style/css/index.css +2 -2
  69. package/cjs/switch/style/css/index.css +2 -2
  70. package/cjs/tab-bar/style/css/index.css +2 -2
  71. package/cjs/tabs/style/css/index.css +2 -2
  72. package/cjs/tag/style/css/index.css +2 -2
  73. package/cjs/textarea/style/css/index.css +2 -2
  74. package/cjs/toast/style/css/index.css +2 -2
  75. package/cjs/transition/style/css/index.css +2 -2
  76. package/cjs/uploader/style/css/index.css +2 -2
  77. package/dist/index.js +1832 -1831
  78. package/dist/index.min.js +4 -4
  79. package/dist/style.css +114 -114
  80. package/esm/action-sheet/style/css/index.css +2 -2
  81. package/esm/avatar/style/css/index.css +2 -2
  82. package/esm/badge/style/css/index.css +2 -2
  83. package/esm/button/style/css/index.css +2 -2
  84. package/esm/carousel/style/css/index.css +2 -2
  85. package/esm/cell/style/css/index.css +2 -2
  86. package/esm/checkbox/style/css/index.css +2 -2
  87. package/esm/circle-progress/style/css/index.css +2 -2
  88. package/esm/collapse/style/css/index.css +2 -2
  89. package/esm/count-down/style/css/index.css +2 -2
  90. package/esm/date-picker/index.js +8 -8
  91. package/esm/date-picker/style/css/index.css +2 -2
  92. package/esm/date-picker/type.d.ts +7 -1
  93. package/esm/dialog/style/css/index.css +2 -2
  94. package/esm/divider/style/css/index.css +2 -2
  95. package/esm/dropdown/style/css/index.css +2 -2
  96. package/esm/dropdown-menu/style/css/index.css +2 -2
  97. package/esm/ellipsis/style/css/index.css +2 -2
  98. package/esm/form/form-item.d.ts +0 -3
  99. package/esm/form/form-item.js +14 -25
  100. package/esm/form/index.js +7 -3
  101. package/esm/form/linked-container.d.ts +8 -0
  102. package/esm/form/linked-container.js +54 -0
  103. package/esm/form/style/css/index.css +2 -2
  104. package/esm/form/style/index.less +3 -3
  105. package/esm/form/type.d.ts +7 -11
  106. package/esm/form/useForm.js +31 -42
  107. package/esm/grid/style/css/index.css +2 -2
  108. package/esm/image/style/css/index.css +2 -2
  109. package/esm/image-picker/style/css/index.css +2 -2
  110. package/esm/image-preview/style/css/index.css +2 -2
  111. package/esm/index-bar/style/css/index.css +2 -2
  112. package/esm/input/style/css/index.css +2 -2
  113. package/esm/keyboard/style/css/index.css +2 -2
  114. package/esm/load-more/style/css/index.css +2 -2
  115. package/esm/loading/style/css/index.css +2 -2
  116. package/esm/masking/style/css/index.css +2 -2
  117. package/esm/nav-bar/style/css/index.css +2 -2
  118. package/esm/notice-bar/style/css/index.css +2 -2
  119. package/esm/notify/style/css/index.css +2 -2
  120. package/esm/pagination/style/css/index.css +2 -2
  121. package/esm/picker/index.js +1 -1
  122. package/esm/picker/style/css/index.css +2 -2
  123. package/esm/picker-view/style/css/index.css +2 -2
  124. package/esm/popover/style/css/index.css +2 -2
  125. package/esm/popover/style/css/menu.css +2 -2
  126. package/esm/popup/style/css/index.css +2 -2
  127. package/esm/popup-swiper/style/css/index.css +2 -2
  128. package/esm/progress/style/css/index.css +2 -2
  129. package/esm/pull-refresh/style/css/index.css +2 -2
  130. package/esm/radio/style/css/index.css +2 -2
  131. package/esm/rate/style/css/index.css +2 -2
  132. package/esm/search-bar/style/css/index.css +2 -2
  133. package/esm/skeleton/style/css/index.css +2 -2
  134. package/esm/slider/style/css/index.css +2 -2
  135. package/esm/stepper/hooks/useInputEvent.d.ts +1 -0
  136. package/esm/stepper/hooks/useInputEvent.js +3 -2
  137. package/esm/stepper/hooks/useValue.d.ts +1 -0
  138. package/esm/stepper/hooks/useValue.js +2 -1
  139. package/esm/stepper/index.js +3 -1
  140. package/esm/stepper/style/css/index.css +2 -2
  141. package/esm/steps/style/css/index.css +2 -2
  142. package/esm/sticky/style/css/index.css +2 -2
  143. package/esm/swipe-action/style/css/index.css +2 -2
  144. package/esm/swipe-load/style/css/index.css +2 -2
  145. package/esm/switch/style/css/index.css +2 -2
  146. package/esm/tab-bar/style/css/index.css +2 -2
  147. package/esm/tabs/style/css/index.css +2 -2
  148. package/esm/tag/style/css/index.css +2 -2
  149. package/esm/textarea/style/css/index.css +2 -2
  150. package/esm/toast/style/css/index.css +2 -2
  151. package/esm/transition/style/css/index.css +2 -2
  152. package/esm/uploader/style/css/index.css +2 -2
  153. package/package.json +3 -3
  154. package/style/css/public.css +2 -2
  155. package/tokens/mixin/index.less +2 -2
  156. package/umd/action-sheet/style/css/index.css +2 -2
  157. package/umd/avatar/style/css/index.css +2 -2
  158. package/umd/badge/style/css/index.css +2 -2
  159. package/umd/button/style/css/index.css +2 -2
  160. package/umd/carousel/style/css/index.css +2 -2
  161. package/umd/cell/style/css/index.css +2 -2
  162. package/umd/checkbox/style/css/index.css +2 -2
  163. package/umd/circle-progress/style/css/index.css +2 -2
  164. package/umd/collapse/style/css/index.css +2 -2
  165. package/umd/count-down/style/css/index.css +2 -2
  166. package/umd/date-picker/index.js +7 -7
  167. package/umd/date-picker/style/css/index.css +2 -2
  168. package/umd/date-picker/type.d.ts +7 -1
  169. package/umd/dialog/style/css/index.css +2 -2
  170. package/umd/divider/style/css/index.css +2 -2
  171. package/umd/dropdown/style/css/index.css +2 -2
  172. package/umd/dropdown-menu/style/css/index.css +2 -2
  173. package/umd/ellipsis/style/css/index.css +2 -2
  174. package/umd/form/form-item.d.ts +0 -3
  175. package/umd/form/form-item.js +19 -34
  176. package/umd/form/index.js +6 -2
  177. package/umd/form/linked-container.d.ts +8 -0
  178. package/umd/form/linked-container.js +78 -0
  179. package/umd/form/style/css/index.css +2 -2
  180. package/umd/form/style/index.less +3 -3
  181. package/umd/form/type.d.ts +7 -11
  182. package/umd/form/useForm.js +38 -50
  183. package/umd/grid/style/css/index.css +2 -2
  184. package/umd/image/style/css/index.css +2 -2
  185. package/umd/image-picker/style/css/index.css +2 -2
  186. package/umd/image-preview/style/css/index.css +2 -2
  187. package/umd/index-bar/style/css/index.css +2 -2
  188. package/umd/input/style/css/index.css +2 -2
  189. package/umd/keyboard/style/css/index.css +2 -2
  190. package/umd/load-more/style/css/index.css +2 -2
  191. package/umd/loading/style/css/index.css +2 -2
  192. package/umd/masking/style/css/index.css +2 -2
  193. package/umd/nav-bar/style/css/index.css +2 -2
  194. package/umd/notice-bar/style/css/index.css +2 -2
  195. package/umd/notify/style/css/index.css +2 -2
  196. package/umd/pagination/style/css/index.css +2 -2
  197. package/umd/picker/index.js +1 -1
  198. package/umd/picker/style/css/index.css +2 -2
  199. package/umd/picker-view/style/css/index.css +2 -2
  200. package/umd/popover/style/css/index.css +2 -2
  201. package/umd/popover/style/css/menu.css +2 -2
  202. package/umd/popup/style/css/index.css +2 -2
  203. package/umd/popup-swiper/style/css/index.css +2 -2
  204. package/umd/progress/style/css/index.css +2 -2
  205. package/umd/pull-refresh/style/css/index.css +2 -2
  206. package/umd/radio/style/css/index.css +2 -2
  207. package/umd/rate/style/css/index.css +2 -2
  208. package/umd/search-bar/style/css/index.css +2 -2
  209. package/umd/skeleton/style/css/index.css +2 -2
  210. package/umd/slider/style/css/index.css +2 -2
  211. package/umd/stepper/hooks/useInputEvent.d.ts +1 -0
  212. package/umd/stepper/hooks/useInputEvent.js +3 -2
  213. package/umd/stepper/hooks/useValue.d.ts +1 -0
  214. package/umd/stepper/hooks/useValue.js +2 -1
  215. package/umd/stepper/index.js +3 -1
  216. package/umd/stepper/style/css/index.css +2 -2
  217. package/umd/steps/style/css/index.css +2 -2
  218. package/umd/sticky/style/css/index.css +2 -2
  219. package/umd/swipe-action/style/css/index.css +2 -2
  220. package/umd/swipe-load/style/css/index.css +2 -2
  221. package/umd/switch/style/css/index.css +2 -2
  222. package/umd/tab-bar/style/css/index.css +2 -2
  223. package/umd/tabs/style/css/index.css +2 -2
  224. package/umd/tag/style/css/index.css +2 -2
  225. package/umd/textarea/style/css/index.css +2 -2
  226. package/umd/toast/style/css/index.css +2 -2
  227. package/umd/transition/style/css/index.css +2 -2
  228. package/umd/uploader/style/css/index.css +2 -2
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -1,7 +1,4 @@
1
1
  import React from 'react';
2
2
  import { FormItemProps, FormItemRef } from './type';
3
- export declare function DefaultPickerLinkedContainer({ value }: {
4
- value: (string | number)[];
5
- }): JSX.Element;
6
3
  declare const _default: React.ForwardRefExoticComponent<FormItemProps & React.RefAttributes<FormItemRef>>;
7
4
  export default _default;
@@ -1,22 +1,21 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "@babel/runtime/helpers/inheritsLoose", "react", "@arco-design/mobile-utils", "./form-item-context", "../context-provider", "./type", "./utils"], factory);
3
+ define(["exports", "@babel/runtime/helpers/extends", "@babel/runtime/helpers/objectWithoutPropertiesLoose", "@babel/runtime/helpers/inheritsLoose", "react", "@arco-design/mobile-utils", "es6-promise", "./form-item-context", "../context-provider", "./type", "./utils", "./linked-container"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("@babel/runtime/helpers/inheritsLoose"), require("react"), require("@arco-design/mobile-utils"), require("./form-item-context"), require("../context-provider"), require("./type"), require("./utils"));
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("@babel/runtime/helpers/objectWithoutPropertiesLoose"), require("@babel/runtime/helpers/inheritsLoose"), require("react"), require("@arco-design/mobile-utils"), require("es6-promise"), require("./form-item-context"), require("../context-provider"), require("./type"), require("./utils"), require("./linked-container"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.inheritsLoose, global.react, global.mobileUtils, global.formItemContext, global.contextProvider, global.type, global.utils);
10
+ factory(mod.exports, global._extends, global.objectWithoutPropertiesLoose, global.inheritsLoose, global.react, global.mobileUtils, global.es6Promise, global.formItemContext, global.contextProvider, global.type, global.utils, global.linkedContainer);
11
11
  global.formItem = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _inheritsLoose2, _react, _mobileUtils, _formItemContext, _contextProvider, _type, _utils) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _objectWithoutPropertiesLoose2, _inheritsLoose2, _react, _mobileUtils, _es6Promise, _formItemContext, _contextProvider, _type, _utils, _linkedContainer) {
14
14
  "use strict";
15
15
 
16
16
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
17
 
18
18
  _exports.__esModule = true;
19
- _exports.DefaultPickerLinkedContainer = DefaultPickerLinkedContainer;
20
19
  _exports.default = void 0;
21
20
  _extends2 = _interopRequireDefault(_extends2);
22
21
  _objectWithoutPropertiesLoose2 = _interopRequireDefault(_objectWithoutPropertiesLoose2);
@@ -28,21 +27,6 @@
28
27
 
29
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
29
 
31
- function DefaultPickerLinkedContainer(_ref) {
32
- var value = _ref.value;
33
-
34
- var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
35
- prefixCls = _useContext.prefixCls,
36
- locale = _useContext.locale;
37
-
38
- var className = prefixCls + "-form-picker-link-container";
39
- return /*#__PURE__*/_react.default.createElement("div", {
40
- className: className
41
- }, value && value.length ? value.join('-') : /*#__PURE__*/_react.default.createElement("span", {
42
- className: className + "-placeholder"
43
- }, locale == null ? void 0 : locale.Form.pickerDefaultHint));
44
- }
45
-
46
30
  var FormItemInner = /*#__PURE__*/function (_PureComponent) {
47
31
  (0, _inheritsLoose2.default)(FormItemInner, _PureComponent);
48
32
 
@@ -56,14 +40,14 @@
56
40
  _this._errors = [];
57
41
  _this._touched = false;
58
42
 
59
- _this.onValueChange = function (preStore, curStore) {
43
+ _this.onValueChange = function (curValue, preValue) {
60
44
  _this._touched = true;
61
45
  var shouldUpdate = _this.props.shouldUpdate;
62
46
 
63
47
  if (typeof shouldUpdate === 'function') {
64
48
  shouldUpdate({
65
- preStore: preStore,
66
- curStore: curStore
49
+ preValue: preValue,
50
+ curValue: curValue
67
51
  }) && _this.forceUpdate();
68
52
  return;
69
53
  }
@@ -96,7 +80,7 @@
96
80
  var fieldValidator = new _mobileUtils.Validator((_Validator = {}, _Validator[field] = rules, _Validator), {
97
81
  validateMessages: validateMessages
98
82
  });
99
- return new Promise(function (resolve) {
83
+ return new _es6Promise.Promise(function (resolve) {
100
84
  var _fieldValidator$valid;
101
85
 
102
86
  fieldValidator.validate((_fieldValidator$valid = {}, _fieldValidator$valid[field] = value, _fieldValidator$valid), function (errorsMap) {
@@ -122,7 +106,7 @@
122
106
  });
123
107
  }
124
108
 
125
- return Promise.resolve({
109
+ return _es6Promise.Promise.resolve({
126
110
  errors: [],
127
111
  warnings: [],
128
112
  value: value,
@@ -273,9 +257,10 @@
273
257
  currentTs: getFieldValue(field),
274
258
  onChange: this.innerTriggerFunctionWithValueFirst,
275
259
  disabled: this.props.disabled,
276
- renderLinkedContainer: ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (val) {
277
- return /*#__PURE__*/_react.default.createElement(DefaultPickerLinkedContainer, {
278
- value: val
260
+ renderLinkedContainer: ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (ts, types) {
261
+ return /*#__PURE__*/_react.default.createElement(_linkedContainer.DefaultDatePickerLinkedContainer, {
262
+ ts: ts,
263
+ types: types
279
264
  });
280
265
  }
281
266
  };
@@ -287,7 +272,7 @@
287
272
  onChange: this.innerTriggerFunctionWithValueFirst,
288
273
  disabled: this.props.disabled,
289
274
  renderLinkedContainer: ((_children$props8 = children.props) == null ? void 0 : _children$props8.renderLinkedContainer) || function (val) {
290
- return /*#__PURE__*/_react.default.createElement(DefaultPickerLinkedContainer, {
275
+ return /*#__PURE__*/_react.default.createElement(_linkedContainer.DefaultPickerLinkedContainer, {
291
276
  value: val
292
277
  });
293
278
  }
@@ -355,12 +340,12 @@
355
340
  className = _props$className === void 0 ? '' : _props$className,
356
341
  rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
357
342
 
358
- var _useContext2 = (0, _react.useContext)(_contextProvider.GlobalContext),
359
- prefixCls = _useContext2.prefixCls;
343
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
344
+ prefixCls = _useContext.prefixCls;
360
345
 
361
- var _useContext3 = (0, _react.useContext)(_formItemContext.FormItemContext),
362
- layout = _useContext3.layout,
363
- propsDisabled = _useContext3.disabled;
346
+ var _useContext2 = (0, _react.useContext)(_formItemContext.FormItemContext),
347
+ layout = _useContext2.layout,
348
+ propsDisabled = _useContext2.disabled;
364
349
 
365
350
  var _useState = (0, _react.useState)(null),
366
351
  errors = _useState[0],
package/umd/form/index.js CHANGED
@@ -50,6 +50,7 @@
50
50
  onSubmitFailed = props.onSubmitFailed,
51
51
  disabled = props.disabled;
52
52
  var domRef = (0, _react.useRef)(null);
53
+ var initRef = (0, _react.useRef)(false);
53
54
 
54
55
  var _useForm = (0, _useForm2.default)(formInstance),
55
56
  form = _useForm[0];
@@ -63,9 +64,12 @@
63
64
  onSubmit: onSubmit,
64
65
  onSubmitFailed: onSubmitFailed
65
66
  });
66
- (0, _react.useEffect)(function () {
67
+
68
+ if (!initRef.current) {
67
69
  setInitialValues(initialValues || {});
68
- }, []);
70
+ initRef.current = true;
71
+ }
72
+
69
73
  (0, _react.useImperativeHandle)(ref, function () {
70
74
  return {
71
75
  dom: domRef.current,
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare function DefaultPickerLinkedContainer({ value }: {
3
+ value: (string | number)[];
4
+ }): JSX.Element;
5
+ export declare function DefaultDatePickerLinkedContainer({ ts, types }: {
6
+ ts: number;
7
+ types: string[];
8
+ }): JSX.Element;
@@ -0,0 +1,78 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../date-picker/helper", "../context-provider"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../date-picker/helper"), require("../context-provider"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.react, global.mobileUtils, global.helper, global.contextProvider);
11
+ global.linkedContainer = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helper, _contextProvider) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.DefaultDatePickerLinkedContainer = DefaultDatePickerLinkedContainer;
20
+ _exports.DefaultPickerLinkedContainer = DefaultPickerLinkedContainer;
21
+ _extends2 = _interopRequireDefault(_extends2);
22
+ _react = _interopRequireWildcard(_react);
23
+
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+
28
+ function DefaultPickerLinkedContainer(_ref) {
29
+ var value = _ref.value;
30
+
31
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
32
+ prefixCls = _useContext.prefixCls,
33
+ locale = _useContext.locale;
34
+
35
+ var className = prefixCls + "-form-picker-link-container";
36
+ return /*#__PURE__*/_react.default.createElement("div", {
37
+ className: className
38
+ }, value && value.length ? value.join('-') : /*#__PURE__*/_react.default.createElement("span", {
39
+ className: className + "-placeholder"
40
+ }, locale == null ? void 0 : locale.Form.pickerDefaultHint));
41
+ }
42
+
43
+ function DefaultDatePickerLinkedContainer(_ref2) {
44
+ var ts = _ref2.ts,
45
+ types = _ref2.types;
46
+
47
+ var _useContext2 = (0, _react.useContext)(_contextProvider.GlobalContext),
48
+ prefixCls = _useContext2.prefixCls,
49
+ locale = _useContext2.locale;
50
+
51
+ var className = prefixCls + "-form-picker-link-container";
52
+ var dateTimeStr = (0, _react.useMemo)(function () {
53
+ return formatDateTimeStr(ts, types);
54
+ }, [ts, types]);
55
+
56
+ function formatDateTimeStr(timestamp, itemTypes) {
57
+ var dateObj = (0, _helper.convertTsToDateObj)(timestamp);
58
+ var validDateObj = Object.keys(dateObj).reduce(function (acc, key) {
59
+ var _ref3;
60
+
61
+ return (0, _extends2.default)({}, acc, itemTypes.includes(key) ? (_ref3 = {}, _ref3[key] = (0, _mobileUtils.formatDateNumber)(dateObj[key]), _ref3) : {});
62
+ }, {});
63
+ var dateStr = [validDateObj.year, validDateObj.month, validDateObj.date].filter(function (v) {
64
+ return v;
65
+ }).join('-');
66
+ var timeStr = [validDateObj.hour, validDateObj.minute, validDateObj.second].filter(function (v) {
67
+ return v;
68
+ }).join(':');
69
+ return dateStr + " " + timeStr;
70
+ }
71
+
72
+ return /*#__PURE__*/_react.default.createElement("div", {
73
+ className: className
74
+ }, ts ? dateTimeStr : /*#__PURE__*/_react.default.createElement("span", {
75
+ className: className + "-placeholder"
76
+ }, locale == null ? void 0 : locale.Form.pickerDefaultHint));
77
+ }
78
+ });
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -39,14 +39,14 @@
39
39
  }
40
40
  &-item-control {
41
41
  padding: 16px 0;
42
- .arco-input-wrap, .arco-input {
42
+ .@{prefix}-input-wrap, .@{prefix}-input {
43
43
  padding: 0;
44
44
  }
45
45
  &-wrapper {
46
46
  width: 100%;
47
47
  flex: 1;
48
48
  position: relative;
49
- .arco-input-wrap {
49
+ .@{prefix}-input-wrap {
50
50
  .use-var(height, input-text-line-height);
51
51
  }
52
52
  }
@@ -75,7 +75,7 @@
75
75
 
76
76
  &-item.@{prefix}-form-item-vertical {
77
77
  display: block;
78
- .arco-input-wrap {
78
+ .@{prefix}-input-wrap {
79
79
  .set-prop-with-rtl(padding-left, 0);
80
80
  }
81
81
  .@{prefix}-form-label-item {
@@ -1,5 +1,6 @@
1
1
  import { IRules } from '@arco-design/mobile-utils';
2
2
  import { ReactNode } from 'react';
3
+ import { Promise } from 'es6-promise';
3
4
  export declare type FieldValue = any;
4
5
  export declare type FieldItem = Record<string, any>;
5
6
  export declare type ILayout = 'horizontal' | 'vertical' | 'inline';
@@ -169,19 +170,14 @@ export interface IFormInstance {
169
170
  * 校验所有表单项
170
171
  * @en Validate all fields
171
172
  */
172
- validateFields: () => Promise<FieldItem>;
173
+ validateFields: () => Promise<IFieldError[]>;
173
174
  /**
174
175
  * 提交表单
175
176
  * @en Submit all fields
176
177
  */
177
178
  submit: () => void;
178
179
  }
179
- export declare type InternalFormInstance = Omit<IFormInstance, 'validateFields'> & {
180
- /**
181
- * 校验所有表单项
182
- * @en Validate all fields
183
- */
184
- validateFields: () => Promise<FieldItem>;
180
+ export declare type InternalFormInstance = IFormInstance & {
185
181
  /**
186
182
  * 获取内部方法
187
183
  * @en Get internal methods
@@ -223,8 +219,8 @@ export interface IFormItemContext {
223
219
  validateMessages?: Record<string, unknown>;
224
220
  }
225
221
  export declare type IShouldUpdateFunc = (data: {
226
- preStore: FieldItem;
227
- curStore: FieldItem;
222
+ preValue: any;
223
+ curValue: any;
228
224
  }) => boolean;
229
225
  export interface FormItemProps {
230
226
  /**
@@ -272,7 +268,7 @@ export interface FormItemProps {
272
268
  * 表单项是否刷新
273
269
  * @en Form item is updated
274
270
  */
275
- shouldUpdate?: boolean | IShouldUpdateFunc;
271
+ shouldUpdate?: IShouldUpdateFunc;
276
272
  /**
277
273
  * 表单项规则
278
274
  * @en Form item rules
@@ -327,7 +323,7 @@ export interface IFormItemInnerProps {
327
323
  * 表单项是否刷新
328
324
  * @en Form item is updated
329
325
  */
330
- shouldUpdate?: boolean | IShouldUpdateFunc;
326
+ shouldUpdate?: IShouldUpdateFunc;
331
327
  /**
332
328
  * 表单项下方节点
333
329
  * @en Form item extra node
@@ -1,16 +1,16 @@
1
1
  (function (global, factory) {
2
2
  if (typeof define === "function" && define.amd) {
3
- define(["exports", "@babel/runtime/regenerator", "@babel/runtime/helpers/asyncToGenerator", "@babel/runtime/helpers/extends", "react"], factory);
3
+ define(["exports", "@babel/runtime/helpers/extends", "react", "es6-promise"], factory);
4
4
  } else if (typeof exports !== "undefined") {
5
- factory(exports, require("@babel/runtime/regenerator"), require("@babel/runtime/helpers/asyncToGenerator"), require("@babel/runtime/helpers/extends"), require("react"));
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("es6-promise"));
6
6
  } else {
7
7
  var mod = {
8
8
  exports: {}
9
9
  };
10
- factory(mod.exports, global.regenerator, global.asyncToGenerator, global._extends, global.react);
10
+ factory(mod.exports, global._extends, global.react, global.es6Promise);
11
11
  global.useForm = mod.exports;
12
12
  }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _regenerator, _asyncToGenerator2, _extends5, _react) {
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends6, _react, _es6Promise) {
14
14
  "use strict";
15
15
 
16
16
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -18,9 +18,7 @@
18
18
  _exports.__esModule = true;
19
19
  _exports.default = useForm;
20
20
  _exports.defaultFormDataMethods = void 0;
21
- _regenerator = _interopRequireDefault(_regenerator);
22
- _asyncToGenerator2 = _interopRequireDefault(_asyncToGenerator2);
23
- _extends5 = _interopRequireDefault(_extends5);
21
+ _extends6 = _interopRequireDefault(_extends6);
24
22
 
25
23
  /* eslint-disable no-console */
26
24
  var defaultFunc = function defaultFunc() {};
@@ -67,40 +65,41 @@
67
65
  this._callbacks = {};
68
66
 
69
67
  this.setFieldsValue = function (values) {
70
- _this._formData = (0, _extends5.default)({}, _this._formData, values);
68
+ var oldValues = Object.keys(values).reduce(function (acc, key) {
69
+ var _extends2;
71
70
 
72
- _this.notifyField(values);
71
+ return (0, _extends6.default)({}, acc, (_extends2 = {}, _extends2[key] = _this.getFieldValue(key), _extends2));
72
+ }, {});
73
+ _this._formData = (0, _extends6.default)({}, _this._formData, values);
74
+ var onValuesChange = _this._callbacks.onValuesChange;
75
+ onValuesChange && onValuesChange(values, _this._formData);
73
76
 
74
- Object.keys(values).forEach(function (key) {
75
- if (key in _this._fieldsList) {
76
- var _this$_fieldsList$key;
77
+ _this.notifyField(values, oldValues);
77
78
 
78
- (_this$_fieldsList$key = _this._fieldsList[key]) == null ? void 0 : _this$_fieldsList$key.onValueChange();
79
- }
80
- });
81
79
  return true;
82
80
  };
83
81
 
84
82
  this.setFieldValue = function (name, value) {
85
- var _extends2, _onValuesChange, _this$notifyField;
83
+ var _oldValues, _extends3, _onValuesChange, _this$notifyField;
86
84
 
87
- _this._formData = (0, _extends5.default)({}, _this._formData, (_extends2 = {}, _extends2[name] = value, _extends2));
85
+ var oldValues = (_oldValues = {}, _oldValues[name] = _this.getFieldValue(name), _oldValues);
86
+ _this._formData = (0, _extends6.default)({}, _this._formData, (_extends3 = {}, _extends3[name] = value, _extends3));
88
87
  var onValuesChange = _this._callbacks.onValuesChange;
89
88
  onValuesChange && onValuesChange((_onValuesChange = {}, _onValuesChange[name] = value, _onValuesChange), _this._formData);
90
89
 
91
- _this.notifyField((_this$notifyField = {}, _this$notifyField[name] = value, _this$notifyField));
90
+ _this.notifyField((_this$notifyField = {}, _this$notifyField[name] = value, _this$notifyField), oldValues);
92
91
 
93
92
  return true;
94
93
  };
95
94
 
96
- this.notifyField = function (values) {
95
+ this.notifyField = function (values, oldValues) {
97
96
  Object.keys(values).map(function (fieldName) {
98
97
  var _this$_fieldsList;
99
98
 
100
99
  var fieldObj = ((_this$_fieldsList = _this._fieldsList) == null ? void 0 : _this$_fieldsList[fieldName]) || null;
101
100
 
102
101
  if (fieldObj) {
103
- fieldObj.onValueChange(values[fieldName]);
102
+ fieldObj.onValueChange(values[fieldName], oldValues[fieldName]);
104
103
  }
105
104
  });
106
105
  };
@@ -165,11 +164,11 @@
165
164
  var initialValue = self.props.initialValue;
166
165
 
167
166
  if (initialValue !== undefined && name) {
168
- var _extends3, _extends4;
167
+ var _extends4, _extends5;
169
168
 
170
- _this._initialValues = (0, _extends5.default)({}, _this._initialValues, (_extends3 = {}, _extends3[name] = initialValue, _extends3));
169
+ _this._initialValues = (0, _extends6.default)({}, _this._initialValues, (_extends4 = {}, _extends4[name] = initialValue, _extends4));
171
170
 
172
- _this.setFieldsValue((0, _extends5.default)({}, _this._formData, (_extends4 = {}, _extends4[name] = initialValue, _extends4)));
171
+ _this.setFieldsValue((0, _extends6.default)({}, _this._formData, (_extends5 = {}, _extends5[name] = initialValue, _extends5)));
173
172
  }
174
173
 
175
174
  return function () {
@@ -181,7 +180,7 @@
181
180
  };
182
181
 
183
182
  this.setInitialValues = function (initVal) {
184
- _this._initialValues = (0, _extends5.default)({}, initVal || {});
183
+ _this._initialValues = (0, _extends6.default)({}, initVal || {});
185
184
 
186
185
  _this.setFieldsValue(initVal);
187
186
  };
@@ -198,8 +197,8 @@
198
197
  return errors;
199
198
  }));
200
199
  });
201
- var summaryPromise = new Promise(function (resolve, reject) {
202
- Promise.all(promiseList).then(function (res) {
200
+ var summaryPromise = new _es6Promise.Promise(function (resolve, reject) {
201
+ _es6Promise.Promise.all(promiseList).then(function (res) {
203
202
  var errorResults = res.filter(function (item) {
204
203
  var _item$errors;
205
204
 
@@ -216,31 +215,20 @@
216
215
  return summaryPromise;
217
216
  };
218
217
 
219
- this.submit = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
220
- return _regenerator.default.wrap(function _callee$(_context) {
221
- while (1) {
222
- switch (_context.prev = _context.next) {
223
- case 0:
224
- _this.validateFields().then(function (result) {
225
- var onSubmit = _this._callbacks.onSubmit;
226
- onSubmit == null ? void 0 : onSubmit(_this._formData, result);
227
- }).catch(function (e) {
228
- var onSubmitFailed = _this._callbacks.onSubmitFailed;
229
-
230
- if (!onSubmitFailed) {
231
- return;
232
- }
233
-
234
- onSubmitFailed(_this._formData, e);
235
- });
236
-
237
- case 1:
238
- case "end":
239
- return _context.stop();
240
- }
218
+ this.submit = function () {
219
+ _this.validateFields().then(function (result) {
220
+ var onSubmit = _this._callbacks.onSubmit;
221
+ onSubmit == null ? void 0 : onSubmit(_this._formData, result);
222
+ }).catch(function (e) {
223
+ var onSubmitFailed = _this._callbacks.onSubmitFailed;
224
+
225
+ if (!onSubmitFailed) {
226
+ return;
241
227
  }
242
- }, _callee);
243
- }));
228
+
229
+ onSubmitFailed(_this._formData, e);
230
+ });
231
+ };
244
232
 
245
233
  this.setCallbacks = function (callbacks) {
246
234
  _this._callbacks = callbacks;
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);
@@ -106,7 +106,7 @@
106
106
  * @param @rules {en} customized rewrite rules, default to initial
107
107
  * @example
108
108
  * ```
109
- * @import '@arco-design/mobile-utils/style/mixin.less';
109
+ * @import '@arco-design/mobile-react/style/mixin.less';
110
110
  *
111
111
  * .demo {
112
112
  * .set-prop-with-rtl(right, auto);
@@ -122,7 +122,7 @@
122
122
  * @param @value {en} css property value
123
123
  * @example
124
124
  * ```
125
- * @import '@arco-design/mobile-utils/style/mixin.less';
125
+ * @import '@arco-design/mobile-react/style/mixin.less';
126
126
  *
127
127
  * .demo {
128
128
  * .set-value-with-rtl(text-align, left);