inertia-bootstrap-forms 1.0.79 → 1.0.80

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/index.d.ts CHANGED
@@ -166,9 +166,12 @@ export const UppyInput: DefineComponent<{
166
166
  type: Boolean,
167
167
  default: true,
168
168
  },
169
+ errorHandler: {type: Function, default: null},
170
+ config: {type: Object, default: () => ({})},
169
171
  modelValue: String,
172
+ XHRConfig: {type: Object, default: {}},
173
+ useXHR: {type: Boolean, default: true},
170
174
  url: { type: String, default: "/upload" },
171
- options: { type: Object, default: () => ({}) },
172
175
  }, {},
173
176
  any,
174
177
  {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inertia-bootstrap-forms",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "Create bootstrap forms with inertia and twitter bootstrap",
5
5
  "main": "dist/inertia-bootstrap-forms.cjs.js",
6
6
  "module": "dist/inertia-bootstrap-forms.es.js",
package/src/UppyInput.vue CHANGED
@@ -198,6 +198,17 @@ function formatBytesToKB(size) {
198
198
  return Math.round(size / 1024);
199
199
  }
200
200
 
201
+ const niceBytesUnits = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
202
+ function niceBytes(x){
203
+ let l = 0, n = parseInt(x, 10) || 0;
204
+
205
+ while(n >= 1024 && ++l){
206
+ n = n/1024;
207
+ }
208
+
209
+ return(n.toFixed(n < 10 && l > 0 ? 1 : 0) + niceBytesUnits[l]);
210
+ }
211
+
201
212
  function buildRestrictionsCaption(restrictions) {
202
213
  if (!restrictions) return '';
203
214
 
@@ -231,16 +242,16 @@ function buildRestrictionsCaption(restrictions) {
231
242
 
232
243
  // حجم هر فایل
233
244
  if (maxFileSize) {
234
- parts.push(`با حداکثر حجم ${formatBytesToKB(maxFileSize)} کیلوبایت برای هر فایل`);
245
+ parts.push(`با حداکثر حجم ${niceBytes(maxFileSize)} برای هر فایل`);
235
246
  }
236
247
 
237
248
  if (minFileSize) {
238
- parts.push(`با حداقل حجم ${formatBytesToKB(minFileSize)} کیلوبایت برای هر فایل`);
249
+ parts.push(`با حداقل حجم ${niceBytes(minFileSize)} برای هر فایل`);
239
250
  }
240
251
 
241
252
  // مجموع حجم
242
253
  if (maxTotalFileSize) {
243
- parts.push(`و مجموع حجم کل حداکثر ${formatBytesToKB(maxTotalFileSize)} کیلوبایت`);
254
+ parts.push(`و مجموع حجم کل حداکثر ${niceBytes(maxTotalFileSize)}`);
244
255
  }
245
256
 
246
257
  if (!parts.length) return '';