@univerjs/sheets-formula-ui 0.8.3 → 0.9.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 +6 -6
- package/lib/es/index.js +581 -571
- package/lib/index.js +581 -571
- package/lib/umd/index.js +6 -6
- package/package.json +13 -13
package/lib/es/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
var Vr = Object.defineProperty;
|
|
2
2
|
var Wr = (e, t, n) => t in e ? Vr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var K = (e, t, n) => Wr(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { CommandType as Te, ICommandService as fe, createIdentifier as Hr, IContextService as an, IUniverInstanceService as te, Rectangle as
|
|
5
|
-
import { SheetPasteCommand as ao, PREDEFINED_HOOK_NAME as
|
|
6
|
-
import { sequenceNodeType as X, serializeRange as Re, FormulaDataModel as bt, LexerTreeBuilder as Ie, ERROR_TYPE_SET as Oo, ErrorType as ae, SetFormulaCalculationResultMutation as No, SetArrayFormulaDataMutation as Mo, SetFormulaCalculationStopMutation as wo, FunctionType as ko, deserializeRangeWithSheetWithCache as Ao, matchRefDrawToken as Fo, isFormulaLexerToken as Do, matchToken as
|
|
7
|
-
import { Subject as mt, debounceTime as hn, combineLatestWith as Uo, map as
|
|
8
|
-
import { IEditorService as je, DocSelectionRenderService as lr, ReplaceTextRunsCommand as
|
|
9
|
-
import { DeviceInputEventType as xe, IRenderManagerService as Oe, ScrollTimerType as
|
|
10
|
-
import { SheetsSelectionsService as fn, getSheetCommandTarget as ur, getCellAtRowCol as Xo, SetSelectionsOperation as gn, SheetInterceptorService as mn, ReorderRangeCommand as Qo, SetRangeValuesMutation as Dt, SetRangeValuesUndoMutationFactory as Jo, BEFORE_CELL_EDIT as es, SetWorksheetRowAutoHeightMutation as ts, INTERCEPTOR_POINT as ns, WorksheetSetCellValuePermission as qe, WorksheetEditPermission as Ke, RangeProtectionPermissionEditPoint as Ye, WorkbookEditablePermission as Ge, IRefSelectionsService as Kt, SelectionMoveType as
|
|
4
|
+
import { CommandType as Te, ICommandService as fe, createIdentifier as Hr, IContextService as an, IUniverInstanceService as te, Rectangle as Xn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ln, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Qn, DEFAULT_EMPTY_DOCUMENT_VALUE as Jn, isRealNum as Br, CellValueType as xn, getCellValueType as jr, Inject as j, Disposable as at, ObjectMatrix as De, Range as qr, Tools as st, isFormulaString as ye, isFormulaId as We, FOCUSING_DOC as Kr, FOCUSING_UNIVER_EDITOR as Yr, LocaleService as lt, isICellData as Gr, Direction as le, Injector as Rt, UniverInstanceType as q, ThemeService as It, ILogService as Zr, toDisposable as er, ColorKit as un, RxDisposable as zr, InterceptorEffectEnum as Xr, DisposableCollection as He, RANGE_TYPE as _e, getBodySlice as On, EDITOR_ACTIVATED as wt, createInternalEditorID as Qr, generateRandomId as Jr, BuildTextUtils as eo, RichTextBuilder as to, DependentOn as no, IConfigService as ro, Plugin as oo, merge as so, registerDependencies as io, touchDependencies as co } from "@univerjs/core";
|
|
5
|
+
import { SheetPasteCommand as ao, PREDEFINED_HOOK_NAME as rt, IEditorBridgeService as dn, SetCellEditVisibleOperation as tr, HoverManagerService as lo, CellAlertManagerService as uo, CellAlertType as ho, IAutoFillService as fo, APPLY_TYPE as go, DATA_TYPE as Nn, ISheetClipboardService as mo, COPY_TYPE as nr, SheetSkeletonManagerService as qt, attachSelectionWithCoord as nn, SelectionControl as rr, SELECTION_SHAPE_DEPTH as po, useActiveWorkbook as vo, getCurrentRangeDisable$ as Be, PASTE_SPECIAL_MENU_ID as So, whenFormulaEditorActivated as Et, whenSheetEditorFocused as Co, SheetsUIPart as _o, BaseSelectionRenderService as Ro, getCoordByOffset as Mn, checkInHeaderRanges as wn, getAllSelection as Io, genNormalSelectionStyle as or, getSheetObject as Eo, MoveSelectionCommand as kn, JumpOver as An, ExpandSelectionCommand as Fn, EMBEDDING_FORMULA_EDITOR as bo, IMarkSelectionService as yo, RANGE_SELECTOR_COMPONENT_KEY as To, EMBEDDING_FORMULA_EDITOR_COMPONENT_KEY as xo } from "@univerjs/sheets-ui";
|
|
6
|
+
import { sequenceNodeType as X, serializeRange as Re, FormulaDataModel as bt, LexerTreeBuilder as Ie, ERROR_TYPE_SET as Oo, ErrorType as ae, SetFormulaCalculationResultMutation as No, SetArrayFormulaDataMutation as Mo, SetFormulaCalculationStopMutation as wo, FunctionType as ko, deserializeRangeWithSheetWithCache as Ao, matchRefDrawToken as Fo, isFormulaLexerToken as Do, matchToken as it, deserializeRangeWithSheet as ut, serializeRangeToRefString as Lo, serializeRangeWithSheet as Ct, generateStringWithSequence as $o, operatorToken as sr, UniverFormulaEnginePlugin as Po } from "@univerjs/engine-formula";
|
|
7
|
+
import { Subject as mt, debounceTime as hn, combineLatestWith as Uo, map as ir, switchMap as Vo, of as Dn, Observable as Wo, BehaviorSubject as cr, throttleTime as Ho, filter as ar, distinctUntilChanged as Bo, merge as jo } from "rxjs";
|
|
8
|
+
import { IEditorService as je, DocSelectionRenderService as lr, ReplaceTextRunsCommand as Ln, MoveSelectionOperation as qo, MoveCursorOperation as Ko, useKeyboardEvent as Yo, useResize as Go, DocBackScrollRenderController as Zo, RichTextEditor as zo } from "@univerjs/docs-ui";
|
|
9
|
+
import { DeviceInputEventType as xe, IRenderManagerService as Oe, ScrollTimerType as Qt, SHEET_VIEWPORT_KEY as $n, Vector2 as Pn } from "@univerjs/engine-render";
|
|
10
|
+
import { SheetsSelectionsService as fn, getSheetCommandTarget as ur, getCellAtRowCol as Xo, SetSelectionsOperation as gn, SheetInterceptorService as mn, ReorderRangeCommand as Qo, SetRangeValuesMutation as Dt, SetRangeValuesUndoMutationFactory as Jo, BEFORE_CELL_EDIT as es, SetWorksheetRowAutoHeightMutation as ts, INTERCEPTOR_POINT as ns, WorksheetSetCellValuePermission as qe, WorksheetEditPermission as Ke, RangeProtectionPermissionEditPoint as Ye, WorkbookEditablePermission as Ge, IRefSelectionsService as Kt, SelectionMoveType as Jt, convertSelectionDataToRange as rs, setEndForRange as os, REF_SELECTIONS_ENABLED as Un, SetWorksheetActiveOperation as Vn } from "@univerjs/sheets";
|
|
11
11
|
import { InsertFunctionCommand as ss, TriggerCalculationController as is, IDescriptionService as Yt, QuickSumCommand as cs, UniverSheetsFormulaPlugin as as } from "@univerjs/sheets-formula";
|
|
12
|
-
import { ISidebarService as pn, IZenZoneService as ls, useDependency as
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { useCallback as Lt, useState as V, forwardRef as Ne, useRef as z, createElement as ze, useEffect as $, useMemo as
|
|
15
|
-
import { clsx as
|
|
12
|
+
import { ISidebarService as pn, IZenZoneService as ls, useDependency as y, useObservable as ve, ProgressBar as us, MenuItemType as Ze, getMenuHiddenObservable as dt, IClipboardInterfaceService as Wn, RibbonFormulasGroup as Hn, KeyCode as L, MetaKeys as P, IMenuManagerService as ds, IShortcutService as Gt, IUIPartsService as dr, ComponentManager as hr, connectInjector as fr, useEvent as J, RectPopup as rn, IContextMenuService as hs, useUpdateEffect as fs, BuiltInUIPart as gs } from "@univerjs/ui";
|
|
13
|
+
import { jsx as x, jsxs as W, Fragment as ms } from "react/jsx-runtime";
|
|
14
|
+
import { useCallback as Lt, useState as V, forwardRef as Ne, useRef as z, createElement as ze, useEffect as $, useMemo as ie, useLayoutEffect as $t, useImperativeHandle as ps } from "react";
|
|
15
|
+
import { clsx as ne, scrollbarClassName as ct, borderLeftClassName as vs, Select as Ss, Input as gr, borderClassName as vn, Button as ot, borderTopClassName as Cs, Tooltip as _s, Dialog as Rs } from "@univerjs/design";
|
|
16
16
|
import { DocSelectionManagerService as mr } from "@univerjs/docs";
|
|
17
17
|
import { debounceTime as Is } from "rxjs/operators";
|
|
18
18
|
const Sn = {
|
|
19
19
|
id: "sheet.command.paste-formula",
|
|
20
20
|
type: Te.COMMAND,
|
|
21
21
|
handler: async (e) => e.get(fe).executeCommand(ao.id, {
|
|
22
|
-
value:
|
|
22
|
+
value: rt.SPECIAL_PASTE_FORMULA
|
|
23
23
|
})
|
|
24
|
-
},
|
|
24
|
+
}, ht = {
|
|
25
25
|
id: "formula-ui.operation.select-editor-formula",
|
|
26
26
|
type: Te.OPERATION,
|
|
27
27
|
handler: (e, t) => !0
|
|
@@ -31,7 +31,7 @@ var Es = Object.getOwnPropertyDescriptor, bs = (e, t, n, o) => {
|
|
|
31
31
|
(c = e[s]) && (r = c(r) || r);
|
|
32
32
|
return r;
|
|
33
33
|
}, ys = (e, t) => (n, o) => t(n, o, e);
|
|
34
|
-
const Ts = "FORMULA_PROMPT_ACTIVATED",
|
|
34
|
+
const Ts = "FORMULA_PROMPT_ACTIVATED", Zt = Hr("formula-ui.prompt-service");
|
|
35
35
|
let on = class {
|
|
36
36
|
constructor(e) {
|
|
37
37
|
K(this, "_search$", new mt());
|
|
@@ -193,7 +193,7 @@ on = bs([
|
|
|
193
193
|
const xs = {
|
|
194
194
|
id: "formula-ui.operation.help-function",
|
|
195
195
|
type: Te.OPERATION,
|
|
196
|
-
handler: async (e, t) => (e.get(
|
|
196
|
+
handler: async (e, t) => (e.get(Zt).help(t), !0)
|
|
197
197
|
}, pe = {
|
|
198
198
|
id: "formula-ui.operation.insert-function",
|
|
199
199
|
type: Te.OPERATION,
|
|
@@ -208,40 +208,40 @@ const xs = {
|
|
|
208
208
|
const { worksheet: c, unitId: i, subUnitId: l } = s, f = c.getCellMatrix(), { value: h } = t, g = e.get(fe);
|
|
209
209
|
e.get(dn);
|
|
210
210
|
const u = [], d = [];
|
|
211
|
-
let a = null,
|
|
212
|
-
if (r.length === 1 && (Ms(r[0].range) || ws(r[0].range) &&
|
|
213
|
-
const { range: R, primary:
|
|
214
|
-
a = R,
|
|
215
|
-
const A =
|
|
211
|
+
let a = null, S = 0, m = 0, p = "";
|
|
212
|
+
if (r.length === 1 && (Ms(r[0].range) || ws(r[0].range) && jn(f, r[0].range))) {
|
|
213
|
+
const { range: R, primary: v } = r[0], O = (C = v == null ? void 0 : v.actualRow) != null ? C : R.startRow, N = (_ = v == null ? void 0 : v.actualColumn) != null ? _ : R.startColumn;
|
|
214
|
+
a = R, S = O, m = N;
|
|
215
|
+
const A = Bn(f, O, N);
|
|
216
216
|
A && (p = Re(A));
|
|
217
217
|
} else
|
|
218
218
|
r.some((R) => {
|
|
219
219
|
var N, A;
|
|
220
|
-
const { range:
|
|
221
|
-
if (
|
|
222
|
-
const F = (N =
|
|
220
|
+
const { range: v, primary: O } = R;
|
|
221
|
+
if (jn(f, v)) {
|
|
222
|
+
const F = (N = O == null ? void 0 : O.actualRow) != null ? N : v.startRow, T = (A = O == null ? void 0 : O.actualColumn) != null ? A : v.startColumn, k = Bn(f, F, T);
|
|
223
223
|
if (!k)
|
|
224
|
-
return a =
|
|
224
|
+
return a = v, S = F, m = T, !0;
|
|
225
225
|
const w = Re(k), b = `=${h}(${w})`;
|
|
226
226
|
u.push({
|
|
227
|
-
range:
|
|
227
|
+
range: v,
|
|
228
228
|
primary: {
|
|
229
229
|
row: F,
|
|
230
|
-
column:
|
|
230
|
+
column: T
|
|
231
231
|
},
|
|
232
232
|
formula: b
|
|
233
233
|
});
|
|
234
234
|
} else {
|
|
235
|
-
const { startRow: F, startColumn:
|
|
235
|
+
const { startRow: F, startColumn: T, endRow: k, endColumn: w } = v;
|
|
236
236
|
if (F === k) {
|
|
237
237
|
const b = ks(f, F, w, c.getColumnCount() - 1), I = b === w ? w - 1 : w, E = Re({
|
|
238
238
|
startRow: F,
|
|
239
239
|
endRow: k,
|
|
240
|
-
startColumn:
|
|
240
|
+
startColumn: T,
|
|
241
241
|
endColumn: I
|
|
242
242
|
}), M = `=${h}(${E})`;
|
|
243
243
|
d.push({
|
|
244
|
-
range:
|
|
244
|
+
range: v,
|
|
245
245
|
primary: {
|
|
246
246
|
row: F,
|
|
247
247
|
column: b
|
|
@@ -250,12 +250,12 @@ const xs = {
|
|
|
250
250
|
});
|
|
251
251
|
} else {
|
|
252
252
|
let b = -1;
|
|
253
|
-
for (let E =
|
|
253
|
+
for (let E = T; E <= w; E++) {
|
|
254
254
|
const M = As(f, E, k, c.getRowCount() - 1);
|
|
255
255
|
b = Math.max(b, M);
|
|
256
256
|
}
|
|
257
257
|
const I = b === k ? k - 1 : k;
|
|
258
|
-
for (let E =
|
|
258
|
+
for (let E = T; E <= w; E++) {
|
|
259
259
|
const M = Re({
|
|
260
260
|
startRow: F,
|
|
261
261
|
endRow: I,
|
|
@@ -263,7 +263,7 @@ const xs = {
|
|
|
263
263
|
endColumn: E
|
|
264
264
|
}), D = `=${h}(${M})`;
|
|
265
265
|
d.push({
|
|
266
|
-
range:
|
|
266
|
+
range: v,
|
|
267
267
|
primary: {
|
|
268
268
|
row: b,
|
|
269
269
|
column: E
|
|
@@ -276,26 +276,26 @@ const xs = {
|
|
|
276
276
|
return !1;
|
|
277
277
|
});
|
|
278
278
|
if (a) {
|
|
279
|
-
const R = Xo(
|
|
280
|
-
range:
|
|
279
|
+
const R = Xo(S, m, c), v = {
|
|
280
|
+
range: Xn.clone(a),
|
|
281
281
|
primary: {
|
|
282
282
|
startRow: R.startRow,
|
|
283
283
|
startColumn: R.startColumn,
|
|
284
284
|
endRow: R.endRow,
|
|
285
285
|
endColumn: R.endColumn,
|
|
286
|
-
actualRow:
|
|
286
|
+
actualRow: S,
|
|
287
287
|
actualColumn: m,
|
|
288
288
|
isMerged: R.isMerged,
|
|
289
|
-
isMergedMainCell: R.startRow ===
|
|
289
|
+
isMergedMainCell: R.startRow === S && R.startColumn === m
|
|
290
290
|
}
|
|
291
|
-
},
|
|
291
|
+
}, O = {
|
|
292
292
|
unitId: i,
|
|
293
293
|
subUnitId: l,
|
|
294
|
-
selections: [
|
|
294
|
+
selections: [v]
|
|
295
295
|
};
|
|
296
|
-
await g.executeCommand(gn.id,
|
|
297
|
-
const N = o.getEditor(ln), A = o.getEditor(
|
|
298
|
-
g.syncExecuteCommand(
|
|
296
|
+
await g.executeCommand(gn.id, O);
|
|
297
|
+
const N = o.getEditor(ln), A = o.getEditor(Qn);
|
|
298
|
+
g.syncExecuteCommand(tr.id, {
|
|
299
299
|
visible: !0,
|
|
300
300
|
unitId: i,
|
|
301
301
|
eventType: xe.Dblclick
|
|
@@ -309,7 +309,7 @@ const xs = {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
};
|
|
312
|
-
function
|
|
312
|
+
function Bn(e, t, n) {
|
|
313
313
|
const o = Os(e, t, n);
|
|
314
314
|
if (o !== t)
|
|
315
315
|
return {
|
|
@@ -365,10 +365,10 @@ function _t(e) {
|
|
|
365
365
|
const t = e == null ? void 0 : e.p.body;
|
|
366
366
|
if (t == null)
|
|
367
367
|
return !1;
|
|
368
|
-
const n = t.dataStream, r = n.substring(n.length - 2, n.length) ===
|
|
368
|
+
const n = t.dataStream, r = n.substring(n.length - 2, n.length) === Jn ? n.substring(0, n.length - 2) : n;
|
|
369
369
|
return Br(r);
|
|
370
370
|
}
|
|
371
|
-
return e && (e.t ===
|
|
371
|
+
return e && (e.t === xn.NUMBER || jr(e) === xn.NUMBER);
|
|
372
372
|
}
|
|
373
373
|
function Ms(e) {
|
|
374
374
|
return e.startRow === e.endRow && e.startColumn === e.endColumn;
|
|
@@ -376,7 +376,7 @@ function Ms(e) {
|
|
|
376
376
|
function ws(e) {
|
|
377
377
|
return e.startRow !== e.endRow && e.startColumn !== e.endColumn;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function jn(e, t) {
|
|
380
380
|
for (let n = t.startRow; n <= t.endRow; n++)
|
|
381
381
|
for (let o = t.startColumn; o <= t.endColumn; o++)
|
|
382
382
|
if (_t(e.getValue(n, o)))
|
|
@@ -395,7 +395,7 @@ function As(e, t, n, o) {
|
|
|
395
395
|
return r;
|
|
396
396
|
return o;
|
|
397
397
|
}
|
|
398
|
-
const pr = "SHEET_FORMULA_UI_PLUGIN", vr = `${pr}_MORE_FUNCTIONS_COMPONENT`,
|
|
398
|
+
const pr = "SHEET_FORMULA_UI_PLUGIN", vr = `${pr}_MORE_FUNCTIONS_COMPONENT`, Cn = {
|
|
399
399
|
id: "formula-ui.operation.more-functions",
|
|
400
400
|
type: Te.OPERATION,
|
|
401
401
|
handler: async (e) => (e.get(pn).open({
|
|
@@ -409,14 +409,14 @@ const pr = "SHEET_FORMULA_UI_PLUGIN", vr = `${pr}_MORE_FUNCTIONS_COMPONENT`, _n
|
|
|
409
409
|
}, Fs = {
|
|
410
410
|
id: "formula-ui.operation.search-function",
|
|
411
411
|
type: Te.OPERATION,
|
|
412
|
-
handler: async (e, t) => (e.get(
|
|
412
|
+
handler: async (e, t) => (e.get(Zt).search(t), !0)
|
|
413
413
|
};
|
|
414
414
|
var Ds = Object.getOwnPropertyDescriptor, Ls = (e, t, n, o) => {
|
|
415
415
|
for (var r = o > 1 ? void 0 : o ? Ds(t, n) : t, s = e.length - 1, c; s >= 0; s--)
|
|
416
416
|
(c = e[s]) && (r = c(r) || r);
|
|
417
417
|
return r;
|
|
418
418
|
}, kt = (e, t) => (n, o) => t(n, o, e);
|
|
419
|
-
let Pt = class extends
|
|
419
|
+
let Pt = class extends at {
|
|
420
420
|
constructor(e, t, n, o) {
|
|
421
421
|
super(), this._sheetInterceptorService = e, this._univerInstanceService = t, this._formulaDataModel = n, this._lexerTreeBuilder = o, this._initialize();
|
|
422
422
|
}
|
|
@@ -438,16 +438,16 @@ let Pt = class extends ct {
|
|
|
438
438
|
const f = l.getCellMatrix(), h = new De(), g = new De();
|
|
439
439
|
let u = !1;
|
|
440
440
|
return qr.foreach(s, (d, a) => {
|
|
441
|
-
let
|
|
442
|
-
c.hasOwnProperty(d) && (
|
|
443
|
-
const m = f.getValue(
|
|
441
|
+
let S = d;
|
|
442
|
+
c.hasOwnProperty(d) && (S = c[d]);
|
|
443
|
+
const m = f.getValue(S, a);
|
|
444
444
|
if (m != null && m.f || m != null && m.si) {
|
|
445
445
|
u = !0;
|
|
446
|
-
const p = this._formulaDataModel.getFormulaStringByCell(
|
|
446
|
+
const p = this._formulaDataModel.getFormulaStringByCell(S, a, r, o), C = this._lexerTreeBuilder.moveFormulaRefOffset(
|
|
447
447
|
p,
|
|
448
448
|
0,
|
|
449
|
-
d -
|
|
450
|
-
), _ =
|
|
449
|
+
d - S
|
|
450
|
+
), _ = st.deepClone(m);
|
|
451
451
|
_.f = C, _.si = null, h.setValue(d, a, _);
|
|
452
452
|
} else
|
|
453
453
|
h.setValue(d, a, m);
|
|
@@ -481,7 +481,7 @@ Pt = Ls([
|
|
|
481
481
|
kt(2, j(bt)),
|
|
482
482
|
kt(3, j(Ie))
|
|
483
483
|
], Pt);
|
|
484
|
-
const $s = "sheets-formula-ui.base.config",
|
|
484
|
+
const $s = "sheets-formula-ui.base.config", qn = {};
|
|
485
485
|
function Ps(e) {
|
|
486
486
|
return e.getContextValue(Kr) && e.getContextValue(Yr);
|
|
487
487
|
}
|
|
@@ -493,7 +493,7 @@ var Us = Object.getOwnPropertyDescriptor, Vs = (e, t, n, o) => {
|
|
|
493
493
|
(c = e[s]) && (r = c(r) || r);
|
|
494
494
|
return r;
|
|
495
495
|
}, pt = (e, t) => (n, o) => t(n, o, e);
|
|
496
|
-
const
|
|
496
|
+
const en = "SHEET_FORMULA_ALERT", Ws = {
|
|
497
497
|
[ae.DIV_BY_ZERO]: "divByZero",
|
|
498
498
|
[ae.NAME]: "name",
|
|
499
499
|
[ae.VALUE]: "value",
|
|
@@ -507,7 +507,7 @@ const Jt = "SHEET_FORMULA_ALERT", Ws = {
|
|
|
507
507
|
[ae.CONNECT]: "connect",
|
|
508
508
|
[ae.NULL]: "null"
|
|
509
509
|
};
|
|
510
|
-
let sn = class extends
|
|
510
|
+
let sn = class extends at {
|
|
511
511
|
constructor(e, t, n, o, r, s) {
|
|
512
512
|
super(), this._context = e, this._hoverManagerService = t, this._cellAlertManagerService = n, this._localeService = o, this._formulaDataModel = r, this._zenZoneService = s, this._init();
|
|
513
513
|
}
|
|
@@ -527,7 +527,7 @@ let sn = class extends ct {
|
|
|
527
527
|
this._hideAlert();
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
const g = this._cellAlertManagerService.currentAlert.get(
|
|
530
|
+
const g = this._cellAlertManagerService.currentAlert.get(en), u = (s = g == null ? void 0 : g.alert) == null ? void 0 : s.location;
|
|
531
531
|
if (u && u.row === e.location.row && u.col === e.location.col && u.subUnitId === e.location.subUnitId && u.unitId === e.location.unitId)
|
|
532
532
|
return;
|
|
533
533
|
this._cellAlertManagerService.showAlert({
|
|
@@ -537,7 +537,7 @@ let sn = class extends ct {
|
|
|
537
537
|
location: e.location,
|
|
538
538
|
width: 200,
|
|
539
539
|
height: 74,
|
|
540
|
-
key:
|
|
540
|
+
key: en
|
|
541
541
|
});
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
@@ -551,13 +551,13 @@ let sn = class extends ct {
|
|
|
551
551
|
}));
|
|
552
552
|
}
|
|
553
553
|
_hideAlert() {
|
|
554
|
-
this._cellAlertManagerService.removeAlert(
|
|
554
|
+
this._cellAlertManagerService.removeAlert(en);
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
557
|
sn = Vs([
|
|
558
558
|
pt(1, j(lo)),
|
|
559
559
|
pt(2, j(uo)),
|
|
560
|
-
pt(3, j(
|
|
560
|
+
pt(3, j(lt)),
|
|
561
561
|
pt(4, j(bt)),
|
|
562
562
|
pt(5, ls)
|
|
563
563
|
], sn);
|
|
@@ -565,17 +565,17 @@ var Hs = Object.getOwnPropertyDescriptor, Bs = (e, t, n, o) => {
|
|
|
565
565
|
for (var r = o > 1 ? void 0 : o ? Hs(t, n) : t, s = e.length - 1, c; s >= 0; s--)
|
|
566
566
|
(c = e[s]) && (r = c(r) || r);
|
|
567
567
|
return r;
|
|
568
|
-
},
|
|
569
|
-
let Ut = class extends
|
|
568
|
+
}, Kn = (e, t) => (n, o) => t(n, o, e);
|
|
569
|
+
let Ut = class extends at {
|
|
570
570
|
constructor(e, t) {
|
|
571
571
|
super(), this._autoFillService = e, this._lexerTreeBuilder = t, this._registerAutoFill();
|
|
572
572
|
}
|
|
573
573
|
_registerAutoFill() {
|
|
574
574
|
const e = {
|
|
575
|
-
type:
|
|
575
|
+
type: Nn.FORMULA,
|
|
576
576
|
priority: 1001,
|
|
577
577
|
match: (t) => ye(t == null ? void 0 : t.f) || We(t == null ? void 0 : t.si),
|
|
578
|
-
isContinue: (t, n) => t.type ===
|
|
578
|
+
isContinue: (t, n) => t.type === Nn.FORMULA,
|
|
579
579
|
applyFunctions: {
|
|
580
580
|
[go.COPY]: (t, n, o, r, s) => {
|
|
581
581
|
const { data: c, index: i } = t;
|
|
@@ -589,9 +589,9 @@ let Ut = class extends ct {
|
|
|
589
589
|
var f, h;
|
|
590
590
|
const c = qs(r), i = [], l = /* @__PURE__ */ new Map();
|
|
591
591
|
for (let g = 1; g <= t; g++) {
|
|
592
|
-
const u = (g - 1) % e.length, d = o[u], a =
|
|
592
|
+
const u = (g - 1) % e.length, d = o[u], a = st.deepClone(e[u]);
|
|
593
593
|
if (a) {
|
|
594
|
-
const
|
|
594
|
+
const S = ((f = e[u]) == null ? void 0 : f.f) || "", m = ((h = e[u]) == null ? void 0 : h.si) || "", p = ye(S);
|
|
595
595
|
if (We(m))
|
|
596
596
|
a.si = m, a.f = null, a.v = null, a.p = null, a.t = null, i.push(a);
|
|
597
597
|
else if (p) {
|
|
@@ -599,13 +599,13 @@ let Ut = class extends ct {
|
|
|
599
599
|
if (_)
|
|
600
600
|
a.si = _, a.f = null, a.v = null, a.p = null, a.t = null;
|
|
601
601
|
else {
|
|
602
|
-
_ =
|
|
603
|
-
const { offsetX: R, offsetY:
|
|
604
|
-
|
|
602
|
+
_ = st.generateRandomId(6), l.set(u, _);
|
|
603
|
+
const { offsetX: R, offsetY: v } = js(c, t, n, s, d), O = this._lexerTreeBuilder.moveFormulaRefOffset(
|
|
604
|
+
S,
|
|
605
605
|
R,
|
|
606
|
-
|
|
606
|
+
v
|
|
607
607
|
);
|
|
608
|
-
a.si = _, a.f =
|
|
608
|
+
a.si = _, a.f = O, a.v = null, a.p = null, a.t = null;
|
|
609
609
|
}
|
|
610
610
|
i.push(a);
|
|
611
611
|
}
|
|
@@ -615,8 +615,8 @@ let Ut = class extends ct {
|
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
617
|
Ut = Bs([
|
|
618
|
-
|
|
619
|
-
|
|
618
|
+
Kn(0, fo),
|
|
619
|
+
Kn(1, j(Ie))
|
|
620
620
|
], Ut);
|
|
621
621
|
function js(e, t, n, o, r) {
|
|
622
622
|
const { source: s, target: c } = o, { rows: i } = c, { rows: l } = s;
|
|
@@ -651,7 +651,7 @@ var Ks = Object.getOwnPropertyDescriptor, Ys = (e, t, n, o) => {
|
|
|
651
651
|
return r;
|
|
652
652
|
}, vt = (e, t) => (n, o) => t(n, o, e);
|
|
653
653
|
const Gs = "default-paste-formula";
|
|
654
|
-
let Vt = class extends
|
|
654
|
+
let Vt = class extends at {
|
|
655
655
|
constructor(e, t, n, o, r) {
|
|
656
656
|
super(), this._currentUniverSheet = e, this._lexerTreeBuilder = t, this._sheetClipboardService = n, this._injector = o, this._formulaDataModel = r, this._initialize();
|
|
657
657
|
}
|
|
@@ -663,7 +663,7 @@ let Vt = class extends ct {
|
|
|
663
663
|
}
|
|
664
664
|
_pasteFormulaHook() {
|
|
665
665
|
return {
|
|
666
|
-
id:
|
|
666
|
+
id: rt.SPECIAL_PASTE_FORMULA,
|
|
667
667
|
priority: 10,
|
|
668
668
|
specialPasteInfo: { label: "specialPaste.formula" },
|
|
669
669
|
onPasteCells: (e, t, n, o) => this._onPasteCells(e, t, n, o, !0)
|
|
@@ -679,8 +679,8 @@ let Vt = class extends ct {
|
|
|
679
679
|
_onPasteCells(e, t, n, o, r) {
|
|
680
680
|
var u;
|
|
681
681
|
if ([
|
|
682
|
-
|
|
683
|
-
|
|
682
|
+
rt.SPECIAL_PASTE_FORMAT,
|
|
683
|
+
rt.SPECIAL_PASTE_COL_WIDTH
|
|
684
684
|
].includes(o.pasteType))
|
|
685
685
|
return {
|
|
686
686
|
undos: [],
|
|
@@ -693,7 +693,7 @@ let Vt = class extends ct {
|
|
|
693
693
|
redos: []
|
|
694
694
|
};
|
|
695
695
|
const f = t.range, h = n, g = {
|
|
696
|
-
copyType: o.copyType ||
|
|
696
|
+
copyType: o.copyType || nr.COPY,
|
|
697
697
|
copyRange: e == null ? void 0 : e.range,
|
|
698
698
|
pasteType: o.pasteType
|
|
699
699
|
};
|
|
@@ -747,7 +747,7 @@ function Zs(e, t, n, o, r, s, c, i, l = !1, f) {
|
|
|
747
747
|
};
|
|
748
748
|
}
|
|
749
749
|
function zs(e, t, n, o, r, s, c, i) {
|
|
750
|
-
return i ? r.pasteType ===
|
|
750
|
+
return i ? r.pasteType === rt.SPECIAL_PASTE_VALUE ? Qs(e, t, n, o, c, i) : r.pasteType === rt.SPECIAL_PASTE_FORMULA ? Js(e, t, n, o, s, c, i) : ei(e, t, n, o, r.copyType, s, c, i) : Xs(e, t, n, o, c);
|
|
751
751
|
}
|
|
752
752
|
function Xs(e, t, n, o, r) {
|
|
753
753
|
const s = new De(), c = r.getSheetFormulaData(e, t);
|
|
@@ -762,16 +762,16 @@ function Qs(e, t, n, o, r, s) {
|
|
|
762
762
|
const c = new De(), i = (h = (f = r.getArrayFormulaCellData()) == null ? void 0 : f[s.unitId]) == null ? void 0 : h[s.subUnitId], l = r.getSheetFormulaData(e, t);
|
|
763
763
|
return o.forValue((g, u, d) => {
|
|
764
764
|
var _, R;
|
|
765
|
-
const a = s.range.rows[g % s.range.rows.length],
|
|
765
|
+
const a = s.range.rows[g % s.range.rows.length], S = s.range.cols[u % s.range.cols.length], m = n.rows[g], p = n.cols[u], C = {};
|
|
766
766
|
if (ye(d.f) || We(d.si))
|
|
767
767
|
C.v = d.v, C.f = null, C.si = null, C.p = null, c.setValue(m, p, C);
|
|
768
|
-
else if ((_ = i == null ? void 0 : i[a]) != null && _[
|
|
769
|
-
const
|
|
770
|
-
C.v =
|
|
768
|
+
else if ((_ = i == null ? void 0 : i[a]) != null && _[S]) {
|
|
769
|
+
const v = i[a][S];
|
|
770
|
+
C.v = v.v, C.f = null, C.si = null, C.p = null, c.setValue(m, p, C);
|
|
771
771
|
} else if ((R = l == null ? void 0 : l[m]) != null && R[p]) {
|
|
772
772
|
if (C.v = d.v, C.f = null, C.si = null, C.p = null, d.p) {
|
|
773
|
-
const
|
|
774
|
-
|
|
773
|
+
const v = _r(d);
|
|
774
|
+
v && (C.v = v);
|
|
775
775
|
}
|
|
776
776
|
c.setValue(m, p, C);
|
|
777
777
|
}
|
|
@@ -783,31 +783,31 @@ function Js(e, t, n, o, r, s, c) {
|
|
|
783
783
|
const u = n.rows[f], d = n.cols[h], a = {};
|
|
784
784
|
if (We(g.si)) {
|
|
785
785
|
if (c.unitId !== e || c.subUnitId !== t) {
|
|
786
|
-
const
|
|
786
|
+
const S = s.getFormulaStringByCell(
|
|
787
787
|
c.range.rows[f % c.range.rows.length],
|
|
788
788
|
c.range.cols[h % c.range.cols.length],
|
|
789
789
|
c.subUnitId,
|
|
790
790
|
c.unitId
|
|
791
|
-
), m = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[f] - c.range.rows[f % c.range.rows.length], C = r.moveFormulaRefOffset(
|
|
791
|
+
), m = n.cols[h] - c.range.cols[h % c.range.cols.length], p = n.rows[f] - c.range.rows[f % c.range.rows.length], C = r.moveFormulaRefOffset(S || "", m, p);
|
|
792
792
|
a.si = null, a.f = C;
|
|
793
793
|
} else
|
|
794
794
|
a.si = g.si, a.f = null;
|
|
795
795
|
a.v = null, a.p = null, i.setValue(u, d, a);
|
|
796
796
|
} else if (ye(g.f)) {
|
|
797
|
-
const
|
|
798
|
-
let m = l.get(
|
|
797
|
+
const S = `${f % c.range.rows.length}_${h % c.range.cols.length}`;
|
|
798
|
+
let m = l.get(S);
|
|
799
799
|
if (m)
|
|
800
800
|
a.si = m, a.f = null;
|
|
801
801
|
else {
|
|
802
|
-
m =
|
|
802
|
+
m = st.generateRandomId(6), l.set(S, m);
|
|
803
803
|
const p = n.cols[h] - c.range.cols[h % c.range.cols.length], C = n.rows[f] - c.range.rows[f % c.range.rows.length], _ = r.moveFormulaRefOffset(g.f || "", p, C);
|
|
804
804
|
a.si = m, a.f = _;
|
|
805
805
|
}
|
|
806
806
|
a.v = null, a.p = null, i.setValue(u, d, a);
|
|
807
807
|
} else {
|
|
808
808
|
if (a.v = g.v, a.f = null, a.si = null, a.p = null, g.p) {
|
|
809
|
-
const
|
|
810
|
-
|
|
809
|
+
const S = _r(g);
|
|
810
|
+
S && (a.v = S);
|
|
811
811
|
}
|
|
812
812
|
i.setValue(u, d, a);
|
|
813
813
|
}
|
|
@@ -815,8 +815,8 @@ function Js(e, t, n, o, r, s, c) {
|
|
|
815
815
|
}
|
|
816
816
|
function ei(e, t, n, o, r, s, c, i) {
|
|
817
817
|
const l = new De(), f = /* @__PURE__ */ new Map(), h = c.getSheetFormulaData(e, t), g = [];
|
|
818
|
-
return r ===
|
|
819
|
-
const
|
|
818
|
+
return r === nr.CUT ? o.forValue((u, d, a) => {
|
|
819
|
+
const S = n.rows[u], m = n.cols[d], p = {};
|
|
820
820
|
if (We(a.si)) {
|
|
821
821
|
if (ye(a.f))
|
|
822
822
|
g.push(a.si), p.f = a.f, p.si = a.si;
|
|
@@ -831,11 +831,11 @@ function ei(e, t, n, o, r, s, c, i) {
|
|
|
831
831
|
);
|
|
832
832
|
p.f = C, p.si = null;
|
|
833
833
|
}
|
|
834
|
-
p.v = null, p.p = null, l.setValue(
|
|
835
|
-
} else ye(a.f) && (p.f = a.f, p.si = null, p.v = null, p.p = null, l.setValue(
|
|
834
|
+
p.v = null, p.p = null, l.setValue(S, m, p);
|
|
835
|
+
} else ye(a.f) && (p.f = a.f, p.si = null, p.v = null, p.p = null, l.setValue(S, m, p));
|
|
836
836
|
}) : o.forValue((u, d, a) => {
|
|
837
837
|
var C;
|
|
838
|
-
const
|
|
838
|
+
const S = n.rows[u], m = n.cols[d], p = {};
|
|
839
839
|
if (We(a.si)) {
|
|
840
840
|
if (i.unitId !== e || i.subUnitId !== t) {
|
|
841
841
|
const _ = c.getFormulaStringByCell(
|
|
@@ -843,33 +843,33 @@ function ei(e, t, n, o, r, s, c, i) {
|
|
|
843
843
|
i.range.cols[d % i.range.cols.length],
|
|
844
844
|
i.subUnitId,
|
|
845
845
|
i.unitId
|
|
846
|
-
), R = n.cols[d] - i.range.cols[d % i.range.cols.length],
|
|
847
|
-
p.si = null, p.f =
|
|
846
|
+
), R = n.cols[d] - i.range.cols[d % i.range.cols.length], v = n.rows[u] - i.range.rows[u % i.range.rows.length], O = s.moveFormulaRefOffset(_ || "", R, v);
|
|
847
|
+
p.si = null, p.f = O;
|
|
848
848
|
} else
|
|
849
849
|
p.si = a.si, p.f = null;
|
|
850
|
-
p.v = null, p.p = null, l.setValue(
|
|
850
|
+
p.v = null, p.p = null, l.setValue(S, m, p);
|
|
851
851
|
} else if (ye(a.f)) {
|
|
852
852
|
const _ = `${u % i.range.rows.length}_${d % i.range.cols.length}`;
|
|
853
853
|
let R = f.get(_);
|
|
854
854
|
if (R)
|
|
855
855
|
p.si = R, p.f = null;
|
|
856
856
|
else {
|
|
857
|
-
R =
|
|
858
|
-
const
|
|
857
|
+
R = st.generateRandomId(6), f.set(_, R);
|
|
858
|
+
const v = n.cols[d] - i.range.cols[d % i.range.cols.length], O = n.rows[u] - i.range.rows[u % i.range.rows.length], N = s.moveFormulaRefOffset(a.f || "", v, O);
|
|
859
859
|
p.si = R, p.f = N;
|
|
860
860
|
}
|
|
861
|
-
p.v = null, p.p = null, l.setValue(
|
|
862
|
-
} else (C = h == null ? void 0 : h[
|
|
861
|
+
p.v = null, p.p = null, l.setValue(S, m, p);
|
|
862
|
+
} else (C = h == null ? void 0 : h[S]) != null && C[m] && (p.v = a.v, p.f = null, p.si = null, p.p = a.p, l.setValue(S, m, p));
|
|
863
863
|
}), g.length > 0 && new De(h).forValue((u, d, a) => {
|
|
864
864
|
if (!(i.range.rows.includes(u) && i.range.cols.includes(d)) && !(n.rows.includes(u) && n.cols.includes(d)) && g.includes(a == null ? void 0 : a.si)) {
|
|
865
|
-
const
|
|
865
|
+
const S = c.getFormulaStringByCell(
|
|
866
866
|
u,
|
|
867
867
|
d,
|
|
868
868
|
i.subUnitId,
|
|
869
869
|
i.unitId
|
|
870
870
|
);
|
|
871
871
|
l.setValue(u, d, {
|
|
872
|
-
f:
|
|
872
|
+
f: S,
|
|
873
873
|
si: null,
|
|
874
874
|
v: null,
|
|
875
875
|
p: null
|
|
@@ -883,7 +883,7 @@ function _r(e) {
|
|
|
883
883
|
if (t == null)
|
|
884
884
|
return;
|
|
885
885
|
const n = t.dataStream;
|
|
886
|
-
return n.substring(n.length - 2, n.length) ===
|
|
886
|
+
return n.substring(n.length - 2, n.length) === Jn ? n.substring(0, n.length - 2) : n;
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
var ti = Object.getOwnPropertyDescriptor, ni = (e, t, n, o) => {
|
|
@@ -891,7 +891,7 @@ var ti = Object.getOwnPropertyDescriptor, ni = (e, t, n, o) => {
|
|
|
891
891
|
(c = e[s]) && (r = c(r) || r);
|
|
892
892
|
return r;
|
|
893
893
|
}, Ue = (e, t) => (n, o) => t(n, o, e);
|
|
894
|
-
let Wt = class extends
|
|
894
|
+
let Wt = class extends at {
|
|
895
895
|
constructor(t, n, o, r, s, c, i, l) {
|
|
896
896
|
super();
|
|
897
897
|
K(this, "_previousShape");
|
|
@@ -921,16 +921,16 @@ let Wt = class extends ct {
|
|
|
921
921
|
}
|
|
922
922
|
_initInterceptorEditorStart() {
|
|
923
923
|
this.disposeWithMe(
|
|
924
|
-
|
|
924
|
+
er(
|
|
925
925
|
this._sheetInterceptorService.writeCellInterceptor.intercept(es, {
|
|
926
926
|
handler: (t, n, o) => {
|
|
927
|
-
var a,
|
|
927
|
+
var a, S, m, p;
|
|
928
928
|
const { row: r, col: s, unitId: c, subUnitId: i, worksheet: l } = n, f = this._formulaDataModel.getArrayFormulaRange(), h = this._formulaDataModel.getArrayFormulaCellData();
|
|
929
929
|
if (this._removeArrayFormulaRangeShape(), t == null)
|
|
930
930
|
return o(t);
|
|
931
931
|
let g = null;
|
|
932
932
|
const u = this._formulaDataModel.getFormulaStringByCell(r, s, i, c);
|
|
933
|
-
if (u !== null && (g = { f: u }), t.v != null && t.v !== "" && ((m = (
|
|
933
|
+
if (u !== null && (g = { f: u }), t.v != null && t.v !== "" && ((m = (S = (a = h[c]) == null ? void 0 : a[i]) == null ? void 0 : S[r]) == null ? void 0 : m[s]) == null)
|
|
934
934
|
return g ? { ...t, ...g } : o(t);
|
|
935
935
|
const d = (p = f == null ? void 0 : f[c]) == null ? void 0 : p[i];
|
|
936
936
|
return d != null && (g = this._displayArrayFormulaRangeShape(d, r, s, c, i, l, g)), g ? { ...t, ...g } : o(t);
|
|
@@ -957,10 +957,10 @@ let Wt = class extends ct {
|
|
|
957
957
|
var m;
|
|
958
958
|
if (g == null)
|
|
959
959
|
return !0;
|
|
960
|
-
const { startRow: u, startColumn: d, endRow: a, endColumn:
|
|
960
|
+
const { startRow: u, startColumn: d, endRow: a, endColumn: S } = g;
|
|
961
961
|
if (f === n && h === o)
|
|
962
962
|
return this._createArrayFormulaRangeShape(g, r), !1;
|
|
963
|
-
if (n >= u && n <= a && o >= d && o <=
|
|
963
|
+
if (n >= u && n <= a && o >= d && o <= S) {
|
|
964
964
|
const p = c.getCell(u, d);
|
|
965
965
|
if ((p == null ? void 0 : p.v) === ae.SPILL)
|
|
966
966
|
return;
|
|
@@ -986,7 +986,7 @@ let Wt = class extends ct {
|
|
|
986
986
|
fill: new un(this._themeService.getColorFromTheme("white")).setAlpha(0).toString(),
|
|
987
987
|
widgets: {}
|
|
988
988
|
}
|
|
989
|
-
}, i =
|
|
989
|
+
}, i = nn(c, r), { rowHeaderWidth: l, columnHeaderHeight: f } = r, h = new rr(s, po.FORMULA_EDITOR_SHOW, this._themeService, {
|
|
990
990
|
highlightHeader: !1,
|
|
991
991
|
rowHeaderWidth: l,
|
|
992
992
|
columnHeaderHeight: f
|
|
@@ -1042,7 +1042,7 @@ var ri = Object.getOwnPropertyDescriptor, oi = (e, t, n, o) => {
|
|
|
1042
1042
|
for (var r = o > 1 ? void 0 : o ? ri(t, n) : t, s = e.length - 1, c; s >= 0; s--)
|
|
1043
1043
|
(c = e[s]) && (r = c(r) || r);
|
|
1044
1044
|
return r;
|
|
1045
|
-
},
|
|
1045
|
+
}, Yn = (e, t) => (n, o) => t(n, o, e);
|
|
1046
1046
|
const si = {
|
|
1047
1047
|
tl: {
|
|
1048
1048
|
size: 6,
|
|
@@ -1069,16 +1069,16 @@ let Ht = class extends zr {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
};
|
|
1071
1071
|
Ht = oi([
|
|
1072
|
-
|
|
1073
|
-
|
|
1072
|
+
Yn(0, j(mn)),
|
|
1073
|
+
Yn(1, j(bt))
|
|
1074
1074
|
], Ht);
|
|
1075
1075
|
function ii() {
|
|
1076
|
-
const e =
|
|
1076
|
+
const e = y(is), t = y(fe), n = ve(e.progress$), o = Lt(() => {
|
|
1077
1077
|
t.executeCommand(wo.id);
|
|
1078
1078
|
}, [t]), r = Lt(() => {
|
|
1079
1079
|
e.clearProgress();
|
|
1080
1080
|
}, [e]);
|
|
1081
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ x(us, { progress: n, onTerminate: o, onClearProgress: r });
|
|
1082
1082
|
}
|
|
1083
1083
|
function ci(e, t) {
|
|
1084
1084
|
return Object.keys(e).filter((n) => isNaN(Number(n)) && n !== "DefinedName").map((n) => ({
|
|
@@ -1104,7 +1104,7 @@ function Ir(e) {
|
|
|
1104
1104
|
"("
|
|
1105
1105
|
] }),
|
|
1106
1106
|
n && n.map((o, r) => /* @__PURE__ */ W("span", { children: [
|
|
1107
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ x("span", { children: Rr(o) }),
|
|
1108
1108
|
r === n.length - 1 ? "" : ","
|
|
1109
1109
|
] }, r)),
|
|
1110
1110
|
")"
|
|
@@ -1113,14 +1113,14 @@ function Ir(e) {
|
|
|
1113
1113
|
function St(e) {
|
|
1114
1114
|
const { className: t, value: n, title: o } = e;
|
|
1115
1115
|
return /* @__PURE__ */ W("div", { className: "univer-mb-2 univer-text-xs", children: [
|
|
1116
|
-
/* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ x(
|
|
1117
1117
|
"div",
|
|
1118
1118
|
{
|
|
1119
|
-
className:
|
|
1119
|
+
className: ne("univer-mb-2 univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300", t),
|
|
1120
1120
|
children: o
|
|
1121
1121
|
}
|
|
1122
1122
|
),
|
|
1123
|
-
/* @__PURE__ */
|
|
1123
|
+
/* @__PURE__ */ x(
|
|
1124
1124
|
"div",
|
|
1125
1125
|
{
|
|
1126
1126
|
className: "univer-break-all univer-text-gray-900 dark:!univer-text-white",
|
|
@@ -1134,14 +1134,14 @@ function ai(e) {
|
|
|
1134
1134
|
if (!t) return null;
|
|
1135
1135
|
const [o, r] = V([]), [s, c] = V(t.functionParameter), [i, l] = V(-1);
|
|
1136
1136
|
return /* @__PURE__ */ W("div", { children: [
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ x("div", { className: ne("univer-h-[364px] univer-overflow-y-auto", ct), children: s.map((f, h) => /* @__PURE__ */ W("div", { children: [
|
|
1138
|
+
/* @__PURE__ */ x("div", { className: "univer-text-sm", children: f.name }),
|
|
1139
|
+
/* @__PURE__ */ x("div", { className: "univer-mb-2 univer-mt-1" })
|
|
1140
1140
|
] }, h)) }),
|
|
1141
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ x("div", { className: ne("univer-flex-1 univer-p-3", vs), children: /* @__PURE__ */ x(
|
|
1142
1142
|
St,
|
|
1143
1143
|
{
|
|
1144
|
-
title: i === -1 ? /* @__PURE__ */
|
|
1144
|
+
title: i === -1 ? /* @__PURE__ */ x(Ir, { prefix: t.functionName, value: s }) : s[i].name,
|
|
1145
1145
|
value: i === -1 ? t.description : s[i].detail
|
|
1146
1146
|
}
|
|
1147
1147
|
) })
|
|
@@ -1242,12 +1242,12 @@ var Si = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none
|
|
|
1242
1242
|
});
|
|
1243
1243
|
Nr.displayName = "SelectRangeIcon";
|
|
1244
1244
|
function Ci(e) {
|
|
1245
|
-
const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, c] = V([]), [i, l] = V(0), [f, h] = V(n), [g, u] = V(0), [d, a] = V(null),
|
|
1245
|
+
const { onChange: t } = e, n = "-1", [o, r] = V(""), [s, c] = V([]), [i, l] = V(0), [f, h] = V(n), [g, u] = V(0), [d, a] = V(null), S = y(Yt), m = y(lt), p = y(pn), C = ve(p.sidebarOptions$), _ = ci(ko, m);
|
|
1246
1246
|
_.unshift({
|
|
1247
1247
|
label: m.t("formula.moreFunctions.allFunctions"),
|
|
1248
1248
|
value: n
|
|
1249
1249
|
});
|
|
1250
|
-
const R = m.t("formula.prompt.required"),
|
|
1250
|
+
const R = m.t("formula.prompt.required"), v = m.t("formula.prompt.optional");
|
|
1251
1251
|
$(() => {
|
|
1252
1252
|
A(n);
|
|
1253
1253
|
}, []), $(() => {
|
|
@@ -1255,17 +1255,17 @@ function Ci(e) {
|
|
|
1255
1255
|
}, [s]), $(() => {
|
|
1256
1256
|
C != null && C.visible && (r(""), c([]), l(0), h(n), u(0), a(null), A(n));
|
|
1257
1257
|
}, [C]);
|
|
1258
|
-
const
|
|
1258
|
+
const O = (b) => {
|
|
1259
1259
|
if (o.trim() === "") return b;
|
|
1260
1260
|
const I = new RegExp(`(${o.toLocaleUpperCase()})`);
|
|
1261
|
-
return b.split(I).filter(Boolean).map((M, D) => M.match(I) ? /* @__PURE__ */
|
|
1261
|
+
return b.split(I).filter(Boolean).map((M, D) => M.match(I) ? /* @__PURE__ */ x("span", { className: "univer-text-red-500", children: M }, D) : M);
|
|
1262
1262
|
}, N = (b) => {
|
|
1263
1263
|
if (s.length === 0) {
|
|
1264
1264
|
a(null);
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
1267
|
u(b);
|
|
1268
|
-
const I =
|
|
1268
|
+
const I = S.getFunctionInfo(s[b].name);
|
|
1269
1269
|
if (!I) {
|
|
1270
1270
|
a(null);
|
|
1271
1271
|
return;
|
|
@@ -1274,15 +1274,15 @@ function Ci(e) {
|
|
|
1274
1274
|
};
|
|
1275
1275
|
function A(b) {
|
|
1276
1276
|
h(b);
|
|
1277
|
-
const I =
|
|
1277
|
+
const I = S.getSearchListByType(+b);
|
|
1278
1278
|
c(I);
|
|
1279
1279
|
}
|
|
1280
1280
|
function F(b) {
|
|
1281
1281
|
r(b);
|
|
1282
|
-
const I =
|
|
1282
|
+
const I = S.getSearchListByName(b);
|
|
1283
1283
|
c(I);
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function T(b) {
|
|
1286
1286
|
if (b.stopPropagation(), b.key === "ArrowDown") {
|
|
1287
1287
|
const I = i + 1;
|
|
1288
1288
|
l(I === s.length ? 0 : I);
|
|
@@ -1298,12 +1298,12 @@ function Ci(e) {
|
|
|
1298
1298
|
};
|
|
1299
1299
|
return /* @__PURE__ */ W("div", { children: [
|
|
1300
1300
|
/* @__PURE__ */ W("div", { className: "univer-flex univer-items-center univer-justify-between univer-gap-2", children: [
|
|
1301
|
-
/* @__PURE__ */
|
|
1302
|
-
/* @__PURE__ */
|
|
1301
|
+
/* @__PURE__ */ x(Ss, { value: f, options: _, onChange: A }),
|
|
1302
|
+
/* @__PURE__ */ x(
|
|
1303
1303
|
gr,
|
|
1304
1304
|
{
|
|
1305
1305
|
placeholder: m.t("formula.moreFunctions.searchFunctionPlaceholder"),
|
|
1306
|
-
onKeyDown:
|
|
1306
|
+
onKeyDown: T,
|
|
1307
1307
|
value: o,
|
|
1308
1308
|
onChange: F,
|
|
1309
1309
|
size: "small",
|
|
@@ -1311,56 +1311,56 @@ function Ci(e) {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
)
|
|
1313
1313
|
] }),
|
|
1314
|
-
s.length > 0 && /* @__PURE__ */
|
|
1314
|
+
s.length > 0 && /* @__PURE__ */ x(
|
|
1315
1315
|
"ul",
|
|
1316
1316
|
{
|
|
1317
|
-
className:
|
|
1318
|
-
onKeyDown:
|
|
1317
|
+
className: ne("univer-m-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", vn, ct),
|
|
1318
|
+
onKeyDown: T,
|
|
1319
1319
|
tabIndex: -1,
|
|
1320
1320
|
children: s.map(({ name: b }, I) => /* @__PURE__ */ W(
|
|
1321
1321
|
"li",
|
|
1322
1322
|
{
|
|
1323
|
-
className:
|
|
1323
|
+
className: ne("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", {
|
|
1324
1324
|
"univer-bg-gray-200 dark:!univer-bg-gray-600": i === I
|
|
1325
1325
|
}),
|
|
1326
1326
|
onMouseEnter: () => k(I),
|
|
1327
1327
|
onMouseLeave: w,
|
|
1328
1328
|
onClick: () => N(I),
|
|
1329
1329
|
children: [
|
|
1330
|
-
g === I && /* @__PURE__ */
|
|
1330
|
+
g === I && /* @__PURE__ */ x(
|
|
1331
1331
|
br,
|
|
1332
1332
|
{
|
|
1333
1333
|
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"
|
|
1334
1334
|
}
|
|
1335
1335
|
),
|
|
1336
|
-
/* @__PURE__ */
|
|
1336
|
+
/* @__PURE__ */ x("span", { className: "univer-block", children: O(b) })
|
|
1337
1337
|
]
|
|
1338
1338
|
},
|
|
1339
1339
|
I
|
|
1340
1340
|
))
|
|
1341
1341
|
}
|
|
1342
1342
|
),
|
|
1343
|
-
d && /* @__PURE__ */ W("div", { className:
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1343
|
+
d && /* @__PURE__ */ W("div", { className: ne("univer-mx-0 univer-my-2 univer-overflow-y-auto", ct), children: [
|
|
1344
|
+
/* @__PURE__ */ x(St, { title: d.functionName, value: d.description }),
|
|
1345
|
+
/* @__PURE__ */ x(
|
|
1346
1346
|
St,
|
|
1347
1347
|
{
|
|
1348
1348
|
title: m.t("formula.moreFunctions.syntax"),
|
|
1349
|
-
value: /* @__PURE__ */
|
|
1349
|
+
value: /* @__PURE__ */ x(Ir, { prefix: d.functionName, value: d.functionParameter })
|
|
1350
1350
|
}
|
|
1351
1351
|
),
|
|
1352
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ x(
|
|
1353
1353
|
St,
|
|
1354
1354
|
{
|
|
1355
1355
|
title: m.t("formula.prompt.helpExample"),
|
|
1356
1356
|
value: `${d.functionName}(${d.functionParameter.map((b) => b.example).join(",")})`
|
|
1357
1357
|
}
|
|
1358
1358
|
),
|
|
1359
|
-
d.functionParameter && d.functionParameter.map((b) => /* @__PURE__ */
|
|
1359
|
+
d.functionParameter && d.functionParameter.map((b) => /* @__PURE__ */ x(
|
|
1360
1360
|
St,
|
|
1361
1361
|
{
|
|
1362
1362
|
title: b.name,
|
|
1363
|
-
value: `${b.require ? R :
|
|
1363
|
+
value: `${b.require ? R : v} ${b.detail}`
|
|
1364
1364
|
},
|
|
1365
1365
|
b.name
|
|
1366
1366
|
))
|
|
@@ -1369,21 +1369,21 @@ function Ci(e) {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
function _i() {
|
|
1371
1371
|
const e = vo(), [t, n] = V(!0), [o, r] = V(!1), [s, c] = V(null);
|
|
1372
|
-
|
|
1373
|
-
const i =
|
|
1372
|
+
y(dn);
|
|
1373
|
+
const i = y(lt), l = y(je), f = y(te), h = y(fe);
|
|
1374
1374
|
function g() {
|
|
1375
1375
|
n(!t), r(!o);
|
|
1376
1376
|
}
|
|
1377
1377
|
function u() {
|
|
1378
1378
|
const d = ur(f);
|
|
1379
1379
|
if (!d) return;
|
|
1380
|
-
h.executeCommand(
|
|
1380
|
+
h.executeCommand(tr.id, {
|
|
1381
1381
|
visible: !0,
|
|
1382
1382
|
unitId: d.unitId,
|
|
1383
1383
|
eventType: xe.Dblclick
|
|
1384
1384
|
});
|
|
1385
|
-
const a = l.getEditor(ln),
|
|
1386
|
-
a == null || a.replaceText(m),
|
|
1385
|
+
const a = l.getEditor(ln), S = l.getEditor(Qn), m = `=${s == null ? void 0 : s.functionName}(`;
|
|
1386
|
+
a == null || a.replaceText(m), S == null || S.replaceText(m, !1);
|
|
1387
1387
|
}
|
|
1388
1388
|
return /* @__PURE__ */ W(
|
|
1389
1389
|
"div",
|
|
@@ -1391,12 +1391,12 @@ function _i() {
|
|
|
1391
1391
|
"data-u-comp": "sheets-formula-functions-panel",
|
|
1392
1392
|
className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-2",
|
|
1393
1393
|
children: [
|
|
1394
|
-
t && /* @__PURE__ */
|
|
1395
|
-
o && /* @__PURE__ */
|
|
1394
|
+
t && /* @__PURE__ */ x(Ci, { onChange: c }),
|
|
1395
|
+
o && /* @__PURE__ */ x(ai, { functionInfo: s, onChange: () => {
|
|
1396
1396
|
} }),
|
|
1397
1397
|
/* @__PURE__ */ W("div", { className: "univer-flex univer-justify-end", children: [
|
|
1398
|
-
o && /* @__PURE__ */
|
|
1399
|
-
|
|
1398
|
+
o && /* @__PURE__ */ x(
|
|
1399
|
+
ot,
|
|
1400
1400
|
{
|
|
1401
1401
|
variant: "primary",
|
|
1402
1402
|
onClick: g,
|
|
@@ -1404,9 +1404,9 @@ function _i() {
|
|
|
1404
1404
|
children: i.t("formula.moreFunctions.next")
|
|
1405
1405
|
}
|
|
1406
1406
|
),
|
|
1407
|
-
o && /* @__PURE__ */
|
|
1408
|
-
t && !!e && /* @__PURE__ */
|
|
1409
|
-
|
|
1407
|
+
o && /* @__PURE__ */ x(ot, { onClick: g, className: "univer-mb-5 univer-ml-4 univer-mr-0 univer-mt-0", children: i.t("formula.moreFunctions.prev") }),
|
|
1408
|
+
t && !!e && /* @__PURE__ */ x(
|
|
1409
|
+
ot,
|
|
1410
1410
|
{
|
|
1411
1411
|
variant: "primary",
|
|
1412
1412
|
onClick: u,
|
|
@@ -1428,7 +1428,7 @@ function Ri(e) {
|
|
|
1428
1428
|
params: {
|
|
1429
1429
|
value: "SUM"
|
|
1430
1430
|
},
|
|
1431
|
-
hidden$:
|
|
1431
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1432
1432
|
disabled$: Be(e, {
|
|
1433
1433
|
workbookTypes: [Ge],
|
|
1434
1434
|
worksheetTypes: [Ke, qe],
|
|
@@ -1445,7 +1445,7 @@ function Ii(e) {
|
|
|
1445
1445
|
params: {
|
|
1446
1446
|
value: "COUNT"
|
|
1447
1447
|
},
|
|
1448
|
-
hidden$:
|
|
1448
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1449
1449
|
disabled$: Be(e, {
|
|
1450
1450
|
workbookTypes: [Ge],
|
|
1451
1451
|
worksheetTypes: [Ke, qe],
|
|
@@ -1462,7 +1462,7 @@ function Ei(e) {
|
|
|
1462
1462
|
params: {
|
|
1463
1463
|
value: "AVERAGE"
|
|
1464
1464
|
},
|
|
1465
|
-
hidden$:
|
|
1465
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1466
1466
|
disabled$: Be(e, {
|
|
1467
1467
|
workbookTypes: [Ge],
|
|
1468
1468
|
worksheetTypes: [Ke, qe],
|
|
@@ -1479,7 +1479,7 @@ function bi(e) {
|
|
|
1479
1479
|
params: {
|
|
1480
1480
|
value: "MAX"
|
|
1481
1481
|
},
|
|
1482
|
-
hidden$:
|
|
1482
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1483
1483
|
disabled$: Be(e, {
|
|
1484
1484
|
workbookTypes: [Ge],
|
|
1485
1485
|
worksheetTypes: [Ke, qe],
|
|
@@ -1496,7 +1496,7 @@ function yi(e) {
|
|
|
1496
1496
|
params: {
|
|
1497
1497
|
value: "MIN"
|
|
1498
1498
|
},
|
|
1499
|
-
hidden$:
|
|
1499
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1500
1500
|
disabled$: Be(e, {
|
|
1501
1501
|
workbookTypes: [Ge],
|
|
1502
1502
|
worksheetTypes: [Ke, qe],
|
|
@@ -1506,11 +1506,11 @@ function yi(e) {
|
|
|
1506
1506
|
}
|
|
1507
1507
|
function Ti(e) {
|
|
1508
1508
|
return {
|
|
1509
|
-
id:
|
|
1509
|
+
id: Cn.id,
|
|
1510
1510
|
title: "formula.insert.more",
|
|
1511
1511
|
tooltip: "formula.insert.tooltip",
|
|
1512
1512
|
type: Ze.BUTTON,
|
|
1513
|
-
hidden$:
|
|
1513
|
+
hidden$: dt(e, q.UNIVER_SHEET),
|
|
1514
1514
|
disabled$: Be(e, {
|
|
1515
1515
|
workbookTypes: [Ge],
|
|
1516
1516
|
worksheetTypes: [Ke, qe],
|
|
@@ -1520,7 +1520,7 @@ function Ti(e) {
|
|
|
1520
1520
|
}
|
|
1521
1521
|
function xi(e) {
|
|
1522
1522
|
return e.get(te).getCurrentTypeOfUnit$(q.UNIVER_SHEET).pipe(
|
|
1523
|
-
Vo((o) => o ? e.get(
|
|
1523
|
+
Vo((o) => o ? e.get(Wn) ? new Wo((s) => s.next(!e.get(Wn).supportClipboard)) : Dn(!0) : Dn(!0))
|
|
1524
1524
|
);
|
|
1525
1525
|
}
|
|
1526
1526
|
function Oi(e) {
|
|
@@ -1534,12 +1534,12 @@ function Oi(e) {
|
|
|
1534
1534
|
rangeTypes: [Ye],
|
|
1535
1535
|
worksheetTypes: [qe, Ke]
|
|
1536
1536
|
})),
|
|
1537
|
-
|
|
1537
|
+
ir(([t, n]) => t || n)
|
|
1538
1538
|
)
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
1541
|
const Ni = {
|
|
1542
|
-
[
|
|
1542
|
+
[Hn.BASIC]: {
|
|
1543
1543
|
[`${pe.id}.sum`]: {
|
|
1544
1544
|
order: 0,
|
|
1545
1545
|
menuItemFactory: Ri
|
|
@@ -1561,8 +1561,8 @@ const Ni = {
|
|
|
1561
1561
|
menuItemFactory: yi
|
|
1562
1562
|
}
|
|
1563
1563
|
},
|
|
1564
|
-
[
|
|
1565
|
-
[
|
|
1564
|
+
[Hn.OTHERS]: {
|
|
1565
|
+
[Cn.id]: {
|
|
1566
1566
|
order: 0,
|
|
1567
1567
|
menuItemFactory: Ti
|
|
1568
1568
|
}
|
|
@@ -1573,17 +1573,17 @@ const Ni = {
|
|
|
1573
1573
|
menuItemFactory: Oi
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
}, Mi = "meta_key_ctrl_And_Shift",
|
|
1576
|
+
}, Mi = "meta_key_ctrl_And_Shift", zt = [
|
|
1577
1577
|
L.ARROW_DOWN,
|
|
1578
1578
|
L.ARROW_UP,
|
|
1579
1579
|
L.ARROW_LEFT,
|
|
1580
1580
|
L.ARROW_RIGHT
|
|
1581
|
-
], wi = [...
|
|
1581
|
+
], wi = [...zt, L.ENTER, L.TAB, L.ESC];
|
|
1582
1582
|
function ki() {
|
|
1583
1583
|
const e = [];
|
|
1584
1584
|
for (const t of wi)
|
|
1585
1585
|
e.push({
|
|
1586
|
-
id:
|
|
1586
|
+
id: ht.id,
|
|
1587
1587
|
binding: t,
|
|
1588
1588
|
preconditions: (n) => Et(n),
|
|
1589
1589
|
staticParameters: {
|
|
@@ -1595,9 +1595,9 @@ function ki() {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
function Ai() {
|
|
1597
1597
|
const e = [];
|
|
1598
|
-
for (const t of
|
|
1598
|
+
for (const t of zt)
|
|
1599
1599
|
e.push({
|
|
1600
|
-
id:
|
|
1600
|
+
id: ht.id,
|
|
1601
1601
|
binding: t | P.SHIFT,
|
|
1602
1602
|
preconditions: (n) => Et(n),
|
|
1603
1603
|
staticParameters: {
|
|
@@ -1610,9 +1610,9 @@ function Ai() {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
function Fi() {
|
|
1612
1612
|
const e = [];
|
|
1613
|
-
for (const t of
|
|
1613
|
+
for (const t of zt)
|
|
1614
1614
|
e.push({
|
|
1615
|
-
id:
|
|
1615
|
+
id: ht.id,
|
|
1616
1616
|
binding: t | P.CTRL_COMMAND,
|
|
1617
1617
|
preconditions: (n) => Et(n),
|
|
1618
1618
|
staticParameters: {
|
|
@@ -1625,9 +1625,9 @@ function Fi() {
|
|
|
1625
1625
|
}
|
|
1626
1626
|
function Di() {
|
|
1627
1627
|
const e = [];
|
|
1628
|
-
for (const t of
|
|
1628
|
+
for (const t of zt)
|
|
1629
1629
|
e.push({
|
|
1630
|
-
id:
|
|
1630
|
+
id: ht.id,
|
|
1631
1631
|
binding: t | P.SHIFT | P.CTRL_COMMAND,
|
|
1632
1632
|
preconditions: (n) => Et(n),
|
|
1633
1633
|
staticParameters: {
|
|
@@ -1647,7 +1647,7 @@ function $i() {
|
|
|
1647
1647
|
const e = [];
|
|
1648
1648
|
for (const t of [L.ENTER, L.TAB, L.ARROW_DOWN, L.ARROW_UP])
|
|
1649
1649
|
e.push({
|
|
1650
|
-
id:
|
|
1650
|
+
id: ht.id,
|
|
1651
1651
|
binding: t,
|
|
1652
1652
|
preconditions: (n) => Ps(n),
|
|
1653
1653
|
staticParameters: {
|
|
@@ -1671,7 +1671,7 @@ var Ui = Object.getOwnPropertyDescriptor, Vi = (e, t, n, o) => {
|
|
|
1671
1671
|
(c = e[s]) && (r = c(r) || r);
|
|
1672
1672
|
return r;
|
|
1673
1673
|
}, Ve = (e, t) => (n, o) => t(n, o, e);
|
|
1674
|
-
let Bt = class extends
|
|
1674
|
+
let Bt = class extends at {
|
|
1675
1675
|
constructor(e, t, n, o, r, s, c) {
|
|
1676
1676
|
super(), this._injector = e, this._menuManagerService = t, this._commandService = n, this._shortcutService = o, this._uiPartsService = r, this._renderManagerService = s, this._componentManager = c, this._initialize();
|
|
1677
1677
|
}
|
|
@@ -1685,10 +1685,10 @@ let Bt = class extends ct {
|
|
|
1685
1685
|
[
|
|
1686
1686
|
Sn,
|
|
1687
1687
|
pe,
|
|
1688
|
-
|
|
1688
|
+
Cn,
|
|
1689
1689
|
Fs,
|
|
1690
1690
|
xs,
|
|
1691
|
-
|
|
1691
|
+
ht,
|
|
1692
1692
|
Sr
|
|
1693
1693
|
].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
|
|
1694
1694
|
}
|
|
@@ -1723,7 +1723,7 @@ Bt = Vi([
|
|
|
1723
1723
|
], Bt);
|
|
1724
1724
|
class Mr {
|
|
1725
1725
|
constructor() {
|
|
1726
|
-
K(this, "_currentSelector$", new
|
|
1726
|
+
K(this, "_currentSelector$", new cr(null));
|
|
1727
1727
|
K(this, "currentSelector$", this._currentSelector$.asObservable());
|
|
1728
1728
|
}
|
|
1729
1729
|
showRangeSelectorDialog(t) {
|
|
@@ -1739,7 +1739,7 @@ var Wi = Object.getOwnPropertyDescriptor, Hi = (e, t, n, o) => {
|
|
|
1739
1739
|
for (var r = o > 1 ? void 0 : o ? Wi(t, n) : t, s = e.length - 1, c; s >= 0; s--)
|
|
1740
1740
|
(c = e[s]) && (r = c(r) || r);
|
|
1741
1741
|
return r;
|
|
1742
|
-
},
|
|
1742
|
+
}, nt = (e, t) => (n, o) => t(n, o, e);
|
|
1743
1743
|
let Le = class extends Ro {
|
|
1744
1744
|
constructor(t, n, o, r, s, c, i) {
|
|
1745
1745
|
super(
|
|
@@ -1775,7 +1775,7 @@ let Le = class extends Ro {
|
|
|
1775
1775
|
* Call this method and user will be able to select on the canvas to update selections.
|
|
1776
1776
|
*/
|
|
1777
1777
|
enableSelectionChanging() {
|
|
1778
|
-
return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(),
|
|
1778
|
+
return this._disableSelectionChanging(), this._eventDisposables = this._initCanvasEventListeners(), er(() => this._disableSelectionChanging());
|
|
1779
1779
|
}
|
|
1780
1780
|
_disableSelectionChanging() {
|
|
1781
1781
|
var t;
|
|
@@ -1791,13 +1791,13 @@ let Le = class extends Ro {
|
|
|
1791
1791
|
})), i.add(
|
|
1792
1792
|
n == null ? void 0 : n.onPointerDown$.subscribeEvent((l, f) => {
|
|
1793
1793
|
if (!this.inRefSelectionMode()) return;
|
|
1794
|
-
const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: g } =
|
|
1795
|
-
|
|
1794
|
+
const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { row: g } = Mn(l.offsetX, l.offsetY, c, h);
|
|
1795
|
+
wn(this._workbookSelections.getCurrentSelections(), g, _e.ROW) || (this._onPointerDown(l, (r.zIndex || 1) + 1, _e.ROW, this._getActiveViewport(l), Qt.Y), l.button !== 2 && f.stopPropagation());
|
|
1796
1796
|
})
|
|
1797
1797
|
), i.add(o == null ? void 0 : o.onPointerDown$.subscribeEvent((l, f) => {
|
|
1798
1798
|
if (!this.inRefSelectionMode()) return;
|
|
1799
|
-
const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: g } =
|
|
1800
|
-
|
|
1799
|
+
const h = this._sheetSkeletonManagerService.getCurrent().skeleton, { column: g } = Mn(l.offsetX, l.offsetY, c, h);
|
|
1800
|
+
wn(this._workbookSelections.getCurrentSelections(), g, _e.COLUMN) || (this._onPointerDown(l, (r.zIndex || 1) + 1, _e.COLUMN, this._getActiveViewport(l), Qt.X), l.button !== 2 && f.stopPropagation());
|
|
1801
1801
|
})), i.add(s == null ? void 0 : s.onPointerDown$.subscribeEvent((l, f) => {
|
|
1802
1802
|
if (this._reset(), !this.inRefSelectionMode()) return;
|
|
1803
1803
|
const h = this._sheetSkeletonManagerService.getCurrent().skeleton, g = Io(h);
|
|
@@ -1815,7 +1815,7 @@ let Le = class extends Ro {
|
|
|
1815
1815
|
*/
|
|
1816
1816
|
_addSelectionControlByModelData(t) {
|
|
1817
1817
|
var c;
|
|
1818
|
-
const n = this._skeleton, o = (c = t.style) != null ? c :
|
|
1818
|
+
const n = this._skeleton, o = (c = t.style) != null ? c : or(this._themeService), r = this._scene;
|
|
1819
1819
|
return t.style = o, this.newSelectionControl(r, n, t);
|
|
1820
1820
|
}
|
|
1821
1821
|
_initSelectionChangeListener() {
|
|
@@ -1828,11 +1828,11 @@ let Le = class extends Ro {
|
|
|
1828
1828
|
*/
|
|
1829
1829
|
_initUserActionSyncListener() {
|
|
1830
1830
|
this.disposeWithMe(this.selectionMoveStart$.subscribe((t) => {
|
|
1831
|
-
this._updateSelections(t,
|
|
1831
|
+
this._updateSelections(t, Jt.MOVE_START);
|
|
1832
1832
|
})), this.disposeWithMe(this.selectionMoving$.subscribe((t) => {
|
|
1833
|
-
this._updateSelections(t,
|
|
1833
|
+
this._updateSelections(t, Jt.MOVING);
|
|
1834
1834
|
})), this.disposeWithMe(this.selectionMoveEnd$.subscribe((t) => {
|
|
1835
|
-
this._updateSelections(t,
|
|
1835
|
+
this._updateSelections(t, Jt.MOVE_END);
|
|
1836
1836
|
}));
|
|
1837
1837
|
}
|
|
1838
1838
|
_updateSelections(t, n) {
|
|
@@ -1847,7 +1847,7 @@ let Le = class extends Ro {
|
|
|
1847
1847
|
this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe((t) => {
|
|
1848
1848
|
if (!t)
|
|
1849
1849
|
return;
|
|
1850
|
-
const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport(
|
|
1850
|
+
const { skeleton: n } = t, { scene: o } = this._context, r = o.getViewport($n.VIEW_MAIN);
|
|
1851
1851
|
this._skeleton && this._skeleton.worksheet.getSheetId() !== n.worksheet.getSheetId() && this._reset(), this._changeRuntime(n, o, r);
|
|
1852
1852
|
const s = this._workbookSelections.getCurrentSelections();
|
|
1853
1853
|
this.resetSelectionsByModelData(s);
|
|
@@ -1855,7 +1855,7 @@ let Le = class extends Ro {
|
|
|
1855
1855
|
}
|
|
1856
1856
|
_getActiveViewport(t) {
|
|
1857
1857
|
const n = this._getSheetObject();
|
|
1858
|
-
return n == null ? void 0 : n.scene.getActiveViewportByCoord(
|
|
1858
|
+
return n == null ? void 0 : n.scene.getActiveViewportByCoord(Pn.FromArray([t.offsetX, t.offsetY]));
|
|
1859
1859
|
}
|
|
1860
1860
|
_getSheetObject() {
|
|
1861
1861
|
return Eo(this._context.unit, this._context);
|
|
@@ -1871,18 +1871,18 @@ let Le = class extends Ro {
|
|
|
1871
1871
|
* @param scrollTimerType
|
|
1872
1872
|
*/
|
|
1873
1873
|
// eslint-disable-next-line complexity, max-lines-per-function
|
|
1874
|
-
_onPointerDown(t, n = 0, o = _e.NORMAL, r, s =
|
|
1875
|
-
var
|
|
1874
|
+
_onPointerDown(t, n = 0, o = _e.NORMAL, r, s = Qt.ALL) {
|
|
1875
|
+
var T;
|
|
1876
1876
|
this._rangeType = o;
|
|
1877
1877
|
const c = this._skeleton, i = this._scene;
|
|
1878
1878
|
if (!i || !c)
|
|
1879
1879
|
return;
|
|
1880
1880
|
r && (this._activeViewport = r);
|
|
1881
|
-
const { offsetX: l, offsetY: f } = t, h = i.getViewport(
|
|
1881
|
+
const { offsetX: l, offsetY: f } = t, h = i.getViewport($n.VIEW_MAIN);
|
|
1882
1882
|
if (!h) return;
|
|
1883
|
-
const g = i.getCoordRelativeToViewport(
|
|
1883
|
+
const g = i.getCoordRelativeToViewport(Pn.FromArray([l, f])), { x: u, y: d } = g;
|
|
1884
1884
|
this._startViewportPosX = u, this._startViewportPosY = d;
|
|
1885
|
-
const a = i.getScrollXYInfoByViewport(g), { scaleX:
|
|
1885
|
+
const a = i.getScrollXYInfoByViewport(g), { scaleX: S, scaleY: m } = i.getAncestorScale(), p = this._skeleton.getCellByOffset(u, d, S, m, a);
|
|
1886
1886
|
if (!p) return;
|
|
1887
1887
|
switch (o) {
|
|
1888
1888
|
case _e.NORMAL:
|
|
@@ -1898,34 +1898,34 @@ let Le = class extends Ro {
|
|
|
1898
1898
|
}
|
|
1899
1899
|
const C = { range: p, primary: p, style: null };
|
|
1900
1900
|
C.range.rangeType = o;
|
|
1901
|
-
const _ =
|
|
1901
|
+
const _ = nn(C, this._skeleton);
|
|
1902
1902
|
this._startRangeWhenPointerDown = { ..._.rangeWithCoord };
|
|
1903
1903
|
const R = { ..._.rangeWithCoord, rangeType: o };
|
|
1904
|
-
let
|
|
1905
|
-
const
|
|
1906
|
-
for (const k of
|
|
1907
|
-
if (t.button === 2 &&
|
|
1908
|
-
|
|
1904
|
+
let v = this.getActiveSelectionControl();
|
|
1905
|
+
const O = this.getSelectionControls();
|
|
1906
|
+
for (const k of O) {
|
|
1907
|
+
if (t.button === 2 && Xn.contains(k.model, R)) {
|
|
1908
|
+
v = k;
|
|
1909
1909
|
return;
|
|
1910
1910
|
}
|
|
1911
1911
|
if (k.model.isEqual(R)) {
|
|
1912
|
-
|
|
1912
|
+
v = k;
|
|
1913
1913
|
break;
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
this._checkClearPreviousControls(t);
|
|
1917
|
-
const N =
|
|
1917
|
+
const N = v == null ? void 0 : v.model.currentCell, A = t.shiftKey && N, F = this._remainLastEnabled && !t.ctrlKey && !t.shiftKey && !this._skipLastEnabled && !this._singleSelectionEnabled;
|
|
1918
1918
|
A && N ? this._makeSelectionByTwoCells(
|
|
1919
1919
|
N,
|
|
1920
1920
|
R,
|
|
1921
1921
|
c,
|
|
1922
1922
|
o,
|
|
1923
|
-
|
|
1923
|
+
v
|
|
1924
1924
|
// Get updated in this method
|
|
1925
|
-
) : F &&
|
|
1925
|
+
) : F && v ? v.updateRangeBySelectionWithCoord(_) : v = this.newSelectionControl(i, c, C);
|
|
1926
1926
|
for (let k = 0; k < this.getSelectionControls().length - 1; k++)
|
|
1927
1927
|
this.getSelectionControls()[k].clearHighlight();
|
|
1928
|
-
this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), i.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (
|
|
1928
|
+
this._selectionMoveStart$.next(this.getSelectionDataWithStyle()), i.disableObjectsEvent(), this._clearUpdatingListeners(), this._addEndingListeners(), (T = i.getTransformer()) == null || T.clearSelectedObjects(), this._setupPointerMoveListener(h, v, o, s, u, d), this._escapeShortcutDisposable = this._shortcutService.forceEscape(), this._scenePointerUpSub = i.onPointerUp$.subscribeEvent(() => {
|
|
1929
1929
|
var k;
|
|
1930
1930
|
this._clearUpdatingListeners(), this._selectionMoveEnd$.next(this.getSelectionDataWithStyle()), (k = this._escapeShortcutDisposable) == null || k.dispose(), this._escapeShortcutDisposable = null;
|
|
1931
1931
|
});
|
|
@@ -1938,12 +1938,12 @@ let Le = class extends Ro {
|
|
|
1938
1938
|
* @returns {SelectionControl} selectionControl just created
|
|
1939
1939
|
*/
|
|
1940
1940
|
newSelectionControl(t, n, o) {
|
|
1941
|
-
const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: c } = n, i = new
|
|
1941
|
+
const r = this.getSelectionControls().length, { rowHeaderWidth: s, columnHeaderHeight: c } = n, i = new rr(t, r, this._themeService, {
|
|
1942
1942
|
highlightHeader: this._highlightHeader,
|
|
1943
1943
|
enableAutoFill: !1,
|
|
1944
1944
|
rowHeaderWidth: s,
|
|
1945
1945
|
columnHeaderHeight: c
|
|
1946
|
-
}), l =
|
|
1946
|
+
}), l = nn(o, n);
|
|
1947
1947
|
return i.updateRangeBySelectionWithCoord(l), this._selectionControls.push(i), i.setControlExtension({
|
|
1948
1948
|
skeleton: n,
|
|
1949
1949
|
scene: t,
|
|
@@ -1958,18 +1958,18 @@ let Le = class extends Ro {
|
|
|
1958
1958
|
}
|
|
1959
1959
|
};
|
|
1960
1960
|
Le = Hi([
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1961
|
+
nt(1, j(Rt)),
|
|
1962
|
+
nt(2, j(It)),
|
|
1963
|
+
nt(3, Gt),
|
|
1964
|
+
nt(4, j(qt)),
|
|
1965
|
+
nt(5, an),
|
|
1966
|
+
nt(6, Kt)
|
|
1967
1967
|
], Le);
|
|
1968
1968
|
function Bi(e) {
|
|
1969
|
-
const t =
|
|
1969
|
+
const t = or(e);
|
|
1970
1970
|
return t.widgets = { tl: !0, tc: !0, tr: !0, ml: !0, mr: !0, bl: !0, bc: !0, br: !0 }, t;
|
|
1971
1971
|
}
|
|
1972
|
-
const
|
|
1972
|
+
const _n = (e, t, n = !0) => {
|
|
1973
1973
|
let o = -1;
|
|
1974
1974
|
return e.reduce((r, s, c) => {
|
|
1975
1975
|
if (r.isFinish)
|
|
@@ -2006,7 +2006,7 @@ const Rn = (e, t, n = !0) => {
|
|
|
2006
2006
|
}, [e, t]);
|
|
2007
2007
|
};
|
|
2008
2008
|
function kr(e, t, n) {
|
|
2009
|
-
const o =
|
|
2009
|
+
const o = y(je), r = ie(() => new cr({ left: -999, top: -999, right: -999, bottom: -999 }), []), s = y(pn), c = y(te), i = J(() => {
|
|
2010
2010
|
var _;
|
|
2011
2011
|
const l = o.getEditor(e);
|
|
2012
2012
|
if (!l)
|
|
@@ -2014,11 +2014,11 @@ function kr(e, t, n) {
|
|
|
2014
2014
|
const f = l.getBoundingClientRect(), { marginTop: h = 0, marginBottom: g = 0 } = l.getDocumentData().documentStyle, u = l.getSkeleton();
|
|
2015
2015
|
if (!u) return;
|
|
2016
2016
|
const d = (_ = u.getSkeletonData()) == null ? void 0 : _.pages[0].height;
|
|
2017
|
-
let { left: a, top:
|
|
2018
|
-
|
|
2017
|
+
let { left: a, top: S, right: m, bottom: p } = f;
|
|
2018
|
+
S = S + h, p = d ? S + d : p - g;
|
|
2019
2019
|
const C = r.getValue();
|
|
2020
|
-
if (!(C.left === a && C.top ===
|
|
2021
|
-
return r.next({ left: a - 1, right: m + 1, top:
|
|
2020
|
+
if (!(C.left === a && C.top === S && C.right === m && C.bottom === p))
|
|
2021
|
+
return r.next({ left: a - 1, right: m + 1, top: S - 1, bottom: p + 1 }), f;
|
|
2022
2022
|
});
|
|
2023
2023
|
return $(() => {
|
|
2024
2024
|
t && i();
|
|
@@ -2033,61 +2033,71 @@ const Qe = (e) => {
|
|
|
2033
2033
|
const t = z(e);
|
|
2034
2034
|
return t.current = e, t;
|
|
2035
2035
|
}, qi = (e, t, n) => {
|
|
2036
|
-
const o =
|
|
2037
|
-
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2036
|
+
const o = y(Zt), r = y(Yt), s = y(Ie), [c, i] = V(), [l, f] = V(-1), [h, g] = V(!0), u = Qe(h), d = z(t);
|
|
2037
|
+
d.current = t;
|
|
2038
|
+
const a = () => {
|
|
2039
|
+
i(void 0), f(-1), g(!1);
|
|
2040
2040
|
};
|
|
2041
2041
|
return $(() => {
|
|
2042
|
+
const S = s.sequenceNodesBuilder(t.slice(1));
|
|
2043
|
+
o.setSequenceNodes(S != null ? S : []);
|
|
2044
|
+
}, [t]), $(() => {
|
|
2042
2045
|
if (n && e) {
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2045
|
-
const [
|
|
2046
|
-
if (
|
|
2047
|
-
const C =
|
|
2048
|
-
if (
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2046
|
+
const S = n.selectionChange$.pipe(hn(50)).subscribe((p) => {
|
|
2047
|
+
if (p.textRanges.length === 1) {
|
|
2048
|
+
const [C] = p.textRanges;
|
|
2049
|
+
if (C.collapsed && u.current) {
|
|
2050
|
+
const { startOffset: _ } = C, R = o.getCurrentSequenceNode(_ - 2);
|
|
2051
|
+
if (R)
|
|
2052
|
+
if (typeof R != "string" && R.nodeType === 3 && !r.hasDefinedNameDescription(R.token.trim())) {
|
|
2053
|
+
const v = r.getFunctionInfo(R.token);
|
|
2054
|
+
i(v), f(-1);
|
|
2055
|
+
return;
|
|
2056
|
+
} else {
|
|
2057
|
+
const v = s.getFunctionAndParameter(`${d.current}A`, _ - 1);
|
|
2058
|
+
if (v) {
|
|
2059
|
+
const { functionName: O, paramIndex: N } = v, A = r.getFunctionInfo(O);
|
|
2060
|
+
i(A), f(N);
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2053
2064
|
}
|
|
2054
2065
|
}
|
|
2055
|
-
|
|
2056
|
-
}),
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
cr((m) => m.textRanges[0].startOffset),
|
|
2066
|
+
i(void 0), f(-1);
|
|
2067
|
+
}), m = n.selectionChange$.pipe(
|
|
2068
|
+
ar((p) => p.textRanges.length === 1),
|
|
2069
|
+
ir((p) => p.textRanges[0].startOffset),
|
|
2060
2070
|
Bo()
|
|
2061
2071
|
).subscribe(() => {
|
|
2062
|
-
|
|
2072
|
+
g(!0);
|
|
2063
2073
|
});
|
|
2064
2074
|
return () => {
|
|
2065
|
-
|
|
2075
|
+
S.unsubscribe(), m.unsubscribe();
|
|
2066
2076
|
};
|
|
2067
2077
|
}
|
|
2068
2078
|
}, [n, e]), $(() => {
|
|
2069
|
-
e ||
|
|
2079
|
+
e || a();
|
|
2070
2080
|
}, [e]), {
|
|
2071
|
-
functionInfo:
|
|
2072
|
-
paramIndex:
|
|
2073
|
-
reset:
|
|
2081
|
+
functionInfo: c,
|
|
2082
|
+
paramIndex: l,
|
|
2083
|
+
reset: a
|
|
2074
2084
|
};
|
|
2075
|
-
}, Ki = ({ onClick: e }) => /* @__PURE__ */
|
|
2085
|
+
}, Ki = ({ onClick: e }) => /* @__PURE__ */ x(
|
|
2076
2086
|
"div",
|
|
2077
2087
|
{
|
|
2078
2088
|
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",
|
|
2079
2089
|
onClick: e,
|
|
2080
2090
|
children: "?"
|
|
2081
2091
|
}
|
|
2082
|
-
),
|
|
2083
|
-
/* @__PURE__ */
|
|
2092
|
+
), tn = ({ className: e, title: t, value: n }) => /* @__PURE__ */ W("div", { className: "univer-my-2", children: [
|
|
2093
|
+
/* @__PURE__ */ x(
|
|
2084
2094
|
"div",
|
|
2085
2095
|
{
|
|
2086
|
-
className:
|
|
2096
|
+
className: ne("univer-mb-2 univer-text-sm univer-font-medium univer-text-gray-900 dark:!univer-text-white", e),
|
|
2087
2097
|
children: t
|
|
2088
2098
|
}
|
|
2089
2099
|
),
|
|
2090
|
-
/* @__PURE__ */
|
|
2100
|
+
/* @__PURE__ */ x(
|
|
2091
2101
|
"div",
|
|
2092
2102
|
{
|
|
2093
2103
|
className: "univer-whitespace-pre-wrap univer-break-words univer-text-xs univer-text-gray-500",
|
|
@@ -2102,7 +2112,7 @@ const Qe = (e) => {
|
|
|
2102
2112
|
"("
|
|
2103
2113
|
] }),
|
|
2104
2114
|
n && n.map((s, c) => /* @__PURE__ */ W("span", { children: [
|
|
2105
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ x(
|
|
2106
2116
|
"span",
|
|
2107
2117
|
{
|
|
2108
2118
|
className: o === c ? "univer-text-primary-500" : "",
|
|
@@ -2114,90 +2124,90 @@ const Qe = (e) => {
|
|
|
2114
2124
|
] }, s.name)),
|
|
2115
2125
|
")"
|
|
2116
2126
|
] });
|
|
2117
|
-
},
|
|
2127
|
+
}, Gn = () => {
|
|
2118
2128
|
};
|
|
2119
2129
|
function Gi(e) {
|
|
2120
|
-
const { onParamsSwitch: t =
|
|
2121
|
-
function
|
|
2122
|
-
t && t(
|
|
2123
|
-
}
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2126
|
-
}),
|
|
2127
|
-
|
|
2130
|
+
const { onParamsSwitch: t = Gn, onClose: n = Gn, isFocus: o, editor: r, formulaText: s } = e, { functionInfo: c, paramIndex: i, reset: l } = qi(o, s, r), f = y(dn), h = !ve(f.helpFunctionVisible$), [g, u] = V(!0), d = y(lt), a = d.t("formula.prompt.required"), S = d.t("formula.prompt.optional"), m = r.getEditorId(), [p] = kr(m, !!c, [c, i]);
|
|
2131
|
+
function C(v) {
|
|
2132
|
+
t && t(v);
|
|
2133
|
+
}
|
|
2134
|
+
const _ = J((v) => {
|
|
2135
|
+
f.helpFunctionVisible$.next(!v);
|
|
2136
|
+
}), R = () => {
|
|
2137
|
+
_(!0), n();
|
|
2128
2138
|
};
|
|
2129
|
-
return
|
|
2139
|
+
return c ? h ? /* @__PURE__ */ x(rn, { portal: !0, anchorRect$: p, direction: "left-center", children: /* @__PURE__ */ x(Ki, { onClick: () => _(!1) }) }, "hidden") : /* @__PURE__ */ x(rn, { portal: !0, onClickOutside: () => l(), anchorRect$: p, direction: "vertical", children: /* @__PURE__ */ W(
|
|
2130
2140
|
"div",
|
|
2131
2141
|
{
|
|
2132
|
-
className:
|
|
2142
|
+
className: ne("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", vn),
|
|
2133
2143
|
children: [
|
|
2134
2144
|
/* @__PURE__ */ W(
|
|
2135
2145
|
"div",
|
|
2136
2146
|
{
|
|
2137
|
-
className:
|
|
2147
|
+
className: ne("univer-wrap-anywhere 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", Cs),
|
|
2138
2148
|
children: [
|
|
2139
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ x(
|
|
2140
2150
|
Yi,
|
|
2141
2151
|
{
|
|
2142
2152
|
prefix: c.functionName,
|
|
2143
2153
|
value: c.functionParameter,
|
|
2144
2154
|
active: i,
|
|
2145
|
-
onClick:
|
|
2155
|
+
onClick: C
|
|
2146
2156
|
}
|
|
2147
2157
|
),
|
|
2148
2158
|
/* @__PURE__ */ W("div", { className: "univer-flex", children: [
|
|
2149
|
-
/* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ x(
|
|
2150
2160
|
"div",
|
|
2151
2161
|
{
|
|
2152
2162
|
className: "univer-ml-2 univer-flex univer-h-6 univer-w-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",
|
|
2153
|
-
style: { transform:
|
|
2154
|
-
onClick: () =>
|
|
2155
|
-
children: /* @__PURE__ */
|
|
2163
|
+
style: { transform: g ? "rotateZ(-90deg)" : "rotateZ(90deg)" },
|
|
2164
|
+
onClick: () => u(!g),
|
|
2165
|
+
children: /* @__PURE__ */ x(Or, {})
|
|
2156
2166
|
}
|
|
2157
2167
|
),
|
|
2158
|
-
/* @__PURE__ */
|
|
2168
|
+
/* @__PURE__ */ x(
|
|
2159
2169
|
"div",
|
|
2160
2170
|
{
|
|
2161
2171
|
className: "univer-ml-2 univer-flex univer-h-6 univer-w-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-bg-transparent univer-p-0 univer-text-xs univer-text-gray-600 univer-outline-none univer-transition-colors hover:univer-bg-gray-300 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-600",
|
|
2162
|
-
onClick:
|
|
2163
|
-
children: /* @__PURE__ */
|
|
2172
|
+
onClick: R,
|
|
2173
|
+
children: /* @__PURE__ */ x(yr, {})
|
|
2164
2174
|
}
|
|
2165
2175
|
)
|
|
2166
2176
|
] })
|
|
2167
2177
|
]
|
|
2168
2178
|
}
|
|
2169
2179
|
),
|
|
2170
|
-
/* @__PURE__ */
|
|
2180
|
+
/* @__PURE__ */ x(
|
|
2171
2181
|
"div",
|
|
2172
2182
|
{
|
|
2173
|
-
className:
|
|
2183
|
+
className: ne("univer-box-border univer-max-h-[350px] univer-overflow-y-auto univer-px-4 univer-pb-3 univer-pt-0", ct),
|
|
2174
2184
|
style: {
|
|
2175
|
-
height:
|
|
2176
|
-
padding:
|
|
2185
|
+
height: g ? "unset" : 0,
|
|
2186
|
+
padding: g ? "revert-layer" : 0
|
|
2177
2187
|
},
|
|
2178
2188
|
children: /* @__PURE__ */ W("div", { className: "univer-mt-3", children: [
|
|
2179
|
-
/* @__PURE__ */
|
|
2180
|
-
|
|
2189
|
+
/* @__PURE__ */ x(
|
|
2190
|
+
tn,
|
|
2181
2191
|
{
|
|
2182
|
-
title:
|
|
2183
|
-
value: `${c.functionName}(${c.functionParameter.map((
|
|
2192
|
+
title: d.t("formula.prompt.helpExample"),
|
|
2193
|
+
value: `${c.functionName}(${c.functionParameter.map((v) => v.example).join(",")})`
|
|
2184
2194
|
}
|
|
2185
2195
|
),
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
|
|
2196
|
+
/* @__PURE__ */ x(
|
|
2197
|
+
tn,
|
|
2188
2198
|
{
|
|
2189
|
-
title:
|
|
2199
|
+
title: d.t("formula.prompt.helpAbstract"),
|
|
2190
2200
|
value: c.description
|
|
2191
2201
|
}
|
|
2192
2202
|
),
|
|
2193
|
-
c && c.functionParameter && c.functionParameter.map((
|
|
2194
|
-
|
|
2203
|
+
c && c.functionParameter && c.functionParameter.map((v, O) => /* @__PURE__ */ x(
|
|
2204
|
+
tn,
|
|
2195
2205
|
{
|
|
2196
|
-
className: i ===
|
|
2197
|
-
title:
|
|
2198
|
-
value: `${
|
|
2206
|
+
className: i === O ? "univer-text-primary-500" : "",
|
|
2207
|
+
title: v.name,
|
|
2208
|
+
value: `${v.require ? a : S} ${v.detail}`
|
|
2199
2209
|
},
|
|
2200
|
-
|
|
2210
|
+
O
|
|
2201
2211
|
))
|
|
2202
2212
|
] })
|
|
2203
2213
|
}
|
|
@@ -2207,13 +2217,13 @@ function Gi(e) {
|
|
|
2207
2217
|
) }, "show") : null;
|
|
2208
2218
|
}
|
|
2209
2219
|
const Zi = (e) => {
|
|
2210
|
-
const t =
|
|
2220
|
+
const t = y(je);
|
|
2211
2221
|
return J((o) => {
|
|
2212
2222
|
var r, s;
|
|
2213
2223
|
if (e) {
|
|
2214
2224
|
t.focus(e.getEditorId());
|
|
2215
2225
|
const c = [...e.getSelectionRanges()];
|
|
2216
|
-
if (
|
|
2226
|
+
if (st.isDefine(o))
|
|
2217
2227
|
e.setSelectionRanges([{ startOffset: o, endOffset: o }]);
|
|
2218
2228
|
else if (!c.length && !e.docSelectionRenderService.isOnPointerEvent) {
|
|
2219
2229
|
const i = (s = (r = e.getDocumentData().body) == null ? void 0 : r.dataStream) != null ? s : `\r
|
|
@@ -2232,78 +2242,78 @@ function zi(e) {
|
|
|
2232
2242
|
var Fe = /* @__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))(Fe || {});
|
|
2233
2243
|
function Xi(e) {
|
|
2234
2244
|
var N;
|
|
2235
|
-
const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, c =
|
|
2245
|
+
const { editorId: t, isFocus: n, disableOnClick: o, unitId: r, subUnitId: s } = e, c = y(Oe), i = y(te), l = c.getRenderById(r), f = c.getRenderById(t), h = f == null ? void 0 : f.with(lr), g = y(mr), u = y(Rt), [d, a] = V(
|
|
2236
2246
|
0
|
|
2237
2247
|
/* NOT_SELECT */
|
|
2238
|
-
),
|
|
2248
|
+
), S = y(Ie), m = z(!0), p = l == null ? void 0 : l.with(Le), C = Qe(d), _ = i.getUnit(r, q.UNIVER_SHEET), R = _ == null ? void 0 : _.getSheetBySheetId(s), v = J((A) => {
|
|
2239
2249
|
p && p.setSkipLastEnabled(
|
|
2240
2250
|
A === 1 || A === 3
|
|
2241
2251
|
/* EDIT_OTHER_SHEET_REFERENCE */
|
|
2242
2252
|
), C.current = A, a(A);
|
|
2243
|
-
}),
|
|
2253
|
+
}), O = J(() => {
|
|
2244
2254
|
var H, ce;
|
|
2245
2255
|
if (!_) return;
|
|
2246
|
-
const A = _.getActiveSheet(), F = h == null ? void 0 : h.getActiveTextRange(),
|
|
2256
|
+
const A = _.getActiveSheet(), F = h == null ? void 0 : h.getActiveTextRange(), T = F != null && F.collapsed ? F.startOffset : -1, k = zi(u);
|
|
2247
2257
|
if (!k) return;
|
|
2248
|
-
const w = (H = k == null ? void 0 : k.dataStream) == null ? void 0 : H.slice(0, -2), b = ((ce =
|
|
2258
|
+
const w = (H = k == null ? void 0 : k.dataStream) == null ? void 0 : H.slice(0, -2), b = ((ce = S.sequenceNodesBuilder(w)) != null ? ce : []).map((Y) => typeof Y == "object" ? Y.nodeType === X.REFERENCE ? {
|
|
2249
2259
|
...Y,
|
|
2250
2260
|
range: Ao(Y.token)
|
|
2251
2261
|
} : {
|
|
2252
2262
|
...Y,
|
|
2253
2263
|
range: void 0
|
|
2254
|
-
} : Y), I = w[
|
|
2264
|
+
} : Y), I = w[T - 1], E = w[T], M = b.find((Y) => typeof Y == "object" && Y.nodeType === X.REFERENCE && T === Y.endIndex + 2), D = I && Fo(I) && (!E || Do(E) && E !== it.OPEN_BRACKET), U = !!M;
|
|
2255
2265
|
if ((w == null ? void 0 : w.substring(0, 1)) === "=" && (D || U))
|
|
2256
2266
|
if (U) {
|
|
2257
2267
|
if (m.current)
|
|
2258
2268
|
return;
|
|
2259
|
-
!M.range.sheetName && A.getSheetId() === (R == null ? void 0 : R.getSheetId()) || M.range.sheetName === A.getName() ?
|
|
2269
|
+
!M.range.sheetName && A.getSheetId() === (R == null ? void 0 : R.getSheetId()) || M.range.sheetName === A.getName() ? v(
|
|
2260
2270
|
2
|
|
2261
2271
|
/* CAN_EDIT */
|
|
2262
|
-
) :
|
|
2272
|
+
) : v(
|
|
2263
2273
|
3
|
|
2264
2274
|
/* EDIT_OTHER_SHEET_REFERENCE */
|
|
2265
2275
|
);
|
|
2266
2276
|
} else
|
|
2267
|
-
m.current = !1,
|
|
2277
|
+
m.current = !1, v(
|
|
2268
2278
|
1
|
|
2269
2279
|
/* NEED_ADD */
|
|
2270
2280
|
);
|
|
2271
2281
|
else
|
|
2272
|
-
|
|
2282
|
+
v(
|
|
2273
2283
|
0
|
|
2274
2284
|
/* NOT_SELECT */
|
|
2275
2285
|
);
|
|
2276
2286
|
});
|
|
2277
2287
|
return $(() => {
|
|
2278
|
-
const A = g.textSelection$.pipe(
|
|
2279
|
-
|
|
2288
|
+
const A = g.textSelection$.pipe(ar((F) => F.unitId === t)).subscribe(() => {
|
|
2289
|
+
O();
|
|
2280
2290
|
});
|
|
2281
2291
|
return () => A.unsubscribe();
|
|
2282
|
-
}, [
|
|
2283
|
-
n || (
|
|
2292
|
+
}, [O, g.textSelection$, t]), $(() => {
|
|
2293
|
+
n || (v(
|
|
2284
2294
|
0
|
|
2285
2295
|
/* NOT_SELECT */
|
|
2286
2296
|
), m.current = !0);
|
|
2287
|
-
}, [n,
|
|
2297
|
+
}, [n, v]), $(() => {
|
|
2288
2298
|
var F;
|
|
2289
2299
|
if (!o) return;
|
|
2290
2300
|
const A = (F = f == null ? void 0 : f.mainComponent) == null ? void 0 : F.onPointerDown$.subscribeEvent(() => {
|
|
2291
|
-
|
|
2301
|
+
v(
|
|
2292
2302
|
0
|
|
2293
2303
|
/* NOT_SELECT */
|
|
2294
2304
|
), m.current = !0;
|
|
2295
2305
|
});
|
|
2296
2306
|
return () => A == null ? void 0 : A.unsubscribe();
|
|
2297
|
-
}, [o, (N = f == null ? void 0 : f.mainComponent) == null ? void 0 : N.onPointerDown$,
|
|
2307
|
+
}, [o, (N = f == null ? void 0 : f.mainComponent) == null ? void 0 : N.onPointerDown$, v]), $(() => {
|
|
2298
2308
|
if (!n) return;
|
|
2299
2309
|
const A = _ == null ? void 0 : _.activeSheet$.subscribe(() => {
|
|
2300
|
-
|
|
2310
|
+
O();
|
|
2301
2311
|
});
|
|
2302
2312
|
return () => A == null ? void 0 : A.unsubscribe();
|
|
2303
|
-
}, [
|
|
2313
|
+
}, [O, n, _ == null ? void 0 : _.activeSheet$]), { isSelecting: d, isSelectingRef: C };
|
|
2304
2314
|
}
|
|
2305
2315
|
const Qi = () => {
|
|
2306
|
-
const e =
|
|
2316
|
+
const e = y(Ie);
|
|
2307
2317
|
return Lt((n) => e.sequenceNodesBuilder(n) || [], [e]);
|
|
2308
2318
|
};
|
|
2309
2319
|
function Ji(e, t, n) {
|
|
@@ -2320,7 +2330,7 @@ function Ji(e, t, n) {
|
|
|
2320
2330
|
};
|
|
2321
2331
|
}
|
|
2322
2332
|
function Ar(e) {
|
|
2323
|
-
var _, R,
|
|
2333
|
+
var _, R, v;
|
|
2324
2334
|
const {
|
|
2325
2335
|
unitId: t,
|
|
2326
2336
|
subUnitId: n,
|
|
@@ -2337,31 +2347,31 @@ function Ar(e) {
|
|
|
2337
2347
|
c.setSelections(a);
|
|
2338
2348
|
return;
|
|
2339
2349
|
}
|
|
2340
|
-
const
|
|
2350
|
+
const S = d.getSheetId(), m = (O) => {
|
|
2341
2351
|
var N;
|
|
2342
|
-
return (N = u == null ? void 0 : u.getSheetBySheetName(
|
|
2352
|
+
return (N = u == null ? void 0 : u.getSheetBySheetName(O)) == null ? void 0 : N.getSheetId();
|
|
2343
2353
|
};
|
|
2344
|
-
if (!((_ = l == null ? void 0 : l.getWorksheetSkeleton(
|
|
2354
|
+
if (!((_ = l == null ? void 0 : l.getWorksheetSkeleton(S)) == null ? void 0 : _.skeleton)) return;
|
|
2345
2355
|
const C = [];
|
|
2346
|
-
for (let
|
|
2347
|
-
const A = r[
|
|
2348
|
-
if (!D && E || g !== t && I !== g || I && I !== g || D && D !==
|
|
2356
|
+
for (let O = 0, N = r.length; O < N; O++) {
|
|
2357
|
+
const A = r[O], { themeColor: F, token: T, refIndex: k, endIndex: w } = A, b = ut(T), { unitId: I, sheetName: E, range: M } = b, D = m(E);
|
|
2358
|
+
if (!D && E || g !== t && I !== g || I && I !== g || D && D !== S || !D && S !== n)
|
|
2349
2359
|
continue;
|
|
2350
2360
|
const U = os(M, d.getRowCount(), d.getColumnCount());
|
|
2351
|
-
U.unitId = t, U.sheetId =
|
|
2361
|
+
U.unitId = t, U.sheetId = S, a.push({
|
|
2352
2362
|
range: U,
|
|
2353
2363
|
primary: null,
|
|
2354
2364
|
style: Ji(f, F, k.toString())
|
|
2355
2365
|
}), C.push(w);
|
|
2356
2366
|
}
|
|
2357
2367
|
if (s) {
|
|
2358
|
-
const
|
|
2368
|
+
const O = (v = (R = s.getSelectionRanges()) == null ? void 0 : R[0]) == null ? void 0 : v.startOffset, N = C.findIndex((A) => A + 2 === O);
|
|
2359
2369
|
N !== -1 ? i == null || i.setActiveSelectionIndex(N) : i == null || i.resetActiveSelectionIndex();
|
|
2360
2370
|
}
|
|
2361
2371
|
return a;
|
|
2362
2372
|
}
|
|
2363
2373
|
function ec(e, t) {
|
|
2364
|
-
const n =
|
|
2374
|
+
const n = y(te), o = y(It), r = y(Kt), s = y(Oe), c = ve(ie(() => n.getCurrentTypeOfUnit$(q.UNIVER_SHEET), [n])), i = c ? s.getRenderById(c.getUnitId()) : null, l = i == null ? void 0 : i.with(Le), f = i == null ? void 0 : i.with(qt), h = J((g, u) => {
|
|
2365
2375
|
const d = n.getCurrentUnitOfType(q.UNIVER_SHEET);
|
|
2366
2376
|
if (!d || l != null && l.selectionMoving) return;
|
|
2367
2377
|
const a = Ar({
|
|
@@ -2383,7 +2393,7 @@ function ec(e, t) {
|
|
|
2383
2393
|
}, [l]), h;
|
|
2384
2394
|
}
|
|
2385
2395
|
function Fr(e = "") {
|
|
2386
|
-
const t =
|
|
2396
|
+
const t = y(Yt), n = tc(), o = y(fe), r = ie(() => e.length, [e]);
|
|
2387
2397
|
return J((c, i, l = !0, f) => {
|
|
2388
2398
|
const h = c.getDocumentData(), g = c.getEditorId();
|
|
2389
2399
|
if (!h)
|
|
@@ -2394,15 +2404,15 @@ function Fr(e = "") {
|
|
|
2394
2404
|
const d = u.dataStream.slice(0, u.dataStream.length - 2), a = { dataStream: "", ...h.body };
|
|
2395
2405
|
if (!d.startsWith(e)) return [];
|
|
2396
2406
|
if (i == null || i.length === 0)
|
|
2397
|
-
return a.textRuns = [], o.syncExecuteCommand(
|
|
2407
|
+
return a.textRuns = [], o.syncExecuteCommand(Ln.id, {
|
|
2398
2408
|
unitId: g,
|
|
2399
|
-
body:
|
|
2409
|
+
body: On(a, 0, a.dataStream.length - 2)
|
|
2400
2410
|
}), [];
|
|
2401
2411
|
{
|
|
2402
|
-
const { textRuns:
|
|
2403
|
-
r &&
|
|
2412
|
+
const { textRuns: S, refSelections: m } = nc(t, n, i);
|
|
2413
|
+
r && S.forEach((_) => {
|
|
2404
2414
|
_.ed = _.ed + r, _.st = _.st + r;
|
|
2405
|
-
}), a.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...
|
|
2415
|
+
}), a.textRuns = [{ st: 0, ed: 1, ts: { fs: 11 } }, ...S];
|
|
2406
2416
|
const p = i.reduce((_, R) => typeof R == "string" ? `${_}${R}` : `${_}${R.token}`, "");
|
|
2407
2417
|
a.dataStream = `${e}${p}\r
|
|
2408
2418
|
`;
|
|
@@ -2414,17 +2424,17 @@ function Fr(e = "") {
|
|
|
2414
2424
|
R.startOffset = Math.max(0, Math.min(R.startOffset, _)), R.endOffset = Math.max(0, Math.min(R.endOffset, _));
|
|
2415
2425
|
});
|
|
2416
2426
|
}
|
|
2417
|
-
return o.syncExecuteCommand(
|
|
2427
|
+
return o.syncExecuteCommand(Ln.id, {
|
|
2418
2428
|
unitId: g,
|
|
2419
|
-
body:
|
|
2429
|
+
body: On(a, 0, a.dataStream.length - 2),
|
|
2420
2430
|
textRanges: f != null ? f : C
|
|
2421
2431
|
}), m;
|
|
2422
2432
|
}
|
|
2423
2433
|
});
|
|
2424
2434
|
}
|
|
2425
2435
|
function tc() {
|
|
2426
|
-
const e =
|
|
2427
|
-
return
|
|
2436
|
+
const e = y(It), t = e.getCurrentTheme();
|
|
2437
|
+
return ie(() => {
|
|
2428
2438
|
const o = [
|
|
2429
2439
|
e.getColorFromTheme("loop-color.1"),
|
|
2430
2440
|
e.getColorFromTheme("loop-color.2"),
|
|
@@ -2448,10 +2458,10 @@ function nc(e, t, n) {
|
|
|
2448
2458
|
for (let g = 0, u = n.length; g < u; g++) {
|
|
2449
2459
|
const d = n[g];
|
|
2450
2460
|
if (typeof d == "string") {
|
|
2451
|
-
const _ = i[i.length - 1], R = _ ? _.ed : 0,
|
|
2461
|
+
const _ = i[i.length - 1], R = _ ? _.ed : 0, v = R + d.length;
|
|
2452
2462
|
i.push({
|
|
2453
2463
|
st: R,
|
|
2454
|
-
ed:
|
|
2464
|
+
ed: v,
|
|
2455
2465
|
ts: {
|
|
2456
2466
|
cl: {
|
|
2457
2467
|
rgb: c
|
|
@@ -2474,7 +2484,7 @@ function nc(e, t, n) {
|
|
|
2474
2484
|
});
|
|
2475
2485
|
continue;
|
|
2476
2486
|
}
|
|
2477
|
-
const { startIndex: a, endIndex:
|
|
2487
|
+
const { startIndex: a, endIndex: S, nodeType: m, token: p } = d;
|
|
2478
2488
|
let C = "";
|
|
2479
2489
|
if (m === X.REFERENCE) {
|
|
2480
2490
|
if (f.has(p))
|
|
@@ -2494,7 +2504,7 @@ function nc(e, t, n) {
|
|
|
2494
2504
|
} else m === X.NUMBER ? C = r : (m === X.STRING || m === X.ARRAY) && (C = s);
|
|
2495
2505
|
C && C.length > 0 ? i.push({
|
|
2496
2506
|
st: a,
|
|
2497
|
-
ed:
|
|
2507
|
+
ed: S + 1,
|
|
2498
2508
|
ts: {
|
|
2499
2509
|
cl: {
|
|
2500
2510
|
rgb: C
|
|
@@ -2503,7 +2513,7 @@ function nc(e, t, n) {
|
|
|
2503
2513
|
}
|
|
2504
2514
|
}) : i.push({
|
|
2505
2515
|
st: a,
|
|
2506
|
-
ed:
|
|
2516
|
+
ed: S + 1,
|
|
2507
2517
|
ts: {
|
|
2508
2518
|
cl: {
|
|
2509
2519
|
rgb: c
|
|
@@ -2515,48 +2525,48 @@ function nc(e, t, n) {
|
|
|
2515
2525
|
return { textRuns: i, refSelections: l };
|
|
2516
2526
|
}
|
|
2517
2527
|
const rc = (e, t, n, o) => {
|
|
2518
|
-
const r =
|
|
2528
|
+
const r = y(fe), s = y(Gt), c = z(t);
|
|
2519
2529
|
c.current = t;
|
|
2520
2530
|
const i = z(o);
|
|
2521
2531
|
i.current = o, $(() => {
|
|
2522
2532
|
if (!n || !e)
|
|
2523
2533
|
return;
|
|
2524
|
-
const f = `sheet.formula-embedding-editor.${n.getEditorId()}`, h = new He(), g = (a,
|
|
2534
|
+
const f = `sheet.formula-embedding-editor.${n.getEditorId()}`, h = new He(), g = (a, S) => {
|
|
2525
2535
|
if (i.current) {
|
|
2526
|
-
i.current(a,
|
|
2536
|
+
i.current(a, S);
|
|
2527
2537
|
return;
|
|
2528
2538
|
}
|
|
2529
2539
|
let m = le.LEFT;
|
|
2530
|
-
a === L.ARROW_DOWN ? m = le.DOWN : a === L.ARROW_UP ? m = le.UP : a === L.ARROW_RIGHT && (m = le.RIGHT),
|
|
2540
|
+
a === L.ARROW_DOWN ? m = le.DOWN : a === L.ARROW_UP ? m = le.UP : a === L.ARROW_RIGHT && (m = le.RIGHT), S === P.SHIFT ? r.executeCommand(qo.id, {
|
|
2531
2541
|
direction: m
|
|
2532
2542
|
}) : r.executeCommand(Ko.id, {
|
|
2533
2543
|
direction: m
|
|
2534
2544
|
});
|
|
2535
|
-
}, u = (a,
|
|
2545
|
+
}, u = (a, S) => {
|
|
2536
2546
|
let m = le.DOWN;
|
|
2537
|
-
a === L.ARROW_DOWN ? m = le.DOWN : a === L.ARROW_UP ? m = le.UP : a === L.ARROW_LEFT ? m = le.LEFT : a === L.ARROW_RIGHT && (m = le.RIGHT), c.current ?
|
|
2547
|
+
a === L.ARROW_DOWN ? m = le.DOWN : a === L.ARROW_UP ? m = le.UP : a === L.ARROW_LEFT ? m = le.LEFT : a === L.ARROW_RIGHT && (m = le.RIGHT), c.current ? S === P.CTRL_COMMAND ? r.executeCommand(kn.id, {
|
|
2538
2548
|
direction: m,
|
|
2539
|
-
jumpOver:
|
|
2549
|
+
jumpOver: An.moveGap,
|
|
2540
2550
|
extra: "formula-editor",
|
|
2541
2551
|
fromCurrentSelection: c.current === Fe.NEED_ADD || c.current === Fe.EDIT_OTHER_SHEET_REFERENCE
|
|
2542
|
-
}) :
|
|
2552
|
+
}) : S === P.SHIFT ? r.executeCommand(Fn.id, {
|
|
2543
2553
|
direction: m,
|
|
2544
2554
|
extra: "formula-editor"
|
|
2545
|
-
}) :
|
|
2555
|
+
}) : S === (P.CTRL_COMMAND | P.SHIFT) ? r.executeCommand(Fn.id, {
|
|
2546
2556
|
direction: m,
|
|
2547
|
-
jumpOver:
|
|
2557
|
+
jumpOver: An.moveGap,
|
|
2548
2558
|
extra: "formula-editor"
|
|
2549
|
-
}) : r.executeCommand(
|
|
2559
|
+
}) : r.executeCommand(kn.id, {
|
|
2550
2560
|
direction: m,
|
|
2551
2561
|
extra: "formula-editor",
|
|
2552
2562
|
fromCurrentSelection: c.current === Fe.NEED_ADD || c.current === Fe.EDIT_OTHER_SHEET_REFERENCE
|
|
2553
|
-
}) : g(a,
|
|
2563
|
+
}) : g(a, S);
|
|
2554
2564
|
};
|
|
2555
2565
|
return h.add(r.registerCommand({
|
|
2556
2566
|
id: f,
|
|
2557
2567
|
type: Te.OPERATION,
|
|
2558
|
-
handler(a,
|
|
2559
|
-
const { keyCode: m, metaKey: p } =
|
|
2568
|
+
handler(a, S) {
|
|
2569
|
+
const { keyCode: m, metaKey: p } = S;
|
|
2560
2570
|
u(m, p);
|
|
2561
2571
|
}
|
|
2562
2572
|
})), [
|
|
@@ -2576,15 +2586,15 @@ const rc = (e, t, n, o) => {
|
|
|
2576
2586
|
{ keyCode: L.ARROW_LEFT, metaKey: P.CTRL_COMMAND | P.SHIFT },
|
|
2577
2587
|
{ keyCode: L.ARROW_RIGHT, metaKey: P.CTRL_COMMAND | P.SHIFT },
|
|
2578
2588
|
{ keyCode: L.ARROW_UP, metaKey: P.CTRL_COMMAND | P.SHIFT }
|
|
2579
|
-
].map(({ keyCode: a, metaKey:
|
|
2589
|
+
].map(({ keyCode: a, metaKey: S }) => ({
|
|
2580
2590
|
id: f,
|
|
2581
|
-
binding:
|
|
2591
|
+
binding: S ? a | S : a,
|
|
2582
2592
|
preconditions: () => !0,
|
|
2583
2593
|
priority: 900,
|
|
2584
2594
|
staticParameters: {
|
|
2585
2595
|
eventType: xe.Keyboard,
|
|
2586
2596
|
keyCode: a,
|
|
2587
|
-
metaKey:
|
|
2597
|
+
metaKey: S
|
|
2588
2598
|
}
|
|
2589
2599
|
})).forEach((a) => {
|
|
2590
2600
|
h.add(s.registerShortcut(a));
|
|
@@ -2594,7 +2604,7 @@ const rc = (e, t, n, o) => {
|
|
|
2594
2604
|
}, [r, n, e, s]);
|
|
2595
2605
|
}, oc = (e, t, n, o = !0) => {
|
|
2596
2606
|
var u;
|
|
2597
|
-
const r =
|
|
2607
|
+
const r = y(Oe), s = y(an), c = y(hs), i = y(Kt), l = y(te), f = ve(ie(() => l.getCurrentTypeOfUnit$(q.UNIVER_SHEET), [l])), h = r.getRenderById((u = f == null ? void 0 : f.getUnitId()) != null ? u : ""), g = h == null ? void 0 : h.with(Le);
|
|
2598
2608
|
$t(() => {
|
|
2599
2609
|
if (e)
|
|
2600
2610
|
return s.setContextValue(wt, !0), () => {
|
|
@@ -2603,8 +2613,8 @@ const rc = (e, t, n, o) => {
|
|
|
2603
2613
|
}, [s, e, i]), $t(() => {
|
|
2604
2614
|
if (e && t) {
|
|
2605
2615
|
const d = g == null ? void 0 : g.enableSelectionChanging();
|
|
2606
|
-
return s.setContextValue(
|
|
2607
|
-
s.setContextValue(
|
|
2616
|
+
return s.setContextValue(Un, !0), () => {
|
|
2617
|
+
s.setContextValue(Un, !1), d == null || d.dispose();
|
|
2608
2618
|
};
|
|
2609
2619
|
}
|
|
2610
2620
|
}, [s, e, g, t]), $(() => {
|
|
@@ -2616,7 +2626,7 @@ const rc = (e, t, n, o) => {
|
|
|
2616
2626
|
e && (g == null || g.setSkipLastEnabled(!1));
|
|
2617
2627
|
}, [e, g]);
|
|
2618
2628
|
}, sc = (e, t, n) => {
|
|
2619
|
-
const o =
|
|
2629
|
+
const o = y(te), r = y(fn);
|
|
2620
2630
|
return Lt(() => {
|
|
2621
2631
|
if (e) {
|
|
2622
2632
|
const c = [...r.getWorkbookSelections(t).getSelectionsOfWorksheet(n)], i = o.getCurrentUnitForType(q.UNIVER_SHEET), l = i == null ? void 0 : i.getActiveSheet();
|
|
@@ -2629,7 +2639,7 @@ const rc = (e, t, n, o) => {
|
|
|
2629
2639
|
if ((o == null ? void 0 : o.length) !== 1)
|
|
2630
2640
|
return;
|
|
2631
2641
|
const s = o[0].startOffset - 1, c = ((g = (h = t == null ? void 0 : t.getDocumentData().body) == null ? void 0 : h.dataStream) != null ? g : `\r
|
|
2632
|
-
`).slice(0, -2), i = (u = n.sequenceNodesBuilder(c.slice(1))) != null ? u : [], l =
|
|
2642
|
+
`).slice(0, -2), i = (u = n.sequenceNodesBuilder(c.slice(1))) != null ? u : [], l = _n(i, s, !1), f = wr(i, l);
|
|
2633
2643
|
return {
|
|
2634
2644
|
nodeIndex: l,
|
|
2635
2645
|
updatingRefIndex: f,
|
|
@@ -2639,12 +2649,12 @@ const rc = (e, t, n, o) => {
|
|
|
2639
2649
|
}, ac = () => {
|
|
2640
2650
|
}, lc = (e, t, n, o, r, s, c, i, l, f = ac) => {
|
|
2641
2651
|
var k;
|
|
2642
|
-
const h =
|
|
2652
|
+
const h = y(Oe), g = y(te), u = y(fe), d = y(mr), a = y(It), S = y(Ie), m = g.getUnit(o), p = J((w, b) => {
|
|
2643
2653
|
var I, E, M;
|
|
2644
2654
|
return (M = (E = (I = g.getUnit(w)) == null ? void 0 : I.getSheetBySheetId(b)) == null ? void 0 : E.getName()) != null ? M : "";
|
|
2645
|
-
}), C =
|
|
2646
|
-
var H, ce, Y, Ee, Je,
|
|
2647
|
-
const I = cc({ editor: l, lexerTreeBuilder:
|
|
2655
|
+
}), C = ie(() => p(o, r), [p, r, o]), _ = ve(m == null ? void 0 : m.activeSheet$), R = Qe({ activeSheet: _, sheetName: C }), v = ve(ie(() => g.getCurrentTypeOfUnit$(q.UNIVER_SHEET), [g])), O = h.getRenderById((k = v == null ? void 0 : v.getUnitId()) != null ? k : ""), N = O == null ? void 0 : O.with(Le), A = O == null ? void 0 : O.with(qt), F = y(Kt), T = J((w, b) => {
|
|
2656
|
+
var H, ce, Y, Ee, Je, re, yt, et, Tt;
|
|
2657
|
+
const I = cc({ editor: l, lexerTreeBuilder: S });
|
|
2648
2658
|
if (!I) return;
|
|
2649
2659
|
const { nodeIndex: E, updatingRefIndex: M, sequenceNodes: D, offset: U } = I;
|
|
2650
2660
|
if (n.current === Fe.NEED_ADD)
|
|
@@ -2653,18 +2663,18 @@ const rc = (e, t, n, o) => {
|
|
|
2653
2663
|
return;
|
|
2654
2664
|
const B = w[w.length - 1], ee = D.splice(E + 1), ge = (H = B.sheetId) != null ? H : r, Se = {
|
|
2655
2665
|
range: B,
|
|
2656
|
-
unitId: (ce = B.unitId) != null ? ce :
|
|
2657
|
-
sheetName: p((Y = B.unitId) != null ? Y :
|
|
2658
|
-
}, ue = ge !== r, Q = (
|
|
2666
|
+
unitId: (ce = B.unitId) != null ? ce : v.getUnitId(),
|
|
2667
|
+
sheetName: p((Y = B.unitId) != null ? Y : v.getUnitId(), ge)
|
|
2668
|
+
}, ue = ge !== r, Q = (v == null ? void 0 : v.getUnitId()) !== o, Ce = At([Se], c && (ue || Q), C, Q);
|
|
2659
2669
|
D.push({ token: Ce[0], nodeType: X.REFERENCE });
|
|
2660
2670
|
const ft = [...D, ...ee], Me = cn(ft);
|
|
2661
2671
|
f(Me, ic(D), b);
|
|
2662
2672
|
} else {
|
|
2663
2673
|
const B = w[w.length - 1], ee = (Ee = B.sheetId) != null ? Ee : r, ge = {
|
|
2664
2674
|
range: B,
|
|
2665
|
-
unitId: (Je = B.unitId) != null ? Je :
|
|
2666
|
-
sheetName: p((
|
|
2667
|
-
}, Se = ee !== r, ue = (
|
|
2675
|
+
unitId: (Je = B.unitId) != null ? Je : v.getUnitId(),
|
|
2676
|
+
sheetName: p((re = B.unitId) != null ? re : v.getUnitId(), ee)
|
|
2677
|
+
}, Se = ee !== r, ue = (v == null ? void 0 : v.getUnitId()) !== o, Q = At([ge], c && (Se || ue), C, ue);
|
|
2668
2678
|
D.unshift({ token: Q[0], nodeType: X.REFERENCE });
|
|
2669
2679
|
const Ce = cn(D);
|
|
2670
2680
|
f(Ce, Q[0].length, b);
|
|
@@ -2687,22 +2697,22 @@ const rc = (e, t, n, o) => {
|
|
|
2687
2697
|
}
|
|
2688
2698
|
let ee = 0;
|
|
2689
2699
|
const ge = D.map((G) => {
|
|
2690
|
-
var de, we,
|
|
2700
|
+
var de, we, tt, $e;
|
|
2691
2701
|
if (typeof G == "string")
|
|
2692
2702
|
return G;
|
|
2693
2703
|
if (G.nodeType === X.REFERENCE) {
|
|
2694
|
-
const me =
|
|
2704
|
+
const me = ut(G.token);
|
|
2695
2705
|
if (me.sheetName || (me.sheetName = C), c && ((de = R.current.activeSheet) == null ? void 0 : de.getName()) !== me.sheetName)
|
|
2696
2706
|
return G.token;
|
|
2697
|
-
const
|
|
2698
|
-
if (ee++, !
|
|
2707
|
+
const oe = B[ee];
|
|
2708
|
+
if (ee++, !oe)
|
|
2699
2709
|
return "";
|
|
2700
|
-
const gt = (we =
|
|
2701
|
-
range:
|
|
2702
|
-
unitId: (
|
|
2703
|
-
sheetName: p(($e =
|
|
2704
|
-
}, xt = (
|
|
2705
|
-
return At([
|
|
2710
|
+
const gt = (we = oe.sheetId) != null ? we : r, Xt = {
|
|
2711
|
+
range: oe,
|
|
2712
|
+
unitId: (tt = oe.unitId) != null ? tt : v.getUnitId(),
|
|
2713
|
+
sheetName: p(($e = oe.unitId) != null ? $e : v.getUnitId(), gt)
|
|
2714
|
+
}, xt = (v == null ? void 0 : v.getUnitId()) !== o;
|
|
2715
|
+
return At([Xt], c && (gt !== r || xt), C, xt)[0];
|
|
2706
2716
|
}
|
|
2707
2717
|
return G.token;
|
|
2708
2718
|
});
|
|
@@ -2712,12 +2722,12 @@ const rc = (e, t, n, o) => {
|
|
|
2712
2722
|
});
|
|
2713
2723
|
const Q = [];
|
|
2714
2724
|
for (let G = ee; G <= w.length - 1; G++) {
|
|
2715
|
-
const de = w[G], we = (yt = de.sheetId) != null ? yt : r,
|
|
2725
|
+
const de = w[G], we = (yt = de.sheetId) != null ? yt : r, tt = {
|
|
2716
2726
|
range: de,
|
|
2717
|
-
unitId: (
|
|
2718
|
-
sheetName: p((Tt = de.unitId) != null ? Tt :
|
|
2719
|
-
}, $e = (
|
|
2720
|
-
Q.push(
|
|
2727
|
+
unitId: (et = de.unitId) != null ? et : v.getUnitId(),
|
|
2728
|
+
sheetName: p((Tt = de.unitId) != null ? Tt : v.getUnitId(), we)
|
|
2729
|
+
}, $e = (v == null ? void 0 : v.getUnitId()) !== o, oe = At([tt], c && (we !== r || $e), C, $e);
|
|
2730
|
+
Q.push(oe[0]);
|
|
2721
2731
|
}
|
|
2722
2732
|
const Ce = D[D.length - 1], ft = Ce && (typeof Ce == "string" ? !1 : Ce.nodeType === X.REFERENCE), Me = `${Se}${Q.length && ft ? "," : ""}${Q.join(",")}`;
|
|
2723
2733
|
f(Me, !Q.length && ue ? ue : Me.length, b);
|
|
@@ -2731,7 +2741,7 @@ const rc = (e, t, n, o) => {
|
|
|
2731
2741
|
w = !1;
|
|
2732
2742
|
return;
|
|
2733
2743
|
}
|
|
2734
|
-
|
|
2744
|
+
T(E.map((D) => D.rangeWithCoord), M);
|
|
2735
2745
|
}, I = new He();
|
|
2736
2746
|
return I.add(N.selectionMoving$.subscribe((E) => {
|
|
2737
2747
|
b(E, !1);
|
|
@@ -2741,19 +2751,19 @@ const rc = (e, t, n, o) => {
|
|
|
2741
2751
|
I.dispose();
|
|
2742
2752
|
};
|
|
2743
2753
|
}
|
|
2744
|
-
}, [e,
|
|
2754
|
+
}, [e, T, N]), $(() => {
|
|
2745
2755
|
if (t && N && l) {
|
|
2746
2756
|
const w = new He(), b = () => {
|
|
2747
2757
|
w.dispose(), N.getSelectionControls().forEach((M, D) => {
|
|
2748
2758
|
w.add(
|
|
2749
2759
|
M.selectionScaling$.subscribe((U) => {
|
|
2750
2760
|
const H = N.getSelectionDataWithStyle().map((Y) => Y.rangeWithCoord), ce = H[D];
|
|
2751
|
-
U.sheetId = ce.sheetId, U.unitId = ce.unitId, H[D] = U,
|
|
2761
|
+
U.sheetId = ce.sheetId, U.unitId = ce.unitId, H[D] = U, T(H, !1);
|
|
2752
2762
|
})
|
|
2753
2763
|
), w.add(
|
|
2754
2764
|
M.selectionMoving$.subscribe((U) => {
|
|
2755
2765
|
const H = N.getSelectionDataWithStyle().map((Y) => Y.rangeWithCoord), ce = H[D];
|
|
2756
|
-
U.sheetId = ce.sheetId, U.unitId = ce.unitId, H[D] = U,
|
|
2766
|
+
U.sheetId = ce.sheetId, U.unitId = ce.unitId, H[D] = U, T(H, !0);
|
|
2757
2767
|
})
|
|
2758
2768
|
);
|
|
2759
2769
|
});
|
|
@@ -2770,7 +2780,7 @@ const rc = (e, t, n, o) => {
|
|
|
2770
2780
|
I.unsubscribe(), w.dispose();
|
|
2771
2781
|
};
|
|
2772
2782
|
}
|
|
2773
|
-
}, [l, t,
|
|
2783
|
+
}, [l, t, T, N, F.selectionSet$]), N == null || N.getSelectionDataWithStyle(), $(() => {
|
|
2774
2784
|
if (i) {
|
|
2775
2785
|
const w = u.onCommandExecuted((b) => {
|
|
2776
2786
|
var E;
|
|
@@ -2781,7 +2791,7 @@ const rc = (e, t, n, o) => {
|
|
|
2781
2791
|
const M = I.selections[I.selections.length - 1];
|
|
2782
2792
|
if (M) {
|
|
2783
2793
|
const D = n.current === Fe.NEED_ADD, U = ((E = N == null ? void 0 : N.getSelectionDataWithStyle()) != null ? E : []).map((H) => H.rangeWithCoord);
|
|
2784
|
-
D ? U.push(M.range) : U[U.length - 1] = M.range,
|
|
2794
|
+
D ? U.push(M.range) : U[U.length - 1] = M.range, T(U, !0);
|
|
2785
2795
|
}
|
|
2786
2796
|
}
|
|
2787
2797
|
});
|
|
@@ -2789,7 +2799,7 @@ const rc = (e, t, n, o) => {
|
|
|
2789
2799
|
w.dispose();
|
|
2790
2800
|
};
|
|
2791
2801
|
}
|
|
2792
|
-
}, [u, l, n,
|
|
2802
|
+
}, [u, l, n, S, i, T, N]), $(() => {
|
|
2793
2803
|
if (!l)
|
|
2794
2804
|
return;
|
|
2795
2805
|
const w = d.textSelection$.subscribe((b) => {
|
|
@@ -2803,26 +2813,26 @@ const rc = (e, t, n, o) => {
|
|
|
2803
2813
|
sheetSkeletonManagerService: A,
|
|
2804
2814
|
themeService: a,
|
|
2805
2815
|
univerInstanceService: g,
|
|
2806
|
-
currentWorkbook:
|
|
2816
|
+
currentWorkbook: v
|
|
2807
2817
|
});
|
|
2808
2818
|
});
|
|
2809
2819
|
return () => w.unsubscribe();
|
|
2810
2820
|
}, [d.textSelection$, l, s, N, F, A, r, a, o, g]);
|
|
2811
2821
|
}, uc = (e, t, n, o, r, s) => {
|
|
2812
|
-
const c =
|
|
2822
|
+
const c = y(fe), i = y(je), f = y(Oe).getRenderById(t), h = y(te), g = f == null ? void 0 : f.with(Le);
|
|
2813
2823
|
$(() => {
|
|
2814
2824
|
if (e && g)
|
|
2815
2825
|
if (n) {
|
|
2816
2826
|
const u = () => {
|
|
2817
|
-
const
|
|
2818
|
-
for (let m = 1; m <=
|
|
2827
|
+
const S = g.getSelectionControls().length;
|
|
2828
|
+
for (let m = 1; m <= S; m++)
|
|
2819
2829
|
g.clearLastSelection();
|
|
2820
2830
|
return setTimeout(() => {
|
|
2821
2831
|
s();
|
|
2822
2832
|
}, 30);
|
|
2823
|
-
}, d = c.onCommandExecuted((
|
|
2824
|
-
|
|
2825
|
-
}), a = h.getCurrentTypeOfUnit$(q.UNIVER_SHEET).subscribe((
|
|
2833
|
+
}, d = c.onCommandExecuted((S) => {
|
|
2834
|
+
S.id === Vn.id && u();
|
|
2835
|
+
}), a = h.getCurrentTypeOfUnit$(q.UNIVER_SHEET).subscribe((S) => {
|
|
2826
2836
|
u();
|
|
2827
2837
|
});
|
|
2828
2838
|
return () => {
|
|
@@ -2830,7 +2840,7 @@ const rc = (e, t, n, o) => {
|
|
|
2830
2840
|
};
|
|
2831
2841
|
} else {
|
|
2832
2842
|
const u = c.beforeCommandExecuted((d) => {
|
|
2833
|
-
if (d.id ===
|
|
2843
|
+
if (d.id === Vn.id) {
|
|
2834
2844
|
o(!1), r(), s();
|
|
2835
2845
|
const a = i.getEditor(ln);
|
|
2836
2846
|
a == null || a.focus();
|
|
@@ -2842,7 +2852,7 @@ const rc = (e, t, n, o) => {
|
|
|
2842
2852
|
}
|
|
2843
2853
|
}, [e, g]);
|
|
2844
2854
|
}, dc = (e, t, n) => {
|
|
2845
|
-
const o =
|
|
2855
|
+
const o = y(Ie), r = z(!0);
|
|
2846
2856
|
$(() => {
|
|
2847
2857
|
if (e) {
|
|
2848
2858
|
const s = setTimeout(() => {
|
|
@@ -2855,11 +2865,11 @@ const rc = (e, t, n, o) => {
|
|
|
2855
2865
|
}, [e]), $(() => {
|
|
2856
2866
|
if (!r.current && t) {
|
|
2857
2867
|
const s = o.checkIfAddBracket(n);
|
|
2858
|
-
t(s === 0 && n.startsWith(
|
|
2868
|
+
t(s === 0 && n.startsWith(sr.EQUALS), `${n}`);
|
|
2859
2869
|
}
|
|
2860
2870
|
}, [n, t]);
|
|
2861
2871
|
}, hc = (e, t = [], n) => {
|
|
2862
|
-
const o =
|
|
2872
|
+
const o = y(Yt), [r, s] = V([]), [c, i] = V(""), l = z(-1), f = Qe({ nodes: t }), h = () => {
|
|
2863
2873
|
s([]), i(""), l.current = -1;
|
|
2864
2874
|
};
|
|
2865
2875
|
return $(() => {
|
|
@@ -2867,9 +2877,9 @@ const rc = (e, t, n, o) => {
|
|
|
2867
2877
|
const u = n.input$.pipe(hn(300)).subscribe(() => {
|
|
2868
2878
|
const d = n.getSelectionRanges();
|
|
2869
2879
|
if (d.length === 1) {
|
|
2870
|
-
const a = f.current.nodes,
|
|
2871
|
-
if (
|
|
2872
|
-
const m =
|
|
2880
|
+
const a = f.current.nodes, S = d[0];
|
|
2881
|
+
if (S.collapsed) {
|
|
2882
|
+
const m = _n(a, S.startOffset - 1, !1);
|
|
2873
2883
|
l.current = m;
|
|
2874
2884
|
const p = a[m];
|
|
2875
2885
|
if (p && typeof p != "string" && p.nodeType === X.FUNCTION) {
|
|
@@ -2894,9 +2904,9 @@ const rc = (e, t, n, o) => {
|
|
|
2894
2904
|
handlerFormulaReplace: (u) => {
|
|
2895
2905
|
const d = [...f.current.nodes];
|
|
2896
2906
|
if (l.current !== -1) {
|
|
2897
|
-
const a = d.splice(l.current + 1),
|
|
2898
|
-
let m = (typeof
|
|
2899
|
-
return d.push(u), a[0] !==
|
|
2907
|
+
const a = d.splice(l.current + 1), S = d.pop() || "";
|
|
2908
|
+
let m = (typeof S == "string" ? S.length : S.token.length) - u.length;
|
|
2909
|
+
return d.push(u), a[0] !== it.OPEN_BRACKET && (d.push(it.OPEN_BRACKET), m--), { text: cn([...d, ...a]), offset: m };
|
|
2900
2910
|
}
|
|
2901
2911
|
},
|
|
2902
2912
|
reset: h
|
|
@@ -2904,12 +2914,12 @@ const rc = (e, t, n, o) => {
|
|
|
2904
2914
|
}, fc = () => {
|
|
2905
2915
|
}, gc = Ne(mc);
|
|
2906
2916
|
function mc(e, t) {
|
|
2907
|
-
const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: c = fc } = e, i = s.getEditorId(), l =
|
|
2908
|
-
const k = u(
|
|
2917
|
+
const { isFocus: n, sequenceNodes: o, onSelect: r, editor: s, onClose: c = fc } = e, i = s.getEditorId(), l = y(Gt), f = y(fe), { searchList: h, searchText: g, handlerFormulaReplace: u, reset: d } = hc(n, o, s), a = ie(() => !!h.length, [h]), S = z(void 0), [m, p] = V(0), C = z(!1), [_] = kr(i, a, [g, h]), R = Qe({ searchList: h, active: m }), v = (T) => {
|
|
2918
|
+
const k = u(T);
|
|
2909
2919
|
k && (d(), r(k));
|
|
2910
2920
|
};
|
|
2911
|
-
function
|
|
2912
|
-
C.current && p(
|
|
2921
|
+
function O(T) {
|
|
2922
|
+
C.current && p(T);
|
|
2913
2923
|
}
|
|
2914
2924
|
function N() {
|
|
2915
2925
|
C.current && p(-1);
|
|
@@ -2917,7 +2927,7 @@ function mc(e, t) {
|
|
|
2917
2927
|
$(() => {
|
|
2918
2928
|
if (!h.length)
|
|
2919
2929
|
return;
|
|
2920
|
-
const
|
|
2930
|
+
const T = `sheet.formula-embedding-editor.search_function.${i}`, k = new He(), w = (b) => {
|
|
2921
2931
|
const { searchList: I, active: E } = R.current;
|
|
2922
2932
|
switch (b) {
|
|
2923
2933
|
case L.ARROW_UP: {
|
|
@@ -2937,7 +2947,7 @@ function mc(e, t) {
|
|
|
2937
2947
|
case L.TAB:
|
|
2938
2948
|
case L.ENTER: {
|
|
2939
2949
|
const M = I[E];
|
|
2940
|
-
|
|
2950
|
+
v(M.name);
|
|
2941
2951
|
break;
|
|
2942
2952
|
}
|
|
2943
2953
|
case L.ESC: {
|
|
@@ -2947,14 +2957,14 @@ function mc(e, t) {
|
|
|
2947
2957
|
}
|
|
2948
2958
|
};
|
|
2949
2959
|
return k.add(f.registerCommand({
|
|
2950
|
-
id:
|
|
2960
|
+
id: T,
|
|
2951
2961
|
type: Te.OPERATION,
|
|
2952
2962
|
handler(b, I) {
|
|
2953
2963
|
const { keyCode: E } = I;
|
|
2954
2964
|
w(E);
|
|
2955
2965
|
}
|
|
2956
2966
|
})), [L.ARROW_UP, L.ARROW_DOWN, L.ENTER, L.ESC, L.TAB].map((b) => ({
|
|
2957
|
-
id:
|
|
2967
|
+
id: T,
|
|
2958
2968
|
binding: b,
|
|
2959
2969
|
preconditions: () => !0,
|
|
2960
2970
|
priority: 1e3,
|
|
@@ -2968,10 +2978,10 @@ function mc(e, t) {
|
|
|
2968
2978
|
k.dispose();
|
|
2969
2979
|
};
|
|
2970
2980
|
}, [h]);
|
|
2971
|
-
function A(
|
|
2972
|
-
const k =
|
|
2981
|
+
function A(T) {
|
|
2982
|
+
const k = S.current;
|
|
2973
2983
|
if (!k) return;
|
|
2974
|
-
const w = k.children[
|
|
2984
|
+
const w = k.children[T];
|
|
2975
2985
|
if (!w) return;
|
|
2976
2986
|
const I = k.getBoundingClientRect().top, E = k.offsetHeight, M = w.getBoundingClientRect(), D = M.top, U = M.height;
|
|
2977
2987
|
if (D >= 0 && D > I && D - I + U <= E)
|
|
@@ -2982,56 +2992,56 @@ function mc(e, t) {
|
|
|
2982
2992
|
behavior: "smooth"
|
|
2983
2993
|
});
|
|
2984
2994
|
}
|
|
2985
|
-
const F =
|
|
2986
|
-
let
|
|
2995
|
+
const F = ie(() => {
|
|
2996
|
+
let T = "";
|
|
2987
2997
|
return () => {
|
|
2988
|
-
clearTimeout(
|
|
2998
|
+
clearTimeout(T), C.current = !0, T = setTimeout(() => {
|
|
2989
2999
|
C.current = !1;
|
|
2990
3000
|
}, 300);
|
|
2991
3001
|
};
|
|
2992
3002
|
}, []);
|
|
2993
|
-
return h.length > 0 && a && /* @__PURE__ */
|
|
3003
|
+
return h.length > 0 && a && /* @__PURE__ */ x(rn, { portal: !0, anchorRect$: _, direction: "vertical", children: /* @__PURE__ */ x(
|
|
2994
3004
|
"ul",
|
|
2995
3005
|
{
|
|
2996
|
-
ref: (
|
|
2997
|
-
|
|
3006
|
+
ref: (T) => {
|
|
3007
|
+
S.current = T, t && (t.current = T);
|
|
2998
3008
|
},
|
|
2999
3009
|
"data-u-comp": "sheets-formula-editor",
|
|
3000
|
-
className:
|
|
3001
|
-
children: h.map((
|
|
3010
|
+
className: ne("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", vn, ct),
|
|
3011
|
+
children: h.map((T, k) => /* @__PURE__ */ W(
|
|
3002
3012
|
"li",
|
|
3003
3013
|
{
|
|
3004
|
-
className:
|
|
3014
|
+
className: ne("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", {
|
|
3005
3015
|
"univer-bg-gray-200 dark:!univer-bg-gray-600": m === k
|
|
3006
3016
|
}),
|
|
3007
|
-
onMouseEnter: () =>
|
|
3017
|
+
onMouseEnter: () => O(k),
|
|
3008
3018
|
onMouseLeave: N,
|
|
3009
3019
|
onMouseMove: F,
|
|
3010
3020
|
onClick: () => {
|
|
3011
|
-
|
|
3021
|
+
v(T.name), s && s.focus();
|
|
3012
3022
|
},
|
|
3013
3023
|
children: [
|
|
3014
3024
|
/* @__PURE__ */ W("span", { className: "univer-text-xs", children: [
|
|
3015
|
-
/* @__PURE__ */
|
|
3016
|
-
/* @__PURE__ */
|
|
3025
|
+
/* @__PURE__ */ x("span", { className: "univer-text-red-500", children: T.name.substring(0, g.length) }),
|
|
3026
|
+
/* @__PURE__ */ x("span", { children: T.name.slice(g.length) })
|
|
3017
3027
|
] }),
|
|
3018
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ x(
|
|
3019
3029
|
"span",
|
|
3020
3030
|
{
|
|
3021
3031
|
className: "univer-block univer-text-xs univer-text-gray-400",
|
|
3022
|
-
children:
|
|
3032
|
+
children: T.desc
|
|
3023
3033
|
}
|
|
3024
3034
|
)
|
|
3025
3035
|
]
|
|
3026
3036
|
},
|
|
3027
|
-
|
|
3037
|
+
T.name
|
|
3028
3038
|
))
|
|
3029
3039
|
}
|
|
3030
3040
|
) });
|
|
3031
3041
|
}
|
|
3032
|
-
const pc = (e) => e.startsWith(
|
|
3042
|
+
const pc = (e) => e.startsWith(sr.EQUALS) ? e.slice(1) : "", Zn = () => {
|
|
3033
3043
|
}, vc = Ne((e, t) => {
|
|
3034
|
-
var
|
|
3044
|
+
var En, bn;
|
|
3035
3045
|
const {
|
|
3036
3046
|
errorText: n,
|
|
3037
3047
|
initValue: o,
|
|
@@ -3039,63 +3049,63 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3039
3049
|
subUnitId: s,
|
|
3040
3050
|
isFocus: c = !0,
|
|
3041
3051
|
isSupportAcrossSheet: i = !1,
|
|
3042
|
-
onFocus: l =
|
|
3043
|
-
onBlur: f =
|
|
3052
|
+
onFocus: l = Zn,
|
|
3053
|
+
onBlur: f = Zn,
|
|
3044
3054
|
onChange: h,
|
|
3045
3055
|
onVerify: g,
|
|
3046
3056
|
className: u,
|
|
3047
3057
|
editorId: d,
|
|
3048
3058
|
moveCursor: a = !0,
|
|
3049
|
-
onFormulaSelectingChange:
|
|
3059
|
+
onFormulaSelectingChange: S,
|
|
3050
3060
|
keyboardEventConfig: m,
|
|
3051
3061
|
onMoveInEditor: p,
|
|
3052
3062
|
resetSelectionOnBlur: C = !0,
|
|
3053
3063
|
autoScrollbar: _ = !0,
|
|
3054
3064
|
isSingle: R = !0,
|
|
3055
|
-
disableSelectionOnClick:
|
|
3056
|
-
autofocus:
|
|
3065
|
+
disableSelectionOnClick: v = !1,
|
|
3066
|
+
autofocus: O = !0,
|
|
3057
3067
|
disableContextMenu: N,
|
|
3058
3068
|
style: A
|
|
3059
|
-
} = e, F =
|
|
3069
|
+
} = e, F = y(je), T = z(null), k = J(h);
|
|
3060
3070
|
ps(t, () => ({
|
|
3061
|
-
isClickOutSide: (Z) =>
|
|
3071
|
+
isClickOutSide: (Z) => T.current ? !T.current.contains(Z.target) : !1
|
|
3062
3072
|
}));
|
|
3063
|
-
const w = J(
|
|
3073
|
+
const w = J(S), b = z(null), I = z(void 0), E = I.current, [M, D] = V(c), U = z(null), H = ie(() => d != null ? d : Qr(`${bo}-${Jr(4)}`), []), ce = ie(() => n !== void 0, [n]), Y = y(te), Ee = Y.getUnit(H);
|
|
3064
3074
|
ve(Ee == null ? void 0 : Ee.change$);
|
|
3065
|
-
const Je = Qi(),
|
|
3075
|
+
const Je = Qi(), re = eo.transform.getPlainText((bn = (En = Ee == null ? void 0 : Ee.getBody()) == null ? void 0 : En.dataStream) != null ? bn : ""), yt = Qe(re), et = ie(() => pc(re), [re]), Tt = ie(() => Je(et), [et, Je]), { isSelecting: B, isSelectingRef: ee } = Xi({ unitId: r, subUnitId: s, editorId: H, isFocus: M, disableOnClick: v }), ge = z(""), ue = y(Oe).getRenderById(H), Q = ue == null ? void 0 : ue.with(lr), Ce = Q == null ? void 0 : Q.isFocusing, ft = ie(() => Y.getCurrentTypeOfUnit$(q.UNIVER_DOC), [Y]), Me = ve(ft), G = (Me == null ? void 0 : Me.getUnitId()) === H, de = z([]), we = B;
|
|
3066
3076
|
fs(() => {
|
|
3067
|
-
k(
|
|
3068
|
-
}, [
|
|
3069
|
-
const
|
|
3077
|
+
k(re);
|
|
3078
|
+
}, [re, k]);
|
|
3079
|
+
const tt = Fr("="), $e = ec(r, s), me = J((Z, se = !0, ke, be) => {
|
|
3070
3080
|
if (!I.current) return;
|
|
3071
3081
|
ge.current = Z;
|
|
3072
|
-
const Ot = Z[0] === "=" ? Z.slice(1) : "", Ae = Je(Ot), $r = Ae.reduce((Pe, Mt) => typeof Mt == "object" ? `${Pe}${Mt.token}` : `${Pe}${Mt}`, ""), Nt =
|
|
3082
|
+
const Ot = Z[0] === "=" ? Z.slice(1) : "", Ae = Je(Ot), $r = Ae.reduce((Pe, Mt) => typeof Mt == "object" ? `${Pe}${Mt.token}` : `${Pe}${Mt}`, ""), Nt = tt(
|
|
3073
3083
|
I.current,
|
|
3074
3084
|
$r === Ot ? Ae : [],
|
|
3075
|
-
|
|
3085
|
+
se,
|
|
3076
3086
|
be
|
|
3077
3087
|
);
|
|
3078
3088
|
if (de.current = Nt, ke) {
|
|
3079
3089
|
const Pe = be != null ? be : E == null ? void 0 : E.getSelectionRanges();
|
|
3080
3090
|
if ((Pe == null ? void 0 : Pe.length) !== 1)
|
|
3081
3091
|
return;
|
|
3082
|
-
const Pr = Pe[0].startOffset - 1, Ur =
|
|
3083
|
-
if (
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3092
|
+
const Pr = Pe[0].startOffset - 1, Ur = _n(Ae, Pr, !1), yn = wr(Ae, Ur);
|
|
3093
|
+
if (yn >= 0) {
|
|
3094
|
+
const Tn = Nt.splice(yn, 1)[0];
|
|
3095
|
+
Tn && Nt.push(Tn);
|
|
3086
3096
|
}
|
|
3087
3097
|
$e(M ? Nt : [], I.current);
|
|
3088
3098
|
}
|
|
3089
3099
|
});
|
|
3090
3100
|
$(() => {
|
|
3091
|
-
M && me(
|
|
3101
|
+
M && me(re, !1, !0);
|
|
3092
3102
|
}, [M]), $(() => {
|
|
3093
3103
|
if (M) {
|
|
3094
|
-
if (ge.current ===
|
|
3095
|
-
me(
|
|
3104
|
+
if (ge.current === re) return;
|
|
3105
|
+
me(re, !1, !0);
|
|
3096
3106
|
}
|
|
3097
|
-
}, [
|
|
3098
|
-
const
|
|
3107
|
+
}, [re]), dc(M, g, re);
|
|
3108
|
+
const oe = Zi(E), gt = sc(M, r, s);
|
|
3099
3109
|
$(() => {
|
|
3100
3110
|
var Z;
|
|
3101
3111
|
w(B, (Z = Q == null ? void 0 : Q.isFocusing) != null ? Z : !0);
|
|
@@ -3103,7 +3113,7 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3103
3113
|
let Z;
|
|
3104
3114
|
if (U.current) {
|
|
3105
3115
|
Z = F.register({
|
|
3106
|
-
autofocus:
|
|
3116
|
+
autofocus: O,
|
|
3107
3117
|
editorUnitId: H,
|
|
3108
3118
|
initialSnapshot: {
|
|
3109
3119
|
id: H,
|
|
@@ -3118,25 +3128,25 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3118
3128
|
documentStyle: {}
|
|
3119
3129
|
}
|
|
3120
3130
|
}, U.current);
|
|
3121
|
-
const
|
|
3122
|
-
I.current =
|
|
3131
|
+
const se = F.getEditor(H);
|
|
3132
|
+
I.current = se, me(o, !1, !0);
|
|
3123
3133
|
}
|
|
3124
3134
|
return () => {
|
|
3125
3135
|
Z == null || Z.dispose();
|
|
3126
3136
|
};
|
|
3127
3137
|
}, []), $t(() => {
|
|
3128
|
-
c ? (D(c),
|
|
3129
|
-
}, [c, E,
|
|
3130
|
-
const { checkScrollBar:
|
|
3138
|
+
c ? (D(c), oe()) : (C && (E == null || E.blur(), gt()), D(c));
|
|
3139
|
+
}, [c, E, oe, gt, C]);
|
|
3140
|
+
const { checkScrollBar: Xt } = Go(E, R, _);
|
|
3131
3141
|
oc(M, !!(B && G), r, N), rc(!!(M && Ce && a), we, E, p);
|
|
3132
|
-
const xt = J((Z,
|
|
3142
|
+
const xt = J((Z, se, ke) => {
|
|
3133
3143
|
if (!Ce)
|
|
3134
3144
|
return;
|
|
3135
|
-
const be =
|
|
3136
|
-
me(`=${Z}`, !0, ke, be), ke && (
|
|
3137
|
-
const Ot = { startOffset:
|
|
3145
|
+
const be = se !== -1 ? [{ startOffset: se + 1, endOffset: se + 1, collapsed: !0 }] : void 0;
|
|
3146
|
+
me(`=${Z}`, !0, ke, be), ke && (oe(), se !== -1 && setTimeout(() => {
|
|
3147
|
+
const Ot = { startOffset: se + 1, endOffset: se + 1 }, Ae = E == null ? void 0 : E.render.with(Zo);
|
|
3138
3148
|
Ae == null || Ae.scrollToRange({ ...Ot, collapsed: !0 });
|
|
3139
|
-
}, 50),
|
|
3149
|
+
}, 50), Xt());
|
|
3140
3150
|
});
|
|
3141
3151
|
lc(
|
|
3142
3152
|
M && !!(B && G),
|
|
@@ -3152,11 +3162,11 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3152
3162
|
), uc(M && !!(B && G), r, i, D, f, () => {
|
|
3153
3163
|
me(yt.current, !1, !0);
|
|
3154
3164
|
});
|
|
3155
|
-
const
|
|
3165
|
+
const Rn = (Z) => {
|
|
3156
3166
|
if (Z) {
|
|
3157
|
-
const
|
|
3158
|
-
if (
|
|
3159
|
-
const ke =
|
|
3167
|
+
const se = E == null ? void 0 : E.getSelectionRanges();
|
|
3168
|
+
if (se && se.length === 1) {
|
|
3169
|
+
const ke = se[0];
|
|
3160
3170
|
if (ke.collapsed) {
|
|
3161
3171
|
const be = Z.offset;
|
|
3162
3172
|
setTimeout(() => {
|
|
@@ -3164,16 +3174,16 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3164
3174
|
}, 30);
|
|
3165
3175
|
}
|
|
3166
3176
|
}
|
|
3167
|
-
|
|
3177
|
+
oe(), me(`=${Z.text}`);
|
|
3168
3178
|
}
|
|
3169
|
-
},
|
|
3170
|
-
D(!0), l(),
|
|
3179
|
+
}, In = () => {
|
|
3180
|
+
D(!0), l(), oe();
|
|
3171
3181
|
};
|
|
3172
3182
|
return /* @__PURE__ */ W("div", { className: u, children: [
|
|
3173
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ x(
|
|
3174
3184
|
"div",
|
|
3175
3185
|
{
|
|
3176
|
-
className:
|
|
3186
|
+
className: ne(
|
|
3177
3187
|
`
|
|
3178
3188
|
univer-relative univer-box-border univer-flex univer-h-full univer-w-full univer-items-center
|
|
3179
3189
|
univer-justify-around univer-gap-2 univer-rounded-none univer-p-0 univer-ring-1
|
|
@@ -3183,33 +3193,33 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3183
3193
|
"univer-ring-red-500": ce
|
|
3184
3194
|
}
|
|
3185
3195
|
),
|
|
3186
|
-
ref:
|
|
3187
|
-
children: /* @__PURE__ */
|
|
3196
|
+
ref: T,
|
|
3197
|
+
children: /* @__PURE__ */ x(
|
|
3188
3198
|
"div",
|
|
3189
3199
|
{
|
|
3190
3200
|
ref: U,
|
|
3191
3201
|
className: "univer-relative univer-h-full univer-w-full",
|
|
3192
|
-
onMouseUp:
|
|
3202
|
+
onMouseUp: In
|
|
3193
3203
|
}
|
|
3194
3204
|
)
|
|
3195
3205
|
}
|
|
3196
3206
|
),
|
|
3197
|
-
n !== void 0 ? /* @__PURE__ */
|
|
3198
|
-
E ? /* @__PURE__ */
|
|
3207
|
+
n !== void 0 ? /* @__PURE__ */ x("div", { className: "univer-my-1 univer-text-xs univer-text-red-500", children: n }) : null,
|
|
3208
|
+
E && et !== "" ? /* @__PURE__ */ x(
|
|
3199
3209
|
Gi,
|
|
3200
3210
|
{
|
|
3201
3211
|
editor: E,
|
|
3202
3212
|
isFocus: M,
|
|
3203
|
-
formulaText:
|
|
3204
|
-
onClose: () =>
|
|
3213
|
+
formulaText: re,
|
|
3214
|
+
onClose: () => oe()
|
|
3205
3215
|
}
|
|
3206
3216
|
) : null,
|
|
3207
|
-
E ? /* @__PURE__ */
|
|
3217
|
+
E ? /* @__PURE__ */ x(
|
|
3208
3218
|
gc,
|
|
3209
3219
|
{
|
|
3210
3220
|
isFocus: M,
|
|
3211
3221
|
sequenceNodes: Tt,
|
|
3212
|
-
onSelect:
|
|
3222
|
+
onSelect: Rn,
|
|
3213
3223
|
ref: b,
|
|
3214
3224
|
editor: E
|
|
3215
3225
|
}
|
|
@@ -3217,7 +3227,7 @@ const pc = (e) => e.startsWith(ir.EQUALS) ? e.slice(1) : "", zn = () => {
|
|
|
3217
3227
|
] });
|
|
3218
3228
|
});
|
|
3219
3229
|
function Sc(e, t, n, o) {
|
|
3220
|
-
const r =
|
|
3230
|
+
const r = y(Ie), s = Fr(""), c = ve(e == null ? void 0 : e.getDocumentDataModel().change$), [i, l] = V([]), f = y(yo), h = z(""), g = y(te);
|
|
3221
3231
|
return $(() => {
|
|
3222
3232
|
if (!e) return;
|
|
3223
3233
|
const u = e.getDocumentDataModel().getPlainText();
|
|
@@ -3227,7 +3237,7 @@ function Sc(e, t, n, o) {
|
|
|
3227
3237
|
const d = r.sequenceNodesBuilder(u);
|
|
3228
3238
|
l(d != null ? d : []);
|
|
3229
3239
|
}, [c, e, r]), $(() => {
|
|
3230
|
-
var a,
|
|
3240
|
+
var a, S;
|
|
3231
3241
|
if (!e) return;
|
|
3232
3242
|
if (!t) {
|
|
3233
3243
|
const m = e.getDocumentData();
|
|
@@ -3235,7 +3245,7 @@ function Sc(e, t, n, o) {
|
|
|
3235
3245
|
...m,
|
|
3236
3246
|
body: {
|
|
3237
3247
|
...m.body,
|
|
3238
|
-
dataStream: (
|
|
3248
|
+
dataStream: (S = (a = m.body) == null ? void 0 : a.dataStream) != null ? S : "",
|
|
3239
3249
|
textRuns: []
|
|
3240
3250
|
}
|
|
3241
3251
|
});
|
|
@@ -3243,10 +3253,10 @@ function Sc(e, t, n, o) {
|
|
|
3243
3253
|
}
|
|
3244
3254
|
const u = s(e, i, !1), d = new He();
|
|
3245
3255
|
return u.forEach((m) => {
|
|
3246
|
-
const p =
|
|
3256
|
+
const p = ut(m.token), C = g.getCurrentUnitForType(q.UNIVER_SHEET), _ = C == null ? void 0 : C.getActiveSheet();
|
|
3247
3257
|
if (!p.sheetName && o !== (_ == null ? void 0 : _.getSheetId()) || p.sheetName && (_ == null ? void 0 : _.getName()) !== p.sheetName)
|
|
3248
3258
|
return;
|
|
3249
|
-
const R = new un(m.themeColor).toRgb(),
|
|
3259
|
+
const R = new un(m.themeColor).toRgb(), v = f.addShape({
|
|
3250
3260
|
range: p.range,
|
|
3251
3261
|
style: {
|
|
3252
3262
|
stroke: m.themeColor,
|
|
@@ -3255,14 +3265,14 @@ function Sc(e, t, n, o) {
|
|
|
3255
3265
|
},
|
|
3256
3266
|
primary: null
|
|
3257
3267
|
});
|
|
3258
|
-
|
|
3268
|
+
v && d.add(() => f.removeShape(v));
|
|
3259
3269
|
}), () => {
|
|
3260
3270
|
d.dispose();
|
|
3261
3271
|
};
|
|
3262
3272
|
}, [e, t, s, f, i]), { sequenceNodes: i };
|
|
3263
3273
|
}
|
|
3264
3274
|
function Cc(e) {
|
|
3265
|
-
const t =
|
|
3275
|
+
const t = y(fn), { supportAcrossSheet: n = !1, unitId: o, subUnitId: r, onChange: s } = e, i = y(te).getUnit(o, q.UNIVER_SHEET), l = J(s), f = J((h, g) => {
|
|
3266
3276
|
const u = i == null ? void 0 : i.getActiveSheet();
|
|
3267
3277
|
if (!u || !n && u.getSheetId() !== r || !(h != null && h.length)) return;
|
|
3268
3278
|
const d = h.map((a) => ({
|
|
@@ -3285,9 +3295,9 @@ function Cc(e) {
|
|
|
3285
3295
|
};
|
|
3286
3296
|
}, [f, t.selectionMoveEnd$, t.selectionMoveStart$, t.selectionMoving$]);
|
|
3287
3297
|
}
|
|
3288
|
-
const
|
|
3298
|
+
const zn = (e) => !e.some((n) => {
|
|
3289
3299
|
if (typeof n == "string") {
|
|
3290
|
-
if (n !==
|
|
3300
|
+
if (n !== it.COMMA)
|
|
3291
3301
|
return !0;
|
|
3292
3302
|
} else if (n.nodeType !== X.REFERENCE)
|
|
3293
3303
|
return !0;
|
|
@@ -3314,19 +3324,19 @@ function Rc(e) {
|
|
|
3314
3324
|
onConfirm: i,
|
|
3315
3325
|
onClose: l,
|
|
3316
3326
|
onShowBySelection: f
|
|
3317
|
-
} = e, h =
|
|
3327
|
+
} = e, h = y(lt), g = y(Ie), [u, d] = V([]), [a, S] = V(0), m = z(null);
|
|
3318
3328
|
$(() => {
|
|
3319
3329
|
if (t && n.length) {
|
|
3320
|
-
const R = n.map((
|
|
3321
|
-
d(R),
|
|
3330
|
+
const R = n.map((v) => v.sheetName ? Ct(v.sheetName, v.range) : Re(v.range));
|
|
3331
|
+
d(R), S(R.length - 1);
|
|
3322
3332
|
} else
|
|
3323
|
-
d([""]),
|
|
3333
|
+
d([""]), S(0);
|
|
3324
3334
|
}, [t]);
|
|
3325
|
-
const p = (R,
|
|
3326
|
-
const
|
|
3327
|
-
|
|
3335
|
+
const p = (R, v) => {
|
|
3336
|
+
const O = [...u];
|
|
3337
|
+
O[R] = v, d(O);
|
|
3328
3338
|
}, C = () => {
|
|
3329
|
-
d([...u, ""]),
|
|
3339
|
+
d([...u, ""]), S(u.length);
|
|
3330
3340
|
}, _ = (R) => {
|
|
3331
3341
|
u.splice(R, 1), d([...u]);
|
|
3332
3342
|
};
|
|
@@ -3334,26 +3344,26 @@ function Rc(e) {
|
|
|
3334
3344
|
unitId: o,
|
|
3335
3345
|
subUnitId: r,
|
|
3336
3346
|
supportAcrossSheet: c,
|
|
3337
|
-
onChange: (R,
|
|
3347
|
+
onChange: (R, v) => {
|
|
3338
3348
|
if (!t && f != null && f(R))
|
|
3339
3349
|
return;
|
|
3340
|
-
const
|
|
3350
|
+
const O = new Set(u), N = R.map((T) => T.sheetName ? Ct(T.sheetName, T.range) : Re(T.range)), A = N.filter((T) => !O.has(T));
|
|
3341
3351
|
if (!A.length) return;
|
|
3342
3352
|
const F = [...u];
|
|
3343
3353
|
if (N.length > 1) {
|
|
3344
|
-
|
|
3345
|
-
const
|
|
3346
|
-
d(
|
|
3354
|
+
v || F.splice(a, 1), F.push(...A);
|
|
3355
|
+
const T = F.slice(0, s);
|
|
3356
|
+
d(T), S(T.length - 1), requestAnimationFrame(() => {
|
|
3347
3357
|
var k;
|
|
3348
3358
|
(k = m.current) == null || k.scrollTo({ top: m.current.scrollHeight });
|
|
3349
3359
|
});
|
|
3350
3360
|
} else {
|
|
3351
3361
|
F.splice(a, 1, ...A);
|
|
3352
|
-
const
|
|
3353
|
-
d(
|
|
3362
|
+
const T = F.slice(0, s);
|
|
3363
|
+
d(T), S(a + A.length - 1);
|
|
3354
3364
|
}
|
|
3355
3365
|
}
|
|
3356
|
-
}), /* @__PURE__ */
|
|
3366
|
+
}), /* @__PURE__ */ x(
|
|
3357
3367
|
Rs,
|
|
3358
3368
|
{
|
|
3359
3369
|
width: "328px",
|
|
@@ -3363,17 +3373,17 @@ function Rc(e) {
|
|
|
3363
3373
|
mask: !1,
|
|
3364
3374
|
maskClosable: !1,
|
|
3365
3375
|
footer: /* @__PURE__ */ W("footer", { className: "univer-flex univer-gap-2", children: [
|
|
3366
|
-
/* @__PURE__ */
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
|
|
3376
|
+
/* @__PURE__ */ x(ot, { onClick: l, children: h.t("rangeSelector.cancel") }),
|
|
3377
|
+
/* @__PURE__ */ x(
|
|
3378
|
+
ot,
|
|
3369
3379
|
{
|
|
3370
3380
|
variant: "primary",
|
|
3371
3381
|
onClick: () => {
|
|
3372
3382
|
i(
|
|
3373
3383
|
u.filter((R) => {
|
|
3374
|
-
const
|
|
3375
|
-
return
|
|
3376
|
-
}).map((R) =>
|
|
3384
|
+
const v = g.sequenceNodesBuilder(R);
|
|
3385
|
+
return v && v.length === 1 && typeof v[0] != "string" && v[0].nodeType === X.REFERENCE;
|
|
3386
|
+
}).map((R) => ut(R)).map((R) => ({ ...R, range: _c(R.range) }))
|
|
3377
3387
|
);
|
|
3378
3388
|
},
|
|
3379
3389
|
children: h.t("rangeSelector.confirm")
|
|
@@ -3385,39 +3395,39 @@ function Rc(e) {
|
|
|
3385
3395
|
"div",
|
|
3386
3396
|
{
|
|
3387
3397
|
ref: m,
|
|
3388
|
-
className:
|
|
3398
|
+
className: ne("-univer-mx-6 univer-max-h-60 univer-overflow-y-auto univer-px-6", ct),
|
|
3389
3399
|
children: [
|
|
3390
|
-
u.map((R,
|
|
3400
|
+
u.map((R, v) => /* @__PURE__ */ W(
|
|
3391
3401
|
"div",
|
|
3392
3402
|
{
|
|
3393
3403
|
className: "univer-mb-2 univer-flex univer-items-center univer-gap-4",
|
|
3394
3404
|
children: [
|
|
3395
|
-
/* @__PURE__ */
|
|
3405
|
+
/* @__PURE__ */ x(
|
|
3396
3406
|
gr,
|
|
3397
3407
|
{
|
|
3398
|
-
className:
|
|
3399
|
-
"univer-border-primary-600": a ===
|
|
3408
|
+
className: ne("univer-w-full", {
|
|
3409
|
+
"univer-border-primary-600": a === v
|
|
3400
3410
|
}),
|
|
3401
3411
|
placeholder: h.t("rangeSelector.placeHolder"),
|
|
3402
|
-
onFocus: () => v
|
|
3412
|
+
onFocus: () => S(v),
|
|
3403
3413
|
value: R,
|
|
3404
|
-
onChange: (
|
|
3414
|
+
onChange: (O) => p(v, O)
|
|
3405
3415
|
}
|
|
3406
3416
|
),
|
|
3407
|
-
u.length > 1 && /* @__PURE__ */
|
|
3417
|
+
u.length > 1 && /* @__PURE__ */ x(
|
|
3408
3418
|
Tr,
|
|
3409
3419
|
{
|
|
3410
3420
|
className: "univer-cursor-pointer",
|
|
3411
|
-
onClick: () => _(
|
|
3421
|
+
onClick: () => _(v)
|
|
3412
3422
|
}
|
|
3413
3423
|
)
|
|
3414
3424
|
]
|
|
3415
3425
|
},
|
|
3416
|
-
|
|
3426
|
+
v
|
|
3417
3427
|
)),
|
|
3418
|
-
u.length < s && /* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */
|
|
3428
|
+
u.length < s && /* @__PURE__ */ x("div", { children: /* @__PURE__ */ W(ot, { variant: "link", onClick: C, children: [
|
|
3429
|
+
/* @__PURE__ */ x(xr, {}),
|
|
3430
|
+
/* @__PURE__ */ x("span", { children: h.t("rangeSelector.addAnotherRange") })
|
|
3421
3431
|
] }) })
|
|
3422
3432
|
]
|
|
3423
3433
|
}
|
|
@@ -3426,10 +3436,10 @@ function Rc(e) {
|
|
|
3426
3436
|
);
|
|
3427
3437
|
}
|
|
3428
3438
|
function Ic(e) {
|
|
3429
|
-
return e.split(
|
|
3439
|
+
return e.split(it.COMMA).filter((t) => !!t).map((t) => ut(t));
|
|
3430
3440
|
}
|
|
3431
3441
|
function Ec(e) {
|
|
3432
|
-
return e.map((t) => t.sheetName ? Ct(t.sheetName, t.range) : Re(t.range)).join(
|
|
3442
|
+
return e.map((t) => t.sheetName ? Ct(t.sheetName, t.range) : Re(t.range)).join(it.COMMA);
|
|
3433
3443
|
}
|
|
3434
3444
|
function Dr(e) {
|
|
3435
3445
|
const [t, n] = V(null), {
|
|
@@ -3445,13 +3455,13 @@ function Dr(e) {
|
|
|
3445
3455
|
onClickOutside: u,
|
|
3446
3456
|
onFocusChange: d,
|
|
3447
3457
|
forceShowDialogWhenSelectionChanged: a,
|
|
3448
|
-
hideEditor:
|
|
3458
|
+
hideEditor: S,
|
|
3449
3459
|
resetRange: m
|
|
3450
|
-
} = e, [p, C] = V(f != null ? f : !1), [_, R] = V(!1), [
|
|
3460
|
+
} = e, [p, C] = V(f != null ? f : !1), [_, R] = V(!1), [v, O] = V([]), N = y(lt), A = y(je), { sequenceNodes: F } = Sc(t, p, s, c), T = Qe(F), k = y(fe), w = J(() => {
|
|
3451
3461
|
t == null || t.setSelectionRanges([]), t == null || t.blur(), A.blur();
|
|
3452
3462
|
}), b = J(() => {
|
|
3453
3463
|
var I;
|
|
3454
|
-
w(),
|
|
3464
|
+
w(), O(Ic((I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "")), R(!0);
|
|
3455
3465
|
});
|
|
3456
3466
|
return $(() => {
|
|
3457
3467
|
r && (r.current = {
|
|
@@ -3462,21 +3472,21 @@ function Dr(e) {
|
|
|
3462
3472
|
A.focus(t.getEditorId());
|
|
3463
3473
|
},
|
|
3464
3474
|
blur: w,
|
|
3465
|
-
verify: () =>
|
|
3475
|
+
verify: () => zn(T.current),
|
|
3466
3476
|
showDialog: (I) => {
|
|
3467
|
-
w(),
|
|
3477
|
+
w(), O(I), R(!0);
|
|
3468
3478
|
},
|
|
3469
3479
|
hideDialog: () => {
|
|
3470
|
-
|
|
3480
|
+
O([]), R(!1);
|
|
3471
3481
|
},
|
|
3472
3482
|
getValue: () => {
|
|
3473
3483
|
var I;
|
|
3474
3484
|
return (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "";
|
|
3475
3485
|
}
|
|
3476
3486
|
});
|
|
3477
|
-
}, [w, t, A, r,
|
|
3487
|
+
}, [w, t, A, r, T]), $(() => {
|
|
3478
3488
|
var I;
|
|
3479
|
-
o == null || o(
|
|
3489
|
+
o == null || o(zn(F), (I = t == null ? void 0 : t.getDocumentDataModel().getPlainText()) != null ? I : "");
|
|
3480
3490
|
}, [F]), $(() => {
|
|
3481
3491
|
g == null || g(_);
|
|
3482
3492
|
}, [_]), $(() => {
|
|
@@ -3490,7 +3500,7 @@ function Dr(e) {
|
|
|
3490
3500
|
k.executeCommand(gn.id, I);
|
|
3491
3501
|
};
|
|
3492
3502
|
}, [_]), /* @__PURE__ */ W(ms, { children: [
|
|
3493
|
-
|
|
3503
|
+
S ? null : /* @__PURE__ */ x(
|
|
3494
3504
|
zo,
|
|
3495
3505
|
{
|
|
3496
3506
|
isSingle: !0,
|
|
@@ -3502,7 +3512,7 @@ function Dr(e) {
|
|
|
3502
3512
|
onClickOutside: () => {
|
|
3503
3513
|
C(!1), w(), u == null || u();
|
|
3504
3514
|
},
|
|
3505
|
-
icon: /* @__PURE__ */
|
|
3515
|
+
icon: /* @__PURE__ */ x(_s, { title: N.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ x(
|
|
3506
3516
|
Nr,
|
|
3507
3517
|
{
|
|
3508
3518
|
className: "univer-cursor-pointer dark:!univer-text-gray-300",
|
|
@@ -3511,32 +3521,32 @@ function Dr(e) {
|
|
|
3511
3521
|
) })
|
|
3512
3522
|
}
|
|
3513
3523
|
),
|
|
3514
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ x(
|
|
3515
3525
|
Rc,
|
|
3516
3526
|
{
|
|
3517
|
-
initialValue:
|
|
3527
|
+
initialValue: v,
|
|
3518
3528
|
unitId: s,
|
|
3519
3529
|
subUnitId: c,
|
|
3520
3530
|
visible: _,
|
|
3521
3531
|
maxRangeCount: i,
|
|
3522
3532
|
onConfirm: (I) => {
|
|
3523
3533
|
const E = Ec(I), M = to.newEmptyData();
|
|
3524
|
-
M.body.dataStream = E, t == null || t.replaceText(E, !1), h == null || h(M, E), R(!1),
|
|
3534
|
+
M.body.dataStream = E, t == null || t.replaceText(E, !1), h == null || h(M, E), R(!1), O([]), requestAnimationFrame(() => {
|
|
3525
3535
|
w();
|
|
3526
3536
|
});
|
|
3527
3537
|
},
|
|
3528
3538
|
onClose: () => {
|
|
3529
|
-
R(!1),
|
|
3539
|
+
R(!1), O([]);
|
|
3530
3540
|
},
|
|
3531
3541
|
supportAcrossSheet: l,
|
|
3532
|
-
onShowBySelection: (I) => p || a ? (
|
|
3542
|
+
onShowBySelection: (I) => p || a ? (O(I), R(!0), !1) : !0
|
|
3533
3543
|
}
|
|
3534
3544
|
)
|
|
3535
3545
|
] });
|
|
3536
3546
|
}
|
|
3537
3547
|
const bc = () => {
|
|
3538
3548
|
var o, r;
|
|
3539
|
-
const e =
|
|
3549
|
+
const e = y(Mr), t = ve(e.currentSelector$), n = z(null);
|
|
3540
3550
|
return $(() => {
|
|
3541
3551
|
var s, c;
|
|
3542
3552
|
if (t)
|
|
@@ -3544,7 +3554,7 @@ const bc = () => {
|
|
|
3544
3554
|
var i;
|
|
3545
3555
|
(i = n.current) == null || i.hideDialog();
|
|
3546
3556
|
};
|
|
3547
|
-
}, [t]), /* @__PURE__ */
|
|
3557
|
+
}, [t]), /* @__PURE__ */ x(
|
|
3548
3558
|
Dr,
|
|
3549
3559
|
{
|
|
3550
3560
|
unitId: (o = t == null ? void 0 : t.unitId) != null ? o : "",
|
|
@@ -3553,7 +3563,7 @@ const bc = () => {
|
|
|
3553
3563
|
selectorRef: n,
|
|
3554
3564
|
onChange: (s, c) => {
|
|
3555
3565
|
var i;
|
|
3556
|
-
t == null || t.callback((i = c == null ? void 0 : c.split(",").map((l) =>
|
|
3566
|
+
t == null || t.callback((i = c == null ? void 0 : c.split(",").map((l) => ut(l))) != null ? i : []);
|
|
3557
3567
|
}
|
|
3558
3568
|
}
|
|
3559
3569
|
);
|
|
@@ -3564,17 +3574,17 @@ var yc = Object.defineProperty, Tc = Object.getOwnPropertyDescriptor, xc = (e, t
|
|
|
3564
3574
|
return r;
|
|
3565
3575
|
}, Ft = (e, t) => (n, o) => t(n, o, e), Lr = (e, t, n) => xc(e, typeof t != "symbol" ? t + "" : t, n);
|
|
3566
3576
|
let jt = class extends oo {
|
|
3567
|
-
constructor(e =
|
|
3577
|
+
constructor(e = qn, t, n, o, r) {
|
|
3568
3578
|
super(), this._config = e, this._injector = t, this._renderManagerService = n, this._configService = o, this._uiPartsService = r;
|
|
3569
3579
|
const { menu: s, ...c } = so(
|
|
3570
|
-
|
|
3580
|
+
qn,
|
|
3571
3581
|
this._config
|
|
3572
3582
|
);
|
|
3573
3583
|
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig($s, c, { merge: !0 });
|
|
3574
3584
|
}
|
|
3575
3585
|
onStarting() {
|
|
3576
3586
|
io(this._injector, [
|
|
3577
|
-
[
|
|
3587
|
+
[Zt, { useClass: on }],
|
|
3578
3588
|
[Mr],
|
|
3579
3589
|
[Bt],
|
|
3580
3590
|
[Ut],
|
|
@@ -3627,12 +3637,12 @@ export {
|
|
|
3627
3637
|
Mr as GlobalRangeSelectorService,
|
|
3628
3638
|
xs as HelpFunctionOperation,
|
|
3629
3639
|
pe as InsertFunctionOperation,
|
|
3630
|
-
|
|
3640
|
+
Cn as MoreFunctionsOperation,
|
|
3631
3641
|
Dr as RangeSelector,
|
|
3632
3642
|
Le as RefSelectionsRenderService,
|
|
3633
3643
|
Sr as ReferenceAbsoluteOperation,
|
|
3634
3644
|
Fs as SearchFunctionOperation,
|
|
3635
|
-
|
|
3645
|
+
ht as SelectEditorFormulaOperation,
|
|
3636
3646
|
Sn as SheetOnlyPasteFormulaCommand,
|
|
3637
3647
|
jt as UniverSheetsFormulaUIPlugin
|
|
3638
3648
|
};
|