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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat: use new message service to optimize UI (#256)
Wenzhao Hud842c85117cf
diff --git a/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts b/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.tsindex 87019859bf..a03750cf97 100644--- a/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts+++ b/packages/base-sheets/src/commands/commands/__tests__/move-rows-cols.command.spec.ts@@ -1,5 +1,5 @@/* eslint-disable no-magic-numbers */-import { INotificationService } from '@univerjs/base-ui';+import { IMessageService } from '@univerjs/base-ui';import {ICellData,ICommandService,@@ -394,6 +394,6 @@ const TEST_ROWS_COLS_MOVE_DEMO: IWorkbookConfig = {function createMoveRowsColsTestBed() {return createCommandTestBed(Tools.deepClone(TEST_ROWS_COLS_MOVE_DEMO), [- [INotificationService, { useValue: { show: () => toDisposable(() => {}) } as INotificationService }],+ [IMessageService, { useValue: { show: () => toDisposable(() => {}) } as IMessageService }],]);}diff --git a/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts b/packages/base-sheets/src/commands/commands/move-rows-cols.command.tsindex 35d4a3d60e..a6b21ee5c7 100644--- a/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts+++ b/packages/base-sheets/src/commands/commands/move-rows-cols.command.ts@@ -1,4 +1,4 @@-import { INotificationService } from '@univerjs/base-ui';+import { IMessageService, MessageType } from '@univerjs/base-ui';import {CommandType,ICommand,@@ -73,23 +73,23 @@ export const MoveRowsCommand: ICommand<IMoveRowsCommandParams> = {const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();- const notificationService = accessor.get(INotificationService);+ const messageService = accessor.get(IMessageService);// Forbid action when some parts of a merged cell are selected.const rangeToMove = filteredSelections[0].range;const beforePrimary = filteredSelections[0].primary;const alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, false);if (!Rectangle.equals(rangeToMove, alignedRange)) {- // TODO@wzhudev: use rightfully implemented notification service when it's ready- notificationService.show({- title: 'Only part of a merged cell is selected.',+ messageService.show({+ type: MessageType.Error,+ content: 'Only part of a merged cell is selected.',});return false;}if (rowAcrossMergedCell(toRow, worksheet)) {- // TODO@wzhudev: use rightfully implemented notification service when it's ready- notificationService.show({- title: 'Across a merged cell',+ messageService.show({+ type: MessageType.Error,+ content: 'Across a merged cell.',});return false;}@@ -250,23 +250,23 @@ export const MoveColsCommand: ICommand<IMoveColsCommandParams> = {const workbookId = workbook.getUnitId();const worksheetId = worksheet.getSheetId();- const notificationService = accessor.get(INotificationService);+ const messageService = accessor.get(IMessageService);// Forbid action when some parts of a merged cell are selected.const rangeToMove = filteredSelections[0].range;const beforePrimary = filteredSelections[0].primary;const alignedRange = alignToMergedCellsBorders(rangeToMove, worksheet, false);if (!Rectangle.equals(rangeToMove, alignedRange)) {- // TODO@wzhudev: use rightfully implemented notification service when it's ready- notificationService.show({- title: 'Only part of a merged cell is selected.',+ messageService.show({+ type: MessageType.Error,+ content: 'Only part of a merged cell is selected.',});return false;}if (columnAcrossMergedCell(toCol, worksheet)) {- // TODO@wzhudev: use rightfully implemented notification service when it's ready- notificationService.show({- title: 'Across a merged cell',+ messageService.show({+ type: MessageType.Error,+ content: 'Across a merged cell.',});return false;}