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