Skip to content

Commit

Permalink
fix: fix rebase error
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Apr 10, 2024
1 parent 2a213b3 commit 2262545
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/sheets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ export {
handleMoveRows,
rotateRange,
runRefRangeMutations,
handleCommonDefaultRangeChangeWithEffectRefCommands,
handleDefaultRangeChangeWithEffectRefCommands,
} from './services/ref-range/util';
export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
Expand Down
45 changes: 45 additions & 0 deletions packages/sheets/src/services/ref-range/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,51 @@ type MutationsAffectRange =
| IInsertRowMutationParams
| IMoveRangeMutationParams;

export const handleCommonDefaultRangeChangeWithEffectRefCommands = (range: IRange, commandInfo: ICommandInfo) => {
let operator: IOperator[] = [];
switch (commandInfo.id) {
case EffectRefRangId.DeleteRangeMoveLeftCommandId: {
return handleDeleteRangeMoveLeftCommon(commandInfo as IDeleteRangeMoveLeftCommand, range);
}
case EffectRefRangId.DeleteRangeMoveUpCommandId: {
return handleDeleteRangeMoveUpCommon(commandInfo as IDeleteRangeMoveUpCommand, range);
}
case EffectRefRangId.InsertRangeMoveDownCommandId: {
return handleInsertRangeMoveDownCommon(commandInfo as IInsertRangeMoveDownCommand, range);
}
case EffectRefRangId.InsertRangeMoveRightCommandId: {
return handleInsertRangeMoveRightCommon(commandInfo as IInsertRangeMoveRightCommand, range);
}
case EffectRefRangId.InsertColCommandId: {
operator = handleInsertCol(commandInfo as IInsertColCommand, range);
break;
}
case EffectRefRangId.InsertRowCommandId: {
operator = handleInsertRow(commandInfo as IInsertRowCommand, range);
break;
}
case EffectRefRangId.MoveColsCommandId: {
return handleMoveColsCommon(commandInfo as IMoveColsCommand, range);
}
case EffectRefRangId.MoveRangeCommandId: {
return handleMoveRangeCommon(commandInfo as IMoveRangeCommand, range);
}
case EffectRefRangId.MoveRowsCommandId: {
return handleMoveRowsCommon(commandInfo as IMoveRowsCommand, range);
}
case EffectRefRangId.RemoveColCommandId: {
operator = handleIRemoveCol(commandInfo as IRemoveRowColCommand, range);
break;
}
case EffectRefRangId.RemoveRowCommandId: {
operator = handleIRemoveRow(commandInfo as IRemoveRowColCommand, range);
break;
}
}
const resultRange = runRefRangeMutations(operator, range);
return resultRange;
};

/**
* This function should work as a pure function.
*
Expand Down

0 comments on commit 2262545

Please sign in to comment.