@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.
- package/CHANGELOG.md +22 -0
- package/README.en-US.md +3 -3
- package/README.md +3 -3
- package/cjs/action-sheet/style/css/index.css +2 -2
- package/cjs/avatar/style/css/index.css +2 -2
- package/cjs/badge/style/css/index.css +2 -2
- package/cjs/button/style/css/index.css +2 -2
- package/cjs/carousel/style/css/index.css +2 -2
- package/cjs/cell/style/css/index.css +2 -2
- package/cjs/checkbox/style/css/index.css +2 -2
- package/cjs/circle-progress/style/css/index.css +2 -2
- package/cjs/collapse/style/css/index.css +2 -2
- package/cjs/count-down/style/css/index.css +2 -2
- package/cjs/date-picker/index.js +7 -7
- package/cjs/date-picker/style/css/index.css +2 -2
- package/cjs/date-picker/type.d.ts +7 -1
- package/cjs/dialog/style/css/index.css +2 -2
- package/cjs/divider/style/css/index.css +2 -2
- package/cjs/dropdown/style/css/index.css +2 -2
- package/cjs/dropdown-menu/style/css/index.css +2 -2
- package/cjs/ellipsis/style/css/index.css +2 -2
- package/cjs/form/form-item.d.ts +0 -3
- package/cjs/form/form-item.js +19 -30
- package/cjs/form/index.js +6 -2
- package/cjs/form/linked-container.d.ts +8 -0
- package/cjs/form/linked-container.js +72 -0
- package/cjs/form/style/css/index.css +2 -2
- package/cjs/form/style/index.less +3 -3
- package/cjs/form/type.d.ts +7 -11
- package/cjs/form/useForm.js +36 -48
- package/cjs/grid/style/css/index.css +2 -2
- package/cjs/image/style/css/index.css +2 -2
- package/cjs/image-picker/style/css/index.css +2 -2
- package/cjs/image-preview/style/css/index.css +2 -2
- package/cjs/index-bar/style/css/index.css +2 -2
- package/cjs/input/style/css/index.css +2 -2
- package/cjs/keyboard/style/css/index.css +2 -2
- package/cjs/load-more/style/css/index.css +2 -2
- package/cjs/loading/style/css/index.css +2 -2
- package/cjs/masking/style/css/index.css +2 -2
- package/cjs/nav-bar/style/css/index.css +2 -2
- package/cjs/notice-bar/style/css/index.css +2 -2
- package/cjs/notify/style/css/index.css +2 -2
- package/cjs/pagination/style/css/index.css +2 -2
- package/cjs/picker/index.js +1 -1
- package/cjs/picker/style/css/index.css +2 -2
- package/cjs/picker-view/style/css/index.css +2 -2
- package/cjs/popover/style/css/index.css +2 -2
- package/cjs/popover/style/css/menu.css +2 -2
- package/cjs/popup/style/css/index.css +2 -2
- package/cjs/popup-swiper/style/css/index.css +2 -2
- package/cjs/progress/style/css/index.css +2 -2
- package/cjs/pull-refresh/style/css/index.css +2 -2
- package/cjs/radio/style/css/index.css +2 -2
- package/cjs/rate/style/css/index.css +2 -2
- package/cjs/search-bar/style/css/index.css +2 -2
- package/cjs/skeleton/style/css/index.css +2 -2
- package/cjs/slider/style/css/index.css +2 -2
- package/cjs/stepper/hooks/useInputEvent.d.ts +1 -0
- package/cjs/stepper/hooks/useInputEvent.js +3 -2
- package/cjs/stepper/hooks/useValue.d.ts +1 -0
- package/cjs/stepper/hooks/useValue.js +2 -1
- package/cjs/stepper/index.js +3 -1
- package/cjs/stepper/style/css/index.css +2 -2
- package/cjs/steps/style/css/index.css +2 -2
- package/cjs/sticky/style/css/index.css +2 -2
- package/cjs/swipe-action/style/css/index.css +2 -2
- package/cjs/swipe-load/style/css/index.css +2 -2
- package/cjs/switch/style/css/index.css +2 -2
- package/cjs/tab-bar/style/css/index.css +2 -2
- package/cjs/tabs/style/css/index.css +2 -2
- package/cjs/tag/style/css/index.css +2 -2
- package/cjs/textarea/style/css/index.css +2 -2
- package/cjs/toast/style/css/index.css +2 -2
- package/cjs/transition/style/css/index.css +2 -2
- package/cjs/uploader/style/css/index.css +2 -2
- package/dist/index.js +1832 -1831
- package/dist/index.min.js +4 -4
- package/dist/style.css +114 -114
- package/esm/action-sheet/style/css/index.css +2 -2
- package/esm/avatar/style/css/index.css +2 -2
- package/esm/badge/style/css/index.css +2 -2
- package/esm/button/style/css/index.css +2 -2
- package/esm/carousel/style/css/index.css +2 -2
- package/esm/cell/style/css/index.css +2 -2
- package/esm/checkbox/style/css/index.css +2 -2
- package/esm/circle-progress/style/css/index.css +2 -2
- package/esm/collapse/style/css/index.css +2 -2
- package/esm/count-down/style/css/index.css +2 -2
- package/esm/date-picker/index.js +8 -8
- package/esm/date-picker/style/css/index.css +2 -2
- package/esm/date-picker/type.d.ts +7 -1
- package/esm/dialog/style/css/index.css +2 -2
- package/esm/divider/style/css/index.css +2 -2
- package/esm/dropdown/style/css/index.css +2 -2
- package/esm/dropdown-menu/style/css/index.css +2 -2
- package/esm/ellipsis/style/css/index.css +2 -2
- package/esm/form/form-item.d.ts +0 -3
- package/esm/form/form-item.js +14 -25
- package/esm/form/index.js +7 -3
- package/esm/form/linked-container.d.ts +8 -0
- package/esm/form/linked-container.js +54 -0
- package/esm/form/style/css/index.css +2 -2
- package/esm/form/style/index.less +3 -3
- package/esm/form/type.d.ts +7 -11
- package/esm/form/useForm.js +31 -42
- package/esm/grid/style/css/index.css +2 -2
- package/esm/image/style/css/index.css +2 -2
- package/esm/image-picker/style/css/index.css +2 -2
- package/esm/image-preview/style/css/index.css +2 -2
- package/esm/index-bar/style/css/index.css +2 -2
- package/esm/input/style/css/index.css +2 -2
- package/esm/keyboard/style/css/index.css +2 -2
- package/esm/load-more/style/css/index.css +2 -2
- package/esm/loading/style/css/index.css +2 -2
- package/esm/masking/style/css/index.css +2 -2
- package/esm/nav-bar/style/css/index.css +2 -2
- package/esm/notice-bar/style/css/index.css +2 -2
- package/esm/notify/style/css/index.css +2 -2
- package/esm/pagination/style/css/index.css +2 -2
- package/esm/picker/index.js +1 -1
- package/esm/picker/style/css/index.css +2 -2
- package/esm/picker-view/style/css/index.css +2 -2
- package/esm/popover/style/css/index.css +2 -2
- package/esm/popover/style/css/menu.css +2 -2
- package/esm/popup/style/css/index.css +2 -2
- package/esm/popup-swiper/style/css/index.css +2 -2
- package/esm/progress/style/css/index.css +2 -2
- package/esm/pull-refresh/style/css/index.css +2 -2
- package/esm/radio/style/css/index.css +2 -2
- package/esm/rate/style/css/index.css +2 -2
- package/esm/search-bar/style/css/index.css +2 -2
- package/esm/skeleton/style/css/index.css +2 -2
- package/esm/slider/style/css/index.css +2 -2
- package/esm/stepper/hooks/useInputEvent.d.ts +1 -0
- package/esm/stepper/hooks/useInputEvent.js +3 -2
- package/esm/stepper/hooks/useValue.d.ts +1 -0
- package/esm/stepper/hooks/useValue.js +2 -1
- package/esm/stepper/index.js +3 -1
- package/esm/stepper/style/css/index.css +2 -2
- package/esm/steps/style/css/index.css +2 -2
- package/esm/sticky/style/css/index.css +2 -2
- package/esm/swipe-action/style/css/index.css +2 -2
- package/esm/swipe-load/style/css/index.css +2 -2
- package/esm/switch/style/css/index.css +2 -2
- package/esm/tab-bar/style/css/index.css +2 -2
- package/esm/tabs/style/css/index.css +2 -2
- package/esm/tag/style/css/index.css +2 -2
- package/esm/textarea/style/css/index.css +2 -2
- package/esm/toast/style/css/index.css +2 -2
- package/esm/transition/style/css/index.css +2 -2
- package/esm/uploader/style/css/index.css +2 -2
- package/package.json +3 -3
- package/style/css/public.css +2 -2
- package/tokens/mixin/index.less +2 -2
- package/umd/action-sheet/style/css/index.css +2 -2
- package/umd/avatar/style/css/index.css +2 -2
- package/umd/badge/style/css/index.css +2 -2
- package/umd/button/style/css/index.css +2 -2
- package/umd/carousel/style/css/index.css +2 -2
- package/umd/cell/style/css/index.css +2 -2
- package/umd/checkbox/style/css/index.css +2 -2
- package/umd/circle-progress/style/css/index.css +2 -2
- package/umd/collapse/style/css/index.css +2 -2
- package/umd/count-down/style/css/index.css +2 -2
- package/umd/date-picker/index.js +7 -7
- package/umd/date-picker/style/css/index.css +2 -2
- package/umd/date-picker/type.d.ts +7 -1
- package/umd/dialog/style/css/index.css +2 -2
- package/umd/divider/style/css/index.css +2 -2
- package/umd/dropdown/style/css/index.css +2 -2
- package/umd/dropdown-menu/style/css/index.css +2 -2
- package/umd/ellipsis/style/css/index.css +2 -2
- package/umd/form/form-item.d.ts +0 -3
- package/umd/form/form-item.js +19 -34
- package/umd/form/index.js +6 -2
- package/umd/form/linked-container.d.ts +8 -0
- package/umd/form/linked-container.js +78 -0
- package/umd/form/style/css/index.css +2 -2
- package/umd/form/style/index.less +3 -3
- package/umd/form/type.d.ts +7 -11
- package/umd/form/useForm.js +38 -50
- package/umd/grid/style/css/index.css +2 -2
- package/umd/image/style/css/index.css +2 -2
- package/umd/image-picker/style/css/index.css +2 -2
- package/umd/image-preview/style/css/index.css +2 -2
- package/umd/index-bar/style/css/index.css +2 -2
- package/umd/input/style/css/index.css +2 -2
- package/umd/keyboard/style/css/index.css +2 -2
- package/umd/load-more/style/css/index.css +2 -2
- package/umd/loading/style/css/index.css +2 -2
- package/umd/masking/style/css/index.css +2 -2
- package/umd/nav-bar/style/css/index.css +2 -2
- package/umd/notice-bar/style/css/index.css +2 -2
- package/umd/notify/style/css/index.css +2 -2
- package/umd/pagination/style/css/index.css +2 -2
- package/umd/picker/index.js +1 -1
- package/umd/picker/style/css/index.css +2 -2
- package/umd/picker-view/style/css/index.css +2 -2
- package/umd/popover/style/css/index.css +2 -2
- package/umd/popover/style/css/menu.css +2 -2
- package/umd/popup/style/css/index.css +2 -2
- package/umd/popup-swiper/style/css/index.css +2 -2
- package/umd/progress/style/css/index.css +2 -2
- package/umd/pull-refresh/style/css/index.css +2 -2
- package/umd/radio/style/css/index.css +2 -2
- package/umd/rate/style/css/index.css +2 -2
- package/umd/search-bar/style/css/index.css +2 -2
- package/umd/skeleton/style/css/index.css +2 -2
- package/umd/slider/style/css/index.css +2 -2
- package/umd/stepper/hooks/useInputEvent.d.ts +1 -0
- package/umd/stepper/hooks/useInputEvent.js +3 -2
- package/umd/stepper/hooks/useValue.d.ts +1 -0
- package/umd/stepper/hooks/useValue.js +2 -1
- package/umd/stepper/index.js +3 -1
- package/umd/stepper/style/css/index.css +2 -2
- package/umd/steps/style/css/index.css +2 -2
- package/umd/sticky/style/css/index.css +2 -2
- package/umd/swipe-action/style/css/index.css +2 -2
- package/umd/swipe-load/style/css/index.css +2 -2
- package/umd/switch/style/css/index.css +2 -2
- package/umd/tab-bar/style/css/index.css +2 -2
- package/umd/tabs/style/css/index.css +2 -2
- package/umd/tag/style/css/index.css +2 -2
- package/umd/textarea/style/css/index.css +2 -2
- package/umd/toast/style/css/index.css +2 -2
- package/umd/transition/style/css/index.css +2 -2
- package/umd/uploader/style/css/index.css +2 -2
@@ -0,0 +1,72 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports.DefaultDatePickerLinkedContainer = DefaultDatePickerLinkedContainer;
|
7
|
+
exports.DefaultPickerLinkedContainer = DefaultPickerLinkedContainer;
|
8
|
+
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
12
|
+
|
13
|
+
var _mobileUtils = require("@arco-design/mobile-utils");
|
14
|
+
|
15
|
+
var _helper = require("../date-picker/helper");
|
16
|
+
|
17
|
+
var _contextProvider = require("../context-provider");
|
18
|
+
|
19
|
+
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); }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
function DefaultPickerLinkedContainer(_ref) {
|
24
|
+
var value = _ref.value;
|
25
|
+
|
26
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
27
|
+
prefixCls = _useContext.prefixCls,
|
28
|
+
locale = _useContext.locale;
|
29
|
+
|
30
|
+
var className = prefixCls + "-form-picker-link-container";
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
32
|
+
className: className
|
33
|
+
}, value && value.length ? value.join('-') : /*#__PURE__*/_react.default.createElement("span", {
|
34
|
+
className: className + "-placeholder"
|
35
|
+
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
36
|
+
}
|
37
|
+
|
38
|
+
function DefaultDatePickerLinkedContainer(_ref2) {
|
39
|
+
var ts = _ref2.ts,
|
40
|
+
types = _ref2.types;
|
41
|
+
|
42
|
+
var _useContext2 = (0, _react.useContext)(_contextProvider.GlobalContext),
|
43
|
+
prefixCls = _useContext2.prefixCls,
|
44
|
+
locale = _useContext2.locale;
|
45
|
+
|
46
|
+
var className = prefixCls + "-form-picker-link-container";
|
47
|
+
var dateTimeStr = (0, _react.useMemo)(function () {
|
48
|
+
return formatDateTimeStr(ts, types);
|
49
|
+
}, [ts, types]);
|
50
|
+
|
51
|
+
function formatDateTimeStr(timestamp, itemTypes) {
|
52
|
+
var dateObj = (0, _helper.convertTsToDateObj)(timestamp);
|
53
|
+
var validDateObj = Object.keys(dateObj).reduce(function (acc, key) {
|
54
|
+
var _ref3;
|
55
|
+
|
56
|
+
return (0, _extends2.default)({}, acc, itemTypes.includes(key) ? (_ref3 = {}, _ref3[key] = (0, _mobileUtils.formatDateNumber)(dateObj[key]), _ref3) : {});
|
57
|
+
}, {});
|
58
|
+
var dateStr = [validDateObj.year, validDateObj.month, validDateObj.date].filter(function (v) {
|
59
|
+
return v;
|
60
|
+
}).join('-');
|
61
|
+
var timeStr = [validDateObj.hour, validDateObj.minute, validDateObj.second].filter(function (v) {
|
62
|
+
return v;
|
63
|
+
}).join(':');
|
64
|
+
return dateStr + " " + timeStr;
|
65
|
+
}
|
66
|
+
|
67
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
68
|
+
className: className
|
69
|
+
}, ts ? dateTimeStr : /*#__PURE__*/_react.default.createElement("span", {
|
70
|
+
className: className + "-placeholder"
|
71
|
+
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
72
|
+
}
|
@@ -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-
|
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-
|
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
|
-
|
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
|
-
|
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
|
-
|
78
|
+
.@{prefix}-input-wrap {
|
79
79
|
.set-prop-with-rtl(padding-left, 0);
|
80
80
|
}
|
81
81
|
.@{prefix}-form-label-item {
|
package/cjs/form/type.d.ts
CHANGED
@@ -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<
|
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 =
|
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
|
-
|
227
|
-
|
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?:
|
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?:
|
326
|
+
shouldUpdate?: IShouldUpdateFunc;
|
331
327
|
/**
|
332
328
|
* 表单项下方节点
|
333
329
|
* @en Form item extra node
|
package/cjs/form/useForm.js
CHANGED
@@ -6,14 +6,12 @@ exports.__esModule = true;
|
|
6
6
|
exports.default = useForm;
|
7
7
|
exports.defaultFormDataMethods = void 0;
|
8
8
|
|
9
|
-
var
|
10
|
-
|
11
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
12
|
-
|
13
|
-
var _extends5 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _extends6 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
14
10
|
|
15
11
|
var _react = require("react");
|
16
12
|
|
13
|
+
var _es6Promise = require("es6-promise");
|
14
|
+
|
17
15
|
/* eslint-disable no-console */
|
18
16
|
var defaultFunc = function defaultFunc() {};
|
19
17
|
|
@@ -59,40 +57,41 @@ var FormData = function FormData() {
|
|
59
57
|
this._callbacks = {};
|
60
58
|
|
61
59
|
this.setFieldsValue = function (values) {
|
62
|
-
|
60
|
+
var oldValues = Object.keys(values).reduce(function (acc, key) {
|
61
|
+
var _extends2;
|
63
62
|
|
64
|
-
|
63
|
+
return (0, _extends6.default)({}, acc, (_extends2 = {}, _extends2[key] = _this.getFieldValue(key), _extends2));
|
64
|
+
}, {});
|
65
|
+
_this._formData = (0, _extends6.default)({}, _this._formData, values);
|
66
|
+
var onValuesChange = _this._callbacks.onValuesChange;
|
67
|
+
onValuesChange && onValuesChange(values, _this._formData);
|
65
68
|
|
66
|
-
|
67
|
-
if (key in _this._fieldsList) {
|
68
|
-
var _this$_fieldsList$key;
|
69
|
+
_this.notifyField(values, oldValues);
|
69
70
|
|
70
|
-
(_this$_fieldsList$key = _this._fieldsList[key]) == null ? void 0 : _this$_fieldsList$key.onValueChange();
|
71
|
-
}
|
72
|
-
});
|
73
71
|
return true;
|
74
72
|
};
|
75
73
|
|
76
74
|
this.setFieldValue = function (name, value) {
|
77
|
-
var
|
75
|
+
var _oldValues, _extends3, _onValuesChange, _this$notifyField;
|
78
76
|
|
79
|
-
|
77
|
+
var oldValues = (_oldValues = {}, _oldValues[name] = _this.getFieldValue(name), _oldValues);
|
78
|
+
_this._formData = (0, _extends6.default)({}, _this._formData, (_extends3 = {}, _extends3[name] = value, _extends3));
|
80
79
|
var onValuesChange = _this._callbacks.onValuesChange;
|
81
80
|
onValuesChange && onValuesChange((_onValuesChange = {}, _onValuesChange[name] = value, _onValuesChange), _this._formData);
|
82
81
|
|
83
|
-
_this.notifyField((_this$notifyField = {}, _this$notifyField[name] = value, _this$notifyField));
|
82
|
+
_this.notifyField((_this$notifyField = {}, _this$notifyField[name] = value, _this$notifyField), oldValues);
|
84
83
|
|
85
84
|
return true;
|
86
85
|
};
|
87
86
|
|
88
|
-
this.notifyField = function (values) {
|
87
|
+
this.notifyField = function (values, oldValues) {
|
89
88
|
Object.keys(values).map(function (fieldName) {
|
90
89
|
var _this$_fieldsList;
|
91
90
|
|
92
91
|
var fieldObj = ((_this$_fieldsList = _this._fieldsList) == null ? void 0 : _this$_fieldsList[fieldName]) || null;
|
93
92
|
|
94
93
|
if (fieldObj) {
|
95
|
-
fieldObj.onValueChange(values[fieldName]);
|
94
|
+
fieldObj.onValueChange(values[fieldName], oldValues[fieldName]);
|
96
95
|
}
|
97
96
|
});
|
98
97
|
};
|
@@ -157,11 +156,11 @@ var FormData = function FormData() {
|
|
157
156
|
var initialValue = self.props.initialValue;
|
158
157
|
|
159
158
|
if (initialValue !== undefined && name) {
|
160
|
-
var
|
159
|
+
var _extends4, _extends5;
|
161
160
|
|
162
|
-
_this._initialValues = (0,
|
161
|
+
_this._initialValues = (0, _extends6.default)({}, _this._initialValues, (_extends4 = {}, _extends4[name] = initialValue, _extends4));
|
163
162
|
|
164
|
-
_this.setFieldsValue((0,
|
163
|
+
_this.setFieldsValue((0, _extends6.default)({}, _this._formData, (_extends5 = {}, _extends5[name] = initialValue, _extends5)));
|
165
164
|
}
|
166
165
|
|
167
166
|
return function () {
|
@@ -173,7 +172,7 @@ var FormData = function FormData() {
|
|
173
172
|
};
|
174
173
|
|
175
174
|
this.setInitialValues = function (initVal) {
|
176
|
-
_this._initialValues = (0,
|
175
|
+
_this._initialValues = (0, _extends6.default)({}, initVal || {});
|
177
176
|
|
178
177
|
_this.setFieldsValue(initVal);
|
179
178
|
};
|
@@ -190,8 +189,8 @@ var FormData = function FormData() {
|
|
190
189
|
return errors;
|
191
190
|
}));
|
192
191
|
});
|
193
|
-
var summaryPromise = new Promise(function (resolve, reject) {
|
194
|
-
Promise.all(promiseList).then(function (res) {
|
192
|
+
var summaryPromise = new _es6Promise.Promise(function (resolve, reject) {
|
193
|
+
_es6Promise.Promise.all(promiseList).then(function (res) {
|
195
194
|
var errorResults = res.filter(function (item) {
|
196
195
|
var _item$errors;
|
197
196
|
|
@@ -208,31 +207,20 @@ var FormData = function FormData() {
|
|
208
207
|
return summaryPromise;
|
209
208
|
};
|
210
209
|
|
211
|
-
this.submit =
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
var onSubmitFailed = _this._callbacks.onSubmitFailed;
|
221
|
-
|
222
|
-
if (!onSubmitFailed) {
|
223
|
-
return;
|
224
|
-
}
|
225
|
-
|
226
|
-
onSubmitFailed(_this._formData, e);
|
227
|
-
});
|
228
|
-
|
229
|
-
case 1:
|
230
|
-
case "end":
|
231
|
-
return _context.stop();
|
232
|
-
}
|
210
|
+
this.submit = function () {
|
211
|
+
_this.validateFields().then(function (result) {
|
212
|
+
var onSubmit = _this._callbacks.onSubmit;
|
213
|
+
onSubmit == null ? void 0 : onSubmit(_this._formData, result);
|
214
|
+
}).catch(function (e) {
|
215
|
+
var onSubmitFailed = _this._callbacks.onSubmitFailed;
|
216
|
+
|
217
|
+
if (!onSubmitFailed) {
|
218
|
+
return;
|
233
219
|
}
|
234
|
-
|
235
|
-
|
220
|
+
|
221
|
+
onSubmitFailed(_this._formData, e);
|
222
|
+
});
|
223
|
+
};
|
236
224
|
|
237
225
|
this.setCallbacks = function (callbacks) {
|
238
226
|
_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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
package/cjs/picker/index.js
CHANGED
@@ -131,7 +131,7 @@ var Picker = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
131
131
|
(0, _mobileUtils.nextTick)(function () {
|
132
132
|
setLinkArgs(getCurrentValueData());
|
133
133
|
});
|
134
|
-
}, []);
|
134
|
+
}, [value]);
|
135
135
|
|
136
136
|
function hidePicker(scene) {
|
137
137
|
setLinkVisible(false);
|
@@ -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-
|
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-
|
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-
|
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-
|
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-
|
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-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|