@farm-investimentos/front-mfe-components 11.5.1 → 11.5.3
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 +222 -495
- 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 +222 -495
- 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/ContextMenu/ContextMenu.vue +8 -2
- package/src/components/CopyToClipboard/CopyToClipboard.stories.js +9 -1
- package/src/components/CopyToClipboard/CopyToClipboard.vue +10 -3
- 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 +2 -2
- package/src/components/TextFieldV2/TextFieldV2.vue +12 -4
- package/src/scss/FormOverrides.scss +50 -1
package/package.json
CHANGED
|
@@ -84,7 +84,6 @@ export default Vue.extend({
|
|
|
84
84
|
}
|
|
85
85
|
window.addEventListener('click', outClick);
|
|
86
86
|
window.addEventListener('resize', resizeWindowHandler);
|
|
87
|
-
|
|
88
87
|
calculatePosition();
|
|
89
88
|
} else {
|
|
90
89
|
window.removeEventListener('click', outClick);
|
|
@@ -105,17 +104,23 @@ export default Vue.extend({
|
|
|
105
104
|
|
|
106
105
|
let offsetLeft = activatorBoundingClientRect.left;
|
|
107
106
|
if (popupClientRect.width > activatorBoundingClientRect.width) {
|
|
107
|
+
const w = popupClientRect.width < 96 ? 96 : popupClientRect.width;
|
|
108
108
|
offsetLeft =
|
|
109
|
-
|
|
109
|
+
activatorBoundingClientRect.left +
|
|
110
|
+
activatorBoundingClientRect.width / 2 -
|
|
111
|
+
w / 2;
|
|
110
112
|
}
|
|
113
|
+
|
|
111
114
|
styles.minWidth =
|
|
112
115
|
(activatorBoundingClientRect.width > 96
|
|
113
116
|
? parseInt(activatorBoundingClientRect.width)
|
|
114
117
|
: 96) + 'px';
|
|
115
118
|
|
|
116
119
|
//Do not allow to open outside window
|
|
120
|
+
|
|
117
121
|
const rightEdge = offsetLeft + popupClientRect.width;
|
|
118
122
|
const clientWidth = document.documentElement.clientWidth;
|
|
123
|
+
|
|
119
124
|
if (rightEdge > clientWidth - 12) {
|
|
120
125
|
offsetLeft = clientWidth - 12 - popupClientRect.width;
|
|
121
126
|
}
|
|
@@ -126,6 +131,7 @@ export default Vue.extend({
|
|
|
126
131
|
offsetTop -= bottomEdge - window.scrollY - clientHeight + 12;
|
|
127
132
|
}
|
|
128
133
|
|
|
134
|
+
|
|
129
135
|
styles.top = `${offsetTop}px`;
|
|
130
136
|
styles.left = `${offsetLeft}px`;
|
|
131
137
|
styles.zIndex = calculateMainZindex();
|
|
@@ -9,7 +9,8 @@ export default {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component: `CopyToClipboard<br />
|
|
12
|
-
selector: <em>farm-copytobclipboard</em
|
|
12
|
+
selector: <em>farm-copytobclipboard</em><br />
|
|
13
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
13
14
|
`,
|
|
14
15
|
},
|
|
15
16
|
},
|
|
@@ -30,3 +31,10 @@ export const NoIcon = () => ({
|
|
|
30
31
|
<farm-copytoclipboard toCopy="To be copied" :isIcon="false" />
|
|
31
32
|
</div>`,
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
export const CustomSuccessMessage = () => ({
|
|
36
|
+
components: { 'farm-copytoclipboard': CopyToClipboard },
|
|
37
|
+
template: `<div style="max-width: 480px; padding-top: 80px; padding-left: 80px;">
|
|
38
|
+
<farm-copytoclipboard toCopy="To be copied" success-message="Custom Succes Message" />
|
|
39
|
+
</div>`,
|
|
40
|
+
});
|
|
@@ -28,18 +28,25 @@ export default Vue.extend({
|
|
|
28
28
|
* Is button with icon?
|
|
29
29
|
*/
|
|
30
30
|
isIcon: { type: Boolean, default: true },
|
|
31
|
+
/**
|
|
32
|
+
* Success message content after copy
|
|
33
|
+
*/
|
|
34
|
+
successMessage: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'Conteúdo copiado para a área de trabalho',
|
|
37
|
+
},
|
|
31
38
|
},
|
|
32
39
|
setup(props) {
|
|
33
40
|
const show = ref(false);
|
|
34
41
|
const feedbackMessage = ref('');
|
|
35
42
|
const disabled = ref(false);
|
|
36
|
-
const { toCopy, isIcon } = toRefs(props);
|
|
43
|
+
const { toCopy, isIcon, successMessage } = toRefs(props);
|
|
37
44
|
|
|
38
45
|
const onClick = async () => {
|
|
39
46
|
disabled.value = true;
|
|
40
47
|
try {
|
|
41
48
|
await toClipboard(toCopy.value);
|
|
42
|
-
feedbackMessage.value =
|
|
49
|
+
feedbackMessage.value = successMessage.value;
|
|
43
50
|
} catch (e) {
|
|
44
51
|
feedbackMessage.value = 'Ocorreu um erro: ' + e;
|
|
45
52
|
}
|
|
@@ -48,7 +55,7 @@ export default Vue.extend({
|
|
|
48
55
|
setTimeout(() => {
|
|
49
56
|
show.value = false;
|
|
50
57
|
disabled.value = false;
|
|
51
|
-
},
|
|
58
|
+
}, 2000);
|
|
52
59
|
};
|
|
53
60
|
|
|
54
61
|
return {
|
|
@@ -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: {
|
|
@@ -203,11 +203,11 @@ export const Mask = () => ({
|
|
|
203
203
|
},
|
|
204
204
|
template: `<div style="width: 480px">
|
|
205
205
|
<farm-label>CPF Mask ({{ mask }})</farm-label>
|
|
206
|
-
<farm-textfield-v2 v-model="v" :
|
|
206
|
+
<farm-textfield-v2 v-model="v" :mask="mask" />
|
|
207
207
|
v-model: {{ v }}
|
|
208
208
|
|
|
209
209
|
<farm-label>Number Mask (R$ ##.###.###,##)</farm-label>
|
|
210
|
-
<farm-textfield-v2 v-model="v2" :
|
|
210
|
+
<farm-textfield-v2 v-model="v2" :mask="currencyMask" />
|
|
211
211
|
v-model: {{ v2 }}
|
|
212
212
|
|
|
213
213
|
</div>`,
|
|
@@ -10,19 +10,27 @@
|
|
|
10
10
|
}"
|
|
11
11
|
>
|
|
12
12
|
<div class="farm-textfield--input">
|
|
13
|
-
<button
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
v-if="icon && iconPosition === 'left'"
|
|
16
|
+
@click="$emit('onClickIcon')"
|
|
17
|
+
>
|
|
14
18
|
<farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
|
|
15
19
|
</button>
|
|
16
20
|
<input
|
|
17
21
|
v-bind="$attrs"
|
|
18
22
|
v-model="innerValue"
|
|
19
|
-
v-mask="
|
|
23
|
+
v-mask="mask"
|
|
20
24
|
:disabled="disabled"
|
|
21
25
|
:readonly="readonly"
|
|
22
26
|
@keyup="onKeyUp"
|
|
23
27
|
@blur="onBlur"
|
|
24
28
|
/>
|
|
25
|
-
<button
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
v-if="icon && iconPosition === 'right'"
|
|
32
|
+
@click="$emit('onClickIcon')"
|
|
33
|
+
>
|
|
26
34
|
<farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
|
|
27
35
|
</button>
|
|
28
36
|
</div>
|
|
@@ -95,7 +103,7 @@ export default Vue.extend({
|
|
|
95
103
|
/**
|
|
96
104
|
* Mask
|
|
97
105
|
*/
|
|
98
|
-
|
|
106
|
+
mask: {
|
|
99
107
|
default: '',
|
|
100
108
|
type: [String, Function],
|
|
101
109
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
&.v-input {
|
|
13
|
-
&.v-
|
|
13
|
+
&.v-text-field.v-text-field--outlined {
|
|
14
14
|
.v-input__slot {
|
|
15
15
|
min-height: 36px !important;
|
|
16
16
|
height: 36px;
|
|
@@ -22,6 +22,15 @@
|
|
|
22
22
|
.v-select__selection {
|
|
23
23
|
font-size: 0.75rem;
|
|
24
24
|
}
|
|
25
|
+
.v-input__append-inner {
|
|
26
|
+
margin-top: 8px;
|
|
27
|
+
}
|
|
28
|
+
.v-input__prepend-inner {
|
|
29
|
+
margin-top: 8px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.v-input__prepend-outer {
|
|
33
|
+
margin-top: 8px;
|
|
25
34
|
}
|
|
26
35
|
&.v-input--is-label-active.v-input--is-focused {
|
|
27
36
|
.v-input__slot fieldset {
|
|
@@ -154,3 +163,43 @@
|
|
|
154
163
|
}
|
|
155
164
|
}
|
|
156
165
|
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
//temporary solution for v-data-table checkboxes
|
|
169
|
+
.v-data-table__checkbox.v-simple-checkbox {
|
|
170
|
+
.v-icon.v-icon {
|
|
171
|
+
font-size: 22px;
|
|
172
|
+
color: var(--farm-neutral-darken);
|
|
173
|
+
&.mdi-checkbox-marked,
|
|
174
|
+
&.mdi-minus-box {
|
|
175
|
+
color: var(--farm-primary-base);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
.v-input--selection-controls__ripple {
|
|
179
|
+
display: none;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.v-list.v-select-list.v-sheet.theme--light.v-list--dense.theme--light {
|
|
184
|
+
|
|
185
|
+
.v-list-item.v-list-item--link {
|
|
186
|
+
padding: 8px 12px;
|
|
187
|
+
height: 36px;
|
|
188
|
+
border-bottom: none;
|
|
189
|
+
&:hover {
|
|
190
|
+
background-color: var(--farm-primary-lighten);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
.v-list-item .v-list-item__content {
|
|
194
|
+
padding: 0;
|
|
195
|
+
}
|
|
196
|
+
.v-list-item__title {
|
|
197
|
+
font-weight: 700;
|
|
198
|
+
font-size: 12px;
|
|
199
|
+
color: var(--farm-text-primary);
|
|
200
|
+
line-height: 12px;
|
|
201
|
+
}
|
|
202
|
+
.v-list-item__action:first-child {
|
|
203
|
+
margin-right: 16px;
|
|
204
|
+
}
|
|
205
|
+
}
|