@univerjs/find-replace 0.8.0-nightly.202505281606 → 0.8.0-nightly.202505301607

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/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  var st = Object.defineProperty;
2
2
  var at = (t, e, n) => e in t ? st(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var o = (t, e, n) => at(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { createIdentifier as ot, Inject as D, Injector as Q, IContextService as X, Disposable as ee, DisposableCollection as ct, toDisposable as $, IUniverInstanceService as fe, ICommandService as U, CommandType as b, LocaleService as B, FOCUSING_SHEET as pe, EDITOR_ACTIVATED as _e, 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 ge, useDependency as v, useObservable as x, ILayoutService as me, KeyCode as C, MetaKeys as y, getMenuHiddenObservable as _t, MenuItemType as gt, RibbonDataGroup as mt, IMenuManagerService as vt, IShortcutService as St, IDialogService as Ct, ComponentManager as Mt } from "@univerjs/ui";
6
- import { throttleTime as Rt, BehaviorSubject as P, combineLatest as ve, debounceTime as bt, Subject as Se, fromEvent as It, map as yt, takeUntil as ae } from "rxjs";
7
- import { MessageType as N, Input as Ce, Pager as Ft, FormLayout as R, Select as j, FormDualColumnLayout as oe, Checkbox as ce, Button as G } from "@univerjs/design";
8
- import { RENDER_RAW_FORMULA_KEY as Dt } from "@univerjs/engine-render";
9
- import { jsx as l, jsxs as I, Fragment as H } from "react/jsx-runtime";
10
- import { forwardRef as W, useRef as K, createElement as Me, useCallback as f, useEffect as A, useMemo as te, useImperativeHandle as xt } from "react";
11
- const Pt = "find-replace.config", le = {};
4
+ import { createIdentifier as ot, Inject as x, Injector as Q, IContextService as X, Disposable as ee, DisposableCollection as ct, toDisposable as $, IUniverInstanceService as fe, ICommandService as U, CommandType as b, LocaleService as B, FOCUSING_SHEET as pe, EDITOR_ACTIVATED as _e, 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 ge, useDependency as S, useObservable as P, useDebounceFn as _t, ILayoutService as me, KeyCode as C, MetaKeys as F, 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 { throttleTime as bt, BehaviorSubject as T, combineLatest as ve, debounceTime as It, Subject as Se, fromEvent as yt, map as Ft, takeUntil as ae } from "rxjs";
7
+ import { MessageType as N, Input as Ce, Pager as Dt, FormLayout as R, Select as j, FormDualColumnLayout as oe, Checkbox as ce, Button as V } from "@univerjs/design";
8
+ import { RENDER_RAW_FORMULA_KEY as xt } from "@univerjs/engine-render";
9
+ import { jsx as l, jsxs as y, Fragment as H } from "react/jsx-runtime";
10
+ import { forwardRef as W, useRef as K, createElement as Me, useState as Pt, useCallback as p, useEffect as A, useMemo as te, useImperativeHandle as Tt } from "react";
11
+ const Ot = "find-replace.config", le = {};
12
12
  var _ = function() {
13
13
  return _ = Object.assign || function(t) {
14
14
  for (var e, n = 1, i = arguments.length; n < i; n++) {
@@ -17,7 +17,7 @@ var _ = function() {
17
17
  }
18
18
  return t;
19
19
  }, _.apply(this, arguments);
20
- }, Tt = function(t, e) {
20
+ }, Et = function(t, e) {
21
21
  var n = {};
22
22
  for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
23
23
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
@@ -25,15 +25,15 @@ var _ = function() {
25
25
  e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
26
26
  return n;
27
27
  }, Re = W(function(t, e) {
28
- var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Tt(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = K("_".concat(Nt()));
28
+ var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Et(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = K("_".concat(At()));
29
29
  return be(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: c }, a), s);
30
30
  });
31
31
  function be(t, e, n, i, r) {
32
- return Me(t.tag, _(_({ key: e }, Ot(t, n, r)), i), (Et(t, n).children || []).map(function(s, a) {
32
+ return Me(t.tag, _(_({ key: e }, Nt(t, n, r)), i), ($t(t, n).children || []).map(function(s, a) {
33
33
  return be(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
34
34
  }));
35
35
  }
36
- function Ot(t, e, n) {
36
+ function Nt(t, e, n) {
37
37
  var i = _({}, t.attrs);
38
38
  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) {
39
39
  var a = s[0], c = s[1];
@@ -45,41 +45,41 @@ function Ot(t, e, n) {
45
45
  typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
46
46
  })), i;
47
47
  }
48
- function Et(t, e) {
48
+ function $t(t, e) {
49
49
  var n, i = e.defIds;
50
50
  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) {
51
51
  return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
52
52
  }) }) : t;
53
53
  }
54
- function Nt() {
54
+ function At() {
55
55
  return Math.random().toString(36).substring(2, 8);
56
56
  }
57
57
  Re.displayName = "UniverIcon";
58
- var $t = { 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" } }] }, Ie = W(function(t, e) {
58
+ var Lt = { 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" } }] }, Ie = W(function(t, e) {
59
59
  return Me(Re, Object.assign({}, t, {
60
60
  id: "search-icon",
61
61
  ref: e,
62
- icon: $t
62
+ icon: Lt
63
63
  }));
64
64
  });
65
65
  Ie.displayName = "SearchIcon";
66
66
  const ye = "FIND_REPLACE_INPUT_FOCUS", Fe = "FIND_REPLACE_DIALOG_FOCUS", De = "FIND_REPLACE_REPLACE_REVEALED";
67
- var At = Object.getOwnPropertyDescriptor, xe = (t, e, n, i) => {
68
- for (var r = i > 1 ? void 0 : i ? At(e, n) : e, s = t.length - 1, a; s >= 0; s--)
67
+ var wt = Object.getOwnPropertyDescriptor, xe = (t, e, n, i) => {
68
+ for (var r = i > 1 ? void 0 : i ? wt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
69
69
  (a = t[s]) && (r = a(r) || r);
70
70
  return r;
71
71
  }, L = (t, e) => (n, i) => e(n, i, t);
72
- class gi extends ee {
72
+ class vi extends ee {
73
73
  }
74
74
  const g = ot("find-replace.service");
75
- function Lt(t) {
75
+ function Ut(t) {
76
76
  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";
77
77
  }
78
78
  let q = class extends ee {
79
79
  constructor(e, n, i, r) {
80
80
  super();
81
- o(this, "currentMatch$", new P(null));
82
- o(this, "replaceables$", new P([]));
81
+ o(this, "currentMatch$", new T(null));
82
+ o(this, "replaceables$", new T([]));
83
83
  /** All find models returned by providers. */
84
84
  o(this, "_findModels", []);
85
85
  /** The find model that the current match is from. */
@@ -87,9 +87,9 @@ let q = class extends ee {
87
87
  o(this, "_matches", []);
88
88
  o(this, "_currentSearchingDisposables", null);
89
89
  this._state = e, this._providers = n, this._univerInstanceService = i, this._commandService = r, this.disposeWithMe(
90
- this._state.stateUpdates$.pipe(Rt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
90
+ this._state.stateUpdates$.pipe(bt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
91
91
  const a = this._state.state;
92
- Lt(s) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
92
+ Ut(s) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
93
93
  })
94
94
  );
95
95
  }
@@ -137,7 +137,7 @@ let q = class extends ee {
137
137
  }
138
138
  // When a document's content changes, we should reset all matches and try to move to the next match.
139
139
  _subscribeToModelsChanges(e) {
140
- const n = this._currentSearchingDisposables = new ct(), i = ve(e.map((r) => r.matchesUpdate$)).pipe(bt(220)).subscribe(([...r]) => {
140
+ const n = this._currentSearchingDisposables = new ct(), i = ve(e.map((r) => r.matchesUpdate$)).pipe(It(220)).subscribe(([...r]) => {
141
141
  const s = this._matches = r.flat();
142
142
  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([]));
143
143
  });
@@ -240,11 +240,11 @@ function ie() {
240
240
  revealed: !0
241
241
  };
242
242
  }
243
- class wt {
243
+ class Bt {
244
244
  constructor() {
245
245
  o(this, "_stateUpdates$", new Se());
246
246
  o(this, "stateUpdates$", this._stateUpdates$.asObservable());
247
- o(this, "_state$", new P(ie()));
247
+ o(this, "_state$", new T(ie()));
248
248
  o(this, "state$", this._state$.asObservable());
249
249
  o(this, "_findString", "");
250
250
  o(this, "_inputtingFindString", "");
@@ -326,11 +326,11 @@ let J = class extends ee {
326
326
  constructor(e, n) {
327
327
  super();
328
328
  o(this, "_providers", /* @__PURE__ */ new Set());
329
- o(this, "_state", new wt());
329
+ o(this, "_state", new Bt());
330
330
  o(this, "_model");
331
- o(this, "_currentMatch$", new P(null));
331
+ o(this, "_currentMatch$", new T(null));
332
332
  o(this, "currentMatch$", this._currentMatch$.asObservable());
333
- o(this, "_replaceables$", new P([]));
333
+ o(this, "_replaceables$", new T([]));
334
334
  o(this, "replaceables$", this._replaceables$.asObservable());
335
335
  o(this, "_focusSignal$", new Se());
336
336
  o(this, "focusSignal$", this._focusSignal$.asObservable());
@@ -434,24 +434,24 @@ let J = class extends ee {
434
434
  this._contextService.setContextValue(De, e);
435
435
  }
436
436
  _toggleDisplayRawFormula(e) {
437
- this._contextService.setContextValue(Dt, e);
437
+ this._contextService.setContextValue(xt, e);
438
438
  }
439
439
  };
440
440
  J = xe([
441
- L(0, D(Q)),
441
+ L(0, x(Q)),
442
442
  L(1, X)
443
443
  ], J);
444
444
  const Pe = {
445
445
  id: "ui.command.replace-current-match",
446
446
  type: b.COMMAND,
447
447
  handler: (t) => t.get(g).replace()
448
- }, Ut = "CONFIRM_REPLACE_ALL", Te = {
448
+ }, Wt = "CONFIRM_REPLACE_ALL", Te = {
449
449
  id: "ui.command.replace-all-matches",
450
450
  type: b.COMMAND,
451
451
  handler: async (t) => {
452
452
  const e = t.get(pt), n = t.get(B), i = t.get(ge);
453
453
  if (!await e.confirm({
454
- id: Ut,
454
+ id: Wt,
455
455
  title: { title: n.t("find-replace.replace.confirm.title") },
456
456
  cancelText: n.t("button.cancel"),
457
457
  confirmText: n.t("button.confirm")
@@ -469,7 +469,7 @@ const Pe = {
469
469
  content: n.t("find-replace.replace.all-success", `${a}`)
470
470
  }), !0);
471
471
  }
472
- }, T = {
472
+ }, O = {
473
473
  id: "ui.operation.open-find-dialog",
474
474
  type: b.OPERATION,
475
475
  handler: (t) => {
@@ -497,24 +497,26 @@ const Pe = {
497
497
  handler: (t) => (t.get(g).focusSelection(), !0)
498
498
  };
499
499
  function $e(t) {
500
- const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: c, ...d } = t, p = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
501
- return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (u) => u.stopPropagation(), children: /* @__PURE__ */ l(
500
+ const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, initialFindString: s, findReplaceService: a, onChange: c, ...d } = t, [m, f] = Pt(s), I = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
501
+ return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (h) => h.stopPropagation(), children: /* @__PURE__ */ l(
502
502
  Ce,
503
503
  {
504
504
  "data-u-comp": "search-input",
505
505
  autoFocus: !0,
506
506
  placeholder: n.t("find-replace.dialog.find-placeholder"),
507
- value: s,
508
- onChange: (u) => c == null ? void 0 : c(u),
507
+ value: m,
508
+ onChange: (h) => {
509
+ f(h), c == null || c(h);
510
+ },
509
511
  slot: /* @__PURE__ */ l(
510
- Ft,
512
+ Dt,
511
513
  {
512
514
  loop: !0,
513
- text: p,
515
+ text: I,
514
516
  value: r,
515
517
  total: i,
516
- onChange: (u) => {
517
- r === i && u === 1 ? a.moveToNextMatch() : r === 1 && u === i || u < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
518
+ onChange: (h) => {
519
+ r === i && h === 1 ? a.moveToNextMatch() : r === 1 && h === i || h < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
518
520
  }
519
521
  }
520
522
  ),
@@ -523,92 +525,92 @@ function $e(t) {
523
525
  ) });
524
526
  }
525
527
  function Ae(t, e) {
526
- const n = f(() => {
528
+ const n = p(() => {
527
529
  var r;
528
530
  (r = document.querySelector(".univer-find-input input")) == null || r.focus();
529
- }, []), i = f(() => {
531
+ }, []), i = p(() => {
530
532
  const r = document.querySelectorAll("[data-u-comp=find-replace-dialog] [data-u-comp=search-input]");
531
533
  return Array.from(r).some((s) => s === document.activeElement);
532
534
  }, []);
533
- return xt(e, () => ({ focus: n, selectHasFocus: i })), A(() => {
535
+ return Tt(e, () => ({ focus: n, selectHasFocus: i })), A(() => {
534
536
  const r = t.focusSignal$.subscribe(() => n());
535
537
  return () => r.unsubscribe();
536
538
  }, [t, n]), { focus: n, selectHasFocus: i };
537
539
  }
538
- const Bt = W(function(e, n) {
539
- const i = v(B), r = v(g), s = v(U), a = x(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: S, matchesPosition: p } = a, u = f(() => {
540
+ const kt = W(function(e, n) {
541
+ const i = S(B), r = S(g), s = S(U), a = P(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: m, matchesPosition: f } = a, M = p(() => {
540
542
  s.executeCommand(ne.id);
541
- }, [s]), E = f((M) => r.changeFindString(M), [r]);
542
- return Ae(r, n), /* @__PURE__ */ I(H, { children: [
543
+ }, [s]), I = _t((h) => r.changeFindString(h), 500);
544
+ return Ae(r, n), /* @__PURE__ */ y(H, { children: [
543
545
  /* @__PURE__ */ l(
544
546
  $e,
545
547
  {
546
548
  findCompleted: c,
547
549
  className: "univer-find-input",
548
- matchesCount: S,
549
- matchesPosition: p,
550
+ matchesCount: m,
551
+ matchesPosition: f,
550
552
  findReplaceService: r,
551
553
  localeService: i,
552
- findString: d,
553
- onChange: E
554
+ initialFindString: d,
555
+ onChange: I
554
556
  }
555
557
  ),
556
558
  /* @__PURE__ */ l("div", { className: "univer-mt-4 univer-text-center", children: /* @__PURE__ */ l(
557
559
  "a",
558
560
  {
559
561
  className: "univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors hover:univer-text-primary-500/80",
560
- onClick: u,
562
+ onClick: M,
561
563
  children: i.t("find-replace.dialog.advanced-finding")
562
564
  }
563
565
  ) })
564
566
  ] });
565
- }), Wt = W(function(e, n) {
566
- const i = v(g), r = v(B), s = v(U), a = v(ge), c = x(i.currentMatch$, void 0, !0), d = x(i.replaceables$, void 0, !0), S = x(i.state$, void 0, !0), {
567
- matchesCount: p,
568
- matchesPosition: u,
569
- findString: E,
570
- inputtingFindString: M,
567
+ }), jt = W(function(e, n) {
568
+ const i = S(g), r = S(B), s = S(U), a = S(ge), c = P(i.currentMatch$, void 0, !0), d = P(i.replaceables$, void 0, !0), m = P(i.state$, void 0, !0), {
569
+ matchesCount: f,
570
+ matchesPosition: M,
571
+ findString: I,
572
+ inputtingFindString: h,
571
573
  replaceString: Ue,
572
574
  caseSensitive: Be,
573
575
  matchesTheWholeCell: We,
574
576
  findDirection: ke,
575
577
  findScope: je,
576
- findBy: Ge,
578
+ findBy: Ve,
577
579
  findCompleted: k
578
- } = S, Ve = M.length === 0, He = p === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = f(
579
- (h) => i.changeInputtingFindString(h),
580
+ } = m, Ge = h.length === 0, He = f === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = p(
581
+ (u) => i.changeInputtingFindString(u),
580
582
  [i]
581
- ), Ze = f(
582
- (h) => i.changeReplaceString(h),
583
+ ), Ze = p(
584
+ (u) => i.changeReplaceString(u),
583
585
  [i]
584
- ), { focus: ze } = Ae(i, n), Ye = f(() => {
585
- E === M ? i.moveToNextMatch() : (i.changeFindString(M), i.find());
586
- }, [E, M, i]), Je = f(() => s.executeCommand(Pe.id), [s]), Qe = f(async () => {
586
+ ), { focus: ze } = Ae(i, n), Ye = p(() => {
587
+ I === h ? i.moveToNextMatch() : (i.changeFindString(h), i.find());
588
+ }, [I, h, i]), Je = p(() => s.executeCommand(Pe.id), [s]), Qe = p(async () => {
587
589
  await s.executeCommand(Te.id), ze();
588
- }, [s]), Xe = f((h) => {
589
- i.changeFindDirection(h);
590
- }, [i]), et = f((h) => {
591
- i.changeFindScope(h);
592
- }, [i]), tt = f((h) => {
593
- i.changeFindBy(h);
594
- }, [i]), it = jt(r), nt = Gt(r), rt = Vt(r);
590
+ }, [s]), Xe = p((u) => {
591
+ i.changeFindDirection(u);
592
+ }, [i]), et = p((u) => {
593
+ i.changeFindScope(u);
594
+ }, [i]), tt = p((u) => {
595
+ i.changeFindBy(u);
596
+ }, [i]), it = Gt(r), nt = Ht(r), rt = Kt(r);
595
597
  return A(() => {
596
- k && p === 0 && a.show({
598
+ k && f === 0 && a.show({
597
599
  content: r.t("find-replace.dialog.no-match"),
598
600
  type: N.Warning,
599
601
  duration: 5e3
600
602
  });
601
- }, [k, p, a, r]), /* @__PURE__ */ I("div", { children: [
603
+ }, [k, f, a, r]), /* @__PURE__ */ y("div", { children: [
602
604
  /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
603
605
  $e,
604
606
  {
605
607
  findCompleted: k,
606
608
  className: "univer-find-input",
607
- matchesCount: p,
608
- matchesPosition: u,
609
+ matchesCount: f,
610
+ matchesPosition: M,
609
611
  findReplaceService: i,
610
612
  localeService: r,
611
- findString: M,
613
+ initialFindString: h,
612
614
  onChange: qe
613
615
  }
614
616
  ) }),
@@ -617,21 +619,21 @@ const Bt = W(function(e, n) {
617
619
  {
618
620
  placeholder: r.t("find-replace.dialog.replace-placeholder"),
619
621
  value: Ue,
620
- onChange: (h) => Ze(h)
622
+ onChange: (u) => Ze(u)
621
623
  }
622
624
  ) }),
623
625
  /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(j, { value: ke, options: nt, onChange: Xe }) }),
624
- /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ I(H, { children: [
626
+ /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ y(H, { children: [
625
627
  /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(j, { value: je, options: it, onChange: et }) }),
626
- /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(j, { value: Ge, options: rt, onChange: tt }) })
628
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(j, { value: Ve, options: rt, onChange: tt }) })
627
629
  ] }) }),
628
- /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ I(H, { children: [
630
+ /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ y(H, { children: [
629
631
  /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
630
632
  ce,
631
633
  {
632
634
  checked: Be,
633
- onChange: (h) => {
634
- i.changeCaseSensitive(h);
635
+ onChange: (u) => {
636
+ i.changeCaseSensitive(u);
635
637
  },
636
638
  children: r.t("find-replace.dialog.case-sensitive")
637
639
  }
@@ -640,169 +642,169 @@ const Bt = W(function(e, n) {
640
642
  ce,
641
643
  {
642
644
  checked: We,
643
- onChange: (h) => {
644
- i.changeMatchesTheWholeCell(h);
645
+ onChange: (u) => {
646
+ i.changeMatchesTheWholeCell(u);
645
647
  },
646
648
  children: r.t("find-replace.dialog.match-the-whole-cell")
647
649
  }
648
650
  ) })
649
651
  ] }) }),
650
- /* @__PURE__ */ I("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
651
- /* @__PURE__ */ l(G, { variant: "primary", onClick: Ye, disabled: Ve, children: r.t("find-replace.dialog.find") }),
652
- /* @__PURE__ */ I("span", { className: "univer-inline-flex univer-gap-2", children: [
653
- /* @__PURE__ */ l(G, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace") }),
654
- /* @__PURE__ */ l(G, { disabled: Ke, onClick: Qe, children: r.t("find-replace.dialog.replace-all") })
652
+ /* @__PURE__ */ y("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
653
+ /* @__PURE__ */ l(V, { variant: "primary", onClick: Ye, disabled: Ge, children: r.t("find-replace.dialog.find") }),
654
+ /* @__PURE__ */ y("span", { className: "univer-inline-flex univer-gap-2", children: [
655
+ /* @__PURE__ */ l(V, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace") }),
656
+ /* @__PURE__ */ l(V, { disabled: Ke, onClick: Qe, children: r.t("find-replace.dialog.replace-all") })
655
657
  ] })
656
658
  ] })
657
659
  ] });
658
660
  });
659
- function kt() {
660
- const t = v(g), e = v(me), n = v(X), i = x(t.state$, void 0, !0), r = K(null);
661
+ function Vt() {
662
+ const t = S(g), e = S(me), n = S(X), i = P(t.state$, void 0, !0), r = K(null);
661
663
  A(() => {
662
664
  let d;
663
665
  return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
664
666
  }, [e]);
665
- const s = K(null), a = f(
667
+ const s = K(null), a = p(
666
668
  (d) => n.setContextValue(Fe, d),
667
669
  [n]
668
- ), c = f(
670
+ ), c = p(
669
671
  (d) => n.setContextValue(ye, d),
670
672
  [n]
671
673
  );
672
674
  return A(() => {
673
- var S;
674
- const d = It(document, "focusin").subscribe((p) => {
675
- var u;
676
- p.target && ((u = r.current) != null && u.contains(p.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
675
+ var m;
676
+ const d = yt(document, "focusin").subscribe((f) => {
677
+ var M;
678
+ f.target && ((M = r.current) != null && M.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
677
679
  });
678
- return (S = s.current) == null || S.focus(), a(!0), c(!0), () => {
680
+ return (m = s.current) == null || m.focus(), a(!0), c(!0), () => {
679
681
  d.unsubscribe(), a(!1);
680
682
  };
681
- }, [a, c]), /* @__PURE__ */ l("div", { ref: r, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ l(Wt, { ref: s }) : /* @__PURE__ */ l(Bt, { ref: s }) });
683
+ }, [a, c]), /* @__PURE__ */ l("div", { ref: r, "data-u-comp": "find-replace-dialog", children: i.replaceRevealed ? /* @__PURE__ */ l(jt, { ref: s }) : /* @__PURE__ */ l(kt, { ref: s }) });
682
684
  }
683
- function jt(t) {
685
+ function Gt(t) {
684
686
  const e = t.getCurrentLocale();
685
687
  return te(() => [
686
688
  { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Y.SUBUNIT },
687
689
  { label: t.t("find-replace.dialog.find-scope.workbook"), value: Y.UNIT }
688
690
  ], [e]);
689
691
  }
690
- function Gt(t) {
692
+ function Ht(t) {
691
693
  const e = t.getCurrentLocale();
692
694
  return te(() => [
693
695
  { label: t.t("find-replace.dialog.find-direction.row"), value: Z.ROW },
694
696
  { label: t.t("find-replace.dialog.find-direction.column"), value: Z.COLUMN }
695
697
  ], [e]);
696
698
  }
697
- function Vt(t) {
699
+ function Kt(t) {
698
700
  const e = t.getCurrentLocale();
699
701
  return te(() => [
700
702
  { label: t.t("find-replace.dialog.find-by.value"), value: z.VALUE },
701
703
  { label: t.t("find-replace.dialog.find-by.formula"), value: z.FORMULA }
702
704
  ], [e]);
703
705
  }
704
- function F(t) {
706
+ function D(t) {
705
707
  return t.getContextValue(Fe);
706
708
  }
707
- function Ht(t) {
709
+ function qt(t) {
708
710
  return t.getContextValue(De);
709
711
  }
710
712
  function Le(t) {
711
713
  return t.getContextValue(ye);
712
714
  }
713
- const O = "7_find-replace-shortcuts";
715
+ const E = "7_find-replace-shortcuts";
714
716
  function re(t) {
715
717
  return t.getContextValue(pe);
716
718
  }
717
719
  function se(t) {
718
720
  return !t.getContextValue(_e);
719
721
  }
720
- const Kt = {
721
- id: T.id,
722
+ const Zt = {
723
+ id: O.id,
722
724
  description: "find-replace.shortcut.open-find-dialog",
723
- binding: C.F | y.CTRL_COMMAND,
724
- group: O,
725
+ binding: C.F | F.CTRL_COMMAND,
726
+ group: E,
725
727
  preconditions(t) {
726
- return !F(t) && re(t) && se(t);
728
+ return !D(t) && re(t) && se(t);
727
729
  }
728
- }, qt = {
729
- id: T.id,
730
+ }, zt = {
731
+ id: O.id,
730
732
  description: "find-replace.shortcut.open-find-dialog",
731
- binding: C.F | y.CTRL_COMMAND,
732
- mac: C.F | y.MAC_CTRL,
733
+ binding: C.F | F.CTRL_COMMAND,
734
+ mac: C.F | F.MAC_CTRL,
733
735
  preconditions(t) {
734
- return !F(t) && re(t) && se(t);
736
+ return !D(t) && re(t) && se(t);
735
737
  }
736
- }, Zt = {
738
+ }, Yt = {
737
739
  id: ne.id,
738
740
  description: "find-replace.shortcut.open-replace-dialog",
739
- binding: C.H | y.CTRL_COMMAND,
740
- mac: C.H | y.MAC_CTRL,
741
- group: O,
741
+ binding: C.H | F.CTRL_COMMAND,
742
+ mac: C.H | F.MAC_CTRL,
743
+ group: E,
742
744
  preconditions(t) {
743
- return re(t) && se(t) && (!F(t) || !Ht(t));
745
+ return re(t) && se(t) && (!D(t) || !qt(t));
744
746
  }
745
- }, zt = {
747
+ }, Jt = {
746
748
  id: Oe.id,
747
749
  description: "find-replace.shortcut.go-to-next-match",
748
750
  binding: C.ENTER,
749
- group: O,
751
+ group: E,
750
752
  priority: 1e3,
751
753
  preconditions(t) {
752
- return Le(t) && F(t);
754
+ return Le(t) && D(t);
753
755
  }
754
- }, Yt = {
756
+ }, Qt = {
755
757
  id: Ee.id,
756
758
  description: "find-replace.shortcut.go-to-previous-match",
757
- binding: C.ENTER | y.SHIFT,
758
- group: O,
759
+ binding: C.ENTER | F.SHIFT,
760
+ group: E,
759
761
  priority: 1e3,
760
762
  preconditions(t) {
761
- return Le(t) && F(t);
763
+ return Le(t) && D(t);
762
764
  }
763
- }, Jt = {
765
+ }, Xt = {
764
766
  id: Ne.id,
765
767
  description: "find-replace.shortcut.focus-selection",
766
768
  binding: C.ESC,
767
- group: O,
769
+ group: E,
768
770
  priority: 1e3,
769
771
  preconditions(t) {
770
- return F(t);
772
+ return D(t);
771
773
  }
772
774
  };
773
- function Qt(t) {
775
+ function ei(t) {
774
776
  const e = t.get(X);
775
777
  return {
776
- id: T.id,
778
+ id: O.id,
777
779
  icon: "SearchIcon",
778
780
  tooltip: "find-replace.toolbar",
779
- type: gt.BUTTON,
780
- hidden$: _t(t, lt.UNIVER_SHEET),
781
+ type: mt.BUTTON,
782
+ hidden$: gt(t, lt.UNIVER_SHEET),
781
783
  disabled$: ve([
782
784
  e.subscribeContextValue$(_e),
783
785
  e.subscribeContextValue$(pe)
784
- ]).pipe(yt(([n, i]) => n || !i))
786
+ ]).pipe(Ft(([n, i]) => n || !i))
785
787
  };
786
788
  }
787
- const Xt = {
788
- [mt.ORGANIZATION]: {
789
- [T.id]: {
789
+ const ti = {
790
+ [vt.ORGANIZATION]: {
791
+ [O.id]: {
790
792
  order: 2,
791
- menuItemFactory: Qt
793
+ menuItemFactory: ei
792
794
  }
793
795
  }
794
796
  };
795
- var ei = Object.getOwnPropertyDescriptor, ti = (t, e, n, i) => {
796
- for (var r = i > 1 ? void 0 : i ? ei(e, n) : e, s = t.length - 1, a; s >= 0; s--)
797
+ var ii = Object.getOwnPropertyDescriptor, ni = (t, e, n, i) => {
798
+ for (var r = i > 1 ? void 0 : i ? ii(e, n) : e, s = t.length - 1, a; s >= 0; s--)
797
799
  (a = t[s]) && (r = a(r) || r);
798
800
  return r;
799
- }, m = (t, e) => (n, i) => e(n, i, t);
800
- const de = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, ii = 20, ni = 64;
801
+ }, v = (t, e) => (n, i) => e(n, i, t);
802
+ const de = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, ri = 20, si = 64;
801
803
  let w = class extends dt {
802
- constructor(e, n, i, r, s, a, c, d, S, p) {
804
+ constructor(e, n, i, r, s, a, c, d, m, f) {
803
805
  super();
804
806
  o(this, "_closingListenerDisposable");
805
- 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 = S, this._injector = p, this._initCommands(), this._initUI(), this._initShortcuts();
807
+ 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 = m, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
806
808
  }
807
809
  dispose() {
808
810
  var e;
@@ -810,7 +812,7 @@ let w = class extends dt {
810
812
  }
811
813
  _initCommands() {
812
814
  [
813
- T,
815
+ O,
814
816
  ne,
815
817
  Oe,
816
818
  Ee,
@@ -823,23 +825,23 @@ let w = class extends dt {
823
825
  }
824
826
  _initShortcuts() {
825
827
  [
826
- Zt,
827
- Kt,
828
- qt,
829
828
  Yt,
829
+ Zt,
830
830
  zt,
831
- Jt
831
+ Qt,
832
+ Jt,
833
+ Xt
832
834
  ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
833
835
  }
834
836
  _initUI() {
835
837
  [
836
- ["FindReplaceDialog", kt],
838
+ ["FindReplaceDialog", Vt],
837
839
  ["SearchIcon", Ie]
838
840
  ].forEach(([e, n]) => {
839
841
  this.disposeWithMe(
840
842
  this._componentManager.register(e, n)
841
843
  );
842
- }), this._menuManagerService.mergeMenu(Xt), this._findReplaceService.stateUpdates$.pipe(ae(this.dispose$)).subscribe((e) => {
844
+ }), this._menuManagerService.mergeMenu(ti), this._findReplaceService.stateUpdates$.pipe(ae(this.dispose$)).subscribe((e) => {
843
845
  e.revealed === !0 && this._openPanel();
844
846
  });
845
847
  }
@@ -853,7 +855,7 @@ let w = class extends dt {
853
855
  destroyOnClose: !0,
854
856
  mask: !1,
855
857
  maskClosable: !1,
856
- defaultPosition: ri(),
858
+ defaultPosition: ai(),
857
859
  preservePositionOnDestroy: !0,
858
860
  onClose: () => this.closePanel()
859
861
  }), this._closingListenerDisposable = $(this._univerInstanceService.focused$.pipe(ae(this.dispose$)).subscribe((e) => {
@@ -864,30 +866,30 @@ let w = class extends dt {
864
866
  this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(de), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
865
867
  }
866
868
  };
867
- w = ti([
868
- m(0, fe),
869
- m(1, vt),
870
- m(2, St),
871
- m(3, U),
872
- m(4, g),
873
- m(5, Ct),
874
- m(6, me),
875
- m(7, D(B)),
876
- m(8, D(Mt)),
877
- m(9, D(Q))
869
+ w = ni([
870
+ v(0, fe),
871
+ v(1, St),
872
+ v(2, Ct),
873
+ v(3, U),
874
+ v(4, g),
875
+ v(5, Mt),
876
+ v(6, me),
877
+ v(7, x(B)),
878
+ v(8, x(Rt)),
879
+ v(9, x(Q))
878
880
  ], w);
879
- function ri() {
881
+ function ai() {
880
882
  const { innerWidth: t } = window;
881
- return { x: t - we - ii, y: ni };
883
+ return { x: t - we - ri, y: si };
882
884
  }
883
- var si = Object.getOwnPropertyDescriptor, ai = (t, e, n, i) => {
884
- for (var r = i > 1 ? void 0 : i ? si(e, n) : e, s = t.length - 1, a; s >= 0; s--)
885
+ var oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
886
+ for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
885
887
  (a = t[s]) && (r = a(r) || r);
886
888
  return r;
887
889
  }, he = (t, e) => (n, i) => e(n, i, t);
888
- const oi = "UNIVER_FIND_REPLACE_PLUGIN";
889
- var V;
890
- let ue = (V = class extends ut {
890
+ const li = "UNIVER_FIND_REPLACE_PLUGIN";
891
+ var G;
892
+ let ue = (G = class extends ut {
891
893
  constructor(t = le, e, n) {
892
894
  super(), this._config = t, this._injector = e, this._configService = n;
893
895
  const { ...i } = ft(
@@ -895,7 +897,7 @@ let ue = (V = class extends ut {
895
897
  le,
896
898
  this._config
897
899
  );
898
- this._configService.setConfig(Pt, i);
900
+ this._configService.setConfig(Ot, i);
899
901
  }
900
902
  onStarting() {
901
903
  [
@@ -906,23 +908,23 @@ let ue = (V = class extends ut {
906
908
  onRendered() {
907
909
  this._injector.get(w);
908
910
  }
909
- }, o(V, "pluginName", oi), V);
910
- ue = ai([
911
- he(1, D(Q)),
911
+ }, o(G, "pluginName", li), G);
912
+ ue = ci([
913
+ he(1, x(Q)),
912
914
  he(2, ht)
913
915
  ], ue);
914
916
  export {
915
917
  z as FindBy,
916
918
  Z as FindDirection,
917
- gi as FindModel,
919
+ vi as FindModel,
918
920
  w as FindReplaceController,
919
921
  q as FindReplaceModel,
920
- wt as FindReplaceState,
922
+ Bt as FindReplaceState,
921
923
  Y as FindScope,
922
924
  Oe as GoToNextMatchOperation,
923
925
  Ee as GoToPreviousMatchOperation,
924
926
  g as IFindReplaceService,
925
- T as OpenFindDialogOperation,
927
+ O as OpenFindDialogOperation,
926
928
  ne as OpenReplaceDialogOperation,
927
929
  Te as ReplaceAllMatchesCommand,
928
930
  Pe as ReplaceCurrentMatchCommand,