Replace bindings to link fields with new count runtime property
This commit is contained in:
parent
42019dd546
commit
448b0ca2ae
|
@ -95,15 +95,23 @@ const contextToBindables = (models, walkResult) => context => {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const newBindable = ([key, fieldSchema]) => ({
|
const newBindable = ([key, fieldSchema]) => {
|
||||||
type: "context",
|
// Replace link bindings with a new property representing the count
|
||||||
fieldSchema,
|
let runtimeBoundKey = key
|
||||||
instance: context.instance,
|
if (fieldSchema.type === "link") {
|
||||||
// how the binding expression persists, and is used in the app at runtime
|
runtimeBoundKey = `${key}_count`
|
||||||
runtimeBinding: `${contextParentPath}data.${key}`,
|
}
|
||||||
// how the binding exressions looks to the user of the builder
|
|
||||||
readableBinding: `${context.instance._instanceName}.${model.name}.${key}`,
|
return {
|
||||||
})
|
type: "context",
|
||||||
|
fieldSchema,
|
||||||
|
instance: context.instance,
|
||||||
|
// how the binding expression persists, and is used in the app at runtime
|
||||||
|
runtimeBinding: `${contextParentPath}data.${runtimeBoundKey}`,
|
||||||
|
// how the binding expressions looks to the user of the builder
|
||||||
|
readableBinding: `${context.instance._instanceName}.${model.name}.${key}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Object.entries(schema)
|
Object.entries(schema)
|
||||||
|
|
Loading…
Reference in New Issue