@univerjs/sheets-formula-ui 0.4.2 → 0.5.0-alpha.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 (88) hide show
  1. package/lib/cjs/index.js +9 -7
  2. package/lib/cjs/locale/en-US.js +40 -0
  3. package/lib/cjs/locale/fa-IR.js +40 -0
  4. package/lib/cjs/locale/ru-RU.js +40 -0
  5. package/lib/cjs/locale/vi-VN.js +37 -0
  6. package/lib/cjs/locale/zh-CN.js +38 -0
  7. package/lib/cjs/locale/zh-TW.js +38 -0
  8. package/lib/es/index.js +3317 -2424
  9. package/lib/es/locale/en-US.js +7684 -0
  10. package/lib/es/locale/fa-IR.js +7684 -0
  11. package/lib/es/locale/ru-RU.js +7683 -0
  12. package/lib/es/locale/vi-VN.js +7467 -0
  13. package/lib/es/locale/zh-CN.js +7661 -0
  14. package/lib/es/locale/zh-TW.js +7661 -0
  15. package/lib/index.css +1 -1
  16. package/lib/types/controllers/config.schema.d.ts +1 -1
  17. package/lib/types/controllers/formula-editor-show.controller.d.ts +4 -3
  18. package/lib/types/index.d.ts +1 -0
  19. package/lib/types/locale/en-US.d.ts +344 -156
  20. package/lib/types/locale/fa-IR.d.ts +344 -156
  21. package/lib/types/locale/function-list/compatibility/en-US.d.ts +106 -30
  22. package/lib/types/locale/function-list/compatibility/ja-JP.d.ts +106 -30
  23. package/lib/types/locale/function-list/compatibility/vi-VN.d.ts +106 -30
  24. package/lib/types/locale/function-list/compatibility/zh-CN.d.ts +106 -30
  25. package/lib/types/locale/function-list/compatibility/zh-TW.d.ts +106 -30
  26. package/lib/types/locale/function-list/lookup/en-US.d.ts +1 -5
  27. package/lib/types/locale/function-list/lookup/ja-JP.d.ts +1 -5
  28. package/lib/types/locale/function-list/lookup/vi-VN.d.ts +14 -0
  29. package/lib/types/locale/function-list/lookup/zh-CN.d.ts +1 -5
  30. package/lib/types/locale/function-list/lookup/zh-TW.d.ts +1 -5
  31. package/lib/types/locale/function-list/statistical/en-US.d.ts +173 -93
  32. package/lib/types/locale/function-list/statistical/ja-JP.d.ts +173 -93
  33. package/lib/types/locale/function-list/statistical/vi-VN.d.ts +983 -57
  34. package/lib/types/locale/function-list/statistical/zh-CN.d.ts +173 -93
  35. package/lib/types/locale/function-list/statistical/zh-TW.d.ts +173 -93
  36. package/lib/types/locale/function-list/text/en-US.d.ts +64 -28
  37. package/lib/types/locale/function-list/text/ja-JP.d.ts +64 -28
  38. package/lib/types/locale/function-list/text/ru-RU.d.ts +220 -106
  39. package/lib/types/locale/function-list/text/vi-VN.d.ts +124 -14
  40. package/lib/types/locale/function-list/text/zh-CN.d.ts +64 -28
  41. package/lib/types/locale/function-list/text/zh-TW.d.ts +64 -28
  42. package/lib/types/locale/ru-RU.d.ts +500 -234
  43. package/lib/types/locale/vi-VN.d.ts +1231 -105
  44. package/lib/types/locale/zh-CN.d.ts +344 -156
  45. package/lib/types/locale/zh-TW.d.ts +344 -156
  46. package/lib/types/sheets-formula-ui.plugin.d.ts +0 -1
  47. package/lib/types/views/formula-editor/help-function/HelpFunction.d.ts +11 -0
  48. package/lib/types/views/formula-editor/hooks/useFormulaDescribe.d.ts +7 -0
  49. package/lib/types/views/formula-editor/hooks/useFormulaSearch.d.ts +12 -0
  50. package/lib/types/views/formula-editor/hooks/useResizeScrollObserver.d.ts +18 -0
  51. package/lib/types/views/formula-editor/hooks/useSelectionAdd.d.ts +19 -0
  52. package/lib/types/views/formula-editor/hooks/useSheetSelectionChange.d.ts +3 -0
  53. package/lib/types/views/formula-editor/hooks/useStateRef.d.ts +18 -0
  54. package/lib/types/views/formula-editor/hooks/useVerify.d.ts +2 -0
  55. package/lib/types/views/formula-editor/index.d.ts +17 -0
  56. package/lib/types/views/formula-editor/search-function/SearchFunction.d.ts +12 -0
  57. package/lib/types/{controllers/utils/__tests__/ref-range-formula.spec.d.ts → views/formula-editor/utils/getFormulaText.d.ts} +1 -1
  58. package/lib/types/views/range-selector/hooks/useEmitChange.d.ts +3 -0
  59. package/lib/types/views/range-selector/hooks/useFirstHighlightDoc.d.ts +3 -0
  60. package/lib/types/views/range-selector/hooks/useFocus.d.ts +2 -0
  61. package/lib/types/views/range-selector/hooks/useFormulaToken.d.ts +2 -4
  62. package/lib/types/views/range-selector/hooks/useHighlight.d.ts +4 -2
  63. package/lib/types/views/range-selector/hooks/useLeftAndRightArrow.d.ts +2 -0
  64. package/lib/types/views/range-selector/hooks/useOnlyOneRange.d.ts +16 -0
  65. package/lib/types/views/range-selector/hooks/useRefactorEffect.d.ts +1 -1
  66. package/lib/types/{controllers/utils/__tests__/offset-formula-data.spec.d.ts → views/range-selector/hooks/useRefocus.d.ts} +1 -1
  67. package/lib/types/views/range-selector/hooks/useResetSelection.d.ts +16 -0
  68. package/lib/types/views/range-selector/hooks/useSheetSelectionChange.d.ts +1 -1
  69. package/lib/types/views/range-selector/hooks/useSwitchSheet.d.ts +16 -0
  70. package/lib/types/views/range-selector/hooks/useVerify.d.ts +2 -2
  71. package/lib/types/views/range-selector/index.d.ts +1 -5
  72. package/lib/types/views/range-selector/utils/unitRangesToText.d.ts +1 -1
  73. package/lib/umd/index.js +9 -7
  74. package/lib/umd/locale/en-US.js +40 -0
  75. package/lib/umd/locale/fa-IR.js +40 -0
  76. package/lib/umd/locale/ru-RU.js +40 -0
  77. package/lib/umd/locale/vi-VN.js +37 -0
  78. package/lib/umd/locale/zh-CN.js +38 -0
  79. package/lib/umd/locale/zh-TW.js +38 -0
  80. package/package.json +35 -27
  81. package/lib/locale/en-US.json +0 -11054
  82. package/lib/locale/fa-IR.json +0 -11054
  83. package/lib/locale/ru-RU.json +0 -10969
  84. package/lib/locale/vi-VN.json +0 -9678
  85. package/lib/locale/zh-CN.json +0 -11054
  86. package/lib/locale/zh-TW.json +0 -11054
  87. package/lib/types/controllers/utils/offset-formula-data.d.ts +0 -15
  88. package/lib/types/controllers/utils/ref-range-formula.d.ts +0 -71
