UNPKG

@progress/kendo-react-upload

Version:

React Upload component helps users transfer files from their file systems to dedicated server handlers. KendoReact Upload package

23 lines (22 loc) 1.3 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ const r = "invalidMaxFileSize", t = "invalidMinFileSize", d = "invalidFileExtension", E = (i, o) => { o.length > 0 && o.indexOf((i.extension || "").toLowerCase()) < 0 && (i.validationErrors = i.validationErrors || [], i.validationErrors.indexOf(d) < 0 && i.validationErrors.push(d)); }, l = (i, o, n) => { o !== 0 && (i.size || 0) < o && (i.validationErrors = i.validationErrors || [], i.validationErrors.indexOf(t) < 0 && i.validationErrors.push(t)), n !== 0 && (i.size || 0) > n && (i.validationErrors = i.validationErrors || [], i.validationErrors.indexOf(r) < 0 && i.validationErrors.push(r)); }, v = (i) => i.map((n) => (n.substring(0, 1) === "." ? n : "." + n).toLowerCase()), x = (i, o) => { const n = v(o.allowedExtensions || []), s = o.maxFileSize || 0, e = o.minFileSize || 0; let a; for (a = 0; a < i.length; a++) E(i[a], n), l(i[a], e, s); }, c = { validateFiles: x }; export { c as default };