@douyinfe/semi-ui 2.14.0-beta.2 → 2.15.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/autoComplete/index.tsx +0 -1
- package/cascader/__test__/cascader.test.js +13 -10
- package/cascader/_story/cascader.stories.js +22 -0
- package/cascader/index.tsx +53 -35
- package/checkbox/checkbox.tsx +1 -0
- package/checkbox/checkboxInner.tsx +4 -1
- package/datePicker/__test__/datePicker.test.js +1 -0
- package/datePicker/_story/v2/FixTriggerRender.tsx +36 -0
- package/datePicker/_story/v2/index.js +1 -0
- package/datePicker/datePicker.tsx +7 -5
- package/dist/css/semi.css +39 -11
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +1151 -347
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/dropdown/context.ts +2 -0
- package/dropdown/dropdownItem.tsx +2 -1
- package/dropdown/dropdownMenu.tsx +24 -1
- package/dropdown/index.tsx +10 -2
- package/form/_story/form.stories.tsx +23 -15
- package/form/hoc/withField.tsx +1 -1
- package/form/interface.ts +1 -1
- package/input/__test__/input.test.js +31 -0
- package/input/_story/input.stories.js +24 -1
- package/input/index.tsx +5 -2
- package/input/inputGroup.tsx +7 -6
- package/inputNumber/index.tsx +5 -3
- package/lib/cjs/autoComplete/index.d.ts +0 -1
- package/lib/cjs/autoComplete/index.js +0 -1
- package/lib/cjs/cascader/index.d.ts +1 -1
- package/lib/cjs/cascader/index.js +36 -9
- package/lib/cjs/checkbox/checkbox.d.ts +1 -0
- package/lib/cjs/checkbox/checkbox.js +2 -1
- package/lib/cjs/checkbox/checkboxInner.d.ts +2 -0
- package/lib/cjs/checkbox/checkboxInner.js +8 -2
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.js +21 -6
- package/lib/cjs/dropdown/context.d.ts +2 -0
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +18 -1
- package/lib/cjs/dropdown/dropdownMenu.js +23 -2
- package/lib/cjs/dropdown/index.d.ts +4 -0
- package/lib/cjs/dropdown/index.js +13 -5
- package/lib/cjs/form/baseForm.d.ts +16 -15
- package/lib/cjs/form/field.d.ts +16 -15
- package/lib/cjs/form/hoc/withField.d.ts +1 -1
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/input/index.d.ts +2 -1
- package/lib/cjs/input/index.js +11 -5
- package/lib/cjs/input/inputGroup.js +16 -9
- package/lib/cjs/inputNumber/index.d.ts +1 -0
- package/lib/cjs/inputNumber/index.js +8 -3
- package/lib/cjs/locale/source/de.d.ts +3 -0
- package/lib/cjs/locale/source/de.js +165 -0
- package/lib/cjs/locale/source/fr.d.ts +3 -0
- package/lib/cjs/locale/source/fr.js +165 -0
- package/lib/cjs/locale/source/it.d.ts +3 -0
- package/lib/cjs/locale/source/it.js +165 -0
- package/lib/cjs/modal/ModalContent.d.ts +1 -0
- package/lib/cjs/modal/ModalContent.js +17 -4
- package/lib/cjs/modal/confirm.d.ts +5 -0
- package/lib/cjs/radio/radio.d.ts +2 -0
- package/lib/cjs/radio/radio.js +2 -1
- package/lib/cjs/radio/radioInner.d.ts +2 -0
- package/lib/cjs/radio/radioInner.js +8 -2
- package/lib/cjs/rating/index.d.ts +7 -0
- package/lib/cjs/rating/index.js +135 -68
- package/lib/cjs/rating/item.d.ts +27 -3
- package/lib/cjs/rating/item.js +145 -38
- package/lib/cjs/select/index.d.ts +2 -0
- package/lib/cjs/select/index.js +15 -3
- package/lib/cjs/spin/icon.js +1 -1
- package/lib/cjs/table/Body/index.js +1 -1
- package/lib/cjs/tabs/index.d.ts +1 -0
- package/lib/cjs/tabs/index.js +2 -1
- package/lib/cjs/tabs/interface.d.ts +1 -0
- package/lib/cjs/tag/index.js +4 -5
- package/lib/cjs/tag/interface.d.ts +1 -0
- package/lib/cjs/tagInput/index.d.ts +2 -0
- package/lib/cjs/tagInput/index.js +19 -5
- package/lib/cjs/timePicker/TimeInput.d.ts +2 -1
- package/lib/cjs/timePicker/TimeInput.js +7 -3
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -0
- package/lib/cjs/timePicker/TimePicker.js +2 -1
- package/lib/cjs/timePicker/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.d.ts +2 -0
- package/lib/cjs/tooltip/index.js +12 -4
- package/lib/cjs/tree/index.d.ts +1 -0
- package/lib/cjs/tree/index.js +21 -5
- package/lib/cjs/tree/treeNode.js +15 -19
- package/lib/cjs/treeSelect/index.js +20 -4
- package/lib/es/autoComplete/index.d.ts +0 -1
- package/lib/es/autoComplete/index.js +0 -1
- package/lib/es/cascader/index.d.ts +1 -1
- package/lib/es/cascader/index.js +36 -9
- package/lib/es/checkbox/checkbox.d.ts +1 -0
- package/lib/es/checkbox/checkbox.js +2 -1
- package/lib/es/checkbox/checkboxInner.d.ts +2 -0
- package/lib/es/checkbox/checkboxInner.js +8 -2
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/datePicker.js +21 -6
- package/lib/es/dropdown/context.d.ts +2 -0
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +18 -1
- package/lib/es/dropdown/dropdownMenu.js +21 -2
- package/lib/es/dropdown/index.d.ts +4 -0
- package/lib/es/dropdown/index.js +13 -5
- package/lib/es/form/baseForm.d.ts +16 -15
- package/lib/es/form/field.d.ts +16 -15
- package/lib/es/form/hoc/withField.d.ts +1 -1
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/input/index.d.ts +2 -1
- package/lib/es/input/index.js +11 -5
- package/lib/es/input/inputGroup.js +15 -9
- package/lib/es/inputNumber/index.d.ts +1 -0
- package/lib/es/inputNumber/index.js +8 -3
- package/lib/es/locale/source/de.d.ts +3 -0
- package/lib/es/locale/source/de.js +153 -0
- package/lib/es/locale/source/fr.d.ts +3 -0
- package/lib/es/locale/source/fr.js +153 -0
- package/lib/es/locale/source/it.d.ts +3 -0
- package/lib/es/locale/source/it.js +153 -0
- package/lib/es/modal/ModalContent.d.ts +1 -0
- package/lib/es/modal/ModalContent.js +17 -4
- package/lib/es/modal/confirm.d.ts +5 -0
- package/lib/es/radio/radio.d.ts +2 -0
- package/lib/es/radio/radio.js +2 -1
- package/lib/es/radio/radioInner.d.ts +2 -0
- package/lib/es/radio/radioInner.js +8 -2
- package/lib/es/rating/index.d.ts +7 -0
- package/lib/es/rating/index.js +133 -65
- package/lib/es/rating/item.d.ts +27 -3
- package/lib/es/rating/item.js +145 -32
- package/lib/es/select/index.d.ts +2 -0
- package/lib/es/select/index.js +15 -3
- package/lib/es/spin/icon.js +1 -1
- package/lib/es/table/Body/index.js +1 -1
- package/lib/es/tabs/index.d.ts +1 -0
- package/lib/es/tabs/index.js +2 -1
- package/lib/es/tabs/interface.d.ts +1 -0
- package/lib/es/tag/index.js +4 -5
- package/lib/es/tag/interface.d.ts +1 -0
- package/lib/es/tagInput/index.d.ts +2 -0
- package/lib/es/tagInput/index.js +19 -5
- package/lib/es/timePicker/TimeInput.d.ts +2 -1
- package/lib/es/timePicker/TimeInput.js +7 -3
- package/lib/es/timePicker/TimePicker.d.ts +2 -0
- package/lib/es/timePicker/TimePicker.js +2 -1
- package/lib/es/timePicker/index.d.ts +1 -0
- package/lib/es/tooltip/index.d.ts +2 -0
- package/lib/es/tooltip/index.js +13 -4
- package/lib/es/tree/index.d.ts +1 -0
- package/lib/es/tree/index.js +19 -5
- package/lib/es/tree/treeNode.js +14 -20
- package/lib/es/treeSelect/index.js +18 -4
- package/locale/source/de.ts +156 -0
- package/locale/source/fr.ts +156 -0
- package/locale/source/it.ts +156 -0
- package/modal/ModalContent.tsx +7 -4
- package/package.json +8 -8
- package/radio/radio.tsx +2 -0
- package/radio/radioInner.tsx +4 -1
- package/rating/__test__/rating.test.js +13 -31
- package/rating/_story/rating.stories.js +13 -2
- package/rating/index.tsx +63 -18
- package/rating/item.tsx +141 -26
- package/select/index.tsx +6 -2
- package/spin/icon.tsx +1 -1
- package/table/Body/index.tsx +1 -1
- package/table/_story/v2/FixedVirtualizedEmpty.tsx +76 -0
- package/table/_story/v2/index.js +2 -1
- package/tabs/index.tsx +1 -0
- package/tabs/interface.ts +1 -0
- package/tag/index.tsx +2 -3
- package/tag/interface.ts +1 -0
- package/tagInput/index.tsx +8 -4
- package/timePicker/TimeInput.tsx +5 -3
- package/timePicker/TimePicker.tsx +2 -0
- package/tooltip/index.tsx +7 -2
- package/tree/index.tsx +13 -2
- package/tree/treeNode.tsx +11 -13
- package/treeSelect/_story/treeSelect.stories.js +38 -1
- package/treeSelect/index.tsx +13 -3
- package/upload/_story/upload.stories.tsx +9 -6
|
@@ -433,6 +433,10 @@ class DatePicker extends _baseComponent.default {
|
|
|
433
433
|
motionEnd
|
|
434
434
|
}),
|
|
435
435
|
setRangeInputFocus: rangeInputFocus => {
|
|
436
|
+
const {
|
|
437
|
+
preventScroll
|
|
438
|
+
} = this.props;
|
|
439
|
+
|
|
436
440
|
if (rangeInputFocus !== this.state.rangeInputFocus) {
|
|
437
441
|
this.setState({
|
|
438
442
|
rangeInputFocus
|
|
@@ -442,7 +446,9 @@ class DatePicker extends _baseComponent.default {
|
|
|
442
446
|
switch (rangeInputFocus) {
|
|
443
447
|
case 'rangeStart':
|
|
444
448
|
const inputStartNode = (0, _get2.default)(this, 'rangeInputStartRef.current');
|
|
445
|
-
inputStartNode && inputStartNode.focus(
|
|
449
|
+
inputStartNode && inputStartNode.focus({
|
|
450
|
+
preventScroll
|
|
451
|
+
});
|
|
446
452
|
/**
|
|
447
453
|
* 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
|
|
448
454
|
* 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
|
|
@@ -464,7 +470,9 @@ class DatePicker extends _baseComponent.default {
|
|
|
464
470
|
|
|
465
471
|
case 'rangeEnd':
|
|
466
472
|
const inputEndNode = (0, _get2.default)(this, 'rangeInputEndRef.current');
|
|
467
|
-
inputEndNode && inputEndNode.focus(
|
|
473
|
+
inputEndNode && inputEndNode.focus({
|
|
474
|
+
preventScroll
|
|
475
|
+
});
|
|
468
476
|
/**
|
|
469
477
|
* 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
|
|
470
478
|
* 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
|
|
@@ -491,6 +499,9 @@ class DatePicker extends _baseComponent.default {
|
|
|
491
499
|
couldPanelClosed: () => this.focusRecordsRef.current.rangeStart && this.focusRecordsRef.current.rangeEnd,
|
|
492
500
|
isEventTarget: e => e && e.target === e.currentTarget,
|
|
493
501
|
setInsetInputFocus: () => {
|
|
502
|
+
const {
|
|
503
|
+
preventScroll
|
|
504
|
+
} = this.props;
|
|
494
505
|
const {
|
|
495
506
|
rangeInputFocus
|
|
496
507
|
} = this.state;
|
|
@@ -499,7 +510,9 @@ class DatePicker extends _baseComponent.default {
|
|
|
499
510
|
case 'rangeEnd':
|
|
500
511
|
if (document.activeElement !== this.rangeInputEndRef.current) {
|
|
501
512
|
const inputEndNode = (0, _get2.default)(this, 'rangeInputEndRef.current');
|
|
502
|
-
inputEndNode && inputEndNode.focus(
|
|
513
|
+
inputEndNode && inputEndNode.focus({
|
|
514
|
+
preventScroll
|
|
515
|
+
});
|
|
503
516
|
}
|
|
504
517
|
|
|
505
518
|
break;
|
|
@@ -508,7 +521,9 @@ class DatePicker extends _baseComponent.default {
|
|
|
508
521
|
default:
|
|
509
522
|
if (document.activeElement !== this.rangeInputStartRef.current) {
|
|
510
523
|
const inputStartNode = (0, _get2.default)(this, 'rangeInputStartRef.current');
|
|
511
|
-
inputStartNode && inputStartNode.focus(
|
|
524
|
+
inputStartNode && inputStartNode.focus({
|
|
525
|
+
preventScroll
|
|
526
|
+
});
|
|
512
527
|
}
|
|
513
528
|
|
|
514
529
|
break;
|
|
@@ -824,7 +839,8 @@ DatePicker.propTypes = {
|
|
|
824
839
|
syncSwitchMonth: _propTypes.default.bool,
|
|
825
840
|
// Callback function for panel date switching
|
|
826
841
|
onPanelChange: _propTypes.default.func,
|
|
827
|
-
rangeSeparator: _propTypes.default.string
|
|
842
|
+
rangeSeparator: _propTypes.default.string,
|
|
843
|
+
preventScroll: _propTypes.default.bool
|
|
828
844
|
};
|
|
829
845
|
DatePicker.defaultProps = {
|
|
830
846
|
onChangeWithDateFirst: true,
|
|
@@ -837,7 +853,6 @@ DatePicker.defaultProps = {
|
|
|
837
853
|
type: 'date',
|
|
838
854
|
size: 'default',
|
|
839
855
|
density: 'default',
|
|
840
|
-
disabled: false,
|
|
841
856
|
multiple: false,
|
|
842
857
|
defaultOpen: false,
|
|
843
858
|
disabledHours: _noop2.default,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TooltipProps } from '../tooltip/index';
|
|
2
3
|
export interface DropdownContextType {
|
|
3
4
|
level?: number;
|
|
4
5
|
showTick?: boolean;
|
|
6
|
+
trigger?: TooltipProps['trigger'];
|
|
5
7
|
}
|
|
6
8
|
declare const DropdownContext: React.Context<DropdownContextType>;
|
|
7
9
|
export default DropdownContext;
|
|
@@ -97,7 +97,9 @@ class DropdownItem extends _baseComponent.default {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return /*#__PURE__*/_react.default.createElement("li", (0, _assign.default)({
|
|
100
|
-
role: "menuitem"
|
|
100
|
+
role: "menuitem",
|
|
101
|
+
tabIndex: -1,
|
|
102
|
+
"aria-disabled": disabled
|
|
101
103
|
}, events, {
|
|
102
104
|
ref: ref => forwardRef(ref),
|
|
103
105
|
className: itemclass,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
4
|
export declare type DropdownMenuProps = BaseProps;
|
|
@@ -8,6 +8,23 @@ declare class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
8
8
|
className: PropTypes.Requireable<string>;
|
|
9
9
|
style: PropTypes.Requireable<object>;
|
|
10
10
|
};
|
|
11
|
+
static contextType: React.Context<import("./context").DropdownContextType>;
|
|
12
|
+
menuRef: React.RefObject<HTMLUListElement>;
|
|
13
|
+
constructor(props: DropdownMenuProps);
|
|
14
|
+
get adapter(): {
|
|
15
|
+
getContext(key: string): any;
|
|
16
|
+
getContexts(): any;
|
|
17
|
+
getProp(key: string): any;
|
|
18
|
+
getProps(): BaseProps;
|
|
19
|
+
getState(key: string): any;
|
|
20
|
+
getStates(): {};
|
|
21
|
+
setState(s: Pick<{}, never>, callback?: any): void;
|
|
22
|
+
getCache(c: string): any;
|
|
23
|
+
getCaches(): any;
|
|
24
|
+
setCache(key: any, value: any): void;
|
|
25
|
+
stopPropagation(e: any): void;
|
|
26
|
+
};
|
|
27
|
+
componentDidMount(): void;
|
|
11
28
|
render(): JSX.Element;
|
|
12
29
|
}
|
|
13
30
|
export default DropdownMenu;
|
|
@@ -24,6 +24,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
24
24
|
|
|
25
25
|
var _constants = require("@douyinfe/semi-foundation/lib/cjs/dropdown/constants");
|
|
26
26
|
|
|
27
|
+
var _menuFoundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/dropdown/menuFoundation"));
|
|
28
|
+
|
|
29
|
+
var _context = _interopRequireDefault(require("./context"));
|
|
30
|
+
|
|
27
31
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
28
32
|
|
|
29
33
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
@@ -40,6 +44,20 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
40
44
|
const prefixCls = _constants.cssClasses.PREFIX;
|
|
41
45
|
|
|
42
46
|
class DropdownMenu extends _baseComponent.default {
|
|
47
|
+
constructor(props) {
|
|
48
|
+
super(props);
|
|
49
|
+
this.menuRef = /*#__PURE__*/_react.default.createRef();
|
|
50
|
+
this.foundation = new _menuFoundation.default(this.adapter);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get adapter() {
|
|
54
|
+
return (0, _assign.default)({}, super.adapter);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
this.foundation.autoFocus(this.menuRef.current);
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
render() {
|
|
44
62
|
const _a = this.props,
|
|
45
63
|
{
|
|
@@ -51,10 +69,12 @@ class DropdownMenu extends _baseComponent.default {
|
|
|
51
69
|
|
|
52
70
|
return /*#__PURE__*/_react.default.createElement("ul", (0, _assign.default)({
|
|
53
71
|
role: "menu",
|
|
54
|
-
"aria-orientation": "vertical"
|
|
72
|
+
"aria-orientation": "vertical",
|
|
73
|
+
ref: this.menuRef
|
|
55
74
|
}, rest, {
|
|
56
75
|
className: (0, _classnames.default)("".concat(prefixCls, "-menu"), className),
|
|
57
|
-
style: style
|
|
76
|
+
style: style,
|
|
77
|
+
onKeyDown: e => this.foundation.onMenuKeydown(e)
|
|
58
78
|
}), children);
|
|
59
79
|
}
|
|
60
80
|
|
|
@@ -65,5 +85,6 @@ DropdownMenu.propTypes = {
|
|
|
65
85
|
className: _propTypes.default.string,
|
|
66
86
|
style: _propTypes.default.object
|
|
67
87
|
};
|
|
88
|
+
DropdownMenu.contextType = _context.default;
|
|
68
89
|
var _default = DropdownMenu;
|
|
69
90
|
exports.default = _default;
|
|
@@ -43,6 +43,8 @@ export interface DropdownProps extends TooltipProps {
|
|
|
43
43
|
onVisibleChange?: (visible: boolean) => void;
|
|
44
44
|
rePosKey?: string | number;
|
|
45
45
|
showTick?: boolean;
|
|
46
|
+
closeOnEsc?: TooltipProps['closeOnEsc'];
|
|
47
|
+
onEscKeyDown?: TooltipProps['onEscKeyDown'];
|
|
46
48
|
}
|
|
47
49
|
interface DropdownState {
|
|
48
50
|
popVisible: boolean;
|
|
@@ -83,6 +85,8 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
83
85
|
position: string;
|
|
84
86
|
mouseLeaveDelay: number;
|
|
85
87
|
showTick: boolean;
|
|
88
|
+
closeOnEsc: boolean;
|
|
89
|
+
onEscKeyDown: (...args: any[]) => void;
|
|
86
90
|
};
|
|
87
91
|
constructor(props: DropdownProps);
|
|
88
92
|
context: DropdownContextType;
|
|
@@ -94,7 +94,8 @@ class Dropdown extends _baseComponent.default {
|
|
|
94
94
|
contentClassName,
|
|
95
95
|
style,
|
|
96
96
|
showTick,
|
|
97
|
-
prefixCls
|
|
97
|
+
prefixCls,
|
|
98
|
+
trigger
|
|
98
99
|
} = this.props;
|
|
99
100
|
const className = (0, _classnames.default)(prefixCls, contentClassName);
|
|
100
101
|
const {
|
|
@@ -102,7 +103,8 @@ class Dropdown extends _baseComponent.default {
|
|
|
102
103
|
} = this.context;
|
|
103
104
|
const contextValue = {
|
|
104
105
|
showTick,
|
|
105
|
-
level: level + 1
|
|
106
|
+
level: level + 1,
|
|
107
|
+
trigger
|
|
106
108
|
};
|
|
107
109
|
let content = null;
|
|
108
110
|
|
|
@@ -237,11 +239,15 @@ class Dropdown extends _baseComponent.default {
|
|
|
237
239
|
position: position,
|
|
238
240
|
trigger: trigger,
|
|
239
241
|
onVisibleChange: this.handleVisibleChange,
|
|
240
|
-
showArrow: false
|
|
242
|
+
showArrow: false,
|
|
243
|
+
returnFocusOnClose: true
|
|
241
244
|
}, attr), /*#__PURE__*/_react.default.isValidElement(children) ? /*#__PURE__*/_react.default.cloneElement(children, {
|
|
242
245
|
className: (0, _classnames.default)((0, _get2.default)(children, 'props.className'), {
|
|
243
246
|
["".concat(prefixCls, "-showing")]: popVisible
|
|
244
|
-
})
|
|
247
|
+
}),
|
|
248
|
+
'aria-haspopup': true,
|
|
249
|
+
'aria-expanded': popVisible,
|
|
250
|
+
onKeyDown: e => this.foundation.handleKeyDown(e)
|
|
245
251
|
}) : children);
|
|
246
252
|
}
|
|
247
253
|
|
|
@@ -281,7 +287,9 @@ Dropdown.defaultProps = {
|
|
|
281
287
|
trigger: 'hover',
|
|
282
288
|
position: 'bottom',
|
|
283
289
|
mouseLeaveDelay: _constants.strings.DEFAULT_LEAVE_DELAY,
|
|
284
|
-
showTick: false
|
|
290
|
+
showTick: false,
|
|
291
|
+
closeOnEsc: true,
|
|
292
|
+
onEscKeyDown: _noop2.default
|
|
285
293
|
};
|
|
286
294
|
var _default = Dropdown;
|
|
287
295
|
exports.default = _default;
|
|
@@ -51,9 +51,9 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
51
51
|
autoScrollToError: boolean;
|
|
52
52
|
showValidateIcon: boolean;
|
|
53
53
|
};
|
|
54
|
-
static Input: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").InputProps, "forwardRef"> & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
55
|
-
static TextArea: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").TextAreaProps, "forwardRef"> & React.RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
56
|
-
static InputNumber: React.ComponentType<import("utility-types").Subtract<import("../inputNumber").InputNumberProps & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
54
|
+
static Input: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").InputProps, "forwardRef"> & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
55
|
+
static TextArea: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").TextAreaProps, "forwardRef"> & React.RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
56
|
+
static InputNumber: React.ComponentType<import("utility-types").Subtract<import("../inputNumber").InputNumberProps & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
57
57
|
static Select: React.ComponentType<import("utility-types").Subtract<{
|
|
58
58
|
'aria-describedby'?: string;
|
|
59
59
|
'aria-errormessage'?: string;
|
|
@@ -125,21 +125,22 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
125
125
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
126
126
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
127
127
|
children?: React.ReactNode;
|
|
128
|
+
preventScroll?: boolean;
|
|
128
129
|
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
129
130
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
130
|
-
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
131
|
+
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
131
132
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
|
132
|
-
static RadioGroup: React.ComponentType<import("utility-types").Subtract<import("../radio").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
133
|
-
static DatePicker: React.ComponentType<import("utility-types").Subtract<import("../datePicker").DatePickerProps & React.RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
134
|
-
static TimePicker: React.ComponentType<import("utility-types").Subtract<import("../timePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
135
|
-
static Switch: React.ComponentType<import("utility-types").Subtract<import("../switch").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
136
|
-
static Slider: React.ComponentType<import("utility-types").Subtract<import("../slider").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
137
|
-
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
138
|
-
static Cascader: React.ComponentType<import("utility-types").Subtract<import("../cascader").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
139
|
-
static Rating: React.ComponentType<import("utility-types").Subtract<import("../rating").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
140
|
-
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
141
|
-
static Upload: React.ComponentType<import("utility-types").Subtract<import("../upload").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
142
|
-
static TagInput: React.ComponentType<import("utility-types").Subtract<import("../tagInput").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
133
|
+
static RadioGroup: React.ComponentType<import("utility-types").Subtract<import("../radio").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
134
|
+
static DatePicker: React.ComponentType<import("utility-types").Subtract<import("../datePicker").DatePickerProps & React.RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
135
|
+
static TimePicker: React.ComponentType<import("utility-types").Subtract<import("../timePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
136
|
+
static Switch: React.ComponentType<import("utility-types").Subtract<import("../switch").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
137
|
+
static Slider: React.ComponentType<import("utility-types").Subtract<import("../slider").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
138
|
+
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
139
|
+
static Cascader: React.ComponentType<import("utility-types").Subtract<import("../cascader").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
140
|
+
static Rating: React.ComponentType<import("utility-types").Subtract<import("../rating").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
141
|
+
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
142
|
+
static Upload: React.ComponentType<import("utility-types").Subtract<import("../upload").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
143
|
+
static TagInput: React.ComponentType<import("utility-types").Subtract<import("../tagInput").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
|
|
143
144
|
static Slot: (props: import("./slot").SlotProps) => JSX.Element;
|
|
144
145
|
static ErrorMessage: typeof ErrorMessage;
|
|
145
146
|
static InputGroup: typeof FormInputGroup;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const FormInput: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/index").InputProps, "forwardRef"> & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
3
|
-
declare const FormInputNumber: import("react").ComponentType<import("utility-types").Subtract<import("../inputNumber/index").InputNumberProps & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
4
|
-
declare const FormTextArea: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/textarea").TextAreaProps, "forwardRef"> & import("react").RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
2
|
+
declare const FormInput: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/index").InputProps, "forwardRef"> & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
3
|
+
declare const FormInputNumber: import("react").ComponentType<import("utility-types").Subtract<import("../inputNumber/index").InputNumberProps & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
4
|
+
declare const FormTextArea: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/textarea").TextAreaProps, "forwardRef"> & import("react").RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
5
5
|
declare const FormSelect: import("react").ComponentType<import("utility-types").Subtract<{
|
|
6
6
|
'aria-describedby'?: string;
|
|
7
7
|
'aria-errormessage'?: string;
|
|
@@ -73,19 +73,20 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
73
73
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
74
74
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
75
75
|
children?: import("react").ReactNode;
|
|
76
|
+
preventScroll?: boolean;
|
|
76
77
|
} & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
77
|
-
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
78
|
+
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
78
79
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
79
|
-
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
80
|
+
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
80
81
|
declare const FormRadio: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio/radio").RadioProps & import("./interface").RCIncludeType>;
|
|
81
|
-
declare const FormDatePicker: import("react").ComponentType<import("utility-types").Subtract<import("../datePicker/datePicker").DatePickerProps & import("react").RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
82
|
-
declare const FormSwitch: import("react").ComponentType<import("utility-types").Subtract<import("../switch/index").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
83
|
-
declare const FormSlider: import("react").ComponentType<import("utility-types").Subtract<import("../slider/index").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
84
|
-
declare const FormTimePicker: import("react").ComponentType<import("utility-types").Subtract<import("../timePicker/TimePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
85
|
-
declare const FormTreeSelect: import("react").ComponentType<import("utility-types").Subtract<import("../treeSelect/index").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
86
|
-
declare const FormCascader: import("react").ComponentType<import("utility-types").Subtract<import("../cascader/index").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
87
|
-
declare const FormRating: import("react").ComponentType<import("utility-types").Subtract<import("../rating/index").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
88
|
-
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
89
|
-
declare const FormUpload: import("react").ComponentType<import("utility-types").Subtract<import("../upload/index").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
90
|
-
declare const FormTagInput: import("react").ComponentType<import("utility-types").Subtract<import("../tagInput/index").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps
|
|
82
|
+
declare const FormDatePicker: import("react").ComponentType<import("utility-types").Subtract<import("../datePicker/datePicker").DatePickerProps & import("react").RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
83
|
+
declare const FormSwitch: import("react").ComponentType<import("utility-types").Subtract<import("../switch/index").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
84
|
+
declare const FormSlider: import("react").ComponentType<import("utility-types").Subtract<import("../slider/index").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
85
|
+
declare const FormTimePicker: import("react").ComponentType<import("utility-types").Subtract<import("../timePicker/TimePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
86
|
+
declare const FormTreeSelect: import("react").ComponentType<import("utility-types").Subtract<import("../treeSelect/index").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
87
|
+
declare const FormCascader: import("react").ComponentType<import("utility-types").Subtract<import("../cascader/index").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
88
|
+
declare const FormRating: import("react").ComponentType<import("utility-types").Subtract<import("../rating/index").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
89
|
+
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
90
|
+
declare const FormUpload: import("react").ComponentType<import("utility-types").Subtract<import("../upload/index").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
|
+
declare const FormTagInput: import("react").ComponentType<import("utility-types").Subtract<import("../tagInput/index").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
|
|
91
92
|
export { FormInput, FormInputNumber, FormTextArea, FormSelect, FormCheckboxGroup, FormCheckbox, FormRadioGroup, FormRadio, FormDatePicker, FormSwitch, FormSlider, FormTimePicker, FormTreeSelect, FormCascader, FormRating, FormAutoComplete, FormUpload, FormTagInput };
|
|
@@ -8,5 +8,5 @@ import { Subtract } from 'utility-types';
|
|
|
8
8
|
* 2. Insert <Label>
|
|
9
9
|
* 3. Insert <ErrorMessage>
|
|
10
10
|
*/
|
|
11
|
-
declare function withField<C extends React.ElementType, T extends Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps
|
|
11
|
+
declare function withField<C extends React.ElementType, T extends Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps & React.RefAttributes<any>, R extends React.ComponentType<T>>(Component: C, opts?: WithFieldOption): R;
|
|
12
12
|
export default withField;
|
|
@@ -68,7 +68,7 @@ export interface SelectStatic {
|
|
|
68
68
|
Option: typeof Option;
|
|
69
69
|
OptGroup: typeof OptGroup;
|
|
70
70
|
}
|
|
71
|
-
export declare class Field<P> extends React.Component<Subtract<P & CommonFieldProps, CommonexcludeType>> {
|
|
71
|
+
export declare class Field<P> extends React.Component<Subtract<P & CommonFieldProps, CommonexcludeType> & React.RefAttributes<any>> {
|
|
72
72
|
}
|
|
73
73
|
export declare let FormSelectType: React.ComponentType<Subtract<SelectProps & CommonFieldProps, CommonexcludeType>> & SelectStatic;
|
|
74
74
|
export declare let FormCheckboxType: React.ComponentType<Subtract<CommonFieldProps, RadioCheckboxExcludeProps> & CheckboxProps & RCIncludeType>;
|
package/lib/cjs/input/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
47
47
|
inputStyle?: React.CSSProperties;
|
|
48
48
|
getValueLength?: (value: string) => number;
|
|
49
49
|
forwardRef?: ((instance: any) => void) | React.MutableRefObject<any> | null;
|
|
50
|
+
preventScroll?: boolean;
|
|
50
51
|
}
|
|
51
52
|
export interface InputState {
|
|
52
53
|
value: React.ReactText;
|
|
@@ -98,13 +99,13 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
98
99
|
insetLabelId: PropTypes.Requireable<string>;
|
|
99
100
|
inputStyle: PropTypes.Requireable<object>;
|
|
100
101
|
getValueLength: PropTypes.Requireable<(...args: any[]) => any>;
|
|
102
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
101
103
|
};
|
|
102
104
|
static defaultProps: {
|
|
103
105
|
addonBefore: string;
|
|
104
106
|
addonAfter: string;
|
|
105
107
|
prefix: string;
|
|
106
108
|
suffix: string;
|
|
107
|
-
disabled: boolean;
|
|
108
109
|
readonly: boolean;
|
|
109
110
|
type: string;
|
|
110
111
|
showClear: boolean;
|
package/lib/cjs/input/index.js
CHANGED
|
@@ -138,10 +138,15 @@ class Input extends _baseComponent.default {
|
|
|
138
138
|
eyeClosed: value
|
|
139
139
|
}),
|
|
140
140
|
toggleFocusing: isFocus => {
|
|
141
|
+
const {
|
|
142
|
+
preventScroll
|
|
143
|
+
} = this.props;
|
|
141
144
|
const input = this.inputRef && this.inputRef.current;
|
|
142
145
|
|
|
143
146
|
if (isFocus) {
|
|
144
|
-
input && input.focus(
|
|
147
|
+
input && input.focus({
|
|
148
|
+
preventScroll
|
|
149
|
+
});
|
|
145
150
|
} else {
|
|
146
151
|
input && input.blur();
|
|
147
152
|
}
|
|
@@ -383,9 +388,10 @@ class Input extends _baseComponent.default {
|
|
|
383
388
|
inputStyle,
|
|
384
389
|
forwardRef,
|
|
385
390
|
maxLength,
|
|
386
|
-
getValueLength
|
|
391
|
+
getValueLength,
|
|
392
|
+
preventScroll
|
|
387
393
|
} = _a,
|
|
388
|
-
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength"]);
|
|
394
|
+
rest = __rest(_a, ["addonAfter", "addonBefore", "autofocus", "className", "disabled", "defaultValue", "placeholder", "prefix", "mode", "insetLabel", "insetLabelId", "validateStatus", "type", "readonly", "size", "suffix", "style", "showClear", "onEnterPress", "onClear", "hideSuffix", "inputStyle", "forwardRef", "maxLength", "getValueLength", "preventScroll"]);
|
|
389
395
|
|
|
390
396
|
const {
|
|
391
397
|
value,
|
|
@@ -510,14 +516,14 @@ Input.propTypes = {
|
|
|
510
516
|
insetLabel: _propTypes.default.node,
|
|
511
517
|
insetLabelId: _propTypes.default.string,
|
|
512
518
|
inputStyle: _propTypes.default.object,
|
|
513
|
-
getValueLength: _propTypes.default.func
|
|
519
|
+
getValueLength: _propTypes.default.func,
|
|
520
|
+
preventScroll: _propTypes.default.bool
|
|
514
521
|
};
|
|
515
522
|
Input.defaultProps = {
|
|
516
523
|
addonBefore: '',
|
|
517
524
|
addonAfter: '',
|
|
518
525
|
prefix: '',
|
|
519
526
|
suffix: '',
|
|
520
|
-
disabled: false,
|
|
521
527
|
readonly: false,
|
|
522
528
|
type: 'text',
|
|
523
529
|
showClear: false,
|
|
@@ -24,6 +24,8 @@ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
24
24
|
|
|
25
25
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
26
26
|
|
|
27
|
+
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
28
|
+
|
|
27
29
|
var _react = _interopRequireDefault(require("react"));
|
|
28
30
|
|
|
29
31
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -104,9 +106,10 @@ class inputGroup extends _baseComponent.default {
|
|
|
104
106
|
children,
|
|
105
107
|
label,
|
|
106
108
|
onBlur: groupOnBlur,
|
|
107
|
-
onFocus: groupOnFocus
|
|
109
|
+
onFocus: groupOnFocus,
|
|
110
|
+
disabled: groupDisabled
|
|
108
111
|
} = _a,
|
|
109
|
-
rest = __rest(_a, ["size", "style", "className", "children", "label", "onBlur", "onFocus"]);
|
|
112
|
+
rest = __rest(_a, ["size", "style", "className", "children", "label", "onBlur", "onFocus", "disabled"]);
|
|
110
113
|
|
|
111
114
|
const groupCls = (0, _classnames.default)("".concat(prefixCls, "-group"), {
|
|
112
115
|
[(0, _concat.default)(_context2 = "".concat(prefixCls, "-")).call(_context2, size)]: size !== 'default'
|
|
@@ -120,16 +123,20 @@ class inputGroup extends _baseComponent.default {
|
|
|
120
123
|
if (item) {
|
|
121
124
|
const {
|
|
122
125
|
onBlur: itemOnBlur,
|
|
123
|
-
onFocus: itemOnFocus
|
|
126
|
+
onFocus: itemOnFocus,
|
|
127
|
+
disabled: itemDisabled
|
|
124
128
|
} = item.props;
|
|
125
|
-
const onBlur = (0, _isFunction2.default)(itemOnBlur) ? itemOnBlur : groupOnBlur;
|
|
126
|
-
const onFocus = (0, _isFunction2.default)(itemOnFocus) ? itemOnFocus : groupOnFocus;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
const onBlur = (0, _isFunction2.default)(itemOnBlur) && (0, _get2.default)(itemOnBlur, 'name') !== 'noop' ? itemOnBlur : groupOnBlur;
|
|
130
|
+
const onFocus = (0, _isFunction2.default)(itemOnFocus) && (0, _get2.default)(itemOnFocus, 'name') !== 'noop' ? itemOnFocus : groupOnFocus;
|
|
131
|
+
const disabled = typeof itemDisabled === 'boolean' ? itemDisabled : groupDisabled;
|
|
132
|
+
return /*#__PURE__*/_react.default.cloneElement(item, (0, _assign.default)((0, _assign.default)({
|
|
133
|
+
key: index
|
|
134
|
+
}, rest), {
|
|
129
135
|
size,
|
|
130
136
|
onBlur,
|
|
131
|
-
onFocus
|
|
132
|
-
|
|
137
|
+
onFocus,
|
|
138
|
+
disabled
|
|
139
|
+
}));
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
return null;
|
|
@@ -68,6 +68,7 @@ declare class InputNumber extends BaseComponent<InputNumberProps, InputNumberSta
|
|
|
68
68
|
prefixCls: PropTypes.Requireable<string>;
|
|
69
69
|
pressInterval: PropTypes.Requireable<number>;
|
|
70
70
|
pressTimeout: PropTypes.Requireable<number>;
|
|
71
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
71
72
|
shiftStep: PropTypes.Requireable<number>;
|
|
72
73
|
step: PropTypes.Requireable<number>;
|
|
73
74
|
style: PropTypes.Requireable<object>;
|
|
@@ -62,6 +62,8 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
62
62
|
}
|
|
63
63
|
return t;
|
|
64
64
|
};
|
|
65
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
66
|
+
|
|
65
67
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
66
68
|
|
|
67
69
|
/* eslint-disable no-unused-vars */
|
|
@@ -307,7 +309,8 @@ class InputNumber extends _baseComponent.default {
|
|
|
307
309
|
|
|
308
310
|
componentDidUpdate(prevProps) {
|
|
309
311
|
const {
|
|
310
|
-
value
|
|
312
|
+
value,
|
|
313
|
+
preventScroll
|
|
311
314
|
} = this.props;
|
|
312
315
|
const {
|
|
313
316
|
focusing
|
|
@@ -422,7 +425,9 @@ class InputNumber extends _baseComponent.default {
|
|
|
422
425
|
|
|
423
426
|
if (this.props.keepFocus && this.state.focusing) {
|
|
424
427
|
if (document.activeElement !== this.inputNode) {
|
|
425
|
-
this.inputNode.focus(
|
|
428
|
+
this.inputNode.focus({
|
|
429
|
+
preventScroll
|
|
430
|
+
});
|
|
426
431
|
}
|
|
427
432
|
}
|
|
428
433
|
}
|
|
@@ -534,6 +539,7 @@ InputNumber.propTypes = {
|
|
|
534
539
|
prefixCls: _propTypes.default.string,
|
|
535
540
|
pressInterval: _propTypes.default.number,
|
|
536
541
|
pressTimeout: _propTypes.default.number,
|
|
542
|
+
preventScroll: _propTypes.default.bool,
|
|
537
543
|
shiftStep: _propTypes.default.number,
|
|
538
544
|
step: _propTypes.default.number,
|
|
539
545
|
style: _propTypes.default.object,
|
|
@@ -547,7 +553,6 @@ InputNumber.propTypes = {
|
|
|
547
553
|
onUpClick: _propTypes.default.func
|
|
548
554
|
};
|
|
549
555
|
InputNumber.defaultProps = {
|
|
550
|
-
disabled: false,
|
|
551
556
|
forwardedRef: _noop2.default,
|
|
552
557
|
innerButtons: false,
|
|
553
558
|
keepFocus: false,
|