FIX[WebApp]: fixes in formula bar

* fx is not clickable
* Removed chevron
* Show slecting/ed area in address
This commit is contained in:
Nicolás Hatcher
2024-10-24 21:44:56 +02:00
committed by Nicolás Hatcher Andrés
parent f9ea4fd757
commit 7ffbfac432
3 changed files with 11 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
import type { Model } from "@ironcalc/wasm"; import type { Model } from "@ironcalc/wasm";
import { Button, styled } from "@mui/material"; import { styled } from "@mui/material";
import { ChevronDown } from "lucide-react";
import { Fx } from "../icons"; import { Fx } from "../icons";
import { import {
COLUMN_WIDTH_SCALE, COLUMN_WIDTH_SCALE,
@@ -34,9 +33,6 @@ function FormulaBar(properties: FormulaBarProps) {
<Container> <Container>
<AddressContainer> <AddressContainer>
<CellBarAddress>{cellAddress}</CellBarAddress> <CellBarAddress>{cellAddress}</CellBarAddress>
<StyledButton>
<ChevronDown />
</StyledButton>
</AddressContainer> </AddressContainer>
<Divider /> <Divider />
<FormulaContainer> <FormulaContainer>
@@ -84,7 +80,9 @@ function FormulaBar(properties: FormulaBarProps) {
); );
} }
const StyledButton = styled(Button)` const StyledButton = styled("div")`
display: inline-flex;
align-items: center;
width: 15px; width: 15px;
min-width: 0px; min-width: 0px;
padding: 0px; padding: 0px;

View File

@@ -29,12 +29,12 @@ export const isNavigationKey = (key: string): key is NavigationKey =>
key, key,
); );
export const getCellAddress = (selectedArea: Area, selectedCell?: Cell) => { export const getCellAddress = (selectedArea: Area, selectedCell: Cell) => {
const isSingleCell = const isSingleCell =
selectedArea.rowStart === selectedArea.rowEnd && selectedArea.rowStart === selectedArea.rowEnd &&
selectedArea.columnEnd === selectedArea.columnStart; selectedArea.columnEnd === selectedArea.columnStart;
return isSingleCell && selectedCell return isSingleCell
? `${columnNameFromNumber(selectedCell.column)}${selectedCell.row}` ? `${columnNameFromNumber(selectedCell.column)}${selectedCell.row}`
: `${columnNameFromNumber(selectedArea.columnStart)}${ : `${columnNameFromNumber(selectedArea.columnStart)}${
selectedArea.rowStart selectedArea.rowStart
@@ -57,5 +57,7 @@ export function rangeToStr(
if (rowStart === rowEnd && columnStart === columnEnd) { if (rowStart === rowEnd && columnStart === columnEnd) {
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}`; return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}`;
} }
return `${sheetName}${columnNameFromNumber(columnStart)}${rowStart}:${columnNameFromNumber(columnEnd)}${rowEnd}`; return `${sheetName}${columnNameFromNumber(
columnStart,
)}${rowStart}:${columnNameFromNumber(columnEnd)}${rowEnd}`;
} }

View File

@@ -164,6 +164,7 @@ function Worksheet(props: {
const { row, column } = cell; const { row, column } = cell;
model.onAreaSelecting(row, column); model.onAreaSelecting(row, column);
canvas.renderSheet(); canvas.renderSheet();
refresh();
}, },
onAreaSelected: () => { onAreaSelected: () => {
const styles = workbookState.getCopyStyles(); const styles = workbookState.getCopyStyles();
@@ -179,6 +180,7 @@ function Worksheet(props: {
if (worksheetElement.current) { if (worksheetElement.current) {
worksheetElement.current.style.cursor = "auto"; worksheetElement.current.style.cursor = "auto";
} }
refresh();
}, },
onExtendToCell: (cell) => { onExtendToCell: (cell) => {
const canvas = worksheetCanvas.current; const canvas = worksheetCanvas.current;