fix: install types (#2682)

* chore: compatible types with jsx

* fix: install types

* fix: anchor, breadcrumb, button, checkbox types

Co-authored-by: Amour1688 <lcz_1996@foxmail.com>
pull/2684/head
言肆 2020-08-16 20:00:45 +08:00 committed by GitHub
parent 2891168a0f
commit 254a663d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 312 additions and 253 deletions

View File

@ -2,18 +2,26 @@
// 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 { VNode } from 'vue';
export declare class AnchorLink extends AntdComponent { export declare class AnchorLink {
/** $props: {
* target of hyperlink /**
* @type string * target of hyperlink
*/ * @type string
href: string; */
href: string;
/** /**
* content of hyperlink * content of hyperlink
* @type any (string | slot) * @type any (string | slot)
*/ */
title: any; title?: string | VNode | VNode[];
/**
* Specifies where to display the linked URL
* @version 1.5.0
*/
target?: string;
};
} }

View File

@ -2,62 +2,93 @@
// 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 { AnchorLink } from './anchor-link'; import { AnchorLink } from './anchor-link';
import { AntdComponent } from '../component';
export declare class Anchor extends AntdComponent { export declare class Anchor extends AntdComponent {
static Link: typeof AnchorLink; static Link: typeof AnchorLink;
/** $props: {
* Fixed mode of Anchor /**
* @default true * Fixed mode of Anchor
* @type boolean * @default true
*/ * @type boolean
affix: boolean; */
affix?: boolean;
/** /**
* Bounding distance of anchor area * Bounding distance of anchor area
* @default 5 * @default 5
* @type number * @type number
*/ */
bounds: number; bounds?: number;
/** /**
* Scrolling container * Scrolling container
* @default () => window * @default () => window
* @type Function * @type Function
*/ */
getContainer: () => HTMLElement; getContainer?: () => HTMLElement;
/** /**
* Pixels to offset from bottom when calculating position of scroll * Pixels to offset from bottom when calculating position of scroll
* @type number * @type number
*/ */
offsetBottom: number; offsetBottom?: number;
/** /**
* Pixels to offset from top when calculating position of scroll * Pixels to offset from top when calculating position of scroll
* @default 0 * @default 0
* @type number * @type number
*/ */
offsetTop: number; offsetTop?: number;
/** /**
* Whether show ink-balls in Fixed mode * Whether show ink-balls in Fixed mode
* @default false * @default false
* @type boolean * @type boolean
*/ */
showInkInFixed: boolean; showInkInFixed?: boolean;
/** /**
* The class name of the container * The class name of the container
* @type string * @type string
*/ */
wrapperClass: string; wrapperClass?: string;
/** /**
* The style of the container * The style of the container
* @type object * @type object
*/ */
wrapperStyle: object; wrapperStyle?: object;
/**
* Customize the anchor highlight
* @version 1.5.0
* @type function
* @return string
*/
getCurrentAnchor?: () => string;
/**
* Anchor scroll offset, default as `offsetTop`
* e.g. https://antdv.com/components/anchor/#components-anchor-demo-targetOffset
* @version 1.5.0
* @type number
*/
targetOffset?: number;
/**
* set the handler to handle click event
* @param e
* @param link
*/
onClick?: (e?: Event, link?: { [key: string]: any }) => void;
/**
* Listening for anchor link change
* @param currentActiveLink
*/
onChange?: (currentActiveLink?: string) => void;
};
} }

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 from 'vue'; import { App } from 'vue';
import { Affix } from './affix'; import { Affix } from './affix';
import { Anchor } from './anchor/anchor'; import { Anchor } from './anchor/anchor';
@ -73,7 +73,7 @@ import { PageHeader } from './page-header';
* Please do not invoke this method directly. * Please do not invoke this method directly.
* Call `Vue.use(Antd)` to install. * Call `Vue.use(Antd)` to install.
*/ */
export function install(vue: typeof Vue): void; export function install(app: App): void;
declare const message: Message; declare const message: Message;
declare const notification: Notification; declare const notification: Notification;

View File

@ -1,15 +1,14 @@
// Project: https://github.com/vueComponent/ant-design-vue // Project: https://github.com/vueComponent/ant-design-vue
// 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
export declare class BreadcrumbItem {
import { AntdComponent } from '../component'; $props: {
/**
export declare class BreadcrumbItem extends AntdComponent { * add navigation
/** * @default ''
* add navigation * @type string
* @default '' */
* @type string href?: String;
*/ overlay?: any;
href?: String; };
overlay?: any;
} }

View File

@ -2,6 +2,4 @@
// 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'; export declare class BreadcrumbSeparator {}
export declare class BreadcrumbSeparator extends AntdComponent {}

View File

@ -2,51 +2,55 @@
// 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 { VNode } from 'vue'; import { VNode } from 'vue';
import { BreadcrumbItem } from './breadcrumb-item'; import { BreadcrumbItem } from './breadcrumb-item';
import { BreadcrumbSeparator } from './breadcrumb-separator'; import { BreadcrumbSeparator } from './breadcrumb-separator';
import { AntdComponent } from '../component';
export interface Route { export interface Route {
path?: String; path?: String;
breadcrumbName?: String; breadcrumbName?: String;
children?: Route[];
} }
export declare class Breadcrumb extends AntdComponent { export declare class Breadcrumb extends AntdComponent {
static Item: typeof BreadcrumbItem; static Item: typeof BreadcrumbItem;
static Separator: typeof BreadcrumbSeparator; static Separator: typeof BreadcrumbSeparator;
/**
* The routing stack information of router
* @type Route[]
*/
routes: Route[];
/** $props: {
* Routing parameters /**
* @type object * The routing stack information of router
*/ * @type Route[]
params: object; */
routes?: Route[];
/** /**
* Custom separator * Routing parameters
* @default '/' * @type object
* @type any (string | slot) */
*/ params?: object;
separator: any;
/** /**
* Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}" * Custom separator
* @type Function * @default '/'
*/ * @type any (string | slot)
itemRender: ({ */
route, separator?: string | VNode | VNode[];
params,
routes, /**
paths, * Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}"
}: { * @type Function
route: any; */
params: any; itemRender?: ({
routes: any; route,
paths: any; params,
}) => VNode; routes,
paths,
}: {
route: any;
params: any;
routes: any;
paths: any;
}) => VNode;
};
} }

View File

@ -2,13 +2,13 @@
// 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'; export declare class ButtonGroup {
$props: {
export declare class ButtonGroup extends AntdComponent { /**
/** * can be set to small large or omitted
* can be set to small large or omitted * @default 'default'
* @default 'default' * @type string
* @type string */
*/ size?: 'small' | 'large' | 'default';
size: 'small' | 'large' | 'default'; };
} }

View File

@ -2,70 +2,73 @@
// 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 { ButtonGroup } from './button-group'; import { ButtonGroup } from './button-group';
export declare class Button extends AntdComponent { export declare class Button {
static Group: typeof ButtonGroup; static Group: typeof ButtonGroup;
/** $props: {
* can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default) /**
* @default 'default' * can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default)
* @type string * @default 'default'
*/ * @type string
type: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default'; */
type: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default';
/** /**
* set the original html type of button * set the original html type of button
* @default 'button' * @default 'button'
* @type string * @type string
*/ */
htmlType: 'button' | 'submit' | 'reset' | 'menu'; htmlType: 'button' | 'submit' | 'reset' | 'menu';
/** /**
* set the icon of button * set the icon of button
* @type string * @type string
*/ */
icon: string; icon: string;
/** /**
* can be set to circle or circle-outline or omitted * can be set to circle or circle-outline or omitted
* @type string * @type string
*/ */
shape: 'circle' | 'circle-outline'; shape: 'circle' | 'circle-outline';
/** /**
* can be set to small large or omitted * can be set to small large or omitted
* @default 'default' * @default 'default'
* @type string * @type string
*/ */
size: 'small' | 'large' | 'default'; size: 'small' | 'large' | 'default';
/** /**
* set the loading status of button * set the loading status of button
* @default false * @default false
* @type boolean | { delay: number } * @type boolean | { delay: number }
*/ */
loading: boolean | { delay: number }; loading: boolean | { delay: number };
/** /**
* disabled state of button * disabled state of button
* @default false * @default false
* @type boolean * @type boolean
*/ */
disabled: boolean; disabled: boolean;
/** /**
* make background transparent and invert text and border colors, added in 2.7 * make background transparent and invert text and border colors, added in 2.7
* @default false * @default false
* @type boolean * @type boolean
*/ */
ghost: boolean; ghost: boolean;
/** /**
* option to fit button width to its parent width * option to fit button width to its parent width
* @default false * @default false
* @type boolean * @type boolean
*/ */
block: boolean; block: boolean;
onClick?: (e?: Event) => void;
};
} }

