@univerjs/find-replace 0.5.5 → 0.6.0-alpha.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 +1 -9
- package/lib/es/index.js +339 -368
- package/lib/types/views/dialog/FindReplaceDialog.d.ts +1 -1
- package/lib/types/views/dialog/FindReplaceDialog.stories.d.ts +2 -3
- package/lib/types/views/dialog/SearchInput.d.ts +1 -2
- package/lib/umd/index.js +1 -9
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1,91 +1,92 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { createIdentifier as
|
|
5
|
-
import { IConfirmService as
|
|
6
|
-
import { throttleTime as
|
|
7
|
-
import { MessageType as E, InputWithSlot as
|
|
8
|
-
import { RENDER_RAW_FORMULA_KEY as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
var rt = Object.defineProperty;
|
|
2
|
+
var st = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var o = (t, e, n) => st(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { createIdentifier as at, Inject as D, Injector as Q, Disposable as X, DisposableCollection as ot, toDisposable as A, IUniverInstanceService as pe, IContextService as ee, CommandType as y, LocaleService as B, useDependency as S, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as ct, RxDisposable as lt, Plugin as dt, merge as ht, IConfigService as ut } from "@univerjs/core";
|
|
5
|
+
import { IConfirmService as ft, IMessageService as me, useObservable as F, ILayoutService as Se, KeyCode as M, MetaKeys as I, MenuItemType as pt, getMenuHiddenObservable as _t, RibbonStartGroup as gt, ComponentManager as mt, IMenuManagerService as St, IShortcutService as vt, IDialogService as Ct } from "@univerjs/ui";
|
|
6
|
+
import { throttleTime as Rt, BehaviorSubject as P, combineLatest as ve, debounceTime as Mt, Subject as Ce, fromEvent as bt, map as It, takeUntil as oe } from "rxjs";
|
|
7
|
+
import { MessageType as E, InputWithSlot as yt, Pager as Dt, Button as N, FormLayout as R, Input as Ft, Select as V, FormDualColumnLayout as ce, Checkbox as le } from "@univerjs/design";
|
|
8
|
+
import { RENDER_RAW_FORMULA_KEY as Pt } from "@univerjs/engine-render";
|
|
9
|
+
import { jsx as l, jsxs as b, Fragment as $ } from "react/jsx-runtime";
|
|
10
|
+
import { forwardRef as W, useRef as H, createElement as Re, useCallback as u, useEffect as L, useMemo as ie, useImperativeHandle as xt } from "react";
|
|
11
|
+
const Tt = "find-replace.config", de = {};
|
|
12
|
+
var _ = function() {
|
|
13
|
+
return _ = Object.assign || function(t) {
|
|
13
14
|
for (var e, n = 1, i = arguments.length; n < i; n++) {
|
|
14
15
|
e = arguments[n];
|
|
15
16
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
16
17
|
}
|
|
17
18
|
return t;
|
|
18
|
-
},
|
|
19
|
-
},
|
|
19
|
+
}, _.apply(this, arguments);
|
|
20
|
+
}, Ot = function(t, e) {
|
|
20
21
|
var n = {};
|
|
21
22
|
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
22
23
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
23
24
|
for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
|
|
24
25
|
e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
|
|
25
26
|
return n;
|
|
26
|
-
},
|
|
27
|
-
var n = t.icon, i = t.id, r = t.className, s = t.extend, a =
|
|
28
|
-
return
|
|
27
|
+
}, Me = W(function(t, e) {
|
|
28
|
+
var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Ot(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = H("_".concat($t()));
|
|
29
|
+
return be(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: c }, a), s);
|
|
29
30
|
});
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
return
|
|
31
|
+
function be(t, e, n, i, r) {
|
|
32
|
+
return Re(t.tag, _(_({ key: e }, Et(t, n, r)), i), (Nt(t, n).children || []).map(function(s, a) {
|
|
33
|
+
return be(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
|
|
33
34
|
}));
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
-
var i =
|
|
36
|
+
function Et(t, e, n) {
|
|
37
|
+
var i = _({}, t.attrs);
|
|
37
38
|
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
|
|
38
39
|
var r = e.defIds;
|
|
39
40
|
return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(s) {
|
|
40
|
-
var a = s[0],
|
|
41
|
-
typeof
|
|
41
|
+
var a = s[0], c = s[1];
|
|
42
|
+
typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
42
43
|
})), i;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function Nt(t, e) {
|
|
45
46
|
var n, i = e.defIds;
|
|
46
|
-
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ?
|
|
47
|
-
return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ?
|
|
47
|
+
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? _(_({}, t), { children: t.children.map(function(r) {
|
|
48
|
+
return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
48
49
|
}) }) : t;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function $t() {
|
|
51
52
|
return Math.random().toString(36).substring(2, 8);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
return
|
|
54
|
+
Me.displayName = "UniverIcon";
|
|
55
|
+
var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, Ie = W(function(t, e) {
|
|
56
|
+
return Re(Me, Object.assign({}, t, {
|
|
56
57
|
id: "search-single-16",
|
|
57
58
|
ref: e,
|
|
58
|
-
icon:
|
|
59
|
+
icon: At
|
|
59
60
|
}));
|
|
60
61
|
});
|
|
61
62
|
Ie.displayName = "SearchSingle16";
|
|
62
|
-
const
|
|
63
|
-
var
|
|
64
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
63
|
+
const ye = "FIND_REPLACE_INPUT_FOCUS", De = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
|
|
64
|
+
var Lt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
|
|
65
|
+
for (var r = i > 1 ? void 0 : i ? wt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
65
66
|
(a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
|
|
66
|
-
return i && r &&
|
|
67
|
-
},
|
|
68
|
-
class
|
|
67
|
+
return i && r && Lt(e, n, r), r;
|
|
68
|
+
}, K = (t, e) => (n, i) => e(n, i, t);
|
|
69
|
+
class Ii extends X {
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
-
function
|
|
71
|
+
const g = at("find-replace.service");
|
|
72
|
+
function Ut(t) {
|
|
72
73
|
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";
|
|
73
74
|
}
|
|
74
|
-
let
|
|
75
|
+
let z = class extends X {
|
|
75
76
|
constructor(e, n, i) {
|
|
76
77
|
super();
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
o(this, "currentMatch$", new P(null));
|
|
79
|
+
o(this, "replaceables$", new P([]));
|
|
79
80
|
/** All find models returned by providers. */
|
|
80
|
-
|
|
81
|
+
o(this, "_findModels", []);
|
|
81
82
|
/** The find model that the current match is from. */
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
o(this, "_matchingModel", null);
|
|
84
|
+
o(this, "_matches", []);
|
|
85
|
+
o(this, "_currentSearchingDisposables", null);
|
|
85
86
|
this._state = e, this._providers = n, this._univerInstanceService = i, this.disposeWithMe(
|
|
86
|
-
this._state.stateUpdates$.pipe(
|
|
87
|
+
this._state.stateUpdates$.pipe(Rt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
|
|
87
88
|
const s = this._state.state;
|
|
88
|
-
|
|
89
|
+
Ut(r) && (s.findString !== "" && !s.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
|
|
89
90
|
})
|
|
90
91
|
);
|
|
91
92
|
}
|
|
@@ -129,14 +130,14 @@ let J = class extends X {
|
|
|
129
130
|
}
|
|
130
131
|
// When a document's content changes, we should reset all matches and try to move to the next match.
|
|
131
132
|
_subscribeToModelsChanges(e) {
|
|
132
|
-
const n = this._currentSearchingDisposables = new
|
|
133
|
+
const n = this._currentSearchingDisposables = new ot(), i = ve(e.map((r) => r.matchesUpdate$)).pipe(Mt(220)).subscribe(([...r]) => {
|
|
133
134
|
const s = this._matches = r.flat();
|
|
134
135
|
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([]));
|
|
135
136
|
});
|
|
136
|
-
e.forEach((r) => n.add(
|
|
137
|
-
const a = this._matches.findIndex((
|
|
137
|
+
e.forEach((r) => n.add(A(r.activelyChangingMatch$.subscribe((s) => {
|
|
138
|
+
const a = this._matches.findIndex((c) => c === s);
|
|
138
139
|
this._state.changeState({ matchesPosition: a + 1 });
|
|
139
|
-
})))), n.add(
|
|
140
|
+
})))), n.add(A(i));
|
|
140
141
|
}
|
|
141
142
|
async replace() {
|
|
142
143
|
return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
|
|
@@ -186,9 +187,9 @@ let J = class extends X {
|
|
|
186
187
|
} else {
|
|
187
188
|
const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
|
|
188
189
|
for (let a = (r - 1 + i) % i; a !== r; ) {
|
|
189
|
-
const
|
|
190
|
-
if (
|
|
191
|
-
return this._matchingModel =
|
|
190
|
+
const c = this._findModels[a], d = c.moveToPreviousMatch({ ignoreSelection: !0 });
|
|
191
|
+
if (d)
|
|
192
|
+
return this._matchingModel = c, this._markMatch(d), d;
|
|
192
193
|
a = (a - 1) % i;
|
|
193
194
|
}
|
|
194
195
|
const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
|
|
@@ -210,10 +211,10 @@ let J = class extends X {
|
|
|
210
211
|
return this._moveToNextUnitMatch(r), 0;
|
|
211
212
|
}
|
|
212
213
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
],
|
|
216
|
-
var
|
|
214
|
+
z = Pe([
|
|
215
|
+
K(2, pe)
|
|
216
|
+
], z);
|
|
217
|
+
var q = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(q || {}), Y = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Z || {});
|
|
217
218
|
function ne() {
|
|
218
219
|
return {
|
|
219
220
|
caseSensitive: !1,
|
|
@@ -231,25 +232,25 @@ function ne() {
|
|
|
231
232
|
revealed: !0
|
|
232
233
|
};
|
|
233
234
|
}
|
|
234
|
-
class
|
|
235
|
+
class Bt {
|
|
235
236
|
constructor() {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
237
|
+
o(this, "_stateUpdates$", new Ce());
|
|
238
|
+
o(this, "stateUpdates$", this._stateUpdates$.asObservable());
|
|
239
|
+
o(this, "_state$", new P(ne()));
|
|
240
|
+
o(this, "state$", this._state$.asObservable());
|
|
241
|
+
o(this, "_findString", "");
|
|
242
|
+
o(this, "_inputtingFindString", "");
|
|
243
|
+
o(this, "_replaceString", "");
|
|
244
|
+
o(this, "_revealed", !1);
|
|
245
|
+
o(this, "_replaceRevealed", !1);
|
|
246
|
+
o(this, "_matchesPosition", 0);
|
|
247
|
+
o(this, "_matchesCount", 0);
|
|
248
|
+
o(this, "_caseSensitive", !0);
|
|
249
|
+
o(this, "_matchesTheWholeCell", !1);
|
|
250
|
+
o(this, "_findDirection", "row");
|
|
251
|
+
o(this, "_findScope", "subunit");
|
|
252
|
+
o(this, "_findBy", "value");
|
|
253
|
+
o(this, "_findCompleted", !1);
|
|
253
254
|
}
|
|
254
255
|
get state() {
|
|
255
256
|
return this._state$.getValue();
|
|
@@ -313,18 +314,18 @@ class Gt {
|
|
|
313
314
|
}), this._stateUpdates$.next(i));
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
|
-
let
|
|
317
|
+
let J = class extends X {
|
|
317
318
|
constructor(e, n) {
|
|
318
319
|
super();
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
o(this, "_providers", /* @__PURE__ */ new Set());
|
|
321
|
+
o(this, "_state", new Bt());
|
|
322
|
+
o(this, "_model");
|
|
323
|
+
o(this, "_currentMatch$", new P(null));
|
|
324
|
+
o(this, "currentMatch$", this._currentMatch$.asObservable());
|
|
325
|
+
o(this, "_replaceables$", new P([]));
|
|
326
|
+
o(this, "replaceables$", this._replaceables$.asObservable());
|
|
327
|
+
o(this, "_focusSignal$", new Ce());
|
|
328
|
+
o(this, "focusSignal$", this._focusSignal$.asObservable());
|
|
328
329
|
this._injector = e, this._contextService = n;
|
|
329
330
|
}
|
|
330
331
|
get stateUpdates$() {
|
|
@@ -402,7 +403,7 @@ let Z = class extends X {
|
|
|
402
403
|
start(e = !1) {
|
|
403
404
|
if (this._providers.size === 0)
|
|
404
405
|
return !1;
|
|
405
|
-
this._model = this._injector.createInstance(
|
|
406
|
+
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));
|
|
406
407
|
const n = ne();
|
|
407
408
|
return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
|
|
408
409
|
}
|
|
@@ -415,396 +416,366 @@ let Z = class extends X {
|
|
|
415
416
|
(e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
|
|
416
417
|
}
|
|
417
418
|
registerFindReplaceProvider(e) {
|
|
418
|
-
return this._providers.add(e),
|
|
419
|
+
return this._providers.add(e), A(() => this._providers.delete(e));
|
|
419
420
|
}
|
|
420
421
|
_toggleRevealReplace(e) {
|
|
421
|
-
this._contextService.setContextValue(
|
|
422
|
+
this._contextService.setContextValue(Fe, e);
|
|
422
423
|
}
|
|
423
424
|
_toggleDisplayRawFormula(e) {
|
|
424
|
-
this._contextService.setContextValue(
|
|
425
|
+
this._contextService.setContextValue(Pt, e);
|
|
425
426
|
}
|
|
426
427
|
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
],
|
|
431
|
-
const
|
|
428
|
+
J = Pe([
|
|
429
|
+
K(0, D(Q)),
|
|
430
|
+
K(1, ee)
|
|
431
|
+
], J);
|
|
432
|
+
const xe = {
|
|
432
433
|
id: "ui.command.replace-current-match",
|
|
433
434
|
type: y.COMMAND,
|
|
434
|
-
handler: (t) => t.get(
|
|
435
|
-
},
|
|
435
|
+
handler: (t) => t.get(g).replace()
|
|
436
|
+
}, Wt = "CONFIRM_REPLACE_ALL", Te = {
|
|
436
437
|
id: "ui.command.replace-all-matches",
|
|
437
438
|
type: y.COMMAND,
|
|
438
439
|
handler: async (t) => {
|
|
439
|
-
const e = t.get(
|
|
440
|
+
const e = t.get(ft), n = t.get(B), i = t.get(me);
|
|
440
441
|
if (!await e.confirm({
|
|
441
|
-
id:
|
|
442
|
+
id: Wt,
|
|
442
443
|
title: { title: n.t("find-replace.replace.confirm.title") },
|
|
443
444
|
cancelText: n.t("button.cancel"),
|
|
444
445
|
confirmText: n.t("button.confirm")
|
|
445
446
|
}))
|
|
446
447
|
return !1;
|
|
447
|
-
const s = await t.get(
|
|
448
|
-
return
|
|
448
|
+
const s = await t.get(g).replaceAll(), { success: a, failure: c } = s;
|
|
449
|
+
return c > 0 ? (a === 0 ? i.show({
|
|
449
450
|
type: E.Error,
|
|
450
451
|
content: n.t("find-replace.replace.all-failure")
|
|
451
452
|
}) : i.show({
|
|
452
453
|
type: E.Warning,
|
|
453
|
-
content: n.t("find-replace.replace.partial-success", `${a}`, `${
|
|
454
|
+
content: n.t("find-replace.replace.partial-success", `${a}`, `${c}`)
|
|
454
455
|
}), !1) : (i.show({
|
|
455
456
|
type: E.Success,
|
|
456
457
|
content: n.t("find-replace.replace.all-success", `${a}`)
|
|
457
458
|
}), !0);
|
|
458
459
|
}
|
|
459
|
-
},
|
|
460
|
+
}, x = {
|
|
460
461
|
id: "ui.operation.open-find-dialog",
|
|
461
462
|
type: y.OPERATION,
|
|
462
463
|
handler: (t) => {
|
|
463
|
-
const e = t.get(
|
|
464
|
+
const e = t.get(g);
|
|
464
465
|
return e.revealed ? e.focusFindInput() : e.start(), !0;
|
|
465
466
|
}
|
|
466
467
|
}, re = {
|
|
467
468
|
id: "ui.operation.open-replace-dialog",
|
|
468
469
|
type: y.OPERATION,
|
|
469
470
|
handler: (t) => {
|
|
470
|
-
const e = t.get(
|
|
471
|
+
const e = t.get(g);
|
|
471
472
|
return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
|
|
472
473
|
}
|
|
473
|
-
},
|
|
474
|
+
}, Oe = {
|
|
474
475
|
type: y.OPERATION,
|
|
475
476
|
id: "ui.operation.go-to-next-match",
|
|
476
|
-
handler: (t) => (t.get(
|
|
477
|
-
},
|
|
477
|
+
handler: (t) => (t.get(g).moveToNextMatch(), !0)
|
|
478
|
+
}, Ee = {
|
|
478
479
|
type: y.OPERATION,
|
|
479
480
|
id: "ui.operation.go-to-previous-match",
|
|
480
|
-
handler: (t) => (t.get(
|
|
481
|
+
handler: (t) => (t.get(g).moveToPreviousMatch(), !0)
|
|
482
|
+
}, jt = "univer-find-replace-dialog-container", Gt = "univer-find-replace-expand-container", Vt = "univer-button-text", kt = "univer-find-replace-buttons-group", Ht = "univer-find-replace-buttons-group-right", w = {
|
|
483
|
+
findReplaceDialogContainer: jt,
|
|
484
|
+
findReplaceExpandContainer: Gt,
|
|
485
|
+
buttonText: Vt,
|
|
486
|
+
findReplaceButtonsGroup: kt,
|
|
487
|
+
findReplaceButtonsGroupRight: Ht
|
|
481
488
|
};
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
*
|
|
487
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
488
|
-
*
|
|
489
|
-
* This source code is licensed under the MIT license found in the
|
|
490
|
-
* LICENSE file in the root directory of this source tree.
|
|
491
|
-
*/
|
|
492
|
-
var ue;
|
|
493
|
-
function Vt() {
|
|
494
|
-
if (ue) return I;
|
|
495
|
-
ue = 1;
|
|
496
|
-
var t = Tt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, r = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
497
|
-
function a(d, c, _) {
|
|
498
|
-
var u, h = {}, R = null, v = null;
|
|
499
|
-
_ !== void 0 && (R = "" + _), c.key !== void 0 && (R = "" + c.key), c.ref !== void 0 && (v = c.ref);
|
|
500
|
-
for (u in c) i.call(c, u) && !s.hasOwnProperty(u) && (h[u] = c[u]);
|
|
501
|
-
if (d && d.defaultProps) for (u in c = d.defaultProps, c) h[u] === void 0 && (h[u] = c[u]);
|
|
502
|
-
return { $$typeof: e, type: d, key: R, ref: v, props: h, _owner: r.current };
|
|
503
|
-
}
|
|
504
|
-
return I.Fragment = n, I.jsx = a, I.jsxs = a, I;
|
|
505
|
-
}
|
|
506
|
-
var he;
|
|
507
|
-
function Ht() {
|
|
508
|
-
return he || (he = 1, k.exports = Vt()), k.exports;
|
|
509
|
-
}
|
|
510
|
-
var o = Ht();
|
|
511
|
-
const qt = "univer-find-replace-dialog-container", Jt = "univer-find-replace-expand-container", Kt = "univer-button-text", zt = "univer-find-replace-buttons-group", Yt = "univer-find-replace-buttons-group-right", L = {
|
|
512
|
-
findReplaceDialogContainer: qt,
|
|
513
|
-
findReplaceExpandContainer: Jt,
|
|
514
|
-
buttonText: Kt,
|
|
515
|
-
findReplaceButtonsGroup: zt,
|
|
516
|
-
findReplaceButtonsGroupRight: Yt
|
|
517
|
-
};
|
|
518
|
-
function Ae(t) {
|
|
519
|
-
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: d, ...c } = t, u = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
|
|
520
|
-
return /* @__PURE__ */ o.jsx(
|
|
521
|
-
Ft,
|
|
489
|
+
function Ne(t) {
|
|
490
|
+
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: c, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
|
|
491
|
+
return /* @__PURE__ */ l(
|
|
492
|
+
yt,
|
|
522
493
|
{
|
|
523
494
|
autoFocus: !0,
|
|
524
495
|
placeholder: n.t("find-replace.dialog.find-placeholder"),
|
|
525
|
-
slot: /* @__PURE__ */
|
|
496
|
+
slot: /* @__PURE__ */ l(
|
|
526
497
|
Dt,
|
|
527
498
|
{
|
|
528
499
|
loop: !0,
|
|
529
|
-
text:
|
|
500
|
+
text: f,
|
|
530
501
|
value: r,
|
|
531
502
|
total: i,
|
|
532
|
-
onChange: (
|
|
533
|
-
r === i &&
|
|
503
|
+
onChange: (p) => {
|
|
504
|
+
r === i && p === 1 ? a.moveToNextMatch() : r === 1 && p === i || p < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
|
|
534
505
|
}
|
|
535
506
|
}
|
|
536
507
|
),
|
|
537
508
|
value: s,
|
|
538
|
-
onChange: (
|
|
539
|
-
...
|
|
509
|
+
onChange: (p) => c == null ? void 0 : c(p),
|
|
510
|
+
...d
|
|
540
511
|
}
|
|
541
512
|
);
|
|
542
513
|
}
|
|
543
|
-
function
|
|
544
|
-
const n =
|
|
514
|
+
function $e(t, e) {
|
|
515
|
+
const n = u(() => {
|
|
545
516
|
var r;
|
|
546
517
|
(r = document.querySelector(".univer-find-input input")) == null || r.focus();
|
|
547
|
-
}, []), i =
|
|
518
|
+
}, []), i = u(() => {
|
|
548
519
|
const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
|
|
549
520
|
return Array.from(r).some((s) => s === document.activeElement);
|
|
550
521
|
}, []);
|
|
551
|
-
return
|
|
522
|
+
return xt(e, () => ({ focus: n, selectHasFocus: i })), L(() => {
|
|
552
523
|
const r = t.focusSignal$.subscribe(() => n());
|
|
553
524
|
return () => r.unsubscribe();
|
|
554
525
|
}, [t, n]), { focus: n, selectHasFocus: i };
|
|
555
526
|
}
|
|
556
|
-
const
|
|
557
|
-
const i =
|
|
527
|
+
const Kt = W(function(e, n) {
|
|
528
|
+
const i = S(B), r = S(g), s = S(te), a = F(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: v, matchesPosition: f } = a, p = u(() => {
|
|
558
529
|
s.executeCommand(re.id);
|
|
559
|
-
}, [s]),
|
|
560
|
-
return
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
|
|
530
|
+
}, [s]), O = u((C) => r.changeFindString(C), [r]);
|
|
531
|
+
return $e(r, n), /* @__PURE__ */ b($, { children: [
|
|
532
|
+
/* @__PURE__ */ l(
|
|
533
|
+
Ne,
|
|
563
534
|
{
|
|
564
|
-
findCompleted:
|
|
535
|
+
findCompleted: c,
|
|
565
536
|
className: "univer-find-input",
|
|
566
|
-
matchesCount:
|
|
567
|
-
matchesPosition:
|
|
537
|
+
matchesCount: v,
|
|
538
|
+
matchesPosition: f,
|
|
568
539
|
findReplaceService: r,
|
|
569
540
|
localeService: i,
|
|
570
|
-
findString:
|
|
571
|
-
onChange:
|
|
541
|
+
findString: d,
|
|
542
|
+
onChange: O
|
|
572
543
|
}
|
|
573
544
|
),
|
|
574
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ l("div", { className: w.findReplaceExpandContainer, children: /* @__PURE__ */ l(N, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
|
|
575
546
|
] });
|
|
576
|
-
}),
|
|
577
|
-
const i =
|
|
578
|
-
matchesCount:
|
|
579
|
-
matchesPosition:
|
|
580
|
-
findString:
|
|
581
|
-
inputtingFindString:
|
|
582
|
-
replaceString:
|
|
583
|
-
caseSensitive:
|
|
584
|
-
matchesTheWholeCell:
|
|
585
|
-
findDirection:
|
|
586
|
-
findScope:
|
|
587
|
-
findBy:
|
|
588
|
-
findCompleted:
|
|
589
|
-
} =
|
|
590
|
-
(
|
|
547
|
+
}), zt = W(function(e, n) {
|
|
548
|
+
const i = S(g), r = S(B), s = S(te), a = S(me), c = F(i.currentMatch$, void 0, !0), d = F(i.replaceables$, void 0, !0), v = F(i.state$, void 0, !0), {
|
|
549
|
+
matchesCount: f,
|
|
550
|
+
matchesPosition: p,
|
|
551
|
+
findString: O,
|
|
552
|
+
inputtingFindString: C,
|
|
553
|
+
replaceString: we,
|
|
554
|
+
caseSensitive: Ue,
|
|
555
|
+
matchesTheWholeCell: Be,
|
|
556
|
+
findDirection: We,
|
|
557
|
+
findScope: je,
|
|
558
|
+
findBy: Ge,
|
|
559
|
+
findCompleted: G
|
|
560
|
+
} = v, Ve = C.length === 0, ke = f === 0 || !(c != null && c.replaceable), He = d.length === 0, Ke = u(
|
|
561
|
+
(h) => i.changeInputtingFindString(h),
|
|
591
562
|
[i]
|
|
592
|
-
), ze =
|
|
593
|
-
(
|
|
563
|
+
), ze = u(
|
|
564
|
+
(h) => i.changeReplaceString(h),
|
|
594
565
|
[i]
|
|
595
|
-
), { focus:
|
|
596
|
-
|
|
597
|
-
}, [
|
|
598
|
-
await s.executeCommand(
|
|
599
|
-
}, [s]),
|
|
600
|
-
i.changeFindDirection(
|
|
601
|
-
}, [i]),
|
|
602
|
-
i.changeFindScope(
|
|
603
|
-
}, [i]),
|
|
604
|
-
i.changeFindBy(
|
|
605
|
-
}, [i]),
|
|
606
|
-
return
|
|
607
|
-
|
|
566
|
+
), { focus: qe } = $e(i, n), Ye = u(() => {
|
|
567
|
+
O === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
|
|
568
|
+
}, [O, C, i]), Ze = u(() => s.executeCommand(xe.id), [s]), Je = u(async () => {
|
|
569
|
+
await s.executeCommand(Te.id), qe();
|
|
570
|
+
}, [s]), Qe = u((h) => {
|
|
571
|
+
i.changeFindDirection(h);
|
|
572
|
+
}, [i]), Xe = u((h) => {
|
|
573
|
+
i.changeFindScope(h);
|
|
574
|
+
}, [i]), et = u((h) => {
|
|
575
|
+
i.changeFindBy(h);
|
|
576
|
+
}, [i]), tt = Yt(r), it = Zt(r), nt = Jt(r);
|
|
577
|
+
return L(() => {
|
|
578
|
+
G && f === 0 && a.show({
|
|
608
579
|
content: r.t("find-replace.dialog.no-match"),
|
|
609
580
|
type: E.Warning,
|
|
610
581
|
duration: 5e3
|
|
611
582
|
});
|
|
612
|
-
}, [
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
|
|
583
|
+
}, [G, f, a, r]), /* @__PURE__ */ b($, { children: [
|
|
584
|
+
/* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
|
|
585
|
+
Ne,
|
|
615
586
|
{
|
|
616
|
-
findCompleted:
|
|
587
|
+
findCompleted: G,
|
|
617
588
|
className: "univer-find-input",
|
|
618
|
-
matchesCount:
|
|
619
|
-
matchesPosition:
|
|
589
|
+
matchesCount: f,
|
|
590
|
+
matchesPosition: p,
|
|
620
591
|
findReplaceService: i,
|
|
621
592
|
localeService: r,
|
|
622
|
-
findString:
|
|
593
|
+
findString: C,
|
|
623
594
|
onChange: Ke
|
|
624
595
|
}
|
|
625
596
|
) }),
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
|
|
597
|
+
/* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
|
|
598
|
+
Ft,
|
|
628
599
|
{
|
|
629
600
|
placeholder: r.t("find-replace.dialog.replace-placeholder"),
|
|
630
|
-
value:
|
|
631
|
-
onChange: (
|
|
601
|
+
value: we,
|
|
602
|
+
onChange: (h) => ze(h)
|
|
632
603
|
}
|
|
633
604
|
) }),
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(V, { value: We, options: it, onChange: Qe }) }),
|
|
606
|
+
/* @__PURE__ */ l(ce, { children: /* @__PURE__ */ b($, { children: [
|
|
607
|
+
/* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(V, { value: je, options: tt, onChange: Xe }) }),
|
|
608
|
+
/* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(V, { value: Ge, options: nt, onChange: et }) })
|
|
638
609
|
] }) }),
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
/* @__PURE__ */
|
|
610
|
+
/* @__PURE__ */ l(ce, { children: /* @__PURE__ */ b($, { children: [
|
|
611
|
+
/* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
|
|
641
612
|
le,
|
|
642
613
|
{
|
|
643
|
-
checked:
|
|
644
|
-
onChange: (
|
|
645
|
-
i.changeCaseSensitive(
|
|
614
|
+
checked: Ue,
|
|
615
|
+
onChange: (h) => {
|
|
616
|
+
i.changeCaseSensitive(h);
|
|
646
617
|
},
|
|
647
618
|
children: r.t("find-replace.dialog.case-sensitive")
|
|
648
619
|
}
|
|
649
620
|
) }),
|
|
650
|
-
/* @__PURE__ */
|
|
621
|
+
/* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
|
|
651
622
|
le,
|
|
652
623
|
{
|
|
653
|
-
checked:
|
|
654
|
-
onChange: (
|
|
655
|
-
i.changeMatchesTheWholeCell(
|
|
624
|
+
checked: Be,
|
|
625
|
+
onChange: (h) => {
|
|
626
|
+
i.changeMatchesTheWholeCell(h);
|
|
656
627
|
},
|
|
657
628
|
children: r.t("find-replace.dialog.match-the-whole-cell")
|
|
658
629
|
}
|
|
659
630
|
) })
|
|
660
631
|
] }) }),
|
|
661
|
-
/* @__PURE__ */
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ b("div", { className: w.findReplaceButtonsGroup, children: [
|
|
633
|
+
/* @__PURE__ */ l(N, { type: "primary", onClick: Ye, disabled: Ve, children: r.t("find-replace.dialog.find") }),
|
|
634
|
+
/* @__PURE__ */ b("span", { className: w.findReplaceButtonsGroupRight, children: [
|
|
635
|
+
/* @__PURE__ */ l(N, { disabled: ke, onClick: Ze, children: r.t("find-replace.dialog.replace") }),
|
|
636
|
+
/* @__PURE__ */ l(N, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace-all") })
|
|
666
637
|
] })
|
|
667
638
|
] })
|
|
668
639
|
] });
|
|
669
640
|
});
|
|
670
|
-
function
|
|
671
|
-
const t =
|
|
672
|
-
|
|
673
|
-
let
|
|
674
|
-
return r.current && (
|
|
641
|
+
function qt() {
|
|
642
|
+
const t = S(g), e = S(Se), n = S(ee), i = F(t.state$, void 0, !0), r = H(null);
|
|
643
|
+
L(() => {
|
|
644
|
+
let d;
|
|
645
|
+
return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
|
|
675
646
|
}, [e]);
|
|
676
|
-
const s = H(null), a =
|
|
677
|
-
(
|
|
647
|
+
const s = H(null), a = u(
|
|
648
|
+
(d) => n.setContextValue(De, d),
|
|
678
649
|
[n]
|
|
679
|
-
),
|
|
680
|
-
(
|
|
650
|
+
), c = u(
|
|
651
|
+
(d) => n.setContextValue(ye, d),
|
|
681
652
|
[n]
|
|
682
653
|
);
|
|
683
|
-
return
|
|
684
|
-
var
|
|
685
|
-
const
|
|
686
|
-
var
|
|
687
|
-
|
|
654
|
+
return L(() => {
|
|
655
|
+
var v;
|
|
656
|
+
const d = bt(document, "focusin").subscribe((f) => {
|
|
657
|
+
var p;
|
|
658
|
+
f.target && ((p = r.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
|
|
688
659
|
});
|
|
689
|
-
return (
|
|
690
|
-
|
|
660
|
+
return (v = s.current) == null || v.focus(), a(!0), c(!0), () => {
|
|
661
|
+
d.unsubscribe(), a(!1);
|
|
691
662
|
};
|
|
692
|
-
}, [a,
|
|
663
|
+
}, [a, c]), /* @__PURE__ */ l("div", { className: w.findReplaceDialogContainer, ref: r, children: i.replaceRevealed ? /* @__PURE__ */ l(zt, { ref: s }) : /* @__PURE__ */ l(Kt, { ref: s }) });
|
|
693
664
|
}
|
|
694
|
-
function
|
|
665
|
+
function Yt(t) {
|
|
695
666
|
const e = t.getCurrentLocale();
|
|
696
667
|
return ie(() => [
|
|
697
|
-
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value:
|
|
698
|
-
{ label: t.t("find-replace.dialog.find-scope.workbook"), value:
|
|
668
|
+
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Z.SUBUNIT },
|
|
669
|
+
{ label: t.t("find-replace.dialog.find-scope.workbook"), value: Z.UNIT }
|
|
699
670
|
], [e]);
|
|
700
671
|
}
|
|
701
|
-
function
|
|
672
|
+
function Zt(t) {
|
|
702
673
|
const e = t.getCurrentLocale();
|
|
703
674
|
return ie(() => [
|
|
704
|
-
{ label: t.t("find-replace.dialog.find-direction.row"), value:
|
|
705
|
-
{ label: t.t("find-replace.dialog.find-direction.column"), value:
|
|
675
|
+
{ label: t.t("find-replace.dialog.find-direction.row"), value: q.ROW },
|
|
676
|
+
{ label: t.t("find-replace.dialog.find-direction.column"), value: q.COLUMN }
|
|
706
677
|
], [e]);
|
|
707
678
|
}
|
|
708
|
-
function
|
|
679
|
+
function Jt(t) {
|
|
709
680
|
const e = t.getCurrentLocale();
|
|
710
681
|
return ie(() => [
|
|
711
|
-
{ label: t.t("find-replace.dialog.find-by.value"), value:
|
|
712
|
-
{ label: t.t("find-replace.dialog.find-by.formula"), value:
|
|
682
|
+
{ label: t.t("find-replace.dialog.find-by.value"), value: Y.VALUE },
|
|
683
|
+
{ label: t.t("find-replace.dialog.find-by.formula"), value: Y.FORMULA }
|
|
713
684
|
], [e]);
|
|
714
685
|
}
|
|
715
686
|
function T(t) {
|
|
716
687
|
return t.getContextValue(De);
|
|
717
688
|
}
|
|
718
|
-
function
|
|
719
|
-
return t.getContextValue(Pe);
|
|
720
|
-
}
|
|
721
|
-
function je(t) {
|
|
689
|
+
function Qt(t) {
|
|
722
690
|
return t.getContextValue(Fe);
|
|
723
691
|
}
|
|
724
|
-
|
|
692
|
+
function Ae(t) {
|
|
693
|
+
return t.getContextValue(ye);
|
|
694
|
+
}
|
|
695
|
+
const j = "7_find-replace-shortcuts";
|
|
725
696
|
function se(t) {
|
|
726
|
-
return t.getContextValue(
|
|
697
|
+
return t.getContextValue(_e);
|
|
727
698
|
}
|
|
728
699
|
function ae(t) {
|
|
729
|
-
return !t.getContextValue(
|
|
700
|
+
return !t.getContextValue(ge);
|
|
730
701
|
}
|
|
731
|
-
const
|
|
732
|
-
id:
|
|
702
|
+
const Xt = {
|
|
703
|
+
id: x.id,
|
|
733
704
|
description: "find-replace.shortcut.open-find-dialog",
|
|
734
|
-
binding:
|
|
735
|
-
group:
|
|
705
|
+
binding: M.F | I.CTRL_COMMAND,
|
|
706
|
+
group: j,
|
|
736
707
|
preconditions(t) {
|
|
737
708
|
return !T(t) && se(t) && ae(t);
|
|
738
709
|
}
|
|
739
|
-
},
|
|
740
|
-
id:
|
|
710
|
+
}, ei = {
|
|
711
|
+
id: x.id,
|
|
741
712
|
description: "find-replace.shortcut.open-find-dialog",
|
|
742
|
-
binding:
|
|
743
|
-
mac:
|
|
713
|
+
binding: M.F | I.CTRL_COMMAND,
|
|
714
|
+
mac: M.F | I.MAC_CTRL,
|
|
744
715
|
preconditions(t) {
|
|
745
716
|
return !T(t) && se(t) && ae(t);
|
|
746
717
|
}
|
|
747
|
-
},
|
|
718
|
+
}, ti = {
|
|
748
719
|
id: re.id,
|
|
749
720
|
description: "find-replace.shortcut.open-replace-dialog",
|
|
750
|
-
binding:
|
|
751
|
-
mac:
|
|
752
|
-
group:
|
|
721
|
+
binding: M.H | I.CTRL_COMMAND,
|
|
722
|
+
mac: M.H | I.MAC_CTRL,
|
|
723
|
+
group: j,
|
|
753
724
|
preconditions(t) {
|
|
754
|
-
return se(t) && ae(t) && (!T(t) || !
|
|
725
|
+
return se(t) && ae(t) && (!T(t) || !Qt(t));
|
|
755
726
|
}
|
|
756
|
-
},
|
|
757
|
-
id:
|
|
727
|
+
}, ii = {
|
|
728
|
+
id: Oe.id,
|
|
758
729
|
description: "find-replace.shortcut.go-to-next-match",
|
|
759
|
-
binding:
|
|
760
|
-
group:
|
|
730
|
+
binding: M.ENTER,
|
|
731
|
+
group: j,
|
|
761
732
|
priority: 1e3,
|
|
762
733
|
preconditions(t) {
|
|
763
|
-
return
|
|
734
|
+
return Ae(t) && T(t);
|
|
764
735
|
}
|
|
765
|
-
},
|
|
766
|
-
id:
|
|
736
|
+
}, ni = {
|
|
737
|
+
id: Ee.id,
|
|
767
738
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
768
|
-
binding:
|
|
769
|
-
group:
|
|
739
|
+
binding: M.ENTER | I.SHIFT,
|
|
740
|
+
group: j,
|
|
770
741
|
priority: 1e3,
|
|
771
742
|
preconditions(t) {
|
|
772
|
-
return
|
|
743
|
+
return Ae(t) && T(t);
|
|
773
744
|
}
|
|
774
745
|
};
|
|
775
|
-
function
|
|
746
|
+
function ri(t) {
|
|
776
747
|
const e = t.get(ee);
|
|
777
748
|
return {
|
|
778
|
-
id:
|
|
749
|
+
id: x.id,
|
|
779
750
|
icon: "SearchIcon",
|
|
780
751
|
tooltip: "find-replace.toolbar",
|
|
781
|
-
type:
|
|
782
|
-
hidden$:
|
|
783
|
-
disabled$:
|
|
784
|
-
e.subscribeContextValue$(
|
|
785
|
-
e.subscribeContextValue$(
|
|
752
|
+
type: pt.BUTTON,
|
|
753
|
+
hidden$: _t(t, ct.UNIVER_SHEET),
|
|
754
|
+
disabled$: ve([
|
|
755
|
+
e.subscribeContextValue$(ge),
|
|
756
|
+
e.subscribeContextValue$(_e)
|
|
786
757
|
]).pipe(It(([n, i]) => n || !i))
|
|
787
758
|
};
|
|
788
759
|
}
|
|
789
|
-
const
|
|
790
|
-
[
|
|
791
|
-
[
|
|
760
|
+
const si = {
|
|
761
|
+
[gt.OTHERS]: {
|
|
762
|
+
[x.id]: {
|
|
792
763
|
order: 2,
|
|
793
|
-
menuItemFactory:
|
|
764
|
+
menuItemFactory: ri
|
|
794
765
|
}
|
|
795
766
|
}
|
|
796
767
|
};
|
|
797
|
-
var
|
|
798
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
768
|
+
var ai = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
|
|
769
|
+
for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
799
770
|
(a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
|
|
800
|
-
return i && r &&
|
|
801
|
-
},
|
|
802
|
-
const
|
|
803
|
-
let
|
|
804
|
-
constructor(e, n, i, r, s, a,
|
|
771
|
+
return i && r && ai(e, n, r), r;
|
|
772
|
+
}, m = (t, e) => (n, i) => e(n, i, t);
|
|
773
|
+
const he = "DESKTOP_FIND_REPLACE_DIALOG", Le = 350, li = 20, di = -90;
|
|
774
|
+
let U = class extends lt {
|
|
775
|
+
constructor(e, n, i, r, s, a, c, d, v, f) {
|
|
805
776
|
super();
|
|
806
|
-
|
|
807
|
-
this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService =
|
|
777
|
+
o(this, "_closingListenerDisposable");
|
|
778
|
+
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 = v, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
|
|
808
779
|
}
|
|
809
780
|
dispose() {
|
|
810
781
|
var e;
|
|
@@ -812,111 +783,111 @@ let j = class extends ut {
|
|
|
812
783
|
}
|
|
813
784
|
_initCommands() {
|
|
814
785
|
[
|
|
815
|
-
|
|
786
|
+
x,
|
|
816
787
|
re,
|
|
817
|
-
|
|
818
|
-
$e,
|
|
788
|
+
Oe,
|
|
819
789
|
Ee,
|
|
820
|
-
Te
|
|
790
|
+
Te,
|
|
791
|
+
xe
|
|
821
792
|
].forEach((e) => {
|
|
822
793
|
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
823
794
|
});
|
|
824
795
|
}
|
|
825
796
|
_initShortcuts() {
|
|
826
797
|
[
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
798
|
+
ti,
|
|
799
|
+
Xt,
|
|
800
|
+
ei,
|
|
801
|
+
ni,
|
|
802
|
+
ii
|
|
832
803
|
].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
|
|
833
804
|
}
|
|
834
805
|
_initUI() {
|
|
835
|
-
this.disposeWithMe(this._componentManager.register("FindReplaceDialog",
|
|
806
|
+
this.disposeWithMe(this._componentManager.register("FindReplaceDialog", qt)), this.disposeWithMe(this._componentManager.register("SearchIcon", Ie)), this._menuManagerService.mergeMenu(si), this._findReplaceService.stateUpdates$.pipe(oe(this.dispose$)).subscribe((e) => {
|
|
836
807
|
e.revealed === !0 && this._openPanel();
|
|
837
808
|
});
|
|
838
809
|
}
|
|
839
810
|
_openPanel() {
|
|
840
811
|
this._dialogService.open({
|
|
841
|
-
id:
|
|
812
|
+
id: he,
|
|
842
813
|
draggable: !0,
|
|
843
|
-
width:
|
|
814
|
+
width: Le,
|
|
844
815
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
845
816
|
children: { label: "FindReplaceDialog" },
|
|
846
817
|
destroyOnClose: !0,
|
|
847
|
-
defaultPosition:
|
|
818
|
+
defaultPosition: hi(),
|
|
848
819
|
preservePositionOnDestroy: !0,
|
|
849
820
|
onClose: () => this.closePanel()
|
|
850
|
-
}), this._closingListenerDisposable =
|
|
821
|
+
}), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((e) => {
|
|
851
822
|
(!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
|
|
852
823
|
}));
|
|
853
824
|
}
|
|
854
825
|
closePanel() {
|
|
855
|
-
this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(
|
|
826
|
+
this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(he), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
|
|
856
827
|
}
|
|
857
828
|
};
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
],
|
|
870
|
-
function
|
|
829
|
+
U = ci([
|
|
830
|
+
m(0, pe),
|
|
831
|
+
m(1, St),
|
|
832
|
+
m(2, vt),
|
|
833
|
+
m(3, te),
|
|
834
|
+
m(4, g),
|
|
835
|
+
m(5, Ct),
|
|
836
|
+
m(6, Se),
|
|
837
|
+
m(7, D(B)),
|
|
838
|
+
m(8, D(mt)),
|
|
839
|
+
m(9, D(Q))
|
|
840
|
+
], U);
|
|
841
|
+
function hi() {
|
|
871
842
|
const { innerWidth: t } = window;
|
|
872
|
-
return { x: (t -
|
|
843
|
+
return { x: (t - Le) / 2 - li, y: di };
|
|
873
844
|
}
|
|
874
|
-
var
|
|
875
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
845
|
+
var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, pi = (t, e, n, i) => {
|
|
846
|
+
for (var r = i > 1 ? void 0 : i ? fi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
876
847
|
(a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
|
|
877
|
-
return i && r &&
|
|
878
|
-
},
|
|
879
|
-
const
|
|
880
|
-
var
|
|
881
|
-
let
|
|
848
|
+
return i && r && ui(e, n, r), r;
|
|
849
|
+
}, ue = (t, e) => (n, i) => e(n, i, t);
|
|
850
|
+
const _i = "UNIVER_FIND_REPLACE_PLUGIN";
|
|
851
|
+
var k;
|
|
852
|
+
let fe = (k = class extends dt {
|
|
882
853
|
constructor(t = de, e, n) {
|
|
883
854
|
super(), this._config = t, this._injector = e, this._configService = n;
|
|
884
|
-
const { ...i } =
|
|
855
|
+
const { ...i } = ht(
|
|
885
856
|
{},
|
|
886
857
|
de,
|
|
887
858
|
this._config
|
|
888
859
|
);
|
|
889
|
-
this._configService.setConfig(
|
|
860
|
+
this._configService.setConfig(Tt, i);
|
|
890
861
|
}
|
|
891
862
|
onStarting() {
|
|
892
863
|
[
|
|
893
|
-
[
|
|
894
|
-
[
|
|
864
|
+
[U],
|
|
865
|
+
[g, { useClass: J }]
|
|
895
866
|
].forEach((t) => this._injector.add(t));
|
|
896
867
|
}
|
|
897
868
|
onRendered() {
|
|
898
|
-
this._injector.get(
|
|
869
|
+
this._injector.get(U);
|
|
899
870
|
}
|
|
900
|
-
},
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
],
|
|
871
|
+
}, o(k, "pluginName", _i), k);
|
|
872
|
+
fe = pi([
|
|
873
|
+
ue(1, D(Q)),
|
|
874
|
+
ue(2, ut)
|
|
875
|
+
], fe);
|
|
905
876
|
export {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
877
|
+
Y as FindBy,
|
|
878
|
+
q as FindDirection,
|
|
879
|
+
Ii as FindModel,
|
|
880
|
+
U as FindReplaceController,
|
|
881
|
+
z as FindReplaceModel,
|
|
882
|
+
Bt as FindReplaceState,
|
|
883
|
+
Z as FindScope,
|
|
884
|
+
Oe as GoToNextMatchOperation,
|
|
885
|
+
Ee as GoToPreviousMatchOperation,
|
|
886
|
+
g as IFindReplaceService,
|
|
887
|
+
x as OpenFindDialogOperation,
|
|
917
888
|
re as OpenReplaceDialogOperation,
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
889
|
+
Te as ReplaceAllMatchesCommand,
|
|
890
|
+
xe as ReplaceCurrentMatchCommand,
|
|
891
|
+
fe as UniverFindReplacePlugin,
|
|
921
892
|
ne as createInitFindReplaceState
|
|
922
893
|
};
|