@bildvitta/quasar-ui-asteroid 3.0.0-beta.7 → 3.0.0

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.
Files changed (106) hide show
  1. package/dist/api/QasAppBar.json +0 -4
  2. package/dist/api/QasBtn.json +2 -1
  3. package/dist/api/QasCard.json +13 -9
  4. package/dist/api/QasDateTimeInput.json +12 -12
  5. package/dist/api/QasDialog.json +6 -2
  6. package/dist/api/QasFilters.json +4 -4
  7. package/dist/api/QasFormGenerator.json +33 -2
  8. package/dist/api/QasFormView.json +43 -15
  9. package/dist/api/QasGridGenerator.json +5 -4
  10. package/dist/api/QasInput.json +1 -1
  11. package/dist/api/QasListItems.json +18 -17
  12. package/dist/api/QasListView.json +21 -7
  13. package/dist/api/QasNestedFields.json +13 -3
  14. package/dist/api/QasNumericInput.json +10 -10
  15. package/dist/api/QasPasswordInput.json +1 -1
  16. package/dist/api/QasSearchBox.json +85 -3
  17. package/dist/api/QasSelect.json +81 -14
  18. package/dist/api/QasSelectList.json +16 -14
  19. package/dist/api/QasSignaturePad.json +1 -1
  20. package/dist/api/QasSingleView.json +13 -4
  21. package/dist/api/QasTabsGenerator.json +5 -2
  22. package/dist/api/QasUploader.json +5 -0
  23. package/dist/asteroid.cjs.css +1 -1
  24. package/dist/asteroid.cjs.js +1522 -706
  25. package/dist/asteroid.cjs.min.js +2 -2
  26. package/dist/asteroid.esm.css +1 -1
  27. package/dist/asteroid.esm.js +1525 -709
  28. package/dist/asteroid.esm.min.js +2 -2
  29. package/dist/asteroid.umd.css +1 -1
  30. package/dist/asteroid.umd.js +1525 -710
  31. package/dist/asteroid.umd.min.js +2 -2
  32. package/dist/vetur/asteroid-attributes.json +176 -100
  33. package/dist/vetur/asteroid-tags.json +60 -41
  34. package/package.json +1 -1
  35. package/src/components/actions-menu/QasActionsMenu.vue +2 -8
  36. package/src/components/app-bar/QasAppBar.vue +16 -12
  37. package/src/components/app-bar/QasAppBar.yml +0 -4
  38. package/src/components/avatar/QasAvatar.vue +0 -4
  39. package/src/components/btn/QasBtn.vue +5 -8
  40. package/src/components/btn/QasBtn.yml +2 -1
  41. package/src/components/card/QasCard.vue +18 -9
  42. package/src/components/card/QasCard.yml +13 -9
  43. package/src/components/date-time-input/QasDateTimeInput.vue +39 -41
  44. package/src/components/date-time-input/QasDateTimeInput.yml +11 -12
  45. package/src/components/delete/QasDelete.vue +15 -1
  46. package/src/components/dialog/QasDialog.vue +26 -3
  47. package/src/components/dialog/QasDialog.yml +6 -3
  48. package/src/components/dialog-router/QasDialogRouter.vue +1 -1
  49. package/src/components/field/QasField.vue +15 -14
  50. package/src/components/filters/QasFilters.vue +27 -10
  51. package/src/components/filters/QasFilters.yml +4 -4
  52. package/src/components/form-generator/QasFormGenerator.vue +87 -12
  53. package/src/components/form-generator/QasFormGenerator.yml +16 -2
  54. package/src/components/form-view/QasFormView.vue +138 -56
  55. package/src/components/form-view/QasFormView.yml +39 -15
  56. package/src/components/grid-generator/QasGridGenerator.vue +23 -7
  57. package/src/components/grid-generator/QasGridGenerator.yml +5 -4
  58. package/src/components/input/QasInput.vue +37 -21
  59. package/src/components/input/QasInput.yml +1 -1
  60. package/src/components/layout/QasLayout.vue +4 -0
  61. package/src/components/list-items/QasListItems.vue +15 -23
  62. package/src/components/list-items/QasListItems.yml +14 -15
  63. package/src/components/list-view/QasListView.vue +45 -24
  64. package/src/components/list-view/QasListView.yml +19 -7
  65. package/src/components/map/QasMap.vue +5 -5
  66. package/src/components/nested-fields/QasNestedFields.vue +29 -21
  67. package/src/components/nested-fields/QasNestedFields.yml +9 -3
  68. package/src/components/numeric-input/QasNumericInput.vue +14 -14
  69. package/src/components/numeric-input/QasNumericInput.yml +10 -10
  70. package/src/components/page-header/QasPageHeader.vue +14 -11
  71. package/src/components/password-input/QasPasswordInput.vue +17 -16
  72. package/src/components/password-input/QasPasswordInput.yml +1 -1
  73. package/src/components/profile/QasProfile.vue +1 -1
  74. package/src/components/search-box/QasSearchBox.vue +138 -42
  75. package/src/components/search-box/QasSearchBox.yml +69 -2
  76. package/src/components/select/QasSelect.vue +63 -53
  77. package/src/components/select/QasSelect.yml +64 -13
  78. package/src/components/select-list/QasSelectList.vue +11 -27
  79. package/src/components/select-list/QasSelectList.yml +13 -14
  80. package/src/components/signature-pad/QasSignaturePad.yml +1 -1
  81. package/src/components/signature-uploader/QasSignatureUploader.vue +7 -5
  82. package/src/components/single-view/QasSingleView.vue +22 -6
  83. package/src/components/single-view/QasSingleView.yml +11 -4
  84. package/src/components/table-generator/QasTableGenerator.vue +13 -2
  85. package/src/components/tabs-generator/QasTabsGenerator.vue +2 -2
  86. package/src/components/tabs-generator/QasTabsGenerator.yml +2 -2
  87. package/src/components/text-truncate/QasTextTruncate.vue +1 -1
  88. package/src/components/uploader/QasUploader.vue +62 -15
  89. package/src/components/uploader/QasUploader.yml +5 -0
  90. package/src/helpers/camelize-fields-name.js +15 -0
  91. package/src/helpers/filters.js +2 -0
  92. package/src/helpers/get-normalized-options.js +20 -0
  93. package/src/helpers/handle-process.js +13 -0
  94. package/src/helpers/index.js +3 -0
  95. package/src/mixins/generator.js +10 -2
  96. package/src/mixins/index.js +2 -0
  97. package/src/mixins/search-filter.js +227 -0
  98. package/src/mixins/view.js +35 -13
  99. package/src/pages/Forbidden.vue +3 -1
  100. package/src/pages/NotFound.vue +3 -1
  101. package/src/pages/ServerError.vue +3 -1
  102. package/src/pages/Unauthorized.vue +28 -0
  103. package/src/plugins/index.js +4 -2
  104. package/src/plugins/logger/Logger.js +44 -0
  105. package/src/plugins/logger/Logger.yml +9 -0
  106. package/src/vue-plugin.js +6 -3
