Fix for Data provider pageNumber binding. Global repeater context flag. Add provider context to table block. Expose rows in form blocks

This commit is contained in:
Dean 2024-01-17 10:04:40 +00:00
parent 50abdf2e63
commit f03d49f3d3
5 changed files with 44 additions and 3 deletions

View File

@ -5602,7 +5602,38 @@
}
]
}
],
"context": {
"type": "static",
"suffix": "provider",
"values": [
{
"label": "Rows",
"key": "rows",
"type": "array"
},
{
"label": "Extra Info",
"key": "info",
"type": "string"
},
{
"label": "Rows Length",
"key": "rowsLength",
"type": "number"
},
{
"label": "Schema",
"key": "schema",
"type": "object"
},
{
"label": "Page Number",
"key": "pageNumber",
"type": "number"
}
]
}
},
"cardsblock": {
"block": true,
@ -6152,6 +6183,10 @@
"type": "form",
"suffix": "form"
},
{
"type": "schema",
"suffix": "repeater"
},
{
"type": "static",
"suffix": "form",

View File

@ -71,7 +71,7 @@
datasource: dataSource || {},
schema,
rowsLength: $fetch.rows.length,
pageNumber: $fetch.pageNumber + 1,
// Undocumented properties. These aren't supposed to be used in builder
// bindings, but are used internally by other components
id: $component?.id,

View File

@ -9,6 +9,7 @@
export let hAlign
export let vAlign
export let gap
export let nested = false
const { Provider, ContextScopes } = getContext("sdk")
const component = getContext("component")
@ -22,7 +23,10 @@
<Placeholder />
{:else if rows.length > 0}
{#each rows as row, index}
<Provider data={{ ...row, index }} scope={ContextScopes.Local}>
<Provider
data={{ ...row, index }}
scope={nested ? ContextScopes.Global : ContextScopes.Local}
>
<slot />
</Provider>
{/each}

View File

@ -231,6 +231,7 @@
paginate,
limit: rowCount,
}}
context="provider"
order={1}
>
<BlockComponent

View File

@ -55,6 +55,7 @@
noRowsMessage: noRowsMessage || "We couldn't find a row to display",
direction: "column",
hAlign: "center",
nested: true,
}}
>
<slot />