@farm-investimentos/front-mfe-components 3.4.13 → 3.5.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 +1866 -110
- 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 +1866 -110
- 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/ChipInviteStatus/ChipInviteStatus.scss +5 -0
- package/src/components/ChipInviteStatus/ChipInviteStatus.stories.js +1 -0
- package/src/components/ChipInviteStatus/ChipInviteStatus.vue +5 -1
- package/src/components/DatePicker/DatePicker.stories.js +8 -1
- package/src/components/DatePicker/DatePicker.vue +30 -6
- package/src/helpers/date.js +5 -0
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ const StatusLabel = {
|
|
|
22
22
|
14: 'FALHA/ERRO',
|
|
23
23
|
15: 'EM ANÁLISE',
|
|
24
24
|
16: 'EM ANDAMENTO',
|
|
25
|
+
17: 'EM ESPERA',
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const StatusColor = {
|
|
@@ -32,6 +33,7 @@ const StatusColor = {
|
|
|
32
33
|
14: 'error',
|
|
33
34
|
15: 'accent',
|
|
34
35
|
16: 'primary',
|
|
36
|
+
17: 'on-wait',
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
import VChip from 'vuetify/lib/components/VChip/';
|
|
@@ -59,7 +61,9 @@ export default Vue.extend({
|
|
|
59
61
|
},
|
|
60
62
|
computed: {
|
|
61
63
|
textColor() {
|
|
62
|
-
return this.status === 10 || this.status === 16
|
|
64
|
+
return this.status === 10 || this.status === 16 || this.status === 17
|
|
65
|
+
? ''
|
|
66
|
+
: StatusColor[this.status];
|
|
63
67
|
},
|
|
64
68
|
color() {
|
|
65
69
|
return !this.status ? '' : StatusColor[this.status];
|
|
@@ -37,13 +37,20 @@ export const MinMaxDates = () => ({
|
|
|
37
37
|
|
|
38
38
|
export const RequiredDates = () => ({
|
|
39
39
|
components: { DatePicker },
|
|
40
|
-
|
|
41
40
|
template: `<div style='max-width: 320px'>
|
|
42
41
|
<DatePicker inputId="input-custom-id-3" :required="true" />
|
|
43
42
|
</div>`,
|
|
44
43
|
});
|
|
45
44
|
|
|
45
|
+
export const readonlyFalse = () => ({
|
|
46
|
+
components: { DatePicker },
|
|
47
|
+
template: `<div style='max-width: 320px'>
|
|
48
|
+
<DatePicker :readonly="false" inputId="input-custom-id-3"/>
|
|
49
|
+
</div>`,
|
|
50
|
+
});
|
|
51
|
+
|
|
46
52
|
Primary.storyName = 'Básico';
|
|
47
53
|
InitValue.storyName = 'Data inicial';
|
|
48
54
|
MinMaxDates.storyName = 'Data mínima e máxima';
|
|
49
55
|
RequiredDates.storyName = 'Obrigatório';
|
|
56
|
+
readonlyFalse.storyName = 'Permitir digitação';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
ref="menuField"
|
|
4
4
|
v-model="menuField"
|
|
5
5
|
:close-on-content-click="false"
|
|
6
|
-
:nudge-right="40"
|
|
7
6
|
:return-value.sync="fieldRange"
|
|
8
7
|
transition="scale-transition"
|
|
9
8
|
offset-y
|
|
@@ -13,13 +12,16 @@
|
|
|
13
12
|
<v-text-field
|
|
14
13
|
color="secondary"
|
|
15
14
|
append-icon="mdi-calendar"
|
|
16
|
-
readonly
|
|
15
|
+
v-mask="`${readonly ? '' : '##/##/####'}`"
|
|
16
|
+
@keyup="keyUpInput"
|
|
17
|
+
:readonly="readonly"
|
|
18
|
+
autocomplete="off"
|
|
17
19
|
outlined
|
|
18
20
|
dense
|
|
19
21
|
v-on="on"
|
|
20
22
|
v-model="fieldRange"
|
|
21
23
|
:id="inputId"
|
|
22
|
-
:rules="
|
|
24
|
+
:rules="[checkMax, checkMin, checkRequire]"
|
|
23
25
|
>
|
|
24
26
|
</v-text-field>
|
|
25
27
|
</template>
|
|
@@ -54,7 +56,7 @@ import { VTextField } from 'vuetify/lib/components/VTextField';
|
|
|
54
56
|
import { VMenu } from 'vuetify/lib/components/VMenu';
|
|
55
57
|
import { VBtn } from 'vuetify/lib/components/VBtn';
|
|
56
58
|
import { VDatePicker } from 'vuetify/lib/components/VDatePicker';
|
|
57
|
-
import { defaultFormat as dateDefaultFormatter } from '../../helpers/date';
|
|
59
|
+
import { defaultFormat as dateDefaultFormatter, convertDate } from '../../helpers/date';
|
|
58
60
|
/**
|
|
59
61
|
* Componente de input com datepicker para data
|
|
60
62
|
*/
|
|
@@ -96,6 +98,10 @@ export default Vue.extend({
|
|
|
96
98
|
type: Boolean,
|
|
97
99
|
default: false,
|
|
98
100
|
},
|
|
101
|
+
readonly: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: false,
|
|
104
|
+
},
|
|
99
105
|
},
|
|
100
106
|
data() {
|
|
101
107
|
const s = this.formatDateRange(this.value);
|
|
@@ -103,9 +109,15 @@ export default Vue.extend({
|
|
|
103
109
|
menuField: false,
|
|
104
110
|
dateField: this.value,
|
|
105
111
|
fieldRange: s,
|
|
106
|
-
|
|
107
|
-
return !!value || value != '' || 'Campo obrigatório';
|
|
112
|
+
checkRequire: value => {
|
|
113
|
+
return this.required ? !!value || value != '' || 'Campo obrigatório' : true;
|
|
108
114
|
},
|
|
115
|
+
checkMax: value => {
|
|
116
|
+
return this.max && new Date(convertDate(value)) > new Date(this.max) ? 'A data está fora do período permitido' : true;
|
|
117
|
+
},
|
|
118
|
+
checkMin: value => {
|
|
119
|
+
return this.min && new Date(convertDate(value)) < new Date(this.min) ? 'A data está fora do período permitido' : true;
|
|
120
|
+
}
|
|
109
121
|
};
|
|
110
122
|
},
|
|
111
123
|
watch: {
|
|
@@ -127,6 +139,18 @@ export default Vue.extend({
|
|
|
127
139
|
this.dateField = '';
|
|
128
140
|
this.save();
|
|
129
141
|
},
|
|
142
|
+
validation(date){
|
|
143
|
+
const pattern = /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[13-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/gm;
|
|
144
|
+
return pattern.test(date);
|
|
145
|
+
},
|
|
146
|
+
keyUpInput(event) {
|
|
147
|
+
let newValue = event.target.value;
|
|
148
|
+
if(this.validation(newValue) && newValue.length === 10) {
|
|
149
|
+
const [day, month, year] = newValue.split('/');
|
|
150
|
+
this.dateField = `${year}-${month}-${day}`;
|
|
151
|
+
this.save();
|
|
152
|
+
}
|
|
153
|
+
},
|
|
130
154
|
},
|
|
131
155
|
computed: {
|
|
132
156
|
inputVal: {
|
package/src/helpers/date.js
CHANGED
|
@@ -4,3 +4,8 @@ export const defaultFormat = (data, UTCTimeZone = true) => {
|
|
|
4
4
|
};
|
|
5
5
|
return data ? new Date(data).toLocaleDateString('pt-BR', UTCTimeZone ? options : {}) : null;
|
|
6
6
|
};
|
|
7
|
+
|
|
8
|
+
export const convertDate = (data) => {
|
|
9
|
+
let newdate = data.split("/").reverse().join("-");
|
|
10
|
+
return newdate;
|
|
11
|
+
}
|