@univerjs/sheets-formula 0.2.6 → 0.2.7
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 +4 -4
- package/lib/es/index.js +324 -377
- package/lib/locale/en-US.json +82 -88
- package/lib/locale/ru-RU.json +79 -85
- package/lib/locale/vi-VN.json +1988 -1483
- package/lib/locale/zh-CN.json +122 -128
- package/lib/locale/zh-TW.json +206 -244
- package/lib/types/controllers/prompt.controller.d.ts +3 -5
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/en-US.d.ts +32 -38
- package/lib/types/locale/function-list/date/vi-VN.d.ts +105 -26
- package/lib/types/locale/function-list/date/zh-TW.d.ts +32 -8
- package/lib/types/locale/function-list/information/ja-JP.d.ts +8 -40
- package/lib/types/locale/function-list/information/vi-VN.d.ts +218 -3
- package/lib/types/locale/function-list/logical/en-US.d.ts +31 -33
- package/lib/types/locale/function-list/logical/ja-JP.d.ts +31 -33
- package/lib/types/locale/function-list/logical/vi-VN.d.ts +31 -33
- package/lib/types/locale/function-list/logical/zh-CN.d.ts +31 -33
- package/lib/types/locale/function-list/logical/zh-TW.d.ts +31 -33
- package/lib/types/locale/function-list/lookup/en-US.d.ts +1 -5
- package/lib/types/locale/function-list/lookup/ja-JP.d.ts +1 -5
- package/lib/types/locale/function-list/lookup/vi-VN.d.ts +421 -9
- package/lib/types/locale/function-list/lookup/zh-CN.d.ts +1 -5
- package/lib/types/locale/function-list/lookup/zh-TW.d.ts +1 -5
- package/lib/types/locale/function-list/math/vi-VN.d.ts +1022 -3
- package/lib/types/locale/function-list/math/zh-TW.d.ts +21 -77
- package/lib/types/locale/function-list/statistical/vi-VN.d.ts +334 -0
- package/lib/types/locale/function-list/text/vi-VN.d.ts +135 -1
- package/lib/types/locale/ru-RU.d.ts +32 -38
- package/lib/types/locale/vi-VN.d.ts +917 -446
- package/lib/types/locale/zh-CN.d.ts +32 -38
- package/lib/types/locale/zh-TW.d.ts +85 -123
- package/lib/types/services/prompt.service.d.ts +5 -1
- package/lib/umd/index.js +4 -4
- package/package.json +23 -23
package/lib/es/index.js
CHANGED
|
@@ -2,23 +2,23 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { Disposable, ObjectMatrix, Dimension, OnLifecycle, LifecycleStages, Inject, IUniverInstanceService, CellValueType, ThemeService, ICommandService, isFormulaString, isFormulaId, Tools, Direction, UniverInstanceType, Injector, DEFAULT_EMPTY_DOCUMENT_VALUE, toDisposable, ColorKit, Rectangle, CommandType, createIdentifier, isRealNum, getCellValueType, useDependency, LocaleService, useInjector, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, connectInjector, throttle, cellToRange, RANGE_TYPE, DisposableCollection, Optional, isICellData, RxDisposable, FOCUSING_EDITOR_INPUT_FORMULA, getCellInfoInMergeData, AbsoluteRefType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
|
|
5
|
+
import { Disposable, ObjectMatrix, Dimension, OnLifecycle, LifecycleStages, Inject, IUniverInstanceService, CellValueType, ThemeService, ICommandService, isFormulaString, isFormulaId, Tools, Direction, UniverInstanceType, Injector, DEFAULT_EMPTY_DOCUMENT_VALUE, toDisposable, ColorKit, Rectangle, CommandType, createIdentifier, IContextService, isRealNum, getCellValueType, useDependency, LocaleService, useInjector, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, connectInjector, throttle, cellToRange, RANGE_TYPE, DisposableCollection, Optional, isICellData, RxDisposable, FORMULA_EDITOR_ACTIVATED, FOCUSING_EDITOR_INPUT_FORMULA, getCellInfoInMergeData, AbsoluteRefType, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, Plugin, DependentOn } from "@univerjs/core";
|
|
6
6
|
import { IRPCChannelService, fromModule, toModule } from "@univerjs/rpc";
|
|
7
7
|
import { SetDefinedNameMutation, RemoveDefinedNameMutation, FormulaDataModel, IActiveDirtyManagerService, IDefinedNamesService, SetArrayFormulaDataMutation, stripErrorMargin, LexerTreeBuilder, SetFormulaCalculationResultMutation, ErrorType, sequenceNodeType, serializeRange, FUNCTION_NAMES_COMPATIBILITY, FunctionType, FUNCTION_NAMES_CUBE, FUNCTION_NAMES_DATABASE, FUNCTION_NAMES_DATE, FUNCTION_NAMES_ENGINEERING, FUNCTION_NAMES_FINANCIAL, FUNCTION_NAMES_INFORMATION, FUNCTION_NAMES_LOGICAL, FUNCTION_NAMES_LOOKUP, FUNCTION_NAMES_MATH, FUNCTION_NAMES_STATISTICAL, FUNCTION_NAMES_TEXT, FUNCTION_NAMES_WEB, isReferenceStrings, functionArray, functionCompatibility, functionCube, functionDatabase, functionDate, functionEngineering, functionFinancial, functionInformation, functionLogical, functionLookup, functionMath, functionMeta, functionStatistical, functionText, functionUniver, functionWeb, IFunctionService, ERROR_TYPE_SET, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, SetFormulaCalculationNotificationMutation, FormulaExecuteStageType, FormulaExecutedStateType, SetFormulaDataMutation, initSheetFormulaData, deserializeRangeWithSheet, serializeRangeToRefString, generateStringWithSequence, CustomFunction, serializeRangeWithSpreadsheet, serializeRangeWithSheet, SetOtherFormulaMutation, RemoveOtherFormulaMutation, matchRefDrawToken, matchToken, compareToken, normalizeSheetName, getAbsoluteRefTypeWitString, UniverFormulaEnginePlugin } from "@univerjs/engine-formula";
|
|
8
8
|
import { IRenderManagerService, ITextSelectionRenderManager, DeviceInputEventType, ScrollTimerType, SHEET_VIEWPORT_KEY, Vector2 } from "@univerjs/engine-render";
|
|
9
9
|
import { SetRangeValuesMutation, SetStyleCommand, MoveRangeMutation, MoveRowsMutation, MoveColsMutation, ReorderRangeMutation, RemoveRowMutation, RemoveColMutation, RemoveSheetMutation, InsertSheetMutation, SetDefinedNameCommand, INTERCEPTOR_POINT, SheetInterceptorService, SetRangeValuesUndoMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetColWidthMutation, SetColHiddenMutation, SetColVisibleMutation, SetRowHiddenMutation, SetRowVisibleMutation, SetWorksheetRowAutoHeightMutation, SetRangeValuesCommand, SheetsSelectionsService, getSheetCommandTarget, getCellAtRowCol, SetSelectionsOperation, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, RangeProtectionPermissionEditPoint, SetBorderCommand, ClearSelectionFormatCommand, INumfmtService, handleMoveRange, EffectRefRangId, runRefRangeMutations, handleMoveRows, handleMoveCols, handleInsertRow, handleInsertCol, handleIRemoveRow, handleIRemoveCol, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertRangeMoveDown, handleInsertRangeMoveRight, RemoveSheetCommand, SetWorksheetNameCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, RemoveColCommand, RemoveRowCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertColCommand, InsertRowCommand, MoveColsCommand, MoveRowsCommand, MoveRangeCommand, SetWorksheetActiveOperation, InsertDefinedNameCommand, RemoveDefinedNameCommand, RefRangeService, handleDefaultRangeChangeWithEffectRefCommands, convertSelectionDataToRange, getNormalSelectionStyle, IRefSelectionsService, DISABLE_NORMAL_SELECTIONS, setEndForRange, getPrimaryForRange, RefSelectionsService } from "@univerjs/sheets";
|
|
10
10
|
import { DATA_TYPE, APPLY_TYPE, IAutoFillService, PREDEFINED_HOOK_NAME, COPY_TYPE, ISheetClipboardService, ISheetSelectionRenderService, SelectionShape, IEditorBridgeService, SheetSkeletonManagerService, SheetPasteCommand, useActiveWorkbook, getCurrentRangeDisable$, PASTE_SPECIAL_MENU_ID, whenFormulaEditorActivated, CellAlertType, HoverManagerService, CellAlertManagerService, BaseSelectionRenderService, getCoordByOffset, checkInHeaderRanges, getAllSelection, attachSelectionWithCoord, getSheetObject, getEditorObject, MoveSelectionCommand, JumpOver, ExpandSelectionCommand } from "@univerjs/sheets-ui";
|
|
11
11
|
import { IEditorService, ISidebarService, MenuGroup, MenuItemType, MenuPosition, getMenuHiddenObservable, IClipboardInterfaceService, KeyCode, MetaKeys, ComponentManager, BuiltInUIPart, IMenuService, IShortcutService, IUIPartsService, IProgressService, UNI_DISABLE_CHANGING_FOCUS_KEY, SetEditorResizeOperation, IContextMenuService } from "@univerjs/ui";
|
|
12
|
-
import { Subject, throttleTime, combineLatestWith, map, switchMap, of, Observable, merge, filter, bufferTime } from "rxjs";
|
|
12
|
+
import { Subject, throttleTime, combineLatestWith, map, switchMap, of, Observable, merge, filter, bufferTime, distinctUntilKeyChanged, distinctUntilChanged } from "rxjs";
|
|
13
13
|
import require$$0, { forwardRef, useRef, createElement, useEffect, useState } from "react";
|
|
14
14
|
import { Popup, Select, Input, Button } from "@univerjs/design";
|
|
15
15
|
import { ReplaceContentCommand, DocSkeletonManagerService, MoveCursorOperation, TextSelectionManagerService } from "@univerjs/docs";
|
|
16
16
|
const FORMULA_UI_PLUGIN_NAME = "formula-ui";
|
|
17
|
-
var __defProp$
|
|
18
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
17
|
+
var __defProp$j = Object.defineProperty, __getOwnPropDesc$j = Object.getOwnPropertyDescriptor, __decorateClass$j = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
18
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
19
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
20
|
-
return kind && result && __defProp$
|
|
21
|
-
}, "__decorateClass$
|
|
20
|
+
return kind && result && __defProp$j(target, key, result), result;
|
|
21
|
+
}, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), _a;
|
|
22
22
|
let ActiveDirtyController = (_a = class extends Disposable {
|
|
23
23
|
constructor(_activeDirtyManagerService, _univerInstanceService, _formulaDataModel, _definedNamesService) {
|
|
24
24
|
super(), this._activeDirtyManagerService = _activeDirtyManagerService, this._univerInstanceService = _univerInstanceService, this._formulaDataModel = _formulaDataModel, this._definedNamesService = _definedNamesService, this._initialize();
|
|
@@ -209,12 +209,12 @@ let ActiveDirtyController = (_a = class extends Disposable {
|
|
|
209
209
|
* All other positions, apart from the top-left corner, need to be marked as dirty.
|
|
210
210
|
*/
|
|
211
211
|
_getDirtyRangesForArrayFormula(unitId, sheetId, cellValue) {
|
|
212
|
-
var
|
|
212
|
+
var _a23, _b;
|
|
213
213
|
const dirtyRanges = [];
|
|
214
214
|
if (cellValue == null)
|
|
215
215
|
return dirtyRanges;
|
|
216
216
|
const cellMatrix = new ObjectMatrix(cellValue), arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
|
|
217
|
-
if ((
|
|
217
|
+
if ((_a23 = arrayFormulaRange == null ? void 0 : arrayFormulaRange[unitId]) != null && _a23[sheetId]) {
|
|
218
218
|
const cellRangeData = new ObjectMatrix((_b = arrayFormulaRange == null ? void 0 : arrayFormulaRange[unitId]) == null ? void 0 : _b[sheetId]);
|
|
219
219
|
cellMatrix.forValue((row, column) => {
|
|
220
220
|
cellRangeData.forValue((arrayFormulaRow, arrayFormulaColumn, arrayFormulaRange2) => {
|
|
@@ -237,18 +237,18 @@ let ActiveDirtyController = (_a = class extends Disposable {
|
|
|
237
237
|
return dirtyRanges;
|
|
238
238
|
}
|
|
239
239
|
}, __name(_a, "ActiveDirtyController"), _a);
|
|
240
|
-
ActiveDirtyController = __decorateClass$
|
|
240
|
+
ActiveDirtyController = __decorateClass$j([
|
|
241
241
|
OnLifecycle(LifecycleStages.Ready, ActiveDirtyController),
|
|
242
|
-
__decorateParam$
|
|
243
|
-
__decorateParam$
|
|
244
|
-
__decorateParam$
|
|
245
|
-
__decorateParam$
|
|
242
|
+
__decorateParam$j(0, IActiveDirtyManagerService),
|
|
243
|
+
__decorateParam$j(1, IUniverInstanceService),
|
|
244
|
+
__decorateParam$j(2, Inject(FormulaDataModel)),
|
|
245
|
+
__decorateParam$j(3, IDefinedNamesService)
|
|
246
246
|
], ActiveDirtyController);
|
|
247
|
-
var __defProp$
|
|
248
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
247
|
+
var __defProp$i = Object.defineProperty, __getOwnPropDesc$i = Object.getOwnPropertyDescriptor, __decorateClass$i = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
248
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
249
249
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
250
|
-
return kind && result && __defProp$
|
|
251
|
-
}, "__decorateClass$
|
|
250
|
+
return kind && result && __defProp$i(target, key, result), result;
|
|
251
|
+
}, "__decorateClass$i"), __decorateParam$i = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$i"), _a2;
|
|
252
252
|
let ArrayFormulaDisplayController = (_a2 = class extends Disposable {
|
|
253
253
|
constructor(_commandService, _sheetInterceptorService, _formulaDataModel, _themeService) {
|
|
254
254
|
super(), this._commandService = _commandService, this._sheetInterceptorService = _sheetInterceptorService, this._formulaDataModel = _formulaDataModel, this._themeService = _themeService, this._initialize();
|
|
@@ -274,36 +274,38 @@ let ArrayFormulaDisplayController = (_a2 = class extends Disposable {
|
|
|
274
274
|
this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
|
|
275
275
|
priority: 100,
|
|
276
276
|
handler: /* @__PURE__ */ __name((cell, location, next) => {
|
|
277
|
-
var
|
|
278
|
-
const { unitId, subUnitId, row, col } = location, arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData(), cellData = (_c = (_b = (
|
|
277
|
+
var _a23, _b, _c;
|
|
278
|
+
const { unitId, subUnitId, row, col } = location, arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData(), cellData = (_c = (_b = (_a23 = arrayFormulaCellData == null ? void 0 : arrayFormulaCellData[unitId]) == null ? void 0 : _a23[subUnitId]) == null ? void 0 : _b[row]) == null ? void 0 : _c[col];
|
|
279
279
|
return cellData == null ? next(cell) : cellData.v == null && cellData.t == null ? next({
|
|
280
280
|
...cell,
|
|
281
|
-
...cellData,
|
|
282
281
|
v: 0,
|
|
283
282
|
// Default value for empty cell
|
|
284
283
|
t: CellValueType.NUMBER
|
|
285
284
|
}) : (cell == null ? void 0 : cell.t) === CellValueType.NUMBER && typeof (cell == null ? void 0 : cell.v) == "number" ? next({
|
|
286
285
|
...cell,
|
|
287
|
-
...cellData,
|
|
288
286
|
v: stripErrorMargin(cell.v)
|
|
289
|
-
}) : next({
|
|
287
|
+
}) : next({
|
|
288
|
+
...cell,
|
|
289
|
+
v: cellData.v,
|
|
290
|
+
t: cellData.t
|
|
291
|
+
});
|
|
290
292
|
}, "handler")
|
|
291
293
|
})
|
|
292
294
|
);
|
|
293
295
|
}
|
|
294
296
|
}, __name(_a2, "ArrayFormulaDisplayController"), _a2);
|
|
295
|
-
ArrayFormulaDisplayController = __decorateClass$
|
|
297
|
+
ArrayFormulaDisplayController = __decorateClass$i([
|
|
296
298
|
OnLifecycle(LifecycleStages.Ready, ArrayFormulaDisplayController),
|
|
297
|
-
__decorateParam$
|
|
298
|
-
__decorateParam$
|
|
299
|
-
__decorateParam$
|
|
300
|
-
__decorateParam$
|
|
299
|
+
__decorateParam$i(0, ICommandService),
|
|
300
|
+
__decorateParam$i(1, Inject(SheetInterceptorService)),
|
|
301
|
+
__decorateParam$i(2, Inject(FormulaDataModel)),
|
|
302
|
+
__decorateParam$i(3, Inject(ThemeService))
|
|
301
303
|
], ArrayFormulaDisplayController);
|
|
302
|
-
var __defProp$
|
|
303
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
304
|
+
var __defProp$h = Object.defineProperty, __getOwnPropDesc$h = Object.getOwnPropertyDescriptor, __decorateClass$h = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
305
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
304
306
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
305
|
-
return kind && result && __defProp$
|
|
306
|
-
}, "__decorateClass$
|
|
307
|
+
return kind && result && __defProp$h(target, key, result), result;
|
|
308
|
+
}, "__decorateClass$h"), __decorateParam$h = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$h"), _a3;
|
|
307
309
|
let FormulaAutoFillController = (_a3 = class extends Disposable {
|
|
308
310
|
constructor(_autoFillService, _lexerTreeBuilder) {
|
|
309
311
|
super(), this._autoFillService = _autoFillService, this._lexerTreeBuilder = _lexerTreeBuilder, this._initialize();
|
|
@@ -327,12 +329,12 @@ let FormulaAutoFillController = (_a3 = class extends Disposable {
|
|
|
327
329
|
this._autoFillService.registerRule(formulaRule);
|
|
328
330
|
}
|
|
329
331
|
_fillCopyFormula(data, len, direction, index, copyDataPiece) {
|
|
330
|
-
var
|
|
332
|
+
var _a23, _b;
|
|
331
333
|
const step = getDataLength(copyDataPiece), applyData = [], formulaIdMap = /* @__PURE__ */ new Map();
|
|
332
334
|
for (let i = 1; i <= len; i++) {
|
|
333
335
|
const index2 = (i - 1) % data.length, d = Tools.deepClone(data[index2]);
|
|
334
336
|
if (d) {
|
|
335
|
-
const originalFormula = ((
|
|
337
|
+
const originalFormula = ((_a23 = data[index2]) == null ? void 0 : _a23.f) || "", originalFormulaId = ((_b = data[index2]) == null ? void 0 : _b.si) || "", checkFormula = isFormulaString(originalFormula);
|
|
336
338
|
if (isFormulaId(originalFormulaId))
|
|
337
339
|
d.si = originalFormulaId, d.f = null, d.v = null, d.p = null, d.t = null, direction === Direction.DOWN || direction === Direction.RIGHT ? applyData.push(d) : applyData.unshift(d);
|
|
338
340
|
else if (checkFormula) {
|
|
@@ -355,10 +357,10 @@ let FormulaAutoFillController = (_a3 = class extends Disposable {
|
|
|
355
357
|
return applyData;
|
|
356
358
|
}
|
|
357
359
|
}, __name(_a3, "FormulaAutoFillController"), _a3);
|
|
358
|
-
FormulaAutoFillController = __decorateClass$
|
|
360
|
+
FormulaAutoFillController = __decorateClass$h([
|
|
359
361
|
OnLifecycle(LifecycleStages.Ready, FormulaAutoFillController),
|
|
360
|
-
__decorateParam$
|
|
361
|
-
__decorateParam$
|
|
362
|
+
__decorateParam$h(0, IAutoFillService),
|
|
363
|
+
__decorateParam$h(1, Inject(LexerTreeBuilder))
|
|
362
364
|
], FormulaAutoFillController);
|
|
363
365
|
function directionToOffset(step, direction) {
|
|
364
366
|
let offsetX = 0, offsetY = 0;
|
|
@@ -388,11 +390,11 @@ function getDataLength(copyDataPiece) {
|
|
|
388
390
|
return length;
|
|
389
391
|
}
|
|
390
392
|
__name(getDataLength, "getDataLength");
|
|
391
|
-
var __defProp$
|
|
392
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
393
|
+
var __defProp$g = Object.defineProperty, __getOwnPropDesc$g = Object.getOwnPropertyDescriptor, __decorateClass$g = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
394
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
393
395
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
394
|
-
return kind && result && __defProp$
|
|
395
|
-
}, "__decorateClass$
|
|
396
|
+
return kind && result && __defProp$g(target, key, result), result;
|
|
397
|
+
}, "__decorateClass$g"), __decorateParam$g = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$g");
|
|
396
398
|
const DEFAULT_PASTE_FORMULA = "default-paste-formula";
|
|
397
399
|
var _a4;
|
|
398
400
|
let FormulaClipboardController = (_a4 = class extends Disposable {
|
|
@@ -421,7 +423,7 @@ let FormulaClipboardController = (_a4 = class extends Disposable {
|
|
|
421
423
|
};
|
|
422
424
|
}
|
|
423
425
|
_onPasteCells(pasteFrom, pasteTo, data, payload, isSpecialPaste) {
|
|
424
|
-
var
|
|
426
|
+
var _a23;
|
|
425
427
|
const pasteType = payload.pasteType;
|
|
426
428
|
if (pasteType === PREDEFINED_HOOK_NAME.SPECIAL_PASTE_VALUE || pasteType === PREDEFINED_HOOK_NAME.SPECIAL_PASTE_FORMAT || pasteType === PREDEFINED_HOOK_NAME.SPECIAL_PASTE_COL_WIDTH)
|
|
427
429
|
return {
|
|
@@ -432,7 +434,7 @@ let FormulaClipboardController = (_a4 = class extends Disposable {
|
|
|
432
434
|
copyType: payload.copyType || COPY_TYPE.COPY,
|
|
433
435
|
copyRange: pasteFrom == null ? void 0 : pasteFrom.range,
|
|
434
436
|
pasteType: payload.pasteType
|
|
435
|
-
}, pastedRange = pasteTo.range, matrix = data, workbook = this._currentUniverSheet.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = pasteTo.unitId || workbook.getUnitId(), subUnitId = pasteTo.subUnitId || ((
|
|
437
|
+
}, pastedRange = pasteTo.range, matrix = data, workbook = this._currentUniverSheet.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = pasteTo.unitId || workbook.getUnitId(), subUnitId = pasteTo.subUnitId || ((_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId());
|
|
436
438
|
return !unitId || !subUnitId ? {
|
|
437
439
|
undos: [],
|
|
438
440
|
redos: []
|
|
@@ -450,13 +452,13 @@ let FormulaClipboardController = (_a4 = class extends Disposable {
|
|
|
450
452
|
));
|
|
451
453
|
}
|
|
452
454
|
}, __name(_a4, "FormulaClipboardController"), _a4);
|
|
453
|
-
FormulaClipboardController = __decorateClass$
|
|
455
|
+
FormulaClipboardController = __decorateClass$g([
|
|
454
456
|
OnLifecycle(LifecycleStages.Ready, FormulaClipboardController),
|
|
455
|
-
__decorateParam$
|
|
456
|
-
__decorateParam$
|
|
457
|
-
__decorateParam$
|
|
458
|
-
__decorateParam$
|
|
459
|
-
__decorateParam$
|
|
457
|
+
__decorateParam$g(0, IUniverInstanceService),
|
|
458
|
+
__decorateParam$g(1, Inject(LexerTreeBuilder)),
|
|
459
|
+
__decorateParam$g(2, ISheetClipboardService),
|
|
460
|
+
__decorateParam$g(3, Inject(Injector)),
|
|
461
|
+
__decorateParam$g(4, Inject(FormulaDataModel))
|
|
460
462
|
], FormulaClipboardController);
|
|
461
463
|
function getSetCellFormulaMutations(unitId, subUnitId, range, matrix, accessor, copyInfo, lexerTreeBuilder, formulaDataModel, isSpecialPaste = !1, pasteFrom) {
|
|
462
464
|
const redoMutationsInfo = [], undoMutationsInfo = [], valueMatrix = new ObjectMatrix(), formulaIdMap = /* @__PURE__ */ new Map();
|
|
@@ -466,14 +468,14 @@ function getSetCellFormulaMutations(unitId, subUnitId, range, matrix, accessor,
|
|
|
466
468
|
copyType === COPY_TYPE.COPY && copyRange && (copyRowLength = copyRange.rows.length, copyColumnLength = copyRange.cols.length);
|
|
467
469
|
}
|
|
468
470
|
matrix.forValue((row, col, value) => {
|
|
469
|
-
var
|
|
471
|
+
var _a23, _b, _c, _d;
|
|
470
472
|
const originalFormula = value.f || "", originalFormulaId = value.si || "";
|
|
471
473
|
let valueObject = {};
|
|
472
474
|
if (isSpecialPaste && (valueObject = Tools.deepClone(value), valueObject.s = null), !(!copyRowLength || !copyColumnLength)) {
|
|
473
475
|
if (isFormulaId(originalFormulaId)) {
|
|
474
476
|
const { unitId: pasteFromUnitId = "", subUnitId: pasteFromSubUnitId = "", range: pasteFromRange } = pasteFrom || {};
|
|
475
477
|
if ((pasteFromUnitId && unitId !== pasteFromUnitId || pasteFromSubUnitId && subUnitId !== pasteFromSubUnitId) && (pasteFromRange != null && pasteFromRange.rows) && (pasteFromRange != null && pasteFromRange.cols)) {
|
|
476
|
-
const formulaString = formulaDataModel.getFormulaStringByCell(pasteFromRange.rows[row], pasteFromRange.cols[col], pasteFromSubUnitId, pasteFromUnitId), rowIndex = row % copyRowLength, colIndex = col % copyColumnLength, copyX = copyInfo != null && copyInfo.copyRange ? (
|
|
478
|
+
const formulaString = formulaDataModel.getFormulaStringByCell(pasteFromRange.rows[row], pasteFromRange.cols[col], pasteFromSubUnitId, pasteFromUnitId), rowIndex = row % copyRowLength, colIndex = col % copyColumnLength, copyX = copyInfo != null && copyInfo.copyRange ? (_a23 = copyInfo == null ? void 0 : copyInfo.copyRange) == null ? void 0 : _a23.cols[colIndex] : colIndex, copyY = copyInfo != null && copyInfo.copyRange ? (_b = copyInfo == null ? void 0 : copyInfo.copyRange) == null ? void 0 : _b.rows[rowIndex] : rowIndex, offsetX = range.cols[col] - copyX, offsetY = range.rows[row] - copyY, shiftedFormula = lexerTreeBuilder.moveFormulaRefOffset(formulaString || "", offsetX, offsetY);
|
|
477
479
|
valueObject.si = null, valueObject.f = shiftedFormula, valueObject.v = null, valueObject.p = null;
|
|
478
480
|
} else
|
|
479
481
|
valueObject.si = originalFormulaId, valueObject.f = null, valueObject.v = null, valueObject.p = null;
|
|
@@ -527,11 +529,11 @@ function getCellRichText(cell) {
|
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
531
|
__name(getCellRichText, "getCellRichText");
|
|
530
|
-
var __defProp$
|
|
531
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
532
|
+
var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
533
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
532
534
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
533
|
-
return kind && result && __defProp$
|
|
534
|
-
}, "__decorateClass$
|
|
535
|
+
return kind && result && __defProp$f(target, key, result), result;
|
|
536
|
+
}, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f");
|
|
535
537
|
const REFRESH_ARRAY_SHAPE_MUTATIONS = [
|
|
536
538
|
SetWorksheetRowHeightMutation.id,
|
|
537
539
|
SetWorksheetColWidthMutation.id,
|
|
@@ -554,13 +556,13 @@ let FormulaEditorShowController = (_a5 = class extends Disposable {
|
|
|
554
556
|
this._editorBridgeService.interceptor.getInterceptPoints().BEFORE_CELL_EDIT,
|
|
555
557
|
{
|
|
556
558
|
handler: /* @__PURE__ */ __name((value, context, next) => {
|
|
557
|
-
var
|
|
559
|
+
var _a23, _b, _c, _d;
|
|
558
560
|
const { row, col, unitId, subUnitId, worksheet } = context, arrayFormulaMatrixRange = this._formulaDataModel.getArrayFormulaRange(), arrayFormulaMatrixCell = this._formulaDataModel.getArrayFormulaCellData();
|
|
559
561
|
if (this._removeArrayFormulaRangeShape(), value == null)
|
|
560
562
|
return next(value);
|
|
561
563
|
let cellInfo = null;
|
|
562
564
|
const formulaString = this._formulaDataModel.getFormulaStringByCell(row, col, subUnitId, unitId);
|
|
563
|
-
if (formulaString !== null && (cellInfo = { f: formulaString }), value.v != null && value.v !== "" && ((_c = (_b = (
|
|
565
|
+
if (formulaString !== null && (cellInfo = { f: formulaString }), value.v != null && value.v !== "" && ((_c = (_b = (_a23 = arrayFormulaMatrixCell[unitId]) == null ? void 0 : _a23[subUnitId]) == null ? void 0 : _b[row]) == null ? void 0 : _c[col]) == null)
|
|
564
566
|
return cellInfo ? { ...value, ...cellInfo } : next(value);
|
|
565
567
|
const matrixRange = (_d = arrayFormulaMatrixRange == null ? void 0 : arrayFormulaMatrixRange[unitId]) == null ? void 0 : _d[subUnitId];
|
|
566
568
|
return matrixRange != null && (cellInfo = this._displayArrayFormulaRangeShape(matrixRange, row, col, unitId, subUnitId, worksheet, cellInfo)), cellInfo ? { ...value, ...cellInfo } : next(value);
|
|
@@ -692,13 +694,13 @@ let FormulaEditorShowController = (_a5 = class extends Disposable {
|
|
|
692
694
|
}
|
|
693
695
|
}
|
|
694
696
|
}, __name(_a5, "FormulaEditorShowController"), _a5);
|
|
695
|
-
FormulaEditorShowController = __decorateClass$
|
|
696
|
-
__decorateParam$
|
|
697
|
-
__decorateParam$
|
|
698
|
-
__decorateParam$
|
|
699
|
-
__decorateParam$
|
|
700
|
-
__decorateParam$
|
|
701
|
-
__decorateParam$
|
|
697
|
+
FormulaEditorShowController = __decorateClass$f([
|
|
698
|
+
__decorateParam$f(1, Inject(IEditorBridgeService)),
|
|
699
|
+
__decorateParam$f(2, Inject(FormulaDataModel)),
|
|
700
|
+
__decorateParam$f(3, Inject(ThemeService)),
|
|
701
|
+
__decorateParam$f(4, IRenderManagerService),
|
|
702
|
+
__decorateParam$f(5, Inject(SheetSkeletonManagerService)),
|
|
703
|
+
__decorateParam$f(6, ICommandService)
|
|
702
704
|
], FormulaEditorShowController);
|
|
703
705
|
const SheetOnlyPasteFormulaCommand = {
|
|
704
706
|
id: "sheet.command.paste-formula",
|
|
@@ -732,37 +734,17 @@ const SheetOnlyPasteFormulaCommand = {
|
|
|
732
734
|
}, SelectEditorFormulaOperation = {
|
|
733
735
|
id: "formula-ui.operation.select-editor-formula",
|
|
734
736
|
type: CommandType.OPERATION,
|
|
735
|
-
handler: /* @__PURE__ */ __name((accessor, params) =>
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
// // case KeyCode.ENTER:
|
|
747
|
-
// // case KeyCode.TAB:
|
|
748
|
-
// // if (formulaPromptService.isSearching()) {
|
|
749
|
-
// // formulaPromptService.accept(true);
|
|
750
|
-
// // } else {
|
|
751
|
-
// // const editorBridgeParameters = {
|
|
752
|
-
// // visible: false,
|
|
753
|
-
// // eventType,
|
|
754
|
-
// // keycode,
|
|
755
|
-
// // };
|
|
756
|
-
// // editorBridgeService.changeVisible(editorBridgeParameters);
|
|
757
|
-
// // }
|
|
758
|
-
// // break;
|
|
759
|
-
// default:
|
|
760
|
-
// break;
|
|
761
|
-
// }
|
|
762
|
-
!0
|
|
763
|
-
), "handler")
|
|
764
|
-
}, IFormulaPromptService = createIdentifier("formula-ui.prompt-service"), _FormulaPromptService = class _FormulaPromptService {
|
|
765
|
-
constructor() {
|
|
737
|
+
handler: /* @__PURE__ */ __name((accessor, params) => !0, "handler")
|
|
738
|
+
};
|
|
739
|
+
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
740
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
741
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
742
|
+
return kind && result && __defProp$e(target, key, result), result;
|
|
743
|
+
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e");
|
|
744
|
+
const FORMULA_PROMPT_ACTIVATED = "FORMULA_PROMPT_ACTIVATED", IFormulaPromptService = createIdentifier("formula-ui.prompt-service");
|
|
745
|
+
var _a6;
|
|
746
|
+
let FormulaPromptService = (_a6 = class {
|
|
747
|
+
constructor(_contextService) {
|
|
766
748
|
__publicField(this, "_search$", new Subject());
|
|
767
749
|
__publicField(this, "_help$", new Subject());
|
|
768
750
|
__publicField(this, "_navigate$", new Subject());
|
|
@@ -778,12 +760,13 @@ const SheetOnlyPasteFormulaCommand = {
|
|
|
778
760
|
__publicField(this, "_sequenceNodes", []);
|
|
779
761
|
__publicField(this, "_isLockedOnSelectionChangeRefString", !1);
|
|
780
762
|
__publicField(this, "_isLockedOnSelectionInsertRefString", !1);
|
|
763
|
+
this._contextService = _contextService;
|
|
781
764
|
}
|
|
782
765
|
dispose() {
|
|
783
766
|
this._search$.complete(), this._help$.complete(), this._navigate$.complete(), this._accept$.complete(), this._acceptFormulaName$.complete(), this._sequenceNodes = [];
|
|
784
767
|
}
|
|
785
768
|
search(param) {
|
|
786
|
-
this._searching = param.visible, this._search$.next(param);
|
|
769
|
+
this._contextService.setContextValue(FORMULA_PROMPT_ACTIVATED, param.visible), this._searching = param.visible, this._search$.next(param);
|
|
787
770
|
}
|
|
788
771
|
isSearching() {
|
|
789
772
|
return this._searching;
|
|
@@ -914,9 +897,10 @@ const SheetOnlyPasteFormulaCommand = {
|
|
|
914
897
|
isLockedSelectionInsert() {
|
|
915
898
|
return this._isLockedOnSelectionInsertRefString;
|
|
916
899
|
}
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
|
|
900
|
+
}, __name(_a6, "FormulaPromptService"), _a6);
|
|
901
|
+
FormulaPromptService = __decorateClass$e([
|
|
902
|
+
__decorateParam$e(0, IContextService)
|
|
903
|
+
], FormulaPromptService);
|
|
920
904
|
const HelpFunctionOperation = {
|
|
921
905
|
id: "formula-ui.operation.help-function",
|
|
922
906
|
type: CommandType.OPERATION,
|
|
@@ -925,7 +909,7 @@ const HelpFunctionOperation = {
|
|
|
925
909
|
id: "formula-ui.operation.insert-function",
|
|
926
910
|
type: CommandType.OPERATION,
|
|
927
911
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
928
|
-
var
|
|
912
|
+
var _a23, _b;
|
|
929
913
|
const selectionManagerService = accessor.get(SheetsSelectionsService), editorService = accessor.get(IEditorService), currentSelections = selectionManagerService.getCurrentSelections();
|
|
930
914
|
if (!currentSelections || !currentSelections.length)
|
|
931
915
|
return !1;
|
|
@@ -934,14 +918,14 @@ const HelpFunctionOperation = {
|
|
|
934
918
|
const { worksheet, unitId, subUnitId } = target, cellMatrix = worksheet.getCellMatrix(), { value } = params, commandService = accessor.get(ICommandService), list = [];
|
|
935
919
|
let editRange = null, editRow = 0, editColumn = 0, editFormulaRangeString = "";
|
|
936
920
|
if (currentSelections.length === 1 && (isSingleCell(currentSelections[0].range) || isMultiRowsColumnsRange(currentSelections[0].range))) {
|
|
937
|
-
const { range, primary } = currentSelections[0], row = (
|
|
921
|
+
const { range, primary } = currentSelections[0], row = (_a23 = primary == null ? void 0 : primary.actualRow) != null ? _a23 : range.startRow, column = (_b = primary == null ? void 0 : primary.actualColumn) != null ? _b : range.startColumn;
|
|
938
922
|
editRange = range, editRow = row, editColumn = column;
|
|
939
923
|
const refRange = findRefRange(cellMatrix, row, column);
|
|
940
924
|
refRange && (editFormulaRangeString = serializeRange(refRange));
|
|
941
925
|
} else
|
|
942
926
|
currentSelections.some((selection) => {
|
|
943
|
-
var
|
|
944
|
-
const { range, primary } = selection, row = (
|
|
927
|
+
var _a24, _b2;
|
|
928
|
+
const { range, primary } = selection, row = (_a24 = primary == null ? void 0 : primary.actualRow) != null ? _a24 : range.startRow, column = (_b2 = primary == null ? void 0 : primary.actualColumn) != null ? _b2 : range.startColumn, refRange = findRefRange(cellMatrix, row, column);
|
|
945
929
|
if (!refRange)
|
|
946
930
|
return editRange = range, editRow = row, editColumn = column, !0;
|
|
947
931
|
const rangeString = serializeRange(refRange), formulaString = `=${value}(${rangeString})`;
|
|
@@ -1122,15 +1106,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
|
1122
1106
|
var attrs = __assign({}, node.attrs);
|
|
1123
1107
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
1124
1108
|
var defIds = runtimeProps.defIds;
|
|
1125
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
|
1126
|
-
var key =
|
|
1109
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a23) {
|
|
1110
|
+
var key = _a23[0], value = _a23[1];
|
|
1127
1111
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
1128
1112
|
})), attrs;
|
|
1129
1113
|
}
|
|
1130
1114
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
1131
1115
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
1132
|
-
var
|
|
1133
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
|
1116
|
+
var _a23, defIds = runtimeProps.defIds;
|
|
1117
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a23 = node.children) === null || _a23 === void 0) && _a23.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
1134
1118
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
1135
1119
|
}) }) : node;
|
|
1136
1120
|
}
|
|
@@ -1432,8 +1416,8 @@ function SearchFunction() {
|
|
|
1432
1416
|
}
|
|
1433
1417
|
__name(handleLiMouseLeave, "handleLiMouseLeave");
|
|
1434
1418
|
function scrollToVisible(liIndex) {
|
|
1435
|
-
var
|
|
1436
|
-
const liElement = (
|
|
1419
|
+
var _a23;
|
|
1420
|
+
const liElement = (_a23 = ulRef.current) == null ? void 0 : _a23.querySelectorAll(`.${styles$4.formulaSearchFunctionItem}`)[liIndex];
|
|
1437
1421
|
if (!liElement) return;
|
|
1438
1422
|
const ulElement = liElement.parentNode;
|
|
1439
1423
|
if (!ulElement) return;
|
|
@@ -6165,22 +6149,7 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6165
6149
|
functionType: FunctionType.Logical,
|
|
6166
6150
|
description: "formula.functionList.FALSE.description",
|
|
6167
6151
|
abstract: "formula.functionList.FALSE.abstract",
|
|
6168
|
-
functionParameter: [
|
|
6169
|
-
{
|
|
6170
|
-
name: "formula.functionList.FALSE.functionParameter.number1.name",
|
|
6171
|
-
detail: "formula.functionList.FALSE.functionParameter.number1.detail",
|
|
6172
|
-
example: "A1:A20",
|
|
6173
|
-
require: 1,
|
|
6174
|
-
repeat: 0
|
|
6175
|
-
},
|
|
6176
|
-
{
|
|
6177
|
-
name: "formula.functionList.FALSE.functionParameter.number2.name",
|
|
6178
|
-
detail: "formula.functionList.FALSE.functionParameter.number2.detail",
|
|
6179
|
-
example: "A1:A20",
|
|
6180
|
-
require: 1,
|
|
6181
|
-
repeat: 0
|
|
6182
|
-
}
|
|
6183
|
-
]
|
|
6152
|
+
functionParameter: []
|
|
6184
6153
|
},
|
|
6185
6154
|
{
|
|
6186
6155
|
functionName: FUNCTION_NAMES_LOGICAL.IF,
|
|
@@ -6240,16 +6209,16 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6240
6209
|
abstract: "formula.functionList.IFNA.abstract",
|
|
6241
6210
|
functionParameter: [
|
|
6242
6211
|
{
|
|
6243
|
-
name: "formula.functionList.IFNA.functionParameter.
|
|
6244
|
-
detail: "formula.functionList.IFNA.functionParameter.
|
|
6245
|
-
example: "
|
|
6212
|
+
name: "formula.functionList.IFNA.functionParameter.value.name",
|
|
6213
|
+
detail: "formula.functionList.IFNA.functionParameter.value.detail",
|
|
6214
|
+
example: "VLOOKUP(C3,C6:D11,2,FALSE)",
|
|
6246
6215
|
require: 1,
|
|
6247
6216
|
repeat: 0
|
|
6248
6217
|
},
|
|
6249
6218
|
{
|
|
6250
|
-
name: "formula.functionList.IFNA.functionParameter.
|
|
6251
|
-
detail: "formula.functionList.IFNA.functionParameter.
|
|
6252
|
-
example: "
|
|
6219
|
+
name: "formula.functionList.IFNA.functionParameter.valueIfNa.name",
|
|
6220
|
+
detail: "formula.functionList.IFNA.functionParameter.valueIfNa.detail",
|
|
6221
|
+
example: '"Not Found"',
|
|
6253
6222
|
require: 1,
|
|
6254
6223
|
repeat: 0
|
|
6255
6224
|
}
|
|
@@ -6262,18 +6231,32 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6262
6231
|
abstract: "formula.functionList.IFS.abstract",
|
|
6263
6232
|
functionParameter: [
|
|
6264
6233
|
{
|
|
6265
|
-
name: "formula.functionList.IFS.functionParameter.
|
|
6266
|
-
detail: "formula.functionList.IFS.functionParameter.
|
|
6267
|
-
example: "
|
|
6234
|
+
name: "formula.functionList.IFS.functionParameter.logicalTest1.name",
|
|
6235
|
+
detail: "formula.functionList.IFS.functionParameter.logicalTest1.detail",
|
|
6236
|
+
example: 'A2 = "foo"',
|
|
6268
6237
|
require: 1,
|
|
6269
6238
|
repeat: 0
|
|
6270
6239
|
},
|
|
6271
6240
|
{
|
|
6272
|
-
name: "formula.functionList.IFS.functionParameter.
|
|
6273
|
-
detail: "formula.functionList.IFS.functionParameter.
|
|
6274
|
-
example: "
|
|
6241
|
+
name: "formula.functionList.IFS.functionParameter.valueIfTrue1.name",
|
|
6242
|
+
detail: "formula.functionList.IFS.functionParameter.valueIfTrue1.detail",
|
|
6243
|
+
example: '"A2 is foo"',
|
|
6275
6244
|
require: 1,
|
|
6276
6245
|
repeat: 0
|
|
6246
|
+
},
|
|
6247
|
+
{
|
|
6248
|
+
name: "formula.functionList.IFS.functionParameter.logicalTest2.name",
|
|
6249
|
+
detail: "formula.functionList.IFS.functionParameter.logicalTest2.detail",
|
|
6250
|
+
example: "F2=1",
|
|
6251
|
+
require: 0,
|
|
6252
|
+
repeat: 1
|
|
6253
|
+
},
|
|
6254
|
+
{
|
|
6255
|
+
name: "formula.functionList.IFS.functionParameter.valueIfTrue2.name",
|
|
6256
|
+
detail: "formula.functionList.IFS.functionParameter.valueIfTrue2.detail",
|
|
6257
|
+
example: "D2",
|
|
6258
|
+
require: 0,
|
|
6259
|
+
repeat: 1
|
|
6277
6260
|
}
|
|
6278
6261
|
]
|
|
6279
6262
|
},
|
|
@@ -6380,16 +6363,9 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6380
6363
|
abstract: "formula.functionList.NOT.abstract",
|
|
6381
6364
|
functionParameter: [
|
|
6382
6365
|
{
|
|
6383
|
-
name: "formula.functionList.NOT.functionParameter.
|
|
6384
|
-
detail: "formula.functionList.NOT.functionParameter.
|
|
6385
|
-
example: "
|
|
6386
|
-
require: 1,
|
|
6387
|
-
repeat: 0
|
|
6388
|
-
},
|
|
6389
|
-
{
|
|
6390
|
-
name: "formula.functionList.NOT.functionParameter.number2.name",
|
|
6391
|
-
detail: "formula.functionList.NOT.functionParameter.number2.detail",
|
|
6392
|
-
example: "A1:A20",
|
|
6366
|
+
name: "formula.functionList.NOT.functionParameter.logical.name",
|
|
6367
|
+
detail: "formula.functionList.NOT.functionParameter.logical.detail",
|
|
6368
|
+
example: "A2>100",
|
|
6393
6369
|
require: 1,
|
|
6394
6370
|
repeat: 0
|
|
6395
6371
|
}
|
|
@@ -6468,18 +6444,39 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6468
6444
|
abstract: "formula.functionList.SWITCH.abstract",
|
|
6469
6445
|
functionParameter: [
|
|
6470
6446
|
{
|
|
6471
|
-
name: "formula.functionList.SWITCH.functionParameter.
|
|
6472
|
-
detail: "formula.functionList.SWITCH.functionParameter.
|
|
6473
|
-
example: "
|
|
6447
|
+
name: "formula.functionList.SWITCH.functionParameter.expression.name",
|
|
6448
|
+
detail: "formula.functionList.SWITCH.functionParameter.expression.detail",
|
|
6449
|
+
example: "WEEKDAY(A2)",
|
|
6474
6450
|
require: 1,
|
|
6475
6451
|
repeat: 0
|
|
6476
6452
|
},
|
|
6477
6453
|
{
|
|
6478
|
-
name: "formula.functionList.SWITCH.functionParameter.
|
|
6479
|
-
detail: "formula.functionList.SWITCH.functionParameter.
|
|
6480
|
-
example: "
|
|
6454
|
+
name: "formula.functionList.SWITCH.functionParameter.value1.name",
|
|
6455
|
+
detail: "formula.functionList.SWITCH.functionParameter.value1.detail",
|
|
6456
|
+
example: "1",
|
|
6457
|
+
require: 1,
|
|
6458
|
+
repeat: 0
|
|
6459
|
+
},
|
|
6460
|
+
{
|
|
6461
|
+
name: "formula.functionList.SWITCH.functionParameter.result1.name",
|
|
6462
|
+
detail: "formula.functionList.SWITCH.functionParameter.result1.detail",
|
|
6463
|
+
example: '"Sunday"',
|
|
6481
6464
|
require: 1,
|
|
6482
6465
|
repeat: 0
|
|
6466
|
+
},
|
|
6467
|
+
{
|
|
6468
|
+
name: "formula.functionList.SWITCH.functionParameter.defaultOrValue2.name",
|
|
6469
|
+
detail: "formula.functionList.SWITCH.functionParameter.defaultOrValue2.detail",
|
|
6470
|
+
example: "2",
|
|
6471
|
+
require: 0,
|
|
6472
|
+
repeat: 1
|
|
6473
|
+
},
|
|
6474
|
+
{
|
|
6475
|
+
name: "formula.functionList.SWITCH.functionParameter.result2.name",
|
|
6476
|
+
detail: "formula.functionList.SWITCH.functionParameter.result2.detail",
|
|
6477
|
+
example: '"Monday"',
|
|
6478
|
+
require: 0,
|
|
6479
|
+
repeat: 1
|
|
6483
6480
|
}
|
|
6484
6481
|
]
|
|
6485
6482
|
},
|
|
@@ -6488,22 +6485,7 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6488
6485
|
functionType: FunctionType.Logical,
|
|
6489
6486
|
description: "formula.functionList.TRUE.description",
|
|
6490
6487
|
abstract: "formula.functionList.TRUE.abstract",
|
|
6491
|
-
functionParameter: [
|
|
6492
|
-
{
|
|
6493
|
-
name: "formula.functionList.TRUE.functionParameter.number1.name",
|
|
6494
|
-
detail: "formula.functionList.TRUE.functionParameter.number1.detail",
|
|
6495
|
-
example: "A1:A20",
|
|
6496
|
-
require: 1,
|
|
6497
|
-
repeat: 0
|
|
6498
|
-
},
|
|
6499
|
-
{
|
|
6500
|
-
name: "formula.functionList.TRUE.functionParameter.number2.name",
|
|
6501
|
-
detail: "formula.functionList.TRUE.functionParameter.number2.detail",
|
|
6502
|
-
example: "A1:A20",
|
|
6503
|
-
require: 1,
|
|
6504
|
-
repeat: 0
|
|
6505
|
-
}
|
|
6506
|
-
]
|
|
6488
|
+
functionParameter: []
|
|
6507
6489
|
},
|
|
6508
6490
|
{
|
|
6509
6491
|
functionName: FUNCTION_NAMES_LOGICAL.XOR,
|
|
@@ -6512,18 +6494,18 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6512
6494
|
abstract: "formula.functionList.XOR.abstract",
|
|
6513
6495
|
functionParameter: [
|
|
6514
6496
|
{
|
|
6515
|
-
name: "formula.functionList.XOR.functionParameter.
|
|
6516
|
-
detail: "formula.functionList.XOR.functionParameter.
|
|
6517
|
-
example: "
|
|
6497
|
+
name: "formula.functionList.XOR.functionParameter.logical1.name",
|
|
6498
|
+
detail: "formula.functionList.XOR.functionParameter.logical1.detail",
|
|
6499
|
+
example: "3>0",
|
|
6518
6500
|
require: 1,
|
|
6519
6501
|
repeat: 0
|
|
6520
6502
|
},
|
|
6521
6503
|
{
|
|
6522
|
-
name: "formula.functionList.XOR.functionParameter.
|
|
6523
|
-
detail: "formula.functionList.XOR.functionParameter.
|
|
6524
|
-
example: "
|
|
6525
|
-
require:
|
|
6526
|
-
repeat:
|
|
6504
|
+
name: "formula.functionList.XOR.functionParameter.logical2.name",
|
|
6505
|
+
detail: "formula.functionList.XOR.functionParameter.logical2.detail",
|
|
6506
|
+
example: "2<9",
|
|
6507
|
+
require: 0,
|
|
6508
|
+
repeat: 1
|
|
6527
6509
|
}
|
|
6528
6510
|
]
|
|
6529
6511
|
}
|
|
@@ -6578,15 +6560,8 @@ const FUNCTION_LIST_ARRAY = [], FUNCTION_LIST_COMPATIBILITY = [
|
|
|
6578
6560
|
abstract: "formula.functionList.AREAS.abstract",
|
|
6579
6561
|
functionParameter: [
|
|
6580
6562
|
{
|
|
6581
|
-
name: "formula.functionList.AREAS.functionParameter.
|
|
6582
|
-
detail: "formula.functionList.AREAS.functionParameter.
|
|
6583
|
-
example: "A1:A20",
|
|
6584
|
-
require: 1,
|
|
6585
|
-
repeat: 0
|
|
6586
|
-
},
|
|
6587
|
-
{
|
|
6588
|
-
name: "formula.functionList.AREAS.functionParameter.number2.name",
|
|
6589
|
-
detail: "formula.functionList.AREAS.functionParameter.number2.detail",
|
|
6563
|
+
name: "formula.functionList.AREAS.functionParameter.reference.name",
|
|
6564
|
+
detail: "formula.functionList.AREAS.functionParameter.reference.detail",
|
|
6590
6565
|
example: "A1:A20",
|
|
6591
6566
|
require: 1,
|
|
6592
6567
|
repeat: 0
|
|
@@ -12874,8 +12849,8 @@ var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPrope
|
|
|
12874
12849
|
return kind && result && __defProp$d(target, key, result), result;
|
|
12875
12850
|
}, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d");
|
|
12876
12851
|
const IDescriptionService = createIdentifier("formula-ui.description-service");
|
|
12877
|
-
var
|
|
12878
|
-
let DescriptionService = (
|
|
12852
|
+
var _a7;
|
|
12853
|
+
let DescriptionService = (_a7 = class {
|
|
12879
12854
|
constructor(_description = [], _functionService, _localeService) {
|
|
12880
12855
|
__publicField(this, "_descriptions", []);
|
|
12881
12856
|
this._description = _description, this._functionService = _functionService, this._localeService = _localeService, this._initialize();
|
|
@@ -12977,7 +12952,7 @@ let DescriptionService = (_a6 = class {
|
|
|
12977
12952
|
}));
|
|
12978
12953
|
this._functionService.registerDescriptions(...functionListLocale);
|
|
12979
12954
|
}
|
|
12980
|
-
}, __name(
|
|
12955
|
+
}, __name(_a7, "DescriptionService"), _a7);
|
|
12981
12956
|
DescriptionService = __decorateClass$d([
|
|
12982
12957
|
__decorateParam$d(1, IFunctionService),
|
|
12983
12958
|
__decorateParam$d(2, Inject(LocaleService))
|
|
@@ -13305,8 +13280,8 @@ var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPrope
|
|
|
13305
13280
|
return kind && result && __defProp$c(target, key, result), result;
|
|
13306
13281
|
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
|
|
13307
13282
|
const DefaultSheetFormulaConfig = {};
|
|
13308
|
-
var
|
|
13309
|
-
let FormulaUIController = (
|
|
13283
|
+
var _a8;
|
|
13284
|
+
let FormulaUIController = (_a8 = class extends Disposable {
|
|
13310
13285
|
constructor(_config, _injector, _menuService, _commandService, _shortcutService, _uiPartsService, _renderManagerService, _componentManager) {
|
|
13311
13286
|
super(), this._config = _config, this._injector = _injector, this._menuService = _menuService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._uiPartsService = _uiPartsService, this._renderManagerService = _renderManagerService, this._componentManager = _componentManager, this._initialize();
|
|
13312
13287
|
}
|
|
@@ -13354,7 +13329,7 @@ let FormulaUIController = (_a7 = class extends Disposable {
|
|
|
13354
13329
|
_registerRenderModules() {
|
|
13355
13330
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, [FormulaEditorShowController]));
|
|
13356
13331
|
}
|
|
13357
|
-
}, __name(
|
|
13332
|
+
}, __name(_a8, "FormulaUIController"), _a8);
|
|
13358
13333
|
FormulaUIController = __decorateClass$c([
|
|
13359
13334
|
OnLifecycle(LifecycleStages.Ready, FormulaUIController),
|
|
13360
13335
|
__decorateParam$c(1, Inject(Injector)),
|
|
@@ -13369,8 +13344,8 @@ var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPrope
|
|
|
13369
13344
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13370
13345
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
13371
13346
|
return kind && result && __defProp$b(target, key, result), result;
|
|
13372
|
-
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"),
|
|
13373
|
-
let TriggerCalculationController = (
|
|
13347
|
+
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a9;
|
|
13348
|
+
let TriggerCalculationController = (_a9 = class extends Disposable {
|
|
13374
13349
|
constructor(_commandService, _activeDirtyManagerService, _numfmtService, _formulaDataModel, _progressService) {
|
|
13375
13350
|
super();
|
|
13376
13351
|
__publicField(this, "_waitingCommandQueue", []);
|
|
@@ -13451,8 +13426,8 @@ let TriggerCalculationController = (_a8 = class extends Disposable {
|
|
|
13451
13426
|
_mergeDirtyNameMap(allDirtyNameMap, dirtyNameMap) {
|
|
13452
13427
|
Object.keys(dirtyNameMap).forEach((unitId) => {
|
|
13453
13428
|
allDirtyNameMap[unitId] == null && (allDirtyNameMap[unitId] = {}), Object.keys(dirtyNameMap[unitId]).forEach((sheetId) => {
|
|
13454
|
-
var
|
|
13455
|
-
(
|
|
13429
|
+
var _a23;
|
|
13430
|
+
(_a23 = dirtyNameMap[unitId]) != null && _a23[sheetId] && (allDirtyNameMap[unitId] == null && (allDirtyNameMap[unitId] = {}), allDirtyNameMap[unitId][sheetId] = dirtyNameMap[unitId][sheetId]);
|
|
13456
13431
|
});
|
|
13457
13432
|
});
|
|
13458
13433
|
}
|
|
@@ -13567,7 +13542,7 @@ let TriggerCalculationController = (_a8 = class extends Disposable {
|
|
|
13567
13542
|
const count = completedCount - this._arrayFormulaCalculationDoneCount;
|
|
13568
13543
|
this._arrayFormulaCalculationDoneCount = completedCount, this._progressService.pushTask({ count });
|
|
13569
13544
|
}
|
|
13570
|
-
}, __name(
|
|
13545
|
+
}, __name(_a9, "TriggerCalculationController"), _a9);
|
|
13571
13546
|
TriggerCalculationController = __decorateClass$b([
|
|
13572
13547
|
OnLifecycle(LifecycleStages.Ready, TriggerCalculationController),
|
|
13573
13548
|
__decorateParam$b(0, ICommandService),
|
|
@@ -13577,14 +13552,14 @@ TriggerCalculationController = __decorateClass$b([
|
|
|
13577
13552
|
__decorateParam$b(4, Inject(IProgressService))
|
|
13578
13553
|
], TriggerCalculationController);
|
|
13579
13554
|
function checkFormulaDataNull(formulaData, unitId, sheetId) {
|
|
13580
|
-
var
|
|
13581
|
-
return formulaData == null || formulaData[unitId] == null || ((
|
|
13555
|
+
var _a23;
|
|
13556
|
+
return formulaData == null || formulaData[unitId] == null || ((_a23 = formulaData[unitId]) == null ? void 0 : _a23[sheetId]) == null;
|
|
13582
13557
|
}
|
|
13583
13558
|
__name(checkFormulaDataNull, "checkFormulaDataNull");
|
|
13584
13559
|
function removeFormulaData(formulaData, unitId, sheetId) {
|
|
13585
|
-
var
|
|
13560
|
+
var _a23;
|
|
13586
13561
|
if (sheetId) {
|
|
13587
|
-
if (formulaData && formulaData[unitId] && ((
|
|
13562
|
+
if (formulaData && formulaData[unitId] && ((_a23 = formulaData[unitId]) != null && _a23[sheetId]))
|
|
13588
13563
|
return delete formulaData[unitId][sheetId], {
|
|
13589
13564
|
[unitId]: {
|
|
13590
13565
|
[sheetId]: null
|
|
@@ -13919,8 +13894,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
|
|
|
13919
13894
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13920
13895
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
13921
13896
|
return kind && result && __defProp$a(target, key, result), result;
|
|
13922
|
-
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"),
|
|
13923
|
-
let UpdateFormulaController = (
|
|
13897
|
+
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a10;
|
|
13898
|
+
let UpdateFormulaController = (_a10 = class extends Disposable {
|
|
13924
13899
|
constructor(_univerInstanceService, _commandService, _lexerTreeBuilder, _formulaDataModel, _sheetInterceptorService, _selectionManagerService, _editorService, _injector) {
|
|
13925
13900
|
super(), this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._lexerTreeBuilder = _lexerTreeBuilder, this._formulaDataModel = _formulaDataModel, this._sheetInterceptorService = _sheetInterceptorService, this._selectionManagerService = _selectionManagerService, this._editorService = _editorService, this._injector = _injector, this._initialize();
|
|
13926
13901
|
}
|
|
@@ -14035,9 +14010,9 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14035
14010
|
[unitId]: {}
|
|
14036
14011
|
};
|
|
14037
14012
|
unitType === UniverInstanceType.UNIVER_SHEET ? unit.getSheets().forEach((worksheet) => {
|
|
14038
|
-
var
|
|
14013
|
+
var _a23;
|
|
14039
14014
|
const cellMatrix = worksheet.getCellMatrix(), sheetId = worksheet.getSheetId(), currentSheetData = initSheetFormulaData(formulaData, unitId, sheetId, cellMatrix);
|
|
14040
|
-
newFormulaData[unitId][sheetId] = (
|
|
14015
|
+
newFormulaData[unitId][sheetId] = (_a23 = currentSheetData[unitId]) == null ? void 0 : _a23[sheetId];
|
|
14041
14016
|
}) : unitType === UniverInstanceType.UNIVER_DOC || UniverInstanceType.UNIVER_SLIDE, this._commandService.executeCommand(
|
|
14042
14017
|
SetFormulaDataMutation.id,
|
|
14043
14018
|
{
|
|
@@ -14304,7 +14279,7 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14304
14279
|
for (const sheetId of sheetDataKeys) {
|
|
14305
14280
|
const matrixData = new ObjectMatrix(sheetData[sheetId] || {}), newFormulaDataItem = new ObjectMatrix();
|
|
14306
14281
|
matrixData.forValue((row, column, formulaDataItem) => {
|
|
14307
|
-
var
|
|
14282
|
+
var _a23;
|
|
14308
14283
|
if (!formulaDataItem) return !0;
|
|
14309
14284
|
const { f: formulaString, x, y, si } = formulaDataItem, sequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formulaString);
|
|
14310
14285
|
if (sequenceNodes == null)
|
|
@@ -14315,7 +14290,7 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14315
14290
|
const node = sequenceNodes[i];
|
|
14316
14291
|
if (typeof node == "string" || node.nodeType !== sequenceNodeType.REFERENCE)
|
|
14317
14292
|
continue;
|
|
14318
|
-
const { token } = node, sequenceGrid = deserializeRangeWithSheet(token), { range, sheetName, unitId: sequenceUnitId } = sequenceGrid, mapUnitId = sequenceUnitId == null || sequenceUnitId.length === 0 ? unitId : sequenceUnitId, sequenceSheetId = (
|
|
14293
|
+
const { token } = node, sequenceGrid = deserializeRangeWithSheet(token), { range, sheetName, unitId: sequenceUnitId } = sequenceGrid, mapUnitId = sequenceUnitId == null || sequenceUnitId.length === 0 ? unitId : sequenceUnitId, sequenceSheetId = (_a23 = unitSheetNameMap == null ? void 0 : unitSheetNameMap[mapUnitId]) == null ? void 0 : _a23[sheetName];
|
|
14319
14294
|
if (!this._checkIsSameUnitAndSheet(
|
|
14320
14295
|
formulaReferenceMoveParam.unitId,
|
|
14321
14296
|
formulaReferenceMoveParam.sheetId,
|
|
@@ -14402,45 +14377,50 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14402
14377
|
return;
|
|
14403
14378
|
const sequenceRange = Rectangle.moveOffset(unitRange, refOffsetX, refOffsetY);
|
|
14404
14379
|
let newRange = null;
|
|
14405
|
-
if (type
|
|
14406
|
-
if (
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
remainRange
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14417
|
-
|
|
14418
|
-
|
|
14419
|
-
|
|
14420
|
-
|
|
14421
|
-
|
|
14422
|
-
|
|
14423
|
-
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
remainRange
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14380
|
+
if (type !== 0) {
|
|
14381
|
+
if (type === 1) {
|
|
14382
|
+
if (from == null || to == null)
|
|
14383
|
+
return;
|
|
14384
|
+
const moveEdge = this._checkMoveEdge(sequenceRange, from);
|
|
14385
|
+
let remainRange = Rectangle.getIntersects(sequenceRange, from);
|
|
14386
|
+
if (remainRange == null && (from.endRow < sequenceRange.startRow && to.endRow < sequenceRange.startRow || from.startRow > sequenceRange.endRow && to.startRow > sequenceRange.endRow))
|
|
14387
|
+
return;
|
|
14388
|
+
remainRange == null && (remainRange = {
|
|
14389
|
+
startRow: sequenceRange.startRow,
|
|
14390
|
+
endRow: sequenceRange.endRow,
|
|
14391
|
+
startColumn: sequenceRange.startColumn,
|
|
14392
|
+
endColumn: sequenceRange.endColumn,
|
|
14393
|
+
rangeType: RANGE_TYPE.NORMAL
|
|
14394
|
+
});
|
|
14395
|
+
const operators = handleMoveRows(
|
|
14396
|
+
{ id: EffectRefRangId.MoveRowsCommandId, params: { toRange: to, fromRange: from } },
|
|
14397
|
+
remainRange
|
|
14398
|
+
), result = runRefRangeMutations(operators, remainRange);
|
|
14399
|
+
if (result == null)
|
|
14400
|
+
return ErrorType.REF;
|
|
14401
|
+
newRange = this._getMoveNewRange(moveEdge, result, from, to, sequenceRange, remainRange);
|
|
14402
|
+
} else if (type === 2) {
|
|
14403
|
+
if (from == null || to == null)
|
|
14404
|
+
return;
|
|
14405
|
+
const moveEdge = this._checkMoveEdge(sequenceRange, from);
|
|
14406
|
+
let remainRange = Rectangle.getIntersects(sequenceRange, from);
|
|
14407
|
+
if (remainRange == null && (from.endColumn < sequenceRange.startColumn && to.endColumn < sequenceRange.startColumn || from.startColumn > sequenceRange.endColumn && to.startColumn > sequenceRange.endColumn))
|
|
14408
|
+
return;
|
|
14409
|
+
remainRange == null && (remainRange = {
|
|
14410
|
+
startRow: sequenceRange.startRow,
|
|
14411
|
+
endRow: sequenceRange.endRow,
|
|
14412
|
+
startColumn: sequenceRange.startColumn,
|
|
14413
|
+
endColumn: sequenceRange.endColumn,
|
|
14414
|
+
rangeType: RANGE_TYPE.NORMAL
|
|
14415
|
+
});
|
|
14416
|
+
const operators = handleMoveCols(
|
|
14417
|
+
{ id: EffectRefRangId.MoveColsCommandId, params: { toRange: to, fromRange: from } },
|
|
14418
|
+
remainRange
|
|
14419
|
+
), result = runRefRangeMutations(operators, remainRange);
|
|
14420
|
+
if (result == null)
|
|
14421
|
+
return ErrorType.REF;
|
|
14422
|
+
newRange = this._getMoveNewRange(moveEdge, result, from, to, sequenceRange, remainRange);
|
|
14423
|
+
}
|
|
14444
14424
|
}
|
|
14445
14425
|
if (range != null) {
|
|
14446
14426
|
if (type === 3) {
|
|
@@ -14651,11 +14631,7 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14651
14631
|
if (startColumn === originStartColumn && endColumn === originEndColumn)
|
|
14652
14632
|
if (startRow < originStartRow)
|
|
14653
14633
|
newRange.startRow = startRow;
|
|
14654
|
-
else if (
|
|
14655
|
-
newRange.startRow = startRow;
|
|
14656
|
-
else if (endRow >= originEndRow && toStartRow <= originEndRow)
|
|
14657
|
-
newRange.startRow = fromEndRow + 1, newRange.endRow = endRow;
|
|
14658
|
-
else if (toStartRow > originEndRow)
|
|
14634
|
+
else if (startRow >= originEndRow)
|
|
14659
14635
|
newRange.endRow -= fromEndRow + 1 - originStartRow;
|
|
14660
14636
|
else
|
|
14661
14637
|
return;
|
|
@@ -14665,11 +14641,7 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14665
14641
|
if (startColumn === originStartColumn && endColumn === originEndColumn)
|
|
14666
14642
|
if (endRow > originEndRow)
|
|
14667
14643
|
newRange.endRow = endRow;
|
|
14668
|
-
else if (
|
|
14669
|
-
newRange.endRow = endRow;
|
|
14670
|
-
else if (startRow <= originStartRow && toEndRow >= originStartRow)
|
|
14671
|
-
newRange.endRow = fromStartRow + 1, newRange.startRow = startRow;
|
|
14672
|
-
else if (toEndRow < originStartRow)
|
|
14644
|
+
else if (endRow <= originStartRow)
|
|
14673
14645
|
newRange.startRow += originEndRow - fromStartRow + 1;
|
|
14674
14646
|
else
|
|
14675
14647
|
return;
|
|
@@ -14679,11 +14651,7 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14679
14651
|
if (startRow === originStartRow && endRow === originEndRow)
|
|
14680
14652
|
if (startColumn < originStartColumn)
|
|
14681
14653
|
newRange.startColumn = startColumn;
|
|
14682
|
-
else if (
|
|
14683
|
-
newRange.startColumn = startColumn;
|
|
14684
|
-
else if (endColumn >= originEndColumn && toStartColumn <= originEndColumn)
|
|
14685
|
-
newRange.startColumn = fromEndColumn + 1, newRange.endColumn = endColumn;
|
|
14686
|
-
else if (toStartColumn > originEndColumn)
|
|
14654
|
+
else if (startColumn >= originEndColumn)
|
|
14687
14655
|
newRange.endColumn -= fromEndColumn + 1 - originStartColumn;
|
|
14688
14656
|
else
|
|
14689
14657
|
return;
|
|
@@ -14693,28 +14661,24 @@ let UpdateFormulaController = (_a9 = class extends Disposable {
|
|
|
14693
14661
|
if (startRow === originStartRow && endRow === originEndRow)
|
|
14694
14662
|
if (endColumn > originEndColumn)
|
|
14695
14663
|
newRange.endColumn = endColumn;
|
|
14696
|
-
else if (
|
|
14697
|
-
newRange.endColumn = endColumn;
|
|
14698
|
-
else if (startColumn <= originStartColumn && toEndColumn >= originStartColumn)
|
|
14699
|
-
newRange.endColumn = fromStartColumn + 1, newRange.startColumn = startColumn;
|
|
14700
|
-
else if (toEndColumn < originStartColumn)
|
|
14664
|
+
else if (endColumn <= originStartColumn)
|
|
14701
14665
|
newRange.startColumn += originEndColumn - fromStartColumn + 1;
|
|
14702
14666
|
else
|
|
14703
14667
|
return;
|
|
14704
14668
|
else
|
|
14705
14669
|
return;
|
|
14706
|
-
else moveEdge === 4 ? (newRange.startRow = startRow, newRange.startColumn = startColumn, newRange.endRow = endRow, newRange.endColumn = endColumn) : fromStartColumn <= originStartColumn && fromEndColumn >= originEndColumn ? toStartRow
|
|
14670
|
+
else moveEdge === 4 ? (newRange.startRow = startRow, newRange.startColumn = startColumn, newRange.endRow = endRow, newRange.endColumn = endColumn) : fromStartColumn <= originStartColumn && fromEndColumn >= originEndColumn ? from.endRow < originStartRow ? (toStartRow >= originStartRow && (newRange.startRow -= fromEndRow - fromStartRow + 1), toStartRow >= originEndRow && (newRange.endRow -= fromEndRow - fromStartRow + 1)) : from.startRow > originEndRow && (toEndRow <= originEndRow && (newRange.endRow += fromEndRow - fromStartRow + 1), toEndRow <= originStartRow && (newRange.startRow += fromEndRow - fromStartRow + 1)) : fromStartRow <= originStartRow && fromEndRow >= originEndRow ? from.endColumn < originStartColumn ? (toStartColumn >= originStartColumn && (newRange.startColumn -= fromEndColumn - fromStartColumn + 1), toStartColumn >= originEndColumn && (newRange.endColumn -= fromEndColumn - fromStartColumn + 1)) : from.startColumn > originEndColumn && (toEndColumn <= originEndColumn && (newRange.endColumn += fromEndColumn - fromStartColumn + 1), toEndColumn <= originStartColumn && (newRange.startColumn += fromEndColumn - fromStartColumn + 1)) : ((toStartColumn <= remainEndColumn + 1 && toEndColumn >= originEndColumn || toStartColumn <= originStartColumn && toEndColumn >= remainStartColumn - 1) && toStartRow <= originStartRow && toEndRow >= originEndRow || (toStartRow <= remainEndRow + 1 && toEndRow >= originEndRow || toStartRow <= originStartRow && toEndRow >= remainStartRow - 1) && toStartColumn <= originStartColumn && toEndColumn >= originEndColumn) && (newRange.startRow = startRow, newRange.startColumn = startColumn, newRange.endRow = endRow, newRange.endColumn = endColumn);
|
|
14707
14671
|
return newRange;
|
|
14708
14672
|
}
|
|
14709
14673
|
_getCurrentSheetInfo() {
|
|
14710
|
-
var
|
|
14711
|
-
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), sheetId = ((
|
|
14674
|
+
var _a23;
|
|
14675
|
+
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), unitId = workbook.getUnitId(), sheetId = ((_a23 = workbook.getActiveSheet()) == null ? void 0 : _a23.getSheetId()) || "";
|
|
14712
14676
|
return {
|
|
14713
14677
|
unitId,
|
|
14714
14678
|
sheetId
|
|
14715
14679
|
};
|
|
14716
14680
|
}
|
|
14717
|
-
}, __name(
|
|
14681
|
+
}, __name(_a10, "UpdateFormulaController"), _a10);
|
|
14718
14682
|
UpdateFormulaController = __decorateClass$a([
|
|
14719
14683
|
OnLifecycle(LifecycleStages.Ready, UpdateFormulaController),
|
|
14720
14684
|
__decorateParam$a(0, IUniverInstanceService),
|
|
@@ -14732,8 +14696,8 @@ var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPrope
|
|
|
14732
14696
|
return kind && result && __defProp$9(target, key, result), result;
|
|
14733
14697
|
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9");
|
|
14734
14698
|
const RemoteRegisterFunctionServiceName = "sheets-formula.remote-register-function.service", IRemoteRegisterFunctionService = createIdentifier(RemoteRegisterFunctionServiceName);
|
|
14735
|
-
var
|
|
14736
|
-
let RemoteRegisterFunctionService = (
|
|
14699
|
+
var _a11;
|
|
14700
|
+
let RemoteRegisterFunctionService = (_a11 = class {
|
|
14737
14701
|
constructor(_functionService) {
|
|
14738
14702
|
this._functionService = _functionService;
|
|
14739
14703
|
}
|
|
@@ -14744,7 +14708,7 @@ let RemoteRegisterFunctionService = (_a10 = class {
|
|
|
14744
14708
|
async unregisterFunctions(names) {
|
|
14745
14709
|
this._functionService.unregisterDescriptions(...names);
|
|
14746
14710
|
}
|
|
14747
|
-
}, __name(
|
|
14711
|
+
}, __name(_a11, "RemoteRegisterFunctionService"), _a11);
|
|
14748
14712
|
RemoteRegisterFunctionService = __decorateClass$9([
|
|
14749
14713
|
__decorateParam$9(0, IFunctionService)
|
|
14750
14714
|
], RemoteRegisterFunctionService);
|
|
@@ -14761,8 +14725,8 @@ var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPrope
|
|
|
14761
14725
|
const IRegisterFunctionService = createIdentifier(
|
|
14762
14726
|
"sheets-formula.register-function-service"
|
|
14763
14727
|
);
|
|
14764
|
-
var
|
|
14765
|
-
let RegisterFunctionService = (
|
|
14728
|
+
var _a12;
|
|
14729
|
+
let RegisterFunctionService = (_a12 = class extends Disposable {
|
|
14766
14730
|
constructor(_localeService, _descriptionService, _functionService, _remoteRegisterFunctionService) {
|
|
14767
14731
|
super(), this._localeService = _localeService, this._descriptionService = _descriptionService, this._functionService = _functionService, this._remoteRegisterFunctionService = _remoteRegisterFunctionService;
|
|
14768
14732
|
}
|
|
@@ -14795,7 +14759,7 @@ let RegisterFunctionService = (_a11 = class extends Disposable {
|
|
|
14795
14759
|
const functionNameList = [], functions = list.map(([func, name]) => (functionNameList.push(name), [func.toString(), name]));
|
|
14796
14760
|
return this._remoteRegisterFunctionService.registerFunctions(functions), toDisposable(() => this._remoteRegisterFunctionService.unregisterFunctions(functionNameList));
|
|
14797
14761
|
}
|
|
14798
|
-
}, __name(
|
|
14762
|
+
}, __name(_a12, "RegisterFunctionService"), _a12);
|
|
14799
14763
|
RegisterFunctionService = __decorateClass$8([
|
|
14800
14764
|
__decorateParam$8(0, Inject(LocaleService)),
|
|
14801
14765
|
__decorateParam$8(1, Inject(IDescriptionService)),
|
|
@@ -14808,8 +14772,8 @@ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPrope
|
|
|
14808
14772
|
return kind && result && __defProp$7(target, key, result), result;
|
|
14809
14773
|
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
|
|
14810
14774
|
const SCOPE_WORKBOOK_VALUE = "AllDefaultWorkbook";
|
|
14811
|
-
var
|
|
14812
|
-
let DefinedNameController = (
|
|
14775
|
+
var _a13;
|
|
14776
|
+
let DefinedNameController = (_a13 = class extends Disposable {
|
|
14813
14777
|
constructor(_descriptionService, _definedNamesService, _univerInstanceService, _commandService) {
|
|
14814
14778
|
super();
|
|
14815
14779
|
__publicField(this, "_preUnitId", null);
|
|
@@ -14923,7 +14887,7 @@ let DefinedNameController = (_a12 = class extends Disposable {
|
|
|
14923
14887
|
localSheetId !== SCOPE_WORKBOOK_VALUE && localSheetId !== sheetId && functionList.push(name);
|
|
14924
14888
|
}), this._descriptionService.unregisterDescriptions(functionList);
|
|
14925
14889
|
}
|
|
14926
|
-
}, __name(
|
|
14890
|
+
}, __name(_a13, "DefinedNameController"), _a13);
|
|
14927
14891
|
DefinedNameController = __decorateClass$7([
|
|
14928
14892
|
OnLifecycle(LifecycleStages.Rendered, DefinedNameController),
|
|
14929
14893
|
__decorateParam$7(0, IDescriptionService),
|
|
@@ -14935,8 +14899,8 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
|
14935
14899
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14936
14900
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
14937
14901
|
return kind && result && __defProp$6(target, key, result), result;
|
|
14938
|
-
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"),
|
|
14939
|
-
let FormulaRefRangeService = (
|
|
14902
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a14;
|
|
14903
|
+
let FormulaRefRangeService = (_a14 = class extends Disposable {
|
|
14940
14904
|
constructor(_refRangeService, _lexerTreeBuilder, _univerInstanceService) {
|
|
14941
14905
|
super(), this._refRangeService = _refRangeService, this._lexerTreeBuilder = _lexerTreeBuilder, this._univerInstanceService = _univerInstanceService;
|
|
14942
14906
|
}
|
|
@@ -14973,7 +14937,7 @@ let FormulaRefRangeService = (_a13 = class extends Disposable {
|
|
|
14973
14937
|
}
|
|
14974
14938
|
}), disposableCollection;
|
|
14975
14939
|
}
|
|
14976
|
-
}, __name(
|
|
14940
|
+
}, __name(_a14, "FormulaRefRangeService"), _a14);
|
|
14977
14941
|
FormulaRefRangeService = __decorateClass$6([
|
|
14978
14942
|
__decorateParam$6(0, Inject(RefRangeService)),
|
|
14979
14943
|
__decorateParam$6(1, Inject(LexerTreeBuilder)),
|
|
@@ -14983,8 +14947,8 @@ var FormulaResultStatus = /* @__PURE__ */ ((FormulaResultStatus2) => (FormulaRes
|
|
|
14983
14947
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14984
14948
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
14985
14949
|
return kind && result && __defProp$5(target, key, result), result;
|
|
14986
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"),
|
|
14987
|
-
let RegisterOtherFormulaService = (
|
|
14950
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a15;
|
|
14951
|
+
let RegisterOtherFormulaService = (_a15 = class extends Disposable {
|
|
14988
14952
|
constructor(_commandService, _activeDirtyManagerService) {
|
|
14989
14953
|
super();
|
|
14990
14954
|
__publicField(this, "_formulaCacheMap", /* @__PURE__ */ new Map());
|
|
@@ -15095,7 +15059,7 @@ let RegisterOtherFormulaService = (_a14 = class extends Disposable {
|
|
|
15095
15059
|
getFormulaValueSync(unitId, subUnitId, formulaId) {
|
|
15096
15060
|
return this._ensureCacheMap(unitId, subUnitId).get(formulaId);
|
|
15097
15061
|
}
|
|
15098
|
-
}, __name(
|
|
15062
|
+
}, __name(_a15, "RegisterOtherFormulaService"), _a15);
|
|
15099
15063
|
RegisterOtherFormulaService = __decorateClass$5([
|
|
15100
15064
|
__decorateParam$5(0, ICommandService),
|
|
15101
15065
|
__decorateParam$5(1, IActiveDirtyManagerService)
|
|
@@ -15119,8 +15083,8 @@ const ALERT_KEY = "SHEET_FORMULA_ALERT", ErrorTypeToMessageMap = {
|
|
|
15119
15083
|
[ErrorType.CONNECT]: "connect",
|
|
15120
15084
|
[ErrorType.NULL]: "null"
|
|
15121
15085
|
};
|
|
15122
|
-
var
|
|
15123
|
-
let FormulaAlertRenderController = (
|
|
15086
|
+
var _a16;
|
|
15087
|
+
let FormulaAlertRenderController = (_a16 = class extends Disposable {
|
|
15124
15088
|
constructor(_context, _hoverManagerService, _cellAlertManagerService, _localeService) {
|
|
15125
15089
|
super(), this._context = _context, this._hoverManagerService = _hoverManagerService, this._cellAlertManagerService = _cellAlertManagerService, this._localeService = _localeService, this._init();
|
|
15126
15090
|
}
|
|
@@ -15129,7 +15093,7 @@ let FormulaAlertRenderController = (_a15 = class extends Disposable {
|
|
|
15129
15093
|
}
|
|
15130
15094
|
_initCellAlertPopup() {
|
|
15131
15095
|
this.disposeWithMe(this._hoverManagerService.currentCell$.subscribe((cellPos) => {
|
|
15132
|
-
var
|
|
15096
|
+
var _a23;
|
|
15133
15097
|
if (cellPos) {
|
|
15134
15098
|
const worksheet = this._context.unit.getActiveSheet();
|
|
15135
15099
|
if (!worksheet) return;
|
|
@@ -15138,7 +15102,7 @@ let FormulaAlertRenderController = (_a15 = class extends Disposable {
|
|
|
15138
15102
|
const errorType = extractFormulaError(cellData);
|
|
15139
15103
|
if (!errorType)
|
|
15140
15104
|
return;
|
|
15141
|
-
const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (
|
|
15105
|
+
const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_a23 = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _a23.location;
|
|
15142
15106
|
if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
|
|
15143
15107
|
return;
|
|
15144
15108
|
this._cellAlertManagerService.showAlert({
|
|
@@ -15156,7 +15120,7 @@ let FormulaAlertRenderController = (_a15 = class extends Disposable {
|
|
|
15156
15120
|
this._cellAlertManagerService.removeAlert(ALERT_KEY);
|
|
15157
15121
|
}));
|
|
15158
15122
|
}
|
|
15159
|
-
}, __name(
|
|
15123
|
+
}, __name(_a16, "FormulaAlertRenderController"), _a16);
|
|
15160
15124
|
FormulaAlertRenderController = __decorateClass$4([
|
|
15161
15125
|
__decorateParam$4(1, Inject(HoverManagerService)),
|
|
15162
15126
|
__decorateParam$4(2, Inject(CellAlertManagerService)),
|
|
@@ -15173,8 +15137,8 @@ const FORMULA_ERROR_MARK = {
|
|
|
15173
15137
|
color: "#409f11"
|
|
15174
15138
|
}
|
|
15175
15139
|
};
|
|
15176
|
-
var
|
|
15177
|
-
let FormulaRenderManagerController = (
|
|
15140
|
+
var _a17;
|
|
15141
|
+
let FormulaRenderManagerController = (_a17 = class extends RxDisposable {
|
|
15178
15142
|
constructor(_sheetInterceptorService) {
|
|
15179
15143
|
super(), this._sheetInterceptorService = _sheetInterceptorService, this._init();
|
|
15180
15144
|
}
|
|
@@ -15193,7 +15157,7 @@ let FormulaRenderManagerController = (_a16 = class extends RxDisposable {
|
|
|
15193
15157
|
}
|
|
15194
15158
|
));
|
|
15195
15159
|
}
|
|
15196
|
-
}, __name(
|
|
15160
|
+
}, __name(_a17, "FormulaRenderManagerController"), _a17);
|
|
15197
15161
|
FormulaRenderManagerController = __decorateClass$3([
|
|
15198
15162
|
OnLifecycle(LifecycleStages.Rendered, FormulaRenderManagerController),
|
|
15199
15163
|
__decorateParam$3(0, Inject(SheetInterceptorService))
|
|
@@ -15202,8 +15166,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
|
15202
15166
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15203
15167
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
15204
15168
|
return kind && result && __defProp$2(target, key, result), result;
|
|
15205
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"),
|
|
15206
|
-
let RefSelectionsRenderService = (
|
|
15169
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a18;
|
|
15170
|
+
let RefSelectionsRenderService = (_a18 = class extends BaseSelectionRenderService {
|
|
15207
15171
|
constructor(_context, injector, themeService, shortcutService, renderManagerService, _refSelectionsService, _sheetSkeletonManagerService) {
|
|
15208
15172
|
super(
|
|
15209
15173
|
injector,
|
|
@@ -15235,14 +15199,13 @@ let RefSelectionsRenderService = (_a17 = class extends BaseSelectionRenderServic
|
|
|
15235
15199
|
return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), toDisposable(() => this._disableSelectionChanging());
|
|
15236
15200
|
}
|
|
15237
15201
|
_disableSelectionChanging() {
|
|
15238
|
-
var
|
|
15239
|
-
(
|
|
15202
|
+
var _a23;
|
|
15203
|
+
(_a23 = this._eventDisposables) == null || _a23.dispose(), this._eventDisposables = null;
|
|
15240
15204
|
}
|
|
15241
15205
|
_initCanvasEventListeners() {
|
|
15242
15206
|
const sheetObject = this._getSheetObject(), { spreadsheetRowHeader, spreadsheetColumnHeader, spreadsheet, spreadsheetLeftTopPlaceholder } = sheetObject, { scene } = this._context, listenerDisposables = new DisposableCollection();
|
|
15243
15207
|
return listenerDisposables.add(spreadsheet == null ? void 0 : spreadsheet.onPointerDown$.subscribeEvent((evt, state) => {
|
|
15244
|
-
|
|
15245
|
-
console.warn("debug start dragging", (_a22 = this._skeleton.worksheet) == null ? void 0 : _a22.getUnitId()), this._onPointerDown(evt, spreadsheet.zIndex + 1, RANGE_TYPE.NORMAL, this._getActiveViewport(evt)), evt.button !== 2 && state.stopPropagation();
|
|
15208
|
+
this._onPointerDown(evt, spreadsheet.zIndex + 1, RANGE_TYPE.NORMAL, this._getActiveViewport(evt)), evt.button !== 2 && state.stopPropagation();
|
|
15246
15209
|
})), listenerDisposables.add(
|
|
15247
15210
|
spreadsheetRowHeader == null ? void 0 : spreadsheetRowHeader.onPointerDown$.subscribeEvent((evt, state) => {
|
|
15248
15211
|
const skeleton = this._sheetSkeletonManagerService.getCurrent().skeleton, { row } = getCoordByOffset(evt.offsetX, evt.offsetY, scene, skeleton);
|
|
@@ -15297,7 +15260,7 @@ let RefSelectionsRenderService = (_a17 = class extends BaseSelectionRenderServic
|
|
|
15297
15260
|
_getSheetObject() {
|
|
15298
15261
|
return getSheetObject(this._context.unit, this._context);
|
|
15299
15262
|
}
|
|
15300
|
-
}, __name(
|
|
15263
|
+
}, __name(_a18, "RefSelectionsRenderService"), _a18);
|
|
15301
15264
|
RefSelectionsRenderService = __decorateClass$2([
|
|
15302
15265
|
__decorateParam$2(1, Inject(Injector)),
|
|
15303
15266
|
__decorateParam$2(2, Inject(ThemeService)),
|
|
@@ -15334,8 +15297,8 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
15334
15297
|
return kind && result && __defProp$1(target, key, result), result;
|
|
15335
15298
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
15336
15299
|
const sheetEditorUnitIds = [DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY];
|
|
15337
|
-
var
|
|
15338
|
-
let PromptController = (
|
|
15300
|
+
var _a19;
|
|
15301
|
+
let PromptController = (_a19 = class extends Disposable {
|
|
15339
15302
|
constructor(_commandService, _contextService, _textSelectionRenderManager, _editorBridgeService, _formulaPromptService, _lexerTreeBuilder, _renderManagerService, _themeService, _sheetsSelectionsService, _refSelectionsService, _univerInstanceService, _descriptionService, _textSelectionManagerService, _contextMenuService, _editorService) {
|
|
15340
15303
|
super();
|
|
15341
15304
|
__publicField(this, "_formulaRefColors", []);
|
|
@@ -15377,7 +15340,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15377
15340
|
this._previousSequenceNodes = null, this._previousInsertRefStringIndex = null, this._isSelectionMovingRefSelections = [], this._previousRangesCount = 0, this._currentInsertRefStringIndex = -1;
|
|
15378
15341
|
}
|
|
15379
15342
|
_initialize() {
|
|
15380
|
-
this._initialCursorSync(), this._initAcceptFormula(), this._initialFormulaTheme(), this._initSelectionsEndListener(), this.
|
|
15343
|
+
this._initialCursorSync(), this._initAcceptFormula(), this._initialFormulaTheme(), this._initSelectionsEndListener(), this._closeRangePromptWhenEditorInvisible(), this._initialEditorInputChange(), this._commandExecutedListener(), this._cursorStateListener(), this._userMouseListener(), this._initialChangeEditor();
|
|
15381
15344
|
}
|
|
15382
15345
|
_initialFormulaTheme() {
|
|
15383
15346
|
const style = this._themeService.getCurrentTheme();
|
|
@@ -15399,14 +15362,14 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15399
15362
|
_initialCursorSync() {
|
|
15400
15363
|
this.disposeWithMe(
|
|
15401
15364
|
this._textSelectionManagerService.textSelection$.subscribe((params) => {
|
|
15402
|
-
var
|
|
15365
|
+
var _a23;
|
|
15403
15366
|
if ((params == null ? void 0 : params.unitId) == null)
|
|
15404
15367
|
return;
|
|
15405
15368
|
const editor = this._editorService.getEditor(params.unitId);
|
|
15406
|
-
if (!editor || editor.onlyInputContent() || editor.isSheetEditor() && this.
|
|
15369
|
+
if (!editor || editor.onlyInputContent() || editor.isSheetEditor() && !this._isFormulaEditorActivated())
|
|
15407
15370
|
return;
|
|
15408
15371
|
const onlyInputRange = editor.onlyInputRange();
|
|
15409
|
-
(
|
|
15372
|
+
(_a23 = params == null ? void 0 : params.options) != null && _a23.fromSelection || (this._quitSelectingMode(), this._contextSwitch(), this._checkShouldEnterSelectingMode(onlyInputRange), !this._formulaPromptService.isLockedSelectionChange() && (this._highlightFormula(), !onlyInputRange && this._changeFunctionPanelState()));
|
|
15410
15373
|
})
|
|
15411
15374
|
);
|
|
15412
15375
|
}
|
|
@@ -15420,12 +15383,14 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15420
15383
|
})
|
|
15421
15384
|
);
|
|
15422
15385
|
}
|
|
15423
|
-
|
|
15386
|
+
_closeRangePromptWhenEditorInvisible() {
|
|
15424
15387
|
this.disposeWithMe(
|
|
15425
|
-
this._editorBridgeService.afterVisible$.subscribe((visibleParam) => {
|
|
15426
|
-
visibleParam.visible
|
|
15388
|
+
this._editorBridgeService.afterVisible$.pipe(distinctUntilKeyChanged("visible")).subscribe((visibleParam) => {
|
|
15389
|
+
visibleParam.visible || this._closeRangePrompt();
|
|
15427
15390
|
})
|
|
15428
|
-
)
|
|
15391
|
+
), this.disposeWithMe(this._contextService.subscribeContextValue$(FORMULA_EDITOR_ACTIVATED).pipe(distinctUntilChanged()).subscribe((activated) => {
|
|
15392
|
+
activated || this._closeRangePrompt();
|
|
15393
|
+
}));
|
|
15429
15394
|
}
|
|
15430
15395
|
_initialChangeEditor() {
|
|
15431
15396
|
this.disposeWithMe(
|
|
@@ -15477,8 +15442,8 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15477
15442
|
return this._currentlyWorkingRefRenderer && this._currentlyWorkingRefRenderer !== renderer ? (this._currentlyWorkingRefRenderer.clearLastSelection(), !1) : !0;
|
|
15478
15443
|
}
|
|
15479
15444
|
_disposeSelectionsChangeListeners() {
|
|
15480
|
-
var
|
|
15481
|
-
(
|
|
15445
|
+
var _a23;
|
|
15446
|
+
(_a23 = this._selectionsChangeDisposables) == null || _a23.dispose(), this._selectionsChangeDisposables = null;
|
|
15482
15447
|
}
|
|
15483
15448
|
_insertControlSelections(selections) {
|
|
15484
15449
|
const currentSelection = selections[selections.length - 1];
|
|
@@ -15497,7 +15462,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15497
15462
|
_initAcceptFormula() {
|
|
15498
15463
|
this.disposeWithMe(
|
|
15499
15464
|
this._formulaPromptService.acceptFormulaName$.subscribe((formulaString) => {
|
|
15500
|
-
const activeRange = this._textSelectionManagerService.
|
|
15465
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
15501
15466
|
if (activeRange == null) {
|
|
15502
15467
|
this._hideFunctionPanel();
|
|
15503
15468
|
return;
|
|
@@ -15524,7 +15489,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15524
15489
|
);
|
|
15525
15490
|
}
|
|
15526
15491
|
_changeFunctionPanelState() {
|
|
15527
|
-
const activeRange = this._textSelectionManagerService.
|
|
15492
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
15528
15493
|
if (activeRange == null) {
|
|
15529
15494
|
this._hideFunctionPanel();
|
|
15530
15495
|
return;
|
|
@@ -15587,7 +15552,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15587
15552
|
* @returns Return the character under the current cursor in the editor.
|
|
15588
15553
|
*/
|
|
15589
15554
|
_getCurrentChar() {
|
|
15590
|
-
const activeRange = this._textSelectionManagerService.
|
|
15555
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
15591
15556
|
if (activeRange == null)
|
|
15592
15557
|
return;
|
|
15593
15558
|
const { startOffset } = activeRange, config = this._getCurrentBodyDataStreamAndOffset();
|
|
@@ -15608,11 +15573,11 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15608
15573
|
this._isSelectingMode && (this._editorBridgeService.disableForceKeepVisible(), this._contextMenuService.enable(), this._formulaPromptService.disableLockedSelectionInsert(), this._currentInsertRefStringIndex = -1, this._disposeSelectionsChangeListeners(), this._arrowMoveActionState === 2 && (this._arrowMoveActionState = 4), this._isSelectingMode = !1);
|
|
15609
15574
|
}
|
|
15610
15575
|
_getCurrentBodyDataStreamAndOffset() {
|
|
15611
|
-
var
|
|
15576
|
+
var _a23, _b;
|
|
15612
15577
|
const documentModel = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
15613
15578
|
if (!(documentModel != null && documentModel.getBody()))
|
|
15614
15579
|
return;
|
|
15615
|
-
const unitId = documentModel.getUnitId(), editor = this._editorService.getEditor(unitId), dataStream = (_b = (
|
|
15580
|
+
const unitId = documentModel.getUnitId(), editor = this._editorService.getEditor(unitId), dataStream = (_b = (_a23 = documentModel.getBody()) == null ? void 0 : _a23.dataStream) != null ? _b : "";
|
|
15616
15581
|
return !editor || !editor.onlyInputRange() ? { dataStream, offset: 0 } : { dataStream: compareToken.EQUALS + dataStream, offset: 1 };
|
|
15617
15582
|
}
|
|
15618
15583
|
_getFormulaAndCellEditorBody(unitIds) {
|
|
@@ -15637,7 +15602,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15637
15602
|
this._contextService.setContextValue(FOCUSING_EDITOR_INPUT_FORMULA, !0), this._contextService.setContextValue(DISABLE_NORMAL_SELECTIONS, !0), this._contextService.setContextValue(UNI_DISABLE_CHANGING_FOCUS_KEY, !0);
|
|
15638
15603
|
const lastSequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(config.dataStream.replace(/\r/g, "").replace(/\n/g, "")) || [];
|
|
15639
15604
|
this._formulaPromptService.setSequenceNodes(lastSequenceNodes);
|
|
15640
|
-
const activeRange = this._textSelectionManagerService.
|
|
15605
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
15641
15606
|
if (activeRange == null)
|
|
15642
15607
|
return;
|
|
15643
15608
|
const { startOffset } = activeRange;
|
|
@@ -15671,10 +15636,10 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15671
15636
|
* Generate styles for formula text, highlighting references, text, numbers, and arrays.
|
|
15672
15637
|
*/
|
|
15673
15638
|
_buildTextRuns(sequenceNodes) {
|
|
15674
|
-
var
|
|
15639
|
+
var _a23;
|
|
15675
15640
|
const textRuns = [], refSelections = [], themeColorMap = /* @__PURE__ */ new Map();
|
|
15676
15641
|
let refColorIndex = 0;
|
|
15677
|
-
const offset = ((
|
|
15642
|
+
const offset = ((_a23 = this._getCurrentBodyDataStreamAndOffset()) == null ? void 0 : _a23.offset) || 0;
|
|
15678
15643
|
for (let i = 0, len = sequenceNodes.length; i < len; i++) {
|
|
15679
15644
|
const node = sequenceNodes[i];
|
|
15680
15645
|
if (typeof node == "string" || this._descriptionService.hasDefinedNameDescription(node.token.trim()))
|
|
@@ -15715,9 +15680,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15715
15680
|
* @param refSelections
|
|
15716
15681
|
*/
|
|
15717
15682
|
_refreshSelectionForReference(refSelectionRenderService, refSelections) {
|
|
15718
|
-
const
|
|
15719
|
-
this._getCurrentUnitIdAndSheetId();
|
|
15720
|
-
const worksheet = this._univerInstanceService.getUniverSheetInstance(unitId).getSheetBySheetId(sheetId);
|
|
15683
|
+
const { unitId, sheetId } = this._editorBridgeService.getEditCellState(), { unitId: selfUnitId, sheetId: selfSheetId } = this._getCurrentUnitIdAndSheetId(), isSelfSheet = sheetId === selfSheetId, worksheet = this._univerInstanceService.getUniverSheetInstance(unitId).getSheetBySheetId(sheetId);
|
|
15721
15684
|
let lastRange = null;
|
|
15722
15685
|
const selectionWithStyle = [];
|
|
15723
15686
|
for (let i = 0, len = refSelections.length; i < len; i++) {
|
|
@@ -15725,7 +15688,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15725
15688
|
if (refUnitId != null && refUnitId.length > 0 && unitId !== refUnitId)
|
|
15726
15689
|
continue;
|
|
15727
15690
|
const refSheetId = this._getSheetIdByName(unitId, sheetName.trim());
|
|
15728
|
-
if (sheetName.length !== 0 && refSheetId !== sheetId || this._exceedCurrentRange(range, worksheet.getRowCount(), worksheet.getColumnCount()))
|
|
15691
|
+
if (!isSelfSheet && refSheetId !== selfSheetId || isSelfSheet && sheetName.length !== 0 && refSheetId !== sheetId || this._exceedCurrentRange(range, worksheet.getRowCount(), worksheet.getColumnCount()))
|
|
15729
15692
|
continue;
|
|
15730
15693
|
const lastRangeCopy = this._getPrimary(range, themeColor, refIndex);
|
|
15731
15694
|
if (lastRangeCopy) {
|
|
@@ -15742,11 +15705,11 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15742
15705
|
lastRange && selectionWithStyle.push(lastRange), selectionWithStyle.length && this._refSelectionsService.addSelections(unitId, sheetId, selectionWithStyle);
|
|
15743
15706
|
}
|
|
15744
15707
|
_getPrimary(range, themeColor, refIndex) {
|
|
15745
|
-
var
|
|
15746
|
-
const primary = (
|
|
15708
|
+
var _a23;
|
|
15709
|
+
const primary = (_a23 = this._insertSelections.find((selection) => {
|
|
15747
15710
|
const { startRow, startColumn, endRow, endColumn } = selection.range;
|
|
15748
15711
|
return startRow === range.startRow && startColumn === range.startColumn && endRow === range.endRow && endColumn === range.endColumn || startRow === range.startRow && startColumn === range.startColumn && range.startRow === range.endRow && range.startColumn === range.endColumn;
|
|
15749
|
-
})) == null ? void 0 :
|
|
15712
|
+
})) == null ? void 0 : _a23.primary;
|
|
15750
15713
|
if (primary == null)
|
|
15751
15714
|
return;
|
|
15752
15715
|
const {
|
|
@@ -15764,18 +15727,18 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15764
15727
|
};
|
|
15765
15728
|
}
|
|
15766
15729
|
_getSheetIdByName(unitId, sheetName) {
|
|
15767
|
-
var
|
|
15730
|
+
var _a23;
|
|
15768
15731
|
const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
|
|
15769
|
-
return (
|
|
15732
|
+
return (_a23 = workbook == null ? void 0 : workbook.getSheetBySheetName(normalizeSheetName(sheetName))) == null ? void 0 : _a23.getSheetId();
|
|
15770
15733
|
}
|
|
15771
15734
|
_getSheetNameById(unitId, sheetId) {
|
|
15772
|
-
var
|
|
15735
|
+
var _a23;
|
|
15773
15736
|
const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
|
|
15774
|
-
return ((
|
|
15737
|
+
return ((_a23 = workbook == null ? void 0 : workbook.getSheetBySheetId(sheetId)) == null ? void 0 : _a23.getName()) || "";
|
|
15775
15738
|
}
|
|
15776
15739
|
_getCurrentUnitIdAndSheetId() {
|
|
15777
|
-
var
|
|
15778
|
-
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet(), skeleton = (_b = (
|
|
15740
|
+
var _a23, _b;
|
|
15741
|
+
const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET), worksheet = workbook.getActiveSheet(), skeleton = (_b = (_a23 = this._renderManagerService.getRenderById(workbook.getUnitId())) == null ? void 0 : _a23.with(SheetSkeletonManagerService)) == null ? void 0 : _b.getCurrentSkeleton();
|
|
15779
15742
|
return {
|
|
15780
15743
|
unitId: workbook.getUnitId(),
|
|
15781
15744
|
sheetId: (worksheet == null ? void 0 : worksheet.getSheetId()) || "",
|
|
@@ -15840,7 +15803,7 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15840
15803
|
let dataStream = generateStringWithSequence(sequenceNodes);
|
|
15841
15804
|
const { textRuns, refSelections } = this._buildTextRuns(sequenceNodes);
|
|
15842
15805
|
this._isSelectionMovingRefSelections = refSelections;
|
|
15843
|
-
const activeRange = this._textSelectionManagerService.
|
|
15806
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
15844
15807
|
if (activeRange == null)
|
|
15845
15808
|
return;
|
|
15846
15809
|
const { collapsed, style } = activeRange;
|
|
@@ -15893,11 +15856,11 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15893
15856
|
* @param textRuns
|
|
15894
15857
|
*/
|
|
15895
15858
|
_updateEditorModel(dataStream, textRuns) {
|
|
15896
|
-
var
|
|
15859
|
+
var _a23;
|
|
15897
15860
|
const documentDataModel = this._univerInstanceService.getCurrentUniverDocInstance(), editorUnitId = documentDataModel.getUnitId();
|
|
15898
15861
|
if (!this._editorService.isEditor(editorUnitId))
|
|
15899
15862
|
return;
|
|
15900
|
-
const docViewModel = (
|
|
15863
|
+
const docViewModel = (_a23 = this._renderManagerService.getRenderById(editorUnitId)) == null ? void 0 : _a23.with(DocSkeletonManagerService).getViewModel();
|
|
15901
15864
|
if (docViewModel == null || documentDataModel == null)
|
|
15902
15865
|
return;
|
|
15903
15866
|
const snapshot = documentDataModel == null ? void 0 : documentDataModel.getSnapshot();
|
|
@@ -15959,10 +15922,10 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
15959
15922
|
}
|
|
15960
15923
|
}
|
|
15961
15924
|
_onSelectionControlChange(toRange, selectionControl) {
|
|
15962
|
-
var
|
|
15925
|
+
var _a23;
|
|
15963
15926
|
const { skeleton } = this._getCurrentUnitIdAndSheetId();
|
|
15964
15927
|
this._formulaPromptService.enableLockedSelectionChange();
|
|
15965
|
-
const id = (
|
|
15928
|
+
const id = (_a23 = selectionControl.selectionStyle) == null ? void 0 : _a23.id;
|
|
15966
15929
|
if (!id || !Tools.isStringNumber(id))
|
|
15967
15930
|
return;
|
|
15968
15931
|
let { startRow, endRow, startColumn, endColumn } = toRange;
|
|
@@ -16002,10 +15965,10 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
16002
15965
|
typeof node != "string" && (this._syncToEditor(sequenceNodes, node.endIndex + 1), selectionControl.update(toRange, void 0, void 0, void 0, this._selectionRenderService.attachPrimaryWithCoord(primary)));
|
|
16003
15966
|
}
|
|
16004
15967
|
_refreshFormulaAndCellEditor(unitIds) {
|
|
16005
|
-
var
|
|
15968
|
+
var _a23;
|
|
16006
15969
|
for (const unitId of unitIds) {
|
|
16007
15970
|
const editorObject = getEditorObject(unitId, this._renderManagerService), documentComponent = editorObject == null ? void 0 : editorObject.document;
|
|
16008
|
-
documentComponent != null && ((
|
|
15971
|
+
documentComponent != null && ((_a23 = documentComponent.getSkeleton()) == null || _a23.calculate(), documentComponent.makeDirty());
|
|
16009
15972
|
}
|
|
16010
15973
|
}
|
|
16011
15974
|
_cursorStateListener() {
|
|
@@ -16144,31 +16107,8 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
16144
16107
|
this._userCursorMove = !0;
|
|
16145
16108
|
}));
|
|
16146
16109
|
}
|
|
16147
|
-
_inputFormulaListener() {
|
|
16148
|
-
this.disposeWithMe(
|
|
16149
|
-
this._editorService.inputFormula$.subscribe((param) => {
|
|
16150
|
-
const { formulaString, editorUnitId } = param;
|
|
16151
|
-
if (formulaString.substring(0, 1) !== compareToken.EQUALS)
|
|
16152
|
-
return;
|
|
16153
|
-
this._editorBridgeService.isVisible().visible === !1 && this._editorBridgeService.changeVisible({
|
|
16154
|
-
visible: !0,
|
|
16155
|
-
eventType: DeviceInputEventType.Dblclick,
|
|
16156
|
-
unitId: ""
|
|
16157
|
-
});
|
|
16158
|
-
const lastSequenceNodes = this._lexerTreeBuilder.sequenceNodesBuilder(formulaString) || [];
|
|
16159
|
-
this._formulaPromptService.setSequenceNodes(lastSequenceNodes), this._syncToEditor(lastSequenceNodes, formulaString.length - 1, editorUnitId, !0, !1);
|
|
16160
|
-
})
|
|
16161
|
-
), this.disposeWithMe(
|
|
16162
|
-
// TODO: unfinished
|
|
16163
|
-
this._editorService.singleSelection$.subscribe((state) => {
|
|
16164
|
-
})
|
|
16165
|
-
);
|
|
16166
|
-
}
|
|
16167
|
-
/**
|
|
16168
|
-
* Absolute range, triggered by F4
|
|
16169
|
-
*/
|
|
16170
16110
|
_changeRefString() {
|
|
16171
|
-
const activeRange = this._textSelectionManagerService.
|
|
16111
|
+
const activeRange = this._textSelectionManagerService.getActiveTextRangeWithStyle();
|
|
16172
16112
|
if (activeRange == null)
|
|
16173
16113
|
return;
|
|
16174
16114
|
const { startOffset } = activeRange, strIndex = startOffset - 2, nodeIndex = this._formulaPromptService.getCurrentSequenceNodeIndex(strIndex), node = this._formulaPromptService.getCurrentSequenceNodeByIndex(nodeIndex);
|
|
@@ -16208,7 +16148,13 @@ let PromptController = (_a18 = class extends Disposable {
|
|
|
16208
16148
|
const editorUnitId = this._univerInstanceService.getCurrentUniverDocInstance().getUnitId(), editor = this._editorService.getEditor(editorUnitId);
|
|
16209
16149
|
return editor == null ? void 0 : editor.render;
|
|
16210
16150
|
}
|
|
16211
|
-
|
|
16151
|
+
_isFormulaEditorActivated() {
|
|
16152
|
+
return this._editorBridgeService.isVisible().visible === !0 || this._contextService.getContextValue(FORMULA_EDITOR_ACTIVATED);
|
|
16153
|
+
}
|
|
16154
|
+
_isSheetOrFormulaEditor(editor) {
|
|
16155
|
+
return editor.isSheetEditor() || editor.isFormulaEditor();
|
|
16156
|
+
}
|
|
16157
|
+
}, __name(_a19, "PromptController"), _a19);
|
|
16212
16158
|
PromptController = __decorateClass$1([
|
|
16213
16159
|
OnLifecycle(LifecycleStages.Steady, PromptController),
|
|
16214
16160
|
__decorateParam$1(0, ICommandService),
|
|
@@ -16231,8 +16177,8 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
|
16231
16177
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16232
16178
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
16233
16179
|
return kind && result && __defProp2(target, key, result), result;
|
|
16234
|
-
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"),
|
|
16235
|
-
let UniverRemoteSheetsFormulaPlugin = (
|
|
16180
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a20;
|
|
16181
|
+
let UniverRemoteSheetsFormulaPlugin = (_a20 = class extends Plugin {
|
|
16236
16182
|
constructor(_config = {}, _injector) {
|
|
16237
16183
|
super(), this._config = _config, this._injector = _injector;
|
|
16238
16184
|
}
|
|
@@ -16242,15 +16188,15 @@ let UniverRemoteSheetsFormulaPlugin = (_a19 = class extends Plugin {
|
|
|
16242
16188
|
fromModule(this._injector.get(RemoteRegisterFunctionService))
|
|
16243
16189
|
);
|
|
16244
16190
|
}
|
|
16245
|
-
}, __name(
|
|
16191
|
+
}, __name(_a20, "UniverRemoteSheetsFormulaPlugin"), _a20);
|
|
16246
16192
|
__publicField2(UniverRemoteSheetsFormulaPlugin, "pluginName", "SHEETS_FORMULA_REMOTE_PLUGIN");
|
|
16247
16193
|
__publicField2(UniverRemoteSheetsFormulaPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
16248
16194
|
UniverRemoteSheetsFormulaPlugin = __decorateClass([
|
|
16249
16195
|
DependentOn(UniverFormulaEnginePlugin),
|
|
16250
16196
|
__decorateParam(1, Inject(Injector))
|
|
16251
16197
|
], UniverRemoteSheetsFormulaPlugin);
|
|
16252
|
-
var
|
|
16253
|
-
let UniverSheetsFormulaPlugin = (
|
|
16198
|
+
var _a21;
|
|
16199
|
+
let UniverSheetsFormulaPlugin = (_a21 = class extends Plugin {
|
|
16254
16200
|
constructor(_config = {}, _injector, _renderManagerService) {
|
|
16255
16201
|
super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._config = Tools.deepMerge({}, DefaultSheetFormulaConfig, this._config);
|
|
16256
16202
|
}
|
|
@@ -16259,8 +16205,8 @@ let UniverSheetsFormulaPlugin = (_a20 = class extends Plugin {
|
|
|
16259
16205
|
[IFormulaPromptService, { useClass: FormulaPromptService }],
|
|
16260
16206
|
[IRefSelectionsService, { useClass: RefSelectionsService }],
|
|
16261
16207
|
[IDescriptionService, { useFactory: /* @__PURE__ */ __name(() => {
|
|
16262
|
-
var
|
|
16263
|
-
return j.createInstance(DescriptionService, (
|
|
16208
|
+
var _a23;
|
|
16209
|
+
return j.createInstance(DescriptionService, (_a23 = this._config) == null ? void 0 : _a23.description);
|
|
16264
16210
|
}, "useFactory") }],
|
|
16265
16211
|
[IRegisterFunctionService, { useClass: RegisterFunctionService }],
|
|
16266
16212
|
[FormulaRefRangeService],
|
|
@@ -16293,7 +16239,7 @@ let UniverSheetsFormulaPlugin = (_a20 = class extends Plugin {
|
|
|
16293
16239
|
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SHEET, dep));
|
|
16294
16240
|
});
|
|
16295
16241
|
}
|
|
16296
|
-
}, __name(
|
|
16242
|
+
}, __name(_a21, "UniverSheetsFormulaPlugin"), _a21);
|
|
16297
16243
|
__publicField2(UniverSheetsFormulaPlugin, "pluginName", FORMULA_UI_PLUGIN_NAME);
|
|
16298
16244
|
__publicField2(UniverSheetsFormulaPlugin, "type", UniverInstanceType.UNIVER_SHEET);
|
|
16299
16245
|
UniverSheetsFormulaPlugin = __decorateClass([
|
|
@@ -16301,8 +16247,8 @@ UniverSheetsFormulaPlugin = __decorateClass([
|
|
|
16301
16247
|
__decorateParam(1, Inject(Injector)),
|
|
16302
16248
|
__decorateParam(2, IRenderManagerService)
|
|
16303
16249
|
], UniverSheetsFormulaPlugin);
|
|
16304
|
-
var
|
|
16305
|
-
let UniverSheetsFormulaMobilePlugin = (
|
|
16250
|
+
var _a22;
|
|
16251
|
+
let UniverSheetsFormulaMobilePlugin = (_a22 = class extends Plugin {
|
|
16306
16252
|
constructor(_config = {}, _injector) {
|
|
16307
16253
|
super(), this._config = _config, this._injector = _injector, this._config = Tools.deepMerge({}, DefaultSheetFormulaConfig, this._config);
|
|
16308
16254
|
}
|
|
@@ -16317,8 +16263,8 @@ let UniverSheetsFormulaMobilePlugin = (_a21 = class extends Plugin {
|
|
|
16317
16263
|
IDescriptionService,
|
|
16318
16264
|
{
|
|
16319
16265
|
useFactory: /* @__PURE__ */ __name(() => {
|
|
16320
|
-
var
|
|
16321
|
-
return this._injector.createInstance(DescriptionService, (
|
|
16266
|
+
var _a23;
|
|
16267
|
+
return this._injector.createInstance(DescriptionService, (_a23 = this._config) == null ? void 0 : _a23.description);
|
|
16322
16268
|
}, "useFactory")
|
|
16323
16269
|
}
|
|
16324
16270
|
],
|
|
@@ -16334,12 +16280,13 @@ let UniverSheetsFormulaMobilePlugin = (_a21 = class extends Plugin {
|
|
|
16334
16280
|
[FormulaRenderManagerController]
|
|
16335
16281
|
].forEach((dependency) => this._injector.add(dependency));
|
|
16336
16282
|
}
|
|
16337
|
-
}, __name(
|
|
16283
|
+
}, __name(_a22, "UniverSheetsFormulaMobilePlugin"), __publicField(_a22, "pluginName", FORMULA_UI_PLUGIN_NAME), __publicField(_a22, "type", UniverInstanceType.UNIVER_SHEET), _a22);
|
|
16338
16284
|
UniverSheetsFormulaMobilePlugin = __decorateClass([
|
|
16339
16285
|
__decorateParam(1, Inject(Injector))
|
|
16340
16286
|
], UniverSheetsFormulaMobilePlugin);
|
|
16341
16287
|
export {
|
|
16342
16288
|
DescriptionService,
|
|
16289
|
+
FORMULA_PROMPT_ACTIVATED,
|
|
16343
16290
|
FormulaRefRangeService,
|
|
16344
16291
|
HelpFunctionOperation,
|
|
16345
16292
|
IDescriptionService,
|