From d1ad801f3ab66a76ee1efd8275de09b35f5a8e48 Mon Sep 17 00:00:00 2001 From: patrick blume Date: Fri, 10 Jan 2025 11:25:52 +0100 Subject: [PATCH] Add check for data column --- src/Client/MainComponents/Cells.fs | 2 +- src/Client/MainComponents/SpreadsheetView/ArcTable.fs | 10 ++++++---- src/Client/MainComponents/SpreadsheetView/DataMap.fs | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Client/MainComponents/Cells.fs b/src/Client/MainComponents/Cells.fs index e7c2e9ae..c841a713 100644 --- a/src/Client/MainComponents/Cells.fs +++ b/src/Client/MainComponents/Cells.fs @@ -161,7 +161,7 @@ type Cell = | TSR | TAN -> $"{columnType} ({cellValue})" | _ -> cellValue let extendableButtonOpt = - if columnType = Main && not header.IsSingleColumn then + if (columnType = Main && not header.IsSingleColumn) || (columnType = Main && header.IsDataColumn) then extendHeaderButton(state_extend, columnIndex, setState_extend) |> Some else None diff --git a/src/Client/MainComponents/SpreadsheetView/ArcTable.fs b/src/Client/MainComponents/SpreadsheetView/ArcTable.fs index e77157a2..643fe213 100644 --- a/src/Client/MainComponents/SpreadsheetView/ArcTable.fs +++ b/src/Client/MainComponents/SpreadsheetView/ArcTable.fs @@ -25,7 +25,7 @@ let private CreateBodyCells (columnIndex, rowIndex, state:Set, model:Model, Cell.Empty() Cell.BodyTSR(index, cell, model, dispatch) Cell.BodyTAN(index, cell, model, dispatch) - elif header.IsDataColumn then + elif header.IsDataColumn && isExtended then if cell.isData then Cell.BodyDataSelector(index, cell, model, dispatch) Cell.BodyDataFormat(index, cell, model, dispatch) @@ -48,9 +48,11 @@ let private CreateHeaderCells(columnIndex, state, setState, model, dispatch) = Cell.HeaderTSR(columnIndex, header, state, setState, model, dispatch) Cell.HeaderTAN(columnIndex, header, state, setState, model, dispatch) elif header.IsDataColumn then - Cell.HeaderDataSelector(columnIndex, header, state, setState, model, dispatch) - Cell.HeaderDataFormat(columnIndex, header, state, setState, model, dispatch) - Cell.HeaderDataSelectorFormat(columnIndex, header, state, setState, model, dispatch) + let isExtended = state.Contains columnIndex + if isExtended then + Cell.HeaderDataSelector(columnIndex, header, state, setState, model, dispatch) + Cell.HeaderDataFormat(columnIndex, header, state, setState, model, dispatch) + Cell.HeaderDataSelectorFormat(columnIndex, header, state, setState, model, dispatch) else () ] diff --git a/src/Client/MainComponents/SpreadsheetView/DataMap.fs b/src/Client/MainComponents/SpreadsheetView/DataMap.fs index 924981f1..29274720 100644 --- a/src/Client/MainComponents/SpreadsheetView/DataMap.fs +++ b/src/Client/MainComponents/SpreadsheetView/DataMap.fs @@ -26,7 +26,7 @@ let private CreateBodyCells(columnIndex, rowIndex, state: Set, model, dispa Cell.Empty() Cell.BodyTSR(index, cell, model, dispatch) Cell.BodyTAN(index, cell, model, dispatch) - elif header.IsDataColumn then + elif header.IsDataColumn && isExtended then if cell.isData then Cell.BodyDataSelector(index, cell, model, dispatch) Cell.BodyDataFormat(index, cell, model, dispatch) @@ -35,7 +35,6 @@ let private CreateBodyCells(columnIndex, rowIndex, state: Set, model, dispa Cell.Empty() Cell.Empty() Cell.Empty() - ] let private CreateHeaderCells(columnIndex, state, setState, model, dispatch) =