6
6
TriggerActionValue ,
7
7
} from "@dmm-com/airone-apiclient-typescript-fetch" ;
8
8
import AddIcon from "@mui/icons-material/Add" ;
9
- import AddCircleIcon from ' @mui/icons-material/AddCircle' ;
10
- import CancelIcon from ' @mui/icons-material/Cancel' ;
9
+ import AddCircleIcon from " @mui/icons-material/AddCircle" ;
10
+ import CancelIcon from " @mui/icons-material/Cancel" ;
11
11
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline" ;
12
12
import {
13
13
Box ,
@@ -22,9 +22,10 @@ import {
22
22
import { styled } from "@mui/material/styles" ;
23
23
import React , { FC } from "react" ;
24
24
import { Control , Controller , useFieldArray } from "react-hook-form" ;
25
- import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete" ;
26
25
27
26
import { Schema } from "./TriggerFormSchema" ;
27
+
28
+ import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete" ;
28
29
import { isSupportedType } from "services/trigger/Edit" ;
29
30
30
31
interface Props {
@@ -49,18 +50,20 @@ interface PropsActionValueComponent {
49
50
actionValue : TriggerActionValue ;
50
51
}
51
52
52
- interface PropsActionValueComponentWithAttrId extends PropsActionValueComponent {
53
+ interface PropsActionValueComponentWithAttrId
54
+ extends PropsActionValueComponent {
53
55
attrId : number ;
54
56
}
55
57
56
- interface PropsActionValueComponentWithEntity extends PropsActionValueComponent {
58
+ interface PropsActionValueComponentWithEntity
59
+ extends PropsActionValueComponent {
57
60
entity : EntityDetail ;
58
61
actionField : TriggerAction ;
59
62
handleAddInputValue : ( index : number ) => void ;
60
63
handleDelInputValue : ( index : number ) => void ;
61
64
}
62
65
63
- const StyledBox = styled ( Box ) ( ( { } ) => ( {
66
+ const StyledBox = styled ( Box ) ( ( { } ) => ( {
64
67
display : "flex" ,
65
68
width : "100%" ,
66
69
gap : "0 12px" ,
@@ -70,17 +73,15 @@ const ActionValueAsString: FC<PropsActionValueComponent> = ({
70
73
indexAction,
71
74
indexActionValue,
72
75
control,
73
- actionValue
76
+ actionValue,
74
77
} ) => {
75
78
return (
76
79
< Controller
77
80
name = { `actions.${ indexAction } .values.${ indexActionValue } .strCond` }
78
81
defaultValue = { actionValue . strCond ?? "" }
79
82
control = { control }
80
83
render = { ( { field } ) => {
81
- return (
82
- < TextField { ...field } variant = "standard" fullWidth />
83
- )
84
+ return < TextField { ...field } variant = "standard" fullWidth /> ;
84
85
} }
85
86
/>
86
87
) ;
@@ -150,7 +151,6 @@ const ActionValueInputForm: FC<PropsActionValueComponentWithEntity> = ({
150
151
handleAddInputValue,
151
152
handleDelInputValue,
152
153
} ) => {
153
-
154
154
const attrInfo = entity . attrs . find ( ( attr ) => attr . id === actionField . attr . id ) ;
155
155
switch ( attrInfo ?. type ) {
156
156
case EntryAttributeTypeTypeEnum . STRING :
@@ -226,7 +226,7 @@ const ActionValueInputForm: FC<PropsActionValueComponentWithEntity> = ({
226
226
</ StyledBox >
227
227
) ;
228
228
}
229
- }
229
+ } ;
230
230
231
231
const ActionValue : FC < PropsActionValue > = ( {
232
232
indexAction,
@@ -246,12 +246,12 @@ const ActionValue: FC<PropsActionValue> = ({
246
246
strCond : "" ,
247
247
refCond : null ,
248
248
} ) ;
249
- }
249
+ } ;
250
250
const handleDelActionValue = ( index : number ) => {
251
251
remove ( index ) ;
252
252
253
253
fields . length === 1 && handleAddActionValue ( 0 ) ;
254
- }
254
+ } ;
255
255
256
256
return (
257
257
< >
@@ -293,27 +293,31 @@ export const ActionForm: FC<Props> = ({
293
293
name : "" ,
294
294
type : 0 ,
295
295
} ,
296
- values : [ {
297
- id : 0 ,
298
- strCond : "" ,
299
- refCond : null ,
300
- boolCond : undefined ,
301
- } ]
302
- } )
296
+ values : [
297
+ {
298
+ id : 0 ,
299
+ strCond : "" ,
300
+ refCond : null ,
301
+ boolCond : undefined ,
302
+ } ,
303
+ ] ,
304
+ } ) ;
303
305
} ;
304
306
305
307
return (
306
308
< >
307
309
{ fields . map ( ( actionField , index ) => {
308
310
return (
309
- < Controller key = { actionField . key }
311
+ < Controller
312
+ key = { actionField . key }
310
313
name = { `actions.${ index } .attr.id` }
311
314
control = { control }
312
315
defaultValue = { actionField . attr . id }
313
316
render = { ( { field } ) => (
314
317
< TableRow >
315
318
< TableCell >
316
- < Select { ...field }
319
+ < Select
320
+ { ...field }
317
321
size = "small"
318
322
fullWidth
319
323
onChange = { ( e ) => {
@@ -323,11 +327,13 @@ export const ActionForm: FC<Props> = ({
323
327
resetActionValues ( index ) ;
324
328
} }
325
329
>
326
- { entity . attrs . filter ( ( attr ) => isSupportedType ( attr ) ) . map ( ( attr ) => (
327
- < MenuItem key = { attr . id } value = { attr . id } >
328
- { attr . name }
329
- </ MenuItem >
330
- ) ) }
330
+ { entity . attrs
331
+ . filter ( ( attr ) => isSupportedType ( attr ) )
332
+ . map ( ( attr ) => (
333
+ < MenuItem key = { attr . id } value = { attr . id } >
334
+ { attr . name }
335
+ </ MenuItem >
336
+ ) ) }
331
337
</ Select >
332
338
</ TableCell >
333
339
< TableCell >
0 commit comments