@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
package/tagInput/index.tsx
CHANGED
|
@@ -61,6 +61,7 @@ export interface TagInputProps {
|
|
|
61
61
|
value?: string[] | undefined;
|
|
62
62
|
autoFocus?: boolean;
|
|
63
63
|
'aria-label'?: string;
|
|
64
|
+
preventScroll?: boolean;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
export interface TagInputState {
|
|
@@ -108,6 +109,7 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
108
109
|
prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
109
110
|
suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
110
111
|
'aria-label': PropTypes.string,
|
|
112
|
+
preventScroll: PropTypes.bool,
|
|
111
113
|
};
|
|
112
114
|
|
|
113
115
|
static defaultProps = {
|
|
@@ -176,9 +178,10 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
176
178
|
this.setState({ focusing });
|
|
177
179
|
},
|
|
178
180
|
toggleFocusing: (isFocus: boolean) => {
|
|
181
|
+
const { preventScroll } = this.props;
|
|
179
182
|
const input = this.inputRef && this.inputRef.current;
|
|
180
183
|
if (isFocus) {
|
|
181
|
-
input && input.focus();
|
|
184
|
+
input && input.focus({ preventScroll });
|
|
182
185
|
} else {
|
|
183
186
|
input && input.blur();
|
|
184
187
|
}
|
|
@@ -212,9 +215,9 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
componentDidMount() {
|
|
215
|
-
const { disabled, autoFocus } = this.props;
|
|
218
|
+
const { disabled, autoFocus, preventScroll } = this.props;
|
|
216
219
|
if (!disabled && autoFocus) {
|
|
217
|
-
this.inputRef.current.focus();
|
|
220
|
+
this.inputRef.current.focus({ preventScroll });
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
|
|
@@ -426,7 +429,8 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
426
429
|
}
|
|
427
430
|
|
|
428
431
|
focus() {
|
|
429
|
-
this.
|
|
432
|
+
const { preventScroll } = this.props;
|
|
433
|
+
this.inputRef.current.focus({ preventScroll });
|
|
430
434
|
}
|
|
431
435
|
|
|
432
436
|
render() {
|
package/timePicker/TimeInput.tsx
CHANGED
|
@@ -33,7 +33,8 @@ export type TimeInputProps = Pick<TimePickerProps,
|
|
|
33
33
|
'locale' |
|
|
34
34
|
'localeCode' |
|
|
35
35
|
'insetLabel' |
|
|
36
|
-
'validateStatus'
|
|
36
|
+
'validateStatus' |
|
|
37
|
+
'preventScroll'> & BaseProps & {
|
|
37
38
|
onChange?: (value: string) => void;
|
|
38
39
|
onEsc?: () => void;
|
|
39
40
|
onClick?: React.MouseEventHandler;
|
|
@@ -69,6 +70,7 @@ class TimeInput extends BaseComponent<TimeInputProps, any> {
|
|
|
69
70
|
localeCode: PropTypes.string,
|
|
70
71
|
insetLabel: PropTypes.node,
|
|
71
72
|
validateStatus: PropTypes.string,
|
|
73
|
+
preventScroll: PropTypes.bool,
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
static defaultProps = {
|
|
@@ -96,13 +98,13 @@ class TimeInput extends BaseComponent<TimeInputProps, any> {
|
|
|
96
98
|
|
|
97
99
|
componentDidMount() {
|
|
98
100
|
super.componentDidMount();
|
|
99
|
-
const { focusOnOpen } = this.props;
|
|
101
|
+
const { focusOnOpen, preventScroll } = this.props;
|
|
100
102
|
if (focusOnOpen) {
|
|
101
103
|
const requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;
|
|
102
104
|
requestAnimationFrame(() => {
|
|
103
105
|
const inputNode = this.adapter.getCache('inputNode');
|
|
104
106
|
if (inputNode) {
|
|
105
|
-
inputNode.focus();
|
|
107
|
+
inputNode.focus({ preventScroll });
|
|
106
108
|
inputNode.select();
|
|
107
109
|
}
|
|
108
110
|
});
|
|
@@ -75,6 +75,7 @@ export type TimePickerProps = {
|
|
|
75
75
|
popupStyle?: React.CSSProperties;
|
|
76
76
|
position?: Position;
|
|
77
77
|
prefixCls?: string;
|
|
78
|
+
preventScroll?: boolean;
|
|
78
79
|
rangeSeparator?: string;
|
|
79
80
|
scrollItemProps?: ScrollItemProps<any>;
|
|
80
81
|
secondStep?: number;
|
|
@@ -164,6 +165,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
164
165
|
autoAdjustOverflow: PropTypes.bool,
|
|
165
166
|
...PanelShape,
|
|
166
167
|
inputStyle: PropTypes.object,
|
|
168
|
+
preventScroll: PropTypes.bool,
|
|
167
169
|
};
|
|
168
170
|
|
|
169
171
|
static defaultProps = {
|
package/tooltip/index.tsx
CHANGED
|
@@ -76,6 +76,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
76
76
|
returnFocusOnClose?: boolean;
|
|
77
77
|
onEscKeyDown?: (e: React.KeyboardEvent) => void;
|
|
78
78
|
wrapperId?: string;
|
|
79
|
+
preventScroll?: boolean;
|
|
79
80
|
}
|
|
80
81
|
interface TooltipState {
|
|
81
82
|
visible: boolean;
|
|
@@ -136,6 +137,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
136
137
|
wrapWhenSpecial: PropTypes.bool, // when trigger has special status such as "disabled" or "loading", wrap span
|
|
137
138
|
guardFocus: PropTypes.bool,
|
|
138
139
|
returnFocusOnClose: PropTypes.bool,
|
|
140
|
+
preventScroll: PropTypes.bool,
|
|
139
141
|
};
|
|
140
142
|
|
|
141
143
|
static defaultProps = {
|
|
@@ -422,9 +424,10 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
422
424
|
return getActiveElement();
|
|
423
425
|
},
|
|
424
426
|
setInitialFocus: () => {
|
|
427
|
+
const { preventScroll } = this.props;
|
|
425
428
|
const focusRefNode = get(this, 'initialFocusRef.current');
|
|
426
429
|
if (focusRefNode && 'focus' in focusRefNode) {
|
|
427
|
-
focusRefNode.focus();
|
|
430
|
+
focusRefNode.focus({ preventScroll });
|
|
428
431
|
}
|
|
429
432
|
},
|
|
430
433
|
notifyEscKeydown: (event: React.KeyboardEvent) => {
|
|
@@ -627,6 +630,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
627
630
|
style.width = '100%';
|
|
628
631
|
}
|
|
629
632
|
|
|
633
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
630
634
|
return <span className={wrapperClassName} style={style}>{elem}</span>;
|
|
631
635
|
};
|
|
632
636
|
|
|
@@ -712,7 +716,8 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
712
716
|
ref.current = node;
|
|
713
717
|
}
|
|
714
718
|
},
|
|
715
|
-
tabIndex:
|
|
719
|
+
tabIndex: 0, // a11y keyboard
|
|
720
|
+
'data-popupId': id
|
|
716
721
|
});
|
|
717
722
|
|
|
718
723
|
// 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
|
package/tree/index.tsx
CHANGED
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
KeyEntity,
|
|
42
42
|
OptionProps
|
|
43
43
|
} from './interface';
|
|
44
|
+
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
44
45
|
|
|
45
46
|
export * from './interface';
|
|
46
47
|
export { AutoSizerProps } from './autoSizer';
|
|
@@ -114,6 +115,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
114
115
|
labelEllipsis: PropTypes.bool,
|
|
115
116
|
checkRelation: PropTypes.string,
|
|
116
117
|
'aria-label': PropTypes.string,
|
|
118
|
+
preventScroll: PropTypes.bool,
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
static defaultProps = {
|
|
@@ -445,8 +447,9 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
445
447
|
this.setState({ inputValue: value });
|
|
446
448
|
},
|
|
447
449
|
focusInput: () => {
|
|
450
|
+
const { preventScroll } = this.props;
|
|
448
451
|
if (this.inputRef && this.inputRef.current) {
|
|
449
|
-
(this.inputRef.current as any).focus();
|
|
452
|
+
(this.inputRef.current as any).focus({ preventScroll });
|
|
450
453
|
}
|
|
451
454
|
},
|
|
452
455
|
};
|
|
@@ -686,6 +689,8 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
686
689
|
filteredKeys,
|
|
687
690
|
dragOverNodeKey,
|
|
688
691
|
dropPosition,
|
|
692
|
+
checkedKeys,
|
|
693
|
+
realCheckedKeys,
|
|
689
694
|
} = this.state;
|
|
690
695
|
|
|
691
696
|
const {
|
|
@@ -706,6 +711,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
706
711
|
renderFullLabel,
|
|
707
712
|
labelEllipsis,
|
|
708
713
|
virtualize,
|
|
714
|
+
checkRelation,
|
|
709
715
|
} = this.props;
|
|
710
716
|
const wrapperCls = cls(`${prefixcls}-wrapper`, className);
|
|
711
717
|
const listCls = cls(`${prefixcls}-option-list`, {
|
|
@@ -760,7 +766,12 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
760
766
|
<div aria-label={this.props['aria-label']} className={wrapperCls} style={style}>
|
|
761
767
|
{filterTreeNode ? this.renderInput() : null}
|
|
762
768
|
<div className={listCls} {...ariaAttr}>
|
|
763
|
-
{noData ? this.renderEmpty() :
|
|
769
|
+
{noData ? this.renderEmpty() : (multiple ?
|
|
770
|
+
(<CheckboxGroup value={Array.from(checkRelation === 'related' ? checkedKeys : realCheckedKeys)}>
|
|
771
|
+
{this.renderNodeList()}
|
|
772
|
+
</CheckboxGroup>) :
|
|
773
|
+
this.renderNodeList()
|
|
774
|
+
)}
|
|
764
775
|
</div>
|
|
765
776
|
</div>
|
|
766
777
|
</TreeContext.Provider>
|
package/tree/treeNode.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { Checkbox } from '../checkbox';
|
|
|
9
9
|
import TreeContext, { TreeContextValue } from './treeContext';
|
|
10
10
|
import Spin from '../spin';
|
|
11
11
|
import { TreeNodeProps, TreeNodeState } from './interface';
|
|
12
|
+
import { getHighLightTextHTML } from '../_utils/index';
|
|
12
13
|
|
|
13
14
|
const prefixcls = cssClasses.PREFIX_OPTION;
|
|
14
15
|
|
|
@@ -220,7 +221,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
renderCheckbox() {
|
|
223
|
-
const { checked, halfChecked } = this.props;
|
|
224
|
+
const { checked, halfChecked, eventKey } = this.props;
|
|
224
225
|
const disabled = this.isDisabled();
|
|
225
226
|
return (
|
|
226
227
|
<div
|
|
@@ -230,6 +231,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
230
231
|
>
|
|
231
232
|
<Checkbox
|
|
232
233
|
aria-label='Toggle the checked state of checkbox'
|
|
234
|
+
value={eventKey}
|
|
233
235
|
indeterminate={halfChecked}
|
|
234
236
|
checked={checked}
|
|
235
237
|
disabled={Boolean(disabled)}
|
|
@@ -282,18 +284,14 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
282
284
|
if (isFunction(renderLabel)) {
|
|
283
285
|
return renderLabel(label, data);
|
|
284
286
|
} else if (isString(label) && filtered && keyword && treeNodeFilterProp === 'label') {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
content.push(node);
|
|
295
|
-
});
|
|
296
|
-
return content;
|
|
287
|
+
return getHighLightTextHTML({
|
|
288
|
+
sourceString: label,
|
|
289
|
+
searchWords: [keyword],
|
|
290
|
+
option: {
|
|
291
|
+
highlightTag: 'span',
|
|
292
|
+
highlightClassName: `${prefixcls}-highlight`,
|
|
293
|
+
},
|
|
294
|
+
} as any);
|
|
297
295
|
} else {
|
|
298
296
|
return label;
|
|
299
297
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Icon, Button, Form, Popover, Tag, Typography } from '../../index';
|
|
2
|
+
import { Icon, Button, Form, Popover, Tag, Typography, CheckboxGroup } from '../../index';
|
|
3
3
|
import TreeSelect from '../index';
|
|
4
4
|
import { flattenDeep } from 'lodash';
|
|
5
5
|
import CustomTrigger from './CustomTrigger';
|
|
@@ -152,6 +152,43 @@ const treeDataWithoutValue = [
|
|
|
152
152
|
},
|
|
153
153
|
];
|
|
154
154
|
|
|
155
|
+
export const TreeSelectWrapper = () => (
|
|
156
|
+
<div>
|
|
157
|
+
<div>github issue 750 修改测试用例</div>
|
|
158
|
+
<CheckboxGroup>
|
|
159
|
+
<TreeSelect
|
|
160
|
+
showClear={true}
|
|
161
|
+
expandAll
|
|
162
|
+
style={{width: 400}}
|
|
163
|
+
treeData={[
|
|
164
|
+
{
|
|
165
|
+
key: '1',
|
|
166
|
+
label: '所有节点',
|
|
167
|
+
value: '1',
|
|
168
|
+
children: [
|
|
169
|
+
{ key: '20006251', label: 'Semi', value: 'semi@bytedance.com' },
|
|
170
|
+
{ key: '20006248', label: 'Design', value: 'design@bytedance.com' },
|
|
171
|
+
{
|
|
172
|
+
key: '20006205',
|
|
173
|
+
label: 'React',
|
|
174
|
+
value: 'react@bytedance.com',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
]}
|
|
179
|
+
multiple
|
|
180
|
+
filterTreeNode
|
|
181
|
+
showFilteredOnly={true}
|
|
182
|
+
leafOnly
|
|
183
|
+
/>
|
|
184
|
+
</CheckboxGroup>
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
TreeSelectWrapper.story = {
|
|
189
|
+
name: 'treeSelect wrapper',
|
|
190
|
+
};
|
|
191
|
+
|
|
155
192
|
class SimpleTree extends React.Component {
|
|
156
193
|
render() {
|
|
157
194
|
return (
|
package/treeSelect/index.tsx
CHANGED
|
@@ -50,6 +50,7 @@ import { isSemiIcon } from '../_utils';
|
|
|
50
50
|
import { OptionProps, TreeProps, TreeState, FlattenNode, TreeNodeData, TreeNodeProps } from '../tree/interface';
|
|
51
51
|
import { Motion } from '../_base/base';
|
|
52
52
|
import { IconChevronDown, IconClear, IconSearch } from '@douyinfe/semi-icons';
|
|
53
|
+
import CheckboxGroup from '../checkbox/checkboxGroup';
|
|
53
54
|
|
|
54
55
|
export type ExpandAction = false | 'click' | 'doubleClick';
|
|
55
56
|
|
|
@@ -265,7 +266,6 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
265
266
|
motionExpand: true,
|
|
266
267
|
expandAll: false,
|
|
267
268
|
zIndex: popoverNumbers.DEFAULT_Z_INDEX,
|
|
268
|
-
disabled: false,
|
|
269
269
|
disableStrictly: false,
|
|
270
270
|
multiple: false,
|
|
271
271
|
filterTreeNode: false,
|
|
@@ -864,6 +864,10 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
864
864
|
};
|
|
865
865
|
|
|
866
866
|
search = (value: string) => {
|
|
867
|
+
const { isOpen } = this.state;
|
|
868
|
+
if (!isOpen) {
|
|
869
|
+
this.foundation.open();
|
|
870
|
+
}
|
|
867
871
|
this.foundation.handleInputChange(value);
|
|
868
872
|
};
|
|
869
873
|
|
|
@@ -1298,7 +1302,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
1298
1302
|
};
|
|
1299
1303
|
|
|
1300
1304
|
renderTree = () => {
|
|
1301
|
-
const { keyEntities, motionKeys, motionType, inputValue, filteredKeys, flattenNodes } = this.state;
|
|
1305
|
+
const { keyEntities, motionKeys, motionType, inputValue, filteredKeys, flattenNodes, checkedKeys, realCheckedKeys } = this.state;
|
|
1302
1306
|
const {
|
|
1303
1307
|
loadData,
|
|
1304
1308
|
filterTreeNode,
|
|
@@ -1315,6 +1319,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
1315
1319
|
searchPosition,
|
|
1316
1320
|
renderLabel,
|
|
1317
1321
|
renderFullLabel,
|
|
1322
|
+
checkRelation,
|
|
1318
1323
|
} = this.props;
|
|
1319
1324
|
const wrapperCls = cls(`${prefixTree}-wrapper`);
|
|
1320
1325
|
const listCls = cls(`${prefixTree}-option-list`, {
|
|
@@ -1359,7 +1364,12 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
1359
1364
|
this.renderInput()
|
|
1360
1365
|
}
|
|
1361
1366
|
<div className={listCls} role="tree" aria-multiselectable={multiple ? true : false} style={optionListStyle}>
|
|
1362
|
-
{noData ? this.renderEmpty() :
|
|
1367
|
+
{ noData ? this.renderEmpty() : (multiple ?
|
|
1368
|
+
(<CheckboxGroup value={Array.from(checkRelation === 'related' ? checkedKeys : realCheckedKeys)}>
|
|
1369
|
+
{this.renderNodeList()}
|
|
1370
|
+
</CheckboxGroup>) :
|
|
1371
|
+
this.renderNodeList()
|
|
1372
|
+
)}
|
|
1363
1373
|
</div>
|
|
1364
1374
|
{outerBottomSlot}
|
|
1365
1375
|
</div>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
/* argus-disable unPkgSensitiveInfo */
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useRef } from 'react';
|
|
4
4
|
import { storiesOf } from '@storybook/react';
|
|
5
5
|
import Upload from '../index';
|
|
6
6
|
|
|
7
7
|
const stories = storiesOf('Upload', module);
|
|
8
8
|
|
|
9
|
-
stories.add('Upload', () =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
stories.add('Upload', () => {
|
|
10
|
+
const ref = useRef();
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<Upload action='//semi.design' ref={ref} />
|
|
14
|
+
</>
|
|
15
|
+
);
|
|
16
|
+
});
|