mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Fix all occurrences of react/addons usage
Fixed also: cloneWithProps deprecation
This commit is contained in:
parent
b0777fe326
commit
960e16475b
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react/addons';
|
||||
import React from 'react';
|
||||
|
||||
import ConsignButton from './acls/consign_button';
|
||||
import EmailButton from './acls/email_button';
|
||||
@ -61,7 +61,7 @@ let AclButtonList = React.createClass({
|
||||
const { buttonListSize } = this.state;
|
||||
|
||||
return React.Children.map(children, (child) => {
|
||||
return React.addons.cloneWithProps(child, { buttonListSize });
|
||||
return React.cloneElement(child, { buttonListSize });
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react/addons';
|
||||
import React from 'react';
|
||||
import update from 'react-addons-update';
|
||||
|
||||
const { string, object } = React.PropTypes;
|
||||
|
||||
@ -30,7 +31,7 @@ const FormSubmitButton = React.createClass({
|
||||
},
|
||||
|
||||
setReadyStateForKey(key, state) {
|
||||
const readyStates = React.addons.update(this.state.readyStates, { [key]: { $set: state } });
|
||||
const readyStates = update(this.state.readyStates, { [key]: { $set: state } });
|
||||
this.setState({ readyStates });
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import ReactAddons from 'react/addons';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
@ -257,7 +256,7 @@ let Form = React.createClass({
|
||||
},
|
||||
|
||||
renderChildren() {
|
||||
return ReactAddons.Children.map(this.props.children, (child, i) => {
|
||||
return React.Children.map(this.props.children, (child, i) => {
|
||||
if (child) {
|
||||
// Since refs will be overwritten by this functions return statement,
|
||||
// we still want to be able to define refs for nested `Form` or `Property`
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react/addons';
|
||||
import React from 'react';
|
||||
import update from 'react-addons-update';
|
||||
|
||||
import InputCheckbox from './input_checkbox';
|
||||
|
||||
@ -101,7 +102,7 @@ const InputContractAgreementCheckbox = React.createClass({
|
||||
// so the parent `Property` is able to get the correct value of this component
|
||||
// when the `Form` queries it.
|
||||
this.setState({
|
||||
value: React.addons.update(this.state.value, {
|
||||
value: update(this.state.value, {
|
||||
terms: { $set: event.target.value }
|
||||
})
|
||||
});
|
||||
|
@ -1,14 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import ReactAddons from 'react/addons';
|
||||
|
||||
import Panel from 'react-bootstrap/lib/Panel';
|
||||
|
||||
import AppConstants from '../../constants/application_constants';
|
||||
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
|
||||
|
||||
const { bool, element, string, oneOfType, func, object, arrayOf } = React.PropTypes;
|
||||
|
||||
@ -261,7 +258,7 @@ const Property = React.createClass({
|
||||
// Input's props should only be cloned and propagated down the tree,
|
||||
// if the component is actually being shown (!== 'expanded === false')
|
||||
if((this.state.expanded && this.props.checkboxLabel) || !this.props.checkboxLabel) {
|
||||
return ReactAddons.Children.map(this.props.children, (child) => {
|
||||
return React.Children.map(this.props.children, (child) => {
|
||||
// Since refs will be overriden by this functions return statement,
|
||||
// we still want to be able to define refs for nested `Form` or `Property`
|
||||
// children, which is why we're upfront simply invoking the callback-ref-
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react/addons';
|
||||
import React from 'react';
|
||||
import { History, Lifecycle } from 'react-router';
|
||||
|
||||
import SlidesContainerBreadcrumbs from './slides_container_breadcrumbs';
|
||||
@ -120,7 +120,7 @@ const SlidesContainer = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
// Since we need to give the slides a width, we need to call ReactAddons.addons.cloneWithProps
|
||||
// Since we need to give the slides a width, we need to call React.cloneElement
|
||||
// Also, a key is nice to have!
|
||||
renderChildren() {
|
||||
const startFrom = parseInt(this.props.location.query.start_from, 10) || -1;
|
||||
@ -129,7 +129,7 @@ const SlidesContainer = React.createClass({
|
||||
// since the default parameter of startFrom is -1, we do not need to check
|
||||
// if its actually present in the url bar, as it will just not match
|
||||
if(child && i >= startFrom) {
|
||||
return React.addons.cloneWithProps(child, {
|
||||
return React.cloneElement(child, {
|
||||
className: 'ascribe-slide',
|
||||
style: {
|
||||
width: this.state.containerWidth
|
||||
|
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import ReactAddons from 'react/addons';
|
||||
|
||||
import TableHeader from './table_header';
|
||||
import { ColumnModel } from './models/table_models';
|
||||
@ -20,8 +19,8 @@ let Table = React.createClass({
|
||||
},
|
||||
|
||||
renderChildren() {
|
||||
return ReactAddons.Children.map(this.props.children, (child, i) => {
|
||||
return ReactAddons.addons.cloneWithProps(child, {
|
||||
return React.Children.map(this.props.children, (child, i) => {
|
||||
return React.cloneElement(child, {
|
||||
columnList: this.props.columnList,
|
||||
columnContent: this.props.itemList[i],
|
||||
key: i
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react/addons';
|
||||
import React from 'react';
|
||||
import update from 'react-addons-update';
|
||||
// FIXME: remove once using react-components
|
||||
import fineUploader from 'exports?qq!./vendor/s3.fine-uploader';
|
||||
import Q from 'q';
|
||||
@ -536,7 +537,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
|
||||
changeSet.status = { $set: status };
|
||||
|
||||
let filesToUpload = React.addons.update(this.state.filesToUpload, { [fileId]: changeSet });
|
||||
let filesToUpload = update(this.state.filesToUpload, { [fileId]: changeSet });
|
||||
|
||||
this.setState({ filesToUpload }, resolve);
|
||||
});
|
||||
@ -547,7 +548,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
|
||||
if(fileId < filesToUpload.length) {
|
||||
const changeSet = { $set: url };
|
||||
const newFilesToUpload = React.addons.update(filesToUpload, {
|
||||
const newFilesToUpload = update(filesToUpload, {
|
||||
[fileId]: { thumbnailUrl: changeSet }
|
||||
});
|
||||
|
||||
@ -574,7 +575,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
completed: false
|
||||
};
|
||||
|
||||
let startedChunks = React.addons.update(this.state.startedChunks, { $set: chunks });
|
||||
let startedChunks = update(this.state.startedChunks, { $set: chunks });
|
||||
|
||||
this.setState({ startedChunks });
|
||||
},
|
||||
@ -588,7 +589,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
chunks[chunkKey].responseJson = responseJson;
|
||||
chunks[chunkKey].xhr = xhr;
|
||||
|
||||
let startedChunks = React.addons.update(this.state.startedChunks, { $set: chunks });
|
||||
let startedChunks = update(this.state.startedChunks, { $set: chunks });
|
||||
|
||||
this.setState({ startedChunks });
|
||||
}
|
||||
@ -619,7 +620,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
files[id].status = FileStatus.UPLOAD_SUCCESSFUL;
|
||||
files[id].key = this.state.uploader.getKey(id);
|
||||
|
||||
let filesToUpload = React.addons.update(this.state.filesToUpload, { $set: files });
|
||||
let filesToUpload = update(this.state.filesToUpload, { $set: files });
|
||||
this.setState({ filesToUpload });
|
||||
|
||||
// Only after the blob has been created server-side, we can make the form submittable.
|
||||
@ -667,7 +668,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
if (!this.state.errorState.errorClass) {
|
||||
notificationMessage = errorNotificationMessage;
|
||||
|
||||
const errorState = React.addons.update(this.state.errorState, {
|
||||
const errorState = update(this.state.errorState, {
|
||||
errorClass: {
|
||||
$set: this.getUploadErrorClass({
|
||||
reason: errorReason,
|
||||
@ -720,7 +721,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
},
|
||||
|
||||
onProgress(id, name, uploadedBytes, totalBytes) {
|
||||
let filesToUpload = React.addons.update(this.state.filesToUpload, {
|
||||
let filesToUpload = update(this.state.filesToUpload, {
|
||||
[id]: {
|
||||
progress: { $set: (uploadedBytes / totalBytes) * 100}
|
||||
}
|
||||
@ -747,7 +748,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
return file;
|
||||
});
|
||||
|
||||
let filesToUpload = React.addons.update(this.state.filesToUpload, {$set: updatedFilesToUpload});
|
||||
let filesToUpload = update(this.state.filesToUpload, {$set: updatedFilesToUpload});
|
||||
|
||||
this.setState({filesToUpload });
|
||||
} else {
|
||||
@ -846,7 +847,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
|
||||
fileIds.forEach((fileId) => {
|
||||
this.state.uploader.retry(fileId);
|
||||
filesToUpload = React.addons.update(filesToUpload, { [fileId]: { status: { $set: FileStatus.UPLOADING } } });
|
||||
filesToUpload = update(filesToUpload, { [fileId]: { status: { $set: FileStatus.UPLOADING } } });
|
||||
});
|
||||
|
||||
this.setState({
|
||||
@ -1041,7 +1042,7 @@ const ReactS3FineUploader = React.createClass({
|
||||
}
|
||||
|
||||
// set the new file array
|
||||
let filesToUpload = React.addons.update(this.state.filesToUpload, { $set: oldAndNewFiles });
|
||||
let filesToUpload = update(this.state.filesToUpload, { $set: oldAndNewFiles });
|
||||
|
||||
this.setState({ filesToUpload }, () => {
|
||||
// when files have been dropped or selected by a user, we want to propagate that
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import update from 'react-addons-update';
|
||||
|
||||
import { alt } from '../alt';
|
||||
import EditionsListActions from '../actions/edition_list_actions';
|
||||
@ -30,7 +30,7 @@ class EditionListStore {
|
||||
|
||||
// if edition already exists, just merge
|
||||
if (pieceEditionList[storeEditionIndex]) {
|
||||
pieceEditionList[storeEditionIndex] = React.addons.update(pieceEditionList[storeEditionIndex], { $merge: updatedEdition });
|
||||
pieceEditionList[storeEditionIndex] = update(pieceEditionList[storeEditionIndex], { $merge: updatedEdition });
|
||||
} else {
|
||||
// if does not exist, assign
|
||||
pieceEditionList[storeEditionIndex] = updatedEdition;
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
import React from 'react';
|
||||
import update from 'react-addons-update';
|
||||
import { alt } from '../alt';
|
||||
|
||||
import PieceListActions from '../actions/piece_list_actions';
|
||||
@ -62,7 +62,7 @@ class PieceListStore {
|
||||
pieceList.forEach((piece, i) => {
|
||||
const oldPiece = this.pieceList[i];
|
||||
if (oldPiece) {
|
||||
piece = React.addons.update(piece, {
|
||||
piece = update(piece, {
|
||||
show: { $set: oldPiece.show }
|
||||
});
|
||||
}
|
||||
|
@ -95,6 +95,7 @@
|
||||
"query-string": "^3.0.0",
|
||||
"raven-js": "^1.1.19",
|
||||
"react": "^15.1.0",
|
||||
"react-addons-update": "^15.1.0",
|
||||
"react-bootstrap": "^0.29.4",
|
||||
"react-datepicker": "^0.27.0",
|
||||
"react-dom": "^15.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user