@bildvitta/quasar-ui-asteroid 3.20.0-beta.14 → 3.20.0-beta.16

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.20.0-beta.14",
4
+ "version": "3.20.0-beta.16",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -45,7 +45,7 @@
45
45
  "@bildvitta/composables": "^1.0.0-beta.7",
46
46
  "@bildvitta/store-adapter": "^1.0.0",
47
47
  "autonumeric": "4.10.9",
48
- "axios": "^1.4.0",
48
+ "axios": "1.4.0",
49
49
  "date-fns": "^2.30.0",
50
50
  "pdfjs-dist": "4.3.136",
51
51
  "debug": "^4.3.4",
@@ -362,7 +362,7 @@ const columnContainerElements = computed(() => {
362
362
  const normalizedHeaders = computed(() => {
363
363
  // retorna dados fakes para criar colunas de skeleton, caso a prop skeleton seja true.
364
364
  if (props.skeleton) {
365
- return Array.from({ length: 4 }).map((_, index) => {
365
+ return Array.from({ length: 8 }).map((_, index) => {
366
366
  return {
367
367
  [props.columnIdKey]: `${props.columnIdKey}-${index}`
368
368
  }
@@ -67,6 +67,7 @@
67
67
  </template>
68
68
 
69
69
  <script setup>
70
+ import QasRouterLink from '../router-link/QasRouterLink.vue'
70
71
  import QasTooltip from '../tooltip/QasTooltip.vue'
71
72
  import QasActionsMenu from '../actions-menu/QasActionsMenu.vue'
72
73
  import QasCheckbox from '../checkbox/QasCheckbox.vue'
@@ -128,6 +129,10 @@ const props = defineProps({
128
129
  default: true
129
130
  },
130
131
 
132
+ useOverlayRoute: {
133
+ type: Boolean
134
+ },
135
+
131
136
  useSelection: {
132
137
  type: Boolean
133
138
  }
@@ -172,11 +177,13 @@ const titleComponent = computed(() => {
172
177
  const hasRoute = !!Object.keys(props.route).length && !props.skeleton
173
178
 
174
179
  return {
175
- is: hasRoute ? 'router-link' : 'h5',
180
+ is: hasRoute ? QasRouterLink : 'h5',
181
+
176
182
  props: {
177
183
  ...(hasRoute && {
178
- to: props.route,
179
- class: 'qas-card__router'
184
+ route: props.route,
185
+ useOverlayRoute: props.useOverlayRoute,
186
+ title: props.title
180
187
  })
181
188
  }
182
189
  }
@@ -229,12 +236,6 @@ const formattedActionsMenuProps = computed(() => {
229
236
  background-color: transparent;
230
237
  }
231
238
 
232
- &__router {
233
- &:hover {
234
- color: $primary;
235
- }
236
- }
237
-
238
239
  &__expansion-header {
239
240
  transition: color var(--qas-generic-transition);
240
241
 
@@ -29,6 +29,11 @@ props:
29
29
  default: {}
30
30
  type: Object
31
31
 
32
+ use-overlay-route:
33
+ desc: Quando verdadeiro, o clique no título abre a rota no overlay em vez de navegar normalmente. Ao abrir em uma nova guia, o comportamento padrão do `router-link` é mantido.
34
+ default: false
35
+ type: Boolean
36
+
32
37
  status-color:
33
38
  desc: Insere uma borda na esquerda para indicar o status do card.
34
39
  default: ''
@@ -7,7 +7,7 @@
7
7
  </slot>
8
8
  </span>
9
9
 
10
- <qas-btn class="q-ml-xs" color="primary" :icon="props.icon" :loading="isLoading" variant="tertiary" @click.stop.prevent="copy">
10
+ <qas-btn class="q-ml-xs" color="primary" :icon="props.icon" :loading="isLoading" variant="tertiary" v-bind="props.buttonProps" @click.stop.prevent="copy">
11
11
  <qas-tooltip text="Copiar" />
12
12
  </qas-btn>
13
13
  </span>
@@ -41,6 +41,11 @@ const props = defineProps({
41
41
  rawText: {
42
42
  default: '',
43
43
  type: String
44
+ },
45
+
46
+ buttonProps: {
47
+ type: Object,
48
+ default: () => ({})
44
49
  }
45
50
  })
46
51
 
@@ -21,3 +21,8 @@ props:
21
21
  raw-text:
22
22
  desc: Caso o texto a ser copiado precise ser diferente do texto a ser exibido, utilize esta propriedade.
23
23
  type: String
24
+
25
+ button-props:
26
+ desc: Propriedades adicionais que serão repassadas ao botão.
27
+ type: Object
28
+ default: () => ({})
@@ -0,0 +1,72 @@
1
+ <!--
2
+ Tratamento feito para ter o comportamento de ao abrir em uma nova guia, direto na página, abre sem overlay.
3
+ Caso contrário, ao clicar normalmente, abrirá no overlay.
4
+ -->
5
+ <template>
6
+ <router-link
7
+ class="qas-router-link text-no-decoration"
8
+ v-bind="routerLinkProps"
9
+ >
10
+ <slot>
11
+ {{ props.label }}
12
+ </slot>
13
+ </router-link>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { computed } from 'vue'
18
+ import { useRouter } from 'vue-router'
19
+ import { useOverlayNavigation } from 'asteroid'
20
+
21
+ defineOptions({ name: 'QasRouterLink' })
22
+
23
+ const props = defineProps({
24
+ label: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+
29
+ route: {
30
+ type: Object,
31
+ required: true
32
+ },
33
+
34
+ useOverlayRoute: {
35
+ type: Boolean
36
+ }
37
+ })
38
+
39
+ // composables
40
+ const router = useRouter()
41
+ const { getOverlayRoute } = useOverlayNavigation()
42
+
43
+ // computeds
44
+ const routerLinkProps = computed(() => {
45
+ return {
46
+ to: props.route,
47
+
48
+ ...(props.useOverlayRoute && {
49
+ onClick: event => {
50
+ /**
51
+ * @click.prevent pra evitar com que o router-link já trate o clique e tente navegar para a rota
52
+ * normalmente, o que não é o desejado quando queremos abrir um overlay
53
+ */
54
+ event.preventDefault()
55
+
56
+ router.push(getOverlayRoute(props.route))
57
+ }
58
+ })
59
+ }
60
+ })
61
+ </script>
62
+
63
+ <style lang="scss">
64
+ .qas-router-link {
65
+ transition: color var(--qas-generic-transition);
66
+ color: inherit;
67
+
68
+ &:hover {
69
+ color: $primary;
70
+ }
71
+ }
72
+ </style>
@@ -0,0 +1,24 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Componente de link baseado no router-link. Ao passar a prop use-overlay-route, o clique normal abre a rota no overlay. Ao abrir em uma nova guia, navega diretamente para a página, sem overlay.
5
+
6
+ props:
7
+ label:
8
+ desc: Texto exibido como conteúdo padrão do link, utilizado quando o slot default não é fornecido.
9
+ default: ''
10
+ type: String
11
+
12
+ route:
13
+ desc: Rota de destino do link, repassada diretamente ao `router-link`.
14
+ required: true
15
+ type: Object
16
+
17
+ use-overlay-route:
18
+ desc: Quando verdadeiro, o clique no link abre a rota no overlay em vez de navegar normalmente. Ao abrir em uma nova guia, o comportamento padrão do `router-link` é mantido.
19
+ default: false
20
+ type: Boolean
21
+
22
+ slots:
23
+ default:
24
+ desc: Conteúdo do link. Quando não fornecido, exibe o valor da prop `label`.
@@ -138,7 +138,7 @@ export default {
138
138
  },
139
139
 
140
140
  hasNoOptionsOnFirstFetch () {
141
- return this.mx_fetchCount === 1 && !this.mx_hasFilteredOptions
141
+ return this.mx_fetchCount === 1 && !this.mx_hasFilteredOptions && !this.mx_hasNextPage
142
142
  },
143
143
 
144
144
  containerHeight () {
@@ -9,22 +9,24 @@
9
9
  v-if="canShowContainerList"
10
10
  class="q-mt-md relative-position"
11
11
  >
12
- <span class="text-grey-10 text-subtitle1">
13
- {{ props.listLabel }}
14
- </span>
15
-
16
12
  <slot name="selected-content">
17
- <q-virtual-scroll #default="{ item, index }" class="app-select-list-dialog__list q-mt-md" :items="selectedOptions" separator>
18
- <q-item class="q-px-none text-body1 text-grey-8">
19
- <q-item-section>
20
- {{ item.label }}
21
- </q-item-section>
22
-
23
- <q-item-section avatar>
24
- <qas-btn v-bind="getRemoveButtonProps({ index, option: item })" />
25
- </q-item-section>
26
- </q-item>
27
- </q-virtual-scroll>
13
+ <qas-search-box v-model:results="searchedResults" v-bind="searchSelectedItemsBoxProps" class="q-mt-md">
14
+ <span class="text-grey-10 text-subtitle1">
15
+ {{ props.listLabel }}
16
+ </span>
17
+
18
+ <q-virtual-scroll #default="{ item, index }" class="app-select-list-dialog__list" :items="searchedResults" separator>
19
+ <q-item class="q-px-none text-body1 text-grey-8">
20
+ <q-item-section>
21
+ {{ item.label }}
22
+ </q-item-section>
23
+
24
+ <q-item-section avatar>
25
+ <qas-btn v-bind="getRemoveButtonProps({ index, option: item })" />
26
+ </q-item-section>
27
+ </q-item>
28
+ </q-virtual-scroll>
29
+ </qas-search-box>
28
30
  </slot>
29
31
 
30
32
  <q-inner-loading :showing="props.loading">
@@ -132,6 +134,11 @@ const props = defineProps({
132
134
 
133
135
  useLazyLoading: {
134
136
  type: Boolean
137
+ },
138
+
139
+ searchPlaceholder: {
140
+ default: 'Pesquisar...',
141
+ type: String
135
142
  }
136
143
  })
137
144
 
@@ -174,6 +181,7 @@ defineExpose({ add, removeAll, remove, toggleDialog })
174
181
 
175
182
  // refs
176
183
  const model = ref([...props.modelValue])
184
+ const searchedResults = ref([])
177
185
 
178
186
  // computeds
179
187
  const hasError = computed(() => Array.isArray(props.error) ? !!props.error.length : !!props.error)
@@ -210,6 +218,15 @@ const hasLazyLoading = computed(() => {
210
218
  return props.useLazyLoading || !!props.selectListProps?.searchBoxProps?.useLazyLoading
211
219
  })
212
220
 
221
+ const searchSelectedItemsBoxProps = computed(() => {
222
+ return {
223
+ fuseOptions: { keys: ['label'] },
224
+ list: selectedOptions.value,
225
+ useEmptyResults: false,
226
+ placeholder: props.searchPlaceholder
227
+ }
228
+ })
229
+
213
230
  watch(() => props.modelValue, newValue => {
214
231
  model.value = [...newValue]
215
232
  })
@@ -55,6 +55,11 @@ props:
55
55
  type: Array
56
56
  model: true
57
57
 
58
+ search-placeholder:
59
+ desc: Placeholder do campo de busca.
60
+ default: Pesquisar...
61
+ type: String
62
+
58
63
  select-list-model:
59
64
  desc: Model dos itens selecionados dentro do dialog.
60
65
  type: Array
@@ -64,8 +69,8 @@ props:
64
69
 
65
70
  select-list-props:
66
71
  desc: Propriedades repassadas para o componente QasSelectList.
67
- default: []
68
- type: Array
72
+ default: {}
73
+ type: Object
69
74
 
70
75
  use-lazy-loading:
71
76
  desc: O componente precisa saber se o lazy-loading esta habilitado para este componente, e caso esteja usando customização pelos slots do "dialog-description", é necessário informar por esta prop.
@@ -86,6 +86,12 @@ export default {
86
86
  return !!this.mx_filteredOptions.length
87
87
  },
88
88
 
89
+ mx_hasNextPage () {
90
+ const { lastPage, page, hasCount, hasNextPage } = this.mx_pagination
91
+
92
+ return hasCount ? !!(lastPage && page <= lastPage) : hasNextPage
93
+ },
94
+
89
95
  mx_hasOptionsToExclude () {
90
96
  return !!this.optionsToExclude.length
91
97
  }