@nutui/nutui-react 3.0.1 → 3.0.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/hooks/use-client-rect.js +1 -0
  3. package/dist/cjs/packages/datepicker/style/style.css +70 -0
  4. package/dist/cjs/packages/datepickerview/style/index.js +1 -0
  5. package/dist/cjs/packages/datepickerview/style/style.css +70 -0
  6. package/dist/cjs/packages/fixednav/fixednav.js +20 -14
  7. package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
  8. package/dist/cjs/packages/fixednav/style/index.js +1 -0
  9. package/dist/cjs/packages/fixednav/style/style.css +97 -14
  10. package/dist/cjs/packages/form/__tests__/merge.spec.d.ts +1 -0
  11. package/dist/cjs/packages/form/__tests__/merge.spec.js +545 -0
  12. package/dist/cjs/packages/form/form.d.ts +2 -0
  13. package/dist/cjs/packages/form/form.js +9 -2
  14. package/dist/cjs/packages/form/index.d.ts +2 -1
  15. package/dist/cjs/packages/form/index.js +1 -0
  16. package/dist/cjs/packages/form/style/form.scss +0 -66
  17. package/dist/cjs/packages/form/style/style.css +31 -21
  18. package/dist/cjs/packages/form/types.d.ts +2 -1
  19. package/dist/cjs/packages/form/useform.d.ts +2 -1
  20. package/dist/cjs/packages/form/useform.js +342 -278
  21. package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
  22. package/dist/cjs/packages/formitem/formitem.js +55 -44
  23. package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
  24. package/dist/cjs/packages/formitem/style/style.css +89 -12
  25. package/dist/cjs/packages/picker/style/index.js +1 -0
  26. package/dist/cjs/packages/picker/style/style.css +70 -0
  27. package/dist/cjs/packages/swipe/style/style.css +3 -3
  28. package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
  29. package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
  30. package/dist/cjs/utils/get-rect-by-taro.js +4 -1
  31. package/dist/cjs/utils/get-system-info.js +4 -5
  32. package/dist/cjs/utils/merge.d.ts +14 -0
  33. package/dist/cjs/utils/merge.js +98 -0
  34. package/dist/cjs/utils/platform-taro.js +4 -5
  35. package/dist/cjs/utils/to-array.d.ts +1 -0
  36. package/dist/cjs/utils/to-array.js +18 -0
  37. package/dist/es/hooks/use-client-rect.js +1 -0
  38. package/dist/es/packages/datepicker/style/style.css +70 -0
  39. package/dist/es/packages/datepickerview/style/index.js +1 -0
  40. package/dist/es/packages/datepickerview/style/style.css +70 -0
  41. package/dist/es/packages/fixednav/fixednav.js +20 -14
  42. package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
  43. package/dist/es/packages/fixednav/style/index.js +1 -0
  44. package/dist/es/packages/fixednav/style/style.css +97 -14
  45. package/dist/es/packages/form/__tests__/merge.spec.d.ts +1 -0
  46. package/dist/es/packages/form/__tests__/merge.spec.js +541 -0
  47. package/dist/es/packages/form/form.d.ts +10 -0
  48. package/dist/es/packages/form/form.js +9 -2
  49. package/dist/es/packages/form/index.d.ts +2 -1
  50. package/dist/es/packages/form/index.js +2 -1
  51. package/dist/es/packages/form/style/form.scss +0 -66
  52. package/dist/es/packages/form/style/style.css +31 -21
  53. package/dist/es/packages/form/types.d.ts +2 -1
  54. package/dist/es/packages/form/useform.d.ts +2 -1
  55. package/dist/es/packages/form/useform.js +340 -279
  56. package/dist/es/packages/formitem/formitem.d.ts +1 -0
  57. package/dist/es/packages/formitem/formitem.js +55 -44
  58. package/dist/es/packages/formitem/style/formitem.scss +101 -21
  59. package/dist/es/packages/formitem/style/style.css +89 -12
  60. package/dist/es/packages/picker/style/index.js +1 -0
  61. package/dist/es/packages/picker/style/style.css +70 -0
  62. package/dist/es/packages/swipe/style/style.css +3 -3
  63. package/dist/es/packages/swipe/style/swipe.scss +7 -3
  64. package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
  65. package/dist/es/utils/get-rect-by-taro.js +4 -1
  66. package/dist/es/utils/get-system-info.js +4 -4
  67. package/dist/es/utils/merge.d.ts +14 -0
  68. package/dist/es/utils/merge.js +68 -0
  69. package/dist/es/utils/platform-taro.js +4 -4
  70. package/dist/es/utils/to-array.d.ts +1 -0
  71. package/dist/es/utils/to-array.js +8 -0
  72. package/dist/nutui.react.umd.js +555 -422
  73. package/dist/style.css +1 -1
  74. package/dist/style.scss +41 -41
  75. package/package.json +1 -1
