mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #9807 from EnableSoftware/jquery.fileupload
Jquery.fileupload
This commit is contained in:
@@ -13,6 +13,18 @@ var __handleAddingFile = function (event:any, data:any)
|
||||
data.submit();
|
||||
};
|
||||
|
||||
var options: JQueryFileInputOptions = {
|
||||
dataType: 'json',
|
||||
singleFileUploads: true,
|
||||
limitMultiFileUploads: 1,
|
||||
add: __handleAddingFile,
|
||||
done: (e, data) => {
|
||||
data.result;
|
||||
data.jqXHR;
|
||||
data.textStatus;
|
||||
}
|
||||
}
|
||||
|
||||
class TestFileInput {
|
||||
|
||||
// The whole body will be the container for this test
|
||||
@@ -24,20 +36,6 @@ class TestFileInput {
|
||||
constructor() {
|
||||
|
||||
// The file upload object receives a fileInputOptions configuration object
|
||||
this.fileInput = <JQueryFileUpload>this.$el.fileupload({
|
||||
|
||||
dataType: 'json',
|
||||
|
||||
// By default, each file of a selection is uploaded using an individual
|
||||
// request for XHR type uploads. Set to false to upload file
|
||||
// selections in one request each:
|
||||
singleFileUploads: true,
|
||||
// To limit the number of files uploaded with one XHR request,
|
||||
// set the following option to an integer greater than 0:
|
||||
limitMultiFileUploads: 1,
|
||||
|
||||
add: __handleAddingFile
|
||||
|
||||
});
|
||||
this.fileInput = <JQueryFileUpload>this.$el.fileupload(options);
|
||||
}
|
||||
}
|
||||
|
||||
+53
-16
@@ -207,25 +207,25 @@ interface JQueryFileInputOptions {
|
||||
timeout?: number;
|
||||
|
||||
active?: Function;
|
||||
progress?: Function;
|
||||
send?: Function;
|
||||
progress?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
|
||||
send?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
|
||||
|
||||
// Other callbacks:
|
||||
submit?: Function;
|
||||
done?: Function;
|
||||
fail?: Function;
|
||||
always?: Function;
|
||||
progressall?: Function;
|
||||
start?: Function;
|
||||
stop?: Function;
|
||||
change?: Function;
|
||||
paste?: Function;
|
||||
drop?: Function;
|
||||
dragover?: Function;
|
||||
chunksend?: Function;
|
||||
chunkdone?: Function;
|
||||
chunkfail?: Function;
|
||||
chunkalways?: Function;
|
||||
done?: (e: JQueryEventObject, data: JQueryFileUploadDone) => void;
|
||||
fail?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void;
|
||||
always?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void;
|
||||
progressall?: (e: JQueryEventObject, data: JQueryFileUploadProgressAllObject) => void;
|
||||
start?: (e: JQueryEventObject) => void;
|
||||
stop?: (e: JQueryEventObject) => void;
|
||||
change?: (e: JQueryEventObject, data: JQueryFileUploadChangeObject) => void;
|
||||
paste?: (e: JQueryEventObject, data: JQueryFileUploadFilesObject) => void;
|
||||
drop?: (e: JQueryEventObject, data: JQueryFileUploadFilesObject) => void;
|
||||
dragover?: (e: JQueryEventObject) => void;
|
||||
chunksend?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
|
||||
chunkdone?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
|
||||
chunkfail?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
|
||||
chunkalways?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
|
||||
|
||||
// Others
|
||||
url?: string;
|
||||
@@ -250,3 +250,40 @@ interface JQuery {
|
||||
interface JQuerySupport {
|
||||
fileInput?: boolean;
|
||||
}
|
||||
|
||||
interface JQueryFileUploadChangeObject {
|
||||
fileInput?: JQuery;
|
||||
fileInputClone?: JQuery;
|
||||
files: File[];
|
||||
form?: JQuery;
|
||||
originalFiles: File[];
|
||||
}
|
||||
|
||||
interface JQueryFileUploadProgressAllObject {
|
||||
loaded?: number;
|
||||
total?: number;
|
||||
bitrate?: number;
|
||||
}
|
||||
|
||||
interface JQueryFileUploadXhr {
|
||||
jqXHR: JQueryXHR;
|
||||
result: any;
|
||||
textStatus: string;
|
||||
}
|
||||
|
||||
interface JQueryFileUploadFilesObject {
|
||||
files: File[];
|
||||
}
|
||||
|
||||
interface JQueryFileUploadChunkObject extends JQueryFileInputOptions, JQueryFileUploadXhr {
|
||||
blob: any;
|
||||
chunkSize: number;
|
||||
contentRange: string;
|
||||
errorThrown: any;
|
||||
}
|
||||
|
||||
interface JQueryFileUploadProgressObject extends JQueryFileInputOptions, JQueryFileUploadProgressAllObject {
|
||||
}
|
||||
|
||||
interface JQueryFileUploadDone extends JQueryFileInputOptions, JQueryFileUploadXhr {
|
||||
}
|
||||
Reference in New Issue
Block a user