@@ -65,7 +65,7 @@ const AdvancePropertise = (props: SchemaProps) => {
6565 // State for content types
6666 const [ contentTypes , setContentTypes ] = useState < ContentType [ ] > ( [ ] ) ;
6767 const [ ctValue , setCTValue ] = useState < ContentTypeOption [ ] | null > ( embedObjects ) ;
68- const [ embedObjectslabels , setEmbedObjectsLabels ] = useState < string [ ] > ( props ?. value ?. embedObjects ) ;
68+ const [ embedObjectsLabels , setEmbedObjectsLabels ] = useState < string [ ] > ( props ?. value ?. embedObjects ) ;
6969 const [ showOptions , setShowOptions ] = useState < Record < number , boolean > > ( { } ) ;
7070 const [ showIcon , setShowIcon ] = useState < number > ( ) ;
7171 const filterRef = useRef < HTMLDivElement | null > ( null ) ;
@@ -132,7 +132,7 @@ const AdvancePropertise = (props: SchemaProps) => {
132132 unique : false ,
133133 nonLocalizable : currentToggleStates ?. nonLocalizable ,
134134 embedObject : currentToggleStates ?. embedObject ,
135- embedObjects : embedObjectslabels ,
135+ embedObjects : embedObjectsLabels ,
136136 minRange : currentToggleStates ?. minRange ,
137137 maxRange : currentToggleStates ?. maxRange ,
138138 minSize : currentToggleStates ?. minSize ,
@@ -165,13 +165,13 @@ const AdvancePropertise = (props: SchemaProps) => {
165165 {
166166 ...props ?. value ,
167167 [ field ] : value ,
168- validationRegex : currentToggleStates ?. validationRegex || '' ,
168+ validationRegex : currentToggleStates ?. validationRegex ?? '' ,
169169 mandatory : currentToggleStates ?. mandatory ,
170170 multiple : currentToggleStates ?. multiple ,
171171 unique : false ,
172172 nonLocalizable : currentToggleStates ?. nonLocalizable ,
173173 embedObject : currentToggleStates ?. embedObject ,
174- embedObjects : embedObjectslabels ,
174+ embedObjects : embedObjectsLabels ,
175175 default_value : currentToggleStates ?. default_value ,
176176 minChars : currentToggleStates ?. minChars ,
177177 maxChars :currentToggleStates ?. maxChars ,
@@ -201,13 +201,13 @@ const AdvancePropertise = (props: SchemaProps) => {
201201 props ?. rowId ,
202202 {
203203 [ field ] : value ,
204- validationRegex : currentToggleStates ?. validationRegex || '' ,
204+ validationRegex : currentToggleStates ?. validationRegex ?? '' ,
205205 mandatory : currentToggleStates ?. mandatory ,
206206 multiple : currentToggleStates ?. multiple ,
207207 unique : false ,
208208 nonLocalizable : currentToggleStates ?. nonLocalizable ,
209209 embedObject : currentToggleStates ?. embedObject ,
210- embedObjects : embedObjectslabels
210+ embedObjects : embedObjectsLabels
211211 } ,
212212 true
213213 ) ;
@@ -240,13 +240,13 @@ const AdvancePropertise = (props: SchemaProps) => {
240240 props ?. rowId ,
241241 {
242242 [ 'default_value' ] : option ?. key ,
243- validationRegex : currentToggleStates ?. validationRegex || '' ,
243+ validationRegex : currentToggleStates ?. validationRegex ?? '' ,
244244 mandatory : currentToggleStates ?. mandatory ,
245245 multiple : currentToggleStates ?. multiple ,
246246 unique : false ,
247247 nonLocalizable : currentToggleStates ?. nonLocalizable ,
248248 embedObject : currentToggleStates ?. embedObject ,
249- embedObjects : embedObjectslabels ,
249+ embedObjects : embedObjectsLabels ,
250250 options :options
251251 } ,
252252 true
@@ -271,13 +271,13 @@ const AdvancePropertise = (props: SchemaProps) => {
271271 props ?. rowId ,
272272 {
273273 [ 'default_value' ] : '' ,
274- validationRegex : currentToggleStates ?. validationRegex || '' ,
274+ validationRegex : currentToggleStates ?. validationRegex ?? '' ,
275275 mandatory : currentToggleStates ?. mandatory ,
276276 multiple : currentToggleStates ?. multiple ,
277277 unique : false ,
278278 nonLocalizable : currentToggleStates ?. nonLocalizable ,
279279 embedObject : currentToggleStates ?. embedObject ,
280- embedObjects : embedObjectslabels ,
280+ embedObjects : embedObjectsLabels ,
281281 options : options
282282 } ,
283283 true
@@ -294,12 +294,12 @@ const AdvancePropertise = (props: SchemaProps) => {
294294 } ;
295295
296296 const handleDragOver = ( e :React . DragEvent < HTMLDivElement > , index :number ) => {
297+ console . log ( "inside function" ) ;
298+
297299 e . preventDefault ( ) ;
298300 document . querySelectorAll ( '.element-wrapper' ) . forEach ( ( el , i ) => {
299301 if ( i === index ) {
300302 el . classList . remove ( 'dragging' ) ;
301- } else {
302- el . classList . remove ( 'dragging' ) ;
303303 }
304304 } ) ;
305305 } ;
@@ -350,25 +350,28 @@ const AdvancePropertise = (props: SchemaProps) => {
350350 < span className = 'read-only-text' > (read only)</ span >
351351 < div className = 'dropdown-choices-wrapper' >
352352 { options ?. map ( ( option : optionsType , index ) => (
353- < >
354- < div className = 'element-wrapper' key = { index } draggable
355- onDragStart = { ( ) => handleDragStart ( index ) }
356- onDragOver = { ( e ) => handleDragOver ( e , index ) }
357- onDrop = { ( ) => handleDrop ( index ) } >
358- < div
359-
360- className = 'term-drag-icon' >
361- < Icon icon = "ActionBar" size = 'medium' version = 'v2' />
362- </ div >
363- < TextInput version = { "v2" } placeholder = 'Enter value here'
364- suffixVisible = { true }
365- disabled = { true }
366- value = { option ?. key }
367- suffix = {
368- < >
369- { index === showIcon && < Icon icon = { 'CheckSquareOffset' } version = 'v2' size = 'medium' /> }
370-
371- </ > } > </ TextInput >
353+
354+ < div
355+ className = 'element-wrapper'
356+ key = { `${ index ?. toString ( ) } ` }
357+ draggable
358+ onDragStart = { ( ) => handleDragStart ( index ) }
359+ onDragOver = { ( e ) => handleDragOver ( e , index ) }
360+ onDrop = { ( ) => handleDrop ( index ) }
361+ >
362+ < div className = 'term-drag-icon' >
363+ < Icon icon = "ActionBar" size = 'medium' version = 'v2' />
364+ </ div >
365+ < TextInput
366+ version = { "v2" }
367+ placeholder = 'Enter value here'
368+ suffixVisible = { true }
369+ disabled = { true }
370+ value = { option ?. key }
371+ suffix = { index === showIcon && < Icon icon = { 'CheckSquareOffset' } version = 'v2' size = 'medium' /> }
372+ >
373+
374+ </ TextInput >
372375
373376 < Button buttonType = "light" version = { "v2" } onlyIcon = { true } canCloseOnClickOutside = { true }
374377 size = { 'small' } icon = { 'v2-DotsThreeLargeVertical' }
@@ -395,7 +398,7 @@ const AdvancePropertise = (props: SchemaProps) => {
395398
396399 </ div >
397400
398- </ > ) ) }
401+ ) ) }
399402
400403
401404 </ div >
@@ -544,7 +547,7 @@ const AdvancePropertise = (props: SchemaProps) => {
544547 props ?. updateFieldSettings (
545548 props ?. rowId ,
546549 {
547- validationRegex : toggleStates ?. validationRegex || '' ,
550+ validationRegex : toggleStates ?. validationRegex ?? '' ,
548551 embedObjects : embedObject
549552 } ,
550553 true ,
0 commit comments