chore: update types

pull/2750/head
undefined 2020-08-22 10:21:34 +08:00
parent 4636463fde
commit 01c0a03ac8
24 changed files with 538 additions and 635 deletions

View File

@ -32,7 +32,7 @@ import { Input } from './input/input';
import { InputNumber } from './input-number'; import { InputNumber } from './input-number';
import { Layout } from './layout/layout'; import { Layout } from './layout/layout';
import { List } from './list/list'; import { List } from './list/list';
import { LocaleProvider } from './locale-provider'; import { Space } from './space';
import { Message } from './message'; import { Message } from './message';
import { Mentions } from './mentions/mentions'; import { Mentions } from './mentions/mentions';
import { Menu } from './menu/menu'; import { Menu } from './menu/menu';
@ -104,7 +104,7 @@ export {
InputNumber, InputNumber,
Layout, Layout,
List, List,
LocaleProvider, Space,
message, message,
Menu, Menu,
Mentions, Mentions,

View File

@ -3,13 +3,15 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component'; import { AntdComponent } from './component';
import { CSSProperties } from 'vue';
export declare type Value = { key: string }; export declare type Value = { key: string };
export declare type SelectValue = string | number | Value | Array<Value | string | number>; export declare type SelectValue = string | number | Value | Array<Value | string | number>;
export declare class AutoComplete extends AntdComponent { export declare class AutoComplete extends AntdComponent {
dropdownMenuStyle: object; $props: {
dropdownMenuStyle: CSSProperties;
/** /**
* Show clear button, effective in multiple mode only. * Show clear button, effective in multiple mode only.
* @default false * @default false
@ -96,7 +98,7 @@ export declare class AutoComplete extends AntdComponent {
* @type boolean * @type boolean
*/ */
open: boolean; open: boolean;
};
/** /**
* remove focus * remove focus
*/ */

2
types/card.d.ts vendored
View File

@ -81,7 +81,7 @@ export declare class Card extends AntdComponent {
* List of TabPane's head, Custom tabs can be created with the scopedSlots property * List of TabPane's head, Custom tabs can be created with the scopedSlots property
* @type Array<{key: string, tab: any, scopedSlots: {tab: string}}> * @type Array<{key: string, tab: any, scopedSlots: {tab: string}}>
*/ */
tabList?: Array<{ key: string; tab: any; scopedSlots: { tab: string } }>; tabList?: Array<{ key: string; tab: any; slots: { tab: string } }>;
/** /**
* Card title * Card title

View File

@ -5,38 +5,40 @@
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export declare class CollapsePanel extends AntdComponent { export declare class CollapsePanel extends AntdComponent {
$props: {
/** /**
* If true, panel cannot be opened or closed * If true, panel cannot be opened or closed
* @default false * @default false
* @type boolean * @type boolean
*/ */
disabled: boolean; disabled?: boolean;
/** /**
* Forced render of content on panel, instead of lazy rending after clicking on header * Forced render of content on panel, instead of lazy rending after clicking on header
* @default false * @default false
* @type boolean * @type boolean
*/ */
forceRender: boolean; forceRender?: boolean;
/** /**
* Title of the panel * Title of the panel
* @type string * @type string
*/ */
header: string; header?: string;
/** /**
* Unique key identifying the panel from among its siblings * Unique key identifying the panel from among its siblings
* @type string * @type string
*/ */
key: string; key?: string;
/** /**
* If false, panel will not show arrow icon * If false, panel will not show arrow icon
* @default true * @default true
* @type boolean * @type boolean
*/ */
showArrow: boolean; showArrow?: boolean;
extra: any; extra?: any;
};
} }

View File

@ -7,45 +7,46 @@ import { CollapsePanel } from './collapse-panel';
export type ExpandIconPosition = 'left' | 'right'; export type ExpandIconPosition = 'left' | 'right';
export declare class Collapse extends AntdComponent { export declare class Collapse extends AntdComponent {
static Panel: typeof CollapsePanel; static Panel: typeof CollapsePanel;
$props: {
expandIconPosition?: ExpandIconPosition; expandIconPosition?: ExpandIconPosition;
/** /**
* If true, Collapse renders as Accordion * If true, Collapse renders as Accordion
* @default false * @default false
* @type boolean * @type boolean
*/ */
accordion: boolean; accordion?: boolean;
/** /**
* Key of the active panel * Key of the active panel
* @default No default value. In accordion mode, it's the key of the first panel. * @default No default value. In accordion mode, it's the key of the first panel.
* @type string | string[] * @type string | string[]
*/ */
activeKey: string | string[]; activeKey?: string | string[];
/** /**
* Toggles rendering of the border around the collapse block * Toggles rendering of the border around the collapse block
* @default true * @default true
* @type boolean * @type boolean
*/ */
bordered: boolean; bordered?: boolean;
/** /**
* Key of the initial active panel * Key of the initial active panel
* @type string * @type string
*/ */
defaultActiveKey: string | string[]; defaultActiveKey?: string | string[];
/** /**
* Destroy Inactive Panel * Destroy Inactive Panel
* @default false * @default false
* @type boolean * @type boolean
*/ */
destroyInactivePanel: boolean; destroyInactivePanel?: boolean;
/** /**
* allow to customize collapse icon. * allow to customize collapse icon.
* @type any (function | slot-scope) * @type any (function | slot-scope)
*/ */
expandIcon: any; expandIcon?: any;
};
} }

View File

@ -5,6 +5,7 @@ import { AntdComponent } from './component';
import Pickr from '@simonwep/pickr'; import Pickr from '@simonwep/pickr';
export declare class ColorPicker extends AntdComponent { export declare class ColorPicker extends AntdComponent {
$props: {
/** simonwep/pickr's options */ /** simonwep/pickr's options */
config?: Pickr.Options; config?: Pickr.Options;
/**prefix class name */ /**prefix class name */
@ -48,4 +49,5 @@ export declare class ColorPicker extends AntdComponent {
* @default "HEXA" * @default "HEXA"
*/ */
format: Pickr.Representation; format: Pickr.Representation;
};
} }

View File

@ -5,6 +5,7 @@
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export declare class TextArea extends AntdComponent { export declare class TextArea extends AntdComponent {
$props: {
/** /**
* Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 } * Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 }
* @default false * @default false
@ -27,5 +28,6 @@ export declare class TextArea extends AntdComponent {
*allow to remove input content with clear icon (1.5.0) *allow to remove input content with clear icon (1.5.0)
* @type boolean * @type boolean
*/ */
allowClear?: boolean allowClear?: boolean;
};
} }

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export interface LayoutFooterProps { export interface LayoutFooterProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/** /**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @type boolean

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export interface LayoutHeaderProps { export interface LayoutHeaderProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/** /**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @type boolean

View File

@ -6,12 +6,6 @@ import { CSSProperties, Slot, VNodeChild } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export interface LayoutSiderProps { export interface LayoutSiderProps {
/**
* container className
* @type string
*/
class?: string;
/** /**
* whether can be collapsed * whether can be collapsed
* @default false * @default false
@ -39,12 +33,6 @@ export interface LayoutSiderProps {
*/ */
reverseArrow?: boolean; reverseArrow?: boolean;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/** /**
* specify the customized trigger, set to null to hide the trigger * specify the customized trigger, set to null to hide the trigger
* @type string | | VNodeChild | JSX.Element * @type string | | VNodeChild | JSX.Element

View File

@ -10,19 +10,6 @@ import LayoutFooter from './layout-footer';
import { CSSProperties } from 'vue'; import { CSSProperties } from 'vue';
export interface LayoutProps { export interface LayoutProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/** /**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @type boolean

View File

@ -1,32 +0,0 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
export interface ModalLocale {
okText: string;
cancelText: string;
justOkText: string;
}
export interface Locale {
locale: string;
Pagination?: Object;
DatePicker?: Object;
TimePicker?: Object;
Calendar?: Object;
Table?: Object;
Modal?: ModalLocale;
Popconfirm?: Object;
Transfer?: Object;
Select?: Object;
Upload?: Object;
}
export declare class LocaleProvider extends AntdComponent {
/**
* language package setting, you can find the packages in this path: antd/lib/locale-provider/
* @type object
*/
locale: object;
}

View File

@ -18,5 +18,5 @@ export declare class MenuItemGroup extends AntdComponent {
* @type string | slot * @type string | slot
*/ */
title?: VNodeChild | JSX.Element; title?: VNodeChild | JSX.Element;
} };
} }

