@overmap-ai/forms 1.0.13 → 1.0.14-file-size-fixes.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forms.js +7 -7
- package/dist/forms.js.map +1 -1
- package/dist/forms.umd.cjs +7 -7
- package/dist/forms.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/forms.umd.cjs
CHANGED
|
@@ -1192,8 +1192,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1192
1192
|
if (helpText)
|
|
1193
1193
|
return helpText;
|
|
1194
1194
|
if (field.maxFileSize) {
|
|
1195
|
-
|
|
1196
|
-
return `Maximum file size: ${size}`;
|
|
1195
|
+
return `Maximum file size: ${field.maxFileSize}MB`;
|
|
1197
1196
|
}
|
|
1198
1197
|
return null;
|
|
1199
1198
|
}, [field.maxFileSize, helpText]);
|
|
@@ -1296,7 +1295,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1296
1295
|
url && /* @__PURE__ */ jsxRuntime.jsx("img", { className: styles$2.previewImage, src: url, alt: name })
|
|
1297
1296
|
] }) });
|
|
1298
1297
|
});
|
|
1299
|
-
const largestSupportedSize = 50
|
|
1298
|
+
const largestSupportedSize = 50;
|
|
1300
1299
|
const _UploadField = class _UploadField extends BaseField {
|
|
1301
1300
|
constructor(options) {
|
|
1302
1301
|
const { extensions, maximum_files, maximum_size, ...base } = options;
|
|
@@ -1329,7 +1328,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1329
1328
|
new NumberField({
|
|
1330
1329
|
// TODO: Default value
|
|
1331
1330
|
label: "What is the maximum size of each file?",
|
|
1332
|
-
description: "Maximum file size in
|
|
1331
|
+
description: "Maximum file size in megabytes (between 1MB-50MB).",
|
|
1333
1332
|
required: false,
|
|
1334
1333
|
identifier: "maximum_size",
|
|
1335
1334
|
minimum: 1,
|
|
@@ -1368,11 +1367,12 @@ var __publicField = (obj, key, value) => {
|
|
|
1368
1367
|
}
|
|
1369
1368
|
getFieldValidators() {
|
|
1370
1369
|
const validators = super.getFieldValidators();
|
|
1371
|
-
const
|
|
1370
|
+
const maxFileSizeInMB = this.maxFileSize ?? largestSupportedSize;
|
|
1371
|
+
const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
|
|
1372
1372
|
const maxFiles = this.maxFiles ?? 1;
|
|
1373
1373
|
validators.push((value) => {
|
|
1374
|
-
if (value && value.some((file) => file.size >
|
|
1375
|
-
return `Files must be at most ${
|
|
1374
|
+
if (value && value.some((file) => file.size > maxFileSizeInB)) {
|
|
1375
|
+
return `Files must be at most ${maxFileSizeInMB}MB.`;
|
|
1376
1376
|
}
|
|
1377
1377
|
});
|
|
1378
1378
|
validators.push((value) => {
|