@univerjs/find-replace 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +106 -251
- package/lib/locale/en-US.json +48 -0
- package/lib/locale/ru-RU.json +48 -0
- package/lib/locale/zh-CN.json +48 -0
- package/lib/types/index.d.ts +0 -1
- package/lib/types/locale/en-US.d.ts +3 -63
- package/lib/umd/index.js +2 -2
- package/package.json +14 -13
- package/lib/types/locale/index.d.ts +0 -18
package/lib/es/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var ot = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var c = (t, e, n) => (ot(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
-
import { Disposable as X, IUniverInstanceService as pe, ILogService as ct, toDisposable as q, IContextService as ee, DisposableCollection as lt, CommandType as y, LocaleService as
|
|
5
|
-
import { createIdentifier as gt, Inject as
|
|
6
|
-
import { IConfirmService as mt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as
|
|
7
|
-
import { BehaviorSubject as
|
|
4
|
+
import { Disposable as X, IUniverInstanceService as pe, ILogService as ct, toDisposable as q, IContextService as ee, DisposableCollection as lt, CommandType as y, LocaleService as D, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as dt, RxDisposable as ht, OnLifecycle as ut, LifecycleStages as ft, Plugin as pt, Tools as _t } from "@univerjs/core";
|
|
5
|
+
import { createIdentifier as gt, Inject as x, Injector as ie } from "@wendellhu/redi";
|
|
6
|
+
import { IConfirmService as mt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as b, MenuGroup as vt, MenuItemType as St, MenuPosition as Ct, getMenuHiddenObservable as Rt, ComponentManager as Mt, IMenuService as xt, IShortcutService as bt, IDialogService as yt } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as P, Subject as Se, throttleTime as It, combineLatest as Ce, debounceTime as Ft, fromEvent as Pt, map as Dt, takeUntil as ce } from "rxjs";
|
|
8
8
|
import { RENDER_RAW_FORMULA_KEY as Ot } from "@univerjs/engine-render";
|
|
9
|
-
import Tt, { forwardRef as U, useRef as z, createElement as Re, useCallback as _, Fragment as $, useEffect as
|
|
10
|
-
import { MessageType as N, InputWithSlot as $t, Pager as Nt, Button as A, FormLayout as R, Input as At, Select as
|
|
9
|
+
import Tt, { forwardRef as U, useRef as z, createElement as Re, useCallback as _, Fragment as $, useEffect as j, useMemo as ne, useImperativeHandle as Et } from "react";
|
|
10
|
+
import { MessageType as N, InputWithSlot as $t, Pager as Nt, Button as A, FormLayout as R, Input as At, Select as k, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
|
|
11
11
|
import { useDependency as S } from "@wendellhu/redi/react-bindings";
|
|
12
12
|
var g = function() {
|
|
13
13
|
return g = Object.assign || function(t) {
|
|
@@ -18,7 +18,7 @@ var g = function() {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
}, g.apply(this, arguments);
|
|
21
|
-
},
|
|
21
|
+
}, jt = function(t, e) {
|
|
22
22
|
var n = {};
|
|
23
23
|
for (var i in t)
|
|
24
24
|
Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
|
|
@@ -26,16 +26,16 @@ var g = function() {
|
|
|
26
26
|
for (var s = 0, i = Object.getOwnPropertySymbols(t); s < i.length; s++)
|
|
27
27
|
e.indexOf(i[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[s]) && (n[i[s]] = t[i[s]]);
|
|
28
28
|
return n;
|
|
29
|
-
},
|
|
30
|
-
var n = t.icon, i = t.id, s = t.className, r = t.extend, a =
|
|
31
|
-
return
|
|
29
|
+
}, Me = U(function(t, e) {
|
|
30
|
+
var n = t.icon, i = t.id, s = t.className, r = t.extend, a = jt(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(Ut()));
|
|
31
|
+
return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, g({ ref: e, className: o }, a), r);
|
|
32
32
|
});
|
|
33
|
-
function
|
|
34
|
-
return Re(t.tag, g(g({ key: e },
|
|
35
|
-
return
|
|
33
|
+
function xe(t, e, n, i, s) {
|
|
34
|
+
return Re(t.tag, g(g({ key: e }, Lt(t, n, s)), i), (wt(t, n).children || []).map(function(r, a) {
|
|
35
|
+
return xe(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Lt(t, e, n) {
|
|
39
39
|
var i = g({}, t.attrs);
|
|
40
40
|
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
|
|
41
41
|
var s = e.defIds;
|
|
@@ -44,7 +44,7 @@ function jt(t, e, n) {
|
|
|
44
44
|
typeof o == "string" && (i[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
45
45
|
})), i;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function wt(t, e) {
|
|
48
48
|
var n, i = e.defIds;
|
|
49
49
|
return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? g(g({}, t), { children: t.children.map(function(s) {
|
|
50
50
|
return typeof s.attrs.id == "string" && i && i.indexOf(s.attrs.id) > -1 ? g(g({}, s), { attrs: g(g({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
|
|
@@ -53,32 +53,32 @@ function Lt(t, e) {
|
|
|
53
53
|
function Ut() {
|
|
54
54
|
return Math.random().toString(36).substring(2, 8);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] },
|
|
58
|
-
return Re(
|
|
56
|
+
Me.displayName = "UniverIcon";
|
|
57
|
+
var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, be = U(function(t, e) {
|
|
58
|
+
return Re(Me, Object.assign({}, t, {
|
|
59
59
|
id: "search-single-16",
|
|
60
60
|
ref: e,
|
|
61
61
|
icon: Bt
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
be.displayName = "SearchSingle16";
|
|
65
65
|
const ye = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
|
|
66
|
-
var Wt = Object.defineProperty,
|
|
67
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
66
|
+
var Wt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
|
|
67
|
+
for (var s = i > 1 ? void 0 : i ? Gt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
68
68
|
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
69
69
|
return i && s && Wt(e, n, s), s;
|
|
70
|
-
},
|
|
71
|
-
class
|
|
70
|
+
}, L = (t, e) => (n, i) => e(n, i, t);
|
|
71
|
+
class ji extends X {
|
|
72
72
|
}
|
|
73
73
|
const m = gt("find-replace.service");
|
|
74
|
-
function
|
|
74
|
+
function Vt(t) {
|
|
75
75
|
return typeof t.findString < "u" || typeof t.inputtingFindString < "u" || typeof t.findDirection < "u" || typeof t.matchesTheWholeCell < "u" || typeof t.caseSensitive < "u" || typeof t.findScope < "u" || typeof t.findBy < "u";
|
|
76
76
|
}
|
|
77
77
|
let K = class extends X {
|
|
78
78
|
constructor(e, n, i, s) {
|
|
79
79
|
super();
|
|
80
|
-
c(this, "currentMatch$", new
|
|
81
|
-
c(this, "replaceables$", new
|
|
80
|
+
c(this, "currentMatch$", new P(null));
|
|
81
|
+
c(this, "replaceables$", new P([]));
|
|
82
82
|
/** All find models returned by providers. */
|
|
83
83
|
c(this, "_findModels", []);
|
|
84
84
|
/** The find model that the current match is from. */
|
|
@@ -88,7 +88,7 @@ let K = class extends X {
|
|
|
88
88
|
this._state = e, this._providers = n, this._univerInstanceService = i, this._logService = s, this.disposeWithMe(
|
|
89
89
|
this._state.stateUpdates$.pipe(It(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
|
|
90
90
|
const a = this._state.state;
|
|
91
|
-
|
|
91
|
+
Vt(r) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
94
|
}
|
|
@@ -210,9 +210,9 @@ let K = class extends X {
|
|
|
210
210
|
return this.currentMatch$.next(a), o;
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
K =
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
K = Pe([
|
|
214
|
+
L(2, pe),
|
|
215
|
+
L(3, ct)
|
|
216
216
|
], K);
|
|
217
217
|
var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Z || {}), J = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(J || {});
|
|
218
218
|
function se() {
|
|
@@ -232,11 +232,11 @@ function se() {
|
|
|
232
232
|
revealed: !0
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
class
|
|
235
|
+
class kt {
|
|
236
236
|
constructor() {
|
|
237
237
|
c(this, "_stateUpdates$", new Se());
|
|
238
238
|
c(this, "stateUpdates$", this._stateUpdates$.asObservable());
|
|
239
|
-
c(this, "_state$", new
|
|
239
|
+
c(this, "_state$", new P(se()));
|
|
240
240
|
c(this, "state$", this._state$.asObservable());
|
|
241
241
|
c(this, "_findString", "");
|
|
242
242
|
c(this, "_inputtingFindString", "");
|
|
@@ -317,11 +317,11 @@ let Q = class extends X {
|
|
|
317
317
|
constructor(e, n) {
|
|
318
318
|
super();
|
|
319
319
|
c(this, "_providers", /* @__PURE__ */ new Set());
|
|
320
|
-
c(this, "_state", new
|
|
320
|
+
c(this, "_state", new kt());
|
|
321
321
|
c(this, "_model");
|
|
322
|
-
c(this, "_currentMatch$", new
|
|
322
|
+
c(this, "_currentMatch$", new P(null));
|
|
323
323
|
c(this, "currentMatch$", this._currentMatch$.asObservable());
|
|
324
|
-
c(this, "_replaceables$", new
|
|
324
|
+
c(this, "_replaceables$", new P([]));
|
|
325
325
|
c(this, "replaceables$", this._replaceables$.asObservable());
|
|
326
326
|
c(this, "_focusSignal$", new Se());
|
|
327
327
|
c(this, "focusSignal$", this._focusSignal$.asObservable());
|
|
@@ -421,9 +421,9 @@ let Q = class extends X {
|
|
|
421
421
|
this._contextService.setContextValue(Ot, e);
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
|
-
Q =
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
Q = Pe([
|
|
425
|
+
L(0, x(ie)),
|
|
426
|
+
L(1, ee)
|
|
427
427
|
], Q);
|
|
428
428
|
const B = {
|
|
429
429
|
id: "ui.operation.open-find-dialog",
|
|
@@ -439,7 +439,7 @@ const B = {
|
|
|
439
439
|
const e = t.get(m);
|
|
440
440
|
return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
|
|
441
441
|
}
|
|
442
|
-
},
|
|
442
|
+
}, De = {
|
|
443
443
|
type: y.OPERATION,
|
|
444
444
|
id: "ui.operation.go-to-next-match",
|
|
445
445
|
handler: (t) => (t.get(m).moveToNextMatch(), !0)
|
|
@@ -482,7 +482,7 @@ const $e = {
|
|
|
482
482
|
id: "ui.command.replace-all-matches",
|
|
483
483
|
type: y.COMMAND,
|
|
484
484
|
handler: async (t) => {
|
|
485
|
-
const e = t.get(mt), n = t.get(
|
|
485
|
+
const e = t.get(mt), n = t.get(D), i = t.get(me);
|
|
486
486
|
if (!await e.confirm({
|
|
487
487
|
id: Jt,
|
|
488
488
|
title: { title: n.t("find-replace.replace.confirm.title") },
|
|
@@ -528,14 +528,14 @@ function Ae(t) {
|
|
|
528
528
|
}
|
|
529
529
|
);
|
|
530
530
|
}
|
|
531
|
-
const Qt = "univer-find-replace-dialog-container", Xt = "univer-find-replace-expand-container", ei = "univer-button-text", ti = "univer-find-replace-buttons-group", ii = "univer-find-replace-buttons-group-right",
|
|
531
|
+
const Qt = "univer-find-replace-dialog-container", Xt = "univer-find-replace-expand-container", ei = "univer-button-text", ti = "univer-find-replace-buttons-group", ii = "univer-find-replace-buttons-group-right", w = {
|
|
532
532
|
findReplaceDialogContainer: Qt,
|
|
533
533
|
findReplaceExpandContainer: Xt,
|
|
534
534
|
buttonText: ei,
|
|
535
535
|
findReplaceButtonsGroup: ti,
|
|
536
536
|
findReplaceButtonsGroupRight: ii
|
|
537
537
|
};
|
|
538
|
-
function
|
|
538
|
+
function je(t, e) {
|
|
539
539
|
const n = _(() => {
|
|
540
540
|
var s;
|
|
541
541
|
(s = document.querySelector(".univer-find-input input")) == null || s.focus();
|
|
@@ -543,16 +543,16 @@ function we(t, e) {
|
|
|
543
543
|
const s = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
|
|
544
544
|
return Array.from(s).some((r) => r === document.activeElement);
|
|
545
545
|
}, []);
|
|
546
|
-
return Et(e, () => ({ focus: n, selectHasFocus: i })),
|
|
546
|
+
return Et(e, () => ({ focus: n, selectHasFocus: i })), j(() => {
|
|
547
547
|
const s = t.focusSignal$.subscribe(() => n());
|
|
548
548
|
return () => s.unsubscribe();
|
|
549
549
|
}, [t, n]), { focus: n, selectHasFocus: i };
|
|
550
550
|
}
|
|
551
551
|
const ni = U(function(e, n) {
|
|
552
|
-
const i = S(
|
|
552
|
+
const i = S(D), s = S(m), r = S(te), a = I(s.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
|
|
553
553
|
r.executeCommand(re.id);
|
|
554
554
|
}, [r]), T = _((C) => s.changeFindString(C), [s]);
|
|
555
|
-
return
|
|
555
|
+
return je(s, n), /* @__PURE__ */ l.jsxs($, { children: [
|
|
556
556
|
/* @__PURE__ */ l.jsx(
|
|
557
557
|
Ae,
|
|
558
558
|
{
|
|
@@ -566,10 +566,10 @@ const ni = U(function(e, n) {
|
|
|
566
566
|
onChange: T
|
|
567
567
|
}
|
|
568
568
|
),
|
|
569
|
-
/* @__PURE__ */ l.jsx("div", { className:
|
|
569
|
+
/* @__PURE__ */ l.jsx("div", { className: w.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(A, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
|
|
570
570
|
] });
|
|
571
571
|
}), si = U(function(e, n) {
|
|
572
|
-
const i = S(m), s = S(
|
|
572
|
+
const i = S(m), s = S(D), r = S(te), a = S(me), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
|
|
573
573
|
matchesCount: f,
|
|
574
574
|
matchesPosition: p,
|
|
575
575
|
findString: T,
|
|
@@ -577,17 +577,17 @@ const ni = U(function(e, n) {
|
|
|
577
577
|
replaceString: Ue,
|
|
578
578
|
caseSensitive: Be,
|
|
579
579
|
matchesTheWholeCell: We,
|
|
580
|
-
findDirection:
|
|
581
|
-
findScope:
|
|
582
|
-
findBy:
|
|
583
|
-
findCompleted:
|
|
580
|
+
findDirection: Ge,
|
|
581
|
+
findScope: Ve,
|
|
582
|
+
findBy: ke,
|
|
583
|
+
findCompleted: V
|
|
584
584
|
} = u, He = C.length === 0, qe = f === 0 || !(o != null && o.replaceable), ze = d.length === 0, Ke = _(
|
|
585
585
|
(h) => i.changeInputtingFindString(h),
|
|
586
586
|
[i]
|
|
587
587
|
), Ye = _(
|
|
588
588
|
(h) => i.changeReplaceString(h),
|
|
589
589
|
[i]
|
|
590
|
-
), { focus: Ze } =
|
|
590
|
+
), { focus: Ze } = je(i, n), Je = _(() => {
|
|
591
591
|
T === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
|
|
592
592
|
}, [T, C, i]), Qe = _(() => r.executeCommand($e.id), [r]), Xe = _(async () => {
|
|
593
593
|
await r.executeCommand(Ne.id), Ze();
|
|
@@ -598,19 +598,19 @@ const ni = U(function(e, n) {
|
|
|
598
598
|
}, [i]), it = _((h) => {
|
|
599
599
|
i.changeFindBy(h);
|
|
600
600
|
}, [i]), nt = ai(s), st = oi(s), rt = ci(s);
|
|
601
|
-
return
|
|
602
|
-
const h =
|
|
601
|
+
return j(() => {
|
|
602
|
+
const h = V && f === 0;
|
|
603
603
|
let E = null;
|
|
604
604
|
return h && (E = a.show({
|
|
605
605
|
content: s.t("find-replace.dialog.no-match"),
|
|
606
606
|
type: N.Warning,
|
|
607
|
-
|
|
607
|
+
duration: 5e3
|
|
608
608
|
})), () => E == null ? void 0 : E.dispose();
|
|
609
|
-
}, [
|
|
609
|
+
}, [V, f, a, s]), /* @__PURE__ */ l.jsxs($, { children: [
|
|
610
610
|
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
|
|
611
611
|
Ae,
|
|
612
612
|
{
|
|
613
|
-
findCompleted:
|
|
613
|
+
findCompleted: V,
|
|
614
614
|
className: "univer-find-input",
|
|
615
615
|
matchesCount: f,
|
|
616
616
|
matchesPosition: p,
|
|
@@ -628,10 +628,10 @@ const ni = U(function(e, n) {
|
|
|
628
628
|
onChange: (h) => Ye(h)
|
|
629
629
|
}
|
|
630
630
|
) }),
|
|
631
|
-
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(
|
|
631
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(k, { value: Ge, options: st, onChange: et }) }),
|
|
632
632
|
/* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
|
|
633
|
-
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(
|
|
634
|
-
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(
|
|
633
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(k, { value: Ve, options: nt, onChange: tt }) }),
|
|
634
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(k, { value: ke, options: rt, onChange: it }) })
|
|
635
635
|
] }) }),
|
|
636
636
|
/* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
|
|
637
637
|
/* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
|
|
@@ -655,9 +655,9 @@ const ni = U(function(e, n) {
|
|
|
655
655
|
}
|
|
656
656
|
) })
|
|
657
657
|
] }) }),
|
|
658
|
-
/* @__PURE__ */ l.jsxs("div", { className:
|
|
658
|
+
/* @__PURE__ */ l.jsxs("div", { className: w.findReplaceButtonsGroup, children: [
|
|
659
659
|
/* @__PURE__ */ l.jsx(A, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
|
|
660
|
-
/* @__PURE__ */ l.jsxs("span", { className:
|
|
660
|
+
/* @__PURE__ */ l.jsxs("span", { className: w.findReplaceButtonsGroupRight, children: [
|
|
661
661
|
/* @__PURE__ */ l.jsx(A, { disabled: qe, onClick: Qe, children: s.t("find-replace.dialog.replace") }),
|
|
662
662
|
/* @__PURE__ */ l.jsx(A, { disabled: ze, onClick: Xe, children: s.t("find-replace.dialog.replace-all") })
|
|
663
663
|
] })
|
|
@@ -666,7 +666,7 @@ const ni = U(function(e, n) {
|
|
|
666
666
|
});
|
|
667
667
|
function ri() {
|
|
668
668
|
const t = S(m), e = S(ve), n = S(ee), i = I(t.state$, void 0, !0), s = z(null);
|
|
669
|
-
|
|
669
|
+
j(() => {
|
|
670
670
|
let d;
|
|
671
671
|
return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
|
|
672
672
|
}, [e]);
|
|
@@ -677,16 +677,16 @@ function ri() {
|
|
|
677
677
|
(d) => n.setContextValue(ye, d),
|
|
678
678
|
[n]
|
|
679
679
|
);
|
|
680
|
-
return
|
|
680
|
+
return j(() => {
|
|
681
681
|
var u;
|
|
682
|
-
const d =
|
|
682
|
+
const d = Pt(document, "focusin").subscribe((f) => {
|
|
683
683
|
var p;
|
|
684
684
|
f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? o(!0) : o(!1);
|
|
685
685
|
});
|
|
686
686
|
return (u = r.current) == null || u.focus(), a(!0), o(!0), () => {
|
|
687
687
|
d.unsubscribe(), a(!1);
|
|
688
688
|
};
|
|
689
|
-
}, [a, o]), /* @__PURE__ */ l.jsx("div", { className:
|
|
689
|
+
}, [a, o]), /* @__PURE__ */ l.jsx("div", { className: w.findReplaceDialogContainer, ref: s, children: i.replaceRevealed ? /* @__PURE__ */ l.jsx(si, { ref: r }) : /* @__PURE__ */ l.jsx(ni, { ref: r }) });
|
|
690
690
|
}
|
|
691
691
|
function ai(t) {
|
|
692
692
|
const e = t.getCurrentLocale();
|
|
@@ -715,10 +715,10 @@ function O(t) {
|
|
|
715
715
|
function li(t) {
|
|
716
716
|
return t.getContextValue(Fe);
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Le(t) {
|
|
719
719
|
return t.getContextValue(ye);
|
|
720
720
|
}
|
|
721
|
-
const
|
|
721
|
+
const G = "7_find-replace-shortcuts";
|
|
722
722
|
function ae(t) {
|
|
723
723
|
return t.getContextValue(_e);
|
|
724
724
|
}
|
|
@@ -728,45 +728,45 @@ function oe(t) {
|
|
|
728
728
|
const di = {
|
|
729
729
|
id: B.id,
|
|
730
730
|
description: "find-replace.shortcut.open-find-dialog",
|
|
731
|
-
binding:
|
|
732
|
-
group:
|
|
731
|
+
binding: M.F | b.CTRL_COMMAND,
|
|
732
|
+
group: G,
|
|
733
733
|
preconditions(t) {
|
|
734
734
|
return !O(t) && ae(t) && oe(t);
|
|
735
735
|
}
|
|
736
736
|
}, hi = {
|
|
737
737
|
id: B.id,
|
|
738
738
|
description: "find-replace.shortcut.open-find-dialog",
|
|
739
|
-
binding:
|
|
740
|
-
mac:
|
|
739
|
+
binding: M.F | b.CTRL_COMMAND,
|
|
740
|
+
mac: M.F | b.MAC_CTRL,
|
|
741
741
|
preconditions(t) {
|
|
742
742
|
return !O(t) && ae(t) && oe(t);
|
|
743
743
|
}
|
|
744
744
|
}, ui = {
|
|
745
745
|
id: re.id,
|
|
746
746
|
description: "find-replace.shortcut.open-replace-dialog",
|
|
747
|
-
binding:
|
|
748
|
-
mac:
|
|
749
|
-
group:
|
|
747
|
+
binding: M.H | b.CTRL_COMMAND,
|
|
748
|
+
mac: M.H | b.MAC_CTRL,
|
|
749
|
+
group: G,
|
|
750
750
|
preconditions(t) {
|
|
751
751
|
return ae(t) && oe(t) && (!O(t) || !li(t));
|
|
752
752
|
}
|
|
753
753
|
}, fi = {
|
|
754
|
-
id:
|
|
754
|
+
id: De.id,
|
|
755
755
|
description: "find-replace.shortcut.go-to-next-match",
|
|
756
|
-
binding:
|
|
757
|
-
group:
|
|
756
|
+
binding: M.ENTER,
|
|
757
|
+
group: G,
|
|
758
758
|
priority: 1e3,
|
|
759
759
|
preconditions(t) {
|
|
760
|
-
return
|
|
760
|
+
return Le(t) && O(t);
|
|
761
761
|
}
|
|
762
762
|
}, pi = {
|
|
763
763
|
id: Oe.id,
|
|
764
764
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
765
|
-
binding:
|
|
766
|
-
group:
|
|
765
|
+
binding: M.ENTER | b.SHIFT,
|
|
766
|
+
group: G,
|
|
767
767
|
priority: 1e3,
|
|
768
768
|
preconditions(t) {
|
|
769
|
-
return
|
|
769
|
+
return Le(t) && O(t);
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
772
|
function _i(t) {
|
|
@@ -782,7 +782,7 @@ function _i(t) {
|
|
|
782
782
|
disabled$: Ce([
|
|
783
783
|
e.subscribeContextValue$(ge),
|
|
784
784
|
e.subscribeContextValue$(_e)
|
|
785
|
-
]).pipe(
|
|
785
|
+
]).pipe(Dt(([n, i]) => n || !i))
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
788
|
var gi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, vi = (t, e, n, i) => {
|
|
@@ -790,7 +790,7 @@ var gi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, vi = (t, e
|
|
|
790
790
|
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
791
791
|
return i && s && gi(e, n, s), s;
|
|
792
792
|
}, v = (t, e) => (n, i) => e(n, i, t);
|
|
793
|
-
const Si = {}, he = "DESKTOP_FIND_REPLACE_DIALOG",
|
|
793
|
+
const Si = {}, he = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, Ci = 20, Ri = -90;
|
|
794
794
|
let F = class extends ht {
|
|
795
795
|
constructor(t, e, n, i, s, r, a, o, d, u, f) {
|
|
796
796
|
super(), this._config = t, this._univerInstanceService = e, this._menuService = n, this._shortcutService = i, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = o, this._localeService = d, this._componentManager = u, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
|
|
@@ -799,7 +799,7 @@ let F = class extends ht {
|
|
|
799
799
|
[
|
|
800
800
|
B,
|
|
801
801
|
re,
|
|
802
|
-
|
|
802
|
+
De,
|
|
803
803
|
Oe,
|
|
804
804
|
Ne,
|
|
805
805
|
$e
|
|
@@ -818,7 +818,7 @@ let F = class extends ht {
|
|
|
818
818
|
}
|
|
819
819
|
_initUI() {
|
|
820
820
|
const { menu: t = {} } = this._config;
|
|
821
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(_i), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ri)), this.disposeWithMe(this._componentManager.register("SearchIcon",
|
|
821
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(_i), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ri)), this.disposeWithMe(this._componentManager.register("SearchIcon", be)), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
822
822
|
e.revealed === !0 && this._openPanel();
|
|
823
823
|
}), this.disposeWithMe(
|
|
824
824
|
this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
@@ -830,11 +830,11 @@ let F = class extends ht {
|
|
|
830
830
|
this._dialogService.open({
|
|
831
831
|
id: he,
|
|
832
832
|
draggable: !0,
|
|
833
|
-
width:
|
|
833
|
+
width: we,
|
|
834
834
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
835
835
|
children: { label: "FindReplaceDialog" },
|
|
836
836
|
destroyOnClose: !0,
|
|
837
|
-
defaultPosition:
|
|
837
|
+
defaultPosition: Mi(),
|
|
838
838
|
preservePositionOnDestroy: !0,
|
|
839
839
|
onClose: () => this.closePanel()
|
|
840
840
|
});
|
|
@@ -846,172 +846,30 @@ let F = class extends ht {
|
|
|
846
846
|
F = vi([
|
|
847
847
|
ut(ft.Rendered, F),
|
|
848
848
|
v(1, pe),
|
|
849
|
-
v(2,
|
|
850
|
-
v(3,
|
|
849
|
+
v(2, xt),
|
|
850
|
+
v(3, bt),
|
|
851
851
|
v(4, te),
|
|
852
852
|
v(5, m),
|
|
853
853
|
v(6, yt),
|
|
854
854
|
v(7, ve),
|
|
855
|
-
v(8,
|
|
856
|
-
v(9,
|
|
857
|
-
v(10,
|
|
855
|
+
v(8, x(D)),
|
|
856
|
+
v(9, x(Mt)),
|
|
857
|
+
v(10, x(ie))
|
|
858
858
|
], F);
|
|
859
|
-
function
|
|
859
|
+
function Mi() {
|
|
860
860
|
const { innerWidth: t } = window;
|
|
861
|
-
return { x: (t -
|
|
861
|
+
return { x: (t - we) / 2 - Ci, y: Ri };
|
|
862
862
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
toolbar: "Find & Replace",
|
|
866
|
-
shortcut: {
|
|
867
|
-
"open-find-dialog": "Open Find Dialog",
|
|
868
|
-
"open-replace-dialog": "Open Replace Dialog",
|
|
869
|
-
"close-dialog": "Close Find & Replace Dialog",
|
|
870
|
-
"go-to-next-match": "Go to Next Match",
|
|
871
|
-
"go-to-previous-match": "Go to Previous Match"
|
|
872
|
-
},
|
|
873
|
-
dialog: {
|
|
874
|
-
title: "Find",
|
|
875
|
-
find: "Find",
|
|
876
|
-
replace: "Replace",
|
|
877
|
-
"replace-all": "Replace All",
|
|
878
|
-
"case-sensitive": "Case Sensitive",
|
|
879
|
-
"find-placeholder": "Find in this Sheet",
|
|
880
|
-
"advanced-finding": "Advanced Searching & Replace",
|
|
881
|
-
"replace-placeholder": "Input Replace String",
|
|
882
|
-
"match-the-whole-cell": "Match the Whole Cell",
|
|
883
|
-
"find-direction": {
|
|
884
|
-
title: "Find Direction",
|
|
885
|
-
row: "Search by Row",
|
|
886
|
-
column: "Search by Column"
|
|
887
|
-
},
|
|
888
|
-
"find-scope": {
|
|
889
|
-
title: "Find Range",
|
|
890
|
-
"current-sheet": "Current Sheet",
|
|
891
|
-
workbook: "Workbook"
|
|
892
|
-
},
|
|
893
|
-
"find-by": {
|
|
894
|
-
title: "Find By",
|
|
895
|
-
value: "Find by Value",
|
|
896
|
-
formula: "Find Formula"
|
|
897
|
-
},
|
|
898
|
-
"no-match": "Finding completed but no match found.",
|
|
899
|
-
"no-result": "No Result"
|
|
900
|
-
},
|
|
901
|
-
replace: {
|
|
902
|
-
"all-success": "Replaced all {0} matches",
|
|
903
|
-
"all-failure": "Replace failed",
|
|
904
|
-
confirm: {
|
|
905
|
-
title: "Are you sure to replace all matches?"
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
},
|
|
909
|
-
"find-replace-shortcuts": "Find & Replace"
|
|
910
|
-
}, Wi = Mi, xi = {
|
|
911
|
-
"find-replace": {
|
|
912
|
-
toolbar: "查找替换",
|
|
913
|
-
shortcut: {
|
|
914
|
-
"open-find-dialog": "打开查找对话框",
|
|
915
|
-
"open-replace-dialog": "打开替换对话框",
|
|
916
|
-
"close-dialog": "关闭查找替换对话框",
|
|
917
|
-
"go-to-next-match": "下一个匹配项",
|
|
918
|
-
"go-to-previous-match": "下一个匹配项"
|
|
919
|
-
},
|
|
920
|
-
dialog: {
|
|
921
|
-
title: "查找",
|
|
922
|
-
find: "查找",
|
|
923
|
-
replace: "替换",
|
|
924
|
-
"replace-all": "替换全部",
|
|
925
|
-
"find-placeholder": "输入查找内容",
|
|
926
|
-
"advanced-finding": "替换 / 高级查找",
|
|
927
|
-
"replace-placeholder": "输入替换内容",
|
|
928
|
-
"case-sensitive": "匹配大小写",
|
|
929
|
-
"match-the-whole-cell": "匹配整个单元格",
|
|
930
|
-
"find-scope": {
|
|
931
|
-
title: "查找范围",
|
|
932
|
-
"current-sheet": "当前子表",
|
|
933
|
-
workbook: "整个工作簿"
|
|
934
|
-
},
|
|
935
|
-
"find-direction": {
|
|
936
|
-
title: "查找顺序",
|
|
937
|
-
column: "按列查找",
|
|
938
|
-
row: "按行查找"
|
|
939
|
-
},
|
|
940
|
-
"find-by": {
|
|
941
|
-
title: "查找方式",
|
|
942
|
-
formula: "查找公式",
|
|
943
|
-
value: "查找值"
|
|
944
|
-
},
|
|
945
|
-
"no-match": "已完成搜索,但是未找到任何匹配项",
|
|
946
|
-
"no-result": "无结果"
|
|
947
|
-
},
|
|
948
|
-
replace: {
|
|
949
|
-
"all-success": "已全部替换 {0} 个匹配项",
|
|
950
|
-
"all-failure": "替换失败",
|
|
951
|
-
confirm: {
|
|
952
|
-
title: "确定要替换所有的匹配项吗?"
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
},
|
|
956
|
-
"find-replace-shortcuts": "查找替换"
|
|
957
|
-
}, yi = xi, Ii = {
|
|
958
|
-
"find-replace": {
|
|
959
|
-
toolbar: "Найти и заменить",
|
|
960
|
-
shortcut: {
|
|
961
|
-
"open-find-dialog": "Открыть диалог поиска",
|
|
962
|
-
"open-replace-dialog": "Открыть диалог замены",
|
|
963
|
-
"close-dialog": "Закрыть диалог поиска и замены",
|
|
964
|
-
"go-to-next-match": "Перейти к следующему совпадению",
|
|
965
|
-
"go-to-previous-match": "Перейти к предыдущему совпадению"
|
|
966
|
-
},
|
|
967
|
-
dialog: {
|
|
968
|
-
title: "Найти",
|
|
969
|
-
find: "Найти",
|
|
970
|
-
replace: "Заменить",
|
|
971
|
-
"replace-all": "Заменить все",
|
|
972
|
-
"case-sensitive": "С учетом регистра",
|
|
973
|
-
"find-placeholder": "Найти в этом листе",
|
|
974
|
-
"advanced-finding": "Расширенный поиск и замена",
|
|
975
|
-
"replace-placeholder": "Введите строку для замены",
|
|
976
|
-
"match-the-whole-cell": "Точное совпадение",
|
|
977
|
-
"find-direction": {
|
|
978
|
-
title: "Направление поиска",
|
|
979
|
-
row: "Поиск по строкам",
|
|
980
|
-
column: "Поиск по столбцам"
|
|
981
|
-
},
|
|
982
|
-
"find-scope": {
|
|
983
|
-
title: "Область поиска",
|
|
984
|
-
"current-sheet": "Текущий лист",
|
|
985
|
-
workbook: "Книга"
|
|
986
|
-
},
|
|
987
|
-
"find-by": {
|
|
988
|
-
title: "Поиск по",
|
|
989
|
-
value: "Поиск по значению",
|
|
990
|
-
formula: "Поиск по формуле"
|
|
991
|
-
},
|
|
992
|
-
"no-match": "Поиск завершен, совпадений не найдено.",
|
|
993
|
-
"no-result": "Нет результатов"
|
|
994
|
-
},
|
|
995
|
-
replace: {
|
|
996
|
-
"all-success": "Заменены все {0} совпадений",
|
|
997
|
-
"all-failure": "Не удалось заменить",
|
|
998
|
-
confirm: {
|
|
999
|
-
title: "Вы уверены, что хотите заменить все совпадения?"
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
},
|
|
1003
|
-
"find-replace-shortcuts": "Найти и заменить"
|
|
1004
|
-
}, ki = Ii;
|
|
1005
|
-
var Fi = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, Pi = (t, e, n, i) => {
|
|
1006
|
-
for (var s = i > 1 ? void 0 : i ? Di(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
863
|
+
var xi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, yi = (t, e, n, i) => {
|
|
864
|
+
for (var s = i > 1 ? void 0 : i ? bi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
1007
865
|
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
1008
|
-
return i && s &&
|
|
866
|
+
return i && s && xi(e, n, s), s;
|
|
1009
867
|
}, ue = (t, e) => (n, i) => e(n, i, t);
|
|
1010
|
-
const
|
|
868
|
+
const Ii = "FIND_REPLACE_PLUGIN";
|
|
1011
869
|
var H;
|
|
1012
870
|
let fe = (H = class extends pt {
|
|
1013
871
|
constructor(t = {}, e, n) {
|
|
1014
|
-
super(), this._config = t, this._injector = e, this._localeService = n, this.
|
|
872
|
+
super(), this._config = t, this._injector = e, this._localeService = n, this._config = _t.deepMerge({}, Si, this._config);
|
|
1015
873
|
}
|
|
1016
874
|
onStarting(t) {
|
|
1017
875
|
[
|
|
@@ -1028,20 +886,17 @@ let fe = (H = class extends pt {
|
|
|
1028
886
|
}
|
|
1029
887
|
);
|
|
1030
888
|
}
|
|
1031
|
-
}, c(H, "pluginName",
|
|
1032
|
-
fe =
|
|
1033
|
-
ue(1,
|
|
1034
|
-
ue(2,
|
|
889
|
+
}, c(H, "pluginName", Ii), H);
|
|
890
|
+
fe = yi([
|
|
891
|
+
ue(1, x(ie)),
|
|
892
|
+
ue(2, x(D))
|
|
1035
893
|
], fe);
|
|
1036
894
|
export {
|
|
1037
895
|
Z as FindBy,
|
|
1038
896
|
Y as FindDirection,
|
|
1039
|
-
|
|
897
|
+
ji as FindModel,
|
|
1040
898
|
F as FindReplaceController,
|
|
1041
899
|
J as FindScope,
|
|
1042
900
|
m as IFindReplaceService,
|
|
1043
|
-
fe as UniverFindReplacePlugin
|
|
1044
|
-
Wi as enUS,
|
|
1045
|
-
ki as ruRU,
|
|
1046
|
-
yi as zhCN
|
|
901
|
+
fe as UniverFindReplacePlugin
|
|
1047
902
|
};
|