@univerjs/find-replace 0.1.11 → 0.1.12
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 +313 -307
- package/lib/types/controllers/find-replace.controller.d.ts +8 -5
- package/lib/types/plugin.d.ts +4 -2
- package/lib/umd/index.js +2 -2
- package/package.json +14 -14
package/lib/es/index.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var ot = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var c = (t, e, n) => (ot(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { createIdentifier as
|
|
6
|
-
import { IConfirmService as
|
|
7
|
-
import { BehaviorSubject as
|
|
8
|
-
import { RENDER_RAW_FORMULA_KEY as
|
|
9
|
-
import
|
|
10
|
-
import { MessageType as
|
|
4
|
+
import { Disposable as X, IUniverInstanceService as pe, ILogService as ct, toDisposable as q, IContextService as ee, DisposableCollection as lt, CommandType as y, LocaleService as P, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as dt, RxDisposable as ht, OnLifecycle as ut, LifecycleStages as ft, Plugin as pt, Tools as _t } from "@univerjs/core";
|
|
5
|
+
import { createIdentifier as gt, Inject as M, Injector as ie } from "@wendellhu/redi";
|
|
6
|
+
import { IConfirmService as mt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as b, MetaKeys as x, MenuGroup as vt, MenuItemType as St, MenuPosition as Ct, getMenuHiddenObservable as Rt, ComponentManager as bt, IMenuService as Mt, IShortcutService as xt, IDialogService as yt } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as D, Subject as Se, throttleTime as It, combineLatest as Ce, debounceTime as Ft, fromEvent as Dt, map as Pt, takeUntil as ce } from "rxjs";
|
|
8
|
+
import { RENDER_RAW_FORMULA_KEY as Ot } from "@univerjs/engine-render";
|
|
9
|
+
import Tt, { forwardRef as U, useRef as z, createElement as Re, useCallback as _, Fragment as $, useEffect as w, useMemo as ne, useImperativeHandle as Et } from "react";
|
|
10
|
+
import { MessageType as N, InputWithSlot as $t, Pager as Nt, Button as A, FormLayout as R, Input as At, Select as V, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
|
|
11
11
|
import { useDependency as S } from "@wendellhu/redi/react-bindings";
|
|
12
|
-
var
|
|
13
|
-
return
|
|
12
|
+
var g = function() {
|
|
13
|
+
return g = Object.assign || function(t) {
|
|
14
14
|
for (var e, n = 1, i = arguments.length; n < i; n++) {
|
|
15
15
|
e = arguments[n];
|
|
16
|
-
for (var
|
|
17
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
16
|
+
for (var s in e)
|
|
17
|
+
Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
20
|
+
}, g.apply(this, arguments);
|
|
21
|
+
}, wt = function(t, e) {
|
|
22
22
|
var n = {};
|
|
23
23
|
for (var i in t)
|
|
24
24
|
Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
25
25
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
26
|
-
for (var
|
|
27
|
-
e.indexOf(i[
|
|
26
|
+
for (var s = 0, i = Object.getOwnPropertySymbols(t); s < i.length; s++)
|
|
27
|
+
e.indexOf(i[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[s]) && (n[i[s]] = t[i[s]]);
|
|
28
28
|
return n;
|
|
29
|
-
}, be =
|
|
30
|
-
var n = t.icon, i = t.id,
|
|
31
|
-
return
|
|
29
|
+
}, be = U(function(t, e) {
|
|
30
|
+
var n = t.icon, i = t.id, s = t.className, r = t.extend, a = wt(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(Ut()));
|
|
31
|
+
return Me(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, g({ ref: e, className: o }, a), r);
|
|
32
32
|
});
|
|
33
|
-
function
|
|
34
|
-
return Re(t.tag,
|
|
35
|
-
return
|
|
33
|
+
function Me(t, e, n, i, s) {
|
|
34
|
+
return Re(t.tag, g(g({ key: e }, jt(t, n, s)), i), (Lt(t, n).children || []).map(function(r, a) {
|
|
35
|
+
return Me(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
var i =
|
|
38
|
+
function jt(t, e, n) {
|
|
39
|
+
var i = g({}, t.attrs);
|
|
40
40
|
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
|
|
41
|
-
var
|
|
42
|
-
return !
|
|
43
|
-
var a =
|
|
41
|
+
var s = e.defIds;
|
|
42
|
+
return !s || s.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(r) {
|
|
43
|
+
var a = r[0], o = r[1];
|
|
44
44
|
typeof o == "string" && (i[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
45
45
|
})), i;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Lt(t, e) {
|
|
48
48
|
var n, i = e.defIds;
|
|
49
|
-
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ?
|
|
50
|
-
return typeof
|
|
49
|
+
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(s) {
|
|
50
|
+
return typeof s.attrs.id == "string" && i && i.indexOf(s.attrs.id) > -1 ? g(g({}, s), { attrs: g(g({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
|
|
51
51
|
}) }) : t;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Ut() {
|
|
54
54
|
return Math.random().toString(36).substring(2, 8);
|
|
55
55
|
}
|
|
56
56
|
be.displayName = "UniverIcon";
|
|
57
|
-
var
|
|
57
|
+
var Bt = { 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" } }] }] }, xe = U(function(t, e) {
|
|
58
58
|
return Re(be, Object.assign({}, t, {
|
|
59
59
|
id: "search-single-16",
|
|
60
60
|
ref: e,
|
|
61
|
-
icon:
|
|
61
|
+
icon: Bt
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
xe.displayName = "SearchSingle16";
|
|
65
65
|
const ye = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
|
|
66
|
-
var
|
|
67
|
-
for (var
|
|
68
|
-
(a = t[
|
|
69
|
-
return i &&
|
|
66
|
+
var Wt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
|
|
67
|
+
for (var s = i > 1 ? void 0 : i ? kt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
68
|
+
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
69
|
+
return i && s && Wt(e, n, s), s;
|
|
70
70
|
}, j = (t, e) => (n, i) => e(n, i, t);
|
|
71
|
-
class
|
|
71
|
+
class Bi extends X {
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
function
|
|
73
|
+
const m = gt("find-replace.service");
|
|
74
|
+
function Gt(t) {
|
|
75
75
|
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";
|
|
76
76
|
}
|
|
77
|
-
let
|
|
78
|
-
constructor(e, n, i,
|
|
77
|
+
let K = class extends X {
|
|
78
|
+
constructor(e, n, i, s) {
|
|
79
79
|
super();
|
|
80
|
-
c(this, "currentMatch$", new
|
|
81
|
-
c(this, "replaceables$", new
|
|
80
|
+
c(this, "currentMatch$", new D(null));
|
|
81
|
+
c(this, "replaceables$", new D([]));
|
|
82
82
|
/** All find models returned by providers. */
|
|
83
83
|
c(this, "_findModels", []);
|
|
84
84
|
/** The find model that the current match is from. */
|
|
85
85
|
c(this, "_matchingModel", null);
|
|
86
86
|
c(this, "_matches", []);
|
|
87
87
|
c(this, "_currentSearchingDisposables", null);
|
|
88
|
-
this._state = e, this._providers = n, this._univerInstanceService = i, this._logService =
|
|
89
|
-
this._state.stateUpdates$.pipe(
|
|
88
|
+
this._state = e, this._providers = n, this._univerInstanceService = i, this._logService = s, this.disposeWithMe(
|
|
89
|
+
this._state.stateUpdates$.pipe(It(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
|
|
90
90
|
const a = this._state.state;
|
|
91
|
-
|
|
91
|
+
Gt(r) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
94
|
}
|
|
@@ -96,7 +96,7 @@ let Y = class extends ee {
|
|
|
96
96
|
return this._findModels.length > 0;
|
|
97
97
|
}
|
|
98
98
|
dispose() {
|
|
99
|
-
super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...
|
|
99
|
+
super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...se(), revealed: !1 });
|
|
100
100
|
}
|
|
101
101
|
async start() {
|
|
102
102
|
if (!this._state.findString)
|
|
@@ -108,7 +108,7 @@ let Y = class extends ee {
|
|
|
108
108
|
async _startSearching() {
|
|
109
109
|
if (!this._state.findString)
|
|
110
110
|
return { results: [] };
|
|
111
|
-
const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((
|
|
111
|
+
const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((r) => r.find({
|
|
112
112
|
findString: this._state.findString,
|
|
113
113
|
findDirection: this._state.findDirection,
|
|
114
114
|
findScope: this._state.findScope,
|
|
@@ -118,13 +118,13 @@ let Y = class extends ee {
|
|
|
118
118
|
matchesTheWholeCell: this._state.matchesTheWholeCell
|
|
119
119
|
})))).flat();
|
|
120
120
|
this._subscribeToModelsChanges(n);
|
|
121
|
-
const i = this._matches = n.map((
|
|
122
|
-
if (this.replaceables$.next(i.filter((
|
|
121
|
+
const i = this._matches = n.map((r) => r.getMatches()).flat();
|
|
122
|
+
if (this.replaceables$.next(i.filter((r) => r.replaceable)), !i.length)
|
|
123
123
|
return this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] };
|
|
124
|
-
const
|
|
124
|
+
const s = this._moveToInitialMatch(n, i);
|
|
125
125
|
return this._state.changeState({
|
|
126
126
|
matchesCount: i.length,
|
|
127
|
-
matchesPosition:
|
|
127
|
+
matchesPosition: s + 1
|
|
128
128
|
// the matches position start from 1
|
|
129
129
|
}), { results: i };
|
|
130
130
|
}
|
|
@@ -139,24 +139,24 @@ let Y = class extends ee {
|
|
|
139
139
|
}
|
|
140
140
|
// When a document's content changes, we should reset all matches and try to move to the next match.
|
|
141
141
|
_subscribeToModelsChanges(e) {
|
|
142
|
-
const n = this._currentSearchingDisposables = new
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
const a = this._moveToInitialMatch(this._findModels,
|
|
146
|
-
this._state.changeState({ matchesCount:
|
|
142
|
+
const n = this._currentSearchingDisposables = new lt(), i = Ce(e.map((s) => s.matchesUpdate$)).pipe(Ft(220)).subscribe(([...s]) => {
|
|
143
|
+
const r = this._matches = s.flat();
|
|
144
|
+
if (r.length) {
|
|
145
|
+
const a = this._moveToInitialMatch(this._findModels, r, !0);
|
|
146
|
+
this._state.changeState({ matchesCount: r.length, matchesPosition: a + 1 }), this.replaceables$.next(r.filter((o) => o.replaceable));
|
|
147
147
|
} else
|
|
148
148
|
this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]);
|
|
149
149
|
});
|
|
150
|
-
e.forEach((
|
|
151
|
-
const a = this._matches.findIndex((o) => o ===
|
|
150
|
+
e.forEach((s) => n.add(q(s.activelyChangingMatch$.subscribe((r) => {
|
|
151
|
+
const a = this._matches.findIndex((o) => o === r);
|
|
152
152
|
this._state.changeState({ matchesPosition: a + 1 });
|
|
153
|
-
})))), n.add(
|
|
153
|
+
})))), n.add(q(i));
|
|
154
154
|
}
|
|
155
155
|
async replace() {
|
|
156
156
|
return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
|
|
157
157
|
}
|
|
158
158
|
async replaceAll() {
|
|
159
|
-
const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i,
|
|
159
|
+
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 }));
|
|
160
160
|
return e.failure === 0 && this._stopSearching(), e;
|
|
161
161
|
}
|
|
162
162
|
getCurrentMatch() {
|
|
@@ -167,13 +167,13 @@ let Y = class extends ee {
|
|
|
167
167
|
return;
|
|
168
168
|
const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
|
|
169
169
|
if (n) {
|
|
170
|
-
const i = this._matches.findIndex((
|
|
170
|
+
const i = this._matches.findIndex((s) => s === n);
|
|
171
171
|
this.currentMatch$.next(n), this._state.changeState({
|
|
172
172
|
matchesPosition: i + 1
|
|
173
173
|
});
|
|
174
174
|
} else {
|
|
175
|
-
const i = this._findModels.findIndex((o) => o === this._matchingModel),
|
|
176
|
-
this.currentMatch$.next(
|
|
175
|
+
const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i + 1) % this._findModels.length], r = s.moveToNextMatch(), a = this._matches.findIndex((o) => o === r);
|
|
176
|
+
this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
|
|
177
177
|
matchesPosition: a + 1
|
|
178
178
|
});
|
|
179
179
|
}
|
|
@@ -183,26 +183,26 @@ let Y = class extends ee {
|
|
|
183
183
|
return;
|
|
184
184
|
const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
|
|
185
185
|
if (n) {
|
|
186
|
-
const i = this._matches.findIndex((
|
|
186
|
+
const i = this._matches.findIndex((s) => s === n);
|
|
187
187
|
this.currentMatch$.next(n), this._state.changeState({
|
|
188
188
|
matchesPosition: i + 1
|
|
189
189
|
});
|
|
190
190
|
} else {
|
|
191
|
-
const i = this._findModels.findIndex((o) => o === this._matchingModel),
|
|
192
|
-
this.currentMatch$.next(
|
|
191
|
+
const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i - 1 + this._findModels.length) % this._findModels.length], r = s.moveToPreviousMatch(), a = this._matches.findIndex((o) => o === r);
|
|
192
|
+
this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
|
|
193
193
|
matchesPosition: a + 1
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
_moveToInitialMatch(e, n, i = !1) {
|
|
198
198
|
var d;
|
|
199
|
-
const
|
|
200
|
-
if (!
|
|
199
|
+
const s = (d = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : d.getUnitId();
|
|
200
|
+
if (!s)
|
|
201
201
|
return -1;
|
|
202
|
-
const
|
|
203
|
-
if (
|
|
204
|
-
this._matchingModel =
|
|
205
|
-
const u =
|
|
202
|
+
const r = e.find((u) => u.unitId === s);
|
|
203
|
+
if (r) {
|
|
204
|
+
this._matchingModel = r;
|
|
205
|
+
const u = r.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }), f = n.findIndex((p) => p === u);
|
|
206
206
|
return this.currentMatch$.next(u), f;
|
|
207
207
|
}
|
|
208
208
|
this._matchingModel = e[0];
|
|
@@ -210,12 +210,12 @@ let Y = class extends ee {
|
|
|
210
210
|
return this.currentMatch$.next(a), o;
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
|
|
214
|
-
j(2,
|
|
215
|
-
j(3,
|
|
216
|
-
],
|
|
217
|
-
var
|
|
218
|
-
function
|
|
213
|
+
K = De([
|
|
214
|
+
j(2, pe),
|
|
215
|
+
j(3, ct)
|
|
216
|
+
], K);
|
|
217
|
+
var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Z || {}), J = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(J || {});
|
|
218
|
+
function se() {
|
|
219
219
|
return {
|
|
220
220
|
caseSensitive: !1,
|
|
221
221
|
findBy: "value",
|
|
@@ -232,11 +232,11 @@ function ne() {
|
|
|
232
232
|
revealed: !0
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
class
|
|
235
|
+
class Vt {
|
|
236
236
|
constructor() {
|
|
237
237
|
c(this, "_stateUpdates$", new Se());
|
|
238
238
|
c(this, "stateUpdates$", this._stateUpdates$.asObservable());
|
|
239
|
-
c(this, "_state$", new
|
|
239
|
+
c(this, "_state$", new D(se()));
|
|
240
240
|
c(this, "state$", this._state$.asObservable());
|
|
241
241
|
c(this, "_findString", "");
|
|
242
242
|
c(this, "_inputtingFindString", "");
|
|
@@ -313,15 +313,15 @@ class kt {
|
|
|
313
313
|
}), this._stateUpdates$.next(i));
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
let
|
|
316
|
+
let Q = class extends X {
|
|
317
317
|
constructor(e, n) {
|
|
318
318
|
super();
|
|
319
319
|
c(this, "_providers", /* @__PURE__ */ new Set());
|
|
320
|
-
c(this, "_state", new
|
|
320
|
+
c(this, "_state", new Vt());
|
|
321
321
|
c(this, "_model");
|
|
322
|
-
c(this, "_currentMatch$", new
|
|
322
|
+
c(this, "_currentMatch$", new D(null));
|
|
323
323
|
c(this, "currentMatch$", this._currentMatch$.asObservable());
|
|
324
|
-
c(this, "_replaceables$", new
|
|
324
|
+
c(this, "_replaceables$", new D([]));
|
|
325
325
|
c(this, "replaceables$", this._replaceables$.asObservable());
|
|
326
326
|
c(this, "_focusSignal$", new Se());
|
|
327
327
|
c(this, "focusSignal$", this._focusSignal$.asObservable());
|
|
@@ -399,8 +399,8 @@ let X = class extends ee {
|
|
|
399
399
|
start(e = !1) {
|
|
400
400
|
if (this._providers.size === 0)
|
|
401
401
|
return !1;
|
|
402
|
-
this._model = this._injector.createInstance(
|
|
403
|
-
const n =
|
|
402
|
+
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));
|
|
403
|
+
const n = se();
|
|
404
404
|
return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
|
|
405
405
|
}
|
|
406
406
|
find() {
|
|
@@ -412,43 +412,43 @@ let X = class extends ee {
|
|
|
412
412
|
(e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
|
|
413
413
|
}
|
|
414
414
|
registerFindReplaceProvider(e) {
|
|
415
|
-
return this._providers.add(e),
|
|
415
|
+
return this._providers.add(e), q(() => this._providers.delete(e));
|
|
416
416
|
}
|
|
417
417
|
_toggleRevealReplace(e) {
|
|
418
418
|
this._contextService.setContextValue(Fe, e);
|
|
419
419
|
}
|
|
420
420
|
_toggleDisplayRawFormula(e) {
|
|
421
|
-
this._contextService.setContextValue(
|
|
421
|
+
this._contextService.setContextValue(Ot, e);
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
|
-
|
|
425
|
-
j(0,
|
|
426
|
-
j(1,
|
|
427
|
-
],
|
|
428
|
-
const
|
|
424
|
+
Q = De([
|
|
425
|
+
j(0, M(ie)),
|
|
426
|
+
j(1, ee)
|
|
427
|
+
], Q);
|
|
428
|
+
const B = {
|
|
429
429
|
id: "ui.operation.open-find-dialog",
|
|
430
|
-
type:
|
|
430
|
+
type: y.OPERATION,
|
|
431
431
|
handler: (t) => {
|
|
432
|
-
const e = t.get(
|
|
432
|
+
const e = t.get(m);
|
|
433
433
|
return e.revealed ? e.focusFindInput() : e.start(), !0;
|
|
434
434
|
}
|
|
435
435
|
}, re = {
|
|
436
436
|
id: "ui.operation.open-replace-dialog",
|
|
437
|
-
type:
|
|
437
|
+
type: y.OPERATION,
|
|
438
438
|
handler: (t) => {
|
|
439
|
-
const e = t.get(
|
|
439
|
+
const e = t.get(m);
|
|
440
440
|
return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
|
|
441
441
|
}
|
|
442
442
|
}, Pe = {
|
|
443
|
-
type:
|
|
443
|
+
type: y.OPERATION,
|
|
444
444
|
id: "ui.operation.go-to-next-match",
|
|
445
|
-
handler: (t) => (t.get(
|
|
445
|
+
handler: (t) => (t.get(m).moveToNextMatch(), !0)
|
|
446
446
|
}, Oe = {
|
|
447
|
-
type:
|
|
447
|
+
type: y.OPERATION,
|
|
448
448
|
id: "ui.operation.go-to-previous-match",
|
|
449
|
-
handler: (t) => (t.get(
|
|
449
|
+
handler: (t) => (t.get(m).moveToPreviousMatch(), !0)
|
|
450
450
|
};
|
|
451
|
-
var Te = { exports: {} },
|
|
451
|
+
var Te = { exports: {} }, W = {};
|
|
452
452
|
/**
|
|
453
453
|
* @license React
|
|
454
454
|
* react-jsx-runtime.production.min.js
|
|
@@ -458,101 +458,101 @@ var Te = { exports: {} }, k = {};
|
|
|
458
458
|
* This source code is licensed under the MIT license found in the
|
|
459
459
|
* LICENSE file in the root directory of this source tree.
|
|
460
460
|
*/
|
|
461
|
-
var
|
|
461
|
+
var Ht = Tt, qt = Symbol.for("react.element"), zt = Symbol.for("react.fragment"), Kt = Object.prototype.hasOwnProperty, Yt = Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Zt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
462
462
|
function Ee(t, e, n) {
|
|
463
|
-
var i,
|
|
464
|
-
n !== void 0 && (
|
|
463
|
+
var i, s = {}, r = null, a = null;
|
|
464
|
+
n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (a = e.ref);
|
|
465
465
|
for (i in e)
|
|
466
|
-
|
|
466
|
+
Kt.call(e, i) && !Zt.hasOwnProperty(i) && (s[i] = e[i]);
|
|
467
467
|
if (t && t.defaultProps)
|
|
468
468
|
for (i in e = t.defaultProps, e)
|
|
469
|
-
|
|
470
|
-
return { $$typeof:
|
|
469
|
+
s[i] === void 0 && (s[i] = e[i]);
|
|
470
|
+
return { $$typeof: qt, type: t, key: r, ref: a, props: s, _owner: Yt.current };
|
|
471
471
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
Te.exports =
|
|
472
|
+
W.Fragment = zt;
|
|
473
|
+
W.jsx = Ee;
|
|
474
|
+
W.jsxs = Ee;
|
|
475
|
+
Te.exports = W;
|
|
476
476
|
var l = Te.exports;
|
|
477
477
|
const $e = {
|
|
478
478
|
id: "ui.command.replace-current-match",
|
|
479
|
-
type:
|
|
480
|
-
handler: (t) => t.get(
|
|
481
|
-
},
|
|
479
|
+
type: y.COMMAND,
|
|
480
|
+
handler: (t) => t.get(m).replace()
|
|
481
|
+
}, Jt = "CONFIRM_REPLACE_ALL", Ne = {
|
|
482
482
|
id: "ui.command.replace-all-matches",
|
|
483
|
-
type:
|
|
483
|
+
type: y.COMMAND,
|
|
484
484
|
handler: async (t) => {
|
|
485
|
-
const e = t.get(
|
|
485
|
+
const e = t.get(mt), n = t.get(P), i = t.get(me);
|
|
486
486
|
if (!await e.confirm({
|
|
487
|
-
id:
|
|
487
|
+
id: Jt,
|
|
488
488
|
title: { title: n.t("find-replace.replace.confirm.title") },
|
|
489
489
|
cancelText: n.t("button.cancel"),
|
|
490
490
|
confirmText: n.t("button.confirm")
|
|
491
491
|
}))
|
|
492
492
|
return !1;
|
|
493
|
-
const
|
|
493
|
+
const r = await t.get(m).replaceAll(), { success: a, failure: o } = r;
|
|
494
494
|
return o > 0 ? (a === 0 ? i.show({
|
|
495
|
-
type:
|
|
495
|
+
type: N.Error,
|
|
496
496
|
content: n.t("find-replace.replace.all-failure")
|
|
497
497
|
}) : i.show({
|
|
498
|
-
type:
|
|
498
|
+
type: N.Warning,
|
|
499
499
|
content: n.t("find-replace.replace.partial-success", `${a}`, `${o}`)
|
|
500
500
|
}), !1) : (i.show({
|
|
501
|
-
type:
|
|
501
|
+
type: N.Success,
|
|
502
502
|
content: n.t("find-replace.replace.all-success", `${a}`)
|
|
503
503
|
}), !0);
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
function Ae(t) {
|
|
507
|
-
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition:
|
|
507
|
+
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: s, findString: r, findReplaceService: a, onChange: o, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
|
|
508
508
|
return /* @__PURE__ */ l.jsx(
|
|
509
|
-
|
|
509
|
+
$t,
|
|
510
510
|
{
|
|
511
511
|
autoFocus: !0,
|
|
512
512
|
placeholder: n.t("find-replace.dialog.find-placeholder"),
|
|
513
513
|
slot: /* @__PURE__ */ l.jsx(
|
|
514
|
-
|
|
514
|
+
Nt,
|
|
515
515
|
{
|
|
516
516
|
loop: !0,
|
|
517
517
|
text: f,
|
|
518
|
-
value:
|
|
518
|
+
value: s,
|
|
519
519
|
total: i,
|
|
520
520
|
onChange: (p) => {
|
|
521
|
-
|
|
521
|
+
s === i && p === 1 ? a.moveToNextMatch() : s === 1 && p === i || p < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
),
|
|
525
|
-
value:
|
|
525
|
+
value: r,
|
|
526
526
|
onChange: (p) => o == null ? void 0 : o(p),
|
|
527
527
|
...d
|
|
528
528
|
}
|
|
529
529
|
);
|
|
530
530
|
}
|
|
531
|
-
const
|
|
532
|
-
findReplaceDialogContainer:
|
|
533
|
-
findReplaceExpandContainer:
|
|
534
|
-
buttonText:
|
|
535
|
-
findReplaceButtonsGroup:
|
|
536
|
-
findReplaceButtonsGroupRight:
|
|
531
|
+
const Qt = "univer-find-replace-dialog-container", Xt = "univer-find-replace-expand-container", ei = "univer-button-text", ti = "univer-find-replace-buttons-group", ii = "univer-find-replace-buttons-group-right", L = {
|
|
532
|
+
findReplaceDialogContainer: Qt,
|
|
533
|
+
findReplaceExpandContainer: Xt,
|
|
534
|
+
buttonText: ei,
|
|
535
|
+
findReplaceButtonsGroup: ti,
|
|
536
|
+
findReplaceButtonsGroupRight: ii
|
|
537
537
|
};
|
|
538
538
|
function we(t, e) {
|
|
539
539
|
const n = _(() => {
|
|
540
|
-
var
|
|
541
|
-
(
|
|
540
|
+
var s;
|
|
541
|
+
(s = document.querySelector(".univer-find-input input")) == null || s.focus();
|
|
542
542
|
}, []), i = _(() => {
|
|
543
|
-
const
|
|
544
|
-
return Array.from(
|
|
543
|
+
const s = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
|
|
544
|
+
return Array.from(s).some((r) => r === document.activeElement);
|
|
545
545
|
}, []);
|
|
546
|
-
return
|
|
547
|
-
const
|
|
548
|
-
return () =>
|
|
546
|
+
return Et(e, () => ({ focus: n, selectHasFocus: i })), w(() => {
|
|
547
|
+
const s = t.focusSignal$.subscribe(() => n());
|
|
548
|
+
return () => s.unsubscribe();
|
|
549
549
|
}, [t, n]), { focus: n, selectHasFocus: i };
|
|
550
550
|
}
|
|
551
|
-
const
|
|
552
|
-
const i = S(
|
|
553
|
-
|
|
554
|
-
}, [
|
|
555
|
-
return we(
|
|
551
|
+
const ni = U(function(e, n) {
|
|
552
|
+
const i = S(P), s = S(m), r = S(te), a = I(s.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
|
|
553
|
+
r.executeCommand(re.id);
|
|
554
|
+
}, [r]), T = _((C) => s.changeFindString(C), [s]);
|
|
555
|
+
return we(s, n), /* @__PURE__ */ l.jsxs($, { children: [
|
|
556
556
|
/* @__PURE__ */ l.jsx(
|
|
557
557
|
Ae,
|
|
558
558
|
{
|
|
@@ -560,19 +560,19 @@ const ti = B(function(e, n) {
|
|
|
560
560
|
className: "univer-find-input",
|
|
561
561
|
matchesCount: u,
|
|
562
562
|
matchesPosition: f,
|
|
563
|
-
findReplaceService:
|
|
563
|
+
findReplaceService: s,
|
|
564
564
|
localeService: i,
|
|
565
565
|
findString: d,
|
|
566
|
-
onChange:
|
|
566
|
+
onChange: T
|
|
567
567
|
}
|
|
568
568
|
),
|
|
569
|
-
/* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(
|
|
569
|
+
/* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(A, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
|
|
570
570
|
] });
|
|
571
|
-
}),
|
|
572
|
-
const i = S(
|
|
571
|
+
}), si = U(function(e, n) {
|
|
572
|
+
const i = S(m), s = S(P), r = S(te), a = S(me), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
|
|
573
573
|
matchesCount: f,
|
|
574
574
|
matchesPosition: p,
|
|
575
|
-
findString:
|
|
575
|
+
findString: T,
|
|
576
576
|
inputtingFindString: C,
|
|
577
577
|
replaceString: Ue,
|
|
578
578
|
caseSensitive: Be,
|
|
@@ -580,7 +580,7 @@ const ti = B(function(e, n) {
|
|
|
580
580
|
findDirection: ke,
|
|
581
581
|
findScope: Ge,
|
|
582
582
|
findBy: Ve,
|
|
583
|
-
findCompleted:
|
|
583
|
+
findCompleted: G
|
|
584
584
|
} = u, He = C.length === 0, qe = f === 0 || !(o != null && o.replaceable), ze = d.length === 0, Ke = _(
|
|
585
585
|
(h) => i.changeInputtingFindString(h),
|
|
586
586
|
[i]
|
|
@@ -588,89 +588,89 @@ const ti = B(function(e, n) {
|
|
|
588
588
|
(h) => i.changeReplaceString(h),
|
|
589
589
|
[i]
|
|
590
590
|
), { focus: Ze } = we(i, n), Je = _(() => {
|
|
591
|
-
|
|
592
|
-
}, [
|
|
593
|
-
await
|
|
594
|
-
}, [
|
|
591
|
+
T === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
|
|
592
|
+
}, [T, C, i]), Qe = _(() => r.executeCommand($e.id), [r]), Xe = _(async () => {
|
|
593
|
+
await r.executeCommand(Ne.id), Ze();
|
|
594
|
+
}, [r]), et = _((h) => {
|
|
595
595
|
i.changeFindDirection(h);
|
|
596
596
|
}, [i]), tt = _((h) => {
|
|
597
597
|
i.changeFindScope(h);
|
|
598
598
|
}, [i]), it = _((h) => {
|
|
599
599
|
i.changeFindBy(h);
|
|
600
|
-
}, [i]), nt =
|
|
600
|
+
}, [i]), nt = ai(s), st = oi(s), rt = ci(s);
|
|
601
601
|
return w(() => {
|
|
602
|
-
const h =
|
|
603
|
-
let
|
|
604
|
-
return h && (
|
|
605
|
-
content:
|
|
606
|
-
type:
|
|
602
|
+
const h = G && f === 0;
|
|
603
|
+
let E = null;
|
|
604
|
+
return h && (E = a.show({
|
|
605
|
+
content: s.t("find-replace.dialog.no-match"),
|
|
606
|
+
type: N.Warning,
|
|
607
607
|
delay: 5e3
|
|
608
|
-
})), () =>
|
|
609
|
-
}, [
|
|
610
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
608
|
+
})), () => E == null ? void 0 : E.dispose();
|
|
609
|
+
}, [G, f, a, s]), /* @__PURE__ */ l.jsxs($, { children: [
|
|
610
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
|
|
611
611
|
Ae,
|
|
612
612
|
{
|
|
613
|
-
findCompleted:
|
|
613
|
+
findCompleted: G,
|
|
614
614
|
className: "univer-find-input",
|
|
615
615
|
matchesCount: f,
|
|
616
616
|
matchesPosition: p,
|
|
617
617
|
findReplaceService: i,
|
|
618
|
-
localeService:
|
|
618
|
+
localeService: s,
|
|
619
619
|
findString: C,
|
|
620
620
|
onChange: Ke
|
|
621
621
|
}
|
|
622
622
|
) }),
|
|
623
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
624
|
-
|
|
623
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l.jsx(
|
|
624
|
+
At,
|
|
625
625
|
{
|
|
626
|
-
placeholder:
|
|
626
|
+
placeholder: s.t("find-replace.dialog.replace-placeholder"),
|
|
627
627
|
value: Ue,
|
|
628
628
|
onChange: (h) => Ye(h)
|
|
629
629
|
}
|
|
630
630
|
) }),
|
|
631
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
632
|
-
/* @__PURE__ */ l.jsx(
|
|
633
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
634
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
631
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(V, { value: ke, options: st, onChange: et }) }),
|
|
632
|
+
/* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
|
|
633
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(V, { value: Ge, options: nt, onChange: tt }) }),
|
|
634
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(V, { value: Ve, options: rt, onChange: it }) })
|
|
635
635
|
] }) }),
|
|
636
|
-
/* @__PURE__ */ l.jsx(
|
|
636
|
+
/* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
|
|
637
637
|
/* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
|
|
638
|
-
|
|
638
|
+
de,
|
|
639
639
|
{
|
|
640
640
|
checked: Be,
|
|
641
641
|
onChange: (h) => {
|
|
642
642
|
i.changeCaseSensitive(h);
|
|
643
643
|
},
|
|
644
|
-
children:
|
|
644
|
+
children: s.t("find-replace.dialog.case-sensitive")
|
|
645
645
|
}
|
|
646
646
|
) }),
|
|
647
647
|
/* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
|
|
648
|
-
|
|
648
|
+
de,
|
|
649
649
|
{
|
|
650
650
|
checked: We,
|
|
651
651
|
onChange: (h) => {
|
|
652
652
|
i.changeMatchesTheWholeCell(h);
|
|
653
653
|
},
|
|
654
|
-
children:
|
|
654
|
+
children: s.t("find-replace.dialog.match-the-whole-cell")
|
|
655
655
|
}
|
|
656
656
|
) })
|
|
657
657
|
] }) }),
|
|
658
658
|
/* @__PURE__ */ l.jsxs("div", { className: L.findReplaceButtonsGroup, children: [
|
|
659
|
-
/* @__PURE__ */ l.jsx(
|
|
659
|
+
/* @__PURE__ */ l.jsx(A, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
|
|
660
660
|
/* @__PURE__ */ l.jsxs("span", { className: L.findReplaceButtonsGroupRight, children: [
|
|
661
|
-
/* @__PURE__ */ l.jsx(
|
|
662
|
-
/* @__PURE__ */ l.jsx(
|
|
661
|
+
/* @__PURE__ */ l.jsx(A, { disabled: qe, onClick: Qe, children: s.t("find-replace.dialog.replace") }),
|
|
662
|
+
/* @__PURE__ */ l.jsx(A, { disabled: ze, onClick: Xe, children: s.t("find-replace.dialog.replace-all") })
|
|
663
663
|
] })
|
|
664
664
|
] })
|
|
665
665
|
] });
|
|
666
666
|
});
|
|
667
|
-
function
|
|
668
|
-
const t = S(
|
|
667
|
+
function ri() {
|
|
668
|
+
const t = S(m), e = S(ve), n = S(ee), i = I(t.state$, void 0, !0), s = z(null);
|
|
669
669
|
w(() => {
|
|
670
670
|
let d;
|
|
671
|
-
return
|
|
671
|
+
return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
|
|
672
672
|
}, [e]);
|
|
673
|
-
const
|
|
673
|
+
const r = z(null), a = _(
|
|
674
674
|
(d) => n.setContextValue(Ie, d),
|
|
675
675
|
[n]
|
|
676
676
|
), o = _(
|
|
@@ -679,125 +679,125 @@ function ni() {
|
|
|
679
679
|
);
|
|
680
680
|
return w(() => {
|
|
681
681
|
var u;
|
|
682
|
-
const d =
|
|
682
|
+
const d = Dt(document, "focusin").subscribe((f) => {
|
|
683
683
|
var p;
|
|
684
|
-
f.target && ((p =
|
|
684
|
+
f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? o(!0) : o(!1);
|
|
685
685
|
});
|
|
686
|
-
return (u =
|
|
686
|
+
return (u = r.current) == null || u.focus(), a(!0), o(!0), () => {
|
|
687
687
|
d.unsubscribe(), a(!1);
|
|
688
688
|
};
|
|
689
|
-
}, [a, o]), /* @__PURE__ */ l.jsx("div", { className: L.findReplaceDialogContainer, ref:
|
|
689
|
+
}, [a, o]), /* @__PURE__ */ l.jsx("div", { className: L.findReplaceDialogContainer, ref: s, children: i.replaceRevealed ? /* @__PURE__ */ l.jsx(si, { ref: r }) : /* @__PURE__ */ l.jsx(ni, { ref: r }) });
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function ai(t) {
|
|
692
692
|
const e = t.getCurrentLocale();
|
|
693
|
-
return
|
|
694
|
-
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value:
|
|
695
|
-
{ label: t.t("find-replace.dialog.find-scope.workbook"), value:
|
|
693
|
+
return ne(() => [
|
|
694
|
+
{ label: t.t("find-replace.dialog.find-scope.current-sheet"), value: J.SUBUNIT },
|
|
695
|
+
{ label: t.t("find-replace.dialog.find-scope.workbook"), value: J.UNIT }
|
|
696
696
|
], [e]);
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function oi(t) {
|
|
699
699
|
const e = t.getCurrentLocale();
|
|
700
|
-
return
|
|
701
|
-
{ label: t.t("find-replace.dialog.find-direction.row"), value:
|
|
702
|
-
{ label: t.t("find-replace.dialog.find-direction.column"), value:
|
|
700
|
+
return ne(() => [
|
|
701
|
+
{ label: t.t("find-replace.dialog.find-direction.row"), value: Y.ROW },
|
|
702
|
+
{ label: t.t("find-replace.dialog.find-direction.column"), value: Y.COLUMN }
|
|
703
703
|
], [e]);
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function ci(t) {
|
|
706
706
|
const e = t.getCurrentLocale();
|
|
707
|
-
return
|
|
708
|
-
{ label: t.t("find-replace.dialog.find-by.value"), value:
|
|
709
|
-
{ label: t.t("find-replace.dialog.find-by.formula"), value:
|
|
707
|
+
return ne(() => [
|
|
708
|
+
{ label: t.t("find-replace.dialog.find-by.value"), value: Z.VALUE },
|
|
709
|
+
{ label: t.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
|
|
710
710
|
], [e]);
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function O(t) {
|
|
713
713
|
return t.getContextValue(Ie);
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function li(t) {
|
|
716
716
|
return t.getContextValue(Fe);
|
|
717
717
|
}
|
|
718
718
|
function je(t) {
|
|
719
719
|
return t.getContextValue(ye);
|
|
720
720
|
}
|
|
721
|
-
const
|
|
722
|
-
function se(t) {
|
|
723
|
-
return t.getContextValue(fe);
|
|
724
|
-
}
|
|
721
|
+
const k = "7_find-replace-shortcuts";
|
|
725
722
|
function ae(t) {
|
|
726
|
-
return
|
|
723
|
+
return t.getContextValue(_e);
|
|
724
|
+
}
|
|
725
|
+
function oe(t) {
|
|
726
|
+
return !t.getContextValue(ge);
|
|
727
727
|
}
|
|
728
|
-
const
|
|
729
|
-
id:
|
|
728
|
+
const di = {
|
|
729
|
+
id: B.id,
|
|
730
730
|
description: "find-replace.shortcut.open-find-dialog",
|
|
731
731
|
binding: b.F | x.CTRL_COMMAND,
|
|
732
|
-
group:
|
|
732
|
+
group: k,
|
|
733
733
|
preconditions(t) {
|
|
734
|
-
return !
|
|
734
|
+
return !O(t) && ae(t) && oe(t);
|
|
735
735
|
}
|
|
736
|
-
},
|
|
737
|
-
id:
|
|
736
|
+
}, hi = {
|
|
737
|
+
id: B.id,
|
|
738
738
|
description: "find-replace.shortcut.open-find-dialog",
|
|
739
739
|
binding: b.F | x.CTRL_COMMAND,
|
|
740
740
|
mac: b.F | x.MAC_CTRL,
|
|
741
741
|
preconditions(t) {
|
|
742
|
-
return !
|
|
742
|
+
return !O(t) && ae(t) && oe(t);
|
|
743
743
|
}
|
|
744
|
-
},
|
|
744
|
+
}, ui = {
|
|
745
745
|
id: re.id,
|
|
746
746
|
description: "find-replace.shortcut.open-replace-dialog",
|
|
747
747
|
binding: b.H | x.CTRL_COMMAND,
|
|
748
748
|
mac: b.H | x.MAC_CTRL,
|
|
749
|
-
group:
|
|
749
|
+
group: k,
|
|
750
750
|
preconditions(t) {
|
|
751
|
-
return
|
|
751
|
+
return ae(t) && oe(t) && (!O(t) || !li(t));
|
|
752
752
|
}
|
|
753
|
-
},
|
|
753
|
+
}, fi = {
|
|
754
754
|
id: Pe.id,
|
|
755
755
|
description: "find-replace.shortcut.go-to-next-match",
|
|
756
756
|
binding: b.ENTER,
|
|
757
|
-
group:
|
|
757
|
+
group: k,
|
|
758
758
|
priority: 1e3,
|
|
759
759
|
preconditions(t) {
|
|
760
|
-
return je(t) &&
|
|
760
|
+
return je(t) && O(t);
|
|
761
761
|
}
|
|
762
|
-
},
|
|
762
|
+
}, pi = {
|
|
763
763
|
id: Oe.id,
|
|
764
764
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
765
765
|
binding: b.ENTER | x.SHIFT,
|
|
766
|
-
group:
|
|
766
|
+
group: k,
|
|
767
767
|
priority: 1e3,
|
|
768
768
|
preconditions(t) {
|
|
769
|
-
return je(t) &&
|
|
769
|
+
return je(t) && O(t);
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
|
-
function
|
|
773
|
-
const e = t.get(
|
|
772
|
+
function _i(t) {
|
|
773
|
+
const e = t.get(ee);
|
|
774
774
|
return {
|
|
775
|
-
id:
|
|
775
|
+
id: B.id,
|
|
776
776
|
icon: "SearchIcon",
|
|
777
777
|
tooltip: "find-replace.toolbar",
|
|
778
|
-
group:
|
|
779
|
-
type:
|
|
780
|
-
positions: [
|
|
781
|
-
hidden$:
|
|
778
|
+
group: vt.TOOLBAR_OTHERS,
|
|
779
|
+
type: St.BUTTON,
|
|
780
|
+
positions: [Ct.TOOLBAR_START],
|
|
781
|
+
hidden$: Rt(t, dt.UNIVER_SHEET),
|
|
782
782
|
disabled$: Ce([
|
|
783
|
-
e.subscribeContextValue$(
|
|
784
|
-
e.subscribeContextValue$(
|
|
785
|
-
]).pipe(
|
|
783
|
+
e.subscribeContextValue$(ge),
|
|
784
|
+
e.subscribeContextValue$(_e)
|
|
785
|
+
]).pipe(Pt(([n, i]) => n || !i))
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
|
-
var
|
|
789
|
-
for (var
|
|
790
|
-
(a = t[
|
|
791
|
-
return i &&
|
|
792
|
-
},
|
|
793
|
-
const
|
|
794
|
-
let
|
|
795
|
-
constructor(t, e, n, i,
|
|
796
|
-
super(), this.
|
|
788
|
+
var gi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, vi = (t, e, n, i) => {
|
|
789
|
+
for (var s = i > 1 ? void 0 : i ? mi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
790
|
+
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
791
|
+
return i && s && gi(e, n, s), s;
|
|
792
|
+
}, v = (t, e) => (n, i) => e(n, i, t);
|
|
793
|
+
const Si = {}, he = "DESKTOP_FIND_REPLACE_DIALOG", Le = 350, Ci = 20, Ri = -90;
|
|
794
|
+
let F = class extends ht {
|
|
795
|
+
constructor(t, e, n, i, s, r, a, o, d, u, f) {
|
|
796
|
+
super(), this._config = t, this._univerInstanceService = e, this._menuService = n, this._shortcutService = i, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = o, this._localeService = d, this._componentManager = u, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
|
|
797
797
|
}
|
|
798
798
|
_initCommands() {
|
|
799
799
|
[
|
|
800
|
-
|
|
800
|
+
B,
|
|
801
801
|
re,
|
|
802
802
|
Pe,
|
|
803
803
|
Oe,
|
|
@@ -809,59 +809,58 @@ let A = class extends dt {
|
|
|
809
809
|
}
|
|
810
810
|
_initShortcuts() {
|
|
811
811
|
[
|
|
812
|
-
di,
|
|
813
|
-
ci,
|
|
814
|
-
li,
|
|
815
812
|
ui,
|
|
816
|
-
|
|
813
|
+
di,
|
|
814
|
+
hi,
|
|
815
|
+
pi,
|
|
816
|
+
fi
|
|
817
817
|
].forEach((t) => this.disposeWithMe(this._shortcutService.registerShortcut(t)));
|
|
818
818
|
}
|
|
819
819
|
_initUI() {
|
|
820
|
-
|
|
821
|
-
|
|
820
|
+
const { menu: t = {} } = this._config;
|
|
821
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(_i), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ri)), this.disposeWithMe(this._componentManager.register("SearchIcon", xe)), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
822
|
+
e.revealed === !0 && this._openPanel();
|
|
822
823
|
}), this.disposeWithMe(
|
|
823
|
-
this._univerInstanceService.focused$.pipe(
|
|
824
|
-
(!
|
|
824
|
+
this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
825
|
+
(!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
|
|
825
826
|
})
|
|
826
827
|
);
|
|
827
828
|
}
|
|
828
829
|
_openPanel() {
|
|
829
830
|
this._dialogService.open({
|
|
830
|
-
id:
|
|
831
|
+
id: he,
|
|
831
832
|
draggable: !0,
|
|
832
833
|
width: Le,
|
|
833
834
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
834
835
|
children: { label: "FindReplaceDialog" },
|
|
835
836
|
destroyOnClose: !0,
|
|
836
|
-
defaultPosition:
|
|
837
|
+
defaultPosition: bi(),
|
|
837
838
|
preservePositionOnDestroy: !0,
|
|
838
839
|
onClose: () => this.closePanel()
|
|
839
840
|
});
|
|
840
841
|
}
|
|
841
842
|
closePanel() {
|
|
842
|
-
this._dialogService.close(
|
|
843
|
+
this._dialogService.close(he), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus());
|
|
843
844
|
}
|
|
844
845
|
};
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
], A);
|
|
860
|
-
function Si() {
|
|
846
|
+
F = vi([
|
|
847
|
+
ut(ft.Rendered, F),
|
|
848
|
+
v(1, pe),
|
|
849
|
+
v(2, Mt),
|
|
850
|
+
v(3, xt),
|
|
851
|
+
v(4, te),
|
|
852
|
+
v(5, m),
|
|
853
|
+
v(6, yt),
|
|
854
|
+
v(7, ve),
|
|
855
|
+
v(8, M(P)),
|
|
856
|
+
v(9, M(bt)),
|
|
857
|
+
v(10, M(ie))
|
|
858
|
+
], F);
|
|
859
|
+
function bi() {
|
|
861
860
|
const { innerWidth: t } = window;
|
|
862
|
-
return { x: (t - Le) / 2 -
|
|
861
|
+
return { x: (t - Le) / 2 - Ci, y: Ri };
|
|
863
862
|
}
|
|
864
|
-
const
|
|
863
|
+
const Mi = {
|
|
865
864
|
"find-replace": {
|
|
866
865
|
toolbar: "Find & Replace",
|
|
867
866
|
shortcut: {
|
|
@@ -908,7 +907,7 @@ const Ci = {
|
|
|
908
907
|
}
|
|
909
908
|
},
|
|
910
909
|
"find-replace-shortcuts": "Find & Replace"
|
|
911
|
-
},
|
|
910
|
+
}, Wi = Mi, xi = {
|
|
912
911
|
"find-replace": {
|
|
913
912
|
toolbar: "查找替换",
|
|
914
913
|
shortcut: {
|
|
@@ -955,7 +954,7 @@ const Ci = {
|
|
|
955
954
|
}
|
|
956
955
|
},
|
|
957
956
|
"find-replace-shortcuts": "查找替换"
|
|
958
|
-
},
|
|
957
|
+
}, yi = xi, Ii = {
|
|
959
958
|
"find-replace": {
|
|
960
959
|
toolbar: "Найти и заменить",
|
|
961
960
|
shortcut: {
|
|
@@ -1002,40 +1001,47 @@ const Ci = {
|
|
|
1002
1001
|
}
|
|
1003
1002
|
},
|
|
1004
1003
|
"find-replace-shortcuts": "Найти и заменить"
|
|
1005
|
-
},
|
|
1006
|
-
var
|
|
1007
|
-
for (var
|
|
1008
|
-
(a = t[
|
|
1009
|
-
return i &&
|
|
1010
|
-
},
|
|
1011
|
-
const
|
|
1012
|
-
var
|
|
1013
|
-
let
|
|
1014
|
-
constructor(t, e) {
|
|
1015
|
-
super(), this.
|
|
1016
|
-
zhCN: bi
|
|
1017
|
-
});
|
|
1004
|
+
}, ki = Ii;
|
|
1005
|
+
var Fi = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, Pi = (t, e, n, i) => {
|
|
1006
|
+
for (var s = i > 1 ? void 0 : i ? Di(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
1007
|
+
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
1008
|
+
return i && s && Fi(e, n, s), s;
|
|
1009
|
+
}, ue = (t, e) => (n, i) => e(n, i, t);
|
|
1010
|
+
const Oi = "FIND_REPLACE_PLUGIN";
|
|
1011
|
+
var H;
|
|
1012
|
+
let fe = (H = class extends pt {
|
|
1013
|
+
constructor(t = {}, e, n) {
|
|
1014
|
+
super(), this._config = t, this._injector = e, this._localeService = n, this._localeService.load({ zhCN: yi }), this._config = _t.deepMerge({}, Si, this._config);
|
|
1018
1015
|
}
|
|
1019
1016
|
onStarting(t) {
|
|
1020
|
-
[
|
|
1017
|
+
[
|
|
1018
|
+
[
|
|
1019
|
+
F,
|
|
1020
|
+
{
|
|
1021
|
+
useFactory: () => this._injector.createInstance(F, this._config)
|
|
1022
|
+
}
|
|
1023
|
+
],
|
|
1024
|
+
[m, { useClass: Q }]
|
|
1025
|
+
].forEach(
|
|
1021
1026
|
(e) => {
|
|
1022
1027
|
t.add(e);
|
|
1023
1028
|
}
|
|
1024
1029
|
);
|
|
1025
1030
|
}
|
|
1026
|
-
}, c(
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1031
|
+
}, c(H, "pluginName", Oi), H);
|
|
1032
|
+
fe = Pi([
|
|
1033
|
+
ue(1, M(ie)),
|
|
1034
|
+
ue(2, M(P))
|
|
1035
|
+
], fe);
|
|
1030
1036
|
export {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1037
|
+
Z as FindBy,
|
|
1038
|
+
Y as FindDirection,
|
|
1039
|
+
Bi as FindModel,
|
|
1040
|
+
F as FindReplaceController,
|
|
1041
|
+
J as FindScope,
|
|
1042
|
+
m as IFindReplaceService,
|
|
1043
|
+
fe as UniverFindReplacePlugin,
|
|
1044
|
+
Wi as enUS,
|
|
1045
|
+
ki as ruRU,
|
|
1046
|
+
yi as zhCN
|
|
1041
1047
|
};
|