@douyinfe/semi-ui 2.6.0-beta.0 → 2.7.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 (105) hide show
  1. package/button/__test__/button.test.js +7 -0
  2. package/button/buttonGroup.tsx +5 -2
  3. package/button/index.tsx +1 -1
  4. package/cascader/__test__/cascader.test.js +159 -81
  5. package/cascader/_story/cascader.stories.js +36 -23
  6. package/cascader/index.tsx +26 -5
  7. package/datePicker/_story/v2/InsetInput.jsx +104 -0
  8. package/datePicker/_story/v2/InsetInputE2E.jsx +69 -0
  9. package/datePicker/_story/v2/index.js +2 -0
  10. package/datePicker/dateInput.tsx +95 -9
  11. package/datePicker/datePicker.tsx +89 -15
  12. package/datePicker/index.tsx +15 -0
  13. package/datePicker/insetInput.tsx +76 -0
  14. package/datePicker/monthsGrid.tsx +14 -7
  15. package/dist/css/semi.css +105 -2
  16. package/dist/css/semi.min.css +1 -1
  17. package/dist/umd/semi-ui.js +949 -163
  18. package/dist/umd/semi-ui.js.map +1 -1
  19. package/dist/umd/semi-ui.min.js +1 -1
  20. package/dist/umd/semi-ui.min.js.map +1 -1
  21. package/form/hooks/useFormApi.tsx +3 -2
  22. package/input/_story/input.stories.js +13 -0
  23. package/lib/cjs/button/Button.d.ts +4 -4
  24. package/lib/cjs/button/buttonGroup.d.ts +3 -2
  25. package/lib/cjs/button/buttonGroup.js +6 -2
  26. package/lib/cjs/button/index.d.ts +5 -6
  27. package/lib/cjs/cascader/index.d.ts +1 -0
  28. package/lib/cjs/cascader/index.js +38 -9
  29. package/lib/cjs/datePicker/dateInput.d.ts +9 -2
  30. package/lib/cjs/datePicker/dateInput.js +92 -9
  31. package/lib/cjs/datePicker/datePicker.d.ts +7 -2
  32. package/lib/cjs/datePicker/datePicker.js +123 -18
  33. package/lib/cjs/datePicker/index.js +24 -2
  34. package/lib/cjs/datePicker/insetInput.d.ts +21 -0
  35. package/lib/cjs/datePicker/insetInput.js +80 -0
  36. package/lib/cjs/datePicker/monthsGrid.js +19 -7
  37. package/lib/cjs/form/hooks/useFormApi.d.ts +2 -1
  38. package/lib/cjs/iconButton/index.d.ts +2 -2
  39. package/lib/cjs/navigation/Item.d.ts +2 -2
  40. package/lib/cjs/navigation/Item.js +8 -6
  41. package/lib/cjs/navigation/SubNav.js +2 -2
  42. package/lib/cjs/radio/radioGroup.js +6 -0
  43. package/lib/cjs/select/index.js +5 -2
  44. package/lib/cjs/table/Body/index.d.ts +2 -0
  45. package/lib/cjs/table/Body/index.js +13 -4
  46. package/lib/cjs/tag/group.d.ts +2 -0
  47. package/lib/cjs/tag/group.js +4 -2
  48. package/lib/cjs/tooltip/index.js +6 -2
  49. package/lib/cjs/tree/index.js +5 -3
  50. package/lib/cjs/tree/interface.d.ts +1 -0
  51. package/lib/cjs/tree/nodeList.js +3 -1
  52. package/lib/cjs/treeSelect/index.js +11 -3
  53. package/lib/es/button/Button.d.ts +4 -4
  54. package/lib/es/button/buttonGroup.d.ts +3 -2
  55. package/lib/es/button/buttonGroup.js +5 -2
  56. package/lib/es/button/index.d.ts +5 -6
  57. package/lib/es/cascader/index.d.ts +1 -0
  58. package/lib/es/cascader/index.js +35 -6
  59. package/lib/es/datePicker/dateInput.d.ts +9 -2
  60. package/lib/es/datePicker/dateInput.js +91 -9
  61. package/lib/es/datePicker/datePicker.d.ts +7 -2
  62. package/lib/es/datePicker/datePicker.js +124 -18
  63. package/lib/es/datePicker/index.js +20 -0
  64. package/lib/es/datePicker/insetInput.d.ts +21 -0
  65. package/lib/es/datePicker/insetInput.js +65 -0
  66. package/lib/es/datePicker/monthsGrid.js +19 -7
  67. package/lib/es/form/hooks/useFormApi.d.ts +2 -1
  68. package/lib/es/iconButton/index.d.ts +2 -2
  69. package/lib/es/navigation/Item.d.ts +2 -2
  70. package/lib/es/navigation/Item.js +8 -6
  71. package/lib/es/navigation/SubNav.js +2 -2
  72. package/lib/es/radio/radioGroup.js +6 -0
  73. package/lib/es/select/index.js +5 -2
  74. package/lib/es/table/Body/index.d.ts +2 -0
  75. package/lib/es/table/Body/index.js +13 -4
  76. package/lib/es/tag/group.d.ts +2 -0
  77. package/lib/es/tag/group.js +4 -2
  78. package/lib/es/tooltip/index.js +6 -2
  79. package/lib/es/tree/index.js +5 -3
  80. package/lib/es/tree/interface.d.ts +1 -0
  81. package/lib/es/tree/nodeList.js +3 -1
  82. package/lib/es/treeSelect/index.js +11 -3
  83. package/navigation/Item.tsx +15 -12
  84. package/navigation/SubNav.tsx +4 -4
  85. package/package.json +9 -9
  86. package/radio/__test__/radioGroup.test.jsx +9 -1
  87. package/radio/_story/radio.stories.js +22 -1
  88. package/radio/radioGroup.tsx +9 -0
  89. package/select/_story/select.stories.js +73 -2
  90. package/select/index.tsx +5 -3
  91. package/table/Body/index.tsx +15 -4
  92. package/table/__test__/table.test.js +18 -0
  93. package/table/_story/v2/FixedExpandedRow/index.jsx +95 -0
  94. package/table/_story/v2/index.js +2 -1
  95. package/tag/group.tsx +5 -3
  96. package/tooltip/_story/tooltip.stories.js +702 -625
  97. package/tooltip/index.tsx +2 -2
  98. package/tree/__test__/tree.test.js +87 -2
  99. package/tree/_story/tree.stories.js +65 -5
  100. package/tree/index.tsx +4 -2
  101. package/tree/interface.ts +1 -0
  102. package/tree/nodeList.tsx +3 -2
  103. package/treeSelect/__test__/treeSelect.test.js +28 -0
  104. package/treeSelect/_story/treeSelect.stories.js +55 -2
  105. package/treeSelect/index.tsx +14 -3
