Fix data binding not generating bindable properties for components referencing a data provider ID wrapped for handlebars
This commit is contained in:
parent
928b9ca9a3
commit
b9fe600a9b
|
@ -74,13 +74,9 @@ export const getDatasourceForProvider = (asset, component) => {
|
||||||
})
|
})
|
||||||
if (dataProviderSetting) {
|
if (dataProviderSetting) {
|
||||||
const settingValue = component[dataProviderSetting.key]
|
const settingValue = component[dataProviderSetting.key]
|
||||||
const providerId = settingValue?.match(/{{\s*literal\s+(\S+)\s*}}/)[1]
|
const providerId = extractLiteralHandlebarsID(settingValue)
|
||||||
if (providerId) {
|
const provider = findComponent(asset.props, providerId)
|
||||||
const provider = findComponent(asset.props, providerId)
|
return getDatasourceForProvider(asset, provider)
|
||||||
return getDatasourceForProvider(asset, provider)
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract datasource from component instance
|
// Extract datasource from component instance
|
||||||
|
@ -135,11 +131,9 @@ const getContextBindings = (asset, componentId) => {
|
||||||
let datasource
|
let datasource
|
||||||
const setting = contextDefinition.dataProviderSetting
|
const setting = contextDefinition.dataProviderSetting
|
||||||
const settingValue = component[setting]
|
const settingValue = component[setting]
|
||||||
if (settingValue) {
|
const providerId = extractLiteralHandlebarsID(settingValue)
|
||||||
const providerId = settingValue.match(/{{\s*literal\s+(\S+)\s*}}/)[1]
|
const provider = findComponent(asset.props, providerId)
|
||||||
const provider = findComponent(asset.props, providerId)
|
datasource = getDatasourceForProvider(asset, provider)
|
||||||
datasource = getDatasourceForProvider(asset, provider)
|
|
||||||
}
|
|
||||||
if (!datasource) {
|
if (!datasource) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -367,6 +361,17 @@ function bindingReplacement(bindableProperties, textWithBindings, convertTo) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts a component ID from a handlebars expression setting of
|
||||||
|
* {{ literal [componentId] }}
|
||||||
|
*/
|
||||||
|
function extractLiteralHandlebarsID(value) {
|
||||||
|
if (!value) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return value.match(/{{\s*literal[\s\[]+([a-fA-F0-9]+)[\s\]]*}}/)[1]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a readable data binding into a runtime data binding
|
* Converts a readable data binding into a runtime data binding
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue