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,9 +2,10 @@
// 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 * target of hyperlink
* @type string * @type string
@ -15,5 +16,12 @@ export declare class AnchorLink extends AntdComponent {
* 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 * Fixed mode of Anchor
* @default true * @default true
* @type boolean * @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,10 +1,8 @@
// 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 * add navigation
* @default '' * @default ''
@ -12,4 +10,5 @@ export declare class BreadcrumbItem extends AntdComponent {
*/ */
href?: String; href?: String;
overlay?: any; 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,43 +2,46 @@
// 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;
$props: {
/** /**
* The routing stack information of router * The routing stack information of router
* @type Route[] * @type Route[]
*/ */
routes: Route[]; routes?: Route[];
/** /**
* Routing parameters * Routing parameters
* @type object * @type object
*/ */
params: object; params?: object;
/** /**
* Custom separator * Custom separator
* @default '/' * @default '/'
* @type any (string | slot) * @type any (string | slot)
*/ */
separator: any; separator?: string | VNode | VNode[];
/** /**
* Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}" * Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}"
* @type Function * @type Function
*/ */
itemRender: ({ itemRender?: ({
route, route,
params, params,
routes, routes,
@ -49,4 +52,5 @@ export declare class Breadcrumb extends AntdComponent {
routes: any; routes: any;
paths: any; paths: any;
}) => VNode; }) => 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,12 +2,12 @@
// 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) * can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default)
* @default 'default' * @default 'default'
@ -68,4 +68,7 @@ export declare class Button extends AntdComponent {
* @type boolean * @type boolean
*/ */
block: boolean; block: boolean;
onClick?: (e?: Event) => void;
};
} }

View File

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

View File

@ -2,46 +2,47 @@
// 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 * get focus when component mounted
* @default false * @default false
* @type boolean * @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
@ -52,4 +53,11 @@ export declare class Checkbox extends AntdComponent {
* 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;
} }

4
types/meta.d.ts vendored
View File

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