@douyinfe/semi-ui 2.9.0-beta.1 → 2.10.0-alpha.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.
Files changed (101) hide show
  1. package/anchor/__test__/anchor.test.js +1 -0
  2. package/anchor/_story/anchor.stories.js +23 -1
  3. package/cascader/_story/cascader.stories.js +17 -2
  4. package/cascader/index.tsx +1 -1
  5. package/checkbox/_story/checkbox.stories.js +1 -1
  6. package/checkbox/checkbox.tsx +18 -8
  7. package/collapse/item.tsx +2 -0
  8. package/datePicker/_story/datePicker.stories.js +37 -0
  9. package/dist/css/semi.css +1 -2
  10. package/dist/css/semi.min.css +1 -1
  11. package/dist/umd/semi-ui.js +23386 -23414
  12. package/dist/umd/semi-ui.js.map +1 -1
  13. package/dist/umd/semi-ui.min.js +1 -1
  14. package/dist/umd/semi-ui.min.js.map +1 -1
  15. package/input/__test__/input.test.js +12 -3
  16. package/input/__test__/textArea.test.js +53 -0
  17. package/lib/cjs/_portal/index.d.ts +1 -1
  18. package/lib/cjs/cascader/index.js +1 -1
  19. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  20. package/lib/cjs/checkbox/checkbox.js +25 -13
  21. package/lib/cjs/collapse/item.js +4 -2
  22. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  23. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  24. package/lib/cjs/datePicker/insetInput.d.ts +0 -1
  25. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  26. package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -1
  27. package/lib/cjs/form/baseForm.d.ts +1 -1
  28. package/lib/cjs/form/field.d.ts +1 -1
  29. package/lib/cjs/modal/Modal.js +3 -0
  30. package/lib/cjs/modal/useModal/index.d.ts +0 -1
  31. package/lib/cjs/notification/useNotification/index.d.ts +0 -1
  32. package/lib/cjs/radio/radio.d.ts +5 -1
  33. package/lib/cjs/radio/radio.js +26 -12
  34. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  35. package/lib/cjs/scrollList/scrollItem.js +4 -0
  36. package/lib/cjs/tabs/TabPane.js +4 -0
  37. package/lib/cjs/tabs/index.js +2 -0
  38. package/lib/cjs/timePicker/Combobox.d.ts +0 -1
  39. package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
  40. package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
  41. package/lib/cjs/timePicker/index.d.ts +2 -2
  42. package/lib/cjs/toast/toast.d.ts +1 -1
  43. package/lib/cjs/toast/useToast/index.d.ts +0 -1
  44. package/lib/cjs/tooltip/index.d.ts +1 -0
  45. package/lib/cjs/tooltip/index.js +6 -1
  46. package/lib/cjs/transfer/index.d.ts +1 -0
  47. package/lib/cjs/transfer/index.js +3 -1
  48. package/lib/cjs/typography/title.d.ts +1 -1
  49. package/lib/cjs/upload/index.d.ts +1 -1
  50. package/lib/es/_portal/index.d.ts +1 -1
  51. package/lib/es/cascader/index.js +1 -1
  52. package/lib/es/checkbox/checkbox.d.ts +4 -0
  53. package/lib/es/checkbox/checkbox.js +25 -13
  54. package/lib/es/collapse/item.js +4 -2
  55. package/lib/es/datePicker/dateInput.d.ts +1 -1
  56. package/lib/es/datePicker/datePicker.d.ts +1 -1
  57. package/lib/es/datePicker/insetInput.d.ts +0 -1
  58. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  59. package/lib/es/dropdown/dropdownMenu.d.ts +0 -1
  60. package/lib/es/form/baseForm.d.ts +1 -1
  61. package/lib/es/form/field.d.ts +1 -1
  62. package/lib/es/modal/Modal.js +3 -0
  63. package/lib/es/modal/useModal/index.d.ts +0 -1
  64. package/lib/es/notification/useNotification/index.d.ts +0 -1
  65. package/lib/es/radio/radio.d.ts +5 -1
  66. package/lib/es/radio/radio.js +26 -12
  67. package/lib/es/radio/radioGroup.d.ts +1 -1
  68. package/lib/es/scrollList/scrollItem.js +4 -0
  69. package/lib/es/tabs/TabPane.js +4 -0
  70. package/lib/es/tabs/index.js +2 -0
  71. package/lib/es/timePicker/Combobox.d.ts +0 -1
  72. package/lib/es/timePicker/TimePicker.d.ts +2 -2
  73. package/lib/es/timePicker/TimeShape.d.ts +1 -1
  74. package/lib/es/timePicker/index.d.ts +2 -2
  75. package/lib/es/toast/toast.d.ts +1 -1
  76. package/lib/es/toast/useToast/index.d.ts +0 -1
  77. package/lib/es/tooltip/index.d.ts +1 -0
  78. package/lib/es/tooltip/index.js +6 -1
  79. package/lib/es/transfer/index.d.ts +1 -0
  80. package/lib/es/transfer/index.js +3 -1
  81. package/lib/es/typography/title.d.ts +1 -1
  82. package/lib/es/upload/index.d.ts +1 -1
  83. package/modal/Modal.tsx +2 -0
  84. package/modal/confirm.tsx +1 -1
  85. package/overflowList/_story/overflowList.stories.js +44 -0
  86. package/package.json +9 -9
  87. package/radio/radio.tsx +17 -7
  88. package/scrollList/_story/SingleWheelList/index.js +72 -0
  89. package/scrollList/_story/scrolllist.stories.js +7 -0
  90. package/scrollList/scrollItem.tsx +3 -0
  91. package/table/__test__/table.test.js +1 -0
  92. package/tabs/TabPane.tsx +2 -0
  93. package/tabs/_story/tabs.stories.js +72 -0
  94. package/tabs/index.tsx +1 -0
  95. package/tagInput/_story/tagInput.stories.js +14 -1
  96. package/tooltip/_story/tooltip.stories.js +127 -15
  97. package/tooltip/index.tsx +5 -1
  98. package/transfer/index.tsx +4 -1
  99. package/typography/__test__/typography.test.js +1 -0
  100. package/upload/__test__/upload.test.js +2 -0
  101. package/upload/_story/upload.stories.js +2 -2
