@univerjs/sheets-find-replace 0.1.13 → 0.1.15
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 +1 -1
- package/lib/es/index.js +327 -336
- package/lib/types/controllers/sheet-find-replace.controller.d.ts +2 -4
- package/lib/types/plugin.d.ts +2 -3
- package/lib/umd/index.js +1 -1
- package/package.json +35 -24
package/lib/es/index.js
CHANGED
|
@@ -1,118 +1,117 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { FindReplaceController as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { SheetSkeletonManagerService as
|
|
10
|
-
import { filter as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
super(i, n);
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var fe = (h, e, t) => e in h ? _e(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var g = (h, e, t) => (fe(h, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { CommandType as B, IUndoRedoService as me, ICommandService as H, Rectangle as Se, OnLifecycle as pe, LifecycleStages as ve, ThemeService as Ie, Disposable as K, EDITOR_ACTIVATED as Ce, IContextService as z, IUniverInstanceService as J, UniverInstanceType as Z, fromCallback as U, ColorKit as Re, rotate as $, groupBy as we, ObjectMatrix as be, Tools as Me, replaceInDocumentBody as ke, DependentOn as xe, Plugin as ye } from "@univerjs/core";
|
|
5
|
+
import { Inject as C, Injector as O } from "@wendellhu/redi";
|
|
6
|
+
import { FindReplaceController as Ue, IFindReplaceService as Pe, FindModel as Be, FindBy as M, FindScope as I, FindDirection as b, UniverFindReplacePlugin as We } from "@univerjs/find-replace";
|
|
7
|
+
import { SetRangeValuesCommand as q, SelectionManagerService as Fe, SetWorksheetActiveOperation as He, SetSelectionsOperation as Oe, SetWorksheetActivateCommand as Te, UniverSheetsPlugin as L } from "@univerjs/sheets";
|
|
8
|
+
import { Shape as Ee, Rect as Ae, IRenderManagerService as ee, RENDER_RAW_FORMULA_KEY as Ne } from "@univerjs/engine-render";
|
|
9
|
+
import { SheetSkeletonManagerService as De, getCoordByCell as j, getSheetObject as $e, ScrollToCellCommand as Le } from "@univerjs/sheets-ui";
|
|
10
|
+
import { filter as k, Subject as V, throttleTime as je, merge as Ve, skip as Qe, debounceTime as Xe } from "rxjs";
|
|
11
|
+
class Ye extends Ee {
|
|
12
|
+
constructor(t, i) {
|
|
13
|
+
super(t, i);
|
|
15
14
|
g(this, "_activated", !1);
|
|
16
15
|
g(this, "_inHiddenRange", !1);
|
|
17
16
|
g(this, "_color");
|
|
18
|
-
|
|
17
|
+
i && this.setShapeProps(i);
|
|
19
18
|
}
|
|
20
|
-
setShapeProps(
|
|
21
|
-
this._activated = !!
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
19
|
+
setShapeProps(t) {
|
|
20
|
+
this._activated = !!t.activated, typeof t.inHiddenRange < "u" && (this._inHiddenRange = t.inHiddenRange), typeof t.color < "u" && (this._color = t.color), this.transformByState({
|
|
21
|
+
width: t.width,
|
|
22
|
+
height: t.height
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
|
-
_draw(
|
|
27
|
-
const
|
|
28
|
-
|
|
25
|
+
_draw(t) {
|
|
26
|
+
const i = this._activated, n = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, 0.35)`, r = `rgb(${this._color.r}, ${this._color.g}, ${this._color.b})`;
|
|
27
|
+
Ae.drawWith(t, {
|
|
29
28
|
width: this.width,
|
|
30
29
|
height: this.height,
|
|
31
|
-
fill:
|
|
32
|
-
stroke:
|
|
33
|
-
strokeWidth:
|
|
30
|
+
fill: n,
|
|
31
|
+
stroke: i ? r : void 0,
|
|
32
|
+
strokeWidth: i ? 2 : 0,
|
|
34
33
|
evented: !1
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
const
|
|
37
|
+
const te = {
|
|
39
38
|
id: "sheet.command.replace",
|
|
40
|
-
type:
|
|
41
|
-
handler: async (
|
|
42
|
-
const
|
|
43
|
-
unitId:
|
|
39
|
+
type: B.COMMAND,
|
|
40
|
+
handler: async (h, e) => {
|
|
41
|
+
const t = h.get(me), i = h.get(H), { unitId: n, replacements: r } = e, s = t.__tempBatchingUndoRedo(n), o = await Promise.all(r.map((c) => i.executeCommand(q.id, {
|
|
42
|
+
unitId: n,
|
|
44
43
|
subUnitId: c.subUnitId,
|
|
45
44
|
value: c.value
|
|
46
45
|
})));
|
|
47
|
-
return
|
|
46
|
+
return s.dispose(), Ge(o, r);
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
|
-
function
|
|
51
|
-
let
|
|
52
|
-
return
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
}), { success:
|
|
49
|
+
function Ge(h, e) {
|
|
50
|
+
let t = 0, i = 0;
|
|
51
|
+
return h.forEach((n, r) => {
|
|
52
|
+
const s = e[r].count;
|
|
53
|
+
n ? t += s : i += s;
|
|
54
|
+
}), { success: t, failure: i };
|
|
56
55
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
56
|
+
function Q(h, e) {
|
|
57
|
+
return h.startRow === e.startRow && h.startColumn === e.startColumn;
|
|
59
58
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
59
|
+
function X(h, e) {
|
|
60
|
+
return h.startRow < e.startRow || h.startRow === e.startRow && h.startColumn <= e.startColumn;
|
|
62
61
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
62
|
+
function Y(h, e) {
|
|
63
|
+
return h.startColumn < e.startColumn || h.startColumn === e.startColumn && h.startRow <= e.startRow;
|
|
65
64
|
}
|
|
66
|
-
function Ke(
|
|
67
|
-
return
|
|
65
|
+
function Ke(h, e) {
|
|
66
|
+
return h.startRow > e.startRow || h.startRow === e.startRow && h.startColumn >= e.startColumn;
|
|
68
67
|
}
|
|
69
|
-
function ze(
|
|
70
|
-
return
|
|
68
|
+
function ze(h, e) {
|
|
69
|
+
return h.startColumn > e.startColumn || h.startColumn === e.startColumn && h.startRow >= e.startRow;
|
|
71
70
|
}
|
|
72
|
-
function Je(
|
|
73
|
-
const { range:
|
|
74
|
-
return
|
|
71
|
+
function Je(h, e) {
|
|
72
|
+
const { range: t } = h, { startRow: i, startColumn: n } = t, r = e.getMergedCell(i, n);
|
|
73
|
+
return r ? Se.equals(t, r) : t.endRow === t.startRow && t.endColumn === t.startColumn;
|
|
75
74
|
}
|
|
76
|
-
var
|
|
77
|
-
for (var
|
|
78
|
-
(
|
|
79
|
-
return
|
|
80
|
-
}, f = (
|
|
81
|
-
let
|
|
82
|
-
constructor(e, i, n,
|
|
75
|
+
var Ze = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, T = (h, e, t, i) => {
|
|
76
|
+
for (var n = i > 1 ? void 0 : i ? qe(e, t) : e, r = h.length - 1, s; r >= 0; r--)
|
|
77
|
+
(s = h[r]) && (n = (i ? s(e, t, n) : s(n)) || n);
|
|
78
|
+
return i && n && Ze(e, t, n), n;
|
|
79
|
+
}, f = (h, e) => (t, i) => e(t, i, h);
|
|
80
|
+
let x = class extends K {
|
|
81
|
+
constructor(e, t, i, n, r) {
|
|
83
82
|
super();
|
|
84
83
|
g(this, "_provider");
|
|
85
|
-
this._injector = e, this._findReplaceController =
|
|
84
|
+
this._injector = e, this._findReplaceController = t, this._contextService = i, this._findReplaceService = n, this._commandService = r, this._init(), this._initCommands();
|
|
86
85
|
}
|
|
87
86
|
dispose() {
|
|
88
|
-
super.dispose(), this._provider.dispose();
|
|
87
|
+
super.dispose(), this._findReplaceController.closePanel(), this._provider.dispose();
|
|
89
88
|
}
|
|
90
89
|
_init() {
|
|
91
|
-
const e = this._injector.createInstance(
|
|
90
|
+
const e = this._injector.createInstance(F);
|
|
92
91
|
this._provider = e, this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(e)), this.disposeWithMe(
|
|
93
|
-
this._contextService.subscribeContextValue$(Ce).pipe(
|
|
92
|
+
this._contextService.subscribeContextValue$(Ce).pipe(k((t) => !!t)).subscribe(() => this._findReplaceController.closePanel())
|
|
94
93
|
);
|
|
95
94
|
}
|
|
96
95
|
_initCommands() {
|
|
97
|
-
[
|
|
96
|
+
[te].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
|
|
98
97
|
}
|
|
99
98
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
f(0,
|
|
103
|
-
f(1,
|
|
104
|
-
f(2,
|
|
99
|
+
x = T([
|
|
100
|
+
pe(ve.Steady, x),
|
|
101
|
+
f(0, C(O)),
|
|
102
|
+
f(1, C(Ue)),
|
|
103
|
+
f(2, z),
|
|
105
104
|
f(3, Pe),
|
|
106
|
-
f(4,
|
|
107
|
-
],
|
|
105
|
+
f(4, H)
|
|
106
|
+
], x);
|
|
108
107
|
const et = "sheets-find-replace-provider", tt = 1e4;
|
|
109
|
-
let
|
|
110
|
-
constructor(e, i, n, s, o,
|
|
108
|
+
let W = class extends Be {
|
|
109
|
+
constructor(e, t, i, n, r, s, o, c) {
|
|
111
110
|
super();
|
|
112
111
|
// We can directly inject the `FindReplaceService` here, and call its methods instead of using the observables.
|
|
113
|
-
g(this, "_matchesUpdate$", new
|
|
112
|
+
g(this, "_matchesUpdate$", new V());
|
|
114
113
|
g(this, "matchesUpdate$", this._matchesUpdate$.asObservable());
|
|
115
|
-
g(this, "_activelyChangingMatch$", new
|
|
114
|
+
g(this, "_activelyChangingMatch$", new V());
|
|
116
115
|
g(this, "activelyChangingMatch$", this._activelyChangingMatch$.asObservable());
|
|
117
116
|
/** Hold matches by the worksheet they are in. Make it easier to track the next (or previous) match when searching in the whole workbook. */
|
|
118
117
|
g(this, "_matchesByWorksheet", /* @__PURE__ */ new Map());
|
|
@@ -125,7 +124,7 @@ let F = class extends We {
|
|
|
125
124
|
g(this, "_currentHighlightShape", null);
|
|
126
125
|
/** This properties holds the query params during this searching session. */
|
|
127
126
|
g(this, "_query", null);
|
|
128
|
-
this._workbook = e, this._univerInstanceService = i, this._renderManagerService = n, this._commandService =
|
|
127
|
+
this._workbook = e, this._sheetSkeletonManagerService = t, this._univerInstanceService = i, this._renderManagerService = n, this._commandService = r, this._contextService = s, this._themeService = o, this._selectionManagerService = c;
|
|
129
128
|
}
|
|
130
129
|
get _matchesCount() {
|
|
131
130
|
return this._matches.length;
|
|
@@ -149,7 +148,7 @@ let F = class extends We {
|
|
|
149
148
|
return this._matches;
|
|
150
149
|
}
|
|
151
150
|
start(e) {
|
|
152
|
-
switch (this._query = e, e.findBy ===
|
|
151
|
+
switch (this._query = e, e.findBy === M.FORMULA ? this._toggleDisplayRawFormula(!0) : this._toggleDisplayRawFormula(!1), e.findScope) {
|
|
153
152
|
case I.UNIT:
|
|
154
153
|
this.findInWorkbook(e);
|
|
155
154
|
break;
|
|
@@ -160,7 +159,7 @@ let F = class extends We {
|
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
_toggleDisplayRawFormula(e) {
|
|
163
|
-
this._contextService.setContextValue(
|
|
162
|
+
this._contextService.setContextValue(Ne, e);
|
|
164
163
|
}
|
|
165
164
|
/**
|
|
166
165
|
* Find all matches in the current workbook no matter which worksheet is activated.
|
|
@@ -168,41 +167,41 @@ let F = class extends We {
|
|
|
168
167
|
* @returns the query complete event
|
|
169
168
|
*/
|
|
170
169
|
findInWorkbook(e) {
|
|
171
|
-
const
|
|
172
|
-
let
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const c = this._findInWorksheet(
|
|
176
|
-
return
|
|
170
|
+
const t = this._workbook.getUnitId();
|
|
171
|
+
let i, n = !0;
|
|
172
|
+
const r = () => {
|
|
173
|
+
const s = this._workbook.getSheets().filter((o) => !o.isSheetHidden()).map((o) => {
|
|
174
|
+
const c = this._findInWorksheet(o, e, t), l = o.getSheetId(), { results: a } = c;
|
|
175
|
+
return a.length ? this._matchesByWorksheet.set(l, c.results) : this._matchesByWorksheet.delete(l), c;
|
|
177
176
|
});
|
|
178
|
-
this._matches =
|
|
177
|
+
this._matches = s.map((o) => o.results).flat(), this._updateFindHighlight(), n ? (i = { results: this._matches }, n = !1) : this._matchesUpdate$.next(this._matches);
|
|
179
178
|
};
|
|
180
179
|
return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => {
|
|
181
180
|
this._updateFindHighlight(), this._updateCurrentHighlightShape(this._activeHighlightIndex);
|
|
182
181
|
})), this.disposeWithMe(
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
U(this._commandService.onCommandExecuted).pipe(
|
|
183
|
+
k(([s, o]) => s.id === He.id && !(o != null && o.fromFindReplace))
|
|
185
184
|
).subscribe(() => {
|
|
186
|
-
const
|
|
187
|
-
this._matchesByWorksheet.has(
|
|
185
|
+
const s = this._workbook.getActiveSheet(), o = s.getSheetId();
|
|
186
|
+
this._matchesByWorksheet.has(o) && this._findNextMatchOnActiveSheetChange(s);
|
|
188
187
|
})
|
|
189
188
|
), this.disposeWithMe(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
([
|
|
189
|
+
U(this._commandService.onCommandExecuted).pipe(
|
|
190
|
+
k(
|
|
191
|
+
([s]) => s.type === B.MUTATION && s.params.unitId === this._workbook.getUnitId()
|
|
193
192
|
),
|
|
194
|
-
|
|
195
|
-
).subscribe(() =>
|
|
196
|
-
),
|
|
193
|
+
je(600, void 0, { leading: !1, trailing: !0 })
|
|
194
|
+
).subscribe(() => r())
|
|
195
|
+
), r(), i;
|
|
197
196
|
}
|
|
198
197
|
/**
|
|
199
198
|
* This method is used in `findInWorkbook`. When the active sheet changes, this method helps to find the next match
|
|
200
199
|
* in the new worksheet.
|
|
201
200
|
*/
|
|
202
201
|
_findNextMatchOnActiveSheetChange(e) {
|
|
203
|
-
let i, n
|
|
204
|
-
const
|
|
205
|
-
|
|
202
|
+
let t, i, n = 0;
|
|
203
|
+
const r = this._matchesByWorksheet.get(e.getSheetId()), s = this._selectionManagerService.getSelections();
|
|
204
|
+
s != null && s.length ? ([t, n] = this._findNextMatchByRange(r, s[0].range), i = r.findIndex((o) => o === t)) : (t = r[0], i = 0, n = this._matches.findIndex((o) => o === t)), this._matchesPosition = n + 1, this._activelyChangingMatch$.next(t), this._activeHighlightIndex = i, this._updateFindHighlight(), this._updateCurrentHighlightShape(i);
|
|
206
205
|
}
|
|
207
206
|
/**
|
|
208
207
|
* Find all matches (only) in the currently activated worksheet.
|
|
@@ -210,331 +209,321 @@ let F = class extends We {
|
|
|
210
209
|
* @returns the query complete event
|
|
211
210
|
*/
|
|
212
211
|
findInActiveWorksheet(e) {
|
|
213
|
-
const
|
|
212
|
+
const t = this._workbook.getUnitId(), i = () => {
|
|
214
213
|
var d;
|
|
215
|
-
const c = this._workbook.getActiveSheet(),
|
|
216
|
-
return (d =
|
|
214
|
+
const c = this._workbook.getActiveSheet(), l = this._selectionManagerService.getSelections();
|
|
215
|
+
return (d = l == null ? void 0 : l.some((_) => !Je(_, c))) != null ? d : !1;
|
|
217
216
|
};
|
|
218
|
-
let
|
|
219
|
-
const
|
|
220
|
-
const c = this._workbook.getActiveSheet(),
|
|
221
|
-
|
|
222
|
-
const
|
|
223
|
-
return this._matches = d.results, this._matchesPosition = this._tryRestoreLastMatchesPosition(
|
|
217
|
+
let n, r = !0, s = !1;
|
|
218
|
+
const o = () => {
|
|
219
|
+
const c = this._workbook.getActiveSheet(), l = this.currentMatch;
|
|
220
|
+
s = i();
|
|
221
|
+
const a = this._selectionManagerService.getSelections(), d = s ? this._findInSelections(c, a, e, t) : this._findInWorksheet(c, e, t);
|
|
222
|
+
return this._matches = d.results, this._matchesPosition = this._tryRestoreLastMatchesPosition(l, this._matches), r ? (n = d, r = !1) : this._matchesUpdate$.next(this._matches), this._updateFindHighlight(), d;
|
|
224
223
|
};
|
|
225
224
|
return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => this._updateFindHighlight())), this.disposeWithMe(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (c.type ===
|
|
225
|
+
Ve(
|
|
226
|
+
U(this._commandService.onCommandExecuted).pipe(
|
|
227
|
+
k(([c]) => {
|
|
228
|
+
if (c.type === B.MUTATION && c.params.unitId === this._workbook.getUnitId())
|
|
230
229
|
return !0;
|
|
231
|
-
if (c.id ===
|
|
232
|
-
const
|
|
233
|
-
return
|
|
230
|
+
if (c.id === Oe.id && c.params.unitId === t) {
|
|
231
|
+
const l = i();
|
|
232
|
+
return l === !1 && s === !1 ? !1 : (s = l, !0);
|
|
234
233
|
}
|
|
235
234
|
return !1;
|
|
236
235
|
})
|
|
237
236
|
),
|
|
238
237
|
// activeSheet$ is a BehaviorSubject, so we need to skip the first
|
|
239
238
|
this._workbook.activeSheet$.pipe(Qe(1))
|
|
240
|
-
).pipe(Xe(200)).subscribe(() =>
|
|
241
|
-
),
|
|
242
|
-
}
|
|
243
|
-
_findInRange(e, i, n,
|
|
244
|
-
const
|
|
245
|
-
for (const
|
|
246
|
-
const { row:
|
|
247
|
-
if (
|
|
239
|
+
).pipe(Xe(200)).subscribe(() => o())
|
|
240
|
+
), o(), n;
|
|
241
|
+
}
|
|
242
|
+
_findInRange(e, t, i, n, r) {
|
|
243
|
+
const s = [], o = e.getSheetId(), c = (t.findDirection === b.COLUMN ? e.iterateByColumn : e.iterateByRow).bind(e)(i);
|
|
244
|
+
for (const l of c) {
|
|
245
|
+
const { row: a, col: d, colSpan: _, rowSpan: S, value: m } = l;
|
|
246
|
+
if (r != null && r(a, d) || !m || e.getRowFiltered(a))
|
|
248
247
|
continue;
|
|
249
|
-
const { hit:
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
248
|
+
const { hit: p, replaceable: R, isFormula: v } = it(e, a, d, t, m);
|
|
249
|
+
if (p) {
|
|
250
|
+
const w = {
|
|
252
251
|
provider: et,
|
|
253
|
-
unitId:
|
|
254
|
-
replaceable:
|
|
255
|
-
isFormula:
|
|
252
|
+
unitId: n,
|
|
253
|
+
replaceable: R,
|
|
254
|
+
isFormula: v,
|
|
256
255
|
range: {
|
|
257
|
-
subUnitId:
|
|
256
|
+
subUnitId: o,
|
|
258
257
|
range: {
|
|
259
|
-
startRow:
|
|
258
|
+
startRow: a,
|
|
260
259
|
startColumn: d,
|
|
261
260
|
endColumn: d + (_ != null ? _ : 1) - 1,
|
|
262
|
-
endRow:
|
|
261
|
+
endRow: a + (S != null ? S : 1) - 1
|
|
263
262
|
}
|
|
264
263
|
}
|
|
265
264
|
};
|
|
266
|
-
|
|
265
|
+
s.push(w);
|
|
267
266
|
}
|
|
268
267
|
}
|
|
269
|
-
return { results:
|
|
268
|
+
return { results: s };
|
|
270
269
|
}
|
|
271
|
-
_findInSelections(e, i, n
|
|
272
|
-
const { findDirection:
|
|
273
|
-
return { results:
|
|
270
|
+
_findInSelections(e, t, i, n) {
|
|
271
|
+
const { findDirection: r } = i, s = r === b.ROW ? X : Y, o = /* @__PURE__ */ new Set();
|
|
272
|
+
return { results: t.map((l) => this._findInRange(
|
|
274
273
|
e,
|
|
274
|
+
i,
|
|
275
|
+
l.range,
|
|
275
276
|
n,
|
|
276
|
-
a
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const _ = `${l}-${d}`;
|
|
280
|
-
return h.has(_) ? !0 : (h.add(_), !1);
|
|
277
|
+
(a, d) => {
|
|
278
|
+
const _ = `${a}-${d}`;
|
|
279
|
+
return o.has(_) ? !0 : (o.add(_), !1);
|
|
281
280
|
}
|
|
282
|
-
).results).flat().sort((
|
|
281
|
+
).results).flat().sort((l, a) => s(l.range.range, a.range.range) ? -1 : 1) };
|
|
283
282
|
}
|
|
284
283
|
/** Find matches in a given worksheet. */
|
|
285
|
-
_findInWorksheet(e,
|
|
286
|
-
const
|
|
287
|
-
return this._findInRange(e,
|
|
284
|
+
_findInWorksheet(e, t, i) {
|
|
285
|
+
const n = e.getRowCount(), r = e.getColumnCount(), s = { startRow: 0, startColumn: 0, endRow: n - 1, endColumn: r - 1 };
|
|
286
|
+
return this._findInRange(e, t, s, i);
|
|
288
287
|
}
|
|
289
288
|
_disposeHighlights() {
|
|
290
289
|
var e;
|
|
291
|
-
this._highlightShapes.forEach((
|
|
292
|
-
|
|
290
|
+
this._highlightShapes.forEach((t) => {
|
|
291
|
+
t.getScene().makeDirty(), t.dispose();
|
|
293
292
|
}), this._highlightShapes = [], (e = this._currentHighlightShape) == null || e.dispose(), this._currentHighlightShape = null;
|
|
294
293
|
}
|
|
295
294
|
_updateFindHighlight() {
|
|
296
|
-
var
|
|
295
|
+
var S, m;
|
|
297
296
|
this._disposeHighlights();
|
|
298
|
-
const e = (
|
|
299
|
-
if (!e || !this._getSheetObject() || ((
|
|
297
|
+
const e = (S = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : S.skeleton;
|
|
298
|
+
if (!e || !this._getSheetObject() || ((m = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : m.getUnitId()) !== this._workbook.getUnitId())
|
|
300
299
|
return;
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
300
|
+
const n = this._workbook.getUnitId(), r = this._renderManagerService.getRenderById(n);
|
|
301
|
+
if (r == null)
|
|
303
302
|
return;
|
|
304
|
-
const { scene:
|
|
305
|
-
const { startColumn: v, startRow:
|
|
306
|
-
left:
|
|
307
|
-
top:
|
|
308
|
-
color:
|
|
309
|
-
width:
|
|
310
|
-
height:
|
|
303
|
+
const { scene: s } = r, o = this._matches, c = this._themeService.getCurrentTheme().gold400, l = new Re(c).toRgb(), a = this._workbook.getActiveSheet(), d = a.getSheetId(), _ = o.filter((p) => p.range.subUnitId === d).map((p, R) => {
|
|
304
|
+
const { startColumn: v, startRow: w, endColumn: se, endRow: re } = p.range.range, oe = j(w, v, s, e), he = j(re, se, s, e), { startX: E, startY: A } = oe, { endX: ce, endY: ae } = he, N = !a.getRowRawVisible(w), D = !a.getColVisible(v), le = N || D, de = D ? 2 : ce - E, ue = N ? 2 : ae - A, ge = {
|
|
305
|
+
left: E,
|
|
306
|
+
top: A,
|
|
307
|
+
color: l,
|
|
308
|
+
width: de,
|
|
309
|
+
height: ue,
|
|
311
310
|
evented: !1,
|
|
312
|
-
inHiddenRange:
|
|
311
|
+
inHiddenRange: le,
|
|
313
312
|
zIndex: tt
|
|
314
313
|
};
|
|
315
|
-
return new Ye(`find-highlight-${R}`,
|
|
314
|
+
return new Ye(`find-highlight-${R}`, ge);
|
|
316
315
|
});
|
|
317
|
-
|
|
316
|
+
s.addObjects(_), this._highlightShapes = _, s.makeDirty();
|
|
318
317
|
}
|
|
319
318
|
_updateCurrentHighlightShape(e) {
|
|
320
|
-
var
|
|
321
|
-
if ((
|
|
322
|
-
const
|
|
323
|
-
if (!
|
|
319
|
+
var t;
|
|
320
|
+
if ((t = this._currentHighlightShape) == null || t.setShapeProps({ activated: !1 }), this._currentHighlightShape = null, e !== void 0) {
|
|
321
|
+
const i = this._highlightShapes[e];
|
|
322
|
+
if (!i)
|
|
324
323
|
return;
|
|
325
|
-
this._currentHighlightShape =
|
|
324
|
+
this._currentHighlightShape = i, i.setShapeProps({ activated: !0 });
|
|
326
325
|
}
|
|
327
326
|
}
|
|
328
327
|
_getSheetObject() {
|
|
329
|
-
return
|
|
328
|
+
return $e(this._univerInstanceService, this._renderManagerService);
|
|
330
329
|
}
|
|
331
330
|
_focusMatch(e) {
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
{ unitId: this._workbook.getUnitId(), subUnitId:
|
|
331
|
+
const t = e.range.subUnitId;
|
|
332
|
+
t !== this._workbook.getActiveSheet().getSheetId() && this._commandService.syncExecuteCommand(
|
|
333
|
+
Te.id,
|
|
334
|
+
{ unitId: this._workbook.getUnitId(), subUnitId: t },
|
|
336
335
|
{ fromFindReplace: !0 }
|
|
337
336
|
), this._commandService.syncExecuteCommand(
|
|
338
|
-
|
|
337
|
+
Le.id,
|
|
339
338
|
{ range: e.range.range },
|
|
340
339
|
{ fromFindReplace: !0 }
|
|
341
340
|
);
|
|
342
341
|
}
|
|
343
|
-
_tryRestoreLastMatchesPosition(e,
|
|
342
|
+
_tryRestoreLastMatchesPosition(e, t) {
|
|
344
343
|
if (!e)
|
|
345
344
|
return 0;
|
|
346
|
-
const { subUnitId:
|
|
347
|
-
if (
|
|
345
|
+
const { subUnitId: i } = e.range, { startColumn: n, startRow: r } = e.range.range, s = t.findIndex((o) => {
|
|
346
|
+
if (i !== o.range.subUnitId)
|
|
348
347
|
return !1;
|
|
349
|
-
const { startColumn: c, startRow:
|
|
350
|
-
return c ===
|
|
348
|
+
const { startColumn: c, startRow: l } = o.range.range;
|
|
349
|
+
return c === n && l === r;
|
|
351
350
|
});
|
|
352
|
-
return
|
|
351
|
+
return s > -1 ? s + 1 : 0;
|
|
353
352
|
}
|
|
354
353
|
moveToNextMatch(e) {
|
|
355
|
-
var
|
|
354
|
+
var s, o, c;
|
|
356
355
|
if (!this._matches.length)
|
|
357
356
|
return null;
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const [
|
|
361
|
-
return this._matchesPosition =
|
|
357
|
+
const t = (s = e == null ? void 0 : e.loop) != null ? s : !1, i = (o = e == null ? void 0 : e.stayIfOnMatch) != null ? o : !1, n = (c = e == null ? void 0 : e.noFocus) != null ? c : !1, r = this._findNextMatch(t, i);
|
|
358
|
+
if (r) {
|
|
359
|
+
const [l, a] = r;
|
|
360
|
+
return this._matchesPosition = a + 1, this._query.findScope === I.UNIT ? this._activeHighlightIndex = this._matchesByWorksheet.get(l.range.subUnitId).findIndex((d) => d === l) : this._activeHighlightIndex = a, n || this._focusMatch(l), this._workbook.getActiveSheet().getSheetId() === l.range.subUnitId && this._updateCurrentHighlightShape(this._activeHighlightIndex), l;
|
|
362
361
|
}
|
|
363
362
|
return this._matchesPosition = 0, this._updateCurrentHighlightShape(), null;
|
|
364
363
|
}
|
|
365
364
|
moveToPreviousMatch(e) {
|
|
366
|
-
var
|
|
365
|
+
var s, o, c;
|
|
367
366
|
if (!this._matches.length)
|
|
368
367
|
return null;
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
const [
|
|
372
|
-
return this._matchesPosition =
|
|
368
|
+
const t = (s = e == null ? void 0 : e.loop) != null ? s : !1, i = (o = e == null ? void 0 : e.stayIfOnMatch) != null ? o : !1, n = (c = e == null ? void 0 : e.noFocus) != null ? c : !1, r = this._findPreviousMatch(t, i);
|
|
369
|
+
if (r) {
|
|
370
|
+
const [l, a] = r;
|
|
371
|
+
return this._matchesPosition = a + 1, this._query.findScope === I.UNIT ? this._activeHighlightIndex = this._matchesByWorksheet.get(l.range.subUnitId).findIndex((d) => d === l) : this._activeHighlightIndex = a, n || this._focusMatch(l), this._workbook.getActiveSheet().getSheetId() === l.range.subUnitId && this._updateCurrentHighlightShape(this._activeHighlightIndex), l;
|
|
373
372
|
}
|
|
374
373
|
return this._matchesPosition = 0, this._updateCurrentHighlightShape(), null;
|
|
375
374
|
}
|
|
376
|
-
_findPreviousMatch(e = !1,
|
|
375
|
+
_findPreviousMatch(e = !1, t = !1) {
|
|
377
376
|
if (this.currentMatch) {
|
|
378
|
-
const
|
|
379
|
-
if (
|
|
380
|
-
return [this.currentMatch,
|
|
381
|
-
const
|
|
382
|
-
if (!e &&
|
|
377
|
+
const s = this._matches.findIndex((a) => a === this.currentMatch);
|
|
378
|
+
if (t)
|
|
379
|
+
return [this.currentMatch, s];
|
|
380
|
+
const o = s - 1;
|
|
381
|
+
if (!e && o < 0)
|
|
383
382
|
return null;
|
|
384
|
-
const c = this._matches.length,
|
|
385
|
-
return [this._matches[
|
|
383
|
+
const c = this._matches.length, l = (o + c) % c;
|
|
384
|
+
return [this._matches[l], l];
|
|
386
385
|
}
|
|
387
|
-
const
|
|
388
|
-
if (!(
|
|
386
|
+
const i = this._selectionManagerService.getSelections();
|
|
387
|
+
if (!(i != null && i.length))
|
|
389
388
|
return [this._matches[0], 0];
|
|
390
389
|
if (this._query.findScope !== I.UNIT)
|
|
391
|
-
return this._findPreviousMatchByRange(this._matches,
|
|
392
|
-
const
|
|
393
|
-
return
|
|
390
|
+
return this._findPreviousMatchByRange(this._matches, i[0].range);
|
|
391
|
+
const n = this._workbook.getActiveSheet().getSheetId(), r = this._findPreviousWorksheetThatHasAMatch(n, e);
|
|
392
|
+
return r ? this._findPreviousMatchByRange(this._matchesByWorksheet.get(r), i[0].range) : null;
|
|
394
393
|
}
|
|
395
|
-
_findNextMatch(e = !1,
|
|
394
|
+
_findNextMatch(e = !1, t = !1) {
|
|
396
395
|
if (this.currentMatch) {
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
return [this.currentMatch,
|
|
400
|
-
const
|
|
401
|
-
if (!e &&
|
|
396
|
+
const s = this._matches.findIndex((a) => a === this.currentMatch);
|
|
397
|
+
if (t)
|
|
398
|
+
return [this.currentMatch, s];
|
|
399
|
+
const o = s + 1, c = this._matches.length;
|
|
400
|
+
if (!e && o >= c)
|
|
402
401
|
return null;
|
|
403
|
-
const
|
|
404
|
-
return [this._matches[
|
|
402
|
+
const l = o % c;
|
|
403
|
+
return [this._matches[l], l];
|
|
405
404
|
}
|
|
406
|
-
const
|
|
407
|
-
if (!(
|
|
405
|
+
const i = this._selectionManagerService.getSelections();
|
|
406
|
+
if (!(i != null && i.length))
|
|
408
407
|
return [this._matches[0], 0];
|
|
409
408
|
if (this._query.findScope !== I.UNIT)
|
|
410
|
-
return this._findNextMatchByRange(this._matches,
|
|
411
|
-
const
|
|
412
|
-
return
|
|
413
|
-
}
|
|
414
|
-
_findPreviousWorksheetThatHasAMatch(e,
|
|
415
|
-
const
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
_findNextWorksheetThatHasAMatch(e,
|
|
419
|
-
const
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
-
_findNextMatchByRange(e,
|
|
423
|
-
const
|
|
424
|
-
let
|
|
425
|
-
const c =
|
|
426
|
-
if (!(
|
|
409
|
+
return this._findNextMatchByRange(this._matches, i[0].range, t);
|
|
410
|
+
const n = this._workbook.getActiveSheet().getSheetId(), r = this._findNextWorksheetThatHasAMatch(n, e);
|
|
411
|
+
return r ? this._findNextMatchByRange(this._matchesByWorksheet.get(r), i[0].range) : null;
|
|
412
|
+
}
|
|
413
|
+
_findPreviousWorksheetThatHasAMatch(e, t = !1) {
|
|
414
|
+
const i = this._workbook.getSheetOrders(), n = i.findIndex((o) => o === e), s = (t ? $(i, n + 1) : i.slice(0, n + 1)).findLast((o) => this._matchesByWorksheet.has(o));
|
|
415
|
+
return s != null ? s : null;
|
|
416
|
+
}
|
|
417
|
+
_findNextWorksheetThatHasAMatch(e, t = !1) {
|
|
418
|
+
const i = this._workbook.getSheetOrders(), n = i.findIndex((o) => o === e), s = (t ? $(i, n) : i.slice(n)).find((o) => this._matchesByWorksheet.has(o));
|
|
419
|
+
return s != null ? s : null;
|
|
420
|
+
}
|
|
421
|
+
_findNextMatchByRange(e, t, i = !1) {
|
|
422
|
+
const n = this._query.findDirection === b.ROW;
|
|
423
|
+
let r = e.findIndex((o) => {
|
|
424
|
+
const c = o.range.range;
|
|
425
|
+
if (!(n ? X(t, c) : Y(t, c)))
|
|
427
426
|
return !1;
|
|
428
|
-
const
|
|
429
|
-
return
|
|
427
|
+
const a = Q(t, c);
|
|
428
|
+
return i ? a : !a;
|
|
430
429
|
});
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
return [
|
|
434
|
-
}
|
|
435
|
-
_findPreviousMatchByRange(e,
|
|
436
|
-
const
|
|
437
|
-
let
|
|
438
|
-
const c =
|
|
439
|
-
if (!(
|
|
430
|
+
r === -1 && (r = e.length - 1);
|
|
431
|
+
const s = e[r];
|
|
432
|
+
return [s, this._matches.findIndex((o) => o === s)];
|
|
433
|
+
}
|
|
434
|
+
_findPreviousMatchByRange(e, t, i = !1) {
|
|
435
|
+
const n = this._query.findDirection === b.ROW;
|
|
436
|
+
let r = this._matches.findLastIndex((o) => {
|
|
437
|
+
const c = o.range.range;
|
|
438
|
+
if (!(n ? Ke(t, c) : ze(t, c)))
|
|
440
439
|
return !1;
|
|
441
|
-
const
|
|
442
|
-
return
|
|
440
|
+
const a = Q(t, c);
|
|
441
|
+
return i ? a : !a;
|
|
443
442
|
});
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
return [
|
|
443
|
+
r === -1 && (r = 0);
|
|
444
|
+
const s = e[r];
|
|
445
|
+
return [s, this._matches.findIndex((o) => o === s)];
|
|
447
446
|
}
|
|
448
447
|
async replace(e) {
|
|
449
448
|
if (this._matchesCount === 0 || !this.currentMatch || !this._query || !this.currentMatch.replaceable)
|
|
450
449
|
return !1;
|
|
451
|
-
const
|
|
450
|
+
const t = this.currentMatch.range, i = this._workbook.getSheetBySheetId(this.currentMatch.range.subUnitId), n = this._getReplacedCellData(
|
|
452
451
|
this.currentMatch,
|
|
453
|
-
|
|
454
|
-
this._query.findBy ===
|
|
452
|
+
i,
|
|
453
|
+
this._query.findBy === M.FORMULA,
|
|
455
454
|
this._query.findString,
|
|
456
455
|
e,
|
|
457
456
|
this._query.caseSensitive ? "g" : "ig"
|
|
458
|
-
),
|
|
457
|
+
), r = {
|
|
459
458
|
unitId: this.currentMatch.unitId,
|
|
460
|
-
subUnitId:
|
|
459
|
+
subUnitId: t.subUnitId,
|
|
461
460
|
value: {
|
|
462
|
-
[
|
|
463
|
-
[
|
|
461
|
+
[t.range.startRow]: {
|
|
462
|
+
[t.range.startColumn]: n
|
|
464
463
|
}
|
|
465
464
|
}
|
|
466
465
|
};
|
|
467
|
-
return this._commandService.executeCommand(
|
|
466
|
+
return this._commandService.executeCommand(q.id, r);
|
|
468
467
|
}
|
|
469
468
|
async replaceAll(e) {
|
|
470
469
|
if (this._matchesCount === 0 || !this._query)
|
|
471
470
|
return { success: 0, failure: 0 };
|
|
472
|
-
const
|
|
473
|
-
return
|
|
474
|
-
const _ = new
|
|
475
|
-
|
|
476
|
-
const { startColumn:
|
|
477
|
-
v && _.setValue(R,
|
|
471
|
+
const t = this._workbook.getUnitId(), { findString: i, caseSensitive: n, findBy: r } = this._query, s = r === M.FORMULA, o = n ? "g" : "ig", c = [];
|
|
472
|
+
return we(this._matches.filter((a) => a.replaceable), (a) => a.range.subUnitId).forEach((a, d) => {
|
|
473
|
+
const _ = new be(), S = this._workbook.getSheetBySheetId(d);
|
|
474
|
+
a.forEach((m) => {
|
|
475
|
+
const { startColumn: p, startRow: R } = m.range.range, v = this._getReplacedCellData(m, S, s, i, e, o);
|
|
476
|
+
v && _.setValue(R, p, v);
|
|
478
477
|
}), c.push({
|
|
479
|
-
count:
|
|
478
|
+
count: a.length,
|
|
480
479
|
subUnitId: d,
|
|
481
480
|
value: _.getMatrix()
|
|
482
481
|
});
|
|
483
|
-
}), c ? this._commandService.executeCommand(
|
|
484
|
-
unitId:
|
|
482
|
+
}), c ? this._commandService.executeCommand(te.id, {
|
|
483
|
+
unitId: t,
|
|
485
484
|
replacements: c
|
|
486
485
|
}) : { success: 0, failure: 0 };
|
|
487
486
|
}
|
|
488
|
-
_getReplacedCellData(e, i, n,
|
|
489
|
-
var
|
|
490
|
-
const
|
|
487
|
+
_getReplacedCellData(e, t, i, n, r, s) {
|
|
488
|
+
var S;
|
|
489
|
+
const o = e.range.range, { startRow: c, startColumn: l } = o, a = t.getCellRaw(c, l);
|
|
491
490
|
if (e.isFormula)
|
|
492
|
-
return
|
|
493
|
-
if (!!((
|
|
494
|
-
const
|
|
495
|
-
return
|
|
491
|
+
return i ? { f: a.f.replace(new RegExp(G(n), s), r), v: null } : null;
|
|
492
|
+
if (!!((S = a.p) != null && S.body)) {
|
|
493
|
+
const m = Me.deepClone(a.p);
|
|
494
|
+
return ke(m.body, n, r), { p: m };
|
|
496
495
|
}
|
|
497
|
-
return { v:
|
|
498
|
-
}
|
|
499
|
-
_getFindReplacePermissionCheck(e) {
|
|
500
|
-
var a, l;
|
|
501
|
-
const { row: i, col: n, subUnitId: s } = e, r = this._univerInstanceService.getCurrentUnitForType(T.UNIVER_SHEET).getSheetBySheetId(s);
|
|
502
|
-
if (!r)
|
|
503
|
-
return !1;
|
|
504
|
-
const h = (l = (a = r.getCell(i, n)) == null ? void 0 : a.selectionProtection) == null ? void 0 : l[0];
|
|
505
|
-
return (h == null ? void 0 : h[ie.View]) !== !1;
|
|
496
|
+
return { v: a.v.toString().replace(new RegExp(G(n), s), r) };
|
|
506
497
|
}
|
|
507
498
|
};
|
|
508
|
-
|
|
509
|
-
f(
|
|
510
|
-
f(
|
|
511
|
-
f(
|
|
512
|
-
f(
|
|
513
|
-
f(
|
|
514
|
-
f(
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
],
|
|
518
|
-
function K(t) {
|
|
519
|
-
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
499
|
+
W = T([
|
|
500
|
+
f(2, J),
|
|
501
|
+
f(3, ee),
|
|
502
|
+
f(4, H),
|
|
503
|
+
f(5, z),
|
|
504
|
+
f(6, C(Ie)),
|
|
505
|
+
f(7, C(Fe))
|
|
506
|
+
], W);
|
|
507
|
+
function G(h) {
|
|
508
|
+
return h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
520
509
|
}
|
|
521
|
-
let
|
|
522
|
-
constructor(e, i) {
|
|
510
|
+
let F = class extends K {
|
|
511
|
+
constructor(e, t, i) {
|
|
523
512
|
super();
|
|
524
513
|
/**
|
|
525
514
|
* Hold all find results in this kind of univer business instances (Workbooks).
|
|
526
515
|
*/
|
|
527
516
|
g(this, "_findModelsByUnitId", /* @__PURE__ */ new Map());
|
|
528
|
-
this._univerInstanceService = e, this._injector = i;
|
|
517
|
+
this._univerInstanceService = e, this._renderManagerService = t, this._injector = i;
|
|
529
518
|
}
|
|
530
519
|
async find(e) {
|
|
531
520
|
this._terminate();
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
const n = this._injector.createInstance(
|
|
535
|
-
this._findModelsByUnitId.set(
|
|
536
|
-
const
|
|
537
|
-
return n.start(
|
|
521
|
+
const t = this._univerInstanceService.getCurrentUnitForType(Z.UNIVER_SHEET), i = this._renderManagerService.getRenderById(t.getUnitId()).with(De);
|
|
522
|
+
if (t) {
|
|
523
|
+
const n = this._injector.createInstance(W, t, i);
|
|
524
|
+
this._findModelsByUnitId.set(t.getUnitId(), n);
|
|
525
|
+
const r = this._preprocessQuery(e);
|
|
526
|
+
return n.start(r), [n];
|
|
538
527
|
}
|
|
539
528
|
return [];
|
|
540
529
|
}
|
|
@@ -550,54 +539,56 @@ let B = class extends q {
|
|
|
550
539
|
* @returns the parsed query object
|
|
551
540
|
*/
|
|
552
541
|
_preprocessQuery(e) {
|
|
553
|
-
let
|
|
554
|
-
return
|
|
542
|
+
let t = e.caseSensitive ? e.findString : e.findString.toLowerCase();
|
|
543
|
+
return t = t.trim(), {
|
|
555
544
|
...e,
|
|
556
|
-
findString:
|
|
545
|
+
findString: t
|
|
557
546
|
};
|
|
558
547
|
}
|
|
559
548
|
};
|
|
560
|
-
|
|
561
|
-
f(0,
|
|
562
|
-
f(1,
|
|
563
|
-
|
|
549
|
+
F = T([
|
|
550
|
+
f(0, J),
|
|
551
|
+
f(1, ee),
|
|
552
|
+
f(2, C(O))
|
|
553
|
+
], F);
|
|
564
554
|
const u = { hit: !1, replaceable: !1, isFormula: !1, rawData: null };
|
|
565
|
-
function it(
|
|
566
|
-
const { findBy:
|
|
567
|
-
return u.rawData =
|
|
555
|
+
function it(h, e, t, i, n) {
|
|
556
|
+
const { findBy: r } = i, s = r === M.FORMULA, o = h.getCellRaw(e, t);
|
|
557
|
+
return u.rawData = o, !(o != null && o.f) ? (u.isFormula = !1, P(n, i) ? o ? (u.hit = !0, u.replaceable = !0) : (u.hit = !0, u.replaceable = !1) : (u.hit = !1, u.replaceable = !1), u) : (u.isFormula = !0, s ? P({ v: o.f }, i) ? (u.hit = !0, u.replaceable = !0, u) : (u.hit = !1, u.replaceable = !1, u) : (u.replaceable = !1, P(n, i) ? u.hit = !0 : u.hit = !1, u));
|
|
568
558
|
}
|
|
569
|
-
function
|
|
570
|
-
let
|
|
571
|
-
return
|
|
559
|
+
function P(h, e) {
|
|
560
|
+
let t = nt(h);
|
|
561
|
+
return t ? e.matchesTheWholeCell ? (t = st(t), e.caseSensitive ? t === e.findString : t.toLowerCase() === e.findString) : e.caseSensitive ? t.indexOf(e.findString) > -1 : t.toLowerCase().indexOf(e.findString) > -1 : !1;
|
|
572
562
|
}
|
|
573
|
-
function nt(
|
|
574
|
-
var i, n
|
|
575
|
-
const e = (
|
|
563
|
+
function nt(h) {
|
|
564
|
+
var t, i, n;
|
|
565
|
+
const e = (n = (i = (t = h == null ? void 0 : h.p) == null ? void 0 : t.body) == null ? void 0 : i.dataStream) != null ? n : h == null ? void 0 : h.v;
|
|
576
566
|
return typeof e == "number" ? `${e}` : typeof e == "boolean" ? e ? "1" : "0" : e;
|
|
577
567
|
}
|
|
578
|
-
function st(
|
|
579
|
-
return
|
|
568
|
+
function st(h) {
|
|
569
|
+
return h.replace(/^ +/g, "").replace(/ +$/g, "");
|
|
580
570
|
}
|
|
581
|
-
var
|
|
582
|
-
for (var
|
|
583
|
-
(
|
|
584
|
-
return
|
|
585
|
-
},
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
571
|
+
var ie = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, ot = (h, e, t) => e in h ? ie(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, ht = (h, e, t, i) => {
|
|
572
|
+
for (var n = i > 1 ? void 0 : i ? rt(e, t) : e, r = h.length - 1, s; r >= 0; r--)
|
|
573
|
+
(s = h[r]) && (n = (i ? s(e, t, n) : s(n)) || n);
|
|
574
|
+
return i && n && ie(e, t, n), n;
|
|
575
|
+
}, ct = (h, e) => (t, i) => e(t, i, h), ne = (h, e, t) => (ot(h, typeof e != "symbol" ? e + "" : e, t), t);
|
|
576
|
+
const at = "SHEET_FIND_REPLACE_PLUGIN";
|
|
577
|
+
let y = class extends ye {
|
|
578
|
+
constructor(h, e) {
|
|
579
|
+
super(), this._injector = e;
|
|
580
|
+
}
|
|
581
|
+
onStarting(h) {
|
|
582
|
+
[[x]].forEach((e) => h.add(e));
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
ne(y, "pluginName", at);
|
|
586
|
+
ne(y, "type", Z.UNIVER_SHEET);
|
|
587
|
+
y = ht([
|
|
588
|
+
xe(L, L, We),
|
|
589
|
+
ct(1, C(O))
|
|
590
|
+
], y);
|
|
600
591
|
export {
|
|
601
|
-
|
|
602
|
-
|
|
592
|
+
x as SheetsFindReplaceController,
|
|
593
|
+
y as UniverSheetsFindReplacePlugin
|
|
603
594
|
};
|