@douyinfe/semi-ui 2.0.9-alpha.5 → 2.1.0-beta.2
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 +584 -646
- 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 +11 -36
- 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 +5 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
- package/lib/es/form/baseForm.d.ts +11 -5
- package/lib/es/form/baseForm.js +2 -1
- package/lib/es/form/field.d.ts +23 -5
- package/lib/es/form/field.js +18 -2
- package/lib/es/form/hoc/withField.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +3 -0
- package/lib/es/locale/localeConsumer.d.ts +5 -5
- package/lib/es/modal/useModal/HookModal.d.ts +2 -3
- package/lib/es/modal/useModal/index.js +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 +0 -1
- package/lib/es/scrollList/scrollItem.d.ts +11 -12
- 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 +4 -2
- 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 +4 -10
- package/lib/es/timePicker/Combobox.js +1 -2
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/treeSelect/index.js +1 -2
- 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 +18 -3
- package/lib/es/upload/index.d.ts +57 -4
- package/package.json +8 -9
- package/lib/es/upload/interface.d.ts +0 -56
- package/lib/es/upload/interface.js +0 -1
|
@@ -16,16 +16,15 @@ import { Motion } from '../_base/base';
|
|
|
16
16
|
export interface BaseDataItem extends DataItem {
|
|
17
17
|
label?: React.ReactNode;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
19
|
+
export interface AutoCompleteProps<Item extends BaseDataItem = BaseDataItem> {
|
|
21
20
|
autoAdjustOverflow?: boolean;
|
|
22
21
|
autoFocus?: boolean;
|
|
23
22
|
className?: string;
|
|
24
23
|
children?: React.ReactNode;
|
|
25
|
-
data?:
|
|
24
|
+
data?: Array<string | Item | number>;
|
|
26
25
|
disabled?: boolean;
|
|
27
26
|
defaultOpen?: boolean;
|
|
28
|
-
defaultValue?:
|
|
27
|
+
defaultValue?: string | number | Item;
|
|
29
28
|
defaultActiveFirstOption?: boolean;
|
|
30
29
|
dropdownMatchSelectWidth?: boolean;
|
|
31
30
|
dropdownClassName?: string;
|
|
@@ -42,7 +41,7 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
42
41
|
onBlur?: (e: React.FocusEvent) => void;
|
|
43
42
|
onChange?: (value: string | number) => void;
|
|
44
43
|
onSearch?: (inputValue: string) => void;
|
|
45
|
-
onSelect?: (value:
|
|
44
|
+
onSelect?: (value: string | Item | number) => void;
|
|
46
45
|
onClear?: () => void;
|
|
47
46
|
onChangeWithObject?: boolean;
|
|
48
47
|
onSelectWithObject?: boolean;
|
|
@@ -50,8 +49,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
50
49
|
prefix?: React.ReactNode;
|
|
51
50
|
placeholder?: string;
|
|
52
51
|
position?: Position;
|
|
53
|
-
renderItem?: (option:
|
|
54
|
-
renderSelectedItem?: (option:
|
|
52
|
+
renderItem?: (option: Item | string) => React.ReactNode;
|
|
53
|
+
renderSelectedItem?: (option: Item) => string;
|
|
55
54
|
size?: 'small' | 'default' | 'large';
|
|
56
55
|
style?: React.CSSProperties;
|
|
57
56
|
suffix?: React.ReactNode;
|
|
@@ -75,7 +74,7 @@ interface AutoCompleteState {
|
|
|
75
74
|
rePosKey: number;
|
|
76
75
|
keyboardEventSet?: KeyboardEventType;
|
|
77
76
|
}
|
|
78
|
-
declare class AutoComplete
|
|
77
|
+
declare class AutoComplete extends BaseComponent<AutoCompleteProps, AutoCompleteState> {
|
|
79
78
|
static propTypes: {
|
|
80
79
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
81
80
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
@@ -119,39 +118,15 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
119
118
|
zIndex: PropTypes.Requireable<number>;
|
|
120
119
|
};
|
|
121
120
|
static Option: typeof Option;
|
|
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
|
-
};
|
|
121
|
+
static defaultProps: Partial<AutoCompleteProps>;
|
|
147
122
|
triggerRef: React.RefObject<HTMLDivElement> | null;
|
|
148
123
|
optionsRef: React.RefObject<HTMLDivElement> | null;
|
|
149
124
|
private clickOutsideHandler;
|
|
150
|
-
constructor(props: AutoCompleteProps
|
|
151
|
-
get adapter(): AutoCompleteAdapter<AutoCompleteProps
|
|
125
|
+
constructor(props: AutoCompleteProps);
|
|
126
|
+
get adapter(): AutoCompleteAdapter<AutoCompleteProps, AutoCompleteState>;
|
|
152
127
|
componentDidMount(): void;
|
|
153
128
|
componentWillUnmount(): void;
|
|
154
|
-
componentDidUpdate(prevProps: AutoCompleteProps
|
|
129
|
+
componentDidUpdate(prevProps: AutoCompleteProps, prevState: AutoCompleteState): void;
|
|
155
130
|
onSelect: (option: StateOptionItem, optionIndex: number, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
156
131
|
onSearch: (value: string) => void;
|
|
157
132
|
onBlur: (e: React.FocusEvent) => void;
|
package/lib/es/collapse/index.js
CHANGED
|
@@ -47,8 +47,12 @@ class Collapse extends BaseComponent {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
get adapter() {
|
|
50
|
+
var _this = this;
|
|
51
|
+
|
|
50
52
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
51
|
-
handleChange: (
|
|
53
|
+
handleChange: function () {
|
|
54
|
+
return _this.props.onChange(...arguments);
|
|
55
|
+
},
|
|
52
56
|
addActiveKey: activeSet => this.setState({
|
|
53
57
|
activeSet
|
|
54
58
|
})
|
|
@@ -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>;
|
|
36
|
+
monthRef: React.RefObject<ScrollItem>;
|
|
37
37
|
constructor(props: YearAndMonthProps);
|
|
38
38
|
get adapter(): YearAndMonthAdapter;
|
|
39
39
|
static getDerivedStateFromProps(props: YearAndMonthProps, state: YearAndMonthState): Partial<YearAndMonthFoundationState>;
|
|
@@ -110,19 +110,25 @@ 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, "stopPropagation" | "getPopupContainer" | "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
|
|
119
|
+
static TimePicker: React.ComponentType<import("utility-types").Subtract<import("../timePicker").TimePickerProps | (import("../timePicker").TimePickerProps & {
|
|
120
|
+
children?: React.ReactNode;
|
|
121
|
+
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
120
122
|
static Switch: React.ComponentType<import("utility-types").Subtract<import("../switch").SwitchProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
121
123
|
static Slider: React.ComponentType<import("utility-types").Subtract<import("../slider").SliderProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
122
|
-
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps
|
|
123
|
-
|
|
124
|
+
static TreeSelect: React.ComponentType<import("utility-types").Subtract<import("../treeSelect").TreeSelectProps | (import("../treeSelect").TreeSelectProps & {
|
|
125
|
+
children?: React.ReactNode;
|
|
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>;
|
|
124
130
|
static Rating: React.ComponentType<import("utility-types").Subtract<import("../rating").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
125
|
-
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").
|
|
131
|
+
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").BaseDataItem>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
126
132
|
static Upload: React.ComponentType<import("utility-types").Subtract<import("../upload").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
127
133
|
static TagInput: React.ComponentType<import("utility-types").Subtract<import("../tagInput").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
128
134
|
static Slot: (props: import("./slot").SlotProps) => JSX.Element;
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -49,7 +49,8 @@ class Form extends BaseComponent {
|
|
|
49
49
|
this.state = {
|
|
50
50
|
formId: getUuidv4()
|
|
51
51
|
};
|
|
52
|
-
warning(
|
|
52
|
+
warning( // @ts-ignore special usage
|
|
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');
|
|
53
54
|
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');
|
|
54
55
|
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');
|
|
55
56
|
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, "stopPropagation" | "getPopupContainer" | "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,11 +68,29 @@ 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
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Reasons for using ts-igonre:
|
|
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>;
|
|
74
92
|
declare const FormRating: import("react").ComponentType<import("utility-types").Subtract<import("../rating/index").RatingProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
75
|
-
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").
|
|
93
|
+
declare const FormAutoComplete: import("react").ComponentType<import("utility-types").Subtract<import("../autoComplete/index").AutoCompleteProps<import("../autoComplete/index").BaseDataItem>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
76
94
|
declare const FormUpload: import("react").ComponentType<import("utility-types").Subtract<import("../upload/index").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
77
95
|
declare const FormTagInput: import("react").ComponentType<import("utility-types").Subtract<import("../tagInput/index").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
78
96
|
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,8 +51,24 @@ const FormSwitch = withField(Switch, {
|
|
|
51
51
|
valueKey: 'checked'
|
|
52
52
|
});
|
|
53
53
|
const FormSlider = withField(Slider);
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Reasons for using ts-igonre:
|
|
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
|
+
|
|
56
72
|
const FormCascader = withField(Cascader);
|
|
57
73
|
const FormRating = withField(Rating);
|
|
58
74
|
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.ComponentType<React.ComponentProps<C>>, T extends React.ComponentType<Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps>>(Component: C, opts?: WithFieldOption): T;
|
|
12
12
|
export default withField;
|
|
@@ -5,6 +5,8 @@ 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
|
+
|
|
8
10
|
/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */
|
|
9
11
|
import React, { useState, useLayoutEffect, useMemo, useRef, forwardRef } from 'react';
|
|
10
12
|
import classNames from 'classnames';
|
|
@@ -505,6 +507,7 @@ function withField(Component, opts) {
|
|
|
505
507
|
return useMemo(() => FieldComponent, [...shouldUpdate]);
|
|
506
508
|
} else {
|
|
507
509
|
// 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
|
|
508
511
|
return FieldComponent;
|
|
509
512
|
}
|
|
510
513
|
};
|
|
@@ -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
|
|
6
|
-
export interface LocaleConsumerProps
|
|
5
|
+
declare type ChildrenRender = (componentLocal: Locale[keyof Locale], localeCode: string, dateFnsLocale: dateFns) => React.ReactNode;
|
|
6
|
+
export interface LocaleConsumerProps {
|
|
7
7
|
componentName: string;
|
|
8
|
-
children?: ChildrenRender
|
|
8
|
+
children?: ChildrenRender;
|
|
9
9
|
}
|
|
10
|
-
export default class LocaleConsumer
|
|
10
|
+
export default class LocaleConsumer extends Component<LocaleConsumerProps> {
|
|
11
11
|
static propTypes: {
|
|
12
12
|
componentName: PropTypes.Validator<string>;
|
|
13
13
|
children: PropTypes.Requireable<any>;
|
|
@@ -15,7 +15,7 @@ export default class LocaleConsumer<T> extends Component<LocaleConsumerProps<T>>
|
|
|
15
15
|
static defaultProps: {
|
|
16
16
|
componentName: string;
|
|
17
17
|
};
|
|
18
|
-
renderChildren(localeData: Locale, children: ChildrenRender
|
|
18
|
+
renderChildren(localeData: Locale, children: ChildrenRender): React.ReactNode;
|
|
19
19
|
render(): JSX.Element;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -6,9 +6,8 @@ interface HookModalProps {
|
|
|
6
6
|
config: ConfirmProps;
|
|
7
7
|
motion?: Motion;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<HookModalProps & React.RefAttributes<{
|
|
10
10
|
destroy: () => void;
|
|
11
11
|
update: (newConfig: ConfirmProps) => void;
|
|
12
|
-
}
|
|
13
|
-
declare const _default: React.ForwardRefExoticComponent<HookModalProps & React.RefAttributes<HookModalRef>>;
|
|
12
|
+
}>>;
|
|
14
13
|
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,
|
|
4
|
+
import { withConfirm, withInfo, withSuccess, withError, withWarning } from '../confirm';
|
|
5
5
|
let uuid = 0;
|
|
6
6
|
|
|
7
7
|
function usePatchElement() {
|
|
@@ -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
|
|
46
|
+
remove: (id: string) => 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(
|
|
42
|
+
this.foundation.removeNotice(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
|
|
26
|
+
onClick?: (e: React.MouseEvent, index: number) => void;
|
|
27
27
|
autoFocus?: boolean;
|
|
28
28
|
size?: 'small' | 'default' | number;
|
|
29
29
|
tooltips?: string[];
|
|
@@ -12,7 +12,6 @@ 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
|
|
16
15
|
return findDOMNode(this.childNode || this);
|
|
17
16
|
} catch (error) {
|
|
18
17
|
// swallow error if findDOMNode is run on unmounted component.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import BaseComponent from '../_base/baseComponent';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/es/scrollList/itemFoundation';
|
|
5
6
|
import { Motion } from '../_base/base';
|
|
6
|
-
|
|
7
|
-
export interface ScrollItemProps<T extends Item> {
|
|
7
|
+
export interface ScrollItemProps {
|
|
8
8
|
mode?: string;
|
|
9
9
|
cycled?: boolean;
|
|
10
|
-
list?:
|
|
10
|
+
list?: Item[];
|
|
11
11
|
selectedIndex?: number;
|
|
12
|
-
onSelect?: (data:
|
|
12
|
+
onSelect?: (data: Item) => 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
|
|
23
|
+
export default class ScrollItem extends BaseComponent<ScrollItemProps, 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<T extends Item> extends BaseComponent<ScrollItem
|
|
|
36
36
|
static defaultProps: {
|
|
37
37
|
selectedIndex: number;
|
|
38
38
|
motion: boolean;
|
|
39
|
-
list:
|
|
39
|
+
list: Item[];
|
|
40
40
|
onSelect: (...args: any[]) => void;
|
|
41
41
|
cycled: boolean;
|
|
42
42
|
mode: string;
|
|
@@ -48,12 +48,12 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
48
48
|
selector: unknown;
|
|
49
49
|
scrollAnimation: any;
|
|
50
50
|
scrolling: boolean;
|
|
51
|
-
throttledAdjustList:
|
|
52
|
-
debouncedSelect:
|
|
51
|
+
throttledAdjustList: import("lodash").DebouncedFunc<(e: any, nearestNode: any) => void>;
|
|
52
|
+
debouncedSelect: import("lodash").DebouncedFunc<(e: any, nearestNode: any) => void>;
|
|
53
53
|
constructor(props?: {});
|
|
54
|
-
get adapter(): ScrollItemAdapter<ScrollItemProps
|
|
54
|
+
get adapter(): ScrollItemAdapter<ScrollItemProps, ScrollItemState>;
|
|
55
55
|
componentDidMount(): void;
|
|
56
|
-
componentDidUpdate(prevProps: ScrollItemProps
|
|
56
|
+
componentDidUpdate(prevProps: ScrollItemProps): 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<T extends Item> extends BaseComponent<ScrollItem
|
|
|
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: Item) => boolean;
|
|
78
78
|
isWheelMode: () => boolean;
|
|
79
79
|
addClassToNode: (selectedNode: Element, selectedCls?: string) => void;
|
|
80
80
|
getIndexByNode: (node: Element) => number;
|
|
@@ -102,4 +102,3 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
102
102
|
renderInfiniteList: () => JSX.Element;
|
|
103
103
|
render(): JSX.Element;
|
|
104
104
|
}
|
|
105
|
-
export {};
|
|
@@ -21,6 +21,14 @@ 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);
|
|
24
32
|
|
|
25
33
|
this._cacheNode = (name, node) => name && node && Object.prototype.hasOwnProperty.call(this, name) && (this[name] = node);
|
|
26
34
|
|
|
@@ -386,14 +394,6 @@ export default class ScrollItem extends BaseComponent {
|
|
|
386
394
|
this.scrollAnimation = null; // cache if select action comes from outside
|
|
387
395
|
|
|
388
396
|
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 LocaleCosumer 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(LocaleCosumer, {
|
|
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 LocaleCosumer 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(LocaleCosumer, {
|
|
101
101
|
componentName: "Select"
|
|
102
102
|
}, locale => /*#__PURE__*/React.createElement("div", {
|
|
103
103
|
className: optionClassName
|
package/lib/es/select/utils.js
CHANGED
|
@@ -41,6 +41,8 @@ const generateOption = (child, parent) => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const getOptionsFromGroup = selectChildren => {
|
|
44
|
+
var _context;
|
|
45
|
+
|
|
44
46
|
let optionGroups = [];
|
|
45
47
|
let options = [];
|
|
46
48
|
const emptyGroup = {
|
|
@@ -50,8 +52,8 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
50
52
|
}; // avoid null
|
|
51
53
|
// eslint-disable-next-line max-len
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
const childNodes = _filterInstanceProperty(_context = React.Children.toArray(selectChildren)).call(_context, childNode => childNode && childNode.props);
|
|
56
|
+
|
|
55
57
|
let type = '';
|
|
56
58
|
|
|
57
59
|
_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) => void;
|
|
4
|
+
onClose?: (e: React.MouseEvent | 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
|
|
16
|
+
onCancel?: (e: React.MouseEvent) => 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:
|
|
56
|
-
handleKeyDown: (e:
|
|
55
|
+
handleCancel: (e: MouseEvent) => void;
|
|
56
|
+
handleKeyDown: (e: MouseEvent) => 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
|
|
5
|
+
import React, { cloneElement, Children, useMemo } 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 => Boolean(c));
|
|
30
30
|
|
|
31
31
|
const content = _mapInstanceProperty(Children).call(Children, filteredChildren, (child, index) => {
|
|
32
32
|
if (!child) {
|