@univerjs/sheets-numfmt 0.1.0-alpha.1

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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/lib/cjs/index.js +2844 -0
  4. package/lib/cjs/locale/en-US.js +50 -0
  5. package/lib/cjs/locale/zh-CN.js +50 -0
  6. package/lib/esm/index.js +2832 -0
  7. package/lib/esm/locale/en-US.js +29 -0
  8. package/lib/esm/locale/zh-CN.js +29 -0
  9. package/lib/index.css +78 -0
  10. package/lib/types/base/const/CURRENCY-SYMBOLS.d.ts +2 -0
  11. package/lib/types/base/const/CURRENCY-SYMBOLS.d.ts.map +1 -0
  12. package/lib/types/base/const/FORMATDETAIL.d.ts +23 -0
  13. package/lib/types/base/const/FORMATDETAIL.d.ts.map +1 -0
  14. package/lib/types/base/const/PLUGIN_NAME.d.ts +2 -0
  15. package/lib/types/base/const/PLUGIN_NAME.d.ts.map +1 -0
  16. package/lib/types/base/types/index.d.ts +8 -0
  17. package/lib/types/base/types/index.d.ts.map +1 -0
  18. package/lib/types/commands/commands/add.decimal.command.d.ts +3 -0
  19. package/lib/types/commands/commands/add.decimal.command.d.ts.map +1 -0
  20. package/lib/types/commands/commands/set.currency.command.d.ts +3 -0
  21. package/lib/types/commands/commands/set.currency.command.d.ts.map +1 -0
  22. package/lib/types/commands/commands/set.numfmt.command.d.ts +12 -0
  23. package/lib/types/commands/commands/set.numfmt.command.d.ts.map +1 -0
  24. package/lib/types/commands/commands/subtract.decimal.command.d.ts +3 -0
  25. package/lib/types/commands/commands/subtract.decimal.command.d.ts.map +1 -0
  26. package/lib/types/commands/operators/close.numfmt.panel.operator.d.ts +3 -0
  27. package/lib/types/commands/operators/close.numfmt.panel.operator.d.ts.map +1 -0
  28. package/lib/types/commands/operators/open.numfmt.panel.operator.d.ts +3 -0
  29. package/lib/types/commands/operators/open.numfmt.panel.operator.d.ts.map +1 -0
  30. package/lib/types/components/accounting/index.d.ts +5 -0
  31. package/lib/types/components/accounting/index.d.ts.map +1 -0
  32. package/lib/types/components/currency/index.d.ts +6 -0
  33. package/lib/types/components/currency/index.d.ts.map +1 -0
  34. package/lib/types/components/date/index.d.ts +5 -0
  35. package/lib/types/components/date/index.d.ts.map +1 -0
  36. package/lib/types/components/general/index.d.ts +5 -0
  37. package/lib/types/components/general/index.d.ts.map +1 -0
  38. package/lib/types/components/index.d.ts +16 -0
  39. package/lib/types/components/index.d.ts.map +1 -0
  40. package/lib/types/components/more-numfmt-type/MoreNumfmtType.d.ts +6 -0
  41. package/lib/types/components/more-numfmt-type/MoreNumfmtType.d.ts.map +1 -0
  42. package/lib/types/components/thousandth-percentile/index.d.ts +5 -0
  43. package/lib/types/components/thousandth-percentile/index.d.ts.map +1 -0
  44. package/lib/types/context/user-habit.d.ts +3 -0
  45. package/lib/types/context/user-habit.d.ts.map +1 -0
  46. package/lib/types/controllers/numfmt.controller.d.ts +42 -0
  47. package/lib/types/controllers/numfmt.controller.d.ts.map +1 -0
  48. package/lib/types/controllers/numfmt.editor.controller.d.ts +22 -0
  49. package/lib/types/controllers/numfmt.editor.controller.d.ts.map +1 -0
  50. package/lib/types/controllers/numfmt.ref-range.controller.d.ts +16 -0
  51. package/lib/types/controllers/numfmt.ref-range.controller.d.ts.map +1 -0
  52. package/lib/types/controllers/numfmt.sheet.controller.d.ts +12 -0
  53. package/lib/types/controllers/numfmt.sheet.controller.d.ts.map +1 -0
  54. package/lib/types/controllers/type.d.ts +5 -0
  55. package/lib/types/controllers/type.d.ts.map +1 -0
  56. package/lib/types/controllers/user-habit.controller.d.ts +19 -0
  57. package/lib/types/controllers/user-habit.controller.d.ts.map +1 -0
  58. package/lib/types/hooks/useCurrencyOptions.d.ts +5 -0
  59. package/lib/types/hooks/useCurrencyOptions.d.ts.map +1 -0
  60. package/lib/types/hooks/useNextTick.d.ts +2 -0
  61. package/lib/types/hooks/useNextTick.d.ts.map +1 -0
  62. package/lib/types/index.d.ts +2 -0
  63. package/lib/types/index.d.ts.map +1 -0
  64. package/lib/types/locale/en-US.d.ts +26 -0
  65. package/lib/types/locale/en-US.d.ts.map +1 -0
  66. package/lib/types/locale/index.d.ts +1 -0
  67. package/lib/types/locale/index.d.ts.map +1 -0
  68. package/lib/types/locale/zh-CN.d.ts +26 -0
  69. package/lib/types/locale/zh-CN.d.ts.map +1 -0
  70. package/lib/types/menu/menu.d.ts +32 -0
  71. package/lib/types/menu/menu.d.ts.map +1 -0
  72. package/lib/types/numfmt-plugin.d.ts +9 -0
  73. package/lib/types/numfmt-plugin.d.ts.map +1 -0
  74. package/lib/types/utils/currency.d.ts +2 -0
  75. package/lib/types/utils/currency.d.ts.map +1 -0
  76. package/lib/types/utils/decimal.d.ts +12 -0
  77. package/lib/types/utils/decimal.d.ts.map +1 -0
  78. package/lib/types/utils/options.d.ts +19 -0
  79. package/lib/types/utils/options.d.ts.map +1 -0
  80. package/lib/types/utils/pattern.d.ts +10 -0
  81. package/lib/types/utils/pattern.d.ts.map +1 -0
  82. package/package.json +68 -0
@@ -0,0 +1,32 @@
1
+ import type { ComponentManager, IMenuButtonItem } from '@univerjs/ui';
2
+ import { MenuGroup, MenuItemType, MenuPosition } from '@univerjs/ui';
3
+ import type { IAccessor } from '@wendellhu/redi';
4
+ export declare const CurrencyMenuItem: (componentManager: ComponentManager) => () => {
5
+ icon: string;
6
+ id: string;
7
+ title: string;
8
+ tooltip: string;
9
+ type: MenuItemType;
10
+ group: MenuGroup;
11
+ positions: MenuPosition[];
12
+ };
13
+ export declare const AddDecimalMenuItem: (componentManager: ComponentManager) => () => {
14
+ icon: string;
15
+ id: string;
16
+ title: string;
17
+ tooltip: string;
18
+ type: MenuItemType;
19
+ positions: MenuPosition[];
20
+ group: MenuGroup;
21
+ };
22
+ export declare const SubtractDecimalMenuItem: (componentManager: ComponentManager) => () => {
23
+ icon: string;
24
+ id: string;
25
+ title: string;
26
+ tooltip: string;
27
+ type: MenuItemType;
28
+ group: MenuGroup;
29
+ positions: MenuPosition[];
30
+ };
31
+ export declare const FactoryOtherMenuItem: (componentManager: ComponentManager) => (_accessor: IAccessor) => IMenuButtonItem<undefined>;
32
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/menu/menu.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAajD,eAAO,MAAM,gBAAgB,qBAAsB,gBAAgB;;;;;;;;CAalE,CAAC;AAEF,eAAO,MAAM,kBAAkB,qBAAsB,gBAAgB;;;;;;;;CAYpE,CAAC;AACF,eAAO,MAAM,uBAAuB,qBAAsB,gBAAgB;;;;;;;;CAYzE,CAAC;AAEF,eAAO,MAAM,oBAAoB,qBAAsB,gBAAgB,iBAEhD,SAAS,+BAgD/B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Plugin, PluginType } from '@univerjs/core';
2
+ import { Injector } from '@wendellhu/redi';
3
+ export declare class NumfmtPlugin extends Plugin {
4
+ readonly _injector: Injector;
5
+ static type: PluginType;
6
+ constructor(_injector: Injector);
7
+ onStarting(): void;
8
+ }
9
+ //# sourceMappingURL=numfmt-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numfmt-plugin.d.ts","sourceRoot":"","sources":["../../src/numfmt-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAUnD,qBAAa,YAAa,SAAQ,MAAM;aAEY,SAAS,EAAE,QAAQ;IADnE,OAAgB,IAAI,aAAoB;gBACQ,SAAS,EAAE,QAAQ;IAI1D,UAAU,IAAI,IAAI;CAO9B"}
@@ -0,0 +1,2 @@
1
+ export declare const getCurrencyType: (pattern: string) => string | undefined;
2
+ //# sourceMappingURL=currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,YAAa,MAAM,uBAG9C,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * the function decimal just use positive,negative configuration ignored
3
+ */
4
+ export declare const getDecimalFromPattern: (pattern: string, defaultValue?: number) => number;
5
+ /**
6
+ * Determines whether two pattern are equal, excluding differences in decimal places
7
+ */
8
+ export declare const isPatternEqualWithoutDecimal: (patternA: string, patternB: string) => boolean;
9
+ export declare const getDecimalString: (length: number) => string;
10
+ export declare const setPatternDecimal: (patterns: string, decimalLength: number) => string;
11
+ export declare const isPatternHasDecimal: (pattern: string) => boolean;
12
+ //# sourceMappingURL=decimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/utils/decimal.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,qBAAqB,YAAa,MAAM,iBAAgB,MAAM,WAO1E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,aAAc,MAAM,YAAY,MAAM,YA0B9E,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,WAC0B,CAAC;AAE1E,eAAO,MAAM,iBAAiB,aAAc,MAAM,iBAAiB,MAAM,WAkBxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAa,MAAM,YAAwD,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const getCurrencyOptions: () => {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export declare const getCurrencyFormatOptions: (suffix: string) => {
6
+ label: string;
7
+ value: string;
8
+ color: string | undefined;
9
+ }[];
10
+ export declare const getDateFormatOptions: () => {
11
+ label: string;
12
+ value: string;
13
+ }[];
14
+ export declare const getNumberFormatOptions: () => {
15
+ label: string;
16
+ value: string;
17
+ color: string | undefined;
18
+ }[];
19
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/utils/options.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;GAAsE,CAAC;AAEtG,eAAO,MAAM,wBAAwB,WAAY,MAAM;;;;GAKhD,CAAC;AAER,eAAO,MAAM,oBAAoB;;;GAA+E,CAAC;AAEjH,eAAO,MAAM,sBAAsB;;;;GAC2D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { FormatType } from '@univerjs/sheets';
2
+ export declare const getPatternType: (pattern: string) => FormatType;
3
+ export declare const getPatternPreview: (pattern: string, value: number) => {
4
+ result: string;
5
+ color: string;
6
+ } | {
7
+ result: string;
8
+ color?: undefined;
9
+ };
10
+ //# sourceMappingURL=pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../../src/utils/pattern.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,eAAO,MAAM,cAAc,YAAa,MAAM,KAAG,UAAuD,CAAC;AACzG,eAAO,MAAM,iBAAiB,YAAa,MAAM,SAAS,MAAM;;;;;;CAc/D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@univerjs/sheets-numfmt",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "UniverSheet numfmt plugin",
5
+ "keywords": [],
6
+ "author": "DreamNum <developer@univer.ai>",
7
+ "license": "MIT",
8
+ "main": "./lib/cjs/index.js",
9
+ "module": "./lib/esm/index.js",
10
+ "types": "./lib/types/index.d.ts",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "import": "./lib/esm/index.js",
17
+ "require": "./lib/cjs/index.js",
18
+ "types": "./lib/types/index.d.ts"
19
+ },
20
+ "./*": {
21
+ "import": "./lib/esm/*",
22
+ "require": "./lib/cjs/*",
23
+ "types": "./lib/types/index.d.ts"
24
+ },
25
+ "./locale/*": {
26
+ "import": "./lib/esm/locale/*.js",
27
+ "require": "./lib/cjs/locale/*.js",
28
+ "types": "./lib/types/index.d.ts"
29
+ }
30
+ },
31
+ "directories": {
32
+ "lib": "lib"
33
+ },
34
+ "files": [
35
+ "lib"
36
+ ],
37
+ "private": false,
38
+ "dependencies": {
39
+ "@univerjs/icons": "^0.1.14",
40
+ "@wendellhu/redi": "^0.12.11",
41
+ "react": "^18.2.0",
42
+ "rxjs": "^7.8.1",
43
+ "@univerjs/engine-numfmt": "0.1.0-alpha.1",
44
+ "@univerjs/engine-render": "0.1.0-alpha.1",
45
+ "@univerjs/design": "0.1.0-alpha.1",
46
+ "@univerjs/sheets": "0.1.0-alpha.1",
47
+ "@univerjs/core": "0.1.0-alpha.1",
48
+ "@univerjs/ui": "0.1.0-alpha.1",
49
+ "@univerjs/sheets-ui": "0.1.0-alpha.1"
50
+ },
51
+ "devDependencies": {
52
+ "@types/react": "^18.2.41",
53
+ "@vitest/coverage-istanbul": "^0.34.6",
54
+ "esbuild": "^0.19.8",
55
+ "less": "^4.2.0",
56
+ "react": "^18.2.0",
57
+ "ts-node": "^10.9.1",
58
+ "typescript": "^5.3.2",
59
+ "vitest": "^0.34.6"
60
+ },
61
+ "peerDependencies": {
62
+ "react": ">=16.9.0"
63
+ },
64
+ "scripts": {
65
+ "test": "vitest run",
66
+ "esbuild": "node ./esbuild.config.mjs && tsc -p tsconfig.esbuild.json"
67
+ }
68
+ }