diff --git a/.gitignore b/.gitignore index d76462d4ad..e5db750be6 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ __html/ dist/ es/ lib/ +types/ test/coverage/ test/**/coverage/ compiled_docs/ diff --git a/types/affix/index.d.ts b/types/affix/index.d.ts deleted file mode 100644 index f170fe52af..0000000000 --- a/types/affix/index.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -import * as React from 'react'; -import { Component } from 'react'; -import * as PropTypes from 'prop-types'; -import ResizeObserver from 'resize-observer-polyfill'; -import type { AffixProps, AffixState, AffixMode } from './types'; -/** Affix */ -declare class Affix extends Component { - static propTypes: { - prefix: PropTypes.Requireable; - container: PropTypes.Requireable<(...args: any[]) => any>; - offsetTop: PropTypes.Requireable; - offsetBottom: PropTypes.Requireable; - onAffix: PropTypes.Requireable<(...args: any[]) => any>; - useAbsolute: PropTypes.Requireable; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - children: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - container: () => Window & typeof globalThis; - onAffix: () => void; - }; - static _getAffixMode(nextProps: AffixProps): AffixMode; - constructor(props: AffixProps, context?: unknown); - static getDerivedStateFromProps(nextProps: AffixProps): { - affixMode: AffixMode; - } | null; - componentDidMount(): void; - componentDidUpdate(prevProps: AffixProps): void; - componentWillUnmount(): void; - resizeObserver: ResizeObserver; - timeout: ReturnType | null; - affixNode: HTMLDivElement; - affixChildNode: HTMLDivElement; - _clearContainerEvent: () => void; - _setEventHandlerForContainer(getContainer: NonNullable): void; - _removeEventHandlerForContainer(getContainer: NonNullable): void; - updatePosition: () => void; - _updateNodePosition: () => false | undefined; - _setAffixStyle(affixStyle: AffixState['style'], affixed?: boolean): void; - _setContainerStyle(containerStyle: AffixState['containerStyle']): void; - _getOffset( - affixNode: HTMLDivElement, - affixContainer: Element | Window - ): { - top: number; - left: number; - width: number; - height: number; - }; - _affixNodeRefHandler: (ref: HTMLDivElement) => void; - _affixChildNodeRefHandler: (ref: HTMLDivElement) => void; - render(): React.JSX.Element; -} -export { AffixProps }; -declare const _default: { - new ( - props: AffixProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - AffixProps & import('../config-provider/types').ComponentCommonProps, - Affix - >; - contextType?: React.Context | undefined; -} & { - propTypes: { - prefix: PropTypes.Requireable; - container: PropTypes.Requireable<(...args: any[]) => any>; - offsetTop: PropTypes.Requireable; - offsetBottom: PropTypes.Requireable; - onAffix: PropTypes.Requireable<(...args: any[]) => any>; - useAbsolute: PropTypes.Requireable; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - children: PropTypes.Requireable; - }; - defaultProps: { - prefix: string; - container: () => Window & typeof globalThis; - onAffix: () => void; - }; - _getAffixMode: typeof Affix._getAffixMode; -}; -export default _default; diff --git a/types/affix/mobile/index.d.ts b/types/affix/mobile/index.d.ts deleted file mode 100644 index e2c18844f9..0000000000 --- a/types/affix/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const Affix: any; -export default Affix; diff --git a/types/affix/types.d.ts b/types/affix/types.d.ts deleted file mode 100644 index 84786bedb4..0000000000 --- a/types/affix/types.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as React from 'react'; -import { CommonProps } from '../util'; -export interface AffixMode { - top: boolean; - bottom: boolean; - offset: number; -} -export interface AffixState { - style: React.CSSProperties | null; - containerStyle: React.CSSProperties | null; - positionStyle: React.CSSProperties['position'] | null; - affixMode: AffixMode; -} -export interface GetContainer { - (): Element; -} -/** - * @api Affix - */ -export interface AffixProps extends CommonProps { - /** - * 设置 Affix 需要监听滚动事件的容器元素 - * @en The container for listening scroll events - * @returns 目标容器元素 - * @defaultValue () =\> window - */ - container?: () => Element | Window; - /** - * 距离窗口顶部达到指定偏移量后触发 - * @en Offset from top when event triggers - */ - offsetTop?: number; - /** - * 距离窗口底部达到指定偏移量后触发 - * @en Offset from bottom when event triggers - */ - offsetBottom?: number; - /** - * 当元素的样式发生固钉样式变化时触发的回调函数 - * @en Callback when affix event triggers - * @param affixed - 是否固定 - if element is affixed - */ - onAffix?: (affixed: boolean) => void; - /** - * 是否启用绝对布局实现 affix - * @en Enable absolute position - */ - useAbsolute?: boolean; - /** - * 包裹 children 容器的类名 - */ - className?: string; - /** - * 最外层容器的 style 样式 - */ - style?: React.CSSProperties; -} diff --git a/types/affix/util.d.ts b/types/affix/util.d.ts deleted file mode 100644 index ade79ee4d5..0000000000 --- a/types/affix/util.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare function getScroll(node: Window | Element, isVertical?: boolean): number; -export declare function getRect(node: Window | Element): - | DOMRect - | { - top: number; - left: number; - bottom: number; - }; -export declare function getNodeHeight(node: Window | Element): number; diff --git a/types/animate/index.d.ts b/types/animate/index.d.ts deleted file mode 100644 index d3b65c0e66..0000000000 --- a/types/animate/index.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { TransitionProps } from 'react-transition-group/Transition'; -import { TransitionGroupProps } from 'react-transition-group/TransitionGroup'; - -export interface AnimateProps extends React.HTMLAttributes, CommonProps { - /** - * 动画 className - */ - animation?: string | any; - - /** - * 子元素第一次挂载时是否执行动画 - */ - animationAppear?: TransitionGroupProps['appear']; - - /** - * 包裹子元素的标签 - */ - component?: TransitionGroupProps['component']; - - /** - * 是否只有单个子元素,如果有多个子元素,请设置为 false - */ - singleMode?: boolean; - - /** - * 子元素 - */ - children?: React.ReactElement | Array; - - /** - * 执行第一次挂载动画前触发的回调函数 - */ - beforeAppear?: (node: HTMLElement) => void; - - /** - * 执行第一次挂载动画,添加 xxx-appear-active 类名后触发的回调函数 - */ - onAppear?: (node: HTMLElement) => void; - - /** - * 执行完第一次挂载动画后触发的函数 - */ - afterAppear?: (node: HTMLElement) => void; - - /** - * 执行进场动画前触发的回调函数 - */ - beforeEnter?: (node: HTMLElement) => void; - - /** - * 执行进场动画,添加 xxx-enter-active 类名后触发的回调函数 - */ - onEnter?: (node: HTMLElement) => void; - - /** - * 执行完进场动画后触发的回调函数 - */ - afterEnter?: (node: HTMLElement) => void; - - /** - * 执行离场动画前触发的回调函数 - */ - beforeLeave?: TransitionProps['onExit']; - - /** - * 执行离场动画,添加 xxx-leave-active 类名后触发的回调函数 - */ - onLeave?: TransitionProps['onExiting']; - - /** - * 执行完离场动画后触发的回调函数 - */ - afterLeave?: TransitionProps['onExited']; -} - -export default class Animate extends React.Component {} diff --git a/types/avatar/index.d.ts b/types/avatar/index.d.ts deleted file mode 100644 index 7836d74785..0000000000 --- a/types/avatar/index.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Component } from 'react'; -import * as React from 'react'; -import * as PropTypes from 'prop-types'; -import type { AvatarProps } from './types'; -/** - * Avatar - */ -declare class Avatar extends Component { - static propTypes: { - prefix: PropTypes.Requireable; - children: PropTypes.Requireable; - className: PropTypes.Requireable; - size: PropTypes.Requireable>; - shape: PropTypes.Requireable; - icon: PropTypes.Requireable>; - src: PropTypes.Requireable; - onError: PropTypes.Requireable<(...args: any[]) => any>; - alt: PropTypes.Requireable; - srcSet: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - size: string; - shape: string; - }; - state: { - isImgExist: boolean; - }; - componentDidUpdate(prevProps: AvatarProps): void; - handleImgLoadError: () => void; - getIconSize: ( - avatarSize: AvatarProps['size'] - ) => number | 'small' | 'medium' | 'large' | undefined; - render(): React.JSX.Element; -} -export { AvatarProps }; -declare const _default: { - new ( - props: AvatarProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - AvatarProps & import('../config-provider/types').ComponentCommonProps, - Avatar - >; - contextType?: React.Context | undefined; -} & { - propTypes: { - prefix: PropTypes.Requireable; - children: PropTypes.Requireable; - className: PropTypes.Requireable; - size: PropTypes.Requireable>; - shape: PropTypes.Requireable; - icon: PropTypes.Requireable>; - src: PropTypes.Requireable; - onError: PropTypes.Requireable<(...args: any[]) => any>; - alt: PropTypes.Requireable; - srcSet: PropTypes.Requireable; - }; - defaultProps: { - prefix: string; - size: string; - shape: string; - }; -}; -export default _default; diff --git a/types/avatar/mobile/index.d.ts b/types/avatar/mobile/index.d.ts deleted file mode 100644 index b155c83f2d..0000000000 --- a/types/avatar/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Avatar } from '@alifd/meet-react'; -export default Avatar; diff --git a/types/avatar/types.d.ts b/types/avatar/types.d.ts deleted file mode 100644 index d3f3eafcd8..0000000000 --- a/types/avatar/types.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as React from 'react'; -import { CommonProps } from '../util'; -/** - * @api Avatar - * @order 0 - */ -export interface AvatarProps extends React.HTMLAttributes, CommonProps { - /** - * 孩子节点列表 - * @en children node list - */ - children?: React.ReactNode; - /** - * 头像的大小 - * @en The size of the avatar - * @defaultValue 'medium' - */ - size?: 'small' | 'medium' | 'large' | number; - /** - * 头像的形状 - * @en The shape of the avatar - * @defaultValue 'circle' - */ - shape?: 'circle' | 'square'; - /** - * icon 类头像的图标类型,可设为 Icon 的 `type` 或 `ReactElement` - * @en The icon type of the icon avatar, can be set to the `type` or `ReactElement` of Icon - */ - icon?: React.ReactElement | string; - /** - * 图片类头像的资源地址 - * @en The resource address of the image avatar - */ - src?: string; - /** - * 图片加载失败的事件,返回 false 会关闭组件默认的 fallback 行为 - * @en The event of the image loading failure, returning false will close the component's default fallback behavior - */ - onError?: () => boolean; - /** - * 图像无法显示时的 alt 替代文本 - * @en The alt replacement text when the image cannot be displayed - */ - alt?: string; - /** - * 图片类头像响应式资源地址 - * @en The responsive resource address of the image avatar - */ - srcSet?: string; -} diff --git a/types/badge/index.d.ts b/types/badge/index.d.ts deleted file mode 100644 index cd4a683ccd..0000000000 --- a/types/badge/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Component } from 'react'; -import * as React from 'react'; -import * as PropTypes from 'prop-types'; -import type { BadgeProps } from './types'; -export type { BadgeProps }; -/** - * Badge - */ -declare class Badge extends Component { - static propTypes: { - prefix: PropTypes.Requireable; - rtl: PropTypes.Requireable; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - /** - * 徽标依托的内容,一般显示在其右上方 - */ - children: PropTypes.Requireable; - /** - * 展示的数字,大于 `overflowCount` 时显示为 `${overflowCount}+`,为 `0` 时默认隐藏 - */ - count: PropTypes.Requireable>; - /** - * 当`count`为`0`时,是否显示 count - * @version 1.16 - */ - showZero: PropTypes.Requireable; - /** - * 自定义徽标中的内容 - */ - content: PropTypes.Requireable; - /** - * 展示的封顶的数字 - */ - overflowCount: PropTypes.Requireable>; - /** - * 不展示数字,只展示一个小红点 - */ - dot: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - count: number; - showZero: boolean; - overflowCount: number; - dot: boolean; - }; - render(): React.JSX.Element; -} -declare const _default: { - new ( - props: BadgeProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - BadgeProps & import('../config-provider/types').ComponentCommonProps, - Badge - >; - contextType?: React.Context | undefined; -} & { - propTypes: { - prefix: PropTypes.Requireable; - rtl: PropTypes.Requireable; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - /** - * 徽标依托的内容,一般显示在其右上方 - */ - children: PropTypes.Requireable; - /** - * 展示的数字,大于 `overflowCount` 时显示为 `${overflowCount}+`,为 `0` 时默认隐藏 - */ - count: PropTypes.Requireable>; - /** - * 当`count`为`0`时,是否显示 count - * @version 1.16 - */ - showZero: PropTypes.Requireable; - /** - * 自定义徽标中的内容 - */ - content: PropTypes.Requireable; - /** - * 展示的封顶的数字 - */ - overflowCount: PropTypes.Requireable>; - /** - * 不展示数字,只展示一个小红点 - */ - dot: PropTypes.Requireable; - }; - defaultProps: { - prefix: string; - count: number; - showZero: boolean; - overflowCount: number; - dot: boolean; - }; -}; -export default _default; diff --git a/types/badge/mobile/index.d.ts b/types/badge/mobile/index.d.ts deleted file mode 100644 index 08abc76b3c..0000000000 --- a/types/badge/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Badge } from '@alifd/meet-react'; -export default Badge; diff --git a/types/badge/sup.d.ts b/types/badge/sup.d.ts deleted file mode 100644 index 5cb787aa70..0000000000 --- a/types/badge/sup.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Component } from 'react'; -import * as React from 'react'; -import * as PropTypes from 'prop-types'; -import type { BadgeSubProps, BadgeSubState } from './types'; -declare class Sup extends Component { - static propTypes: { - prefix: PropTypes.Requireable; - count: PropTypes.Requireable; - showZero: PropTypes.Requireable; - overflowCount: PropTypes.Requireable; - content: PropTypes.Requireable; - dot: PropTypes.Requireable; - style: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - count: number; - showZero: boolean; - overflowCount: number; - dot: boolean; - }; - supEl: HTMLElement | null; - static renderDigit(prefix: string, digit: number, key: string | number): React.JSX.Element; - static renderNumber(prefix: string, count: number | string): React.JSX.Element[]; - constructor(props: BadgeSubProps); - static getDerivedStateFromProps( - nextProps: BadgeSubProps, - prevState: BadgeSubState - ): { - lastCount: string | number | undefined; - currentCount: string | number | undefined; - } | null; - componentDidMount(): void; - componentDidUpdate(prevProps: BadgeSubProps): void; - computeStyle(removeTransition: boolean, revert?: boolean): void; - getPositionByDigit(digit: number, i: number, revert?: boolean): number; - saveRef: React.LegacyRef; - render(): React.FunctionComponentElement; -} -declare const _default: typeof Sup; -export default _default; diff --git a/types/badge/types.d.ts b/types/badge/types.d.ts deleted file mode 100644 index 590df4cdb7..0000000000 --- a/types/badge/types.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as React from 'react'; -import { CommonProps } from '../util'; -/** - * @api Badge - */ -export interface BadgeProps - extends Omit, 'content'>, - CommonProps { - /** - * 徽章依托的内容 - * @en content of Badge based on - */ - children?: React.ReactNode; - /** - * 展示的数字,大于 overflowCount 时显示为 overflowCount+,为 0 时隐藏 - * @en number to display, display overflowCount+ when count is greater than overflowCount, display none when count equal to 0 - * @defaultValue 0 - */ - count?: number | string; - /** - * 自定义节点内容 - * @en customized node content - */ - content?: React.ReactNode; - /** - * 展示的封顶的数字 - * @en max number to display - * @defaultValue 99 - */ - overflowCount?: number | string; - /** - * 不展示数字,只展示一个小红点 - * @en display a red dot, not a number - * @defaultValue false - */ - dot?: boolean; - /** - * 当 count 为 0 时,默认不显示,但是可以使用 showZero 修改为显示 - * @en whether to show count when count is 0 - * @defaultValue false - */ - showZero?: boolean; -} -export interface BadgeSubProps - extends Pick< - BadgeProps, - 'prefix' | 'count' | 'showZero' | 'overflowCount' | 'content' | 'dot' | 'style' - > {} -export interface BadgeSubState { - lastCount: BadgeSubProps['count']; - currentCount: BadgeSubProps['count']; -} diff --git a/types/balloon/index.d.ts b/types/balloon/index.d.ts deleted file mode 100644 index f395c8cbd3..0000000000 --- a/types/balloon/index.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { PopupProps } from '../overlay'; - -export interface TooltipProps extends React.HTMLAttributes, CommonProps { - /** - * 样式类名的品牌前缀 - */ - prefix?: string; - - /** - * 自定义类名 - */ - className?: string; - - /** - * 自定义内联样式 - */ - style?: React.CSSProperties; - - /** - * tooltip的内容 - */ - children?: any; - - /** - * 弹出层位置 - */ - align?: 't' | 'r' | 'b' | 'l' | 'tl' | 'tr' | 'bl' | 'br' | 'lt' | 'lb' | 'rt' | 'rb'; - - /** - * 触发元素 - */ - trigger?: any; - - /** - * 触发行为 - * 鼠标悬浮, 鼠标点击('hover', 'click')或者它们组成的数组,如 ['hover', 'click'], 强烈不建议使用'focus',若有复杂交互,推荐使用triggerType为click的Balloon组件 - */ - triggerType?: string | Array; - - /** - * 弹层组件style,透传给Popup - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层组件className,透传给Popup - */ - popupClassName?: string; - - /** - * 弹层组件属性,透传给Popup - */ - popupProps?: PopupProps; - - /** - * 弹层在触发以后的延时显示, 单位毫秒 ms - */ - delay?: number; - - /** - * 是否pure render - */ - pure?: boolean; - - /** - * 指定浮层渲染的父节点, 可以为节点id的字符串,也可以返回节点的函数。 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层id, 传入值才会支持无障碍 - */ - id?: string; - followTrigger?: boolean; - /** - * 开启 v2 - */ - v2?: boolean; - /** - * [v2] 箭头是否指向目标元素的中心 - */ - arrowPointToCenter?: boolean; -} - -export class Tooltip extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} -export interface BalloonProps extends HTMLAttributesWeak, CommonProps { - /** - * 自定义类名 - */ - className?: string; - - /** - * 自定义内敛样式 - */ - style?: React.CSSProperties; - - /** - * 浮层的内容 - */ - children?: any; - - title?: React.ReactNode; - - /** - * 样式类型 - */ - type?: 'normal' | 'primary'; - - /** - * 弹层当前显示的状态 - */ - visible?: boolean; - - /** - * 弹层默认显示的状态 - */ - defaultVisible?: boolean; - - /** - * 弹层在显示和隐藏触发的事件 - */ - onVisibleChange?: (visible: boolean, type: string) => void; - - /** - * 弹出层对齐方式 - */ - alignEdge?: boolean; - - /** - * 是否显示关闭按钮 - */ - closable?: boolean; - - /** - * 弹出层位置 - */ - align?: 't' | 'r' | 'b' | 'l' | 'tl' | 'tr' | 'bl' | 'br' | 'lt' | 'lb' | 'rt' | 'rb'; - - /** - * 弹层相对于trigger的定位的微调 - */ - offset?: Array; - - /** - * 触发元素 - */ - trigger?: any; - - /** - * 触发行为 - * 鼠标悬浮, 鼠标点击('hover','click')或者它们组成的数组,如 ['hover', 'click'], 强烈不建议使用'focus',若弹窗内容有复杂交互请使用click - */ - triggerType?: string | Array; - - /** - * 任何visible为false时会触发的事件 - */ - onClose?: () => void; - - /** - * 是否进行自动位置调整 - */ - needAdjust?: boolean; - - /** - * 弹层在触发以后的延时显示, 单位毫秒 ms - */ - delay?: number; - - /** - * 浮层关闭后触发的事件, 如果有动画,则在动画结束后触发 - */ - afterClose?: () => void; - - /** - * 强制更新定位信息 - */ - shouldUpdatePosition?: boolean; - - /** - * 弹层出现后是否自动focus到内部第一个元素 - */ - autoFocus?: boolean; - - /** - * 安全节点:对于triggetType为click的浮层,会在点击除了浮层外的其它区域时关闭浮层.safeNode用于添加不触发关闭的节点, 值可以是dom节点的id或者是节点的dom对象 - */ - safeNode?: any; - - /** - * 用来指定safeNode节点的id,和safeNode配合使用 - */ - safeId?: string; - - /** - * 配置动画的播放方式 - */ - animation?: any | boolean; - - /** - * 弹层的dom节点关闭时是否删除 - */ - cache?: boolean; - - /** - * 指定浮层渲染的父节点, 可以为节点id的字符串,也可以返回节点的函数。 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层组件style,透传给Popup - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层组件className,透传给Popup - */ - popupClassName?: string; - - /** - * 弹层组件属性,透传给Popup - */ - popupProps?: PopupProps; - - /** - * 弹层id, 传入值才会支持无障碍 - */ - id?: string; - followTrigger?: boolean; - /** - * 开启 v2 - */ - v2?: boolean; - /** - * [v2] 箭头是否指向目标元素的中心 - */ - arrowPointToCenter?: boolean; - /** - * [v2] 是否进行自动位置调整,默认自动开启 - */ - autoAdjust?: boolean; -} - -export default class Balloon extends React.Component { - static Tooltip: typeof Tooltip; -} diff --git a/types/box/index.d.ts b/types/box/index.d.ts deleted file mode 100644 index 1c1013013e..0000000000 --- a/types/box/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/// - -import React, { HTMLAttributes, ElementType, Component } from 'react'; -import { CommonProps } from '../util'; - -export interface BoxProps extends HTMLAttributes, CommonProps { - device?: 'phone' | 'tablet' | 'desktop'; - flex?: number | Array; - direction?: 'row' | 'column' | 'row-reverse'; - wrap?: boolean; - spacing?: number | Array; - margin?: number | Array; - padding?: number | Array; - justify?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | string; - align?: 'flex-start' | 'center' | 'flex-end' | 'baseline' | 'stretch' | string; - component?: keyof React.JSX.IntrinsicElements; -} - -export default class Box extends Component {} diff --git a/types/breadcrumb/index.d.ts b/types/breadcrumb/index.d.ts deleted file mode 100644 index b598fc6108..0000000000 --- a/types/breadcrumb/index.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/// - -import * as React from 'react'; -import { PopupProps } from '../overlay'; - -export interface ItemProps extends React.HTMLAttributes { - /** - * 面包屑节点链接,如果设置这个属性,则该节点为`` ,否则是`` - */ - link?: string; - onClick?: React.MouseEventHandler; -} - -export class Item extends React.Component {} -export interface BreadcrumbProps extends React.HTMLAttributes { - /** - * 样式类名的品牌前缀 - */ - prefix?: string; - - /** - * 面包屑子节点,需传入 Breadcrumb.Item - */ - children?: any; - - /** - * 面包屑最多显示个数,超出部分会被隐藏 - */ - maxNode?: number | 'auto'; - - /** - * 分隔符,可以是文本或 Icon - */ - separator?: string | React.ReactNode; - - /** - * 设置标签类型 - */ - component?: string | (() => void); - /** - * 当超过的项被隐藏时,是否可通过点击省略号展示菜单(包含被隐藏的项) - */ - showHiddenItems?: boolean; - /** - * 弹层挂载的容器节点(在showHiddenItems为true时才有意义) - */ - popupContainer?: any; - /** - * 是否跟随trigger滚动(在showHiddenItems为true时才有意义) - */ - followTrigger?: boolean; - /** - * 添加到弹层上的属性(在showHiddenItems为true时才有意义) - */ - popupProps?: PopupProps; -} - -export default class Breadcrumb extends React.Component { - static Item: typeof Item; -} diff --git a/types/button/index.d.ts b/types/button/index.d.ts deleted file mode 100644 index 74dc9e8796..0000000000 --- a/types/button/index.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -/// -import type { ButtonProps, GroupProps } from './types'; -import Button from './view/button'; -export type { ButtonProps, GroupProps }; -declare const _default: { - new ( - props: ButtonProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - ButtonProps & import('../config-provider/types').ComponentCommonProps, - Button - >; - contextType?: import('react').Context | undefined; -} & { - propTypes: { - prefix: import('prop-types').Requireable; - rtl: import('prop-types').Requireable; - type: import('prop-types').Requireable; - size: import('prop-types').Requireable; - icons: import('prop-types').Requireable< - import('prop-types').InferProps<{ - loading: import('prop-types').Requireable; - }> - >; - iconSize: import('prop-types').Requireable>; - htmlType: import('prop-types').Requireable; - component: import('prop-types').Requireable; - loading: import('prop-types').Requireable; - ghost: import('prop-types').Requireable; - text: import('prop-types').Requireable; - warning: import('prop-types').Requireable; - disabled: import('prop-types').Requireable; - onClick: import('prop-types').Requireable<(...args: any[]) => any>; - className: import('prop-types').Requireable; - onMouseUp: import('prop-types').Requireable<(...args: any[]) => any>; - children: import('prop-types').Requireable; - locale: import('prop-types').Requireable; - defaultPropsConfig: import('prop-types').Requireable; - errorBoundary: import('prop-types').Requireable< - NonNullable - >; - pure: import('prop-types').Requireable; - device: import('prop-types').Requireable; - popupContainer: import('prop-types').Requireable; - }; - defaultProps: { - prefix: string; - type: string; - size: string; - icons: {}; - htmlType: string; - component: string; - loading: boolean; - ghost: boolean; - text: boolean; - warning: boolean; - disabled: boolean; - onClick: () => void; - }; - Group: { - new ( - props: GroupProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - GroupProps & import('../config-provider/types').ComponentCommonProps, - { - render(): import('react').JSX.Element; - context: any; - setState( - state: - | {} - | (( - prevState: Readonly<{}>, - props: Readonly - ) => {} | Pick<{}, K> | null) - | Pick<{}, K> - | null, - callback?: (() => void) | undefined - ): void; - forceUpdate(callback?: (() => void) | undefined): void; - readonly props: Readonly & - Readonly<{ - children?: import('react').ReactNode; - }>; - state: Readonly<{}>; - refs: { - [key: string]: import('react').ReactInstance; - }; - componentDidMount?(): void; - shouldComponentUpdate?( - nextProps: Readonly, - nextState: Readonly<{}>, - nextContext: any - ): boolean; - componentWillUnmount?(): void; - componentDidCatch?(error: Error, errorInfo: import('react').ErrorInfo): void; - getSnapshotBeforeUpdate?( - prevProps: Readonly, - prevState: Readonly<{}> - ): any; - componentDidUpdate?( - prevProps: Readonly, - prevState: Readonly<{}>, - snapshot?: any - ): void; - componentWillMount?(): void; - UNSAFE_componentWillMount?(): void; - componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void; - UNSAFE_componentWillReceiveProps?( - nextProps: Readonly, - nextContext: any - ): void; - componentWillUpdate?( - nextProps: Readonly, - nextState: Readonly<{}>, - nextContext: any - ): void; - UNSAFE_componentWillUpdate?( - nextProps: Readonly, - nextState: Readonly<{}>, - nextContext: any - ): void; - } - >; - contextType?: import('react').Context | undefined; - } & { - propTypes: { - rtl: import('prop-types').Requireable; - prefix: import('prop-types').Requireable; - size: import('prop-types').Requireable; - className: import('prop-types').Requireable; - children: import('prop-types').Requireable; - locale: import('prop-types').Requireable; - defaultPropsConfig: import('prop-types').Requireable; - errorBoundary: import('prop-types').Requireable< - NonNullable - >; - pure: import('prop-types').Requireable; - warning: import('prop-types').Requireable; - device: import('prop-types').Requireable; - popupContainer: import('prop-types').Requireable; - }; - defaultProps: { - prefix: string; - size: string; - }; - }; -}; -export default _default; diff --git a/types/button/mobile/index.d.ts b/types/button/mobile/index.d.ts deleted file mode 100644 index 9eca876add..0000000000 --- a/types/button/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Button } from '@alifd/meet-react'; -export default Button; diff --git a/types/button/types.d.ts b/types/button/types.d.ts deleted file mode 100644 index 5818a15c4c..0000000000 --- a/types/button/types.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as React from 'react'; -import { CommonProps } from '../util'; -/** - * 按钮类型 - * @api - */ -export type ButtonSize = 'small' | 'medium' | 'large'; -/** - * @api Button.Group - */ -export interface GroupProps extends React.HTMLAttributes, CommonProps { - /** - * 统一设置 Button 组件的按钮大小 - */ - size?: ButtonSize; -} -type HTMLAttributesWeak = Omit, 'type' | 'onClick'>; -/** - * @api Button - */ -export interface ButtonProps extends HTMLAttributesWeak, CommonProps { - /** - * 按钮的类型 - * @en Typeo of button - * @defaultValue 'normal' - */ - type?: 'primary' | 'secondary' | 'normal'; - /** - * @deprecated use `warning` `text` `ghost` insteaded - * @skip - */ - shape?: 'warning' | 'text' | 'ghost'; - /** - * 按钮的尺寸 - * @en Size of button - * @defaultValue 'medium' - */ - size?: ButtonSize; - /** - * 按钮中可配置的 Icon - * @en Available icons in button - * @example - * \{ loading: \} - */ - icons?: { - loading?: React.ReactNode; - }; - /** - * 按钮中 Icon 的尺寸 - * @en Size of icon in button - * @defaultValue 默认根据 size 自动映射,映射规则: - * size:large -\> `small` - * size:medium -\> `xs` - * size:small -\> `xs` - */ - iconSize?: - | number - | 'xxs' - | 'xs' - | 'small' - | 'medium' - | 'large' - | 'xl' - | 'xxl' - | 'xxxl' - | 'inherit'; - /** - * button 标签的 type 值 - * @en Original html type for button element - * @defaultValue 'button' - * @remarks 仅当 component = 'button' 时使用 - */ - htmlType?: 'submit' | 'reset' | 'button'; - /** - * 最终渲染的 jsx 标签标签类型 - * @en The jsx tag to be rendered - * @remarks 直接去掉原先的 ReactNode 类型,因为即使传递了非法类型运行时也会报错,不如在类型提示阶段就将错误抛出 - */ - component?: 'button' | 'a' | React.ComponentType; - /** - * 设置按钮的载入状态 - * @en Loading state of a button - * @defaultValue false - */ - loading?: boolean; - /** - * 是否为幽灵按钮 - * @en Setting ghost button - * @defaultValue false - */ - ghost?: true | false | 'light' | 'dark'; - /** - * 是否为文本按钮 - * @en Is text button - * @defaultValue false - */ - text?: boolean; - /** - * 是否为警告按钮 - * @en Is warning button - * @defaultValue false - */ - warning?: boolean; - /** - * 是否禁用 - * @en Is disabled - * @defaultValue false - */ - disabled?: boolean; - /** - * 点击按钮的回调 - * @en Callback of click event - */ - onClick?: React.MouseEventHandler; - /** - * 'a' 标签的 href 属性 - * @remarks 仅在 component = 'a' 时使用 - * @skip - */ - href?: string; - /** - * 'a' 标签的 target 属性 - * @remarks 仅在 component = 'a' 时使用 - * @skip - */ - target?: string; - /** - * 'ReactRouterLink' 组件的 to 属性 - * @remarks 仅在 component 支持 to 属性时使用 - * @skip - */ - to?: string; -} -export {}; diff --git a/types/button/view/button.d.ts b/types/button/view/button.d.ts deleted file mode 100644 index c2412b06e2..0000000000 --- a/types/button/view/button.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import * as React from 'react'; -import { Component } from 'react'; -import * as PropTypes from 'prop-types'; -import { ButtonProps } from '../types'; -export default class Button extends Component { - static propTypes: { - prefix: PropTypes.Requireable; - rtl: PropTypes.Requireable; - type: PropTypes.Requireable; - size: PropTypes.Requireable; - icons: PropTypes.Requireable< - PropTypes.InferProps<{ - loading: PropTypes.Requireable; - }> - >; - iconSize: PropTypes.Requireable>; - htmlType: PropTypes.Requireable; - component: PropTypes.Requireable; - loading: PropTypes.Requireable; - ghost: PropTypes.Requireable; - text: PropTypes.Requireable; - warning: PropTypes.Requireable; - disabled: PropTypes.Requireable; - onClick: PropTypes.Requireable<(...args: any[]) => any>; - className: PropTypes.Requireable; - onMouseUp: PropTypes.Requireable<(...args: any[]) => any>; - children: PropTypes.Requireable; - locale: PropTypes.Requireable; - defaultPropsConfig: PropTypes.Requireable; - errorBoundary: PropTypes.Requireable>; - pure: PropTypes.Requireable; - device: PropTypes.Requireable; - popupContainer: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - type: string; - size: string; - icons: {}; - htmlType: string; - component: string; - loading: boolean; - ghost: boolean; - text: boolean; - warning: boolean; - disabled: boolean; - onClick: () => void; - }; - button: HTMLButtonElement | HTMLAnchorElement | unknown; - onMouseUp: (e: React.MouseEvent) => void; - buttonRefHandler: (button: unknown) => void; - render(): React.JSX.Element; -} diff --git a/types/button/view/group.d.ts b/types/button/view/group.d.ts deleted file mode 100644 index 60250c4c89..0000000000 --- a/types/button/view/group.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from 'react'; -import { Component } from 'react'; -import * as PropTypes from 'prop-types'; -import { GroupProps } from '../types'; -/** - * Button.Group - */ -declare class ButtonGroup extends Component { - static propTypes: { - rtl: PropTypes.Requireable; - prefix: PropTypes.Requireable; - size: PropTypes.Requireable; - className: PropTypes.Requireable; - children: PropTypes.Requireable; - locale: PropTypes.Requireable; - defaultPropsConfig: PropTypes.Requireable; - errorBoundary: PropTypes.Requireable>; - pure: PropTypes.Requireable; - warning: PropTypes.Requireable; - device: PropTypes.Requireable; - popupContainer: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - size: string; - }; - render(): React.JSX.Element; -} -declare const _default: { - new ( - props: GroupProps & import('../../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../../config-provider/types').ConfiguredComponent< - GroupProps & import('../../config-provider/types').ComponentCommonProps, - ButtonGroup - >; - contextType?: React.Context | undefined; -} & { - propTypes: { - rtl: PropTypes.Requireable; - prefix: PropTypes.Requireable; - size: PropTypes.Requireable; - className: PropTypes.Requireable; - children: PropTypes.Requireable; - locale: PropTypes.Requireable; - defaultPropsConfig: PropTypes.Requireable; - errorBoundary: PropTypes.Requireable>; - pure: PropTypes.Requireable; - warning: PropTypes.Requireable; - device: PropTypes.Requireable; - popupContainer: PropTypes.Requireable; - }; - defaultProps: { - prefix: string; - size: string; - }; -}; -export default _default; diff --git a/types/calendar/index.d.ts b/types/calendar/index.d.ts deleted file mode 100644 index bc87a4e32c..0000000000 --- a/types/calendar/index.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onSelect?: any; -} - -export interface CalendarProps extends HTMLAttributesWeak, CommonProps { - /** - * 默认选中的日期(moment 对象) - */ - defaultValue?: any; - - /** - * 选中的日期值 (moment 对象) - */ - value?: any; - - /** - * 是否展示非本月的日期 - */ - showOtherMonth?: boolean; - - /** - * 默认展示的月份 - */ - defaultVisibleMonth?: () => void; - - /** - * 展现形态 - */ - shape?: 'card' | 'fullscreen' | 'panel'; - - /** - * 选择日期单元格时的回调 - */ - onSelect?: (value: {}) => void; - - /** - * 展现的月份变化时的回调 - */ - onVisibleMonthChange?: (value: {}, reason: string) => void; - - /** - * 自定义样式类 - */ - className?: string; - - /** - * 自定义日期渲染函数 - */ - dateCellRender?: (value: {}) => React.ReactNode; - - /** - * 自定义月份渲染函数 - */ - monthCellRender?: (calendarDate: {}) => React.ReactNode; - - /** - * 不可选择的日期 - */ - disabledDate?: (calendarDate: {}, view: string) => boolean; -} - -export default class Calendar extends React.Component {} diff --git a/types/calendar2/index.d.ts b/types/calendar2/index.d.ts deleted file mode 100644 index df65897047..0000000000 --- a/types/calendar2/index.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { Dayjs, ConfigType } from 'dayjs'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onSelect?: any; - onChange?: any; -} - -export interface CalendarProps extends HTMLAttributesWeak, CommonProps { - name?: string; - /** - * 默认选中的日期(dayjs 对象) - */ - defaultValue?: ConfigType; - - /** - * 选中的日期值 (dayjs 对象) - */ - value?: ConfigType; - - /** - * 面板默认显示的日期 - */ - defaultPanelValue?: ConfigType; - - /** - * 展现形态 - */ - shape?: 'card' | 'fullscreen' | 'panel'; - - /** - * 选择日期单元格时的回调 - */ - onSelect?: (value: Dayjs, strVal: string) => void; - - /** - * 值改变时的回调 - */ - onChange?: (value: Dayjs, strVal: string) => void; - - /** - * 日期面板变化回调 - */ - onPanelChange?: (value: Dayjs, mode: string) => void; - - /** - * 自定义样式类 - */ - className?: string; - - /** - * 自定义日期渲染 - */ - dateCellRender?: (value: Dayjs) => React.ReactNode; - - /** - * 自定义月份渲染函数 - */ - monthCellRender?: (value: Dayjs) => React.ReactNode; - - /** - * 自定义年份渲染函数 - */ - yearCellRender?: (value: Dayjs) => React.ReactNode; - - /** - * 不可选择的日期 - */ - disabledDate?: (value: Dayjs, mode: string) => boolean; -} - -export default class Calendar extends React.Component {} diff --git a/types/card/index.d.ts b/types/card/index.d.ts deleted file mode 100644 index 687199d165..0000000000 --- a/types/card/index.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} - -export interface CardProps extends HTMLAttributesWeak, CommonProps { - /** - * 卡片的上的图片 / 视频 - */ - media?: React.ReactNode; - - /** - * 卡片的标题 - */ - title?: React.ReactNode; - - /** - * 卡片的副标题 - */ - subTitle?: React.ReactNode; - - /** - * 卡片操作组,位置在卡片底部 - */ - actions?: React.ReactNode; - - /** - * 是否显示标题的项目符号 - */ - showTitleBullet?: boolean; - - /** - * 是否展示头部的分隔线 - */ - showHeadDivider?: boolean; - - /** - * 内容区域的固定高度 - */ - contentHeight?: string | number; - - /** - * 标题区域的用户自定义内容 - */ - extra?: React.ReactNode; - - /** - * 是否开启自由模式,开启后card 将使用子组件配合使用, 设置此项后 title, subtitle, 等等属性都将失效 - */ - free?: boolean; - hasBorder?: boolean; -} - -export interface CardBulletHeaderProps extends HTMLAttributesWeak, CommonProps { - /** - * 卡片的标题 - */ - title?: React.ReactNode; - - /** - * 卡片的副标题 - */ - subTitle?: React.ReactNode; - /** - * 是否显示标题的项目符号 - */ - showTitleBullet?: boolean; - /** - * 标题区域的用户自定义内容 - */ - extra?: React.ReactNode; -} - -export interface CardCollaspeContentProps extends HTMLAttributesWeak, CommonProps { - contentHeight?: string | number; -} -export interface CardCollapseContentProps extends HTMLAttributesWeak, CommonProps { - contentHeight?: string | number; -} - -export interface CardHeaderProps extends HTMLAttributesWeak, CommonProps { - /** - * 卡片的标题 - */ - title?: React.ReactNode; - - /** - * 卡片的副标题 - */ - subTitle?: React.ReactNode; - - /** - * 标题区域的用户自定义内容 - */ - extra?: React.ReactNode; - - /** - * 设置标签类型 - */ - component?: React.ElementType; -} - -export interface CardContentProps extends HTMLAttributesWeak, CommonProps { - /** - * 设置标签类型 - */ - component?: React.ElementType; -} - -export interface CardMediaProps extends HTMLAttributesWeak, CommonProps { - /** - * 设置标签类型 - */ - component?: React.ElementType; - /** - * 背景图片地址 - */ - image?: string; - /** - * 媒体源文件地址 - */ - src?: string; -} - -export interface CardActionsProps extends HTMLAttributesWeak, CommonProps {} - -export interface CardDividerProps extends HTMLAttributesWeak, CommonProps { - /** - * 分割线是否向内缩进 - */ - inset?: boolean; -} - -export default class Card extends React.Component { - static BulletHeader: React.ComponentType; - static CollaspeContent: React.ComponentType; - static CollapseContent: React.ComponentType; - static Header: React.ComponentType; - static Content: React.ComponentType; - static Media: React.ComponentType; - static Actions: React.ComponentType; - static Divider: React.ComponentType; -} diff --git a/types/cascader-select/index.d.ts b/types/cascader-select/index.d.ts deleted file mode 100644 index 70a1d683e3..0000000000 --- a/types/cascader-select/index.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -/// - -import * as React from 'react'; -import { CascaderProps, data, extra } from '../cascader'; -import { CommonProps } from '../util'; -import { PopupProps } from '../overlay'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -export interface CascaderSelectProps extends CascaderProps, HTMLAttributesWeak, CommonProps { - /** - * 选择框大小 - */ - size?: 'small' | 'medium' | 'large'; - name?: string; - - /** - * 选择框占位符 - */ - placeholder?: string; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 是否有下拉箭头 - */ - hasArrow?: boolean; - - /** - * 是否有边框 - */ - hasBorder?: boolean; - - /** - * 是否有清除按钮 - */ - hasClear?: boolean; - - /** - * 自定义内联 label - */ - label?: React.ReactNode; - - /** - * 是否只读,只读模式下可以展开弹层但不能选 - */ - readOnly?: boolean; - - /** - * 数据源,结构可参考下方说明 - */ - dataSource?: Array; - - /** - * (非受控)默认值 - */ - defaultValue?: string | Array; - - /** - * (受控)当前值 - */ - value?: string | Array; - - valueRender?: (item: any) => React.ReactNode; - - /** - * 选中值改变时触发的回调函数 - */ - onChange?: (value: string | Array, data: data | Array, extra: extra) => void; - - /** - * 默认展开值,如果不设置,组件内部会根据 defaultValue/value 进行自动设置 - */ - defaultExpandedValue?: Array; - - /** - * 展开触发的方式 - */ - expandTriggerType?: 'click' | 'hover'; - - /** - * 是否开启虚拟滚动 - */ - useVirtual?: boolean; - - /** - * 是否多选 - */ - multiple?: boolean; - - /** - * 是否选中即发生改变, 该属性仅在单选模式下有效 - */ - changeOnSelect?: boolean; - - /** - * 是否只能勾选叶子项的checkbox,该属性仅在多选模式下有效 - */ - canOnlyCheckLeaf?: boolean; - - /** - * 父子节点是否选中不关联 - */ - checkStrictly?: boolean; - - /** - * 每列列表样式对象 - */ - listStyle?: React.CSSProperties; - - /** - * 每列列表类名 - */ - listClassName?: string; - - /** - * 选择框单选时展示结果的自定义渲染函数 - */ - displayRender?: (label: Array) => React.ReactNode; - - /** - * 渲染 item 内容的方法 - */ - itemRender?: (item: data) => React.ReactNode; - - /** - * 是否显示搜索框 - */ - showSearch?: boolean; - - /** - * 自定义搜索函数 - */ - filter?: (searchValue: string, path: Array) => boolean; - - /** - * 当搜索框值变化时回调 - */ - onSearch?: (value: string) => void; - - /** - * 搜索结果自定义渲染函数 - */ - resultRender?: (searchValue: string, path: Array) => React.ReactNode; - - /** - * 搜索结果列表是否和选择框等宽 - */ - resultAutoWidth?: boolean; - - /** - * 无数据时显示内容 - */ - notFoundContent?: React.ReactNode; - - /** - * 异步加载数据函数 - */ - loadData?: (data: {}) => void; - - /** - * 自定义下拉框头部 - */ - header?: React.ReactNode; - - /** - * 自定义下拉框底部 - */ - footer?: React.ReactNode; - - /** - * 初始下拉框是否显示 - */ - defaultVisible?: boolean; - - /** - * 当前下拉框是否显示 - */ - visible?: boolean; - - /** - * 下拉框显示或关闭时触发事件的回调函数 - */ - onVisibleChange?: (visible: boolean, type: string) => void; - - /** - * 下拉框自定义样式对象 - */ - popupStyle?: React.CSSProperties; - - /** - * 下拉框样式自定义类名 - */ - popupClassName?: string; - - /** - * 下拉框挂载的容器节点 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 是否跟随滚动 - */ - followTrigger?: boolean; - - /** - * 透传到 Popup 的属性对象 - */ - popupProps?: PopupProps; - - /** - * 是否是不可变数据 - */ - immutable?: boolean; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - renderPreview?: (value: string | Array) => React.ReactNode; -} - -export default class CascaderSelect extends React.Component {} diff --git a/types/cascader/index.d.ts b/types/cascader/index.d.ts deleted file mode 100644 index 1c7566f093..0000000000 --- a/types/cascader/index.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -type data = { - value?: string; - label?: string; - disabled?: boolean; - checkboxDisabled?: boolean; - children?: Array; - [propName: string]: any; -}; - -type extra = { - /** - * 单选时选中的数据的路径 - */ - selectedPath?: Array; - /** - * 多选时当前的操作是选中还是取消选中 - */ - checked?: boolean; - /** - * 多选时当前操作的数据 - */ - currentData?: any; - /** - * 多选时所有被选中的数据 - */ - checkedData?: Array; - /** - * 多选时半选的数据 - */ - indeterminateData?: Array; -}; - -export interface CascaderProps extends HTMLAttributesWeak, CommonProps { - /** - * 数据源,结构可参考下方说明 - */ - dataSource?: Array; - - /** - * (非受控)默认值 - */ - defaultValue?: string | Array; - - /** - * (受控)当前值 - */ - value?: string | Array; - - /** - * 选中值改变时触发的回调函数 - */ - onChange?: (value: string | Array, data: data | Array, extra: extra) => void; - - /** - * (非受控)默认展开值,如果不设置,组件内部会根据 defaultValue/value 进行自动设置 - */ - defaultExpandedValue?: Array; - - /** - * (受控)当前展开值 - */ - expandedValue?: Array; - - /** - * 展开触发的方式 - */ - expandTriggerType?: 'click' | 'hover'; - - /** - * 展开时触发的回调函数 - */ - onExpand?: (expandedValue: Array) => void; - - /** - * 是否开启虚拟滚动 - */ - useVirtual?: boolean; - - /** - * 是否多选 - */ - multiple?: boolean; - - /** - * 单选时是否只能选中叶子节点 - */ - canOnlySelectLeaf?: boolean; - - /** - * 多选时是否只能选中叶子节点 - */ - canOnlyCheckLeaf?: boolean; - - /** - * 父子节点是否选中不关联 - */ - checkStrictly?: boolean; - - /** - * 每列列表样式对象 - */ - listStyle?: React.CSSProperties; - - /** - * 每列列表类名 - */ - listClassName?: string; - - /** - * 每列列表项渲染函数 - */ - itemRender?: (data: data) => React.ReactNode; - - /** - * 异步加载数据函数,source是原始对象 - */ - loadData?: (data: data, source: data) => void; - - /** - * 是否是不可变数据 - */ - immutable?: boolean; -} - -export default class Cascader extends React.Component {} diff --git a/types/checkbox/index.d.ts b/types/checkbox/index.d.ts deleted file mode 100644 index 1afb780fdc..0000000000 --- a/types/checkbox/index.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -type data = { - value?: string | number | boolean; - label?: React.ReactNode; - disabled?: boolean; - [propName: string]: any; -}; - -export type CheckboxData = data; - -export interface GroupProps extends HTMLAttributesWeak, CommonProps { - /** - * 自定义类名 - */ - className?: string; - - /** - * 自定义内敛样式 - */ - style?: React.CSSProperties; - - /** - * 整体禁用 - */ - disabled?: boolean; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - renderPreview?: (checked: boolean, props: object) => React.ReactNode; - - /** - * 可选项列表, 数据项可为 String 或者 Object, 如 `['apple', 'pear', 'orange']` 或者 `[{value: 'apple', label: '苹果',}, {value: 'pear', label: '梨'}, {value: 'orange', label: '橙子'}]` - */ - dataSource?: Array | Array | Array; - - /** - * 被选中的值列表 - */ - value?: Array | Array | Array | string | number | boolean; - - /** - * 默认被选中的值列表 - */ - defaultValue?: Array | Array | Array | string | number | boolean; - - /** - * name - */ - name?: string; - - /** - * 通过子元素方式设置内部 checkbox - */ - children?: Array; - - /** - * 选中值改变时的事件 - */ - onChange?: (value: Array | Array | Array, e: any) => void; - - /** - * 子项目的排列方式 - * - hoz: 水平排列 (default) - * - ver: 垂直排列 - */ - direction?: 'hoz' | 'ver'; - itemDirection?: 'hoz' | 'ver'; -} - -export class Group extends React.Component {} -interface HTMLAttributesWeak extends React.HTMLAttributes { - onChange?: any; - onMouseEnter?: any; - onMouseLeave?: any; -} - -export interface CheckboxProps extends HTMLAttributesWeak, CommonProps { - /** - * 自定义类名 - */ - className?: string; - - /** - * checkbox id, 挂载在input上 - */ - id?: string; - - /** - * 自定义内敛样式 - */ - style?: React.CSSProperties; - - /** - * 选中状态 - */ - checked?: boolean; - - /** - * checkbox 的value - */ - value?: string | number | boolean; - - /** - * name - */ - name?: string; - - /** - * 默认选中状态 - */ - defaultChecked?: boolean; - - /** - * 禁用 - */ - disabled?: boolean; - - /** - * 通过属性配置label, - */ - label?: React.ReactNode; - - /** - * Checkbox 的中间状态,只会影响到 Checkbox 的样式,并不影响其 checked 属性 - */ - indeterminate?: boolean; - - /** - * Checkbox 的默认中间态,只会影响到 Checkbox 的样式,并不影响其 checked 属性 - */ - defaultIndeterminate?: boolean; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - /** - * 状态变化时触发的事件 - */ - onChange?: (checked: boolean, e: any) => void; - - /** - * 鼠标进入enter事件 - */ - onMouseEnter?: (e: React.MouseEvent) => void; - - /** - * 鼠标离开Leave事件 - */ - onMouseLeave?: (e: React.MouseEvent) => void; -} - -export default class Checkbox extends React.Component { - static Group: typeof Group; -} diff --git a/types/collapse/index.d.ts b/types/collapse/index.d.ts deleted file mode 100644 index 571f1a8607..0000000000 --- a/types/collapse/index.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} - -export interface PanelProps extends HTMLAttributesWeak, CommonProps { - /** - * 样式类名的品牌前缀 - */ - prefix?: string; - - /** - * 子组件接受行内样式 - */ - style?: React.CSSProperties; - - /** - * 是否禁止用户操作 - */ - disabled?: boolean; - - /** - * 标题 - */ - title?: React.ReactNode; - - /** - * 扩展class - */ - className?: string; -} - -export class Panel extends React.Component {} - -type data = { - title?: React.ReactNode; - content?: React.ReactNode; - disabled?: boolean; - key?: string; - [propName: string]: any; -}; - -export interface CollapseProps extends React.HTMLAttributes, CommonProps { - /** - * 样式前缀 - */ - prefix?: string; - - /** - * 组件接受行内样式 - */ - style?: React.CSSProperties; - - /** - * 使用数据模型构建 - */ - dataSource?: Array; - - /** - * 默认展开keys - */ - defaultExpandedKeys?: Array; - - /** - * 受控展开keys - */ - expandedKeys?: Array; - - /** - * 展开状态发升变化时候的回调 - */ - onExpand?: (expandedKeys: Array) => void; - - /** - * 所有禁用 - */ - disabled?: boolean; - - /** - * 扩展class - */ - className?: string; - - /** - * 手风琴模式,一次只能打开一个 - */ - accordion?: boolean; -} - -export default class Collapse extends React.Component { - static Panel: typeof Panel; -} diff --git a/types/config-provider/cache.d.ts b/types/config-provider/cache.d.ts deleted file mode 100644 index cf08015981..0000000000 --- a/types/config-provider/cache.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -declare class Cache { - _root: unknown; - _store: Map; - constructor(); - empty(): boolean; - has(key: unknown): boolean; - get(key: unknown, defaultValue?: T): T | null | undefined; - add(key: unknown, value: unknown): void; - update(key: unknown, value: unknown): void; - remove(key: unknown): void; - clear(): void; - root(): unknown; -} -export default Cache; diff --git a/types/config-provider/config.d.ts b/types/config-provider/config.d.ts deleted file mode 100644 index 73ac5ca781..0000000000 --- a/types/config-provider/config.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { - ComponentClass, - FunctionComponent, - ForwardRefExoticComponent, - ComponentProps, - ComponentRef, - StaticLifecycle, -} from 'react'; -import { Locale } from '../locale/types'; -import type { ConfigOptions, ComponentCommonProps, ConfiguredComponent } from './types'; -export declare function initLocales(locales?: Record): void; -export declare function setLanguage(language: string): void; -export declare function setLocale(locale: Partial): void; -export declare function setDirection(dir: 'ltr' | 'rtl'): void; -export declare function getLocale(): Partial; -export declare function getLanguage(): string; -export declare function getDirection(): boolean | undefined; -export type ExcludeComponentStatics = - | 'prototype' - | 'contextType' - | keyof StaticLifecycle; -declare function config< - C extends ComponentClass | ForwardRefExoticComponent | FunctionComponent, - R = C extends ComponentClass - ? InstanceType - : C extends ForwardRefExoticComponent - ? ComponentRef - : unknown, ->( - Component: C, - options?: ConfigOptions> -): typeof ConfiguredComponent & ComponentCommonProps, R> & { - [K in Exclude]: C[K]; -}; -export { config }; diff --git a/types/config-provider/consumer.d.ts b/types/config-provider/consumer.d.ts deleted file mode 100644 index 7ded1cd1c8..0000000000 --- a/types/config-provider/consumer.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ReactElement, ReactNode } from 'react'; -import * as PropTypes from 'prop-types'; -import { ConfigProviderProps } from './types'; -export type ConsumerState = Pick< - ConfigProviderProps, - 'prefix' | 'pure' | 'rtl' | 'warning' | 'device' | 'popupContainer' | 'locale' ->; -export interface ConsumerProps { - children?: ((state: ConsumerState) => ReactElement) | ReactNode; -} -/** - * Consumer - */ -declare const Consumer: { - ({ children }: ConsumerProps, context: Record): any; - /** - * PropTypes - */ - propTypes: { - children: PropTypes.Requireable<(...args: any[]) => any>; - }; - /** - * ContextTypes (legacy context) - */ - contextTypes: { - nextPrefix: PropTypes.Requireable; - nextLocale: PropTypes.Requireable; - nextPure: PropTypes.Requireable; - newRtl: PropTypes.Requireable; - nextWarning: PropTypes.Requireable; - nextDevice: PropTypes.Requireable; - nextPopupContainer: PropTypes.Requireable; - }; -}; -export default Consumer; diff --git a/types/config-provider/error-boundary.d.ts b/types/config-provider/error-boundary.d.ts deleted file mode 100644 index 2141a518df..0000000000 --- a/types/config-provider/error-boundary.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import { Component, ErrorInfo } from 'react'; -import * as PropTypes from 'prop-types'; -import { ErrorBoundaryConfig } from './types'; -export type ErrorBoundaryProps = ErrorBoundaryConfig; -interface ErrorBoundaryState { - error?: Error | null; - errorInfo?: ErrorInfo | null; -} -export default class ErrorBoundary extends Component { - static propTypes: { - children: PropTypes.Requireable; - afterCatch: PropTypes.Requireable<(...args: any[]) => any>; - fallbackUI: PropTypes.Requireable<(...args: any[]) => any>; - }; - constructor(props: ErrorBoundaryProps); - componentDidCatch(error: Error, errorInfo: ErrorInfo): void; - render(): React.ReactNode; -} -export {}; diff --git a/types/config-provider/get-context-props.d.ts b/types/config-provider/get-context-props.d.ts deleted file mode 100644 index e340d8897d..0000000000 --- a/types/config-provider/get-context-props.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ContextState, OverlayCommonProps, ParsedContextConfig } from './types'; -export default function getContextProps

