@douyinfe/semi-ui 2.0.7 → 2.0.9-alpha.3
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/css/semi.css +153 -5
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +776 -672
- 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 -12
- package/lib/es/autoComplete/index.js +0 -1
- 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/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/index.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +1 -2
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/hoc/withField.d.ts +2 -2
- package/lib/es/form/hoc/withField.js +5 -1
- package/lib/es/form/interface.d.ts +2 -2
- package/lib/es/locale/localeConsumer.d.ts +5 -5
- package/lib/es/modal/Modal.d.ts +1 -0
- package/lib/es/modal/Modal.js +23 -26
- 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 +2 -2
- package/lib/es/notification/index.js +1 -1
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/radio/radioGroup.d.ts +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 +8 -8
- package/lib/es/select/index.d.ts +0 -1
- package/lib/es/select/index.js +2 -3
- 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/slider/index.js +3 -1
- package/lib/es/spin/index.d.ts +2 -2
- package/lib/es/spin/index.js +1 -1
- 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/table/Table.d.ts +1 -1
- package/lib/es/table/interface.d.ts +2 -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 +2 -2
- 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/typography/title.d.ts +1 -1
- package/lib/es/upload/fileCard.d.ts +3 -18
- package/lib/es/upload/index.d.ts +4 -56
- package/lib/es/upload/interface.d.ts +56 -0
- package/lib/es/upload/interface.js +1 -0
- package/package.json +9 -8
|
@@ -5,7 +5,6 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
|
5
5
|
import { Position } from '../tooltip';
|
|
6
6
|
import Option from '../select/option';
|
|
7
7
|
import '@douyinfe/semi-foundation/lib/es/autoComplete/autoComplete.css';
|
|
8
|
-
import '@douyinfe/semi-foundation/lib/es/select/option.css';
|
|
9
8
|
import { Motion } from '../_base/base';
|
|
10
9
|
/**
|
|
11
10
|
* AutoComplete is an enhanced Input (candidates suggest that users can choose or not),
|
|
@@ -17,15 +16,16 @@ import { Motion } from '../_base/base';
|
|
|
17
16
|
export interface BaseDataItem extends DataItem {
|
|
18
17
|
label?: React.ReactNode;
|
|
19
18
|
}
|
|
20
|
-
export
|
|
19
|
+
export declare type AutoCompleteItems = BaseDataItem | string | number;
|
|
20
|
+
export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
21
21
|
autoAdjustOverflow?: boolean;
|
|
22
22
|
autoFocus?: boolean;
|
|
23
23
|
className?: string;
|
|
24
24
|
children?: React.ReactNode;
|
|
25
|
-
data?:
|
|
25
|
+
data?: T[];
|
|
26
26
|
disabled?: boolean;
|
|
27
27
|
defaultOpen?: boolean;
|
|
28
|
-
defaultValue?:
|
|
28
|
+
defaultValue?: T;
|
|
29
29
|
defaultActiveFirstOption?: boolean;
|
|
30
30
|
dropdownMatchSelectWidth?: boolean;
|
|
31
31
|
dropdownClassName?: string;
|
|
@@ -42,7 +42,7 @@ export interface AutoCompleteProps<Item extends BaseDataItem = BaseDataItem> {
|
|
|
42
42
|
onBlur?: (e: React.FocusEvent) => void;
|
|
43
43
|
onChange?: (value: string | number) => void;
|
|
44
44
|
onSearch?: (inputValue: string) => void;
|
|
45
|
-
onSelect?: (value:
|
|
45
|
+
onSelect?: (value: T) => void;
|
|
46
46
|
onClear?: () => void;
|
|
47
47
|
onChangeWithObject?: boolean;
|
|
48
48
|
onSelectWithObject?: boolean;
|
|
@@ -50,8 +50,8 @@ export interface AutoCompleteProps<Item extends BaseDataItem = BaseDataItem> {
|
|
|
50
50
|
prefix?: React.ReactNode;
|
|
51
51
|
placeholder?: string;
|
|
52
52
|
position?: Position;
|
|
53
|
-
renderItem?: (option:
|
|
54
|
-
renderSelectedItem?: (option:
|
|
53
|
+
renderItem?: (option: T) => React.ReactNode;
|
|
54
|
+
renderSelectedItem?: (option: T) => string;
|
|
55
55
|
size?: 'small' | 'default' | 'large';
|
|
56
56
|
style?: React.CSSProperties;
|
|
57
57
|
suffix?: React.ReactNode;
|
|
@@ -75,7 +75,7 @@ interface AutoCompleteState {
|
|
|
75
75
|
rePosKey: number;
|
|
76
76
|
keyboardEventSet?: KeyboardEventType;
|
|
77
77
|
}
|
|
78
|
-
declare class AutoComplete extends BaseComponent<AutoCompleteProps
|
|
78
|
+
declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoCompleteProps<T>, AutoCompleteState> {
|
|
79
79
|
static propTypes: {
|
|
80
80
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
81
81
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
@@ -119,15 +119,39 @@ declare class AutoComplete extends BaseComponent<AutoCompleteProps, AutoComplete
|
|
|
119
119
|
zIndex: PropTypes.Requireable<number>;
|
|
120
120
|
};
|
|
121
121
|
static Option: typeof Option;
|
|
122
|
-
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
|
+
};
|
|
123
147
|
triggerRef: React.RefObject<HTMLDivElement> | null;
|
|
124
148
|
optionsRef: React.RefObject<HTMLDivElement> | null;
|
|
125
149
|
private clickOutsideHandler;
|
|
126
|
-
constructor(props: AutoCompleteProps);
|
|
127
|
-
get adapter(): AutoCompleteAdapter<AutoCompleteProps
|
|
150
|
+
constructor(props: AutoCompleteProps<T>);
|
|
151
|
+
get adapter(): AutoCompleteAdapter<AutoCompleteProps<T>, AutoCompleteState>;
|
|
128
152
|
componentDidMount(): void;
|
|
129
153
|
componentWillUnmount(): void;
|
|
130
|
-
componentDidUpdate(prevProps: AutoCompleteProps
|
|
154
|
+
componentDidUpdate(prevProps: AutoCompleteProps<T>, prevState: AutoCompleteState): void;
|
|
131
155
|
onSelect: (option: StateOptionItem, optionIndex: number, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
132
156
|
onSearch: (value: string) => void;
|
|
133
157
|
onBlur: (e: React.FocusEvent) => void;
|
|
@@ -21,7 +21,6 @@ import Trigger from '../trigger';
|
|
|
21
21
|
import Option from '../select/option';
|
|
22
22
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
23
23
|
import '@douyinfe/semi-foundation/lib/es/autoComplete/autoComplete.css';
|
|
24
|
-
import '@douyinfe/semi-foundation/lib/es/select/option.css';
|
|
25
24
|
const prefixCls = cssClasses.PREFIX;
|
|
26
25
|
const sizeSet = strings.SIZE;
|
|
27
26
|
const positionSet = strings.POSITION;
|
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
|
})
|
|
@@ -24,7 +24,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
24
24
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
25
|
value: PropTypes.Requireable<any[]>;
|
|
26
26
|
disabled: PropTypes.Requireable<boolean>;
|
|
27
|
-
type: PropTypes.Requireable<"
|
|
27
|
+
type: PropTypes.Requireable<"date" | "dateTime" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
28
28
|
multiple: PropTypes.Requireable<boolean>;
|
|
29
29
|
showClear: PropTypes.Requireable<boolean>;
|
|
30
30
|
format: PropTypes.Requireable<string>;
|
|
@@ -29,7 +29,7 @@ export declare type DatePickerState = DatePickerFoundationState;
|
|
|
29
29
|
export default class DatePicker extends BaseComponent<DatePickerProps, DatePickerState> {
|
|
30
30
|
static contextType: React.Context<import("../configProvider/context").ContextValue>;
|
|
31
31
|
static propTypes: {
|
|
32
|
-
type: PropTypes.Requireable<"
|
|
32
|
+
type: PropTypes.Requireable<"date" | "dateTime" | "month" | "dateRange" | "year" | "dateTimeRange">;
|
|
33
33
|
size: PropTypes.Requireable<"default" | "small" | "large">;
|
|
34
34
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
35
35
|
defaultValue: PropTypes.Requireable<string | number | object>;
|
|
@@ -8,4 +8,4 @@ export { QuickControlProps } from './quickControl';
|
|
|
8
8
|
export { YearAndMonthProps } from './yearAndMonth';
|
|
9
9
|
declare const _default: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<DatePicker>>;
|
|
10
10
|
export default _default;
|
|
11
|
-
export { BaseValueType, DayStatusType, DisabledDateOptions, DisabledDateType, DisabledTimeType, InputSize, Position, PresetType, PresetsType, TriggerRenderProps, ValidateStatus, ValueType, } from '@douyinfe/semi-foundation/datePicker/foundation';
|
|
11
|
+
export { BaseValueType, DayStatusType, DisabledDateOptions, DisabledDateType, DisabledTimeType, InputSize, Position, PresetType, PresetsType, TriggerRenderProps, ValidateStatus, ValueType, } from '@douyinfe/semi-foundation/lib/es/datePicker/foundation';
|
|
@@ -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" | "dateTime" | "month" | "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>;
|
|
@@ -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>;
|
|
@@ -128,7 +128,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
128
128
|
children?: React.ReactNode;
|
|
129
129
|
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
130
130
|
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").
|
|
131
|
+
static AutoComplete: React.ComponentType<import("utility-types").Subtract<import("../autoComplete").AutoCompleteProps<import("../autoComplete").AutoCompleteItems>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
132
132
|
static Upload: React.ComponentType<import("utility-types").Subtract<import("../upload").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
133
133
|
static TagInput: React.ComponentType<import("utility-types").Subtract<import("../tagInput").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
134
134
|
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
|
@@ -90,7 +90,7 @@ declare const FormCascader: import("react").ComponentType<import("utility-types"
|
|
|
90
90
|
children?: import("react").ReactNode;
|
|
91
91
|
}), import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
92
92
|
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").
|
|
93
|
+
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
94
|
declare const FormUpload: import("react").ComponentType<import("utility-types").Subtract<import("../upload/index").UploadProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
95
95
|
declare const FormTagInput: import("react").ComponentType<import("utility-types").Subtract<import("../tagInput/index").TagInputProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
96
96
|
export { FormInput, FormInputNumber, FormTextArea, FormSelect, FormCheckboxGroup, FormCheckbox, FormRadioGroup, FormRadio, FormDatePicker, FormSwitch, FormSlider, FormTimePicker, FormTreeSelect, FormCascader, FormRating, FormAutoComplete, FormUpload, FormTagInput };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
|
|
3
3
|
import { CommonFieldProps, CommonexcludeType } from '../interface';
|
|
4
4
|
import { Subtract } from 'utility-types';
|
|
5
5
|
/**
|
|
@@ -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.ComponentType<React.ComponentProps<C>>, T extends React.ComponentType<Subtract<React.ComponentProps<C>, CommonexcludeType> & CommonFieldProps>>(Component: C, opts?:
|
|
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;
|
|
@@ -507,10 +507,14 @@ function withField(Component, opts) {
|
|
|
507
507
|
return useMemo(() => FieldComponent, [...shouldUpdate]);
|
|
508
508
|
} else {
|
|
509
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
|
|
511
510
|
return FieldComponent;
|
|
512
511
|
}
|
|
513
512
|
};
|
|
513
|
+
/**
|
|
514
|
+
* Reasons for using ts-igonre: skip strict check of ref
|
|
515
|
+
*/
|
|
516
|
+
// @ts-ignore-next-line
|
|
517
|
+
|
|
514
518
|
|
|
515
519
|
SemiField = /*#__PURE__*/forwardRef(SemiField);
|
|
516
520
|
SemiField.displayName = getDisplayName(Component);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Subtract } from 'utility-types';
|
|
3
3
|
import type { RuleItem } from 'async-validator';
|
|
4
4
|
import { Options as scrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
5
|
-
import { BaseFormApi as FormApi, FormState } from '@douyinfe/semi-foundation/lib/es/form/interface';
|
|
5
|
+
import { BaseFormApi as FormApi, FormState, WithFieldOption } from '@douyinfe/semi-foundation/lib/es/form/interface';
|
|
6
6
|
import { SelectProps } from '../select/index';
|
|
7
7
|
import Option from '../select/option';
|
|
8
8
|
import OptGroup from '../select/optionGroup';
|
|
@@ -10,7 +10,7 @@ import { CheckboxProps } from '../checkbox/index';
|
|
|
10
10
|
import { RadioProps } from '../radio/index';
|
|
11
11
|
import { ReactFieldError as FieldError } from './errorMessage';
|
|
12
12
|
import { LabelProps } from './label';
|
|
13
|
-
export { FormState, FormApi };
|
|
13
|
+
export { FormState, FormApi, WithFieldOption };
|
|
14
14
|
export declare type CommonFieldProps = {
|
|
15
15
|
/** Field is required (except Form. Checkbox within the Group, Form. Radio) */
|
|
16
16
|
field: string;
|
|
@@ -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 {};
|
package/lib/es/modal/Modal.d.ts
CHANGED
|
@@ -125,6 +125,7 @@ declare class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
125
125
|
componentWillUnmount(): void;
|
|
126
126
|
handleCancel: (e: React.MouseEvent) => void;
|
|
127
127
|
handleOk: (e: React.MouseEvent) => void;
|
|
128
|
+
updateHiddenState: () => void;
|
|
128
129
|
renderFooter: () => ReactNode;
|
|
129
130
|
renderDialog: () => JSX.Element;
|
|
130
131
|
render(): JSX.Element;
|
package/lib/es/modal/Modal.js
CHANGED
|
@@ -45,6 +45,21 @@ class Modal extends BaseComponent {
|
|
|
45
45
|
this.foundation.handleOk(e);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
this.updateHiddenState = () => {
|
|
49
|
+
const {
|
|
50
|
+
visible
|
|
51
|
+
} = this.props;
|
|
52
|
+
const {
|
|
53
|
+
hidden
|
|
54
|
+
} = this.state;
|
|
55
|
+
|
|
56
|
+
if (!visible && !hidden) {
|
|
57
|
+
this.foundation.toggleHidden(true, () => this.foundation.afterClose());
|
|
58
|
+
} else if (visible && this.state.hidden) {
|
|
59
|
+
this.foundation.toggleHidden(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
48
63
|
this.renderFooter = () => {
|
|
49
64
|
const {
|
|
50
65
|
okText,
|
|
@@ -123,7 +138,7 @@ class Modal extends BaseComponent {
|
|
|
123
138
|
}
|
|
124
139
|
|
|
125
140
|
const classList = cls(className, {
|
|
126
|
-
["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.hidden
|
|
141
|
+
["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.hidden && !visible
|
|
127
142
|
});
|
|
128
143
|
const contentClassName = motion ? cls({
|
|
129
144
|
["".concat(cssClasses.DIALOG, "-content-animate-hide")]: !visible,
|
|
@@ -133,19 +148,6 @@ class Modal extends BaseComponent {
|
|
|
133
148
|
["".concat(cssClasses.DIALOG, "-mask-animate-hide")]: !visible,
|
|
134
149
|
["".concat(cssClasses.DIALOG, "-mask-animate-show")]: visible
|
|
135
150
|
}) : null;
|
|
136
|
-
|
|
137
|
-
const updateHiddenState = () => {
|
|
138
|
-
if (!visible && !this.state.hidden) {
|
|
139
|
-
this.foundation.toggleHidden(true);
|
|
140
|
-
} else if (visible && this.state.hidden) {
|
|
141
|
-
this.foundation.toggleHidden(false);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
if (!motion) {
|
|
146
|
-
updateHiddenState();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
151
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
150
152
|
style: wrapperStyle,
|
|
151
153
|
getPopupContainer: getPopupContainer
|
|
@@ -159,7 +161,7 @@ class Modal extends BaseComponent {
|
|
|
159
161
|
style: style,
|
|
160
162
|
ref: this.modalRef,
|
|
161
163
|
onAnimationEnd: () => {
|
|
162
|
-
updateHiddenState();
|
|
164
|
+
this.updateHiddenState();
|
|
163
165
|
},
|
|
164
166
|
footer: renderFooter,
|
|
165
167
|
onClose: this.handleCancel
|
|
@@ -212,11 +214,11 @@ class Modal extends BaseComponent {
|
|
|
212
214
|
notifyClose: () => {
|
|
213
215
|
this.props.afterClose();
|
|
214
216
|
},
|
|
215
|
-
toggleHidden: hidden => {
|
|
217
|
+
toggleHidden: (hidden, callback) => {
|
|
216
218
|
if (hidden !== this.state.hidden) {
|
|
217
219
|
this.setState({
|
|
218
220
|
hidden
|
|
219
|
-
});
|
|
221
|
+
}, callback || noop);
|
|
220
222
|
}
|
|
221
223
|
},
|
|
222
224
|
notifyFullScreen: isFullScreen => {
|
|
@@ -232,17 +234,8 @@ class Modal extends BaseComponent {
|
|
|
232
234
|
static getDerivedStateFromProps(props, prevState) {
|
|
233
235
|
const newState = {};
|
|
234
236
|
|
|
235
|
-
if (props.visible && prevState.hidden) {
|
|
236
|
-
newState.hidden = false;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
237
|
if (props.fullScreen !== prevState.isFullScreen) {
|
|
240
238
|
newState.isFullScreen = props.fullScreen;
|
|
241
|
-
} // if not using animation, need to update hidden state from props
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (!props.visible && !props.motion && !prevState.hidden) {
|
|
245
|
-
newState.hidden = true;
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
return newState;
|
|
@@ -276,6 +269,10 @@ class Modal extends BaseComponent {
|
|
|
276
269
|
if (prevProps.visible && !this.props.visible) {
|
|
277
270
|
this.foundation.afterHide();
|
|
278
271
|
}
|
|
272
|
+
|
|
273
|
+
if (!this.props.motion) {
|
|
274
|
+
this.updateHiddenState();
|
|
275
|
+
}
|
|
279
276
|
}
|
|
280
277
|
|
|
281
278
|
componentWillUnmount() {
|
|
@@ -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';
|
|
@@ -9,7 +9,7 @@ export { NoticeTransitionProps } from './NoticeTransition';
|
|
|
9
9
|
export interface NoticeReactProps extends NoticeProps {
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
}
|
|
12
|
-
export { NoticeState, NotificationListProps, NotificationListState };
|
|
12
|
+
export { NoticeState, NotificationListProps, NotificationListState, ConfigProps };
|
|
13
13
|
export declare type NoticesInPosition = {
|
|
14
14
|
top: NoticeInstance[];
|
|
15
15
|
topLeft: NoticeInstance[];
|
|
@@ -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/radio/radio.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
65
65
|
prefixCls?: string;
|
|
66
66
|
name?: string;
|
|
67
67
|
onChange?: (e: RadioChangeEvent) => void;
|
|
68
|
-
buttonSize?: "small" | "
|
|
68
|
+
buttonSize?: "small" | "large" | "middle";
|
|
69
69
|
isCardRadio?: boolean;
|
|
70
70
|
isPureCardRadio?: boolean;
|
|
71
71
|
};
|
|
@@ -40,7 +40,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
|
|
|
40
40
|
disabled: PropTypes.Requireable<boolean>;
|
|
41
41
|
name: PropTypes.Requireable<string>;
|
|
42
42
|
options: PropTypes.Requireable<any[]>;
|
|
43
|
-
buttonSize: PropTypes.Requireable<"small" | "
|
|
43
|
+
buttonSize: PropTypes.Requireable<"small" | "large" | "middle">;
|
|
44
44
|
type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
|
|
45
45
|
value: PropTypes.Requireable<any>;
|
|
46
46
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
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.
|
|
@@ -4,12 +4,12 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/es/scrollList/itemFoundation';
|
|
6
6
|
import { Motion } from '../_base/base';
|
|
7
|
-
export interface ScrollItemProps {
|
|
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;
|
|
@@ -51,9 +51,9 @@ export default class ScrollItem extends BaseComponent<ScrollItemProps, ScrollIte
|
|
|
51
51
|
throttledAdjustList: import("lodash").DebouncedFunc<(e: any, nearestNode: any) => void>;
|
|
52
52
|
debouncedSelect: import("lodash").DebouncedFunc<(e: any, nearestNode: any) => void>;
|
|
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;
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
|
5
5
|
import Option, { OptionProps } from './option';
|
|
6
6
|
import OptionGroup from './optionGroup';
|
|
7
7
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
8
|
-
import '@douyinfe/semi-foundation/lib/es/select/option.css';
|
|
9
8
|
import { Position, TooltipProps } from '../tooltip';
|
|
10
9
|
export { OptionProps } from './option';
|
|
11
10
|
export { OptionGroupProps } from './optionGroup';
|
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';
|
|
@@ -40,7 +40,6 @@ import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
|
|
|
40
40
|
import { isSemiIcon } from '../_utils';
|
|
41
41
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
42
42
|
import '@douyinfe/semi-foundation/lib/es/select/select.css';
|
|
43
|
-
import '@douyinfe/semi-foundation/lib/es/select/option.css';
|
|
44
43
|
const prefixcls = cssClasses.PREFIX;
|
|
45
44
|
const key = 0; // Notes: Use the label of the option as the identifier, that is, the option in Select, the value is allowed to be the same, but the label must be unique
|
|
46
45
|
|
|
@@ -475,7 +474,7 @@ class Select extends BaseComponent {
|
|
|
475
474
|
}, option, {
|
|
476
475
|
focused: isFocused,
|
|
477
476
|
style: style
|
|
478
|
-
}), /*#__PURE__*/React.createElement(
|
|
477
|
+
}), /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
479
478
|
componentName: "Select"
|
|
480
479
|
}, locale => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
481
480
|
className: "".concat(prefixcls, "-create-tips")
|