-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@uppy/file-input: refactor to TypeScript #4954
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Diff output filesdiff --git a/packages/@uppy/file-input/lib/FileInput.js b/packages/@uppy/file-input/lib/FileInput.js
index f42cfa3..d688deb 100644
--- a/packages/@uppy/file-input/lib/FileInput.js
+++ b/packages/@uppy/file-input/lib/FileInput.js
@@ -5,22 +5,20 @@ const packageJson = {
"version": "3.0.4",
};
import locale from "./locale.js";
+const defaultOptions = {
+ pretty: true,
+ inputName: "files[]",
+};
export default class FileInput extends UIPlugin {
constructor(uppy, opts) {
- super(uppy, opts);
+ super(uppy, {
+ ...defaultOptions,
+ ...opts,
+ });
this.id = this.opts.id || "FileInput";
this.title = "File Input";
this.type = "acquirer";
this.defaultLocale = locale;
- const defaultOptions = {
- target: null,
- pretty: true,
- inputName: "files[]",
- };
- this.opts = {
- ...defaultOptions,
- ...opts,
- };
this.i18nInit();
this.render = this.render.bind(this);
this.handleInputChange = this.handleInputChange.bind(this);
@@ -60,7 +58,7 @@ export default class FileInput extends UIPlugin {
const {
restrictions,
} = this.uppy.opts;
- const accept = restrictions.allowedFileTypes ? restrictions.allowedFileTypes.join(",") : null;
+ const accept = restrictions.allowedFileTypes ? restrictions.allowedFileTypes.join(",") : undefined;
return h(
"div",
{
@@ -68,7 +66,7 @@ export default class FileInput extends UIPlugin {
},
h("input", {
className: "uppy-FileInput-input",
- style: this.opts.pretty && hiddenInputStyle,
+ style: this.opts.pretty ? hiddenInputStyle : undefined,
type: "file",
name: this.opts.inputName,
onChange: this.handleInputChange, |
aduh95
commented
Feb 23, 2024
aduh95
commented
Feb 23, 2024
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
aduh95
commented
Feb 24, 2024
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
aduh95
commented
Feb 24, 2024
aduh95
commented
Feb 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM
Murderlon
added a commit
that referenced
this pull request
Feb 26, 2024
* main: @uppy/file-input: refactor to TypeScript (#4954)
Murderlon
added a commit
that referenced
this pull request
Feb 26, 2024
* main: @uppy/file-input: refactor to TypeScript (#4954) Release: uppy@3.22.2 (#4952) @uppy/core: fix plugin detection (#4951) Introduce `ValidateableFile` & move `MinimalRequiredUppyFile` into utils (#4944) uppy: fix bundle builder (#4950) @uppy/core: improve `UIPluginOptions` types (#4946) @uppy/companion-client: fix body/url on upload-success (#4922) @uppy/utils: remove EventManager circular reference (#4949) MetaEditor + ImageEditor - new state machine logic (#4939) meta: disable `@typescript-eslint/no-non-null-assertion` lint rule (#4945) remove unnecessary `'use strict'` directives (#4943) @uppy/companion-client: type changes for provider-views (#4938) meta: bump ip from 1.1.8 to 1.1.9 (#4941)
Merged
github-actions bot
added a commit
that referenced
this pull request
Feb 28, 2024
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/box | 2.2.1 | @uppy/onedrive | 3.2.1 | | @uppy/companion-client | 3.7.4 | @uppy/progress-bar | 3.1.0 | | @uppy/core | 3.9.3 | @uppy/provider-views | 3.10.0 | | @uppy/dashboard | 3.7.5 | @uppy/status-bar | 3.3.0 | | @uppy/file-input | 3.1.0 | @uppy/utils | 5.7.4 | | @uppy/form | 3.2.0 | @uppy/xhr-upload | 3.6.4 | | @uppy/image-editor | 2.4.4 | uppy | 3.23.0 | | @uppy/informer | 3.1.0 | | | - @uppy/form: migrate to TS (Merlijn Vos / #4937) - @uppy/box: fetchPreAuthToken in box too (Mikael Finstad / #4969) - @uppy/progress-bar: refactor to TypeScript (Mikael Finstad / #4921) - @uppy/onedrive: fix custom oauth2 credentials for onedrive (Mikael Finstad / #4968) - @uppy/companion-client,@uppy/utils,@uppy/xhr-upload: improvements for #4922 (Mikael Finstad / #4960) - @uppy/utils: fix various type issues (Mikael Finstad / #4958) - @uppy/provider-views: migrate to TS (Merlijn Vos / #4919) - @uppy/utils: simplify `findDOMElements` (Mikael Finstad / #4957) - @uppy/xhr-upload: fix getResponseData regression (Merlijn Vos / #4964) - @uppy/informer: migrate to TS (Merlijn Vos / #4967) - @uppy/core: remove unused import (Antoine du Hamel / #4972) - @uppy/image-editor: remove default target (Merlijn Vos / #4966) - @uppy/angular: Build fixes (Mikael Finstad / #4959) - meta: Fix flaky e2e test (Murderlon) - meta: fix e2e flake (Mikael Finstad / #4961) - meta: add support for `Fragment` short syntax (Antoine du Hamel / #4953) - @uppy/file-input: refactor to TypeScript (Antoine du Hamel / #4954)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted from #4921