@nutui/nutui-react 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.
Files changed (72) hide show
  1. package/dist/cjs/hooks/use-client-rect.js +1 -0
  2. package/dist/cjs/packages/datepicker/style/style.css +70 -0
  3. package/dist/cjs/packages/datepickerview/style/index.js +1 -0
  4. package/dist/cjs/packages/datepickerview/style/style.css +70 -0
  5. package/dist/cjs/packages/fixednav/fixednav.js +20 -14
  6. package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
  7. package/dist/cjs/packages/fixednav/style/style.css +0 -14
  8. package/dist/cjs/packages/form/__tests__/merge.spec.d.ts +1 -0
  9. package/dist/cjs/packages/form/__tests__/merge.spec.js +545 -0
  10. package/dist/cjs/packages/form/form.d.ts +2 -0
  11. package/dist/cjs/packages/form/form.js +9 -2
  12. package/dist/cjs/packages/form/index.d.ts +2 -1
  13. package/dist/cjs/packages/form/index.js +1 -0
  14. package/dist/cjs/packages/form/style/form.scss +0 -66
  15. package/dist/cjs/packages/form/style/style.css +31 -21
  16. package/dist/cjs/packages/form/types.d.ts +2 -1
  17. package/dist/cjs/packages/form/useform.d.ts +2 -1
  18. package/dist/cjs/packages/form/useform.js +342 -278
  19. package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
  20. package/dist/cjs/packages/formitem/formitem.js +55 -44
  21. package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
  22. package/dist/cjs/packages/formitem/style/style.css +89 -12
  23. package/dist/cjs/packages/picker/style/index.js +1 -0
  24. package/dist/cjs/packages/picker/style/style.css +70 -0
  25. package/dist/cjs/packages/swipe/style/style.css +3 -3
  26. package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
  27. package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
  28. package/dist/cjs/utils/get-rect-by-taro.js +4 -1
  29. package/dist/cjs/utils/get-system-info.js +4 -5
  30. package/dist/cjs/utils/merge.d.ts +14 -0
  31. package/dist/cjs/utils/merge.js +98 -0
  32. package/dist/cjs/utils/platform-taro.js +4 -5
  33. package/dist/cjs/utils/to-array.d.ts +1 -0
  34. package/dist/cjs/utils/to-array.js +18 -0
  35. package/dist/es/hooks/use-client-rect.js +1 -0
  36. package/dist/es/packages/datepicker/style/style.css +70 -0
  37. package/dist/es/packages/datepickerview/style/index.js +1 -0
  38. package/dist/es/packages/datepickerview/style/style.css +70 -0
  39. package/dist/es/packages/fixednav/fixednav.js +20 -14
  40. package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
  41. package/dist/es/packages/fixednav/style/style.css +0 -14
  42. package/dist/es/packages/form/__tests__/merge.spec.d.ts +1 -0
  43. package/dist/es/packages/form/__tests__/merge.spec.js +541 -0
  44. package/dist/es/packages/form/form.d.ts +10 -0
  45. package/dist/es/packages/form/form.js +9 -2
  46. package/dist/es/packages/form/index.d.ts +2 -1
  47. package/dist/es/packages/form/index.js +2 -1
  48. package/dist/es/packages/form/style/form.scss +0 -66
  49. package/dist/es/packages/form/style/style.css +31 -21
  50. package/dist/es/packages/form/types.d.ts +2 -1
  51. package/dist/es/packages/form/useform.d.ts +2 -1
  52. package/dist/es/packages/form/useform.js +340 -279
  53. package/dist/es/packages/formitem/formitem.d.ts +1 -0
  54. package/dist/es/packages/formitem/formitem.js +55 -44
  55. package/dist/es/packages/formitem/style/formitem.scss +101 -21
  56. package/dist/es/packages/formitem/style/style.css +89 -12
  57. package/dist/es/packages/picker/style/index.js +1 -0
  58. package/dist/es/packages/picker/style/style.css +70 -0
  59. package/dist/es/packages/swipe/style/style.css +3 -3
  60. package/dist/es/packages/swipe/style/swipe.scss +7 -3
  61. package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
  62. package/dist/es/utils/get-rect-by-taro.js +4 -1
  63. package/dist/es/utils/get-system-info.js +4 -4
  64. package/dist/es/utils/merge.d.ts +14 -0
  65. package/dist/es/utils/merge.js +68 -0
  66. package/dist/es/utils/platform-taro.js +4 -4
  67. package/dist/es/utils/to-array.d.ts +1 -0
  68. package/dist/es/utils/to-array.js +8 -0
  69. package/dist/nutui.react.umd.js +555 -422
  70. package/dist/style.css +1 -1
  71. package/dist/style.scss +41 -41
  72. package/package.json +1 -1
