Skip to content

Commit

Permalink
types: update .d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Nov 7, 2020
1 parent 7f2e0be commit d8a1697
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 113 deletions.
6 changes: 4 additions & 2 deletions types/alert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { ElementUIComponent } from './component'
export type AlertType = 'success' | 'warning' | 'info' | 'error'
export type AlertEffect = 'dark' | 'light'

/** Alert Component */
export declare class ElAlert extends ElementUIComponent {
interface IAlert {
/** Title */
title: string

Expand All @@ -29,3 +28,6 @@ export declare class ElAlert extends ElementUIComponent {
/** Choose effect */
effect: AlertEffect
}

/** Alert Component */
export const ElAlert: IAlert
6 changes: 4 additions & 2 deletions types/aside.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ElementUIComponent } from './component'

/** Aside Component */
export declare class ElAside extends ElementUIComponent {
interface IAside extends ElementUIComponent {
/** Width of the side section */
width: string
}

/** Aside Component */
export const ElAside: IAside
17 changes: 12 additions & 5 deletions types/autocomplete.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { ElementUIComponent } from './component'

export type SuggestionPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'
export type SuggestionPlacement =
| 'top'
| 'top-start'
| 'top-end'
| 'bottom'
| 'bottom-start'
| 'bottom-end'

export interface FetchSuggestionsCallback {
/**
Expand All @@ -20,9 +26,7 @@ export interface FetchSuggestions {
*/
(queryString: string, callback: FetchSuggestionsCallback): void
}

/** Autocomplete Component */
export declare class ElAutocomplete extends ElementUIComponent {
interface IAutocomplete extends ElementUIComponent {
/** The placeholder of Autocomplete */
placeholder: string

Expand Down Expand Up @@ -74,5 +78,8 @@ export declare class ElAutocomplete extends ElementUIComponent {
/**
* Focus the Input component
*/
focus (): void
focus(): void
}

/** Autocomplete Component */
export const ElAutocomplete: IAutocomplete
6 changes: 4 additions & 2 deletions types/badge.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ElementUIComponent } from './component'

/** Badge Component */
export declare class ElBadge extends ElementUIComponent {
interface IBadge extends ElementUIComponent{
/** Display value */
value: string | number

Expand All @@ -14,3 +13,6 @@ export declare class ElBadge extends ElementUIComponent {
/** Hidden badge */
hidden: boolean
}

/** Badge Component */
export const ElBadge: IBadge
6 changes: 4 additions & 2 deletions types/breadcrumb-item.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ElementUIComponent } from './component'

/** Breadcrumb Item Component */
export declare class ElBreadcrumbItem extends ElementUIComponent {
interface IBreadcrumbItem extends ElementUIComponent {
/** Target route of the link, same as to of vue-router */
to: string | object

/** If true, the navigation will not leave a history record */
replace: boolean
}

/** Breadcrumb Item Component */
export const ElBreadcrumbItem: IBreadcrumbItem
6 changes: 4 additions & 2 deletions types/breadcrumb.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ElementUIComponent } from './component'

/** Displays the location of the current page, making it easier to browser back */
export declare class ElBreadcrumb extends ElementUIComponent {
interface IBreadcrumb extends ElementUIComponent {
/** Separator character */
separator: string

/** Class name of the icon separator */
separatorClass: string
}

/** Breadcrumb Component */
export const ElBreadcrumb: IBreadcrumb
4 changes: 3 additions & 1 deletion types/button-group.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ElementUIComponent } from './component'

interface IButtonGroup extends ElementUIComponent {}

/** Button Group Component */
export declare class ElButtonGroup extends ElementUIComponent {}
export const ElButtonGroup: IButtonGroup
7 changes: 5 additions & 2 deletions types/button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info' |
/** Same as native button's type */
export type ButtonNativeType = 'button' | 'submit' | 'reset' | 'menu'

/** Button Component */
export declare class ElButton extends ElementUIComponent {

interface IButton extends ElementUIComponent{
/** Button size */
size: ElementUIComponentSize

Expand Down Expand Up @@ -35,3 +35,6 @@ export declare class ElButton extends ElementUIComponent {
/** Same as native button's type */
nativeType: ButtonNativeType
}

/** Button Component */
export const ElButton:IButton
9 changes: 6 additions & 3 deletions types/card.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import { ElementUIComponent } from './component'

export interface CardSlots {
/** Content of the card */
default: VNode[],
default: VNode[]

/** Title of the card */
header: VNode[]

[key: string]: VNode[]
}

/** Integrate information in a card container */
export declare class ElCard extends ElementUIComponent {
interface ICard extends ElementUIComponent {
/** Title of the card */
header: string

Expand All @@ -23,4 +22,8 @@ export declare class ElCard extends ElementUIComponent {
shadow: string

$slots: CardSlots

}

/** Integrate information in a card container */
export const ElCard: ICard
6 changes: 4 additions & 2 deletions types/carousel-item.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { ElementUIComponent } from './component'

/** Carousel Item Component */
export declare class ElCarouselItem extends ElementUIComponent {
interface ICarouselItem extends ElementUIComponent {
/** Name of the item, can be used in setActiveItem */
name: string

/** Text content for the corresponding indicator */
label: string
}

/** Carousel Item Component */
export const ElCarouselItem: ICarouselItem
14 changes: 8 additions & 6 deletions types/carousel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export type CarouselArrowVisibility = 'always' | 'hover' | 'never'
export type CarouselType = 'card'
export type CarouselDirection = 'horizontal' | 'vertical'

/** Loop a series of images or texts in a limited space */
export declare class ElCarousel extends ElementUIComponent {
interface ICarousel extends ElementUIComponent {
/** Height of the carousel */
height: number

Expand Down Expand Up @@ -40,18 +39,21 @@ export declare class ElCarousel extends ElementUIComponent {
*
* @param index Index of the slide to be switched to (starting from 0)
*/
setActiveItem (index: number): void
setActiveItem(index: number): void

/**
* Manually switch slide by carousel item's name
*
* @param name The name of the corresponding `el-carousel-item`
*/
setActiveItem (name: string): void
setActiveItem(name: string): void

/** Switch to the previous slide */
prev (): void
prev(): void

/** Switch to the next slide */
next (): void
next(): void
}

/** Loop a series of images or texts in a limited space */
export const ElCarousel: ICarousel
14 changes: 8 additions & 6 deletions types/cascader.d.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import { VNode } from 'vue';
import { VNode } from 'vue'
import { ElementUIComponent, ElementUIComponentSize } from './component'
import { CascaderOption, CascaderProps, CascaderNode } from './cascader-panel';
import { CascaderOption, CascaderProps, CascaderNode } from './cascader-panel'

export { CascaderOption, CascaderProps, CascaderNode };
export { CascaderOption, CascaderProps, CascaderNode }

export interface CascaderSlots {
/** Custom label content */
default: VNode[],
default: VNode[]

/** Empty content when no option matches */
empty: VNode[]

[key: string]: VNode[]
}

/** Cascader Component */
export declare class ElCascader<V = any, D = CascaderOption> extends ElementUIComponent {
interface ICascader<V = any, D = CascaderOption> extends ElementUIComponent {
/** Data of the options */
options: CascaderOption[]

Expand Down Expand Up @@ -63,3 +62,6 @@ export declare class ElCascader<V = any, D = CascaderOption> extends ElementUICo

$slots: CascaderSlots
}

/** Cascader Component */
export const ElCascader: ICascader
4 changes: 3 additions & 1 deletion types/checkbox-button.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ElementUIComponent } from './component'

/** Checkbox Button Component */
export declare class ElCheckboxButton extends ElementUIComponent {
export const ElCheckboxButton :ICheckboxButton

interface ICheckboxButton extends ElementUIComponent {
/** Value of the checkbox when used inside a checkbox-group */
label: string | number | boolean

Expand Down
3 changes: 2 additions & 1 deletion types/checkbox-group.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ElementUIComponent, ElementUIComponentSize } from './component'

/** Checkbox Group Component */
export declare class ElCheckboxGroup extends ElementUIComponent {
export const ElCheckboxGroup : ICheckboxGroup
interface ICheckboxGroup extends ElementUIComponent {
/** Size of checkbox buttons or bordered checkboxes */
size: ElementUIComponentSize

Expand Down
6 changes: 4 additions & 2 deletions types/checkbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ElementUIComponent, ElementUIComponentSize } from './component'

/** Checkbox Component */
export declare class ElCheckbox extends ElementUIComponent {
interface ICheckbox extends ElementUIComponent {
/** The form input value */
value: string | string[]

Expand Down Expand Up @@ -32,3 +31,6 @@ export declare class ElCheckbox extends ElementUIComponent {
/** Same as indeterminate in native checkbox */
indeterminate: boolean
}

/** Checkbox Component */
export const ElCheckbox: ICheckbox
5 changes: 3 additions & 2 deletions types/col.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ElementUIComponent } from './component'
/** Responsive column props */
export interface ResponsiveColumnProperties {
/** Number of column the grid spans */
span: number,
span: number

/** Number of spacing on the left side of the grid */
offset: number
Expand All @@ -13,7 +13,8 @@ export interface ResponsiveColumnProperties {
export type ResponsiveColumn = number | ResponsiveColumnProperties

/** Colunm Layout Component */
export declare class ElCol extends ElementUIComponent {
export const ElCol: ICol
interface ICol extends ElementUIComponent {
/** Number of column the grid spans */
span: number

Expand Down
6 changes: 3 additions & 3 deletions types/component.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Vue from 'vue'
import { App } from 'vue'

/** ElementUI component common definition */
export declare class ElementUIComponent extends Vue {
export interface ElementUIComponent {
/** Install component into Vue */
static install (vue: typeof Vue): void
install: (app: App, ...options: any[]) => any
}

/** Component size definition for button, input, etc */
Expand Down
Loading

0 comments on commit d8a1697

Please sign in to comment.