@douyinfe/semi-ui 2.14.0 → 2.15.0-beta.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/datePicker.tsx +7 -5
- package/dist/css/semi.css +34 -6
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +1089 -329
- 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/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 +9 -2
- package/lib/cjs/tree/treeNode.js +12 -18
- package/lib/cjs/treeSelect/index.js +8 -1
- 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/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 +9 -2
- package/lib/es/tree/treeNode.js +11 -19
- package/lib/es/treeSelect/index.js +8 -1
- 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/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 +3 -1
- package/tree/treeNode.tsx +9 -12
- package/treeSelect/index.tsx +4 -1
- package/upload/_story/upload.stories.tsx +9 -6
|
@@ -15,7 +15,12 @@ class CheckboxInner extends PureComponent {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
focus() {
|
|
18
|
-
|
|
18
|
+
const {
|
|
19
|
+
preventScroll
|
|
20
|
+
} = this.props;
|
|
21
|
+
this.inputEntity.focus({
|
|
22
|
+
preventScroll
|
|
23
|
+
});
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
render() {
|
|
@@ -93,7 +98,8 @@ CheckboxInner.propTypes = {
|
|
|
93
98
|
extraId: PropTypes.string,
|
|
94
99
|
focusInner: PropTypes.bool,
|
|
95
100
|
onInputFocus: PropTypes.func,
|
|
96
|
-
onInputBlur: PropTypes.func
|
|
101
|
+
onInputBlur: PropTypes.func,
|
|
102
|
+
preventScroll: PropTypes.bool
|
|
97
103
|
};
|
|
98
104
|
CheckboxInner.defaultProps = {
|
|
99
105
|
onChange: _noop
|
|
@@ -103,6 +103,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
103
103
|
syncSwitchMonth: PropTypes.Requireable<boolean>;
|
|
104
104
|
onPanelChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
105
105
|
rangeSeparator: PropTypes.Requireable<string>;
|
|
106
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
106
107
|
};
|
|
107
108
|
static defaultProps: {
|
|
108
109
|
onChangeWithDateFirst: boolean;
|
|
@@ -114,7 +115,6 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
114
115
|
type: string;
|
|
115
116
|
size: string;
|
|
116
117
|
density: string;
|
|
117
|
-
disabled: boolean;
|
|
118
118
|
multiple: boolean;
|
|
119
119
|
defaultOpen: boolean;
|
|
120
120
|
disabledHours: (...args: any[]) => void;
|
|
@@ -395,6 +395,10 @@ export default class DatePicker extends BaseComponent {
|
|
|
395
395
|
motionEnd
|
|
396
396
|
}),
|
|
397
397
|
setRangeInputFocus: rangeInputFocus => {
|
|
398
|
+
const {
|
|
399
|
+
preventScroll
|
|
400
|
+
} = this.props;
|
|
401
|
+
|
|
398
402
|
if (rangeInputFocus !== this.state.rangeInputFocus) {
|
|
399
403
|
this.setState({
|
|
400
404
|
rangeInputFocus
|
|
@@ -405,7 +409,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
405
409
|
case 'rangeStart':
|
|
406
410
|
const inputStartNode = _get(this, 'rangeInputStartRef.current');
|
|
407
411
|
|
|
408
|
-
inputStartNode && inputStartNode.focus(
|
|
412
|
+
inputStartNode && inputStartNode.focus({
|
|
413
|
+
preventScroll
|
|
414
|
+
});
|
|
409
415
|
/**
|
|
410
416
|
* 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
|
|
411
417
|
* 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
|
|
@@ -429,7 +435,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
429
435
|
case 'rangeEnd':
|
|
430
436
|
const inputEndNode = _get(this, 'rangeInputEndRef.current');
|
|
431
437
|
|
|
432
|
-
inputEndNode && inputEndNode.focus(
|
|
438
|
+
inputEndNode && inputEndNode.focus({
|
|
439
|
+
preventScroll
|
|
440
|
+
});
|
|
433
441
|
/**
|
|
434
442
|
* 解决选择完startDate,切换到endDate后panel被立马关闭的问题。
|
|
435
443
|
* 用户打开panel,选了startDate后,会执行setRangeInputFocus('rangeEnd'),focus到endDateInput,
|
|
@@ -457,6 +465,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
457
465
|
couldPanelClosed: () => this.focusRecordsRef.current.rangeStart && this.focusRecordsRef.current.rangeEnd,
|
|
458
466
|
isEventTarget: e => e && e.target === e.currentTarget,
|
|
459
467
|
setInsetInputFocus: () => {
|
|
468
|
+
const {
|
|
469
|
+
preventScroll
|
|
470
|
+
} = this.props;
|
|
460
471
|
const {
|
|
461
472
|
rangeInputFocus
|
|
462
473
|
} = this.state;
|
|
@@ -466,7 +477,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
466
477
|
if (document.activeElement !== this.rangeInputEndRef.current) {
|
|
467
478
|
const inputEndNode = _get(this, 'rangeInputEndRef.current');
|
|
468
479
|
|
|
469
|
-
inputEndNode && inputEndNode.focus(
|
|
480
|
+
inputEndNode && inputEndNode.focus({
|
|
481
|
+
preventScroll
|
|
482
|
+
});
|
|
470
483
|
}
|
|
471
484
|
|
|
472
485
|
break;
|
|
@@ -476,7 +489,9 @@ export default class DatePicker extends BaseComponent {
|
|
|
476
489
|
if (document.activeElement !== this.rangeInputStartRef.current) {
|
|
477
490
|
const inputStartNode = _get(this, 'rangeInputStartRef.current');
|
|
478
491
|
|
|
479
|
-
inputStartNode && inputStartNode.focus(
|
|
492
|
+
inputStartNode && inputStartNode.focus({
|
|
493
|
+
preventScroll
|
|
494
|
+
});
|
|
480
495
|
}
|
|
481
496
|
|
|
482
497
|
break;
|
|
@@ -791,7 +806,8 @@ DatePicker.propTypes = {
|
|
|
791
806
|
syncSwitchMonth: PropTypes.bool,
|
|
792
807
|
// Callback function for panel date switching
|
|
793
808
|
onPanelChange: PropTypes.func,
|
|
794
|
-
rangeSeparator: PropTypes.string
|
|
809
|
+
rangeSeparator: PropTypes.string,
|
|
810
|
+
preventScroll: PropTypes.bool
|
|
795
811
|
};
|
|
796
812
|
DatePicker.defaultProps = {
|
|
797
813
|
onChangeWithDateFirst: true,
|
|
@@ -804,7 +820,6 @@ DatePicker.defaultProps = {
|
|
|
804
820
|
type: 'date',
|
|
805
821
|
size: 'default',
|
|
806
822
|
density: 'default',
|
|
807
|
-
disabled: false,
|
|
808
823
|
multiple: false,
|
|
809
824
|
defaultOpen: false,
|
|
810
825
|
disabledHours: _noop,
|
|
@@ -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;
|
|
@@ -74,7 +74,9 @@ class DropdownItem extends BaseComponent {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
return /*#__PURE__*/React.createElement("li", _Object$assign({
|
|
77
|
-
role: "menuitem"
|
|
77
|
+
role: "menuitem",
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
"aria-disabled": disabled
|
|
78
80
|
}, events, {
|
|
79
81
|
ref: ref => forwardRef(ref),
|
|
80
82
|
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;
|
|
@@ -17,10 +17,26 @@ import React from 'react';
|
|
|
17
17
|
import PropTypes from 'prop-types';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
19
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/dropdown/constants';
|
|
20
|
+
import Foundation from '@douyinfe/semi-foundation/lib/es/dropdown/menuFoundation';
|
|
21
|
+
import DropdownContext from './context';
|
|
20
22
|
import BaseComponent from '../_base/baseComponent';
|
|
21
23
|
const prefixCls = cssClasses.PREFIX;
|
|
22
24
|
|
|
23
25
|
class DropdownMenu extends BaseComponent {
|
|
26
|
+
constructor(props) {
|
|
27
|
+
super(props);
|
|
28
|
+
this.menuRef = /*#__PURE__*/React.createRef();
|
|
29
|
+
this.foundation = new Foundation(this.adapter);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get adapter() {
|
|
33
|
+
return _Object$assign({}, super.adapter);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
componentDidMount() {
|
|
37
|
+
this.foundation.autoFocus(this.menuRef.current);
|
|
38
|
+
}
|
|
39
|
+
|
|
24
40
|
render() {
|
|
25
41
|
const _a = this.props,
|
|
26
42
|
{
|
|
@@ -32,10 +48,12 @@ class DropdownMenu extends BaseComponent {
|
|
|
32
48
|
|
|
33
49
|
return /*#__PURE__*/React.createElement("ul", _Object$assign({
|
|
34
50
|
role: "menu",
|
|
35
|
-
"aria-orientation": "vertical"
|
|
51
|
+
"aria-orientation": "vertical",
|
|
52
|
+
ref: this.menuRef
|
|
36
53
|
}, rest, {
|
|
37
54
|
className: classnames("".concat(prefixCls, "-menu"), className),
|
|
38
|
-
style: style
|
|
55
|
+
style: style,
|
|
56
|
+
onKeyDown: e => this.foundation.onMenuKeydown(e)
|
|
39
57
|
}), children);
|
|
40
58
|
}
|
|
41
59
|
|
|
@@ -46,4 +64,5 @@ DropdownMenu.propTypes = {
|
|
|
46
64
|
className: PropTypes.string,
|
|
47
65
|
style: PropTypes.object
|
|
48
66
|
};
|
|
67
|
+
DropdownMenu.contextType = DropdownContext;
|
|
49
68
|
export default DropdownMenu;
|
|
@@ -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;
|
package/lib/es/dropdown/index.js
CHANGED
|
@@ -62,7 +62,8 @@ class Dropdown extends BaseComponent {
|
|
|
62
62
|
contentClassName,
|
|
63
63
|
style,
|
|
64
64
|
showTick,
|
|
65
|
-
prefixCls
|
|
65
|
+
prefixCls,
|
|
66
|
+
trigger
|
|
66
67
|
} = this.props;
|
|
67
68
|
const className = classnames(prefixCls, contentClassName);
|
|
68
69
|
const {
|
|
@@ -70,7 +71,8 @@ class Dropdown extends BaseComponent {
|
|
|
70
71
|
} = this.context;
|
|
71
72
|
const contextValue = {
|
|
72
73
|
showTick,
|
|
73
|
-
level: level + 1
|
|
74
|
+
level: level + 1,
|
|
75
|
+
trigger
|
|
74
76
|
};
|
|
75
77
|
let content = null;
|
|
76
78
|
|
|
@@ -207,11 +209,15 @@ class Dropdown extends BaseComponent {
|
|
|
207
209
|
position: position,
|
|
208
210
|
trigger: trigger,
|
|
209
211
|
onVisibleChange: this.handleVisibleChange,
|
|
210
|
-
showArrow: false
|
|
212
|
+
showArrow: false,
|
|
213
|
+
returnFocusOnClose: true
|
|
211
214
|
}, attr), /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, {
|
|
212
215
|
className: classnames(_get(children, 'props.className'), {
|
|
213
216
|
["".concat(prefixCls, "-showing")]: popVisible
|
|
214
|
-
})
|
|
217
|
+
}),
|
|
218
|
+
'aria-haspopup': true,
|
|
219
|
+
'aria-expanded': popVisible,
|
|
220
|
+
onKeyDown: e => this.foundation.handleKeyDown(e)
|
|
215
221
|
}) : children);
|
|
216
222
|
}
|
|
217
223
|
|
|
@@ -251,6 +257,8 @@ Dropdown.defaultProps = {
|
|
|
251
257
|
trigger: 'hover',
|
|
252
258
|
position: 'bottom',
|
|
253
259
|
mouseLeaveDelay: strings.DEFAULT_LEAVE_DELAY,
|
|
254
|
-
showTick: false
|
|
260
|
+
showTick: false,
|
|
261
|
+
closeOnEsc: true,
|
|
262
|
+
onEscKeyDown: _noop
|
|
255
263
|
};
|
|
256
264
|
export default Dropdown;
|
|
@@ -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/es/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/es/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/es/input/index.js
CHANGED
|
@@ -111,10 +111,15 @@ class Input extends BaseComponent {
|
|
|
111
111
|
eyeClosed: value
|
|
112
112
|
}),
|
|
113
113
|
toggleFocusing: isFocus => {
|
|
114
|
+
const {
|
|
115
|
+
preventScroll
|
|
116
|
+
} = this.props;
|
|
114
117
|
const input = this.inputRef && this.inputRef.current;
|
|
115
118
|
|
|
116
119
|
if (isFocus) {
|
|
117
|
-
input && input.focus(
|
|
120
|
+
input && input.focus({
|
|
121
|
+
preventScroll
|
|
122
|
+
});
|
|
118
123
|
} else {
|
|
119
124
|
input && input.blur();
|
|
120
125
|
}
|
|
@@ -356,9 +361,10 @@ class Input extends BaseComponent {
|
|
|
356
361
|
inputStyle,
|
|
357
362
|
forwardRef,
|
|
358
363
|
maxLength,
|
|
359
|
-
getValueLength
|
|
364
|
+
getValueLength,
|
|
365
|
+
preventScroll
|
|
360
366
|
} = _a,
|
|
361
|
-
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"]);
|
|
367
|
+
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"]);
|
|
362
368
|
|
|
363
369
|
const {
|
|
364
370
|
value,
|
|
@@ -483,14 +489,14 @@ Input.propTypes = {
|
|
|
483
489
|
insetLabel: PropTypes.node,
|
|
484
490
|
insetLabelId: PropTypes.string,
|
|
485
491
|
inputStyle: PropTypes.object,
|
|
486
|
-
getValueLength: PropTypes.func
|
|
492
|
+
getValueLength: PropTypes.func,
|
|
493
|
+
preventScroll: PropTypes.bool
|
|
487
494
|
};
|
|
488
495
|
Input.defaultProps = {
|
|
489
496
|
addonBefore: '',
|
|
490
497
|
addonAfter: '',
|
|
491
498
|
prefix: '',
|
|
492
499
|
suffix: '',
|
|
493
|
-
disabled: false,
|
|
494
500
|
readonly: false,
|
|
495
501
|
type: 'text',
|
|
496
502
|
showClear: false,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _isFunction from "lodash/isFunction";
|
|
2
|
+
import _get from "lodash/get";
|
|
2
3
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
3
4
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -78,9 +79,10 @@ export default class inputGroup extends BaseComponent {
|
|
|
78
79
|
children,
|
|
79
80
|
label,
|
|
80
81
|
onBlur: groupOnBlur,
|
|
81
|
-
onFocus: groupOnFocus
|
|
82
|
+
onFocus: groupOnFocus,
|
|
83
|
+
disabled: groupDisabled
|
|
82
84
|
} = _a,
|
|
83
|
-
rest = __rest(_a, ["size", "style", "className", "children", "label", "onBlur", "onFocus"]);
|
|
85
|
+
rest = __rest(_a, ["size", "style", "className", "children", "label", "onBlur", "onFocus", "disabled"]);
|
|
84
86
|
|
|
85
87
|
const groupCls = cls("".concat(prefixCls, "-group"), {
|
|
86
88
|
[_concatInstanceProperty(_context2 = "".concat(prefixCls, "-")).call(_context2, size)]: size !== 'default'
|
|
@@ -94,16 +96,20 @@ export default class inputGroup extends BaseComponent {
|
|
|
94
96
|
if (item) {
|
|
95
97
|
const {
|
|
96
98
|
onBlur: itemOnBlur,
|
|
97
|
-
onFocus: itemOnFocus
|
|
99
|
+
onFocus: itemOnFocus,
|
|
100
|
+
disabled: itemDisabled
|
|
98
101
|
} = item.props;
|
|
99
|
-
const onBlur = _isFunction(itemOnBlur) ? itemOnBlur : groupOnBlur;
|
|
100
|
-
const onFocus = _isFunction(itemOnFocus) ? itemOnFocus : groupOnFocus;
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
const onBlur = _isFunction(itemOnBlur) && _get(itemOnBlur, 'name') !== 'noop' ? itemOnBlur : groupOnBlur;
|
|
103
|
+
const onFocus = _isFunction(itemOnFocus) && _get(itemOnFocus, 'name') !== 'noop' ? itemOnFocus : groupOnFocus;
|
|
104
|
+
const disabled = typeof itemDisabled === 'boolean' ? itemDisabled : groupDisabled;
|
|
105
|
+
return /*#__PURE__*/React.cloneElement(item, _Object$assign(_Object$assign({
|
|
106
|
+
key: index
|
|
107
|
+
}, rest), {
|
|
103
108
|
size,
|
|
104
109
|
onBlur,
|
|
105
|
-
onFocus
|
|
106
|
-
|
|
110
|
+
onFocus,
|
|
111
|
+
disabled
|
|
112
|
+
}));
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
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>;
|
|
@@ -18,6 +18,8 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
22
|
+
|
|
21
23
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
22
24
|
|
|
23
25
|
/* eslint-disable no-unused-vars */
|
|
@@ -277,7 +279,8 @@ class InputNumber extends BaseComponent {
|
|
|
277
279
|
|
|
278
280
|
componentDidUpdate(prevProps) {
|
|
279
281
|
const {
|
|
280
|
-
value
|
|
282
|
+
value,
|
|
283
|
+
preventScroll
|
|
281
284
|
} = this.props;
|
|
282
285
|
const {
|
|
283
286
|
focusing
|
|
@@ -392,7 +395,9 @@ class InputNumber extends BaseComponent {
|
|
|
392
395
|
|
|
393
396
|
if (this.props.keepFocus && this.state.focusing) {
|
|
394
397
|
if (document.activeElement !== this.inputNode) {
|
|
395
|
-
this.inputNode.focus(
|
|
398
|
+
this.inputNode.focus({
|
|
399
|
+
preventScroll
|
|
400
|
+
});
|
|
396
401
|
}
|
|
397
402
|
}
|
|
398
403
|
}
|
|
@@ -502,6 +507,7 @@ InputNumber.propTypes = {
|
|
|
502
507
|
prefixCls: PropTypes.string,
|
|
503
508
|
pressInterval: PropTypes.number,
|
|
504
509
|
pressTimeout: PropTypes.number,
|
|
510
|
+
preventScroll: PropTypes.bool,
|
|
505
511
|
shiftStep: PropTypes.number,
|
|
506
512
|
step: PropTypes.number,
|
|
507
513
|
style: PropTypes.object,
|
|
@@ -515,7 +521,6 @@ InputNumber.propTypes = {
|
|
|
515
521
|
onUpClick: PropTypes.func
|
|
516
522
|
};
|
|
517
523
|
InputNumber.defaultProps = {
|
|
518
|
-
disabled: false,
|
|
519
524
|
forwardedRef: _noop,
|
|
520
525
|
innerButtons: false,
|
|
521
526
|
keepFocus: false,
|