@burh/nuxt-core 1.0.23 → 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.
@@ -6,11 +6,9 @@
6
6
  placeholder="Escreva o nome da etapa"
7
7
  type="text"
8
8
  class=""
9
- :error="getError('Ask')"
10
- :valid="isValid('Ask')"
11
9
  v-on:input="emitStage()"
12
10
  v-model="name"
13
- v-validate="'required'"/>
11
+ />
14
12
 
15
13
  <div class="pb-3">
16
14
  <textarea
@@ -64,12 +62,6 @@ export default {
64
62
  }
65
63
  },
66
64
  methods: {
67
- getError(name){
68
- return this.errors.first(name);
69
- },
70
- isValid(name) {
71
- return this.validated && !this.errors.has(name);
72
- },
73
65
  emitStage() {
74
66
  this.$emit('change-stage',
75
67
  {
@@ -19,6 +19,7 @@ import Loading from 'vue-loading-overlay';
19
19
  import 'vue-loading-overlay/dist/vue-loading.css';
20
20
 
21
21
  export default {
22
+ name: 'loading-full-page',
22
23
  // data() {
23
24
  // return {
24
25
  // isLoading: false,
@@ -3,34 +3,19 @@
3
3
  <template slot="header">
4
4
  <h2 class="display-4 px-4">Insira os e-mail que deseja enviar o teste</h2>
5
5
  </template>
6
- <div class="row px-4">
7
- <div class="col-3">
8
- <label for="name">Nome(opcional)</label>
9
- </div>
10
- <div class="col-3">
11
- <label for="email">E-mail</label>
12
- </div>
13
- <div class="col-3">
6
+ <div class="row px-4 justify-content-start">
7
+ <div class="col-4">
14
8
  <label for="teste">Selecione a vaga</label>
15
9
  </div>
16
- <div class="col-3">
10
+ <div class="col-4">
17
11
  <label for="teste">Selecione o teste</label>
18
12
  </div>
19
13
  </div>
20
- <div class="row px-4"
21
- v-for="(slot, idx) in slots"
22
- :key="idx"
23
- >
24
- <div class="col-3">
25
- <base-input v-model="slot.name"/>
26
- </div>
27
- <div class="col-3">
28
- <base-input v-model="slot.email"/>
29
- </div>
30
- <div class="col-3">
14
+ <div class="row px-4 justify-content-start">
15
+ <div class="col-4">
31
16
  <el-select
32
17
  placeholder="Escolha a vaga"
33
- v-model="slot.jobid">
18
+ v-model="jobid">
34
19
  <el-option v-for="job in allJobs"
35
20
  class="select-danger"
36
21
  :value="job.id"
@@ -38,11 +23,12 @@
38
23
  :key="job.id">
39
24
  </el-option>
40
25
  </el-select>
26
+ <span></span>
41
27
  </div>
42
- <div class="col-2">
28
+ <div class="col-4">
43
29
  <el-select
44
30
  placeholder="Escolha o teste"
45
- v-model="slot.testid">
31
+ v-model="testid">
46
32
  <el-option v-for="test in allTests"
47
33
  class="select-danger"
48
34
  :value="test.id"
@@ -51,6 +37,26 @@
51
37
  </el-option>
52
38
  </el-select>
53
39
  </div>
40
+ </div>
41
+ <hr>
42
+ <div class="row px-4">
43
+ <div class="col-4">
44
+ <label for="name">Nome(opcional)</label>
45
+ </div>
46
+ <div class="col-8">
47
+ <label for="email">E-mail</label>
48
+ </div>
49
+ </div>
50
+ <div class="row px-4"
51
+ v-for="(slot, idx) in slots"
52
+ :key="idx"
53
+ >
54
+ <div class="col-4">
55
+ <base-input v-model="slot.name"/>
56
+ </div>
57
+ <div class="col-7">
58
+ <base-input v-model="slot.email"/>
59
+ </div>
54
60
  <div class="col-1">
55
61
  <i v-if="idx !== (slots.length - 1)" class="fa fa-trash pointer" @click="removeSlot(slot.id)"></i>
56
62
  <i v-else class="fa fa-plus pointer" @click="addSlot"></i>
@@ -98,52 +104,46 @@ export default {
98
104
  this.slots = [...this.slots, newSlot];
99
105
  },
100
106
  sendTest() {
101
- const testRequest = this.slots;
107
+ const filterSlots = slot => slot.email !== "";
108
+ const formatRequest = slot => ({...slot, jobid: this.jobid, testid: this.testid});
109
+ const testRequest = this.slots.filter(filterSlots).map(formatRequest);
102
110
  this.$emit('send-test', testRequest);
103
111
  }
104
112
  },
105
113
  watch: {
106
114
  selectedTest(newValue) {
107
- this.slots = this.slots.map(slot => ({...slot, testid: newValue}));
115
+ this.testid = newValue;
108
116
  }
109
117
  },
110
118
  data() {
111
119
  return {
120
+ jobid: null,
121
+ testid: this.selectedTest,
112
122
  slots: [
113
123
  {
114
124
  id: 'first',
115
125
  name: '',
116
126
  email: '',
117
- testid: this.selectedTest,
118
- jobid: null,
119
127
  },
120
128
  {
121
129
  id: 'second',
122
130
  name: '',
123
131
  email: '',
124
- testid: this.selectedTest,
125
- jobid: null,
126
132
  },
127
133
  {
128
134
  id: 'third',
129
135
  name: '',
130
136
  email: '',
131
- testid: this.selectedTest,
132
- jobid: null,
133
137
  },
134
138
  {
135
139
  id: 'fourth',
136
140
  name: '',
137
141
  email: '',
138
- testid: this.selectedTest,
139
- jobid: null,
140
142
  },
141
143
  {
142
144
  id: 'fifth',
143
145
  name: '',
144
146
  email: '',
145
- testid: this.selectedTest,
146
- jobid: null,
147
147
  }
148
148
  ]
149
149
  }
@@ -87,36 +87,12 @@ export default {
87
87
  }
88
88
  return this.defaultPagesToDisplay;
89
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
90
  },
117
91
  data() {
118
92
  return {
119
- defaultPagesToDisplay: 1
93
+ defaultPagesToDisplay: 1,
94
+ minPage: 1,
95
+ maxPage: this.pagesName.length >= 5 ? 5 : this.pagesName.length,
120
96
  };
121
97
  },
122
98
  methods: {
@@ -128,7 +104,6 @@ export default {
128
104
  return arr;
129
105
  },
130
106
  changePage(item) {
131
- console.log(item)
132
107
  this.$emit('input', item);
133
108
  },
134
109
  nextPage() {
@@ -148,7 +123,24 @@ export default {
148
123
  },
149
124
  total() {
150
125
  this.$emit('input', 1);
151
- }
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
+ }
152
144
  }
153
145
  };
154
146
  </script>
@@ -1,17 +1,18 @@
1
1
  <template>
2
2
  <div class="card position-relative">
3
3
  <div class="row px-4 justify-content-start">
4
- <base-input
5
- name="Question"
6
- :label="`Pergunta #${position + 1}`"
7
- placeholder="Escreva uma pergunta"
8
- type="text"
9
- class="col-8"
10
- :error="getError('Question')"
11
- :valid="isValid('Question')"
12
- :value="question.question"
13
- v-on:input="setQuestion('question', $event)"
14
- v-validate="'required'"/>
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>
15
16
 
16
17
  <div class="col-4">
17
18
  <label class="form-control-label d-block pt-1">
@@ -39,7 +40,7 @@
39
40
  :data="question.multiples"
40
41
  v-on:data-changed="mergeDataQuestion"/>
41
42
  <question-attach
42
- v-if="question.question_type == 'question-attach'"
43
+ v-if="question.question_type == 'annex'"
43
44
  :data="question"
44
45
  v-on:data-changed="mergeDataQuestion"/>
45
46
  </div>
@@ -70,7 +71,14 @@ export default {
70
71
  QuestionAttach
71
72
  },
72
73
  props: {
73
- position: Number,
74
+ stepIndex: {
75
+ type: Number,
76
+ default: 0
77
+ },
78
+ position: {
79
+ type: Number,
80
+ default: 0
81
+ },
74
82
  data: null,
75
83
  icons: {
76
84
  type: Array,
@@ -84,7 +92,7 @@ export default {
84
92
  default: () => [
85
93
  { value: 'paragraph', label: 'Paragrafo' },
86
94
  { value: 'multiple', label: 'Alternativa' },
87
- { value: 'question-attach', label: 'Anexo' }
95
+ { value: 'annex', label: 'Anexo' }
88
96
  ]
89
97
  },
90
98
  },
@@ -94,12 +102,6 @@ export default {
94
102
  question: this.data,
95
103
  }
96
104
  },
97
- mounted() {
98
- this.$validator.attach({ name: "Question", rules: "required" });
99
- this.$nextTick(() => {
100
- this.$validator.attach({ name: "Question", rules: "required" });
101
- })
102
- },
103
105
  watch: {
104
106
  data(newValue) {
105
107
  this.question = newValue;
@@ -120,12 +122,6 @@ export default {
120
122
  isChangeTypeQuestion(value) {
121
123
  return this.listComponentes.includes(value);
122
124
  },
123
- getError(name){
124
- return this.errors.first(name);
125
- },
126
- isValid(name) {
127
- return this.validated && !this.errors.has(name);
128
- },
129
125
  }
130
126
  }
131
127
  </script>
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <div>
3
- <el-radio-group v-model="selected" v-for="(answer, index) in answers" :key="index">
3
+ <el-radio-group v-model="selected">
4
4
  <question-radio-item
5
+ v-for="(answer, index) in answers" :key="index"
5
6
  :response="answer.name"
6
7
  v-on:change-answer="setAnswers($event, answer)"
7
8
  ></question-radio-item>
@@ -17,82 +18,79 @@ import QuestionRadioItem from '@burh/nuxt-core/components/burh-ds/Questions/Ques
17
18
  import Swal from 'sweetalert2';
18
19
 
19
20
  export default {
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: () => [{}, {}]
21
+ name: 'question-radio',
22
+ components: {
23
+ [Radio.name]: Radio,
24
+ [RadioGroup.name]: RadioGroup,
25
+ QuestionRadioItem
30
26
  },
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({});
27
+ props: {
28
+ data: {
29
+ type: Array,
30
+ default: () => [{}, {}]
31
+ },
45
32
  },
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();
69
- },
70
- makeRadiolist() {
71
- const listRadio = this.answers.map(radio => {
33
+ data() {
72
34
  return {
73
- name: radio.name,
74
- correct: radio.name === this.selected ? true : false
35
+ selected: null,
36
+ answers: this.data,
37
+ minRadios: 2,
75
38
  }
76
- })
77
- return listRadio
78
- },
79
- emitRadioList() {
80
- const payload = {
81
- response: this.selected,
82
- multiples: this.makeRadiolist()
83
- }
84
- this.$emit('data-changed', payload)
85
39
  },
86
- },
87
- watch: {
88
- data(newValue) {
89
- this.answers = newValue.map(e => { return { ...e }}); //prevent cloning references
90
- this.loadAnswer();
40
+ methods: {
41
+ addOption() {
42
+ this.answers.push({});
43
+ },
44
+ removeLastOption() {
45
+ if(this.answers.length <= this.minRadios) {
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
+ })
54
+ }
55
+ this.answers.splice(this.answers.length - 1, 1);
56
+ },
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();
66
+ },
67
+ makeRadiolist() {
68
+ const listRadio = this.answers.map(radio => {
69
+
70
+ return {
71
+ id: radio.id,
72
+ name: radio.name,
73
+ correct: radio.id === this.selected ? true : false
74
+ }
75
+ })
76
+ return listRadio
77
+ },
78
+ emitRadioList() {
79
+ const payload = {
80
+ response: this.selected,
81
+ multiples: this.makeRadiolist()
82
+ }
83
+ this.$emit('data-changed', payload)
84
+ },
91
85
  },
92
- selected() {
93
- this.emitRadioList();
86
+ watch: {
87
+ data(newValue) {
88
+ this.answers = newValue.map(e => { return { ...e }}); //prevent cloning references
89
+ },
90
+ selected() {
91
+ this.emitRadioList();
92
+ },
94
93
  },
95
- },
96
94
  }
97
95
  </script>
98
96
 
@@ -1,19 +1,22 @@
1
1
  <template>
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>
2
+ <validation-provider tag="div" class="" :vid="`radio-${id}`"
3
+ name="Resposta" rules="required" v-slot="{ errors }">
4
+ <el-radio
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>
18
+ </el-radio>
19
+ </validation-provider>
17
20
  </template>
18
21
 
19
22
  <script>
@@ -30,19 +33,15 @@ export default {
30
33
  default: ''
31
34
  }
32
35
  },
36
+ created() {
37
+ this.$emit('change-answer', {id: this.id, value: this.value});
38
+ },
33
39
  data() {
34
40
  return {
41
+ id: this.$uuid.v4(),
35
42
  value: this.response,
36
43
  }
37
44
  },
38
- methods: {
39
- getError(name){
40
- return this.errors.first(name);
41
- },
42
- isValid(name) {
43
- return this.validated && !this.errors.has(name);
44
- },
45
- },
46
45
  watch: {
47
46
  response(newValue) {
48
47
  this.value = this.response
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {