react-native-nitro-input 0.3.7 → 0.3.8
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/CHANGELOG.md +44 -0
- package/README.md +4 -3
- package/android/CMakeLists.txt +1 -0
- package/cpp/RollingEngine.cpp +68 -5
- package/cpp/RollingEngine.hpp +13 -0
- package/cpp/numberformat/FormatFigure.cpp +134 -0
- package/cpp/numberformat/FormatFigure.hpp +65 -0
- package/cpp/numberformat/HybridNitroNumberFormat.cpp +32 -10
- package/cpp/numberformat/HybridNitroNumberFormat.hpp +9 -1
- package/lib/commonjs/src/NitroNumber.js +19 -11
- package/lib/commonjs/src/NumberFormat.js +20 -0
- package/lib/commonjs/src/formatProps.js +57 -81
- package/lib/module/src/NitroNumber.js +20 -12
- package/lib/module/src/NumberFormat.js +18 -0
- package/lib/module/src/formatProps.js +54 -81
- package/lib/typescript/src/NitroNumber.d.ts +25 -7
- package/lib/typescript/src/NumberFormat.d.ts +15 -1
- package/lib/typescript/src/formatProps.d.ts +23 -18
- package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +33 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +8 -0
- package/nitrogen/generated/shared/c++/NumberFigure.hpp +95 -0
- package/nitrogen/generated/shared/c++/NumberFormatLayout.hpp +112 -0
- package/package.json +2 -2
- package/src/NitroNumber.tsx +48 -19
- package/src/NumberFormat.ts +22 -0
- package/src/formatProps.ts +59 -99
- package/src/specs/NumberFormat.nitro.ts +35 -0
|
@@ -69,6 +69,37 @@ export interface NumberFormatPart {
|
|
|
69
69
|
value: string
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* One value as `NitroNumber` rolls it: the figure its digits show, rounded and
|
|
74
|
+
* trimmed as the format prints it, and the text around it.
|
|
75
|
+
*/
|
|
76
|
+
export interface NumberFigure {
|
|
77
|
+
/** The figure as the digits show it, signed: 1.2 for "1.2K", 2.12 for "$2.12"; 0 (never -0) when it rounds to nothing, or for NaN and infinities. */
|
|
78
|
+
value: number
|
|
79
|
+
/** The fraction digits this value shows ("$1,234" 0, "$1,234.50" 2); the format's maximum for NaN and infinities. */
|
|
80
|
+
fractionDigits: number
|
|
81
|
+
/** The text before the number, without the sign. */
|
|
82
|
+
prefix: string
|
|
83
|
+
/** The text after the number, without the sign. */
|
|
84
|
+
suffix: string
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The shape of a format, as `NitroNumber` and `NitroInput` lay a number out. */
|
|
88
|
+
export interface NumberFormatLayout {
|
|
89
|
+
prefix: string
|
|
90
|
+
suffix: string
|
|
91
|
+
/** Empty when the format does not group. */
|
|
92
|
+
groupingSeparator: string
|
|
93
|
+
decimalSeparator: string
|
|
94
|
+
/** A negative amount's sign comes after the prefix ("$-5"), not before it ("-$5"). */
|
|
95
|
+
signAfterAffix: boolean
|
|
96
|
+
minusSign: string
|
|
97
|
+
/** The group nearest the decimal point and every one before it ([3, 2]: 12,34,567). */
|
|
98
|
+
groupingSizes: number[]
|
|
99
|
+
/** The format's digits 0…9, or empty for Latin ones. */
|
|
100
|
+
digitGlyphs: string[]
|
|
101
|
+
}
|
|
102
|
+
|
|
72
103
|
/**
|
|
73
104
|
* A number formatter with the API of `Intl.NumberFormat`. It learns a
|
|
74
105
|
* locale's format once from the platform (Foundation on iOS, ICU on Android)
|
|
@@ -80,6 +111,10 @@ export interface NitroNumberFormat extends HybridObject<{ ios: 'c++'; android: '
|
|
|
80
111
|
format(value: number | Int64 | string): string
|
|
81
112
|
formatToParts(value: number | Int64 | string): NumberFormatPart[]
|
|
82
113
|
resolvedOptions(): ResolvedNumberFormatOptions
|
|
114
|
+
/** For the components, not part of `Intl.NumberFormat`: what `value` shows, as a figure. */
|
|
115
|
+
figure(value: number | Int64 | string): NumberFigure
|
|
116
|
+
/** For the components, not part of `Intl.NumberFormat`: the shape of the format. */
|
|
117
|
+
layout(): NumberFormatLayout
|
|
83
118
|
}
|
|
84
119
|
|
|
85
120
|
export interface NitroNumberFormatFactory extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
|