@douyinfe/semi-ui 2.12.0-alpha.0 → 2.12.0-beta.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/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 +9 -11
- package/card/index.tsx +41 -43
- package/carousel/CarouselArrow.tsx +0 -2
- package/carousel/index.tsx +0 -1
- package/cascader/index.tsx +123 -101
- package/cascader/item.tsx +1 -1
- package/checkbox/checkbox.tsx +2 -13
- package/collapsible/index.tsx +1 -8
- package/datePicker/dateInput.tsx +0 -1
- package/datePicker/datePicker.tsx +5 -13
- package/dist/umd/semi-ui.js +2491 -789
- 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/iconButton/index.tsx +1 -2
- package/input/index.tsx +11 -38
- 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.d.ts +1 -1
- 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/index.js +1 -2
- package/lib/cjs/cascader/index.js +6 -9
- package/lib/cjs/cascader/item.js +1 -2
- package/lib/cjs/checkbox/checkbox.js +4 -8
- 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 +2 -2
- 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/list/index.js +3 -6
- package/lib/cjs/modal/ConfirmModal.js +1 -2
- package/lib/cjs/modal/Modal.js +5 -8
- package/lib/cjs/modal/ModalContent.d.ts +2 -0
- package/lib/cjs/modal/ModalContent.js +23 -22
- 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/progress/index.js +1 -1
- 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.d.ts +1 -1
- 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.js +2 -4
- package/lib/cjs/timePicker/Combobox.js +1 -3
- 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 +1 -1
- package/lib/cjs/upload/index.js +6 -13
- 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.d.ts +1 -1
- 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/index.js +1 -2
- package/lib/es/cascader/index.js +6 -9
- package/lib/es/cascader/item.js +1 -2
- package/lib/es/checkbox/checkbox.js +4 -8
- 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 +2 -2
- 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/list/index.js +3 -6
- package/lib/es/modal/ConfirmModal.js +1 -2
- package/lib/es/modal/Modal.js +5 -8
- package/lib/es/modal/ModalContent.d.ts +2 -0
- package/lib/es/modal/ModalContent.js +22 -22
- 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/progress/index.js +1 -1
- 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.d.ts +1 -1
- 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.js +2 -4
- package/lib/es/timePicker/Combobox.js +1 -3
- 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 +1 -1
- package/lib/es/upload/index.js +6 -13
- package/list/index.tsx +4 -16
- package/modal/ConfirmModal.tsx +1 -1
- package/modal/Modal.tsx +2 -3
- package/modal/ModalContent.tsx +34 -40
- package/notification/notice.tsx +4 -16
- package/package.json +9 -9
- package/pagination/index.tsx +2 -16
- package/popconfirm/index.tsx +3 -11
- package/progress/index.tsx +1 -1
- package/radio/radio.tsx +2 -10
- package/rating/item.tsx +1 -1
- package/scrollList/index.tsx +3 -19
- 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/tabs/TabBar.tsx +1 -1
- package/tabs/TabPane.tsx +4 -9
- package/tagInput/index.tsx +2 -2
- 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/index.tsx +38 -107
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,9 +274,10 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
274
274
|
}
|
|
275
275
|
},
|
|
276
276
|
};
|
|
277
|
-
const cascaderAdapter: Pick<
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
const cascaderAdapter: Pick<CascaderAdapter,
|
|
278
|
+
'registerClickOutsideHandler'
|
|
279
|
+
| 'unregisterClickOutsideHandler'
|
|
280
|
+
| 'rePositionDropdown'
|
|
280
281
|
> = {
|
|
281
282
|
registerClickOutsideHandler: cb => {
|
|
282
283
|
const clickOutsideHandler = (e: Event) => {
|
|
@@ -367,10 +368,17 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
static getDerivedStateFromProps(props: CascaderProps, prevState: CascaderState) {
|
|
370
|
-
const {
|
|
371
|
+
const {
|
|
372
|
+
multiple,
|
|
373
|
+
value,
|
|
374
|
+
defaultValue,
|
|
375
|
+
onChangeWithObject,
|
|
376
|
+
leafOnly,
|
|
377
|
+
autoMergeValue,
|
|
378
|
+
} = props;
|
|
371
379
|
const { prevProps } = prevState;
|
|
372
380
|
let keyEntities = prevState.keyEntities || {};
|
|
373
|
-
const newState: Partial<CascaderState> = {};
|
|
381
|
+
const newState: Partial<CascaderState> = { };
|
|
374
382
|
const needUpdate = (name: string) => {
|
|
375
383
|
const firstInProps = isEmpty(prevProps) && name in props;
|
|
376
384
|
const nameHasChange = prevProps && !isEqual(prevProps[name], props[name]);
|
|
@@ -400,18 +408,18 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
400
408
|
const realValue = needUpdate('value') ? value : defaultValue;
|
|
401
409
|
// eslint-disable-next-line max-depth
|
|
402
410
|
if (Array.isArray(realValue)) {
|
|
403
|
-
normallizedValue = Array.isArray(realValue[0])
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
normallizedValue = Array.isArray(realValue[0]) ?
|
|
412
|
+
realValue as SimpleValueType[][] :
|
|
413
|
+
[realValue] as SimpleValueType[][];
|
|
406
414
|
} else {
|
|
407
415
|
normallizedValue = [[realValue]];
|
|
408
416
|
}
|
|
409
417
|
// formatValuePath is used to save value of valuePath
|
|
410
418
|
const formatValuePath: (string | number)[][] = [];
|
|
411
419
|
normallizedValue.forEach((valueItem: SimpleValueType[]) => {
|
|
412
|
-
const formatItem: (string | number)[] = onChangeWithObject
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
const formatItem: (string | number)[] = onChangeWithObject ?
|
|
421
|
+
(valueItem as CascaderData[]).map(i => i.value) :
|
|
422
|
+
valueItem as (string | number)[];
|
|
415
423
|
formatValuePath.push(formatItem);
|
|
416
424
|
});
|
|
417
425
|
// formatKeys is used to save key of value
|
|
@@ -472,9 +480,12 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
472
480
|
renderTagItem = (value: string | Array<string>, idx: number, type: string) => {
|
|
473
481
|
const { keyEntities, disabledKeys } = this.state;
|
|
474
482
|
const { size, disabled, displayProp, displayRender, disableStrictly } = this.props;
|
|
475
|
-
const nodeKey = type === strings.IS_VALUE ?
|
|
476
|
-
|
|
477
|
-
|
|
483
|
+
const nodeKey = type === strings.IS_VALUE ?
|
|
484
|
+
findKeysForValues(value, keyEntities)[0] :
|
|
485
|
+
value;
|
|
486
|
+
const isDsiabled = disabled ||
|
|
487
|
+
keyEntities[nodeKey].data.disabled ||
|
|
488
|
+
(disableStrictly && disabledKeys.has(nodeKey));
|
|
478
489
|
if (!isEmpty(keyEntities) && !isEmpty(keyEntities[nodeKey])) {
|
|
479
490
|
const tagCls = cls(`${prefixcls}-selection-tag`, {
|
|
480
491
|
[`${prefixcls}-selection-tag-disabled`]: isDsiabled,
|
|
@@ -482,7 +493,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
482
493
|
// custom render tags
|
|
483
494
|
if (isFunction(displayRender)) {
|
|
484
495
|
return displayRender(keyEntities[nodeKey], idx);
|
|
485
|
-
|
|
496
|
+
// default render tags
|
|
486
497
|
} else {
|
|
487
498
|
return (
|
|
488
499
|
<Tag
|
|
@@ -506,11 +517,25 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
506
517
|
};
|
|
507
518
|
|
|
508
519
|
renderTagInput() {
|
|
509
|
-
const {
|
|
510
|
-
|
|
520
|
+
const {
|
|
521
|
+
size,
|
|
522
|
+
disabled,
|
|
523
|
+
placeholder,
|
|
524
|
+
maxTagCount,
|
|
525
|
+
showRestTagsPopover,
|
|
526
|
+
restTagsPopoverProps,
|
|
527
|
+
} = this.props;
|
|
528
|
+
const {
|
|
529
|
+
inputValue,
|
|
530
|
+
checkedKeys,
|
|
531
|
+
keyEntities,
|
|
532
|
+
resolvedCheckedKeys
|
|
533
|
+
} = this.state;
|
|
511
534
|
const tagInputcls = cls(`${prefixcls}-tagInput-wrapper`);
|
|
512
535
|
const tagValue: Array<Array<string>> = [];
|
|
513
|
-
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
536
|
+
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
537
|
+
? checkedKeys
|
|
538
|
+
: resolvedCheckedKeys;
|
|
514
539
|
[...realKeys].forEach(checkedKey => {
|
|
515
540
|
if (!isEmpty(keyEntities[checkedKey])) {
|
|
516
541
|
tagValue.push(keyEntities[checkedKey].valuePath);
|
|
@@ -523,7 +548,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
523
548
|
disabled={disabled}
|
|
524
549
|
size={size}
|
|
525
550
|
// TODO Modify logic, not modify type
|
|
526
|
-
value={
|
|
551
|
+
value={tagValue as unknown as string[]}
|
|
527
552
|
showRestTagsPopover={showRestTagsPopover}
|
|
528
553
|
restTagsPopoverProps={restTagsPopoverProps}
|
|
529
554
|
maxTagCount={maxTagCount}
|
|
@@ -531,7 +556,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
531
556
|
inputValue={inputValue}
|
|
532
557
|
onInputChange={this.handleInputChange}
|
|
533
558
|
// TODO Modify logic, not modify type
|
|
534
|
-
onRemove={v => this.handleTagRemove(null,
|
|
559
|
+
onRemove={v => this.handleTagRemove(null, v as unknown as (string | number)[])}
|
|
535
560
|
placeholder={placeholder}
|
|
536
561
|
/>
|
|
537
562
|
);
|
|
@@ -553,7 +578,11 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
553
578
|
});
|
|
554
579
|
return (
|
|
555
580
|
<div className={wrappercls}>
|
|
556
|
-
<Input
|
|
581
|
+
<Input
|
|
582
|
+
ref={this.inputRef as any}
|
|
583
|
+
size={size}
|
|
584
|
+
{...inputProps}
|
|
585
|
+
/>
|
|
557
586
|
</div>
|
|
558
587
|
);
|
|
559
588
|
}
|
|
@@ -583,7 +612,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
583
612
|
checkedKeys,
|
|
584
613
|
halfCheckedKeys,
|
|
585
614
|
loadedKeys,
|
|
586
|
-
loadingKeys
|
|
615
|
+
loadingKeys
|
|
587
616
|
} = this.state;
|
|
588
617
|
const {
|
|
589
618
|
filterTreeNode,
|
|
@@ -595,7 +624,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
595
624
|
topSlot,
|
|
596
625
|
bottomSlot,
|
|
597
626
|
showNext,
|
|
598
|
-
multiple
|
|
627
|
+
multiple
|
|
599
628
|
} = this.props;
|
|
600
629
|
const searchable = Boolean(filterTreeNode) && isSearching;
|
|
601
630
|
const popoverCls = cls(dropdownClassName, `${prefixcls}-popover`);
|
|
@@ -632,29 +661,37 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
632
661
|
renderPlusN = (hiddenTag: Array<ReactNode>) => {
|
|
633
662
|
const { disabled, showRestTagsPopover, restTagsPopoverProps } = this.props;
|
|
634
663
|
const plusNCls = cls(`${prefixcls}-selection-n`, {
|
|
635
|
-
[`${prefixcls}-selection-n-disabled`]: disabled
|
|
664
|
+
[`${prefixcls}-selection-n-disabled`]: disabled
|
|
636
665
|
});
|
|
637
|
-
const renderPlusNChildren =
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
666
|
+
const renderPlusNChildren = (
|
|
667
|
+
<span className={plusNCls}>
|
|
668
|
+
+{hiddenTag.length}
|
|
669
|
+
</span>
|
|
670
|
+
);
|
|
671
|
+
return (
|
|
672
|
+
showRestTagsPopover && !disabled ?
|
|
673
|
+
(
|
|
674
|
+
<Popover
|
|
675
|
+
content={hiddenTag}
|
|
676
|
+
showArrow
|
|
677
|
+
trigger="hover"
|
|
678
|
+
position="top"
|
|
679
|
+
autoAdjustOverflow
|
|
680
|
+
{...restTagsPopoverProps}
|
|
681
|
+
>
|
|
682
|
+
{renderPlusNChildren}
|
|
683
|
+
</Popover>
|
|
684
|
+
) :
|
|
685
|
+
renderPlusNChildren
|
|
651
686
|
);
|
|
652
687
|
};
|
|
653
688
|
|
|
654
689
|
renderMultipleTags = () => {
|
|
655
690
|
const { autoMergeValue, maxTagCount } = this.props;
|
|
656
691
|
const { checkedKeys, resolvedCheckedKeys } = this.state;
|
|
657
|
-
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
692
|
+
const realKeys = this.mergeType === strings.NONE_MERGE_TYPE
|
|
693
|
+
? checkedKeys
|
|
694
|
+
: resolvedCheckedKeys;
|
|
658
695
|
const displayTag: Array<ReactNode> = [];
|
|
659
696
|
const hiddenTag: Array<ReactNode> = [];
|
|
660
697
|
[...realKeys].forEach((checkedKey, idx) => {
|
|
@@ -683,22 +720,19 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
683
720
|
if (displayRender && typeof displayRender === 'function') {
|
|
684
721
|
displayText = displayRender(displayPath);
|
|
685
722
|
} else {
|
|
686
|
-
displayText = displayPath.map((path: ReactNode, index: number)
|
|
723
|
+
displayText = displayPath.map((path: ReactNode, index: number)=>(
|
|
687
724
|
<Fragment key={`${path}-${index}`}>
|
|
688
|
-
{
|
|
689
|
-
|
|
690
|
-
{path}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
) : (
|
|
694
|
-
path
|
|
695
|
-
)}
|
|
725
|
+
{
|
|
726
|
+
index<displayPath.length-1
|
|
727
|
+
? <>{path}{separator}</>
|
|
728
|
+
: path
|
|
729
|
+
}
|
|
696
730
|
</Fragment>
|
|
697
731
|
));
|
|
698
732
|
}
|
|
699
733
|
}
|
|
700
734
|
return displayText;
|
|
701
|
-
}
|
|
735
|
+
}
|
|
702
736
|
|
|
703
737
|
renderSelectContent = () => {
|
|
704
738
|
const { placeholder, filterTreeNode, multiple } = this.props;
|
|
@@ -729,11 +763,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
729
763
|
[`${prefixcls}-suffix-text`]: suffix && isString(suffix),
|
|
730
764
|
[`${prefixcls}-suffix-icon`]: isSemiIcon(suffix),
|
|
731
765
|
});
|
|
732
|
-
return
|
|
733
|
-
<div className={suffixWrapperCls} x-semi-prop="suffix">
|
|
734
|
-
{suffix}
|
|
735
|
-
</div>
|
|
736
|
-
);
|
|
766
|
+
return <div className={suffixWrapperCls}>{suffix}</div>;
|
|
737
767
|
};
|
|
738
768
|
|
|
739
769
|
renderPrefix = () => {
|
|
@@ -748,11 +778,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
748
778
|
[`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
749
779
|
});
|
|
750
780
|
|
|
751
|
-
return
|
|
752
|
-
<div className={prefixWrapperCls} id={insetLabelId} x-semi-prop="prefix,insetLabel">
|
|
753
|
-
{labelNode}
|
|
754
|
-
</div>
|
|
755
|
-
);
|
|
781
|
+
return <div className={prefixWrapperCls} id={insetLabelId}>{labelNode}</div>;
|
|
756
782
|
};
|
|
757
783
|
|
|
758
784
|
renderCustomTrigger = () => {
|
|
@@ -821,7 +847,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
821
847
|
className={clearCls}
|
|
822
848
|
onClick={this.handleClear}
|
|
823
849
|
onKeyPress={this.handleClearEnterPress}
|
|
824
|
-
role=
|
|
850
|
+
role='button'
|
|
825
851
|
tabIndex={0}
|
|
826
852
|
>
|
|
827
853
|
<IconClear />
|
|
@@ -837,11 +863,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
837
863
|
if (showClearBtn) {
|
|
838
864
|
return null;
|
|
839
865
|
}
|
|
840
|
-
return arrowIcon ? (
|
|
841
|
-
<div className={cls(`${prefixcls}-arrow`)} x-semi-prop="arrowIcon">
|
|
842
|
-
{arrowIcon}
|
|
843
|
-
</div>
|
|
844
|
-
) : null;
|
|
866
|
+
return arrowIcon ? <div className={cls(`${prefixcls}-arrow`)}>{arrowIcon}</div> : null;
|
|
845
867
|
};
|
|
846
868
|
|
|
847
869
|
renderSelection = () => {
|
|
@@ -863,40 +885,40 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
863
885
|
const { isOpen, isFocus, isInput, checkedKeys } = this.state;
|
|
864
886
|
const filterable = Boolean(filterTreeNode);
|
|
865
887
|
const useCustomTrigger = typeof triggerRender === 'function';
|
|
866
|
-
const classNames = useCustomTrigger
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
const mouseEvent = showClear
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
888
|
+
const classNames = useCustomTrigger ?
|
|
889
|
+
cls(className) :
|
|
890
|
+
cls(prefixcls, className, {
|
|
891
|
+
[`${prefixcls}-focus`]: isFocus || (isOpen && !isInput),
|
|
892
|
+
[`${prefixcls}-disabled`]: disabled,
|
|
893
|
+
[`${prefixcls}-single`]: true,
|
|
894
|
+
[`${prefixcls}-filterable`]: filterable,
|
|
895
|
+
[`${prefixcls}-error`]: validateStatus === 'error',
|
|
896
|
+
[`${prefixcls}-warning`]: validateStatus === 'warning',
|
|
897
|
+
[`${prefixcls}-small`]: size === 'small',
|
|
898
|
+
[`${prefixcls}-large`]: size === 'large',
|
|
899
|
+
[`${prefixcls}-with-prefix`]: prefix || insetLabel,
|
|
900
|
+
[`${prefixcls}-with-suffix`]: suffix,
|
|
901
|
+
});
|
|
902
|
+
const mouseEvent = showClear ?
|
|
903
|
+
{
|
|
904
|
+
onMouseEnter: () => this.handleMouseOver(),
|
|
905
|
+
onMouseLeave: () => this.handleMouseLeave(),
|
|
906
|
+
} :
|
|
907
|
+
{};
|
|
886
908
|
const sectionCls = cls(`${prefixcls}-selection`, {
|
|
887
909
|
[`${prefixcls}-selection-multiple`]: multiple && !isEmpty(checkedKeys),
|
|
888
910
|
});
|
|
889
|
-
const inner = useCustomTrigger
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
911
|
+
const inner = useCustomTrigger ?
|
|
912
|
+
this.renderCustomTrigger() :
|
|
913
|
+
[
|
|
914
|
+
<Fragment key={'prefix'}>{prefix || insetLabel ? this.renderPrefix() : null}</Fragment>,
|
|
915
|
+
<Fragment key={'selection'}>
|
|
916
|
+
<div className={sectionCls}>{this.renderSelectContent()}</div>
|
|
917
|
+
</Fragment>,
|
|
918
|
+
<Fragment key={'clearbtn'}>{this.renderClearBtn()}</Fragment>,
|
|
919
|
+
<Fragment key={'suffix'}>{suffix ? this.renderSuffix() : null}</Fragment>,
|
|
920
|
+
<Fragment key={'arrow'}>{this.renderArrow()}</Fragment>,
|
|
921
|
+
];
|
|
900
922
|
/**
|
|
901
923
|
* Reasons for disabling the a11y eslint rule:
|
|
902
924
|
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
@@ -912,12 +934,12 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
912
934
|
aria-errormessage={this.props['aria-errormessage']}
|
|
913
935
|
aria-label={this.props['aria-label']}
|
|
914
936
|
aria-labelledby={this.props['aria-labelledby']}
|
|
915
|
-
aria-describedby={this.props[
|
|
937
|
+
aria-describedby={this.props["aria-describedby"]}
|
|
916
938
|
aria-required={this.props['aria-required']}
|
|
917
939
|
id={id}
|
|
918
940
|
{...mouseEvent}
|
|
919
941
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
920
|
-
role=
|
|
942
|
+
role='combobox'
|
|
921
943
|
tabIndex={0}
|
|
922
944
|
>
|
|
923
945
|
{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`}>
|
|
295
295
|
{emptyContent || locale.emptyText}
|
|
296
296
|
</span>
|
|
297
297
|
</ul>
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -203,21 +203,10 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
203
203
|
[`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
const name = inGroup && this.context.checkboxGroup.name;
|
|
207
|
-
const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
|
|
208
|
-
|
|
209
206
|
const renderContent = () => (
|
|
210
207
|
<>
|
|
211
|
-
{children ?
|
|
212
|
-
|
|
213
|
-
{children}
|
|
214
|
-
</span>
|
|
215
|
-
) : null}
|
|
216
|
-
{extra ? (
|
|
217
|
-
<div id={this.extraId} className={extraCls} x-semi-prop="extra">
|
|
218
|
-
{extra}
|
|
219
|
-
</div>
|
|
220
|
-
) : null}
|
|
208
|
+
{children ? <span id={addonId} className={`${prefix}-addon`}>{children}</span> : null}
|
|
209
|
+
{extra ? <div id={extraId} className={extraCls}>{extra}</div> : null}
|
|
221
210
|
</>
|
|
222
211
|
);
|
|
223
212
|
return (
|
package/collapsible/index.tsx
CHANGED
|
@@ -92,14 +92,7 @@ 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
|
|
96
|
-
ref={setHeight}
|
|
97
|
-
style={{ overflow: 'hidden' }}
|
|
98
|
-
id={id}
|
|
99
|
-
x-semi-prop="children"
|
|
100
|
-
>
|
|
101
|
-
{children}
|
|
102
|
-
</div>
|
|
95
|
+
<div ref={setHeight} style={{ overflow: 'hidden' }} id={id}>{children}</div>
|
|
103
96
|
</div>
|
|
104
97
|
);
|
|
105
98
|
};
|
package/datePicker/dateInput.tsx
CHANGED
|
@@ -172,7 +172,6 @@ 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"
|
|
176
175
|
>
|
|
177
176
|
{labelNode}
|
|
178
177
|
</div>
|
|
@@ -653,21 +653,13 @@ 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 &&
|
|
657
|
-
<div className={`${cssClasses.PREFIX}-topSlot`} x-semi-prop="topSlot">
|
|
658
|
-
{topSlot}
|
|
659
|
-
</div>
|
|
660
|
-
)}
|
|
656
|
+
{topSlot && <div className={`${cssClasses.PREFIX}-topSlot`}>{topSlot}</div>}
|
|
661
657
|
{insetInput && <DateInput {...insetInputProps} insetInput={true} />}
|
|
662
|
-
{this.adapter.typeIsYearOrMonth()
|
|
663
|
-
|
|
664
|
-
|
|
658
|
+
{this.adapter.typeIsYearOrMonth() ?
|
|
659
|
+
this.renderYearMonthPanel(locale, localeCode) :
|
|
660
|
+
this.renderMonthGrid(locale, localeCode, dateFnsLocale)}
|
|
665
661
|
{this.renderQuickControls()}
|
|
666
|
-
{bottomSlot &&
|
|
667
|
-
<div className={`${cssClasses.PREFIX}-bottomSlot`} x-semi-prop="bottomSlot">
|
|
668
|
-
{bottomSlot}
|
|
669
|
-
</div>
|
|
670
|
-
)}
|
|
662
|
+
{bottomSlot && <div className={`${cssClasses.PREFIX}-bottomSlot`}>{bottomSlot}</div>}
|
|
671
663
|
{this.renderFooter(locale, localeCode)}
|
|
672
664
|
</div>
|
|
673
665
|
);
|