@univerjs/sheets-formula-ui 1.0.4 → 1.1.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.
- package/lib/cjs/index.js +317 -173
- package/lib/cjs/locale/ar-SA.js +14 -0
- package/lib/cjs/locale/ca-ES.js +14 -0
- package/lib/cjs/locale/de-DE.js +14 -0
- package/lib/cjs/locale/en-US.js +14 -0
- package/lib/cjs/locale/es-ES.js +14 -0
- package/lib/cjs/locale/fa-IR.js +14 -0
- package/lib/cjs/locale/fr-FR.js +14 -0
- package/lib/cjs/locale/id-ID.js +14 -0
- package/lib/cjs/locale/it-IT.js +14 -0
- package/lib/cjs/locale/ja-JP.js +14 -0
- package/lib/cjs/locale/ko-KR.js +14 -0
- package/lib/cjs/locale/pl-PL.js +14 -0
- package/lib/cjs/locale/pt-BR.js +14 -0
- package/lib/cjs/locale/ru-RU.js +14 -0
- package/lib/cjs/locale/sk-SK.js +14 -0
- package/lib/cjs/locale/vi-VN.js +14 -0
- package/lib/cjs/locale/zh-CN.js +14 -0
- package/lib/cjs/locale/zh-HK.js +14 -0
- package/lib/cjs/locale/zh-TW.js +14 -0
- package/lib/es/index.js +323 -173
- package/lib/es/locale/ar-SA.js +14 -0
- package/lib/es/locale/ca-ES.js +14 -0
- package/lib/es/locale/de-DE.js +14 -0
- package/lib/es/locale/en-US.js +14 -0
- package/lib/es/locale/es-ES.js +14 -0
- package/lib/es/locale/fa-IR.js +14 -0
- package/lib/es/locale/fr-FR.js +14 -0
- package/lib/es/locale/id-ID.js +14 -0
- package/lib/es/locale/it-IT.js +14 -0
- package/lib/es/locale/ja-JP.js +14 -0
- package/lib/es/locale/ko-KR.js +14 -0
- package/lib/es/locale/pl-PL.js +14 -0
- package/lib/es/locale/pt-BR.js +14 -0
- package/lib/es/locale/ru-RU.js +14 -0
- package/lib/es/locale/sk-SK.js +14 -0
- package/lib/es/locale/vi-VN.js +14 -0
- package/lib/es/locale/zh-CN.js +14 -0
- package/lib/es/locale/zh-HK.js +14 -0
- package/lib/es/locale/zh-TW.js +14 -0
- package/lib/index.css +4 -20
- package/lib/index.js +323 -173
- package/lib/locale/ar-SA.js +14 -0
- package/lib/locale/ca-ES.js +14 -0
- package/lib/locale/de-DE.js +14 -0
- package/lib/locale/en-US.js +14 -0
- package/lib/locale/es-ES.js +14 -0
- package/lib/locale/fa-IR.js +14 -0
- package/lib/locale/fr-FR.js +14 -0
- package/lib/locale/id-ID.js +14 -0
- package/lib/locale/it-IT.js +14 -0
- package/lib/locale/ja-JP.js +14 -0
- package/lib/locale/ko-KR.js +14 -0
- package/lib/locale/pl-PL.js +14 -0
- package/lib/locale/pt-BR.js +14 -0
- package/lib/locale/ru-RU.js +14 -0
- package/lib/locale/sk-SK.js +14 -0
- package/lib/locale/vi-VN.js +14 -0
- package/lib/locale/zh-CN.js +14 -0
- package/lib/locale/zh-HK.js +14 -0
- package/lib/locale/zh-TW.js +14 -0
- package/lib/types/commands/operations/calculation-options.operation.d.ts +19 -0
- package/lib/types/controllers/formula-alert-render.controller.d.ts +14 -6
- package/lib/types/index.d.ts +0 -1
- package/lib/types/locale/en-US.d.ts +14 -0
- package/lib/types/menu/menu.d.ts +1 -0
- package/lib/types/mobile-plugin.d.ts +0 -1
- package/lib/types/plugin.d.ts +0 -1
- package/lib/types/views/calculation-options/CalculationOptions.d.ts +19 -0
- package/lib/types/views/calculation-options/interface.d.ts +17 -0
- package/lib/types/views/formula-editor/hooks/use-highlight.d.ts +2 -8
- package/lib/umd/index.js +5 -5
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -15
- package/lib/types/controllers/formula-reorder.controller.d.ts +0 -27
package/lib/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ const SheetOnlyPasteFormulaCommand = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region \0@oxc-project+runtime@0.
|
|
36
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
37
37
|
function _typeof(o) {
|
|
38
38
|
"@babel/helpers - typeof";
|
|
39
39
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -44,7 +44,7 @@ function _typeof(o) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
//#endregion
|
|
47
|
-
//#region \0@oxc-project+runtime@0.
|
|
47
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
48
48
|
function toPrimitive(t, r) {
|
|
49
49
|
if ("object" != _typeof(t) || !t) return t;
|
|
50
50
|
var e = t[Symbol.toPrimitive];
|
|
@@ -57,14 +57,14 @@ function toPrimitive(t, r) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region \0@oxc-project+runtime@0.
|
|
60
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
61
61
|
function toPropertyKey(t) {
|
|
62
62
|
var i = toPrimitive(t, "string");
|
|
63
63
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region \0@oxc-project+runtime@0.
|
|
67
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
68
68
|
function _defineProperty(e, r, t) {
|
|
69
69
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
70
70
|
value: t,
|
|
@@ -75,7 +75,7 @@ function _defineProperty(e, r, t) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
//#endregion
|
|
78
|
-
//#region \0@oxc-project+runtime@0.
|
|
78
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
79
79
|
function __decorateParam(paramIndex, decorator) {
|
|
80
80
|
return function(target, key) {
|
|
81
81
|
decorator(target, key, paramIndex);
|
|
@@ -83,7 +83,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
//#endregion
|
|
86
|
-
//#region \0@oxc-project+runtime@0.
|
|
86
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
87
87
|
function __decorate(decorators, target, key, desc) {
|
|
88
88
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
89
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -727,86 +727,49 @@ function genFormulaRefSelectionStyle(themeService, refColor, id) {
|
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
//#endregion
|
|
730
|
-
//#region src/
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
const formulaString = this._formulaDataModel.getFormulaStringByCell(targetRow, col, subUnitId, unitId);
|
|
770
|
-
const shiftedFormula = this._lexerTreeBuilder.moveFormulaRefOffset(formulaString, 0, row - targetRow);
|
|
771
|
-
const newCell = _univerjs_core.Tools.deepClone(targetCell);
|
|
772
|
-
newCell.f = shiftedFormula;
|
|
773
|
-
newCell.si = null;
|
|
774
|
-
redoFormulaMatrix.setValue(row, col, newCell);
|
|
775
|
-
} else redoFormulaMatrix.setValue(row, col, targetCell);
|
|
776
|
-
undoFormulaMatrix.setValue(row, col, cellMatrix.getValue(row, col));
|
|
777
|
-
});
|
|
778
|
-
if (!hasFormula) return {
|
|
779
|
-
redos,
|
|
780
|
-
undos
|
|
781
|
-
};
|
|
782
|
-
redos.push({
|
|
783
|
-
id: _univerjs_sheets.SetRangeValuesMutation.id,
|
|
784
|
-
params: {
|
|
785
|
-
unitId,
|
|
786
|
-
subUnitId,
|
|
787
|
-
cellValue: redoFormulaMatrix.getMatrix()
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
undos.push({
|
|
791
|
-
id: _univerjs_sheets.SetRangeValuesMutation.id,
|
|
792
|
-
params: {
|
|
793
|
-
unitId,
|
|
794
|
-
subUnitId,
|
|
795
|
-
cellValue: undoFormulaMatrix.getMatrix()
|
|
796
|
-
}
|
|
730
|
+
//#region src/views/calculation-options/interface.ts
|
|
731
|
+
/**
|
|
732
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
733
|
+
*
|
|
734
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
735
|
+
* you may not use this file except in compliance with the License.
|
|
736
|
+
* You may obtain a copy of the License at
|
|
737
|
+
*
|
|
738
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
739
|
+
*
|
|
740
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
741
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
742
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
743
|
+
* See the License for the specific language governing permissions and
|
|
744
|
+
* limitations under the License.
|
|
745
|
+
*/
|
|
746
|
+
const CALCULATION_OPTIONS_COMPONENT = "sheets-formula-ui.calculation-options";
|
|
747
|
+
const CALCULATION_OPTIONS_DIALOG = "sheets-formula-ui.calculation-options-dialog";
|
|
748
|
+
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region src/commands/operations/calculation-options.operation.ts
|
|
751
|
+
const CalculationOptionsOperation = {
|
|
752
|
+
id: "sheets-formula-ui.operation.calculation-options",
|
|
753
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
754
|
+
handler: (accessor, params) => {
|
|
755
|
+
const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
756
|
+
const workbook = (params === null || params === void 0 ? void 0 : params.unitId) ? instanceService.getUnit(params.unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
757
|
+
if (!workbook) return false;
|
|
758
|
+
const dialogService = accessor.get(_univerjs_ui.IDialogService);
|
|
759
|
+
dialogService.close(CALCULATION_OPTIONS_DIALOG);
|
|
760
|
+
dialogService.open({
|
|
761
|
+
id: CALCULATION_OPTIONS_DIALOG,
|
|
762
|
+
title: { title: "sheets-formula-ui.calculation.title" },
|
|
763
|
+
children: { label: {
|
|
764
|
+
name: CALCULATION_OPTIONS_COMPONENT,
|
|
765
|
+
props: { unitId: workbook.getUnitId() }
|
|
766
|
+
} },
|
|
767
|
+
width: 420,
|
|
768
|
+
onClose: () => dialogService.close(CALCULATION_OPTIONS_DIALOG)
|
|
797
769
|
});
|
|
798
|
-
return
|
|
799
|
-
redos,
|
|
800
|
-
undos
|
|
801
|
-
};
|
|
770
|
+
return true;
|
|
802
771
|
}
|
|
803
772
|
};
|
|
804
|
-
FormulaReorderController = __decorate([
|
|
805
|
-
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetInterceptorService)),
|
|
806
|
-
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.IUniverInstanceService)),
|
|
807
|
-
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_engine_formula.FormulaDataModel)),
|
|
808
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_engine_formula.LexerTreeBuilder))
|
|
809
|
-
], FormulaReorderController);
|
|
810
773
|
|
|
811
774
|
//#endregion
|
|
812
775
|
//#region src/menu/menu.ts
|
|
@@ -926,6 +889,16 @@ function PasteFormulaMenuItemFactory(accessor) {
|
|
|
926
889
|
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET)
|
|
927
890
|
};
|
|
928
891
|
}
|
|
892
|
+
function CalculationOptionsMenuItemFactory(accessor) {
|
|
893
|
+
return {
|
|
894
|
+
id: CalculationOptionsOperation.id,
|
|
895
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
896
|
+
icon: "CalculationOptionsIcon",
|
|
897
|
+
title: "sheets-formula-ui.calculation.title",
|
|
898
|
+
tooltip: "sheets-formula-ui.calculation.title",
|
|
899
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET)
|
|
900
|
+
};
|
|
901
|
+
}
|
|
929
902
|
|
|
930
903
|
//#endregion
|
|
931
904
|
//#region src/menu/schema.ts
|
|
@@ -986,6 +959,17 @@ const menuSchema = {
|
|
|
986
959
|
menuItemFactory: InsertDatabaseFunctionMenuItemFactory
|
|
987
960
|
}
|
|
988
961
|
},
|
|
962
|
+
[_univerjs_ui.RibbonFormulasGroup.OTHERS]: { [CalculationOptionsOperation.id]: {
|
|
963
|
+
order: 0,
|
|
964
|
+
gridLayout: {
|
|
965
|
+
row: 1,
|
|
966
|
+
column: 1,
|
|
967
|
+
rowSpan: 2,
|
|
968
|
+
columnSpan: 2,
|
|
969
|
+
showLabel: true
|
|
970
|
+
},
|
|
971
|
+
menuItemFactory: CalculationOptionsMenuItemFactory
|
|
972
|
+
} },
|
|
989
973
|
[_univerjs_sheets_ui.COPY_SPECIAL_MENU_ID]: { [SheetCopyFormulaOnlyCommand.id]: {
|
|
990
974
|
order: 0,
|
|
991
975
|
menuItemFactory: CopyFormulaOnlyMenuItemFactory
|
|
@@ -999,7 +983,7 @@ const menuSchema = {
|
|
|
999
983
|
//#endregion
|
|
1000
984
|
//#region package.json
|
|
1001
985
|
var name = "@univerjs/sheets-formula-ui";
|
|
1002
|
-
var version = "1.0
|
|
986
|
+
var version = "1.1.0";
|
|
1003
987
|
|
|
1004
988
|
//#endregion
|
|
1005
989
|
//#region src/config/config.ts
|
|
@@ -1028,63 +1012,120 @@ const ErrorTypeToMessageMap = {
|
|
|
1028
1012
|
[_univerjs_engine_formula.ErrorType.NULL]: "null"
|
|
1029
1013
|
};
|
|
1030
1014
|
let FormulaAlertRenderController = class FormulaAlertRenderController extends _univerjs_core.Disposable {
|
|
1031
|
-
constructor(_context,
|
|
1015
|
+
constructor(_context, _selectionsService, _cellAlertManagerService, _localeService, _formulaDataModel, _sheetSkeletonService, _sheetSkeletonManagerService, _commandService, _instanceService, _editorBridgeService) {
|
|
1032
1016
|
super();
|
|
1033
1017
|
this._context = _context;
|
|
1034
|
-
this.
|
|
1018
|
+
this._selectionsService = _selectionsService;
|
|
1035
1019
|
this._cellAlertManagerService = _cellAlertManagerService;
|
|
1036
1020
|
this._localeService = _localeService;
|
|
1037
1021
|
this._formulaDataModel = _formulaDataModel;
|
|
1038
|
-
this.
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
this.
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
this.disposeWithMe(this.
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
this._cellAlertManagerService.showAlert({
|
|
1065
|
-
type: _univerjs_sheets_ui.CellAlertType.ERROR,
|
|
1066
|
-
title: this._localeService.t("sheets-formula-ui.error.title"),
|
|
1067
|
-
message: this._localeService.t(`sheets-formula-ui.error.${ErrorTypeToMessageMap[errorType]}`),
|
|
1068
|
-
location: cellPos.location,
|
|
1069
|
-
width: 200,
|
|
1070
|
-
height: 74,
|
|
1071
|
-
key: ALERT_KEY
|
|
1072
|
-
});
|
|
1073
|
-
return;
|
|
1022
|
+
this._sheetSkeletonService = _sheetSkeletonService;
|
|
1023
|
+
this._sheetSkeletonManagerService = _sheetSkeletonManagerService;
|
|
1024
|
+
this._commandService = _commandService;
|
|
1025
|
+
this._instanceService = _instanceService;
|
|
1026
|
+
this._editorBridgeService = _editorBridgeService;
|
|
1027
|
+
_defineProperty(this, "_circularLocations", /* @__PURE__ */ new Set());
|
|
1028
|
+
this.disposeWithMe(this._selectionsService.selectionChanged$.subscribe(() => this._updateAlert()));
|
|
1029
|
+
this.disposeWithMe(this._context.unit.activeSheet$.subscribe(() => this._updateAlert()));
|
|
1030
|
+
this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).subscribe(() => this._updateAlert()));
|
|
1031
|
+
this.disposeWithMe(this._editorBridgeService.visible$.subscribe(() => this._updateAlert()));
|
|
1032
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
|
|
1033
|
+
if (command.id === _univerjs_engine_formula.SetFormulaCalculationNotificationMutation.id) {
|
|
1034
|
+
const params = command.params;
|
|
1035
|
+
if (params.circularReferences) {
|
|
1036
|
+
const locations = new Set(params.circularReferences.filter((cell) => cell.unitId === this._context.unit.getUnitId()).map((cell) => JSON.stringify([
|
|
1037
|
+
cell.sheetId,
|
|
1038
|
+
cell.row,
|
|
1039
|
+
cell.column
|
|
1040
|
+
])));
|
|
1041
|
+
const changed = locations.size !== this._circularLocations.size || Array.from(locations).some((location) => !this._circularLocations.has(location));
|
|
1042
|
+
this._circularLocations = locations;
|
|
1043
|
+
this._formulaDataModel.setCircularReferences(params.circularReferences);
|
|
1044
|
+
if (changed) this._refreshMarkers();
|
|
1045
|
+
this._updateAlert();
|
|
1074
1046
|
}
|
|
1047
|
+
} else if (command.id === _univerjs_sheets.SetRangeValuesMutation.id || command.id === _univerjs_sheets.SetWorkbookCalculationSettingsMutation.id) {
|
|
1048
|
+
if (command.id === _univerjs_sheets.SetWorkbookCalculationSettingsMutation.id && command.params.unitId === this._context.unit.getUnitId()) this._refreshMarkers();
|
|
1049
|
+
this._updateAlert();
|
|
1075
1050
|
}
|
|
1076
|
-
this._hideAlert();
|
|
1077
1051
|
}));
|
|
1052
|
+
this.disposeWithMe(() => this._hideAlert());
|
|
1053
|
+
}
|
|
1054
|
+
_updateAlert() {
|
|
1055
|
+
var _selections, _this$_formulaDataMod, _this$_cellAlertManag;
|
|
1056
|
+
const workbook = this._context.unit;
|
|
1057
|
+
const worksheet = workbook.getActiveSheet();
|
|
1058
|
+
const selection = this._selectionsService.currentSelectionParam;
|
|
1059
|
+
const currentWorkbook = this._instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
1060
|
+
if (!worksheet || (selection === null || selection === void 0 ? void 0 : selection.unitId) !== workbook.getUnitId() || selection.sheetId !== worksheet.getSheetId() || (currentWorkbook === null || currentWorkbook === void 0 ? void 0 : currentWorkbook.getUnitId()) !== workbook.getUnitId() || this._editorBridgeService.isVisible().visible) {
|
|
1061
|
+
this._hideAlert();
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
const selections = this._selectionsService.getCurrentSelections();
|
|
1065
|
+
const primary = selections === null || selections === void 0 || (_selections = selections[selections.length - 1]) === null || _selections === void 0 ? void 0 : _selections.primary;
|
|
1066
|
+
if (!primary) {
|
|
1067
|
+
this._hideAlert();
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
const row = primary.actualRow;
|
|
1071
|
+
const col = primary.actualColumn;
|
|
1072
|
+
const unitId = workbook.getUnitId();
|
|
1073
|
+
const subUnitId = worksheet.getSheetId();
|
|
1074
|
+
const cell = worksheet.getCell(row, col);
|
|
1075
|
+
const circular = !workbook.getCalculationSettings().iterativeCalculation && Boolean((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) && this._formulaDataModel.isCircularReference(unitId, subUnitId, row, col);
|
|
1076
|
+
const arrayCell = (_this$_formulaDataMod = this._formulaDataModel.getArrayFormulaCellData()) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[unitId]) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[subUnitId]) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[row]) === null || _this$_formulaDataMod === void 0 ? void 0 : _this$_formulaDataMod[col];
|
|
1077
|
+
const error = (0, _univerjs_core.isICellData)(cell) ? (0, _univerjs_engine_formula.extractFormulaError)(cell, !!arrayCell) : void 0;
|
|
1078
|
+
if (!circular && !error) {
|
|
1079
|
+
this._hideAlert();
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
1082
|
+
const message = circular ? this._localeService.t("sheets-formula-ui.calculation.circular") : this._localeService.t(`sheets-formula-ui.error.${ErrorTypeToMessageMap[error]}`);
|
|
1083
|
+
const previous = (_this$_cellAlertManag = this._cellAlertManagerService.currentAlert.get(this._alertKey)) === null || _this$_cellAlertManag === void 0 ? void 0 : _this$_cellAlertManag.alert;
|
|
1084
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.location.row) === row && previous.location.col === col && previous.location.subUnitId === subUnitId && previous.message === message && Boolean(previous.action) === circular) return;
|
|
1085
|
+
this._cellAlertManagerService.showAlert({
|
|
1086
|
+
type: _univerjs_sheets_ui.CellAlertType.ERROR,
|
|
1087
|
+
title: this._localeService.t(circular ? "sheets-formula-ui.calculation.circularTitle" : "sheets-formula-ui.error.title"),
|
|
1088
|
+
message,
|
|
1089
|
+
location: {
|
|
1090
|
+
unitId,
|
|
1091
|
+
subUnitId,
|
|
1092
|
+
row,
|
|
1093
|
+
col
|
|
1094
|
+
},
|
|
1095
|
+
width: 240,
|
|
1096
|
+
height: circular ? 124 : 74,
|
|
1097
|
+
key: this._alertKey,
|
|
1098
|
+
action: circular ? {
|
|
1099
|
+
label: this._localeService.t("sheets-formula-ui.calculation.action"),
|
|
1100
|
+
onSelect: () => {
|
|
1101
|
+
this._commandService.syncExecuteCommand(CalculationOptionsOperation.id, { unitId });
|
|
1102
|
+
}
|
|
1103
|
+
} : void 0
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
get _alertKey() {
|
|
1107
|
+
return `${ALERT_KEY}:${this._context.unit.getUnitId()}`;
|
|
1108
|
+
}
|
|
1109
|
+
_refreshMarkers() {
|
|
1110
|
+
var _this$_context$mainCo;
|
|
1111
|
+
this._sheetSkeletonService.getSkeletonsByUnitId(this._context.unit.getUnitId()).forEach((skeleton) => skeleton.resetCache());
|
|
1112
|
+
this._sheetSkeletonManagerService.reCalculate();
|
|
1113
|
+
(_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 || _this$_context$mainCo.makeDirty();
|
|
1078
1114
|
}
|
|
1079
1115
|
_hideAlert() {
|
|
1080
|
-
this._cellAlertManagerService.removeAlert(
|
|
1116
|
+
this._cellAlertManagerService.removeAlert(this._alertKey);
|
|
1081
1117
|
}
|
|
1082
1118
|
};
|
|
1083
1119
|
FormulaAlertRenderController = __decorate([
|
|
1084
|
-
__decorateParam(1, (0, _univerjs_core.Inject)(
|
|
1120
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService)),
|
|
1085
1121
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.CellAlertManagerService)),
|
|
1086
1122
|
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
1087
|
-
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_engine_formula.FormulaDataModel))
|
|
1123
|
+
__decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_engine_formula.FormulaDataModel)),
|
|
1124
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetSkeletonService)),
|
|
1125
|
+
__decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_sheets_ui.SheetSkeletonManagerService)),
|
|
1126
|
+
__decorateParam(7, _univerjs_core.ICommandService),
|
|
1127
|
+
__decorateParam(8, _univerjs_core.IUniverInstanceService),
|
|
1128
|
+
__decorateParam(9, _univerjs_sheets_ui.IEditorBridgeService)
|
|
1088
1129
|
], FormulaAlertRenderController);
|
|
1089
1130
|
|
|
1090
1131
|
//#endregion
|
|
@@ -1716,7 +1757,9 @@ let FormulaRenderManagerController = class FormulaRenderManagerController extend
|
|
|
1716
1757
|
handler: (cell, pos, next) => {
|
|
1717
1758
|
var _this$_formulaDataMod;
|
|
1718
1759
|
const arrayFormulaCellData = (_this$_formulaDataMod = this._formulaDataModel.getArrayFormulaCellData()) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[pos.unitId]) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[pos.subUnitId]) === null || _this$_formulaDataMod === void 0 || (_this$_formulaDataMod = _this$_formulaDataMod[pos.row]) === null || _this$_formulaDataMod === void 0 ? void 0 : _this$_formulaDataMod[pos.col];
|
|
1719
|
-
|
|
1760
|
+
const errorType = (0, _univerjs_engine_formula.extractFormulaError)(cell, !!arrayFormulaCellData);
|
|
1761
|
+
const circular = Boolean((cell === null || cell === void 0 ? void 0 : cell.f) || (cell === null || cell === void 0 ? void 0 : cell.si)) && !pos.workbook.getCalculationSettings().iterativeCalculation && this._formulaDataModel.isCircularReference(pos.unitId, pos.subUnitId, pos.row, pos.col);
|
|
1762
|
+
if (!errorType && !circular) return next(cell);
|
|
1720
1763
|
if (!cell) return next(cell);
|
|
1721
1764
|
if (cell === pos.rawData) cell = { ...pos.rawData };
|
|
1722
1765
|
cell.markers = {
|
|
@@ -2333,6 +2376,7 @@ function useFormulaSelecting(opts) {
|
|
|
2333
2376
|
});
|
|
2334
2377
|
const calculateSelectingType = (0, _univerjs_ui.useEvent)(() => {
|
|
2335
2378
|
var _editor$getSelectionR, _config$dataStream;
|
|
2379
|
+
if (!isFocus) return;
|
|
2336
2380
|
const currentWorkbook = resolveFormulaSelectionWorkbook(univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET), workbook);
|
|
2337
2381
|
if (!currentWorkbook) return;
|
|
2338
2382
|
const currentSheet = currentWorkbook.getActiveSheet();
|
|
@@ -2608,7 +2652,7 @@ function useDocHight(_leadingCharacter = "") {
|
|
|
2608
2652
|
});
|
|
2609
2653
|
return [];
|
|
2610
2654
|
} else {
|
|
2611
|
-
const { textRuns, refSelections } =
|
|
2655
|
+
const { textRuns, refSelections } = (0, _univerjs_engine_formula.buildFormulaTextRuns)(descriptionService, colorMap, sequenceNodes);
|
|
2612
2656
|
if (leadingCharacterLength) textRuns.forEach((e) => {
|
|
2613
2657
|
e.ed = e.ed + leadingCharacterLength;
|
|
2614
2658
|
e.st = e.st + leadingCharacterLength;
|
|
@@ -2653,31 +2697,28 @@ function createHighlightTextRuns(textRuns, leadingCharacterLength) {
|
|
|
2653
2697
|
}
|
|
2654
2698
|
function useColor() {
|
|
2655
2699
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
2656
|
-
const
|
|
2700
|
+
const canvasColorService = (0, _univerjs_ui.useDependency)(_univerjs_engine_render.ICanvasColorService);
|
|
2701
|
+
const theme = (0, _univerjs_ui.useObservable)(themeService.currentTheme$, themeService.getCurrentTheme());
|
|
2702
|
+
const darkMode = (0, _univerjs_ui.useObservable)(themeService.darkMode$, themeService.darkMode);
|
|
2657
2703
|
return (0, react.useMemo)(() => {
|
|
2658
2704
|
return {
|
|
2659
|
-
formulaRefColors: [
|
|
2660
|
-
themeService.getColorFromTheme(
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
themeService.getColorFromTheme("loop-color.7"),
|
|
2667
|
-
themeService.getColorFromTheme("loop-color.8"),
|
|
2668
|
-
themeService.getColorFromTheme("loop-color.9"),
|
|
2669
|
-
themeService.getColorFromTheme("loop-color.10"),
|
|
2670
|
-
themeService.getColorFromTheme("loop-color.11"),
|
|
2671
|
-
themeService.getColorFromTheme("loop-color.12")
|
|
2672
|
-
].map((color) => themeService.isValidThemeColor(color) ? themeService.getColorFromTheme(color) : color),
|
|
2705
|
+
formulaRefColors: Object.values(theme["loop-color"]).map((color) => {
|
|
2706
|
+
const resolvedColor = themeService.isValidThemeColor(color) ? themeService.getColorFromTheme(color) : color;
|
|
2707
|
+
if (!darkMode) return resolvedColor;
|
|
2708
|
+
let referenceColor = new _univerjs_core.ColorKit(resolvedColor);
|
|
2709
|
+
while (referenceColor.toHsl().l > 0 && _univerjs_core.ColorKit.getContrastRatio(canvasColorService.getRenderColor(referenceColor.toHexString()), theme.gray[800]) < 4.5) referenceColor = referenceColor.darken(5);
|
|
2710
|
+
return referenceColor.toHexString();
|
|
2711
|
+
}),
|
|
2673
2712
|
numberColor: themeService.getColorFromTheme("blue.700"),
|
|
2674
2713
|
stringColor: themeService.getColorFromTheme("jiqing.800"),
|
|
2675
2714
|
plainTextColor: themeService.getColorFromTheme("gray.1000")
|
|
2676
2715
|
};
|
|
2677
|
-
}, [
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2716
|
+
}, [
|
|
2717
|
+
theme,
|
|
2718
|
+
darkMode,
|
|
2719
|
+
themeService,
|
|
2720
|
+
canvasColorService
|
|
2721
|
+
]);
|
|
2681
2722
|
}
|
|
2682
2723
|
|
|
2683
2724
|
//#endregion
|
|
@@ -3745,12 +3786,11 @@ function MobileFunctionPanel(props) {
|
|
|
3745
3786
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3746
3787
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3747
3788
|
className: "univer-px-4 univer-pb-3",
|
|
3748
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3789
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
3749
3790
|
value: query,
|
|
3750
3791
|
"aria-label": copy.search,
|
|
3751
3792
|
placeholder: copy.search,
|
|
3752
|
-
|
|
3753
|
-
onChange: (event) => setQuery(event.target.value)
|
|
3793
|
+
onChange: setQuery
|
|
3754
3794
|
})
|
|
3755
3795
|
}),
|
|
3756
3796
|
!query && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -5641,6 +5681,7 @@ let MobileComponentsController = class MobileComponentsController extends _unive
|
|
|
5641
5681
|
}
|
|
5642
5682
|
_registerIcons() {
|
|
5643
5683
|
this.disposeWithMe(this._iconManager.register({
|
|
5684
|
+
CalculationOptionsIcon: _univerjs_icons.CalculationOptionsIcon,
|
|
5644
5685
|
DatabaseFunctionIcon: _univerjs_icons.DatabaseFunctionIcon,
|
|
5645
5686
|
DateFunctionIcon: _univerjs_icons.DateFunctionIcon,
|
|
5646
5687
|
EngineeringFunctionIcon: _univerjs_icons.EngineeringFunctionIcon,
|
|
@@ -5741,6 +5782,7 @@ let FormulaUIController = class FormulaUIController extends _univerjs_core.Dispo
|
|
|
5741
5782
|
SheetOnlyPasteFormulaCommand,
|
|
5742
5783
|
InsertFunctionOperation,
|
|
5743
5784
|
MoreFunctionsOperation,
|
|
5785
|
+
CalculationOptionsOperation,
|
|
5744
5786
|
SearchFunctionOperation,
|
|
5745
5787
|
HelpFunctionOperation,
|
|
5746
5788
|
ReferenceAbsoluteOperation
|
|
@@ -6147,7 +6189,6 @@ let UniverSheetsFormulaMobileUIPlugin = class UniverSheetsFormulaMobileUIPlugin
|
|
|
6147
6189
|
[FormulaClipboardController],
|
|
6148
6190
|
[FormulaEditorShowController],
|
|
6149
6191
|
[FormulaRenderManagerController],
|
|
6150
|
-
[FormulaReorderController],
|
|
6151
6192
|
[ImageFormulaRenderController]
|
|
6152
6193
|
]);
|
|
6153
6194
|
this._initUIPart();
|
|
@@ -6169,9 +6210,6 @@ let UniverSheetsFormulaMobileUIPlugin = class UniverSheetsFormulaMobileUIPlugin
|
|
|
6169
6210
|
[ImageFormulaRenderController]
|
|
6170
6211
|
]);
|
|
6171
6212
|
}
|
|
6172
|
-
onSteady() {
|
|
6173
|
-
this._injector.get(FormulaReorderController);
|
|
6174
|
-
}
|
|
6175
6213
|
_initUIPart() {
|
|
6176
6214
|
this.disposeWithMe(this._uiPartsService.registerComponent(_univerjs_ui.BuiltInUIPart.GLOBAL, () => (0, _univerjs_ui.connectInjector)(MobileGlobalRangeSelector, this._injector)));
|
|
6177
6215
|
}
|
|
@@ -6188,6 +6226,125 @@ UniverSheetsFormulaMobileUIPlugin = __decorate([
|
|
|
6188
6226
|
__decorateParam(4, _univerjs_ui.IUIPartsService)
|
|
6189
6227
|
], UniverSheetsFormulaMobileUIPlugin);
|
|
6190
6228
|
|
|
6229
|
+
//#endregion
|
|
6230
|
+
//#region src/views/calculation-options/CalculationOptions.tsx
|
|
6231
|
+
function CalculationOptions({ unitId }) {
|
|
6232
|
+
var _permissionService$ge;
|
|
6233
|
+
const instanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
6234
|
+
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
6235
|
+
const permissionService = (0, _univerjs_ui.useDependency)(_univerjs_core.IPermissionService);
|
|
6236
|
+
const dialogService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IDialogService);
|
|
6237
|
+
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
6238
|
+
const workbook = instanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
6239
|
+
const permissionId = new _univerjs_sheets.WorkbookEditablePermission(unitId).id;
|
|
6240
|
+
const permission = (0, _univerjs_ui.useObservable)(permissionService.getPermissionPoint$(permissionId), void 0, false);
|
|
6241
|
+
const readOnly = !workbook || ((permission === null || permission === void 0 ? void 0 : permission.value) ?? ((_permissionService$ge = permissionService.getPermissionPoint(permissionId)) === null || _permissionService$ge === void 0 ? void 0 : _permissionService$ge.value)) === false;
|
|
6242
|
+
const [draft, setDraft] = (0, react.useState)(() => {
|
|
6243
|
+
const settings = (0, _univerjs_core.normalizeWorkbookCalculationSettings)(workbook === null || workbook === void 0 ? void 0 : workbook.getCalculationSettings());
|
|
6244
|
+
return {
|
|
6245
|
+
enabled: settings.iterativeCalculation,
|
|
6246
|
+
count: String(settings.maxIterations),
|
|
6247
|
+
change: String(settings.maxChange)
|
|
6248
|
+
};
|
|
6249
|
+
});
|
|
6250
|
+
const [submitted, setSubmitted] = (0, react.useState)(false);
|
|
6251
|
+
const settings = {
|
|
6252
|
+
iterativeCalculation: draft.enabled,
|
|
6253
|
+
maxIterations: draft.count.trim() ? Number(draft.count) : NaN,
|
|
6254
|
+
maxChange: draft.change.trim() ? Number(draft.change) : NaN
|
|
6255
|
+
};
|
|
6256
|
+
const validCount = Number.isInteger(settings.maxIterations) && settings.maxIterations >= 1 && settings.maxIterations <= _univerjs_core.MAX_ITERATION_COUNT;
|
|
6257
|
+
const validChange = Number.isFinite(settings.maxChange) && settings.maxChange > 0;
|
|
6258
|
+
const showCountError = submitted && draft.enabled && !validCount;
|
|
6259
|
+
const showChangeError = submitted && draft.enabled && !validChange;
|
|
6260
|
+
function close() {
|
|
6261
|
+
dialogService.close(CALCULATION_OPTIONS_DIALOG);
|
|
6262
|
+
}
|
|
6263
|
+
function submit() {
|
|
6264
|
+
if (readOnly) return;
|
|
6265
|
+
setSubmitted(true);
|
|
6266
|
+
if (draft.enabled && (!validCount || !validChange)) return;
|
|
6267
|
+
const nextSettings = draft.enabled ? settings : {
|
|
6268
|
+
...workbook.getCalculationSettings(),
|
|
6269
|
+
iterativeCalculation: false
|
|
6270
|
+
};
|
|
6271
|
+
if (commandService.syncExecuteCommand(_univerjs_sheets.SetWorkbookCalculationSettingsCommand.id, {
|
|
6272
|
+
unitId,
|
|
6273
|
+
settings: nextSettings
|
|
6274
|
+
})) close();
|
|
6275
|
+
}
|
|
6276
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6277
|
+
className: "univer-flex univer-flex-col univer-gap-4 univer-p-4",
|
|
6278
|
+
children: [
|
|
6279
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
6280
|
+
className: "univer-m-0 univer-text-sm",
|
|
6281
|
+
children: localeService.t("sheets-formula-ui.calculation.workbook")
|
|
6282
|
+
}),
|
|
6283
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
|
|
6284
|
+
checked: draft.enabled,
|
|
6285
|
+
disabled: readOnly,
|
|
6286
|
+
onChange: (enabled) => setDraft((previous) => ({
|
|
6287
|
+
...previous,
|
|
6288
|
+
enabled: Boolean(enabled)
|
|
6289
|
+
})),
|
|
6290
|
+
children: localeService.t("sheets-formula-ui.calculation.enable")
|
|
6291
|
+
}),
|
|
6292
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
6293
|
+
className: "univer-flex univer-flex-col univer-gap-2 univer-text-sm",
|
|
6294
|
+
children: [
|
|
6295
|
+
localeService.t("sheets-formula-ui.calculation.iterations", String(_univerjs_core.MAX_ITERATION_COUNT)),
|
|
6296
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
6297
|
+
value: draft.count,
|
|
6298
|
+
inputClass: showCountError ? "univer-border-red-500" : void 0,
|
|
6299
|
+
disabled: readOnly || !draft.enabled,
|
|
6300
|
+
onChange: (count) => setDraft((previous) => ({
|
|
6301
|
+
...previous,
|
|
6302
|
+
count
|
|
6303
|
+
}))
|
|
6304
|
+
}),
|
|
6305
|
+
showCountError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6306
|
+
role: "alert",
|
|
6307
|
+
className: "univer-text-red-500",
|
|
6308
|
+
children: localeService.t("sheets-formula-ui.calculation.invalidIterations", String(_univerjs_core.MAX_ITERATION_COUNT))
|
|
6309
|
+
})
|
|
6310
|
+
]
|
|
6311
|
+
}),
|
|
6312
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
6313
|
+
className: "univer-flex univer-flex-col univer-gap-2 univer-text-sm",
|
|
6314
|
+
children: [
|
|
6315
|
+
localeService.t("sheets-formula-ui.calculation.change"),
|
|
6316
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
6317
|
+
value: draft.change,
|
|
6318
|
+
inputClass: showChangeError ? "univer-border-red-500" : void 0,
|
|
6319
|
+
disabled: readOnly || !draft.enabled,
|
|
6320
|
+
onChange: (change) => setDraft((previous) => ({
|
|
6321
|
+
...previous,
|
|
6322
|
+
change
|
|
6323
|
+
}))
|
|
6324
|
+
}),
|
|
6325
|
+
showChangeError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6326
|
+
role: "alert",
|
|
6327
|
+
className: "univer-text-red-500",
|
|
6328
|
+
children: localeService.t("sheets-formula-ui.calculation.invalidChange")
|
|
6329
|
+
})
|
|
6330
|
+
]
|
|
6331
|
+
}),
|
|
6332
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6333
|
+
className: "univer-flex univer-justify-end univer-gap-2",
|
|
6334
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
6335
|
+
onClick: close,
|
|
6336
|
+
children: localeService.t("sheets-formula-ui.calculation.cancel")
|
|
6337
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
6338
|
+
variant: "primary",
|
|
6339
|
+
disabled: readOnly,
|
|
6340
|
+
onClick: submit,
|
|
6341
|
+
children: localeService.t("sheets-formula-ui.calculation.confirm")
|
|
6342
|
+
})]
|
|
6343
|
+
})
|
|
6344
|
+
]
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
|
|
6191
6348
|
//#endregion
|
|
6192
6349
|
//#region src/views/formula-editor/hooks/use-formula-describe.ts
|
|
6193
6350
|
const useFormulaDescribe = (isNeed, formulaText, editor) => {
|
|
@@ -6427,10 +6584,6 @@ function SearchFunctionFactory(props, ref) {
|
|
|
6427
6584
|
if (!isEnableMouseEnterOrOut.current) return;
|
|
6428
6585
|
setActive(index);
|
|
6429
6586
|
}
|
|
6430
|
-
function handleLiMouseLeave() {
|
|
6431
|
-
if (!isEnableMouseEnterOrOut.current) return;
|
|
6432
|
-
setActive(-1);
|
|
6433
|
-
}
|
|
6434
6587
|
(0, react.useEffect)(() => {
|
|
6435
6588
|
if (!searchList.length) return;
|
|
6436
6589
|
const operationId = `sheet.formula-embedding-editor.search_function.${editorId}`;
|
|
@@ -6455,7 +6608,7 @@ function SearchFunctionFactory(props, ref) {
|
|
|
6455
6608
|
case _univerjs_ui.KeyCode.TAB:
|
|
6456
6609
|
case _univerjs_ui.KeyCode.ENTER: {
|
|
6457
6610
|
const item = searchList[active];
|
|
6458
|
-
handleFunctionSelect(item.name, item.functionType);
|
|
6611
|
+
if (item) handleFunctionSelect(item.name, item.functionType);
|
|
6459
6612
|
break;
|
|
6460
6613
|
}
|
|
6461
6614
|
case _univerjs_ui.KeyCode.ESC:
|
|
@@ -6537,7 +6690,6 @@ function SearchFunctionFactory(props, ref) {
|
|
|
6537
6690
|
children: searchList.map((item, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
6538
6691
|
className: (0, _univerjs_design.clsx)("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-1 univer-text-gray-900 univer-transition-colors dark:!univer-text-gray-0", { "univer-bg-gray-200 dark:!univer-bg-gray-600": active === index }),
|
|
6539
6692
|
onMouseEnter: () => handleLiMouseEnter(index),
|
|
6540
|
-
onMouseLeave: handleLiMouseLeave,
|
|
6541
6693
|
onMouseMove: debounceResetMouseState,
|
|
6542
6694
|
onClick: () => {
|
|
6543
6695
|
handleFunctionSelect(item.name, item.functionType);
|
|
@@ -6943,6 +7095,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
6943
7095
|
}
|
|
6944
7096
|
_registerIcons() {
|
|
6945
7097
|
this.disposeWithMe(this._iconManager.register({
|
|
7098
|
+
CalculationOptionsIcon: _univerjs_icons.CalculationOptionsIcon,
|
|
6946
7099
|
DatabaseFunctionIcon: _univerjs_icons.DatabaseFunctionIcon,
|
|
6947
7100
|
DateFunctionIcon: _univerjs_icons.DateFunctionIcon,
|
|
6948
7101
|
EngineeringFunctionIcon: _univerjs_icons.EngineeringFunctionIcon,
|
|
@@ -6960,6 +7113,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
|
|
|
6960
7113
|
this.disposeWithMe(this._componentManager.register(MORE_FUNCTIONS_COMPONENT, MoreFunctions));
|
|
6961
7114
|
this.disposeWithMe(this._componentManager.register(_univerjs_sheets_ui.RANGE_SELECTOR_COMPONENT_KEY, RangeSelector));
|
|
6962
7115
|
this.disposeWithMe(this._componentManager.register(_univerjs_sheets_ui.EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY, FormulaEditor));
|
|
7116
|
+
this.disposeWithMe(this._componentManager.register(CALCULATION_OPTIONS_COMPONENT, CalculationOptions));
|
|
6963
7117
|
}
|
|
6964
7118
|
};
|
|
6965
7119
|
ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], ComponentsController);
|
|
@@ -7043,7 +7197,6 @@ let UniverSheetsFormulaUIPlugin = class UniverSheetsFormulaUIPlugin extends _uni
|
|
|
7043
7197
|
[FormulaClipboardController],
|
|
7044
7198
|
[FormulaEditorShowController],
|
|
7045
7199
|
[FormulaRenderManagerController],
|
|
7046
|
-
[FormulaReorderController],
|
|
7047
7200
|
[ImageFormulaRenderController]
|
|
7048
7201
|
]);
|
|
7049
7202
|
this._initUIPart();
|
|
@@ -7065,9 +7218,6 @@ let UniverSheetsFormulaUIPlugin = class UniverSheetsFormulaUIPlugin extends _uni
|
|
|
7065
7218
|
[ImageFormulaRenderController]
|
|
7066
7219
|
]);
|
|
7067
7220
|
}
|
|
7068
|
-
onSteady() {
|
|
7069
|
-
this._injector.get(FormulaReorderController);
|
|
7070
|
-
}
|
|
7071
7221
|
_initUIPart() {
|
|
7072
7222
|
this.disposeWithMe(this._uiPartsService.registerComponent(_univerjs_ui.BuiltInUIPart.GLOBAL, () => (0, _univerjs_ui.connectInjector)(GlobalRangeSelector, this._injector)));
|
|
7073
7223
|
}
|
|
@@ -7087,12 +7237,6 @@ UniverSheetsFormulaUIPlugin = __decorate([
|
|
|
7087
7237
|
//#endregion
|
|
7088
7238
|
exports.FORMULA_PROMPT_ACTIVATED = FORMULA_PROMPT_ACTIVATED;
|
|
7089
7239
|
exports.FormulaEditor = FormulaEditor;
|
|
7090
|
-
Object.defineProperty(exports, 'FormulaReorderController', {
|
|
7091
|
-
enumerable: true,
|
|
7092
|
-
get: function () {
|
|
7093
|
-
return FormulaReorderController;
|
|
7094
|
-
}
|
|
7095
|
-
});
|
|
7096
7240
|
exports.GlobalRangeSelectorService = GlobalRangeSelectorService;
|
|
7097
7241
|
exports.HelpFunctionOperation = HelpFunctionOperation;
|
|
7098
7242
|
exports.InsertFunctionOperation = InsertFunctionOperation;
|
|
@@ -7100,7 +7244,7 @@ exports.MORE_FUNCTIONS_COMPONENT = MORE_FUNCTIONS_COMPONENT;
|
|
|
7100
7244
|
exports.MobileRangeSelector = MobileRangeSelector;
|
|
7101
7245
|
exports.MoreFunctionsOperation = MoreFunctionsOperation;
|
|
7102
7246
|
exports.RangeSelector = RangeSelector;
|
|
7103
|
-
Object.defineProperty(exports,
|
|
7247
|
+
Object.defineProperty(exports, "RefSelectionsRenderService", {
|
|
7104
7248
|
enumerable: true,
|
|
7105
7249
|
get: function () {
|
|
7106
7250
|
return RefSelectionsRenderService;
|
|
@@ -7111,13 +7255,13 @@ exports.SearchFunctionOperation = SearchFunctionOperation;
|
|
|
7111
7255
|
exports.SheetCopyFormulaOnlyCommand = SheetCopyFormulaOnlyCommand;
|
|
7112
7256
|
exports.SheetOnlyPasteFormulaCommand = SheetOnlyPasteFormulaCommand;
|
|
7113
7257
|
exports.SheetsFormulaUIMenuSchema = menuSchema;
|
|
7114
|
-
Object.defineProperty(exports,
|
|
7258
|
+
Object.defineProperty(exports, "UniverSheetsFormulaMobileUIPlugin", {
|
|
7115
7259
|
enumerable: true,
|
|
7116
7260
|
get: function () {
|
|
7117
7261
|
return UniverSheetsFormulaMobileUIPlugin;
|
|
7118
7262
|
}
|
|
7119
7263
|
});
|
|
7120
|
-
Object.defineProperty(exports,
|
|
7264
|
+
Object.defineProperty(exports, "UniverSheetsFormulaUIPlugin", {
|
|
7121
7265
|
enumerable: true,
|
|
7122
7266
|
get: function () {
|
|
7123
7267
|
return UniverSheetsFormulaUIPlugin;
|