14
types/modal.d.ts vendored
View File

@ -112,7 +112,7 @@ export interface ModalOptions {
/** /**
* Style of floating layer, typically used at least for adjusting the position. * Style of floating layer, typically used at least for adjusting the position.
*/ */
dialogStyle?: CSSProperties dialogStyle?: CSSProperties;
/** /**
* className of floating layer. * className of floating layer.
*/ */
@ -299,7 +299,7 @@ export declare class Modal extends AntdComponent {
* @type number * @type number
*/ */
zIndex?: number; zIndex?: number;
} };
static info(options: ModalOptions): ModalConfirm; static info(options: ModalOptions): ModalConfirm;
static success(options: ModalOptions): ModalConfirm; static success(options: ModalOptions): ModalConfirm;
static error(options: ModalOptions): ModalConfirm; static error(options: ModalOptions): ModalConfirm;
@ -307,13 +307,3 @@ export declare class Modal extends AntdComponent {
static confirm(options: ModalOptions): ModalConfirm; static confirm(options: ModalOptions): ModalConfirm;
static destroyAll(): void; static destroyAll(): void;
} }
declare module 'vue/types/vue' {
interface Vue {
$info: (modalOptios: ModalOptions) => ModalConfirm;
$success: (modalOptios: ModalOptions) => ModalConfirm;
$error: (modalOptios: ModalOptions) => ModalConfirm;
$warning: (modalOptios: ModalOptions) => ModalConfirm;
$confirm: (modalOptios: ModalOptions) => ModalConfirm;
}
}

