@douyinfe/semi-ui 2.8.2 → 2.9.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 (118) hide show
  1. package/anchor/__test__/anchor.test.js +1 -0
  2. package/anchor/_story/anchor.stories.js +23 -1
  3. package/badge/index.tsx +12 -3
  4. package/cascader/_story/cascader.stories.js +17 -2
  5. package/cascader/index.tsx +1 -1
  6. package/checkbox/_story/checkbox.stories.js +1 -1
  7. package/collapse/item.tsx +2 -0
  8. package/datePicker/_story/datePicker.stories.js +37 -0
  9. package/descriptions/index.tsx +3 -4
  10. package/descriptions/item.tsx +1 -1
  11. package/dist/css/semi.css +63 -17
  12. package/dist/css/semi.min.css +1 -1
  13. package/dist/umd/semi-ui.js +7444 -3323
  14. package/dist/umd/semi-ui.js.map +1 -1
  15. package/dist/umd/semi-ui.min.js +1 -1
  16. package/dist/umd/semi-ui.min.js.map +1 -1
  17. package/divider/__test__/divider.test.js +72 -0
  18. package/divider/_story/Demo.tsx +16 -0
  19. package/divider/_story/divider.stories.js +41 -0
  20. package/divider/_story/divider.stories.tsx +8 -0
  21. package/divider/index.tsx +72 -0
  22. package/form/_story/demo.jsx +9 -0
  23. package/index.ts +1 -0
  24. package/input/__test__/input.test.js +12 -3
  25. package/input/__test__/textArea.test.js +53 -0
  26. package/lib/cjs/badge/index.d.ts +9 -0
  27. package/lib/cjs/badge/index.js +34 -6
  28. package/lib/cjs/button/index.d.ts +1 -1
  29. package/lib/cjs/cascader/index.js +1 -1
  30. package/lib/cjs/collapse/item.js +4 -2
  31. package/lib/cjs/descriptions/index.d.ts +2 -3
  32. package/lib/cjs/descriptions/index.js +4 -3
  33. package/lib/cjs/descriptions/item.d.ts +1 -1
  34. package/lib/cjs/divider/index.d.ts +20 -0
  35. package/lib/cjs/divider/index.js +88 -0
  36. package/lib/cjs/form/baseForm.d.ts +1 -1
  37. package/lib/cjs/form/errorMessage.d.ts +1 -1
  38. package/lib/cjs/iconButton/index.d.ts +1 -1
  39. package/lib/cjs/index.d.ts +1 -0
  40. package/lib/cjs/index.js +9 -0
  41. package/lib/cjs/modal/Modal.js +3 -0
  42. package/lib/cjs/modal/confirm.d.ts +5 -5
  43. package/lib/cjs/navigation/Header.d.ts +1 -1
  44. package/lib/cjs/navigation/index.d.ts +2 -2
  45. package/lib/cjs/popover/index.d.ts +1 -1
  46. package/lib/cjs/progress/index.d.ts +1 -1
  47. package/lib/cjs/scrollList/scrollItem.js +4 -0
  48. package/lib/cjs/select/optionGroup.d.ts +1 -1
  49. package/lib/cjs/slider/index.js +16 -12
  50. package/lib/cjs/table/Body/BaseRow.d.ts +1 -1
  51. package/lib/cjs/table/Body/ExpandedRow.d.ts +1 -1
  52. package/lib/cjs/table/Column.d.ts +1 -1
  53. package/lib/cjs/table/ColumnShape.d.ts +1 -1
  54. package/lib/cjs/table/CustomExpandIcon.d.ts +1 -1
  55. package/lib/cjs/table/Table.d.ts +5 -5
  56. package/lib/cjs/table/index.d.ts +4 -4
  57. package/lib/cjs/tabs/TabPane.js +4 -0
  58. package/lib/cjs/tabs/index.js +2 -0
  59. package/lib/cjs/tagInput/index.d.ts +1 -1
  60. package/lib/cjs/tooltip/index.d.ts +1 -1
  61. package/lib/cjs/transfer/index.d.ts +1 -0
  62. package/lib/cjs/transfer/index.js +3 -1
  63. package/lib/es/badge/index.d.ts +9 -0
  64. package/lib/es/badge/index.js +31 -6
  65. package/lib/es/button/index.d.ts +1 -1
  66. package/lib/es/cascader/index.js +1 -1
  67. package/lib/es/collapse/item.js +4 -2
  68. package/lib/es/descriptions/index.d.ts +2 -3
  69. package/lib/es/descriptions/index.js +4 -3
  70. package/lib/es/descriptions/item.d.ts +1 -1
  71. package/lib/es/divider/index.d.ts +20 -0
  72. package/lib/es/divider/index.js +68 -0
  73. package/lib/es/form/baseForm.d.ts +1 -1
  74. package/lib/es/form/errorMessage.d.ts +1 -1
  75. package/lib/es/iconButton/index.d.ts +1 -1
  76. package/lib/es/index.d.ts +1 -0
  77. package/lib/es/index.js +1 -0
  78. package/lib/es/modal/Modal.js +3 -0
  79. package/lib/es/modal/confirm.d.ts +5 -5
  80. package/lib/es/navigation/Header.d.ts +1 -1
  81. package/lib/es/navigation/index.d.ts +2 -2
  82. package/lib/es/popover/index.d.ts +1 -1
  83. package/lib/es/progress/index.d.ts +1 -1
  84. package/lib/es/scrollList/scrollItem.js +4 -0
  85. package/lib/es/select/optionGroup.d.ts +1 -1
  86. package/lib/es/slider/index.js +16 -12
  87. package/lib/es/table/Body/BaseRow.d.ts +1 -1
  88. package/lib/es/table/Body/ExpandedRow.d.ts +1 -1
  89. package/lib/es/table/Column.d.ts +1 -1
  90. package/lib/es/table/ColumnShape.d.ts +1 -1
  91. package/lib/es/table/CustomExpandIcon.d.ts +1 -1
  92. package/lib/es/table/Table.d.ts +5 -5
  93. package/lib/es/table/index.d.ts +4 -4
  94. package/lib/es/tabs/TabPane.js +4 -0
  95. package/lib/es/tabs/index.js +2 -0
  96. package/lib/es/tagInput/index.d.ts +1 -1
  97. package/lib/es/tooltip/index.d.ts +1 -1
  98. package/lib/es/transfer/index.d.ts +1 -0
  99. package/lib/es/transfer/index.js +3 -1
  100. package/modal/Modal.tsx +2 -0
  101. package/modal/confirm.tsx +1 -1
  102. package/overflowList/_story/overflowList.stories.js +44 -0
  103. package/package.json +9 -9
  104. package/scrollList/_story/SingleWheelList/index.js +72 -0
  105. package/scrollList/_story/scrolllist.stories.js +7 -0
  106. package/scrollList/scrollItem.tsx +3 -0
  107. package/slider/_story/slider.stories.js +28 -6
  108. package/slider/index.tsx +15 -10
  109. package/table/__test__/table.test.js +1 -0
  110. package/tabs/TabPane.tsx +2 -0
  111. package/tabs/_story/tabs.stories.js +72 -0
  112. package/tabs/index.tsx +1 -0
  113. package/tagInput/_story/tagInput.stories.js +14 -1
  114. package/tooltip/_story/tooltip.stories.js +127 -15
  115. package/transfer/index.tsx +4 -1
  116. package/typography/__test__/typography.test.js +1 -0
  117. package/upload/__test__/upload.test.js +2 -0
  118. package/upload/_story/upload.stories.js +2 -2
