@forizi-tecnologia/ui 0.0.2
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/LICENSE +21 -0
- package/README.md +220 -0
- package/dist/chunks/components/buttons-FzIconToolTip-D_cBN1TN.js +53 -0
- package/dist/chunks/components/buttons-FzIconToolTip-D_cBN1TN.js.map +1 -0
- package/dist/chunks/components/inputs-FzEmailField-B07tsUyr.js +86 -0
- package/dist/chunks/components/inputs-FzEmailField-B07tsUyr.js.map +1 -0
- package/dist/chunks/components/inputs-FzFullAddress-e05j6MFg.js +195 -0
- package/dist/chunks/components/inputs-FzFullAddress-e05j6MFg.js.map +1 -0
- package/dist/chunks/components/inputs-FzMoneyField-BxAg9Bd_.js +106 -0
- package/dist/chunks/components/inputs-FzMoneyField-BxAg9Bd_.js.map +1 -0
- package/dist/chunks/components/inputs-FzNumberField-BAPRZpBo.js +107 -0
- package/dist/chunks/components/inputs-FzNumberField-BAPRZpBo.js.map +1 -0
- package/dist/chunks/components/inputs-FzPhoneField-DKMx53pK.js +272 -0
- package/dist/chunks/components/inputs-FzPhoneField-DKMx53pK.js.map +1 -0
- package/dist/chunks/components/inputs-FzZipCodeField-kkCMb3t9.js +102 -0
- package/dist/chunks/components/inputs-FzZipCodeField-kkCMb3t9.js.map +1 -0
- package/dist/chunks/components/layout-FzLoadingOverlay-DbVh5Ncb.js +58 -0
- package/dist/chunks/components/layout-FzLoadingOverlay-DbVh5Ncb.js.map +1 -0
- package/dist/chunks/components/messages-FzConfirmDialog-kcpokBc2.js +18 -0
- package/dist/chunks/components/messages-FzConfirmDialog-kcpokBc2.js.map +1 -0
- package/dist/chunks/components/messages-FzCustomConfirmDialog-CttE2KMh.js +107 -0
- package/dist/chunks/components/messages-FzCustomConfirmDialog-CttE2KMh.js.map +1 -0
- package/dist/chunks/components/messages-FzFloatingNotify-BdlkCu5i.js +96 -0
- package/dist/chunks/components/messages-FzFloatingNotify-BdlkCu5i.js.map +1 -0
- package/dist/chunks/components/modals-FzModalBase-C4wU9yAp.js +131 -0
- package/dist/chunks/components/modals-FzModalBase-C4wU9yAp.js.map +1 -0
- package/dist/chunks/composables/useBreakpoint-DnFIVluv.js +13 -0
- package/dist/chunks/composables/useBreakpoint-DnFIVluv.js.map +1 -0
- package/dist/chunks/composables/useGlobals-AagqYKoP.js +15 -0
- package/dist/chunks/composables/useGlobals-AagqYKoP.js.map +1 -0
- package/dist/chunks/composables/useLoading-Cu1i2QIr.js +20 -0
- package/dist/chunks/composables/useLoading-Cu1i2QIr.js.map +1 -0
- package/dist/chunks/composables/useNumericInput-DGw52-Ds.js +71 -0
- package/dist/chunks/composables/useNumericInput-DGw52-Ds.js.map +1 -0
- package/dist/chunks/index-Bu6SLmX_.js +31 -0
- package/dist/chunks/index-Bu6SLmX_.js.map +1 -0
- package/dist/chunks/utils/api-N1Cju-89.js +26 -0
- package/dist/chunks/utils/api-N1Cju-89.js.map +1 -0
- package/dist/chunks/utils/confirm-DiGEPjua.js +18 -0
- package/dist/chunks/utils/confirm-DiGEPjua.js.map +1 -0
- package/dist/chunks/utils/loading-dXhCGa6R.js +17 -0
- package/dist/chunks/utils/loading-dXhCGa6R.js.map +1 -0
- package/dist/chunks/utils/notify-CE_gbk11.js +65 -0
- package/dist/chunks/utils/notify-CE_gbk11.js.map +1 -0
- package/dist/chunks/utils/types-DV6li0y5.js +6 -0
- package/dist/chunks/utils/types-DV6li0y5.js.map +1 -0
- package/dist/chunks/utils/vuetify-check-DRI6ZYnO.js +21 -0
- package/dist/chunks/utils/vuetify-check-DRI6ZYnO.js.map +1 -0
- package/dist/components/buttons/FzIconToolTip.vue.d.ts +22 -0
- package/dist/components/buttons/FzIconToolTip.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +27 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/inputs/FzEmailField.vue.d.ts +49 -0
- package/dist/components/inputs/FzEmailField.vue.d.ts.map +1 -0
- package/dist/components/inputs/FzFullAddress.vue.d.ts +40 -0
- package/dist/components/inputs/FzFullAddress.vue.d.ts.map +1 -0
- package/dist/components/inputs/FzMoneyField.vue.d.ts +47 -0
- package/dist/components/inputs/FzMoneyField.vue.d.ts.map +1 -0
- package/dist/components/inputs/FzNumberField.vue.d.ts +49 -0
- package/dist/components/inputs/FzNumberField.vue.d.ts.map +1 -0
- package/dist/components/inputs/FzPhoneField.vue.d.ts +38 -0
- package/dist/components/inputs/FzPhoneField.vue.d.ts.map +1 -0
- package/dist/components/inputs/FzZipCodeField.vue.d.ts +50 -0
- package/dist/components/inputs/FzZipCodeField.vue.d.ts.map +1 -0
- package/dist/components/layout/FzLoadingOverlay.vue.d.ts +13 -0
- package/dist/components/layout/FzLoadingOverlay.vue.d.ts.map +1 -0
- package/dist/components/messages/FzConfirmDialog.vue.d.ts +7 -0
- package/dist/components/messages/FzConfirmDialog.vue.d.ts.map +1 -0
- package/dist/components/messages/FzCustomConfirmDialog.vue.d.ts +7 -0
- package/dist/components/messages/FzCustomConfirmDialog.vue.d.ts.map +1 -0
- package/dist/components/messages/FzFloatingNotify.vue.d.ts +4 -0
- package/dist/components/messages/FzFloatingNotify.vue.d.ts.map +1 -0
- package/dist/components/modals/FzModalBase.vue.d.ts +45 -0
- package/dist/components/modals/FzModalBase.vue.d.ts.map +1 -0
- package/dist/composables/index.d.ts +5 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/index.js +13 -0
- package/dist/composables/index.js.map +1 -0
- package/dist/composables/useBreakpoint.d.ts +5 -0
- package/dist/composables/useBreakpoint.d.ts.map +1 -0
- package/dist/composables/useGlobals.d.ts +9 -0
- package/dist/composables/useGlobals.d.ts.map +1 -0
- package/dist/composables/useLoading.d.ts +7 -0
- package/dist/composables/useLoading.d.ts.map +1 -0
- package/dist/composables/useNumericInput.d.ts +14 -0
- package/dist/composables/useNumericInput.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +94 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/globals.d.ts +16 -0
- package/dist/plugins/globals.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/ui.css +1 -0
- package/dist/utils/api.d.ts +8 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/confirm.d.ts +15 -0
- package/dist/utils/confirm.d.ts.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/loading.d.ts +12 -0
- package/dist/utils/loading.d.ts.map +1 -0
- package/dist/utils/notify.d.ts +40 -0
- package/dist/utils/notify.d.ts.map +1 -0
- package/dist/utils/types.d.ts +21 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/vuetify-check.d.ts +4 -0
- package/dist/utils/vuetify-check.d.ts.map +1 -0
- package/dist/vuetifyComponents.d.ts +22 -0
- package/dist/vuetifyComponents.d.ts.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent as y, ref as C, computed as u, onBeforeUnmount as w, resolveComponent as m, withDirectives as z, createBlock as V, openBlock as $, createSlots as B, withCtx as l, createVNode as S, createTextVNode as j, renderSlot as p, unref as x } from "vue";
|
|
2
|
+
import { k as A } from "./inputs-FzPhoneField-DKMx53pK.js";
|
|
3
|
+
import { Mask as F } from "maska";
|
|
4
|
+
const E = /* @__PURE__ */ y({
|
|
5
|
+
__name: "FzZipCodeField",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { default: "" },
|
|
8
|
+
label: { default: "CEP" },
|
|
9
|
+
rules: { default: () => [] },
|
|
10
|
+
disabled: { type: Boolean, default: !1 },
|
|
11
|
+
hint: { default: "" },
|
|
12
|
+
variant: { default: "underlined" }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue", "zip-code-found", "zip-code-not-found"],
|
|
15
|
+
setup(n, { emit: c }) {
|
|
16
|
+
const d = n, o = c, r = C(!1);
|
|
17
|
+
let t = null;
|
|
18
|
+
const f = new F({ mask: "#####-###", eager: !0 }), v = u(() => f.masked(d.modelValue ?? "")), h = u(() => !!d.hint);
|
|
19
|
+
function b(e) {
|
|
20
|
+
return {
|
|
21
|
+
zipCode: e.cep ?? "",
|
|
22
|
+
street: e.logradouro ?? "",
|
|
23
|
+
complement: e.complemento ?? "",
|
|
24
|
+
neighborhood: e.bairro ?? "",
|
|
25
|
+
city: e.localidade ?? "",
|
|
26
|
+
state: e.uf ?? "",
|
|
27
|
+
error: e.erro
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function k(e) {
|
|
31
|
+
t?.abort(), t = new AbortController(), r.value = !0;
|
|
32
|
+
try {
|
|
33
|
+
const s = await (await fetch(`https://viacep.com.br/ws/${e}/json/`, {
|
|
34
|
+
signal: t.signal
|
|
35
|
+
})).json(), a = b(s);
|
|
36
|
+
if (a.error) {
|
|
37
|
+
o("zip-code-not-found");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
o("zip-code-found", a);
|
|
41
|
+
} catch {
|
|
42
|
+
o("zip-code-not-found");
|
|
43
|
+
} finally {
|
|
44
|
+
r.value = !1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const g = {
|
|
48
|
+
mask: "#####-###",
|
|
49
|
+
eager: !0,
|
|
50
|
+
onMaska: (e) => {
|
|
51
|
+
o("update:modelValue", e.unmasked), e.completed && k(e.unmasked);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return w(() => {
|
|
55
|
+
t?.abort();
|
|
56
|
+
}), (e, i) => {
|
|
57
|
+
const s = m("v-icon"), a = m("v-text-field");
|
|
58
|
+
return z(($(), V(a, {
|
|
59
|
+
"model-value": v.value,
|
|
60
|
+
label: n.label,
|
|
61
|
+
rules: n.rules,
|
|
62
|
+
disabled: n.disabled,
|
|
63
|
+
hint: n.hint,
|
|
64
|
+
"persistent-hint": h.value,
|
|
65
|
+
variant: n.variant,
|
|
66
|
+
loading: r.value,
|
|
67
|
+
inputmode: "numeric"
|
|
68
|
+
}, B({
|
|
69
|
+
"prepend-inner": l(() => [
|
|
70
|
+
S(s, null, {
|
|
71
|
+
default: l(() => [...i[0] || (i[0] = [
|
|
72
|
+
j("mdi-map-marker-outline", -1)
|
|
73
|
+
])]),
|
|
74
|
+
_: 1
|
|
75
|
+
})
|
|
76
|
+
]),
|
|
77
|
+
_: 2
|
|
78
|
+
}, [
|
|
79
|
+
e.$slots.prepend ? {
|
|
80
|
+
name: "prepend",
|
|
81
|
+
fn: l(() => [
|
|
82
|
+
p(e.$slots, "prepend")
|
|
83
|
+
]),
|
|
84
|
+
key: "0"
|
|
85
|
+
} : void 0,
|
|
86
|
+
e.$slots.append ? {
|
|
87
|
+
name: "append",
|
|
88
|
+
fn: l(() => [
|
|
89
|
+
p(e.$slots, "append")
|
|
90
|
+
]),
|
|
91
|
+
key: "1"
|
|
92
|
+
} : void 0
|
|
93
|
+
]), 1032, ["model-value", "label", "rules", "disabled", "hint", "persistent-hint", "variant", "loading"])), [
|
|
94
|
+
[x(A), g]
|
|
95
|
+
]);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
E as _
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=inputs-FzZipCodeField-kkCMb3t9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs-FzZipCodeField-kkCMb3t9.js","sources":["../../../src/components/inputs/FzZipCodeField.vue"],"sourcesContent":["<template>\n <v-text-field\n v-maska=\"maskOptions\"\n :model-value=\"displayValue\"\n :label=\"label\"\n :rules=\"rules\"\n :disabled=\"disabled\"\n :hint=\"hint\"\n :persistent-hint=\"hasHint\"\n :variant=\"variant\"\n :loading=\"isSearching\"\n inputmode=\"numeric\"\n >\n <template #prepend-inner>\n <v-icon>mdi-map-marker-outline</v-icon>\n </template>\n <template v-if=\"$slots.prepend\" #prepend>\n <slot name=\"prepend\" />\n </template>\n <template v-if=\"$slots.append\" #append>\n <slot name=\"append\" />\n </template>\n </v-text-field>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, onBeforeUnmount } from 'vue';\nimport { vMaska } from 'maska/vue';\nimport { Mask } from 'maska';\nimport type { TextFieldVariant } from '@/utils/types';\n\ntype ValidationRule = (value: string) => boolean | string;\n\nexport interface ZipCodeResponse {\n zipCode: string;\n street: string;\n complement: string;\n neighborhood: string;\n city: string;\n state: string;\n error?: boolean;\n}\n\ninterface ViaCepApiResponse {\n cep: string;\n logradouro: string;\n complemento: string;\n bairro: string;\n localidade: string;\n uf: string;\n erro?: boolean;\n}\n\ninterface Props {\n modelValue?: string\n label?: string\n rules?: ValidationRule[]\n disabled?: boolean\n hint?: string\n variant?: TextFieldVariant\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n modelValue: '',\n label: 'CEP',\n rules: () => [],\n disabled: false,\n hint: '',\n variant: 'underlined',\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n 'zip-code-found': [address: ZipCodeResponse]\n 'zip-code-not-found': []\n}>();\n\nconst isSearching = ref(false);\nlet abortController: AbortController | null = null;\n\nconst mask = new Mask({ mask: '#####-###', eager: true });\n\nconst displayValue = computed(() => mask.masked(props.modelValue ?? ''));\n\nconst hasHint = computed(() => !!props.hint);\n\n\n\nfunction mapResponse(data: ViaCepApiResponse): ZipCodeResponse {\n return {\n zipCode: data.cep ?? '',\n street: data.logradouro ?? '',\n complement: data.complemento ?? '',\n neighborhood: data.bairro ?? '',\n city: data.localidade ?? '',\n state: data.uf ?? '',\n error: data.erro,\n };\n}\n\nasync function fetchAddress(zipCode: string) {\n abortController?.abort();\n abortController = new AbortController();\n\n isSearching.value = true;\n\n try {\n const res = await fetch(`https://viacep.com.br/ws/${zipCode}/json/`, {\n signal: abortController.signal,\n });\n\n const data = await res.json();\n const mapped = mapResponse(data);\n\n if (mapped.error) {\n emit('zip-code-not-found');\n\n return;\n }\n\n emit('zip-code-found', mapped);\n } catch {\n emit('zip-code-not-found');\n } finally {\n isSearching.value = false;\n }\n}\n\nconst maskOptions = {\n mask: '#####-###',\n eager: true,\n onMaska: (detail: { masked: string; unmasked: string; completed: boolean }) => {\n emit('update:modelValue', detail.unmasked);\n\n if (detail.completed) fetchAddress(detail.unmasked);\n },\n};\n\nonBeforeUnmount(() => {\n abortController?.abort();\n});\n</script>\n"],"names":["props","__props","emit","__emit","isSearching","ref","abortController","mask","Mask","displayValue","computed","hasHint","mapResponse","data","fetchAddress","zipCode","mapped","maskOptions","detail","onBeforeUnmount","_createBlock","_component_v_text_field","_createVNode","_component_v_icon","_cache","$slots","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;AA8DA,UAAMA,IAAQC,GASRC,IAAOC,GAMPC,IAAcC,EAAI,EAAK;AAC7B,QAAIC,IAA0C;AAE9C,UAAMC,IAAO,IAAIC,EAAK,EAAE,MAAM,aAAa,OAAO,IAAM,GAElDC,IAAeC,EAAS,MAAMH,EAAK,OAAOP,EAAM,cAAc,EAAE,CAAC,GAEjEW,IAAUD,EAAS,MAAM,CAAC,CAACV,EAAM,IAAI;AAI3C,aAASY,EAAYC,GAA0C;AAC7D,aAAO;AAAA,QACL,SAASA,EAAK,OAAO;AAAA,QACrB,QAAQA,EAAK,cAAc;AAAA,QAC3B,YAAYA,EAAK,eAAe;AAAA,QAChC,cAAcA,EAAK,UAAU;AAAA,QAC7B,MAAMA,EAAK,cAAc;AAAA,QACzB,OAAOA,EAAK,MAAM;AAAA,QAClB,OAAOA,EAAK;AAAA,MAAA;AAAA,IAEhB;AAEA,mBAAeC,EAAaC,GAAiB;AAC3C,MAAAT,GAAiB,MAAA,GACjBA,IAAkB,IAAI,gBAAA,GAEtBF,EAAY,Q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;AAAA,YAAtBC,EAAsBC,EAAA,QAAA,QAAA;AAAA,UAAA;;;;eAlBfV,CAAW;AAAA,MAAA;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineComponent as u, ref as f, watch as _, onBeforeUnmount as g, resolveComponent as p, createBlock as v, openBlock as a, Transition as l, withCtx as i, createElementBlock as s, createCommentVNode as c, createVNode as d, createElementVNode as y, toDisplayString as h } from "vue";
|
|
2
|
+
import { _ as x } from "./inputs-FzMoneyField-BxAg9Bd_.js";
|
|
3
|
+
const w = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "loading-overlay d-flex align-center justify-center"
|
|
6
|
+
}, C = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "d-flex flex-column align-center"
|
|
9
|
+
}, k = { class: "text-white text-body-1 font-weight-medium mt-3" }, B = /* @__PURE__ */ u({
|
|
10
|
+
__name: "FzLoadingOverlay",
|
|
11
|
+
props: {
|
|
12
|
+
isLoading: { type: Boolean, default: !1 },
|
|
13
|
+
message: { default: "Carregando..." },
|
|
14
|
+
delay: { default: 300 }
|
|
15
|
+
},
|
|
16
|
+
setup(t) {
|
|
17
|
+
const n = t, o = f(!1);
|
|
18
|
+
let e = null;
|
|
19
|
+
return _(() => n.isLoading, (r) => {
|
|
20
|
+
if (r) {
|
|
21
|
+
e = setTimeout(() => {
|
|
22
|
+
o.value = !0;
|
|
23
|
+
}, n.delay);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
e && (clearTimeout(e), e = null), o.value = !1;
|
|
27
|
+
}), g(() => {
|
|
28
|
+
e && clearTimeout(e);
|
|
29
|
+
}), (r, L) => {
|
|
30
|
+
const m = p("v-progress-circular");
|
|
31
|
+
return a(), v(l, { name: "fade" }, {
|
|
32
|
+
default: i(() => [
|
|
33
|
+
t.isLoading ? (a(), s("div", w, [
|
|
34
|
+
d(l, { name: "fade-delayed" }, {
|
|
35
|
+
default: i(() => [
|
|
36
|
+
o.value ? (a(), s("div", C, [
|
|
37
|
+
d(m, {
|
|
38
|
+
indeterminate: "",
|
|
39
|
+
color: "primary",
|
|
40
|
+
size: 30,
|
|
41
|
+
width: 5
|
|
42
|
+
}),
|
|
43
|
+
y("div", k, h(t.message), 1)
|
|
44
|
+
])) : c("", !0)
|
|
45
|
+
]),
|
|
46
|
+
_: 1
|
|
47
|
+
})
|
|
48
|
+
])) : c("", !0)
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}), F = /* @__PURE__ */ x(B, [["__scopeId", "data-v-7110b861"]]);
|
|
55
|
+
export {
|
|
56
|
+
F
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=layout-FzLoadingOverlay-DbVh5Ncb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-FzLoadingOverlay-DbVh5Ncb.js","sources":["../../../src/components/layout/FzLoadingOverlay.vue"],"sourcesContent":["<template>\n <Transition name=\"fade\">\n <div v-if=\"isLoading\" class=\"loading-overlay d-flex align-center justify-center\">\n <Transition name=\"fade-delayed\">\n <div v-if=\"showContent\" class=\"d-flex flex-column align-center\">\n <v-progress-circular indeterminate color=\"primary\" :size=\"30\" :width=\"5\" />\n <div class=\"text-white text-body-1 font-weight-medium mt-3\">\n {{ message }}\n </div>\n </div>\n </Transition>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch, onBeforeUnmount } from 'vue';\n\ninterface Props {\n isLoading?: boolean\n message?: string\n delay?: number\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n isLoading: false,\n message: 'Carregando...',\n delay: 300,\n});\n\nconst showContent = ref(false);\nlet contentTimeoutId: ReturnType<typeof setTimeout> | null = null;\n\nwatch(() => props.isLoading, (val) => {\n if (val) {\n contentTimeoutId = setTimeout(() => {\n showContent.value = true;\n }, props.delay);\n\n return;\n }\n\n if (contentTimeoutId) {\n clearTimeout(contentTimeoutId);\n contentTimeoutId = null;\n }\n\n showContent.value = false;\n});\n\nonBeforeUnmount(() => {\n if (contentTimeoutId) clearTimeout(contentTimeoutId);\n});\n</script>\n\n<style scoped>\n.loading-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.7);\n z-index: 9998;\n}\n\n.fade-enter-active,\n.fade-leave-active {\n transition: opacity 0.2s ease;\n}\n\n.fade-enter-from,\n.fade-leave-to {\n opacity: 0;\n}\n\n.fade-delayed-enter-active {\n transition: opacity 0.3s ease 0.1s;\n}\n\n.fade-delayed-leave-active {\n transition: opacity 0.2s ease;\n}\n\n.fade-delayed-enter-from,\n.fade-delayed-leave-to {\n opacity: 0;\n}\n</style>\n"],"names":["props","__props","showContent","ref","contentTimeoutId","watch","val","onBeforeUnmount","_createBlock","_Transition","_openBlock","_createElementBlock","_hoisted_1","_createVNode","_hoisted_2","_component_v_progress_circular","_createElementVNode","_hoisted_3","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;AAwBA,UAAMA,IAAQC,GAMRC,IAAcC,EAAI,EAAK;AAC7B,QAAIC,IAAyD;AAE7D,WAAAC,EAAM,MAAML,EAAM,WAAW,CAACM,MAAQ;AACpC,UAAIA,GAAK;AACP,QAAAF,IAAmB,WAAW,MAAM;AAClC,UAAAF,EAAY,QAAQ;AAAA,QACtB,GAAGF,EAAM,KAAK;AAEd;AAAA,MACF;AAEA,MAAII,MACF,aAAaA,CAAgB,GAC7BA,IAAmB,OAGrBF,EAAY,QAAQ;AAAA,IACtB,CAAC,GAEDK,EAAgB,MAAM;AACpB,MAAIH,kBAA+BA,CAAgB;AAAA,IACrD,CAAC;;kBAnDCI,EAWaC,GAAA,EAXD,MAAK,UAAM;AAAA,mBACrB,MASM;AAAA,UATKR,EAAA,aAAXS,EAAA,GAAAC,EASM,OATNC,GASM;AAAA,YARJC,EAOaJ,GAAA,EAPD,MAAK,kBAAc;AAAA,yBAC7B,MAKM;AAAA,gBALKP,EAAA,SAAXQ,EAAA,GAAAC,EAKM,OALNG,GAKM;AAAA,kBAJJD,EAA2EE,GAAA;AAAA,oBAAtD,eAAA;AAAA,oBAAc,OAAM;AAAA,oBAAW,MAAM;AAAA,oBAAK,OAAO;AAAA,kBAAA;kBACtEC,EAEM,OAFNC,GAEMC,EADDjB,EAAA,OAAO,GAAA,CAAA;AAAA,gBAAA;;;;;;;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineComponent as l, ref as t, createBlock as a, openBlock as f } from "vue";
|
|
2
|
+
import { F as m } from "./messages-FzCustomConfirmDialog-CttE2KMh.js";
|
|
3
|
+
const p = /* @__PURE__ */ l({
|
|
4
|
+
__name: "FzConfirmDialog",
|
|
5
|
+
setup(c, { expose: n }) {
|
|
6
|
+
const o = t(null);
|
|
7
|
+
return n({
|
|
8
|
+
confirmDialog: (e, r, i) => o.value ? o.value.confirmDialog(e, r, i) : Promise.resolve(!1)
|
|
9
|
+
}), (e, r) => (f(), a(m, {
|
|
10
|
+
ref_key: "customDialogRef",
|
|
11
|
+
ref: o
|
|
12
|
+
}, null, 512));
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
p as _
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=messages-FzConfirmDialog-kcpokBc2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-FzConfirmDialog-kcpokBc2.js","sources":["../../../src/components/messages/FzConfirmDialog.vue"],"sourcesContent":["<template>\n <FzCustomConfirmDialog ref=\"customDialogRef\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport FzCustomConfirmDialog from './FzCustomConfirmDialog.vue';\nimport type { ConfirmOptions } from '@/utils/types';\n\nconst customDialogRef = ref<InstanceType<typeof FzCustomConfirmDialog> | null>(null);\n\nconst confirmDialog = (title: string, message: string, options?: ConfirmOptions): Promise<boolean> => {\n if (!customDialogRef.value) return Promise.resolve(false);\n\n return customDialogRef.value.confirmDialog(title, message, options);\n};\n\ndefineExpose({\n confirmDialog,\n});\n</script>\n"],"names":["customDialogRef","ref","__expose","title","message","options","_createBlock","FzCustomConfirmDialog"],"mappings":";;;;;AASA,UAAMA,IAAkBC,EAAuD,IAAI;AAQnF,WAAAC,EAAa;AAAA,MACX,eAPoB,CAACC,GAAeC,GAAiBC,MAChDL,EAAgB,QAEdA,EAAgB,MAAM,cAAcG,GAAOC,GAASC,CAAO,IAF/B,QAAQ,QAAQ,EAAK;AAAA,IAMxD,CACD,mBAlBCC,EAA+CC,GAAA;AAAA,eAApB;AAAA,MAAJ,KAAIP;AAAA,IAAA;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineComponent as F, ref as e, onMounted as M, onUnmounted as S, resolveComponent as a, createBlock as b, openBlock as f, Teleport as j, createVNode as n, Transition as E, withCtx as t, createElementBlock as O, createCommentVNode as T, withModifiers as R, createElementVNode as I, createTextVNode as s, toDisplayString as i } from "vue";
|
|
2
|
+
import { u as w } from "../utils/confirm-DiGEPjua.js";
|
|
3
|
+
import { _ as U } from "./inputs-FzMoneyField-BxAg9Bd_.js";
|
|
4
|
+
const Y = { class: "text-h6 font-weight-medium" }, q = /* @__PURE__ */ F({
|
|
5
|
+
__name: "FzCustomConfirmDialog",
|
|
6
|
+
setup(A, { expose: N }) {
|
|
7
|
+
const c = e(!1), m = e(""), u = e(""), v = e(!0), _ = e(""), p = e(""), x = e("primary"), C = e("secondary");
|
|
8
|
+
let l = null;
|
|
9
|
+
const g = (h, r, o) => (m.value = h, u.value = r, v.value = o?.persistent ?? !0, _.value = o?.confirmText ?? "Sim", p.value = o?.cancelText ?? "Não", x.value = o?.confirmColor ?? "primary", C.value = o?.cancelColor ?? "secondary", c.value = !0, new Promise((d) => {
|
|
10
|
+
l = d;
|
|
11
|
+
}));
|
|
12
|
+
M(() => {
|
|
13
|
+
w().setConfirmRef({ confirmDialog: g });
|
|
14
|
+
}), S(() => {
|
|
15
|
+
w().setConfirmRef({ confirmDialog: () => Promise.resolve(!1) });
|
|
16
|
+
});
|
|
17
|
+
const D = () => {
|
|
18
|
+
l && l(!0), c.value = !1;
|
|
19
|
+
}, y = () => {
|
|
20
|
+
l && l(!1), c.value = !1;
|
|
21
|
+
}, P = () => {
|
|
22
|
+
v.value || y();
|
|
23
|
+
};
|
|
24
|
+
return N({
|
|
25
|
+
confirmDialog: g
|
|
26
|
+
}), (h, r) => {
|
|
27
|
+
const o = a("v-icon"), d = a("v-card-title"), V = a("v-card-text"), k = a("v-btn"), z = a("v-card-actions"), B = a("v-card");
|
|
28
|
+
return f(), b(j, { to: "body" }, [
|
|
29
|
+
n(E, { name: "dialog-fade" }, {
|
|
30
|
+
default: t(() => [
|
|
31
|
+
c.value ? (f(), O("div", {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "custom-dialog-overlay d-flex align-center justify-center pa-4",
|
|
34
|
+
onClick: R(P, ["self"])
|
|
35
|
+
}, [
|
|
36
|
+
n(B, {
|
|
37
|
+
class: "flex-grow-1",
|
|
38
|
+
"max-width": "500",
|
|
39
|
+
elevation: 12
|
|
40
|
+
}, {
|
|
41
|
+
default: t(() => [
|
|
42
|
+
n(d, { class: "d-flex align-center ga-3 px-6 pb-4 pt-6" }, {
|
|
43
|
+
default: t(() => [
|
|
44
|
+
n(o, {
|
|
45
|
+
color: "warning",
|
|
46
|
+
size: "28"
|
|
47
|
+
}, {
|
|
48
|
+
default: t(() => [...r[0] || (r[0] = [
|
|
49
|
+
s("mdi-help-circle", -1)
|
|
50
|
+
])]),
|
|
51
|
+
_: 1
|
|
52
|
+
}),
|
|
53
|
+
I("span", Y, i(m.value), 1)
|
|
54
|
+
]),
|
|
55
|
+
_: 1
|
|
56
|
+
}),
|
|
57
|
+
u.value ? (f(), b(V, {
|
|
58
|
+
key: 0,
|
|
59
|
+
class: "px-6 pb-4 text-body-2"
|
|
60
|
+
}, {
|
|
61
|
+
default: t(() => [
|
|
62
|
+
s(i(u.value), 1)
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
})) : T("", !0),
|
|
66
|
+
n(z, { class: "d-flex justify-end ga-2 px-6 pb-6 pt-2" }, {
|
|
67
|
+
default: t(() => [
|
|
68
|
+
n(k, {
|
|
69
|
+
color: C.value,
|
|
70
|
+
variant: "outlined",
|
|
71
|
+
class: "text-none",
|
|
72
|
+
onClick: y
|
|
73
|
+
}, {
|
|
74
|
+
default: t(() => [
|
|
75
|
+
s(i(p.value), 1)
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
}, 8, ["color"]),
|
|
79
|
+
n(k, {
|
|
80
|
+
color: x.value,
|
|
81
|
+
variant: "elevated",
|
|
82
|
+
class: "text-none",
|
|
83
|
+
onClick: D
|
|
84
|
+
}, {
|
|
85
|
+
default: t(() => [
|
|
86
|
+
s(i(_.value), 1)
|
|
87
|
+
]),
|
|
88
|
+
_: 1
|
|
89
|
+
}, 8, ["color"])
|
|
90
|
+
]),
|
|
91
|
+
_: 1
|
|
92
|
+
})
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
})
|
|
96
|
+
])) : T("", !0)
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
})
|
|
100
|
+
]);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}), K = /* @__PURE__ */ U(q, [["__scopeId", "data-v-ecb0e1a5"]]);
|
|
104
|
+
export {
|
|
105
|
+
K as F
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=messages-FzCustomConfirmDialog-CttE2KMh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-FzCustomConfirmDialog-CttE2KMh.js","sources":["../../../src/components/messages/FzCustomConfirmDialog.vue"],"sourcesContent":["<template>\n <Teleport to=\"body\">\n <Transition name=\"dialog-fade\">\n <div\n v-if=\"isOpen\"\n class=\"custom-dialog-overlay d-flex align-center justify-center pa-4\"\n @click.self=\"handleOverlayClick\"\n >\n <v-card class=\"flex-grow-1\" max-width=\"500\" :elevation=\"12\">\n <v-card-title class=\"d-flex align-center ga-3 px-6 pb-4 pt-6\">\n <v-icon color=\"warning\" size=\"28\">mdi-help-circle</v-icon>\n <span class=\"text-h6 font-weight-medium\">{{ currentTitle }}</span>\n </v-card-title>\n\n <v-card-text v-if=\"currentMessage\" class=\"px-6 pb-4 text-body-2\">\n {{ currentMessage }}\n </v-card-text>\n\n <v-card-actions class=\"d-flex justify-end ga-2 px-6 pb-6 pt-2\">\n <v-btn :color=\"cancelColor\" variant=\"outlined\" class=\"text-none\" @click=\"handleNo\">\n {{ cancelText }}\n </v-btn>\n <v-btn :color=\"confirmColor\" variant=\"elevated\" class=\"text-none\" @click=\"handleYes\">\n {{ confirmText }}\n </v-btn>\n </v-card-actions>\n </v-card>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue';\nimport type { ConfirmOptions } from '@/utils/types';\nimport { useConfirmStore } from '@/utils/confirm';\n\nconst isOpen = ref(false);\nconst currentTitle = ref('');\nconst currentMessage = ref('');\nconst isPersistent = ref(true);\nconst confirmText = ref('');\nconst cancelText = ref('');\nconst confirmColor = ref('primary');\nconst cancelColor = ref('secondary');\nlet resolvePromise: ((value: boolean) => void) | null = null;\n\nconst confirmDialog = (title: string, message: string, options?: ConfirmOptions): Promise<boolean> => {\n currentTitle.value = title;\n currentMessage.value = message;\n isPersistent.value = options?.persistent ?? true;\n confirmText.value = options?.confirmText ?? 'Sim';\n cancelText.value = options?.cancelText ?? 'Não';\n confirmColor.value = options?.confirmColor ?? 'primary';\n cancelColor.value = options?.cancelColor ?? 'secondary';\n isOpen.value = true;\n\n return new Promise((resolve) => {\n resolvePromise = resolve;\n });\n};\n\nonMounted(() => {\n useConfirmStore().setConfirmRef({ confirmDialog });\n});\n\nonUnmounted(() => {\n useConfirmStore().setConfirmRef({ confirmDialog: () => Promise.resolve(false) });\n});\n\nconst handleYes = () => {\n if (resolvePromise) resolvePromise(true);\n\n isOpen.value = false;\n};\n\nconst handleNo = () => {\n if (resolvePromise) resolvePromise(false);\n\n isOpen.value = false;\n};\n\nconst handleOverlayClick = () => {\n if (isPersistent.value) return;\n\n handleNo();\n};\n\ndefineExpose({\n confirmDialog,\n});\n</script>\n\n<style scoped>\n.custom-dialog-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 2400;\n}\n\n.dialog-fade-enter-active,\n.dialog-fade-leave-active {\n transition: opacity 0.2s ease;\n}\n\n.dialog-fade-enter-from,\n.dialog-fade-leave-to {\n opacity: 0;\n}\n\n.dialog-fade-enter-active .v-card,\n.dialog-fade-leave-active .v-card {\n transition: transform 0.2s ease;\n}\n\n.dialog-fade-enter-from .v-card {\n transform: scale(0.9);\n}\n\n.dialog-fade-leave-to .v-card {\n transform: scale(0.9);\n}\n</style>\n"],"names":["isOpen","ref","currentTitle","currentMessage","isPersistent","confirmText","cancelText","confirmColor","cancelColor","resolvePromise","confirmDialog","title","message","options","resolve","onMounted","useConfirmStore","onUnmounted","handleYes","handleNo","handleOverlayClick","__expose","_createBlock","_Teleport","_createVNode","_Transition","_createElementBlock","_component_v_card","_component_v_card_title","_component_v_icon","_cache","_createElementVNode","_hoisted_1","_toDisplayString","_component_v_card_text","_component_v_card_actions","_component_v_btn"],"mappings":";;;;;;AAqCA,UAAMA,IAASC,EAAI,EAAK,GAClBC,IAAeD,EAAI,EAAE,GACrBE,IAAiBF,EAAI,EAAE,GACvBG,IAAeH,EAAI,EAAI,GACvBI,IAAcJ,EAAI,EAAE,GACpBK,IAAaL,EAAI,EAAE,GACnBM,IAAeN,EAAI,SAAS,GAC5BO,IAAcP,EAAI,WAAW;AACnC,QAAIQ,IAAoD;AAExD,UAAMC,IAAgB,CAACC,GAAeC,GAAiBC,OACrDX,EAAa,QAAQS,GACrBR,EAAe,QAAQS,GACvB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,sBAAA;mCAAK,MAAe,CAAA,GAAAC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,4BAAf,mBAAe,EAAA;AAAA,wBAAA;;;sBACjDC,EAAkE,QAAlEC,GAAkEC,EAAtB/B,EAAA,KAAY,GAAA,CAAA;AAAA,oBAAA;;;kBAGvCC,EAAA,cAAnBmB,EAEcY,GAAA;AAAA;oBAFqB,OAAM;AAAA,kBAAA;+BACvC,MAAoB;AAAA,0BAAjB/B,EAAA,KAAc,GAAA,CAAA;AAAA,oBAAA;;;kBAGnBqB,EAOiBW,GAAA,EAPD,OAAM,4CAAwC;AAAA,+BAC5D,MAEQ;AAAA,sBAFRX,EAEQY,GAAA;AAAA,wBAFA,OAAO5B,EAAA;AAAA,wBAAa,SAAQ;AAAA,wBAAW,OAAM;AAAA,wBAAa,SAAOW;AAAA,sBAAA;mCACvE,MAAgB;AAAA,8BAAbb,EAAA,KAAU,GAAA,CAAA;AAAA,wBAAA;;;sBAEfkB,EAEQY,GAAA;AAAA,wBAFA,OAAO7B,EAAA;AAAA,wBAAc,SAAQ;AAAA,wBAAW,OAAM;AAAA,wBAAa,SAAOW;AAAA,sBAAA;mCACxE,MAAiB;AAAA,8BAAdb,EAAA,KAAW,GAAA,CAAA;AAAA,wBAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineComponent as T, ref as E, computed as a, watch as A, onUnmounted as D, resolveComponent as x, createBlock as B, openBlock as k, Transition as I, withCtx as S, createElementBlock as R, createCommentVNode as V, unref as s, normalizeStyle as p, createVNode as q, createElementVNode as b } from "vue";
|
|
2
|
+
import { useTheme as z } from "vuetify";
|
|
3
|
+
import { u as G } from "../utils/notify-CE_gbk11.js";
|
|
4
|
+
import { N as h } from "../utils/types-DV6li0y5.js";
|
|
5
|
+
import { _ as L } from "./inputs-FzMoneyField-BxAg9Bd_.js";
|
|
6
|
+
const O = 350, H = "#1E1E1E", K = /* @__PURE__ */ T({
|
|
7
|
+
__name: "FzFloatingNotify",
|
|
8
|
+
setup(M) {
|
|
9
|
+
const d = z(), e = G(), v = E(null), n = E(100), F = a(() => d.global.name.value === "dark"), y = {
|
|
10
|
+
success: "#4CAF50",
|
|
11
|
+
error: "#F44336",
|
|
12
|
+
warning: "#FF9800",
|
|
13
|
+
info: "#2196F3"
|
|
14
|
+
}, _ = a(() => {
|
|
15
|
+
try {
|
|
16
|
+
const t = d.global.current.value.colors?.[e.type];
|
|
17
|
+
if (typeof t == "string" && t.startsWith("#")) return t;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
return y[e.type] || y.info;
|
|
21
|
+
}), l = {
|
|
22
|
+
success: "#E8F5E9",
|
|
23
|
+
error: "#FFEBEE",
|
|
24
|
+
warning: "#FFF3E0",
|
|
25
|
+
info: "#E3F2FD"
|
|
26
|
+
}, w = a(() => ({
|
|
27
|
+
backgroundColor: F.value ? H : l[e.type] || l.info,
|
|
28
|
+
borderInlineStart: `4px solid ${_.value}`
|
|
29
|
+
})), C = a(() => F.value ? "rgba(255, 255, 255, 0.05)" : l[e.type] || l.info), N = a(() => _.value);
|
|
30
|
+
function i() {
|
|
31
|
+
if (!e.isVisible) return;
|
|
32
|
+
const r = Date.now() >= g && (v.value?.matches(":hover") ?? !1);
|
|
33
|
+
if (r && !o) {
|
|
34
|
+
o = !0, u += Date.now() - c, e.pause(), requestAnimationFrame(i);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!r && o && (o = !1, c = Date.now(), e.resume()), o) {
|
|
38
|
+
requestAnimationFrame(i);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const t = Date.now() - c, f = u + t, m = h - f;
|
|
42
|
+
if (m <= 0) {
|
|
43
|
+
n.value = 0;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
n.value = m / h * 100, requestAnimationFrame(i);
|
|
47
|
+
}
|
|
48
|
+
let u = 0, c = 0, g = 0, o = !1;
|
|
49
|
+
return A(() => e.isVisible, (r) => {
|
|
50
|
+
if (r) {
|
|
51
|
+
u = 0, c = Date.now(), g = Date.now() + O, o = !1, n.value = 100, requestAnimationFrame(i);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
o = !1, n.value = 100;
|
|
55
|
+
}), D(() => {
|
|
56
|
+
e.cleanup();
|
|
57
|
+
}), (r, t) => {
|
|
58
|
+
const f = x("v-alert");
|
|
59
|
+
return k(), B(I, { name: "slide-fade" }, {
|
|
60
|
+
default: S(() => [
|
|
61
|
+
s(e).isVisible ? (k(), R("div", {
|
|
62
|
+
key: 0,
|
|
63
|
+
ref_key: "notificationRef",
|
|
64
|
+
ref: v,
|
|
65
|
+
class: "floating-notify elevation-6",
|
|
66
|
+
style: p(w.value)
|
|
67
|
+
}, [
|
|
68
|
+
q(f, {
|
|
69
|
+
type: s(e).type,
|
|
70
|
+
title: s(e).title,
|
|
71
|
+
text: s(e).message,
|
|
72
|
+
variant: "text",
|
|
73
|
+
closable: "",
|
|
74
|
+
class: "floating-notify-alert",
|
|
75
|
+
"onClick:close": t[0] || (t[0] = (m) => s(e).hide())
|
|
76
|
+
}, null, 8, ["type", "title", "text"]),
|
|
77
|
+
b("div", {
|
|
78
|
+
class: "progress-track",
|
|
79
|
+
style: p({ backgroundColor: C.value })
|
|
80
|
+
}, [
|
|
81
|
+
b("div", {
|
|
82
|
+
class: "progress-fill",
|
|
83
|
+
style: p({ width: n.value + "%", backgroundColor: N.value })
|
|
84
|
+
}, null, 4)
|
|
85
|
+
], 4)
|
|
86
|
+
], 4)) : V("", !0)
|
|
87
|
+
]),
|
|
88
|
+
_: 1
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}), j = /* @__PURE__ */ L(K, [["__scopeId", "data-v-b4d8014f"]]);
|
|
93
|
+
export {
|
|
94
|
+
j as F
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=messages-FzFloatingNotify-BdlkCu5i.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages-FzFloatingNotify-BdlkCu5i.js","sources":["../../../src/components/messages/FzFloatingNotify.vue"],"sourcesContent":["<template>\n <Transition name=\"slide-fade\">\n <div\n v-if=\"store.isVisible\"\n ref=\"notificationRef\"\n class=\"floating-notify elevation-6\"\n :style=\"wrapperStyle\"\n >\n <v-alert\n :type=\"store.type\"\n :title=\"store.title\"\n :text=\"store.message\"\n variant=\"text\"\n closable\n class=\"floating-notify-alert\"\n @click:close=\"store.hide()\"\n />\n\n <div\n class=\"progress-track\"\n :style=\"{ backgroundColor: trackBg }\"\n >\n <div\n class=\"progress-fill\"\n :style=\"{ width: progress + '%', backgroundColor: fillColor }\"\n />\n </div>\n </div>\n </Transition>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, computed, watch, onUnmounted } from 'vue';\nimport { useTheme } from 'vuetify';\nimport { useNotifyStore } from '@/utils/notify';\nimport { NOTIFY_DURATION } from '@/utils/types';\n\nconst theme = useTheme();\nconst store = useNotifyStore();\n\nconst notificationRef = ref<HTMLElement | null>(null);\nconst progress = ref(100);\nconst ENTER_TRANSITION_MS = 350;\n\nconst isDark = computed(() => theme.global.name.value === 'dark');\n\nconst FALLBACK: Record<string, string> = {\n success: '#4CAF50', error: '#F44336', warning: '#FF9800', info: '#2196F3',\n};\n\nconst themeTypeColor = computed(() => {\n try {\n const colors = theme.global.current.value.colors;\n const hex = colors?.[store.type];\n\n if (typeof hex === 'string' && hex.startsWith('#')) return hex;\n } catch {\n // theme not accessible\n }\n\n return FALLBACK[store.type] || FALLBACK.info;\n});\n\nconst LIGHT_BG: Record<string, string> = {\n success: '#E8F5E9', error: '#FFEBEE', warning: '#FFF3E0', info: '#E3F2FD',\n};\nconst DARK_BG = '#1E1E1E';\n\nconst wrapperStyle = computed(() => ({\n backgroundColor: isDark.value ? DARK_BG : LIGHT_BG[store.type] || LIGHT_BG.info,\n borderInlineStart: `4px solid ${themeTypeColor.value}`,\n}));\n\nconst trackBg = computed(() => {\n if (isDark.value) return 'rgba(255, 255, 255, 0.05)';\n\n return LIGHT_BG[store.type] || LIGHT_BG.info;\n});\n\nconst fillColor = computed(() => themeTypeColor.value);\n\nfunction updateProgress() {\n if (!store.isVisible) return;\n\n const hovered = Date.now() >= enterTransitionEndTime && (notificationRef.value?.matches(':hover') ?? false);\n\n if (hovered && !isHovered) {\n isHovered = true;\n totalElapsedMs += Date.now() - intervalStartTime;\n\n store.pause();\n\n requestAnimationFrame(updateProgress);\n\n return;\n }\n\n if (!hovered && isHovered) {\n isHovered = false;\n intervalStartTime = Date.now();\n\n store.resume();\n }\n\n if (isHovered) {\n requestAnimationFrame(updateProgress);\n\n return;\n }\n\n const elapsed = Date.now() - intervalStartTime;\n const totalElapsed = totalElapsedMs + elapsed;\n const remaining = NOTIFY_DURATION - totalElapsed;\n\n if (remaining <= 0) {\n progress.value = 0;\n\n return;\n }\n\n progress.value = (remaining / NOTIFY_DURATION) * 100;\n\n requestAnimationFrame(updateProgress);\n}\n\nlet totalElapsedMs = 0;\nlet intervalStartTime = 0;\nlet enterTransitionEndTime = 0;\nlet isHovered = false;\n\nwatch(() => store.isVisible, (visible) => {\n if (visible) {\n totalElapsedMs = 0;\n intervalStartTime = Date.now();\n enterTransitionEndTime = Date.now() + ENTER_TRANSITION_MS;\n isHovered = false;\n progress.value = 100;\n\n requestAnimationFrame(updateProgress);\n\n return;\n }\n\n isHovered = false;\n progress.value = 100;\n});\n\nonUnmounted(() => {\n store.cleanup();\n});\n</script>\n\n<style scoped>\n.floating-notify {\n position: fixed;\n top: 20px;\n right: 20px;\n min-width: 300px;\n max-width: 500px;\n z-index: 9999;\n border-radius: 4px;\n overflow: hidden;\n}\n\n.floating-notify :deep(.v-alert--border) {\n border-inline-start-width: 0;\n}\n\n.progress-track {\n height: 3px;\n}\n\n.progress-fill {\n height: 100%;\n transition: width 100ms linear;\n}\n\n.slide-fade-enter-active {\n transition: all 0.3s ease-out;\n}\n\n.slide-fade-leave-active {\n transition: all 0.3s ease-in;\n}\n\n.slide-fade-enter-from {\n transform: translateX(100%);\n opacity: 0;\n}\n\n.slide-fade-leave-to {\n transform: translateX(100%);\n opacity: 0;\n}\n</style>\n"],"names":["ENTER_TRANSITION_MS","DARK_BG","theme","useTheme","store","useNotifyStore","notificationRef","ref","progress","isDark","computed","FALLBACK","themeTypeColor","hex","LIGHT_BG","wrapperStyle","trackBg","fillColor","updateProgress","hovered","enterTransitionEndTime","isHovered","totalElapsedMs","intervalStartTime","elapsed","totalElapsed","remaining","NOTIFY_DURATION","watch","visible","onUnmounted","_createBlock","_Transition","_unref","_createElementBlock","_createVNode","_component_v_alert","_cache","$event","_createElementVNode","_normalizeStyle"],"mappings":";;;;;AA0CA,MAAMA,IAAsB,KAwBtBC,IAAU;;;AA7BhB,UAAMC,IAAQC,EAAA,GACRC,IAAQC,EAAA,GAERC,IAAkBC,EAAwB,IAAI,GAC9CC,IAAWD,EAAI,GAAG,GAGlBE,IAASC,EAAS,MAAMR,EAAM,OAAO,KAAK,UAAU,MAAM,GAE1DS,IAAmC;AAAA,MACvC,SAAS;AAAA,MAAW,OAAO;AAAA,MAAW,SAAS;AAAA,MAAW,MAAM;AAAA,IAAA,GAG5DC,IAAiBF,EAAS,MAAM;AACpC,UAAI;AAEF,cAAMG,IADSX,EAAM,OAAO,QAAQ,MAAM,SACrBE,EAAM,IAAI;AAE/B,YAAI,OAAOS,KAAQ,YAAYA,EAAI,WAAW,GAAG,EAAG,QAAOA;AAAA,MAC7D,QAAQ;AAAA,MAER;AAEA,aAAOF,EAASP,EAAM,IAAI,KAAKO,EAAS;AAAA,IAC1C,CAAC,GAEKG,IAAmC;AAAA,MACvC,SAAS;AAAA,MAAW,OAAO;AAAA,MAAW,SAAS;AAAA,MAAW,MAAM;AAAA,IAAA,GAI5DC,IAAeL,EAAS,OAAO;AAAA,MACnC,iBAAiBD,EAAO,QAAQR,IAAUa,EAASV,EAAM,IAAI,KAAKU,EAAS;AAAA,MAC3E,m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A,EA3BD,MAAK,gBAAY;AAAA,mBAC3B,MAyBM;AAAA,UAxBEC,EAAA7B,CAAA,EAAM,kBADd8B,EAyBM,OAAA;AAAA;qBAvBA;AAAA,YAAJ,KAAI5B;AAAA,YACJ,OAAM;AAAA,YACL,SAAOS,EAAA,KAAY;AAAA,UAAA;YAEpBoB,EAQEC,GAAA;AAAA,cAPC,MAAMH,EAAA7B,CAAA,EAAM;AAAA,cACZ,OAAO6B,EAAA7B,CAAA,EAAM;AAAA,cACb,MAAM6B,EAAA7B,CAAA,EAAM;AAAA,cACb,SAAQ;AAAA,cACR,UAAA;AAAA,cACA,OAAM;AAAA,cACL,iBAAWiC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEL,EAAA7B,CAAA,EAAM,KAAA;AAAA,YAAI;YAG1BmC,EAQM,OAAA;AAAA,cAPJ,OAAM;AAAA,cACL,4BAA0BvB,EAAA,OAAO;AAAA,YAAA;cAElCuB,EAGE,OAAA;AAAA,gBAFA,OAAM;AAAA,gBACL,OAAKC,EAAA,EAAA,OAAWhC,EAAA,QAAQ,KAAA,iBAAyBS,EAAA,MAAA,CAAS;AAAA,cAAA;;;;;;;;;"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { defineComponent as F, computed as f, resolveComponent as a, createBlock as s, openBlock as c, withCtx as r, createVNode as d, createCommentVNode as y, createElementVNode as z, createTextVNode as p, toDisplayString as u, renderSlot as P, createElementBlock as M, Fragment as O, renderList as S } from "vue";
|
|
2
|
+
import { useTheme as W } from "vuetify";
|
|
3
|
+
import { _ as L } from "./inputs-FzMoneyField-BxAg9Bd_.js";
|
|
4
|
+
const R = /* @__PURE__ */ F({
|
|
5
|
+
__name: "FzModalBase",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { type: Boolean },
|
|
8
|
+
title: { default: void 0 },
|
|
9
|
+
message: { default: "" },
|
|
10
|
+
maxWidth: { default: 500 },
|
|
11
|
+
persistent: { type: Boolean, default: !0 },
|
|
12
|
+
actions: { default: () => [] },
|
|
13
|
+
contentClass: { default: void 0 },
|
|
14
|
+
fullscreen: { type: Boolean, default: !1 },
|
|
15
|
+
titleIcon: { default: void 0 }
|
|
16
|
+
},
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(t, { emit: g }) {
|
|
19
|
+
const n = t, x = g, h = W(), v = f({
|
|
20
|
+
get: () => n.modelValue,
|
|
21
|
+
set: (e) => x("update:modelValue", e)
|
|
22
|
+
}), _ = f(() => `v-theme--${h.global.name.value}`), C = f(() => n.contentClass ? `${_.value} ${n.contentClass}` : _.value);
|
|
23
|
+
function V() {
|
|
24
|
+
return n.actions.find((e) => e.color === "secondary" || e.color === "error");
|
|
25
|
+
}
|
|
26
|
+
function k() {
|
|
27
|
+
return n.actions.find(
|
|
28
|
+
(e) => e.color === "primary" || !e.color && n.actions.indexOf(e) === n.actions.length - 1
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function B(e) {
|
|
32
|
+
return e.tagName === "TEXTAREA";
|
|
33
|
+
}
|
|
34
|
+
function A(e) {
|
|
35
|
+
return !e || e === "primary" ? "elevated" : e === "secondary" || e === "error" ? "outlined" : "text";
|
|
36
|
+
}
|
|
37
|
+
async function m(e) {
|
|
38
|
+
e.handler && await e.handler();
|
|
39
|
+
}
|
|
40
|
+
function E(e) {
|
|
41
|
+
if (n.actions.length !== 0) {
|
|
42
|
+
if (e.key === "Escape") {
|
|
43
|
+
const l = V();
|
|
44
|
+
if (!l) return;
|
|
45
|
+
e.preventDefault(), e.stopPropagation(), m(l);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && !e.altKey) {
|
|
49
|
+
const l = e.target;
|
|
50
|
+
if (B(l)) return;
|
|
51
|
+
const i = k();
|
|
52
|
+
if (!i) return;
|
|
53
|
+
e.preventDefault(), e.stopPropagation(), m(i);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return (e, l) => {
|
|
58
|
+
const i = a("v-icon"), w = a("v-card-title"), b = a("v-card-text"), D = a("v-spacer"), I = a("v-btn"), K = a("v-card-actions"), N = a("v-card"), T = a("v-dialog");
|
|
59
|
+
return c(), s(T, {
|
|
60
|
+
modelValue: v.value,
|
|
61
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => v.value = o),
|
|
62
|
+
"max-width": t.maxWidth,
|
|
63
|
+
persistent: t.persistent,
|
|
64
|
+
"content-class": C.value,
|
|
65
|
+
fullscreen: t.fullscreen,
|
|
66
|
+
scrollable: "",
|
|
67
|
+
"z-index": 2400,
|
|
68
|
+
onKeydown: E
|
|
69
|
+
}, {
|
|
70
|
+
default: r(() => [
|
|
71
|
+
d(N, null, {
|
|
72
|
+
default: r(() => [
|
|
73
|
+
t.title ? (c(), s(w, {
|
|
74
|
+
key: 0,
|
|
75
|
+
class: "text-h5 d-flex align-center px-6 pt-6 modal-title"
|
|
76
|
+
}, {
|
|
77
|
+
default: r(() => [
|
|
78
|
+
t.titleIcon ? (c(), s(i, {
|
|
79
|
+
key: 0,
|
|
80
|
+
class: "mr-2"
|
|
81
|
+
}, {
|
|
82
|
+
default: r(() => [
|
|
83
|
+
p(u(t.titleIcon), 1)
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
})) : y("", !0),
|
|
87
|
+
z("span", null, u(t.title), 1)
|
|
88
|
+
]),
|
|
89
|
+
_: 1
|
|
90
|
+
})) : y("", !0),
|
|
91
|
+
d(b, { class: "px-6 pt-4" }, {
|
|
92
|
+
default: r(() => [
|
|
93
|
+
P(e.$slots, "default", {}, () => [
|
|
94
|
+
p(u(t.message), 1)
|
|
95
|
+
], !0)
|
|
96
|
+
]),
|
|
97
|
+
_: 3
|
|
98
|
+
}),
|
|
99
|
+
d(K, null, {
|
|
100
|
+
default: r(() => [
|
|
101
|
+
d(D),
|
|
102
|
+
(c(!0), M(O, null, S(t.actions, (o, $) => (c(), s(I, {
|
|
103
|
+
key: $,
|
|
104
|
+
color: o.color || "primary",
|
|
105
|
+
"prepend-icon": o.icon,
|
|
106
|
+
variant: o.variant || A(o.color),
|
|
107
|
+
type: "button",
|
|
108
|
+
class: "text-none",
|
|
109
|
+
onClick: (U) => m(o)
|
|
110
|
+
}, {
|
|
111
|
+
default: r(() => [
|
|
112
|
+
p(u(o.text), 1)
|
|
113
|
+
]),
|
|
114
|
+
_: 2
|
|
115
|
+
}, 1032, ["color", "prepend-icon", "variant", "onClick"]))), 128))
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
})
|
|
119
|
+
]),
|
|
120
|
+
_: 3
|
|
121
|
+
})
|
|
122
|
+
]),
|
|
123
|
+
_: 3
|
|
124
|
+
}, 8, ["modelValue", "max-width", "persistent", "content-class", "fullscreen"]);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}), G = /* @__PURE__ */ L(R, [["__scopeId", "data-v-e2905dad"]]);
|
|
128
|
+
export {
|
|
129
|
+
G as F
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=modals-FzModalBase-C4wU9yAp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modals-FzModalBase-C4wU9yAp.js","sources":["../../../src/components/modals/FzModalBase.vue"],"sourcesContent":["<template>\n <v-dialog\n v-model=\"isOpen\"\n :max-width=\"maxWidth\"\n :persistent=\"persistent\"\n :content-class=\"dialogContentClass\"\n :fullscreen=\"fullscreen\"\n scrollable\n :z-index=\"2400\"\n @keydown=\"onDialogKeydown\"\n >\n <v-card>\n <v-card-title\n v-if=\"title\"\n class=\"text-h5 d-flex align-center px-6 pt-6 modal-title\"\n >\n <v-icon v-if=\"titleIcon\" class=\"mr-2\">{{ titleIcon }}</v-icon>\n <span>{{ title }}</span>\n </v-card-title>\n\n <v-card-text class=\"px-6 pt-4\">\n <slot>\n {{ message }}\n </slot>\n </v-card-text>\n\n <v-card-actions>\n <v-spacer />\n <v-btn\n v-for=\"(action, index) in actions\"\n :key=\"index\"\n :color=\"action.color || 'primary'\"\n :prepend-icon=\"action.icon\"\n :variant=\"action.variant || getDefaultVariant(action.color)\"\n type=\"button\"\n class=\"text-none\"\n @click=\"handleAction(action)\"\n >\n {{ action.text }}\n </v-btn>\n </v-card-actions>\n </v-card>\n </v-dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { useTheme } from 'vuetify';\n\nexport interface ModalAction {\n text: string;\n icon?: string;\n color?: string;\n variant?: 'text' | 'flat' | 'elevated' | 'tonal' | 'outlined' | 'plain';\n handler?: () => void | Promise<void>;\n}\n\ninterface Props {\n modelValue: boolean;\n title?: string;\n message?: string;\n maxWidth?: string | number;\n persistent?: boolean;\n actions?: ModalAction[];\n contentClass?: string;\n fullscreen?: boolean;\n titleIcon?: string;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n title: undefined,\n message: '',\n maxWidth: 500,\n persistent: true,\n actions: () => [],\n contentClass: undefined,\n fullscreen: false,\n titleIcon: undefined,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: boolean];\n}>();\n\nconst theme = useTheme();\n\nconst isOpen = computed({\n get: () => props.modelValue,\n set: (val) => emit('update:modelValue', val),\n});\n\nconst dialogThemeClass = computed(() => `v-theme--${theme.global.name.value}`);\n\nconst dialogContentClass = computed(() => {\n if (!props.contentClass) return dialogThemeClass.value;\n\n return `${dialogThemeClass.value} ${props.contentClass}`;\n});\n\nfunction findCancelAction(): ModalAction | undefined {\n return props.actions.find((a) => a.color === 'secondary' || a.color === 'error');\n}\n\nfunction findPrimaryAction(): ModalAction | undefined {\n return props.actions.find(\n (a) => a.color === 'primary' || (!a.color && props.actions.indexOf(a) === props.actions.length - 1),\n );\n}\n\nfunction isInteractiveElement(target: HTMLElement): boolean {\n return target.tagName === 'TEXTAREA';\n}\n\nfunction getDefaultVariant(color?: string): 'elevated' | 'outlined' | 'text' {\n if (!color || color === 'primary') return 'elevated';\n\n if (color === 'secondary' || color === 'error') return 'outlined';\n\n return 'text';\n}\n\nasync function handleAction(action: ModalAction): Promise<void> {\n if (!action.handler) return;\n\n await action.handler();\n}\n\nfunction onDialogKeydown(e: KeyboardEvent): void {\n if (props.actions.length === 0) return;\n\n if (e.key === 'Escape') {\n const cancelAction = findCancelAction();\n\n if (!cancelAction) return;\n\n e.preventDefault();\n e.stopPropagation();\n handleAction(cancelAction);\n\n return;\n }\n\n if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.altKey) {\n const target = e.target as HTMLElement;\n\n if (isInteractiveElement(target)) return;\n\n const primaryAction = findPrimaryAction();\n\n if (!primaryAction) return;\n\n e.preventDefault();\n e.stopPropagation();\n handleAction(primaryAction);\n }\n}\n\n</script>\n\n<style scoped>\n.modal-title {\n word-break: break-word;\n white-space: normal;\n}\n</style>\n\n<!-- Vuetify renders overlays as siblings at root; adjust z-index so v-select/v-menu popups inside this dialog appear above the dialog overlay -->\n<style>\n.v-overlay-container .v-menu > .v-overlay__content,\n.v-overlay-container .v-select__content,\n.v-overlay-container .v-autocomplete__content {\n z-index: 2500;\n}\n</style>\n"],"names":["props","__props","emit","__emit","theme","useTheme","isOpen","computed","val","dialogThemeClass","dialogContentClass","findCancelAction","a","findPrimaryAction","isInteractiveElement","target","getDefaultVariant","color","handleAction","action","onDialogKeydown","cancelAction","primaryAction","_createBlock","_component_v_dialog","$event","_createVNode","_component_v_card","_component_v_card_title","_component_v_icon","_createElementVNode","_component_v_card_text","_renderSlot","_ctx","_component_v_card_actions","_component_v_spacer","_openBlock","_createElementBlock","_Fragment","_renderList","index","_component_v_btn","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,UAAMA,IAAQC,GAWRC,IAAOC,GAIPC,IAAQC,EAAA,GAERC,IAASC,EAAS;AAAA,MACtB,KAAK,MAAMP,EAAM;AAAA,MACjB,KAAK,CAACQ,MAAQN,EAAK,qBAAqBM,CAAG;AAAA,IAAA,CAC5C,GAEKC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AAduB,EAAAC,EAAAxB,EAAO,IAAI,GAAA,CAAA;AAAA,oBAAA;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { computed as s } from "vue";
|
|
2
|
+
import { useDisplay as i } from "vuetify";
|
|
3
|
+
function u() {
|
|
4
|
+
const o = i(), e = s(() => o.xs.value), t = s(() => o.smAndDown.value);
|
|
5
|
+
return {
|
|
6
|
+
isMobile: e,
|
|
7
|
+
isMobileOrTablet: t
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
u
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useBreakpoint-DnFIVluv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreakpoint-DnFIVluv.js","sources":["../../../src/composables/useBreakpoint.ts"],"sourcesContent":["import { computed } from 'vue';\nimport { useDisplay } from 'vuetify';\n\nexport function useBreakpoint() {\n const display = useDisplay();\n\n const isMobile = computed(() => display.xs.value);\n const isMobileOrTablet = computed(() => display.smAndDown.value);\n\n return {\n isMobile,\n isMobileOrTablet,\n };\n}\n"],"names":["useBreakpoint","display","useDisplay","isMobile","computed","isMobileOrTablet"],"mappings":";;AAGO,SAASA,IAAgB;AAC9B,QAAMC,IAAUC,EAAA,GAEVC,IAAWC,EAAS,MAAMH,EAAQ,GAAG,KAAK,GAC1CI,IAAmBD,EAAS,MAAMH,EAAQ,UAAU,KAAK;AAE/D,SAAO;AAAA,IACL,UAAAE;AAAA,IACA,kBAAAE;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getCurrentInstance as i } from "vue";
|
|
2
|
+
function s() {
|
|
3
|
+
const o = i();
|
|
4
|
+
if (!o) throw new Error("useGlobals must be called within setup()");
|
|
5
|
+
const n = o.appContext.config.globalProperties.$notify, t = o.appContext.config.globalProperties.$loading, e = o.appContext.config.globalProperties.$confirm;
|
|
6
|
+
return {
|
|
7
|
+
notify: n,
|
|
8
|
+
loading: t,
|
|
9
|
+
confirm: e
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
s as u
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useGlobals-AagqYKoP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGlobals-AagqYKoP.js","sources":["../../../src/composables/useGlobals.ts"],"sourcesContent":["import { getCurrentInstance } from 'vue';\nimport type { notify as notifyFn } from '../utils/notify';\nimport type { loading as loadingFn } from '../utils/loading';\nimport type { confirm as confirmFn } from '../utils/confirm';\n\nexport function useGlobals() {\n const instance = getCurrentInstance();\n\n if (!instance) throw new Error('useGlobals must be called within setup()');\n\n const $notify = instance.appContext.config.globalProperties.$notify;\n const $loading = instance.appContext.config.globalProperties.$loading;\n const $confirm = instance.appContext.config.globalProperties.$confirm;\n\n return {\n notify: $notify as typeof notifyFn,\n loading: $loading as typeof loadingFn,\n confirm: $confirm as typeof confirmFn,\n };\n}\n"],"names":["useGlobals","instance","getCurrentInstance","$notify","$loading","$confirm"],"mappings":";AAKO,SAASA,IAAa;AAC3B,QAAMC,IAAWC,EAAA;AAEjB,MAAI,CAACD,EAAU,OAAM,IAAI,MAAM,0CAA0C;AAEzE,QAAME,IAAUF,EAAS,WAAW,OAAO,iBAAiB,SACtDG,IAAWH,EAAS,WAAW,OAAO,iBAAiB,UACvDI,IAAWJ,EAAS,WAAW,OAAO,iBAAiB;AAE7D,SAAO;AAAA,IACL,QAAQE;AAAA,IACR,SAASC;AAAA,IACT,SAASC;AAAA,EAAA;AAEb;"}
|