@bildvitta/quasar-ui-asteroid 3.10.0-beta.0 → 3.10.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.10.0-beta.0",
4
+ "version": "3.10.0-beta.2",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="text-body1 text-grey-8">
3
+ <slot>
4
+ {{ text }}
5
+ </slot>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'QasEmptyResultText',
12
+
13
+ props: {
14
+ text: {
15
+ default: 'Não há itens para serem exibidos.',
16
+ type: String
17
+ }
18
+ }
19
+ }
20
+ </script>
@@ -0,0 +1,14 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Componente de texto em casos de resultados vazio após filtros.
5
+
6
+ props:
7
+ text:
8
+ desc: Texto a ser exibido.
9
+ default: Não há itens para serem exibidos.
10
+ type: String
11
+
12
+ slots:
13
+ default:
14
+ desc: Slot que substitui a propriedade "text".
@@ -40,7 +40,7 @@
40
40
  <script>
41
41
  import PvFiltersButton from './private/PvFiltersButton.vue'
42
42
 
43
- import { camelize, camelizeKeys } from 'humps'
43
+ import { camelize, camelizeKeys, decamelize } from 'humps'
44
44
  import { humanize, parseValue } from '../../helpers/filters.js'
45
45
  import contextMixin from '../../mixins/context.js'
46
46
  import { getState, getAction } from '@bildvitta/store-adapter'
