Remoto - VFS
|
A file upload field. More...
#include "remoto!stdlib:js/widgets/widgets/fileUploadWidget.js"
Public Member Functions | |
fileUploadWidget (d) | |
fileUploadWidget constructor More... | |
activate () | |
Activate this widget, which will enable clicking and dropping. More... | |
createWidget () | |
Create only the widget portion of this widget. More... | |
deactivate () | |
Remove clicking and dropping, and make this widget inert. More... | |
doFileRemove () | |
Store an empty value in this field, and trigger the correct down-stream things. More... | |
doFileSelect () | |
Trigger the hidden file upload field to do its thing. More... | |
fileContentsChanged () | |
Do the encoding work and follow the logic based on mime type. More... | |
Public Member Functions inherited from widget | |
widget (d) | |
widget contstructor More... | |
activate () | |
Activate the widget, which will cause changes to propagate to the form, and therefore the submit() mechanism. More... | |
applyOptions () | |
Apply option changes to an existing widget, like from a diff. More... | |
arrowMessage (m) | |
Create an arrowMessage and point its arrow at this widget's position on screen. More... | |
createHTML () | |
Create the HTML representation of this object, including the label and form field. More... | |
createLabel () | |
Create the label jQuery object. More... | |
createWidget () | |
Create the widget jQuery object. More... | |
deactivate () | |
Deactivate the widget, which will unbind input events from their callbacks. More... | |
destroy () | |
Destroy this widget. More... | |
disable () | |
Disable this widget. More... | |
doChange () | |
Collect changes to the value of this widget and call this widget's _change method, if it exists, after a period of the user's uifreqency has expired. More... | |
enable () | |
Enable this widget. More... | |
sync () | |
Sync the visible value with the internal value. More... | |
validate () | |
Validate the value of this widget using the _validator function. More... | |
setter | immediateValue |
Set the value of this widget, and trigger the doChange method without waiting. More... | |
getter | value |
Return the internal value of this widget, which may not be the same as what is displayed in the interface. More... | |
getter | defaultValue |
Return the default value of this widget. More... | |
getter | visibleWidget |
Return the visible jQuery object for this widget. More... | |
getter | isDefault |
Return whether or not this widget's value is its default value. More... | |
getter | nonDefaultValue |
Return the value of this widget, or return undefined if it contains the default value. More... | |
setter | validator |
Set this widget's validator function. More... | |
setter | error |
Set the error value of this widget. More... | |
setter | activeUser |
Set the activeUser of this widget. More... | |
getter | enabled |
Return true or false based on _enabled state. More... | |
getter | hidden |
The hidden state of this widget. More... | |
A file upload field.
This field can contain any data, however it is primarily used for images. Data is stored as a data URI string to the widget field.
For images, an invisible canvas is created and the toDataURL method is used:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL
For images, the folowing web formats are supported: ".jpg,.jpeg,.gif,.png,.svg,image/[mime]".
Notice that on a system that can detect a file type without an extension, a mime type starting with "image/" is accepted.
Available options:
fileUploadWidget | ( | d | ) |
fileUploadWidget constructor
d | The widget definition object |
activate | ( | ) |
Activate this widget, which will enable clicking and dropping.
createWidget | ( | ) |
Create only the widget portion of this widget.
This will create a "remove" and "choose" button, as well as a larger box that is clickable and droppable for new images or files.
deactivate | ( | ) |
Remove clicking and dropping, and make this widget inert.
doFileRemove | ( | ) |
Store an empty value in this field, and trigger the correct down-stream things.
doFileSelect | ( | ) |
Trigger the hidden file upload field to do its thing.
Effectively we are submitting a form here, but abstracted by layers of VFS interface.
fileContentsChanged | ( | ) |
Do the encoding work and follow the logic based on mime type.
Do the best we can to understand an incoming mime type and process it. Images have the most focus here.
Ultimately the result is a data URI stored to the value() setter.