@enso-ui/uploader 2.0.7 → 2.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enso-ui/uploader",
3
- "version": "2.0.7",
3
+ "version": "2.0.11",
4
4
  "description": "File Uploader",
5
5
  "main": "bulma/index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "homepage": "https://github.com/enso-ui/uploader#readme",
23
23
  "dependencies": {
24
24
  "@fortawesome/fontawesome-svg-core": "^1.2.2",
25
- "@fortawesome/free-solid-svg-icons": "^5.2.0",
25
+ "@fortawesome/free-solid-svg-icons": "^5.11.2",
26
26
  "@fortawesome/vue-fontawesome": "3.0.0-5",
27
27
  "bulma": "^0.9.0",
28
28
  "vue": "^3.0"
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <uploader v-bind="$attrs"
3
- :i18n="i18n"
2
+ <uploader
3
+ :http="http"
4
+ :i18n="i18n"
4
5
  ref="uploader"/>
5
6
  </template>
6
7
 
@@ -12,7 +13,7 @@ export default {
12
13
 
13
14
  components: { Uploader },
14
15
 
15
- inject: ['i18n'],
16
+ inject: ['http', 'i18n'],
16
17
 
17
18
  methods: {
18
19
  browseFiles() {
@@ -6,6 +6,8 @@ export default {
6
6
 
7
7
  inject: ['errorHandler', 'toastr'],
8
8
 
9
+ inheritAttrs: false,
10
+
9
11
  props: {
10
12
  compact: {
11
13
  default: false,
@@ -19,8 +21,12 @@ export default {
19
21
  default: 20 * 1024 * 1024,
20
22
  type: Number,
21
23
  },
24
+ http: {
25
+ required: true,
26
+ type: Function,
27
+ },
22
28
  i18n: {
23
- default: (v) => v,
29
+ default: v => v,
24
30
  type: Function,
25
31
  },
26
32
  label: {
@@ -96,17 +102,17 @@ export default {
96
102
  return;
97
103
  }
98
104
 
99
- axios.post(this.url, this.formData).then((response) => {
105
+ this.http.post(this.url, this.formData).then(response => {
100
106
  this.reset();
101
107
  this.$emit('upload-successful', response.data);
102
- }).catch((error) => {
108
+ }).catch(error => {
103
109
  this.reset();
104
110
  this.$emit('upload-error');
105
111
  const { data, status } = error.response;
106
112
 
107
113
  if (status === 422) {
108
114
  Object.keys(data.errors)
109
- .forEach((key) => this.toastr.error(data.errors[key][0]));
115
+ .forEach(key => this.toastr.error(data.errors[key][0]));
110
116
  return;
111
117
  }
112
118
 
@@ -183,7 +189,7 @@ export default {
183
189
  },
184
190
  inputEvents: {
185
191
  change: this.onChange,
186
- input: (event) => this.$emit('input', event.target.value),
192
+ input: event => this.$emit('input', event.target.value),
187
193
  },
188
194
  label: this.displayLabel,
189
195
  multiple: this.multiple,