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