assui 2.0.97 → 2.0.98
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/label-input/index.js +21 -10
- package/lib/label-input/index.js +22 -10
- package/package.json +3 -3
package/es/label-input/index.js
CHANGED
|
@@ -31,6 +31,20 @@ import { useControllableValue } from 'ahooks';
|
|
|
31
31
|
import { trimStart } from 'lodash';
|
|
32
32
|
import EyeFilled from 'a-icons/lib/EyeFilled';
|
|
33
33
|
import EyeOutlined from 'a-icons/lib/EyeOutlined';
|
|
34
|
+
var PasswordSuffix = /*#__PURE__*/React.memo(function (_a) {
|
|
35
|
+
var inputType = _a.inputType,
|
|
36
|
+
onChangeInputType = _a.onChangeInputType;
|
|
37
|
+
var resultNode = inputType === 'password' ? /*#__PURE__*/React.createElement(EyeOutlined, {
|
|
38
|
+
onClick: function onClick() {
|
|
39
|
+
onChangeInputType('text');
|
|
40
|
+
}
|
|
41
|
+
}) : /*#__PURE__*/React.createElement(EyeFilled, {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
onChangeInputType('password');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return resultNode;
|
|
47
|
+
});
|
|
34
48
|
|
|
35
49
|
var LabelInput = function LabelInput(props) {
|
|
36
50
|
var className = props.className,
|
|
@@ -82,15 +96,9 @@ var LabelInput = function LabelInput(props) {
|
|
|
82
96
|
(_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
83
97
|
};
|
|
84
98
|
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}) : /*#__PURE__*/React.createElement(EyeFilled, {
|
|
90
|
-
onClick: function onClick() {
|
|
91
|
-
return setInputType('password');
|
|
92
|
-
}
|
|
93
|
-
});
|
|
99
|
+
var onChangeInputType = React.useCallback(function (nextInputType) {
|
|
100
|
+
setInputType(nextInputType);
|
|
101
|
+
}, []);
|
|
94
102
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
103
|
className: classNames('label-input-control', className),
|
|
96
104
|
id: id
|
|
@@ -120,7 +128,10 @@ var LabelInput = function LabelInput(props) {
|
|
|
120
128
|
onClick: handleLabelClick
|
|
121
129
|
}, label)), (suffix || isPasswordInput) && /*#__PURE__*/React.createElement("div", {
|
|
122
130
|
className: "label-input-suffix"
|
|
123
|
-
}, suffix ||
|
|
131
|
+
}, suffix || /*#__PURE__*/React.createElement(PasswordSuffix, {
|
|
132
|
+
inputType: inputType,
|
|
133
|
+
onChangeInputType: onChangeInputType
|
|
134
|
+
}))));
|
|
124
135
|
};
|
|
125
136
|
|
|
126
137
|
export default LabelInput;
|
package/lib/label-input/index.js
CHANGED
|
@@ -49,6 +49,21 @@ var EyeFilled_1 = __importDefault(require("a-icons/lib/EyeFilled"));
|
|
|
49
49
|
|
|
50
50
|
var EyeOutlined_1 = __importDefault(require("a-icons/lib/EyeOutlined"));
|
|
51
51
|
|
|
52
|
+
var PasswordSuffix = react_1["default"].memo(function (_a) {
|
|
53
|
+
var inputType = _a.inputType,
|
|
54
|
+
onChangeInputType = _a.onChangeInputType;
|
|
55
|
+
var resultNode = inputType === 'password' ? react_1["default"].createElement(EyeOutlined_1["default"], {
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
onChangeInputType('text');
|
|
58
|
+
}
|
|
59
|
+
}) : react_1["default"].createElement(EyeFilled_1["default"], {
|
|
60
|
+
onClick: function onClick() {
|
|
61
|
+
onChangeInputType('password');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return resultNode;
|
|
65
|
+
});
|
|
66
|
+
|
|
52
67
|
var LabelInput = function LabelInput(props) {
|
|
53
68
|
var className = props.className,
|
|
54
69
|
prefix = props.prefix,
|
|
@@ -99,15 +114,9 @@ var LabelInput = function LabelInput(props) {
|
|
|
99
114
|
(_a = InputDomRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
100
115
|
};
|
|
101
116
|
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
}) : react_1["default"].createElement(EyeFilled_1["default"], {
|
|
107
|
-
onClick: function onClick() {
|
|
108
|
-
return setInputType('password');
|
|
109
|
-
}
|
|
110
|
-
});
|
|
117
|
+
var onChangeInputType = react_1["default"].useCallback(function (nextInputType) {
|
|
118
|
+
setInputType(nextInputType);
|
|
119
|
+
}, []);
|
|
111
120
|
return react_1["default"].createElement("div", {
|
|
112
121
|
className: classnames_1["default"]('label-input-control', className),
|
|
113
122
|
id: id
|
|
@@ -137,7 +146,10 @@ var LabelInput = function LabelInput(props) {
|
|
|
137
146
|
onClick: handleLabelClick
|
|
138
147
|
}, label)), (suffix || isPasswordInput) && react_1["default"].createElement("div", {
|
|
139
148
|
className: "label-input-suffix"
|
|
140
|
-
}, suffix ||
|
|
149
|
+
}, suffix || react_1["default"].createElement(PasswordSuffix, {
|
|
150
|
+
inputType: inputType,
|
|
151
|
+
onChangeInputType: onChangeInputType
|
|
152
|
+
}))));
|
|
141
153
|
};
|
|
142
154
|
|
|
143
155
|
exports["default"] = LabelInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.98",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@ahooksjs/use-url-state": "^2.5.8",
|
|
34
34
|
"@tinymce/tinymce-react": "^3.13.0",
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
|
-
"a-icons": "^1.0.
|
|
36
|
+
"a-icons": "^1.0.51",
|
|
37
37
|
"ahooks": "^3.0.8",
|
|
38
38
|
"bignumber.js": "^9.0.1",
|
|
39
39
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"node": ">=10.0.0"
|
|
70
70
|
},
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "3871c2af4095f1875f95460cb583c6d5ecf5f6c3"
|
|
73
73
|
}
|