insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
171 stars 34 forks source link

move `label` of `teal_module(s)` from list element to attribute #1117

Closed chlebowa closed 4 months ago

chlebowa commented 6 months ago

In short: the label property of teal_module and teal_modules objects are moved from a list element to an attribute. This will make it less of a headache to write recursive functions. Unfortunately, we will not be able to use rapply as it requires that the "bottom" class not be list-like, which teal_module is.

teal_modules is no longer a list of length 2 with label and children elements, the latter being a list of teal_module or teal_modules, but rather a list of teal_module/teal_modules objects with a label attribute. In essence, teal_modules is now what teal_modules$children was. As a consequence, the label of a teal_module is moved to attribute accordingly.

Added function module_label for convenient extraction of the label attribute.

STATUS

Introduced core changes. Tests pass. There are probably places downstream that will be modified.

Conflicts with https://github.com/insightsengineering/teal/pull/1090 will be substantial.

m7pr commented 6 months ago

kudos for starting on that!