@@ -76,6 +76,7 @@ export declare class FormItem extends React.Component<Partial<FormItemProps>, {
76
76
  getControlled: (children: React.ReactElement) => any;
77
77
  refresh: () => void;
78
78
  onStoreChange: (type?: string) => void;
79
+ getClassNameWithDirection(className: string): string;
79
80
  renderLayout: (childNode: React.ReactNode) => React.JSX.Element;
80
81
  render(): React.JSX.Element;
81
82
  }
@@ -12,6 +12,7 @@ import { Context } from "../form/context";
12
12
  import Cell from "../cell";
13
13
  import { ComponentDefaults } from "../../utils/typings";
14
14
  import { isForwardRefComponent } from "../../utils/is-forward-ref-component";
15
+ import { toArray } from "../../utils/to-array";
15
16
  import { SECRET } from "../form/useform";
16
17
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
17
18
  required: false,
@@ -24,7 +25,6 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
24
25
  }
25
26
  ],
26
27
  errorMessageAlign: 'left',
27
- validateTrigger: 'onChange',
28
28
  shouldUpdate: false,
29
29
  noStyle: false
30
30
  });
@@ -40,15 +40,19 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
40
40
  ]), _define_property(_this, "cancelRegister", void 0), _define_property(_this, "componentRef", void 0), _define_property(_this, "eventOff", void 0), // children添加value属性和onChange事件
41
41
  _define_property(_this, "getControlled", function(children) {
42
42
  var _children_props;
43
- var _this_context = _this.context, setFieldsValue = _this_context.setFieldsValue, getFieldValue = _this_context.getFieldValue;
44
- var dispatch = _this.context.getInternal(SECRET).dispatch;
43
+ var _this_context_formInstance = _this.context.formInstance, setFieldsValue = _this_context_formInstance.setFieldsValue, getFieldValue = _this_context_formInstance.getFieldValue;
44
+ var dispatch = _this.context.formInstance.getInternal(SECRET).dispatch;
45
45
  var _this_props = _this.props, _this_props_name = _this_props.name, name = _this_props_name === void 0 ? '' : _this_props_name;
46
46
  if (children === null || children === void 0 ? void 0 : (_children_props = children.props) === null || _children_props === void 0 ? void 0 : _children_props.defaultValue) {
47
- console.warn('通过 initialValue 设置初始值');
47
+ if (process.env.NODE_ENV !== 'production') {
48
+ console.warn('[NutUI] FormItem:', '请通过 initialValue 设置初始值,而不是 defaultValue');
49
+ }
48
50
  }
49
51
  var fieldValue = getFieldValue(name);
50
52
  var _obj;
51
- var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {}, _define_property(_obj, _this.props.valuePropName || 'value', fieldValue !== undefined ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || 'onChange', function() {
53
+ var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
54
+ className: children.props.className
55
+ }, _define_property(_obj, _this.props.valuePropName || 'value', fieldValue !== undefined ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || 'onChange', function() {
52
56
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
53
57
  args[_key] = arguments[_key];
54
58
  }
@@ -62,33 +66,27 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
62
66
  var _this_props;
63
67
  next = (_this_props = _this.props).getValueFromEvent.apply(_this_props, _to_consumable_array(args));
64
68
  }
65
- setFieldsValue(_define_property({}, name, next), false);
69
+ setFieldsValue(_define_property({}, name, next));
66
70
  }), _obj));