View File

@ -2,34 +2,40 @@
// 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'; export declare class CheckboxGroup {
$props: {
/**
* Default selected value
* @type string[]
*/
defaultValue?: string[];
export declare class CheckboxGroup extends AntdComponent { /**
/** * Disable all checkboxes
* Default selected value * @default false
* @type string[] * @type boolean
*/ */
defaultValue: string[]; disabled?: boolean;
/** /**
* Disable all checkboxes * Specifies options, you can customize `label` with slot = "label" slot-scope = "option"
* @default false * @type Array<string | { label: string, value: string, disabled?: boolean, onChange?: Function }>
* @type boolean */
*/ options?: Array<
disabled: boolean; string | { label: string; value: string; disabled?: boolean; onChange?: Function }
>;
/** /**
* Specifies options, you can customize `label` with slot = "label" slot-scope = "option" * Used for setting the currently selected value.
* @type Array<string | { label: string, value: string, disabled?: boolean, onChange?: Function }> * @type string[]
*/ */
options: Array< value: string[];
string | { label: string; value: string; disabled?: boolean; onChange?: Function } name?: string;
>;
/** /**
* Used for setting the currently selected value. * The callback function that is triggered when the state changes.
* @type string[] * @param e
*/ */
value: string[]; onChange?: (checkedValue?: any) => void;
name?: string; };
} }

View File

@ -2,54 +2,62 @@
// 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 { CheckboxGroup } from './checkbox-group'; import { CheckboxGroup } from './checkbox-group';
import { AntdComponent } from '../component';
export declare class Checkbox extends AntdComponent { export declare class Checkbox extends AntdComponent {
static Group: typeof CheckboxGroup; static Group: typeof CheckboxGroup;
/** $props: {
* get focus when component mounted /**
* @default false * get focus when component mounted
* @type boolean * @default false
*/ * @type boolean
autofocus: boolean; */
autofocus?: boolean;
/** /**
* Specifies whether the checkbox is selected. * Specifies whether the checkbox is selected.
* @default false * @default false
* @type boolean * @type boolean
*/ */
checked: boolean; checked?: boolean;
/** /**
* Specifies the initial state: whether or not the checkbox is selected. * Specifies the initial state: whether or not the checkbox is selected.
* @default false * @default false
* @type boolean * @type boolean
*/ */
defaultChecked: boolean; defaultChecked?: boolean;
/** /**
* Disable checkbox * Disable checkbox
* @default false * @default false
* @type boolean * @type boolean
*/ */
disabled: boolean; disabled?: boolean;
/** /**
* indeterminate checked state of checkbox * indeterminate checked state of checkbox
* @default false * @default false
* @type boolean * @type boolean
*/ */
indeterminate: boolean; indeterminate?: boolean;
/** /**
* remove focus * remove focus
*/ */
blur(): void; blur(): void;
/** /**
* get focus * get focus
*/ */
focus(): void; focus(): void;
/**
* The callback function that is triggered when the state changes.
* @param event
*/
onChange?: (e?: Event) => void;
};
} }

View File

@ -2,8 +2,8 @@
// 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 from 'vue'; import { App } from 'vue';
export declare class AntdComponent extends Vue { export declare class AntdComponent {
static install(vue: typeof Vue): void; static install(app: App): void;
} }

34
types/meta.d.ts vendored
View File

@ -4,22 +4,24 @@
import { AntdComponent } from './component'; import { AntdComponent } from './component';
export declare class Meta extends AntdComponent { export declare class Meta {
/** $props: {
* The avatar of list item /**
* @type any (slot) * The avatar of list item
*/ * @type any (slot)
avatar: any; */
avatar: any;
/** /**
* The description of list item * The description of list item
* @type any (string | slot) * @type any (string | slot)
*/ */
description: any; description: any;
/** /**
* The title of list item * The title of list item
* @type any (string | slot) * @type any (string | slot)
*/ */
title: any; title: any;
};
} }