@univerjs/find-replace 0.6.7 → 0.6.9

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/index.js ADDED
@@ -0,0 +1,924 @@
1
+ var rt = Object.defineProperty;
2
+ var st = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => st(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { createIdentifier as at, Inject as D, Injector as Q, IContextService as X, Disposable as ee, DisposableCollection as ot, toDisposable as A, IUniverInstanceService as fe, ICommandService as W, CommandType as b, LocaleService as B, FOCUSING_SHEET as pe, EDITOR_ACTIVATED as _e, UniverInstanceType as ct, RxDisposable as lt, IConfigService as dt, Plugin as ht, merge as ut } from "@univerjs/core";
5
+ import { IConfirmService as ft, IMessageService as ge, useDependency as v, useObservable as x, ILayoutService as me, KeyCode as C, MetaKeys as y, getMenuHiddenObservable as pt, MenuItemType as _t, RibbonStartGroup as gt, IMenuManagerService as mt, IShortcutService as vt, IDialogService as St, ComponentManager as Ct } from "@univerjs/ui";
6
+ import { throttleTime as Mt, BehaviorSubject as P, combineLatest as ve, debounceTime as Rt, Subject as Se, fromEvent as bt, map as It, takeUntil as ae } from "rxjs";
7
+ import { MessageType as N, InputWithSlot as yt, Pager as Ft, FormLayout as R, Input as Dt, Select as V, FormDualColumnLayout as oe, Checkbox as ce, Button as G } from "@univerjs/design";
8
+ import { RENDER_RAW_FORMULA_KEY as xt } from "@univerjs/engine-render";
9
+ import { jsx as l, jsxs as I, Fragment as $ } from "react/jsx-runtime";
10
+ import { forwardRef as j, useRef as K, createElement as Ce, useCallback as u, useEffect as L, useMemo as te, useImperativeHandle as Pt } from "react";
11
+ const Tt = "find-replace.config", le = {};
12
+ var _ = function() {
13
+ return _ = Object.assign || function(t) {
14
+ for (var e, n = 1, i = arguments.length; n < i; n++) {
15
+ e = arguments[n];
16
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
17
+ }
18
+ return t;
19
+ }, _.apply(this, arguments);
20
+ }, Ot = function(t, e) {
21
+ var n = {};
22
+ for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
23
+ if (t != null && typeof Object.getOwnPropertySymbols == "function")
24
+ for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
25
+ e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
26
+ return n;
27
+ }, Me = j(function(t, e) {
28
+ var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Ot(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = K("_".concat($t()));
29
+ return Re(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: c }, a), s);
30
+ });
31
+ function Re(t, e, n, i, r) {
32
+ return Ce(t.tag, _(_({ key: e }, Et(t, n, r)), i), (Nt(t, n).children || []).map(function(s, a) {
33
+ return Re(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
34
+ }));
35
+ }
36
+ function Et(t, e, n) {
37
+ var i = _({}, t.attrs);
38
+ n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(function(s) {
39
+ var a = s[0], c = s[1];
40
+ a === "mask" && typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
41
+ });
42
+ var r = e.defIds;
43
+ 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) {
44
+ var a = s[0], c = s[1];
45
+ typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
46
+ })), i;
47
+ }
48
+ function Nt(t, e) {
49
+ var n, i = e.defIds;
50
+ return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? _(_({}, t), { children: t.children.map(function(r) {
51
+ return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
52
+ }) }) : t;
53
+ }
54
+ function $t() {
55
+ return Math.random().toString(36).substring(2, 8);
56
+ }
57
+ Me.displayName = "UniverIcon";
58
+ var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, be = j(function(t, e) {
59
+ return Ce(Me, Object.assign({}, t, {
60
+ id: "search-single",
61
+ ref: e,
62
+ icon: At
63
+ }));
64
+ });
65
+ be.displayName = "SearchSingle";
66
+ const Ie = "FIND_REPLACE_INPUT_FOCUS", ye = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
67
+ var Lt = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
68
+ for (var r = i > 1 ? void 0 : i ? Lt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
69
+ (a = t[s]) && (r = a(r) || r);
70
+ return r;
71
+ }, w = (t, e) => (n, i) => e(n, i, t);
72
+ class mi extends ee {
73
+ }
74
+ const g = at("find-replace.service");
75
+ function wt(t) {
76
+ 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";
77
+ }
78
+ let q = class extends ee {
79
+ constructor(e, n, i, r) {
80
+ super();
81
+ o(this, "currentMatch$", new P(null));
82
+ o(this, "replaceables$", new P([]));
83
+ /** All find models returned by providers. */
84
+ o(this, "_findModels", []);
85
+ /** The find model that the current match is from. */
86
+ o(this, "_matchingModel", null);
87
+ o(this, "_matches", []);
88
+ o(this, "_currentSearchingDisposables", null);
89
+ this._state = e, this._providers = n, this._univerInstanceService = i, this._commandService = r, this.disposeWithMe(
90
+ this._state.stateUpdates$.pipe(Mt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
91
+ const a = this._state.state;
92
+ wt(s) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
93
+ })
94
+ );
95
+ }
96
+ get searched() {
97
+ return this._findModels.length > 0;
98
+ }
99
+ dispose() {
100
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ie(), revealed: !1 });
101
+ }
102
+ async start() {
103
+ if (!this._state.findString)
104
+ return { results: [] };
105
+ const e = await this._startSearching();
106
+ return this._state.changeState({ findCompleted: !0 }), e;
107
+ }
108
+ focusSelection() {
109
+ var e;
110
+ (e = this._matchingModel) == null || e.focusSelection();
111
+ }
112
+ /** Call this method to start a `searching`. */
113
+ async _startSearching() {
114
+ if (!this._state.findString)
115
+ return { results: [] };
116
+ const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((r) => r.find({
117
+ findString: this._state.findString,
118
+ findDirection: this._state.findDirection,
119
+ findScope: this._state.findScope,
120
+ findBy: this._state.findBy,
121
+ replaceRevealed: this._state.replaceRevealed,
122
+ caseSensitive: this._state.caseSensitive,
123
+ matchesTheWholeCell: this._state.matchesTheWholeCell
124
+ })))).flat();
125
+ this._subscribeToModelsChanges(n);
126
+ const i = this._matches = n.map((r) => r.getMatches()).flat();
127
+ 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: [] });
128
+ }
129
+ /** Terminate the current searching session, when searching string is empty. */
130
+ _stopSearching() {
131
+ var e;
132
+ this._providers.forEach((n) => n.terminate()), this._findModels = [], this._matches = [], this._matchingModel = null, (e = this._currentSearchingDisposables) == null || e.dispose(), this._currentSearchingDisposables = null, this.currentMatch$.next(null), this.replaceables$.next([]), this._state.changeState({
133
+ findCompleted: !1,
134
+ matchesCount: 0,
135
+ matchesPosition: 0
136
+ });
137
+ }
138
+ // When a document's content changes, we should reset all matches and try to move to the next match.
139
+ _subscribeToModelsChanges(e) {
140
+ const n = this._currentSearchingDisposables = new ot(), i = ve(e.map((r) => r.matchesUpdate$)).pipe(Rt(220)).subscribe(([...r]) => {
141
+ const s = this._matches = r.flat();
142
+ 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([]));
143
+ });
144
+ e.forEach((r) => n.add(A(r.activelyChangingMatch$.subscribe((s) => {
145
+ const a = this._matches.findIndex((c) => c === s);
146
+ this._state.changeState({ matchesPosition: a + 1 });
147
+ })))), n.add(A(i));
148
+ }
149
+ async replace() {
150
+ return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
151
+ }
152
+ async replaceAll() {
153
+ 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 }));
154
+ return e.failure === 0 && this._stopSearching(), e;
155
+ }
156
+ getCurrentMatch() {
157
+ return this._state.matchesPosition > 0 ? this._matches[this._state.matchesPosition - 1] : null;
158
+ }
159
+ _markMatch(e) {
160
+ const n = this._matches.findIndex((i) => i === e);
161
+ this.currentMatch$.next(e), this._state.changeState({ matchesPosition: n + 1 });
162
+ }
163
+ moveToNextMatch() {
164
+ if (!this._matchingModel)
165
+ return;
166
+ const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
167
+ if (n)
168
+ return this._markMatch(n), n;
169
+ {
170
+ const i = this._findModels.findIndex((r) => r === this._matchingModel);
171
+ return this._moveToNextUnitMatch(i);
172
+ }
173
+ }
174
+ _moveToNextUnitMatch(e) {
175
+ const n = this._findModels.length;
176
+ for (let i = (e + 1) % n; i !== e; ) {
177
+ const r = this._findModels[i], s = r.moveToNextMatch({ ignoreSelection: !0 });
178
+ if (s)
179
+ return this._matchingModel = r, this._markMatch(s), s;
180
+ i = (i + 1) % n;
181
+ }
182
+ if (this._matchingModel) {
183
+ const i = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
184
+ return i && this._markMatch(i), i;
185
+ }
186
+ }
187
+ moveToPreviousMatch() {
188
+ if (!this._matchingModel)
189
+ return;
190
+ const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
191
+ if (n) {
192
+ const i = this._matches.findIndex((r) => r === n);
193
+ return this.currentMatch$.next(n), this._state.changeState({ matchesPosition: i + 1 }), n;
194
+ } else {
195
+ const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
196
+ for (let a = (r - 1 + i) % i; a !== r; ) {
197
+ const c = this._findModels[a], d = c.moveToPreviousMatch({ ignoreSelection: !0 });
198
+ if (d)
199
+ return this._matchingModel = c, this._markMatch(d), d;
200
+ a = (a - 1) % i;
201
+ }
202
+ const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
203
+ return s && this._markMatch(s), s;
204
+ }
205
+ }
206
+ _moveToInitialMatch(e, n = !1) {
207
+ var s;
208
+ const i = (s = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : s.getUnitId();
209
+ if (!i)
210
+ return -1;
211
+ const r = e.findIndex((a) => a.unitId === i);
212
+ if (r !== -1) {
213
+ this._matchingModel = e[r];
214
+ const a = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus: n });
215
+ if (a)
216
+ return this._markMatch(a), r;
217
+ }
218
+ return this._moveToNextUnitMatch(r), 0;
219
+ }
220
+ };
221
+ q = De([
222
+ w(2, fe),
223
+ w(3, W)
224
+ ], q);
225
+ var z = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(z || {}), Y = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Z || {});
226
+ function ie() {
227
+ return {
228
+ caseSensitive: !1,
229
+ findBy: "value",
230
+ findCompleted: !1,
231
+ findDirection: "row",
232
+ findScope: "subunit",
233
+ findString: "",
234
+ inputtingFindString: "",
235
+ matchesCount: 0,
236
+ matchesPosition: 0,
237
+ matchesTheWholeCell: !1,
238
+ replaceRevealed: !1,
239
+ replaceString: "",
240
+ revealed: !0
241
+ };
242
+ }
243
+ class Ut {
244
+ constructor() {
245
+ o(this, "_stateUpdates$", new Se());
246
+ o(this, "stateUpdates$", this._stateUpdates$.asObservable());
247
+ o(this, "_state$", new P(ie()));
248
+ o(this, "state$", this._state$.asObservable());
249
+ o(this, "_findString", "");
250
+ o(this, "_inputtingFindString", "");
251
+ o(this, "_replaceString", "");
252
+ o(this, "_revealed", !1);
253
+ o(this, "_replaceRevealed", !1);
254
+ o(this, "_matchesPosition", 0);
255
+ o(this, "_matchesCount", 0);
256
+ o(this, "_caseSensitive", !0);
257
+ o(this, "_matchesTheWholeCell", !1);
258
+ o(this, "_findDirection", "row");
259
+ o(this, "_findScope", "subunit");
260
+ o(this, "_findBy", "value");
261
+ o(this, "_findCompleted", !1);
262
+ }
263
+ get state() {
264
+ return this._state$.getValue();
265
+ }
266
+ get inputtingFindString() {
267
+ return this._inputtingFindString;
268
+ }
269
+ get findString() {
270
+ return this._findString;
271
+ }
272
+ get revealed() {
273
+ return this._revealed;
274
+ }
275
+ get replaceRevealed() {
276
+ return this._replaceRevealed;
277
+ }
278
+ get matchesPosition() {
279
+ return this._matchesPosition;
280
+ }
281
+ get matchesCount() {
282
+ return this._matchesCount;
283
+ }
284
+ get replaceString() {
285
+ return this._replaceString;
286
+ }
287
+ get caseSensitive() {
288
+ return this._caseSensitive;
289
+ }
290
+ get matchesTheWholeCell() {
291
+ return this._matchesTheWholeCell;
292
+ }
293
+ get findDirection() {
294
+ return this._findDirection;
295
+ }
296
+ get findScope() {
297
+ return this._findScope;
298
+ }
299
+ get findBy() {
300
+ return this._findBy;
301
+ }
302
+ get findCompleted() {
303
+ return this._findCompleted;
304
+ }
305
+ // eslint-disable-next-line max-lines-per-function, complexity
306
+ changeState(e) {
307
+ let n = !1;
308
+ const i = {};
309
+ 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({
310
+ caseSensitive: this._caseSensitive,
311
+ findBy: this._findBy,
312
+ findCompleted: this._findCompleted,
313
+ findDirection: this._findDirection,
314
+ findScope: this._findScope,
315
+ findString: this._findString,
316
+ inputtingFindString: this._inputtingFindString,
317
+ matchesCount: this._matchesCount,
318
+ matchesPosition: this._matchesPosition,
319
+ matchesTheWholeCell: this._matchesTheWholeCell,
320
+ replaceRevealed: this._replaceRevealed,
321
+ revealed: this._revealed
322
+ }), this._stateUpdates$.next(i));
323
+ }
324
+ }
325
+ let J = class extends ee {
326
+ constructor(e, n) {
327
+ super();
328
+ o(this, "_providers", /* @__PURE__ */ new Set());
329
+ o(this, "_state", new Ut());
330
+ o(this, "_model");
331
+ o(this, "_currentMatch$", new P(null));
332
+ o(this, "currentMatch$", this._currentMatch$.asObservable());
333
+ o(this, "_replaceables$", new P([]));
334
+ o(this, "replaceables$", this._replaceables$.asObservable());
335
+ o(this, "_focusSignal$", new Se());
336
+ o(this, "focusSignal$", this._focusSignal$.asObservable());
337
+ this._injector = e, this._contextService = n;
338
+ }
339
+ get stateUpdates$() {
340
+ return this._state.stateUpdates$;
341
+ }
342
+ get state$() {
343
+ return this._state.state$;
344
+ }
345
+ get revealed() {
346
+ return this._state.revealed;
347
+ }
348
+ get replaceRevealed() {
349
+ return this._state.replaceRevealed;
350
+ }
351
+ dispose() {
352
+ super.dispose(), this._currentMatch$.next(null), this._currentMatch$.complete(), this._replaceables$.next([]), this._replaceables$.complete(), this._focusSignal$.complete();
353
+ }
354
+ getProviders() {
355
+ return this._providers;
356
+ }
357
+ getCurrentMatch() {
358
+ var e;
359
+ return (e = this._model) == null ? void 0 : e.getCurrentMatch();
360
+ }
361
+ getFindString() {
362
+ return this._state.findString;
363
+ }
364
+ changeFindString(e) {
365
+ this._state.changeState({ findString: e });
366
+ }
367
+ focusFindInput() {
368
+ this._focusSignal$.next();
369
+ }
370
+ changeInputtingFindString(e) {
371
+ e ? this._state.changeState({ inputtingFindString: e }) : this._state.changeState({ inputtingFindString: "", findString: "" });
372
+ }
373
+ changeReplaceString(e) {
374
+ this._state.changeState({ replaceString: e });
375
+ }
376
+ changeMatchesTheWholeCell(e) {
377
+ this._state.changeState({ matchesTheWholeCell: e });
378
+ }
379
+ changeCaseSensitive(e) {
380
+ this._state.changeState({ caseSensitive: e });
381
+ }
382
+ changeFindBy(e) {
383
+ this._state.changeState({ findBy: e }), this._toggleDisplayRawFormula(
384
+ e === "formula"
385
+ /* FORMULA */
386
+ );
387
+ }
388
+ changeFindScope(e) {
389
+ this._state.changeState({ findScope: e });
390
+ }
391
+ changeFindDirection(e) {
392
+ this._state.changeState({ findDirection: e });
393
+ }
394
+ moveToNextMatch() {
395
+ this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToNextMatch(), this._focusSignal$.next());
396
+ }
397
+ moveToPreviousMatch() {
398
+ this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToPreviousMatch(), this._focusSignal$.next());
399
+ }
400
+ async replace() {
401
+ return this._model ? this._model.replace() : !1;
402
+ }
403
+ async replaceAll() {
404
+ if (!this._model)
405
+ throw new Error("[FindReplaceService] replaceAll: model is not initialized!");
406
+ return this._model.replaceAll();
407
+ }
408
+ revealReplace() {
409
+ this._state.changeState({ replaceRevealed: !0, inputtingFindString: this._state.findString }), this._toggleRevealReplace(!0);
410
+ }
411
+ focusSelection() {
412
+ var e;
413
+ (e = this._model) == null || e.focusSelection();
414
+ }
415
+ start(e = !1) {
416
+ if (this._providers.size === 0)
417
+ return !1;
418
+ this._model = this._injector.createInstance(q, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
419
+ const n = ie();
420
+ return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
421
+ }
422
+ find() {
423
+ var e;
424
+ (e = this._model) == null || e.start();
425
+ }
426
+ terminate() {
427
+ var e;
428
+ (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
429
+ }
430
+ registerFindReplaceProvider(e) {
431
+ return this._providers.add(e), A(() => this._providers.delete(e));
432
+ }
433
+ _toggleRevealReplace(e) {
434
+ this._contextService.setContextValue(Fe, e);
435
+ }
436
+ _toggleDisplayRawFormula(e) {
437
+ this._contextService.setContextValue(xt, e);
438
+ }
439
+ };
440
+ J = De([
441
+ w(0, D(Q)),
442
+ w(1, X)
443
+ ], J);
444
+ const xe = {
445
+ id: "ui.command.replace-current-match",
446
+ type: b.COMMAND,
447
+ handler: (t) => t.get(g).replace()
448
+ }, Wt = "CONFIRM_REPLACE_ALL", Pe = {
449
+ id: "ui.command.replace-all-matches",
450
+ type: b.COMMAND,
451
+ handler: async (t) => {
452
+ const e = t.get(ft), n = t.get(B), i = t.get(ge);
453
+ if (!await e.confirm({
454
+ id: Wt,
455
+ title: { title: n.t("find-replace.replace.confirm.title") },
456
+ cancelText: n.t("button.cancel"),
457
+ confirmText: n.t("button.confirm")
458
+ }))
459
+ return !1;
460
+ const s = await t.get(g).replaceAll(), { success: a, failure: c } = s;
461
+ return c > 0 ? (a === 0 ? i.show({
462
+ type: N.Error,
463
+ content: n.t("find-replace.replace.all-failure")
464
+ }) : i.show({
465
+ type: N.Warning,
466
+ content: n.t("find-replace.replace.partial-success", `${a}`, `${c}`)
467
+ }), !1) : (i.show({
468
+ type: N.Success,
469
+ content: n.t("find-replace.replace.all-success", `${a}`)
470
+ }), !0);
471
+ }
472
+ }, T = {
473
+ id: "ui.operation.open-find-dialog",
474
+ type: b.OPERATION,
475
+ handler: (t) => {
476
+ const e = t.get(g);
477
+ return e.revealed ? e.focusFindInput() : e.start(), !0;
478
+ }
479
+ }, ne = {
480
+ id: "ui.operation.open-replace-dialog",
481
+ type: b.OPERATION,
482
+ handler: (t) => {
483
+ const e = t.get(g);
484
+ return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
485
+ }
486
+ }, Te = {
487
+ type: b.OPERATION,
488
+ id: "ui.operation.go-to-next-match",
489
+ handler: (t) => (t.get(g).moveToNextMatch(), !0)
490
+ }, Oe = {
491
+ type: b.OPERATION,
492
+ id: "ui.operation.go-to-previous-match",
493
+ handler: (t) => (t.get(g).moveToPreviousMatch(), !0)
494
+ }, Ee = {
495
+ type: b.OPERATION,
496
+ id: "ui.operation.focus-selection",
497
+ handler: (t) => (t.get(g).focusSelection(), !0)
498
+ };
499
+ function Ne(t) {
500
+ const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: c, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
501
+ return /* @__PURE__ */ l(
502
+ yt,
503
+ {
504
+ autoFocus: !0,
505
+ placeholder: n.t("find-replace.dialog.find-placeholder"),
506
+ slot: /* @__PURE__ */ l(
507
+ Ft,
508
+ {
509
+ loop: !0,
510
+ text: f,
511
+ value: r,
512
+ total: i,
513
+ onChange: (p) => {
514
+ r === i && p === 1 ? a.moveToNextMatch() : r === 1 && p === i || p < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
515
+ }
516
+ }
517
+ ),
518
+ value: s,
519
+ onChange: (p) => c == null ? void 0 : c(p),
520
+ ...d
521
+ }
522
+ );
523
+ }
524
+ function $e(t, e) {
525
+ const n = u(() => {
526
+ var r;
527
+ (r = document.querySelector(".univer-find-input input")) == null || r.focus();
528
+ }, []), i = u(() => {
529
+ const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
530
+ return Array.from(r).some((s) => s === document.activeElement);
531
+ }, []);
532
+ return Pt(e, () => ({ focus: n, selectHasFocus: i })), L(() => {
533
+ const r = t.focusSignal$.subscribe(() => n());
534
+ return () => r.unsubscribe();
535
+ }, [t, n]), { focus: n, selectHasFocus: i };
536
+ }
537
+ const Bt = j(function(e, n) {
538
+ const i = v(B), r = v(g), s = v(W), a = x(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: S, matchesPosition: f } = a, p = u(() => {
539
+ s.executeCommand(ne.id);
540
+ }, [s]), E = u((M) => r.changeFindString(M), [r]);
541
+ return $e(r, n), /* @__PURE__ */ I($, { children: [
542
+ /* @__PURE__ */ l(
543
+ Ne,
544
+ {
545
+ findCompleted: c,
546
+ className: "univer-find-input",
547
+ matchesCount: S,
548
+ matchesPosition: f,
549
+ findReplaceService: r,
550
+ localeService: i,
551
+ findString: d,
552
+ onChange: E
553
+ }
554
+ ),
555
+ /* @__PURE__ */ l("div", { className: "univer-mt-4 univer-text-center", children: /* @__PURE__ */ l(
556
+ "a",
557
+ {
558
+ className: `
559
+ univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors
560
+ hover:univer-text-primary-500/80
561
+ `,
562
+ onClick: p,
563
+ children: i.t("find-replace.dialog.advanced-finding")
564
+ }
565
+ ) })
566
+ ] });
567
+ }), jt = j(function(e, n) {
568
+ const i = v(g), r = v(B), s = v(W), a = v(ge), c = x(i.currentMatch$, void 0, !0), d = x(i.replaceables$, void 0, !0), S = x(i.state$, void 0, !0), {
569
+ matchesCount: f,
570
+ matchesPosition: p,
571
+ findString: E,
572
+ inputtingFindString: M,
573
+ replaceString: we,
574
+ caseSensitive: Ue,
575
+ matchesTheWholeCell: We,
576
+ findDirection: Be,
577
+ findScope: je,
578
+ findBy: ke,
579
+ findCompleted: k
580
+ } = S, Ve = M.length === 0, Ge = f === 0 || !(c != null && c.replaceable), He = d.length === 0, Ke = u(
581
+ (h) => i.changeInputtingFindString(h),
582
+ [i]
583
+ ), qe = u(
584
+ (h) => i.changeReplaceString(h),
585
+ [i]
586
+ ), { focus: ze } = $e(i, n), Ye = u(() => {
587
+ E === M ? i.moveToNextMatch() : (i.changeFindString(M), i.find());
588
+ }, [E, M, i]), Ze = u(() => s.executeCommand(xe.id), [s]), Je = u(async () => {
589
+ await s.executeCommand(Pe.id), ze();
590
+ }, [s]), Qe = u((h) => {
591
+ i.changeFindDirection(h);
592
+ }, [i]), Xe = u((h) => {
593
+ i.changeFindScope(h);
594
+ }, [i]), et = u((h) => {
595
+ i.changeFindBy(h);
596
+ }, [i]), tt = Vt(r), it = Gt(r), nt = Ht(r);
597
+ return L(() => {
598
+ k && f === 0 && a.show({
599
+ content: r.t("find-replace.dialog.no-match"),
600
+ type: N.Warning,
601
+ duration: 5e3
602
+ });
603
+ }, [k, f, a, r]), /* @__PURE__ */ I($, { children: [
604
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
605
+ Ne,
606
+ {
607
+ findCompleted: k,
608
+ className: "univer-find-input",
609
+ matchesCount: f,
610
+ matchesPosition: p,
611
+ findReplaceService: i,
612
+ localeService: r,
613
+ findString: M,
614
+ onChange: Ke
615
+ }
616
+ ) }),
617
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
618
+ Dt,
619
+ {
620
+ placeholder: r.t("find-replace.dialog.replace-placeholder"),
621
+ value: we,
622
+ onChange: (h) => qe(h)
623
+ }
624
+ ) }),
625
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(V, { value: Be, options: it, onChange: Qe }) }),
626
+ /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ I($, { children: [
627
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(V, { value: je, options: tt, onChange: Xe }) }),
628
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(V, { value: ke, options: nt, onChange: et }) })
629
+ ] }) }),
630
+ /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ I($, { children: [
631
+ /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
632
+ ce,
633
+ {
634
+ checked: Ue,
635
+ onChange: (h) => {
636
+ i.changeCaseSensitive(h);
637
+ },
638
+ children: r.t("find-replace.dialog.case-sensitive")
639
+ }
640
+ ) }),
641
+ /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
642
+ ce,
643
+ {
644
+ checked: We,
645
+ onChange: (h) => {
646
+ i.changeMatchesTheWholeCell(h);
647
+ },
648
+ children: r.t("find-replace.dialog.match-the-whole-cell")
649
+ }
650
+ ) })
651
+ ] }) }),
652
+ /* @__PURE__ */ I("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
653
+ /* @__PURE__ */ l(G, { type: "primary", onClick: Ye, disabled: Ve, children: r.t("find-replace.dialog.find") }),
654
+ /* @__PURE__ */ I("span", { className: "univer-inline-flex univer-gap-2", children: [
655
+ /* @__PURE__ */ l(G, { disabled: Ge, onClick: Ze, children: r.t("find-replace.dialog.replace") }),
656
+ /* @__PURE__ */ l(G, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace-all") })
657
+ ] })
658
+ ] })
659
+ ] });
660
+ });
661
+ function kt() {
662
+ const t = v(g), e = v(me), n = v(X), i = x(t.state$, void 0, !0), r = K(null);
663
+ L(() => {
664
+ let d;
665
+ return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
666
+ }, [e]);
667
+ const s = K(null), a = u(
668
+ (d) => n.setContextValue(ye, d),
669
+ [n]
670
+ ), c = u(
671
+ (d) => n.setContextValue(Ie, d),
672
+ [n]
673
+ );
674
+ return L(() => {
675
+ var S;
676
+ const d = bt(document, "focusin").subscribe((f) => {
677
+ var p;
678
+ f.target && ((p = r.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
679
+ });
680
+ return (S = s.current) == null || S.focus(), a(!0), c(!0), () => {
681
+ d.unsubscribe(), a(!1);
682
+ };
683
+ }, [a, c]), /* @__PURE__ */ l("div", { ref: r, children: i.replaceRevealed ? /* @__PURE__ */ l(jt, { ref: s }) : /* @__PURE__ */ l(Bt, { ref: s }) });
684
+ }
685
+ function Vt(t) {
686
+ const e = t.getCurrentLocale();
687
+ return te(() => [
688
+ { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Z.SUBUNIT },
689
+ { label: t.t("find-replace.dialog.find-scope.workbook"), value: Z.UNIT }
690
+ ], [e]);
691
+ }
692
+ function Gt(t) {
693
+ const e = t.getCurrentLocale();
694
+ return te(() => [
695
+ { label: t.t("find-replace.dialog.find-direction.row"), value: z.ROW },
696
+ { label: t.t("find-replace.dialog.find-direction.column"), value: z.COLUMN }
697
+ ], [e]);
698
+ }
699
+ function Ht(t) {
700
+ const e = t.getCurrentLocale();
701
+ return te(() => [
702
+ { label: t.t("find-replace.dialog.find-by.value"), value: Y.VALUE },
703
+ { label: t.t("find-replace.dialog.find-by.formula"), value: Y.FORMULA }
704
+ ], [e]);
705
+ }
706
+ function F(t) {
707
+ return t.getContextValue(ye);
708
+ }
709
+ function Kt(t) {
710
+ return t.getContextValue(Fe);
711
+ }
712
+ function Ae(t) {
713
+ return t.getContextValue(Ie);
714
+ }
715
+ const O = "7_find-replace-shortcuts";
716
+ function re(t) {
717
+ return t.getContextValue(pe);
718
+ }
719
+ function se(t) {
720
+ return !t.getContextValue(_e);
721
+ }
722
+ const qt = {
723
+ id: T.id,
724
+ description: "find-replace.shortcut.open-find-dialog",
725
+ binding: C.F | y.CTRL_COMMAND,
726
+ group: O,
727
+ preconditions(t) {
728
+ return !F(t) && re(t) && se(t);
729
+ }
730
+ }, zt = {
731
+ id: T.id,
732
+ description: "find-replace.shortcut.open-find-dialog",
733
+ binding: C.F | y.CTRL_COMMAND,
734
+ mac: C.F | y.MAC_CTRL,
735
+ preconditions(t) {
736
+ return !F(t) && re(t) && se(t);
737
+ }
738
+ }, Yt = {
739
+ id: ne.id,
740
+ description: "find-replace.shortcut.open-replace-dialog",
741
+ binding: C.H | y.CTRL_COMMAND,
742
+ mac: C.H | y.MAC_CTRL,
743
+ group: O,
744
+ preconditions(t) {
745
+ return re(t) && se(t) && (!F(t) || !Kt(t));
746
+ }
747
+ }, Zt = {
748
+ id: Te.id,
749
+ description: "find-replace.shortcut.go-to-next-match",
750
+ binding: C.ENTER,
751
+ group: O,
752
+ priority: 1e3,
753
+ preconditions(t) {
754
+ return Ae(t) && F(t);
755
+ }
756
+ }, Jt = {
757
+ id: Oe.id,
758
+ description: "find-replace.shortcut.go-to-previous-match",
759
+ binding: C.ENTER | y.SHIFT,
760
+ group: O,
761
+ priority: 1e3,
762
+ preconditions(t) {
763
+ return Ae(t) && F(t);
764
+ }
765
+ }, Qt = {
766
+ id: Ee.id,
767
+ description: "find-replace.shortcut.focus-selection",
768
+ binding: C.ESC,
769
+ group: O,
770
+ priority: 1e3,
771
+ preconditions(t) {
772
+ return F(t);
773
+ }
774
+ };
775
+ function Xt(t) {
776
+ const e = t.get(X);
777
+ return {
778
+ id: T.id,
779
+ icon: "SearchIcon",
780
+ tooltip: "find-replace.toolbar",
781
+ type: _t.BUTTON,
782
+ hidden$: pt(t, ct.UNIVER_SHEET),
783
+ disabled$: ve([
784
+ e.subscribeContextValue$(_e),
785
+ e.subscribeContextValue$(pe)
786
+ ]).pipe(It(([n, i]) => n || !i))
787
+ };
788
+ }
789
+ const ei = {
790
+ [gt.OTHERS]: {
791
+ [T.id]: {
792
+ order: 2,
793
+ menuItemFactory: Xt
794
+ }
795
+ }
796
+ };
797
+ var ti = Object.getOwnPropertyDescriptor, ii = (t, e, n, i) => {
798
+ for (var r = i > 1 ? void 0 : i ? ti(e, n) : e, s = t.length - 1, a; s >= 0; s--)
799
+ (a = t[s]) && (r = a(r) || r);
800
+ return r;
801
+ }, m = (t, e) => (n, i) => e(n, i, t);
802
+ const de = "DESKTOP_FIND_REPLACE_DIALOG", Le = 350, ni = 20, ri = -90;
803
+ let U = class extends lt {
804
+ constructor(e, n, i, r, s, a, c, d, S, f) {
805
+ super();
806
+ o(this, "_closingListenerDisposable");
807
+ this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = c, this._localeService = d, this._componentManager = S, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
808
+ }
809
+ dispose() {
810
+ var e;
811
+ super.dispose(), (e = this._closingListenerDisposable) == null || e.dispose(), this._closingListenerDisposable = null;
812
+ }
813
+ _initCommands() {
814
+ [
815
+ T,
816
+ ne,
817
+ Te,
818
+ Oe,
819
+ Pe,
820
+ xe,
821
+ Ee
822
+ ].forEach((e) => {
823
+ this.disposeWithMe(this._commandService.registerCommand(e));
824
+ });
825
+ }
826
+ _initShortcuts() {
827
+ [
828
+ Yt,
829
+ qt,
830
+ zt,
831
+ Jt,
832
+ Zt,
833
+ Qt
834
+ ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
835
+ }
836
+ _initUI() {
837
+ this.disposeWithMe(this._componentManager.register("FindReplaceDialog", kt)), this.disposeWithMe(this._componentManager.register("SearchIcon", be)), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(ae(this.dispose$)).subscribe((e) => {
838
+ e.revealed === !0 && this._openPanel();
839
+ });
840
+ }
841
+ _openPanel() {
842
+ this._dialogService.open({
843
+ id: de,
844
+ draggable: !0,
845
+ width: Le,
846
+ title: { title: this._localeService.t("find-replace.dialog.title") },
847
+ children: { label: "FindReplaceDialog" },
848
+ destroyOnClose: !0,
849
+ defaultPosition: si(),
850
+ preservePositionOnDestroy: !0,
851
+ onClose: () => this.closePanel()
852
+ }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(ae(this.dispose$)).subscribe((e) => {
853
+ (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
854
+ }));
855
+ }
856
+ closePanel() {
857
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(de), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
858
+ }
859
+ };
860
+ U = ii([
861
+ m(0, fe),
862
+ m(1, mt),
863
+ m(2, vt),
864
+ m(3, W),
865
+ m(4, g),
866
+ m(5, St),
867
+ m(6, me),
868
+ m(7, D(B)),
869
+ m(8, D(Ct)),
870
+ m(9, D(Q))
871
+ ], U);
872
+ function si() {
873
+ const { innerWidth: t } = window;
874
+ return { x: (t - Le) / 2 - ni, y: ri };
875
+ }
876
+ var ai = Object.getOwnPropertyDescriptor, oi = (t, e, n, i) => {
877
+ for (var r = i > 1 ? void 0 : i ? ai(e, n) : e, s = t.length - 1, a; s >= 0; s--)
878
+ (a = t[s]) && (r = a(r) || r);
879
+ return r;
880
+ }, he = (t, e) => (n, i) => e(n, i, t);
881
+ const ci = "UNIVER_FIND_REPLACE_PLUGIN";
882
+ var H;
883
+ let ue = (H = class extends ht {
884
+ constructor(t = le, e, n) {
885
+ super(), this._config = t, this._injector = e, this._configService = n;
886
+ const { ...i } = ut(
887
+ {},
888
+ le,
889
+ this._config
890
+ );
891
+ this._configService.setConfig(Tt, i);
892
+ }
893
+ onStarting() {
894
+ [
895
+ [U],
896
+ [g, { useClass: J }]
897
+ ].forEach((t) => this._injector.add(t));
898
+ }
899
+ onRendered() {
900
+ this._injector.get(U);
901
+ }
902
+ }, o(H, "pluginName", ci), H);
903
+ ue = oi([
904
+ he(1, D(Q)),
905
+ he(2, dt)
906
+ ], ue);
907
+ export {
908
+ Y as FindBy,
909
+ z as FindDirection,
910
+ mi as FindModel,
911
+ U as FindReplaceController,
912
+ q as FindReplaceModel,
913
+ Ut as FindReplaceState,
914
+ Z as FindScope,
915
+ Te as GoToNextMatchOperation,
916
+ Oe as GoToPreviousMatchOperation,
917
+ g as IFindReplaceService,
918
+ T as OpenFindDialogOperation,
919
+ ne as OpenReplaceDialogOperation,
920
+ Pe as ReplaceAllMatchesCommand,
921
+ xe as ReplaceCurrentMatchCommand,
922
+ ue as UniverFindReplacePlugin,
923
+ ie as createInitFindReplaceState
924
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "Find & Replace",
4
+ shortcut: {
5
+ "open-find-dialog": "Open Find Dialog",
6
+ "open-replace-dialog": "Open Replace Dialog",
7
+ "close-dialog": "Close Find & Replace Dialog",
8
+ "go-to-next-match": "Go to Next Match",
9
+ "go-to-previous-match": "Go to Previous Match",
10
+ "focus-selection": "Focus Selection"
11
+ },
12
+ dialog: {
13
+ title: "Find",
14
+ find: "Find",
15
+ replace: "Replace",
16
+ "replace-all": "Replace All",
17
+ "case-sensitive": "Case Sensitive",
18
+ "find-placeholder": "Find in this Sheet",
19
+ "advanced-finding": "Advanced Searching & Replace",
20
+ "replace-placeholder": "Input Replace String",
21
+ "match-the-whole-cell": "Match the Whole Cell",
22
+ "find-direction": {
23
+ title: "Find Direction",
24
+ row: "Search by Row",
25
+ column: "Search by Column"
26
+ },
27
+ "find-scope": {
28
+ title: "Find Range",
29
+ "current-sheet": "Current Sheet",
30
+ workbook: "Workbook"
31
+ },
32
+ "find-by": {
33
+ title: "Find By",
34
+ value: "Find by Value",
35
+ formula: "Find Formula"
36
+ },
37
+ "no-match": "Finding completed but no match found.",
38
+ "no-result": "No Result"
39
+ },
40
+ replace: {
41
+ "all-success": "Replaced all {0} matches",
42
+ "all-failure": "Replace failed",
43
+ confirm: {
44
+ title: "Are you sure to replace all matches?"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "Find & Replace"
49
+ };
50
+ export {
51
+ e as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "یافتن و جایگزینی",
4
+ shortcut: {
5
+ "open-find-dialog": "باز کردن پنجره گفتگوی یافتن",
6
+ "open-replace-dialog": "باز کردن پنجره گفتگوی جایگزینی",
7
+ "close-dialog": "بستن پنجره گفتگوی یافتن و جایگزینی",
8
+ "go-to-next-match": "رفتن به تطابق بعدی",
9
+ "go-to-previous-match": "رفتن به تطابق قبلی",
10
+ "focus-selection": "تمرکز بر روی انتخاب"
11
+ },
12
+ dialog: {
13
+ title: "یافتن",
14
+ find: "یافتن",
15
+ replace: "جایگزینی",
16
+ "replace-all": "جایگزینی همه",
17
+ "case-sensitive": "حساس به حروف کوچک و بزرگ",
18
+ "find-placeholder": "یافتن در این برگ",
19
+ "advanced-finding": "جستجوی پیشرفته و جایگزینی",
20
+ "replace-placeholder": "ورود رشته جایگزین",
21
+ "match-the-whole-cell": "مطابقت با کل سلول",
22
+ "find-direction": {
23
+ title: "جهت یافتن",
24
+ row: "جستجو بر اساس سطر",
25
+ column: "جستجو بر اساس ستون"
26
+ },
27
+ "find-scope": {
28
+ title: "محدوده یافتن",
29
+ "current-sheet": "برگ فعلی",
30
+ workbook: "کتاب کار"
31
+ },
32
+ "find-by": {
33
+ title: "یافتن بر اساس",
34
+ value: "یافتن بر اساس مقدار",
35
+ formula: "یافتن فرمول"
36
+ },
37
+ "no-match": "یافتن تکمیل شد اما هیچ تطابقی یافت نشد.",
38
+ "no-result": "نتیجه‌ای وجود ندارد"
39
+ },
40
+ replace: {
41
+ "all-success": "همه {0} تطابق جایگزین شد",
42
+ "all-failure": "جایگزینی ناموفق بود",
43
+ confirm: {
44
+ title: "آیا مطمئن هستید که همه تطابق‌ها را جایگزین کنید؟"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "یافتن و جایگزینی"
49
+ };
50
+ export {
51
+ e as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "Rechercher & Remplacer",
4
+ shortcut: {
5
+ "open-find-dialog": "Ouvrir la boîte de dialogue Rechercher",
6
+ "open-replace-dialog": "Ouvrir la boîte de dialogue Remplacer",
7
+ "close-dialog": "Fermer la boîte de dialogue Rechercher & Remplacer",
8
+ "go-to-next-match": "Aller à la correspondance suivante",
9
+ "go-to-previous-match": "Aller à la correspondance précédente",
10
+ "focus-selection": "Focus sur la sélection"
11
+ },
12
+ dialog: {
13
+ title: "Rechercher",
14
+ find: "Rechercher",
15
+ replace: "Remplacer",
16
+ "replace-all": "Remplacer tout",
17
+ "case-sensitive": "Sensible à la casse",
18
+ "find-placeholder": "Rechercher dans cette feuille",
19
+ "advanced-finding": "Recherche avancée & Remplacer",
20
+ "replace-placeholder": "Entrer la chaîne de remplacement",
21
+ "match-the-whole-cell": "Correspondre à toute la cellule",
22
+ "find-direction": {
23
+ title: "Direction de recherche",
24
+ row: "Rechercher par ligne",
25
+ column: "Rechercher par colonne"
26
+ },
27
+ "find-scope": {
28
+ title: "Plage de recherche",
29
+ "current-sheet": "Feuille actuelle",
30
+ workbook: "Classeur"
31
+ },
32
+ "find-by": {
33
+ title: "Rechercher par",
34
+ value: "Rechercher par valeur",
35
+ formula: "Rechercher par formule"
36
+ },
37
+ "no-match": "Recherche terminée mais aucune correspondance trouvée.",
38
+ "no-result": "Aucun résultat"
39
+ },
40
+ replace: {
41
+ "all-success": "Remplacé toutes les {0} correspondances",
42
+ "all-failure": "Échec du remplacement",
43
+ confirm: {
44
+ title: "Êtes-vous sûr de vouloir remplacer toutes les correspondances?"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "Rechercher & Remplacer"
49
+ };
50
+ export {
51
+ e as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "Найти и заменить",
4
+ shortcut: {
5
+ "open-find-dialog": "Открыть диалог поиска",
6
+ "open-replace-dialog": "Открыть диалог замены",
7
+ "close-dialog": "Закрыть диалог поиска и замены",
8
+ "go-to-next-match": "Перейти к следующему совпадению",
9
+ "go-to-previous-match": "Перейти к предыдущему совпадению",
10
+ "focus-selection": "Фокус на выделении"
11
+ },
12
+ dialog: {
13
+ title: "Найти",
14
+ find: "Найти",
15
+ replace: "Заменить",
16
+ "replace-all": "Заменить все",
17
+ "case-sensitive": "С учетом регистра",
18
+ "find-placeholder": "Найти в этом листе",
19
+ "advanced-finding": "Расширенный поиск и замена",
20
+ "replace-placeholder": "Введите строку для замены",
21
+ "match-the-whole-cell": "Точное совпадение",
22
+ "find-direction": {
23
+ title: "Направление поиска",
24
+ row: "Поиск по строкам",
25
+ column: "Поиск по столбцам"
26
+ },
27
+ "find-scope": {
28
+ title: "Область поиска",
29
+ "current-sheet": "Текущий лист",
30
+ workbook: "Книга"
31
+ },
32
+ "find-by": {
33
+ title: "Поиск по",
34
+ value: "Поиск по значению",
35
+ formula: "Поиск по формуле"
36
+ },
37
+ "no-match": "Поиск завершен, совпадений не найдено.",
38
+ "no-result": "Нет результатов"
39
+ },
40
+ replace: {
41
+ "all-success": "Заменены все {0} совпадений",
42
+ "all-failure": "Не удалось заменить",
43
+ confirm: {
44
+ title: "Вы уверены, что хотите заменить все совпадения?"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "Найти и заменить"
49
+ };
50
+ export {
51
+ e as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const t = {
2
+ "find-replace": {
3
+ toolbar: "Tìm kiếm và Thay thế",
4
+ shortcut: {
5
+ "open-find-dialog": "Mở hộp thoại tìm kiếm",
6
+ "open-replace-dialog": "Mở hộp thoại thay thế",
7
+ "close-dialog": "Đóng hộp thoại tìm kiếm và thay thế",
8
+ "go-to-next-match": "Đến mục khớp tiếp theo",
9
+ "go-to-previous-match": "Đến mục khớp trước đó",
10
+ "focus-selection": "Tập trung vào lựa chọn"
11
+ },
12
+ dialog: {
13
+ title: "Tìm kiếm",
14
+ find: "Tìm kiếm",
15
+ replace: "Thay thế",
16
+ "replace-all": "Thay thế tất cả",
17
+ "find-placeholder": "Nhập nội dung tìm kiếm",
18
+ "advanced-finding": "Thay thế / Tìm kiếm nâng cao",
19
+ "replace-placeholder": "Nhập nội dung thay thế",
20
+ "case-sensitive": "Phân biệt chữ hoa chữ thường",
21
+ "match-the-whole-cell": "Khớp toàn bộ ô",
22
+ "find-scope": {
23
+ title: "Phạm vi tìm kiếm",
24
+ "current-sheet": "Bảng hiện tại",
25
+ workbook: "Toàn bộ sổ làm việc"
26
+ },
27
+ "find-direction": {
28
+ title: "Thứ tự tìm kiếm",
29
+ column: "Tìm theo cột",
30
+ row: "Tìm theo hàng"
31
+ },
32
+ "find-by": {
33
+ title: "Phương thức tìm kiếm",
34
+ formula: "Tìm công thức",
35
+ value: "Tìm giá trị"
36
+ },
37
+ "no-match": "Đã hoàn thành tìm kiếm nhưng không tìm thấy mục nào khớp",
38
+ "no-result": "Không có kết quả"
39
+ },
40
+ replace: {
41
+ "all-success": "Đã thay thế tất cả {0} mục khớp",
42
+ "all-failure": "Thay thế thất bại",
43
+ confirm: {
44
+ title: "Bạn có chắc muốn thay thế tất cả các mục khớp không?"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "Tìm kiếm và Thay thế"
49
+ };
50
+ export {
51
+ t as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "查找替换",
4
+ shortcut: {
5
+ "open-find-dialog": "打开查找对话框",
6
+ "open-replace-dialog": "打开替换对话框",
7
+ "close-dialog": "关闭查找替换对话框",
8
+ "go-to-next-match": "下一个匹配项",
9
+ "go-to-previous-match": "下一个匹配项",
10
+ "focus-selection": "聚焦选区"
11
+ },
12
+ dialog: {
13
+ title: "查找",
14
+ find: "查找",
15
+ replace: "替换",
16
+ "replace-all": "替换全部",
17
+ "find-placeholder": "输入查找内容",
18
+ "advanced-finding": "替换 / 高级查找",
19
+ "replace-placeholder": "输入替换内容",
20
+ "case-sensitive": "匹配大小写",
21
+ "match-the-whole-cell": "匹配整个单元格",
22
+ "find-scope": {
23
+ title: "查找范围",
24
+ "current-sheet": "当前子表",
25
+ workbook: "整个工作簿"
26
+ },
27
+ "find-direction": {
28
+ title: "查找顺序",
29
+ column: "按列查找",
30
+ row: "按行查找"
31
+ },
32
+ "find-by": {
33
+ title: "查找方式",
34
+ formula: "查找公式",
35
+ value: "查找值"
36
+ },
37
+ "no-match": "已完成搜索,但是未找到任何匹配项",
38
+ "no-result": "无结果"
39
+ },
40
+ replace: {
41
+ "all-success": "已全部替换 {0} 个匹配项",
42
+ "all-failure": "替换失败",
43
+ confirm: {
44
+ title: "确定要替换所有的匹配项吗?"
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "查找替换"
49
+ };
50
+ export {
51
+ e as default
52
+ };
@@ -0,0 +1,52 @@
1
+ const e = {
2
+ "find-replace": {
3
+ toolbar: "尋找替換",
4
+ shortcut: {
5
+ "open-find-dialog": "開啟尋找對話框",
6
+ "open-replace-dialog": "開啟替換對話框",
7
+ "close-dialog": "關閉查找替換對話框",
8
+ "go-to-next-match": "下一個匹配項",
9
+ "go-to-previous-match": "下一個匹配項",
10
+ "focus-selection": "聚焦選區"
11
+ },
12
+ dialog: {
13
+ title: "找",
14
+ find: "找",
15
+ replace: "替換",
16
+ "replace-all": "替換全部",
17
+ "find-placeholder": "輸入查找內容",
18
+ "advanced-finding": "取代 / 進階查找",
19
+ "replace-placeholder": "輸入替換內容",
20
+ "case-sensitive": "匹配大小寫",
21
+ "match-the-whole-cell": "符合整個儲存格",
22
+ "find-scope": {
23
+ title: "找出範圍",
24
+ "current-sheet": "目前子表",
25
+ workbook: "整個工作簿"
26
+ },
27
+ "find-direction": {
28
+ title: "找出順序",
29
+ column: "按列查找",
30
+ row: "按行查找"
31
+ },
32
+ "find-by": {
33
+ title: "找出方式",
34
+ formula: "找出公式",
35
+ value: "查找值"
36
+ },
37
+ "no-match": "已完成搜索,但是未找到任何匹配項",
38
+ "no-result": "無結果"
39
+ },
40
+ replace: {
41
+ "all-success": "已全部替換 {0} 個匹配項",
42
+ "all-failure": "替換失敗",
43
+ confirm: {
44
+ title: "確定要取代所有的符合項目嗎? "
45
+ }
46
+ }
47
+ },
48
+ "find-replace-shortcuts": "尋找替換"
49
+ };
50
+ export {
51
+ e as default
52
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/find-replace",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -50,15 +50,15 @@
50
50
  "lib"
51
51
  ],
52
52
  "peerDependencies": {
53
- "react": ">=16.9.0",
53
+ "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
54
54
  "rxjs": ">=7.0.0"
55
55
  },
56
56
  "dependencies": {
57
- "@univerjs/icons": "^0.2.28",
58
- "@univerjs/core": "0.6.7",
59
- "@univerjs/design": "0.6.7",
60
- "@univerjs/engine-render": "0.6.7",
61
- "@univerjs/ui": "0.6.7"
57
+ "@univerjs/icons": "^0.2.31",
58
+ "@univerjs/core": "0.6.9",
59
+ "@univerjs/design": "0.6.9",
60
+ "@univerjs/engine-render": "0.6.9",
61
+ "@univerjs/ui": "0.6.9"
62
62
  },
63
63
  "devDependencies": {
64
64
  "postcss": "^8.5.3",
@@ -68,7 +68,7 @@
68
68
  "typescript": "^5.8.2",
69
69
  "vite": "^6.2.3",
70
70
  "vitest": "^3.0.9",
71
- "@univerjs-infra/shared": "0.6.7"
71
+ "@univerjs-infra/shared": "0.6.9"
72
72
  },
73
73
  "scripts": {
74
74
  "test": "vitest run",