From 817b8f31861eba241f7d5a0da52cdb3a91492447 Mon Sep 17 00:00:00 2001 From: cqmimi <785513452@qq.com> Date: Fri, 28 Dec 2018 14:51:13 +0800 Subject: [PATCH 1/2] feat: add typescript support --- package.json | 4 +- types/affix.d.ts | 10 ++ types/alert.d.ts | 26 +++++ types/anchor.d.ts | 25 ++++ types/ant-design-vue.d.ts | 227 +++++++++++++++++++++++++++++++++++++ types/auto-complete.d.ts | 39 +++++++ types/avatar.d.ts | 18 +++ types/back-top.d.ts | 9 ++ types/badge.d.ts | 24 ++++ types/breadcrumb.d.ts | 29 +++++ types/button.d.ts | 31 +++++ types/calendar.d.ts | 28 +++++ types/card.d.ts | 49 ++++++++ types/carousel.d.ts | 29 +++++ types/cascader.d.ts | 59 ++++++++++ types/checkbox-group.d.ts | 12 ++ types/checkbox.d.ts | 20 ++++ types/col.d.ts | 26 +++++ types/collapse.d.ts | 22 ++++ types/component.d.ts | 13 +++ types/date-picker.d.ts | 63 ++++++++++ types/divider.d.ts | 10 ++ types/dropdown.d.ts | 45 ++++++++ types/form-item.d.ts | 23 ++++ types/form.d.ts | 39 +++++++ types/icon.d.ts | 23 ++++ types/index.d.ts | 3 + types/input-number.d.ts | 34 ++++++ types/input.d.ts | 50 ++++++++ types/layout.d.ts | 40 +++++++ types/list.d.ts | 66 +++++++++++ types/locale-provider.d.ts | 6 + types/menu-ItemGroup.d.ts | 7 ++ types/menu-item.d.ts | 8 ++ types/menu-submenu.d.ts | 15 +++ types/menu.d.ts | 51 +++++++++ types/message.d.ts | 29 +++++ types/modal.d.ts | 126 ++++++++++++++++++++ types/month-picker.d.ts | 23 ++++ types/notification.d.ts | 58 ++++++++++ types/pagination.d.ts | 35 ++++++ types/popconfirm.d.ts | 21 ++++ types/popover.d.ts | 9 ++ types/progress.d.ts | 33 ++++++ types/radio.d.ts | 39 +++++++ types/range-picker.d.ts | 27 +++++ types/rate.d.ts | 31 +++++ types/row.d.ts | 18 +++ types/select.d.ts | 102 +++++++++++++++++ types/skeleton.d.ts | 34 ++++++ types/slider.d.ts | 38 +++++++ types/spin.d.ts | 19 ++++ types/step.d.ts | 15 +++ types/steps.d.ts | 21 ++++ types/switch.d.ts | 27 +++++ types/table.d.ts | 141 +++++++++++++++++++++++ types/tabs.d.ts | 48 ++++++++ types/tag.d.ts | 21 ++++ types/time-picker.d.ts | 57 ++++++++++ types/timeline.d.ts | 20 ++++ types/tooltip.d.ts | 31 +++++ types/transfer.d.ts | 43 +++++++ types/tree-select.d.ts | 83 ++++++++++++++ types/tree.d.ts | 91 +++++++++++++++ types/upload.d.ts | 44 +++++++ types/week-picker.d.ts | 18 +++ 66 files changed, 2484 insertions(+), 1 deletion(-) create mode 100644 types/affix.d.ts create mode 100644 types/alert.d.ts create mode 100644 types/anchor.d.ts create mode 100644 types/ant-design-vue.d.ts create mode 100644 types/auto-complete.d.ts create mode 100644 types/avatar.d.ts create mode 100644 types/back-top.d.ts create mode 100644 types/badge.d.ts create mode 100644 types/breadcrumb.d.ts create mode 100644 types/button.d.ts create mode 100644 types/calendar.d.ts create mode 100644 types/card.d.ts create mode 100644 types/carousel.d.ts create mode 100644 types/cascader.d.ts create mode 100644 types/checkbox-group.d.ts create mode 100644 types/checkbox.d.ts create mode 100644 types/col.d.ts create mode 100644 types/collapse.d.ts create mode 100644 types/component.d.ts create mode 100644 types/date-picker.d.ts create mode 100644 types/divider.d.ts create mode 100644 types/dropdown.d.ts create mode 100644 types/form-item.d.ts create mode 100644 types/form.d.ts create mode 100644 types/icon.d.ts create mode 100644 types/index.d.ts create mode 100644 types/input-number.d.ts create mode 100644 types/input.d.ts create mode 100644 types/layout.d.ts create mode 100644 types/list.d.ts create mode 100644 types/locale-provider.d.ts create mode 100644 types/menu-ItemGroup.d.ts create mode 100644 types/menu-item.d.ts create mode 100644 types/menu-submenu.d.ts create mode 100644 types/menu.d.ts create mode 100644 types/message.d.ts create mode 100644 types/modal.d.ts create mode 100644 types/month-picker.d.ts create mode 100644 types/notification.d.ts create mode 100644 types/pagination.d.ts create mode 100644 types/popconfirm.d.ts create mode 100644 types/popover.d.ts create mode 100644 types/progress.d.ts create mode 100644 types/radio.d.ts create mode 100644 types/range-picker.d.ts create mode 100644 types/rate.d.ts create mode 100644 types/row.d.ts create mode 100644 types/select.d.ts create mode 100644 types/skeleton.d.ts create mode 100644 types/slider.d.ts create mode 100644 types/spin.d.ts create mode 100644 types/step.d.ts create mode 100644 types/steps.d.ts create mode 100644 types/switch.d.ts create mode 100644 types/table.d.ts create mode 100644 types/tabs.d.ts create mode 100644 types/tag.d.ts create mode 100644 types/time-picker.d.ts create mode 100644 types/timeline.d.ts create mode 100644 types/tooltip.d.ts create mode 100644 types/transfer.d.ts create mode 100644 types/tree-select.d.ts create mode 100644 types/tree.d.ts create mode 100644 types/upload.d.ts create mode 100644 types/week-picker.d.ts diff --git a/package.json b/package.json index e6fa9fbb15..51287d9cac 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,10 @@ "files": [ "dist", "lib", - "es" + "es", + "types" ], + "typings": "types/index.d.ts", "scripts": { "dev": "cross-env NODE_ENV=development ENTRY_INDEX=dev ./node_modules/.bin/webpack-dev-server --open --hot --port 3001", "start": "cross-env NODE_ENV=development ./node_modules/.bin/webpack-dev-server --open --hot", diff --git a/types/affix.d.ts b/types/affix.d.ts new file mode 100644 index 0000000000..3b109ee0b0 --- /dev/null +++ b/types/affix.d.ts @@ -0,0 +1,10 @@ +import { AntdVueComponent } from './component'; + +/** AAffix Layout Component */ +export declare class AAffix extends AntdVueComponent { + offsetBottom: number + + offsetTop: number + + target: () => HTMLElement +} diff --git a/types/alert.d.ts b/types/alert.d.ts new file mode 100644 index 0000000000..97825acd2b --- /dev/null +++ b/types/alert.d.ts @@ -0,0 +1,26 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +type Types = 'success' | 'info' | 'warning' | 'error'; +/** AAlert Layout Component */ +export declare class AAlert extends AntdVueComponent { + afterClose: () => void + + banner: boolean + + closable: boolean + + closeText: string | VNode + + description: string | VNode + + message: string | VNode + + showIcon: boolean + + iconType: string + + type: Types + + close: (e: MouseEvent) => void +} diff --git a/types/anchor.d.ts b/types/anchor.d.ts new file mode 100644 index 0000000000..0b0b6b4e39 --- /dev/null +++ b/types/anchor.d.ts @@ -0,0 +1,25 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** AAnchor Layout Component */ +export declare class AAnchor extends AntdVueComponent { + affix: boolean + + bounds: number + + getContainer: () => HTMLElement + + offsetBottom: number + + offsetTop: number + + showInkInFixed: boolean +} + + +/** ALink Layout Component */ +export declare class ALink extends AntdVueComponent { + href: string + + title: string | VNode +} diff --git a/types/ant-design-vue.d.ts b/types/ant-design-vue.d.ts new file mode 100644 index 0000000000..e159ebd977 --- /dev/null +++ b/types/ant-design-vue.d.ts @@ -0,0 +1,227 @@ +import Vue, { Component } from 'vue'; + +import { AMessage } from './message'; +import { AIcon } from './icon'; +import { ASpin } from './spin'; +import { AAffix } from './affix'; +import { AAlert } from './alert'; +import { AAnchor, ALink } from './anchor'; +import { AAutoComplete } from './auto-complete'; +import { AAvatar } from './avatar'; +import { ABackTop } from './back-top'; +import { ABadge } from './badge'; +import { ABreadcrumb, ABreadcrumbItem } from './breadcrumb'; +import { AButton, AButtonGroup } from './button'; +import { ACalendar } from './calendar'; +import { ACard, ACardMeta, ACardGrid } from './card'; +import { ACarousel, ACarouselPanel } from './carousel'; +import { ACascader } from './cascader'; +import { ACheckbox } from './checkbox'; +import { ACheckboxGroup } from './checkbox-group'; +import { ACol } from './col'; +import { ACollapse } from './collapse'; +import { ADatePicker } from './date-picker'; +import { AInputNumber } from './input-number'; +import { AInput, AInputTextArea, AInputSearch, AInputGroup } from './input'; +import { AList, AListGrid, AListItem, AListItemMeta } from './list'; +import { ALocaleProvider } from './locale-provider'; +import { AMenu, AMenuDivider } from './menu'; +import { AMenuItem } from './menu-item'; +import { ASubmenu } from './menu-submenu'; +import { AMenuItemGroup } from './menu-ItemGroup'; +import { AModal } from './modal'; +import { AMonthPicker } from './month-picker'; +import { ANotification } from './notification'; +import { APagination } from './pagination'; +import { APopconfirm } from './popconfirm'; +import { APopover } from './popover'; +import { AProgress } from './progress'; +import { ARadio, ARadioGroup, ARadioButton } from './radio'; +import { ARangePicker } from './range-picker'; +import { ARate } from './rate'; +import { ARow } from './row'; +import { ASelect, ASelectOption, AOptGroup } from './select'; +import { ASlider } from './slider'; +import { ASteps } from './steps'; +import { AStep } from './step'; +import { ASwitch } from './switch'; +import { ATable, AColumn, AColumnGroup } from './table'; +import { ATabs, ATabPane } from './tabs'; +import { ATag } from './tag'; +import { ATimeline, ATimelineItem } from './timeline'; +import { ATimePicker } from './time-picker'; +import { ATooltip } from './tooltip'; +import { ATransfer } from './transfer'; +import { ATreeSelect, TreeNode } from './tree-select'; +import { ATree } from './tree'; +import { AUpload } from './upload'; +import { AWeekPicker } from './week-picker'; +import { ADropdown, ADropdownButton } from './dropdown'; +import { AForm } from './form'; +import { AFormItem } from './form-item'; +import { ALayout, ASider } from './layout'; +import { ASKeleton } from './skeleton'; + +export const message: AMessage; + +export class Icon extends AIcon {} + +export class Affix extends AAffix {} + +export class Alert extends AAlert {} + +export class Anchor extends AAnchor {} + +export class AutoComplete extends AAutoComplete {} + +export class Avatar extends AAvatar {} + +export class BackTop extends ABackTop {} + +export class Badge extends ABadge {} + +export class Breadcrumb extends ABreadcrumb { + static Item: ABreadcrumbItem & Component +} + +export class Button extends AButton { + static Group: AButtonGroup & Component +} + +export class Calendar extends ACalendar {} + +export class Card extends ACard { + static Meta: ACardMeta & Component + + static Grid: ACardGrid & Component +} + +export class Carousel extends ACarousel { + static Panel: ACarouselPanel & Component +} + +export class Cascader extends ACascader {} + +export class Checkbox extends ACheckbox { + static Group: ACheckboxGroup & Component +} + +export class Col extends ACol {} + +export class Collapse extends ACollapse {} + +export class DatePicker extends ADatePicker { + static MonthPicker: AMonthPicker & Component + static RangePicker: ARangePicker & Component + static WeekPicker: AWeekPicker & Component +} + +export class Dropdown extends ADropdown { + static Button: ADropdownButton & Component +} + +export class Form extends AForm { + static Item: AFormItem & Component +} + +export class InputNumber extends AInputNumber {} + +export class Input extends AInput { + static TextArea: AInputTextArea & Component + static Search: AInputSearch & Component + static Group: AInputGroup & Component +} + +export class List extends AList { + static Item: AListItem & Component +} + +export class ListGrid extends AListGrid {} + +export class Link extends ALink {} + +export class LocaleProvider extends ALocaleProvider {} + +export class Menu extends AMenu { + static Divider: AMenuDivider & Component + static Item: AMenuItem & Component + static SubMenu: ASubmenu & Component + static ItemGroup: AMenuItemGroup & Component +} + +export class Modal extends AModal {} + +export class Notification extends ANotification {} + +export class Pagination extends APagination {} + +export class Popconfirm extends APopconfirm {} + +export class Popover extends APopover {} + +export class Progress extends AProgress {} + +export class Radio extends ARadio { + static Group: ARadioGroup & Component + static Button: ARadioButton & Component +} + +export class Rate extends ARate {} + +export class Row extends ARow {} + +export class Select extends ASelect { + static Option: ASelectOption & Component + static OptGroup: AOptGroup & Component +} + +export class Slider extends ASlider {} + +export class Spin extends ASpin {} + +export class Steps extends ASteps {} + +export class Step extends AStep {} + +export class Switch extends ASwitch {} + +export class Table extends ATable { + static Column: AColumn & Component + static ColumnGroup: AColumnGroup & Component +} + +export class Column extends AColumn {} + +export class Tabs extends ATabs { + static TabPane: ATabPane & Component +} + +export class Tag extends ATag { + static CheckableTag: any & Component +} + +export class TimePicker extends ATimePicker {} + +export class Timeline extends ATimeline { + static Item: ATimelineItem & Component +} + +export class Tooltip extends ATooltip {} + +export class Transfer extends ATransfer {} + +export class TreeSelect extends ATreeSelect { + static TreeNode: TreeNode & Component +} + +export class Tree extends ATree {} + +export class Upload extends AUpload { + static Dragger: any & Component +} + +export class Layout extends ALayout { + Sider: ASider +} + +export class SKeleton extends ASKeleton {} \ No newline at end of file diff --git a/types/auto-complete.d.ts b/types/auto-complete.d.ts new file mode 100644 index 0000000000..ee4422fc75 --- /dev/null +++ b/types/auto-complete.d.ts @@ -0,0 +1,39 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +type DataSourceItemType = { value: any, text: string }; + +/** AAutoComplete Layout Component */ +export declare class AAutoComplete extends AntdVueComponent { + allowClear: boolean + + autoFocus: boolean + + backfill: boolean + + dataSource: VNode | DataSourceItemType[] + + defaultActiveFirstOption: boolean + + defaultValue: string | string[] | + { key: string, label: string|VNode[] } | Array<{ key: string, label: string|VNode[]}> + + disabled: boolean + + filterOption: (inputValue: string, option: any) => boolean | boolean + + optionLabelProp: string + + placeholder: string | VNode + + value: string | string[] | + { key: string, label: string|VNode[] } | Array<{ key: string, label: string|VNode[]}> + + defaultOpen: boolean + + open: boolean + + static blur: () => void + + static focus: () => void +} diff --git a/types/avatar.d.ts b/types/avatar.d.ts new file mode 100644 index 0000000000..d7d3a85165 --- /dev/null +++ b/types/avatar.d.ts @@ -0,0 +1,18 @@ +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +declare enum shape { 'circle', 'square' } + +/** AAvatar Layout Component */ +export declare class AAvatar extends AntdVueComponent { + icon: string + + shape: shape + + size: AntdVueComponentSize + + src: string + + alt: string + + loadError: () => boolean +} diff --git a/types/back-top.d.ts b/types/back-top.d.ts new file mode 100644 index 0000000000..03f1c357fc --- /dev/null +++ b/types/back-top.d.ts @@ -0,0 +1,9 @@ +import { AntdVueComponent } from './component'; + +/** ABackTop Layout Component */ +export declare class ABackTop extends AntdVueComponent { + target: () => Window + + visibilityHeight: number + +} diff --git a/types/badge.d.ts b/types/badge.d.ts new file mode 100644 index 0000000000..96b9b207c0 --- /dev/null +++ b/types/badge.d.ts @@ -0,0 +1,24 @@ +import { AntdVueComponent } from './component'; + +type Status = 'success' | 'processing' | 'default' | 'error' | 'warning'; + +/** ABadge Layout Component */ +export declare class ABadge extends AntdVueComponent { + count: number | string + + dot: boolean + + offset: [number|string, number|string] + + overflowCount: number + + showZero: boolean + + status: Status + + text: string + + numberStyle: object + + title: string +} diff --git a/types/breadcrumb.d.ts b/types/breadcrumb.d.ts new file mode 100644 index 0000000000..9c0887e5bf --- /dev/null +++ b/types/breadcrumb.d.ts @@ -0,0 +1,29 @@ +import Vue, { VNode } from 'vue'; + +import { AntdVueComponent } from './component'; + +export interface RenderOptions{ + route: object[] + + params: object + + routes: object + + paths: string +} + +/** ABreadcrumb Layout Component */ +export declare class ABreadcrumb extends AntdVueComponent { + itemRender (options: RenderOptions): VNode + + params: object + + routes: object[] + + separator: string | VNode +} + +export declare class ABreadcrumbItem extends AntdVueComponent { + +} + diff --git a/types/button.d.ts b/types/button.d.ts new file mode 100644 index 0000000000..b8dab3017b --- /dev/null +++ b/types/button.d.ts @@ -0,0 +1,31 @@ +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +type ButtonType = 'primary' | 'dashed' | 'danger'; + +type ButtonShape = 'circle' | 'default'; + +type HtmlType = 'button' | 'reset' | 'submit'; + +export declare class AButton extends AntdVueComponent { + type: ButtonType + + shape: ButtonShape + + size: AntdVueComponentSize + + loading: boolean | { delay: number } + + disabled: boolean + + ghost: boolean + + htmlType: HtmlType + + icon: string + + block: boolean +} + +export declare class AButtonGroup extends AntdVueComponent { + +} diff --git a/types/calendar.d.ts b/types/calendar.d.ts new file mode 100644 index 0000000000..6bd0f212d7 --- /dev/null +++ b/types/calendar.d.ts @@ -0,0 +1,28 @@ +import { AntdVueComponent, AntdVueComponentSize } from './component'; +import { VNode } from 'vue'; +import { Moment } from 'moment'; + +/** ACalendar Layout Component */ +export declare class ACalendar extends AntdVueComponent { + dateCellRender: (date: Moment) => void + + dateFullCellRender: (date: Moment) => void + + defaultValue: Moment + + disabledDate: (currentDate: Moment) => boolean + + fullscreen: boolean + + locale: object + + mode: string + + monthCellRender: (date: Moment) => void + + monthFullCellRender: (date: Moment) => void + + validRange: [Moment, Moment] + + value: Moment +} diff --git a/types/card.d.ts b/types/card.d.ts new file mode 100644 index 0000000000..5f952dd165 --- /dev/null +++ b/types/card.d.ts @@ -0,0 +1,49 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** ACard Layout Component */ +export declare class ACard extends AntdVueComponent { + actions: VNode + + headStyle: object + + bodyStyle: object + + bordered: boolean + + cover: VNode + + extra: string | VNode + + hoverable: boolean + + loading: boolean + + tabList: Array<{key: string, tab: any, scopedSlots: {tab: 'XXX'}}> + + activeTabKey: string + + defaultActiveTabKey: string + + title: string | VNode + + type: string + + onTabChange: (key: string) => void + + tabChange(key: string): void +} + +/** ACardMeta Layout Component */ +export declare class ACardMeta extends AntdVueComponent { + avatar: VNode + + description: string | VNode + + title: string | VNode +} + +/** ACardGrid Layout Component */ +export declare class ACardGrid extends AntdVueComponent { + +} diff --git a/types/carousel.d.ts b/types/carousel.d.ts new file mode 100644 index 0000000000..7dc60ca64a --- /dev/null +++ b/types/carousel.d.ts @@ -0,0 +1,29 @@ +import { AntdVueComponent } from './component'; + +/** ACarousel Layout Component */ +export declare class ACarousel extends AntdVueComponent { + afterChange(current: number): void + + autoplay: boolean + + beforeChange(form: number, to: number): void + + dots: boolean + + easing: string + + effect: string + + vertical: boolean + + goTo(slideNumber: number): void + + next(): void + + prev(): void +} + +/** ACarouselPanel Layout Component */ +export declare class ACarouselPanel extends AntdVueComponent { + +} diff --git a/types/cascader.d.ts b/types/cascader.d.ts new file mode 100644 index 0000000000..adddf2647f --- /dev/null +++ b/types/cascader.d.ts @@ -0,0 +1,59 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +interface DisplayRender { labels: string, selectedOptions: any } + +type Placement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight'; +/** ACascader Layout Component */ +export declare class ACascader extends AntdVueComponent { + allowClear: boolean + + autoFocus: boolean + + changeOnSelect: boolean + + defaultValue: string[] + + disabled: boolean + + displayRender: (Options: DisplayRender) => VNode + + expandTrigger: 'click' | 'hover' + + fieldNames: { label: string, value: string, children: string } + + getPopupContainer(triggerNode: VNode): HTMLElement + + loadData(selectedOptions: any): void + + notFoundContent: string + + options: object + + placeholder: string + + popupClassName: string + + popupStyle: object + + popupPlacement: Placement + + popupVisible: boolean + + showSearch: boolean | { + filter: (inputValue: any, path: string) => boolean, + matchInputWidth: boolean, + render: ({inputValue, path}) => VNode, + sort: (a: any, b: any, inputValue: string) => void + } + + size: AntdVueComponentSize + + suffixIcon: string | VNode + + value: string[] + + blur(): void + + focus(): void +} diff --git a/types/checkbox-group.d.ts b/types/checkbox-group.d.ts new file mode 100644 index 0000000000..54c0eebb4d --- /dev/null +++ b/types/checkbox-group.d.ts @@ -0,0 +1,12 @@ +import { AntdVueComponent } from './component'; + +/** ACheckboxGroup Layout Component */ +export declare class ACheckboxGroup extends AntdVueComponent { + defaultValue: string[] + + options: string[] | Array<{ label: string, value: string, disabled?: boolean, onChange?: Function }> + + value: string[] + + onChange(checkedValue: string[]): void +} diff --git a/types/checkbox.d.ts b/types/checkbox.d.ts new file mode 100644 index 0000000000..8e4b8bd037 --- /dev/null +++ b/types/checkbox.d.ts @@ -0,0 +1,20 @@ +import { AntdVueComponent } from './component'; + +/** ACheckbox Layout Component */ +export declare class ACheckbox extends AntdVueComponent { + autoFocus: boolean + + checked: boolean + + defaultChecked: boolean + + disabled: boolean + + indeterminate: boolean + + change(e: Event): void + + blur(): void + + focus(): void +} diff --git a/types/col.d.ts b/types/col.d.ts new file mode 100644 index 0000000000..31a07707ad --- /dev/null +++ b/types/col.d.ts @@ -0,0 +1,26 @@ +import { AntdVueComponent } from './component'; + +/** Row Layout Component */ +export declare class ACol extends AntdVueComponent { + offset: number + + order: number + + pull: number + + push: number + + span: number + + xs: number | object + + sm: number | object + + md: number | object + + lg: number | object + + xl: number | object + + xxl: number | object +} diff --git a/types/collapse.d.ts b/types/collapse.d.ts new file mode 100644 index 0000000000..6a7429f568 --- /dev/null +++ b/types/collapse.d.ts @@ -0,0 +1,22 @@ +import { AntdVueComponent } from './component'; +import { VNode } from 'vue'; + +/** ACollapse Layout Component */ +export declare class ACollapse extends AntdVueComponent { + activeKey: string[] | string + + defaultActiveKey: string + + change: (key: string) => void +} + +/** ACollapsePanel Layout Component */ +export declare class ACollapsePanel extends AntdVueComponent { + disabled: boolean + + forceRender: boolean + + header: string | VNode + + key: string +} diff --git a/types/component.d.ts b/types/component.d.ts new file mode 100644 index 0000000000..887f6fcd08 --- /dev/null +++ b/types/component.d.ts @@ -0,0 +1,13 @@ +import Vue from 'vue'; + +/** AntdVue component common definition */ +export declare class AntdVueComponent extends Vue { + /** Install component into Vue */ + static install (vue: typeof Vue): void +} + +/** Component size definition for button, input, etc */ +export type AntdVueComponentSize = 'large' | 'default' | 'small'; + +/** Horizontal alignment */ +export type AntdVueHorizontalAlignment = 'left' | 'center' | 'right'; diff --git a/types/date-picker.d.ts b/types/date-picker.d.ts new file mode 100644 index 0000000000..18a04328a3 --- /dev/null +++ b/types/date-picker.d.ts @@ -0,0 +1,63 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; +import { Moment } from 'moment'; + +/** ADatePublic Layout Component */ +export declare class ADatePublic extends AntdVueComponent { + allowClear: boolean + + autoFocus: boolean + + dateRender: VNode + + disabled: boolean + + disabledDate: (currentDate: Moment) => boolean + + getCalendarContainer: (trigger: Event) => void + + locale: object + + open: boolean + + placeholder: string | string[] + + popupStyle: object + + dropdownClassName: string + + size: AntdVueComponentSize + + suffixIcon: VNode + + blur(): void + + focus(): void + + openChange(status: any): void +} + + +/** ADatePicker Layout Component */ +export declare class ADatePicker extends AntdVueComponent { + defaultValue: Moment + + defaultPickerValue: Moment + + disabledTime(date: Moment | [Moment, Moment], partial?: 'start' | 'end'): void + + format: string + + renderExtraFooter: VNode + + showTime: { defaultValue: Moment } | boolean + + showToday: boolean + + value: any + + change(date: any, dateString: string): void + + ok(): void +} + diff --git a/types/divider.d.ts b/types/divider.d.ts new file mode 100644 index 0000000000..73edb7aef4 --- /dev/null +++ b/types/divider.d.ts @@ -0,0 +1,10 @@ +import { AntdVueComponent } from './component'; + +/** ADivider Layout Component */ +export declare class ADivider extends AntdVueComponent { + dashed: boolean + + type: 'horizontal' | 'vertical' + + orientation: 'left' | 'right' +} diff --git a/types/dropdown.d.ts b/types/dropdown.d.ts new file mode 100644 index 0000000000..7a27bfd49e --- /dev/null +++ b/types/dropdown.d.ts @@ -0,0 +1,45 @@ +import Vue, { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +type PlaceMent = 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight'; + +type Trigger = 'click' | 'hover' | 'contextmenu'; + +/** ADropdown Layout Component */ +export declare class ADropdown extends AntdVueComponent { + disabled: boolean + + getPopupContainer (): HTMLElement + + overlay: VNode + + placement: PlaceMent + + trigger: Array + + visable: boolean + + visibleChange: (visible: boolean) => void +} + + +/** ADropdownButton Layout Component */ +export declare class ADropdownButton extends AntdVueComponent { + disabled: boolean + + overlay: any + + placement: 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' + + size: AntdVueComponentSize + + trigger: string[] + + type: string + + visible: boolean + + click: Function + + visibleChange: (visible: boolean) => void +} diff --git a/types/form-item.d.ts b/types/form-item.d.ts new file mode 100644 index 0000000000..a46ac8a5ae --- /dev/null +++ b/types/form-item.d.ts @@ -0,0 +1,23 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** AFormItem Layout Component */ +export declare class AFormItem extends AntdVueComponent { + colon: boolean + + extra: string | VNode + + hasFeedback: boolean + + help: string | VNode + + label: string | VNode + + labelCol: object + + required: boolean + + validateStatus: string + + wrapperCol: object +} diff --git a/types/form.d.ts b/types/form.d.ts new file mode 100644 index 0000000000..702ab594f7 --- /dev/null +++ b/types/form.d.ts @@ -0,0 +1,39 @@ +import { AntdVueComponent } from './component'; + +type Layout = 'horizontal' | 'vertical' | 'inline'; + +export interface CreateOptions { + props?: object + + mapPropsToFields?: (props: object) => ({ fieldName: object }) + + validateMessages?: Object + + onFieldsChange?: (props: object, fields: object) => void + + onValuesChange?: (props: object, values: string) => void +} + +/** AForm Layout Component */ +export declare class AForm extends AntdVueComponent { + form: object + + hideRequiredMark: Boolean + + layout: Layout + + autoFormCreate: (form: object) => void + + options: object + + submit(e: Event): void + + static create(options?: CreateOptions): any +} + +declare module 'vue/types/vue' { + interface Vue { + Form: any, + form: any + } +} diff --git a/types/icon.d.ts b/types/icon.d.ts new file mode 100644 index 0000000000..a1cb4f0f37 --- /dev/null +++ b/types/icon.d.ts @@ -0,0 +1,23 @@ +import { AntdVueComponent } from './component'; +import { VNode, Component } from 'vue'; + +export declare class AIcon extends AntdVueComponent { + type: string; + + style: any; + + theme: 'filled' | 'outlined' | 'twoTone', + + spin: boolean; + + component: VNode; + + twoToneColor: string; + + static setTwoToneColor: (color: string) => void; + + static getTwoToneColor: () => string; + + createFromIconfontCN: ({ scriptUrl: string, extraCommonProps: object }) => Component; + +} \ No newline at end of file diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000000..8b17d65ecb --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,3 @@ +import * as AntdVue from './ant-design-vue' +export * from './ant-design-vue' +export default AntdVue diff --git a/types/input-number.d.ts b/types/input-number.d.ts new file mode 100644 index 0000000000..1ae4b7516e --- /dev/null +++ b/types/input-number.d.ts @@ -0,0 +1,34 @@ +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** AInputNumber Layout Component */ +export declare class AInputNumber extends AntdVueComponent { + autoFocus: boolean + + defaultValue: number + + disabled: boolean + + formatter(value: number | string): string + + max: number + + min: number + + parser(string: string): number + + decimalSeparator: string + + precision: number + + size: AntdVueComponentSize + + step: number | string + + value: number + + change(value: number | string): void + + blur(): void + + focus(): void +} diff --git a/types/input.d.ts b/types/input.d.ts new file mode 100644 index 0000000000..5b24453144 --- /dev/null +++ b/types/input.d.ts @@ -0,0 +1,50 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** AInput Layout Component */ +export declare class AInput extends AntdVueComponent { + addonAfter: string | VNode + + addonBefore: string | VNode + + defaultValue: string + + disabled: boolean + + id: string + + prefix: string | VNode + + size: AntdVueComponentSize + + suffix: string | VNode + + type: string + + value: string + + pressEnter(): void +} + +/** AInputTextArea Layout Component */ +export declare class AInputTextArea extends AInput { + autosize: boolean | object + + defaultValue: string + + value: string +} + +/** AInputSearch Layout Component */ +export declare class AInputSearch extends AInput { + enterButton: boolean | VNode + + search(value: string): void +} + +/** AInputGroup Layout Component */ +export declare class AInputGroup { + compact: boolean + + size: AntdVueComponentSize +} diff --git a/types/layout.d.ts b/types/layout.d.ts new file mode 100644 index 0000000000..0a87b1be7c --- /dev/null +++ b/types/layout.d.ts @@ -0,0 +1,40 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ALayout Layout Component */ +export declare class ALayout extends AntdVueComponent { + class: string; + + style: object; + + hasSider: boolean; + + Sider: ASider +} + +export declare class ASider extends AntdVueComponent { + breakpoint: object; + + class: string; + + collapsed: boolean; + + collapsedWidth: number; + + collapsible: boolean; + + defaultCollapsed: boolean; + + reverseArrow: boolean; + + style: object | string; + + theme: 'light' | 'dark'; + + trigger: string | VNode; + + width: number | string; + + collapse: (collapsed: boolean, type: string) => void; +} + diff --git a/types/list.d.ts b/types/list.d.ts new file mode 100644 index 0000000000..bf5201e71c --- /dev/null +++ b/types/list.d.ts @@ -0,0 +1,66 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** AList Layout Component */ +export declare class AList extends AntdVueComponent { + bordered: boolean + + footer: VNode | string + + grid: object + + header: VNode | string + + itemLayout: string + + loading: boolean | object + + loadMore: string | VNode + + pagination: boolean | object + + size: AntdVueComponentSize + + split: boolean + + renderItem: (item: any, index: number) => VNode + + rowKey: (item: any) => string | number +} + +/** AList Layout Component */ +export declare class AListGrid extends AntdVueComponent { + column: number + + gutter: number + + xs: number + + sm: number + + md: number + + lg: number + + xl: number + + xxl: number +} + +/** AListItem Layout Component */ +export declare class AListItem extends AntdVueComponent { + actions: Array + + extra: string | VNode + + Meta: AListItemMeta +} + +/** AListItemMeta Layout Component */ +export declare class AListItemMeta extends AntdVueComponent { + avatar: VNode + + description: string | VNode + + title: string | VNode +} diff --git a/types/locale-provider.d.ts b/types/locale-provider.d.ts new file mode 100644 index 0000000000..80c4b19e13 --- /dev/null +++ b/types/locale-provider.d.ts @@ -0,0 +1,6 @@ +import { AntdVueComponent } from './component'; + +/** ALocaleProvider Layout Component */ +export declare class ALocaleProvider extends AntdVueComponent { + locale: object +} diff --git a/types/menu-ItemGroup.d.ts b/types/menu-ItemGroup.d.ts new file mode 100644 index 0000000000..c4c4d52d71 --- /dev/null +++ b/types/menu-ItemGroup.d.ts @@ -0,0 +1,7 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** AMenuItemGroup Layout Component */ +export declare class AMenuItemGroup extends AntdVueComponent { + title: string | Function | VNode +} diff --git a/types/menu-item.d.ts b/types/menu-item.d.ts new file mode 100644 index 0000000000..311637126b --- /dev/null +++ b/types/menu-item.d.ts @@ -0,0 +1,8 @@ +import { AntdVueComponent } from './component'; + +/** AMenuItem Item Component */ +export declare class AMenuItem extends AntdVueComponent { + disabled: boolean + + key: string +} diff --git a/types/menu-submenu.d.ts b/types/menu-submenu.d.ts new file mode 100644 index 0000000000..f6fe2ab8c3 --- /dev/null +++ b/types/menu-submenu.d.ts @@ -0,0 +1,15 @@ +import Vue, { VNode } from 'vue'; +import { AntdVueComponent } from './component'; +import { AMenuItem } from './menu-item'; +/** ASubmenu Layout Component */ +export declare class ASubmenu extends AntdVueComponent { + children: Array + + disabled: boolean + + key: string + + title: string | VNode + + titleClick(key: string, domEvent: Event): void +} diff --git a/types/menu.d.ts b/types/menu.d.ts new file mode 100644 index 0000000000..9b6c9bc358 --- /dev/null +++ b/types/menu.d.ts @@ -0,0 +1,51 @@ +import { AntdVueComponent } from './component'; + +type MenuMode = 'vertical' | 'vertical-right' | 'horizontal' | 'inline'; + +type Theme = 'light' | 'dark'; + +interface clickOption{ item: any, key: string, keyPath: string } + +interface deselectOption{ item: any, key: string, selectedKeys: string } + +/** AMenu Layout Component */ +export declare class AMenu extends AntdVueComponent { + defaultOpenKeys: string[] + + defaultSelectedKeys: string[] + + forceSubMenuRender: boolean + + inlineCollapsed: boolean + + inlineIndent: number + + mode: MenuMode + + multiple: boolean + + openKeys: string[] + + selectable: boolean + + selectedKeys: string[] + + subMenuCloseDelay: number + + subMenuOpenDelay: number + + theme: Theme + + click(Options: clickOption): void + + deselect(Options: deselectOption): void + + openChange(openKeys: string[]): void + + select(Options: deselectOption): void +} +/** AMenuDivider Layout Component */ +export declare class AMenuDivider extends AntdVueComponent { + +} + diff --git a/types/message.d.ts b/types/message.d.ts new file mode 100644 index 0000000000..2cc7bcd65a --- /dev/null +++ b/types/message.d.ts @@ -0,0 +1,29 @@ + +interface Config { + top?: string, + duration?: number, + maxCount?: number, + getContainer?: () => HTMLElement +} + +export interface AMessage { + success (content: string, duration?: number, onClose?: () => void): void, + + error (content: string, duration?: number, onClose?: () => void): void, + + info (content: string, duration?: number, onClose?: () => void): void, + + warning (content: string, duration?: number, onClose?: () => void): void, + + warn (content: string, duration?: number, onClose?: () => void): void, + + loading (content: string, duration?: number, onClose?: () => void): void, + + config (options: Config): void +} + +declare module 'vue/types/vue' { + interface Vue { + $message: AMessage + } +} diff --git a/types/modal.d.ts b/types/modal.d.ts new file mode 100644 index 0000000000..5b30ab63b0 --- /dev/null +++ b/types/modal.d.ts @@ -0,0 +1,126 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** AModal Layout Component */ +export declare class AModal extends AntdVueComponent { + afterClose?: Function + + bodyStyle?: object + + cancelText?: string | VNode + + centered: boolean + + closable?: boolean + + confirmLoading?: boolean + + destroyOnClose?: boolean + + footer?: string | VNode + + getContainer?: (instance: any) => HTMLElement + + keyboard: boolean + + mask?: boolean + + maskClosable?: boolean + + maskStyle?: object + + okText?: string | VNode + + okType?: string + + okButtonProps: {props: object, on: {}} + + cancelButtonProps: {props: object, on: {}} + + style?: object + + title?: string | VNode + + visible?: boolean + + width?: string | number + + wrapClassName?: string + + zIndex?: number + + content?: string | VNode + + cancel?: (e: Event) => void + + ok?: (e: Event) => void + + onOk?: (e: Event) => void + + static info: (params: AModalParams) => void + + static success: (params: AModalParams) => void + + static error: (params: AModalParams) => void + + static warning: (params: AModalParams) => void + + static confirm: (params: AModalParams) => void +} + +export declare class AModalParams { + + autoFocusButton: null | 'ok' | 'cancel' + + afterClose?: Function + + bodyStyle?: object + + cancelText?: string | VNode + + centered: boolean + + class: string + + closable?: boolean + + iconType: string + + confirmLoading?: boolean + + destroyOnClose?: boolean + + footer?: string | VNode + + getContainer?: (instance: any) => HTMLElement + + mask?: boolean + + maskClosable?: boolean + + maskStyle?: object + + okText?: string | VNode + + okType?: string + + style?: object + + title?: string | VNode + + visible?: boolean + + width?: string | number + + wrapClassName?: string + + zIndex?: number + + content?: string | VNode + + cancel?: (e: Event) => void + + ok?: (e: Event) => void + + onOk?: (e: Event) => void +} diff --git a/types/month-picker.d.ts b/types/month-picker.d.ts new file mode 100644 index 0000000000..4a4e6c9f54 --- /dev/null +++ b/types/month-picker.d.ts @@ -0,0 +1,23 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; +import { ADatePicker } from './date-picker'; +import { Moment } from 'moment'; + + +/** AMonthPicker Layout Component */ +export declare class AMonthPicker extends ADatePicker { + defaultValue: Moment + + defaultPickerValue: Moment + + format: string + + monthCellContentRender: VNode + + renderExtraFooter: VNode + + value: Moment + + change(date: any, dateString: string): void +} + diff --git a/types/notification.d.ts b/types/notification.d.ts new file mode 100644 index 0000000000..596d13ac02 --- /dev/null +++ b/types/notification.d.ts @@ -0,0 +1,58 @@ +import { CreateElement, VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +type Placement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; +/** ANotification Layout Component */ +export declare class ANotification extends AntdVueComponent { + static success: (params: Params) => void + + static error: (params: Params) => void + + static info: (params: Params) => void + + static warning: (params: Params) => void + + static warn: (params: Params) => void + + static open: (params: Params) => void + + static close: (params: Params) => void + + static destroy: () => void + + static config: (params: Config) => void +} + +interface Params { + btn?: (h: CreateElement) => any | VNode + + class?: string + + description?: (h: CreateElement) => any | VNode | string + + duration?: number + + icon?: (h: CreateElement) => any | VNode + + key?: string + + message?: (h: CreateElement) => any | VNode | string + + placement?: Placement + + style?: object | string + + onClose?: Function +} + +interface Config { + bottom?: string + + duration?: number + + getContainer?: () => HTMLElement + + placement?: Placement + + top?: string +} diff --git a/types/pagination.d.ts b/types/pagination.d.ts new file mode 100644 index 0000000000..3e17449d47 --- /dev/null +++ b/types/pagination.d.ts @@ -0,0 +1,35 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** APagination Layout Component */ +export declare class APagination extends AntdVueComponent { + current: number + + defaultCurrent: number + + defaultPageSize: number + + hideOnSinglePage: boolean + + itemRender: (page: number, type: 'page' | 'prev' | 'next', originalElement: HTMLElement) => VNode + + pageSize: number + + pageSizeOptions: string[] + + showQuickJumper: boolean + + showSizeChanger: boolean + + showTotal (total: number, range: any): void + + simple: boolean + + size: 'default' | 'small' + + total: number + + change(page: number, pageSize: number): void + + showSizeChange(current: number, size: number): void +} diff --git a/types/popconfirm.d.ts b/types/popconfirm.d.ts new file mode 100644 index 0000000000..26d5a4affb --- /dev/null +++ b/types/popconfirm.d.ts @@ -0,0 +1,21 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** APopconfirm Layout Component */ +export declare class APopconfirm extends AntdVueComponent { + cancelText: string | VNode + + okText: string | VNode + + okType: string + + title: string | VNode + + icon: VNode + + cancel: (e: Event) => void + + confirm: (e: Event) => void + + visibleChange: (visible: boolean) => void +} diff --git a/types/popover.d.ts b/types/popover.d.ts new file mode 100644 index 0000000000..032adeba17 --- /dev/null +++ b/types/popover.d.ts @@ -0,0 +1,9 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** APopover Layout Component */ +export declare class APopover extends AntdVueComponent { + content: string | VNode + + title: string | VNode +} diff --git a/types/progress.d.ts b/types/progress.d.ts new file mode 100644 index 0000000000..08349dbb25 --- /dev/null +++ b/types/progress.d.ts @@ -0,0 +1,33 @@ +import { AntdVueComponent } from './component'; + +declare enum position { 'top', 'bottom', 'left', 'right' } + +declare enum strokeLinecap { 'round', 'square' } + +/** AProgress Layout Component */ +export declare class AProgress extends AntdVueComponent { + format: (percent: number) => string + + gapDegree: number + + gapPosition: position + + percent: number + + showInfo: boolean + + status: 'success' | 'exception' | 'active' + + strokeWidth: number + + type: 'line' | 'circle' | 'dashboard' + + width: number + + successPercent: number + + strokeColor: string + + strokeLinecap: strokeLinecap +} + diff --git a/types/radio.d.ts b/types/radio.d.ts new file mode 100644 index 0000000000..62a7c94b3d --- /dev/null +++ b/types/radio.d.ts @@ -0,0 +1,39 @@ +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ARadio Layout Component */ +export declare class ARadio extends AntdVueComponent { + autoFocus: boolean + + checked: boolean + + defaultChecked: boolean + + value: any + + blur(): void + + focus(): void +} + +export declare class ARadioGroup extends AntdVueComponent { + defaultValue: any + + disabled: boolean + + name: string + + options: string[] | Array<{ label: string, value: string, disabled?: boolean }> + + size: AntdVueComponentSize + + value: any + + buttonStyle: 'outline' | 'solid' + + change(e: Event): void +} + + +export declare class ARadioButton extends AntdVueComponent { + value: string | number +} diff --git a/types/range-picker.d.ts b/types/range-picker.d.ts new file mode 100644 index 0000000000..e10d1c38ca --- /dev/null +++ b/types/range-picker.d.ts @@ -0,0 +1,27 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; +import { ADatePicker } from './date-picker'; +import { Moment } from 'moment'; + +/** ARangePicker Layout Component */ +export declare class ARangePicker extends ADatePicker { + + defaultValue: Moment + + defaultPickerValue: Moment + + format: string + + ranges: () => { [range: string]: Moment[] } | { [range: string]: () => Moment[] } + + renderExtraFooter: VNode + + value: any + + calendarChange(dates: object[], dateStrings: [string, string]): void + + change(date: any, dateString: string): void + + ok(): void +} + diff --git a/types/rate.d.ts b/types/rate.d.ts new file mode 100644 index 0000000000..9f32067651 --- /dev/null +++ b/types/rate.d.ts @@ -0,0 +1,31 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** ARate Layout Component */ +export declare class ARate extends AntdVueComponent { + allowClear: boolean + + allowHalf: boolean + + autoFocus: boolean + + character: string | VNode + + count: number + + defaultValue: number + + disabled: boolean + + value: number + + static blur(): void + + static change(value: number): void + + static focus(): void + + static hoverChange(value: number): void + + static keydown(e: Event): void +} diff --git a/types/row.d.ts b/types/row.d.ts new file mode 100644 index 0000000000..f61845162a --- /dev/null +++ b/types/row.d.ts @@ -0,0 +1,18 @@ +import { AntdVueComponent } from './component'; + +/** Horizontal alignment of flex layout */ +export type HorizontalAlignment = 'start' | 'end' | 'center' | 'space-around' | 'space-between'; + +/** vertical alignment of flex layout */ +export type VertialAlignment = 'top' | 'middle' | 'bottom'; + +/** Row Layout Component */ +export declare class ARow extends AntdVueComponent { + align: VertialAlignment + + gutter: number | object + + justify: HorizontalAlignment + + type: string +} diff --git a/types/select.d.ts b/types/select.d.ts new file mode 100644 index 0000000000..b4ee090083 --- /dev/null +++ b/types/select.d.ts @@ -0,0 +1,102 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +interface Options { value: any, label: string } + +export declare class ASelectOption extends AntdVueComponent { + disabled: boolean + + key: string + + title: string + + value: string | number + + class: string +} + +/** ASelect Layout Component */ +export declare class ASelect extends AntdVueComponent { + allowClear: boolean + + autoClearSearchValue: boolean + + autoFocus: boolean + + defaultActiveFirstOption: boolean + + defaultValue: string | string[] | number | number[] + + disabled: boolean + + dropdownClassName: string + + dropdownMatchSelectWidth: boolean + + dropdownStyle: object + + filterOption:(inputValue: string, option: any) => boolean | boolean + + firstActiveValue: string | string[] + + getPopupContainer: (triggerNode: VNode) => HTMLElement + + labelInValue: boolean + + maxTagCount: number + + maxTagPlaceholder: (omittedValues: any) => void | VNode + + mode: 'default' | 'multiple' | 'tags' | 'combobox' + + notFoundContent: string | VNode + + optionFilterProp: string + + optionLabelProp: string + + placeholder: string | VNode + + showSearch: boolean + + showArrow: boolean + + size: AntdVueComponentSize + + tokenSeparators: string[] + + value: string | string[] | number | number[] + + options: Array + + defaultOpen: boolean + + open: boolean + + static blur(): void + + static change(value: any, option: ASelectOption| Array): void + + static deselect(value: any, option:ASelectOption): void + + static focus(): void + + static inputKeydown(): void + + static mouseenter(): void + + static mouseleave(): void + + static popupScroll(): void + + static search(value: string): void + + static select(value: string, option:ASelectOption): void +} + +/** AOptGroup Layout Component */ +export declare class AOptGroup extends AntdVueComponent { + key: string + + label: (h: any) => void | string | VNode +} diff --git a/types/skeleton.d.ts b/types/skeleton.d.ts new file mode 100644 index 0000000000..bb4b06bb24 --- /dev/null +++ b/types/skeleton.d.ts @@ -0,0 +1,34 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ASKeleton Layout Component */ +export declare class ASKeleton extends AntdVueComponent { + active: boolean + + avatar: boolean | SkeletonAvatarProps + + loading: boolean + + paragraph: boolean | SkeletonParagraphProps + + title: boolean | SkeletonTitleProps +} + +declare enum Size { 'large', 'small', 'default' } + +declare enum Shape { 'circle', 'square' } + +interface SkeletonAvatarProps { + size: Size, + shape: Shape +} + +interface SkeletonTitleProps { + width: number | string +} + +interface SkeletonParagraphProps { + rows: number + + width: number | string | Array +} \ No newline at end of file diff --git a/types/slider.d.ts b/types/slider.d.ts new file mode 100644 index 0000000000..a3954a787f --- /dev/null +++ b/types/slider.d.ts @@ -0,0 +1,38 @@ +import { AntdVueComponent } from './component'; + +/** ASlider Layout Component */ +export declare class ASlider extends AntdVueComponent { + autoFocus: boolean + + defaultValue: number | number[] + + disabled: boolean + + dots: boolean + + included: boolean + + marks: object + + max: number + + min: number + + range: boolean + + step: number | null + + tipFormatter: Function | null + + value: number | number[] + + vertical: boolean + + static afterChange(value: number): void + + static change(value: number): void + + blur(): void + + focus(): void +} diff --git a/types/spin.d.ts b/types/spin.d.ts new file mode 100644 index 0000000000..a40ab3de99 --- /dev/null +++ b/types/spin.d.ts @@ -0,0 +1,19 @@ +import { VNode, CreateElement } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ASpin Layout Component */ +export declare class ASpin extends AntdVueComponent { + delay: number + + indicator: VNode + + size: AntdVueComponentSize + + spinning: boolean + + tip: string + + wrapperClassName: string + + static setDefaultIndicator: ({ indicator: (h: CreateElement) => VNode }) +} diff --git a/types/step.d.ts b/types/step.d.ts new file mode 100644 index 0000000000..a187089001 --- /dev/null +++ b/types/step.d.ts @@ -0,0 +1,15 @@ +import { VNode } from 'vue'; + +import { AntdVueComponent } from './component'; + +type Status = 'wait' | 'process' | 'finish' | 'error'; +/** ASteps Layout Component */ +export declare class AStep extends AntdVueComponent { + description: string | VNode + + icon: string | VNode + + status: Status + + title: string | VNode +} diff --git a/types/steps.d.ts b/types/steps.d.ts new file mode 100644 index 0000000000..58a923450e --- /dev/null +++ b/types/steps.d.ts @@ -0,0 +1,21 @@ +import { VNode } from 'vue'; + +import { AntdVueComponent } from './component'; + +type Status = 'wait' | 'process' | 'finish' | 'error'; +/** ASteps Layout Component */ +export declare class ASteps extends AntdVueComponent { + current: number + + direction: 'horizontal' | 'vertical' + + labelPlacement: string + + progressDot: boolean | VNode + + size: 'small' | 'default' + + status: Status + + initial: number +} diff --git a/types/switch.d.ts b/types/switch.d.ts new file mode 100644 index 0000000000..8dd83d8ce7 --- /dev/null +++ b/types/switch.d.ts @@ -0,0 +1,27 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ASwitch Layout Component */ +export declare class ASwitch extends AntdVueComponent { + autoFocus: boolean + + checked: boolean + + checkedChildren: string | VNode + + defaultChecked: boolean + + disabled: boolean + + loading: boolean + + size: AntdVueComponentSize + + unCheckedChildren: string | VNode + + static change(checked: boolean): void + + blur(): void + + focus(): void +} diff --git a/types/table.d.ts b/types/table.d.ts new file mode 100644 index 0000000000..096d488994 --- /dev/null +++ b/types/table.d.ts @@ -0,0 +1,141 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +/** ATable Layout Component */ +export declare class ATable extends AntdVueComponent { + bordered: boolean + + childrenColumnName: string[] + + columns: Array + + components: object + + dataSource: any[] + + defaultExpandAllRows: boolean + + defaultExpandedRowKeys: string[] + + expandedRowKeys: string[] + + expandedRowRender: (record: any, index: number, indent: any, expanded: any) => VNode + + expandRowByClick: boolean + + footer: (currentPageData: any) => any| VNode + + indentSize: number + + loading: boolean | object + + locale: object + + pagination: object | boolean + + rowClassName: (record: any, index: number) => string + + rowKey: (record: any) => string | string + + rowSelection: object + + scroll: { x: number | true, y: number } + + showHeader: boolean + + size: AntdVueComponentSize + + static title: (currentPageData: any) => any| VNode + + static customHeaderRow: (column: any, index: number) => any + + static customRow: (record: any, index: number) => any + + expandedRowsChange: (expandedRows: any) => void + + change: (pagination: any, filters: any, sorter: any) => void + + expand: (expanded: any, record: any) => void +} + +/** AColumn Layout Component */ +export declare class AColumn { + align: 'left' | 'right' | 'center' + + colSpan?: number + + dataIndex: string + + filterDropdown?: VNode + + filterDropdownVisible?: boolean + + filtered?: boolean + + filteredValue?: string[] + + filterIcon?: VNode + + filterMultiple?: boolean + + filters?: object[] + + fixed?: boolean | string + + key?: string + + customRender?: (text: any, record: object, index: number) => any | VNode + + sorter?: Function | boolean + + sortOrder?: boolean | string + + title?: string | VNode + + width?: string | number + + customCell?: (record: object) => any + + customHeaderCell?: (column: any) => any + + onFilter?: Function + + onFilterDropdownVisibleChange?: (visible: boolean) => any + + slots?: object + + scopedSlots?: object +} + +/** AColumn Layout Component */ +export declare class AColumnGroup extends AntdVueComponent { + title: string | VNode + + slots: object +} + +interface rowSelection { + columnWidth: string | number + + columnTitle: string | VNode + + fixed: boolean + + getCheckboxProps: (record: any) => any + + hideDefaultSelections: boolean + + selectedRowKeys: string[] + + selections: object[] | boolean + + type: 'checkbox' | 'radio' + + onChange: (selectedRowKeys: string[], selectedRows: string[]) => void + + onSelect: (record: any, selected: any, selectedRows: any, nativeEvent: any) => void + + onSelectAll: (selected: any, selectedRows: any, changeRows: any) => void + + onSelectInvert: (selectedRows: any) => void +} diff --git a/types/tabs.d.ts b/types/tabs.d.ts new file mode 100644 index 0000000000..c3976e2932 --- /dev/null +++ b/types/tabs.d.ts @@ -0,0 +1,48 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + + +type position = 'top' | 'right' | 'bottom' | 'left'; + +type Type = 'line' | 'card' | 'editable-card'; +/** ATabs Layout Component */ +export declare class ATabs extends AntdVueComponent { + activeKey: string + + animated: boolean | {inkBar:boolean, tabPane:boolean} + + defaultActiveKey: string + + hideAdd: boolean + + size: AntdVueComponentSize + + tabBarExtraContent: VNode + + tabBarStyle: object + + tabPosition: position + + type: Type + + tabBarGutter: number + + static change: (activeKey: string) => void + + static edit: (targetKey: string, action: string) => void + + static nextClick: Function + + static prevClick: Function + + static tabClick: Function +} + +/** ATabPane Layout Component */ +export declare class ATabPane extends AntdVueComponent { + forceRender: boolean + + key: string + + tab: string | VNode +} diff --git a/types/tag.d.ts b/types/tag.d.ts new file mode 100644 index 0000000000..e3688d09ec --- /dev/null +++ b/types/tag.d.ts @@ -0,0 +1,21 @@ +import { AntdVueComponent } from './component'; + +/** ATag Layout Component */ +export declare class ATag extends AntdVueComponent { + afterClose: () => void + + closable: boolean + + color: string + + visible: boolean + + static close: (e: Event) => void +} + +/** ACheckableTag Layout Component */ +export declare class ACheckableTag extends AntdVueComponent { + checked: boolean + + static change: (checked: boolean) => void +} diff --git a/types/time-picker.d.ts b/types/time-picker.d.ts new file mode 100644 index 0000000000..0b9f48d4dd --- /dev/null +++ b/types/time-picker.d.ts @@ -0,0 +1,57 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** ATimePicker Layout Component */ +export declare class ATimePicker extends AntdVueComponent { + addon: VNode + + allowEmpty: boolean + + autoFocus: boolean + + clearText: string + + defaultOpenValue: object + + defaultValue: object + + disabled: boolean + + disabledHours(): object + + disabledMinutes(selectedHour: any): object + + disabledSeconds(selectedHour: any, selectedMinute: any): any + + format: string + + getPopupContainer(trigger: VNode): void + + hideDisabledOptions: boolean + + hourStep: number + + inputReadOnly: boolean + + minuteStep: number + + open: boolean + + placeholder: string + + popupClassName: string + + secondStep: number + + use12Hours: boolean + + value: object + + change(time: object, timeString: string): void + + openChange(open: boolean): void + + blur(): void + + focus(): void +} diff --git a/types/timeline.d.ts b/types/timeline.d.ts new file mode 100644 index 0000000000..d1468a1260 --- /dev/null +++ b/types/timeline.d.ts @@ -0,0 +1,20 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** ATimeline Layout Component */ +export declare class ATimeline extends AntdVueComponent { + pending: boolean | string | VNode + + pendingDot: string | VNode + + reverse: boolean + + mode: 'left' | 'alternate' | 'right' +} + +/** ATimelineItem Layout Component */ +export declare class ATimelineItem extends AntdVueComponent { + color: string + + dot: string | VNode +} diff --git a/types/tooltip.d.ts b/types/tooltip.d.ts new file mode 100644 index 0000000000..4c41230678 --- /dev/null +++ b/types/tooltip.d.ts @@ -0,0 +1,31 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + +/** ATooltip Layout Component */ +export declare class ATooltip extends AntdVueComponent { + title: string | VNode + + arrowPointAtCenter: boolean + + autoAdjustOverflow: boolean + + defaultVisible: boolean + + getPopupContainer: (triggerNode: any) => HTMLElement + + mouseEnterDelay: number + + mouseLeaveDelay: number + + overlayClassName: string + + overlayStyle: object + + placement: string + + trigger: string + + visible: boolean + + visibleChange: (visible: boolean) => void +} diff --git a/types/transfer.d.ts b/types/transfer.d.ts new file mode 100644 index 0000000000..31c2d95181 --- /dev/null +++ b/types/transfer.d.ts @@ -0,0 +1,43 @@ +import { VNode } from 'vue'; +import { AntdVueComponent } from './component'; + + +interface Data {key: string, title: string, description?: string, disabled?: boolean} +/** ATransfer Layout Component */ +export declare class ATransfer extends AntdVueComponent { + dataSource: Data[] + + disabled: boolean + + filterOption(inputValue: any, option: any): boolean + + footer: VNode + + lazy: object | boolean + + listStyle: object + + notFoundContent: string | VNode + + operations: string[] + + render(record: any): any + + searchPlaceholder: string + + selectedKeys: string[] + + showSearch: boolean + + targetKeys: string[] + + titles: string[] + + change(targetKeys: string, direction: string, moveKeys: string[]): void + + scroll(direction: string, event: Event): void + + searchChange(direction: 'left'|'right', event: Event): void + + selectChange(sourceSelectedKeys: string[], targetSelectedKeys: string[]): void +} diff --git a/types/tree-select.d.ts b/types/tree-select.d.ts new file mode 100644 index 0000000000..5a54f72c9f --- /dev/null +++ b/types/tree-select.d.ts @@ -0,0 +1,83 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; + +export declare class TreeNode extends AntdVueComponent { + disableCheckbox: boolean + + disabled: boolean + + isLeaf: boolean + + key: string + + title: string | VNode + + value: string + + scopedSlots: object +} + +/** ATreeSelect Layout Component */ +export declare class ATreeSelect extends AntdVueComponent { + allowClear: boolean + + defaultValue: string | string[] + + disabled: boolean + + dropdownClassName: string + + dropdownMatchSelectWidth: boolean + + dropdownStyle: object + + filterTreeNode: (inputValue: string, treeNode: TreeNode) => boolean | boolean + + getPopupContainer(triggerNode: VNode): HTMLElement + + labelInValue: boolean + + loadData(node: TreeNode): any + + multiple: boolean + + placeholder: string | VNode + + searchPlaceholder: string | VNode + + showCheckedStrategy: any + + showSearch: boolean + + size: AntdVueComponentSize + + suffixIcon: VNode + + treeCheckable: boolean + + treeCheckStrictly: boolean + + treeData: Array<{value: any, label: string, children: any }> + + treeDataSimpleMode: false | Array<{ id: string, pId: string, rootPId: null }> + + treeDefaultExpandAll: boolean + + treeDefaultExpandedKeys: string[] + + treeNodeFilterProp: string + + treeNodeLabelProp: string + + value: string | string + + change(value: any, label: any, extra: any): void + + search(value: string): void + + select(value: any, node: TreeNode, extra: any): void + + blur(): void + + focus(): void +} diff --git a/types/tree.d.ts b/types/tree.d.ts new file mode 100644 index 0000000000..6254df7806 --- /dev/null +++ b/types/tree.d.ts @@ -0,0 +1,91 @@ +import { AntdVueComponent } from './component'; +import { VNode } from 'vue'; + +/** ATree Layout Component */ +export declare class ATree extends AntdVueComponent { + treeData: any + + autoExpandParent: boolean + + checkable: boolean + + checkedKeys: string[] | {checked: string[], halfChecked: string[]} + + checkStrictly: boolean + + defaultCheckedKeys: string[] + + defaultExpandAll: boolean + + defaultExpandedKeys: string[] + + defaultExpandParent: boolean + + defaultSelectedKeys: string[] + + disabled: boolean + + draggable: boolean + + expandedKeys: string[] + + filterTreeNode: (node: any) => boolean + + loadData: (node: any) => any + + multiple: boolean + + selectedKeys: string[] + + showIcon: boolean + + showLine: boolean + + check: (checkedKeys: any, + e:{checked: boolean, checkedNodes: any, node: any, event: Event}) => void + + dragEnd: (params: { event: Event, node: any }) => void + + dragEnter: (params: { event: Event, node: any, expandedKeys: any }) => void + + dragLeave: (params: { event: Event, node: any }) => void + + dragOver: (params: { event: Event, node: any }) => void + + dragStart: (params: { event: Event, node: any }) => void + + drop: (params: {event: Event, node: any, dragNode: any, dragNodesKeys: any}) => void + + expand: (expandedKeys: any, opt: {expanded: boolean, node: any}) => void + + rightClick: (params: {event: Event, node: any}) => void + + select: (selectedKeys: any, + e:{selected: boolean, selectedNodes: any, node: any, event: Event}) => void +} + +export interface TreeNode { + class: string + + style: string | object + + disableCheckbox: boolean + + disabled: boolean + + icon: VNode + + isLeaf: boolean + + key: string + + selectable: boolean + + title: string | VNode + + slots: object + + scopedSlots: object + + on: object +} diff --git a/types/upload.d.ts b/types/upload.d.ts new file mode 100644 index 0000000000..8526a38dfd --- /dev/null +++ b/types/upload.d.ts @@ -0,0 +1,44 @@ +import { AntdVueComponent } from './component'; + +/** AUpload Layout Component */ +export declare class AUpload extends AntdVueComponent { + accept: string + + action: string + + directory: boolean + + beforeUpload: (file: File, fileList: FileList) => boolean | Promise + + customRequest: Function + + data: (file: File) => any | object + + defaultFileList: object[] + + disabled: boolean + + fileList: FileList + + headers: object + + listType: string + + multiple: boolean + + name: string + + showUploadList: { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | boolean + + supportServerRender: boolean + + withCredentials: boolean + + openFileDialogOnClick: boolean + + change(): void + + preview(file: File): void + + remove(file: File): boolean | Promise +} diff --git a/types/week-picker.d.ts b/types/week-picker.d.ts new file mode 100644 index 0000000000..8cb7d9cb89 --- /dev/null +++ b/types/week-picker.d.ts @@ -0,0 +1,18 @@ +import { VNode } from 'vue'; +import { AntdVueComponent, AntdVueComponentSize } from './component'; +import { ADatePicker } from './date-picker'; +import { Moment } from 'moment'; + +/** AWeekPicker Layout Component */ +export declare class AWeekPicker extends ADatePicker { + defaultValue: Moment + + defaultPickerValue: Moment + + format: string + + value: any + + change(date: any, dateString: string): void +} + From a8aa4ebee370dde0b86fd21a46f5b7c0884ce21b Mon Sep 17 00:00:00 2001 From: cqmimi <785513452@qq.com> Date: Fri, 28 Dec 2018 14:53:42 +0800 Subject: [PATCH 2/2] feat: update typescript icon notification file --- types/icon.d.ts | 2 +- types/notification.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/icon.d.ts b/types/icon.d.ts index a1cb4f0f37..ce22f1ed6a 100644 --- a/types/icon.d.ts +++ b/types/icon.d.ts @@ -6,7 +6,7 @@ export declare class AIcon extends AntdVueComponent { style: any; - theme: 'filled' | 'outlined' | 'twoTone', + theme: 'filled' | 'outlined' | 'twoTone'; spin: boolean; diff --git a/types/notification.d.ts b/types/notification.d.ts index 596d13ac02..41dc4d4b53 100644 --- a/types/notification.d.ts +++ b/types/notification.d.ts @@ -3,7 +3,7 @@ import { AntdVueComponent } from './component'; type Placement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; /** ANotification Layout Component */ -export declare class ANotification extends AntdVueComponent { +export declare class ANotification { static success: (params: Params) => void static error: (params: Params) => void