Expose static repeater context for row index

This commit is contained in:
Andrew Kingston 2021-11-30 08:47:21 +00:00
parent f1b715e844
commit d2ce037297
2 changed files with 26 additions and 5 deletions

View File

@ -501,9 +501,20 @@
"defaultValue": "M" "defaultValue": "M"
} }
], ],
"context": { "context": [
"type": "schema" {
} "type": "schema"
},
{
"type": "static",
"values": [
{
"label": "Row Index",
"key": "index"
}
]
}
]
}, },
"stackedlist": { "stackedlist": {
"deprecated": true, "deprecated": true,
@ -3150,6 +3161,16 @@
} }
] ]
}, },
{
"type": "static",
"suffix": "repeater",
"values": [
{
"label": "Row Index",
"key": "index"
}
]
},
{ {
"type": "schema", "type": "schema",
"suffix": "repeater" "suffix": "repeater"

View File

@ -21,8 +21,8 @@
{#if $component.empty} {#if $component.empty}
<Placeholder /> <Placeholder />
{:else if rows.length > 0} {:else if rows.length > 0}
{#each rows as row} {#each rows as row, index}
<Provider data={row}> <Provider data={{ ...row, index }}>
<slot /> <slot />
</Provider> </Provider>
{/each} {/each}