@univerjs/find-replace 0.9.3 → 0.9.4-nightly.202507290757
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 +1 -1
- package/lib/es/index.js +273 -261
- package/lib/index.js +273 -261
- package/lib/types/controllers/find-replace.controller.d.ts +2 -3
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
var st = Object.defineProperty;
|
|
2
2
|
var at = (t, e, n) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var o = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { createIdentifier as ot, Inject as
|
|
5
|
-
import { IConfirmService as pt, IMessageService as
|
|
6
|
-
import { MessageType as N, Input as
|
|
4
|
+
import { createIdentifier as ot, Inject as $, Injector as pe, IContextService as ee, Disposable as te, DisposableCollection as ct, toDisposable as A, IUniverInstanceService as _e, ICommandService as k, CommandType as I, LocaleService as B, FOCUSING_SHEET as ge, EDITOR_ACTIVATED as me, UniverInstanceType as lt, RxDisposable as dt, IConfigService as ht, Plugin as ut, merge as ft } from "@univerjs/core";
|
|
5
|
+
import { IConfirmService as pt, IMessageService as ve, useDependency as S, useObservable as P, useDebounceFn as _t, ILayoutService as Se, KeyCode as M, MetaKeys as D, getMenuHiddenObservable as gt, MenuItemType as mt, RibbonDataGroup as vt, IMenuManagerService as St, IShortcutService as Ct, IDialogService as Mt, ComponentManager as Rt } from "@univerjs/ui";
|
|
6
|
+
import { MessageType as N, Input as Ce, Pager as bt, FormLayout as b, Select as G, FormDualColumnLayout as oe, Checkbox as ce, Button as H } from "@univerjs/design";
|
|
7
7
|
import { RENDER_RAW_FORMULA_KEY as It } from "@univerjs/engine-render";
|
|
8
|
-
import { throttleTime as yt, BehaviorSubject as T, combineLatest as
|
|
9
|
-
import { jsx as l, jsxs as
|
|
10
|
-
import { forwardRef as W, useRef as
|
|
11
|
-
const
|
|
12
|
-
var Ot = Object.getOwnPropertyDescriptor,
|
|
8
|
+
import { throttleTime as yt, BehaviorSubject as T, combineLatest as Me, debounceTime as Ft, Subject as Re, fromEvent as Dt, map as xt, takeUntil as le } from "rxjs";
|
|
9
|
+
import { jsx as l, jsxs as F, Fragment as q } from "react/jsx-runtime";
|
|
10
|
+
import { forwardRef as W, useRef as Z, createElement as be, useState as Pt, useCallback as u, useEffect as L, useMemo as ie, useImperativeHandle as Tt } from "react";
|
|
11
|
+
const Ie = "FIND_REPLACE_INPUT_FOCUS", ye = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
|
|
12
|
+
var Ot = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
|
|
13
13
|
for (var r = i > 1 ? void 0 : i ? Ot(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
14
14
|
(a = t[s]) && (r = a(r) || r);
|
|
15
15
|
return r;
|
|
16
|
-
},
|
|
17
|
-
class vi extends
|
|
16
|
+
}, w = (t, e) => (n, i) => e(n, i, t);
|
|
17
|
+
class vi extends te {
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const _ = ot("find-replace.service");
|
|
20
20
|
function Et(t) {
|
|
21
21
|
return typeof t.findString < "u" || typeof t.inputtingFindString < "u" || typeof t.findDirection < "u" || typeof t.matchesTheWholeCell < "u" || typeof t.caseSensitive < "u" || typeof t.findScope < "u" || typeof t.findBy < "u";
|
|
22
22
|
}
|
|
23
|
-
let
|
|
23
|
+
let z = class extends te {
|
|
24
24
|
constructor(e, n, i, r) {
|
|
25
25
|
super();
|
|
26
26
|
o(this, "currentMatch$", new T(null));
|
|
@@ -42,7 +42,7 @@ let q = class extends ee {
|
|
|
42
42
|
return this._findModels.length > 0;
|
|
43
43
|
}
|
|
44
44
|
dispose() {
|
|
45
|
-
super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...
|
|
45
|
+
super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ne(), revealed: !1 });
|
|
46
46
|
}
|
|
47
47
|
async start() {
|
|
48
48
|
if (!this._state.findString)
|
|
@@ -82,14 +82,14 @@ let q = class extends ee {
|
|
|
82
82
|
}
|
|
83
83
|
// When a document's content changes, we should reset all matches and try to move to the next match.
|
|
84
84
|
_subscribeToModelsChanges(e) {
|
|
85
|
-
const n = this._currentSearchingDisposables = new ct(), i =
|
|
85
|
+
const n = this._currentSearchingDisposables = new ct(), i = Me(e.map((r) => r.matchesUpdate$)).pipe(Ft(220)).subscribe(([...r]) => {
|
|
86
86
|
const s = this._matches = r.flat();
|
|
87
87
|
s.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: s.length }), this.replaceables$.next(s.filter((a) => a.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
|
|
88
88
|
});
|
|
89
|
-
e.forEach((r) => n.add(
|
|
89
|
+
e.forEach((r) => n.add(A(r.activelyChangingMatch$.subscribe((s) => {
|
|
90
90
|
const a = this._matches.findIndex((c) => c === s);
|
|
91
91
|
this._state.changeState({ matchesPosition: a + 1 });
|
|
92
|
-
})))), n.add(
|
|
92
|
+
})))), n.add(A(i));
|
|
93
93
|
}
|
|
94
94
|
async replace() {
|
|
95
95
|
return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
|
|
@@ -163,12 +163,12 @@ let q = class extends ee {
|
|
|
163
163
|
return this._moveToNextUnitMatch(r), 0;
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
],
|
|
170
|
-
var
|
|
171
|
-
function
|
|
166
|
+
z = De([
|
|
167
|
+
w(2, _e),
|
|
168
|
+
w(3, k)
|
|
169
|
+
], z);
|
|
170
|
+
var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), J = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(J || {}), Q = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Q || {});
|
|
171
|
+
function ne() {
|
|
172
172
|
return {
|
|
173
173
|
caseSensitive: !1,
|
|
174
174
|
findBy: "value",
|
|
@@ -187,9 +187,9 @@ function ie() {
|
|
|
187
187
|
}
|
|
188
188
|
class Nt {
|
|
189
189
|
constructor() {
|
|
190
|
-
o(this, "_stateUpdates$", new
|
|
190
|
+
o(this, "_stateUpdates$", new Re());
|
|
191
191
|
o(this, "stateUpdates$", this._stateUpdates$.asObservable());
|
|
192
|
-
o(this, "_state$", new T(
|
|
192
|
+
o(this, "_state$", new T(ne()));
|
|
193
193
|
o(this, "state$", this._state$.asObservable());
|
|
194
194
|
o(this, "_findString", "");
|
|
195
195
|
o(this, "_inputtingFindString", "");
|
|
@@ -267,7 +267,7 @@ class Nt {
|
|
|
267
267
|
}), this._stateUpdates$.next(i));
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
let
|
|
270
|
+
let X = class extends te {
|
|
271
271
|
constructor(e, n) {
|
|
272
272
|
super();
|
|
273
273
|
o(this, "_providers", /* @__PURE__ */ new Set());
|
|
@@ -277,7 +277,7 @@ let J = class extends ee {
|
|
|
277
277
|
o(this, "currentMatch$", this._currentMatch$.asObservable());
|
|
278
278
|
o(this, "_replaceables$", new T([]));
|
|
279
279
|
o(this, "replaceables$", this._replaceables$.asObservable());
|
|
280
|
-
o(this, "_focusSignal$", new
|
|
280
|
+
o(this, "_focusSignal$", new Re());
|
|
281
281
|
o(this, "focusSignal$", this._focusSignal$.asObservable());
|
|
282
282
|
this._injector = e, this._contextService = n;
|
|
283
283
|
}
|
|
@@ -360,8 +360,8 @@ let J = class extends ee {
|
|
|
360
360
|
start(e = !1) {
|
|
361
361
|
if (this._providers.size === 0)
|
|
362
362
|
return !1;
|
|
363
|
-
this._model = this._injector.createInstance(
|
|
364
|
-
const n =
|
|
363
|
+
this._model = this._injector.createInstance(z, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
|
|
364
|
+
const n = ne();
|
|
365
365
|
return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
|
|
366
366
|
}
|
|
367
367
|
find() {
|
|
@@ -373,28 +373,28 @@ let J = class extends ee {
|
|
|
373
373
|
(e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
|
|
374
374
|
}
|
|
375
375
|
registerFindReplaceProvider(e) {
|
|
376
|
-
return this._providers.add(e),
|
|
376
|
+
return this._providers.add(e), A(() => this._providers.delete(e));
|
|
377
377
|
}
|
|
378
378
|
_toggleRevealReplace(e) {
|
|
379
|
-
this._contextService.setContextValue(
|
|
379
|
+
this._contextService.setContextValue(Fe, e);
|
|
380
380
|
}
|
|
381
381
|
_toggleDisplayRawFormula(e) {
|
|
382
382
|
this._contextService.setContextValue(It, e);
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
],
|
|
389
|
-
const
|
|
385
|
+
X = De([
|
|
386
|
+
w(0, $(pe)),
|
|
387
|
+
w(1, ee)
|
|
388
|
+
], X);
|
|
389
|
+
const xe = {
|
|
390
390
|
id: "ui.command.replace-current-match",
|
|
391
|
-
type:
|
|
392
|
-
handler: (t) => t.get(
|
|
393
|
-
}, $t = "CONFIRM_REPLACE_ALL",
|
|
391
|
+
type: I.COMMAND,
|
|
392
|
+
handler: (t) => t.get(_).replace()
|
|
393
|
+
}, $t = "CONFIRM_REPLACE_ALL", Pe = {
|
|
394
394
|
id: "ui.command.replace-all-matches",
|
|
395
|
-
type:
|
|
395
|
+
type: I.COMMAND,
|
|
396
396
|
handler: async (t) => {
|
|
397
|
-
const e = t.get(pt), n = t.get(B), i = t.get(
|
|
397
|
+
const e = t.get(pt), n = t.get(B), i = t.get(ve);
|
|
398
398
|
if (!await e.confirm({
|
|
399
399
|
id: $t,
|
|
400
400
|
title: { title: n.t("find-replace.replace.confirm.title") },
|
|
@@ -402,7 +402,7 @@ const Fe = {
|
|
|
402
402
|
confirmText: n.t("button.confirm")
|
|
403
403
|
}))
|
|
404
404
|
return !1;
|
|
405
|
-
const s = await t.get(
|
|
405
|
+
const s = await t.get(_).replaceAll(), { success: a, failure: c } = s;
|
|
406
406
|
return c > 0 ? (a === 0 ? i.show({
|
|
407
407
|
type: N.Error,
|
|
408
408
|
content: n.t("find-replace.replace.all-failure")
|
|
@@ -416,39 +416,39 @@ const Fe = {
|
|
|
416
416
|
}
|
|
417
417
|
}, O = {
|
|
418
418
|
id: "ui.operation.open-find-dialog",
|
|
419
|
-
type:
|
|
419
|
+
type: I.OPERATION,
|
|
420
420
|
handler: (t) => {
|
|
421
|
-
const e = t.get(
|
|
421
|
+
const e = t.get(_);
|
|
422
422
|
return e.revealed ? e.focusFindInput() : e.start(), !0;
|
|
423
423
|
}
|
|
424
|
-
},
|
|
424
|
+
}, re = {
|
|
425
425
|
id: "ui.operation.open-replace-dialog",
|
|
426
|
-
type:
|
|
426
|
+
type: I.OPERATION,
|
|
427
427
|
handler: (t) => {
|
|
428
|
-
const e = t.get(
|
|
428
|
+
const e = t.get(_);
|
|
429
429
|
return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
|
|
430
430
|
}
|
|
431
|
-
},
|
|
432
|
-
type:
|
|
431
|
+
}, Te = {
|
|
432
|
+
type: I.OPERATION,
|
|
433
433
|
id: "ui.operation.go-to-next-match",
|
|
434
|
-
handler: (t) => (t.get(
|
|
435
|
-
},
|
|
436
|
-
type:
|
|
434
|
+
handler: (t) => (t.get(_).moveToNextMatch(), !0)
|
|
435
|
+
}, Oe = {
|
|
436
|
+
type: I.OPERATION,
|
|
437
437
|
id: "ui.operation.go-to-previous-match",
|
|
438
|
-
handler: (t) => (t.get(
|
|
439
|
-
},
|
|
440
|
-
type:
|
|
438
|
+
handler: (t) => (t.get(_).moveToPreviousMatch(), !0)
|
|
439
|
+
}, Ee = {
|
|
440
|
+
type: I.OPERATION,
|
|
441
441
|
id: "ui.operation.focus-selection",
|
|
442
|
-
handler: (t) => (t.get(
|
|
442
|
+
handler: (t) => (t.get(_).focusSelection(), !0)
|
|
443
443
|
};
|
|
444
|
-
var
|
|
445
|
-
return
|
|
444
|
+
var p = function() {
|
|
445
|
+
return p = Object.assign || function(t) {
|
|
446
446
|
for (var e, n = 1, i = arguments.length; n < i; n++) {
|
|
447
447
|
e = arguments[n];
|
|
448
448
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
449
449
|
}
|
|
450
450
|
return t;
|
|
451
|
-
},
|
|
451
|
+
}, p.apply(this, arguments);
|
|
452
452
|
}, At = function(t, e) {
|
|
453
453
|
var n = {};
|
|
454
454
|
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
@@ -456,17 +456,17 @@ var _ = function() {
|
|
|
456
456
|
for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
|
|
457
457
|
e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
|
|
458
458
|
return n;
|
|
459
|
-
},
|
|
460
|
-
var n = t.icon, i = t.id, r = t.className, s = t.extend, a = At(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d =
|
|
461
|
-
return
|
|
459
|
+
}, Ne = W(function(t, e) {
|
|
460
|
+
var n = t.icon, i = t.id, r = t.className, s = t.extend, a = At(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = Z("_".concat(Ut()));
|
|
461
|
+
return $e(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, p({ ref: e, className: c }, a), s);
|
|
462
462
|
});
|
|
463
|
-
function
|
|
464
|
-
return
|
|
465
|
-
return
|
|
463
|
+
function $e(t, e, n, i, r) {
|
|
464
|
+
return be(t.tag, p(p({ key: e }, Lt(t, n, r)), i), (wt(t, n).children || []).map(function(s, a) {
|
|
465
|
+
return $e(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
468
|
function Lt(t, e, n) {
|
|
469
|
-
var i =
|
|
469
|
+
var i = p({}, t.attrs);
|
|
470
470
|
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(function(s) {
|
|
471
471
|
var a = s[0], c = s[1];
|
|
472
472
|
a === "mask" && typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
@@ -479,309 +479,322 @@ function Lt(t, e, n) {
|
|
|
479
479
|
}
|
|
480
480
|
function wt(t, e) {
|
|
481
481
|
var n, i = e.defIds;
|
|
482
|
-
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ?
|
|
483
|
-
return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ?
|
|
482
|
+
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? p(p({}, t), { children: t.children.map(function(r) {
|
|
483
|
+
return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ? p(p({}, r), { attrs: p(p({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
484
484
|
}) }) : t;
|
|
485
485
|
}
|
|
486
486
|
function Ut() {
|
|
487
487
|
return Math.random().toString(36).substring(2, 8);
|
|
488
488
|
}
|
|
489
|
-
|
|
490
|
-
var
|
|
491
|
-
return
|
|
489
|
+
Ne.displayName = "UniverIcon";
|
|
490
|
+
var kt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ae = W(function(t, e) {
|
|
491
|
+
return be(Ne, Object.assign({}, t, {
|
|
492
492
|
id: "search-icon",
|
|
493
493
|
ref: e,
|
|
494
|
-
icon:
|
|
494
|
+
icon: kt
|
|
495
495
|
}));
|
|
496
496
|
});
|
|
497
|
-
|
|
498
|
-
function
|
|
499
|
-
const {
|
|
500
|
-
|
|
501
|
-
|
|
497
|
+
Ae.displayName = "SearchIcon";
|
|
498
|
+
function Le(t) {
|
|
499
|
+
const {
|
|
500
|
+
findCompleted: e,
|
|
501
|
+
localeService: n,
|
|
502
|
+
matchesCount: i,
|
|
503
|
+
matchesPosition: r,
|
|
504
|
+
initialFindString: s,
|
|
505
|
+
findReplaceService: a,
|
|
506
|
+
onChange: c,
|
|
507
|
+
...d
|
|
508
|
+
} = t, [m, g] = Pt(s), y = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
|
|
509
|
+
function v(f) {
|
|
510
|
+
r === i && f === 1 ? a.moveToNextMatch() : r === 1 && f === i || f < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
|
|
511
|
+
}
|
|
512
|
+
function j(f) {
|
|
513
|
+
f.key === "Enter" && v(r + 1);
|
|
514
|
+
}
|
|
515
|
+
return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (f) => f.stopPropagation(), children: /* @__PURE__ */ l(
|
|
516
|
+
Ce,
|
|
502
517
|
{
|
|
503
518
|
"data-u-comp": "search-input",
|
|
504
519
|
autoFocus: !0,
|
|
505
520
|
placeholder: n.t("find-replace.dialog.find-placeholder"),
|
|
506
521
|
value: m,
|
|
507
|
-
onChange: (
|
|
508
|
-
f
|
|
522
|
+
onChange: (f) => {
|
|
523
|
+
g(f), c == null || c(f);
|
|
509
524
|
},
|
|
525
|
+
onKeyDown: j,
|
|
510
526
|
slot: /* @__PURE__ */ l(
|
|
511
527
|
bt,
|
|
512
528
|
{
|
|
513
529
|
loop: !0,
|
|
514
|
-
text:
|
|
530
|
+
text: y,
|
|
515
531
|
value: r,
|
|
516
532
|
total: i,
|
|
517
|
-
onChange:
|
|
518
|
-
r === i && h === 1 ? a.moveToNextMatch() : r === 1 && h === i || h < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
|
|
519
|
-
}
|
|
533
|
+
onChange: v
|
|
520
534
|
}
|
|
521
535
|
),
|
|
522
536
|
...d
|
|
523
537
|
}
|
|
524
538
|
) });
|
|
525
539
|
}
|
|
526
|
-
function
|
|
527
|
-
const n =
|
|
540
|
+
function we(t, e) {
|
|
541
|
+
const n = u(() => {
|
|
528
542
|
var r;
|
|
529
543
|
(r = document.querySelector(".univer-find-input input")) == null || r.focus();
|
|
530
|
-
}, []), i =
|
|
544
|
+
}, []), i = u(() => {
|
|
531
545
|
const r = document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");
|
|
532
546
|
return Array.from(r).some((s) => s === document.activeElement);
|
|
533
547
|
}, []);
|
|
534
|
-
return Tt(e, () => ({ focus: n, selectHasFocus: i })),
|
|
548
|
+
return Tt(e, () => ({ focus: n, selectHasFocus: i })), L(() => {
|
|
535
549
|
const r = t.focusSignal$.subscribe(() => n());
|
|
536
550
|
return () => r.unsubscribe();
|
|
537
551
|
}, [t, n]), { focus: n, selectHasFocus: i };
|
|
538
552
|
}
|
|
539
|
-
const
|
|
540
|
-
const i = S(B), r = S(
|
|
541
|
-
s.executeCommand(
|
|
542
|
-
}, [s]),
|
|
543
|
-
return
|
|
553
|
+
const Bt = W(function(e, n) {
|
|
554
|
+
const i = S(B), r = S(_), s = S(k), a = P(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: m, matchesPosition: g } = a, R = u(() => {
|
|
555
|
+
s.executeCommand(re.id);
|
|
556
|
+
}, [s]), y = _t((v) => r.changeFindString(v), 500);
|
|
557
|
+
return we(r, n), /* @__PURE__ */ F(q, { children: [
|
|
544
558
|
/* @__PURE__ */ l(
|
|
545
|
-
|
|
559
|
+
Le,
|
|
546
560
|
{
|
|
547
561
|
findCompleted: c,
|
|
548
|
-
className: "univer-find-input",
|
|
549
562
|
matchesCount: m,
|
|
550
|
-
matchesPosition:
|
|
563
|
+
matchesPosition: g,
|
|
551
564
|
findReplaceService: r,
|
|
552
565
|
localeService: i,
|
|
553
566
|
initialFindString: d,
|
|
554
|
-
onChange:
|
|
567
|
+
onChange: y
|
|
555
568
|
}
|
|
556
569
|
),
|
|
557
570
|
/* @__PURE__ */ l("div", { className: "univer-mt-4 univer-text-center", children: /* @__PURE__ */ l(
|
|
558
571
|
"a",
|
|
559
572
|
{
|
|
560
573
|
className: "hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors",
|
|
561
|
-
onClick:
|
|
574
|
+
onClick: R,
|
|
562
575
|
children: i.t("find-replace.dialog.advanced-finding")
|
|
563
576
|
}
|
|
564
577
|
) })
|
|
565
578
|
] });
|
|
566
|
-
}),
|
|
567
|
-
const i = S(
|
|
568
|
-
matchesCount:
|
|
569
|
-
matchesPosition:
|
|
570
|
-
findString:
|
|
571
|
-
inputtingFindString:
|
|
572
|
-
replaceString:
|
|
573
|
-
caseSensitive:
|
|
574
|
-
matchesTheWholeCell:
|
|
575
|
-
findDirection:
|
|
579
|
+
}), Wt = W(function(e, n) {
|
|
580
|
+
const i = S(_), r = S(B), s = S(k), a = S(ve), c = P(i.currentMatch$, void 0, !0), d = P(i.replaceables$, void 0, !0), m = P(i.state$, void 0, !0), {
|
|
581
|
+
matchesCount: g,
|
|
582
|
+
matchesPosition: R,
|
|
583
|
+
findString: y,
|
|
584
|
+
inputtingFindString: v,
|
|
585
|
+
replaceString: j,
|
|
586
|
+
caseSensitive: f,
|
|
587
|
+
matchesTheWholeCell: Be,
|
|
588
|
+
findDirection: We,
|
|
576
589
|
findScope: je,
|
|
577
590
|
findBy: Ve,
|
|
578
|
-
findCompleted:
|
|
579
|
-
} = m, Ge =
|
|
580
|
-
(
|
|
591
|
+
findCompleted: V
|
|
592
|
+
} = m, Ge = v.length === 0, He = g === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = u(
|
|
593
|
+
(h) => i.changeInputtingFindString(h),
|
|
581
594
|
[i]
|
|
582
|
-
), Ze =
|
|
583
|
-
(
|
|
595
|
+
), Ze = u(
|
|
596
|
+
(h) => i.changeReplaceString(h),
|
|
584
597
|
[i]
|
|
585
|
-
), { focus: ze } =
|
|
586
|
-
|
|
587
|
-
}, [
|
|
588
|
-
await s.executeCommand(
|
|
589
|
-
}, [s]), Xe =
|
|
590
|
-
i.changeFindDirection(
|
|
591
|
-
}, [i]), et =
|
|
592
|
-
i.changeFindScope(
|
|
593
|
-
}, [i]), tt =
|
|
594
|
-
i.changeFindBy(
|
|
598
|
+
), { focus: ze } = we(i, n), Ye = u(() => {
|
|
599
|
+
y === v ? i.moveToNextMatch() : (i.changeFindString(v), i.find());
|
|
600
|
+
}, [y, v, i]), Je = u(() => s.executeCommand(xe.id), [s]), Qe = u(async () => {
|
|
601
|
+
await s.executeCommand(Pe.id), ze();
|
|
602
|
+
}, [s]), Xe = u((h) => {
|
|
603
|
+
i.changeFindDirection(h);
|
|
604
|
+
}, [i]), et = u((h) => {
|
|
605
|
+
i.changeFindScope(h);
|
|
606
|
+
}, [i]), tt = u((h) => {
|
|
607
|
+
i.changeFindBy(h);
|
|
595
608
|
}, [i]), it = Vt(r), nt = Gt(r), rt = Ht(r);
|
|
596
|
-
return
|
|
597
|
-
|
|
609
|
+
return L(() => {
|
|
610
|
+
V && g === 0 && a.show({
|
|
598
611
|
content: r.t("find-replace.dialog.no-match"),
|
|
599
612
|
type: N.Warning,
|
|
600
613
|
duration: 5e3
|
|
601
614
|
});
|
|
602
|
-
}, [
|
|
603
|
-
/* @__PURE__ */ l(
|
|
604
|
-
|
|
615
|
+
}, [V, g, a, r]), /* @__PURE__ */ F("div", { children: [
|
|
616
|
+
/* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
|
|
617
|
+
Le,
|
|
605
618
|
{
|
|
606
|
-
findCompleted:
|
|
619
|
+
findCompleted: V,
|
|
607
620
|
className: "univer-find-input",
|
|
608
|
-
matchesCount:
|
|
609
|
-
matchesPosition:
|
|
621
|
+
matchesCount: g,
|
|
622
|
+
matchesPosition: R,
|
|
610
623
|
findReplaceService: i,
|
|
611
624
|
localeService: r,
|
|
612
|
-
initialFindString:
|
|
625
|
+
initialFindString: v,
|
|
613
626
|
onChange: qe
|
|
614
627
|
}
|
|
615
628
|
) }),
|
|
616
|
-
/* @__PURE__ */ l(
|
|
617
|
-
|
|
629
|
+
/* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
|
|
630
|
+
Ce,
|
|
618
631
|
{
|
|
619
632
|
placeholder: r.t("find-replace.dialog.replace-placeholder"),
|
|
620
|
-
value:
|
|
621
|
-
onChange: (
|
|
633
|
+
value: j,
|
|
634
|
+
onChange: (h) => Ze(h)
|
|
622
635
|
}
|
|
623
636
|
) }),
|
|
624
|
-
/* @__PURE__ */ l(
|
|
625
|
-
/* @__PURE__ */ l(
|
|
626
|
-
/* @__PURE__ */ l(
|
|
627
|
-
/* @__PURE__ */ l(
|
|
637
|
+
/* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(G, { value: We, options: nt, onChange: Xe }) }),
|
|
638
|
+
/* @__PURE__ */ l(oe, { children: /* @__PURE__ */ F(q, { children: [
|
|
639
|
+
/* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(G, { value: je, options: it, onChange: et }) }),
|
|
640
|
+
/* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(G, { value: Ve, options: rt, onChange: tt }) })
|
|
628
641
|
] }) }),
|
|
629
|
-
/* @__PURE__ */ l(
|
|
630
|
-
/* @__PURE__ */ l(
|
|
631
|
-
|
|
642
|
+
/* @__PURE__ */ l(oe, { children: /* @__PURE__ */ F(q, { children: [
|
|
643
|
+
/* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
|
|
644
|
+
ce,
|
|
632
645
|
{
|
|
633
|
-
checked:
|
|
634
|
-
onChange: (
|
|
635
|
-
i.changeCaseSensitive(
|
|
646
|
+
checked: f,
|
|
647
|
+
onChange: (h) => {
|
|
648
|
+
i.changeCaseSensitive(h);
|
|
636
649
|
},
|
|
637
650
|
children: r.t("find-replace.dialog.case-sensitive")
|
|
638
651
|
}
|
|
639
652
|
) }),
|
|
640
|
-
/* @__PURE__ */ l(
|
|
641
|
-
|
|
653
|
+
/* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
|
|
654
|
+
ce,
|
|
642
655
|
{
|
|
643
|
-
checked:
|
|
644
|
-
onChange: (
|
|
645
|
-
i.changeMatchesTheWholeCell(
|
|
656
|
+
checked: Be,
|
|
657
|
+
onChange: (h) => {
|
|
658
|
+
i.changeMatchesTheWholeCell(h);
|
|
646
659
|
},
|
|
647
660
|
children: r.t("find-replace.dialog.match-the-whole-cell")
|
|
648
661
|
}
|
|
649
662
|
) })
|
|
650
663
|
] }) }),
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */ l(
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */ l(
|
|
655
|
-
/* @__PURE__ */ l(
|
|
664
|
+
/* @__PURE__ */ F("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
|
|
665
|
+
/* @__PURE__ */ l(H, { variant: "primary", onClick: Ye, disabled: Ge, children: r.t("find-replace.dialog.find") }),
|
|
666
|
+
/* @__PURE__ */ F("span", { className: "univer-inline-flex univer-gap-2", children: [
|
|
667
|
+
/* @__PURE__ */ l(H, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace") }),
|
|
668
|
+
/* @__PURE__ */ l(H, { disabled: Ke, onClick: Qe, children: r.t("find-replace.dialog.replace-all") })
|
|
656
669
|
] })
|
|
657
670
|
] })
|
|
658
671
|
] });
|
|
659
672
|
});
|
|
660
673
|
function jt() {
|
|
661
|
-
const t = S(
|
|
662
|
-
|
|
674
|
+
const t = S(_), e = S(Se), n = S(ee), i = P(t.state$, void 0, !0), r = Z(null);
|
|
675
|
+
L(() => {
|
|
663
676
|
let d;
|
|
664
677
|
return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
|
|
665
678
|
}, [e]);
|
|
666
|
-
const s =
|
|
667
|
-
(d) => n.setContextValue(
|
|
679
|
+
const s = Z(null), a = u(
|
|
680
|
+
(d) => n.setContextValue(ye, d),
|
|
668
681
|
[n]
|
|
669
|
-
), c =
|
|
670
|
-
(d) => n.setContextValue(
|
|
682
|
+
), c = u(
|
|
683
|
+
(d) => n.setContextValue(Ie, d),
|
|
671
684
|
[n]
|
|
672
685
|
);
|
|
673
|
-
return
|
|
686
|
+
return L(() => {
|
|
674
687
|
var m;
|
|
675
|
-
const d = Dt(document, "focusin").subscribe((
|
|
676
|
-
var
|
|
677
|
-
|
|
688
|
+
const d = Dt(document, "focusin").subscribe((g) => {
|
|
689
|
+
var R;
|
|
690
|
+
g.target && ((R = r.current) != null && R.contains(g.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
|
|
678
691
|
});
|
|
679
692
|
return (m = s.current) == null || m.focus(), a(!0), c(!0), () => {
|
|
680
693
|
d.unsubscribe(), a(!1);
|
|
681
694
|
};
|
|
682
|
-
}, [a, c]), /* @__PURE__ */ l("div", { ref: r, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ l(
|
|
695
|
+
}, [a, c]), /* @__PURE__ */ l("div", { ref: r, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ l(Wt, { ref: s }) : /* @__PURE__ */ l(Bt, { ref: s }) });
|
|
683
696
|
}
|
|
684
697
|
function Vt(t) {
|
|
685
698
|
const e = t.getCurrentLocale();
|
|
686
|
-
return
|
|
687
|
-
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value:
|
|
688
|
-
{ label: t.t("find-replace.dialog.find-scope.workbook"), value:
|
|
699
|
+
return ie(() => [
|
|
700
|
+
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Q.SUBUNIT },
|
|
701
|
+
{ label: t.t("find-replace.dialog.find-scope.workbook"), value: Q.UNIT }
|
|
689
702
|
], [e]);
|
|
690
703
|
}
|
|
691
704
|
function Gt(t) {
|
|
692
705
|
const e = t.getCurrentLocale();
|
|
693
|
-
return
|
|
694
|
-
{ label: t.t("find-replace.dialog.find-direction.row"), value:
|
|
695
|
-
{ label: t.t("find-replace.dialog.find-direction.column"), value:
|
|
706
|
+
return ie(() => [
|
|
707
|
+
{ label: t.t("find-replace.dialog.find-direction.row"), value: Y.ROW },
|
|
708
|
+
{ label: t.t("find-replace.dialog.find-direction.column"), value: Y.COLUMN }
|
|
696
709
|
], [e]);
|
|
697
710
|
}
|
|
698
711
|
function Ht(t) {
|
|
699
712
|
const e = t.getCurrentLocale();
|
|
700
|
-
return
|
|
701
|
-
{ label: t.t("find-replace.dialog.find-by.value"), value:
|
|
702
|
-
{ label: t.t("find-replace.dialog.find-by.formula"), value:
|
|
713
|
+
return ie(() => [
|
|
714
|
+
{ label: t.t("find-replace.dialog.find-by.value"), value: J.VALUE },
|
|
715
|
+
{ label: t.t("find-replace.dialog.find-by.formula"), value: J.FORMULA }
|
|
703
716
|
], [e]);
|
|
704
717
|
}
|
|
705
|
-
function
|
|
706
|
-
return t.getContextValue(
|
|
718
|
+
function x(t) {
|
|
719
|
+
return t.getContextValue(ye);
|
|
707
720
|
}
|
|
708
721
|
function Kt(t) {
|
|
709
|
-
return t.getContextValue(
|
|
722
|
+
return t.getContextValue(Fe);
|
|
710
723
|
}
|
|
711
|
-
function
|
|
712
|
-
return t.getContextValue(
|
|
724
|
+
function Ue(t) {
|
|
725
|
+
return t.getContextValue(Ie);
|
|
713
726
|
}
|
|
714
727
|
const E = "7_find-replace-shortcuts";
|
|
715
|
-
function re(t) {
|
|
716
|
-
return t.getContextValue(pe);
|
|
717
|
-
}
|
|
718
728
|
function se(t) {
|
|
719
|
-
return
|
|
729
|
+
return t.getContextValue(ge);
|
|
730
|
+
}
|
|
731
|
+
function ae(t) {
|
|
732
|
+
return !t.getContextValue(me);
|
|
720
733
|
}
|
|
721
734
|
const qt = {
|
|
722
735
|
id: O.id,
|
|
723
736
|
description: "find-replace.shortcut.open-find-dialog",
|
|
724
|
-
binding:
|
|
737
|
+
binding: M.F | D.CTRL_COMMAND,
|
|
725
738
|
group: E,
|
|
726
739
|
preconditions(t) {
|
|
727
|
-
return !
|
|
740
|
+
return !x(t) && se(t) && ae(t);
|
|
728
741
|
}
|
|
729
742
|
}, Zt = {
|
|
730
743
|
id: O.id,
|
|
731
744
|
description: "find-replace.shortcut.open-find-dialog",
|
|
732
|
-
binding:
|
|
733
|
-
mac:
|
|
745
|
+
binding: M.F | D.CTRL_COMMAND,
|
|
746
|
+
mac: M.F | D.MAC_CTRL,
|
|
734
747
|
preconditions(t) {
|
|
735
|
-
return !
|
|
748
|
+
return !x(t) && se(t) && ae(t);
|
|
736
749
|
}
|
|
737
750
|
}, zt = {
|
|
738
|
-
id:
|
|
751
|
+
id: re.id,
|
|
739
752
|
description: "find-replace.shortcut.open-replace-dialog",
|
|
740
|
-
binding:
|
|
741
|
-
mac:
|
|
753
|
+
binding: M.H | D.CTRL_COMMAND,
|
|
754
|
+
mac: M.H | D.MAC_CTRL,
|
|
742
755
|
group: E,
|
|
743
756
|
preconditions(t) {
|
|
744
|
-
return
|
|
757
|
+
return se(t) && ae(t) && (!x(t) || !Kt(t));
|
|
745
758
|
}
|
|
746
759
|
}, Yt = {
|
|
747
|
-
id:
|
|
760
|
+
id: Te.id,
|
|
748
761
|
description: "find-replace.shortcut.go-to-next-match",
|
|
749
|
-
binding:
|
|
762
|
+
binding: M.ENTER,
|
|
750
763
|
group: E,
|
|
751
764
|
priority: 1e3,
|
|
752
765
|
preconditions(t) {
|
|
753
|
-
return
|
|
766
|
+
return Ue(t) && x(t);
|
|
754
767
|
}
|
|
755
768
|
}, Jt = {
|
|
756
|
-
id:
|
|
769
|
+
id: Oe.id,
|
|
757
770
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
758
|
-
binding:
|
|
771
|
+
binding: M.ENTER | D.SHIFT,
|
|
759
772
|
group: E,
|
|
760
773
|
priority: 1e3,
|
|
761
774
|
preconditions(t) {
|
|
762
|
-
return
|
|
775
|
+
return Ue(t) && x(t);
|
|
763
776
|
}
|
|
764
777
|
}, Qt = {
|
|
765
|
-
id:
|
|
778
|
+
id: Ee.id,
|
|
766
779
|
description: "find-replace.shortcut.focus-selection",
|
|
767
|
-
binding:
|
|
780
|
+
binding: M.ESC,
|
|
768
781
|
group: E,
|
|
769
782
|
priority: 1e3,
|
|
770
783
|
preconditions(t) {
|
|
771
|
-
return
|
|
784
|
+
return x(t);
|
|
772
785
|
}
|
|
773
786
|
};
|
|
774
787
|
function Xt(t) {
|
|
775
|
-
const e = t.get(
|
|
788
|
+
const e = t.get(ee);
|
|
776
789
|
return {
|
|
777
790
|
id: O.id,
|
|
778
791
|
icon: "SearchIcon",
|
|
779
792
|
tooltip: "find-replace.toolbar",
|
|
780
793
|
type: mt.BUTTON,
|
|
781
794
|
hidden$: gt(t, lt.UNIVER_SHEET),
|
|
782
|
-
disabled$:
|
|
783
|
-
e.subscribeContextValue$(
|
|
784
|
-
e.subscribeContextValue$(
|
|
795
|
+
disabled$: Me([
|
|
796
|
+
e.subscribeContextValue$(me),
|
|
797
|
+
e.subscribeContextValue$(ge)
|
|
785
798
|
]).pipe(xt(([n, i]) => n || !i))
|
|
786
799
|
};
|
|
787
800
|
}
|
|
@@ -797,13 +810,13 @@ var ti = Object.getOwnPropertyDescriptor, ii = (t, e, n, i) => {
|
|
|
797
810
|
for (var r = i > 1 ? void 0 : i ? ti(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
798
811
|
(a = t[s]) && (r = a(r) || r);
|
|
799
812
|
return r;
|
|
800
|
-
},
|
|
801
|
-
const
|
|
802
|
-
let
|
|
803
|
-
constructor(e, n, i, r, s, a, c, d, m
|
|
813
|
+
}, C = (t, e) => (n, i) => e(n, i, t);
|
|
814
|
+
const de = "DESKTOP_FIND_REPLACE_DIALOG", ke = 350, ni = 20, ri = 64;
|
|
815
|
+
let U = class extends dt {
|
|
816
|
+
constructor(e, n, i, r, s, a, c, d, m) {
|
|
804
817
|
super();
|
|
805
818
|
o(this, "_closingListenerDisposable");
|
|
806
|
-
this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = c, this._localeService = d, this._componentManager = m, this.
|
|
819
|
+
this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = c, this._localeService = d, this._componentManager = m, this._initCommands(), this._initUI(), this._initShortcuts();
|
|
807
820
|
}
|
|
808
821
|
dispose() {
|
|
809
822
|
var e;
|
|
@@ -812,12 +825,12 @@ let w = class extends dt {
|
|
|
812
825
|
_initCommands() {
|
|
813
826
|
[
|
|
814
827
|
O,
|
|
815
|
-
|
|
816
|
-
|
|
828
|
+
re,
|
|
829
|
+
Te,
|
|
830
|
+
Oe,
|
|
817
831
|
Pe,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
Te
|
|
832
|
+
xe,
|
|
833
|
+
Ee
|
|
821
834
|
].forEach((e) => {
|
|
822
835
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
823
836
|
});
|
|
@@ -835,20 +848,20 @@ let w = class extends dt {
|
|
|
835
848
|
_initUI() {
|
|
836
849
|
[
|
|
837
850
|
["FindReplaceDialog", jt],
|
|
838
|
-
["SearchIcon",
|
|
851
|
+
["SearchIcon", Ae]
|
|
839
852
|
].forEach(([e, n]) => {
|
|
840
853
|
this.disposeWithMe(
|
|
841
854
|
this._componentManager.register(e, n)
|
|
842
855
|
);
|
|
843
|
-
}), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(
|
|
856
|
+
}), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
844
857
|
e.revealed === !0 && this._openPanel();
|
|
845
858
|
});
|
|
846
859
|
}
|
|
847
860
|
_openPanel() {
|
|
848
861
|
this._dialogService.open({
|
|
849
|
-
id:
|
|
862
|
+
id: de,
|
|
850
863
|
draggable: !0,
|
|
851
|
-
width:
|
|
864
|
+
width: ke,
|
|
852
865
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
853
866
|
children: { label: "FindReplaceDialog" },
|
|
854
867
|
destroyOnClose: !0,
|
|
@@ -857,77 +870,76 @@ let w = class extends dt {
|
|
|
857
870
|
defaultPosition: si(),
|
|
858
871
|
preservePositionOnDestroy: !0,
|
|
859
872
|
onClose: () => this.closePanel()
|
|
860
|
-
}), this._closingListenerDisposable =
|
|
873
|
+
}), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
861
874
|
(!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
|
|
862
875
|
}));
|
|
863
876
|
}
|
|
864
877
|
closePanel() {
|
|
865
|
-
this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(
|
|
878
|
+
this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(de), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
|
|
866
879
|
}
|
|
867
880
|
};
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
], w);
|
|
881
|
+
U = ii([
|
|
882
|
+
C(0, _e),
|
|
883
|
+
C(1, St),
|
|
884
|
+
C(2, Ct),
|
|
885
|
+
C(3, k),
|
|
886
|
+
C(4, _),
|
|
887
|
+
C(5, Mt),
|
|
888
|
+
C(6, Se),
|
|
889
|
+
C(7, $(B)),
|
|
890
|
+
C(8, $(Rt))
|
|
891
|
+
], U);
|
|
880
892
|
function si() {
|
|
881
893
|
const { innerWidth: t } = window;
|
|
882
|
-
return { x: t -
|
|
894
|
+
return { x: t - ke - ni, y: ri };
|
|
883
895
|
}
|
|
884
|
-
const ai = "find-replace.config",
|
|
896
|
+
const ai = "find-replace.config", he = {};
|
|
885
897
|
var oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
|
|
886
898
|
for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
887
899
|
(a = t[s]) && (r = a(r) || r);
|
|
888
900
|
return r;
|
|
889
|
-
},
|
|
901
|
+
}, ue = (t, e) => (n, i) => e(n, i, t);
|
|
890
902
|
const li = "UNIVER_FIND_REPLACE_PLUGIN";
|
|
891
|
-
var
|
|
892
|
-
let
|
|
893
|
-
constructor(t =
|
|
903
|
+
var K;
|
|
904
|
+
let fe = (K = class extends ut {
|
|
905
|
+
constructor(t = he, e, n) {
|
|
894
906
|
super(), this._config = t, this._injector = e, this._configService = n;
|
|
895
907
|
const { ...i } = ft(
|
|
896
908
|
{},
|
|
897
|
-
|
|
909
|
+
he,
|
|
898
910
|
this._config
|
|
899
911
|
);
|
|
900
912
|
this._configService.setConfig(ai, i);
|
|
901
913
|
}
|
|
902
914
|
onStarting() {
|
|
903
915
|
[
|
|
904
|
-
[
|
|
905
|
-
[
|
|
916
|
+
[U],
|
|
917
|
+
[_, { useClass: X }]
|
|
906
918
|
].forEach((t) => this._injector.add(t));
|
|
907
919
|
}
|
|
908
920
|
onRendered() {
|
|
909
|
-
this._injector.get(
|
|
921
|
+
this._injector.get(U);
|
|
910
922
|
}
|
|
911
|
-
}, o(
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
],
|
|
923
|
+
}, o(K, "pluginName", li), K);
|
|
924
|
+
fe = ci([
|
|
925
|
+
ue(1, $(pe)),
|
|
926
|
+
ue(2, ht)
|
|
927
|
+
], fe);
|
|
916
928
|
export {
|
|
917
|
-
|
|
918
|
-
|
|
929
|
+
J as FindBy,
|
|
930
|
+
Y as FindDirection,
|
|
919
931
|
vi as FindModel,
|
|
920
|
-
|
|
921
|
-
|
|
932
|
+
U as FindReplaceController,
|
|
933
|
+
z as FindReplaceModel,
|
|
922
934
|
Nt as FindReplaceState,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
935
|
+
Q as FindScope,
|
|
936
|
+
Te as GoToNextMatchOperation,
|
|
937
|
+
Oe as GoToPreviousMatchOperation,
|
|
938
|
+
_ as IFindReplaceService,
|
|
927
939
|
O as OpenFindDialogOperation,
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
940
|
+
re as OpenReplaceDialogOperation,
|
|
941
|
+
Pe as ReplaceAllMatchesCommand,
|
|
942
|
+
xe as ReplaceCurrentMatchCommand,
|
|
943
|
+
fe as UniverFindReplacePlugin,
|
|
944
|
+
ne as createInitFindReplaceState
|
|
933
945
|
};
|