@@ -82,18 +82,24 @@ export const FieldWrapper = ( props ) => {
8282 // Sort out different shapes that we could get the help text in.
8383 // It's possible to get an array of strings for the help text, but it
8484 // will usually be a string.
85- const shouldShowHelpText = helpText && ( 'help' !== helpText ) ;
85+ const shouldShowHelpText = helpText && (
86+ 'help' !== helpText
87+ ) ;
8688
8789 const helpTextString = Array . isArray ( helpText ) ? helpText [ 0 ] : helpText ;
88- const helpLink = ( Array . isArray ( helpText ) && ! ! helpText [ 1 ] )
90+ const helpLink = (
91+ Array . isArray ( helpText ) && ! ! helpText [ 1 ]
92+ )
8993 ? helpText [ 1 ]
9094 : undefined ;
9195
9296 // Some fields show a label, and some don't.
9397 // Others get a description and others don't.
9498 const showLabel = (
9599 'heading' !== fieldType &&
96- ( 'html' !== fieldType || ! htmlNoLabel ) &&
100+ (
101+ 'html' !== fieldType || ! htmlNoLabel
102+ ) &&
97103 ! fieldEmbed
98104 ) ;
99105
@@ -110,7 +116,9 @@ export const FieldWrapper = ( props ) => {
110116 const passAllPodFieldsMap = isBooleanGroupField ;
111117
112118 // Make all values into an array, to make handling repeatable fields easier.
113- const valuesArray = ( isRepeatable && Array . isArray ( value ) )
119+ const valuesArray = (
120+ isRepeatable && Array . isArray ( value )
121+ )
114122 ? value
115123 : [ value ] ;
116124
@@ -136,16 +144,16 @@ export const FieldWrapper = ( props ) => {
136144 && field ?. required
137145 ) {
138146 // Check if we have a field value.
139- let fieldValue = undefined ;
140- let fieldVariation = undefined ;
147+ let fieldValue ;
148+ let fieldVariation ;
141149
142- let variations = [
150+ const variations = [
143151 field . name ,
144152 'pods_meta_' + field . name ,
145153 'pods_field_' + field . name ,
146154 ] ;
147155
148- variations . every ( variation => {
156+ variations . every ( ( variation ) => {
149157 // Stop the loop if we found the value we were looking for.
150158 if ( 'undefined' !== typeof allPodValues [ variation ] ) {
151159 fieldValue = allPodValues [ variation ] ;
@@ -161,8 +169,8 @@ export const FieldWrapper = ( props ) => {
161169 if (
162170 '' === fieldValue
163171 || (
164- 'undefined' !== typeof field ?. data [ '' ]
165- && field ?. data [ '' ] === fieldValue
172+ 'undefined' !== typeof field ?. data [ '' ]
173+ && field ?. data [ '' ] === fieldValue
166174 )
167175 ) {
168176 setValue ( field ?. default ?? '' ) ;
@@ -190,7 +198,7 @@ export const FieldWrapper = ( props ) => {
190198 condition : ( ) => true === toBool ( required ) ,
191199 } ,
192200 ] ,
193- value
201+ value ,
194202 ) ;
195203
196204 // Handle Block Editor save lock.
@@ -230,71 +238,75 @@ export const FieldWrapper = ( props ) => {
230238 const inputComponents = ! ! FieldComponent ? (
231239 < FieldErrorBoundary >
232240 < div className = "pods-field-wrapper" >
233- { ( ( ) => {
234- if ( true === isBooleanGroupField ) {
241+ { (
242+ ( ) => {
243+ if ( true === isBooleanGroupField ) {
244+ return (
245+ < FieldComponent
246+ storeKey = { storeKey }
247+ values = { values }
248+ podName = { podName }
249+ podType = { podType }
250+ allPodValues = { passAllPodValues ? allPodValues : undefined }
251+ allPodFieldsMap = { passAllPodFieldsMap ? allPodFieldsMap : undefined }
252+ setOptionValue = { setOptionValue }
253+ isValid = { ! validationMessages . length }
254+ addValidationRules = { addValidationRules }
255+ setHasBlurred = { ( ) => setHasBlurred ( true ) }
256+ fieldConfig = { field }
257+ />
258+ ) ;
259+ }
260+
261+ if ( true === isRepeatable ) {
262+ return (
263+ < RepeatableFieldList
264+ storeKey = { storeKey }
265+ fieldConfig = { processedFieldConfig }
266+ valuesArray = { valuesArray }
267+ FieldComponent = { FieldComponent }
268+ podType = { podType }
269+ podName = { podName }
270+ allPodValues = { passAllPodValues ? allPodValues : undefined }
271+ allPodFieldsMap = { passAllPodFieldsMap ? allPodFieldsMap : undefined }
272+ setFullValue = { setValue }
273+ setHasBlurred = { ( ) => setHasBlurred ( true ) }
274+ />
275+ ) ;
276+ }
277+
235278 return (
236279 < FieldComponent
237280 storeKey = { storeKey }
238- values = { values }
281+ value = { value }
239282 podName = { podName }
240283 podType = { podType }
241- allPodValues = { passAllPodValues ? allPodValues : undefined }
242- allPodFieldsMap = { passAllPodFieldsMap ? allPodFieldsMap : undefined }
243- setOptionValue = { setOptionValue }
284+ allPodValues = { allPodValues }
285+ allPodFieldsMap = { allPodFieldsMap }
286+ setValue = { setValue }
244287 isValid = { ! validationMessages . length }
245288 addValidationRules = { addValidationRules }
246289 setHasBlurred = { ( ) => setHasBlurred ( true ) }
247- fieldConfig = { field }
248- />
249- ) ;
250- }
251-
252- if ( true === isRepeatable ) {
253- return (
254- < RepeatableFieldList
255- storeKey = { storeKey }
256290 fieldConfig = { processedFieldConfig }
257- valuesArray = { valuesArray }
258- FieldComponent = { FieldComponent }
259- podType = { podType }
260- podName = { podName }
261- allPodValues = { passAllPodValues ? allPodValues : undefined }
262- allPodFieldsMap = { passAllPodFieldsMap ? allPodFieldsMap : undefined }
263- setFullValue = { setValue }
264- setHasBlurred = { ( ) => setHasBlurred ( true ) }
265291 />
266292 ) ;
267293 }
268-
269- return (
270- < FieldComponent
271- storeKey = { storeKey }
272- value = { value }
273- podName = { podName }
274- podType = { podType }
275- allPodValues = { allPodValues }
276- allPodFieldsMap = { allPodFieldsMap }
277- setValue = { setValue }
278- isValid = { ! validationMessages . length }
279- addValidationRules = { addValidationRules }
280- setHasBlurred = { ( ) => setHasBlurred ( true ) }
281- fieldConfig = { processedFieldConfig }
282- />
283- ) ;
284- } ) ( ) }
294+ ) ( ) }
285295 </ div >
286296 </ FieldErrorBoundary >
287297 ) : (
288298 < span className = "pods-field-option__invalid-field" >
289299 { sprintf (
290300 // translators: %s is the field type.
291301 __ ( 'The field type \'%s\' was invalid.' , 'pods' ) ,
292- fieldType
302+ fieldType ,
293303 ) }
294304 </ span >
295305 ) ;
296306
297- const validationMessagesComponent = ( hasBlurred && validationMessages . length ) ? (
307+ const validationMessagesComponent = (
308+ hasBlurred && validationMessages . length
309+ ) ? (
298310 < ValidationMessages messages = { validationMessages } />
299311 ) : undefined ;
300312
@@ -406,8 +418,10 @@ const MemoizedFieldWrapper = React.memo(
406418
407419 // Look up the dependencies, we may need to re-render if any of the
408420 // values have changed.
409- const allDependencyFieldSlugs = ( nextProps . field ?. conditional_logic ?. rules || [ ] ) . map (
410- ( rule ) => rule . field
421+ const allDependencyFieldSlugs = (
422+ nextProps . field ?. conditional_logic ?. rules || [ ]
423+ ) . map (
424+ ( rule ) => rule . field ,
411425 ) ;
412426
413427 // If it's a boolean group, there are also subfields to check.
@@ -416,9 +430,13 @@ const MemoizedFieldWrapper = React.memo(
416430
417431 subfields . forEach ( ( subfield ) => {
418432 allDependencyFieldSlugs . push (
419- ...( ( subfield ?. conditional_logic ?. rules || [ ] ) . map (
420- ( rule ) => rule . field
421- ) )
433+ ...(
434+ (
435+ subfield ?. conditional_logic ?. rules || [ ]
436+ ) . map (
437+ ( rule ) => rule . field ,
438+ )
439+ ) ,
422440 ) ;
423441 } ) ;
424442 }
@@ -444,9 +462,13 @@ const MemoizedFieldWrapper = React.memo(
444462 }
445463
446464 parentDependencySlugs . push (
447- ...( ( parentField ?. conditional_logic ?. rules || [ ] ) . map (
448- ( rule ) => rule . field
449- ) )
465+ ...(
466+ (
467+ parentField ?. conditional_logic ?. rules || [ ]
468+ ) . map (
469+ ( rule ) => rule . field ,
470+ )
471+ ) ,
450472 ) ;
451473 } ) ;
452474
@@ -458,7 +480,7 @@ const MemoizedFieldWrapper = React.memo(
458480 ...dependencyFieldSlugs ,
459481 ...parentDependencySlugs ,
460482 ...nextLevelSlugs ,
461- ]
483+ ] ,
462484 ) ;
463485 } ;
464486
@@ -474,7 +496,7 @@ const MemoizedFieldWrapper = React.memo(
474496 } ) ;
475497
476498 return ! haveAnyDependenciesChanged ;
477- }
499+ } ,
478500) ;
479501
480502export default MemoizedFieldWrapper ;
0 commit comments