@ledvance/base 1.1.48 → 1.1.49
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/src/api/native.ts
CHANGED
|
@@ -319,8 +319,8 @@ export const queryDpIds = (dpIds: string, deviceId: string) => {
|
|
|
319
319
|
})
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
export const formatNumber: (num: number, fixed: number,
|
|
323
|
-
const res = devicePanel.formatNumber(num, fixed,
|
|
322
|
+
export const formatNumber: (num: number, fixed: number, shoGroup?: boolean) => string = (num, fixed, shoGroup: boolean = true) => {
|
|
323
|
+
const res = devicePanel.formatNumber(num, fixed, shoGroup)
|
|
324
324
|
log(`formatNumber: num=${num}, fixed=${fixed}, res=${res}`)
|
|
325
325
|
return res
|
|
326
326
|
}
|
|
@@ -186,7 +186,7 @@ const useDeviceInfo: () => DevInfo<DpState> = () => {
|
|
|
186
186
|
const useTimeSchedule = (): [v: boolean | undefined, f: any] => {
|
|
187
187
|
const dps = useSelector(store => store.ldvModules.timeSchedule)
|
|
188
188
|
const dispatch = useDispatch()
|
|
189
|
-
const setTimeScheduleFn = (value:
|
|
189
|
+
const setTimeScheduleFn = (value: boolean) => {
|
|
190
190
|
dispatch(setTimeSchedule(value))
|
|
191
191
|
}
|
|
192
192
|
return [dps, setTimeScheduleFn]
|
package/src/utils/common.ts
CHANGED
|
@@ -86,19 +86,21 @@ if (Platform.OS === 'ios') {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// 德国数字格式化
|
|
89
|
-
export const localeNumber = (v: number | string, fixed?: number) => {
|
|
89
|
+
export const localeNumber = (v: number | string, fixed?: number, showGroup?: boolean) => {
|
|
90
90
|
const mFixed = fixed || 2
|
|
91
91
|
const n = isNaN(Number(v)) ? 0 : Number(v)
|
|
92
|
-
const num = Number(n.toFixed(mFixed))
|
|
93
92
|
try {
|
|
94
|
-
if (Platform.OS === 'android') return formatNumber(n, mFixed)
|
|
93
|
+
if (Platform.OS === 'android') return formatNumber(n, mFixed, showGroup)
|
|
95
94
|
let local = defaultLocale
|
|
96
95
|
if (defaultLocale !== 'pt_BR' && defaultLocale !== 'pt-BR') {
|
|
97
96
|
local = defaultLocale.split('_')[0]
|
|
98
97
|
}
|
|
99
|
-
return new Intl.NumberFormat(local
|
|
98
|
+
return new Intl.NumberFormat(local, {
|
|
99
|
+
useGrouping: showGroup !== undefined ? showGroup : true,
|
|
100
|
+
maximumFractionDigits: mFixed
|
|
101
|
+
}).format(n)
|
|
100
102
|
} catch (_) {
|
|
101
|
-
return
|
|
103
|
+
return n
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
|