Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
2cffe4f8
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2cffe4f8
编写于
7月 10, 2018
作者:
陈
陈帅
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimization: Fix problems found in review
上级
9ad01141
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
46 deletion
+20
-46
components/_util/isNumeric.ts
components/_util/isNumeric.ts
+5
-0
components/drawer/demo/basic-left.md
components/drawer/demo/basic-left.md
+1
-1
components/drawer/demo/multi-level-drawer.md
components/drawer/demo/multi-level-drawer.md
+8
-36
components/drawer/index.en-US.md
components/drawer/index.en-US.md
+1
-1
components/drawer/index.tsx
components/drawer/index.tsx
+2
-1
components/drawer/style/drawer.less
components/drawer/style/drawer.less
+3
-7
未找到文件。
components/_util/isNumeric.ts
0 → 100644
浏览文件 @
2cffe4f8
const
isNumeric
=
(
value
:
any
):
boolean
=>
{
return
!
isNaN
(
parseFloat
(
value
))
&&
isFinite
(
value
);
};
export
default
isNumeric
;
components/drawer/demo/basic-left.md
浏览文件 @
2cffe4f8
...
...
@@ -2,7 +2,7 @@
order
:
1
title
:
zh-CN
:
左侧滑出
en-US
:
Left S
il
der
en-US
:
Left S
li
der
---
## zh-CN
...
...
components/drawer/demo/multi-level-drawer.md
浏览文件 @
2cffe4f8
...
...
@@ -14,20 +14,9 @@ title:
Open a new drawer on top of an existing drawer to handle multi branch tasks
```
jsx
import
{
Drawer
,
List
,
Form
,
Button
,
Input
,
Tag
}
from
'
antd
'
;
import
{
Drawer
,
Button
}
from
'
antd
'
;
const
vegetables
=
[
'
asparagus
'
,
'
bamboo
'
,
'
potato
'
,
'
carrot
'
,
'
cilantro
'
,
'
potato
'
,
'
eggplant
'
];
const
TagList
=
({
value
,
show
})
=>
{
return
(
<
div
>
{
value
.
map
(
item
=>
<
Tag
key
=
{
item
}
>
{
item
}
</
Tag
>)
}
<
Tag
onClick
=
{
()
=>
show
()
}
>
+
</
Tag
>
</
div
>
);
};
class
DrawerForm
extends
React
.
Component
{
class
App
extends
React
.
Component
{
state
=
{
visible
:
false
,
childrenDrawer
:
false
};
showDrawer
=
()
=>
{
...
...
@@ -55,33 +44,22 @@ class DrawerForm extends React.Component {
};
render
()
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
return
(
<
div
>
<
Button
type
=
"primary"
onClick
=
{
this
.
showDrawer
}
>
New Cookbook
Open drawer
</
Button
>
<
Drawer
title
=
"
Cookbook
"
title
=
"
Multi-level drawer
"
width
=
{
520
}
closable
=
{
false
}
onClose
=
{
this
.
onClose
}
visible
=
{
this
.
state
.
visible
}
push
=
{
this
.
state
.
childrenDrawer
}
>
<
Form
hideRequiredMark
>
<
Form
.
Item
label
=
"Name"
>
{
getFieldDecorator
(
'
name
'
,
{
rules
:
[{
required
:
true
,
message
:
'
please enter cookbook name
'
}],
})(<
Input
placeholder
=
"please enter cookbook name"
/>)
}
</
Form
.
Item
>
<
Form
.
Item
label
=
"Food"
>
{
getFieldDecorator
(
'
Food
'
,
{
rules
:
[{
required
:
true
,
message
:
'
please enter food
'
}],
initialValue
:
[
'
potato
'
,
'
eggplant
'
],
})(<
TagList
show
=
{
this
.
showChildrenDrawer
}
/>)
}
</
Form
.
Item
>
</
Form
>
<
Button
type
=
"primary"
onClick
=
{
this
.
showChildrenDrawer
}
>
Two-level drawer
</
Button
>
<
Drawer
title
=
"Food"
width
=
{
320
}
...
...
@@ -89,12 +67,7 @@ class DrawerForm extends React.Component {
onClose
=
{
this
.
onChildrenDrawerClose
}
visible
=
{
this
.
state
.
childrenDrawer
}
>
<
List
size
=
"small"
header
=
{
<
div
>
Vegetables
</
div
>
}
dataSource
=
{
vegetables
}
renderItem
=
{
item
=>
<
List
.
Item
>
{
item
}
</
List
.
Item
>
}
/>
This is two-level drawer
</
Drawer
>
<
div
style
=
{
{
...
...
@@ -126,7 +99,6 @@ class DrawerForm extends React.Component {
);
}
}
const
App
=
Form
.
create
()(
DrawerForm
);
ReactDOM
.
render
(<
App
/>,
mountNode
);
```
...
...
components/drawer/index.en-US.md
浏览文件 @
2cffe4f8
...
...
@@ -26,7 +26,7 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
| style | Style of floating layer, typically used for adjusting its position. | object | - |
| title | The title for Drawer. | string
\|
ReactNode | - |
| visible | Whether the Drawer dialog is visible or not. | boolean | false |
| width | Width of the Drawer dialog. | string
\|
number |
520
|
| width | Width of the Drawer dialog. | string
\|
number |
256
|
| wrapClassName | The class name of the container of the Drawer dialog. | string | - |
| zIndex | The
`z-index`
of the Drawer. | Number | 1000 |
| placement | The placement of the Drawer. | 'left'
\|
'right' | 'right'
...
...
components/drawer/index.tsx
浏览文件 @
2cffe4f8
...
...
@@ -2,6 +2,7 @@ import * as React from 'react';
import
RcDrawer
from
'
rc-drawer
'
;
import
PropTypes
from
'
prop-types
'
;
import
createReactContext
,
{
Context
}
from
'
create-react-context
'
;
import
isNumeric
from
'
../_util/isNumeric
'
;
const
DrawerContext
:
Context
<
Drawer
|
null
>
=
createReactContext
(
null
);
...
...
@@ -151,7 +152,7 @@ export default class Drawer extends React.Component<DrawerProps, IDrawerState> {
}
renderProvider
=
(
value
:
Drawer
)
=>
{
let
{
width
,
zIndex
,
style
,
placement
,
...
rest
}
=
this
.
props
;
if
(
typeof
width
===
'
number
'
)
{
if
(
isNumeric
(
width
)
)
{
width
=
`
${
width
}
px`
;
}
const
RcDrawerStyle
=
this
.
state
.
push
...
...
components/drawer/style/drawer.less
浏览文件 @
2cffe4f8
...
...
@@ -72,7 +72,6 @@
background-color: @component-background;
border: 0;
background-clip: padding-box;
box-shadow: @shadow-2;
z-index: 1;
}
...
...
@@ -147,12 +146,9 @@
&-open {
overflow: hidden;
&-content {
box-shadow: @shadow-2;
}
}
}
@media (max-width: @screen-md) {
.@{dawer-prefix-cls} {
width: auto !important;
margin: 10px;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录