From 0e499ee908b431f04b85b09701a401063f95c83c Mon Sep 17 00:00:00 2001 From: Akshay Jat Date: Tue, 1 Jan 2019 09:43:51 +0530 Subject: [PATCH] feat: typescript support (#359) * feat: typescript support Added typing files for better support in Typescript * feat: typescript support Adding declare keywords left in last commit * feat: typescript support Added support to add Ant Design globally (Vue.use(Antd)) * feat: typescript support Fix wrong import file * fix: typescript support changed aobject[] to object[] * feat: typescript support Removed Library version from comments & corrected few incorrect types * fix: typescript support Tree : xxxKeys should support number[] * fix: typescript support table: updated return type for customXXX * fix: typescript support Fix spelling mistake (plcement => placement) --- package.json | 1 + types/affix.d.ts | 27 +++ types/alert.d.ts | 64 +++++ types/anchor/anchor-link.d.ts | 19 ++ types/anchor/anchor.d.ts | 51 ++++ types/ant-design-vue.d.ts | 127 ++++++++++ types/auto-complete.d.ts | 112 +++++++++ types/avatar.d.ts | 45 ++++ types/back-top.d.ts | 21 ++ types/badge.d.ts | 65 +++++ types/breadcrumb.d.ts | 45 ++++ types/button/button-group.d.ts | 14 ++ types/button/button.d.ts | 71 ++++++ types/calendar.d.ts | 82 +++++++ types/card.d.ts | 92 +++++++ types/carousel.d.ts | 73 ++++++ types/cascader.d.ts | 202 ++++++++++++++++ types/checkbox/checkbox-group.d.ts | 35 +++ types/checkbox/checkbox.d.ts | 55 +++++ types/collapse/collapse-panel.d.ts | 40 ++++ types/collapse/collapse.d.ts | 44 ++++ types/component.d.ts | 9 + types/date-picker/common.d.ts | 89 +++++++ types/date-picker/date-picker.d.ts | 81 +++++++ types/date-picker/month-picker.d.ts | 46 ++++ types/date-picker/range-picker.d.ts | 60 +++++ types/date-picker/week-picker.d.ts | 34 +++ types/divider.d.ts | 28 +++ types/drawer.d.ts | 106 +++++++++ types/dropdown/dropdown-button.d.ts | 60 +++++ types/dropdown/dropdown.d.ts | 56 +++++ types/form/form-item.d.ts | 65 +++++ types/form/form.d.ts | 355 ++++++++++++++++++++++++++++ types/grid/col.d.ts | 78 ++++++ types/grid/row.d.ts | 43 ++++ types/icon.d.ts | 65 +++++ types/index.d.ts | 8 + types/input-number.d.ts | 85 +++++++ types/input/input-group.d.ts | 21 ++ types/input/input-search.d.ts | 14 ++ types/input/input.d.ts | 77 ++++++ types/input/textarea.d.ts | 26 ++ types/layout/layout-sider.d.ts | 79 +++++++ types/layout/layout.d.ts | 29 +++ types/list/list-item.d.ts | 24 ++ types/list/list.d.ts | 106 +++++++++ types/locale-provider.d.ts | 13 + types/menu/menu-item-group.d.ts | 20 ++ types/menu/menu-item.d.ts | 20 ++ types/menu/menu.d.ts | 113 +++++++++ types/menu/sub-menu.d.ts | 33 +++ types/message.d.ts | 84 +++++++ types/meta.d.ts | 25 ++ types/modal.d.ts | 293 +++++++++++++++++++++++ types/notification.d.ts | 125 ++++++++++ types/pagination.d.ts | 98 ++++++++ types/popconfirm.d.ts | 41 ++++ types/popover.d.ts | 19 ++ types/progress.d.ts | 91 +++++++ types/radio/radio-button.d.ts | 13 + types/radio/radio-group.d.ts | 52 ++++ types/radio/radio.d.ts | 54 +++++ types/rate.d.ts | 72 ++++++ types/select/option-group.d.ts | 19 ++ types/select/option.d.ts | 38 +++ types/select/select.d.ts | 221 +++++++++++++++++ types/skeleton.d.ts | 55 +++++ types/slider.d.ts | 115 +++++++++ types/spin.d.ts | 51 ++++ types/steps/step.d.ts | 32 +++ types/steps/steps.d.ts | 59 +++++ types/switch.d.ts | 71 ++++++ types/table/column-group.d.ts | 20 ++ types/table/column.d.ts | 186 +++++++++++++++ types/table/table.d.ts | 314 ++++++++++++++++++++++++ types/tabs/tab-pane.d.ts | 26 ++ types/tabs/tabs.d.ts | 75 ++++++ types/tag/checkable-tag.d.ts | 14 ++ types/tag/tag.d.ts | 36 +++ types/time-picker.d.ts | 177 ++++++++++++++ types/timeline/timeline-item.d.ts | 20 ++ types/timeline/timeline.d.ts | 38 +++ types/tootip/common.d.ts | 103 ++++++++ types/tootip/tooltip.d.ts | 14 ++ types/transfer.d.ts | 109 +++++++++ types/tree-node.d.ts | 101 ++++++++ types/tree-select.d.ts | 218 +++++++++++++++++ types/tree/dictionary-tree.d.ts | 15 ++ types/tree/tree.d.ts | 156 ++++++++++++ types/upload.d.ts | 138 +++++++++++ 90 files changed, 6516 insertions(+) create mode 100644 types/affix.d.ts create mode 100644 types/alert.d.ts create mode 100644 types/anchor/anchor-link.d.ts create mode 100644 types/anchor/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/button-group.d.ts create mode 100644 types/button/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/checkbox-group.d.ts create mode 100644 types/checkbox/checkbox.d.ts create mode 100644 types/collapse/collapse-panel.d.ts create mode 100644 types/collapse/collapse.d.ts create mode 100644 types/component.d.ts create mode 100644 types/date-picker/common.d.ts create mode 100644 types/date-picker/date-picker.d.ts create mode 100644 types/date-picker/month-picker.d.ts create mode 100644 types/date-picker/range-picker.d.ts create mode 100644 types/date-picker/week-picker.d.ts create mode 100644 types/divider.d.ts create mode 100644 types/drawer.d.ts create mode 100644 types/dropdown/dropdown-button.d.ts create mode 100644 types/dropdown/dropdown.d.ts create mode 100644 types/form/form-item.d.ts create mode 100644 types/form/form.d.ts create mode 100644 types/grid/col.d.ts create mode 100644 types/grid/row.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/input-group.d.ts create mode 100644 types/input/input-search.d.ts create mode 100644 types/input/input.d.ts create mode 100644 types/input/textarea.d.ts create mode 100644 types/layout/layout-sider.d.ts create mode 100644 types/layout/layout.d.ts create mode 100644 types/list/list-item.d.ts create mode 100644 types/list/list.d.ts create mode 100644 types/locale-provider.d.ts create mode 100644 types/menu/menu-item-group.d.ts create mode 100644 types/menu/menu-item.d.ts create mode 100644 types/menu/menu.d.ts create mode 100644 types/menu/sub-menu.d.ts create mode 100644 types/message.d.ts create mode 100644 types/meta.d.ts create mode 100644 types/modal.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/radio-button.d.ts create mode 100644 types/radio/radio-group.d.ts create mode 100644 types/radio/radio.d.ts create mode 100644 types/rate.d.ts create mode 100644 types/select/option-group.d.ts create mode 100644 types/select/option.d.ts create mode 100644 types/select/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/steps/step.d.ts create mode 100644 types/steps/steps.d.ts create mode 100644 types/switch.d.ts create mode 100644 types/table/column-group.d.ts create mode 100644 types/table/column.d.ts create mode 100644 types/table/table.d.ts create mode 100644 types/tabs/tab-pane.d.ts create mode 100644 types/tabs/tabs.d.ts create mode 100644 types/tag/checkable-tag.d.ts create mode 100644 types/tag/tag.d.ts create mode 100644 types/time-picker.d.ts create mode 100644 types/timeline/timeline-item.d.ts create mode 100644 types/timeline/timeline.d.ts create mode 100644 types/tootip/common.d.ts create mode 100644 types/tootip/tooltip.d.ts create mode 100644 types/transfer.d.ts create mode 100644 types/tree-node.d.ts create mode 100644 types/tree-select.d.ts create mode 100644 types/tree/dictionary-tree.d.ts create mode 100644 types/tree/tree.d.ts create mode 100644 types/upload.d.ts diff --git a/package.json b/package.json index 5c162d349d..63c537d181 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "frontend" ], "main": "dist/antd.min.js", + "typings": "types/index.d.ts", "files": [ "dist", "lib", diff --git a/types/affix.d.ts b/types/affix.d.ts new file mode 100644 index 0000000000..2bb3bdf94c --- /dev/null +++ b/types/affix.d.ts @@ -0,0 +1,27 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Affix extends AntdComponent { + /** + * Pixels to offset from top when calculating position of scroll + * @default 0 + * @type number + */ + offsetTop: number; + + /** + * Pixels to offset from bottom when calculating position of scroll + * @type number + */ + offsetBottom: number; + + /** + * specifies the scrollable area dom node + * @default () => window + * @type Function + */ + target: () => HTMLElement; +} diff --git a/types/alert.d.ts b/types/alert.d.ts new file mode 100644 index 0000000000..bd45c82323 --- /dev/null +++ b/types/alert.d.ts @@ -0,0 +1,64 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Alert extends AntdComponent { + /** + * Called when close animation is finished + * @type Function + */ + afterClose: () => void; + + /** + * Whether to show as banner + * @default false + * @type boolean + */ + banner: boolean; + + /** + * Whether Alert can be closed + * @type boolean + */ + closable: boolean; + + /** + * Close text to show + * @type any (string | slot) + */ + closeText: any; + + /** + * additional content of Alert + * @type any (string | slot) + */ + description: any; + + /** + * Custom icon, effective when showIcon is true + * @type any (VNode | slot) + */ + icon: any; + + /** + * Content of Alert + * @type any (string | slot) + */ + message: any; + + /** + * Whether to show icon + * @default false, in banner mode default is true + * @type boolean + */ + showIcon: boolean; + + /** + * Type of Alert styles, options: success, info, warning, error + * @default info, in banner mode default is warning + * @type string + */ + type: "success" | "info" | "warning" | "error"; +} diff --git a/types/anchor/anchor-link.d.ts b/types/anchor/anchor-link.d.ts new file mode 100644 index 0000000000..e33f96d2e2 --- /dev/null +++ b/types/anchor/anchor-link.d.ts @@ -0,0 +1,19 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class AnchorLink extends AntdComponent { + /** + * target of hyperlink + * @type string + */ + href: string; + + /** + * content of hyperlink + * @type any (string | slot) + */ + title: any; +} diff --git a/types/anchor/anchor.d.ts b/types/anchor/anchor.d.ts new file mode 100644 index 0000000000..61a574a9a9 --- /dev/null +++ b/types/anchor/anchor.d.ts @@ -0,0 +1,51 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from '../component'; +import { AnchorLink } from "./anchor-link"; + +export declare class Anchor extends AntdComponent { + static Link: AnchorLink; + + /** + * Fixed mode of Anchor + * @default true + * @type boolean + */ + affix: boolean; + + /** + * Bounding distance of anchor area + * @default 5 + * @type number + */ + bounds: number; + + /** + * Scrolling container + * @default () => window + * @type Function + */ + getContainer: () => HTMLElement; + + /** + * Pixels to offset from bottom when calculating position of scroll + * @type number + */ + offsetBottom: number; + + /** + * Pixels to offset from top when calculating position of scroll + * @default 0 + * @type number + */ + offsetTop: number; + + /** + * Whether show ink-balls in Fixed mode + * @default false + * @type boolean + */ + showInkInFixed: boolean; +} diff --git a/types/ant-design-vue.d.ts b/types/ant-design-vue.d.ts new file mode 100644 index 0000000000..205a2e649e --- /dev/null +++ b/types/ant-design-vue.d.ts @@ -0,0 +1,127 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import Vue from "vue"; + +import { Affix } from "./affix"; +import { Anchor } from "./anchor/anchor"; +import { AutoComplete } from "./auto-complete"; +import { Alert } from "./alert"; +import { Avatar } from "./avatar"; +import { BackTop } from "./back-top"; +import { Badge } from "./badge"; +import { Breadcrumb } from "./breadcrumb"; +import { Button } from "./button/button"; +import { Calendar } from "./calendar"; +import { Card } from "./card"; +import { Collapse } from "./collapse/collapse"; +import { Carousel } from "./carousel"; +import { Cascader } from "./cascader"; +import { Checkbox } from "./checkbox/checkbox"; +import { Col } from "./grid/col"; +import { DatePicker } from "./date-picker/date-picker"; +import { Divider } from "./divider"; +import { Dropdown } from "./dropdown/dropdown"; +import { Form } from "./form/form"; +import { Icon } from "./icon"; +import { Input } from "./input/input"; +import { InputNumber } from "./input-number"; +import { Layout } from "./layout/layout"; +import { List } from "./list/list"; +import { LocaleProvider } from "./locale-provider"; +import { Message } from "./message"; +import { Menu } from "./menu/menu"; +import { Modal } from "./modal"; +import { Notification } from "./notification"; +import { Pagination } from "./pagination"; +import { Popconfirm } from "./popconfirm"; +import { Popover } from "./popover"; +import { Progress } from "./progress"; +import { Radio } from "./radio/radio"; +import { Rate } from "./rate"; +import { Row } from "./grid/row"; +import { Select } from "./select/select"; +import { Slider } from "./slider"; +import { Spin } from "./spin"; +import { Steps } from "./steps/steps"; +import { Switch } from "./switch"; +import { Table } from "./table/table"; +import { Transfer } from "./transfer"; +import { Tree } from "./tree/tree"; +import { TreeSelect } from "./tree-select"; +import { Tabs } from "./tabs/tabs"; +import { Tag } from "./tag/tag"; +import { TimePicker } from "./time-picker"; +import { Timeline } from "./timeline/timeline"; +import { Tooltip } from "./tootip/tooltip"; +import { Upload } from "./upload"; +import { Drawer } from "./drawer"; +import { Skeleton } from "./skeleton"; + +/** + * Install all ant-design-vue components into Vue. + * Please do not invoke this method directly. + * Call `Vue.use(Antd)` to install. + */ +export function install(vue: typeof Vue): void; + +declare const message: Message; +declare const notification: Notification; + +export { + Affix, + Anchor, + AutoComplete, + Alert, + Avatar, + BackTop, + Badge, + Breadcrumb, + Button, + Calendar, + Card, + Collapse, + Carousel, + Cascader, + Checkbox, + Col, + DatePicker, + Divider, + Dropdown, + Form, + Icon, + Input, + InputNumber, + Layout, + List, + LocaleProvider, + message, + Menu, + Modal, + notification, + Pagination, + Popconfirm, + Popover, + Progress, + Radio, + Rate, + Row, + Select, + Slider, + Spin, + Steps, + Switch, + Table, + Transfer, + Tree, + TreeSelect, + Tabs, + Tag, + TimePicker, + Timeline, + Tooltip, + Upload, + Drawer, + Skeleton +}; diff --git a/types/auto-complete.d.ts b/types/auto-complete.d.ts new file mode 100644 index 0000000000..ed6228848d --- /dev/null +++ b/types/auto-complete.d.ts @@ -0,0 +1,112 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare type Value = { key: string }; + +export declare type SelectValue = + | string + | number + | Value + | Array; + +export declare class AutoComplete extends AntdComponent { + /** + * Show clear button, effective in multiple mode only. + * @default false + * @type boolean + */ + allowClear: boolean; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * backfill selected item the input when using keyboard + * @default false + * @type boolean + */ + backfill: boolean; + + /** + * Data source for autocomplete + * @type slot | Array<{ value: String, text: String }> + */ + dataSource: any; + + /** + * Whether active first option by default + * @default true + * @type boolean + */ + defaultActiveFirstOption: boolean; + + /** + * Initial selected option. + * @type SelectValue + */ + defaultValue: SelectValue; + + /** + * Whether disabled select + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * If true, filter options by input, if function, filter options against it. + * The function will receive two arguments, inputValue and option, + * if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. + * @default true + * @type boolean | Function + */ + filterOption: boolean | Function; + + /** + * Which prop value of option will render as content of select. + * @default 'children' + * @type string + */ + optionLabelProp: string; + + /** + * placeholder of input + * @type string + */ + placeholder: string; + + /** + * selected option + * @type SelectValue + */ + value: SelectValue; + + /** + * Initial open state of dropdown + * @type boolean + */ + defaultOpen: boolean; + + /** + * Controlled open state of dropdown + * @type boolean + */ + open: boolean; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/avatar.d.ts b/types/avatar.d.ts new file mode 100644 index 0000000000..b9c33fe349 --- /dev/null +++ b/types/avatar.d.ts @@ -0,0 +1,45 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Avatar extends AntdComponent { + /** + * the Icon type for an icon avatar, see Icon Component + * @type string + */ + icon: string; + + /** + * the shape of avatar + * @default 'circle' + * @type string + */ + shape: "circle" | "square"; + + /** + * the size of the avatar + * @default 'default' + * @type number | string + */ + size: "small" | "large" | "default" | number; + + /** + * the address of the image for an image avatar + * @type string + */ + src: string; + + /** + * This attribute defines the alternative text describing the image + * @type string + */ + alt: string; + + /** + * handler when img load error,return false to prevent default fallback behavior + * @type + */ + loadError: () => boolean; +} diff --git a/types/back-top.d.ts b/types/back-top.d.ts new file mode 100644 index 0000000000..0236264720 --- /dev/null +++ b/types/back-top.d.ts @@ -0,0 +1,21 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class BackTop extends AntdComponent { + /** + * specifies the scrollable area dom node + * @default () => window + * @type Function + */ + target: () => HTMLElement + + /** + * the BackTop button will not show until the scroll height reaches this value + * @default 400 + * @type number + */ + visibilityHeight: number +} \ No newline at end of file diff --git a/types/badge.d.ts b/types/badge.d.ts new file mode 100644 index 0000000000..7d5ff850b1 --- /dev/null +++ b/types/badge.d.ts @@ -0,0 +1,65 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Badge extends AntdComponent { + /** + * Number to show in badge + * @type number | string + */ + count: number | string; + + /** + * to display a red dot instead of count + * @default false + * @type boolean + */ + dot: boolean; + + /** + * set offset of the badge dot, like [x, y] + * @type Array + */ + offset: Array; + + /** + * Max count to show + * @default 99 + * @type number + */ + overflowCount: number; + + /** + * Whether to show badge when count is zero + * @default false + * @type boolean + */ + showZero: boolean; + + /** + * Set Badge as a status dot + * @type string + */ + status: "success" | "processing" | "default" | "error" | "warning"; + + /** + * If status is set, text sets the display text of the status dot + * @type string + */ + text: string; + + /** + * sets the display style of the status dot + * @type + */ + numberStyle: object; + + /** + * Text to show when hovering over the badge + * @default 'count' + * @type string + */ + title: string; +} diff --git a/types/breadcrumb.d.ts b/types/breadcrumb.d.ts new file mode 100644 index 0000000000..2bc520c128 --- /dev/null +++ b/types/breadcrumb.d.ts @@ -0,0 +1,45 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; + +export interface Route { + path?: String; + breadcrumbName?: String; +} + +export declare class Breadcrumb extends AntdComponent { + /** + * The routing stack information of router + * @type Route[] + */ + routes: Route[]; + + /** + * Routing parameters + * @type object + */ + params: object; + + /** + * Custom separator + * @default '/' + * @type any (string | slot) + */ + separator: any; + + /** + * Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}" + * @type Function + */ + itemRender: ( + { + route, + params, + routes, + paths + }: { route: any; params: any; routes: any; paths: any } + ) => VNode; +} diff --git a/types/button/button-group.d.ts b/types/button/button-group.d.ts new file mode 100644 index 0000000000..eac6fcf943 --- /dev/null +++ b/types/button/button-group.d.ts @@ -0,0 +1,14 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class ButtonGroup extends AntdComponent { + /** + * can be set to small large or omitted + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; +} diff --git a/types/button/button.d.ts b/types/button/button.d.ts new file mode 100644 index 0000000000..aab76e9fee --- /dev/null +++ b/types/button/button.d.ts @@ -0,0 +1,71 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: 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 { + Group: ButtonGroup; + + /** + * can be set to primary ghost dashed danger(added in 2.7) or omitted (meaning default) + * @default 'default' + * @type string + */ + type: "primary" | "danger" | "dashed" | "ghost" | "default"; + + /** + * set the original html type of button + * @default 'button' + * @type string + */ + htmlType: "button" | "submit" | "reset" | "menu"; + + /** + * set the icon of button + * @type string + */ + icon: string; + + /** + * can be set to circle or circle-outline or omitted + * @type string + */ + shape: "circle" | "circle-outline"; + + /** + * can be set to small large or omitted + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; + + /** + * set the loading status of button + * @default false + * @type boolean | { delay: number } + */ + loading: boolean | { delay: number }; + + /** + * disabled state of button + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * make background transparent and invert text and border colors, added in 2.7 + * @default false + * @type boolean + */ + ghost: boolean; + + /** + * option to fit button width to its parent width + * @default false + * @type boolean + */ + block: boolean; +} diff --git a/types/calendar.d.ts b/types/calendar.d.ts new file mode 100644 index 0000000000..76b8ab7667 --- /dev/null +++ b/types/calendar.d.ts @@ -0,0 +1,82 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { Moment } from "moment"; + +export declare class Calendar extends AntdComponent { + /** + * Customize the display of the date cell by setting a scoped slot, + * the returned content will be appended to the cell + * @type Function + */ + dateCellRender: (date: Moment) => any; + + /** + * Customize the display of the date cell by setting a scoped slot, + * the returned content will override the cell + * @type Function + */ + dateFullCellRender: (date: Moment) => any; + + /** + * The date selected by default + * @default default date + * @type Moment + */ + defaultValue: Moment; + + /** + * Function that specifies the dates that cannot be selected + * @type Function + */ + disabledDate: (currentDate: Moment) => boolean; + + /** + * Whether to display in full-screen + * @default true + * @type boolean + */ + fullscreen: boolean; + + /** + * The calendar's locale + * @default [default] + * @type object + * @see https://github.com/vueComponent/ant-design-vue/blob/master/components/date-picker/locale/example.json + */ + locale: object; + + /** + * The display mode of the calendar + * @default 'month' + * @type string + */ + mode: "month" | "year"; + + /** + * Customize the display of the month cell by setting a scoped slot, the returned content will be appended to the cell + * @type Function + */ + monthCellRender: (date: Moment) => any; + + /** + * Customize the display of the month cell by setting a scoped slot, the returned content will override the cell + * @type Function + */ + monthFullCellRender: (date: Moment) => any; + + /** + * to set valid range + * @type [Moment, Moment] + */ + validRange: [Moment, Moment]; + + /** + * The current selected date + * @default current date + * @type Moment + */ + value: Moment; +} diff --git a/types/card.d.ts b/types/card.d.ts new file mode 100644 index 0000000000..a12147b281 --- /dev/null +++ b/types/card.d.ts @@ -0,0 +1,92 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { Meta } from "./meta"; + +export declare class Card extends AntdComponent { + static Grid: any; + static Meta: Meta; + + /** + * The action list, shows at the bottom of the Card. + * @type any (slots) + */ + actions: any; + + /** + * Current TabPane's key + * @type string + */ + activeTabKey: string; + + /** + * Inline style to apply to the card head + * @type object + */ + headStyle: object; + + /** + * Inline style to apply to the card content + * @type object + */ + bodyStyle: object; + + /** + * Toggles rendering of the border around the card + * @default true + * @type boolean + */ + bordered: boolean; + + /** + * Card cover + * @type any (slot) + */ + cover: any; + + /** + * Initial active TabPane's key, if activeTabKey is not set. + * @type string + */ + defaultActiveTabKey: string; + + /** + * Content to render in the top-right corner of the card + * @type any (string | slot) + */ + extra: any; + + /** + * Lift up when hovering card + * @default false + * @type boolean + */ + hoverable: boolean; + + /** + * Shows a loading indicator while the contents of the card are being fetched + * @default false + * @type boolean + */ + loading: boolean; + + /** + * List of TabPane's head, Custom tabs can be created with the scopedSlots property + * @type Array<{key: string, tab: any, scopedSlots: {tab: string}}> + */ + tabList: Array<{ key: string; tab: any; scopedSlots: { tab: string } }>; + + /** + * Card title + * @type any (string | slot) + */ + title: any; + + /** + * Card style type, can be set to inner or not set + * @type string + */ + type: string; +} diff --git a/types/carousel.d.ts b/types/carousel.d.ts new file mode 100644 index 0000000000..59cdb4fa5e --- /dev/null +++ b/types/carousel.d.ts @@ -0,0 +1,73 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Carousel extends AntdComponent { + /** + * Callback function called after the current index changes + * @type Function + */ + afterChange: (current: number) => any; + + /** + * Whether to scroll automatically + * @default false + * @type boolean + */ + autoplay: boolean; + + /** + * Callback function called before the current index changes + * @type Function + */ + beforeChange: (from: number, to: number) => any; + + /** + * Whether to show the dots at the bottom of the gallery + * @default true + * @type boolean + */ + dots: boolean; + + /** + * Transition interpolation function name + * @default 'linear' + * @type string + */ + easing: string; + + /** + * Transition effect + * @default 'scrollx' + * @type string + */ + effect: "scrollx" | "fade"; + + /** + * Whether to use a vertical display + * @default false + * @type boolean + */ + vertical: boolean; + + /** + * Go to slide index, if dontAnimate=true, it happens without animation + * @param slideNumber slide number to go + * @param dontAnimate animate or not + */ + goTo(slideNumber: number, dontAnimate: boolean): void; + + /** + * Next + * @description Change current slide to next slide + */ + next(): void; + + /** + * Previous + * @description Change current slide to previous slide + */ + prev(): void; +} diff --git a/types/cascader.d.ts b/types/cascader.d.ts new file mode 100644 index 0000000000..f239d95fe8 --- /dev/null +++ b/types/cascader.d.ts @@ -0,0 +1,202 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; + +export interface CascaderOptionType { + value?: string; + label?: any; + disabled?: boolean; + children?: any; + key?: string; +} + +export interface ShowSearchType { + /** + * The function will receive two arguments, inputValue and option, + * if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. + * @type Function + */ + filter?: (inputValue: any, path: any) => boolean; + + /** + * Used to render filtered options, you can use slot="showSearchRender" and slot-scope="{inputValue, path}" + * @type Function + */ + render?: ({ inputValue, path }: { inputValue: any; path: any }) => VNode; + + /** + * Used to sort filtered options. + * @type Function + */ + sort?: (a: any, b: any, inputValue: any) => any; + + /** + * Whether the width of result list equals to input's + * @type boolean + */ + matchInputWidth?: boolean; +} + +export declare class Cascader extends AntdComponent { + /** + * whether allow clear + * @default true + * @type boolean + */ + allowClear: boolean; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * change value on each selection if set to true. + * @default false + * @type boolean + */ + changeOnSelect: boolean; + + /** + * initial selected value + * @type string[] + */ + defaultValue: string[]; + + /** + * Whether disabled select + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * render function of displaying selected options, you can use slot="displayRender" and slot-scope="{labels, selectedOptions}" + * @default labels => labels.join(' / ') + * @type Function + */ + displayRender: ( + { + labels, + selectedOptions + }: { labels: string[]; selectedOptions: CascaderOptionType[] } + ) => VNode; + + /** + * expand current item when click or hover, one of 'click' 'hover' + * @default 'click' + * @type string + */ + expandTrigger: "click" | "hover"; + + /** + * custom field name for label and value and children + * @default { label: 'label', value: 'value', children: 'children' } + * @type { value: string; label: string; children?: string; } + */ + fieldNames: { + value: string; + label: string; + children?: string; + }; + + /** + * Parent Node which the selector should be rendered to. Default to body. + * When position issues happen, try to modify it into scrollable content and position it relative. + * @default () => document.body + * @type Function + */ + getPopupContainer: (triggerNode: any) => HTMLElement; + + /** + * To load option lazily, and it cannot work with showSearch + * @type Function + */ + loadData: (selectedOptions: CascaderOptionType[]) => void; + + /** + * Specify content to show when no result matches. + * @default 'Not Found' + * @type string + */ + notFoundContent: string; + + /** + * data options of cascade + * @type CascaderOptionType + */ + options: CascaderOptionType; + + /** + * input placeholder + * @default 'Please select' + * @type string + */ + placeholder: string; + + /** + * additional className of popup overlay + * @type string + */ + popupClassName: string; + + /** + * additional style of popup overlay + * @type object + */ + popupStyle: object; + + /** + * use preset popup align config from builtinPlacements:bottomLeft bottomRight topLeft topRight + * @default 'bottomLeft' + * @type string + */ + popupPlacement: "bottomLeft" | "bottomRight" | "topLeft" | "topRight"; + + /** + * set visible of cascader popup + * @type boolean + */ + popupVisible: boolean; + + /** + * Whether show search input in single mode. + * @default false + * @type boolean | ShowSearchType + */ + showSearch: boolean | ShowSearchType; + + /** + * input size, one of large default small + * @default 'default' + * @type string + */ + size: "large" | "default" | "small"; + + /** + * The custom suffix icon + * @type String | VNode | slot + */ + suffixIcon: any; + + /** + * selected value + * @type string[] + */ + value: string[]; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/checkbox/checkbox-group.d.ts b/types/checkbox/checkbox-group.d.ts new file mode 100644 index 0000000000..d5ac504b17 --- /dev/null +++ b/types/checkbox/checkbox-group.d.ts @@ -0,0 +1,35 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class CheckboxGroup extends AntdComponent { + /** + * Default selected value + * @type string[] + */ + defaultValue: string[]; + + /** + * Disable all checkboxes + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Specifies options + * @type Array + */ + options: Array< + | string + | { label: string; value: string; disabled?: boolean; onChange?: Function } + >; + + /** + * Used for setting the currently selected value. + * @type string[] + */ + value: string[]; +} diff --git a/types/checkbox/checkbox.d.ts b/types/checkbox/checkbox.d.ts new file mode 100644 index 0000000000..e211bf697c --- /dev/null +++ b/types/checkbox/checkbox.d.ts @@ -0,0 +1,55 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { CheckboxGroup } from "./checkbox-group"; + +export declare class Checkbox extends AntdComponent { + static Group: CheckboxGroup; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * Specifies whether the checkbox is selected. + * @default false + * @type boolean + */ + checked: boolean; + + /** + * Specifies the initial state: whether or not the checkbox is selected. + * @default false + * @type boolean + */ + defaultChecked: boolean; + + /** + * Disable checkbox + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * indeterminate checked state of checkbox + * @default false + * @type boolean + */ + indeterminate: boolean; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/collapse/collapse-panel.d.ts b/types/collapse/collapse-panel.d.ts new file mode 100644 index 0000000000..3088dfb1bc --- /dev/null +++ b/types/collapse/collapse-panel.d.ts @@ -0,0 +1,40 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class CollapsePanel extends AntdComponent { + /** + * If true, panel cannot be opened or closed + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Forced render of content on panel, instead of lazy rending after clicking on header + * @default false + * @type boolean + */ + forceRender: boolean; + + /** + * Title of the panel + * @type string + */ + header: string; + + /** + * Unique key identifying the panel from among its siblings + * @type string + */ + key: string; + + /** + * If false, panel will not show arrow icon + * @default true + * @type boolean + */ + showArrow: boolean; +} diff --git a/types/collapse/collapse.d.ts b/types/collapse/collapse.d.ts new file mode 100644 index 0000000000..5554885646 --- /dev/null +++ b/types/collapse/collapse.d.ts @@ -0,0 +1,44 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { CollapsePanel } from "./collapse-panel"; + +export declare class Collapse extends AntdComponent { + static Panel: CollapsePanel; + + /** + * If true, Collapse renders as Accordion + * @default false + * @type boolean + */ + accordion: boolean; + + /** + * Key of the active panel + * @default No default value. In accordion mode, it's the key of the first panel. + * @type string | string[] + */ + activeKey: string | string[]; + + /** + * Toggles rendering of the border around the collapse block + * @default true + * @type boolean + */ + bordered: boolean; + + /** + * Key of the initial active panel + * @type string + */ + defaultActiveKey: string | string[]; + + /** + * Destroy Inactive Panel + * @default false + * @type boolean + */ + destroyInactivePanel: boolean; +} diff --git a/types/component.d.ts b/types/component.d.ts new file mode 100644 index 0000000000..1e6f2c915b --- /dev/null +++ b/types/component.d.ts @@ -0,0 +1,9 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import Vue from "vue"; + +export declare class AntdComponent extends Vue { + static install(vue: typeof Vue): void; +} diff --git a/types/date-picker/common.d.ts b/types/date-picker/common.d.ts new file mode 100644 index 0000000000..fdba0e9e68 --- /dev/null +++ b/types/date-picker/common.d.ts @@ -0,0 +1,89 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Moment } from "moment"; + +export declare class DatepickerCommon extends AntdComponent { + /** + * Whether to show clear button + * @default true + * @type boolean + */ + allowClear: boolean; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * custom rendering function for date cells by setting a scoped slot + * @type any (slot="dateRender" slot-scope="current, today") + */ + dateRender: any; + + /** + * determine whether the DatePicker is disabled + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * specify the date that cannot be selected + * @type Function + */ + disabledDate: (currentDate: Moment) => boolean; + + /** + * to set the container of the floating layer, while the default is to create a div element in body + * @type Function + */ + getCalendarContainer: (trigger: any) => any; + + /** + * localization configuration + * @type any + */ + locale: any; + + /** + * open state of picker + * @type boolean + */ + open: boolean; + + /** + * placeholder of date input + * @type string | string[] + */ + placeholder: string | string[]; + + /** + * to customize the style of the popup calendar + * @type object + */ + popupStyle: object; + + /** + * to customize the className of the popup calendar + * @type string + */ + dropdownClassName: string; + + /** + * determine the size of the input box, the height of large and small, are 40px and 24px respectively, while default size is 32px + * @type string + */ + size: "large" | "small" | "default"; + + /** + * The custom suffix icon + * @type any (VNode | slot) + */ + suffixIcon: any; +} diff --git a/types/date-picker/date-picker.d.ts b/types/date-picker/date-picker.d.ts new file mode 100644 index 0000000000..4fa0586eb8 --- /dev/null +++ b/types/date-picker/date-picker.d.ts @@ -0,0 +1,81 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { DatepickerCommon } from "./common"; +import { Moment } from "moment"; +import { RangePicker } from "./range-picker"; +import { MonthPicker } from "./month-picker"; +import { WeekPicker } from "./week-picker"; + +export declare class DatePicker extends DatepickerCommon { + RangePicker: RangePicker; + MonthPicker: MonthPicker; + WeekPickerker: WeekPicker; + + /** + * Defualt Value + * @description to set default date + * @default undefined + * @type Moment + */ + defaultValue: Moment; + + /** + * Default Picker Value + * @description to set default picker date + * @default undefined + * @type Moment + */ + defaultPickerValue: Moment; + + /** + * Disabled Time + * @description to specify the time that cannot be selected + * @default undefined + * @type Function (function(date)) + */ + disabledTime: Function; + + /** + * Format + * @description to set the date format, refer to moment.js http://momentjs.com + * @default 'YYYY-MM-DD' + * @type string + */ + format: string; + + /** + * Render Extra Footer + * @description render extra footer in panel by setting a scoped slot + * @default undefined + * @type any (slot="renderExtraFooter") + */ + renderExtraFooter: any; + + /** + * Show Time + * @description to provide an additional time selection + * showTime.defaultValue to set default time of selected date - type Moment + * -- + * @default TimePicker Options + * @type object | boolean + */ + showTime: object | boolean; + + /** + * Show Today + * @description whether to show "Today" button + * @default true + * @type boolean + */ + showToday: boolean; + + /** + * Value + * @description to set date + * @default undefined + * @type Moment + */ + value: Moment; +} diff --git a/types/date-picker/month-picker.d.ts b/types/date-picker/month-picker.d.ts new file mode 100644 index 0000000000..0f84540abf --- /dev/null +++ b/types/date-picker/month-picker.d.ts @@ -0,0 +1,46 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { DatepickerCommon } from "./common"; +import { Moment } from "moment"; + +export declare class MonthPicker extends DatepickerCommon { + /** + * to set default date + * @type Moment + */ + defaultValue: Moment; + + /** + * to set default picker date + * @type Moment + */ + defaultPickerValue: Moment; + + /** + * to set the date format, refer to moment.js + * @default 'YYYY-MM' + * @type string + * @see http://momentjs.com + */ + format: string; + + /** + * Custom month cell content render method by setting a scoped slot + * @type Function (slot="monthCellContentRender", slot-scope="date, locale") + */ + monthCellContentRender: Function; + + /** + * render extra footer in panel by setting a scoped slot + * @type any (slot="renderExtraFooter") + */ + renderExtraFooter: any; + + /** + * to set date + * @type Moment + */ + value: Moment; +} diff --git a/types/date-picker/range-picker.d.ts b/types/date-picker/range-picker.d.ts new file mode 100644 index 0000000000..511fc58a82 --- /dev/null +++ b/types/date-picker/range-picker.d.ts @@ -0,0 +1,60 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { DatepickerCommon } from "./common"; +import { Moment } from "moment"; + +export declare class RangePicker extends DatepickerCommon { + /** + * to set default date + * @type [Moment, Moment] + */ + defaultValue: [Moment, Moment]; + + /** + * to set default picker date + * @type [Moment, Moment] + */ + defaultPickerValue: [Moment, Moment]; + + /** + * to specify the time that cannot be selected + * @type Function + */ + disabledTime: (dates: [Moment, Moment], partial: "start" | "end") => any; + + /** + * to set the date format, refer to moment.js + * @default 'YYYY-MM-DD HH:mm:ss' + * @type string + * @see http://momentjs.com + */ + format: string; + + /** + * preseted ranges for quick selection + * @type object + */ + ranges: { [range: string]: Moment[] } | { [range: string]: () => Moment[] }; + + /** + * render extra footer in panel by setting a scoped slot + * @type any (slot="renderExtraFooter") + */ + renderExtraFooter: any; + + /** + * to provide an additional time selection + * showTime.defaultValue to set default time of selected date - type Moment[] + * @default TimePicker Options + * @type object | boolean + */ + showTime: object | boolean; + + /** + * to set date + * @type [Moment, Moment] + */ + value: [Moment, Moment]; +} diff --git a/types/date-picker/week-picker.d.ts b/types/date-picker/week-picker.d.ts new file mode 100644 index 0000000000..3695ad5442 --- /dev/null +++ b/types/date-picker/week-picker.d.ts @@ -0,0 +1,34 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { DatepickerCommon } from "./common"; +import { Moment } from "moment"; + +export declare class WeekPicker extends DatepickerCommon { + /** + * to set default date + * @type Moment + */ + defaultValue: Moment; + + /** + * to set default picker date + * @type Moment + */ + defaultPickerValue: Moment; + + /** + * to set the date format, refer to moment.js + * @default 'YYYY-wos' + * @type string + * @see http://momentjs.com + */ + format: string; + + /** + * to set date + * @type Moment + */ + value: Moment; +} diff --git a/types/divider.d.ts b/types/divider.d.ts new file mode 100644 index 0000000000..e79c98cfb1 --- /dev/null +++ b/types/divider.d.ts @@ -0,0 +1,28 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Divider extends AntdComponent { + /** + * whether line is dashed + * @default false + * @type boolean + */ + dashed: boolean; + + /** + * position of title inside divider + * @default 'center' + * @type string + */ + orientation: "left" | "right" | "center"; + + /** + * direction type of divider + * @default 'horizontal' + * @type string + */ + type: "horizontal" | "vertical"; +} diff --git a/types/drawer.d.ts b/types/drawer.d.ts new file mode 100644 index 0000000000..f752ed2a1c --- /dev/null +++ b/types/drawer.d.ts @@ -0,0 +1,106 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Drawer extends AntdComponent { + /** + * Whether a close (x) button is visible on top right of the Drawer dialog or not. + * @default true + * @type boolean + */ + closable: boolean; + + /** + * Whether to unmount child components on closing drawer or not. + * @default false + * @type boolean + */ + destroyOnClose: boolean; + + /** + * Return the mounted node for Drawer. + * @default 'body' + * @type any + */ + getContainer: any; + + /** + * Whether to show mask or not. + * @default true + * @type boolean + */ + mask: boolean; + + /** + * Clicking on the mask (area outside the Drawer) to close the Drawer or not. + * @default true + * @type boolean + */ + maskClosable: boolean; + + /** + * Style for Drawer's mask element. + * @default {} + * @type object + */ + maskStyle: object; + + /** + * The title for Drawer. + * @type any (string | slot) + */ + title: any; + + /** + * Whether the Drawer dialog is visible or not. + * @default false + * @type boolean + */ + visible: boolean; + + /** + * The class name of the container of the Drawer dialog. + * @type string + */ + wrapClassName: string; + + /** + * Width of the Drawer dialog. + * @default 256 + * @type string | number + */ + width: string | number; + + /** + * placement is top or bottom, height of the Drawer dialog. + * @type string | number + */ + height: string | number; + + /** + * The class name of the container of the Drawer dialog. + * @type string + */ + className: string; + + /** + * The z-index of the Drawer. + * @default 1000 + * @type number + */ + zIndex: number; + + /** + * The placement of the Drawer. + * @default 'right' + * @type string + */ + placement: "top" | "right" | "bottom" | "left"; + + /** + * Specify a callback that will be called when a user clicks mask, close button or Cancel button. + */ + close(): void; +} diff --git a/types/dropdown/dropdown-button.d.ts b/types/dropdown/dropdown-button.d.ts new file mode 100644 index 0000000000..0515bd4768 --- /dev/null +++ b/types/dropdown/dropdown-button.d.ts @@ -0,0 +1,60 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Menu } from "../menu/menu"; + +export declare class DropdownButton extends AntdComponent { + /** + * whether the dropdown menu is disabled + * @type boolean + */ + disabled: boolean; + + /** + * the dropdown menu + * @type Menu + */ + overlay: Menu; + + /** + * placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight + * @default 'bottomLeft' + * @type string + */ + placement: + | "topLeft" + | "topCenter" + | "topRight" + | "bottomLeft" + | "bottomCenter" + | "bottomRight"; + + /** + * size of the button, the same as Button + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; + + /** + * the trigger mode which executes the drop-down action + * @default ['hover'] + * @type string[] + */ + trigger: Array<"click" | "hover" | "contextmenu">; + + /** + * type of the button, the same as Button + * @default 'default' + * @type string + */ + type: "primary" | "danger" | "dashed" | "ghost" | "default"; + + /** + * whether the dropdown menu is visible + * @type boolean + */ + visible: boolean; +} diff --git a/types/dropdown/dropdown.d.ts b/types/dropdown/dropdown.d.ts new file mode 100644 index 0000000000..db7c4a1fbe --- /dev/null +++ b/types/dropdown/dropdown.d.ts @@ -0,0 +1,56 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Menu } from "../menu/menu"; +import { DropdownButton } from "./dropdown-button"; + +export declare class Dropdown extends AntdComponent { + static Button: DropdownButton; + + /** + * the trigger mode which executes the drop-down action + * @default ['hover'] + * @type string[] + */ + trigger: Array<"click" | "hover" | "contextmenu">; + + /** + * the dropdown menu + * @type Menu + */ + overlay: Menu; + + /** + * whether the dropdown menu is visible + * @type boolean + */ + visible: boolean; + + /** + * whether the dropdown menu is disabled + * @type boolean + */ + disabled: boolean; + + /** + * to set the ontainer of the dropdown menu. The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition. + * @default () => document.body + * @type Function + */ + getPopupContainer: (triggerNode?: any) => HTMLElement; + + /** + * placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight + * @default 'bottomLeft' + * @type string + */ + placement: + | "topLeft" + | "topCenter" + | "topRight" + | "bottomLeft" + | "bottomCenter" + | "bottomRight"; +} diff --git a/types/form/form-item.d.ts b/types/form/form-item.d.ts new file mode 100644 index 0000000000..8ec6cdfe65 --- /dev/null +++ b/types/form/form-item.d.ts @@ -0,0 +1,65 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Col } from "../grid/col"; + +export declare class FormItem extends AntdComponent { + /** + * Used with label, whether to display : after label text. + * @default true + * @type boolean + */ + colon: boolean; + + /** + * The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time. + * @type any (string | slot) + */ + extra: any; + + /** + * Used with validateStatus, this option specifies the validation status icon. Recommended to be used only with Input. + * @default false + * @type boolean + */ + hasFeedback: boolean; + + /** + * The prompt message. If not provided, the prompt message will be generated by the validation rule. + * @type any (string | slot) + */ + help: any; + + /** + * Label test + * @type any (string | slot) + */ + label: any; + + /** + * The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with + * @type Col + */ + labelCol: Col; + + /** + * Whether provided or not, it will be generated by the validation rule. + * @default false + * @type boolean + */ + required: boolean; + + /** + * The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating' + * @type string + */ + validateStatus: "" | "success" | "warning" | "error" | "validating"; + + /** + * The layout for input controls, same as labelCol + * @type Col + */ + wrapperCol: Col; +} diff --git a/types/form/form.d.ts b/types/form/form.d.ts new file mode 100644 index 0000000000..87f56178e3 --- /dev/null +++ b/types/form/form.d.ts @@ -0,0 +1,355 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import Vue from "vue"; +import { FormItem } from "./form-item"; + +export interface Field { + [fieldName: string]: { + value: any; + errors?: Array; + }; +} + +export interface FieldValue { + [fieldName: string]: any; +} + +export interface ValidateFieldOptions { + /** + * If true, every field will stop validation at first failed rule + * @default false + * @type boolean + */ + first?: boolean; + + /** + * Those fields will stop validation at first failed rule + * @type string[] + */ + firstFields?: string[]; + + /** + * Should validate validated field again when validateTrigger is been triggered again + * @default false + * @type boolean + */ + force?: boolean; + + /** + * Config scroll behavior of validateFieldsAndScroll + * @type object + */ + scroll?: object; +} + +declare interface ValidationRule { + /** + * validation error message + * @type string + */ + message?: string; + + /** + * built-in validation type, available options: https://github.com/yiminghe/async-validator#type + * @default 'string' + * @type string + */ + type?: string; + + /** + * indicates whether field is required + * @default false + * @type boolean + */ + required?: boolean; + + /** + * treat required fields that only contain whitespace as errors + * @default false + * @type boolean + */ + whitespace?: boolean; + + /** + * validate the exact length of a field + * @type number + */ + len?: number; + + /** + * validate the min length of a field + * @type number + */ + min?: number; + + /** + * validate the max length of a field + * @type number + */ + max?: number; + + /** + * validate the value from a list of possible values + * @type string | string[] + */ + enum?: string | string[]; + + /** + * validate from a regular expression + * @type boolean + */ + pattern?: RegExp; + + /** + * transform a value before validation + * @type Function + */ + transform?: (value: any) => any; + + /** + * custom validate function (Note: callback must be called) + * @type Function + */ + validator?: (rule: any, value: any, callback: Function) => any; +} + +declare interface FieldDecoratorOptions { + /** + * Specify how to get value from event or other onChange arguments + * @type Function + */ + getValueFromEvent?: (...args: any[]) => any; + + /** + * Get the component props according to field value. + * @type Function + */ + getValueProps?: (value: any) => any; + + /** + * You can specify initial value, type, optional value of children node. + * (Note: Because Form will test equality with === internally, we recommend to use variable as initialValue, instead of literal) + * @default n/a + * @type any + */ + initialValue?: any; + + /** + * Normalize value to form component + * @type Function + */ + normalize?: (value: any, prevValue: any, allValues: any) => any; + + /** + * Includes validation rules. Please refer to "Validation Rules" part for details. + * @default n/a + * @type ValidationRule[] + */ + rules?: ValidationRule[]; + + /** + * When to collect the value of children node + * @default 'change' + * @type string + */ + trigger?: string; + + /** + * Whether stop validate on first rule of error for this field. + * @default false + * @type boolean + */ + validateFirst?: boolean; + + /** + * When to validate the value of children node. + * @default 'change' + * @type string | string[] + */ + validateTrigger?: string | string[]; + + /** + * Props of children node, for example, the prop of Switch is 'checked'. + * @default 'value' + * @type string + */ + valuePropName?: string; +} + +export interface WrappedFormUtils { + /** + * Two-way binding for form, single file template can be bound using the directive v-decorator. + * @type Function + */ + getFieldDecorator(id: string, options: FieldDecoratorOptions); + + /** + * Get the error of a field. + * @type Function (Function(name)) + */ + getFieldError(name: string); + + /** + * Get the specified fields' error. If you don't specify a parameter, you will get all fields' error. + * @type Function (Function([names: string[])) + */ + getFieldsError(names: string[]); + + /** + * Get the specified fields' values. If you don't specify a parameter, you will get all fields' values. + * @type Funtion (Function([fieldNames: string[])) + */ + getFieldsValue(fieldNames: string[]); + + /** + * Get the value of a field. + * @type Function (Function(fieldName: string)) + */ + getFieldValue(fieldName: string); + + /** + * Check whether any of fields is touched by getFieldDecorator's options.trigger event + * @type Function + */ + isFieldsTouched(names?: string[]): boolean; + + /** + * Check whether a field is touched by getFieldDecorator's options.trigger event + * @type Function ((name: string) => boolean) + */ + isFieldTouched: Function; + + /** + * Check if the specified field is being validated. + * @type Function (Function(name)) + */ + isFieldValidating(name: string): boolean; + + /** + * Reset the specified fields' value(to initialValue) and status. + * If you don't specify a parameter, all the fields will be reset. + * @type Function (Function([names: string[]])) + */ + resetFields(names: string[]): void; + + /** + * Set value and error state of fields + * @type Function + */ + setFields(field: Field): void; + + /** + * Set the value of a field. + * @type Function + */ + setFieldsValue(fieldValue: FieldValue): void; + + /** + * Validate the specified fields and get theirs values and errors. + * If you don't specify the parameter of fieldNames, you will validate all fields. + * @type Function + */ + validateFields( + fieldNames: string[], + options: ValidateFieldOptions, + callback: (erros: Error[], values: any) => any + ): void; + + /** + * This function is similar to validateFields, but after validation, if the target field is not in visible area of form, + * form will be automatically scrolled to the target field area. + * @type Function + */ + validateFieldsAndScroll( + fieldNames: string[], + options: ValidateFieldOptions, + callback: (erros: Error[], values: any) => any + ): void; +} + +export interface IformCreateOption { + /** + * Only supports the use of Form.create({})(CustomizedForm). declare props on form(like vue props) + * @type object + */ + props?: object; + + /** + * Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with Form.createFormField. + * If you use $form.createForm to create a collector, you can map any data to the Field without being bound by the parent component. + * @type Function + */ + mapPropsToFields?: Function; + + /** + * Default validate message. And its format is similar with newMessages's returned value + * @type any + */ + validateMessages?: any; + + /** + * Specify a function that will be called when the value a Form.Item gets changed. + * Usage example: saving the field's value to Redux store. + * @type Function (Function(props, fields)) + */ + onFieldsChange?: (props: any, fields: any) => any; + + /** + * A handler while value of any field is changed + * @type Function + */ + onValuesChange?: (props: any, fields: any) => void; +} + +export declare class Form extends AntdComponent { + static Item: FormItem; + static create: (options: IformCreateOption) => (WrapedComponent: any) => any; + + /** + * Decorated by Form.create() will be automatically set this.form property, so just pass to form. + * If you use the template syntax, you can use this.$form.createForm(this, options) + * @default n/a + * @type WrappedFormUtils + */ + form: WrappedFormUtils; + + /** + * Hide required mark of all form items + * @default false + * @type boolean + */ + hideRequiredMark: boolean; + + /** + * Define form layout + * @default 'horizontal' + * @type string + */ + layout: "horizontal" | "inline" | "vertical"; + + /** + * Automate Form.create, Recommended for use under the template component, and cannot be used with Form.create(). + * You should use $form.createForm to instead it after 1.1.9. + * @type Function + * @deprecated after 1.1.9 + */ + autoFormCreate: (form: any) => any; + + /** + * The options corresponding to Form.create(options). You should use $form.createForm to instead it after 1.1.9. + * @type object + * @deprecated after 1.1.9 + */ + options: object; + + createForm(context: Vue, options?: IformCreateOption): any; +} + +declare module "vue/types/vue" { + interface Vue { + $form: Form; + } +} diff --git a/types/grid/col.d.ts b/types/grid/col.d.ts new file mode 100644 index 0000000000..9bd948f93e --- /dev/null +++ b/types/grid/col.d.ts @@ -0,0 +1,78 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class Col extends AntdComponent { + /** + * raster number of cells to occupy, 0 corresponds to display: none + * @default none (0) + * @type number + */ + span: number; + + /** + * raster order, used in flex layout mode + * @default 0 + * @type number + */ + order: number; + + /** + * the number of cells to offset Col from the left + * @default 0 + * @type number + */ + offset: number; + + /** + * the number of cells that raster is moved to the right + * @default 0 + * @type number + */ + push: number; + + /** + * the number of cells that raster is moved to the left + * @default 0 + * @type number + */ + pull: number; + + /** + * <576px and also default setting, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + xs: { span: number; offset: number } | number; + + /** + * ≥576px, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + sm: { span: number; offset: number } | number; + + /** + * ≥768px, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + md: { span: number; offset: number } | number; + + /** + * ≥992px, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + lg: { span: number; offset: number } | number; + + /** + * ≥1200px, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + xl: { span: number; offset: number } | number; + + /** + * ≥1600px, could be a span value or an object containing above props + * @type { span: number, offset: number } | number + */ + xxl: { span: number; offset: number } | number; +} diff --git a/types/grid/row.d.ts b/types/grid/row.d.ts new file mode 100644 index 0000000000..91f0b8eca2 --- /dev/null +++ b/types/grid/row.d.ts @@ -0,0 +1,43 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class Row extends AntdComponent { + /** + * spacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24} + * @default 0 + * @type numner | object + */ + gutter: + | number + | { + xs: number; + sm: number; + md: number; + lg: number; + xl: number; + xxl: number; + }; + + /** + * layout mode, optional flex + * @type string + */ + type: string; + + /** + * the vertical alignment of the flex layout: top middle bottom + * @default 'top' + * @type string + */ + align: "top" | "middle" | "bottom"; + + /** + * horizontal arrangement of the flex layout: start end center space-around space-between + * @default 'start' + * @type string + */ + justify: "start" | "end" | "center" | "space-around" | "space-between"; +} diff --git a/types/icon.d.ts b/types/icon.d.ts new file mode 100644 index 0000000000..25cf1d8178 --- /dev/null +++ b/types/icon.d.ts @@ -0,0 +1,65 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { Component } from 'vue/types/options'; + +export interface IconOptions { + /** + * The URL generated by iconfont.cn project. + * @type string + */ + scriptUrl: string; + + /** + * Define extra properties to the component + * @default {} + * @type object + */ + extraCommonProps?: { [key: string]: any }; +} + +export declare class Icon extends AntdComponent { + static getTwoToneColor(): string; + static setTwoToneColor(colorString: string): void; + static createFromIconfontCN(iconOptions: IconOptions): Icon; + + /** + * Type of the ant design icon + * @type string + */ + type: string; + + /** + * Style properties of icon, like fontSize and color + * @type string + */ + style: string; + + /** + * The component used for the root node. This will override the type property. + * @type Component + */ + component: Component; + + /** + * Rotate icon with animation + * @default false + * @type boolean + */ + spin: boolean; + + /** + * Theme of the ant design icon + * @default 'outlined' + * @type string + */ + theme: "filled" | "outlined" | "twoTone"; + + /** + * Only support the two-tone icon. Specific the primary color. + * @type string + */ + twoToneColor: string; +} diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000000..728165f0d6 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,8 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +export * from "./ant-design-vue"; + +import * as Antd from "./ant-design-vue"; +export default Antd; diff --git a/types/input-number.d.ts b/types/input-number.d.ts new file mode 100644 index 0000000000..a9fe991cce --- /dev/null +++ b/types/input-number.d.ts @@ -0,0 +1,85 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class InputNumber extends AntdComponent { + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * initial value + * @type number | string + */ + defaultValue: number | string; + + /** + * disable the input + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Specifies the format of the value presented + * @type Function + */ + formatter: (value: number | string) => string; + + /** + * max value + * @default Infinity + * @type number + */ + max: number; + + /** + * mix value + * @default Infinity + * @type number + */ + min: number; + + /** + * Specifies the value extracted from formatter + * @type Function + */ + parser: (string: string) => number; + + /** + * precision of input value + * @type number + */ + precision: number; + + /** + * decimal separator + * @type string + */ + decimalSeparator: string; + + /** + * width of input box + * @default 'default' + * @type string + */ + size: "large" | "small" | "default"; + + /** + * The number to which the current value is increased or decreased. It can be an integer or decimal. + * @default 1 + * @type number | string + */ + step: number | string; + + /** + * current value + * @type number | string + */ + value: number | string; +} diff --git a/types/input/input-group.d.ts b/types/input/input-group.d.ts new file mode 100644 index 0000000000..3bddb6e0c1 --- /dev/null +++ b/types/input/input-group.d.ts @@ -0,0 +1,21 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class InputGroup extends AntdComponent { + /** + * Whether use compact style + * @default false + * @type boolean + */ + compact: boolean; + + /** + * The size of Input.Group specifies the size of the included Input fields. Available: large default small + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; +} diff --git a/types/input/input-search.d.ts b/types/input/input-search.d.ts new file mode 100644 index 0000000000..cea7d4f6bf --- /dev/null +++ b/types/input/input-search.d.ts @@ -0,0 +1,14 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class InputSearch extends AntdComponent { + /** + * to show an enter button after input + * @default false + * @type any (boolean | slot) + */ + enterButton: any; +} diff --git a/types/input/input.d.ts b/types/input/input.d.ts new file mode 100644 index 0000000000..2ba7802e4d --- /dev/null +++ b/types/input/input.d.ts @@ -0,0 +1,77 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { InputGroup } from "./input-group"; +import { InputSearch } from "./input-search"; +import { TextArea } from "./textarea"; + +export declare class Input extends AntdComponent { + static Group: InputGroup; + static Search: InputSearch; + static TextArea: TextArea; + + /** + * The label text displayed after (on the right side of) the input field. + * @type any (string | slot) + */ + addonAfter: any; + + /** + * The label text displayed before (on the left side of) the input field. + * @type any (string | slot) + */ + addonBefore: any; + + /** + * The initial input content + * @type string | number + */ + defaultValue: string | number; + + /** + * Whether the input is disabled. + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * The ID for input + * @type string + */ + id: string; + + /** + * The prefix icon for the Input. + * @type any (string | slot) + */ + prefix: any; + + /** + * The size of the input box. Note: in the context of a form, the large size is used. Available: large default small + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; + + /** + * The suffix icon for the Input. + * @type any (string | slot) + */ + suffix: any; + + /** + * The type of input, see: MDN (use Input.TextArea instead of type="textarea") + * @default 'text' + * @type string + */ + type: string; + + /** + * The input content value + * @type string | number + */ + value: string | number; +} diff --git a/types/input/textarea.d.ts b/types/input/textarea.d.ts new file mode 100644 index 0000000000..b02b12311a --- /dev/null +++ b/types/input/textarea.d.ts @@ -0,0 +1,26 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class TextArea extends AntdComponent { + /** + * Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 } + * @default false + * @type boolean | object + */ + autosize: boolean | { minRows: number; maxRows: number }; + + /** + * The initial input content + * @type string | number + */ + defaultValue: string | number; + + /** + * The input content value + * @type string | number + */ + value: string | number; +} diff --git a/types/layout/layout-sider.d.ts b/types/layout/layout-sider.d.ts new file mode 100644 index 0000000000..d35e00a711 --- /dev/null +++ b/types/layout/layout-sider.d.ts @@ -0,0 +1,79 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class LayoutSider extends AntdComponent { + /** + * container className + * @type string + */ + class: string; + + /** + * whether can be collapsed + * @default false + * @type boolean + */ + collapsible: boolean; + + /** + * to set the current status + * @type boolean + */ + collapsed: boolean; + + /** + * to set the initial status + * @default false + * @type boolean + */ + defaultCollapsed: boolean; + + /** + * reverse direction of arrow, for a sider that expands from the right + * @default false + * @type boolean + */ + reverseArrow: boolean; + + /** + * to customize the styles + * @type object | string + */ + style: object | string; + + /** + * specify the customized trigger, set to null to hide the trigger + * @type string | slot + */ + trigger: any; + + /** + * width of the sidebar + * @default 200 + * @type number | string + */ + width: number | string; + + /** + * width of the collapsed sidebar, by setting to 0 a special trigger will appear + * @default 64 + * @type number + */ + collapsedWidth: number; + + /** + * breakpoints of the responsive layout + * @type string + */ + breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "xxl"; + + /** + * color theme of the sidebar + * @default 'dark' + * @type string + */ + theme: "light" | "dark"; +} diff --git a/types/layout/layout.d.ts b/types/layout/layout.d.ts new file mode 100644 index 0000000000..0946ed805b --- /dev/null +++ b/types/layout/layout.d.ts @@ -0,0 +1,29 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { LayoutSider } from "./layout-sider"; + +export declare class Layout extends AntdComponent { + static Sider: LayoutSider; + + /** + * container className + * @default undefined + * @type string + */ + class: string; + + /** + * to customize the styles + * @type string | object + */ + style: string | object; + + /** + * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering + * @type boolean + */ + hasSider: boolean; +} diff --git a/types/list/list-item.d.ts b/types/list/list-item.d.ts new file mode 100644 index 0000000000..b5426ea597 --- /dev/null +++ b/types/list/list-item.d.ts @@ -0,0 +1,24 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Meta } from "../meta"; + +export declare class ListItem extends AntdComponent { + static Meta: Meta; + + /** + * The actions content of list item. If itemLayout is vertical, shows the content on bottom, + * otherwise shows content on the far right. + * @type any (VNode[] | slot) + */ + actions: any; + + /** + * The extra content of list item. If itemLayout is vertical, shows the content on right, + * otherwise shows content on the far right. + * @type any (string | slot) + */ + extra: any; +} diff --git a/types/list/list.d.ts b/types/list/list.d.ts new file mode 100644 index 0000000000..98a4246cbc --- /dev/null +++ b/types/list/list.d.ts @@ -0,0 +1,106 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { VNode } from "vue"; +import { Pagination } from "../pagination"; +import { ListItem } from "./list-item"; + +export declare type ColumnCount = "" | 1 | 2 | 3 | 4 | 6 | 8 | 12 | 24; + +export declare class PaginationConfig extends Pagination { + position: "top" | "bottom" | "both"; +} + +export class List extends AntdComponent { + static Item: ListItem; + + /** + * Toggles rendering of the border around the list + * @default false + * @type boolean + */ + bordered: boolean; + + /** + * List footer renderer + * @type any (string | slot) + */ + footer: any; + + /** + * The grid type of list. You can set grid to something like {gutter: 16, column: 4} + * @type object + */ + grid: { + gutter: number; + column: ColumnCount; + xs: ColumnCount; + sm: ColumnCount; + md: ColumnCount; + lg: ColumnCount; + xl: ColumnCount; + xxl: ColumnCount; + }; + + /** + * List header renderer + * @type any (string | slot) + */ + header: any; + + /** + * The layout of list, default is horizontal, If a vertical list is desired, set the itemLayout property to vertical + * @type string + */ + itemLayout: string; + + /** + * Shows a loading indicator while the contents of the list are being fetched + * @default false + * @type boolean | object + */ + loading: boolean | object; + + /** + * Shows a load more content + * @type any (string | slot) + */ + loadMore: any; + + /** + * i18n text including empty text + * @default emptyText: 'No Data' + * @type object + */ + locale: object; + + /** + * Pagination config, hide it by setting it to false + * @default false + * @type boolean | object + */ + pagination: boolean | PaginationConfig; + + /** + * Toggles rendering of the split under the list item + * @default true + * @type boolean + */ + split: boolean; + + /** + * Custom item renderer, slot="renderItem" and slot-scope="item, index" + * @default null + * @type Function + */ + renderItem: (item: any, index: number) => VNode; + + /** + * Specify the key that will be used for uniquely identify each element + * @default null + * @type Function + */ + rowKey: (item: any) => string | number; +} diff --git a/types/locale-provider.d.ts b/types/locale-provider.d.ts new file mode 100644 index 0000000000..0a09719b41 --- /dev/null +++ b/types/locale-provider.d.ts @@ -0,0 +1,13 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class LocaleProvider extends AntdComponent { + /** + * language package setting, you can find the packages in this path: antd/lib/locale-provider/ + * @type object + */ + locale: object; +} diff --git a/types/menu/menu-item-group.d.ts b/types/menu/menu-item-group.d.ts new file mode 100644 index 0000000000..f28a9c53e0 --- /dev/null +++ b/types/menu/menu-item-group.d.ts @@ -0,0 +1,20 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { MenuItem } from "./menu-item"; + +export declare class MenuItemGroup extends AntdComponent { + /** + * sub menu items + * @type MenuItem[] + */ + children: MenuItem[]; + + /** + * title of the group + * @type string | slot + */ + title: any; +} diff --git a/types/menu/menu-item.d.ts b/types/menu/menu-item.d.ts new file mode 100644 index 0000000000..ab9486b52d --- /dev/null +++ b/types/menu/menu-item.d.ts @@ -0,0 +1,20 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class MenuItem extends AntdComponent { + /** + * unique id of the menu item + * @type string + */ + key: string; + + /** + * whether menu item is disabled or not + * @default false + * @type boolean + */ + disabled: boolean; +} diff --git a/types/menu/menu.d.ts b/types/menu/menu.d.ts new file mode 100644 index 0000000000..3d471a4207 --- /dev/null +++ b/types/menu/menu.d.ts @@ -0,0 +1,113 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { MenuItem } from "./menu-item"; +import { SubMenu } from "./sub-menu"; +import { MenuItemGroup } from "./menu-item-group"; +import { Divider } from "../divider"; + +export declare class Menu extends AntdComponent { + static Item: MenuItem; + static SubMenu: SubMenu; + static ItemGroup: MenuItemGroup; + static Divider: Divider; + + /** + * Allow selection of multiple items + * @default false + * @type boolean + */ + multiple: boolean; + + /** + * array with the keys of currently selected menu items + * @type string[] + */ + selectedKeys: string[]; + + /** + * array with the keys of default selected menu items + * @type string[] + */ + defaultSelectedKeys: string[]; + + /** + * array with the keys of default opened sub menus + * @type any + */ + defaultOpenKeys: any; + + /** + * array with the keys of currently opened sub menus + * @type string[] + */ + openKeys: string[]; + + /** + * type of the menu; vertical, horizontal, and inline modes are supported + * @default 'vertical' + * @type string + */ + mode: + | "horizontal" + | "vertical" + | "vertical-left" + | "vertical-right" + | "inline"; + + /** + * delay time to show submenu when mouse enter, unit: second + * @default 0 + * @type number + */ + subMenuOpenDelay: number; + + /** + * delay time to hide submenu when mouse leave, unit: second + * @default 0.1 + * @type number + */ + subMenuCloseDelay: Number; + + /** + * indent px of inline menu item on each level + * @default 24 + * @type number + */ + inlineIndent: number; + + /** + * style of the root node + * @type object + */ + style: object; + + /** + * color theme of the menu + * @default 'light' + * @type string + */ + theme: "light" | "dark"; + + /** + * render submenu into DOM before it shows + * @default false + * @type boolean + */ + forceSubMenuRender: boolean; + + /** + * allow selecting menu items + * @default true + * @type boolean + */ + selectable: boolean; + + /** + * specifies the collapsed status when menu is inline mode + * @type boolean + */ + inlineCollapsed: boolean; +} diff --git a/types/menu/sub-menu.d.ts b/types/menu/sub-menu.d.ts new file mode 100644 index 0000000000..b0995b9d1a --- /dev/null +++ b/types/menu/sub-menu.d.ts @@ -0,0 +1,33 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { MenuItem } from "./menu-item"; + +export declare class SubMenu extends AntdComponent { + /** + * unique id of the menu item + * @type string + */ + key: string; + + /** + * whether menu item is disabled or not + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * sub menus or sub menu items + * @type Array + */ + children: Array; + + /** + * title of the sub menu + * @type string | slot + */ + title: any; +} diff --git a/types/message.d.ts b/types/message.d.ts new file mode 100644 index 0000000000..b943bb28d9 --- /dev/null +++ b/types/message.d.ts @@ -0,0 +1,84 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + + +export interface MessageOptions { + /** + * content of the message + * @type any (string | VNode | (h) => VNode) + */ + content: any; + + /** + * time(seconds) before auto-dismiss, don't dismiss if set to 0 + * @default 3 + * @type number + */ + duration?: number; + + /** + * type of message + * @type string + */ + type?: "success" | "info" | "warning" | "error" | "loading"; + + /** + * Customized Icon + * @type any (string | VNode | (h) => VNode) + */ + icon?: any; + + /** + * Specify a function that will be called when the message is closed + * @type Function + */ + onClose?: () => void; +} + +export interface MessageConfigOptions { + /** + * time before auto-dismiss, in seconds + * @default 1.5 + * @type number + */ + duration?: number; + + /** + * Return the mount node for Message + * @default () => document.body + * @type Function + */ + getContainer?: () => HTMLElement; + + /** + * max message show, drop oldest if exceed limit + * @type number + */ + maxCount?: number; + + /** + * distance from top + * @default '24px' + * @type string + */ + top?: string; +} + +export declare class Message { + success(content: any, duration?: number, onClose?: () => void): Promise; + warning(content: any, duration?: number, onClose?: () => void): Promise; + warn(content: any, duration?: number, onClose?: () => void): Promise; + info(content: any, duration?: number, onClose?: () => void): Promise; + error(content: any, duration?: number, onClose?: () => void): Promise; + loading(content: any, duration?: number, onClose?: () => void): Promise; + open: (config: MessageOptions) => Promise; + config: (options: MessageConfigOptions) => void; + destroy: () => void; +} + +declare module "vue/types/vue" { + interface Vue { + $message: Message; + } +} diff --git a/types/meta.d.ts b/types/meta.d.ts new file mode 100644 index 0000000000..3a9cd9ee45 --- /dev/null +++ b/types/meta.d.ts @@ -0,0 +1,25 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Meta extends AntdComponent { + /** + * The avatar of list item + * @type any (slot) + */ + avatar: any; + + /** + * The description of list item + * @type any (string | slot) + */ + description: any; + + /** + * The title of list item + * @type any (string | slot) + */ + title: any; +} diff --git a/types/modal.d.ts b/types/modal.d.ts new file mode 100644 index 0000000000..f870e9f5a2 --- /dev/null +++ b/types/modal.d.ts @@ -0,0 +1,293 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; +import { TreeNode } from "./tree-node"; +import { Button } from "./button/button"; + +export interface ModalOptions { + /** + * Specify which button to autofocus + * @default 'ok' + * @type string | null + */ + autoFocusButton?: string | null; + + /** + * Text of the Cancel button + * @default 'cancel' + * @type string + */ + cancelText?: string; + + /** + * Centered Modal + * @default false + * @type boolean + */ + centered?: boolean; + + /** + * class of container + * @type string + */ + class?: string; + + /** + * Modal content + * @type string | VNode + */ + content?: string | VNode; + + /** + * Icon type of the Icon component + * @default 'question-circle' + * @type string + */ + iconType?: string; + + /** + * Whether support press esc to close + * @default true + * @type boolean + */ + keyboard?: boolean; + + /** + * Whether to close the modal dialog when the mask (area outside the modal) is clicked + * @default false + * @type boolean + */ + maskClosable?: boolean; + + /** + * Text of the OK button + * @default 'OK' + * @type string + */ + okText?: string; + + /** + * Button type of the OK button + * @default 'primary' + * @type string + */ + okType?: string; + + /** + * The ok button props + * @type object + */ + okButtonProps?: Button; + + /** + * The cancel button props + * @type object + */ + cancelButtonProps?: Button; + + /** + * Title + * @type string | VNode + */ + title?: string | VNode; + + /** + * Width of the modal dialog + * @default 416 + * @type string | number + */ + width?: string | number; + + /** + * The z-index of the Modal + * @default 100 + * @type number + */ + zIndex?: number; + + /** + * Specify a function that will be called when the user clicks the Cancel button. + * The parameter of this function is a function whose execution should include closing the dialog. + * You can also just return a promise and when the promise is resolved, the modal dialog will also be closed + * @type Function + */ + onCancel?: () => any; + + /** + * Specify a function that will be called when the user clicks the OK button. + * The parameter of this function is a function whose execution should include closing the dialog. + * You can also just return a promise and when the promise is resolved, the modal dialog will also be closed + * @type Function + */ + onOk?: () => any; +} + +export interface ModalConfirm { + /** + * Updates modal options + * @param modalOptions modal option + */ + update(modalOptions: ModalOptions): void; + + /** + * Destroy the current model instace + */ + destroy(): void; +} + +export declare class Modal extends AntdComponent { + /** + * Specify a function that will be called when modal is closed completely. + * @type Function + */ + afterClose: () => any; + + /** + * Body style for modal body element. Such as height, padding etc. + * @default {} + * @type object + */ + bodyStyle: object; + + /** + * Text of the Cancel button + * @default 'cancel' + * @type string + */ + cancelText: string; + + /** + * Centered Modal + * @default false + * @type boolean + */ + centered: boolean; + + /** + * Whether a close (x) button is visible on top right of the modal dialog or not + * @default true + * @type boolean + */ + closable: boolean; + + /** + * Whether to apply loading visual effect for OK button or not + * @default false + * @type boolean + */ + confirmLoading: boolean; + + /** + * Whether to unmount child components on onClose + * @default false + * @type boolean + */ + destroyOnClose: boolean; + + /** + * Footer content, set as :footer="null" when you don't need default buttons + * @default OK and Cancel buttons + * @type any (string | slot) + */ + footer: any; + + /** + * Return the mount node for Modal + * @default () => document.body + * @type Function + */ + getContainer: (instance: any) => HTMLElement; + + /** + * Whether show mask or not. + * @default true + * @type boolean + */ + mask: boolean; + + /** + * Whether to close the modal dialog when the mask (area outside the modal) is clicked + * @default true + * @type boolean + */ + maskClosable: boolean; + + /** + * Style for modal's mask element. + * @default {} + * @type object + */ + maskStyle: object; + + /** + * Text of the OK button + * @default 'OK' + * @type string + */ + okText: string; + + /** + * Button type of the OK button + * @default 'primary' + * @type string + */ + okType: "primary" | "danger" | "dashed" | "ghost" | "default"; + + /** + * The ok button props, follow jsx rules + * @type object + */ + okButtonProps: { props: Button; on: {} }; + + /** + * The cancel button props, follow jsx rules + * @type object + */ + cancelButtonProps: { props: Button; on: {} }; + + /** + * The modal dialog's title + * @type any (string | slot) + */ + title: any; + + /** + * Whether the modal dialog is visible or not + * @default false + * @type boolean + */ + visible: boolean; + + /** + * Width of the modal dialog + * @default 520 + * @type string | number + */ + width: string | number; + + /** + * The class name of the container of the modal dialog + * @type string + */ + wrapClassName: string; + + /** + * The z-index of the Modal + * @default 1000 + * @type number + */ + zIndex: number; +} + +declare module "vue/types/vue" { + interface Vue { + $info: (modalOptios: ModalOptions) => ModalConfirm; + $success: (modalOptios: ModalOptions) => ModalConfirm; + $error: (modalOptios: ModalOptions) => ModalConfirm; + $warning: (modalOptios: ModalOptions) => ModalConfirm; + $confirm: (modalOptios: ModalOptions) => ModalConfirm; + } +} diff --git a/types/notification.d.ts b/types/notification.d.ts new file mode 100644 index 0000000000..329e1e1cbf --- /dev/null +++ b/types/notification.d.ts @@ -0,0 +1,125 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; + +export interface NotificationOptions { + /** + * Customized close button + * @type VNode | Function + */ + btn?: VNode | Function; + + /** + * Customized CSS class + * @type string + */ + class?: string; + + /** + * The content of notification box (required) + * @type string | VNode | Function + */ + description: string | VNode | Function; + + /** + * Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically + * @default 4.5 + * @type number + */ + duration?: number; + + /** + * Customized icon + * @type VNode | Function + */ + icon?: VNode | Function; + + /** + * The unique identifier of the Notification + * @type string + */ + key?: string; + + /** + * The title of notification box (required) + * @type string | VNode | Function + */ + message: string | VNode | Function; + + /** + * Position of Notification, can be one of topLeft topRight bottomLeft bottomRight + * @default 'topRight' + * @type string + */ + placement?: string; + + /** + * Customized inline style + * @type object | string + */ + style?: object | string; + + /** + * Specify a function that will be called when the close button is clicked + * @type Function + */ + onClose?: Function; +} + +export interface NotificationConfigOptions { + /** + * Distance from the bottom of the viewport, when placement is bottomRight or bottomLeft (unit: pixels). + * @default '24px' + * @type string + */ + bottom?: string; + + /** + * Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically + * @default 4.5 + * @type number + */ + duration?: number; + + /** + * Return the mount node for Notification + * @default () => document.body + * @type Function + */ + getContainer?: () => HTMLElement; + + /** + * Position of Notification, can be one of topLeft topRight bottomLeft bottomRight + * @default 'topRight' + * @type string + */ + placement?: string; + + /** + * Distance from the top of the viewport, when placement is topRight or topLeft (unit: pixels). + * @default '24px' + * @type string + */ + top?: string; +} + +export declare class Notification { + success(config: NotificationOptions): void; + warning(config: NotificationOptions): void; + warn(config: NotificationOptions): void; + info(config: NotificationOptions): void; + error(config: NotificationOptions): void; + open(config: NotificationOptions): void; + config(options: NotificationConfigOptions): void; + close(key: string): void; + destroy(): void; +} + +declare module "vue/types/vue" { + interface Vue { + $notification: Notification; + } +} diff --git a/types/pagination.d.ts b/types/pagination.d.ts new file mode 100644 index 0000000000..c3cb01fdf3 --- /dev/null +++ b/types/pagination.d.ts @@ -0,0 +1,98 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; + +export declare class Pagination extends AntdComponent { + /** + * total number of data items + * @default 0 + * @type number + */ + total: number; + + /** + * default initial page number + * @default 1 + * @type number + */ + defaultCurrent: number; + + /** + * current page number + * @type number + */ + current: number; + + /** + * default number of data items per page + * @default 10 + * @type number + */ + defaultPageSize: number; + + /** + * number of data items per page + * @type number + */ + pageSize: number; + + /** + * Whether to hide pager on single page + * @default false + * @type boolean + */ + hideOnSinglePage: boolean; + + /** + * determine whether pageSize can be changed + * @default false + * @type boolean + */ + showSizeChanger: boolean; + + /** + * specify the sizeChanger options + * @default ['10', '20', '30', '40'] + * @type string[] + */ + pageSizeOptions: string[]; + + /** + * determine whether you can jump to pages directly + * @default false + * @type boolean + */ + showQuickJumper: boolean; + + /** + * to display the total number and range + * @type Function + */ + showTotal: (total: number, range: [number, number]) => any; + + /** + * specify the size of Pagination, can be set to small + * @default '' + * @type string + */ + size: string; + + /** + * whether to use simple mode + * @type boolean + */ + simple: boolean; + + /** + * to customize item innerHTML + * @type Function + */ + itemRender: ( + page: number, + type: "page" | "prev" | "next", + originalElement: any + ) => VNode; +} diff --git a/types/popconfirm.d.ts b/types/popconfirm.d.ts new file mode 100644 index 0000000000..263098f2af --- /dev/null +++ b/types/popconfirm.d.ts @@ -0,0 +1,41 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { TooltipCommon } from "./tootip/common"; + +export declare class Popconfirm extends TooltipCommon { + /** + * text of the Cancel button + * @default 'Cancel' + * @type any (string | slot) + */ + cancelText: any; + + /** + * text of the Confirm button + * @default 'Confirm' + * @type any (string | slot) + */ + okText: any; + + /** + * Button type of the Confirm button + * @default 'primary' + * @type string + */ + okType: "primary" | "danger" | "dashed" | "ghost" | "default"; + + /** + * title of the confirmation box + * @type any (string | slot) + */ + title: any; + + /** + * customize icon of confirmation + * @default + * @type any (VNode | slot) + */ + icon: any; +} diff --git a/types/popover.d.ts b/types/popover.d.ts new file mode 100644 index 0000000000..ade684645f --- /dev/null +++ b/types/popover.d.ts @@ -0,0 +1,19 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { TooltipCommon } from "./tootip/common"; + +export declare class Popover extends TooltipCommon { + /** + * Content of the card + * @type any (string | slot | VNode) + */ + content: any; + + /** + * Title of the card + * @type any (string | slot | VNode) + */ + title: any; +} diff --git a/types/progress.d.ts b/types/progress.d.ts new file mode 100644 index 0000000000..6286713b08 --- /dev/null +++ b/types/progress.d.ts @@ -0,0 +1,91 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Progress extends AntdComponent { + /** + * template function of the content + * @default percent => percent + '%' + * @type Function + */ + format: (percent?: number, successPercent?: number) => any; + + /** + * the gap degree of half circle, 0 ~ 360 + * @default 0 + * @type number + */ + gapDegree: number; + + /** + * the gap position, options: top bottom left right + * @default 'top' + * @type string + */ + gapPosition: "top" | "bottom" | "left" | "right"; + + /** + * to set the completion percentage + * @default 0 + * @type number + */ + percent: number; + + /** + * whether to display the progress value and the status icon + * @default true + * @type boolean + */ + showInfo: boolean; + + /** + * to set the status of the Progress, options: normal success exception active + * @default 'normal' + * @type string + */ + status: "normal" | "success" | "active" | "exception"; + + /** + * to set the width of the progress bar, unit: px. + * to set the width of the circular progress bar, unit: percentage of the canvas width + * @default 10 if type = 'line', else 6 + * @type number + */ + strokeWidth: number; + + /** + * to set the style of the progress linecap + * @default 'round' + * @type Enum{ 'round', 'square' } + */ + strokeLinecap: "round" | "square"; + + /** + * color of progress bar + * @type string + */ + strokeColor: string; + + /** + * segmented success percent, works when type="line" + * @default 0 + * @type number + */ + successPercent: number; + + /** + * to set the type, options: line circle dashboard + * @default 'line' + * @type string + */ + type: "line" | "circle" | "dashboard"; + + /** + * to set the canvas width of the circular progress bar, unit: px + * @default 120 + * @type number + */ + width: number; +} diff --git a/types/radio/radio-button.d.ts b/types/radio/radio-button.d.ts new file mode 100644 index 0000000000..ae5823a9ff --- /dev/null +++ b/types/radio/radio-button.d.ts @@ -0,0 +1,13 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { Radio } from "./radio"; + +export declare class RadioButton extends Radio { + /** + * Type of radio button + * @type string + */ + type: "primary" | "danger" | "dashed" | "ghost" | "default"; +} diff --git a/types/radio/radio-group.d.ts b/types/radio/radio-group.d.ts new file mode 100644 index 0000000000..80243f0964 --- /dev/null +++ b/types/radio/radio-group.d.ts @@ -0,0 +1,52 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class RadioGroup extends AntdComponent { + /** + * Specifies the initial state: whether or not the radio is selected. + * @type boolean + */ + defaultValue: boolean; + + /** + * Disable radio + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * The name property of all input[type="radio"] children + * @type string + */ + name: string; + + /** + * set children optional + * @type Array + */ + options: Array; + + /** + * size for radio button style + * @default 'default' + * @type String + */ + size: "large" | "default" | "small"; + + /** + * Used for setting the currently selected value. + * @type any + */ + value: any; + + /** + * style type of radio button + * @default 'outline' + * @type string + */ + buttonStyle: "outline" | "solid"; +} diff --git a/types/radio/radio.d.ts b/types/radio/radio.d.ts new file mode 100644 index 0000000000..4ca041bdd7 --- /dev/null +++ b/types/radio/radio.d.ts @@ -0,0 +1,54 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { RadioGroup } from "./radio-group"; +import { RadioButton } from "./radio-button"; + +export declare class Radio extends AntdComponent { + static Group: RadioGroup; + static Button: RadioButton; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * Specifies whether the radio is selected. + * @type boolean + */ + checked: boolean; + + /** + * Specifies the initial state: whether or not the radio is selected. + * @type boolean + */ + defaultChecked: boolean; + + /** + * Disable radio + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * According to value for comparison, to determine whether the selected + * @type any + */ + value: any; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/rate.d.ts b/types/rate.d.ts new file mode 100644 index 0000000000..6bdd3ccb46 --- /dev/null +++ b/types/rate.d.ts @@ -0,0 +1,72 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Rate extends AntdComponent { + /** + * whether to allow clear when click again + * @default true + * @type boolean + */ + allowClear: boolean; + + /** + * whether to allow semi selection + * @default false + * @type boolean + */ + allowHalf: boolean; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * custom character of rate + * @default + * @type any (String or slot="character") + */ + character: any; + + /** + * star count + * @default 5 + * @type number + */ + count: number; + + /** + * default value + * @default 0 + * @type number + */ + defaultValue: number; + + /** + * read only, unable to interact + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * current value + * @type number + */ + value: number; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/select/option-group.d.ts b/types/select/option-group.d.ts new file mode 100644 index 0000000000..aa6984d80e --- /dev/null +++ b/types/select/option-group.d.ts @@ -0,0 +1,19 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class OptionGroup extends AntdComponent { + /** + * Key + * @type string + */ + key: string; + + /** + * Group label + * @type any (string | slot) + */ + label: any; +} diff --git a/types/select/option.d.ts b/types/select/option.d.ts new file mode 100644 index 0000000000..5368d1927f --- /dev/null +++ b/types/select/option.d.ts @@ -0,0 +1,38 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class Option extends AntdComponent { + /** + * Disable this option + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Same usage as value. If Vue request you to set this property, you can set it to value of option, and then omit value property. + * @type string + */ + key: string; + + /** + * title of Select after select this Option + * @type string + */ + title: string; + + /** + * default to filter with this property + * @type string | number + */ + value: string | number; + + /** + * additional class to option + * @type string + */ + class: string; +} diff --git a/types/select/select.d.ts b/types/select/select.d.ts new file mode 100644 index 0000000000..b10effae73 --- /dev/null +++ b/types/select/select.d.ts @@ -0,0 +1,221 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Option } from "./option"; +import { OptionGroup } from "./option-group"; + +export declare class Select extends AntdComponent { + static Option: Option; + static OptGroup: OptionGroup; + + /** + * Show clear button. + * @default false + * @type boolean + */ + allowClear: boolean; + + /** + * Whether the current search will be cleared on selecting an item. Only applies when mode is set to multiple or tags. + * @default true + * @type boolean + */ + autoClearSearchValue: boolean; + + /** + * Get focus by default + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * Whether active first option by default + * @default true + * @type boolean + */ + defaultActiveFirstOption: boolean; + + /** + * Initial selected option. + * @type string | number | Array + */ + defaultValue: string | number | Array; + + /** + * Whether disabled select + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * className of dropdown menu + * @type string + */ + dropdownClassName: string; + + /** + * Whether dropdown's width is same with select. + * @default true + * @type boolean + */ + dropdownMatchSelectWidth: boolean; + + /** + * style of dropdown menu + * @type object + */ + dropdownStyle: object; + + /** + * If true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, + * if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. + * @default true + * @type boolean | Function + */ + filterOption: boolean | Function; + + /** + * Value of action option by default + * @type string | string[] + */ + firstActiveValue: string | string[]; + + /** + * Parent Node which the selector should be rendered to. Default to body. + * When position issues happen, try to modify it into scrollable content and position it relative. + * @default () => document.body + * @type Function + */ + getPopupContainer: (triggerNode: any) => any; + + /** + * whether to embed label in value, turn the format of value from string to {key: string, label: vNodes} + * @default false + * @type boolean + */ + labelInValue: boolean; + + /** + * Max tag count to show + * @type number + */ + maxTagCount: number; + + /** + * Placeholder for not showing tags + * @type any (slot | Function) + */ + maxTagPlaceholder: any; + + /** + * Set mode of Select + * @default 'default' + * @type string + */ + mode: "default" | "multiple" | "tags"; + + /** + * Specify content to show when no result matches.. + * @default 'Not Found' + * @type any (string | slot) + */ + notFoundContent: any; + + /** + * Which prop value of option will be used for filter if filterOption is true + * @default 'value' + * @type string + */ + optionFilterProp: string; + + /** + * Which prop value of option will render as content of select. + * @default 'value' for combobox, 'children' for other modes + * @type string + */ + optionLabelProp: string; + + /** + * Placeholder of select + * @type any (string | slot) + */ + placeholder: any; + + /** + * Whether show search input in single mode. + * @default false + * @type boolean + */ + showSearch: boolean; + + /** + * Whether to show the drop-down arrow + * @default true + * @type boolean + */ + showArrow: boolean; + + /** + * Size of Select input. default large small + * @default 'default' + * @type string + */ + size: "default" | "large" | "small"; + + /** + * The custom suffix icon + * @type any (string | VNode | slot) + */ + suffixIcon: any; + + /** + * Separator used to tokenize on tag/multiple mode + * @type string[] + */ + tokenSeparators: string[]; + + /** + * Current selected option. + * @type string | number | Array + */ + value: string | number | Array; + + /** + * Data of the selectOption, manual construction work is no longer needed if this property has been set + * @default [] + * @type Array<{ value; label; disabled?; key?; title? }> + */ + options: Array<{ + value: any; + label: any; + disabled?: boolean; + key?: any; + title?: any; + }>; + + /** + * Initial open state of dropdown + * @type boolean + */ + defaultOpen: boolean; + + /** + * Controlled open state of dropdown + * @type boolean + */ + open: boolean; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/skeleton.d.ts b/types/skeleton.d.ts new file mode 100644 index 0000000000..33e6ae9abc --- /dev/null +++ b/types/skeleton.d.ts @@ -0,0 +1,55 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export interface SkeletonAvatarProps { + size?: "large" | "small" | "default"; + shape?: "circle" | "square"; +} + +export interface SkeletonTitleProps { + width?: number | string; +} + +export interface SkeletonParagraphProps { + width?: string | number | Array; + rows?: number; +} + +export declare class Skeleton extends AntdComponent { + /** + * Show animation effect + * @default false + * @type boolean + */ + active: boolean; + + /** + * Show avatar placeholder + * @default false + * @type boolean | object + */ + avatar: boolean | SkeletonAvatarProps; + + /** + * Display the skeleton when true + * @type boolean + */ + loading: boolean; + + /** + * Show paragraph placeholder + * @default true + * @type boolean | object + */ + paragraph: boolean | SkeletonParagraphProps; + + /** + * Show title placeholder + * @default true + * @type boolean | object + */ + title: boolean | SkeletonTitleProps; +} diff --git a/types/slider.d.ts b/types/slider.d.ts new file mode 100644 index 0000000000..636870fb50 --- /dev/null +++ b/types/slider.d.ts @@ -0,0 +1,115 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { VNode } from "vue"; + +export declare class Slider extends AntdComponent { + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * The default value of slider. When range is false, use number, otherwise, use [number, number] + * @default 0 | [0, 0] + * @type number | number[] + */ + defaultValue: number | number[]; + + /** + * If true, the slider will not be interactable. + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Whether the thumb can drag over tick only. + * @default false + * @type boolean + */ + dots: boolean; + + /** + * Make effect when marks not null,true means containment and false means coordinative + * @default true + * @type boolean + */ + included: boolean; + + /** + * Tick mark of Slider, type of key must be number, and must in closed interval [min, max] ,each mark can declare its own style. + * @default { number: string|VNode } | { number: { style: object, label: string|VNode } } | { number: () => VNode } + * @type object + */ + marks: { + number: + | string + | VNode + | { style: object; label: string | VNode } + | Function; + }; + + /** + * The maximum value the slider can slide to + * @default 100 + * @type number + */ + max: number; + + /** + * The minimum value the slider can slide to. + * @default 0 + * @type number + */ + min: number; + + /** + * dual thumb mode + * @default false + * @type boolean + */ + range: boolean; + + /** + * The granularity the slider can step through values. + * Must greater than 0, and be divided by (max - min) . When marks no null, step can be null. + * @default 1 + * @type number | null + */ + step: number | null; + + /** + * Slider will pass its value to tipFormatter, and display its value in Tooltip, and hide Tooltip when return value is null. + * @default IDENTITY + * @type Function | null + */ + tipFormatter: Function | null; + + /** + * The value of slider. When range is false, use number, otherwise, use [number, number] + * @type number | number[] + */ + value: number | number[]; + + /** + * If true, the slider will be vertical. + * @default false + * @type boolean + */ + vertical: boolean; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/spin.d.ts b/types/spin.d.ts new file mode 100644 index 0000000000..5d6a67c768 --- /dev/null +++ b/types/spin.d.ts @@ -0,0 +1,51 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Spin extends AntdComponent { + /** + * As indicator, you can define the global default spin element + * @param param0 indicator + */ + static setDefaultIndicator({ indicator }: { indicator: any }): void; + + /** + * specifies a delay in milliseconds for loading state (prevent flush) + * @type number (milliseconds) + */ + delay: number; + + /** + * vue node of the spinning indicator + * @type any (VNode | slot) + */ + indicator: any; + + /** + * size of Spin, options: small, default and large + * @default 'default' + * @type string + */ + size: "small" | "default" | "large"; + + /** + * whether Spin is spinning + * @default true + * @type boolean + */ + spinning: boolean; + + /** + * customize description content when Spin has children + * @type string + */ + tip: string; + + /** + * className of wrapper when Spin has children + * @type string + */ + wrapperClassName: string; +} diff --git a/types/steps/step.d.ts b/types/steps/step.d.ts new file mode 100644 index 0000000000..3e3c98f94e --- /dev/null +++ b/types/steps/step.d.ts @@ -0,0 +1,32 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class Step extends AntdComponent { + /** + * description of the step, optional property + * @type any (string | slot) + */ + description: any; + + /** + * icon of the step, optional property + * @type any (string | slot) + */ + icon: any; + + /** + * to specify the status. It will be automatically set by current of Steps if not configured. Optional values are: wait process finish error + * @default 'wait' + * @type string + */ + status: "wait" | "process" | "finish" | "error"; + + /** + * title of the step + * @type any (string | slot) + */ + title: any; +} diff --git a/types/steps/steps.d.ts b/types/steps/steps.d.ts new file mode 100644 index 0000000000..6955709fc4 --- /dev/null +++ b/types/steps/steps.d.ts @@ -0,0 +1,59 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Step } from "./step"; + +export declare class Steps extends AntdComponent { + static Step: Step + + /** + * to set the current step, counting from 0. You can overwrite this state by using status of Step + * @default 0 + * @type number + */ + current: number; + + /** + * set the initial step, counting from 0 + * @default 0 + * @type number + */ + initial: number; + + /** + * support vertial title and description + * @default 'horizontal' + * @type string + */ + labelPlacement: "horizontal" | "vertical"; + + /** + * to specify the status of current step, can be set to one of the following values: wait process finish error + * @default 'process' + * @type string + */ + status: "wait" | "process" | "finish" | "error"; + + /** + * to specify the size of the step bar, default and small are currently supported + * @default 'default' + * @type string + */ + size: "default" | "small"; + + /** + * to specify the direction of the step bar, horizontal and vertical are currently supported + * @default 'horizontal' + * @type string + */ + direction: "horizontal" | "vertical"; + + /** + * Steps with progress dot style, customize the progress dot by setting a scoped slot. labelPlacement will be vertical + * @default false + * @type boolean | Funtion + */ + progressDot: boolean | Function; +} diff --git a/types/switch.d.ts b/types/switch.d.ts new file mode 100644 index 0000000000..64e3248b0a --- /dev/null +++ b/types/switch.d.ts @@ -0,0 +1,71 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class Switch extends AntdComponent { + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * determine whether the Switch is checked + * @default false + * @type boolean + */ + checked: boolean; + + /** + * content to be shown when the state is checked + * @type any (string | slot) + */ + checkedChildren: any; + + /** + * to set the initial state + * @default false + * @type boolean + */ + defaultChecked: boolean; + + /** + * Disable switch + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * loading state of switch + * @default false + * @type boolean + */ + loading: boolean; + + /** + * the size of the Switch, options: default small + * @default 'default' + * @type string + */ + size: "small" | "default" | "large"; + + /** + * content to be shown when the state is unchecked + * @type any (string | slot) + */ + unCheckedChildren: any; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/table/column-group.d.ts b/types/table/column-group.d.ts new file mode 100644 index 0000000000..36f7ed9d4e --- /dev/null +++ b/types/table/column-group.d.ts @@ -0,0 +1,20 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class ColumnGroup extends AntdComponent { + /** + * Title of the column group + * @type any + */ + title: any; + + /** + * When using columns, you can use this property to configure the properties that support the slot, + * such as slots: { title: 'XXX'} + * @type object + */ + slots: object; +} diff --git a/types/table/column.d.ts b/types/table/column.d.ts new file mode 100644 index 0000000000..0fd087f6af --- /dev/null +++ b/types/table/column.d.ts @@ -0,0 +1,186 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { VNode } from "vue"; +import { ScopedSlot } from "vue/types/vnode"; + +export interface ColumnFilterItem { + text?: string; + value?: string; + children?: any; +} + +export declare type SortOrder = "ascend" | "descend"; + +export declare class Column extends AntdComponent { + /** + * specify how content is aligned + * @default 'left' + * @type string + */ + align: "left" | "right" | "center"; + + /** + * Span of this column's title + * @type number + */ + colSpan: number; + + /** + * Display field of the data record, could be set like a.b.c + * @type string + */ + dataIndex: string; + + /** + * Default order of sorted values: 'ascend' 'descend' null + * @type string + */ + defaultSortOrder: SortOrder; + + /** + * Customized filter overlay + * @type any (slot) + */ + filterDropdown: any; + + /** + * Whether filterDropdown is visible + * @type boolean + */ + filterDropdownVisible: boolean; + + /** + * Whether the dataSource is filtered + * @default false + * @type boolean + */ + filtered: boolean; + + /** + * Controlled filtered value, filter icon will highlight + * @type string[] + */ + filteredValue: string[]; + + /** + * Customized filter icon + * @default false + * @type any + */ + filterIcon: any; + + /** + * Whether multiple filters can be selected + * @default true + * @type boolean + */ + filterMultiple: boolean; + + /** + * Filter menu config + * @type object[] + */ + filters: ColumnFilterItem[]; + + /** + * Set column to be fixed: true(same as left) 'left' 'right' + * @default false + * @type boolean | string + */ + fixed: boolean | "left" | "right"; + + /** + * Unique key of this column, you can ignore this prop if you've set a unique dataIndex + * @type string + */ + key: string; + + /** + * Renderer of the table cell. The return value should be a VNode, or an object for colSpan/rowSpan config + * @type Function | ScopedSlot + */ + customRender: Function | ScopedSlot; + + /** + * Sort function for local sort, see Array.sort's compareFunction. If you need sort buttons only, set to true + * @type boolean | Function + */ + sorter: boolean | Function; + + /** + * Order of sorted values: 'ascend' 'descend' false + * @type boolean | string + */ + sortOrder: boolean | SortOrder; + + /** + * Title of this column + * @type any (string | slot) + */ + title: any; + + /** + * Width of this column + * @type string | number + */ + width: string | number; + + /** + * Set props on per cell + * @type Function + */ + customCell: ( + record: any + ) => { + props: object; + attrs: object; + on: object; + class: object; + style: object; + nativeOn: object; + }; + + /** + * Set props on per header cell + * @type + */ + customHeaderCell: ( + column: any + ) => { + props: object; + attrs: object; + on: object; + class: object; + style: object; + nativeOn: object; + }; + + /** + * Callback executed when the confirm filter button is clicked, Use as a filter event when using template or jsx + * @type Function + */ + onFilter: Function; + + /** + * Callback executed when filterDropdownVisible is changed, Use as a filterDropdownVisible event when using template or jsx + * @type Function + */ + onFilterDropdownVisibleChange: (visible: boolean) => void; + + /** + * When using columns, you can use this property to configure the properties that support the slot, + * such as slots: { filterIcon: 'XXX'} + * @type object + */ + slots: object; + + /** + * When using columns, you can use this property to configure the properties that support the slot-scope, + * such as scopedSlots: { customRender: 'XXX'} + * @type object + */ + scopedSlots: object; +} diff --git a/types/table/table.d.ts b/types/table/table.d.ts new file mode 100644 index 0000000000..0d372307a0 --- /dev/null +++ b/types/table/table.d.ts @@ -0,0 +1,314 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Spin } from "../spin"; +import { ScopedSlot, VNode } from "vue/types/vnode"; +import { Pagination } from "../pagination"; +import { Column } from "./column"; +import { ColumnGroup } from "./column-group"; + +export declare class PaginationConfig extends Pagination { + position: "top" | "bottom" | "both"; +} + +export interface customSelction { + /** + * Key + * @description Unique key of this selection + * @default undefined + * @type string + */ + key?: string; + + /** + * Text + * @description Display text of this selection + * @default undefined + * @type string | VNode + */ + text?: string | VNode; + + /** + * On Select + * @description Callback executed when this selection is clicked + * @default undefined + * @type Function + */ + onSelect?: (changeableRowKeys?: any) => any; +} + +export interface TableRowSelection { + /** + * checkbox or radio + * @default 'checkbox' + * @type string + */ + type?: "checkbox" | "radio"; + + /** + * Controlled selected row keys + * @type string[] + */ + selectedRowKeys?: string[]; + + /** + * Get Checkbox or Radio props + * @type Function + */ + getCheckboxProps?: (record: any) => any; + + /** + * Custom selection config, only displays default selections when set to true + * @type boolean | object[] + */ + selections?: boolean | customSelction[]; + + /** + * Remove the default Select All and Select Invert selections + * @default false + * @type boolean + */ + hideDefaultSelections?: boolean; + + /** + * Fixed selection column on the left + * @type boolean + */ + fixed?: boolean; + + /** + * Set the width of the selection column + * @type string | number + */ + columnWidth?: string | number; + + /** + * Set the title of the selection column + * @type string | VNode + */ + columnTitle?: string | VNode; + + /** + * Callback executed when selected rows change + * @type Function + */ + onChange?: ( + selectedRowKeys: Array, + selectedRows: object[] + ) => any; + + /** + * Callback executed when select/deselect one row + * @type Function + */ + onSelect?: ( + record: any, + selected: boolean, + selectedRows: object[], + nativeEvent: Event + ) => any; + + /** + * Callback executed when select/deselect all rows + * @type Function + */ + onSelectAll?: ( + selected: boolean, + selectedRows: object[], + changeRows: object[] + ) => any; + + /** + * Callback executed when row selection is inverted + * @type Function + */ + onSelectInvert?: (selectedRows: Object[]) => any; +} + +export declare class Table extends AntdComponent { + static Column: Column; + static ColumnGroup: ColumnGroup; + + /** + * Whether to show all table borders + * @default false + * @type boolean + */ + bordered: boolean; + + /** + * The column contains children to display + * @default 'children' + * @type string | string[] + */ + childrenColumnName: string | string[]; + + /** + * Columns of table + * @type any + */ + columns: any; + + /** + * Override default table elements + * @type object + */ + components: object; + + /** + * Data record array to be displayed + * @type any + */ + dataSource: any; + + /** + * Expand all rows initially + * @default false + * @type boolean + */ + defaultExpandAllRows: boolean; + + /** + * Initial expanded row keys + * @type string[] + */ + defaultExpandedRowKeys: string[]; + + /** + * Current expanded row keys + * @type string[] + */ + expandedRowKeys: string[]; + + /** + * Expanded container render for each row + * @type Function + */ + expandedRowRender: ( + record: any, + index: number, + indent: number, + expanded: boolean + ) => any; + + /** + * Whether to expand row by clicking anywhere in the whole row + * @default false + * @type boolean + */ + expandRowByClick: boolean; + + /** + * Table footer renderer + * @type Function | ScopedSlot + */ + footer: Function | ScopedSlot; + + /** + * Indent size in pixels of tree data + * @default 15 + * @type number + */ + indentSize: number; + + /** + * Loading status of table + * @default false + * @type boolean | object + */ + loading: boolean | Spin; + + /** + * i18n text including filter, sort, empty text, etc + * @default { filterConfirm: 'Ok', filterReset: 'Reset', emptyText: 'No Data' } + * @type object + */ + locale: object; + + /** + * Pagination config or [Pagination] (/ant-design-vue/components/pagination/), hide it by setting it to false + * @type boolean | PaginationConfig + */ + pagination: boolean | PaginationConfig; + + /** + * Row's className + * @type Function + */ + rowClassName: (record: any, index: number) => string; + + /** + * Row's unique key, could be a string or function that returns a string + * @default 'key' + * @type string | Function + */ + rowKey: string | Function; + + /** + * Row selection config + * @type object + */ + rowSelection: TableRowSelection; + + /** + * Set horizontal or vertical scrolling, can also be used to specify the width and height of the scroll area. + * It is recommended to set a number for x, if you want to set it to true, + * you need to add style .ant-table td { white-space: nowrap; }. + * @type object + */ + scroll: { x: number | true; y: number }; + + /** + * Whether to show table header + * @default true + * @type boolean + */ + showHeader: boolean; + + /** + * Size of table + * @default 'default' + * @type string + */ + size: "default" | "middle" | "small" | "large"; + + /** + * Table title renderer + * @type Function | ScopedSlot + */ + title: Function | ScopedSlot; + + /** + * Set props on per header row + * @type Function + */ + customHeaderRow: ( + column: any, + index: number + ) => { + props: object; + attrs: object; + on: object; + class: object; + style: object; + nativeOn: object; + }; + + /** + * Set props on per row + * @type Function + */ + customRow: ( + record: any, + index: number + ) => { + props: object; + attrs: object; + on: object; + class: object; + style: object; + nativeOn: object; + }; +} diff --git a/types/tabs/tab-pane.d.ts b/types/tabs/tab-pane.d.ts new file mode 100644 index 0000000000..a47d76db4f --- /dev/null +++ b/types/tabs/tab-pane.d.ts @@ -0,0 +1,26 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class TabPane extends AntdComponent { + /** + * Forced render of content in tabs, not lazy render after clicking on tabs + * @default false + * @type boolean + */ + forceRender: boolean; + + /** + * TabPane's key + * @type string + */ + key: string; + + /** + * Show text in TabPane's head + * @type any (string | slot) + */ + tab: any; +} diff --git a/types/tabs/tabs.d.ts b/types/tabs/tabs.d.ts new file mode 100644 index 0000000000..9cd177af7b --- /dev/null +++ b/types/tabs/tabs.d.ts @@ -0,0 +1,75 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { TabPane } from "./tab-pane"; + +export declare class Tabs extends AntdComponent { + static TabPane: TabPane; + + /** + * Current TabPane's key + * @type string + */ + activeKey: string; + + /** + * Whether to change tabs with animation. Only works while tabPosition="top"\|"bottom" + * @default true, false when type="card" + * @type boolean | object + */ + animated: boolean | { inkBar: boolean; tabPane: boolean }; + + /** + * Initial active TabPane's key, if activeKey is not set. + * @type string + */ + defaultActiveKey: string; + + /** + * Hide plus icon or not. Only works while type="editable-card" + * @default false + * @type boolean + */ + hideAdd: boolean; + + /** + * preset tab bar size + * @default 'default' + * @type string + */ + size: "default" | "small" | "large"; + + /** + * Extra content in tab bar + * @type any + */ + tabBarExtraContent: any; + + /** + * Tab bar style object + * @type object + */ + tabBarStyle: object; + + /** + * Position of tabs + * @default 'top' + * @type string + */ + tabPosition: "top" | "right" | "bottom" | "left"; + + /** + * Basic style of tabs + * @default 'line' + * @type string + */ + type: "line" | "card" | "editable-card"; + + /** + * The gap between tabs + * @type number + */ + tabBarGutter: number; +} diff --git a/types/tag/checkable-tag.d.ts b/types/tag/checkable-tag.d.ts new file mode 100644 index 0000000000..264dd67de4 --- /dev/null +++ b/types/tag/checkable-tag.d.ts @@ -0,0 +1,14 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class CheckableTag extends AntdComponent { + /** + * Checked status of Tag + * @default false + * @type boolean + */ + checked: boolean; +} diff --git a/types/tag/tag.d.ts b/types/tag/tag.d.ts new file mode 100644 index 0000000000..ff73255511 --- /dev/null +++ b/types/tag/tag.d.ts @@ -0,0 +1,36 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { CheckableTag } from "./checkable-tag"; + +export declare class Tag extends AntdComponent { + static CheckableTag: CheckableTag; + + /** + * Callback executed when close animation is completed + * @type Function + */ + afterClose: () => void; + + /** + * Whether the Tag can be closed + * @default false + * @type boolean + */ + closable: boolean; + + /** + * Color of the Tag + * @type string + */ + color: string; + + /** + * Whether the Tag is closed or not + * @default true + * @type boolean + */ + visible: boolean; +} diff --git a/types/time-picker.d.ts b/types/time-picker.d.ts new file mode 100644 index 0000000000..a921ad69d6 --- /dev/null +++ b/types/time-picker.d.ts @@ -0,0 +1,177 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { Moment } from "moment"; + +export declare class TimePicker extends AntdComponent { + /** + * some addon to timepicker panel bottom + * @type any (slot | slot-scope) + */ + addon: any; + + /** + * allow clearing text + * @default true + * @type boolean + */ + allowEmpty: boolean; + + /** + * get focus when component mounted + * @default false + * @type boolean + */ + autoFocus: boolean; + + /** + * clear tooltip of icon + * @default 'clear' + * @type string + */ + clearText: string; + + /** + * default open panel value, used to set utcOffset,locale if value/defaultValue absent + * @default Moment + * @type Moment + */ + defaultOpenValue: Moment; + + /** + * to set default time + * @type Moment + */ + defaultValue: Moment; + + /** + * determine whether the TimePicker is disabled + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * to specify the hours that cannot be selected + * @type Function + */ + disabledHours: () => any; + + /** + * to specify the minutes that cannot be selected + * @type Function + */ + disabledMinutes: (selectedHour: any) => any; + + /** + * to specify the seconds that cannot be selected + * @type Function + */ + disabledSeconds: (selectedHour: any, selectedMinute: any) => any; + + /** + * to set the time format + * @default "HH:mm:ss" + * @type string + */ + format: string; + + /** + * to set the container of the floating layer, while the default is to create a div element in body + * @type Function + */ + getPopupContainer: (trigger: any) => any; + + /** + * hide the options that can not be selected + * @default false + * @type boolean + */ + hideDisabledOptions: boolean; + + /** + * interval between hours in picker + * @default 1 + * @type number + */ + hourStep: number; + + /** + * Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices) + * @default false + * @type boolean + */ + inputReadOnly: boolean; + + /** + * interval between minutes in picker + * @default 1 + * @type number + */ + minuteStep: number; + + /** + * whether to popup panel + * @default false + * @type boolean + */ + open: boolean; + + /** + * display when there's no value + * @default "Select a time" + * @type string + */ + placeholder: string; + + /** + * className of panel + * @type string + */ + popupClassName: string; + + /** + * interval between seconds in picker + * @default 1 + * @type number + */ + secondStep: number; + + /** + * The custom suffix icon + * @type any (string | VNode | slot) + */ + suffixIcon: any; + + /** + * display as 12 hours format, with default format h:mm:ss a + * @default false + * @type boolean + */ + use12Hours: boolean; + + /** + * to set time + * @type Moment + */ + value: Moment; + + /** + * Time picker size + * @default 'default' + * @type string + */ + size: "large" | "default" | "small"; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/timeline/timeline-item.d.ts b/types/timeline/timeline-item.d.ts new file mode 100644 index 0000000000..24b24574a6 --- /dev/null +++ b/types/timeline/timeline-item.d.ts @@ -0,0 +1,20 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare class TimelineItem extends AntdComponent { + /** + * Set the circle's color to blue, red, green or other custom colors + * @default 'blue' + * @type string + */ + color: string; + + /** + * Customize timeline dot + * @type any (string | slot) + */ + dot: any; +} diff --git a/types/timeline/timeline.d.ts b/types/timeline/timeline.d.ts new file mode 100644 index 0000000000..855f7e52f6 --- /dev/null +++ b/types/timeline/timeline.d.ts @@ -0,0 +1,38 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { TimelineItem } from "./timeline-item"; + +export declare class Timeline extends AntdComponent { + static Item: TimelineItem; + + /** + * Set the last ghost node's existence or its content + * @default false + * @type any (boolean | string | slot) + */ + pending: any; + + /** + * Set the dot of the last ghost node when pending is true + * @default + * @type any (string | slot) + */ + pendingDot: any; + + /** + * reverse nodes or not + * @default false + * @type boolean + */ + reverse: boolean; + + /** + * By sending alternate the timeline will distribute the nodes to the left and right. + * @default 'left' + * @type string + */ + mode: "left" | "alternate" | "right"; +} diff --git a/types/tootip/common.d.ts b/types/tootip/common.d.ts new file mode 100644 index 0000000000..22625e6e49 --- /dev/null +++ b/types/tootip/common.d.ts @@ -0,0 +1,103 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; + +export declare type triggerType = "hover" | "focus" | "click" | "contextmenu"; + +export declare class TooltipCommon extends AntdComponent { + /** + * Whether the arrow is pointed at the center of target + * @default false + * @type boolean + */ + arrowPointAtCenter: boolean; + + /** + * Whether to adjust popup placement automatically when popup is off screen + * @default true + * @type boolean + */ + autoAdjustOverflow: boolean | object; + + /** + * Whether the floating tooltip card is visible by default + * @default false + * @type boolean + */ + defaultVisible: boolean; + + /** + * The DOM container of the tip, the default behavior is to create a div element in body. + * @default () => document.body + * @type Function + */ + getPopupContainer: (triggerNode: any) => any; + + /** + * Delay in seconds, before tooltip is shown on mouse enter + * @default 0 + * @type number + */ + mouseEnterDelay: number; + + /** + * Delay in seconds, before tooltip is hidden on mouse leave + * @default 0.1 + * @type number + */ + mouseLeaveDelay: number; + + /** + * Class name of the tooltip card + * @type string + */ + overlayClassName: string; + + /** + * Style of the tooltip card + * @type undefined + */ + overlayStyle: object; + + /** + * The position of the tooltip relative to the target, which can be one of top + * left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom + * @default 'top' + * @type string + */ + placement: + | "top" + | "left" + | "right" + | "bottom" + | "topLeft" + | "topRight" + | "bottomLeft" + | "bottomRight" + | "leftTop" + | "leftBottom" + | "rightTop" + | "rightBottom"; + + /** + * Tooltip trigger mode + * @default 'hover' + * @type triggerType | triggerType[] + */ + trigger: triggerType | triggerType[]; + + /** + * Whether the floating tooltip card is visible or not + * @default false + * @type boolean + */ + visible: boolean; + + /** + * this value will be merged into placement's config, please refer to the settings dom-align + * @type object + */ + align: object; +} diff --git a/types/tootip/tooltip.d.ts b/types/tootip/tooltip.d.ts new file mode 100644 index 0000000000..8ec0bbf704 --- /dev/null +++ b/types/tootip/tooltip.d.ts @@ -0,0 +1,14 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import Vue from "vue"; +import { TooltipCommon } from "./common"; + +export declare class Tooltip extends TooltipCommon { + /** + * The text shown in the tooltip + * @type any (string | slot) + */ + title: any; +} diff --git a/types/transfer.d.ts b/types/transfer.d.ts new file mode 100644 index 0000000000..665763c392 --- /dev/null +++ b/types/transfer.d.ts @@ -0,0 +1,109 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export interface TransferItem { + key: string; + title: string; + description?: string; + disabled?: boolean; +} + +export declare class Transfer extends AntdComponent { + /** + * Used for setting the source data. The elements that are part of this array will be present the left column. + * Except the elements whose keys are included in targetKeys prop. + * @default [] + * @type TransferItem[] + */ + dataSource: TransferItem[]; + + /** + * Whether disabled transfer + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * A function to determine whether an item should show in search result list + * @type Function + */ + filterOption: (inputValue: any, option: any) => boolean; + + /** + * customize the progress dot by setting a scoped slot + * @type any (slot="footer" slot-scope="props") + */ + footer: any; + + /** + * property of vc-lazy-load for lazy rendering items. Turn off it by set to false. + * @default { height: 32, offset: 32 } + * @type object | boolean + */ + lazy: object | boolean; + + /** + * A custom CSS style used for rendering the transfer columns. + * @type object + */ + listStyle: object; + + /** + * i18n text including filter, empty text, item unit, etc + * @default { itemUnit: 'item', itemsUnit: 'items', notFoundContent: 'The list is empty', searchPlaceholder: 'Search here' } + * @type object + */ + locale: { + itemUnit: string; + itemsUnit: string; + notFoundContent: string; + searchPlaceholder: string; + }; + + /** + * A set of operations that are sorted from bottom to top. + * @default ['>', '<'] + * @type string[] + */ + operations: string[]; + + /** + * The function to generate the item shown on a column. + * Based on an record (element of the dataSource array), + * this function should return a element which is generated from that record. + * Also, it can return a plain object with value and label, label is a element and value is for title + * @type Function + */ + render: (record: TransferItem) => void; + + /** + * A set of keys of selected items. + * @default [] + * @type string[] + */ + selectedKeys: string[]; + + /** + * If included, a search box is shown on each column. + * @default false + * @type boolean + */ + showSearch: boolean; + + /** + * A set of keys of elements that are listed on the right column. + * @default [] + * @type string[] + */ + targetKeys: string[]; + + /** + * A set of titles that are sorted from left to right. + * @type string[] + */ + titles: string[]; +} diff --git a/types/tree-node.d.ts b/types/tree-node.d.ts new file mode 100644 index 0000000000..4e854d8ccb --- /dev/null +++ b/types/tree-node.d.ts @@ -0,0 +1,101 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export declare class TreeNode extends AntdComponent { + /** + * Class + * @description className + * @type string + */ + class: string; + + /** + * Style + * @description style of tree node + * @type string | object + */ + style: string | object; + + /** + * Disable Checkbox + * @description Disables the checkbox of the treeNode + * @default false + * @type boolean + */ + disableCheckbox: boolean; + + /** + * Disabled + * @description Disabled or not + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Icon + * @description customize icon. When you pass component, whose render will receive full TreeNode props as component props + * @type any (slot | slot-scope) + */ + icon: any; + + /** + * Is Leaf? + * @description Leaf node or not + * @default false + * @type boolean + */ + isLeaf: boolean; + + /** + * Key + * @description Required property, should be unique in the tree + * (In tree: Used with (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys) + * @default internal calculated position of treeNode or undefined + * @type string | number + */ + key: string | number; + + /** + * Selectable + * @description Set whether the treeNode can be selected + * @default true + * @type boolean + */ + selectable: boolean; + + /** + * Title + * @description Content showed on the treeNodes + * @default '---' + * @type any (string | slot) + */ + title: any; + + /** + * Value + * @description Will be treated as treeNodeFilterProp by default, should be unique in the tree + * @default undefined + * @type string + */ + value: string; + + /** + * Slots + * @description When using treeNodes, you can use this property to configure the properties that support the slot, + * such as slots: { title: 'XXX'} + * @type object + */ + slots: object; + + /** + * Scoped Slots + * @description When using treeNodes, you can use this property to configure the properties that support the slot, + * such as scopedSlots: { title: 'XXX'} + * @type object + */ + scopedSlots: object; +} diff --git a/types/tree-select.d.ts b/types/tree-select.d.ts new file mode 100644 index 0000000000..e798d40288 --- /dev/null +++ b/types/tree-select.d.ts @@ -0,0 +1,218 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; +import { TreeNode } from './tree-node'; + +export interface TreeData { + key: string | number; + value: string; + label: any; + children: any; + disabled?: boolean; + disableCheckbox?: boolean; + selectable?: boolean; +} + +export declare class TreeSelect extends AntdComponent { + static TreeNode: TreeNode; + + /** + * Whether allow clear + * @default false + * @type boolean + */ + allowClear: boolean; + + /** + * To set the initial selected treeNode(s). + * @type string | string[] + */ + defaultValue: string | string[]; + + /** + * Disabled or not + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * className of dropdown menu + * @type string + */ + dropdownClassName: string; + + /** + * Determine whether the dropdown menu and the select input are the same width + * @default true + * @type boolean + */ + dropdownMatchSelectWidth: boolean; + + /** + * To set the style of the dropdown menu + * @type object + */ + dropdownStyle: object; + + /** + * Whether to filter treeNodes by input value. The value of treeNodeFilterProp is used for filtering by default. + * @default Function + * @type boolean | Function + */ + filterTreeNode: boolean | Function; + + /** + * To set the container of the dropdown menu. + * The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition. + * @default () => document.body + * @type Function + */ + getPopupContainer: (triggerNode: any) => HTMLElement; + + /** + * whether to embed label in value, turn the format of value from string to {value: string, label: VNode, halfChecked: string[]} + * @default false + * @type boolean + */ + labelInValue: boolean; + + /** + * Load data asynchronously. + * @type + */ + loadData: (node: any) => void; + + /** + * Support multiple or not, will be true when enable treeCheckable. + * @default false + * @type boolean + */ + multiple: boolean; + + /** + * Placeholder of the select input + * @type any (string | slot) + */ + placeholder: any; + + /** + * Placeholder of the search input + * @type any (string | slot) + */ + searchPlaceholder: any; + + /** + * Show Checked Strategy + * @description The way show selected item in box. Default: just show child nodes. + * TreeSelect.SHOW_ALL: show all checked treeNodes (include parent treeNode). + * TreeSelect.SHOW_PARENT: show checked treeNodes (just show parent treeNode). + * @default TreeSelect.SHOW_CHILD + * @type + */ + showCheckedStrategy: "SHOW_ALL" | "SHOW_PARENT" | "SHOW_CHILD"; + + /** + * Whether to display a search input in the dropdown menu(valid only in the single mode) + * @default false + * @type boolean + */ + showSearch: boolean; + + /** + * To set the size of the select input, options: large small + * @default 'default' + * @type string + */ + size: "small" | "large" | "default"; + + /** + * Whether to show checkbox on the treeNodes + * @default false + * @type boolean + */ + treeCheckable: boolean; + + /** + * Whether to check nodes precisely (in the checkable mode), means parent and + * child nodes are not associated, and it will make labelInValue be true + * @default false + * @type boolean + */ + treeCheckStrictly: boolean; + + /** + * Data of the treeNodes, manual construction work is no longer needed + * if this property has been set(ensure the Uniqueness of each value) + * @default [] + * @type object[] + */ + treeData: TreeData[]; + + /** + * Enable simple mode of treeData. + * (treeData should like this: [{id:1, pId:0, value:'1', label:"test1",...},...], pId is parent node's id) + * @default false + * @type boolean | object[] + */ + treeDataSimpleMode: + | boolean + | Array<{ id: string; pId: string; rootPId: any }>; + + /** + * Whether to expand all treeNodes by default + * @default false + * @type boolean + */ + treeDefaultExpandAll: boolean; + + /** + * Default expanded treeNodes + * @type string[] | number[] + */ + treeDefaultExpandedKeys: string[] | number[]; + + /** + * Set expanded keys + * @type string[] | number[] + */ + treeExpandedKeys: string[] | number[]; + + /** + * Will be used for filtering if filterTreeNode returns true + * @default 'value' + * @type string + */ + treeNodeFilterProp: string; + + /** + * Will render as content of select + * @default 'title' + * @type string + */ + treeNodeLabelProp: string; + + /** + * To set the current selected treeNode(s). + * @type string | string[] + */ + value: string | string[]; + + /** + * The custom suffix icon + * @type any (VNode | slot) + */ + suffixIcon: any; + + /** + * remove focus + */ + blur(): void; + + /** + * get focus + */ + focus(): void; +} diff --git a/types/tree/dictionary-tree.d.ts b/types/tree/dictionary-tree.d.ts new file mode 100644 index 0000000000..b0747b6066 --- /dev/null +++ b/types/tree/dictionary-tree.d.ts @@ -0,0 +1,15 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { Tree } from "./tree"; + +export declare class DictionaryTree extends Tree { + /** + * Directory open logic, optional false 'click' 'doubleclick' + * @default 'click' + * @type string + */ + expandAction: string; +} diff --git a/types/tree/tree.d.ts b/types/tree/tree.d.ts new file mode 100644 index 0000000000..e9c2674425 --- /dev/null +++ b/types/tree/tree.d.ts @@ -0,0 +1,156 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from "../component"; +import { TreeNode } from "../tree-node"; +import { DictionaryTree } from "./dictionary-tree"; + +export declare class Tree extends AntdComponent { + static TreeNode: TreeNode; + static DirectoryTree: DictionaryTree; + + /** + * treeNode of tree + * @type TreeNode[] + */ + treeData: TreeNode[]; + + /** + * Whether to automatically expand a parent treeNode + * @default true + * @type boolean + */ + autoExpandParent: boolean; + + /** + * Adds a Checkbox before the treeNodes + * @default false + * @type boolean + */ + checkable: boolean; + + /** + * (Controlled) Specifies the keys of the checked treeNodes + * (PS: When this specifies the key of a treeNode which is also a parent treeNode, + * all the children treeNodes of will be checked; and vice versa, + * when it specifies the key of a treeNode which is a child treeNode, + * its parent treeNode will also be checked. When checkable and checkStrictly is true, + * its object has checked and halfChecked property. Regardless of whether the child or parent treeNode is checked, + * they won't impact each other. + * @default [] + * @type string[] | number[] | { checked: string[]; halfChecked: string[] } + */ + checkedKeys: string[] | number[] | { checked: string[]; halfChecked: string[] }; + + /** + * Check treeNode precisely; parent treeNode and children treeNodes are not associated + * @default false + * @type boolean + */ + checkStrictly: boolean; + + /** + * Specifies the keys of the default checked treeNodes + * @default [] + * @type string[] | number[] + */ + defaultCheckedKeys: string[] | number[]; + + /** + * Whether to expand all treeNodes by default + * @default false + * @type boolean + */ + defaultExpandAll: boolean; + + /** + * Specify the keys of the default expanded treeNodes + * @default [] + * @type string[] | number[] + */ + defaultExpandedKeys: string[] | number[]; + + /** + * auto expand parent treeNodes when init + * @default true + * @type boolean + */ + defaultExpandParent: boolean; + + /** + * Specifies the keys of the default selected treeNodes + * @default [] + * @type string[] | number[] + */ + defaultSelectedKeys: string[] | number[]; + + /** + * whether disabled the tree + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * Specifies whether this Tree is draggable (IE > 8) + * @default false + * @type boolean + */ + draggable: boolean; + + /** + * (Controlled) Specifies the keys of the expanded treeNodes + * @default [] + * @type string[] | number[] + */ + expandedKeys: string[] | number[]; + + /** + * Defines a function to filter (highlight) treeNodes. + * When the function returns true, the corresponding treeNode will be highlighted + * @type Function + */ + filterTreeNode: (node: TreeNode) => any; + + /** + * Load data asynchronously + * @type Function + */ + loadData: (node: TreeNode) => any; + + /** + * (Controlled) Set loaded tree nodes. Need work with loadData + * @default [] + * @type string[] + */ + loadedKeys: string[]; + + /** + * Allows selecting multiple treeNodes + * @default false + * @type boolean + */ + multiple: boolean; + + /** + * (Controlled) Specifies the keys of the selected treeNodes + * @type string[] | number[] + */ + selectedKeys: string[] | number[]; + + /** + * Shows the icon before a TreeNode's title. + * There is no default style; you must set a custom style for it if set to true + * @default false + * @type boolean + */ + showIcon: boolean; + + /** + * Shows a connecting line + * @default false + * @type boolean + */ + showLine: boolean; +} diff --git a/types/upload.d.ts b/types/upload.d.ts new file mode 100644 index 0000000000..8536f2cd87 --- /dev/null +++ b/types/upload.d.ts @@ -0,0 +1,138 @@ +// Project: https://github.com/vueComponent/ant-design-vue +// Definitions by: akki-jat +// Definitions: https://github.com/vueComponent/ant-design-vue/types + +import { AntdComponent } from './component'; + +export interface UploadFile { + uid: string | number; + name: string; +} + +export interface ShowUploadList { + showRemoveIcon?: boolean; + showPreviewIcon?: boolean; +} + +export declare class Upload extends AntdComponent { + /** + * File types that can be accepted. + * @type string + */ + accept: string; + + /** + * Uploading URL + * @type string | Function + */ + action: string | Function; + + /** + * support upload whole directory + * @type boolean + * @see https://caniuse.com/#feat=input-file-directory + */ + directory: boolean; + + /** + * Hook function which will be executed before uploading. + * Uploading will be stopped with false or a rejected Promise returned. + * Warning:this function is not supported in IE9. + * @type Function + */ + beforeUpload: (file: any, fileList: any) => boolean | Promise; + + /** + * override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest + * @type Function + */ + customRequest: Function; + + /** + * Uploading params or function which can return uploading params. + * @type object | Function + */ + data: object | Function; + + /** + * Default list of files that have been uploaded. + * @type UploadFile[] + */ + defaultFileList: UploadFile[]; + + /** + * disable upload button + * @default false + * @type boolean + */ + disabled: boolean; + + /** + * List of files that have been uploaded (controlled) + * @type UploadFile[] + */ + fileList: UploadFile[]; + + /** + * Set request headers, valid above IE10. + * @type object + */ + headers: object; + + /** + * Built-in stylesheets, support for three types: text, picture or picture-card + * @default 'text' + * @type string + */ + listType: "text" | "picture" | "picture-card"; + + /** + * Whether to support selected multiple file. IE10+ supported. + * You can select multiple files with CTRL holding down while multiple is set to be true + * @default false + * @type boolean + */ + multiple: boolean; + + /** + * The name of uploading file + * @default 'file' + * @type string + */ + name: string; + + /** + * Whether to show default upload list, could be an object to specify showPreviewIcon and showRemoveIcon individually + * @default true + * @type boolean | ShowUploadList + */ + showUploadList: boolean | ShowUploadList; + + /** + * Need to be turned on while the server side is rendering. + * @default false + * @type boolean + */ + supportServerRender: boolean; + + /** + * ajax upload with cookie sent + * @default false + * @type boolean + */ + withCredentials: boolean; + + /** + * click open file dialog + * @default true + * @type boolean + */ + openFileDialogOnClick: boolean; + + /** + * A callback function, will be executed when removing file button is clicked, + * remove event will be prevented when return value is false or a Promise which resolve(false) or reject. + * @type Function + */ + remove: (file: any) => boolean | Promise; +}