update: change border styling in cell selector
This commit is contained in:
@@ -226,12 +226,14 @@ const Worksheet = forwardRef(
|
|||||||
if (!canvas) {
|
if (!canvas) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
workbookState.setSelecting(true);
|
||||||
const { row, column } = cell;
|
const { row, column } = cell;
|
||||||
model.onAreaSelecting(row, column);
|
model.onAreaSelecting(row, column);
|
||||||
canvas.renderSheet();
|
canvas.renderSheet();
|
||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
onAreaSelected: () => {
|
onAreaSelected: () => {
|
||||||
|
workbookState.setSelecting(false);
|
||||||
const styles = workbookState.getCopyStyles();
|
const styles = workbookState.getCopyStyles();
|
||||||
if (styles?.length) {
|
if (styles?.length) {
|
||||||
model.onPasteStyles(styles);
|
model.onPasteStyles(styles);
|
||||||
@@ -505,8 +507,8 @@ const RowResizeGuide = styled("div")`
|
|||||||
|
|
||||||
const AreaOutline = styled("div")`
|
const AreaOutline = styled("div")`
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border: 1px solid ${outlineColor};
|
border: 0px solid ${outlineColor};
|
||||||
border-radius: 3px;
|
border-radius: 1px;
|
||||||
background-color: ${outlineBackgroundColor};
|
background-color: ${outlineBackgroundColor};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -517,6 +519,7 @@ const CellOutline = styled("div")`
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
box-shadow: inset 0 0 0 1px white;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ExtendToOutline = styled("div")`
|
const ExtendToOutline = styled("div")`
|
||||||
@@ -536,6 +539,7 @@ const EditorWrapper = styled("div")`
|
|||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
outline: 3px solid ${outlineColor}40;
|
||||||
span {
|
span {
|
||||||
min-width: 1px;
|
min-width: 1px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export function attachOutlineHandle(
|
|||||||
background: outlineColor,
|
background: outlineColor,
|
||||||
cursor: "crosshair",
|
cursor: "crosshair",
|
||||||
borderRadius: "1px",
|
borderRadius: "1px",
|
||||||
|
border: `1px solid white`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// cell handle events
|
// cell handle events
|
||||||
|
|||||||
@@ -1560,7 +1560,9 @@ export default class WorksheetCanvas {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cellOutline.style.visibility = "visible";
|
cellOutline.style.visibility = "visible";
|
||||||
cellOutlineHandle.style.visibility = "visible";
|
cellOutlineHandle.style.visibility = this.workbookState.isSelecting()
|
||||||
|
? "hidden"
|
||||||
|
: "visible";
|
||||||
areaOutline.style.visibility = "visible";
|
areaOutline.style.visibility = "visible";
|
||||||
|
|
||||||
const [selectedSheet, selectedRow, selectedColumn] =
|
const [selectedSheet, selectedRow, selectedColumn] =
|
||||||
@@ -1619,7 +1621,9 @@ export default class WorksheetCanvas {
|
|||||||
handleY += this.getRowHeight(selectedSheet, rowStart);
|
handleY += this.getRowHeight(selectedSheet, rowStart);
|
||||||
} else {
|
} else {
|
||||||
areaOutline.style.visibility = "visible";
|
areaOutline.style.visibility = "visible";
|
||||||
cellOutlineHandle.style.visibility = "visible";
|
cellOutlineHandle.style.visibility = this.workbookState.isSelecting()
|
||||||
|
? "hidden"
|
||||||
|
: "visible";
|
||||||
const [areaX, areaY] = this.getCoordinatesByCell(rowStart, columnStart);
|
const [areaX, areaY] = this.getCoordinatesByCell(rowStart, columnStart);
|
||||||
const [areaWidth, areaHeight] = this.getAreaDimensions(
|
const [areaWidth, areaHeight] = this.getAreaDimensions(
|
||||||
rowStart,
|
rowStart,
|
||||||
@@ -1644,7 +1648,9 @@ export default class WorksheetCanvas {
|
|||||||
clipLeft,
|
clipLeft,
|
||||||
clipTop,
|
clipTop,
|
||||||
);
|
);
|
||||||
areaOutline.style.border = `1px solid ${outlineColor}`;
|
areaOutline.style.border = this.workbookState.isSelecting()
|
||||||
|
? "none"
|
||||||
|
: `1px solid ${outlineColor}`;
|
||||||
// hide the handle if it is out of the visible area
|
// hide the handle if it is out of the visible area
|
||||||
if (
|
if (
|
||||||
(rowEnd > frozenRows && rowEnd < topLeftCell.row - 1) ||
|
(rowEnd > frozenRows && rowEnd < topLeftCell.row - 1) ||
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ export class WorkbookState {
|
|||||||
private copyStyles: AreaStyles | null;
|
private copyStyles: AreaStyles | null;
|
||||||
private cell: EditingCell | null;
|
private cell: EditingCell | null;
|
||||||
private cutRange: CutRange | null;
|
private cutRange: CutRange | null;
|
||||||
|
private selecting: boolean;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// the extendTo area is the area we are covering
|
// the extendTo area is the area we are covering
|
||||||
@@ -99,6 +100,15 @@ export class WorkbookState {
|
|||||||
this.copyStyles = null;
|
this.copyStyles = null;
|
||||||
this.cell = null;
|
this.cell = null;
|
||||||
this.cutRange = null;
|
this.cutRange = null;
|
||||||
|
this.selecting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSelecting(): boolean {
|
||||||
|
return this.selecting;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelecting(value: boolean): void {
|
||||||
|
this.selecting = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getExtendToArea(): Area | null {
|
getExtendToArea(): Area | null {
|
||||||
|
|||||||
Reference in New Issue
Block a user