@ucloud-fe/react-components 1.4.4 → 1.5.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/CHANGELOG.md +26 -0
- package/dist/icon.min.js +1 -1
- package/dist/main.min.js +4 -4
- package/lib/components/Calendar/style/index.js +5 -5
- package/lib/components/DatePicker/Range.js +16 -6
- package/lib/components/DatePicker/usePicker.js +31 -15
- package/lib/components/DatePicker/useRangePicker.d.ts +1 -0
- package/lib/components/DatePicker/useRangePicker.js +3 -2
- package/lib/components/DatePicker/utils.d.ts +2 -1
- package/lib/components/DatePicker/utils.js +13 -1
- package/lib/components/Form/ControllerContext.d.ts +1 -1
- package/lib/components/Input/.recodo/interaction.js +2 -2
- package/lib/components/Input/Input.js +12 -60
- package/lib/components/Input/Search.js +1 -0
- package/lib/components/Input/style/index.d.ts +23 -8
- package/lib/components/Input/style/index.js +97 -17
- package/lib/components/Menu/Item.js +9 -2
- package/lib/components/Menu/Menu.d.ts +11 -3
- package/lib/components/Menu/Menu.js +23 -9
- package/lib/components/Menu/MenuContext.d.ts +1 -0
- package/lib/components/Menu/index.d.ts +2 -2
- package/lib/components/Menu/style/index.d.ts +3 -0
- package/lib/components/Menu/style/index.js +14 -8
- package/lib/components/Notice/index.d.ts +1 -1
- package/lib/components/Select/Group.d.ts +3 -0
- package/lib/components/Select/Group.js +4 -0
- package/lib/components/Select/Overflow.d.ts +19 -0
- package/lib/components/Select/Overflow.js +155 -0
- package/lib/components/Select/Select.d.ts +15 -9
- package/lib/components/Select/Select.js +1149 -322
- package/lib/components/Select/SelectContext.d.ts +1 -1
- package/lib/components/Select/index.d.ts +3 -1
- package/lib/components/Select/locale/en_US.js +2 -1
- package/lib/components/Select/locale/zh_CN.d.ts +1 -0
- package/lib/components/Select/locale/zh_CN.js +2 -1
- package/lib/components/Select/style/index.d.ts +43 -6
- package/lib/components/Select/style/index.js +128 -42
- package/lib/components/SvgIcon/icons/ArrowDown.js +2 -2
- package/lib/components/SvgIcon/icons/ArrowLeft.js +3 -2
- package/lib/components/SvgIcon/icons/ArrowRight.js +2 -2
- package/lib/components/SvgIcon/icons/ArrowUp.js +2 -2
- package/lib/components/SvgIcon/icons/DoubleArrowLeft.js +4 -7
- package/lib/components/SvgIcon/icons/DoubleArrowRight.js +4 -6
- package/lib/components/SvgIcon/style/index.js +2 -2
- package/lib/hooks/group.d.ts +1 -1
- package/lib/hooks/group.js +5 -9
- package/lib/hooks/useUncontrolled.d.ts +1 -1
- package/lib/hooks/useUncontrolled.js +1 -1
- package/lib/libs/rc-table/Table.js +2 -3
- package/lib/sharedComponents/InputWrap.d.ts +16 -0
- package/lib/sharedComponents/InputWrap.js +66 -0
- package/lib/utils/pick.d.ts +1 -1
- package/package.json +3 -3
|
@@ -250,16 +250,21 @@ var Range = function Range(_ref2) {
|
|
|
250
250
|
var rangeDateValidResult = (0, _utils.isRangeDateValid)(newValue, rules, precision);
|
|
251
251
|
setRangeError(undefined);
|
|
252
252
|
|
|
253
|
-
if (isClear) {
|
|
253
|
+
if (isClear) {
|
|
254
|
+
var _actionRefS$current, _actionRefE$current;
|
|
255
|
+
|
|
256
|
+
onChange(newValue);
|
|
257
|
+
(_actionRefS$current = actionRefS.current) === null || _actionRefS$current === void 0 ? void 0 : _actionRefS$current.hide();
|
|
258
|
+
(_actionRefE$current = actionRefE.current) === null || _actionRefE$current === void 0 ? void 0 : _actionRefE$current.hide();
|
|
254
259
|
} else if (rangeDateValidResult !== true) {
|
|
255
260
|
var _inputRefE$current;
|
|
256
261
|
|
|
257
262
|
(_inputRefE$current = inputRefE.current) === null || _inputRefE$current === void 0 ? void 0 : _inputRefE$current.focus();
|
|
258
263
|
|
|
259
264
|
if (rangeDateValidResult === 'startGreaterThanEnd') {
|
|
260
|
-
var _actionRefE$
|
|
265
|
+
var _actionRefE$current2;
|
|
261
266
|
|
|
262
|
-
(_actionRefE$
|
|
267
|
+
(_actionRefE$current2 = actionRefE.current) === null || _actionRefE$current2 === void 0 ? void 0 : _actionRefE$current2.clear();
|
|
263
268
|
} else {
|
|
264
269
|
setRangeError(locale[rangeDateValidResult + 'Tip']);
|
|
265
270
|
}
|
|
@@ -285,16 +290,21 @@ var Range = function Range(_ref2) {
|
|
|
285
290
|
var rangeDateValidResult = (0, _utils.isRangeDateValid)(newValue, rules, precision);
|
|
286
291
|
setRangeError(undefined);
|
|
287
292
|
|
|
288
|
-
if (isClear) {
|
|
293
|
+
if (isClear) {
|
|
294
|
+
var _actionRefS$current2, _actionRefE$current3;
|
|
295
|
+
|
|
296
|
+
onChange(newValue);
|
|
297
|
+
(_actionRefS$current2 = actionRefS.current) === null || _actionRefS$current2 === void 0 ? void 0 : _actionRefS$current2.hide();
|
|
298
|
+
(_actionRefE$current3 = actionRefE.current) === null || _actionRefE$current3 === void 0 ? void 0 : _actionRefE$current3.hide();
|
|
289
299
|
} else if (rangeDateValidResult !== true) {
|
|
290
300
|
var _inputRefS$current;
|
|
291
301
|
|
|
292
302
|
(_inputRefS$current = inputRefS.current) === null || _inputRefS$current === void 0 ? void 0 : _inputRefS$current.focus();
|
|
293
303
|
|
|
294
304
|
if (rangeDateValidResult === 'startGreaterThanEnd') {
|
|
295
|
-
var _actionRefS$
|
|
305
|
+
var _actionRefS$current3;
|
|
296
306
|
|
|
297
|
-
(_actionRefS$
|
|
307
|
+
(_actionRefS$current3 = actionRefS.current) === null || _actionRefS$current3 === void 0 ? void 0 : _actionRefS$current3.clear();
|
|
298
308
|
} else {
|
|
299
309
|
setRangeError(locale[rangeDateValidResult + 'Tip']);
|
|
300
310
|
}
|
|
@@ -49,7 +49,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
49
49
|
|
|
50
50
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
51
51
|
|
|
52
|
-
var formatInput = function formatInput(v, allFormat) {
|
|
52
|
+
var formatInput = function formatInput(v, allFormat, precision) {
|
|
53
53
|
(0, _newArrowCheck2.default)(this, _this);
|
|
54
54
|
if (v == '') return null;
|
|
55
55
|
var l = allFormat.length;
|
|
@@ -62,7 +62,7 @@ var formatInput = function formatInput(v, allFormat) {
|
|
|
62
62
|
var d = (0, _moment.default)(v, format, true);
|
|
63
63
|
|
|
64
64
|
if (d.isValid()) {
|
|
65
|
-
return d;
|
|
65
|
+
return precision ? d.startOf(precision) : d;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -154,6 +154,15 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
154
154
|
allFormat = _useMemo4[1],
|
|
155
155
|
timeMode = _useMemo4[2];
|
|
156
156
|
|
|
157
|
+
var precision = (0, _react.useMemo)(function () {
|
|
158
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
159
|
+
if (mode === 'month') return 'month';
|
|
160
|
+
if (!(timeMode !== null && timeMode !== void 0 && timeMode.length)) return 'date';
|
|
161
|
+
if (timeMode.indexOf('ss') >= 0) return 'second';
|
|
162
|
+
if (timeMode.indexOf('mm') >= 0) return 'minute';
|
|
163
|
+
if (timeMode.indexOf('HH') >= 0) return 'hour';
|
|
164
|
+
return 'date';
|
|
165
|
+
}.bind(this), [mode, timeMode]);
|
|
157
166
|
var d = (0, _react.useMemo)(function () {
|
|
158
167
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
159
168
|
return new Date();
|
|
@@ -223,7 +232,7 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
223
232
|
var currentValue;
|
|
224
233
|
|
|
225
234
|
if (useInputValue) {
|
|
226
|
-
var inputDValue = formatInput(inputValue, allFormat);
|
|
235
|
+
var inputDValue = formatInput(inputValue, allFormat, precision);
|
|
227
236
|
if (inputDValue === false) return locale.inputErrorTip;
|
|
228
237
|
currentValue = inputDValue;
|
|
229
238
|
} else {
|
|
@@ -237,13 +246,13 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
237
246
|
}
|
|
238
247
|
|
|
239
248
|
return true;
|
|
240
|
-
}.bind(this), [allFormat, calValue, inputValue, locale.dateErrorTip, locale.inputErrorTip, locale.nullableErrorTip, nullable, rules, useInputValue, value]);
|
|
249
|
+
}.bind(this), [allFormat, calValue, inputValue, locale.dateErrorTip, locale.inputErrorTip, locale.nullableErrorTip, nullable, precision, rules, useInputValue, value]);
|
|
241
250
|
var handleInputChange = (0, _react.useCallback)(function (e) {
|
|
242
251
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
243
252
|
if (!visible) setVisible(true);
|
|
244
253
|
var v = e.target.value;
|
|
245
254
|
setInputValue(v);
|
|
246
|
-
var d = formatInput(v, allFormat);
|
|
255
|
+
var d = formatInput(v, allFormat, precision);
|
|
247
256
|
|
|
248
257
|
if (d) {
|
|
249
258
|
setCalValue(d);
|
|
@@ -253,13 +262,17 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
253
262
|
}
|
|
254
263
|
|
|
255
264
|
setUseInputValue(true);
|
|
256
|
-
}.bind(this), [allFormat, calValue, visible]);
|
|
265
|
+
}.bind(this), [allFormat, calValue, precision, visible]);
|
|
257
266
|
var clear = (0, _react.useCallback)(function () {
|
|
258
267
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
259
268
|
setInputValue('');
|
|
260
269
|
setCalValue(null);
|
|
261
270
|
}.bind(this), []);
|
|
262
|
-
var
|
|
271
|
+
var hide = (0, _react.useCallback)(function () {
|
|
272
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
273
|
+
setVisible(false);
|
|
274
|
+
}.bind(this), []);
|
|
275
|
+
var handleConfirm = (0, _react.useCallback)(function (v) {
|
|
263
276
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
264
277
|
var currentValue = v !== undefined ? v : calValue;
|
|
265
278
|
|
|
@@ -270,20 +283,22 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
270
283
|
}
|
|
271
284
|
|
|
272
285
|
onChange && onChange(currentValue ? (0, _moment.default)(+currentValue) : null);
|
|
273
|
-
|
|
274
|
-
if (!dontChangeVisible) {
|
|
275
|
-
setVisible(false);
|
|
276
|
-
}
|
|
286
|
+
setVisible(false);
|
|
277
287
|
}.bind(this), [calValue, nullable, onChange, rules, value]);
|
|
278
288
|
var handleInputClear = (0, _react.useCallback)(function () {
|
|
279
289
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
280
290
|
clear(); // 不走 onChange,区分两种操作
|
|
281
291
|
|
|
282
|
-
|
|
283
|
-
|
|
292
|
+
if (onClear) {
|
|
293
|
+
onClear();
|
|
294
|
+
} else {
|
|
295
|
+
handleConfirm(null);
|
|
296
|
+
}
|
|
297
|
+
}.bind(this), [clear, handleConfirm, onClear]);
|
|
284
298
|
var handleCalendarChange = (0, _react.useCallback)(function (v) {
|
|
285
299
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
286
300
|
v = (0, _utils.getValidDate)(v, rules);
|
|
301
|
+
v = (0, _utils.setPrecision)(v, precision);
|
|
287
302
|
setCalValue((0, _moment.default)(+v));
|
|
288
303
|
setInputValue(formatDate((0, _moment.default)(+v), format));
|
|
289
304
|
setUseInputValue(false);
|
|
@@ -292,7 +307,7 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
292
307
|
onChange && onChange((0, _moment.default)(+v));
|
|
293
308
|
setVisible(false);
|
|
294
309
|
}
|
|
295
|
-
}.bind(this), [clickConfirm, format, onChange, rules]);
|
|
310
|
+
}.bind(this), [clickConfirm, format, onChange, precision, rules]);
|
|
296
311
|
var handleInputFocus = (0, _react.useCallback)(function () {
|
|
297
312
|
var _this3 = this;
|
|
298
313
|
|
|
@@ -400,7 +415,8 @@ var usePicker = function usePicker(props, displayToFormatAndTimeMode, mode, onCl
|
|
|
400
415
|
error: typeof error === 'string' ? error : null,
|
|
401
416
|
active: visible
|
|
402
417
|
}, {
|
|
403
|
-
clear: clear
|
|
418
|
+
clear: clear,
|
|
419
|
+
hide: hide
|
|
404
420
|
}];
|
|
405
421
|
}.bind(void 0);
|
|
406
422
|
|
|
@@ -76,9 +76,10 @@ var useRangePicker = function useRangePicker(_ref) {
|
|
|
76
76
|
(0, _react.useImperativeHandle)(actionRef, function () {
|
|
77
77
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
78
78
|
return {
|
|
79
|
-
clear: actions.clear
|
|
79
|
+
clear: actions.clear,
|
|
80
|
+
hide: actions.hide
|
|
80
81
|
};
|
|
81
|
-
}.bind(this), [actions.clear]);
|
|
82
|
+
}.bind(this), [actions.clear, actions.hide]);
|
|
82
83
|
return [// inputProps
|
|
83
84
|
_objectSpread(_objectSpread({}, inputProps), {}, {
|
|
84
85
|
customStyle: inputCustomStyle,
|
|
@@ -2,12 +2,13 @@ import { Moment } from 'moment';
|
|
|
2
2
|
import { TDate } from '@z-r/calendar';
|
|
3
3
|
import { isDateDisabled, getValidDate } from '../../components/Calendar/utils';
|
|
4
4
|
declare type Range = [TDate | void | null, TDate | void | null];
|
|
5
|
-
declare type Precision = 'second' | 'minute' | 'hour' | 'date' | 'month' | 'year';
|
|
5
|
+
export declare type Precision = 'second' | 'minute' | 'hour' | 'date' | 'month' | 'year';
|
|
6
6
|
export interface Rules {
|
|
7
7
|
range?: Range;
|
|
8
8
|
custom?: (date: Moment, value?: Moment | null) => boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare const formatToShort: (format: string) => string;
|
|
11
|
+
export declare const setPrecision: (v: TDate, precision?: Precision | undefined) => TDate;
|
|
11
12
|
declare const isRangeDateValid: (value: [TDate | null, TDate | null], rules: {
|
|
12
13
|
range?: Range | undefined;
|
|
13
14
|
maxRange?: any;
|
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "getValidDate", {
|
|
|
17
17
|
return _utils.getValidDate;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
exports.isRangeDateValid = exports.isDateValid = exports.formatToShort = void 0;
|
|
20
|
+
exports.isRangeDateValid = exports.isDateValid = exports.setPrecision = exports.formatToShort = void 0;
|
|
21
21
|
|
|
22
22
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
23
23
|
|
|
@@ -36,6 +36,18 @@ var formatToShort = function formatToShort(format) {
|
|
|
36
36
|
|
|
37
37
|
exports.formatToShort = formatToShort;
|
|
38
38
|
|
|
39
|
+
var setPrecision = function setPrecision(v, precision) {
|
|
40
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
41
|
+
|
|
42
|
+
if (precision) {
|
|
43
|
+
v = (0, _moment.default)(+v).startOf(precision);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return v;
|
|
47
|
+
}.bind(void 0);
|
|
48
|
+
|
|
49
|
+
exports.setPrecision = setPrecision;
|
|
50
|
+
|
|
39
51
|
var isRangeDateValid = function isRangeDateValid(value, rules, precision) {
|
|
40
52
|
(0, _newArrowCheck2.default)(this, _this);
|
|
41
53
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const ControllerContext: React.Context<{
|
|
3
|
-
status?: "loading" | "default" | "
|
|
3
|
+
status?: "loading" | "default" | "error" | "success" | "warning" | undefined;
|
|
4
4
|
}>;
|
|
5
5
|
export default ControllerContext;
|
|
@@ -24,8 +24,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
24
24
|
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; }
|
|
25
25
|
|
|
26
26
|
var config = {
|
|
27
|
-
size:
|
|
28
|
-
clearable:
|
|
27
|
+
size: ['sm', 'md', 'lg'],
|
|
28
|
+
clearable: 'boolean',
|
|
29
29
|
disabled: 'boolean',
|
|
30
30
|
block: _interactionDemo.USE_DEFINE,
|
|
31
31
|
status: _interactionDemo.USE_DEFINE,
|
|
@@ -19,16 +19,8 @@ var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/new
|
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
|
-
|
|
24
|
-
var _Icon = _interopRequireDefault(require("../../components/Icon"));
|
|
25
|
-
|
|
26
|
-
var _SvgIcon = _interopRequireDefault(require("../../components/SvgIcon"));
|
|
27
|
-
|
|
28
22
|
var _ControllerContext = _interopRequireDefault(require("../../components/Form/ControllerContext"));
|
|
29
23
|
|
|
30
|
-
var _deprecatedLog = _interopRequireDefault(require("../../utils/deprecatedLog"));
|
|
31
|
-
|
|
32
24
|
var _noop = _interopRequireDefault(require("../../utils/noop"));
|
|
33
25
|
|
|
34
26
|
var _useUncontrolled3 = _interopRequireDefault(require("../../hooks/useUncontrolled"));
|
|
@@ -43,7 +35,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
43
35
|
|
|
44
36
|
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; }
|
|
45
37
|
|
|
46
|
-
var deprecatedLogForIcon = (0, _deprecatedLog.default)('Input icon', 'suffix');
|
|
47
38
|
var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
48
39
|
var _this2 = this;
|
|
49
40
|
|
|
@@ -76,7 +67,7 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
67
|
}.bind(this), []);
|
|
77
68
|
|
|
78
69
|
var _useUncontrolled = (0, _useUncontrolled3.default)(_value, defaultValue || '', _onChange, {
|
|
79
|
-
|
|
70
|
+
getter: valueGetter
|
|
80
71
|
}),
|
|
81
72
|
_useUncontrolled2 = (0, _slicedToArray2.default)(_useUncontrolled, 2),
|
|
82
73
|
value = _useUncontrolled2[0],
|
|
@@ -144,67 +135,22 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
144
135
|
e.preventDefault();
|
|
145
136
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
146
137
|
}.bind(this), []);
|
|
147
|
-
var renderClear = (0, _react.useMemo)(function () {
|
|
148
|
-
(0, _newArrowCheck2.default)(this, _this2);
|
|
149
|
-
|
|
150
|
-
if (clearable) {
|
|
151
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
152
|
-
className: _style.clearCls,
|
|
153
|
-
onClick: handleClear,
|
|
154
|
-
onMouseDown: handleClearMouseDown
|
|
155
|
-
}, /*#__PURE__*/_react.default.createElement(_SvgIcon.default, {
|
|
156
|
-
type: "cross-circle-filled"
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
}.bind(this), [clearable, handleClear, handleClearMouseDown]);
|
|
160
|
-
var renderPrefix = (0, _react.useMemo)(function () {
|
|
161
|
-
(0, _newArrowCheck2.default)(this, _this2);
|
|
162
|
-
return prefix && /*#__PURE__*/_react.default.createElement("span", {
|
|
163
|
-
className: _style.inputPrefixCls
|
|
164
|
-
}, prefix);
|
|
165
|
-
}.bind(this), [prefix]);
|
|
166
|
-
var renderSuffix = (0, _react.useMemo)(function () {
|
|
167
|
-
(0, _newArrowCheck2.default)(this, _this2);
|
|
168
|
-
|
|
169
|
-
if (icon) {
|
|
170
|
-
deprecatedLogForIcon();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
var renderSuffix = null;
|
|
174
|
-
|
|
175
|
-
if (suffix) {
|
|
176
|
-
renderSuffix = suffix;
|
|
177
|
-
} else if (typeof icon === 'string') {
|
|
178
|
-
renderSuffix = /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
179
|
-
type: icon
|
|
180
|
-
});
|
|
181
|
-
} else if ( /*#__PURE__*/_react.default.isValidElement(icon)) {
|
|
182
|
-
renderSuffix = icon;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (renderSuffix) {
|
|
186
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
187
|
-
className: _style.inputSuffixCls
|
|
188
|
-
}, renderSuffix);
|
|
189
|
-
}
|
|
190
|
-
}.bind(this), [icon, suffix]);
|
|
191
138
|
|
|
192
139
|
var _useContext = (0, _react.useContext)(_ControllerContext.default),
|
|
193
140
|
status = _useContext.status;
|
|
194
141
|
|
|
195
|
-
return /*#__PURE__*/_react.default.createElement(_style.
|
|
196
|
-
className: (0, _classnames.default)(block && _style.blockCls, className),
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement(_style.InputWrap, {
|
|
197
143
|
size: size,
|
|
198
144
|
focused: focused,
|
|
199
145
|
style: style,
|
|
200
146
|
disabled: disabled,
|
|
201
147
|
status: _status || status,
|
|
202
148
|
customStyle: customStyle,
|
|
149
|
+
block: block,
|
|
150
|
+
className: className,
|
|
203
151
|
empty: !value,
|
|
204
152
|
onMouseDown: handleWrapMouseDown
|
|
205
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
206
|
-
className: _style.inputWrapCls
|
|
207
|
-
}, renderPrefix, /*#__PURE__*/_react.default.createElement("span", {
|
|
153
|
+
}, /*#__PURE__*/_react.default.createElement(_style.Prefix, null, prefix), /*#__PURE__*/_react.default.createElement("span", {
|
|
208
154
|
className: _style.inputBlockWrapCls
|
|
209
155
|
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, rest, {
|
|
210
156
|
value: value,
|
|
@@ -213,7 +159,13 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
213
159
|
onFocus: handleFocus,
|
|
214
160
|
onBlur: handleBlur,
|
|
215
161
|
disabled: disabled
|
|
216
|
-
})),
|
|
162
|
+
})), /*#__PURE__*/_react.default.createElement(_style.Clear, {
|
|
163
|
+
clearable: clearable,
|
|
164
|
+
onMouseDown: handleClearMouseDown,
|
|
165
|
+
onClick: handleClear
|
|
166
|
+
})), /*#__PURE__*/_react.default.createElement(_style.Suffix, {
|
|
167
|
+
icon: icon
|
|
168
|
+
}, suffix));
|
|
217
169
|
}.bind(void 0));
|
|
218
170
|
|
|
219
171
|
var _default = /*#__PURE__*/_react.default.memo(Input);
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import SvgIcon from '../../../components/SvgIcon';
|
|
3
3
|
import { InputProps } from '../Input';
|
|
4
4
|
export declare const prefixCls: string;
|
|
5
5
|
export declare const focusedCls: string;
|
|
6
6
|
export declare const disabledCls: string;
|
|
7
7
|
export declare const blockCls: string;
|
|
8
|
-
export declare const inputWrapCls: string;
|
|
9
8
|
export declare const inputPrefixCls: string;
|
|
10
9
|
export declare const inputSuffixCls: string;
|
|
11
10
|
export declare const clearCls: string;
|
|
12
11
|
export declare const inputBlockWrapCls: string;
|
|
13
|
-
export declare const SearchIcon: import("@emotion/styled-base").StyledComponent<Pick<any, string | number | symbol> &
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export declare const SearchIcon: import("@emotion/styled-base").StyledComponent<Pick<any, string | number | symbol> & React.RefAttributes<SvgIcon>, Pick<Pick<any, string | number | symbol> & React.RefAttributes<SvgIcon>, string | number | symbol>, object>;
|
|
13
|
+
export declare const Prefix: React.NamedExoticComponent<object>;
|
|
14
|
+
export declare const Suffix: React.NamedExoticComponent<{
|
|
15
|
+
icon?: string | ReactNode;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const Clear: React.NamedExoticComponent<Pick<InputProps, "clearable"> & React.HTMLAttributes<HTMLSpanElement>>;
|
|
19
|
+
export declare const InputPart: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
20
|
+
stretch?: boolean | undefined;
|
|
21
|
+
visible?: boolean | undefined;
|
|
22
|
+
}, object>;
|
|
23
|
+
export declare type InputWrapProps = Pick<InputProps, 'block' | 'disabled' | 'status' | 'customStyle'> & Required<Pick<InputProps, 'size'>> & {
|
|
24
|
+
focused?: boolean;
|
|
25
|
+
empty?: boolean;
|
|
26
|
+
cursor?: CSSProperties['cursor'];
|
|
27
|
+
};
|
|
28
|
+
export declare const InputWrap: React.ForwardRefExoticComponent<Pick<InputProps, "block" | "customStyle" | "disabled" | "status"> & Required<Pick<InputProps, "size">> & {
|
|
29
|
+
focused?: boolean | undefined;
|
|
30
|
+
empty?: boolean | undefined;
|
|
31
|
+
cursor?: CSSProperties['cursor'];
|
|
32
|
+
} & React.HTMLAttributes<HTMLSpanElement> & {
|
|
18
33
|
theme?: import("../../../style").Theme | undefined;
|
|
19
|
-
} &
|
|
34
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|