Skip to content

Commit

Permalink
fix(core/upload): drop while loading and input width (#655)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Leroux <daniel.leroux@siemens.com>
  • Loading branch information
goncalosard and danielleroux committed Jul 31, 2023
1 parent 8d5b979 commit 2a12e33
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/components/upload/upload.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
}

&.file-over {
&:not(.disabled).file-over {
border-color: var(--theme-upload--border-color--dragover);
border-style: solid;
}
Expand All @@ -73,10 +73,14 @@
}

.upload-browser {
opacity: 0;
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
z-index: -1;
width: 1px;
}

.loader {
Expand Down
15 changes: 11 additions & 4 deletions packages/core/src/components/upload/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ export class Upload {
}

private fileOver(event: DragEvent) {
event.preventDefault();
event.dataTransfer.dropEffect = 'move';
if (this.state !== UploadFileState.LOADING) {
event.preventDefault();
event.dataTransfer.dropEffect = 'move';
}

if (!this.multiple && event.dataTransfer.items.length > 1) {
event.preventDefault();
Expand Down Expand Up @@ -206,12 +208,17 @@ export class Upload {
<div
class={{
'file-upload-area': true,
'file-over': this.isFileOver,
'file-over':
this.state !== UploadFileState.LOADING && this.isFileOver,
checking: this.state === UploadFileState.LOADING,
disabled: this.disabled,
multiline: this.multiline,
}}
onDrop={(e) => this.fileDropped(e)}
onDrop={(e) => {
if (this.state !== UploadFileState.LOADING) {
this.fileDropped(e);
}
}}
onDragOver={(e) => this.fileOver(e)}
onDragLeave={() => this.fileLeave()}
draggable={!this.disabled}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2a12e33

Please sign in to comment.