Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

flush

jerry3bf6aa56ef3c
diff --cc packages/base-sheets/src/Controller/Selection/SelectionManager.ts
index 4290b65744,c4e7d3fb34..4fab8607da
--- a/packages/base-sheets/src/Controller/Selection/SelectionManager.ts
+++ b/packages/base-sheets/src/Controller/Selection/SelectionManager.ts
@@@ -18,7 -18,7 +18,6 @@@ import { ACTION_NAMES, ISelectionsConfi
import { ISelectionModelValue, ISetSelectionValueActionData, SetSelectionValueAction } from '../../Model/Action/SetSelectionValueAction';
import { SelectionModel } from '../../Model/SelectionModel';
import { SheetPlugin } from '../../SheetPlugin';
--import { SheetView } from '../../View/Render/Views/SheetView';
import { ColumnTitleController } from './ColumnTitleController';
import { DragLineController } from './DragLineController';
import { RowTitleController } from './RowTitleController';
@@@ -30,8 -30,8 +29,6 @@@ import { SelectionControl, SELECTION_TY
* SelectionManager 维护model数据list,action也是修改这一层数据,obs监听到数据变动后,自动刷新(control仍然可以持有数据)
*/
export class SelectionManager {
-- hasSelection: boolean = false;
--
private _mainComponent: Spreadsheet;
private _rowComponent: SpreadsheetRowTitle;
@@@ -64,11 -64,11 +61,7 @@@
private _dragLineControl: DragLineController;
-- constructor(private _sheetView: SheetView) {
-- this._plugin = this._sheetView.getPlugin() as SheetPlugin;
-- this._initialize();
-- this._initializeObserver();
-- }
++ hasSelection: boolean = false;
getSheetView() {
return this._sheetView;
diff --cc packages/core/src/Sheets/Domain/Worksheet.ts
index 9fef54fcbc,9dcf52375e..ce538b7d1c
--- a/packages/core/src/Sheets/Domain/Worksheet.ts
+++ b/packages/core/src/Sheets/Domain/Worksheet.ts
@@@ -796,14 -791,22 +796,23 @@@ export class Worksheet
columnIndex = 0;
}
- const { _context, _commandManager, _sheetId } = this;
+ const { _context, _sheetId } = this;
+ const _commandManager = this.getCommandManager();
const columnData = new ObjectMatrix<ICellData>();
- this._cellData.forEach((index) => {
- for (let i = columnIndex; i < columnIndex + numColumns; i++) {
- columnData.setValue(index, i - columnIndex, {});
+ if (this._cellData.getLength()) {
+ this._cellData.forEach((index) => {
+ for (let i = columnIndex; i < columnIndex + numColumns; i++) {
+ columnData.setValue(index, i - columnIndex, {});
+ }
+ });
+ } else {
+ for (let i = 0; i < this._config.rowCount; i++) {
+ for (let j = columnIndex; j < columnIndex + numColumns; j++) {
+ columnData.setValue(i, j - columnIndex, {});
+ }
}
- });
+ }
+
const insertColumnData: IInsertColumnDataActionData = {
actionName: InsertColumnDataAction.NAME,
sheetId: _sheetId,