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