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
fc9c88a1
Commit
fc9c88a1
authored
Aug 29, 2018
by
ζι
Committed by
εε³
Aug 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add lint react/sort-comp rule and fix it
parent
3d728ed2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
68 deletions
+79
-68
.eslintrc.js
.eslintrc.js
+1
-0
src/components/CountDown/index.js
src/components/CountDown/index.js
+13
-12
src/components/TagSelect/index.js
src/components/TagSelect/index.js
+7
-7
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+24
-17
src/pages/Account/Settings/Info.js
src/pages/Account/Settings/Info.js
+9
-9
src/pages/Forms/TableForm.js
src/pages/Forms/TableForm.js
+4
-3
src/pages/List/BasicList.js
src/pages/List/BasicList.js
+5
-4
src/pages/List/TableList.js
src/pages/List/TableList.js
+16
-16
No files found.
.eslintrc.js
View file @
fc9c88a1
...
@@ -10,6 +10,7 @@ module.exports = {
...
@@ -10,6 +10,7 @@ module.exports = {
},
},
rules
:
{
rules
:
{
'
jsx-a11y/href-no-hash
'
:
[
0
],
'
jsx-a11y/href-no-hash
'
:
[
0
],
'
react/sort-comp
'
:
1
,
},
},
settings
:
{
settings
:
{
polyfills
:
[
'
fetch
'
,
'
promises
'
],
polyfills
:
[
'
fetch
'
,
'
promises
'
],
...
...
src/components/CountDown/index.js
View file @
fc9c88a1
...
@@ -23,9 +23,6 @@ const initTime = props => {
...
@@ -23,9 +23,6 @@ const initTime = props => {
};
};
class
CountDown
extends
Component
{
class
CountDown
extends
Component
{
timer
=
0
;
interval
=
1000
;
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -35,6 +32,16 @@ class CountDown extends Component {
...
@@ -35,6 +32,16 @@ class CountDown extends Component {
};
};
}
}
static
getDerivedStateFromProps
(
nextProps
,
preState
)
{
const
{
lastTime
}
=
initTime
(
nextProps
);
if
(
preState
.
lastTime
!==
lastTime
)
{
return
{
lastTime
,
};
}
return
null
;
}
componentDidMount
()
{
componentDidMount
()
{
this
.
tick
();
this
.
tick
();
}
}
...
@@ -51,15 +58,9 @@ class CountDown extends Component {
...
@@ -51,15 +58,9 @@ class CountDown extends Component {
clearTimeout
(
this
.
timer
);
clearTimeout
(
this
.
timer
);
}
}
static
getDerivedStateFromProps
(
nextProps
,
preState
)
{
timer
=
0
;
const
{
lastTime
}
=
initTime
(
nextProps
);
if
(
preState
.
lastTime
!==
lastTime
)
{
interval
=
1000
;
return
{
lastTime
,
};
}
return
null
;
}
// defaultFormat = time => (
// defaultFormat = time => (
// <span>{moment(time).format('hh:mm:ss')}</span>
// <span>{moment(time).format('hh:mm:ss')}</span>
...
...
src/components/TagSelect/index.js
View file @
fc9c88a1
...
@@ -26,6 +26,13 @@ class TagSelect extends Component {
...
@@ -26,6 +26,13 @@ class TagSelect extends Component {
};
};
}
}
static
getDerivedStateFromProps
(
nextProps
)
{
if
(
'
value
'
in
nextProps
&&
nextProps
.
value
)
{
return
{
value
:
nextProps
.
value
};
}
return
null
;
}
onChange
=
value
=>
{
onChange
=
value
=>
{
const
{
onChange
}
=
this
.
props
;
const
{
onChange
}
=
this
.
props
;
if
(
!
(
'
value
'
in
this
.
props
))
{
if
(
!
(
'
value
'
in
this
.
props
))
{
...
@@ -44,13 +51,6 @@ class TagSelect extends Component {
...
@@ -44,13 +51,6 @@ class TagSelect extends Component {
this
.
onChange
(
checkedTags
);
this
.
onChange
(
checkedTags
);
};
};
static
getDerivedStateFromProps
(
nextProps
)
{
if
(
'
value
'
in
nextProps
&&
nextProps
.
value
)
{
return
{
value
:
nextProps
.
value
};
}
return
null
;
}
getAllTags
()
{
getAllTags
()
{
let
{
children
}
=
this
.
props
;
let
{
children
}
=
this
.
props
;
children
=
React
.
Children
.
toArray
(
children
);
children
=
React
.
Children
.
toArray
(
children
);
...
...
src/layouts/BasicLayout.js
View file @
fc9c88a1
...
@@ -64,9 +64,6 @@ const query = {
...
@@ -64,9 +64,6 @@ const query = {
};
};
class
BasicLayout
extends
React
.
PureComponent
{
class
BasicLayout
extends
React
.
PureComponent
{
state
=
{
rendering
:
true
,
};
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
const
{
menuData
}
=
this
.
props
;
const
{
menuData
}
=
this
.
props
;
...
@@ -74,6 +71,28 @@ class BasicLayout extends React.PureComponent {
...
@@ -74,6 +71,28 @@ class BasicLayout extends React.PureComponent {
// Because there are many places to be. So put it here
// Because there are many places to be. So put it here
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
}
}
state
=
{
rendering
:
true
,
};
componentDidMount
()
{
this
.
renderRef
=
requestAnimationFrame
(()
=>
{
this
.
setState
({
rendering
:
false
,
});
});
}
componentDidUpdate
()
{
const
{
menuData
}
=
this
.
props
;
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
}
componentWillUnmount
()
{
cancelAnimationFrame
(
this
.
renderRef
);
}
getContext
()
{
getContext
()
{
const
{
location
}
=
this
.
props
;
const
{
location
}
=
this
.
props
;
return
{
return
{
...
@@ -81,10 +100,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -81,10 +100,7 @@ class BasicLayout extends React.PureComponent {
breadcrumbNameMap
:
this
.
breadcrumbNameMap
,
breadcrumbNameMap
:
this
.
breadcrumbNameMap
,
};
};
}
}
componentDidUpdate
()
{
const
{
menuData
}
=
this
.
props
;
this
.
breadcrumbNameMap
=
getBreadcrumbNameMap
(
menuData
);
}
getPageTitle
=
pathname
=>
{
getPageTitle
=
pathname
=>
{
let
currRouterData
=
null
;
let
currRouterData
=
null
;
// match params path
// match params path
...
@@ -149,16 +165,7 @@ class BasicLayout extends React.PureComponent {
...
@@ -149,16 +165,7 @@ class BasicLayout extends React.PureComponent {
payload
:
collapsed
,
payload
:
collapsed
,
});
});
};
};
componentDidMount
()
{
this
.
renderRef
=
requestAnimationFrame
(()
=>
{
this
.
setState
({
rendering
:
false
,
});
});
}
componentWillUnmount
()
{
cancelAnimationFrame
(
this
.
renderRef
);
}
render
()
{
render
()
{
const
{
const
{
isMobile
,
isMobile
,
...
...
src/pages/Account/Settings/Info.js
View file @
fc9c88a1
...
@@ -41,15 +41,6 @@ export default class Info extends Component {
...
@@ -41,15 +41,6 @@ export default class Info extends Component {
});
});
}
}
componentDidMount
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
resize
);
this
.
resize
();
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
}
static
getDerivedStateFromProps
(
props
,
state
)
{
static
getDerivedStateFromProps
(
props
,
state
)
{
const
{
match
,
location
}
=
props
;
const
{
match
,
location
}
=
props
;
let
selectKey
=
location
.
pathname
.
replace
(
`
${
match
.
path
}
/`
,
''
);
let
selectKey
=
location
.
pathname
.
replace
(
`
${
match
.
path
}
/`
,
''
);
...
@@ -60,6 +51,15 @@ export default class Info extends Component {
...
@@ -60,6 +51,15 @@ export default class Info extends Component {
return
null
;
return
null
;
}
}
componentDidMount
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
resize
);
this
.
resize
();
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
}
getmenu
=
()
=>
{
getmenu
=
()
=>
{
const
{
menuMap
}
=
this
.
state
;
const
{
menuMap
}
=
this
.
state
;
return
Object
.
keys
(
menuMap
).
map
(
item
=>
<
Item
key
=
{
item
}
>
{
menuMap
[
item
]}
<
/Item>
)
;
return
Object
.
keys
(
menuMap
).
map
(
item
=>
<
Item
key
=
{
item
}
>
{
menuMap
[
item
]}
<
/Item>
)
;
...
...
src/pages/Forms/TableForm.js
View file @
fc9c88a1
...
@@ -4,9 +4,6 @@ import isEqual from 'lodash.isequal';
...
@@ -4,9 +4,6 @@ import isEqual from 'lodash.isequal';
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
export
default
class
TableForm
extends
PureComponent
{
export
default
class
TableForm
extends
PureComponent
{
index
=
0
;
cacheOriginData
=
{};
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -29,6 +26,10 @@ export default class TableForm extends PureComponent {
...
@@ -29,6 +26,10 @@ export default class TableForm extends PureComponent {
};
};
}
}
index
=
0
;
cacheOriginData
=
{};
getRowByKey
(
key
,
newData
)
{
getRowByKey
(
key
,
newData
)
{
const
{
data
}
=
this
.
state
;
const
{
data
}
=
this
.
state
;
return
(
newData
||
data
).
filter
(
item
=>
item
.
key
===
key
)[
0
];
return
(
newData
||
data
).
filter
(
item
=>
item
.
key
===
key
)[
0
];
...
...
src/pages/List/BasicList.js
View file @
fc9c88a1
...
@@ -38,10 +38,6 @@ const { Search, TextArea } = Input;
...
@@ -38,10 +38,6 @@ const { Search, TextArea } = Input;
}))
}))
@
Form
.
create
()
@
Form
.
create
()
export
default
class
BasicList
extends
PureComponent
{
export
default
class
BasicList
extends
PureComponent
{
formLayout
=
{
labelCol
:
{
span
:
7
},
wrapperCol
:
{
span
:
13
},
};
state
=
{
visible
:
false
,
done
:
false
};
state
=
{
visible
:
false
,
done
:
false
};
...
@@ -55,6 +51,11 @@ export default class BasicList extends PureComponent {
...
@@ -55,6 +51,11 @@ export default class BasicList extends PureComponent {
});
});
}
}
formLayout
=
{
labelCol
:
{
span
:
7
},
wrapperCol
:
{
span
:
13
},
};
showModal
=
()
=>
{
showModal
=
()
=>
{
this
.
setState
({
this
.
setState
({
visible
:
true
,
visible
:
true
,
...
...
src/pages/List/TableList.js
View file @
fc9c88a1
...
@@ -272,6 +272,22 @@ class UpdateForm extends PureComponent {
...
@@ -272,6 +272,22 @@ class UpdateForm extends PureComponent {
}))
}))
@
Form
.
create
()
@
Form
.
create
()
export
default
class
TableList
extends
PureComponent
{
export
default
class
TableList
extends
PureComponent
{
state
=
{
modalVisible
:
false
,
updateModalVisible
:
false
,
expandForm
:
false
,
selectedRows
:
[],
formValues
:
{},
stepFormValues
:
{},
};
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'
rule/fetch
'
,
});
}
columns
=
[
columns
=
[
{
{
title
:
'
θ§εεη§°
'
,
title
:
'
θ§εεη§°
'
,
...
@@ -333,22 +349,6 @@ export default class TableList extends PureComponent {
...
@@ -333,22 +349,6 @@ export default class TableList extends PureComponent {
},
},
];
];
state
=
{
modalVisible
:
false
,
updateModalVisible
:
false
,
expandForm
:
false
,
selectedRows
:
[],
formValues
:
{},
stepFormValues
:
{},
};
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
dispatch
({
type
:
'
rule/fetch
'
,
});
}
handleStandardTableChange
=
(
pagination
,
filtersArg
,
sorter
)
=>
{
handleStandardTableChange
=
(
pagination
,
filtersArg
,
sorter
)
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
const
{
formValues
}
=
this
.
state
;
const
{
formValues
}
=
this
.
state
;
...
...
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