-
Notifications
You must be signed in to change notification settings - Fork 4k
Align st.beta_columns #2811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align st.beta_columns #2811
Conversation
* remove extra padding * remove snapshot completely * add snapshot back in * remove snapshots * remove rest of snapshots * add snapshots back in
* autofocus clear cache button * add test * update test * fix lint
Point our `component-template` submodule to the latest commit in that repo. (Among other things, this will de-dupe a bunch of the `component-lib` code that used to live in `component-template` before being pulled into its own npm package.)
* Close streamlit#2699 * Override Thumb subcomponent completely * Fixed linting errors Co-authored-by: Ken McGrady <[email protected]>
Adds a new config option, `"client.showTracebacks"`. By default, it's `True`. If the option is set to `False`, then uncaught exceptions in a Streamlit app will result in a generic "Something went wrong!" warning in the browser, rather than the exception and its traceback This logic happens in the `error_util.handle_uncaught_app_exception` function, rather than directly within ScriptRunner. `scriptrunner_test`, `caching_test`, and `streamlit_test` have new tests that verify the right thing happens when exceptions are thrown in different circumstances with this config option turned on and off. Closes streamlit#1032
* remove nonexistent elements from widget states * fix typo * add test
* save changes * remove redundant change * fix tests * fix quotes * add tests and other fixes * fix lint * update protobufs and tests * add e2e test * fix quotes * update test
This reverts commit f886adc.
This reverts commit d3632d9.
This reverts commit 7c4400e.
|
I apologize for the excessive qty of commits, I accidentally started of a branch that had not been merged and I wanted to ensure those were not part of this commit. |
|
This looks amazing! That screenshot really sells this PR :) It looks like there are some tests that will need to be fixed up: https://app.circleci.com/pipelines/github/streamlit/streamlit/6698/workflows/165d4473-3b5b-447e-9057-9f6bbd615928/jobs/19160 st.multiselect.spec.js looks like a flake, and st_columns.spec.js probably just needs tweaking to look for the new flex values. st.image.spec will probably need to regenerate the image snapshot, though. Please let us know if you're having issues with any of those! |
|
@akrolsmir I am having some problems with running tests locally. I am working through it, but I did adjust the column_spec so it will hopefully pass. pretty sure st.multiselect.spec.js is a flake since it failed on my other pull request. |
|
After, removing all global pip packages, clean installing pyenv and python, then running/fixing brew doctor. Everything is installing correctly now and all tests run. I should be able to work through and fix everything now. Something unrelated, I believe, I keep getting failure on the data-frame demo locally... |
|
@akrolsmir All checks have now passed! |
|
Hi @RedFrez Sorry for the delay! I took a look. Overall, this is positive addition, but I was concerned by the following:
Separately is use of I think overall it's still worth merging given above. Let me know if you have any thoughts. |
|
Ah, great investigation, @kmcgrady ! Just some quick thoughts:
And the fact that gap is unsupported in Safari is actually quite annoying, and agreed that CSS grid may be a future ideal improvement. When I was first implementing this, I didn't have a particular principled reason behind choosing Flexbox over CSS Grid, and I'm happy to have that decision revisited! Totally agreed that it's out of scope for this PR; and it's very much worth merging this improvement :) |
|
This solution was what I determined would be the least change for accomplishing the current goal. @kmcgrady I think it definitely would be better to have only gap or padding, but it would require for more information to be available for calculations. The potential break in flow could be accommodated by reducing the overall percentage a little bit which would have a little extra space available to grow into. I wonder if Safari will end up following the path of IE… I did verify and the gap does not show up for flex. From the aspect of use case, I do think Grid fits better since the content will never flow or wrap from one column to another. Grid could also provide opportunities for the future of adding rows to the columns that are aligned, versus having the create new columns. The main downfall with Grid that I see, is that it requires extra work to make it flexible when the columns aren’t equal width. Also, it seems like the gap drives offsets with Grid regardless of if percentages or the fractional unit is used. For either Grid or Flex, I think it would be helpful if the total qty of columns were passed to the styled component, as it would allow for calculation of padding that is needing to be adjusted for. I was trying to play with it some, but unfortunately I have limited Proto experience to be able to make any successful changes. @akrolsmir I added a short comment for documentation to the Horizontal Block. For this comment under // The minimal viewport width used to determine the minimal
// fixed column width while accounting for column proportions.
// Randomly selected based on visual experimentation.is it from old styling? Does it still apply or should it be removed? Also, I don’t think the width property actually does anything with the current setup, and might be worth removing (after I re-verify it doesn’t actually affect anything if gone). |
|
@RedFrez that comment for Looking at this. I'm going to merge it in. Thank you for your help in this! |
* develop: Align st.beta_columns (streamlit#2811)
* develop: `watch_file` utility function (streamlit#2851) Align st.beta_columns (streamlit#2811)
* develop: st.beta_secrets (streamlit#2757) `watch_file` utility function (streamlit#2851) Align st.beta_columns (streamlit#2811)
* develop: (29 commits) Update bug_report.md Refactor CodeBlock.tsx (#2814) Remove copy button for empty codeblocks (#2808) Add image format deprecation config with expiration (#2865) Remove unneeded "use_column_width=True" from our doc examples (#2692) Extend our st.cache MagicMock handling logic to Mock (#2846) save work (#2862) Remove .stale-element class (#2848) Release 0.77 (#2849) Fix watchdog import failure (#2856) 🔥 Fully remove `format` param from st.image (#2637) Don't memoize config._server_headless (#2858) hide empty columns on mobile (#2756) st.beta_secrets (#2757) `watch_file` utility function (#2851) Align st.beta_columns (#2811) Update "showErrorDetails" config description and docs (#2841) Pause Dependabot updates for non-security-related issues (#2840) client.showTracebacks -> showErrorDetails (per product) (#2837) Color picker - show value (#2817) ...
Based off of #2716. Minor adjustments to padding, gap and flex/flex-basis to better align columns between different rows.
Gap affects alignment since "expands" the content box and is affected by how many columns are in a row. Padding (with border-box sizing) does not affect row no matter how many columns.
Currently, both padding-left and gaps are used.
This change alters it to use just padding-left for regular screen sizes, and then only gap when smaller.
The removal of padding-left for smaller sizes was driven by that a column maintained its left padding even after the row was wrapped and it no longer needed it. This caused misalignment along the left size of the inputs. Gap automatically accommodates for the columns at the exterior.
To adjust spacing since only gap or padding is used now, I increased the spacing from
theme.spacing.smtotheme.spacing.md.The other change was to shift the flex-basis (controlled by flex) parameter to use percentages instead of just numbers for the row. This defines the initial width of each column to be based off the percentage of the container width. Using just the weight numbers directly controls how the "extra" space outside of the content gets divided.
A good image from the w3 spec:
Results image (also provided in issue):