assui 2.0.102 → 2.0.103

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.
@@ -20,6 +20,8 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
20
20
  maxLength?: number;
21
21
  /** 输入框获取焦点的回调 */
22
22
  onFocus?: (value: string) => void;
23
+ /** 输入框除去label之后的最小末尾宽度 */
24
+ baseMinWidth?: number;
23
25
  /** 组件dom id */
24
26
  id?: string;
25
27
  }
@@ -58,23 +58,25 @@ var LabelInput = function LabelInput(props) {
58
58
  onBlur = props.onBlur,
59
59
  _a = props.type,
60
60
  type = _a === void 0 ? 'text' : _a,
61
- maxLength = props.maxLength;
61
+ maxLength = props.maxLength,
62
+ _b = props.baseMinWidth,
63
+ baseMinWidth = _b === void 0 ? 50 : _b;
62
64
  var labelDomRef = React.useRef(null);
63
65
  var labelSize = useSize(labelDomRef);
64
66
 
65
- var _b = __read(React.useState(false), 2),
66
- focused = _b[0],
67
- setFocused = _b[1];
67
+ var _c = __read(React.useState(false), 2),
68
+ focused = _c[0],
69
+ setFocused = _c[1];
68
70
 
69
- var _c = __read(useControllableValue(props, {
71
+ var _d = __read(useControllableValue(props, {
70
72
  defaultValue: ''
71
73
  }), 2),
72
- value = _c[0],
73
- setValue = _c[1];
74
+ value = _d[0],
75
+ setValue = _d[1];
74
76
 
75
- var _d = __read(React.useState(type), 2),
76
- inputType = _d[0],
77
- setInputType = _d[1];
77
+ var _e = __read(React.useState(type), 2),
78
+ inputType = _e[0],
79
+ setInputType = _e[1];
78
80
 
79
81
  var InputDomRef = React.useRef(null);
80
82
  var isPasswordInput = type === 'password';
@@ -103,7 +105,7 @@ var LabelInput = function LabelInput(props) {
103
105
  var onChangeInputType = React.useCallback(function (nextInputType) {
104
106
  setInputType(nextInputType);
105
107
  }, []);
106
- var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + 28 : undefined;
108
+ var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
107
109
  return /*#__PURE__*/React.createElement("div", {
108
110
  className: classNames('label-input-control', className),
109
111
  id: id,
@@ -20,6 +20,8 @@ export interface LabelInputProps extends Omit<React.InputHTMLAttributes<HTMLInpu
20
20
  maxLength?: number;
21
21
  /** 输入框获取焦点的回调 */
22
22
  onFocus?: (value: string) => void;
23
+ /** 输入框除去label之后的最小末尾宽度 */
24
+ baseMinWidth?: number;
23
25
  /** 组件dom id */
24
26
  id?: string;
25
27
  }
@@ -77,23 +77,25 @@ var LabelInput = function LabelInput(props) {
77
77
  onBlur = props.onBlur,
78
78
  _a = props.type,
79
79
  type = _a === void 0 ? 'text' : _a,
80
- maxLength = props.maxLength;
80
+ maxLength = props.maxLength,
81
+ _b = props.baseMinWidth,
82
+ baseMinWidth = _b === void 0 ? 50 : _b;
81
83
  var labelDomRef = react_1["default"].useRef(null);
82
84
  var labelSize = useSize_1["default"](labelDomRef);
83
85
 
84
- var _b = __read(react_1["default"].useState(false), 2),
85
- focused = _b[0],
86
- setFocused = _b[1];
86
+ var _c = __read(react_1["default"].useState(false), 2),
87
+ focused = _c[0],
88
+ setFocused = _c[1];
87
89
 
88
- var _c = __read(useControllableValue_1["default"](props, {
90
+ var _d = __read(useControllableValue_1["default"](props, {
89
91
  defaultValue: ''
90
92
  }), 2),
91
- value = _c[0],
92
- setValue = _c[1];
93
+ value = _d[0],
94
+ setValue = _d[1];
93
95
 
94
- var _d = __read(react_1["default"].useState(type), 2),
95
- inputType = _d[0],
96
- setInputType = _d[1];
96
+ var _e = __read(react_1["default"].useState(type), 2),
97
+ inputType = _e[0],
98
+ setInputType = _e[1];
97
99
 
98
100
  var InputDomRef = react_1["default"].useRef(null);
99
101
  var isPasswordInput = type === 'password';
@@ -122,7 +124,7 @@ var LabelInput = function LabelInput(props) {
122
124
  var onChangeInputType = react_1["default"].useCallback(function (nextInputType) {
123
125
  setInputType(nextInputType);
124
126
  }, []);
125
- var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + 28 : undefined;
127
+ var controlMinWidth = (labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) ? labelSize.width + baseMinWidth : undefined;
126
128
  return react_1["default"].createElement("div", {
127
129
  className: classnames_1["default"]('label-input-control', className),
128
130
  id: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.0.102",
3
+ "version": "2.0.103",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -69,5 +69,5 @@
69
69
  "node": ">=10.0.0"
70
70
  },
71
71
  "license": "MIT",
72
- "gitHead": "f4d12b46c9bb1353d9f155a97cc1f59bd2764f2d"
72
+ "gitHead": "ab500961aaa3150c3f63455bf44e5e1e877dd407"
73
73
  }