>( - props: P, - context: ContextState, - displayName: string -): ParsedContextConfig; diff --git a/types/config-provider/index.d.ts b/types/config-provider/index.d.ts deleted file mode 100644 index 0a623e4217..0000000000 --- a/types/config-provider/index.d.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Component } from 'react'; -import * as PropTypes from 'prop-types'; -import { - config, - initLocales, - setLanguage, - setLocale, - setDirection, - getLocale, - getLanguage, - getDirection, -} from './config'; -import ErrorBoundary from './error-boundary'; -import type { ConfigProviderProps, ComponentCommonProps, ContextState } from './types'; -declare class ConfigProvider extends Component< - ConfigProviderProps, - Pick -> { - static propTypes: { - /** - * 样式类名的品牌前缀 - */ - prefix: PropTypes.Requireable; - /** - * 国际化文案对象,属性为组件的 displayName - */ - locale: PropTypes.Requireable; - /** - * 组件 API 的默认配置 - */ - defaultPropsConfig: PropTypes.Requireable; - /** - * 是否开启错误捕捉 errorBoundary - * 如需自定义参数,请传入对象 对象接受参数列表如下: - * - * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示 - * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为,比如埋点上传 - */ - errorBoundary: PropTypes.Requireable>; - /** - * 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用 - */ - pure: PropTypes.Requireable; - /** - * 是否在开发模式下显示组件属性被废弃的 warning 提示 - */ - warning: PropTypes.Requireable; - /** - * 是否开启 rtl 模式 - */ - rtl: PropTypes.Requireable; - /** - * 设备类型,针对不同的设备类型组件做出对应的响应式变化 - */ - device: PropTypes.Requireable; - /** - * 组件树 - */ - children: PropTypes.Requireable; - /** - * 指定浮层渲染的父节点,可以为节点 id 的字符串,也可以返回节点的函数 - */ - popupContainer: PropTypes.Requireable; - }; - static defaultProps: { - warning: boolean; - errorBoundary: boolean; - }; - static contextTypes: { - nextPrefix: PropTypes.Requireable; - nextLocale: PropTypes.Requireable; - nextDefaultPropsConfig: PropTypes.Requireable; - nextPure: PropTypes.Requireable; - nextRtl: PropTypes.Requireable; - nextWarning: PropTypes.Requireable; - nextDevice: PropTypes.Requireable; - nextPopupContainer: PropTypes.Requireable; - nextErrorBoundary: PropTypes.Requireable>; - }; - static childContextTypes: { - nextPrefix: PropTypes.Requireable; - nextLocale: PropTypes.Requireable; - nextDefaultPropsConfig: PropTypes.Requireable; - nextPure: PropTypes.Requireable; - nextRtl: PropTypes.Requireable; - nextWarning: PropTypes.Requireable; - nextDevice: PropTypes.Requireable; - nextPopupContainer: PropTypes.Requireable; - nextErrorBoundary: PropTypes.Requireable>; - }; - /** - * 传入组件,生成受 ConfigProvider 控制的 HOC 组件 - * @param Component - 组件类 - * @param options - 可选项 - * @returns 被 HOC 后的组件 - */ - static config: typeof config; - static initLocales: typeof initLocales; - static setLanguage: typeof setLanguage; - static setLocale: typeof setLocale; - static setDirection: typeof setDirection; - static getLanguage: typeof getLanguage; - static getLocale: typeof getLocale; - static getDirection: typeof getDirection; - static Consumer: { - ( - { children }: import('./consumer').ConsumerProps, - context: Record - ): any; - propTypes: { - children: PropTypes.Requireable<(...args: any[]) => any> /** - * 是否开启错误捕捉 errorBoundary - * 如需自定义参数,请传入对象 对象接受参数列表如下: - * - * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示 - * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为,比如埋点上传 - */; - }; - contextTypes: { - nextPrefix: PropTypes.Requireable; - nextLocale: PropTypes.Requireable; - nextPure: PropTypes.Requireable; - newRtl: PropTypes.Requireable; - nextWarning: PropTypes.Requireable; - nextDevice: PropTypes.Requireable; - nextPopupContainer: PropTypes.Requireable; - }; - }; - static ErrorBoundary: typeof ErrorBoundary; - /** - * 传入组件的 props 和 displayName,得到和 childContext 计算过的包含有 preifx/locale/pure 的对象,一般用于通过静态方法生成脱离组件树的组件 - * @param props - 组件的 props - * @param displayName - 组件的 displayName - * @returns 新的 context props - */ - static getContextProps:

( - props: P, - displayName: string - ) => import('./types').ParsedContextConfig; - static clearCache: () => void; - static getContext: () => { - prefix: string | undefined; - locale: import('..').Locale | undefined; - defaultPropsConfig: import('./types').DefaultPropsConfig | undefined; - pure: boolean | undefined; - rtl: boolean | undefined; - warning: boolean | undefined; - device: import('./types').DeviceType | undefined; - popupContainer: import('./types').PopupContainerType | undefined; - errorBoundary: import('./types').ErrorBoundaryType | undefined; - }; - constructor(props: ConfigProviderProps, context: ContextState); - getChildContext(): { - nextPrefix: any; - nextDefaultPropsConfig: any; - nextLocale: any; - nextPure: any; - nextRtl: any; - nextWarning: any; - nextDevice: any; - nextPopupContainer: any; - nextErrorBoundary: any; - }; - static getDerivedStateFromProps( - nextProps: ConfigProviderProps, - prevState: Pick - ): { - locale: Partial | undefined; - } | null; - componentDidUpdate(): void; - componentWillUnmount(): void; - render(): - | boolean - | {} - | import('react').ReactChild - | import('react').ReactPortal - | null - | undefined; -} -export type { ConfigProviderProps }; -declare const _default: typeof ConfigProvider; -export default _default; diff --git a/types/config-provider/mobile/index.d.ts b/types/config-provider/mobile/index.d.ts deleted file mode 100644 index f9cf91f3f6..0000000000 --- a/types/config-provider/mobile/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from '../index'; diff --git a/types/config-provider/types.d.ts b/types/config-provider/types.d.ts deleted file mode 100644 index 793cd77a7d..0000000000 --- a/types/config-provider/types.d.ts +++ /dev/null @@ -1,167 +0,0 @@ -import * as React from 'react'; -import { ErrorInfo, JSXElementConstructor, Component, PropsWithChildren } from 'react'; -import { ComponentLocaleObject, Locale } from '../locale/types'; -export interface PropsDeprecatedPrinter { - (props: string, instead: string, component: string): void; -} -/** - * @api - */ -export type DeviceType = 'tablet' | 'desktop' | 'phone'; -/** - * @api - */ -export type PopupContainerType = string | HTMLElement | ((target: HTMLElement) => HTMLElement); -export interface AfterCatch { - (error: Error, errorInfo: ErrorInfo): void; -} -export interface FallbackUIProps { - error: Error; - errorInfo: ErrorInfo; -} -export type FallbackUI = JSXElementConstructor; -export interface ErrorBoundaryConfig { - afterCatch?: AfterCatch; - fallbackUI?: FallbackUI; -} -export type ErrorBoundaryType = boolean | ParsedErrorBoundary; -export interface ParsedErrorBoundary extends ErrorBoundaryConfig { - open?: boolean; -} -export type DefaultPropsConfig = Record; -/** - * Context 配置信息 - */ -export interface ContextState { - nextPrefix?: string; - nextLocale?: Locale; - nextDefaultPropsConfig?: DefaultPropsConfig; - nextPure?: boolean; - nextDevice?: DeviceType; - nextPopupContainer?: PopupContainerType; - nextRtl?: boolean; - nextWarning?: boolean; - nextErrorBoundary?: ErrorBoundaryType; -} -/** - * 组件通用参数配置 - */ -export interface ComponentCommonProps { - /** - * 样式类名的品牌前缀 - */ - prefix?: string; - /** - * 组件的国际化文案对象 - */ - locale?: ComponentLocaleObject; - /** - * 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用 - */ - pure?: boolean; - /** - * 设备类型,针对不同的设备类型组件做出对应的响应式变化 - */ - device?: DeviceType; - /** - * 是否开启 rtl 模式 - */ - rtl?: boolean; - /** - * 是否开启错误捕捉 errorBoundary - * 如需自定义参数,请传入对象 对象接受参数列表如下: - * - * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示 - * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为,比如埋点上传 - */ - errorBoundary?: ErrorBoundaryType; - /** - * 是否在开发模式下显示组件属性被废弃的 warning 提示 - */ - warning?: boolean; -} -export interface OverlayCommonProps extends ComponentCommonProps { - popupContainer?: PopupContainerType; - container?: PopupContainerType; -} -export interface ConfigOptions, Names extends string = string> { - exportNames?: Names[]; - componentName?: string; - transform?: ( - props: PropsWithChildren>, - propsDeprecatedPrinter: PropsDeprecatedPrinter - ) => PropsWithChildren; -} -/** - * @api ConfigProvider - */ -export interface ConfigProviderProps { - /** - * 样式类名的品牌前缀 - * @en Prefix of component className - */ - prefix?: string; - /** - * 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用 - * @en Enable the Pure Render mode, it will improve performance, but it will also have side effects - */ - pure?: boolean; - /** - * 设备类型,针对不同的设备类型组件做出对应的响应式变化 - * @en Responsive of device - */ - device?: DeviceType; - /** - * 是否开启 rtl 模式 - * @en Enable right to left mode - */ - rtl?: boolean; - /** - * 是否开启错误捕捉 - * @en Turn errorBoundary on or not - * @defaultValue false - * @remarks - * 如需自定义参数,请传入对象 对象接受参数列表如下: - * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示 - * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为,比如埋点上传 - */ - errorBoundary?: ErrorBoundaryType; - /** - * 是否在开发模式下显示组件属性被废弃的 warning 提示 - * @en whether to display the warning prompt for component properties being deprecated in development mode - * @defaultValue true - */ - warning?: boolean; - /** - * 各组件的国际化文案对象,属性为组件的 displayName - * @en Locale object for components - */ - locale?: Partial; - /** - * 指定浮层渲染的父节点,可以为节点 id 的字符串,也可以返回节点的函数 - * @en shell container node - */ - popupContainer?: PopupContainerType; - /** - * 组件树 - * @en children nodes - */ - children?: React.ReactNode; - /** - * 各组件 API 的默认配置 - * @en Set default props of components in batches - */ - defaultPropsConfig?: Record; -} -export interface ParsedContextConfig extends Omit { - locale?: ComponentLocaleObject; - errorBoundary: ParsedErrorBoundary; - prefix: string; - defaultPropsConfig: DefaultPropsConfig; -} -export declare class ConfiguredComponent extends Component

