Skip to content

Commit

Permalink
feat: typescript support (vueComponent#359)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
akki-jat authored and tangjinzhou committed Jan 1, 2019
1 parent 94d2515 commit 0e499ee
Show file tree
Hide file tree
Showing 90 changed files with 6,516 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"frontend"
],
"main": "dist/antd.min.js",
"typings": "types/index.d.ts",
"files": [
"dist",
"lib",
Expand Down
27 changes: 27 additions & 0 deletions types/affix.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types

import { AntdComponent } from './component';

export declare class 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;
}
64 changes: 64 additions & 0 deletions types/alert.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types

import { AntdComponent } from './component';

export declare class 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";
}
19 changes: 19 additions & 0 deletions types/anchor/anchor-link.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types

import { AntdComponent } from "../component";

export declare class AnchorLink extends AntdComponent {
/**
* target of hyperlink
* @type string
*/
href: string;

/**
* content of hyperlink
* @type any (string | slot)
*/
title: any;
}
51 changes: 51 additions & 0 deletions types/anchor/anchor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types

import { AntdComponent } from '../component';
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;
}
127 changes: 127 additions & 0 deletions types/ant-design-vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types

import 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
};
Loading

0 comments on commit 0e499ee

Please sign in to comment.