fix: link editor cannot unselect (#363)

* fix: the many-to-one relationship link editor cannot deselect

* fix: formula FIND and SEARCH return type error
This commit is contained in:
SkyHuang 2024-02-06 17:11:08 +08:00 committed by GitHub
parent e5ea44ff65
commit 37be99f516
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -66,7 +66,7 @@ export class Find extends TextFunc {
getReturnType(params?: TypedValue[]) {
params && this.validateParams(params);
return { type: CellValueType.String };
return { type: CellValueType.Number };
}
eval(params: TypedValue<string | number | null | (string | number | null)[]>[]): number | null {
@ -96,7 +96,7 @@ export class Search extends TextFunc {
getReturnType(params?: TypedValue[]) {
params && this.validateParams(params);
return { type: CellValueType.String };
return { type: CellValueType.Number };
}
eval(params: TypedValue<string | number | null | (string | number | null)[]>[]): number | null {

View File

@ -99,10 +99,17 @@ export const useSelection = (props: IUseSelectionProps) => {
const pureSelectColumnOrRow = (colOrRowIndex: number, type: SelectionRegionType) => {
const range = [colOrRowIndex, colOrRowIndex] as IRange;
const newSelection =
isPrevRowSelection && isMultiSelectionEnable
? selection.merge(range)
: selection.set(type, [range]);
let newSelection;
if (
isPrevRowSelection &&
(isMultiSelectionEnable ||
(!isMultiSelectionEnable && prevSelectionRanges[0][0] === colOrRowIndex))
) {
newSelection = selection.merge(range);
} else {
newSelection = selection.set(type, [range]);
}
if (newSelection.includes(range)) {
prevSelectedRowIndex.current = colOrRowIndex;
}