@bildvitta/quasar-ui-asteroid 2.18.0 → 2.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
- "version": "2.18.0",
3
+ "version": "2.21.0",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -73,9 +73,5 @@
73
73
  },
74
74
  "peerDependencies": {
75
75
  "vue": "^2.6.14"
76
- },
77
- "engines": {
78
- "node": ">= 12 < 15",
79
- "npm": ">= 6 < 7"
80
76
  }
81
77
  }
@@ -0,0 +1,25 @@
1
+ <?xml version='1.0' encoding='utf-8'?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100">
3
+ <g>
4
+ <path id="small" fill="#424242" d="m86.6 10.3v-0.1c-1.5-2-3.3-3.7-5.4-5.3v0.1c-1.7 1.3-3.4 2.7-5 4.1-0.7-0.4-1.3-0.7-1.9-1-0.8-0.4-1.6-0.8-2.5-1-0.3-0.1-0.6-0.2-0.9-0.2-0.2-2.2-0.4-4.4-0.7-6.6-1-0.2-2-0.2-3.1-0.3h-1.6c-1 0.1-1.9 0.1-2.8 0.3-0.3 2.1-0.5 4.3-0.6 6.5-0.4 0-0.7 0.1-1.1 0.2-0.1 0-0.2 0-0.3 0.1-0.8 0.2-1.6 0.6-2.4 1-0.7 0.3-1.3 0.6-1.9 1-1.7-1.4-3.3-2.7-5-4.1l-0.1-0.1c-0.4 0.3-0.8 0.6-1.1 0.9-0.7 0.5-1.3 1.1-1.8 1.7-0.9 0.8-1.6 1.8-2.4 2.8h0.1c1.3 1.7 2.7 3.3 4.1 5-0.4 0.6-0.8 1.3-1.1 1.9-0.4 0.8-0.7 1.7-0.9 2.5-0.2 0.4-0.3 0.8-0.3 1.1-2.2 0.2-4.4 0.4-6.5 0.7-0.2 1-0.3 2-0.3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-6.5z"></path>
5
+ <path fill="#424242" d="m66.5 17.2c-2.2 0-4 0.8-5.6 2.3-1.5 1.6-2.3 3.4-2.3 5.6s0.8 4 2.3 5.6c1.6 1.6 3.4 2.4 5.6 2.4s4-0.8 5.6-2.4 2.3-3.4 2.3-5.6-0.7-4-2.3-5.6c-1.6-1.5-3.4-2.3-5.6-2.3zm-4.2 3.7c1.2-1.1 2.6-1.7 4.2-1.7s3 0.6 4.2 1.7c1.2 1.2 1.7 2.5 1.7 4.2s-0.5 3.1-1.7 4.2c-1.2 1.2-2.6 1.8-4.2 1.8s-3-0.6-4.2-1.8c-1.1-1.1-1.7-2.5-1.7-4.2 0-1.6 0.6-3 1.7-4.2z"/>
6
+ <animateTransform attributeName="transform"
7
+ attributeType="XML"
8
+ type="rotate"
9
+ from="360 66 25.1"
10
+ to="0 66 25.1"
11
+ dur="6s"
12
+ repeatCount="indefinite"/>
13
+ </g>
14
+ <g>
15
+ <path id="big" fill="#424242" d="m40.8 33.6c-0.4-0.2-0.7-0.3-1-0.3-1.2-0.3-2.4-0.5-3.6-0.7-1.1 2.7-2 5.3-2.9 7.9h-1.8c-1.2 0.1-2.3 0.2-3.4 0.4-0.9 0.1-1.8 0.4-2.7 0.7-1.6-2.3-3.3-4.6-4.9-6.8l-0.1-0.1c-0.6 0.2-1.2 0.4-1.7 0.7-1 0.4-1.9 0.9-2.8 1.5-1.4 0.7-2.7 1.6-3.9 2.7v0.1c1.2 2.5 2.3 5 3.5 7.5-0.7 0.7-1.3 1.3-1.9 2.1-0.8 0.8-1.5 1.8-2.1 2.8-0.3 0.4-0.5 0.8-0.7 1.3-2.8-0.5-5.6-1-8.4-1.4-0.5 1.2-1 2.4-1.4 3.7-0.4 2-0.8 3.9-1 5.8l7.8 3v1.4c0 1.1 0.1 2.3 0.4 3.5 0.1 1 0.4 2 0.7 3-2.3 1.6-4.5 3.2-6.8 4.9 1.2 3 2.9 5.8 4.9 8.4h0.1c2.5-1.2 5-2.3 7.6-3.5 0.6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7-2.7-7.3-5.5z"></path>
16
+ <path fill="#424242" d="m22.8 62.4c-0.8 2.7-0.5 5.3 0.9 7.7h0.1c1.4 2.5 3.5 4 6.2 4.8 2.7 0.7 5.3 0.4 7.8-1 2.5-1.5 4-3.5 4.8-6.2v-0.1c0.7-2.7 0.3-5.3-1.1-7.7-1.4-2.5-3.5-4.1-6.2-4.8-2.7-0.8-5.4-0.4-7.8 1-2.5 1.4-4 3.5-4.7 6.3zm6-4c1.9-1.1 3.8-1.4 5.8-0.8 2 0.5 3.6 1.7 4.7 3.6 1.1 1.8 1.3 3.8 0.8 5.8-0.6 2-1.8 3.6-3.6 4.6v0.1c-1.9 1-3.8 1.3-5.8 0.7-2.1-0.5-3.6-1.7-4.7-3.6-1-1.8-1.3-3.7-0.8-5.8 0.6-2 1.8-3.5 3.6-4.6z" />
17
+ <animateTransform attributeName="transform"
18
+ attributeType="XML"
19
+ type="rotate"
20
+ from="0 32.5 65"
21
+ to="360 32.5 65"
22
+ dur="6s"
23
+ repeatCount="indefinite"/>
24
+ </g>
25
+ </svg>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <q-input ref="mask" v-model="model" v-bind="$attrs" bottom-slots :mask="mask" unmasked-value v-on="listeners">
3
+ <q-input ref="mask" v-model="model" v-bind="$attrs" bottom-slots :mask="mask" unmasked-value v-on="listeners" @paste="onPaste">
4
4
  <slot v-for="(slot, key) in $slots" :slot="key" :name="key" />
