@douyinfe/semi-ui 2.0.8 → 2.0.9-alpha.4
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 +759 -652
- 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/index.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/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/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.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/interface.d.ts +2 -1
- 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 +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 +6 -5
|
@@ -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
|
})
|
|
@@ -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';
|
|
@@ -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 {};
|
|
@@ -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/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.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")
|
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
|
}
|
package/lib/es/slider/index.js
CHANGED
|
@@ -399,6 +399,7 @@ export default class Slider extends BaseComponent {
|
|
|
399
399
|
},
|
|
400
400
|
onHandleMove: function (mousePos, isMin) {
|
|
401
401
|
let stateChangeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
|
|
402
|
+
let clickTrack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
402
403
|
|
|
403
404
|
const sliderDOMIsInRenderTree = _this.foundation.checkAndUpdateIsInRenderTreeState();
|
|
404
405
|
|
|
@@ -426,7 +427,8 @@ export default class Slider extends BaseComponent {
|
|
|
426
427
|
if (!isEqual(_this.foundation.outPutValue(currentValue), outPutValue)) {
|
|
427
428
|
onChange(outPutValue);
|
|
428
429
|
|
|
429
|
-
if (_this.foundation.valueFormatIsCorrect(value)) {
|
|
430
|
+
if (!clickTrack && _this.foundation.valueFormatIsCorrect(value)) {
|
|
431
|
+
// still require afterChangeCallback when click on the track directly, need skip here
|
|
430
432
|
return false;
|
|
431
433
|
}
|
|
432
434
|
|
package/lib/es/spin/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface SpinProps {
|
|
|
8
8
|
spinning?: boolean;
|
|
9
9
|
indicator?: React.ReactNode;
|
|
10
10
|
delay?: number;
|
|
11
|
-
tip?:
|
|
11
|
+
tip?: React.ReactNode;
|
|
12
12
|
wrapperClassName?: string;
|
|
13
13
|
style?: React.CSSProperties;
|
|
14
14
|
childStyle?: React.CSSProperties;
|
|
@@ -25,7 +25,7 @@ declare class Spin extends BaseComponent<SpinProps, SpinState> {
|
|
|
25
25
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
26
|
indicator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
27
|
delay: PropTypes.Requireable<number>;
|
|
28
|
-
tip: PropTypes.Requireable<
|
|
28
|
+
tip: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
29
29
|
wrapperClassName: PropTypes.Requireable<string>;
|
|
30
30
|
childStyle: PropTypes.Requireable<object>;
|
|
31
31
|
style: PropTypes.Requireable<object>;
|
package/lib/es/spin/index.js
CHANGED
|
@@ -107,7 +107,7 @@ Spin.propTypes = {
|
|
|
107
107
|
children: PropTypes.node,
|
|
108
108
|
indicator: PropTypes.node,
|
|
109
109
|
delay: PropTypes.number,
|
|
110
|
-
tip: PropTypes.
|
|
110
|
+
tip: PropTypes.node,
|
|
111
111
|
wrapperClassName: PropTypes.string,
|
|
112
112
|
childStyle: PropTypes.object,
|
|
113
113
|
style: PropTypes.object
|