2016-05-27 14:27:46 +02:00
|
|
|
import XFileInput from 'emberx-file-input/components/x-file-input';
|
|
|
|
|
2017-11-22 18:04:48 +01:00
|
|
|
// TODO: remove this override and use {{x-file-input}} directly once we've
|
|
|
|
// upgraded to emberx-file-input@1.2.0
|
2016-05-27 14:27:46 +02:00
|
|
|
|
|
|
|
export default XFileInput.extend({
|
|
|
|
change(e) {
|
2019-03-06 14:53:54 +01:00
|
|
|
let action = this.action;
|
2017-12-12 12:53:35 +01:00
|
|
|
let files = this.files(e);
|
|
|
|
|
|
|
|
if (files.length && action) {
|
|
|
|
action(files, this.resetInput.bind(this));
|
2017-11-25 00:18:35 +01:00
|
|
|
}
|
2017-11-22 18:04:48 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets files from event object.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @private
|
|
|
|
* @param {$.Event || Event}
|
|
|
|
*/
|
|
|
|
files(e) {
|
|
|
|
return (e.originalEvent || e).testingFiles || e.target.files;
|
2016-05-27 14:27:46 +02:00
|
|
|
}
|
|
|
|
});
|