@@ -1930,4 +1930,22 @@ describe(`Table`, () => {
1930
1930
  expect(newExpandedRows.length).toEqual(1);
1931
1931
  expect(table.state(`expandedRowKeys`)).toEqual(['1']);
1932
1932
  });
1933
+
1934
+ it(`test expanded row re-render`, () => {
1935
+ const expandedRowRender = sinon.spy(() => <div>Semi Design</div>);
1936
+ const demo = mount(
1937
+ <Table
1938
+ columns={columns}
1939
+ dataSource={data}
1940
+ expandedRowRender={expandedRowRender}
1941
+ />
1942
+ );
1943
+
1944
+ const table = demo.find(BaseTable);
1945
+
1946
+ const expandIcons = demo.find(`.semi-table-tbody .semi-table-row .semi-table-expand-icon`);
1947
+ expandIcons.at(0).simulate('click');
1948
+ expandIcons.at(1).simulate('click');
1949
+ expect(expandedRowRender.calledTwice).toBeTruthy();
1950
+ });
1933
1951
  });
@@ -0,0 +1,95 @@
1
+ import React from 'react';
2
+ import { Table, Avatar } from '@douyinfe/semi-ui';
3
+ import { IconMore } from '@douyinfe/semi-icons';
4
+
5
+ const columns = [
6
+ {
7
+ title: '标题',
8
+ width: 500,
9
+ dataIndex: 'name',
10
+ render: (text, record, index) => {
11
+ return (
12
+ <span>
13
+ <Avatar size="small" shape="square" src={record.nameIconSrc} style={{ marginRight: 12 }}></Avatar>
14
+ {text}
15
+ </span>
16
+ );
17
+ },
18
+ },
19
+ {
20
+ title: '大小',
21
+ dataIndex: 'size',
22
+ },
23
+ {
24
+ title: '所有者',
25
+ dataIndex: 'owner',
26
+ render: (text, record, index) => {
27
+ return (
28
+ <div>
29
+ <Avatar size="small" color={record.avatarBg} style={{ marginRight: 4 }}>
30
+ {typeof text === 'string' && text.slice(0, 1)}
31
+ </Avatar>
32
+ {text}
33
+ </div>
34
+ );
35
+ },
36
+ },
37
+ {
38
+ title: '更新日期',
39
+ dataIndex: 'updateTime',
40
+ },
41
+ {
42
+ title: '',
43
+ dataIndex: 'operate',
44
+ render: () => {
45
+ return <IconMore />;
46
+ },
47
+ },
48
+ ];
49
+
50
+ const data = [
51
+ {
52
+ key: '1',
53
+ name: 'Semi Design 设计稿.fig',
54
+ nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/figma-icon.png',
55
+ size: '2M',
56
+ owner: '姜鹏志',
57
+ updateTime: '2020-02-02 05:13',
58
+ avatarBg: 'grey',
59
+ },
60
+ {
61
+ key: '2',
62
+ name: 'Semi Design 分享演示文稿',
63
+ nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
64
+ size: '2M',
65
+ owner: '郝宣',
66
+ updateTime: '2020-01-17 05:31',
67
+ avatarBg: 'red',
68
+ },
69
+ {
70
+ key: '3',
71
+ name: '设计文档',
72
+ nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
73
+ size: '34KB',
74
+ owner: 'Zoey Edwards',
75
+ updateTime: '2020-01-26 11:01',
76
+ avatarBg: 'light-blue',
77
+ },
78
+ ];
79
+
80
+ export default function App() {
81
+ const expandRowRender = (record, index) => {
82
+ console.log('render', index);
83
+ return <div>semi design</div>;
84
+ };
85
+
86
+ return (
87
+ <Table
88
+ rowKey="name"
89
+ columns={columns}
90
+ dataSource={data}
91
+ expandedRowRender={expandRowRender}
92
+ pagination={false}
93
+ />
94
+ );
95
+ }
@@ -2,4 +2,5 @@ export { default as DefaultFilteredValue } from './defaultFilteredValue';
2
2
  export { default as FixedColumnsChange } from './FixedColumnsChange';
