vueless 0.0.610 → 0.0.612
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/package.json
CHANGED
|
@@ -4,7 +4,10 @@ import { getRawValue, getFormattedValue } from "./utilFormat.ts";
|
|
|
4
4
|
|
|
5
5
|
import type { FormatOptions } from "./types.ts";
|
|
6
6
|
|
|
7
|
-
export default function useFormatCurrency(
|
|
7
|
+
export default function useFormatCurrency(
|
|
8
|
+
elementId: string = "",
|
|
9
|
+
options: (() => FormatOptions) | FormatOptions,
|
|
10
|
+
) {
|
|
8
11
|
let prevValue = "";
|
|
9
12
|
let inputElement: HTMLInputElement | null = null;
|
|
10
13
|
|
|
@@ -3,6 +3,7 @@ import type { FormatOptions } from "./types.ts";
|
|
|
3
3
|
const isNumberValueRegExp = /^[\d,.\s-]+$/;
|
|
4
4
|
const rawDecimalMark = ".";
|
|
5
5
|
const comma = ",";
|
|
6
|
+
const minus = "-";
|
|
6
7
|
|
|
7
8
|
export function getRawValue(value: string | number, options: FormatOptions): string {
|
|
8
9
|
const { thousandsSeparator, decimalSeparator, prefix } = options;
|
|
@@ -44,12 +45,18 @@ export function getFormattedValue(value: string | number, options: FormatOptions
|
|
|
44
45
|
value = String(value)
|
|
45
46
|
.replace(invalidValuesRegExp, "")
|
|
46
47
|
.replace(doubleValueRegExp, "$1")
|
|
47
|
-
.replaceAll(decimalSeparator, rawDecimalMark)
|
|
48
|
+
.replaceAll(decimalSeparator, rawDecimalMark)
|
|
49
|
+
.trim();
|
|
48
50
|
|
|
49
51
|
const isNumber = isNumberValueRegExp.test(value);
|
|
50
52
|
const isFloat = value.endsWith(rawDecimalMark) || value.endsWith(".0");
|
|
53
|
+
const isMinus = value === minus;
|
|
51
54
|
|
|
52
|
-
if (
|
|
55
|
+
if (isMinus && positiveOnly) {
|
|
56
|
+
value = "";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!value || !isNumber || isFloat || isMinus) {
|
|
53
60
|
return `${prefix}${value.replaceAll(rawDecimalMark, decimalSeparator)}`;
|
|
54
61
|
}
|
|
55
62
|
|
package/ui.image-icon/UIcon.vue
CHANGED
|
@@ -42,11 +42,16 @@ const generatedIcons = computed(() => {
|
|
|
42
42
|
const dynamicComponent = computed(() => {
|
|
43
43
|
const FILL_SUFFIX = "-fill";
|
|
44
44
|
|
|
45
|
+
const userLibrary = config.value.defaults.library as IconLibraries;
|
|
46
|
+
|
|
45
47
|
const isInternalIcon = Boolean(
|
|
46
|
-
generatedIcons.value.find(([path]) =>
|
|
47
|
-
|
|
48
|
+
generatedIcons.value.find(([path]) => {
|
|
49
|
+
const hasInInternal = path.includes(VUELESS_LIBRARY + "/" + props.name);
|
|
50
|
+
const hasInExternal = path.includes(userLibrary + "/" + props.name);
|
|
48
51
|
|
|
49
|
-
|
|
52
|
+
return hasInInternal && !hasInExternal;
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
50
55
|
|
|
51
56
|
const library = props.internal && isInternalIcon ? VUELESS_LIBRARY : userLibrary;
|
|
52
57
|
const customLibraryPath = config.value.defaults.path;
|