[Horiz Layout] Columns#1979
Conversation
frontend/src/lib/DeltaParser.ts
Outdated
| : List() | ||
|
|
||
| return ImmutableMap({ element: list, reportId, metadata, deltaBlock }) | ||
| const existingEl = reportElement?.get("element") |
There was a problem hiding this comment.
Note: this is supposed to be a pure refactor, no functionality change.
| @@ -426,12 +449,7 @@ def expander(self, label=None, expanded=False): | |||
| return self._block(block_proto=block_proto) | |||
|
|
|||
| def favicon( | |||
There was a problem hiding this comment.
I really don't know why this keeps flopping back and forth. In any case, favicon() is an unused method; I'll kill it soonish
| const element = reportElement.get("element") | ||
|
|
||
| if (element instanceof List) { | ||
| // Recursive case AKA a single container AKA node with children |
lib/streamlit/delta_generator.py
Outdated
| return col_proto | ||
|
|
||
| horiz_proto = Block_pb2.Block() | ||
| horiz_proto.horizontal.unused = False |
There was a problem hiding this comment.
This unused name confused me. When I first read this, I assumed you were reclassifying columns to be a vertical layout which puzzled me. But I guess you just needed a dummy name to check if it exists?
There was a problem hiding this comment.
Yeah, needed to set something so that I could check against the presence of the Horizontal() proto later.
Set it to horizontal.unused = True, which I think makes a bit more sense.
| // Create a horizontal block as the parent for columns | ||
| // TODO: Calculate widths for children? We just pick a big number for now. | ||
| return ( | ||
| <div className="stBlock-horiz" style={{ display: "flex" }}> |
There was a problem hiding this comment.
The style tag is a bit ugly. Doesn't have to be part of this PR but would be great to have this in a styled component.
There was a problem hiding this comment.
That's a good point, I'll add a task to go through and clean up these up.
| // TODO: Calculate widths for children? We just pick a big number for now. | ||
| return ( | ||
| <div className="stBlock-horiz" style={{ display: "flex" }}> | ||
| {this.renderElements(8888)} |
There was a problem hiding this comment.
I was going to try this out but at this point, I'm just going to ask... but is width needed for horizontal block if we're going to flex it? From what i'm getting this renderElements will be just for the block and the children will end up running through the whole thing and hitting the autosizer below?
There was a problem hiding this comment.
Huh, you're absolutely right, actually; hadn't realized that was the case. Setting to "0" as an ignorable parameter, for now.
| ) | ||
| public render = (): ReactNode => { | ||
| if (this.props.deltaBlock?.horizontal) { | ||
| // Create a horizontal block as the parent for columns |
There was a problem hiding this comment.
Accurate for now but it'd be great to have horizontal blocks in the future that are not necessarily housing just columns
| // Create a horizontal block as the parent for columns | ||
| // TODO: Calculate widths for children? We just pick a big number for now. | ||
| return ( | ||
| <div className="stBlock-horiz" style={{ display: "flex", gap: "8px" }}> |
There was a problem hiding this comment.
Let's style this as a component too! Definitely a cleanup activity that can wait for another PR
* [Horizontal Layout] Implement st.container() (#1961) * Fix up dg._block() to be dg.container() * Add a unit test * Add an e2e test for st.container * Minor cleanups * Clean up variable names and comments * Clean up deltaPath code and docs * [Horizontal Layout] Implement `with DG` (#1964) * Force reinstall of setuptools to 49.6.0 (#1962) * try updating in virtualenv * new cache * am i using 39.0.1 and if so why is it failing? * somewhere somehow we are upgrading to setuptools 50.0.3... but where..? * looks like somewhere between setup + pipenv-install we get a newer version of setuptools * looks like somewhere between setup + pipenv-install we get a newer version of setuptools * force reinstall * looks like it's test requirements messing us up? * force reinstall + cleanup debugs * Fix up dg._block() to be dg.container() * Add a unit test * Add an e2e test for st.container * Minor cleanups * Clean up variable names and comments * Clean up deltaPath code and docs * Organize DGs in a tree, to track the `with DG` * Enable `with` in every st.foo call * Appease mypy with # type: ignore * More sacrifices at the altar of mypy * Add unit and e2e tests for with * Actually, don't rely on each DG mixin to call _active_dg Revert "Appease mypy with # type: ignore" This reverts commit 4ba7c47. Revert "Enable `with` in every st.foo call" This reverts commit 9b467d6. * Use the active DG for all "protected" class methods * Clean up DG docs * Don't switch DGs from add_rows Per Karrie's suggestion Co-authored-by: karrie <[email protected]> * [horiz-layout] Add collapsible_container (#1978) * Add collapsible_container * Add default collapsed * make label required + initial docs * Consolidate with WIP column work * Address PR comments for more cleanliness * Update e2e tests * Rename collapsible container (#1993) * rename to expander * Fix tests * Rename collapsible to expandable * [Horiz Layout] Columns (#1979) * Implement columns with variable widths * Add a e2e test for columns * Add a unit test * Update Prettier to 1.19 to allow optional chaining https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining * Fix e2e test * Downgrade Prettier back to 1.18 * Empty columns now take up space * Remove duplicate function from merge conflict * Use flex-gap instead of margin, so column sides don't get padded * Minor tweaks requested by code review * Prefix new layout methods with `beta_` Co-authored-by: karrie <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.