View File

@ -2,7 +2,6 @@
// Definitions by: akki-jat <https://github.com/akki-jat> // Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { VNodeChild, CSSProperties } from 'vue'; import { VNodeChild, CSSProperties } from 'vue';
export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
export interface NotificationOptions extends NotificationConfigOptions { export interface NotificationOptions extends NotificationConfigOptions {

View File

11
types/space.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { AntdComponent } from './component';
export type SizeType = 'small' | 'middle' | 'large' | undefined;
export declare class Space extends AntdComponent {
$props: {
prefixCls?: string;
size?: SizeType | number;
direction?: 'horizontal' | 'vertical';
// No `stretch` since many components do not support that.
align?: 'start' | 'end' | 'center' | 'baseline';
};
}

View File

@ -2,7 +2,7 @@
// Definitions by: akki-jat <https://github.com/akki-jat> // Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { VNodeChild, Slots } from 'vue'; import { VNodeChild } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export declare class ColumnGroup extends AntdComponent { export declare class ColumnGroup extends AntdComponent {
@ -12,12 +12,5 @@ export declare class ColumnGroup extends AntdComponent {
* @type any * @type any
*/ */
title?: VNodeChild | JSX.Element; title?: VNodeChild | JSX.Element;
/**
* When using columns, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: Slots;
}; };
} }

View File

@ -199,7 +199,7 @@ export interface ColumnProps<T> {
* such as slots: { filterIcon: 'XXX'} * such as slots: { filterIcon: 'XXX'}
* @type object * @type object
*/ */
slots?: { [key: string]: string }; slots?: Record<string, string>;
} }
export declare class Column<T> extends AntdComponent { export declare class Column<T> extends AntdComponent {

View File

@ -2,7 +2,7 @@
// Definitions by: akki-jat <https://github.com/akki-jat> // Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import Vue, { VNodeChild } from 'vue'; import { VNodeChild } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
import { TooltipCommon } from './common'; import { TooltipCommon } from './common';
@ -12,6 +12,6 @@ export declare class Tooltip extends AntdComponent {
* The text shown in the tooltip * The text shown in the tooltip
* @type any (string | slot) * @type any (string | slot)
*/ */
title: VNodeChild | JSX.Element title: VNodeChild | JSX.Element;
} & TooltipCommon } & TooltipCommon;
} }

28
types/tree-node.d.ts vendored
View File