@@ -32,6 +32,7 @@ export declare class FormItem extends React.Component<Partial<FormItemProps>, {
32
32
  getControlled: (children: React.ReactElement) => any;
33
33
  refresh: () => void;
34
34
  onStoreChange: (type?: string) => void;
35
+ getClassNameWithDirection(className: string): string;
35
36
  renderLayout: (childNode: React.ReactNode) => React.JSX.Element;
36
37
  render(): React.JSX.Element;
37
38
  }
@@ -23,6 +23,7 @@ var _context = require("../form/context");
23
23
  var _cell = /*#__PURE__*/ _interop_require_default._(require("../cell"));
24
24
  var _typings = require("../../utils/typings");
25
25
  var _isforwardrefcomponent = require("../../utils/is-forward-ref-component");
26
+ var _toarray = require("../../utils/to-array");
26
27
  var _useform = require("../form/useform");
27
28
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
28
29
  required: false,
@@ -35,7 +36,6 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
35
36
  }
36
37
  ],
37
38
  errorMessageAlign: 'left',
38
- validateTrigger: 'onChange',
39
39
  shouldUpdate: false,
40
40
  noStyle: false
41
41
  });
@@ -50,15 +50,19 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
50
50
  props
51
51
  ]), (0, _define_property._)(_this, "cancelRegister", void 0), (0, _define_property._)(_this, "componentRef", void 0), (0, _define_property._)(_this, "eventOff", void 0), (0, _define_property._)(_this, "getControlled", function(children) {
52
52
  var _children_props;
53
- var _this_context = _this.context, setFieldsValue = _this_context.setFieldsValue, getFieldValue = _this_context.getFieldValue;
54
- var dispatch = _this.context.getInternal(_useform.SECRET).dispatch;
53
+ var _this_context_formInstance = _this.context.formInstance, setFieldsValue = _this_context_formInstance.setFieldsValue, getFieldValue = _this_context_formInstance.getFieldValue;
54
+ var dispatch = _this.context.formInstance.getInternal(_useform.SECRET).dispatch;
55
55
  var _this_props = _this.props, _this_props_name = _this_props.name, name = _this_props_name === void 0 ? '' : _this_props_name;
56
56
  if (children === null || children === void 0 ? void 0 : (_children_props = children.props) === null || _children_props === void 0 ? void 0 : _children_props.defaultValue) {
57
- console.warn('通过 initialValue 设置初始值');
57
+ if (process.env.NODE_ENV !== 'production') {
58
+ console.warn('[NutUI] FormItem:', '请通过 initialValue 设置初始值,而不是 defaultValue');
59
+ }
58
60
  }
59
61
  var fieldValue = getFieldValue(name);
60
62
  var _obj;
61
- var controlled = (0, _object_spread_props._)((0, _object_spread._)({}, children.props), (_obj = {}, (0, _define_property._)(_obj, _this.props.valuePropName || 'value', fieldValue !== undefined ? fieldValue : _this.props.initialValue), (0, _define_property._)(_obj, _this.props.trigger || 'onChange', function() {
63
+ var controlled = (0, _object_spread_props._)((0, _object_spread._)({}, children.props), (_obj = {
64
+ className: children.props.className
65
+ }, (0, _define_property._)(_obj, _this.props.valuePropName || 'value', fieldValue !== undefined ? fieldValue : _this.props.initialValue), (0, _define_property._)(_obj, _this.props.trigger || 'onChange', function() {
62
66
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
63
67
  args[_key] = arguments[_key];
64
68
  }
@@ -72,33 +76,27 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
72
76
  var _this_props;
73
77
  next = (_this_props = _this.props).getValueFromEvent.apply(_this_props, (0, _to_consumable_array._)(args));
74
78
  }
75
- setFieldsValue((0, _define_property._)({}, name, next), false);
79
+ setFieldsValue((0, _define_property._)({}, name, next));
76
80
  }), _obj));
77
81
  var validateTrigger = _this.props.validateTrigger;
78
- var validateTriggers = [
79
- _this.props.trigger || 'onChange'
80
- ];
81
- if (validateTrigger) {
82
- validateTriggers = typeof validateTrigger === 'string' ? [
83
- validateTrigger
84
- ] : (0, _to_consumable_array._)(validateTrigger);
85
- validateTriggers.forEach(function(trigger) {
86
- var originTrigger = controlled[trigger];
87
- controlled[trigger] = function() {
88
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
89
- args[_key] = arguments[_key];
90
- }
91
- if (originTrigger) {
92
- originTrigger.apply(void 0, (0, _to_consumable_array._)(args));
93
- }
94
- if (_this.props.rules && _this.props.rules.length) {
95
- dispatch({
96
- name: _this.props.name
97
- });
98
- }
99
- };
100
- });
101
- }
82
+ var mergedValidateTrigger = validateTrigger || _this.context.validateTrigger;
83
+ var validateTriggers = (0, _toarray.toArray)(mergedValidateTrigger);
84
+ validateTriggers.forEach(function(trigger) {
85
+ var originTrigger = controlled[trigger];
86
+ controlled[trigger] = function() {
87
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
88
+ args[_key] = arguments[_key];
89
+ }
90
+ if (originTrigger) {
91
+ originTrigger.apply(void 0, (0, _to_consumable_array._)(args));
92
+ }
93
+ if (_this.props.rules && _this.props.rules.length) {
94
+ dispatch({
95
+ name: _this.props.name
96
+ });
97
+ }
98
+ };
99
+ });
102
100
  if ((0, _isforwardrefcomponent.isForwardRefComponent)(children)) {
103
101
  controlled.ref = function(componentInstance) {
104
102
  var originRef = children.ref;
@@ -123,7 +121,7 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
123
121
  });
124
122
  }), (0, _define_property._)(_this, "onStoreChange", function(type) {
125
123
  if (type === 'reset') {
126
- _this.context.errors[_this.props.name] = [];
124
+ _this.context.formInstance.errors[_this.props.name] = [];
127
125
  _this.refresh();
128
126
  } else {
129
127
  _this.forceUpdate();
@@ -133,23 +131,25 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
133
131
  var requiredInRules = rules === null || rules === void 0 ? void 0 : rules.some(function(rule) {
134
132
  return rule.required;
135
133
  });
136
- var item = name ? _this.context.errors[name] : [];
137
- var starPosition = _this.context.starPosition;
138
- var renderStar = (required || requiredInRules) && /*#__PURE__*/ _react.default.createElement("i", {
139
- className: "required"
140
- });
141
- var renderLabel = /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, starPosition === 'left' ? renderStar : null, label, starPosition === 'right' ? renderStar : null);
134
+ var item = name ? _this.context.formInstance.errors[name] : [];
135
+ var starPosition = _this.context.formInstance.starPosition;
136
+ var renderStar = (required || requiredInRules) && /*#__PURE__*/ _react.default.createElement("div", {
137
+ className: "nut-form-item-label-required required"
138
+ }, "*");
139
+ var renderLabel = /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement("span", {
140
+ className: "nut-form-item-labeltxt"
141
+ }, starPosition === 'left' ? renderStar : null, label), starPosition === 'right' ? renderStar : null);
142
142
  return /*#__PURE__*/ _react.default.createElement(_cell.default, {
143
- className: "nut-form-item ".concat(className),
143
+ className: "".concat(_this.getClassNameWithDirection('nut-form-item'), " ").concat(className),
144
144
  style: style,
145
145
  align: align,
146
146
  onClick: function onClick(e) {
147
147
  return _this.props.onClick && _this.props.onClick(e, _this.componentRef);
148
148
  }
149
149
  }, label ? /*#__PURE__*/ _react.default.createElement("div", {
150
- className: "nut-cell-title nut-form-item-label"
150
+ className: "nut-cell-title ".concat(_this.getClassNameWithDirection('nut-form-item-label'))
151
151
  }, renderLabel) : null, /*#__PURE__*/ _react.default.createElement("div", {
152
- className: "nut-cell-value nut-form-item-body"
152
+ className: "nut-cell-value ".concat(_this.getClassNameWithDirection('nut-form-item-body'))
153
153
  }, /*#__PURE__*/ _react.default.createElement("div", {
154
154
  className: "nut-form-item-body-slots"
155
155
  }, childNode), item && item.length > 0 && /*#__PURE__*/ _react.default.createElement("div", {
@@ -170,12 +170,12 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
170
170
  key: "componentDidMount",
171
171
  value: function componentDidMount() {
172
172
  // Form设置initialValues时的处理
173
- var _this_context_getInternal = this.context.getInternal(_useform.SECRET), _this_context_getInternal_store = _this_context_getInternal.store, store = _this_context_getInternal_store === void 0 ? {} : _this_context_getInternal_store, setInitialValues = _this_context_getInternal.setInitialValues;
173
+ var _this_context_formInstance_getInternal = this.context.formInstance.getInternal(_useform.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;
174
174
  if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
175
175
  setInitialValues((0, _object_spread_props._)((0, _object_spread._)({}, store), (0, _define_property._)({}, this.props.name, this.props.initialValue)), true);
176
176
  }
177
177
  // 注册组件实例到FormStore
178
- var _this_context_getInternal1 = this.context.getInternal(_useform.SECRET), registerField = _this_context_getInternal1.registerField, registerUpdate = _this_context_getInternal1.registerUpdate;
178
+ var _this_context_formInstance_getInternal1 = this.context.formInstance.getInternal(_useform.SECRET), registerField = _this_context_formInstance_getInternal1.registerField, registerUpdate = _this_context_formInstance_getInternal1.registerUpdate;
179
179
  this.cancelRegister = registerField(this);
180
180
  // 这里需要增加事件监听,因为此实现属于依赖触发
181
181
  this.eventOff = registerUpdate(this, this.props.shouldUpdate);
@@ -192,6 +192,15 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
192
192
  }
193
193
  }
194
194
  },
195
+ {
196
+ key: "getClassNameWithDirection",
197
+ value: function getClassNameWithDirection(className) {
198
+ if (className && this.context.labelPosition) {
199
+ return "".concat(className, " ").concat(className, "-").concat(this.context.labelPosition);
200
+ }
201
+ return className;
202
+ }
203
+ },
195
204
  {
196
205
  key: "render",
197
206
  value: function render() {
@@ -201,11 +210,13 @@ var FormItem = /*#__PURE__*/ function(_superClass) {
201
210
  if (!this.props.shouldUpdate) {
202
211
  returnChildNode = /*#__PURE__*/ _react.default.cloneElement(child, this.getControlled(child));
203
212
  } else {
204
- returnChildNode = child(this.context);
213
+ returnChildNode = child(this.context.formInstance);
205
214
  }
206
215
  return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, {
207
216
  key: this.state.resetCount
208
- }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
217
+ }, /*#__PURE__*/ _react.default.createElement("div", {
218
+ className: this.context.disabled ? 'nut-form-item-disabled' : ''
219
+ }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
209
220
  }
210
221
  }
211
222
  ]);
@@ -1,40 +1,41 @@
1
1
  .nut-form-item {
2
2
  display: flex;
3
- align-items: center;
4
- padding: 4px 12px;
3
+ line-height: unset;
5
4
 
6
- &.error {
7
- &.line {
8
- &::before {
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: none !important;
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
- .required {
27
- &::before {
28
- content: '*';
29
- color: $form-item-required-color;
30
- margin-right: $form-item-required-margin-right;
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 !important;
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 !important;
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
- align-items: center;
8
- padding: 4px 12px;
7
+ line-height: unset;
9
8
  }
10
- .nut-form-item.error.line::before {
11
- border-bottom: 1px solid var(--nutui-form-item-error-line-color, var(--nutui-color-primary, #ff0f23));
12
- transform: scaleX(1);
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: none !important;
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 .required::before {
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 !important;
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 !important;
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
  }
@@ -1,2 +1,3 @@
1
1
  import '../../popup/style';
2
+ import '../../pickerview/style';
2
3
  import './picker.scss';
@@ -383,6 +383,76 @@
383
383
  right: 0;
384
384
  }
385
385
 
386
+ .nut-pickerview {
387
+ --nutui-picker-item-height: 36px;
388
+ position: relative;
389
+ display: flex;
390
+ width: 100%;
391
+ height: calc(var(--nutui-picker-item-height, 36px) * 7);
392
+ overflow: hidden;
393
+ }
394
+ .nut-pickerview-mask, .nut-pickerview-indicator {
395
+ position: absolute;
396
+ left: 0;
397
+ right: 0;
398
+ z-index: 3;
399
+ pointer-events: none;
400
+ }
401
+ .nut-pickerview-mask {
402
+ top: 0;
403
+ bottom: 0;
404
+ background-image: var(--picker-mask-background, linear-gradient(180deg, var(--nutui-white-12), var(--nutui-white-7)), linear-gradient(0deg, var(--nutui-white-12), var(--nutui-white-7)));
405
+ background-position: top, bottom;
406
+ background-size: 100% calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
407
+ background-repeat: no-repeat;
408
+ transform: translateZ(0);
409
+ }
410
+ .nut-pickerview-indicator {
411
+ top: calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
412
+ height: var(--nutui-picker-item-height, 36px);
413
+ border: var(--nutui-picker-item-active-line-border, 1px solid var(--nutui-color-border, rgba(0, 0, 0, 0.06)));
414
+ border-left: 0;
415
+ border-right: 0;
416
+ box-sizing: border-box;
417
+ }
418
+ .nut-pickerview-list {
419
+ position: relative;
420
+ flex: 1;
421
+ height: calc(var(--nutui-picker-item-height, 36px) * 7);
422
+ overflow: hidden;
423
+ touch-action: none;
424
+ }
425
+ .nut-pickerview-roller {
426
+ position: absolute;
427
+ top: calc((var(--nutui-picker-item-height, 36px) * 7 - var(--nutui-picker-item-height, 36px)) / 2);
428
+ width: 100%;
429
+ height: var(--nutui-picker-item-height, 36px);
430
+ z-index: 1;
431
+ transform-style: preserve-3d;
432
+ }
433
+ .nut-pickerview-roller-item {
434
+ position: absolute;
435
+ top: 0;
436
+ backface-visibility: hidden;
437
+ -moz-backface-visibility: hidden;
438
+ -webkit-backface-visibility: hidden;
439
+ }
440
+ .nut-pickerview-roller-item-hidden {
441
+ visibility: hidden;
442
+ opacity: 0;
443
+ }
444
+ .nut-pickerview-roller-item, .nut-pickerview-roller-item-tiled {
445
+ width: 100%;
446
+ height: var(--nutui-picker-item-height, 36px);
447
+ line-height: var(--nutui-picker-item-height, 36px);
448
+ color: var(--nutui-picker-item-text-color, var(--nutui-color-title, #1a1a1a));
449
+ font-size: var(--nutui-picker-item-text-font-size, var(--nutui-font-size-base, 14px));
450
+ text-align: center;
451
+ overflow: hidden;
452
+ text-overflow: ellipsis;
453
+ white-space: nowrap;
454
+ }
455
+
386
456
  .nut-picker {
387
457
  background-color: var(--nutui-color-background-overlay, #ffffff);
388
458
  width: 100%;
@@ -22,12 +22,12 @@
22
22
  .nut-swipe-left, .nut-swipe-right {
23
23
  position: absolute;
24
24
  top: 0;
25
- display: flex;
26
- flex-direction: row;
27
25
  }
28
26
  .nut-swipe-left {
29
27
  left: 0;
28
+ transform: translate(-100%, 0px);
30
29
  }
31
30
  .nut-swipe-right {
32
- left: 100%;
31
+ right: 0px;
32
+ transform: translate(100%, 0px);
33
33
  }
@@ -20,15 +20,19 @@
20
20
  &-right {
21
21
  position: absolute;
22
22
  top: 0;
23
- display: flex;
24
- flex-direction: row;
23
+ //display: flex;
24
+ //flex-direction: row;
25
+ //flex-shrink: 0;
25
26
  }
26
27
 
27
28
  &-left {
28
29
  left: 0;
30
+ transform: translate(-100%, 0px);
29
31
  }
30
32
 
31
33
  &-right {
32
- left: 100%;
34
+ //left: 100%;
35
+ right: 0px;
36
+ transform: translate(100%, 0px);
33
37
  }
34
38
  }
@@ -9,4 +9,4 @@ export interface Rect {
9
9
  height: number;
10
10
  }
11
11
  export declare function makeRect(width: number, height: number): Rect;
12
- export declare const getRectByTaro: (element: any) => Promise<Rect>;
12
+ export declare const getRectByTaro: (element: any, harmonyId?: string) => Promise<Rect>;
@@ -33,7 +33,10 @@ function makeRect(width, height) {
33
33
  }
34
34
  var getRectByTaro = /*#__PURE__*/ function() {
35
35
  var _ref = (0, _async_to_generator._)(function(element) {
36
+ var harmonyId;
37
+ var _arguments = arguments;
36
38
  return (0, _ts_generator._)(this, function(_state) {
39
+ harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
37
40
  if (element) {
38
41
  if (_useclientrect.inBrowser) {
39
42
  return [
@@ -45,7 +48,7 @@ var getRectByTaro = /*#__PURE__*/ function() {
45
48
  return [
46
49
  2,
47
50
  new Promise(function(resolve, reject) {
48
- (0, _taro.createSelectorQuery)().select("#".concat(element.uid)).boundingClientRect().exec(function(param) {
51
+ (0, _taro.createSelectorQuery)().select("#".concat(harmonyId || element.uid)).boundingClientRect().exec(function(param) {
49
52
  var _param = (0, _sliced_to_array._)(param, 1), rects = _param[0];
50
53
  resolve(rects);
51
54
  });