@douyinfe/semi-ui 2.13.0 → 2.14.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autoComplete/_story/CustomTrigger/index.jsx +1 -1
- package/avatar/_story/avatar.stories.js +62 -5
- package/avatar/avatarGroup.tsx +16 -4
- package/avatar/index.tsx +88 -17
- 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/calendar/_story/calendar.stories.js +125 -1
- package/card/index.tsx +43 -41
- package/carousel/CarouselArrow.tsx +2 -0
- package/carousel/index.tsx +1 -0
- package/cascader/_story/cascader.stories.js +21 -0
- package/cascader/index.tsx +99 -120
- 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 +51 -35
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +933 -530
- 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/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/_story/input.stories.js +32 -3
- package/input/index.tsx +45 -23
- package/input/inputGroup.tsx +3 -1
- package/input/textarea.tsx +2 -14
- package/lib/cjs/_base/base.css +14 -14
- package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
- package/lib/cjs/avatar/avatarGroup.js +36 -9
- package/lib/cjs/avatar/index.d.ts +5 -0
- package/lib/cjs/avatar/index.js +121 -41
- 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 +11 -6
- package/lib/cjs/cascader/item.js +2 -1
- package/lib/cjs/checkbox/checkbox.js +6 -2
- package/lib/cjs/collapsible/index.js +2 -1
- package/lib/cjs/datePicker/dateInput.js +2 -1
- package/lib/cjs/datePicker/datePicker.js +4 -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.d.ts +0 -1
- package/lib/cjs/input/index.js +41 -36
- package/lib/cjs/input/inputGroup.js +2 -3
- package/lib/cjs/input/textarea.js +8 -15
- 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/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 +4 -0
- package/lib/cjs/radio/radio.js +32 -9
- package/lib/cjs/radio/radioInner.d.ts +6 -0
- package/lib/cjs/radio/radioInner.js +13 -4
- package/lib/cjs/rating/item.js +2 -1
- package/lib/cjs/scrollList/index.js +6 -3
- package/lib/cjs/select/index.js +10 -4
- 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/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.js +6 -3
- package/lib/cjs/tabs/TabBar.js +2 -1
- package/lib/cjs/tabs/TabPane.js +5 -2
- package/lib/cjs/tagInput/index.js +25 -15
- package/lib/cjs/timePicker/Combobox.js +3 -1
- package/lib/cjs/timePicker/TimePicker.js +2 -0
- package/lib/cjs/toast/toast.js +6 -3
- package/lib/cjs/tooltip/index.js +6 -1
- package/lib/cjs/transfer/index.js +2 -1
- package/lib/cjs/tree/treeNode.js +2 -1
- package/lib/cjs/treeSelect/index.js +10 -3
- 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/_base/base.css +14 -14
- package/lib/es/avatar/avatarGroup.d.ts +1 -1
- package/lib/es/avatar/avatarGroup.js +37 -9
- package/lib/es/avatar/index.d.ts +5 -0
- package/lib/es/avatar/index.js +119 -38
- 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 +11 -6
- package/lib/es/cascader/item.js +2 -1
- package/lib/es/checkbox/checkbox.js +6 -2
- package/lib/es/collapsible/index.js +2 -1
- package/lib/es/datePicker/dateInput.js +2 -1
- package/lib/es/datePicker/datePicker.js +4 -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.d.ts +0 -1
- package/lib/es/input/index.js +41 -36
- package/lib/es/input/inputGroup.js +2 -3
- package/lib/es/input/textarea.js +8 -15
- 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/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 +4 -0
- package/lib/es/radio/radio.js +32 -9
- package/lib/es/radio/radioInner.d.ts +6 -0
- package/lib/es/radio/radioInner.js +13 -4
- package/lib/es/rating/item.js +2 -1
- package/lib/es/scrollList/index.js +6 -3
- package/lib/es/select/index.js +10 -4
- 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/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.js +6 -3
- package/lib/es/tabs/TabBar.js +2 -1
- package/lib/es/tabs/TabPane.js +5 -2
- package/lib/es/tagInput/index.js +25 -15
- package/lib/es/timePicker/Combobox.js +3 -1
- package/lib/es/timePicker/TimePicker.js +2 -0
- package/lib/es/toast/toast.js +6 -3
- package/lib/es/tooltip/index.js +6 -1
- package/lib/es/transfer/index.js +2 -1
- package/lib/es/tree/treeNode.js +2 -1
- package/lib/es/treeSelect/index.js +10 -3
- 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 +27 -14
- package/notification/notice.tsx +16 -4
- package/package.json +8 -8
- package/pagination/index.tsx +16 -2
- package/popconfirm/index.tsx +11 -3
- package/radio/_story/radio.stories.js +9 -6
- package/radio/radio.tsx +37 -7
- package/radio/radioInner.tsx +11 -2
- package/rating/item.tsx +1 -1
- package/scrollList/index.tsx +19 -3
- package/select/index.tsx +13 -4
- package/select/option.tsx +5 -1
- package/sideSheet/SideSheetContent.tsx +3 -3
- package/skeleton/index.tsx +1 -1
- 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/tabs/TabBar.tsx +1 -1
- package/tabs/TabPane.tsx +9 -4
- package/tagInput/index.tsx +23 -4
- package/timePicker/Combobox.tsx +6 -1
- package/timePicker/TimePicker.tsx +1 -0
- package/toast/toast.tsx +3 -3
- package/tooltip/index.tsx +4 -1
- package/transfer/index.tsx +1 -0
- package/tree/treeNode.tsx +1 -1
- package/treeSelect/_story/treeSelect.stories.js +161 -2
- package/treeSelect/index.tsx +17 -3
- package/typography/base.tsx +1 -1
- package/upload/index.tsx +107 -38
- package/yarn-error.log +26235 -0
package/card/index.tsx
CHANGED
|
@@ -55,7 +55,6 @@ export interface CardProps {
|
|
|
55
55
|
'aria-label'?: string;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
58
|
class Card extends PureComponent<CardProps> {
|
|
60
59
|
static Meta = Meta;
|
|
61
60
|
|
|
@@ -106,37 +105,33 @@ class Card extends PureComponent<CardProps> {
|
|
|
106
105
|
if (header || headerExtraContent || title) {
|
|
107
106
|
return (
|
|
108
107
|
<div style={headerStyle} className={headerCls}>
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
</div>
|
|
138
|
-
)
|
|
139
|
-
}
|
|
108
|
+
{header || ( // Priority of header over title and headerExtraContent
|
|
109
|
+
<div className={headerWrapperCls}>
|
|
110
|
+
{headerExtraContent && (
|
|
111
|
+
<div
|
|
112
|
+
className={`${prefixcls}-header-wrapper-extra`}
|
|
113
|
+
x-semi-prop="headerExtraContent"
|
|
114
|
+
>
|
|
115
|
+
{headerExtraContent}
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
{title && (
|
|
119
|
+
<div className={titleCls}>
|
|
120
|
+
{isString(title) ? (
|
|
121
|
+
<Typography.Title
|
|
122
|
+
heading={6}
|
|
123
|
+
ellipsis={{ showTooltip: true, rows: 1 }}
|
|
124
|
+
x-semi-prop="title"
|
|
125
|
+
>
|
|
126
|
+
{title}
|
|
127
|
+
</Typography.Title>
|
|
128
|
+
) : (
|
|
129
|
+
title
|
|
130
|
+
)}
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
140
135
|
</div>
|
|
141
136
|
);
|
|
142
137
|
}
|
|
@@ -149,16 +144,17 @@ class Card extends PureComponent<CardProps> {
|
|
|
149
144
|
} = this.props;
|
|
150
145
|
const coverCls = cls(`${prefixcls}-cover`);
|
|
151
146
|
|
|
152
|
-
return
|
|
147
|
+
return (
|
|
148
|
+
cover && (
|
|
149
|
+
<div className={coverCls} x-semi-prop="cover">
|
|
150
|
+
{cover}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
);
|
|
153
154
|
};
|
|
154
155
|
|
|
155
156
|
renderBody = (): ReactNode => {
|
|
156
|
-
const {
|
|
157
|
-
bodyStyle,
|
|
158
|
-
children,
|
|
159
|
-
actions,
|
|
160
|
-
loading
|
|
161
|
-
} = this.props;
|
|
157
|
+
const { bodyStyle, children, actions, loading } = this.props;
|
|
162
158
|
const bodyCls = cls(`${prefixcls}-body`);
|
|
163
159
|
const actionsCls = cls(`${prefixcls}-body-actions`);
|
|
164
160
|
const actionsItemCls = cls(`${prefixcls}-body-actions-item`);
|
|
@@ -182,7 +178,7 @@ class Card extends PureComponent<CardProps> {
|
|
|
182
178
|
<div className={actionsCls}>
|
|
183
179
|
<Space spacing={12}>
|
|
184
180
|
{actions.map((item, idx) => (
|
|
185
|
-
<div key={idx} className={actionsItemCls}>{item}</div>
|
|
181
|
+
<div key={idx} className={actionsItemCls} x-semi-prop={`actions.${idx}`}>{item}</div>
|
|
186
182
|
))}
|
|
187
183
|
</Space>
|
|
188
184
|
</div>
|
|
@@ -202,7 +198,13 @@ class Card extends PureComponent<CardProps> {
|
|
|
202
198
|
[`${prefixcls}-footer-bordered`]: footerLine
|
|
203
199
|
});
|
|
204
200
|
|
|
205
|
-
return
|
|
201
|
+
return (
|
|
202
|
+
footer && (
|
|
203
|
+
<div style={footerStyle} className={footerCls} x-semi-prop="footer">
|
|
204
|
+
{footer}
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
);
|
|
206
208
|
};
|
|
207
209
|
|
|
208
210
|
render(): ReactNode {
|
|
@@ -41,6 +41,7 @@ class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
|
41
41
|
className={leftClassNames}
|
|
42
42
|
onClick={prev}
|
|
43
43
|
{...get(this.props, 'arrowProps.leftArrow.props')}
|
|
44
|
+
x-semi-prop="arrowProps.leftArrow.children"
|
|
44
45
|
>
|
|
45
46
|
{this.renderLeftIcon()}
|
|
46
47
|
</div>
|
|
@@ -50,6 +51,7 @@ class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
|
50
51
|
className={rightClassNames}
|
|
51
52
|
onClick={next}
|
|
52
53
|
{...get(this.props, 'arrowProps.rightArrow.props')}
|
|
54
|
+
x-semi-prop="arrowProps.rightArrow.children"
|
|
53
55
|
>
|
|
54
56
|
{this.renderRightIcon()}
|
|
55
57
|
</div>
|
package/carousel/index.tsx
CHANGED
|
@@ -279,6 +279,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
|
279
279
|
[`${cssClasses.CAROUSEL_CONTENT}`]: true,
|
|
280
280
|
[`${cssClasses.CAROUSEL_CONTENT}-reverse`]: slideDirection === 'left' ? isReverse : !isReverse,
|
|
281
281
|
})}
|
|
282
|
+
x-semi-prop="children"
|
|
282
283
|
>
|
|
283
284
|
{this.renderChildren()}
|
|
284
285
|
</div>
|
|
@@ -1276,6 +1276,27 @@ export const OnChangeWithObject = () => (
|
|
|
1276
1276
|
</>
|
|
1277
1277
|
);
|
|
1278
1278
|
|
|
1279
|
+
export const undefinedValueWhileMutipleAndOnChangeWithObject = () => {
|
|
1280
|
+
const [value, setValue] = useState(undefined);
|
|
1281
|
+
|
|
1282
|
+
return (
|
|
1283
|
+
<>
|
|
1284
|
+
<div>多选 + onChangeWithObject + value 为 undefined</div>
|
|
1285
|
+
<Cascader
|
|
1286
|
+
multiple
|
|
1287
|
+
onChangeWithObject
|
|
1288
|
+
style={{ width: 300 }}
|
|
1289
|
+
treeData={treeData2}
|
|
1290
|
+
placeholder="请选择所在地区"
|
|
1291
|
+
value={value}
|
|
1292
|
+
onChange={(v)=>{
|
|
1293
|
+
setValue(v);
|
|
1294
|
+
}}
|
|
1295
|
+
/>
|
|
1296
|
+
</>
|
|
1297
|
+
)
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1279
1300
|
export const LeafOnly = () => {
|
|
1280
1301
|
const [value, setValue] = useState([])
|
|
1281
1302
|
return (
|
package/cascader/index.tsx
CHANGED
|
@@ -122,7 +122,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
122
122
|
PropTypes.shape({
|
|
123
123
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
124
124
|
label: PropTypes.any,
|
|
125
|
-
})
|
|
125
|
+
})
|
|
126
126
|
),
|
|
127
127
|
treeNodeFilterProp: PropTypes.string,
|
|
128
128
|
suffix: PropTypes.node,
|
|
@@ -199,7 +199,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
199
199
|
onDropdownVisibleChange: noop,
|
|
200
200
|
onListScroll: noop,
|
|
201
201
|
enableLeafClick: false,
|
|
202
|
-
'aria-label': 'Cascader'
|
|
202
|
+
'aria-label': 'Cascader',
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
options: any;
|
|
@@ -247,7 +247,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
247
247
|
/* Keys of loading item */
|
|
248
248
|
loadingKeys: new Set(),
|
|
249
249
|
/* Mark whether this rendering has triggered asynchronous loading of data */
|
|
250
|
-
loading: false
|
|
250
|
+
loading: false,
|
|
251
251
|
};
|
|
252
252
|
this.options = {};
|
|
253
253
|
this.isEmpty = false;
|
|
@@ -274,10 +274,9 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
274
274
|
}
|
|
275
275
|
},
|
|
276
276
|
};
|
|
277
|
-
const cascaderAdapter: Pick<
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
| 'rePositionDropdown'
|
|
277
|
+
const cascaderAdapter: Pick<
|
|
278
|
+
CascaderAdapter,
|
|
279
|
+
'registerClickOutsideHandler' | 'unregisterClickOutsideHandler' | 'rePositionDropdown'
|
|
281
280
|
> = {
|
|
282
281
|
registerClickOutsideHandler: cb => {
|
|
283
282
|
const clickOutsideHandler = (e: Event) => {
|
|
@@ -368,17 +367,10 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
368
367
|
}
|
|
369
368
|
|
|
370
369
|
static getDerivedStateFromProps(props: CascaderProps, prevState: CascaderState) {
|
|
371
|
-
const {
|
|
372
|
-
multiple,
|
|
373
|
-
value,
|
|
374
|
-
defaultValue,
|
|
375
|
-
onChangeWithObject,
|
|
376
|
-
leafOnly,
|
|
377
|
-
autoMergeValue,
|
|
378
|
-
} = props;
|
|
370
|
+
const { multiple, value, defaultValue, onChangeWithObject, leafOnly, autoMergeValue } = props;
|
|
379
371
|
const { prevProps } = prevState;
|
|
380
372
|
let keyEntities = prevState.keyEntities || {};
|
|
381
|
-
const newState: Partial<CascaderState> = {
|
|
373
|
+
const newState: Partial<CascaderState> = {};
|
|
382
374
|
const needUpdate = (name: string) => {
|
|
383
375
|
const firstInProps = isEmpty(prevProps) && name in props;
|
|
384
376
|
const nameHasChange = prevProps && !isEqual(prevProps[name], props[name]);
|
|
@@ -408,9 +400,9 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
408
400
|
const realValue = needUpdate('value') ? value : defaultValue;
|
|
409
401
|
// eslint-disable-next-line max-depth
|
|
410
402
|
if (Array.isArray(realValue)) {
|
|
411
|
-
normallizedValue = Array.isArray(realValue[0])
|
|
412
|
-
realValue as SimpleValueType[][]
|
|
413
|
-
[realValue] as SimpleValueType[][];
|
|
403
|
+
normallizedValue = Array.isArray(realValue[0])
|
|
404
|
+
? (realValue as SimpleValueType[][])
|
|
405
|
+
: ([realValue] as SimpleValueType[][]);
|
|
414
406
|
} else {
|
|
415
407
|
if (realValue !== undefined) {
|
|
416
408
|
normallizedValue = [[realValue]];
|
|
@@ -482,12 +474,9 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
482
474
|
renderTagItem = (value: string | Array<string>, idx: number, type: string) => {
|
|
483
475
|
const { keyEntities, disabledKeys } = this.state;
|
|
484
476
|
const { size, disabled, displayProp, displayRender, disableStrictly } = this.props;
|
|
485
|
-
const nodeKey = type === strings.IS_VALUE ?
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
const isDsiabled = disabled ||
|
|
489
|
-
keyEntities[nodeKey].data.disabled ||
|
|
490
|
-
(disableStrictly && disabledKeys.has(nodeKey));
|
|
477
|
+
const nodeKey = type === strings.IS_VALUE ? findKeysForValues(value, keyEntities)[0] : value;
|
|
478
|
+
const isDsiabled =
|
|
479
|
+
disabled || keyEntities[nodeKey].data.disabled || (disableStrictly && disabledKeys.has(nodeKey));
|
|
491
480
|
if (!isEmpty(keyEntities) && !isEmpty(keyEntities[nodeKey])) {
|
|
492
481
|
const tagCls = cls(`${prefixcls}-selection-tag`, {
|
|
493
482
|
[`${prefixcls}-selection-tag-disabled`]: isDsiabled,
|
|
@@ -495,7 +484,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
495
484
|
// custom render tags
|
|
496
485
|
if (isFunction(displayRender)) {
|
|
497
486
|
return displayRender(keyEntities[nodeKey], idx);
|
|
498
|
-
|
|
487
|
+
// default render tags
|
|
499
488
|
} else {
|
|
500
489
|
return (
|
|
501
490
|
<Tag
|
|
@@ -519,25 +508,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
519
508
|
};
|
|
520
509
|
|
|
521
510
|
renderTagInput() {
|
|
522
|
-
const {
|
|
523
|
-
|
|
524
|
-
disabled,
|
|
525
|
-
placeholder,
|
|
526
|
-
maxTagCount,
|
|
527
|
-
showRestTagsPopover,
|
|
528
|
-
restTagsPopoverProps,
|
|
529
|
-
} = this.props;
|
|
530
|
-
const {
|
|
531
|
-
inputValue,
|
|
532
|
-
checkedKeys,
|
|
533
|
-
keyEntities,
|
|
534
|
-
resolvedCheckedKeys
|
|
535
|
-
} = this.state;
|
|
511
|
+
const { size, disabled, placeholder, maxTagCount, showRestTagsPopover, restTagsPopoverProps } = this.props;
|
|
512
|
+
const { inputValue, checkedKeys, keyEntities, resolvedCheckedKeys } = this.state;
|
|
536
513
|
const tagInputcls = cls(`${prefixcls}-tagInput-wrapper`);
|
|
537
514
|
const tagValue: Array<Array<string>> = [];
|
|
538
|
-
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
539
|
-
? checkedKeys
|
|
540
|
-
: resolvedCheckedKeys;
|
|
515
|
+
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE ? checkedKeys : resolvedCheckedKeys;
|
|
541
516
|
[...realKeys].forEach(checkedKey => {
|
|
542
517
|
if (!isEmpty(keyEntities[checkedKey])) {
|
|
543
518
|
tagValue.push(keyEntities[checkedKey].valuePath);
|
|
@@ -550,7 +525,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
550
525
|
disabled={disabled}
|
|
551
526
|
size={size}
|
|
552
527
|
// TODO Modify logic, not modify type
|
|
553
|
-
value={tagValue as unknown as string[]}
|
|
528
|
+
value={(tagValue as unknown) as string[]}
|
|
554
529
|
showRestTagsPopover={showRestTagsPopover}
|
|
555
530
|
restTagsPopoverProps={restTagsPopoverProps}
|
|
556
531
|
maxTagCount={maxTagCount}
|
|
@@ -558,7 +533,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
558
533
|
inputValue={inputValue}
|
|
559
534
|
onInputChange={this.handleInputChange}
|
|
560
535
|
// TODO Modify logic, not modify type
|
|
561
|
-
onRemove={v => this.handleTagRemove(null, v as unknown as (string | number)[])}
|
|
536
|
+
onRemove={v => this.handleTagRemove(null, (v as unknown) as (string | number)[])}
|
|
562
537
|
placeholder={placeholder}
|
|
563
538
|
/>
|
|
564
539
|
);
|
|
@@ -580,11 +555,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
580
555
|
});
|
|
581
556
|
return (
|
|
582
557
|
<div className={wrappercls}>
|
|
583
|
-
<Input
|
|
584
|
-
ref={this.inputRef as any}
|
|
585
|
-
size={size}
|
|
586
|
-
{...inputProps}
|
|
587
|
-
/>
|
|
558
|
+
<Input ref={this.inputRef as any} size={size} {...inputProps} />
|
|
588
559
|
</div>
|
|
589
560
|
);
|
|
590
561
|
}
|
|
@@ -614,7 +585,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
614
585
|
checkedKeys,
|
|
615
586
|
halfCheckedKeys,
|
|
616
587
|
loadedKeys,
|
|
617
|
-
loadingKeys
|
|
588
|
+
loadingKeys,
|
|
618
589
|
} = this.state;
|
|
619
590
|
const {
|
|
620
591
|
filterTreeNode,
|
|
@@ -626,7 +597,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
626
597
|
topSlot,
|
|
627
598
|
bottomSlot,
|
|
628
599
|
showNext,
|
|
629
|
-
multiple
|
|
600
|
+
multiple,
|
|
630
601
|
} = this.props;
|
|
631
602
|
const searchable = Boolean(filterTreeNode) && isSearching;
|
|
632
603
|
const popoverCls = cls(dropdownClassName, `${prefixcls}-popover`);
|
|
@@ -663,37 +634,29 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
663
634
|
renderPlusN = (hiddenTag: Array<ReactNode>) => {
|
|
664
635
|
const { disabled, showRestTagsPopover, restTagsPopoverProps } = this.props;
|
|
665
636
|
const plusNCls = cls(`${prefixcls}-selection-n`, {
|
|
666
|
-
[`${prefixcls}-selection-n-disabled`]: disabled
|
|
637
|
+
[`${prefixcls}-selection-n-disabled`]: disabled,
|
|
667
638
|
});
|
|
668
|
-
const renderPlusNChildren =
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
{...restTagsPopoverProps}
|
|
683
|
-
>
|
|
684
|
-
{renderPlusNChildren}
|
|
685
|
-
</Popover>
|
|
686
|
-
) :
|
|
687
|
-
renderPlusNChildren
|
|
639
|
+
const renderPlusNChildren = <span className={plusNCls}>+{hiddenTag.length}</span>;
|
|
640
|
+
return showRestTagsPopover && !disabled ? (
|
|
641
|
+
<Popover
|
|
642
|
+
content={hiddenTag}
|
|
643
|
+
showArrow
|
|
644
|
+
trigger="hover"
|
|
645
|
+
position="top"
|
|
646
|
+
autoAdjustOverflow
|
|
647
|
+
{...restTagsPopoverProps}
|
|
648
|
+
>
|
|
649
|
+
{renderPlusNChildren}
|
|
650
|
+
</Popover>
|
|
651
|
+
) : (
|
|
652
|
+
renderPlusNChildren
|
|
688
653
|
);
|
|
689
654
|
};
|
|
690
655
|
|
|
691
656
|
renderMultipleTags = () => {
|
|
692
657
|
const { autoMergeValue, maxTagCount } = this.props;
|
|
693
658
|
const { checkedKeys, resolvedCheckedKeys } = this.state;
|
|
694
|
-
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
695
|
-
? checkedKeys
|
|
696
|
-
: resolvedCheckedKeys;
|
|
659
|
+
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE ? checkedKeys : resolvedCheckedKeys;
|
|
697
660
|
const displayTag: Array<ReactNode> = [];
|
|
698
661
|
const hiddenTag: Array<ReactNode> = [];
|
|
699
662
|
[...realKeys].forEach((checkedKey, idx) => {
|
|
@@ -722,19 +685,22 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
722
685
|
if (displayRender && typeof displayRender === 'function') {
|
|
723
686
|
displayText = displayRender(displayPath);
|
|
724
687
|
} else {
|
|
725
|
-
displayText = displayPath.map((path: ReactNode, index: number)=>(
|
|
688
|
+
displayText = displayPath.map((path: ReactNode, index: number) => (
|
|
726
689
|
<Fragment key={`${path}-${index}`}>
|
|
727
|
-
{
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
690
|
+
{index < displayPath.length - 1 ? (
|
|
691
|
+
<>
|
|
692
|
+
{path}
|
|
693
|
+
{separator}
|
|
694
|
+
</>
|
|
695
|
+
) : (
|
|
696
|
+
path
|
|
697
|
+
)}
|
|
732
698
|
</Fragment>
|
|
733
699
|
));
|
|
734
700
|
}
|
|
735
701
|
}
|
|
736
702
|
return displayText;
|
|
737
|
-
}
|
|
703
|
+
};
|
|
738
704
|
|
|
739
705
|
renderSelectContent = () => {
|
|
740
706
|
const { placeholder, filterTreeNode, multiple } = this.props;
|
|
@@ -765,7 +731,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
765
731
|
[`${prefixcls}-suffix-text`]: suffix && isString(suffix),
|
|
766
732
|
[`${prefixcls}-suffix-icon`]: isSemiIcon(suffix),
|
|
767
733
|
});
|
|
768
|
-
return
|
|
734
|
+
return (
|
|
735
|
+
<div className={suffixWrapperCls} x-semi-prop="suffix">
|
|
736
|
+
{suffix}
|
|
737
|
+
</div>
|
|
738
|
+
);
|
|
769
739
|
};
|
|
770
740
|
|
|
771
741
|
renderPrefix = () => {
|
|
@@ -780,7 +750,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
780
750
|
[`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
781
751
|
});
|
|
782
752
|
|
|
783
|
-
return
|
|
753
|
+
return (
|
|
754
|
+
<div className={prefixWrapperCls} id={insetLabelId} x-semi-prop="prefix,insetLabel">
|
|
755
|
+
{labelNode}
|
|
756
|
+
</div>
|
|
757
|
+
);
|
|
784
758
|
};
|
|
785
759
|
|
|
786
760
|
renderCustomTrigger = () => {
|
|
@@ -827,6 +801,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
827
801
|
/**
|
|
828
802
|
* A11y: simulate clear button click
|
|
829
803
|
*/
|
|
804
|
+
/* istanbul ignore next */
|
|
830
805
|
handleClearEnterPress = (e: KeyboardEvent) => {
|
|
831
806
|
e && e.stopPropagation();
|
|
832
807
|
this.foundation.handleClearEnterPress(e);
|
|
@@ -849,7 +824,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
849
824
|
className={clearCls}
|
|
850
825
|
onClick={this.handleClear}
|
|
851
826
|
onKeyPress={this.handleClearEnterPress}
|
|
852
|
-
role=
|
|
827
|
+
role="button"
|
|
853
828
|
tabIndex={0}
|
|
854
829
|
>
|
|
855
830
|
<IconClear />
|
|
@@ -865,7 +840,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
865
840
|
if (showClearBtn) {
|
|
866
841
|
return null;
|
|
867
842
|
}
|
|
868
|
-
return arrowIcon ?
|
|
843
|
+
return arrowIcon ? (
|
|
844
|
+
<div className={cls(`${prefixcls}-arrow`)} x-semi-prop="arrowIcon">
|
|
845
|
+
{arrowIcon}
|
|
846
|
+
</div>
|
|
847
|
+
) : null;
|
|
869
848
|
};
|
|
870
849
|
|
|
871
850
|
renderSelection = () => {
|
|
@@ -887,40 +866,40 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
887
866
|
const { isOpen, isFocus, isInput, checkedKeys } = this.state;
|
|
888
867
|
const filterable = Boolean(filterTreeNode);
|
|
889
868
|
const useCustomTrigger = typeof triggerRender === 'function';
|
|
890
|
-
const classNames = useCustomTrigger
|
|
891
|
-
cls(className)
|
|
892
|
-
cls(prefixcls, className, {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const mouseEvent = showClear
|
|
905
|
-
{
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
{};
|
|
869
|
+
const classNames = useCustomTrigger
|
|
870
|
+
? cls(className)
|
|
871
|
+
: cls(prefixcls, className, {
|
|
872
|
+
[`${prefixcls}-focus`]: isFocus || (isOpen && !isInput),
|
|
873
|
+
[`${prefixcls}-disabled`]: disabled,
|
|
874
|
+
[`${prefixcls}-single`]: true,
|
|
875
|
+
[`${prefixcls}-filterable`]: filterable,
|
|
876
|
+
[`${prefixcls}-error`]: validateStatus === 'error',
|
|
877
|
+
[`${prefixcls}-warning`]: validateStatus === 'warning',
|
|
878
|
+
[`${prefixcls}-small`]: size === 'small',
|
|
879
|
+
[`${prefixcls}-large`]: size === 'large',
|
|
880
|
+
[`${prefixcls}-with-prefix`]: prefix || insetLabel,
|
|
881
|
+
[`${prefixcls}-with-suffix`]: suffix,
|
|
882
|
+
});
|
|
883
|
+
const mouseEvent = showClear
|
|
884
|
+
? {
|
|
885
|
+
onMouseEnter: () => this.handleMouseOver(),
|
|
886
|
+
onMouseLeave: () => this.handleMouseLeave(),
|
|
887
|
+
}
|
|
888
|
+
: {};
|
|
910
889
|
const sectionCls = cls(`${prefixcls}-selection`, {
|
|
911
890
|
[`${prefixcls}-selection-multiple`]: multiple && !isEmpty(checkedKeys),
|
|
912
891
|
});
|
|
913
|
-
const inner = useCustomTrigger
|
|
914
|
-
this.renderCustomTrigger()
|
|
915
|
-
[
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
892
|
+
const inner = useCustomTrigger
|
|
893
|
+
? this.renderCustomTrigger()
|
|
894
|
+
: [
|
|
895
|
+
<Fragment key={'prefix'}>{prefix || insetLabel ? this.renderPrefix() : null}</Fragment>,
|
|
896
|
+
<Fragment key={'selection'}>
|
|
897
|
+
<div className={sectionCls}>{this.renderSelectContent()}</div>
|
|
898
|
+
</Fragment>,
|
|
899
|
+
<Fragment key={'clearbtn'}>{this.renderClearBtn()}</Fragment>,
|
|
900
|
+
<Fragment key={'suffix'}>{suffix ? this.renderSuffix() : null}</Fragment>,
|
|
901
|
+
<Fragment key={'arrow'}>{this.renderArrow()}</Fragment>,
|
|
902
|
+
];
|
|
924
903
|
/**
|
|
925
904
|
* Reasons for disabling the a11y eslint rule:
|
|
926
905
|
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
@@ -936,12 +915,12 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
936
915
|
aria-errormessage={this.props['aria-errormessage']}
|
|
937
916
|
aria-label={this.props['aria-label']}
|
|
938
917
|
aria-labelledby={this.props['aria-labelledby']}
|
|
939
|
-
aria-describedby={this.props[
|
|
918
|
+
aria-describedby={this.props['aria-describedby']}
|
|
940
919
|
aria-required={this.props['aria-required']}
|
|
941
920
|
id={id}
|
|
942
921
|
{...mouseEvent}
|
|
943
922
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
944
|
-
role=
|
|
923
|
+
role="combobox"
|
|
945
924
|
tabIndex={0}
|
|
946
925
|
>
|
|
947
926
|
{inner}
|
package/cascader/item.tsx
CHANGED
|
@@ -291,7 +291,7 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
291
291
|
<LocaleConsumer componentName="Cascader">
|
|
292
292
|
{(locale: Locale['Cascader']) => (
|
|
293
293
|
<ul className={`${prefixcls} ${prefixcls}-empty`} key={'empty-list'}>
|
|
294
|
-
<span className={`${prefixcls}-label`}>
|
|
294
|
+
<span className={`${prefixcls}-label`} x-semi-prop="emptyContent">
|
|
295
295
|
{emptyContent || locale.emptyText}
|
|
296
296
|
</span>
|
|
297
297
|
</ul>
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -220,10 +220,21 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
220
220
|
[`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
|
|
221
221
|
});
|
|
222
222
|
|
|
223
|
+
const name = inGroup && this.context.checkboxGroup.name;
|
|
224
|
+
const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
|
|
225
|
+
|
|
223
226
|
const renderContent = () => (
|
|
224
227
|
<>
|
|
225
|
-
{children ?
|
|
226
|
-
|
|
228
|
+
{children ? (
|
|
229
|
+
<span id={addonId} className={`${prefix}-addon`} x-semi-prop={xSemiPropChildren}>
|
|
230
|
+
{children}
|
|
231
|
+
</span>
|
|
232
|
+
) : null}
|
|
233
|
+
{extra ? (
|
|
234
|
+
<div id={extraId} className={extraCls} x-semi-prop="extra">
|
|
235
|
+
{extra}
|
|
236
|
+
</div>
|
|
237
|
+
) : null}
|
|
227
238
|
</>
|
|
228
239
|
);
|
|
229
240
|
return (
|
package/collapsible/index.tsx
CHANGED
|
@@ -92,7 +92,14 @@ const Collapsible = (props: CollapsibleProps) => {
|
|
|
92
92
|
const wrapperCls = cls(`${cssClasses.PREFIX}-wrapper`, className);
|
|
93
93
|
return (
|
|
94
94
|
<div style={wrapperstyle} className={wrapperCls} ref={ref}>
|
|
95
|
-
<div
|
|
95
|
+
<div
|
|
96
|
+
ref={setHeight}
|
|
97
|
+
style={{ overflow: 'hidden' }}
|
|
98
|
+
id={id}
|
|
99
|
+
x-semi-prop="children"
|
|
100
|
+
>
|
|
101
|
+
{children}
|
|
102
|
+
</div>
|
|
96
103
|
</div>
|
|
97
104
|
);
|
|
98
105
|
};
|
package/datePicker/dateInput.tsx
CHANGED
|
@@ -172,6 +172,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
172
172
|
<div
|
|
173
173
|
className={`${prefixCls}-range-input-prefix`}
|
|
174
174
|
onClick={e => !disabled && !rangeInputFocus && this.handleRangeStartFocus(e)}
|
|
175
|
+
x-semi-prop="prefix,insetLabel"
|
|
175
176
|
>
|
|
176
177
|
{labelNode}
|
|
177
178
|
</div>
|
|
@@ -653,13 +653,21 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
653
653
|
|
|
654
654
|
return (
|
|
655
655
|
<div ref={this.panelRef} className={wrapCls} style={dropdownStyle}>
|
|
656
|
-
{topSlot &&
|
|
656
|
+
{topSlot && (
|
|
657
|
+
<div className={`${cssClasses.PREFIX}-topSlot`} x-semi-prop="topSlot">
|
|
658
|
+
{topSlot}
|
|
659
|
+
</div>
|
|
660
|
+
)}
|
|
657
661
|
{insetInput && <DateInput {...insetInputProps} insetInput={true} />}
|
|
658
|
-
{this.adapter.typeIsYearOrMonth()
|
|
659
|
-
this.renderYearMonthPanel(locale, localeCode)
|
|
660
|
-
this.renderMonthGrid(locale, localeCode, dateFnsLocale)}
|
|
662
|
+
{this.adapter.typeIsYearOrMonth()
|
|
663
|
+
? this.renderYearMonthPanel(locale, localeCode)
|
|
664
|
+
: this.renderMonthGrid(locale, localeCode, dateFnsLocale)}
|
|
661
665
|
{this.renderQuickControls()}
|
|
662
|
-
{bottomSlot &&
|
|
666
|
+
{bottomSlot && (
|
|
667
|
+
<div className={`${cssClasses.PREFIX}-bottomSlot`} x-semi-prop="bottomSlot">
|
|
668
|
+
{bottomSlot}
|
|
669
|
+
</div>
|
|
670
|
+
)}
|
|
663
671
|
{this.renderFooter(locale, localeCode)}
|
|
664
672
|
</div>
|
|
665
673
|
);
|