mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Use destructuring for ReactS3Fineuploader props
This commit is contained in:
parent
a8ccf13f91
commit
2ffc26d703
@ -18,87 +18,100 @@ import { displayValidFilesFilter, transformAllowedExtensionsToInputAcceptProp }
|
|||||||
import { getCookie } from '../../utils/fetch_api_utils';
|
import { getCookie } from '../../utils/fetch_api_utils';
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
|
||||||
let ReactS3FineUploader = React.createClass({
|
|
||||||
|
const { shape,
|
||||||
|
string,
|
||||||
|
oneOfType,
|
||||||
|
number,
|
||||||
|
func,
|
||||||
|
bool,
|
||||||
|
any,
|
||||||
|
object,
|
||||||
|
oneOf,
|
||||||
|
element,
|
||||||
|
arrayOf } = React.PropTypes;
|
||||||
|
|
||||||
|
const ReactS3FineUploader = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
keyRoutine: React.PropTypes.shape({
|
keyRoutine: shape({
|
||||||
url: React.PropTypes.string,
|
url: string,
|
||||||
fileClass: React.PropTypes.string,
|
fileClass: string,
|
||||||
pieceId: React.PropTypes.oneOfType([
|
pieceId: oneOfType([
|
||||||
React.PropTypes.string,
|
string,
|
||||||
React.PropTypes.number
|
number
|
||||||
])
|
])
|
||||||
}),
|
}),
|
||||||
createBlobRoutine: React.PropTypes.shape({
|
createBlobRoutine: shape({
|
||||||
url: React.PropTypes.string,
|
url: string,
|
||||||
pieceId: React.PropTypes.oneOfType([
|
pieceId: oneOfType([
|
||||||
React.PropTypes.string,
|
string,
|
||||||
React.PropTypes.number
|
number
|
||||||
])
|
])
|
||||||
}),
|
}),
|
||||||
submitFile: React.PropTypes.func,
|
submitFile: func,
|
||||||
autoUpload: React.PropTypes.bool,
|
autoUpload: bool,
|
||||||
debug: React.PropTypes.bool,
|
debug: bool,
|
||||||
objectProperties: React.PropTypes.shape({
|
objectProperties: shape({
|
||||||
acl: React.PropTypes.string
|
acl: string
|
||||||
}),
|
}),
|
||||||
request: React.PropTypes.shape({
|
request: shape({
|
||||||
endpoint: React.PropTypes.string,
|
endpoint: string,
|
||||||
accessKey: React.PropTypes.string,
|
accessKey: string,
|
||||||
params: React.PropTypes.shape({
|
params: shape({
|
||||||
csrfmiddlewaretoken: React.PropTypes.string
|
csrfmiddlewaretoken: string
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
signature: React.PropTypes.shape({
|
signature: shape({
|
||||||
endpoint: React.PropTypes.string
|
endpoint: string
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
uploadSuccess: React.PropTypes.shape({
|
uploadSuccess: shape({
|
||||||
method: React.PropTypes.string,
|
method: string,
|
||||||
endpoint: React.PropTypes.string,
|
endpoint: string,
|
||||||
params: React.PropTypes.shape({
|
params: shape({
|
||||||
isBrowserPreviewCapable: React.PropTypes.any, // maybe fix this later
|
isBrowserPreviewCapable: any, // maybe fix this later
|
||||||
bitcoin_ID_noPrefix: React.PropTypes.string
|
bitcoin_ID_noPrefix: string
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
cors: React.PropTypes.shape({
|
cors: shape({
|
||||||
expected: React.PropTypes.bool
|
expected: bool
|
||||||
}),
|
}),
|
||||||
chunking: React.PropTypes.shape({
|
chunking: shape({
|
||||||
enabled: React.PropTypes.bool
|
enabled: bool
|
||||||
}),
|
}),
|
||||||
resume: React.PropTypes.shape({
|
resume: shape({
|
||||||
enabled: React.PropTypes.bool
|
enabled: bool
|
||||||
}),
|
}),
|
||||||
deleteFile: React.PropTypes.shape({
|
deleteFile: shape({
|
||||||
enabled: React.PropTypes.bool,
|
enabled: bool,
|
||||||
method: React.PropTypes.string,
|
method: string,
|
||||||
endpoint: React.PropTypes.string,
|
endpoint: string,
|
||||||
customHeaders: React.PropTypes.object
|
customHeaders: object
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
session: React.PropTypes.shape({
|
session: shape({
|
||||||
customHeaders: React.PropTypes.object,
|
customHeaders: object,
|
||||||
endpoint: React.PropTypes.string,
|
endpoint: string,
|
||||||
params: React.PropTypes.object,
|
params: object,
|
||||||
refreshOnRequests: React.PropTypes.bool
|
refreshOnRequests: bool
|
||||||
}),
|
}),
|
||||||
validation: React.PropTypes.shape({
|
validation: shape({
|
||||||
itemLimit: React.PropTypes.number,
|
itemLimit: number,
|
||||||
sizeLimit: React.PropTypes.string,
|
sizeLimit: string,
|
||||||
allowedExtensions: React.PropTypes.arrayOf(React.PropTypes.string)
|
allowedExtensions: arrayOf(string)
|
||||||
}),
|
}),
|
||||||
messages: React.PropTypes.shape({
|
messages: shape({
|
||||||
unsupportedBrowser: React.PropTypes.string
|
unsupportedBrowser: string
|
||||||
}),
|
}),
|
||||||
formatFileName: React.PropTypes.func,
|
formatFileName: func,
|
||||||
multiple: React.PropTypes.bool,
|
multiple: bool,
|
||||||
retry: React.PropTypes.shape({
|
retry: shape({
|
||||||
enableAuto: React.PropTypes.bool
|
enableAuto: bool
|
||||||
}),
|
}),
|
||||||
setIsUploadReady: React.PropTypes.func,
|
setIsUploadReady: func,
|
||||||
isReadyForFormSubmission: React.PropTypes.func,
|
isReadyForFormSubmission: func,
|
||||||
areAssetsDownloadable: React.PropTypes.bool,
|
areAssetsDownloadable: bool,
|
||||||
areAssetsEditable: React.PropTypes.bool,
|
areAssetsEditable: bool,
|
||||||
defaultErrorMessage: React.PropTypes.string,
|
defaultErrorMessage: string,
|
||||||
onInactive: React.PropTypes.func,
|
onInactive: func,
|
||||||
|
|
||||||
// We encountered some cases where people had difficulties to upload their
|
// We encountered some cases where people had difficulties to upload their
|
||||||
// works to ascribe due to a slow internet connection.
|
// works to ascribe due to a slow internet connection.
|
||||||
@ -111,22 +124,22 @@ let ReactS3FineUploader = React.createClass({
|
|||||||
// which should be passed into 'uploadMethod':
|
// which should be passed into 'uploadMethod':
|
||||||
// 'hash': upload using the hash
|
// 'hash': upload using the hash
|
||||||
// 'upload': upload full file (default if not specified)
|
// 'upload': upload full file (default if not specified)
|
||||||
enableLocalHashing: React.PropTypes.bool,
|
enableLocalHashing: bool,
|
||||||
uploadMethod: React.PropTypes.oneOf(['hash', 'upload']),
|
uploadMethod: oneOf(['hash', 'upload']),
|
||||||
|
|
||||||
// A class of a file the user has to upload
|
// A class of a file the user has to upload
|
||||||
// Needs to be defined both in singular as well as in plural
|
// Needs to be defined both in singular as well as in plural
|
||||||
fileClassToUpload: React.PropTypes.shape({
|
fileClassToUpload: shape({
|
||||||
singular: React.PropTypes.string,
|
singular: string,
|
||||||
plural: React.PropTypes.string
|
plural: string
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// Uploading functionality of react fineuploader is disconnected from its UI
|
// Uploading functionality of react fineuploader is disconnected from its UI
|
||||||
// layer, which means that literally every (properly adjusted) react element
|
// layer, which means that literally every (properly adjusted) react element
|
||||||
// can handle the UI handling.
|
// can handle the UI handling.
|
||||||
fileInputElement: React.PropTypes.oneOfType([
|
fileInputElement: oneOfType([
|
||||||
React.PropTypes.func,
|
func,
|
||||||
React.PropTypes.element
|
element
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user