package/radio/radio.tsx CHANGED
@@ -41,10 +41,14 @@ export type RadioProps = {
41
41
  addonClassName?: string;
42
42
  type?: RadioType;
43
43
  'aria-label'?: React.AriaAttributes['aria-label'];
44
+ addonId?: string;
45
+ extraId?: string;
44
46
  };
45
47
 
46
48
  export interface RadioState {
47
49
  hover?: boolean;
50
+ addonId?: string;
51
+ extraId?: string;
48
52
  }
49
53
 
50
54
  export { RadioChangeEvent };
@@ -94,11 +98,11 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
94
98
  super(props);
95
99
  this.state = {
96
100
  hover: false,
101
+ addonId: props.addonId,
102
+ extraId: props.extraId,
97
103
  };
98
104
  this.foundation = new RadioFoundation(this.adapter);
99
105
  this.radioEntity = null;
100
- this.addonId = getUuidShort({ prefix: 'addon' });
101
- this.extraId = getUuidShort({ prefix: 'extra' });
102
106
  }
103
107
 
104
108
  get adapter(): RadioAdapter {
@@ -106,6 +110,12 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
106
110
  ...super.adapter,
107
111
  setHover: (hover: boolean) => {
108
112
  this.setState({ hover });
113
+ },
114
+ setAddonId: () => {
115
+ this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
116
+ },
117
+ setExtraId: () => {
118
+ this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
109
119
  }
110
120
  };
111
121
  }
@@ -168,7 +178,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
168
178
  isButtonRadioComponent,
169
179
  buttonSize,
170
180
  realPrefixCls;
171
- const isHover = this.state.hover;
181
+ const { hover: isHover, addonId, extraId } = this.state;
172
182
  let props = {};
