Skip to content

Commit

Permalink
fix: not work correctly when the row span is 1 (#1913)
Browse files Browse the repository at this point in the history
  • Loading branch information
jajugoguma authored May 18, 2023
1 parent d754758 commit 5ecc972
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/toast-ui.grid/src/dispatch/rowSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function updateRowSpanWhenAppending(data: Row[], prevRow: Row, extendPrev
const startOffset = keyRow || extendPrevRowSpan ? 1 : -count + 1;

// keep rowSpan state when appends row in the middle of rowSpan
if (mainRowSpan.spanCount > startOffset) {
if (
mainRowSpan.spanCount > startOffset ||
(mainRowSpan.spanCount === 1 && startOffset === 1)
) {
mainRowSpan.count += 1;
mainRowSpan.spanCount += 1;

Expand Down
3 changes: 2 additions & 1 deletion packages/toast-ui.grid/src/store/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ function createSubRowSpan(prevRowSpanMap: RowSpanMap) {
Object.keys(prevRowSpanMap).forEach((columnName) => {
const prevRowSpan = prevRowSpanMap[columnName];
const { mainRowKey, count, spanCount } = prevRowSpan;
if (spanCount > 1 - count) {

if (spanCount > 1 && spanCount > 1 - count) {
const subRowCount = count >= 0 ? -1 : count - 1;
subRowSpanMap[columnName] = createRowSpan(false, mainRowKey, subRowCount, spanCount);
}
Expand Down

0 comments on commit 5ecc972

Please sign in to comment.