3
3
  export { default as FixedZIndex } from './FixedZIndex';
4
4
  export { default as FixedHeaderMerge } from './FixedHeaderMerge';
5
- export { default as FixedResizable } from './FixedResizable';
5
+ export { default as FixedResizable } from './FixedResizable';
6
+ export { default as FixedExpandedRow } from './FixedExpandedRow';
package/tag/group.tsx CHANGED
@@ -14,12 +14,13 @@ export interface TagGroupProps {
14
14
  style?: React.CSSProperties;
15
15
  className?: string;
16
16
  maxTagCount?: number;
17
+ restCount?: number;
17
18
  tagList?: (TagProps | React.ReactNode)[];
18
19
  size?: 'small' | 'large';
19
20
  showPopover?: boolean;
20
21
  popoverProps?: PopoverProps;
21
22
  avatarShape?: AvatarShape;
22
- mode?: string; // TODO: This API is not in the check file
23
+ mode?: string;
23
24
  }
24
25
 
25
26
  export default class TagGroup extends PureComponent<TagGroupProps> {
@@ -35,6 +36,7 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
35
36
  style: PropTypes.object,
36
37
  className: PropTypes.string,
37
38
  maxTagCount: PropTypes.number,
39
+ restCount: PropTypes.number,
38
40
  tagList: PropTypes.array,
39
41
  size: PropTypes.oneOf(tagSize),
40
42
  mode: PropTypes.string,
@@ -77,8 +79,8 @@ export default class TagGroup extends PureComponent<TagGroupProps> {
77
79
  }
78
80
 
79
81
  renderMergeTags(tags: (Tag | React.ReactNode)[]) {
80
- const { maxTagCount, tagList } = this.props;
81
- const n = tagList.length - maxTagCount;
82
+ const { maxTagCount, tagList, restCount } = this.props;
83
+ const n = restCount ? restCount : tagList.length - maxTagCount;
82
84
  let renderTags: (Tag | React.ReactNode)[] = tags;
83
85
 
84
86
  const normalTags: (Tag | React.ReactNode)[] = tags.slice(0, maxTagCount);