Fix table row selection bindings not being generated, add row selection bindings for table blocks, update readable text for row selection bindings
This commit is contained in:
parent
08d6e104c7
commit
664fd945f4
|
@ -32,7 +32,7 @@ export const getBindableProperties = (asset, componentId) => {
|
||||||
const urlBindings = getUrlBindings(asset)
|
const urlBindings = getUrlBindings(asset)
|
||||||
const deviceBindings = getDeviceBindings()
|
const deviceBindings = getDeviceBindings()
|
||||||
const stateBindings = getStateBindings()
|
const stateBindings = getStateBindings()
|
||||||
const rowBindings = getRowBindings(asset, componentId)
|
const rowBindings = getRowBindings(asset)
|
||||||
return [
|
return [
|
||||||
...contextBindings,
|
...contextBindings,
|
||||||
...urlBindings,
|
...urlBindings,
|
||||||
|
@ -320,22 +320,33 @@ const getDeviceBindings = () => {
|
||||||
/**
|
/**
|
||||||
* Gets all row bindings that are globally available.
|
* Gets all row bindings that are globally available.
|
||||||
*/
|
*/
|
||||||
const getRowBindings = () => {
|
const getRowBindings = asset => {
|
||||||
let tables = []
|
|
||||||
getAllAssets().forEach(asset => {
|
|
||||||
tables = findAllMatchingComponents(asset.props, component =>
|
|
||||||
component._component.endsWith("table")
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
let bindings = []
|
let bindings = []
|
||||||
if (get(store).clientFeatures?.rowSelection) {
|
if (get(store).clientFeatures?.rowSelection) {
|
||||||
|
// Add bindings for table components
|
||||||
|
let tables = findAllMatchingComponents(asset.props, component =>
|
||||||
|
component._component.endsWith("table")
|
||||||
|
)
|
||||||
const safeState = makePropSafe("rowSelection")
|
const safeState = makePropSafe("rowSelection")
|
||||||
bindings = tables.map(table => ({
|
bindings = bindings.concat(
|
||||||
type: "context",
|
tables.map(table => ({
|
||||||
runtimeBinding: `${safeState}.${makePropSafe(table._id)}`,
|
type: "context",
|
||||||
readableBinding: `${table._instanceName}.Rows`,
|
runtimeBinding: `${safeState}.${makePropSafe(table._id)}`,
|
||||||
}))
|
readableBinding: `${table._instanceName}.Selected rows`,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
// Add bindings for table blocks
|
||||||
|
let tableBlocks = findAllMatchingComponents(asset.props, component =>
|
||||||
|
component._component.endsWith("tableblock")
|
||||||
|
)
|
||||||
|
bindings = bindings.concat(
|
||||||
|
tableBlocks.map(block => ({
|
||||||
|
type: "context",
|
||||||
|
runtimeBinding: `${safeState}.${makePropSafe(block._id + "-table")}`,
|
||||||
|
readableBinding: `${block._instanceName}.Selected rows`,
|
||||||
|
}))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return bindings
|
return bindings
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue