@burh/nuxt-core 1.0.21 → 1.0.23
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 +181 -0
- package/components/burh-ds/Cards/WelcomeCard.vue +48 -42
- 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 +95 -51
- package/components/burh-ds/Link/DefaultLink.vue +31 -0
- package/components/burh-ds/Lists/ListNavLinks.vue +47 -34
- package/components/burh-ds/Modals/AppConfigModal.vue +158 -156
- 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 +179 -0
- package/components/burh-ds/Questions/Question.vue +76 -36
- package/components/burh-ds/Questions/QuestionAttach.vue +1 -1
- package/components/burh-ds/Questions/QuestionRadio.vue +79 -73
- package/components/burh-ds/Questions/QuestionRadioItem.vue +25 -18
- 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 -242
- package/package.json +2 -2
- package/components/burh-ds/Cards/RecentTestCard.vue +0 -51
- package/data/ListNavLinksMock.json +0 -113
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
minPage() {
|
|
91
|
+
if (this.value >= 5) {
|
|
92
|
+
const pagesToAdd = Math.floor(5 / 2);
|
|
93
|
+
const newMaxPage = pagesToAdd + this.value;
|
|
94
|
+
if (newMaxPage > this.pagesName.length) {
|
|
95
|
+
return this.pagesName.length - 5 + 1;
|
|
96
|
+
}
|
|
97
|
+
return this.value - pagesToAdd;
|
|
98
|
+
} else {
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
maxPage() {
|
|
103
|
+
const pagesToDisplay = this.pagesName.length === 5 ? 5 : (this.pagesName.length);
|
|
104
|
+
if (this.value >= pagesToDisplay) {
|
|
105
|
+
const pagesToAdd = Math.floor(pagesToDisplay / 2);
|
|
106
|
+
const newMaxPage = pagesToAdd + this.value;
|
|
107
|
+
if (newMaxPage < this.pagesName.length) {
|
|
108
|
+
return newMaxPage;
|
|
109
|
+
} else {
|
|
110
|
+
return this.pagesName.length;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
return pagesToDisplay;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
data() {
|
|
118
|
+
return {
|
|
119
|
+
defaultPagesToDisplay: 1
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
methods: {
|
|
123
|
+
range(min, max) {
|
|
124
|
+
let arr = [];
|
|
125
|
+
for (let i = min; i <= max; i++) {
|
|
126
|
+
arr.push(i);
|
|
127
|
+
}
|
|
128
|
+
return arr;
|
|
129
|
+
},
|
|
130
|
+
changePage(item) {
|
|
131
|
+
console.log(item)
|
|
132
|
+
this.$emit('input', item);
|
|
133
|
+
},
|
|
134
|
+
nextPage() {
|
|
135
|
+
if (this.value < this.totalPages) {
|
|
136
|
+
this.$emit('input', this.value + 1);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
prevPage() {
|
|
140
|
+
if (this.value > 1) {
|
|
141
|
+
this.$emit('input', this.value - 1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
watch: {
|
|
146
|
+
perPage() {
|
|
147
|
+
this.$emit('input', 1);
|
|
148
|
+
},
|
|
149
|
+
total() {
|
|
150
|
+
this.$emit('input', 1);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
</script>
|
|
155
|
+
<style lang="scss" scoped>
|
|
156
|
+
|
|
157
|
+
.page-item, .page-link {
|
|
158
|
+
display: flex;
|
|
159
|
+
width: auto !important;
|
|
160
|
+
border-radius: 10rem !important;
|
|
161
|
+
|
|
162
|
+
width: fit-content;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.page-item {
|
|
166
|
+
padding: 0 !important;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.page-link {
|
|
170
|
+
padding: 0 1rem !important;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
.teste {
|
|
175
|
+
.page-link:hover {
|
|
176
|
+
color: #fff;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="card
|
|
2
|
+
<div class="card position-relative">
|
|
3
3
|
<div class="row px-4 justify-content-start">
|
|
4
4
|
<base-input
|
|
5
5
|
name="Question"
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
type="text"
|
|
9
9
|
class="col-8"
|
|
10
10
|
:error="getError('Question')"
|
|
11
|
-
:valid="isValid('Question')"
|
|
12
|
-
|
|
11
|
+
:valid="isValid('Question')"
|
|
12
|
+
:value="question.question"
|
|
13
|
+
v-on:input="setQuestion('question', $event)"
|
|
13
14
|
v-validate="'required'"/>
|
|
14
15
|
|
|
15
16
|
<div class="col-4">
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
Escolha o tipo da pergunta
|
|
18
19
|
</label>
|
|
19
20
|
<el-select class="select-danger w-100"
|
|
20
|
-
placeholder="
|
|
21
|
+
placeholder="Escolha o tipo da pergunta"
|
|
21
22
|
v-model="question.question_type">
|
|
22
23
|
<el-option v-for="option in listComponentes"
|
|
23
24
|
class="select-danger"
|
|
@@ -29,12 +30,27 @@
|
|
|
29
30
|
</div>
|
|
30
31
|
|
|
31
32
|
<div class="col-8 form-group">
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
33
|
+
<paragraph
|
|
34
|
+
v-if="question.question_type == 'paragraph'"
|
|
35
|
+
:data="question.max_char ? question.max_char : undefined"
|
|
36
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
37
|
+
<question-radio
|
|
38
|
+
v-if="question.question_type == 'multiple'"
|
|
39
|
+
:data="question.multiples"
|
|
40
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
41
|
+
<question-attach
|
|
42
|
+
v-if="question.question_type == 'question-attach'"
|
|
43
|
+
:data="question"
|
|
44
|
+
v-on:data-changed="mergeDataQuestion"/>
|
|
37
45
|
</div>
|
|
46
|
+
|
|
47
|
+
<ul class="question-icons">
|
|
48
|
+
<li v-for="(icon, index) in icons"
|
|
49
|
+
:key="`question-icon-${position}-${index}`"
|
|
50
|
+
@click="$emit(icon.event)">
|
|
51
|
+
<font-awesome-icon :icon="icon.icon" class="" />
|
|
52
|
+
</li>
|
|
53
|
+
</ul>
|
|
38
54
|
</div>
|
|
39
55
|
</div>
|
|
40
56
|
</template>
|
|
@@ -55,45 +71,54 @@ export default {
|
|
|
55
71
|
},
|
|
56
72
|
props: {
|
|
57
73
|
position: Number,
|
|
74
|
+
data: null,
|
|
75
|
+
icons: {
|
|
76
|
+
type: Array,
|
|
77
|
+
default: () => [
|
|
78
|
+
{ event: 'first-icon-click', icon: ['far', 'copy'] },
|
|
79
|
+
{ event: 'second-icon-click', icon: ['fas', 'trash-alt'] }
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
listComponentes: {
|
|
83
|
+
type: Array,
|
|
84
|
+
default: () => [
|
|
85
|
+
{ value: 'paragraph', label: 'Paragrafo' },
|
|
86
|
+
{ value: 'multiple', label: 'Alternativa' },
|
|
87
|
+
{ value: 'question-attach', label: 'Anexo' }
|
|
88
|
+
]
|
|
89
|
+
},
|
|
58
90
|
},
|
|
59
91
|
data() {
|
|
60
92
|
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
|
-
}
|
|
93
|
+
console: console,
|
|
94
|
+
question: this.data,
|
|
80
95
|
}
|
|
81
96
|
},
|
|
97
|
+
mounted() {
|
|
98
|
+
this.$validator.attach({ name: "Question", rules: "required" });
|
|
99
|
+
this.$nextTick(() => {
|
|
100
|
+
this.$validator.attach({ name: "Question", rules: "required" });
|
|
101
|
+
})
|
|
102
|
+
},
|
|
82
103
|
watch: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
104
|
+
data(newValue) {
|
|
105
|
+
this.question = newValue;
|
|
106
|
+
}
|
|
87
107
|
},
|
|
88
108
|
methods: {
|
|
89
109
|
emitQuestion() {
|
|
90
110
|
this.$emit('change-question', this.question)
|
|
91
111
|
},
|
|
92
|
-
|
|
93
|
-
|
|
112
|
+
setQuestion(type, data) {
|
|
113
|
+
this.question[type] = data
|
|
114
|
+
this.emitQuestion();
|
|
94
115
|
},
|
|
95
|
-
|
|
116
|
+
mergeDataQuestion(data) {
|
|
96
117
|
this.question = { ...this.question , ...data }
|
|
118
|
+
this.emitQuestion();
|
|
119
|
+
},
|
|
120
|
+
isChangeTypeQuestion(value) {
|
|
121
|
+
return this.listComponentes.includes(value);
|
|
97
122
|
},
|
|
98
123
|
getError(name){
|
|
99
124
|
return this.errors.first(name);
|
|
@@ -105,6 +130,21 @@ export default {
|
|
|
105
130
|
}
|
|
106
131
|
</script>
|
|
107
132
|
|
|
108
|
-
<style>
|
|
133
|
+
<style lang="scss" scoped>
|
|
134
|
+
.question-icons {
|
|
135
|
+
position: absolute;
|
|
136
|
+
bottom: 0;
|
|
137
|
+
right: 1rem;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: flex-end;
|
|
140
|
+
align-items: flex-end;
|
|
141
|
+
list-style: none;
|
|
109
142
|
|
|
143
|
+
li {
|
|
144
|
+
padding-top: 1rem;
|
|
145
|
+
padding-left: 1rem;
|
|
146
|
+
padding-right: 1rem;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
110
150
|
</style>
|
|
@@ -1,92 +1,98 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</
|
|
2
|
+
<div>
|
|
3
|
+
<el-radio-group v-model="selected" v-for="(answer, index) in answers" :key="index">
|
|
4
|
+
<question-radio-item
|
|
5
|
+
:response="answer.name"
|
|
6
|
+
v-on:change-answer="setAnswers($event, answer)"
|
|
7
|
+
></question-radio-item>
|
|
8
|
+
</el-radio-group>
|
|
9
|
+
<base-button size="sm" type="link" class="mr-0" @click="addOption">Adicionar opção</base-button>
|
|
10
|
+
<base-button size="sm" type="link" @click="removeLastOption">Remover opção</base-button>
|
|
11
|
+
</div>
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script>
|
|
14
15
|
import {Radio, RadioGroup} from 'element-ui'
|
|
15
16
|
import QuestionRadioItem from '@burh/nuxt-core/components/burh-ds/Questions/QuestionRadioItem.vue';
|
|
17
|
+
import Swal from 'sweetalert2';
|
|
16
18
|
|
|
17
19
|
export default {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
name: 'question-radio',
|
|
21
|
+
components: {
|
|
22
|
+
[Radio.name]: Radio,
|
|
23
|
+
[RadioGroup.name]: RadioGroup,
|
|
24
|
+
QuestionRadioItem
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
data: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => [{}, {}]
|
|
23
30
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
selected: null,
|
|
35
|
+
answers: this.data,
|
|
36
|
+
minRadios: 2,
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
created() {
|
|
40
|
+
this.loadAnswer();
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
addOption() {
|
|
44
|
+
this.answers.push({});
|
|
45
|
+
},
|
|
46
|
+
removeLastOption() {
|
|
47
|
+
if(this.answers.length <= this.minRadios) {
|
|
48
|
+
return Swal.fire({
|
|
49
|
+
title: 'Oops...',
|
|
50
|
+
text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
|
|
51
|
+
type: 'warning',
|
|
52
|
+
buttonsStyling: false,
|
|
53
|
+
confirmButtonText: 'Okay!',
|
|
54
|
+
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
this.answers.splice(this.answers.length - 1, 1);
|
|
58
|
+
},
|
|
59
|
+
loadAnswer() {
|
|
60
|
+
const answerSelected = this.answers.find(ans => ans.correct);
|
|
61
|
+
this.selected = answerSelected ? answerSelected.name : null;
|
|
62
|
+
},
|
|
63
|
+
setAnswers(value, answer) {
|
|
64
|
+
answer.name = value;
|
|
65
|
+
if (answer.correct) {
|
|
66
|
+
this.selected = value
|
|
67
|
+
}
|
|
68
|
+
this.emitRadioList();
|
|
29
69
|
},
|
|
30
|
-
|
|
70
|
+
makeRadiolist() {
|
|
71
|
+
const listRadio = this.answers.map(radio => {
|
|
31
72
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
minRadios: 2,
|
|
73
|
+
name: radio.name,
|
|
74
|
+
correct: radio.name === this.selected ? true : false
|
|
35
75
|
}
|
|
76
|
+
})
|
|
77
|
+
return listRadio
|
|
36
78
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.answers.splice(this.answers.length - 1, 1);
|
|
46
|
-
},
|
|
47
|
-
setAnswers(value, answer) {
|
|
48
|
-
answer['response'] = value;
|
|
49
|
-
this.emitAnswersRadio();
|
|
50
|
-
},
|
|
51
|
-
makeStructureListRadio() {
|
|
52
|
-
const listRadio = this.answers.map(radio => {
|
|
53
|
-
if ( radio.response == this.selected ) {
|
|
54
|
-
return {
|
|
55
|
-
name: radio.response,
|
|
56
|
-
correct: true,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
name: radio.response,
|
|
62
|
-
correct: false,
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
return listRadio
|
|
67
|
-
},
|
|
68
|
-
emitAnswersRadio() {
|
|
69
|
-
const payload = {
|
|
70
|
-
response: this.selected,
|
|
71
|
-
multiples: this.makeStructureListRadio()
|
|
72
|
-
}
|
|
73
|
-
this.$emit('data-changed', payload)
|
|
74
|
-
},
|
|
79
|
+
emitRadioList() {
|
|
80
|
+
const payload = {
|
|
81
|
+
response: this.selected,
|
|
82
|
+
multiples: this.makeRadiolist()
|
|
83
|
+
}
|
|
84
|
+
this.$emit('data-changed', payload)
|
|
75
85
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
data(newValue) {
|
|
89
|
+
this.answers = newValue.map(e => { return { ...e }}); //prevent cloning references
|
|
90
|
+
this.loadAnswer();
|
|
80
91
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
handler: 'emitAnswersRadio',
|
|
84
|
-
deep: true
|
|
85
|
-
},
|
|
86
|
-
selected() {
|
|
87
|
-
this.emitAnswersRadio();
|
|
88
|
-
}
|
|
92
|
+
selected() {
|
|
93
|
+
this.emitRadioList();
|
|
89
94
|
},
|
|
95
|
+
},
|
|
90
96
|
}
|
|
91
97
|
</script>
|
|
92
98
|
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</el-radio>
|
|
18
|
-
</div>
|
|
2
|
+
<el-radio
|
|
3
|
+
:label="value"
|
|
4
|
+
class="form-radio"
|
|
5
|
+
:class="{'form-radio--error': getError('Response')}">
|
|
6
|
+
<base-input
|
|
7
|
+
name="Response"
|
|
8
|
+
class=""
|
|
9
|
+
type="text"
|
|
10
|
+
placeholder="Coloque uma resposta aqui"
|
|
11
|
+
v-model="value"
|
|
12
|
+
v-on:input="$emit('change-answer', value)"
|
|
13
|
+
:error="getError('Response')"
|
|
14
|
+
:valid="isValid('Response')"
|
|
15
|
+
v-validate="'required'"/>
|
|
16
|
+
</el-radio>
|
|
19
17
|
</template>
|
|
20
18
|
|
|
21
19
|
<script>
|
|
@@ -27,10 +25,14 @@ export default {
|
|
|
27
25
|
[Radio.name]: Radio,
|
|
28
26
|
},
|
|
29
27
|
props: {
|
|
28
|
+
response: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
}
|
|
30
32
|
},
|
|
31
33
|
data() {
|
|
32
34
|
return {
|
|
33
|
-
value:
|
|
35
|
+
value: this.response,
|
|
34
36
|
}
|
|
35
37
|
},
|
|
36
38
|
methods: {
|
|
@@ -40,6 +42,11 @@ export default {
|
|
|
40
42
|
isValid(name) {
|
|
41
43
|
return this.validated && !this.errors.has(name);
|
|
42
44
|
},
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
response(newValue) {
|
|
48
|
+
this.value = this.response
|
|
49
|
+
}
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
</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
|
|