(content, flow, size, scope=None, position=OutputPosition.BOTTOM)
| 1347 | |
| 1348 | |
| 1349 | def _row_column_layout(content, flow, size, scope=None, position=OutputPosition.BOTTOM) -> Output: |
| 1350 | if not isinstance(content, (list, tuple, OutputList)): |
| 1351 | content = [content] |
| 1352 | |
| 1353 | if not size: |
| 1354 | size = ' '.join('1fr' if c is not None else '10px' for c in content) |
| 1355 | |
| 1356 | content = [c if c is not None else put_html('<div></div>') for c in content] |
| 1357 | for item in content: |
| 1358 | assert isinstance(item, Output), "put_row()/put_column()'s content must be list of put_xxx()" |
| 1359 | |
| 1360 | style = 'grid-auto-flow: {flow}; grid-template-{flow}s: {size};'.format(flow=flow, size=size) |
| 1361 | tpl = """ |
| 1362 | <div style="display: grid; %s"> |
| 1363 | {{#contents}} |
| 1364 | {{& pywebio_output_parse}} |
| 1365 | {{/contents}} |
| 1366 | </div>""".strip() % html.escape(style, quote=True) |
| 1367 | return put_widget(template=tpl, data=dict(contents=content), scope=scope, |
| 1368 | position=position) |
| 1369 | |
| 1370 | |
| 1371 | @safely_destruct_output_when_exp('content') |
no test coverage detected
searching dependent graphs…