@bildvitta/quasar-ui-asteroid 3.19.0-beta.0 → 3.19.0-beta.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.19.0-beta.0",
4
+ "version": "3.19.0-beta.2",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -227,6 +227,11 @@ export default {
227
227
  default: true
228
228
  },
229
229
 
230
+ useHeader: {
231
+ type: Boolean,
232
+ default: true
233
+ },
234
+
230
235
  useIndexLabel: {
231
236
  type: Boolean
232
237
  },
@@ -545,7 +550,7 @@ export default {
545
550
  },
546
551
 
547
552
  hasHeader ({ row }) {
548
- return this.hasBlockActions(row) || !this.useSingleLabel
553
+ return (this.hasBlockActions(row) || !this.useSingleLabel) && this.useHeader
549
554
  },
550
555
 
551
556
  getHeaderProps ({ index, row }) {
@@ -169,6 +169,11 @@ props:
169
169
  default: true
170
170
  type: Boolean
171
171
 
172
+ use-header:
173
+ desc: Controla se vai ter um header em cada linha.
174
+ default: true
175
+ type: Boolean
176
+
172
177
  use-index-label:
173
178
  desc: Se tiver "rowLabel" esta prop controla se cada label da linha vai ter o index como sufixo.
174
179
  type: Boolean
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <q-field class="qas-numeric-input" :class="classes" dense :label="formattedLabel" :model-value="modelValue" no-error-icon>
3
- <template #control="{ floatingLabel, id, editable }">
4
- <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :disabled="!editable" inputmode="numeric" :placeholder @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
3
+ <template #control="{ floatingLabel, id }">
4
+ <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :disabled="$attrs.disable" inputmode="numeric" :placeholder :readonly="$attrs.readonly" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
5
5
  </template>
6
6
 
7
7
  <template v-if="icon" #append>
@@ -1,20 +1,6 @@
1
1
  <template>
2
2
  <div class="app-select-list-dialog full-width">
3
- <header class="flex items-center justify-between no-wrap">
4
- <qas-label v-bind="labelProps" />
5
-
6
- <qas-btn
7
- v-bind="defaultAddButtonProps"
8
- @click="toggleDialog"
9
- />
10
- </header>
11
-
12
- <div
13
- v-if="props.description"
14
- class="q-mt-md text-body1 text-grey-8"
15
- >
16
- {{ props.description }}
17
- </div>
3
+ <qas-header v-bind="headerProps" />
18
4
 
19
5
  <component
20
6
  :is="containerListComponent"
@@ -25,17 +11,19 @@
25
11
  {{ props.listLabel }}
26
12
  </span>
27
13
 
28
- <q-virtual-scroll #default="{ item, index }" class="app-select-list-dialog__list q-mt-md" :items="selectedOptions" separator>
29
- <q-item class="q-px-none text-body1 text-grey-8">
30
- <q-item-section>
31
- {{ item.label }}
32
- </q-item-section>
14
+ <slot name="selected-content">
15
+ <q-virtual-scroll #default="{ item, index }" class="app-select-list-dialog__list q-mt-md" :items="selectedOptions" separator>
16
+ <q-item class="q-px-none text-body1 text-grey-8">
17
+ <q-item-section>
18
+ {{ item.label }}
19
+ </q-item-section>
33
20
 
34
- <q-item-section avatar>
35
- <qas-btn v-bind="getRemoveButtonProps({ index, option: item })" />
36
- </q-item-section>
37
- </q-item>
38
- </q-virtual-scroll>
21
+ <q-item-section avatar>
22
+ <qas-btn v-bind="getRemoveButtonProps({ index, option: item })" />
23
+ </q-item-section>
24
+ </q-item>
25
+ </q-virtual-scroll>
26
+ </slot>
39
27
 
40
28
  <q-inner-loading :showing="props.loading">
41
29
  <q-spinner
@@ -77,10 +65,9 @@
77
65
  </template>
78
66
 
79
67
  <script setup>
80
- import QasBox from '../box/QasBox.vue'
68
+ import QasHeader from '../header/QasHeader.vue'
81
69
  import QasBtn from '../btn/QasBtn.vue'
82
70
  import QasDialog from '../dialog/QasDialog.vue'
83
- import QasLabel from '../label/QasLabel.vue'
84
71
  import QasSelectList from '../select-list/QasSelectList.vue'
85
72
 
86
73
  import { computed, ref, watch, useSlots, inject } from 'vue'
@@ -146,16 +133,16 @@ const props = defineProps({
146
133
  }
147
134
  })
