@burh/nuxt-core 1.0.435 → 1.0.437

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,6 +1,6 @@
1
1
  <template>
2
2
  <base-header class="app-header" :type="'white'">
3
- <div class="row justify-content-between">
3
+ <div class="row justify-content-between app__header">
4
4
  <div
5
5
  :class="{ 'images__container': users.length }"
6
6
  class="col-8 my-auto header__container"
@@ -8,7 +8,7 @@
8
8
  <slot name="header-top" />
9
9
 
10
10
  <div class="header__content">
11
- <div class="d-flex align-items-center justify-content-center flex-row">
11
+ <div class="d-flex align-items-center justify-content-center flex-row header__title" :class="{ hasBackButton }">
12
12
  <button class="back__button" v-if="hasBackButton" @click="goBack()">
13
13
  <i class="fas fa-arrow-left"></i>
14
14
  </button>
@@ -25,7 +25,7 @@
25
25
  </div>
26
26
  <div class="images" v-if="users.length">
27
27
  <el-tooltip
28
- v-for="user in users"
28
+ v-for="user in users.slice(0, 5)"
29
29
  :key="user.id"
30
30
  placement="top"
31
31
  :content="user.name"
@@ -42,6 +42,33 @@
42
42
  :style=" `--avatar-color: #${avatarColor}` "
43
43
  />
44
44
  </el-tooltip>
45
+
46
+ <template v-if="users.length > 5">
47
+ <el-dropdown trigger="click" class="ml-4">
48
+ <span class="app__header__dropdown__title" :class="{ 'app__header__dropdown__title--active': users.map(user => user.id).includes(activeUserId) }" draggable="false">
49
+ + {{ users.slice(5).length }}
50
+ </span>
51
+ <el-dropdown-menu slot="dropdown" class="app__header__imagems__dropdown">
52
+ <el-dropdown-item
53
+ v-for="user in users.slice(5)"
54
+ :key="user.id"
55
+ @click.native="setActiveUser(user.id)"
56
+ >
57
+ <div class="dropdown__user__data" :class="{ 'dropdown__user__data--active': activeUserId === user.id }">
58
+ <image-with-fallback
59
+ :src="user.avatar"
60
+ :alt="user.name"
61
+ :fallbackText="user.name"
62
+ :fallbackBackground="avatarColor"
63
+ fallbackSize="200x200"
64
+ :style=" `--avatar-color: #${avatarColor}` "
65
+ />
66
+ <span>{{ user.name }} {{ user.last_name }}</span>
67
+ </div>
68
+ </el-dropdown-item>
69
+ </el-dropdown-menu>
70
+ </el-dropdown>
71
+ </template>
45
72
  </div>
46
73
  </div>
47
74
 
@@ -52,7 +79,7 @@
52
79
  <slot name="header-bottom" />
53
80
  </div>
54
81
 
55
- <div class="col-4 d-flex justify-content-end align-items-start">
82
+ <div class="col-4 d-flex justify-content-end align-items-start footer__content">
56
83
  <el-tooltip v-for="(item, index) in icons" :key="index"
57
84
  v-show="!item.disabled"
58
85
  class="item" effect="dark" :content="item.title" placement="top">
@@ -70,7 +97,13 @@
70
97
  </base-header>
71
98
  </template>
72
99
  <script>
