@farm-investimentos/front-mfe-components 11.7.0 → 11.7.1
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 +6388 -6389
- 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 +6388 -6389
- 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/DatePicker/DatePicker.stories.js +7 -12
- package/src/components/DatePicker/DatePicker.vue +9 -17
- package/src/components/FilePicker/FilePicker.vue +10 -15
- package/src/components/FilePicker/__tests__/FilePicker.spec.js +12 -4
- package/src/components/Form/Form.stories.js +53 -47
- package/src/components/RangeDatePicker/RangeDatePicker.stories.js +23 -25
- package/src/components/RangeDatePicker/RangeDatePicker.vue +6 -14
- package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +29 -29
- package/src/components/TextFieldV2/TextFieldV2.scss +14 -2
- package/src/components/TextFieldV2/TextFieldV2.stories.js +1 -0
- package/src/components/TextFieldV2/TextFieldV2.vue +3 -2
- package/src/components/layout/Basic.stories.js +21 -0
- package/src/components/layout/Container/Container.scss +1 -0
package/package.json
CHANGED
|
@@ -16,42 +16,37 @@ export default {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const Primary = () => ({
|
|
19
|
-
components: { DatePicker },
|
|
20
19
|
data() {
|
|
21
20
|
return {
|
|
22
|
-
|
|
21
|
+
date: '',
|
|
23
22
|
};
|
|
24
23
|
},
|
|
25
24
|
template: `<div style='max-width: 320px'>
|
|
26
|
-
<
|
|
27
|
-
{{
|
|
25
|
+
<farm-input-datepicker inputId="input-custom-id-0" v-model="date" />
|
|
26
|
+
{{ date }}
|
|
28
27
|
</div>`,
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
export const InitValue = () => ({
|
|
32
|
-
|
|
33
|
-
template: `<div style='max-width: 320px'><DatePicker inputId="input-custom-id-1" value="2021-08-01" /></div>`,
|
|
31
|
+
template: `<div style='max-width: 320px'><farm-input-datepicker inputId="input-custom-id-1" value="2021-08-01" /></div>`,
|
|
34
32
|
});
|
|
35
33
|
|
|
36
34
|
export const MinMaxDates = () => ({
|
|
37
|
-
components: { DatePicker },
|
|
38
35
|
template: `<div style='max-width: 320px'>
|
|
39
|
-
<
|
|
36
|
+
<farm-input-datepicker inputId="input-custom-id-2" max="2021-12-02" min="2021-07-01" />
|
|
40
37
|
max="2021-12-02" min="2021-07-01"
|
|
41
38
|
</div>`,
|
|
42
39
|
});
|
|
43
40
|
|
|
44
41
|
export const RequiredDates = () => ({
|
|
45
|
-
components: { DatePicker },
|
|
46
42
|
template: `<div style='max-width: 320px'>
|
|
47
|
-
<
|
|
43
|
+
<farm-input-datepicker inputId="input-custom-id-3" :required="true" />
|
|
48
44
|
</div>`,
|
|
49
45
|
});
|
|
50
46
|
|
|
51
47
|
export const ReadonlyFalse = () => ({
|
|
52
|
-
components: { DatePicker },
|
|
53
48
|
template: `<div style='max-width: 320px'>
|
|
54
|
-
<
|
|
49
|
+
<farm-input-datepicker :readonly="false" inputId="input-custom-id-3"/>
|
|
55
50
|
</div>`,
|
|
56
51
|
});
|
|
57
52
|
|
|
@@ -8,22 +8,18 @@
|
|
|
8
8
|
offset-y
|
|
9
9
|
min-width="290px"
|
|
10
10
|
>
|
|
11
|
-
<template v-slot:activator="{
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
v-mask="`${readonly ? '' : '##/##/####'}`"
|
|
16
|
-
@keyup="keyUpInput"
|
|
11
|
+
<template v-slot:activator="{}">
|
|
12
|
+
<farm-textfield-v2
|
|
13
|
+
icon="calendar"
|
|
14
|
+
v-model="fieldRange"
|
|
17
15
|
:readonly="readonly"
|
|
16
|
+
:mask="`${readonly ? '' : '##/##/####'}`"
|
|
18
17
|
autocomplete="off"
|
|
19
|
-
outlined
|
|
20
|
-
dense
|
|
21
|
-
v-on="on"
|
|
22
|
-
v-model="fieldRange"
|
|
23
18
|
:id="inputId"
|
|
24
19
|
:rules="[checkMax, checkMin, checkRequire]"
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
@keyup="keyUpInput"
|
|
21
|
+
@click="menuField = true"
|
|
22
|
+
/>
|
|
27
23
|
</template>
|
|
28
24
|
<v-date-picker
|
|
29
25
|
v-if="menuField"
|
|
@@ -45,12 +41,10 @@
|
|
|
45
41
|
</v-date-picker>
|
|
46
42
|
</v-menu>
|
|
47
43
|
</template>
|
|
48
|
-
<script>
|
|
44
|
+
<script lang="ts">
|
|
49
45
|
import Vue from 'vue';
|
|
50
|
-
import { VTextField } from 'vuetify/lib/components/VTextField';
|
|
51
46
|
import { VMenu } from 'vuetify/lib/components/VMenu';
|
|
52
47
|
import { VDatePicker } from 'vuetify/lib/components/VDatePicker';
|
|
53
|
-
import DefaultButton from '../Buttons/DefaultButton';
|
|
54
48
|
import { defaultFormat as dateDefaultFormatter, convertDate } from '../../helpers/date';
|
|
55
49
|
/**
|
|
56
50
|
* Componente de input com datepicker para data
|
|
@@ -58,10 +52,8 @@ import { defaultFormat as dateDefaultFormatter, convertDate } from '../../helper
|
|
|
58
52
|
export default Vue.extend({
|
|
59
53
|
name: 'farm-input-datepicker',
|
|
60
54
|
components: {
|
|
61
|
-
VTextField,
|
|
62
55
|
VMenu,
|
|
63
56
|
VDatePicker,
|
|
64
|
-
'farm-btn': DefaultButton,
|
|
65
57
|
},
|
|
66
58
|
props: {
|
|
67
59
|
/**
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<input
|
|
4
4
|
type="file"
|
|
5
5
|
name="file"
|
|
6
|
-
@change="fileChange($event.target.files)"
|
|
7
6
|
:accept="acceptedFileTypes"
|
|
7
|
+
@change="fileChange($event.target.files)"
|
|
8
8
|
/>
|
|
9
9
|
<div v-if="!selectedFile" class="selectfile-container">
|
|
10
|
-
<farm-icon>cloud-upload</farm-icon>
|
|
10
|
+
<farm-icon @click="triggerClick">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">
|
|
@@ -19,12 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<p v-if="maxSizeReach" v-html="maxSizeReachMsg"></p>
|
|
21
21
|
|
|
22
|
-
<farm-btn
|
|
23
|
-
outlined
|
|
24
|
-
class="farm-btn--responsive"
|
|
25
|
-
title="Escolher outro"
|
|
26
|
-
@click="reset"
|
|
27
|
-
>
|
|
22
|
+
<farm-btn outlined class="farm-btn--responsive" title="Escolher outro" @click="reset">
|
|
28
23
|
Escolher outro
|
|
29
24
|
</farm-btn>
|
|
30
25
|
</div>
|
|
@@ -32,8 +27,6 @@
|
|
|
32
27
|
</template>
|
|
33
28
|
<script lang="ts">
|
|
34
29
|
import Vue from 'vue';
|
|
35
|
-
import DefaultButton from '../Buttons/DefaultButton';
|
|
36
|
-
import Icon from '../Icon';
|
|
37
30
|
|
|
38
31
|
export default Vue.extend({
|
|
39
32
|
name: 'farm-filepicker',
|
|
@@ -63,6 +56,9 @@ export default Vue.extend({
|
|
|
63
56
|
maxSizeReachMsg() {
|
|
64
57
|
return `Arquivo ultrapassou o tamanho máximo de ${this.maxFileSize}MB`;
|
|
65
58
|
},
|
|
59
|
+
inputEl() {
|
|
60
|
+
return this.$refs.container.querySelector('input');
|
|
61
|
+
}
|
|
66
62
|
},
|
|
67
63
|
mounted() {
|
|
68
64
|
this.dropArea = this.$refs.container;
|
|
@@ -70,7 +66,7 @@ export default Vue.extend({
|
|
|
70
66
|
},
|
|
71
67
|
methods: {
|
|
72
68
|
reset() {
|
|
73
|
-
this
|
|
69
|
+
this.inputEl.value = '';
|
|
74
70
|
this.$emit('onReset');
|
|
75
71
|
this.maxSizeReach = false;
|
|
76
72
|
this.selectedFile = null;
|
|
@@ -102,10 +98,9 @@ export default Vue.extend({
|
|
|
102
98
|
this.dropArea.addEventListener('dragover', this.handlerFunctionHighlight, false);
|
|
103
99
|
this.dropArea.addEventListener('drop', this.handlerFunctionUnhighlight, false);
|
|
104
100
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
'farm-icon': Icon,
|
|
101
|
+
triggerClick() {
|
|
102
|
+
this.inputEl.click();
|
|
103
|
+
}
|
|
109
104
|
},
|
|
110
105
|
});
|
|
111
106
|
</script>
|
|
@@ -3,9 +3,11 @@ import FilePicker from '../FilePicker';
|
|
|
3
3
|
|
|
4
4
|
describe('FilePicker component', () => {
|
|
5
5
|
let wrapper;
|
|
6
|
+
let component;
|
|
6
7
|
|
|
7
8
|
beforeEach(() => {
|
|
8
9
|
wrapper = shallowMount(FilePicker);
|
|
10
|
+
component = wrapper.vm;
|
|
9
11
|
});
|
|
10
12
|
|
|
11
13
|
test('Created hook', () => {
|
|
@@ -15,12 +17,12 @@ describe('FilePicker component', () => {
|
|
|
15
17
|
describe('Component methods', () => {
|
|
16
18
|
describe('fileChange', () => {
|
|
17
19
|
it('Should emit event with a file', () => {
|
|
18
|
-
|
|
20
|
+
component.fileChange([1]);
|
|
19
21
|
expect(wrapper.emitted().onFileChange[0]).toBeDefined();
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
it('Should not emit', () => {
|
|
23
|
-
|
|
25
|
+
component.fileChange([]);
|
|
24
26
|
expect(wrapper.emitted().onFileChange).toBeUndefined();
|
|
25
27
|
});
|
|
26
28
|
|
|
@@ -28,7 +30,7 @@ describe('FilePicker component', () => {
|
|
|
28
30
|
await wrapper.setProps({
|
|
29
31
|
maxFileSize: 5,
|
|
30
32
|
});
|
|
31
|
-
|
|
33
|
+
component.fileChange([{ size: 6 * 1024 * 1024 }]);
|
|
32
34
|
expect(wrapper.vm.maxSizeReach).toBeTruthy();
|
|
33
35
|
});
|
|
34
36
|
});
|
|
@@ -36,7 +38,7 @@ describe('FilePicker component', () => {
|
|
|
36
38
|
describe('handlerFunctionHighlight', () => {
|
|
37
39
|
it('Should add class', () => {
|
|
38
40
|
const spyObj = jest.spyOn(wrapper.vm.dropArea.classList, 'add');
|
|
39
|
-
|
|
41
|
+
component.handlerFunctionHighlight();
|
|
40
42
|
expect(spyObj).toHaveBeenCalled();
|
|
41
43
|
});
|
|
42
44
|
});
|
|
@@ -65,5 +67,11 @@ describe('FilePicker component', () => {
|
|
|
65
67
|
});
|
|
66
68
|
expect(wrapper.vm.maxSizeReachMsg).toContain('Arquivo ultrapassou o tamanho máximo');
|
|
67
69
|
});
|
|
70
|
+
|
|
71
|
+
it('Should have input element', () => {
|
|
72
|
+
expect(component.inputEl).toBeDefined();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
|
|
68
76
|
});
|
|
69
77
|
});
|
|
@@ -35,6 +35,7 @@ export const Primary = () => ({
|
|
|
35
35
|
checkbox: true,
|
|
36
36
|
birthDate: new Date('1980/09/20').toISOString(),
|
|
37
37
|
selectId: 1,
|
|
38
|
+
rangeDate: [],
|
|
38
39
|
},
|
|
39
40
|
validForm: false,
|
|
40
41
|
rules: {
|
|
@@ -65,7 +66,7 @@ export const Primary = () => ({
|
|
|
65
66
|
<v-select :rules="[rules.required]" :items="items" v-model="form.selectId"/>
|
|
66
67
|
|
|
67
68
|
<farm-label :required="true">Birthdate:</farm-label>
|
|
68
|
-
<
|
|
69
|
+
<farm-input-datepicker
|
|
69
70
|
ref="birthDate"
|
|
70
71
|
inputId="form-pf-birthDate"
|
|
71
72
|
class="mt-4"
|
|
@@ -73,12 +74,22 @@ export const Primary = () => ({
|
|
|
73
74
|
:readonly="true"
|
|
74
75
|
:required="true"
|
|
75
76
|
/>
|
|
77
|
+
|
|
78
|
+
<farm-label :required="true">Range date:</farm-label>
|
|
79
|
+
<farm-input-rangedatepicker
|
|
80
|
+
ref="rangeDate"
|
|
81
|
+
inputId="form-pf-rangeDate"
|
|
82
|
+
class="mt-4"
|
|
83
|
+
v-model="form.rangeDate"
|
|
84
|
+
:required="true"
|
|
85
|
+
/>
|
|
76
86
|
|
|
77
87
|
|
|
78
88
|
<div class="footer" :style="[styles.footer]">
|
|
79
|
-
<farm-btn
|
|
80
|
-
<farm-btn
|
|
89
|
+
<farm-btn outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
90
|
+
<farm-btn :disabled="!validForm">Salvar</farm-btn>
|
|
81
91
|
</div>
|
|
92
|
+
form: {{ form }}
|
|
82
93
|
</farm-form>
|
|
83
94
|
`,
|
|
84
95
|
});
|
|
@@ -196,51 +207,9 @@ export const RadioGroupReset = () => ({
|
|
|
196
207
|
`,
|
|
197
208
|
});
|
|
198
209
|
|
|
199
|
-
export const DatePickers = () => ({
|
|
200
|
-
data() {
|
|
201
|
-
return {
|
|
202
|
-
birthDate: '',
|
|
203
|
-
rangeDate: [],
|
|
204
|
-
validForm: false,
|
|
205
|
-
styles,
|
|
206
|
-
};
|
|
207
|
-
},
|
|
208
|
-
template: `
|
|
209
|
-
<farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
|
|
210
|
-
|
|
211
|
-
<farm-label :required="true">Birthdate: {{ birthDate }}</farm-label>
|
|
212
|
-
<DatePicker
|
|
213
|
-
ref="birthDate"
|
|
214
|
-
inputId="form-pf-birthDate"
|
|
215
|
-
class="mt-4"
|
|
216
|
-
v-model="birthDate"
|
|
217
|
-
:readonly="true"
|
|
218
|
-
:required="true"
|
|
219
|
-
/>
|
|
220
|
-
|
|
221
|
-
<farm-label :required="true">Range: {{ rangeDate }}</farm-label>
|
|
222
|
-
<RangeDatePicker
|
|
223
|
-
ref="rangeDate"
|
|
224
|
-
inputId="form-pf-rangeDate"
|
|
225
|
-
class="mt-4"
|
|
226
|
-
v-model="rangeDate"
|
|
227
|
-
:readonly="true"
|
|
228
|
-
:required="true"
|
|
229
|
-
/>
|
|
230
|
-
|
|
231
|
-
<div class="footer" :style="[styles.footer]">
|
|
232
|
-
<farm-btn color="secondary" outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
233
|
-
<farm-btn color="secondary" :disabled="!validForm">Salvar</farm-btn>
|
|
234
|
-
</div>
|
|
235
|
-
</farm-form>
|
|
236
|
-
`,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
210
|
export const Grid = () => ({
|
|
240
211
|
data() {
|
|
241
|
-
return {
|
|
242
|
-
|
|
243
|
-
};
|
|
212
|
+
return {};
|
|
244
213
|
},
|
|
245
214
|
template: `
|
|
246
215
|
<farm-container>
|
|
@@ -257,7 +226,7 @@ export const Grid = () => ({
|
|
|
257
226
|
</farm-col>
|
|
258
227
|
<farm-col cols="12" md="3">
|
|
259
228
|
<farm-label>Label 3</farm-label>
|
|
260
|
-
<farm-textfield hint="some hint text" persistent-hint="true" />
|
|
229
|
+
<farm-textfield hint="some hint text" :persistent-hint="true" />
|
|
261
230
|
</farm-col>
|
|
262
231
|
<farm-col cols="12" md="3">
|
|
263
232
|
<farm-label>Label 4</farm-label>
|
|
@@ -290,4 +259,41 @@ export const Grid = () => ({
|
|
|
290
259
|
</farm-form>
|
|
291
260
|
</farm-container>
|
|
292
261
|
`,
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export const MigrateTextVieldV2 = () => ({
|
|
265
|
+
data() {
|
|
266
|
+
return {
|
|
267
|
+
form: {
|
|
268
|
+
document: 'Document',
|
|
269
|
+
name: 'Name',
|
|
270
|
+
},
|
|
271
|
+
validForm: false,
|
|
272
|
+
rules: {
|
|
273
|
+
required: value => !!value || 'Campo obrigatório',
|
|
274
|
+
},
|
|
275
|
+
items: [
|
|
276
|
+
{ value: null, text: '' },
|
|
277
|
+
{ value: 1, text: 'label 1' },
|
|
278
|
+
{ value: 2, text: 'label 2' },
|
|
279
|
+
],
|
|
280
|
+
styles,
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
template: `
|
|
284
|
+
<farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
|
|
285
|
+
<div>
|
|
286
|
+
<farm-label :required="true">Documento</farm-label>
|
|
287
|
+
<farm-textfield-v2 v-model="form.document" :rules="[rules.required]" />
|
|
288
|
+
</div>
|
|
289
|
+
<farm-label :required="true">Nome</farm-label>
|
|
290
|
+
<farm-textfield-v2 v-model="form.name" :rules="[rules.required]" />
|
|
291
|
+
|
|
292
|
+
<div class="footer" :style="[styles.footer]">
|
|
293
|
+
<farm-btn outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
294
|
+
<farm-btn :disabled="!validForm">Salvar</farm-btn>
|
|
295
|
+
</div>
|
|
296
|
+
form: {{ form }}
|
|
297
|
+
</farm-form>
|
|
298
|
+
`,
|
|
293
299
|
});
|
|
@@ -5,40 +5,38 @@ export default {
|
|
|
5
5
|
title: 'Form/RangeDatePicker',
|
|
6
6
|
component: RangeDatePicker,
|
|
7
7
|
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `Range I put Date Picker<br />
|
|
12
|
+
selector: <em>farm-input-rangedatepicker</em>
|
|
13
|
+
`,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
viewMode: 'docs',
|
|
17
|
+
},
|
|
18
|
+
design: {
|
|
19
|
+
type: 'figma',
|
|
20
|
+
url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1503%3A810',
|
|
21
|
+
},
|
|
8
22
|
};
|
|
9
23
|
|
|
10
24
|
export const Primary = () => ({
|
|
11
|
-
|
|
12
|
-
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
date: [],
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
template: `<div style='max-width: 320px'>
|
|
31
|
+
<RangeDatePicker inputId="input-custom-id" v-model="date" />
|
|
32
|
+
date: {{ date }}
|
|
33
|
+
</div>`,
|
|
13
34
|
});
|
|
14
35
|
|
|
15
36
|
export const Secondary = () => ({
|
|
16
|
-
components: { RangeDatePicker },
|
|
17
37
|
template: `<RangeDatePicker inputId="input-custom-id" :value="['2021-08-01', '2021-08-05']" />`,
|
|
18
38
|
});
|
|
19
39
|
|
|
20
40
|
export const MinMax = () => ({
|
|
21
|
-
components: { RangeDatePicker },
|
|
22
41
|
template: `<RangeDatePicker inputId="input-custom-id" min="2022-01-17" max="2022-02-15" />`,
|
|
23
42
|
});
|
|
24
|
-
|
|
25
|
-
const parameters = {
|
|
26
|
-
design: {
|
|
27
|
-
type: 'figma',
|
|
28
|
-
url:
|
|
29
|
-
'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%8D---Design-System?node-id=1503%3A810',
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
Primary.story = {
|
|
34
|
-
name: 'Básico',
|
|
35
|
-
parameters
|
|
36
|
-
};
|
|
37
|
-
Secondary.story = {
|
|
38
|
-
name: 'Data Inicial',
|
|
39
|
-
parameters
|
|
40
|
-
};
|
|
41
|
-
MinMax.story = {
|
|
42
|
-
name: 'Data Mínima e Máxima',
|
|
43
|
-
parameters
|
|
44
|
-
};
|
|
@@ -9,18 +9,15 @@
|
|
|
9
9
|
offset-y
|
|
10
10
|
min-width="290px"
|
|
11
11
|
>
|
|
12
|
-
<template v-slot:activator="{
|
|
13
|
-
<
|
|
14
|
-
color="secondary"
|
|
12
|
+
<template v-slot:activator="{}">
|
|
13
|
+
<farm-textfield-v2
|
|
15
14
|
v-model="fieldRange"
|
|
16
|
-
|
|
15
|
+
icon="calendar"
|
|
17
16
|
readonly
|
|
18
|
-
v-on="on"
|
|
19
|
-
outlined
|
|
20
|
-
dense
|
|
21
17
|
:id="inputId"
|
|
22
18
|
:rules="required ? [requiredRule] : []"
|
|
23
|
-
|
|
19
|
+
@click="menuField = true"
|
|
20
|
+
/>
|
|
24
21
|
</template>
|
|
25
22
|
<v-date-picker
|
|
26
23
|
v-if="menuField"
|
|
@@ -45,7 +42,6 @@
|
|
|
45
42
|
</template>
|
|
46
43
|
<script>
|
|
47
44
|
import Vue from 'vue';
|
|
48
|
-
import { VTextField } from 'vuetify/lib/components/VTextField';
|
|
49
45
|
import { VMenu } from 'vuetify/lib/components/VMenu';
|
|
50
46
|
import { VDatePicker } from 'vuetify/lib/components/VDatePicker';
|
|
51
47
|
import DefaultButton from '../Buttons/DefaultButton';
|
|
@@ -56,7 +52,6 @@ import { defaultFormat as dateDefaultFormatter } from '../../helpers/date';
|
|
|
56
52
|
export default Vue.extend({
|
|
57
53
|
name: 'farm-input-rangedatepicker',
|
|
58
54
|
components: {
|
|
59
|
-
VTextField,
|
|
60
55
|
VMenu,
|
|
61
56
|
VDatePicker,
|
|
62
57
|
'farm-btn': DefaultButton,
|
|
@@ -150,10 +145,7 @@ export default Vue.extend({
|
|
|
150
145
|
},
|
|
151
146
|
},
|
|
152
147
|
canConfirm() {
|
|
153
|
-
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
148
|
+
return !this.dateField || this.dateField.length == 1;
|
|
157
149
|
},
|
|
158
150
|
},
|
|
159
151
|
});
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="farm-resource-metainfo">
|
|
3
3
|
<div v-if="showCreate">
|
|
4
|
-
<farm-icon color="gray" size="
|
|
5
|
-
<farm-caption color="gray"
|
|
6
|
-
|
|
7
|
-
<farm-caption color="gray" variation="medium" tag="span">
|
|
8
|
-
formattedCreatedAt
|
|
9
|
-
|
|
4
|
+
<farm-icon color="gray" size="sm">calendar-blank</farm-icon>
|
|
5
|
+
<farm-caption color="gray" variation="regular">
|
|
6
|
+
Data de cadastro:
|
|
7
|
+
<farm-caption color="gray" variation="medium" tag="span">
|
|
8
|
+
{{ formattedCreatedAt }}
|
|
9
|
+
</farm-caption>
|
|
10
10
|
</farm-caption>
|
|
11
11
|
</div>
|
|
12
12
|
<div v-if="showUpdate">
|
|
13
|
-
<farm-icon color="gray" size="
|
|
13
|
+
<farm-icon color="gray" size="sm">history</farm-icon>
|
|
14
14
|
|
|
15
|
-
<farm-caption color="gray"
|
|
16
|
-
|
|
17
|
-
<farm-caption color="gray" variation="medium" tag="span">
|
|
18
|
-
formattedUsername
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<farm-caption color="gray" variation="medium" tag="span">
|
|
22
|
-
formattedUpdatedAt
|
|
23
|
-
|
|
15
|
+
<farm-caption color="gray" variation="regular">
|
|
16
|
+
Última atualização feita por
|
|
17
|
+
<farm-caption color="gray" variation="medium" tag="span">
|
|
18
|
+
{{ formattedUsername }}
|
|
19
|
+
</farm-caption>
|
|
20
|
+
, dia
|
|
21
|
+
<farm-caption color="gray" variation="medium" tag="span">
|
|
22
|
+
{{ formattedUpdatedAt }}
|
|
23
|
+
</farm-caption>
|
|
24
24
|
às
|
|
25
|
-
<farm-caption color="gray" variation="medium" tag="span">
|
|
26
|
-
formattedUpdatedHours
|
|
27
|
-
|
|
25
|
+
<farm-caption color="gray" variation="medium" tag="span">
|
|
26
|
+
{{ formattedUpdatedHours }}
|
|
27
|
+
</farm-caption>
|
|
28
28
|
</farm-caption>
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
</template>
|
|
32
32
|
<script lang="ts">
|
|
33
33
|
import Vue, { computed, PropType, toRefs } from 'vue';
|
|
34
|
-
import Icon from '../Icon';
|
|
35
|
-
import { Caption } from '../Typography';
|
|
36
34
|
|
|
37
35
|
interface ResourceMetaInfoProps {
|
|
38
36
|
createdAt: string;
|
|
@@ -43,19 +41,24 @@ interface ResourceMetaInfoProps {
|
|
|
43
41
|
|
|
44
42
|
export default Vue.extend({
|
|
45
43
|
name: 'farm-resource-metainfo',
|
|
46
|
-
components: {
|
|
47
|
-
'farm-icon': Icon,
|
|
48
|
-
'farm-caption': Caption,
|
|
49
|
-
},
|
|
50
44
|
props: {
|
|
45
|
+
/**
|
|
46
|
+
* Object with the metadata information
|
|
47
|
+
*/
|
|
51
48
|
infos: {
|
|
52
49
|
required: true,
|
|
53
50
|
type: Object as PropType<ResourceMetaInfoProps>,
|
|
54
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* Show create metadata info if empty?
|
|
54
|
+
*/
|
|
55
55
|
showEmptyCreate: {
|
|
56
56
|
type: Boolean,
|
|
57
57
|
default: false,
|
|
58
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* Show update metadata info if empty?
|
|
61
|
+
*/
|
|
59
62
|
showEmptyUpdate: {
|
|
60
63
|
type: Boolean,
|
|
61
64
|
default: false,
|
|
@@ -77,11 +80,8 @@ export default Vue.extend({
|
|
|
77
80
|
);
|
|
78
81
|
|
|
79
82
|
const formattedCreatedAt = computed(() => infos.value.createdAt || 'N/A');
|
|
80
|
-
|
|
81
83
|
const formattedUpdatedAt = computed(() => infos.value.updatedAt || 'N/A');
|
|
82
|
-
|
|
83
84
|
const formattedUsername = computed(() => infos.value.username || 'N/A');
|
|
84
|
-
|
|
85
85
|
const formattedUpdatedHours = computed(() => infos.value.updatedHours || 'N/A');
|
|
86
86
|
|
|
87
87
|
return {
|
|
@@ -96,5 +96,5 @@ export default Vue.extend({
|
|
|
96
96
|
});
|
|
97
97
|
</script>
|
|
98
98
|
<style lang="scss" scoped>
|
|
99
|
-
@import 'ResourceMetaInfo
|
|
99
|
+
@import 'ResourceMetaInfo';
|
|
100
100
|
</style>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.farm-textfield {
|
|
2
2
|
height: 64px;
|
|
3
|
+
|
|
3
4
|
&--input {
|
|
4
5
|
display: flex;
|
|
5
6
|
align-items: center;
|
|
@@ -11,19 +12,30 @@
|
|
|
11
12
|
padding: 8px;
|
|
12
13
|
margin-bottom: 4px;
|
|
13
14
|
|
|
14
|
-
>
|
|
15
|
+
>button {
|
|
15
16
|
display: flex;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
&>input {
|
|
19
20
|
flex: 1;
|
|
20
21
|
outline: none;
|
|
21
|
-
color: var(--farm-
|
|
22
|
+
color: var(--farm-text-primary);
|
|
22
23
|
font-size: 12px;
|
|
23
24
|
font-weight: 400;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
width: 100%;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&--disabled {
|
|
32
|
+
input {
|
|
33
|
+
color: var(--farm-gray-base);
|
|
34
|
+
}
|
|
35
|
+
.farm-icon {
|
|
36
|
+
color: var(--farm-gray-lighten);
|
|
37
|
+
cursor: default;
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
.farm-caption {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
'farm-textfield--touched': isTouched,
|
|
8
8
|
'farm-textfield--blured': isBlured,
|
|
9
9
|
'farm-textfield--error': hasError,
|
|
10
|
+
'farm-textfield--disabled': disabled,
|
|
10
11
|
}"
|
|
11
12
|
>
|
|
12
13
|
<div class="farm-textfield--input">
|
|
@@ -20,9 +21,10 @@
|
|
|
20
21
|
<input
|
|
21
22
|
v-bind="$attrs"
|
|
22
23
|
v-model="innerValue"
|
|
23
|
-
v-mask="mask"
|
|
24
|
+
v-mask="mask"
|
|
24
25
|
:disabled="disabled"
|
|
25
26
|
:readonly="readonly"
|
|
27
|
+
@click="$emit('click')"
|
|
26
28
|
@keyup="onKeyUp"
|
|
27
29
|
@blur="onBlur"
|
|
28
30
|
/>
|
|
@@ -34,7 +36,6 @@
|
|
|
34
36
|
<farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
|
|
35
37
|
</button>
|
|
36
38
|
</div>
|
|
37
|
-
|
|
38
39
|
<farm-caption v-if="showErrorText" color="error" variation="regular">
|
|
39
40
|
{{ errorBucket[0] }}
|
|
40
41
|
</farm-caption>
|