@farm-investimentos/front-mfe-components 7.3.1 → 7.3.2
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/front-mfe-components.common.js +86 -83
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +86 -83
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilePicker/FilePicker.scss +2 -2
- package/src/components/FilePicker/FilePicker.stories.js +1 -1
- package/src/components/FilePicker/FilePicker.vue +23 -14
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ section {
|
|
|
27
27
|
|
|
28
28
|
.selectfile-container {
|
|
29
29
|
text-align: center;
|
|
30
|
-
.
|
|
30
|
+
.farm-icon {
|
|
31
31
|
font-size: 2.25rem;
|
|
32
32
|
margin-bottom: 1rem;
|
|
33
33
|
}
|
|
@@ -46,7 +46,7 @@ section {
|
|
|
46
46
|
margin-bottom: 0;
|
|
47
47
|
font-size: 0.75rem;
|
|
48
48
|
}
|
|
49
|
-
.
|
|
49
|
+
.farm-btn {
|
|
50
50
|
margin-top: 1rem;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -7,28 +7,37 @@
|
|
|
7
7
|
:accept="acceptedFileTypes"
|
|
8
8
|
/>
|
|
9
9
|
<div v-if="!selectedFile" class="selectfile-container">
|
|
10
|
-
<
|
|
10
|
+
<farm-icon color="secondary">cloud-upload</farm-icon>
|
|
11
11
|
<p>Clique para selecionar ou arraste o arquivo aqui</p>
|
|
12
12
|
</div>
|
|
13
13
|
<div v-if="selectedFile || maxSizeReach" class="reset-container">
|
|
14
14
|
<div v-if="selectedFile">
|
|
15
|
-
<
|
|
15
|
+
<farm-icon>file</farm-icon> Arquivo selecionado: {{ selectedFile.name }} ({{
|
|
16
16
|
Math.floor(selectedFile.size / 1024)
|
|
17
17
|
}}kB)
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<p v-if="maxSizeReach" v-html="maxSizeReachMsg"></p>
|
|
21
21
|
|
|
22
|
-
<farm-btn
|
|
22
|
+
<farm-btn
|
|
23
|
+
outlined
|
|
24
|
+
color="secondary"
|
|
25
|
+
class="farm-btn--responsive"
|
|
26
|
+
title="Escolher outro"
|
|
27
|
+
@click="reset"
|
|
28
|
+
>
|
|
23
29
|
Escolher outro
|
|
24
30
|
</farm-btn>
|
|
25
31
|
</div>
|
|
26
32
|
</section>
|
|
27
33
|
</template>
|
|
28
|
-
<script>
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import Vue from 'vue';
|
|
29
36
|
import DefaultButton from '../Buttons/DefaultButton';
|
|
30
|
-
import
|
|
31
|
-
|
|
37
|
+
import Icon from '../Icon';
|
|
38
|
+
|
|
39
|
+
export default Vue.extend({
|
|
40
|
+
name: 'farm-filepicker',
|
|
32
41
|
props: {
|
|
33
42
|
/*
|
|
34
43
|
* Accepted file types
|
|
@@ -37,9 +46,9 @@ export default {
|
|
|
37
46
|
type: String,
|
|
38
47
|
default: '*',
|
|
39
48
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Max file size (in MB)
|
|
51
|
+
*/
|
|
43
52
|
maxFileSize: {
|
|
44
53
|
default: null,
|
|
45
54
|
},
|
|
@@ -54,7 +63,7 @@ export default {
|
|
|
54
63
|
computed: {
|
|
55
64
|
maxSizeReachMsg() {
|
|
56
65
|
return `Arquivo ultrapassou o tamanho máximo de ${this.maxFileSize}MB`;
|
|
57
|
-
}
|
|
66
|
+
},
|
|
58
67
|
},
|
|
59
68
|
mounted() {
|
|
60
69
|
this.dropArea = this.$refs.container;
|
|
@@ -64,10 +73,10 @@ export default {
|
|
|
64
73
|
reset() {
|
|
65
74
|
this.$refs.container.querySelector('input').value = '';
|
|
66
75
|
this.$emit('onReset');
|
|
67
|
-
|
|
76
|
+
this.maxSizeReach = false;
|
|
68
77
|
this.selectedFile = null;
|
|
69
78
|
},
|
|
70
|
-
fileChange(fileList) {
|
|
79
|
+
fileChange(fileList: Array<File>) {
|
|
71
80
|
this.maxSizeReach = false;
|
|
72
81
|
if (!fileList.length || fileList.length > 1) return;
|
|
73
82
|
|
|
@@ -97,9 +106,9 @@ export default {
|
|
|
97
106
|
},
|
|
98
107
|
components: {
|
|
99
108
|
'farm-btn': DefaultButton,
|
|
100
|
-
|
|
109
|
+
'farm-icon': Icon,
|
|
101
110
|
},
|
|
102
|
-
};
|
|
111
|
+
});
|
|
103
112
|
</script>
|
|
104
113
|
<style scoped lang="scss">
|
|
105
114
|
@import './FilePicker.scss';
|