@arco-design/mobile-react 2.36.0 → 2.36.2
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 +24 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/carousel/index.js +8 -7
- package/cjs/ellipsis/components/js-ellipsis.js +3 -1
- package/cjs/form/form-item.d.ts +33 -2
- package/cjs/form/form-item.js +142 -121
- package/cjs/form/index.js +3 -1
- package/cjs/form/linked-container.d.ts +1 -1
- package/cjs/form/linked-container.js +4 -0
- package/cjs/form/style/css/index.css +4 -1
- package/cjs/form/style/index.less +6 -1
- package/cjs/form/type.d.ts +24 -1
- package/cjs/form/type.js +10 -2
- package/cjs/form/useForm.d.ts +2 -17
- package/cjs/form/useForm.js +98 -17
- package/cjs/form/utils.d.ts +2 -0
- package/cjs/form/utils.js +42 -2
- package/cjs/input/index.js +1 -1
- package/cjs/popover/hooks/usePosition.js +26 -8
- package/cjs/radio/group.js +1 -1
- package/cjs/radio/type.d.ts +2 -2
- package/dist/index.js +3021 -370
- package/dist/index.min.js +4 -4
- package/dist/style.css +4 -1
- package/dist/style.min.css +1 -1
- package/esm/carousel/index.js +8 -7
- package/esm/ellipsis/components/js-ellipsis.js +3 -1
- package/esm/form/form-item.d.ts +33 -2
- package/esm/form/form-item.js +143 -122
- package/esm/form/index.js +3 -1
- package/esm/form/linked-container.d.ts +1 -1
- package/esm/form/linked-container.js +4 -0
- package/esm/form/style/css/index.css +4 -1
- package/esm/form/style/index.less +6 -1
- package/esm/form/type.d.ts +24 -1
- package/esm/form/type.js +8 -1
- package/esm/form/useForm.d.ts +2 -17
- package/esm/form/useForm.js +97 -17
- package/esm/form/utils.d.ts +2 -0
- package/esm/form/utils.js +31 -1
- package/esm/input/index.js +1 -1
- package/esm/popover/hooks/usePosition.js +26 -8
- package/esm/radio/group.js +1 -1
- package/esm/radio/type.d.ts +2 -2
- package/esnext/carousel/index.js +7 -5
- package/esnext/ellipsis/components/js-ellipsis.js +2 -0
- package/esnext/form/form-item.d.ts +33 -2
- package/esnext/form/form-item.js +85 -71
- package/esnext/form/index.js +2 -1
- package/esnext/form/linked-container.d.ts +1 -1
- package/esnext/form/linked-container.js +3 -0
- package/esnext/form/style/css/index.css +4 -1
- package/esnext/form/style/index.less +6 -1
- package/esnext/form/type.d.ts +24 -1
- package/esnext/form/type.js +7 -0
- package/esnext/form/useForm.d.ts +2 -17
- package/esnext/form/useForm.js +72 -13
- package/esnext/form/utils.d.ts +2 -0
- package/esnext/form/utils.js +26 -0
- package/esnext/input/index.js +1 -1
- package/esnext/popover/hooks/usePosition.js +32 -12
- package/esnext/radio/group.js +3 -1
- package/esnext/radio/type.d.ts +2 -2
- package/package.json +3 -3
- package/umd/carousel/index.js +8 -7
- package/umd/ellipsis/components/js-ellipsis.js +3 -1
- package/umd/form/form-item.d.ts +33 -2
- package/umd/form/form-item.js +142 -121
- package/umd/form/index.js +3 -1
- package/umd/form/linked-container.d.ts +1 -1
- package/umd/form/linked-container.js +4 -0
- package/umd/form/style/css/index.css +4 -1
- package/umd/form/style/index.less +6 -1
- package/umd/form/type.d.ts +24 -1
- package/umd/form/type.js +9 -1
- package/umd/form/useForm.d.ts +2 -17
- package/umd/form/useForm.js +98 -21
- package/umd/form/utils.d.ts +2 -0
- package/umd/form/utils.js +40 -5
- package/umd/input/index.js +1 -1
- package/umd/popover/hooks/usePosition.js +26 -8
- package/umd/radio/group.js +1 -1
- package/umd/radio/type.d.ts +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,30 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.36.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.36.1...@arco-design/mobile-react@2.36.2) (2025-06-06)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* `Carousel` swipping problem after setting "bounceWhenNoLoop" ([#326](https://github.com/arco-design/arco-design-mobile/issues/326)) ([8e5a788](https://github.com/arco-design/arco-design-mobile/commit/8e5a78858ba5398936ed5d6923753adfae46e1e7))
|
12
|
+
* `Form` add change & reset callback ([#325](https://github.com/arco-design/arco-design-mobile/issues/325)) ([16c2ffd](https://github.com/arco-design/arco-design-mobile/commit/16c2ffd9190cb38b1b8df9ca4087b1b0a90e67ff))
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
## [2.36.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.36.0...@arco-design/mobile-react@2.36.1) (2025-05-15)
|
19
|
+
|
20
|
+
|
21
|
+
### Bug Fixes
|
22
|
+
|
23
|
+
* `Popover` adjust edge when popover is too tall ([#321](https://github.com/arco-design/arco-design-mobile/issues/321)) ([b105897](https://github.com/arco-design/arco-design-mobile/commit/b105897d0a6b8c521cb37364fee8263af4e8a8e0))
|
24
|
+
* fix emoji truncation issue about `Ellipsis` ([#324](https://github.com/arco-design/arco-design-mobile/issues/324)) ([3c157f1](https://github.com/arco-design/arco-design-mobile/commit/3c157f1ee9ae45552647533533864f1c5781c418))
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
6
30
|
# [2.36.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.35.2...@arco-design/mobile-react@2.36.0) (2025-05-13)
|
7
31
|
|
8
32
|
|
package/README.en-US.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.36.1/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.36.1/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## Full import
|
package/README.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.36.1/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.36.1/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
package/cjs/carousel/index.js
CHANGED
@@ -699,12 +699,6 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
699
699
|
|
700
700
|
stopPropagation && e.stopPropagation();
|
701
701
|
|
702
|
-
if (bouncingRef.current) {
|
703
|
-
bouncingRef.current = false;
|
704
|
-
jumpTo(index, false);
|
705
|
-
return;
|
706
|
-
}
|
707
|
-
|
708
702
|
if (!touchStartedRef.current) {
|
709
703
|
return;
|
710
704
|
}
|
@@ -716,7 +710,14 @@ var Carousel = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
716
710
|
return;
|
717
711
|
}
|
718
712
|
|
719
|
-
touchMovedRef.current = false;
|
713
|
+
touchMovedRef.current = false; // bugfix: 回弹判断逻辑需在touchMovedRef标识重置逻辑之后,否则会在触发回弹后导致标识无法重置引起滑动判断问题
|
714
|
+
// @en bugfix: The logic for the bounce judgment needs to be after the touchMovedRef reset logic, otherwise it will cause the problem of slide judgment after the bounce is triggered.
|
715
|
+
|
716
|
+
if (bouncingRef.current) {
|
717
|
+
bouncingRef.current = false;
|
718
|
+
jumpTo(index, false);
|
719
|
+
return;
|
720
|
+
}
|
720
721
|
|
721
722
|
if (posAdjustingRef.current || touchStoppedRef.current) {
|
722
723
|
return;
|
@@ -83,9 +83,11 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
83
83
|
currentText += temp;
|
84
84
|
l = m;
|
85
85
|
}
|
86
|
-
} // Remove the
|
86
|
+
} // Remove the last character if it is orphaned high-surrogate characters (indicative of incomplete emoji).
|
87
87
|
|
88
88
|
|
89
|
+
currentText = currentText.replace(/[\uD800-\uDBFF]+$/, ''); // Remove the exclude char at the end of the content.
|
90
|
+
|
89
91
|
while (endExcludes && endExcludes.includes(currentText[currentText.length - 1])) {
|
90
92
|
currentText = currentText.slice(0, -1);
|
91
93
|
} // Callback after reflow.
|
package/cjs/form/form-item.d.ts
CHANGED
@@ -1,4 +1,35 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import {
|
1
|
+
import React, { PureComponent, ReactNode } from 'react';
|
2
|
+
import { Promise } from 'es6-promise';
|
3
|
+
import { FormItemContext } from './form-item-context';
|
4
|
+
import { IFieldError, FieldValue, IFormItemInnerProps, FormItemProps, ValidateStatus, FormItemRef, ValueChangeType, IFormItemContext } from './type';
|
5
|
+
interface IFormItemInnerState {
|
6
|
+
validateStatus: ValidateStatus;
|
7
|
+
errors?: ReactNode[];
|
8
|
+
_touched: boolean;
|
9
|
+
}
|
10
|
+
declare class FormItemInner extends PureComponent<IFormItemInnerProps, IFormItemInnerState> {
|
11
|
+
context: React.ContextType<typeof FormItemContext>;
|
12
|
+
destroyField: () => void;
|
13
|
+
private _errors;
|
14
|
+
private _touched;
|
15
|
+
constructor(props: IFormItemInnerProps, context: IFormItemContext);
|
16
|
+
componentDidMount(): void;
|
17
|
+
componentWillUnmount(): void;
|
18
|
+
onValueChange: (curValue: FieldValue, preValue: any, info?: {
|
19
|
+
changeType: ValueChangeType;
|
20
|
+
} | undefined) => void;
|
21
|
+
getInitialValue: () => any;
|
22
|
+
getFieldError: () => React.ReactNode[];
|
23
|
+
isFieldTouched: () => boolean;
|
24
|
+
getAllRuleValidateTriggers: () => string[];
|
25
|
+
validateField: (validateTrigger?: string | undefined) => Promise<IFieldError>;
|
26
|
+
setFieldData: (value: FieldValue) => void;
|
27
|
+
innerTriggerFunctionWithValueFirst: (value: any, ...args: any[]) => void;
|
28
|
+
innerOnInputFunction: (_: any, value: any, ...args: any[]) => void;
|
29
|
+
innerClearFunction: (...args: any[]) => void;
|
30
|
+
renderChildren(): React.FunctionComponentElement<any>;
|
31
|
+
render(): React.FunctionComponentElement<any>;
|
32
|
+
}
|
33
|
+
export { FormItemInner };
|
3
34
|
declare const _default: React.ForwardRefExoticComponent<FormItemProps & React.RefAttributes<FormItemRef>>;
|
4
35
|
export default _default;
|
package/cjs/form/form-item.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
-
exports.default = void 0;
|
6
|
+
exports.default = exports.FormItemInner = void 0;
|
7
7
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
9
|
|
@@ -46,7 +46,7 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
46
46
|
_this._errors = [];
|
47
47
|
_this._touched = false;
|
48
48
|
|
49
|
-
_this.onValueChange = function (curValue, preValue) {
|
49
|
+
_this.onValueChange = function (curValue, preValue, info) {
|
50
50
|
_this._touched = true;
|
51
51
|
var shouldUpdate = _this.props.shouldUpdate;
|
52
52
|
|
@@ -58,9 +58,34 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
58
58
|
return;
|
59
59
|
}
|
60
60
|
|
61
|
+
if ((info == null ? void 0 : info.changeType) === _type.ValueChangeType.Reset) {
|
62
|
+
_this.props.onValidateStatusChange({
|
63
|
+
errors: [],
|
64
|
+
warnings: [],
|
65
|
+
errorTypes: []
|
66
|
+
});
|
67
|
+
|
68
|
+
_this._errors = [];
|
69
|
+
}
|
70
|
+
|
61
71
|
_this.forceUpdate();
|
62
72
|
};
|
63
73
|
|
74
|
+
_this.getInitialValue = function () {
|
75
|
+
var _children$type, _getInitialValue;
|
76
|
+
|
77
|
+
var _this$props = _this.props,
|
78
|
+
children = _this$props.children,
|
79
|
+
displayType = _this$props.displayType;
|
80
|
+
|
81
|
+
var _this$context$form$ge = _this.context.form.getInternalHooks(),
|
82
|
+
getInitialValue = _this$context$form$ge.getInitialValue;
|
83
|
+
|
84
|
+
var childrenType = displayType || ((_children$type = children.type) == null ? void 0 : _children$type.displayName); // get user-defined initialValue or if not defined
|
85
|
+
|
86
|
+
return (_getInitialValue = getInitialValue(_this.props.field)) != null ? _getInitialValue : (0, _utils.getDefaultValueForInterComponent)(childrenType);
|
87
|
+
};
|
88
|
+
|
64
89
|
_this.getFieldError = function () {
|
65
90
|
return _this._errors;
|
66
91
|
};
|
@@ -69,21 +94,37 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
69
94
|
return _this._touched;
|
70
95
|
};
|
71
96
|
|
72
|
-
_this.
|
97
|
+
_this.getAllRuleValidateTriggers = function () {
|
98
|
+
var _this$props$rules;
|
99
|
+
|
100
|
+
return ((_this$props$rules = _this.props.rules) == null ? void 0 : _this$props$rules.map(function (rule) {
|
101
|
+
return rule.validateTrigger;
|
102
|
+
}).flat().filter(function (v) {
|
103
|
+
return !!v;
|
104
|
+
})) || [];
|
105
|
+
};
|
106
|
+
|
107
|
+
_this.validateField = function (validateTrigger) {
|
73
108
|
var validateMessages = _this.context.validateMessages;
|
74
109
|
var getFieldValue = _this.context.form.getFieldValue;
|
75
|
-
var _this$
|
76
|
-
field = _this$
|
77
|
-
rules = _this$
|
78
|
-
onValidateStatusChange = _this$
|
79
|
-
var value = getFieldValue(field);
|
80
|
-
|
81
|
-
|
110
|
+
var _this$props2 = _this.props,
|
111
|
+
field = _this$props2.field,
|
112
|
+
rules = _this$props2.rules,
|
113
|
+
onValidateStatusChange = _this$props2.onValidateStatusChange;
|
114
|
+
var value = getFieldValue(field); // rules: if validateTrigger is not defined, all rules will be validated
|
115
|
+
// if validateTrigger is defined, only rules with validateTrigger or without rule.validateTrigger will be validated
|
116
|
+
|
117
|
+
var curRules = validateTrigger ? rules == null ? void 0 : rules.filter(function (rule) {
|
118
|
+
var triggerList = [].concat(rule.validateTrigger || validateTrigger);
|
119
|
+
return triggerList.includes(validateTrigger);
|
120
|
+
}) : rules;
|
121
|
+
|
122
|
+
if (curRules != null && curRules.length && field) {
|
82
123
|
var _Validator;
|
83
124
|
|
84
125
|
var fieldDom = _this.props.getFormItemRef();
|
85
126
|
|
86
|
-
var fieldValidator = new _mobileUtils.Validator((_Validator = {}, _Validator[field] =
|
127
|
+
var fieldValidator = new _mobileUtils.Validator((_Validator = {}, _Validator[field] = curRules, _Validator), {
|
87
128
|
validateMessages: validateMessages
|
88
129
|
});
|
89
130
|
return new _es6Promise.Promise(function (resolve) {
|
@@ -122,82 +163,79 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
122
163
|
};
|
123
164
|
|
124
165
|
_this.setFieldData = function (value) {
|
125
|
-
var
|
126
|
-
|
127
|
-
|
166
|
+
var _this$props3 = _this.props,
|
167
|
+
field = _this$props3.field,
|
168
|
+
_this$props3$trigger = _this$props3.trigger,
|
169
|
+
trigger = _this$props3$trigger === void 0 ? 'onChange' : _this$props3$trigger;
|
170
|
+
|
171
|
+
var _this$context$form$ge2 = _this.context.form.getInternalHooks(),
|
172
|
+
innerSetFieldValue = _this$context$form$ge2.innerSetFieldValue;
|
128
173
|
|
129
|
-
|
174
|
+
innerSetFieldValue(field, value);
|
175
|
+
|
176
|
+
_this.validateField(trigger);
|
130
177
|
};
|
131
178
|
|
132
|
-
_this.
|
179
|
+
_this.innerTriggerFunctionWithValueFirst = function (value) {
|
133
180
|
var _children$props;
|
134
181
|
|
135
182
|
_this.setFieldData(value);
|
136
183
|
|
137
|
-
var _this$
|
138
|
-
children = _this$
|
139
|
-
_this$
|
140
|
-
trigger = _this$
|
184
|
+
var _this$props4 = _this.props,
|
185
|
+
children = _this$props4.children,
|
186
|
+
_this$props4$trigger = _this$props4.trigger,
|
187
|
+
trigger = _this$props4$trigger === void 0 ? 'onChange' : _this$props4$trigger;
|
141
188
|
|
142
189
|
if (trigger && (_children$props = children.props) != null && _children$props[trigger]) {
|
143
190
|
var _children$props2;
|
144
191
|
|
145
|
-
for (var _len = arguments.length, args = new Array(_len >
|
146
|
-
args[_key -
|
192
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
193
|
+
args[_key - 1] = arguments[_key];
|
147
194
|
}
|
148
195
|
|
149
|
-
(_children$props2 = children.props) == null ? void 0 : _children$props2[trigger].apply(_children$props2, [
|
196
|
+
(_children$props2 = children.props) == null ? void 0 : _children$props2[trigger].apply(_children$props2, [value].concat(args));
|
150
197
|
}
|
151
198
|
};
|
152
199
|
|
153
|
-
_this.
|
200
|
+
_this.innerOnInputFunction = function (_, value) {
|
154
201
|
var _children$props3;
|
155
202
|
|
156
203
|
_this.setFieldData(value);
|
157
204
|
|
158
|
-
var
|
159
|
-
children = _this$props3.children,
|
160
|
-
_this$props3$trigger = _this$props3.trigger,
|
161
|
-
trigger = _this$props3$trigger === void 0 ? 'onChange' : _this$props3$trigger;
|
162
|
-
|
163
|
-
if (trigger && (_children$props3 = children.props) != null && _children$props3[trigger]) {
|
164
|
-
var _children$props4;
|
165
|
-
|
166
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
167
|
-
args[_key2 - 1] = arguments[_key2];
|
168
|
-
}
|
205
|
+
var children = _this.props.children;
|
169
206
|
|
170
|
-
|
207
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
208
|
+
args[_key2 - 2] = arguments[_key2];
|
171
209
|
}
|
210
|
+
|
211
|
+
(_children$props3 = children.props) == null ? void 0 : _children$props3.onInput == null ? void 0 : _children$props3.onInput.apply(_children$props3, [_, value].concat(args));
|
172
212
|
};
|
173
213
|
|
174
214
|
_this.innerClearFunction = function () {
|
175
|
-
var _children$
|
215
|
+
var _children$props4;
|
176
216
|
|
177
217
|
var children = _this.props.children;
|
178
218
|
|
179
219
|
_this.setFieldData('');
|
180
220
|
|
181
|
-
if ((_children$
|
182
|
-
var _children$
|
221
|
+
if ((_children$props4 = children.props) != null && _children$props4.onClear) {
|
222
|
+
var _children$props5;
|
183
223
|
|
184
224
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
185
225
|
args[_key3] = arguments[_key3];
|
186
226
|
}
|
187
227
|
|
188
|
-
(_children$
|
228
|
+
(_children$props5 = children.props) == null ? void 0 : _children$props5.onClear.apply(_children$props5, args);
|
189
229
|
}
|
190
230
|
};
|
191
231
|
|
192
232
|
_this.destroyField = function () {};
|
193
233
|
|
194
234
|
if (props != null && props.initialValue && props.field) {
|
195
|
-
var _setInitialValues;
|
196
|
-
|
197
235
|
var _context$form$getInte = context.form.getInternalHooks(),
|
198
|
-
|
236
|
+
setInitialValue = _context$form$getInte.setInitialValue;
|
199
237
|
|
200
|
-
|
238
|
+
setInitialValue(props.field, props.initialValue);
|
201
239
|
}
|
202
240
|
|
203
241
|
return _this;
|
@@ -206,8 +244,8 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
206
244
|
var _proto = FormItemInner.prototype;
|
207
245
|
|
208
246
|
_proto.componentDidMount = function componentDidMount() {
|
209
|
-
var _this$context$form$
|
210
|
-
registerField = _this$context$form$
|
247
|
+
var _this$context$form$ge3 = this.context.form.getInternalHooks(),
|
248
|
+
registerField = _this$context$form$ge3.registerField;
|
211
249
|
|
212
250
|
this.destroyField = registerField(this.props.field, this);
|
213
251
|
};
|
@@ -217,108 +255,90 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
217
255
|
};
|
218
256
|
|
219
257
|
_proto.renderChildren = function renderChildren() {
|
220
|
-
var
|
221
|
-
_children$
|
258
|
+
var _this2 = this,
|
259
|
+
_children$type2,
|
222
260
|
_children$props7,
|
223
|
-
_children$props8
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
_this$
|
230
|
-
|
231
|
-
_this$
|
232
|
-
|
233
|
-
|
261
|
+
_children$props8;
|
262
|
+
|
263
|
+
var _this$props5 = this.props,
|
264
|
+
children = _this$props5.children,
|
265
|
+
field = _this$props5.field,
|
266
|
+
_this$props5$trigger = _this$props5.trigger,
|
267
|
+
trigger = _this$props5$trigger === void 0 ? 'onChange' : _this$props5$trigger,
|
268
|
+
_this$props5$triggerP = _this$props5.triggerPropsField,
|
269
|
+
triggerPropsField = _this$props5$triggerP === void 0 ? 'value' : _this$props5$triggerP,
|
270
|
+
displayType = _this$props5.displayType,
|
271
|
+
disabled = _this$props5.disabled;
|
234
272
|
var getFieldValue = this.context.form.getFieldValue;
|
235
|
-
var
|
236
|
-
|
273
|
+
var childrenProps = {
|
274
|
+
disabled: disabled
|
275
|
+
}; // inject validateTriggers of rules
|
276
|
+
|
277
|
+
this.getAllRuleValidateTriggers().forEach(function (triggerName) {
|
278
|
+
childrenProps[triggerName] = function (e) {
|
279
|
+
var _children$props6, _children$props6$trig;
|
280
|
+
|
281
|
+
_this2.validateField(triggerName);
|
282
|
+
|
283
|
+
children == null ? void 0 : (_children$props6 = children.props) == null ? void 0 : (_children$props6$trig = _children$props6[triggerName]) == null ? void 0 : _children$props6$trig.call(_children$props6, e);
|
284
|
+
};
|
285
|
+
});
|
286
|
+
var childrenType = displayType || ((_children$type2 = children.type) == null ? void 0 : _children$type2.displayName);
|
237
287
|
|
238
288
|
switch (childrenType) {
|
239
289
|
case _type.FormInternalComponentType.Input:
|
240
290
|
case _type.FormInternalComponentType.Textarea:
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
onClear: this.innerClearFunction,
|
245
|
-
disabled: this.props.disabled
|
246
|
-
};
|
247
|
-
break;
|
248
|
-
|
249
|
-
case _type.FormInternalComponentType.Checkbox:
|
250
|
-
case _type.FormInternalComponentType.Radio:
|
251
|
-
case _type.FormInternalComponentType.Slider:
|
252
|
-
case _type.FormInternalComponentType.RadioGroup:
|
253
|
-
case _type.FormInternalComponentType.CheckboxGroup:
|
254
|
-
props = {
|
255
|
-
value: getFieldValue(field),
|
256
|
-
onChange: this.innerTriggerFunctionWithValueFirst,
|
257
|
-
disabled: this.props.disabled
|
258
|
-
};
|
291
|
+
childrenProps.value = getFieldValue(field) || '';
|
292
|
+
childrenProps.onInput = this.innerOnInputFunction;
|
293
|
+
childrenProps.onClear = this.innerClearFunction;
|
259
294
|
break;
|
260
295
|
|
261
296
|
case _type.FormInternalComponentType.DatePicker:
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
});
|
271
|
-
}
|
297
|
+
childrenProps.currentTs = getFieldValue(field);
|
298
|
+
childrenProps.onChange = this.innerTriggerFunctionWithValueFirst;
|
299
|
+
|
300
|
+
childrenProps.renderLinkedContainer = ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (ts, types) {
|
301
|
+
return /*#__PURE__*/_react.default.createElement(_linkedContainer.DefaultDatePickerLinkedContainer, {
|
302
|
+
ts: ts,
|
303
|
+
types: types
|
304
|
+
});
|
272
305
|
};
|
306
|
+
|
273
307
|
break;
|
274
308
|
|
275
309
|
case _type.FormInternalComponentType.Picker:
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
});
|
284
|
-
}
|
310
|
+
childrenProps.value = getFieldValue(field) || '';
|
311
|
+
childrenProps.onChange = this.innerTriggerFunctionWithValueFirst;
|
312
|
+
|
313
|
+
childrenProps.renderLinkedContainer = ((_children$props8 = children.props) == null ? void 0 : _children$props8.renderLinkedContainer) || function (val) {
|
314
|
+
return /*#__PURE__*/_react.default.createElement(_linkedContainer.DefaultPickerLinkedContainer, {
|
315
|
+
value: val
|
316
|
+
});
|
285
317
|
};
|
318
|
+
|
286
319
|
break;
|
287
320
|
|
288
321
|
case _type.FormInternalComponentType.Switch:
|
289
|
-
|
290
|
-
|
291
|
-
onChange: this.innerTriggerFunctionWithValueFirst,
|
292
|
-
disabled: this.props.disabled
|
293
|
-
};
|
322
|
+
childrenProps.checked = Boolean(getFieldValue(field));
|
323
|
+
childrenProps.onChange = this.innerTriggerFunctionWithValueFirst;
|
294
324
|
break;
|
295
325
|
|
296
326
|
case _type.FormInternalComponentType.ImagePicker:
|
297
|
-
|
298
|
-
|
299
|
-
onChange: this.innerTriggerFunctionWithValueFirst,
|
300
|
-
disabled: this.props.disabled
|
301
|
-
};
|
327
|
+
childrenProps.images = getFieldValue(field);
|
328
|
+
childrenProps.onChange = this.innerTriggerFunctionWithValueFirst;
|
302
329
|
break;
|
303
330
|
|
304
331
|
default:
|
305
|
-
|
306
|
-
|
307
|
-
|
332
|
+
if (triggerPropsField) {
|
333
|
+
childrenProps[triggerPropsField] = getFieldValue(field);
|
334
|
+
} // inject the validated result
|
308
335
|
|
309
|
-
props[trigger] = function (newValue) {
|
310
|
-
_this2.setFieldData(newValue);
|
311
|
-
|
312
|
-
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
313
|
-
args[_key4 - 1] = arguments[_key4];
|
314
|
-
}
|
315
|
-
|
316
|
-
originTrigger && originTrigger.apply(void 0, [newValue].concat(args));
|
317
|
-
};
|
318
336
|
|
337
|
+
childrenProps.error = this._errors;
|
338
|
+
childrenProps[trigger] = this.innerTriggerFunctionWithValueFirst;
|
319
339
|
}
|
320
340
|
|
321
|
-
return /*#__PURE__*/_react.default.cloneElement(children,
|
341
|
+
return /*#__PURE__*/_react.default.cloneElement(children, childrenProps);
|
322
342
|
};
|
323
343
|
|
324
344
|
_proto.render = function render() {
|
@@ -328,6 +348,7 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
328
348
|
return FormItemInner;
|
329
349
|
}(_react.PureComponent);
|
330
350
|
|
351
|
+
exports.FormItemInner = FormItemInner;
|
331
352
|
FormItemInner.contextType = _formItemContext.FormItemContext;
|
332
353
|
|
333
354
|
var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
package/cjs/form/index.js
CHANGED
@@ -47,6 +47,7 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
47
47
|
formInstance = props.form,
|
48
48
|
children = props.children,
|
49
49
|
onValuesChange = props.onValuesChange,
|
50
|
+
onChange = props.onChange,
|
50
51
|
onSubmit = props.onSubmit,
|
51
52
|
onSubmitFailed = props.onSubmitFailed,
|
52
53
|
disabled = props.disabled;
|
@@ -63,7 +64,8 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
64
|
setCallbacks({
|
64
65
|
onValuesChange: onValuesChange,
|
65
66
|
onSubmit: onSubmit,
|
66
|
-
onSubmitFailed: onSubmitFailed
|
67
|
+
onSubmitFailed: onSubmitFailed,
|
68
|
+
onChange: onChange
|
67
69
|
});
|
68
70
|
|
69
71
|
if (!initRef.current) {
|
@@ -3,6 +3,6 @@ export declare function DefaultPickerLinkedContainer({ value }: {
|
|
3
3
|
value: (string | number)[];
|
4
4
|
}): JSX.Element;
|
5
5
|
export declare function DefaultDatePickerLinkedContainer({ ts, types, }: {
|
6
|
-
ts
|
6
|
+
ts?: number | [number, number];
|
7
7
|
types: string[];
|
8
8
|
}): JSX.Element;
|
@@ -45,6 +45,10 @@ function DefaultDatePickerLinkedContainer(_ref2) {
|
|
45
45
|
|
46
46
|
var className = prefixCls + "-form-picker-link-container";
|
47
47
|
var dateTimeStr = (0, _react.useMemo)(function () {
|
48
|
+
if (ts === undefined) {
|
49
|
+
return '';
|
50
|
+
}
|
51
|
+
|
48
52
|
if (typeof ts === 'number') {
|
49
53
|
return formatDateTimeStr(ts, types);
|
50
54
|
}
|
@@ -567,6 +567,9 @@
|
|
567
567
|
.arco-form-item-control .arco-input {
|
568
568
|
padding: 0;
|
569
569
|
}
|
570
|
+
.arco-form-item-control .arco-input-wrap.textarea {
|
571
|
+
padding: 0;
|
572
|
+
}
|
570
573
|
.arco-form-item-control-wrapper {
|
571
574
|
width: 100%;
|
572
575
|
-webkit-box-flex: 1;
|
@@ -574,7 +577,7 @@
|
|
574
577
|
flex: 1;
|
575
578
|
position: relative;
|
576
579
|
}
|
577
|
-
.arco-form-item-control-wrapper .arco-input-wrap {
|
580
|
+
.arco-form-item-control-wrapper .arco-input-wrap.single-line {
|
578
581
|
height: 0.44rem ;
|
579
582
|
}
|
580
583
|
.arco-form-item-message {
|
@@ -42,11 +42,16 @@
|
|
42
42
|
.@{prefix}-input-wrap, .@{prefix}-input {
|
43
43
|
padding: 0;
|
44
44
|
}
|
45
|
+
|
46
|
+
.@{prefix}-input-wrap.textarea {
|
47
|
+
padding: 0;
|
48
|
+
}
|
49
|
+
|
45
50
|
&-wrapper {
|
46
51
|
width: 100%;
|
47
52
|
flex: 1;
|
48
53
|
position: relative;
|
49
|
-
.@{prefix}-input-wrap {
|
54
|
+
.@{prefix}-input-wrap.single-line {
|
50
55
|
.use-var(height, input-text-line-height);
|
51
56
|
}
|
52
57
|
}
|