Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
a50a4faa
Commit
a50a4faa
authored
Oct 19, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update form styles
parent
5580703f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
39 deletions
+78
-39
src/components/Result/index.less
src/components/Result/index.less
+4
-4
src/routes/Forms/AdvancedForm.js
src/routes/Forms/AdvancedForm.js
+1
-1
src/routes/Forms/StepForm/Step1.js
src/routes/Forms/StepForm/Step1.js
+1
-1
src/routes/Forms/StepForm/style.less
src/routes/Forms/StepForm/style.less
+19
-8
src/routes/Forms/TableForm.js
src/routes/Forms/TableForm.js
+37
-12
src/routes/Forms/style.less
src/routes/Forms/style.less
+16
-13
No files found.
src/components/Result/index.less
View file @
a50a4faa
...
@@ -24,19 +24,19 @@
...
@@ -24,19 +24,19 @@
color: @heading-color;
color: @heading-color;
font-weight: 500;
font-weight: 500;
line-height: 32px;
line-height: 32px;
margin-bottom:
16
px;
margin-bottom:
8
px;
}
}
.description {
.description {
font-size: 14px;
font-size: 14px;
color: @text-color-secondary;
color: @text-color-secondary;
margin-bottom:
24
px;
margin-bottom:
16
px;
}
}
.extra {
.extra {
background: #fafafa;
background: #fafafa;
padding:
24
px 40px;
padding:
16
px 40px;
margin-top:
24
px;
margin-top:
16
px;
border-radius: @border-radius-sm;
border-radius: @border-radius-sm;
text-align: left;
text-align: left;
}
}
...
...
src/routes/Forms/AdvancedForm.js
View file @
a50a4faa
...
@@ -97,7 +97,7 @@ function AdvancedForm({ form, dispatch, submitting }) {
...
@@ -97,7 +97,7 @@ function AdvancedForm({ form, dispatch, submitting }) {
<
PageHeaderLayout
<
PageHeaderLayout
title
=
"
高级表单
"
title
=
"
高级表单
"
content
=
"
在后台页面中,大批量的数据修改和提交是很常见的情况。
"
content
=
"
在后台页面中,大批量的数据修改和提交是很常见的情况。
"
wrapperClassName
=
{
styles
.
withFooterToolbar
}
wrapperClassName
=
{
styles
.
advancedForm
}
>
>
<
Card
title
=
"
仓库管理
"
className
=
{
styles
.
card
}
bordered
=
{
false
}
>
<
Card
title
=
"
仓库管理
"
className
=
{
styles
.
card
}
bordered
=
{
false
}
>
<
Form
layout
=
"
vertical
"
hideRequiredMark
>
<
Form
layout
=
"
vertical
"
hideRequiredMark
>
...
...
src/routes/Forms/StepForm/Step1.js
View file @
a50a4faa
...
@@ -91,7 +91,7 @@ export default ({ formItemLayout, form, dispatch }) => {
...
@@ -91,7 +91,7 @@ export default ({ formItemLayout, form, dispatch }) => {
<
/Button
>
<
/Button
>
<
/Form.Item
>
<
/Form.Item
>
<
/Form
>
<
/Form
>
<
Divider
style
=
{{
margin
:
'
4
8px 0 16
px
'
}}
/
>
<
Divider
style
=
{{
margin
:
'
4
0px 0 24
px
'
}}
/
>
<
div
className
=
{
styles
.
desc
}
>
<
div
className
=
{
styles
.
desc
}
>
<
h3
>
说明
<
/h3
>
<
h3
>
说明
<
/h3
>
<
h4
>
转账到支付宝账户
<
/h4
>
<
h4
>
转账到支付宝账户
<
/h4
>
...
...
src/routes/Forms/StepForm/style.less
View file @
a50a4faa
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
}
}
.stepFormText {
.stepFormText {
margin-bottom: 24px;
:global {
:global {
.ant-form-item-label,
.ant-form-item-label,
.ant-form-item-control {
.ant-form-item-control {
...
@@ -16,26 +17,36 @@
...
@@ -16,26 +17,36 @@
.result {
.result {
margin: 0 auto;
margin: 0 auto;
max-width: 5
2
0px;
max-width: 5
6
0px;
padding:
32
px 0;
padding:
24
px 0;
}
}
.desc {
.desc {
h3 {
h3 {
font-size: 1
4
px;
font-size: 1
6
px;
margin:
8
px 0;
margin:
0 0 12
px 0;
color: @text-color-secondary;
color: @text-color-secondary;
line-height: 32px;
}
}
h4 {
h4 {
margin:
2
px 0;
margin:
0 0 4
px 0;
color: @text-color-secondary;
color: @text-color-secondary;
font-size: 14px;
line-height: 22px;
}
}
p {
p {
margin-bottom: 16px;
margin-top: 0;
margin-bottom: 12px;
line-height: 22px;
}
}
padding: 0
34
px;
padding: 0
80
px;
color: @text-color-secondary;
color: @text-color-secondary;
font-size: 12px;
}
@media screen and (max-width: @screen-md) {
.desc {
padding: 0;
}
}
}
.information {
.information {
...
...
src/routes/Forms/TableForm.js
View file @
a50a4faa
import
React
,
{
PureComponent
}
from
'
react
'
;
import
React
,
{
PureComponent
}
from
'
react
'
;
import
{
Table
,
Button
,
Input
,
message
}
from
'
antd
'
;
import
{
Table
,
Button
,
Input
,
message
,
Popconfirm
}
from
'
antd
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
export
default
class
TableForm
extends
PureComponent
{
export
default
class
TableForm
extends
PureComponent
{
...
@@ -45,8 +45,7 @@ export default class TableForm extends PureComponent {
...
@@ -45,8 +45,7 @@ export default class TableForm extends PureComponent {
this
.
setState
({
data
:
[...
this
.
state
.
data
]
});
this
.
setState
({
data
:
[...
this
.
state
.
data
]
});
}
}
}
}
remove
(
e
,
key
)
{
remove
(
key
)
{
e
.
preventDefault
();
const
newData
=
this
.
state
.
data
.
filter
(
item
=>
item
.
key
!==
key
);
const
newData
=
this
.
state
.
data
.
filter
(
item
=>
item
.
key
!==
key
);
this
.
setState
({
data
:
newData
});
this
.
setState
({
data
:
newData
});
this
.
props
.
onChange
(
newData
);
this
.
props
.
onChange
(
newData
);
...
@@ -64,6 +63,11 @@ export default class TableForm extends PureComponent {
...
@@ -64,6 +63,11 @@ export default class TableForm extends PureComponent {
this
.
index
+=
1
;
this
.
index
+=
1
;
this
.
setState
({
data
:
newData
});
this
.
setState
({
data
:
newData
});
}
}
handleKeyPress
(
e
,
key
)
{
if
(
e
.
key
===
'
Enter
'
)
{
this
.
saveRow
(
e
,
key
);
}
}
handleFieldChange
(
e
,
fieldName
,
key
)
{
handleFieldChange
(
e
,
fieldName
,
key
)
{
const
newData
=
[...
this
.
state
.
data
];
const
newData
=
[...
this
.
state
.
data
];
const
target
=
this
.
getRowByKey
(
key
);
const
target
=
this
.
getRowByKey
(
key
);
...
@@ -73,16 +77,29 @@ export default class TableForm extends PureComponent {
...
@@ -73,16 +77,29 @@ export default class TableForm extends PureComponent {
}
}
}
}
saveRow
(
e
,
key
)
{
saveRow
(
e
,
key
)
{
const
target
=
this
.
getRowByKey
(
key
);
e
.
persist
();
delete
target
.
isNew
;
// save field when blur input
if
(
!
target
.
workId
||
!
target
.
name
||
!
target
.
department
)
{
setTimeout
(()
=>
{
message
.
error
(
'
请填写完整成员信息。
'
);
if
(
document
.
activeElement
.
tagName
===
'
INPUT
'
&&
return
;
document
.
activeElement
!==
e
.
target
)
{
}
return
;
this
.
toggleEditable
(
e
,
key
);
}
this
.
props
.
onChange
(
this
.
state
.
data
);
if
(
this
.
clickedCancel
)
{
this
.
clickedCancel
=
false
;
return
;
}
const
target
=
this
.
getRowByKey
(
key
);
delete
target
.
isNew
;
if
(
!
target
.
workId
||
!
target
.
name
||
!
target
.
department
)
{
message
.
error
(
'
请填写完整成员信息。
'
);
return
;
}
this
.
toggleEditable
(
e
,
key
);
this
.
props
.
onChange
(
this
.
state
.
data
);
},
10
);
}
}
cancel
(
e
,
key
)
{
cancel
(
e
,
key
)
{
this
.
clickedCancel
=
true
;
e
.
preventDefault
();
e
.
preventDefault
();
const
target
=
this
.
getRowByKey
(
key
);
const
target
=
this
.
getRowByKey
(
key
);
if
(
this
.
cacheOriginData
[
key
])
{
if
(
this
.
cacheOriginData
[
key
])
{
...
@@ -105,6 +122,8 @@ export default class TableForm extends PureComponent {
...
@@ -105,6 +122,8 @@ export default class TableForm extends PureComponent {
value
=
{
text
}
value
=
{
text
}
autoFocus
autoFocus
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
name
'
,
record
.
key
)}
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
name
'
,
record
.
key
)}
onBlur
=
{
e
=>
this
.
saveRow
(
e
,
record
.
key
)}
onKeyPress
=
{
e
=>
this
.
handleKeyPress
(
e
,
record
.
key
)}
placeholder
=
"
成员姓名
"
placeholder
=
"
成员姓名
"
/>
/>
);
);
...
@@ -122,6 +141,8 @@ export default class TableForm extends PureComponent {
...
@@ -122,6 +141,8 @@ export default class TableForm extends PureComponent {
<
Input
<
Input
value
=
{
text
}
value
=
{
text
}
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
workId
'
,
record
.
key
)}
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
workId
'
,
record
.
key
)}
onBlur
=
{
e
=>
this
.
saveRow
(
e
,
record
.
key
)}
onKeyPress
=
{
e
=>
this
.
handleKeyPress
(
e
,
record
.
key
)}
placeholder
=
"
工号
"
placeholder
=
"
工号
"
/>
/>
);
);
...
@@ -139,6 +160,8 @@ export default class TableForm extends PureComponent {
...
@@ -139,6 +160,8 @@ export default class TableForm extends PureComponent {
<
Input
<
Input
value
=
{
text
}
value
=
{
text
}
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
department
'
,
record
.
key
)}
onChange
=
{
e
=>
this
.
handleFieldChange
(
e
,
'
department
'
,
record
.
key
)}
onBlur
=
{
e
=>
this
.
saveRow
(
e
,
record
.
key
)}
onKeyPress
=
{
e
=>
this
.
handleKeyPress
(
e
,
record
.
key
)}
placeholder
=
"
所属部门
"
placeholder
=
"
所属部门
"
/>
/>
);
);
...
@@ -171,7 +194,9 @@ export default class TableForm extends PureComponent {
...
@@ -171,7 +194,9 @@ export default class TableForm extends PureComponent {
<
span
>
<
span
>
<
a
onClick
=
{
e
=>
this
.
toggleEditable
(
e
,
record
.
key
)}
>
编辑
<
/a
>
<
a
onClick
=
{
e
=>
this
.
toggleEditable
(
e
,
record
.
key
)}
>
编辑
<
/a
>
<
span
className
=
"
ant-divider
"
/>
<
span
className
=
"
ant-divider
"
/>
<
a
onClick
=
{
e
=>
this
.
remove
(
e
,
record
.
key
)}
>
删除
<
/a
>
<
Popconfirm
title
=
"
是否要删除此行?
"
onConfirm
=
{()
=>
this
.
remove
(
record
.
key
)}
>
<
a
>
删除
<
/a
>
<
/Popconfirm
>
<
/span
>
<
/span
>
);
);
},
},
...
...
src/routes/Forms/style.less
View file @
a50a4faa
...
@@ -15,13 +15,6 @@
...
@@ -15,13 +15,6 @@
margin: 16px auto;
margin: 16px auto;
}
}
.divider {
border: 0;
border-top: 1px solid @border-color-split;
height: 1px;
margin: 0 0 24px 0;
}
.errorIcon {
.errorIcon {
cursor: pointer;
cursor: pointer;
color: @error-color;
color: @error-color;
...
@@ -37,7 +30,7 @@
...
@@ -37,7 +30,7 @@
padding: 0;
padding: 0;
max-height: 290px;
max-height: 290px;
overflow: auto;
overflow: auto;
min-width: 2
40
px;
min-width: 2
56
px;
}
}
}
}
}
}
...
@@ -45,7 +38,7 @@
...
@@ -45,7 +38,7 @@
.errorListItem {
.errorListItem {
list-style: none;
list-style: none;
border-bottom: 1px solid @border-color-split;
border-bottom: 1px solid @border-color-split;
padding: 8px
24
px;
padding: 8px
16
px;
cursor: pointer;
cursor: pointer;
transition: all .3s;
transition: all .3s;
&:hover {
&:hover {
...
@@ -58,13 +51,13 @@
...
@@ -58,13 +51,13 @@
color: @error-color;
color: @error-color;
float: left;
float: left;
margin-top: 4px;
margin-top: 4px;
margin-right:
8
px;
margin-right:
12
px;
padding-bottom: 22px;
padding-bottom: 22px;
}
}
.errorField {
.errorField {
font-size: 12px;
font-size: 12px;
color: @text-color-secondary;
color: @text-color-secondary;
margin-top:
4
px;
margin-top:
2
px;
}
}
}
}
...
@@ -72,15 +65,25 @@
...
@@ -72,15 +65,25 @@
td {
td {
padding-top: 13px !important;
padding-top: 13px !important;
padding-bottom: 12.5px !important;
padding-bottom: 12.5px !important;
transition: none !important;
}
}
}
}
// custom footer for fixed footer toolbar
// custom footer for fixed footer toolbar
.
withFooterToolbar
+ div {
.
advancedForm
+ div {
padding-bottom: 64px;
padding-bottom: 64px;
}
}
.advancedForm {
:global {
.ant-form .ant-row:last-child .ant-form-item {
margin-bottom: 24px;
}
.ant-table td {
transition: none !important;
}
}
}
.optional {
.optional {
color: @text-color-secondary;
color: @text-color-secondary;
font-style: normal;
font-style: normal;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment