intelliwaketssveltekitv25 0.1.111 → 0.1.112
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/NumberFormat.svelte +14 -2
- package/package.json +1 -1
package/dist/NumberFormat.svelte
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* @component NumberFormat
|
|
4
|
+
* @description Provides a span with formatted number version of the value based on the paramemters provided
|
|
5
|
+
* @param {number | string | null} value - The value to be displayed
|
|
6
|
+
* @param {boolean} currency - If the value should be displayed as $1,234.56
|
|
7
|
+
* @param {boolean} percent - If the value should be displayed as 12.3%
|
|
8
|
+
* @param {boolean} dash - If blanks should show as dashes instead
|
|
9
|
+
* @param {boolean} blank - If zero should show as blank instead of 0
|
|
10
|
+
* @param {number} decimals - Number of decimal places to show
|
|
11
|
+
* @param {string} className - CSS class name to apply to span
|
|
12
|
+
* @param {string} classNameAddOnNegative - Additional CSS class name to apply when value is negative
|
|
13
|
+
*/
|
|
2
14
|
import {
|
|
15
|
+
CleanNumber,
|
|
3
16
|
ToCurrency,
|
|
4
17
|
ToCurrencyBlank,
|
|
5
18
|
ToCurrencyDash,
|
|
@@ -32,11 +45,10 @@
|
|
|
32
45
|
} = $props()
|
|
33
46
|
</script>
|
|
34
47
|
|
|
35
|
-
|
|
36
48
|
<span
|
|
37
49
|
data-color="danger"
|
|
38
50
|
class={
|
|
39
|
-
(className ?? '') + ' ' + ((value
|
|
51
|
+
(className ?? '') + ' ' + (CleanNumber(value, 4) < 0 ? classNameAddOnNegative ?? 'text-red-600' : '')
|
|
40
52
|
}>
|
|
41
53
|
{percent
|
|
42
54
|
? blank
|