@@ -137,8 +137,10 @@ export default {
137
137
  const hasField = fields.includes(key)
138
138
 
139
139
  if (hasField) {
140
- const value = humanize(this.fields[key], this.normalizeValues(filters[key], this.fields[key]?.multiple))
141
- const { label, name } = this.fields[key]
140
+ const field = { ...this.fields[key], ...this.formattedFieldsProps?.[key] }
141
+
142
+ const value = humanize(field, this.normalizeValues(filters[key], field?.multiple))
143
+ const { label, name } = field
142
144
 
143
145
  activeFilters[key] = { label, name, value }
144
146
  }
@@ -147,6 +149,18 @@ export default {
147
149
  return activeFilters
148
150
  },
149
151
 
152
+ formattedFieldsProps () {
153
+ const fieldsProps = {}
154
+
155
+ for (const key in this.fieldsProps) {
156
+ const decamelizedFieldKey = decamelize(key)
157
+
158
+ fieldsProps[decamelizedFieldKey] = { ...this.fieldsProps[key] }
159
+ }
160
+
161
+ return fieldsProps
162
+ },
163
+
150
164
  fields () {
151
165
  return getState.call(this, { entity: this.entity, key: 'filters' })
152
166
  },
@@ -166,7 +180,7 @@ export default {
166
180
  color: this.filterButtonColor,
167
181
  error: this.hasFetchError,
168
182
  fields: this.fields,
169
- fieldsProps: this.fieldsProps,
183
+ fieldsProps: this.formattedFieldsProps,
170
184
  loading: this.isFetching,
171
185
 
172
186
  onClear: this.clearFilters,
@@ -216,7 +230,8 @@ export default {
216
230
 
217
231
  methods: {
218
232
  clearFilters () {
219
- const { filters, ...query } = this.mx_context
233
+ const { filters } = this.mx_context
234
+ const query = { ...this.$route.query }
220
235
  const activeFilters = {
221
236
  ...filters,
222
237
  ...this.filters
@@ -298,6 +313,10 @@ export default {
298
313
  search: this.search || undefined
299
314
  }
300
315
 
316
+ for (const key in query) {
317
+ if (!query[key]) delete query[key]
318
+ }
319
+
301
320
  this.hideFiltersMenu()
302
321
  this.updateCurrentFilters()
303
322
  this.updateRouteQuery(query)
@@ -16,9 +16,7 @@
16
16
 
17
17
  <div v-else-if="!mx_isFetching">
18
18
  <slot name="empty-results">
19
- <div class="q-my-lg text-body1 text-grey-7">
20
- Não há itens para serem exibidos.
21
- </div>
19
+ <qas-empty-result-text />
22
20
  </slot>
23
21
  </div>
24
22
 
@@ -14,10 +14,7 @@
14
14
  </slot>
15
15
 
16
16
  <slot v-if="showEmptyResult" name="empty-result">
17
- <div class="absolute-center text-center">
18
- <q-icon class="q-mb-sm text-center" color="primary" name="sym_r_search" size="38px" />
19
- <div>{{ emptyResultText }}</div>
20
- </div>
17
+ <qas-empty-result-text class="q-mt-md" />
21
18
  </slot>
22
19
 
23
20
  <q-inner-loading :showing="showInnerLoading">
@@ -50,11 +47,6 @@ export default {
50
47
  type: String
51
48
  },
52
49
 
53
- emptyResultText: {
54
- default: 'Não há resultados disponíveis.',
55
- type: String
56
- },
57
-
58
50
  fuseOptions: {
59
51
  default: () => ({}),
60
52
  type: Object
@@ -228,7 +220,9 @@ export default {
228
220
  // Se tiver erro no primeiro fetch, retorna o "done" na proxima.
229
221
  if (((this.mx_hasFetchError && !this.mx_hasFilteredOptions) || this.hasNoOptionsOnFirstFetch)) return done()
230
222
 
231
- if (!this.mx_hasFilteredOptions && !this.mx_search) {
223
+ const canMakeFirstFetch = this.mx_fetchCount === 0 && this.mx_hasFilteredOptions
224
+
225
+ if ((!this.mx_hasFilteredOptions || canMakeFirstFetch) && !this.mx_search) {
232
226
  await this.mx_setFetchOptions()
233
227
  return done()
234
228
  }
@@ -9,11 +9,6 @@ props:
9
9
  default: 100px
10
10
  type: String
11
11
 
12
- empty-result-text:
13
- desc: Define o texto dentro do box quando a lista está vazia.
14
- default: Não há resultados disponíveis.
15
- type: String
16
-
17
12
  entity:
18
13
  desc: Entidade enviada para a action "fetchFieldOptions" (usar somente quando "useLazyLoading" estiver habilitada).
19
14
  default: ''
@@ -8,10 +8,7 @@
8
8
  <slot />
9
9
  </template>
10
10
 
11
- <div v-else-if="!mx_isFetching" class="q-my-xl text-center">
12
- <q-icon class="q-mb-sm text-center" color="grey-7" name="sym_r_search" size="38px" />
13
- <div class="text-grey-7">Nenhum item encontrado.</div>
14
- </div>
11
+ <qas-empty-result-text v-else-if="!mx_isFetching" class="q-my-xl" />
15
12
 
16
13
  <footer v-if="mx_hasFooterSlot">
17
14
  <slot name="footer" />
@@ -10,7 +10,7 @@
10
10
  // headings
11
11
  $h1: (
12
12
  size: 3rem,
13
- line-height: 3rem,
13
+ line-height: 140%,
14
14
  letter-spacing: 0,
15
15
  weight: 800,
16
16
  margin: 0
@@ -18,7 +18,7 @@ $h1: (
18
18
 
19
19
  $h2: (
20
20
  size: 2rem,
21
- line-height: 2rem,
21
+ line-height: 140%,
22
22
  letter-spacing: 0,
23
23
  weight: 700,
24
24
  margin: 0
@@ -26,7 +26,7 @@ $h2: (
26
26
 
27
27
  $h3: (
28
28
  size: 1.5rem,
29
- line-height: 1.5rem,
29
+ line-height: 140%,
30
30
  letter-spacing: 0,
31
31
  weight: 700,
32
32
  margin: 0
@@ -34,7 +34,7 @@ $h3: (
34
34
 
35
35
  $h4: (
36
36
  size: 1.125rem,
37
- line-height: 1.125rem,
37
+ line-height: 140%,
38
38
  letter-spacing: 0,
39
39
  weight: 600,
40
40
  margin: 0
@@ -42,7 +42,7 @@ $h4: (
42
42
 
43
43
  $h5: (
44
44
  size: 1rem,
45
- line-height: 1rem,
45
+ line-height: 140%,
46
46
  letter-spacing: 0,
47
47
  weight: 600,
48
48
  margin: 0
@@ -50,7 +50,7 @@ $h5: (
50
50
 
51
51
  $h6: (
52
52
  size: 0.875rem,
53
- line-height: 0.875rem,
53
+ line-height: 140%,
54
54
  letter-spacing: 0,
55
55
  weight: 600,
56
56
  margin: 0
@@ -59,14 +59,14 @@ $h6: (
59
59
  // subtitles
60
60
  $subtitle1: (
61
61
  size: 1rem,
62
- line-height: 1rem,
62
+ line-height: 140%,
63
63
  letter-spacing: 0,
64
64
  weight: 600
65
65
  );
66
66
 
67
67
  $subtitle2: (
68
68
  size: 0.875rem,
69
- line-height: 0.875rem,
69
+ line-height: 140%,
70
70
  letter-spacing: 0,
71
71
  weight: 600
72
72
  );
@@ -74,14 +74,14 @@ $subtitle2: (
74
74
  // body
75
75
  $body1: (
76
76
  size: 1rem,
77
- line-height: 1rem,
77
+ line-height: 140%,
78
78
  letter-spacing: 0,
79
79
  weight: 400
80
80
  );
81
81
 
82
82
  $body2: (
83
83
  size: 0.875rem,
84
- line-height: 0.875rem,
84
+ line-height: 140%,
85
85
  letter-spacing: 0,
86
86
  weight: 400
87
87
  );
@@ -89,7 +89,7 @@ $body2: (
89
89
  // overline
90
90
  $overline: (
91
91
  size: 0.875rem,
92
- line-height: 0.875rem,
92
+ line-height: 140%,
93
93
  letter-spacing: 0.25rem,
94
94
  weight: 600
95
95
  );
@@ -97,7 +97,7 @@ $overline: (
97
97
  // caption
98
98
  $caption: (
99
99
  size: 0.75rem,
100
- line-height: 0.75rem,
100
+ line-height: 140%,
101
101
  letter-spacing: 0,
102
102
  weight: 400
103
103
  );
@@ -102,14 +102,21 @@ export default {
102
102
 
103
103
  this.mx_fromSearch = !!search
104
104
 
105
- await this.mx_setFetchOptions()
105
+ const options = await this.mx_fetchOptions()
106
+
107
+ this.mx_resetOptions()
108
+
109
+ this.mx_filteredOptions.push(...options)
106
110
 
107
111
  if (this.mx_cachedOptions.length && !search) this.mx_setInitialCachedOptions()
108
112
  },
109
113
 
110
- mx_resetFilter (search) {
114
+ mx_resetOptions () {
111
115
  this.mx_filteredOptions = []
112
116
  this.mx_foundDuplicatedOptions = []
117
+ },
118
+
119
+ mx_resetFilter (search) {
113
120
  this.mx_search = search
114
121
  this.mx_pagination = {
115
122
  page: 1,
package/src/vue-plugin.js CHANGED
@@ -19,6 +19,7 @@ import QasDebugger from './components/debugger/QasDebugger.vue'
19
19
  import QasDelete from './components/delete/QasDelete.vue'
20
20
  import QasDialog from './components/dialog/QasDialog.vue'
21
21
  import QasDialogRouter from './components/dialog-router/QasDialogRouter.vue'
22
+ import QasEmptyResultText from './components/empty-result-text/QasEmptyResultText.vue'
22
23
  import QasField from './components/field/QasField.vue'
23
24
  import QasSearchInput from './components/search-input/QasSearchInput.vue'
24
25
  import QasFilters from './components/filters/QasFilters.vue'
@@ -101,6 +102,7 @@ function install (app) {
101
102
  app.component('QasDelete', QasDelete)
102
103
  app.component('QasDialog', QasDialog)
103
104
  app.component('QasDialogRouter', QasDialogRouter)
105
+ app.component('QasEmptyResultText', QasEmptyResultText)
104
106
  app.component('QasField', QasField)
105
107
  app.component('QasSearchInput', QasSearchInput)
106
108
  app.component('QasFilters', QasFilters)
@@ -184,6 +186,7 @@ export {
184
186
  QasDelete,
185
187
  QasDialog,
186
188
  QasDialogRouter,
189
+ QasEmptyResultText,
187
190
  QasField,
188
191
  QasSearchInput,
189
192
  QasFilters,