@douyinfe/semi-ui 2.9.0-beta.1 → 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.
- package/anchor/__test__/anchor.test.js +1 -0
- package/anchor/_story/anchor.stories.js +23 -1
- package/cascader/_story/cascader.stories.js +17 -2
- package/cascader/index.tsx +1 -1
- package/checkbox/_story/checkbox.stories.js +1 -1
- package/collapse/item.tsx +2 -0
- package/datePicker/_story/datePicker.stories.js +37 -0
- package/dist/css/semi.css +1 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +27 -6
- 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/input/__test__/input.test.js +12 -3
- package/input/__test__/textArea.test.js +53 -0
- package/lib/cjs/cascader/index.js +1 -1
- package/lib/cjs/collapse/item.js +4 -2
- package/lib/cjs/modal/Modal.js +3 -0
- package/lib/cjs/scrollList/scrollItem.js +4 -0
- package/lib/cjs/tabs/TabPane.js +4 -0
- package/lib/cjs/tabs/index.js +2 -0
- package/lib/cjs/transfer/index.d.ts +1 -0
- package/lib/cjs/transfer/index.js +3 -1
- package/lib/es/cascader/index.js +1 -1
- package/lib/es/collapse/item.js +4 -2
- package/lib/es/modal/Modal.js +3 -0
- package/lib/es/scrollList/scrollItem.js +4 -0
- package/lib/es/tabs/TabPane.js +4 -0
- package/lib/es/tabs/index.js +2 -0
- package/lib/es/transfer/index.d.ts +1 -0
- package/lib/es/transfer/index.js +3 -1
- package/modal/Modal.tsx +2 -0
- package/modal/confirm.tsx +1 -1
- package/overflowList/_story/overflowList.stories.js +44 -0
- package/package.json +9 -9
- package/scrollList/_story/SingleWheelList/index.js +72 -0
- package/scrollList/_story/scrolllist.stories.js +7 -0
- package/scrollList/scrollItem.tsx +3 -0
- package/table/__test__/table.test.js +1 -0
- package/tabs/TabPane.tsx +2 -0
- package/tabs/_story/tabs.stories.js +72 -0
- package/tabs/index.tsx +1 -0
- package/tagInput/_story/tagInput.stories.js +14 -1
- package/tooltip/_story/tooltip.stories.js +127 -15
- package/transfer/index.tsx +4 -1
- package/typography/__test__/typography.test.js +1 -0
- package/upload/__test__/upload.test.js +2 -0
- package/upload/_story/upload.stories.js +2 -2
|
@@ -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:
|
|
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="
|
|
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="
|
|
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/transfer/index.tsx
CHANGED
|
@@ -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/
|
|
575
|
+
// disabled
|
|
576
|
+
accept="application/image/*,.md"
|
|
577
577
|
dragMainText={'点击上传文件或拖拽文件到这里'}
|
|
578
578
|
dragSubText="支持的文件类型:.jpg、.pdf"
|
|
579
579
|
></Upload>
|