@farm-investimentos/front-mfe-components 3.4.3 → 3.4.4
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/README.md +2 -0
- package/dist/front-mfe-components.common.js +290 -241
- 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 +290 -241
- 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 +10 -14
- package/src/components/Buttons/ConfirmButton/ConfirmButton.stories.js +10 -0
- package/src/components/Buttons/DangerButton/DangerButton.stories.js +10 -0
- package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +10 -0
- package/src/components/DataTablePaginator/DataTablePaginator.stories.js +17 -2
- package/src/components/DataTablePaginator/DataTablePaginator.vue +5 -3
- package/src/components/DatePicker/DatePicker.stories.js +13 -3
- package/src/components/DatePicker/DatePicker.vue +4 -2
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +13 -0
- package/src/components/DefaultTextField/DefaultTextField.vue +12 -0
- package/src/components/FilePicker/FilePicker.scss +5 -4
- package/src/components/FilePicker/FilePicker.stories.js +10 -4
- package/src/components/FilePicker/FilePicker.vue +95 -67
- package/src/components/FilePicker/__tests__/FilePicker.spec.js +17 -0
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +21 -1
- package/src/examples/Table.stories.js +27 -16
- package/src/examples/inputs/Password.stories.js +42 -0
- package/src/scss/Sticky-table.scss +69 -0
- package/src/scss/Table.scss +2 -0
- package/src/scss/main.scss +4 -0
- package/src/stories/Introduction.stories.mdx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm-investimentos/front-mfe-components",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"author": "farm investimentos",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/front-mfe-components.common.js",
|
|
@@ -21,30 +21,26 @@
|
|
|
21
21
|
"src/*"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"core-js": "^3.6.5",
|
|
28
|
-
"sass": "~1.32.0",
|
|
29
|
-
"sass-loader": "^10.2.0",
|
|
24
|
+
"core-js": "3.21.1",
|
|
25
|
+
"sass": "1.32.13",
|
|
26
|
+
"sass-loader": "^10.1.1",
|
|
30
27
|
"vue": "^2.6.11",
|
|
31
28
|
"vuetify": "^2.5.7"
|
|
32
29
|
},
|
|
33
30
|
"devDependencies": {
|
|
34
|
-
"@
|
|
31
|
+
"@socheatsok78/storybook-addon-vuetify": "^0.1.8",
|
|
35
32
|
"@storybook/addon-actions": "^6.3.6",
|
|
36
33
|
"@storybook/addon-essentials": "^6.3.6",
|
|
37
34
|
"@storybook/addon-links": "^6.3.6",
|
|
38
35
|
"@storybook/vue": "^6.3.6",
|
|
39
|
-
"@vue/cli-plugin-babel": "
|
|
40
|
-
"@vue/cli-plugin-eslint": "~4.5.
|
|
41
|
-
"@vue/cli-plugin-unit-jest": "
|
|
42
|
-
"@vue/cli-service": "~4.5.
|
|
36
|
+
"@vue/cli-plugin-babel": "4.5.15",
|
|
37
|
+
"@vue/cli-plugin-eslint": "~4.5.14",
|
|
38
|
+
"@vue/cli-plugin-unit-jest": "~4.5.14",
|
|
39
|
+
"@vue/cli-service": "~4.5.14",
|
|
40
|
+
"@vue/test-utils": "^1.3.0",
|
|
43
41
|
"babel-eslint": "^10.1.0",
|
|
44
|
-
"babel-loader": "^8.2.2",
|
|
45
42
|
"eslint": "^6.7.2",
|
|
46
43
|
"eslint-plugin-vue": "^6.2.2",
|
|
47
|
-
"jest": "^25.5.4",
|
|
48
44
|
"storybook-addon-designs": "^6.2.1",
|
|
49
45
|
"vue-template-compiler": "^2.6.11",
|
|
50
46
|
"webpack-cli": "^4.9.0"
|
|
@@ -3,6 +3,16 @@ import ConfirmButton from './ConfirmButton.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'API/Buttons/Confirm',
|
|
5
5
|
component: ConfirmButton,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Confirm button<br />
|
|
10
|
+
selector: <em>farm-btn-confirm</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
6
16
|
};
|
|
7
17
|
|
|
8
18
|
export const Primary = () => ({
|
|
@@ -3,6 +3,16 @@ import DangerButton from './DangerButton.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'API/Buttons/DangerButton',
|
|
5
5
|
component: DangerButton,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Danger button<br />
|
|
10
|
+
selector: <em>farm-btn-fanger</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
6
16
|
};
|
|
7
17
|
|
|
8
18
|
export const Primary = () => ({
|
|
@@ -3,6 +3,16 @@ import DefaultButton from './DefaultButton.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'API/Buttons/Default',
|
|
5
5
|
component: DefaultButton,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Default button (inherit from Vuetify)<br />
|
|
10
|
+
selector: <em>farm-btn</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
6
16
|
};
|
|
7
17
|
|
|
8
18
|
export const Primary = () => ({
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
1
2
|
import DataTablePaginator from './DataTablePaginator.vue';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
title: 'API/Table/DataTablePaginator',
|
|
5
6
|
component: DataTablePaginator,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `Paginator with items per page select<br />
|
|
12
|
+
selector: <em>farm-datatable-paginator</em>
|
|
13
|
+
`,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
design: {
|
|
17
|
+
type: 'figma',
|
|
18
|
+
url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1503%3A921',
|
|
19
|
+
},
|
|
20
|
+
viewMode: 'docs',
|
|
21
|
+
},
|
|
6
22
|
};
|
|
7
23
|
|
|
8
24
|
export const Primary = () => ({
|
|
@@ -29,8 +45,7 @@ export const CustomPerPage = () => ({
|
|
|
29
45
|
const parameters = {
|
|
30
46
|
design: {
|
|
31
47
|
type: 'figma',
|
|
32
|
-
url:
|
|
33
|
-
'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1503%3A921',
|
|
48
|
+
url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1503%3A921',
|
|
34
49
|
},
|
|
35
50
|
};
|
|
36
51
|
|
|
@@ -22,14 +22,16 @@
|
|
|
22
22
|
</section>
|
|
23
23
|
</template>
|
|
24
24
|
<script>
|
|
25
|
+
import Vue from 'vue';
|
|
25
26
|
import { VSelect } from 'vuetify/lib/components/VSelect';
|
|
26
27
|
import { VPagination } from 'vuetify/lib/components/VPagination';
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* Componente de paginação usado em tabelas e listas
|
|
29
31
|
* com opção de itens por página
|
|
30
32
|
*/
|
|
31
|
-
export default {
|
|
32
|
-
name: '
|
|
33
|
+
export default Vue.extend({
|
|
34
|
+
name: 'farm-datatable-paginator',
|
|
33
35
|
props: {
|
|
34
36
|
/**
|
|
35
37
|
* Lista de opções para o controle de registros por página
|
|
@@ -100,7 +102,7 @@ export default {
|
|
|
100
102
|
VSelect,
|
|
101
103
|
VPagination,
|
|
102
104
|
},
|
|
103
|
-
};
|
|
105
|
+
});
|
|
104
106
|
</script>
|
|
105
107
|
|
|
106
108
|
<style lang="scss">
|
|
@@ -3,24 +3,34 @@ import DatePicker from './DatePicker';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'API/Form/DatePicker',
|
|
5
5
|
component: DatePicker,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Input Date Picker<br />
|
|
10
|
+
selector: <em>farm-input-datepicker</em>
|
|
11
|
+
`,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
},
|
|
6
16
|
};
|
|
7
17
|
|
|
8
18
|
export const Primary = () => ({
|
|
9
19
|
components: { DatePicker },
|
|
10
20
|
template: `<div style='max-width: 320px'>
|
|
11
|
-
<DatePicker inputId="input-custom-id" />
|
|
21
|
+
<DatePicker inputId="input-custom-id-0" />
|
|
12
22
|
</div>`,
|
|
13
23
|
});
|
|
14
24
|
|
|
15
25
|
export const InitValue = () => ({
|
|
16
26
|
components: { DatePicker },
|
|
17
|
-
template: `<div style='max-width: 320px'><DatePicker inputId="input-custom-id" value="2021-08-01" /></div>`,
|
|
27
|
+
template: `<div style='max-width: 320px'><DatePicker inputId="input-custom-id-1" value="2021-08-01" /></div>`,
|
|
18
28
|
});
|
|
19
29
|
|
|
20
30
|
export const MinMaxDates = () => ({
|
|
21
31
|
components: { DatePicker },
|
|
22
32
|
template: `<div style='max-width: 320px'>
|
|
23
|
-
<DatePicker inputId="input-custom-id" max="2021-12-02" min="2021-07-01" />
|
|
33
|
+
<DatePicker inputId="input-custom-id-2" max="2021-12-02" min="2021-07-01" />
|
|
24
34
|
max="2021-12-02" min="2021-07-01"
|
|
25
35
|
</div>`,
|
|
26
36
|
});
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
</v-menu>
|
|
50
50
|
</template>
|
|
51
51
|
<script>
|
|
52
|
+
import Vue from 'vue';
|
|
52
53
|
import { VTextField } from 'vuetify/lib/components/VTextField';
|
|
53
54
|
import { VMenu } from 'vuetify/lib/components/VMenu';
|
|
54
55
|
import { VBtn } from 'vuetify/lib/components/VBtn';
|
|
@@ -57,7 +58,8 @@ import { defaultFormat as dateDefaultFormatter } from '../../helpers/date';
|
|
|
57
58
|
/**
|
|
58
59
|
* Componente de input com datepicker para data
|
|
59
60
|
*/
|
|
60
|
-
export default {
|
|
61
|
+
export default Vue.extend({
|
|
62
|
+
name: 'farm-input-datepicker',
|
|
61
63
|
components: {
|
|
62
64
|
VTextField,
|
|
63
65
|
VMenu,
|
|
@@ -136,5 +138,5 @@ export default {
|
|
|
136
138
|
},
|
|
137
139
|
},
|
|
138
140
|
},
|
|
139
|
-
};
|
|
141
|
+
});
|
|
140
142
|
</script>
|
|
@@ -3,6 +3,7 @@ import DatePicker from '../DatePicker';
|
|
|
3
3
|
|
|
4
4
|
describe('DatePicker component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
+
let component;
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
wrapper = shallowMount(DatePicker, {
|
|
@@ -10,6 +11,7 @@ describe('DatePicker component', () => {
|
|
|
10
11
|
inputId: 'someid',
|
|
11
12
|
},
|
|
12
13
|
});
|
|
14
|
+
component = wrapper.vm;
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
test('Created hook', () => {
|
|
@@ -21,4 +23,15 @@ describe('DatePicker component', () => {
|
|
|
21
23
|
expect(wrapper.element).toMatchSnapshot();
|
|
22
24
|
});
|
|
23
25
|
});
|
|
26
|
+
|
|
27
|
+
describe('computed properties', () => {
|
|
28
|
+
it('get inputVal', () => {
|
|
29
|
+
expect(component.inputVal).toBeFalsy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('get inputVal', () => {
|
|
33
|
+
component.inputVal = 'teste';
|
|
34
|
+
expect(wrapper.emitted().input).toBeDefined();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
24
37
|
});
|
|
@@ -29,9 +29,15 @@ export default {
|
|
|
29
29
|
value: {
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Array of rules
|
|
34
|
+
*/
|
|
32
35
|
rules: {
|
|
33
36
|
type: Array,
|
|
34
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Input is disabled or not
|
|
40
|
+
*/
|
|
35
41
|
disabled: {
|
|
36
42
|
type: Boolean,
|
|
37
43
|
default: false,
|
|
@@ -41,10 +47,16 @@ export default {
|
|
|
41
47
|
required: false,
|
|
42
48
|
default: 'form',
|
|
43
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* Input is required or not
|
|
52
|
+
*/
|
|
44
53
|
required: {
|
|
45
54
|
type: Boolean,
|
|
46
55
|
default: false,
|
|
47
56
|
},
|
|
57
|
+
/**
|
|
58
|
+
* Mask (v-mask)
|
|
59
|
+
*/
|
|
48
60
|
mask: {
|
|
49
61
|
type: String,
|
|
50
62
|
default: null,
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
section {
|
|
2
|
-
//outline: 1px dashed grey;
|
|
3
|
-
//outline-offset: -0.5rem;
|
|
4
2
|
border: 2px dashed var(--v-gray-lighten1);
|
|
5
3
|
border-radius: 2rem;
|
|
6
4
|
background-color: var(--v-gray-lighten4);
|
|
7
|
-
//color: var(--v-primary-base);
|
|
8
5
|
padding: 1rem;
|
|
9
6
|
position: relative;
|
|
10
7
|
cursor: pointer;
|
|
11
|
-
height:
|
|
8
|
+
height: 12rem;
|
|
12
9
|
display: flex;
|
|
13
10
|
flex-direction: column;
|
|
14
11
|
align-items: center;
|
|
@@ -45,6 +42,10 @@ section {
|
|
|
45
42
|
flex-direction: column;
|
|
46
43
|
align-items: center;
|
|
47
44
|
justify-content: center;
|
|
45
|
+
> p {
|
|
46
|
+
margin-bottom: 0;
|
|
47
|
+
font-size: 0.75rem;
|
|
48
|
+
}
|
|
48
49
|
.v-btn {
|
|
49
50
|
margin-top: 1rem;
|
|
50
51
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import FilePicker from './FilePicker.vue';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
title: 'API/FilePicker',
|
|
5
|
+
component: FilePicker,
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export const Primary = () => ({
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
components: { FilePicker },
|
|
10
|
+
template: '<FilePicker />',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const MaxFileSize = () => ({
|
|
14
|
+
components: { FilePicker },
|
|
15
|
+
template: '<FilePicker maxFileSize="5" />',
|
|
11
16
|
});
|
|
12
17
|
|
|
13
18
|
Primary.storyName = 'Básico';
|
|
19
|
+
MaxFileSize.storyName = 'Max File Size';
|
|
@@ -1,78 +1,106 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
<section ref="container" id="droparea-container">
|
|
3
|
+
<input
|
|
4
|
+
type="file"
|
|
5
|
+
name="file"
|
|
6
|
+
@change="fileChange($event.target.files)"
|
|
7
|
+
:accept="acceptedFileTypes"
|
|
8
|
+
/>
|
|
9
|
+
<div v-if="!selectedFile" class="selectfile-container">
|
|
10
|
+
<v-icon color="secondary">mdi-cloud-upload</v-icon>
|
|
11
|
+
<p>Clique para selecionar ou arraste o arquivo aqui</p>
|
|
12
|
+
</div>
|
|
13
|
+
<div v-if="selectedFile || maxSizeReach" class="reset-container">
|
|
14
|
+
<div v-if="selectedFile">
|
|
15
|
+
<v-icon>mdi-file</v-icon> Arquivo selecionado: {{ selectedFile.name }} ({{
|
|
16
|
+
Math.floor(selectedFile.size / 1024)
|
|
17
|
+
}}kB)
|
|
18
|
+
</div>
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
<p v-if="maxSizeReach" v-html="maxSizeReachMsg"></p>
|
|
21
|
+
|
|
22
|
+
<v-btn depressed outlined color="secondary" class="v-btn-responsive" @click="reset"
|
|
23
|
+
>Escolher outro</v-btn
|
|
24
|
+
>
|
|
25
|
+
</div>
|
|
26
|
+
</section>
|
|
25
27
|
</template>
|
|
26
28
|
<script>
|
|
27
29
|
import { VBtn } from 'vuetify/lib/components/VBtn';
|
|
28
30
|
import { VIcon } from 'vuetify/lib/components/VIcon';
|
|
29
31
|
export default {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
props: {
|
|
33
|
+
/*
|
|
34
|
+
* Accepted file types
|
|
35
|
+
*/
|
|
36
|
+
acceptedFileTypes: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: '*',
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Max file size (in MB)
|
|
42
|
+
*/
|
|
43
|
+
maxFileSize: {
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
selectedFile: null,
|
|
50
|
+
dropArea: null,
|
|
51
|
+
maxSizeReach: false,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
computed: {
|
|
55
|
+
maxSizeReachMsg() {
|
|
56
|
+
return `Arquivo ultrapassou o tamanho máximo de ${this.maxFileSize}MB`;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
mounted() {
|
|
60
|
+
this.dropArea = this.$refs.container;
|
|
61
|
+
this.addListeners();
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
reset() {
|
|
65
|
+
this.$refs.container.querySelector('input').value = '';
|
|
66
|
+
this.$emit('onReset');
|
|
67
|
+
this.maxSizeReach = false;
|
|
68
|
+
this.selectedFile = null;
|
|
69
|
+
},
|
|
70
|
+
fileChange(fileList) {
|
|
71
|
+
this.maxSizeReach = false;
|
|
72
|
+
if (!fileList.length || fileList.length > 1) return;
|
|
73
|
+
|
|
74
|
+
if (this.maxFileSize) {
|
|
75
|
+
const sizeInMB = fileList[0].size / (1024 * 1024);
|
|
76
|
+
|
|
77
|
+
if (sizeInMB > this.maxFileSize) {
|
|
78
|
+
this.maxSizeReach = true;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.selectedFile = fileList[0];
|
|
83
|
+
this.$emit('onFileChange', this.selectedFile);
|
|
84
|
+
},
|
|
85
|
+
handlerFunctionHighlight() {
|
|
86
|
+
this.dropArea.classList.add('highlight');
|
|
87
|
+
},
|
|
88
|
+
handlerFunctionUnhighlight() {
|
|
89
|
+
this.dropArea.classList.remove('highlight');
|
|
90
|
+
},
|
|
91
|
+
addListeners() {
|
|
92
|
+
this.dropArea.addEventListener('dragenter', this.handlerFunctionHighlight, false);
|
|
93
|
+
this.dropArea.addEventListener('dragleave', this.handlerFunctionUnhighlight, false);
|
|
94
|
+
this.dropArea.addEventListener('dragover', this.handlerFunctionHighlight, false);
|
|
95
|
+
this.dropArea.addEventListener('drop', this.handlerFunctionUnhighlight, false);
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
components: {
|
|
99
|
+
VBtn,
|
|
100
|
+
VIcon,
|
|
101
|
+
},
|
|
74
102
|
};
|
|
75
103
|
</script>
|
|
76
104
|
<style scoped lang="scss">
|
|
77
105
|
@import './FilePicker.scss';
|
|
78
|
-
</style>
|
|
106
|
+
</style>
|
|
@@ -23,6 +23,14 @@ describe('FilePicker component', () => {
|
|
|
23
23
|
wrapper.vm.fileChange([]);
|
|
24
24
|
expect(wrapper.emitted().onFileChange).toBeUndefined();
|
|
25
25
|
});
|
|
26
|
+
|
|
27
|
+
it('Should handle max file size', async () => {
|
|
28
|
+
await wrapper.setProps({
|
|
29
|
+
maxFileSize: 5,
|
|
30
|
+
});
|
|
31
|
+
wrapper.vm.fileChange([{ size: 6 * 1024 * 1024 }]);
|
|
32
|
+
expect(wrapper.vm.maxSizeReach).toBeTruthy();
|
|
33
|
+
});
|
|
26
34
|
});
|
|
27
35
|
|
|
28
36
|
describe('handlerFunctionHighlight', () => {
|
|
@@ -49,4 +57,13 @@ describe('FilePicker component', () => {
|
|
|
49
57
|
});
|
|
50
58
|
});
|
|
51
59
|
});
|
|
60
|
+
|
|
61
|
+
describe('Computed properties', () => {
|
|
62
|
+
it('Should return maxSizeReachMsg', () => {
|
|
63
|
+
wrapper.setProps({
|
|
64
|
+
maxFileSize: 5,
|
|
65
|
+
});
|
|
66
|
+
expect(wrapper.vm.maxSizeReachMsg).toContain('Arquivo ultrapassou o tamanho máximo');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
52
69
|
});
|
|
@@ -7,7 +7,14 @@ export default {
|
|
|
7
7
|
|
|
8
8
|
export const Primary = () => ({
|
|
9
9
|
components: { PromptUserToConfirm },
|
|
10
|
-
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
model: {},
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
template: `<div style="max-width: 320px"><PromptUserToConfirm v-model="model"/>
|
|
16
|
+
match: {{ model }}
|
|
17
|
+
</div>`,
|
|
11
18
|
});
|
|
12
19
|
|
|
13
20
|
export const CustomTitle = () => ({
|
|
@@ -15,5 +22,18 @@ export const CustomTitle = () => ({
|
|
|
15
22
|
template: '<div style="max-width: 320px"><PromptUserToConfirm title="Custom" /></div>',
|
|
16
23
|
});
|
|
17
24
|
|
|
25
|
+
export const CustomMatchInput = () => ({
|
|
26
|
+
components: { PromptUserToConfirm },
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
model: {},
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
template: `<div style="max-width: 320px"><PromptUserToConfirm title="Custom match input: CONFIRMAR" match="CONFIRMAR" v-model="model" />
|
|
33
|
+
match: {{ model }}
|
|
34
|
+
</div>`,
|
|
35
|
+
});
|
|
36
|
+
|
|
18
37
|
Primary.storyName = 'Básico';
|
|
19
38
|
CustomTitle.storyName = 'Título customizado';
|
|
39
|
+
CustomMatchInput.storyName = 'Match input customizado';
|
|
@@ -9,11 +9,30 @@ const headers = [
|
|
|
9
9
|
width: 80,
|
|
10
10
|
align: 'left',
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
text: 'Name',
|
|
14
|
+
sortable: false,
|
|
15
|
+
value: 'id',
|
|
16
|
+
width: 160,
|
|
17
|
+
align: 'left',
|
|
18
|
+
},
|
|
12
19
|
];
|
|
13
20
|
|
|
14
21
|
export default {
|
|
15
22
|
title: 'Examples/Table',
|
|
16
23
|
decorators: [withDesign],
|
|
24
|
+
parameters: {
|
|
25
|
+
design: {
|
|
26
|
+
type: 'figma',
|
|
27
|
+
url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1505%3A372',
|
|
28
|
+
},
|
|
29
|
+
viewMode: 'docs',
|
|
30
|
+
docs: {
|
|
31
|
+
description: {
|
|
32
|
+
component: `Data Table (inherit from Vuetify)`,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
17
36
|
};
|
|
18
37
|
|
|
19
38
|
export const TableNoData = () => ({
|
|
@@ -26,8 +45,10 @@ export const TableNoData = () => ({
|
|
|
26
45
|
};
|
|
27
46
|
},
|
|
28
47
|
template: `<div>
|
|
48
|
+
|
|
29
49
|
<v-data-table
|
|
30
50
|
hide-default-footer
|
|
51
|
+
id="v-data-table--default"
|
|
31
52
|
:headers="headers"
|
|
32
53
|
>
|
|
33
54
|
<template slot="no-data">
|
|
@@ -46,12 +67,17 @@ export const TableSampleData = () => ({
|
|
|
46
67
|
data() {
|
|
47
68
|
return {
|
|
48
69
|
headers,
|
|
49
|
-
items: [
|
|
70
|
+
items: [
|
|
71
|
+
{ id: 1, name: 'name 1' },
|
|
72
|
+
{ id: 2, name: 'name 2' },
|
|
73
|
+
{ id: 3, name: 'name 3' },
|
|
74
|
+
],
|
|
50
75
|
};
|
|
51
76
|
},
|
|
52
77
|
template: `<div>
|
|
53
78
|
<v-data-table
|
|
54
79
|
hide-default-footer
|
|
80
|
+
id="v-data-table--default"
|
|
55
81
|
:headers="headers"
|
|
56
82
|
:items="items"
|
|
57
83
|
>
|
|
@@ -62,23 +88,8 @@ export const TableSampleData = () => ({
|
|
|
62
88
|
|
|
63
89
|
TableNoData.story = {
|
|
64
90
|
name: 'No data',
|
|
65
|
-
parameters: {
|
|
66
|
-
design: {
|
|
67
|
-
type: 'figma',
|
|
68
|
-
url:
|
|
69
|
-
'https://www.figma.com/file/rkkAsX4IP0tzv1udIDXlqe/%E2%9C%8D---Onboarding---PJ?node-id=2867%3A10594',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
91
|
};
|
|
73
92
|
|
|
74
93
|
TableSampleData.story = {
|
|
75
94
|
name: 'With data',
|
|
76
|
-
parameters: {
|
|
77
|
-
design: {
|
|
78
|
-
type: 'figma',
|
|
79
|
-
url:
|
|
80
|
-
'https://www.figma.com/file/rkkAsX4IP0tzv1udIDXlqe/%E2%9C%8D---Onboarding---PJ?node-id=2867%3A10594',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
95
|
};
|
|
84
|
-
|