67
71
  var validateTrigger = _this.props.validateTrigger;
68
- var validateTriggers = [
69
- _this.props.trigger || 'onChange'
70
- ];
71
- if (validateTrigger) {
72
- validateTriggers = typeof validateTrigger === 'string' ? [
73
- validateTrigger
74
- ] : _to_consumable_array(validateTrigger);
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
- });
91
- }
72
+ var mergedValidateTrigger = validateTrigger || _this.context.validateTrigger;
73
+ var validateTriggers = toArray(mergedValidateTrigger);
74
+ validateTriggers.forEach(function(trigger) {
75
+ var originTrigger = controlled[trigger];
76
+ controlled[trigger] = function() {
77
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
78
+ args[_key] = arguments[_key];
79
+ }
80
+ if (originTrigger) {
81
+ originTrigger.apply(void 0, _to_consumable_array(args));
82
+ }
83
+ if (_this.props.rules && _this.props.rules.length) {
84
+ dispatch({
85
+ name: _this.props.name
86
+ });
87
+ }
88
+ };
89
+ });
92
90
  if (isForwardRefComponent(children)) {
93
91
  controlled.ref = function(componentInstance) {
94
92
  var originRef = children.ref;
@@ -113,7 +111,7 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
113
111
  });
114
112
  }), _define_property(_this, "onStoreChange", function(type) {
115
113
  if (type === 'reset') {
116
- _this.context.errors[_this.props.name] = [];
114
+ _this.context.formInstance.errors[_this.props.name] = [];
117
115
  _this.refresh();
118
116
  } else {
119
117
  _this.forceUpdate();
@@ -123,23 +121,25 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
123
121
  var requiredInRules = rules === null || rules === void 0 ? void 0 : rules.some(function(rule) {
124
122
  return rule.required;
125
123
  });
126
- var item = name ? _this.context.errors[name] : [];
127
- var starPosition = _this.context.starPosition;
128
- var renderStar = (required || requiredInRules) && /*#__PURE__*/ React.createElement("i", {
129
- className: "required"
130
- });
131
- var renderLabel = /*#__PURE__*/ React.createElement(React.Fragment, null, starPosition === 'left' ? renderStar : null, label, starPosition === 'right' ? renderStar : null);
124
+ var item = name ? _this.context.formInstance.errors[name] : [];
125
+ var starPosition = _this.context.formInstance.starPosition;
126
+ var renderStar = (required || requiredInRules) && /*#__PURE__*/ React.createElement("div", {
127
+ className: "nut-form-item-label-required required"
128
+ }, "*");
129
+ var renderLabel = /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", {
130
+ className: "nut-form-item-labeltxt"
131
+ }, starPosition === 'left' ? renderStar : null, label), starPosition === 'right' ? renderStar : null);
132
132
  return /*#__PURE__*/ React.createElement(Cell, {
133
- className: "nut-form-item ".concat(className),
133
+ className: "".concat(_this.getClassNameWithDirection('nut-form-item'), " ").concat(className),
134
134
  style: style,
135
135
  align: align,
136
136
  onClick: function(e) {
137
137
  return _this.props.onClick && _this.props.onClick(e, _this.componentRef);
138
138
  }
139
139
  }, label ? /*#__PURE__*/ React.createElement("div", {
140
- className: "nut-cell-title nut-form-item-label"
140
+ className: "nut-cell-title ".concat(_this.getClassNameWithDirection('nut-form-item-label'))
141
141
  }, renderLabel) : null, /*#__PURE__*/ React.createElement("div", {
142
- className: "nut-cell-value nut-form-item-body"
142
+ className: "nut-cell-value ".concat(_this.getClassNameWithDirection('nut-form-item-body'))
143
143
  }, /*#__PURE__*/ React.createElement("div", {
144
144
  className: "nut-form-item-body-slots"
145
145
  }, childNode), item && item.length > 0 && /*#__PURE__*/ React.createElement("div", {
@@ -160,12 +160,12 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
160
160
  key: "componentDidMount",
161
161
  value: function componentDidMount() {
162
162
  // Form设置initialValues时的处理
163
- var _this_context_getInternal = this.context.getInternal(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;
163
+ 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;
164
164
  if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
165
165
  setInitialValues(_object_spread_props(_object_spread({}, store), _define_property({}, this.props.name, this.props.initialValue)), true);
166
166
  }
167
167
  // 注册组件实例到FormStore
168
- var _this_context_getInternal1 = this.context.getInternal(SECRET), registerField = _this_context_getInternal1.registerField, registerUpdate = _this_context_getInternal1.registerUpdate;
168
+ var _this_context_formInstance_getInternal1 = this.context.formInstance.getInternal(SECRET), registerField = _this_context_formInstance_getInternal1.registerField, registerUpdate = _this_context_formInstance_getInternal1.registerUpdate;
169
169
  this.cancelRegister = registerField(this);
170
170
  // 这里需要增加事件监听,因为此实现属于依赖触发
171
171
  this.eventOff = registerUpdate(this, this.props.shouldUpdate);
@@ -182,6 +182,15 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
182
182
  }
183
183
  }
184
184
  },
185
+ {
186
+ key: "getClassNameWithDirection",
187
+ value: function getClassNameWithDirection(className) {
188
+ if (className && this.context.labelPosition) {
189
+ return "".concat(className, " ").concat(className, "-").concat(this.context.labelPosition);
190
+ }
191
+ return className;
192
+ }
193
+ },
185
194
  {
186
195
  key: "render",
187
196
  value: function render() {
@@ -191,11 +200,13 @@ export var FormItem = /*#__PURE__*/ function(_superClass) {
191
200
  if (!this.props.shouldUpdate) {
192
201
  returnChildNode = /*#__PURE__*/ React.cloneElement(child, this.getControlled(child));
193
202
  } else {
194
- returnChildNode = child(this.context);
203
+ returnChildNode = child(this.context.formInstance);
195
204
  }
196
205
  return /*#__PURE__*/ React.createElement(React.Fragment, {
197
206
  key: this.state.resetCount
198
- }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
207
+ }, /*#__PURE__*/ React.createElement("div", {
208
+ className: this.context.disabled ? 'nut-form-item-disabled' : ''
209
+ }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
199
210
  }
200
211
  }
201
212
  ]);
@@ -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>;
@@ -15,7 +15,10 @@ export function makeRect(width, height) {
15
15
  }
16
16
  export var getRectByTaro = /*#__PURE__*/ function() {
17
17
  var _ref = _async_to_generator(function(element) {
18
+ var harmonyId;
19
+ var _arguments = arguments;
18
20
  return _ts_generator(this, function(_state) {
21
+ harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
19
22
  if (element) {
20
23
  if (inBrowser) {
21
24
  return [
@@ -27,7 +30,7 @@ export var getRectByTaro = /*#__PURE__*/ function() {
27
30
  return [
28
31
  2,
29
32
  new Promise(function(resolve, reject) {
30
- createSelectorQuery().select("#".concat(element.uid)).boundingClientRect().exec(function(param) {
33
+ createSelectorQuery().select("#".concat(harmonyId || element.uid)).boundingClientRect().exec(function(param) {
31
34
  var _param = _sliced_to_array(param, 1), rects = _param[0];
32
35
  resolve(rects);
33
36
  });