@merkaly/nuxt 0.7.3 → 0.7.5
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 +1 -1
- package/dist/runtime/components/input/InputAddress.d.vue.ts +1 -1
- package/dist/runtime/components/input/InputAddress.vue.d.ts +1 -1
- package/dist/runtime/components/input/InputSelect.d.vue.ts +2 -0
- package/dist/runtime/components/input/InputSelect.vue +6 -4
- package/dist/runtime/components/input/InputSelect.vue.d.ts +2 -0
- package/dist/runtime/components/table/TableDatagrid.d.vue.ts +1 -1
- package/dist/runtime/components/table/TableDatagrid.vue +21 -4
- package/dist/runtime/components/table/TableDatagrid.vue.d.ts +1 -1
- package/dist/runtime/composables/useValidator.js +9 -6
- package/dist/runtime/utils/formatMoney.d.ts +12 -0
- package/dist/runtime/utils/formatMoney.js +3 -1
- package/package.json +2 -2
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;
|
|
@@ -83,6 +83,8 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
83
83
|
text: string;
|
|
84
84
|
selectedOption: boolean;
|
|
85
85
|
}) => any;
|
|
86
|
+
} & {
|
|
87
|
+
'no-options'?: (props: any) => any;
|
|
86
88
|
};
|
|
87
89
|
emit: ((e: "request:selected" | "search", v: string) => unknown) & ((event: "update:modelValue", value: any) => void);
|
|
88
90
|
}>) => import("vue").VNode & {
|
|
@@ -120,10 +120,12 @@ const isRequired = computed(() => {
|
|
|
120
120
|
<BSpinner v-if="isLoading" class="spinner" variant="primary" />
|
|
121
121
|
</template>
|
|
122
122
|
|
|
123
|
-
<template #no-options="
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
<template #no-options="scope">
|
|
124
|
+
<slot name="no-options" v-bind="scope">
|
|
125
|
+
<span v-if="scope.loading">Searching for "{{ scope.search }}"</span>
|
|
126
|
+
<span v-else-if="scope.searching">No results for "{{ scope.search }}"</span>
|
|
127
|
+
<span v-else>Type to search</span>
|
|
128
|
+
</slot>
|
|
127
129
|
</template>
|
|
128
130
|
|
|
129
131
|
<template #open-indicator="{ attributes }">
|
|
@@ -83,6 +83,8 @@ declare const __VLS_export: <T extends Record<string, any>>(__VLS_props: NonNull
|
|
|
83
83
|
text: string;
|
|
84
84
|
selectedOption: boolean;
|
|
85
85
|
}) => any;
|
|
86
|
+
} & {
|
|
87
|
+
'no-options'?: (props: any) => any;
|
|
86
88
|
};
|
|
87
89
|
emit: ((e: "request:selected" | "search", v: string) => unknown) & ((event: "update:modelValue", value: any) => void);
|
|
88
90
|
}>) => import("vue").VNode & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { sentenceCase } from "change-case";
|
|
3
3
|
import { computed, getCurrentInstance, useSlots } from "vue";
|
|
4
|
+
import { useI18n } from "vue-i18n";
|
|
4
5
|
import DropdownIcon from "../dropdown/DropdownIcon.vue";
|
|
5
6
|
import FormatIcon from "../format/FormatIcon.vue";
|
|
6
7
|
import FormatText from "../format/FormatText.vue";
|
|
@@ -8,13 +9,14 @@ import InputSearch from "../input/InputSearch.vue";
|
|
|
8
9
|
const emit = defineEmits(["fetch", "toggle:item"]);
|
|
9
10
|
const slots = useSlots();
|
|
10
11
|
const props = defineProps({
|
|
11
|
-
emptyText: { type: String, default:
|
|
12
|
+
emptyText: { type: String, default: void 0 },
|
|
12
13
|
hideHeader: { type: Boolean, default: false },
|
|
13
14
|
hideFooter: { type: Boolean, default: false },
|
|
14
15
|
hidePagination: { type: Boolean, default: false },
|
|
15
16
|
hideSelect: { type: Boolean, default: false }
|
|
16
17
|
});
|
|
17
18
|
const $datagrid = defineModel({ type: Object, ...{ type: Object, required: true } });
|
|
19
|
+
const { t } = useI18n({ useScope: "local" });
|
|
18
20
|
const instance = getCurrentInstance();
|
|
19
21
|
const canFetch = Boolean(instance?.vnode?.props?.onFetch);
|
|
20
22
|
const canFilter = Boolean(slots.filters);
|
|
@@ -39,7 +41,7 @@ const paginationText = computed(() => {
|
|
|
39
41
|
}
|
|
40
42
|
const end = Math.min(page * limit, total);
|
|
41
43
|
return {
|
|
42
|
-
template: "
|
|
44
|
+
template: t("pagination"),
|
|
43
45
|
values: {
|
|
44
46
|
current: start,
|
|
45
47
|
final: end,
|
|
@@ -216,7 +218,7 @@ function getRowAttrs(item, idx) {
|
|
|
216
218
|
<BTbody v-if="!visibleItems.length">
|
|
217
219
|
<BTd :colspan="tableColspan">
|
|
218
220
|
<slot name="empty">
|
|
219
|
-
<div class="text-center text-muted" v-text="props.emptyText" />
|
|
221
|
+
<div class="text-center text-muted" v-text="props.emptyText ?? t('empty')" />
|
|
220
222
|
</slot>
|
|
221
223
|
</BTd>
|
|
222
224
|
</BTbody>
|
|
@@ -249,7 +251,7 @@ function getRowAttrs(item, idx) {
|
|
|
249
251
|
</template>
|
|
250
252
|
|
|
251
253
|
<BTd v-if="hasActionsSlot" class="text-end px-3">
|
|
252
|
-
<DropdownIcon icon="caret-down" text="
|
|
254
|
+
<DropdownIcon icon="caret-down" :text="t('actions')" toggle-class="py-1 px-3" variant="light-dark">
|
|
253
255
|
<slot :index="idx" :item="item" name="actions" />
|
|
254
256
|
</DropdownIcon>
|
|
255
257
|
</BTd>
|
|
@@ -327,3 +329,18 @@ thead:before {
|
|
|
327
329
|
background: rgb(var(--bs-primary-rgb), 0.05);
|
|
328
330
|
}
|
|
329
331
|
</style>
|
|
332
|
+
|
|
333
|
+
<i18n lang="json">
|
|
334
|
+
{
|
|
335
|
+
"en": {
|
|
336
|
+
"empty": "No items found",
|
|
337
|
+
"actions": "Actions",
|
|
338
|
+
"pagination": "Showing :current: to :final: of :total: items"
|
|
339
|
+
},
|
|
340
|
+
"pt": {
|
|
341
|
+
"empty": "Nenhum item encontrado",
|
|
342
|
+
"actions": "Ações",
|
|
343
|
+
"pagination": "Mostrando :current: a :final: de :total: itens"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
</i18n>
|
|
@@ -21,14 +21,17 @@ function extractConstraints(constructor) {
|
|
|
21
21
|
return constraints;
|
|
22
22
|
}
|
|
23
23
|
function applyErrors(result, errors, state) {
|
|
24
|
-
|
|
25
|
-
errors[key] = "";
|
|
26
|
-
state[key] = true;
|
|
27
|
-
}
|
|
24
|
+
const failures = /* @__PURE__ */ new Map();
|
|
28
25
|
for (const error of result) {
|
|
29
26
|
const messages = error.constraints ? Object.values(error.constraints) : [];
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
failures.set(error.property, messages[0] || "Invalid");
|
|
28
|
+
}
|
|
29
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(errors), ...failures.keys()]);
|
|
30
|
+
for (const key of keys) {
|
|
31
|
+
const message = failures.get(key) ?? "";
|
|
32
|
+
const isValid = !failures.has(key);
|
|
33
|
+
if (errors[key] !== message) errors[key] = message;
|
|
34
|
+
if (state[key] !== isValid) state[key] = isValid;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
function mergeAttrs(constraints, state) {
|
|
@@ -3,5 +3,17 @@ export interface FormatMoneyOptions {
|
|
|
3
3
|
currency?: string;
|
|
4
4
|
locale?: string;
|
|
5
5
|
mode?: Intl.NumberFormatOptionsStyle;
|
|
6
|
+
notation?: Intl.NumberFormatOptions['notation'];
|
|
7
|
+
maximumFractionDigits?: number;
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Formats a monetary value held as an **integer in the minor unit (cents)**.
|
|
11
|
+
*
|
|
12
|
+
* Across Merkaly money is stored and transported as integer cents ($1.00 -> 100),
|
|
13
|
+
* so this helper divides by `base` (default 100) before formatting. Pass cents in,
|
|
14
|
+
* get a currency string out: `formatMoney(100)` -> `"$1.00"`.
|
|
15
|
+
*
|
|
16
|
+
* For non-currency numbers (counts, units, percentages) use `formatNumber` /
|
|
17
|
+
* `MKFormatNumber` instead — those do NOT divide and would show the raw cents.
|
|
18
|
+
*/
|
|
7
19
|
export declare function formatMoney(value: number, options?: FormatMoneyOptions): string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export function formatMoney(value, options = {}) {
|
|
2
2
|
return (value / (options.base ?? 100)).toLocaleString(options.locale ?? "en-US", {
|
|
3
3
|
style: options.mode ?? "currency",
|
|
4
|
-
currency: options.currency ?? "USD"
|
|
4
|
+
currency: options.currency ?? "USD",
|
|
5
|
+
notation: options.notation,
|
|
6
|
+
maximumFractionDigits: options.maximumFractionDigits
|
|
5
7
|
});
|
|
6
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkaly/nuxt",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/merkaly-io/nuxt.git"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"notivue": "^2.4.5",
|
|
57
57
|
"nuxt": "^4.4.8",
|
|
58
58
|
"reflect-metadata": "^0.2.2",
|
|
59
|
-
"sass": "^1.
|
|
59
|
+
"sass": "^1.101.0",
|
|
60
60
|
"typescript": "~5.9.3",
|
|
61
61
|
"v-money3": "^3.26.1",
|
|
62
62
|
"vite-svg-loader": "^5.1.1",
|