@merkaly/nuxt 0.9.2 → 0.9.3
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
|
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
}>, {
|
|
82
82
|
mode: PlaceTypes;
|
|
83
83
|
disabled: boolean;
|
|
84
|
-
placeholder: string;
|
|
85
84
|
countries: string[];
|
|
85
|
+
placeholder: string;
|
|
86
86
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
87
|
declare const _default: typeof __VLS_export;
|
|
88
88
|
export default _default;
|
|
@@ -81,8 +81,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
}>, {
|
|
82
82
|
mode: PlaceTypes;
|
|
83
83
|
disabled: boolean;
|
|
84
|
-
placeholder: string;
|
|
85
84
|
countries: string[];
|
|
85
|
+
placeholder: string;
|
|
86
86
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
87
87
|
declare const _default: typeof __VLS_export;
|
|
88
88
|
export default _default;
|
|
@@ -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>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
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",
|