@douyinfe/semi-ui 2.12.1-alpha.1 → 2.13.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/autoComplete/_story/autoComplete.stories.js +0 -1
- package/autoComplete/index.tsx +1 -1
- package/avatar/index.tsx +2 -2
- package/backtop/index.tsx +7 -11
- package/badge/index.tsx +1 -1
- package/banner/index.tsx +5 -5
- package/breadcrumb/index.tsx +3 -5
- package/button/Button.tsx +8 -10
- package/card/index.tsx +41 -43
- package/carousel/CarouselArrow.tsx +0 -2
- package/carousel/index.tsx +0 -1
- package/cascader/index.tsx +126 -102
- package/cascader/item.tsx +1 -1
- package/checkbox/checkbox.tsx +28 -20
- package/checkbox/checkboxInner.tsx +11 -1
- package/collapsible/index.tsx +1 -8
- package/datePicker/dateInput.tsx +0 -1
- package/datePicker/datePicker.tsx +5 -13
- package/dist/css/semi.css +31 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +5321 -3696
- 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/divider/index.tsx +4 -8
- package/dropdown/index.tsx +1 -1
- package/empty/index.tsx +5 -13
- package/form/hoc/withField.tsx +1 -1
- package/form/label.tsx +1 -1
- package/grid/col.tsx +1 -1
- package/grid/row.tsx +1 -1
- package/gulpfile.js +5 -5
- package/iconButton/index.tsx +1 -2
- package/input/index.tsx +11 -38
- package/inputNumber/__test__/inputNumber.test.js +2 -3
- package/inputNumber/_story/inputNumber.stories.js +53 -0
- package/inputNumber/index.tsx +0 -4
- package/lib/cjs/_base/base.css +22 -0
- package/lib/cjs/autoComplete/index.js +1 -1
- package/lib/cjs/avatar/index.js +2 -4
- package/lib/cjs/backtop/index.js +1 -2
- package/lib/cjs/badge/index.js +1 -2
- package/lib/cjs/banner/index.js +4 -9
- package/lib/cjs/breadcrumb/index.js +3 -4
- package/lib/cjs/button/Button.js +3 -13
- package/lib/cjs/card/index.js +5 -10
- package/lib/cjs/carousel/CarouselArrow.js +2 -6
- package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/carousel/index.js +1 -2
- package/lib/cjs/cascader/index.js +10 -11
- package/lib/cjs/cascader/item.js +1 -2
- package/lib/cjs/checkbox/checkbox.d.ts +3 -2
- package/lib/cjs/checkbox/checkbox.js +33 -15
- package/lib/cjs/checkbox/checkboxInner.d.ts +6 -0
- package/lib/cjs/checkbox/checkboxInner.js +14 -4
- package/lib/cjs/collapsible/index.js +1 -2
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.js +1 -2
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.js +2 -4
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/divider/index.js +1 -2
- package/lib/cjs/dropdown/index.js +1 -2
- package/lib/cjs/empty/index.js +4 -8
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +1 -2
- package/lib/cjs/form/label.js +1 -2
- package/lib/cjs/grid/col.js +1 -2
- package/lib/cjs/grid/row.js +1 -2
- package/lib/cjs/iconButton/index.js +1 -3
- package/lib/cjs/input/index.js +5 -9
- package/lib/cjs/inputNumber/index.js +0 -4
- package/lib/cjs/list/index.js +3 -6
- package/lib/cjs/modal/ConfirmModal.js +1 -2
- package/lib/cjs/modal/Modal.js +2 -6
- package/lib/cjs/modal/ModalContent.js +6 -13
- package/lib/cjs/notification/notice.js +3 -6
- package/lib/cjs/pagination/index.js +2 -4
- package/lib/cjs/popconfirm/index.js +3 -6
- package/lib/cjs/popover/index.d.ts +1 -0
- package/lib/cjs/radio/radio.d.ts +1 -1
- package/lib/cjs/radio/radio.js +2 -4
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/rating/item.js +1 -2
- package/lib/cjs/scrollList/index.js +3 -6
- package/lib/cjs/select/index.js +4 -8
- package/lib/cjs/select/option.js +1 -2
- package/lib/cjs/sideSheet/SideSheetContent.js +3 -6
- package/lib/cjs/skeleton/index.js +1 -3
- package/lib/cjs/space/index.js +1 -2
- package/lib/cjs/spin/index.js +3 -7
- package/lib/cjs/switch/index.js +4 -6
- package/lib/cjs/table/Table.js +3 -6
- package/lib/cjs/tabs/TabBar.js +1 -2
- package/lib/cjs/tabs/TabPane.js +2 -5
- package/lib/cjs/tagInput/index.d.ts +6 -1
- package/lib/cjs/tagInput/index.js +50 -17
- package/lib/cjs/timePicker/Combobox.js +1 -3
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
- package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +2 -2
- package/lib/cjs/toast/toast.js +3 -6
- package/lib/cjs/transfer/index.js +1 -2
- package/lib/cjs/tree/treeNode.js +1 -2
- package/lib/cjs/treeSelect/index.js +3 -6
- package/lib/cjs/typography/base.js +1 -2
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +2 -2
- package/lib/cjs/upload/index.js +6 -13
- package/lib/es/_base/base.css +22 -0
- package/lib/es/autoComplete/index.js +1 -1
- package/lib/es/avatar/index.js +2 -4
- package/lib/es/backtop/index.js +1 -2
- package/lib/es/badge/index.js +1 -2
- package/lib/es/banner/index.js +4 -9
- package/lib/es/breadcrumb/index.js +3 -4
- package/lib/es/button/Button.js +3 -11
- package/lib/es/card/index.js +5 -10
- package/lib/es/carousel/CarouselArrow.js +2 -6
- package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/carousel/index.js +1 -2
- package/lib/es/cascader/index.js +10 -11
- package/lib/es/cascader/item.js +1 -2
- package/lib/es/checkbox/checkbox.d.ts +3 -2
- package/lib/es/checkbox/checkbox.js +33 -15
- package/lib/es/checkbox/checkboxInner.d.ts +6 -0
- package/lib/es/checkbox/checkboxInner.js +14 -4
- package/lib/es/collapsible/index.js +1 -2
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/dateInput.js +1 -2
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/datePicker.js +2 -4
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/divider/index.js +1 -2
- package/lib/es/dropdown/index.js +1 -2
- package/lib/es/empty/index.js +4 -8
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +1 -2
- package/lib/es/form/label.js +1 -2
- package/lib/es/grid/col.js +1 -2
- package/lib/es/grid/row.js +1 -2
- package/lib/es/iconButton/index.js +1 -3
- package/lib/es/input/index.js +5 -9
- package/lib/es/inputNumber/index.js +0 -4
- package/lib/es/list/index.js +3 -6
- package/lib/es/modal/ConfirmModal.js +1 -2
- package/lib/es/modal/Modal.js +2 -6
- package/lib/es/modal/ModalContent.js +6 -13
- package/lib/es/notification/notice.js +3 -6
- package/lib/es/pagination/index.js +2 -4
- package/lib/es/popconfirm/index.js +3 -6
- package/lib/es/popover/index.d.ts +1 -0
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/radio/radio.js +2 -4
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/rating/item.js +1 -2
- package/lib/es/scrollList/index.js +3 -6
- package/lib/es/select/index.js +4 -8
- package/lib/es/select/option.js +1 -2
- package/lib/es/sideSheet/SideSheetContent.js +3 -6
- package/lib/es/skeleton/index.js +1 -3
- package/lib/es/space/index.js +1 -2
- package/lib/es/spin/index.js +3 -7
- package/lib/es/switch/index.js +4 -6
- package/lib/es/table/Table.js +3 -6
- package/lib/es/tabs/TabBar.js +1 -2
- package/lib/es/tabs/TabPane.js +2 -5
- package/lib/es/tagInput/index.d.ts +6 -1
- package/lib/es/tagInput/index.js +47 -17
- package/lib/es/timePicker/Combobox.js +1 -3
- package/lib/es/timePicker/TimePicker.d.ts +2 -2
- package/lib/es/timePicker/TimeShape.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +2 -2
- package/lib/es/toast/toast.js +3 -6
- package/lib/es/transfer/index.js +1 -2
- package/lib/es/tree/treeNode.js +1 -2
- package/lib/es/treeSelect/index.js +3 -6
- package/lib/es/typography/base.js +1 -2
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +2 -2
- package/lib/es/upload/index.js +6 -13
- package/list/index.tsx +4 -16
- package/modal/ConfirmModal.tsx +1 -1
- package/modal/Modal.tsx +0 -2
- package/modal/ModalContent.tsx +14 -27
- package/notification/notice.tsx +4 -16
- package/package.json +9 -9
- package/pagination/index.tsx +2 -16
- package/popconfirm/index.tsx +3 -11
- package/popover/index.tsx +1 -1
- package/radio/radio.tsx +2 -10
- package/rating/item.tsx +1 -1
- package/scrollList/index.tsx +3 -19
- package/select/_story/select.stories.js +11 -0
- package/select/index.tsx +4 -12
- package/select/option.tsx +1 -5
- package/sideSheet/SideSheetContent.tsx +3 -3
- package/skeleton/index.tsx +1 -1
- package/space/index.tsx +1 -1
- package/spin/index.tsx +9 -15
- package/switch/index.tsx +14 -9
- package/table/Table.tsx +3 -5
- package/table/_story/v2/FixedOnHeaderRow/index.jsx +3 -0
- package/tabs/TabBar.tsx +1 -1
- package/tabs/TabPane.tsx +4 -9
- package/tabs/_story/tabs.stories.js +36 -0
- package/tag/_story/tag.stories.js +1 -1
- package/tagInput/index.tsx +47 -22
- package/timePicker/Combobox.tsx +1 -6
- package/toast/toast.tsx +3 -3
- package/transfer/index.tsx +0 -1
- package/tree/treeNode.tsx +1 -1
- package/treeSelect/index.tsx +3 -15
- package/typography/base.tsx +1 -1
- package/upload/_story/upload.stories.js +152 -0
- package/upload/index.tsx +38 -107
- package/yarn-error.log +0 -26235
package/switch/index.tsx
CHANGED
|
@@ -146,18 +146,23 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
146
146
|
const showUncheckedText = uncheckedText && !nativeControlChecked && size !== 'small';
|
|
147
147
|
return (
|
|
148
148
|
<div className={wrapperCls} style={style} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
{
|
|
150
|
+
loading
|
|
151
|
+
? (
|
|
152
|
+
<Spin
|
|
153
|
+
wrapperClassName={cssClasses.LOADING_SPIN}
|
|
154
|
+
size={size === 'default' ? 'middle' : size}
|
|
155
|
+
/>
|
|
156
|
+
)
|
|
157
|
+
: <div className={cssClasses.KNOB} aria-hidden={true} />
|
|
158
|
+
}
|
|
154
159
|
{showCheckedText ? (
|
|
155
|
-
<div className={cssClasses.CHECKED_TEXT}
|
|
160
|
+
<div className={cssClasses.CHECKED_TEXT}>
|
|
156
161
|
{checkedText}
|
|
157
162
|
</div>
|
|
158
163
|
) : null}
|
|
159
164
|
{showUncheckedText ? (
|
|
160
|
-
<div className={cssClasses.UNCHECKED_TEXT}
|
|
165
|
+
<div className={cssClasses.UNCHECKED_TEXT}>
|
|
161
166
|
{uncheckedText}
|
|
162
167
|
</div>
|
|
163
168
|
) : null}
|
|
@@ -165,13 +170,13 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
165
170
|
{...switchProps}
|
|
166
171
|
ref={this.switchRef}
|
|
167
172
|
id={id}
|
|
168
|
-
role=
|
|
173
|
+
role='switch'
|
|
169
174
|
aria-checked={nativeControlChecked}
|
|
170
175
|
aria-invalid={this.props['aria-invalid']}
|
|
171
176
|
aria-errormessage={this.props['aria-errormessage']}
|
|
172
177
|
aria-label={this.props['aria-label']}
|
|
173
178
|
aria-labelledby={this.props['aria-labelledby']}
|
|
174
|
-
aria-describedby={this.props[
|
|
179
|
+
aria-describedby={this.props["aria-describedby"]}
|
|
175
180
|
aria-disabled={this.props['disabled']}
|
|
176
181
|
onChange={e => this.foundation.handleChange(e.target.checked, e)}
|
|
177
182
|
onFocus={e => this.handleFocusVisible(e)}
|
package/table/Table.tsx
CHANGED
|
@@ -1015,7 +1015,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1015
1015
|
}
|
|
1016
1016
|
|
|
1017
1017
|
return isValidElement(title) || typeof title === 'string' ? (
|
|
1018
|
-
<div className={`${prefixCls}-title`}
|
|
1018
|
+
<div className={`${prefixCls}-title`}>{title}</div>
|
|
1019
1019
|
) : null;
|
|
1020
1020
|
};
|
|
1021
1021
|
|
|
@@ -1032,9 +1032,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1032
1032
|
<LocaleConsumer componentName="Table" key={'emptyText'}>
|
|
1033
1033
|
{(locale: TableLocale, localeCode: string) => (
|
|
1034
1034
|
<div className={wrapCls}>
|
|
1035
|
-
<div className={`${prefixCls}-empty`}
|
|
1036
|
-
{empty || locale.emptyText}
|
|
1037
|
-
</div>
|
|
1035
|
+
<div className={`${prefixCls}-empty`}>{empty || locale.emptyText}</div>
|
|
1038
1036
|
</div>
|
|
1039
1037
|
)}
|
|
1040
1038
|
</LocaleConsumer>
|
|
@@ -1050,7 +1048,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
|
|
|
1050
1048
|
}
|
|
1051
1049
|
|
|
1052
1050
|
return isValidElement(footer) || typeof footer === 'string' ? (
|
|
1053
|
-
<div className={`${prefixCls}-footer`} key="footer"
|
|
1051
|
+
<div className={`${prefixCls}-footer`} key="footer">
|
|
1054
1052
|
{footer}
|
|
1055
1053
|
</div>
|
|
1056
1054
|
) : null;
|
package/tabs/TabBar.tsx
CHANGED
|
@@ -70,7 +70,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
|
|
|
70
70
|
if (tabBarExtraContent) {
|
|
71
71
|
const tabBarStyle = { ...tabBarExtraContentDefaultStyle, ...tabBarExtraContentStyle };
|
|
72
72
|
return (
|
|
73
|
-
<div className={extraCls} style={tabBarStyle}
|
|
73
|
+
<div className={extraCls} style={tabBarStyle}>
|
|
74
74
|
{tabBarExtraContent}
|
|
75
75
|
</div>
|
|
76
76
|
);
|
package/tabs/TabPane.tsx
CHANGED
|
@@ -98,7 +98,6 @@ class TabPane extends PureComponent<TabPaneProps> {
|
|
|
98
98
|
aria-hidden={active ? 'false' : 'true'}
|
|
99
99
|
tabIndex={0}
|
|
100
100
|
{...getDataAttr(restProps)}
|
|
101
|
-
x-semi-prop="children"
|
|
102
101
|
>
|
|
103
102
|
{motion ? (
|
|
104
103
|
<TabPaneTransition
|
|
@@ -108,18 +107,14 @@ class TabPane extends PureComponent<TabPaneProps> {
|
|
|
108
107
|
state={active ? 'enter' : 'leave'}
|
|
109
108
|
>
|
|
110
109
|
{(transitionStyle): ReactNode => (
|
|
111
|
-
<div
|
|
112
|
-
className={`${cssClasses.TABS_PANE_MOTION_OVERLAY}`}
|
|
113
|
-
style={{ ...transitionStyle }}
|
|
114
|
-
x-semi-prop="children"
|
|
115
|
-
>
|
|
110
|
+
<div className={`${cssClasses.TABS_PANE_MOTION_OVERLAY}`} style={{ ...transitionStyle }}>
|
|
116
111
|
{shouldRender ? children : null}
|
|
117
112
|
</div>
|
|
118
113
|
)}
|
|
119
114
|
</TabPaneTransition>
|
|
120
|
-
) :
|
|
121
|
-
children
|
|
122
|
-
)
|
|
115
|
+
) : (
|
|
116
|
+
shouldRender ? children : null
|
|
117
|
+
)}
|
|
123
118
|
</div>
|
|
124
119
|
);
|
|
125
120
|
}
|
|
@@ -867,3 +867,39 @@ export const TabListChange = () => <TabListChangeDemo />;
|
|
|
867
867
|
TabListChange.story = {
|
|
868
868
|
name: 'tablist change',
|
|
869
869
|
};
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
class TabClosableDemo extends React.Component {
|
|
873
|
+
constructor(props){
|
|
874
|
+
super(props);
|
|
875
|
+
this.state = {
|
|
876
|
+
tabList: [
|
|
877
|
+
{tab: '文档', itemKey:'1', text:'文档', closable:true},
|
|
878
|
+
{tab: '快速起步', itemKey:'2', text:'快速起步', closable:true},
|
|
879
|
+
{tab: '帮助', itemKey:'3', text:'帮助'},
|
|
880
|
+
]
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
close(key){
|
|
884
|
+
const newTabList = [...this.state.tabList];
|
|
885
|
+
const closeIndex = newTabList.findIndex(t=>t.itemKey===key);
|
|
886
|
+
newTabList.splice(closeIndex, 1);
|
|
887
|
+
this.setState({tabList:newTabList});
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
render() {
|
|
891
|
+
return (
|
|
892
|
+
<Tabs type="card" defaultActiveKey="1" onTabClose={this.close.bind(this)}>
|
|
893
|
+
{
|
|
894
|
+
this.state.tabList.map(t=><TabPane closable={t.closable} tab={t.tab} itemKey={t.itemKey} key={t.itemKey}>{t.text}</TabPane>)
|
|
895
|
+
}
|
|
896
|
+
</Tabs>
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
export const TabClosable = () => <TabClosableDemo />;
|
|
902
|
+
|
|
903
|
+
TabClosable.story = {
|
|
904
|
+
name: 'tab closable',
|
|
905
|
+
};
|
|
@@ -155,7 +155,7 @@ export const TagAvatar = () => {
|
|
|
155
155
|
'https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/avatarDemo.jpeg';
|
|
156
156
|
return (
|
|
157
157
|
<div style={{ margin: 10 }}>
|
|
158
|
-
<Tag avatarSrc={avatarSrc} avatarShape={'square'}>
|
|
158
|
+
<Tag avatarSrc={avatarSrc} avatarShape={'square'} onClick={()=>{console.log('如果能重来,我要做李白')}}>
|
|
159
159
|
李白
|
|
160
160
|
</Tag>
|
|
161
161
|
<br />
|
package/tagInput/index.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { cssClasses, strings } from '@douyinfe/semi-foundation/tagInput/constant
|
|
|
13
13
|
import '@douyinfe/semi-foundation/tagInput/tagInput.scss';
|
|
14
14
|
import TagInputFoundation, { TagInputAdapter } from '@douyinfe/semi-foundation/tagInput/foundation';
|
|
15
15
|
import { ArrayElement } from '../_base/base';
|
|
16
|
+
import { isSemiIcon } from '../_utils';
|
|
16
17
|
import BaseComponent from '../_base/baseComponent';
|
|
17
18
|
import Tag from '../tag';
|
|
18
19
|
import Input from '../input';
|
|
@@ -47,6 +48,8 @@ export interface TagInputProps {
|
|
|
47
48
|
onKeyDown?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
48
49
|
onRemove?: (removedValue: string, idx: number) => void;
|
|
49
50
|
placeholder?: string;
|
|
51
|
+
insetLabel?: React.ReactNode;
|
|
52
|
+
insetLabelId?: string;
|
|
50
53
|
prefix?: React.ReactNode;
|
|
51
54
|
renderTagItem?: (value: string, index: number) => React.ReactNode;
|
|
52
55
|
separator?: string | string[] | null;
|
|
@@ -129,6 +132,8 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
129
132
|
};
|
|
130
133
|
|
|
131
134
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
135
|
+
foundation: TagInputFoundation;
|
|
136
|
+
|
|
132
137
|
constructor(props: TagInputProps) {
|
|
133
138
|
super(props);
|
|
134
139
|
this.foundation = new TagInputFoundation(this.adapter);
|
|
@@ -170,6 +175,15 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
170
175
|
setFocusing: (focusing: boolean) => {
|
|
171
176
|
this.setState({ focusing });
|
|
172
177
|
},
|
|
178
|
+
toggleFocusing: (isFocus: boolean) => {
|
|
179
|
+
const input = this.inputRef && this.inputRef.current;
|
|
180
|
+
if (isFocus) {
|
|
181
|
+
input && input.focus();
|
|
182
|
+
} else {
|
|
183
|
+
input && input.blur();
|
|
184
|
+
}
|
|
185
|
+
this.setState({ focusing: isFocus });
|
|
186
|
+
},
|
|
173
187
|
setHovering: (hovering: boolean) => {
|
|
174
188
|
this.setState({ hovering });
|
|
175
189
|
},
|
|
@@ -240,6 +254,15 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
240
254
|
this.foundation.handleInputMouseEnter();
|
|
241
255
|
};
|
|
242
256
|
|
|
257
|
+
handleClickPrefixOrSuffix = (e: React.MouseEvent<HTMLInputElement>) => {
|
|
258
|
+
this.foundation.handleClickPrefixOrSuffix(e);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
handlePreventMouseDown = (e: React.MouseEvent<HTMLInputElement>) => {
|
|
262
|
+
this.foundation.handlePreventMouseDown(e);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
|
|
243
266
|
renderClearBtn() {
|
|
244
267
|
const { hovering, tagsArray, inputValue } = this.state;
|
|
245
268
|
const { showClear, disabled } = this.props;
|
|
@@ -248,11 +271,11 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
248
271
|
});
|
|
249
272
|
if (showClear) {
|
|
250
273
|
return (
|
|
251
|
-
<div
|
|
274
|
+
<div
|
|
252
275
|
role="button"
|
|
253
|
-
tabIndex={0}
|
|
254
|
-
aria-label="Clear TagInput value"
|
|
255
|
-
className={clearCls}
|
|
276
|
+
tabIndex={0}
|
|
277
|
+
aria-label="Clear TagInput value"
|
|
278
|
+
className={clearCls}
|
|
256
279
|
onClick={e => this.handleClearBtn(e)}
|
|
257
280
|
onKeyPress={e => this.handleClearEnterPress(e)}
|
|
258
281
|
>
|
|
@@ -264,16 +287,19 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
264
287
|
}
|
|
265
288
|
|
|
266
289
|
renderPrefix() {
|
|
267
|
-
const { prefix } = this.props;
|
|
268
|
-
|
|
290
|
+
const { prefix, insetLabel, insetLabelId } = this.props;
|
|
291
|
+
const labelNode = prefix || insetLabel;
|
|
292
|
+
if (isNull(labelNode) || isUndefined(labelNode)) {
|
|
269
293
|
return null;
|
|
270
294
|
}
|
|
271
295
|
const prefixWrapperCls = cls(`${prefixCls}-prefix`, {
|
|
272
|
-
[`${prefixCls}-
|
|
296
|
+
[`${prefixCls}-inset-label`]: insetLabel,
|
|
297
|
+
[`${prefixCls}-prefix-text`]: labelNode && isString(labelNode),
|
|
273
298
|
// eslint-disable-next-line max-len
|
|
274
|
-
[`${prefixCls}-prefix-icon`]:
|
|
299
|
+
[`${prefixCls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
275
300
|
});
|
|
276
|
-
|
|
301
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
|
|
302
|
+
return <div className={prefixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix} id={insetLabelId}>{labelNode}</div>;
|
|
277
303
|
}
|
|
278
304
|
|
|
279
305
|
renderSuffix() {
|
|
@@ -284,9 +310,10 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
284
310
|
const suffixWrapperCls = cls(`${prefixCls}-suffix`, {
|
|
285
311
|
[`${prefixCls}-suffix-text`]: suffix && isString(suffix),
|
|
286
312
|
// eslint-disable-next-line max-len
|
|
287
|
-
[`${prefixCls}-suffix-icon`]:
|
|
313
|
+
[`${prefixCls}-suffix-icon`]: isSemiIcon(suffix),
|
|
288
314
|
});
|
|
289
|
-
|
|
315
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
316
|
+
return <div className={suffixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix}>{suffix}</div>;
|
|
290
317
|
}
|
|
291
318
|
|
|
292
319
|
renderTags() {
|
|
@@ -306,7 +333,7 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
306
333
|
const typoCls = cls(`${prefixCls}-wrapper-typo`, {
|
|
307
334
|
[`${prefixCls}-wrapper-typo-disabled`]: disabled
|
|
308
335
|
});
|
|
309
|
-
const
|
|
336
|
+
const restTagsCls = cls(`${prefixCls}-wrapper-n`, {
|
|
310
337
|
[`${prefixCls}-wrapper-n-disabled`]: disabled
|
|
311
338
|
});
|
|
312
339
|
const restTags: Array<React.ReactNode> = [];
|
|
@@ -345,13 +372,18 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
345
372
|
tags.push(item);
|
|
346
373
|
}
|
|
347
374
|
});
|
|
375
|
+
|
|
376
|
+
const restTagsContent = (
|
|
377
|
+
<span className={restTagsCls}>+{tagsArray.length - maxTagCount}</span>
|
|
378
|
+
);
|
|
379
|
+
|
|
348
380
|
return (
|
|
349
381
|
<>
|
|
350
382
|
{tags}
|
|
351
383
|
{
|
|
352
384
|
restTags.length > 0 &&
|
|
353
385
|
(
|
|
354
|
-
showRestTagsPopover
|
|
386
|
+
showRestTagsPopover ?
|
|
355
387
|
(
|
|
356
388
|
<Popover
|
|
357
389
|
content={restTags}
|
|
@@ -361,16 +393,9 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
|
|
|
361
393
|
autoAdjustOverflow
|
|
362
394
|
{...restTagsPopoverProps}
|
|
363
395
|
>
|
|
364
|
-
|
|
365
|
-
+{tagsArray.length - maxTagCount}
|
|
366
|
-
</span>
|
|
396
|
+
{restTagsContent}
|
|
367
397
|
</Popover>
|
|
368
|
-
) :
|
|
369
|
-
(
|
|
370
|
-
<span className={spanNotWithPopoverCls}>
|
|
371
|
-
{`+${tagsArray.length - maxTagCount}`}
|
|
372
|
-
</span>
|
|
373
|
-
)
|
|
398
|
+
) : restTagsContent
|
|
374
399
|
)
|
|
375
400
|
}
|
|
376
401
|
</>
|
package/timePicker/Combobox.tsx
CHANGED
|
@@ -317,12 +317,7 @@ class Combobox extends BaseComponent<ComboboxProps, ComboboxState> {
|
|
|
317
317
|
return (
|
|
318
318
|
<LocaleConsumer componentName="TimePicker">
|
|
319
319
|
{(locale: Locale['TimePicker'], localeCode: Locale['code']) => (
|
|
320
|
-
<ScrollList
|
|
321
|
-
header={panelHeader}
|
|
322
|
-
footer={panelFooter}
|
|
323
|
-
x-semi-header-alias="panelHeader"
|
|
324
|
-
x-semi-footer-alias="panelFooter"
|
|
325
|
-
>
|
|
320
|
+
<ScrollList header={panelHeader} footer={panelFooter}>
|
|
326
321
|
{this.renderAMPMSelect(locale, localeCode)}
|
|
327
322
|
{this.renderHourSelect(value.getHours(), locale)}
|
|
328
323
|
{this.renderMinuteSelect(value.getMinutes(), locale)}
|
package/toast/toast.tsx
CHANGED
|
@@ -120,7 +120,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
|
|
|
120
120
|
const btnSize = 'small';
|
|
121
121
|
return (
|
|
122
122
|
<div
|
|
123
|
-
role=
|
|
123
|
+
role='alert'
|
|
124
124
|
aria-label={`${type ? type : 'default'} type`}
|
|
125
125
|
className={toastCls}
|
|
126
126
|
style={style}
|
|
@@ -129,7 +129,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
|
|
|
129
129
|
>
|
|
130
130
|
<div className={`${prefixCls}-content`}>
|
|
131
131
|
{this.renderIcon()}
|
|
132
|
-
<span className={`${prefixCls}-content-text`} style={textStyle}
|
|
132
|
+
<span className={`${prefixCls}-content-text`} style={textStyle}>
|
|
133
133
|
{content}
|
|
134
134
|
</span>
|
|
135
135
|
{showClose && (
|
|
@@ -137,7 +137,7 @@ class Toast extends BaseComponent<ToastReactProps, ToastState> {
|
|
|
137
137
|
<Button
|
|
138
138
|
onClick={e => this.close(e)}
|
|
139
139
|
type="tertiary"
|
|
140
|
-
icon={<IconClose
|
|
140
|
+
icon={<IconClose />}
|
|
141
141
|
theme={btnTheme}
|
|
142
142
|
size={btnSize}
|
|
143
143
|
/>
|
package/transfer/index.tsx
CHANGED
|
@@ -353,7 +353,6 @@ class Transfer extends BaseComponent<TransferProps, TransferState> {
|
|
|
353
353
|
checked={checked}
|
|
354
354
|
role="listitem"
|
|
355
355
|
onChange={() => this.onSelectOrRemove(item)}
|
|
356
|
-
x-semi-children-alias={`dataSource[${index}].label`}
|
|
357
356
|
>
|
|
358
357
|
{item.label}
|
|
359
358
|
</Checkbox>
|
package/tree/treeNode.tsx
CHANGED
|
@@ -269,7 +269,7 @@ export default class TreeNode extends PureComponent<TreeNodeProps, TreeNodeState
|
|
|
269
269
|
});
|
|
270
270
|
return (
|
|
271
271
|
<ul className={wrapperCls}>
|
|
272
|
-
<li className={`${prefixcls}-label ${prefixcls}-label-empty`}
|
|
272
|
+
<li className={`${prefixcls}-label ${prefixcls}-label-empty`}>
|
|
273
273
|
{emptyContent}
|
|
274
274
|
</li>
|
|
275
275
|
</ul>
|
package/treeSelect/index.tsx
CHANGED
|
@@ -646,11 +646,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
646
646
|
[`${prefixcls}-suffix-text`]: suffix && isString(suffix),
|
|
647
647
|
[`${prefixcls}-suffix-icon`]: isSemiIcon(suffix),
|
|
648
648
|
});
|
|
649
|
-
return
|
|
650
|
-
<div className={suffixWrapperCls} x-semi-prop="suffix">
|
|
651
|
-
{suffix}
|
|
652
|
-
</div>
|
|
653
|
-
);
|
|
649
|
+
return <div className={suffixWrapperCls}>{suffix}</div>;
|
|
654
650
|
};
|
|
655
651
|
|
|
656
652
|
renderPrefix = () => {
|
|
@@ -664,11 +660,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
664
660
|
[`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
665
661
|
});
|
|
666
662
|
|
|
667
|
-
return
|
|
668
|
-
<div className={prefixWrapperCls} id={insetLabelId} x-semi-prop="prefix,insetLabel">
|
|
669
|
-
{labelNode}
|
|
670
|
-
</div>
|
|
671
|
-
);
|
|
663
|
+
return <div className={prefixWrapperCls} id={insetLabelId}>{labelNode}</div>;
|
|
672
664
|
};
|
|
673
665
|
|
|
674
666
|
renderContent = () => {
|
|
@@ -875,11 +867,7 @@ class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState> {
|
|
|
875
867
|
if (showClearBtn) {
|
|
876
868
|
return null;
|
|
877
869
|
}
|
|
878
|
-
return arrowIcon ? (
|
|
879
|
-
<div className={cls(`${prefixcls}-arrow`)} x-semi-prop="arrowIcon">
|
|
880
|
-
{arrowIcon}
|
|
881
|
-
</div>
|
|
882
|
-
) : null;
|
|
870
|
+
return arrowIcon ? <div className={cls(`${prefixcls}-arrow`)}>{arrowIcon}</div> : null;
|
|
883
871
|
};
|
|
884
872
|
|
|
885
873
|
renderClearBtn = () => {
|
package/typography/base.tsx
CHANGED
|
@@ -526,7 +526,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
526
526
|
}
|
|
527
527
|
const iconSize: Size = size === 'small' ? 'small' : 'default';
|
|
528
528
|
return (
|
|
529
|
-
<span className={`${prefixCls}-icon`}
|
|
529
|
+
<span className={`${prefixCls}-icon`}>
|
|
530
530
|
{isSemiIcon(icon) ? React.cloneElement((icon as React.ReactElement), { size: iconSize }) : icon}
|
|
531
531
|
</span>
|
|
532
532
|
);
|
|
@@ -957,3 +957,155 @@ export const CustomListOperation = () => {
|
|
|
957
957
|
CustomListOperation.story = {
|
|
958
958
|
name: 'custom list operation',
|
|
959
959
|
}
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
export const TestReplaceFunc = () => (
|
|
963
|
+
<>
|
|
964
|
+
<Upload
|
|
965
|
+
{...commonProps}
|
|
966
|
+
action={action}
|
|
967
|
+
accept=".md,image/*,video/*"
|
|
968
|
+
maxSize={mb1}
|
|
969
|
+
minSize={0}
|
|
970
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
971
|
+
>
|
|
972
|
+
<Button icon={<IconUpload />} theme="light">
|
|
973
|
+
点击上传(最小0kB,最大1MB)
|
|
974
|
+
</Button>
|
|
975
|
+
</Upload>
|
|
976
|
+
<Upload
|
|
977
|
+
{...commonProps}
|
|
978
|
+
action={action}
|
|
979
|
+
accept="image/*"
|
|
980
|
+
maxSize={mb1}
|
|
981
|
+
minSize={0}
|
|
982
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
983
|
+
>
|
|
984
|
+
<Button icon={<IconUpload />} theme="light">
|
|
985
|
+
只接受image点击上传(最小0kB,最大1MB)
|
|
986
|
+
</Button>
|
|
987
|
+
</Upload>
|
|
988
|
+
<Upload
|
|
989
|
+
{...commonProps}
|
|
990
|
+
action={action}
|
|
991
|
+
accept=".md,image/*,video/*"
|
|
992
|
+
maxSize={mb1}
|
|
993
|
+
minSize={kb2}
|
|
994
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
995
|
+
>
|
|
996
|
+
<Button icon={<IconUpload />} theme="light">
|
|
997
|
+
点击上传(最小200kB,最大1MB)
|
|
998
|
+
</Button>
|
|
999
|
+
</Upload>
|
|
1000
|
+
</>
|
|
1001
|
+
);
|
|
1002
|
+
|
|
1003
|
+
TestReplaceFunc.story = {
|
|
1004
|
+
name: 'test replace func',
|
|
1005
|
+
};
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
class InsertUpload extends React.Component {
|
|
1009
|
+
constructor() {
|
|
1010
|
+
super();
|
|
1011
|
+
this.onFileChange = this.onFileChange.bind(this);
|
|
1012
|
+
this.insert1 = this.insert1.bind(this);
|
|
1013
|
+
this.insert2 = this.insert2.bind(this);
|
|
1014
|
+
this.insert3 = this.insert3.bind(this);
|
|
1015
|
+
this.uploadRef1 = React.createRef();
|
|
1016
|
+
this.uploadRef2 = React.createRef();
|
|
1017
|
+
this.uploadRef3 = React.createRef();
|
|
1018
|
+
this.file = null;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
onFileChange(file) {
|
|
1022
|
+
delete file[0].uid;
|
|
1023
|
+
this.file = file;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
insert1() {
|
|
1027
|
+
// test file number limit
|
|
1028
|
+
this.uploadRef1.current.insert(this.file, 0);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
insert2() {
|
|
1032
|
+
this.uploadRef2.current.insert(this.file, 0);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
insert3() {
|
|
1036
|
+
// test size limit
|
|
1037
|
+
this.uploadRef3.current.insert(this.file, 0);
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
render() {
|
|
1041
|
+
let action = 'https://run.mocky.io/v3/d6ac5c9e-4d39-4309-a747-7ed3b5694859';
|
|
1042
|
+
return (
|
|
1043
|
+
<div>
|
|
1044
|
+
<Upload
|
|
1045
|
+
action={action}
|
|
1046
|
+
ref={this.uploadRef1}
|
|
1047
|
+
accept=".md,image/*,video/*"
|
|
1048
|
+
onSuccess={(...v) => console.log(...v)}
|
|
1049
|
+
onError={(...v) => console.log(...v)}
|
|
1050
|
+
onFileChange={this.onFileChange}
|
|
1051
|
+
maxSize={mb1}
|
|
1052
|
+
minSize={0}
|
|
1053
|
+
limit={1}
|
|
1054
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
1055
|
+
>
|
|
1056
|
+
<Button icon={<IconPlus />} theme="light" style={{ marginRight: 8 }}>
|
|
1057
|
+
选择文件 limit 1
|
|
1058
|
+
</Button>
|
|
1059
|
+
</Upload>
|
|
1060
|
+
<Upload
|
|
1061
|
+
action={action}
|
|
1062
|
+
ref={this.uploadRef2}
|
|
1063
|
+
accept=".md,image/*,video/*"
|
|
1064
|
+
onSuccess={(...v) => console.log(...v)}
|
|
1065
|
+
onError={(...v) => console.log(...v)}
|
|
1066
|
+
onFileChange={this.onFileChange}
|
|
1067
|
+
maxSize={mb1}
|
|
1068
|
+
minSize={0}
|
|
1069
|
+
limit={2}
|
|
1070
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
1071
|
+
>
|
|
1072
|
+
<Button icon={<IconPlus />} theme="light" style={{ marginRight: 8 }}>
|
|
1073
|
+
选择文件 limit 2
|
|
1074
|
+
</Button>
|
|
1075
|
+
</Upload>
|
|
1076
|
+
<Upload
|
|
1077
|
+
{...commonProps}
|
|
1078
|
+
action={action}
|
|
1079
|
+
ref={this.uploadRef3}
|
|
1080
|
+
accept=".md,image/*,video/*"
|
|
1081
|
+
onSuccess={(...v) => console.log(...v)}
|
|
1082
|
+
onError={(...v) => console.log(...v)}
|
|
1083
|
+
onFileChange={this.onFileChange}
|
|
1084
|
+
maxSize={mb1}
|
|
1085
|
+
minSize={kb2}
|
|
1086
|
+
limit={1}
|
|
1087
|
+
transformFile={(fileInstance)=>{return fileInstance;}}
|
|
1088
|
+
>
|
|
1089
|
+
<Button icon={<IconPlus />} theme="light" style={{ marginRight: 8 }}>
|
|
1090
|
+
选择文件 size 限制
|
|
1091
|
+
</Button>
|
|
1092
|
+
</Upload>
|
|
1093
|
+
<Button icon={<IconUpload />} theme="light" onClick={this.insert1}>
|
|
1094
|
+
插入首项上传1
|
|
1095
|
+
</Button>
|
|
1096
|
+
<Button icon={<IconUpload />} theme="light" onClick={this.insert2}>
|
|
1097
|
+
插入首项上传2
|
|
1098
|
+
</Button>
|
|
1099
|
+
<Button icon={<IconUpload />} theme="light" onClick={this.insert3}>
|
|
1100
|
+
插入首项上传3
|
|
1101
|
+
</Button>
|
|
1102
|
+
</div>
|
|
1103
|
+
);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export const Insert = () => <InsertUpload></InsertUpload>;
|
|
1108
|
+
|
|
1109
|
+
Insert.story = {
|
|
1110
|
+
name: 'insert',
|
|
1111
|
+
};
|