@nutui/nutui-react 1.4.1 → 1.4.2-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.
package/dist/esm/Input.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["children", "type", "name", "defaultValue", "placeholder", "label", "labelClass", "labelWidth", "labelAlign", "colon", "inputAlign", "center", "required", "disabled", "readonly", "error", "maxlength", "leftIcon", "leftIconSize", "rightIcon", "rightIconSize", "clearable", "clearIcon", "clearSize", "border", "formatTrigger", "rules", "errorMessage", "errorMessageAlign", "showWordLimit", "autofocus", "style", "className", "rows", "slotButton", "slotInput", "onChange", "onBlur", "onFocus", "onClear", "formatter", "keypress", "onClickInput", "onClickLeftIcon", "onClickRightIcon", "onClick", "change", "blur", "focus", "clear", "clickInput", "clickLeftIcon", "clickRightIcon", "click", "iconClassPrefix", "iconFontClassName"];
4
+ var _excluded = ["children", "type", "name", "defaultValue", "placeholder", "label", "labelClass", "labelWidth", "labelAlign", "colon", "inputAlign", "center", "required", "disabled", "readonly", "error", "maxlength", "leftIcon", "leftIconSize", "rightIcon", "rightIconSize", "clearable", "clearIcon", "clearSize", "border", "formatTrigger", "rules", "errorMessage", "errorMessageAlign", "showWordLimit", "autofocus", "style", "className", "rows", "slotButton", "slotInput", "onChange", "onBlur", "onFocus", "onClear", "formatter", "keypress", "onClickInput", "onClickLeftIcon", "onClickRightIcon", "onClick", "iconClassPrefix", "iconFontClassName"];
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  import React__default, { forwardRef, useState, useRef, useLayoutEffect, useEffect, useImperativeHandle, useCallback } from 'react';
@@ -119,14 +119,6 @@ var Input = forwardRef(function (props, ref) {
119
119
  onClickLeftIcon = _defaultProps$props.onClickLeftIcon,
120
120
  onClickRightIcon = _defaultProps$props.onClickRightIcon,
121
121
  _onClick = _defaultProps$props.onClick,
122
- change = _defaultProps$props.change,
123
- blur = _defaultProps$props.blur,
124
- focus = _defaultProps$props.focus,
125
- clear = _defaultProps$props.clear,
126
- clickInput = _defaultProps$props.clickInput,
127
- clickLeftIcon = _defaultProps$props.clickLeftIcon,
128
- clickRightIcon = _defaultProps$props.clickRightIcon,
129
- click = _defaultProps$props.click,
130
122
  iconClassPrefix = _defaultProps$props.iconClassPrefix,
131
123
  iconFontClassName = _defaultProps$props.iconFontClassName,
132
124
  rest = _objectWithoutProperties(_defaultProps$props, _excluded);
@@ -148,7 +140,9 @@ var Input = forwardRef(function (props, ref) {
148
140
  };
149
141
  var inputRef = useRef(null);
150
142
  useLayoutEffect(function () {
151
- updateValue(getModelValue(), formatTrigger);
143
+ if (defaultValue) {
144
+ updateValue(getModelValue(), formatTrigger);
145
+ }
152
146
  });
153
147
  useEffect(function () {
154
148
  setClasses(inputClass);
@@ -166,10 +160,15 @@ var Input = forwardRef(function (props, ref) {
166
160
  var inputClass = useCallback(function () {
167
161
  var prefixCls = 'nut-input';
168
162
  return [prefixCls, "".concat(center ? 'center' : ''), "".concat(disabled ? "".concat(prefixCls, "-disabled") : ''), "".concat(required ? "".concat(prefixCls, "-required") : ''), "".concat(error ? "".concat(prefixCls, "-error") : ''), "".concat(border ? "".concat(prefixCls, "-border") : ''), "".concat(slotButton || rightIcon ? "".concat(prefixCls, "-right-mark") : '')].filter(Boolean).join(' ');
169
- }, [disabled, required, error, border]);
163
+ }, [disabled, required, error, border, slotButton, rightIcon, center]);
164
+ // 样式状态重置
165
+ useEffect(function () {
166
+ setClasses(inputClass);
167
+ }, [disabled, required, error, border, slotButton, rightIcon, center]);
170
168
  var updateValue = function updateValue(value) {
171
169
  var _inputRef$current;
172
170
  var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'onChange';
171
+ var event = arguments.length > 2 ? arguments[2] : undefined;
173
172
  var val = value;
174
173
  if (type === 'digit' || type === 'tel') {
175
174
  val = formatNumber(val, false, false);
@@ -188,25 +187,20 @@ var Input = forwardRef(function (props, ref) {
188
187
  if ((inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== val) {
189
188
  inputRef.current.value = val;
190
189
  }
191
- // if (val !== defaultValue) {
192
190
  SetInputValue(val);
193
- // }
191
+ onChange && onChange(val, event);
194
192
  };
195
-
196
193
  var handleFocus = function handleFocus(event) {
197
194
  var val = event.target.value;
198
195
  SetActive(true);
199
196
  onFocus && onFocus(val, event);
200
- focus && focus(val, event);
201
197
  };
202
198
  var handleInput = function handleInput(event) {
203
199
  var val = event.target.value;
204
200
  if (maxlength && val.length > Number(maxlength)) {
205
201
  val = val.slice(0, Number(maxlength));
206
202
  }
207
- updateValue(val);
208
- onChange && onChange(val, event);
209
- change && change(val, event);
203
+ updateValue(val, 'onChange', event);
210
204
  };
211
205
  var handleBlur = function handleBlur(event) {
212
206
  setTimeout(function () {
@@ -218,19 +212,15 @@ var Input = forwardRef(function (props, ref) {
218
212
  }
219
213
  updateValue(getModelValue(), 'onBlur');
220
214
  onBlur && onBlur(val, event);
221
- blur && blur(val, event);
222
215
  };
223
216
  var handleClickInput = function handleClickInput(event) {
224
217
  onClickInput && onClickInput(event);
225
- clickInput && clickInput(event);
226
218
  };
227
219
  var handleClickLeftIcon = function handleClickLeftIcon(event) {
228
220
  onClickLeftIcon && onClickLeftIcon(event);
229
- clickLeftIcon && clickLeftIcon(event);
230
221
  };
231
222
  var handleClickRightIcon = function handleClickRightIcon(event) {
232
223
  onClickRightIcon && onClickRightIcon(event);
233
- clickRightIcon && clickRightIcon(event);
234
224
  };
235
225
  var resetValidation = function resetValidation() {};
236
226
  var inputType = function inputType(type) {
@@ -245,7 +235,6 @@ var Input = forwardRef(function (props, ref) {
245
235
  var handleClear = function handleClear(event) {
246
236
  updateValue('');
247
237
  onClear && onClear('', event);
248
- clear && clear('', event);
249
238
  };
250
239
  return React__default.createElement("div", _objectSpread(_objectSpread({
251
240
  className: "".concat(classes, " ").concat(className || ''),
@@ -253,7 +242,6 @@ var Input = forwardRef(function (props, ref) {
253
242
  }, rest), {}, {
254
243
  onClick: function onClick(e) {
255
244
  _onClick && _onClick(e);
256
- click && click(e);
257
245
  }
258
246
  }), slotInput ? React__default.createElement(React__default.Fragment, null, label ? React__default.createElement("div", {
259
247
  className: "nut-input-label ".concat(labelClass),
@@ -102,88 +102,82 @@ var PullToRefresh = function PullToRefresh(p) {
102
102
  function _doRefresh() {
103
103
  _doRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
104
104
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
105
- while (1) {
106
- switch (_context3.prev = _context3.next) {
107
- case 0:
108
- api.start({
109
- height: headHeight
110
- });
111
- setStatus('refreshing');
112
- _context3.prev = 2;
113
- _context3.next = 5;
114
- return props.onRefresh();
115
- case 5:
116
- setStatus('complete');
117
- _context3.next = 12;
118
- break;
119
- case 8:
120
- _context3.prev = 8;
121
- _context3.t0 = _context3["catch"](2);
122
- api.start({
123
- to: function () {
124
- var _to = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(next) {
125
- return _regeneratorRuntime.wrap(function _callee$(_context) {
126
- while (1) {
127
- switch (_context.prev = _context.next) {
128
- case 0:
129
- _context.next = 2;
130
- return next({
131
- height: 0
132
- });
133
- case 2:
134
- setStatus('pulling');
135
- case 3:
136
- case "end":
137
- return _context.stop();
138
- }
139
- }
140
- }, _callee);
141
- }));
142
- function to(_x) {
143
- return _to.apply(this, arguments);
144
- }
145
- return to;
146
- }()
147
- });
148
- throw _context3.t0;
149
- case 12:
150
- if (!(props.completeDelay > 0)) {
151
- _context3.next = 15;
152
- break;
153
- }
105
+ while (1) switch (_context3.prev = _context3.next) {
106
+ case 0:
107
+ api.start({
108
+ height: headHeight
109
+ });
110
+ setStatus('refreshing');
111
+ _context3.prev = 2;
112
+ _context3.next = 5;
113
+ return props.onRefresh();
114
+ case 5:
115
+ setStatus('complete');
116
+ _context3.next = 12;
117
+ break;
118
+ case 8:
119
+ _context3.prev = 8;
120
+ _context3.t0 = _context3["catch"](2);
121
+ api.start({
122
+ to: function () {
123
+ var _to = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(next) {
124
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
125
+ while (1) switch (_context.prev = _context.next) {
126
+ case 0:
127
+ _context.next = 2;
128
+ return next({
129
+ height: 0
130
+ });
131
+ case 2:
132
+ setStatus('pulling');
133
+ case 3:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }, _callee);
138
+ }));
139
+ function to(_x) {
140
+ return _to.apply(this, arguments);
141
+ }
142
+ return to;
143
+ }()
144
+ });
145
+ throw _context3.t0;
146
+ case 12:
147
+ if (!(props.completeDelay > 0)) {
154
148
  _context3.next = 15;
155
- return sleep(props.completeDelay);
156
- case 15:
157
- api.start({
158
- to: function () {
159
- var _to2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(next) {
160
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
161
- while (1) {
162
- switch (_context2.prev = _context2.next) {
163
- case 0:
164
- _context2.next = 2;
165
- return next({
166
- height: 0
167
- });
168
- case 2:
169
- setStatus('pulling');
170
- case 3:
171
- case "end":
172
- return _context2.stop();
173
- }
174
- }
175
- }, _callee2);
176
- }));
177
- function to(_x2) {
178
- return _to2.apply(this, arguments);
179
- }
180
- return to;
181
- }()
182
- });
183
- case 16:
184
- case "end":
185
- return _context3.stop();
186
- }
149
+ break;
150
+ }
151
+ _context3.next = 15;
152
+ return sleep(props.completeDelay);
153
+ case 15:
154
+ api.start({
155
+ to: function () {
156
+ var _to2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(next) {
157
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
158
+ while (1) switch (_context2.prev = _context2.next) {
159
+ case 0:
160
+ _context2.next = 2;
161
+ return next({
162
+ height: 0
163
+ });
164
+ case 2:
165
+ setStatus('pulling');
166
+ case 3:
167
+ case "end":
168
+ return _context2.stop();
169
+ }
170
+ }, _callee2);
171
+ }));
172
+ function to(_x2) {
173
+ return _to2.apply(this, arguments);
174
+ }
175
+ return to;
176
+ }()
177
+ });
178
+ case 16:
179
+ case "end":
180
+ return _context3.stop();
187
181
  }
188
182
  }, _callee3, null, [[2, 8]]);
189
183
  }));
@@ -55,18 +55,16 @@ function concurrentUnmount(_x) {
55
55
  function _concurrentUnmount() {
56
56
  _concurrentUnmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(container) {
57
57
  return _regeneratorRuntime.wrap(function _callee$(_context) {
58
- while (1) {
59
- switch (_context.prev = _context.next) {
60
- case 0:
61
- return _context.abrupt("return", Promise.resolve().then(function () {
62
- var _container$MARK;
63
- (_container$MARK = container[MARK]) === null || _container$MARK === void 0 ? void 0 : _container$MARK.unmount();
64
- delete container[MARK];
65
- }));
66
- case 1:
67
- case "end":
68
- return _context.stop();
69
- }
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ return _context.abrupt("return", Promise.resolve().then(function () {
61
+ var _container$MARK;
62
+ (_container$MARK = container[MARK]) === null || _container$MARK === void 0 ? void 0 : _container$MARK.unmount();
63
+ delete container[MARK];
64
+ }));
65
+ case 1:
66
+ case "end":
67
+ return _context.stop();
70
68
  }
71
69
  }, _callee);
72
70
  }));
@@ -46,14 +46,6 @@ export interface InputProps extends BasicComponent {
46
46
  slotButton?: React.ReactNode;
47
47
  slotInput?: React.ReactNode;
48
48
  formatter: (value: string) => void;
49
- change?: (value: any, event: Event) => void;
50
- blur?: (value: any, event: Event) => void;
51
- focus?: (value: any, event: Event) => void;
52
- clear?: (value: any, event: Event) => void;
53
- clickInput?: (value: any) => void;
54
- clickLeftIcon?: (value: any) => void;
55
- clickRightIcon?: (value: any) => void;
56
- click?: (value: any) => void;
57
49
  onChange?: (value: any, event: Event) => void;
58
50
  onBlur?: (value: any, event: Event) => void;
59
51
  onFocus?: (value: any, event: Event) => void;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  const enUS = {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  const idID = {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  const zhCN = {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  const zhTW = {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:48:51 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:55:05 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  const zhUG = {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:47:00 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:54:28 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import * as React from "react";
@@ -16521,14 +16521,6 @@ const Input = forwardRef((props, ref) => {
16521
16521
  onClickLeftIcon,
16522
16522
  onClickRightIcon,
16523
16523
  onClick,
16524
- change,
16525
- blur,
16526
- focus,
16527
- clear,
16528
- clickInput,
16529
- clickLeftIcon,
16530
- clickRightIcon,
16531
- click,
16532
16524
  iconClassPrefix,
16533
16525
  iconFontClassName,
16534
16526
  ...rest
@@ -16543,7 +16535,9 @@ const Input = forwardRef((props, ref) => {
16543
16535
  const getModelValue = () => String(inputValue != null ? inputValue : "");
16544
16536
  const inputRef = useRef(null);
16545
16537
  useLayoutEffect(() => {
16546
- updateValue(getModelValue(), formatTrigger);
16538
+ if (defaultValue) {
16539
+ updateValue(getModelValue(), formatTrigger);
16540
+ }
16547
16541
  });
16548
16542
  useEffect(() => {
16549
16543
  setClasses(inputClass);
@@ -16569,8 +16563,11 @@ const Input = forwardRef((props, ref) => {
16569
16563
  `${border ? `${prefixCls}-border` : ""}`,
16570
16564
  `${slotButton || rightIcon ? `${prefixCls}-right-mark` : ""}`
16571
16565
  ].filter(Boolean).join(" ");
16572
- }, [disabled, required4, error, border]);
16573
- const updateValue = (value, trigger = "onChange") => {
16566
+ }, [disabled, required4, error, border, slotButton, rightIcon, center]);
16567
+ useEffect(() => {
16568
+ setClasses(inputClass);
16569
+ }, [disabled, required4, error, border, slotButton, rightIcon, center]);
16570
+ const updateValue = (value, trigger = "onChange", event) => {
16574
16571
  var _a;
16575
16572
  let val = value;
16576
16573
  if (type4 === "digit" || type4 === "tel") {
@@ -16591,21 +16588,19 @@ const Input = forwardRef((props, ref) => {
16591
16588
  inputRef.current.value = val;
16592
16589
  }
16593
16590
  SetInputValue(val);
16591
+ onChange && onChange(val, event);
16594
16592
  };
16595
16593
  const handleFocus = (event) => {
16596
16594
  const val = event.target.value;
16597
16595
  SetActive(true);
16598
16596
  onFocus && onFocus(val, event);
16599
- focus && focus(val, event);
16600
16597
  };
16601
16598
  const handleInput = (event) => {
16602
16599
  let val = event.target.value;
16603
16600
  if (maxlength && val.length > Number(maxlength)) {
16604
16601
  val = val.slice(0, Number(maxlength));
16605
16602
  }
16606
- updateValue(val);
16607
- onChange && onChange(val, event);
16608
- change && change(val, event);
16603
+ updateValue(val, "onChange", event);
16609
16604
  };
16610
16605
  const handleBlur = (event) => {
16611
16606
  setTimeout(() => {
@@ -16617,19 +16612,15 @@ const Input = forwardRef((props, ref) => {
16617
16612
  }
16618
16613
  updateValue(getModelValue(), "onBlur");
16619
16614
  onBlur && onBlur(val, event);
16620
- blur && blur(val, event);
16621
16615
  };
16622
16616
  const handleClickInput = (event) => {
16623
16617
  onClickInput && onClickInput(event);
16624
- clickInput && clickInput(event);
16625
16618
  };
16626
16619
  const handleClickLeftIcon = (event) => {
16627
16620
  onClickLeftIcon && onClickLeftIcon(event);
16628
- clickLeftIcon && clickLeftIcon(event);
16629
16621
  };
16630
16622
  const handleClickRightIcon = (event) => {
16631
16623
  onClickRightIcon && onClickRightIcon(event);
16632
- clickRightIcon && clickRightIcon(event);
16633
16624
  };
16634
16625
  const resetValidation = () => {
16635
16626
  };
@@ -16645,7 +16636,6 @@ const Input = forwardRef((props, ref) => {
16645
16636
  const handleClear = (event) => {
16646
16637
  updateValue("");
16647
16638
  onClear && onClear("", event);
16648
- clear && clear("", event);
16649
16639
  };
16650
16640
  return /* @__PURE__ */ React__default.createElement("div", {
16651
16641
  className: `${classes} ${className || ""}`,
@@ -16653,7 +16643,6 @@ const Input = forwardRef((props, ref) => {
16653
16643
  ...rest,
16654
16644
  onClick: (e2) => {
16655
16645
  onClick && onClick(e2);
16656
- click && click(e2);
16657
16646
  }
16658
16647
  }, slotInput ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, label ? /* @__PURE__ */ React__default.createElement("div", {
16659
16648
  className: `nut-input-label ${labelClass}`,
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui-react v1.4.1-beta.0 Wed Dec 28 2022 16:47:00 GMT+0800 (中国标准时间)
3
- * (c) 2022 @jdf2e.
2
+ * @nutui/nutui-react v1.4.2-beta.0 Wed Jan 04 2023 14:54:28 GMT+0800 (China Standard Time)
3
+ * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function(global2, factory) {
@@ -16548,14 +16548,6 @@
16548
16548
  onClickLeftIcon,
16549
16549
  onClickRightIcon,
16550
16550
  onClick,
16551
- change,
16552
- blur,
16553
- focus,
16554
- clear,
16555
- clickInput,
16556
- clickLeftIcon,
16557
- clickRightIcon,
16558
- click,
16559
16551
  iconClassPrefix,
16560
16552
  iconFontClassName,
16561
16553
  ...rest
@@ -16570,7 +16562,9 @@
16570
16562
  const getModelValue = () => String(inputValue != null ? inputValue : "");
16571
16563
  const inputRef = React.useRef(null);
16572
16564
  React.useLayoutEffect(() => {
16573
- updateValue(getModelValue(), formatTrigger);
16565
+ if (defaultValue) {
16566
+ updateValue(getModelValue(), formatTrigger);
16567
+ }
16574
16568
  });
16575
16569
  React.useEffect(() => {
16576
16570
  setClasses(inputClass);
@@ -16596,8 +16590,11 @@
16596
16590
  `${border ? `${prefixCls}-border` : ""}`,
16597
16591
  `${slotButton || rightIcon ? `${prefixCls}-right-mark` : ""}`
16598
16592
  ].filter(Boolean).join(" ");
16599
- }, [disabled, required2, error, border]);
16600
- const updateValue = (value, trigger = "onChange") => {
16593
+ }, [disabled, required2, error, border, slotButton, rightIcon, center]);
16594
+ React.useEffect(() => {
16595
+ setClasses(inputClass);
16596
+ }, [disabled, required2, error, border, slotButton, rightIcon, center]);
16597
+ const updateValue = (value, trigger = "onChange", event) => {
16601
16598
  var _a;
16602
16599
  let val = value;
16603
16600
  if (type2 === "digit" || type2 === "tel") {
@@ -16618,21 +16615,19 @@
16618
16615
  inputRef.current.value = val;
16619
16616
  }
16620
16617
  SetInputValue(val);
16618
+ onChange && onChange(val, event);
16621
16619
  };
16622
16620
  const handleFocus = (event) => {
16623
16621
  const val = event.target.value;
16624
16622
  SetActive(true);
16625
16623
  onFocus && onFocus(val, event);
16626
- focus && focus(val, event);
16627
16624
  };
16628
16625
  const handleInput = (event) => {
16629
16626
  let val = event.target.value;
16630
16627
  if (maxlength && val.length > Number(maxlength)) {
16631
16628
  val = val.slice(0, Number(maxlength));
16632
16629
  }
16633
- updateValue(val);
16634
- onChange && onChange(val, event);
16635
- change && change(val, event);
16630
+ updateValue(val, "onChange", event);
16636
16631
  };
16637
16632
  const handleBlur = (event) => {
16638
16633
  setTimeout(() => {
@@ -16644,19 +16639,15 @@
16644
16639
  }
16645
16640
  updateValue(getModelValue(), "onBlur");
16646
16641
  onBlur && onBlur(val, event);
16647
- blur && blur(val, event);
16648
16642
  };
16649
16643
  const handleClickInput = (event) => {
16650
16644
  onClickInput && onClickInput(event);
16651
- clickInput && clickInput(event);
16652
16645
  };
16653
16646
  const handleClickLeftIcon = (event) => {
16654
16647
  onClickLeftIcon && onClickLeftIcon(event);
16655
- clickLeftIcon && clickLeftIcon(event);
16656
16648
  };
16657
16649
  const handleClickRightIcon = (event) => {
16658
16650
  onClickRightIcon && onClickRightIcon(event);
16659
- clickRightIcon && clickRightIcon(event);
16660
16651
  };
16661
16652
  const resetValidation = () => {
16662
16653
  };
@@ -16672,7 +16663,6 @@
16672
16663
  const handleClear = (event) => {
16673
16664
  updateValue("");
16674
16665
  onClear && onClear("", event);
16675
- clear && clear("", event);
16676
16666
  };
16677
16667
  return /* @__PURE__ */ React__default["default"].createElement("div", {
16678
16668
  className: `${classes} ${className || ""}`,
@@ -16680,7 +16670,6 @@
16680
16670
  ...rest,
16681
16671
  onClick: (e2) => {
16682
16672
  onClick && onClick(e2);
16683
- click && click(e2);
16684
16673
  }
16685
16674
  }, slotInput ? /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, label ? /* @__PURE__ */ React__default["default"].createElement("div", {
16686
16675
  className: `nut-input-label ${labelClass}`,
@@ -54,18 +54,18 @@ textarea {
54
54
  border: 0;
55
55
  text-decoration: none;
56
56
  }
57
- &-label {
58
- width: 80px;
59
- overflow: hidden;
60
- text-align: left;
61
- display: flex;
62
- .label-string {
63
- overflow: hidden;
64
- white-space: nowrap;
65
- text-overflow: ellipsis;
66
- color: $gray1;
67
- }
68
- }
57
+ // &-label {
58
+ // width: 80px;
59
+ // overflow: hidden;
60
+ // text-align: left;
61
+ // display: flex;
62
+ // .label-string {
63
+ // overflow: hidden;
64
+ // white-space: nowrap;
65
+ // text-overflow: ellipsis;
66
+ // color: $gray1;
67
+ // }
68
+ // }
69
69
  &__clear {
70
70
  width: 16px;
71
71
  height: 16px;