feat: Support spanning cell over rows/columns#188
Merged
nam-hle merged 1 commit intogajus:masterfrom Jan 5, 2022
Merged
Conversation
Pull Request Test Coverage Report for Build 1537893299
💛 - Coveralls |
55a69f6 to
b9db077
Compare
|
🎉 This PR is included in version 6.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix #187, #12.
API
Algorithm
Width calculation
The width of the spanning cell (SC) is the sum of all column widths, padding, border (hidden borders has been considered) that it spans.
Height calculation
The raw content of the top-left cell will be used as SC's content. After calculating the width above, we can determine the total height that needs to be used to render the cell.
The table row height calculation will skip the cells that belong to SCs, except those cells are belongs to the last row of SC since we need all the remaining content of SC to be placed in them.
Spanning cell config
We will use the config of the first column of SC as the SC's config, except the padding-right will be inherited from the last column's (for better alignment). The user can also overwrite those configs on demand.
Drawing border
We also need other kinds of border characters to be placed around SC. The logic should be straightforward but many cases need to be considered.
Header
The header content and config will be transferred into spanning cell config
Validation
row,col,rowSpan(min 1),colSpan(min 1) need to be specified such as all cells inside spanning cells are also contained inside the table, and do not overlap other spanning cells.