-
Notifications
You must be signed in to change notification settings - Fork 65
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
Add FileUploader widget #1540
base: master
Are you sure you want to change the base?
Add FileUploader widget #1540
Conversation
This pull request is being automatically deployed with Vercel (learn more). dojo.widgets – ./🔍 Inspect: https://vercel.com/dojo/dojowidgets/cpraac4yf widget-test-docs – ./🔍 Inspect: https://vercel.com/dojo/widget-test-docs/j4ljxjlc3 |
Codecov Report
@@ Coverage Diff @@
## master #1540 +/- ##
==========================================
- Coverage 90.15% 89.93% -0.23%
==========================================
Files 94 98 +4
Lines 4846 5016 +170
Branches 1297 1353 +56
==========================================
+ Hits 4369 4511 +142
- Misses 236 248 +12
- Partials 241 257 +16
Continue to review full report at Codecov.
|
I added comments to the issue re. the separation of the two widgets. I don't think this will need a child renderer at all as the file-list version of the file upload widget would be opinionated in it's appearance. The only child would likely be the |
234b08c
to
9ffb246
Compare
* FileUploadInput: add file type validation for DnD * FileUploadInput: update unit tests * FileUploader: add formatted file size display * FileUploader: add CustomValidator example
6db05be
to
19368f9
Compare
} | ||
} | ||
|
||
function onClickButton() { |
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.
if we really need to do this then perhaps you should rename this function to clickNativeButton
to make it clearer what it is doing.
|
||
export interface FileUploaderProperties extends FileUploadInputProperties { | ||
/** Custom validator used to validate each file */ | ||
customValidator?: (file: File) => ValidationInfo | void; |
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.
I'm not sure about this pattern, other widgets set the valid
property when they want to control the validation and use the the onValue
function to trigger said validation.
customValidator?: (file: File) => ValidationInfo | void; | ||
|
||
/** The files to render in the widget (controlled scenario) */ | ||
files?: FileWithValidation[]; |
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.
Seems odd that the validation is being mixed into the files for all of these callbacks. Would have expected onValue
etc and files
to only take / pass File[]
params.
Type: feature
The following has been addressed in the PR:
.dojorc
theme.variant()
is added to the root domnodetheme.compose
like thisDescription: add
FileUploader
widgetResolves #1129