{ - constructor(props: P, context?: unknown); - getInstance(): R; - [key: string]: unknown; - render(): React.JSX.Element; -} diff --git a/types/date-picker/index.d.ts b/types/date-picker/index.d.ts deleted file mode 100644 index 7b75da4d30..0000000000 --- a/types/date-picker/index.d.ts +++ /dev/null @@ -1,640 +0,0 @@ -/// -import { Moment } from 'moment'; -import * as React from 'react'; -import { CommonProps } from '../util'; -import { PopupProps } from '../overlay'; -import { InputProps } from '../input'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -export interface MonthPickerProps extends HTMLAttributesWeak, CommonProps { - name?: string; - /** - * 输入框内置标签 - */ - label?: React.ReactNode; - - /** - * 输入框状态 - */ - state?: 'success' | 'loading' | 'error'; - - /** - * 输入提示 - */ - placeholder?: string; - - /** - * 默认展现的年 - */ - defaultVisibleYear?: () => void; - - /** - * 日期值(受控)moment 对象 - */ - value?: any; - - /** - * 初始日期值,moment 对象 - */ - defaultValue?: any; - - /** - * 日期值的格式(用于限定用户输入和展示) - */ - format?: string; - - /** - * 禁用日期函数 - */ - disabledDate?: (date: Moment, view: string) => boolean; - - /** - * 自定义面板页脚 - */ - footerRender?: () => React.ReactNode; - - /** - * 日期值改变时的回调 - */ - onChange?: (value: any | string) => void; - - /** - * 输入框尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 是否显示清空按钮 - */ - hasClear?: boolean; - - /** - * 弹层显示状态 - */ - visible?: boolean; - - /** - * 弹层默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 弹层展示状态变化时的回调 - */ - onVisibleChange?: (visible: boolean, reason: string) => void; - - /** - * 弹层触发方式 - */ - popupTriggerType?: 'click' | 'hover'; - - /** - * 弹层对齐方式, 具体含义见 OverLay文档 - */ - popupAlign?: string; - - /** - * 弹层容器 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层自定义样式 - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层自定义样式类 - */ - popupClassName?: string; - - /** - * 弹层其他属性 - */ - popupProps?: PopupProps; - - /** - * 输入框其他属性 - */ - inputProps?: InputProps; - - /** - * 自定义月份渲染函数 - */ - monthCellRender?: (calendarDate: any) => React.ReactNode; - - /** - * 日期输入框的 aria-label 属性 - */ - dateInputAriaLabel?: string; -} - -export class MonthPicker extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; - placeholder?: any; -} - -export interface RangePickerProps extends HTMLAttributesWeak, CommonProps { - name?: string; - type?: 'date' | 'month' | 'year'; - - /** - * 默认展示的起始月份 - */ - defaultVisibleMonth?: () => void; - - /** - * 输入提示 - */ - placeholder?: Array | string; - - /** - * 日期范围值数组 [moment, moment] - */ - value?: Array; - - /** - * 初始的日期范围值数组 [moment, moment] - */ - defaultValue?: Array; - - /** - * 日期格式 - */ - format?: string; - - /** - * 是否使用时间控件,支持传入 TimePicker 的属性 - */ - showTime?: any | boolean; - - /** - * 每次选择是否重置时间(仅在 showTime 开启时有效) - */ - resetTime?: boolean; - - /** - * 禁用日期函数 - */ - disabledDate?: (date: Moment, view: string) => boolean; - - /** - * 自定义面板页脚 - */ - footerRender?: () => React.ReactNode; - - /** - * 日期范围值改变时的回调 [ MomentObject|String, MomentObject|String ] - */ - onChange?: (value: Array) => void; - - /** - * 点击确认按钮时的回调 返回开始时间和结束时间`[ MomentObject|String, MomentObject|String ]` - */ - onOk?: (value: Array) => void; - - /** - * 输入框内置标签 - */ - label?: React.ReactNode; - - /** - * 输入框状态 - */ - state?: 'error' | 'loading' | 'success'; - - /** - * 输入框尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 是否显示清空按钮 - */ - hasClear?: boolean; - - /** - * 弹层显示状态 - */ - visible?: boolean; - - /** - * 弹层默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 弹层展示状态变化时的回调 - */ - onVisibleChange?: (visible: boolean, reason: string) => void; - - /** - * 弹层触发方式 - */ - popupTriggerType?: 'click' | 'hover'; - - /** - * 弹层对齐方式, 具体含义见 OverLay文档 - */ - popupAlign?: string; - - /** - * 弹层容器 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层自定义样式 - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层自定义样式类 - */ - popupClassName?: string; - - /** - * 弹层其他属性 - */ - popupProps?: PopupProps; - - /** - * 输入框其他属性 - */ - inputProps?: InputProps; - - /** - * 自定义日期单元格渲染 - */ - dateCellRender?: () => void; - - /** - * 开始日期输入框的 aria-label 属性 - */ - startDateInputAriaLabel?: string; - - /** - * 开始时间输入框的 aria-label 属性 - */ - startTimeInputAriaLabel?: string; - - /** - * 结束日期输入框的 aria-label 属性 - */ - endDateInputAriaLabel?: string; - - /** - * 结束时间输入框的 aria-label 属性 - */ - endTimeInputAriaLabel?: string; -} - -export class RangePicker extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -export interface YearPickerProps extends HTMLAttributesWeak, CommonProps { - name?: string; - /** - * 输入框内置标签 - */ - label?: React.ReactNode; - - /** - * 输入框状态 - */ - state?: 'success' | 'loading' | 'error'; - - /** - * 输入提示 - */ - placeholder?: string; - - /** - * 日期值(受控)moment 对象 - */ - value?: any; - - /** - * 初始日期值,moment 对象 - */ - defaultValue?: any; - - /** - * 日期值的格式(用于限定用户输入和展示) - */ - format?: string; - - /** - * 禁用日期函数 - */ - disabledDate?: (date: Moment, view: string) => boolean; - - /** - * 自定义面板页脚 - */ - footerRender?: () => React.ReactNode; - - /** - * 日期值改变时的回调 - */ - onChange?: (value: {} | string) => void; - - /** - * 输入框尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 是否显示清空按钮 - */ - hasClear?: boolean; - - /** - * 弹层显示状态 - */ - visible?: boolean; - - /** - * 弹层默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 弹层展示状态变化时的回调 - */ - onVisibleChange?: (visible: boolean, reason: string) => void; - - /** - * 弹层触发方式 - */ - popupTriggerType?: 'click' | 'hover'; - - /** - * 弹层对齐方式, 具体含义见 OverLay文档 - */ - popupAlign?: string; - - /** - * 弹层容器 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层自定义样式 - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层自定义样式类 - */ - popupClassName?: string; - - /** - * 弹层其他属性 - */ - popupProps?: PopupProps; - - /** - * 输入框其他属性 - */ - inputProps?: InputProps; - - /** - * 日期输入框的 aria-label 属性 - */ - dateInputAriaLabel?: string; -} - -export class YearPicker extends React.Component {} -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} - -export interface DatePickerProps extends HTMLAttributesWeak, CommonProps { - name?: string; - /** - * 输入框内置标签 - */ - label?: React.ReactNode; - - /** - * 输入框状态 - */ - state?: 'success' | 'loading' | 'error'; - - /** - * 输入提示 - */ - placeholder?: string; - - /** - * 默认展现的月 - */ - defaultVisibleMonth?: () => Moment; - - /** - * 默认展现的年 - */ - defaultVisibleYear?: () => Moment; - - /** - * 日期值(受控)moment 对象 - */ - value?: any; - - /** - * 初始日期值,moment 对象 - */ - defaultValue?: any; - - /** - * 日期值的格式(用于限定用户输入和展示) - */ - format?: string; - - /** - * 是否使用时间控件,传入 TimePicker 的属性 { defaultValue, format, ... } - */ - showTime?: any | boolean; - - /** - * 每次选择日期时是否重置时间(仅在 showTime 开启时有效) - */ - resetTime?: boolean; - - /** - * 禁用日期函数 - */ - disabledDate?: (date: Moment, view: string) => boolean; - - /** - * 自定义面板页脚 - */ - footerRender?: () => React.ReactNode; - - /** - * 日期值改变时的回调 - */ - onChange?: (value: {} | string) => void; - - /** - * 点击确认按钮时的回调 - */ - onOk?: (value: {} | string) => void; - - /** - * 输入框尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 是否显示清空按钮 - */ - hasClear?: boolean; - - /** - * 弹层显示状态 - */ - visible?: boolean; - - /** - * 弹层默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 弹层展示状态变化时的回调 - */ - onVisibleChange?: (visible: boolean, reason: string) => void; - - /** - * 弹层展示月份变化时的回调 - */ - onVisibleMonthChange?: (value: Moment, reason: string) => void; - - /** - * 弹层触发方式 - */ - popupTriggerType?: 'click' | 'hover'; - - /** - * 弹层对齐方式,具体含义见 OverLay文档 - */ - popupAlign?: string; - - /** - * 弹层容器 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层自定义样式 - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层自定义样式类 - */ - popupClassName?: string; - - /** - * 弹层其他属性 - */ - popupProps?: PopupProps; - - /** - * 输入框其他属性 - */ - inputProps?: InputProps; - - /** - * 自定义日期渲染函数 - */ - dateCellRender?: (calendarDate: Moment) => React.ReactNode; - - /** - * 自定义月份渲染函数 - */ - monthCellRender?: (calendarDate: Moment) => React.ReactNode; - - /** - * 自定义年份渲染函数 - */ - yearCellRender?: (calendarDate: Moment) => React.ReactNode; - - /** - * 日期输入框的 aria-label 属性 - */ - dateInputAriaLabel?: string; - - /** - * 时间输入框的 aria-label 属性 - */ - timeInputAriaLabel?: string; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - renderPreview?: (value: any) => React.ReactNode; - - /** - * 是否跟随滚动 - */ - followTrigger?: boolean; - - /** - * 自定义弹层 - */ - popupComponent?: React.ComponentType; - - /** - * 自定义弹层内容 - */ - popupContent?: React.ReactNode; - - /** - * 禁用日期选择器的日期模式切换 - */ - disableChangeMode?: boolean; -} - -export default class DatePicker extends React.Component { - static MonthPicker: typeof MonthPicker; - static RangePicker: typeof RangePicker; - static YearPicker: typeof YearPicker; - static WeekPicker: React.ComponentType; -} diff --git a/types/date-picker2/index.d.ts b/types/date-picker2/index.d.ts deleted file mode 100644 index 18ca7b3841..0000000000 --- a/types/date-picker2/index.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -/// -import * as React from 'react'; -import { CommonProps } from '../util'; -import { Dayjs, ConfigType } from 'dayjs'; -import { PopupProps } from '../overlay'; -import { InputProps } from '../input'; - -export default class DatePicker extends React.Component { - static RangePicker: typeof RangePicker; - static MonthPicker: typeof MonthPicker; - static YearPicker: typeof YearPicker; - static WeekPicker: typeof WeekPicker; - static QuarterPicker: typeof QuarterPicker; -} - -export class YearPicker extends React.Component { - mode: 'year'; -} -export class MonthPicker extends React.Component { - mode: 'month'; -} -export class WeekPicker extends React.Component { - mode: 'week'; -} -export class QuarterPicker extends React.Component { - mode: 'quarter'; -} -export class RangePicker extends React.Component { - type: 'range'; -} -interface HTMLAttributesWeak extends React.HTMLAttributes { - defaultValue?: any; - onChange?: any; -} -export interface DatePickerProps extends HTMLAttributesWeak, CommonProps { - type?: 'date' | 'range'; - name?: string; - mode?: 'date' | 'month' | 'week' | 'quarter' | 'year'; - value?: ConfigType; - defaultValue?: ConfigType; - defaultPanelValue?: Dayjs; - disabledDate?: (value: Dayjs, mode: 'date' | 'month' | 'week' | 'quarter' | 'year') => boolean; - extraFooterRender?: React.ReactNode | (() => React.ReactNode); - preset?: object | Array; - showTime?: boolean; - showOk?: boolean; - resetTime?: boolean; - timePanelProps?: object; - disabledTime?: object; - - onOk?: (value: Dayjs, strVal: string) => void; - onChange?: (value: Dayjs, strVal: string) => void; - onVisibleChange?: (visible: boolean) => void; - onPanelChange?: ( - panelValue: Dayjs, - mode: 'date' | 'month' | 'week' | 'quarter' | 'year' - ) => void; - - format?: string | ((value: Dayjs) => string); - /** - * 输出格式:控制 onChange、onOk 事件的输出值格式 - * - string 类型:根据时间格式进行转换 - * - function 类型:((value: Dayjs, strVal: string) => any) - * - * @version 1.23 - */ - outputFormat?: string | ((value: Dayjs, strVal: string) => any); - disabled?: boolean; - state?: 'success' | 'loading' | 'error'; - size?: 'small' | 'medium' | 'large'; - hasBorder?: boolean; - inputProps?: InputProps; - inputReadOnly?: boolean; - hasClear?: boolean; - label?: React.ReactNode; - separator?: React.ReactNode; - placeholder?: string; - - visible?: boolean; - defaultVisible?: boolean; - popupTriggerType?: 'click' | 'hover'; - popupAlign?: string; - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - popupStyle?: React.CSSProperties; - popupClassName?: string; - popupProps?: PopupProps; - followTrigger?: boolean; - popupComponent?: React.Component; - dateCellRender?: (value: Dayjs) => React.ReactNode; - monthCellRender?: (value: Dayjs) => React.ReactNode; - dateInputAriaLabel?: string; - isPreview?: boolean; - renderPreview?: (value: Dayjs) => React.ReactNode; -} - -export interface RangePickerProps - extends Omit< - DatePickerProps, - | 'value' - | 'placeholder' - | 'defaultValue' - | 'format' - | 'onOk' - | 'onChange' - | 'dateInputAriaLabel' - | 'disabled' - | 'outputFormat' - > { - value?: Array; - defaultValue?: Array; - format?: string | ((value: Dayjs) => string) | Array | Array<(value: Dayjs) => string>; - onOk?: (value: Array, strVal: Array) => void; - onChange?: (value: Array, strVal: Array) => void; - /** - * 输出格式:控制 onChange、onOk 事件的输出值格式 - * - string 类型:根据时间格式进行转换 - * - function 类型:((value: Dayjs, strVal: string) => any) - * - * @version 1.23 - */ - outputFormat?: - | string - | ((value: Dayjs) => string) - | Array - | Array<(value: Dayjs) => string>; - placeholder?: string | Array; - dateInputAriaLabel?: Array | string; - disabled?: boolean | boolean[]; - onCalendarChange?: (values: [Dayjs, Dayjs], formatString: [string, string]) => void; -} diff --git a/types/dialog/index.d.ts b/types/dialog/index.d.ts deleted file mode 100644 index b5047cb03a..0000000000 --- a/types/dialog/index.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { ButtonProps } from '../button'; -import { OverlayProps } from '../overlay'; - -export type CloseMode = 'close' | 'mask' | 'esc'; -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} - -export interface DialogProps extends Omit, CommonProps { - /** - * 是否显示 - */ - visible?: boolean; - - /** - * 标题 - */ - title?: React.ReactNode; - - /** - * 内容 - */ - children?: React.ReactNode; - - /** - * 底部内容,设置为 false,则不进行显示 - */ - footer?: boolean | React.ReactNode; - - /** - * 底部按钮的对齐方式 - */ - footerAlign?: 'left' | 'center' | 'right'; - - /** - * 指定确定按钮和取消按钮是否存在以及如何排列,

