Comment some parts of blocks implementation for clarity

This commit is contained in:
Andrew Kingston 2021-11-02 08:58:50 +00:00
parent 0f1d9c4de3
commit e43aba075e
3 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,9 @@
const component = getContext("component")
const { styleable } = getContext("sdk")
// We need to set a block context to know we're inside a block, but also
// to be able to reference the actual component ID of the block from
// any depth
setContext("block", {
id: $component.id,
})

View File

@ -6,6 +6,9 @@
export let type
export let props
export let styles
// ID is only exposed as a prop so that it can be bound to from parent
// block components
export let id
const block = getContext("block")
@ -14,6 +17,8 @@
$: id = block.id + rand
$: instance = createInstance(type, props, id)
// Create a fake component instance so that we can use the core Component
// to render this part of the block, taking advantage of binding enrichment
const createInstance = (type, props, id) => {
return {
_component: `@budibase/standard-components/${type}`,

View File

@ -21,6 +21,7 @@
$: enrichedFilter = enrichFilter(filter, searchColumns, formId)
// Enrich the default filter with the specified search fields
const enrichFilter = (filter, searchColumns, formId) => {
let enrichedFilter = [...(filter || [])]
searchColumns?.forEach(column => {