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": { "cardsblock": {
"block": true, "block": true,
@ -6152,6 +6183,10 @@
"type": "form", "type": "form",
"suffix": "form" "suffix": "form"
}, },
{
"type": "schema",
"suffix": "repeater"
},
{ {
"type": "static", "type": "static",
"suffix": "form", "suffix": "form",

View File

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

View File

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

View File

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

View File

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