-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Fix and improve resizing in editor (incl. Add Spacer component) #2818
Merged
Merged
Changes from 34 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
1fc9961
Allow DataGrid height to be styled, fix HUD position in full-page ele…
apedroferreira 87cbb61
Only use bottom inner hint position if defaulting to bottom position
apedroferreira e04aff2
Update NodeHud.tsx
apedroferreira 340041f
Merge branch 'master' into fix-containers
apedroferreira 95d16f6
Fix creating new page with blur and default name + scroll only below …
apedroferreira 50b9c7d
Fix resizing inside columns
apedroferreira eb1e0b7
Merge remote-tracking branch 'origin/fix-containers' into resizing-fixes
apedroferreira cf7f783
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 97ec428
Fix resizing, add Spacer component (WIP)
apedroferreira 4fb61b3
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 20a5764
Vertical resizing with spacer (ongoing)
apedroferreira 62e3ce1
Fix duplication in page root
apedroferreira 4019fcb
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira fbfca0b
Fix more bugs, new layout height system
apedroferreira 6f0aaec
Add snapshot tests for vertical resizing of elements
apedroferreira 1a40eaa
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 007c311
Improve Spacer component height
apedroferreira 5e25447
Fix highlight in slots
apedroferreira fa07e97
Update schemas
apedroferreira d2c5a8b
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 0471351
Fix Chart component height
apedroferreira 5a40939
Update docs
apedroferreira 44fd577
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 9cbe298
Continue merge, seeing if I can still turn this PR into something useful
apedroferreira 189a104
More merge fixes
apedroferreira 0e06cc0
Make elements always fill column space
apedroferreira afb84ae
More adjustments
apedroferreira 3980eae
Regenerate docs
apedroferreira af6a74f
Block invalid top resize
apedroferreira 7523bb7
Disable resizing from top for now, it's still not good enough
apedroferreira 9e967de
Nevermind UX is bad anyway in some cases
apedroferreira 8608ab4
Revert "Nevermind UX is bad anyway in some cases"
apedroferreira 0efe12b
Fix spread method
apedroferreira 64ce555
Re-add todos, this would take too much time
apedroferreira f867615
Line spacing
apedroferreira 11caaa3
More tests behaving differently for no reason
apedroferreira 01f7c34
Still don't know what's wrong
apedroferreira 16db5e6
Fix tests not passing if component catalog needs to scroll
apedroferreira f05c44b
I don't think this condition is ever true
apedroferreira ffcf428
Fix fixtures
apedroferreira 1ae8a85
Remove test.only
apedroferreira 1dba2a3
Make Spacer height resizable
apedroferreira 6e1e06c
Remove Spacer component
apedroferreira 5fcc01c
Merge remote-tracking branch 'upstream/master' into resizing-fixes
apedroferreira 19f3ef5
Unused imports
apedroferreira 7b9c763
Revert "Remove Spacer component"
apedroferreira bc14881
Readjust
apedroferreira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- ATTENTION: DO NOT EDIT! This file has been auto-generated using `pnpm docs:build:api`. --> | ||
|
||
# Spacer | ||
|
||
<p class="description">API docs for the Toolpad Spacer component.</p> | ||
|
||
Spacer component. | ||
It allows for creating space between elements. | ||
|
||
## Properties | ||
|
||
| Name | Type | Default | Description | | ||
| :-------------------------------- | :------------------------------------ | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| <span class="prop-name">sx</span> | <span class="prop-type">object</span> | | The [`sx` prop](https://mui.com/system/getting-started/the-sx-prop/) is used for defining custom styles that have access to the theme. All MUI System properties are available via the `sx` prop. In addition, the `sx` prop allows you to specify any other CSS rules you may need. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* ATTENTION: DO NOT EDIT! This file has been auto-generated using `pnpm docs:build:api`. */ | ||
|
||
import * as React from 'react'; | ||
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs'; | ||
import * as pageProps from '../../../../data/toolpad/reference/components/spacer.md?@mui/markdown'; | ||
|
||
export default function Page() { | ||
return <MarkdownDocs {...pageProps} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,6 +518,7 @@ function expandFromDom<N extends appDom.AppDomNode>( | |
name: node.name, | ||
layout: undefinedWhenEmpty({ | ||
columnSize: node.layout?.columnSize, | ||
height: node.layout?.height, | ||
horizontalAlign: stringOnly(node.layout?.horizontalAlign), | ||
verticalAlign: stringOnly(node.layout?.verticalAlign), | ||
}), | ||
|
@@ -715,7 +716,14 @@ function mergePageIntoDom(dom: appDom.AppDom, pageName: string, pageFile: Page): | |
return dom; | ||
} | ||
|
||
function optimizePageElement(element: ElementType): ElementType { | ||
function optimizePageElement( | ||
element: ElementType, | ||
isPageChild = false, | ||
): ElementType | ElementType[] { | ||
if (isPageChild && element.component === PAGE_COLUMN_COMPONENT_ID) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gets rid of page columns inside the page root too, I saw it in a few apps already and it's unnecessary / shouldn't ever happen. |
||
return (element.children || []).flatMap((child) => optimizePageElement(child, true)); | ||
} | ||
|
||
const isLayoutElement = (possibleLayoutElement: ElementType): boolean => | ||
possibleLayoutElement.component === PAGE_ROW_COMPONENT_ID || | ||
possibleLayoutElement.component === PAGE_COLUMN_COMPONENT_ID; | ||
|
@@ -736,7 +744,7 @@ function optimizePageElement(element: ElementType): ElementType { | |
|
||
return { | ||
...element, | ||
children: element.children && element.children.map(optimizePageElement), | ||
children: element.children && element.children.flatMap((child) => optimizePageElement(child)), | ||
}; | ||
} | ||
|
||
|
@@ -745,7 +753,7 @@ function optimizePage(page: Page): Page { | |
...page, | ||
spec: { | ||
...page.spec, | ||
content: page.spec?.content?.map(optimizePageElement), | ||
content: page.spec?.content?.flatMap((element) => optimizePageElement(element, true)), | ||
}, | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Element heights are controlled in the boxes that wrap components instead of the components themselves.