@bildvitta/quasar-ui-asteroid 3.17.0-beta.2 → 3.17.0-beta.4
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 +1 -1
- package/src/components/grid-generator/QasGridGenerator.vue +50 -24
- package/src/components/grid-generator/QasGridGenerator.yml +15 -0
- package/src/components/select/QasSelect.vue +86 -0
- package/src/components/select/QasSelect.yml +6 -0
- package/src/css/components/item.scss +5 -1
package/package.json
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
<component :is="component.is" v-bind="component.props">
|
|
3
|
+
<qas-header v-if="hasHeader" v-bind="props.headerProps" />
|
|
4
|
+
|
|
5
|
+
<div :class="classes">
|
|
6
|
+
<div v-for="(field, key) in fieldsByResult" :key="key" :class="getContainerClass({ key })">
|
|
7
|
+
<slot :field="field" :name="`field-${field.name}`">
|
|
8
|
+
<qas-grid-item :use-ellipsis="props.useEllipsis" :use-inline="props.useInline">
|
|
9
|
+
<template #header>
|
|
10
|
+
<slot :field="field" :name="`header-field-${field.name}`">
|
|
11
|
+
<slot :field="field" name="header">
|
|
12
|
+
<div :class="headerClass" :data-cy="`grid-generator-${field.name}-field`" :title="getTitle(field, 'label')">
|
|
13
|
+
{{ field.label }}
|
|
14
|
+
</div>
|
|
15
|
+
</slot>
|
|
12
16
|
</slot>
|
|
13
|
-
</
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<template #content>
|
|
20
|
+
<slot :field="field" :name="`content-field-${field.name}`">
|
|
21
|
+
<slot :field="field" name="content">
|
|
22
|
+
<div :class="contentClass" :data-cy="`grid-generator-${field.name}-result`" :title="getTitle(field, 'formattedResult')">
|
|
23
|
+
{{ field.formattedResult }}
|
|
24
|
+
</div>
|
|
25
|
+
</slot>
|
|
22
26
|
</slot>
|
|
23
|
-
</
|
|
24
|
-
</
|
|
25
|
-
</
|
|
26
|
-
</
|
|
27
|
+
</template>
|
|
28
|
+
</qas-grid-item>
|
|
29
|
+
</slot>
|
|
30
|
+
</div>
|
|
27
31
|
</div>
|
|
28
|
-
</
|
|
32
|
+
</component>
|
|
29
33
|
</template>
|
|
30
34
|
|
|
31
35
|
<script setup>
|
|
@@ -44,6 +48,11 @@ const screen = useScreen()
|
|
|
44
48
|
const props = defineProps({
|
|
45
49
|
...baseProps,
|
|
46
50
|
|
|
51
|
+
boxProps: {
|
|
52
|
+
type: Object,
|
|
53
|
+
default: () => ({})
|
|
54
|
+
},
|
|
55
|
+
|
|
47
56
|
contentClass: {
|
|
48
57
|
default: '',
|
|
49
58
|
type: [Array, Object, String]
|
|
@@ -54,6 +63,11 @@ const props = defineProps({
|
|
|
54
63
|
type: [Array, Object, String]
|
|
55
64
|
},
|
|
56
65
|
|
|
66
|
+
headerProps: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({})
|
|
69
|
+
},
|
|
70
|
+
|
|
57
71
|
emptyResultText: {
|
|
58
72
|
default: '-',
|
|
59
73
|
type: String
|
|
@@ -64,6 +78,10 @@ const props = defineProps({
|
|
|
64
78
|
type: Object
|
|
65
79
|
},
|
|
66
80
|
|
|
81
|
+
useBox: {
|
|
82
|
+
type: Boolean
|
|
83
|
+
},
|
|
84
|
+
|
|
67
85
|
useEmptyResult: {
|
|
68
86
|
default: true,
|
|
69
87
|
type: Boolean
|
|
@@ -85,6 +103,7 @@ const { classes, getFieldClass } = useGenerator({ props })
|
|
|
85
103
|
// computed
|
|
86
104
|
const hasResult = computed(() => Object.keys(props.result).length)
|
|
87
105
|
const hasFields = computed(() => Object.keys(props.fields).length)
|
|
106
|
+
const hasHeader = computed(() => Object.keys(props.headerProps).length)
|
|
88
107
|
|
|
89
108
|
const contentClass = computed(() => {
|
|
90
109
|
return [
|
|
@@ -96,6 +115,13 @@ const contentClass = computed(() => {
|
|
|
96
115
|
]
|
|
97
116
|
})
|
|
98
117
|
|
|
118
|
+
const component = computed(() => {
|
|
119
|
+
return {
|
|
120
|
+
is: props.useBox ? 'qas-box' : 'div',
|
|
121
|
+
props: props.useBox ? props.boxProps : {}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
99
125
|
const headerClass = computed(() => {
|
|
100
126
|
return [
|
|
101
127
|
props.headerClass,
|
|
@@ -4,6 +4,11 @@ meta:
|
|
|
4
4
|
desc: Componente para criação de textos dinâmicos.
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
|
+
box-props:
|
|
8
|
+
desc: Propriedades do "QasBox" que envolve o conteúdo.
|
|
9
|
+
default: {}
|
|
10
|
+
type: Object
|
|
11
|
+
|
|
7
12
|
columns:
|
|
8
13
|
desc: Colunas do grid de cada campo.
|
|
9
14
|
default: col-6
|
|
@@ -41,6 +46,11 @@ props:
|
|
|
41
46
|
default: 'text-bold'
|
|
42
47
|
type: [Array, Object, String]
|
|
43
48
|
|
|
49
|
+
header-props:
|
|
50
|
+
desc: Propriedades do "QasHeader".
|
|
51
|
+
default: {}
|
|
52
|
+
type: Object
|
|
53
|
+
|
|
44
54
|
result:
|
|
45
55
|
desc: Resultado contendo todas informações para serem exibidas na tela.
|
|
46
56
|
default: {}
|
|
@@ -52,6 +62,11 @@ props:
|
|
|
52
62
|
default: true
|
|
53
63
|
type: Boolean
|
|
54
64
|
|
|
65
|
+
use-box:
|
|
66
|
+
desc: Controla se o componente vai ter o QasBox englobando ou não.
|
|
67
|
+
default: false
|
|
68
|
+
type: Boolean
|
|
69
|
+
|
|
55
70
|
use-ellipsis:
|
|
56
71
|
desc: Adiciona a classe "ellipsis" para o elemento do conteúdo.
|
|
57
72
|
default: true
|
|
@@ -30,6 +30,34 @@
|
|
|
30
30
|
</qas-badge>
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
|
+
<template v-if="useCustomOptions" #option="scope">
|
|
34
|
+
<q-item v-bind="scope.itemProps" class="qas-select__option">
|
|
35
|
+
<q-item-section>
|
|
36
|
+
<div class="items-center q-gutter-x-sm row">
|
|
37
|
+
<q-item-label>
|
|
38
|
+
{{ scope.opt.label }}
|
|
39
|
+
</q-item-label>
|
|
40
|
+
|
|
41
|
+
<div v-for="(badge, index) in getFilteredBadgeList(scope.opt)" :key="index">
|
|
42
|
+
<qas-badge v-if="hasBadge(badge)" v-bind="getBadgeProps(badge)" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div v-if="scope.opt.caption">
|
|
47
|
+
<div class="items-center q-col-gutter-x-sm row">
|
|
48
|
+
<q-item-label v-for="(caption, index) in getCaptionArray(scope.opt.caption)" :key="index" caption class="items-center q-mt-xs row">
|
|
49
|
+
<div>
|
|
50
|
+
{{ caption }}
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<q-separator v-if="hasSeparator({ caption: getCaptionArray(scope.opt.caption), index })" class="q-ml-sm" vertical />
|
|
54
|
+
</q-item-label>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</q-item-section>
|
|
58
|
+
</q-item>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
33
61
|
<template v-for="(_, name) in $slots" #[name]="context">
|
|
34
62
|
<slot :name="name" v-bind="context || {}" />
|
|
35
63
|
</template>
|
|
@@ -50,6 +78,11 @@ export default {
|
|
|
50
78
|
mixins: [searchFilterMixin],
|
|
51
79
|
|
|
52
80
|
props: {
|
|
81
|
+
badgeProps: {
|
|
82
|
+
default: () => ({}),
|
|
83
|
+
type: Object
|
|
84
|
+
},
|
|
85
|
+
|
|
53
86
|
fuseOptions: {
|
|
54
87
|
default: () => ({}),
|
|
55
88
|
type: Object
|
|
@@ -83,6 +116,10 @@ export default {
|
|
|
83
116
|
type: Boolean
|
|
84
117
|
},
|
|
85
118
|
|
|
119
|
+
useCustomOptions: {
|
|
120
|
+
type: Boolean
|
|
121
|
+
},
|
|
122
|
+
|
|
86
123
|
useFetchOptionsOnCreate: {
|
|
87
124
|
default: true,
|
|
88
125
|
type: Boolean
|
|
@@ -328,6 +365,51 @@ export default {
|
|
|
328
365
|
: this.options[0]
|
|
329
366
|
|
|
330
367
|
this.$emit('update:modelValue', modelValue)
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
getFilteredBadgeList (payload = {}) {
|
|
371
|
+
const { label, value, disable, caption, ...rest } = payload
|
|
372
|
+
|
|
373
|
+
const badgeList = []
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Exemplo de estrutura percorrida:
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* {
|
|
380
|
+
* isTester: true,
|
|
381
|
+
* isOwner: false
|
|
382
|
+
* }
|
|
383
|
+
*/
|
|
384
|
+
for (const [key, val] of Object.entries(rest)) {
|
|
385
|
+
if (key in this.badgeProps) {
|
|
386
|
+
badgeList.push({ [key]: val })
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return badgeList
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
getBadgeProps (badge) {
|
|
394
|
+
const model = Object.keys(badge)[0]
|
|
395
|
+
|
|
396
|
+
const isFunction = typeof this.badgeProps[model] === 'function'
|
|
397
|
+
|
|
398
|
+
return isFunction ? this.badgeProps[model](badge[model]).props : this.badgeProps[model]
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
hasBadge (badge) {
|
|
402
|
+
const model = Object.keys(badge)[0]
|
|
403
|
+
|
|
404
|
+
return badge[model] || this.badgeProps[model](badge[model]).show
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
getCaptionArray (caption) {
|
|
408
|
+
return Array.isArray(caption) ? caption : [caption]
|
|
409
|
+
},
|
|
410
|
+
|
|
411
|
+
hasSeparator ({ caption, index }) {
|
|
412
|
+
return index !== caption.length - 1
|
|
331
413
|
}
|
|
332
414
|
}
|
|
333
415
|
}
|
|
@@ -353,6 +435,10 @@ export default {
|
|
|
353
435
|
}
|
|
354
436
|
}
|
|
355
437
|
|
|
438
|
+
&__option:hover .q-item__label--caption {
|
|
439
|
+
color: var(--q-primary);
|
|
440
|
+
}
|
|
441
|
+
|
|
356
442
|
&--closed {
|
|
357
443
|
.q-field__native span {
|
|
358
444
|
white-space: nowrap;
|
|
@@ -7,6 +7,12 @@ meta:
|
|
|
7
7
|
desc: Componente para select que implementa o "QSelect" repassando propriedades, slots e eventos.
|
|
8
8
|
|
|
9
9
|
props:
|
|
10
|
+
badge-list:
|
|
11
|
+
desc: Configuração das badges no qual cada key é um callback com o valor booleano retornado pelo back.
|
|
12
|
+
default: {}
|
|
13
|
+
examples: ["{ isTester: () => { return { color: 'grey-8', label: 'Tester', textColor: 'white' }} }"]
|
|
14
|
+
type: Object
|
|
15
|
+
|
|
10
16
|
entity:
|
|
11
17
|
desc: Entidade enviada para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
|
|
12
18
|
default: ''
|
|
@@ -27,13 +27,17 @@
|
|
|
27
27
|
|
|
28
28
|
&--clickable:not(&--active) {
|
|
29
29
|
color: $grey-10;
|
|
30
|
-
transition:
|
|
30
|
+
transition: var(--qas-generic-transition);
|
|
31
31
|
|
|
32
32
|
&:not(&.q-router-link--active):hover {
|
|
33
33
|
color: var(--q-primary-contrast);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
&__label--caption {
|
|
38
|
+
transition: var(--qas-generic-transition);
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
&__section--avatar {
|
|
38
42
|
min-width: 0;
|
|
39
43
|
}
|