@farm-investimentos/front-mfe-components-vue3 0.2.1 → 0.3.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 +37 -20
- 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 +37 -20
- 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 +12 -0
- package/src/components/DatePicker/DatePicker.vue +6 -1
- package/src/components/DatePicker/customDatePicker.scss +4 -0
- package/src/components/DialogFooter/DialogFooter.scss +1 -1
- package/src/components/Modal/Modal.stories.js +2 -0
- package/src/components/ProgressBar/ProgressBar.scss +21 -1
- package/src/components/ProgressBar/ProgressBar.stories.js +9 -0
- package/src/components/ProgressBar/ProgressBar.vue +18 -4
- package/src/examples/Dialog.stories.js +37 -1
- package/src/plugins/DialogPrompt/index.ts +2 -1
- package/src/plugins/DialogPrompt/utils/bootstrap.ts +10 -2
- package/src/stories/Introduction.stories.mdx +1 -1
package/package.json
CHANGED
|
@@ -131,4 +131,16 @@ export const CenterPositioned = () => ({
|
|
|
131
131
|
<farm-input-datepicker inputId="input-custom-id-0" v-model="date" position="center" />
|
|
132
132
|
{{ date }}
|
|
133
133
|
</div>`,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export const RequiredMessage = () => ({
|
|
137
|
+
data() {
|
|
138
|
+
return {
|
|
139
|
+
date: '',
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
template: `<div style='max-width: 320px'>
|
|
143
|
+
<farm-input-datepicker inputId="input-custom-id-10" v-model="date" requiredMessage="Preencha a data de forma correta." :required="true" />
|
|
144
|
+
date: {{ date }}
|
|
145
|
+
</div>`,
|
|
134
146
|
});
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
ref="inputCalendar"
|
|
59
59
|
:readonly="readonly"
|
|
60
60
|
:mask="`${readonly ? '' : '##/##/####'}`"
|
|
61
|
+
:requiredMessage="requiredMessage"
|
|
61
62
|
:id="inputId"
|
|
62
63
|
:rules="[checkDateValid, checkMax, checkMin, checkRequire]"
|
|
63
64
|
@keyup="keyUpInput"
|
|
@@ -136,6 +137,10 @@ export default {
|
|
|
136
137
|
type: Boolean,
|
|
137
138
|
default: false,
|
|
138
139
|
},
|
|
140
|
+
requiredMessage: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: 'Campo obrigatório'
|
|
143
|
+
}
|
|
139
144
|
},
|
|
140
145
|
data() {
|
|
141
146
|
return {
|
|
@@ -150,7 +155,7 @@ export default {
|
|
|
150
155
|
return true;
|
|
151
156
|
},
|
|
152
157
|
checkRequire: value => {
|
|
153
|
-
return this.required ? !!value || value != '' ||
|
|
158
|
+
return this.required ? !!value || value != '' || this.requiredMessage : true;
|
|
154
159
|
},
|
|
155
160
|
checkMax: value => {
|
|
156
161
|
if (!this.required && value.length === 0) {
|
|
@@ -6,8 +6,9 @@ $radius: 5px;
|
|
|
6
6
|
width: 100%;
|
|
7
7
|
height: 5px;
|
|
8
8
|
border-radius: $radius;
|
|
9
|
+
overflow: hidden;
|
|
9
10
|
|
|
10
|
-
>
|
|
11
|
+
>div {
|
|
11
12
|
border-radius: $radius;
|
|
12
13
|
height: 100%;
|
|
13
14
|
}
|
|
@@ -22,4 +23,23 @@ $radius: 5px;
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.farm-progressbar--infinite {
|
|
29
|
+
animation: indeterminateAnimation 1s infinite linear;
|
|
30
|
+
transform-origin: 0% 50%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes indeterminateAnimation {
|
|
34
|
+
0% {
|
|
35
|
+
transform: translateX(0) scaleX(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
40% {
|
|
39
|
+
transform: translateX(0) scaleX(0.4);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
100% {
|
|
43
|
+
transform: translateX(100%) scaleX(0.5);
|
|
44
|
+
}
|
|
25
45
|
}
|
|
@@ -47,3 +47,12 @@ export const CustomHexaColors = () => ({
|
|
|
47
47
|
},
|
|
48
48
|
template: '<farm-progressbar :value="val" background-color="#FFFF00" value-color="#00FF00" />',
|
|
49
49
|
});
|
|
50
|
+
|
|
51
|
+
export const IndeterminateAnimation = () => ({
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
val: 35,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
template: '<farm-progressbar indeterminate :value="val" background-color="#FFFF00" value-color="#00FF00" />',
|
|
58
|
+
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
:class="classes"
|
|
4
|
+
:style="containerStyle"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
:class="{ 'farm-progressbar--infinite': indeterminate }"
|
|
8
|
+
:style="valueStyle"
|
|
9
|
+
></div>
|
|
4
10
|
</div>
|
|
5
11
|
</template>
|
|
6
12
|
|
|
@@ -57,10 +63,17 @@ export default {
|
|
|
57
63
|
type: Number,
|
|
58
64
|
required: true,
|
|
59
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Indeterminate
|
|
68
|
+
*/
|
|
69
|
+
indeterminate: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
60
73
|
},
|
|
61
74
|
|
|
62
75
|
setup(props) {
|
|
63
|
-
const { backgroundColor, valueColor, value } = toRefs(props);
|
|
76
|
+
const { backgroundColor, valueColor, value, indeterminate } = toRefs(props);
|
|
64
77
|
|
|
65
78
|
const classes = computed(() => {
|
|
66
79
|
const obj = {};
|
|
@@ -80,8 +93,9 @@ export default {
|
|
|
80
93
|
|
|
81
94
|
const valueStyle = computed(() => {
|
|
82
95
|
const obj = {
|
|
83
|
-
width: `${value.value}%`,
|
|
96
|
+
width: indeterminate.value ? '100%' : `${value.value}%`,
|
|
84
97
|
};
|
|
98
|
+
|
|
85
99
|
if (valueColor.value.startsWith('#')) {
|
|
86
100
|
obj['background-color'] = valueColor.value;
|
|
87
101
|
}
|
|
@@ -126,4 +126,40 @@ export const CustomHtml = () => ({
|
|
|
126
126
|
Open
|
|
127
127
|
</farm-btn>
|
|
128
128
|
</div>`,
|
|
129
|
-
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const OpenTwice = () => ({
|
|
132
|
+
methods: {
|
|
133
|
+
openDialog() {
|
|
134
|
+
this.$dialog.confirm(
|
|
135
|
+
{
|
|
136
|
+
title: 'Dialog title',
|
|
137
|
+
body: 'Dialog content',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
html: true,
|
|
141
|
+
okText: 'OK',
|
|
142
|
+
cancelText: 'Cancel',
|
|
143
|
+
}
|
|
144
|
+
).finally( () => {});
|
|
145
|
+
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
this.$dialog.alert(
|
|
148
|
+
{
|
|
149
|
+
title: 'Dialog title',
|
|
150
|
+
body: 'Dialog content',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
html: true,
|
|
154
|
+
okText: 'Cancel',
|
|
155
|
+
}
|
|
156
|
+
).finally( () => {});
|
|
157
|
+
}, 2000);
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
161
|
+
<farm-btn @click="openDialog">
|
|
162
|
+
Open
|
|
163
|
+
</farm-btn>
|
|
164
|
+
</div>`,
|
|
165
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import calculateMainZindex from '../../helpers/calculateMainZindex';
|
|
2
1
|
import { bootstrap, modalFooter, modalHeader } from './utils';
|
|
3
2
|
|
|
3
|
+
import calculateMainZindex from '../../helpers/calculateMainZindex';
|
|
4
|
+
|
|
4
5
|
export interface IDialogPromptOptions {
|
|
5
6
|
title: string;
|
|
6
7
|
body: string;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
const DIALOG_ID = 'farm-dialog-prompt-identifier';
|
|
2
|
+
const OVERLAY_CLASS = 'farm-modal--overlay';
|
|
3
|
+
const CONTAINER_CLASS = 'farm-modal--container';
|
|
2
4
|
|
|
3
5
|
export default function (): { container: HTMLElement; backdrop: HTMLElement; modal: HTMLElement } {
|
|
4
6
|
let container;
|
|
5
7
|
if (document.getElementById(DIALOG_ID)) {
|
|
6
8
|
container = document.getElementById(DIALOG_ID);
|
|
9
|
+
if(document.getElementsByClassName(OVERLAY_CLASS).length > 0) {
|
|
10
|
+
container.removeChild(document.getElementsByClassName(OVERLAY_CLASS)[0]);
|
|
11
|
+
}
|
|
12
|
+
if(document.getElementsByClassName(CONTAINER_CLASS).length > 0) {
|
|
13
|
+
container.removeChild(document.getElementsByClassName(CONTAINER_CLASS)[0]);
|
|
14
|
+
}
|
|
7
15
|
} else {
|
|
8
16
|
container = document.createElement('div');
|
|
9
17
|
container.className = 'farm-modal';
|
|
@@ -11,10 +19,10 @@ export default function (): { container: HTMLElement; backdrop: HTMLElement; mod
|
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
const backdrop = document.createElement('div');
|
|
14
|
-
backdrop.className =
|
|
22
|
+
backdrop.className = OVERLAY_CLASS;
|
|
15
23
|
|
|
16
24
|
const modal = document.createElement('div');
|
|
17
|
-
modal.className =
|
|
25
|
+
modal.className = CONTAINER_CLASS;
|
|
18
26
|
|
|
19
27
|
modal.style.width = '98%';
|
|
20
28
|
modal.style.maxWidth = '400px';
|
|
@@ -113,6 +113,6 @@ import imageFile from './assets/logo_farmtech.svg';
|
|
|
113
113
|
|
|
114
114
|
<img src={imageFile} />
|
|
115
115
|
|
|
116
|
-
Here you can find the components from the Farmtech's Design System on the top of Vue
|
|
116
|
+
Here you can find the components from the Farmtech's Design System on the top of Vue 3.
|
|
117
117
|
|
|
118
118
|
Currrent version: {VERSION}
|