From 5809a76e38514a17e451f552f18253dae961ebe4 Mon Sep 17 00:00:00 2001 From: "daeyeon.kim" Date: Mon, 15 May 2023 14:34:01 +0900 Subject: [PATCH] fix: not work correctly when the row span is 1 --- packages/toast-ui.grid/src/dispatch/rowSpan.ts | 5 ++++- packages/toast-ui.grid/src/store/data.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/toast-ui.grid/src/dispatch/rowSpan.ts b/packages/toast-ui.grid/src/dispatch/rowSpan.ts index e3f910389..58b4c941d 100644 --- a/packages/toast-ui.grid/src/dispatch/rowSpan.ts +++ b/packages/toast-ui.grid/src/dispatch/rowSpan.ts @@ -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; diff --git a/packages/toast-ui.grid/src/store/data.ts b/packages/toast-ui.grid/src/store/data.ts index c8d5b85ef..bccff5bad 100644 --- a/packages/toast-ui.grid/src/store/data.ts +++ b/packages/toast-ui.grid/src/store/data.ts @@ -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); }