@bildvitta/quasar-ui-asteroid 3.17.0-beta.8 → 3.17.0
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/package.json +3 -2
- package/src/assets/sounds/nave-notification.mp3 +0 -0
- package/src/components/app-menu/QasAppMenu.vue +73 -15
- package/src/components/app-menu/QasAppMenu.yml +5 -5
- package/src/components/app-user/QasAppUser.vue +49 -40
- package/src/components/avatar/QasAvatar.vue +7 -8
- package/src/components/badge/QasBadge.vue +3 -29
- package/src/components/board-generator/QasBoardGenerator.vue +442 -40
- package/src/components/board-generator/QasBoardGenerator.yml +107 -12
- package/src/components/card/QasCard.vue +13 -4
- package/src/components/chart-view/QasChartView.vue +56 -3
- package/src/components/chart-view/QasChartView.yml +6 -0
- package/src/components/checkbox/QasCheckbox.vue +67 -11
- package/src/components/checkbox/QasCheckbox.yml +18 -0
- package/src/components/copy/QasCopy.vue +12 -2
- package/src/components/copy/QasCopy.yml +8 -0
- package/src/components/expansion-item/QasExpansionItem.vue +108 -76
- package/src/components/expansion-item/QasExpansionItem.yml +38 -10
- package/src/components/field/QasField.vue +1 -1
- package/src/components/form-generator/QasFormGenerator.vue +23 -10
- package/src/components/form-generator/QasFormGenerator.yml +2 -2
- package/src/components/grabbable/QasGrabbable.vue +14 -6
- package/src/components/grabbable/QasGrabbable.yml +4 -0
- package/src/components/grid-generator/QasGridGenerator.vue +3 -3
- package/src/components/grid-generator/QasGridGenerator.yml +2 -2
- package/src/components/grid-item/QasGridItem.vue +1 -1
- package/src/components/header/QasHeader.vue +11 -9
- package/src/components/infinite-scroll/QasInfiniteScroll.vue +16 -17
- package/src/components/infinite-scroll/QasInfiniteScroll.yml +7 -0
- package/src/components/list-view/QasListView.vue +16 -2
- package/src/components/list-view/QasListView.yml +9 -0
- package/src/components/radio/QasRadio.vue +24 -5
- package/src/components/radio/QasRadio.yml +6 -0
- package/src/components/select/QasSelect.vue +54 -7
- package/src/components/select/QasSelect.yml +6 -1
- package/src/components/select-filter/QasSelectFilter.vue +65 -0
- package/src/components/select-filter/QasSelectFilter.yml +36 -0
- package/src/components/stepper/QasStepper.vue +50 -3
- package/src/components/stepper-form-view/QasStepperFormView.vue +6 -4
- package/src/components/stepper-form-view/QasStepperFormView.yml +1 -1
- package/src/components/table-generator/QasTableGenerator.vue +3 -0
- package/src/components/text-truncate/QasTextTruncate.vue +77 -14
- package/src/components/text-truncate/QasTextTruncate.yml +14 -3
- package/src/components/uploader/QasUploader.vue +70 -24
- package/src/components/uploader/QasUploader.yml +15 -1
- package/src/components/welcome/QasWelcome.vue +8 -0
- package/src/components/welcome/QasWelcome.yml +3 -0
- package/src/composables/index.js +3 -1
- package/src/composables/private/index.js +1 -0
- package/src/composables/private/use-auth-user.js +20 -0
- package/src/composables/private/use-generator.js +20 -5
- package/src/composables/use-default-filters.js +106 -0
- package/src/composables/use-notifications.js +14 -0
- package/src/composables/use-query-cache.js +1 -1
- package/src/css/components/field.scss +13 -6
- package/src/helpers/set-scroll-on-grab.js +9 -1
- package/src/shared/badge-config.js +29 -0
- package/src/vue-plugin.js +3 -0
- package/src/components/app-menu/private/PvAppMenuHelpChat.vue +0 -222
|
@@ -4,6 +4,46 @@ meta:
|
|
|
4
4
|
desc: Componente usado para board de colunas.
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
|
+
before-update-position:
|
|
8
|
+
desc: função onde será executada antes do dialog de confirmação ou atualização da posição.
|
|
9
|
+
type: function
|
|
10
|
+
default: undefined
|
|
11
|
+
params:
|
|
12
|
+
event:
|
|
13
|
+
desc: Evento do "onAdd" do sortablejs.
|
|
14
|
+
type: Object
|
|
15
|
+
default: {}
|
|
16
|
+
|
|
17
|
+
cancel:
|
|
18
|
+
desc: Cancela o drag and drop.
|
|
19
|
+
type: Function
|
|
20
|
+
default: undefined
|
|
21
|
+
|
|
22
|
+
getItem:
|
|
23
|
+
desc: Recupera o item atual a ser dropado.
|
|
24
|
+
type: Function
|
|
25
|
+
default: {}
|
|
26
|
+
|
|
27
|
+
openConfirmDialog:
|
|
28
|
+
desc: Chama o dialog de confirmação para salvar nova posição.
|
|
29
|
+
type: Function
|
|
30
|
+
default: undefined
|
|
31
|
+
|
|
32
|
+
update:
|
|
33
|
+
desc: Salva nova posição.
|
|
34
|
+
type: Function
|
|
35
|
+
default: undefined
|
|
36
|
+
|
|
37
|
+
getColumnTo:
|
|
38
|
+
desc: Recupera o payload da coluna que o item será adicionado.
|
|
39
|
+
type: Function
|
|
40
|
+
default: {}
|
|
41
|
+
|
|
42
|
+
getColumnFrom:
|
|
43
|
+
desc: Recupera o payload da coluna que o item saiu.
|
|
44
|
+
type: Function
|
|
45
|
+
default: {}
|
|
46
|
+
|
|
7
47
|
column-id-key:
|
|
8
48
|
desc: chave que será o id usado para ser o identificador da coluna.
|
|
9
49
|
type: String
|
|
@@ -20,19 +60,33 @@ props:
|
|
|
20
60
|
required: true
|
|
21
61
|
|
|
22
62
|
column-width:
|
|
23
|
-
desc: Largura da coluna
|
|
63
|
+
desc: Largura da coluna.
|
|
24
64
|
type: String
|
|
25
65
|
default: 288
|
|
26
66
|
|
|
67
|
+
confirm-dialog-props:
|
|
68
|
+
desc: Propriedade repassada ao `QasDialog` para confirmar um drag and drop. Caso não seja passado, não é usado dialog de confirmação. As ações de confirmar e cancelar são feitas por padrão no componente.
|
|
69
|
+
type: Object
|
|
70
|
+
default: {}
|
|
71
|
+
|
|
72
|
+
header-box-props:
|
|
73
|
+
desc: Propriedades repassadas ao `QasBox` do header.
|
|
74
|
+
type: Object
|
|
75
|
+
default: {}
|
|
76
|
+
|
|
27
77
|
headers:
|
|
28
78
|
desc: Lista de itens sendo cada um o header de cada coluna.
|
|
29
79
|
default: []
|
|
30
80
|
type: Array
|
|
31
|
-
|
|
81
|
+
|
|
32
82
|
height:
|
|
33
|
-
desc: Altura do container do board. Caso não seja passado um height, o
|
|
83
|
+
desc: Altura do container do board. Caso não seja passado um height, o cálculo é feito para ocupar a maior altura possível da página.
|
|
34
84
|
type: String
|
|
35
|
-
|
|
85
|
+
|
|
86
|
+
item-id-key:
|
|
87
|
+
desc: Identificador único do item a ser movido, sendo que será usado nas requisições realizadas pelo drop.
|
|
88
|
+
type: String
|
|
89
|
+
|
|
36
90
|
lazy-loading-fields-keys:
|
|
37
91
|
desc: Chaves dos campos que são lazy loading para o tratamento de merge das options.
|
|
38
92
|
type: Array
|
|
@@ -44,7 +98,7 @@ props:
|
|
|
44
98
|
default: 12
|
|
45
99
|
|
|
46
100
|
use-mark-raw:
|
|
47
|
-
desc: Define se os valores dos itens das colunas
|
|
101
|
+
desc: Define se os valores dos itens das colunas irão ser atribuídos utilizando o "markRaw", onde somente a primeira camada do model será reativa. (https://vuejs.org/api/reactivity-advanced.html#markraw)
|
|
48
102
|
type: Boolean
|
|
49
103
|
default: true
|
|
50
104
|
|
|
@@ -55,6 +109,30 @@ props:
|
|
|
55
109
|
examples: [v-model:results="resultsColumns"]
|
|
56
110
|
model: true
|
|
57
111
|
|
|
112
|
+
sortable-config:
|
|
113
|
+
desc: Configuração passada para a instância do SortableJS.
|
|
114
|
+
type: Object
|
|
115
|
+
default: "{ animation: 500, swapThreshold: 1, delay: 50, delayOnTouchOnly: true, emptyInsertThreshold: 0 }"
|
|
116
|
+
debugger: true
|
|
117
|
+
|
|
118
|
+
use-drag-and-drop-x:
|
|
119
|
+
desc: Controla se irá ter drag and drop no eixo X (entre colunas).
|
|
120
|
+
type: Boolean
|
|
121
|
+
|
|
122
|
+
use-drag-and-drop-y:
|
|
123
|
+
desc: Controla se irá ter drag and drop no eixo Y (mesma coluna, utilizado para ordenação de itens).
|
|
124
|
+
type: Boolean
|
|
125
|
+
|
|
126
|
+
update-position-url:
|
|
127
|
+
desc: URL usada para realizar o PATCH do drag and drop.
|
|
128
|
+
type: String
|
|
129
|
+
default: ''
|
|
130
|
+
|
|
131
|
+
update-position-params:
|
|
132
|
+
desc: Parâmetros customizados caso precise passar para a API de PATCH.
|
|
133
|
+
type: Object
|
|
134
|
+
default: {}
|
|
135
|
+
|
|
58
136
|
slots:
|
|
59
137
|
header-column:
|
|
60
138
|
desc: Slot para acessar o card do header de cada coluna.
|
|
@@ -63,9 +141,9 @@ slots:
|
|
|
63
141
|
desc: Fields referente à coluna atual do template.
|
|
64
142
|
type: Object
|
|
65
143
|
default: {}
|
|
66
|
-
|
|
144
|
+
|
|
67
145
|
header:
|
|
68
|
-
desc: Informações de cada item do header que foi fornecido através da prop "headers"
|
|
146
|
+
desc: Informações de cada item do header que foi fornecido através da prop "headers".
|
|
69
147
|
type: Object
|
|
70
148
|
default: {}
|
|
71
149
|
|
|
@@ -76,7 +154,7 @@ slots:
|
|
|
76
154
|
desc: Fields referente à coluna atual do template.
|
|
77
155
|
type: Object
|
|
78
156
|
default: {}
|
|
79
|
-
|
|
157
|
+
|
|
80
158
|
item:
|
|
81
159
|
desc: Informações de cada item da coluna que foi buscado através da API.
|
|
82
160
|
type: Object
|
|
@@ -98,14 +176,14 @@ events:
|
|
|
98
176
|
type: Object
|
|
99
177
|
|
|
100
178
|
header:
|
|
101
|
-
desc:
|
|
179
|
+
desc: Header da coluna atual.
|
|
102
180
|
type: Object
|
|
103
181
|
|
|
104
182
|
'@update:fetch-column-error -> function(error)':
|
|
105
183
|
desc: Dispara quando o "fetchColumn" cai em uma exceção.
|
|
106
184
|
params:
|
|
107
185
|
error:
|
|
108
|
-
desc: Retorna todos os dados "
|
|
186
|
+
desc: Retorna todos os dados "crus" respondidos na exceção do fetch.
|
|
109
187
|
type: Object
|
|
110
188
|
|
|
111
189
|
'@update:fetch-columns-success -> function()':
|
|
@@ -115,12 +193,29 @@ events:
|
|
|
115
193
|
desc: Dispara quando algum "fetchColumn" cai em uma exceção.
|
|
116
194
|
params:
|
|
117
195
|
error:
|
|
118
|
-
desc: Retorna todos os dados "
|
|
196
|
+
desc: Retorna todos os dados "crus" respondidos na exceção do fetch.
|
|
197
|
+
type: Object
|
|
198
|
+
|
|
199
|
+
'@update-success -> function()':
|
|
200
|
+
desc: Dispara quando o PATCH do drag and drop é com sucesso.
|
|
201
|
+
params:
|
|
202
|
+
data:
|
|
203
|
+
desc: Retorno da API.
|
|
204
|
+
type: Object
|
|
205
|
+
|
|
206
|
+
'@update-error -> function()':
|
|
207
|
+
desc: Dispara quando o PATCH do drag and drop cai em uma exceção.
|
|
208
|
+
params:
|
|
209
|
+
error:
|
|
210
|
+
desc: Retorno da API.
|
|
119
211
|
type: Object
|
|
120
212
|
|
|
121
213
|
methods:
|
|
214
|
+
'cancelDrop: () => void':
|
|
215
|
+
desc: Cancela o drop e volta o item para coluna original.
|
|
216
|
+
|
|
122
217
|
'fetchColumns: () => void':
|
|
123
218
|
desc: Busca todas colunas com base nos headers fornecidos.
|
|
124
219
|
|
|
125
220
|
'fetchColumn: (header) => void':
|
|
126
|
-
desc: Busca uma coluna
|
|
221
|
+
desc: Busca uma coluna específica com base no header fornecido.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
<div class="qas-card">
|
|
3
3
|
<qas-box class="rounded-borders-right" v-bind="boxProps">
|
|
4
4
|
<q-card class="column full-height overflow-hidden shadow-0">
|
|
5
|
-
<div class="items-center justify-between row">
|
|
6
|
-
<component :is="titleComponent" class="text-
|
|
5
|
+
<div class="full-width items-center justify-between no-wrap row">
|
|
6
|
+
<component :is="titleComponent" class="ellipsis text-h5 text-no-decoration" :class="titleClasses" :to="route">
|
|
7
7
|
<slot name="title">
|
|
8
8
|
{{ props.title }}
|
|
9
9
|
</slot>
|
|
10
10
|
</component>
|
|
11
11
|
|
|
12
|
-
<qas-actions-menu v-if="hasActions"
|
|
12
|
+
<qas-actions-menu v-if="hasActions" v-bind="formattedActionsMenuProps" />
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<div class="q-my-sm qas-card__content">
|
|
@@ -66,8 +66,10 @@ const props = defineProps({
|
|
|
66
66
|
}
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
+
// consts
|
|
69
70
|
const isInsideBox = inject('isBox', false)
|
|
70
71
|
|
|
72
|
+
// computeds
|
|
71
73
|
const boxProps = computed(() => {
|
|
72
74
|
return {
|
|
73
75
|
outlined: isInsideBox,
|
|
@@ -89,7 +91,7 @@ const titleClasses = computed(() => {
|
|
|
89
91
|
}
|
|
90
92
|
})
|
|
91
93
|
|
|
92
|
-
const titleComponent = computed(() => hasRoute.value ? 'router-link' : '
|
|
94
|
+
const titleComponent = computed(() => hasRoute.value ? 'router-link' : 'h5')
|
|
93
95
|
|
|
94
96
|
const style = computed(() => {
|
|
95
97
|
if (!props.statusColor) return
|
|
@@ -106,6 +108,13 @@ const slots = useSlots()
|
|
|
106
108
|
const hasFooterSlot = computed(() => !!slots.footer)
|
|
107
109
|
|
|
108
110
|
const hasFooter = computed(() => hasFooterSlot.value || hasExpansion.value)
|
|
111
|
+
|
|
112
|
+
const formattedActionsMenuProps = computed(() => {
|
|
113
|
+
return {
|
|
114
|
+
...props.actionsMenuProps,
|
|
115
|
+
useLabel: false
|
|
116
|
+
}
|
|
117
|
+
})
|
|
109
118
|
</script>
|
|
110
119
|
|
|
111
120
|
<style lang="scss">
|
|
@@ -46,8 +46,9 @@ import zoomPlugin from 'chartjs-plugin-zoom'
|
|
|
46
46
|
import chartDataLabels from 'chartjs-plugin-datalabels'
|
|
47
47
|
|
|
48
48
|
// Outras importações
|
|
49
|
-
import { extend } from 'quasar'
|
|
50
49
|
import { filterListByHandle } from '../../helpers'
|
|
50
|
+
|
|
51
|
+
import { extend, is } from 'quasar'
|
|
51
52
|
import { getAction } from '@bildvitta/store-adapter'
|
|
52
53
|
|
|
53
54
|
const ChartTypes = {
|
|
@@ -131,6 +132,11 @@ export default {
|
|
|
131
132
|
type: String
|
|
132
133
|
},
|
|
133
134
|
|
|
135
|
+
urlQueryList: {
|
|
136
|
+
default: () => (['company']),
|
|
137
|
+
type: Array
|
|
138
|
+
},
|
|
139
|
+
|
|
134
140
|
useBox: {
|
|
135
141
|
type: Boolean,
|
|
136
142
|
default: true
|
|
@@ -332,6 +338,10 @@ export default {
|
|
|
332
338
|
...(this.useBox && { ...this.boxProps })
|
|
333
339
|
}
|
|
334
340
|
}
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
queryFromURL () {
|
|
344
|
+
return this.getQueryFromURL(this.$route.query)
|
|
335
345
|
}
|
|
336
346
|
},
|
|
337
347
|
|
|
@@ -342,6 +352,10 @@ export default {
|
|
|
342
352
|
|
|
343
353
|
isFetching (value) {
|
|
344
354
|
this.$emit('update:fetching', value)
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
$route (to, from) {
|
|
358
|
+
this.onRouteChange(to, from)
|
|
345
359
|
}
|
|
346
360
|
},
|
|
347
361
|
|
|
@@ -350,16 +364,17 @@ export default {
|
|
|
350
364
|
this.handleFetchData()
|
|
351
365
|
},
|
|
352
366
|
|
|
353
|
-
|
|
367
|
+
beforeUnmount () {
|
|
354
368
|
this.unregisterChartJS()
|
|
355
369
|
},
|
|
356
370
|
|
|
357
371
|
methods: {
|
|
358
372
|
handleFetchData () {
|
|
359
373
|
const hasBeforeFetch = typeof this.beforeFetch === 'function'
|
|
374
|
+
|
|
360
375
|
const payload = {
|
|
361
376
|
url: this.url,
|
|
362
|
-
filters: this.filters
|
|
377
|
+
filters: { ...this.filters, ...this.queryFromURL }
|
|
363
378
|
}
|
|
364
379
|
|
|
365
380
|
if (hasBeforeFetch && !this.cancelBeforeFetch) {
|
|
@@ -435,6 +450,44 @@ export default {
|
|
|
435
450
|
...this.defaultChartItems,
|
|
436
451
|
...this.elementsChartItems[this.type]
|
|
437
452
|
)
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
onRouteChange (to, from) {
|
|
456
|
+
const { query } = to
|
|
457
|
+
|
|
458
|
+
const isSameRoute = to.name === from.name
|
|
459
|
+
const hasQueryInURLQueryList = this.urlQueryList.some(urlQuery => query[urlQuery])
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* feito com função para evitar um deepEqual desnecessário, uma vez que
|
|
463
|
+
* caso "isSameRoute" seja falso, ou "hasQueryInURLQueryList" seja falso,
|
|
464
|
+
* não é necessário fazer a comparação.
|
|
465
|
+
*/
|
|
466
|
+
const hasQueryChanged = () => !is.deepEqual(this.queryFromURL, this.getQueryFromURL(from.query))
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Verifica se a rota atual é a mesma, se há uma query na URL que corresponde à queryList,
|
|
470
|
+
* e se a query correspondente à queryList foi alterada. Se todas essas condições forem
|
|
471
|
+
* verdadeiras, faz a requisição de dados.
|
|
472
|
+
*/
|
|
473
|
+
if (isSameRoute && hasQueryInURLQueryList && hasQueryChanged()) this.handleFetchData()
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* "urlQueryList" é uma lista de query que o componente deve pegar da URL.
|
|
478
|
+
*/
|
|
479
|
+
getQueryFromURL (query = {}) {
|
|
480
|
+
const newQuery = {}
|
|
481
|
+
|
|
482
|
+
this.urlQueryList.forEach(urlQuery => {
|
|
483
|
+
const queryValue = query[urlQuery]
|
|
484
|
+
|
|
485
|
+
if (queryValue) {
|
|
486
|
+
newQuery[urlQuery] = queryValue
|
|
487
|
+
}
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
return newQuery
|
|
438
491
|
}
|
|
439
492
|
}
|
|
440
493
|
}
|
|
@@ -70,6 +70,12 @@ props:
|
|
|
70
70
|
desc: Envia como parâmetro para a action "fetchList" do modulo correspondente a "entity".
|
|
71
71
|
type: String
|
|
72
72
|
|
|
73
|
+
url-query-list:
|
|
74
|
+
desc: Lista de query que serão recuperadas da URL e enviadas como parâmetro para a action "fetchList" do modulo correspondente a "entity".
|
|
75
|
+
type: Array
|
|
76
|
+
default:
|
|
77
|
+
- company
|
|
78
|
+
|
|
73
79
|
use-box:
|
|
74
80
|
desc: Controla se o componente vai ter o QasBox englobando ou não.
|
|
75
81
|
default: true
|
|
@@ -1,27 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div class="qas-checkbox">
|
|
3
3
|
<!-- Single -->
|
|
4
|
-
<q-checkbox v-if="isSingle" v-model="model" v-bind="
|
|
4
|
+
<q-checkbox v-if="isSingle" v-model="model" v-bind="singleAttributes" dense>
|
|
5
5
|
<slot />
|
|
6
6
|
</q-checkbox>
|
|
7
7
|
|
|
8
8
|
<!-- Group -->
|
|
9
|
-
<div v-else
|
|
10
|
-
<div v-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<div v-else>
|
|
10
|
+
<div v-if="hasCheckboxLabel" class="q-mb-sm text-body1" :class="checkboxLabelClasses">
|
|
11
|
+
{{ formattedLabel }}
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div :class="classes">
|
|
15
|
+
<div v-for="(option, index) in props.options" :key="index">
|
|
16
|
+
<!-- Com children -->
|
|
17
|
+
<q-checkbox v-if="hasChildren(option)" :class="getCheckboxClass(option)" dense :indeterminate-value="false" :label="option.label" :model-value="getModelValue(index)" @update:model-value="updateCheckbox($event, option, index)" />
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
<!-- Com children -->
|
|
20
|
+
<q-option-group v-if="hasChildren(option)" class="q-ml-xs q-mt-xs" dense :inline="props.inline" :model-value="props.modelValue" :options="option.children" type="checkbox" @update:model-value="updateChildren($event, option, index)" />
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
<!-- Sem children -->
|
|
23
|
+
<q-option-group v-else v-model="model" v-bind="attrs" dense :options="[option]" type="checkbox" />
|
|
24
|
+
</div>
|
|
19
25
|
</div>
|
|
20
26
|
</div>
|
|
27
|
+
|
|
28
|
+
<div v-if="props.errorMessage" class="q-pt-sm qas-checkbox__error-message text-negative">
|
|
29
|
+
{{ props.errorMessage }}
|
|
30
|
+
</div>
|
|
21
31
|
</div>
|
|
22
32
|
</template>
|
|
23
33
|
|
|
24
34
|
<script setup>
|
|
35
|
+
import { getRequiredLabel } from '../../helpers'
|
|
25
36
|
import { watch, computed, ref, onMounted, useAttrs } from 'vue'
|
|
26
37
|
|
|
27
38
|
defineOptions({
|
|
@@ -30,6 +41,11 @@ defineOptions({
|
|
|
30
41
|
})
|
|
31
42
|
|
|
32
43
|
const props = defineProps({
|
|
44
|
+
label: {
|
|
45
|
+
default: '',
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
|
|
33
49
|
options: {
|
|
34
50
|
default: () => [],
|
|
35
51
|
type: Array
|
|
@@ -43,6 +59,19 @@ const props = defineProps({
|
|
|
43
59
|
inline: {
|
|
44
60
|
default: true,
|
|
45
61
|
type: Boolean
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
errorMessage: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ''
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
error: {
|
|
70
|
+
type: Boolean
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
required: {
|
|
74
|
+
type: Boolean
|
|
46
75
|
}
|
|
47
76
|
})
|
|
48
77
|
|
|
@@ -59,6 +88,8 @@ onMounted(handleParent)
|
|
|
59
88
|
// computed
|
|
60
89
|
const classes = computed(() => props.inline && 'flex q-gutter-x-sm')
|
|
61
90
|
|
|
91
|
+
const hasCheckboxLabel = computed(() => !!props.label)
|
|
92
|
+
|
|
62
93
|
const model = computed({
|
|
63
94
|
get () {
|
|
64
95
|
return props.modelValue
|
|
@@ -71,6 +102,22 @@ const model = computed({
|
|
|
71
102
|
|
|
72
103
|
const isSingle = computed(() => !props.options.length)
|
|
73
104
|
|
|
105
|
+
const singleAttributes = computed(() => {
|
|
106
|
+
return {
|
|
107
|
+
...attrs,
|
|
108
|
+
|
|
109
|
+
label: props.label
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const checkboxLabelClasses = computed(() => {
|
|
114
|
+
return { 'text-negative': props.error }
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const formattedLabel = computed(() => {
|
|
118
|
+
return getRequiredLabel({ label: props.label, required: props.required })
|
|
119
|
+
})
|
|
120
|
+
|
|
74
121
|
// watch
|
|
75
122
|
watch(() => props.options, handleParent)
|
|
76
123
|
|
|
@@ -95,7 +142,7 @@ function setGroupIntersection (value, option, index) {
|
|
|
95
142
|
const options = option.children.map(item => item.value)
|
|
96
143
|
const intersection = options.filter(item => value.includes(item))
|
|
97
144
|
|
|
98
|
-
group.value[index] = intersection.length
|
|
145
|
+
group.value[index] = intersection.length ? (intersection.length === options.length ? true : null) : false
|
|
99
146
|
}
|
|
100
147
|
|
|
101
148
|
function updateCheckbox (value, option, index) {
|
|
@@ -127,3 +174,12 @@ function getModelValue (index) {
|
|
|
127
174
|
return group.value[index]
|
|
128
175
|
}
|
|
129
176
|
</script>
|
|
177
|
+
|
|
178
|
+
<style lang="scss">
|
|
179
|
+
.qas-checkbox {
|
|
180
|
+
&__error-message {
|
|
181
|
+
// Tamanho da fonte utilizada nos errors no q-field.
|
|
182
|
+
font-size: 11px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
</style>
|
|
@@ -9,6 +9,11 @@ props:
|
|
|
9
9
|
default: true
|
|
10
10
|
type: Boolean
|
|
11
11
|
|
|
12
|
+
label:
|
|
13
|
+
desc: Label utilizada em casos de ser checkbox-group.
|
|
14
|
+
default: ''
|
|
15
|
+
type: String
|
|
16
|
+
|
|
12
17
|
model-value:
|
|
13
18
|
desc: Model do componente, usado para v-model.
|
|
14
19
|
default: []
|
|
@@ -21,6 +26,19 @@ props:
|
|
|
21
26
|
default: []
|
|
22
27
|
type: Array
|
|
23
28
|
|
|
29
|
+
error:
|
|
30
|
+
desc: Booleano que caso seja true a label passa a ter a cor vermelha.
|
|
31
|
+
type: Boolean
|
|
32
|
+
|
|
33
|
+
error-message:
|
|
34
|
+
desc: Mensagem de erro exibida na parte inferior do checkbox.
|
|
35
|
+
type: String
|
|
36
|
+
|
|
37
|
+
required:
|
|
38
|
+
desc: Controla se exibirá o sufixo "*" ao lado do texto.
|
|
39
|
+
default: false
|
|
40
|
+
type: Boolean
|
|
41
|
+
|
|
24
42
|
events:
|
|
25
43
|
'@update:model-value -> function(value)':
|
|
26
44
|
desc: Dispara quando o model-value altera, também usado para v-model.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span>
|
|
3
|
-
<slot>{{ props.text }}</slot>
|
|
3
|
+
<slot v-if="props.useText">{{ props.text }}</slot>
|
|
4
4
|
|
|
5
5
|
<qas-btn class="q-ml-xs" color="primary" :icon="props.icon" :loading="isLoading" variant="tertiary" @click.stop.prevent="copy">
|
|
6
6
|
<q-tooltip>Copiar</q-tooltip>
|
|
@@ -23,13 +23,23 @@ const props = defineProps({
|
|
|
23
23
|
text: {
|
|
24
24
|
required: true,
|
|
25
25
|
type: String
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
useText: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
rawText: {
|
|
34
|
+
default: '',
|
|
35
|
+
type: String
|
|
26
36
|
}
|
|
27
37
|
})
|
|
28
38
|
|
|
29
39
|
const isLoading = ref(false)
|
|
30
40
|
|
|
31
41
|
function copy () {
|
|
32
|
-
copyToClipboard(props.text, value => {
|
|
42
|
+
copyToClipboard(props.rawText || props.text, value => {
|
|
33
43
|
isLoading.value = value
|
|
34
44
|
})
|
|
35
45
|
}
|
|
@@ -13,3 +13,11 @@ props:
|
|
|
13
13
|
desc: Texto a ser copiado.
|
|
14
14
|
type: String
|
|
15
15
|
|
|
16
|
+
use-text:
|
|
17
|
+
desc: Controla se o texto será exibo ao lado do botão ou não.
|
|
18
|
+
type: Boolean
|
|
19
|
+
default: true
|
|
20
|
+
|
|
21
|
+
raw-text:
|
|
22
|
+
desc: Caso o texto a ser copiado precise ser diferente do texto a ser exibido, utilize esta propriedade.
|
|
23
|
+
type: String
|