@@ -0,0 +1,15 @@
1
+ import { camelize } from 'humps'
2
+
3
+ export default function camelizeFieldsName (fields) {
4
+ for (const field in fields) {
5
+ const currentField = fields[field]
6
+
7
+ currentField.name = camelize(currentField.name)
8
+
9
+ if (Object.keys(currentField.children || {}).length) {
10
+ camelizeFieldsName(currentField.children)
11
+ }
12
+ }
13
+
14
+ return fields
15
+ }
@@ -114,6 +114,8 @@ function humanize (field = {}, value) {
114
114
  case 'time': return time(value)
115
115
  case 'radio': return selectLabel(field.options, value)
116
116
  case 'percent': return formatPercent(value)
117
+ case 'money': return money(value)
118
+ case 'decimal': return decimal(value)
117
119
  default: return value
118
120
  }
119
121
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * param {options: object[], label: string, value: string} object
3
+ *
4
+ * @example getNormalizedOptions({
5
+ * options: [{ name: 'Test 1', uuid: '1' }, { name: 'Test 2', uuid: '2' }],
6
+ * label: 'name'
7
+ * value: 'uuid'
8
+ * }) // retorna [{ label: 'Test 1', value: '1' }, { label: 'Test 2', value: '2' }]
9
+ */
10
+ export default ({ options = [], label, value }) => {
11
+ return options.map(option => {
12
+ const { [label]: labelKey, [value]: valueKey, ...payload } = option
13
+
14
+ return {
15
+ label: option[label],
16
+ value: option[value],
17
+ ...payload
18
+ }
19
+ })
20
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @param {function} processEnv função que retorna o process.env.
3
+ * @param {string} defaultValue valor default caso não exista a process.env
4
+ *
5
+ * @example handleProcess(() => process.env.MY_ENV, 'meu-valor-default')
6
+ */
7
+ export default (processEnv = () => {}, defaultValue) => {
8
+ try {
9
+ return processEnv() || defaultValue
10
+ } catch {
11
+ return defaultValue
12
+ }
13
+ }
@@ -8,6 +8,9 @@ export { default as filterObject } from './filter-object.js'
8
8
  export { default as getGreatestCommonDivisor } from './get-greatest-common-divisor.js'
9
9
  export { default as filterObjectToArray } from './filter-object-to-array.js'
10
10
  export { default as filterListByHandle } from './filter-list-by-handle.js'
11
+ export { default as camelizeFieldsName } from './camelize-fields-name.js'
12
+ export { default as getNormalizedOptions } from './get-normalized-options.js'
13
+ export { default as handleProcess } from './handle-process.js'
11
14
 
12
15
  export * from './filters.js'
13
16
  export * from './images.js'
@@ -15,7 +15,9 @@ export default {
15
15
  gutter: {
16
16
  default: 'md',
17
17
  type: [String, Boolean],
18
- validator: value => ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
18
+ validator: value => {
19
+ return typeof value === 'boolean' || ['xs', 'sm', 'md', 'lg', 'xl'].includes(value)
20
+ }
19
21
  }
20
22
  },
21
23
 
@@ -64,7 +66,13 @@ export default {
64
66
  },
65
67
 
66
68
  mx_handleColumnsByIndex (index, isGridGenerator) {
67
- const fields = isGridGenerator ? this.fields : this.groupedFields.visible
69
+ const fields = isGridGenerator ? this.fields : {}
70
+
71
+ if (!isGridGenerator) {
72
+ for (const key in this.normalizedFields) {
73
+ Object.assign(fields, this.normalizedFields[key].fields.visible)
74
+ }
75
+ }
68
76
 
69
77
  if (!Array.isArray(fields)) {
70
78
  index = Object.keys(fields).findIndex(field => field === index)
@@ -1,6 +1,7 @@
1
1
  import contextMixin from './context.js'
2
2
  import formMixin from './form.js'
3
3
  import generatorMixin from './generator.js'
4
+ import searchFilterMixin from './search-filter.js'
4
5
  import passwordMixin from './password.js'
5
6
  import viewMixin from './view.js'
6
7
 
@@ -8,6 +9,7 @@ export {
8
9
  contextMixin,
9
10
  formMixin,
10
11
  generatorMixin,
12
+ searchFilterMixin,
11
13
  passwordMixin,
12
14
  viewMixin
13
15
  }
@@ -0,0 +1,227 @@
1
+ import { decamelize } from 'humps'
2
+ import { isEqual } from 'lodash'
3
+ import { getNormalizedOptions } from '../helpers'
4
+
5
+ export default {
6
+ props: {
7
+ entity: {
8
+ default: '',
9
+ type: String
10
+ },
11
+
12
+ lazyLoadingProps: {
13
+ default: () => ({}),
14
+ type: Object
15
+ },
16
+
17
+ name: {
18
+ default: '',
19
+ type: String
20
+ },
21
+
22
+ useLazyLoading: {
23
+ type: Boolean
24
+ },
25
+
26
+ fetching: {
27
+ type: Boolean
28
+ }
29
+ },
30
+
31
+ emits: [
32
+ 'update:modelValue',
33
+ 'update:fetching',
34
+ 'fetch-options-success',
35
+ 'fetch-options-error'
36
+ ],
37
+
38
+ data () {
39
+ return {
40
+ mx_filteredOptions: [],
41
+ mx_hasFetchError: false,
42
+ mx_isFetching: false,
43
+ mx_isScrolling: false,
44
+ mx_search: '',
45
+ mx_fetchCount: 0,
46
+ mx_pagination: {
47
+ page: 1,
48
+ lastPage: null,
49
+ hasCount: true,
50
+ hasNextPage: false
51
+ }
52
+ }
53
+ },
54
+
55
+ computed: {
56
+ mx_defaultLazyLoadingProps () {
57
+ const {
58
+ url,
59
+ params,
60
+ decamelizeFieldName
61
+ } = this.lazyLoadingProps
62
+
63
+ const defaultParams = { limit: 48 }
64
+
65
+ return {
66
+ url: url || '',
67
+ params: {
68
+ ...defaultParams,
69
+ ...params
70
+ },
71
+ decamelizeFieldName: decamelizeFieldName === undefined ? true : decamelizeFieldName
72
+ }
73
+ },
74
+
75
+ mx_hasFilteredOptions () {
76
+ return !!this.mx_filteredOptions.length
77
+ },
78
+
79
+ mx_isFilterByFuse () {
80
+ return !this.useLazyLoading
81
+ }
82
+ },
83
+
84
+ watch: {
85
+ lazyLoadingProps: {
86
+ handler (value, oldValue) {
87
+ if (isEqual(value, oldValue)) return
88
+
89
+ this.mx_filterOptionsByStore('')
90
+ this.$emit('update:modelValue', '')
91
+ }
92
+ }
93
+ },
94
+
95
+ methods: {
96
+ async mx_filterOptionsByStore (search) {
97
+ this.mx_resetFilter(search)
98
+ await this.mx_setFetchOptions()
99
+ },
100
+
101
+ mx_resetFilter (search) {
102
+ this.mx_filteredOptions = []
103
+ this.mx_search = search
104
+ this.mx_pagination = {
105
+ page: 1,
106
+ lastPage: null,
107
+ hasCount: true,
108
+ hasNextPage: false
109
+ }
110
+ },
111
+
112
+ async mx_onVirtualScroll ({ index, ref }) {
113
+ const lastIndex = this.mx_filteredOptions.length - 1
114
+
115
+ if (index === lastIndex && this.mx_canFetchOptions()) {
116
+ await this.mx_loadMoreOptions()
117
+
118
+ this.$nextTick(() => {
119
+ ref.reset()
120
+ ref.refresh(lastIndex)
121
+ })
122
+ }
123
+ },
124
+
125
+ async mx_loadMoreOptions () {
126
+ this.mx_isScrolling = true
127
+
128
+ const options = await this.mx_fetchOptions()
129
+ this.mx_filteredOptions.push(...options)
130
+
131
+ // this is to prevent the virtual-scroll event to be fired again
132
+ this.$nextTick(() => {
133
+ this.mx_isScrolling = false
134
+ })
135
+ },
136
+
137
+ async mx_fetchOptions () {
138
+ this.mx_fetchCount++
139
+
140
+ try {
141
+ if (!this.entity) this.mx_setMissingPropsMessage('entity')
142
+ if (!this.name) this.mx_setMissingPropsMessage('name')
143
+
144
+ this.mx_hasFetchError = false
145
+ this.mx_isFetching = true
146
+
147
+ this.$emit('update:fetching', true)
148
+
149
+ const { url, params, decamelizeFieldName } = this.mx_defaultLazyLoadingProps
150
+
151
+ const { data } = await this.$store.dispatch(`${this.entity}/fetchFieldOptions`, {
152
+ url,
153
+ field: decamelizeFieldName ? decamelize(this.name, { separator: '-' }) : this.name,
154
+ params: {
155
+ ...params,
156
+ search: this.mx_search,
157
+ offset: (this.mx_pagination.page - 1) * params.limit
158
+ }
159
+ })
160
+
161
+ const { results, count, hasNextPage } = data
162
+ const hasCount = count !== undefined
163
+
164
+ this.mx_pagination = {
165
+ page: this.mx_pagination.page + 1,
166
+ lastPage: hasCount ? Math.ceil(count / params.limit) : null,
167
+ hasCount,
168
+ hasNextPage
169
+ }
170
+
171
+ this.$emit('fetch-options-success', data)
172
+
173
+ return this.mx_handleOptions(results)
174
+ } catch (error) {
175
+ this.$qas.logger.group(
176
+ `Mixin: searchFilterMixin - mx_fetchOptions -> exceção da action ${this.entity}/fetchFieldOptions`,
177
+ [error],
178
+ { error: true }
179
+ )
180
+
181
+ this.mx_hasFetchError = true
182
+ this.$emit('fetch-options-error', error)
183
+
184
+ return []
185
+ } finally {
186
+ this.mx_isFetching = false
187
+ this.$emit('update:fetching', false)
188
+ }
189
+ },
190
+
191
+ async mx_setFetchOptions () {
192
+ this.mx_filteredOptions = await this.mx_fetchOptions()
193
+ },
194
+
195
+ mx_canFetchOptions () {
196
+ const { lastPage, page, hasCount, hasNextPage } = this.mx_pagination
197
+
198
+ const hasMorePages = hasCount ? lastPage && page <= lastPage : hasNextPage
199
+
200
+ return hasMorePages && !this.mx_isFetching && !this.mx_isScrolling && this.useLazyLoading
201
+ },
202
+
203
+ mx_handleOptions (options) {
204
+ if (this.labelKey && this.valueKey) {
205
+ return getNormalizedOptions({
206
+ options,
207
+ label: this.labelKey,
208
+ value: this.valueKey
209
+ })
210
+ }
211
+
212
+ return options
213
+ },
214
+
215
+ mx_getMissingPropsMessage (prop) {
216
+ return `A propriedade "${prop}" é obrigatória quando a propriedade "useLazyLoading" está ativa.`
217
+ },
218
+
219
+ mx_setMissingPropsMessage (prop) {
220
+ throw new Error(this.mx_getMissingPropsMessage(prop))
221
+ },
222
+
223
+ mx_getNormalizedFuseResults (results = []) {
224
+ return results.map(({ item }) => item)
225
+ }
226
+ }
227
+ }
@@ -1,12 +1,8 @@
1
- import { camelize } from 'humps'
1
+ import { camelizeFieldsName } from '../helpers'
2
2
  import { markRaw } from 'vue'
3
3
 
4
4
  export default {
5
5
  props: {
6
- dialog: {
7
- type: Boolean
8
- },
9
-
10
6
  entity: {
11
7
  required: true,
12
8
  type: String
@@ -34,6 +30,16 @@ export default {
34
30
 
35
31
  fetching: {
36
32
  type: Boolean
33
+ },
34
+
35
+ useBoundary: {
36
+ default: true,
37
+ type: Boolean
38
+ },
39
+
40
+ beforeFetch: {
41
+ default: null,
42
+ type: Function
37
43
  }
38
44
  },
39
45
 
@@ -49,7 +55,7 @@ export default {
49
55
  mx_errors: {},
50
56
  mx_fields: {},
51
57
  mx_metadata: {},
52
-
58
+ mx_cancelBeforeFetch: false,
53
59
  mx_isFetching: false
54
60
  }
55
61
  },
@@ -62,11 +68,11 @@ export default {
62
68
 
63
69
  computed: {
64
70
  mx_componentTag () {
65
- return this.dialog ? 'div' : 'q-page'
71
+ return this.useBoundary ? 'q-page' : 'div'
66
72
  },
67
73
 
68
74
  mx_componentClass () {
69
- return !this.dialog && 'container spaced'
75
+ return this.useBoundary && 'container spaced'
70
76
  },
71
77
 
72
78
  mx_hasFooterSlot () {
@@ -86,7 +92,9 @@ export default {
86
92
  this.$qas.error('Ops! Erro ao obter os dados.', exception)
87
93
 
88
94
  const status = response?.status
89
- const redirect = ({ 403: 'Forbidden', 404: 'NotFound' })[status]
95
+ const redirect = status >= 500
96
+ ? 'ServerError'
97
+ : ({ 401: 'Unauthorized', 403: 'Forbidden', 404: 'NotFound' })[status]
90
98
 
91
99
  if (redirect) {
92
100
  this.$router.replace({ name: redirect })
@@ -98,11 +106,9 @@ export default {
98
106
  },
99
107
 
100
108
  mx_setFields (fields = {}) {
101
- for (const field in fields) {
102
- fields[field].name = camelize(fields[field].name)
103
- }
109
+ const camelizedFields = camelizeFieldsName(fields)
104
110
 
105
- this.mx_fields = markRaw(fields)
111
+ this.mx_fields = markRaw(camelizedFields)
106
112
  },
107
113
 
108
114
  mx_setMetadata (metadata = {}) {
@@ -115,6 +121,22 @@ export default {
115
121
 
116
122
  this.$emit(`update:${key}`, models[key])
117
123
  }
124
+ },
125
+
126
+ mx_fetchHandler (payload, resolve) {
127
+ const hasBeforeFetch = typeof this.beforeFetch === 'function'
128
+
129
+ if (hasBeforeFetch && !this.mx_cancelBeforeFetch) {
130
+ return this.beforeFetch({
131
+ payload,
132
+ resolve: payload => resolve(payload),
133
+ done: () => {
134
+ this.mx_cancelBeforeFetch = true
135
+ }
136
+ })
137
+ }
138
+
139
+ resolve()
118
140
  }
119
141
  }
120
142
  }
@@ -3,9 +3,11 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import ErrorComponent from './ErrorComponent'
6
+ import ErrorComponent from './ErrorComponent.vue'
7
7
 
8
8
  export default {
9
+ name: 'Forbidden',
10
+
9
11
  components: {
10
12
  ErrorComponent
11
13
  },
@@ -3,9 +3,11 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import ErrorComponent from './ErrorComponent'
6
+ import ErrorComponent from './ErrorComponent.vue'
7
7
 
8
8
  export default {
9
+ name: 'NotFound',
10
+
9
11
  components: {
10
12
  ErrorComponent
11
13
  },
@@ -3,9 +3,11 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import ErrorComponent from './ErrorComponent'
6
+ import ErrorComponent from './ErrorComponent.vue'
7
7
 
8
8
  export default {
9
+ name: 'ServerError',
10
+
9
11
  components: {
10
12
  ErrorComponent
11
13
  },
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <error-component v-bind="errorProps" />
3
+ </template>
4
+
5
+ <script>
6
+ import ErrorComponent from './ErrorComponent.vue'
7
+
8
+ export default {
9
+ name: 'Unauthorized',
10
+
11
+ components: {
12
+ ErrorComponent
13
+ },
14
+
15
+ computed: {
16
+ errorProps () {
17
+ return {
18
+ code: '401',
19
+ title: 'Ops! Parece que você está sem acesso ao sistema!',
20
+ buttonProps: {
21
+ to: { path: '/auth/login' },
22
+ label: 'Fazer login'
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ </script>
@@ -1,11 +1,13 @@
1
1
  import Dialog from './dialog/Dialog.js'
2
+ import Logger from './logger/Logger.js'
2
3
  import NotifyError from './notify-error/NotifyError.js'
3
4
  import NotifySuccess from './notify-success/NotifySuccess.js'
4
5
  import Screen from './screen/Screen.js'
5
6
 
6
7
  export {
7
8
  Dialog,
9
+ Logger,
8
10
  NotifyError,
9
- Screen,
10
- NotifySuccess
11
+ NotifySuccess,
12
+ Screen
11
13
  }
@@ -0,0 +1,44 @@
1
+ export default () => {
2
+ const isDebugEnabled = process.env.DEBUGGING
3
+
4
+ const normalizeMessage = msg => `%c ${msg}`
5
+ const getStyle = isError => (
6
+ `
7
+ background: ${isError ? '#C10015 ' : '#1976d2'};
8
+ font-weight: bold;
9
+ color: white;
10
+ padding: 6px 20px;
11
+ border-radius: 4px;
12
+ display: block;
13
+ width: 100%;
14
+ font-size: 12px;
15
+ `
16
+ )
17
+
18
+ return {
19
+ group (message, payload = [], { error } = {}) {
20
+ if (!isDebugEnabled) return
21
+
22
+ console.groupCollapsed(normalizeMessage(message), getStyle(error))
23
+
24
+ for (const item of payload) {
25
+ if (typeof item === 'string') {
26
+ console.info(normalizeMessage(item), getStyle(error))
27
+ continue
28
+ }
29
+
30
+ console.table(item)
31
+ }
32
+
33
+ console.groupEnd()
34
+ },
35
+
36
+ info (message) {
37
+ isDebugEnabled && console.info(normalizeMessage(message), getStyle())
38
+ },
39
+
40
+ error (message) {
41
+ isDebugEnabled && console.info(normalizeMessage(message), getStyle(true))
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,9 @@
1
+ type: component
2
+
3
+ meta:
4
+ desc: Plugin para adicionar loggers.
5
+
6
+ inject:
7
+ 'this.$qas.logger':
8
+ default: {}
9
+ type: Object
package/src/vue-plugin.js CHANGED
@@ -55,7 +55,8 @@ import {
55
55
  Dialog,
56
56
  NotifyError,
57
57
  NotifySuccess,
58
- Screen
58
+ Screen,
59
+ Logger
59
60
  } from './plugins'
60
61
 
61
62
  import packageInfo from '../package.json'
@@ -124,8 +125,9 @@ function install (app) {
124
125
  app.config.globalProperties.$qas = {
125
126
  dialog: Dialog,
126
127
  error: NotifyError,
127
- success: NotifySuccess,
128
- screen: Screen()
128
+ logger: Logger(),
129
+ screen: Screen(),
130
+ success: NotifySuccess
129
131
  }
130
132
 
131
133
  app.directive(Test.name, Test)
@@ -186,6 +188,7 @@ export {
186
188
 
187
189
  // plugins
188
190
  Dialog,
191
+ Logger,
189
192
  NotifyError,
190
193
  NotifySuccess,
191
194
  Screen,