@douyinfe/semi-ui 2.1.4 → 2.2.0-beta.1
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/_base/_story/a11y.jsx +1302 -0
- package/_base/_story/a11y.scss +49 -0
- package/_base/_story/index.stories.js +3 -1
- package/_utils/index.ts +9 -4
- package/button/Button.tsx +1 -0
- package/cascader/__test__/cascader.test.js +221 -0
- package/cascader/_story/cascader.stories.js +138 -0
- package/cascader/index.tsx +37 -21
- package/cascader/item.tsx +4 -2
- package/checkbox/checkbox.tsx +2 -0
- package/checkbox/checkboxGroup.tsx +3 -2
- package/datePicker/__test__/datePicker.test.js +85 -2
- package/datePicker/_story/datePicker.stories.js +29 -1
- package/datePicker/_story/v2/YearButton.jsx +17 -0
- package/datePicker/_story/v2/index.js +1 -0
- package/datePicker/monthsGrid.tsx +12 -1
- package/datePicker/navigation.tsx +55 -29
- package/descriptions/__test__/descriptions.test.js +27 -1
- package/descriptions/_story/descriptions.stories.js +52 -2
- package/descriptions/item.tsx +1 -1
- package/dist/css/semi.css +56 -32
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +854 -258
- 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/empty/index.tsx +2 -2
- package/form/_story/form.stories.js +0 -67
- package/form/hoc/withField.tsx +1 -1
- package/gulpfile.js +2 -1
- package/lib/cjs/_base/base.css +2 -2
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +12 -5
- package/lib/cjs/button/Button.d.ts +1 -0
- package/lib/cjs/cascader/index.d.ts +7 -0
- package/lib/cjs/cascader/index.js +35 -22
- package/lib/cjs/cascader/item.d.ts +2 -0
- package/lib/cjs/cascader/item.js +4 -2
- package/lib/cjs/checkbox/checkbox.js +3 -1
- package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -0
- package/lib/cjs/checkbox/checkboxGroup.js +3 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +6 -0
- package/lib/cjs/datePicker/navigation.js +47 -7
- package/lib/cjs/descriptions/item.js +1 -1
- package/lib/cjs/empty/index.d.ts +2 -2
- package/lib/cjs/empty/index.js +19 -18
- package/lib/cjs/form/baseForm.d.ts +6 -0
- package/lib/cjs/form/field.d.ts +6 -0
- package/lib/cjs/form/hoc/withField.js +3 -1
- package/lib/cjs/locale/source/es.d.ts +7 -0
- package/lib/cjs/locale/source/es.js +168 -0
- package/lib/cjs/modal/Modal.d.ts +2 -2
- package/lib/cjs/modal/Modal.js +2 -2
- package/lib/cjs/modal/confirm.d.ts +10 -10
- package/lib/cjs/navigation/index.d.ts +2 -2
- package/lib/cjs/pagination/index.js +9 -4
- package/lib/cjs/rating/item.js +1 -1
- package/lib/cjs/select/index.d.ts +10 -0
- package/lib/cjs/select/index.js +15 -9
- package/lib/cjs/timeline/item.d.ts +5 -2
- package/lib/cjs/timeline/item.js +13 -7
- package/lib/cjs/tree/treeNode.js +0 -2
- package/lib/cjs/upload/fileCard.d.ts +2 -0
- package/lib/cjs/upload/fileCard.js +70 -45
- package/lib/cjs/upload/index.d.ts +23 -2
- package/lib/cjs/upload/index.js +133 -25
- package/lib/cjs/upload/interface.d.ts +3 -0
- package/lib/es/_base/base.css +2 -2
- package/lib/es/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +12 -5
- package/lib/es/button/Button.d.ts +1 -0
- package/lib/es/cascader/index.d.ts +7 -0
- package/lib/es/cascader/index.js +34 -25
- package/lib/es/cascader/item.d.ts +2 -0
- package/lib/es/cascader/item.js +4 -2
- package/lib/es/checkbox/checkbox.js +3 -1
- package/lib/es/checkbox/checkboxGroup.d.ts +1 -0
- package/lib/es/checkbox/checkboxGroup.js +3 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +6 -0
- package/lib/es/datePicker/navigation.js +48 -8
- package/lib/es/descriptions/item.js +1 -1
- package/lib/es/empty/index.d.ts +2 -2
- package/lib/es/empty/index.js +19 -18
- package/lib/es/form/baseForm.d.ts +6 -0
- package/lib/es/form/field.d.ts +6 -0
- package/lib/es/form/hoc/withField.js +3 -1
- package/lib/es/locale/source/es.d.ts +7 -0
- package/lib/es/locale/source/es.js +157 -0
- package/lib/es/modal/Modal.d.ts +2 -2
- package/lib/es/modal/Modal.js +2 -2
- package/lib/es/modal/confirm.d.ts +10 -10
- package/lib/es/navigation/index.d.ts +2 -2
- package/lib/es/pagination/index.js +8 -4
- package/lib/es/rating/item.js +1 -1
- package/lib/es/select/index.d.ts +10 -0
- package/lib/es/select/index.js +19 -9
- package/lib/es/timeline/item.d.ts +5 -2
- package/lib/es/timeline/item.js +12 -7
- package/lib/es/tree/treeNode.js +0 -2
- package/lib/es/upload/fileCard.d.ts +2 -0
- package/lib/es/upload/fileCard.js +69 -44
- package/lib/es/upload/index.d.ts +23 -2
- package/lib/es/upload/index.js +133 -24
- package/lib/es/upload/interface.d.ts +3 -0
- package/locale/source/es.ts +160 -0
- package/modal/Modal.tsx +4 -4
- package/navigation/__test__/navigation.test.js +4 -4
- package/navigation/_story/AutoOpen/index.js +1 -1
- package/navigation/_story/WithChildren/index.js +1 -1
- package/navigation/_story/navigation.stories.js +1 -1
- package/navigation/_story/navigation.stories.tsx +4 -4
- package/navigation/index.tsx +2 -2
- package/package.json +17 -9
- package/pagination/_story/pagination.stories.js +11 -0
- package/pagination/index.tsx +9 -4
- package/popover/Arrow.tsx +1 -1
- package/radio/_story/radio.stories.js +12 -1
- package/rating/item.tsx +1 -1
- package/select/_story/select.stories.js +39 -14
- package/select/index.tsx +21 -7
- package/table/_story/DynamicFilters/index.js +13 -16
- package/timeline/__test__/timeline.test.js +17 -1
- package/timeline/_story/timeline.stories.js +70 -6
- package/timeline/item.tsx +11 -6
- package/tooltip/_story/tooltip.stories.js +1 -1
- package/tree/_story/tree.stories.js +2 -2
- package/tree/treeNode.tsx +0 -2
- package/upload/__test__/upload.test.js +50 -1
- package/upload/fileCard.tsx +110 -95
- package/upload/index.tsx +147 -53
- package/upload/interface.ts +3 -0
package/modal/Modal.tsx
CHANGED
|
@@ -47,8 +47,8 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
47
47
|
closable: PropTypes.bool,
|
|
48
48
|
centered: PropTypes.bool,
|
|
49
49
|
visible: PropTypes.bool,
|
|
50
|
-
width: PropTypes.number,
|
|
51
|
-
height: PropTypes.number,
|
|
50
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
51
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
52
52
|
confirmLoading: PropTypes.bool,
|
|
53
53
|
cancelLoading: PropTypes.bool,
|
|
54
54
|
okText: PropTypes.string,
|
|
@@ -264,9 +264,9 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
264
264
|
if (!visible && !hidden) {
|
|
265
265
|
this.foundation.toggleHidden(true, () => this.foundation.afterClose());
|
|
266
266
|
} else if (visible && this.state.hidden) {
|
|
267
|
-
this.foundation.toggleHidden(false)
|
|
267
|
+
this.foundation.toggleHidden(false);
|
|
268
268
|
}
|
|
269
|
-
}
|
|
269
|
+
};
|
|
270
270
|
|
|
271
271
|
renderFooter = (): ReactNode => {
|
|
272
272
|
const {
|
|
@@ -36,7 +36,7 @@ describe(`Navigation`, () => {
|
|
|
36
36
|
onSelect={key => console.log(key)}
|
|
37
37
|
header={{
|
|
38
38
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwzthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
39
|
-
text: '
|
|
39
|
+
text: 'Semi 运营后台',
|
|
40
40
|
}}
|
|
41
41
|
footer={{
|
|
42
42
|
collapseButton: true,
|
|
@@ -71,7 +71,7 @@ describe(`Navigation`, () => {
|
|
|
71
71
|
onSelect={data => console.log('trigger onSelect: ', data)}
|
|
72
72
|
onClick={data => console.log('trigger onClick: ', data)}
|
|
73
73
|
>
|
|
74
|
-
<Nav.Header logo={'bytedance_logo'} text={'
|
|
74
|
+
<Nav.Header logo={'bytedance_logo'} text={'Semi 运营后台'} />
|
|
75
75
|
<Nav.Item itemKey={'union'} text={'公会中心'} icon={'star'} />
|
|
76
76
|
<Nav.Sub itemKey={'user'} text="用户管理" icon="user">
|
|
77
77
|
<Nav.Item itemKey={'golder'} text={'金主管理'} />
|
|
@@ -135,7 +135,7 @@ describe(`Navigation`, () => {
|
|
|
135
135
|
items={items}
|
|
136
136
|
header={{
|
|
137
137
|
logo: 'bytedance_logo',
|
|
138
|
-
text: '
|
|
138
|
+
text: 'Semi 运营后台',
|
|
139
139
|
}}
|
|
140
140
|
footer={{ collapseButton: true }}
|
|
141
141
|
/>
|
|
@@ -201,7 +201,7 @@ describe(`Navigation`, () => {
|
|
|
201
201
|
onClick={onClick}
|
|
202
202
|
header={{
|
|
203
203
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwzthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
204
|
-
text: '
|
|
204
|
+
text: 'Semi 运营后台',
|
|
205
205
|
}}
|
|
206
206
|
footer={{
|
|
207
207
|
collapseButton: true,
|
|
@@ -55,7 +55,7 @@ const Demo = (props = {}) => {
|
|
|
55
55
|
onSelect={key => console.log(key)}
|
|
56
56
|
header={{
|
|
57
57
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
58
|
-
text: '
|
|
58
|
+
text: 'Semi运营后台',
|
|
59
59
|
}}
|
|
60
60
|
footer={{
|
|
61
61
|
collapseButton: true,
|
|
@@ -106,7 +106,7 @@ const Demo = (props = {}) => {
|
|
|
106
106
|
onOpenChange={onOpenChange}
|
|
107
107
|
header={{
|
|
108
108
|
logo: <img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />,
|
|
109
|
-
text: '
|
|
109
|
+
text: 'Semi 运营后台',
|
|
110
110
|
}}
|
|
111
111
|
footer={{
|
|
112
112
|
collapseButton: true,
|
|
@@ -272,7 +272,7 @@ class HorizontalDemo extends React.Component {
|
|
|
272
272
|
logo: (
|
|
273
273
|
<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />
|
|
274
274
|
),
|
|
275
|
-
text: '
|
|
275
|
+
text: 'Semi 运营后台',
|
|
276
276
|
}}
|
|
277
277
|
footer={{
|
|
278
278
|
collapseButton: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
|
-
import { IconHome, IconHistogram, IconSetting, IconLive, IconUser, IconStar } from '@douyinfe/semi-icons';
|
|
3
|
+
import { IconHome, IconHistogram, IconSetting, IconLive, IconUser, IconStar, IconUserGroup } from '@douyinfe/semi-icons';
|
|
4
4
|
|
|
5
5
|
import Nav from '..';
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ stories.add(`default`, () => {
|
|
|
15
15
|
<Nav onSelect={(...args: any[]) => console.log(...args)}>
|
|
16
16
|
<Nav.Header logo={<img src={logo} />} text={'火山运营'} />
|
|
17
17
|
<Nav.Item itemKey={'1'} text={'Option 1'} icon="mail" link="/mail" />
|
|
18
|
-
<Nav.Sub text={'Group 2'} icon="folder"
|
|
18
|
+
<Nav.Sub text={'Group 2'} icon="folder" itemKey={'2'}>
|
|
19
19
|
{['2-1', '2-2'].map(k => (
|
|
20
20
|
<Nav.Item key={k} itemKey={String(k)} text={'Option ' + k} link={`folder/${k}`} />
|
|
21
21
|
))}
|
|
@@ -27,7 +27,7 @@ stories.add(`default`, () => {
|
|
|
27
27
|
</Nav.Sub>
|
|
28
28
|
<Nav.Item key={3} itemKey={'3'} text={'Option 3'} icon="gift" />
|
|
29
29
|
<Nav.Item key={4} itemKey={'4'} text={'Option 4'} icon="list" />
|
|
30
|
-
<Nav.Sub text={'Group 5'} icon="flag"
|
|
30
|
+
<Nav.Sub text={'Group 5'} icon="flag" itemKey={'5'}>
|
|
31
31
|
{['5-1', '5-2'].map(k => (
|
|
32
32
|
<Nav.Item key={k} itemKey={String(k)} text={'Option ' + k} />
|
|
33
33
|
))}
|
|
@@ -80,7 +80,7 @@ stories.add(`fix 35`, () => {
|
|
|
80
80
|
onSelect={data => console.log('trigger onSelect: ', data)}
|
|
81
81
|
onClick={data => console.log('trigger onClick: ', data)}
|
|
82
82
|
>
|
|
83
|
-
<Nav.Header logo={<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />} text={'
|
|
83
|
+
<Nav.Header logo={<img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/webcast_logo.svg" />} text={'Semi 运营后台'} />
|
|
84
84
|
<Nav.Item itemKey={'union'} text={'公会中心'} icon={<IconStar />} />
|
|
85
85
|
<Nav.Sub itemKey={'user'} text="用户管理" icon={<IconUser />}>
|
|
86
86
|
<Nav.Item itemKey={'golder'} text={'金主管理'} />
|
package/navigation/index.tsx
CHANGED
|
@@ -50,8 +50,8 @@ export interface NavProps extends BaseProps {
|
|
|
50
50
|
defaultIsCollapsed?: boolean;
|
|
51
51
|
defaultOpenKeys?: React.ReactText[];
|
|
52
52
|
defaultSelectedKeys?: React.ReactText[];
|
|
53
|
-
footer?: React.ReactNode |
|
|
54
|
-
header?: React.ReactNode |
|
|
53
|
+
footer?: React.ReactNode | NavFooterProps;
|
|
54
|
+
header?: React.ReactNode | NavHeaderProps;
|
|
55
55
|
isCollapsed?: boolean;
|
|
56
56
|
items?: NavItems;
|
|
57
57
|
limitIndent?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation-react": "2.1
|
|
18
|
-
"@douyinfe/semi-foundation": "2.1
|
|
19
|
-
"@douyinfe/semi-icons": "2.1
|
|
20
|
-
"@douyinfe/semi-illustrations": "2.1
|
|
21
|
-
"@douyinfe/semi-theme-default": "2.1
|
|
17
|
+
"@douyinfe/semi-animation-react": "2.2.0-beta.1",
|
|
18
|
+
"@douyinfe/semi-foundation": "2.2.0-beta.1",
|
|
19
|
+
"@douyinfe/semi-icons": "2.2.0-beta.1",
|
|
20
|
+
"@douyinfe/semi-illustrations": "2.2.0-beta.1",
|
|
21
|
+
"@douyinfe/semi-theme-default": "2.2.0-beta.1",
|
|
22
22
|
"@types/react-window": "^1.8.2",
|
|
23
23
|
"async-validator": "^3.5.0",
|
|
24
24
|
"classnames": "^2.2.6",
|
|
@@ -53,6 +53,14 @@
|
|
|
53
53
|
"pc component",
|
|
54
54
|
"dark mode"
|
|
55
55
|
],
|
|
56
|
+
"homepage": "https://semi.design",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/DouyinFE/semi-design/issues"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/DouyinFE"
|
|
63
|
+
},
|
|
56
64
|
"_unpkg": true,
|
|
57
65
|
"unpkgFiles": [
|
|
58
66
|
"dist/css",
|
|
@@ -60,13 +68,13 @@
|
|
|
60
68
|
],
|
|
61
69
|
"author": "",
|
|
62
70
|
"license": "MIT",
|
|
63
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "b380360d4f966a59369dc1ab895cb23bb9903751",
|
|
64
72
|
"devDependencies": {
|
|
65
73
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
66
74
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
67
75
|
"@babel/preset-env": "^7.15.8",
|
|
68
76
|
"@babel/preset-react": "^7.14.5",
|
|
69
|
-
"@douyinfe/semi-scss-compile": "2.1
|
|
77
|
+
"@douyinfe/semi-scss-compile": "2.2.0-beta.1",
|
|
70
78
|
"@storybook/addon-knobs": "^6.3.1",
|
|
71
79
|
"@types/lodash": "^4.14.176",
|
|
72
80
|
"babel-loader": "^8.2.2",
|
|
@@ -91,7 +99,7 @@
|
|
|
91
99
|
"react-storybook-addon-props-combinations": "^1.1.0",
|
|
92
100
|
"react-virtualized": "^9.22.3",
|
|
93
101
|
"rimraf": "^3.0.2",
|
|
94
|
-
"sass": "1.
|
|
102
|
+
"sass": "1.45.0",
|
|
95
103
|
"sinon": "^6.3.5",
|
|
96
104
|
"terser-webpack-plugin": "^4.2.3",
|
|
97
105
|
"through2": "^4.0.2",
|
|
@@ -146,3 +146,14 @@ export const PaginationDynamicUpdatePageSize = () => <DynamicPageSize />;
|
|
|
146
146
|
PaginationDynamicUpdatePageSize.story = {
|
|
147
147
|
name: 'Pagination dynamic update pageSize',
|
|
148
148
|
};
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
export const HideOnSingePageAndShowChanger = () => {
|
|
152
|
+
return (
|
|
153
|
+
<Pagination total={10} hideOnSinglePage showSizeChanger style={{ marginBottom: 12 }}></Pagination>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
HideOnSingePageAndShowChanger.story = {
|
|
158
|
+
name: 'hideOnSingelePage & showSizeChanger at same time',
|
|
159
|
+
};
|
package/pagination/index.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { cssClasses, numbers } from '@douyinfe/semi-foundation/pagination/consta
|
|
|
14
14
|
import '@douyinfe/semi-foundation/pagination/pagination.scss';
|
|
15
15
|
import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
|
|
16
16
|
import { IconChevronLeft, IconChevronRight } from '@douyinfe/semi-icons';
|
|
17
|
+
import warning from '@douyinfe/semi-foundation/utils/warning';
|
|
17
18
|
|
|
18
19
|
import ConfigContext from '../configProvider/context';
|
|
19
20
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
@@ -127,6 +128,10 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
127
128
|
this.foundation = new PaginationFoundation(this.adapter);
|
|
128
129
|
this.renderDefaultPage = this.renderDefaultPage.bind(this);
|
|
129
130
|
this.renderSmallPage = this.renderSmallPage.bind(this);
|
|
131
|
+
warning(
|
|
132
|
+
Boolean(props.showSizeChanger && props.hideOnSinglePage),
|
|
133
|
+
'[Semi Pagination] You should not use showSizeChanger and hideOnSinglePage in ths same time. At this time, hideOnSinglePage no longer takes effect, otherwise there may be a problem that the switch entry disappears'
|
|
134
|
+
);
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
get adapter(): PaginationAdapter<PaginationProps, PaginationState> {
|
|
@@ -377,11 +382,11 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
377
382
|
}
|
|
378
383
|
|
|
379
384
|
renderSmallPage(locale: PaginationLocale) {
|
|
380
|
-
const { className, style, hideOnSinglePage, hoverShowPageSelect } = this.props;
|
|
385
|
+
const { className, style, hideOnSinglePage, hoverShowPageSelect, showSizeChanger } = this.props;
|
|
381
386
|
const paginationCls = classNames(`${prefixCls}-small`, prefixCls, className);
|
|
382
387
|
const { currentPage, total, pageSize } = this.state;
|
|
383
388
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
384
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
389
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
385
390
|
return null;
|
|
386
391
|
}
|
|
387
392
|
|
|
@@ -410,11 +415,11 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
|
|
|
410
415
|
|
|
411
416
|
renderDefaultPage(locale: PaginationLocale) {
|
|
412
417
|
const { total, pageSize } = this.state;
|
|
413
|
-
const { showTotal, className, style, hideOnSinglePage } = this.props;
|
|
418
|
+
const { showTotal, className, style, hideOnSinglePage, showSizeChanger } = this.props;
|
|
414
419
|
const paginationCls = classNames(className, `${prefixCls}`);
|
|
415
420
|
const showTotalCls = `${prefixCls }-total`;
|
|
416
421
|
const totalPageNum = Math.ceil(total / pageSize);
|
|
417
|
-
if (totalPageNum < 2 && hideOnSinglePage) {
|
|
422
|
+
if (totalPageNum < 2 && hideOnSinglePage && !showSizeChanger) {
|
|
418
423
|
return null;
|
|
419
424
|
}
|
|
420
425
|
return (
|
package/popover/Arrow.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import Button from '../../button';
|
|
3
3
|
import Space from '../../space';
|
|
4
4
|
|
|
5
|
-
import { Radio, RadioGroup } from '../../index';
|
|
5
|
+
import { Radio, RadioGroup, Form, Tooltip } from '../../index';
|
|
6
6
|
import { Row, Col } from '../../grid';
|
|
7
7
|
import './radio.scss';
|
|
8
8
|
|
|
@@ -855,3 +855,14 @@ export const RadioGroupPureCardStyle = () => (
|
|
|
855
855
|
RadioGroupPureCardStyle.story = {
|
|
856
856
|
name: 'radioGroup pureCard style'
|
|
857
857
|
}
|
|
858
|
+
|
|
859
|
+
export const FixWithFieldLossRef = () => {
|
|
860
|
+
return (
|
|
861
|
+
<Form>
|
|
862
|
+
<Tooltip visible trigger="custom" content={'hi bytedance'}>
|
|
863
|
+
<Form.Radio>Semi</Form.Radio>
|
|
864
|
+
</Tooltip>
|
|
865
|
+
</Form>
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
FixWithFieldLossRef.storyName = '修复 Form Field 丢失 ref 问题 #384';
|
package/rating/item.tsx
CHANGED
|
@@ -88,7 +88,7 @@ export default class Item extends PureComponent<RatingItemProps> {
|
|
|
88
88
|
height: size,
|
|
89
89
|
fontSize: size
|
|
90
90
|
} : {};
|
|
91
|
-
const iconSize = size === 'small' ? 'default' : 'extra-large';
|
|
91
|
+
const iconSize = isCustomSize ? 'inherit' : (size === 'small' ? 'default' : 'extra-large');
|
|
92
92
|
const content = character ? character : <IconStar size={iconSize} />;
|
|
93
93
|
return (
|
|
94
94
|
<li className={starCls} style={{ ...sizeStyle }}>
|
|
@@ -1033,12 +1033,12 @@ class CustomRender extends React.Component {
|
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
-
renderCustomOption(item) {
|
|
1037
|
-
|
|
1036
|
+
renderCustomOption(item, index) {
|
|
1037
|
+
const optionStyle = {
|
|
1038
1038
|
display: 'flex',
|
|
1039
1039
|
};
|
|
1040
1040
|
return (
|
|
1041
|
-
<Option value={item.name} style={optionStyle} showTick={false} {...item}>
|
|
1041
|
+
<Option key={index} value={item.name} style={optionStyle} showTick={false} {...item}>
|
|
1042
1042
|
<Avatar color={item.color} size="small">
|
|
1043
1043
|
{item.abbr}
|
|
1044
1044
|
</Avatar>
|
|
@@ -1098,7 +1098,7 @@ class CustomRender extends React.Component {
|
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
1100
|
|
|
1101
|
-
renderMultipleWithoutTag(optionNode
|
|
1101
|
+
renderMultipleWithoutTag(optionNode) {
|
|
1102
1102
|
let content = (
|
|
1103
1103
|
<div>
|
|
1104
1104
|
<Avatar color={optionNode.color} size="small">
|
|
@@ -1125,7 +1125,7 @@ class CustomRender extends React.Component {
|
|
|
1125
1125
|
defaultValue={'夏可漫'}
|
|
1126
1126
|
renderSelectedItem={this.renderSelectedItem}
|
|
1127
1127
|
>
|
|
1128
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1128
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1129
1129
|
</Select>
|
|
1130
1130
|
<Select
|
|
1131
1131
|
style={{
|
|
@@ -1138,7 +1138,7 @@ class CustomRender extends React.Component {
|
|
|
1138
1138
|
multiple
|
|
1139
1139
|
renderSelectedItem={this.renderMultipleSelectedItem}
|
|
1140
1140
|
>
|
|
1141
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1141
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1142
1142
|
</Select>
|
|
1143
1143
|
<Select
|
|
1144
1144
|
style={{
|
|
@@ -1151,7 +1151,7 @@ class CustomRender extends React.Component {
|
|
|
1151
1151
|
multiple
|
|
1152
1152
|
renderSelectedItem={this.renderMultipleWithoutTag}
|
|
1153
1153
|
>
|
|
1154
|
-
{list.map(item => this.renderCustomOption(item))}
|
|
1154
|
+
{list.map((item, index) => this.renderCustomOption(item, index))}
|
|
1155
1155
|
</Select>
|
|
1156
1156
|
</React.Fragment>
|
|
1157
1157
|
);
|
|
@@ -2122,15 +2122,15 @@ class OptionGroupDemo extends React.Component {
|
|
|
2122
2122
|
});
|
|
2123
2123
|
}
|
|
2124
2124
|
|
|
2125
|
-
renderGroup(group) {
|
|
2126
|
-
|
|
2127
|
-
<Select.Option value={option.value} label={option.label} key={option.label}
|
|
2125
|
+
renderGroup(group, index) {
|
|
2126
|
+
const options = group.children.map(option => (
|
|
2127
|
+
<Select.Option value={option.value} label={option.label} key={option.label} />
|
|
2128
2128
|
));
|
|
2129
|
-
return <Select.OptGroup label={group.label}>{options}</Select.OptGroup>;
|
|
2129
|
+
return <Select.OptGroup key={`${index}-${group.label}`} label={group.label}>{options}</Select.OptGroup>;
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
render() {
|
|
2133
|
-
|
|
2133
|
+
const { groups } = this.state;
|
|
2134
2134
|
return (
|
|
2135
2135
|
<>
|
|
2136
2136
|
<Select
|
|
@@ -2142,14 +2142,14 @@ class OptionGroupDemo extends React.Component {
|
|
|
2142
2142
|
onSearch={this.handleSearch}
|
|
2143
2143
|
remote
|
|
2144
2144
|
>
|
|
2145
|
-
{groups.map(group => this.renderGroup(group))}
|
|
2145
|
+
{groups.map((group, index) => this.renderGroup(group, index))}
|
|
2146
2146
|
</Select>
|
|
2147
2147
|
</>
|
|
2148
2148
|
);
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
2151
|
|
|
2152
|
-
export const SelectOptionGroup = () => <OptionGroupDemo
|
|
2152
|
+
export const SelectOptionGroup = () => <OptionGroupDemo />;
|
|
2153
2153
|
|
|
2154
2154
|
SelectOptionGroup.story = {
|
|
2155
2155
|
name: 'Select OptionGroup',
|
|
@@ -2850,3 +2850,28 @@ export const ScrollIntoView = () => (
|
|
|
2850
2850
|
ScrollIntoView.story = {
|
|
2851
2851
|
name: 'scroll into view',
|
|
2852
2852
|
};
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
export const SelectInputPropsDemo = () => {
|
|
2856
|
+
|
|
2857
|
+
const inputProps = {
|
|
2858
|
+
className: 'ttt',
|
|
2859
|
+
onCompositionEnd: (v) => console.log(v.target.value)
|
|
2860
|
+
};
|
|
2861
|
+
|
|
2862
|
+
return (
|
|
2863
|
+
<Select
|
|
2864
|
+
// onSearch={(v) => console.log(v)}
|
|
2865
|
+
optionList={list}
|
|
2866
|
+
inputProps={inputProps}
|
|
2867
|
+
multiple
|
|
2868
|
+
filter
|
|
2869
|
+
style={{ width: 200 }}
|
|
2870
|
+
>
|
|
2871
|
+
</Select>
|
|
2872
|
+
)
|
|
2873
|
+
};
|
|
2874
|
+
SelectInputPropsDemo.story = {
|
|
2875
|
+
name: 'inputProps',
|
|
2876
|
+
};
|
|
2877
|
+
|
package/select/index.tsx
CHANGED
|
@@ -18,13 +18,14 @@ import { FixedSizeList as List } from 'react-window';
|
|
|
18
18
|
import { getOptionsFromGroup } from './utils';
|
|
19
19
|
import VirtualRow from './virtualRow';
|
|
20
20
|
|
|
21
|
-
import Input from '../input/index';
|
|
21
|
+
import Input, { InputProps } from '../input/index';
|
|
22
22
|
import Option, { OptionProps } from './option';
|
|
23
23
|
import OptionGroup from './optionGroup';
|
|
24
24
|
import Spin from '../spin';
|
|
25
25
|
import Trigger from '../trigger';
|
|
26
26
|
import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
27
27
|
import { isSemiIcon } from '../_utils';
|
|
28
|
+
import { Subtract } from 'utility-types';
|
|
28
29
|
|
|
29
30
|
import warning from '@douyinfe/semi-foundation/utils/warning';
|
|
30
31
|
|
|
@@ -40,6 +41,12 @@ const prefixcls = cssClasses.PREFIX;
|
|
|
40
41
|
|
|
41
42
|
const key = 0;
|
|
42
43
|
|
|
44
|
+
type ExcludeInputType = {
|
|
45
|
+
value?: InputProps['value'];
|
|
46
|
+
onFocus?: InputProps['onFocus'];
|
|
47
|
+
onChange?: InputProps['onChange'];
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
type OnChangeValueType = string | number | Record<string, any>;
|
|
44
51
|
export interface optionRenderProps {
|
|
45
52
|
key?: any;
|
|
@@ -78,6 +85,7 @@ export type RenderMultipleSelectedItemFn = (optionNode: Record<string, any>, mul
|
|
|
78
85
|
export type RenderSelectedItemFn = RenderSingleSelectedItemFn | RenderMultipleSelectedItemFn;
|
|
79
86
|
|
|
80
87
|
export type SelectProps = {
|
|
88
|
+
id?: string;
|
|
81
89
|
autoFocus?: boolean;
|
|
82
90
|
arrowIcon?: React.ReactNode;
|
|
83
91
|
defaultValue?: string | number | any[] | Record<string, any>;
|
|
@@ -114,6 +122,7 @@ export type SelectProps = {
|
|
|
114
122
|
suffix?: React.ReactNode;
|
|
115
123
|
prefix?: React.ReactNode;
|
|
116
124
|
insetLabel?: React.ReactNode;
|
|
125
|
+
inputProps?: Subtract<InputProps, ExcludeInputType>;
|
|
117
126
|
showClear?: boolean;
|
|
118
127
|
showArrow?: boolean;
|
|
119
128
|
renderSelectedItem?: RenderSelectedItemFn;
|
|
@@ -199,6 +208,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
199
208
|
dropdownStyle: PropTypes.object,
|
|
200
209
|
outerTopSlot: PropTypes.node,
|
|
201
210
|
innerTopSlot: PropTypes.node,
|
|
211
|
+
inputProps: PropTypes.object,
|
|
202
212
|
outerBottomSlot: PropTypes.node,
|
|
203
213
|
innerBottomSlot: PropTypes.node, // Options slot
|
|
204
214
|
optionList: PropTypes.array,
|
|
@@ -557,18 +567,20 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
557
567
|
handleInputChange = (value: string) => this.foundation.handleInputChange(value);
|
|
558
568
|
|
|
559
569
|
renderInput() {
|
|
560
|
-
const { size, multiple, disabled } = this.props;
|
|
570
|
+
const { size, multiple, disabled, inputProps } = this.props;
|
|
571
|
+
const inputPropsCls = get(inputProps, 'className');
|
|
561
572
|
const inputcls = cls(`${prefixcls}-input`, {
|
|
562
573
|
[`${prefixcls}-input-single`]: !multiple,
|
|
563
574
|
[`${prefixcls}-input-multiple`]: multiple,
|
|
564
|
-
});
|
|
575
|
+
}, inputPropsCls);
|
|
565
576
|
const { inputValue } = this.state;
|
|
566
577
|
|
|
567
|
-
const
|
|
578
|
+
const selectInputProps: Record<string, any> = {
|
|
568
579
|
value: inputValue,
|
|
569
580
|
disabled,
|
|
570
581
|
className: inputcls,
|
|
571
582
|
onChange: this.handleInputChange,
|
|
583
|
+
...inputProps,
|
|
572
584
|
};
|
|
573
585
|
|
|
574
586
|
let style = {};
|
|
@@ -577,18 +589,18 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
577
589
|
style = {
|
|
578
590
|
width: inputValue ? `${inputValue.length * 16}px` : '2px',
|
|
579
591
|
};
|
|
580
|
-
|
|
592
|
+
selectInputProps.style = style;
|
|
581
593
|
}
|
|
582
594
|
return (
|
|
583
595
|
<Input
|
|
584
596
|
ref={this.inputRef as any}
|
|
585
597
|
size={size}
|
|
586
|
-
{...inputProps}
|
|
587
598
|
onFocus={(e: React.FocusEvent<HTMLInputElement>) => {
|
|
588
599
|
// prevent event bubbling which will fire trigger onFocus event
|
|
589
600
|
e.stopPropagation();
|
|
590
601
|
// e.nativeEvent.stopImmediatePropagation();
|
|
591
602
|
}}
|
|
603
|
+
{...selectInputProps}
|
|
592
604
|
/>
|
|
593
605
|
);
|
|
594
606
|
}
|
|
@@ -882,7 +894,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
882
894
|
</Tag>
|
|
883
895
|
);
|
|
884
896
|
} else {
|
|
885
|
-
return content
|
|
897
|
+
return <Fragment key={value}>{content}</Fragment>;
|
|
886
898
|
}
|
|
887
899
|
});
|
|
888
900
|
|
|
@@ -981,6 +993,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
981
993
|
multiple,
|
|
982
994
|
filter,
|
|
983
995
|
style,
|
|
996
|
+
id,
|
|
984
997
|
size,
|
|
985
998
|
className,
|
|
986
999
|
validateStatus,
|
|
@@ -1063,6 +1076,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
1063
1076
|
ref={ref => ((this.triggerRef as any).current = ref)}
|
|
1064
1077
|
onClick={e => this.foundation.handleClick(e)}
|
|
1065
1078
|
style={style}
|
|
1079
|
+
id={id}
|
|
1066
1080
|
tabIndex={tabIndex}
|
|
1067
1081
|
onMouseEnter={this.onMouseEnter}
|
|
1068
1082
|
onMouseLeave={this.onMouseLeave}
|
|
@@ -6,22 +6,19 @@ class App extends React.Component {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
const labels = [
|
|
9
|
-
{ text: '
|
|
10
|
-
{ text: '
|
|
11
|
-
{ text: '
|
|
12
|
-
{ text: '
|
|
13
|
-
{ text: '
|
|
14
|
-
{ text: '
|
|
15
|
-
{ text: '
|
|
16
|
-
{ text: '
|
|
17
|
-
{ text: '
|
|
18
|
-
{ text: '
|
|
19
|
-
{ text: '
|
|
20
|
-
{ text: '
|
|
21
|
-
{ text: '
|
|
22
|
-
{ text: '123456789123', value: 24 },
|
|
23
|
-
{ text: '哈哈', value: 23 },
|
|
24
|
-
{ text: '匠子空间mcn签约', value: 7 },
|
|
9
|
+
{ text: '测试数据0', value: 4 },
|
|
10
|
+
{ text: '测试数据1', value: 18 },
|
|
11
|
+
{ text: '测试数据2', value: 3 },
|
|
12
|
+
{ text: '测试数据3', value: 1427 },
|
|
13
|
+
{ text: '测试数据4', value: 1 },
|
|
14
|
+
{ text: '测试数据5', value: 1406 },
|
|
15
|
+
{ text: '测试数据6', value: 1404 },
|
|
16
|
+
{ text: '测试数据7', value: 1401 },
|
|
17
|
+
{ text: '测试数据8', value: 1397 },
|
|
18
|
+
{ text: '测试数据9', value: 1396 },
|
|
19
|
+
{ text: '测试数据10', value: 2 },
|
|
20
|
+
{ text: '测试数据11', value: 24 },
|
|
21
|
+
{ text: '测试数据12', value: 23 },
|
|
25
22
|
];
|
|
26
23
|
this.state = {
|
|
27
24
|
data: datsJson,
|
|
@@ -234,4 +234,20 @@ describe('Timeline', () => {
|
|
|
234
234
|
timelineRight.unmount();
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
it('Timeline with time type ReactNode',()=>{
|
|
238
|
+
const timeline=mount(<Timeline>
|
|
239
|
+
<Timeline.Item time={<span>2019-07-14 10:35</span>}>第一个节点内容</Timeline.Item>
|
|
240
|
+
<Timeline.Item time="2019-06-13 16:17">第二个节点内容</Timeline.Item>
|
|
241
|
+
</Timeline>, {
|
|
242
|
+
attachTo: document.getElementById('container'),
|
|
243
|
+
});
|
|
244
|
+
const firstItem = timeline.find(`.${BASE_CLASS_PREFIX}-timeline-item .${BASE_CLASS_PREFIX}-timeline-item-content .${BASE_CLASS_PREFIX}-timeline-item-content-time`).at(0);
|
|
245
|
+
expect(
|
|
246
|
+
firstItem
|
|
247
|
+
.getDOMNode()
|
|
248
|
+
.innerHTML
|
|
249
|
+
).toEqual('<span>2019-07-14 10:35</span>');
|
|
250
|
+
timeline.unmount();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
});
|