Skip to content

Commit

Permalink
feat(input): add files property
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Jan 12, 2023
1 parent efd08f1 commit a9b9a04
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ export class Input
/** The component's value. */
@Prop({ mutable: true }) value = "";

/**
* Contains the component's list of files when `type` is `"file"`.
*
* @mdn https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/files
*/
@Prop({ mutable: true }) files: FileList;

/**
* Made into a prop for testing purposes only
*
Expand All @@ -344,6 +351,10 @@ export class Input

@Watch("value")
valueWatcher(newValue: string, previousValue: string): void {
if (this.type === "file") {
this.files = (this.childEl as HTMLInputElement).files;
}

if (!this.userChangedValue) {
this.setValue({
origin: "direct",
Expand Down

0 comments on commit a9b9a04

Please sign in to comment.