@douyinfe/semi-ui 2.0.9-alpha.0 → 2.0.9-alpha.5
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/dist/umd/semi-ui.js +641 -579
- 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/lib/es/autoComplete/index.d.ts +36 -11
- package/lib/es/calendar/dayCalendar.js +1 -1
- package/lib/es/calendar/monthCalendar.js +1 -1
- package/lib/es/calendar/rangeCalendar.js +1 -1
- package/lib/es/calendar/weekCalendar.js +1 -1
- package/lib/es/collapse/index.js +1 -5
- package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
- package/lib/es/form/baseForm.d.ts +5 -11
- package/lib/es/form/baseForm.js +1 -2
- package/lib/es/form/field.d.ts +5 -23
- package/lib/es/form/field.js +2 -18
- package/lib/es/form/hoc/withField.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +0 -3
- package/lib/es/locale/localeConsumer.d.ts +5 -5
- package/lib/es/modal/useModal/HookModal.d.ts +3 -2
- package/lib/es/modal/useModal/index.js +1 -1
- package/lib/es/navigation/index.d.ts +1 -1
- package/lib/es/notification/index.d.ts +1 -1
- package/lib/es/notification/index.js +1 -1
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/resizeObserver/index.js +1 -0
- package/lib/es/scrollList/scrollItem.d.ts +12 -11
- package/lib/es/scrollList/scrollItem.js +8 -8
- package/lib/es/select/index.js +2 -2
- package/lib/es/select/option.js +2 -2
- package/lib/es/select/utils.js +2 -4
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/es/sideSheet/index.d.ts +3 -3
- package/lib/es/steps/basicSteps.js +2 -2
- package/lib/es/steps/fillSteps.js +3 -3
- package/lib/es/steps/navSteps.js +2 -2
- package/lib/es/tabs/TabBar.d.ts +1 -1
- package/lib/es/tabs/index.js +5 -5
- package/lib/es/timePicker/Combobox.d.ts +10 -4
- package/lib/es/timePicker/Combobox.js +2 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/toast/index.d.ts +1 -1
- package/lib/es/treeSelect/index.js +2 -1
- 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/upload/fileCard.d.ts +3 -18
- package/lib/es/upload/index.d.ts +4 -57
- package/lib/es/upload/interface.d.ts +56 -0
- package/lib/es/upload/interface.js +1 -0
- package/package.json +5 -4
|
@@ -16,15 +16,16 @@ import { Motion } from '../_base/base';
|
|
|
16
16
|
export interface BaseDataItem extends DataItem {
|
|
17
17
|
label?: React.ReactNode;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export declare type AutoCompleteItems = BaseDataItem | string | number;
|
|
20
|
+
export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
20
21
|
autoAdjustOverflow?: boolean;
|
|
21
22
|
autoFocus?: boolean;
|
|
22
23
|
className?: string;
|
|
23
24
|
children?: React.ReactNode;
|
|
24
|
-
data?:
|
|
25
|
+
data?: T[];
|
|
25
26
|
disabled?: boolean;
|
|
26
27
|
defaultOpen?: boolean;
|
|
27
|
-
defaultValue?:
|
|
28
|
+
defaultValue?: T;
|
|
28
29
|
defaultActiveFirstOption?: boolean;
|
|
29
30
|
dropdownMatchSelectWidth?: boolean;
|
|
30
31
|
dropdownClassName?: string;
|
|
@@ -41,7 +42,7 @@ export interface AutoCompleteProps<Item extends BaseDataItem = BaseDataItem> {
|
|
|
41
42
|
onBlur?: (e: React.FocusEvent) => void;
|
|
42
43
|
onChange?: (value: string | number) => void;
|
|
43
44
|
onSearch?: (inputValue: string) => void;
|
|
44
|
-
onSelect?: (value:
|
|
45
|
+
onSelect?: (value: T) => void;
|
|
45
46
|
onClear?: () => void;
|
|
46
47
|
onChangeWithObject?: boolean;
|
|
47
48
|
onSelectWithObject?: boolean;
|
|
@@ -49,8 +50,8 @@ export interface AutoCompleteProps<Item extends BaseDataItem = BaseDataItem> {
|
|
|
49
50
|
prefix?: React.ReactNode;
|
|
50
51
|
placeholder?: string;
|
|
51
52
|
position?: Position;
|
|
52
|
-
renderItem?: (option:
|
|
53
|
-
renderSelectedItem?: (option:
|
|
53
|
+
renderItem?: (option: T) => React.ReactNode;
|
|
54
|
+
renderSelectedItem?: (option: T) => string;
|
|
54
55
|
size?: 'small' | 'default' | 'large';
|
|
55
56
|
style?: React.CSSProperties;
|
|
56
57
|
suffix?: React.ReactNode;
|
|
@@ -74,7 +75,7 @@ interface AutoCompleteState {
|
|
|
74
75
|
rePosKey: number;
|
|
75
76
|
keyboardEventSet?: KeyboardEventType;
|
|
76
77
|
}
|
|
77
|
-
declare class AutoComplete extends BaseComponent<AutoCompleteProps
|
|
78
|
+
declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoCompleteProps<T>, AutoCompleteState> {
|
|
78
79
|
static propTypes: {
|
|
79
80
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
80
81
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
@@ -118,15 +119,39 @@ declare class AutoComplete extends BaseComponent<AutoCompleteProps, AutoComplete
|
|
|
118
119
|
zIndex: PropTypes.Requireable<number>;
|
|
119
120
|
};
|
|
120
121
|
static Option: typeof Option;
|
|
121
|
-
static defaultProps:
|
|
122
|
+
static defaultProps: {
|
|
123
|
+
stopPropagation: boolean;
|
|
124
|
+
motion: boolean;
|
|
125
|
+
zIndex: number;
|
|
126
|
+
position: "bottomLeft";
|
|
127
|
+
data: [];
|
|
128
|
+
showClear: boolean;
|
|
129
|
+
disabled: boolean;
|
|
130
|
+
size: "default";
|
|
131
|
+
onFocus: (...args: any[]) => void;
|
|
132
|
+
onSearch: (...args: any[]) => void;
|
|
133
|
+
onClear: (...args: any[]) => void;
|
|
134
|
+
onBlur: (...args: any[]) => void;
|
|
135
|
+
onSelect: (...args: any[]) => void;
|
|
136
|
+
onChange: (...args: any[]) => void;
|
|
137
|
+
onSelectWithObject: boolean;
|
|
138
|
+
onDropdownVisibleChange: (...args: any[]) => void;
|
|
139
|
+
defaultActiveFirstOption: boolean;
|
|
140
|
+
dropdownMatchSelectWidth: boolean;
|
|
141
|
+
loading: boolean;
|
|
142
|
+
maxHeight: number;
|
|
143
|
+
validateStatus: "default";
|
|
144
|
+
autoFocus: boolean;
|
|
145
|
+
emptyContent: null;
|
|
146
|
+
};
|
|
122
147
|
triggerRef: React.RefObject<HTMLDivElement> | null;
|
|
123
148
|
optionsRef: React.RefObject<HTMLDivElement> | null;
|
|
124
149
|
private clickOutsideHandler;
|
|
125
|
-
constructor(props: AutoCompleteProps);
|
|
126
|
-
get adapter(): AutoCompleteAdapter<AutoCompleteProps
|
|
150
|
+
constructor(props: AutoCompleteProps<T>);
|
|
151
|
+
get adapter(): AutoCompleteAdapter<AutoCompleteProps<T>, AutoCompleteState>;
|
|
127
152
|
componentDidMount(): void;
|
|
128
153
|
componentWillUnmount(): void;
|
|
129
|
-
componentDidUpdate(prevProps: AutoCompleteProps
|
|
154
|
+
componentDidUpdate(prevProps: AutoCompleteProps<T>, prevState: AutoCompleteState): void;
|
|
130
155
|
onSelect: (option: StateOptionItem, optionIndex: number, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
131
156
|
onSearch: (value: string) => void;
|
|
132
157
|
onBlur: (e: React.FocusEvent) => void;
|
package/lib/es/collapse/index.js
CHANGED
|
@@ -47,12 +47,8 @@ class Collapse extends BaseComponent {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
get adapter() {
|
|
50
|
-
var _this = this;
|
|
51
|
-
|
|
52
50
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
53
|
-
handleChange:
|
|
54
|
-
return _this.props.onChange(...arguments);
|
|
55
|
-
},
|
|
51
|
+
handleChange: (activeKey, e) => this.props.onChange(activeKey, e),
|
|
56
52
|
addActiveKey: activeSet => this.setState({
|
|
57
53
|
activeSet
|
|
58
54
|
})
|
|
@@ -32,8 +32,8 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
32
32
|
onSelect: (...args: any[]) => void;
|
|
33
33
|
};
|
|
34
34
|
foundation: YearAndMonthFoundation;
|
|
35
|
-
yearRef: React.RefObject<ScrollItem
|
|
36
|
-
monthRef: React.RefObject<ScrollItem
|
|
35
|
+
yearRef: React.RefObject<ScrollItem<YearScrollItem>>;
|
|
36
|
+
monthRef: React.RefObject<ScrollItem<MonthScrollItem>>;
|
|
37
37
|
constructor(props: YearAndMonthProps);
|
|
38
38
|
get adapter(): YearAndMonthAdapter;
|
|
39
39
|
static getDerivedStateFromProps(props: YearAndMonthProps, state: YearAndMonthState): Partial<YearAndMonthFoundationState>;
|
|
@@ -110,25 +110,19 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
110
110
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
111
111
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
112
112
|
children?: React.ReactNode;
|
|
113
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
113
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
114
114
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
115
115
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
116
116
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
|
117
117
|
static RadioGroup: React.ComponentType<import("utility-types").Subtract<import("../radio").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
118
118
|
static DatePicker: React.ComponentType<import("utility-types").Subtract<import("../datePicker").DatePickerProps & React.RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
119
|
-
static TimePicker: React.ComponentType<import("utility-types").Subtract<import("../timePicker").TimePickerProps
|
|
120
|
-
children?: React.ReactNode;
|
|
121
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
119
|
+
static TimePicker: React.ComponentType<import("utility-types").Subtract<import("../timePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
122
120
|
static Switch: React.ComponentType<import("utility-types").Subtract<import("../switch").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
123
121
|
static Slider: React.ComponentType<import("utility-types").Subtract<import("../slider").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
124
|
-
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps
|
|
125
|
-
|
|
126
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
127
|
-
static Cascader: React.ComponentType<import("utility-types").Subtract<import("../cascader").CascaderProps | (import("../cascader").CascaderProps & {
|
|
128
|
-
children?: React.ReactNode;
|
|
129
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
122
|
+
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
123
|
+
static Cascader: React.ComponentType<import("utility-types").Subtract<import("../cascader").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
130
124
|
static Rating: React.ComponentType<import("utility-types").Subtract<import("../rating").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
131
|
-
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").
|
|
125
|
+
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
132
126
|
static Upload: React.ComponentType<import("utility-types").Subtract<import("../upload").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
133
127
|
static TagInput: React.ComponentType<import("utility-types").Subtract<import("../tagInput").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
134
128
|
static Slot: (props: import("./slot").SlotProps) => JSX.Element;
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -49,8 +49,7 @@ class Form extends BaseComponent {
|
|
|
49
49
|
this.state = {
|
|
50
50
|
formId: getUuidv4()
|
|
51
51
|
};
|
|
52
|
-
warning(
|
|
53
|
-
props.component && props.render, '[Semi Form] You should not use <Form component> and <Form render> in ths same time; <Form render> will be ignored');
|
|
52
|
+
warning(Boolean(props.component && props.render), '[Semi Form] You should not use <Form component> and <Form render> in ths same time; <Form render> will be ignored');
|
|
54
53
|
warning(props.component && props.children && !isEmptyChildren(props.children), '[Semi Form] You should not use <Form component> and <Form>{children}</Form> in ths same time; <Form>{children}</Form> will be ignored');
|
|
55
54
|
warning(props.render && props.children && !isEmptyChildren(props.children), '[Semi Form] You should not use <Form render> and <Form>{children}</Form> in ths same time; <Form>{children}</Form> will be ignored');
|
|
56
55
|
this.submit = _bindInstanceProperty(_context = this.submit).call(_context, this);
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
60
60
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
61
61
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
62
62
|
children?: import("react").ReactNode;
|
|
63
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
63
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
64
64
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
65
65
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
66
66
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -68,29 +68,11 @@ declare const FormRadio: import("react").ComponentType<import("utility-types").S
|
|
|
68
68
|
declare const FormDatePicker: import("react").ComponentType<import("utility-types").Subtract<import("../datePicker/datePicker").DatePickerProps & import("react").RefAttributes<import("../datePicker/datePicker").default>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
69
69
|
declare const FormSwitch: import("react").ComponentType<import("utility-types").Subtract<import("../switch/index").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
70
70
|
declare const FormSlider: import("react").ComponentType<import("utility-types").Subtract<import("../slider/index").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* 1. TimePicker: The propTypes of the locale is defined as object (it is not necessary and too troublesome to write a complete shapeOf),
|
|
75
|
-
* but the interface defines a complete type, the two cannot match, and ts will report an error, so skip it here.
|
|
76
|
-
*
|
|
77
|
-
* 2. Cascader: treeData { label, value } define in PropTypes.shapeOf alreaady declare isRequired, ts still throw error
|
|
78
|
-
* 【Property is optional in type “InferProps<{ value: Validator<string | number>; label: Validator<any>; }>” but required in type CascaderData】
|
|
79
|
-
* skip it here.
|
|
80
|
-
* 3. TreeSelect: value same as cascader, skip it here
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
declare const FormTimePicker: import("react").ComponentType<import("utility-types").Subtract<import("../timePicker/TimePicker").TimePickerProps | (import("../timePicker/TimePicker").TimePickerProps & {
|
|
84
|
-
children?: import("react").ReactNode;
|
|
85
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
86
|
-
declare const FormTreeSelect: import("react").ComponentType<import("utility-types").Subtract<import("../treeSelect/index").TreeSelectProps | (import("../treeSelect/index").TreeSelectProps & {
|
|
87
|
-
children?: import("react").ReactNode;
|
|
88
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
89
|
-
declare const FormCascader: import("react").ComponentType<import("utility-types").Subtract<import("../cascader/index").CascaderProps | (import("../cascader/index").CascaderProps & {
|
|
90
|
-
children?: import("react").ReactNode;
|
|
91
|
-
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
71
|
+
declare const FormTimePicker: import("react").ComponentType<import("utility-types").Subtract<import("../timePicker/TimePicker").TimePickerProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
72
|
+
declare const FormTreeSelect: import("react").ComponentType<import("utility-types").Subtract<import("../treeSelect/index").TreeSelectProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
73
|
+
declare const FormCascader: import("react").ComponentType<import("utility-types").Subtract<import("../cascader/index").CascaderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
92
74
|
declare const FormRating: import("react").ComponentType<import("utility-types").Subtract<import("../rating/index").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
93
|
-
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").
|
|
75
|
+
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
94
76
|
declare const FormUpload: import("react").ComponentType<import("utility-types").Subtract<import("../upload/index").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
95
77
|
declare const FormTagInput: import("react").ComponentType<import("utility-types").Subtract<import("../tagInput/index").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
96
78
|
export { FormInput, FormInputNumber, FormTextArea, FormSelect, FormCheckboxGroup, FormCheckbox, FormRadioGroup, FormRadio, FormDatePicker, FormSwitch, FormSlider, FormTimePicker, FormTreeSelect, FormCascader, FormRating, FormAutoComplete, FormUpload, FormTagInput };
|
package/lib/es/form/field.js
CHANGED
|
@@ -51,24 +51,8 @@ const FormSwitch = withField(Switch, {
|
|
|
51
51
|
valueKey: 'checked'
|
|
52
52
|
});
|
|
53
53
|
const FormSlider = withField(Slider);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
* 1. TimePicker: The propTypes of the locale is defined as object (it is not necessary and too troublesome to write a complete shapeOf),
|
|
58
|
-
* but the interface defines a complete type, the two cannot match, and ts will report an error, so skip it here.
|
|
59
|
-
*
|
|
60
|
-
* 2. Cascader: treeData { label, value } define in PropTypes.shapeOf alreaady declare isRequired, ts still throw error
|
|
61
|
-
* 【Property is optional in type “InferProps<{ value: Validator<string | number>; label: Validator<any>; }>” but required in type CascaderData】
|
|
62
|
-
* skip it here.
|
|
63
|
-
* 3. TreeSelect: value same as cascader, skip it here
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
// @ts-ignore-next-line
|
|
67
|
-
|
|
68
|
-
const FormTimePicker = withField(TimePicker); // @ts-ignore-next-line
|
|
69
|
-
|
|
70
|
-
const FormTreeSelect = withField(TreeSelect); // @ts-ignore-next-line
|
|
71
|
-
|
|
54
|
+
const FormTimePicker = withField(TimePicker);
|
|
55
|
+
const FormTreeSelect = withField(TreeSelect);
|
|
72
56
|
const FormCascader = withField(Cascader);
|
|
73
57
|
const FormRating = withField(Rating);
|
|
74
58
|
const FormAutoComplete = withField(AutoComplete, {
|
|
@@ -8,5 +8,5 @@ import { Subtract } from 'utility-types';
|
|
|
8
8
|
* 2. Insert <Label>
|
|
9
9
|
* 3. Insert <ErrorMessage>
|
|
10
10
|
*/
|
|
11
|
-
declare function withField<C extends React.
|
|
11
|
+
declare function withField<C extends React.ElementType, T extends Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps, R extends React.ComponentType<T>>(Component: C, opts?: WithFieldOption): R;
|
|
12
12
|
export default withField;
|
|
@@ -5,8 +5,6 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
5
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
6
6
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
7
7
|
|
|
8
|
-
/* argus-disable unPkgSensitiveInfo */
|
|
9
|
-
|
|
10
8
|
/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */
|
|
11
9
|
import React, { useState, useLayoutEffect, useMemo, useRef, forwardRef } from 'react';
|
|
12
10
|
import classNames from 'classnames';
|
|
@@ -507,7 +505,6 @@ function withField(Component, opts) {
|
|
|
507
505
|
return useMemo(() => FieldComponent, [...shouldUpdate]);
|
|
508
506
|
} else {
|
|
509
507
|
// Some Custom Component with inner state shouldn't be memo, otherwise the component will not updated when the internal state is updated
|
|
510
|
-
// Fixed issue 328
|
|
511
508
|
return FieldComponent;
|
|
512
509
|
}
|
|
513
510
|
};
|
|
@@ -2,12 +2,12 @@ import React, { Component } from 'react';
|
|
|
2
2
|
import { Locale as dateFns } from 'date-fns';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { Locale } from './interface';
|
|
5
|
-
declare type ChildrenRender = (componentLocal:
|
|
6
|
-
export interface LocaleConsumerProps {
|
|
5
|
+
declare type ChildrenRender<T> = (componentLocal: T, localeCode: string, dateFnsLocale: dateFns) => React.ReactNode;
|
|
6
|
+
export interface LocaleConsumerProps<T> {
|
|
7
7
|
componentName: string;
|
|
8
|
-
children?: ChildrenRender
|
|
8
|
+
children?: ChildrenRender<T>;
|
|
9
9
|
}
|
|
10
|
-
export default class LocaleConsumer extends Component<LocaleConsumerProps
|
|
10
|
+
export default class LocaleConsumer<T> extends Component<LocaleConsumerProps<T>> {
|
|
11
11
|
static propTypes: {
|
|
12
12
|
componentName: PropTypes.Validator<string>;
|
|
13
13
|
children: PropTypes.Requireable<any>;
|
|
@@ -15,7 +15,7 @@ export default class LocaleConsumer extends Component<LocaleConsumerProps> {
|
|
|
15
15
|
static defaultProps: {
|
|
16
16
|
componentName: string;
|
|
17
17
|
};
|
|
18
|
-
renderChildren(localeData: Locale, children: ChildrenRender): React.ReactNode;
|
|
18
|
+
renderChildren(localeData: Locale, children: ChildrenRender<T>): React.ReactNode;
|
|
19
19
|
render(): JSX.Element;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -6,8 +6,9 @@ interface HookModalProps {
|
|
|
6
6
|
config: ConfirmProps;
|
|
7
7
|
motion?: Motion;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
export interface HookModalRef {
|
|
10
10
|
destroy: () => void;
|
|
11
11
|
update: (newConfig: ConfirmProps) => void;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
declare const _default: React.ForwardRefExoticComponent<HookModalProps & React.RefAttributes<HookModalRef>>;
|
|
13
14
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import HookModal from './HookModal';
|
|
4
|
-
import { withConfirm, withInfo, withSuccess,
|
|
4
|
+
import { withConfirm, withError, withInfo, withSuccess, withWarning } from '../confirm';
|
|
5
5
|
let uuid = 0;
|
|
6
6
|
|
|
7
7
|
function usePatchElement() {
|
|
@@ -7,7 +7,7 @@ import Item, { NavItemProps } from './Item';
|
|
|
7
7
|
import Footer, { NavFooterProps } from './Footer';
|
|
8
8
|
import Header, { NavHeaderProps } from './Header';
|
|
9
9
|
import '@douyinfe/semi-foundation/lib/es/navigation/navigation.css';
|
|
10
|
-
import { Motion } from '_base/base';
|
|
10
|
+
import { Motion } from '../_base/base';
|
|
11
11
|
export { CollapseButtonProps } from './CollapseButton';
|
|
12
12
|
export { NavFooterProps } from './Footer';
|
|
13
13
|
export { NavHeaderProps } from './Header';
|
|
@@ -43,7 +43,7 @@ declare class NotificationList extends BaseComponent<NotificationListProps, Noti
|
|
|
43
43
|
static destroyAll(): void;
|
|
44
44
|
static config(opts: ConfigProps): void;
|
|
45
45
|
add: (noticeOpts: NoticeProps) => any;
|
|
46
|
-
remove: (id: string) => void;
|
|
46
|
+
remove: (id: string | number) => void;
|
|
47
47
|
destroyAll: () => any;
|
|
48
48
|
renderNoticeInPosition: (notices: NoticeInstance[], position: NoticePosition, removedItems?: NoticeInstance[]) => JSX.Element;
|
|
49
49
|
setPosInStyle(noticeInstance: NoticeInstance): {};
|
|
@@ -39,7 +39,7 @@ class NotificationList extends BaseComponent {
|
|
|
39
39
|
this.add = noticeOpts => this.foundation.addNotice(noticeOpts);
|
|
40
40
|
|
|
41
41
|
this.remove = id => {
|
|
42
|
-
this.foundation.removeNotice(id);
|
|
42
|
+
this.foundation.removeNotice(String(id));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
this.destroyAll = () => this.foundation.destroyAll();
|
package/lib/es/rating/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface RatingProps {
|
|
|
23
23
|
onFocus?: (e: React.FocusEvent) => void;
|
|
24
24
|
onBlur?: (e: React.FocusEvent) => void;
|
|
25
25
|
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
26
|
-
onClick?: (e: React.MouseEvent, index: number) => void;
|
|
26
|
+
onClick?: (e: React.MouseEvent | React.KeyboardEvent, index: number) => void;
|
|
27
27
|
autoFocus?: boolean;
|
|
28
28
|
size?: 'small' | 'default' | number;
|
|
29
29
|
tooltips?: string[];
|
|
@@ -12,6 +12,7 @@ export default class ReactResizeObserver extends BaseComponent {
|
|
|
12
12
|
// using findDOMNode for two reasons:
|
|
13
13
|
// 1. cloning to insert a ref is unwieldy and not performant.
|
|
14
14
|
// 2. ensure that we resolve to an actual DOM node (instead of any JSX ref instance).
|
|
15
|
+
// eslint-disable-next-line
|
|
15
16
|
return findDOMNode(this.childNode || this);
|
|
16
17
|
} catch (error) {
|
|
17
18
|
// swallow error if findDOMNode is run on unmounted component.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import BaseComponent from '../_base/baseComponent';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/es/scrollList/itemFoundation';
|
|
6
5
|
import { Motion } from '../_base/base';
|
|
7
|
-
|
|
6
|
+
declare type DebounceSelectFn = (e: React.UIEvent, newSelectedNode: HTMLElement) => void;
|
|
7
|
+
export interface ScrollItemProps<T extends Item> {
|
|
8
8
|
mode?: string;
|
|
9
9
|
cycled?: boolean;
|
|
10
|
-
list?:
|
|
10
|
+
list?: T[];
|
|
11
11
|
selectedIndex?: number;
|
|
12
|
-
onSelect?: (data:
|
|
12
|
+
onSelect?: (data: T) => void;
|
|
13
13
|
transform?: (value: any, text: string) => string;
|
|
14
14
|
className?: string;
|
|
15
15
|
motion?: Motion;
|
|
@@ -20,7 +20,7 @@ export interface ScrollItemState {
|
|
|
20
20
|
prependCount: number;
|
|
21
21
|
appendCount: number;
|
|
22
22
|
}
|
|
23
|
-
export default class ScrollItem extends BaseComponent<ScrollItemProps
|
|
23
|
+
export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItemProps<T>, ScrollItemState> {
|
|
24
24
|
static propTypes: {
|
|
25
25
|
mode: PropTypes.Requireable<string>;
|
|
26
26
|
cycled: PropTypes.Requireable<boolean>;
|
|
@@ -36,7 +36,7 @@ export default class ScrollItem extends BaseComponent<ScrollItemProps, ScrollIte
|
|
|
36
36
|
static defaultProps: {
|
|
37
37
|
selectedIndex: number;
|
|
38
38
|
motion: boolean;
|
|
39
|
-
list:
|
|
39
|
+
list: readonly [];
|
|
40
40
|
onSelect: (...args: any[]) => void;
|
|
41
41
|
cycled: boolean;
|
|
42
42
|
mode: string;
|
|
@@ -48,12 +48,12 @@ export default class ScrollItem extends BaseComponent<ScrollItemProps, ScrollIte
|
|
|
48
48
|
selector: unknown;
|
|
49
49
|
scrollAnimation: any;
|
|
50
50
|
scrolling: boolean;
|
|
51
|
-
throttledAdjustList:
|
|
52
|
-
debouncedSelect:
|
|
51
|
+
throttledAdjustList: DebounceSelectFn;
|
|
52
|
+
debouncedSelect: DebounceSelectFn;
|
|
53
53
|
constructor(props?: {});
|
|
54
|
-
get adapter(): ScrollItemAdapter<ScrollItemProps,
|
|
54
|
+
get adapter(): ScrollItemAdapter<ScrollItemProps<T>, ScrollItemState, T>;
|
|
55
55
|
componentDidMount(): void;
|
|
56
|
-
componentDidUpdate(prevProps: ScrollItemProps): void;
|
|
56
|
+
componentDidUpdate(prevProps: ScrollItemProps<T>): void;
|
|
57
57
|
_cacheNode: (name: string, node: Element) => Element;
|
|
58
58
|
_cacheSelectedNode: (selectedNode: Element) => Element;
|
|
59
59
|
_cacheWillSelectNode: (node: Element) => Element;
|
|
@@ -74,7 +74,7 @@ export default class ScrollItem extends BaseComponent<ScrollItemProps, ScrollIte
|
|
|
74
74
|
indexIsSame: (index1: number, index2: number) => boolean;
|
|
75
75
|
isDisabledIndex: (index: number) => boolean;
|
|
76
76
|
isDisabledNode: (node: Element) => boolean;
|
|
77
|
-
isDisabledData: (data:
|
|
77
|
+
isDisabledData: (data: T) => boolean;
|
|
78
78
|
isWheelMode: () => boolean;
|
|
79
79
|
addClassToNode: (selectedNode: Element, selectedCls?: string) => void;
|
|
80
80
|
getIndexByNode: (node: Element) => number;
|
|
@@ -102,3 +102,4 @@ export default class ScrollItem extends BaseComponent<ScrollItemProps, ScrollIte
|
|
|
102
102
|
renderInfiniteList: () => JSX.Element;
|
|
103
103
|
render(): JSX.Element;
|
|
104
104
|
}
|
|
105
|
+
export {};
|
|
@@ -21,14 +21,6 @@ export default class ScrollItem extends BaseComponent {
|
|
|
21
21
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
22
|
super(props);
|
|
23
23
|
_this = this;
|
|
24
|
-
this.throttledAdjustList = throttle((e, nearestNode) => {
|
|
25
|
-
this.foundation.adjustInfiniteList(this.list, this.wrapper, nearestNode);
|
|
26
|
-
}, msPerFrame);
|
|
27
|
-
this.debouncedSelect = debounce((e, nearestNode) => {
|
|
28
|
-
this._cacheSelectedNode(nearestNode);
|
|
29
|
-
|
|
30
|
-
this.foundation.selectNode(nearestNode, this.list);
|
|
31
|
-
}, msPerFrame * 5);
|
|
32
24
|
|
|
33
25
|
this._cacheNode = (name, node) => name && node && Object.prototype.hasOwnProperty.call(this, name) && (this[name] = node);
|
|
34
26
|
|
|
@@ -394,6 +386,14 @@ export default class ScrollItem extends BaseComponent {
|
|
|
394
386
|
this.scrollAnimation = null; // cache if select action comes from outside
|
|
395
387
|
|
|
396
388
|
this.foundation = new ItemFoundation(this.adapter);
|
|
389
|
+
this.throttledAdjustList = throttle((e, nearestNode) => {
|
|
390
|
+
this.foundation.adjustInfiniteList(this.list, this.wrapper, nearestNode);
|
|
391
|
+
}, msPerFrame);
|
|
392
|
+
this.debouncedSelect = debounce((e, nearestNode) => {
|
|
393
|
+
this._cacheSelectedNode(nearestNode);
|
|
394
|
+
|
|
395
|
+
this.foundation.selectNode(nearestNode, this.list);
|
|
396
|
+
}, msPerFrame * 5);
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
get adapter() {
|
package/lib/es/select/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
25
25
|
import { isEqual, isString, noop } from 'lodash-es';
|
|
26
26
|
import Tag from '../tag/index';
|
|
27
27
|
import TagGroup from '../tag/group';
|
|
28
|
-
import
|
|
28
|
+
import LocaleConsumer from '../locale/localeConsumer';
|
|
29
29
|
import Popover from '../popover/index';
|
|
30
30
|
import { numbers as popoverNumbers } from '@douyinfe/semi-foundation/lib/es/popover/constants';
|
|
31
31
|
import { FixedSizeList as List } from 'react-window';
|
|
@@ -474,7 +474,7 @@ class Select extends BaseComponent {
|
|
|
474
474
|
}, option, {
|
|
475
475
|
focused: isFocused,
|
|
476
476
|
style: style
|
|
477
|
-
}), /*#__PURE__*/React.createElement(
|
|
477
|
+
}), /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
478
478
|
componentName: "Select"
|
|
479
479
|
}, locale => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
480
480
|
className: "".concat(prefixcls, "-create-tips")
|
package/lib/es/select/option.js
CHANGED
|
@@ -20,7 +20,7 @@ import classNames from 'classnames';
|
|
|
20
20
|
import PropTypes from 'prop-types';
|
|
21
21
|
import { isString } from 'lodash-es';
|
|
22
22
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/select/constants';
|
|
23
|
-
import
|
|
23
|
+
import LocaleConsumer from '../locale/localeConsumer';
|
|
24
24
|
import { IconTick } from '@douyinfe/semi-icons';
|
|
25
25
|
import { getHighLightTextHTML } from '../_utils/index';
|
|
26
26
|
|
|
@@ -97,7 +97,7 @@ class Option extends PureComponent {
|
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return /*#__PURE__*/React.createElement(
|
|
100
|
+
return /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
101
101
|
componentName: "Select"
|
|
102
102
|
}, locale => /*#__PURE__*/React.createElement("div", {
|
|
103
103
|
className: optionClassName
|
package/lib/es/select/utils.js
CHANGED
|
@@ -41,8 +41,6 @@ const generateOption = (child, parent) => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const getOptionsFromGroup = selectChildren => {
|
|
44
|
-
var _context;
|
|
45
|
-
|
|
46
44
|
let optionGroups = [];
|
|
47
45
|
let options = [];
|
|
48
46
|
const emptyGroup = {
|
|
@@ -52,8 +50,8 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
52
50
|
}; // avoid null
|
|
53
51
|
// eslint-disable-next-line max-len
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
let childNodes = React.Children.toArray(selectChildren);
|
|
54
|
+
childNodes = _filterInstanceProperty(childNodes).call(childNodes, childNode => childNode && childNode.props);
|
|
57
55
|
let type = '';
|
|
58
56
|
|
|
59
57
|
_forEachInstanceProperty(childNodes).call(childNodes, child => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export interface SideSheetContentProps {
|
|
4
|
-
onClose?: (e: React.MouseEvent
|
|
4
|
+
onClose?: (e: React.MouseEvent) => void;
|
|
5
5
|
mask?: boolean;
|
|
6
6
|
maskStyle?: CSSProperties;
|
|
7
7
|
maskClosable?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface SideSheetReactProps extends SideSheetProps {
|
|
|
13
13
|
title?: React.ReactNode;
|
|
14
14
|
footer?: React.ReactNode;
|
|
15
15
|
children?: React.ReactNode;
|
|
16
|
-
onCancel?: (e: React.MouseEvent) => void;
|
|
16
|
+
onCancel?: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
17
17
|
}
|
|
18
18
|
export { SideSheetState };
|
|
19
19
|
export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSheetState> {
|
|
@@ -52,8 +52,8 @@ export default class SideSheet extends BaseComponent<SideSheetReactProps, SideSh
|
|
|
52
52
|
componentDidMount(): void;
|
|
53
53
|
componentDidUpdate(prevProps: SideSheetReactProps, prevState: SideSheetState, snapshot: any): void;
|
|
54
54
|
componentWillUnmount(): void;
|
|
55
|
-
handleCancel: (e: MouseEvent) => void;
|
|
56
|
-
handleKeyDown: (e:
|
|
55
|
+
handleCancel: (e: React.MouseEvent) => void;
|
|
56
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
57
57
|
renderContent(): JSX.Element;
|
|
58
58
|
render(): JSX.Element;
|
|
59
59
|
}
|
|
@@ -2,7 +2,7 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
3
3
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
4
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
|
-
import React, { cloneElement, Children, useMemo } from 'react';
|
|
5
|
+
import React, { cloneElement, Children, useMemo, isValidElement } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import cls from 'classnames';
|
|
8
8
|
import { stepsClasses as css } from '@douyinfe/semi-foundation/lib/es/steps/constants';
|
|
@@ -26,7 +26,7 @@ const Steps = props => {
|
|
|
26
26
|
const inner = useMemo(() => {
|
|
27
27
|
var _context;
|
|
28
28
|
|
|
29
|
-
const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c =>
|
|
29
|
+
const filteredChildren = _filterInstanceProperty(_context = Children.toArray(children)).call(_context, c => /*#__PURE__*/isValidElement(c));
|
|
30
30
|
|
|
31
31
|
const content = _mapInstanceProperty(Children).call(Children, filteredChildren, (child, index) => {
|
|
32
32
|
if (!child) {
|