1
1
import {
2
- // App
3
- Admin , AppBar , InspectorButton , Layout , Resource , TitlePortal ,
4
- // Create/Edit
5
- Create , DeleteButton , Edit , SaveButton , SimpleForm , Toolbar ,
6
- // List
7
- Datagrid , DatagridConfigurable , List ,
8
- // Show
9
- SimpleShowLayout , Show ,
10
- // Actions
11
- BulkDeleteButton , BulkExportButton , BulkUpdateButton , CloneButton , CreateButton ,
12
- ExportButton , FilterButton , ListButton , SelectColumnsButton , ShowButton , TopToolbar ,
13
- // Fields
14
- BooleanField , DateField , NumberField , ReferenceField , ReferenceManyField ,
15
- ReferenceOneField , SelectField , TextField ,
16
- // Inputs
17
- BooleanInput , DateInput , DateTimeInput , NullableBooleanInput , NumberInput ,
18
- SelectInput , TextInput ,
19
- TimeInput as _TimeInput , ReferenceInput as _ReferenceInput ,
20
- // Filters
2
+ Admin , AppBar , AutocompleteInput ,
3
+ BooleanField , BooleanInput , BulkDeleteButton , Button , BulkExportButton , BulkUpdateButton ,
4
+ CloneButton , Create , CreateButton ,
5
+ Datagrid , DatagridConfigurable , DateField , DateInput , DateTimeInput , DeleteButton ,
6
+ Edit , EditButton , ExportButton ,
7
+ FilterButton , HttpError , InspectorButton ,
8
+ Layout , List , ListButton ,
9
+ NullableBooleanInput , NumberInput , NumberField ,
10
+ ReferenceField , ReferenceInput , ReferenceManyField , ReferenceOneField , Resource ,
11
+ SaveButton , SelectColumnsButton , SelectField , SelectInput , Show , ShowButton ,
12
+ SimpleForm , SimpleShowLayout ,
13
+ TextField , TextInput , TimeInput , TitlePortal , Toolbar , TopToolbar ,
14
+ WithRecord ,
21
15
email , maxLength , maxValue , minLength , minValue , regex , required ,
22
- // Misc
23
- AutocompleteInput , EditButton , HttpError , WithRecord
16
+ useCreate , useCreatePath , useDelete , useDeleteMany , useGetList , useGetMany ,
17
+ useGetOne , useInfiniteGetList , useGetRecordId , useInput , useNotify ,
18
+ useRecordContext , useRedirect , useRefresh , useResourceContext , useUnselect ,
19
+ useUnselectAll , useUpdate , useUpdateMany ,
24
20
} from "react-admin" ;
25
21
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff" ;
26
22
23
+ window . ReactAdmin = {
24
+ Admin, AppBar, AutocompleteInput,
25
+ BooleanField, BooleanInput, BulkDeleteButton, Button, BulkExportButton, BulkUpdateButton,
26
+ CloneButton, Create, CreateButton,
27
+ Datagrid, DatagridConfigurable, DateField, DateInput, DateTimeInput, DeleteButton,
28
+ Edit, EditButton, ExportButton,
29
+ FilterButton, HttpError, InspectorButton,
30
+ Layout, List, ListButton,
31
+ NullableBooleanInput, NumberInput, NumberField,
32
+ ReferenceField, ReferenceInput, ReferenceManyField, ReferenceOneField, Resource,
33
+ SaveButton, SelectColumnsButton, SelectField, SelectInput, Show, ShowButton,
34
+ SimpleForm, SimpleShowLayout,
35
+ TextField, TextInput, TimeInput, TitlePortal, Toolbar, TopToolbar,
36
+ WithRecord,
37
+ email, maxLength, maxValue, minLength, minValue, regex, required,
38
+ useCreate, useCreatePath, useDelete, useDeleteMany, useGetList, useGetMany,
39
+ useGetOne, useInfiniteGetList, useGetRecordId, useInput, useNotify,
40
+ useRecordContext, useRedirect, useRefresh, useResourceContext, useUnselect,
41
+ useUnselectAll, useUpdate, useUpdateMany,
42
+ } ;
43
+
27
44
// Hacked TimeField/TimeInput to actually work with times.
28
45
// TODO: Replace once new components are introduced using Temporal API.
29
46
30
- const TimeField = ( props ) => (
47
+ const _TimeField = ( props ) => (
31
48
< WithRecord { ...props } render = {
32
49
( record ) => < DateField { ...props } showDate = { false } showTime = { true }
33
50
record = { { ...record , [ props [ "source" ] ] : record [ props [ "source" ] ] === null ? null : "2020-01-01T" + record [ props [ "source" ] ] } } />
34
51
} />
35
52
) ;
36
53
37
- const TimeInput = ( props ) => ( < _TimeInput format = { ( v ) => v } parse = { ( v ) => v } { ...props } /> ) ;
54
+ const _TimeInput = ( props ) => ( < TimeInput format = { ( v ) => v } parse = { ( v ) => v } { ...props } /> ) ;
38
55
39
56
/** Reconfigure ReferenceInput to filter by the displayed repr field. */
40
- const ReferenceInput = ( props ) => {
57
+ const _ReferenceInput = ( props ) => {
41
58
const ref = props [ "reference" ] ;
42
59
const repr = STATE [ "resources" ] [ ref ] [ "repr" ] ;
43
60
return (
44
- < _ReferenceInput sort = { { "field" : repr , "order" : "ASC" } } { ...props } >
61
+ < ReferenceInput sort = { { "field" : repr , "order" : "ASC" } } { ...props } >
45
62
< AutocompleteInput filterToQuery = { s => ( { [ repr ] : s } ) } />
46
- </ _ReferenceInput >
63
+ </ ReferenceInput >
47
64
) ;
48
65
} ;
49
66
@@ -64,10 +81,10 @@ const COMPONENTS = {
64
81
ExportButton, FilterButton, ListButton, ShowButton,
65
82
66
83
BooleanField, DateField, NumberField, ReferenceField, ReferenceManyField,
67
- ReferenceOneField, SelectField, TextField, TimeField,
84
+ ReferenceOneField, SelectField, TextField, TimeField : _TimeField ,
68
85
69
86
BooleanInput, DateInput, DateTimeInput, NullableBooleanInput, NumberInput,
70
- ReferenceInput, SelectInput, TextInput, TimeInput
87
+ ReferenceInput : _ReferenceInput , SelectInput, TextInput, TimeInput : _TimeInput
71
88
} ;
72
89
const FUNCTIONS = { email, maxLength, maxValue, minLength, minValue, regex, required} ;
73
90
const _body = document . querySelector ( "body" ) ;
0 commit comments