shineout 1.8.4 → 1.8.5

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/es/Form/Field.js CHANGED
@@ -53,13 +53,18 @@ function (_Component) {
53
53
  });
54
54
  }
55
55
 
56
+ var cloneProps = {
57
+ value: value,
58
+ error: error,
59
+ onChange: this.handleChange
60
+ };
61
+
62
+ if (disabled !== undefined) {
63
+ cloneProps.disabled = disabled;
64
+ }
65
+
56
66
  if (isValidElement(children)) {
57
- return cloneElement(children, {
58
- value: value,
59
- error: error,
60
- onChange: this.handleChange,
61
- disabled: disabled
62
- });
67
+ return cloneElement(children, cloneProps);
63
68
  }
64
69
 
65
70
  console.error(new Error('Form.Field expect a single ReactElement or a function.'));
@@ -29,7 +29,9 @@ function (_Component) {
29
29
  _this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_assertThisInitialized(_this)));
30
30
  _this.geHandleMax = _this.geHandleMax.bind(_assertThisInitialized(_assertThisInitialized(_this)));
31
31
  _this.handlePaste = _this.handlePaste.bind(_assertThisInitialized(_assertThisInitialized(_this)));
32
- _this.focusInput = _this.focusInput.bind(_assertThisInitialized(_assertThisInitialized(_this))); // for mutiple select
32
+ _this.focusInput = _this.focusInput.bind(_assertThisInitialized(_assertThisInitialized(_this)));
33
+ _this.handleCompositionStart = _this.handleCompositionStart.bind(_assertThisInitialized(_assertThisInitialized(_this)));
34
+ _this.handleCompositionEnd = _this.handleCompositionEnd.bind(_assertThisInitialized(_assertThisInitialized(_this))); // for mutiple select
33
35
 
34
36
  _this.props.setInputReset(_this.reset.bind(_assertThisInitialized(_assertThisInitialized(_this)))); // set focus func to Select
35
37
 
@@ -81,7 +83,7 @@ function (_Component) {
81
83
  _proto.geHandleMax = function geHandleMax(e) {
82
84
  var maxLength = this.props.maxLength;
83
85
 
84
- if (!maxLength) {
86
+ if (!maxLength || this.composition) {
85
87
  return true;
86
88
  }
87
89
 
@@ -202,6 +204,15 @@ function (_Component) {
202
204
  this.props.onInputBlur(text);
203
205
  };
204
206
 
207
+ _proto.handleCompositionStart = function handleCompositionStart() {
208
+ this.composition = true;
209
+ };
210
+
211
+ _proto.handleCompositionEnd = function handleCompositionEnd(e) {
212
+ this.composition = false;
213
+ this.handleInput(e);
214
+ };
215
+
205
216
  _proto.render = function render() {
206
217
  var _this$props = this.props,
207
218
  text = _this$props.text,
@@ -216,7 +227,9 @@ function (_Component) {
216
227
  contentEditable: focus || this.state.editable,
217
228
  onFocus: handleFocus,
218
229
  onBlur: this.handleBlur,
219
- title: !focus && isString(value) ? value : null
230
+ title: !focus && isString(value) ? value : null,
231
+ onCompositionStart: this.handleCompositionStart,
232
+ onCompositionEnd: this.handleCompositionEnd
220
233
  };
221
234
 
222
235
  if (isValidElement(value)) {
package/es/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import './styles/normalize.less'
3
3
  import * as utils from './utils'
4
4
 
5
- export default { utils, version: '1.8.4' }
5
+ export default { utils, version: '1.8.5' }
6
6
  export { utils }
7
7
  export { setLocale } from './locale'
8
8
  export { color, style } from './utils/expose'
package/es/index.js CHANGED
@@ -3,7 +3,7 @@ import './styles/normalize.less';
3
3
  import * as utils from './utils';
4
4
  export default {
5
5
  utils: utils,
6
- version: '1.8.4'
6
+ version: '1.8.5'
7
7
  };
8
8
  export { utils };
9
9
  export { setLocale } from './locale';
package/lib/Form/Field.js CHANGED
@@ -64,13 +64,18 @@ function (_Component) {
64
64
  });
65
65
  }
66
66
 
67
+ var cloneProps = {
68
+ value: value,
69
+ error: error,
70
+ onChange: this.handleChange
71
+ };
72
+
73
+ if (disabled !== undefined) {
74
+ cloneProps.disabled = disabled;
75
+ }
76
+
67
77
  if ((0, _react.isValidElement)(children)) {
68
- return (0, _react.cloneElement)(children, {
69
- value: value,
70
- error: error,
71
- onChange: this.handleChange,
72
- disabled: disabled
73
- });
78
+ return (0, _react.cloneElement)(children, cloneProps);
74
79
  }
75
80
 
76
81
  console.error(new Error('Form.Field expect a single ReactElement or a function.'));
@@ -46,7 +46,9 @@ function (_Component) {
46
46
  _this.handleBlur = _this.handleBlur.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
47
47
  _this.geHandleMax = _this.geHandleMax.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
48
48
  _this.handlePaste = _this.handlePaste.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
49
- _this.focusInput = _this.focusInput.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); // for mutiple select
49
+ _this.focusInput = _this.focusInput.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
50
+ _this.handleCompositionStart = _this.handleCompositionStart.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
51
+ _this.handleCompositionEnd = _this.handleCompositionEnd.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); // for mutiple select
50
52
 
51
53
  _this.props.setInputReset(_this.reset.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)))); // set focus func to Select
52
54
 
@@ -98,7 +100,7 @@ function (_Component) {
98
100
  _proto.geHandleMax = function geHandleMax(e) {
99
101
  var maxLength = this.props.maxLength;
100
102
 
101
- if (!maxLength) {
103
+ if (!maxLength || this.composition) {
102
104
  return true;
103
105
  }
104
106
 
@@ -219,6 +221,15 @@ function (_Component) {
219
221
  this.props.onInputBlur(text);
220
222
  };
221
223
 
224
+ _proto.handleCompositionStart = function handleCompositionStart() {
225
+ this.composition = true;
226
+ };
227
+
228
+ _proto.handleCompositionEnd = function handleCompositionEnd(e) {
229
+ this.composition = false;
230
+ this.handleInput(e);
231
+ };
232
+
222
233
  _proto.render = function render() {
223
234
  var _this$props = this.props,
224
235
  text = _this$props.text,
@@ -233,7 +244,9 @@ function (_Component) {
233
244
  contentEditable: focus || this.state.editable,
234
245
  onFocus: handleFocus,
235
246
  onBlur: this.handleBlur,
236
- title: !focus && (0, _is.isString)(value) ? value : null
247
+ title: !focus && (0, _is.isString)(value) ? value : null,
248
+ onCompositionStart: this.handleCompositionStart,
249
+ onCompositionEnd: this.handleCompositionEnd
237
250
  };
238
251
 
239
252
  if ((0, _react.isValidElement)(value)) {
package/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import './styles/normalize.less'
3
3
  import * as utils from './utils'
4
4
 
5
- export default { utils, version: '1.8.4' }
5
+ export default { utils, version: '1.8.5' }
6
6
  export { utils }
7
7
  export { setLocale } from './locale'
8
8
  export { color, style } from './utils/expose'
package/lib/index.js CHANGED
@@ -222,6 +222,6 @@ exports.Upload = _Upload.default;
222
222
  // Created by scripts/src-index.js.
223
223
  var _default = {
224
224
  utils: utils,
225
- version: '1.8.4'
225
+ version: '1.8.5'
226
226
  };
227
227
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shineout",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "description": "Shein 前端组件库",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",