mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
eliminate any
type in exported interfaces.#14044
This commit is contained in:
parent
cb4a86ae29
commit
f1ee189bd2
@ -1,4 +1,5 @@
|
||||
// https://github.com/moment/moment/issues/3650
|
||||
// since we are using ts 3.5.1, it should be safe to remove.
|
||||
export default function interopDefault(m: any) {
|
||||
return m.default || m;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ export interface AnchorLinkProps {
|
||||
prefixCls?: string;
|
||||
href: string;
|
||||
title: React.ReactNode;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
|
||||
export interface InputElementProps {
|
||||
children: React.ReactElement<any>;
|
||||
children: React.ReactElement<unknown>;
|
||||
}
|
||||
|
||||
export default class InputElement extends React.Component<InputElementProps, any> {
|
||||
|
@ -17,8 +17,8 @@ export type DataSourceItemType =
|
||||
| React.ReactElement<OptGroupProps>;
|
||||
|
||||
export interface AutoCompleteInputProps {
|
||||
onChange?: React.FormEventHandler<any>;
|
||||
value: any;
|
||||
onChange?: React.FormEventHandler<unknown>;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
export type ValidInputElement =
|
||||
@ -34,7 +34,7 @@ export interface AutoCompleteProps extends AbstractSelectProps {
|
||||
backfill?: boolean;
|
||||
optionLabelProp?: string;
|
||||
onChange?: (value: SelectValue) => void;
|
||||
onSelect?: (value: SelectValue, option: Object) => any;
|
||||
onSelect?: (value: SelectValue, option: Object) => unknown;
|
||||
onBlur?: (value: SelectValue) => void;
|
||||
onFocus?: () => void;
|
||||
children?:
|
||||
|
@ -20,7 +20,7 @@ export interface AvatarProps {
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
alt?: string;
|
||||
/* callback when img load error */
|
||||
/* return false to prevent Avatar show default fallback behavior, then you can do fallback by your self*/
|
||||
|
@ -25,7 +25,7 @@ function getDefaultTarget() {
|
||||
|
||||
export interface BackTopProps {
|
||||
visibilityHeight?: number;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
target?: () => HTMLElement | Window;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
|
@ -22,7 +22,7 @@ export interface ScrollNumberProps {
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
count?: string | number | null;
|
||||
displayComponent?: React.ReactElement<any>;
|
||||
displayComponent?: React.ReactElement<HTMLElement>;
|
||||
component?: string;
|
||||
onAnimated?: Function;
|
||||
style?: React.CSSProperties;
|
||||
|
@ -17,12 +17,12 @@ export interface Route {
|
||||
export interface BreadcrumbProps {
|
||||
prefixCls?: string;
|
||||
routes?: Route[];
|
||||
params?: any;
|
||||
params?: unknown;
|
||||
separator?: React.ReactNode;
|
||||
itemRender?: (
|
||||
route: any,
|
||||
params: any,
|
||||
routes: Array<any>,
|
||||
route: Route,
|
||||
params: unknown,
|
||||
routes: Array<Route>,
|
||||
paths: Array<string>,
|
||||
) => React.ReactNode;
|
||||
style?: React.CSSProperties;
|
||||
@ -72,21 +72,21 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
}
|
||||
|
||||
getPath = (path: string, params: any) => {
|
||||
path = (path || '').replace(/^\//, '');
|
||||
Object.keys(params).forEach(key => {
|
||||
path = path.replace(`:${key}`, params[key]);
|
||||
});
|
||||
return path;
|
||||
}
|
||||
path = (path || '').replace(/^\//, '');
|
||||
Object.keys(params).forEach(key => {
|
||||
path = path.replace(`:${key}`, params[key]);
|
||||
});
|
||||
return path;
|
||||
};
|
||||
|
||||
addChildPath = (paths: string[], childPath: string = '', params: any) => {
|
||||
const originalPaths = [...paths];
|
||||
const path = this.getPath(childPath, params);
|
||||
if (path) {
|
||||
originalPaths.push(path);
|
||||
originalPaths.push(path);
|
||||
}
|
||||
return originalPaths;
|
||||
}
|
||||
};
|
||||
|
||||
genForRoutes = ({
|
||||
routes = [],
|
||||
@ -107,12 +107,10 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
|
||||
overlay = (
|
||||
<Menu>
|
||||
{route.children.map(child => (
|
||||
<Menu.Item key={child.breadcrumbName || child.path}>
|
||||
{
|
||||
itemRender(child, params, routes, this.addChildPath(paths, child.path, params))
|
||||
}
|
||||
</Menu.Item>
|
||||
))}
|
||||
<Menu.Item key={child.breadcrumbName || child.path}>
|
||||
{itemRender(child, params, routes, this.addChildPath(paths, child.path, params))}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
@ -91,15 +91,15 @@ export interface BaseButtonProps {
|
||||
export type AnchorButtonProps = {
|
||||
href: string;
|
||||
target?: string;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
} & BaseButtonProps &
|
||||
Omit<React.AnchorHTMLAttributes<any>, 'type'>;
|
||||
Omit<React.AnchorHTMLAttributes<unknown>, 'type' | 'onClick'>;
|
||||
|
||||
export type NativeButtonProps = {
|
||||
htmlType?: ButtonHTMLType;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
} & BaseButtonProps &
|
||||
Omit<React.ButtonHTMLAttributes<any>, 'type'>;
|
||||
Omit<React.ButtonHTMLAttributes<unknown>, 'type' | 'onClick'>;
|
||||
|
||||
export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
|
||||
|
||||
@ -289,7 +289,7 @@ class Button extends React.Component<ButtonProps, ButtonState> {
|
||||
|
||||
const buttonNode = (
|
||||
<button
|
||||
{...otherProps as NativeButtonProps}
|
||||
{...(otherProps as NativeButtonProps)}
|
||||
type={htmlType}
|
||||
className={classes}
|
||||
onClick={this.handleClick}
|
||||
|
@ -138,7 +138,7 @@ export default class Header extends React.Component<HeaderProps, any> {
|
||||
};
|
||||
|
||||
onInternalTypeChange = (e: RadioChangeEvent) => {
|
||||
this.onTypeChange(e.target.value);
|
||||
this.onTypeChange(e.target.value as string);
|
||||
};
|
||||
|
||||
onTypeChange = (type: string) => {
|
||||
|
@ -15,12 +15,12 @@ export interface AbstractCheckboxProps<T> {
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
onChange?: (e: T) => void;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
onMouseEnter?: React.MouseEventHandler<any>;
|
||||
onMouseLeave?: React.MouseEventHandler<any>;
|
||||
onKeyPress?: React.KeyboardEventHandler<any>;
|
||||
onKeyDown?: React.KeyboardEventHandler<any>;
|
||||
value?: any;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
||||
onKeyPress?: React.KeyboardEventHandler<HTMLElement>;
|
||||
onKeyDown?: React.KeyboardEventHandler<HTMLElement>;
|
||||
value?: unknown;
|
||||
tabIndex?: number;
|
||||
name?: string;
|
||||
children?: React.ReactNode;
|
||||
|
@ -39,7 +39,7 @@ export interface CheckboxGroupState {
|
||||
export interface CheckboxGroupContext {
|
||||
checkboxGroup: {
|
||||
toggleOption: (option: CheckboxOptionType) => void;
|
||||
value: any;
|
||||
value: unknown;
|
||||
disabled: boolean;
|
||||
};
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export interface CollapseProps {
|
||||
className?: string;
|
||||
bordered?: boolean;
|
||||
prefixCls?: string;
|
||||
expandIcon?: (panelProps: any) => React.ReactNode;
|
||||
expandIcon?: (panelProps: PanelProps) => React.ReactNode;
|
||||
expandIconPosition?: ExpandIconPosition;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export interface CommentProps {
|
||||
/** The main content of the comment */
|
||||
content: React.ReactNode;
|
||||
/** Nested comments should be provided as children of the Comment */
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
/** Comment prefix defaults to '.ant-comment' */
|
||||
prefixCls?: string;
|
||||
/** Additional style for the comment */
|
||||
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import Icon from '../icon';
|
||||
import classNames from 'classnames';
|
||||
|
||||
export default function InputIcon(props: { suffixIcon: any; prefixCls: string }) {
|
||||
export default function InputIcon(props: { suffixIcon: React.ReactNode; prefixCls: string }) {
|
||||
const { suffixIcon, prefixCls } = props;
|
||||
return (
|
||||
(suffixIcon &&
|
||||
|
@ -16,7 +16,7 @@ export interface PickerProps {
|
||||
style?: React.CSSProperties;
|
||||
popupStyle?: React.CSSProperties;
|
||||
dropdownClassName?: string;
|
||||
locale?: any;
|
||||
locale?: unknown;
|
||||
size?: 'large' | 'small' | 'default';
|
||||
getCalendarContainer?: (triggerNode: Element) => HTMLElement;
|
||||
open?: boolean;
|
||||
|
@ -21,7 +21,7 @@ export interface DropdownButtonProps extends ButtonGroupProps, DropDownProps {
|
||||
*/
|
||||
icon?: React.ReactNode;
|
||||
href?: string;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export default class DropdownButton extends React.Component<DropdownButtonProps, any> {
|
||||
|
@ -13,15 +13,15 @@ import { FIELD_META_PROP, FIELD_DATA_PROP } from './constants';
|
||||
import { FormContext } from './context';
|
||||
import { FormWrappedProps } from './interface';
|
||||
|
||||
type FormCreateOptionMessagesCallback = (...args: any[]) => string;
|
||||
type FormCreateOptionMessagesCallback = (...args: unknown[]) => string;
|
||||
|
||||
interface FormCreateOptionMessages {
|
||||
[messageId: string]: string | FormCreateOptionMessagesCallback | FormCreateOptionMessages;
|
||||
}
|
||||
|
||||
export interface FormCreateOption<T> {
|
||||
onFieldsChange?: (props: T, fields: any, allFields: any) => void;
|
||||
onValuesChange?: (props: T, changedValues: any, allValues: any) => void;
|
||||
onFieldsChange?: (props: T, fields: unknown, allFields: unknown) => void;
|
||||
onValuesChange?: (props: T, changedValues: unknown, allValues: unknown) => void;
|
||||
mapPropsToFields?: (props: T) => void;
|
||||
validateMessages?: FormCreateOptionMessages;
|
||||
withRef?: boolean;
|
||||
@ -34,7 +34,7 @@ export type FormLayout = (typeof FormLayouts)[number];
|
||||
export interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
||||
layout?: FormLayout;
|
||||
form?: WrappedFormUtils;
|
||||
onSubmit?: React.FormEventHandler<any>;
|
||||
onSubmit?: React.FormEventHandler<HTMLElement>;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
prefixCls?: string;
|
||||
@ -71,24 +71,30 @@ export type ValidationRule = {
|
||||
/** validate from a regular expression */
|
||||
pattern?: RegExp;
|
||||
/** transform a value before validation */
|
||||
transform?: (value: any) => any;
|
||||
transform?: (value: unknown) => unknown;
|
||||
/** custom validate function (Note: callback must be called) */
|
||||
validator?: (rule: any, value: any, callback: any, source?: any, options?: any) => any;
|
||||
validator?: (
|
||||
rule: unknown,
|
||||
value: unknown,
|
||||
callback: unknown,
|
||||
source?: unknown,
|
||||
options?: unknown,
|
||||
) => unknown;
|
||||
};
|
||||
|
||||
export type ValidateCallback<V> = (errors: any, values: V) => void;
|
||||
export type ValidateCallback<V> = (errors: unknown, values: V) => void;
|
||||
|
||||
export type GetFieldDecoratorOptions = {
|
||||
/** 子节点的值的属性,如 Checkbox 的是 'checked' */
|
||||
valuePropName?: string;
|
||||
/** 子节点的初始值,类型、可选值均由子节点决定 */
|
||||
initialValue?: any;
|
||||
initialValue?: unknown;
|
||||
/** 收集子节点的值的时机 */
|
||||
trigger?: string;
|
||||
/** 可以把 onChange 的参数转化为控件的值,例如 DatePicker 可设为:(date, dateString) => dateString */
|
||||
getValueFromEvent?: (...args: any[]) => any;
|
||||
getValueFromEvent?: (...args: unknown[]) => unknown;
|
||||
/** Get the component props according to field value. */
|
||||
getValueProps?: (value: any) => any;
|
||||
getValueProps?: (value: unknown) => unknown;
|
||||
/** 校验子节点值的时机 */
|
||||
validateTrigger?: string | string[];
|
||||
/** 校验规则,参见 [async-validator](https://github.com/yiminghe/async-validator) */
|
||||
@ -96,7 +102,7 @@ export type GetFieldDecoratorOptions = {
|
||||
/** 是否和其他控件互斥,特别用于 Radio 单选控件 */
|
||||
exclusive?: boolean;
|
||||
/** Normalize value to form component */
|
||||
normalize?: (value: any, prevValue: any, allValues: any) => any;
|
||||
normalize?: (value: unknown, prevValue: unknown, allValues: unknown) => unknown;
|
||||
/** Whether stop validate on first rule of error for this field. */
|
||||
validateFirst?: boolean;
|
||||
/** 是否一直保留子节点的信息 */
|
||||
@ -135,11 +141,11 @@ export type ValidateFieldsOptions = {
|
||||
};
|
||||
|
||||
// function create
|
||||
export type WrappedFormUtils<V = any> = {
|
||||
export type WrappedFormUtils<V = unknown> = {
|
||||
/** 获取一组输入控件的值,如不传入参数,则获取全部组件的值 */
|
||||
getFieldsValue(fieldNames?: Array<string>): { [field: string]: any };
|
||||
getFieldsValue(fieldNames?: Array<string>): { [field: string]: unknown };
|
||||
/** 获取一个输入控件的值 */
|
||||
getFieldValue(fieldName: string): any;
|
||||
getFieldValue(fieldName: string): unknown;
|
||||
/** 设置一组输入控件的值 */
|
||||
setFieldsValue(obj: Object): void;
|
||||
/** 设置一组输入控件的值 */
|
||||
@ -186,15 +192,17 @@ export type WrappedFormUtils<V = any> = {
|
||||
): (node: React.ReactNode) => React.ReactNode;
|
||||
};
|
||||
|
||||
export interface WrappedFormInternalProps<V = any> {
|
||||
export interface WrappedFormInternalProps<V = unknown> {
|
||||
form: WrappedFormUtils<V>;
|
||||
}
|
||||
|
||||
export interface RcBaseFormProps {
|
||||
wrappedComponentRef?: any;
|
||||
wrappedComponentRef?: unknown;
|
||||
}
|
||||
|
||||
export interface FormComponentProps<V = any> extends WrappedFormInternalProps<V>, RcBaseFormProps {
|
||||
export interface FormComponentProps<V = unknown>
|
||||
extends WrappedFormInternalProps<V>,
|
||||
RcBaseFormProps {
|
||||
form: WrappedFormUtils<V>;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ const customCache = new Set<string>();
|
||||
|
||||
export interface CustomIconOptions {
|
||||
scriptUrl?: string;
|
||||
extraCommonProps?: { [key: string]: any };
|
||||
extraCommonProps?: { [key: string]: unknown };
|
||||
}
|
||||
|
||||
export default function create(options: CustomIconOptions = {}): React.SFC<IconProps> {
|
||||
|
@ -5,7 +5,7 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
export interface GroupProps {
|
||||
className?: string;
|
||||
size?: 'large' | 'small' | 'default';
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
style?: React.CSSProperties;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLSpanElement>;
|
||||
|
@ -10,7 +10,7 @@ export interface SearchProps extends InputProps {
|
||||
onSearch?: (
|
||||
value: string,
|
||||
event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLInputElement>,
|
||||
) => any;
|
||||
) => void;
|
||||
enterButton?: boolean | React.ReactNode;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ export interface ListProps<T> {
|
||||
loadMore?: React.ReactNode;
|
||||
pagination?: PaginationConfig | false;
|
||||
prefixCls?: string;
|
||||
rowKey?: any;
|
||||
rowKey?: ((item: T) => string) | string;
|
||||
renderItem?: (item: T, index: number) => React.ReactNode;
|
||||
size?: ListSize;
|
||||
split?: boolean;
|
||||
|
@ -5,7 +5,7 @@ import defaultLocaleData from './default';
|
||||
export interface LocaleReceiverProps {
|
||||
componentName?: string;
|
||||
defaultLocale?: object | Function;
|
||||
children: (locale: object, localeCode?: string) => React.ReactElement<any>;
|
||||
children: (locale: object, localeCode?: string) => React.ReactNode;
|
||||
}
|
||||
|
||||
interface LocaleInterface {
|
||||
|
@ -8,18 +8,20 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
export type MentionPlacement = 'top' | 'bottom';
|
||||
|
||||
type SuggestionItme = React.ReactElement<{ value?: string }> | string;
|
||||
|
||||
export interface MentionProps {
|
||||
prefixCls?: string;
|
||||
suggestionStyle?: React.CSSProperties;
|
||||
defaultSuggestions?: Array<any>;
|
||||
suggestions?: Array<any>;
|
||||
onSearchChange?: (value: string, trigger: string) => any;
|
||||
onChange?: (contentState: any) => any;
|
||||
notFoundContent?: any;
|
||||
defaultSuggestions?: Array<SuggestionItme>;
|
||||
suggestions?: Array<React.ReactElement<unknown>>;
|
||||
onSearchChange?: (value: string, trigger: string) => unknown;
|
||||
onChange?: (contentState: unknown) => void;
|
||||
notFoundContent?: unknown;
|
||||
loading?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
defaultValue?: any;
|
||||
value?: any;
|
||||
defaultValue?: unknown;
|
||||
value?: unknown;
|
||||
className?: string;
|
||||
multiLines?: boolean;
|
||||
prefix?: string | string[];
|
||||
@ -27,14 +29,14 @@ export interface MentionProps {
|
||||
getSuggestionContainer?: (triggerNode: Element) => HTMLElement;
|
||||
onFocus?: React.FocusEventHandler<HTMLElement>;
|
||||
onBlur?: React.FocusEventHandler<HTMLElement>;
|
||||
onSelect?: (suggestion: string, data?: any) => any;
|
||||
onSelect?: (suggestion: string, data?: unknown) => void;
|
||||
readOnly?: boolean;
|
||||
disabled?: boolean;
|
||||
placement?: MentionPlacement;
|
||||
}
|
||||
|
||||
export interface MentionState {
|
||||
filteredSuggestions?: Array<any>;
|
||||
filteredSuggestions?: Array<unknown>;
|
||||
focus?: Boolean;
|
||||
}
|
||||
|
||||
@ -81,12 +83,13 @@ class Mention extends React.Component<MentionProps, MentionState> {
|
||||
defaultSearchChange(value: string): void {
|
||||
const searchValue = value.toLowerCase();
|
||||
const filteredSuggestions = (this.props.defaultSuggestions || []).filter(suggestion => {
|
||||
if (suggestion.type && suggestion.type === Nav) {
|
||||
if (typeof suggestion === 'string') {
|
||||
return suggestion.toLowerCase().indexOf(searchValue) !== -1;
|
||||
} else if (suggestion.type && suggestion.type === Nav) {
|
||||
return suggestion.props.value
|
||||
? suggestion.props.value.toLowerCase().indexOf(searchValue) !== -1
|
||||
: true;
|
||||
}
|
||||
return suggestion.toLowerCase().indexOf(searchValue) !== -1;
|
||||
});
|
||||
this.setState({
|
||||
filteredSuggestions,
|
||||
|
@ -19,7 +19,7 @@ export type MentionPlacement = 'top' | 'bottom';
|
||||
export interface OptionProps {
|
||||
value: string;
|
||||
children: React.ReactNode;
|
||||
[key: string]: any;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface MentionProps extends RcMentionsProps {
|
||||
@ -49,28 +49,26 @@ class Mentions extends React.Component<MentionProps, MentionState> {
|
||||
|
||||
return value
|
||||
.split(split)
|
||||
.map(
|
||||
(str = ''): MentionsEntity | null => {
|
||||
let hitPrefix: string | null = null;
|
||||
.map((str = ''): MentionsEntity | null => {
|
||||
let hitPrefix: string | null = null;
|
||||
|
||||
prefixList.some(prefixStr => {
|
||||
const startStr = str.slice(0, prefixStr.length);
|
||||
if (startStr === prefixStr) {
|
||||
hitPrefix = prefixStr;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hitPrefix !== null) {
|
||||
return {
|
||||
prefix: hitPrefix,
|
||||
value: str.slice(hitPrefix!.length),
|
||||
};
|
||||
prefixList.some(prefixStr => {
|
||||
const startStr = str.slice(0, prefixStr.length);
|
||||
if (startStr === prefixStr) {
|
||||
hitPrefix = prefixStr;
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
)
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hitPrefix !== null) {
|
||||
return {
|
||||
prefix: hitPrefix,
|
||||
value: str.slice(hitPrefix!.length),
|
||||
};
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((entity): entity is MentionsEntity => !!entity && !!entity.value);
|
||||
};
|
||||
|
||||
|
@ -15,16 +15,16 @@ import raf from '../_util/raf';
|
||||
export interface SelectParam {
|
||||
key: string;
|
||||
keyPath: Array<string>;
|
||||
item: any;
|
||||
domEvent: any;
|
||||
item: unknown;
|
||||
domEvent: Event;
|
||||
selectedKeys: Array<string>;
|
||||
}
|
||||
|
||||
export interface ClickParam {
|
||||
key: string;
|
||||
keyPath: Array<string>;
|
||||
item: any;
|
||||
domEvent: any;
|
||||
item: unknown;
|
||||
domEvent: Event;
|
||||
}
|
||||
|
||||
export type MenuMode = 'vertical' | 'vertical-left' | 'vertical-right' | 'horizontal' | 'inline';
|
||||
|
@ -39,13 +39,13 @@ function getMessageInstance(callback: (i: any) => void) {
|
||||
type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
|
||||
|
||||
export interface ThenableArgument {
|
||||
(_: any): any;
|
||||
(val: unknown): void;
|
||||
}
|
||||
|
||||
export interface MessageType {
|
||||
(): void;
|
||||
then: (fill: ThenableArgument, reject: ThenableArgument) => Promise<any>;
|
||||
promise: Promise<any>;
|
||||
then: (fill: ThenableArgument, reject: ThenableArgument) => Promise<void>;
|
||||
promise: Promise<void>;
|
||||
}
|
||||
|
||||
export interface ArgsProps {
|
||||
|
@ -40,9 +40,9 @@ export interface ModalProps {
|
||||
/** 是否显示右上角的关闭按钮*/
|
||||
closable?: boolean;
|
||||
/** 点击确定回调*/
|
||||
onOk?: (e: React.MouseEvent<any>) => void;
|
||||
onOk?: (e: React.MouseEvent<HTMLElement>) => void;
|
||||
/** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调*/
|
||||
onCancel?: (e: React.MouseEvent<any>) => void;
|
||||
onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
|
||||
afterClose?: () => void;
|
||||
/** 垂直居中 */
|
||||
centered?: boolean;
|
||||
@ -74,7 +74,7 @@ export interface ModalProps {
|
||||
maskStyle?: React.CSSProperties;
|
||||
mask?: boolean;
|
||||
keyboard?: boolean;
|
||||
wrapProps?: any;
|
||||
wrapProps?: unknown;
|
||||
prefixCls?: string;
|
||||
}
|
||||
|
||||
@ -84,8 +84,9 @@ export interface ModalFuncProps {
|
||||
visible?: boolean;
|
||||
title?: React.ReactNode;
|
||||
content?: React.ReactNode;
|
||||
onOk?: (...args: any[]) => any | PromiseLike<any>;
|
||||
onCancel?: (...args: any[]) => any | PromiseLike<any>;
|
||||
// TODO: find out exact types
|
||||
onOk?: (...args: unknown[]) => unknown;
|
||||
onCancel?: (...args: unknown[]) => unknown;
|
||||
okButtonProps?: NativeButtonProps;
|
||||
cancelButtonProps?: NativeButtonProps;
|
||||
centered?: boolean;
|
||||
|
@ -10,15 +10,15 @@ import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
|
||||
export interface PopconfirmProps extends AbstractTooltipProps {
|
||||
title: React.ReactNode;
|
||||
onConfirm?: (e?: React.MouseEvent<any>) => void;
|
||||
onCancel?: (e?: React.MouseEvent<any>) => void;
|
||||
onConfirm?: (e?: React.MouseEvent<HTMLElement>) => void;
|
||||
onCancel?: (e?: React.MouseEvent<HTMLElement>) => void;
|
||||
okText?: React.ReactNode;
|
||||
okType?: ButtonType;
|
||||
cancelText?: React.ReactNode;
|
||||
okButtonProps?: NativeButtonProps;
|
||||
cancelButtonProps?: NativeButtonProps;
|
||||
icon?: React.ReactNode;
|
||||
onVisibleChange?: (visible: boolean, e?: React.MouseEvent<any>) => void;
|
||||
onVisibleChange?: (visible: boolean, e?: React.MouseEvent<HTMLElement>) => void;
|
||||
}
|
||||
|
||||
export interface PopconfirmState {
|
||||
|
@ -5,8 +5,8 @@ import { AbstractCheckboxProps } from '../checkbox/Checkbox';
|
||||
export type RadioGroupButtonStyle = 'outline' | 'solid';
|
||||
|
||||
export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
||||
defaultValue?: any;
|
||||
value?: any;
|
||||
defaultValue?: unknown;
|
||||
value?: unknown;
|
||||
onChange?: (e: RadioChangeEvent) => void;
|
||||
size?: 'large' | 'default' | 'small';
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
@ -18,13 +18,13 @@ export interface RadioGroupProps extends AbstractCheckboxGroupProps {
|
||||
}
|
||||
|
||||
export interface RadioGroupState {
|
||||
value: any;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
export interface RadioGroupContext {
|
||||
radioGroup: {
|
||||
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
||||
value: any;
|
||||
value: unknown;
|
||||
disabled: boolean;
|
||||
name: string;
|
||||
};
|
||||
|
@ -15,8 +15,8 @@ export interface RateProps {
|
||||
allowClear?: boolean;
|
||||
disabled?: boolean;
|
||||
tooltips?: Array<string>;
|
||||
onChange?: (value: number) => any;
|
||||
onHoverChange?: (value: number) => any;
|
||||
onChange?: (value: number) => void;
|
||||
onHoverChange?: (value: number) => void;
|
||||
character?: React.ReactNode;
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
|
@ -30,9 +30,11 @@ export interface AbstractSelectProps {
|
||||
dropdownStyle?: React.CSSProperties;
|
||||
dropdownMenuStyle?: React.CSSProperties;
|
||||
dropdownMatchSelectWidth?: boolean;
|
||||
onSearch?: (value: string) => any;
|
||||
onSearch?: (value: string) => void;
|
||||
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
||||
filterOption?: boolean | ((inputValue: string, option: React.ReactElement<OptionProps>) => any);
|
||||
filterOption?:
|
||||
| boolean
|
||||
| ((inputValue: string, option: React.ReactElement<OptionProps>) => boolean);
|
||||
id?: string;
|
||||
defaultOpen?: boolean;
|
||||
open?: boolean;
|
||||
@ -55,22 +57,25 @@ export interface SelectProps<T = SelectValue> extends AbstractSelectProps {
|
||||
mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string;
|
||||
optionLabelProp?: string;
|
||||
firstActiveValue?: string | string[];
|
||||
onChange?: (value: T, option: React.ReactElement<any> | React.ReactElement<any>[]) => void;
|
||||
onSelect?: (value: T extends (infer I)[] ? I : T, option: React.ReactElement<any>) => any;
|
||||
onDeselect?: (value: T extends (infer I)[] ? I : T) => any;
|
||||
onChange?: (
|
||||
value: T,
|
||||
option: React.ReactElement<unknown> | React.ReactElement<unknown>[],
|
||||
) => void;
|
||||
onSelect?: (value: T extends (infer I)[] ? I : T, option: React.ReactElement<unknown>) => void;
|
||||
onDeselect?: (value: T extends (infer I)[] ? I : T) => void;
|
||||
onBlur?: (value: T) => void;
|
||||
onFocus?: () => void;
|
||||
onPopupScroll?: React.UIEventHandler<HTMLDivElement>;
|
||||
onInputKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
||||
onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => any;
|
||||
onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => any;
|
||||
onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
||||
onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => void;
|
||||
maxTagCount?: number;
|
||||
maxTagTextLength?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: T[]) => React.ReactNode);
|
||||
optionFilterProp?: string;
|
||||
labelInValue?: boolean;
|
||||
tokenSeparators?: string[];
|
||||
getInputElement?: () => React.ReactElement<any>;
|
||||
getInputElement?: () => React.ReactElement<unknown>;
|
||||
autoFocus?: boolean;
|
||||
suffixIcon?: React.ReactNode;
|
||||
removeIcon?: React.ReactNode;
|
||||
|
@ -25,7 +25,7 @@ interface HandleGeneratorInfo {
|
||||
export type HandleGeneratorFn = (
|
||||
tooltipPrefixCls: string,
|
||||
info: HandleGeneratorInfo,
|
||||
) => React.ReactElement<any>;
|
||||
) => React.ReactNode;
|
||||
|
||||
export interface SliderProps {
|
||||
prefixCls?: string;
|
||||
|
@ -8,7 +8,7 @@ import { tuple } from '../_util/type';
|
||||
|
||||
const SpinSizes = tuple('small', 'default', 'large');
|
||||
export type SpinSize = (typeof SpinSizes)[number];
|
||||
export type SpinIndicator = React.ReactElement<any>;
|
||||
export type SpinIndicator = React.ReactElement<HTMLElement>;
|
||||
|
||||
export interface SpinProps {
|
||||
prefixCls?: string;
|
||||
@ -34,8 +34,8 @@ function renderIndicator(prefixCls: string, props: SpinProps): React.ReactNode {
|
||||
const { indicator } = props;
|
||||
const dotClassName = `${prefixCls}-dot`;
|
||||
if (React.isValidElement(indicator)) {
|
||||
return React.cloneElement(indicator as SpinIndicator, {
|
||||
className: classNames((indicator as SpinIndicator).props.className, dotClassName),
|
||||
return React.cloneElement(indicator, {
|
||||
className: classNames(indicator.props.className, dotClassName),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ export interface StepProps {
|
||||
className?: string;
|
||||
description?: React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
onClick?: React.MouseEventHandler<any>;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
status?: 'wait' | 'process' | 'finish' | 'error';
|
||||
title?: React.ReactNode;
|
||||
style?: React.CSSProperties;
|
||||
|
@ -13,8 +13,8 @@ export interface SwitchProps {
|
||||
className?: string;
|
||||
checked?: boolean;
|
||||
defaultChecked?: boolean;
|
||||
onChange?: (checked: boolean, event: MouseEvent) => any;
|
||||
onClick?: (checked: boolean, event: MouseEvent) => any;
|
||||
onChange?: (checked: boolean, event: MouseEvent) => void;
|
||||
onClick?: (checked: boolean, event: MouseEvent) => void;
|
||||
checkedChildren?: React.ReactNode;
|
||||
unCheckedChildren?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
|
||||
export interface FilterDropdownMenuWrapperProps {
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ import warning from '../_util/warning';
|
||||
|
||||
function noop() {}
|
||||
|
||||
function stopPropagation(e: React.SyntheticEvent<any>) {
|
||||
function stopPropagation(e: React.SyntheticEvent<unknown>) {
|
||||
e.stopPropagation();
|
||||
if (e.nativeEvent.stopImmediatePropagation) {
|
||||
e.nativeEvent.stopImmediatePropagation();
|
||||
|
@ -1,5 +1,5 @@
|
||||
export interface Store {
|
||||
setState: (partial: Object) => void;
|
||||
setState: (partial: object) => void;
|
||||
getState: () => any;
|
||||
subscribe: (listener: () => void) => () => void;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import FilterDropdownMenuWrapper from './FilterDropdownMenuWrapper';
|
||||
import { FilterMenuProps, FilterMenuState, ColumnProps, ColumnFilterItem } from './interface';
|
||||
import { generateValueMaps } from './util';
|
||||
|
||||
function stopPropagation(e: React.SyntheticEvent<any>) {
|
||||
function stopPropagation(e: React.SyntheticEvent<unknown>) {
|
||||
e.stopPropagation();
|
||||
if (e.nativeEvent.stopImmediatePropagation) {
|
||||
e.nativeEvent.stopImmediatePropagation();
|
||||
|
@ -29,10 +29,10 @@ export interface ColumnProps<T> {
|
||||
| ((options: { filters: TableStateFilters; sortOrder?: SortOrder }) => React.ReactNode);
|
||||
key?: React.Key;
|
||||
dataIndex?: string; // Note: We can not use generic type here, since we need to support nested key, see #9393
|
||||
render?: (text: any, record: T, index: number) => React.ReactNode;
|
||||
render?: (text: unknown, record: T, index: number) => React.ReactNode;
|
||||
align?: 'left' | 'right' | 'center';
|
||||
filters?: ColumnFilterItem[];
|
||||
onFilter?: (value: any, record: T) => boolean;
|
||||
onFilter?: (value: unknown, record: T) => boolean;
|
||||
filterMultiple?: boolean;
|
||||
filterDropdown?: React.ReactNode | ((props: FilterDropdownProps) => React.ReactNode);
|
||||
filterDropdownVisible?: boolean;
|
||||
@ -44,12 +44,12 @@ export interface ColumnProps<T> {
|
||||
className?: string;
|
||||
fixed?: boolean | ('left' | 'right');
|
||||
filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode);
|
||||
filteredValue?: any[];
|
||||
filteredValue?: unknown[];
|
||||
sortOrder?: SortOrder | boolean;
|
||||
children?: ColumnProps<T>[];
|
||||
onCellClick?: (record: T, event: any) => void;
|
||||
onCell?: (record: T, rowIndex: number) => any;
|
||||
onHeaderCell?: (props: ColumnProps<T>) => any;
|
||||
onCellClick?: (record: T, event: Event) => void;
|
||||
onCell?: (record: T, rowIndex: number) => TableEventListeners;
|
||||
onHeaderCell?: (props: ColumnProps<T>) => TableEventListeners;
|
||||
sortDirections?: SortOrder[];
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ export type SelectionSelectFn<T> = (
|
||||
selected: boolean,
|
||||
selectedRows: Object[],
|
||||
nativeEvent: Event,
|
||||
) => any;
|
||||
) => void;
|
||||
|
||||
export type TableSelectWay = 'onSelect' | 'onSelectMultiple' | 'onSelectAll' | 'onSelectInvert';
|
||||
|
||||
@ -129,6 +129,14 @@ export interface TableCurrentDataSource<T> {
|
||||
currentDataSource: T[];
|
||||
}
|
||||
|
||||
export interface TableEventListeners {
|
||||
onClick?: (arg: React.SyntheticEvent) => void;
|
||||
onDoubleClick?: (arg: React.SyntheticEvent) => void;
|
||||
onContextMenu?: (arg: React.SyntheticEvent) => void;
|
||||
onMouseEnter?: (arg: React.SyntheticEvent) => void;
|
||||
onMouseLeave?: (arg: React.SyntheticEvent) => void;
|
||||
}
|
||||
|
||||
export interface TableProps<T> {
|
||||
prefixCls?: string;
|
||||
dropdownPrefixCls?: string;
|
||||
@ -165,8 +173,8 @@ export interface TableProps<T> {
|
||||
locale?: TableLocale;
|
||||
indentSize?: number;
|
||||
onRowClick?: (record: T, index: number, event: Event) => void;
|
||||
onRow?: (record: T, index: number) => any;
|
||||
onHeaderRow?: (columns: ColumnProps<T>[], index: number) => any;
|
||||
onRow?: (record: T, index: number) => TableEventListeners;
|
||||
onHeaderRow?: (columns: ColumnProps<T>[]) => TableEventListeners;
|
||||
useFixedHeader?: boolean;
|
||||
bordered?: boolean;
|
||||
showHeader?: boolean;
|
||||
@ -193,7 +201,7 @@ export interface TableState<T> {
|
||||
pivot?: number;
|
||||
}
|
||||
|
||||
export type SelectionItemSelectFn = (key: string[]) => any;
|
||||
export type SelectionItemSelectFn = (key: string[]) => void;
|
||||
type GetPopupContainer = (triggerNode?: HTMLElement) => HTMLElement;
|
||||
|
||||
export interface SelectionItem {
|
||||
@ -204,13 +212,13 @@ export interface SelectionItem {
|
||||
|
||||
export interface SelectionCheckboxAllProps<T> {
|
||||
store: Store;
|
||||
locale: any;
|
||||
locale: TableLocale;
|
||||
disabled: boolean;
|
||||
getCheckboxPropsByItem: (item: any, index: number) => any;
|
||||
getRecordKey: (record: any, index?: number) => string;
|
||||
getCheckboxPropsByItem: (item: T, index: number) => { defaultChecked: boolean };
|
||||
getRecordKey: (record: T, index?: number) => string;
|
||||
data: T[];
|
||||
prefixCls: string | undefined;
|
||||
onSelect: (key: string, index: number, selectFunc: any) => void;
|
||||
onSelect: (key: string, index: number, selectFunc: unknown) => void;
|
||||
hideDefaultSelections?: boolean;
|
||||
selections?: SelectionItem[] | boolean;
|
||||
getPopupContainer?: GetPopupContainer;
|
||||
@ -247,7 +255,7 @@ export interface FilterMenuProps<T> {
|
||||
locale: TableLocale;
|
||||
selectedKeys: string[];
|
||||
column: ColumnProps<T>;
|
||||
confirmFilter: (column: ColumnProps<T>, selectedKeys: string[]) => any;
|
||||
confirmFilter: (column: ColumnProps<T>, selectedKeys: string[]) => unknown;
|
||||
prefixCls: string;
|
||||
dropdownPrefixCls: string;
|
||||
getPopupContainer?: GetPopupContainer;
|
||||
@ -255,7 +263,7 @@ export interface FilterMenuProps<T> {
|
||||
|
||||
export interface FilterMenuState<T> {
|
||||
selectedKeys: string[];
|
||||
valueKeys: { [name: string]: any };
|
||||
valueKeys: { [name: string]: string };
|
||||
keyPathOfSelectedItem: { [key: string]: string };
|
||||
visible?: boolean;
|
||||
prevProps: FilterMenuProps<T>;
|
||||
@ -267,5 +275,5 @@ export type PrepareParamsArgumentsReturn<T> = [
|
||||
Object,
|
||||
{
|
||||
currentDataSource: T[];
|
||||
}
|
||||
},
|
||||
];
|
||||
|
@ -18,20 +18,20 @@ export interface TabsProps {
|
||||
hideAdd?: boolean;
|
||||
onChange?: (activeKey: string) => void;
|
||||
onTabClick?: Function;
|
||||
onPrevClick?: React.MouseEventHandler<any>;
|
||||
onNextClick?: React.MouseEventHandler<any>;
|
||||
onPrevClick?: React.MouseEventHandler<HTMLElement>;
|
||||
onNextClick?: React.MouseEventHandler<HTMLElement>;
|
||||
tabBarExtraContent?: React.ReactNode | null;
|
||||
tabBarStyle?: React.CSSProperties;
|
||||
type?: TabsType;
|
||||
tabPosition?: TabsPosition;
|
||||
onEdit?: (targetKey: string | React.MouseEvent<HTMLElement>, action: any) => void;
|
||||
onEdit?: (targetKey: string | React.MouseEvent<HTMLElement>, action: 'add' | 'remove') => void;
|
||||
size?: 'large' | 'default' | 'small';
|
||||
style?: React.CSSProperties;
|
||||
prefixCls?: string;
|
||||
className?: string;
|
||||
animated?: boolean | { inkBar: boolean; tabPane: boolean };
|
||||
tabBarGutter?: number;
|
||||
renderTabBar?: (props: TabsProps, DefaultTabBar: React.ReactNode) => React.ReactElement<any>;
|
||||
renderTabBar?: (props: TabsProps, DefaultTabBar: React.ReactNode) => React.ReactElement<unknown>;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
|
@ -22,10 +22,10 @@ export interface PlacementsConfig {
|
||||
horizontalArrowShift?: number;
|
||||
verticalArrowShift?: number;
|
||||
arrowPointAtCenter?: boolean;
|
||||
autoAdjustOverflow?: any;
|
||||
autoAdjustOverflow?: boolean | AdjustOverflow;
|
||||
}
|
||||
|
||||
export function getOverflowOptions(autoAdjustOverflow: any) {
|
||||
export function getOverflowOptions(autoAdjustOverflow: boolean | AdjustOverflow) {
|
||||
if (typeof autoAdjustOverflow === 'boolean') {
|
||||
return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ export interface TransferProps {
|
||||
targetKeys?: string[];
|
||||
selectedKeys?: string[];
|
||||
render?: TransferRender;
|
||||
onChange?: (targetKeys: string[], direction: string, moveKeys: any) => void;
|
||||
onChange?: (targetKeys: string[], direction: string, moveKeys: string[]) => void;
|
||||
onSelectChange?: (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => void;
|
||||
style?: React.CSSProperties;
|
||||
listStyle?: React.CSSProperties;
|
||||
@ -50,7 +50,7 @@ export interface TransferProps {
|
||||
titles?: string[];
|
||||
operations?: string[];
|
||||
showSearch?: boolean;
|
||||
filterOption?: (inputValue: any, item: any) => boolean;
|
||||
filterOption?: (inputValue: string, item: TransferItem) => boolean;
|
||||
searchPlaceholder?: string;
|
||||
notFoundContent?: React.ReactNode;
|
||||
locale?: {};
|
||||
|
@ -5,9 +5,9 @@ import Input from '../input';
|
||||
export interface TransferSearchProps {
|
||||
prefixCls?: string;
|
||||
placeholder?: string;
|
||||
onChange?: (e: React.FormEvent<any>) => void;
|
||||
handleClear?: (e: React.MouseEvent<any>) => void;
|
||||
value?: any;
|
||||
onChange?: (e: React.FormEvent<HTMLElement>) => void;
|
||||
handleClear?: (e: React.MouseEvent<HTMLElement>) => void;
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import RcTreeSelect, { TreeNode, SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from 'rc-tree-select';
|
||||
import classNames from 'classnames';
|
||||
import { TreeSelectProps } from './interface';
|
||||
import { TreeSelectProps, TreeNodeValue } from './interface';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import warning from '../_util/warning';
|
||||
import Icon from '../icon';
|
||||
@ -10,7 +10,10 @@ import omit from 'omit.js';
|
||||
|
||||
export { TreeNode, TreeSelectProps } from './interface';
|
||||
|
||||
export default class TreeSelect extends React.Component<TreeSelectProps, any> {
|
||||
export default class TreeSelect<T extends TreeNodeValue> extends React.Component<
|
||||
TreeSelectProps<T>,
|
||||
any
|
||||
> {
|
||||
static TreeNode = TreeNode;
|
||||
static SHOW_ALL = SHOW_ALL;
|
||||
static SHOW_PARENT = SHOW_PARENT;
|
||||
@ -23,7 +26,7 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> {
|
||||
|
||||
private rcTreeSelect: any;
|
||||
|
||||
constructor(props: TreeSelectProps) {
|
||||
constructor(props: TreeSelectProps<T>) {
|
||||
super(props);
|
||||
|
||||
warning(
|
||||
|
@ -3,8 +3,10 @@ import { AbstractSelectProps } from '../select';
|
||||
|
||||
export type TreeNode = TreeNodeNormal | TreeNodeSimpleMode;
|
||||
|
||||
export type TreeNodeValue = string | number | string[] | number[];
|
||||
|
||||
export interface TreeNodeNormal {
|
||||
value: string | number;
|
||||
value: TreeNodeValue;
|
||||
/**
|
||||
* @deprecated Please use `title` instead.
|
||||
*/
|
||||
@ -29,20 +31,20 @@ export interface TreeDataSimpleMode {
|
||||
rootPId?: string;
|
||||
}
|
||||
|
||||
export interface TreeSelectProps extends AbstractSelectProps {
|
||||
export interface TreeSelectProps<T extends TreeNodeValue> extends AbstractSelectProps {
|
||||
autoFocus?: boolean;
|
||||
defaultValue?: string | number | Array<any>;
|
||||
defaultValue?: T;
|
||||
dropdownStyle?: React.CSSProperties;
|
||||
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
|
||||
filterTreeNode?: (inputValue: string, treeNode: unknown) => boolean | boolean;
|
||||
labelInValue?: boolean;
|
||||
loadData?: (node: any) => void;
|
||||
loadData?: (node: unknown) => void;
|
||||
maxTagCount?: number;
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: any[]) => React.ReactNode);
|
||||
maxTagPlaceholder?: React.ReactNode | ((omittedValues: unknown[]) => React.ReactNode);
|
||||
multiple?: boolean;
|
||||
notFoundContent?: React.ReactNode;
|
||||
onChange?: (value: any, label: any, extra: any) => void;
|
||||
onSearch?: (value: any) => void;
|
||||
onSelect?: (value: any) => void;
|
||||
onChange?: (value: T, label: unknown, extra: unknown) => void;
|
||||
onSearch?: (value: unknown) => void;
|
||||
onSelect?: (value: unknown) => void;
|
||||
onTreeExpand?: (keys: Array<string>) => void;
|
||||
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
||||
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
||||
@ -60,5 +62,5 @@ export interface TreeSelectProps extends AbstractSelectProps {
|
||||
treeIcon?: boolean;
|
||||
treeNodeFilterProp?: string;
|
||||
treeNodeLabelProp?: string;
|
||||
value?: string | number | Array<any>;
|
||||
value?: T;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ export interface AntTreeNodeExpandedEvent extends AntTreeNodeBaseEvent {
|
||||
|
||||
export interface AntTreeNodeMouseEvent {
|
||||
node: AntTreeNode;
|
||||
event: React.MouseEvent<any>;
|
||||
event: React.MouseEvent<HTMLElement>;
|
||||
}
|
||||
|
||||
export interface AntTreeNodeDragEnterEvent extends AntTreeNodeMouseEvent {
|
||||
@ -83,7 +83,7 @@ export interface AntTreeNodeDropEvent {
|
||||
dragNodesKeys: string[];
|
||||
dropPosition: number;
|
||||
dropToGap?: boolean;
|
||||
event: React.MouseEvent<any>;
|
||||
event: React.MouseEvent<HTMLElement>;
|
||||
}
|
||||
|
||||
export interface TreeProps {
|
||||
@ -117,7 +117,7 @@ export interface TreeProps {
|
||||
defaultSelectedKeys?: string[];
|
||||
selectable?: boolean;
|
||||
/** 展开/收起节点时触发 */
|
||||
onExpand?: (expandedKeys: string[], info: AntTreeNodeExpandedEvent) => void | PromiseLike<any>;
|
||||
onExpand?: (expandedKeys: string[], info: AntTreeNodeExpandedEvent) => void | PromiseLike<void>;
|
||||
/** 点击复选框触发 */
|
||||
onCheck?: (
|
||||
checkedKeys: string[] | { checked: string[]; halfChecked: string[] },
|
||||
@ -132,7 +132,7 @@ export interface TreeProps {
|
||||
/** filter some AntTreeNodes as you need. it should return true */
|
||||
filterAntTreeNode?: (node: AntTreeNode) => boolean;
|
||||
/** 异步加载数据 */
|
||||
loadData?: (node: AntTreeNode) => PromiseLike<any>;
|
||||
loadData?: (node: AntTreeNode) => PromiseLike<void>;
|
||||
loadedKeys?: string[];
|
||||
onLoad?: (loadedKeys: string[], info: { event: 'load'; node: AntTreeNode }) => void;
|
||||
/** 响应右键点击 */
|
||||
@ -147,11 +147,11 @@ export interface TreeProps {
|
||||
onDrop?: (options: AntTreeNodeDropEvent) => void;
|
||||
style?: React.CSSProperties;
|
||||
showIcon?: boolean;
|
||||
icon?: (nodeProps: AntdTreeNodeAttribute) => React.ReactNode | React.ReactNode;
|
||||
switcherIcon?: React.ReactElement<any>;
|
||||
icon?: ((nodeProps: AntdTreeNodeAttribute) => React.ReactNode) | React.ReactNode;
|
||||
switcherIcon?: React.ReactElement<unknown>;
|
||||
prefixCls?: string;
|
||||
filterTreeNode?: (node: AntTreeNode) => boolean;
|
||||
children?: React.ReactNode | React.ReactNode[];
|
||||
children?: React.ReactNode;
|
||||
blockNode?: boolean;
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ export interface UploadProps {
|
||||
fileList?: Array<UploadFile>;
|
||||
action?: string | ((file: RcFile) => string) | ((file: RcFile) => PromiseLike<string>);
|
||||
directory?: boolean;
|
||||
data?: Object | ((file: UploadFile) => any);
|
||||
data?: object | ((file: UploadFile) => object);
|
||||
headers?: HttpRequestHeader;
|
||||
showUploadList?: boolean | ShowUploadListInterface;
|
||||
multiple?: boolean;
|
||||
accept?: string;
|
||||
beforeUpload?: (file: RcFile, FileList: RcFile[]) => boolean | PromiseLike<any>;
|
||||
beforeUpload?: (file: RcFile, FileList: RcFile[]) => boolean | PromiseLike<void>;
|
||||
onChange?: (info: UploadChangeParam) => void;
|
||||
listType?: UploadListType;
|
||||
className?: string;
|
||||
@ -76,7 +76,7 @@ export interface UploadProps {
|
||||
style?: React.CSSProperties;
|
||||
disabled?: boolean;
|
||||
prefixCls?: string;
|
||||
customRequest?: (option: any) => void;
|
||||
customRequest?: (option: object) => void;
|
||||
withCredentials?: boolean;
|
||||
openFileDialogOnClick?: boolean;
|
||||
locale?: UploadLocale;
|
||||
|
Loading…
Reference in New Issue
Block a user