@douyinfe/semi-ui 2.9.0-beta.1 → 2.10.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/anchor/__test__/anchor.test.js +1 -0
- package/anchor/_story/anchor.stories.js +23 -1
- package/cascader/_story/cascader.stories.js +17 -2
- package/cascader/index.tsx +1 -1
- package/checkbox/_story/checkbox.stories.js +1 -1
- package/checkbox/checkbox.tsx +18 -8
- package/collapse/item.tsx +2 -0
- package/datePicker/_story/datePicker.stories.js +37 -0
- package/dist/css/semi.css +1 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +23386 -23414
- 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/input/__test__/input.test.js +12 -3
- package/input/__test__/textArea.test.js +53 -0
- package/lib/cjs/_portal/index.d.ts +1 -1
- package/lib/cjs/cascader/index.js +1 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +25 -13
- package/lib/cjs/collapse/item.js +4 -2
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/insetInput.d.ts +0 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/modal/Modal.js +3 -0
- package/lib/cjs/modal/useModal/index.d.ts +0 -1
- package/lib/cjs/notification/useNotification/index.d.ts +0 -1
- package/lib/cjs/radio/radio.d.ts +5 -1
- package/lib/cjs/radio/radio.js +26 -12
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/scrollList/scrollItem.js +4 -0
- package/lib/cjs/tabs/TabPane.js +4 -0
- package/lib/cjs/tabs/index.js +2 -0
- package/lib/cjs/timePicker/Combobox.d.ts +0 -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/toast/toast.d.ts +1 -1
- package/lib/cjs/toast/useToast/index.d.ts +0 -1
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +6 -1
- package/lib/cjs/transfer/index.d.ts +1 -0
- package/lib/cjs/transfer/index.js +3 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/es/_portal/index.d.ts +1 -1
- package/lib/es/cascader/index.js +1 -1
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +25 -13
- package/lib/es/collapse/item.js +4 -2
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/insetInput.d.ts +0 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +0 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/modal/Modal.js +3 -0
- package/lib/es/modal/useModal/index.d.ts +0 -1
- package/lib/es/notification/useNotification/index.d.ts +0 -1
- package/lib/es/radio/radio.d.ts +5 -1
- package/lib/es/radio/radio.js +26 -12
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/scrollList/scrollItem.js +4 -0
- package/lib/es/tabs/TabPane.js +4 -0
- package/lib/es/tabs/index.js +2 -0
- package/lib/es/timePicker/Combobox.d.ts +0 -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/toast/toast.d.ts +1 -1
- package/lib/es/toast/useToast/index.d.ts +0 -1
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +6 -1
- package/lib/es/transfer/index.d.ts +1 -0
- package/lib/es/transfer/index.js +3 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +1 -1
- package/modal/Modal.tsx +2 -0
- package/modal/confirm.tsx +1 -1
- package/overflowList/_story/overflowList.stories.js +44 -0
- package/package.json +9 -9
- package/radio/radio.tsx +17 -7
- package/scrollList/_story/SingleWheelList/index.js +72 -0
- package/scrollList/_story/scrolllist.stories.js +7 -0
- package/scrollList/scrollItem.tsx +3 -0
- package/table/__test__/table.test.js +1 -0
- package/tabs/TabPane.tsx +2 -0
- package/tabs/_story/tabs.stories.js +72 -0
- package/tabs/index.tsx +1 -0
- package/tagInput/_story/tagInput.stories.js +14 -1
- package/tooltip/_story/tooltip.stories.js +127 -15
- package/tooltip/index.tsx +5 -1
- package/transfer/index.tsx +4 -1
- package/typography/__test__/typography.test.js +1 -0
- package/upload/__test__/upload.test.js +2 -0
- package/upload/_story/upload.stories.js +2 -2
|
@@ -113,9 +113,18 @@ describe('Input', () => {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
it('input password mode', () => {
|
|
116
|
-
const inputMode = mount(<Input
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
const inputMode = mount(<Input />);
|
|
117
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
118
|
+
inputMode.setProps({ mode: 'password' }) ;
|
|
119
|
+
expect(inputMode.find('input').instance().type).toEqual('password');
|
|
120
|
+
inputMode.setProps({ mode: '' }) ;
|
|
121
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('input password click eyes icon', () => {
|
|
125
|
+
const inputMode = mount(<Input mode='password' defaultValue="123456" autofocus/>);
|
|
126
|
+
inputMode.simulate('mouseEnter', {}).find(`.${BASE_CLASS_PREFIX}-input-modebtn`).simulate('click');
|
|
127
|
+
expect(inputMode.find('input').instance().type).toEqual('text');
|
|
119
128
|
});
|
|
120
129
|
|
|
121
130
|
it('input controlled mode', () => {
|
|
@@ -116,4 +116,57 @@ describe('TextArea', () => {
|
|
|
116
116
|
const counter2 = textarea.find(`.${BASE_CLASS_PREFIX}-input-textarea-counter`);
|
|
117
117
|
expect(counter2.hasClass('semi-input-textarea-counter-exceed')).toEqual(false);
|
|
118
118
|
});
|
|
119
|
+
|
|
120
|
+
it('test minLength', () => {
|
|
121
|
+
let inputValue = '💖💖💖';
|
|
122
|
+
let inputValue1 = '💖💖💖💖';
|
|
123
|
+
let minLength = 4;
|
|
124
|
+
let event = { target: { value: inputValue } };
|
|
125
|
+
let event1 = { target: { value: inputValue1 } };
|
|
126
|
+
|
|
127
|
+
let onChange = value => {
|
|
128
|
+
console.log(value);
|
|
129
|
+
};
|
|
130
|
+
let spyOnChange = sinon.spy(onChange);
|
|
131
|
+
const textArea = mount(<TextArea onChange={spyOnChange} minLength={minLength} getValueLength={getValueLength} />);
|
|
132
|
+
const textAreaDom = textArea.find('textarea');
|
|
133
|
+
|
|
134
|
+
textAreaDom.simulate('change', event);
|
|
135
|
+
expect(spyOnChange.calledOnce).toBe(true);
|
|
136
|
+
expect(spyOnChange.calledWithMatch(textAreaDom)).toBe(true);
|
|
137
|
+
expect(textAreaDom.instance().minLength).toEqual(inputValue.length + (minLength - getValueLength(inputValue)));
|
|
138
|
+
|
|
139
|
+
textAreaDom.simulate('change', event1);
|
|
140
|
+
expect(spyOnChange.calledWithMatch(textAreaDom)).toBe(true);
|
|
141
|
+
expect(textAreaDom.instance().minLength).toEqual(minLength)
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('test maxLength + truncateValue', () => {
|
|
145
|
+
function truncateValue(inputValue, maxLength, getValueLength) {
|
|
146
|
+
let event = { target: { value: inputValue } };
|
|
147
|
+
let onChange = value => {
|
|
148
|
+
console.log(value);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
let spyOnChange = sinon.spy(onChange);
|
|
152
|
+
const textArea = mount(<TextArea onChange={spyOnChange} maxLength={maxLength} getValueLength={getValueLength} />);
|
|
153
|
+
const textAreaDom = textArea.find('textarea');
|
|
154
|
+
textAreaDom.simulate('change', event);
|
|
155
|
+
expect(spyOnChange.calledOnce).toBe(true);
|
|
156
|
+
return textAreaDom.instance().value;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const testCases = [
|
|
160
|
+
// 自定义valueLength
|
|
161
|
+
['Semi', 5, getValueLength, 'Semi'],
|
|
162
|
+
['Semi Design', 4, getValueLength, 'Semi'],
|
|
163
|
+
['💖💖💖💖💖💖💖💖💖💖👨👩👧👦', 10, getValueLength, '💖💖💖💖💖💖💖💖💖💖'],
|
|
164
|
+
['💖', -1, getValueLength, ''],
|
|
165
|
+
['🆗', 1, getValueLength, '🆗'],
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
for (let [value, length, fc, result] of testCases) {
|
|
169
|
+
expect(truncateValue(value, length, fc)).toBe(result);
|
|
170
|
+
}
|
|
171
|
+
})
|
|
119
172
|
})
|
|
@@ -33,6 +33,6 @@ declare class Portal extends PureComponent<PortalProps, PortalState> {
|
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
34
|
addStyle: (style?: {}) => void;
|
|
35
35
|
addClass: (prefixCls: string, ...classNames: string[]) => void;
|
|
36
|
-
render():
|
|
36
|
+
render(): import("react").ReactPortal;
|
|
37
37
|
}
|
|
38
38
|
export default Portal;
|
|
@@ -423,7 +423,7 @@ class Cascader extends _baseComponent.default {
|
|
|
423
423
|
|
|
424
424
|
this.handleClearEnterPress = e => {
|
|
425
425
|
e && e.stopPropagation();
|
|
426
|
-
this.foundation.handleClearEnterPress();
|
|
426
|
+
this.foundation.handleClearEnterPress(e);
|
|
427
427
|
};
|
|
428
428
|
|
|
429
429
|
this.showClearBtn = () => {
|
|
@@ -22,9 +22,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
22
22
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
23
23
|
role?: React.HTMLAttributes<HTMLSpanElement>['role'];
|
|
24
24
|
tabIndex?: number;
|
|
25
|
+
addonId?: string;
|
|
26
|
+
extraId?: string;
|
|
25
27
|
}
|
|
26
28
|
interface CheckboxState {
|
|
27
29
|
checked: boolean;
|
|
30
|
+
addonId?: string;
|
|
31
|
+
extraId?: string;
|
|
28
32
|
}
|
|
29
33
|
declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
30
34
|
static contextType: React.Context<CheckboxContextType>;
|
|
@@ -51,15 +51,11 @@ class Checkbox extends _baseComponent.default {
|
|
|
51
51
|
|
|
52
52
|
const checked = false;
|
|
53
53
|
this.state = {
|
|
54
|
-
checked: props.checked || props.defaultChecked || checked
|
|
54
|
+
checked: props.checked || props.defaultChecked || checked,
|
|
55
|
+
addonId: props.addonId,
|
|
56
|
+
extraId: props.extraId
|
|
55
57
|
};
|
|
56
58
|
this.checkboxEntity = null;
|
|
57
|
-
this.addonId = (0, _uuid.getUuidShort)({
|
|
58
|
-
prefix: 'addon'
|
|
59
|
-
});
|
|
60
|
-
this.extraId = (0, _uuid.getUuidShort)({
|
|
61
|
-
prefix: 'extra'
|
|
62
|
-
});
|
|
63
59
|
this.foundation = new _checkboxFoundation.default(this.adapter);
|
|
64
60
|
}
|
|
65
61
|
|
|
@@ -81,7 +77,21 @@ class Checkbox extends _baseComponent.default {
|
|
|
81
77
|
notifyGroupChange: cbContent => {
|
|
82
78
|
this.context.checkboxGroup.onChange(cbContent);
|
|
83
79
|
},
|
|
84
|
-
getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled
|
|
80
|
+
getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled,
|
|
81
|
+
setAddonId: () => {
|
|
82
|
+
this.setState({
|
|
83
|
+
addonId: (0, _uuid.getUuidShort)({
|
|
84
|
+
prefix: 'addon'
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
setExtraId: () => {
|
|
89
|
+
this.setState({
|
|
90
|
+
extraId: (0, _uuid.getUuidShort)({
|
|
91
|
+
prefix: 'extra'
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
85
95
|
});
|
|
86
96
|
}
|
|
87
97
|
|
|
@@ -124,7 +134,9 @@ class Checkbox extends _baseComponent.default {
|
|
|
124
134
|
id
|
|
125
135
|
} = this.props;
|
|
126
136
|
const {
|
|
127
|
-
checked
|
|
137
|
+
checked,
|
|
138
|
+
addonId,
|
|
139
|
+
extraId
|
|
128
140
|
} = this.state;
|
|
129
141
|
const props = {
|
|
130
142
|
checked,
|
|
@@ -171,10 +183,10 @@ class Checkbox extends _baseComponent.default {
|
|
|
171
183
|
const name = inGroup && this.context.checkboxGroup.name;
|
|
172
184
|
|
|
173
185
|
const renderContent = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children ? /*#__PURE__*/_react.default.createElement("span", {
|
|
174
|
-
id:
|
|
186
|
+
id: addonId,
|
|
175
187
|
className: "".concat(prefix, "-addon")
|
|
176
188
|
}, children) : null, extra ? /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
-
id:
|
|
189
|
+
id: extraId,
|
|
178
190
|
className: extraCls
|
|
179
191
|
}, extra) : null);
|
|
180
192
|
|
|
@@ -194,8 +206,8 @@ class Checkbox extends _baseComponent.default {
|
|
|
194
206
|
onKeyPress: this.handleEnterPress,
|
|
195
207
|
"aria-labelledby": this.props['aria-labelledby']
|
|
196
208
|
}, /*#__PURE__*/_react.default.createElement(_checkboxInner.default, (0, _assign.default)({}, this.props, props, {
|
|
197
|
-
addonId: children &&
|
|
198
|
-
extraId: extra &&
|
|
209
|
+
addonId: children && addonId,
|
|
210
|
+
extraId: extra && extraId,
|
|
199
211
|
name: name,
|
|
200
212
|
isPureCardType: props.isPureCardType,
|
|
201
213
|
ref: ref => {
|
package/lib/cjs/collapse/item.js
CHANGED
|
@@ -103,9 +103,11 @@ class CollapsePanel extends _react.PureComponent {
|
|
|
103
103
|
className,
|
|
104
104
|
children,
|
|
105
105
|
itemKey,
|
|
106
|
-
reCalcKey
|
|
106
|
+
reCalcKey,
|
|
107
|
+
header,
|
|
108
|
+
extra
|
|
107
109
|
} = _a,
|
|
108
|
-
restProps = __rest(_a, ["className", "children", "itemKey", "reCalcKey"]);
|
|
110
|
+
restProps = __rest(_a, ["className", "children", "itemKey", "reCalcKey", "header", "extra"]);
|
|
109
111
|
|
|
110
112
|
const {
|
|
111
113
|
keepDOM,
|
|
@@ -26,7 +26,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
26
26
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
27
|
value: PropTypes.Requireable<any[]>;
|
|
28
28
|
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
-
type: PropTypes.Requireable<"
|
|
29
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
30
30
|
showClear: PropTypes.Requireable<boolean>;
|
|
31
31
|
format: PropTypes.Requireable<string>;
|
|
32
32
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -41,7 +41,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
41
41
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
42
42
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
43
43
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
44
|
-
type: PropTypes.Requireable<"
|
|
44
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
45
45
|
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
46
46
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
47
47
|
defaultValue: PropTypes.Requireable<string | number | object>;
|
|
@@ -17,7 +17,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
17
17
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
18
18
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
19
19
|
static propTypes: {
|
|
20
|
-
type: PropTypes.Requireable<"
|
|
20
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
21
21
|
defaultValue: PropTypes.Requireable<string | number | object>;
|
|
22
22
|
defaultPickerValue: PropTypes.Requireable<string | number | object>;
|
|
23
23
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
125
125
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
126
126
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
127
127
|
children?: React.ReactNode;
|
|
128
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
128
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
129
129
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
130
130
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
131
131
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
73
73
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
74
74
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
75
75
|
children?: import("react").ReactNode;
|
|
76
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
76
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
77
77
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
78
78
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
79
79
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
package/lib/cjs/modal/Modal.js
CHANGED
|
@@ -253,6 +253,9 @@ class Modal extends _baseComponent.default {
|
|
|
253
253
|
this.props.onOk(e);
|
|
254
254
|
},
|
|
255
255
|
notifyClose: () => {
|
|
256
|
+
var _a, _b;
|
|
257
|
+
|
|
258
|
+
(_b = (_a = this.props.motion) === null || _a === void 0 ? void 0 : _a.didLeave) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
256
259
|
this.props.afterClose();
|
|
257
260
|
},
|
|
258
261
|
toggleHidden: (hidden, callback) => {
|
package/lib/cjs/radio/radio.d.ts
CHANGED
|
@@ -29,9 +29,13 @@ export declare type RadioProps = {
|
|
|
29
29
|
addonClassName?: string;
|
|
30
30
|
type?: RadioType;
|
|
31
31
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
32
|
+
addonId?: string;
|
|
33
|
+
extraId?: string;
|
|
32
34
|
};
|
|
33
35
|
export interface RadioState {
|
|
34
36
|
hover?: boolean;
|
|
37
|
+
addonId?: string;
|
|
38
|
+
extraId?: string;
|
|
35
39
|
}
|
|
36
40
|
export { RadioChangeEvent };
|
|
37
41
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,7 +75,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
75
|
prefixCls?: string;
|
|
72
76
|
name?: string;
|
|
73
77
|
onChange?: (e: RadioChangeEvent) => void;
|
|
74
|
-
buttonSize?: "small" | "
|
|
78
|
+
buttonSize?: "small" | "large" | "middle";
|
|
75
79
|
isCardRadio?: boolean;
|
|
76
80
|
isPureCardRadio?: boolean;
|
|
77
81
|
};
|
package/lib/cjs/radio/radio.js
CHANGED
|
@@ -67,16 +67,12 @@ class Radio extends _baseComponent.default {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
this.state = {
|
|
70
|
-
hover: false
|
|
70
|
+
hover: false,
|
|
71
|
+
addonId: props.addonId,
|
|
72
|
+
extraId: props.extraId
|
|
71
73
|
};
|
|
72
74
|
this.foundation = new _radioFoundation.default(this.adapter);
|
|
73
75
|
this.radioEntity = null;
|
|
74
|
-
this.addonId = (0, _uuid.getUuidShort)({
|
|
75
|
-
prefix: 'addon'
|
|
76
|
-
});
|
|
77
|
-
this.extraId = (0, _uuid.getUuidShort)({
|
|
78
|
-
prefix: 'extra'
|
|
79
|
-
});
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
get adapter() {
|
|
@@ -85,6 +81,20 @@ class Radio extends _baseComponent.default {
|
|
|
85
81
|
this.setState({
|
|
86
82
|
hover
|
|
87
83
|
});
|
|
84
|
+
},
|
|
85
|
+
setAddonId: () => {
|
|
86
|
+
this.setState({
|
|
87
|
+
addonId: (0, _uuid.getUuidShort)({
|
|
88
|
+
prefix: 'addon'
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
setExtraId: () => {
|
|
93
|
+
this.setState({
|
|
94
|
+
extraId: (0, _uuid.getUuidShort)({
|
|
95
|
+
prefix: 'extra'
|
|
96
|
+
})
|
|
97
|
+
});
|
|
88
98
|
}
|
|
89
99
|
});
|
|
90
100
|
}
|
|
@@ -121,7 +131,11 @@ class Radio extends _baseComponent.default {
|
|
|
121
131
|
value: propValue
|
|
122
132
|
} = this.props;
|
|
123
133
|
let realChecked, isDisabled, realMode, isButtonRadioGroup, isCardRadioGroup, isPureCardRadioGroup, isButtonRadioComponent, buttonSize, realPrefixCls;
|
|
124
|
-
const
|
|
134
|
+
const {
|
|
135
|
+
hover: isHover,
|
|
136
|
+
addonId,
|
|
137
|
+
extraId
|
|
138
|
+
} = this.state;
|
|
125
139
|
let props = {};
|
|
126
140
|
|
|
127
141
|
if (this.isInGroup()) {
|
|
@@ -174,10 +188,10 @@ class Radio extends _baseComponent.default {
|
|
|
174
188
|
const renderContent = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children ? /*#__PURE__*/_react.default.createElement("span", {
|
|
175
189
|
className: addonCls,
|
|
176
190
|
style: addonStyle,
|
|
177
|
-
id:
|
|
191
|
+
id: addonId
|
|
178
192
|
}, children) : null, extra && !isButtonRadio ? /*#__PURE__*/_react.default.createElement("div", {
|
|
179
193
|
className: "".concat(prefix, "-extra"),
|
|
180
|
-
id:
|
|
194
|
+
id: extraId
|
|
181
195
|
}, extra) : null);
|
|
182
196
|
|
|
183
197
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
@@ -194,8 +208,8 @@ class Radio extends _baseComponent.default {
|
|
|
194
208
|
ref: ref => {
|
|
195
209
|
this.radioEntity = ref;
|
|
196
210
|
},
|
|
197
|
-
addonId: children &&
|
|
198
|
-
extraId: extra &&
|
|
211
|
+
addonId: children && addonId,
|
|
212
|
+
extraId: extra && extraId
|
|
199
213
|
})), isCardRadioGroup ? /*#__PURE__*/_react.default.createElement("div", {
|
|
200
214
|
className: "".concat(prefix, "-isCardRadioGroup_content")
|
|
201
215
|
}, renderContent()) : renderContent());
|
|
@@ -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>;
|
|
@@ -71,6 +71,8 @@ class ScrollItem extends _baseComponent.default {
|
|
|
71
71
|
this._cacheSelectorNode = selector => this._cacheNode('selector', selector);
|
|
72
72
|
|
|
73
73
|
this._cacheWrapperNode = wrapper => this._cacheNode('wrapper', wrapper);
|
|
74
|
+
/* istanbul ignore next */
|
|
75
|
+
|
|
74
76
|
|
|
75
77
|
this._isFirst = node => {
|
|
76
78
|
const {
|
|
@@ -85,6 +87,8 @@ class ScrollItem extends _baseComponent.default {
|
|
|
85
87
|
|
|
86
88
|
return false;
|
|
87
89
|
};
|
|
90
|
+
/* istanbul ignore next */
|
|
91
|
+
|
|
88
92
|
|
|
89
93
|
this._isLast = node => {
|
|
90
94
|
const {
|
package/lib/cjs/tabs/TabPane.js
CHANGED
|
@@ -75,6 +75,8 @@ class TabPane extends _react.PureComponent {
|
|
|
75
75
|
|
|
76
76
|
return false;
|
|
77
77
|
};
|
|
78
|
+
/* istanbul ignore next */
|
|
79
|
+
|
|
78
80
|
|
|
79
81
|
this.hideScroll = () => {
|
|
80
82
|
if (this.ref && this.ref.current) {
|
|
@@ -82,6 +84,8 @@ class TabPane extends _react.PureComponent {
|
|
|
82
84
|
this.isAnimating = true;
|
|
83
85
|
}
|
|
84
86
|
};
|
|
87
|
+
/* istanbul ignore next */
|
|
88
|
+
|
|
85
89
|
|
|
86
90
|
this.autoScroll = () => {
|
|
87
91
|
if (this.ref && this.ref.current) {
|
package/lib/cjs/tabs/index.js
CHANGED
|
@@ -112,6 +112,8 @@ class Tabs extends _baseComponent.default {
|
|
|
112
112
|
this.onTabClick = (activeKey, event) => {
|
|
113
113
|
this.foundation.handleTabClick(activeKey, event);
|
|
114
114
|
};
|
|
115
|
+
/* istanbul ignore next */
|
|
116
|
+
|
|
115
117
|
|
|
116
118
|
this.rePosChildren = (children, activeKey) => {
|
|
117
119
|
const newChildren = [];
|
|
@@ -97,11 +97,11 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
97
97
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
98
98
|
prefixCls: PropTypes.Requireable<string>;
|
|
99
99
|
clearText: PropTypes.Requireable<string>;
|
|
100
|
-
value: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
100
|
+
value: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
101
101
|
inputReadOnly: PropTypes.Requireable<boolean>;
|
|
102
102
|
disabled: PropTypes.Requireable<boolean>;
|
|
103
103
|
showClear: PropTypes.Requireable<boolean>;
|
|
104
|
-
defaultValue: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
104
|
+
defaultValue: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
105
105
|
open: PropTypes.Requireable<boolean>;
|
|
106
106
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
107
107
|
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 };
|
|
@@ -18,11 +18,11 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
18
18
|
'aria-required': import("prop-types").Requireable<boolean>;
|
|
19
19
|
prefixCls: import("prop-types").Requireable<string>;
|
|
20
20
|
clearText: import("prop-types").Requireable<string>;
|
|
21
|
-
value: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
21
|
+
value: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
22
22
|
inputReadOnly: import("prop-types").Requireable<boolean>;
|
|
23
23
|
disabled: import("prop-types").Requireable<boolean>;
|
|
24
24
|
showClear: import("prop-types").Requireable<boolean>;
|
|
25
|
-
defaultValue: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
25
|
+
defaultValue: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
26
26
|
open: import("prop-types").Requireable<boolean>;
|
|
27
27
|
defaultOpen: import("prop-types").Requireable<boolean>;
|
|
28
28
|
onOpenChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
package/lib/cjs/toast/toast.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ declare class Toast extends BaseComponent<ToastReactProps, ToastState> {
|
|
|
41
41
|
close(e: React.MouseEvent): void;
|
|
42
42
|
clearCloseTimer: () => void;
|
|
43
43
|
startCloseTimer: () => void;
|
|
44
|
-
renderIcon(): true | React.
|
|
44
|
+
renderIcon(): string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment;
|
|
45
45
|
render(): JSX.Element;
|
|
46
46
|
}
|
|
47
47
|
export default Toast;
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -327,7 +327,7 @@ class Tooltip extends _baseComponent.default {
|
|
|
327
327
|
placement: props.position || 'top',
|
|
328
328
|
transitionStyle: {},
|
|
329
329
|
isPositionUpdated: false,
|
|
330
|
-
id:
|
|
330
|
+
id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
331
331
|
|
|
332
332
|
};
|
|
333
333
|
this.foundation = new _foundation.default(this.adapter);
|
|
@@ -600,6 +600,11 @@ class Tooltip extends _baseComponent.default {
|
|
|
600
600
|
},
|
|
601
601
|
notifyEscKeydown: event => {
|
|
602
602
|
this.props.onEscKeyDown(event);
|
|
603
|
+
},
|
|
604
|
+
setId: () => {
|
|
605
|
+
this.setState({
|
|
606
|
+
id: (0, _uuid.getUuidShort)()
|
|
607
|
+
});
|
|
603
608
|
}
|
|
604
609
|
});
|
|
605
610
|
}
|
|
@@ -296,7 +296,8 @@ class Transfer extends _baseComponent.default {
|
|
|
296
296
|
loading,
|
|
297
297
|
type,
|
|
298
298
|
emptyContent,
|
|
299
|
-
renderSourcePanel
|
|
299
|
+
renderSourcePanel,
|
|
300
|
+
dataSource
|
|
300
301
|
} = this.props;
|
|
301
302
|
const totalToken = locale.total;
|
|
302
303
|
const inSearchMode = inputValue !== '';
|
|
@@ -356,6 +357,7 @@ class Transfer extends _baseComponent.default {
|
|
|
356
357
|
noMatch,
|
|
357
358
|
filterData,
|
|
358
359
|
sourceData: data,
|
|
360
|
+
propsDataSource: dataSource,
|
|
359
361
|
allChecked: !leftContainesNotInSelected,
|
|
360
362
|
showNumber,
|
|
361
363
|
inputValue,
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 6 | 5>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
|
@@ -140,7 +140,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
140
140
|
style: PropTypes.Requireable<object>;
|
|
141
141
|
timeout: PropTypes.Requireable<number>;
|
|
142
142
|
transformFile: PropTypes.Requireable<(...args: any[]) => any>;
|
|
143
|
-
uploadTrigger: PropTypes.Requireable<"
|
|
143
|
+
uploadTrigger: PropTypes.Requireable<"custom" | "auto">;
|
|
144
144
|
validateMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
145
145
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
146
146
|
withCredentials: PropTypes.Requireable<boolean>;
|
|
@@ -33,6 +33,6 @@ declare class Portal extends PureComponent<PortalProps, PortalState> {
|
|
|
33
33
|
componentWillUnmount(): void;
|
|
34
34
|
addStyle: (style?: {}) => void;
|
|
35
35
|
addClass: (prefixCls: string, ...classNames: string[]) => void;
|
|
36
|
-
render():
|
|
36
|
+
render(): import("react").ReactPortal;
|
|
37
37
|
}
|
|
38
38
|
export default Portal;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -22,9 +22,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
22
22
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
23
23
|
role?: React.HTMLAttributes<HTMLSpanElement>['role'];
|
|
24
24
|
tabIndex?: number;
|
|
25
|
+
addonId?: string;
|
|
26
|
+
extraId?: string;
|
|
25
27
|
}
|
|
26
28
|
interface CheckboxState {
|
|
27
29
|
checked: boolean;
|
|
30
|
+
addonId?: string;
|
|
31
|
+
extraId?: string;
|
|
28
32
|
}
|
|
29
33
|
declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
30
34
|
static contextType: React.Context<CheckboxContextType>;
|