173
183
 
174
184
  if (this.isInGroup()) {
@@ -218,8 +228,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
218
228
  }, addonClassName);
219
229
  const renderContent = () => (
220
230
  <>
221
- {children ? <span className={addonCls} style={addonStyle} id={this.addonId}>{children}</span> : null}
222
- {extra && !isButtonRadio ? <div className={`${prefix}-extra`} id={this.extraId}>{extra}</div> : null}
231
+ {children ? <span className={addonCls} style={addonStyle} id={addonId}>{children}</span> : null}
232
+ {extra && !isButtonRadio ? <div className={`${prefix}-extra`} id={extraId}>{extra}</div> : null}
223
233
  </>
224
234
  );
225
235
  return (
@@ -240,8 +250,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
240
250
  ref={(ref: RadioInner) => {
241
251
  this.radioEntity = ref;
242
252
  }}
243
- addonId={children && this.addonId}
244
- extraId={extra && this.extraId}
253
+ addonId={children && addonId}
254
+ extraId={extra && extraId}
245
255
  />
246
256
  {
247
257
  isCardRadioGroup ?
@@ -0,0 +1,72 @@
1
+ import { ScrollList, ScrollItem, Button } from '@douyinfe/semi-ui';
2
+ import React from 'react';
3
+
4
+ class SingleScrollListDemo extends React.Component {
5
+ constructor(props) {
6
+ super(props);
7
+ this.state = {
8
+ selectIndex3: -2,
9
+ };
10
+
11
+ this.minutes = new Array(60).fill(0).map((itm, index) => {
12
+ return {
13
+ value: index,
14
+ disabled: index % 2 === 1 ? true : false,
15
+ };
16
+ });
17
+ this.onSelectMinute = this.onSelectMinute.bind(this);
18
+ this.handleClose = this.handleClose.bind(this);
19
+ this.renderFooter = this.renderFooter.bind(this);
20
+ }
21
+
22
+
23
+ onSelectMinute(data) {
24
+ console.log('You have choose the minute for: ', data.value);
25
+ this.setState({
26
+ ['selectIndex' + data.type]: data.index,
27
+ });
28
+ }
29
+
30
+ handleClose() {
31
+ console.log('close');
32
+ }
33
+
34
+ renderFooter() {
35
+ return (
36
+ <Button size="small" type="primary" onClick={this.handleClose}>
37
+ Ok
38
+ </Button>
39
+ );
40
+ }
41
+
42
+ render() {
43
+ let list = this.list;
44
+ const scrollStyle = {
45
+ border: 'unset',
46
+ boxShadow: 'unset',
47
+ };
48
+ const commonProps = {
49
+ // mode: 'normal',
50
+ mode: 'wheel',
51
+ cycled: false,
52
+ motion: false,
53
+ };
54
+ return (
55
+ <div>
56
+ <ScrollList style={scrollStyle} header={'单个无限滚动列表'} footer={this.renderFooter()}>
57
+ <ScrollItem
58
+ {...commonProps}
59
+ list={this.minutes}
60
+ type={3}
61
+ selectedIndex={this.state.selectIndex3}
62
+ onSelect={this.onSelectMinute}
63
+ aria-label="分钟"
64
+ cycled
65
+ />
66
+ </ScrollList>
67
+ </div>
68
+ );
69
+ }
70
+ }
71
+
72
+ export default SingleScrollListDemo;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import WheelListDemo from './WheelList';
3
3
  import ScrollListDemo from './ScrollList';
4
+ import SingleScrollListDemo from './SingleWheelList';
4
5
 
5
6
 
6
7
  export default {
@@ -24,3 +25,9 @@ export const _WheelListDemo = () => <WheelListDemo />;
24
25
  _WheelListDemo.story = {
25
26
  name: 'wheel list demo',
26
27
  };
28
+
29
+ export const SingleScrollList = () => <SingleScrollListDemo />;
30
+
31
+ SingleScrollList.story = {
32
+ name: 'single scroll list demo',
33
+ };
@@ -178,6 +178,7 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
178
178
 
179
179
  _cacheWrapperNode = (wrapper: Element) => this._cacheNode('wrapper', wrapper);
180
180
 
181
+ /* istanbul ignore next */
181
182
  _isFirst = (node: Element) => {
182
183
  const { list } = this;
183
184
 
@@ -191,6 +192,8 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
191
192
  return false;
192
193
  };
193
194
 
195
+
196
+ /* istanbul ignore next */
194
197
  _isLast = (node: Element) => {
195
198
  const { list } = this;
196
199
 
@@ -109,6 +109,7 @@ describe(`Table`, () => {
109
109
  myCls,
110
110
  myClsIndex,
111
111
  });
112
+ demo.unmount();
112
113
  });
113
114
  it(`test object columns appearance`, async () => {
114
115
  const myCls = `my-tr-class`;
package/tabs/TabPane.tsx CHANGED
@@ -53,6 +53,7 @@ class TabPane extends PureComponent<TabPaneProps> {
53
53
  return false;
54
54
  };
55
55
 
56
+ /* istanbul ignore next */
56
57
  hideScroll = (): void => {
57
58
  if (this.ref && this.ref.current) {
58
59
  this.ref.current.style.overflow = 'hidden';
@@ -60,6 +61,7 @@ class TabPane extends PureComponent<TabPaneProps> {
60
61
  }
61
62
  };
62
63
 
64
+ /* istanbul ignore next */
63
65
  autoScroll = (): void => {
64
66
  if (this.ref && this.ref.current) {
65
67
  this.ref.current.style.overflow = '';
@@ -795,3 +795,75 @@ export const TabSize = () => <TabSizeDemo />;
795
795
  TabSize.story = {
796
796
  name: 'tab size',
797
797
  };
798
+
799
+ class TabListChangeDemo extends React.Component {
800
+ constructor() {
801
+ super();
802
+ this.state = {
803
+ itemKey: '1',
804
+ tabList:[
805
+ {
806
+ tab: '文档',
807
+ itemKey: '1',
808
+ },
809
+ {
810
+ tab: '快速起步',
811
+ itemKey: '2',
812
+ },
813
+ {
814
+ tab: '帮助',
815
+ itemKey: '3',
816
+ },
817
+ {
818
+ tab: '关于',
819
+ itemKey: '4',
820
+ },
821
+ {
822
+ tab: '资源工具',
823
+ itemKey: '5',
824
+ },
825
+ ]
826
+ };
827
+ this.onTabClick = this.onTabClick.bind(this);
828
+ }
829
+
830
+ onTabClick(itemKey, type) {
831
+ this.setState({
832
+ [type]: itemKey,
833
+ tabList: [{
834
+ tab: '文档',
835
+ itemKey: '1',
836
+ }]
837
+ });
838
+ }
839
+
840
+ render() {
841
+ const contentList = [
842
+ <div>文档</div>,
843
+ <div>快速起步</div>,
844
+ <div>帮助</div>,
845
+ <div>关于</div>,
846
+ <div>资源工具</div>,
847
+ ];
848
+ return (
849
+ <Tabs
850
+ style={style}
851
+ type="line"
852
+ tabList={this.state.tabList}
853
+ onTabClick={itemKey => {
854
+ this.onTabClick(itemKey, 'itemKey');
855
+ }}
856
+ >
857
+ {contentList[this.state.itemKey]}
858
+ <span>test</span>
859
+ <span>test2</span>
860
+ </Tabs>
861
+ );
862
+ }
863
+ }
864
+
865
+ export const TabListChange = () => <TabListChangeDemo />;
866
+
867
+ TabListChange.story = {
868
+ name: 'tablist change',
869
+ };
package/tabs/index.tsx CHANGED
@@ -192,6 +192,7 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
192
192
  this.foundation.handleTabClick(activeKey, event);
193
193
  };
194
194
 
195
+ /* istanbul ignore next */
195
196
  rePosChildren = (children: ReactElement[], activeKey: string): ReactElement[] => {
196
197
  const newChildren: ReactElement[] = [];
197
198
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Toast, Icon, Button, Avatar } from '@douyinfe/semi-ui/';
2
+ import { Toast, Icon, Button, Avatar, Form } from '@douyinfe/semi-ui/';
3
3
  import TagInput from '../index';
4
4
  import { IconGift, IconVigoLogo } from '@douyinfe/semi-icons';
5
5
  const style = {
@@ -412,3 +412,16 @@ export const PrefixSuffix = () => (
412
412
  PrefixSuffix.story = {
413
413
  name: 'prefix / suffix',
414
414
  };
415
+
416
+
417
+ export const TagInputInForm = () => (
418
+ <>
419
+ <Form onSubmit={() => Toast.info('123')}>
420
+ <TagInput showClear />
421
+ </Form>
422
+ </>
423
+ );
424
+
425
+ PrefixSuffix.story = {
426
+ name: 'TagInputInForm'
427
+ };
@@ -404,6 +404,115 @@ AdjustPosition.story = {
404
404
  name: '自适应',
405
405
  };
406
406
 
407
+ export const AdjustPosIfNeed = () => {
408
+ const tops = [
409
+ ['topLeft', 'TL'],
410
+ ['top', 'Top'],
411
+ ['topRight', 'TR'],
412
+ ];
413
+ const lefts = [
414
+ ['leftTop', 'LT'],
415
+ ['left', 'Left'],
416
+ ['leftBottom', 'LB'],
417
+ ];
418
+ const rights = [
419
+ ['rightTop', 'RT'],
420
+ ['right', 'Right'],
421
+ ['rightBottom', 'RB'],
422
+ ];
423
+ const bottoms = [
424
+ ['bottomLeft', 'BL'],
425
+ ['bottom', 'Bottom'],
426
+ ['bottomRight', 'BR'],
427
+ ];
428
+
429
+ return (
430
+ <div style={{ paddingLeft: 40 }}>
431
+ <div style={{ marginLeft: 40, whiteSpace: 'nowrap' }}>
432
+ {tops.map((pos, index) => (
433
+ <Tooltip
434
+ showArrow
435
+ arrowPointAtCenter
436
+ content={
437
+ <article>
438
+ Hi ByteDancer, this is a tooltip.
439
+ <br /> We have 2 lines.
440
+ </article>
441
+ }
442
+ position={Array.isArray(pos) ? pos[0] : pos}
443
+ key={index}
444
+ >
445
+ <Tag
446
+ style={{ marginRight: '8px' }}
447
+ data-cy={Array.isArray(pos) ? pos[0] : pos}
448
+ >
449
+ {Array.isArray(pos) ? pos[1] : pos}
450
+ </Tag>
451
+ </Tooltip>
452
+ ))}
453
+ </div>
454
+ <div style={{ width: 40, float: 'left' }}>
455
+ {lefts.map((pos, index) => (
456
+ <Tooltip
457
+ showArrow
458
+ arrowPointAtCenter
459
+ content={
460
+ <article>
461
+ Hi ByteDancer, this is a tooltip.
462
+ <br /> We have 2 lines.
463
+ </article>
464
+ }
465
+ position={Array.isArray(pos) ? pos[0] : pos}
466
+ key={index}
467
+ >
468
+ <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
469
+ </Tooltip>
470
+ ))}
471
+ </div>
472
+ <div style={{ width: 40, marginLeft: 180 }}>
473
+ {rights.map((pos, index) => (
474
+ <Tooltip
475
+ showArrow
476
+ arrowPointAtCenter
477
+ content={
478
+ <article>
479
+ Hi ByteDancer, this is a tooltip.
480
+ <br /> We have 2 lines.
481
+ </article>
482
+ }
483
+ position={Array.isArray(pos) ? pos[0] : pos}
484
+ key={index}
485
+ >
486
+ <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} style={{ marginBottom: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
487
+ </Tooltip>
488
+ ))}
489
+ </div>
490
+ <div style={{ marginLeft: 40, clear: 'both', whiteSpace: 'nowrap' }}>
491
+ {bottoms.map((pos, index) => (
492
+ <Tooltip
493
+ showArrow
494
+ arrowPointAtCenter
495
+ content={
496
+ <article>
497
+ Hi ByteDancer, this is a tooltip.
498
+ <br /> We have 2 lines.
499
+ </article>
500
+ }
501
+ position={Array.isArray(pos) ? pos[0] : pos}
502
+ key={index}
503
+ >
504
+ <Tag data-cy={Array.isArray(pos) ? pos[0] : pos} position={Array.isArray(pos) ? pos[0] : pos} style={{ marginRight: '8px' }}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
505
+ </Tooltip>
506
+ ))}
507
+ </div>
508
+ </div>
509
+ );
510
+ }
511
+
512
+ AdjustPosIfNeed.story = {
513
+ name: '自适应位置',
514
+ };
515
+
407
516
  export const CompositeComponent = () => (
408
517
  <div
409
518
  style={{
@@ -764,7 +873,7 @@ export const leftTopOverDemo = () => {
764
873
  content,
765
874
  trigger: 'click',
766
875
  showArrow: false,
767
- visible,
876
+ visible:true,
768
877
  trigger: 'custom',
769
878
  motion: false,
770
879
  };
@@ -774,34 +883,37 @@ export const leftTopOverDemo = () => {
774
883
 
775
884
  return (
776
885
  <div data-cy="wrapper">
777
- <Button onClick={() => setVisible(!visible)}>toggle visible</Button>
778
- <div style={{ paddingTop: 200 }}>
886
+ <Button onClick={() => setVisible(!visible)} data-cy="toggleVisible">toggle visible</Button>
887
+ <div style={{ paddingTop: 110 }}>
779
888
  <Space spacing={80}>
780
- <Tooltip {...commonProps} position="leftTopOver">
781
- <Button data-cy="leftTopOver" style={buttonStyle}>
782
- leftTopOver
783
- </Button>
784
- </Tooltip>
785
- <Tooltip {...commonProps} position="leftBottomOver">
889
+ <Tooltip {...commonProps} position="leftBottomOver" trigger="click">
786
890
  <Button data-cy="leftBottomOver" style={buttonStyle}>
787
891
  leftBottomOver
788
892
  </Button>
789
893
  </Tooltip>
790
- <Tooltip {...commonProps} position="rightTopOver">
791
- <Button data-cy="rightTopOver" style={buttonStyle}>
792
- rightTopOver
793
- </Button>
794
- </Tooltip>
795
- <Tooltip {...commonProps} position="rightBottomOver">
894
+ <Tooltip {...commonProps} position="rightBottomOver" trigger="click">
796
895
  <Button data-cy="rightBottomOver" style={buttonStyle}>
797
896
  rightBottomOver
798
897
  </Button>
799
898
  </Tooltip>
800
899
  </Space>
801
900
  </div>
901
+ <Space spacing={80}>
902
+ <Tooltip {...commonProps} position="leftTopOver" trigger="click">
903
+ <Button data-cy="leftTopOver" style={buttonStyle}>
904
+ leftTopOver
905
+ </Button>
906
+ </Tooltip>
907
+ <Tooltip {...commonProps} position="rightTopOver" trigger="click">
908
+ <Button data-cy="rightTopOver" style={buttonStyle}>
909
+ rightTopOver
910
+ </Button>
911
+ </Tooltip>
912
+ </Space>
802
913
  </div>
803
914
  );
804
915
  };
916
+
805
917
  leftTopOverDemo.storyName = `leftTopOver visible`;
806
918
  leftTopOverDemo.parameters = {
807
919
  chromatic: {
package/tooltip/index.tsx CHANGED
@@ -75,6 +75,7 @@ export interface TooltipProps extends BaseProps {
75
75
  guardFocus?: boolean;
76
76
  returnFocusOnClose?: boolean;
77
77
  onEscKeyDown?: (e: React.KeyboardEvent) => void;
78
+ wrapperId?: string;
78
79
  }
79
80
  interface TooltipState {
80
81
  visible: boolean;
@@ -193,7 +194,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
193
194
  placement: props.position || 'top',
194
195
  transitionStyle: {},
195
196
  isPositionUpdated: false,
196
- id: getUuidShort(), // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
197
+ id: props.wrapperId, // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
197
198
  };
198
199
  this.foundation = new TooltipFoundation(this.adapter);
199
200
  this.eventManager = new Event();
@@ -428,6 +429,9 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
428
429
  },
429
430
  notifyEscKeydown: (event: React.KeyboardEvent) => {
430
431
  this.props.onEscKeyDown(event);
432
+ },
433
+ setId: () => {
434
+ this.setState({ id: getUuidShort() });
431
435
  }
432
436
  };
433
437
  }
@@ -60,6 +60,8 @@ export interface SourcePanelProps {
60
60
  filterData: Array<DataItem>;
61
61
  /* All items */
62
62
  sourceData: Array<DataItem>;
63
+ /* transfer props' dataSource */
64
+ propsDataSource: DataSource,
63
65
  /* Whether to select all */
64
66
  allChecked: boolean;
65
67
  /* Number of filtered results */
@@ -359,7 +361,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
359
361
 
360
362
  renderLeft(locale: Locale['Transfer']) {
361
363
  const { data, selectedItems, inputValue, searchResult } = this.state;
362
- const { loading, type, emptyContent, renderSourcePanel } = this.props;
364
+ const { loading, type, emptyContent, renderSourcePanel, dataSource } = this.props;
363
365
  const totalToken = locale.total;
364
366
  const inSearchMode = inputValue !== '';
365
367
  const showNumber = inSearchMode ? searchResult.size : data.length;
@@ -423,6 +425,7 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
423
425
  noMatch,
424
426
  filterData,
425
427
  sourceData: data,
428
+ propsDataSource: dataSource,
426
429
  allChecked: !leftContainesNotInSelected,
427
430
  showNumber,
428
431
  inputValue,
@@ -24,6 +24,7 @@ describe(`Typography`, () => {
24
24
  const typographyParagraph = mount(<Typography.Paragraph {...props}>Semi Design</Typography.Paragraph>)
25
25
  const p = typographyParagraph.find('div.semi-typography-paragraph');
26
26
  expect(p.length).toEqual(1);
27
+ typographyParagraph.unmount();
27
28
  });
28
29
 
29
30
  it('typography copyable', () => {
@@ -564,6 +564,7 @@ describe('Upload', () => {
564
564
  requests[0].respond(200, { 'Content-Type': 'application/json' }, 'success');
565
565
  const previewContent = upload.find(`.${BASE_CLASS_PREFIX}-upload-file-card-preview`);
566
566
  expect(previewContent.contains(specificContent)).toEqual(true);
567
+ upload.unmount();
567
568
  });
568
569
 
569
570
  it('afterUpload', () => {
@@ -642,6 +643,7 @@ describe('Upload', () => {
642
643
  ).toEqual(true);
643
644
  expect(stateFileList.every(item => item.name !== 'remove.jpg')).toEqual(true);
644
645
  expect(stateFileList[3].status === 'uploadFail' && stateFileList[3].name === rename).toEqual(true);
646
+ upload.unmount();
645
647
  });
646
648
 
647
649
  it('uploadTrigger', () => {
@@ -572,8 +572,8 @@ export const Draggable = () => (
572
572
  <Upload
573
573
  {...commonProps}
574
574
  draggable={true}
575
- disabled
576
- accept="application/pdf,.jpeg"
575
+ // disabled
576
+ accept="application/image/*,.md"
577
577
  dragMainText={'点击上传文件或拖拽文件到这里'}
578
578
  dragSubText="支持的文件类型:.jpg、.pdf"
579
579
  ></Upload>