-
-
Notifications
You must be signed in to change notification settings - Fork 143
Upgrade to React 16 #508
Upgrade to React 16 #508
Changes from all commits
46fa128
12a0721
938e78f
99d92ab
843ad9c
f9fcd5d
f1fe6dd
0ed301c
d27390c
992ceef
56ea868
526cc33
8e5ca13
15bde4a
47fa983
5ffd572
602af8f
6ba7ffe
b137649
2129d59
931d470
89a435f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
percy | ||
selenium | ||
pandas | ||
dash_table_experiments | ||
xlrd | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed table experiment for the table while at it -- the experiment was causing problems in any case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for the tests, or is the transition to 16 the end of the line for anyone still using experiments? Which would be fine, but it would mean we need to be very clear about this with users. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed this because I was having issues with the experiment. Will check if this is end-of-line or just usage details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, will not looking further into this. The issue might be limited to the old |
||
flake8 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
"ramda": "^0.24.1", | ||
"rc-slider": "^8.3.1", | ||
"react-addons-shallow-compare": "^15.6.0", | ||
"react-dates": "^12.3.0", | ||
"react-dates": "^20.1.0", | ||
"react-docgen": "^2.21.0", | ||
"react-dropzone": "^4.1.2", | ||
"react-markdown": "^4.0.6", | ||
|
@@ -70,17 +70,16 @@ | |
"jest": "^24.5.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^1.14.2", | ||
"react": "^16.6.1", | ||
"react-dom": "^16.6.1", | ||
"react-dot-fragment": "^0.2.8", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bump react, remove polyfill |
||
"style-loader": "^0.23.1", | ||
"styled-jsx": "^3.1.1", | ||
"webpack": "^4.29.6", | ||
"webpack-cli": "^3.3.0", | ||
"webpack-serve": "^2.0.3" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.6.0 || ^16.0.0", | ||
"react-dom": "^15.6.0 || ^16.0.0" | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import 'react-dates/initialize'; | ||
import {DateRangePicker} from 'react-dates'; | ||
import PropTypes from 'prop-types'; | ||
import R from 'ramda'; | ||
import React, {Component} from 'react'; | ||
|
||
import convertToMoment from '../utils/convertToMoment'; | ||
|
@@ -51,18 +51,19 @@ export default class DatePickerRange extends Component { | |
} | ||
onDatesChange({startDate: start_date, endDate: end_date}) { | ||
const {setProps, updatemode} = this.props; | ||
|
||
const old_start_date = this.state.start_date; | ||
const old_end_date = this.state.end_date; | ||
const newState = {}; | ||
if (setProps && start_date !== null && start_date !== old_start_date) { | ||
|
||
this.setState({start_date, end_date}); | ||
|
||
if (start_date && !start_date.isSame(old_start_date)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .isSame, .isBefore, .isAfter are functions offered by moment to compare moment objects to various time formats |
||
if (updatemode === 'singledate') { | ||
setProps({start_date: start_date.format('YYYY-MM-DD')}); | ||
} | ||
} | ||
|
||
newState.start_date = start_date; | ||
|
||
if (setProps && end_date !== null && end_date !== old_end_date) { | ||
if (end_date && !end_date.isSame(old_end_date)) { | ||
if (updatemode === 'singledate') { | ||
setProps({end_date: end_date.format('YYYY-MM-DD')}); | ||
} else if (updatemode === 'bothdates') { | ||
|
@@ -72,22 +73,14 @@ export default class DatePickerRange extends Component { | |
}); | ||
} | ||
} | ||
newState.end_date = end_date; | ||
|
||
this.setState(newState); | ||
} | ||
|
||
isOutsideRange(date) { | ||
const {min_date_allowed, max_date_allowed} = this.state; | ||
const notUndefined = R.complement( | ||
R.pipe( | ||
R.type, | ||
R.equals('Undefined') | ||
) | ||
); | ||
|
||
return ( | ||
(notUndefined(min_date_allowed) && date < min_date_allowed) || | ||
(notUndefined(max_date_allowed) && date >= max_date_allowed) | ||
(min_date_allowed && date.isBefore(min_date_allowed)) || | ||
(max_date_allowed && date.isAfter(max_date_allowed)) | ||
); | ||
} | ||
|
||
|
@@ -121,6 +114,8 @@ export default class DatePickerRange extends Component { | |
id, | ||
style, | ||
className, | ||
start_date_id, | ||
end_date_id, | ||
} = this.props; | ||
|
||
const verticalFlag = calendar_orientation !== 'vertical'; | ||
|
@@ -178,6 +173,8 @@ export default class DatePickerRange extends Component { | |
with_full_screen_portal && verticalFlag | ||
} | ||
withPortal={with_portal && verticalFlag} | ||
startDateId={start_date_id} | ||
endDateId={end_date_id} | ||
/> | ||
</div> | ||
); | ||
|
@@ -194,6 +191,9 @@ DatePickerRange.propTypes = { | |
*/ | ||
start_date: PropTypes.string, | ||
|
||
start_date_id: PropTypes.string, | ||
end_date_id: PropTypes.string, | ||
|
||
/** | ||
* Specifies the ending date for the component. | ||
* Accepts datetime.datetime objects or strings | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import 'react-dates/initialize'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Starting with react-dates 13+ that's required |
||
|
||
import {SingleDatePicker} from 'react-dates'; | ||
import moment from 'moment'; | ||
import PropTypes from 'prop-types'; | ||
import R from 'ramda'; | ||
import React, {Component} from 'react'; | ||
|
||
import convertToMoment from '../utils/convertToMoment'; | ||
|
@@ -53,25 +54,18 @@ export default class DatePickerSingle extends Component { | |
|
||
isOutsideRange(date) { | ||
const {min_date_allowed, max_date_allowed} = this.state; | ||
const notUndefined = R.complement( | ||
R.pipe( | ||
R.type, | ||
R.equals('Undefined') | ||
) | ||
); | ||
|
||
return ( | ||
(notUndefined(min_date_allowed) && date < min_date_allowed) || | ||
(notUndefined(max_date_allowed) && date >= max_date_allowed) | ||
(min_date_allowed && date.isBefore(min_date_allowed)) || | ||
(max_date_allowed && date.isAfter(max_date_allowed)) | ||
); | ||
} | ||
|
||
onDateChange(date) { | ||
const {setProps} = this.props; | ||
if (setProps) { | ||
setProps({date: date ? date.format('YYYY-MM-DD') : null}); | ||
} else { | ||
this.setState({date}); | ||
} | ||
|
||
this.setState({date}); | ||
setProps({date: date ? date.format('YYYY-MM-DD') : null}); | ||
} | ||
|
||
render() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import React from 'react'; | ||
import React, {Fragment} from 'react'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fragment is supported by React 16, remove the polyfill |
||
import PropTypes from 'prop-types'; | ||
import Fragment from 'react-dot-fragment'; | ||
|
||
const Tab = ({children}) => <Fragment>{children}</Fragment>; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be removed once merged into master