removed workarounds for webpack, as it seems that it's a temporary cache problem (possibly triggered by squashing commits) that any syntax change will solve
Massimo Melina committed
May 6, 2022 at 12:08 UTC
e39c4cd8159c3f6e76f59659212c6358a98e9cd7
3 files changed
+4
-4
admin/src/Form.ts
+4
-2
@@ -1,4 +1,5 @@
1
// This file is part of HFS - Copyright 2021-2022, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
+
3
import {
4
createElement as h,
5
FC,
@@ -307,13 +308,14 @@ function commonSelectProps<T>(props: { sx?:SxProps, label?: FieldProps<T>['label
308
}
309
}
310
310
-export function NumberField({ value, onChange, min, max, step, ...props }: FieldProps<number | null>) {
311
+export function NumberField({ value, onChange, min, max, step, required, ...props }: FieldProps<number | null>) {
312
return h(StringField, {
313
type: 'number',
314
value: typeof value === 'number' ? String(value) : '',
315
onChange(v, { was, ...rest }) {
316
const n = Number(v)
316
- onChange(!v ? null : n < min ? Error('too low') : n > max ? Error('too high') : n,
317
+ onChange(!v ? (required ? Error('required') : null)
318
+ : n < min ? Error('too low') : n > max ? Error('too high') : n,
319
{ ...rest, was: was ? Number(was) : null })
320
},
321
inputProps: { min, max, step, },
admin/src/misc.ts
-1
@@ -8,7 +8,6 @@ import { SvgIconComponent } from '@mui/icons-material'
8
import { alertDialog } from './dialog'
9
import { apiCall } from './api'
10
import { onlyTruthy, useStateMounted } from '@hfs/shared'
11
-import {} from '@hfs/shared' // without this we get weird warnings by webpack
11
export * from '@hfs/shared'
12
13
export function spinner() {
frontend/src/misc.ts
-1
@@ -5,7 +5,6 @@ import { Spinner } from './components'
5
import { newDialog } from './dialog'
6
import { Icon } from './icons'
7
import { Dict } from '@hfs/shared'
8
-import {} from '@hfs/shared' // without this we get weird warnings by webpack
8
export * from '@hfs/shared'
9
10
export function hIcon(name: string, props?:any) {