@univerjs/sheets-formula-ui 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +5 -5
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +1518 -1559
- package/lib/es/locale/ca-ES.js +1 -6
- package/lib/es/locale/en-US.js +1 -6
- package/lib/es/locale/es-ES.js +1 -6
- package/lib/es/locale/fa-IR.js +1 -6
- package/lib/es/locale/fr-FR.js +1 -6
- package/lib/es/locale/ja-JP.js +1 -6
- package/lib/es/locale/ko-KR.js +1 -6
- package/lib/es/locale/ru-RU.js +1 -6
- package/lib/es/locale/sk-SK.js +1 -6
- package/lib/es/locale/vi-VN.js +1 -6
- package/lib/es/locale/zh-CN.js +1 -6
- package/lib/es/locale/zh-TW.js +1 -6
- package/lib/index.js +1518 -1559
- package/lib/locale/ca-ES.js +1 -6
- package/lib/locale/en-US.js +1 -6
- package/lib/locale/es-ES.js +1 -6
- package/lib/locale/fa-IR.js +1 -6
- package/lib/locale/fr-FR.js +1 -6
- package/lib/locale/ja-JP.js +1 -6
- package/lib/locale/ko-KR.js +1 -6
- package/lib/locale/ru-RU.js +1 -6
- package/lib/locale/sk-SK.js +1 -6
- package/lib/locale/vi-VN.js +1 -6
- package/lib/locale/zh-CN.js +1 -6
- package/lib/locale/zh-TW.js +1 -6
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/en-US.d.ts +1 -6
- package/lib/types/menu/menu.d.ts +16 -0
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +5 -5
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
- package/lib/types/controllers/formula-auto-fill.controller.d.ts +0 -10
- package/lib/types/controllers/menu.d.ts +0 -12
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
- /package/lib/types/{controllers/menu.schema.d.ts → menu/schema.d.ts} +0 -0
package/lib/es/index.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var j = (e, t, n) =>
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { ISheetClipboardService as
|
|
6
|
-
import { sequenceNodeType as Q, serializeRange as
|
|
7
|
-
import { Subject as
|
|
8
|
-
import { IEditorService as
|
|
9
|
-
import { DeviceInputEventType as
|
|
10
|
-
import { SheetsSelectionsService as
|
|
11
|
-
import { InsertFunctionCommand as
|
|
12
|
-
import { ISidebarService as
|
|
13
|
-
import { jsx as x, jsxs as
|
|
14
|
-
import { useCallback as
|
|
15
|
-
import { clsx as
|
|
16
|
-
import { DocSelectionManagerService as
|
|
17
|
-
import { debounceTime as
|
|
18
|
-
const
|
|
1
|
+
var Zr = Object.defineProperty;
|
|
2
|
+
var Xr = (e, t, n) => t in e ? Zr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var j = (e, t, n) => Xr(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { CommandType as ye, ICommandService as ve, createIdentifier as Qr, IContextService as ln, IUniverInstanceService as re, Rectangle as un, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as dn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as er, DEFAULT_EMPTY_DOCUMENT_VALUE as tr, isRealNum as Jr, CellValueType as An, getCellValueType as eo, Inject as q, Disposable as at, ObjectMatrix as Pe, Range as to, Tools as nr, LocaleService as lt, isICellData as no, Injector as Rt, getEmptyCell as gt, isFormulaString as Fe, isFormulaId as st, UniverInstanceType as B, generateRandomId as hn, ThemeService as It, ILogService as ro, toDisposable as rr, ColorKit as fn, RxDisposable as oo, InterceptorEffectEnum as so, IConfigService as gn, FOCUSING_DOC as io, FOCUSING_UNIVER_EDITOR as co, DisposableCollection as Ye, RANGE_TYPE as Ee, getBodySlice as Dn, Direction as xe, EDITOR_ACTIVATED as Ln, createInternalEditorID as ao, BuildTextUtils as lo, RichTextBuilder as uo, DependentOn as ho, Plugin as fo, merge as go, registerDependencies as mo, touchDependencies as po } from "@univerjs/core";
|
|
5
|
+
import { ISheetClipboardService as or, PREDEFINED_HOOK_NAME_COPY as sr, SheetPasteCommand as So, PREDEFINED_HOOK_NAME_PASTE as rt, IEditorBridgeService as mn, SetCellEditVisibleOperation as ir, HoverManagerService as vo, CellAlertManagerService as Co, CellAlertType as _o, COPY_TYPE as cr, SheetSkeletonManagerService as Et, attachSelectionWithCoord as rn, SelectionControl as ar, SELECTION_SHAPE_DEPTH as Ro, menuClipboardDisabledObservable as Io, getCurrentRangeDisable$ as pn, PASTE_SPECIAL_MENU_ID as Eo, COPY_SPECIAL_MENU_ID as bo, useActiveWorkbook as yo, whenFormulaEditorActivated as bt, whenSheetEditorFocused as To, SheetsUIPart as Oo, BaseSelectionRenderService as No, getCoordByOffset as $n, checkInHeaderRanges as Pn, getAllSelection as Mo, genNormalSelectionStyle as lr, getSheetObject as xo, MoveSelectionCommand as Un, JumpOver as Wn, ExpandSelectionCommand as Vn, EMBEDDING_FORMULA_EDITOR as wo, IMarkSelectionService as Fo, RANGE_SELECTOR_COMPONENT_KEY as ko, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as Ao } from "@univerjs/sheets-ui";
|
|
6
|
+
import { sequenceNodeType as Q, serializeRange as be, FormulaDataModel as yt, LexerTreeBuilder as ke, ErrorType as de, extractFormulaError as ur, SetFormulaCalculationResultMutation as Do, SetArrayFormulaDataMutation as Lo, FunctionType as fe, SetFormulaCalculationStopMutation as $o, matchToken as Ge, deserializeRangeWithSheetWithCache as Po, matchRefDrawToken as Uo, isFormulaLexerToken as Wo, deserializeRangeWithSheet as ut, serializeRangeToRefString as Vo, serializeRangeWithSheet as Ct, serializeRangeWithSpreadsheet as Ho, generateStringWithSequence as Bo, operatorToken as dr } from "@univerjs/engine-formula";
|
|
7
|
+
import { Subject as mt, debounceTime as Sn, combineLatestWith as qo, map as hr, BehaviorSubject as fr, throttleTime as jo, filter as gr, distinctUntilChanged as Ko, merge as Yo } from "rxjs";
|
|
8
|
+
import { IEditorService as ze, DocSelectionRenderService as mr, ReplaceTextRunsCommand as Hn, MoveSelectionOperation as Go, MoveCursorOperation as zo, useKeyboardEvent as Zo, useResize as Xo, DocBackScrollRenderController as Qo, RichTextEditor as Jo } from "@univerjs/docs-ui";
|
|
9
|
+
import { DeviceInputEventType as Ae, IRenderManagerService as Te, ScrollTimerType as Qt, SHEET_VIEWPORT_KEY as Bn, Vector2 as qn } from "@univerjs/engine-render";
|
|
10
|
+
import { SheetsSelectionsService as vn, getSheetCommandTarget as pr, getCellAtRowCol as es, SetSelectionsOperation as Cn, SheetInterceptorService as _n, ReorderRangeCommand as ts, SetRangeValuesMutation as $t, SetRangeValuesUndoMutationFactory as ns, BEFORE_CELL_EDIT as rs, SetWorksheetRowAutoHeightMutation as os, INTERCEPTOR_POINT as ss, WorksheetSetCellValuePermission as Sr, WorksheetEditPermission as vr, RangeProtectionPermissionEditPoint as Cr, WorkbookEditablePermission as _r, RangeProtectionPermissionViewPoint as is, WorksheetCopyPermission as cs, WorkbookCopyPermission as as, IRefSelectionsService as Kt, SelectionMoveType as Jt, convertSelectionDataToRange as ls, setEndForRange as us, REF_SELECTIONS_ENABLED as jn, SetWorksheetActiveOperation as Kn } from "@univerjs/sheets";
|
|
11
|
+
import { InsertFunctionCommand as ds, IDescriptionService as dt, TriggerCalculationController as hs, PLUGIN_CONFIG_KEY_BASE as fs, QuickSumCommand as gs, ImageFormulaCellInterceptorController as ms, UniverSheetsFormulaPlugin as ps } from "@univerjs/sheets-formula";
|
|
12
|
+
import { ISidebarService as Rn, IZenZoneService as Ss, getMenuHiddenObservable as Tt, MenuItemType as Ot, RibbonFormulasGroup as vs, useDependency as b, useObservable as Re, ProgressBar as Cs, KeyCode as L, MetaKeys as W, IMenuManagerService as _s, IShortcutService as Yt, IUIPartsService as Rr, ComponentManager as Ir, connectInjector as Er, useEvent as ee, RectPopup as on, IContextMenuService as Rs, useUpdateEffect as Is, BuiltInUIPart as Es } from "@univerjs/ui";
|
|
13
|
+
import { jsx as x, jsxs as H, Fragment as bs } from "react/jsx-runtime";
|
|
14
|
+
import { useCallback as Pt, useState as V, useRef as X, createElement as Ze, forwardRef as We, useEffect as P, useMemo as le, useLayoutEffect as Ut, useImperativeHandle as ys } from "react";
|
|
15
|
+
import { clsx as ie, scrollbarClassName as it, borderLeftClassName as Ts, Select as Os, Input as br, borderClassName as In, Button as ot, borderTopClassName as Ns, Tooltip as Ms, Dialog as xs } from "@univerjs/design";
|
|
16
|
+
import { DocSelectionManagerService as yr } from "@univerjs/docs";
|
|
17
|
+
import { debounceTime as ws } from "rxjs/operators";
|
|
18
|
+
const En = {
|
|
19
19
|
id: "sheet.command.copy-formula-only",
|
|
20
|
-
type:
|
|
21
|
-
handler: async (e) => e.get(
|
|
22
|
-
copyHookType:
|
|
20
|
+
type: ye.COMMAND,
|
|
21
|
+
handler: async (e) => e.get(or).copy({
|
|
22
|
+
copyHookType: sr.SPECIAL_COPY_FORMULA_ONLY
|
|
23
23
|
})
|
|
24
|
-
},
|
|
24
|
+
}, bn = {
|
|
25
25
|
id: "sheet.command.paste-formula",
|
|
26
|
-
type:
|
|
27
|
-
handler: async (e) => e.get(
|
|
28
|
-
value:
|
|
26
|
+
type: ye.COMMAND,
|
|
27
|
+
handler: async (e) => e.get(ve).executeCommand(So.id, {
|
|
28
|
+
value: rt.SPECIAL_PASTE_FORMULA
|
|
29
29
|
})
|
|
30
|
-
},
|
|
30
|
+
}, ht = {
|
|
31
31
|
id: "formula-ui.operation.select-editor-formula",
|
|
32
|
-
type:
|
|
32
|
+
type: ye.OPERATION,
|
|
33
33
|
handler: (e, t) => !0
|
|
34
34
|
};
|
|
35
|
-
var Fs = Object.getOwnPropertyDescriptor,
|
|
35
|
+
var Fs = Object.getOwnPropertyDescriptor, ks = (e, t, n, o) => {
|
|
36
36
|
for (var r = o > 1 ? void 0 : o ? Fs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
37
37
|
(i = e[s]) && (r = i(r) || r);
|
|
38
38
|
return r;
|
|
39
|
-
},
|
|
40
|
-
const
|
|
41
|
-
let
|
|
39
|
+
}, As = (e, t) => (n, o) => t(n, o, e);
|
|
40
|
+
const Ds = "FORMULA_PROMPT_ACTIVATED", Gt = Qr("formula-ui.prompt-service");
|
|
41
|
+
let sn = class {
|
|
42
42
|
constructor(e) {
|
|
43
|
-
j(this, "_search$", new
|
|
44
|
-
j(this, "_help$", new
|
|
45
|
-
j(this, "_navigate$", new
|
|
46
|
-
j(this, "_accept$", new
|
|
47
|
-
j(this, "_acceptFormulaName$", new
|
|
43
|
+
j(this, "_search$", new mt());
|
|
44
|
+
j(this, "_help$", new mt());
|
|
45
|
+
j(this, "_navigate$", new mt());
|
|
46
|
+
j(this, "_accept$", new mt());
|
|
47
|
+
j(this, "_acceptFormulaName$", new mt());
|
|
48
48
|
j(this, "search$", this._search$.asObservable());
|
|
49
49
|
j(this, "help$", this._help$.asObservable());
|
|
50
50
|
j(this, "navigate$", this._navigate$.asObservable());
|
|
@@ -61,7 +61,7 @@ let an = class {
|
|
|
61
61
|
this._search$.complete(), this._help$.complete(), this._navigate$.complete(), this._accept$.complete(), this._acceptFormulaName$.complete(), this._sequenceNodes = [];
|
|
62
62
|
}
|
|
63
63
|
search(e) {
|
|
64
|
-
this._contextService.setContextValue(
|
|
64
|
+
this._contextService.setContextValue(Ds, e.visible), this._searching = e.visible, this._search$.next(e);
|
|
65
65
|
}
|
|
66
66
|
isSearching() {
|
|
67
67
|
return this._searching;
|
|
@@ -193,86 +193,86 @@ let an = class {
|
|
|
193
193
|
return this._isLockedOnSelectionInsertRefString;
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
],
|
|
199
|
-
const
|
|
196
|
+
sn = ks([
|
|
197
|
+
As(0, ln)
|
|
198
|
+
], sn);
|
|
199
|
+
const Ls = {
|
|
200
200
|
id: "formula-ui.operation.help-function",
|
|
201
|
-
type:
|
|
202
|
-
handler: async (e, t) => (e.get(
|
|
203
|
-
},
|
|
201
|
+
type: ye.OPERATION,
|
|
202
|
+
handler: async (e, t) => (e.get(Gt).help(t), !0)
|
|
203
|
+
}, ne = {
|
|
204
204
|
id: "formula-ui.operation.insert-function",
|
|
205
|
-
type:
|
|
205
|
+
type: ye.OPERATION,
|
|
206
206
|
// eslint-disable-next-line
|
|
207
207
|
handler: async (e, t) => {
|
|
208
|
-
var C,
|
|
209
|
-
const n = e.get(
|
|
208
|
+
var C, I;
|
|
209
|
+
const n = e.get(vn), o = e.get(ze), r = n.getCurrentSelections();
|
|
210
210
|
if (!r || !r.length)
|
|
211
211
|
return !1;
|
|
212
|
-
const s =
|
|
212
|
+
const s = pr(e.get(re));
|
|
213
213
|
if (!s) return !1;
|
|
214
|
-
const { worksheet: i, unitId: c, subUnitId: a } = s,
|
|
215
|
-
e.get(
|
|
216
|
-
const u = [],
|
|
217
|
-
let l = null, S = 0, v = 0,
|
|
218
|
-
if (r.length === 1 && (
|
|
219
|
-
const { range: E, primary:
|
|
220
|
-
l = E, S =
|
|
221
|
-
const
|
|
222
|
-
|
|
214
|
+
const { worksheet: i, unitId: c, subUnitId: a } = s, h = i.getCellMatrix(), { value: g } = t, p = e.get(ve);
|
|
215
|
+
e.get(mn);
|
|
216
|
+
const u = [], d = [];
|
|
217
|
+
let l = null, S = 0, v = 0, f = "";
|
|
218
|
+
if (r.length === 1 && (Us(r[0].range) || Ws(r[0].range) && Gn(h, r[0].range))) {
|
|
219
|
+
const { range: E, primary: m } = r[0], y = (C = m == null ? void 0 : m.actualRow) != null ? C : E.startRow, T = (I = m == null ? void 0 : m.actualColumn) != null ? I : E.startColumn;
|
|
220
|
+
l = E, S = y, v = T;
|
|
221
|
+
const A = Yn(h, y, T);
|
|
222
|
+
A && (f = be(A));
|
|
223
223
|
} else
|
|
224
224
|
r.some((E) => {
|
|
225
|
-
var T,
|
|
226
|
-
const { range:
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
225
|
+
var T, A;
|
|
226
|
+
const { range: m, primary: y } = E;
|
|
227
|
+
if (Gn(h, m)) {
|
|
228
|
+
const k = (T = y == null ? void 0 : y.actualRow) != null ? T : m.startRow, N = (A = y == null ? void 0 : y.actualColumn) != null ? A : m.startColumn, M = Yn(h, k, N);
|
|
229
229
|
if (!M)
|
|
230
|
-
return l =
|
|
231
|
-
const w =
|
|
230
|
+
return l = m, S = k, v = N, !0;
|
|
231
|
+
const w = be(M), F = `=${g}(${w})`;
|
|
232
232
|
u.push({
|
|
233
|
-
range:
|
|
233
|
+
range: m,
|
|
234
234
|
primary: {
|
|
235
|
-
row:
|
|
235
|
+
row: k,
|
|
236
236
|
column: N
|
|
237
237
|
},
|
|
238
|
-
formula:
|
|
238
|
+
formula: F
|
|
239
239
|
});
|
|
240
240
|
} else {
|
|
241
|
-
const { startRow:
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
startRow:
|
|
241
|
+
const { startRow: k, startColumn: N, endRow: M, endColumn: w } = m;
|
|
242
|
+
if (k === M) {
|
|
243
|
+
const F = Vs(h, k, w, i.getColumnCount() - 1), $ = F === w ? w - 1 : w, R = be({
|
|
244
|
+
startRow: k,
|
|
245
245
|
endRow: M,
|
|
246
246
|
startColumn: N,
|
|
247
247
|
endColumn: $
|
|
248
|
-
}), _ = `=${
|
|
249
|
-
|
|
250
|
-
range:
|
|
248
|
+
}), _ = `=${g}(${R})`;
|
|
249
|
+
d.push({
|
|
250
|
+
range: m,
|
|
251
251
|
primary: {
|
|
252
|
-
row:
|
|
253
|
-
column:
|
|
252
|
+
row: k,
|
|
253
|
+
column: F
|
|
254
254
|
},
|
|
255
255
|
formula: _
|
|
256
256
|
});
|
|
257
257
|
} else {
|
|
258
|
-
let
|
|
259
|
-
for (let
|
|
260
|
-
const _ =
|
|
261
|
-
|
|
258
|
+
let F = -1;
|
|
259
|
+
for (let R = N; R <= w; R++) {
|
|
260
|
+
const _ = Hs(h, R, M, i.getRowCount() - 1);
|
|
261
|
+
F = Math.max(F, _);
|
|
262
262
|
}
|
|
263
|
-
const $ =
|
|
264
|
-
for (let
|
|
265
|
-
const _ =
|
|
266
|
-
startRow:
|
|
263
|
+
const $ = F === M ? M - 1 : M;
|
|
264
|
+
for (let R = N; R <= w; R++) {
|
|
265
|
+
const _ = be({
|
|
266
|
+
startRow: k,
|
|
267
267
|
endRow: $,
|
|
268
|
-
startColumn:
|
|
269
|
-
endColumn:
|
|
270
|
-
}), O = `=${
|
|
271
|
-
|
|
272
|
-
range:
|
|
268
|
+
startColumn: R,
|
|
269
|
+
endColumn: R
|
|
270
|
+
}), O = `=${g}(${_})`;
|
|
271
|
+
d.push({
|
|
272
|
+
range: m,
|
|
273
273
|
primary: {
|
|
274
|
-
row:
|
|
275
|
-
column:
|
|
274
|
+
row: F,
|
|
275
|
+
column: R
|
|
276
276
|
},
|
|
277
277
|
formula: O
|
|
278
278
|
});
|
|
@@ -282,8 +282,8 @@ const Ps = {
|
|
|
282
282
|
return !1;
|
|
283
283
|
});
|
|
284
284
|
if (l) {
|
|
285
|
-
const E =
|
|
286
|
-
range:
|
|
285
|
+
const E = es(S, v, i), m = {
|
|
286
|
+
range: un.clone(l),
|
|
287
287
|
primary: {
|
|
288
288
|
startRow: E.startRow,
|
|
289
289
|
startColumn: E.startColumn,
|
|
@@ -294,29 +294,29 @@ const Ps = {
|
|
|
294
294
|
isMerged: E.isMerged,
|
|
295
295
|
isMergedMainCell: E.startRow === S && E.startColumn === v
|
|
296
296
|
}
|
|
297
|
-
},
|
|
297
|
+
}, y = {
|
|
298
298
|
unitId: c,
|
|
299
299
|
subUnitId: a,
|
|
300
|
-
selections: [
|
|
300
|
+
selections: [m]
|
|
301
301
|
};
|
|
302
|
-
await
|
|
303
|
-
const T = o.getEditor(
|
|
304
|
-
|
|
302
|
+
await p.executeCommand(Cn.id, y);
|
|
303
|
+
const T = o.getEditor(dn), A = o.getEditor(er);
|
|
304
|
+
p.syncExecuteCommand(ir.id, {
|
|
305
305
|
visible: !0,
|
|
306
306
|
unitId: c,
|
|
307
|
-
eventType:
|
|
307
|
+
eventType: Ae.Dblclick
|
|
308
308
|
});
|
|
309
|
-
const
|
|
310
|
-
T == null || T.replaceText(
|
|
309
|
+
const k = `=${g}(${f}`;
|
|
310
|
+
T == null || T.replaceText(k), A == null || A.replaceText(k, !1);
|
|
311
311
|
}
|
|
312
|
-
return u.length === 0 &&
|
|
312
|
+
return u.length === 0 && d.length === 0 ? !1 : p.executeCommand(ds.id, {
|
|
313
313
|
list: u,
|
|
314
|
-
listOfRangeHasNumber:
|
|
314
|
+
listOfRangeHasNumber: d
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
};
|
|
318
|
-
function
|
|
319
|
-
const o =
|
|
318
|
+
function Yn(e, t, n) {
|
|
319
|
+
const o = $s(e, t, n);
|
|
320
320
|
if (o !== t)
|
|
321
321
|
return {
|
|
322
322
|
startRow: o,
|
|
@@ -324,7 +324,7 @@ function Qn(e, t, n) {
|
|
|
324
324
|
startColumn: n,
|
|
325
325
|
endColumn: n
|
|
326
326
|
};
|
|
327
|
-
const r =
|
|
327
|
+
const r = Ps(e, t, n);
|
|
328
328
|
return r !== n ? {
|
|
329
329
|
startRow: t,
|
|
330
330
|
endRow: t,
|
|
@@ -332,16 +332,16 @@ function Qn(e, t, n) {
|
|
|
332
332
|
endColumn: n - 1
|
|
333
333
|
} : null;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function $s(e, t, n) {
|
|
336
336
|
let o = !1;
|
|
337
337
|
if (t === 0) return t;
|
|
338
338
|
for (let r = t - 1; r >= 0; r--) {
|
|
339
339
|
const s = e.getValue(r, n);
|
|
340
|
-
if (
|
|
340
|
+
if (_t(s) && !o) {
|
|
341
341
|
if (r === 0) return 0;
|
|
342
342
|
o = !0;
|
|
343
343
|
} else {
|
|
344
|
-
if (o && !
|
|
344
|
+
if (o && !_t(s))
|
|
345
345
|
return r + 1;
|
|
346
346
|
if (o && r === 0)
|
|
347
347
|
return 0;
|
|
@@ -349,16 +349,16 @@ function Us(e, t, n) {
|
|
|
349
349
|
}
|
|
350
350
|
return t;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Ps(e, t, n) {
|
|
353
353
|
let o = !1;
|
|
354
354
|
if (n === 0) return n;
|
|
355
355
|
for (let r = n - 1; r >= 0; r--) {
|
|
356
356
|
const s = e.getValue(t, r);
|
|
357
|
-
if (
|
|
357
|
+
if (_t(s) && !o) {
|
|
358
358
|
if (r === 0) return 0;
|
|
359
359
|
o = !0;
|
|
360
360
|
} else {
|
|
361
|
-
if (o && !
|
|
361
|
+
if (o && !_t(s))
|
|
362
362
|
return r + 1;
|
|
363
363
|
if (o && r === 0)
|
|
364
364
|
return 0;
|
|
@@ -366,69 +366,69 @@ function Vs(e, t, n) {
|
|
|
366
366
|
}
|
|
367
367
|
return n;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function _t(e) {
|
|
370
370
|
if (e != null && e.p) {
|
|
371
371
|
const t = e == null ? void 0 : e.p.body;
|
|
372
372
|
if (t == null)
|
|
373
373
|
return !1;
|
|
374
|
-
const n = t.dataStream, r = n.substring(n.length - 2, n.length) ===
|
|
375
|
-
return
|
|
374
|
+
const n = t.dataStream, r = n.substring(n.length - 2, n.length) === tr ? n.substring(0, n.length - 2) : n;
|
|
375
|
+
return Jr(r);
|
|
376
376
|
}
|
|
377
|
-
return e && (e.t ===
|
|
377
|
+
return e && (e.t === An.NUMBER || eo(e) === An.NUMBER);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Us(e) {
|
|
380
380
|
return e.startRow === e.endRow && e.startColumn === e.endColumn;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Ws(e) {
|
|
383
383
|
return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function Gn(e, t) {
|
|
386
386
|
for (let n = t.startRow; n <= t.endRow; n++)
|
|
387
387
|
for (let o = t.startColumn; o <= t.endColumn; o++)
|
|
388
|
-
if (
|
|
388
|
+
if (_t(e.getValue(n, o)))
|
|
389
389
|
return !1;
|
|
390
390
|
return !0;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Vs(e, t, n, o) {
|
|
393
393
|
for (let r = n; r <= o; r++)
|
|
394
394
|
if (!e.getValue(t, r))
|
|
395
395
|
return r;
|
|
396
396
|
return o;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Hs(e, t, n, o) {
|
|
399
399
|
for (let r = n; r <= o; r++)
|
|
400
400
|
if (!e.getValue(r, t))
|
|
401
401
|
return r;
|
|
402
402
|
return o;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
404
|
+
const Tr = "SHEET_FORMULA_UI_PLUGIN", Or = `${Tr}_MORE_FUNCTIONS_COMPONENT`, he = {
|
|
405
405
|
id: "formula-ui.operation.more-functions",
|
|
406
|
-
type:
|
|
407
|
-
handler: async (e) => (e.get(
|
|
406
|
+
type: ye.OPERATION,
|
|
407
|
+
handler: async (e) => (e.get(Rn).open({
|
|
408
408
|
header: { title: "formula.insert.tooltip" },
|
|
409
|
-
children: { label:
|
|
409
|
+
children: { label: Or }
|
|
410
410
|
}), !0)
|
|
411
|
-
},
|
|
411
|
+
}, Nr = {
|
|
412
412
|
id: "formula-ui.operation.change-ref-to-absolute",
|
|
413
|
-
type:
|
|
413
|
+
type: ye.OPERATION,
|
|
414
414
|
handler: async (e) => !0
|
|
415
|
-
},
|
|
415
|
+
}, Bs = {
|
|
416
416
|
id: "formula-ui.operation.search-function",
|
|
417
|
-
type:
|
|
418
|
-
handler: async (e, t) => (e.get(
|
|
417
|
+
type: ye.OPERATION,
|
|
418
|
+
handler: async (e, t) => (e.get(Gt).search(t), !0)
|
|
419
419
|
};
|
|
420
|
-
var
|
|
421
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
420
|
+
var qs = Object.getOwnPropertyDescriptor, js = (e, t, n, o) => {
|
|
421
|
+
for (var r = o > 1 ? void 0 : o ? qs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
422
422
|
(i = e[s]) && (r = i(r) || r);
|
|
423
423
|
return r;
|
|
424
424
|
}, At = (e, t) => (n, o) => t(n, o, e);
|
|
425
|
-
let
|
|
425
|
+
let Wt = class extends at {
|
|
426
426
|
constructor(e, t, n, o) {
|
|
427
427
|
super(), this._sheetInterceptorService = e, this._univerInstanceService = t, this._formulaDataModel = n, this._lexerTreeBuilder = o, this._initialize();
|
|
428
428
|
}
|
|
429
429
|
_initialize() {
|
|
430
430
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
431
|
-
getMutations: (e) => e.id ===
|
|
431
|
+
getMutations: (e) => e.id === ts.id ? this._reorderFormula(e.params) : {
|
|
432
432
|
redos: [],
|
|
433
433
|
undos: []
|
|
434
434
|
}
|
|
@@ -441,36 +441,36 @@ let Ut = class extends ze {
|
|
|
441
441
|
redos: t,
|
|
442
442
|
undos: n
|
|
443
443
|
};
|
|
444
|
-
const
|
|
444
|
+
const h = a.getCellMatrix(), g = new Pe(), p = new Pe();
|
|
445
445
|
let u = !1;
|
|
446
|
-
return
|
|
447
|
-
let S =
|
|
448
|
-
i.hasOwnProperty(
|
|
449
|
-
const v =
|
|
446
|
+
return to.foreach(s, (d, l) => {
|
|
447
|
+
let S = d;
|
|
448
|
+
i.hasOwnProperty(d) && (S = i[d]);
|
|
449
|
+
const v = h.getValue(S, l);
|
|
450
450
|
if (v != null && v.f || v != null && v.si) {
|
|
451
451
|
u = !0;
|
|
452
|
-
const
|
|
453
|
-
|
|
452
|
+
const f = this._formulaDataModel.getFormulaStringByCell(S, l, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
|
|
453
|
+
f,
|
|
454
454
|
0,
|
|
455
|
-
|
|
456
|
-
),
|
|
457
|
-
|
|
455
|
+
d - S
|
|
456
|
+
), I = nr.deepClone(v);
|
|
457
|
+
I.f = C, I.si = null, g.setValue(d, l, I);
|
|
458
458
|
} else
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
g.setValue(d, l, v);
|
|
460
|
+
p.setValue(d, l, h.getValue(d, l));
|
|
461
461
|
}), u ? (t.push({
|
|
462
|
-
id:
|
|
462
|
+
id: $t.id,
|
|
463
463
|
params: {
|
|
464
464
|
unitId: o,
|
|
465
465
|
subUnitId: r,
|
|
466
|
-
cellValue:
|
|
466
|
+
cellValue: g.getMatrix()
|
|
467
467
|
}
|
|
468
468
|
}), n.push({
|
|
469
|
-
id:
|
|
469
|
+
id: $t.id,
|
|
470
470
|
params: {
|
|
471
471
|
unitId: o,
|
|
472
472
|
subUnitId: r,
|
|
473
|
-
cellValue:
|
|
473
|
+
cellValue: p.getMatrix()
|
|
474
474
|
}
|
|
475
475
|
}), {
|
|
476
476
|
redos: t,
|
|
@@ -481,33 +481,36 @@ let Ut = class extends ze {
|
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
|
-
|
|
485
|
-
At(0, q(
|
|
486
|
-
At(1, q(
|
|
487
|
-
At(2, q(
|
|
488
|
-
At(3, q(
|
|
489
|
-
],
|
|
490
|
-
const
|
|
484
|
+
Wt = js([
|
|
485
|
+
At(0, q(_n)),
|
|
486
|
+
At(1, q(re)),
|
|
487
|
+
At(2, q(yt)),
|
|
488
|
+
At(3, q(ke))
|
|
489
|
+
], Wt);
|
|
490
|
+
const Ks = "@univerjs/sheets-formula-ui", Ys = "0.17.0", Mr = {
|
|
491
|
+
name: Ks,
|
|
492
|
+
version: Ys
|
|
493
|
+
}, xr = "sheets-formula-ui.base.config", zn = {};
|
|
491
494
|
var Gs = Object.getOwnPropertyDescriptor, zs = (e, t, n, o) => {
|
|
492
495
|
for (var r = o > 1 ? void 0 : o ? Gs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
493
496
|
(i = e[s]) && (r = i(r) || r);
|
|
494
497
|
return r;
|
|
495
|
-
},
|
|
496
|
-
const
|
|
497
|
-
[
|
|
498
|
-
[
|
|
499
|
-
[
|
|
500
|
-
[
|
|
501
|
-
[
|
|
502
|
-
[
|
|
503
|
-
[
|
|
504
|
-
[
|
|
505
|
-
[
|
|
506
|
-
[
|
|
507
|
-
[
|
|
508
|
-
[
|
|
498
|
+
}, pt = (e, t) => (n, o) => t(n, o, e);
|
|
499
|
+
const en = "SHEET_FORMULA_ALERT", Zs = {
|
|
500
|
+
[de.DIV_BY_ZERO]: "divByZero",
|
|
501
|
+
[de.NAME]: "name",
|
|
502
|
+
[de.VALUE]: "value",
|
|
503
|
+
[de.NUM]: "num",
|
|
504
|
+
[de.NA]: "na",
|
|
505
|
+
[de.CYCLE]: "cycle",
|
|
506
|
+
[de.REF]: "ref",
|
|
507
|
+
[de.SPILL]: "spill",
|
|
508
|
+
[de.CALC]: "calc",
|
|
509
|
+
[de.ERROR]: "error",
|
|
510
|
+
[de.CONNECT]: "connect",
|
|
511
|
+
[de.NULL]: "null"
|
|
509
512
|
};
|
|
510
|
-
let
|
|
513
|
+
let cn = class extends at {
|
|
511
514
|
constructor(e, t, n, o, r, s) {
|
|
512
515
|
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = n, this._localeService = o, this._formulaDataModel = r, this._zenZoneService = s, this._init();
|
|
513
516
|
}
|
|
@@ -515,31 +518,31 @@ let un = class extends ze {
|
|
|
515
518
|
this._initCellAlertPopup(), this._initZenService();
|
|
516
519
|
}
|
|
517
520
|
_initCellAlertPopup() {
|
|
518
|
-
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(
|
|
521
|
+
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(Sn(100)).subscribe((e) => {
|
|
519
522
|
var t, n, o, r, s;
|
|
520
523
|
if (e) {
|
|
521
524
|
const c = this._context.unit.getActiveSheet();
|
|
522
525
|
if (!c) return this._hideAlert();
|
|
523
|
-
const a = c.getCell(e.location.row, e.location.col),
|
|
524
|
-
if (
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
526
|
+
const a = c.getCell(e.location.row, e.location.col), h = (r = (o = (n = (t = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : t[e.location.unitId]) == null ? void 0 : n[e.location.subUnitId]) == null ? void 0 : o[e.location.row]) == null ? void 0 : r[e.location.col];
|
|
527
|
+
if (no(a)) {
|
|
528
|
+
const g = ur(a, !!h);
|
|
529
|
+
if (!g) {
|
|
527
530
|
this._hideAlert();
|
|
528
531
|
return;
|
|
529
532
|
}
|
|
530
|
-
const
|
|
533
|
+
const p = this._cellAlertManagerService.currentAlert.get(en), u = (s = p == null ? void 0 : p.alert) == null ? void 0 : s.location;
|
|
531
534
|
if (u && u.row === e.location.row && u.col === e.location.col && u.subUnitId === e.location.subUnitId && u.unitId === e.location.unitId) {
|
|
532
535
|
this._hideAlert();
|
|
533
536
|
return;
|
|
534
537
|
}
|
|
535
538
|
this._cellAlertManagerService.showAlert({
|
|
536
|
-
type:
|
|
539
|
+
type: _o.ERROR,
|
|
537
540
|
title: this._localeService.t("formula.error.title"),
|
|
538
|
-
message: this._localeService.t(`formula.error.${Zs[
|
|
541
|
+
message: this._localeService.t(`formula.error.${Zs[g]}`),
|
|
539
542
|
location: e.location,
|
|
540
543
|
width: 200,
|
|
541
544
|
height: 74,
|
|
542
|
-
key:
|
|
545
|
+
key: en
|
|
543
546
|
});
|
|
544
547
|
return;
|
|
545
548
|
}
|
|
@@ -553,107 +556,23 @@ let un = class extends ze {
|
|
|
553
556
|
}));
|
|
554
557
|
}
|
|
555
558
|
_hideAlert() {
|
|
556
|
-
this._cellAlertManagerService.removeAlert(
|
|
559
|
+
this._cellAlertManagerService.removeAlert(en);
|
|
557
560
|
}
|
|
558
561
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
],
|
|
562
|
+
cn = zs([
|
|
563
|
+
pt(1, q(vo)),
|
|
564
|
+
pt(2, q(Co)),
|
|
565
|
+
pt(3, q(lt)),
|
|
566
|
+
pt(4, q(yt)),
|
|
567
|
+
pt(5, Ss)
|
|
568
|
+
], cn);
|
|
566
569
|
var Xs = Object.getOwnPropertyDescriptor, Qs = (e, t, n, o) => {
|
|
567
570
|
for (var r = o > 1 ? void 0 : o ? Xs(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
568
571
|
(i = e[s]) && (r = i(r) || r);
|
|
569
572
|
return r;
|
|
570
|
-
},
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
|
|
574
|
-
}
|
|
575
|
-
_registerAutoFill() {
|
|
576
|
-
const e = {
|
|
577
|
-
type: Gn.FORMULA,
|
|
578
|
-
priority: 1001,
|
|
579
|
-
match: (t) => Ce(t == null ? void 0 : t.f) || De(t == null ? void 0 : t.si),
|
|
580
|
-
isContinue: (t, n) => t.type === Gn.FORMULA,
|
|
581
|
-
applyFunctions: {
|
|
582
|
-
[os.COPY]: (t, n, o, r, s) => {
|
|
583
|
-
const { data: i, index: c } = t;
|
|
584
|
-
return this._fillCopyFormula(i, n, o, c, r, s);
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
this._autoFillService.registerRule(e);
|
|
589
|
-
}
|
|
590
|
-
_fillCopyFormula(e, t, n, o, r, s) {
|
|
591
|
-
var d, f;
|
|
592
|
-
const i = ei(r), c = [], a = /* @__PURE__ */ new Map();
|
|
593
|
-
for (let m = 1; m <= t; m++) {
|
|
594
|
-
const u = (m - 1) % e.length, h = o[u], l = mn.deepClone(e[u]);
|
|
595
|
-
if (l) {
|
|
596
|
-
const S = ((d = e[u]) == null ? void 0 : d.f) || "", v = ((f = e[u]) == null ? void 0 : f.si) || "", g = Ce(S);
|
|
597
|
-
if (De(v))
|
|
598
|
-
l.si = v, l.f = null, l.v = null, l.p = null, l.t = null, c.push(l);
|
|
599
|
-
else if (g) {
|
|
600
|
-
let R = a.get(u);
|
|
601
|
-
if (R)
|
|
602
|
-
l.si = R, l.f = null, l.v = null, l.p = null, l.t = null;
|
|
603
|
-
else {
|
|
604
|
-
R = Yt(6), a.set(u, R);
|
|
605
|
-
const { offsetX: E, offsetY: p } = Js(i, t, n, s, h), b = this._lexerTreeBuilder.moveFormulaRefOffset(
|
|
606
|
-
S,
|
|
607
|
-
E,
|
|
608
|
-
p
|
|
609
|
-
);
|
|
610
|
-
l.si = R, l.f = b, l.v = null, l.p = null, l.t = null;
|
|
611
|
-
}
|
|
612
|
-
c.push(l);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
return c;
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
Vt = Qs([
|
|
620
|
-
tr(0, rs),
|
|
621
|
-
tr(1, q(ye))
|
|
622
|
-
], Vt);
|
|
623
|
-
function Js(e, t, n, o, r) {
|
|
624
|
-
const { source: s, target: i } = o, { rows: c } = i, { rows: a } = s;
|
|
625
|
-
let d = 0, f = 0;
|
|
626
|
-
switch (n) {
|
|
627
|
-
case de.UP:
|
|
628
|
-
f = c[r] - a[r];
|
|
629
|
-
break;
|
|
630
|
-
case de.RIGHT:
|
|
631
|
-
d = e;
|
|
632
|
-
break;
|
|
633
|
-
case de.DOWN:
|
|
634
|
-
f = c[r] - a[r];
|
|
635
|
-
break;
|
|
636
|
-
case de.LEFT:
|
|
637
|
-
d = -e * t;
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
return { offsetX: d, offsetY: f };
|
|
641
|
-
}
|
|
642
|
-
function ei(e) {
|
|
643
|
-
let t = 0;
|
|
644
|
-
for (const n in e)
|
|
645
|
-
e[n].forEach((o) => {
|
|
646
|
-
t += o.data.length;
|
|
647
|
-
});
|
|
648
|
-
return t;
|
|
649
|
-
}
|
|
650
|
-
var ti = Object.getOwnPropertyDescriptor, ni = (e, t, n, o) => {
|
|
651
|
-
for (var r = o > 1 ? void 0 : o ? ti(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
652
|
-
(i = e[s]) && (r = i(r) || r);
|
|
653
|
-
return r;
|
|
654
|
-
}, vt = (e, t) => (n, o) => t(n, o, e);
|
|
655
|
-
const ri = "default-paste-formula";
|
|
656
|
-
let Wt = class extends ze {
|
|
573
|
+
}, St = (e, t) => (n, o) => t(n, o, e);
|
|
574
|
+
const Js = "default-paste-formula";
|
|
575
|
+
let Vt = class extends at {
|
|
657
576
|
constructor(e, t, n, o, r) {
|
|
658
577
|
super(), this._univerInstanceService = e, this._lexerTreeBuilder = t, this._sheetClipboardService = n, this._injector = o, this._formulaDataModel = r, this._initialize();
|
|
659
578
|
}
|
|
@@ -667,7 +586,7 @@ let Wt = class extends ze {
|
|
|
667
586
|
const e = this;
|
|
668
587
|
let t = null;
|
|
669
588
|
return {
|
|
670
|
-
id:
|
|
589
|
+
id: sr.SPECIAL_COPY_FORMULA_ONLY,
|
|
671
590
|
priority: 10,
|
|
672
591
|
onBeforeCopy(n, o) {
|
|
673
592
|
t = e._getWorksheet(n, o);
|
|
@@ -675,7 +594,7 @@ let Wt = class extends ze {
|
|
|
675
594
|
onCopyCellContent(n, o) {
|
|
676
595
|
if (!t) return "";
|
|
677
596
|
const r = t.getCellRaw(n, o);
|
|
678
|
-
return r ?
|
|
597
|
+
return r ? Fe(r.f) ? r.f : st(r.si) && e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId()) || "" : "";
|
|
679
598
|
},
|
|
680
599
|
onAfterCopy() {
|
|
681
600
|
t = null;
|
|
@@ -684,30 +603,30 @@ let Wt = class extends ze {
|
|
|
684
603
|
const s = e._getWorksheet(n, o);
|
|
685
604
|
if (!s) return [];
|
|
686
605
|
const { startRow: i, endRow: c } = r, a = [];
|
|
687
|
-
for (let
|
|
688
|
-
s.getRowFiltered(
|
|
606
|
+
for (let h = i; h <= c; h++)
|
|
607
|
+
s.getRowFiltered(h) && a.push(h);
|
|
689
608
|
return a;
|
|
690
609
|
},
|
|
691
610
|
handleMatrixOnCell(n, o, r, s, i, c, a) {
|
|
692
|
-
const
|
|
693
|
-
if (t &&
|
|
694
|
-
const
|
|
611
|
+
const h = i.getValue(n, o);
|
|
612
|
+
if (t && h && (Fe(h.f) || st(h.si))) {
|
|
613
|
+
const g = Fe(h.f) ? h.f : e._formulaDataModel.getFormulaStringByCell(n, o, t.getSheetId(), t.getUnitId());
|
|
695
614
|
c.setValue(r, s, {
|
|
696
|
-
...
|
|
697
|
-
f
|
|
615
|
+
...gt(),
|
|
616
|
+
f: g
|
|
698
617
|
}), a.setValue(r, s, {
|
|
699
|
-
...
|
|
700
|
-
f,
|
|
701
|
-
displayV:
|
|
618
|
+
...gt(),
|
|
619
|
+
f: g,
|
|
620
|
+
displayV: g
|
|
702
621
|
});
|
|
703
622
|
} else
|
|
704
|
-
i.setValue(n, o,
|
|
623
|
+
i.setValue(n, o, gt()), c.setValue(r, s, gt()), a.setValue(r, s, gt());
|
|
705
624
|
}
|
|
706
625
|
};
|
|
707
626
|
}
|
|
708
627
|
_pasteFormulaHook() {
|
|
709
628
|
return {
|
|
710
|
-
id:
|
|
629
|
+
id: rt.SPECIAL_PASTE_FORMULA,
|
|
711
630
|
priority: 10,
|
|
712
631
|
specialPasteInfo: { label: "specialPaste.formula" },
|
|
713
632
|
onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !0)
|
|
@@ -715,13 +634,13 @@ let Wt = class extends ze {
|
|
|
715
634
|
}
|
|
716
635
|
_pasteWithFormulaHook() {
|
|
717
636
|
return {
|
|
718
|
-
id:
|
|
637
|
+
id: Js,
|
|
719
638
|
priority: 10,
|
|
720
639
|
onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !1)
|
|
721
640
|
};
|
|
722
641
|
}
|
|
723
642
|
_getWorkbook(e) {
|
|
724
|
-
return e ? this._univerInstanceService.getUnit(e,
|
|
643
|
+
return e ? this._univerInstanceService.getUnit(e, B.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(B.UNIVER_SHEET);
|
|
725
644
|
}
|
|
726
645
|
_getWorksheet(e, t) {
|
|
727
646
|
const n = this._getWorkbook(e);
|
|
@@ -730,8 +649,8 @@ let Wt = class extends ze {
|
|
|
730
649
|
_onPasteCells(e, t, n, o, r) {
|
|
731
650
|
var u;
|
|
732
651
|
if ([
|
|
733
|
-
|
|
734
|
-
|
|
652
|
+
rt.SPECIAL_PASTE_FORMAT,
|
|
653
|
+
rt.SPECIAL_PASTE_COL_WIDTH
|
|
735
654
|
].includes(o.pasteType))
|
|
736
655
|
return {
|
|
737
656
|
undos: [],
|
|
@@ -743,18 +662,18 @@ let Wt = class extends ze {
|
|
|
743
662
|
undos: [],
|
|
744
663
|
redos: []
|
|
745
664
|
};
|
|
746
|
-
const
|
|
747
|
-
copyType: o.copyType ||
|
|
665
|
+
const h = t.range, g = n, p = {
|
|
666
|
+
copyType: o.copyType || cr.COPY,
|
|
748
667
|
copyRange: e == null ? void 0 : e.range,
|
|
749
668
|
pasteType: o.pasteType
|
|
750
669
|
};
|
|
751
|
-
return this._injector.invoke((
|
|
670
|
+
return this._injector.invoke((d) => ei(
|
|
752
671
|
c,
|
|
753
672
|
a,
|
|
754
|
-
d,
|
|
755
|
-
f,
|
|
756
673
|
h,
|
|
757
|
-
|
|
674
|
+
g,
|
|
675
|
+
d,
|
|
676
|
+
p,
|
|
758
677
|
this._lexerTreeBuilder,
|
|
759
678
|
this._formulaDataModel,
|
|
760
679
|
r,
|
|
@@ -762,164 +681,164 @@ let Wt = class extends ze {
|
|
|
762
681
|
));
|
|
763
682
|
}
|
|
764
683
|
};
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
],
|
|
772
|
-
function
|
|
773
|
-
const
|
|
684
|
+
Vt = Qs([
|
|
685
|
+
St(0, re),
|
|
686
|
+
St(1, q(ke)),
|
|
687
|
+
St(2, or),
|
|
688
|
+
St(3, q(Rt)),
|
|
689
|
+
St(4, q(yt))
|
|
690
|
+
], Vt);
|
|
691
|
+
function ei(e, t, n, o, r, s, i, c, a = !1, h) {
|
|
692
|
+
const g = [], p = [], u = ti(e, t, n, o, s, i, c, h);
|
|
774
693
|
if (!u.hasValue())
|
|
775
694
|
return {
|
|
776
695
|
undos: [],
|
|
777
696
|
redos: []
|
|
778
697
|
};
|
|
779
|
-
const
|
|
698
|
+
const d = {
|
|
780
699
|
unitId: e,
|
|
781
700
|
subUnitId: t,
|
|
782
701
|
cellValue: u.getData()
|
|
783
702
|
};
|
|
784
|
-
|
|
785
|
-
id:
|
|
786
|
-
params:
|
|
703
|
+
g.push({
|
|
704
|
+
id: $t.id,
|
|
705
|
+
params: d
|
|
787
706
|
});
|
|
788
|
-
const l =
|
|
707
|
+
const l = ns(
|
|
789
708
|
r,
|
|
790
|
-
|
|
709
|
+
d
|
|
791
710
|
);
|
|
792
|
-
return
|
|
793
|
-
id:
|
|
711
|
+
return p.push({
|
|
712
|
+
id: $t.id,
|
|
794
713
|
params: l
|
|
795
714
|
}), {
|
|
796
|
-
undos:
|
|
797
|
-
redos:
|
|
715
|
+
undos: p,
|
|
716
|
+
redos: g
|
|
798
717
|
};
|
|
799
718
|
}
|
|
800
|
-
function
|
|
801
|
-
return c ? r.pasteType ===
|
|
719
|
+
function ti(e, t, n, o, r, s, i, c) {
|
|
720
|
+
return c ? r.pasteType === rt.SPECIAL_PASTE_VALUE ? ri(e, t, n, o, i, c) : r.pasteType === rt.SPECIAL_PASTE_FORMULA ? oi(e, t, n, o, s, i, c) : si(e, t, n, o, r.copyType, s, i, c) : ni(e, t, n, o, i);
|
|
802
721
|
}
|
|
803
|
-
function
|
|
804
|
-
const s = new
|
|
805
|
-
return o.forValue((c, a,
|
|
806
|
-
var
|
|
807
|
-
const
|
|
808
|
-
|
|
722
|
+
function ni(e, t, n, o, r) {
|
|
723
|
+
const s = new Pe(), i = r.getSheetFormulaData(e, t);
|
|
724
|
+
return o.forValue((c, a, h) => {
|
|
725
|
+
var d;
|
|
726
|
+
const g = n.rows[c], p = n.cols[a], u = {};
|
|
727
|
+
Fe(h.v) ? (u.v = null, u.f = `${h.v}`, u.si = null, u.p = null, s.setValue(g, p, u)) : (d = i == null ? void 0 : i[g]) != null && d[p] && (u.v = h.v, u.f = null, u.si = null, u.p = null, s.setValue(g, p, u));
|
|
809
728
|
}), s;
|
|
810
729
|
}
|
|
811
|
-
function
|
|
812
|
-
var
|
|
813
|
-
const i = new
|
|
814
|
-
return o.forValue((
|
|
815
|
-
var
|
|
816
|
-
const l = s.range.rows[
|
|
817
|
-
if (
|
|
818
|
-
C.v =
|
|
819
|
-
else if ((
|
|
820
|
-
const
|
|
821
|
-
C.v =
|
|
822
|
-
} else if ((E = a == null ? void 0 : a[v]) != null && E[
|
|
823
|
-
if (C.v =
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
i.setValue(v,
|
|
730
|
+
function ri(e, t, n, o, r, s) {
|
|
731
|
+
var h, g;
|
|
732
|
+
const i = new Pe(), c = (g = (h = r.getArrayFormulaCellData()) == null ? void 0 : h[s.unitId]) == null ? void 0 : g[s.subUnitId], a = r.getSheetFormulaData(e, t);
|
|
733
|
+
return o.forValue((p, u, d) => {
|
|
734
|
+
var I, E;
|
|
735
|
+
const l = s.range.rows[p % s.range.rows.length], S = s.range.cols[u % s.range.cols.length], v = n.rows[p], f = n.cols[u], C = {};
|
|
736
|
+
if (Fe(d.f) || st(d.si))
|
|
737
|
+
C.v = d.v, C.f = null, C.si = null, C.p = null, i.setValue(v, f, C);
|
|
738
|
+
else if ((I = c == null ? void 0 : c[l]) != null && I[S]) {
|
|
739
|
+
const m = c[l][S];
|
|
740
|
+
C.v = m.v, C.f = null, C.si = null, C.p = null, i.setValue(v, f, C);
|
|
741
|
+
} else if ((E = a == null ? void 0 : a[v]) != null && E[f]) {
|
|
742
|
+
if (C.v = d.v, C.f = null, C.si = null, C.p = null, d.p) {
|
|
743
|
+
const m = wr(d);
|
|
744
|
+
m && (C.v = m);
|
|
745
|
+
}
|
|
746
|
+
i.setValue(v, f, C);
|
|
828
747
|
}
|
|
829
748
|
}), i;
|
|
830
749
|
}
|
|
831
|
-
function
|
|
832
|
-
const c = new
|
|
833
|
-
return o.forValue((
|
|
834
|
-
const u = n.rows[
|
|
835
|
-
if (
|
|
750
|
+
function oi(e, t, n, o, r, s, i) {
|
|
751
|
+
const c = new Pe(), a = /* @__PURE__ */ new Map();
|
|
752
|
+
return o.forValue((h, g, p) => {
|
|
753
|
+
const u = n.rows[h], d = n.cols[g], l = {};
|
|
754
|
+
if (st(p.si)) {
|
|
836
755
|
if (i.unitId !== e || i.subUnitId !== t) {
|
|
837
756
|
const S = s.getFormulaStringByCell(
|
|
838
|
-
i.range.rows[
|
|
839
|
-
i.range.cols[
|
|
757
|
+
i.range.rows[h % i.range.rows.length],
|
|
758
|
+
i.range.cols[g % i.range.cols.length],
|
|
840
759
|
i.subUnitId,
|
|
841
760
|
i.unitId
|
|
842
|
-
), v = n.cols[
|
|
761
|
+
), v = n.cols[g] - i.range.cols[g % i.range.cols.length], f = n.rows[h] - i.range.rows[h % i.range.rows.length], C = r.moveFormulaRefOffset(S || "", v, f);
|
|
843
762
|
l.si = null, l.f = C;
|
|
844
763
|
} else
|
|
845
|
-
l.si =
|
|
846
|
-
l.v = null, l.p = null, c.setValue(u,
|
|
847
|
-
} else if (
|
|
848
|
-
const S = `${
|
|
764
|
+
l.si = p.si, l.f = null;
|
|
765
|
+
l.v = null, l.p = null, c.setValue(u, d, l);
|
|
766
|
+
} else if (Fe(p.f)) {
|
|
767
|
+
const S = `${h % i.range.rows.length}_${g % i.range.cols.length}`;
|
|
849
768
|
let v = a.get(S);
|
|
850
769
|
if (v)
|
|
851
770
|
l.si = v, l.f = null;
|
|
852
771
|
else {
|
|
853
|
-
v =
|
|
854
|
-
const
|
|
855
|
-
l.si = v, l.f =
|
|
772
|
+
v = hn(6), a.set(S, v);
|
|
773
|
+
const f = n.cols[g] - i.range.cols[g % i.range.cols.length], C = n.rows[h] - i.range.rows[h % i.range.rows.length], I = r.moveFormulaRefOffset(p.f || "", f, C);
|
|
774
|
+
l.si = v, l.f = I;
|
|
856
775
|
}
|
|
857
|
-
l.v = null, l.p = null, c.setValue(u,
|
|
776
|
+
l.v = null, l.p = null, c.setValue(u, d, l);
|
|
858
777
|
} else {
|
|
859
|
-
if (l.v =
|
|
860
|
-
const S = wr(
|
|
778
|
+
if (l.v = p.v, l.f = null, l.si = null, l.p = null, p.p) {
|
|
779
|
+
const S = wr(p);
|
|
861
780
|
S && (l.v = S);
|
|
862
781
|
}
|
|
863
|
-
c.setValue(u,
|
|
782
|
+
c.setValue(u, d, l);
|
|
864
783
|
}
|
|
865
784
|
}), c;
|
|
866
785
|
}
|
|
867
|
-
function
|
|
868
|
-
const a = new
|
|
869
|
-
return r ===
|
|
870
|
-
const S = n.rows[u], v = n.cols[
|
|
871
|
-
if (
|
|
872
|
-
if (
|
|
873
|
-
|
|
874
|
-
else if (
|
|
875
|
-
|
|
786
|
+
function si(e, t, n, o, r, s, i, c) {
|
|
787
|
+
const a = new Pe(), h = /* @__PURE__ */ new Map(), g = i.getSheetFormulaData(e, t), p = [];
|
|
788
|
+
return r === cr.CUT ? o.forValue((u, d, l) => {
|
|
789
|
+
const S = n.rows[u], v = n.cols[d], f = {};
|
|
790
|
+
if (st(l.si)) {
|
|
791
|
+
if (Fe(l.f))
|
|
792
|
+
p.push(l.si), f.f = l.f, f.si = l.si;
|
|
793
|
+
else if (p.includes(l.si))
|
|
794
|
+
f.f = null, f.si = l.si;
|
|
876
795
|
else {
|
|
877
796
|
const C = i.getFormulaStringByCell(
|
|
878
797
|
c.range.rows[u % c.range.rows.length],
|
|
879
|
-
c.range.cols[
|
|
798
|
+
c.range.cols[d % c.range.cols.length],
|
|
880
799
|
c.subUnitId,
|
|
881
800
|
c.unitId
|
|
882
801
|
);
|
|
883
|
-
|
|
802
|
+
f.f = C, f.si = null;
|
|
884
803
|
}
|
|
885
|
-
|
|
886
|
-
} else
|
|
887
|
-
}) : o.forValue((u,
|
|
804
|
+
f.v = null, f.p = null, a.setValue(S, v, f);
|
|
805
|
+
} else Fe(l.f) && (f.f = l.f, f.si = null, f.v = null, f.p = null, a.setValue(S, v, f));
|
|
806
|
+
}) : o.forValue((u, d, l) => {
|
|
888
807
|
var C;
|
|
889
|
-
const S = n.rows[u], v = n.cols[
|
|
890
|
-
if (
|
|
808
|
+
const S = n.rows[u], v = n.cols[d], f = {};
|
|
809
|
+
if (st(l.si)) {
|
|
891
810
|
if (c.unitId !== e || c.subUnitId !== t) {
|
|
892
|
-
const
|
|
811
|
+
const I = i.getFormulaStringByCell(
|
|
893
812
|
c.range.rows[u % c.range.rows.length],
|
|
894
|
-
c.range.cols[
|
|
813
|
+
c.range.cols[d % c.range.cols.length],
|
|
895
814
|
c.subUnitId,
|
|
896
815
|
c.unitId
|
|
897
|
-
), E = n.cols[
|
|
898
|
-
|
|
816
|
+
), E = n.cols[d] - c.range.cols[d % c.range.cols.length], m = n.rows[u] - c.range.rows[u % c.range.rows.length], y = s.moveFormulaRefOffset(I || "", E, m);
|
|
817
|
+
f.si = null, f.f = y;
|
|
899
818
|
} else
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
} else if (
|
|
903
|
-
const
|
|
904
|
-
let E =
|
|
819
|
+
f.si = l.si, f.f = null;
|
|
820
|
+
f.v = null, f.p = null, a.setValue(S, v, f);
|
|
821
|
+
} else if (Fe(l.f)) {
|
|
822
|
+
const I = `${u % c.range.rows.length}_${d % c.range.cols.length}`;
|
|
823
|
+
let E = h.get(I);
|
|
905
824
|
if (E)
|
|
906
|
-
|
|
825
|
+
f.si = E, f.f = null;
|
|
907
826
|
else {
|
|
908
|
-
E =
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
} else (C =
|
|
914
|
-
}),
|
|
915
|
-
if (!(c.range.rows.includes(u) && c.range.cols.includes(
|
|
827
|
+
E = hn(6), h.set(I, E);
|
|
828
|
+
const m = n.cols[d] - c.range.cols[d % c.range.cols.length], y = n.rows[u] - c.range.rows[u % c.range.rows.length], T = s.moveFormulaRefOffset(l.f || "", m, y);
|
|
829
|
+
f.si = E, f.f = T;
|
|
830
|
+
}
|
|
831
|
+
f.v = null, f.p = null, a.setValue(S, v, f);
|
|
832
|
+
} else (C = g == null ? void 0 : g[S]) != null && C[v] && (f.v = l.v, f.f = null, f.si = null, f.p = l.p, a.setValue(S, v, f));
|
|
833
|
+
}), p.length > 0 && new Pe(g).forValue((u, d, l) => {
|
|
834
|
+
if (!(c.range.rows.includes(u) && c.range.cols.includes(d)) && !(n.rows.includes(u) && n.cols.includes(d)) && p.includes(l == null ? void 0 : l.si)) {
|
|
916
835
|
const S = i.getFormulaStringByCell(
|
|
917
836
|
u,
|
|
918
|
-
|
|
837
|
+
d,
|
|
919
838
|
c.subUnitId,
|
|
920
839
|
c.unitId
|
|
921
840
|
);
|
|
922
|
-
a.setValue(u,
|
|
841
|
+
a.setValue(u, d, {
|
|
923
842
|
f: S,
|
|
924
843
|
si: null,
|
|
925
844
|
v: null,
|
|
@@ -934,15 +853,15 @@ function wr(e) {
|
|
|
934
853
|
if (t == null)
|
|
935
854
|
return;
|
|
936
855
|
const n = t.dataStream;
|
|
937
|
-
return n.substring(n.length - 2, n.length) ===
|
|
856
|
+
return n.substring(n.length - 2, n.length) === tr ? n.substring(0, n.length - 2) : n;
|
|
938
857
|
}
|
|
939
858
|
}
|
|
940
|
-
var
|
|
941
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
859
|
+
var ii = Object.getOwnPropertyDescriptor, ci = (e, t, n, o) => {
|
|
860
|
+
for (var r = o > 1 ? void 0 : o ? ii(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
942
861
|
(i = e[s]) && (r = i(r) || r);
|
|
943
862
|
return r;
|
|
944
863
|
}, je = (e, t) => (n, o) => t(n, o, e);
|
|
945
|
-
let Ht = class extends
|
|
864
|
+
let Ht = class extends at {
|
|
946
865
|
constructor(t, n, o, r, s, i, c, a) {
|
|
947
866
|
super();
|
|
948
867
|
j(this, "_previousShape");
|
|
@@ -972,19 +891,19 @@ let Ht = class extends ze {
|
|
|
972
891
|
}
|
|
973
892
|
_initInterceptorEditorStart() {
|
|
974
893
|
this.disposeWithMe(
|
|
975
|
-
|
|
976
|
-
this._sheetInterceptorService.writeCellInterceptor.intercept(
|
|
894
|
+
rr(
|
|
895
|
+
this._sheetInterceptorService.writeCellInterceptor.intercept(rs, {
|
|
977
896
|
handler: (t, n, o) => {
|
|
978
|
-
var l, S, v,
|
|
979
|
-
const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n,
|
|
897
|
+
var l, S, v, f;
|
|
898
|
+
const { row: r, col: s, unitId: i, subUnitId: c, worksheet: a } = n, h = this._formulaDataModel.getArrayFormulaRange(), g = this._formulaDataModel.getArrayFormulaCellData();
|
|
980
899
|
if (this._removeArrayFormulaRangeShape(), t == null)
|
|
981
900
|
return o(t);
|
|
982
|
-
let
|
|
901
|
+
let p = null;
|
|
983
902
|
const u = this._formulaDataModel.getFormulaStringByCell(r, s, c, i);
|
|
984
|
-
if (u !== null && (
|
|
985
|
-
return
|
|
986
|
-
const
|
|
987
|
-
return
|
|
903
|
+
if (u !== null && (p = { f: u }), t.v != null && t.v !== "" && ((v = (S = (l = g[i]) == null ? void 0 : l[c]) == null ? void 0 : S[r]) == null ? void 0 : v[s]) == null)
|
|
904
|
+
return p ? { ...t, ...p } : o(t);
|
|
905
|
+
const d = (f = h == null ? void 0 : h[i]) == null ? void 0 : f[c];
|
|
906
|
+
return d != null && (p = this._displayArrayFormulaRangeShape(d, r, s, i, c, a, p)), p ? { ...t, ...p } : o(t);
|
|
988
907
|
}
|
|
989
908
|
})
|
|
990
909
|
)
|
|
@@ -992,10 +911,10 @@ let Ht = class extends ze {
|
|
|
992
911
|
}
|
|
993
912
|
_commandExecutedListener() {
|
|
994
913
|
this.disposeWithMe(this._commandService.onCommandExecuted((t, n) => {
|
|
995
|
-
(t.id ===
|
|
914
|
+
(t.id === Do.id || t.id === Lo.id && n && n.remove) && this._removeArrayFormulaRangeShape();
|
|
996
915
|
})), this.disposeWithMe(
|
|
997
916
|
this._commandService.beforeCommandExecuted((t) => {
|
|
998
|
-
|
|
917
|
+
os.id === t.id && requestIdleCallback(() => {
|
|
999
918
|
const n = t.params, { unitId: o, subUnitId: r, rowsAutoHeightInfo: s } = n;
|
|
1000
919
|
this._refreshArrayFormulaRangeShapeByRow(o, r, s);
|
|
1001
920
|
});
|
|
@@ -1003,18 +922,18 @@ let Ht = class extends ze {
|
|
|
1003
922
|
);
|
|
1004
923
|
}
|
|
1005
924
|
_displayArrayFormulaRangeShape(t, n, o, r, s, i, c) {
|
|
1006
|
-
return new
|
|
1007
|
-
if (
|
|
925
|
+
return new Pe(t).forValue((a, h, g) => {
|
|
926
|
+
if (g == null)
|
|
1008
927
|
return !0;
|
|
1009
|
-
const { startRow:
|
|
1010
|
-
if (a === n &&
|
|
1011
|
-
return this._createArrayFormulaRangeShape(
|
|
1012
|
-
if (n >=
|
|
1013
|
-
const S = i.getCell(
|
|
1014
|
-
return (S == null ? void 0 : S.v) ===
|
|
928
|
+
const { startRow: p, startColumn: u, endRow: d, endColumn: l } = g;
|
|
929
|
+
if (a === n && h === o)
|
|
930
|
+
return this._createArrayFormulaRangeShape(g, r), !1;
|
|
931
|
+
if (n >= p && n <= d && o >= u && o <= l) {
|
|
932
|
+
const S = i.getCell(p, u);
|
|
933
|
+
return (S == null ? void 0 : S.v) === de.SPILL || (S == null ? void 0 : S.f) == null ? void 0 : (c == null && (c = {
|
|
1015
934
|
f: S.f,
|
|
1016
935
|
isInArrayFormulaRange: !0
|
|
1017
|
-
}), this._createArrayFormulaRangeShape(
|
|
936
|
+
}), this._createArrayFormulaRangeShape(g, r), !1);
|
|
1018
937
|
}
|
|
1019
938
|
}), c;
|
|
1020
939
|
}
|
|
@@ -1029,15 +948,15 @@ let Ht = class extends ze {
|
|
|
1029
948
|
style: {
|
|
1030
949
|
strokeWidth: 1,
|
|
1031
950
|
stroke: this._themeService.getColorFromTheme("primary.600"),
|
|
1032
|
-
fill: new
|
|
951
|
+
fill: new fn(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
|
|
1033
952
|
widgets: {}
|
|
1034
953
|
}
|
|
1035
|
-
}, c =
|
|
954
|
+
}, c = rn(i, r), { rowHeaderWidth: a, columnHeaderHeight: h } = r, g = new ar(s, Ro.FORMULA_EDITOR_SHOW, this._themeService, {
|
|
1036
955
|
highlightHeader: !1,
|
|
1037
956
|
rowHeaderWidth: a,
|
|
1038
|
-
columnHeaderHeight:
|
|
957
|
+
columnHeaderHeight: h
|
|
1039
958
|
});
|
|
1040
|
-
|
|
959
|
+
g.updateRangeBySelectionWithCoord(c), g.setEvent(!1), this._previousShape = g;
|
|
1041
960
|
}
|
|
1042
961
|
_removeArrayFormulaRangeShape() {
|
|
1043
962
|
this._previousShape != null && (this._previousShape.dispose(), this._previousShape = null);
|
|
@@ -1061,52 +980,52 @@ let Ht = class extends ze {
|
|
|
1061
980
|
if (!this._checkCurrentSheet(t, n) || !this._previousShape) return;
|
|
1062
981
|
const { startRow: r, endRow: s, startColumn: i, endColumn: c } = this._previousShape.getRange();
|
|
1063
982
|
for (let a = 0; a < o.length; a++) {
|
|
1064
|
-
const { row:
|
|
1065
|
-
if (r >=
|
|
1066
|
-
const
|
|
983
|
+
const { row: h } = o[a];
|
|
984
|
+
if (r >= h) {
|
|
985
|
+
const g = {
|
|
1067
986
|
startRow: r,
|
|
1068
987
|
endRow: s,
|
|
1069
988
|
startColumn: i,
|
|
1070
989
|
endColumn: c
|
|
1071
990
|
};
|
|
1072
|
-
this._refreshArrayFormulaRangeShape(t,
|
|
991
|
+
this._refreshArrayFormulaRangeShape(t, g);
|
|
1073
992
|
break;
|
|
1074
993
|
}
|
|
1075
994
|
}
|
|
1076
995
|
}
|
|
1077
996
|
};
|
|
1078
|
-
Ht =
|
|
1079
|
-
je(1, q(
|
|
1080
|
-
je(2, q(
|
|
1081
|
-
je(3, q(
|
|
997
|
+
Ht = ci([
|
|
998
|
+
je(1, q(_n)),
|
|
999
|
+
je(2, q(yt)),
|
|
1000
|
+
je(3, q(It)),
|
|
1082
1001
|
je(4, Te),
|
|
1083
|
-
je(5, q(
|
|
1084
|
-
je(6,
|
|
1085
|
-
je(7,
|
|
1002
|
+
je(5, q(Et)),
|
|
1003
|
+
je(6, ve),
|
|
1004
|
+
je(7, ro)
|
|
1086
1005
|
], Ht);
|
|
1087
|
-
var
|
|
1088
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
1006
|
+
var ai = Object.getOwnPropertyDescriptor, li = (e, t, n, o) => {
|
|
1007
|
+
for (var r = o > 1 ? void 0 : o ? ai(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
1089
1008
|
(i = e[s]) && (r = i(r) || r);
|
|
1090
1009
|
return r;
|
|
1091
|
-
},
|
|
1092
|
-
const
|
|
1010
|
+
}, Zn = (e, t) => (n, o) => t(n, o, e);
|
|
1011
|
+
const ui = {
|
|
1093
1012
|
tl: {
|
|
1094
1013
|
size: 6,
|
|
1095
1014
|
color: "#409f11"
|
|
1096
1015
|
}
|
|
1097
1016
|
};
|
|
1098
|
-
let Bt = class extends
|
|
1017
|
+
let Bt = class extends oo {
|
|
1099
1018
|
constructor(e, t) {
|
|
1100
1019
|
super(), this._sheetInterceptorService = e, this._formulaDataModel = t, this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
1101
|
-
|
|
1020
|
+
ss.CELL_CONTENT,
|
|
1102
1021
|
{
|
|
1103
|
-
effect:
|
|
1022
|
+
effect: so.Style,
|
|
1104
1023
|
handler: (n, o, r) => {
|
|
1105
|
-
var c, a,
|
|
1106
|
-
const s = (
|
|
1107
|
-
return !
|
|
1024
|
+
var c, a, h, g;
|
|
1025
|
+
const s = (g = (h = (a = (c = this._formulaDataModel.getArrayFormulaCellData()) == null ? void 0 : c[o.unitId]) == null ? void 0 : a[o.subUnitId]) == null ? void 0 : h[o.row]) == null ? void 0 : g[o.col];
|
|
1026
|
+
return !ur(n, !!s) || !n || (n === o.rawData && (n = { ...o.rawData }), n.markers = {
|
|
1108
1027
|
...n == null ? void 0 : n.markers,
|
|
1109
|
-
...
|
|
1028
|
+
...ui
|
|
1110
1029
|
}), r(n);
|
|
1111
1030
|
},
|
|
1112
1031
|
priority: 10
|
|
@@ -1114,25 +1033,230 @@ let Bt = class extends so {
|
|
|
1114
1033
|
));
|
|
1115
1034
|
}
|
|
1116
1035
|
};
|
|
1117
|
-
Bt =
|
|
1118
|
-
|
|
1119
|
-
|
|
1036
|
+
Bt = li([
|
|
1037
|
+
Zn(0, q(_n)),
|
|
1038
|
+
Zn(1, q(yt))
|
|
1120
1039
|
], Bt);
|
|
1121
|
-
function
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
|
|
1040
|
+
function di(e) {
|
|
1041
|
+
const t = ["SUMIF", "SUM", "AVERAGE", "IF", "COUNT", "SIN", "MAX"];
|
|
1042
|
+
let n = t.map((o) => ({
|
|
1043
|
+
label: {
|
|
1044
|
+
name: o,
|
|
1045
|
+
selectable: !1
|
|
1046
|
+
},
|
|
1047
|
+
value: o
|
|
1048
|
+
}));
|
|
1049
|
+
try {
|
|
1050
|
+
const o = e.get(dt), r = t.filter((s) => !!o.getFunctionInfo(s));
|
|
1051
|
+
r.length > 0 && (n = r.map((s) => ({
|
|
1052
|
+
label: {
|
|
1053
|
+
name: s,
|
|
1054
|
+
selectable: !1
|
|
1055
|
+
},
|
|
1056
|
+
value: s
|
|
1057
|
+
})));
|
|
1058
|
+
} catch {
|
|
1059
|
+
}
|
|
1060
|
+
return {
|
|
1061
|
+
id: `${ne.id}.common`,
|
|
1062
|
+
commandId: ne.id,
|
|
1063
|
+
title: "formula.insert.common",
|
|
1064
|
+
tooltip: "formula.insert.tooltip",
|
|
1065
|
+
icon: "FunctionIcon",
|
|
1066
|
+
type: Ot.SELECTOR,
|
|
1067
|
+
selections: n,
|
|
1068
|
+
hidden$: Tt(e, B.UNIVER_SHEET)
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
function Oe(e, t, n) {
|
|
1072
|
+
return function(r) {
|
|
1073
|
+
let s = [];
|
|
1074
|
+
try {
|
|
1075
|
+
s = r.get(dt).getSearchListByType(e).map(({ name: c }) => ({
|
|
1076
|
+
label: {
|
|
1077
|
+
name: c,
|
|
1078
|
+
selectable: !1
|
|
1079
|
+
},
|
|
1080
|
+
value: c
|
|
1081
|
+
}));
|
|
1082
|
+
} catch {
|
|
1083
|
+
s = [];
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
id: `${ne.id}.${t}`,
|
|
1087
|
+
commandId: ne.id,
|
|
1088
|
+
title: `formula.functionType.${t}`,
|
|
1089
|
+
tooltip: "formula.insert.tooltip",
|
|
1090
|
+
icon: n,
|
|
1091
|
+
type: Ot.SELECTOR,
|
|
1092
|
+
selections: s,
|
|
1093
|
+
hidden$: Tt(r, B.UNIVER_SHEET)
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
const hi = Oe(fe.Financial, "financial"), fi = Oe(fe.Logical, "logical"), gi = Oe(fe.Text, "text"), mi = Oe(fe.Date, "date"), pi = Oe(fe.Lookup, "lookup"), Si = Oe(fe.Math, "math"), vi = Oe(fe.Statistical, "statistical"), Ci = Oe(fe.Engineering, "engineering"), _i = Oe(fe.Information, "information"), Ri = Oe(fe.Database, "database");
|
|
1098
|
+
function _e(e) {
|
|
1099
|
+
return {
|
|
1100
|
+
id: he.id,
|
|
1101
|
+
title: "formula.moreFunctions.allFunctions",
|
|
1102
|
+
tooltip: "formula.insert.tooltip",
|
|
1103
|
+
type: Ot.BUTTON,
|
|
1104
|
+
hidden$: Tt(e, B.UNIVER_SHEET),
|
|
1105
|
+
disabled$: pn(e, {
|
|
1106
|
+
workbookTypes: [_r],
|
|
1107
|
+
worksheetTypes: [vr, Sr],
|
|
1108
|
+
rangeTypes: [Cr]
|
|
1109
|
+
})
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
function Ii(e) {
|
|
1113
|
+
return {
|
|
1114
|
+
id: En.id,
|
|
1115
|
+
type: Ot.BUTTON,
|
|
1116
|
+
title: "formula.operation.copyFormulaOnly",
|
|
1117
|
+
disabled$: pn(e, {
|
|
1118
|
+
workbookTypes: [as],
|
|
1119
|
+
worksheetTypes: [cs],
|
|
1120
|
+
rangeTypes: [is]
|
|
1121
|
+
}),
|
|
1122
|
+
hidden$: Tt(e, B.UNIVER_SHEET)
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
function Ei(e) {
|
|
1126
|
+
return {
|
|
1127
|
+
id: bn.id,
|
|
1128
|
+
type: Ot.BUTTON,
|
|
1129
|
+
title: "formula.operation.pasteFormula",
|
|
1130
|
+
disabled$: Io(e).pipe(
|
|
1131
|
+
qo(pn(e, {
|
|
1132
|
+
workbookTypes: [_r],
|
|
1133
|
+
rangeTypes: [Cr],
|
|
1134
|
+
worksheetTypes: [Sr, vr]
|
|
1135
|
+
})),
|
|
1136
|
+
hr(([t, n]) => t || n)
|
|
1137
|
+
),
|
|
1138
|
+
hidden$: Tt(e, B.UNIVER_SHEET)
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
const bi = {
|
|
1142
|
+
[vs.BASIC]: {
|
|
1143
|
+
[`${ne.id}.common`]: {
|
|
1144
|
+
order: 0,
|
|
1145
|
+
menuItemFactory: di,
|
|
1146
|
+
[he.id]: {
|
|
1147
|
+
order: 0,
|
|
1148
|
+
menuItemFactory: _e
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
[`${ne.id}.financial`]: {
|
|
1152
|
+
order: 1,
|
|
1153
|
+
menuItemFactory: hi,
|
|
1154
|
+
[he.id]: {
|
|
1155
|
+
order: 0,
|
|
1156
|
+
menuItemFactory: _e
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
[`${ne.id}.logical`]: {
|
|
1160
|
+
order: 2,
|
|
1161
|
+
menuItemFactory: fi,
|
|
1162
|
+
[he.id]: {
|
|
1163
|
+
order: 0,
|
|
1164
|
+
menuItemFactory: _e
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
[`${ne.id}.text`]: {
|
|
1168
|
+
order: 3,
|
|
1169
|
+
menuItemFactory: gi,
|
|
1170
|
+
[he.id]: {
|
|
1171
|
+
order: 0,
|
|
1172
|
+
menuItemFactory: _e
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
[`${ne.id}.date`]: {
|
|
1176
|
+
order: 4,
|
|
1177
|
+
menuItemFactory: mi,
|
|
1178
|
+
[he.id]: {
|
|
1179
|
+
order: 0,
|
|
1180
|
+
menuItemFactory: _e
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
[`${ne.id}.lookup`]: {
|
|
1184
|
+
order: 5,
|
|
1185
|
+
menuItemFactory: pi,
|
|
1186
|
+
[he.id]: {
|
|
1187
|
+
order: 0,
|
|
1188
|
+
menuItemFactory: _e
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
[`${ne.id}.math`]: {
|
|
1192
|
+
order: 6,
|
|
1193
|
+
menuItemFactory: Si,
|
|
1194
|
+
[he.id]: {
|
|
1195
|
+
order: 0,
|
|
1196
|
+
menuItemFactory: _e
|
|
1197
|
+
}
|
|
1198
|
+
},
|
|
1199
|
+
[`${ne.id}.statistical`]: {
|
|
1200
|
+
order: 7,
|
|
1201
|
+
menuItemFactory: vi,
|
|
1202
|
+
[he.id]: {
|
|
1203
|
+
order: 0,
|
|
1204
|
+
menuItemFactory: _e
|
|
1205
|
+
}
|
|
1206
|
+
},
|
|
1207
|
+
[`${ne.id}.engineering`]: {
|
|
1208
|
+
order: 8,
|
|
1209
|
+
menuItemFactory: Ci,
|
|
1210
|
+
[he.id]: {
|
|
1211
|
+
order: 0,
|
|
1212
|
+
menuItemFactory: _e
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
[`${ne.id}.information`]: {
|
|
1216
|
+
order: 9,
|
|
1217
|
+
menuItemFactory: _i,
|
|
1218
|
+
[he.id]: {
|
|
1219
|
+
order: 0,
|
|
1220
|
+
menuItemFactory: _e
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
[`${ne.id}.database`]: {
|
|
1224
|
+
order: 10,
|
|
1225
|
+
menuItemFactory: Ri,
|
|
1226
|
+
[he.id]: {
|
|
1227
|
+
order: 0,
|
|
1228
|
+
menuItemFactory: _e
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
[bo]: {
|
|
1233
|
+
[En.id]: {
|
|
1234
|
+
order: 0,
|
|
1235
|
+
menuItemFactory: Ii
|
|
1236
|
+
}
|
|
1237
|
+
},
|
|
1238
|
+
[Eo]: {
|
|
1239
|
+
[bn.id]: {
|
|
1240
|
+
order: 4,
|
|
1241
|
+
menuItemFactory: Ei
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
function yi() {
|
|
1246
|
+
const e = b(hs), t = b(ve), n = Re(e.progress$), o = Pt(() => {
|
|
1247
|
+
t.executeCommand($o.id);
|
|
1248
|
+
}, [t]), r = Pt(() => {
|
|
1125
1249
|
e.clearProgress();
|
|
1126
1250
|
}, [e]);
|
|
1127
|
-
return /* @__PURE__ */ x(
|
|
1251
|
+
return /* @__PURE__ */ x(Cs, { progress: n, onTerminate: o, onClearProgress: r });
|
|
1128
1252
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return Object.keys(
|
|
1253
|
+
function Ti(e, t) {
|
|
1254
|
+
return Object.keys(fe).filter((n) => isNaN(Number(n)) && n !== "DefinedName" && n !== "Table" && (t || n !== "User")).map((n) => ({
|
|
1131
1255
|
label: e.t(`formula.functionType.${n.toLocaleLowerCase()}`),
|
|
1132
|
-
value: `${
|
|
1256
|
+
value: `${fe[n]}`
|
|
1133
1257
|
}));
|
|
1134
1258
|
}
|
|
1135
|
-
function
|
|
1259
|
+
function Fr(e) {
|
|
1136
1260
|
if (!e.require && !e.repeat)
|
|
1137
1261
|
return `[${e.name}]`;
|
|
1138
1262
|
if (e.require && !e.repeat)
|
|
@@ -1142,27 +1266,27 @@ function kr(e) {
|
|
|
1142
1266
|
if (e.require && e.repeat)
|
|
1143
1267
|
return `${e.name},...`;
|
|
1144
1268
|
}
|
|
1145
|
-
function
|
|
1269
|
+
function kr(e) {
|
|
1146
1270
|
const { prefix: t, value: n } = e;
|
|
1147
|
-
return /* @__PURE__ */
|
|
1148
|
-
/* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ H("div", { children: [
|
|
1272
|
+
/* @__PURE__ */ H("span", { children: [
|
|
1149
1273
|
t,
|
|
1150
1274
|
"("
|
|
1151
1275
|
] }),
|
|
1152
|
-
n && n.map((o, r) => /* @__PURE__ */
|
|
1153
|
-
/* @__PURE__ */ x("span", { children:
|
|
1276
|
+
n && n.map((o, r) => /* @__PURE__ */ H("span", { children: [
|
|
1277
|
+
/* @__PURE__ */ x("span", { children: Fr(o) }),
|
|
1154
1278
|
r === n.length - 1 ? "" : ","
|
|
1155
1279
|
] }, r)),
|
|
1156
1280
|
")"
|
|
1157
1281
|
] });
|
|
1158
1282
|
}
|
|
1159
|
-
function
|
|
1283
|
+
function vt(e) {
|
|
1160
1284
|
const { className: t, value: n, title: o } = e;
|
|
1161
|
-
return /* @__PURE__ */
|
|
1285
|
+
return /* @__PURE__ */ H("div", { className: "univer-mb-2 univer-text-xs", children: [
|
|
1162
1286
|
/* @__PURE__ */ x(
|
|
1163
1287
|
"div",
|
|
1164
1288
|
{
|
|
1165
|
-
className:
|
|
1289
|
+
className: ie("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
|
|
1166
1290
|
children: o
|
|
1167
1291
|
}
|
|
1168
1292
|
),
|
|
@@ -1175,27 +1299,27 @@ function Ct(e) {
|
|
|
1175
1299
|
)
|
|
1176
1300
|
] });
|
|
1177
1301
|
}
|
|
1178
|
-
function
|
|
1302
|
+
function Oi(e) {
|
|
1179
1303
|
const { functionInfo: t, onChange: n } = e;
|
|
1180
1304
|
if (!t) return null;
|
|
1181
|
-
const [o, r] =
|
|
1182
|
-
return /* @__PURE__ */
|
|
1183
|
-
/* @__PURE__ */ x("div", { className:
|
|
1184
|
-
/* @__PURE__ */ x("div", { className: "univer-text-sm", children:
|
|
1305
|
+
const [o, r] = V([]), [s, i] = V(t.functionParameter), [c, a] = V(-1);
|
|
1306
|
+
return /* @__PURE__ */ H("div", { children: [
|
|
1307
|
+
/* @__PURE__ */ x("div", { className: ie("univer-h-[364px] univer-overflow-y-auto", it), children: s.map((h, g) => /* @__PURE__ */ H("div", { children: [
|
|
1308
|
+
/* @__PURE__ */ x("div", { className: "univer-text-sm", children: h.name }),
|
|
1185
1309
|
/* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
|
|
1186
|
-
] },
|
|
1187
|
-
/* @__PURE__ */ x("div", { className:
|
|
1188
|
-
|
|
1310
|
+
] }, g)) }),
|
|
1311
|
+
/* @__PURE__ */ x("div", { className: ie("univer-flex-1 univer-p-3", Ts), children: /* @__PURE__ */ x(
|
|
1312
|
+
vt,
|
|
1189
1313
|
{
|
|
1190
|
-
title: c === -1 ? /* @__PURE__ */ x(
|
|
1314
|
+
title: c === -1 ? /* @__PURE__ */ x(kr, { prefix: t.functionName, value: s }) : s[c].name,
|
|
1191
1315
|
value: c === -1 ? t.description : s[c].detail
|
|
1192
1316
|
}
|
|
1193
1317
|
) })
|
|
1194
1318
|
] });
|
|
1195
1319
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${
|
|
1198
|
-
return
|
|
1320
|
+
function Xe({ ref: e, ...t }) {
|
|
1321
|
+
const { icon: n, id: o, className: r, extend: s, ...i } = t, c = `univerjs-icon univerjs-icon-${o} ${r || ""}`.trim(), a = X(`_${xi()}`);
|
|
1322
|
+
return Ar(n, `${o}`, {
|
|
1199
1323
|
defIds: n.defIds,
|
|
1200
1324
|
idSuffix: a.current
|
|
1201
1325
|
}, {
|
|
@@ -1204,14 +1328,14 @@ function nt({ ref: e, ...t }) {
|
|
|
1204
1328
|
...i
|
|
1205
1329
|
}, s);
|
|
1206
1330
|
}
|
|
1207
|
-
function
|
|
1208
|
-
return
|
|
1331
|
+
function Ar(e, t, n, o, r) {
|
|
1332
|
+
return Ze(e.tag, {
|
|
1209
1333
|
key: t,
|
|
1210
|
-
...
|
|
1334
|
+
...Ni(e, n, r),
|
|
1211
1335
|
...o
|
|
1212
|
-
}, (
|
|
1336
|
+
}, (Mi(e, n).children || []).map((s, i) => Ar(s, `${t}-${e.tag}-${i}`, n, void 0, r)));
|
|
1213
1337
|
}
|
|
1214
|
-
function
|
|
1338
|
+
function Ni(e, t, n) {
|
|
1215
1339
|
const o = { ...e.attrs };
|
|
1216
1340
|
n != null && n.colorChannel1 && o.fill === "colorChannel1" && (o.fill = n.colorChannel1), e.tag === "mask" && o.id && (o.id = o.id + t.idSuffix), Object.entries(o).forEach(([s, i]) => {
|
|
1217
1341
|
s === "mask" && typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
@@ -1221,7 +1345,7 @@ function vi(e, t, n) {
|
|
|
1221
1345
|
typeof i == "string" && (o[s] = i.replace(/url\(#(.*)\)/, `url(#$1${t.idSuffix})`));
|
|
1222
1346
|
})), o;
|
|
1223
1347
|
}
|
|
1224
|
-
function
|
|
1348
|
+
function Mi(e, t) {
|
|
1225
1349
|
var o;
|
|
1226
1350
|
const { defIds: n } = t;
|
|
1227
1351
|
return !n || n.length === 0 ? e : e.tag === "defs" && ((o = e.children) != null && o.length) ? {
|
|
@@ -1235,11 +1359,11 @@ function Ci(e, t) {
|
|
|
1235
1359
|
} : r)
|
|
1236
1360
|
} : e;
|
|
1237
1361
|
}
|
|
1238
|
-
function
|
|
1362
|
+
function xi() {
|
|
1239
1363
|
return Math.random().toString(36).substring(2, 8);
|
|
1240
1364
|
}
|
|
1241
|
-
|
|
1242
|
-
const
|
|
1365
|
+
Xe.displayName = "UniverIcon";
|
|
1366
|
+
const wi = {
|
|
1243
1367
|
tag: "svg",
|
|
1244
1368
|
attrs: {
|
|
1245
1369
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1257,15 +1381,15 @@ const Ri = {
|
|
|
1257
1381
|
clipRule: "evenodd"
|
|
1258
1382
|
}
|
|
1259
1383
|
}]
|
|
1260
|
-
}, Dr =
|
|
1261
|
-
return
|
|
1384
|
+
}, Dr = We(function(t, n) {
|
|
1385
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1262
1386
|
id: "check-mark-icon",
|
|
1263
1387
|
ref: n,
|
|
1264
|
-
icon:
|
|
1388
|
+
icon: wi
|
|
1265
1389
|
}));
|
|
1266
1390
|
});
|
|
1267
1391
|
Dr.displayName = "CheckMarkIcon";
|
|
1268
|
-
const
|
|
1392
|
+
const Fi = {
|
|
1269
1393
|
tag: "svg",
|
|
1270
1394
|
attrs: {
|
|
1271
1395
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1281,15 +1405,15 @@ const Ii = {
|
|
|
1281
1405
|
d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z"
|
|
1282
1406
|
}
|
|
1283
1407
|
}]
|
|
1284
|
-
}, Lr =
|
|
1285
|
-
return
|
|
1408
|
+
}, Lr = We(function(t, n) {
|
|
1409
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1286
1410
|
id: "close-icon",
|
|
1287
1411
|
ref: n,
|
|
1288
|
-
icon:
|
|
1412
|
+
icon: Fi
|
|
1289
1413
|
}));
|
|
1290
1414
|
});
|
|
1291
1415
|
Lr.displayName = "CloseIcon";
|
|
1292
|
-
const
|
|
1416
|
+
const ki = {
|
|
1293
1417
|
tag: "svg",
|
|
1294
1418
|
attrs: {
|
|
1295
1419
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1330,15 +1454,15 @@ const Ei = {
|
|
|
1330
1454
|
}
|
|
1331
1455
|
}
|
|
1332
1456
|
]
|
|
1333
|
-
}, $r =
|
|
1334
|
-
return
|
|
1457
|
+
}, $r = We(function(t, n) {
|
|
1458
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1335
1459
|
id: "delete-icon",
|
|
1336
1460
|
ref: n,
|
|
1337
|
-
icon:
|
|
1461
|
+
icon: ki
|
|
1338
1462
|
}));
|
|
1339
1463
|
});
|
|
1340
1464
|
$r.displayName = "DeleteIcon";
|
|
1341
|
-
const
|
|
1465
|
+
const Ai = {
|
|
1342
1466
|
tag: "svg",
|
|
1343
1467
|
attrs: {
|
|
1344
1468
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1354,15 +1478,15 @@ const bi = {
|
|
|
1354
1478
|
d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"
|
|
1355
1479
|
}
|
|
1356
1480
|
}]
|
|
1357
|
-
}, Pr =
|
|
1358
|
-
return
|
|
1481
|
+
}, Pr = We(function(t, n) {
|
|
1482
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1359
1483
|
id: "increase-icon",
|
|
1360
1484
|
ref: n,
|
|
1361
|
-
icon:
|
|
1485
|
+
icon: Ai
|
|
1362
1486
|
}));
|
|
1363
1487
|
});
|
|
1364
1488
|
Pr.displayName = "IncreaseIcon";
|
|
1365
|
-
const
|
|
1489
|
+
const Di = {
|
|
1366
1490
|
tag: "svg",
|
|
1367
1491
|
attrs: {
|
|
1368
1492
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1380,15 +1504,15 @@ const yi = {
|
|
|
1380
1504
|
clipRule: "evenodd"
|
|
1381
1505
|
}
|
|
1382
1506
|
}]
|
|
1383
|
-
}, Ur =
|
|
1384
|
-
return
|
|
1507
|
+
}, Ur = We(function(t, n) {
|
|
1508
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1385
1509
|
id: "more-icon",
|
|
1386
1510
|
ref: n,
|
|
1387
|
-
icon:
|
|
1511
|
+
icon: Di
|
|
1388
1512
|
}));
|
|
1389
1513
|
});
|
|
1390
1514
|
Ur.displayName = "MoreIcon";
|
|
1391
|
-
const
|
|
1515
|
+
const Li = {
|
|
1392
1516
|
tag: "svg",
|
|
1393
1517
|
attrs: {
|
|
1394
1518
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1412,42 +1536,42 @@ const Ti = {
|
|
|
1412
1536
|
clipRule: "evenodd"
|
|
1413
1537
|
}
|
|
1414
1538
|
}]
|
|
1415
|
-
},
|
|
1416
|
-
return
|
|
1539
|
+
}, Wr = We(function(t, n) {
|
|
1540
|
+
return Ze(Xe, Object.assign({}, t, {
|
|
1417
1541
|
id: "select-range-icon",
|
|
1418
1542
|
ref: n,
|
|
1419
|
-
icon:
|
|
1543
|
+
icon: Li
|
|
1420
1544
|
}));
|
|
1421
1545
|
});
|
|
1422
|
-
|
|
1423
|
-
function
|
|
1424
|
-
var
|
|
1425
|
-
const n = (
|
|
1426
|
-
(_) =>
|
|
1546
|
+
Wr.displayName = "SelectRangeIcon";
|
|
1547
|
+
function $i(e) {
|
|
1548
|
+
var R;
|
|
1549
|
+
const n = (R = b(gn).getConfig(fs)) == null ? void 0 : R.function, { onChange: o } = e, r = "-1", [s, i] = V(""), [c, a] = V([]), [h, g] = V(0), [p, u] = V(r), [d, l] = V(0), [S, v] = V(null), f = b(dt), C = b(lt), I = b(Rn), E = Re(I.sidebarOptions$), m = Ti(C, !!n).filter(
|
|
1550
|
+
(_) => f.getSearchListByType(Number(_.value)).length > 0
|
|
1427
1551
|
);
|
|
1428
|
-
|
|
1552
|
+
m.unshift({
|
|
1429
1553
|
label: C.t("formula.moreFunctions.allFunctions"),
|
|
1430
1554
|
value: r
|
|
1431
1555
|
});
|
|
1432
|
-
const
|
|
1556
|
+
const y = C.t("formula.prompt.required"), T = C.t("formula.prompt.optional");
|
|
1433
1557
|
P(() => {
|
|
1434
1558
|
N(r);
|
|
1435
1559
|
}, []), P(() => {
|
|
1436
|
-
|
|
1560
|
+
k(0);
|
|
1437
1561
|
}, [c]), P(() => {
|
|
1438
|
-
E != null && E.visible && (i(""), a([]),
|
|
1562
|
+
E != null && E.visible && (i(""), a([]), g(0), u(r), l(0), v(null), N(r));
|
|
1439
1563
|
}, [E]);
|
|
1440
|
-
const
|
|
1564
|
+
const A = (_) => {
|
|
1441
1565
|
if (s.trim() === "") return _;
|
|
1442
1566
|
const O = new RegExp(`(${s.toLocaleUpperCase()})`);
|
|
1443
1567
|
return _.split(O).filter(Boolean).map((U, Y) => U.match(O) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: U }, Y) : U);
|
|
1444
|
-
},
|
|
1568
|
+
}, k = (_) => {
|
|
1445
1569
|
if (c.length === 0) {
|
|
1446
1570
|
v(null), o(null);
|
|
1447
1571
|
return;
|
|
1448
1572
|
}
|
|
1449
1573
|
l(_);
|
|
1450
|
-
const O =
|
|
1574
|
+
const O = f.getFunctionInfo(c[_].name);
|
|
1451
1575
|
if (!O) {
|
|
1452
1576
|
v(null), o(null);
|
|
1453
1577
|
return;
|
|
@@ -1456,33 +1580,33 @@ function Oi(e) {
|
|
|
1456
1580
|
};
|
|
1457
1581
|
function N(_) {
|
|
1458
1582
|
u(_);
|
|
1459
|
-
const O =
|
|
1583
|
+
const O = f.getSearchListByType(+_);
|
|
1460
1584
|
a(O);
|
|
1461
1585
|
}
|
|
1462
1586
|
function M(_) {
|
|
1463
1587
|
i(_);
|
|
1464
|
-
const O =
|
|
1588
|
+
const O = f.getSearchListByName(_);
|
|
1465
1589
|
a(O);
|
|
1466
1590
|
}
|
|
1467
1591
|
function w(_) {
|
|
1468
1592
|
if (_.stopPropagation(), _.key === "ArrowDown") {
|
|
1469
|
-
const O =
|
|
1470
|
-
|
|
1593
|
+
const O = h + 1;
|
|
1594
|
+
g(O === c.length ? 0 : O);
|
|
1471
1595
|
} else if (_.key === "ArrowUp") {
|
|
1472
|
-
const O =
|
|
1473
|
-
|
|
1474
|
-
} else _.key === "Enter" &&
|
|
1596
|
+
const O = h - 1;
|
|
1597
|
+
g(O === -1 ? c.length - 1 : O);
|
|
1598
|
+
} else _.key === "Enter" && k(h);
|
|
1475
1599
|
}
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1600
|
+
const F = (_) => {
|
|
1601
|
+
g(_);
|
|
1478
1602
|
}, $ = () => {
|
|
1479
|
-
|
|
1603
|
+
g(-1);
|
|
1480
1604
|
};
|
|
1481
|
-
return /* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */ x(
|
|
1605
|
+
return /* @__PURE__ */ H("div", { children: [
|
|
1606
|
+
/* @__PURE__ */ H("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
|
|
1607
|
+
/* @__PURE__ */ x(Os, { value: p, options: m, onChange: N }),
|
|
1484
1608
|
/* @__PURE__ */ x(
|
|
1485
|
-
|
|
1609
|
+
br,
|
|
1486
1610
|
{
|
|
1487
1611
|
placeholder: C.t("formula.moreFunctions.searchFunctionPlaceholder"),
|
|
1488
1612
|
onKeyDown: w,
|
|
@@ -1496,99 +1620,99 @@ function Oi(e) {
|
|
|
1496
1620
|
c.length > 0 && /* @__PURE__ */ x(
|
|
1497
1621
|
"ul",
|
|
1498
1622
|
{
|
|
1499
|
-
className:
|
|
1623
|
+
className: ie("univer-mb-0 univer-mt-2 univer-box-border univer-max-h-72 univer-w-full univer-select-none univer-list-none univer-overflow-y-auto univer-rounded univer-p-3 univer-outline-none", In, it),
|
|
1500
1624
|
onKeyDown: w,
|
|
1501
1625
|
tabIndex: -1,
|
|
1502
|
-
children: c.map(({ name: _ }, O) => /* @__PURE__ */
|
|
1626
|
+
children: c.map(({ name: _ }, O) => /* @__PURE__ */ H(
|
|
1503
1627
|
"li",
|
|
1504
1628
|
{
|
|
1505
|
-
className:
|
|
1506
|
-
"univer-bg-gray-200 dark:!univer-bg-gray-600":
|
|
1629
|
+
className: ie("univer-relative univer-box-border univer-cursor-pointer univer-rounded univer-px-7 univer-py-1 univer-text-sm univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
|
|
1630
|
+
"univer-bg-gray-200 dark:!univer-bg-gray-600": h === O
|
|
1507
1631
|
}),
|
|
1508
|
-
onMouseEnter: () =>
|
|
1632
|
+
onMouseEnter: () => F(O),
|
|
1509
1633
|
onMouseLeave: $,
|
|
1510
|
-
onClick: () =>
|
|
1634
|
+
onClick: () => k(O),
|
|
1511
1635
|
children: [
|
|
1512
|
-
|
|
1636
|
+
d === O && /* @__PURE__ */ x(
|
|
1513
1637
|
Dr,
|
|
1514
1638
|
{
|
|
1515
1639
|
className: "univer-absolute univer-left-1.5 univer-top-1/2 univer-inline-flex -univer-translate-y-1/2 univer-text-base univer-text-primary-600"
|
|
1516
1640
|
}
|
|
1517
1641
|
),
|
|
1518
|
-
/* @__PURE__ */ x("span", { className: "univer-block", children:
|
|
1642
|
+
/* @__PURE__ */ x("span", { className: "univer-block", children: A(_) })
|
|
1519
1643
|
]
|
|
1520
1644
|
},
|
|
1521
1645
|
O
|
|
1522
1646
|
))
|
|
1523
1647
|
}
|
|
1524
1648
|
),
|
|
1525
|
-
S && /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */ x(
|
|
1649
|
+
S && /* @__PURE__ */ H("div", { className: ie("univer-mx-0 univer-my-2 univer-overflow-y-auto", it), children: [
|
|
1650
|
+
/* @__PURE__ */ x(vt, { title: S.functionName, value: S.description }),
|
|
1527
1651
|
/* @__PURE__ */ x(
|
|
1528
|
-
|
|
1652
|
+
vt,
|
|
1529
1653
|
{
|
|
1530
1654
|
title: C.t("formula.moreFunctions.syntax"),
|
|
1531
|
-
value: /* @__PURE__ */ x(
|
|
1655
|
+
value: /* @__PURE__ */ x(kr, { prefix: S.functionName, value: S.functionParameter })
|
|
1532
1656
|
}
|
|
1533
1657
|
),
|
|
1534
1658
|
/* @__PURE__ */ x(
|
|
1535
|
-
|
|
1659
|
+
vt,
|
|
1536
1660
|
{
|
|
1537
1661
|
title: C.t("formula.prompt.helpExample"),
|
|
1538
1662
|
value: `${S.functionName}(${S.functionParameter.map((_) => _.example).join(",")})`
|
|
1539
1663
|
}
|
|
1540
1664
|
),
|
|
1541
1665
|
S.functionParameter && S.functionParameter.map((_) => /* @__PURE__ */ x(
|
|
1542
|
-
|
|
1666
|
+
vt,
|
|
1543
1667
|
{
|
|
1544
1668
|
title: _.name,
|
|
1545
|
-
value: `${_.require ?
|
|
1669
|
+
value: `${_.require ? y : T} ${_.detail}`
|
|
1546
1670
|
},
|
|
1547
1671
|
_.name
|
|
1548
1672
|
))
|
|
1549
1673
|
] })
|
|
1550
1674
|
] });
|
|
1551
1675
|
}
|
|
1552
|
-
function
|
|
1553
|
-
const e =
|
|
1554
|
-
|
|
1555
|
-
const c =
|
|
1556
|
-
function
|
|
1676
|
+
function Pi() {
|
|
1677
|
+
const e = yo(), [t, n] = V(!0), [o, r] = V(!1), [s, i] = V(null);
|
|
1678
|
+
b(mn);
|
|
1679
|
+
const c = b(lt), a = b(ze), h = b(re), g = b(ve);
|
|
1680
|
+
function p() {
|
|
1557
1681
|
n(!t), r(!o);
|
|
1558
1682
|
}
|
|
1559
1683
|
function u() {
|
|
1560
|
-
const
|
|
1561
|
-
if (!
|
|
1562
|
-
|
|
1684
|
+
const d = pr(h);
|
|
1685
|
+
if (!d) return;
|
|
1686
|
+
g.executeCommand(ir.id, {
|
|
1563
1687
|
visible: !0,
|
|
1564
|
-
unitId:
|
|
1565
|
-
eventType:
|
|
1688
|
+
unitId: d.unitId,
|
|
1689
|
+
eventType: Ae.Dblclick
|
|
1566
1690
|
});
|
|
1567
|
-
const l = a.getEditor(
|
|
1691
|
+
const l = a.getEditor(dn), S = a.getEditor(er), v = `=${s == null ? void 0 : s.functionName}(`;
|
|
1568
1692
|
l == null || l.replaceText(v), S == null || S.replaceText(v, !1);
|
|
1569
1693
|
}
|
|
1570
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ H(
|
|
1571
1695
|
"div",
|
|
1572
1696
|
{
|
|
1573
1697
|
"data-u-comp": "sheets-formula-functions-panel",
|
|
1574
1698
|
className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
|
|
1575
1699
|
children: [
|
|
1576
|
-
t && /* @__PURE__ */ x(
|
|
1577
|
-
o && /* @__PURE__ */ x(
|
|
1700
|
+
t && /* @__PURE__ */ x($i, { onChange: i }),
|
|
1701
|
+
o && /* @__PURE__ */ x(Oi, { functionInfo: s, onChange: () => {
|
|
1578
1702
|
} }),
|
|
1579
|
-
/* @__PURE__ */
|
|
1703
|
+
/* @__PURE__ */ H("div", { className: "univer-flex univer-justify-end", children: [
|
|
1580
1704
|
o && /* @__PURE__ */ x(
|
|
1581
|
-
|
|
1705
|
+
ot,
|
|
1582
1706
|
{
|
|
1583
1707
|
variant: "primary",
|
|
1584
|
-
onClick:
|
|
1708
|
+
onClick: p,
|
|
1585
1709
|
className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0",
|
|
1586
1710
|
children: c.t("formula.moreFunctions.next")
|
|
1587
1711
|
}
|
|
1588
1712
|
),
|
|
1589
|
-
o && /* @__PURE__ */ x(
|
|
1713
|
+
o && /* @__PURE__ */ x(ot, { onClick: p, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: c.t("formula.moreFunctions.prev") }),
|
|
1590
1714
|
t && !!e && /* @__PURE__ */ x(
|
|
1591
|
-
|
|
1715
|
+
ot,
|
|
1592
1716
|
{
|
|
1593
1717
|
disabled: !s,
|
|
1594
1718
|
variant: "primary",
|
|
@@ -1602,278 +1726,109 @@ function Ni() {
|
|
|
1602
1726
|
}
|
|
1603
1727
|
);
|
|
1604
1728
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
title: "SUM",
|
|
1609
|
-
icon: "SumIcon",
|
|
1610
|
-
type: Ue.BUTTON,
|
|
1611
|
-
params: {
|
|
1612
|
-
value: "SUM"
|
|
1613
|
-
},
|
|
1614
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1615
|
-
disabled$: $e(e, {
|
|
1616
|
-
workbookTypes: [et],
|
|
1617
|
-
worksheetTypes: [Qe, Xe],
|
|
1618
|
-
rangeTypes: [Je]
|
|
1619
|
-
})
|
|
1620
|
-
};
|
|
1621
|
-
}
|
|
1622
|
-
function xi(e) {
|
|
1623
|
-
return {
|
|
1624
|
-
id: ve.id,
|
|
1625
|
-
title: "COUNT",
|
|
1626
|
-
icon: "CntIcon",
|
|
1627
|
-
type: Ue.BUTTON,
|
|
1628
|
-
params: {
|
|
1629
|
-
value: "COUNT"
|
|
1630
|
-
},
|
|
1631
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1632
|
-
disabled$: $e(e, {
|
|
1633
|
-
workbookTypes: [et],
|
|
1634
|
-
worksheetTypes: [Qe, Xe],
|
|
1635
|
-
rangeTypes: [Je]
|
|
1636
|
-
})
|
|
1637
|
-
};
|
|
1638
|
-
}
|
|
1639
|
-
function wi(e) {
|
|
1640
|
-
return {
|
|
1641
|
-
id: ve.id,
|
|
1642
|
-
title: "AVERAGE",
|
|
1643
|
-
icon: "AvgIcon",
|
|
1644
|
-
type: Ue.BUTTON,
|
|
1645
|
-
params: {
|
|
1646
|
-
value: "AVERAGE"
|
|
1647
|
-
},
|
|
1648
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1649
|
-
disabled$: $e(e, {
|
|
1650
|
-
workbookTypes: [et],
|
|
1651
|
-
worksheetTypes: [Qe, Xe],
|
|
1652
|
-
rangeTypes: [Je]
|
|
1653
|
-
})
|
|
1654
|
-
};
|
|
1655
|
-
}
|
|
1656
|
-
function ki(e) {
|
|
1657
|
-
return {
|
|
1658
|
-
id: ve.id,
|
|
1659
|
-
title: "MAX",
|
|
1660
|
-
icon: "MaxIcon",
|
|
1661
|
-
type: Ue.BUTTON,
|
|
1662
|
-
params: {
|
|
1663
|
-
value: "MAX"
|
|
1664
|
-
},
|
|
1665
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1666
|
-
disabled$: $e(e, {
|
|
1667
|
-
workbookTypes: [et],
|
|
1668
|
-
worksheetTypes: [Qe, Xe],
|
|
1669
|
-
rangeTypes: [Je]
|
|
1670
|
-
})
|
|
1671
|
-
};
|
|
1672
|
-
}
|
|
1673
|
-
function Ai(e) {
|
|
1674
|
-
return {
|
|
1675
|
-
id: ve.id,
|
|
1676
|
-
title: "MIN",
|
|
1677
|
-
icon: "MinIcon",
|
|
1678
|
-
type: Ue.BUTTON,
|
|
1679
|
-
params: {
|
|
1680
|
-
value: "MIN"
|
|
1681
|
-
},
|
|
1682
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1683
|
-
disabled$: $e(e, {
|
|
1684
|
-
workbookTypes: [et],
|
|
1685
|
-
worksheetTypes: [Qe, Xe],
|
|
1686
|
-
rangeTypes: [Je]
|
|
1687
|
-
})
|
|
1688
|
-
};
|
|
1689
|
-
}
|
|
1690
|
-
function Fi(e) {
|
|
1691
|
-
return {
|
|
1692
|
-
id: On.id,
|
|
1693
|
-
title: "formula.insert.more",
|
|
1694
|
-
tooltip: "formula.insert.tooltip",
|
|
1695
|
-
type: Ue.BUTTON,
|
|
1696
|
-
hidden$: Pe(e, W.UNIVER_SHEET),
|
|
1697
|
-
disabled$: $e(e, {
|
|
1698
|
-
workbookTypes: [et],
|
|
1699
|
-
worksheetTypes: [Qe, Xe],
|
|
1700
|
-
rangeTypes: [Je]
|
|
1701
|
-
})
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
function Di(e) {
|
|
1705
|
-
return {
|
|
1706
|
-
id: yn.id,
|
|
1707
|
-
type: Ue.BUTTON,
|
|
1708
|
-
title: "formula.operation.copyFormulaOnly",
|
|
1709
|
-
disabled$: $e(e, {
|
|
1710
|
-
workbookTypes: [ds],
|
|
1711
|
-
worksheetTypes: [us],
|
|
1712
|
-
rangeTypes: [as]
|
|
1713
|
-
}),
|
|
1714
|
-
hidden$: Pe(e, W.UNIVER_SHEET)
|
|
1715
|
-
};
|
|
1716
|
-
}
|
|
1717
|
-
function Li(e) {
|
|
1718
|
-
return {
|
|
1719
|
-
id: Tn.id,
|
|
1720
|
-
type: Ue.BUTTON,
|
|
1721
|
-
title: "formula.operation.pasteFormula",
|
|
1722
|
-
disabled$: bo(e).pipe(
|
|
1723
|
-
jo($e(e, {
|
|
1724
|
-
workbookTypes: [et],
|
|
1725
|
-
rangeTypes: [Je],
|
|
1726
|
-
worksheetTypes: [Xe, Qe]
|
|
1727
|
-
})),
|
|
1728
|
-
Sr(([t, n]) => t || n)
|
|
1729
|
-
),
|
|
1730
|
-
hidden$: Pe(e, W.UNIVER_SHEET)
|
|
1731
|
-
};
|
|
1732
|
-
}
|
|
1733
|
-
const $i = {
|
|
1734
|
-
[Xn.BASIC]: {
|
|
1735
|
-
[`${ve.id}.sum`]: {
|
|
1736
|
-
order: 0,
|
|
1737
|
-
menuItemFactory: Mi
|
|
1738
|
-
},
|
|
1739
|
-
[`${ve.id}.count`]: {
|
|
1740
|
-
order: 1,
|
|
1741
|
-
menuItemFactory: xi
|
|
1742
|
-
},
|
|
1743
|
-
[`${ve.id}.average`]: {
|
|
1744
|
-
order: 2,
|
|
1745
|
-
menuItemFactory: wi
|
|
1746
|
-
},
|
|
1747
|
-
[`${ve.id}.max`]: {
|
|
1748
|
-
order: 3,
|
|
1749
|
-
menuItemFactory: ki
|
|
1750
|
-
},
|
|
1751
|
-
[`${ve.id}.min`]: {
|
|
1752
|
-
order: 4,
|
|
1753
|
-
menuItemFactory: Ai
|
|
1754
|
-
}
|
|
1755
|
-
},
|
|
1756
|
-
[Xn.OTHERS]: {
|
|
1757
|
-
[On.id]: {
|
|
1758
|
-
order: 0,
|
|
1759
|
-
menuItemFactory: Fi
|
|
1760
|
-
}
|
|
1761
|
-
},
|
|
1762
|
-
[To]: {
|
|
1763
|
-
[yn.id]: {
|
|
1764
|
-
order: 0,
|
|
1765
|
-
menuItemFactory: Di
|
|
1766
|
-
}
|
|
1767
|
-
},
|
|
1768
|
-
[yo]: {
|
|
1769
|
-
[Tn.id]: {
|
|
1770
|
-
order: 4,
|
|
1771
|
-
menuItemFactory: Li
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
}, Pi = "meta_key_ctrl_And_Shift";
|
|
1775
|
-
function Ui(e) {
|
|
1776
|
-
return e.getContextValue(co) && e.getContextValue(lo);
|
|
1729
|
+
const Ui = "meta_key_ctrl_And_Shift";
|
|
1730
|
+
function Wi(e) {
|
|
1731
|
+
return e.getContextValue(io) && e.getContextValue(co);
|
|
1777
1732
|
}
|
|
1778
|
-
const
|
|
1733
|
+
const zt = [
|
|
1779
1734
|
L.ARROW_DOWN,
|
|
1780
1735
|
L.ARROW_UP,
|
|
1781
1736
|
L.ARROW_LEFT,
|
|
1782
1737
|
L.ARROW_RIGHT
|
|
1783
|
-
], Vi = [...
|
|
1784
|
-
function
|
|
1738
|
+
], Vi = [...zt, L.ENTER, L.TAB, L.ESC];
|
|
1739
|
+
function Hi() {
|
|
1785
1740
|
const e = [];
|
|
1786
1741
|
for (const t of Vi)
|
|
1787
1742
|
e.push({
|
|
1788
|
-
id:
|
|
1743
|
+
id: ht.id,
|
|
1789
1744
|
binding: t,
|
|
1790
|
-
preconditions: (n) =>
|
|
1745
|
+
preconditions: (n) => bt(n),
|
|
1791
1746
|
staticParameters: {
|
|
1792
|
-
eventType:
|
|
1747
|
+
eventType: Ae.Keyboard,
|
|
1793
1748
|
keycode: t
|
|
1794
1749
|
}
|
|
1795
1750
|
});
|
|
1796
1751
|
return e;
|
|
1797
1752
|
}
|
|
1798
|
-
function
|
|
1753
|
+
function Bi() {
|
|
1799
1754
|
const e = [];
|
|
1800
|
-
for (const t of
|
|
1755
|
+
for (const t of zt)
|
|
1801
1756
|
e.push({
|
|
1802
|
-
id:
|
|
1803
|
-
binding: t |
|
|
1804
|
-
preconditions: (n) =>
|
|
1757
|
+
id: ht.id,
|
|
1758
|
+
binding: t | W.SHIFT,
|
|
1759
|
+
preconditions: (n) => bt(n),
|
|
1805
1760
|
staticParameters: {
|
|
1806
|
-
eventType:
|
|
1761
|
+
eventType: Ae.Keyboard,
|
|
1807
1762
|
keycode: t,
|
|
1808
|
-
metaKey:
|
|
1763
|
+
metaKey: W.SHIFT
|
|
1809
1764
|
}
|
|
1810
1765
|
});
|
|
1811
1766
|
return e;
|
|
1812
1767
|
}
|
|
1813
|
-
function
|
|
1768
|
+
function qi() {
|
|
1814
1769
|
const e = [];
|
|
1815
|
-
for (const t of
|
|
1770
|
+
for (const t of zt)
|
|
1816
1771
|
e.push({
|
|
1817
|
-
id:
|
|
1818
|
-
binding: t |
|
|
1819
|
-
preconditions: (n) =>
|
|
1772
|
+
id: ht.id,
|
|
1773
|
+
binding: t | W.CTRL_COMMAND,
|
|
1774
|
+
preconditions: (n) => bt(n),
|
|
1820
1775
|
staticParameters: {
|
|
1821
|
-
eventType:
|
|
1776
|
+
eventType: Ae.Keyboard,
|
|
1822
1777
|
keycode: t,
|
|
1823
|
-
metaKey:
|
|
1778
|
+
metaKey: W.CTRL_COMMAND
|
|
1824
1779
|
}
|
|
1825
1780
|
});
|
|
1826
1781
|
return e;
|
|
1827
1782
|
}
|
|
1828
|
-
function
|
|
1783
|
+
function ji() {
|
|
1829
1784
|
const e = [];
|
|
1830
|
-
for (const t of
|
|
1785
|
+
for (const t of zt)
|
|
1831
1786
|
e.push({
|
|
1832
|
-
id:
|
|
1833
|
-
binding: t |
|
|
1834
|
-
preconditions: (n) =>
|
|
1787
|
+
id: ht.id,
|
|
1788
|
+
binding: t | W.SHIFT | W.CTRL_COMMAND,
|
|
1789
|
+
preconditions: (n) => bt(n),
|
|
1835
1790
|
staticParameters: {
|
|
1836
|
-
eventType:
|
|
1791
|
+
eventType: Ae.Keyboard,
|
|
1837
1792
|
keycode: t,
|
|
1838
|
-
metaKey:
|
|
1793
|
+
metaKey: Ui
|
|
1839
1794
|
}
|
|
1840
1795
|
});
|
|
1841
1796
|
return e;
|
|
1842
1797
|
}
|
|
1843
|
-
const
|
|
1844
|
-
id:
|
|
1798
|
+
const Ki = {
|
|
1799
|
+
id: Nr.id,
|
|
1845
1800
|
binding: L.F4,
|
|
1846
|
-
preconditions: (e) =>
|
|
1801
|
+
preconditions: (e) => bt(e)
|
|
1847
1802
|
};
|
|
1848
|
-
function
|
|
1803
|
+
function Yi() {
|
|
1849
1804
|
const e = [];
|
|
1850
1805
|
for (const t of [L.ENTER, L.TAB, L.ARROW_DOWN, L.ARROW_UP])
|
|
1851
1806
|
e.push({
|
|
1852
|
-
id:
|
|
1807
|
+
id: ht.id,
|
|
1853
1808
|
binding: t,
|
|
1854
|
-
preconditions: (n) =>
|
|
1809
|
+
preconditions: (n) => Wi(n),
|
|
1855
1810
|
staticParameters: {
|
|
1856
|
-
eventType:
|
|
1811
|
+
eventType: Ae.Keyboard,
|
|
1857
1812
|
keycode: t,
|
|
1858
1813
|
isSingleEditor: !0
|
|
1859
1814
|
}
|
|
1860
1815
|
});
|
|
1861
1816
|
return e;
|
|
1862
1817
|
}
|
|
1863
|
-
const
|
|
1864
|
-
id:
|
|
1865
|
-
binding:
|
|
1866
|
-
preconditions:
|
|
1867
|
-
mac:
|
|
1818
|
+
const Gi = {
|
|
1819
|
+
id: gs.id,
|
|
1820
|
+
binding: W.ALT | L.EQUAL,
|
|
1821
|
+
preconditions: To,
|
|
1822
|
+
mac: W.CTRL_COMMAND | W.ALT | L.EQUAL,
|
|
1868
1823
|
description: "shortcut.sheets-formula-ui.quick-sum",
|
|
1869
1824
|
group: "4_sheet-edit"
|
|
1870
1825
|
};
|
|
1871
|
-
var
|
|
1872
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
1826
|
+
var zi = Object.getOwnPropertyDescriptor, Zi = (e, t, n, o) => {
|
|
1827
|
+
for (var r = o > 1 ? void 0 : o ? zi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
1873
1828
|
(i = e[s]) && (r = i(r) || r);
|
|
1874
1829
|
return r;
|
|
1875
1830
|
}, Ke = (e, t) => (n, o) => t(n, o, e);
|
|
1876
|
-
let qt = class extends
|
|
1831
|
+
let qt = class extends at {
|
|
1877
1832
|
constructor(e, t, n, o, r, s, i) {
|
|
1878
1833
|
super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = i, this._initialize();
|
|
1879
1834
|
}
|
|
@@ -1881,75 +1836,75 @@ let qt = class extends ze {
|
|
|
1881
1836
|
this._registerCommands(), this._registerMenus(), this._registerShortcuts(), this._registerComponents(), this._registerRenderModules();
|
|
1882
1837
|
}
|
|
1883
1838
|
_registerMenus() {
|
|
1884
|
-
this._menuManagerService.mergeMenu(
|
|
1839
|
+
this._menuManagerService.mergeMenu(bi);
|
|
1885
1840
|
}
|
|
1886
1841
|
_registerCommands() {
|
|
1887
1842
|
[
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1843
|
+
En,
|
|
1844
|
+
bn,
|
|
1845
|
+
ne,
|
|
1846
|
+
he,
|
|
1847
|
+
Bs,
|
|
1848
|
+
Ls,
|
|
1849
|
+
ht,
|
|
1850
|
+
Nr
|
|
1896
1851
|
].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
|
|
1897
1852
|
}
|
|
1898
1853
|
_registerShortcuts() {
|
|
1899
1854
|
[
|
|
1900
|
-
...Wi(),
|
|
1901
1855
|
...Hi(),
|
|
1902
1856
|
...Bi(),
|
|
1903
1857
|
...qi(),
|
|
1904
|
-
...
|
|
1905
|
-
Yi,
|
|
1906
|
-
|
|
1858
|
+
...ji(),
|
|
1859
|
+
...Yi(),
|
|
1860
|
+
Gi,
|
|
1861
|
+
Ki
|
|
1907
1862
|
].forEach((e) => {
|
|
1908
1863
|
this.disposeWithMe(this._shortcutService.registerShortcut(e));
|
|
1909
1864
|
});
|
|
1910
1865
|
}
|
|
1911
1866
|
_registerComponents() {
|
|
1912
|
-
this.disposeWithMe(this._uiPartsService.registerComponent(
|
|
1867
|
+
this.disposeWithMe(this._uiPartsService.registerComponent(Oo.FORMULA_AUX, () => Er(yi, this._injector))), this._componentManager.register(Or, Pi);
|
|
1913
1868
|
}
|
|
1914
1869
|
_registerRenderModules() {
|
|
1915
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
1870
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, [Ht]));
|
|
1916
1871
|
}
|
|
1917
1872
|
};
|
|
1918
|
-
qt =
|
|
1919
|
-
Ke(0, q(
|
|
1920
|
-
Ke(1,
|
|
1921
|
-
Ke(2,
|
|
1922
|
-
Ke(3,
|
|
1923
|
-
Ke(4,
|
|
1873
|
+
qt = Zi([
|
|
1874
|
+
Ke(0, q(Rt)),
|
|
1875
|
+
Ke(1, _s),
|
|
1876
|
+
Ke(2, ve),
|
|
1877
|
+
Ke(3, Yt),
|
|
1878
|
+
Ke(4, Rr),
|
|
1924
1879
|
Ke(5, Te),
|
|
1925
|
-
Ke(6, q(
|
|
1880
|
+
Ke(6, q(Ir))
|
|
1926
1881
|
], qt);
|
|
1927
|
-
var
|
|
1928
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
1882
|
+
var Xi = Object.getOwnPropertyDescriptor, Qi = (e, t, n, o) => {
|
|
1883
|
+
for (var r = o > 1 ? void 0 : o ? Xi(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
1929
1884
|
(i = e[s]) && (r = i(r) || r);
|
|
1930
1885
|
return r;
|
|
1931
|
-
},
|
|
1932
|
-
let jt = class extends
|
|
1886
|
+
}, tn = (e, t) => (n, o) => t(n, o, e);
|
|
1887
|
+
let jt = class extends at {
|
|
1933
1888
|
constructor(e, t, n) {
|
|
1934
1889
|
super(), this._imageFormulaCellInterceptorController = e, this._renderManagerService = t, this._univerInstanceService = n, this._imageFormulaCellInterceptorController.registerRefreshRenderFunction(() => {
|
|
1935
|
-
const o = this._univerInstanceService.getCurrentUnitOfType(
|
|
1890
|
+
const o = this._univerInstanceService.getCurrentUnitOfType(B.UNIVER_SHEET);
|
|
1936
1891
|
if (!o) return;
|
|
1937
1892
|
const r = this._renderManagerService.getRenderById(o.getUnitId());
|
|
1938
1893
|
if (!r) return;
|
|
1939
|
-
r.with(
|
|
1894
|
+
r.with(Et).reCalculate();
|
|
1940
1895
|
const s = r.mainComponent;
|
|
1941
1896
|
s && s.makeDirty();
|
|
1942
1897
|
});
|
|
1943
1898
|
}
|
|
1944
1899
|
};
|
|
1945
|
-
jt =
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1900
|
+
jt = Qi([
|
|
1901
|
+
tn(0, q(ms)),
|
|
1902
|
+
tn(1, Te),
|
|
1903
|
+
tn(2, re)
|
|
1949
1904
|
], jt);
|
|
1950
|
-
class
|
|
1905
|
+
class Vr {
|
|
1951
1906
|
constructor() {
|
|
1952
|
-
j(this, "_currentSelector$", new
|
|
1907
|
+
j(this, "_currentSelector$", new fr(null));
|
|
1953
1908
|
j(this, "currentSelector$", this._currentSelector$.asObservable());
|
|
1954
1909
|
}
|
|
1955
1910
|
showRangeSelectorDialog(t) {
|
|
@@ -1961,12 +1916,12 @@ class Wr {
|
|
|
1961
1916
|
return this._currentSelector$.next(t), o;
|
|
1962
1917
|
}
|
|
1963
1918
|
}
|
|
1964
|
-
var
|
|
1965
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
1919
|
+
var Ji = Object.getOwnPropertyDescriptor, ec = (e, t, n, o) => {
|
|
1920
|
+
for (var r = o > 1 ? void 0 : o ? Ji(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
1966
1921
|
(i = e[s]) && (r = i(r) || r);
|
|
1967
1922
|
return r;
|
|
1968
|
-
},
|
|
1969
|
-
let
|
|
1923
|
+
}, nt = (e, t) => (n, o) => t(n, o, e);
|
|
1924
|
+
let Ue = class extends No {
|
|
1970
1925
|
constructor(t, n, o, r, s, i, c) {
|
|
1971
1926
|
super(
|
|
1972
1927
|
n,
|
|
@@ -1977,7 +1932,7 @@ let Le = class extends Mo {
|
|
|
1977
1932
|
);
|
|
1978
1933
|
j(this, "_workbookSelections");
|
|
1979
1934
|
j(this, "_eventDisposables");
|
|
1980
|
-
this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(
|
|
1935
|
+
this._context = t, this._contextService = i, this._refSelectionsService = c, this._workbookSelections = this._refSelectionsService.getWorkbookSelections(this._context.unitId), this._initSelectionChangeListener(), this._initSkeletonChangeListener(), this._initUserActionSyncListener(), this._setSelectionStyle(tc(this._themeService)), this._remainLastEnabled = !0, this._highlightHeader = !1;
|
|
1981
1936
|
}
|
|
1982
1937
|
getLocation() {
|
|
1983
1938
|
return this._skeleton.getLocation();
|
|
@@ -2001,7 +1956,7 @@ let Le = class extends Mo {
|
|
|
2001
1956
|
* Call this method and user will be able to select on the canvas to update selections.
|
|
2002
1957
|
*/
|
|
2003
1958
|
enableSelectionChanging() {
|
|
2004
|
-
return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(),
|
|
1959
|
+
return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), rr(() => this._disableSelectionChanging());
|
|
2005
1960
|
}
|
|
2006
1961
|
_disableSelectionChanging() {
|
|
2007
1962
|
var t;
|
|
@@ -2012,26 +1967,26 @@ let Le = class extends Mo {
|
|
|
2012
1967
|
}
|
|
2013
1968
|
_initCanvasEventListeners() {
|
|
2014
1969
|
const t = this._getSheetObject(), { spreadsheetRowHeader: n, spreadsheetColumnHeader: o, spreadsheet: r, spreadsheetLeftTopPlaceholder: s } = t, { scene: i } = this._context, c = new Ye();
|
|
2015
|
-
return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a,
|
|
2016
|
-
this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1,
|
|
1970
|
+
return c.add(r == null ? void 0 : r.onPointerDown$.subscribeEvent((a, h) => {
|
|
1971
|
+
this.inRefSelectionMode() && (this._onPointerDown(a, r.zIndex + 1, Ee.NORMAL, this._getActiveViewport(a)), a.button !== 2 && h.stopPropagation());
|
|
2017
1972
|
})), c.add(
|
|
2018
|
-
n == null ? void 0 : n.onPointerDown$.subscribeEvent((a,
|
|
1973
|
+
n == null ? void 0 : n.onPointerDown$.subscribeEvent((a, h) => {
|
|
2019
1974
|
if (!this.inRefSelectionMode()) return;
|
|
2020
|
-
const
|
|
2021
|
-
|
|
1975
|
+
const g = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: p } = $n(a.offsetX, a.offsetY, i, g);
|
|
1976
|
+
Pn(this._workbookSelections.getCurrentSelections(), p, Ee.ROW) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ee.ROW, this._getActiveViewport(a), Qt.Y), a.button !== 2 && h.stopPropagation());
|
|
2022
1977
|
})
|
|
2023
|
-
), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a,
|
|
1978
|
+
), c.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((a, h) => {
|
|
2024
1979
|
if (!this.inRefSelectionMode()) return;
|
|
2025
|
-
const
|
|
2026
|
-
|
|
2027
|
-
})), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a,
|
|
1980
|
+
const g = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: p } = $n(a.offsetX, a.offsetY, i, g);
|
|
1981
|
+
Pn(this._workbookSelections.getCurrentSelections(), p, Ee.COLUMN) || (this._onPointerDown(a, (r.zIndex || 1) + 1, Ee.COLUMN, this._getActiveViewport(a), Qt.X), a.button !== 2 && h.stopPropagation());
|
|
1982
|
+
})), c.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((a, h) => {
|
|
2028
1983
|
if (this._reset(), !this.inRefSelectionMode()) return;
|
|
2029
|
-
const
|
|
2030
|
-
this._addSelectionControlByModelData(
|
|
1984
|
+
const g = this._sheetSkeletonManagerService.getCurrent().skeleton, p = Mo(g);
|
|
1985
|
+
this._addSelectionControlByModelData(p), this._selectionMoveStart$.next(this.getSelectionDataWithStyle());
|
|
2031
1986
|
const u = i.onPointerUp$.subscribeEvent(() => {
|
|
2032
1987
|
u.unsubscribe(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle());
|
|
2033
1988
|
});
|
|
2034
|
-
a.button !== 2 &&
|
|
1989
|
+
a.button !== 2 && h.stopPropagation();
|
|
2035
1990
|
})), c;
|
|
2036
1991
|
}
|
|
2037
1992
|
/**
|
|
@@ -2041,7 +1996,7 @@ let Le = class extends Mo {
|
|
|
2041
1996
|
*/
|
|
2042
1997
|
_addSelectionControlByModelData(t) {
|
|
2043
1998
|
var i;
|
|
2044
|
-
const n = this._skeleton, o = (i = t.style) != null ? i :
|
|
1999
|
+
const n = this._skeleton, o = (i = t.style) != null ? i : lr(this._themeService), r = this._scene;
|
|
2045
2000
|
return t.style = o, this.newSelectionControl(r, n, t);
|
|
2046
2001
|
}
|
|
2047
2002
|
_initSelectionChangeListener() {
|
|
@@ -2054,18 +2009,18 @@ let Le = class extends Mo {
|
|
|
2054
2009
|
*/
|
|
2055
2010
|
_initUserActionSyncListener() {
|
|
2056
2011
|
this.disposeWithMe(this.selectionMoveStart$.subscribe((t) => {
|
|
2057
|
-
this._updateSelections(t,
|
|
2012
|
+
this._updateSelections(t, Jt.MOVE_START);
|
|
2058
2013
|
})), this.disposeWithMe(this.selectionMoving$.subscribe((t) => {
|
|
2059
|
-
this._updateSelections(t,
|
|
2014
|
+
this._updateSelections(t, Jt.MOVING);
|
|
2060
2015
|
})), this.disposeWithMe(this.selectionMoveEnd$.subscribe((t) => {
|
|
2061
|
-
this._updateSelections(t,
|
|
2016
|
+
this._updateSelections(t, Jt.MOVE_END);
|
|
2062
2017
|
}));
|
|
2063
2018
|
}
|
|
2064
2019
|
_updateSelections(t, n) {
|
|
2065
2020
|
const r = this._context.unit.getActiveSheet().getSheetId();
|
|
2066
2021
|
t.length !== 0 && this._workbookSelections.setSelections(
|
|
2067
2022
|
r,
|
|
2068
|
-
t.map((s) =>
|
|
2023
|
+
t.map((s) => ls(s)),
|
|
2069
2024
|
n
|
|
2070
2025
|
);
|
|
2071
2026
|
}
|
|
@@ -2074,7 +2029,7 @@ let Le = class extends Mo {
|
|
|
2074
2029
|
var i;
|
|
2075
2030
|
if (!t)
|
|
2076
2031
|
return;
|
|
2077
|
-
const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(
|
|
2032
|
+
const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(Bn.VIEW_MAIN);
|
|
2078
2033
|
this._skeleton && ((i = this._skeleton.worksheet) == null ? void 0 : i.getSheetId()) !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
|
|
2079
2034
|
const s = this._workbookSelections.getCurrentSelections();
|
|
2080
2035
|
this.resetSelectionsByModelData(s);
|
|
@@ -2082,10 +2037,10 @@ let Le = class extends Mo {
|
|
|
2082
2037
|
}
|
|
2083
2038
|
_getActiveViewport(t) {
|
|
2084
2039
|
const n = this._getSheetObject();
|
|
2085
|
-
return n == null ? void 0 : n.scene.getActiveViewportByCoord(
|
|
2040
|
+
return n == null ? void 0 : n.scene.getActiveViewportByCoord(qn.FromArray([t.offsetX, t.offsetY]));
|
|
2086
2041
|
}
|
|
2087
2042
|
_getSheetObject() {
|
|
2088
|
-
return
|
|
2043
|
+
return xo(this._context.unit, this._context);
|
|
2089
2044
|
}
|
|
2090
2045
|
/**
|
|
2091
2046
|
* Handle pointer down event, bind pointermove & pointerup handler.
|
|
@@ -2098,79 +2053,79 @@ let Le = class extends Mo {
|
|
|
2098
2053
|
* @param scrollTimerType
|
|
2099
2054
|
*/
|
|
2100
2055
|
// eslint-disable-next-line complexity, max-lines-per-function
|
|
2101
|
-
_onPointerDown(t, n = 0, o =
|
|
2056
|
+
_onPointerDown(t, n = 0, o = Ee.NORMAL, r, s = Qt.ALL) {
|
|
2102
2057
|
var N;
|
|
2103
2058
|
this._rangeType = o;
|
|
2104
2059
|
const i = this._skeleton, c = this._scene;
|
|
2105
2060
|
if (!c || !i)
|
|
2106
2061
|
return;
|
|
2107
2062
|
r && (this._activeViewport = r);
|
|
2108
|
-
const { offsetX: a, offsetY:
|
|
2109
|
-
if (!f) return;
|
|
2110
|
-
const m = c.getCoordRelativeToViewport(Yn.FromArray([a, d])), { x: u, y: h } = m;
|
|
2111
|
-
this._startViewportPosX = u, this._startViewportPosY = h;
|
|
2112
|
-
const l = c.getScrollXYInfoByViewport(m), { scaleX: S, scaleY: v } = c.getAncestorScale(), g = this._skeleton.getCellByOffset(u, h, S, v, l);
|
|
2063
|
+
const { offsetX: a, offsetY: h } = t, g = c.getViewport(Bn.VIEW_MAIN);
|
|
2113
2064
|
if (!g) return;
|
|
2065
|
+
const p = c.getCoordRelativeToViewport(qn.FromArray([a, h])), { x: u, y: d } = p;
|
|
2066
|
+
this._startViewportPosX = u, this._startViewportPosY = d;
|
|
2067
|
+
const l = c.getScrollXYInfoByViewport(p), { scaleX: S, scaleY: v } = c.getAncestorScale(), f = this._skeleton.getCellByOffset(u, d, S, v, l);
|
|
2068
|
+
if (!f) return;
|
|
2114
2069
|
switch (o) {
|
|
2115
|
-
case
|
|
2070
|
+
case Ee.NORMAL:
|
|
2116
2071
|
break;
|
|
2117
|
-
case
|
|
2118
|
-
|
|
2072
|
+
case Ee.ROW:
|
|
2073
|
+
f.startColumn = 0, f.endColumn = this._skeleton.getColumnCount() - 1;
|
|
2119
2074
|
break;
|
|
2120
|
-
case
|
|
2121
|
-
|
|
2075
|
+
case Ee.COLUMN:
|
|
2076
|
+
f.startRow = 0, f.endRow = this._skeleton.getRowCount() - 1;
|
|
2122
2077
|
break;
|
|
2123
|
-
case
|
|
2124
|
-
|
|
2078
|
+
case Ee.ALL:
|
|
2079
|
+
f.startRow = 0, f.startColumn = 0, f.endRow = this._skeleton.getRowCount() - 1, f.endColumn = this._skeleton.getColumnCount() - 1;
|
|
2125
2080
|
}
|
|
2126
|
-
let C = { range:
|
|
2127
|
-
(
|
|
2081
|
+
let C = { range: f, primary: f, style: null };
|
|
2082
|
+
(f.isMerged || f.isMergedMainCell) && (C = {
|
|
2128
2083
|
range: {
|
|
2129
|
-
...
|
|
2130
|
-
startRow:
|
|
2131
|
-
endRow:
|
|
2132
|
-
startColumn:
|
|
2133
|
-
endColumn:
|
|
2084
|
+
...f,
|
|
2085
|
+
startRow: f.startRow,
|
|
2086
|
+
endRow: f.startRow,
|
|
2087
|
+
startColumn: f.startColumn,
|
|
2088
|
+
endColumn: f.startColumn
|
|
2134
2089
|
},
|
|
2135
2090
|
primary: {
|
|
2136
|
-
...
|
|
2137
|
-
actualRow:
|
|
2138
|
-
actualColumn:
|
|
2139
|
-
startRow:
|
|
2140
|
-
endRow:
|
|
2141
|
-
startColumn:
|
|
2142
|
-
endColumn:
|
|
2091
|
+
...f,
|
|
2092
|
+
actualRow: f.startRow,
|
|
2093
|
+
actualColumn: f.startColumn,
|
|
2094
|
+
startRow: f.startRow,
|
|
2095
|
+
endRow: f.startRow,
|
|
2096
|
+
startColumn: f.startColumn,
|
|
2097
|
+
endColumn: f.startColumn
|
|
2143
2098
|
},
|
|
2144
2099
|
style: null
|
|
2145
2100
|
}), C.range.rangeType = o;
|
|
2146
|
-
const
|
|
2147
|
-
this._startRangeWhenPointerDown = { ...
|
|
2148
|
-
const E = { ...
|
|
2149
|
-
let
|
|
2150
|
-
const
|
|
2151
|
-
for (const M of
|
|
2152
|
-
if (t.button === 2 &&
|
|
2153
|
-
|
|
2101
|
+
const I = rn(C, this._skeleton);
|
|
2102
|
+
this._startRangeWhenPointerDown = { ...I.rangeWithCoord };
|
|
2103
|
+
const E = { ...I.rangeWithCoord, rangeType: o };
|
|
2104
|
+
let m = this.getActiveSelectionControl();
|
|
2105
|
+
const y = this.getSelectionControls();
|
|
2106
|
+
for (const M of y) {
|
|
2107
|
+
if (t.button === 2 && un.contains(M.model, E)) {
|
|
2108
|
+
m = M;
|
|
2154
2109
|
return;
|
|
2155
2110
|
}
|
|
2156
2111
|
if (M.model.isEqual(E)) {
|
|
2157
|
-
|
|
2112
|
+
m = M;
|
|
2158
2113
|
break;
|
|
2159
2114
|
}
|
|
2160
2115
|
}
|
|
2161
2116
|
this._checkClearPreviousControls(t);
|
|
2162
|
-
const T =
|
|
2163
|
-
|
|
2117
|
+
const T = m == null ? void 0 : m.model.currentCell, A = t.shiftKey && T, k = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
|
|
2118
|
+
A && T ? this._makeSelectionByTwoCells(
|
|
2164
2119
|
T,
|
|
2165
2120
|
E,
|
|
2166
2121
|
i,
|
|
2167
2122
|
o,
|
|
2168
|
-
|
|
2123
|
+
m
|
|
2169
2124
|
// Get updated in this method
|
|
2170
|
-
) :
|
|
2125
|
+
) : k && m ? m.updateRangeBySelectionWithCoord(I) : m = this.newSelectionControl(c, i, C);
|
|
2171
2126
|
for (let M = 0; M < this.getSelectionControls().length - 1; M++)
|
|
2172
2127
|
this.getSelectionControls()[M].clearHighlight();
|
|
2173
|
-
this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(
|
|
2128
|
+
this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), c.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (N = c.getTransformer()) == null || N.clearSelectedObjects(), this._setupPointerMoveListener(g, m, o, s, u, d), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = c.onPointerUp$.subscribeEvent(() => {
|
|
2174
2129
|
var M;
|
|
2175
2130
|
this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (M = this._escapeShortcutDisposable) == null || M.dispose(), this._escapeShortcutDisposable = null;
|
|
2176
2131
|
});
|
|
@@ -2183,12 +2138,12 @@ let Le = class extends Mo {
|
|
|
2183
2138
|
* @returns {SelectionControl} selectionControl just created
|
|
2184
2139
|
*/
|
|
2185
2140
|
newSelectionControl(t, n, o) {
|
|
2186
|
-
const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new
|
|
2141
|
+
const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: i } = n, c = new ar(t, r, this._themeService, {
|
|
2187
2142
|
highlightHeader: this._highlightHeader,
|
|
2188
2143
|
enableAutoFill: !1,
|
|
2189
2144
|
rowHeaderWidth: s,
|
|
2190
2145
|
columnHeaderHeight: i
|
|
2191
|
-
}), a =
|
|
2146
|
+
}), a = rn(o, n);
|
|
2192
2147
|
return c.updateRangeBySelectionWithCoord(a), this._selectionControls.push(c), c.setControlExtension({
|
|
2193
2148
|
skeleton: n,
|
|
2194
2149
|
scene: t,
|
|
@@ -2202,19 +2157,19 @@ let Le = class extends Mo {
|
|
|
2202
2157
|
}), c;
|
|
2203
2158
|
}
|
|
2204
2159
|
};
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
],
|
|
2213
|
-
function
|
|
2214
|
-
const t =
|
|
2160
|
+
Ue = ec([
|
|
2161
|
+
nt(1, q(Rt)),
|
|
2162
|
+
nt(2, q(It)),
|
|
2163
|
+
nt(3, Yt),
|
|
2164
|
+
nt(4, q(Et)),
|
|
2165
|
+
nt(5, ln),
|
|
2166
|
+
nt(6, Kt)
|
|
2167
|
+
], Ue);
|
|
2168
|
+
function tc(e) {
|
|
2169
|
+
const t = lr(e);
|
|
2215
2170
|
return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
|
|
2216
2171
|
}
|
|
2217
|
-
const
|
|
2172
|
+
const yn = (e, t, n = !0) => {
|
|
2218
2173
|
let o = -1;
|
|
2219
2174
|
return e.reduce((r, s, i) => {
|
|
2220
2175
|
if (r.isFinish)
|
|
@@ -2237,7 +2192,7 @@ const Nn = (e, t, n = !0) => {
|
|
|
2237
2192
|
typeof s != "string" && s.nodeType === Q.REFERENCE && o++;
|
|
2238
2193
|
}
|
|
2239
2194
|
return o;
|
|
2240
|
-
},
|
|
2195
|
+
}, nc = (e, t = 100) => {
|
|
2241
2196
|
P(() => {
|
|
2242
2197
|
let n = null;
|
|
2243
2198
|
const o = () => {
|
|
@@ -2251,70 +2206,70 @@ const Nn = (e, t, n = !0) => {
|
|
|
2251
2206
|
}, [e, t]);
|
|
2252
2207
|
};
|
|
2253
2208
|
function Br(e, t, n) {
|
|
2254
|
-
const o =
|
|
2255
|
-
var
|
|
2209
|
+
const o = b(ze), r = le(() => new fr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = b(Rn), i = b(re), c = ee(() => {
|
|
2210
|
+
var I;
|
|
2256
2211
|
const a = o.getEditor(e);
|
|
2257
2212
|
if (!a)
|
|
2258
2213
|
return;
|
|
2259
|
-
const
|
|
2214
|
+
const h = a.getBoundingClientRect(), { marginTop: g = 0, marginBottom: p = 0 } = a.getDocumentData().documentStyle, u = a.getSkeleton();
|
|
2260
2215
|
if (!u) return;
|
|
2261
|
-
const
|
|
2262
|
-
let { left: l, top: S, right: v, bottom:
|
|
2263
|
-
S = S +
|
|
2216
|
+
const d = (I = u.getSkeletonData()) == null ? void 0 : I.pages[0].height;
|
|
2217
|
+
let { left: l, top: S, right: v, bottom: f } = h;
|
|
2218
|
+
S = S + g, f = d ? S + d : f - p;
|
|
2264
2219
|
const C = r.getValue();
|
|
2265
|
-
if (!(C.left === l && C.top === S && C.right === v && C.bottom ===
|
|
2266
|
-
return r.next({ left: l - 1, right: v + 1, top: S - 1, bottom:
|
|
2220
|
+
if (!(C.left === l && C.top === S && C.right === v && C.bottom === f))
|
|
2221
|
+
return r.next({ left: l - 1, right: v + 1, top: S - 1, bottom: f + 1 }), h;
|
|
2267
2222
|
});
|
|
2268
2223
|
return P(() => {
|
|
2269
2224
|
t && c();
|
|
2270
|
-
}, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]),
|
|
2271
|
-
const a = s.scrollEvent$.pipe(
|
|
2225
|
+
}, [e, o, i.unitAdded$, c, t, ...n != null ? n : []]), nc(c), P(() => {
|
|
2226
|
+
const a = s.scrollEvent$.pipe(jo(100)).subscribe(c);
|
|
2272
2227
|
return () => {
|
|
2273
2228
|
a.unsubscribe();
|
|
2274
2229
|
};
|
|
2275
2230
|
}, []), [r, c];
|
|
2276
2231
|
}
|
|
2277
|
-
const
|
|
2232
|
+
const Qe = (e) => {
|
|
2278
2233
|
const t = X(e);
|
|
2279
2234
|
return t.current = e, t;
|
|
2280
|
-
},
|
|
2281
|
-
const o =
|
|
2282
|
-
|
|
2235
|
+
}, rc = (e, t, n) => {
|
|
2236
|
+
const o = b(Gt), r = b(dt), s = b(ke), [i, c] = V(), [a, h] = V(-1), [g, p] = V(!0), u = Qe(g), d = X(t);
|
|
2237
|
+
d.current = t;
|
|
2283
2238
|
const l = () => {
|
|
2284
|
-
c(void 0),
|
|
2239
|
+
c(void 0), h(-1), p(!1);
|
|
2285
2240
|
};
|
|
2286
2241
|
return P(() => {
|
|
2287
2242
|
const S = s.sequenceNodesBuilder(t.slice(1));
|
|
2288
2243
|
o.setSequenceNodes(S != null ? S : []);
|
|
2289
2244
|
}, [t]), P(() => {
|
|
2290
2245
|
if (n && e) {
|
|
2291
|
-
const S = n.selectionChange$.pipe(
|
|
2292
|
-
if (
|
|
2293
|
-
const [C] =
|
|
2246
|
+
const S = n.selectionChange$.pipe(Sn(50)).subscribe((f) => {
|
|
2247
|
+
if (f.textRanges.length === 1) {
|
|
2248
|
+
const [C] = f.textRanges;
|
|
2294
2249
|
if (C.collapsed && u.current) {
|
|
2295
|
-
const { startOffset:
|
|
2296
|
-
if (
|
|
2297
|
-
if (typeof
|
|
2298
|
-
const T = r.getFunctionInfo(
|
|
2299
|
-
c(T),
|
|
2250
|
+
const { startOffset: I } = C, E = o.getCurrentSequenceNodeIndex(I - 2), m = o.getCurrentSequenceNodeByIndex(E), y = o.getCurrentSequenceNodeByIndex(E + 1);
|
|
2251
|
+
if (m)
|
|
2252
|
+
if (typeof m != "string" && m.nodeType === 3 && !r.hasDefinedNameDescription(m.token.trim()) && y === Ge.OPEN_BRACKET) {
|
|
2253
|
+
const T = r.getFunctionInfo(m.token);
|
|
2254
|
+
c(T), h(-1);
|
|
2300
2255
|
return;
|
|
2301
2256
|
} else {
|
|
2302
|
-
const T = s.getFunctionAndParameter(`${
|
|
2257
|
+
const T = s.getFunctionAndParameter(`${d.current}A`, I - 1);
|
|
2303
2258
|
if (T) {
|
|
2304
|
-
const { functionName:
|
|
2305
|
-
c(N),
|
|
2259
|
+
const { functionName: A, paramIndex: k } = T, N = r.getFunctionInfo(A);
|
|
2260
|
+
c(N), h(k);
|
|
2306
2261
|
return;
|
|
2307
2262
|
}
|
|
2308
2263
|
}
|
|
2309
2264
|
}
|
|
2310
2265
|
}
|
|
2311
|
-
c(void 0),
|
|
2266
|
+
c(void 0), h(-1);
|
|
2312
2267
|
}), v = n.selectionChange$.pipe(
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2268
|
+
gr((f) => f.textRanges.length === 1),
|
|
2269
|
+
hr((f) => f.textRanges[0].startOffset),
|
|
2270
|
+
Ko()
|
|
2316
2271
|
).subscribe(() => {
|
|
2317
|
-
|
|
2272
|
+
p(!0);
|
|
2318
2273
|
});
|
|
2319
2274
|
return () => {
|
|
2320
2275
|
S.unsubscribe(), v.unsubscribe();
|
|
@@ -2327,18 +2282,18 @@ const rt = (e) => {
|
|
|
2327
2282
|
paramIndex: a,
|
|
2328
2283
|
reset: l
|
|
2329
2284
|
};
|
|
2330
|
-
},
|
|
2285
|
+
}, oc = ({ onClick: e }) => /* @__PURE__ */ x(
|
|
2331
2286
|
"div",
|
|
2332
2287
|
{
|
|
2333
2288
|
className: "univer-z-[15] univer-box-border univer-h-[18px] univer-cursor-pointer univer-overflow-visible univer-whitespace-nowrap univer-rounded-l univer-border univer-border-r-0 univer-border-gray-600 univer-bg-primary-600 univer-p-0.5 univer-text-xs univer-font-bold univer-leading-[13px] univer-text-white",
|
|
2334
2289
|
onClick: e,
|
|
2335
2290
|
children: "?"
|
|
2336
2291
|
}
|
|
2337
|
-
),
|
|
2292
|
+
), nn = ({ className: e, title: t, value: n }) => /* @__PURE__ */ H("div", { className: "univer-my-2", children: [
|
|
2338
2293
|
/* @__PURE__ */ x(
|
|
2339
2294
|
"div",
|
|
2340
2295
|
{
|
|
2341
|
-
className:
|
|
2296
|
+
className: ie("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
|
|
2342
2297
|
children: t
|
|
2343
2298
|
}
|
|
2344
2299
|
),
|
|
@@ -2349,50 +2304,53 @@ const rt = (e) => {
|
|
|
2349
2304
|
children: n
|
|
2350
2305
|
}
|
|
2351
2306
|
)
|
|
2352
|
-
] }),
|
|
2307
|
+
] }), sc = (e) => {
|
|
2353
2308
|
const { prefix: t, value: n, active: o, onClick: r } = e;
|
|
2354
|
-
return /* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2309
|
+
return /* @__PURE__ */ H("div", { children: [
|
|
2310
|
+
/* @__PURE__ */ H("span", { children: [
|
|
2356
2311
|
t,
|
|
2357
2312
|
"("
|
|
2358
2313
|
] }),
|
|
2359
|
-
n && n.map((s, i) => /* @__PURE__ */
|
|
2314
|
+
n && n.map((s, i) => /* @__PURE__ */ H("span", { children: [
|
|
2360
2315
|
/* @__PURE__ */ x(
|
|
2361
2316
|
"span",
|
|
2362
2317
|
{
|
|
2363
2318
|
className: o === i ? "univer-text-primary-500" : "",
|
|
2364
2319
|
onClick: () => r(i),
|
|
2365
|
-
children:
|
|
2320
|
+
children: Fr(s)
|
|
2366
2321
|
}
|
|
2367
2322
|
),
|
|
2368
2323
|
i === n.length - 1 ? "" : ","
|
|
2369
2324
|
] }, s.name)),
|
|
2370
2325
|
")"
|
|
2371
2326
|
] });
|
|
2372
|
-
},
|
|
2327
|
+
}, Xn = () => {
|
|
2373
2328
|
};
|
|
2374
|
-
function
|
|
2375
|
-
const { onParamsSwitch: t =
|
|
2376
|
-
function C(
|
|
2377
|
-
t && t(
|
|
2329
|
+
function ic(e) {
|
|
2330
|
+
const { onParamsSwitch: t = Xn, onClose: n = Xn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: i, paramIndex: c, reset: a } = rc(o, s, r), h = b(mn), g = !Re(h.helpFunctionVisible$), [p, u] = V(!1), d = b(lt), l = d.t("formula.prompt.required"), S = d.t("formula.prompt.optional"), v = r.getEditorId(), [f] = Br(v, !!i, [i, c]);
|
|
2331
|
+
function C(m) {
|
|
2332
|
+
t && t(m);
|
|
2378
2333
|
}
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2334
|
+
const I = ee((m) => {
|
|
2335
|
+
h.helpFunctionVisible$.next(!m);
|
|
2381
2336
|
}), E = () => {
|
|
2382
|
-
|
|
2337
|
+
I(!0), n();
|
|
2383
2338
|
};
|
|
2384
|
-
return i ?
|
|
2339
|
+
return i ? g ? /* @__PURE__ */ x(on, { portal: !0, anchorRect$: f, direction: "left-center", children: /* @__PURE__ */ x(oc, { onClick: () => I(!1) }) }, "hidden") : /* @__PURE__ */ x(on, { portal: !0, onClickOutside: () => a(), anchorRect$: f, direction: "vertical", children: /* @__PURE__ */ H(
|
|
2385
2340
|
"div",
|
|
2386
2341
|
{
|
|
2387
|
-
className:
|
|
2342
|
+
className: ie("univer-m-0 univer-box-border univer-w-[250px] univer-select-none univer-list-none univer-rounded-lg univer-bg-white univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", In),
|
|
2388
2343
|
children: [
|
|
2389
|
-
/* @__PURE__ */
|
|
2344
|
+
/* @__PURE__ */ H(
|
|
2390
2345
|
"div",
|
|
2391
2346
|
{
|
|
2392
|
-
className:
|
|
2347
|
+
className: ie("univer-box-border univer-flex univer-items-center univer-justify-between univer-px-4 univer-py-3 univer-text-xs univer-font-medium univer-text-gray-900 dark:!univer-text-white", Ns),
|
|
2348
|
+
style: {
|
|
2349
|
+
overflowWrap: "anywhere"
|
|
2350
|
+
},
|
|
2393
2351
|
children: [
|
|
2394
2352
|
/* @__PURE__ */ x(
|
|
2395
|
-
|
|
2353
|
+
sc,
|
|
2396
2354
|
{
|
|
2397
2355
|
prefix: i.functionName,
|
|
2398
2356
|
value: i.functionParameter,
|
|
@@ -2400,13 +2358,13 @@ function sc(e) {
|
|
|
2400
2358
|
onClick: C
|
|
2401
2359
|
}
|
|
2402
2360
|
),
|
|
2403
|
-
/* @__PURE__ */
|
|
2361
|
+
/* @__PURE__ */ H("div", { className: "univer-flex", children: [
|
|
2404
2362
|
/* @__PURE__ */ x(
|
|
2405
2363
|
"div",
|
|
2406
2364
|
{
|
|
2407
2365
|
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-500 univer-outline-none univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",
|
|
2408
|
-
style: { transform:
|
|
2409
|
-
onClick: () => u(!
|
|
2366
|
+
style: { transform: p ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
|
|
2367
|
+
onClick: () => u(!p),
|
|
2410
2368
|
children: /* @__PURE__ */ x(Ur, {})
|
|
2411
2369
|
}
|
|
2412
2370
|
),
|
|
@@ -2425,34 +2383,34 @@ function sc(e) {
|
|
|
2425
2383
|
/* @__PURE__ */ x(
|
|
2426
2384
|
"div",
|
|
2427
2385
|
{
|
|
2428
|
-
className:
|
|
2386
|
+
className: ie("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", it),
|
|
2429
2387
|
style: {
|
|
2430
|
-
height:
|
|
2431
|
-
padding:
|
|
2388
|
+
height: p ? "unset" : 0,
|
|
2389
|
+
padding: p ? "revert-layer" : 0
|
|
2432
2390
|
},
|
|
2433
|
-
children: /* @__PURE__ */
|
|
2391
|
+
children: /* @__PURE__ */ H("div", { className: "univer-mt-3", children: [
|
|
2434
2392
|
/* @__PURE__ */ x(
|
|
2435
|
-
|
|
2393
|
+
nn,
|
|
2436
2394
|
{
|
|
2437
|
-
title:
|
|
2438
|
-
value: `${i.functionName}(${i.functionParameter.map((
|
|
2395
|
+
title: d.t("formula.prompt.helpExample"),
|
|
2396
|
+
value: `${i.functionName}(${i.functionParameter.map((m) => m.example).join(",")})`
|
|
2439
2397
|
}
|
|
2440
2398
|
),
|
|
2441
2399
|
/* @__PURE__ */ x(
|
|
2442
|
-
|
|
2400
|
+
nn,
|
|
2443
2401
|
{
|
|
2444
|
-
title:
|
|
2402
|
+
title: d.t("formula.prompt.helpAbstract"),
|
|
2445
2403
|
value: i.description
|
|
2446
2404
|
}
|
|
2447
2405
|
),
|
|
2448
|
-
i && i.functionParameter && i.functionParameter.map((
|
|
2449
|
-
|
|
2406
|
+
i && i.functionParameter && i.functionParameter.map((m, y) => /* @__PURE__ */ x(
|
|
2407
|
+
nn,
|
|
2450
2408
|
{
|
|
2451
|
-
className: c ===
|
|
2452
|
-
title:
|
|
2453
|
-
value: `${
|
|
2409
|
+
className: c === y ? "univer-text-primary-500" : "",
|
|
2410
|
+
title: m.name,
|
|
2411
|
+
value: `${m.require ? l : S} ${m.detail}`
|
|
2454
2412
|
},
|
|
2455
|
-
|
|
2413
|
+
y
|
|
2456
2414
|
))
|
|
2457
2415
|
] })
|
|
2458
2416
|
}
|
|
@@ -2461,14 +2419,14 @@ function sc(e) {
|
|
|
2461
2419
|
}
|
|
2462
2420
|
) }, "show") : null;
|
|
2463
2421
|
}
|
|
2464
|
-
const
|
|
2465
|
-
const t =
|
|
2422
|
+
const cc = (e) => {
|
|
2423
|
+
const t = b(ze);
|
|
2466
2424
|
return ee((o) => {
|
|
2467
2425
|
var r, s;
|
|
2468
2426
|
if (e) {
|
|
2469
2427
|
t.focus(e.getEditorId());
|
|
2470
2428
|
const i = [...e.getSelectionRanges()];
|
|
2471
|
-
if (
|
|
2429
|
+
if (nr.isDefine(o))
|
|
2472
2430
|
e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
|
|
2473
2431
|
else if (!i.length && !e.docSelectionRenderService.isOnPointerEvent) {
|
|
2474
2432
|
const c = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
|
|
@@ -2479,99 +2437,99 @@ const ic = (e) => {
|
|
|
2479
2437
|
}
|
|
2480
2438
|
});
|
|
2481
2439
|
};
|
|
2482
|
-
function
|
|
2440
|
+
function ac(e) {
|
|
2483
2441
|
var r, s;
|
|
2484
|
-
const n = e.get(
|
|
2442
|
+
const n = e.get(re).getCurrentUniverDocInstance();
|
|
2485
2443
|
return n != null && n.getBody() ? { dataStream: (s = (r = n.getBody()) == null ? void 0 : r.dataStream) != null ? s : "", offset: 0 } : void 0;
|
|
2486
2444
|
}
|
|
2487
|
-
var
|
|
2445
|
+
var we = /* @__PURE__ */ ((e) => (e[e.NOT_SELECT = 0] = "NOT_SELECT", e[e.NEED_ADD = 1] = "NEED_ADD", e[e.CAN_EDIT = 2] = "CAN_EDIT", e[e.EDIT_OTHER_SHEET_REFERENCE = 3] = "EDIT_OTHER_SHEET_REFERENCE", e[e.EDIT_OTHER_WORKBOOK_REFERENCE = 4] = "EDIT_OTHER_WORKBOOK_REFERENCE", e))(we || {});
|
|
2488
2446
|
function lc(e) {
|
|
2489
2447
|
var T;
|
|
2490
|
-
const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i =
|
|
2448
|
+
const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, i = b(Te), c = b(re), a = i.getRenderById(r), h = i.getRenderById(t), g = h == null ? void 0 : h.with(mr), p = b(yr), u = b(Rt), [d, l] = V(
|
|
2491
2449
|
0
|
|
2492
2450
|
/* NOT_SELECT */
|
|
2493
|
-
), S =
|
|
2494
|
-
|
|
2495
|
-
|
|
2451
|
+
), S = b(ke), v = X(!0), f = a == null ? void 0 : a.with(Ue), C = Qe(d), I = c.getUnit(r, B.UNIVER_SHEET), E = I == null ? void 0 : I.getSheetBySheetId(s), m = ee((A) => {
|
|
2452
|
+
f && f.setSkipLastEnabled(
|
|
2453
|
+
A === 1 || A === 3 || A === 4
|
|
2496
2454
|
/* EDIT_OTHER_WORKBOOK_REFERENCE */
|
|
2497
|
-
), C.current =
|
|
2498
|
-
}),
|
|
2499
|
-
var Y,
|
|
2500
|
-
const
|
|
2501
|
-
if (!
|
|
2502
|
-
const
|
|
2455
|
+
), C.current = A, l(A);
|
|
2456
|
+
}), y = ee(() => {
|
|
2457
|
+
var Y, oe, ge;
|
|
2458
|
+
const A = c.getCurrentUnitOfType(B.UNIVER_SHEET);
|
|
2459
|
+
if (!A) return;
|
|
2460
|
+
const k = A.getActiveSheet(), N = g == null ? void 0 : g.getActiveTextRange(), M = N != null && N.collapsed ? N.startOffset : -1, w = ac(u);
|
|
2503
2461
|
if (!w) return;
|
|
2504
|
-
const
|
|
2462
|
+
const F = (Y = w == null ? void 0 : w.dataStream) == null ? void 0 : Y.slice(0, -2), $ = ((oe = S.sequenceNodesBuilder(F)) != null ? oe : []).map((G) => typeof G == "object" ? G.nodeType === Q.REFERENCE ? {
|
|
2505
2463
|
...G,
|
|
2506
|
-
range:
|
|
2464
|
+
range: Po(G.token)
|
|
2507
2465
|
} : {
|
|
2508
2466
|
...G,
|
|
2509
2467
|
range: void 0
|
|
2510
|
-
} : G),
|
|
2511
|
-
if ((
|
|
2468
|
+
} : G), R = F[M - 1], _ = F[M], O = $.find((G) => typeof G == "object" && G.nodeType === Q.REFERENCE && M === G.endIndex + 2), D = R && Uo(R) && (!_ || Wo(_) && _ !== Ge.OPEN_BRACKET), U = !!O;
|
|
2469
|
+
if ((F == null ? void 0 : F.substring(0, 1)) === "=" && (D || U))
|
|
2512
2470
|
if (U) {
|
|
2513
2471
|
if (v.current)
|
|
2514
2472
|
return;
|
|
2515
|
-
const { sheetName: G, unitId: J } = O.range,
|
|
2516
|
-
J && J !==
|
|
2473
|
+
const { sheetName: G, unitId: J } = O.range, Je = (ge = c.getCurrentUnitOfType(B.UNIVER_SHEET)) == null ? void 0 : ge.getUnitId();
|
|
2474
|
+
J && J !== Je ? m(
|
|
2517
2475
|
4
|
|
2518
2476
|
/* EDIT_OTHER_WORKBOOK_REFERENCE */
|
|
2519
|
-
) : !G &&
|
|
2477
|
+
) : !G && k.getSheetId() === (E == null ? void 0 : E.getSheetId()) || G === k.getName() ? m(
|
|
2520
2478
|
2
|
|
2521
2479
|
/* CAN_EDIT */
|
|
2522
|
-
) :
|
|
2480
|
+
) : m(
|
|
2523
2481
|
3
|
|
2524
2482
|
/* EDIT_OTHER_SHEET_REFERENCE */
|
|
2525
2483
|
);
|
|
2526
2484
|
} else
|
|
2527
|
-
v.current = !1,
|
|
2485
|
+
v.current = !1, m(
|
|
2528
2486
|
1
|
|
2529
2487
|
/* NEED_ADD */
|
|
2530
2488
|
);
|
|
2531
2489
|
else
|
|
2532
|
-
|
|
2490
|
+
m(
|
|
2533
2491
|
0
|
|
2534
2492
|
/* NOT_SELECT */
|
|
2535
2493
|
);
|
|
2536
2494
|
});
|
|
2537
2495
|
return P(() => {
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2496
|
+
const A = p.textSelection$.pipe(gr((k) => k.unitId === t)).subscribe(() => {
|
|
2497
|
+
y();
|
|
2540
2498
|
});
|
|
2541
|
-
return () =>
|
|
2542
|
-
}, [
|
|
2543
|
-
n || (
|
|
2499
|
+
return () => A.unsubscribe();
|
|
2500
|
+
}, [y, p.textSelection$, t]), P(() => {
|
|
2501
|
+
n || (m(
|
|
2544
2502
|
0
|
|
2545
2503
|
/* NOT_SELECT */
|
|
2546
2504
|
), v.current = !0);
|
|
2547
|
-
}, [n,
|
|
2548
|
-
var
|
|
2505
|
+
}, [n, m]), P(() => {
|
|
2506
|
+
var k;
|
|
2549
2507
|
if (!o) return;
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2508
|
+
const A = (k = h == null ? void 0 : h.mainComponent) == null ? void 0 : k.onPointerDown$.subscribeEvent(() => {
|
|
2509
|
+
m(
|
|
2552
2510
|
0
|
|
2553
2511
|
/* NOT_SELECT */
|
|
2554
2512
|
), v.current = !0;
|
|
2555
2513
|
});
|
|
2556
|
-
return () =>
|
|
2557
|
-
}, [o, (T =
|
|
2514
|
+
return () => A == null ? void 0 : A.unsubscribe();
|
|
2515
|
+
}, [o, (T = h == null ? void 0 : h.mainComponent) == null ? void 0 : T.onPointerDown$, m]), P(() => {
|
|
2558
2516
|
if (!n) return;
|
|
2559
|
-
const
|
|
2560
|
-
|
|
2561
|
-
}),
|
|
2562
|
-
|
|
2517
|
+
const A = I == null ? void 0 : I.activeSheet$.subscribe(() => {
|
|
2518
|
+
y();
|
|
2519
|
+
}), k = c.getCurrentTypeOfUnit$(B.UNIVER_SHEET).subscribe(() => {
|
|
2520
|
+
y();
|
|
2563
2521
|
});
|
|
2564
2522
|
return () => {
|
|
2565
|
-
|
|
2523
|
+
A == null || A.unsubscribe(), k == null || k.unsubscribe();
|
|
2566
2524
|
};
|
|
2567
|
-
}, [
|
|
2525
|
+
}, [y, n, I == null ? void 0 : I.activeSheet$, c.getCurrentTypeOfUnit$]), { isSelecting: d, isSelectingRef: C };
|
|
2568
2526
|
}
|
|
2569
|
-
const
|
|
2570
|
-
const e =
|
|
2571
|
-
return
|
|
2527
|
+
const uc = () => {
|
|
2528
|
+
const e = b(ke);
|
|
2529
|
+
return Pt((n) => e.sequenceNodesBuilder(n) || [], [e]);
|
|
2572
2530
|
};
|
|
2573
|
-
function
|
|
2574
|
-
const o = new
|
|
2531
|
+
function dc(e, t, n) {
|
|
2532
|
+
const o = new fn(t).setAlpha(0.05).toRgbString();
|
|
2575
2533
|
return {
|
|
2576
2534
|
id: n,
|
|
2577
2535
|
strokeWidth: 1,
|
|
@@ -2584,7 +2542,7 @@ function uc(e, t, n) {
|
|
|
2584
2542
|
};
|
|
2585
2543
|
}
|
|
2586
2544
|
function qr(e) {
|
|
2587
|
-
var
|
|
2545
|
+
var I, E, m;
|
|
2588
2546
|
const {
|
|
2589
2547
|
unitId: t,
|
|
2590
2548
|
subUnitId: n,
|
|
@@ -2594,49 +2552,49 @@ function qr(e) {
|
|
|
2594
2552
|
refSelectionsService: i,
|
|
2595
2553
|
refSelectionsRenderService: c,
|
|
2596
2554
|
sheetSkeletonManagerService: a,
|
|
2597
|
-
themeService:
|
|
2598
|
-
univerInstanceService:
|
|
2599
|
-
} = e,
|
|
2600
|
-
if (!u || !
|
|
2555
|
+
themeService: h,
|
|
2556
|
+
univerInstanceService: g
|
|
2557
|
+
} = e, p = o.getUnitId(), u = g.getUnit(t, B.UNIVER_SHEET), d = u == null ? void 0 : u.getActiveSheet(), l = [];
|
|
2558
|
+
if (!u || !d) {
|
|
2601
2559
|
i.setSelections(l);
|
|
2602
2560
|
return;
|
|
2603
2561
|
}
|
|
2604
|
-
const S =
|
|
2562
|
+
const S = d.getSheetId(), v = (y) => {
|
|
2605
2563
|
var T;
|
|
2606
|
-
return (T = u == null ? void 0 : u.getSheetBySheetName(
|
|
2564
|
+
return (T = u == null ? void 0 : u.getSheetBySheetName(y)) == null ? void 0 : T.getSheetId();
|
|
2607
2565
|
};
|
|
2608
|
-
if (!((
|
|
2566
|
+
if (!((I = a == null ? void 0 : a.getWorksheetSkeleton(S)) == null ? void 0 : I.skeleton)) return;
|
|
2609
2567
|
const C = [];
|
|
2610
|
-
for (let
|
|
2611
|
-
const
|
|
2612
|
-
if (!O &&
|
|
2568
|
+
for (let y = 0, T = r.length; y < T; y++) {
|
|
2569
|
+
const A = r[y], { themeColor: k, token: N, refIndex: M, endIndex: w } = A, F = ut(N), { unitId: $, sheetName: R, range: _ } = F, O = v(R);
|
|
2570
|
+
if (!O && R || p !== t && $ !== p || $ && $ !== p || O && O !== S || !O && S !== n)
|
|
2613
2571
|
continue;
|
|
2614
|
-
const D =
|
|
2572
|
+
const D = us(_, d.getRowCount(), d.getColumnCount());
|
|
2615
2573
|
D.unitId = t, D.sheetId = S, l.push({
|
|
2616
2574
|
range: D,
|
|
2617
2575
|
primary: null,
|
|
2618
|
-
style:
|
|
2576
|
+
style: dc(h, k, M.toString())
|
|
2619
2577
|
}), C.push(w);
|
|
2620
2578
|
}
|
|
2621
2579
|
if (s) {
|
|
2622
|
-
const
|
|
2580
|
+
const y = (m = (E = s.getSelectionRanges()) == null ? void 0 : E[0]) == null ? void 0 : m.startOffset, T = C.findIndex((A) => A + 2 === y);
|
|
2623
2581
|
T !== -1 ? c == null || c.setActiveSelectionIndex(T) : c == null || c.resetActiveSelectionIndex();
|
|
2624
2582
|
}
|
|
2625
2583
|
return l;
|
|
2626
2584
|
}
|
|
2627
|
-
function
|
|
2628
|
-
const n =
|
|
2629
|
-
const
|
|
2630
|
-
if (!
|
|
2585
|
+
function hc(e, t) {
|
|
2586
|
+
const n = b(re), o = b(It), r = b(Kt), s = b(Te), i = Re(le(() => n.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [n])), c = i ? s.getRenderById(i.getUnitId()) : null, a = c == null ? void 0 : c.with(Ue), h = c == null ? void 0 : c.with(Et), g = ee((p, u) => {
|
|
2587
|
+
const d = n.getCurrentUnitOfType(B.UNIVER_SHEET);
|
|
2588
|
+
if (!d || a != null && a.selectionMoving) return;
|
|
2631
2589
|
const l = qr({
|
|
2632
2590
|
unitId: e,
|
|
2633
2591
|
subUnitId: t,
|
|
2634
|
-
currentWorkbook:
|
|
2635
|
-
refSelections:
|
|
2592
|
+
currentWorkbook: d,
|
|
2593
|
+
refSelections: p,
|
|
2636
2594
|
editor: u,
|
|
2637
2595
|
refSelectionsService: r,
|
|
2638
2596
|
refSelectionsRenderService: a,
|
|
2639
|
-
sheetSkeletonManagerService:
|
|
2597
|
+
sheetSkeletonManagerService: h,
|
|
2640
2598
|
themeService: o,
|
|
2641
2599
|
univerInstanceService: n
|
|
2642
2600
|
});
|
|
@@ -2645,50 +2603,50 @@ function dc(e, t) {
|
|
|
2645
2603
|
});
|
|
2646
2604
|
return P(() => () => {
|
|
2647
2605
|
a == null || a.resetActiveSelectionIndex();
|
|
2648
|
-
}, [a]),
|
|
2606
|
+
}, [a]), g;
|
|
2649
2607
|
}
|
|
2650
2608
|
function jr(e = "") {
|
|
2651
|
-
const t =
|
|
2652
|
-
return ee((i, c, a = !0,
|
|
2653
|
-
const
|
|
2654
|
-
if (!
|
|
2609
|
+
const t = b(dt), n = fc(), o = b(ve), r = le(() => e.length, [e]);
|
|
2610
|
+
return ee((i, c, a = !0, h) => {
|
|
2611
|
+
const g = i.getDocumentData(), p = i.getEditorId();
|
|
2612
|
+
if (!g)
|
|
2655
2613
|
return [];
|
|
2656
|
-
const u =
|
|
2614
|
+
const u = g.body;
|
|
2657
2615
|
if (!u)
|
|
2658
2616
|
return [];
|
|
2659
|
-
const
|
|
2660
|
-
if (!
|
|
2617
|
+
const d = u.dataStream.slice(0, u.dataStream.length - 2), l = { dataStream: "", ...g.body };
|
|
2618
|
+
if (!d.startsWith(e)) return [];
|
|
2661
2619
|
if (c == null || c.length === 0)
|
|
2662
|
-
return l.textRuns = [], o.syncExecuteCommand(
|
|
2663
|
-
unitId:
|
|
2664
|
-
body:
|
|
2620
|
+
return l.textRuns = [], o.syncExecuteCommand(Hn.id, {
|
|
2621
|
+
unitId: p,
|
|
2622
|
+
body: Dn(l, 0, l.dataStream.length - 2)
|
|
2665
2623
|
}), [];
|
|
2666
2624
|
{
|
|
2667
|
-
const { textRuns: S, refSelections: v } =
|
|
2668
|
-
r && S.forEach((
|
|
2669
|
-
|
|
2625
|
+
const { textRuns: S, refSelections: v } = gc(t, n, c);
|
|
2626
|
+
r && S.forEach((I) => {
|
|
2627
|
+
I.ed = I.ed + r, I.st = I.st + r;
|
|
2670
2628
|
}), l.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...S];
|
|
2671
|
-
const
|
|
2672
|
-
l.dataStream = `${e}${
|
|
2629
|
+
const f = c.reduce((I, E) => typeof E == "string" ? `${I}${E}` : `${I}${E.token}`, "");
|
|
2630
|
+
l.dataStream = `${e}${f}\r
|
|
2673
2631
|
`;
|
|
2674
2632
|
let C;
|
|
2675
2633
|
if (a) {
|
|
2676
2634
|
C = i.getSelectionRanges();
|
|
2677
|
-
const
|
|
2635
|
+
const I = l.dataStream.length - 2 + r;
|
|
2678
2636
|
C.forEach((E) => {
|
|
2679
|
-
E.startOffset = Math.max(0, Math.min(E.startOffset,
|
|
2637
|
+
E.startOffset = Math.max(0, Math.min(E.startOffset, I)), E.endOffset = Math.max(0, Math.min(E.endOffset, I));
|
|
2680
2638
|
});
|
|
2681
2639
|
}
|
|
2682
|
-
return o.syncExecuteCommand(
|
|
2683
|
-
unitId:
|
|
2684
|
-
body:
|
|
2685
|
-
textRanges:
|
|
2640
|
+
return o.syncExecuteCommand(Hn.id, {
|
|
2641
|
+
unitId: p,
|
|
2642
|
+
body: Dn(l, 0, l.dataStream.length - 2),
|
|
2643
|
+
textRanges: h != null ? h : C
|
|
2686
2644
|
}), v;
|
|
2687
2645
|
}
|
|
2688
2646
|
});
|
|
2689
2647
|
}
|
|
2690
|
-
function
|
|
2691
|
-
const e =
|
|
2648
|
+
function fc() {
|
|
2649
|
+
const e = b(It), t = e.getCurrentTheme();
|
|
2692
2650
|
return le(() => {
|
|
2693
2651
|
const o = [
|
|
2694
2652
|
e.getColorFromTheme("loop-color.1"),
|
|
@@ -2707,16 +2665,16 @@ function hc() {
|
|
|
2707
2665
|
return { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i };
|
|
2708
2666
|
}, [t]);
|
|
2709
2667
|
}
|
|
2710
|
-
function
|
|
2711
|
-
const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [],
|
|
2712
|
-
let
|
|
2713
|
-
for (let
|
|
2714
|
-
const
|
|
2715
|
-
if (typeof
|
|
2716
|
-
const
|
|
2668
|
+
function gc(e, t, n) {
|
|
2669
|
+
const { formulaRefColors: o, numberColor: r, stringColor: s, plainTextColor: i } = t, c = [], a = [], h = /* @__PURE__ */ new Map();
|
|
2670
|
+
let g = 0;
|
|
2671
|
+
for (let p = 0, u = n.length; p < u; p++) {
|
|
2672
|
+
const d = n[p];
|
|
2673
|
+
if (typeof d == "string") {
|
|
2674
|
+
const I = c[c.length - 1], E = I ? I.ed : 0, m = E + d.length;
|
|
2717
2675
|
c.push({
|
|
2718
2676
|
st: E,
|
|
2719
|
-
ed:
|
|
2677
|
+
ed: m,
|
|
2720
2678
|
ts: {
|
|
2721
2679
|
cl: {
|
|
2722
2680
|
rgb: i
|
|
@@ -2726,10 +2684,10 @@ function fc(e, t, n) {
|
|
|
2726
2684
|
});
|
|
2727
2685
|
continue;
|
|
2728
2686
|
}
|
|
2729
|
-
if (e.hasDefinedNameDescription(
|
|
2687
|
+
if (e.hasDefinedNameDescription(d.token.trim())) {
|
|
2730
2688
|
c.push({
|
|
2731
|
-
st:
|
|
2732
|
-
ed:
|
|
2689
|
+
st: d.startIndex,
|
|
2690
|
+
ed: d.endIndex + 1,
|
|
2733
2691
|
ts: {
|
|
2734
2692
|
cl: {
|
|
2735
2693
|
rgb: i
|
|
@@ -2739,21 +2697,21 @@ function fc(e, t, n) {
|
|
|
2739
2697
|
});
|
|
2740
2698
|
continue;
|
|
2741
2699
|
}
|
|
2742
|
-
const { startIndex: l, endIndex: S, nodeType: v, token:
|
|
2700
|
+
const { startIndex: l, endIndex: S, nodeType: v, token: f } = d;
|
|
2743
2701
|
let C = "";
|
|
2744
2702
|
if (v === Q.REFERENCE) {
|
|
2745
|
-
if (
|
|
2746
|
-
C =
|
|
2703
|
+
if (h.has(f))
|
|
2704
|
+
C = h.get(f);
|
|
2747
2705
|
else {
|
|
2748
|
-
const
|
|
2749
|
-
C = o[
|
|
2706
|
+
const I = g % o.length;
|
|
2707
|
+
C = o[I], h.set(f, C), g++;
|
|
2750
2708
|
}
|
|
2751
2709
|
a.push({
|
|
2752
|
-
refIndex:
|
|
2710
|
+
refIndex: p,
|
|
2753
2711
|
themeColor: C,
|
|
2754
|
-
token:
|
|
2755
|
-
startIndex:
|
|
2756
|
-
endIndex:
|
|
2712
|
+
token: f,
|
|
2713
|
+
startIndex: d.startIndex,
|
|
2714
|
+
endIndex: d.endIndex,
|
|
2757
2715
|
index: a.length
|
|
2758
2716
|
});
|
|
2759
2717
|
} else v === Q.NUMBER ? C = r : (v === Q.STRING || v === Q.ARRAY) && (C = s);
|
|
@@ -2779,166 +2737,166 @@ function fc(e, t, n) {
|
|
|
2779
2737
|
}
|
|
2780
2738
|
return { textRuns: c, refSelections: a };
|
|
2781
2739
|
}
|
|
2782
|
-
const
|
|
2783
|
-
const r =
|
|
2740
|
+
const mc = (e, t, n, o) => {
|
|
2741
|
+
const r = b(ve), s = b(Yt), i = X(t);
|
|
2784
2742
|
i.current = t;
|
|
2785
2743
|
const c = X(o);
|
|
2786
2744
|
c.current = o, P(() => {
|
|
2787
2745
|
if (!n || !e)
|
|
2788
2746
|
return;
|
|
2789
|
-
const
|
|
2747
|
+
const h = `sheet.formula-embedding-editor.${n.getEditorId()}`, g = new Ye(), p = (l, S) => {
|
|
2790
2748
|
if (c.current) {
|
|
2791
2749
|
c.current(l, S);
|
|
2792
2750
|
return;
|
|
2793
2751
|
}
|
|
2794
|
-
let v =
|
|
2795
|
-
l === L.ARROW_DOWN ? v =
|
|
2752
|
+
let v = xe.LEFT;
|
|
2753
|
+
l === L.ARROW_DOWN ? v = xe.DOWN : l === L.ARROW_UP ? v = xe.UP : l === L.ARROW_RIGHT && (v = xe.RIGHT), S === W.SHIFT ? r.executeCommand(Go.id, {
|
|
2796
2754
|
direction: v
|
|
2797
|
-
}) : r.executeCommand(
|
|
2755
|
+
}) : r.executeCommand(zo.id, {
|
|
2798
2756
|
direction: v
|
|
2799
2757
|
});
|
|
2800
2758
|
}, u = (l, S) => {
|
|
2801
|
-
let v =
|
|
2802
|
-
l === L.ARROW_DOWN ? v =
|
|
2759
|
+
let v = xe.DOWN;
|
|
2760
|
+
l === L.ARROW_DOWN ? v = xe.DOWN : l === L.ARROW_UP ? v = xe.UP : l === L.ARROW_LEFT ? v = xe.LEFT : l === L.ARROW_RIGHT && (v = xe.RIGHT), i.current ? S === W.CTRL_COMMAND ? r.executeCommand(Un.id, {
|
|
2803
2761
|
direction: v,
|
|
2804
|
-
jumpOver:
|
|
2762
|
+
jumpOver: Wn.moveGap,
|
|
2805
2763
|
extra: "formula-editor",
|
|
2806
|
-
fromCurrentSelection: i.current ===
|
|
2807
|
-
}) : S ===
|
|
2764
|
+
fromCurrentSelection: i.current === we.NEED_ADD || i.current === we.EDIT_OTHER_SHEET_REFERENCE
|
|
2765
|
+
}) : S === W.SHIFT ? r.executeCommand(Vn.id, {
|
|
2808
2766
|
direction: v,
|
|
2809
2767
|
extra: "formula-editor"
|
|
2810
|
-
}) : S === (
|
|
2768
|
+
}) : S === (W.CTRL_COMMAND | W.SHIFT) ? r.executeCommand(Vn.id, {
|
|
2811
2769
|
direction: v,
|
|
2812
|
-
jumpOver:
|
|
2770
|
+
jumpOver: Wn.moveGap,
|
|
2813
2771
|
extra: "formula-editor"
|
|
2814
|
-
}) : r.executeCommand(
|
|
2772
|
+
}) : r.executeCommand(Un.id, {
|
|
2815
2773
|
direction: v,
|
|
2816
2774
|
extra: "formula-editor",
|
|
2817
|
-
fromCurrentSelection: i.current ===
|
|
2818
|
-
}) :
|
|
2775
|
+
fromCurrentSelection: i.current === we.NEED_ADD || i.current === we.EDIT_OTHER_SHEET_REFERENCE
|
|
2776
|
+
}) : p(l, S);
|
|
2819
2777
|
};
|
|
2820
|
-
return
|
|
2821
|
-
id:
|
|
2822
|
-
type:
|
|
2778
|
+
return g.add(r.registerCommand({
|
|
2779
|
+
id: h,
|
|
2780
|
+
type: ye.OPERATION,
|
|
2823
2781
|
handler(l, S) {
|
|
2824
|
-
const { keyCode: v, metaKey:
|
|
2825
|
-
u(v,
|
|
2782
|
+
const { keyCode: v, metaKey: f } = S;
|
|
2783
|
+
u(v, f);
|
|
2826
2784
|
}
|
|
2827
2785
|
})), [
|
|
2828
2786
|
{ keyCode: L.ARROW_DOWN },
|
|
2829
2787
|
{ keyCode: L.ARROW_LEFT },
|
|
2830
2788
|
{ keyCode: L.ARROW_RIGHT },
|
|
2831
2789
|
{ keyCode: L.ARROW_UP },
|
|
2832
|
-
{ keyCode: L.ARROW_DOWN, metaKey:
|
|
2833
|
-
{ keyCode: L.ARROW_LEFT, metaKey:
|
|
2834
|
-
{ keyCode: L.ARROW_RIGHT, metaKey:
|
|
2835
|
-
{ keyCode: L.ARROW_UP, metaKey:
|
|
2836
|
-
{ keyCode: L.ARROW_DOWN, metaKey:
|
|
2837
|
-
{ keyCode: L.ARROW_LEFT, metaKey:
|
|
2838
|
-
{ keyCode: L.ARROW_RIGHT, metaKey:
|
|
2839
|
-
{ keyCode: L.ARROW_UP, metaKey:
|
|
2840
|
-
{ keyCode: L.ARROW_DOWN, metaKey:
|
|
2841
|
-
{ keyCode: L.ARROW_LEFT, metaKey:
|
|
2842
|
-
{ keyCode: L.ARROW_RIGHT, metaKey:
|
|
2843
|
-
{ keyCode: L.ARROW_UP, metaKey:
|
|
2790
|
+
{ keyCode: L.ARROW_DOWN, metaKey: W.SHIFT },
|
|
2791
|
+
{ keyCode: L.ARROW_LEFT, metaKey: W.SHIFT },
|
|
2792
|
+
{ keyCode: L.ARROW_RIGHT, metaKey: W.SHIFT },
|
|
2793
|
+
{ keyCode: L.ARROW_UP, metaKey: W.SHIFT },
|
|
2794
|
+
{ keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND },
|
|
2795
|
+
{ keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND },
|
|
2796
|
+
{ keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND },
|
|
2797
|
+
{ keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND },
|
|
2798
|
+
{ keyCode: L.ARROW_DOWN, metaKey: W.CTRL_COMMAND | W.SHIFT },
|
|
2799
|
+
{ keyCode: L.ARROW_LEFT, metaKey: W.CTRL_COMMAND | W.SHIFT },
|
|
2800
|
+
{ keyCode: L.ARROW_RIGHT, metaKey: W.CTRL_COMMAND | W.SHIFT },
|
|
2801
|
+
{ keyCode: L.ARROW_UP, metaKey: W.CTRL_COMMAND | W.SHIFT }
|
|
2844
2802
|
].map(({ keyCode: l, metaKey: S }) => ({
|
|
2845
|
-
id:
|
|
2803
|
+
id: h,
|
|
2846
2804
|
binding: S ? l | S : l,
|
|
2847
2805
|
preconditions: () => !0,
|
|
2848
2806
|
priority: 900,
|
|
2849
2807
|
staticParameters: {
|
|
2850
|
-
eventType:
|
|
2808
|
+
eventType: Ae.Keyboard,
|
|
2851
2809
|
keyCode: l,
|
|
2852
2810
|
metaKey: S
|
|
2853
2811
|
}
|
|
2854
2812
|
})).forEach((l) => {
|
|
2855
|
-
|
|
2813
|
+
g.add(s.registerShortcut(l));
|
|
2856
2814
|
}), () => {
|
|
2857
|
-
|
|
2815
|
+
g.dispose();
|
|
2858
2816
|
};
|
|
2859
2817
|
}, [r, n, e, s]);
|
|
2860
|
-
},
|
|
2861
|
-
var
|
|
2862
|
-
const s =
|
|
2863
|
-
|
|
2818
|
+
}, pc = (e, t, n, o, r = !0) => {
|
|
2819
|
+
var d;
|
|
2820
|
+
const s = b(Te), i = b(ln), c = b(Rs), a = b(Kt), h = b(re), g = Re(le(() => h.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [h])), p = s.getRenderById((d = g == null ? void 0 : g.getUnitId()) != null ? d : ""), u = p == null ? void 0 : p.with(Ue);
|
|
2821
|
+
Ut(() => {
|
|
2864
2822
|
if (e)
|
|
2865
|
-
return i.setContextValue(
|
|
2866
|
-
const l =
|
|
2867
|
-
(l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(
|
|
2823
|
+
return i.setContextValue(Ln, !0), r && c.disable(), () => {
|
|
2824
|
+
const l = h.getCurrentUnitOfType(B.UNIVER_DOC);
|
|
2825
|
+
(l == null ? void 0 : l.getUnitId()) === o && i.setContextValue(Ln, !1), r && c.enable(), a.clear();
|
|
2868
2826
|
};
|
|
2869
|
-
}, [i, e, a, r, o]),
|
|
2827
|
+
}, [i, e, a, r, o]), Ut(() => {
|
|
2870
2828
|
if (e && t) {
|
|
2871
2829
|
const l = u == null ? void 0 : u.enableSelectionChanging();
|
|
2872
|
-
return i.setContextValue(
|
|
2873
|
-
i.setContextValue(
|
|
2830
|
+
return i.setContextValue(jn, !0), () => {
|
|
2831
|
+
i.setContextValue(jn, !1), l == null || l.dispose();
|
|
2874
2832
|
};
|
|
2875
2833
|
}
|
|
2876
2834
|
}, [i, e, u, t]), P(() => {
|
|
2877
2835
|
e && (u == null || u.setSkipLastEnabled(!1));
|
|
2878
2836
|
}, [e, u]);
|
|
2879
|
-
},
|
|
2880
|
-
const o =
|
|
2881
|
-
return
|
|
2837
|
+
}, Sc = (e, t, n) => {
|
|
2838
|
+
const o = b(re), r = b(vn);
|
|
2839
|
+
return Pt(() => {
|
|
2882
2840
|
if (e) {
|
|
2883
|
-
const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(
|
|
2841
|
+
const i = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], c = o.getCurrentUnitForType(B.UNIVER_SHEET), a = c == null ? void 0 : c.getActiveSheet();
|
|
2884
2842
|
(c == null ? void 0 : c.getUnitId()) !== t && o.setCurrentUnitForType(t), a && a.getSheetId() === n && r.setSelections(i);
|
|
2885
2843
|
}
|
|
2886
2844
|
}, [e, r, n, t, o]);
|
|
2887
|
-
},
|
|
2888
|
-
var
|
|
2845
|
+
}, vc = (e) => e.reduce((t, n) => typeof n == "string" ? t + n.length : t + n.token.length, 0), an = (e) => e.map((t) => typeof t == "string" ? t : t.token).join(""), Dt = (e, t = !1, n = "", o = !1) => !t && !o ? e.map((r) => be(r.range)) : e.map((r) => o ? Vo(r) : r.sheetName !== "" && r.sheetName !== n ? Ct(r.sheetName, r.range) : be(r.range)), Cc = (e) => {
|
|
2846
|
+
var g, p, u;
|
|
2889
2847
|
const { editor: t, lexerTreeBuilder: n } = e, o = t == null ? void 0 : t.getSelectionRanges();
|
|
2890
2848
|
if ((o == null ? void 0 : o.length) !== 1)
|
|
2891
2849
|
return;
|
|
2892
|
-
const s = o[0].startOffset - 1, i = ((
|
|
2893
|
-
`).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a =
|
|
2850
|
+
const s = o[0].startOffset - 1, i = ((p = (g = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : g.dataStream) != null ? p : `\r
|
|
2851
|
+
`).slice(0, -2), c = (u = n.sequenceNodesBuilder(i.slice(1))) != null ? u : [], a = yn(c, s, !1), h = Hr(c, a);
|
|
2894
2852
|
return {
|
|
2895
2853
|
nodeIndex: a,
|
|
2896
|
-
updatingRefIndex:
|
|
2854
|
+
updatingRefIndex: h,
|
|
2897
2855
|
sequenceNodes: c,
|
|
2898
2856
|
offset: s
|
|
2899
2857
|
};
|
|
2900
|
-
},
|
|
2901
|
-
}),
|
|
2858
|
+
}, _c = (() => {
|
|
2859
|
+
}), Rc = (e, t, n, o, r, s, i, c, a, h = _c) => {
|
|
2902
2860
|
var M;
|
|
2903
|
-
const
|
|
2904
|
-
var $,
|
|
2905
|
-
return (_ = (
|
|
2906
|
-
}), C = le(() =>
|
|
2907
|
-
var Y,
|
|
2908
|
-
const
|
|
2909
|
-
if (!
|
|
2910
|
-
const { nodeIndex: _, updatingRefIndex: O, sequenceNodes: D, offset: U } =
|
|
2911
|
-
if (n.current ===
|
|
2861
|
+
const g = b(Te), p = b(re), u = b(ve), d = b(yr), l = b(It), S = b(ke), v = p.getUnit(o), f = ee((w, F) => {
|
|
2862
|
+
var $, R, _;
|
|
2863
|
+
return (_ = (R = ($ = p.getUnit(w)) == null ? void 0 : $.getSheetBySheetId(F)) == null ? void 0 : R.getName()) != null ? _ : "";
|
|
2864
|
+
}), C = le(() => f(o, r), [f, r, o]), I = Re(v == null ? void 0 : v.activeSheet$), E = Qe({ activeSheet: I, sheetName: C }), m = Re(le(() => p.getCurrentTypeOfUnit$(B.UNIVER_SHEET), [p])), y = g.getRenderById((M = m == null ? void 0 : m.getUnitId()) != null ? M : ""), T = y == null ? void 0 : y.with(Ue), A = y == null ? void 0 : y.with(Et), k = b(Kt), N = ee((w, F, $) => {
|
|
2865
|
+
var Y, oe, ge, G, J, Je, et, Nt, Ne, Mt;
|
|
2866
|
+
const R = Cc({ editor: a, lexerTreeBuilder: S });
|
|
2867
|
+
if (!R) return;
|
|
2868
|
+
const { nodeIndex: _, updatingRefIndex: O, sequenceNodes: D, offset: U } = R;
|
|
2869
|
+
if (n.current === we.NEED_ADD)
|
|
2912
2870
|
if (U !== 0) {
|
|
2913
2871
|
if (_ === -1 && D.length)
|
|
2914
2872
|
return;
|
|
2915
|
-
const K = w[w.length - 1], te = D.splice(_ + 1),
|
|
2873
|
+
const K = w[w.length - 1], te = D.splice(_ + 1), me = (Y = K.sheetId) != null ? Y : r, se = {
|
|
2916
2874
|
range: K,
|
|
2917
|
-
unitId: (
|
|
2918
|
-
sheetName:
|
|
2919
|
-
},
|
|
2920
|
-
D.push({ token:
|
|
2921
|
-
const
|
|
2922
|
-
|
|
2875
|
+
unitId: (oe = K.unitId) != null ? oe : m.getUnitId(),
|
|
2876
|
+
sheetName: f((ge = K.unitId) != null ? ge : m.getUnitId(), me)
|
|
2877
|
+
}, ue = me !== r, pe = (m == null ? void 0 : m.getUnitId()) !== o, Ce = Dt([se], i && (ue || pe), C, pe);
|
|
2878
|
+
D.push({ token: Ce[0], nodeType: Q.REFERENCE });
|
|
2879
|
+
const Ve = [...D, ...te], He = an(Ve);
|
|
2880
|
+
h(He, vc(D), F);
|
|
2923
2881
|
} else {
|
|
2924
|
-
const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r,
|
|
2882
|
+
const K = w[w.length - 1], te = (G = K.sheetId) != null ? G : r, me = {
|
|
2925
2883
|
range: K,
|
|
2926
|
-
unitId: (J = K.unitId) != null ? J :
|
|
2927
|
-
sheetName:
|
|
2928
|
-
},
|
|
2929
|
-
D.unshift({ token:
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2932
|
-
}
|
|
2933
|
-
else if (n.current ===
|
|
2884
|
+
unitId: (J = K.unitId) != null ? J : m.getUnitId(),
|
|
2885
|
+
sheetName: f((Je = K.unitId) != null ? Je : m.getUnitId(), te)
|
|
2886
|
+
}, se = te !== r, ue = (m == null ? void 0 : m.getUnitId()) !== o, pe = Dt([me], i && (se || ue), C, ue);
|
|
2887
|
+
D.unshift({ token: pe[0], nodeType: Q.REFERENCE });
|
|
2888
|
+
const Ce = an(D);
|
|
2889
|
+
h(Ce, pe[0].length, F);
|
|
2890
|
+
}
|
|
2891
|
+
else if (n.current === we.EDIT_OTHER_SHEET_REFERENCE || n.current === we.EDIT_OTHER_WORKBOOK_REFERENCE) {
|
|
2934
2892
|
const K = w.pop();
|
|
2935
2893
|
if (!K) return;
|
|
2936
2894
|
const te = D[_];
|
|
2937
2895
|
if (typeof te == "object" && te.nodeType === Q.REFERENCE) {
|
|
2938
|
-
const
|
|
2939
|
-
(
|
|
2940
|
-
const
|
|
2941
|
-
|
|
2896
|
+
const me = te.token;
|
|
2897
|
+
(m == null ? void 0 : m.getUnitId()) !== o ? te.token = Ho((et = m == null ? void 0 : m.getUnitId()) != null ? et : "", C, K) : te.token = C === (I == null ? void 0 : I.getName()) ? be(K) : Ct(I.getName(), K);
|
|
2898
|
+
const ue = U + (te.token.length - me.length);
|
|
2899
|
+
h(Bo(D), ue, F);
|
|
2942
2900
|
}
|
|
2943
2901
|
} else {
|
|
2944
2902
|
const K = [...w];
|
|
@@ -2947,104 +2905,104 @@ const gc = (e, t, n, o) => {
|
|
|
2947
2905
|
z && K.splice(O, 0, z);
|
|
2948
2906
|
}
|
|
2949
2907
|
let te = 0;
|
|
2950
|
-
const
|
|
2951
|
-
var
|
|
2908
|
+
const me = D.map((z) => {
|
|
2909
|
+
var Ie, De, tt, Be;
|
|
2952
2910
|
if (typeof z == "string")
|
|
2953
2911
|
return z;
|
|
2954
2912
|
if (z.nodeType === Q.REFERENCE) {
|
|
2955
|
-
const
|
|
2956
|
-
if (
|
|
2913
|
+
const Se = ut(z.token);
|
|
2914
|
+
if (Se.sheetName || (Se.sheetName = C), (Se.unitId || o) !== (m == null ? void 0 : m.getUnitId()) || i && ((Ie = E.current.activeSheet) == null ? void 0 : Ie.getName()) !== Se.sheetName)
|
|
2957
2915
|
return z.token;
|
|
2958
|
-
const
|
|
2959
|
-
if (te++, !
|
|
2916
|
+
const ce = K[te];
|
|
2917
|
+
if (te++, !ce)
|
|
2960
2918
|
return "";
|
|
2961
|
-
const
|
|
2962
|
-
range:
|
|
2963
|
-
unitId: (
|
|
2964
|
-
sheetName:
|
|
2965
|
-
},
|
|
2966
|
-
return
|
|
2919
|
+
const ft = (De = ce.sheetId) != null ? De : r, Xt = {
|
|
2920
|
+
range: ce,
|
|
2921
|
+
unitId: (tt = ce.unitId) != null ? tt : m.getUnitId(),
|
|
2922
|
+
sheetName: f((Be = ce.unitId) != null ? Be : m.getUnitId(), ft)
|
|
2923
|
+
}, xt = (m == null ? void 0 : m.getUnitId()) !== o;
|
|
2924
|
+
return Dt([Xt], i && (ft !== r || xt), C, xt)[0];
|
|
2967
2925
|
}
|
|
2968
2926
|
return z.token;
|
|
2969
2927
|
});
|
|
2970
|
-
let
|
|
2971
|
-
|
|
2972
|
-
|
|
2928
|
+
let se = "", ue;
|
|
2929
|
+
me.forEach((z, Ie) => {
|
|
2930
|
+
se += z, Ie === _ && (ue = se.length);
|
|
2973
2931
|
});
|
|
2974
|
-
const
|
|
2932
|
+
const pe = [];
|
|
2975
2933
|
for (let z = te; z <= w.length - 1; z++) {
|
|
2976
|
-
const
|
|
2977
|
-
range:
|
|
2978
|
-
unitId: (
|
|
2979
|
-
sheetName:
|
|
2980
|
-
}, Be = (
|
|
2981
|
-
|
|
2982
|
-
}
|
|
2983
|
-
const
|
|
2984
|
-
|
|
2934
|
+
const Ie = w[z], De = (Nt = Ie.sheetId) != null ? Nt : r, tt = {
|
|
2935
|
+
range: Ie,
|
|
2936
|
+
unitId: (Ne = Ie.unitId) != null ? Ne : m.getUnitId(),
|
|
2937
|
+
sheetName: f((Mt = Ie.unitId) != null ? Mt : m.getUnitId(), De)
|
|
2938
|
+
}, Be = (m == null ? void 0 : m.getUnitId()) !== o, ce = Dt([tt], i && (De !== r || Be), C, Be);
|
|
2939
|
+
pe.push(ce[0]);
|
|
2940
|
+
}
|
|
2941
|
+
const Ce = D[D.length - 1], Ve = Ce && (typeof Ce == "string" ? !1 : Ce.nodeType === Q.REFERENCE), He = `${se}${pe.length && Ve ? "," : ""}${pe.join(",")}`;
|
|
2942
|
+
h(He, !pe.length && ue ? ue : He.length, F);
|
|
2985
2943
|
}
|
|
2986
2944
|
});
|
|
2987
2945
|
P(() => {
|
|
2988
2946
|
if (T && e) {
|
|
2989
|
-
let w = !0,
|
|
2947
|
+
let w = !0, F = 0;
|
|
2990
2948
|
const $ = (_, O) => {
|
|
2991
2949
|
if (w) {
|
|
2992
|
-
w = !1,
|
|
2950
|
+
w = !1, F = _.length;
|
|
2993
2951
|
return;
|
|
2994
2952
|
}
|
|
2995
|
-
const D = _.length >
|
|
2996
|
-
O && (
|
|
2997
|
-
},
|
|
2998
|
-
return
|
|
2953
|
+
const D = _.length > F;
|
|
2954
|
+
O && (F = _.length), N(_.map((U) => U.rangeWithCoord), O, D);
|
|
2955
|
+
}, R = new Ye();
|
|
2956
|
+
return R.add(T.selectionMoving$.subscribe((_) => {
|
|
2999
2957
|
$(_, !1);
|
|
3000
|
-
})),
|
|
2958
|
+
})), R.add(T.selectionMoveEnd$.subscribe((_) => {
|
|
3001
2959
|
$(_, !0);
|
|
3002
2960
|
})), () => {
|
|
3003
|
-
|
|
2961
|
+
R.dispose();
|
|
3004
2962
|
};
|
|
3005
2963
|
}
|
|
3006
2964
|
}, [e, N, T]), P(() => {
|
|
3007
2965
|
if (t && T && a) {
|
|
3008
|
-
const w = new Ye(),
|
|
2966
|
+
const w = new Ye(), F = () => {
|
|
3009
2967
|
w.dispose(), T.getSelectionControls().forEach((_, O) => {
|
|
3010
2968
|
w.add(
|
|
3011
2969
|
_.selectionScaling$.subscribe((D) => {
|
|
3012
|
-
const U = T.getSelectionDataWithStyle().map((
|
|
2970
|
+
const U = T.getSelectionDataWithStyle().map((oe) => oe.rangeWithCoord), Y = U[O];
|
|
3013
2971
|
D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !1);
|
|
3014
2972
|
})
|
|
3015
2973
|
), w.add(
|
|
3016
2974
|
_.selectionMoving$.subscribe((D) => {
|
|
3017
|
-
const U = T.getSelectionDataWithStyle().map((
|
|
2975
|
+
const U = T.getSelectionDataWithStyle().map((oe) => oe.rangeWithCoord), Y = U[O];
|
|
3018
2976
|
D.sheetId = Y.sheetId, D.unitId = Y.unitId, U[O] = D, N(U, !0);
|
|
3019
2977
|
})
|
|
3020
2978
|
);
|
|
3021
2979
|
});
|
|
3022
|
-
}, $ =
|
|
2980
|
+
}, $ = Yo(
|
|
3023
2981
|
a.input$,
|
|
3024
|
-
|
|
2982
|
+
k.selectionSet$,
|
|
3025
2983
|
T.selectionMoveEnd$
|
|
3026
2984
|
).pipe(
|
|
3027
|
-
|
|
2985
|
+
ws(50)
|
|
3028
2986
|
).subscribe(() => {
|
|
3029
|
-
|
|
2987
|
+
F();
|
|
3030
2988
|
});
|
|
3031
2989
|
return () => {
|
|
3032
2990
|
$.unsubscribe(), w.dispose();
|
|
3033
2991
|
};
|
|
3034
2992
|
}
|
|
3035
|
-
}, [a, t, N, T,
|
|
2993
|
+
}, [a, t, N, T, k.selectionSet$]), T == null || T.getSelectionDataWithStyle(), P(() => {
|
|
3036
2994
|
if (c) {
|
|
3037
|
-
const w = u.onCommandExecuted((
|
|
3038
|
-
var
|
|
3039
|
-
if (
|
|
2995
|
+
const w = u.onCommandExecuted((F) => {
|
|
2996
|
+
var R;
|
|
2997
|
+
if (F.id !== Cn.id)
|
|
3040
2998
|
return;
|
|
3041
|
-
const $ =
|
|
2999
|
+
const $ = F.params;
|
|
3042
3000
|
if ($.extra === "formula-editor" && $.selections.length) {
|
|
3043
3001
|
const _ = $.selections[$.selections.length - 1];
|
|
3044
3002
|
if (_) {
|
|
3045
3003
|
const { range: O, primary: D } = _;
|
|
3046
|
-
(D != null && D.isMergedMainCell || D != null && D.isMerged) &&
|
|
3047
|
-
const U = n.current ===
|
|
3004
|
+
(D != null && D.isMergedMainCell || D != null && D.isMerged) && un.contains(D, O) && (O.startRow = D.startRow, O.endRow = D.startRow, O.startColumn = D.startColumn, O.endColumn = D.startColumn), O.unitId = $.unitId, O.sheetId = $.subUnitId;
|
|
3005
|
+
const U = n.current === we.NEED_ADD, Y = ((R = T == null ? void 0 : T.getSelectionDataWithStyle()) != null ? R : []).map((oe) => oe.rangeWithCoord);
|
|
3048
3006
|
U ? Y.push(O) : Y[Y.length - 1] = O, N(Y, !0);
|
|
3049
3007
|
}
|
|
3050
3008
|
}
|
|
@@ -3056,47 +3014,47 @@ const gc = (e, t, n, o) => {
|
|
|
3056
3014
|
}, [u, a, n, S, c, N, T]), P(() => {
|
|
3057
3015
|
if (!a)
|
|
3058
3016
|
return;
|
|
3059
|
-
const w =
|
|
3060
|
-
|
|
3017
|
+
const w = d.textSelection$.subscribe((F) => {
|
|
3018
|
+
F.unitId === a.getEditorId() && qr({
|
|
3061
3019
|
unitId: o,
|
|
3062
3020
|
subUnitId: r,
|
|
3063
3021
|
refSelections: s.current,
|
|
3064
3022
|
editor: a,
|
|
3065
|
-
refSelectionsService:
|
|
3023
|
+
refSelectionsService: k,
|
|
3066
3024
|
refSelectionsRenderService: T,
|
|
3067
|
-
sheetSkeletonManagerService:
|
|
3025
|
+
sheetSkeletonManagerService: A,
|
|
3068
3026
|
themeService: l,
|
|
3069
|
-
univerInstanceService:
|
|
3070
|
-
currentWorkbook:
|
|
3027
|
+
univerInstanceService: p,
|
|
3028
|
+
currentWorkbook: m
|
|
3071
3029
|
});
|
|
3072
3030
|
});
|
|
3073
3031
|
return () => w.unsubscribe();
|
|
3074
|
-
}, [
|
|
3075
|
-
},
|
|
3076
|
-
const i =
|
|
3032
|
+
}, [d.textSelection$, a, s, T, k, A, r, l, o, p]);
|
|
3033
|
+
}, Ic = (e, t, n, o, r, s) => {
|
|
3034
|
+
const i = b(ve), c = b(ze), h = b(Te).getRenderById(t), g = b(re), p = h == null ? void 0 : h.with(Ue);
|
|
3077
3035
|
P(() => {
|
|
3078
|
-
if (e &&
|
|
3036
|
+
if (e && p)
|
|
3079
3037
|
if (n) {
|
|
3080
3038
|
const u = () => {
|
|
3081
|
-
const S =
|
|
3039
|
+
const S = p.getSelectionControls().length;
|
|
3082
3040
|
for (let v = 1; v <= S; v++)
|
|
3083
|
-
|
|
3041
|
+
p.clearLastSelection();
|
|
3084
3042
|
return setTimeout(() => {
|
|
3085
3043
|
s();
|
|
3086
3044
|
}, 30);
|
|
3087
|
-
},
|
|
3088
|
-
S.id ===
|
|
3089
|
-
}), l =
|
|
3045
|
+
}, d = i.onCommandExecuted((S) => {
|
|
3046
|
+
S.id === Kn.id && u();
|
|
3047
|
+
}), l = g.getCurrentTypeOfUnit$(B.UNIVER_SHEET).subscribe((S) => {
|
|
3090
3048
|
u();
|
|
3091
3049
|
});
|
|
3092
3050
|
return () => {
|
|
3093
|
-
|
|
3051
|
+
d.dispose(), l.unsubscribe();
|
|
3094
3052
|
};
|
|
3095
3053
|
} else {
|
|
3096
|
-
const u = i.beforeCommandExecuted((
|
|
3097
|
-
if (
|
|
3054
|
+
const u = i.beforeCommandExecuted((d) => {
|
|
3055
|
+
if (d.id === Kn.id) {
|
|
3098
3056
|
o(!1), r(), s();
|
|
3099
|
-
const l = c.getEditor(
|
|
3057
|
+
const l = c.getEditor(dn);
|
|
3100
3058
|
l == null || l.focus();
|
|
3101
3059
|
}
|
|
3102
3060
|
});
|
|
@@ -3104,9 +3062,9 @@ const gc = (e, t, n, o) => {
|
|
|
3104
3062
|
u.dispose();
|
|
3105
3063
|
};
|
|
3106
3064
|
}
|
|
3107
|
-
}, [e,
|
|
3108
|
-
},
|
|
3109
|
-
const o =
|
|
3065
|
+
}, [e, p]);
|
|
3066
|
+
}, Ec = (e, t, n) => {
|
|
3067
|
+
const o = b(ke), r = X(!0);
|
|
3110
3068
|
P(() => {
|
|
3111
3069
|
if (e) {
|
|
3112
3070
|
const s = setTimeout(() => {
|
|
@@ -3119,27 +3077,27 @@ const gc = (e, t, n, o) => {
|
|
|
3119
3077
|
}, [e]), P(() => {
|
|
3120
3078
|
if (!r.current && t) {
|
|
3121
3079
|
const s = o.checkIfAddBracket(n);
|
|
3122
|
-
t(s === 0 && n.startsWith(
|
|
3080
|
+
t(s === 0 && n.startsWith(dr.EQUALS), `${n}`);
|
|
3123
3081
|
}
|
|
3124
3082
|
}, [n, t]);
|
|
3125
|
-
},
|
|
3126
|
-
const o =
|
|
3083
|
+
}, bc = (e, t = [], n) => {
|
|
3084
|
+
const o = b(dt), [r, s] = V([]), [i, c] = V(""), a = X(-1), h = Qe({ nodes: t }), g = () => {
|
|
3127
3085
|
s([]), c(""), a.current = -1;
|
|
3128
3086
|
};
|
|
3129
3087
|
return P(() => {
|
|
3130
3088
|
if (n && e) {
|
|
3131
|
-
const u = n.input$.pipe(
|
|
3132
|
-
const
|
|
3133
|
-
if (
|
|
3134
|
-
const l =
|
|
3089
|
+
const u = n.input$.pipe(Sn(300)).subscribe(() => {
|
|
3090
|
+
const d = n.getSelectionRanges();
|
|
3091
|
+
if (d.length === 1) {
|
|
3092
|
+
const l = h.current.nodes, S = d[0];
|
|
3135
3093
|
if (S.collapsed) {
|
|
3136
|
-
const v =
|
|
3094
|
+
const v = yn(l, S.startOffset - 1, !1);
|
|
3137
3095
|
a.current = v;
|
|
3138
|
-
const
|
|
3139
|
-
if (
|
|
3096
|
+
const f = l[v];
|
|
3097
|
+
if (f && typeof f != "string" && f.nodeType === Q.FUNCTION) {
|
|
3140
3098
|
a.current = v;
|
|
3141
|
-
const C =
|
|
3142
|
-
s(
|
|
3099
|
+
const C = f.token, I = o.getSearchListByNameFirstLetter(C);
|
|
3100
|
+
s(I), c(C);
|
|
3143
3101
|
return;
|
|
3144
3102
|
}
|
|
3145
3103
|
}
|
|
@@ -3151,102 +3109,102 @@ const gc = (e, t, n, o) => {
|
|
|
3151
3109
|
};
|
|
3152
3110
|
}
|
|
3153
3111
|
}, [n, e]), P(() => {
|
|
3154
|
-
e ||
|
|
3112
|
+
e || g();
|
|
3155
3113
|
}, [e]), {
|
|
3156
3114
|
searchList: r,
|
|
3157
3115
|
searchText: i,
|
|
3158
|
-
handlerFormulaReplace: (u,
|
|
3159
|
-
const l = [...
|
|
3116
|
+
handlerFormulaReplace: (u, d) => {
|
|
3117
|
+
const l = [...h.current.nodes];
|
|
3160
3118
|
if (a.current !== -1) {
|
|
3161
3119
|
const S = l.splice(a.current + 1), v = l.pop() || "";
|
|
3162
|
-
let
|
|
3163
|
-
return l.push(u), S[0] !== Ge.OPEN_BRACKET &&
|
|
3120
|
+
let f = (typeof v == "string" ? v.length : v.token.length) - u.length;
|
|
3121
|
+
return l.push(u), S[0] !== Ge.OPEN_BRACKET && d !== fe.DefinedName && (l.push(Ge.OPEN_BRACKET), f--), { text: an([...l, ...S]), offset: f };
|
|
3164
3122
|
}
|
|
3165
3123
|
},
|
|
3166
|
-
reset:
|
|
3124
|
+
reset: g
|
|
3167
3125
|
};
|
|
3168
|
-
},
|
|
3169
|
-
},
|
|
3170
|
-
function
|
|
3171
|
-
const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i =
|
|
3126
|
+
}, yc = () => {
|
|
3127
|
+
}, Tc = We(Oc);
|
|
3128
|
+
function Oc(e, t) {
|
|
3129
|
+
const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: i = yc } = e, c = s.getEditorId(), a = b(Yt), h = b(ve), { searchList: g, searchText: p, handlerFormulaReplace: u, reset: d } = bc(n, o, s), l = le(() => !!g.length, [g]), S = X(void 0), [v, f] = V(0), C = X(!1), [I] = Br(c, l, [p, g]), E = Qe({ searchList: g, active: v }), m = (N, M) => {
|
|
3172
3130
|
const w = u(N, M);
|
|
3173
|
-
w && (
|
|
3131
|
+
w && (d(), r(w));
|
|
3174
3132
|
};
|
|
3175
|
-
function
|
|
3176
|
-
C.current &&
|
|
3133
|
+
function y(N) {
|
|
3134
|
+
C.current && f(N);
|
|
3177
3135
|
}
|
|
3178
3136
|
function T() {
|
|
3179
|
-
C.current &&
|
|
3137
|
+
C.current && f(-1);
|
|
3180
3138
|
}
|
|
3181
3139
|
P(() => {
|
|
3182
|
-
if (!
|
|
3140
|
+
if (!g.length)
|
|
3183
3141
|
return;
|
|
3184
|
-
const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), w = (
|
|
3185
|
-
const { searchList: $, active:
|
|
3186
|
-
switch (
|
|
3142
|
+
const N = `sheet.formula-embedding-editor.search_function.${c}`, M = new Ye(), w = (F) => {
|
|
3143
|
+
const { searchList: $, active: R } = E.current;
|
|
3144
|
+
switch (F) {
|
|
3187
3145
|
case L.ARROW_UP: {
|
|
3188
|
-
|
|
3146
|
+
f((_) => {
|
|
3189
3147
|
const O = Math.max(0, _ - 1);
|
|
3190
|
-
return
|
|
3148
|
+
return A(O), O;
|
|
3191
3149
|
});
|
|
3192
3150
|
break;
|
|
3193
3151
|
}
|
|
3194
3152
|
case L.ARROW_DOWN: {
|
|
3195
|
-
|
|
3153
|
+
f((_) => {
|
|
3196
3154
|
const O = Math.min($.length - 1, _ + 1);
|
|
3197
|
-
return
|
|
3155
|
+
return A(O), O;
|
|
3198
3156
|
});
|
|
3199
3157
|
break;
|
|
3200
3158
|
}
|
|
3201
3159
|
case L.TAB:
|
|
3202
3160
|
case L.ENTER: {
|
|
3203
|
-
const _ = $[
|
|
3204
|
-
|
|
3161
|
+
const _ = $[R];
|
|
3162
|
+
m(_.name, _.functionType);
|
|
3205
3163
|
break;
|
|
3206
3164
|
}
|
|
3207
3165
|
case L.ESC: {
|
|
3208
|
-
|
|
3166
|
+
d(), i();
|
|
3209
3167
|
break;
|
|
3210
3168
|
}
|
|
3211
3169
|
}
|
|
3212
3170
|
};
|
|
3213
|
-
return M.add(
|
|
3171
|
+
return M.add(h.registerCommand({
|
|
3214
3172
|
id: N,
|
|
3215
|
-
type:
|
|
3216
|
-
handler(
|
|
3217
|
-
const { keyCode:
|
|
3218
|
-
w(
|
|
3173
|
+
type: ye.OPERATION,
|
|
3174
|
+
handler(F, $) {
|
|
3175
|
+
const { keyCode: R } = $;
|
|
3176
|
+
w(R);
|
|
3219
3177
|
}
|
|
3220
|
-
})), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((
|
|
3178
|
+
})), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((F) => ({
|
|
3221
3179
|
id: N,
|
|
3222
|
-
binding:
|
|
3180
|
+
binding: F,
|
|
3223
3181
|
preconditions: () => !0,
|
|
3224
3182
|
priority: 1e3,
|
|
3225
3183
|
staticParameters: {
|
|
3226
|
-
eventType:
|
|
3227
|
-
keyCode:
|
|
3184
|
+
eventType: Ae.Keyboard,
|
|
3185
|
+
keyCode: F
|
|
3228
3186
|
}
|
|
3229
|
-
})).forEach((
|
|
3230
|
-
M.add(a.registerShortcut(
|
|
3187
|
+
})).forEach((F) => {
|
|
3188
|
+
M.add(a.registerShortcut(F));
|
|
3231
3189
|
}), () => {
|
|
3232
3190
|
M.dispose();
|
|
3233
3191
|
};
|
|
3234
|
-
}, [
|
|
3235
|
-
function
|
|
3192
|
+
}, [g]);
|
|
3193
|
+
function A(N) {
|
|
3236
3194
|
const M = S.current;
|
|
3237
3195
|
if (!M) return;
|
|
3238
3196
|
const w = M.children[N];
|
|
3239
3197
|
if (!w) return;
|
|
3240
|
-
const $ = M.getBoundingClientRect().top,
|
|
3241
|
-
if (O >= 0 && O > $ && O - $ + D <=
|
|
3198
|
+
const $ = M.getBoundingClientRect().top, R = M.offsetHeight, _ = w.getBoundingClientRect(), O = _.top, D = _.height;
|
|
3199
|
+
if (O >= 0 && O > $ && O - $ + D <= R)
|
|
3242
3200
|
return;
|
|
3243
|
-
const U = w.offsetTop - (
|
|
3201
|
+
const U = w.offsetTop - (R - D) / 2;
|
|
3244
3202
|
M.scrollTo({
|
|
3245
3203
|
top: U,
|
|
3246
3204
|
behavior: "smooth"
|
|
3247
3205
|
});
|
|
3248
3206
|
}
|
|
3249
|
-
const
|
|
3207
|
+
const k = le(() => {
|
|
3250
3208
|
let N = "";
|
|
3251
3209
|
return () => {
|
|
3252
3210
|
clearTimeout(N), C.current = !0, N = setTimeout(() => {
|
|
@@ -3254,30 +3212,30 @@ function Tc(e, t) {
|
|
|
3254
3212
|
}, 300);
|
|
3255
3213
|
};
|
|
3256
3214
|
}, []);
|
|
3257
|
-
return
|
|
3215
|
+
return g.length > 0 && l && /* @__PURE__ */ x(on, { portal: !0, anchorRect$: I, direction: "vertical", children: /* @__PURE__ */ x(
|
|
3258
3216
|
"ul",
|
|
3259
3217
|
{
|
|
3260
3218
|
ref: (N) => {
|
|
3261
3219
|
S.current = N, t && (t.current = N);
|
|
3262
3220
|
},
|
|
3263
3221
|
"data-u-comp": "sheets-formula-editor",
|
|
3264
|
-
className:
|
|
3265
|
-
children:
|
|
3222
|
+
className: ie("univer-m-0 univer-box-border univer-max-h-[400px] univer-w-[250px] univer-list-none univer-overflow-y-auto univer-rounded-lg univer-bg-white univer-p-2 univer-leading-5 univer-shadow-md univer-outline-none dark:!univer-bg-gray-900", In, it),
|
|
3223
|
+
children: g.map((N, M) => /* @__PURE__ */ H(
|
|
3266
3224
|
"li",
|
|
3267
3225
|
{
|
|
3268
|
-
className:
|
|
3226
|
+
className: ie("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-1 univer-text-gray-900 univer-transition-colors dark:!univer-text-white", {
|
|
3269
3227
|
"univer-bg-gray-200 dark:!univer-bg-gray-600": v === M
|
|
3270
3228
|
}),
|
|
3271
|
-
onMouseEnter: () =>
|
|
3229
|
+
onMouseEnter: () => y(M),
|
|
3272
3230
|
onMouseLeave: T,
|
|
3273
|
-
onMouseMove:
|
|
3231
|
+
onMouseMove: k,
|
|
3274
3232
|
onClick: () => {
|
|
3275
|
-
|
|
3233
|
+
m(N.name, N.functionType), s && s.focus();
|
|
3276
3234
|
},
|
|
3277
3235
|
children: [
|
|
3278
|
-
/* @__PURE__ */
|
|
3279
|
-
/* @__PURE__ */ x("span", { className: "univer-text-red-500", children: N.name.substring(0,
|
|
3280
|
-
/* @__PURE__ */ x("span", { children: N.name.slice(
|
|
3236
|
+
/* @__PURE__ */ H("span", { className: "univer-block univer-truncate univer-text-xs", children: [
|
|
3237
|
+
/* @__PURE__ */ x("span", { className: "univer-text-red-500", children: N.name.substring(0, p.length) }),
|
|
3238
|
+
/* @__PURE__ */ x("span", { children: N.name.slice(p.length) })
|
|
3281
3239
|
] }),
|
|
3282
3240
|
/* @__PURE__ */ x(
|
|
3283
3241
|
"span",
|
|
@@ -3293,9 +3251,9 @@ function Tc(e, t) {
|
|
|
3293
3251
|
}
|
|
3294
3252
|
) });
|
|
3295
3253
|
}
|
|
3296
|
-
const
|
|
3297
|
-
},
|
|
3298
|
-
var
|
|
3254
|
+
const Nc = (e) => e.startsWith(dr.EQUALS) ? e.slice(1) : "", Qn = () => {
|
|
3255
|
+
}, Mc = We((e, t) => {
|
|
3256
|
+
var Nn, Mn, xn, wn;
|
|
3299
3257
|
const {
|
|
3300
3258
|
errorText: n,
|
|
3301
3259
|
initValue: o,
|
|
@@ -3303,71 +3261,71 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
|
|
|
3303
3261
|
subUnitId: s,
|
|
3304
3262
|
isFocus: i = !0,
|
|
3305
3263
|
isSupportAcrossSheet: c = !1,
|
|
3306
|
-
onFocus: a =
|
|
3307
|
-
onBlur:
|
|
3308
|
-
onChange:
|
|
3309
|
-
onVerify:
|
|
3264
|
+
onFocus: a = Qn,
|
|
3265
|
+
onBlur: h = Qn,
|
|
3266
|
+
onChange: g,
|
|
3267
|
+
onVerify: p,
|
|
3310
3268
|
className: u,
|
|
3311
|
-
editorId:
|
|
3269
|
+
editorId: d,
|
|
3312
3270
|
moveCursor: l = !0,
|
|
3313
3271
|
onFormulaSelectingChange: S,
|
|
3314
3272
|
keyboardEventConfig: v,
|
|
3315
|
-
onMoveInEditor:
|
|
3273
|
+
onMoveInEditor: f,
|
|
3316
3274
|
resetSelectionOnBlur: C = !0,
|
|
3317
|
-
autoScrollbar:
|
|
3275
|
+
autoScrollbar: I = !0,
|
|
3318
3276
|
isSingle: E = !0,
|
|
3319
|
-
disableSelectionOnClick:
|
|
3320
|
-
autofocus:
|
|
3277
|
+
disableSelectionOnClick: m = !1,
|
|
3278
|
+
autofocus: y = !0,
|
|
3321
3279
|
disableContextMenu: T,
|
|
3322
|
-
style:
|
|
3323
|
-
} = e,
|
|
3324
|
-
|
|
3280
|
+
style: A
|
|
3281
|
+
} = e, k = b(ze), N = X(null), M = ee(g);
|
|
3282
|
+
ys(t, () => ({
|
|
3325
3283
|
isClickOutSide: (Z) => N.current ? !N.current.contains(Z.target) : !1
|
|
3326
3284
|
}));
|
|
3327
|
-
const w = ee(S),
|
|
3328
|
-
|
|
3329
|
-
const G =
|
|
3330
|
-
|
|
3285
|
+
const w = ee(S), F = X(null), $ = X(void 0), R = $.current, [_, O] = V(i), D = X(null), U = le(() => d != null ? d : ao(`${wo}-${hn(4)}`), []), Y = le(() => n !== void 0, [n]), oe = b(re), ge = oe.getUnit(U);
|
|
3286
|
+
Re(ge == null ? void 0 : ge.change$);
|
|
3287
|
+
const G = uc(), J = lo.transform.getPlainText((Mn = (Nn = ge == null ? void 0 : ge.getBody()) == null ? void 0 : Nn.dataStream) != null ? Mn : ""), Je = Qe(J), et = le(() => Nc(J), [J]), Nt = le(() => G(et), [et, G]), { isSelecting: Ne, isSelectingRef: Mt } = lc({ unitId: r, subUnitId: s, editorId: U, isFocus: _, disableOnClick: m }), K = X(""), me = b(Te).getRenderById(U), se = me == null ? void 0 : me.with(mr), ue = se == null ? void 0 : se.isFocusing, pe = le(() => oe.getCurrentTypeOfUnit$(B.UNIVER_DOC), [oe]), Ce = Re(pe), Ve = (Ce == null ? void 0 : Ce.getUnitId()) === U, He = X([]), z = Ne, De = (wn = (xn = b(gn).getConfig(xr)) == null ? void 0 : xn.functionScreenTips) != null ? wn : !0;
|
|
3288
|
+
Is(() => {
|
|
3331
3289
|
M(J);
|
|
3332
3290
|
}, [J, M]);
|
|
3333
|
-
const
|
|
3291
|
+
const tt = jr("="), Be = hc(r, s), Se = ee((Z, ae = !0, Le, Me) => {
|
|
3334
3292
|
if (!$.current) return;
|
|
3335
3293
|
K.current = Z;
|
|
3336
|
-
const
|
|
3294
|
+
const wt = Z[0] === "=" ? Z.slice(1) : "", $e = G(wt), Yr = $e.reduce((qe, kt) => typeof kt == "object" ? `${qe}${kt.token}` : `${qe}${kt}`, ""), Ft = tt(
|
|
3337
3295
|
$.current,
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3296
|
+
Yr === wt ? $e : [],
|
|
3297
|
+
ae,
|
|
3298
|
+
Me
|
|
3341
3299
|
);
|
|
3342
|
-
if (He.current =
|
|
3343
|
-
const qe =
|
|
3300
|
+
if (He.current = Ft, Le) {
|
|
3301
|
+
const qe = Me != null ? Me : R == null ? void 0 : R.getSelectionRanges();
|
|
3344
3302
|
if ((qe == null ? void 0 : qe.length) !== 1)
|
|
3345
3303
|
return;
|
|
3346
|
-
const
|
|
3347
|
-
if (
|
|
3348
|
-
const
|
|
3349
|
-
|
|
3304
|
+
const Gr = qe[0].startOffset - 1, zr = yn($e, Gr, !1), Fn = Hr($e, zr);
|
|
3305
|
+
if (Fn >= 0) {
|
|
3306
|
+
const kn = Ft.splice(Fn, 1)[0];
|
|
3307
|
+
kn && Ft.push(kn);
|
|
3350
3308
|
}
|
|
3351
|
-
Be(_ ?
|
|
3309
|
+
Be(_ ? Ft : [], $.current);
|
|
3352
3310
|
}
|
|
3353
3311
|
});
|
|
3354
3312
|
P(() => {
|
|
3355
|
-
_ &&
|
|
3313
|
+
_ && Se(J, !1, !0);
|
|
3356
3314
|
}, [_]), P(() => {
|
|
3357
3315
|
if (_) {
|
|
3358
3316
|
if (K.current === J) return;
|
|
3359
|
-
|
|
3317
|
+
Se(J, !1, !0);
|
|
3360
3318
|
}
|
|
3361
|
-
}, [J]),
|
|
3362
|
-
const
|
|
3319
|
+
}, [J]), Ec(_, p, J);
|
|
3320
|
+
const ce = cc(R), ft = Sc(_, r, s);
|
|
3363
3321
|
P(() => {
|
|
3364
3322
|
var Z;
|
|
3365
|
-
w(
|
|
3366
|
-
}, [w,
|
|
3323
|
+
w(Ne, (Z = se == null ? void 0 : se.isFocusing) != null ? Z : !0);
|
|
3324
|
+
}, [w, Ne]), Zo(_, v, R), Ut(() => {
|
|
3367
3325
|
let Z;
|
|
3368
3326
|
if (D.current) {
|
|
3369
|
-
Z =
|
|
3370
|
-
autofocus:
|
|
3327
|
+
Z = k.register({
|
|
3328
|
+
autofocus: y,
|
|
3371
3329
|
editorUnitId: U,
|
|
3372
3330
|
initialSnapshot: {
|
|
3373
3331
|
id: U,
|
|
@@ -3382,63 +3340,63 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
|
|
|
3382
3340
|
documentStyle: {}
|
|
3383
3341
|
}
|
|
3384
3342
|
}, D.current);
|
|
3385
|
-
const
|
|
3386
|
-
$.current =
|
|
3343
|
+
const ae = k.getEditor(U);
|
|
3344
|
+
$.current = ae, Se(o, !1, !0);
|
|
3387
3345
|
}
|
|
3388
3346
|
return () => {
|
|
3389
3347
|
Z == null || Z.dispose();
|
|
3390
3348
|
};
|
|
3391
|
-
}, []),
|
|
3392
|
-
i ? (O(i),
|
|
3393
|
-
}, [i,
|
|
3394
|
-
const { checkScrollBar:
|
|
3395
|
-
|
|
3396
|
-
const
|
|
3397
|
-
if (!
|
|
3349
|
+
}, []), Ut(() => {
|
|
3350
|
+
i ? (O(i), ce()) : (C && (R == null || R.blur(), ft()), O(i));
|
|
3351
|
+
}, [i, R, ce, ft, C]);
|
|
3352
|
+
const { checkScrollBar: Xt } = Xo(R, E, I);
|
|
3353
|
+
pc(_, !!(Ne && Ve), r, U, T), mc(!!(_ && ue && l), z, R, f);
|
|
3354
|
+
const xt = ee((Z, ae, Le) => {
|
|
3355
|
+
if (!ue)
|
|
3398
3356
|
return;
|
|
3399
|
-
const
|
|
3400
|
-
|
|
3401
|
-
const
|
|
3402
|
-
|
|
3403
|
-
}, 50),
|
|
3357
|
+
const Me = ae !== -1 ? [{ startOffset: ae + 1, endOffset: ae + 1, collapsed: !0 }] : void 0;
|
|
3358
|
+
Se(`=${Z}`, !0, Le, Me), Le && (ce(), ae !== -1 && setTimeout(() => {
|
|
3359
|
+
const wt = { startOffset: ae + 1, endOffset: ae + 1 }, $e = R == null ? void 0 : R.render.with(Qo);
|
|
3360
|
+
$e == null || $e.scrollToRange({ ...wt, collapsed: !0 });
|
|
3361
|
+
}, 50), Xt());
|
|
3404
3362
|
});
|
|
3405
|
-
|
|
3406
|
-
_ && !!(
|
|
3363
|
+
Rc(
|
|
3364
|
+
_ && !!(Ne && Ve),
|
|
3407
3365
|
_,
|
|
3408
|
-
|
|
3366
|
+
Mt,
|
|
3409
3367
|
r,
|
|
3410
3368
|
s,
|
|
3411
3369
|
He,
|
|
3412
3370
|
c,
|
|
3413
3371
|
!!z,
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
),
|
|
3417
|
-
|
|
3372
|
+
R,
|
|
3373
|
+
xt
|
|
3374
|
+
), Ic(_ && !!(Ne && Ve), r, c, O, h, () => {
|
|
3375
|
+
Se(Je.current, !1, !0);
|
|
3418
3376
|
});
|
|
3419
|
-
const
|
|
3377
|
+
const Tn = (Z) => {
|
|
3420
3378
|
if (Z) {
|
|
3421
|
-
const
|
|
3422
|
-
if (
|
|
3423
|
-
const
|
|
3424
|
-
if (
|
|
3425
|
-
const
|
|
3379
|
+
const ae = R == null ? void 0 : R.getSelectionRanges();
|
|
3380
|
+
if (ae && ae.length === 1) {
|
|
3381
|
+
const Le = ae[0];
|
|
3382
|
+
if (Le.collapsed) {
|
|
3383
|
+
const Me = Z.offset;
|
|
3426
3384
|
setTimeout(() => {
|
|
3427
|
-
|
|
3385
|
+
R == null || R.setSelectionRanges([{ startOffset: Le.startOffset - Me, endOffset: Le.endOffset - Me }]);
|
|
3428
3386
|
}, 30);
|
|
3429
3387
|
}
|
|
3430
3388
|
}
|
|
3431
|
-
|
|
3389
|
+
ce(), Se(`=${Z.text}`);
|
|
3432
3390
|
}
|
|
3433
|
-
},
|
|
3434
|
-
O(!0), a(),
|
|
3391
|
+
}, On = () => {
|
|
3392
|
+
O(!0), a(), ce();
|
|
3435
3393
|
};
|
|
3436
|
-
return /* @__PURE__ */
|
|
3394
|
+
return /* @__PURE__ */ H("div", { className: u, children: [
|
|
3437
3395
|
/* @__PURE__ */ x(
|
|
3438
3396
|
"div",
|
|
3439
3397
|
{
|
|
3440
3398
|
ref: N,
|
|
3441
|
-
className:
|
|
3399
|
+
className: ie("univer-relative univer-box-border univer-flex univer-size-full univer-items-center univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1", {
|
|
3442
3400
|
"univer-ring-primary-500": _,
|
|
3443
3401
|
"univer-ring-red-500": Y
|
|
3444
3402
|
}),
|
|
@@ -3447,43 +3405,43 @@ const Oc = (e) => e.startsWith(pr.EQUALS) ? e.slice(1) : "", or = () => {
|
|
|
3447
3405
|
{
|
|
3448
3406
|
ref: D,
|
|
3449
3407
|
className: "univer-relative univer-size-full",
|
|
3450
|
-
onMouseUp:
|
|
3408
|
+
onMouseUp: On
|
|
3451
3409
|
}
|
|
3452
3410
|
)
|
|
3453
3411
|
}
|
|
3454
3412
|
),
|
|
3455
3413
|
n !== void 0 && /* @__PURE__ */ x("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }),
|
|
3456
|
-
|
|
3457
|
-
|
|
3414
|
+
De && R && et !== "" && /* @__PURE__ */ x(
|
|
3415
|
+
ic,
|
|
3458
3416
|
{
|
|
3459
|
-
editor:
|
|
3417
|
+
editor: R,
|
|
3460
3418
|
isFocus: _,
|
|
3461
3419
|
formulaText: J,
|
|
3462
|
-
onClose: () =>
|
|
3420
|
+
onClose: () => ce()
|
|
3463
3421
|
}
|
|
3464
3422
|
),
|
|
3465
|
-
|
|
3466
|
-
|
|
3423
|
+
De && !!R && /* @__PURE__ */ x(
|
|
3424
|
+
Tc,
|
|
3467
3425
|
{
|
|
3468
3426
|
isFocus: _,
|
|
3469
|
-
sequenceNodes:
|
|
3470
|
-
onSelect:
|
|
3471
|
-
ref:
|
|
3472
|
-
editor:
|
|
3427
|
+
sequenceNodes: Nt,
|
|
3428
|
+
onSelect: Tn,
|
|
3429
|
+
ref: F,
|
|
3430
|
+
editor: R
|
|
3473
3431
|
}
|
|
3474
3432
|
)
|
|
3475
3433
|
] });
|
|
3476
3434
|
});
|
|
3477
|
-
function
|
|
3478
|
-
const r =
|
|
3435
|
+
function xc(e, t, n, o) {
|
|
3436
|
+
const r = b(ke), s = jr(""), i = Re(e == null ? void 0 : e.getDocumentDataModel().change$), [c, a] = V([]), h = b(Fo), g = X(""), p = b(re);
|
|
3479
3437
|
return P(() => {
|
|
3480
3438
|
if (!e) return;
|
|
3481
3439
|
const u = e.getDocumentDataModel().getPlainText();
|
|
3482
|
-
if (
|
|
3440
|
+
if (g.current === u)
|
|
3483
3441
|
return;
|
|
3484
|
-
|
|
3485
|
-
const
|
|
3486
|
-
a(
|
|
3442
|
+
g.current = u;
|
|
3443
|
+
const d = r.sequenceNodesBuilder(u);
|
|
3444
|
+
a(d != null ? d : []);
|
|
3487
3445
|
}, [i, e, r]), P(() => {
|
|
3488
3446
|
var l, S;
|
|
3489
3447
|
if (!e) return;
|
|
@@ -3499,13 +3457,13 @@ function Mc(e, t, n, o) {
|
|
|
3499
3457
|
});
|
|
3500
3458
|
return;
|
|
3501
3459
|
}
|
|
3502
|
-
const u = s(e, c, !1),
|
|
3460
|
+
const u = s(e, c, !1), d = new Ye();
|
|
3503
3461
|
return u.forEach((v) => {
|
|
3504
|
-
const
|
|
3505
|
-
if (!
|
|
3462
|
+
const f = ut(v.token), C = p.getCurrentUnitForType(B.UNIVER_SHEET), I = C == null ? void 0 : C.getActiveSheet();
|
|
3463
|
+
if (!f.sheetName && o !== (I == null ? void 0 : I.getSheetId()) || f.sheetName && (I == null ? void 0 : I.getName()) !== f.sheetName)
|
|
3506
3464
|
return;
|
|
3507
|
-
const E = new
|
|
3508
|
-
range:
|
|
3465
|
+
const E = new fn(v.themeColor).toRgb(), m = h.addShape({
|
|
3466
|
+
range: f.range,
|
|
3509
3467
|
style: {
|
|
3510
3468
|
stroke: v.themeColor,
|
|
3511
3469
|
fill: `rgba(${E.r}, ${E.g}, ${E.b}, 0.1)`,
|
|
@@ -3513,44 +3471,44 @@ function Mc(e, t, n, o) {
|
|
|
3513
3471
|
},
|
|
3514
3472
|
primary: null
|
|
3515
3473
|
});
|
|
3516
|
-
|
|
3474
|
+
m && d.add(() => h.removeShape(m));
|
|
3517
3475
|
}), () => {
|
|
3518
|
-
|
|
3476
|
+
d.dispose();
|
|
3519
3477
|
};
|
|
3520
|
-
}, [e, t, s,
|
|
3478
|
+
}, [e, t, s, h, c]), { sequenceNodes: c };
|
|
3521
3479
|
}
|
|
3522
|
-
function
|
|
3523
|
-
const t =
|
|
3524
|
-
const
|
|
3525
|
-
if (!
|
|
3526
|
-
const l = o ?
|
|
3480
|
+
function wc(e) {
|
|
3481
|
+
const t = b(vn), { supportAcrossSheet: n = !1, keepSheetReference: o = !1, unitId: r, subUnitId: s, onChange: i } = e, a = b(re).getUnit(r, B.UNIVER_SHEET), h = ee(i), g = ee((p, u) => {
|
|
3482
|
+
const d = a == null ? void 0 : a.getActiveSheet();
|
|
3483
|
+
if (!d || !n && d.getSheetId() !== s || !(p != null && p.length)) return;
|
|
3484
|
+
const l = o ? d.getName() : d.getSheetId() === s ? "" : d.getName(), S = p.map((v) => ({
|
|
3527
3485
|
range: v.range,
|
|
3528
3486
|
unitId: r,
|
|
3529
3487
|
sheetName: l
|
|
3530
3488
|
}));
|
|
3531
|
-
|
|
3489
|
+
h(S, u);
|
|
3532
3490
|
});
|
|
3533
3491
|
P(() => {
|
|
3534
|
-
const
|
|
3535
|
-
return
|
|
3536
|
-
|
|
3537
|
-
})),
|
|
3538
|
-
|
|
3539
|
-
})),
|
|
3540
|
-
|
|
3492
|
+
const p = new Ye();
|
|
3493
|
+
return p.add(t.selectionMoveStart$.subscribe((u) => {
|
|
3494
|
+
g(u, !0);
|
|
3495
|
+
})), p.add(t.selectionMoving$.subscribe((u) => {
|
|
3496
|
+
g(u, !1);
|
|
3497
|
+
})), p.add(t.selectionMoveEnd$.subscribe((u) => {
|
|
3498
|
+
g(u, !1);
|
|
3541
3499
|
})), () => {
|
|
3542
|
-
|
|
3500
|
+
p.dispose();
|
|
3543
3501
|
};
|
|
3544
|
-
}, [
|
|
3502
|
+
}, [g, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
|
|
3545
3503
|
}
|
|
3546
|
-
const
|
|
3504
|
+
const Jn = (e) => !e.some((n) => {
|
|
3547
3505
|
if (typeof n == "string") {
|
|
3548
3506
|
if (n !== Ge.COMMA)
|
|
3549
3507
|
return !0;
|
|
3550
3508
|
} else if (n.nodeType !== Q.REFERENCE)
|
|
3551
3509
|
return !0;
|
|
3552
3510
|
return !1;
|
|
3553
|
-
}),
|
|
3511
|
+
}), Fc = (e) => {
|
|
3554
3512
|
if (e.endColumn < e.startColumn) {
|
|
3555
3513
|
const t = e.endColumn;
|
|
3556
3514
|
e.endColumn = e.startColumn, e.startColumn = t;
|
|
@@ -3571,113 +3529,113 @@ function kc(e) {
|
|
|
3571
3529
|
supportAcrossSheet: i,
|
|
3572
3530
|
keepSheetReference: c,
|
|
3573
3531
|
onConfirm: a,
|
|
3574
|
-
onClose:
|
|
3575
|
-
onShowBySelection:
|
|
3576
|
-
} = e,
|
|
3532
|
+
onClose: h,
|
|
3533
|
+
onShowBySelection: g
|
|
3534
|
+
} = e, p = b(lt), u = b(ke), [d, l] = V([]), [S, v] = V(0), f = X(null);
|
|
3577
3535
|
P(() => {
|
|
3578
3536
|
if (t && n.length) {
|
|
3579
|
-
const
|
|
3580
|
-
l(
|
|
3537
|
+
const m = n.map((y) => y.sheetName ? Ct(y.sheetName, y.range) : be(y.range));
|
|
3538
|
+
l(m), v(m.length - 1);
|
|
3581
3539
|
} else
|
|
3582
3540
|
l([""]), v(0);
|
|
3583
3541
|
}, [t]);
|
|
3584
|
-
const C = (
|
|
3585
|
-
const T = [...
|
|
3586
|
-
T[
|
|
3587
|
-
},
|
|
3588
|
-
l([...
|
|
3589
|
-
}, E = (
|
|
3590
|
-
|
|
3542
|
+
const C = (m, y) => {
|
|
3543
|
+
const T = [...d];
|
|
3544
|
+
T[m] = y, l(T);
|
|
3545
|
+
}, I = () => {
|
|
3546
|
+
l([...d, ""]), v(d.length);
|
|
3547
|
+
}, E = (m) => {
|
|
3548
|
+
d.splice(m, 1), l([...d]);
|
|
3591
3549
|
};
|
|
3592
|
-
return
|
|
3550
|
+
return wc({
|
|
3593
3551
|
unitId: o,
|
|
3594
3552
|
subUnitId: r,
|
|
3595
3553
|
supportAcrossSheet: i,
|
|
3596
3554
|
keepSheetReference: c,
|
|
3597
|
-
onChange: (
|
|
3598
|
-
if (!t &&
|
|
3555
|
+
onChange: (m, y) => {
|
|
3556
|
+
if (!t && g != null && g(m))
|
|
3599
3557
|
return;
|
|
3600
|
-
const T = new Set(
|
|
3601
|
-
if (!
|
|
3602
|
-
const N = [...
|
|
3603
|
-
if (
|
|
3604
|
-
|
|
3558
|
+
const T = new Set(d), A = m.map((M) => M.sheetName ? Ct(M.sheetName, M.range) : be(M.range)), k = A.filter((M) => !T.has(M));
|
|
3559
|
+
if (!k.length) return;
|
|
3560
|
+
const N = [...d];
|
|
3561
|
+
if (A.length > 1) {
|
|
3562
|
+
y || N.splice(S, 1), N.push(...k);
|
|
3605
3563
|
const M = N.slice(0, s);
|
|
3606
3564
|
l(M), v(M.length - 1), requestAnimationFrame(() => {
|
|
3607
3565
|
var w;
|
|
3608
|
-
(w =
|
|
3566
|
+
(w = f.current) == null || w.scrollTo({ top: f.current.scrollHeight });
|
|
3609
3567
|
});
|
|
3610
3568
|
} else {
|
|
3611
|
-
N.splice(S, 1, ...
|
|
3569
|
+
N.splice(S, 1, ...k);
|
|
3612
3570
|
const M = N.slice(0, s);
|
|
3613
|
-
l(M), v(S +
|
|
3571
|
+
l(M), v(S + k.length - 1);
|
|
3614
3572
|
}
|
|
3615
3573
|
}
|
|
3616
3574
|
}), /* @__PURE__ */ x(
|
|
3617
|
-
|
|
3575
|
+
xs,
|
|
3618
3576
|
{
|
|
3619
3577
|
width: "328px",
|
|
3620
3578
|
open: t,
|
|
3621
|
-
title:
|
|
3579
|
+
title: p.t("rangeSelector.title"),
|
|
3622
3580
|
draggable: !0,
|
|
3623
3581
|
mask: !1,
|
|
3624
3582
|
maskClosable: !1,
|
|
3625
|
-
footer: /* @__PURE__ */
|
|
3626
|
-
/* @__PURE__ */ x(
|
|
3583
|
+
footer: /* @__PURE__ */ H("footer", { className: "univer-flex univer-gap-2", children: [
|
|
3584
|
+
/* @__PURE__ */ x(ot, { onClick: h, children: p.t("rangeSelector.cancel") }),
|
|
3627
3585
|
/* @__PURE__ */ x(
|
|
3628
|
-
|
|
3586
|
+
ot,
|
|
3629
3587
|
{
|
|
3630
3588
|
variant: "primary",
|
|
3631
3589
|
onClick: () => {
|
|
3632
3590
|
a(
|
|
3633
|
-
|
|
3634
|
-
const
|
|
3635
|
-
return
|
|
3636
|
-
}).map((
|
|
3591
|
+
d.filter((m) => {
|
|
3592
|
+
const y = u.sequenceNodesBuilder(m);
|
|
3593
|
+
return y && y.length === 1 && typeof y[0] != "string" && y[0].nodeType === Q.REFERENCE;
|
|
3594
|
+
}).map((m) => ut(m)).map((m) => ({ ...m, range: Fc(m.range) }))
|
|
3637
3595
|
);
|
|
3638
3596
|
},
|
|
3639
|
-
children:
|
|
3597
|
+
children: p.t("rangeSelector.confirm")
|
|
3640
3598
|
}
|
|
3641
3599
|
)
|
|
3642
3600
|
] }),
|
|
3643
|
-
onClose:
|
|
3644
|
-
children: /* @__PURE__ */
|
|
3601
|
+
onClose: h,
|
|
3602
|
+
children: /* @__PURE__ */ H(
|
|
3645
3603
|
"div",
|
|
3646
3604
|
{
|
|
3647
|
-
ref:
|
|
3648
|
-
className:
|
|
3605
|
+
ref: f,
|
|
3606
|
+
className: ie("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", it),
|
|
3649
3607
|
children: [
|
|
3650
|
-
|
|
3608
|
+
d.map((m, y) => /* @__PURE__ */ H(
|
|
3651
3609
|
"div",
|
|
3652
3610
|
{
|
|
3653
3611
|
className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
|
|
3654
3612
|
children: [
|
|
3655
3613
|
/* @__PURE__ */ x(
|
|
3656
|
-
|
|
3614
|
+
br,
|
|
3657
3615
|
{
|
|
3658
|
-
className:
|
|
3659
|
-
"univer-border-primary-600": S ===
|
|
3616
|
+
className: ie("univer-w-full", {
|
|
3617
|
+
"univer-border-primary-600": S === y
|
|
3660
3618
|
}),
|
|
3661
|
-
placeholder:
|
|
3662
|
-
onFocus: () => v(
|
|
3663
|
-
value:
|
|
3664
|
-
onChange: (T) => C(
|
|
3619
|
+
placeholder: p.t("rangeSelector.placeHolder"),
|
|
3620
|
+
onFocus: () => v(y),
|
|
3621
|
+
value: m,
|
|
3622
|
+
onChange: (T) => C(y, T)
|
|
3665
3623
|
}
|
|
3666
3624
|
),
|
|
3667
|
-
|
|
3625
|
+
d.length > 1 && /* @__PURE__ */ x(
|
|
3668
3626
|
$r,
|
|
3669
3627
|
{
|
|
3670
3628
|
className: "univer-cursor-pointer",
|
|
3671
|
-
onClick: () => E(
|
|
3629
|
+
onClick: () => E(y)
|
|
3672
3630
|
}
|
|
3673
3631
|
)
|
|
3674
3632
|
]
|
|
3675
3633
|
},
|
|
3676
|
-
|
|
3634
|
+
y
|
|
3677
3635
|
)),
|
|
3678
|
-
|
|
3636
|
+
d.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ H(ot, { variant: "link", onClick: I, children: [
|
|
3679
3637
|
/* @__PURE__ */ x(Pr, {}),
|
|
3680
|
-
/* @__PURE__ */ x("span", { children:
|
|
3638
|
+
/* @__PURE__ */ x("span", { children: p.t("rangeSelector.addAnotherRange") })
|
|
3681
3639
|
] }) })
|
|
3682
3640
|
]
|
|
3683
3641
|
}
|
|
@@ -3686,33 +3644,33 @@ function kc(e) {
|
|
|
3686
3644
|
);
|
|
3687
3645
|
}
|
|
3688
3646
|
function Ac(e) {
|
|
3689
|
-
return e.split(Ge.COMMA).filter((t) => !!t).map((t) =>
|
|
3647
|
+
return e.split(Ge.COMMA).filter((t) => !!t).map((t) => ut(t));
|
|
3690
3648
|
}
|
|
3691
|
-
function
|
|
3692
|
-
return e.map((t) => t.sheetName ?
|
|
3649
|
+
function Dc(e) {
|
|
3650
|
+
return e.map((t) => t.sheetName ? Ct(t.sheetName, t.range) : be(t.range)).join(Ge.COMMA);
|
|
3693
3651
|
}
|
|
3694
3652
|
function Kr(e) {
|
|
3695
|
-
const [t, n] =
|
|
3653
|
+
const [t, n] = V(null), {
|
|
3696
3654
|
onVerify: o,
|
|
3697
3655
|
selectorRef: r,
|
|
3698
3656
|
unitId: s,
|
|
3699
3657
|
subUnitId: i,
|
|
3700
3658
|
maxRangeCount: c,
|
|
3701
3659
|
supportAcrossSheet: a,
|
|
3702
|
-
keepSheetReference:
|
|
3703
|
-
autoFocus:
|
|
3704
|
-
onChange:
|
|
3660
|
+
keepSheetReference: h,
|
|
3661
|
+
autoFocus: g,
|
|
3662
|
+
onChange: p,
|
|
3705
3663
|
onRangeSelectorDialogVisibleChange: u,
|
|
3706
|
-
onClickOutside:
|
|
3664
|
+
onClickOutside: d,
|
|
3707
3665
|
onFocusChange: l,
|
|
3708
3666
|
forceShowDialogWhenSelectionChanged: S,
|
|
3709
3667
|
hideEditor: v,
|
|
3710
|
-
resetRange:
|
|
3711
|
-
} = e, [C,
|
|
3712
|
-
t == null || t.setSelectionRanges([]), t == null || t.blur(),
|
|
3668
|
+
resetRange: f
|
|
3669
|
+
} = e, [C, I] = V(g != null ? g : !1), [E, m] = V(!1), [y, T] = V([]), A = b(lt), k = b(ze), { sequenceNodes: N } = xc(t, C, s, i), M = Qe(N), w = b(ve), F = ee(() => {
|
|
3670
|
+
t == null || t.setSelectionRanges([]), t == null || t.blur(), k.blur();
|
|
3713
3671
|
}), $ = ee(() => {
|
|
3714
|
-
var
|
|
3715
|
-
|
|
3672
|
+
var R;
|
|
3673
|
+
F(), T(Ac((R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "")), m(!0);
|
|
3716
3674
|
});
|
|
3717
3675
|
return P(() => {
|
|
3718
3676
|
r && (r.current = {
|
|
@@ -3720,51 +3678,51 @@ function Kr(e) {
|
|
|
3720
3678
|
return t;
|
|
3721
3679
|
},
|
|
3722
3680
|
focus() {
|
|
3723
|
-
|
|
3681
|
+
k.focus(t.getEditorId());
|
|
3724
3682
|
},
|
|
3725
|
-
blur:
|
|
3726
|
-
verify: () =>
|
|
3727
|
-
showDialog: (
|
|
3728
|
-
|
|
3683
|
+
blur: F,
|
|
3684
|
+
verify: () => Jn(M.current),
|
|
3685
|
+
showDialog: (R) => {
|
|
3686
|
+
F(), T(R), m(!0);
|
|
3729
3687
|
},
|
|
3730
3688
|
hideDialog: () => {
|
|
3731
|
-
T([]),
|
|
3689
|
+
T([]), m(!1);
|
|
3732
3690
|
},
|
|
3733
3691
|
getValue: () => {
|
|
3734
|
-
var
|
|
3735
|
-
return (
|
|
3692
|
+
var R;
|
|
3693
|
+
return (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "";
|
|
3736
3694
|
}
|
|
3737
3695
|
});
|
|
3738
|
-
}, [
|
|
3739
|
-
var
|
|
3740
|
-
o == null || o(
|
|
3696
|
+
}, [F, t, k, r, M]), P(() => {
|
|
3697
|
+
var R;
|
|
3698
|
+
o == null || o(Jn(N), (R = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? R : "");
|
|
3741
3699
|
}, [N]), P(() => {
|
|
3742
3700
|
u == null || u(E);
|
|
3743
3701
|
}, [E]), P(() => {
|
|
3744
|
-
if (E &&
|
|
3702
|
+
if (E && f)
|
|
3745
3703
|
return () => {
|
|
3746
|
-
const
|
|
3704
|
+
const R = {
|
|
3747
3705
|
unitId: s,
|
|
3748
3706
|
subUnitId: i,
|
|
3749
|
-
selections:
|
|
3707
|
+
selections: f
|
|
3750
3708
|
};
|
|
3751
|
-
w.executeCommand(
|
|
3709
|
+
w.executeCommand(Cn.id, R);
|
|
3752
3710
|
};
|
|
3753
|
-
}, [E]), /* @__PURE__ */
|
|
3711
|
+
}, [E]), /* @__PURE__ */ H(bs, { children: [
|
|
3754
3712
|
v ? null : /* @__PURE__ */ x(
|
|
3755
|
-
|
|
3713
|
+
Jo,
|
|
3756
3714
|
{
|
|
3757
3715
|
isSingle: !0,
|
|
3758
3716
|
...e,
|
|
3759
|
-
onFocusChange: (
|
|
3760
|
-
R
|
|
3717
|
+
onFocusChange: (R, _) => {
|
|
3718
|
+
I(R), l == null || l(R, _);
|
|
3761
3719
|
},
|
|
3762
3720
|
editorRef: n,
|
|
3763
3721
|
onClickOutside: () => {
|
|
3764
|
-
|
|
3722
|
+
I(!1), F(), d == null || d();
|
|
3765
3723
|
},
|
|
3766
|
-
icon: /* @__PURE__ */ x(
|
|
3767
|
-
|
|
3724
|
+
icon: /* @__PURE__ */ x(Ms, { title: A.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
|
|
3725
|
+
Wr,
|
|
3768
3726
|
{
|
|
3769
3727
|
className: "univer-cursor-pointer dark:!univer-text-gray-300",
|
|
3770
3728
|
onClick: $
|
|
@@ -3775,30 +3733,30 @@ function Kr(e) {
|
|
|
3775
3733
|
/* @__PURE__ */ x(
|
|
3776
3734
|
kc,
|
|
3777
3735
|
{
|
|
3778
|
-
initialValue:
|
|
3736
|
+
initialValue: y,
|
|
3779
3737
|
unitId: s,
|
|
3780
3738
|
subUnitId: i,
|
|
3781
3739
|
visible: E,
|
|
3782
3740
|
maxRangeCount: c,
|
|
3783
|
-
onConfirm: (
|
|
3784
|
-
const _ =
|
|
3785
|
-
O.body.dataStream = _, t == null || t.replaceText(_, !1),
|
|
3786
|
-
|
|
3741
|
+
onConfirm: (R) => {
|
|
3742
|
+
const _ = Dc(R), O = uo.newEmptyData();
|
|
3743
|
+
O.body.dataStream = _, t == null || t.replaceText(_, !1), p == null || p(O, _), m(!1), T([]), requestAnimationFrame(() => {
|
|
3744
|
+
F();
|
|
3787
3745
|
});
|
|
3788
3746
|
},
|
|
3789
3747
|
onClose: () => {
|
|
3790
|
-
|
|
3748
|
+
m(!1), T([]);
|
|
3791
3749
|
},
|
|
3792
3750
|
supportAcrossSheet: a,
|
|
3793
|
-
keepSheetReference:
|
|
3794
|
-
onShowBySelection: (
|
|
3751
|
+
keepSheetReference: h,
|
|
3752
|
+
onShowBySelection: (R) => C || S ? (T(R), m(!0), !1) : !0
|
|
3795
3753
|
}
|
|
3796
3754
|
)
|
|
3797
3755
|
] });
|
|
3798
3756
|
}
|
|
3799
|
-
const
|
|
3757
|
+
const Lc = () => {
|
|
3800
3758
|
var o, r;
|
|
3801
|
-
const e =
|
|
3759
|
+
const e = b(Vr), t = Re(e.currentSelector$), n = X(null);
|
|
3802
3760
|
return P(() => {
|
|
3803
3761
|
var s, i;
|
|
3804
3762
|
if (t)
|
|
@@ -3815,89 +3773,90 @@ const Dc = () => {
|
|
|
3815
3773
|
selectorRef: n,
|
|
3816
3774
|
onChange: (s, i) => {
|
|
3817
3775
|
var c;
|
|
3818
|
-
t == null || t.callback((c = i == null ? void 0 : i.split(",").map((a) =>
|
|
3776
|
+
t == null || t.callback((c = i == null ? void 0 : i.split(",").map((a) => ut(a))) != null ? c : []);
|
|
3819
3777
|
}
|
|
3820
3778
|
}
|
|
3821
3779
|
);
|
|
3822
3780
|
};
|
|
3823
|
-
var
|
|
3824
|
-
for (var r = o > 1 ? void 0 : o ?
|
|
3781
|
+
var $c = Object.defineProperty, Pc = Object.getOwnPropertyDescriptor, Uc = (e, t, n) => t in e ? $c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Wc = (e, t, n, o) => {
|
|
3782
|
+
for (var r = o > 1 ? void 0 : o ? Pc(t, n) : t, s = e.length - 1, i; s >= 0; s--)
|
|
3825
3783
|
(i = e[s]) && (r = i(r) || r);
|
|
3826
3784
|
return r;
|
|
3827
|
-
},
|
|
3828
|
-
let
|
|
3829
|
-
constructor(e =
|
|
3785
|
+
}, Lt = (e, t) => (n, o) => t(n, o, e), Zt = (e, t, n) => Uc(e, typeof t != "symbol" ? t + "" : t, n);
|
|
3786
|
+
let ct = class extends fo {
|
|
3787
|
+
constructor(e = zn, t, n, o, r) {
|
|
3830
3788
|
super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
|
|
3831
|
-
const { menu: s, ...i } =
|
|
3832
|
-
|
|
3789
|
+
const { menu: s, ...i } = go(
|
|
3790
|
+
zn,
|
|
3833
3791
|
this._config
|
|
3834
3792
|
);
|
|
3835
3793
|
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(xr, i, { merge: !0 });
|
|
3836
3794
|
}
|
|
3837
3795
|
onStarting() {
|
|
3838
|
-
|
|
3839
|
-
[
|
|
3840
|
-
[
|
|
3796
|
+
mo(this._injector, [
|
|
3797
|
+
[Gt, { useClass: sn }],
|
|
3798
|
+
[Vr],
|
|
3841
3799
|
[qt],
|
|
3842
3800
|
[Vt],
|
|
3843
|
-
[Wt],
|
|
3844
3801
|
[Ht],
|
|
3845
3802
|
[Bt],
|
|
3846
|
-
[
|
|
3803
|
+
[Wt],
|
|
3847
3804
|
[jt]
|
|
3848
3805
|
]), this._initUIPart();
|
|
3849
3806
|
}
|
|
3850
3807
|
onReady() {
|
|
3851
3808
|
[
|
|
3852
|
-
[
|
|
3809
|
+
[Ue]
|
|
3853
3810
|
].forEach((e) => {
|
|
3854
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3811
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, e));
|
|
3855
3812
|
});
|
|
3856
3813
|
}
|
|
3857
3814
|
onRendered() {
|
|
3858
3815
|
[
|
|
3859
|
-
[
|
|
3816
|
+
[cn]
|
|
3860
3817
|
].forEach((e) => {
|
|
3861
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
3862
|
-
}),
|
|
3818
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(B.UNIVER_SHEET, e));
|
|
3819
|
+
}), po(this._injector, [
|
|
3863
3820
|
[qt],
|
|
3864
3821
|
// FormulaProgressBar relies on TriggerCalculationController, but it is necessary to ensure that the formula calculation is done after rendered.
|
|
3865
|
-
[
|
|
3822
|
+
[Vt],
|
|
3866
3823
|
[Bt],
|
|
3867
3824
|
[jt]
|
|
3868
3825
|
]);
|
|
3869
3826
|
}
|
|
3870
3827
|
onSteady() {
|
|
3871
|
-
this._injector.get(
|
|
3828
|
+
this._injector.get(Wt);
|
|
3872
3829
|
}
|
|
3873
3830
|
_initUIPart() {
|
|
3874
|
-
const e = this._injector.get(
|
|
3875
|
-
this.disposeWithMe(e.register(
|
|
3831
|
+
const e = this._injector.get(Ir);
|
|
3832
|
+
this.disposeWithMe(e.register(ko, Kr)), this.disposeWithMe(e.register(Ao, Mc)), this.disposeWithMe(this._uiPartsService.registerComponent(Es.GLOBAL, () => Er(Lc, this._injector)));
|
|
3876
3833
|
}
|
|
3877
3834
|
};
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3835
|
+
Zt(ct, "pluginName", Tr);
|
|
3836
|
+
Zt(ct, "packageName", Mr.name);
|
|
3837
|
+
Zt(ct, "version", Mr.version);
|
|
3838
|
+
Zt(ct, "type", B.UNIVER_SHEET);
|
|
3839
|
+
ct = Wc([
|
|
3840
|
+
ho(ps),
|
|
3841
|
+
Lt(1, q(Rt)),
|
|
3842
|
+
Lt(2, Te),
|
|
3843
|
+
Lt(3, gn),
|
|
3844
|
+
Lt(4, Rr)
|
|
3845
|
+
], ct);
|
|
3887
3846
|
export {
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3847
|
+
Ds as FORMULA_PROMPT_ACTIVATED,
|
|
3848
|
+
Mc as FormulaEditor,
|
|
3849
|
+
Wt as FormulaReorderController,
|
|
3850
|
+
Vr as GlobalRangeSelectorService,
|
|
3851
|
+
Ls as HelpFunctionOperation,
|
|
3852
|
+
ne as InsertFunctionOperation,
|
|
3853
|
+
he as MoreFunctionsOperation,
|
|
3895
3854
|
Kr as RangeSelector,
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3855
|
+
Ue as RefSelectionsRenderService,
|
|
3856
|
+
Nr as ReferenceAbsoluteOperation,
|
|
3857
|
+
Bs as SearchFunctionOperation,
|
|
3858
|
+
ht as SelectEditorFormulaOperation,
|
|
3859
|
+
En as SheetCopyFormulaOnlyCommand,
|
|
3860
|
+
bn as SheetOnlyPasteFormulaCommand,
|
|
3861
|
+
ct as UniverSheetsFormulaUIPlugin
|
|
3903
3862
|
};
|