@univerjs/find-replace 0.1.11 → 0.1.13
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 +321 -460
- package/lib/locale/en-US.json +48 -0
- package/lib/locale/ru-RU.json +48 -0
- package/lib/locale/zh-CN.json +48 -0
- package/lib/types/controllers/find-replace.controller.d.ts +8 -5
- package/lib/types/index.d.ts +0 -1
- package/lib/types/locale/en-US.d.ts +3 -63
- package/lib/types/plugin.d.ts +4 -2
- package/lib/umd/index.js +2 -2
- package/package.json +16 -15
- package/lib/types/locale/index.d.ts +0 -18
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 D, 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 x, Injector as ie } from "@wendellhu/redi";
|
|
6
|
+
import { IConfirmService as mt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as b, MenuGroup as vt, MenuItemType as St, MenuPosition as Ct, getMenuHiddenObservable as Rt, ComponentManager as Mt, IMenuService as xt, IShortcutService as bt, IDialogService as yt } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as P, Subject as Se, throttleTime as It, combineLatest as Ce, debounceTime as Ft, fromEvent as Pt, map as Dt, 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 j, 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 k, 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
|
+
}, jt = 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
|
-
},
|
|
30
|
-
var n = t.icon, i = t.id,
|
|
31
|
-
return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current },
|
|
29
|
+
}, Me = U(function(t, e) {
|
|
30
|
+
var n = t.icon, i = t.id, s = t.className, r = t.extend, a = jt(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(Ut()));
|
|
31
|
+
return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, g({ ref: e, className: o }, a), r);
|
|
32
32
|
});
|
|
33
|
-
function xe(t, e, n, i,
|
|
34
|
-
return Re(t.tag,
|
|
35
|
-
return xe(
|
|
33
|
+
function xe(t, e, n, i, s) {
|
|
34
|
+
return Re(t.tag, g(g({ key: e }, Lt(t, n, s)), i), (wt(t, n).children || []).map(function(r, a) {
|
|
35
|
+
return xe(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
var i =
|
|
38
|
+
function Lt(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
47
|
function wt(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
|
-
|
|
57
|
-
var
|
|
58
|
-
return Re(
|
|
56
|
+
Me.displayName = "UniverIcon";
|
|
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" } }] }] }, be = U(function(t, e) {
|
|
58
|
+
return Re(Me, Object.assign({}, t, {
|
|
59
59
|
id: "search-single-16",
|
|
60
60
|
ref: e,
|
|
61
|
-
icon:
|
|
61
|
+
icon: Bt
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
be.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 &&
|
|
70
|
-
},
|
|
71
|
-
class
|
|
66
|
+
var Wt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
|
|
67
|
+
for (var s = i > 1 ? void 0 : i ? Gt(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
|
+
}, L = (t, e) => (n, i) => e(n, i, t);
|
|
71
|
+
class ji extends X {
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
function
|
|
73
|
+
const m = gt("find-replace.service");
|
|
74
|
+
function Vt(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 P(null));
|
|
81
|
+
c(this, "replaceables$", new P([]));
|
|
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
|
+
Vt(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
|
-
|
|
215
|
-
|
|
216
|
-
],
|
|
217
|
-
var
|
|
218
|
-
function
|
|
213
|
+
K = Pe([
|
|
214
|
+
L(2, pe),
|
|
215
|
+
L(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",
|
|
@@ -236,7 +236,7 @@ class kt {
|
|
|
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 P(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
320
|
c(this, "_state", new kt());
|
|
321
321
|
c(this, "_model");
|
|
322
|
-
c(this, "_currentMatch$", new
|
|
322
|
+
c(this, "_currentMatch$", new P(null));
|
|
323
323
|
c(this, "currentMatch$", this._currentMatch$.asObservable());
|
|
324
|
-
c(this, "_replaceables$", new
|
|
324
|
+
c(this, "_replaceables$", new P([]));
|
|
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
|
-
|
|
426
|
-
|
|
427
|
-
],
|
|
428
|
-
const
|
|
424
|
+
Q = Pe([
|
|
425
|
+
L(0, x(ie)),
|
|
426
|
+
L(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
|
-
},
|
|
443
|
-
type:
|
|
442
|
+
}, De = {
|
|
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(D), 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", w = {
|
|
532
|
+
findReplaceDialogContainer: Qt,
|
|
533
|
+
findReplaceExpandContainer: Xt,
|
|
534
|
+
buttonText: ei,
|
|
535
|
+
findReplaceButtonsGroup: ti,
|
|
536
|
+
findReplaceButtonsGroupRight: ii
|
|
537
537
|
};
|
|
538
|
-
function
|
|
538
|
+
function je(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 })), j(() => {
|
|
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(D),
|
|
553
|
-
|
|
554
|
-
}, [
|
|
555
|
-
return
|
|
551
|
+
const ni = U(function(e, n) {
|
|
552
|
+
const i = S(D), 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 je(s, n), /* @__PURE__ */ l.jsxs($, { children: [
|
|
556
556
|
/* @__PURE__ */ l.jsx(
|
|
557
557
|
Ae,
|
|
558
558
|
{
|
|
@@ -560,26 +560,26 @@ 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:
|
|
569
|
+
/* @__PURE__ */ l.jsx("div", { className: w.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(D), 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,
|
|
579
579
|
matchesTheWholeCell: We,
|
|
580
|
-
findDirection:
|
|
581
|
-
findScope:
|
|
582
|
-
findBy:
|
|
580
|
+
findDirection: Ge,
|
|
581
|
+
findScope: Ve,
|
|
582
|
+
findBy: ke,
|
|
583
583
|
findCompleted: V
|
|
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),
|
|
@@ -587,27 +587,27 @@ const ti = B(function(e, n) {
|
|
|
587
587
|
), Ye = _(
|
|
588
588
|
(h) => i.changeReplaceString(h),
|
|
589
589
|
[i]
|
|
590
|
-
), { focus: Ze } =
|
|
591
|
-
|
|
592
|
-
}, [
|
|
593
|
-
await
|
|
594
|
-
}, [
|
|
590
|
+
), { focus: Ze } = je(i, n), Je = _(() => {
|
|
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 =
|
|
601
|
-
return
|
|
600
|
+
}, [i]), nt = ai(s), st = oi(s), rt = ci(s);
|
|
601
|
+
return j(() => {
|
|
602
602
|
const h = V && f === 0;
|
|
603
|
-
let
|
|
604
|
-
return h && (
|
|
605
|
-
content:
|
|
606
|
-
type:
|
|
607
|
-
|
|
608
|
-
})), () =>
|
|
609
|
-
}, [V, f, a,
|
|
610
|
-
/* @__PURE__ */ l.jsx(R, { label:
|
|
603
|
+
let E = null;
|
|
604
|
+
return h && (E = a.show({
|
|
605
|
+
content: s.t("find-replace.dialog.no-match"),
|
|
606
|
+
type: N.Warning,
|
|
607
|
+
duration: 5e3
|
|
608
|
+
})), () => E == null ? void 0 : E.dispose();
|
|
609
|
+
}, [V, 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
613
|
findCompleted: V,
|
|
@@ -615,191 +615,191 @@ const ti = B(function(e, n) {
|
|
|
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(k, { value: Ge, 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(k, { value: Ve, options: nt, onChange: tt }) }),
|
|
634
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(k, { value: ke, 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
|
-
/* @__PURE__ */ l.jsxs("div", { className:
|
|
659
|
-
/* @__PURE__ */ l.jsx(
|
|
660
|
-
/* @__PURE__ */ l.jsxs("span", { className:
|
|
661
|
-
/* @__PURE__ */ l.jsx(
|
|
662
|
-
/* @__PURE__ */ l.jsx(
|
|
658
|
+
/* @__PURE__ */ l.jsxs("div", { className: w.findReplaceButtonsGroup, children: [
|
|
659
|
+
/* @__PURE__ */ l.jsx(A, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
|
|
660
|
+
/* @__PURE__ */ l.jsxs("span", { className: w.findReplaceButtonsGroupRight, children: [
|
|
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(
|
|
669
|
-
|
|
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
|
+
j(() => {
|
|
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 = _(
|
|
677
677
|
(d) => n.setContextValue(ye, d),
|
|
678
678
|
[n]
|
|
679
679
|
);
|
|
680
|
-
return
|
|
680
|
+
return j(() => {
|
|
681
681
|
var u;
|
|
682
|
-
const d =
|
|
682
|
+
const d = Pt(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:
|
|
689
|
+
}, [a, o]), /* @__PURE__ */ l.jsx("div", { className: w.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
|
-
function
|
|
718
|
+
function Le(t) {
|
|
719
719
|
return t.getContextValue(ye);
|
|
720
720
|
}
|
|
721
721
|
const G = "7_find-replace-shortcuts";
|
|
722
|
-
function se(t) {
|
|
723
|
-
return t.getContextValue(fe);
|
|
724
|
-
}
|
|
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
|
-
binding:
|
|
731
|
+
binding: M.F | b.CTRL_COMMAND,
|
|
732
732
|
group: G,
|
|
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
|
-
binding:
|
|
740
|
-
mac:
|
|
739
|
+
binding: M.F | b.CTRL_COMMAND,
|
|
740
|
+
mac: M.F | b.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
|
-
binding:
|
|
748
|
-
mac:
|
|
747
|
+
binding: M.H | b.CTRL_COMMAND,
|
|
748
|
+
mac: M.H | b.MAC_CTRL,
|
|
749
749
|
group: G,
|
|
750
750
|
preconditions(t) {
|
|
751
|
-
return
|
|
751
|
+
return ae(t) && oe(t) && (!O(t) || !li(t));
|
|
752
752
|
}
|
|
753
|
-
},
|
|
754
|
-
id:
|
|
753
|
+
}, fi = {
|
|
754
|
+
id: De.id,
|
|
755
755
|
description: "find-replace.shortcut.go-to-next-match",
|
|
756
|
-
binding:
|
|
756
|
+
binding: M.ENTER,
|
|
757
757
|
group: G,
|
|
758
758
|
priority: 1e3,
|
|
759
759
|
preconditions(t) {
|
|
760
|
-
return
|
|
760
|
+
return Le(t) && O(t);
|
|
761
761
|
}
|
|
762
|
-
},
|
|
762
|
+
}, pi = {
|
|
763
763
|
id: Oe.id,
|
|
764
764
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
765
|
-
binding:
|
|
765
|
+
binding: M.ENTER | b.SHIFT,
|
|
766
766
|
group: G,
|
|
767
767
|
priority: 1e3,
|
|
768
768
|
preconditions(t) {
|
|
769
|
-
return
|
|
769
|
+
return Le(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(Dt(([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", we = 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
|
+
De,
|
|
803
803
|
Oe,
|
|
804
804
|
Ne,
|
|
805
805
|
$e
|
|
@@ -809,233 +809,94 @@ 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", be)), 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
|
-
width:
|
|
833
|
+
width: we,
|
|
833
834
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
834
835
|
children: { label: "FindReplaceDialog" },
|
|
835
836
|
destroyOnClose: !0,
|
|
836
|
-
defaultPosition:
|
|
837
|
+
defaultPosition: Mi(),
|
|
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, xt),
|
|
850
|
+
v(3, bt),
|
|
851
|
+
v(4, te),
|
|
852
|
+
v(5, m),
|
|
853
|
+
v(6, yt),
|
|
854
|
+
v(7, ve),
|
|
855
|
+
v(8, x(D)),
|
|
856
|
+
v(9, x(Mt)),
|
|
857
|
+
v(10, x(ie))
|
|
858
|
+
], F);
|
|
859
|
+
function Mi() {
|
|
861
860
|
const { innerWidth: t } = window;
|
|
862
|
-
return { x: (t -
|
|
861
|
+
return { x: (t - we) / 2 - Ci, y: Ri };
|
|
863
862
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
},
|
|
874
|
-
dialog: {
|
|
875
|
-
title: "Find",
|
|
876
|
-
find: "Find",
|
|
877
|
-
replace: "Replace",
|
|
878
|
-
"replace-all": "Replace All",
|
|
879
|
-
"case-sensitive": "Case Sensitive",
|
|
880
|
-
"find-placeholder": "Find in this Sheet",
|
|
881
|
-
"advanced-finding": "Advanced Searching & Replace",
|
|
882
|
-
"replace-placeholder": "Input Replace String",
|
|
883
|
-
"match-the-whole-cell": "Match the Whole Cell",
|
|
884
|
-
"find-direction": {
|
|
885
|
-
title: "Find Direction",
|
|
886
|
-
row: "Search by Row",
|
|
887
|
-
column: "Search by Column"
|
|
888
|
-
},
|
|
889
|
-
"find-scope": {
|
|
890
|
-
title: "Find Range",
|
|
891
|
-
"current-sheet": "Current Sheet",
|
|
892
|
-
workbook: "Workbook"
|
|
893
|
-
},
|
|
894
|
-
"find-by": {
|
|
895
|
-
title: "Find By",
|
|
896
|
-
value: "Find by Value",
|
|
897
|
-
formula: "Find Formula"
|
|
898
|
-
},
|
|
899
|
-
"no-match": "Finding completed but no match found.",
|
|
900
|
-
"no-result": "No Result"
|
|
901
|
-
},
|
|
902
|
-
replace: {
|
|
903
|
-
"all-success": "Replaced all {0} matches",
|
|
904
|
-
"all-failure": "Replace failed",
|
|
905
|
-
confirm: {
|
|
906
|
-
title: "Are you sure to replace all matches?"
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
},
|
|
910
|
-
"find-replace-shortcuts": "Find & Replace"
|
|
911
|
-
}, Ui = Ci, Ri = {
|
|
912
|
-
"find-replace": {
|
|
913
|
-
toolbar: "查找替换",
|
|
914
|
-
shortcut: {
|
|
915
|
-
"open-find-dialog": "打开查找对话框",
|
|
916
|
-
"open-replace-dialog": "打开替换对话框",
|
|
917
|
-
"close-dialog": "关闭查找替换对话框",
|
|
918
|
-
"go-to-next-match": "下一个匹配项",
|
|
919
|
-
"go-to-previous-match": "下一个匹配项"
|
|
920
|
-
},
|
|
921
|
-
dialog: {
|
|
922
|
-
title: "查找",
|
|
923
|
-
find: "查找",
|
|
924
|
-
replace: "替换",
|
|
925
|
-
"replace-all": "替换全部",
|
|
926
|
-
"find-placeholder": "输入查找内容",
|
|
927
|
-
"advanced-finding": "替换 / 高级查找",
|
|
928
|
-
"replace-placeholder": "输入替换内容",
|
|
929
|
-
"case-sensitive": "匹配大小写",
|
|
930
|
-
"match-the-whole-cell": "匹配整个单元格",
|
|
931
|
-
"find-scope": {
|
|
932
|
-
title: "查找范围",
|
|
933
|
-
"current-sheet": "当前子表",
|
|
934
|
-
workbook: "整个工作簿"
|
|
935
|
-
},
|
|
936
|
-
"find-direction": {
|
|
937
|
-
title: "查找顺序",
|
|
938
|
-
column: "按列查找",
|
|
939
|
-
row: "按行查找"
|
|
940
|
-
},
|
|
941
|
-
"find-by": {
|
|
942
|
-
title: "查找方式",
|
|
943
|
-
formula: "查找公式",
|
|
944
|
-
value: "查找值"
|
|
945
|
-
},
|
|
946
|
-
"no-match": "已完成搜索,但是未找到任何匹配项",
|
|
947
|
-
"no-result": "无结果"
|
|
948
|
-
},
|
|
949
|
-
replace: {
|
|
950
|
-
"all-success": "已全部替换 {0} 个匹配项",
|
|
951
|
-
"all-failure": "替换失败",
|
|
952
|
-
confirm: {
|
|
953
|
-
title: "确定要替换所有的匹配项吗?"
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
"find-replace-shortcuts": "查找替换"
|
|
958
|
-
}, bi = Ri, xi = {
|
|
959
|
-
"find-replace": {
|
|
960
|
-
toolbar: "Найти и заменить",
|
|
961
|
-
shortcut: {
|
|
962
|
-
"open-find-dialog": "Открыть диалог поиска",
|
|
963
|
-
"open-replace-dialog": "Открыть диалог замены",
|
|
964
|
-
"close-dialog": "Закрыть диалог поиска и замены",
|
|
965
|
-
"go-to-next-match": "Перейти к следующему совпадению",
|
|
966
|
-
"go-to-previous-match": "Перейти к предыдущему совпадению"
|
|
967
|
-
},
|
|
968
|
-
dialog: {
|
|
969
|
-
title: "Найти",
|
|
970
|
-
find: "Найти",
|
|
971
|
-
replace: "Заменить",
|
|
972
|
-
"replace-all": "Заменить все",
|
|
973
|
-
"case-sensitive": "С учетом регистра",
|
|
974
|
-
"find-placeholder": "Найти в этом листе",
|
|
975
|
-
"advanced-finding": "Расширенный поиск и замена",
|
|
976
|
-
"replace-placeholder": "Введите строку для замены",
|
|
977
|
-
"match-the-whole-cell": "Точное совпадение",
|
|
978
|
-
"find-direction": {
|
|
979
|
-
title: "Направление поиска",
|
|
980
|
-
row: "Поиск по строкам",
|
|
981
|
-
column: "Поиск по столбцам"
|
|
982
|
-
},
|
|
983
|
-
"find-scope": {
|
|
984
|
-
title: "Область поиска",
|
|
985
|
-
"current-sheet": "Текущий лист",
|
|
986
|
-
workbook: "Книга"
|
|
987
|
-
},
|
|
988
|
-
"find-by": {
|
|
989
|
-
title: "Поиск по",
|
|
990
|
-
value: "Поиск по значению",
|
|
991
|
-
formula: "Поиск по формуле"
|
|
992
|
-
},
|
|
993
|
-
"no-match": "Поиск завершен, совпадений не найдено.",
|
|
994
|
-
"no-result": "Нет результатов"
|
|
995
|
-
},
|
|
996
|
-
replace: {
|
|
997
|
-
"all-success": "Заменены все {0} совпадений",
|
|
998
|
-
"all-failure": "Не удалось заменить",
|
|
999
|
-
confirm: {
|
|
1000
|
-
title: "Вы уверены, что хотите заменить все совпадения?"
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
"find-replace-shortcuts": "Найти и заменить"
|
|
1005
|
-
}, Bi = xi;
|
|
1006
|
-
var Mi = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, Ii = (t, e, n, i) => {
|
|
1007
|
-
for (var r = i > 1 ? void 0 : i ? yi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
|
|
1008
|
-
(a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
|
|
1009
|
-
return i && r && Mi(e, n, r), r;
|
|
1010
|
-
}, Fi = (t, e) => (n, i) => e(n, i, t);
|
|
1011
|
-
const Di = "FIND_REPLACE";
|
|
1012
|
-
var q;
|
|
1013
|
-
let he = (q = class extends pt {
|
|
1014
|
-
constructor(t, e) {
|
|
1015
|
-
super(), this._injector = t, this._localeService = e, this._localeService.load({
|
|
1016
|
-
zhCN: bi
|
|
1017
|
-
});
|
|
863
|
+
var xi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, yi = (t, e, n, i) => {
|
|
864
|
+
for (var s = i > 1 ? void 0 : i ? bi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
865
|
+
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
866
|
+
return i && s && xi(e, n, s), s;
|
|
867
|
+
}, ue = (t, e) => (n, i) => e(n, i, t);
|
|
868
|
+
const Ii = "FIND_REPLACE_PLUGIN";
|
|
869
|
+
var H;
|
|
870
|
+
let fe = (H = class extends pt {
|
|
871
|
+
constructor(t = {}, e, n) {
|
|
872
|
+
super(), this._config = t, this._injector = e, this._localeService = n, this._config = _t.deepMerge({}, Si, this._config);
|
|
1018
873
|
}
|
|
1019
874
|
onStarting(t) {
|
|
1020
|
-
[
|
|
875
|
+
[
|
|
876
|
+
[
|
|
877
|
+
F,
|
|
878
|
+
{
|
|
879
|
+
useFactory: () => this._injector.createInstance(F, this._config)
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
[m, { useClass: Q }]
|
|
883
|
+
].forEach(
|
|
1021
884
|
(e) => {
|
|
1022
885
|
t.add(e);
|
|
1023
886
|
}
|
|
1024
887
|
);
|
|
1025
888
|
}
|
|
1026
|
-
}, c(
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
889
|
+
}, c(H, "pluginName", Ii), H);
|
|
890
|
+
fe = yi([
|
|
891
|
+
ue(1, x(ie)),
|
|
892
|
+
ue(2, x(D))
|
|
893
|
+
], fe);
|
|
1030
894
|
export {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
Ui as enUS,
|
|
1039
|
-
Bi as ruRU,
|
|
1040
|
-
bi as zhCN
|
|
895
|
+
Z as FindBy,
|
|
896
|
+
Y as FindDirection,
|
|
897
|
+
ji as FindModel,
|
|
898
|
+
F as FindReplaceController,
|
|
899
|
+
J as FindScope,
|
|
900
|
+
m as IFindReplaceService,
|
|
901
|
+
fe as UniverFindReplacePlugin
|
|
1041
902
|
};
|