@univerjs/sheets-formula 0.1.0-beta.2 → 0.1.0-beta.3
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.
- package/{LICENSE.txt → LICENSE} +0 -2
- package/lib/cjs/index.js +7 -7
- package/lib/es/index.js +2807 -2611
- package/lib/index.css +1 -1
- package/lib/types/controllers/prompt.controller.d.ts +4 -1
- package/lib/types/controllers/update-formula.controller.d.ts +1 -0
- package/lib/types/controllers/utils/__tests__/redo-undo-formula-data.spec.d.ts +16 -0
- package/lib/types/controllers/utils/offset-formula-data.d.ts +52 -0
- package/lib/types/controllers/utils/redo-undo-formula-data.d.ts +19 -0
- package/lib/umd/index.js +6 -6
- package/package.json +45 -43
- package/lib/types/controllers/utils.d.ts +0 -27
- /package/lib/types/controllers/{__tests__/utils.spec.d.ts → utils/__tests__/offset-formula-data.spec.d.ts} +0 -0
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-formula-error-function{position:absolute}.univer-formula-help-function{-webkit-user-select:none;user-select:none;box-sizing:border-box;width:250px;margin:0;line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-help-function-title{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;padding:var(--padding-base) var(--padding-lg);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color));border-bottom:1px solid rgb(var(--border-color))}.univer-formula-help-function-title-icons{display:flex}.univer-formula-help-function-title-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-left:var(--margin-xs);padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-formula-help-function-title-icon:hover{background-color:rgb(var(--bg-color-hover))}.univer-formula-help-function-content{overflow-y:auto;box-sizing:border-box;max-height:350px;padding:0 var(--padding-lg) var(--padding-base) var(--padding-lg)}.univer-formula-help-function-content-inner{margin-top:var(--margin-sm)}.univer-formula-help-function-content-params{margin:var(--margin-xs) 0}.univer-formula-help-function-content-params-title{margin-bottom:var(--margin-xs);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color))}.univer-formula-help-function-content-params-detail{font-size:var(--font-size-xxs);font-weight:400;color:rgb(var(--text-color-secondary))}.univer-formula-help-function-active{color:rgb(var(--primary-color))}.univer-formula-help-decorator{cursor:pointer;position:fixed;z-index:10;display:flex;align-items:center;justify-content:center;padding:var(--padding-xs)}.univer-formula-search-function{overflow-y:auto;box-sizing:border-box;width:250px;max-height:400px;margin:0;padding:var(--padding-sm);line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-search-function-item{cursor:pointer;box-sizing:border-box;padding:var(--padding-xs) var(--padding-sm);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-search-function-item-name{font-size:var(--font-size-xs)}.univer-formula-search-function-item-name-light{color:rgb(var(--error-color))}.univer-formula-search-function-item-desc{display:block;font-size:var(--font-size-xxs);color:rgb(var(--grey-500))}.univer-formula-search-function-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-more-functions{display:flex;flex-direction:column;justify-content:space-between;height:100%;line-height:20px}.univer-formula-more-functions-operation{display:flex;justify-content:flex-end}.univer-formula-more-functions-operation>button{margin:0 0 var(--margin-lg) var(--margin-base)}.univer-formula-function-params{margin-bottom:var(--margin-xs);font-size:var(--font-size-xxs)}.univer-formula-function-params-title{font-weight:500;color:rgb(var(--text-color-secondary))}.univer-formula-function-params-detail{font-weight:400;color:rgb(var(--text-color))}.univer-formula-input-params-list{overflow-y:auto;height:364px}.univer-formula-input-params-list-item-name{font-size:var(--font-size-sm)}.univer-formula-input-params-list-item-selector{margin:var(--margin-xxs) 0 var(--margin-xs) 0}.univer-formula-select-function-select{display:flex;gap:10%;align-items:center;justify-content:space-between}.univer-formula-select-function-result{-webkit-user-select:none;user-select:none;overflow-y:auto;box-sizing:border-box;width:100%;height:364px;margin:0;margin-top:var(--margin-xs);padding:var(--padding-base);list-style:none;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);outline:none}.univer-formula-select-function-result-item{cursor:pointer;position:relative;box-sizing:border-box;padding:var(--padding-xs) 28px;font-size:var(--font-size-xs);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-select-function-result-item>span{display:block}.univer-formula-select-function-result-item-name-light{color:rgb(var(--error-color))}.univer-formula-select-function-result-item-selected{position:absolute;top:50%;left:6px;transform:translateY(-50%);display:inline-flex;font-size:var(--font-size-lg);color:rgb(var(--success-color))}.univer-formula-select-function-result-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-select-function-content{overflow-y:auto;max-height:307px;margin:var(--margin-xs) 0}
|
|
1
|
+
.univer-formula-error-function{position:absolute}.univer-formula-help-function{-webkit-user-select:none;user-select:none;box-sizing:border-box;width:250px;margin:0;line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-help-function-title{display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;padding:var(--padding-base) var(--padding-lg);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color));overflow-wrap:anywhere;border-bottom:1px solid rgb(var(--border-color))}.univer-formula-help-function-title-icons{display:flex}.univer-formula-help-function-title-icon{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-left:var(--margin-xs);padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-formula-help-function-title-icon:hover{background-color:rgb(var(--bg-color-hover))}.univer-formula-help-function-content{overflow-y:auto;box-sizing:border-box;max-height:350px;padding:0 var(--padding-lg) var(--padding-base) var(--padding-lg)}.univer-formula-help-function-content-inner{margin-top:var(--margin-sm)}.univer-formula-help-function-content-params{margin:var(--margin-xs) 0}.univer-formula-help-function-content-params-title{margin-bottom:var(--margin-xs);font-size:var(--font-size-xs);font-weight:500;color:rgb(var(--text-color))}.univer-formula-help-function-content-params-detail{font-size:var(--font-size-xxs);font-weight:400;color:rgb(var(--text-color-secondary))}.univer-formula-help-function-active{color:rgb(var(--primary-color))}.univer-formula-help-decorator{cursor:pointer;position:fixed;z-index:10;display:flex;align-items:center;justify-content:center;padding:var(--padding-xs)}.univer-formula-search-function{overflow-y:auto;box-sizing:border-box;width:250px;max-height:400px;margin:0;padding:var(--padding-sm);line-height:20px;list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-formula-search-function-item{cursor:pointer;box-sizing:border-box;padding:var(--padding-xs) var(--padding-sm);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-search-function-item-name{font-size:var(--font-size-xs)}.univer-formula-search-function-item-name-light{color:rgb(var(--error-color))}.univer-formula-search-function-item-desc{display:block;font-size:var(--font-size-xxs);color:rgb(var(--grey-500))}.univer-formula-search-function-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-more-functions{display:flex;flex-direction:column;justify-content:space-between;height:100%;line-height:20px}.univer-formula-more-functions-operation{display:flex;justify-content:flex-end}.univer-formula-more-functions-operation>button{margin:0 0 var(--margin-lg) var(--margin-base)}.univer-formula-function-params{margin-bottom:var(--margin-xs);font-size:var(--font-size-xxs)}.univer-formula-function-params-title{font-weight:500;color:rgb(var(--text-color-secondary))}.univer-formula-function-params-detail{font-weight:400;color:rgb(var(--text-color))}.univer-formula-input-params-list{overflow-y:auto;height:364px}.univer-formula-input-params-list-item-name{font-size:var(--font-size-sm)}.univer-formula-input-params-list-item-selector{margin:var(--margin-xxs) 0 var(--margin-xs) 0}.univer-formula-select-function-select{display:flex;gap:10%;align-items:center;justify-content:space-between}.univer-formula-select-function-result{-webkit-user-select:none;user-select:none;overflow-y:auto;box-sizing:border-box;width:100%;height:364px;margin:0;margin-top:var(--margin-xs);padding:var(--padding-base);list-style:none;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);outline:none}.univer-formula-select-function-result-item{cursor:pointer;position:relative;box-sizing:border-box;padding:var(--padding-xs) 28px;font-size:var(--font-size-xs);color:rgb(var(--text-color));border-radius:var(--border-radius-base);transition:background .2s}.univer-formula-select-function-result-item>span{display:block}.univer-formula-select-function-result-item-name-light{color:rgb(var(--error-color))}.univer-formula-select-function-result-item-selected{position:absolute;top:50%;left:6px;transform:translateY(-50%);display:inline-flex;font-size:var(--font-size-lg);color:rgb(var(--success-color))}.univer-formula-select-function-result-item-active{background-color:rgb(var(--bg-color-hover))}.univer-formula-select-function-content{overflow-y:auto;max-height:307px;margin:var(--margin-xs) 0}
|
|
@@ -20,6 +20,7 @@ import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/en
|
|
|
20
20
|
import { SelectionManagerService } from '@univerjs/sheets';
|
|
21
21
|
import type { EditorBridgeService } from '@univerjs/sheets-ui';
|
|
22
22
|
import { ISelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
|
|
23
|
+
import { IContextMenuService } from '@univerjs/ui';
|
|
23
24
|
import { IDescriptionService } from '../services/description.service';
|
|
24
25
|
import { IFormulaInputService } from '../services/formula-input.service';
|
|
25
26
|
import { IFormulaPromptService } from '../services/prompt.service';
|
|
@@ -40,6 +41,7 @@ export declare class PromptController extends Disposable {
|
|
|
40
41
|
private readonly _textSelectionManagerService;
|
|
41
42
|
private readonly _formulaInputService;
|
|
42
43
|
private readonly _docViewModelManagerService;
|
|
44
|
+
private readonly _contextMenuService;
|
|
43
45
|
private _formulaRefColors;
|
|
44
46
|
private _previousSequenceNodes;
|
|
45
47
|
private _previousRangesCount;
|
|
@@ -53,7 +55,7 @@ export declare class PromptController extends Disposable {
|
|
|
53
55
|
private _numberColor;
|
|
54
56
|
private _insertSelections;
|
|
55
57
|
private _inputPanelState;
|
|
56
|
-
constructor(_commandService: ICommandService, _contextService: IContextService, _textSelectionRenderManager: ITextSelectionRenderManager, _editorBridgeService: EditorBridgeService, _formulaPromptService: IFormulaPromptService, _lexerTreeBuilder: LexerTreeBuilder, _renderManagerService: IRenderManagerService, _themeService: ThemeService, _selectionManagerService: SelectionManagerService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _currentUniverService: IUniverInstanceService, _selectionRenderService: ISelectionRenderService, _descriptionService: IDescriptionService, _textSelectionManagerService: TextSelectionManagerService, _formulaInputService: IFormulaInputService, _docViewModelManagerService: DocViewModelManagerService);
|
|
58
|
+
constructor(_commandService: ICommandService, _contextService: IContextService, _textSelectionRenderManager: ITextSelectionRenderManager, _editorBridgeService: EditorBridgeService, _formulaPromptService: IFormulaPromptService, _lexerTreeBuilder: LexerTreeBuilder, _renderManagerService: IRenderManagerService, _themeService: ThemeService, _selectionManagerService: SelectionManagerService, _sheetSkeletonManagerService: SheetSkeletonManagerService, _currentUniverService: IUniverInstanceService, _selectionRenderService: ISelectionRenderService, _descriptionService: IDescriptionService, _textSelectionManagerService: TextSelectionManagerService, _formulaInputService: IFormulaInputService, _docViewModelManagerService: DocViewModelManagerService, _contextMenuService: IContextMenuService);
|
|
57
59
|
dispose(): void;
|
|
58
60
|
private _resetTemp;
|
|
59
61
|
private _initialize;
|
|
@@ -152,6 +154,7 @@ export declare class PromptController extends Disposable {
|
|
|
152
154
|
private _updateRefSelectionStyle;
|
|
153
155
|
private _changeControlSelection;
|
|
154
156
|
private _refreshFormulaAndCellEditor;
|
|
157
|
+
private _setRemainCapture;
|
|
155
158
|
private _cursorStateListener;
|
|
156
159
|
private _commandExecutedListener;
|
|
157
160
|
private _moveInEditor;
|
|
@@ -28,6 +28,7 @@ export declare class UpdateFormulaController extends Disposable {
|
|
|
28
28
|
constructor(_currentUniverService: IUniverInstanceService, _commandService: ICommandService, _lexerTreeBuilder: LexerTreeBuilder, _formulaDataModel: FormulaDataModel, _sheetInterceptorService: SheetInterceptorService, _selectionManagerService: SelectionManagerService, _injector: Injector);
|
|
29
29
|
private _initialize;
|
|
30
30
|
private _commandExecutedListener;
|
|
31
|
+
private _handleRedoUndo;
|
|
31
32
|
private _handleSetRangeValuesMutation;
|
|
32
33
|
private _handleRemoveSheetMutation;
|
|
33
34
|
private _handleInsertSheetMutation;
|
|
@@ -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 {};
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import type { ICommandInfo, IObjectMatrixPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import { ObjectMatrix } from '@univerjs/core';
|
|
18
|
+
import type { IArrayFormulaRangeType } from '@univerjs/engine-formula';
|
|
19
|
+
import type { ISelectionWithStyle } from '@univerjs/sheets';
|
|
20
|
+
interface IFormulaDataGenerics<T> {
|
|
21
|
+
[unitId: string]: Nullable<{
|
|
22
|
+
[sheetId: string]: IObjectMatrixPrimitiveType<T>;
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export interface IRefRangeWithPosition {
|
|
26
|
+
row: number;
|
|
27
|
+
column: number;
|
|
28
|
+
range: IRange;
|
|
29
|
+
}
|
|
30
|
+
export declare function offsetFormula<T>(formulaData: IFormulaDataGenerics<T>, command: ICommandInfo, unitId: string, sheetId: string, selections?: Readonly<Nullable<ISelectionWithStyle[]>>, formulaRangeData?: IFormulaDataGenerics<IRange>, refRanges?: IRefRangeWithPosition[]): IFormulaDataGenerics<T>;
|
|
31
|
+
export declare function offsetArrayFormula(arrayFormulaRange: IArrayFormulaRangeType, command: ICommandInfo, unitId: string, sheetId: string): IArrayFormulaRangeType;
|
|
32
|
+
export declare function checkFormulaDataNull<T>(formulaData: IFormulaDataGenerics<T>, unitId: string, sheetId: string): boolean;
|
|
33
|
+
export declare function removeFormulaData<T>(formulaData: IFormulaDataGenerics<T>, unitId: string, sheetId: string): void;
|
|
34
|
+
export declare function removeValueFormulaArray<T>(formulaRange: IRange, formulaMatrix: ObjectMatrix<T>): void;
|
|
35
|
+
export declare function inFormulaRange(row: number, column: number, formulaMatrix?: ObjectMatrix<IRange>): boolean;
|
|
36
|
+
export declare function moveRangeUpdateFormulaData<T>(fromRange: IRange, toRange: IRange, fromArrayFormulaCellDataMatrix: ObjectMatrix<T>, toArrayFormulaCellDataMatrix: ObjectMatrix<T>, arrayFormulaRangeMatrix?: ObjectMatrix<IRange>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Handle arrayFormulaRange and arrayFormulaCellData. If removing rows affects the array formula, the array formula cell data needs to be cleared and will be regenerated during recalculation.
|
|
39
|
+
* @param range
|
|
40
|
+
* @param formulaMatrix
|
|
41
|
+
* @param formulaRangeMatrix
|
|
42
|
+
* @param refRanges
|
|
43
|
+
*/
|
|
44
|
+
export declare function removeFormulaArrayRow<T>(range: IRange, formulaMatrix: ObjectMatrix<T>, formulaRangeMatrix: ObjectMatrix<IRange>, refRanges?: IRefRangeWithPosition[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* Handle arrayFormulaRange and arrayFormulaCellData. If removing columns affects the array formula, the array formula cell data needs to be cleared and will be regenerated during recalculation.
|
|
47
|
+
* @param range
|
|
48
|
+
* @param formulaRangeMatrix
|
|
49
|
+
* @param refRanges
|
|
50
|
+
*/
|
|
51
|
+
export declare function removeFormulaArrayColumn<T>(range: IRange, formulaMatrix: ObjectMatrix<T>, formulaRangeMatrix: ObjectMatrix<IRange>, refRanges?: IRefRangeWithPosition[]): void;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import type { ICommandInfo } from '@univerjs/core';
|
|
17
|
+
import type { IArrayFormulaRangeType, IArrayFormulaUnitCellType, IFormulaData } from '@univerjs/engine-formula';
|
|
18
|
+
import type { IMoveRangeMutationParams } from '@univerjs/sheets';
|
|
19
|
+
export declare function handleRedoUndoMoveRange(command: ICommandInfo<IMoveRangeMutationParams>, formulaData: IFormulaData, arrayFormulaRange: IArrayFormulaRangeType, arrayFormulaCellData: IArrayFormulaUnitCellType): void;
|