Bug fixing added moving torrents after download, getting ready for alpha release
This commit is contained in:
8
goTorrentWebUI/node_modules/react-dropzone/examples/.eslintrc
generated
vendored
Normal file
8
goTorrentWebUI/node_modules/react-dropzone/examples/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"globals": {
|
||||
"Dropzone": true
|
||||
},
|
||||
"rules": {
|
||||
"react/jsx-no-bind": "off"
|
||||
}
|
||||
}
|
99
goTorrentWebUI/node_modules/react-dropzone/examples/Accept/Readme.md
generated
vendored
Normal file
99
goTorrentWebUI/node_modules/react-dropzone/examples/Accept/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
By providing `accept` prop you can make Dropzone to accept specific file types and reject the others.
|
||||
|
||||
The value must be a comma-separated list of unique content type specifiers:
|
||||
* A file extension starting with the STOP character (U+002E). (e.g. .jpg, .png, .doc).
|
||||
* A valid MIME type with no extensions.
|
||||
* audio/* representing sound files.
|
||||
* video/* representing video files.
|
||||
* image/* representing image files.
|
||||
|
||||
For more information see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input
|
||||
|
||||
```
|
||||
class Accept extends React.Component {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
accepted: [],
|
||||
rejected: []
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<section>
|
||||
<div className="dropzone">
|
||||
<Dropzone
|
||||
accept="image/jpeg, image/png"
|
||||
onDrop={(accepted, rejected) => { this.setState({ accepted, rejected }); }}
|
||||
>
|
||||
<p>Try dropping some files here, or click to select files to upload.</p>
|
||||
<p>Only *.jpeg and *.png images will be accepted</p>
|
||||
</Dropzone>
|
||||
</div>
|
||||
<aside>
|
||||
<h2>Accepted files</h2>
|
||||
<ul>
|
||||
{
|
||||
this.state.accepted.map(f => <li key={f.name}>{f.name} - {f.size} bytes</li>)
|
||||
}
|
||||
</ul>
|
||||
<h2>Rejected files</h2>
|
||||
<ul>
|
||||
{
|
||||
this.state.rejected.map(f => <li key={f.name}>{f.name} - {f.size} bytes</li>)
|
||||
}
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
<Accept />
|
||||
```
|
||||
|
||||
### Browser limitations
|
||||
|
||||
Because of HTML5 File API differences across different browsers during the drag, Dropzone will only display `rejected` styles in Chrome (and Chromium based browser). It isn't working in Safari nor IE.
|
||||
|
||||
Also, at this moment it's not possible to read file names (and thus, file extensions) during the drag operation. For that reason, if you want to react on different file types _during_ the drag operation, _you have to use_ mime types and not extensions! For example, the following example won't work even in Chrome:
|
||||
|
||||
```
|
||||
<Dropzone
|
||||
accept=".jpeg,.png"
|
||||
>
|
||||
{({ isDragActive, isDragReject }) => {
|
||||
if (isDragActive) {
|
||||
return "All files will be accepted";
|
||||
}
|
||||
if (isDragReject) {
|
||||
return "Some files will be rejected";
|
||||
}
|
||||
return "Dropping some files here...";
|
||||
}}
|
||||
</Dropzone>
|
||||
```
|
||||
|
||||
but this one will:
|
||||
|
||||
```
|
||||
<Dropzone
|
||||
accept="image/jpeg, image/png"
|
||||
>
|
||||
{({ isDragActive, isDragReject }) => {
|
||||
if (isDragActive) {
|
||||
return "All files will be accepted";
|
||||
}
|
||||
if (isDragReject) {
|
||||
return "Some files will be rejected";
|
||||
}
|
||||
return "Dropping some files here...";
|
||||
}}
|
||||
</Dropzone>
|
||||
```
|
||||
|
||||
### Notes
|
||||
|
||||
Mime type determination is not reliable accross platforms. CSV files, for example, are reported as text/plain under macOS but as application/vnd.ms-excel under Windows. In some cases there might not be a mime type set at all.
|
||||
|
80
goTorrentWebUI/node_modules/react-dropzone/examples/Basic/Readme.md
generated
vendored
Normal file
80
goTorrentWebUI/node_modules/react-dropzone/examples/Basic/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
Dropzone with default properties and displays list of the dropped files.
|
||||
|
||||
```
|
||||
class Basic extends React.Component {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = { files: [] }
|
||||
}
|
||||
|
||||
onDrop(files) {
|
||||
this.setState({
|
||||
files
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<section>
|
||||
<div className="dropzone">
|
||||
<Dropzone onDrop={this.onDrop.bind(this)}>
|
||||
<p>Try dropping some files here, or click to select files to upload.</p>
|
||||
</Dropzone>
|
||||
</div>
|
||||
<aside>
|
||||
<h2>Dropped files</h2>
|
||||
<ul>
|
||||
{
|
||||
this.state.files.map(f => <li key={f.name}>{f.name} - {f.size} bytes</li>)
|
||||
}
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
<Basic />
|
||||
```
|
||||
|
||||
Dropzone with `disabled` property:
|
||||
|
||||
```
|
||||
class Basic extends React.Component {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = { disabled: true, files: [] }
|
||||
}
|
||||
|
||||
onDrop(files) {
|
||||
this.setState({
|
||||
files
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<section>
|
||||
<aside>
|
||||
<button type="button" onClick={() => this.setState({ disabled: !this.state.disabled })}>Toggle disabled</button>
|
||||
</aside>
|
||||
<div className="dropzone">
|
||||
<Dropzone onDrop={this.onDrop.bind(this)} disabled={this.state.disabled}>
|
||||
<p>Try dropping some files here, or click to select files to upload.</p>
|
||||
</Dropzone>
|
||||
</div>
|
||||
<aside>
|
||||
<h2>Dropped files</h2>
|
||||
<ul>
|
||||
{
|
||||
this.state.files.map(f => <li>{f.name} - {f.size} bytes</li>)
|
||||
}
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
<Basic />
|
||||
```
|
16
goTorrentWebUI/node_modules/react-dropzone/examples/File Dialog/Readme.md
generated
vendored
Normal file
16
goTorrentWebUI/node_modules/react-dropzone/examples/File Dialog/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
You can programmatically invoke default OS file prompt. In order to do that you'll have to set the ref on your `Dropzone` instance and call the instance `open` method.
|
||||
|
||||
```
|
||||
let dropzoneRef;
|
||||
|
||||
<div>
|
||||
<Dropzone ref={(node) => { dropzoneRef = node; }} onDrop={(accepted, rejected) => { alert(accepted) }}>
|
||||
<p>Drop files here.</p>
|
||||
</Dropzone>
|
||||
<button type="button" onClick={() => { dropzoneRef.open() }}>
|
||||
Open File Dialog
|
||||
</button>
|
||||
</div>
|
||||
```
|
||||
|
||||
The completion handler for the `open` function is also the `onDrop` function.
|
85
goTorrentWebUI/node_modules/react-dropzone/examples/Fullscreen/Readme.md
generated
vendored
Normal file
85
goTorrentWebUI/node_modules/react-dropzone/examples/Fullscreen/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
You can wrap the whole app into the dropzone. This will make the whole app a Dropzone target.
|
||||
|
||||
```
|
||||
class FullScreen extends React.Component {
|
||||
constructor() {
|
||||
super()
|
||||
this.state = {
|
||||
accept: '',
|
||||
files: [],
|
||||
dropzoneActive: false
|
||||
}
|
||||
}
|
||||
|
||||
onDragEnter() {
|
||||
this.setState({
|
||||
dropzoneActive: true
|
||||
});
|
||||
}
|
||||
|
||||
onDragLeave() {
|
||||
this.setState({
|
||||
dropzoneActive: false
|
||||
});
|
||||
}
|
||||
|
||||
onDrop(files) {
|
||||
this.setState({
|
||||
files,
|
||||
dropzoneActive: false
|
||||
});
|
||||
}
|
||||
|
||||
applyMimeTypes(event) {
|
||||
this.setState({
|
||||
accept: event.target.value
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { accept, files, dropzoneActive } = this.state;
|
||||
const overlayStyle = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
padding: '2.5em 0',
|
||||
background: 'rgba(0,0,0,0.5)',
|
||||
textAlign: 'center',
|
||||
color: '#fff'
|
||||
};
|
||||
return (
|
||||
<Dropzone
|
||||
disableClick
|
||||
style={{position: "relative"}}
|
||||
accept={accept}
|
||||
onDrop={this.onDrop.bind(this)}
|
||||
onDragEnter={this.onDragEnter.bind(this)}
|
||||
onDragLeave={this.onDragLeave.bind(this)}
|
||||
>
|
||||
{ dropzoneActive && <div style={overlayStyle}>Drop files...</div> }
|
||||
<div>
|
||||
<h1>My awesome app</h1>
|
||||
<label htmlFor="mimetypes">Enter mime types you want to accept: </label>
|
||||
<input
|
||||
type="text"
|
||||
id="mimetypes"
|
||||
onChange={this.applyMimeTypes.bind(this)}
|
||||
/>
|
||||
|
||||
<h2>Dropped files</h2>
|
||||
<ul>
|
||||
{
|
||||
files.map(f => <li>{f.name} - {f.size} bytes</li>)
|
||||
}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</Dropzone>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
<FullScreen />
|
||||
```
|
23
goTorrentWebUI/node_modules/react-dropzone/examples/Styling/Readme.md
generated
vendored
Normal file
23
goTorrentWebUI/node_modules/react-dropzone/examples/Styling/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
By default, the Dropzone component picks up some default styling to get you started. You can customize `<Dropzone>` by specifying a `style`, `activeStyle` or `rejectStyle` which is applied when a file is dragged over the zone. You can also specify `className`, `activeClassName` or `rejectClassName` if you would rather style using CSS.
|
||||
|
||||
## Updating styles and contents based on user input
|
||||
|
||||
By providing a function that returns the component's children you can not only style Dropzone appropriately but also render appropriate content.
|
||||
|
||||
```
|
||||
<Dropzone
|
||||
accept="image/png"
|
||||
>
|
||||
{({ isDragActive, isDragReject, acceptedFiles, rejectedFiles }) => {
|
||||
if (isDragActive) {
|
||||
return "This file is authorized";
|
||||
}
|
||||
if (isDragReject) {
|
||||
return "This file is not authorized";
|
||||
}
|
||||
return acceptedFiles.length || rejectedFiles.length
|
||||
? `Accepted ${acceptedFiles.length}, rejected ${rejectedFiles.length} files`
|
||||
: "Try dropping some files.";
|
||||
}}
|
||||
</Dropzone>
|
||||
```
|
12
goTorrentWebUI/node_modules/react-dropzone/examples/theme.css
generated
vendored
Normal file
12
goTorrentWebUI/node_modules/react-dropzone/examples/theme.css
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
section {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.dropzone {
|
||||
flex: 1 auto;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
aside {
|
||||
width: 50%;
|
||||
}
|
Reference in New Issue
Block a user