(
header: str,
inline_details="",
details="",
n_items=None,
enabled=True,
collapsed=False,
span_grid=False,
)
| 178 | |
| 179 | |
| 180 | def collapsible_section( |
| 181 | header: str, |
| 182 | inline_details="", |
| 183 | details="", |
| 184 | n_items=None, |
| 185 | enabled=True, |
| 186 | collapsed=False, |
| 187 | span_grid=False, |
| 188 | ) -> str: |
| 189 | # "unique" id to expand/collapse the section |
| 190 | data_id = "section-" + str(uuid.uuid4()) |
| 191 | |
| 192 | has_items = n_items is not None and n_items |
| 193 | n_items_span = "" if n_items is None else f" <span>({n_items})</span>" |
| 194 | enabled_attr = "" if enabled and has_items else " disabled" |
| 195 | collapsed_attr = "" if collapsed or not has_items else " checked" |
| 196 | span_grid_attr = " xr-span-grid" if span_grid else "" |
| 197 | tip = " title='Expand/collapse section'" if enabled_attr == "" else "" |
| 198 | html = ( |
| 199 | f"<input id='{data_id}' class='xr-section-summary-in' type='checkbox'{enabled_attr}{collapsed_attr} />" |
| 200 | f"<label for='{data_id}' class='xr-section-summary{span_grid_attr}'{tip}>{header}{n_items_span}</label>" |
| 201 | f"<div class='xr-section-inline-details'>{inline_details}</div>" |
| 202 | ) |
| 203 | if details: |
| 204 | html += f"<div class='xr-section-details'>{details}</div>" |
| 205 | return html |
| 206 | |
| 207 | |
| 208 | def _mapping_section( |
no outgoing calls
no test coverage detected
searching dependent graphs…