@burh/nuxt-core 1.0.22 → 1.0.24
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/assets/css/variables.css +3 -0
- package/assets/sass/argon-panna.scss +106 -0
- package/assets/sass/argon-test-online.scss +106 -0
- package/assets/sass/burh-ds/_variables.scss +1 -0
- package/assets/sass/burh-ds/organisms/_cards.scss +36 -4
- package/assets/sass/burh-ds/variables/_colors-panna.scss +303 -0
- package/assets/sass/burh-ds/variables/_colors-test-online.scss +303 -0
- package/assets/sass/burh-ds/variables/_colors.scss +0 -1
- package/assets/sass/custom/_variables.scss +1 -0
- package/components/argon-core/BaseDropdown.vue +1 -1
- package/components/argon-core/Modal.vue +1 -1
- package/components/burh-ds/Avatar/AvatarLink.vue +24 -18
- package/components/burh-ds/Button/ExportButton.vue +3 -8
- package/components/burh-ds/Cards/TestCard.vue +163 -52
- package/components/burh-ds/Cards/WelcomeCard.vue +36 -43
- package/components/burh-ds/Dropdown/AppLinkArea.vue +125 -39
- package/components/burh-ds/Dropdown/DropdownItem.vue +21 -16
- package/components/burh-ds/Dropdown/DropdownSection.vue +26 -26
- package/components/burh-ds/Dropdown/FaqVideoArea.vue +79 -65
- package/components/burh-ds/Dropdown/SignOutItem.vue +6 -6
- package/components/burh-ds/Dropdown/UserMenuDropdown.vue +54 -48
- package/components/burh-ds/Groups/SimpleProductItem.vue +26 -11
- package/components/burh-ds/Headings/AppHeader.vue +46 -47
- package/components/burh-ds/Headings/StepHeader.vue +87 -51
- package/components/burh-ds/Link/DefaultLink.vue +31 -0
- package/components/burh-ds/Lists/ListNavLinks.vue +47 -34
- package/components/burh-ds/Loadings/LoadingFullPage.vue +1 -0
- package/components/burh-ds/Modals/AppConfigModal.vue +157 -159
- package/components/burh-ds/Modals/SendTest.vue +170 -0
- package/components/burh-ds/Modals/VideoModal.vue +15 -5
- package/components/burh-ds/Navbar/BaseNav.vue +2 -2
- package/components/burh-ds/Pagination/NamedPagination.vue +171 -0
- package/components/burh-ds/Questions/Question.vue +86 -50
- package/components/burh-ds/Questions/QuestionAttach.vue +1 -1
- package/components/burh-ds/Questions/QuestionRadio.vue +44 -40
- package/components/burh-ds/Questions/QuestionRadioItem.vue +29 -23
- package/components/burh-ds/Questions/QuestionText.vue +53 -22
- package/components/burh-ds/Tabs/TesteTab.vue +100 -0
- package/components/layouts/burh-ds/navbar/AppNavbar.vue +73 -35
- package/components/layouts/burh-ds/navbar/BusinessGlobalNavbar.vue +385 -241
- package/package.json +2 -2
- package/data/ListNavLinksMock.json +0 -113
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="pagination row" :class="[size && `pagination-${size}`, align && `justify-content-${align}`]">
|
|
3
|
+
<li class="page-item prev-page" :class="{disabled: value === 1}" v-if="pagesName.length > 5">
|
|
4
|
+
<a class="page-link" aria-label="Previous" @click="prevPage">
|
|
5
|
+
<span aria-hidden="true"><i class="fa fa-angle-left" aria-hidden="true"></i></span>
|
|
6
|
+
</a>
|
|
7
|
+
</li>
|
|
8
|
+
<teste-tab
|
|
9
|
+
:key="item"
|
|
10
|
+
v-for="item in range(minPage, maxPage)"
|
|
11
|
+
@tab-click="changePage(item)"
|
|
12
|
+
:title="pagesName[item - 1]"
|
|
13
|
+
:active="value === item"
|
|
14
|
+
/>
|
|
15
|
+
<slot />
|
|
16
|
+
<li class="page-item next-page" :class="{disabled: value === totalPages}" v-if="pagesName.length > 5">
|
|
17
|
+
<a class="page-link" aria-label="Next" @click="nextPage">
|
|
18
|
+
<span aria-hidden="true"><i class="fa fa-angle-right" aria-hidden="true"></i></span>
|
|
19
|
+
</a>
|
|
20
|
+
</li>
|
|
21
|
+
<!-- <li class="btn mx-1" :class="vvalue === item ? 'btn-primary' : 'btn-outline-primary'"
|
|
22
|
+
:key="item"
|
|
23
|
+
v-for="item in range(1, pagesName.length)"> -->
|
|
24
|
+
<!-- <a
|
|
25
|
+
@click="changePage(item)">{{pagesName[item - 1]}}
|
|
26
|
+
</a> -->
|
|
27
|
+
<!-- </li> -->
|
|
28
|
+
</ul>
|
|
29
|
+
</template>
|
|
30
|
+
<script>
|
|
31
|
+
import TesteTab from '../Tabs/TesteTab';
|
|
32
|
+
export default {
|
|
33
|
+
name: 'base-pagination',
|
|
34
|
+
components: {
|
|
35
|
+
TesteTab,
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
pagesName: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => ['page 1', 'page 2', 'page 3', 'page 4', 'page 5', 'page 6', 'page 7', 'page 8', 'page 9', 'page 10']
|
|
41
|
+
},
|
|
42
|
+
pageCount: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 10,
|
|
45
|
+
description:
|
|
46
|
+
'Pagination page count. This should be specified in combination with perPage'
|
|
47
|
+
},
|
|
48
|
+
perPage: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 10,
|
|
51
|
+
description:
|
|
52
|
+
'Pagination per page. Should be specified with total or pageCount'
|
|
53
|
+
},
|
|
54
|
+
total: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 0,
|
|
57
|
+
description:
|
|
58
|
+
'Can be specified instead of pageCount. The page count in this case will be total/perPage'
|
|
59
|
+
},
|
|
60
|
+
value: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: 1,
|
|
63
|
+
description: 'Pagination value'
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
description: 'Pagination size'
|
|
69
|
+
},
|
|
70
|
+
align: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
description: 'Pagination alignment (e.g center|start|end)'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
totalPages() {
|
|
78
|
+
if (this.pageCount > 0) return this.pageCount;
|
|
79
|
+
if (this.total > 0) {
|
|
80
|
+
return Math.ceil(this.total / this.perPage);
|
|
81
|
+
}
|
|
82
|
+
return 1;
|
|
83
|
+
},
|
|
84
|
+
pagesToDisplay() {
|
|
85
|
+
if (this.totalPages > 0 && this.totalPages < this.defaultPagesToDisplay) {
|
|
86
|
+
return this.totalPages;
|
|
87
|
+
}
|
|
88
|
+
return this.defaultPagesToDisplay;
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
data() {
|
|
92
|
+
return {
|
|
93
|
+
defaultPagesToDisplay: 1,
|
|
94
|
+
minPage: 1,
|
|
95
|
+
maxPage: this.pagesName.length >= 5 ? 5 : this.pagesName.length,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
range(min, max) {
|
|
100
|
+
let arr = [];
|
|
101
|
+
for (let i = min; i <= max; i++) {
|
|
102
|
+
arr.push(i);
|
|
103
|
+
}
|
|
104
|
+
return arr;
|
|
105
|
+
},
|
|
106
|
+
changePage(item) {
|
|
107
|
+
this.$emit('input', item);
|
|
108
|
+
},
|
|
109
|
+
nextPage() {
|
|
110
|
+
if (this.value < this.totalPages) {
|
|
111
|
+
this.$emit('input', this.value + 1);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
prevPage() {
|
|
115
|
+
if (this.value > 1) {
|
|
116
|
+
this.$emit('input', this.value - 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
watch: {
|
|
121
|
+
perPage() {
|
|
122
|
+
this.$emit('input', 1);
|
|
123
|
+
},
|
|
124
|
+
total() {
|
|
125
|
+
this.$emit('input', 1);
|
|
126
|
+
},
|
|
127
|
+
value(newValue, oldValue) {
|
|
128
|
+
const pagesToDisplay = this.pagesName.length >= 5 ? 5 : this.pagesName.length;
|
|
129
|
+
if(newValue < 5) {
|
|
130
|
+
this.minPage = 1;
|
|
131
|
+
this.maxPage = pagesToDisplay;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if(newValue < this.minPage) {
|
|
135
|
+
this.minPage = newValue;
|
|
136
|
+
this.maxPage = this.minPage + 4;
|
|
137
|
+
}
|
|
138
|
+
if(newValue > this.maxPage) {
|
|
139
|
+
this.maxPage = newValue;
|
|
140
|
+
this.minPage = this.maxPage - 4;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
</script>
|
|
147
|
+
<style lang="scss" scoped>
|
|
148
|
+
|
|
149
|
+
.page-item, .page-link {
|
|
150
|
+
display: flex;
|
|
151
|
+
width: auto !important;
|
|
152
|
+
border-radius: 10rem !important;
|
|
153
|
+
|
|
154
|
+
width: fit-content;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.page-item {
|
|
158
|
+
padding: 0 !important;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.page-link {
|
|
162
|
+
padding: 0 1rem !important;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
.teste {
|
|
167
|
+
.page-link:hover {
|
|
168
|
+
color: #fff;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="card
|
|
2
|
+
<div class="card position-relative">
|
|
3
3
|
<div class="row px-4 justify-content-start">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
<validation-provider tag="div" class="col-8" :vid="`question-${stepIndex}-${position}`"
|
|
5
|
+
name="Pergunta" rules="required" v-slot="{ errors }">
|
|
6
|
+
<base-input
|
|
7
|
+
:label="`Pergunta #${position + 1}`"
|
|
8
|
+
placeholder="Escreva uma pergunta"
|
|
9
|
+
type="text"
|
|
10
|
+
:error="errors[0]"
|
|
11
|
+
:valid="errors.length ? true : false"
|
|
12
|
+
:value="question.question"
|
|
13
|
+
v-on:input="setQuestion('question', $event)"
|
|
14
|
+
/>
|
|
15
|
+
</validation-provider>
|
|
14
16
|
|
|
15
17
|
<div class="col-4">
|
|
16
18
|
<label class="form-control-label d-block pt-1">
|
|
17
19
|
Escolha o tipo da pergunta
|
|
18
20
|
</label>
|
|
19
21
|
<el-select class="select-danger w-100"
|
|
20
|
-
placeholder="
|
|
22
|
+
placeholder="Escolha o tipo da pergunta"
|
|
21
23
|
v-model="question.question_type">
|
|
22
24
|
<el-option v-for="option in listComponentes"
|
|
23
25
|
class="select-danger"
|
|
@@ -29,12 +31,27 @@
|
|
|
29
31
|
</div>
|
|
30
32
|
|
|
31
33
|
<div class="col-8 form-group">
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
34
|
+
<paragraph
|
|
35
|
+
v-if="question.question_type == 'paragraph'"
|
|
36
|
+
:data="question.max_char ? question.max_char : undefined"
|
|
37
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
38
|
+
<question-radio
|
|
39
|
+
v-if="question.question_type == 'multiple'"
|
|
40
|
+
:data="question.multiples"
|
|
41
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
42
|
+
<question-attach
|
|
43
|
+
v-if="question.question_type == 'annex'"
|
|
44
|
+
:data="question"
|
|
45
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
37
46
|
</div>
|
|
47
|
+
|
|
48
|
+
<ul class="question-icons">
|
|
49
|
+
<li v-for="(icon, index) in icons"
|
|
50
|
+
:key="`question-icon-${position}-${index}`"
|
|
51
|
+
@click="$emit(icon.event)">
|
|
52
|
+
<font-awesome-icon :icon="icon.icon" class="" />
|
|
53
|
+
</li>
|
|
54
|
+
</ul>
|
|
38
55
|
</div>
|
|
39
56
|
</div>
|
|
40
57
|
</template>
|
|
@@ -54,57 +71,76 @@ export default {
|
|
|
54
71
|
QuestionAttach
|
|
55
72
|
},
|
|
56
73
|
props: {
|
|
57
|
-
|
|
74
|
+
stepIndex: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 0
|
|
77
|
+
},
|
|
78
|
+
position: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 0
|
|
81
|
+
},
|
|
82
|
+
data: null,
|
|
83
|
+
icons: {
|
|
84
|
+
type: Array,
|
|
85
|
+
default: () => [
|
|
86
|
+
{ event: 'first-icon-click', icon: ['far', 'copy'] },
|
|
87
|
+
{ event: 'second-icon-click', icon: ['fas', 'trash-alt'] }
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
listComponentes: {
|
|
91
|
+
type: Array,
|
|
92
|
+
default: () => [
|
|
93
|
+
{ value: 'paragraph', label: 'Paragrafo' },
|
|
94
|
+
{ value: 'multiple', label: 'Alternativa' },
|
|
95
|
+
{ value: 'annex', label: 'Anexo' }
|
|
96
|
+
]
|
|
97
|
+
},
|
|
58
98
|
},
|
|
59
99
|
data() {
|
|
60
100
|
return {
|
|
61
|
-
console:console,
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
value: 'paragraph',
|
|
65
|
-
label: 'Paragrafo'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
value: 'question-radio',
|
|
69
|
-
label: 'Dissertativa'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
value: 'question-attach',
|
|
73
|
-
label: 'Anexo'
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
question: {
|
|
77
|
-
question_type: 'paragraph',
|
|
78
|
-
question: '',
|
|
79
|
-
}
|
|
101
|
+
console: console,
|
|
102
|
+
question: this.data,
|
|
80
103
|
}
|
|
81
104
|
},
|
|
82
105
|
watch: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
106
|
+
data(newValue) {
|
|
107
|
+
this.question = newValue;
|
|
108
|
+
}
|
|
87
109
|
},
|
|
88
110
|
methods: {
|
|
89
111
|
emitQuestion() {
|
|
90
112
|
this.$emit('change-question', this.question)
|
|
91
113
|
},
|
|
92
|
-
|
|
93
|
-
|
|
114
|
+
setQuestion(type, data) {
|
|
115
|
+
this.question[type] = data
|
|
116
|
+
this.emitQuestion();
|
|
94
117
|
},
|
|
95
|
-
|
|
118
|
+
mergeDataQuestion(data) {
|
|
96
119
|
this.question = { ...this.question , ...data }
|
|
120
|
+
this.emitQuestion();
|
|
97
121
|
},
|
|
98
|
-
|
|
99
|
-
return this.
|
|
100
|
-
},
|
|
101
|
-
isValid(name) {
|
|
102
|
-
return this.validated && !this.errors.has(name);
|
|
122
|
+
isChangeTypeQuestion(value) {
|
|
123
|
+
return this.listComponentes.includes(value);
|
|
103
124
|
},
|
|
104
125
|
}
|
|
105
126
|
}
|
|
106
127
|
</script>
|
|
107
128
|
|
|
108
|
-
<style>
|
|
129
|
+
<style lang="scss" scoped>
|
|
130
|
+
.question-icons {
|
|
131
|
+
position: absolute;
|
|
132
|
+
bottom: 0;
|
|
133
|
+
right: 1rem;
|
|
134
|
+
display: flex;
|
|
135
|
+
justify-content: flex-end;
|
|
136
|
+
align-items: flex-end;
|
|
137
|
+
list-style: none;
|
|
109
138
|
|
|
139
|
+
li {
|
|
140
|
+
padding-top: 1rem;
|
|
141
|
+
padding-left: 1rem;
|
|
142
|
+
padding-right: 1rem;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
110
146
|
</style>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</
|
|
2
|
+
<div>
|
|
3
|
+
<el-radio-group v-model="selected">
|
|
4
|
+
<question-radio-item
|
|
5
|
+
v-for="(answer, index) in answers" :key="index"
|
|
6
|
+
:response="answer.name"
|
|
7
|
+
v-on:change-answer="setAnswers($event, answer)"
|
|
8
|
+
></question-radio-item>
|
|
9
|
+
</el-radio-group>
|
|
10
|
+
<base-button size="sm" type="link" class="mr-0" @click="addOption">Adicionar opção</base-button>
|
|
11
|
+
<base-button size="sm" type="link" @click="removeLastOption">Remover opção</base-button>
|
|
12
|
+
</div>
|
|
11
13
|
</template>
|
|
12
14
|
|
|
13
15
|
<script>
|
|
14
16
|
import {Radio, RadioGroup} from 'element-ui'
|
|
15
17
|
import QuestionRadioItem from '@burh/nuxt-core/components/burh-ds/Questions/QuestionRadioItem.vue';
|
|
18
|
+
import Swal from 'sweetalert2';
|
|
16
19
|
|
|
17
20
|
export default {
|
|
18
21
|
name: 'question-radio',
|
|
@@ -22,15 +25,15 @@ export default {
|
|
|
22
25
|
QuestionRadioItem
|
|
23
26
|
},
|
|
24
27
|
props: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
28
|
+
data: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => [{}, {}]
|
|
31
|
+
},
|
|
29
32
|
},
|
|
30
33
|
data() {
|
|
31
34
|
return {
|
|
32
35
|
selected: null,
|
|
33
|
-
answers: this.
|
|
36
|
+
answers: this.data,
|
|
34
37
|
minRadios: 2,
|
|
35
38
|
}
|
|
36
39
|
},
|
|
@@ -40,52 +43,53 @@ export default {
|
|
|
40
43
|
},
|
|
41
44
|
removeLastOption() {
|
|
42
45
|
if(this.answers.length <= this.minRadios) {
|
|
43
|
-
return
|
|
46
|
+
return Swal.fire({
|
|
47
|
+
title: 'Oops...',
|
|
48
|
+
text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
|
|
49
|
+
type: 'warning',
|
|
50
|
+
buttonsStyling: false,
|
|
51
|
+
confirmButtonText: 'Okay!',
|
|
52
|
+
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
53
|
+
})
|
|
44
54
|
}
|
|
45
55
|
this.answers.splice(this.answers.length - 1, 1);
|
|
46
56
|
},
|
|
47
|
-
setAnswers(value, answer) {
|
|
48
|
-
answer
|
|
49
|
-
|
|
57
|
+
setAnswers({id, value}, answer) {
|
|
58
|
+
answer.name = value;
|
|
59
|
+
answer.id = id;
|
|
60
|
+
|
|
61
|
+
if(this.selected == null && answer.correct != false) { // be carefully here
|
|
62
|
+
this.selected = answer.id
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.emitRadioList();
|
|
50
66
|
},
|
|
51
|
-
|
|
67
|
+
makeRadiolist() {
|
|
52
68
|
const listRadio = this.answers.map(radio => {
|
|
53
|
-
if ( radio.response == this.selected ) {
|
|
54
|
-
return {
|
|
55
|
-
name: radio.response,
|
|
56
|
-
correct: true,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
69
|
|
|
60
70
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
id: radio.id,
|
|
72
|
+
name: radio.name,
|
|
73
|
+
correct: radio.id === this.selected ? true : false
|
|
63
74
|
}
|
|
64
75
|
})
|
|
65
|
-
|
|
66
76
|
return listRadio
|
|
67
77
|
},
|
|
68
|
-
|
|
78
|
+
emitRadioList() {
|
|
69
79
|
const payload = {
|
|
70
80
|
response: this.selected,
|
|
71
|
-
multiples: this.
|
|
81
|
+
multiples: this.makeRadiolist()
|
|
72
82
|
}
|
|
73
83
|
this.$emit('data-changed', payload)
|
|
74
84
|
},
|
|
75
85
|
},
|
|
76
|
-
computed: {
|
|
77
|
-
getAnswers() {
|
|
78
|
-
return this.answers;
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
86
|
watch: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
deep: true
|
|
87
|
+
data(newValue) {
|
|
88
|
+
this.answers = newValue.map(e => { return { ...e }}); //prevent cloning references
|
|
85
89
|
},
|
|
86
90
|
selected() {
|
|
87
|
-
this.
|
|
88
|
-
}
|
|
91
|
+
this.emitRadioList();
|
|
92
|
+
},
|
|
89
93
|
},
|
|
90
94
|
}
|
|
91
95
|
</script>
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<validation-provider tag="div" class="" :vid="`radio-${id}`"
|
|
3
|
+
name="Resposta" rules="required" v-slot="{ errors }">
|
|
3
4
|
<el-radio
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
:label="id"
|
|
6
|
+
class="form-radio"
|
|
7
|
+
:class="{'form-radio--error': errors[0]}">
|
|
8
|
+
<base-input
|
|
9
|
+
name="Response"
|
|
10
|
+
class=""
|
|
11
|
+
type="text"
|
|
12
|
+
placeholder="Coloque uma resposta aqui"
|
|
13
|
+
v-model="value"
|
|
14
|
+
:error="errors[0]"
|
|
15
|
+
:valid="errors.length ? true : false"
|
|
16
|
+
v-on:input="$emit('change-answer', {id, value})">
|
|
17
|
+
</base-input>
|
|
17
18
|
</el-radio>
|
|
18
|
-
</
|
|
19
|
+
</validation-provider>
|
|
19
20
|
</template>
|
|
20
21
|
|
|
21
22
|
<script>
|
|
@@ -27,19 +28,24 @@ export default {
|
|
|
27
28
|
[Radio.name]: Radio,
|
|
28
29
|
},
|
|
29
30
|
props: {
|
|
31
|
+
response: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ''
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
created() {
|
|
37
|
+
this.$emit('change-answer', {id: this.id, value: this.value});
|
|
30
38
|
},
|
|
31
39
|
data() {
|
|
32
40
|
return {
|
|
33
|
-
|
|
41
|
+
id: this.$uuid.v4(),
|
|
42
|
+
value: this.response,
|
|
34
43
|
}
|
|
35
44
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
isValid(name) {
|
|
41
|
-
return this.validated && !this.errors.has(name);
|
|
42
|
-
},
|
|
45
|
+
watch: {
|
|
46
|
+
response(newValue) {
|
|
47
|
+
this.value = this.response
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
</script>
|
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
v-on:change="$emit('data-changed', { max_char:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<label class="form-control-label d-block pt-1">
|
|
4
|
+
Tamanho da resposta
|
|
5
|
+
</label>
|
|
6
|
+
<el-select class="select-danger w-100"
|
|
7
|
+
v-on:change="$emit('data-changed', { max_char: $event })"
|
|
8
|
+
placeholder="Selecione o tamanho da resposta"
|
|
9
|
+
v-model="selected">
|
|
10
|
+
<el-option v-for="option in list"
|
|
11
|
+
class="select-danger"
|
|
12
|
+
:value="option.value"
|
|
13
|
+
:label="option.label"
|
|
14
|
+
:key="option.label">
|
|
15
|
+
</el-option>
|
|
16
|
+
</el-select>
|
|
17
|
+
</div>
|
|
12
18
|
</template>
|
|
13
19
|
|
|
14
20
|
<script>
|
|
21
|
+
import {Select, Option} from 'element-ui'
|
|
15
22
|
|
|
16
23
|
export default {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
name: 'question-text',
|
|
25
|
+
components: {
|
|
26
|
+
[Select.name]: Select,
|
|
27
|
+
[Option.name]: Option,
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
data: {
|
|
31
|
+
type: Number | String,
|
|
32
|
+
default: 246
|
|
22
33
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
list: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => [
|
|
37
|
+
{ value: 246, label: 'Resposta Curta' },
|
|
38
|
+
{ value: 512, label: 'Resposta Média' },
|
|
39
|
+
{ value: 1024, label: 'Resposta Longa' },
|
|
40
|
+
]
|
|
30
41
|
}
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
selected: this.getItemMoreClosest(this.data),
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
methods: {
|
|
49
|
+
getItemMoreClosest(goal) {
|
|
50
|
+
const values = this.list.map(e => e.value)
|
|
51
|
+
const closest = values.reduce((prev, curr) => {
|
|
52
|
+
return (Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev);
|
|
53
|
+
});
|
|
54
|
+
return closest
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
watch: {
|
|
58
|
+
data(value) {
|
|
59
|
+
this.selected = this.getItemMoreClosest(value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
31
62
|
}
|
|
32
63
|
</script>
|
|
33
64
|
|