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