@titaui/pc 1.8.4 → 1.8.61
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/lib/components/dialog/index.css +1 -1
- package/lib/components/form/form-fields/duties/index.js +2 -1
- package/lib/components/form/form-fields/input/index.js +1 -1
- package/lib/components/form/form-fields/input-verification-code/index.js +18 -15
- package/lib/components/form/form-fields/password/index.css +18 -0
- package/lib/components/form/form-fields/password/index.js +33 -20
- package/lib/components/form/index.js +4 -1
- package/lib/components/table/index.css +1 -0
- package/lib/components/upload-photo-modal/constant.js +10 -4
- package/lib/components/upload-photo-modal/index.css +1 -2
- package/lib/components/upload-photo-modal/index.js +58 -186
- package/lib/components/user-selector/request-apis.js +1 -1
- package/lib/pages/personal-info/components/base-info/index.css +31 -3
- package/lib/pages/personal-info/components/base-info/index.js +13 -5
- package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.css +1 -1
- package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.js +3 -4
- package/lib/pages/personal-info/components/person-photo/index.css +18 -5
- package/lib/pages/personal-info/components/person-photo/index.js +18 -3
- package/package.json +1 -1
- package/src/components/dialog/index.scss +1 -1
- package/src/components/form/form-fields/duties/index.tsx +1 -1
- package/src/components/form/form-fields/input/index.tsx +2 -2
- package/src/components/form/form-fields/input-verification-code/index.tsx +100 -70
- package/src/components/form/form-fields/password/index.scss +20 -4
- package/src/components/form/form-fields/password/index.tsx +73 -51
- package/src/components/form/index.tsx +3 -1
- package/src/components/table/index.scss +1 -0
- package/src/components/upload-photo-modal/constant.ts +7 -1
- package/src/components/upload-photo-modal/index.scss +1 -2
- package/src/components/upload-photo-modal/index.tsx +53 -156
- package/src/components/user-selector/export-modules/duties-selector/index.tsx +1 -1
- package/src/components/user-selector/request-apis.js +1 -1
- package/src/pages/personal-info/components/base-info/index.scss +26 -3
- package/src/pages/personal-info/components/base-info/index.tsx +12 -3
- package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.scss +1 -1
- package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.tsx +2 -4
- package/src/pages/personal-info/components/person-photo/index.scss +17 -5
- package/src/pages/personal-info/components/person-photo/index.tsx +12 -4
- package/lib/pages/personal-info/components/edit-info/input/index.css +0 -89
- package/lib/pages/personal-info/components/edit-info/input/index.js +0 -199
- package/src/pages/personal-info/components/edit-info/input/index.scss +0 -82
- package/src/pages/personal-info/components/edit-info/input/index.tsx +0 -145
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _errorTip = _interopRequireDefault(require("../../../../../components/tooltip/error-tip"));
|
|
15
|
-
|
|
16
|
-
require("./index.css");
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
|
|
26
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
-
|
|
30
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
|
|
32
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
-
|
|
34
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
-
|
|
36
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
|
-
var preCls = 'edit-base-info-input';
|
|
39
|
-
|
|
40
|
-
var OverlayInner = function OverlayInner(_ref) {
|
|
41
|
-
var hasError = _ref.hasError,
|
|
42
|
-
hasActive = _ref.hasActive,
|
|
43
|
-
tip = _ref.tip;
|
|
44
|
-
if (hasError) return /*#__PURE__*/_react["default"].createElement("span", {
|
|
45
|
-
style: {
|
|
46
|
-
'color': '#F05E5E'
|
|
47
|
-
}
|
|
48
|
-
}, tip);
|
|
49
|
-
if (hasActive) return /*#__PURE__*/_react["default"].createElement("span", {
|
|
50
|
-
style: {
|
|
51
|
-
'color': '#3F4755'
|
|
52
|
-
}
|
|
53
|
-
}, tip);
|
|
54
|
-
return /*#__PURE__*/_react["default"].createElement("span", null);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
var popupAlign = {
|
|
58
|
-
offset: [-12, -4],
|
|
59
|
-
overflow: {
|
|
60
|
-
adjustX: true,
|
|
61
|
-
adjustY: true
|
|
62
|
-
},
|
|
63
|
-
targetOffset: [0, 0]
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
var _default = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
67
|
-
var _classNames;
|
|
68
|
-
|
|
69
|
-
var label = props.label,
|
|
70
|
-
verifies = props.verifies,
|
|
71
|
-
placeholder = props.placeholder,
|
|
72
|
-
onChange = props.onChange,
|
|
73
|
-
require = props.require,
|
|
74
|
-
type = props.type,
|
|
75
|
-
name = props.name,
|
|
76
|
-
disabled = props.disabled,
|
|
77
|
-
getContainer = props.getContainer;
|
|
78
|
-
var inputRef = (0, _react.useRef)();
|
|
79
|
-
|
|
80
|
-
var _useState = (0, _react.useState)(false),
|
|
81
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
82
|
-
hasError = _useState2[0],
|
|
83
|
-
setHasError = _useState2[1];
|
|
84
|
-
|
|
85
|
-
var _useState3 = (0, _react.useState)(false),
|
|
86
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
87
|
-
hasActive = _useState4[0],
|
|
88
|
-
setHasActive = _useState4[1];
|
|
89
|
-
|
|
90
|
-
var _useState5 = (0, _react.useState)(''),
|
|
91
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
92
|
-
tip = _useState6[0],
|
|
93
|
-
setTip = _useState6[1];
|
|
94
|
-
|
|
95
|
-
var _useState7 = (0, _react.useState)(props.value || ''),
|
|
96
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
97
|
-
value = _useState8[0],
|
|
98
|
-
setValue = _useState8[1];
|
|
99
|
-
|
|
100
|
-
(0, _react.useEffect)(function () {
|
|
101
|
-
setValue(props.value);
|
|
102
|
-
}, [props.value]);
|
|
103
|
-
|
|
104
|
-
var _verifing = function verifing() {
|
|
105
|
-
var value = inputRef.current && inputRef.current.value;
|
|
106
|
-
if (!verifies || !verifies.length) return [];
|
|
107
|
-
if (!require && !value) return [];
|
|
108
|
-
var errors = [];
|
|
109
|
-
|
|
110
|
-
for (var i = 0; i < verifies.length; i++) {
|
|
111
|
-
var _verifies$i = verifies[i],
|
|
112
|
-
test = _verifies$i.test,
|
|
113
|
-
_tip = _verifies$i.tip;
|
|
114
|
-
|
|
115
|
-
if (!value.match(test)) {
|
|
116
|
-
errors.push({
|
|
117
|
-
name: name,
|
|
118
|
-
tip: _tip
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return errors;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
var onInputFocusHandler = function onInputFocusHandler() {
|
|
127
|
-
setHasActive(true);
|
|
128
|
-
inputRef.current.setSelectionRange(9999999, 9999999);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
var onBlurHandler = function onBlurHandler() {
|
|
132
|
-
setHasActive(false);
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
var onChangeHandler = function onChangeHandler() {
|
|
136
|
-
var value = inputRef.current && inputRef.current.value;
|
|
137
|
-
onChange && onChange(value);
|
|
138
|
-
setValue(value);
|
|
139
|
-
|
|
140
|
-
var errors = _verifing();
|
|
141
|
-
|
|
142
|
-
if (errors.length) {
|
|
143
|
-
setHasError(true);
|
|
144
|
-
setTip(errors[0].tip);
|
|
145
|
-
} else {
|
|
146
|
-
setHasError(false);
|
|
147
|
-
setTip('');
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
152
|
-
return {
|
|
153
|
-
'verifing': function verifing() {
|
|
154
|
-
var errors = _verifing();
|
|
155
|
-
|
|
156
|
-
if (errors.length) {
|
|
157
|
-
setHasError(true);
|
|
158
|
-
setTip(errors[0].tip);
|
|
159
|
-
inputRef.current.focus();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return errors;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
167
|
-
className: (0, _classnames["default"])(preCls)
|
|
168
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
169
|
-
className: (0, _classnames["default"])("".concat(preCls, "__label"))
|
|
170
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
171
|
-
className: (0, _classnames["default"])("".concat(preCls, "__label-text"))
|
|
172
|
-
}, label)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
173
|
-
className: (0, _classnames["default"])("".concat(preCls, "__border"), (_classNames = {}, _defineProperty(_classNames, "".concat(preCls, "__border--error"), hasError), _defineProperty(_classNames, "".concat(preCls, "__border--active"), hasActive), _defineProperty(_classNames, "".concat(preCls, "__border--disabled"), disabled), _classNames))
|
|
174
|
-
}, /*#__PURE__*/_react["default"].createElement(_errorTip["default"], {
|
|
175
|
-
placement: 'topLeft',
|
|
176
|
-
popupAlign: popupAlign,
|
|
177
|
-
destroyTooltipOnHide: true,
|
|
178
|
-
visible: (hasActive || hasError) && tip,
|
|
179
|
-
overlay: /*#__PURE__*/_react["default"].createElement(OverlayInner, {
|
|
180
|
-
hasActive: hasActive,
|
|
181
|
-
hasError: hasError,
|
|
182
|
-
tip: tip
|
|
183
|
-
}),
|
|
184
|
-
getTooltipContainer: getContainer
|
|
185
|
-
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
186
|
-
ref: inputRef,
|
|
187
|
-
type: type,
|
|
188
|
-
disabled: disabled,
|
|
189
|
-
className: (0, _classnames["default"])("".concat(preCls, "__input")),
|
|
190
|
-
value: value,
|
|
191
|
-
placeholder: placeholder,
|
|
192
|
-
onFocus: onInputFocusHandler,
|
|
193
|
-
onBlur: onBlurHandler,
|
|
194
|
-
onChange: onChangeHandler,
|
|
195
|
-
autoComplete: "off"
|
|
196
|
-
}))));
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
exports["default"] = _default;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
.edit-base-info-input {
|
|
2
|
-
display: flex;
|
|
3
|
-
box-sizing: border-box;
|
|
4
|
-
padding: 0 32px;
|
|
5
|
-
align-items: center;
|
|
6
|
-
margin-bottom: 16px;
|
|
7
|
-
&__label {
|
|
8
|
-
width: 56px;
|
|
9
|
-
height: 22px;
|
|
10
|
-
font-size: 14px;
|
|
11
|
-
margin-bottom: 5px;
|
|
12
|
-
margin-right: 20px;
|
|
13
|
-
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
14
|
-
font-weight: 400;
|
|
15
|
-
line-height: 22px;
|
|
16
|
-
|
|
17
|
-
&-text {
|
|
18
|
-
color: #89919F;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&-require {
|
|
22
|
-
color: red;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&__border {
|
|
27
|
-
flex:1;
|
|
28
|
-
padding: 6px 12px;
|
|
29
|
-
transition: all 0.2s;
|
|
30
|
-
border: 1px solid #e9ecf0;
|
|
31
|
-
box-sizing: border-box;
|
|
32
|
-
border-radius: 8px;
|
|
33
|
-
|
|
34
|
-
&--disabled {
|
|
35
|
-
background-color: #fafafa;
|
|
36
|
-
cursor: not-allowed;
|
|
37
|
-
input:disabled {
|
|
38
|
-
background-color: #fafafa;
|
|
39
|
-
cursor: not-allowed;
|
|
40
|
-
color: #3f475594;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
&__border--error {
|
|
45
|
-
box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) !important;
|
|
46
|
-
border: 1px solid #f05e5e !important;
|
|
47
|
-
}
|
|
48
|
-
&__border--active {
|
|
49
|
-
box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
|
|
50
|
-
border: 1px solid #2879ff;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&__input {
|
|
54
|
-
display: inline-block;
|
|
55
|
-
padding: 0;
|
|
56
|
-
width: calc(100% - 12px);
|
|
57
|
-
font-size: 14px;
|
|
58
|
-
font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
|
|
59
|
-
font-weight: 400;
|
|
60
|
-
color: #3f4755;
|
|
61
|
-
height: 22px;
|
|
62
|
-
line-height: inherit;
|
|
63
|
-
border: none;
|
|
64
|
-
|
|
65
|
-
&::-webkit-input-placeholder {
|
|
66
|
-
color: #bfc7d5;
|
|
67
|
-
font-weight: unset;
|
|
68
|
-
}
|
|
69
|
-
&::-moz-placeholder {
|
|
70
|
-
color: #bfc7d5;
|
|
71
|
-
font-weight: unset;
|
|
72
|
-
}
|
|
73
|
-
&:-moz-placeholder {
|
|
74
|
-
color: #bfc7d5;
|
|
75
|
-
font-weight: unset;
|
|
76
|
-
}
|
|
77
|
-
&:-ms-input-placeholder {
|
|
78
|
-
color: #bfc7d5;
|
|
79
|
-
font-weight: unset;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import ToolTip from '../../../../../components/tooltip/error-tip';
|
|
4
|
-
import './index.scss'
|
|
5
|
-
|
|
6
|
-
const preCls = 'edit-base-info-input';
|
|
7
|
-
|
|
8
|
-
interface verify {
|
|
9
|
-
tip: string;
|
|
10
|
-
test: RegExp;
|
|
11
|
-
}
|
|
12
|
-
interface Props {
|
|
13
|
-
label: string;
|
|
14
|
-
verifies?: verify[];
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
onChange?: Function;
|
|
17
|
-
value?: any;
|
|
18
|
-
require?: boolean;
|
|
19
|
-
type?: string;
|
|
20
|
-
name: string;
|
|
21
|
-
getContainer?: Function;
|
|
22
|
-
disabled?: boolean
|
|
23
|
-
}
|
|
24
|
-
interface Error {
|
|
25
|
-
name: string;
|
|
26
|
-
tip: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const OverlayInner = ({ hasError, hasActive, tip }) => {
|
|
30
|
-
if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
|
|
31
|
-
if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
|
|
32
|
-
return <span />;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const popupAlign = {
|
|
36
|
-
offset: [-12, -4],
|
|
37
|
-
overflow: { adjustX: true, adjustY: true },
|
|
38
|
-
targetOffset: [0, 0],
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default forwardRef((props: Props, ref) => {
|
|
42
|
-
const {
|
|
43
|
-
label,
|
|
44
|
-
verifies,
|
|
45
|
-
placeholder,
|
|
46
|
-
onChange,
|
|
47
|
-
require,
|
|
48
|
-
type,
|
|
49
|
-
name,
|
|
50
|
-
disabled,
|
|
51
|
-
getContainer
|
|
52
|
-
} = props;
|
|
53
|
-
|
|
54
|
-
const inputRef = useRef<any>();
|
|
55
|
-
const [hasError, setHasError] = useState<boolean>(false);
|
|
56
|
-
const [hasActive, setHasActive] = useState<boolean>(false);
|
|
57
|
-
const [tip, setTip] = useState<string>('');
|
|
58
|
-
const [value, setValue] = useState<string>(props.value || '');
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
setValue(props.value);
|
|
62
|
-
}, [props.value])
|
|
63
|
-
|
|
64
|
-
const verifing = (): Error[] => {
|
|
65
|
-
const value = inputRef.current && inputRef.current.value;
|
|
66
|
-
if (!verifies || !verifies.length) return [];
|
|
67
|
-
if (!require && !value) return [];
|
|
68
|
-
const errors: Error[] = [];
|
|
69
|
-
for (let i = 0; i < verifies.length; i++) {
|
|
70
|
-
let { test, tip } = verifies[i];
|
|
71
|
-
if (!value.match(test)) {
|
|
72
|
-
errors.push({ name, tip });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return errors;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const onInputFocusHandler = () => {
|
|
79
|
-
setHasActive(true);
|
|
80
|
-
inputRef.current.setSelectionRange(9999999, 9999999);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const onBlurHandler = () => {
|
|
84
|
-
setHasActive(false);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const onChangeHandler = () => {
|
|
88
|
-
const value = inputRef.current && inputRef.current.value;
|
|
89
|
-
onChange && onChange(value);
|
|
90
|
-
setValue(value);
|
|
91
|
-
const errors = verifing();
|
|
92
|
-
if (errors.length) {
|
|
93
|
-
setHasError(true);
|
|
94
|
-
setTip(errors[0].tip);
|
|
95
|
-
} else {
|
|
96
|
-
setHasError(false);
|
|
97
|
-
setTip('');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
useImperativeHandle(ref, () => ({
|
|
102
|
-
'verifing': (): Error[] => {
|
|
103
|
-
const errors = verifing();
|
|
104
|
-
if (errors.length) {
|
|
105
|
-
setHasError(true);
|
|
106
|
-
setTip(errors[0].tip);
|
|
107
|
-
inputRef.current.focus();
|
|
108
|
-
}
|
|
109
|
-
return errors;
|
|
110
|
-
}
|
|
111
|
-
}))
|
|
112
|
-
|
|
113
|
-
return <div className={classNames(preCls)}>
|
|
114
|
-
<div className={classNames(`${preCls}__label`)}>
|
|
115
|
-
<span className={classNames(`${preCls}__label-text`)}>{label}</span>
|
|
116
|
-
</div>
|
|
117
|
-
<div className={classNames(`${preCls}__border`, {
|
|
118
|
-
[`${preCls}__border--error`]: hasError,
|
|
119
|
-
[`${preCls}__border--active`]: hasActive,
|
|
120
|
-
[`${preCls}__border--disabled`]: disabled
|
|
121
|
-
})}>
|
|
122
|
-
<ToolTip
|
|
123
|
-
placement={'topLeft'}
|
|
124
|
-
popupAlign={popupAlign}
|
|
125
|
-
destroyTooltipOnHide={true}
|
|
126
|
-
visible={(hasActive || hasError) && tip}
|
|
127
|
-
overlay={<OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />}
|
|
128
|
-
getTooltipContainer={getContainer}
|
|
129
|
-
>
|
|
130
|
-
<input
|
|
131
|
-
ref={inputRef}
|
|
132
|
-
type={type}
|
|
133
|
-
disabled={disabled}
|
|
134
|
-
className={classNames(`${preCls}__input`)}
|
|
135
|
-
value={value}
|
|
136
|
-
placeholder={placeholder}
|
|
137
|
-
onFocus={onInputFocusHandler}
|
|
138
|
-
onBlur={onBlurHandler}
|
|
139
|
-
onChange={onChangeHandler}
|
|
140
|
-
autoComplete='off'
|
|
141
|
-
/>
|
|
142
|
-
</ToolTip>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
})
|