1
1
import React , { useEffect , useState } from "react" ;
2
2
import { themeColor } from "../../constant/const" ;
3
3
import ModalUi from "../../primitives/ModalUi" ;
4
+ import { radioButtonWidget } from "../../constant/Utils" ;
4
5
function DropdownWidgetOption ( props ) {
5
6
const [ dropdownOptionList , setDropdownOptionList ] = useState ( [
6
7
"option-1" ,
@@ -10,6 +11,7 @@ function DropdownWidgetOption(props) {
10
11
const [ maxCount , setMaxCount ] = useState ( 0 ) ;
11
12
const [ dropdownName , setDropdownName ] = useState ( props . type ) ;
12
13
const [ isReadOnly , setIsReadOnly ] = useState ( false ) ;
14
+ const [ isHideLabel , setIsHideLabel ] = useState ( false ) ;
13
15
const [ status , setStatus ] = useState ( "required" ) ;
14
16
const [ defaultValue , setDefaultValue ] = useState ( "" ) ;
15
17
const statusArr = [ "required" , "optional" ] ;
@@ -19,6 +21,7 @@ function DropdownWidgetOption(props) {
19
21
setDropdownOptionList ( [ "option-1" , "option-2" ] ) ;
20
22
setDropdownName ( props . type ) ;
21
23
setIsReadOnly ( false ) ;
24
+ setIsHideLabel ( false ) ;
22
25
setMinCount ( 0 ) ;
23
26
setMaxCount ( 0 ) ;
24
27
setDefaultCheckbox ( [ ] ) ;
@@ -39,6 +42,7 @@ function DropdownWidgetOption(props) {
39
42
props . currWidgetsDetails ?. options ?. validation ?. maxRequiredCount
40
43
) ;
41
44
setIsReadOnly ( props . currWidgetsDetails ?. options ?. isReadOnly ) ;
45
+ setIsHideLabel ( props . currWidgetsDetails ?. options ?. isHideLabel ) ;
42
46
setStatus ( props . currWidgetsDetails ?. options ?. status || "required" ) ;
43
47
setDefaultValue ( props . currWidgetsDetails ?. options ?. defaultValue || "" ) ;
44
48
setDefaultCheckbox ( props . currWidgetsDetails ?. options ?. defaultValue || [ ] ) ;
@@ -106,13 +110,15 @@ function DropdownWidgetOption(props) {
106
110
null ,
107
111
null ,
108
112
status ,
109
- defaultData
113
+ defaultData ,
114
+ isHideLabel
110
115
) ;
111
116
// props.setShowDropdown(false);
112
117
setDropdownOptionList ( [ "option-1" , "option-2" ] ) ;
113
118
setDropdownName ( props . type ) ;
114
119
// props.setCurrWidgetsDetails({});
115
120
setIsReadOnly ( false ) ;
121
+ setIsHideLabel ( false ) ;
116
122
setMinCount ( 0 ) ;
117
123
setMaxCount ( 0 ) ;
118
124
setDefaultCheckbox ( [ ] ) ;
@@ -143,7 +149,7 @@ function DropdownWidgetOption(props) {
143
149
// styleClass={"dropdownModal"}
144
150
isOpen = { props . showDropdown }
145
151
title = { props . title }
146
- closeOff = { true }
152
+ showClose = { false }
147
153
>
148
154
< div style = { { height : "100%" , padding : 20 } } >
149
155
< form
@@ -153,20 +159,6 @@ function DropdownWidgetOption(props) {
153
159
} }
154
160
>
155
161
< div className = "dropdownContainer" >
156
- { [ "checkbox" , "radio" ] . includes ( props . type ) &&
157
- ! props . isSignYourself && (
158
- < div >
159
- < input
160
- type = "checkbox"
161
- checked = { isReadOnly }
162
- onChange = { ( e ) => {
163
- setIsReadOnly ( e . target . checked ) ;
164
- } }
165
- />
166
-
167
- < label style = { { marginLeft : "10px" } } > Is read only</ label >
168
- </ div >
169
- ) }
170
162
< label style = { { fontSize : "13px" , fontWeight : "600" } } >
171
163
Name< span style = { { color : "red" , fontSize : 13 } } > *</ span >
172
164
</ label >
@@ -178,36 +170,6 @@ function DropdownWidgetOption(props) {
178
170
className = "drodown-input"
179
171
/>
180
172
181
- { props . type === "checkbox" && ! props . isSignYourself && (
182
- < >
183
- < label style = { { fontSize : "13px" , fontWeight : "600" } } >
184
- Minimun check
185
- </ label >
186
- < input
187
- required
188
- defaultValue = { 0 }
189
- value = { minCount }
190
- onChange = { ( e ) => {
191
- const count = handleSetMinMax ( e ) ;
192
- setMinCount ( count ) ;
193
- } }
194
- className = "drodown-input"
195
- />
196
- < label style = { { fontSize : "13px" , fontWeight : "600" } } >
197
- Maximum check
198
- </ label >
199
- < input
200
- required
201
- defaultValue = { 0 }
202
- value = { maxCount }
203
- onChange = { ( e ) => {
204
- const count = handleSetMinMax ( e ) ;
205
- setMaxCount ( count ) ;
206
- } }
207
- className = "drodown-input"
208
- />
209
- </ >
210
- ) }
211
173
< label
212
174
style = { { fontSize : "13px" , fontWeight : "600" , marginTop : "5px" } }
213
175
>
@@ -274,7 +236,6 @@ function DropdownWidgetOption(props) {
274
236
> </ i >
275
237
</ div >
276
238
) ) }
277
-
278
239
< i
279
240
onClick = { handleAddInput }
280
241
style = { {
@@ -285,8 +246,38 @@ function DropdownWidgetOption(props) {
285
246
} }
286
247
className = "fa-solid fa-square-plus"
287
248
> </ i >
249
+ { props . type === "checkbox" && ! props . isSignYourself && (
250
+ < >
251
+ < label style = { { fontSize : "13px" , fontWeight : "600" } } >
252
+ Minimun check
253
+ </ label >
254
+ < input
255
+ required
256
+ defaultValue = { 0 }
257
+ value = { minCount }
258
+ onChange = { ( e ) => {
259
+ const count = handleSetMinMax ( e ) ;
260
+ setMinCount ( count ) ;
261
+ } }
262
+ className = "drodown-input"
263
+ />
264
+ < label style = { { fontSize : "13px" , fontWeight : "600" } } >
265
+ Maximum check
266
+ </ label >
267
+ < input
268
+ required
269
+ defaultValue = { 0 }
270
+ value = { maxCount }
271
+ onChange = { ( e ) => {
272
+ const count = handleSetMinMax ( e ) ;
273
+ setMaxCount ( count ) ;
274
+ } }
275
+ className = "drodown-input"
276
+ />
277
+ </ >
278
+ ) }
288
279
</ div >
289
- { [ "dropdown" , "radio" ] . includes ( props . type ) && (
280
+ { [ "dropdown" , radioButtonWidget ] . includes ( props . type ) && (
290
281
< >
291
282
< label
292
283
style = { {
@@ -321,7 +312,7 @@ function DropdownWidgetOption(props) {
321
312
</ select >
322
313
</ >
323
314
) }
324
- { props . type !== "checkbox" && props . type !== "radio" && (
315
+ { props . type !== "checkbox" && props . type !== radioButtonWidget && (
325
316
< >
326
317
< div
327
318
style = { {
@@ -358,8 +349,40 @@ function DropdownWidgetOption(props) {
358
349
</ div >
359
350
</ >
360
351
) }
361
- </ div >
352
+ { [ "checkbox" , radioButtonWidget ] . includes ( props . type ) && (
353
+ < div className = "flex flex-row gap-5 mt-2 items-center text-center" >
354
+ { ! props . isSignYourself && (
355
+ < div >
356
+ < input
357
+ id = "isreadonly"
358
+ type = "checkbox"
359
+ checked = { isReadOnly }
360
+ onChange = { ( e ) => {
361
+ setIsReadOnly ( e . target . checked ) ;
362
+ } }
363
+ />
364
+ < label className = "ml-1" htmlFor = "isreadonly" >
365
+ Is read only
366
+ </ label >
367
+ </ div >
368
+ ) }
369
+ < div >
370
+ < input
371
+ id = "ishidelabel"
372
+ type = "checkbox"
373
+ checked = { isHideLabel }
374
+ onChange = { ( e ) => {
375
+ setIsHideLabel ( e . target . checked ) ;
376
+ } }
377
+ />
362
378
379
+ < label className = "ml-1" htmlFor = "ishidelabel" >
380
+ Hide label
381
+ </ label >
382
+ </ div >
383
+ </ div >
384
+ ) }
385
+ </ div >
363
386
< div
364
387
style = { {
365
388
height : "1px" ,
0 commit comments