Simple Vault properties
Usage
{
type: "simplevault",
name?: string,
id?: string,
target?: string,
value?: [
{
id?: string | number,
file?: File,
status?: "queue" | "inprogress" | "uploaded" | "failed",
progress?: number,
request?: XMLHttpRequest,
path?: string,
name?: string,
[key: string]?: any
},
// more file objects
],
css?: string,
height?: string | number | "content", // "content" by default
width?: string | number | "content", // "content" by default
padding?: string | number,
hidden?: boolean, // false by default
disabled?: boolean, // false by default
fieldName?: string, // "file" by default
params?: {
[key: string]: any,
},
headerParams?: {
[key: string]: any,
},
singleRequest?: boolean, // false by default
updateFromResponse?: boolean, // true by default
autosend?: boolean, // false by default
accept?: string, // all file types by default
validation?: (value: object[]) => boolean;
required?: boolean, // false by default
hiddenLabel?: boolean, // false by default
label?: string,
labelPosition?: "left" | "top", // "top" by default
labelWidth?: string | number,
helpMessage?: string,
preMessage?: string,
successMessage?: string,
errorMessage?: string,
}
Description
type | (required) the type of a control, set it to "simpleVault" |
name | (optional) the name of a control |
id | (optional) the id of a control, auto-generated if not set |
target | (optional) sets an URL to the server-side script that will process file upload |
value | (optional) sets the default list of loaded files. Each file object can contain the following properties:
|
css | (optional) adds style classes to a control |
height | (optional) the height of a control, "content" by default |
width | (optional) the width of a control, "content" by default |
padding | (optional) sets padding between a cell and a border of the SimpleVault control |
hidden | (optional) defines whether a control is hidden, false by default |
disabled | (optional) defines whether a control is enabled (false) or disabled (true), false by default |
fieldName | (optional) sets the name of the file field in the form data that is sent to the server, "file" by default |
params | (optional) adds extra parameters for sending an XMLHttpRequest |
headerParams | (optional) provides additional parameters for Request Headers |
singleRequest | (optional) defines whether files are sent in one request, false by default |
updateFromResponse | (optional) updates file attributes with the data from the server response, true by default |
autosend | (optional) enables/disables automatic sending of an added file (files won't be sent if they fail validation), false by default |
accept | (optional) allows specifying the type/extension that will be displayed in the dialog window during the file selection. Check details, all file types by default |
validation | (optional) the validation function, takes as a parameter the value to validate and returns true/false to indicate the result of validation |
required | (optional) defines whether a control is required, false by default |
hiddenLabel | (optional) makes the label invisible, false by default |
label | (optional) specifies a label for a control |
labelPosition | (optional) defines the position of a label: "left" | "top", "top" by default |
labelWidth | (optional) sets the width of the label of a control |
helpMessage | (optional) adds a help message to a control |
preMessage | (optional) a message that contains instructions for interacting with the control |
successMessage | (optional) a message that appears in case of successful validation of the control value |
errorMessage | (optional) a message that appears in case of error during validation of the control value |
Example
Related article: SimpleVault