@@ -13,7 +13,6 @@ export declare class UniverSheetsFormulaUIPlugin extends Plugin {
13
13
  static type: UniverInstanceType;
14
14
  constructor(_config: Partial<IUniverSheetsFormulaBaseConfig> | undefined, _injector: Injector, _renderManagerService: IRenderManagerService, _configService: IConfigService);
15
15
  onStarting(): void;
16
- onReady(): void;
17
16
  onRendered(): void;
18
17
  onSteady(): void;
19
18
  }
@@ -0,0 +1,11 @@
1
+ import { IFunctionInfo } from '@univerjs/engine-formula';
2
+ import { default as React } from 'react';
3
+ interface IHelpFunctionProps {
4
+ functionInfo?: IFunctionInfo;
5
+ paramIndex: number;
6
+ editorId: string;
7
+ onParamsSwitch?: (index: number) => void;
8
+ onClose?: () => void;
9
+ }
10
+ export declare function HelpFunction(props: IHelpFunctionProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { IFunctionInfo } from '@univerjs/engine-formula';
3
+ export declare const useFormulaDescribe: (isNeed: boolean, formulaText: string, editor?: Editor) => {
4
+ functionInfo: IFunctionInfo | undefined;
5
+ paramIndex: number;
6
+ reset: () => void;
7
+ };
@@ -0,0 +1,12 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { ISearchItem } from '@univerjs/sheets-formula';
3
+ import { INode } from '../../range-selector/hooks/useFormulaToken';
4
+ export declare const useFormulaSearch: (isNeed: boolean, nodes?: INode[], editor?: Editor) => {
5
+ searchList: ISearchItem[];
6
+ searchText: string;
7
+ handlerFormulaReplace: (formulaName: string) => {
8
+ text: string;
9
+ offset: number;
10
+ } | undefined;
11
+ reset: () => void;
12
+ };
@@ -0,0 +1,18 @@
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
+ type Callback = () => void;
17
+ export declare const useResizeScrollObserver: (callback: Callback, delay?: number) => void;
18
+ export default useResizeScrollObserver;
@@ -0,0 +1,19 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { INode } from '../../range-selector/utils/filterReferenceNode';
3
+ /**
4
+ * 根据输入内容,以及当前光标位置判断下一个 mouseDown 事件是不是需要新增选区
5
+ *
6
+ * @param {string} unitId
7
+ * @param {INode[]} sequenceNodes
8
+ * @param {Editor} [editor]
9
+ * @return {*}
10
+ */
11
+ export declare const useSelectionAdd: (unitId: string, sequenceNodes: INode[], editor?: Editor) => {
12
+ setIsAddSelection: (v: boolean) => void;
13
+ getIsNeedAddSelection: () => boolean;
14
+ isLockSelectionEvent: {
15
+ getValue: () => boolean;
16
+ setValue: (v: boolean) => void;
17
+ reset: () => void;
18
+ };
19
+ };
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { INode } from '../../range-selector/utils/filterReferenceNode';
3
+ export declare const useSheetSelectionChange: (isNeed: boolean, unitId: string, subUnitId: string, sequenceNodes: INode[], isSupportAcrossSheet: boolean, editor?: Editor, handleRangeChange?: ((refString: string, offset: number, isEnd: boolean) => void)) => void;
@@ -0,0 +1,18 @@
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 useStateRef: <T = any>(value: T) => {
17
+ current: T;
18
+ };
@@ -0,0 +1,2 @@
1
+ import { IFormulaEditorProps } from '../index';
2
+ export declare const useVerify: (isNeed: boolean, onVerify: IFormulaEditorProps["onVerify"], formulaText: string) => void;
@@ -0,0 +1,17 @@
1
+ import { ReactNode, default as React } from 'react';
2
+ export interface IFormulaEditorProps {
3
+ unitId: string;
4
+ subUnitId: string;
5
+ initValue: `=${string}`;
6
+ onChange: (text: string) => void;
7
+ errorText?: string | ReactNode;
8
+ onVerify?: (res: boolean, result: string) => void;
9
+ isFocus?: boolean;
10
+ onFocus?: () => void;
11
+ onBlur?: () => void;
12
+ isSupportAcrossSheet?: boolean;
13
+ actions?: {
14
+ handleOutClick?: (e: MouseEvent, cb: () => void) => void;
15
+ };
16
+ }
17
+ export declare function FormulaEditor(props: IFormulaEditorProps): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { ISearchItem } from '@univerjs/sheets-formula';
2
+ import { default as React } from 'react';
3
+ interface ISearchFunctionProps {
4
+ searchList: ISearchItem[];
5
+ searchText: string;
6
+ onSelect: (functionName: string) => void;
7
+ onChange?: (functionName: string) => void;
8
+ editorId: string;
9
+ onClose?: () => void;
10
+ }
11
+ export declare const SearchFunction: React.ForwardRefExoticComponent<ISearchFunctionProps & React.RefAttributes<HTMLElement>>;
12
+ export {};
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export {};
16
+ export declare const getFormulaText: (formula: string) => string;
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { INode } from './useFormulaToken';
3
+ export declare const useEmitChange: (sequenceNodes: INode[], onChange: (v: string) => void, editor?: Editor) => () => boolean;
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ import { useDocHight, useSheetHighlight } from './useHighlight';
3
+ export declare const useFirstHighlightDoc: (text: string, leadingCharacter: string, isNeed: boolean, highlightDoc: ReturnType<typeof useDocHight>, highlightSheet: ReturnType<typeof useSheetHighlight>, editor?: Editor) => void;
@@ -0,0 +1,2 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ export declare const useFocus: (editor?: Editor) => () => void;
@@ -1,5 +1,3 @@
1
1
  import { ISequenceNode } from '@univerjs/engine-formula';
2
- export declare const useFormulaToken: (text: string) => {
3
- sequenceNodes: (string | ISequenceNode)[];
4
- sequenceNodesSet: import('react').Dispatch<import('react').SetStateAction<(string | ISequenceNode)[]>>;
5
- };
2
+ export type INode = (string | ISequenceNode);
3
+ export declare const useFormulaToken: () => (text: string) => (string | ISequenceNode)[];
@@ -1,5 +1,7 @@
1
1
  import { ITextRun } from '@univerjs/core';
2
+ import { Editor } from '@univerjs/docs-ui';
2
3
  import { ISequenceNode } from '@univerjs/engine-formula';
4
+ import { INode } from './useFormulaToken';
3
5
  import { IDescriptionService } from '@univerjs/sheets-formula';
4
6
  interface IRefSelection {
5
7
  refIndex: number;
@@ -11,8 +13,8 @@ interface IRefSelection {
11
13
  * @param {string} subUnitId 打开面板的时候传入的 sheetId
12
14
  * @param {IRefSelection[]} refSelections
13
15
  */
14
- export declare function useSheetHighlight(isNeed: boolean, unitId: string, subUnitId: string, refSelections: IRefSelection[]): void;
15
- export declare function useDocHight(editorId: string, sequenceNodes: (string | ISequenceNode)[]): IRefSelection[];
16
+ export declare function useSheetHighlight(unitId: string): (refSelections: IRefSelection[]) => void;
17
+ export declare function useDocHight(_leadingCharacter?: string): (editor: Editor, sequenceNodes: INode[], isNeedResetSelection?: boolean) => IRefSelection[];
16
18
  export declare function useColor(): {
17
19
  formulaRefColors: string[];
18
20
  numberColor: string;
@@ -0,0 +1,2 @@
1
+ import { Editor } from '@univerjs/docs-ui';
2
+ export declare const useLeftAndRightArrow: (isNeed: boolean, editor?: Editor) => void;
@@ -0,0 +1,16 @@
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 useOnlyOneRange: (unitId: string, isOnlyOneRange: boolean) => void;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const useRefactorEffect: (isNeed: boolean, unitId: string, isOnlyOneRange: boolean) => void;
16
+ export declare const useRefactorEffect: (isNeed: boolean, unitId: string) => void;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export {};
16
+ export declare const useRefocus: () => void;
@@ -0,0 +1,16 @@
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 useResetSelection: (isNeed: boolean) => () => void;
@@ -1,2 +1,2 @@
1
1
  import { INode } from '../utils/filterReferenceNode';
2
- export declare const useSheetSelectionChange: (isNeed: boolean, unitId: string, _subUnitId: string, sequenceNodes: INode[], isSupportAcrossSheet: boolean, isOnlyOneRange: boolean, handleRangeChange: (refString: string, offset: number) => void) => void;
2
+ export declare const useSheetSelectionChange: (isNeed: boolean, unitId: string, _subUnitId: string, sequenceNodes: INode[], isSupportAcrossSheet: boolean, isOnlyOneRange: boolean, handleRangeChange: (refString: string, offset: number, isEnd: boolean) => void) => void;
@@ -0,0 +1,16 @@
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 useSwitchSheet: (isNeed: boolean, unitId: string, isSupportAcrossSheet: boolean, isFocusSet: (v: boolean) => void, onBlur: () => void, refresh: () => void) => void;
@@ -1,3 +1,3 @@
1
1
  import { IRangeSelectorProps } from '../';
2
- import { useFormulaToken } from './useFormulaToken';
3
- export declare const useVerify: (onVerify: IRangeSelectorProps["onVerify"], sequenceNodes: ReturnType<typeof useFormulaToken>["sequenceNodes"]) => void;
2
+ import { INode } from './useFormulaToken';
3
+ export declare const useVerify: (isNeed: boolean, onVerify: IRangeSelectorProps["onVerify"], sequenceNodes: INode[]) => void;
@@ -10,13 +10,9 @@ export interface IRangeSelectorProps {
10
10
  placeholder?: string;
11
11
  isFocus?: boolean;
12
12
  onBlur?: () => void;
13
- /**
14
- * 暂无效果
15
- * @memberof IRangeSelectorProps
16
- */
17
13
  onFocus?: () => void;
18
14
  actions?: {
19
- handleOutClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, cb: (v: boolean) => void) => void;
15
+ handleOutClick?: (e: MouseEvent, cb: () => void) => void;
20
16
  };
21
17
  /**
22
18
  * 是否只允许最多一个 range 区域,默认为 false。
@@ -1,4 +1,4 @@
1
1
  import { IUnitRangeName, IUniverInstanceService } from '@univerjs/core';
2
2
  export declare function getSheetIdByName(univerInstanceService: IUniverInstanceService, unitId: string, name: string): string;
3
3
  export declare function getSheetNameById(univerInstanceService: IUniverInstanceService, unitId: string, sheetId: string): string;
4
- export declare const unitRangesToText: (ranges: IUnitRangeName[], isSupportAcrossSheet?: boolean) => string[];
4
+ export declare const unitRangesToText: (ranges: IUnitRangeName[], isNeedSheetName?: boolean) => string[];