Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
3086f720
"Dockerfile" did not exist on "ade5cbba31e2e92b20f024e60c5263dc3b52bd49"
Commit
3086f720
authored
Jun 05, 2018
by
jim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix eslint error
parent
e6e305d5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
54 deletions
+77
-54
src/components/CountDown/index.js
src/components/CountDown/index.js
+10
-10
src/components/SiderMenu/SiderMenu.js
src/components/SiderMenu/SiderMenu.js
+10
-10
src/components/StandardTable/index.js
src/components/StandardTable/index.js
+16
-12
src/components/TagSelect/index.js
src/components/TagSelect/index.js
+5
-6
src/routes/Dashboard/Analysis.js
src/routes/Dashboard/Analysis.js
+1
-8
src/routes/Forms/TableForm.js
src/routes/Forms/TableForm.js
+8
-8
src/utils/Yuan.js
src/utils/Yuan.js
+27
-0
No files found.
src/components/CountDown/index.js
View file @
3086f720
...
...
@@ -23,16 +23,6 @@ const initTime = props => {
};
class
CountDown
extends
Component
{
static
getDerivedStateFromProps
(
nextProps
,
preState
)
{
const
{
lastTime
}
=
initTime
(
nextProps
);
if
(
preState
.
lastTime
!==
lastTime
)
{
return
{
lastTime
,
};
}
return
null
;
}
constructor
(
props
)
{
super
(
props
);
...
...
@@ -43,6 +33,16 @@ class CountDown extends Component {
};
}
static
getDerivedStateFromProps
(
nextProps
,
preState
)
{
const
{
lastTime
}
=
initTime
(
nextProps
);
if
(
preState
.
lastTime
!==
lastTime
)
{
return
{
lastTime
,
};
}
return
null
;
}
componentDidMount
()
{
this
.
tick
();
}
...
...
src/components/SiderMenu/SiderMenu.js
View file @
3086f720
...
...
@@ -65,16 +65,6 @@ export const getMenuMatchKeys = (flatMenuKeys, paths) =>
);
export
default
class
SiderMenu
extends
PureComponent
{
static
getDerivedStateFromProps
(
props
,
state
)
{
const
{
pathname
}
=
state
;
if
(
props
.
location
.
pathname
!==
pathname
)
{
return
{
pathname
:
props
.
location
.
pathname
,
openKeys
:
getDefaultCollapsedSubMenus
(
props
),
};
}
return
null
;
}
constructor
(
props
)
{
super
(
props
);
this
.
menus
=
props
.
menuData
;
...
...
@@ -85,6 +75,16 @@ export default class SiderMenu extends PureComponent {
};
}
static
getDerivedStateFromProps
(
props
,
state
)
{
const
{
pathname
}
=
state
;
if
(
props
.
location
.
pathname
!==
pathname
)
{
return
{
pathname
:
props
.
location
.
pathname
,
openKeys
:
getDefaultCollapsedSubMenus
(
props
),
};
}
return
null
;
}
/**
* Convert pathname to openKeys
* /list/search/articles = > ['list','/list/search']
...
...
src/components/StandardTable/index.js
View file @
3086f720
...
...
@@ -13,6 +13,16 @@ function initTotalList(columns) {
}
class
StandardTable
extends
PureComponent
{
constructor
(
props
)
{
super
(
props
);
const
{
columns
}
=
props
;
const
needTotalList
=
initTotalList
(
columns
);
this
.
state
=
{
selectedRowKeys
:
[],
needTotalList
,
};
}
static
getDerivedStateFromProps
(
nextProps
)
{
// clean state
if
(
nextProps
.
selectedRows
.
length
===
0
)
{
...
...
@@ -24,17 +34,6 @@ class StandardTable extends PureComponent {
}
return
null
;
}
constructor
(
props
)
{
super
(
props
);
const
{
columns
}
=
props
;
const
needTotalList
=
initTotalList
(
columns
);
this
.
state
=
{
selectedRowKeys
:
[],
needTotalList
,
};
}
handleRowSelectChange
=
(
selectedRowKeys
,
selectedRows
)
=>
{
let
needTotalList
=
[...
this
.
state
.
needTotalList
];
needTotalList
=
needTotalList
.
map
(
item
=>
{
...
...
@@ -63,7 +62,12 @@ class StandardTable extends PureComponent {
render
()
{
const
{
selectedRowKeys
,
needTotalList
}
=
this
.
state
;
const
{
data
:
{
list
,
pagination
},
loading
,
columns
,
rowKey
}
=
this
.
props
;
const
{
data
:
{
list
,
pagination
},
loading
,
columns
,
rowKey
,
}
=
this
.
props
;
const
paginationProps
=
{
showSizeChanger
:
true
,
...
...
src/components/TagSelect/index.js
View file @
3086f720
...
...
@@ -15,18 +15,17 @@ const TagSelectOption = ({ children, checked, onChange, value }) => (
TagSelectOption
.
isTagSelectOption
=
true
;
class
TagSelect
extends
Component
{
state
=
{
expand
:
false
,
value
:
this
.
props
.
value
||
this
.
props
.
defaultValue
||
[],
};
static
getDerivedStateFromProps
(
nextProps
)
{
if
(
'
value
'
in
nextProps
&&
nextProps
.
value
)
{
return
{
value
:
nextProps
.
value
};
}
return
null
;
}
state
=
{
expand
:
false
,
value
:
this
.
props
.
value
||
this
.
props
.
defaultValue
||
[],
};
onChange
=
value
=>
{
const
{
onChange
}
=
this
.
props
;
if
(
!
(
'
value
'
in
this
.
props
))
{
...
...
src/routes/Dashboard/Analysis.js
View file @
3086f720
...
...
@@ -15,7 +15,6 @@ import {
}
from
'
antd
'
;
import
{
ChartCard
,
yuan
,
MiniArea
,
MiniBar
,
MiniProgress
,
...
...
@@ -28,7 +27,7 @@ import Trend from 'components/Trend';
import
NumberInfo
from
'
components/NumberInfo
'
;
import
numeral
from
'
numeral
'
;
import
GridContent
from
'
../../layouts/GridContent
'
;
import
Yuan
from
'
../../utils/Yuan
'
;
import
{
getTimeDistance
}
from
'
../../utils/utils
'
;
import
styles
from
'
./Analysis.less
'
;
...
...
@@ -44,12 +43,6 @@ for (let i = 0; i < 7; i += 1) {
});
}
const
Yuan
=
({
children
})
=>
(
<
span
dangerouslySetInnerHTML
=
{{
__html
:
yuan
(
children
)
}}
/> /
*
eslint
-
disable
-
line
react
/
no
-
danger
*
/
);
@
connect
(({
chart
,
loading
})
=>
({
chart
,
loading
:
loading
.
effects
[
'
chart/fetch
'
],
...
...
src/routes/Forms/TableForm.js
View file @
3086f720
...
...
@@ -3,14 +3,6 @@ import { Table, Button, Input, message, Popconfirm, Divider } from 'antd';
import
styles
from
'
./style.less
'
;
export
default
class
TableForm
extends
PureComponent
{
static
getDerivedStateFromProps
(
nextProps
)
{
if
(
'
value
'
in
nextProps
)
{
return
{
data
:
nextProps
.
value
,
};
}
return
null
;
}
constructor
(
props
)
{
super
(
props
);
...
...
@@ -21,6 +13,14 @@ export default class TableForm extends PureComponent {
};
}
static
getDerivedStateFromProps
(
nextProps
)
{
if
(
'
value
'
in
nextProps
)
{
return
{
data
:
nextProps
.
value
,
};
}
return
null
;
}
getRowByKey
(
key
,
newData
)
{
return
(
newData
||
this
.
state
.
data
).
filter
(
item
=>
item
.
key
===
key
)[
0
];
}
...
...
src/utils/Yuan.js
0 β 100644
View file @
3086f720
import
React
from
'
react
'
;
import
{
yuan
}
from
'
components/Charts
'
;
/**
* εε°δ½Ώη¨ dangerouslySetInnerHTML
*/
export
default
class
Yuan
extends
React
.
PureComponent
{
componentDidMount
()
{
this
.
rendertoHtml
();
}
componentDidUpdate
()
{
this
.
rendertoHtml
();
}
rendertoHtml
=
()
=>
{
if
(
this
.
main
)
{
this
.
main
.
innerHTML
=
yuan
(
this
.
props
.
children
);
}
};
render
()
{
return
(
<
span
ref
=
{
ref
=>
{
this
.
main
=
ref
;
}}
/
>
);
}
}
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