Resolve "Repeat element: add current_record data provider support"
What is in this MR
This MR is the third step in getting the repeat element implemented. In this MR we refactor how applicationContext
object is provided/injected in components, which ensures that in appropriate components we include the element
and recordIndex
(if the element is a collection element). This makes it possible for the RepeatElement
to use the current_record
data provider.
What is not in this MR
- The
current_record
provider will look for the first collection element ancestor of the element it's been given to find the correct list data source. If the element is already a collection element, we'll use that element's data source. The consequence of this is that you can nestRepeatElement
, but you can only use thecurrent_record
of the immediate collection element, not any further up the chain. This will come in a future MR. - It's not possible to nest a
RepeatElement
in aColumnElement
, the latter will prevent it. We can look at more nesting options in #2569 (closed).
How to test this MR
- Create a page.
- Add a list data source to it.
- Add a repeat element to the page, connect it to the list data source.
- Adding child elements to it, and in child elements, use the
current_record
provider in their formulas. Confirm it all repeats properly. - Add a repeat element inside a repeat element, with different data sources, confirm that the children of each repeat element only uses the
current_record
of their immediate repeat element ancestor. For example:-
RepeatA
(dataSourceA
)-
HeadingA
(can repeatcurrent_record
ofdataSourceA
). -
RepeatB
(dataSourceB
)-
ColumnElement
-
HeadingB
(can repeatcurrent_record
ofdataSourceB
).
-
-
-
-
Merge Request Checklist
-
changelog.md has been updated if required.- I'll make a changelog entry in the final MR.
-
New/updated Premium/Enterprise features are separated correctly in the premium or enterprise folder -
The latest Chrome and Firefox have been used to test any new frontend features -
Documentation has been updated -
Quality Standards are met -
Performance: tables are still fast with 100k+ rows, 100+ field tables -
The redoc API pages have been updated for any REST API changes -
Our custom API docs are updated for changes to endpoints accessed via api tokens -
The UI/UX has been updated following UI Style Guide
Closes #2583 (closed)
Edited by Peter Evans