feat(file-uploader-drop-container): dispatch instead of forward change event

This commit is contained in:
Eric Liu 2022-02-21 10:24:27 -08:00
commit e1cfc5864f

View file

@ -1,6 +1,7 @@
<script> <script>
/** /**
* @event {File} add * @event {File[]} add
* @event {File[]} change
*/ */
/** /**
@ -76,6 +77,7 @@
over = false; over = false;
files = validateFiles([...dataTransfer.files]); files = validateFiles([...dataTransfer.files]);
dispatch('add', files); dispatch('add', files);
dispatch('change', files);
} }
}}" }}"
> >
@ -111,10 +113,10 @@
name="{name}" name="{name}"
multiple="{multiple}" multiple="{multiple}"
class:bx--file-input="{true}" class:bx--file-input="{true}"
on:change
on:change="{({ target }) => { on:change="{({ target }) => {
files = validateFiles([...target.files]); files = validateFiles([...target.files]);
dispatch('add', files); dispatch('add', files);
dispatch('change', files);
}}" }}"
on:click on:click
on:click="{({ target }) => { on:click="{({ target }) => {