@burh/nuxt-core 1.0.129 → 1.0.130

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <default-link @click="callVideoTutorial" :link="to" class="product-item">
2
+ <default-link @click="callVideoTutorial($event)" :link="disabled ? '' : to" class="product-item" :disabled="disabled">
3
3
  <div :class="'product-item--avatar bg-'+color">
4
4
  <img :src="avatar" alt="">
5
5
  </div>
@@ -60,10 +60,11 @@ export default {
60
60
  type: String,
61
61
  default: '/'
62
62
  },
63
- indexableName: String
63
+ indexableName: String,
64
+ disabled: Boolean
64
65
  },
65
66
  methods: {
66
- callVideoTutorial() {
67
+ callVideoTutorial(e) {
67
68
  if (this.indexableName == 'VIDEO_CHAMADA') {
68
69
  this.$emit('callVideoTutorial');
69
70
  }
@@ -74,6 +75,11 @@ export default {
74
75
 
75
76
  <style lang="scss" scoped>
76
77
  .product-item {
78
+ &[disabled] {
79
+ cursor: not-allowed;
80
+ pointer-events: all !important;
81
+ }
82
+
77
83
  display: inline-block;
78
84
 
79
85
  &--title {
@@ -147,7 +147,6 @@ export default {
147
147
  setQuestion(type, data) {
148
148
  this.question[type] = data;
149
149
  this.emitQuestion();
150
-
151
150
  },
152
151
  mergeDataQuestion(data) {
153
152
  this.question = { ...this.question, ...data };
@@ -2,19 +2,22 @@
2
2
  <div class="">
3
3
  <div v-for="(answer, index) in answers" :key="index">
4
4
  <div class="d-flex w-100 align-items-start">
5
- <el-radio-group v-model="selected">
5
+ <el-radio-group v-model="selected">
6
6
  <question-radio-item
7
7
  :response="answer.name"
8
+ :index="index"
8
9
  v-on:change-answer="setAnswers($event, answer)"
9
10
  ></question-radio-item>
10
- </el-radio-group>
11
- <el-tooltip class="item" effect="dark" content="Remover alternativa" placement="top">
12
- <base-button size="sm" type="link" class="text-danger px-2 w-auto m-0 ml-2" @click="removeLastOption">
13
- <font-awesome-icon icon="trash" />
14
- </base-button>
15
- </el-tooltip>
11
+ </el-radio-group>
12
+
13
+ <el-tooltip class="item" effect="dark" content="Remover alternativa" placement="top">
14
+ <base-button size="sm" type="link" class="text-danger px-2 w-auto m-0 ml-2" @click="removeLastOption">
15
+ <font-awesome-icon icon="trash" />
16
+ </base-button>
17
+ </el-tooltip>
16
18
  </div>
17
19
  </div>
20
+
18
21
  <ul class="list-inline">
19
22
  <li class="list-inline-item">
20
23
  <base-button size="xs" type="link" class="mr-0" @click="addOption">
@@ -43,8 +46,8 @@ export default {
43
46
  },
44
47
  props: {
45
48
  data: {
46
- type: Array,
47
- default: () => [{}, {}]
49
+ type: Array,
50
+ default: () => [{}, {}]
48
51
  },
49
52
  },
50
53
  data() {
@@ -61,42 +64,44 @@ export default {
61
64
  removeLastOption() {
62
65
  if(this.answers.length <= this.minRadios) {
63
66
  return Swal.fire({
64
- title: 'Erro',
65
- text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
66
- type: 'warning',
67
- buttonsStyling: false,
68
- confirmButtonText: 'Entendido',
69
- confirmButtonClass: 'btn btn-primary btn-fill',
67
+ title: 'Erro',
68
+ text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
69
+ type: 'warning',
70
+ buttonsStyling: false,
71
+ confirmButtonText: 'Entendido',
72
+ confirmButtonClass: 'btn btn-primary btn-fill',
70
73
  })
71
- }
74
+ }
75
+
72
76
  this.answers.splice(this.answers.length - 1, 1);
77
+
78
+ this.emitRadioList();
73
79
  },
74
- setAnswers({id, value}, answer) {
80
+ setAnswers({ index, value }, answer) {
75
81
  answer.name = value;
76
- answer.id = id;
77
82
 
78
- if(this.selected == null && answer.correct != false) { // be carefully here, correct can be null
79
- this.selected = answer.id
83
+ if (this.selected == null && answer.correct != false) { // be carefully here, correct can be null
84
+ this.selected = index
80
85
  }
81
86
 
82
87
  this.emitRadioList();
83
88
  },
84
89
  makeRadiolist() {
85
- const listRadio = this.answers.map(radio => {
86
-
90
+ const listRadio = this.answers.map((radio, idx) => {
87
91
  return {
88
92
  id: radio.id,
89
93
  name: radio.name,
90
- correct: radio.id === this.selected ? true : false
94
+ correct: idx == this.selected ? true : false
91
95
  }
92
96
  })
97
+
93
98
  return listRadio
94
99
  },
95
100
  emitRadioList() {
96
101
  const payload = {
97
- // response: this.selected,
98
102
  multiples: this.makeRadiolist()
99
103
  }
104
+
100
105
  this.$emit('data-changed', payload)
101
106
  },
102
107
  },
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <validation-provider tag="div" class="" :vid="`radio-${id}`"
2
+ <validation-provider tag="div" class="" :vid="`radio-${index}`"
3
3
  name="Resposta" rules="required" v-slot="{ errors }">
4
4
  <el-radio
5
- :label="id"
5
+ :label="index"
6
6
  class="form-radio"
7
7
  :class="{'form-radio--error': errors[0]}">
8
8
  <base-input
@@ -13,7 +13,7 @@
13
13
  v-model="value"
14
14
  :error="errors[0]"
15
15
  :valid="errors.length ? true : false"
16
- v-on:input="$emit('change-answer', {id, value})">
16
+ v-on:input="$emit('change-answer', { index, value })">
17
17
  </base-input>
18
18
  </el-radio>
19
19
  </validation-provider>
@@ -28,17 +28,20 @@ export default {
28
28
  [Radio.name]: Radio,
29
29
  },
30
30
  props: {
31
+ index: {
32
+ type: Number,
33
+ default: null
34
+ },
31
35
  response: {
32
36
  type: String,
33
37
  default: ''
34
38
  }
35
39
  },
36
40
  created() {
37
- this.$emit('change-answer', {id: this.id, value: this.value});
41
+ this.$emit('change-answer', { index: this.index, value: this.value });
38
42
  },
39
43
  data() {
40
44
  return {
41
- id: this.$uuid.v4(),
42
45
  value: this.response,
43
46
  }
44
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.129",
3
+ "version": "1.0.130",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {