-
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
Uploader widget #1129
Comments
The native At its most basic,
A child renderer function could be provided to control the list of selected files. To expose "remove file" functionality to the child renderer, we have two options: add a
In the future, it would be possible to add a drag-and-drop area (
|
UI mock for discussion: The mock has 4 file rows:
interface UploaderChildren {
buttonLabel?: string; // Choose files…
dndLabel?: string; // Or drop files here
renderFiles?(props: { files: File[] }): RenderResult;
}
interface UploaderProperties {
// generic form properties
disabled?: boolean;
name?: string;
required?: boolean;
onValue?: (selectedFiles: File[]): void;
// specific to file uploading
/**
* File-type extensions or MIME types
*/
accept?: string | string[];
allowDnd?: boolean;
/**
* Can multiple files be uploaded? Defaults to true.
*/
multiple?: boolean;
} |
@msssk good questions / points so far. I think that we may well want multiple file uploaders to support different scenarios. FileUploaderThe basic uploader would use a label as you suggested to wrap the underlying input element and provide both a dojo and a material themed appearance. MultiFileUploaderThe multi file uploader could well have an appearance similar to that of your code pen example but would be opinionated about how it renders it's children rather than offering a child renderer for them. It would use the interface MultiFileUploaderProperties {
value?: File[];
initialValue?: File[];
onValue(files: File[]) => void;
onAdd(file: File) => void;
onRemove(file: File) => void;
} When the The multi file uploader would also have the same kind of properties as the single file uploader such as required / dnd etc. It would probably also benefit from some validation such as max / min number of files? This is far from extensive, but just my current thoughts on the above and the codepen example. What do you think? |
edit to the above, the multi probably only needs |
I've created a draft PR (#1540) for this with a basic implementation and a few examples - Basic, Disabled, Multiple. What would be the value of two separate widgets for single and multi file handling? One challenge I am seeing with that is the need to specify the
I think the next best things to work on are validation and DnD. After that maybe look into the widget itself handling XHR uploads? That would allow us to provide a renderer that handles progress display and errors. |
The idea between the two different widgets would be to provide both a basic and a more complete widget with a file list etc. You could certainly still specify
|
I've split the widgets into two - a base File uploads and DnD are necessitating some DOM interactions not currently supported by Dojo:
|
We should really get this over the line |
Please add all comments and discussions surround an uploader widget to this issue
The text was updated successfully, but these errors were encountered: