@univerjs/sheets-numfmt 0.4.2 → 0.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +10 -10
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -9
  4. package/lib/es/facade.js +12 -0
  5. package/lib/es/index.js +361 -1311
  6. package/lib/types/{controllers/__tests__/editor.controller.spec.d.ts → facade/f-range.d.ts} +12 -0
  7. package/lib/types/{controllers/__tests__/cell-content.controller.spec.d.ts → facade/index.d.ts} +1 -1
  8. package/lib/types/index.d.ts +7 -3
  9. package/lib/types/numfmt-plugin.d.ts +3 -4
  10. package/lib/umd/facade.js +1 -0
  11. package/lib/umd/index.js +1 -9
  12. package/package.json +25 -26
  13. package/lib/index.css +0 -1
  14. package/lib/locale/en-US.json +0 -38
  15. package/lib/locale/fa-IR.json +0 -38
  16. package/lib/locale/ru-RU.json +0 -38
  17. package/lib/locale/vi-VN.json +0 -38
  18. package/lib/locale/zh-CN.json +0 -38
  19. package/lib/locale/zh-TW.json +0 -38
  20. package/lib/types/base/const/MENU-OPTIONS.d.ts +0 -19
  21. package/lib/types/base/types/index.d.ts +0 -7
  22. package/lib/types/commands/operations/close.numfmt.panel.operation.d.ts +0 -2
  23. package/lib/types/commands/operations/open.numfmt.panel.operation.d.ts +0 -2
  24. package/lib/types/components/accounting/index.d.ts +0 -4
  25. package/lib/types/components/currency/index.d.ts +0 -4
  26. package/lib/types/components/custom-format/index.d.ts +0 -3
  27. package/lib/types/components/date/index.d.ts +0 -4
  28. package/lib/types/components/general/index.d.ts +0 -4
  29. package/lib/types/components/index.d.ts +0 -14
  30. package/lib/types/components/more-numfmt-type/MoreNumfmtType.d.ts +0 -7
  31. package/lib/types/components/stories/Panel.stories.d.ts +0 -5
  32. package/lib/types/components/thousandth-percentile/index.d.ts +0 -4
  33. package/lib/types/context/user-habit.d.ts +0 -16
  34. package/lib/types/controllers/__tests__/test.util.d.ts +0 -15
  35. package/lib/types/controllers/config.schema.d.ts +0 -7
  36. package/lib/types/controllers/menu.schema.d.ts +0 -2
  37. package/lib/types/controllers/numfmt.controller.d.ts +0 -33
  38. package/lib/types/controllers/numfmt.editor.controller.d.ts +0 -20
  39. package/lib/types/controllers/numfmt.menu.controller.d.ts +0 -8
  40. package/lib/types/controllers/user-habit.controller.d.ts +0 -18
  41. package/lib/types/hooks/useCurrencyOptions.d.ts +0 -19
  42. package/lib/types/hooks/useNextTick.d.ts +0 -16
  43. package/lib/types/locale/en-US.d.ts +0 -3
  44. package/lib/types/locale/fa-IR.d.ts +0 -3
  45. package/lib/types/locale/ru-RU.d.ts +0 -3
  46. package/lib/types/locale/vi-VN.d.ts +0 -3
  47. package/lib/types/locale/zh-CN.d.ts +0 -54
  48. package/lib/types/locale/zh-TW.d.ts +0 -3
  49. package/lib/types/menu/menu.d.ts +0 -40
  50. /package/lib/types/controllers/{numfmt.cell-content.controller.d.ts → numfmt-cell-content.controller.d.ts} +0 -0
  51. /package/lib/types/controllers/{numfmt.currency.controller.d.ts → numfmt-currency.controller.d.ts} +0 -0
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare const MENU_OPTIONS: Array<{
17
- label: string;
18
- pattern: string | null;
19
- } | '|'>;
@@ -1,7 +0,0 @@
1
- import { MutableRefObject } from 'react';
2
- export interface IBusinessComponentProps {
3
- onChange: (result: string) => void;
4
- defaultValue: number;
5
- defaultPattern: string;
6
- action: MutableRefObject<() => string | null>;
7
- }
@@ -1,2 +0,0 @@
1
- import { ICommand } from '@univerjs/core';
2
- export declare const CloseNumfmtPanelOperator: ICommand;
@@ -1,2 +0,0 @@
1
- import { ICommand } from '@univerjs/core';
2
- export declare const OpenNumfmtPanelOperator: ICommand;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare const isAccountingPanel: (pattern: string) => boolean;
4
- export declare const AccountingPanel: FC<IBusinessComponentProps>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare const isCurrencyPanel: (pattern: string) => boolean;
4
- export declare const CurrencyPanel: FC<IBusinessComponentProps>;
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare function CustomFormat(props: IBusinessComponentProps): React.JSX.Element;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare const isDatePanel: (pattern: string) => boolean;
4
- export declare const DatePanel: FC<IBusinessComponentProps>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare const isGeneralPanel: (pattern: string) => boolean;
4
- export declare const GeneralPanel: FC<IBusinessComponentProps>;
@@ -1,14 +0,0 @@
1
- import { FC } from 'react';
2
- export interface ISheetNumfmtPanelProps {
3
- value: {
4
- defaultValue: number;
5
- defaultPattern: string;
6
- row: number;
7
- col: number;
8
- };
9
- onChange: (config: {
10
- type: 'change' | 'cancel' | 'confirm';
11
- value: string;
12
- }) => void;
13
- }
14
- export declare const SheetNumfmtPanel: FC<ISheetNumfmtPanelProps>;
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- export declare const MORE_NUMFMT_TYPE_KEY = "sheet.numfmt.moreNumfmtType";
3
- export declare const OPTIONS_KEY = "sheet.numfmt.moreNumfmtType.options";
4
- export declare const MoreNumfmtType: (props: {
5
- value?: string;
6
- }) => React.JSX.Element;
7
- export declare const Options: () => React.JSX.Element;
@@ -1,5 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { ISheetNumfmtPanelProps } from '../index';
3
- declare const meta: Meta;
4
- export default meta;
5
- export declare const Test: StoryObj<ISheetNumfmtPanelProps>;
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- import { IBusinessComponentProps } from '../../base/types';
3
- export declare const isThousandthPercentilePanel: (pattern: string) => boolean;
4
- export declare const ThousandthPercentilePanel: FC<IBusinessComponentProps>;
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare const UserHabitCurrencyContext: import('react').Context<string[]>;
@@ -1,15 +0,0 @@
1
- import { Dependency, Univer } from '@univerjs/core';
2
- export declare const createTestBed: (dependencies?: Dependency[]) => {
3
- univer: Univer;
4
- get: {
5
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp): T;
6
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp): T[];
7
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp): T | null;
8
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp): T;
9
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantity?: import('@wendellhu/redi').Quantity, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
10
- <T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp, lookUp?: import('@wendellhu/redi').LookUp): T[] | T | null;
11
- };
12
- sheet: import('@univerjs/core').Workbook;
13
- unitId: string;
14
- subUnitId: string;
15
- };
@@ -1,7 +0,0 @@
1
- import { MenuConfig } from '@univerjs/ui';
2
- export declare const PLUGIN_CONFIG_KEY = "sheets-numfmt.config";
3
- export declare const configSymbol: unique symbol;
4
- export interface IUniverSheetsNumfmtConfig {
5
- menu?: MenuConfig;
6
- }
7
- export declare const defaultPluginConfig: IUniverSheetsNumfmtConfig;
@@ -1,2 +0,0 @@
1
- import { MenuSchemaType } from '@univerjs/ui';
2
- export declare const menuSchema: MenuSchemaType;
@@ -1,33 +0,0 @@
1
- import { INumfmtController } from './type';
2
- import { Disposable, ICommandService, IUniverInstanceService, LocaleService, ThemeService } from '@univerjs/core';
3
- import { IRenderManagerService } from '@univerjs/engine-render';
4
- import { INumfmtService, SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
5
- import { ComponentManager, ISidebarService } from '@univerjs/ui';
6
- export declare class NumfmtController extends Disposable implements INumfmtController {
7
- private _sheetInterceptorService;
8
- private _themeService;
9
- private _univerInstanceService;
10
- private _commandService;
11
- private _selectionManagerService;
12
- private _renderManagerService;
13
- private _numfmtService;
14
- private _componentManager;
15
- private _sidebarService;
16
- private _localeService;
17
- /**
18
- * If _previewPattern is null ,the realTimeRenderingInterceptor will skip and if it is '',realTimeRenderingInterceptor will clear numfmt.
19
- * @private
20
- * @type {(string | null)}
21
- * @memberof NumfmtController
22
- */
23
- private _previewPattern;
24
- constructor(_sheetInterceptorService: SheetInterceptorService, _themeService: ThemeService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _selectionManagerService: SheetsSelectionsService, _renderManagerService: IRenderManagerService, _numfmtService: INumfmtService, _componentManager: ComponentManager, _sidebarService: ISidebarService, _localeService: LocaleService);
25
- openPanel(): boolean;
26
- private _forceUpdate;
27
- private _initCommands;
28
- private _initPanel;
29
- private _initRealTimeRenderingInterceptor;
30
- private _commandExecutedListener;
31
- private _sidebarDisposable;
32
- private _initCloseListener;
33
- }
@@ -1,20 +0,0 @@
1
- import { Disposable, Injector, IUniverInstanceService } from '@univerjs/core';
2
- import { INumfmtService, SheetInterceptorService } from '@univerjs/sheets';
3
- import { IEditorBridgeService } from '@univerjs/sheets-ui';
4
- export declare class NumfmtEditorController extends Disposable {
5
- private _sheetInterceptorService;
6
- private _numfmtService;
7
- private _univerInstanceService;
8
- private _injector;
9
- private _editorBridgeService?;
10
- private _collectEffectMutation;
11
- constructor(_sheetInterceptorService: SheetInterceptorService, _numfmtService: INumfmtService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _editorBridgeService?: IEditorBridgeService | undefined);
12
- private _initInterceptorEditorStart;
13
- /**
14
- * Process the values after edit
15
- * @private
16
- * @memberof NumfmtService
17
- */
18
- private _initInterceptorEditorEnd;
19
- private _initInterceptorCommands;
20
- }
@@ -1,8 +0,0 @@
1
- import { Disposable } from '@univerjs/core';
2
- import { ComponentManager, IMenuManagerService } from '@univerjs/ui';
3
- export declare class NumfmtMenuController extends Disposable {
4
- private _componentManager;
5
- private readonly _menuManagerService;
6
- constructor(_componentManager: ComponentManager, _menuManagerService: IMenuManagerService);
7
- private _initMenu;
8
- }
@@ -1,18 +0,0 @@
1
- import { ILocalStorageService } from '@univerjs/core';
2
- type HabitValue = string | number;
3
- interface IUserHabitController {
4
- addHabit(habit: string, initValue: HabitValue[]): Promise<void>;
5
- markHabit(habit: string, value: HabitValue): void;
6
- deleteHabit(habit: string): void;
7
- getHabit(habit: string, sortList?: HabitValue[]): Promise<HabitValue[]>;
8
- }
9
- export declare class UserHabitController implements IUserHabitController {
10
- private _localStorageService;
11
- constructor(_localStorageService: ILocalStorageService);
12
- private _getKey;
13
- addHabit<T = unknown[]>(habit: string, initValue: T): Promise<void>;
14
- markHabit(habit: string, value: HabitValue): void;
15
- getHabit(habit: string, sortList: HabitValue[]): Promise<HabitValue[]>;
16
- deleteHabit(habit: string): void;
17
- }
18
- export {};
@@ -1,19 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare const useCurrencyOptions: (onOptionChange?: (options: string[]) => void) => {
17
- userHabitCurrency: string[];
18
- mark: (v: string) => void;
19
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export declare const useNextTick: () => (fn: () => void) => void;
@@ -1,3 +0,0 @@
1
- import { default as zhCN } from './zh-CN';
2
- declare const locale: typeof zhCN;
3
- export default locale;
@@ -1,3 +0,0 @@
1
- import { default as zhCN } from './zh-CN';
2
- declare const locale: typeof zhCN;
3
- export default locale;
@@ -1,3 +0,0 @@
1
- import { default as zhCN } from './zh-CN';
2
- declare const locale: typeof zhCN;
3
- export default locale;
@@ -1,3 +0,0 @@
1
- import { default as zhCN } from './zh-CN';
2
- declare const locale: typeof zhCN;
3
- export default locale;
@@ -1,54 +0,0 @@
1
- /**
2
- * Copyright 2023-present DreamNum Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- declare const locale: {
17
- sheet: {
18
- numfmt: {
19
- percent: string;
20
- title: string;
21
- numfmtType: string;
22
- cancel: string;
23
- confirm: string;
24
- general: string;
25
- accounting: string;
26
- text: string;
27
- number: string;
28
- currency: string;
29
- date: string;
30
- time: string;
31
- thousandthPercentile: string;
32
- preview: string;
33
- dateTime: string;
34
- decimalLength: string;
35
- currencyType: string;
36
- moreFmt: string;
37
- financialValue: string;
38
- roundingCurrency: string;
39
- timeDuration: string;
40
- currencyDes: string;
41
- accountingDes: string;
42
- dateType: string;
43
- dateDes: string;
44
- negType: string;
45
- generalDes: string;
46
- thousandthPercentileDes: string;
47
- addDecimal: string;
48
- subtractDecimal: string;
49
- customFormat: string;
50
- customFormatDes: string;
51
- };
52
- };
53
- };
54
- export default locale;
@@ -1,3 +0,0 @@
1
- import { default as zhCN } from './zh-CN';
2
- declare const locale: typeof zhCN;
3
- export default locale;
@@ -1,40 +0,0 @@
1
- import { IMenuSelectorItem, MenuItemType } from '@univerjs/ui';
2
- import { IAccessor } from '@univerjs/core';
3
- import { Observable } from 'rxjs';
4
- export declare const CurrencyMenuItem: (accessor: IAccessor) => {
5
- icon: Observable<string>;
6
- id: string;
7
- title: string;
8
- tooltip: string;
9
- type: MenuItemType;
10
- hidden$: Observable<boolean>;
11
- disabled$: Observable<boolean>;
12
- };
13
- export declare const AddDecimalMenuItem: (accessor: IAccessor) => {
14
- icon: string;
15
- id: string;
16
- title: string;
17
- tooltip: string;
18
- type: MenuItemType;
19
- hidden$: Observable<boolean>;
20
- disabled$: Observable<boolean>;
21
- };
22
- export declare const SubtractDecimalMenuItem: (accessor: IAccessor) => {
23
- icon: string;
24
- id: string;
25
- title: string;
26
- tooltip: string;
27
- type: MenuItemType;
28
- hidden$: Observable<boolean>;
29
- disabled$: Observable<boolean>;
30
- };
31
- export declare const PercentMenuItem: (accessor: IAccessor) => {
32
- icon: string;
33
- id: string;
34
- title: string;
35
- tooltip: string;
36
- type: MenuItemType;
37
- hidden$: Observable<boolean>;
38
- disabled$: Observable<boolean>;
39
- };
40
- export declare const FactoryOtherMenuItem: (accessor: IAccessor) => IMenuSelectorItem;