@burh/nuxt-core 1.1.23 → 1.1.26

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,403 +1,403 @@
1
- <template>
2
- <base-header class="app-header" :type="'white'">
3
- <div :class="headerClass">
4
- <div
5
- :class="{ 'images__container': users.length }"
6
- class="col-8 my-auto header__container"
7
- >
8
- <slot name="header-top" />
9
-
10
- <div class="header__content">
11
- <div class="d-flex align-items-center justify-content-center flex-row header__title" :class="{ hasBackButton }">
12
- <button class="back__button" v-if="hasBackButton" @click="goBack()">
13
- <i class="fas fa-arrow-left"></i>
14
- </button>
15
- <h2 class="font-weight-bold display-3">{{name}}</h2>
16
- <badge
17
- v-if="beta"
18
- rounded
19
- size="md"
20
- class="badge-font ml-2 mb-2"
21
- type="primary"
22
- >
23
- BETA
24
- </badge>
25
- </div>
26
- <div class="images" v-if="users.length">
27
- <el-tooltip
28
- v-for="user in users.slice(0, 5)"
29
- :key="user.id"
30
- placement="top"
31
- :content="user.name"
32
- class="user__avatar"
33
- :class="{ 'user__avatar--active': activeUserId === user.id }"
34
- >
35
- <image-with-fallback
36
- @click.native="setActiveUser(user.id)"
37
- :src="user.avatar"
38
- :alt="user.name"
39
- :fallbackText="user.name"
40
- fallbackSize="200"
41
- :fallbackBackground="avatarColor"
42
- :style=" `--avatar-color: #${avatarColor}`"
43
- />
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
- fallbackSize="200"
63
- :fallbackBackground="avatarColor"
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>
72
- </div>
73
- </div>
74
-
75
- <span id="credits-amount" v-if="subheader !== null">
76
- <template v-if="subheader >= 0">
77
- {{ subheader }} {{ $t('app_header.credits') }}
78
- </template>
79
-
80
- <template v-else>
81
- {{ $t('app_header.unlimited_credits') }}
82
- </template>
83
- </span>
84
-
85
- <slot name="header-bottom" />
86
- </div>
87
-
88
- <div class="col-4 d-flex justify-content-end align-items-start footer__content">
89
- <el-tooltip v-for="(item, index) in icons" :key="index"
90
- v-show="!item.disabled"
91
- class="item" effect="dark" :content="item.title" placement="top">
92
- <base-button size="md" type="link" class="text-primary px-2 w-auto"
93
- @click="$emit(item.event, item)">
94
- <font-awesome-icon :icon="item.icon" class="mr-2" />
95
- </base-button>
96
- </el-tooltip>
97
-
98
- <slot name="buttons" />
99
- </div>
100
-
101
- <slot/>
102
- </div>
103
- </base-header>
104
- </template>
105
- <script>
106
- import { Dropdown, DropdownMenu, DropdownItem } from 'element-ui';
107
- export default {
108
- components: {
109
- ElDropdown: Dropdown,
110
- ElDropdownMenu: DropdownMenu,
111
- ElDropdownItem: DropdownItem,
112
- },
113
- computed: {
114
- headerClass() {
115
- const baseClass = 'justify-content-between app__header';
116
- const regex = /\/admissao\/\d+\/\d+/;
117
- return regex.test(this.currentPath) ? baseClass : `row ${baseClass}`;
118
- },
119
- },
120
- data(){
121
- return{
122
- default: '',
123
- activeUserId: null,
124
- currentPath: ''
125
- };
126
- },
127
- props:{
128
- icons:{
129
- type: Array,
130
- default: () =>[
131
- {
132
- event: 'view',
133
- icon: ['fas', 'eye'],
134
- disabled: false,
135
- title: this.$t('app_header.default_icons.view')
136
- },
137
- {
138
- event: 'config',
139
- icon: ['fas', 'cog'],
140
- disabled: false,
141
- title: this.$t('app_header.default_icons.edit')
142
- }
143
- ]
144
- },
145
- name: {
146
- type: String,
147
- default: () => this.$t('app_header.default_name')
148
- },
149
- beta:{
150
- type: Boolean,
151
- default: false
152
- },
153
- subheader: {
154
- type: Number,
155
- default: null
156
- },
157
- users: {
158
- type: Array,
159
- default: () => []
160
- },
161
- hasBackButton: {
162
- type: Boolean,
163
- default: false
164
- },
165
- backClickAction: {
166
- type: Function || null,
167
- default: null
168
- },
169
- avatarColor: {
170
- type: String,
171
- default: '5865f2'
172
- }
173
- },
174
- methods: {
175
- goBack() {
176
- if (this.backClickAction === null) {
177
- this.$router.go(-1);
178
- } else {
179
- this.backClickAction();
180
- }
181
- },
182
- setActiveUser(userId) {
183
- if (this.activeUserId !== userId) {
184
- this.activeUserId = userId;
185
- this.$emit('active-user', userId);
186
- } else {
187
- this.activeUserId = null;
188
- this.$emit('active-user', null);
189
- }
190
- }
191
- },
192
- mounted() {
193
- this.currentPath = window.location.pathname;
194
- }
195
- };
196
- </script>
197
- <style lang="scss">
198
- .app__header__imagems__dropdown {
199
- max-height: 300px;
200
- overflow: hidden;
201
- overflow-y: scroll;
202
- &::-webkit-scrollbar {
203
- width: 8px;
204
- }
205
-
206
- &::-webkit-scrollbar-track {
207
- background: #f5f5f5;
208
- }
209
-
210
- &::-webkit-scrollbar-thumb {
211
- background: #e9e8e8;
212
- border-radius: 10px;
213
- }
214
- .dropdown__user__data {
215
- display: grid;
216
- grid-template-columns: 40px 1fr;
217
- align-items: center;
218
- margin-bottom: 5px;
219
- img {
220
- width: 32px;
221
- height: 32px;
222
- border-radius: 100px;
223
- display: block;
224
- border: 2px solid transparent;
225
- }
226
- span {
227
- font-weight: 500;
228
- }
229
- &--active {
230
- img {
231
- border-color: #5865f2;
232
- }
233
- }
234
- }
235
- }
236
- </style>
237
-
238
- <style lang="scss" scoped>
239
- @media (max-width: 850px) {
240
- .app__header {
241
- .header__container {
242
- width: 100%!important;
243
- max-width: none!important;
244
- }
245
- .hasBackButton {
246
- flex-direction: row!important;
247
- justify-content: flex-start!important;
248
- }
249
- .header__content {
250
- width: 100%!important;
251
- max-width: none!important;
252
- flex-direction: column!important;
253
- text-align: left!important;
254
- align-items: flex-start!important;
255
- justify-content: flex-start!important;
256
- > .images {
257
- margin: 0!important;
258
- margin-top: 10px!important;
259
- }
260
- }
261
- }
262
- }
263
- @media (max-width: 600px) {
264
- .app__header {
265
- display: flex!important;
266
- flex-direction: column!important;
267
- .header__content {
268
- .header__title {
269
- width: 100%!important;
270
- max-width: none!important;
271
- text-align: left!important;
272
- align-items: flex-start!important;
273
- justify-content: flex-start!important;
274
- &:not(:has(.hasBackButton)) {
275
- flex-direction: column!important;
276
- }
277
- }
278
- }
279
- .footer__content {
280
- width: 100%!important;
281
- max-width: none!important;
282
- padding: 0!important;
283
- display: grid!important;
284
- grid-template-columns: repeat(auto-fit, minmax(calc(100% / 2), 1fr));
285
- justify-content: stretch!important;
286
- /deep/ button {
287
- width: 100%!important;
288
- }
289
- }
290
- }
291
- }
292
-
293
- .app__header__dropdown__title {
294
- background: #8DA2B5;
295
- color: #fff;
296
- width: 42px;
297
- height: 42px;
298
- display: grid;
299
- place-items: center;
300
- border-radius: 100px;
301
- border: 2px solid #fff;
302
- margin-left: -34px;
303
- font-size: 0.7rem;
304
- user-select: none;
305
- &--active {
306
- border-color: #5865f2;
307
- }
308
- }
309
-
310
- #credits-amount {
311
- margin: 0!important;
312
- min-width: 8em;
313
- margin: 1rem 1rem 1rem 0;
314
- padding: 0.25em 1em;
315
- font-size: 0.85rem;
316
- line-height: 1.4em;
317
- border-radius: 23rem;
318
- font-weight: 400;
319
- text-align: center;
320
- background-color: rgba(29, 161, 241, 0.1);
321
- color: #5865F2;
322
- }
323
- </style>
324
- <style lang="scss">
325
-
326
- .app-header {
327
- width: 100%;
328
- padding-top: 1.25rem;
329
- box-shadow: 0 0 2rem 0 rgba(136, 152, 170, 0.15);
330
- }
331
-
332
- .back__button {
333
- cursor: pointer;
334
- width: 42px;
335
- height: 42px;
336
- display: flex;
337
- align-items: center;
338
- justify-content: center;
339
- margin-right: 10px;
340
- border-radius: 100px;
341
- transition: background 0.5s;
342
- margin-left: -15px;
343
- border: 0;
344
- background: transparent;
345
- color: #32325d;
346
- &:focus {
347
- outline: none;
348
- }
349
- &:not(:disabled):hover, &:focus:not(:disabled):hover {
350
- background: rgba(0, 0, 0, 0.08);
351
- }
352
- }
353
-
354
- .header__container {
355
- display: flex;
356
- flex-direction: column;
357
- justify-content: center;
358
- align-items: flex-start;
359
- }
360
-
361
- .images__container {
362
- display: flex;
363
- align-items: flex-start;
364
- justify-content: center;
365
- .header__content {
366
- display: flex;
367
- align-items: center;
368
- flex-direction: row;
369
- padding: 10px 0;
370
- h2 {
371
- margin-bottom: 0;
372
- }
373
- .images {
374
- margin-left: 10px;
375
- display: flex;
376
- align-items: center;
377
- user-select: none;
378
- .user__avatar {
379
- cursor: pointer;
380
- border: 2px solid transparent;
381
- transition: border-color 0.5s;
382
- border: 2px solid #fff;
383
- background: var(--avatar-color);
384
- &--active {
385
- border-color: #5865F2;
386
- z-index: 10;
387
- }
388
- }
389
- img {
390
- $size: 42px;
391
- display: block;
392
- width: $size;
393
- height: $size;
394
- object-fit: cover;
395
- border-radius: 100px;
396
- &:not(:first-child) {
397
- margin-left: -10px;
398
- }
399
- }
400
- }
401
- }
402
- }
403
- </style>
1
+ <template>
2
+ <base-header class="app-header" :type="'white'">
3
+ <div :class="headerClass">
4
+ <div
5
+ :class="{ 'images__container': users.length }"
6
+ class="col-8 my-auto header__container"
7
+ >
8
+ <slot name="header-top" />
9
+
10
+ <div class="header__content">
11
+ <div class="d-flex align-items-center justify-content-center flex-row header__title" :class="{ hasBackButton }">
12
+ <button class="back__button" v-if="hasBackButton" @click="goBack()">
13
+ <i class="fas fa-arrow-left"></i>
14
+ </button>
15
+ <h2 class="font-weight-bold display-3">{{name}}</h2>
16
+ <badge
17
+ v-if="beta"
18
+ rounded
19
+ size="md"
20
+ class="badge-font ml-2 mb-2"
21
+ type="primary"
22
+ >
23
+ BETA
24
+ </badge>
25
+ </div>
26
+ <div class="images" v-if="users.length">
27
+ <el-tooltip
28
+ v-for="user in users.slice(0, 5)"
29
+ :key="user.id"
30
+ placement="top"
31
+ :content="user.name"
32
+ class="user__avatar"
33
+ :class="{ 'user__avatar--active': activeUserId === user.id }"
34
+ >
35
+ <image-with-fallback
36
+ @click.native="setActiveUser(user.id)"
37
+ :src="user.avatar"
38
+ :alt="user.name"
39
+ :fallbackText="user.name"
40
+ fallbackSize="200"
41
+ :fallbackBackground="avatarColor"
42
+ :style=" `--avatar-color: #${avatarColor}`"
43
+ />
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
+ fallbackSize="200"
63
+ :fallbackBackground="avatarColor"
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>
72
+ </div>
73
+ </div>
74
+
75
+ <span id="credits-amount" v-if="subheader !== null">
76
+ <template v-if="subheader >= 0">
77
+ {{ subheader }} {{ $t('app_header.credits') }}
78
+ </template>
79
+
80
+ <template v-else>
81
+ {{ $t('app_header.unlimited_credits') }}
82
+ </template>
83
+ </span>
84
+
85
+ <slot name="header-bottom" />
86
+ </div>
87
+
88
+ <div class="col-4 d-flex justify-content-end align-items-start footer__content">
89
+ <el-tooltip v-for="(item, index) in icons" :key="index"
90
+ v-show="!item.disabled"
91
+ class="item" effect="dark" :content="item.title" placement="top">
92
+ <base-button size="md" type="link" class="text-primary px-2 w-auto"
93
+ @click="$emit(item.event, item)">
94
+ <font-awesome-icon :icon="item.icon" class="mr-2" />
95
+ </base-button>
96
+ </el-tooltip>
97
+
98
+ <slot name="buttons" />
99
+ </div>
100
+
101
+ <slot/>
102
+ </div>
103
+ </base-header>
104
+ </template>
105
+ <script>
106
+ import { Dropdown, DropdownMenu, DropdownItem } from 'element-ui';
107
+ export default {
108
+ components: {
109
+ ElDropdown: Dropdown,
110
+ ElDropdownMenu: DropdownMenu,
111
+ ElDropdownItem: DropdownItem,
112
+ },
113
+ computed: {
114
+ headerClass() {
115
+ const baseClass = 'justify-content-between app__header';
116
+ const regex = /\/admissao\/\d+\/\d+/;
117
+ return regex.test(this.currentPath) ? baseClass : `row ${baseClass}`;
118
+ },
119
+ },
120
+ data(){
121
+ return{
122
+ default: '',
123
+ activeUserId: null,
124
+ currentPath: ''
125
+ };
126
+ },
127
+ props:{
128
+ icons:{
129
+ type: Array,
130
+ default: () =>[
131
+ {
132
+ event: 'view',
133
+ icon: ['fas', 'eye'],
134
+ disabled: false,
135
+ title: this.$t('app_header.default_icons.view')
136
+ },
137
+ {
138
+ event: 'config',
139
+ icon: ['fas', 'cog'],
140
+ disabled: false,
141
+ title: this.$t('app_header.default_icons.edit')
142
+ }
143
+ ]
144
+ },
145
+ name: {
146
+ type: String,
147
+ default: () => this.$t('app_header.default_name')
148
+ },
149
+ beta:{
150
+ type: Boolean,
151
+ default: false
152
+ },
153
+ subheader: {
154
+ type: Number,
155
+ default: null
156
+ },
157
+ users: {
158
+ type: Array,
159
+ default: () => []
160
+ },
161
+ hasBackButton: {
162
+ type: Boolean,
163
+ default: false
164
+ },
165
+ backClickAction: {
166
+ type: Function || null,
167
+ default: null
168
+ },
169
+ avatarColor: {
170
+ type: String,
171
+ default: '5865f2'
172
+ }
173
+ },
174
+ methods: {
175
+ goBack() {
176
+ if (this.backClickAction === null) {
177
+ this.$router.go(-1);
178
+ } else {
179
+ this.backClickAction();
180
+ }
181
+ },
182
+ setActiveUser(userId) {
183
+ if (this.activeUserId !== userId) {
184
+ this.activeUserId = userId;
185
+ this.$emit('active-user', userId);
186
+ } else {
187
+ this.activeUserId = null;
188
+ this.$emit('active-user', null);
189
+ }
190
+ }
191
+ },
192
+ mounted() {
193
+ this.currentPath = window.location.pathname;
194
+ }
195
+ };
196
+ </script>
197
+ <style lang="scss">
198
+ .app__header__imagems__dropdown {
199
+ max-height: 300px;
200
+ overflow: hidden;
201
+ overflow-y: scroll;
202
+ &::-webkit-scrollbar {
203
+ width: 8px;
204
+ }
205
+
206
+ &::-webkit-scrollbar-track {
207
+ background: #f5f5f5;
208
+ }
209
+
210
+ &::-webkit-scrollbar-thumb {
211
+ background: #e9e8e8;
212
+ border-radius: 10px;
213
+ }
214
+ .dropdown__user__data {
215
+ display: grid;
216
+ grid-template-columns: 40px 1fr;
217
+ align-items: center;
218
+ margin-bottom: 5px;
219
+ img {
220
+ width: 32px;
221
+ height: 32px;
222
+ border-radius: 100px;
223
+ display: block;
224
+ border: 2px solid transparent;
225
+ }
226
+ span {
227
+ font-weight: 500;
228
+ }
229
+ &--active {
230
+ img {
231
+ border-color: #5865f2;
232
+ }
233
+ }
234
+ }
235
+ }
236
+ </style>
237
+
238
+ <style lang="scss" scoped>
239
+ @media (max-width: 850px) {
240
+ .app__header {
241
+ .header__container {
242
+ width: 100%!important;
243
+ max-width: none!important;
244
+ }
245
+ .hasBackButton {
246
+ flex-direction: row!important;
247
+ justify-content: flex-start!important;
248
+ }
249
+ .header__content {
250
+ width: 100%!important;
251
+ max-width: none!important;
252
+ flex-direction: column!important;
253
+ text-align: left!important;
254
+ align-items: flex-start!important;
255
+ justify-content: flex-start!important;
256
+ > .images {
257
+ margin: 0!important;
258
+ margin-top: 10px!important;
259
+ }
260
+ }
261
+ }
262
+ }
263
+ @media (max-width: 600px) {
264
+ .app__header {
265
+ display: flex!important;
266
+ flex-direction: column!important;
267
+ .header__content {
268
+ .header__title {
269
+ width: 100%!important;
270
+ max-width: none!important;
271
+ text-align: left!important;
272
+ align-items: flex-start!important;
273
+ justify-content: flex-start!important;
274
+ &:not(:has(.hasBackButton)) {
275
+ flex-direction: column!important;
276
+ }
277
+ }
278
+ }
279
+ .footer__content {
280
+ width: 100%!important;
281
+ max-width: none!important;
282
+ padding: 0!important;
283
+ display: grid!important;
284
+ grid-template-columns: repeat(auto-fit, minmax(calc(100% / 2), 1fr));
285
+ justify-content: stretch!important;
286
+ /deep/ button {
287
+ width: 100%!important;
288
+ }
289
+ }
290
+ }
291
+ }
292
+
293
+ .app__header__dropdown__title {
294
+ background: #8DA2B5;
295
+ color: #fff;
296
+ width: 42px;
297
+ height: 42px;
298
+ display: grid;
299
+ place-items: center;
300
+ border-radius: 100px;
301
+ border: 2px solid #fff;
302
+ margin-left: -34px;
303
+ font-size: 0.7rem;
304
+ user-select: none;
305
+ &--active {
306
+ border-color: #5865f2;
307
+ }
308
+ }
309
+
310
+ #credits-amount {
311
+ margin: 0!important;
312
+ min-width: 8em;
313
+ margin: 1rem 1rem 1rem 0;
314
+ padding: 0.25em 1em;
315
+ font-size: 0.85rem;
316
+ line-height: 1.4em;
317
+ border-radius: 23rem;
318
+ font-weight: 400;
319
+ text-align: center;
320
+ background-color: rgba(29, 161, 241, 0.1);
321
+ color: #5865F2;
322
+ }
323
+ </style>
324
+ <style lang="scss">
325
+
326
+ .app-header {
327
+ width: 100%;
328
+ padding-top: 1.25rem;
329
+ box-shadow: 0 0 2rem 0 rgba(136, 152, 170, 0.15);
330
+ }
331
+
332
+ .back__button {
333
+ cursor: pointer;
334
+ width: 42px;
335
+ height: 42px;
336
+ display: flex;
337
+ align-items: center;
338
+ justify-content: center;
339
+ margin-right: 10px;
340
+ border-radius: 100px;
341
+ transition: background 0.5s;
342
+ margin-left: -15px;
343
+ border: 0;
344
+ background: transparent;
345
+ color: #32325d;
346
+ &:focus {
347
+ outline: none;
348
+ }
349
+ &:not(:disabled):hover, &:focus:not(:disabled):hover {
350
+ background: rgba(0, 0, 0, 0.08);
351
+ }
352
+ }
353
+
354
+ .header__container {
355
+ display: flex;
356
+ flex-direction: column;
357
+ justify-content: center;
358
+ align-items: flex-start;
359
+ }
360
+
361
+ .images__container {
362
+ display: flex;
363
+ align-items: flex-start;
364
+ justify-content: center;
365
+ .header__content {
366
+ display: flex;
367
+ align-items: center;
368
+ flex-direction: row;
369
+ padding: 10px 0;
370
+ h2 {
371
+ margin-bottom: 0;
372
+ }
373
+ .images {
374
+ margin-left: 10px;
375
+ display: flex;
376
+ align-items: center;
377
+ user-select: none;
378
+ .user__avatar {
379
+ cursor: pointer;
380
+ border: 2px solid transparent;
381
+ transition: border-color 0.5s;
382
+ border: 2px solid #fff;
383
+ background: var(--avatar-color);
384
+ &--active {
385
+ border-color: #5865F2;
386
+ z-index: 10;
387
+ }
388
+ }
389
+ img {
390
+ $size: 42px;
391
+ display: block;
392
+ width: $size;
393
+ height: $size;
394
+ object-fit: cover;
395
+ border-radius: 100px;
396
+ &:not(:first-child) {
397
+ margin-left: -10px;
398
+ }
399
+ }
400
+ }
401
+ }
402
+ }
403
+ </style>