-
Notifications
You must be signed in to change notification settings - Fork 19.7k
add button positioning capability to DataView component #20969
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
base: master
Are you sure you want to change the base?
add button positioning capability to DataView component #20969
Conversation
Add buttonPosition option to DataView feature that allows users to customize the position of buttons in the DataView panel. This enhances flexibility by enabling precise positioning using top, right, bottom, and left properties. Test case added in area-large-dataView.html.
Thanks for your contribution! The pull request is marked to be Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20969@e88138d |
It looks like this auto build doesn't actually build what I have in PR, instead something else. |
…ositioning_feature
@Ovilia Thanks for review. I have made my changes but I have problem with commit. I could try to figure out what is all about but maybe I'm just missing something. I have pull changes from upstream master to my branch before that commit. Here is what I'm getting now:
|
You need to clone zrender and use
|
…buttonPosition - Improved code readability by reducing excessive indentation in string concatenation - Example file demonstrating the use of buttonPosition property for custom positioning PR: apache#20969
Thanks @Ovilia I have pushed changes which address your comments. |
+ ';left:' + buttonPosition.left | ||
+ ';right:' + buttonPosition.right | ||
+ ';bottom:' + buttonPosition.bottom | ||
+ ';'; |
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.
Most of the top/left/right/bottom
options uses number
type for pixel values, and most of them support percentage position relative to the container. I'd suggest using buttonExtraCssText
instead of buttonPosition
, similar to tooltip.extraCssText. In this way, we can provide more flexibility to developers and it's easier to implement.
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.
…g for DataView styling PR: apache#20969
@@ -375,7 +377,8 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> { | |||
const blockMetaList = result.meta; | |||
|
|||
const buttonContainer = document.createElement('div'); | |||
buttonContainer.style.cssText = 'position:absolute;bottom:5px;left:0;right:0'; | |||
const buttonExtraCssText = model.get('buttonExtraCssText') || ''; | |||
buttonContainer.style.cssText = 'position:absolute;' + buttonExtraCssText; |
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.
buttonExtraCssText
looks like it is for a single button rather than the button container, and can be misleading.
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.
Do you suggest other naming than ?
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.
How about buttonContainerExtraCssText
?
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.
@plainheart @Ovilia I have renamed it to suggested buttonContainerExtraCssText
.
Add buttonPosition option to DataView feature that allows users to customize the position of buttons in the DataView panel. This enhances flexibility by enabling precise positioning using top, right, bottom, and left properties.
Test case added in area-large-dataView.html.
Brief Information
This pull request is in the type of:
What does this PR do?
Adds positioning capability to DataView buttons in the toolbox component.
Fixed issues
Details
Before: What was the problem?
Previously, the DataView buttons were fixed at the bottom right of the panel with a hardcoded style:
position:absolute;bottom:5px;left:0;right:0
. Users had no way to customize the position of these buttons to match their UI requirements.After: How does it behave after the fixing?
After this change, users can specify exact positioning for the DataView buttons using the
buttonPosition
property which leverages the existingBoxLayoutOptionMixin
type. This allows precise control over the top, right, bottom, and left positioning of the buttons.Example usage:
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
A test case has been added in area-large-dataView.html demonstrating the new button positioning functionality.
Others
Merging options
Other information