v-sistec-features 1.6.2 → 1.7.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/dist/core.js +1 -1
- package/dist/index-SOrsDdYZ.js +710 -0
- package/dist/index.js +1 -1
- package/dist/{plugin-CS5DnmVr.js → plugin-BWcXrGKi.js} +65 -59
- package/dist/toast/components/ToastComponent.vue.d.ts +6 -0
- package/dist/toast/index.d.ts +1 -0
- package/dist/toast/useToastStore.d.ts +15 -0
- package/dist/toast.js +50 -0
- package/dist/v-sistec-features.css +1 -1
- package/package.json +8 -2
- package/src/core/plugin.ts +9 -0
- package/src/toast/components/ToastComponent.vue +20 -0
- package/src/toast/index.ts +2 -0
- package/src/toast/useToastStore.ts +53 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
// store.ts
|
|
3
|
+
import { useToast } from "vue-toastification";
|
|
4
|
+
import ToastComponent from "./components/ToastComponent.vue";
|
|
5
|
+
import { defineStore } from "pinia";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Define os tipos de toast aceitos.
|
|
9
|
+
* 1 = success
|
|
10
|
+
* 2 = error
|
|
11
|
+
* 3 = info
|
|
12
|
+
*/
|
|
13
|
+
type ToastStoreType = 1 | 2 | 3;
|
|
14
|
+
|
|
15
|
+
export const useToastStore = defineStore("toastStore", () => {
|
|
16
|
+
const showToast = (
|
|
17
|
+
title: string,
|
|
18
|
+
body: string,
|
|
19
|
+
type: ToastStoreType
|
|
20
|
+
) => {
|
|
21
|
+
const toast = useToast();
|
|
22
|
+
|
|
23
|
+
const content = {
|
|
24
|
+
component: ToastComponent,
|
|
25
|
+
props: {
|
|
26
|
+
content: {
|
|
27
|
+
title: title,
|
|
28
|
+
body: body,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
switch (type) {
|
|
33
|
+
case 1:
|
|
34
|
+
toast.success(content, {});
|
|
35
|
+
break;
|
|
36
|
+
case 2:
|
|
37
|
+
toast.error(content, {
|
|
38
|
+
timeout: 7000,
|
|
39
|
+
});
|
|
40
|
+
break;
|
|
41
|
+
case 3:
|
|
42
|
+
toast.info(content, {});
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
console.info("Tipo de toast não encontrado");
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
showToast,
|
|
52
|
+
};
|
|
53
|
+
});
|