@farm-investimentos/front-mfe-components 11.10.7 → 11.11.0
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 +213 -218
- 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 +213 -218
- 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/Checkbox/Checkbox.stories.js +25 -1
- package/src/components/DatePicker/DatePicker.stories.js +2 -1
- package/src/components/DatePicker/DatePicker.vue +18 -5
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +12 -0
- package/src/components/Logger/Logger.scss +24 -5
- package/src/components/Logger/Logger.stories.js +8 -1
- package/src/components/Logger/Logger.vue +6 -24
- package/src/components/Logger/LoggerItem/LoggerItem.scss +3 -0
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +14 -0
- package/src/components/Logger/LoggerItem/LoggerItem.vue +4 -5
- package/src/components/Logger/__tests__/Logger.spec.js +3 -50
- package/src/components/RangeDatePicker/RangeDatePicker.stories.js +3 -2
- package/src/components/RangeDatePicker/RangeDatePicker.vue +9 -2
- package/src/components/RangeDatePicker/__tests__/RangeDatePicker.spec.js +17 -3
package/package.json
CHANGED
|
@@ -32,6 +32,30 @@ export const Primary = () => ({
|
|
|
32
32
|
</div>`,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
export const Value = () => ({
|
|
36
|
+
data() {
|
|
37
|
+
return {
|
|
38
|
+
option1: 'option1',
|
|
39
|
+
option2: 'option2',
|
|
40
|
+
option3: 'option3',
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
template: `<div>
|
|
44
|
+
<div class="d-flex">
|
|
45
|
+
<farm-checkbox v-model="option1" value="1" class="mr-2" />
|
|
46
|
+
option1 : {{option1}}
|
|
47
|
+
</div>
|
|
48
|
+
<div class="d-flex align-center">
|
|
49
|
+
<farm-checkbox v-model="option2" value="2" class="mr-2 my-2" />
|
|
50
|
+
option2 : {{option2}}
|
|
51
|
+
</div>
|
|
52
|
+
<div class="d-flex">
|
|
53
|
+
<farm-checkbox v-model="option3" value="3" class="mr-2" />
|
|
54
|
+
option3 : {{option3}}
|
|
55
|
+
</div>
|
|
56
|
+
</div>`,
|
|
57
|
+
});
|
|
58
|
+
|
|
35
59
|
export const DefaultCheck = () => ({
|
|
36
60
|
data() {
|
|
37
61
|
return {
|
|
@@ -120,4 +144,4 @@ export const Indeterminate = () => ({
|
|
|
120
144
|
template: `<div>
|
|
121
145
|
<farm-checkbox :indeterminate="true" v-model="isChecked" :value="true" />
|
|
122
146
|
</div>`,
|
|
123
|
-
});
|
|
147
|
+
});
|
|
@@ -7,7 +7,8 @@ export default {
|
|
|
7
7
|
docs: {
|
|
8
8
|
description: {
|
|
9
9
|
component: `Input Date Picker<br />
|
|
10
|
-
selector: <em>farm-input-datepicker</em
|
|
10
|
+
selector: <em>farm-input-datepicker</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
11
12
|
`,
|
|
12
13
|
},
|
|
13
14
|
},
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
<farm-textfield-v2
|
|
13
13
|
icon="calendar"
|
|
14
14
|
v-model="fieldRange"
|
|
15
|
+
autocomplete="off"
|
|
15
16
|
:readonly="readonly"
|
|
16
17
|
:mask="`${readonly ? '' : '##/##/####'}`"
|
|
17
|
-
autocomplete="off"
|
|
18
18
|
:id="inputId"
|
|
19
19
|
:rules="[checkMax, checkMin, checkRequire]"
|
|
20
20
|
@keyup="keyUpInput"
|
|
21
|
-
@click="
|
|
21
|
+
@click="openDatepicker"
|
|
22
|
+
@onClickIcon="openDatepicker"
|
|
22
23
|
/>
|
|
23
24
|
</template>
|
|
24
25
|
<v-date-picker
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
:max="max"
|
|
32
33
|
:min="min"
|
|
33
34
|
>
|
|
34
|
-
<farm-btn outlined color="secondary" @click="
|
|
35
|
+
<farm-btn outlined color="secondary" @click="closeDatepicker" title="Fechar">
|
|
35
36
|
Fechar
|
|
36
37
|
</farm-btn>
|
|
37
38
|
<farm-btn outlined class="ml-2" @click="clear"> Limpar </farm-btn>
|
|
@@ -57,23 +58,29 @@ export default Vue.extend({
|
|
|
57
58
|
},
|
|
58
59
|
props: {
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
+
* Input's id
|
|
61
62
|
*/
|
|
62
63
|
inputId: {
|
|
63
64
|
type: String,
|
|
64
65
|
required: true,
|
|
65
66
|
},
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
+
* v-model bind
|
|
68
69
|
*/
|
|
69
70
|
value: {
|
|
70
71
|
type: String,
|
|
71
72
|
default: '',
|
|
72
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Max date (ISO format)
|
|
76
|
+
*/
|
|
73
77
|
max: {
|
|
74
78
|
type: String,
|
|
75
79
|
default: null,
|
|
76
80
|
},
|
|
81
|
+
/**
|
|
82
|
+
* Min date (ISO format)
|
|
83
|
+
*/
|
|
77
84
|
min: {
|
|
78
85
|
type: String,
|
|
79
86
|
default: null,
|
|
@@ -173,6 +180,12 @@ export default Vue.extend({
|
|
|
173
180
|
const arr = onlyDMY.split('/');
|
|
174
181
|
return new Date(arr[2], arr[1] - 1, arr[0]);
|
|
175
182
|
},
|
|
183
|
+
openDatepicker() {
|
|
184
|
+
this.menuField = true;
|
|
185
|
+
},
|
|
186
|
+
closeDatepicker() {
|
|
187
|
+
this.menuField = false;
|
|
188
|
+
},
|
|
176
189
|
},
|
|
177
190
|
computed: {
|
|
178
191
|
inputVal: {
|
|
@@ -34,4 +34,16 @@ describe('DatePicker component', () => {
|
|
|
34
34
|
expect(wrapper.emitted().input).toBeDefined();
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
|
+
|
|
38
|
+
describe('methods', () => {
|
|
39
|
+
it('openDatepicker', () => {
|
|
40
|
+
component.openDatepicker();
|
|
41
|
+
expect(component.menuField).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('closeDatepicker', () => {
|
|
45
|
+
component.closeDatepicker();
|
|
46
|
+
expect(component.menuField).toBeFalsy();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
37
49
|
});
|
|
@@ -2,24 +2,43 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.logger__divider {
|
|
6
7
|
height: 40px;
|
|
7
8
|
margin: -4px 0 -4px 16px;
|
|
8
9
|
width: 1px;
|
|
9
10
|
|
|
10
|
-
&.logger__divider--success
|
|
11
|
+
&.logger__divider--success-to-success {
|
|
11
12
|
background: var(--farm-primary-base);
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
&.logger__divider--error {
|
|
15
|
+
&.logger__divider--error-to-error {
|
|
15
16
|
background: var(--farm-error-base);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
&.logger__divider--
|
|
19
|
-
background:
|
|
19
|
+
&.logger__divider--info-to-info {
|
|
20
|
+
background: var(--farm-error-base);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
&.logger__divider--success-to-error {
|
|
23
24
|
background: linear-gradient(to bottom, var(--farm-primary-base), var(--farm-error-base));
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
&.logger__divider--success-to-info {
|
|
27
|
+
background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-info-base));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.logger__divider--error-to-success {
|
|
31
|
+
background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-primary-base));
|
|
32
|
+
}
|
|
33
|
+
&.logger__divider--error-to-info {
|
|
34
|
+
background: linear-gradient(to bottom, var(--farm-error-base), var(--farm-info-base));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&.logger__divider--info-to-success {
|
|
38
|
+
background: linear-gradient(to bottom, var(--farm-info-base), var(--farm-primary-base));
|
|
39
|
+
}
|
|
40
|
+
&.logger__divider--info-to-error {
|
|
41
|
+
background: linear-gradient(to bottom, var(--farm-info-base), var(--farm-error-base));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -31,6 +31,7 @@ export const Primary = () => ({
|
|
|
31
31
|
formattedDate: '13/06/2022 20:40',
|
|
32
32
|
status: 'error',
|
|
33
33
|
},
|
|
34
|
+
|
|
34
35
|
{
|
|
35
36
|
message: 'Aprovado entre as pré elegíveis',
|
|
36
37
|
userName: 'Cleyton Rasta',
|
|
@@ -53,7 +54,13 @@ export const Primary = () => ({
|
|
|
53
54
|
message: 'Recusado entre as pré elegíveis',
|
|
54
55
|
userName: 'Cleyton Rasta',
|
|
55
56
|
formattedDate: '13/06/2022 20:40',
|
|
56
|
-
status: '
|
|
57
|
+
status: 'success',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
message: 'Info',
|
|
61
|
+
userName: 'Cleyton Rasta',
|
|
62
|
+
formattedDate: '13/06/2022 20:40',
|
|
63
|
+
status: 'info',
|
|
57
64
|
},
|
|
58
65
|
],
|
|
59
66
|
};
|
|
@@ -5,13 +5,8 @@
|
|
|
5
5
|
<div
|
|
6
6
|
v-if="hasDivider(index)"
|
|
7
7
|
:class="{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'logger__divider--error': isPreviousLogAndCurrentLogError(index),
|
|
11
|
-
'logger__divider--success-to-error':
|
|
12
|
-
isPreviousLogErrorAndCurrentLogSuccess(index),
|
|
13
|
-
'logger__divider--error-to-success':
|
|
14
|
-
isPreviousLogSuccessAndCurrentLogError(index),
|
|
8
|
+
logger__divider: true,
|
|
9
|
+
[dividerCssClass(index)]: true,
|
|
15
10
|
}"
|
|
16
11
|
:key="'divider_' + index"
|
|
17
12
|
></div>
|
|
@@ -34,23 +29,10 @@ export default Vue.extend({
|
|
|
34
29
|
hasDivider(index: number): boolean {
|
|
35
30
|
return index < this.items.length - 1;
|
|
36
31
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return this.isSuccess(index) && this.isSuccess(index + 1);
|
|
42
|
-
},
|
|
43
|
-
isPreviousLogErrorAndCurrentLogSuccess(index: number): boolean {
|
|
44
|
-
return this.isSuccess(index) && this.isError(index + 1);
|
|
45
|
-
},
|
|
46
|
-
isPreviousLogSuccessAndCurrentLogError(index: number): boolean {
|
|
47
|
-
return this.isError(index) && this.isSuccess(index + 1);
|
|
48
|
-
},
|
|
49
|
-
isError(index: number): boolean {
|
|
50
|
-
return this.items[index].status === 'error';
|
|
51
|
-
},
|
|
52
|
-
isSuccess(index: number): boolean {
|
|
53
|
-
return this.items[index].status === 'success';
|
|
32
|
+
dividerCssClass(index: number): string {
|
|
33
|
+
const previous = this.items[index].status;
|
|
34
|
+
const next = this.items[index + 1].status;
|
|
35
|
+
return `logger__divider--${previous}-to-${next}`;
|
|
54
36
|
},
|
|
55
37
|
},
|
|
56
38
|
});
|
|
@@ -60,6 +60,20 @@ export const Error = () => ({
|
|
|
60
60
|
template: `<farm-logger-item :item="item" />`,
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
export const Info = () => ({
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
item: {
|
|
67
|
+
message: 'Recusado entre as pré elegíveis',
|
|
68
|
+
userName: 'Cleyton Rasta',
|
|
69
|
+
formattedDate: '13/06/2022 20:40',
|
|
70
|
+
status: 'info',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
template: `<farm-logger-item :item="item" />`,
|
|
75
|
+
});
|
|
76
|
+
|
|
63
77
|
export const CustomIcon = () => ({
|
|
64
78
|
data() {
|
|
65
79
|
return {
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
<section
|
|
3
3
|
class="logger__item"
|
|
4
4
|
:class="{
|
|
5
|
-
'logger__item--
|
|
6
|
-
'logger__item--success': item.status === 'success',
|
|
5
|
+
['logger__item--' + item.status]: true,
|
|
7
6
|
}"
|
|
8
7
|
>
|
|
9
8
|
<farm-icon>{{ mdiIconName }}</farm-icon>
|
|
@@ -25,9 +24,9 @@
|
|
|
25
24
|
title="Ver Detalhes"
|
|
26
25
|
:color="buttonColor"
|
|
27
26
|
@click="callDetails"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
>
|
|
28
|
+
Ver Detalhes
|
|
29
|
+
</farm-btn>
|
|
31
30
|
</section>
|
|
32
31
|
</template>
|
|
33
32
|
<script lang="ts">
|
|
@@ -65,57 +65,10 @@ describe('Logger component', () => {
|
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
describe('
|
|
68
|
+
describe('dividerCssClass', () => {
|
|
69
69
|
it('should return true', () => {
|
|
70
|
-
expect(component.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
it('should return false', () => {
|
|
74
|
-
expect(component.isPreviousLogAndCurrentLogError(1)).toBeFalsy();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe('isPreviousLogAndCurrentLogSuccess', () => {
|
|
79
|
-
it('should return true', () => {
|
|
80
|
-
expect(component.isPreviousLogAndCurrentLogSuccess(2)).toBeTruthy();
|
|
81
|
-
});
|
|
82
|
-
it('should return false', () => {
|
|
83
|
-
expect(component.isPreviousLogAndCurrentLogSuccess(0)).toBeFalsy();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('isPreviousLogErrorAndCurrentLogSuccess', () => {
|
|
88
|
-
it('should return true', () => {
|
|
89
|
-
expect(component.isPreviousLogErrorAndCurrentLogSuccess(3)).toBeTruthy();
|
|
90
|
-
});
|
|
91
|
-
it('should return false', () => {
|
|
92
|
-
expect(component.isPreviousLogErrorAndCurrentLogSuccess(2)).toBeFalsy();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
describe('isPreviousLogSuccessAndCurrentLogError', () => {
|
|
96
|
-
it('should return true', () => {
|
|
97
|
-
expect(component.isPreviousLogSuccessAndCurrentLogError(1)).toBeTruthy();
|
|
98
|
-
});
|
|
99
|
-
it('should false', () => {
|
|
100
|
-
expect(component.isPreviousLogSuccessAndCurrentLogError(2)).toBeFalsy();
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('isError', () => {
|
|
105
|
-
it('should true when the status is error', () => {
|
|
106
|
-
expect(component.isError(1)).toBeTruthy();
|
|
107
|
-
});
|
|
108
|
-
it('should false when the status is success', () => {
|
|
109
|
-
expect(component.isError(2)).toBeFalsy();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('isSuccess', () => {
|
|
114
|
-
it('should return true when the status is success', () => {
|
|
115
|
-
expect(component.isSuccess(2)).toBeTruthy();
|
|
116
|
-
});
|
|
117
|
-
it('should false when the status is error', () => {
|
|
118
|
-
expect(component.isSuccess(1)).toBeFalsy();
|
|
70
|
+
expect(component.dividerCssClass(0)).toEqual('logger__divider--error-to-error');
|
|
71
|
+
expect(component.dividerCssClass(1)).toEqual('logger__divider--error-to-success');
|
|
119
72
|
});
|
|
120
73
|
});
|
|
121
74
|
});
|
|
@@ -8,8 +8,9 @@ export default {
|
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
|
-
component: `Range
|
|
12
|
-
selector: <em>farm-input-rangedatepicker</em
|
|
11
|
+
component: `Range Input Date Picker<br />
|
|
12
|
+
selector: <em>farm-input-rangedatepicker</em><br />
|
|
13
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
13
14
|
`,
|
|
14
15
|
},
|
|
15
16
|
},
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
readonly
|
|
17
17
|
:id="inputId"
|
|
18
18
|
:rules="required ? [requiredRule] : []"
|
|
19
|
-
@click="
|
|
19
|
+
@click="openDatepicker"
|
|
20
|
+
@onClickIcon="openDatepicker"
|
|
20
21
|
/>
|
|
21
22
|
</template>
|
|
22
23
|
<v-date-picker
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
color="secondary"
|
|
31
32
|
locale="pt-br"
|
|
32
33
|
>
|
|
33
|
-
<farm-btn outlined color="secondary" @click="
|
|
34
|
+
<farm-btn outlined color="secondary" @click="closeDatepicker" title="Fechar">
|
|
34
35
|
Fechar
|
|
35
36
|
</farm-btn>
|
|
36
37
|
<farm-btn outlined class="ml-2" @click="clear()" title="Limpar"> Limpar</farm-btn>
|
|
@@ -134,6 +135,12 @@ export default Vue.extend({
|
|
|
134
135
|
this.dateField = [];
|
|
135
136
|
this.save();
|
|
136
137
|
},
|
|
138
|
+
openDatepicker() {
|
|
139
|
+
this.menuField = true;
|
|
140
|
+
},
|
|
141
|
+
closeDatepicker() {
|
|
142
|
+
this.menuField = false;
|
|
143
|
+
},
|
|
137
144
|
},
|
|
138
145
|
computed: {
|
|
139
146
|
inputVal: {
|
|
@@ -3,6 +3,7 @@ import RangeDatePicker from '../RangeDatePicker';
|
|
|
3
3
|
|
|
4
4
|
describe('RangeDatePicker component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
+
let component;
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
wrapper = shallowMount(RangeDatePicker, {
|
|
@@ -10,6 +11,7 @@ describe('RangeDatePicker component', () => {
|
|
|
10
11
|
inputId: 'someid',
|
|
11
12
|
},
|
|
12
13
|
});
|
|
14
|
+
component = wrapper.vm;
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
test('Created hook', () => {
|
|
@@ -29,9 +31,21 @@ describe('RangeDatePicker component', () => {
|
|
|
29
31
|
min: '2022-01-17',
|
|
30
32
|
max: '2022-01-31',
|
|
31
33
|
});
|
|
32
|
-
expect(
|
|
33
|
-
expect(
|
|
34
|
-
expect(
|
|
34
|
+
expect(component.inputId).toBe('someid');
|
|
35
|
+
expect(component.min).toBe('2022-01-17');
|
|
36
|
+
expect(component.max).toBe('2022-01-31');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('methods', () => {
|
|
41
|
+
it('openDatepicker', () => {
|
|
42
|
+
component.openDatepicker();
|
|
43
|
+
expect(component.menuField).toBeTruthy();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('closeDatepicker', () => {
|
|
47
|
+
component.closeDatepicker();
|
|
48
|
+
expect(component.menuField).toBeFalsy();
|
|
35
49
|
});
|
|
36
50
|
});
|
|
37
51
|
});
|