mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
feat(file-uploader-drop-container): add files prop
This commit is contained in:
parent
45c0e7960b
commit
8bfdb7f4e1
1 changed files with 10 additions and 2 deletions
|
@ -9,6 +9,12 @@
|
|||
*/
|
||||
export let accept = [];
|
||||
|
||||
/**
|
||||
* Obtain a reference to the uploaded files
|
||||
* @type {File[]}
|
||||
*/
|
||||
export let files = [];
|
||||
|
||||
/** Set to `true` to allow multiple files */
|
||||
export let multiple = false;
|
||||
|
||||
|
@ -68,7 +74,8 @@
|
|||
on:drop|preventDefault|stopPropagation="{({ dataTransfer }) => {
|
||||
if (!disabled) {
|
||||
over = false;
|
||||
dispatch('add', validateFiles([...dataTransfer.files]));
|
||||
files = validateFiles([...dataTransfer.files]);
|
||||
dispatch('add', files);
|
||||
}
|
||||
}}"
|
||||
>
|
||||
|
@ -106,7 +113,8 @@
|
|||
class:bx--file-input="{true}"
|
||||
on:change
|
||||
on:change="{({ target }) => {
|
||||
dispatch('add', validateFiles([...target.files]));
|
||||
files = validateFiles([...target.files]);
|
||||
dispatch('add', files);
|
||||
}}"
|
||||
on:click
|
||||
on:click="{({ target }) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue