File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,6 @@ export function buildFieldSchema(
298298
299299 // Clone the schema to avoid mutating the original, as we'll be adding computed attributes to it
300300 let schemaCopy = safeDeepClone ( schema )
301- // schemaCopy['x-jsf-presentation'] = schemaCopy?.['x-jsf-presentation'] || {}
302301
303302 const computedSchema = jsonLogicContext ? buildSchemaBasedOnComputedAttrs ( schema , jsonLogicContext ) : undefined
304303
Original file line number Diff line number Diff line change @@ -201,10 +201,18 @@ function computeObjectValues(
201201
202202 const computedObjectValues : Record < string , string > = { }
203203
204- Object . entries ( value ) . forEach ( ( [ key , message ] ) => {
205- let computedMessage = message
206- if ( containsHandlebars ( message ) ) {
207- computedMessage = interpolate ( message , jsonLogicContext )
204+ Object . entries ( value ) . forEach ( ( [ key , value ] ) => {
205+ let computedMessage = value
206+ // If the message contains handlebars, interpolate it
207+ if ( containsHandlebars ( value ) ) {
208+ computedMessage = interpolate ( value , jsonLogicContext )
209+ }
210+ else {
211+ // Check if the object value is the name of a computed value and if so, calculate it
212+ const rule = jsonLogicContext ?. schema ?. computedValues ?. [ value ] ?. rule
213+ if ( rule ) {
214+ computedMessage = jsonLogic . apply ( rule , replaceUndefinedAndNullValuesWithNaN ( jsonLogicContext . value as ObjectValue ) )
215+ }
208216 }
209217 computedObjectValues [ key ] = computedMessage
210218 } )
You can’t perform that action at this time.
0 commit comments