@bildvitta/quasar-ui-asteroid 3.11.0-beta.4 → 3.11.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.11.0-beta.4",
4
+ "version": "3.11.0-beta.6",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -20,7 +20,7 @@
20
20
 
21
21
  <script setup>
22
22
  import useGenerator, { baseProps } from '../../composables/private/use-generator'
23
- import { humanize } from '../../helpers/filters'
23
+ import { isEmpty, humanize } from '../../helpers'
24
24
  import { isObject } from 'lodash-es'
25
25
  import { ref, computed, watch } from 'vue'
26
26
 
@@ -102,14 +102,17 @@ function getFieldsByResult () {
102
102
  const result = { ...props.result }
103
103
  const fieldsByResult = {}
104
104
 
105
- for (const key in result) {
105
+ for (const key in formattedFields.value) {
106
106
  const field = formattedFields.value[key] || {}
107
107
 
108
108
  if (!field.type) continue
109
109
 
110
+ const humanizedResult = humanize(field, result[key])
111
+ const formattedResult = isEmpty({ value: humanizedResult }) ? props.emptyResultText : humanizedResult
112
+
110
113
  fieldsByResult[key] = {
111
114
  ...field,
112
- formattedResult: humanize(field, result[key]) || props.emptyResultText
115
+ formattedResult
113
116
  }
114
117
  }
115
118
 
@@ -16,7 +16,7 @@ props:
16
16
  type: [Array, Object, String]
17
17
 
18
18
  empty-result-text:
19
- desc: Se o resultado de algum campo for vazio, esta prop define qual será o valor padrão.
19
+ desc: Se o resultado de algum campo for vazio (null, undefined, ''), esta prop define qual será o valor padrão.
20
20
  default: '-'
21
21
  type: String
22
22
 
@@ -33,6 +33,13 @@ props:
33
33
  examples: [v-model="value"]
34
34
  model: true
35
35
 
36
+ options-to-exclude:
37
+ desc: Lista de valores que não serão exibidos na lista de resultados (options/list) que pode ser uuid/id/slug.
38
+ default: []
39
+ type: Array
40
+ examples:
41
+ - options-to-exclude="['uuid1', 'uuid2', 'uuid3']"
42
+
36
43
  readonly:
37
44
  desc: Habilita modo visualização.
38
45
  default: false
@@ -20,8 +20,7 @@
20
20
 
21
21
  <script>
22
22
  import { extend } from 'quasar'
23
- import { humanize } from '../../helpers/filters'
24
- import { setScrollOnGrab } from '../../helpers'
23
+ import { isEmpty, humanize, setScrollOnGrab } from '../../helpers'
25
24
 
26
25
  export default {
27
26
  name: 'QasTableGenerator',
@@ -190,8 +189,11 @@ export default {
190
189
 
191
190
  const mappedResults = results.map((result, index) => {
192
191
  for (const key in result) {
192
+ const humanizedResult = humanize(this.fields[key], result[key])
193
+ const formattedResult = isEmpty({ value: humanizedResult }) ? this.emptyResultText : humanizedResult
194
+
193
195
  result.default = this.results[index]
194
- result[key] = humanize(this.fields[key], result[key]) || this.emptyResultText
196
+ result[key] = formattedResult
195
197
  }
196
198
 
197
199
  return result
@@ -10,7 +10,7 @@ props:
10
10
  type: Array
11
11
 
12
12
  empty-result-text:
13
- desc: Quando uma célula da tabela está vazia, esta prop define qual será o valor padrão.
13
+ desc: Quando uma célula da tabela está vazia (null, undefined, ''), esta prop define qual será o valor padrão.
14
14
  default: '-'
15
15
  type: String
16
16
 
@@ -13,6 +13,7 @@ export { default as getGreatestCommonDivisor } from './get-greatest-common-divis
13
13
  export { default as getNormalizedOptions } from './get-normalized-options.js'
14
14
  export { default as getSlotChildrenText } from './get-slot-children-text.js'
15
15
  export { default as handleProcess } from './handle-process.js'
16
+ export { default as isEmpty } from './is-empty.js'
16
17
  export { default as isLocalDevelopment } from './is-local-development.js'
17
18
  export { default as promiseHandler } from './promise-handler.js'
18
19
  export { default as setScrollOnGrab } from './set-scroll-on-grab.js'
@@ -0,0 +1,3 @@
1
+ export default function ({ value }) {
2
+ return [null, undefined, ''].includes(value)
3
+ }
@@ -1,5 +1,5 @@
1
1
  function required (value = '', message = 'Campo obrigatório.') {
2
- return String(value ?? '') || message
2
+ return String(value ?? '').length || message
3
3
  }
4
4
 
5
5
  export {
@@ -25,6 +25,11 @@ export default {
25
25
 
26
26
  useLazyLoading: {
27
27
  type: Boolean
28
+ },
29
+
30
+ optionsToExclude: {
31
+ default: () => [],
32
+ type: Array
28
33
  }
29
34
  },
30
35
 
@@ -77,6 +82,10 @@ export default {
77
82
 
78
83
  mx_hasFilteredOptions () {
79
84
  return !!this.mx_filteredOptions.length
85
+ },
86
+
87
+ mx_hasOptionsToExclude () {
88
+ return !!this.optionsToExclude.length
80
89
  }
81
90
  },
82
91
 
@@ -192,7 +201,9 @@ export default {
192
201
 
193
202
  this.$emit('fetch-options-success', data)
194
203
 
195
- return this.mx_getNonDuplicatedOptions(results)
204
+ const options = this.mx_getOptions(results)
205
+
206
+ return this.mx_getNonDuplicatedOptions(options)
196
207
  } catch (error) {
197
208
  this.mx_hasFetchError = true
198
209
  this.$emit('fetch-options-error', error)
@@ -273,6 +284,8 @@ export default {
273
284
  this.$watch(model, options => {
274
285
  if (!options?.length) return
275
286
 
287
+ options = this.mx_getOptions(options)
288
+
276
289
  /*
277
290
  * pode ser que as opções sejam inicializadas após o primeiro fetch de opções
278
291
  * fazendo com que as opções sobrescreva as que vieram através do fetch, então é
@@ -297,6 +310,18 @@ export default {
297
310
 
298
311
  this.mx_cachedOptions = [...options]
299
312
  }, { immediate: true })
313
+ },
314
+
315
+ mx_getOptions (options = []) {
316
+ if (this.mx_hasOptionsToExclude) {
317
+ this.optionsToExclude.forEach(option => {
318
+ const index = options.findIndex(({ value }) => value === option)
319
+
320
+ if (~index) options.splice(index, 1)
321
+ })
322
+ }
323
+
324
+ return options
300
325
  }
301
326
  }
302
327
  }
package/src/vue-plugin.js CHANGED
@@ -72,19 +72,12 @@ import {
72
72
  } from './plugins'
73
73
 
74
74
  import packageInfo from '../package.json'
75
- import thirdPartyComponentsInitializer from './vue-plugin/third-party-components-initializer'
76
75
 
77
76
  // Directives
78
77
  import Test from './directives/Test.js'
79
78
 
80
79
  const version = packageInfo.version
81
80
 
82
- const thirdPartyComponentsInitializerFn = thirdPartyComponentsInitializer()
83
-
84
- const {
85
- QasMap
86
- } = thirdPartyComponentsInitializerFn.getComponents()
87
-
88
81
  async function install (app) {
89
82
  app.component('QasActions', QasActions)
90
83
  app.component('QasActionsMenu', QasActionsMenu)
@@ -147,8 +140,6 @@ async function install (app) {
147
140
  app.component('QasUploader', QasUploader)
148
141
  app.component('QasWelcome', QasWelcome)
149
142
 
150
- thirdPartyComponentsInitializerFn.initializeComponents(app)
151
-
152
143
  app.use(Quasar, { plugins: { Notify, Loading, QuasarDialog, Dialog } })
153
144
 
154
145
  app.config.globalProperties.$qas = {
@@ -203,7 +194,6 @@ export {
203
194
  QasLayout,
204
195
  QasListItems,
205
196
  QasListView,
206
- QasMap,
207
197
  QasNestedFields,
208
198
  QasNumericInput,
209
199
  QasOptionGroup,
@@ -1,16 +0,0 @@
1
- import thirdPartyComponentHandler from '../third-party-component-handler'
2
-
3
- export default function () {
4
- const { QasComponent, initializeComponent } = thirdPartyComponentHandler({
5
- name: 'QasChartView',
6
- importFn: () => import('../../components/chart-view/QasChartView.vue')
7
- })
8
-
9
- return {
10
- QasComponent,
11
-
12
- initializeComponent (app) {
13
- return initializeComponent({ app })
14
- }
15
- }
16
- }
@@ -1,16 +0,0 @@
1
- import thirdPartyComponentHandler from '../third-party-component-handler'
2
-
3
- export default function () {
4
- const { QasComponent, initializeComponent } = thirdPartyComponentHandler({
5
- name: 'QasMap',
6
- importFn: () => import('../../components/map/QasMap.vue')
7
- })
8
-
9
- return {
10
- QasComponent,
11
-
12
- initializeComponent (app) {
13
- return initializeComponent({ app })
14
- }
15
- }
16
- }
@@ -1,31 +0,0 @@
1
- import chartViewComponent from './components/chart-view-component'
2
- import mapComponent from './components/map-component'
3
-
4
- export default function () {
5
- const components = {
6
- QasChartView: chartViewComponent(),
7
- QasMap: mapComponent()
8
- }
9
-
10
- function getComponents () {
11
- const normalizedComponents = {}
12
-
13
- for (const key in components) {
14
- normalizedComponents[key] = components[key].QasComponent
15
- }
16
-
17
- return normalizedComponents
18
- }
19
-
20
- async function initializeComponents (app) {
21
- for (const key in components) {
22
- components[key].initializeComponent(app)
23
- }
24
- }
25
-
26
- return {
27
- initializeComponents,
28
-
29
- getComponents
30
- }
31
- }