@douyinfe/semi-ui 2.14.0 → 2.15.1
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 +1150 -346
- 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 +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/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/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
package/lib/es/select/index.js
CHANGED
|
@@ -129,8 +129,14 @@ class Select extends BaseComponent {
|
|
|
129
129
|
});
|
|
130
130
|
},
|
|
131
131
|
focusInput: () => {
|
|
132
|
+
const {
|
|
133
|
+
preventScroll
|
|
134
|
+
} = this.props;
|
|
135
|
+
|
|
132
136
|
if (this.inputRef && this.inputRef.current) {
|
|
133
|
-
this.inputRef.current.focus(
|
|
137
|
+
this.inputRef.current.focus({
|
|
138
|
+
preventScroll
|
|
139
|
+
});
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
142
|
};
|
|
@@ -282,8 +288,13 @@ class Select extends BaseComponent {
|
|
|
282
288
|
},
|
|
283
289
|
focusTrigger: () => {
|
|
284
290
|
try {
|
|
291
|
+
const {
|
|
292
|
+
preventScroll
|
|
293
|
+
} = this.props;
|
|
285
294
|
const el = this.triggerRef.current;
|
|
286
|
-
el.focus(
|
|
295
|
+
el.focus({
|
|
296
|
+
preventScroll
|
|
297
|
+
});
|
|
287
298
|
} catch (error) {}
|
|
288
299
|
},
|
|
289
300
|
updateScrollTop: index => {
|
|
@@ -1086,7 +1097,8 @@ Select.propTypes = {
|
|
|
1086
1097
|
virtualize: PropTypes.object,
|
|
1087
1098
|
renderOptionItem: PropTypes.func,
|
|
1088
1099
|
onListScroll: PropTypes.func,
|
|
1089
|
-
arrowIcon: PropTypes.node
|
|
1100
|
+
arrowIcon: PropTypes.node,
|
|
1101
|
+
preventScroll: PropTypes.bool // open: PropTypes.bool,
|
|
1090
1102
|
// tagClosable: PropTypes.bool,
|
|
1091
1103
|
|
|
1092
1104
|
};
|
|
@@ -299,7 +299,7 @@ class Body extends BaseComponent {
|
|
|
299
299
|
|
|
300
300
|
const listStyle = {
|
|
301
301
|
width: '100%',
|
|
302
|
-
height: y,
|
|
302
|
+
height: (virtualizedData === null || virtualizedData === void 0 ? void 0 : virtualizedData.length) ? y : 0,
|
|
303
303
|
overflowX: 'auto',
|
|
304
304
|
overflowY: 'auto'
|
|
305
305
|
};
|
package/lib/es/tabs/index.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
33
33
|
tabPosition: PropTypes.Requireable<string>;
|
|
34
34
|
type: PropTypes.Requireable<string>;
|
|
35
35
|
onTabClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
36
37
|
};
|
|
37
38
|
static defaultProps: TabsProps;
|
|
38
39
|
contentRef: RefObject<HTMLDivElement>;
|
package/lib/es/tabs/index.js
CHANGED
|
@@ -359,7 +359,8 @@ Tabs.propTypes = {
|
|
|
359
359
|
tabPaneMotion: PropTypes.oneOfType([PropTypes.bool, PropTypes.object, PropTypes.func]),
|
|
360
360
|
tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
|
|
361
361
|
type: PropTypes.oneOf(strings.TYPE_MAP),
|
|
362
|
-
onTabClose: PropTypes.func
|
|
362
|
+
onTabClose: PropTypes.func,
|
|
363
|
+
preventScroll: PropTypes.bool
|
|
363
364
|
};
|
|
364
365
|
Tabs.defaultProps = {
|
|
365
366
|
children: [],
|
package/lib/es/tag/index.js
CHANGED
|
@@ -17,10 +17,6 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
17
17
|
};
|
|
18
18
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
19
19
|
|
|
20
|
-
/* eslint-disable no-unused-vars */
|
|
21
|
-
|
|
22
|
-
/* eslint-disable max-len */
|
|
23
|
-
|
|
24
20
|
|
|
25
21
|
import React, { Component } from 'react';
|
|
26
22
|
import classNames from 'classnames';
|
|
@@ -85,7 +81,8 @@ export default class Tag extends Component {
|
|
|
85
81
|
handleKeyDown(event) {
|
|
86
82
|
const {
|
|
87
83
|
closable,
|
|
88
|
-
onClick
|
|
84
|
+
onClick,
|
|
85
|
+
onKeyDown
|
|
89
86
|
} = this.props;
|
|
90
87
|
|
|
91
88
|
switch (event.key) {
|
|
@@ -107,6 +104,8 @@ export default class Tag extends Component {
|
|
|
107
104
|
default:
|
|
108
105
|
break;
|
|
109
106
|
}
|
|
107
|
+
|
|
108
|
+
onKeyDown && onKeyDown(event);
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
renderAvatar() {
|
|
@@ -45,6 +45,7 @@ export interface TagInputProps {
|
|
|
45
45
|
value?: string[] | undefined;
|
|
46
46
|
autoFocus?: boolean;
|
|
47
47
|
'aria-label'?: string;
|
|
48
|
+
preventScroll?: boolean;
|
|
48
49
|
}
|
|
49
50
|
export interface TagInputState {
|
|
50
51
|
tagsArray?: string[];
|
|
@@ -88,6 +89,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
88
89
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
89
90
|
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
90
91
|
'aria-label': PropTypes.Requireable<string>;
|
|
92
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
91
93
|
};
|
|
92
94
|
static defaultProps: {
|
|
93
95
|
showClear: boolean;
|
package/lib/es/tagInput/index.js
CHANGED
|
@@ -124,10 +124,15 @@ class TagInput extends BaseComponent {
|
|
|
124
124
|
});
|
|
125
125
|
},
|
|
126
126
|
toggleFocusing: isFocus => {
|
|
127
|
+
const {
|
|
128
|
+
preventScroll
|
|
129
|
+
} = this.props;
|
|
127
130
|
const input = this.inputRef && this.inputRef.current;
|
|
128
131
|
|
|
129
132
|
if (isFocus) {
|
|
130
|
-
input && input.focus(
|
|
133
|
+
input && input.focus({
|
|
134
|
+
preventScroll
|
|
135
|
+
});
|
|
131
136
|
} else {
|
|
132
137
|
input && input.blur();
|
|
133
138
|
}
|
|
@@ -168,11 +173,14 @@ class TagInput extends BaseComponent {
|
|
|
168
173
|
componentDidMount() {
|
|
169
174
|
const {
|
|
170
175
|
disabled,
|
|
171
|
-
autoFocus
|
|
176
|
+
autoFocus,
|
|
177
|
+
preventScroll
|
|
172
178
|
} = this.props;
|
|
173
179
|
|
|
174
180
|
if (!disabled && autoFocus) {
|
|
175
|
-
this.inputRef.current.focus(
|
|
181
|
+
this.inputRef.current.focus({
|
|
182
|
+
preventScroll
|
|
183
|
+
});
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
186
|
|
|
@@ -341,7 +349,12 @@ class TagInput extends BaseComponent {
|
|
|
341
349
|
}
|
|
342
350
|
|
|
343
351
|
focus() {
|
|
344
|
-
|
|
352
|
+
const {
|
|
353
|
+
preventScroll
|
|
354
|
+
} = this.props;
|
|
355
|
+
this.inputRef.current.focus({
|
|
356
|
+
preventScroll
|
|
357
|
+
});
|
|
345
358
|
}
|
|
346
359
|
|
|
347
360
|
render() {
|
|
@@ -441,7 +454,8 @@ TagInput.propTypes = {
|
|
|
441
454
|
validateStatus: PropTypes.oneOf(strings.STATUS),
|
|
442
455
|
prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
443
456
|
suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
444
|
-
'aria-label': PropTypes.string
|
|
457
|
+
'aria-label': PropTypes.string,
|
|
458
|
+
preventScroll: PropTypes.bool
|
|
445
459
|
};
|
|
446
460
|
TagInput.defaultProps = {
|
|
447
461
|
showClear: false,
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
4
|
import InputFoundation, { TimeInputAdapter } from '@douyinfe/semi-foundation/lib/es/timePicker/inputFoundation';
|
|
5
5
|
import { TimePickerProps } from './TimePicker';
|
|
6
|
-
export declare type TimeInputProps = Pick<TimePickerProps, 'value' | 'format' | 'prefixCls' | 'placeholder' | 'clearText' | 'inputReadOnly' | 'disabled' | 'type' | 'timeZone' | 'defaultOpen' | 'disabledHours' | 'disabledMinutes' | 'disabledSeconds' | 'dateFnsLocale' | 'onFocus' | 'onBlur' | 'focusOnOpen' | 'locale' | 'localeCode' | 'insetLabel' | 'validateStatus'> & BaseProps & {
|
|
6
|
+
export declare type TimeInputProps = Pick<TimePickerProps, 'value' | 'format' | 'prefixCls' | 'placeholder' | 'clearText' | 'inputReadOnly' | 'disabled' | 'type' | 'timeZone' | 'defaultOpen' | 'disabledHours' | 'disabledMinutes' | 'disabledSeconds' | 'dateFnsLocale' | 'onFocus' | 'onBlur' | 'focusOnOpen' | 'locale' | 'localeCode' | 'insetLabel' | 'validateStatus' | 'preventScroll'> & BaseProps & {
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
8
|
onEsc?: () => void;
|
|
9
9
|
onClick?: React.MouseEventHandler;
|
|
@@ -38,6 +38,7 @@ declare class TimeInput extends BaseComponent<TimeInputProps, any> {
|
|
|
38
38
|
localeCode: PropTypes.Requireable<string>;
|
|
39
39
|
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
40
40
|
validateStatus: PropTypes.Requireable<string>;
|
|
41
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
41
42
|
};
|
|
42
43
|
static defaultProps: {
|
|
43
44
|
inputReadOnly: boolean;
|
|
@@ -48,7 +48,8 @@ class TimeInput extends BaseComponent {
|
|
|
48
48
|
componentDidMount() {
|
|
49
49
|
super.componentDidMount();
|
|
50
50
|
const {
|
|
51
|
-
focusOnOpen
|
|
51
|
+
focusOnOpen,
|
|
52
|
+
preventScroll
|
|
52
53
|
} = this.props;
|
|
53
54
|
|
|
54
55
|
if (focusOnOpen) {
|
|
@@ -57,7 +58,9 @@ class TimeInput extends BaseComponent {
|
|
|
57
58
|
const inputNode = this.adapter.getCache('inputNode');
|
|
58
59
|
|
|
59
60
|
if (inputNode) {
|
|
60
|
-
inputNode.focus(
|
|
61
|
+
inputNode.focus({
|
|
62
|
+
preventScroll
|
|
63
|
+
});
|
|
61
64
|
inputNode.select();
|
|
62
65
|
}
|
|
63
66
|
});
|
|
@@ -186,7 +189,8 @@ TimeInput.propTypes = {
|
|
|
186
189
|
locale: PropTypes.object,
|
|
187
190
|
localeCode: PropTypes.string,
|
|
188
191
|
insetLabel: PropTypes.node,
|
|
189
|
-
validateStatus: PropTypes.string
|
|
192
|
+
validateStatus: PropTypes.string,
|
|
193
|
+
preventScroll: PropTypes.bool
|
|
190
194
|
};
|
|
191
195
|
TimeInput.defaultProps = {
|
|
192
196
|
inputReadOnly: false,
|
|
@@ -54,6 +54,7 @@ export declare type TimePickerProps = {
|
|
|
54
54
|
popupStyle?: React.CSSProperties;
|
|
55
55
|
position?: Position;
|
|
56
56
|
prefixCls?: string;
|
|
57
|
+
preventScroll?: boolean;
|
|
57
58
|
rangeSeparator?: string;
|
|
58
59
|
scrollItemProps?: ScrollItemProps<any>;
|
|
59
60
|
secondStep?: number;
|
|
@@ -88,6 +89,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
88
89
|
static contextType: React.Context<import("../configProvider/context").ContextValue>;
|
|
89
90
|
static propTypes: {
|
|
90
91
|
inputStyle: PropTypes.Requireable<object>;
|
|
92
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
91
93
|
panelHeader: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
92
94
|
panelFooter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
93
95
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
@@ -443,7 +443,8 @@ TimePicker.propTypes = _Object$assign(_Object$assign({
|
|
|
443
443
|
motion: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.object]),
|
|
444
444
|
autoAdjustOverflow: PropTypes.bool
|
|
445
445
|
}, PanelShape), {
|
|
446
|
-
inputStyle: PropTypes.object
|
|
446
|
+
inputStyle: PropTypes.object,
|
|
447
|
+
preventScroll: PropTypes.bool
|
|
447
448
|
});
|
|
448
449
|
TimePicker.defaultProps = _Object$assign({
|
|
449
450
|
autoAdjustOverflow: true,
|
|
@@ -9,6 +9,7 @@ export declare type LocalePickerProps = BasePickerProps;
|
|
|
9
9
|
export default class LocaleTimePicker extends React.PureComponent<LocalePickerProps> {
|
|
10
10
|
static propTypes: {
|
|
11
11
|
inputStyle: import("prop-types").Requireable<object>;
|
|
12
|
+
preventScroll: import("prop-types").Requireable<boolean>;
|
|
12
13
|
panelHeader: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
13
14
|
panelFooter: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
14
15
|
'aria-labelledby': import("prop-types").Requireable<string>;
|
|
@@ -54,6 +54,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
54
54
|
returnFocusOnClose?: boolean;
|
|
55
55
|
onEscKeyDown?: (e: React.KeyboardEvent) => void;
|
|
56
56
|
wrapperId?: string;
|
|
57
|
+
preventScroll?: boolean;
|
|
57
58
|
}
|
|
58
59
|
interface TooltipState {
|
|
59
60
|
visible: boolean;
|
|
@@ -109,6 +110,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
109
110
|
wrapWhenSpecial: PropTypes.Requireable<boolean>;
|
|
110
111
|
guardFocus: PropTypes.Requireable<boolean>;
|
|
111
112
|
returnFocusOnClose: PropTypes.Requireable<boolean>;
|
|
113
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
112
114
|
};
|
|
113
115
|
static defaultProps: {
|
|
114
116
|
arrowBounding: {
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -251,7 +251,8 @@ export default class Tooltip extends BaseComponent {
|
|
|
251
251
|
|
|
252
252
|
if (block || _includesInstanceProperty(blockDisplays).call(blockDisplays, display)) {
|
|
253
253
|
style.width = '100%';
|
|
254
|
-
}
|
|
254
|
+
} // eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
255
|
+
|
|
255
256
|
|
|
256
257
|
return /*#__PURE__*/React.createElement("span", {
|
|
257
258
|
className: wrapperClassName,
|
|
@@ -554,10 +555,16 @@ export default class Tooltip extends BaseComponent {
|
|
|
554
555
|
return getActiveElement();
|
|
555
556
|
},
|
|
556
557
|
setInitialFocus: () => {
|
|
558
|
+
const {
|
|
559
|
+
preventScroll
|
|
560
|
+
} = this.props;
|
|
561
|
+
|
|
557
562
|
const focusRefNode = _get(this, 'initialFocusRef.current');
|
|
558
563
|
|
|
559
564
|
if (focusRefNode && 'focus' in focusRefNode) {
|
|
560
|
-
focusRefNode.focus(
|
|
565
|
+
focusRefNode.focus({
|
|
566
|
+
preventScroll
|
|
567
|
+
});
|
|
561
568
|
}
|
|
562
569
|
},
|
|
563
570
|
notifyEscKeydown: event => {
|
|
@@ -676,7 +683,8 @@ export default class Tooltip extends BaseComponent {
|
|
|
676
683
|
ref.current = node;
|
|
677
684
|
}
|
|
678
685
|
},
|
|
679
|
-
tabIndex:
|
|
686
|
+
tabIndex: 0,
|
|
687
|
+
'data-popupid': id
|
|
680
688
|
})); // If you do not add a layer of div, in order to bind the events and className in the tooltip, you need to cloneElement children, but this time it may overwrite the children's original ref reference
|
|
681
689
|
// So if the user adds ref to the content, you need to use callback ref: https://github.com/facebook/react/issues/8873
|
|
682
690
|
|
|
@@ -717,7 +725,8 @@ Tooltip.propTypes = {
|
|
|
717
725
|
role: PropTypes.string,
|
|
718
726
|
wrapWhenSpecial: PropTypes.bool,
|
|
719
727
|
guardFocus: PropTypes.bool,
|
|
720
|
-
returnFocusOnClose: PropTypes.bool
|
|
728
|
+
returnFocusOnClose: PropTypes.bool,
|
|
729
|
+
preventScroll: PropTypes.bool
|
|
721
730
|
};
|
|
722
731
|
Tooltip.defaultProps = {
|
|
723
732
|
arrowBounding: numbers.ARROW_BOUNDING,
|
package/lib/es/tree/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
73
73
|
labelEllipsis: PropTypes.Requireable<boolean>;
|
|
74
74
|
checkRelation: PropTypes.Requireable<string>;
|
|
75
75
|
'aria-label': PropTypes.Requireable<string>;
|
|
76
|
+
preventScroll: PropTypes.Requireable<boolean>;
|
|
76
77
|
};
|
|
77
78
|
static defaultProps: {
|
|
78
79
|
showClear: boolean;
|
package/lib/es/tree/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
|
7
7
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
8
8
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
9
9
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
10
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
10
11
|
|
|
11
12
|
/* eslint-disable max-lines-per-function */
|
|
12
13
|
import React from 'react';
|
|
@@ -27,6 +28,7 @@ import NodeList from './nodeList';
|
|
|
27
28
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
28
29
|
import '@douyinfe/semi-foundation/lib/es/tree/tree.css';
|
|
29
30
|
import { IconSearch } from '@douyinfe/semi-icons';
|
|
31
|
+
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
30
32
|
export * from './interface';
|
|
31
33
|
const prefixcls = cssClasses.PREFIX;
|
|
32
34
|
|
|
@@ -424,8 +426,14 @@ class Tree extends BaseComponent {
|
|
|
424
426
|
});
|
|
425
427
|
},
|
|
426
428
|
focusInput: () => {
|
|
429
|
+
const {
|
|
430
|
+
preventScroll
|
|
431
|
+
} = this.props;
|
|
432
|
+
|
|
427
433
|
if (this.inputRef && this.inputRef.current) {
|
|
428
|
-
this.inputRef.current.focus(
|
|
434
|
+
this.inputRef.current.focus({
|
|
435
|
+
preventScroll
|
|
436
|
+
});
|
|
429
437
|
}
|
|
430
438
|
}
|
|
431
439
|
};
|
|
@@ -587,7 +595,9 @@ class Tree extends BaseComponent {
|
|
|
587
595
|
inputValue,
|
|
588
596
|
filteredKeys,
|
|
589
597
|
dragOverNodeKey,
|
|
590
|
-
dropPosition
|
|
598
|
+
dropPosition,
|
|
599
|
+
checkedKeys,
|
|
600
|
+
realCheckedKeys
|
|
591
601
|
} = this.state;
|
|
592
602
|
const {
|
|
593
603
|
blockNode,
|
|
@@ -606,7 +616,8 @@ class Tree extends BaseComponent {
|
|
|
606
616
|
draggable,
|
|
607
617
|
renderFullLabel,
|
|
608
618
|
labelEllipsis,
|
|
609
|
-
virtualize
|
|
619
|
+
virtualize,
|
|
620
|
+
checkRelation
|
|
610
621
|
} = this.props;
|
|
611
622
|
const wrapperCls = cls("".concat(prefixcls, "-wrapper"), className);
|
|
612
623
|
const listCls = cls("".concat(prefixcls, "-option-list"), {
|
|
@@ -664,7 +675,9 @@ class Tree extends BaseComponent {
|
|
|
664
675
|
style: style
|
|
665
676
|
}, filterTreeNode ? this.renderInput() : null, /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
666
677
|
className: listCls
|
|
667
|
-
}, ariaAttr), noData ? this.renderEmpty() :
|
|
678
|
+
}, ariaAttr), noData ? this.renderEmpty() : multiple ? /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
679
|
+
value: _Array$from(checkRelation === 'related' ? checkedKeys : realCheckedKeys)
|
|
680
|
+
}, this.renderNodeList()) : this.renderNodeList())));
|
|
668
681
|
}
|
|
669
682
|
|
|
670
683
|
}
|
|
@@ -731,7 +744,8 @@ Tree.propTypes = {
|
|
|
731
744
|
onDrop: PropTypes.func,
|
|
732
745
|
labelEllipsis: PropTypes.bool,
|
|
733
746
|
checkRelation: PropTypes.string,
|
|
734
|
-
'aria-label': PropTypes.string
|
|
747
|
+
'aria-label': PropTypes.string,
|
|
748
|
+
preventScroll: PropTypes.bool
|
|
735
749
|
};
|
|
736
750
|
Tree.defaultProps = {
|
|
737
751
|
showClear: true,
|
package/lib/es/tree/treeNode.js
CHANGED
|
@@ -6,7 +6,6 @@ import _debounce from "lodash/debounce";
|
|
|
6
6
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
7
7
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
8
8
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
9
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
10
9
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
10
|
|
|
12
11
|
var __rest = this && this.__rest || function (s, e) {
|
|
@@ -29,6 +28,7 @@ import { IconTreeTriangleDown, IconFile, IconFolder, IconFolderOpen } from '@dou
|
|
|
29
28
|
import { Checkbox } from '../checkbox';
|
|
30
29
|
import TreeContext from './treeContext';
|
|
31
30
|
import Spin from '../spin';
|
|
31
|
+
import { getHighLightTextHTML } from '../_utils/index';
|
|
32
32
|
const prefixcls = cssClasses.PREFIX_OPTION;
|
|
33
33
|
export default class TreeNode extends PureComponent {
|
|
34
34
|
constructor(props) {
|
|
@@ -248,22 +248,14 @@ export default class TreeNode extends PureComponent {
|
|
|
248
248
|
if (_isFunction(renderLabel)) {
|
|
249
249
|
return renderLabel(label, data);
|
|
250
250
|
} else if (_isString(label) && filtered && keyword && treeNodeFilterProp === 'label') {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
content.push( /*#__PURE__*/React.createElement("span", {
|
|
258
|
-
className: "".concat(prefixcls, "-highlight"),
|
|
259
|
-
key: index
|
|
260
|
-
}, keyword));
|
|
251
|
+
return getHighLightTextHTML({
|
|
252
|
+
sourceString: label,
|
|
253
|
+
searchWords: [keyword],
|
|
254
|
+
option: {
|
|
255
|
+
highlightTag: 'span',
|
|
256
|
+
highlightClassName: "".concat(prefixcls, "-highlight")
|
|
261
257
|
}
|
|
262
|
-
|
|
263
|
-
content.push(node);
|
|
264
258
|
});
|
|
265
|
-
|
|
266
|
-
return content;
|
|
267
259
|
} else {
|
|
268
260
|
return label;
|
|
269
261
|
}
|
|
@@ -311,7 +303,8 @@ export default class TreeNode extends PureComponent {
|
|
|
311
303
|
renderCheckbox() {
|
|
312
304
|
const {
|
|
313
305
|
checked,
|
|
314
|
-
halfChecked
|
|
306
|
+
halfChecked,
|
|
307
|
+
eventKey
|
|
315
308
|
} = this.props;
|
|
316
309
|
const disabled = this.isDisabled();
|
|
317
310
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -320,6 +313,7 @@ export default class TreeNode extends PureComponent {
|
|
|
320
313
|
onKeyPress: this.handleCheckEnterPress
|
|
321
314
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
322
315
|
"aria-label": 'Toggle the checked state of checkbox',
|
|
316
|
+
value: eventKey,
|
|
323
317
|
indeterminate: halfChecked,
|
|
324
318
|
checked: checked,
|
|
325
319
|
disabled: Boolean(disabled)
|
|
@@ -362,7 +356,7 @@ export default class TreeNode extends PureComponent {
|
|
|
362
356
|
}
|
|
363
357
|
|
|
364
358
|
renderEmptyNode() {
|
|
365
|
-
var
|
|
359
|
+
var _context;
|
|
366
360
|
|
|
367
361
|
const {
|
|
368
362
|
emptyContent
|
|
@@ -373,14 +367,14 @@ export default class TreeNode extends PureComponent {
|
|
|
373
367
|
return /*#__PURE__*/React.createElement("ul", {
|
|
374
368
|
className: wrapperCls
|
|
375
369
|
}, /*#__PURE__*/React.createElement("li", {
|
|
376
|
-
className: _concatInstanceProperty(
|
|
370
|
+
className: _concatInstanceProperty(_context = "".concat(prefixcls, "-label ")).call(_context, prefixcls, "-label-empty"),
|
|
377
371
|
"x-semi-prop": "emptyContent"
|
|
378
372
|
}, emptyContent));
|
|
379
373
|
} // eslint-disable-next-line max-lines-per-function
|
|
380
374
|
|
|
381
375
|
|
|
382
376
|
render() {
|
|
383
|
-
var
|
|
377
|
+
var _context2;
|
|
384
378
|
|
|
385
379
|
const _a = this.props,
|
|
386
380
|
{
|
|
@@ -418,7 +412,7 @@ export default class TreeNode extends PureComponent {
|
|
|
418
412
|
const dragOverGapTop = dragOverNodeKey === eventKey && dropPosition === -1;
|
|
419
413
|
const dragOverGapBottom = dragOverNodeKey === eventKey && dropPosition === 1;
|
|
420
414
|
const nodeCls = cls(prefixcls, {
|
|
421
|
-
[_concatInstanceProperty(
|
|
415
|
+
[_concatInstanceProperty(_context2 = "".concat(prefixcls, "-level-")).call(_context2, level + 1)]: true,
|
|
422
416
|
["".concat(prefixcls, "-collapsed")]: !expanded,
|
|
423
417
|
["".concat(prefixcls, "-disabled")]: Boolean(disabled),
|
|
424
418
|
["".concat(prefixcls, "-selected")]: selected,
|
|
@@ -11,6 +11,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
11
11
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
12
12
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
13
13
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
14
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
14
15
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
15
16
|
import React, { Fragment } from 'react';
|
|
16
17
|
import ReactDOM from 'react-dom';
|
|
@@ -39,6 +40,7 @@ import Trigger from '../trigger';
|
|
|
39
40
|
import TagInput from '../tagInput';
|
|
40
41
|
import { isSemiIcon } from '../_utils';
|
|
41
42
|
import { IconChevronDown, IconClear, IconSearch } from '@douyinfe/semi-icons';
|
|
43
|
+
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
42
44
|
const prefixcls = cssClasses.PREFIX;
|
|
43
45
|
const prefixTree = cssClasses.PREFIX_TREE;
|
|
44
46
|
const key = 0;
|
|
@@ -324,6 +326,14 @@ class TreeSelect extends BaseComponent {
|
|
|
324
326
|
};
|
|
325
327
|
|
|
326
328
|
this.search = value => {
|
|
329
|
+
const {
|
|
330
|
+
isOpen
|
|
331
|
+
} = this.state;
|
|
332
|
+
|
|
333
|
+
if (!isOpen) {
|
|
334
|
+
this.foundation.open();
|
|
335
|
+
}
|
|
336
|
+
|
|
327
337
|
this.foundation.handleInputChange(value);
|
|
328
338
|
};
|
|
329
339
|
|
|
@@ -813,7 +823,9 @@ class TreeSelect extends BaseComponent {
|
|
|
813
823
|
motionType,
|
|
814
824
|
inputValue,
|
|
815
825
|
filteredKeys,
|
|
816
|
-
flattenNodes
|
|
826
|
+
flattenNodes,
|
|
827
|
+
checkedKeys,
|
|
828
|
+
realCheckedKeys
|
|
817
829
|
} = this.state;
|
|
818
830
|
const {
|
|
819
831
|
loadData,
|
|
@@ -830,7 +842,8 @@ class TreeSelect extends BaseComponent {
|
|
|
830
842
|
optionListStyle,
|
|
831
843
|
searchPosition,
|
|
832
844
|
renderLabel,
|
|
833
|
-
renderFullLabel
|
|
845
|
+
renderFullLabel,
|
|
846
|
+
checkRelation
|
|
834
847
|
} = this.props;
|
|
835
848
|
const wrapperCls = cls("".concat(prefixTree, "-wrapper"));
|
|
836
849
|
const listCls = cls("".concat(prefixTree, "-option-list"), {
|
|
@@ -871,7 +884,9 @@ class TreeSelect extends BaseComponent {
|
|
|
871
884
|
role: "tree",
|
|
872
885
|
"aria-multiselectable": multiple ? true : false,
|
|
873
886
|
style: optionListStyle
|
|
874
|
-
}, noData ? this.renderEmpty() :
|
|
887
|
+
}, noData ? this.renderEmpty() : multiple ? /*#__PURE__*/React.createElement(CheckboxGroup, {
|
|
888
|
+
value: _Array$from(checkRelation === 'related' ? checkedKeys : realCheckedKeys)
|
|
889
|
+
}, this.renderNodeList()) : this.renderNodeList()), outerBottomSlot));
|
|
875
890
|
};
|
|
876
891
|
|
|
877
892
|
this.state = {
|
|
@@ -1315,7 +1330,6 @@ TreeSelect.defaultProps = {
|
|
|
1315
1330
|
motionExpand: true,
|
|
1316
1331
|
expandAll: false,
|
|
1317
1332
|
zIndex: popoverNumbers.DEFAULT_Z_INDEX,
|
|
1318
|
-
disabled: false,
|
|
1319
1333
|
disableStrictly: false,
|
|
1320
1334
|
multiple: false,
|
|
1321
1335
|
filterTreeNode: false,
|