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