File tree Expand file tree Collapse file tree 6 files changed +69
-41
lines changed Expand file tree Collapse file tree 6 files changed +69
-41
lines changed Original file line number Diff line number Diff line change @@ -682,6 +682,7 @@ export interface OwnPropsOfMasterListItem {
682
682
index : number ;
683
683
selected : boolean ;
684
684
path : string ;
685
+ enabled : boolean ;
685
686
schema : JsonSchema ;
686
687
handleSelect ( index : number ) : ( ) => void ;
687
688
removeItem ( path : string , value : number ) : ( ) => void ;
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export const ListWithDetailMasterItem = ({
39
39
index,
40
40
childLabel,
41
41
selected,
42
+ enabled,
42
43
handleSelect,
43
44
removeItem,
44
45
path,
@@ -50,15 +51,17 @@ export const ListWithDetailMasterItem = ({
50
51
< Avatar aria-label = 'Index' > { index + 1 } </ Avatar >
51
52
</ ListItemAvatar >
52
53
< ListItemText primary = { childLabel } />
53
- < ListItemSecondaryAction >
54
- < IconButton
55
- aria-label = { translations . removeAriaLabel }
56
- onClick = { removeItem ( path , index ) }
57
- size = 'large'
58
- >
59
- < DeleteIcon />
60
- </ IconButton >
61
- </ ListItemSecondaryAction >
54
+ { enabled && (
55
+ < ListItemSecondaryAction >
56
+ < IconButton
57
+ aria-label = { translations . removeAriaLabel }
58
+ onClick = { removeItem ( path , index ) }
59
+ size = 'large'
60
+ >
61
+ < DeleteIcon />
62
+ </ IconButton >
63
+ </ ListItemSecondaryAction >
64
+ ) }
62
65
</ ListItem >
63
66
) ;
64
67
} ;
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ export const MaterialListWithDetailRenderer = ({
51
51
schema,
52
52
uischema,
53
53
path,
54
+ enabled,
54
55
errors,
55
56
visible,
56
57
label,
@@ -114,6 +115,7 @@ export const MaterialListWithDetailRenderer = ({
114
115
) }
115
116
errors = { errors }
116
117
path = { path }
118
+ enabled = { enabled }
117
119
addItem = { addItem }
118
120
createDefault = { handleCreateDefaultValue }
119
121
/>
@@ -126,6 +128,7 @@ export const MaterialListWithDetailRenderer = ({
126
128
index = { index }
127
129
path = { path }
128
130
schema = { schema }
131
+ enabled = { enabled }
129
132
handleSelect = { handleListItemClick }
130
133
removeItem = { handleRemoveItem }
131
134
selected = { selectedIndex === index }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface ArrayLayoutToolbarProps {
7
7
label : string ;
8
8
errors : string ;
9
9
path : string ;
10
+ enabled : boolean ;
10
11
addItem ( path : string , data : any ) : ( ) => void ;
11
12
createDefault ( ) : any ;
12
13
translations : ArrayTranslations ;
@@ -16,39 +17,56 @@ export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
16
17
errors,
17
18
addItem,
18
19
path,
20
+ enabled,
19
21
createDefault,
20
22
translations,
21
23
} : ArrayLayoutToolbarProps ) {
22
24
return (
23
25
< Toolbar disableGutters = { true } >
24
26
< Grid container alignItems = 'center' justifyContent = 'space-between' >
25
27
< Grid item >
26
- < Typography variant = { 'h6' } > { label } </ Typography >
28
+ < Grid
29
+ container
30
+ justifyContent = { 'flex-start' }
31
+ alignItems = { 'center' }
32
+ spacing = { 2 }
33
+ >
34
+ < Grid item >
35
+ < Typography variant = { 'h6' } > { label } </ Typography >
36
+ </ Grid >
37
+ < Grid item >
38
+ { errors . length !== 0 && (
39
+ < Grid item >
40
+ < ValidationIcon
41
+ id = 'tooltip-validation'
42
+ errorMessages = { errors }
43
+ />
44
+ </ Grid >
45
+ ) }
46
+ </ Grid >
47
+ </ Grid >
27
48
</ Grid >
28
- { errors . length !== 0 && (
49
+ { enabled && (
29
50
< Grid item >
30
- < ValidationIcon id = 'tooltip-validation' errorMessages = { errors } />
31
- </ Grid >
32
- ) }
33
- < Grid item >
34
- < Grid container >
35
- < Grid item >
36
- < Tooltip
37
- id = 'tooltip-add'
38
- title = { translations . addTooltip }
39
- placement = 'bottom'
40
- >
41
- < IconButton
42
- aria-label = { translations . addAriaLabel }
43
- onClick = { addItem ( path , createDefault ( ) ) }
44
- size = 'large'
51
+ < Grid container >
52
+ < Grid item >
53
+ < Tooltip
54
+ id = 'tooltip-add'
55
+ title = { translations . addTooltip }
56
+ placement = 'bottom'
45
57
>
46
- < AddIcon />
47
- </ IconButton >
48
- </ Tooltip >
58
+ < IconButton
59
+ aria-label = { translations . addTooltip }
60
+ onClick = { addItem ( path , createDefault ( ) ) }
61
+ size = 'large'
62
+ >
63
+ < AddIcon />
64
+ </ IconButton >
65
+ </ Tooltip >
66
+ </ Grid >
49
67
</ Grid >
50
68
</ Grid >
51
- </ Grid >
69
+ ) }
52
70
</ Grid >
53
71
</ Toolbar >
54
72
) ;
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
164
164
justifyContent = 'center'
165
165
alignItems = 'center'
166
166
>
167
- { showSortButtons ? (
167
+ { showSortButtons && enabled ? (
168
168
< Fragment >
169
169
< Grid item >
170
170
< IconButton
@@ -192,16 +192,18 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
192
192
) : (
193
193
''
194
194
) }
195
- < Grid item >
196
- < IconButton
197
- onClick = { removeItems ( path , [ index ] ) }
198
- style = { iconStyle }
199
- aria-label = { translations . removeAriaLabel }
200
- size = 'large'
201
- >
202
- < DeleteIcon />
203
- </ IconButton >
204
- </ Grid >
195
+ { enabled && (
196
+ < Grid item >
197
+ < IconButton
198
+ onClick = { removeItems ( path , [ index ] ) }
199
+ style = { iconStyle }
200
+ aria-label = { translations . removeAriaLabel }
201
+ size = 'large'
202
+ >
203
+ < DeleteIcon />
204
+ </ IconButton >
205
+ </ Grid >
206
+ ) }
205
207
</ Grid >
206
208
</ Grid >
207
209
</ Grid >
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ const MaterialArrayLayoutComponent = (props: ArrayLayoutProps) => {
80
80
) }
81
81
errors = { errors }
82
82
path = { path }
83
+ enabled = { enabled }
83
84
addItem = { addItem }
84
85
createDefault = { innerCreateDefaultValue }
85
86
/>
You can’t perform that action at this time.
0 commit comments