@univerjs/find-replace 0.1.4 → 0.1.6
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 +168 -119
- package/lib/types/commands/command/replace.command.d.ts +2 -16
- package/lib/types/commands/operations/find-replace.operation.d.ts +2 -16
- package/lib/types/controllers/find-replace.controller.d.ts +4 -18
- package/lib/types/controllers/find-replace.menu.d.ts +3 -17
- package/lib/types/controllers/find-replace.shortcut.d.ts +2 -16
- package/lib/types/index.d.ts +1 -0
- package/lib/types/locale/zh-CN.d.ts +2 -16
- package/lib/types/plugin.d.ts +2 -16
- package/lib/types/services/find-replace.service.d.ts +5 -22
- package/lib/types/views/dialog/FindReplaceDialog.d.ts +2 -16
- package/lib/types/views/dialog/FindReplaceDialog.stories.d.ts +3 -17
- package/lib/types/views/dialog/SearchInput.d.ts +5 -19
- package/lib/umd/index.js +2 -2
- package/package.json +15 -15
package/lib/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var rt = Object.defineProperty;
|
|
2
2
|
var at = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var c = (t, e, n) => (at(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
-
import { Disposable as X, IUniverInstanceService as he, ILogService as ue, toDisposable as q, IContextService as U, DisposableCollection as ot, CommandType as
|
|
5
|
-
import { createIdentifier as
|
|
6
|
-
import { IConfirmService as
|
|
7
|
-
import { BehaviorSubject as F, Subject as ve, throttleTime as
|
|
4
|
+
import { Disposable as X, IUniverInstanceService as he, ILogService as ue, toDisposable as q, IContextService as U, DisposableCollection as ot, CommandType as M, LocaleService as D, ICommandService as ee, FOCUSING_SHEET as pe, EDITOR_ACTIVATED as fe, UniverInstanceType as ct, RxDisposable as lt, OnLifecycle as dt, LifecycleStages as ht, Plugin as ut } from "@univerjs/core";
|
|
5
|
+
import { createIdentifier as pt, Inject as y, Injector as _e } from "@wendellhu/redi";
|
|
6
|
+
import { IConfirmService as ft, IMessageService as ge, useObservable as I, ILayoutService as me, KeyCode as b, MetaKeys as x, MenuGroup as _t, MenuItemType as gt, MenuPosition as mt, getMenuHiddenObservable as vt, ComponentManager as St, IMenuService as Ct, IShortcutService as Rt, IDialogService as bt } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as F, Subject as ve, throttleTime as xt, combineLatest as Se, debounceTime as Mt, fromEvent as yt, map as It, takeUntil as ae } from "rxjs";
|
|
8
8
|
import { RENDER_RAW_FORMULA_KEY as Ft } from "@univerjs/engine-render";
|
|
9
|
-
import
|
|
9
|
+
import Dt, { forwardRef as B, useRef as z, createElement as Ce, useCallback as _, Fragment as E, useEffect as w, useMemo as te, useImperativeHandle as Pt } from "react";
|
|
10
10
|
import { MessageType as $, InputWithSlot as Ot, Pager as Tt, Button as N, FormLayout as R, Input as Et, Select as H, FormDualColumnLayout as oe, Checkbox as ce } from "@univerjs/design";
|
|
11
11
|
import { useDependency as S } from "@wendellhu/redi/react-bindings";
|
|
12
12
|
var m = function() {
|
|
@@ -27,12 +27,12 @@ var m = function() {
|
|
|
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
29
|
}, Re = B(function(t, e) {
|
|
30
|
-
var n = t.icon, i = t.id, s = t.className, r = t.extend, a = $t(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(
|
|
31
|
-
return
|
|
30
|
+
var n = t.icon, i = t.id, s = t.className, r = t.extend, a = $t(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(wt()));
|
|
31
|
+
return be(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, m({ ref: e, className: o }, a), r);
|
|
32
32
|
});
|
|
33
|
-
function
|
|
33
|
+
function be(t, e, n, i, s) {
|
|
34
34
|
return Ce(t.tag, m(m({ key: e }, Nt(t, n, s)), i), (At(t, n).children || []).map(function(r, a) {
|
|
35
|
-
return
|
|
35
|
+
return be(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
38
|
function Nt(t, e, n) {
|
|
@@ -50,27 +50,27 @@ function At(t, e) {
|
|
|
50
50
|
return typeof s.attrs.id == "string" && i && i.indexOf(s.attrs.id) > -1 ? m(m({}, s), { attrs: m(m({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
|
|
51
51
|
}) }) : t;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function wt() {
|
|
54
54
|
return Math.random().toString(36).substring(2, 8);
|
|
55
55
|
}
|
|
56
56
|
Re.displayName = "UniverIcon";
|
|
57
|
-
var
|
|
57
|
+
var jt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, xe = B(function(t, e) {
|
|
58
58
|
return Ce(Re, Object.assign({}, t, {
|
|
59
59
|
id: "search-single-16",
|
|
60
60
|
ref: e,
|
|
61
|
-
icon:
|
|
61
|
+
icon: jt
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
|
-
|
|
65
|
-
const
|
|
64
|
+
xe.displayName = "SearchSingle16";
|
|
65
|
+
const Me = "FIND_REPLACE_INPUT_FOCUS", ye = "FIND_REPLACE_DIALOG_FOCUS", Ie = "FIND_REPLACE_REPLACE_REVEALED";
|
|
66
66
|
var Lt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Fe = (t, e, n, i) => {
|
|
67
67
|
for (var s = i > 1 ? void 0 : i ? Ut(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 && Lt(e, n, s), s;
|
|
70
|
-
},
|
|
71
|
-
class
|
|
70
|
+
}, j = (t, e) => (n, i) => e(n, i, t);
|
|
71
|
+
class wi extends X {
|
|
72
72
|
}
|
|
73
|
-
const v =
|
|
73
|
+
const v = pt("find-replace.service");
|
|
74
74
|
function Bt(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
|
}
|
|
@@ -86,7 +86,7 @@ let K = class extends X {
|
|
|
86
86
|
c(this, "_matches", []);
|
|
87
87
|
c(this, "_currentSearchingDisposables", null);
|
|
88
88
|
this._state = e, this._providers = n, this._univerInstanceService = i, this._logService = s, this.disposeWithMe(
|
|
89
|
-
this._state.stateUpdates$.pipe(
|
|
89
|
+
this._state.stateUpdates$.pipe(xt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
|
|
90
90
|
const a = this._state.state;
|
|
91
91
|
Bt(r) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
|
|
92
92
|
})
|
|
@@ -139,7 +139,7 @@ let K = class extends X {
|
|
|
139
139
|
}
|
|
140
140
|
// When a document's content changes, we should reset all matches and try to move to the next match.
|
|
141
141
|
_subscribeToModelsChanges(e) {
|
|
142
|
-
const n = this._currentSearchingDisposables = new ot(), i = Se(e.map((s) => s.matchesUpdate$)).pipe(
|
|
142
|
+
const n = this._currentSearchingDisposables = new ot(), i = Se(e.map((s) => s.matchesUpdate$)).pipe(Mt(220)).subscribe(([...s]) => {
|
|
143
143
|
const r = this._matches = s.flat();
|
|
144
144
|
if (r.length) {
|
|
145
145
|
const a = this._moveToInitialMatch(this._findModels, r, !0);
|
|
@@ -202,8 +202,8 @@ let K = class extends X {
|
|
|
202
202
|
const r = e.find((u) => u.unitId === s);
|
|
203
203
|
if (r) {
|
|
204
204
|
this._matchingModel = r;
|
|
205
|
-
const u = r.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }),
|
|
206
|
-
return this.currentMatch$.next(u),
|
|
205
|
+
const u = r.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }), f = n.findIndex((p) => p === u);
|
|
206
|
+
return this.currentMatch$.next(u), f;
|
|
207
207
|
}
|
|
208
208
|
this._matchingModel = e[0];
|
|
209
209
|
const a = this._matchingModel.moveToNextMatch({ noFocus: i }), o = this._matches.findIndex((u) => u === a);
|
|
@@ -211,8 +211,8 @@ let K = class extends X {
|
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
K = Fe([
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
j(2, he),
|
|
215
|
+
j(3, ue)
|
|
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 ie() {
|
|
@@ -422,33 +422,33 @@ let Q = class extends X {
|
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
424
|
Q = Fe([
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
j(0, y(_e)),
|
|
426
|
+
j(1, U)
|
|
427
427
|
], Q);
|
|
428
428
|
const W = {
|
|
429
429
|
id: "ui.operation.open-find-dialog",
|
|
430
|
-
type:
|
|
430
|
+
type: M.OPERATION,
|
|
431
431
|
handler: (t) => {
|
|
432
432
|
const e = t.get(v);
|
|
433
433
|
return e.revealed ? e.focusFindInput() : e.start(), !0;
|
|
434
434
|
}
|
|
435
435
|
}, ne = {
|
|
436
436
|
id: "ui.operation.open-replace-dialog",
|
|
437
|
-
type:
|
|
437
|
+
type: M.OPERATION,
|
|
438
438
|
handler: (t) => {
|
|
439
439
|
const e = t.get(v);
|
|
440
440
|
return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
|
|
441
441
|
}
|
|
442
|
-
},
|
|
443
|
-
type:
|
|
442
|
+
}, De = {
|
|
443
|
+
type: M.OPERATION,
|
|
444
444
|
id: "ui.operation.go-to-next-match",
|
|
445
445
|
handler: (t) => (t.get(v).moveToNextMatch(), !0)
|
|
446
|
-
},
|
|
447
|
-
type:
|
|
446
|
+
}, Pe = {
|
|
447
|
+
type: M.OPERATION,
|
|
448
448
|
id: "ui.operation.go-to-previous-match",
|
|
449
449
|
handler: (t) => (t.get(v).moveToPreviousMatch(), !0)
|
|
450
450
|
};
|
|
451
|
-
var Oe = { exports: {} },
|
|
451
|
+
var Oe = { exports: {} }, k = {};
|
|
452
452
|
/**
|
|
453
453
|
* @license React
|
|
454
454
|
* react-jsx-runtime.production.min.js
|
|
@@ -458,7 +458,7 @@ var Oe = { exports: {} }, G = {};
|
|
|
458
458
|
* This source code is licensed under the MIT license found in the
|
|
459
459
|
* LICENSE file in the root directory of this source tree.
|
|
460
460
|
*/
|
|
461
|
-
var
|
|
461
|
+
var kt = Dt, Gt = Symbol.for("react.element"), Vt = Symbol.for("react.fragment"), Ht = Object.prototype.hasOwnProperty, qt = kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, zt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
462
462
|
function Te(t, e, n) {
|
|
463
463
|
var i, s = {}, r = null, a = null;
|
|
464
464
|
n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (a = e.ref);
|
|
@@ -467,22 +467,22 @@ function Te(t, e, n) {
|
|
|
467
467
|
if (t && t.defaultProps)
|
|
468
468
|
for (i in e = t.defaultProps, e)
|
|
469
469
|
s[i] === void 0 && (s[i] = e[i]);
|
|
470
|
-
return { $$typeof:
|
|
470
|
+
return { $$typeof: Gt, type: t, key: r, ref: a, props: s, _owner: qt.current };
|
|
471
471
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
Oe.exports =
|
|
472
|
+
k.Fragment = Vt;
|
|
473
|
+
k.jsx = Te;
|
|
474
|
+
k.jsxs = Te;
|
|
475
|
+
Oe.exports = k;
|
|
476
476
|
var l = Oe.exports;
|
|
477
477
|
const Ee = {
|
|
478
478
|
id: "ui.command.replace-current-match",
|
|
479
|
-
type:
|
|
479
|
+
type: M.COMMAND,
|
|
480
480
|
handler: (t) => t.get(v).replace()
|
|
481
481
|
}, Kt = "CONFIRM_REPLACE_ALL", $e = {
|
|
482
482
|
id: "ui.command.replace-all-matches",
|
|
483
|
-
type:
|
|
483
|
+
type: M.COMMAND,
|
|
484
484
|
handler: async (t) => {
|
|
485
|
-
const e = t.get(
|
|
485
|
+
const e = t.get(ft), n = t.get(D), i = t.get(ge);
|
|
486
486
|
if (!await e.confirm({
|
|
487
487
|
id: Kt,
|
|
488
488
|
title: { title: n.t("find-replace.replace.confirm.title") },
|
|
@@ -504,7 +504,7 @@ const Ee = {
|
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
function Ne(t) {
|
|
507
|
-
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: s, findString: r, findReplaceService: a, onChange: o, ...d } = t,
|
|
507
|
+
const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: s, findString: r, findReplaceService: a, onChange: o, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
|
|
508
508
|
return /* @__PURE__ */ l.jsx(
|
|
509
509
|
Ot,
|
|
510
510
|
{
|
|
@@ -514,16 +514,16 @@ function Ne(t) {
|
|
|
514
514
|
Tt,
|
|
515
515
|
{
|
|
516
516
|
loop: !0,
|
|
517
|
-
text:
|
|
517
|
+
text: f,
|
|
518
518
|
value: s,
|
|
519
519
|
total: i,
|
|
520
|
-
onChange: (
|
|
521
|
-
s === i &&
|
|
520
|
+
onChange: (p) => {
|
|
521
|
+
s === i && p === 1 ? a.moveToNextMatch() : s === 1 && p === i || p < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
524
|
),
|
|
525
525
|
value: r,
|
|
526
|
-
onChange: (
|
|
526
|
+
onChange: (p) => o == null ? void 0 : o(p),
|
|
527
527
|
...d
|
|
528
528
|
}
|
|
529
529
|
);
|
|
@@ -543,13 +543,13 @@ function Ae(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
|
|
546
|
+
return Pt(e, () => ({ focus: n, selectHasFocus: i })), w(() => {
|
|
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 ei = B(function(e, n) {
|
|
552
|
-
const i = S(
|
|
552
|
+
const i = S(D), s = S(v), r = S(ee), a = I(s.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
|
|
553
553
|
r.executeCommand(ne.id);
|
|
554
554
|
}, [r]), O = _((C) => s.changeFindString(C), [s]);
|
|
555
555
|
return Ae(s, n), /* @__PURE__ */ l.jsxs(E, { children: [
|
|
@@ -559,29 +559,29 @@ const ei = B(function(e, n) {
|
|
|
559
559
|
findCompleted: o,
|
|
560
560
|
className: "univer-find-input",
|
|
561
561
|
matchesCount: u,
|
|
562
|
-
matchesPosition:
|
|
562
|
+
matchesPosition: f,
|
|
563
563
|
findReplaceService: s,
|
|
564
564
|
localeService: i,
|
|
565
565
|
findString: d,
|
|
566
566
|
onChange: O
|
|
567
567
|
}
|
|
568
568
|
),
|
|
569
|
-
/* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(N, { type: "text", size: "small", onClick:
|
|
569
|
+
/* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(N, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
|
|
570
570
|
] });
|
|
571
571
|
}), ti = B(function(e, n) {
|
|
572
|
-
const i = S(v), s = S(
|
|
573
|
-
matchesCount:
|
|
574
|
-
matchesPosition:
|
|
572
|
+
const i = S(v), s = S(D), r = S(ee), a = S(ge), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
|
|
573
|
+
matchesCount: f,
|
|
574
|
+
matchesPosition: p,
|
|
575
575
|
findString: O,
|
|
576
576
|
inputtingFindString: C,
|
|
577
577
|
replaceString: Le,
|
|
578
578
|
caseSensitive: Ue,
|
|
579
579
|
matchesTheWholeCell: Be,
|
|
580
580
|
findDirection: We,
|
|
581
|
-
findScope:
|
|
582
|
-
findBy:
|
|
581
|
+
findScope: ke,
|
|
582
|
+
findBy: Ge,
|
|
583
583
|
findCompleted: V
|
|
584
|
-
} = u, Ve = C.length === 0, He =
|
|
584
|
+
} = u, Ve = C.length === 0, He = f === 0 || !(o != null && o.replaceable), qe = d.length === 0, ze = _(
|
|
585
585
|
(h) => i.changeInputtingFindString(h),
|
|
586
586
|
[i]
|
|
587
587
|
), Ke = _(
|
|
@@ -598,22 +598,22 @@ const ei = B(function(e, n) {
|
|
|
598
598
|
}, [i]), tt = _((h) => {
|
|
599
599
|
i.changeFindBy(h);
|
|
600
600
|
}, [i]), it = ni(s), nt = si(s), st = ri(s);
|
|
601
|
-
return
|
|
602
|
-
const h = V &&
|
|
601
|
+
return w(() => {
|
|
602
|
+
const h = V && f === 0;
|
|
603
603
|
let T = null;
|
|
604
604
|
return h && (T = a.show({
|
|
605
605
|
content: s.t("find-replace.dialog.no-match"),
|
|
606
606
|
type: $.Warning,
|
|
607
607
|
delay: 5e3
|
|
608
608
|
})), () => T == null ? void 0 : T.dispose();
|
|
609
|
-
}, [V,
|
|
609
|
+
}, [V, f, a, s]), /* @__PURE__ */ l.jsxs(E, { children: [
|
|
610
610
|
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
|
|
611
611
|
Ne,
|
|
612
612
|
{
|
|
613
613
|
findCompleted: V,
|
|
614
614
|
className: "univer-find-input",
|
|
615
|
-
matchesCount:
|
|
616
|
-
matchesPosition:
|
|
615
|
+
matchesCount: f,
|
|
616
|
+
matchesPosition: p,
|
|
617
617
|
findReplaceService: i,
|
|
618
618
|
localeService: s,
|
|
619
619
|
findString: C,
|
|
@@ -630,8 +630,8 @@ const ei = B(function(e, n) {
|
|
|
630
630
|
) }),
|
|
631
631
|
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(H, { value: We, options: nt, onChange: Xe }) }),
|
|
632
632
|
/* @__PURE__ */ l.jsx(oe, { children: /* @__PURE__ */ l.jsxs(E, { children: [
|
|
633
|
-
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(H, { value:
|
|
634
|
-
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(H, { value:
|
|
633
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(H, { value: ke, options: it, onChange: et }) }),
|
|
634
|
+
/* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(H, { value: Ge, options: st, onChange: tt }) })
|
|
635
635
|
] }) }),
|
|
636
636
|
/* @__PURE__ */ l.jsx(oe, { children: /* @__PURE__ */ l.jsxs(E, { children: [
|
|
637
637
|
/* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
|
|
@@ -666,7 +666,7 @@ const ei = B(function(e, n) {
|
|
|
666
666
|
});
|
|
667
667
|
function ii() {
|
|
668
668
|
const t = S(v), e = S(me), n = S(U), i = I(t.state$, void 0, !0), s = z(null);
|
|
669
|
-
|
|
669
|
+
w(() => {
|
|
670
670
|
let d;
|
|
671
671
|
return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
|
|
672
672
|
}, [e]);
|
|
@@ -674,14 +674,14 @@ function ii() {
|
|
|
674
674
|
(d) => n.setContextValue(ye, d),
|
|
675
675
|
[n]
|
|
676
676
|
), o = _(
|
|
677
|
-
(d) => n.setContextValue(
|
|
677
|
+
(d) => n.setContextValue(Me, d),
|
|
678
678
|
[n]
|
|
679
679
|
);
|
|
680
|
-
return
|
|
680
|
+
return w(() => {
|
|
681
681
|
var u;
|
|
682
|
-
const d = yt(document, "focusin").subscribe((
|
|
683
|
-
var
|
|
684
|
-
|
|
682
|
+
const d = yt(document, "focusin").subscribe((f) => {
|
|
683
|
+
var p;
|
|
684
|
+
f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? o(!0) : o(!1);
|
|
685
685
|
});
|
|
686
686
|
return (u = r.current) == null || u.focus(), a(!0), o(!0), () => {
|
|
687
687
|
d.unsubscribe(), a(!1);
|
|
@@ -709,64 +709,64 @@ function ri(t) {
|
|
|
709
709
|
{ label: t.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
|
|
710
710
|
], [e]);
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function P(t) {
|
|
713
713
|
return t.getContextValue(ye);
|
|
714
714
|
}
|
|
715
715
|
function ai(t) {
|
|
716
716
|
return t.getContextValue(Ie);
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
return t.getContextValue(
|
|
718
|
+
function we(t) {
|
|
719
|
+
return t.getContextValue(Me);
|
|
720
720
|
}
|
|
721
|
-
const
|
|
721
|
+
const G = "7_find-replace-shortcuts";
|
|
722
722
|
function se(t) {
|
|
723
|
-
return t.getContextValue(
|
|
723
|
+
return t.getContextValue(pe);
|
|
724
724
|
}
|
|
725
725
|
function re(t) {
|
|
726
|
-
return !t.getContextValue(
|
|
726
|
+
return !t.getContextValue(fe);
|
|
727
727
|
}
|
|
728
728
|
const oi = {
|
|
729
729
|
id: W.id,
|
|
730
730
|
description: "find-replace.shortcut.open-find-dialog",
|
|
731
|
-
binding:
|
|
732
|
-
group:
|
|
731
|
+
binding: b.F | x.CTRL_COMMAND,
|
|
732
|
+
group: G,
|
|
733
733
|
preconditions(t) {
|
|
734
|
-
return !
|
|
734
|
+
return !P(t) && se(t) && re(t);
|
|
735
735
|
}
|
|
736
736
|
}, ci = {
|
|
737
737
|
id: W.id,
|
|
738
738
|
description: "find-replace.shortcut.open-find-dialog",
|
|
739
|
-
binding:
|
|
740
|
-
mac:
|
|
739
|
+
binding: b.F | x.CTRL_COMMAND,
|
|
740
|
+
mac: b.F | x.MAC_CTRL,
|
|
741
741
|
preconditions(t) {
|
|
742
|
-
return !
|
|
742
|
+
return !P(t) && se(t) && re(t);
|
|
743
743
|
}
|
|
744
744
|
}, li = {
|
|
745
745
|
id: ne.id,
|
|
746
746
|
description: "find-replace.shortcut.open-replace-dialog",
|
|
747
|
-
binding:
|
|
748
|
-
mac:
|
|
749
|
-
group:
|
|
747
|
+
binding: b.H | x.CTRL_COMMAND,
|
|
748
|
+
mac: b.H | x.MAC_CTRL,
|
|
749
|
+
group: G,
|
|
750
750
|
preconditions(t) {
|
|
751
|
-
return se(t) && re(t) && (!
|
|
751
|
+
return se(t) && re(t) && (!P(t) || !ai(t));
|
|
752
752
|
}
|
|
753
753
|
}, di = {
|
|
754
|
-
id:
|
|
754
|
+
id: De.id,
|
|
755
755
|
description: "find-replace.shortcut.go-to-next-match",
|
|
756
|
-
binding:
|
|
757
|
-
group:
|
|
756
|
+
binding: b.ENTER,
|
|
757
|
+
group: G,
|
|
758
758
|
priority: 1e3,
|
|
759
759
|
preconditions(t) {
|
|
760
|
-
return
|
|
760
|
+
return we(t) && P(t);
|
|
761
761
|
}
|
|
762
762
|
}, hi = {
|
|
763
|
-
id:
|
|
763
|
+
id: Pe.id,
|
|
764
764
|
description: "find-replace.shortcut.go-to-previous-match",
|
|
765
|
-
binding:
|
|
766
|
-
group:
|
|
765
|
+
binding: b.ENTER | x.SHIFT,
|
|
766
|
+
group: G,
|
|
767
767
|
priority: 1e3,
|
|
768
768
|
preconditions(t) {
|
|
769
|
-
return
|
|
769
|
+
return we(t) && P(t);
|
|
770
770
|
}
|
|
771
771
|
};
|
|
772
772
|
function ui(t) {
|
|
@@ -780,27 +780,27 @@ function ui(t) {
|
|
|
780
780
|
positions: [mt.TOOLBAR_START],
|
|
781
781
|
hidden$: vt(t, ct.SHEET),
|
|
782
782
|
disabled$: Se([
|
|
783
|
-
e.subscribeContextValue$(
|
|
784
|
-
e.subscribeContextValue$(
|
|
783
|
+
e.subscribeContextValue$(fe),
|
|
784
|
+
e.subscribeContextValue$(pe)
|
|
785
785
|
]).pipe(It(([n, i]) => n || !i))
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
|
-
var
|
|
789
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
788
|
+
var pi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, _i = (t, e, n, i) => {
|
|
789
|
+
for (var s = i > 1 ? void 0 : i ? fi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
790
790
|
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
791
|
-
return i && s &&
|
|
791
|
+
return i && s && pi(e, n, s), s;
|
|
792
792
|
}, g = (t, e) => (n, i) => e(n, i, t);
|
|
793
|
-
const le = "DESKTOP_FIND_REPLACE_DIALOG",
|
|
793
|
+
const le = "DESKTOP_FIND_REPLACE_DIALOG", je = 350, gi = 20, mi = -90;
|
|
794
794
|
let A = class extends lt {
|
|
795
|
-
constructor(t, e, n, i, s, r, a, o, d, u,
|
|
796
|
-
super(), this._univerInstanceService = t, this._menuService = e, this._shortcutService = n, this._commandService = i, this._findReplaceService = s, this._logService = r, this._dialogService = a, this._contextService = o, this._layoutService = d, this._localeService = u, this._componentManager =
|
|
795
|
+
constructor(t, e, n, i, s, r, a, o, d, u, f, p) {
|
|
796
|
+
super(), this._univerInstanceService = t, this._menuService = e, this._shortcutService = n, this._commandService = i, this._findReplaceService = s, this._logService = r, this._dialogService = a, this._contextService = o, this._layoutService = d, this._localeService = u, this._componentManager = f, this._injector = p, this._initCommands(), this._initUI(), this._initShortcuts();
|
|
797
797
|
}
|
|
798
798
|
_initCommands() {
|
|
799
799
|
[
|
|
800
800
|
W,
|
|
801
801
|
ne,
|
|
802
|
-
Pe,
|
|
803
802
|
De,
|
|
803
|
+
Pe,
|
|
804
804
|
$e,
|
|
805
805
|
Ee
|
|
806
806
|
].forEach((t) => {
|
|
@@ -817,7 +817,7 @@ let A = class extends lt {
|
|
|
817
817
|
].forEach((t) => this.disposeWithMe(this._shortcutService.registerShortcut(t)));
|
|
818
818
|
}
|
|
819
819
|
_initUI() {
|
|
820
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(ui))), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ii)), this.disposeWithMe(this._componentManager.register("SearchIcon",
|
|
820
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(ui))), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ii)), this.disposeWithMe(this._componentManager.register("SearchIcon", xe)), this._findReplaceService.stateUpdates$.pipe(ae(this.dispose$)).subscribe((t) => {
|
|
821
821
|
t.revealed === !0 && this._openPanel();
|
|
822
822
|
}), this.disposeWithMe(
|
|
823
823
|
this._univerInstanceService.focused$.pipe(ae(this.dispose$)).subscribe((t) => {
|
|
@@ -829,7 +829,7 @@ let A = class extends lt {
|
|
|
829
829
|
this._dialogService.open({
|
|
830
830
|
id: le,
|
|
831
831
|
draggable: !0,
|
|
832
|
-
width:
|
|
832
|
+
width: je,
|
|
833
833
|
title: { title: this._localeService.t("find-replace.dialog.title") },
|
|
834
834
|
children: { label: "FindReplaceDialog" },
|
|
835
835
|
destroyOnClose: !0,
|
|
@@ -850,18 +850,65 @@ A = _i([
|
|
|
850
850
|
g(3, ee),
|
|
851
851
|
g(4, v),
|
|
852
852
|
g(5, ue),
|
|
853
|
-
g(6,
|
|
853
|
+
g(6, bt),
|
|
854
854
|
g(7, U),
|
|
855
855
|
g(8, me),
|
|
856
|
-
g(9, y(
|
|
856
|
+
g(9, y(D)),
|
|
857
857
|
g(10, y(St)),
|
|
858
858
|
g(11, y(_e))
|
|
859
859
|
], A);
|
|
860
860
|
function vi() {
|
|
861
861
|
const { innerWidth: t } = window;
|
|
862
|
-
return { x: (t -
|
|
862
|
+
return { x: (t - je) / 2 - gi, y: mi };
|
|
863
863
|
}
|
|
864
864
|
const Si = {
|
|
865
|
+
"find-replace": {
|
|
866
|
+
toolbar: "Find & Replace",
|
|
867
|
+
shortcut: {
|
|
868
|
+
"open-find-dialog": "Open Find Dialog",
|
|
869
|
+
"open-replace-dialog": "Open Replace Dialog",
|
|
870
|
+
"close-dialog": "Close Find & Replace Dialog",
|
|
871
|
+
"go-to-next-match": "Go to Next Match",
|
|
872
|
+
"go-to-previous-match": "Go to Previous Match"
|
|
873
|
+
},
|
|
874
|
+
dialog: {
|
|
875
|
+
title: "Find",
|
|
876
|
+
find: "Find",
|
|
877
|
+
replace: "Replace",
|
|
878
|
+
"replace-all": "Replace All",
|
|
879
|
+
"case-sensitive": "Case Sensitive",
|
|
880
|
+
"find-placeholder": "Find in this Sheet",
|
|
881
|
+
"advanced-finding": "Advanced Searching & Replace",
|
|
882
|
+
"replace-placeholder": "Input Replace String",
|
|
883
|
+
"match-the-whole-cell": "Match the Whole Cell",
|
|
884
|
+
"find-direction": {
|
|
885
|
+
title: "Find Direction",
|
|
886
|
+
row: "Search by Row",
|
|
887
|
+
column: "Search by Column"
|
|
888
|
+
},
|
|
889
|
+
"find-scope": {
|
|
890
|
+
title: "Find Range",
|
|
891
|
+
"current-sheet": "Current Sheet",
|
|
892
|
+
workbook: "Workbook"
|
|
893
|
+
},
|
|
894
|
+
"find-by": {
|
|
895
|
+
title: "Find By",
|
|
896
|
+
value: "Find by Value",
|
|
897
|
+
formula: "Find Formula"
|
|
898
|
+
},
|
|
899
|
+
"no-match": "Finding completed but no match found.",
|
|
900
|
+
"no-result": "No Result"
|
|
901
|
+
},
|
|
902
|
+
replace: {
|
|
903
|
+
"all-success": "Replaced all {0} matches",
|
|
904
|
+
"all-failure": "Replace failed",
|
|
905
|
+
confirm: {
|
|
906
|
+
title: "Are you sure to replace all matches?"
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
"find-replace-shortcuts": "Find & Replace"
|
|
911
|
+
}, ji = Si, Ci = {
|
|
865
912
|
"find-replace": {
|
|
866
913
|
toolbar: "查找替换",
|
|
867
914
|
shortcut: {
|
|
@@ -908,17 +955,17 @@ const Si = {
|
|
|
908
955
|
}
|
|
909
956
|
},
|
|
910
957
|
"find-replace-shortcuts": "查找替换"
|
|
911
|
-
};
|
|
912
|
-
var
|
|
913
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
958
|
+
}, Ri = Ci;
|
|
959
|
+
var bi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, Mi = (t, e, n, i) => {
|
|
960
|
+
for (var s = i > 1 ? void 0 : i ? xi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
|
|
914
961
|
(a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
|
|
915
|
-
return i && s &&
|
|
916
|
-
},
|
|
917
|
-
const
|
|
962
|
+
return i && s && bi(e, n, s), s;
|
|
963
|
+
}, yi = (t, e) => (n, i) => e(n, i, t);
|
|
964
|
+
const Ii = "FIND_REPLACE";
|
|
918
965
|
let de = class extends ut {
|
|
919
966
|
constructor(t, e) {
|
|
920
|
-
super(
|
|
921
|
-
zhCN:
|
|
967
|
+
super(Ii), this._injector = t, this._localeService = e, this._localeService.load({
|
|
968
|
+
zhCN: Ri
|
|
922
969
|
});
|
|
923
970
|
}
|
|
924
971
|
onStarting(t) {
|
|
@@ -929,15 +976,17 @@ let de = class extends ut {
|
|
|
929
976
|
);
|
|
930
977
|
}
|
|
931
978
|
};
|
|
932
|
-
de =
|
|
933
|
-
|
|
979
|
+
de = Mi([
|
|
980
|
+
yi(1, y(D))
|
|
934
981
|
], de);
|
|
935
982
|
export {
|
|
936
983
|
Z as FindBy,
|
|
937
984
|
Y as FindDirection,
|
|
938
|
-
|
|
985
|
+
wi as FindModel,
|
|
939
986
|
A as FindReplaceController,
|
|
940
987
|
J as FindScope,
|
|
941
988
|
v as IFindReplaceService,
|
|
942
|
-
de as UniverFindReplacePlugin
|
|
989
|
+
de as UniverFindReplacePlugin,
|
|
990
|
+
ji as enUS,
|
|
991
|
+
Ri as zhCN
|
|
943
992
|
};
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { ICommand } from '@univerjs/core';
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
17
3
|
export declare const ReplaceCurrentMatchCommand: ICommand;
|
|
18
4
|
export declare const ReplaceAllMatchesCommand: ICommand;
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import type { IOperation } from '@univerjs/core';
|
|
1
|
+
import { IOperation } from '@univerjs/core';
|
|
2
|
+
|
|
17
3
|
export declare const OpenFindDialogOperation: IOperation;
|
|
18
4
|
export declare const OpenReplaceDialogOperation: IOperation;
|
|
19
5
|
export declare const GoToNextMatchOperation: IOperation;
|