@douyinfe/semi-ui 2.11.0 → 2.12.0-alpha.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/README.md +1 -1
- package/avatar/index.tsx +2 -2
- package/backtop/index.tsx +11 -7
- package/badge/index.tsx +1 -1
- package/banner/index.tsx +5 -5
- package/breadcrumb/index.tsx +5 -3
- package/button/Button.tsx +10 -8
- package/card/index.tsx +43 -41
- package/carousel/CarouselArrow.tsx +2 -0
- package/carousel/index.tsx +1 -0
- package/cascader/index.tsx +101 -123
- package/cascader/item.tsx +1 -1
- package/checkbox/checkbox.tsx +13 -2
- package/collapsible/index.tsx +8 -1
- package/datePicker/dateInput.tsx +1 -0
- package/datePicker/datePicker.tsx +13 -5
- package/dist/css/semi.css +33 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +694 -384
- 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 +8 -4
- package/dropdown/index.tsx +1 -1
- package/empty/index.tsx +13 -5
- package/form/_story/FormSubmit/index.tsx +45 -0
- package/form/_story/form.stories.js +2 -1
- 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/iconButton/index.tsx +2 -1
- package/input/index.tsx +38 -11
- package/lib/cjs/avatar/index.js +4 -2
- package/lib/cjs/backtop/index.js +2 -1
- package/lib/cjs/badge/index.js +2 -1
- package/lib/cjs/banner/index.js +9 -4
- package/lib/cjs/breadcrumb/index.js +4 -3
- package/lib/cjs/button/Button.js +13 -3
- package/lib/cjs/card/index.js +10 -5
- package/lib/cjs/carousel/CarouselArrow.js +6 -2
- package/lib/cjs/carousel/index.js +2 -1
- package/lib/cjs/cascader/index.js +9 -6
- package/lib/cjs/cascader/item.js +2 -1
- package/lib/cjs/checkbox/checkbox.js +8 -4
- package/lib/cjs/collapsible/index.js +2 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.js +2 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.js +4 -2
- package/lib/cjs/datePicker/monthsGrid.d.ts +2 -2
- package/lib/cjs/divider/index.js +2 -1
- package/lib/cjs/dropdown/index.js +2 -1
- package/lib/cjs/empty/index.js +8 -4
- 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 +2 -1
- package/lib/cjs/form/label.js +2 -1
- package/lib/cjs/grid/col.js +2 -1
- package/lib/cjs/grid/row.js +2 -1
- package/lib/cjs/iconButton/index.js +3 -1
- package/lib/cjs/input/index.js +9 -5
- package/lib/cjs/list/index.js +6 -3
- package/lib/cjs/modal/ConfirmModal.js +2 -1
- package/lib/cjs/modal/Modal.js +6 -2
- package/lib/cjs/modal/ModalContent.js +13 -6
- package/lib/cjs/navigation/Item.d.ts +1 -1
- package/lib/cjs/notification/notice.js +6 -3
- package/lib/cjs/pagination/index.js +4 -2
- package/lib/cjs/popconfirm/index.js +6 -3
- package/lib/cjs/radio/radio.d.ts +1 -1
- package/lib/cjs/radio/radio.js +4 -2
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/rating/item.js +2 -1
- package/lib/cjs/scrollList/index.js +6 -3
- package/lib/cjs/select/index.js +9 -5
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
- package/lib/cjs/skeleton/index.js +3 -1
- package/lib/cjs/slider/index.js +9 -5
- package/lib/cjs/space/index.js +2 -1
- package/lib/cjs/spin/index.js +7 -3
- package/lib/cjs/switch/index.js +6 -4
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +6 -3
- package/lib/cjs/tabs/TabBar.d.ts +1 -0
- package/lib/cjs/tabs/TabBar.js +10 -2
- package/lib/cjs/tabs/TabPane.js +7 -3
- package/lib/cjs/tabs/index.js +2 -1
- package/lib/cjs/tabs/interface.d.ts +1 -0
- package/lib/cjs/tag/index.d.ts +2 -0
- package/lib/cjs/tag/index.js +60 -11
- package/lib/cjs/tag/interface.d.ts +1 -0
- package/lib/cjs/tagInput/index.js +7 -4
- package/lib/cjs/timePicker/Combobox.js +3 -1
- package/lib/cjs/toast/toast.js +6 -3
- package/lib/cjs/transfer/index.js +2 -1
- package/lib/cjs/tree/treeNode.js +2 -1
- package/lib/cjs/treeSelect/index.js +9 -6
- package/lib/cjs/typography/base.js +2 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/cjs/upload/index.js +13 -6
- package/lib/es/avatar/index.js +4 -2
- package/lib/es/backtop/index.js +2 -1
- package/lib/es/badge/index.js +2 -1
- package/lib/es/banner/index.js +9 -4
- package/lib/es/breadcrumb/index.js +4 -3
- package/lib/es/button/Button.js +11 -3
- package/lib/es/card/index.js +10 -5
- package/lib/es/carousel/CarouselArrow.js +6 -2
- package/lib/es/carousel/index.js +2 -1
- package/lib/es/cascader/index.js +9 -6
- package/lib/es/cascader/item.js +2 -1
- package/lib/es/checkbox/checkbox.js +8 -4
- package/lib/es/collapsible/index.js +2 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/dateInput.js +2 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/datePicker.js +4 -2
- package/lib/es/datePicker/monthsGrid.d.ts +2 -2
- package/lib/es/divider/index.js +2 -1
- package/lib/es/dropdown/index.js +2 -1
- package/lib/es/empty/index.js +8 -4
- 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 +2 -1
- package/lib/es/form/label.js +2 -1
- package/lib/es/grid/col.js +2 -1
- package/lib/es/grid/row.js +2 -1
- package/lib/es/iconButton/index.js +3 -1
- package/lib/es/input/index.js +9 -5
- package/lib/es/list/index.js +6 -3
- package/lib/es/modal/ConfirmModal.js +2 -1
- package/lib/es/modal/Modal.js +6 -2
- package/lib/es/modal/ModalContent.js +13 -6
- package/lib/es/navigation/Item.d.ts +1 -1
- package/lib/es/notification/notice.js +6 -3
- package/lib/es/pagination/index.js +4 -2
- package/lib/es/popconfirm/index.js +6 -3
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/radio/radio.js +4 -2
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/rating/item.js +2 -1
- package/lib/es/scrollList/index.js +6 -3
- package/lib/es/select/index.js +9 -5
- package/lib/es/select/option.js +2 -1
- package/lib/es/sideSheet/SideSheetContent.js +6 -3
- package/lib/es/skeleton/index.js +3 -1
- package/lib/es/slider/index.js +9 -5
- package/lib/es/space/index.js +2 -1
- package/lib/es/spin/index.js +7 -3
- package/lib/es/switch/index.js +6 -4
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +6 -3
- package/lib/es/tabs/TabBar.d.ts +1 -0
- package/lib/es/tabs/TabBar.js +10 -2
- package/lib/es/tabs/TabPane.js +7 -3
- package/lib/es/tabs/index.js +2 -1
- package/lib/es/tabs/interface.d.ts +1 -0
- package/lib/es/tag/index.d.ts +2 -0
- package/lib/es/tag/index.js +56 -9
- package/lib/es/tag/interface.d.ts +1 -0
- package/lib/es/tagInput/index.js +7 -4
- package/lib/es/timePicker/Combobox.js +3 -1
- package/lib/es/toast/toast.js +6 -3
- package/lib/es/transfer/index.js +2 -1
- package/lib/es/tree/treeNode.js +2 -1
- package/lib/es/treeSelect/index.js +8 -5
- package/lib/es/typography/base.js +2 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +1 -1
- package/lib/es/upload/index.js +13 -6
- package/list/index.tsx +16 -4
- package/modal/ConfirmModal.tsx +1 -1
- package/modal/Modal.tsx +2 -0
- package/modal/ModalContent.tsx +33 -21
- package/navigation/Item.tsx +1 -1
- package/notification/notice.tsx +16 -4
- package/package.json +9 -9
- package/pagination/index.tsx +16 -2
- package/popconfirm/index.tsx +11 -3
- package/radio/radio.tsx +10 -2
- package/rating/item.tsx +1 -1
- package/scrollList/index.tsx +19 -3
- package/select/index.tsx +13 -6
- package/select/option.tsx +5 -1
- package/sideSheet/SideSheetContent.tsx +3 -3
- package/skeleton/index.tsx +1 -1
- package/slider/index.tsx +5 -3
- package/space/index.tsx +1 -1
- package/spin/index.tsx +15 -9
- package/switch/index.tsx +9 -14
- package/table/Table.tsx +5 -3
- package/table/_story/v2/index.js +2 -1
- package/table/_story/v2/radioRowSelection.tsx +107 -0
- package/tabs/TabBar.tsx +8 -1
- package/tabs/TabPane.tsx +10 -4
- package/tabs/index.tsx +2 -1
- package/tabs/interface.ts +1 -0
- package/tag/index.tsx +32 -2
- package/tag/interface.ts +1 -0
- package/tagInput/index.tsx +3 -2
- package/timePicker/Combobox.tsx +6 -1
- package/toast/toast.tsx +3 -3
- package/transfer/index.tsx +1 -0
- package/tree/treeNode.tsx +1 -1
- package/treeSelect/index.tsx +16 -4
- package/typography/base.tsx +1 -1
- package/upload/index.tsx +107 -38
package/divider/index.tsx
CHANGED
|
@@ -60,10 +60,14 @@ const Divider: React.FC<DividerProps> = props => {
|
|
|
60
60
|
|
|
61
61
|
return (
|
|
62
62
|
<div {...rest} className={dividerClassNames} style={{ ...overrideDefaultStyle, ...style }}>
|
|
63
|
-
{
|
|
64
|
-
typeof children === 'string' ?
|
|
65
|
-
{children
|
|
66
|
-
|
|
63
|
+
{children && layout === 'horizontal' ? (
|
|
64
|
+
typeof children === 'string' ? (
|
|
65
|
+
<span className={`${prefixCls}-divider_inner-text`} x-semi-prop="children">
|
|
66
|
+
{children}
|
|
67
|
+
</span>
|
|
68
|
+
) : (
|
|
69
|
+
children
|
|
70
|
+
)
|
|
67
71
|
) : null}
|
|
68
72
|
</div>
|
|
69
73
|
);
|
package/dropdown/index.tsx
CHANGED
|
@@ -144,7 +144,7 @@ class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
|
|
|
144
144
|
return (
|
|
145
145
|
<DropdownContext.Provider value={contextValue}>
|
|
146
146
|
<div className={className} style={style}>
|
|
147
|
-
<div className={`${prefixCls}-content`}>{content}</div>
|
|
147
|
+
<div className={`${prefixCls}-content`} x-semi-prop="render">{content}</div>
|
|
148
148
|
</div>
|
|
149
149
|
</DropdownContext.Provider>
|
|
150
150
|
);
|
package/empty/index.tsx
CHANGED
|
@@ -109,17 +109,25 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
109
109
|
};
|
|
110
110
|
return (
|
|
111
111
|
<div className={wrapperCls} style={style}>
|
|
112
|
-
<div className={`${prefixCls}-image`} style={imageStyle} >
|
|
112
|
+
<div className={`${prefixCls}-image`} style={imageStyle} x-semi-prop="image,darkModeImage">
|
|
113
113
|
{imageNode}
|
|
114
114
|
</div>
|
|
115
|
-
<div className={`${prefixCls}-content`}
|
|
115
|
+
<div className={`${prefixCls}-content`}>
|
|
116
116
|
{title ? (
|
|
117
|
-
<Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`} >
|
|
117
|
+
<Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`} x-semi-prop="title">
|
|
118
118
|
{title}
|
|
119
119
|
</Typography.Title>
|
|
120
120
|
) : null}
|
|
121
|
-
{description ?
|
|
122
|
-
|
|
121
|
+
{description ? (
|
|
122
|
+
<div className={`${prefixCls}-description`} x-semi-prop="description">
|
|
123
|
+
{description}
|
|
124
|
+
</div>
|
|
125
|
+
) : null}
|
|
126
|
+
{children ? (
|
|
127
|
+
<div className={`${prefixCls}-footer`} x-semi-prop="children">
|
|
128
|
+
{children}
|
|
129
|
+
</div>
|
|
130
|
+
) : null}
|
|
123
131
|
</div>
|
|
124
132
|
</div>
|
|
125
133
|
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Form, Tooltip, Button } from '@douyinfe/semi-ui';
|
|
3
|
+
import { IconHelpCircle } from '@douyinfe/semi-icons';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description input, button may trigger submit of form
|
|
7
|
+
*
|
|
8
|
+
* case 1: 当 form 中只有一个 input,在 input 上敲击 enter 会触发 form submit
|
|
9
|
+
* case 2: 当 form 中有 2 个 input,在任意一个 input 上敲击 enter 都不会触发 form submit
|
|
10
|
+
* case 3: 当 from 中有一个 input 和一个 button,在 input 上敲击 enter 会触发 form submit
|
|
11
|
+
*
|
|
12
|
+
* @summary 如果不想触发 form submit,监听 input key down,如果 `e.key` 等于 `Enter` 则调用 e.preventDefault
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/DouyinFE/semi-design/issues/767#issuecomment-1098836675
|
|
15
|
+
*/
|
|
16
|
+
const App = () => {
|
|
17
|
+
const { Option } = Form.Select;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Form onSubmit={() => { console.log('submit');} }>
|
|
21
|
+
<Form.Select field="Role" label='角色' style={{ width:176 }}>
|
|
22
|
+
<Option value="admin">管理员</Option>
|
|
23
|
+
<Option value="user">普通用户</Option>
|
|
24
|
+
<Option value="guest">访客</Option>
|
|
25
|
+
</Form.Select>
|
|
26
|
+
<Form.Input field='UserName' label='用户名' style={{ width:80 }} onKeyDown={e => {
|
|
27
|
+
if (e.key === 'Enter') {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
}
|
|
30
|
+
}} />
|
|
31
|
+
<Form.Input
|
|
32
|
+
field='Password'
|
|
33
|
+
label={{
|
|
34
|
+
text: '密码',
|
|
35
|
+
extra: <Tooltip content='详情'><IconHelpCircle style={{ color: '--semi-color-text-1' }}/></Tooltip>
|
|
36
|
+
}}
|
|
37
|
+
style={{ width:176 }}
|
|
38
|
+
/>
|
|
39
|
+
<Button>提交</Button>
|
|
40
|
+
</Form>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
App.storyName = 'form submit';
|
|
44
|
+
|
|
45
|
+
export default App;
|
|
@@ -91,6 +91,7 @@ import { SetValuesDemo, SetValuesWithArrayField } from './FormApi/setValuesDemo'
|
|
|
91
91
|
import { SetValueUsingParentPath } from './FormApi/formApiDemo';
|
|
92
92
|
import { FieldPathWithArrayDemo } from './Debug/bugDemo';
|
|
93
93
|
import ChildDidMount from './Debug/childDidMount';
|
|
94
|
+
export { default as FormSubmit } from './FormSubmit';
|
|
94
95
|
|
|
95
96
|
export default {
|
|
96
97
|
title: 'Form'
|
|
@@ -429,4 +430,4 @@ export const _ChildDidMount = () => <ChildDidMount />;
|
|
|
429
430
|
|
|
430
431
|
_ChildDidMount.story = {
|
|
431
432
|
name: 'child did mount',
|
|
432
|
-
};
|
|
433
|
+
};
|
package/form/hoc/withField.tsx
CHANGED
|
@@ -439,7 +439,7 @@ function withField<
|
|
|
439
439
|
[`${prefix}-field-extra-botttom`]: mergeExtraPos === 'bottom',
|
|
440
440
|
});
|
|
441
441
|
|
|
442
|
-
const extraContent = extraText ? <div className={extraCls} id={extraTextId}>{extraText}</div> : null;
|
|
442
|
+
const extraContent = extraText ? <div className={extraCls} id={extraTextId} x-semi-prop="extraText">{extraText}</div> : null;
|
|
443
443
|
|
|
444
444
|
let newProps: Record<string, any> = {
|
|
445
445
|
id: a11yId,
|
package/form/label.tsx
CHANGED
|
@@ -61,7 +61,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
61
61
|
width ? labelStyle.width = width : null;
|
|
62
62
|
|
|
63
63
|
const textContent = (
|
|
64
|
-
<div className={`${prefixCls}-field-label-text`}>
|
|
64
|
+
<div className={`${prefixCls}-field-label-text`} x-semi-prop="label">
|
|
65
65
|
{typeof text !== 'undefined' ? text : children}
|
|
66
66
|
</div>
|
|
67
67
|
);
|
package/grid/col.tsx
CHANGED
package/grid/row.tsx
CHANGED
|
@@ -167,7 +167,7 @@ class Row extends React.Component<RowProps, RowState> {
|
|
|
167
167
|
gutters,
|
|
168
168
|
}}
|
|
169
169
|
>
|
|
170
|
-
<div {...otherProps} className={classes} style={rowStyle}>
|
|
170
|
+
<div {...otherProps} className={classes} style={rowStyle} x-semi-prop="children">
|
|
171
171
|
{children}
|
|
172
172
|
</div>
|
|
173
173
|
</RowContext.Provider>
|
package/iconButton/index.tsx
CHANGED
|
@@ -97,7 +97,8 @@ class IconButton extends PureComponent<IconButtonProps> {
|
|
|
97
97
|
[`${prefixCls}-content-right`]: iconPosition === 'left',
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const xSemiProp = this.props['x-semi-children-alias'] || 'children';
|
|
101
|
+
const children = originChildren != null ? <span className={btnTextCls} x-semi-prop={xSemiProp}>{originChildren}</span> : null;
|
|
101
102
|
|
|
102
103
|
if (iconPosition === 'left') {
|
|
103
104
|
finalChildren = (
|
package/input/index.tsx
CHANGED
|
@@ -141,7 +141,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
141
141
|
onKeyUp: noop,
|
|
142
142
|
onKeyPress: noop,
|
|
143
143
|
onEnterPress: noop,
|
|
144
|
-
validateStatus: 'default'
|
|
144
|
+
validateStatus: 'default',
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
inputRef!: React.RefObject<HTMLInputElement>;
|
|
@@ -195,7 +195,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
195
195
|
notifyClear: (e: React.MouseEvent<HTMLDivElement>) => this.props.onClear(e),
|
|
196
196
|
setPaddingLeft: (paddingLeft: string) => this.setState({ paddingLeft }),
|
|
197
197
|
setMinLength: (minLength: number) => this.setState({ minLength }),
|
|
198
|
-
isEventTarget: (e: React.MouseEvent) => e && e.target === e.currentTarget
|
|
198
|
+
isEventTarget: (e: React.MouseEvent) => e && e.target === e.currentTarget,
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -255,7 +255,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
255
255
|
|
|
256
256
|
handleModeEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
257
257
|
this.foundation.handleModeEnterPress(e);
|
|
258
|
-
}
|
|
258
|
+
};
|
|
259
259
|
|
|
260
260
|
handleClickPrefixOrSuffix = (e: React.MouseEvent<HTMLInputElement>) => {
|
|
261
261
|
this.foundation.handleClickPrefixOrSuffix(e);
|
|
@@ -273,7 +273,11 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
273
273
|
[`${prefixCls}-prepend-text`]: addonBefore && isString(addonBefore),
|
|
274
274
|
[`${prefixCls}-prepend-icon`]: isSemiIcon(addonBefore),
|
|
275
275
|
});
|
|
276
|
-
return
|
|
276
|
+
return (
|
|
277
|
+
<div className={prefixWrapperCls} x-semi-prop="addonBefore">
|
|
278
|
+
{addonBefore}
|
|
279
|
+
</div>
|
|
280
|
+
);
|
|
277
281
|
}
|
|
278
282
|
return null;
|
|
279
283
|
}
|
|
@@ -286,7 +290,11 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
286
290
|
[`${prefixCls}-append-text`]: addonAfter && isString(addonAfter),
|
|
287
291
|
[`${prefixCls}-append-icon`]: isSemiIcon(addonAfter),
|
|
288
292
|
});
|
|
289
|
-
return
|
|
293
|
+
return (
|
|
294
|
+
<div className={prefixWrapperCls} x-semi-prop="addonAfter">
|
|
295
|
+
{addonAfter}
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
290
298
|
}
|
|
291
299
|
return null;
|
|
292
300
|
}
|
|
@@ -352,7 +360,17 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
352
360
|
});
|
|
353
361
|
|
|
354
362
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
355
|
-
return
|
|
363
|
+
return (
|
|
364
|
+
<div
|
|
365
|
+
className={prefixWrapperCls}
|
|
366
|
+
onMouseDown={this.handlePreventMouseDown}
|
|
367
|
+
onClick={this.handleClickPrefixOrSuffix}
|
|
368
|
+
id={insetLabelId}
|
|
369
|
+
x-semi-prop="prefix,insetLabel"
|
|
370
|
+
>
|
|
371
|
+
{labelNode}
|
|
372
|
+
</div>
|
|
373
|
+
);
|
|
356
374
|
}
|
|
357
375
|
|
|
358
376
|
showClearBtn() {
|
|
@@ -367,13 +385,22 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
367
385
|
return null;
|
|
368
386
|
}
|
|
369
387
|
const suffixWrapperCls = cls({
|
|
370
|
-
[`${prefixCls
|
|
371
|
-
[`${prefixCls
|
|
372
|
-
[`${prefixCls
|
|
388
|
+
[`${prefixCls}-suffix`]: true,
|
|
389
|
+
[`${prefixCls}-suffix-text`]: suffix && isString(suffix),
|
|
390
|
+
[`${prefixCls}-suffix-icon`]: isSemiIcon(suffix),
|
|
373
391
|
[`${prefixCls}-suffix-hidden`]: suffixAllowClear && Boolean(hideSuffix),
|
|
374
392
|
});
|
|
375
393
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
376
|
-
return
|
|
394
|
+
return (
|
|
395
|
+
<div
|
|
396
|
+
className={suffixWrapperCls}
|
|
397
|
+
onMouseDown={this.handlePreventMouseDown}
|
|
398
|
+
onClick={this.handleClickPrefixOrSuffix}
|
|
399
|
+
x-semi-prop="suffix"
|
|
400
|
+
>
|
|
401
|
+
{suffix}
|
|
402
|
+
</div>
|
|
403
|
+
);
|
|
377
404
|
}
|
|
378
405
|
|
|
379
406
|
render() {
|
|
@@ -460,7 +487,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
460
487
|
inputProps.minLength = stateMinLength;
|
|
461
488
|
}
|
|
462
489
|
if (validateStatus === 'error') {
|
|
463
|
-
inputProps['aria-invalid'] =
|
|
490
|
+
inputProps['aria-invalid'] = 'true';
|
|
464
491
|
}
|
|
465
492
|
return (
|
|
466
493
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
package/lib/cjs/avatar/index.js
CHANGED
|
@@ -202,7 +202,8 @@ class Avatar extends _baseComponent.default {
|
|
|
202
202
|
}, className);
|
|
203
203
|
let content = children;
|
|
204
204
|
const hoverRender = hoverContent ? /*#__PURE__*/_react.default.createElement("div", {
|
|
205
|
-
className: "".concat(prefixCls, "-hover")
|
|
205
|
+
className: "".concat(prefixCls, "-hover"),
|
|
206
|
+
"x-semi-prop": "hoverContent"
|
|
206
207
|
}, hoverContent) : null;
|
|
207
208
|
|
|
208
209
|
if (isImg) {
|
|
@@ -216,7 +217,8 @@ class Avatar extends _baseComponent.default {
|
|
|
216
217
|
content = /*#__PURE__*/_react.default.createElement("span", {
|
|
217
218
|
className: "".concat(prefixCls, "-content")
|
|
218
219
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
219
|
-
className: "".concat(prefixCls, "-label")
|
|
220
|
+
className: "".concat(prefixCls, "-label"),
|
|
221
|
+
"x-semi-prop": "children"
|
|
220
222
|
}, children));
|
|
221
223
|
}
|
|
222
224
|
|
package/lib/cjs/backtop/index.js
CHANGED
|
@@ -121,7 +121,8 @@ class BackTop extends _baseComponent.default {
|
|
|
121
121
|
const content = visible ? /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({}, others, {
|
|
122
122
|
className: preCls,
|
|
123
123
|
style: style,
|
|
124
|
-
onClick: e => this.handleClick(e)
|
|
124
|
+
onClick: e => this.handleClick(e),
|
|
125
|
+
"x-semi-prop": "children"
|
|
125
126
|
}), backtopBtn) : null;
|
|
126
127
|
return content;
|
|
127
128
|
}
|
package/lib/cjs/badge/index.js
CHANGED
|
@@ -104,7 +104,8 @@ class Badge extends _react.PureComponent {
|
|
|
104
104
|
className: prefixCls
|
|
105
105
|
}, rest), children, /*#__PURE__*/_react.default.createElement("span", {
|
|
106
106
|
className: wrapper,
|
|
107
|
-
style: style
|
|
107
|
+
style: style,
|
|
108
|
+
"x-semi-prop": "count"
|
|
108
109
|
}, dot ? null : content));
|
|
109
110
|
}
|
|
110
111
|
|
package/lib/cjs/banner/index.js
CHANGED
|
@@ -93,6 +93,7 @@ class Banner extends _baseComponent.default {
|
|
|
93
93
|
className: "".concat(prefixCls, "-close"),
|
|
94
94
|
onClick: this.remove,
|
|
95
95
|
icon: closeIcon || /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
|
|
96
|
+
"x-semi-prop": "closeIcon",
|
|
96
97
|
"aria-hidden": true
|
|
97
98
|
}),
|
|
98
99
|
theme: "borderless",
|
|
@@ -139,7 +140,8 @@ class Banner extends _baseComponent.default {
|
|
|
139
140
|
|
|
140
141
|
if (iconType) {
|
|
141
142
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
142
|
-
className: iconCls
|
|
143
|
+
className: iconCls,
|
|
144
|
+
"x-semi-prop": "icon"
|
|
143
145
|
}, iconType);
|
|
144
146
|
}
|
|
145
147
|
|
|
@@ -181,12 +183,15 @@ class Banner extends _baseComponent.default {
|
|
|
181
183
|
}, title ? /*#__PURE__*/_react.default.createElement(_typography.default.Title, {
|
|
182
184
|
heading: 5,
|
|
183
185
|
className: "".concat(prefixCls, "-title"),
|
|
184
|
-
component: "div"
|
|
186
|
+
component: "div",
|
|
187
|
+
"x-semi-prop": "title"
|
|
185
188
|
}, title) : null, description ? /*#__PURE__*/_react.default.createElement(_typography.default.Paragraph, {
|
|
186
189
|
className: "".concat(prefixCls, "-description"),
|
|
187
|
-
component: "div"
|
|
190
|
+
component: "div",
|
|
191
|
+
"x-semi-prop": "description"
|
|
188
192
|
}, description) : null)), this.renderCloser()), children ? /*#__PURE__*/_react.default.createElement("div", {
|
|
189
|
-
className: "".concat(prefixCls, "-extra")
|
|
193
|
+
className: "".concat(prefixCls, "-extra"),
|
|
194
|
+
"x-semi-prop": "children"
|
|
190
195
|
}, children) : null) : null;
|
|
191
196
|
return banner;
|
|
192
197
|
}
|
|
@@ -76,14 +76,15 @@ class Breadcrumb extends _baseComponent.default {
|
|
|
76
76
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
77
77
|
className: "".concat(clsPrefix, "-item-wrap")
|
|
78
78
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
79
|
-
role:
|
|
79
|
+
role: "button",
|
|
80
80
|
tabIndex: 0,
|
|
81
|
-
"aria-label":
|
|
81
|
+
"aria-label": "Expand breadcrumb items",
|
|
82
82
|
className: (0, _concat.default)(_context = "".concat(clsPrefix, "-item ")).call(_context, clsPrefix, "-item-more"),
|
|
83
83
|
onClick: item => this.foundation.handleExpand(item),
|
|
84
84
|
onKeyPress: e => this.foundation.handleExpandEnterPress(e)
|
|
85
85
|
}, hasRenderMore && renderMore(restItem), !hasRenderMore && moreType === 'default' && /*#__PURE__*/_react.default.createElement(_semiIcons.IconMore, null), !hasRenderMore && moreType === 'popover' && this.renderPopoverMore(restItem)), /*#__PURE__*/_react.default.createElement("span", {
|
|
86
|
-
className: "".concat(clsPrefix, "-separator")
|
|
86
|
+
className: "".concat(clsPrefix, "-separator"),
|
|
87
|
+
"x-semi-prop": "separator"
|
|
87
88
|
}, this.props.separator)));
|
|
88
89
|
|
|
89
90
|
(0, _splice.default)(template).call(template, 1, itemsLen - maxItemCount, spread);
|
package/lib/cjs/button/Button.js
CHANGED
|
@@ -22,6 +22,10 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
22
22
|
|
|
23
23
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
24
24
|
|
|
25
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
26
|
+
|
|
27
|
+
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
28
|
+
|
|
25
29
|
var _react = _interopRequireWildcard(require("react"));
|
|
26
30
|
|
|
27
31
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -81,7 +85,7 @@ class Button extends _react.PureComponent {
|
|
|
81
85
|
|
|
82
86
|
const baseProps = (0, _assign.default)((0, _assign.default)({
|
|
83
87
|
disabled
|
|
84
|
-
}, attr), {
|
|
88
|
+
}, (0, _omit2.default)(attr, ['x-semi-children-alias'])), {
|
|
85
89
|
className: (0, _classnames.default)(prefixCls, {
|
|
86
90
|
[(0, _concat.default)(_context = "".concat(prefixCls, "-")).call(_context, type)]: !disabled && type,
|
|
87
91
|
["".concat(prefixCls, "-disabled")]: disabled,
|
|
@@ -96,6 +100,12 @@ class Button extends _react.PureComponent {
|
|
|
96
100
|
type: htmlType,
|
|
97
101
|
'aria-disabled': disabled
|
|
98
102
|
});
|
|
103
|
+
const xSemiProps = {};
|
|
104
|
+
|
|
105
|
+
if (!(className && (0, _includes.default)(className).call(className, '-with-icon'))) {
|
|
106
|
+
xSemiProps['x-semi-prop'] = this.props['x-semi-children-alias'] || 'children';
|
|
107
|
+
}
|
|
108
|
+
|
|
99
109
|
return (
|
|
100
110
|
/*#__PURE__*/
|
|
101
111
|
// eslint-disable-next-line react/button-has-type
|
|
@@ -103,10 +113,10 @@ class Button extends _react.PureComponent {
|
|
|
103
113
|
onClick: this.props.onClick,
|
|
104
114
|
onMouseDown: this.props.onMouseDown,
|
|
105
115
|
style: style
|
|
106
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
116
|
+
}), /*#__PURE__*/_react.default.createElement("span", (0, _assign.default)({
|
|
107
117
|
className: "".concat(prefixCls, "-content"),
|
|
108
118
|
onClick: e => disabled && e.stopPropagation()
|
|
109
|
-
}, children))
|
|
119
|
+
}, xSemiProps), children))
|
|
110
120
|
);
|
|
111
121
|
}
|
|
112
122
|
|
package/lib/cjs/card/index.js
CHANGED
|
@@ -95,7 +95,8 @@ class Card extends _react.PureComponent {
|
|
|
95
95
|
_react.default.createElement("div", {
|
|
96
96
|
className: headerWrapperCls
|
|
97
97
|
}, headerExtraContent && /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
-
className: "".concat(prefixcls, "-header-wrapper-extra")
|
|
98
|
+
className: "".concat(prefixcls, "-header-wrapper-extra"),
|
|
99
|
+
"x-semi-prop": "headerExtraContent"
|
|
99
100
|
}, headerExtraContent), title && /*#__PURE__*/_react.default.createElement("div", {
|
|
100
101
|
className: titleCls
|
|
101
102
|
}, (0, _isString2.default)(title) ? /*#__PURE__*/_react.default.createElement(_typography.default.Title, {
|
|
@@ -103,7 +104,8 @@ class Card extends _react.PureComponent {
|
|
|
103
104
|
ellipsis: {
|
|
104
105
|
showTooltip: true,
|
|
105
106
|
rows: 1
|
|
106
|
-
}
|
|
107
|
+
},
|
|
108
|
+
"x-semi-prop": "title"
|
|
107
109
|
}, title) : title)));
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -116,7 +118,8 @@ class Card extends _react.PureComponent {
|
|
|
116
118
|
} = this.props;
|
|
117
119
|
const coverCls = (0, _classnames.default)("".concat(prefixcls, "-cover"));
|
|
118
120
|
return cover && /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
-
className: coverCls
|
|
121
|
+
className: coverCls,
|
|
122
|
+
"x-semi-prop": "cover"
|
|
120
123
|
}, cover);
|
|
121
124
|
};
|
|
122
125
|
|
|
@@ -148,7 +151,8 @@ class Card extends _react.PureComponent {
|
|
|
148
151
|
spacing: 12
|
|
149
152
|
}, (0, _map.default)(actions).call(actions, (item, idx) => /*#__PURE__*/_react.default.createElement("div", {
|
|
150
153
|
key: idx,
|
|
151
|
-
className: actionsItemCls
|
|
154
|
+
className: actionsItemCls,
|
|
155
|
+
"x-semi-prop": "actions.".concat(idx)
|
|
152
156
|
}, item)))));
|
|
153
157
|
};
|
|
154
158
|
|
|
@@ -163,7 +167,8 @@ class Card extends _react.PureComponent {
|
|
|
163
167
|
});
|
|
164
168
|
return footer && /*#__PURE__*/_react.default.createElement("div", {
|
|
165
169
|
style: footerStyle,
|
|
166
|
-
className: footerCls
|
|
170
|
+
className: footerCls,
|
|
171
|
+
"x-semi-prop": "footer"
|
|
167
172
|
}, footer);
|
|
168
173
|
};
|
|
169
174
|
}
|
|
@@ -74,12 +74,16 @@ class CarouselArrow extends _react.default.PureComponent {
|
|
|
74
74
|
// role='button'
|
|
75
75
|
className: leftClassNames,
|
|
76
76
|
onClick: prev
|
|
77
|
-
}, (0, _get2.default)(this.props, 'arrowProps.leftArrow.props')
|
|
77
|
+
}, (0, _get2.default)(this.props, 'arrowProps.leftArrow.props'), {
|
|
78
|
+
"x-semi-prop": "arrowProps.leftArrow.children"
|
|
79
|
+
}), this.renderLeftIcon()), /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({
|
|
78
80
|
// role='button'
|
|
79
81
|
// tabIndex={0}
|
|
80
82
|
className: rightClassNames,
|
|
81
83
|
onClick: next
|
|
82
|
-
}, (0, _get2.default)(this.props, 'arrowProps.rightArrow.props')
|
|
84
|
+
}, (0, _get2.default)(this.props, 'arrowProps.rightArrow.props'), {
|
|
85
|
+
"x-semi-prop": "arrowProps.rightArrow.children"
|
|
86
|
+
}), this.renderRightIcon()));
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
}
|
|
@@ -296,7 +296,8 @@ class Carousel extends _baseComponent.default {
|
|
|
296
296
|
className: (0, _classnames.default)([(0, _concat.default)(_context2 = "".concat(_constants.cssClasses.CAROUSEL_CONTENT, "-")).call(_context2, animation)], {
|
|
297
297
|
["".concat(_constants.cssClasses.CAROUSEL_CONTENT)]: true,
|
|
298
298
|
["".concat(_constants.cssClasses.CAROUSEL_CONTENT, "-reverse")]: slideDirection === 'left' ? isReverse : !isReverse
|
|
299
|
-
})
|
|
299
|
+
}),
|
|
300
|
+
"x-semi-prop": "children"
|
|
300
301
|
}, this.renderChildren()), this.renderIndicator(), this.renderArrow());
|
|
301
302
|
}
|
|
302
303
|
|
|
@@ -342,7 +342,8 @@ class Cascader extends _baseComponent.default {
|
|
|
342
342
|
["".concat(prefixcls, "-suffix-icon")]: (0, _utils.isSemiIcon)(suffix)
|
|
343
343
|
});
|
|
344
344
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
345
|
-
className: suffixWrapperCls
|
|
345
|
+
className: suffixWrapperCls,
|
|
346
|
+
"x-semi-prop": "suffix"
|
|
346
347
|
}, suffix);
|
|
347
348
|
};
|
|
348
349
|
|
|
@@ -362,7 +363,8 @@ class Cascader extends _baseComponent.default {
|
|
|
362
363
|
});
|
|
363
364
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
364
365
|
className: prefixWrapperCls,
|
|
365
|
-
id: insetLabelId
|
|
366
|
+
id: insetLabelId,
|
|
367
|
+
"x-semi-prop": "prefix,insetLabel"
|
|
366
368
|
}, labelNode);
|
|
367
369
|
};
|
|
368
370
|
|
|
@@ -452,7 +454,7 @@ class Cascader extends _baseComponent.default {
|
|
|
452
454
|
className: clearCls,
|
|
453
455
|
onClick: this.handleClear,
|
|
454
456
|
onKeyPress: this.handleClearEnterPress,
|
|
455
|
-
role:
|
|
457
|
+
role: "button",
|
|
456
458
|
tabIndex: 0
|
|
457
459
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClear, null));
|
|
458
460
|
}
|
|
@@ -471,7 +473,8 @@ class Cascader extends _baseComponent.default {
|
|
|
471
473
|
}
|
|
472
474
|
|
|
473
475
|
return arrowIcon ? /*#__PURE__*/_react.default.createElement("div", {
|
|
474
|
-
className: (0, _classnames.default)("".concat(prefixcls, "-arrow"))
|
|
476
|
+
className: (0, _classnames.default)("".concat(prefixcls, "-arrow")),
|
|
477
|
+
"x-semi-prop": "arrowIcon"
|
|
475
478
|
}, arrowIcon) : null;
|
|
476
479
|
};
|
|
477
480
|
|
|
@@ -546,12 +549,12 @@ class Cascader extends _baseComponent.default {
|
|
|
546
549
|
"aria-errormessage": this.props['aria-errormessage'],
|
|
547
550
|
"aria-label": this.props['aria-label'],
|
|
548
551
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
549
|
-
"aria-describedby": this.props[
|
|
552
|
+
"aria-describedby": this.props['aria-describedby'],
|
|
550
553
|
"aria-required": this.props['aria-required'],
|
|
551
554
|
id: id
|
|
552
555
|
}, mouseEvent, {
|
|
553
556
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
554
|
-
role:
|
|
557
|
+
role: "combobox",
|
|
555
558
|
tabIndex: 0
|
|
556
559
|
}), inner);
|
|
557
560
|
};
|
package/lib/cjs/cascader/item.js
CHANGED
|
@@ -332,7 +332,8 @@ class Item extends _react.PureComponent {
|
|
|
332
332
|
className: (0, _concat.default)(_context6 = "".concat(prefixcls, " ")).call(_context6, prefixcls, "-empty"),
|
|
333
333
|
key: 'empty-list'
|
|
334
334
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
335
|
-
className: "".concat(prefixcls, "-label")
|
|
335
|
+
className: "".concat(prefixcls, "-label"),
|
|
336
|
+
"x-semi-prop": "emptyContent"
|
|
336
337
|
}, emptyContent || locale.emptyText));
|
|
337
338
|
});
|
|
338
339
|
}
|
|
@@ -181,13 +181,17 @@ class Checkbox extends _baseComponent.default {
|
|
|
181
181
|
const extraCls = (0, _classnames.default)("".concat(prefix, "-extra"), {
|
|
182
182
|
["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
|
|
183
183
|
});
|
|
184
|
+
const name = inGroup && this.context.checkboxGroup.name;
|
|
185
|
+
const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
|
|
184
186
|
|
|
185
187
|
const renderContent = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children ? /*#__PURE__*/_react.default.createElement("span", {
|
|
186
|
-
id: addonId,
|
|
187
|
-
className: "".concat(prefix, "-addon")
|
|
188
|
+
id: this.addonId,
|
|
189
|
+
className: "".concat(prefix, "-addon"),
|
|
190
|
+
"x-semi-prop": xSemiPropChildren
|
|
188
191
|
}, children) : null, extra ? /*#__PURE__*/_react.default.createElement("div", {
|
|
189
|
-
id: extraId,
|
|
190
|
-
className: extraCls
|
|
192
|
+
id: this.extraId,
|
|
193
|
+
className: extraCls,
|
|
194
|
+
"x-semi-prop": "extra"
|
|
191
195
|
}, extra) : null);
|
|
192
196
|
|
|
193
197
|
return (
|
|
@@ -26,7 +26,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
26
26
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
27
|
value: PropTypes.Requireable<any[]>;
|
|
28
28
|
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
-
type: PropTypes.Requireable<"
|
|
29
|
+
type: PropTypes.Requireable<"date" | "dateTime" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
30
30
|
showClear: PropTypes.Requireable<boolean>;
|
|
31
31
|
format: PropTypes.Requireable<string>;
|
|
32
32
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -179,7 +179,8 @@ class DateInput extends _baseComponent.default {
|
|
|
179
179
|
const labelNode = prefix || insetLabel;
|
|
180
180
|
return labelNode ? /*#__PURE__*/_react.default.createElement("div", {
|
|
181
181
|
className: "".concat(prefixCls, "-range-input-prefix"),
|
|
182
|
-
onClick: e => !disabled && !rangeInputFocus && this.handleRangeStartFocus(e)
|
|
182
|
+
onClick: e => !disabled && !rangeInputFocus && this.handleRangeStartFocus(e),
|
|
183
|
+
"x-semi-prop": "prefix,insetLabel"
|
|
183
184
|
}, labelNode) : null;
|
|
184
185
|
}
|
|
185
186
|
|
|
@@ -41,7 +41,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
41
41
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
42
42
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
43
43
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
44
|
-
type: PropTypes.Requireable<"
|
|
44
|
+
type: PropTypes.Requireable<"date" | "dateTime" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
45
45
|
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
46
46
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
47
47
|
defaultValue: PropTypes.Requireable<string | number | object>;
|