Skip to content

Commit

Permalink
fix: fix sheets numfmt panel
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Oct 30, 2024
1 parent 83c1bfc commit 482eae9
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export const CloseNumfmtPanelOperator: ICommand = {
id: 'sheet.operation.close.numfmt.panel',
type: CommandType.OPERATION,
handler: () =>
// do nothing,just notify panel is closed
// do nothing, just notify panel is closed
true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

import type { IAccessor, ICommand } from '@univerjs/core';
import { CommandType } from '@univerjs/core';

import { INumfmtController } from '../../controllers/type';
import { SheetNumfmtUIController } from '../../controllers/numfmt.controller';

export const OpenNumfmtPanelOperator: ICommand = {
id: 'sheet.operation.open.numfmt.panel',
type: CommandType.OPERATION,
handler: (accessor: IAccessor) => {
const numfmtController = accessor.get(INumfmtController);
const numfmtController = accessor.get(SheetNumfmtUIController);
numfmtController.openPanel();
return true;
},
Expand Down
3 changes: 2 additions & 1 deletion packages/sheets-numfmt-ui/src/controllers/menu.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

import type { MenuSchemaType } from '@univerjs/ui';
import { AddDecimalCommand, OpenNumfmtPanelOperator, SetCurrencyCommand, SetPercentCommand, SubtractDecimalCommand } from '@univerjs/sheets-numfmt';
import { AddDecimalCommand, SetCurrencyCommand, SetPercentCommand, SubtractDecimalCommand } from '@univerjs/sheets-numfmt';
import { RibbonStartGroup } from '@univerjs/ui';
import { OpenNumfmtPanelOperator } from '../commands/operations/open.numfmt.panel.operation';
import { AddDecimalMenuItem, CurrencyMenuItem, FactoryOtherMenuItem, PercentMenuItem, SubtractDecimalMenuItem } from './menu';

export const menuSchema: MenuSchemaType = {
Expand Down
3 changes: 2 additions & 1 deletion packages/sheets-numfmt-ui/src/controllers/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import {
WorksheetEditPermission,
WorksheetSetCellStylePermission,
} from '@univerjs/sheets';
import { AddDecimalCommand, countryCurrencyMap, isPatternEqualWithoutDecimal, MenuCurrencyService, OpenNumfmtPanelOperator, SetCurrencyCommand, SetPercentCommand, SubtractDecimalCommand } from '@univerjs/sheets-numfmt';
import { AddDecimalCommand, countryCurrencyMap, isPatternEqualWithoutDecimal, MenuCurrencyService, SetCurrencyCommand, SetPercentCommand, SubtractDecimalCommand } from '@univerjs/sheets-numfmt';
import { deriveStateFromActiveSheet$, getCurrentRangeDisable$ } from '@univerjs/sheets-ui';
import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';
import { merge, Observable } from 'rxjs';
import { OpenNumfmtPanelOperator } from '../commands/operations/open.numfmt.panel.operation';
import { MORE_NUMFMT_TYPE_KEY, OPTIONS_KEY } from '../views/components/more-numfmt-type/MoreNumfmtType';

export const MENU_OPTIONS: Array<{ label: string; pattern: string | null } | '|'> = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ import {
SheetInterceptorService,
SheetsSelectionsService,
} from '@univerjs/sheets';
import { CloseNumfmtPanelOperator, getPatternPreviewIgnoreGeneral, getPatternType, OpenNumfmtPanelOperator, SetNumfmtCommand } from '@univerjs/sheets-numfmt';
import { getPatternPreviewIgnoreGeneral, getPatternType, SetNumfmtCommand } from '@univerjs/sheets-numfmt';
import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
import { ComponentManager, ISidebarService } from '@univerjs/ui';
import { combineLatest, Observable } from 'rxjs';
import { debounceTime, map, switchMap, tap } from 'rxjs/operators';
import { CloseNumfmtPanelOperator } from '../commands/operations/close.numfmt.panel.operation';
import { OpenNumfmtPanelOperator } from '../commands/operations/open.numfmt.panel.operation';
import { SheetNumfmtPanel } from '../views/components';

const SHEET_NUMFMT_PANEL = 'SHEET_NUMFMT_PANEL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import type { FormatType } from '@univerjs/sheets';

import { ICommandService, LocaleService, Range, useDependency, useInjector } from '@univerjs/core';
import { SheetsSelectionsService } from '@univerjs/sheets';
import { getPatternPreview, getPatternType, OpenNumfmtPanelOperator, SetNumfmtCommand } from '@univerjs/sheets-numfmt';
import { getPatternPreview, getPatternType, SetNumfmtCommand } from '@univerjs/sheets-numfmt';
import { ILayoutService } from '@univerjs/ui';
import React from 'react';
import { MENU_OPTIONS } from '../../../controllers/menu';
import { OpenNumfmtPanelOperator } from '../../../commands/operations/open.numfmt.panel.operation';

import { MENU_OPTIONS } from '../../../controllers/menu';
// FIXME: DO NOT USE GLOBAL STYLES
import './index.less';

Expand Down
2 changes: 0 additions & 2 deletions packages/sheets-numfmt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,5 @@ export { SetCurrencyCommand } from './commands/commands/set-currency.command';
export { type ISetNumfmtCommandParams, SetNumfmtCommand } from './commands/commands/set-numfmt.command';
export { SetPercentCommand } from './commands/commands/set-percent.command';
export { SubtractDecimalCommand } from './commands/commands/subtract-decimal.command';
export { CloseNumfmtPanelOperator } from './commands/operations/close.numfmt.panel.operation';
export { OpenNumfmtPanelOperator } from './commands/operations/open.numfmt.panel.operation';

// #endregion
2 changes: 0 additions & 2 deletions packages/sheets-numfmt/src/numfmt-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { SetPercentCommand } from './commands/commands/set-percent.command';
import { SubtractDecimalCommand } from './commands/commands/subtract-decimal.command';
import { SheetsNumfmtCellContentController } from './controllers/numfmt-cell-content.controller';
import { NumfmtCurrencyController } from './controllers/numfmt-currency.controller';
import { INumfmtController } from './controllers/type';
import { MenuCurrencyService } from './service/menu.currency.service';

@DependentOn(UniverSheetsPlugin)
Expand All @@ -50,7 +49,6 @@ export class UniverSheetsNumfmtPlugin extends Plugin {

override onRendered(): void {
touchDependencies(this._injector, [
[INumfmtController],
[SheetsNumfmtCellContentController],
[NumfmtCurrencyController],
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-numfmt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"outDir": "lib/types"
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
"include": ["src", "../sheets-numfmt-ui/src/commands/operations"]
}

0 comments on commit 482eae9

Please sign in to comment.