From ffc4a11f68329c0783249937f0fe5f2900fd7e21 Mon Sep 17 00:00:00 2001
From: bang
Date: Fri, 11 Mar 2016 16:53:35 +0800
Subject: [PATCH] Type definitions for Antd
---
antd/antd-tests.tsx | 483 ++++++++++++++++++
antd/antd.d.ts | 1148 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 1631 insertions(+)
create mode 100644 antd/antd-tests.tsx
create mode 100644 antd/antd.d.ts
diff --git a/antd/antd-tests.tsx b/antd/antd-tests.tsx
new file mode 100644
index 0000000000..91cf213d8f
--- /dev/null
+++ b/antd/antd-tests.tsx
@@ -0,0 +1,483 @@
+///
+///
+import React = __React
+/*import {
+ Affix,
+ Button,
+ Alert,
+ Badge,
+ Breadcrumb,
+ Calendar,
+ Carousel,
+ Cascader,
+ Checkbox,
+ Collapse,
+ DatePicker,
+ Dropdown,
+ Icon,
+ Form,
+ Input,
+ InputNumber,
+ Row,
+ Col,
+ Menu,
+ message,
+ Modal,
+ Notification,
+ Pagination,
+ Popconfirm,
+ Popover,
+ Progress,
+ QueueAnim,
+ Radio,
+ Select,
+ Slider,
+ Spin,
+ Steps,
+ Switch,
+ Table,
+ Tabs,
+ Tag,
+ TimePicker,
+ Timeline,
+ Tooltip,
+ Transfer,
+ Tree,
+ TreeSelect,
+ Upload,
+
+
+
+} from 'antd';*/
+
+import Affix from 'antd/lib/Affix'
+import Button from 'antd/lib/Button'
+import Alert from 'antd/lib/Alert'
+import Badge from 'antd/lib/Badge'
+import Breadcrumb from 'antd/lib/Breadcrumb'
+import Calendar from 'antd/lib/Calendar'
+import Carousel from 'antd/lib/Carousel'
+import Cascader from 'antd/lib/Cascader'
+import Checkbox from 'antd/lib/Checkbox'
+import Collapse from 'antd/lib/Collapse'
+import DatePicker from 'antd/lib/DatePicker'
+import Dropdown from 'antd/lib/Dropdown'
+import Icon from 'antd/lib/Icon'
+import Form from 'antd/lib/Form'
+import Input from 'antd/lib/Input'
+import InputNumber from 'antd/lib/InputNumber'
+import Row from 'antd/lib/Row'
+import Col from 'antd/lib/Col'
+import Menu from 'antd/lib/Menu'
+import message from 'antd/lib/message'
+import Modal from 'antd/lib/Modal'
+import Notification from 'antd/lib/Notification'
+import Pagination from 'antd/lib/Pagination'
+import Popconfirm from 'antd/lib/Popconfirm'
+import Popover from 'antd/lib/Popover'
+import Progress from 'antd/lib/Progress'
+import QueueAnim from 'antd/lib/QueueAnim'
+import Radio from 'antd/lib/Radio'
+import Select from 'antd/lib/Select'
+import Slider from 'antd/lib/Slider'
+import Spin from 'antd/lib/Spin'
+import Steps from 'antd/lib/Steps'
+import Switch from 'antd/lib/Switch'
+import Table from 'antd/lib/Table'
+import Tabs from 'antd/lib/Tabs'
+import Tag from 'antd/lib/Tag'
+import TimePicker from 'antd/lib/TimePicker'
+import Timeline from 'antd/lib/Timeline'
+import Tooltip from 'antd/lib/Tooltip'
+import Transfer from 'antd/lib/Transfer'
+import Tree from 'antd/lib/Tree'
+import TreeSelect from 'antd/lib/TreeSelect'
+import Upload from 'antd/lib/Upload'
+
+const ButtonGroup = Button.Group;
+const CheckboxGroup = Checkbox.Group;
+const Panel = Collapse.Panel;
+const RangePicker = DatePicker.RangePicker;
+const MonthPicker = DatePicker.MonthPicker;
+const DropdownButton = Dropdown.Button;
+const SubMenu = Menu.SubMenu;
+const MenuItemGroup = Menu.ItemGroup;
+const ProgressCircle = Progress.Circle;
+const ProgressLine = Progress.Line;
+const RadioGroup = Radio.Group;
+const Option = Select.Option;
+const OptGroup = Select.OptGroup;
+const Step = Steps.Step;
+const FormItem = Form.Item;
+const TabPane = Tabs.TabPane;
+const TreeNode = Tree.TreeNode;
+const TreeSelectTreeNode = TreeSelect.TreeNode;
+
+const onChange = () => { }
+
+const options = [{
+ value: 'zhejiang',
+ label: '浙江',
+ children: [{
+ value: 'hangzhou',
+ label: '杭州',
+ children: [{
+ value: 'xihu',
+ label: '西湖',
+ }],
+ }],
+}, {
+ value: 'jiangsu',
+ label: '江苏',
+ children: [{
+ value: 'nanjing',
+ label: '南京',
+ children: [{
+ value: 'zhonghuamen',
+ label: '中华门',
+ }],
+ }],
+ }];
+
+const columns = [{
+ title: '姓名',
+ dataIndex: 'name',
+ key: 'name',
+ render(text: any) {
+ return {text};
+ }
+}, {
+ title: '年龄',
+ dataIndex: 'age',
+ key: 'age',
+ }, {
+ title: '住址',
+ dataIndex: 'address',
+ key: 'address',
+ }, {
+ title: '操作',
+ key: 'operation',
+ render(text: any, record: any) {
+ return (
+
+ 操作一{record.name}
+
+ 操作二
+
+
+ 更多
+
+
+ );
+ }
+ }];
+const data = [{
+ key: '1',
+ name: '胡彦斌',
+ age: 32,
+ address: '西湖区湖底公园1号'
+}, {
+ key: '2',
+ name: '胡彦祖',
+ age: 42,
+ address: '西湖区湖底公园1号'
+ }, {
+ key: '3',
+ name: '李大嘴',
+ age: 32,
+ address: '西湖区湖底公园1号'
+ }];
+
+// tests
+class AccountForm extends React.Component{
+ render() {
+ const { getFieldProps } = this.props.form;
+ return (
+
+ );
+ }
+}
+
+var Account = Form.create()(AccountForm);
+
+// app
+class App extends React.Component{
+ render() {
+ message.success('success')
+ message.config({ top: 100 })
+ message.destroy()
+ message.info('info', 1000)
+ message.error('error', 3500)
+
+ Modal.info({ title: 'hello' });
+ Modal.success({ cancelText: 'No' })
+ Notification.success({
+ message: 'hello',
+ description: 'test'
+ })
+ const props = {
+ name: 'file',
+ action: '/upload.do',
+ onChange(info: any) {
+ if (info.file.status !== 'uploading') {
+ console.log(info.file, info.fileList);
+ }
+ if (info.file.status === 'done') {
+ message.success(`${info.file.name} 上传成功。`);
+ } else if (info.file.status === 'error') {
+ message.error(`${info.file.name} 上传失败。`);
+ }
+ }
+ };
+ return
+
Affix
+
+
+ test
+
+
+
+
+
+
+
+
+
+
+
+ 首页
+ 应用中心
+ 应用列表
+ 某应用
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+
+
+
+ test1
+
+
+ test2
+
+
+ test3
+
+
+
+
+
+ Hello Dp }>
+
+ 触发链接
+
+
+ dpb
} type="primary">
+ 某功能按钮
+
+
+
+
+
+
+
+
+
+
+
+ ,
+
+
+ remove
+
+ Overlay} title="title">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ demo1
+ demo2
+ demo3
+ demo4
+
+
+
+ A
+ B
+ C
+ D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ,
+
+
+
+ 选项卡一内容
+ 选项卡二内容
+ 选项卡三内容
+
+
+ 标签一
+ 标签二
+ { } }>标签三
+ 标签四(链接)
+
+
+
+
+
+ 创建服务现场 2015-09-01
+ 初步排除网络异常 2015-09-01
+ 技术测试异常 2015-09-01
+ 网络异常正在修复 2015-09-01
+
+
+
+
+ 鼠标移上来就会出现提示
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sss} key="0-0-1-0" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sss} key="random3" />
+
+
+
+
+
+ }
+}
diff --git a/antd/antd.d.ts b/antd/antd.d.ts
new file mode 100644
index 0000000000..96e473c544
--- /dev/null
+++ b/antd/antd.d.ts
@@ -0,0 +1,1148 @@
+// Type definitions for Antd v0.12.8
+// Project: http://ant.design
+// Definitions by: bang88
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+///
+declare namespace Antd {
+
+ import React = __React
+
+ // Affix
+ interface AffixProps extends React.Props {
+ offset?: number
+ }
+ export class Affix extends React.Component{ }
+
+
+ // Alert
+ interface AlertProps extends React.Props {
+ type: string,
+ closable?: boolean,
+ closeText?: React.ReactNode,
+ message: React.ReactNode,
+ description?: React.ReactNode,
+ onClose?: Function,
+ showIcon?: boolean
+ }
+ export class Alert extends React.Component{ }
+
+
+ // Badge
+ export class Badge extends React.Component{ }
+ interface BadgeProps extends React.Props {
+ count: number,
+ overflowCount?: number,
+ dot?: boolean
+ }
+
+
+ // Button
+ interface ButtonProps extends React.Props