@ -7,20 +7,6 @@ import { VNodeChild } from 'vue';
export declare class TreeNode extends AntdComponent { export declare class TreeNode extends AntdComponent {
$props: { $props: {
/**
* Class
* @description className
* @type string
*/
class?: string;
/**
* Style
* @description style of tree node
* @type string | object
*/
style?: string | object;
/** /**
* When Tree is checkable, set TreeNode display Checkbox or not * When Tree is checkable, set TreeNode display Checkbox or not
* @version 1.5.0 * @version 1.5.0
@ -90,19 +76,5 @@ export declare class TreeNode extends AntdComponent {
* @type string * @type string
*/ */
value?: string; value?: string;
/**
* Slots
* @description When using treeNodes, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: object;
/**
* When using treeNodes, you can use this property to configure the events,
* such as on: { click: () => {}}
*/
on?: object;
}; };
} }

View File

@ -8,12 +8,21 @@ import { VNodeChild, CSSProperties } from 'vue';
export interface TreeData { export interface TreeData {
key: string | number; key: string | number;
title: string | VNodeChild | JSX.Element;
value: string; value: string;
label: any; label?: any;
children: any; children?: object[];
disabled?: boolean; disabled?: boolean;
disableCheckbox?: boolean; disableCheckbox?: boolean;
selectable?: boolean; selectable?: boolean;
checkable?: boolean;
/**
* Slots
* @description When using treeNodes, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: Record<string, string>;
} }
export interface ReplaceFields { export interface ReplaceFields {

View File

@ -3,15 +3,16 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
import { Tree } from './tree'; import { TreeProps } from './tree';
export declare class DictionaryTree extends Tree { interface DictionaryTreeProps extends TreeProps {
$props: {
/** /**
* Directory open logic, optional `false` 'click' 'dblclick' * Directory open logic, optional `false` 'click' 'dblclick'
* @default 'click' * @default 'click'
* @type string * @type string
*/ */
expandAction?: string | boolean; expandAction?: string | boolean;
}; }
export declare class DictionaryTree extends AntdComponent {
$props: DictionaryTreeProps;
} }

22
types/tree/tree.d.ts vendored
View File

@ -5,12 +5,9 @@
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
import { TreeNode } from '../tree-node'; import { TreeNode } from '../tree-node';
import { DictionaryTree } from './dictionary-tree'; import { DictionaryTree } from './dictionary-tree';
import { TreeData } from '../tree-select';
export declare class Tree extends AntdComponent { import { VNode } from 'vue';
static TreeNode: typeof TreeNode; export interface TreeProps {
static DirectoryTree: typeof DictionaryTree;
$props: {
/** /**
* Whether treeNode fill remaining horizontal space * Whether treeNode fill remaining horizontal space
* @version 1.5.0 * @version 1.5.0
@ -25,7 +22,7 @@ export declare class Tree extends AntdComponent {
* treeNode of tree * treeNode of tree
* @type TreeNode[] * @type TreeNode[]
*/ */
treeData?: TreeNode[]; treeData?: TreeData[];
/** /**
* *
@ -141,13 +138,13 @@ export declare class Tree extends AntdComponent {
* When the function returns true, the corresponding treeNode will be highlighted * When the function returns true, the corresponding treeNode will be highlighted
* @type Function * @type Function
*/ */
filterTreeNode?: (node?: TreeNode) => any; filterTreeNode?: (node?: VNode) => any | boolean;
/** /**
* Load data asynchronously * Load data asynchronously
* @type Function * @type Function
*/ */
loadData?: (node?: TreeNode) => any; loadData?: (node?: VNode) => any;
/** /**
* (Controlled) Set loaded tree nodes. Need work with loadData * (Controlled) Set loaded tree nodes. Need work with loadData
@ -269,5 +266,10 @@ export declare class Tree extends AntdComponent {
* @param event * @param event
*/ */
onSelect?: (selectedKeys: string[], event: { selected; selectedNodes; node; event }) => void; onSelect?: (selectedKeys: string[], event: { selected; selectedNodes; node; event }) => void;
}; }
export declare class Tree extends AntdComponent {
static TreeNode: typeof TreeNode;
static DirectoryTree: typeof DictionaryTree;
$props: TreeProps;
} }