Skip to content

Commit 4cc0bfe

Browse files
committed
v4.24.2
1 parent 01be9e0 commit 4cc0bfe

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@signal24/vue-foundation",
33
"type": "module",
4-
"version": "4.24.1",
4+
"version": "4.24.2",
55
"description": "Common components, directives, and helpers for Vue 3 apps",
66
"module": "./dist/vue-foundation.es.js",
77
"exports": {

src/components/vf-ez-smart-select.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<template>
2-
<VfSmartSelect v-model="selectedItem" :options="computedOpts" :formatter="ezFormatter" :null-title="nullTitle" :placeholder="placeholder" />
2+
<VfSmartSelect
3+
v-model="selectedItem"
4+
:options="computedOpts"
5+
:formatter="ezFormatter"
6+
:null-title="nullTitle"
7+
:placeholder="placeholder"
8+
:name="name"
9+
/>
310
</template>
411

512
<script lang="ts" setup generic="T extends string">
@@ -19,6 +26,7 @@ const props = defineProps<{
1926
placeholder?: string;
2027
options: { [key in T]: string } | T[];
2128
formatter?: (label: string, key: T) => string;
29+
name?: string;
2230
}>();
2331
2432
const computedOpts = computed(() => {

src/components/vf-smart-select.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:class="{ nullable: !!nullTitle }"
1010
:placeholder="effectivePlaceholder"
1111
:required="required"
12+
:name="name"
1213
data-1p-ignore
1314
@keydown="handleKeyDown"
1415
@focus="handleInputFocused"
@@ -79,6 +80,7 @@ const props = defineProps<{
7980
required?: boolean;
8081
showCreateTextOnNewItem?: boolean;
8182
autoNext?: boolean;
83+
name?: string;
8284
}>();
8385
8486
const emit = defineEmits<{

src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ interface IOptions {
33
errorHandler: (err: Error) => void;
44
defaultDateFormat: string;
55
defaultTimeFormat: string;
6+
defaultCurrencyDivisor: number;
67
}
78

89
export const VfOptions: IOptions = {
910
unhandledErrorSupportText: 'please contact support',
1011
errorHandler: err => console.error('Unhandled error:', err),
1112
defaultDateFormat: 'M/d/yy',
12-
defaultTimeFormat: 'H:mm'
13+
defaultTimeFormat: 'H:mm',
14+
defaultCurrencyDivisor: 1
1315
};
1416

1517
export function configureVf(options: Partial<IOptions>) {

src/filters/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function desnake(value: string | null) {
6464
return value ? desnakeCase(value) : null;
6565
}
6666

67-
function usCurrency(value: string | number, divisor = 1) {
67+
function usCurrency(value: string | number, divisor?: number) {
6868
return formatUSCurrency(value, divisor);
6969
}
7070

src/helpers/string.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import currency from 'currency.js';
22
import { v4 as uuidv4 } from 'uuid';
33

4+
import { VfOptions } from '@/config';
5+
46
// placing this here so we don't have to use the ESLint rule everywhere
57
// eslint-disable-next-line vue/prefer-import-from-vue
68
export { escapeHtml } from '@vue/shared';
@@ -19,8 +21,10 @@ export function formatPhone(value: string) {
1921
return '(' + cleanValue.substring(0, 3) + ') ' + cleanValue.substring(3, 6) + '-' + cleanValue.substring(6);
2022
}
2123

22-
export function formatUSCurrency(value: string | number, divisor = 1) {
23-
return currency(value).divide(divisor).format();
24+
export function formatUSCurrency(value: string | number, divisor?: number) {
25+
return currency(value)
26+
.divide(divisor ?? VfOptions.defaultCurrencyDivisor)
27+
.format();
2428
}
2529

2630
export function uuid() {

0 commit comments

Comments
 (0)