@vaadin/upload
Advanced tools
Comparing version 23.1.0-alpha3 to 23.1.0-alpha4
{ | ||
"name": "@vaadin/upload", | ||
"version": "23.1.0-alpha3", | ||
"version": "23.1.0-alpha4", | ||
"publishConfig": { | ||
@@ -37,16 +37,16 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/button": "23.1.0-alpha3", | ||
"@vaadin/component-base": "23.1.0-alpha3", | ||
"@vaadin/progress-bar": "23.1.0-alpha3", | ||
"@vaadin/vaadin-lumo-styles": "23.1.0-alpha3", | ||
"@vaadin/vaadin-material-styles": "23.1.0-alpha3", | ||
"@vaadin/vaadin-themable-mixin": "23.1.0-alpha3" | ||
"@vaadin/button": "23.1.0-alpha4", | ||
"@vaadin/component-base": "23.1.0-alpha4", | ||
"@vaadin/progress-bar": "23.1.0-alpha4", | ||
"@vaadin/vaadin-lumo-styles": "23.1.0-alpha4", | ||
"@vaadin/vaadin-material-styles": "23.1.0-alpha4", | ||
"@vaadin/vaadin-themable-mixin": "23.1.0-alpha4" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/form-layout": "23.1.0-alpha3", | ||
"@vaadin/form-layout": "23.1.0-alpha4", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
"sinon": "^13.0.2" | ||
}, | ||
"gitHead": "8c9e64e8dfa158dd52a9bf6da351ff038c88ca85" | ||
"gitHead": "aacdb7fe09811894751f0378ff7fb66071892c71" | ||
} |
@@ -146,4 +146,4 @@ /** | ||
value: 0, | ||
reflectToAttribute: true | ||
} | ||
reflectToAttribute: true, | ||
}, | ||
}; | ||
@@ -158,3 +158,3 @@ } | ||
'_toggleHostAttribute(file.uploading, "uploading")', | ||
'_toggleHostAttribute(file.complete, "complete")' | ||
'_toggleHostAttribute(file.complete, "complete")', | ||
]; | ||
@@ -208,4 +208,4 @@ } | ||
bubbles: true, | ||
composed: true | ||
}) | ||
composed: true, | ||
}), | ||
); | ||
@@ -226,4 +226,4 @@ } | ||
bubbles: true, | ||
composed: true | ||
}) | ||
composed: true, | ||
}), | ||
); | ||
@@ -230,0 +230,0 @@ } |
@@ -404,3 +404,3 @@ /** | ||
listener: (this: Upload, ev: UploadEventMap[K]) => void, | ||
options?: boolean | AddEventListenerOptions | ||
options?: boolean | AddEventListenerOptions, | ||
): void; | ||
@@ -411,3 +411,3 @@ | ||
listener: (this: Upload, ev: UploadEventMap[K]) => void, | ||
options?: boolean | EventListenerOptions | ||
options?: boolean | EventListenerOptions, | ||
): void; | ||
@@ -414,0 +414,0 @@ } |
@@ -146,3 +146,3 @@ /** | ||
reflectToAttribute: true, | ||
value: isTouch | ||
value: isTouch, | ||
}, | ||
@@ -157,3 +157,3 @@ | ||
type: String, | ||
value: '' | ||
value: '', | ||
}, | ||
@@ -167,3 +167,3 @@ | ||
type: String, | ||
value: 'POST' | ||
value: 'POST', | ||
}, | ||
@@ -181,3 +181,3 @@ | ||
type: Object, | ||
value: {} | ||
value: {}, | ||
}, | ||
@@ -192,3 +192,3 @@ | ||
type: Number, | ||
value: 0 | ||
value: 0, | ||
}, | ||
@@ -200,3 +200,3 @@ | ||
value: false, | ||
observer: '_dragoverChanged' | ||
observer: '_dragoverChanged', | ||
}, | ||
@@ -232,3 +232,3 @@ | ||
return []; | ||
} | ||
}, | ||
}, | ||
@@ -244,3 +244,3 @@ | ||
type: Number, | ||
value: Infinity | ||
value: Infinity, | ||
}, | ||
@@ -259,3 +259,3 @@ | ||
reflectToAttribute: true, | ||
computed: '_maxFilesAdded(maxFiles, files.length)' | ||
computed: '_maxFilesAdded(maxFiles, files.length)', | ||
}, | ||
@@ -274,3 +274,3 @@ | ||
type: String, | ||
value: '' | ||
value: '', | ||
}, | ||
@@ -288,3 +288,3 @@ | ||
type: Number, | ||
value: Infinity | ||
value: Infinity, | ||
}, | ||
@@ -300,3 +300,3 @@ | ||
value: false, | ||
observer: '_dragoverValidChanged' | ||
observer: '_dragoverValidChanged', | ||
}, | ||
@@ -311,3 +311,3 @@ | ||
type: String, | ||
value: 'file' | ||
value: 'file', | ||
}, | ||
@@ -323,3 +323,3 @@ | ||
type: Boolean, | ||
value: false | ||
value: false, | ||
}, | ||
@@ -334,3 +334,3 @@ | ||
type: Boolean, | ||
value: false | ||
value: false, | ||
}, | ||
@@ -410,7 +410,7 @@ | ||
one: 'Drop file here', | ||
many: 'Drop files here' | ||
many: 'Drop files here', | ||
}, | ||
addFiles: { | ||
one: 'Upload File...', | ||
many: 'Upload Files...' | ||
many: 'Upload Files...', | ||
}, | ||
@@ -420,3 +420,3 @@ error: { | ||
fileIsTooBig: 'File is Too Big.', | ||
incorrectFileType: 'Incorrect File Type.' | ||
incorrectFileType: 'Incorrect File Type.', | ||
}, | ||
@@ -428,7 +428,7 @@ uploading: { | ||
processing: 'Processing File...', | ||
held: 'Queued' | ||
held: 'Queued', | ||
}, | ||
remainingTime: { | ||
prefix: 'remaining time: ', | ||
unknown: 'unknown remaining time' | ||
unknown: 'unknown remaining time', | ||
}, | ||
@@ -438,4 +438,4 @@ error: { | ||
unexpectedServerError: 'Upload failed due to server error', | ||
forbidden: 'Upload forbidden' | ||
} | ||
forbidden: 'Upload forbidden', | ||
}, | ||
}, | ||
@@ -445,10 +445,10 @@ file: { | ||
start: 'Start', | ||
remove: 'Remove' | ||
remove: 'Remove', | ||
}, | ||
units: { | ||
size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] | ||
} | ||
size: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | ||
}, | ||
}; | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
@@ -484,3 +484,3 @@ } | ||
const size = parseFloat((bytes / base ** unit).toFixed(dec)); | ||
return size + ' ' + this.i18n.units.size[unit]; | ||
return `${size} ${this.i18n.units.size[unit]}`; | ||
} | ||
@@ -522,12 +522,8 @@ | ||
_formatFileProgress(file) { | ||
return ( | ||
file.totalStr + | ||
': ' + | ||
file.progress + | ||
'% (' + | ||
(file.loaded > 0 | ||
const remainingTime = | ||
file.loaded > 0 | ||
? this.i18n.uploading.remainingTime.prefix + file.remainingStr | ||
: this.i18n.uploading.remainingTime.unknown) + | ||
')' | ||
); | ||
: this.i18n.uploading.remainingTime.unknown; | ||
return `${file.totalStr}: ${file.progress}% (${remainingTime})`; | ||
} | ||
@@ -574,3 +570,3 @@ | ||
_configureXhr(xhr) { | ||
if (typeof this.headers == 'string') { | ||
if (typeof this.headers === 'string') { | ||
try { | ||
@@ -661,3 +657,3 @@ this.headers = JSON.parse(this.headers); | ||
xhr.onreadystatechange = () => { | ||
if (xhr.readyState == 4) { | ||
if (xhr.readyState === 4) { | ||
clearTimeout(stalledId); | ||
@@ -675,4 +671,4 @@ file.indeterminate = file.uploading = false; | ||
detail: { file, xhr }, | ||
cancelable: true | ||
}) | ||
cancelable: true, | ||
}), | ||
); | ||
@@ -694,4 +690,4 @@ | ||
new CustomEvent(`upload-${file.error ? 'error' : 'success'}`, { | ||
detail: { file, xhr } | ||
}) | ||
detail: { file, xhr }, | ||
}), | ||
); | ||
@@ -710,4 +706,4 @@ this._notifyFileChanges(file); | ||
detail: { file, xhr }, | ||
cancelable: true | ||
}) | ||
cancelable: true, | ||
}), | ||
); | ||
@@ -730,4 +726,4 @@ if (!evt) { | ||
new CustomEvent('upload-start', { | ||
detail: { file, xhr } | ||
}) | ||
detail: { file, xhr }, | ||
}), | ||
); | ||
@@ -742,4 +738,4 @@ this._notifyFileChanges(file); | ||
detail: { file, xhr, formData }, | ||
cancelable: true | ||
}) | ||
cancelable: true, | ||
}), | ||
); | ||
@@ -756,4 +752,4 @@ if (uploadEvt) { | ||
detail: { file, xhr: file.xhr }, | ||
cancelable: true | ||
}) | ||
cancelable: true, | ||
}), | ||
); | ||
@@ -770,4 +766,4 @@ if (evt) { | ||
detail: { file, xhr: file.xhr }, | ||
cancelable: true | ||
}) | ||
cancelable: true, | ||
}), | ||
); | ||
@@ -785,3 +781,3 @@ if (evt) { | ||
_notifyFileChanges(file) { | ||
var p = 'files.' + this.files.indexOf(file) + '.'; | ||
var p = `files.${this.files.indexOf(file)}.`; | ||
for (const i in file) { | ||
@@ -810,4 +806,4 @@ // eslint-disable-next-line no-prototype-builtins | ||
new CustomEvent('file-reject', { | ||
detail: { file, error: this.i18n.error.tooManyFiles } | ||
}) | ||
detail: { file, error: this.i18n.error.tooManyFiles }, | ||
}), | ||
); | ||
@@ -819,4 +815,4 @@ return; | ||
new CustomEvent('file-reject', { | ||
detail: { file, error: this.i18n.error.fileIsTooBig } | ||
}) | ||
detail: { file, error: this.i18n.error.fileIsTooBig }, | ||
}), | ||
); | ||
@@ -826,8 +822,8 @@ return; | ||
const fileExt = file.name.match(/\.[^.]*$|$/)[0]; | ||
const re = new RegExp('^(' + this.accept.replace(/[, ]+/g, '|').replace(/\/\*/g, '/.*') + ')$', 'i'); | ||
const re = new RegExp(`^(${this.accept.replace(/[, ]+/g, '|').replace(/\/\*/g, '/.*')})$`, 'i'); | ||
if (this.accept && !(re.test(file.type) || re.test(fileExt))) { | ||
this.dispatchEvent( | ||
new CustomEvent('file-reject', { | ||
detail: { file, error: this.i18n.error.incorrectFileType } | ||
}) | ||
detail: { file, error: this.i18n.error.incorrectFileType }, | ||
}), | ||
); | ||
@@ -922,3 +918,7 @@ return; | ||
_dragoverChanged(dragover) { | ||
dragover ? this.setAttribute('dragover', dragover) : this.removeAttribute('dragover'); | ||
if (dragover) { | ||
this.setAttribute('dragover', dragover); | ||
} else { | ||
this.removeAttribute('dragover'); | ||
} | ||
} | ||
@@ -928,3 +928,7 @@ | ||
_dragoverValidChanged(dragoverValid) { | ||
dragoverValid ? this.setAttribute('dragover-valid', dragoverValid) : this.removeAttribute('dragover-valid'); | ||
if (dragoverValid) { | ||
this.setAttribute('dragover-valid', dragoverValid); | ||
} else { | ||
this.removeAttribute('dragover-valid'); | ||
} | ||
} | ||
@@ -934,3 +938,3 @@ | ||
_i18nPlural(value, plural) { | ||
return value == 1 ? plural.one : plural.many; | ||
return value === 1 ? plural.one : plural.many; | ||
} | ||
@@ -940,3 +944,3 @@ | ||
_isMultiple(maxFiles) { | ||
return maxFiles != 1; | ||
return maxFiles !== 1; | ||
} | ||
@@ -943,0 +947,0 @@ |
@@ -70,3 +70,3 @@ import '@vaadin/vaadin-lumo-styles/font-icons.js'; | ||
`, | ||
{ moduleId: 'lumo-upload' } | ||
{ moduleId: 'lumo-upload' }, | ||
); | ||
@@ -73,0 +73,0 @@ |
@@ -96,3 +96,3 @@ import '@vaadin/vaadin-material-styles/color.js'; | ||
`, | ||
{ moduleId: 'material-upload' } | ||
{ moduleId: 'material-upload' }, | ||
); | ||
@@ -251,3 +251,3 @@ | ||
`, | ||
{ moduleId: 'material-upload-file' } | ||
{ moduleId: 'material-upload-file' }, | ||
); |
79471
1950
+ Added@vaadin/button@23.1.0-alpha4(transitive)
+ Added@vaadin/component-base@23.1.0-alpha4(transitive)
+ Added@vaadin/icon@23.1.0-alpha4(transitive)
+ Added@vaadin/progress-bar@23.1.0-alpha4(transitive)
+ Added@vaadin/vaadin-lumo-styles@23.1.0-alpha4(transitive)
+ Added@vaadin/vaadin-material-styles@23.1.0-alpha4(transitive)
+ Added@vaadin/vaadin-themable-mixin@23.1.0-alpha4(transitive)
- Removed@vaadin/button@23.1.0-alpha3(transitive)
- Removed@vaadin/component-base@23.1.0-alpha3(transitive)
- Removed@vaadin/icon@23.1.0-alpha3(transitive)
- Removed@vaadin/progress-bar@23.1.0-alpha3(transitive)
- Removed@vaadin/vaadin-lumo-styles@23.1.0-alpha3(transitive)
- Removed@vaadin/vaadin-material-styles@23.1.0-alpha3(transitive)
- Removed@vaadin/vaadin-themable-mixin@23.1.0-alpha3(transitive)
Updated@vaadin/button@23.1.0-alpha4