@@ -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
 
@@ -254,14 +254,15 @@ SliderInScrollContainer.story = {
254
254
 
255
255
  class ControlledSlider extends Component {
256
256
  state = {
257
- value: 50,
258
- rangeValue: undefined,
257
+ value: 30,
258
+ rangeValue: [10, 30],
259
259
  };
260
260
  changeValue = () => {
261
261
  this.setState({ value: this.state.value + 10 });
262
+ const [start, end] = this.state.rangeValue;
263
+ this.setState({ rangeValue: [start - 10, end + 10]})
262
264
  };
263
265
  changeRangeValue = rangeValue => {
264
- console.log('rangeValue' + rangeValue);
265
266
  this.setState({ rangeValue: rangeValue });
266
267
  };
267
268
  render() {
@@ -269,21 +270,42 @@ class ControlledSlider extends Component {
269
270
  return (
270
271
  <div>
271
272
  <Button onClick={() => this.changeValue()}>点击改变value</Button>
272
- <div style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
273
+ <div data-cy="horizontalNoChangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
274
+ <Slider
275
+ value={30}
276
+ onChange={value => {
277
+ console.log('value改变了' + value);
278
+ }}
279
+ ></Slider>
280
+ </div>
281
+ <div data-cy="horizontalOnChangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
273
282
  <Slider
274
283
  value={value}
275
284
  onChange={value => {
276
285
  console.log('value改变了' + value);
286
+ this.setState({value: value});
277
287
  }}
278
288
  ></Slider>
279
289
  </div>
280
- <div style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
290
+ <div data-cy="horizontalNoChangeRangeSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
281
291
  <Slider
282
292
  value={rangeValue}
283
- onChange={rangeValue => this.changeRangeValue(rangeValue)}
293
+ onChange={rangeValue => {
294
+ console.log('value改变了' + rangeValue);
295
+ }}
284
296
  range
285
297
  ></Slider>
286
298
  </div>
299
+ <div data-cy="horizontalNoChangeVerticalSlider" style={{ width: 800, marginLeft: 20, marginTop: 40 }}>
300
+ <Slider
301
+ value={40}
302
+ vertical
303
+ onChange={value => {
304
+ console.log('value改变了' + value);
305
+ }}
306
+ style={{height: '300px'}}
307
+ ></Slider>
308
+ </div>
287
309
  </div>
288
310
  );
289
311
  }
package/slider/index.tsx CHANGED
@@ -195,29 +195,33 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
195
195
  this._addEventListener(document.body, 'mouseup', this.foundation.onHandleUp, false);
196
196
  this._addEventListener(document.body, 'touchmove', this.foundation.onHandleTouchMove, false);
197
197
  },
198
- onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback = noop, clickTrack = false): boolean | void => {
198
+ onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback = noop, clickTrack = false, outPutValue): boolean | void => {
199
199
 
200
200
  const sliderDOMIsInRenderTree = this.foundation.checkAndUpdateIsInRenderTreeState();
201
201
  if (!sliderDOMIsInRenderTree) {
202
202
  return;
203
203
  }
204
204
 
205
- const { value, onChange } = this.props;
206
- const moveValue = this.foundation.transPosToValue(mousePos, isMin);
207
- if (moveValue === false) {
208
- return;
205
+ const { value } = this.props;
206
+
207
+
208
+ let finalOutPutValue = outPutValue;
209
+ if (finalOutPutValue === undefined) {
210
+ const moveValue = this.foundation.transPosToValue(mousePos, isMin);
211
+ if (moveValue === false) {
212
+ return;
213
+ }
214
+ finalOutPutValue = this.foundation.outPutValue(moveValue);
209
215
  }
210
216
 
211
- const outPutValue = this.foundation.outPutValue(moveValue);
212
217
  const { currentValue } = this.state;
213
- if (!isEqual(this.foundation.outPutValue(currentValue), outPutValue)) {
214
- onChange(outPutValue);
218
+ if (!isEqual(this.foundation.outPutValue(currentValue), finalOutPutValue)) {
215
219
  if (!clickTrack && this.foundation.valueFormatIsCorrect(value)) {
216
220
  // still require afterChangeCallback when click on the track directly, need skip here
217
221
  return false;
218
222
  }
219
223
  this.setState({
220
- currentValue: outPutValue,
224
+ currentValue: finalOutPutValue,
221
225
  }, stateChangeCallback);
222
226
  }
223
227
  },
@@ -307,7 +311,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
307
311
  'aria-labelledby': ariaLabelledby,
308
312
  'aria-disabled': disabled
309
313
  };
310
- vertical && Object.assign(commonAria, {'aria-orientation': 'vertical'});
314
+ vertical && Object.assign(commonAria, { 'aria-orientation': 'vertical' });
311
315
 
312
316
  const handleContents = !range ? (
313
317
  <Tooltip
@@ -494,6 +498,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
494
498
  });
495
499
  const markPercent = (Number(mark) - min) / (max - min);
496
500
  return activeResult ? (
501
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
497
502
  <span
498
503
  key={mark}
499
504
  onClick={e => this.foundation.handleWrapClick(e)}
@@ -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: {
@@ -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>