@bildvitta/quasar-ui-asteroid 3.3.1-beta.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
|
@@ -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
|
}
|
|
@@ -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 = {}) {
|