@farm-investimentos/front-mfe-components 11.4.6 → 11.4.7
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 +385 -239
- 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 +385 -239
- 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/Form/Form.stories.js +16 -2
- package/src/components/Form/Form.vue +4 -2
- package/src/components/IdCaption/IdCaption.vue +1 -1
- package/src/components/RadioGroup/RadioGroup.vue +14 -2
- package/src/components/TableContextMenu/TableContextMenu.vue +3 -1
- package/src/components/TextFieldV2/TextFieldV2.scss +59 -0
- package/src/components/TextFieldV2/TextFieldV2.stories.js +66 -2
- package/src/components/TextFieldV2/TextFieldV2.vue +118 -5
- package/src/components/Typography/Typography.vue +13 -0
- package/src/components/layout/Col/Col.scss +1 -1
- package/src/components/layout/Line/Line.vue +4 -1
- package/src/examples/VuetifyDialog.stories.js +119 -0
- package/src/examples/ConfirmDialog.stories.js +0 -43
- package/src/examples/Modal.stories.js +0 -181
package/package.json
CHANGED
|
@@ -33,13 +33,19 @@ export const Primary = () => ({
|
|
|
33
33
|
document: 'Document',
|
|
34
34
|
name: 'Name',
|
|
35
35
|
checkbox: true,
|
|
36
|
-
birthDate: new Date('1980/09/20').toISOString()
|
|
36
|
+
birthDate: new Date('1980/09/20').toISOString(),
|
|
37
|
+
selectId: 1,
|
|
37
38
|
},
|
|
38
39
|
validForm: false,
|
|
39
40
|
rules: {
|
|
40
41
|
required: value => !!value || 'Campo obrigatório',
|
|
41
42
|
checked: value => !!value || 'Deve estar marcado',
|
|
42
43
|
},
|
|
44
|
+
items: [
|
|
45
|
+
{ value: null, text: '' },
|
|
46
|
+
{ value: 1, text: 'label 1' },
|
|
47
|
+
{ value: 2, text: 'label 2' },
|
|
48
|
+
],
|
|
43
49
|
styles,
|
|
44
50
|
};
|
|
45
51
|
},
|
|
@@ -55,6 +61,9 @@ export const Primary = () => ({
|
|
|
55
61
|
<farm-label :required="true">True/false</farm-label>
|
|
56
62
|
<farm-checkbox v-model="form.checkbox" :rules="[rules.checked]" />
|
|
57
63
|
|
|
64
|
+
<farm-label :required="true">Select</farm-label>
|
|
65
|
+
<v-select :rules="[rules.required]" :items="items" v-model="form.selectId"/>
|
|
66
|
+
|
|
58
67
|
<farm-label :required="true">Birthdate:</farm-label>
|
|
59
68
|
<DatePicker
|
|
60
69
|
ref="birthDate"
|
|
@@ -87,6 +96,11 @@ export const Secondary = () => ({
|
|
|
87
96
|
required: value => !!value || 'Campo obrigatório',
|
|
88
97
|
},
|
|
89
98
|
styles,
|
|
99
|
+
items: [
|
|
100
|
+
{ value: null, text: '' },
|
|
101
|
+
{ value: 1, text: 'label 1' },
|
|
102
|
+
{ value: 2, text: 'label 2' },
|
|
103
|
+
],
|
|
90
104
|
};
|
|
91
105
|
},
|
|
92
106
|
template: `
|
|
@@ -220,4 +234,4 @@ export const DatePickers = () => ({
|
|
|
220
234
|
</div>
|
|
221
235
|
</farm-form>
|
|
222
236
|
`,
|
|
223
|
-
});
|
|
237
|
+
});
|
|
@@ -9,7 +9,7 @@ type ErrorsBag = Record<number, boolean>;
|
|
|
9
9
|
export default Vue.extend({
|
|
10
10
|
name: 'farm-form',
|
|
11
11
|
props: {
|
|
12
|
-
value: { type: [Boolean]
|
|
12
|
+
value: { type: [Boolean] },
|
|
13
13
|
},
|
|
14
14
|
inheritAttrs: true,
|
|
15
15
|
setup(props, { emit }) {
|
|
@@ -42,7 +42,9 @@ export default Vue.extend({
|
|
|
42
42
|
|
|
43
43
|
const recursiveFormField = $node => {
|
|
44
44
|
$node.$children.forEach($leaf => {
|
|
45
|
-
if
|
|
45
|
+
if($leaf.validate) {
|
|
46
|
+
validationFields.push($leaf);
|
|
47
|
+
} else if ($leaf.$children.length > 1) {
|
|
46
48
|
recursiveFormField($leaf);
|
|
47
49
|
} else if ($leaf.$children[0] && $leaf.$children[0].validate) {
|
|
48
50
|
validationFields.push($leaf.$children[0]);
|
|
@@ -52,9 +52,21 @@ export default Vue.extend({
|
|
|
52
52
|
default: false,
|
|
53
53
|
},
|
|
54
54
|
color: {
|
|
55
|
-
type: String
|
|
55
|
+
type: String as PropType<
|
|
56
|
+
| 'primary'
|
|
57
|
+
| 'secondary'
|
|
58
|
+
| 'neutral'
|
|
59
|
+
| 'info'
|
|
60
|
+
| 'success'
|
|
61
|
+
| 'error'
|
|
62
|
+
| 'warning'
|
|
63
|
+
| 'success'
|
|
64
|
+
| 'extra-1'
|
|
65
|
+
| 'extra-2'
|
|
66
|
+
| 'gray'
|
|
67
|
+
>,
|
|
56
68
|
default: 'primary',
|
|
57
|
-
}
|
|
69
|
+
}
|
|
58
70
|
},
|
|
59
71
|
setup(props, { emit }) {
|
|
60
72
|
const innerValue = ref(props.value);
|
|
@@ -40,6 +40,9 @@ export default Vue.extend({
|
|
|
40
40
|
name: 'farm-context-menu',
|
|
41
41
|
components: {},
|
|
42
42
|
props: {
|
|
43
|
+
/**
|
|
44
|
+
* Items to populate the context menu
|
|
45
|
+
*/
|
|
43
46
|
items: {
|
|
44
47
|
type: Array as PropType<Array<IContextMenuOption>>,
|
|
45
48
|
required: true,
|
|
@@ -54,7 +57,6 @@ export default Vue.extend({
|
|
|
54
57
|
onClick(handler) {
|
|
55
58
|
if (handler !== undefined) {
|
|
56
59
|
this.$emit(handler);
|
|
57
|
-
// handler();
|
|
58
60
|
}
|
|
59
61
|
},
|
|
60
62
|
toggleValue() {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.farm-textfield {
|
|
2
|
+
&--input {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
border: 1px solid;
|
|
7
|
+
border-color: var(--farm-gray-lighten);
|
|
8
|
+
height: 36px;
|
|
9
|
+
border-radius: 5px;
|
|
10
|
+
padding: 8px;
|
|
11
|
+
margin-bottom: 8px;
|
|
12
|
+
|
|
13
|
+
> button {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&>input {
|
|
18
|
+
flex: 1;
|
|
19
|
+
outline: none;
|
|
20
|
+
color: var(--farm-neutral-darken);
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.farm-textfield--touched.farm-textfield--validatable {
|
|
30
|
+
&.farm-textfield--error {
|
|
31
|
+
.farm-textfield {
|
|
32
|
+
&--input {
|
|
33
|
+
border-color: var(--farm-error-base);
|
|
34
|
+
|
|
35
|
+
&>input {
|
|
36
|
+
color: var(--farm-neutral-darken);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.farm-icon {
|
|
40
|
+
color: var(--farm-error-base);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.farm-textfield--blured.farm-textfield--validatable:not(.farm-textfield--error) {
|
|
48
|
+
.farm-textfield--input {
|
|
49
|
+
border-color: var(--farm-primary-base);
|
|
50
|
+
|
|
51
|
+
&>input {
|
|
52
|
+
color: var(--farm-neutral-darken);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.farm-icon {
|
|
56
|
+
color: var(--farm-primary-base);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -25,11 +25,75 @@ export default {
|
|
|
25
25
|
export const Primary = () => ({
|
|
26
26
|
data() {
|
|
27
27
|
return {
|
|
28
|
-
v: '
|
|
28
|
+
v: 'input text',
|
|
29
29
|
};
|
|
30
30
|
},
|
|
31
31
|
template: `<div style="width: 480px">
|
|
32
32
|
<farm-textfield-v2 v-model="v" />
|
|
33
|
-
|
|
33
|
+
v-model: {{ v }}
|
|
34
|
+
</div>`,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const Validate = () => ({
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
v: 'input',
|
|
41
|
+
rules: {
|
|
42
|
+
required: value => !!value || 'Campo obrigatório',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
template: `<div style="width: 480px">
|
|
47
|
+
<farm-label required>Required field</farm-label>
|
|
48
|
+
<farm-textfield-v2 v-model="v" :rules="[rules.required]" />
|
|
49
|
+
</div>`,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const Icon = () => ({
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
v: '',
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
show() {
|
|
60
|
+
alert('On icon click');
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
template: `<div style="width: 480px">
|
|
64
|
+
<farm-textfield-v2 v-model="v" icon="eye" onClickIcon="this.show" />
|
|
65
|
+
<farm-textfield-v2 v-model="v" icon="eye" icon-position="left" onClickIcon="this.show" />
|
|
66
|
+
</div>`,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const HintText = () => ({
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
v: 'input text',
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
template: `<div style="width: 480px">
|
|
76
|
+
<farm-textfield-v2 v-model="v" hintText="Hint text" />
|
|
77
|
+
</div>`,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const UpdateValue = () => ({
|
|
81
|
+
data() {
|
|
82
|
+
return {
|
|
83
|
+
counter: 1,
|
|
84
|
+
v: '1',
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
onClick() {
|
|
89
|
+
this.counter++;
|
|
90
|
+
this.v = this.counter;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
template: `<div style="width: 480px">
|
|
94
|
+
<farm-textfield-v2 v-model="v" />
|
|
95
|
+
<farm-btn @click="onClick">Add 1 to counter and update v-model</farm-btn>
|
|
96
|
+
<br />counter: {{ counter }}
|
|
97
|
+
<br />v-model: {{ v }}
|
|
34
98
|
</div>`,
|
|
35
99
|
});
|
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="farm-textfield"
|
|
4
|
+
:class="{
|
|
5
|
+
'farm-textfield': true,
|
|
6
|
+
'farm-textfield--validatable': rules.length > 0,
|
|
7
|
+
'farm-textfield--touched': isTouched,
|
|
8
|
+
'farm-textfield--blured': isBlured,
|
|
9
|
+
'farm-textfield--error': hasError,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
3
12
|
<div class="farm-textfield--input">
|
|
4
|
-
<
|
|
13
|
+
<button v-if="icon && iconPosition === 'left'" @click="$emit('onClickIcon')">
|
|
14
|
+
<farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
|
|
15
|
+
</button>
|
|
16
|
+
|
|
17
|
+
<input
|
|
18
|
+
v-bind="$attrs"
|
|
19
|
+
v-model="innerValue"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
@keyup="onKeyUp"
|
|
22
|
+
@blur="onBlur"
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
<button v-if="icon && iconPosition === 'right'" @click="$emit('onClickIcon')">
|
|
26
|
+
<farm-icon color="gray" size="20px">{{ icon }}</farm-icon>
|
|
27
|
+
</button>
|
|
5
28
|
</div>
|
|
6
|
-
|
|
29
|
+
|
|
30
|
+
<farm-caption v-if="hasError && isTouched" color="error" variation="regular">
|
|
31
|
+
{{ errorBucket[0] }}
|
|
32
|
+
</farm-caption>
|
|
33
|
+
<farm-caption v-if="hintText && !errorMessage" color="gray" variation="regular">
|
|
34
|
+
{{ hintText }}
|
|
35
|
+
</farm-caption>
|
|
7
36
|
</div>
|
|
8
37
|
</template>
|
|
38
|
+
|
|
9
39
|
<script lang="ts">
|
|
10
|
-
import Vue, { ref, watch } from 'vue';
|
|
40
|
+
import Vue, { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
|
|
41
|
+
import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
|
|
42
|
+
import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
|
|
43
|
+
import validateFormMethodBuilder from '../../composition/validateFormMethodBuilder';
|
|
44
|
+
import deepEqual from '../../composition/deepEqual';
|
|
11
45
|
|
|
12
46
|
export default Vue.extend({
|
|
13
47
|
name: 'farm-textfield-v2',
|
|
@@ -16,15 +50,61 @@ export default Vue.extend({
|
|
|
16
50
|
/**
|
|
17
51
|
* v-model binding
|
|
18
52
|
*/
|
|
19
|
-
value: {},
|
|
53
|
+
value: { type: [String, Number], default: '' },
|
|
54
|
+
/**
|
|
55
|
+
* Show icon?
|
|
56
|
+
*/
|
|
57
|
+
icon: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: null,
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* Icon position
|
|
63
|
+
*/
|
|
64
|
+
iconPosition: { type: String as PropType<'left' | 'right'>, default: 'right' },
|
|
65
|
+
/**
|
|
66
|
+
* Show hint text
|
|
67
|
+
*/
|
|
68
|
+
hintText: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: null,
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Show input disable
|
|
74
|
+
*/
|
|
75
|
+
disabled: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
errorMessage: String,
|
|
81
|
+
/**
|
|
82
|
+
* Array of rules used for validation
|
|
83
|
+
*/
|
|
84
|
+
rules: {
|
|
85
|
+
type: Array as PropType<Array<Function>>,
|
|
86
|
+
default: () => [],
|
|
87
|
+
},
|
|
20
88
|
},
|
|
21
89
|
setup(props, { emit }) {
|
|
90
|
+
const { rules } = toRefs(props);
|
|
22
91
|
const innerValue = ref(props.value);
|
|
92
|
+
const isTouched = ref(false);
|
|
93
|
+
const isBlured = ref(false);
|
|
94
|
+
|
|
95
|
+
const { errorBucket, valid, validatable } = validateFormStateBuilder();
|
|
96
|
+
|
|
97
|
+
let fieldValidator = validateFormFieldBuilder(rules.value);
|
|
98
|
+
|
|
99
|
+
const hasError = computed(() => {
|
|
100
|
+
return errorBucket.value.length > 0;
|
|
101
|
+
});
|
|
23
102
|
|
|
24
103
|
watch(
|
|
25
104
|
() => props.value,
|
|
26
105
|
() => {
|
|
27
106
|
innerValue.value = props.value;
|
|
107
|
+
validate(innerValue.value);
|
|
28
108
|
}
|
|
29
109
|
);
|
|
30
110
|
|
|
@@ -35,8 +115,41 @@ export default Vue.extend({
|
|
|
35
115
|
}
|
|
36
116
|
);
|
|
37
117
|
|
|
118
|
+
watch(
|
|
119
|
+
() => props.rules,
|
|
120
|
+
(newVal, oldVal) => {
|
|
121
|
+
if (deepEqual(newVal, oldVal)) return;
|
|
122
|
+
fieldValidator = validateFormFieldBuilder(rules.value);
|
|
123
|
+
validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
|
|
124
|
+
validate(innerValue.value);
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
onBeforeMount(() => {
|
|
129
|
+
validate(innerValue.value);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
let validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
|
|
133
|
+
|
|
134
|
+
const onKeyUp = () => {
|
|
135
|
+
isTouched.value = true;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const onBlur = () => {
|
|
139
|
+
isBlured.value = true;
|
|
140
|
+
};
|
|
141
|
+
|
|
38
142
|
return {
|
|
39
143
|
innerValue,
|
|
144
|
+
errorBucket,
|
|
145
|
+
valid,
|
|
146
|
+
validatable,
|
|
147
|
+
hasError,
|
|
148
|
+
isTouched,
|
|
149
|
+
isBlured,
|
|
150
|
+
validate,
|
|
151
|
+
onKeyUp,
|
|
152
|
+
onBlur,
|
|
40
153
|
};
|
|
41
154
|
},
|
|
42
155
|
});
|
|
@@ -23,18 +23,30 @@ export default Vue.extend({
|
|
|
23
23
|
inheritAttrs: true,
|
|
24
24
|
name: 'farm-typography',
|
|
25
25
|
props: {
|
|
26
|
+
/**
|
|
27
|
+
* Html tag
|
|
28
|
+
*/
|
|
26
29
|
tag: {
|
|
27
30
|
type: String as PropType<
|
|
28
31
|
'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'legend' | 'label' | 'li'
|
|
29
32
|
>,
|
|
30
33
|
default: 'p',
|
|
31
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Size
|
|
37
|
+
*/
|
|
32
38
|
size: {
|
|
33
39
|
type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
|
|
34
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Line Height
|
|
43
|
+
*/
|
|
35
44
|
lineHeight: {
|
|
36
45
|
type: String,
|
|
37
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* Font-weight
|
|
49
|
+
*/
|
|
38
50
|
weight: {
|
|
39
51
|
type: Number as PropType<100 | 200 | 300 | 400 | 500 | 600 | 700>,
|
|
40
52
|
},
|
|
@@ -53,6 +65,7 @@ export default Vue.extend({
|
|
|
53
65
|
| 'success'
|
|
54
66
|
| 'extra-1'
|
|
55
67
|
| 'extra-2'
|
|
68
|
+
| 'gray'
|
|
56
69
|
>,
|
|
57
70
|
default: 'default',
|
|
58
71
|
},
|
|
@@ -8,6 +8,9 @@ import Vue from 'vue';
|
|
|
8
8
|
export default Vue.extend({
|
|
9
9
|
name: 'farm-line',
|
|
10
10
|
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Remove default margins
|
|
13
|
+
*/
|
|
11
14
|
noSpacing: {
|
|
12
15
|
type: Boolean,
|
|
13
16
|
default: false,
|
|
@@ -17,5 +20,5 @@ export default Vue.extend({
|
|
|
17
20
|
</script>
|
|
18
21
|
|
|
19
22
|
<style lang="scss" scoped>
|
|
20
|
-
@import './Line
|
|
23
|
+
@import './Line'
|
|
21
24
|
</style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Display/Dialog/Vuetify',
|
|
5
|
+
decorators: [withDesign],
|
|
6
|
+
parameters: {
|
|
7
|
+
viewMode: 'docs',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: `Dialog created by vuetify-dialog`,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Primary = () => ({
|
|
17
|
+
methods: {
|
|
18
|
+
openDialog() {
|
|
19
|
+
this.$dialog.confirm({
|
|
20
|
+
text: `Deseja realmente sair?`,
|
|
21
|
+
title: 'Sair',
|
|
22
|
+
actions: {
|
|
23
|
+
true: {
|
|
24
|
+
text: 'Sim',
|
|
25
|
+
color: 'secondary',
|
|
26
|
+
handle: () => {
|
|
27
|
+
alert('Clicked: Sim');
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
35
|
+
<farm-btn @click="openDialog">
|
|
36
|
+
Open
|
|
37
|
+
</farm-btn>
|
|
38
|
+
</div>`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Default = () => ({
|
|
42
|
+
methods: {
|
|
43
|
+
openDialog() {
|
|
44
|
+
this.$dialog.confirm({
|
|
45
|
+
text: `Deseja realmente sair?`,
|
|
46
|
+
title: 'Sair',
|
|
47
|
+
actions: {
|
|
48
|
+
false: {
|
|
49
|
+
text: 'Cancelar',
|
|
50
|
+
color: 'secondary-outlined',
|
|
51
|
+
handle: () => {
|
|
52
|
+
alert('Clicked: Cancelar');
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
true: {
|
|
56
|
+
text: 'Sim',
|
|
57
|
+
color: 'secondary',
|
|
58
|
+
handle: () => {
|
|
59
|
+
alert('Clicked: Sim');
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
67
|
+
<farm-btn @click="openDialog">
|
|
68
|
+
Open
|
|
69
|
+
</farm-btn>
|
|
70
|
+
</div>`,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const ErrorColor = () => ({
|
|
74
|
+
methods: {
|
|
75
|
+
openDialog() {
|
|
76
|
+
this.$dialog.confirm({
|
|
77
|
+
text: `Deseja realmente sair?`,
|
|
78
|
+
title: 'Sair',
|
|
79
|
+
actions: {
|
|
80
|
+
true: {
|
|
81
|
+
text: 'Sair',
|
|
82
|
+
color: 'error',
|
|
83
|
+
handle: () => {
|
|
84
|
+
alert('Clicked: Sair');
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
92
|
+
<farm-btn @click="openDialog">
|
|
93
|
+
Open
|
|
94
|
+
</farm-btn>
|
|
95
|
+
</div>`,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
export const CustomContent = () => ({
|
|
100
|
+
methods: {
|
|
101
|
+
openDialog() {
|
|
102
|
+
this.$dialog.confirm({
|
|
103
|
+
text: `This is a text with <strong>html markup</strong> and<br />break line!`,
|
|
104
|
+
title: 'Sair',
|
|
105
|
+
actions: {
|
|
106
|
+
true: {
|
|
107
|
+
text: 'Sim',
|
|
108
|
+
color: 'secondary',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
115
|
+
<farm-btn @click="openDialog">
|
|
116
|
+
Open
|
|
117
|
+
</farm-btn>
|
|
118
|
+
</div>`,
|
|
119
|
+
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Display/Dialog/Confirm',
|
|
5
|
-
decorators: [withDesign],
|
|
6
|
-
parameters: {
|
|
7
|
-
viewMode: 'docs',
|
|
8
|
-
docs: {
|
|
9
|
-
description: {
|
|
10
|
-
component: `ConfirmDialog created by vuetify-dialog`,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const ConfirmDialog = () => ({
|
|
17
|
-
methods: {
|
|
18
|
-
openDialog() {
|
|
19
|
-
this.$dialog.confirm({
|
|
20
|
-
text: `Deseja realmente sair?`,
|
|
21
|
-
title: 'Sair',
|
|
22
|
-
actions: {
|
|
23
|
-
false: {
|
|
24
|
-
text: 'Cancelar',
|
|
25
|
-
color: 'primary',
|
|
26
|
-
},
|
|
27
|
-
true: {
|
|
28
|
-
text: 'Sim',
|
|
29
|
-
color: 'secondary',
|
|
30
|
-
handle: () => {
|
|
31
|
-
this.$emit('onLogout');
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
template: `<div style="display: flex; flex-direction: column; max-width: 160px; width: 100%;">
|
|
39
|
-
<ConfirmButton @click="openDialog">
|
|
40
|
-
Open
|
|
41
|
-
</ConfirmButton>
|
|
42
|
-
</div>`,
|
|
43
|
-
});
|