@farm-investimentos/front-mfe-components 11.5.1 → 11.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 +158 -440
- 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 +158 -440
- 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/DialogFooter/DialogFooter.stories.js +11 -1
- package/src/components/DialogFooter/DialogFooter.vue +3 -0
- package/src/components/Form/Form.vue +16 -3
- package/src/components/Label/Label.stories.js +18 -1
- package/src/components/Label/Label.vue +1 -1
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +11 -5
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.vue +8 -23
- package/src/components/TextFieldV2/TextFieldV2.stories.js +5 -0
package/package.json
CHANGED
|
@@ -3,10 +3,20 @@ import DialogFooter from './DialogFooter.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Display/Dialog/DialogFooter',
|
|
5
5
|
component: DialogFooter,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `DialogFooter<br />
|
|
10
|
+
selector: <em>farm-dialog-footer</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
12
|
+
`,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
viewMode: 'docs',
|
|
16
|
+
},
|
|
6
17
|
};
|
|
7
18
|
|
|
8
19
|
export const Primary = () => ({
|
|
9
|
-
components: { 'farm-dialog-footer': DialogFooter },
|
|
10
20
|
template: '<farm-dialog-footer />',
|
|
11
21
|
});
|
|
12
22
|
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
<farm-btn v-if="hasCancel" color="primary" outlined @click="$emit('onClose')">
|
|
4
4
|
{{ closeLabel }}
|
|
5
5
|
</farm-btn>
|
|
6
|
+
|
|
6
7
|
<farm-btn
|
|
7
8
|
v-for="button in extraButtons"
|
|
8
9
|
:key="button.label"
|
|
9
10
|
:color="button.color"
|
|
10
11
|
:outlined="button.outlined"
|
|
11
12
|
:disabled="button.disabled"
|
|
13
|
+
:title="button.label"
|
|
12
14
|
@click="$emit(button.listener ? button.listener : '')"
|
|
13
15
|
>
|
|
14
16
|
{{ button.label }}
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
v-if="hasConfirm"
|
|
18
20
|
:color="confirmColor"
|
|
19
21
|
:disabled="isConfirmDisabled"
|
|
22
|
+
:title="confirmLabel"
|
|
20
23
|
@click="$emit('onConfirm')"
|
|
21
24
|
>
|
|
22
25
|
<farm-icon v-if="confirmIcon">{{ confirmIcon }}</farm-icon>
|
|
@@ -14,8 +14,9 @@ export default Vue.extend({
|
|
|
14
14
|
inheritAttrs: true,
|
|
15
15
|
setup(props, { emit }) {
|
|
16
16
|
const innerValue = ref(props.value);
|
|
17
|
-
|
|
17
|
+
let errorsBag = reactive({} as ErrorsBag);
|
|
18
18
|
let validationFields = [];
|
|
19
|
+
const instance = getCurrentInstance().proxy;
|
|
19
20
|
|
|
20
21
|
const dispatchError = () => {
|
|
21
22
|
const keys = Object.keys(errorsBag);
|
|
@@ -42,7 +43,7 @@ export default Vue.extend({
|
|
|
42
43
|
|
|
43
44
|
const recursiveFormField = $node => {
|
|
44
45
|
$node.$children.forEach($leaf => {
|
|
45
|
-
if($leaf.validate) {
|
|
46
|
+
if ($leaf.validate) {
|
|
46
47
|
validationFields.push($leaf);
|
|
47
48
|
} else if ($leaf.$children.length > 1) {
|
|
48
49
|
recursiveFormField($leaf);
|
|
@@ -57,16 +58,28 @@ export default Vue.extend({
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
onMounted(() => {
|
|
60
|
-
|
|
61
|
+
validationFields = [];
|
|
62
|
+
recursiveFormField(instance);
|
|
61
63
|
validationFields.forEach(field => {
|
|
62
64
|
watchInput(field);
|
|
63
65
|
});
|
|
64
66
|
});
|
|
65
67
|
|
|
68
|
+
const restartValidation = () => {
|
|
69
|
+
validationFields = [];
|
|
70
|
+
errorsBag = {};
|
|
71
|
+
recursiveFormField(instance);
|
|
72
|
+
validationFields.forEach(field => {
|
|
73
|
+
watchInput(field);
|
|
74
|
+
field.validate();
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
66
78
|
return {
|
|
67
79
|
innerValue,
|
|
68
80
|
errorsBag,
|
|
69
81
|
reset,
|
|
82
|
+
restartValidation,
|
|
70
83
|
};
|
|
71
84
|
},
|
|
72
85
|
});
|
|
@@ -25,5 +25,22 @@ export const Primary = () => ({
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
export const Required = () => ({
|
|
28
|
-
template:
|
|
28
|
+
template: `<div>
|
|
29
|
+
<farm-label :required="true">Label</farm-label>
|
|
30
|
+
<farm-label required>Label</farm-label>
|
|
31
|
+
</div>`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const Tooltip = () => ({
|
|
35
|
+
template: `<div>
|
|
36
|
+
<farm-label required>
|
|
37
|
+
Label with tooltip
|
|
38
|
+
<farm-tooltip>
|
|
39
|
+
this is the tooltip!
|
|
40
|
+
<template v-slot:activator="{ on, attrs }">
|
|
41
|
+
<farm-icon size="sm" color="gray">help-circle</farm-icon>
|
|
42
|
+
</template>
|
|
43
|
+
</farm-tooltip>
|
|
44
|
+
</farm-label>
|
|
45
|
+
</div>`,
|
|
29
46
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import PromptUserToConfirm from './PromptUserToConfirm';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
title: '
|
|
4
|
+
title: 'Interactions/PromptUserToConfirm',
|
|
5
5
|
component: PromptUserToConfirm,
|
|
6
6
|
parameters: {
|
|
7
7
|
viewMode: 'docs',
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component: `Prompt User to Confirm<br />
|
|
11
|
-
selector: <em>farm-promptusertoconfirm</em
|
|
11
|
+
selector: <em>farm-promptusertoconfirm</em><br />
|
|
12
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>`,
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
},
|
|
@@ -17,7 +18,7 @@ export default {
|
|
|
17
18
|
export const Primary = () => ({
|
|
18
19
|
data() {
|
|
19
20
|
return {
|
|
20
|
-
model:
|
|
21
|
+
model: false,
|
|
21
22
|
};
|
|
22
23
|
},
|
|
23
24
|
template: `<div style="max-width: 320px"><farm-promptusertoconfirm v-model="model"/>
|
|
@@ -26,13 +27,18 @@ export const Primary = () => ({
|
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
export const CustomTitle = () => ({
|
|
29
|
-
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
model: false,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
template: '<div style="max-width: 320px"><farm-promptusertoconfirm title="Custom" v-model="model" /></div>',
|
|
30
36
|
});
|
|
31
37
|
|
|
32
38
|
export const CustomMatchInput = () => ({
|
|
33
39
|
data() {
|
|
34
40
|
return {
|
|
35
|
-
model:
|
|
41
|
+
model: false,
|
|
36
42
|
};
|
|
37
43
|
},
|
|
38
44
|
template: `<div style="max-width: 320px">
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<farm-form v-model="formVal" autocomplete="off">
|
|
3
3
|
<farm-caption v-html="title" color="gray" />
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
outlined
|
|
11
|
-
dense
|
|
12
|
-
:rules="[rules.checkRemove]"
|
|
13
|
-
></v-text-field>
|
|
14
|
-
</v-col>
|
|
15
|
-
</v-row>
|
|
16
|
-
</v-form>
|
|
4
|
+
<farm-textfield-v2
|
|
5
|
+
v-model="matchInput"
|
|
6
|
+
class="mt-3"
|
|
7
|
+
:rules="[rules.checkRemove]"
|
|
8
|
+
></farm-textfield-v2>
|
|
9
|
+
</farm-form>
|
|
17
10
|
</template>
|
|
18
11
|
<script lang="ts">
|
|
19
12
|
import Vue from 'vue';
|
|
20
|
-
import { VForm } from 'vuetify/lib/components/VForm';
|
|
21
|
-
import { VTextField } from 'vuetify/lib/components/VTextField';
|
|
22
|
-
import { VRow, VCol } from 'vuetify/lib/components/VGrid';
|
|
23
13
|
export default Vue.extend({
|
|
24
14
|
name: 'farm-promptusertoconfirm',
|
|
25
15
|
props: {
|
|
@@ -35,6 +25,7 @@ export default Vue.extend({
|
|
|
35
25
|
*/
|
|
36
26
|
value: {
|
|
37
27
|
required: true,
|
|
28
|
+
type: Boolean,
|
|
38
29
|
},
|
|
39
30
|
/**
|
|
40
31
|
* Title
|
|
@@ -44,12 +35,6 @@ export default Vue.extend({
|
|
|
44
35
|
default: 'Escreva no campo abaixo "EXCLUIR" para confirmar a exclusão.',
|
|
45
36
|
},
|
|
46
37
|
},
|
|
47
|
-
components: {
|
|
48
|
-
VForm,
|
|
49
|
-
VTextField,
|
|
50
|
-
VRow,
|
|
51
|
-
VCol,
|
|
52
|
-
},
|
|
53
38
|
data() {
|
|
54
39
|
return {
|
|
55
40
|
rules: {
|
|
@@ -73,8 +73,10 @@ export const Validate = () => ({
|
|
|
73
73
|
v2: '',
|
|
74
74
|
v3: '',
|
|
75
75
|
v4: '',
|
|
76
|
+
v5: '',
|
|
76
77
|
rules: {
|
|
77
78
|
required: value => !!value || 'Required field',
|
|
79
|
+
requiredNoMessage: value => !!value || '',
|
|
78
80
|
email: v =>
|
|
79
81
|
!v ||
|
|
80
82
|
/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) ||
|
|
@@ -86,6 +88,9 @@ export const Validate = () => ({
|
|
|
86
88
|
<farm-label required>Required field</farm-label>
|
|
87
89
|
<farm-textfield-v2 v-model="v1" :rules="[rules.required]" />
|
|
88
90
|
|
|
91
|
+
<farm-label required>Required field no message</farm-label>
|
|
92
|
+
<farm-textfield-v2 v-model="v5" :rules="[rules.requiredNoMessage]" />
|
|
93
|
+
|
|
89
94
|
<farm-label>E-mail</farm-label>
|
|
90
95
|
<farm-textfield-v2 v-model="v2" :rules="[rules.email]" />
|
|
91
96
|
|