**可选值**: - * ['ok', 'cancel'](确认取消按钮同时存在,确认按钮在左) - * ['cancel', 'ok'](确认取消按钮同时存在,确认按钮在右) - * ['ok'](只存在确认按钮) - * ['cancel'](只存在取消按钮) - */ - footerActions?: Array; - - /** - * 隐藏时是否保留子节点,不销毁 - */ - cache?: boolean; - - /** - * 在点击确定按钮时触发的回调函数 - */ - onOk?: (event: React.MouseEvent) => void; - - /** - * 在点击取消按钮时触发的回调函数 - */ - onCancel?: (event: React.MouseEvent) => void; - - /** - * 应用于确定按钮的属性对象 - */ - okProps?: ButtonProps; - - /** - * 应用于取消按钮的属性对象 - */ - cancelProps?: ButtonProps; - - /** - * [废弃]同closeMode, 控制对话框关闭的方式,值可以为字符串或者布尔值,其中字符串是由以下值组成: - * **close** 表示点击关闭按钮可以关闭对话框 - * **mask** 表示点击遮罩区域可以关闭对话框 - * **esc** 表示按下 esc 键可以关闭对话框 - * 如 'close' 或 'close,esc,mask' - * 如果设置为 true,则以上关闭方式全部生效 - * 如果设置为 false,则以上关闭方式全部失效 - */ - closeable?: 'close' | 'mask' | 'esc' | boolean | 'close,mask' | 'close,esc' | 'mask,esc'; - /** - * [推荐]控制对话框关闭的方式,值可以为字符串或者数组,其中字符串、数组均为以下值的枚举: - * **close** 表示点击关闭按钮可以关闭对话框 - * **mask** 表示点击遮罩区域可以关闭对话框 - * **esc** 表示按下 esc 键可以关闭对话框 - * 如 'close' 或 ['close','esc','mask'], [] - */ - closeMode?: CloseMode[] | 'close' | 'mask' | 'esc'; - - /** - * 对话框关闭时触发的回调函数 - */ - onClose?: (trigger: string, event: React.MouseEvent) => void; - - /** - * 对话框关闭后触发的回调函数, 如果有动画,则在动画结束后触发 - */ - afterClose?: () => void; - - /** - * 是否显示遮罩 - */ - hasMask?: boolean; - - /** - * 显示隐藏时动画的播放方式 - */ - animation?: any | boolean; - - /** - * 对话框弹出时是否自动获得焦点 - */ - autoFocus?: boolean; - - /** - * [v2废弃] 对话框对齐方式, 具体见Overlay文档 - * @deprecated - */ - align?: string | boolean; - /** - * [v2废弃] 当对话框高度超过浏览器视口高度时,是否显示所有内容而不是出现滚动条以保证对话框完整显示在浏览器视口内,该属性仅在对话框垂直水平居中时生效,即 align 被设置为 'cc cc' 时 - * @deprecated - */ - isFullScreen?: boolean; - - /** - * [v2废弃] 是否在对话框重新渲染时及时更新对话框位置,一般用于对话框高度变化后依然能保证原来的对齐方式 - * @deprecated - */ - shouldUpdatePosition?: boolean; - - /** - * [v2废弃] 对话框距离浏览器顶部和底部的最小间距,align 被设置为 'cc cc' 并且 isFullScreen 被设置为 true 时不生效 - * @deprecated - */ - minMargin?: number; - /** - * 透传到弹层组件的属性对象 - */ - overlayProps?: OverlayProps; - - /** - * 自定义国际化文案对象 - */ - locale?: { - ok: string; - cancel: string; - }; - - /** - * 对话框的高度样式属性 - */ - height?: string | number; - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - /** - * 开启 v2 版本弹窗 - */ - v2?: boolean; - /** - * [v2] 定制关闭按钮 icon - */ - closeIcon?: React.ReactNode; - /** - * [v2] 弹窗宽度 v2 生效 - */ - width?: string | number; - /** - * [v2] 弹窗上边距。默认 100,设置 centered=true 后默认 40 - */ - top?: number; - /** - * [v2] 弹窗下边距, 默认 40 - */ - bottom?: number; - /** - * [v2] 对话框高度超过浏览器视口高度时,对话框是否展示滚动条。关闭此功后对话框会随高度撑开页面 - */ - overflowScroll?: boolean; - /** - * [v2] 弹窗居中对齐 - */ - centered?: boolean; - /** - * [v2] 自定义渲染弹窗 - */ - dialogRender?: (modal: React.ReactNode) => React.ReactNode; - /** - * [v2] 最外包裹层 className - */ - wrapperClassName?: string; -} - -export interface QuickShowConfig extends DialogProps { - prefix?: string; - type?: 'alert' | 'confirm'; - messageProps?: object; - content?: React.ReactNode; - onOk?: () => void; - onCancel?: () => void; - okProps?: object; - needWrapper?: boolean; -} - -export interface QuickShowRet { - hide: () => void; -} - -export default class Dialog extends React.Component { - static show(config: QuickShowConfig): QuickShowRet; - static alert(config: QuickShowConfig): QuickShowRet; - static confirm(config: QuickShowConfig): QuickShowRet; - static success(config: QuickShowConfig): QuickShowRet; - static error(config: QuickShowConfig): QuickShowRet; - static warning(config: QuickShowConfig): QuickShowRet; - static notice(config: QuickShowConfig): QuickShowRet; - static help(config: QuickShowConfig): QuickShowRet; -} diff --git a/types/divider/index.d.ts b/types/divider/index.d.ts deleted file mode 100644 index 2f89b249fc..0000000000 --- a/types/divider/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -export interface DividerProps extends React.HTMLAttributes, CommonProps { - /** - * 是否为虚线 - */ - dashed?: boolean; - /** - * 线是水平还是垂直类型 - */ - direction?: 'hoz' | 'ver'; - /** - * 分割线标题的位置 - */ - orientation?: 'left' | 'right' | 'center'; -} - -export default class Divider extends React.Component {} diff --git a/types/drawer/index.d.ts b/types/drawer/index.d.ts deleted file mode 100644 index 861551daf6..0000000000 --- a/types/drawer/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/// - -import * as React from 'react'; -import { PopupProps } from '../overlay'; -import { CloseMode } from '../dialog'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends PopupProps { - title?: any; - onClose?: any; -} - -export interface DrawerProps extends Omit, CommonProps { - /** - * [废弃]同closeMode, 控制对话框关闭的方式,值可以为字符串或者布尔值,其中字符串是由以下值组成: - * **mask** 表示点击遮罩区域可以关闭对话框 - * **esc** 表示按下 esc 键可以关闭对话框 - * 如 'mask' 或 'esc,mask' - * 如果设置为 true,则以上关闭方式全部生效 - * 如果设置为 false,则以上关闭方式全部失效 - * @deprecated - */ - closeable?: 'close' | 'mask' | 'esc' | boolean | 'close,mask' | 'close,esc' | 'mask,esc'; - /** - * [推荐]控制对话框关闭的方式,值可以为字符串或者数组,其中字符串、数组均为以下值的枚举: - * **close** 表示点击关闭按钮可以关闭对话框 - * **mask** 表示点击遮罩区域可以关闭对话框 - * **esc** 表示按下 esc 键可以关闭对话框 - * 如 'close' 或 ['close','esc','mask'], [] - */ - closeMode?: CloseMode[] | 'close' | 'mask' | 'esc'; - /** - * 隐藏时是否保留子节点,不销毁 - */ - cache?: boolean; - /** - * 标题 - */ - title?: React.ReactNode; - /** - * body上的样式 - */ - bodyStyle?: React.CSSProperties; - headerStyle?: React.CSSProperties; - /** - * 显示隐藏时动画的播放方式 - * @property {String} in 进场动画 - * @property {String} out 出场动画 - */ - animation?: { in: string; out: string } | boolean; - visible?: boolean; - - /** - * 宽度,仅在 placement是 left right 的时候生效 - */ - width?: number | string; - - /** - * 高度,仅在 placement是 top bottom 的时候生效 - */ - height?: number | string; - /** - * [v2 废弃] 受控模式下(没有 trigger 的时候),只会在关闭时触发,相当于onClose - * @deprecated - */ - onVisibleChange?: (visible: boolean, reason: string) => void; - /** - * [v2] 弹窗关闭后的回调 - */ - afterClose?: () => void; - onClose?: (reason: string, e: React.MouseEvent) => void; - /** - * 位于页面的位置 - */ - placement?: 'top' | 'right' | 'bottom' | 'left'; - /** - * 开启v2版本 - */ - v2?: boolean; - - /** - * 内容 - */ - content?: React.ReactNode; -} - -export interface QuickShowRet { - hide: () => void; -} - -export default class Drawer extends React.Component { - static show(config: DrawerProps): QuickShowRet; -} diff --git a/types/dropdown/index.d.ts b/types/dropdown/index.d.ts deleted file mode 100644 index b8f0abc6eb..0000000000 --- a/types/dropdown/index.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -export interface DropdownProps extends React.HTMLAttributes, CommonProps { - /** - * 弹层内容 - */ - children?: React.ReactNode; - - /** - * 弹层当前是否显示 - */ - visible?: boolean; - - /** - * 弹层请求关闭时触发事件的回调函数 - */ - onRequestClose?: (type: string, e: {}) => void; - - /** - * 弹层定位的参照元素 - */ - target?: any; - - /** - * 弹层相对于触发元素的定位, 详见 Overlay 的定位部分 - */ - align?: string; - - /** - * 弹层相对于触发元素定位的微调 - */ - offset?: Array; - - /** - * 渲染组件的容器,如果是函数需要返回 ref,如果是字符串则是该 DOM 的 id,也可以直接传入 DOM 节点 - */ - container?: any; - - /** - * 是否显示遮罩 - */ - hasMask?: boolean; - - /** - * 是否支持 esc 按键关闭弹层 - */ - canCloseByEsc?: boolean; - - /** - * 点击弹层外的区域是否关闭弹层,不显示遮罩时生效 - */ - canCloseByOutSideClick?: boolean; - - /** - * 点击遮罩区域是否关闭弹层,显示遮罩时生效 - */ - canCloseByMask?: boolean; - - /** - * 弹层打开前触发事件的回调函数 - */ - beforeOpen?: () => void; - - /** - * 弹层打开时触发事件的回调函数 - */ - onOpen?: () => void; - - /** - * 弹层打开后触发事件的回调函数, 如果有动画,则在动画结束后触发 - */ - afterOpen?: () => void; - - /** - * 弹层关闭前触发事件的回调函数 - */ - beforeClose?: () => void; - - /** - * 弹层关闭时触发事件的回调函数 - */ - onClose?: () => void; - - /** - * 弹层关闭后触发事件的回调函数, 如果有动画,则在动画结束后触发 - */ - afterClose?: () => void; - - /** - * 弹层定位完成前触发的事件 - */ - beforePosition?: () => void; - - /** - * 弹层定位完成时触发的事件 - */ - onPosition?: (config: {}, node: {}) => void; - - /** - * 是否在每次弹层重新渲染后强制更新定位信息,一般用于弹层内容区域大小发生变化时,仍需保持原来的定位方式 - */ - shouldUpdatePosition?: boolean; - - /** - * 弹层打开时是否让其中的元素自动获取焦点 - */ - autoFocus?: boolean; - - /** - * 当弹层由于页面滚动等情况不在可视区域时,是否自动调整定位以出现在可视区域 - */ - needAdjust?: boolean; - - /** - * 是否禁用页面滚动 - */ - disableScroll?: boolean; - - /** - * 隐藏时是否保留子节点 - */ - cache?: boolean; - - /** - * 安全节点,当点击 document 的时候,如果包含该节点则不会关闭弹层,如果是函数需要返回 ref,如果是字符串则是该 DOM 的 id,也可以直接传入 DOM 节点,或者以上值组成的数组 - */ - safeNode?: any; - - /** - * 弹层的根节点的样式类 - */ - wrapperClassName?: string; - - /** - * 弹层的根节点的内联样式 - */ - wrapperStyle?: React.CSSProperties; - - /** - * 配置动画的播放方式,支持 { in: 'enter-class', out: 'leave-class' } 的对象参数,如果设置为 false,则不播放动画 - */ - animation?: any | boolean; - - /** - * 触发弹层显示或者隐藏的元素 - */ - trigger?: React.ReactNode; - - /** - * 触发弹层显示或隐藏的操作类型,可以是 'click','hover',或者它们组成的数组,如 ['hover', 'click'] - */ - triggerType?: string | Array; - - /** - * 当 triggerType 为 click 时才生效,可自定义触发弹层显示的键盘码 - */ - triggerClickKeycode?: number | Array; - - /** - * 弹层默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 开启后,默认点击children弹窗就收起 0.x 2.x中默认是true - */ - autoClose?: boolean; - - /** - * 弹层显示或隐藏时触发的回调函数 - */ - onVisibleChange?: (visible: boolean, type: string, e: {}) => void; - - /** - * 设置此属性,弹层无法显示或隐藏 - */ - disabled?: boolean; - - /** - * 弹层显示或隐藏的延时时间(以毫秒为单位),在 triggerType 被设置为 hover 时生效 - */ - delay?: number; - - /** - * trigger 是否可以关闭弹层 - */ - canCloseByTrigger?: boolean; - - /** - * 是否跟随trigger滚动 - */ - followTrigger?: boolean; -} - -export default class Dropdown extends React.Component {} diff --git a/types/field/index.d.ts b/types/field/index.d.ts deleted file mode 100644 index 8161752e3f..0000000000 --- a/types/field/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// - -import { FieldOption, WatchCallback } from '@alifd/field'; -import innerField from '@alifd/field'; - -export * from '@alifd/field'; -export default class Field extends innerField { - /** - * - * @param contextComp 传入调用class的this - * @param options 一些事件配置 - */ - constructor(contextComp: any, options?: FieldOption); - - /** - * 校验 - * @param callback - */ - validate(callback?: (errors: object[], values: object) => void): void; - - /** - * 校验 - * @param names - * @param callback - */ - validate( - names?: string[] | string, - callback?: (errors: object[], values: object) => void - ): void; - - /** - * react hooks 风格使用 Field - * @param options - */ - static useField(options?: FieldOption): Field; - - /** - * react hooks 风格使用 watch - * @param field 指定 field - * @param names 需要监听的字段 name 列表(name 需要在 field 内注册才能生效) - * @param callback 字段值发生变化回调 - */ - static useWatch(field: Field, names: string[], callback: WatchCallback): void; -} diff --git a/types/form/index.d.ts b/types/form/index.d.ts deleted file mode 100644 index 2e895a2ef7..0000000000 --- a/types/form/index.d.ts +++ /dev/null @@ -1,566 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { data } from '../checkbox'; -import { ButtonProps } from '../button'; - -type SpanOffset = { - span?: string | number; - offset?: string | number; - [propName: string]: any; -}; - -export interface ItemProps extends React.HTMLAttributes, CommonProps { - /** - * 表单名 - */ - name?: string; - - /** - * 样式前缀 - */ - prefix?: string; - - /** - * label 标签的文本 - */ - label?: React.ReactNode; - - /** - * label 标签布局,通 `` 组件,设置 span offset 值,如 {span: 8, offset: 16},该项仅在垂直表单有效 - */ - labelCol?: SpanOffset; - - /** - * 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol - */ - wrapperCol?: SpanOffset; - - /** - * 自定义提示信息,如不设置,则会根据校验规则自动生成. - */ - help?: React.ReactNode; - - /** - * 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 位于错误信息后面 - */ - extra?: React.ReactNode; - - /** - * 校验状态,如不设置,则会根据校验规则自动生成 - */ - validateState?: 'error' | 'success' | 'loading' | 'warning'; - - /** - * 配合 validateState 属性使用,是否展示 success/loading 的校验状态图标, 目前只有Input支持 - */ - hasFeedback?: boolean; - - /** - * 自定义内联样式 - */ - style?: React.CSSProperties; - - /** - * node 或者 function(values) - */ - children?: React.ReactNode | (() => void); - - /** - * 单个 Item 的 size 自定义,优先级高于 Form 的 size, 并且当组件与 Item 一起使用时,组件自身设置 size 属性无效。 - */ - size?: 'large' | 'small' | 'medium'; - - /** - * 标签的位置 - */ - labelAlign?: 'top' | 'left' | 'inset'; - - /** - * 标签的左右对齐方式 - */ - labelTextAlign?: 'left' | 'right'; - - /** - * 扩展class - */ - className?: string; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * [表单校验] 不能为空 - */ - required?: boolean; - - /** - * required 的星号是否显示 - */ - asterisk?: boolean; - - /** - * required 自定义错误信息 - */ - requiredMessage?: string; - - /** - * required 自定义触发方式 - */ - requiredTrigger?: string | Array; - - /** - * [表单校验] 最小值 - */ - min?: number; - - /** - * [表单校验] 最大值 - */ - max?: number; - - /** - * min/max 自定义错误信息 - */ - minmaxMessage?: string; - - /** - * min/max 自定义触发方式 - */ - minmaxTrigger?: string | Array; - - /** - * [表单校验] 字符串最小长度 / 数组最小个数 - */ - minLength?: number; - - /** - * [表单校验] 字符串最大长度 / 数组最大个数 - */ - maxLength?: number; - - /** - * minLength/maxLength 自定义错误信息 - */ - minmaxLengthMessage?: string; - - /** - * minLength/maxLength 自定义触发方式 - */ - minmaxLengthTrigger?: string | Array; - - /** - * [表单校验] 字符串精确长度 / 数组精确个数 - */ - length?: number; - - /** - * length 自定义错误信息 - */ - lengthMessage?: string; - - /** - * length 自定义触发方式 - */ - lengthTrigger?: string | Array; - - /** - * 正则校验 - */ - pattern?: any; - - /** - * pattern 自定义错误信息 - */ - patternMessage?: string; - - /** - * pattern 自定义触发方式 - */ - patternTrigger?: string | Array; - - /** - * [表单校验] 四种常用的 pattern - */ - format?: 'number' | 'email' | 'url' | 'tel'; - - /** - * format 自定义错误信息 - */ - formatMessage?: string; - - /** - * format 自定义触发方式 - */ - formatTrigger?: string | Array; - - /** - * [表单校验] 自定义校验函数 - */ - validator?: (rule: any, value: any, callback: any) => void; - - /** - * validator 自定义触发方式 - */ - validatorTrigger?: string | Array; - - /** - * 是否修改数据时自动触发校验 - */ - autoValidate?: boolean; - - /** - * 在响应式布局下,且label在左边时,label的宽度是多少 - */ - labelWidth?: number | string; - - /** - * 在响应式布局模式下,表单项占多少列 - */ - colSpan?: number; - - /** - * 是否开启预览态 - */ - isPreview?: boolean; - - /** - * 预览态模式下渲染的内容 - * @param {any} value 根据包裹的组件的 value 类型而决定 - */ - renderPreview?: ( - values: number | string | data | Array, - props: any - ) => any; - - /** - * 是否使用 label 替换校验信息的 name 字段 - */ - useLabelForErrorMessage?: boolean; - - /** - * 倾向使用 item 的 margin 空间来展示 help - * @default false - * @version 1.26.37 - */ - preferMarginToDisplayHelp?: boolean; - - /** - * 表示是否显示 label 后面的冒号 - */ - colon?: boolean; - - /** - * 子元素的 value 名称 - */ - valueName?: string; - - /** - * 单个 Item 中表单类组件宽度是否是 100% - */ - fullWidth?: boolean; -} - -export class Item extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes, ButtonProps { - onClick?: any; -} - -export interface SubmitProps extends HTMLAttributesWeak, CommonProps { - /** - * 按钮的类型 - */ - type?: 'primary' | 'secondary' | 'normal'; - - /** - * 按钮的尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小 - */ - iconSize?: 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl'; - - /** - * 当 component = 'button' 时,设置 button 标签的 type 值 - */ - htmlType?: 'submit' | 'reset' | 'button'; - - /** - * 设置标签类型 - */ - component?: 'button' | 'a'; - - /** - * 设置按钮的载入状态 - */ - loading?: boolean; - - /** - * 是否为幽灵按钮 - */ - ghost?: true | false | 'light' | 'dark'; - - /** - * 是否为文本按钮 - */ - text?: boolean; - - /** - * 是否为警告按钮 - */ - warning?: boolean; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 点击提交后触发 - */ - onClick?: (value: any, errors: any, field: any) => void; - - /** - * 是否校验/需要校验的 name 数组 - */ - validate?: boolean | Array; - - /** - * 自定义 field (在 Form 内不需要设置) - */ - field?: any; -} - -export class Submit extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - onClick?: any; -} - -export interface ResetProps extends HTMLAttributesWeak, CommonProps { - /** - * 按钮的类型 - */ - type?: 'primary' | 'secondary' | 'normal'; - - /** - * 按钮的尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 按钮中 Icon 的尺寸,用于替代 Icon 的默认大小 - */ - iconSize?: - | number - | 'xxs' - | 'xs' - | 'small' - | 'medium' - | 'large' - | 'xl' - | 'xxl' - | 'xxxl' - | 'inherit'; - - /** - * 当 component = 'button' 时,设置 button 标签的 type 值 - */ - htmlType?: 'submit' | 'reset' | 'button'; - - /** - * 设置标签类型 - */ - component?: 'button' | 'a'; - - /** - * 设置按钮的载入状态 - */ - loading?: boolean; - - /** - * 是否为幽灵按钮 - */ - ghost?: true | false | 'light' | 'dark'; - - /** - * 是否为文本按钮 - */ - text?: boolean; - - /** - * 是否为警告按钮 - */ - warning?: boolean; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 点击提交后触发 - */ - onClick?: () => void; - - /** - * 自定义重置的字段 - */ - names?: Array; - - /** - * 返回默认值 - */ - toDefault?: boolean; - - /** - * 自定义 field (在 Form 内不需要设置) - */ - field?: any; -} - -export class Reset extends React.Component {} - -export interface ErrorProps extends React.HTMLAttributes, CommonProps { - /** - * 表单名 - */ - name?: string | Array; - - /** - * 自定义 field (在 Form 内不需要设置) - */ - field?: any; - - /** - * 自定义错误渲染, 可以是 node 或者 function(errors, state) - */ - children?: React.ReactNode | (() => void); -} - -export class Error extends React.Component {} -interface HTMLAttributesWeak extends React.HTMLAttributes { - onChange?: any; -} - -export interface FormProps extends HTMLAttributesWeak, CommonProps { - /** - * 样式前缀 - */ - prefix?: string; - - /** - * 内联表单 - */ - inline?: boolean; - fullWidth?: boolean; - colon?: boolean; - - /** - * 单个 Item 的 size 自定义,优先级高于 Form 的 size, 并且当组件与 Item 一起使用时,组件自身设置 size 属性无效。 - */ - size?: 'large' | 'medium' | 'small'; - - /** - * 标签的位置 - */ - labelAlign?: 'top' | 'left' | 'inset'; - - /** - * 标签的左右对齐方式 - */ - labelTextAlign?: 'left' | 'right'; - - /** - * 经 `new Field(this)` 初始化后,直接传给 Form 即可 用到表单校验则不可忽略此项 - */ - field?: any; - - /** - * 保存 Form 自动生成的 field 对象 - */ - saveField?: () => void; - - /** - * 控制第一级 Item 的 labelCol - */ - labelCol?: SpanOffset; - - /** - * 控制第一级 Item 的 wrapperCol - */ - wrapperCol?: SpanOffset; - - /** - * form内有 `htmlType="submit"` 的元素的时候会触发 - */ - onSubmit?: React.FormEventHandler; - - /** - * 子元素 - */ - children?: any; - - /** - * 扩展class - */ - className?: string; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 自定义内联样式 - */ - style?: React.CSSProperties; - - /** - * 表单数值 - */ - value?: any; - - /** - * 表单变化回调 - */ - onChange?: (values: any, item: any) => void; - - /** - * 设置标签类型 - */ - component?: string | (() => void); - /** - * 是否开启内置的响应式布局 (使用ResponsiveGrid) - */ - responsive?: boolean; - // 在 responsive模式下,透传给 ResponsiveGrid的, 表示 每个 cell 之间的间距, [bottom&top, right&left] - gap?: number | Array; - /** - * 是否开启预览态 - */ - isPreview?: boolean; - /** - * 是否使用 label 替换校验信息的 name 字段 - */ - useLabelForErrorMessage?: boolean; - /** - * 倾向使用 item 的 margin 空间来展示 help - * @default false - * @version 1.26.37 - */ - preferMarginToDisplayHelp?: boolean; -} - -export default class Form extends React.Component { - static Item: typeof Item; - static Submit: typeof Submit; - static Reset: typeof Reset; - static Error: typeof Error; -} diff --git a/types/grid/index.d.ts b/types/grid/index.d.ts deleted file mode 100644 index e3b022ee61..0000000000 --- a/types/grid/index.d.ts +++ /dev/null @@ -1,142 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - hidden?: any; -} - -export interface RowProps extends HTMLAttributesWeak, CommonProps { - /** - * 行内容 - */ - children?: React.ReactNode; - - /** - * 列间隔 - */ - gutter?: string | number; - - /** - * 列在行中宽度溢出后是否换行 - */ - wrap?: boolean; - - /** - * 行在某一断点下宽度是否保持不变(默认行宽度随视口变化而变化) - */ - fixed?: boolean; - - /** - * 固定行的宽度为某一断点的宽度,不受视口影响而变动 - */ - fixedWidth?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl'; - - /** - * (不支持IE9浏览器)多列垂直方向对齐方式 - */ - align?: 'top' | 'center' | 'bottom' | 'baseline' | 'stretch'; - - /** - * (不支持IE9浏览器)行内具有多余空间时的布局方式 - */ - justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around'; - - /** - * 行在不同断点下的显示与隐藏

