@merkaly/nuxt 0.9.2 → 0.9.4
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/module.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onBeforeMount, ref } from "vue";
|
|
3
|
+
import { useI18n } from "vue-i18n";
|
|
3
4
|
import FormatIcon from "../format/FormatIcon.vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
disabled: { type: Boolean, default: false },
|
|
6
7
|
preset: { type: String, default: () => "today" }
|
|
7
8
|
});
|
|
8
9
|
const model = defineModel({ type: Object });
|
|
10
|
+
const { locale, t } = useI18n({ useScope: "local" });
|
|
9
11
|
const presets = [
|
|
10
|
-
{ key: "today",
|
|
11
|
-
{ key: "yesterday",
|
|
12
|
-
{ key: "last7days",
|
|
13
|
-
{ key: "last30days",
|
|
14
|
-
{ key: "thisMonth",
|
|
15
|
-
{ key: "lastMonth",
|
|
12
|
+
{ key: "today", icon: "calendar-day" },
|
|
13
|
+
{ key: "yesterday", icon: "calendar-minus" },
|
|
14
|
+
{ key: "last7days", icon: "calendar-week" },
|
|
15
|
+
{ key: "last30days", icon: "calendar" },
|
|
16
|
+
{ key: "thisMonth", icon: "calendar-check" },
|
|
17
|
+
{ key: "lastMonth", icon: "calendar-xmark" }
|
|
16
18
|
];
|
|
17
19
|
const selectedPreset = ref(model.value?.preset || props.preset);
|
|
18
20
|
const getDateRange = (key) => {
|
|
@@ -50,16 +52,17 @@ const getDateRange = (key) => {
|
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
54
|
const currentPresetLabel = computed(() => {
|
|
53
|
-
|
|
55
|
+
const preset = presets.find((p) => p.key === selectedPreset.value);
|
|
56
|
+
return preset ? t(preset.key) : t("select");
|
|
54
57
|
});
|
|
55
58
|
const formatDateRange = computed(() => {
|
|
56
59
|
const range = getDateRange(selectedPreset.value);
|
|
57
60
|
const options = { day: "numeric", month: "short" };
|
|
58
61
|
if (range.start.getTime() === range.end.getTime()) {
|
|
59
|
-
return range.start.toLocaleDateString(
|
|
62
|
+
return range.start.toLocaleDateString(locale.value, { ...options, year: "numeric" });
|
|
60
63
|
}
|
|
61
|
-
const startStr = range.start.toLocaleDateString(
|
|
62
|
-
const endStr = range.end.toLocaleDateString(
|
|
64
|
+
const startStr = range.start.toLocaleDateString(locale.value, options);
|
|
65
|
+
const endStr = range.end.toLocaleDateString(locale.value, { ...options, year: "numeric" });
|
|
63
66
|
return `${startStr} - ${endStr}`;
|
|
64
67
|
});
|
|
65
68
|
const selectPreset = (preset) => {
|
|
@@ -78,14 +81,14 @@ onBeforeMount(() => selectPreset(props.preset));
|
|
|
78
81
|
</template>
|
|
79
82
|
|
|
80
83
|
<div class="px-3 py-2 border-bottom">
|
|
81
|
-
<span class="fs-7 fw-bold text-gray-800"
|
|
84
|
+
<span class="fs-7 fw-bold text-gray-800" v-text="t('title')" />
|
|
82
85
|
</div>
|
|
83
86
|
|
|
84
87
|
<template v-for="item in presets" :key="item.key">
|
|
85
88
|
<BDropdownItem :active="selectedPreset === item.key" @click="selectPreset(item.key)">
|
|
86
89
|
<div class="d-flex align-items-center gap-2">
|
|
87
90
|
<FormatIcon :name="item.icon" class="text-gray-500" />
|
|
88
|
-
<span v-text="item.
|
|
91
|
+
<span v-text="t(item.key)" />
|
|
89
92
|
</div>
|
|
90
93
|
</BDropdownItem>
|
|
91
94
|
</template>
|
|
@@ -95,8 +98,35 @@ onBeforeMount(() => selectPreset(props.preset));
|
|
|
95
98
|
<BDropdownItem disabled>
|
|
96
99
|
<div class="d-flex align-items-center gap-2 text-muted">
|
|
97
100
|
<FormatIcon name="calendar-plus" />
|
|
98
|
-
<span
|
|
101
|
+
<span v-text="t('custom')" />
|
|
99
102
|
</div>
|
|
100
103
|
</BDropdownItem>
|
|
101
104
|
</BDropdown>
|
|
102
105
|
</template>
|
|
106
|
+
|
|
107
|
+
<i18n lang="json">
|
|
108
|
+
{
|
|
109
|
+
"en": {
|
|
110
|
+
"title": "Date range",
|
|
111
|
+
"select": "Select",
|
|
112
|
+
"today": "Today",
|
|
113
|
+
"yesterday": "Yesterday",
|
|
114
|
+
"last7days": "Last 7 days",
|
|
115
|
+
"last30days": "Last 30 days",
|
|
116
|
+
"thisMonth": "This month",
|
|
117
|
+
"lastMonth": "Last month",
|
|
118
|
+
"custom": "Custom range (coming soon)"
|
|
119
|
+
},
|
|
120
|
+
"pt": {
|
|
121
|
+
"title": "Período",
|
|
122
|
+
"select": "Selecionar",
|
|
123
|
+
"today": "Hoje",
|
|
124
|
+
"yesterday": "Ontem",
|
|
125
|
+
"last7days": "Últimos 7 dias",
|
|
126
|
+
"last30days": "Últimos 30 dias",
|
|
127
|
+
"thisMonth": "Este mês",
|
|
128
|
+
"lastMonth": "Mês passado",
|
|
129
|
+
"custom": "Período personalizado (em breve)"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</i18n>
|
|
@@ -3,9 +3,13 @@ import type { Auth0Client, User } from '@auth0/auth0-spa-js';
|
|
|
3
3
|
import type { ApiOptions } from '../plugins/api.global';
|
|
4
4
|
import type { AuthErrorContext } from '../composables/useAuth';
|
|
5
5
|
|
|
6
|
+
type MerkalyAuth0Client = Auth0Client & {
|
|
7
|
+
linkWithConnection: (connection: string) => Promise<unknown>; // added by the auth0 plugin
|
|
8
|
+
};
|
|
9
|
+
|
|
6
10
|
declare module '#app' {
|
|
7
11
|
interface NuxtApp {
|
|
8
|
-
$auth0:
|
|
12
|
+
$auth0: MerkalyAuth0Client;
|
|
9
13
|
$api: <T = unknown>(url: string, options?: ApiOptions) => Promise<T>;
|
|
10
14
|
$gmap: never;
|
|
11
15
|
}
|
|
@@ -20,7 +24,7 @@ declare module '#app' {
|
|
|
20
24
|
|
|
21
25
|
declare module 'vue' {
|
|
22
26
|
interface ComponentCustomProperties {
|
|
23
|
-
$auth0:
|
|
27
|
+
$auth0: MerkalyAuth0Client;
|
|
24
28
|
$api: <T = unknown>(url: string, options?: ApiOptions) => Promise<T>;
|
|
25
29
|
$gmap: never;
|
|
26
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/merkaly-io/nuxt.git"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"filesize": "^11.0.17",
|
|
55
55
|
"gsap": "^3.15.0",
|
|
56
56
|
"notivue": "^2.4.5",
|
|
57
|
-
"nuxt": "^4.6.
|
|
57
|
+
"nuxt": "^4.6.3",
|
|
58
58
|
"reflect-metadata": "^0.2.2",
|
|
59
59
|
"sass": "^1.106.1",
|
|
60
60
|
"typescript": "~5.9.3",
|