@douyinfe/semi-ui 2.1.5 → 2.2.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/_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/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/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 +49 -25
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +839 -253
- 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/gulpfile.js +2 -1
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +12 -5
- 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/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 +5 -0
- package/lib/cjs/form/field.d.ts +5 -0
- package/lib/cjs/locale/source/es.d.ts +7 -0
- package/lib/cjs/locale/source/es.js +168 -0
- package/lib/cjs/pagination/index.js +9 -4
- package/lib/cjs/rating/item.js +1 -1
- package/lib/cjs/select/index.d.ts +9 -0
- package/lib/cjs/select/index.js +13 -9
- package/lib/cjs/tabs/index.js +3 -7
- package/lib/cjs/timeline/item.d.ts +3 -0
- package/lib/cjs/timeline/item.js +10 -4
- 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/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +12 -5
- 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/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 +5 -0
- package/lib/es/form/field.d.ts +5 -0
- package/lib/es/locale/source/es.d.ts +7 -0
- package/lib/es/locale/source/es.js +157 -0
- package/lib/es/pagination/index.js +8 -4
- package/lib/es/rating/item.js +1 -1
- package/lib/es/select/index.d.ts +9 -0
- package/lib/es/select/index.js +17 -9
- package/lib/es/tabs/index.js +1 -5
- package/lib/es/timeline/item.d.ts +3 -0
- package/lib/es/timeline/item.js +9 -4
- 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/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/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/rating/item.tsx +1 -1
- package/select/_story/select.stories.js +39 -14
- package/select/index.tsx +18 -7
- package/table/_story/DynamicFilters/index.js +13 -16
- package/tabs/index.tsx +1 -1
- package/timeline/_story/timeline.stories.js +70 -6
- package/timeline/item.tsx +7 -2
- package/tooltip/_story/tooltip.stories.js +1 -1
- 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
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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.
|
|
18
|
-
"@douyinfe/semi-foundation": "2.
|
|
19
|
-
"@douyinfe/semi-icons": "2.
|
|
20
|
-
"@douyinfe/semi-illustrations": "2.
|
|
21
|
-
"@douyinfe/semi-theme-default": "2.
|
|
17
|
+
"@douyinfe/semi-animation-react": "2.2.0",
|
|
18
|
+
"@douyinfe/semi-foundation": "2.2.0",
|
|
19
|
+
"@douyinfe/semi-icons": "2.2.0",
|
|
20
|
+
"@douyinfe/semi-illustrations": "2.2.0",
|
|
21
|
+
"@douyinfe/semi-theme-default": "2.2.0",
|
|
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": "f47324c727f9ca85ceb44649c4227b75876c4596",
|
|
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.
|
|
77
|
+
"@douyinfe/semi-scss-compile": "2.2.0",
|
|
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
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;
|
|
@@ -115,6 +122,7 @@ export type SelectProps = {
|
|
|
115
122
|
suffix?: React.ReactNode;
|
|
116
123
|
prefix?: React.ReactNode;
|
|
117
124
|
insetLabel?: React.ReactNode;
|
|
125
|
+
inputProps?: Subtract<InputProps, ExcludeInputType>;
|
|
118
126
|
showClear?: boolean;
|
|
119
127
|
showArrow?: boolean;
|
|
120
128
|
renderSelectedItem?: RenderSelectedItemFn;
|
|
@@ -200,6 +208,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
200
208
|
dropdownStyle: PropTypes.object,
|
|
201
209
|
outerTopSlot: PropTypes.node,
|
|
202
210
|
innerTopSlot: PropTypes.node,
|
|
211
|
+
inputProps: PropTypes.object,
|
|
203
212
|
outerBottomSlot: PropTypes.node,
|
|
204
213
|
innerBottomSlot: PropTypes.node, // Options slot
|
|
205
214
|
optionList: PropTypes.array,
|
|
@@ -558,18 +567,20 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
558
567
|
handleInputChange = (value: string) => this.foundation.handleInputChange(value);
|
|
559
568
|
|
|
560
569
|
renderInput() {
|
|
561
|
-
const { size, multiple, disabled } = this.props;
|
|
570
|
+
const { size, multiple, disabled, inputProps } = this.props;
|
|
571
|
+
const inputPropsCls = get(inputProps, 'className');
|
|
562
572
|
const inputcls = cls(`${prefixcls}-input`, {
|
|
563
573
|
[`${prefixcls}-input-single`]: !multiple,
|
|
564
574
|
[`${prefixcls}-input-multiple`]: multiple,
|
|
565
|
-
});
|
|
575
|
+
}, inputPropsCls);
|
|
566
576
|
const { inputValue } = this.state;
|
|
567
577
|
|
|
568
|
-
const
|
|
578
|
+
const selectInputProps: Record<string, any> = {
|
|
569
579
|
value: inputValue,
|
|
570
580
|
disabled,
|
|
571
581
|
className: inputcls,
|
|
572
582
|
onChange: this.handleInputChange,
|
|
583
|
+
...inputProps,
|
|
573
584
|
};
|
|
574
585
|
|
|
575
586
|
let style = {};
|
|
@@ -578,18 +589,18 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
578
589
|
style = {
|
|
579
590
|
width: inputValue ? `${inputValue.length * 16}px` : '2px',
|
|
580
591
|
};
|
|
581
|
-
|
|
592
|
+
selectInputProps.style = style;
|
|
582
593
|
}
|
|
583
594
|
return (
|
|
584
595
|
<Input
|
|
585
596
|
ref={this.inputRef as any}
|
|
586
597
|
size={size}
|
|
587
|
-
{...inputProps}
|
|
588
598
|
onFocus={(e: React.FocusEvent<HTMLInputElement>) => {
|
|
589
599
|
// prevent event bubbling which will fire trigger onFocus event
|
|
590
600
|
e.stopPropagation();
|
|
591
601
|
// e.nativeEvent.stopImmediatePropagation();
|
|
592
602
|
}}
|
|
603
|
+
{...selectInputProps}
|
|
593
604
|
/>
|
|
594
605
|
);
|
|
595
606
|
}
|
|
@@ -883,7 +894,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
|
|
|
883
894
|
</Tag>
|
|
884
895
|
);
|
|
885
896
|
} else {
|
|
886
|
-
return content
|
|
897
|
+
return <Fragment key={value}>{content}</Fragment>;
|
|
887
898
|
}
|
|
888
899
|
});
|
|
889
900
|
|
|
@@ -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,
|
package/tabs/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import TabPane from './TabPane';
|
|
|
15
15
|
import TabsContext from './tabs-context';
|
|
16
16
|
import { TabsProps, PlainTab, TabBarProps } from './interface';
|
|
17
17
|
|
|
18
|
-
const panePickKeys =
|
|
18
|
+
const panePickKeys = ['className', 'style', 'disabled', 'itemKey', 'tab', 'icon'];
|
|
19
19
|
|
|
20
20
|
export * from './interface';
|
|
21
21
|
|
|
@@ -81,8 +81,21 @@ export const Mode = () => (
|
|
|
81
81
|
}}
|
|
82
82
|
>
|
|
83
83
|
<Timeline mode="alternate">
|
|
84
|
-
<Timeline.Item time="2015-09-01">创建服务现场</Timeline.Item>
|
|
85
|
-
<Timeline.Item time="2015-09-01">初步排除网络异常</Timeline.Item>
|
|
84
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>创建服务现场</Timeline.Item>
|
|
85
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>初步排除网络异常</Timeline.Item>
|
|
86
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>技术测试异常</Timeline.Item>
|
|
87
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>网络异常正在修复</Timeline.Item>
|
|
88
|
+
</Timeline>
|
|
89
|
+
</div>
|
|
90
|
+
<br />
|
|
91
|
+
<div
|
|
92
|
+
style={{
|
|
93
|
+
width: '300px',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<Timeline mode="right">
|
|
97
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>创建服务现场</Timeline.Item>
|
|
98
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>初步排除网络异常</Timeline.Item>
|
|
86
99
|
<Timeline.Item time="2015-09-01">技术测试异常</Timeline.Item>
|
|
87
100
|
<Timeline.Item time="2015-09-01">网络异常正在修复</Timeline.Item>
|
|
88
101
|
</Timeline>
|
|
@@ -93,9 +106,9 @@ export const Mode = () => (
|
|
|
93
106
|
width: '300px',
|
|
94
107
|
}}
|
|
95
108
|
>
|
|
96
|
-
<Timeline mode="
|
|
97
|
-
<Timeline.Item time="2015-09-01">创建服务现场</Timeline.Item>
|
|
98
|
-
<Timeline.Item time="2015-09-01">初步排除网络异常</Timeline.Item>
|
|
109
|
+
<Timeline mode="left">
|
|
110
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>创建服务现场</Timeline.Item>
|
|
111
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>初步排除网络异常</Timeline.Item>
|
|
99
112
|
<Timeline.Item time="2015-09-01">技术测试异常</Timeline.Item>
|
|
100
113
|
<Timeline.Item time="2015-09-01">网络异常正在修复</Timeline.Item>
|
|
101
114
|
</Timeline>
|
|
@@ -108,7 +121,7 @@ export const Mode = () => (
|
|
|
108
121
|
>
|
|
109
122
|
<Timeline mode="center">
|
|
110
123
|
<Timeline.Item time="2015-09-01">创建服务现场</Timeline.Item>
|
|
111
|
-
<Timeline.Item time="2015-09-01">初步排除网络异常</Timeline.Item>
|
|
124
|
+
<Timeline.Item time="2015-09-01" dot={<IconAlertTriangle />}>初步排除网络异常</Timeline.Item>
|
|
112
125
|
<Timeline.Item time="2015-09-01">技术测试异常</Timeline.Item>
|
|
113
126
|
<Timeline.Item time="2015-09-01">网络异常正在修复</Timeline.Item>
|
|
114
127
|
</Timeline>
|
|
@@ -152,6 +165,7 @@ const data = [
|
|
|
152
165
|
time: '2019-05-09 09:12',
|
|
153
166
|
extra: '节点辅助说明信息',
|
|
154
167
|
content: '网络异常正在修复',
|
|
168
|
+
dot: <IconAlertTriangle />,
|
|
155
169
|
type: 'success',
|
|
156
170
|
},
|
|
157
171
|
];
|
|
@@ -169,3 +183,53 @@ export const DataSource = () => (
|
|
|
169
183
|
DataSource.story = {
|
|
170
184
|
name: 'dataSource',
|
|
171
185
|
};
|
|
186
|
+
|
|
187
|
+
const dataWithOnClick = [
|
|
188
|
+
{
|
|
189
|
+
time: '2019-07-14 10:35',
|
|
190
|
+
extra: '节点辅助说明信息',
|
|
191
|
+
content: '创建服务现场',
|
|
192
|
+
type: 'ongoing',
|
|
193
|
+
onClick: e => console.log(e, '创建服务现场'),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
time: '2019-06-13 16:17',
|
|
197
|
+
extra: '节点辅助说明信息',
|
|
198
|
+
content: <span style={{ fontSize: '18px' }}>初步排除网络异常</span>,
|
|
199
|
+
color: 'pink',
|
|
200
|
+
onClick: e => console.log(e, '初步排除网络异常'),
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
time: '2019-05-14 18:34',
|
|
204
|
+
extra: '节点辅助说明信息',
|
|
205
|
+
dot: <Icon type="alert_triangle" />,
|
|
206
|
+
content: '技术测试异常',
|
|
207
|
+
type: 'warning',
|
|
208
|
+
onClick: e => console.log(e, '技术测试异常'),
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
time: '2019-05-09 09:12',
|
|
212
|
+
extra: '节点辅助说明信息',
|
|
213
|
+
content: '网络异常正在修复',
|
|
214
|
+
type: 'success',
|
|
215
|
+
onClick: e => console.log(e, '网络异常正在修复'),
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
export const OnClickDemo = () => (
|
|
220
|
+
<div style={{ width: '400px' }}>
|
|
221
|
+
<div style={{ width: '300px' }}>
|
|
222
|
+
<Timeline mode='center'>
|
|
223
|
+
<Timeline.Item time='2015-09-01' onClick={e=>console.log(e, '创建服务现场')}>创建服务现场</Timeline.Item>
|
|
224
|
+
<Timeline.Item time='2015-09-01' onClick={e=>console.log(e, '初步排除网络异常')}>初步排除网络异常</Timeline.Item>
|
|
225
|
+
<Timeline.Item time='2015-09-01' onClick={e=>console.log(e, '技术测试异常')}>技术测试异常</Timeline.Item>
|
|
226
|
+
<Timeline.Item time='2015-09-01' onClick={e=>console.log(e, '网络异常正在修复')}>网络异常正在修复</Timeline.Item>
|
|
227
|
+
</Timeline>
|
|
228
|
+
<Timeline mode='alternate' dataSource={dataWithOnClick} />
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
OnClickDemo.story = {
|
|
234
|
+
name: 'onClick',
|
|
235
|
+
};
|