**可选值**:
true(在所有断点下隐藏)
false(在所有断点下显示)
'xs'(在 xs 断点下隐藏)
['xxs', 'xs', 's', 'm', 'l', 'xl'](在 xxs, xs, s, m, l, xl 断点下隐藏) - */ - hidden?: boolean | string | Array; - - /** - * 指定以何种元素渲染该节点 - * - 默认为 'div' - */ - component?: string | (() => void); -} - -export class Row extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - hidden?: any; -} - -export interface ColProps extends HTMLAttributesWeak, CommonProps { - /** - * 列内容 - */ - children?: React.ReactNode; - - /** - * 列宽度

**可选值**:
1, 2, 3, ..., 22, 23, 24 - */ - span?: string | number; - - /** - * 固定列宽度,宽度值为20 * 栅格数

**可选值**:
1, 2, 3, ..., 28, 29, 30 - */ - fixedSpan?: string | number; - - /** - * (不支持IE9浏览器)列偏移

**可选值**:
1, 2, 3, ..., 22, 23, 24 - */ - offset?: string | number; - - /** - * (不支持IE9浏览器)固定列偏移,宽度值为20 * 栅格数

**可选值**:
1, 2, 3, ..., 28, 29, 30 - */ - fixedOffset?: string | number; - - /** - * (不支持IE9浏览器)多列垂直方向对齐方式,可覆盖Row的align属性 - */ - align?: 'top' | 'center' | 'bottom' | 'baseline' | 'stretch'; - - /** - * 列在不同断点下的显示与隐藏

**可选值**:
true(在所有断点下隐藏)
false(在所有断点下显示)
'xs'(在 xs 断点下隐藏)
['xxs', 'xs', 's', 'm', 'l', 'xl'](在 xxs, xs, s, m, l, xl 断点下隐藏) - */ - hidden?: boolean | string | Array; - - /** - * >=320px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - xxs?: string | number | {}; - - /** - * >=480px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - xs?: string | number | {}; - - /** - * >=720px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - s?: string | number | {}; - - /** - * >=990px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - m?: string | number | {}; - - /** - * >=1200px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - l?: string | number | {}; - - /** - * >=1500px,响应式栅格,可为栅格数(span)或一个包含栅格数(span)和偏移栅格数(offset)对象 - */ - xl?: string | number | {}; - - /** - * 指定以何种元素渲染该节点,默认为 'div' - */ - component?: string | (() => void); -} - -export class Col extends React.Component {} -export interface GridProps extends React.HTMLAttributes, CommonProps {} - -export default class Grid extends React.Component { - static Row: typeof Row; - static Col: typeof Col; -} diff --git a/types/icon/index.d.ts b/types/icon/index.d.ts deleted file mode 100644 index ac6e5de3c7..0000000000 --- a/types/icon/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -export interface IconProps extends React.HTMLAttributes, CommonProps { - /** - * 指定显示哪种图标 - */ - type?: string; - - /** - * 指定图标大小 - */ - size?: number | 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' | 'inherit'; -} - -export interface iconOptions { - /** - * 如果页面上已经有同 id 的标签,那么不会再加载这个图标库 - */ - scriptUrl: string; -} - -export class CustomIcon extends React.Component {} - -export default class Icon extends React.Component { - static createFromIconfontCN(options: iconOptions): typeof CustomIcon; -} diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 1f0f5d54a9..0000000000 --- a/types/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export { default as Affix } from './affix'; -export { default as Animate } from './animate'; -export { default as Badge } from './badge'; -export { default as Balloon } from './balloon'; -export { default as Breadcrumb } from './breadcrumb'; -export { default as Button } from './button'; -export { default as Calendar } from './calendar'; -export { default as Card } from './card'; -export { default as Cascader } from './cascader'; -export { default as CascaderSelect } from './cascader-select'; -export { default as Checkbox } from './checkbox'; -export { default as Collapse } from './collapse'; -export { default as ConfigProvider } from './config-provider'; -export { default as DatePicker } from './date-picker'; -export { default as Dialog } from './dialog'; -export { default as Dropdown } from './dropdown'; -export { default as Drawer } from './drawer'; -export { default as Field } from './field'; -export { default as Form } from './form'; -export { default as Grid } from './grid'; -export { default as Icon } from './icon'; -export { default as Input } from './input'; -export { default as Loading } from './loading'; -export { default as Menu } from './menu'; -export { default as MenuButton } from './menu-button'; -export { default as Message } from './message'; -export { default as Nav } from './nav'; -export { default as NumberPicker } from './number-picker'; -export { default as Overlay } from './overlay'; -export { default as Pagination } from './pagination'; -export { default as Paragraph } from './paragraph'; -export { default as Progress } from './progress'; -export { default as Radio } from './radio'; -export { default as Range } from './range'; -export { default as Rating } from './rating'; -export { default as Search } from './search'; -export { default as Select } from './select'; -export { default as Shell } from './shell'; -export { default as Slider } from './slider'; -export { default as SplitButton } from './split-button'; -export { default as Step } from './step'; -export { default as Switch } from './switch'; -export { default as Tab } from './tab'; -export { default as Table } from './table'; -export { default as Tag } from './tag'; -export { default as TimePicker } from './time-picker'; -export { default as Timeline } from './timeline'; -export { default as Transfer } from './transfer'; -export { default as Tree } from './tree'; -export { default as TreeSelect } from './tree-select'; -export { default as Typography } from './typography'; -export { default as Upload } from './upload'; -export { default as VirtualList } from './virtual-list'; -export { default as Notification } from './notification'; -export { default as Divider } from './divider'; -export { default as Avatar } from './avatar'; -export { default as ResponsiveGrid } from './responsive-grid'; -export { default as Box } from './box'; -export { default as List } from './list'; -export { default as TimePicker2 } from './time-picker2'; -export { default as DatePicker2 } from './date-picker2'; -export { default as Calendar2 } from './calendar2'; -export type { CommonProps, IconsType } from './util/types'; -export type { Locale } from './locale/types'; diff --git a/types/input/index.d.ts b/types/input/index.d.ts deleted file mode 100644 index 85a093c57e..0000000000 --- a/types/input/index.d.ts +++ /dev/null @@ -1,373 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.InputHTMLAttributes { - defaultValue?: any; - onChange?: any; - onKeyDown?: any; - size?: any; -} - -export interface TextAreaProps extends HTMLAttributesWeak, CommonProps { - /** - * 当前值 - */ - value?: string | number; - - /** - * 初始化值 - */ - defaultValue?: string | number; - - /** - * 发生改变的时候触发的回调 - */ - onChange?: (value: string, e: React.ChangeEvent, type?: string) => void; - - /** - * 键盘按下的时候触发的回调 - */ - onKeyDown?: (e: React.KeyboardEvent, opts: {}) => void; - - /** - * 禁用状态 - */ - disabled?: boolean; - - /** - * 最大长度 - */ - maxLength?: number; - - /** - * 是否展现最大长度样式 - */ - hasLimitHint?: boolean; - showLimitHint?: boolean; - - /** - * 当设置了maxLength时,是否截断超出字符串 - */ - cutString?: boolean; - - /** - * 只读 - */ - readOnly?: boolean; - - /** - * onChange返回会自动去除头尾空字符 - */ - trim?: boolean; - - /** - * 输入提示 - */ - placeholder?: string; - - /** - * 获取焦点时候触发的回调 - */ - onFocus?: (e: React.FocusEvent) => void; - - /** - * 失去焦点时候触发的回调 - */ - onBlur?: (e: React.FocusEvent) => void; - - /** - * 自定义字符串计算长度方式 - */ - getValueLength?: (value: string) => number; - - /** - * 自定义class - */ - className?: string; - - /** - * 自定义内联样式 - */ - style?: React.CSSProperties; - - /** - * 原生type - */ - htmlType?: string; - - /** - * name - */ - name?: string; - - /** - * 状态 - */ - state?: 'error' | 'warning'; - - /** - * 是否有边框 - */ - hasBorder?: boolean; - - /** - * 自动高度 true / {minRows: 2, maxRows: 4} - */ - autoHeight?: boolean | {}; - - /** - * 多行文本框高度
(不要直接用height设置多行文本框的高度, ie9 10会有兼容性问题) - */ - rows?: number; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - renderPreview?: (value: string | number) => React.ReactNode; - - /** - * 开启后会过滤输入法中间字母状态,文字输入完成后才会触发 onChange - */ - composition?: boolean; -} - -export class TextArea extends React.Component {} - -export interface GroupProps extends React.HTMLAttributes, CommonProps { - /** - * 样式前缀 - */ - prefix?: string; - - /** - * 输入框前附加内容 - */ - addonBefore?: React.ReactNode; - - /** - * 输入框前附加内容css - */ - addonBeforeClassName?: string; - - /** - * 输入框后附加内容 - */ - addonAfter?: React.ReactNode; - - /** - * 输入框后额外css - */ - addonAfterClassName?: string; - - /** - * rtl - */ - rtl?: boolean; -} - -export class Group extends React.Component {} - -export interface InputProps extends HTMLAttributesWeak, CommonProps { - /** - * 当前值 - */ - value?: string | number; - - /** - * 初始化值 - */ - defaultValue?: string | number; - - /** - * 发生改变的时候触发的回调 - */ - onChange?: (value: string, e: React.ChangeEvent, type?: string) => void; - - /** - * 键盘按下的时候触发的回调 - */ - onKeyDown?: (e: React.KeyboardEvent, opts: {}) => void; - - /** - * 禁用状态 - */ - disabled?: boolean; - - /** - * 最大长度 - */ - maxLength?: number; - - /** - * 是否展现最大长度样式 - */ - hasLimitHint?: boolean; - showLimitHint?: boolean; - - /** - * 当设置了maxLength时,是否截断超出字符串 - */ - cutString?: boolean; - - /** - * 只读 - */ - readOnly?: boolean; - - /** - * onChange返回会自动去除头尾空字符 - */ - trim?: boolean; - - /** - * 输入提示 - */ - placeholder?: string; - - /** - * 获取焦点时候触发的回调 - */ - onFocus?: (e: React.FocusEvent) => void; - - /** - * 失去焦点时候触发的回调 - */ - onBlur?: (e: React.FocusEvent) => void; - - /** - * 自定义字符串计算长度方式 - */ - getValueLength?: (value: string) => number; - - /** - * 自定义class - */ - className?: string; - - /** - * 自定义内联样式 - */ - style?: React.CSSProperties; - - /** - * 原生type - */ - htmlType?: string; - - /** - * name - */ - name?: string; - - /** - * 状态 - */ - state?: 'error' | 'loading' | 'success' | 'warning'; - - /** - * label - */ - label?: React.ReactNode; - - /** - * 是否出现clear按钮 - */ - hasClear?: boolean; - - /** - * 是否有边框 - */ - hasBorder?: boolean; - - /** - * 尺寸 - */ - size?: 'small' | 'medium' | 'large'; - - /** - * 按下回车的回调 - */ - onPressEnter?: (e: React.KeyboardEvent) => void; - - /** - * 水印 (Icon的type类型,和hasClear占用一个地方) - */ - hint?: string | React.ReactNode; - - /** - * 文字前附加内容 - */ - innerBefore?: React.ReactNode; - - /** - * 文字后附加内容 - */ - innerAfter?: React.ReactNode; - - /** - * 输入框前附加内容 - */ - addonBefore?: React.ReactNode; - - /** - * 输入框后附加内容 - */ - addonAfter?: React.ReactNode; - - /** - * 输入框前附加文字 - */ - addonTextBefore?: React.ReactNode; - - /** - * 输入框后附加文字 - */ - addonTextAfter?: React.ReactNode; - - /** - * (原生input支持) - */ - autoComplete?: string; - - /** - * 自动聚焦(原生input支持) - */ - autoFocus?: boolean; - - /** - * 是否为预览态 - */ - isPreview?: boolean; - - renderPreview?: (value: string | number) => React.ReactNode; - - /** - * 开启后会过滤输入法中间字母状态,文字输入完成后才会触发 onChange - * @version 1.23 - */ - composition?: boolean; - - /** - * hover展示clear (配合 hasClear=true使用) - * @version 1.24 - */ - hoverShowClear?: boolean; -} -export interface PasswordProps extends InputProps { - /** - * 是否展示切换按钮 - */ - showToggle?: boolean; -} -export class Password extends React.Component {} - -export default class Input extends React.Component { - static TextArea: typeof TextArea; - static Group: typeof Group; - static Password: typeof Password; - getInputNode: () => HTMLInputElement; -} diff --git a/types/list/index.d.ts b/types/list/index.d.ts deleted file mode 100644 index fb4d03d35a..0000000000 --- a/types/list/index.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/// - -import { ReactNode, Component, ComponentType } from 'react'; -import { LoadingProps } from '../loading'; -import { CommonProps } from '../util'; - -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} - -export interface ListProps extends React.HTMLAttributes, CommonProps { - /** - * 列表头部 - */ - header?: ReactNode; - /** - * 列表尾部 - */ - footer?: ReactNode; - /** - * 列表尺寸 - */ - size?: 'medium' | 'small'; - /** - * 是否显示分割线 - */ - divider?: boolean; - /** - * children - */ - children?: ReactNode; - dataSource?: any[]; - /** - * 当使用 dataSource 时,可以用 renderItem 自定义渲染列表项 - * @param {Any} current 当前遍历的项 - * @param {Number} index 当前遍历的项的索引 - */ - renderItem?: (current: any, index: number) => any; - loading?: boolean; - /** - * 自定义 Loading 组件 - * 请务必透传 props, 使用方式: loadingComponent={props => } - */ - loadingComponent?: (props: LoadingProps) => ReactNode; - emptyContent?: ReactNode; -} - -export interface ListItemProps extends HTMLAttributesWeak, CommonProps { - /** - * 列表元素的标题 - */ - title?: ReactNode; - /** - * 列表元素的描述内容 - */ - description?: ReactNode; - /** - * 列表元素的头像 / 图标 / 图片内容 - */ - media?: ReactNode; - /** - * 额外内容 - */ - extra?: ReactNode; -} - -export default class List extends Component { - static Item: ComponentType; -} diff --git a/types/loading/index.d.ts b/types/loading/index.d.ts deleted file mode 100644 index d19eb60c28..0000000000 --- a/types/loading/index.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as React from 'react'; -import * as PropTypes from 'prop-types'; -import type { LoadingProps } from './types'; -/** Loading */ -declare class Loading extends React.Component { - static propTypes: { - prefix: PropTypes.Requireable; - tip: PropTypes.Requireable; - tipAlign: PropTypes.Requireable; - visible: PropTypes.Requireable; - onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - size: PropTypes.Requireable; - indicator: PropTypes.Requireable; - color: PropTypes.Requireable; - fullScreen: PropTypes.Requireable; - disableScroll: PropTypes.Requireable; - safeNode: PropTypes.Requireable; - children: PropTypes.Requireable; - inline: PropTypes.Requireable; - rtl: PropTypes.Requireable; - locale: PropTypes.Requireable; - defaultPropsConfig: PropTypes.Requireable; - errorBoundary: PropTypes.Requireable>; - pure: PropTypes.Requireable; - warning: PropTypes.Requireable; - device: PropTypes.Requireable; - popupContainer: PropTypes.Requireable; - }; - static defaultProps: { - prefix: string; - visible: boolean; - onVisibleChange: () => void; - animate: null; - tipAlign: string; - size: string; - inline: boolean; - disableScroll: boolean; - }; - render(): React.JSX.Element | React.ReactNode[]; -} -export type { LoadingProps }; -declare const _default: { - new ( - props: LoadingProps & import('../config-provider/types').ComponentCommonProps, - context?: unknown - ): import('../config-provider/types').ConfiguredComponent< - LoadingProps & import('../config-provider/types').ComponentCommonProps, - Loading - >; - contextType?: React.Context | undefined; -} & { - propTypes: { - prefix: PropTypes.Requireable; - tip: PropTypes.Requireable; - tipAlign: PropTypes.Requireable; - visible: PropTypes.Requireable; - onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>; - className: PropTypes.Requireable; - style: PropTypes.Requireable; - size: PropTypes.Requireable; - indicator: PropTypes.Requireable; - color: PropTypes.Requireable; - fullScreen: PropTypes.Requireable; - disableScroll: PropTypes.Requireable; - safeNode: PropTypes.Requireable; - children: PropTypes.Requireable; - inline: PropTypes.Requireable; - rtl: PropTypes.Requireable; - locale: PropTypes.Requireable; - defaultPropsConfig: PropTypes.Requireable; - errorBoundary: PropTypes.Requireable>; - pure: PropTypes.Requireable; - warning: PropTypes.Requireable; - device: PropTypes.Requireable; - popupContainer: PropTypes.Requireable; - }; - defaultProps: { - prefix: string; - visible: boolean; - onVisibleChange: () => void; - animate: null; - tipAlign: string; - size: string; - inline: boolean; - disableScroll: boolean; - }; -}; -export default _default; diff --git a/types/loading/mobile/index.d.ts b/types/loading/mobile/index.d.ts deleted file mode 100644 index fcb71fd3fc..0000000000 --- a/types/loading/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const Loading: any; -export default Loading; diff --git a/types/loading/types.d.ts b/types/loading/types.d.ts deleted file mode 100644 index 2be202d452..0000000000 --- a/types/loading/types.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as React from 'react'; -import { CommonProps } from '../util'; -import type { PopupProps } from '../overlay'; -/** - * @api Loading - */ -export interface LoadingProps extends React.HTMLAttributes, CommonProps { - /** - * 自定义内容,可以传入 string 或 reactElement - * @en Tip content - */ - tip?: React.ReactNode | string; - /** - * 自定义内容位置 - * @en Align of tip - * @defaultValue 'bottom' - */ - tipAlign?: 'right' | 'bottom'; - /** - * loading 状态, 默认 true - * @en Loading status, default to true - * @defaultValue true - */ - visible?: boolean; - /** - * 自定义class - * @skip - */ - className?: string; - /** - * 自定义内联样式 - * @skip - */ - style?: React.CSSProperties; - /** - * 设置动画尺寸 - * @en Size of animation indicator - * @defaultValue 'large' - */ - size?: 'large' | 'medium'; - /** - * 自定义动画 - * @en Custom animation indicator - */ - indicator?: React.ReactNode; - /** - * 动画颜色 - * @en Color of animation indicator - */ - color?: string; - /** - * 全屏展示 - * @en Full screen display - */ - fullScreen?: boolean; - /** - * 当点击 document 的时候,如果包含该节点则不会关闭弹层, - * 如果是函数需要返回 ref,如果是字符串则是该 DOM 的 id,也可以直接传入 DOM 节点,或者以上值组成的数组 - * 是否禁用滚动,仅在 fullScreen 模式下生效 - * @en Is scrolling disabled, only effective in fullScreen mode - * @defaultValue false - */ - disableScroll?: boolean; - /** - * 子元素 - * @en Child elements - */ - children?: React.ReactNode; - /** - * 全屏模式下,loading弹层请求关闭时触发的回调函数 - * @en The callback function triggered when the loading layer request is closed in full screen mode - * @param type - 弹层关闭的来源 - The source of fan layer closure - * @param e - DOM 事件 - DOM events - */ - onVisibleChange?: (type: string, e: React.MouseEvent) => void; - /** - * 安全节点,仅在 fullScreen 时有效 - * @en Security node, only valid at fullScreen - */ - safeNode?: PopupProps['safeNode']; - /** - * @deprecated should loader be displayed inline - * @defaultValue true - * @skip - */ - inline?: boolean; -} diff --git a/types/locale/default.d.ts b/types/locale/default.d.ts deleted file mode 100644 index 7b8d0cdf9a..0000000000 --- a/types/locale/default.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { Locale as default } from './types'; diff --git a/types/locale/en-us.d.ts b/types/locale/en-us.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/en-us.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/id-id.d.ts b/types/locale/id-id.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/id-id.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/it-it.d.ts b/types/locale/it-it.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/it-it.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/ja-jp.d.ts b/types/locale/ja-jp.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/ja-jp.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/ko-kr.d.ts b/types/locale/ko-kr.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/ko-kr.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/mobile/index.d.ts b/types/locale/mobile/index.d.ts deleted file mode 100644 index 1ce28dfed1..0000000000 --- a/types/locale/mobile/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { Locale as MeetLocale } from '@alifd/meet-react'; -export default MeetLocale; diff --git a/types/locale/ms-my.d.ts b/types/locale/ms-my.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/ms-my.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/pt-pt.d.ts b/types/locale/pt-pt.d.ts deleted file mode 100644 index b5be9560ba..0000000000 --- a/types/locale/pt-pt.d.ts +++ /dev/null @@ -1,179 +0,0 @@ -declare const locale: { - momentLocale: string; - Timeline: { - expand: string; - fold: string; - }; - Balloon: { - close: string; - }; - Card: { - expand: string; - fold: string; - }; - Calendar: { - today: string; - now: string; - ok: string; - clear: string; - month: string; - year: string; - prevYear: string; - nextYear: string; - prevMonth: string; - nextMonth: string; - prevDecade: string; - nextDecade: string; - yearSelectAriaLabel: string; - monthSelectAriaLabel: string; - }; - DatePicker: { - placeholder: string; - datetimePlaceholder: string; - monthPlaceholder: string; - yearPlaceholder: string; - weekPlaceholder: string; - now: string; - selectTime: string; - selectDate: string; - ok: string; - clear: string; - startPlaceholder: string; - endPlaceholder: string; - hour: string; - minute: string; - second: string; - }; - Dialog: { - close: string; - ok: string; - cancel: string; - }; - Drawer: { - close: string; - }; - Message: { - closeAriaLabel: string; - }; - Pagination: { - prev: string; - next: string; - goTo: string; - page: string; - go: string; - total: string; - labelPrev: string; - labelNext: string; - inputAriaLabel: string; - selectAriaLabel: string; - pageSize: string; - }; - Input: { - clear: string; - }; - List: { - empty: string; - }; - Select: { - selectPlaceholder: string; - autoCompletePlaceholder: string; - notFoundContent: string; - maxTagPlaceholder: string; - selectAll: string; - }; - TreeSelect: { - maxTagPlaceholder: string; - shortMaxTagPlaceholder: string; - }; - Table: { - empty: string; - ok: string; - reset: string; - asc: string; - desc: string; - expanded: string; - folded: string; - filter: string; - selectAll: string; - }; - TimePicker: { - placeholder: string; - clear: string; - hour: string; - minute: string; - second: string; - ok: string; - }; - Transfer: { - items: string; - item: string; - moveAll: string; - searchPlaceholder: string; - moveToLeft: string; - moveToRight: string; - }; - Upload: { - card: { - cancel: string; - addPhoto: string; - download: string; - delete: string; - }; - drag: { - text: string; - hint: string; - }; - upload: { - delete: string; - }; - }; - Search: { - buttonText: string; - }; - Tag: { - delete: string; - }; - Rating: { - description: string; - }; - Switch: { - on: string; - off: string; - }; - Tab: { - closeAriaLabel: string; - }; - Form: { - Validate: { - default: string; - required: string; - format: { - number: string; - email: string; - url: string; - tel: string; - }; - number: { - length: string; - min: string; - max: string; - minLength: string; - maxLength: string; - }; - string: { - length: string; - min: string; - max: string; - minLength: string; - maxLength: string; - }; - array: { - length: string; - minLength: string; - maxLength: string; - }; - pattern: string; - }; - }; -}; -export default locale; diff --git a/types/locale/th-th.d.ts b/types/locale/th-th.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/th-th.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/types.d.ts b/types/locale/types.d.ts deleted file mode 100644 index 66067cef9b..0000000000 --- a/types/locale/types.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -export interface ComponentLocaleObject { - [key: string]: string | ComponentLocaleObject | undefined; -} -export interface LocaleConfig { - rtl?: boolean; - momentLocale?: string; - dateLocale?: string; -} -export interface Locale extends LocaleConfig { - Timeline: { - expand: string; - fold: string; - }; - Balloon: { - close: string; - }; - Card: { - expand: string; - fold: string; - }; - Calendar: { - today: string; - now: string; - ok: string; - clear: string; - month: string; - year: string; - prevYear: string; - nextYear: string; - prevMonth: string; - nextMonth: string; - prevDecade: string; - nextDecade: string; - yearSelectAriaLabel: string; - monthSelectAriaLabel: string; - }; - DatePicker: { - placeholder: string; - datetimePlaceholder: string; - monthPlaceholder: string; - weekPlaceholder: string; - yearPlaceholder: string; - now: string; - selectTime: string; - selectDate: string; - ok: string; - clear: string; - startPlaceholder: string; - endPlaceholder: string; - hour: string; - minute: string; - second: string; - }; - Dialog: { - close: string; - ok: string; - cancel: string; - }; - Drawer: { - close: string; - }; - Message: { - closeAriaLabel: string; - }; - Pagination: { - prev: string; - next: string; - goTo: string; - page: string; - go: string; - total: string; - labelPrev: string; - labelNext: string; - inputAriaLabel: string; - selectAriaLabel: string; - pageSize: string; - }; - Input: { - clear: string; - }; - List: { - empty: string; - }; - Select: { - selectPlaceholder: string; - autoCompletePlaceholder: string; - notFoundContent: string; - maxTagPlaceholder: string; - selectAll: string; - }; - TreeSelect: { - maxTagPlaceholder: string; - shortMaxTagPlaceholder: string; - }; - Table: { - empty: string; - ok: string; - reset: string; - asc: string; - desc: string; - expanded: string; - folded: string; - filter: string; - selectAll: string; - }; - TimePicker: { - placeholder: string; - clear: string; - hour: string; - minute: string; - second: string; - ok: string; - }; - Transfer: { - items: string; - item: string; - moveAll: string; - searchPlaceholder: string; - moveToLeft: string; - moveToRight: string; - }; - Upload: { - card: { - cancel: string; - addPhoto: string; - download: string; - delete: string; - }; - drag: { - text: string; - hint: string; - }; - upload: { - delete: string; - }; - }; - Search: { - buttonText: string; - }; - Tag: { - delete: string; - }; - Rating: { - description: string; - }; - Switch: { - on: string; - off: string; - }; - Tab: { - closeAriaLabel: string; - }; - Form: { - Validate: { - default: string; - required: string; - format: { - number: string; - email: string; - url: string; - tel: string; - }; - number: { - length: string; - min: string; - max: string; - minLength: string; - maxLength: string; - }; - string: { - length: string; - min: string; - max: string; - minLength: string; - maxLength: string; - }; - array: { - length: string; - minLength: string; - maxLength: string; - }; - pattern: string; - }; - }; - [key: string]: ComponentLocaleObject | boolean | string | undefined; -} -/** - * @deprecated type locale is deprecated, use Locale instead - */ -export type locale = Locale; diff --git a/types/locale/vi-vn.d.ts b/types/locale/vi-vn.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/vi-vn.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/zh-cn.d.ts b/types/locale/zh-cn.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/zh-cn.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/zh-hk.d.ts b/types/locale/zh-hk.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/zh-hk.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/locale/zh-tw.d.ts b/types/locale/zh-tw.d.ts deleted file mode 100644 index 8a2beb9968..0000000000 --- a/types/locale/zh-tw.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Locale } from './types'; -declare const locale: Locale; -export default locale; diff --git a/types/menu-button/index.d.ts b/types/menu-button/index.d.ts deleted file mode 100644 index 5668b908c2..0000000000 --- a/types/menu-button/index.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -/// - -import * as React from 'react'; -import { Item, Group, Divider, MenuProps } from '../menu'; -import { CommonProps } from '../util'; -import { ButtonProps } from '../button'; -import { PopupProps } from '../overlay'; - -export interface MenuButtonProps extends Omit, CommonProps { - /** - * 按钮上的文本内容 - */ - label?: React.ReactNode; - - /** - * 弹层是否与按钮宽度相同 - */ - autoWidth?: boolean; - - /** - * 弹层触发方式 - */ - popupTriggerType?: 'click' | 'hover'; - - /** - * 弹层容器 - */ - popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement); - - /** - * 弹层展开状态 - */ - visible?: boolean; - - /** - * 弹层默认是否展开 - */ - defaultVisible?: boolean; - - /** - * 弹层在显示和隐藏触发的事件 - */ - onVisibleChange?: (visible: boolean, type: string) => void; - - /** - * 弹层自定义样式 - */ - popupStyle?: React.CSSProperties; - - /** - * 弹层自定义样式类 - */ - popupClassName?: string; - - /** - * 弹层属性透传 - */ - popupProps?: PopupProps; - - /** - * 菜单是否跟随滚动 - */ - followTrigger?: boolean; - - /** - * 默认激活的菜单项(用法同 Menu 非受控) - */ - defaultSelectedKeys?: Array; - - /** - * 激活的菜单项(用法同 Menu 受控) - */ - selectedKeys?: string | Array; - - /** - * 菜单的选择模式,同 Menu - */ - selectMode?: 'single' | 'multiple'; - - /** - * 点击菜单项后的回调,同 Menu - */ - onItemClick?: (key: string, item: any, event: React.MouseEvent) => void; - - /** - * 选择菜单后的回调,同 Menu - */ - onSelect?: (selectedKeys: Array, item: any, extra: any) => void; - - /** - * 菜单属性透传 - */ - menuProps?: MenuProps; -} - -export default class MenuButton extends React.Component { - static Item: typeof Item; - static Group: typeof Group; - static Divider: typeof Divider; -} diff --git a/types/menu/index.d.ts b/types/menu/index.d.ts deleted file mode 100644 index 9ea4f6e14c..0000000000 --- a/types/menu/index.d.ts +++ /dev/null @@ -1,336 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { PopupProps } from '../overlay'; - -export interface ItemProps extends React.HTMLAttributes, CommonProps { - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 帮助文本 - */ - helper?: React.ReactNode; - - /** - * 菜单项标签内容 - */ - children?: React.ReactNode; -} - -export class Item extends React.Component {} - -export interface SubMenuProps extends React.HTMLAttributes, CommonProps { - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 是否可选,该属性仅在设置 Menu 组件 selectMode 属性后生效 - */ - selectable?: boolean; - - /** - * 子菜单打开方式,如果设置会覆盖 Menu 上的同名属性 - */ - mode?: 'inline' | 'popup'; - - /** - * 菜单项或下一级子菜单 - */ - children?: React.ReactNode; -} - -export class SubMenu extends React.Component {} - -export interface PopupItemProps extends React.HTMLAttributes, CommonProps { - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 自定义弹层内容 - */ - children?: React.ReactNode; - - /** - * 子菜单打开的触发行为 - */ - triggerType?: 'click' | 'hover'; -} - -export class PopupItem extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - onChange?: any; -} - -export interface CheckboxItemProps extends HTMLAttributesWeak, CommonProps { - /** - * 是否选中 - */ - checked?: boolean; - - /** - * 是否半选中 - */ - indeterminate?: boolean; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 选中或取消选中触发的回调函数 - */ - onChange?: (checked: boolean, event: React.MouseEvent) => void; - - /** - * 帮助文本 - */ - helper?: React.ReactNode; - - /** - * 标签内容 - */ - children?: React.ReactNode; -} - -export class CheckboxItem extends React.Component {} - -interface HTMLAttributesWeak extends React.HTMLAttributes { - onChange?: any; -} - -export interface RadioItemProps extends HTMLAttributesWeak, CommonProps { - /** - * 是否选中 - */ - checked?: boolean; - - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 选中或取消选中触发的回调函数 - */ - onChange?: (checked: boolean, event: {}) => void; - - /** - * 帮助文本 - */ - helper?: React.ReactNode; - - /** - * 标签内容 - */ - children?: React.ReactNode; -} - -export class RadioItem extends React.Component {} - -export interface GroupProps extends React.HTMLAttributes, CommonProps { - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 菜单项 - */ - children?: React.ReactNode; -} - -export class Group extends React.Component {} - -export interface DividerProps extends React.HTMLAttributes, CommonProps {} - -export class Divider extends React.Component {} -interface HTMLAttributesWeak extends React.HTMLAttributes { - onSelect?: any; -} - -export interface MenuProps extends HTMLAttributesWeak, CommonProps { - /** - * 菜单项和子菜单 - */ - children?: React.ReactNode; - - /** - * 点击菜单项触发的回调函数 - */ - onItemClick?: (key: string, item: any, event: React.MouseEvent) => void; - - /** - * 当前打开的子菜单的 key 值 - */ - openKeys?: string | Array; - - /** - * 初始打开的子菜单的 key 值 - */ - defaultOpenKeys?: string | Array; - - /** - * 初始展开所有的子菜单,只在 mode 设置为 'inline' 以及 openMode 设置为 'multiple' 下生效,优先级高于 defaultOpenKeys - */ - defaultOpenAll?: boolean; - - /** - * 打开或关闭子菜单触发的回调函数 - */ - onOpen?: (key: string[], extra: { key: string; open: boolean }) => void; - - /** - * 子菜单打开的模式 - */ - mode?: 'inline' | 'popup'; - - /** - * 子菜单打开的触发行为 - */ - triggerType?: 'click' | 'hover'; - - /** - * 展开内连子菜单的模式,同时可以展开一个子菜单还是多个子菜单,该属性仅在 mode 为 inline 时生效 - */ - openMode?: 'single' | 'multiple'; - - /** - * 内连子菜单缩进距离 - */ - inlineIndent?: number; - - /** - * 是否自动让弹层的宽度和菜单项保持一致,如果弹层的宽度比菜单项小则和菜单项保持一致,如果宽度大于菜单项则不做处理 - */ - popupAutoWidth?: boolean; - - /** - * 弹层的对齐方式 - */ - popupAlign?: 'follow' | 'outside'; - - /** - * 弹层自定义 props - */ - popupProps?: PopupProps | (() => void); - - /** - * 弹出子菜单自定义 className - */ - popupClassName?: string; - - /** - * 弹出子菜单自定义 style - */ - popupStyle?: React.CSSProperties; - - /** - * 当前选中菜单项的 key 值 - */ - selectedKeys?: string | Array; - - /** - * 初始选中菜单项的 key 值 - */ - defaultSelectedKeys?: string | Array; - - /** - * 选中或取消选中菜单项触发的回调函数 - */ - onSelect?: ( - selectedKeys: Array, - item: any, - extra: { select: boolean; lable: any; keyPath: any[]; key: string[] } - ) => void; - - /** - * 选中模式,单选还是多选,默认无值,不可选 - */ - selectMode?: 'single' | 'multiple'; - - /** - * 是否只能选择第一层菜单项(不能选择子菜单中的菜单项) - */ - shallowSelect?: boolean; - - /** - * 是否显示选中图标,如果设置为 false 需配合配置平台设置选中时的背景色以示区分 - */ - hasSelectedIcon?: boolean; - - /** - * 是否将选中图标居右,仅当 hasSelectedIcon 为true 时生效。 - * 注意:SubMenu 上的选中图标一直居左,不受此API控制 - */ - isSelectIconRight?: boolean; - - /** - * 菜单第一层展示方向 - */ - direction?: 'ver' | 'hoz'; - - /** - * 横向菜单条 item 和 footer 的对齐方向,在 direction 设置为 'hoz' 并且 header 存在时生效 - */ - hozAlign?: 'left' | 'right'; - - /** - * 自定义菜单头部 - */ - header?: React.ReactNode; - - /** - * 自定义菜单尾部 - */ - footer?: React.ReactNode; - - /** - * 自定义菜单尾部容器的 className - */ - footerWrapperClassName?: string; - - /** - * 是否自动获得焦点 - */ - autoFocus?: boolean; - - /** - * 当前获得焦点的子菜单或菜单项 key 值 - */ - focusedKey?: string; - renderMore?: (items?: Array) => React.ReactElement; - - /** - * 是否开启嵌入式模式,一般用于Layout的布局中,开启后没有默认背景、外层border、box-shadow,可以配合`` 自定义高度 - */ - embeddable?: boolean; - icons?: { - select?: React.ReactNode; - }; - - /** - * 横向菜单模式下,是否维持在一行,即超出一行折叠成 SubMenu 显示 - */ - hozInLine?: boolean; -} - -export default class Menu extends React.Component { - static Item: typeof Item; - static SubMenu: typeof SubMenu; - static PopupItem: typeof PopupItem; - static CheckboxItem: typeof CheckboxItem; - static RadioItem: typeof RadioItem; - static Group: typeof Group; - static Divider: typeof Divider; - static create(props: any): void; -} diff --git a/types/message/index.d.ts b/types/message/index.d.ts deleted file mode 100644 index 156a856f79..0000000000 --- a/types/message/index.d.ts +++ /dev/null @@ -1,148 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { OverlayProps } from '../overlay'; -interface HTMLAttributesWeak extends React.HTMLAttributes { - title?: any; -} - -export interface MessageProps extends HTMLAttributesWeak, CommonProps { - /** - * 反馈类型 - */ - type?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading'; - - /** - * 反馈外观 - */ - shape?: 'inline' | 'addon' | 'toast'; - - /** - * 反馈大小 - */ - size?: 'medium' | 'large'; - - /** - * 标题 - */ - title?: React.ReactNode; - - /** - * 内容,非函数式调用下使用 - */ - children?: React.ReactNode; - - /** - * 默认是否显示 - */ - defaultVisible?: boolean; - - /** - * 当前是否显示 - */ - visible?: boolean; - - /** - * 显示的图标类型,会覆盖内部设置的IconType,传false不显示图标 - */ - iconType?: string | false; - - /** - * 显示关闭按钮 - */ - closeable?: boolean; - - /** - * 关闭按钮的回调 - */ - onClose?: () => void; - - /** - * 关闭之后调用的函数 - */ - afterClose?: () => void; - - /** - * 是否开启展开收起动画 - */ - animation?: boolean; -} - -export interface MessageQuickProps extends Omit, CommonProps { - /** - * 反馈类型 - */ - type?: 'success' | 'warning' | 'error' | 'notice' | 'help' | 'loading'; - - /** - * 反馈大小 - */ - size?: 'medium' | 'large'; - /** - * 标题 - */ - title?: React.ReactNode; - - /** - * 内容,函数式调用下使用 - */ - content?: React.ReactNode; - /** - * 弹层相对于参照元素的定位, 详见开发指南的[定位部分](#定位) - */ - align?: string | boolean; - - /** - * 弹层相对于参照元素定位的微调 - */ - offset?: Array; - /** - * 是否显示遮罩 - */ - hasMask?: boolean; - - /** - * 显示持续时间,0表示一直存在,以毫秒为单位 - */ - duration?: number; - timeoutId?: string; - - /** - * 显示关闭按钮 - */ - closeable?: boolean; - - /** - * 关闭按钮的回调 - */ - onClose?: () => void; - - /** - * 关闭之后调用的函数 - */ - afterClose?: () => void; - - /** - * 是否开启展开收起动画 - */ - animation?: boolean; - /** - * 透传到弹层组件的属性对象 - */ - overlayProps?: OverlayProps; -} - -type OpenProps = string | React.ReactElement | MessageQuickProps; - -export default class Message extends React.Component { - static show(props: OpenProps): void; - static hide(): void; - static success(props: OpenProps): void; - static warning(props: OpenProps): void; - static error(props: OpenProps): void; - static help(props: OpenProps): void; - static loading(props: OpenProps): void; - static notice(props: OpenProps): void; - static config(props: OpenProps): void; -} diff --git a/types/nav/index.d.ts b/types/nav/index.d.ts deleted file mode 100644 index 4fe6a6d392..0000000000 --- a/types/nav/index.d.ts +++ /dev/null @@ -1,294 +0,0 @@ -/// - -import * as React from 'react'; -import { CommonProps } from '../util'; -import { PopupProps } from '../overlay'; - -export interface GroupProps extends React.HTMLAttributes, CommonProps { - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 导航项和子导航 - */ - children?: React.ReactNode; - - /** - * 自定义类名 - */ - className?: string; -} - -export class Group extends React.Component {} - -export interface ItemProps extends React.HTMLAttributes, CommonProps { - /** - * 是否禁用 - */ - disabled?: boolean; - - /** - * 帮助文本 - */ - helper?: React.ReactNode; - - /** - * 导航内容 - */ - children?: React.ReactNode; - - /** - * 自定义图标,可以使用 Icon 的 type,也可以使用组件 `` - */ - icon?: string | React.ReactNode; -} - -export class Item extends React.Component {} - -export interface PopupItemProps extends React.HTMLAttributes, CommonProps { - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 弹出内容 - */ - children?: React.ReactNode; - - /** - * 自定义类名 - */ - className?: string; - - /** - * 自定义图标,可以使用 Icon 的 type, 也可以使用组件 `` - */ - icon?: string | React.ReactNode; -} - -export class PopupItem extends React.Component {} - -export interface SubNavProps extends React.HTMLAttributes, CommonProps { - /** - * 自定义类名 - */ - className?: string; - - /** - * 自定义图标,可以使用 Icon 的 type,也可以使用组件 `` - */ - icon?: string | React.ReactNode; - - /** - * 标签内容 - */ - label?: React.ReactNode; - - /** - * 是否可选 - */ - selectable?: boolean; - - /** - * 导航项和子导航 - */ - children?: React.ReactNode; -} - -export class SubNav extends React.Component {} -interface HTMLAttributesWeak extends React.HTMLAttributes { - onSelect?: any; -} - -export interface NavProps extends HTMLAttributesWeak, CommonProps { - /** - * 导航项和子导航 - */ - children?: React.ReactNode; - - /** - * 点击菜单项触发的回调函数 - */ - onItemClick?: (key: string, item: {}, event: {}) => void; - - /** - * 当前打开的子菜单的 key 值 - */ - openKeys?: string | Array; - - /** - * 初始打开的子菜单的 key 值 - */ - defaultOpenKeys?: string | Array; - - /** - * 初始展开所有的子导航,只在 mode 设置为 'inline' 以及 openMode 设置为 'multiple' 下生效 - */ - defaultOpenAll?: boolean; - - /** - * 打开或关闭子菜单触发的回调函数 - */ - onOpen?: (key: string[], extra: { key: string; open: boolean }) => void; - - /** - * 子导航打开的模式(水平导航只支持弹出) - */ - mode?: 'inline' | 'popup'; - - /** - * 子导航打开的触发方式 - */ - triggerType?: 'click' | 'hover'; - - /** - * 内联子导航的展开模式,同时可以展开一个同级子导航还是多个同级子导航,该属性仅在 mode 为 inline 时生效 - */ - openMode?: 'single' | 'multiple'; - - /** - * 内联子导航缩进距离 - */ - inlineIndent?: number; - - /** - * 是否自动让弹层的宽度和菜单项保持一致,如果弹层的宽度比菜单项小则和菜单项保持一致,如果宽度大于菜单项则不做处理 - */ - popupAutoWidth?: boolean; - - /** - * 弹出子导航的对齐方式(水平导航只支持 follow ) - */ - popupAlign?: 'follow' | 'outside'; - - /** - * 弹层自定义 props - */ - popupProps?: PopupProps | (() => void); - - /** - * 弹出子导航的自定义类名 - */ - popupClassName?: string; - - /** - * 弹出子菜单自定义 style - */ - popupStyle?: React.CSSProperties; - - /** - * 当前选中导航项的 key 值 - */ - selectedKeys?: string | Array; - - /** - * 初始选中导航项的 key 值 - */ - defaultSelectedKeys?: string | Array; - - /** - * 选中或取消选中导航项触发的回调函数 - */ - onSelect?: (selectedKeys: Array, item: {}, extra: {}) => void; - - /** - * 选中模式,单选还是多选,默认无值,不可选 - */ - selectMode?: 'single' | 'multiple'; - - /** - * 是否只能选择第一层菜单项(不能选择子菜单中的菜单项) - */ - shallowSelect?: boolean; - - /** - * 是否显示选中图标,如果设置为 false 需配合配置平台设置选中时的背景色以示区分 - */ - hasSelectedIcon?: boolean; - - /** - * 是否将选中图标居右,仅当 hasSelectedIcon 为true 时生效。 - * 注意:SubMenu 上的选中图标一直居左,不受此API控制 - */ - isSelectIconRight?: boolean; - - /** - * 导航布局 - */ - direction?: 'hoz' | 'ver'; - - /** - * 横向导航条 items 和 footer 的对齐方向,在 direction 设置为 'hoz' 并且 header 存在时生效 - */ - hozAlign?: 'left' | 'right'; - - /** - * 自定义导航头部 - */ - header?: React.ReactNode; - - /** - * 自定义导航尾部 - */ - footer?: React.ReactNode; - - /** - * 是否自动获得焦点 - */ - autoFocus?: boolean; - - /** - * 当前获得焦点的子菜单或菜单项 key 值 - */ - focusedKey?: string; - - /** - * 是否开启嵌入式模式,一般用于Layout的布局中,开启后没有默认背景、外层border、box-shadow,可以配合`