nicer number fields on admin-panel with firefox

Massimo Melina committed Feb 7, 2023 at 14:03 UTC 78a9ae5890e83a9462bb6d6d3e845a0af733e85f
1 file changed +6 -3
mui-grid-form/misc-fields.ts
+6 -3
@@ -14,6 +14,7 @@ import {
14 InputAdornment,
15 Switch
16 } from '@mui/material'
17 +import _ from 'lodash'
18
19 export function DisplayField({ value, empty='-', ...props }: any) {
20 if (!props.toField && empty !== undefined && value !== 0 && !value)
@@ -38,13 +39,15 @@ export function NumberField({ value, onChange, getApi, required, min, max, step,
39 })
40 },
41 inputProps: { min, max, step, },
41 - InputProps: unit && {
42 + InputProps: _.merge({
43 + sx: { '& input': { appearance: 'textfield' } }
44 + }, unit && {
45 sx: { pr: '6px', '& input': { pl: '.2em', textAlign: 'right' } },
46 endAdornment: h(InputAdornment, {
47 position: 'end',
45 - sx: { mt: '1.2em', ml: '2px', '& p': { fontSize: '80%' } }
48 + sx: { mt: '1.2em', ml: '5px', '& p': { fontSize: '80%' } }
49 }, unit),
47 - },
50 + }),
51 ...props,
52 })
53 }