filepond-plugin-file-validate-size
Advanced tools
Comparing version 2.2.2 to 2.2.3
/*! | ||
* FilePondPluginFileValidateSize 2.2.1 | ||
* FilePondPluginFileValidateSize 2.2.3 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT/ | ||
@@ -57,3 +57,7 @@ * Please visit https://pqina.nl/filepond/ for details. | ||
sub: replaceInString(query('GET_LABEL_MAX_FILE_SIZE'), { | ||
filesize: toNaturalFileSize(sizeMax) | ||
filesize: toNaturalFileSize( | ||
sizeMax, | ||
'.', | ||
root.query('GET_FILE_SIZE_BASE') | ||
) | ||
}) | ||
@@ -72,3 +76,7 @@ } | ||
sub: replaceInString(query('GET_LABEL_MIN_FILE_SIZE'), { | ||
filesize: toNaturalFileSize(sizeMin) | ||
filesize: toNaturalFileSize( | ||
sizeMin, | ||
'.', | ||
root.query('GET_FILE_SIZE_BASE') | ||
) | ||
}) | ||
@@ -75,0 +83,0 @@ } |
/*! | ||
* FilePondPluginFileValidateSize 2.2.1 | ||
* FilePondPluginFileValidateSize 2.2.3 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT/ | ||
@@ -9,2 +9,2 @@ * Please visit https://pqina.nl/filepond/ for details. | ||
const e=({addFilter:e,utils:i})=>{const{Type:l,replaceInString:E,toNaturalFileSize:_}=i;return e("ALLOW_HOPPER_ITEM",(e,{query:i})=>{if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;const l=i("GET_MAX_FILE_SIZE");if(null!==l&&e.size>=l)return!1;const E=i("GET_MIN_FILE_SIZE");return!(null!==E&&e.size<=E)}),e("LOAD_FILE",(e,{query:i})=>new Promise((l,I)=>{if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return l(e);const t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return l(e);const n=i("GET_MAX_FILE_SIZE");if(null!==n&&e.size>=n)return void I({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:E(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:_(n)})}});const s=i("GET_MIN_FILE_SIZE");if(null!==s&&e.size<=s)return void I({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:E(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:_(s)})}});const L=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==L){if(i("GET_ACTIVE_ITEMS").reduce((e,i)=>e+i.fileSize,0)>L)return void I({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:E(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:_(L)})}})}l(e)})),{options:{allowFileSizeValidation:[!0,l.BOOLEAN],maxFileSize:[null,l.INT],minFileSize:[null,l.INT],maxTotalFileSize:[null,l.INT],fileValidateSizeFilter:[null,l.FUNCTION],labelMinFileSizeExceeded:["File is too small",l.STRING],labelMinFileSize:["Minimum file size is {filesize}",l.STRING],labelMaxFileSizeExceeded:["File is too large",l.STRING],labelMaxFileSize:["Maximum file size is {filesize}",l.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",l.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",l.STRING]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e}));export default e; | ||
const e=({addFilter:e,utils:i})=>{const{Type:E,replaceInString:l,toNaturalFileSize:_}=i;return e("ALLOW_HOPPER_ITEM",(e,{query:i})=>{if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;const E=i("GET_MAX_FILE_SIZE");if(null!==E&&e.size>=E)return!1;const l=i("GET_MIN_FILE_SIZE");return!(null!==l&&e.size<=l)}),e("LOAD_FILE",(e,{query:i})=>new Promise((E,I)=>{if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return E(e);const t=i("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return E(e);const n=i("GET_MAX_FILE_SIZE");if(null!==n&&e.size>=n)return void I({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:_(n,".",root.query("GET_FILE_SIZE_BASE"))})}});const L=i("GET_MIN_FILE_SIZE");if(null!==L&&e.size<=L)return void I({status:{main:i("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MIN_FILE_SIZE"),{filesize:_(L,".",root.query("GET_FILE_SIZE_BASE"))})}});const T=i("GET_MAX_TOTAL_FILE_SIZE");if(null!==T){if(i("GET_ACTIVE_ITEMS").reduce((e,i)=>e+i.fileSize,0)>T)return void I({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:l(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:_(T)})}})}E(e)})),{options:{allowFileSizeValidation:[!0,E.BOOLEAN],maxFileSize:[null,E.INT],minFileSize:[null,E.INT],maxTotalFileSize:[null,E.INT],fileValidateSizeFilter:[null,E.FUNCTION],labelMinFileSizeExceeded:["File is too small",E.STRING],labelMinFileSize:["Minimum file size is {filesize}",E.STRING],labelMaxFileSizeExceeded:["File is too large",E.STRING],labelMaxFileSize:["Maximum file size is {filesize}",E.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",E.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",E.STRING]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e}));export default e; |
/*! | ||
* FilePondPluginFileValidateSize 2.2.1 | ||
* FilePondPluginFileValidateSize 2.2.3 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT/ | ||
@@ -71,3 +71,7 @@ * Please visit https://pqina.nl/filepond/ for details. | ||
sub: replaceInString(query('GET_LABEL_MAX_FILE_SIZE'), { | ||
filesize: toNaturalFileSize(sizeMax) | ||
filesize: toNaturalFileSize( | ||
sizeMax, | ||
'.', | ||
root.query('GET_FILE_SIZE_BASE') | ||
) | ||
}) | ||
@@ -87,3 +91,7 @@ } | ||
sub: replaceInString(query('GET_LABEL_MIN_FILE_SIZE'), { | ||
filesize: toNaturalFileSize(sizeMin) | ||
filesize: toNaturalFileSize( | ||
sizeMin, | ||
'.', | ||
root.query('GET_FILE_SIZE_BASE') | ||
) | ||
}) | ||
@@ -90,0 +98,0 @@ } |
/*! | ||
* FilePondPluginFileValidateSize 2.2.1 | ||
* FilePondPluginFileValidateSize 2.2.3 | ||
* Licensed under MIT, https://opensource.org/licenses/MIT/ | ||
@@ -9,2 +9,2 @@ * Please visit https://pqina.nl/filepond/ for details. | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e=e||self).FilePondPluginFileValidateSize=i()}(this,function(){"use strict";var e=function(e){var i=e.addFilter,l=e.utils,E=l.Type,n=l.replaceInString,_=l.toNaturalFileSize;return i("ALLOW_HOPPER_ITEM",function(e,i){var l=i.query;if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var E=l("GET_MAX_FILE_SIZE");if(null!==E&&e.size>=E)return!1;var n=l("GET_MIN_FILE_SIZE");return!(null!==n&&e.size<=n)}),i("LOAD_FILE",function(e,i){var l=i.query;return new Promise(function(i,E){if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return i(e);var t=l("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return i(e);var a=l("GET_MAX_FILE_SIZE");if(null!==a&&e.size>=a)E({status:{main:l("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:n(l("GET_LABEL_MAX_FILE_SIZE"),{filesize:_(a)})}});else{var I=l("GET_MIN_FILE_SIZE");if(null!==I&&e.size<=I)E({status:{main:l("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:n(l("GET_LABEL_MIN_FILE_SIZE"),{filesize:_(I)})}});else{var u=l("GET_MAX_TOTAL_FILE_SIZE");if(null!==u)if(l("GET_ACTIVE_ITEMS").reduce(function(e,i){return e+i.fileSize},0)>u)return void E({status:{main:l("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:n(l("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:_(u)})}});i(e)}}})}),{options:{allowFileSizeValidation:[!0,E.BOOLEAN],maxFileSize:[null,E.INT],minFileSize:[null,E.INT],maxTotalFileSize:[null,E.INT],fileValidateSizeFilter:[null,E.FUNCTION],labelMinFileSizeExceeded:["File is too small",E.STRING],labelMinFileSize:["Minimum file size is {filesize}",E.STRING],labelMaxFileSizeExceeded:["File is too large",E.STRING],labelMaxFileSize:["Maximum file size is {filesize}",E.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",E.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",E.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}); | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(e=e||self).FilePondPluginFileValidateSize=i()}(this,function(){"use strict";var e=function(e){var i=e.addFilter,l=e.utils,E=l.Type,_=l.replaceInString,n=l.toNaturalFileSize;return i("ALLOW_HOPPER_ITEM",function(e,i){var l=i.query;if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var E=l("GET_MAX_FILE_SIZE");if(null!==E&&e.size>=E)return!1;var _=l("GET_MIN_FILE_SIZE");return!(null!==_&&e.size<=_)}),i("LOAD_FILE",function(e,i){var l=i.query;return new Promise(function(i,E){if(!l("GET_ALLOW_FILE_SIZE_VALIDATION"))return i(e);var t=l("GET_FILE_VALIDATE_SIZE_FILTER");if(t&&!t(e))return i(e);var I=l("GET_MAX_FILE_SIZE");if(null!==I&&e.size>=I)E({status:{main:l("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:_(l("GET_LABEL_MAX_FILE_SIZE"),{filesize:n(I,".",root.query("GET_FILE_SIZE_BASE"))})}});else{var u=l("GET_MIN_FILE_SIZE");if(null!==u&&e.size<=u)E({status:{main:l("GET_LABEL_MIN_FILE_SIZE_EXCEEDED"),sub:_(l("GET_LABEL_MIN_FILE_SIZE"),{filesize:n(u,".",root.query("GET_FILE_SIZE_BASE"))})}});else{var a=l("GET_MAX_TOTAL_FILE_SIZE");if(null!==a)if(l("GET_ACTIVE_ITEMS").reduce(function(e,i){return e+i.fileSize},0)>a)return void E({status:{main:l("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:_(l("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:n(a)})}});i(e)}}})}),{options:{allowFileSizeValidation:[!0,E.BOOLEAN],maxFileSize:[null,E.INT],minFileSize:[null,E.INT],maxTotalFileSize:[null,E.INT],fileValidateSizeFilter:[null,E.FUNCTION],labelMinFileSizeExceeded:["File is too small",E.STRING],labelMinFileSize:["Minimum file size is {filesize}",E.STRING],labelMaxFileSizeExceeded:["File is too large",E.STRING],labelMaxFileSize:["Maximum file size is {filesize}",E.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",E.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",E.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}); |
{ | ||
"name": "filepond-plugin-file-validate-size", | ||
"version": "2.2.2", | ||
"description": "File Size Validation Plugin for FilePond", | ||
"license": "MIT", | ||
"author": { | ||
"name": "PQINA", | ||
"url": "https://pqina.nl/" | ||
}, | ||
"homepage": "https://pqina.nl/filepond/", | ||
"repository": "pqina/filepond-plugin-file-validate-size", | ||
"main": "dist/filepond-plugin-file-validate-size.js", | ||
"browser": "dist/filepond-plugin-file-validate-size.js", | ||
"module": "dist/filepond-plugin-file-validate-size.esm.js", | ||
"browserslist": [ | ||
"last 1 version and not Explorer 10", | ||
"Explorer 11", | ||
"iOS >= 9", | ||
"Android >= 4.4" | ||
], | ||
"files": [ | ||
"dist", | ||
"types/*.d.ts" | ||
], | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"start": "npx rollup -c -w", | ||
"build": "npx rollup -c" | ||
}, | ||
"peerDependencies": { | ||
"filepond": ">=3.1.2 <5.x" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.4.0", | ||
"@babel/preset-env": "^7.4.2", | ||
"rollup": "^1.7.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.2.1", | ||
"rollup-plugin-license": "^0.8.1", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-prettier": "^0.6.0", | ||
"rollup-plugin-terser": "^4.0.4" | ||
} | ||
} | ||
"name": "filepond-plugin-file-validate-size", | ||
"version": "2.2.3", | ||
"description": "File Size Validation Plugin for FilePond", | ||
"license": "MIT", | ||
"author": { | ||
"name": "PQINA", | ||
"url": "https://pqina.nl/" | ||
}, | ||
"homepage": "https://pqina.nl/filepond/", | ||
"repository": "pqina/filepond-plugin-file-validate-size", | ||
"main": "dist/filepond-plugin-file-validate-size.js", | ||
"browser": "dist/filepond-plugin-file-validate-size.js", | ||
"module": "dist/filepond-plugin-file-validate-size.esm.js", | ||
"browserslist": [ | ||
"last 1 version and not Explorer 10", | ||
"Explorer 11", | ||
"iOS >= 9", | ||
"Android >= 4.4" | ||
], | ||
"files": [ | ||
"dist", | ||
"types/*.d.ts" | ||
], | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"start": "npx rollup -c -w", | ||
"build": "npx rollup -c" | ||
}, | ||
"peerDependencies": { | ||
"filepond": ">=3.1.2 <5.x" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.4.0", | ||
"@babel/preset-env": "^7.4.2", | ||
"rollup": "^1.7.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.2.1", | ||
"rollup-plugin-license": "^0.8.1", | ||
"rollup-plugin-node-resolve": "^4.0.1", | ||
"rollup-plugin-prettier": "^0.6.0", | ||
"rollup-plugin-terser": "^4.0.4" | ||
} | ||
} |
@@ -1,21 +0,21 @@ | ||
declare module "filepond-plugin-file-validate-size" { | ||
const FilePondPluginFileValidateSize: FilePondPluginFileValidateSizeProps; | ||
export interface FilePondPluginFileValidateSizeProps { | ||
/** Enable or disable file size validation. */ | ||
allowFileSizeValidation?: boolean; | ||
/** The maximum size of a file, for instance 5MB or 750KB. */ | ||
maxFileSize: string | null; | ||
/** Maximum size of all files in list, same format as maxFileSize. */ | ||
maxTotalFileSize: string | null; | ||
/** Message shown when a large file is dropped. */ | ||
labelMaxFileSizeExceeded?: string; | ||
/** Message shown when max file size was exceeded. {filesize} is replaced with the value of the maxFileSize property. */ | ||
labelMaxFileSize?: string; | ||
/** Message shown when total file size exceeds maximum. */ | ||
labelMaxTotalFileSizeExceeded?: string; | ||
/** Message shown then total file size exceeds maximum. */ | ||
labelMaxTotalFileSize?: string; | ||
} | ||
export default FilePondPluginFileValidateSize; | ||
// @ts-ignore | ||
import { FilePondOptions } from "filepond"; | ||
declare module "filepond" { | ||
export interface FilePondOptions { | ||
/** Enable or disable file size validation. */ | ||
allowFileSizeValidation?: boolean; | ||
/** The maximum size of a file, for instance 5MB or 750KB. */ | ||
maxFileSize?: string | null; | ||
/** Maximum size of all files in list, same format as maxFileSize. */ | ||
maxTotalFileSize?: string | null; | ||
/** Message shown when a large file is dropped. */ | ||
labelMaxFileSizeExceeded?: string; | ||
/** Message shown when max file size was exceeded. {filesize} is replaced with the value of the maxFileSize property. */ | ||
labelMaxFileSize?: string; | ||
/** Message shown when total file size exceeds maximum. */ | ||
labelMaxTotalFileSizeExceeded?: string; | ||
/** Message shown then total file size exceeds maximum. */ | ||
labelMaxTotalFileSize?: string; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18087
339