mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
feat(bootstrap-fileinput): add missing instance methods (#43312)
- missing methods added - tests added to package - TS details updated to match current DT recommendations - formatting with DT prettier settings https://plugins.krajee.com/file-input/plugin-methods /cc @aliemre1990 Thanks! Fixes: #43288
This commit is contained in:
parent
0506ca2fe8
commit
480921ca85
@@ -0,0 +1,79 @@
|
||||
$('#input-id').fileinput();
|
||||
const plugin = $('#input-id').fileinput({ showUpload: false, previewFileType: 'any' });
|
||||
$('document').on('ready', () => {
|
||||
$('#input-id')
|
||||
.fileinput({
|
||||
uploadUrl: 'http://localhost/file-upload.php',
|
||||
uploadExtraData: {
|
||||
uploadToken: 'SOME-TOKEN', // for access control / security
|
||||
},
|
||||
maxFileCount: 5,
|
||||
allowedFileTypes: ['image'], // allow only images
|
||||
showCancel: true,
|
||||
overwriteInitial: false,
|
||||
theme: 'fas',
|
||||
deleteUrl: 'http://localhost/file-delete.php',
|
||||
})
|
||||
.on('fileuploaded', (event, previewId, index, fileId) => {
|
||||
console.log('File Uploaded', `ID: ${fileId}, Thumb ID: ${previewId}`);
|
||||
})
|
||||
.on('fileuploaderror', (event, data, msg) => {
|
||||
console.log('File Upload Error', `ID: ${data.fileId}, Thumb ID: ${data.previewId}`);
|
||||
})
|
||||
.on('filebatchuploadcomplete', (event, preview, config, tags, extraData) => {
|
||||
console.log('File Batch Uploaded', preview, config, tags, extraData);
|
||||
});
|
||||
|
||||
$('#input-id').fileinput('disable');
|
||||
$('#input-id').fileinput('enable');
|
||||
$('#input-id').fileinput('reset');
|
||||
$('#input-id').fileinput('destroy');
|
||||
$('#input-id')
|
||||
.fileinput('destroy')
|
||||
.fileinput({ showPreview: false });
|
||||
$('#input-id').attr('disabled', 'disabled');
|
||||
$('#input-id').fileinput('refresh');
|
||||
$('#input-id').fileinput('refresh', { browseLabel: 'Select...', removeLabel: 'Delete' });
|
||||
$('#input-id')
|
||||
.fileinput('refresh', { showCaption: false })
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('clear')
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('upload')
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('cancel')
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('pause')
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('lock')
|
||||
.fileinput('disable');
|
||||
$('#input-id')
|
||||
.fileinput('resume')
|
||||
.fileinput('unlock');
|
||||
const fileObj: File = null!;
|
||||
$('#input-id').fileinput('addToStack', fileObj);
|
||||
$('#input-id').fileinput('addToStack', fileObj, '#input-id');
|
||||
$('#input-id').fileinput('clearFileStack');
|
||||
const filestack = $('#input-id').fileinput('getFileStack');
|
||||
const fstack: File[] = [];
|
||||
$.each(filestack, (fileId, fileObj) => {
|
||||
if (fileObj !== undefined) {
|
||||
fstack.push(fileObj);
|
||||
}
|
||||
});
|
||||
const files = $('#input-id').fileinput('getFileList');
|
||||
const filesCount = $('#input-id').fileinput('getFilesCount');
|
||||
const totalFilesCount = $('#input-id').fileinput('getFilesCount', true);
|
||||
$('#input-id').fileinput('readFiles', files);
|
||||
$('#input-id').fileinput('zoom', 'preview-123882');
|
||||
const preview = $('#input-id').fileinput('getPreview'); // $ExpectType PreviewInfo
|
||||
const exif = $('#input-id').fileinput('getExif', 'yourThumbFrameId');
|
||||
$('#input1').fileinput('getFrames');
|
||||
$('#input2').fileinput('getFrames', '.file-preview-initial');
|
||||
$('#input3').fileinput('getFrames', ':not(.file-preview-success)');
|
||||
});
|
||||
Vendored
+804
-694
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"bootstrap-fileinput-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,16 +1 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"array-type": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"dt-header": false,
|
||||
"export-just-namespace": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-internal-module": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"prefer-method-signature": false,
|
||||
"semicolon": false
|
||||
}
|
||||
}
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
|
||||
Reference in New Issue
Block a user