@nutui/nutui-react-taro 3.0.1 → 3.0.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/dist/cjs/hooks/use-client-rect.js +1 -0
- package/dist/cjs/packages/datepicker/style/style.css +70 -0
- package/dist/cjs/packages/datepickerview/style/index.js +1 -0
- package/dist/cjs/packages/datepickerview/style/style.css +70 -0
- package/dist/cjs/packages/fixednav/fixednav.js +20 -14
- package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
- package/dist/cjs/packages/fixednav/style/style.css +0 -14
- package/dist/cjs/packages/fixednav/style/style.harmony.css +0 -14
- package/dist/cjs/packages/form/form.d.ts +2 -0
- package/dist/cjs/packages/form/form.js +11 -2
- package/dist/cjs/packages/form/index.d.ts +2 -1
- package/dist/cjs/packages/form/index.js +1 -0
- package/dist/cjs/packages/form/style/form.scss +0 -66
- package/dist/cjs/packages/form/style/style.css +31 -21
- package/dist/cjs/packages/form/style/style.harmony.css +1 -67
- package/dist/cjs/packages/form/types.d.ts +2 -1
- package/dist/cjs/packages/form/useform.d.ts +2 -1
- package/dist/cjs/packages/form/useform.js +338 -247
- package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
- package/dist/cjs/packages/formitem/formitem.js +57 -45
- package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
- package/dist/cjs/packages/formitem/style/style.css +89 -12
- package/dist/cjs/packages/formitem/style/style.harmony.css +89 -12
- package/dist/cjs/packages/input/input.js +3 -1
- package/dist/cjs/packages/picker/style/index.js +1 -0
- package/dist/cjs/packages/picker/style/style.css +70 -0
- package/dist/cjs/packages/signature/signature.js +1 -1
- package/dist/cjs/packages/swipe/style/style.css +3 -3
- package/dist/cjs/packages/swipe/style/style.harmony.css +3 -3
- package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
- package/dist/cjs/packages/swipe/swipe.js +14 -15
- package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
- package/dist/cjs/utils/get-rect-by-taro.js +4 -1
- package/dist/cjs/utils/get-system-info.js +4 -5
- package/dist/cjs/utils/merge.d.ts +14 -0
- package/dist/cjs/utils/merge.js +98 -0
- package/dist/cjs/utils/platform-taro.js +4 -5
- package/dist/cjs/utils/to-array.d.ts +1 -0
- package/dist/cjs/utils/to-array.js +18 -0
- package/dist/es/hooks/use-client-rect.js +1 -0
- package/dist/es/packages/datepicker/style/style.css +70 -0
- package/dist/es/packages/datepickerview/style/index.js +1 -0
- package/dist/es/packages/datepickerview/style/style.css +70 -0
- package/dist/es/packages/fixednav/fixednav.js +20 -14
- package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
- package/dist/es/packages/fixednav/style/style.css +0 -14
- package/dist/es/packages/fixednav/style/style.harmony.css +0 -14
- package/dist/es/packages/form/form.d.ts +10 -0
- package/dist/es/packages/form/form.js +11 -2
- package/dist/es/packages/form/index.d.ts +2 -1
- package/dist/es/packages/form/index.js +2 -1
- package/dist/es/packages/form/style/form.scss +0 -66
- package/dist/es/packages/form/style/style.css +31 -21
- package/dist/es/packages/form/style/style.harmony.css +1 -67
- package/dist/es/packages/form/types.d.ts +2 -1
- package/dist/es/packages/form/useform.d.ts +2 -1
- package/dist/es/packages/form/useform.js +336 -248
- package/dist/es/packages/formitem/formitem.d.ts +1 -0
- package/dist/es/packages/formitem/formitem.js +58 -46
- package/dist/es/packages/formitem/style/formitem.scss +101 -21
- package/dist/es/packages/formitem/style/style.css +89 -12
- package/dist/es/packages/formitem/style/style.harmony.css +89 -12
- package/dist/es/packages/input/input.js +3 -1
- package/dist/es/packages/picker/style/index.js +1 -0
- package/dist/es/packages/picker/style/style.css +70 -0
- package/dist/es/packages/signature/signature.js +2 -2
- package/dist/es/packages/swipe/style/style.css +3 -3
- package/dist/es/packages/swipe/style/style.harmony.css +3 -3
- package/dist/es/packages/swipe/style/swipe.scss +7 -3
- package/dist/es/packages/swipe/swipe.js +14 -15
- package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
- package/dist/es/utils/get-rect-by-taro.js +4 -1
- package/dist/es/utils/get-system-info.js +4 -4
- package/dist/es/utils/merge.d.ts +14 -0
- package/dist/es/utils/merge.js +68 -0
- package/dist/es/utils/platform-taro.js +4 -4
- package/dist/es/utils/to-array.d.ts +1 -0
- package/dist/es/utils/to-array.js +8 -0
- package/dist/nutui.react.umd.js +4301 -4084
- package/dist/style.css +1 -1
- package/dist/style.scss +34 -34
- package/package.json +1 -1
|
@@ -8,11 +8,12 @@ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
|
8
8
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
9
9
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
10
10
|
import React from "react";
|
|
11
|
-
import { View } from "@tarojs/components";
|
|
11
|
+
import { Text, View } from "@tarojs/components";
|
|
12
12
|
import { Context } from "../form/context";
|
|
13
13
|
import Cell from "../cell/index";
|
|
14
14
|
import { ComponentDefaults } from "../../utils/typings";
|
|
15
15
|
import { isForwardRefComponent } from "../../utils/is-forward-ref-component";
|
|
16
|
+
import { toArray } from "../../utils/to-array";
|
|
16
17
|
import { SECRET } from "../form/useform";
|
|
17
18
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
18
19
|
required: false,
|
|
@@ -25,7 +26,6 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
|
25
26
|
}
|
|
26
27
|
],
|
|
27
28
|
errorMessageAlign: 'left',
|
|
28
|
-
validateTrigger: 'onChange',
|
|
29
29
|
shouldUpdate: false,
|
|
30
30
|
noStyle: false
|
|
31
31
|
});
|
|
@@ -41,15 +41,19 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
41
41
|
]), _define_property(_this, "cancelRegister", void 0), _define_property(_this, "componentRef", void 0), _define_property(_this, "eventOff", void 0), // children添加value属性和onChange事件
|
|
42
42
|
_define_property(_this, "getControlled", function(children) {
|
|
43
43
|
var _children_props;
|
|
44
|
-
var
|
|
45
|
-
var dispatch = _this.context.getInternal(SECRET).dispatch;
|
|
44
|
+
var _this_context_formInstance = _this.context.formInstance, setFieldsValue = _this_context_formInstance.setFieldsValue, getFieldValue = _this_context_formInstance.getFieldValue;
|
|
45
|
+
var dispatch = _this.context.formInstance.getInternal(SECRET).dispatch;
|
|
46
46
|
var _this_props = _this.props, _this_props_name = _this_props.name, name = _this_props_name === void 0 ? '' : _this_props_name;
|
|
47
47
|
if (children === null || children === void 0 ? void 0 : (_children_props = children.props) === null || _children_props === void 0 ? void 0 : _children_props.defaultValue) {
|
|
48
|
-
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
+
console.warn('[NutUI] FormItem:', '请通过 initialValue 设置初始值,而不是 defaultValue');
|
|
50
|
+
}
|
|
49
51
|
}
|
|
50
52
|
var fieldValue = getFieldValue(name);
|
|
51
53
|
var _obj;
|
|
52
|
-
var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
|
|
54
|
+
var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
|
|
55
|
+
className: children.props.className
|
|
56
|
+
}, _define_property(_obj, _this.props.valuePropName || 'value', fieldValue !== undefined ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || 'onChange', function() {
|
|
53
57
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
54
58
|
args[_key] = arguments[_key];
|
|
55
59
|
}
|
|
@@ -63,33 +67,27 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
63
67
|
var _this_props;
|
|
64
68
|
next = (_this_props = _this.props).getValueFromEvent.apply(_this_props, _to_consumable_array(args));
|
|
65
69
|
}
|
|
66
|
-
setFieldsValue(_define_property({}, name, next)
|
|
70
|
+
setFieldsValue(_define_property({}, name, next));
|
|
67
71
|
}), _obj));
|
|
68
72
|
var validateTrigger = _this.props.validateTrigger;
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
name: _this.props.name
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
}
|
|
73
|
+
var mergedValidateTrigger = validateTrigger || _this.context.validateTrigger;
|
|
74
|
+
var validateTriggers = toArray(mergedValidateTrigger);
|
|
75
|
+
validateTriggers.forEach(function(trigger) {
|
|
76
|
+
var originTrigger = controlled[trigger];
|
|
77
|
+
controlled[trigger] = function() {
|
|
78
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
79
|
+
args[_key] = arguments[_key];
|
|
80
|
+
}
|
|
81
|
+
if (originTrigger) {
|
|
82
|
+
originTrigger.apply(void 0, _to_consumable_array(args));
|
|
83
|
+
}
|
|
84
|
+
if (_this.props.rules && _this.props.rules.length) {
|
|
85
|
+
dispatch({
|
|
86
|
+
name: _this.props.name
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
});
|
|
93
91
|
if (isForwardRefComponent(children)) {
|
|
94
92
|
controlled.ref = function(componentInstance) {
|
|
95
93
|
var originRef = children.ref;
|
|
@@ -114,34 +112,36 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
114
112
|
});
|
|
115
113
|
}), _define_property(_this, "onStoreChange", function(type) {
|
|
116
114
|
if (type === 'reset') {
|
|
117
|
-
_this.context.errors[_this.props.name] = [];
|
|
115
|
+
_this.context.formInstance.errors[_this.props.name] = [];
|
|
118
116
|
_this.refresh();
|
|
119
117
|
} else {
|
|
120
118
|
_this.forceUpdate();
|
|
121
119
|
}
|
|
122
120
|
}), _define_property(_this, "renderLayout", function(childNode) {
|
|
123
121
|
var _item_;
|
|
124
|
-
var _$_object_spread = _object_spread({}, defaultProps, _this.props), label = _$_object_spread.label, name = _$_object_spread.name, required = _$_object_spread.required, rules = _$_object_spread.rules, className = _$_object_spread.className, style = _$_object_spread.style,
|
|
122
|
+
var _$_object_spread = _object_spread({}, defaultProps, _this.props), label = _$_object_spread.label, name = _$_object_spread.name, required = _$_object_spread.required, rules = _$_object_spread.rules, className = _$_object_spread.className, style = _$_object_spread.style, errorMessageAlign = _$_object_spread.errorMessageAlign, align = _$_object_spread.align;
|
|
125
123
|
var requiredInRules = rules === null || rules === void 0 ? void 0 : rules.some(function(rule) {
|
|
126
124
|
return rule.required;
|
|
127
125
|
});
|
|
128
|
-
var item = name ? _this.context.errors[name] : [];
|
|
129
|
-
var starPosition = _this.context.starPosition;
|
|
130
|
-
var renderStar = (required || requiredInRules) && /*#__PURE__*/ React.createElement(
|
|
131
|
-
className: "required"
|
|
132
|
-
});
|
|
133
|
-
var renderLabel = /*#__PURE__*/ React.createElement(React.Fragment, null,
|
|
126
|
+
var item = name ? _this.context.formInstance.errors[name] : [];
|
|
127
|
+
var starPosition = _this.context.formInstance.starPosition;
|
|
128
|
+
var renderStar = (required || requiredInRules) && /*#__PURE__*/ React.createElement(Text, {
|
|
129
|
+
className: "nut-form-item-label-required required"
|
|
130
|
+
}, "*");
|
|
131
|
+
var renderLabel = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Text, {
|
|
132
|
+
className: "nut-form-item-labeltxt"
|
|
133
|
+
}, starPosition === 'left' ? renderStar : null, label), starPosition === 'right' ? renderStar : null);
|
|
134
134
|
return /*#__PURE__*/ React.createElement(Cell, {
|
|
135
|
-
className: "nut-form-item ".concat(className),
|
|
135
|
+
className: "".concat(_this.getClassNameWithDirection('nut-form-item'), " ").concat(className),
|
|
136
136
|
style: style,
|
|
137
137
|
align: align,
|
|
138
138
|
onClick: function(e) {
|
|
139
139
|
return _this.props.onClick && _this.props.onClick(e, _this.componentRef);
|
|
140
140
|
}
|
|
141
141
|
}, label ? /*#__PURE__*/ React.createElement(View, {
|
|
142
|
-
className: "nut-cell-title nut-form-item-label
|
|
142
|
+
className: "nut-cell-title ".concat(_this.getClassNameWithDirection('nut-form-item-label'))
|
|
143
143
|
}, renderLabel) : null, /*#__PURE__*/ React.createElement(View, {
|
|
144
|
-
className: "nut-cell-value nut-form-item-body
|
|
144
|
+
className: "nut-cell-value ".concat(_this.getClassNameWithDirection('nut-form-item-body'))
|
|
145
145
|
}, /*#__PURE__*/ React.createElement(View, {
|
|
146
146
|
className: "nut-form-item-body-slots"
|
|
147
147
|
}, childNode), /*#__PURE__*/ React.createElement(View, {
|
|
@@ -163,12 +163,12 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
163
163
|
key: "componentDidMount",
|
|
164
164
|
value: function componentDidMount() {
|
|
165
165
|
// Form设置initialValues时的处理
|
|
166
|
-
var
|
|
166
|
+
var _this_context_formInstance_getInternal = this.context.formInstance.getInternal(SECRET), _this_context_formInstance_getInternal_store = _this_context_formInstance_getInternal.store, store = _this_context_formInstance_getInternal_store === void 0 ? {} : _this_context_formInstance_getInternal_store, setInitialValues = _this_context_formInstance_getInternal.setInitialValues;
|
|
167
167
|
if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
|
|
168
168
|
setInitialValues(_object_spread_props(_object_spread({}, store), _define_property({}, this.props.name, this.props.initialValue)), true);
|
|
169
169
|
}
|
|
170
170
|
// 注册组件实例到FormStore
|
|
171
|
-
var
|
|
171
|
+
var _this_context_formInstance_getInternal1 = this.context.formInstance.getInternal(SECRET), registerField = _this_context_formInstance_getInternal1.registerField, registerUpdate = _this_context_formInstance_getInternal1.registerUpdate;
|
|
172
172
|
this.cancelRegister = registerField(this);
|
|
173
173
|
// 这里需要增加事件监听,因为此实现属于依赖触发
|
|
174
174
|
this.eventOff = registerUpdate(this, this.props.shouldUpdate);
|
|
@@ -185,6 +185,15 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
key: "getClassNameWithDirection",
|
|
190
|
+
value: function getClassNameWithDirection(className) {
|
|
191
|
+
if (className && this.context.labelPosition) {
|
|
192
|
+
return "".concat(className, " ").concat(className, "-").concat(this.context.labelPosition);
|
|
193
|
+
}
|
|
194
|
+
return className;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
188
197
|
{
|
|
189
198
|
key: "render",
|
|
190
199
|
value: function render() {
|
|
@@ -194,11 +203,14 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
|
|
|
194
203
|
if (!this.props.shouldUpdate) {
|
|
195
204
|
returnChildNode = /*#__PURE__*/ React.cloneElement(child, this.getControlled(child));
|
|
196
205
|
} else {
|
|
197
|
-
returnChildNode = child(this.context);
|
|
206
|
+
returnChildNode = child(this.context.formInstance);
|
|
198
207
|
}
|
|
199
208
|
return /*#__PURE__*/ React.createElement(React.Fragment, {
|
|
200
209
|
key: this.state.resetCount
|
|
201
|
-
},
|
|
210
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
211
|
+
className: this.context.disabled ? 'nut-form-item-disabled' : '',
|
|
212
|
+
catchMove: this.context.disabled
|
|
213
|
+
}, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
|
|
202
214
|
}
|
|
203
215
|
}
|
|
204
216
|
]);
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
.nut-form-item {
|
|
2
2
|
display: flex;
|
|
3
|
-
|
|
4
|
-
padding: 4px 12px;
|
|
3
|
+
line-height: unset;
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
border-bottom: 1px solid $form-item-error-line-color;
|
|
10
|
-
transform: scaleX(1);
|
|
11
|
-
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
5
|
+
&-disabled {
|
|
6
|
+
opacity: 0.4;
|
|
7
|
+
pointer-events: none;
|
|
14
8
|
}
|
|
15
9
|
|
|
16
10
|
&-label {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
17
13
|
font-size: $form-item-label-font-size;
|
|
18
14
|
font-weight: normal;
|
|
19
15
|
width: $form-item-label-width;
|
|
20
16
|
margin-right: $form-item-label-margin-right;
|
|
21
|
-
flex:
|
|
22
|
-
display: inline-block !important;
|
|
17
|
+
flex: 0 0 auto;
|
|
23
18
|
word-wrap: break-word;
|
|
24
19
|
text-align: $form-item-label-text-align;
|
|
20
|
+
line-height: unset;
|
|
21
|
+
}
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
&-label-required {
|
|
24
|
+
color: $form-item-required-color;
|
|
25
|
+
margin-right: $form-item-required-margin-right;
|
|
26
|
+
display: block;
|
|
27
|
+
position: absolute;
|
|
28
|
+
left: -10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nut-form-item-labeltxt {
|
|
32
|
+
position: relative;
|
|
33
|
+
font-size: 12px;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
&-body {
|
|
36
37
|
flex: 1;
|
|
37
|
-
display: flex
|
|
38
|
+
display: flex;
|
|
38
39
|
flex-direction: column;
|
|
39
40
|
|
|
40
41
|
&-slots {
|
|
@@ -45,6 +46,10 @@
|
|
|
45
46
|
border: 0;
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
.nut-input-container {
|
|
50
|
+
height: auto;
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
.nut-input-text {
|
|
49
54
|
font-size: $form-item-body-font-size;
|
|
50
55
|
text-align: $form-item-body-input-text-align;
|
|
@@ -61,7 +66,7 @@
|
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
.nut-textarea {
|
|
64
|
-
padding: 0
|
|
69
|
+
padding: 0;
|
|
65
70
|
|
|
66
71
|
.nut-textarea-textarea {
|
|
67
72
|
font: inherit;
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
}
|
|
78
83
|
}
|
|
79
84
|
}
|
|
85
|
+
|
|
80
86
|
[dir='rtl'] .nut-form-item,
|
|
81
87
|
.nut-rtl .nut-form-item {
|
|
82
88
|
&-label {
|
|
@@ -91,22 +97,96 @@
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
100
|
+
|
|
94
101
|
&-body {
|
|
95
102
|
&-slots {
|
|
96
103
|
text-align: right;
|
|
104
|
+
|
|
97
105
|
.nut-icon-ArrowRight,
|
|
98
106
|
.nut-icon-ArrowLeft {
|
|
99
107
|
transform: rotateY(180deg);
|
|
100
108
|
}
|
|
109
|
+
|
|
101
110
|
.nut-input-text {
|
|
102
111
|
text-align: right;
|
|
103
112
|
}
|
|
113
|
+
|
|
104
114
|
.nut-textarea-textarea {
|
|
105
115
|
text-align: right;
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
118
|
}
|
|
119
|
+
|
|
109
120
|
&-tips {
|
|
110
121
|
text-align: right;
|
|
111
122
|
}
|
|
112
123
|
}
|
|
124
|
+
|
|
125
|
+
/* position */
|
|
126
|
+
|
|
127
|
+
.nut-form-item-label-right {
|
|
128
|
+
justify-content: flex-end;
|
|
129
|
+
padding-right: 24px;
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.nut-form-item-label-left {
|
|
134
|
+
position: relative;
|
|
135
|
+
padding-left: 12px;
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nut-form-item-label-left-required {
|
|
140
|
+
display: block;
|
|
141
|
+
line-height: 1.5;
|
|
142
|
+
position: absolute;
|
|
143
|
+
left: 0.1em;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.nut-form-item-top {
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
align-items: flex-start;
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.nut-form-item-label-top {
|
|
153
|
+
display: block;
|
|
154
|
+
padding-bottom: 4px;
|
|
155
|
+
padding-right: 24px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.nut-form-item-body-top {
|
|
159
|
+
margin-left: 0;
|
|
160
|
+
width: 100%;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[dir='rtl'] .form-layout-right .nut-form-item-label,
|
|
164
|
+
.nut-rtl .form-layout-right .nut-form-item-label {
|
|
165
|
+
text-align: left;
|
|
166
|
+
padding-right: 0;
|
|
167
|
+
padding-left: 24px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
[dir='rtl'] .form-layout-left .nut-form-item-label,
|
|
171
|
+
.nut-rtl .form-layout-left .nut-form-item-label {
|
|
172
|
+
text-align: right;
|
|
173
|
+
padding-left: 0;
|
|
174
|
+
padding-right: 12px;
|
|
175
|
+
|
|
176
|
+
.required {
|
|
177
|
+
left: auto;
|
|
178
|
+
right: 0.1em;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
[dir='rtl'] .form-layout-top .nut-form-item-label,
|
|
183
|
+
.nut-rtl .form-layout-top .nut-form-item-label {
|
|
184
|
+
padding-right: 0;
|
|
185
|
+
padding-left: 24px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[dir='rtl'] .form-layout-top .nut-form-item-body,
|
|
189
|
+
.nut-rtl .form-layout-top .nut-form-item-body {
|
|
190
|
+
margin-left: 0;
|
|
191
|
+
margin-right: 0;
|
|
192
|
+
}
|
|
@@ -4,32 +4,38 @@
|
|
|
4
4
|
/* #endif */
|
|
5
5
|
.nut-form-item {
|
|
6
6
|
display: flex;
|
|
7
|
-
|
|
8
|
-
padding: 4px 12px;
|
|
7
|
+
line-height: unset;
|
|
9
8
|
}
|
|
10
|
-
.nut-form-item
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
9
|
+
.nut-form-item-disabled {
|
|
10
|
+
opacity: 0.4;
|
|
11
|
+
pointer-events: none;
|
|
14
12
|
}
|
|
15
13
|
.nut-form-item-label {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
16
|
font-size: var(--nutui-form-item-label-font-size, var(--nutui-font-size-base, 14px));
|
|
17
17
|
font-weight: normal;
|
|
18
18
|
width: var(--nutui-form-item-label-width, 90px);
|
|
19
19
|
margin-right: var(--nutui-form-item-label-margin-right, 10px);
|
|
20
|
-
flex:
|
|
21
|
-
display: inline-block !important;
|
|
20
|
+
flex: 0 0 auto;
|
|
22
21
|
word-wrap: break-word;
|
|
23
22
|
text-align: var(--nutui-form-item-label-text-align, left);
|
|
23
|
+
line-height: unset;
|
|
24
24
|
}
|
|
25
|
-
.nut-form-item-label
|
|
26
|
-
content: "*";
|
|
25
|
+
.nut-form-item-label-required {
|
|
27
26
|
color: var(--nutui-form-item-required-color, var(--nutui-color-primary, #ff0f23));
|
|
28
27
|
margin-right: var(--nutui-form-item-required-margin-right, 4px);
|
|
28
|
+
display: block;
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: -10px;
|
|
31
|
+
}
|
|
32
|
+
.nut-form-item .nut-form-item-labeltxt {
|
|
33
|
+
position: relative;
|
|
34
|
+
font-size: 12px;
|
|
29
35
|
}
|
|
30
36
|
.nut-form-item-body {
|
|
31
37
|
flex: 1;
|
|
32
|
-
display: flex
|
|
38
|
+
display: flex;
|
|
33
39
|
flex-direction: column;
|
|
34
40
|
}
|
|
35
41
|
.nut-form-item-body-slots {
|
|
@@ -39,6 +45,9 @@
|
|
|
39
45
|
padding: 0;
|
|
40
46
|
border: 0;
|
|
41
47
|
}
|
|
48
|
+
.nut-form-item-body-slots .nut-input-container {
|
|
49
|
+
height: auto;
|
|
50
|
+
}
|
|
42
51
|
.nut-form-item-body-slots .nut-input-text {
|
|
43
52
|
font-size: var(--nutui-form-item-body-font-size, var(--nutui-font-size-base, 14px));
|
|
44
53
|
text-align: var(--nutui-form-item-body-input-text-align, left);
|
|
@@ -53,7 +62,7 @@
|
|
|
53
62
|
min-height: 24px;
|
|
54
63
|
}
|
|
55
64
|
.nut-form-item-body-slots .nut-textarea {
|
|
56
|
-
padding: 0
|
|
65
|
+
padding: 0;
|
|
57
66
|
}
|
|
58
67
|
.nut-form-item-body-slots .nut-textarea .nut-textarea-textarea {
|
|
59
68
|
font: inherit;
|
|
@@ -97,4 +106,72 @@
|
|
|
97
106
|
[dir=rtl] .nut-form-item-tips,
|
|
98
107
|
.nut-rtl .nut-form-item-tips {
|
|
99
108
|
text-align: right;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* position */
|
|
112
|
+
.nut-form-item-label-right {
|
|
113
|
+
justify-content: flex-end;
|
|
114
|
+
padding-right: 24px;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.nut-form-item-label-left {
|
|
119
|
+
position: relative;
|
|
120
|
+
padding-left: 12px;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nut-form-item-label-left-required {
|
|
125
|
+
display: block;
|
|
126
|
+
line-height: 1.5;
|
|
127
|
+
position: absolute;
|
|
128
|
+
left: 0.1em;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.nut-form-item-top {
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
align-items: flex-start;
|
|
134
|
+
white-space: nowrap;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.nut-form-item-label-top {
|
|
138
|
+
display: block;
|
|
139
|
+
padding-bottom: 4px;
|
|
140
|
+
padding-right: 24px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.nut-form-item-body-top {
|
|
144
|
+
margin-left: 0;
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[dir=rtl] .form-layout-right .nut-form-item-label,
|
|
149
|
+
.nut-rtl .form-layout-right .nut-form-item-label {
|
|
150
|
+
text-align: left;
|
|
151
|
+
padding-right: 0;
|
|
152
|
+
padding-left: 24px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[dir=rtl] .form-layout-left .nut-form-item-label,
|
|
156
|
+
.nut-rtl .form-layout-left .nut-form-item-label {
|
|
157
|
+
text-align: right;
|
|
158
|
+
padding-left: 0;
|
|
159
|
+
padding-right: 12px;
|
|
160
|
+
}
|
|
161
|
+
[dir=rtl] .form-layout-left .nut-form-item-label .required,
|
|
162
|
+
.nut-rtl .form-layout-left .nut-form-item-label .required {
|
|
163
|
+
left: auto;
|
|
164
|
+
right: 0.1em;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[dir=rtl] .form-layout-top .nut-form-item-label,
|
|
168
|
+
.nut-rtl .form-layout-top .nut-form-item-label {
|
|
169
|
+
padding-right: 0;
|
|
170
|
+
padding-left: 24px;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[dir=rtl] .form-layout-top .nut-form-item-body,
|
|
174
|
+
.nut-rtl .form-layout-top .nut-form-item-body {
|
|
175
|
+
margin-left: 0;
|
|
176
|
+
margin-right: 0;
|
|
100
177
|
}
|
|
@@ -4,32 +4,38 @@
|
|
|
4
4
|
/* #endif */
|
|
5
5
|
.nut-form-item {
|
|
6
6
|
display: flex;
|
|
7
|
-
|
|
8
|
-
padding: 4px 12px;
|
|
7
|
+
line-height: unset;
|
|
9
8
|
}
|
|
10
|
-
.nut-form-item
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
transition: transform 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;
|
|
9
|
+
.nut-form-item-disabled {
|
|
10
|
+
opacity: 0.4;
|
|
11
|
+
pointer-events: none;
|
|
14
12
|
}
|
|
15
13
|
.nut-form-item-label {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
16
|
font-size: 14px;
|
|
17
17
|
font-weight: normal;
|
|
18
18
|
width: 90px;
|
|
19
19
|
margin-right: 10px;
|
|
20
|
-
flex:
|
|
21
|
-
display: inline-block !important;
|
|
20
|
+
flex: 0 0 auto;
|
|
22
21
|
word-wrap: break-word;
|
|
23
22
|
text-align: left;
|
|
23
|
+
line-height: unset;
|
|
24
24
|
}
|
|
25
|
-
.nut-form-item-label
|
|
26
|
-
content: "*";
|
|
25
|
+
.nut-form-item-label-required {
|
|
27
26
|
color: #ff0f23;
|
|
28
27
|
margin-right: 4px;
|
|
28
|
+
display: block;
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: -10px;
|
|
31
|
+
}
|
|
32
|
+
.nut-form-item .nut-form-item-labeltxt {
|
|
33
|
+
position: relative;
|
|
34
|
+
font-size: 12px;
|
|
29
35
|
}
|
|
30
36
|
.nut-form-item-body {
|
|
31
37
|
flex: 1;
|
|
32
|
-
display: flex
|
|
38
|
+
display: flex;
|
|
33
39
|
flex-direction: column;
|
|
34
40
|
}
|
|
35
41
|
.nut-form-item-body-slots {
|
|
@@ -39,6 +45,9 @@
|
|
|
39
45
|
padding: 0;
|
|
40
46
|
border: 0;
|
|
41
47
|
}
|
|
48
|
+
.nut-form-item-body-slots .nut-input-container {
|
|
49
|
+
height: auto;
|
|
50
|
+
}
|
|
42
51
|
.nut-form-item-body-slots .nut-input-text {
|
|
43
52
|
font-size: 14px;
|
|
44
53
|
text-align: left;
|
|
@@ -53,7 +62,7 @@
|
|
|
53
62
|
min-height: 24px;
|
|
54
63
|
}
|
|
55
64
|
.nut-form-item-body-slots .nut-textarea {
|
|
56
|
-
padding: 0
|
|
65
|
+
padding: 0;
|
|
57
66
|
}
|
|
58
67
|
.nut-form-item-body-slots .nut-textarea .nut-textarea-textarea {
|
|
59
68
|
font: inherit;
|
|
@@ -105,4 +114,72 @@
|
|
|
105
114
|
[dir=rtl] .nut-form-item-tips,
|
|
106
115
|
.nut-rtl .nut-form-item-tips {
|
|
107
116
|
text-align: right;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* position */
|
|
120
|
+
.nut-form-item-label-right {
|
|
121
|
+
justify-content: flex-end;
|
|
122
|
+
padding-right: 24px;
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nut-form-item-label-left {
|
|
127
|
+
position: relative;
|
|
128
|
+
padding-left: 12px;
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.nut-form-item-label-left-required {
|
|
133
|
+
display: block;
|
|
134
|
+
line-height: 1.5;
|
|
135
|
+
position: absolute;
|
|
136
|
+
left: 0.1em;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nut-form-item-top {
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
align-items: flex-start;
|
|
142
|
+
white-space: nowrap;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.nut-form-item-label-top {
|
|
146
|
+
display: block;
|
|
147
|
+
padding-bottom: 4px;
|
|
148
|
+
padding-right: 24px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.nut-form-item-body-top {
|
|
152
|
+
margin-left: 0;
|
|
153
|
+
width: 100%;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
[dir=rtl] .form-layout-right .nut-form-item-label,
|
|
157
|
+
.nut-rtl .form-layout-right .nut-form-item-label {
|
|
158
|
+
text-align: left;
|
|
159
|
+
padding-right: 0;
|
|
160
|
+
padding-left: 24px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[dir=rtl] .form-layout-left .nut-form-item-label,
|
|
164
|
+
.nut-rtl .form-layout-left .nut-form-item-label {
|
|
165
|
+
text-align: right;
|
|
166
|
+
padding-left: 0;
|
|
167
|
+
padding-right: 12px;
|
|
168
|
+
}
|
|
169
|
+
[dir=rtl] .form-layout-left .nut-form-item-label .required,
|
|
170
|
+
.nut-rtl .form-layout-left .nut-form-item-label .required {
|
|
171
|
+
left: auto;
|
|
172
|
+
right: 0.1em;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
[dir=rtl] .form-layout-top .nut-form-item-label,
|
|
176
|
+
.nut-rtl .form-layout-top .nut-form-item-label {
|
|
177
|
+
padding-right: 0;
|
|
178
|
+
padding-left: 24px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
[dir=rtl] .form-layout-top .nut-form-item-body,
|
|
182
|
+
.nut-rtl .form-layout-top .nut-form-item-body {
|
|
183
|
+
margin-left: 0;
|
|
184
|
+
margin-right: 0;
|
|
108
185
|
}
|
|
@@ -154,7 +154,9 @@ export var Input = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
154
154
|
name: name,
|
|
155
155
|
className: "nut-input-native",
|
|
156
156
|
ref: inputRef,
|
|
157
|
-
style:
|
|
157
|
+
style: {
|
|
158
|
+
textAlign: getTextAlign()
|
|
159
|
+
},
|
|
158
160
|
type: inputType(type),
|
|
159
161
|
password: type === 'password',
|
|
160
162
|
maxlength: maxLength,
|