@bildvitta/quasar-ui-asteroid 3.12.0-beta.4 → 3.12.0-beta.6
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
CHANGED
|
@@ -1,87 +1,110 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="
|
|
3
|
-
<
|
|
2
|
+
<div v-if="show" class="inline-block">
|
|
3
|
+
<div class="bg-dark flex justify-between no-wrap q-pa-md qas-alert relative-position">
|
|
4
|
+
<div class="qas-alert__border-left" :class="borderClass" />
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<div class="text-body1 text-white">
|
|
7
|
+
<slot>
|
|
8
|
+
{{ text }}
|
|
9
|
+
</slot>
|
|
10
|
+
</div>
|
|
9
11
|
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
<qas-btn
|
|
13
|
+
class="q-ml-xs qas-alert__close"
|
|
14
|
+
color="white"
|
|
15
|
+
icon="sym_r_close"
|
|
16
|
+
:use-hover-on-white-color="false"
|
|
17
|
+
@click="close"
|
|
18
|
+
/>
|
|
13
19
|
</div>
|
|
14
20
|
</div>
|
|
15
21
|
</template>
|
|
16
22
|
|
|
17
|
-
<script>
|
|
18
|
-
import
|
|
19
|
-
import
|
|
23
|
+
<script setup>
|
|
24
|
+
import { LocalStorage } from 'quasar'
|
|
25
|
+
import { Status, StatusColor } from '../../enums/Status'
|
|
26
|
+
import { computed, watch, ref } from 'vue'
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
name: 'QasAlert',
|
|
28
|
+
defineOptions({ name: 'QasAlert' })
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
27
34
|
},
|
|
28
35
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: Boolean
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
text: {
|
|
36
|
-
default: '',
|
|
37
|
-
type: String
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
color: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: 'primary'
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
title: {
|
|
46
|
-
default: '',
|
|
47
|
-
type: String
|
|
48
|
-
}
|
|
36
|
+
text: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
49
39
|
},
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
model: true
|
|
56
|
-
}
|
|
41
|
+
storageKey: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ''
|
|
57
44
|
},
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
status: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: Status.Info,
|
|
49
|
+
validator: value => Object.values(Status).includes(value)
|
|
63
50
|
},
|
|
64
51
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
52
|
+
usePersistentModelOnClose: {
|
|
53
|
+
type: Boolean
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits(['update:modelValue'])
|
|
58
|
+
|
|
59
|
+
const model = ref(props.modelValue)
|
|
60
|
+
|
|
61
|
+
watch(() => props.modelValue, value => {
|
|
62
|
+
model.value = value
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const colorByStatus = computed(() => {
|
|
66
|
+
const status = Object.keys(Status).find(key => Status[key] === props.status)
|
|
67
|
+
return StatusColor[status]
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const borderClass = computed(() => `bg-${colorByStatus.value}`)
|
|
71
|
+
|
|
72
|
+
const storageClosedKey = computed(() => `alert-${props.storageKey}-closed`)
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const isClosed = computed(() => {
|
|
75
|
+
return props.usePersistentModelOnClose && LocalStorage.getItem(storageClosedKey.value)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const show = computed(() => !isClosed.value && model.value)
|
|
79
|
+
|
|
80
|
+
function close () {
|
|
81
|
+
if (props.usePersistentModelOnClose) {
|
|
82
|
+
LocalStorage.set(storageClosedKey.value, true)
|
|
78
83
|
}
|
|
84
|
+
|
|
85
|
+
model.value = false
|
|
86
|
+
|
|
87
|
+
emit('update:modelValue', model.value)
|
|
79
88
|
}
|
|
89
|
+
|
|
80
90
|
</script>
|
|
81
91
|
|
|
82
92
|
<style lang="scss">
|
|
83
93
|
.qas-alert {
|
|
84
|
-
border-
|
|
85
|
-
|
|
94
|
+
border-radius: var(--qas-generic-border-radius);
|
|
95
|
+
|
|
96
|
+
&__border-left {
|
|
97
|
+
border-radius: var(--qas-generic-border-radius) 0 0 var(--qas-generic-border-radius);
|
|
98
|
+
bottom: 0;
|
|
99
|
+
content: '';
|
|
100
|
+
left: 0;
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 0;
|
|
103
|
+
width: 4px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__close {
|
|
107
|
+
top: calc(var(--qas-spacing-sm) * -1);
|
|
108
|
+
}
|
|
86
109
|
}
|
|
87
110
|
</style>
|
|
@@ -9,21 +9,27 @@ props:
|
|
|
9
9
|
default: true
|
|
10
10
|
type: Boolean
|
|
11
11
|
|
|
12
|
-
title:
|
|
13
|
-
desc: Título do componente.
|
|
14
|
-
type: String
|
|
15
|
-
|
|
16
12
|
text:
|
|
17
13
|
desc: Texto do componente.
|
|
18
14
|
type: String
|
|
19
15
|
|
|
16
|
+
status:
|
|
17
|
+
desc: Status do alerta.
|
|
18
|
+
type: String
|
|
19
|
+
examples: ['error', 'info']
|
|
20
|
+
|
|
21
|
+
storage-key:
|
|
22
|
+
desc: Chave a ser salva no localStorage, necessário caso esteja usando mais de um QasAlert na aplicação e ambos estejam com a prop "use-persist-model-on-close" ativada.
|
|
23
|
+
type: String
|
|
24
|
+
|
|
25
|
+
use-persistent-model-on-close:
|
|
26
|
+
desc: Habilita salvar o model em localStorage ao fechar o alerta para não aparecer novamente.
|
|
27
|
+
type: Boolean
|
|
28
|
+
|
|
20
29
|
slots:
|
|
21
30
|
default:
|
|
22
31
|
desc: 'Slot para acessar o conteúdo gerado pela prop "text"'
|
|
23
32
|
|
|
24
|
-
header:
|
|
25
|
-
desc: 'Slot para acessar o conteúdo gerado pela prop "title"'
|
|
26
|
-
|
|
27
33
|
events:
|
|
28
34
|
'@update:model-value -> function(value)':
|
|
29
35
|
desc: Dispara quando o model-value altera, também usado para v-model.
|
|
@@ -130,7 +130,7 @@ export default {
|
|
|
130
130
|
},
|
|
131
131
|
|
|
132
132
|
disabledRows: {
|
|
133
|
-
type: [Array, Boolean],
|
|
133
|
+
type: [Array, Boolean, Function],
|
|
134
134
|
default: false
|
|
135
135
|
},
|
|
136
136
|
|
|
@@ -449,6 +449,8 @@ export default {
|
|
|
449
449
|
isDisabledRow (row) {
|
|
450
450
|
if (!this.disabledRows) return false
|
|
451
451
|
|
|
452
|
+
if (typeof this.disabledRows === 'function') return this.disabledRows(row)
|
|
453
|
+
|
|
452
454
|
if (typeof this.disabledRows === 'boolean') return true
|
|
453
455
|
|
|
454
456
|
return this.disabledRows.includes(row[this.identifierItemKey])
|
|
@@ -37,10 +37,10 @@ props:
|
|
|
37
37
|
type: String
|
|
38
38
|
|
|
39
39
|
disabled-rows:
|
|
40
|
-
desc: Com esta propriedade é possível desabilitar rows (linhas) especificas passando um array com chaves identificadoras,
|
|
40
|
+
desc: Com esta propriedade é possível desabilitar rows (linhas) especificas passando um array com chaves identificadoras, caso queira desativar todas passe um valor boolean "true", ou também é possível utilizar uma função de callback, que receberá a "row" como parâmetro. (Isto vai remover todos os botões da linha, como por exemplo, o duplicar e excluir).
|
|
41
41
|
default: "false"
|
|
42
|
-
type: [Array, Boolean]
|
|
43
|
-
examples: ["['my-uuid-from-row-1']", true]
|
|
42
|
+
type: [Array, Boolean, Function]
|
|
43
|
+
examples: ["['my-uuid-from-row-1']", true, "row => row.disable"]
|
|
44
44
|
|
|
45
45
|
errors:
|
|
46
46
|
desc: Propriedade de erros para mostrar nos campos gerados.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cores por status
|
|
3
|
+
*
|
|
4
|
+
* @property
|
|
5
|
+
* @name Spacing
|
|
6
|
+
* @readonly
|
|
7
|
+
* @enum
|
|
8
|
+
* @type {{
|
|
9
|
+
* Info: 'yellow-14',
|
|
10
|
+
* Error: 'red-14'
|
|
11
|
+
* }}
|
|
12
|
+
*/
|
|
13
|
+
export const StatusColor = {
|
|
14
|
+
Info: 'yellow-14',
|
|
15
|
+
Error: 'red-14'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Status
|
|
20
|
+
*
|
|
21
|
+
* @property
|
|
22
|
+
* @name Spacing
|
|
23
|
+
* @readonly
|
|
24
|
+
* @enum
|
|
25
|
+
* @type {{
|
|
26
|
+
* Info: 'info',
|
|
27
|
+
* Error: 'error'
|
|
28
|
+
* }}
|
|
29
|
+
*/
|
|
30
|
+
export const Status = {
|
|
31
|
+
Info: 'info',
|
|
32
|
+
Error: 'error'
|
|
33
|
+
}
|