Skip to content

Commit 0e499ee

Browse files
akki-jattangjinzhou
authored andcommitted
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)
1 parent 94d2515 commit 0e499ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6516
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"frontend"
1717
],
1818
"main": "dist/antd.min.js",
19+
"typings": "types/index.d.ts",
1920
"files": [
2021
"dist",
2122
"lib",

types/affix.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Project: https://github.com/vueComponent/ant-design-vue
2+
// Definitions by: akki-jat <https://github.com/akki-jat>
3+
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4+
5+
import { AntdComponent } from './component';
6+
7+
export declare class Affix extends AntdComponent {
8+
/**
9+
* Pixels to offset from top when calculating position of scroll
10+
* @default 0
11+
* @type number
12+
*/
13+
offsetTop: number;
14+
15+
/**
16+
* Pixels to offset from bottom when calculating position of scroll
17+
* @type number
18+
*/
19+
offsetBottom: number;
20+
21+
/**
22+
* specifies the scrollable area dom node
23+
* @default () => window
24+
* @type Function
25+
*/
26+
target: () => HTMLElement;
27+
}

types/alert.d.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Project: https://github.com/vueComponent/ant-design-vue
2+
// Definitions by: akki-jat <https://github.com/akki-jat>
3+
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4+
5+
import { AntdComponent } from './component';
6+
7+
export declare class Alert extends AntdComponent {
8+
/**
9+
* Called when close animation is finished
10+
* @type Function
11+
*/
12+
afterClose: () => void;
13+
14+
/**
15+
* Whether to show as banner
16+
* @default false
17+
* @type boolean
18+
*/
19+
banner: boolean;
20+
21+
/**
22+
* Whether Alert can be closed
23+
* @type boolean
24+
*/
25+
closable: boolean;
26+
27+
/**
28+
* Close text to show
29+
* @type any (string | slot)
30+
*/
31+
closeText: any;
32+
33+
/**
34+
* additional content of Alert
35+
* @type any (string | slot)
36+
*/
37+
description: any;
38+
39+
/**
40+
* Custom icon, effective when showIcon is true
41+
* @type any (VNode | slot)
42+
*/
43+
icon: any;
44+
45+
/**
46+
* Content of Alert
47+
* @type any (string | slot)
48+
*/
49+
message: any;
50+
51+
/**
52+
* Whether to show icon
53+
* @default false, in banner mode default is true
54+
* @type boolean
55+
*/
56+
showIcon: boolean;
57+
58+
/**
59+
* Type of Alert styles, options: success, info, warning, error
60+
* @default info, in banner mode default is warning
61+
* @type string
62+
*/
63+
type: "success" | "info" | "warning" | "error";
64+
}

types/anchor/anchor-link.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Project: https://github.com/vueComponent/ant-design-vue
2+
// Definitions by: akki-jat <https://github.com/akki-jat>
3+
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4+
5+
import { AntdComponent } from "../component";
6+
7+
export declare class AnchorLink extends AntdComponent {
8+
/**
9+
* target of hyperlink
10+
* @type string
11+
*/
12+
href: string;
13+
14+
/**
15+
* content of hyperlink
16+
* @type any (string | slot)
17+
*/
18+
title: any;
19+
}

types/anchor/anchor.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Project: https://github.com/vueComponent/ant-design-vue
2+
// Definitions by: akki-jat <https://github.com/akki-jat>
3+
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4+
5+
import { AntdComponent } from '../component';
6+
import { AnchorLink } from "./anchor-link";
7+
8+
export declare class Anchor extends AntdComponent {
9+
static Link: AnchorLink;
10+
11+
/**
12+
* Fixed mode of Anchor
13+
* @default true
14+
* @type boolean
15+
*/
16+
affix: boolean;
17+
18+
/**
19+
* Bounding distance of anchor area
20+
* @default 5
21+
* @type number
22+
*/
23+
bounds: number;
24+
25+
/**
26+
* Scrolling container
27+
* @default () => window
28+
* @type Function
29+
*/
30+
getContainer: () => HTMLElement;
31+
32+
/**
33+
* Pixels to offset from bottom when calculating position of scroll
34+
* @type number
35+
*/
36+
offsetBottom: number;
37+
38+
/**
39+
* Pixels to offset from top when calculating position of scroll
40+
* @default 0
41+
* @type number
42+
*/
43+
offsetTop: number;
44+
45+
/**
46+
* Whether show ink-balls in Fixed mode
47+
* @default false
48+
* @type boolean
49+
*/
50+
showInkInFixed: boolean;
51+
}

types/ant-design-vue.d.ts

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Project: https://github.com/vueComponent/ant-design-vue
2+
// Definitions by: akki-jat <https://github.com/akki-jat>
3+
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4+
5+
import Vue from "vue";
6+
7+
import { Affix } from "./affix";
8+
import { Anchor } from "./anchor/anchor";
9+
import { AutoComplete } from "./auto-complete";
10+
import { Alert } from "./alert";
11+
import { Avatar } from "./avatar";
12+
import { BackTop } from "./back-top";
13+
import { Badge } from "./badge";
14+
import { Breadcrumb } from "./breadcrumb";
15+
import { Button } from "./button/button";
16+
import { Calendar } from "./calendar";
17+
import { Card } from "./card";
18+
import { Collapse } from "./collapse/collapse";
19+
import { Carousel } from "./carousel";
20+
import { Cascader } from "./cascader";
21+
import { Checkbox } from "./checkbox/checkbox";
22+
import { Col } from "./grid/col";
23+
import { DatePicker } from "./date-picker/date-picker";
24+
import { Divider } from "./divider";
25+
import { Dropdown } from "./dropdown/dropdown";
26+
import { Form } from "./form/form";
27+
import { Icon } from "./icon";
28+
import { Input } from "./input/input";
29+
import { InputNumber } from "./input-number";
30+
import { Layout } from "./layout/layout";
31+
import { List } from "./list/list";
32+
import { LocaleProvider } from "./locale-provider";
33+
import { Message } from "./message";
34+
import { Menu } from "./menu/menu";
35+
import { Modal } from "./modal";
36+
import { Notification } from "./notification";
37+
import { Pagination } from "./pagination";
38+
import { Popconfirm } from "./popconfirm";
39+
import { Popover } from "./popover";
40+
import { Progress } from "./progress";
41+
import { Radio } from "./radio/radio";
42+
import { Rate } from "./rate";
43+
import { Row } from "./grid/row";
44+
import { Select } from "./select/select";
45+
import { Slider } from "./slider";
46+
import { Spin } from "./spin";
47+
import { Steps } from "./steps/steps";
48+
import { Switch } from "./switch";
49+
import { Table } from "./table/table";
50+
import { Transfer } from "./transfer";
51+
import { Tree } from "./tree/tree";
52+
import { TreeSelect } from "./tree-select";
53+
import { Tabs } from "./tabs/tabs";
54+
import { Tag } from "./tag/tag";
55+
import { TimePicker } from "./time-picker";
56+
import { Timeline } from "./timeline/timeline";
57+
import { Tooltip } from "./tootip/tooltip";
58+
import { Upload } from "./upload";
59+
import { Drawer } from "./drawer";
60+
import { Skeleton } from "./skeleton";
61+
62+
/**
63+
* Install all ant-design-vue components into Vue.
64+
* Please do not invoke this method directly.
65+
* Call `Vue.use(Antd)` to install.
66+
*/
67+
export function install(vue: typeof Vue): void;
68+
69+
declare const message: Message;
70+
declare const notification: Notification;
71+
72+
export {
73+
Affix,
74+
Anchor,
75+
AutoComplete,
76+
Alert,
77+
Avatar,
78+
BackTop,
79+
Badge,
80+
Breadcrumb,
81+
Button,
82+
Calendar,
83+
Card,
84+
Collapse,
85+
Carousel,
86+
Cascader,
87+
Checkbox,
88+
Col,
89+
DatePicker,
90+
Divider,
91+
Dropdown,
92+
Form,
93+
Icon,
94+
Input,
95+
InputNumber,
96+
Layout,
97+
List,
98+
LocaleProvider,
99+
message,
100+
Menu,
101+
Modal,
102+
notification,
103+
Pagination,
104+
Popconfirm,
105+
Popover,
106+
Progress,
107+
Radio,
108+
Rate,
109+
Row,
110+
Select,
111+
Slider,
112+
Spin,
113+
Steps,
114+
Switch,
115+
Table,
116+
Transfer,
117+
Tree,
118+
TreeSelect,
119+
Tabs,
120+
Tag,
121+
TimePicker,
122+
Timeline,
123+
Tooltip,
124+
Upload,
125+
Drawer,
126+
Skeleton
127+
};

0 commit comments

Comments
 (0)