@bildvitta/quasar-ui-asteroid 3.3.0 → 3.4.0-beta.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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bildvitta/quasar-ui-asteroid",
|
|
3
3
|
"description": "Asteroid",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.4.0-beta.0",
|
|
5
5
|
"author": "Bild & Vitta <systemteam@bild.com.br>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/asteroid.cjs.min.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"autoprefixer": "^10.4.2",
|
|
36
36
|
"core-js": "^3.20.2",
|
|
37
37
|
"postcss": "^8.4.5",
|
|
38
|
-
"quasar": "^2.10.
|
|
38
|
+
"quasar": "^2.10.1",
|
|
39
39
|
"rimraf": "^3.0.2",
|
|
40
40
|
"rollup": "^2.66.0",
|
|
41
41
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import { copyToClipboard } from '
|
|
12
|
+
import { copyToClipboard } from '../../helpers'
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
15
|
name: 'QasCopy',
|
|
@@ -38,17 +38,10 @@ export default {
|
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
methods: {
|
|
41
|
-
|
|
42
|
-
this.isLoading
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
await copyToClipboard(this.text)
|
|
46
|
-
this.$qas.success('Copiado!', this.text)
|
|
47
|
-
} catch (error) {
|
|
48
|
-
this.$qas.error('Não foi possível copiar.', this.text)
|
|
49
|
-
} finally {
|
|
50
|
-
setTimeout(() => { this.isLoading = false }, 500)
|
|
51
|
-
}
|
|
41
|
+
copy () {
|
|
42
|
+
copyToClipboard(this.text, isLoading => {
|
|
43
|
+
this.isLoading = isLoading
|
|
44
|
+
})
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
47
|
}
|
|
@@ -47,7 +47,8 @@ export default {
|
|
|
47
47
|
data () {
|
|
48
48
|
return {
|
|
49
49
|
errorData: false,
|
|
50
|
-
messageErrorData: ''
|
|
50
|
+
messageErrorData: '',
|
|
51
|
+
mask: ''
|
|
51
52
|
}
|
|
52
53
|
},
|
|
53
54
|
|
|
@@ -60,13 +61,6 @@ export default {
|
|
|
60
61
|
return this.$refs.input
|
|
61
62
|
},
|
|
62
63
|
|
|
63
|
-
mask () {
|
|
64
|
-
const { mask } = this.$attrs
|
|
65
|
-
const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, mask)
|
|
66
|
-
|
|
67
|
-
return hasDefaultMask ? this.masks[mask]() : mask
|
|
68
|
-
},
|
|
69
|
-
|
|
70
64
|
masks () {
|
|
71
65
|
return {
|
|
72
66
|
'company-document': () => '##.###.###/####-##',
|
|
@@ -83,10 +77,7 @@ export default {
|
|
|
83
77
|
},
|
|
84
78
|
|
|
85
79
|
set (value) {
|
|
86
|
-
|
|
87
|
-
this.errorData = false
|
|
88
|
-
this.errorMessageData = ''
|
|
89
|
-
}
|
|
80
|
+
this.handleErrors()
|
|
90
81
|
|
|
91
82
|
return this.$emit('update:modelValue', value)
|
|
92
83
|
}
|
|
@@ -94,7 +85,9 @@ export default {
|
|
|
94
85
|
},
|
|
95
86
|
|
|
96
87
|
watch: {
|
|
97
|
-
mask () {
|
|
88
|
+
mask (value) {
|
|
89
|
+
if (!value) return
|
|
90
|
+
|
|
98
91
|
const input = this.getInput()
|
|
99
92
|
|
|
100
93
|
requestAnimationFrame(() => {
|
|
@@ -102,6 +95,13 @@ export default {
|
|
|
102
95
|
})
|
|
103
96
|
},
|
|
104
97
|
|
|
98
|
+
modelValue: {
|
|
99
|
+
handler () {
|
|
100
|
+
this.handleMask()
|
|
101
|
+
},
|
|
102
|
+
immediate: true
|
|
103
|
+
},
|
|
104
|
+
|
|
105
105
|
error: {
|
|
106
106
|
handler (value) {
|
|
107
107
|
this.errorData = value
|
|
@@ -129,8 +129,6 @@ export default {
|
|
|
129
129
|
},
|
|
130
130
|
|
|
131
131
|
toggleMask (first, second) {
|
|
132
|
-
if (!this.modelValue?.length) return
|
|
133
|
-
|
|
134
132
|
const length = first.split('#').length - 2
|
|
135
133
|
return this.modelValue?.length > length ? second : first
|
|
136
134
|
},
|
|
@@ -152,7 +150,25 @@ export default {
|
|
|
152
150
|
},
|
|
153
151
|
|
|
154
152
|
getInput () {
|
|
155
|
-
return this.inputReference
|
|
153
|
+
return this.inputReference?.$el?.querySelector('input')
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
handleErrors () {
|
|
157
|
+
if (this.useRemoveErrorOnType && this.error) {
|
|
158
|
+
this.errorData = false
|
|
159
|
+
this.errorMessageData = ''
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
handleMask () {
|
|
164
|
+
if (!this.modelValue?.length) return
|
|
165
|
+
|
|
166
|
+
const { mask } = this.$attrs
|
|
167
|
+
const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, mask)
|
|
168
|
+
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
this.mask = hasDefaultMask ? this.masks[mask]() : mask
|
|
171
|
+
})
|
|
156
172
|
}
|
|
157
173
|
}
|
|
158
174
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { copyToClipboard } from 'quasar'
|
|
2
|
+
import { NotifySuccess, NotifyError } from '../plugins'
|
|
3
|
+
|
|
4
|
+
export default async (text, onLoading = () => {}) => {
|
|
5
|
+
onLoading(true)
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
await copyToClipboard(text)
|
|
9
|
+
NotifySuccess('Copiado!', text)
|
|
10
|
+
} catch {
|
|
11
|
+
NotifyError('Não foi possível copiar.', text)
|
|
12
|
+
} finally {
|
|
13
|
+
setTimeout(() => { onLoading(false) }, 500)
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/helpers/index.js
CHANGED
|
@@ -13,7 +13,8 @@ export { default as getNormalizedOptions } from './get-normalized-options.js'
|
|
|
13
13
|
export { default as handleProcess } from './handle-process.js'
|
|
14
14
|
export { default as destroyNestedChildrenByKey } from './destroy-nested-children-by-key.js'
|
|
15
15
|
export { default as promiseHandler } from './promise-handler.js'
|
|
16
|
-
export { default as findChildrenByKey } from './find-children-by-key'
|
|
16
|
+
export { default as findChildrenByKey } from './find-children-by-key.js'
|
|
17
|
+
export { default as copyToClipboard } from './copy-to-clipboard.js'
|
|
17
18
|
|
|
18
19
|
export * from './filters.js'
|
|
19
20
|
export * from './images.js'
|
package/src/mixins/view.js
CHANGED
|
@@ -89,16 +89,20 @@ export default {
|
|
|
89
89
|
const { response } = error
|
|
90
90
|
const exception = response?.data?.exception || error.message
|
|
91
91
|
|
|
92
|
-
this.$qas.error('Ops! Erro ao obter os dados.', exception)
|
|
93
|
-
|
|
94
92
|
const status = response?.status
|
|
93
|
+
|
|
95
94
|
const redirect = status >= 500
|
|
96
95
|
? 'ServerError'
|
|
97
96
|
: ({ 401: 'Unauthorized', 403: 'Forbidden', 404: 'NotFound' })[status]
|
|
98
97
|
|
|
98
|
+
// caso exista um desses status será redirecionado sem aparecer o "notify"
|
|
99
99
|
if (redirect) {
|
|
100
100
|
this.$router.replace({ name: redirect })
|
|
101
|
+
|
|
102
|
+
return
|
|
101
103
|
}
|
|
104
|
+
|
|
105
|
+
this.$qas.error('Ops! Erro ao obter os dados.', exception)
|
|
102
106
|
},
|
|
103
107
|
|
|
104
108
|
mx_setErrors (errors = {}) {
|