vueless 0.0.447 → 0.0.448
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
package/ui.text-money/UMoney.vue
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<span
|
|
20
20
|
v-if="!integer"
|
|
21
21
|
v-bind="pennyAttrs"
|
|
22
|
-
v-text="preparedMoney.
|
|
22
|
+
v-text="preparedMoney.decimalSeparator + preparedMoney.penny"
|
|
23
23
|
/>
|
|
24
24
|
|
|
25
25
|
<span
|
|
@@ -118,11 +118,11 @@ const props = defineProps({
|
|
|
118
118
|
},
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
*
|
|
121
|
+
* A symbol used to separate the integer part from the fractional part of a number.
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
decimalSeparator: {
|
|
124
124
|
type: String,
|
|
125
|
-
default: getDefault(defaultConfig, UMoney).
|
|
125
|
+
default: getDefault(defaultConfig, UMoney).decimalSeparator,
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
/**
|
|
@@ -200,6 +200,6 @@ const mathSign = computed(() => {
|
|
|
200
200
|
});
|
|
201
201
|
|
|
202
202
|
const preparedMoney = computed(() => {
|
|
203
|
-
return separatedMoney(Math.abs(props.sum), props.decimalScale, props.
|
|
203
|
+
return separatedMoney(Math.abs(props.sum), props.decimalScale, props.decimalSeparator);
|
|
204
204
|
});
|
|
205
205
|
</script>
|
package/ui.text-money/config.js
CHANGED
|
@@ -8,17 +8,22 @@ export const ADD_SPACE_IN_MONEY_REG_EX = /(\d)(?=(\d{3})+(\D|$))/g;
|
|
|
8
8
|
export const SINGLE_ZERO = "0";
|
|
9
9
|
export const DOUBLE_ZERO = "00";
|
|
10
10
|
|
|
11
|
-
export function separatedMoney(money, decimalPlaces = 2,
|
|
11
|
+
export function separatedMoney(money, decimalPlaces = 2, decimalSeparator = ",") {
|
|
12
12
|
const roundedMoney = money ? money.toFixed(decimalPlaces) : 0;
|
|
13
13
|
|
|
14
14
|
let [integer, penny] = String(roundedMoney).split(".");
|
|
15
15
|
|
|
16
16
|
integer = integer.replace(ADD_SPACE_IN_MONEY_REG_EX, "$1 ");
|
|
17
17
|
|
|
18
|
-
if (roundedMoney
|
|
18
|
+
if (!roundedMoney) {
|
|
19
19
|
integer = SINGLE_ZERO;
|
|
20
20
|
penny = DOUBLE_ZERO;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
if (decimalPlaces === 0) {
|
|
24
|
+
decimalSeparator = "";
|
|
25
|
+
penny = "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return { integer, penny, decimalSeparator };
|
|
24
29
|
}
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.448",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -6631,8 +6631,8 @@
|
|
|
6631
6631
|
"default": "2"
|
|
6632
6632
|
},
|
|
6633
6633
|
{
|
|
6634
|
-
"name": "
|
|
6635
|
-
"description": "
|
|
6634
|
+
"name": "decimalSeparator",
|
|
6635
|
+
"description": "A symbol used to separate the integer part from the fractional part of a number.",
|
|
6636
6636
|
"value": {
|
|
6637
6637
|
"kind": "expression",
|
|
6638
6638
|
"type": "string"
|