100
+ import { Dropdown, DropdownMenu, DropdownItem } from 'element-ui';
73
101
  export default {
102
+ components: {
103
+ ElDropdown: Dropdown,
104
+ ElDropdownMenu: DropdownMenu,
105
+ ElDropdownItem: DropdownItem,
106
+ },
74
107
  data(){
75
108
  return{
76
109
  default: '',
@@ -131,7 +164,119 @@ export default {
131
164
  }
132
165
  };
133
166
  </script>
167
+ <style lang="scss">
168
+ .app__header__imagems__dropdown {
169
+ max-height: 300px;
170
+ overflow: hidden;
171
+ overflow-y: scroll;
172
+ &::-webkit-scrollbar {
173
+ width: 8px;
174
+ }
175
+
176
+ &::-webkit-scrollbar-track {
177
+ background: #f5f5f5;
178
+ }
179
+
180
+ &::-webkit-scrollbar-thumb {
181
+ background: #e9e8e8;
182
+ border-radius: 10px;
183
+ }
184
+ .dropdown__user__data {
185
+ display: grid;
186
+ grid-template-columns: 40px 1fr;
187
+ align-items: center;
188
+ margin-bottom: 5px;
189
+ img {
190
+ width: 32px;
191
+ height: 32px;
192
+ border-radius: 100px;
193
+ display: block;
194
+ border: 2px solid transparent;
195
+ }
196
+ span {
197
+ font-weight: 500;
198
+ }
199
+ &--active {
200
+ img {
201
+ border-color: #1F8CEB;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ </style>
207
+
134
208
  <style lang="scss" scoped>
209
+ @media (max-width: 850px) {
210
+ .app__header {
211
+ .header__container {
212
+ width: 100%!important;
213
+ max-width: none!important;
214
+ }
215
+ .hasBackButton {
216
+ flex-direction: row!important;
217
+ justify-content: flex-start!important;
218
+ }
219
+ .header__content {
220
+ width: 100%!important;
221
+ max-width: none!important;
222
+ flex-direction: column!important;
223
+ text-align: left!important;
224
+ align-items: flex-start!important;
225
+ justify-content: flex-start!important;
226
+ > .images {
227
+ margin: 0!important;
228
+ margin-top: 10px!important;
229
+ }
230
+ }
231
+ }
232
+ }
233
+ @media (max-width: 600px) {
234
+ .app__header {
235
+ display: flex!important;
236
+ flex-direction: column!important;
237
+ .header__content {
238
+ .header__title {
239
+ width: 100%!important;
240
+ max-width: none!important;
241
+ text-align: left!important;
242
+ align-items: flex-start!important;
243
+ justify-content: flex-start!important;
244
+ &:not(:has(.hasBackButton)) {
245
+ flex-direction: column!important;
246
+ }
247
+ }
248
+ }
249
+ .footer__content {
250
+ width: 100%!important;
251
+ max-width: none!important;
252
+ padding: 0!important;
253
+ display: grid!important;
254
+ grid-template-columns: repeat(auto-fit, minmax(calc(100% / 2), 1fr));
255
+ justify-content: stretch!important;
256
+ /deep/ button {
257
+ width: 100%!important;
258
+ }
259
+ }
260
+ }
261
+ }
262
+
263
+ .app__header__dropdown__title {
264
+ background: #8DA2B5;
265
+ color: #fff;
266
+ width: 42px;
267
+ height: 42px;
268
+ display: grid;
269
+ place-items: center;
270
+ border-radius: 100px;
271
+ border: 2px solid #fff;
272
+ margin-left: -34px;
273
+ font-size: 0.7rem;
274
+ user-select: none;
275
+ &--active {
276
+ border-color: #1F8CEB;
277
+ }
278
+ }
279
+
135
280
  #credits-amount {
136
281
  margin: 0!important;
137
282
  min-width: 8em;
@@ -1,82 +1,84 @@
1
1
  <template>
2
- <div class="card position-relative">
3
- <div class="row px-4 justify-content-start">
4
- <div class="col-12 col-md-8">
5
- <label class="form-control-label d-block pt-1">
6
- {{ `Pergunta #${position + 1}` }}
7
- </label>
8
- <html-editor
9
- placeholder="Escreva uma pergunta"
10
- :value="question.question"
11
- :baseApiUrl="baseApiUrl"
12
- :token="token"
13
- v-on:input="setQuestion('question', $event)"
14
- />
15
- </div>
2
+ <div class="card position-relative">
3
+ <div class="row px-4 justify-content-start">
4
+ <div class="col-12 col-md-8">
5
+ <label class="form-control-label d-block pt-1">
6
+ {{ `Pergunta #${position + 1}` }}
7
+ </label>
8
+ <html-editor
9
+ v-if="isHtmlEditorActive"
10
+ placeholder="Escreva uma pergunta"
11
+ :value="question.question"
12
+ :baseApiUrl="baseApiUrl"
13
+ :token="token"
14
+ @input="handleInput"
15
+ />
16
+ <div @click="handleLoadHtmlEditor" v-if="!isHtmlEditorActive" class="question__preview" v-html="question.question"></div>
17
+ </div>
16
18
 
17
- <div class="col-12 col-md-4 mb-4 mb-md-0">
18
- <label class="form-control-label d-block pt-1">
19
- Tipo
20
- </label>
21
- <el-select
22
- class="select-danger w-100"
23
- placeholder="Escolha o tipo da pergunta"
24
- v-on:change="emitQuestion"
25
- v-model="question.question_type"
26
- >
27
- <el-option
28
- v-for="option in listComponentes"
29
- class="select-danger"
30
- :value="option.value"
31
- :label="option.label"
32
- :key="option.label"
33
- >
34
- </el-option>
35
- </el-select>
36
- </div>
19
+ <div class="col-12 col-md-4 mb-4 mb-md-0">
20
+ <label class="form-control-label d-block pt-1">
21
+ Tipo
22
+ </label>
23
+ <el-select
24
+ class="select-danger w-100"
25
+ placeholder="Escolha o tipo da pergunta"
26
+ v-on:change="emitQuestion"
27
+ v-model="question.question_type"
28
+ >
29
+ <el-option
30
+ v-for="option in listComponentes"
31
+ class="select-danger"
32
+ :value="option.value"
33
+ :label="option.label"
34
+ :key="option.label"
35
+ >
36
+ </el-option>
37
+ </el-select>
38
+ </div>
37
39
 
38
- <div class="col-12 col-md-8 form-group">
39
- <paragraph
40
- v-if="question.question_type == 'paragraph'"
41
- :data="question.max_char ? question.max_char : undefined"
42
- v-on:data-changed="mergeDataQuestion"
43
- />
44
- <question-radio
45
- v-if="question.question_type == 'multiple'"
46
- :data="question.multiples"
47
- v-on:data-changed="mergeDataQuestion"
48
- />
49
- <question-attach
50
- v-if="question.question_type == 'annex'"
51
- :data="question"
52
- v-on:data-changed="mergeDataQuestion"
53
- />
54
- </div>
55
- <div class="col-12 text-right pb-2">
56
- <ul class="question-icons list-inline">
57
- <li
58
- v-for="(icon, index) in icons"
59
- :key="`question-icon-${position}-${index}`"
60
- @click="$emit(icon.event)"
61
- :class="`list-inline-item text-${icon.type}`"
62
- >
63
- <el-tooltip
64
- class="item"
65
- effect="dark"
66
- :content="icon.alt"
67
- placement="top"
68
- >
69
- <font-awesome-icon
70
- :icon="icon.icon"
71
- :class="`icon-${icon.type}`"
72
- :title="icon.alt"
73
- />
74
- </el-tooltip>
75
- </li>
76
- </ul>
77
- </div>
78
- </div>
79
- </div>
40
+ <div class="col-12 col-md-8 form-group">
41
+ <paragraph
42
+ v-if="question.question_type == 'paragraph'"
43
+ :data="question.max_char ? question.max_char : undefined"
44
+ v-on:data-changed="mergeDataQuestion"
45
+ />
46
+ <question-radio
47
+ v-if="question.question_type == 'multiple'"
48
+ :data="question.multiples"
49
+ v-on:data-changed="mergeDataQuestion"
50
+ />
51
+ <question-attach
52
+ v-if="question.question_type == 'annex'"
53
+ :data="question"
54
+ v-on:data-changed="mergeDataQuestion"
55
+ />
56
+ </div>
57
+ <div class="col-12 text-right pb-2">
58
+ <ul class="question-icons list-inline">
59
+ <li
60
+ v-for="(icon, index) in icons"
61
+ :key="`question-icon-${position}-${index}`"
62
+ @click="$emit(icon.event)"
63
+ :class="`list-inline-item text-${icon.type}`"
64
+ >
65
+ <el-tooltip
66
+ class="item"
67
+ effect="dark"
68
+ :content="icon.alt"
69
+ placement="top"
70
+ >
71
+ <font-awesome-icon
72
+ :icon="icon.icon"
73
+ :class="`icon-${icon.type}`"
74
+ :title="icon.alt"
75
+ />
76
+ </el-tooltip>
77
+ </li>
78
+ </ul>
79
+ </div>
80
+ </div>
81
+ </div>
80
82
  </template>
81
83
 
82
84
  <script>
@@ -87,79 +89,95 @@ import QuestionAttach from '@burh/nuxt-core/components/burh-ds/Questions/Questio
87
89
  import HtmlEditor from '@burh/nuxt-core/components/burh-ds/Inputs/HtmlEditor.vue';
88
90
 
89
91
  export default {
90
- components: {
91
- [Select.name]: Select,
92
- [Option.name]: Option,
93
- Paragraph: QuestionText,
94
- QuestionRadio,
95
- QuestionAttach,
96
- HtmlEditor
97
- },
98
- props: {
99
- step: {
100
- type: Number,
101
- default: 0
102
- },
103
- position: {
104
- type: Number,
105
- default: 0
106
- },
107
- data: null,
108
- baseApiUrl: String,
109
- token: String,
110
- icons: {
111
- type: Array,
112
- default: () => [
113
- {
114
- event: 'first-icon-click',
115
- icon: ['far', 'copy'],
116
- alt: 'Clonar questão',
117
- type: 'primary'
118
- },
119
- {
120
- event: 'second-icon-click',
121
- icon: ['fas', 'trash-alt'],
122
- alt: 'Remover questão',
123
- type: 'danger'
124
- }
125
- ]
126
- },
127
- listComponentes: {
128
- type: Array,
129
- default: () => [
130
- { value: 'paragraph', label: 'Paragrafo' },
131
- { value: 'multiple', label: 'Alternativa' },
132
- { value: 'annex', label: 'Anexo' }
133
- ]
134
- }
135
- },
136
- data() {
137
- return {
138
- console: console,
139
- question: this.data
140
- };
141
- },
142
- watch: {
143
- data(newValue) {
144
- this.question = newValue;
145
- }
146
- },
147
- methods: {
148
- emitQuestion() {
149
- this.$emit('change-question', this.question);
150
- },
151
- setQuestion(type, data) {
152
- this.question[type] = data;
153
- this.emitQuestion();
154
- },
155
- mergeDataQuestion(data) {
156
- this.question = { ...this.question, ...data };
157
- this.emitQuestion();
158
- },
159
- isChangeTypeQuestion(value) {
160
- return this.listComponentes.includes(value);
161
- }
162
- }
92
+ components: {
93
+ [Select.name]: Select,
94
+ [Option.name]: Option,
95
+ Paragraph: QuestionText,
96
+ QuestionRadio,
97
+ QuestionAttach,
98
+ HtmlEditor
99
+ },
100
+ props: {
101
+ step: {
102
+ type: Number,
103
+ default: 0
104
+ },
105
+ position: {
106
+ type: Number,
107
+ default: 0
108
+ },
109
+ data: null,
110
+ baseApiUrl: String,
111
+ token: String,
112
+ icons: {
113
+ type: Array,
114
+ default: () => [
115
+ {
116
+ event: 'first-icon-click',
117
+ icon: ['far', 'copy'],
118
+ alt: 'Clonar questão',
119
+ type: 'primary'
120
+ },
121
+ {
122
+ event: 'second-icon-click',
123
+ icon: ['fas', 'trash-alt'],
124
+ alt: 'Remover questão',
125
+ type: 'danger'
126
+ }
127
+ ]
128
+ },
129
+ listComponentes: {
130
+ type: Array,
131
+ default: () => [
132
+ { value: 'paragraph', label: 'Paragrafo' },
133
+ { value: 'multiple', label: 'Alternativa' },
134
+ { value: 'annex', label: 'Anexo' }
135
+ ]
136
+ }
137
+ },
138
+ data() {
139
+ return {
140
+ console: console,
141
+ question: this.data,
142
+ isHtmlEditorActive: false,
143
+ htmlEditorActiveTimer: null
144
+ };
145
+ },
146
+ watch: {
147
+ data(newValue) {
148
+ this.question = newValue;
149
+ }
150
+ },
151
+ methods: {
152
+ setHtmlEditorTimeout() {
153
+ clearTimeout(this.htmlEditorActiveTimer);
154
+ this.htmlEditorActiveTimer = setTimeout(() => this.isHtmlEditorActive = false, (1000 * 10));
155
+ },
156
+ handleInput($event) {
157
+ this.setHtmlEditorTimeout();
158
+
159
+ this.setQuestion('question', $event);
160
+ },
161
+ handleLoadHtmlEditor() {
162
+ this.isHtmlEditorActive = true;
163
+
164
+ this.setHtmlEditorTimeout();
165
+ },
166
+ emitQuestion() {
167
+ this.$emit('change-question', this.question);
168
+ },
169
+ setQuestion(type, data) {
170
+ this.question[type] = data;
171
+ this.emitQuestion();
172
+ },
173
+ mergeDataQuestion(data) {
174
+ this.question = { ...this.question, ...data };
175
+ this.emitQuestion();
176
+ },
177
+ isChangeTypeQuestion(value) {
178
+ return this.listComponentes.includes(value);
179
+ }
180
+ }
163
181
  };
164
182
  </script>
165
183
 
@@ -180,4 +198,13 @@ export default {
180
198
  cursor: pointer;
181
199
  }
182
200
  }
201
+
202
+ .question__preview {
203
+ background: #e9e9e9;
204
+ height: 200px;
205
+ padding: 20px;
206
+ margin: 20px 0;
207
+ border-radius: 4px;
208
+ user-select: none;
209
+ }
183
210
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burh/nuxt-core",
3
- "version": "1.0.435",
3
+ "version": "1.0.437",
4
4
  "description": "Design System and Components.",
5
5
  "author": "Burh",
6
6
  "scripts": {