148
135
 
136
+ // emits
149
137
  const emit = defineEmits(['add', 'remove', 'update:modelValue'])
150
138
 
139
+ // slots
151
140
  const slots = useSlots()
152
141
 
142
+ // globals
153
143
  const isBox = inject('isBox', false)
154
144
 
155
- const hasError = computed(() => Array.isArray(props.error) ? !!props.error.length : !!props.error)
156
- const errorMessage = computed(() => Array.isArray(props.error) ? props.error.join(' ') : props.error)
157
- const containerListComponent = computed(() => isBox ? 'div' : QasBox)
158
-
145
+ // composables
159
146
  const {
160
147
  listModel,
161
148
  showDialog,
@@ -178,25 +165,38 @@ const {
178
165
  getRemoveButtonProps
179
166
  } = useList()
180
167
 
168
+ // expose
181
169
  defineExpose({ add, removeAll, remove })
182
170
 
171
+ // refs
183
172
  const model = ref([...props.modelValue])
184
173
 
185
- const defaultAddButtonProps = computed(() => {
186
- return {
187
- icon: 'sym_r_add',
188
- useLabelOnSmallScreen: false,
189
- ...props.addButtonProps,
190
- disable: props.disable,
191
- loading: props.loading
192
- }
193
- })
174
+ // computeds
175
+ const hasError = computed(() => Array.isArray(props.error) ? !!props.error.length : !!props.error)
176
+ const errorMessage = computed(() => Array.isArray(props.error) ? props.error.join(' ') : props.error)
177
+ const containerListComponent = computed(() => isBox ? 'div' : 'qas-box')
194
178
 
195
- const labelProps = computed(() => {
179
+ const headerProps = computed(() => {
196
180
  return {
197
- label: props.label,
198
- margin: 'none',
199
- color: hasError.value ? 'negative' : 'grey-10'
181
+ labelProps: {
182
+ label: props.label,
183
+ margin: 'none',
184
+ color: hasError.value ? 'negative' : 'grey-10'
185
+ },
186
+
187
+ spacing: 'none',
188
+ description: props.description,
189
+
190
+ buttonProps: {
191
+ icon: 'sym_r_add',
192
+ useLabelOnSmallScreen: false,
193
+ ...props.addButtonProps,
194
+ disable: props.disable,
195
+ loading: props.loading,
196
+
197
+ // events
198
+ onClick: toggleDialog
199
+ }
200
200
  }
201
201
  })
202
202
 
@@ -208,6 +208,7 @@ watch(() => props.modelValue, newValue => {
208
208
  model.value = [...newValue]
209
209
  })
210
210
 
211
+ // functions
211
212
  function updateModel () {
212
213
  emit('update:modelValue', model.value)
213
214
  }
@@ -237,7 +238,7 @@ function useList () {
237
238
  /**
238
239
  * Valida se tenho opções ou se está carregando para mostrar o container da listagem.
239
240
  */
240
- const canShowContainerList = computed(() => hasFilteredOptions.value || props.loading)
241
+ const canShowContainerList = computed(() => hasFilteredOptions.value || props.loading || !!slots['selected-content'])
241
242
  const hasFilteredOptions = computed(() => model.value.length)
242
243
 
243
244
  /*
@@ -75,6 +75,9 @@ slots:
75
75
  dialog-header:
76
76
  desc: Slot para substituir cabeçalho do dialog.
77
77
 
78
+ selected-content:
79
+ desc: Slot para personalizar o conteúdo dos itens adicionados.
80
+
78
81
  events:
79
82
  '@add -> function(items)':
80
83
  desc: Dispara toda vez que é adicionado novos itens.