@douyinfe/semi-ui 2.17.1 → 2.18.1-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/anchor/index.tsx +1 -1
- package/anchor/link.tsx +3 -4
- package/autoComplete/__test__/autoComplete.test.js +6 -6
- package/autoComplete/index.tsx +1 -1
- package/autoComplete/option.tsx +164 -0
- package/calendar/__test__/calendar.test.js +21 -2
- package/calendar/_story/calendar.stories.js +31 -0
- package/calendar/index.tsx +3 -1
- package/calendar/interface.ts +2 -1
- package/carousel/index.tsx +5 -5
- package/checkbox/checkbox.tsx +10 -2
- package/dist/css/semi.css +133 -28
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +7478 -8726
- 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/form/_story/FieldProps/labelOptional.jsx +30 -0
- package/form/_story/form.stories.js +7 -0
- package/form/baseForm.tsx +0 -1
- package/form/hoc/withField.tsx +1 -0
- package/form/label.tsx +21 -7
- package/gulpfile.js +3 -1
- package/lib/cjs/_base/base.css +35 -0
- package/lib/cjs/anchor/index.js +2 -1
- package/lib/cjs/anchor/link.d.ts +1 -1
- package/lib/cjs/anchor/link.js +9 -5
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.js +1 -1
- package/lib/cjs/autoComplete/option.d.ts +50 -0
- package/lib/cjs/autoComplete/option.js +218 -0
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/calendar/index.d.ts +2 -0
- package/lib/cjs/calendar/index.js +3 -1
- package/lib/cjs/calendar/interface.d.ts +2 -1
- package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/carousel/index.js +2 -2
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +9 -3
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +0 -1
- package/lib/cjs/form/hoc/withField.js +2 -1
- package/lib/cjs/form/label.d.ts +8 -5
- package/lib/cjs/form/label.js +15 -4
- package/lib/cjs/locale/interface.d.ts +3 -0
- package/lib/cjs/locale/source/ar.js +3 -0
- package/lib/cjs/locale/source/de.js +3 -0
- package/lib/cjs/locale/source/en_GB.js +3 -0
- package/lib/cjs/locale/source/en_US.js +3 -0
- package/lib/cjs/locale/source/es.js +3 -0
- package/lib/cjs/locale/source/fr.js +3 -0
- package/lib/cjs/locale/source/id_ID.js +3 -0
- package/lib/cjs/locale/source/it.js +3 -0
- package/lib/cjs/locale/source/ja_JP.js +3 -0
- package/lib/cjs/locale/source/ko_KR.js +3 -0
- package/lib/cjs/locale/source/ms_MY.js +3 -0
- package/lib/cjs/locale/source/pt_BR.js +3 -0
- package/lib/cjs/locale/source/ru_RU.js +3 -0
- package/lib/cjs/locale/source/th_TH.js +3 -0
- package/lib/cjs/locale/source/tr_TR.js +3 -0
- package/lib/cjs/locale/source/vi_VN.js +3 -0
- package/lib/cjs/locale/source/zh_CN.js +3 -0
- package/lib/cjs/locale/source/zh_TW.js +3 -0
- package/lib/cjs/modal/Modal.js +0 -8
- package/lib/cjs/modal/ModalContent.js +4 -1
- package/lib/cjs/radio/radio.d.ts +3 -1
- package/lib/cjs/radio/radio.js +33 -8
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/table/ColumnFilter.js +4 -2
- package/lib/cjs/table/ColumnSorter.d.ts +1 -0
- package/lib/cjs/table/ColumnSorter.js +9 -6
- package/lib/cjs/table/Table.js +11 -4
- package/lib/cjs/tabs/TabBar.js +5 -1
- package/lib/cjs/tag/group.d.ts +3 -0
- package/lib/cjs/tag/group.js +24 -6
- package/lib/cjs/tag/index.d.ts +2 -1
- package/lib/cjs/tag/index.js +7 -5
- package/lib/cjs/tag/interface.d.ts +2 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
- package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +2 -2
- package/lib/cjs/transfer/index.js +7 -2
- package/lib/cjs/tree/index.d.ts +3 -1
- package/lib/cjs/tree/index.js +23 -0
- package/lib/cjs/tree/interface.d.ts +4 -0
- package/lib/cjs/typography/base.d.ts +1 -1
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +2 -2
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/es/_base/base.css +35 -0
- package/lib/es/anchor/index.js +2 -1
- package/lib/es/anchor/link.d.ts +1 -1
- package/lib/es/anchor/link.js +9 -5
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/autoComplete/index.js +1 -1
- package/lib/es/autoComplete/option.d.ts +50 -0
- package/lib/es/autoComplete/option.js +188 -0
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/calendar/index.d.ts +2 -0
- package/lib/es/calendar/index.js +3 -1
- package/lib/es/calendar/interface.d.ts +2 -1
- package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/carousel/index.js +2 -2
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +10 -4
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/form/baseForm.js +0 -1
- package/lib/es/form/hoc/withField.js +2 -1
- package/lib/es/form/label.d.ts +8 -5
- package/lib/es/form/label.js +13 -4
- package/lib/es/locale/interface.d.ts +3 -0
- package/lib/es/locale/source/ar.js +3 -0
- package/lib/es/locale/source/de.js +3 -0
- package/lib/es/locale/source/en_GB.js +3 -0
- package/lib/es/locale/source/en_US.js +3 -0
- package/lib/es/locale/source/es.js +3 -0
- package/lib/es/locale/source/fr.js +3 -0
- package/lib/es/locale/source/id_ID.js +3 -0
- package/lib/es/locale/source/it.js +3 -0
- package/lib/es/locale/source/ja_JP.js +3 -0
- package/lib/es/locale/source/ko_KR.js +3 -0
- package/lib/es/locale/source/ms_MY.js +3 -0
- package/lib/es/locale/source/pt_BR.js +3 -0
- package/lib/es/locale/source/ru_RU.js +3 -0
- package/lib/es/locale/source/th_TH.js +3 -0
- package/lib/es/locale/source/tr_TR.js +3 -0
- package/lib/es/locale/source/vi_VN.js +3 -0
- package/lib/es/locale/source/zh_CN.js +3 -0
- package/lib/es/locale/source/zh_TW.js +3 -0
- package/lib/es/modal/Modal.js +0 -8
- package/lib/es/modal/ModalContent.js +4 -1
- package/lib/es/radio/radio.d.ts +3 -1
- package/lib/es/radio/radio.js +31 -8
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/table/ColumnFilter.js +4 -2
- package/lib/es/table/ColumnSorter.d.ts +1 -0
- package/lib/es/table/ColumnSorter.js +9 -6
- package/lib/es/table/Table.js +10 -4
- package/lib/es/tabs/TabBar.js +5 -1
- package/lib/es/tag/group.d.ts +3 -0
- package/lib/es/tag/group.js +24 -6
- package/lib/es/tag/index.d.ts +2 -1
- package/lib/es/tag/index.js +7 -5
- package/lib/es/tag/interface.d.ts +2 -1
- package/lib/es/timePicker/TimePicker.d.ts +2 -2
- package/lib/es/timePicker/TimeShape.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +2 -2
- package/lib/es/transfer/index.js +7 -2
- package/lib/es/tree/index.d.ts +3 -1
- package/lib/es/tree/index.js +22 -0
- package/lib/es/tree/interface.d.ts +4 -0
- package/lib/es/typography/base.d.ts +1 -1
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +2 -2
- package/lib/es/upload/index.d.ts +1 -1
- package/locale/interface.ts +3 -0
- package/locale/source/ar.ts +3 -0
- package/locale/source/de.ts +3 -0
- package/locale/source/en_GB.ts +3 -0
- package/locale/source/en_US.ts +3 -0
- package/locale/source/es.ts +3 -0
- package/locale/source/fr.ts +3 -0
- package/locale/source/id_ID.ts +3 -0
- package/locale/source/it.ts +3 -0
- package/locale/source/ja_JP.ts +3 -0
- package/locale/source/ko_KR.ts +3 -0
- package/locale/source/ms_MY.ts +3 -0
- package/locale/source/pt_BR.ts +3 -0
- package/locale/source/ru_RU.ts +3 -0
- package/locale/source/th_TH.ts +3 -0
- package/locale/source/tr_TR.ts +4 -1
- package/locale/source/vi_VN.ts +3 -0
- package/locale/source/zh_CN.ts +3 -0
- package/locale/source/zh_TW.ts +3 -0
- package/modal/Modal.tsx +0 -6
- package/modal/ModalContent.tsx +4 -1
- package/modal/__test__/modal.test.js +1 -1
- package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
- package/package.json +7 -7
- package/radio/_story/radio.stories.js +2 -2
- package/radio/radio.tsx +27 -5
- package/rating/__test__/rating.test.js +1 -1
- package/select/__test__/select.test.js +11 -17
- package/select/_story/select.stories.js +6 -6
- package/steps/_story/steps.stories.js +3 -3
- package/switch/_story/switch.stories.js +4 -4
- package/switch/_story/switch.stories.tsx +4 -4
- package/table/ColumnFilter.tsx +2 -1
- package/table/ColumnSorter.tsx +16 -10
- package/table/Table.tsx +7 -4
- package/tabs/TabBar.tsx +7 -1
- package/tag/_story/tag.stories.js +57 -1
- package/tag/group.tsx +20 -3
- package/tag/index.tsx +6 -5
- package/tag/interface.ts +2 -1
- package/transfer/_story/transfer.stories.js +2 -2
- package/transfer/index.tsx +7 -2
- package/tree/_story/tree.stories.js +152 -3
- package/tree/index.tsx +16 -1
- package/tree/interface.ts +6 -0
- package/upload/_story/upload.stories.js +2 -2
- package/webpack.config.js +13 -3
package/lib/es/modal/Modal.js
CHANGED
|
@@ -125,14 +125,6 @@ class Modal extends BaseComponent {
|
|
|
125
125
|
let style = styleFromProps;
|
|
126
126
|
const maskStyle = maskStyleFromProps;
|
|
127
127
|
const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
|
|
128
|
-
|
|
129
|
-
if (this.props.centered) {
|
|
130
|
-
style = _Object$assign({
|
|
131
|
-
transform: 'translateY(-50%)',
|
|
132
|
-
top: '50%'
|
|
133
|
-
}, style);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
128
|
let wrapperStyle = {
|
|
137
129
|
zIndex
|
|
138
130
|
};
|
|
@@ -342,7 +342,10 @@ export default class ModalContent extends BaseComponent {
|
|
|
342
342
|
}, this.getMaskElement(), /*#__PURE__*/React.createElement("div", {
|
|
343
343
|
role: "none",
|
|
344
344
|
tabIndex: -1,
|
|
345
|
-
className:
|
|
345
|
+
className: cls({
|
|
346
|
+
["".concat(cssClasses.DIALOG, "-wrap")]: true,
|
|
347
|
+
["".concat(cssClasses.DIALOG, "-wrap-center")]: this.props.centered
|
|
348
|
+
}),
|
|
346
349
|
onClick: maskClosable ? this.onMaskClick : null,
|
|
347
350
|
onMouseUp: maskClosable ? this.onMaskMouseUp : null
|
|
348
351
|
}, this.getDialogElement())); // eslint-disable-next-line max-len
|
package/lib/es/radio/radio.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface RadioState {
|
|
|
39
39
|
addonId?: string;
|
|
40
40
|
extraId?: string;
|
|
41
41
|
focusVisible?: boolean;
|
|
42
|
+
checked?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export { RadioChangeEvent };
|
|
44
45
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
72
|
addonId: string;
|
|
72
73
|
extraId: string;
|
|
73
74
|
constructor(props: RadioProps);
|
|
75
|
+
componentDidUpdate(prevProps: RadioProps): void;
|
|
74
76
|
get adapter(): RadioAdapter;
|
|
75
77
|
isInGroup(): {
|
|
76
78
|
value?: string | number;
|
|
@@ -79,7 +81,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
79
81
|
prefixCls?: string;
|
|
80
82
|
name?: string;
|
|
81
83
|
onChange?: (e: RadioChangeEvent) => void;
|
|
82
|
-
buttonSize?: "small" | "
|
|
84
|
+
buttonSize?: "small" | "large" | "middle";
|
|
83
85
|
isCardRadio?: boolean;
|
|
84
86
|
isPureCardRadio?: boolean;
|
|
85
87
|
};
|
package/lib/es/radio/radio.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _isBoolean from "lodash/isBoolean";
|
|
2
|
+
import _isUndefined from "lodash/isUndefined";
|
|
1
3
|
import _noop from "lodash/noop";
|
|
2
4
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -30,6 +32,7 @@ class Radio extends BaseComponent {
|
|
|
30
32
|
radioGroup.onChange && radioGroup.onChange(e);
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
!('checked' in this.props) && this.foundation.setChecked(e.target.checked);
|
|
33
36
|
onChange && onChange(e);
|
|
34
37
|
};
|
|
35
38
|
|
|
@@ -54,12 +57,23 @@ class Radio extends BaseComponent {
|
|
|
54
57
|
this.state = {
|
|
55
58
|
hover: false,
|
|
56
59
|
addonId: props.addonId,
|
|
57
|
-
extraId: props.extraId
|
|
60
|
+
extraId: props.extraId,
|
|
61
|
+
checked: props.checked || props.defaultChecked || false
|
|
58
62
|
};
|
|
59
63
|
this.foundation = new RadioFoundation(this.adapter);
|
|
60
64
|
this.radioEntity = null;
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
componentDidUpdate(prevProps) {
|
|
68
|
+
if (this.props.checked !== prevProps.checked) {
|
|
69
|
+
if (_isUndefined(this.props.checked)) {
|
|
70
|
+
this.foundation.setChecked(false);
|
|
71
|
+
} else if (_isBoolean(this.props.checked)) {
|
|
72
|
+
this.foundation.setChecked(this.props.checked);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
get adapter() {
|
|
64
78
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
65
79
|
setHover: hover => {
|
|
@@ -74,6 +88,11 @@ class Radio extends BaseComponent {
|
|
|
74
88
|
})
|
|
75
89
|
});
|
|
76
90
|
},
|
|
91
|
+
setChecked: checked => {
|
|
92
|
+
this.setState({
|
|
93
|
+
checked
|
|
94
|
+
});
|
|
95
|
+
},
|
|
77
96
|
setExtraId: () => {
|
|
78
97
|
this.setState({
|
|
79
98
|
extraId: getUuidShort({
|
|
@@ -108,7 +127,6 @@ class Radio extends BaseComponent {
|
|
|
108
127
|
const {
|
|
109
128
|
addonClassName,
|
|
110
129
|
addonStyle,
|
|
111
|
-
checked,
|
|
112
130
|
disabled,
|
|
113
131
|
style,
|
|
114
132
|
className,
|
|
@@ -126,9 +144,13 @@ class Radio extends BaseComponent {
|
|
|
126
144
|
hover: isHover,
|
|
127
145
|
addonId,
|
|
128
146
|
extraId,
|
|
129
|
-
focusVisible
|
|
147
|
+
focusVisible,
|
|
148
|
+
checked
|
|
130
149
|
} = this.state;
|
|
131
|
-
|
|
150
|
+
const props = {
|
|
151
|
+
checked,
|
|
152
|
+
disabled
|
|
153
|
+
};
|
|
132
154
|
|
|
133
155
|
if (this.isInGroup()) {
|
|
134
156
|
realChecked = this.context.radioGroup.value === propValue;
|
|
@@ -139,16 +161,17 @@ class Radio extends BaseComponent {
|
|
|
139
161
|
isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
|
|
140
162
|
buttonSize = this.context.radioGroup.buttonSize;
|
|
141
163
|
realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
|
|
142
|
-
props =
|
|
143
|
-
|
|
144
|
-
disabled: isDisabled
|
|
145
|
-
};
|
|
164
|
+
props.checked = realChecked;
|
|
165
|
+
props.disabled = isDisabled;
|
|
146
166
|
} else {
|
|
147
167
|
realChecked = checked;
|
|
148
168
|
isDisabled = disabled;
|
|
149
169
|
realMode = mode;
|
|
150
170
|
isButtonRadioComponent = type === 'button';
|
|
151
171
|
realPrefixCls = prefixCls;
|
|
172
|
+
isButtonRadioGroup = type === strings.TYPE_BUTTON;
|
|
173
|
+
isPureCardRadioGroup = type === strings.TYPE_PURECARD;
|
|
174
|
+
isCardRadioGroup = type === strings.TYPE_CARD || isPureCardRadioGroup;
|
|
152
175
|
}
|
|
153
176
|
|
|
154
177
|
const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
|
|
@@ -48,7 +48,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
|
|
|
48
48
|
disabled: PropTypes.Requireable<boolean>;
|
|
49
49
|
name: PropTypes.Requireable<string>;
|
|
50
50
|
options: PropTypes.Requireable<any[]>;
|
|
51
|
-
buttonSize: PropTypes.Requireable<"small" | "
|
|
51
|
+
buttonSize: PropTypes.Requireable<"small" | "large" | "middle">;
|
|
52
52
|
type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
|
|
53
53
|
value: PropTypes.Requireable<any>;
|
|
54
54
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -153,12 +153,14 @@ export default function ColumnFilter() {
|
|
|
153
153
|
} else {
|
|
154
154
|
iconElem = /*#__PURE__*/React.createElement("div", {
|
|
155
155
|
className: finalCls
|
|
156
|
-
},
|
|
156
|
+
}, '\u200b'
|
|
157
|
+
/* ZWSP(zero-width space) */
|
|
158
|
+
, /*#__PURE__*/React.createElement(IconFilter, {
|
|
157
159
|
role: "button",
|
|
158
160
|
"aria-label": "Filter data with this column",
|
|
159
161
|
"aria-haspopup": "listbox",
|
|
160
162
|
tabIndex: -1,
|
|
161
|
-
size: "
|
|
163
|
+
size: "default"
|
|
162
164
|
}));
|
|
163
165
|
}
|
|
164
166
|
|
|
@@ -7,6 +7,7 @@ export interface ColumnSorterProps {
|
|
|
7
7
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
8
|
prefixCls?: string;
|
|
9
9
|
sortOrder?: SortOrder;
|
|
10
|
+
title?: React.ReactNode;
|
|
10
11
|
}
|
|
11
12
|
export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
12
13
|
static propTypes: {
|
|
@@ -12,9 +12,10 @@ export default class ColumnSorter extends PureComponent {
|
|
|
12
12
|
prefixCls,
|
|
13
13
|
onClick,
|
|
14
14
|
sortOrder,
|
|
15
|
-
style
|
|
15
|
+
style,
|
|
16
|
+
title
|
|
16
17
|
} = this.props;
|
|
17
|
-
const iconBtnSize = '
|
|
18
|
+
const iconBtnSize = 'default';
|
|
18
19
|
const upCls = cls("".concat(prefixCls, "-column-sorter-up"), {
|
|
19
20
|
on: sortOrder === strings.SORT_DIRECTIONS[0]
|
|
20
21
|
});
|
|
@@ -33,11 +34,13 @@ export default class ColumnSorter extends PureComponent {
|
|
|
33
34
|
role: 'button'
|
|
34
35
|
}, ariaProps, {
|
|
35
36
|
tabIndex: -1,
|
|
36
|
-
|
|
37
|
-
className: "".concat(prefixCls, "-column-sorter"),
|
|
37
|
+
className: "".concat(prefixCls, "-column-sorter-wrapper"),
|
|
38
38
|
onClick: onClick,
|
|
39
39
|
onKeyPress: e => isEnterPress(e) && onClick(e)
|
|
40
|
-
}), /*#__PURE__*/React.createElement("
|
|
40
|
+
}), title, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
style: style,
|
|
42
|
+
className: "".concat(prefixCls, "-column-sorter")
|
|
43
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
41
44
|
className: "".concat(upCls)
|
|
42
45
|
}, /*#__PURE__*/React.createElement(IconCaretup, {
|
|
43
46
|
size: iconBtnSize
|
|
@@ -45,7 +48,7 @@ export default class ColumnSorter extends PureComponent {
|
|
|
45
48
|
className: "".concat(downCls)
|
|
46
49
|
}, /*#__PURE__*/React.createElement(IconCaretdown, {
|
|
47
50
|
size: iconBtnSize
|
|
48
|
-
})));
|
|
51
|
+
}))));
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
}
|
package/lib/es/table/Table.js
CHANGED
|
@@ -494,15 +494,23 @@ class Table extends BaseComponent {
|
|
|
494
494
|
const defaultSortOrder = _get(curQuery, 'defaultSortOrder', false);
|
|
495
495
|
|
|
496
496
|
const sortOrder = _this.foundation.isSortOrderValid(stateSortOrder) ? stateSortOrder : defaultSortOrder;
|
|
497
|
+
const TitleNode = typeof rawTitle !== 'function' && /*#__PURE__*/React.createElement(React.Fragment, {
|
|
498
|
+
key: strings.DEFAULT_KEY_COLUMN_TITLE
|
|
499
|
+
}, rawTitle);
|
|
497
500
|
|
|
498
501
|
if (typeof column.sorter === 'function' || column.sorter === true) {
|
|
502
|
+
// In order to increase the click hot area of sorting, when sorting is required & useFullRender is false,
|
|
503
|
+
// both the title and sorting areas are used as the click hot area for sorting。
|
|
499
504
|
const sorter = /*#__PURE__*/React.createElement(ColumnSorter, {
|
|
500
505
|
key: strings.DEFAULT_KEY_COLUMN_SORTER,
|
|
501
506
|
sortOrder: sortOrder,
|
|
502
|
-
onClick: e => _this.foundation.handleSort(column, e)
|
|
507
|
+
onClick: e => _this.foundation.handleSort(column, e),
|
|
508
|
+
title: TitleNode
|
|
503
509
|
});
|
|
504
510
|
useFullRender && (titleMap.sorter = sorter);
|
|
505
511
|
titleArr.push(sorter);
|
|
512
|
+
} else {
|
|
513
|
+
titleArr.push(TitleNode);
|
|
506
514
|
}
|
|
507
515
|
|
|
508
516
|
const stateFilteredValue = _get(curQuery, 'filteredValue');
|
|
@@ -523,9 +531,7 @@ class Table extends BaseComponent {
|
|
|
523
531
|
titleArr.push(filter);
|
|
524
532
|
}
|
|
525
533
|
|
|
526
|
-
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr
|
|
527
|
-
key: strings.DEFAULT_KEY_COLUMN_TITLE
|
|
528
|
-
}, rawTitle)) && titleArr;
|
|
534
|
+
const newTitle = typeof rawTitle === 'function' ? () => rawTitle(titleMap) : titleArr;
|
|
529
535
|
column = _Object$assign(_Object$assign({}, column), {
|
|
530
536
|
title: newTitle
|
|
531
537
|
});
|
package/lib/es/tabs/TabBar.js
CHANGED
|
@@ -125,7 +125,11 @@ class TabBar extends React.Component {
|
|
|
125
125
|
var _context5, _context6;
|
|
126
126
|
|
|
127
127
|
if (_isEmpty(items)) {
|
|
128
|
-
return
|
|
128
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
129
|
+
disabled: true,
|
|
130
|
+
icon: icon,
|
|
131
|
+
theme: "borderless"
|
|
132
|
+
});
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
const {
|
package/lib/es/tag/group.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface TagGroupProps<T> {
|
|
|
14
14
|
popoverProps?: PopoverProps;
|
|
15
15
|
avatarShape?: AvatarShape;
|
|
16
16
|
mode?: string;
|
|
17
|
+
onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
|
17
18
|
}
|
|
18
19
|
export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
19
20
|
static defaultProps: {
|
|
@@ -21,6 +22,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
|
21
22
|
className: string;
|
|
22
23
|
size: string;
|
|
23
24
|
avatarShape: string;
|
|
25
|
+
onTagClose: () => any;
|
|
24
26
|
};
|
|
25
27
|
static propTypes: {
|
|
26
28
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -31,6 +33,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
|
|
|
31
33
|
tagList: PropTypes.Requireable<any[]>;
|
|
32
34
|
size: PropTypes.Requireable<string>;
|
|
33
35
|
mode: PropTypes.Requireable<string>;
|
|
36
|
+
onTagClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
37
|
showPopover: PropTypes.Requireable<boolean>;
|
|
35
38
|
popoverProps: PropTypes.Requireable<object>;
|
|
36
39
|
avatarShape: PropTypes.Requireable<string>;
|
package/lib/es/tag/group.js
CHANGED
|
@@ -72,10 +72,11 @@ export default class TagGroup extends PureComponent {
|
|
|
72
72
|
tagList,
|
|
73
73
|
size,
|
|
74
74
|
mode,
|
|
75
|
-
avatarShape
|
|
75
|
+
avatarShape,
|
|
76
|
+
onTagClose
|
|
76
77
|
} = this.props;
|
|
77
78
|
|
|
78
|
-
const renderTags = _mapInstanceProperty(tagList).call(tagList,
|
|
79
|
+
const renderTags = _mapInstanceProperty(tagList).call(tagList, tag => {
|
|
79
80
|
if (mode === 'custom') {
|
|
80
81
|
return tag;
|
|
81
82
|
}
|
|
@@ -88,9 +89,24 @@ export default class TagGroup extends PureComponent {
|
|
|
88
89
|
tag.avatarShape = avatarShape;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
if (!tag.tagKey) {
|
|
93
|
+
if (typeof tag.children === 'string' || typeof tag.children === 'number') {
|
|
94
|
+
tag.tagKey = tag.children;
|
|
95
|
+
} else {
|
|
96
|
+
tag.tagKey = Math.random();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return /*#__PURE__*/React.createElement(Tag, _Object$assign({}, tag, {
|
|
101
|
+
key: tag.tagKey,
|
|
102
|
+
onClose: (tagChildren, e, tagKey) => {
|
|
103
|
+
if (tag.onClose) {
|
|
104
|
+
tag.onClose(tagChildren, e, tagKey);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
onTagClose && onTagClose(tagChildren, e, tagKey);
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
94
110
|
});
|
|
95
111
|
|
|
96
112
|
return renderTags;
|
|
@@ -122,7 +138,8 @@ TagGroup.defaultProps = {
|
|
|
122
138
|
style: {},
|
|
123
139
|
className: '',
|
|
124
140
|
size: tagSize[0],
|
|
125
|
-
avatarShape: 'square'
|
|
141
|
+
avatarShape: 'square',
|
|
142
|
+
onTagClose: () => undefined
|
|
126
143
|
};
|
|
127
144
|
TagGroup.propTypes = {
|
|
128
145
|
children: PropTypes.node,
|
|
@@ -133,6 +150,7 @@ TagGroup.propTypes = {
|
|
|
133
150
|
tagList: PropTypes.array,
|
|
134
151
|
size: PropTypes.oneOf(tagSize),
|
|
135
152
|
mode: PropTypes.string,
|
|
153
|
+
onTagClose: PropTypes.func,
|
|
136
154
|
showPopover: PropTypes.bool,
|
|
137
155
|
popoverProps: PropTypes.object,
|
|
138
156
|
avatarShape: PropTypes.oneOf(avatarShapeSet)
|
package/lib/es/tag/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default class Tag extends Component<TagProps, TagState> {
|
|
|
10
10
|
static defaultProps: TagProps;
|
|
11
11
|
static propTypes: {
|
|
12
12
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
13
|
+
tagKey: PropTypes.Requireable<PropTypes.Requireable<string> | PropTypes.Requireable<number>>;
|
|
13
14
|
size: PropTypes.Requireable<string>;
|
|
14
15
|
color: PropTypes.Requireable<string>;
|
|
15
16
|
type: PropTypes.Requireable<string>;
|
|
@@ -28,7 +29,7 @@ export default class Tag extends Component<TagProps, TagState> {
|
|
|
28
29
|
visible: boolean;
|
|
29
30
|
};
|
|
30
31
|
setVisible(visible: boolean): void;
|
|
31
|
-
close(e: React.MouseEvent<HTMLElement>, value: React.ReactNode): void;
|
|
32
|
+
close(e: React.MouseEvent<HTMLElement>, value: React.ReactNode, tagKey: string | number): void;
|
|
32
33
|
handleKeyDown(event: any): void;
|
|
33
34
|
renderAvatar(): JSX.Element;
|
|
34
35
|
render(): JSX.Element;
|
package/lib/es/tag/index.js
CHANGED
|
@@ -63,13 +63,13 @@ export default class Tag extends Component {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
close(e, value) {
|
|
66
|
+
close(e, value, tagKey) {
|
|
67
67
|
const {
|
|
68
68
|
onClose
|
|
69
69
|
} = this.props;
|
|
70
70
|
e.stopPropagation();
|
|
71
71
|
e.nativeEvent.stopImmediatePropagation();
|
|
72
|
-
onClose && onClose(value, e); // when user call e.preventDefault() in onClick callback, tag will not hidden
|
|
72
|
+
onClose && onClose(value, e, tagKey); // when user call e.preventDefault() in onClick callback, tag will not hidden
|
|
73
73
|
|
|
74
74
|
if (e.defaultPrevented) {
|
|
75
75
|
return;
|
|
@@ -88,7 +88,7 @@ export default class Tag extends Component {
|
|
|
88
88
|
switch (event.key) {
|
|
89
89
|
case "Backspace":
|
|
90
90
|
case "Delete":
|
|
91
|
-
closable && this.close(event, this.props.children);
|
|
91
|
+
closable && this.close(event, this.props.children, this.props.tagKey);
|
|
92
92
|
handlePrevent(event);
|
|
93
93
|
break;
|
|
94
94
|
|
|
@@ -125,6 +125,7 @@ export default class Tag extends Component {
|
|
|
125
125
|
|
|
126
126
|
const _a = this.props,
|
|
127
127
|
{
|
|
128
|
+
tagKey,
|
|
128
129
|
children,
|
|
129
130
|
size,
|
|
130
131
|
color,
|
|
@@ -138,7 +139,7 @@ export default class Tag extends Component {
|
|
|
138
139
|
avatarShape,
|
|
139
140
|
tabIndex
|
|
140
141
|
} = _a,
|
|
141
|
-
attr = __rest(_a, ["children", "size", "color", "closable", "visible", "onClose", "onClick", "className", "type", "avatarSrc", "avatarShape", "tabIndex"]);
|
|
142
|
+
attr = __rest(_a, ["tagKey", "children", "size", "color", "closable", "visible", "onClose", "onClick", "className", "type", "avatarSrc", "avatarShape", "tabIndex"]);
|
|
142
143
|
|
|
143
144
|
const {
|
|
144
145
|
visible: isVisible
|
|
@@ -171,7 +172,7 @@ export default class Tag extends Component {
|
|
|
171
172
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
172
173
|
React.createElement("div", {
|
|
173
174
|
className: "".concat(prefixCls, "-close"),
|
|
174
|
-
onClick: e => this.close(e, children)
|
|
175
|
+
onClick: e => this.close(e, children, tagKey)
|
|
175
176
|
}, /*#__PURE__*/React.createElement(IconClose, {
|
|
176
177
|
size: "small"
|
|
177
178
|
})) : null;
|
|
@@ -197,6 +198,7 @@ Tag.defaultProps = {
|
|
|
197
198
|
};
|
|
198
199
|
Tag.propTypes = {
|
|
199
200
|
children: PropTypes.node,
|
|
201
|
+
tagKey: PropTypes.oneOf([PropTypes.string, PropTypes.number]),
|
|
200
202
|
size: PropTypes.oneOf(tagSize),
|
|
201
203
|
color: PropTypes.oneOf(tagColors),
|
|
202
204
|
type: PropTypes.oneOf(tagType),
|
|
@@ -5,12 +5,13 @@ export declare type TagSize = 'default' | 'small' | 'large';
|
|
|
5
5
|
export declare type AvatarShape = 'circle' | 'square';
|
|
6
6
|
export interface TagProps {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
+
tagKey?: string | number;
|
|
8
9
|
size?: TagSize;
|
|
9
10
|
color?: TagColor;
|
|
10
11
|
type?: TagType;
|
|
11
12
|
closable?: boolean;
|
|
12
13
|
visible?: boolean;
|
|
13
|
-
onClose?: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement
|
|
14
|
+
onClose?: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
|
|
14
15
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
15
16
|
style?: React.CSSProperties;
|
|
16
17
|
className?: string;
|
|
@@ -99,11 +99,11 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
99
99
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
100
100
|
prefixCls: PropTypes.Requireable<string>;
|
|
101
101
|
clearText: PropTypes.Requireable<string>;
|
|
102
|
-
value: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
102
|
+
value: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
103
103
|
inputReadOnly: PropTypes.Requireable<boolean>;
|
|
104
104
|
disabled: PropTypes.Requireable<boolean>;
|
|
105
105
|
showClear: PropTypes.Requireable<boolean>;
|
|
106
|
-
defaultValue: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
106
|
+
defaultValue: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
107
107
|
open: PropTypes.Requireable<boolean>;
|
|
108
108
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
109
109
|
onOpenChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -6,5 +6,5 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
* - \[12:00:12, 12:21:12]
|
|
7
7
|
* - \[[12:00:12, 12:21:12], [12:11:12, 12:32:12]]
|
|
8
8
|
*/
|
|
9
|
-
declare const TimeShape: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
9
|
+
declare const TimeShape: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
10
10
|
export { TimeShape };
|
|
@@ -19,11 +19,11 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
19
19
|
'aria-required': import("prop-types").Requireable<boolean>;
|
|
20
20
|
prefixCls: import("prop-types").Requireable<string>;
|
|
21
21
|
clearText: import("prop-types").Requireable<string>;
|
|
22
|
-
value: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
22
|
+
value: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
23
23
|
inputReadOnly: import("prop-types").Requireable<boolean>;
|
|
24
24
|
disabled: import("prop-types").Requireable<boolean>;
|
|
25
25
|
showClear: import("prop-types").Requireable<boolean>;
|
|
26
|
-
defaultValue: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
26
|
+
defaultValue: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
27
27
|
open: import("prop-types").Requireable<boolean>;
|
|
28
28
|
defaultOpen: import("prop-types").Requireable<boolean>;
|
|
29
29
|
onOpenChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
package/lib/es/transfer/index.js
CHANGED
|
@@ -280,7 +280,8 @@ class Transfer extends BaseComponent {
|
|
|
280
280
|
const noMatch = inSearchMode && searchResult.size === 0;
|
|
281
281
|
const emptySearch = emptyContent.search ? emptyContent.search : locale.emptySearch;
|
|
282
282
|
const emptyLeft = emptyContent.left ? emptyContent.left : locale.emptyLeft;
|
|
283
|
-
const
|
|
283
|
+
const emptyDataCom = this.renderEmpty('left', emptyLeft);
|
|
284
|
+
const emptySearchCom = this.renderEmpty('left', emptySearch);
|
|
284
285
|
const loadingCom = /*#__PURE__*/React.createElement(Spin, null);
|
|
285
286
|
let content = null;
|
|
286
287
|
|
|
@@ -290,7 +291,11 @@ class Transfer extends BaseComponent {
|
|
|
290
291
|
break;
|
|
291
292
|
|
|
292
293
|
case noMatch:
|
|
293
|
-
content =
|
|
294
|
+
content = emptySearchCom;
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
case data.length === 0:
|
|
298
|
+
content = emptyDataCom;
|
|
294
299
|
break;
|
|
295
300
|
|
|
296
301
|
case type === strings.TYPE_TREE_TO_LIST:
|
package/lib/es/tree/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
6
6
|
import Input from '../input/index';
|
|
7
7
|
import TreeNode from './treeNode';
|
|
8
8
|
import '@douyinfe/semi-foundation/lib/es/tree/tree.css';
|
|
9
|
-
import { TreeProps, TreeState, TreeNodeProps, TreeNodeData, FlattenNode, KeyEntity } from './interface';
|
|
9
|
+
import { TreeProps, TreeState, TreeNodeProps, TreeNodeData, FlattenNode, KeyEntity, ScrollData } from './interface';
|
|
10
10
|
export * from './interface';
|
|
11
11
|
export { AutoSizerProps } from './autoSizer';
|
|
12
12
|
declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
@@ -102,6 +102,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
102
102
|
onNodeClick: any;
|
|
103
103
|
onMotionEnd: any;
|
|
104
104
|
context: ContextValue;
|
|
105
|
+
virtualizedListRef: React.RefObject<any>;
|
|
105
106
|
constructor(props: TreeProps);
|
|
106
107
|
/**
|
|
107
108
|
* Process of getDerivedStateFromProps was inspired by rc-tree
|
|
@@ -110,6 +111,7 @@ declare class Tree extends BaseComponent<TreeProps, TreeState> {
|
|
|
110
111
|
static getDerivedStateFromProps(props: TreeProps, prevState: TreeState): Partial<TreeState>;
|
|
111
112
|
get adapter(): TreeAdapter;
|
|
112
113
|
search: (value: string) => void;
|
|
114
|
+
scrollTo: (scrollData: ScrollData) => void;
|
|
113
115
|
renderInput(): JSX.Element;
|
|
114
116
|
renderEmpty: () => JSX.Element;
|
|
115
117
|
onNodeSelect: (e: MouseEvent | KeyboardEvent, treeNode: TreeNodeProps) => void;
|