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: 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
@ -15,5 +16,12 @@ export declare class AnchorLink extends AntdComponent {
* content of hyperlink
* @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: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
import { AnchorLink } from './anchor-link';
import { AntdComponent } from '../component';
export declare class Anchor extends AntdComponent {
static Link: typeof AnchorLink;
$props: {
/**
* Fixed mode of Anchor
* @default true
* @type boolean
*/
affix: boolean;
affix?: boolean;
/**
* Bounding distance of anchor area
* @default 5
* @type number
*/
bounds: number;
bounds?: number;
/**
* Scrolling container
* @default () => window
* @type Function
*/
getContainer: () => HTMLElement;
getContainer?: () => HTMLElement;
/**
* Pixels to offset from bottom when calculating position of scroll
* @type number
*/
offsetBottom: number;
offsetBottom?: number;
/**
* Pixels to offset from top when calculating position of scroll
* @default 0
* @type number
*/
offsetTop: number;
offsetTop?: number;
/**
* Whether show ink-balls in Fixed mode
* @default false
* @type boolean
*/
showInkInFixed: boolean;
showInkInFixed?: boolean;
/**
* The class name of the container
* @type string
*/
wrapperClass: string;
wrapperClass?: string;
/**
* The style of the container
* @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: https://github.com/vueComponent/ant-design-vue/types
import Vue from 'vue';
import { App } from 'vue';
import { Affix } from './affix';
import { Anchor } from './anchor/anchor';
@ -73,7 +73,7 @@ import { PageHeader } from './page-header';
* Please do not invoke this method directly.
* 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 notification: Notification;

View File

@ -1,10 +1,8 @@
// 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 declare class BreadcrumbItem extends AntdComponent {
export declare class BreadcrumbItem {
$props: {
/**
* add navigation
* @default ''
@ -12,4 +10,5 @@ export declare class BreadcrumbItem extends AntdComponent {
*/
href?: String;
overlay?: any;
};
}

View File

@ -2,6 +2,4 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
export declare class BreadcrumbSeparator extends AntdComponent {}
export declare class BreadcrumbSeparator {}

View File

@ -2,43 +2,46 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
import { VNode } from 'vue';
import { BreadcrumbItem } from './breadcrumb-item';
import { BreadcrumbSeparator } from './breadcrumb-separator';
import { AntdComponent } from '../component';
export interface Route {
path?: String;
breadcrumbName?: String;
children?: Route[];
}
export declare class Breadcrumb extends AntdComponent {
static Item: typeof BreadcrumbItem;
static Separator: typeof BreadcrumbSeparator;
$props: {
/**
* The routing stack information of router
* @type Route[]
*/
routes: Route[];
routes?: Route[];
/**
* Routing parameters
* @type object
*/
params: object;
params?: object;
/**
* Custom separator
* @default '/'
* @type any (string | slot)
*/
separator: any;
separator?: string | VNode | VNode[];
/**
* Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}"
* @type Function
*/
itemRender: ({
itemRender?: ({
route,
params,
routes,
@ -49,4 +52,5 @@ export declare class Breadcrumb extends AntdComponent {
routes: any;
paths: any;
}) => VNode;
};
}

View File

@ -2,13 +2,13 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
export declare class ButtonGroup extends AntdComponent {
export declare class ButtonGroup {
$props: {
/**
* can be set to small large or omitted
* @default 'default'
* @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: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
import { ButtonGroup } from './button-group';
export declare class Button extends AntdComponent {
export declare class Button {
static Group: typeof ButtonGroup;
$props: {
/**
* can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default)
* @default 'default'
@ -68,4 +68,7 @@ export declare class Button extends AntdComponent {
* @type boolean
*/
block: boolean;
onClick?: (e?: Event) => void;
};
}

View File

@ -2,27 +2,26 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
export declare class CheckboxGroup extends AntdComponent {
export declare class CheckboxGroup {
$props: {
/**
* Default selected value
* @type string[]
*/
defaultValue: string[];
defaultValue?: string[];
/**
* Disable all checkboxes
* @default false
* @type boolean
*/
disabled: boolean;
disabled?: boolean;
/**
* Specifies options, you can customize `label` with slot = "label" slot-scope = "option"
* @type Array<string | { label: string, value: string, disabled?: boolean, onChange?: Function }>
*/
options: Array<
options?: Array<
string | { label: string; value: string; disabled?: boolean; onChange?: Function }
>;
@ -32,4 +31,11 @@ export declare class CheckboxGroup extends AntdComponent {
*/
value: 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: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
import { CheckboxGroup } from './checkbox-group';
import { AntdComponent } from '../component';
export declare class Checkbox extends AntdComponent {
static Group: typeof CheckboxGroup;
$props: {
/**
* get focus when component mounted
* @default false
* @type boolean
*/
autofocus: boolean;
autofocus?: boolean;
/**
* Specifies whether the checkbox is selected.
* @default false
* @type boolean
*/
checked: boolean;
checked?: boolean;
/**
* Specifies the initial state: whether or not the checkbox is selected.
* @default false
* @type boolean
*/
defaultChecked: boolean;
defaultChecked?: boolean;
/**
* Disable checkbox
* @default false
* @type boolean
*/
disabled: boolean;
disabled?: boolean;
/**
* indeterminate checked state of checkbox
* @default false
* @type boolean
*/
indeterminate: boolean;
indeterminate?: boolean;
/**
* remove focus
@ -52,4 +53,11 @@ export declare class Checkbox extends AntdComponent {
* get focus
*/
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: https://github.com/vueComponent/ant-design-vue/types
import Vue from 'vue';
import { App } from 'vue';
export declare class AntdComponent extends Vue {
static install(vue: typeof Vue): void;
export declare class AntdComponent {
static install(app: App): void;
}

4
types/meta.d.ts vendored
View File

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