5
5
  <template v-for="(slot, key) in $scopedSlots" :slot="key" slot-scope="scope">
6
6
  <slot :name="key" v-bind="scope" />
@@ -65,7 +65,7 @@ export default {
65
65
 
66
66
  watch: {
67
67
  mask () {
68
- const input = this.$refs.mask.$refs.input
68
+ const input = this.getInput()
69
69
 
70
70
  requestAnimationFrame(() => {
71
71
  input.selectionStart = input.value ? input.value.length : ''
@@ -75,6 +75,8 @@ export default {
75
75
 
76
76
  methods: {
77
77
  toggleMask (first, second) {
78
+ if (!this.value.length) return
79
+
78
80
  const length = first.split('#').length - 2
79
81
  return this.value?.length > length ? second : first
80
82
  },
@@ -89,6 +91,22 @@ export default {
89
91
 
90
92
  resetValidation () {
91
93
  return this.inputReference.resetValidation()
94
+ },
95
+
96
+ onPaste (event) {
97
+ if (!this.mask) return
98
+
99
+ const value = event.clipboardData.getData('text')
100
+ const input = this.getInput()
101
+
102
+ requestAnimationFrame(() => {
103
+ this.$emit('input', value)
104
+ input.selectionStart = input.value ? input.value.length : ''
105
+ })
106
+ },
107
+
108
+ getInput () {
109
+ return this.inputReference.$el?.querySelector('input')
92
110
  }
93
111
  }
94
112
  }
@@ -68,7 +68,6 @@ import QasLabel from '../label/QasLabel'
68
68
  import { constructObject } from '../../helpers'
69
69
 
70
70
  import { extend } from 'quasar'
71
- import { camelize } from 'humps'
72
71
 
73
72
  export default {
74
73
  name: 'QasNestedFields',
@@ -213,13 +212,7 @@ export default {
213
212
  },
214
213
 
215
214
  children () {
216
- const field = extend(true, {}, this.field)
217
-
218
- for (const key in field?.children) {
219
- field.children[key].name = camelize(field?.children[key].name)
220
- }
221
-
222
- return field?.children
215
+ return this.field?.children
223
216
  },
224
217
 
225
218
  showDestroyBtn () {
@@ -44,13 +44,23 @@ export default {
44
44
 
45
45
  // Events
46
46
  input: {
47
- description: 'Emitted when the component needs to change the model. Is also used by `v-model`.',
47
+ description: 'Emitted when the component needs to change the value.',
48
48
  table: {
49
49
  defaultValue: {
50
50
  detail: JSON.stringify({ value: 'number' }),
51
51
  summary: '{}'
52
52
  }
53
53
  }
54
+ },
55
+
56
+ 'update-model': {
57
+ description: 'Emitted when the user inputs a new value in the component.',
58
+ table: {
59
+ defaultValue: {
60
+ detail: JSON.stringify({ value: 'object' }),
61
+ summary: '{}'
62
+ }
63
+ }
54
64
  }
55
65
  }
56
66
  }
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div>
3
- <q-field v-model="model" v-bind="$attrs">
4
- <template #control="{ emitValue, floatingLabel, id, value: modelValue }">
5
- <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" :model-value="modelValue" @input="emitValue($event.target.value)">
3
+ <q-field :value="value" v-bind="$attrs">
4
+ <template #control="{ floatingLabel, id }">
5
+ <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
6
6
  </template>
7
7
  </q-field>
8
8
  </div>
@@ -66,15 +66,13 @@ export default {
66
66
  computed: {
67
67
  defaultMode () {
68
68
  return defaultModes[this.mode]
69
- },
70
-
71
- model: {
72
- get () {
73
- return this.value
74
- },
69
+ }
70
+ },
75
71
 
76
- set () {
77
- this.$emit('input', this.autoNumeric.getNumber())
72
+ watch: {
73
+ value (value) {
74
+ if (this.autoNumeric) {
75
+ this.autoNumeric.set(value)
78
76
  }
79
77
  }
80
78
  },
@@ -110,13 +108,30 @@ export default {
110
108
  Object.assign(options, this.autonumericProps)
111
109
 
112
110
  this.$nextTick(() => {
113
- this.$refs.input.value = this.value
114
111
  this.autoNumeric = new AutoNumeric(this.$refs.input, options)
112
+ this.autoNumeric.set(this.value)
115
113
  })
116
114
  },
117
115
 
118
116
  beforeDestroy () {
119
117
  this.autoNumeric.remove()
118
+ },
119
+
120
+ methods: {
121
+ setSelect () {
122
+ this.$refs?.input?.select()
123
+ },
124
+
125
+ emitValue () {
126
+ this.$emit('input', this.autoNumeric.getNumber())
127
+ },
128
+
129
+ emitUpdateModel (value) {
130
+ this.$emit('update-model', {
131
+ value,
132
+ raw: this.autoNumeric.getNumber()
133
+ })
134
+ }
120
135
  }
121
136
  }
122
137
  </script>
@@ -22,7 +22,7 @@
22
22
 
23
23
  <template #description>
24
24
  <div :style="signaturePadWidth">
25
- <qas-signature-pad ref="signaturePadModal" :is-empty.sync="isEmpty" :height="signaturePadHeight" />
25
+ <qas-signature-pad ref="signaturePadModal" :height="signaturePadHeight" :is-empty.sync="isEmpty" />
26
26
  </div>
27
27
  </template>
28
28
 
@@ -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
+ }
@@ -1,4 +1,5 @@
1
1
  import base64ToBlob from './base64ToBlob.js'
2
+ import camelizeFieldsName from './camelize-fields-name.js'
2
3
  import constructObject from './constructObject.js'
3
4
  import filterObject from './filter-object.js'
4
5
  import greatestCommonDivisor from './greatestCommonDivisor.js'
@@ -31,6 +32,7 @@ export {
31
32
  // filters
32
33
  asset,
33
34
  booleanLabel,
35
+ camelizeFieldsName,
34
36
  constructObject,
35
37
  date,
36
38
  dateTime,
@@ -1,5 +1,6 @@
1
1
  import { camelize } from 'humps'
2
2
  import { get } from 'lodash'
3
+ import { camelizeFieldsName } from '../helpers'
3
4
 
4
5
  import { NotifyError } from '../plugins'
5
6
 
@@ -52,7 +53,7 @@ export default {
52
53
  NotifyError('Ops! Erro ao obter os dados.', exception)
53
54
 
54
55
  const status = get(response, 'status')
55
- const redirect = ({ 403: 'Forbidden', 404: 'NotFound' })[status]
56
+ const redirect = status >= 500 ? 'ServerError' : ({ 403: 'Forbidden', 404: 'NotFound' })[status]
56
57
 
57
58
  if (redirect) {
58
59
  this.$router.replace({ name: redirect })
@@ -64,11 +65,7 @@ export default {
64
65
  },
65
66
 
66
67
  setFields (fields = {}) {
67
- for (const field in fields) {
68
- fields[field].name = camelize(fields[field].name)
69
- }
70
-
71
- this.fields = fields
68
+ this.fields = camelizeFieldsName(fields)
72
69
  },
73
70
 
74
71
  setMetadata (metadata = {}) {
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="column error-component items-center justify-around q-px-xl">
3
+ <div class="column full-width items-center justify-center q-gutter-md q-py-md row">
4
+ <q-img src="../assets/gear.svg" :width="gearSize" />
5
+ <div class="text-bold text-h1 text-primary">{{ code }}</div>
6
+ <div class="text-bold text-center text-grey-9 text-h6">{{ title }}</div>
7
+ <div v-if="subtitle" class="text-bold text-center text-grey-9 text-subtitle2">{{ subtitle }}</div>
8
+ <qas-btn v-if="hasButtonProps" class="text-bold text-primary" v-bind="buttonProps" />
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import screenMixin from '../mixins/screen'
15
+
16
+ export default {
17
+ name: 'ErrorComponent',
18
+
19
+ mixins: [screenMixin],
20
+
21
+ props: {
22
+ buttonProps: {
23
+ type: Object,
24
+ default: () => ({})
25
+ },
26
+
27
+ code: {
28
+ type: String,
29
+ required: true
30
+ },
31
+
32
+ subtitle: {
33
+ type: String,
34
+ default: ''
35
+ },
36
+
37
+ title: {
38
+ type: String,
39
+ required: true
40
+ }
41
+ },
42
+
43
+ computed: {
44
+ gearSize () {
45
+ return this.$_isSmall ? '90px' : '160px'
46
+ },
47
+
48
+ hasButtonProps () {
49
+ return !!Object.keys(this.buttonProps).length
50
+ }
51
+ }
52
+ }
53
+ </script>
54
+
55
+ <style lang="scss">
56
+ .error-component {
57
+ min-height: 100vh;
58
+ background-color: var(--qas-background-color);
59
+ }
60
+ </style>
@@ -1,6 +1,26 @@
1
1
  <template>
2
- <div class="fixed-center text-center">
3
- <p class="q-my-lg text-faded">Ops, você não tem permissão para acessar esta página <strong>(403).</strong></p>
4
- <q-btn color="primary" flat @click="$router.push('/')">Voltar</q-btn>
5
- </div>
6
- </template>
2
+ <error-component v-bind="errorProps" />
3
+ </template>
4
+
5
+ <script>
6
+ import ErrorComponent from './ErrorComponent'
7
+
8
+ export default {
9
+ components: {
10
+ ErrorComponent
11
+ },
12
+
13
+ computed: {
14
+ errorProps () {
15
+ return {
16
+ code: '403',
17
+ title: 'Ops, parece que você não tem acesso para este recurso!',
18
+ buttonProps: {
19
+ to: { path: '/' },
20
+ label: 'Voltar ao início'
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ </script>
@@ -1,6 +1,26 @@
1
1
  <template>
2
- <div class="fixed-center text-center">
3
- <p class="q-my-lg text-faded">Ops, nada aqui... <strong>(404)</strong></p>
4
- <q-btn color="primary" flat @click="$router.push('/')">Voltar</q-btn>
5
- </div>
2
+ <error-component v-bind="errorProps" />
6
3
  </template>
4
+
5
+ <script>
6
+ import ErrorComponent from './ErrorComponent'
7
+
8
+ export default {
9
+ components: {
10
+ ErrorComponent
11
+ },
12
+
13
+ computed: {
14
+ errorProps () {
15
+ return {
16
+ code: '404',
17
+ title: 'Ops! Parece que a página que está tentando acessar não existe!',
18
+ buttonProps: {
19
+ to: { path: '/' },
20
+ label: 'Voltar ao início'
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ </script>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <error-component v-bind="errorProps" />
3
+ </template>
4
+
5
+ <script>
6
+ import ErrorComponent from './ErrorComponent'
7
+
8
+ export default {
9
+ components: {
10
+ ErrorComponent
11
+ },
12
+
13
+ computed: {
14
+ errorProps () {
15
+ return {
16
+ code: '500',
17
+ title: 'Ops, ocorreu um erro interno no nosso servidor!',
18
+ subtitle: 'Tente novamente em alguns instantes.'
19
+ }
20
+ }
21
+ }
22
+ }
23
+ </script>