@bildvitta/quasar-ui-asteroid 3.13.0-beta.7 → 3.13.0-beta.8

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.13.0-beta.7",
4
+ "version": "3.13.0-beta.8",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -47,6 +47,7 @@
47
47
  "autonumeric": "^4.9.0",
48
48
  "axios": "^1.4.0",
49
49
  "date-fns": "^2.30.0",
50
+ "debug": "^4.3.4",
50
51
  "fuse.js": "^6.6.2",
51
52
  "humps": "^2.0.1",
52
53
  "lodash-es": "^4.17.21",
@@ -39,12 +39,15 @@
39
39
 
40
40
  <script>
41
41
  import PvFiltersButton from './private/PvFiltersButton.vue'
42
+ import debug from 'debug'
42
43
 
43
44
  import { camelize, camelizeKeys, decamelize } from 'humps'
44
45
  import { humanize, parseValue } from '../../helpers/filters.js'
45
46
  import contextMixin from '../../mixins/context.js'
46
47
  import { getState, getAction } from '@bildvitta/store-adapter'
47
48
 
49
+ const log = debug('asteroid-ui:qas-filters')
50
+
48
51
  export default {
49
52
  name: 'QasFilters',
50
53
 
@@ -281,11 +284,6 @@ export default {
281
284
  this.isFetching = true
282
285
 
283
286
  try {
284
- this.$qas.logger.group(
285
- `QasFilters - fetchFilters -> Payload do parâmetro do ${this.entity}/fetchFilters`,
286
- [{ url: this.url }]
287
- )
288
-
289
287
  const response = await getAction.call(this, {
290
288
  entity: this.entity,
291
289
  key: 'fetchFilters',
@@ -294,18 +292,12 @@ export default {
294
292
 
295
293
  this.$emit('fetch-success', response)
296
294
 
297
- this.$qas.logger.group(
298
- `QasFilters - fetchFilters -> resposta da action ${this.entity}/fetchFilters`, [response]
299
- )
295
+ log(`[${this.entity}]:fetchFilters:success`, response)
300
296
  } catch (error) {
301
297
  this.hasFetchError = true
302
298
  this.$emit('fetch-error', error)
303
299
 
304
- this.$qas.logger.group(
305
- `QasFilters - fetchFilters -> exceção da action ${this.entity}/fetchFilters`,
306
- [error],
307
- { error: true }
308
- )
300
+ log(`[${this.entity}]:fetchFilters:error`, error)
309
301
  } finally {
310
302
  this.isFetching = false
311
303
  }
@@ -33,19 +33,21 @@
33
33
  </template>
34
34
 
35
35
  <script>
36
- import { isEqualWith } from 'lodash-es'
37
- import { getAction } from '@bildvitta/store-adapter'
38
- import { extend } from 'quasar'
39
- import { onBeforeRouteLeave } from 'vue-router'
40
-
41
- import { useHistory } from '../../composables'
42
- import { NotifyError, NotifySuccess } from '../../plugins'
43
-
44
36
  import QasBtn from '../btn/QasBtn.vue'
45
37
  import QasDialog from '../dialog/QasDialog.vue'
46
38
 
39
+ import { NotifyError, NotifySuccess } from '../../plugins'
40
+ import { useHistory } from '../../composables'
47
41
  import { viewMixin } from '../../mixins'
48
42
 
43
+ import debug from 'debug'
44
+ import { extend } from 'quasar'
45
+ import { getAction } from '@bildvitta/store-adapter'
46
+ import { isEqualWith } from 'lodash-es'
47
+ import { onBeforeRouteLeave } from 'vue-router'
48
+
49
+ const log = debug('asteroid-ui:qas-form-view')
50
+
49
51
  export default {
50
52
  name: 'QasFormView',
51
53
 
@@ -260,11 +262,6 @@ export default {
260
262
  return next()
261
263
  }
262
264
 
263
- this.$qas.logger.group(
264
- 'QasFormView - beforeRouteLeave -> dialog chamado, modelValue diferente do cachedResult',
265
- [{ modelValue: clonedModelValue, cachedResult: clonedCachedResult }]
266
- )
267
-
268
265
  this.handleDialog(() => {
269
266
  this.ignoreRouterGuard = true
270
267
  next()
@@ -286,10 +283,6 @@ export default {
286
283
  ...externalPayload
287
284
  }
288
285
 
289
- this.$qas.logger.group(
290
- `QasFormView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`, [payload]
291
- )
292
-
293
286
  const response = await getAction.call(this, {
294
287
  entity: this.entity,
295
288
  key: 'fetchSingle',
@@ -312,28 +305,19 @@ export default {
312
305
 
313
306
  result && Object.assign(modelValue, result)
314
307
 
315
- this.$qas.logger.group(
316
- `QasFormView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
317
- )
318
-
319
308
  if (this.useDialogOnUnsavedChanges) {
320
309
  this.cachedResult = extend(true, {}, result || modelValue)
321
- this.$qas.logger.group('QasFormView - fetchSingle -> cachedResult', [this.cachedResult])
322
310
  }
323
311
 
324
312
  this.$emit('update:modelValue', modelValue)
325
313
  this.$emit('fetch-success', response, this.modelValue)
326
314
 
327
- this.$qas.logger.group('QasFormView - fetchSingle -> modelValue', [modelValue])
315
+ log(`[${this.entity}]:fetchSingle:success`, { response, modelValue })
328
316
  } catch (error) {
329
317
  this.mx_fetchError(error)
330
318
  this.$emit('fetch-error', error)
331
319
 
332
- this.$qas.logger.group(
333
- `QasFormView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
334
- [error],
335
- { error: true }
336
- )
320
+ log(`[${this.entity}]:fetchSingle:error`, error)
337
321
  } finally {
338
322
  this.mx_isFetching = false
339
323
  }
@@ -424,10 +408,6 @@ export default {
424
408
  ...externalPayload
425
409
  }
426
410
 
427
- this.$qas.logger.group(
428
- `QasFormView - submit -> payload do ${this.entity}/${this.mode}`, [payload]
429
- )
430
-
431
411
  const response = await getAction.call(this, {
432
412
  entity: this.entity,
433
413
  key: this.mode,
@@ -448,13 +428,11 @@ export default {
448
428
 
449
429
  this.createSubmitSuccessEvent({ ...payload, entity: this.entity })
450
430
 
451
- this.$qas.logger.group(
452
- `QasFormView - submit -> resposta da action ${this.entity}/${this.mode}`, [response]
453
- )
454
-
455
431
  if (this.useNotifySuccess) {
456
432
  NotifySuccess(response.data.status.text || this.defaultNotifyMessages.success)
457
433
  }
434
+
435
+ log(`[${this.entity}]:submit:success`, { response, modelValue })
458
436
  } catch (error) {
459
437
  const errors = error?.response?.data?.errors
460
438
  const message = error?.response?.data?.status?.text
@@ -471,11 +449,7 @@ export default {
471
449
 
472
450
  this.$emit('submit-error', error)
473
451
 
474
- this.$qas.logger.group(
475
- `QasFormView - submit -> exceção da action ${this.entity}/${this.mode}`,
476
- [error],
477
- { error: true }
478
- )
452
+ log(`[${this.entity}]:submit:error`, error)
479
453
  } finally {
480
454
  this.isSubmitting = false
481
455
  }
@@ -39,11 +39,14 @@
39
39
  </template>
40
40
 
41
41
  <script>
42
- import { viewMixin, contextMixin } from '../../mixins'
43
42
  import QasFilters from '../filters/QasFilters.vue'
44
43
  import QasPagination from '../pagination/QasPagination.vue'
44
+ import debug from 'debug'
45
45
  import { extend } from 'quasar'
46
46
  import { getState, getAction } from '@bildvitta/store-adapter'
47
+ import { viewMixin, contextMixin } from '../../mixins'
48
+
49
+ const log = debug('asteroid-ui:qas-list-view')
47
50
 
48
51
  export default {
49
52
  components: {
@@ -191,10 +194,6 @@ export default {
191
194
  ...externalPayload
192
195
  }
193
196
 
194
- this.$qas.logger.group(
195
- `QasListView - fetchList -> Payload do parâmetro do ${this.entity}/fetchList`, [payload]
196
- )
197
-
198
197
  const response = await getAction.call(this, {
199
198
  entity: this.entity,
200
199
  key: 'fetchList',
@@ -216,19 +215,13 @@ export default {
216
215
 
217
216
  this.$emit('fetch-success', response)
218
217
 
219
- this.$qas.logger.group(
220
- `QasListView - fetchList -> resposta da action ${this.entity}/fetchList`, [response]
221
- )
218
+ log(`[${this.entity}]:fetchList:success`, response)
222
219
  } catch (error) {
223
220
  this.mx_fetchError(error)
224
221
  this.$emit('update:errors', error)
225
222
  this.$emit('fetch-error', error)
226
223
 
227
- this.$qas.logger.group(
228
- `QasListView - fetchSingle -> exceção da action ${this.entity}/fetchList`,
229
- [error],
230
- { error: true }
231
- )
224
+ log(`[${this.entity}]:fetchList:error`, error)
232
225
  } finally {
233
226
  this.mx_isFetching = false
234
227
  }
@@ -65,10 +65,14 @@ import QasBtn from '../btn/QasBtn.vue'
65
65
  import QasFormGenerator from '../form-generator/QasFormGenerator.vue'
66
66
  import QasInput from '../input/QasInput.vue'
67
67
  import QasLabel from '../label/QasLabel.vue'
68
+
69
+ import { constructObject } from '../../helpers'
70
+
68
71
  import { TransitionGroup } from 'vue'
72
+ import debug from 'debug'
69
73
  import { extend } from 'quasar'
70
74
 
71
- import { constructObject } from '../../helpers'
75
+ const log = debug('asteroid-ui:qas-nested-fields')
72
76
 
73
77
  export default {
74
78
  name: 'QasNestedFields',
@@ -392,7 +396,7 @@ export default {
392
396
  this.setFocus()
393
397
  })
394
398
 
395
- this.$qas.logger.group('QasNestedFields - add', [payload])
399
+ log('add', payload)
396
400
 
397
401
  this.updateModelValue()
398
402
  },
@@ -410,7 +414,7 @@ export default {
410
414
  ? this.nested.splice(index, 1)
411
415
  : this.nested.splice(index, 1, { [this.destroyKey]: true, ...row })
412
416
 
413
- this.$qas.logger.group('QasNestedFields - destroy', [{ index, row }])
417
+ log('destroy', { index, row })
414
418
 
415
419
  this.updateModelValue()
416
420
  },
@@ -22,8 +22,12 @@
22
22
 
23
23
  <script>
24
24
  import viewMixin from '../../mixins/view'
25
+
25
26
  import { markRaw } from 'vue'
26
27
  import { getGetter, getAction } from '@bildvitta/store-adapter'
28
+ import debug from 'debug'
29
+
30
+ const log = debug('asteroid-ui:qas-single-view')
27
31
 
28
32
  export default {
29
33
  name: 'QasSingleView',
@@ -85,11 +89,6 @@ export default {
85
89
  try {
86
90
  const payload = { id: this.id, url: this.url, ...externalPayload }
87
91
 
88
- this.$qas.logger.group(
89
- `QasSingleView - fetchSingle -> payload do parâmetro do ${this.entity}/fetchSingle`,
90
- [payload]
91
- )
92
-
93
92
  const response = await getAction.call(this, {
94
93
  entity: this.entity,
95
94
  key: 'fetchSingle',
@@ -108,20 +107,14 @@ export default {
108
107
  metadata: this.mx_metadata
109
108
  })
110
109
 
111
- this.$qas.logger.group(
112
- `QasSingleView - fetchSingle -> resposta da action ${this.entity}/fetchSingle`, [response]
113
- )
114
-
115
110
  this.$emit('fetch-success', response)
111
+
112
+ log(`[${this.entity}]:fetchSingle:success`, response)
116
113
  } catch (error) {
117
114
  this.mx_fetchError(error)
118
115
  this.$emit('fetch-error', error)
119
116
 
120
- this.$qas.logger.group(
121
- `QasSingleView - fetchSingle -> exceção da action ${this.entity}/fetchSingle`,
122
- [error],
123
- { error: true }
124
- )
117
+ log(`[${this.entity}]:fetchSingle:error`, error)
125
118
  } finally {
126
119
  this.mx_isFetching = false
127
120
  }
@@ -159,8 +159,6 @@ export default {
159
159
  columnByField(this.fields[index])
160
160
  }
161
161
 
162
- this.$qas.logger.group('QasTableGenerator - Automatic columns', [columns])
163
-
164
162
  return columns
165
163
  }
166
164
 
@@ -173,8 +171,6 @@ export default {
173
171
  }
174
172
  })
175
173
 
176
- this.$qas.logger.group('QasTableGenerator - columns', [columns])
177
-
178
174
  return columns
179
175
  },
180
176
 
@@ -199,8 +195,6 @@ export default {
199
195
  return result
200
196
  })
201
197
 
202
- this.$qas.logger.group('QasTableGenerator - resultsByFields', [mappedResults])
203
-
204
198
  return mappedResults
205
199
  },
206
200
 
@@ -1,6 +1,5 @@
1
1
  import Delete from './delete/Delete.js'
2
2
  import Dialog from './dialog/Dialog.js'
3
- import Logger from './logger/Logger.js'
4
3
  import NotifyError from './notify-error/NotifyError.js'
5
4
  import NotifySuccess from './notify-success/NotifySuccess.js'
6
5
  import Screen from './screen/Screen.js'
@@ -8,7 +7,6 @@ import Screen from './screen/Screen.js'
8
7
  export {
9
8
  Delete,
10
9
  Dialog,
11
- Logger,
12
10
  NotifyError,
13
11
  NotifySuccess,
14
12
  Screen
package/src/vue-plugin.js CHANGED
@@ -70,8 +70,7 @@ import {
70
70
  Dialog,
71
71
  NotifyError,
72
72
  NotifySuccess,
73
- Screen,
74
- Logger
73
+ Screen
75
74
  } from './plugins'
76
75
 
77
76
  import packageInfo from '../package.json'
@@ -152,7 +151,6 @@ async function install (app) {
152
151
  delete: params => Delete.call(app.config.globalProperties, params),
153
152
  dialog: Dialog,
154
153
  error: NotifyError,
155
- logger: Logger(),
156
154
  screen: Screen(),
157
155
  success: NotifySuccess
158
156
  }
@@ -230,7 +228,6 @@ export {
230
228
 
231
229
  // plugins
232
230
  Dialog,
233
- Logger,
234
231
  NotifyError,
235
232
  NotifySuccess,
236
233
  Screen,
@@ -1,44 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
1
- type: component
2
-
3
- meta:
4
- desc: Plugin para adicionar loggers.
5
-
6
- inject:
7
- 'this.$qas.logger':
8
- default: {}
9
- type: Object