@univerjs/find-replace 0.10.12 → 0.10.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  var st = Object.defineProperty;
2
- var at = (t, e, n) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var o = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { createIdentifier as ot, Inject as $, Injector as fe, IContextService as X, Disposable as ee, DisposableCollection as ct, toDisposable as A, IUniverInstanceService as pe, ICommandService as B, CommandType as I, LocaleService as W, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as lt, RxDisposable as dt, IConfigService as ht, Plugin as ut, merge as ft } from "@univerjs/core";
5
- import { IConfirmService as pt, IMessageService as me, useDependency as v, useObservable as P, useDebounceFn as _t, ILayoutService as ve, KeyCode as M, MetaKeys as D, getMenuHiddenObservable as gt, MenuItemType as mt, RibbonDataGroup as vt, IMenuManagerService as St, IShortcutService as Ct, IDialogService as Mt, ComponentManager as Rt } from "@univerjs/ui";
6
- import { MessageType as N, Input as Se, Pager as bt, FormLayout as b, Select as V, FormDualColumnLayout as ae, Checkbox as oe, Button as G } from "@univerjs/design";
7
- import { RENDER_RAW_FORMULA_KEY as It } from "@univerjs/engine-render";
8
- import { throttleTime as yt, BehaviorSubject as T, combineLatest as Ce, debounceTime as Ft, Subject as Me, fromEvent as Dt, map as xt, takeUntil as ce } from "rxjs";
9
- import { jsx as l, jsxs as F, Fragment as K } from "react/jsx-runtime";
10
- import { forwardRef as k, useRef as q, createElement as Re, useState as Pt, useCallback as u, useEffect as L, useMemo as te, useImperativeHandle as Tt } from "react";
11
- const be = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", ye = "FIND_REPLACE_REPLACE_REVEALED";
12
- var Ot = Object.getOwnPropertyDescriptor, Fe = (t, e, n, i) => {
13
- for (var r = i > 1 ? void 0 : i ? Ot(e, n) : e, s = t.length - 1, a; s >= 0; s--)
14
- (a = t[s]) && (r = a(r) || r);
15
- return r;
16
- }, w = (t, e) => (n, i) => e(n, i, t);
17
- class vi extends ee {
2
+ var rt = (t, e, n) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => rt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { createIdentifier as at, Inject as $, Injector as ue, IContextService as J, Disposable as Q, DisposableCollection as ot, toDisposable as O, IUniverInstanceService as fe, ICommandService as U, CommandType as b, LocaleService as B, FOCUSING_SHEET as pe, EDITOR_ACTIVATED as _e, UniverInstanceType as ct, RxDisposable as lt, IConfigService as dt, Plugin as ht, merge as ut } from "@univerjs/core";
5
+ import { IConfirmService as ft, IMessageService as ge, useDependency as m, useObservable as P, useDebounceFn as pt, ILayoutService as me, KeyCode as C, MetaKeys as D, getMenuHiddenObservable as _t, MenuItemType as gt, RibbonDataGroup as mt, IMenuManagerService as St, IShortcutService as vt, IDialogService as Ct, ComponentManager as Mt } from "@univerjs/ui";
6
+ import { MessageType as N, Input as Se, Pager as Rt, FormLayout as R, Select as k, FormDualColumnLayout as re, Checkbox as ae, Button as j } from "@univerjs/design";
7
+ import { RENDER_RAW_FORMULA_KEY as bt } from "@univerjs/engine-render";
8
+ import { throttleTime as It, BehaviorSubject as T, combineLatest as ve, debounceTime as Ft, Subject as Ce, fromEvent as Dt, map as yt, takeUntil as oe } from "rxjs";
9
+ import { useRef as G, createElement as Me, forwardRef as X, useState as Pt, useCallback as u, useEffect as A, useMemo as ee, useImperativeHandle as Tt } from "react";
10
+ import { jsx as c, jsxs as F, Fragment as H } from "react/jsx-runtime";
11
+ const Re = "FIND_REPLACE_INPUT_FOCUS", be = "FIND_REPLACE_DIALOG_FOCUS", Ie = "FIND_REPLACE_REPLACE_REVEALED";
12
+ var xt = Object.getOwnPropertyDescriptor, Fe = (t, e, n, i) => {
13
+ for (var s = i > 1 ? void 0 : i ? xt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
14
+ (a = t[r]) && (s = a(s) || s);
15
+ return s;
16
+ }, L = (t, e) => (n, i) => e(n, i, t);
17
+ class gi extends Q {
18
18
  }
19
- const p = ot("find-replace.service");
19
+ const f = at("find-replace.service");
20
20
  function Et(t) {
21
21
  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";
22
22
  }
23
- let Z = class extends ee {
24
- constructor(e, n, i, r) {
23
+ let K = class extends Q {
24
+ constructor(e, n, i, s) {
25
25
  super();
26
26
  o(this, "currentMatch$", new T(null));
27
27
  o(this, "replaceables$", new T([]));
@@ -31,10 +31,10 @@ let Z = class extends ee {
31
31
  o(this, "_matchingModel", null);
32
32
  o(this, "_matches", []);
33
33
  o(this, "_currentSearchingDisposables", null);
34
- this._state = e, this._providers = n, this._univerInstanceService = i, this._commandService = r, this.disposeWithMe(
35
- this._state.stateUpdates$.pipe(yt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
34
+ this._state = e, this._providers = n, this._univerInstanceService = i, this._commandService = s, this.disposeWithMe(
35
+ this._state.stateUpdates$.pipe(It(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
36
36
  const a = this._state.state;
37
- Et(s) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
37
+ Et(r) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
38
38
  })
39
39
  );
40
40
  }
@@ -42,7 +42,7 @@ let Z = class extends ee {
42
42
  return this._findModels.length > 0;
43
43
  }
44
44
  dispose() {
45
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ie(), revealed: !1 });
45
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...te(), revealed: !1 });
46
46
  }
47
47
  async start() {
48
48
  if (!this._state.findString)
@@ -58,7 +58,7 @@ let Z = class extends ee {
58
58
  async _startSearching() {
59
59
  if (!this._state.findString)
60
60
  return { results: [] };
61
- const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((r) => r.find({
61
+ const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((s) => s.find({
62
62
  findString: this._state.findString,
63
63
  findDirection: this._state.findDirection,
64
64
  findScope: this._state.findScope,
@@ -68,8 +68,8 @@ let Z = class extends ee {
68
68
  matchesTheWholeCell: this._state.matchesTheWholeCell
69
69
  })))).flat();
70
70
  this._subscribeToModelsChanges(n);
71
- const i = this._matches = n.map((r) => r.getMatches()).flat();
72
- 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: [] });
71
+ const i = this._matches = n.map((s) => s.getMatches()).flat();
72
+ return this.replaceables$.next(i.filter((s) => s.replaceable)), i.length ? (this._moveToInitialMatch(n), this._state.changeState({ matchesCount: i.length }), { results: i }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
73
73
  }
74
74
  /** Terminate the current searching session, when searching string is empty. */
75
75
  _stopSearching() {
@@ -82,20 +82,20 @@ let Z = class extends ee {
82
82
  }
83
83
  // When a document's content changes, we should reset all matches and try to move to the next match.
84
84
  _subscribeToModelsChanges(e) {
85
- const n = this._currentSearchingDisposables = new ct(), i = Ce(e.map((r) => r.matchesUpdate$)).pipe(Ft(220)).subscribe(([...r]) => {
86
- const s = this._matches = r.flat();
87
- 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([]));
85
+ const n = this._currentSearchingDisposables = new ot(), i = ve(e.map((s) => s.matchesUpdate$)).pipe(Ft(220)).subscribe(([...s]) => {
86
+ const r = this._matches = s.flat();
87
+ 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([]));
88
88
  });
89
- e.forEach((r) => n.add(A(r.activelyChangingMatch$.subscribe((s) => {
90
- const a = this._matches.findIndex((c) => c === s);
89
+ e.forEach((s) => n.add(O(s.activelyChangingMatch$.subscribe((r) => {
90
+ const a = this._matches.findIndex((l) => l === r);
91
91
  this._state.changeState({ matchesPosition: a + 1 });
92
- })))), n.add(A(i));
92
+ })))), n.add(O(i));
93
93
  }
94
94
  async replace() {
95
95
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
96
96
  }
97
97
  async replaceAll() {
98
- 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 }));
98
+ const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i, s) => (i.success += s.success, i.failure += s.failure, i), { success: 0, failure: 0 }));
99
99
  return e.failure === 0 && this._stopSearching(), e;
100
100
  }
101
101
  getCurrentMatch() {
@@ -112,16 +112,16 @@ let Z = class extends ee {
112
112
  if (n)
113
113
  return this._markMatch(n), n;
114
114
  {
115
- const i = this._findModels.findIndex((r) => r === this._matchingModel);
115
+ const i = this._findModels.findIndex((s) => s === this._matchingModel);
116
116
  return this._moveToNextUnitMatch(i);
117
117
  }
118
118
  }
119
119
  _moveToNextUnitMatch(e) {
120
120
  const n = this._findModels.length;
121
121
  for (let i = (e + 1) % n; i !== e; ) {
122
- const r = this._findModels[i], s = r.moveToNextMatch({ ignoreSelection: !0 });
123
- if (s)
124
- return this._matchingModel = r, this._markMatch(s), s;
122
+ const s = this._findModels[i], r = s.moveToNextMatch({ ignoreSelection: !0 });
123
+ if (r)
124
+ return this._matchingModel = s, this._markMatch(r), r;
125
125
  i = (i + 1) % n;
126
126
  }
127
127
  if (this._matchingModel) {
@@ -134,41 +134,41 @@ let Z = class extends ee {
134
134
  return;
135
135
  const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
136
136
  if (n) {
137
- const i = this._matches.findIndex((r) => r === n);
137
+ const i = this._matches.findIndex((s) => s === n);
138
138
  return this.currentMatch$.next(n), this._state.changeState({ matchesPosition: i + 1 }), n;
139
139
  } else {
140
- const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
141
- for (let a = (r - 1 + i) % i; a !== r; ) {
142
- const c = this._findModels[a], d = c.moveToPreviousMatch({ ignoreSelection: !0 });
140
+ const i = this._findModels.length, s = this._findModels.findIndex((a) => a === this._matchingModel);
141
+ for (let a = (s - 1 + i) % i; a !== s; ) {
142
+ const l = this._findModels[a], d = l.moveToPreviousMatch({ ignoreSelection: !0 });
143
143
  if (d)
144
- return this._matchingModel = c, this._markMatch(d), d;
144
+ return this._matchingModel = l, this._markMatch(d), d;
145
145
  a = (a - 1) % i;
146
146
  }
147
- const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
148
- return s && this._markMatch(s), s;
147
+ const r = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
148
+ return r && this._markMatch(r), r;
149
149
  }
150
150
  }
151
151
  _moveToInitialMatch(e, n = !1) {
152
- var s;
153
- const i = (s = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : s.getUnitId();
152
+ var r;
153
+ const i = (r = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : r.getUnitId();
154
154
  if (!i)
155
155
  return -1;
156
- const r = e.findIndex((a) => a.unitId === i);
157
- if (r !== -1) {
158
- this._matchingModel = e[r];
156
+ const s = e.findIndex((a) => a.unitId === i);
157
+ if (s !== -1) {
158
+ this._matchingModel = e[s];
159
159
  const a = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus: n });
160
160
  if (a)
161
- return this._markMatch(a), r;
161
+ return this._markMatch(a), s;
162
162
  }
163
- return this._moveToNextUnitMatch(r), 0;
163
+ return this._moveToNextUnitMatch(s), 0;
164
164
  }
165
165
  };
166
- Z = Fe([
167
- w(2, pe),
168
- w(3, B)
169
- ], Z);
170
- var z = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(z || {}), Y = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Y || {}), J = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(J || {});
171
- function ie() {
166
+ K = Fe([
167
+ L(2, fe),
168
+ L(3, U)
169
+ ], K);
170
+ var q = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(q || {}), Z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Z || {}), z = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(z || {});
171
+ function te() {
172
172
  return {
173
173
  caseSensitive: !1,
174
174
  findBy: "value",
@@ -187,9 +187,9 @@ function ie() {
187
187
  }
188
188
  class Nt {
189
189
  constructor() {
190
- o(this, "_stateUpdates$", new Me());
190
+ o(this, "_stateUpdates$", new Ce());
191
191
  o(this, "stateUpdates$", this._stateUpdates$.asObservable());
192
- o(this, "_state$", new T(ie()));
192
+ o(this, "_state$", new T(te()));
193
193
  o(this, "state$", this._state$.asObservable());
194
194
  o(this, "_findString", "");
195
195
  o(this, "_inputtingFindString", "");
@@ -267,7 +267,7 @@ class Nt {
267
267
  }), this._stateUpdates$.next(i));
268
268
  }
269
269
  }
270
- let Q = class extends ee {
270
+ let Y = class extends Q {
271
271
  constructor(e, n) {
272
272
  super();
273
273
  o(this, "_providers", /* @__PURE__ */ new Set());
@@ -277,7 +277,7 @@ let Q = class extends ee {
277
277
  o(this, "currentMatch$", this._currentMatch$.asObservable());
278
278
  o(this, "_replaceables$", new T([]));
279
279
  o(this, "replaceables$", this._replaceables$.asObservable());
280
- o(this, "_focusSignal$", new Me());
280
+ o(this, "_focusSignal$", new Ce());
281
281
  o(this, "focusSignal$", this._focusSignal$.asObservable());
282
282
  this._injector = e, this._contextService = n;
283
283
  }
@@ -360,8 +360,8 @@ let Q = class extends ee {
360
360
  start(e = !1) {
361
361
  if (this._providers.size === 0)
362
362
  return !1;
363
- this._model = this._injector.createInstance(Z, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
364
- const n = ie();
363
+ 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));
364
+ const n = te();
365
365
  return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
366
366
  }
367
367
  find() {
@@ -373,28 +373,28 @@ let Q = class extends ee {
373
373
  (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
374
374
  }
375
375
  registerFindReplaceProvider(e) {
376
- return this._providers.add(e), A(() => this._providers.delete(e));
376
+ return this._providers.add(e), O(() => this._providers.delete(e));
377
377
  }
378
378
  _toggleRevealReplace(e) {
379
- this._contextService.setContextValue(ye, e);
379
+ this._contextService.setContextValue(Ie, e);
380
380
  }
381
381
  _toggleDisplayRawFormula(e) {
382
- this._contextService.setContextValue(It, e);
382
+ this._contextService.setContextValue(bt, e);
383
383
  }
384
384
  };
385
- Q = Fe([
386
- w(0, $(fe)),
387
- w(1, X)
388
- ], Q);
385
+ Y = Fe([
386
+ L(0, $(ue)),
387
+ L(1, J)
388
+ ], Y);
389
389
  const De = {
390
390
  id: "ui.command.replace-current-match",
391
- type: I.COMMAND,
392
- handler: (t) => t.get(p).replace()
393
- }, $t = "CONFIRM_REPLACE_ALL", xe = {
391
+ type: b.COMMAND,
392
+ handler: (t) => t.get(f).replace()
393
+ }, $t = "CONFIRM_REPLACE_ALL", ye = {
394
394
  id: "ui.command.replace-all-matches",
395
- type: I.COMMAND,
395
+ type: b.COMMAND,
396
396
  handler: async (t) => {
397
- const e = t.get(pt), n = t.get(W), i = t.get(me);
397
+ const e = t.get(ft), n = t.get(B), i = t.get(ge);
398
398
  if (!await e.confirm({
399
399
  id: $t,
400
400
  title: { title: n.t("find-replace.replace.confirm.title") },
@@ -402,129 +402,147 @@ const De = {
402
402
  confirmText: n.t("button.confirm")
403
403
  }))
404
404
  return !1;
405
- const s = await t.get(p).replaceAll(), { success: a, failure: c } = s;
406
- return c > 0 ? (a === 0 ? i.show({
405
+ const r = await t.get(f).replaceAll(), { success: a, failure: l } = r;
406
+ return l > 0 ? (a === 0 ? i.show({
407
407
  type: N.Error,
408
408
  content: n.t("find-replace.replace.all-failure")
409
409
  }) : i.show({
410
410
  type: N.Warning,
411
- content: n.t("find-replace.replace.partial-success", `${a}`, `${c}`)
411
+ content: n.t("find-replace.replace.partial-success", `${a}`, `${l}`)
412
412
  }), !1) : (i.show({
413
413
  type: N.Success,
414
414
  content: n.t("find-replace.replace.all-success", `${a}`)
415
415
  }), !0);
416
416
  }
417
- }, O = {
417
+ }, x = {
418
418
  id: "ui.operation.open-find-dialog",
419
- type: I.OPERATION,
419
+ type: b.OPERATION,
420
420
  handler: (t) => {
421
- const e = t.get(p);
421
+ const e = t.get(f);
422
422
  return e.revealed ? e.focusFindInput() : e.start(), !0;
423
423
  }
424
- }, ne = {
424
+ }, ie = {
425
425
  id: "ui.operation.open-replace-dialog",
426
- type: I.OPERATION,
426
+ type: b.OPERATION,
427
427
  handler: (t) => {
428
- const e = t.get(p);
428
+ const e = t.get(f);
429
429
  return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
430
430
  }
431
431
  }, Pe = {
432
- type: I.OPERATION,
432
+ type: b.OPERATION,
433
433
  id: "ui.operation.go-to-next-match",
434
- handler: (t) => (t.get(p).moveToNextMatch(), !0)
434
+ handler: (t) => (t.get(f).moveToNextMatch(), !0)
435
435
  }, Te = {
436
- type: I.OPERATION,
436
+ type: b.OPERATION,
437
437
  id: "ui.operation.go-to-previous-match",
438
- handler: (t) => (t.get(p).moveToPreviousMatch(), !0)
439
- }, Oe = {
440
- type: I.OPERATION,
438
+ handler: (t) => (t.get(f).moveToPreviousMatch(), !0)
439
+ }, xe = {
440
+ type: b.OPERATION,
441
441
  id: "ui.operation.focus-selection",
442
- handler: (t) => (t.get(p).focusSelection(), !0)
442
+ handler: (t) => (t.get(f).focusSelection(), !0)
443
443
  };
444
- var f = function() {
445
- return f = Object.assign || function(t) {
446
- for (var e, n = 1, i = arguments.length; n < i; n++) {
447
- e = arguments[n];
448
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
449
- }
450
- return t;
451
- }, f.apply(this, arguments);
452
- }, At = function(t, e) {
453
- var n = {};
454
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
455
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
456
- for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
457
- e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
458
- return n;
459
- }, Ee = k(function(t, e) {
460
- var n = t.icon, i = t.id, r = t.className, s = t.extend, a = At(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = q("_".concat(Ut()));
461
- return Ne(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, f({ ref: e, className: c }, a), s);
462
- });
463
- function Ne(t, e, n, i, r) {
464
- return Re(t.tag, f(f({ key: e }, Lt(t, n, r)), i), (wt(t, n).children || []).map(function(s, a) {
465
- return Ne(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
466
- }));
444
+ function Ee({ ref: t, ...e }) {
445
+ const { icon: n, id: i, className: s, extend: r, ...a } = e, l = `univerjs-icon univerjs-icon-${i} ${s || ""}`.trim(), d = G(`_${Lt()}`);
446
+ return Ne(n, `${i}`, {
447
+ defIds: n.defIds,
448
+ idSuffix: d.current
449
+ }, {
450
+ ref: t,
451
+ className: l,
452
+ ...a
453
+ }, r);
467
454
  }
468
- function Lt(t, e, n) {
469
- var i = f({}, t.attrs);
470
- n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(function(s) {
471
- var a = s[0], c = s[1];
472
- a === "mask" && typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
455
+ function Ne(t, e, n, i, s) {
456
+ return Me(t.tag, {
457
+ key: e,
458
+ ...Ot(t, n, s),
459
+ ...i
460
+ }, (At(t, n).children || []).map((r, a) => Ne(r, `${e}-${t.tag}-${a}`, n, void 0, s)));
461
+ }
462
+ function Ot(t, e, n) {
463
+ const i = { ...t.attrs };
464
+ n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(([r, a]) => {
465
+ r === "mask" && typeof a == "string" && (i[r] = a.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
473
466
  });
474
- var r = e.defIds;
475
- 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) {
476
- var a = s[0], c = s[1];
477
- typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
467
+ const { defIds: s } = e;
468
+ return !s || s.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(([r, a]) => {
469
+ typeof a == "string" && (i[r] = a.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
478
470
  })), i;
479
471
  }
480
- function wt(t, e) {
481
- var n, i = e.defIds;
482
- return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? f(f({}, t), { children: t.children.map(function(r) {
483
- return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ? f(f({}, r), { attrs: f(f({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
484
- }) }) : t;
472
+ function At(t, e) {
473
+ var i;
474
+ const { defIds: n } = e;
475
+ return !n || n.length === 0 ? t : t.tag === "defs" && ((i = t.children) != null && i.length) ? {
476
+ ...t,
477
+ children: t.children.map((s) => typeof s.attrs.id == "string" && n && n.includes(s.attrs.id) ? {
478
+ ...s,
479
+ attrs: {
480
+ ...s.attrs,
481
+ id: s.attrs.id + e.idSuffix
482
+ }
483
+ } : s)
484
+ } : t;
485
485
  }
486
- function Ut() {
486
+ function Lt() {
487
487
  return Math.random().toString(36).substring(2, 8);
488
488
  }
489
489
  Ee.displayName = "UniverIcon";
490
- var Bt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, $e = k(function(t, e) {
491
- return Re(Ee, Object.assign({}, t, {
490
+ const wt = {
491
+ tag: "svg",
492
+ attrs: {
493
+ xmlns: "http://www.w3.org/2000/svg",
494
+ fill: "none",
495
+ viewBox: "0 0 16 16",
496
+ width: "1em",
497
+ height: "1em"
498
+ },
499
+ children: [{
500
+ tag: "path",
501
+ attrs: {
502
+ fill: "currentColor",
503
+ d: "M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z",
504
+ fillRule: "evenodd",
505
+ clipRule: "evenodd"
506
+ }
507
+ }]
508
+ }, $e = X(function(e, n) {
509
+ return Me(Ee, Object.assign({}, e, {
492
510
  id: "search-icon",
493
- ref: e,
494
- icon: Bt
511
+ ref: n,
512
+ icon: wt
495
513
  }));
496
514
  });
497
515
  $e.displayName = "SearchIcon";
498
- function Ae(t) {
516
+ function Oe(t) {
499
517
  const {
500
518
  findCompleted: e,
501
519
  localeService: n,
502
520
  matchesCount: i,
503
- matchesPosition: r,
504
- initialFindString: s,
521
+ matchesPosition: s,
522
+ initialFindString: r,
505
523
  findReplaceService: a,
506
- onChange: c,
524
+ onChange: l,
507
525
  ...d
508
- } = t, [g, _] = Pt(s), y = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
509
- function S(m) {
510
- r === i && m === 1 ? a.moveToNextMatch() : r === 1 && m === i || m < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
526
+ } = t, [_, p] = Pt(r), I = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
527
+ function S(g) {
528
+ s === i && g === 1 ? a.moveToNextMatch() : s === 1 && g === i || g < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
511
529
  }
512
- return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (m) => m.stopPropagation(), children: /* @__PURE__ */ l(
530
+ return /* @__PURE__ */ c("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (g) => g.stopPropagation(), children: /* @__PURE__ */ c(
513
531
  Se,
514
532
  {
515
533
  "data-u-comp": "search-input",
516
534
  autoFocus: !0,
517
535
  placeholder: n.t("find-replace.dialog.find-placeholder"),
518
- value: g,
519
- onChange: (m) => {
520
- _(m), c == null || c(m);
536
+ value: _,
537
+ onChange: (g) => {
538
+ p(g), l == null || l(g);
521
539
  },
522
- slot: /* @__PURE__ */ l(
523
- bt,
540
+ slot: /* @__PURE__ */ c(
541
+ Rt,
524
542
  {
525
543
  loop: !0,
526
- text: y,
527
- value: r,
544
+ text: I,
545
+ value: s,
528
546
  total: i,
529
547
  onChange: S
530
548
  }
@@ -533,286 +551,286 @@ function Ae(t) {
533
551
  }
534
552
  ) });
535
553
  }
536
- function Le(t, e) {
554
+ function Ae(t, e) {
537
555
  const n = u(() => {
538
- var r;
539
- (r = document.querySelector(".univer-find-input input")) == null || r.focus();
556
+ var s;
557
+ (s = document.querySelector(".univer-find-input input")) == null || s.focus();
540
558
  }, []), i = u(() => {
541
- const r = document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");
542
- return Array.from(r).some((s) => s === document.activeElement);
559
+ const s = document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");
560
+ return Array.from(s).some((r) => r === document.activeElement);
543
561
  }, []);
544
- return Tt(e, () => ({ focus: n, selectHasFocus: i })), L(() => {
545
- const r = t.focusSignal$.subscribe(() => n());
546
- return () => r.unsubscribe();
562
+ return Tt(e, () => ({ focus: n, selectHasFocus: i })), A(() => {
563
+ const s = t.focusSignal$.subscribe(() => n());
564
+ return () => s.unsubscribe();
547
565
  }, [t, n]), { focus: n, selectHasFocus: i };
548
566
  }
549
- const Wt = k(function(e, n) {
550
- const i = v(W), r = v(p), s = v(B), a = P(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: g, matchesPosition: _ } = a, R = u(() => {
551
- s.executeCommand(ne.id);
552
- }, [s]), y = _t((S) => r.changeFindString(S), 500);
553
- return Le(r, n), /* @__PURE__ */ F(K, { children: [
554
- /* @__PURE__ */ l(
555
- Ae,
567
+ const Ut = X(function(e, n) {
568
+ const i = m(B), s = m(f), r = m(U), a = P(s.state$, void 0, !0), { findCompleted: l, findString: d, matchesCount: _, matchesPosition: p } = a, M = u(() => {
569
+ r.executeCommand(ie.id);
570
+ }, [r]), I = pt((S) => s.changeFindString(S), 500);
571
+ return Ae(s, n), /* @__PURE__ */ F(H, { children: [
572
+ /* @__PURE__ */ c(
573
+ Oe,
556
574
  {
557
- findCompleted: c,
558
- matchesCount: g,
559
- matchesPosition: _,
560
- findReplaceService: r,
575
+ findCompleted: l,
576
+ matchesCount: _,
577
+ matchesPosition: p,
578
+ findReplaceService: s,
561
579
  localeService: i,
562
580
  initialFindString: d,
563
- onChange: y
581
+ onChange: I
564
582
  }
565
583
  ),
566
- /* @__PURE__ */ l("div", { className: "univer-mt-4 univer-text-center", children: /* @__PURE__ */ l(
584
+ /* @__PURE__ */ c("div", { className: "univer-mt-4 univer-text-center", children: /* @__PURE__ */ c(
567
585
  "a",
568
586
  {
569
587
  className: "hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors",
570
- onClick: R,
588
+ onClick: M,
571
589
  children: i.t("find-replace.dialog.advanced-finding")
572
590
  }
573
591
  ) })
574
592
  ] });
575
- }), kt = k(function(e, n) {
576
- const i = v(p), r = v(W), s = v(B), a = v(me), c = P(i.currentMatch$, void 0, !0), d = P(i.replaceables$, void 0, !0), g = P(i.state$, void 0, !0), {
577
- matchesCount: _,
578
- matchesPosition: R,
579
- findString: y,
593
+ }), Bt = X(function(e, n) {
594
+ const i = m(f), s = m(B), r = m(U), a = m(ge), l = P(i.currentMatch$, void 0, !0), d = P(i.replaceables$, void 0, !0), _ = P(i.state$, void 0, !0), {
595
+ matchesCount: p,
596
+ matchesPosition: M,
597
+ findString: I,
580
598
  inputtingFindString: S,
581
- replaceString: m,
582
- caseSensitive: Be,
583
- matchesTheWholeCell: We,
584
- findDirection: ke,
585
- findScope: je,
586
- findBy: Ve,
587
- findCompleted: j
588
- } = g, Ge = S.length === 0, He = _ === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = u(
599
+ replaceString: g,
600
+ caseSensitive: Ue,
601
+ matchesTheWholeCell: Be,
602
+ findDirection: We,
603
+ findScope: ke,
604
+ findBy: je,
605
+ findCompleted: W
606
+ } = _, Ve = S.length === 0, Ge = p === 0 || !(l != null && l.replaceable), He = d.length === 0, Ke = u(
589
607
  (h) => i.changeInputtingFindString(h),
590
608
  [i]
591
- ), Ze = u(
609
+ ), qe = u(
592
610
  (h) => i.changeReplaceString(h),
593
611
  [i]
594
- ), { focus: ze } = Le(i, n), Ye = u(() => {
595
- y === S ? i.moveToNextMatch() : (i.changeFindString(S), i.find());
596
- }, [y, S, i]), Je = u(() => s.executeCommand(De.id), [s]), Qe = u(async () => {
597
- await s.executeCommand(xe.id), ze();
598
- }, [s]), Xe = u((h) => {
612
+ ), { focus: Ze } = Ae(i, n), ze = u(() => {
613
+ I === S ? i.moveToNextMatch() : (i.changeFindString(S), i.find());
614
+ }, [I, S, i]), Ye = u(() => r.executeCommand(De.id), [r]), Je = u(async () => {
615
+ await r.executeCommand(ye.id), Ze();
616
+ }, [r]), Qe = u((h) => {
599
617
  i.changeFindDirection(h);
600
- }, [i]), et = u((h) => {
618
+ }, [i]), Xe = u((h) => {
601
619
  i.changeFindScope(h);
602
- }, [i]), tt = u((h) => {
620
+ }, [i]), et = u((h) => {
603
621
  i.changeFindBy(h);
604
- }, [i]), it = Vt(r), nt = Gt(r), rt = Ht(r);
605
- return L(() => {
606
- j && _ === 0 && a.show({
607
- content: r.t("find-replace.dialog.no-match"),
622
+ }, [i]), tt = kt(s), it = jt(s), nt = Vt(s);
623
+ return A(() => {
624
+ W && p === 0 && a.show({
625
+ content: s.t("find-replace.dialog.no-match"),
608
626
  type: N.Warning,
609
627
  duration: 5e3
610
628
  });
611
- }, [j, _, a, r]), /* @__PURE__ */ F("div", { children: [
612
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
613
- Ae,
629
+ }, [W, p, a, s]), /* @__PURE__ */ F("div", { children: [
630
+ /* @__PURE__ */ c(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ c(
631
+ Oe,
614
632
  {
615
- findCompleted: j,
633
+ findCompleted: W,
616
634
  className: "univer-find-input",
617
- matchesCount: _,
618
- matchesPosition: R,
635
+ matchesCount: p,
636
+ matchesPosition: M,
619
637
  findReplaceService: i,
620
- localeService: r,
638
+ localeService: s,
621
639
  initialFindString: S,
622
- onChange: qe
640
+ onChange: Ke
623
641
  }
624
642
  ) }),
625
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
643
+ /* @__PURE__ */ c(R, { label: s.t("find-replace.dialog.replace"), children: /* @__PURE__ */ c(
626
644
  Se,
627
645
  {
628
- placeholder: r.t("find-replace.dialog.replace-placeholder"),
629
- value: m,
630
- onChange: (h) => Ze(h)
646
+ placeholder: s.t("find-replace.dialog.replace-placeholder"),
647
+ value: g,
648
+ onChange: (h) => qe(h)
631
649
  }
632
650
  ) }),
633
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(V, { value: ke, options: nt, onChange: Xe }) }),
634
- /* @__PURE__ */ l(ae, { children: /* @__PURE__ */ F(K, { children: [
635
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(V, { value: je, options: it, onChange: et }) }),
636
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(V, { value: Ve, options: rt, onChange: tt }) })
651
+ /* @__PURE__ */ c(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ c(k, { value: We, options: it, onChange: Qe }) }),
652
+ /* @__PURE__ */ c(re, { children: /* @__PURE__ */ F(H, { children: [
653
+ /* @__PURE__ */ c(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ c(k, { value: ke, options: tt, onChange: Xe }) }),
654
+ /* @__PURE__ */ c(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ c(k, { value: je, options: nt, onChange: et }) })
637
655
  ] }) }),
638
- /* @__PURE__ */ l(ae, { children: /* @__PURE__ */ F(K, { children: [
639
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
640
- oe,
656
+ /* @__PURE__ */ c(re, { children: /* @__PURE__ */ F(H, { children: [
657
+ /* @__PURE__ */ c(R, { children: /* @__PURE__ */ c(
658
+ ae,
641
659
  {
642
- checked: Be,
660
+ checked: Ue,
643
661
  onChange: (h) => {
644
662
  i.changeCaseSensitive(h);
645
663
  },
646
- children: r.t("find-replace.dialog.case-sensitive")
664
+ children: s.t("find-replace.dialog.case-sensitive")
647
665
  }
648
666
  ) }),
649
- /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
650
- oe,
667
+ /* @__PURE__ */ c(R, { children: /* @__PURE__ */ c(
668
+ ae,
651
669
  {
652
- checked: We,
670
+ checked: Be,
653
671
  onChange: (h) => {
654
672
  i.changeMatchesTheWholeCell(h);
655
673
  },
656
- children: r.t("find-replace.dialog.match-the-whole-cell")
674
+ children: s.t("find-replace.dialog.match-the-whole-cell")
657
675
  }
658
676
  ) })
659
677
  ] }) }),
660
678
  /* @__PURE__ */ F("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
661
- /* @__PURE__ */ l(G, { variant: "primary", onClick: Ye, disabled: Ge, children: r.t("find-replace.dialog.find") }),
679
+ /* @__PURE__ */ c(j, { variant: "primary", onClick: ze, disabled: Ve, children: s.t("find-replace.dialog.find") }),
662
680
  /* @__PURE__ */ F("span", { className: "univer-inline-flex univer-gap-2", children: [
663
- /* @__PURE__ */ l(G, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace") }),
664
- /* @__PURE__ */ l(G, { disabled: Ke, onClick: Qe, children: r.t("find-replace.dialog.replace-all") })
681
+ /* @__PURE__ */ c(j, { disabled: Ge, onClick: Ye, children: s.t("find-replace.dialog.replace") }),
682
+ /* @__PURE__ */ c(j, { disabled: He, onClick: Je, children: s.t("find-replace.dialog.replace-all") })
665
683
  ] })
666
684
  ] })
667
685
  ] });
668
686
  });
669
- function jt() {
670
- const t = v(p), e = v(ve), n = v(X), i = P(t.state$, void 0, !0), r = q(null);
671
- L(() => {
687
+ function Wt() {
688
+ const t = m(f), e = m(me), n = m(J), i = P(t.state$, void 0, !0), s = G(null);
689
+ A(() => {
672
690
  let d;
673
- return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
691
+ return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
674
692
  }, [e]);
675
- const s = q(null), a = u(
676
- (d) => n.setContextValue(Ie, d),
677
- [n]
678
- ), c = u(
693
+ const r = G(null), a = u(
679
694
  (d) => n.setContextValue(be, d),
680
695
  [n]
696
+ ), l = u(
697
+ (d) => n.setContextValue(Re, d),
698
+ [n]
681
699
  );
682
- return L(() => {
683
- var g;
684
- const d = Dt(document, "focusin").subscribe((_) => {
685
- var R;
686
- _.target && ((R = r.current) != null && R.contains(_.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!1) : c(!0);
700
+ return A(() => {
701
+ var _;
702
+ const d = Dt(document, "focusin").subscribe((p) => {
703
+ var M;
704
+ p.target && ((M = s.current) != null && M.contains(p.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? l(!1) : l(!0);
687
705
  });
688
- return (g = s.current) == null || g.focus(), a(!0), c(!0), () => {
706
+ return (_ = r.current) == null || _.focus(), a(!0), l(!0), () => {
689
707
  d.unsubscribe(), a(!1);
690
708
  };
691
- }, [a, c]), /* @__PURE__ */ l("div", { ref: r, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ l(kt, { ref: s }) : /* @__PURE__ */ l(Wt, { ref: s }) });
709
+ }, [a, l]), /* @__PURE__ */ c("div", { ref: s, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ c(Bt, { ref: r }) : /* @__PURE__ */ c(Ut, { ref: r }) });
692
710
  }
693
- function Vt(t) {
711
+ function kt(t) {
694
712
  const e = t.getCurrentLocale();
695
- return te(() => [
696
- { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: J.SUBUNIT },
697
- { label: t.t("find-replace.dialog.find-scope.workbook"), value: J.UNIT }
713
+ return ee(() => [
714
+ { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: z.SUBUNIT },
715
+ { label: t.t("find-replace.dialog.find-scope.workbook"), value: z.UNIT }
698
716
  ], [e]);
699
717
  }
700
- function Gt(t) {
718
+ function jt(t) {
701
719
  const e = t.getCurrentLocale();
702
- return te(() => [
703
- { label: t.t("find-replace.dialog.find-direction.row"), value: z.ROW },
704
- { label: t.t("find-replace.dialog.find-direction.column"), value: z.COLUMN }
720
+ return ee(() => [
721
+ { label: t.t("find-replace.dialog.find-direction.row"), value: q.ROW },
722
+ { label: t.t("find-replace.dialog.find-direction.column"), value: q.COLUMN }
705
723
  ], [e]);
706
724
  }
707
- function Ht(t) {
725
+ function Vt(t) {
708
726
  const e = t.getCurrentLocale();
709
- return te(() => [
710
- { label: t.t("find-replace.dialog.find-by.value"), value: Y.VALUE },
711
- { label: t.t("find-replace.dialog.find-by.formula"), value: Y.FORMULA }
727
+ return ee(() => [
728
+ { label: t.t("find-replace.dialog.find-by.value"), value: Z.VALUE },
729
+ { label: t.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
712
730
  ], [e]);
713
731
  }
714
- function x(t) {
715
- return t.getContextValue(Ie);
732
+ function y(t) {
733
+ return t.getContextValue(be);
716
734
  }
717
- function Kt(t) {
718
- return t.getContextValue(ye);
735
+ function Gt(t) {
736
+ return t.getContextValue(Ie);
719
737
  }
720
- function we(t) {
721
- return t.getContextValue(be);
738
+ function Le(t) {
739
+ return t.getContextValue(Re);
722
740
  }
723
741
  const E = "7_find-replace-shortcuts";
724
- function re(t) {
725
- return t.getContextValue(_e);
742
+ function ne(t) {
743
+ return t.getContextValue(pe);
726
744
  }
727
745
  function se(t) {
728
- return !t.getContextValue(ge);
746
+ return !t.getContextValue(_e);
729
747
  }
730
- const qt = {
731
- id: O.id,
748
+ const Ht = {
749
+ id: x.id,
732
750
  description: "find-replace.shortcut.open-find-dialog",
733
- binding: M.F | D.CTRL_COMMAND,
751
+ binding: C.F | D.CTRL_COMMAND,
734
752
  group: E,
735
753
  preconditions(t) {
736
- return !x(t) && re(t) && se(t);
754
+ return !y(t) && ne(t) && se(t);
737
755
  }
738
- }, Zt = {
739
- id: O.id,
756
+ }, Kt = {
757
+ id: x.id,
740
758
  description: "find-replace.shortcut.open-find-dialog",
741
- binding: M.F | D.CTRL_COMMAND,
742
- mac: M.F | D.MAC_CTRL,
759
+ binding: C.F | D.CTRL_COMMAND,
760
+ mac: C.F | D.MAC_CTRL,
743
761
  preconditions(t) {
744
- return !x(t) && re(t) && se(t);
762
+ return !y(t) && ne(t) && se(t);
745
763
  }
746
- }, zt = {
747
- id: ne.id,
764
+ }, qt = {
765
+ id: ie.id,
748
766
  description: "find-replace.shortcut.open-replace-dialog",
749
- binding: M.H | D.CTRL_COMMAND,
750
- mac: M.H | D.MAC_CTRL,
767
+ binding: C.H | D.CTRL_COMMAND,
768
+ mac: C.H | D.MAC_CTRL,
751
769
  group: E,
752
770
  preconditions(t) {
753
- return re(t) && se(t) && (!x(t) || !Kt(t));
771
+ return ne(t) && se(t) && (!y(t) || !Gt(t));
754
772
  }
755
- }, Yt = {
773
+ }, Zt = {
756
774
  id: Pe.id,
757
775
  description: "find-replace.shortcut.go-to-next-match",
758
- binding: M.ENTER,
776
+ binding: C.ENTER,
759
777
  group: E,
760
778
  priority: 1e3,
761
779
  preconditions(t) {
762
- return we(t) && x(t);
780
+ return Le(t) && y(t);
763
781
  }
764
- }, Jt = {
782
+ }, zt = {
765
783
  id: Te.id,
766
784
  description: "find-replace.shortcut.go-to-previous-match",
767
- binding: M.ENTER | D.SHIFT,
785
+ binding: C.ENTER | D.SHIFT,
768
786
  group: E,
769
787
  priority: 1e3,
770
788
  preconditions(t) {
771
- return we(t) && x(t);
789
+ return Le(t) && y(t);
772
790
  }
773
- }, Qt = {
774
- id: Oe.id,
791
+ }, Yt = {
792
+ id: xe.id,
775
793
  description: "find-replace.shortcut.focus-selection",
776
- binding: M.ESC,
794
+ binding: C.ESC,
777
795
  group: E,
778
796
  priority: 1e3,
779
797
  preconditions(t) {
780
- return x(t);
798
+ return y(t);
781
799
  }
782
800
  };
783
- function Xt(t) {
784
- const e = t.get(X);
801
+ function Jt(t) {
802
+ const e = t.get(J);
785
803
  return {
786
- id: O.id,
804
+ id: x.id,
787
805
  icon: "SearchIcon",
788
806
  tooltip: "find-replace.toolbar",
789
- type: mt.BUTTON,
790
- hidden$: gt(t, lt.UNIVER_SHEET),
791
- disabled$: Ce([
792
- e.subscribeContextValue$(ge),
793
- e.subscribeContextValue$(_e)
794
- ]).pipe(xt(([n, i]) => n || !i))
807
+ type: gt.BUTTON,
808
+ hidden$: _t(t, ct.UNIVER_SHEET),
809
+ disabled$: ve([
810
+ e.subscribeContextValue$(_e),
811
+ e.subscribeContextValue$(pe)
812
+ ]).pipe(yt(([n, i]) => n || !i))
795
813
  };
796
814
  }
797
- const ei = {
798
- [vt.ORGANIZATION]: {
799
- [O.id]: {
815
+ const Qt = {
816
+ [mt.ORGANIZATION]: {
817
+ [x.id]: {
800
818
  order: 2,
801
- menuItemFactory: Xt
819
+ menuItemFactory: Jt
802
820
  }
803
821
  }
804
822
  };
805
- var ti = Object.getOwnPropertyDescriptor, ii = (t, e, n, i) => {
806
- for (var r = i > 1 ? void 0 : i ? ti(e, n) : e, s = t.length - 1, a; s >= 0; s--)
807
- (a = t[s]) && (r = a(r) || r);
808
- return r;
809
- }, C = (t, e) => (n, i) => e(n, i, t);
810
- const le = "DESKTOP_FIND_REPLACE_DIALOG", Ue = 350, ni = 20, ri = 64;
811
- let U = class extends dt {
812
- constructor(e, n, i, r, s, a, c, d, g) {
823
+ var Xt = Object.getOwnPropertyDescriptor, ei = (t, e, n, i) => {
824
+ for (var s = i > 1 ? void 0 : i ? Xt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
825
+ (a = t[r]) && (s = a(s) || s);
826
+ return s;
827
+ }, v = (t, e) => (n, i) => e(n, i, t);
828
+ const ce = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, ti = 20, ii = 64;
829
+ let w = class extends lt {
830
+ constructor(e, n, i, s, r, a, l, d, _) {
813
831
  super();
814
832
  o(this, "_closingListenerDisposable");
815
- this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = c, this._localeService = d, this._componentManager = g, this._initCommands(), this._initUI(), this._initShortcuts();
833
+ this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = l, this._localeService = d, this._componentManager = _, this._initCommands(), this._initUI(), this._initShortcuts();
816
834
  }
817
835
  dispose() {
818
836
  var e;
@@ -820,122 +838,122 @@ let U = class extends dt {
820
838
  }
821
839
  _initCommands() {
822
840
  [
823
- O,
824
- ne,
841
+ x,
842
+ ie,
825
843
  Pe,
826
844
  Te,
827
- xe,
845
+ ye,
828
846
  De,
829
- Oe
847
+ xe
830
848
  ].forEach((e) => {
831
849
  this.disposeWithMe(this._commandService.registerCommand(e));
832
850
  });
833
851
  }
834
852
  _initShortcuts() {
835
853
  [
836
- zt,
837
854
  qt,
855
+ Ht,
856
+ Kt,
857
+ zt,
838
858
  Zt,
839
- Jt,
840
- Yt,
841
- Qt
859
+ Yt
842
860
  ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
843
861
  }
844
862
  _initUI() {
845
863
  [
846
- ["FindReplaceDialog", jt],
864
+ ["FindReplaceDialog", Wt],
847
865
  ["SearchIcon", $e]
848
866
  ].forEach(([e, n]) => {
849
867
  this.disposeWithMe(
850
868
  this._componentManager.register(e, n)
851
869
  );
852
- }), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
870
+ }), this._menuManagerService.mergeMenu(Qt), this._findReplaceService.stateUpdates$.pipe(oe(this.dispose$)).subscribe((e) => {
853
871
  e.revealed === !0 && this._openPanel();
854
872
  });
855
873
  }
856
874
  _openPanel() {
857
875
  this._dialogService.open({
858
- id: le,
876
+ id: ce,
859
877
  draggable: !0,
860
- width: Ue,
878
+ width: we,
861
879
  title: { title: this._localeService.t("find-replace.dialog.title") },
862
880
  children: { label: "FindReplaceDialog" },
863
881
  destroyOnClose: !0,
864
882
  mask: !1,
865
883
  maskClosable: !1,
866
- defaultPosition: si(),
884
+ defaultPosition: ni(),
867
885
  preservePositionOnDestroy: !0,
868
886
  onClose: () => this.closePanel()
869
- }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
887
+ }), this._closingListenerDisposable = O(this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((e) => {
870
888
  (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
871
889
  }));
872
890
  }
873
891
  closePanel() {
874
- this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(le), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
892
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(ce), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
875
893
  }
876
894
  };
877
- U = ii([
878
- C(0, pe),
879
- C(1, St),
880
- C(2, Ct),
881
- C(3, B),
882
- C(4, p),
883
- C(5, Mt),
884
- C(6, ve),
885
- C(7, $(W)),
886
- C(8, $(Rt))
887
- ], U);
888
- function si() {
895
+ w = ei([
896
+ v(0, fe),
897
+ v(1, St),
898
+ v(2, vt),
899
+ v(3, U),
900
+ v(4, f),
901
+ v(5, Ct),
902
+ v(6, me),
903
+ v(7, $(B)),
904
+ v(8, $(Mt))
905
+ ], w);
906
+ function ni() {
889
907
  const { innerWidth: t } = window;
890
- return { x: t - Ue - ni, y: ri };
908
+ return { x: t - we - ti, y: ii };
891
909
  }
892
- const ai = "find-replace.config", de = {};
893
- var oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
894
- for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
895
- (a = t[s]) && (r = a(r) || r);
896
- return r;
897
- }, he = (t, e) => (n, i) => e(n, i, t);
898
- const li = "UNIVER_FIND_REPLACE_PLUGIN";
899
- var H;
900
- let ue = (H = class extends ut {
901
- constructor(t = de, e, n) {
910
+ const si = "find-replace.config", le = {};
911
+ var ri = Object.getOwnPropertyDescriptor, ai = (t, e, n, i) => {
912
+ for (var s = i > 1 ? void 0 : i ? ri(e, n) : e, r = t.length - 1, a; r >= 0; r--)
913
+ (a = t[r]) && (s = a(s) || s);
914
+ return s;
915
+ }, de = (t, e) => (n, i) => e(n, i, t);
916
+ const oi = "UNIVER_FIND_REPLACE_PLUGIN";
917
+ var V;
918
+ let he = (V = class extends ht {
919
+ constructor(t = le, e, n) {
902
920
  super(), this._config = t, this._injector = e, this._configService = n;
903
- const { ...i } = ft(
921
+ const { ...i } = ut(
904
922
  {},
905
- de,
923
+ le,
906
924
  this._config
907
925
  );
908
- this._configService.setConfig(ai, i);
926
+ this._configService.setConfig(si, i);
909
927
  }
910
928
  onStarting() {
911
929
  [
912
- [U],
913
- [p, { useClass: Q }]
930
+ [w],
931
+ [f, { useClass: Y }]
914
932
  ].forEach((t) => this._injector.add(t));
915
933
  }
916
934
  onRendered() {
917
- this._injector.get(U);
935
+ this._injector.get(w);
918
936
  }
919
- }, o(H, "pluginName", li), H);
920
- ue = ci([
921
- he(1, $(fe)),
922
- he(2, ht)
923
- ], ue);
937
+ }, o(V, "pluginName", oi), V);
938
+ he = ai([
939
+ de(1, $(ue)),
940
+ de(2, dt)
941
+ ], he);
924
942
  export {
925
- Y as FindBy,
926
- z as FindDirection,
927
- vi as FindModel,
928
- U as FindReplaceController,
929
- Z as FindReplaceModel,
943
+ Z as FindBy,
944
+ q as FindDirection,
945
+ gi as FindModel,
946
+ w as FindReplaceController,
947
+ K as FindReplaceModel,
930
948
  Nt as FindReplaceState,
931
- J as FindScope,
949
+ z as FindScope,
932
950
  Pe as GoToNextMatchOperation,
933
951
  Te as GoToPreviousMatchOperation,
934
- p as IFindReplaceService,
935
- O as OpenFindDialogOperation,
936
- ne as OpenReplaceDialogOperation,
937
- xe as ReplaceAllMatchesCommand,
952
+ f as IFindReplaceService,
953
+ x as OpenFindDialogOperation,
954
+ ie as OpenReplaceDialogOperation,
955
+ ye as ReplaceAllMatchesCommand,
938
956
  De as ReplaceCurrentMatchCommand,
939
- ue as UniverFindReplacePlugin,
940
- ie as createInitFindReplaceState
957
+ he as UniverFindReplacePlugin,
958
+ te as createInitFindReplaceState
941
959
  };