@univerjs/find-replace 0.10.2 → 0.10.3-experimental.20250812-b4b6f1a

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,26 +1,26 @@
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 $, Injector as pe, IContextService as ee, Disposable as te, DisposableCollection as ct, toDisposable as A, IUniverInstanceService as _e, ICommandService as k, CommandType as I, LocaleService as B, FOCUSING_SHEET as ge, EDITOR_ACTIVATED as me, 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 ve, useDependency as S, useObservable as P, useDebounceFn as _t, ILayoutService as Se, 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 Ce, Pager as bt, FormLayout as b, Select as G, FormDualColumnLayout as oe, Checkbox as ce, Button as H } from "@univerjs/design";
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
7
  import { RENDER_RAW_FORMULA_KEY as It } from "@univerjs/engine-render";
8
- import { throttleTime as yt, BehaviorSubject as T, combineLatest as Me, debounceTime as Ft, Subject as Re, fromEvent as Dt, map as xt, takeUntil as le } from "rxjs";
9
- import { jsx as l, jsxs as F, Fragment as q } from "react/jsx-runtime";
10
- import { forwardRef as W, useRef as Z, createElement as be, useState as Pt, useCallback as u, useEffect as L, useMemo as ie, useImperativeHandle as Tt } from "react";
11
- const Ie = "FIND_REPLACE_INPUT_FOCUS", ye = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
12
- var Ot = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
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
13
  for (var r = i > 1 ? void 0 : i ? Ot(e, n) : e, s = t.length - 1, a; s >= 0; s--)
14
14
  (a = t[s]) && (r = a(r) || r);
15
15
  return r;
16
16
  }, w = (t, e) => (n, i) => e(n, i, t);
17
- class vi extends te {
17
+ class vi extends ee {
18
18
  }
19
- const _ = ot("find-replace.service");
19
+ const p = ot("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 te {
23
+ let Z = class extends ee {
24
24
  constructor(e, n, i, r) {
25
25
  super();
26
26
  o(this, "currentMatch$", new T(null));
@@ -42,7 +42,7 @@ let z = class extends te {
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({ ...ne(), revealed: !1 });
45
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ie(), revealed: !1 });
46
46
  }
47
47
  async start() {
48
48
  if (!this._state.findString)
@@ -82,7 +82,7 @@ let z = class extends te {
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 = Me(e.map((r) => r.matchesUpdate$)).pipe(Ft(220)).subscribe(([...r]) => {
85
+ const n = this._currentSearchingDisposables = new ct(), i = Ce(e.map((r) => r.matchesUpdate$)).pipe(Ft(220)).subscribe(([...r]) => {
86
86
  const s = this._matches = r.flat();
87
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([]));
88
88
  });
@@ -163,12 +163,12 @@ let z = class extends te {
163
163
  return this._moveToNextUnitMatch(r), 0;
164
164
  }
165
165
  };
166
- z = De([
167
- w(2, _e),
168
- w(3, k)
169
- ], z);
170
- var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), J = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(J || {}), Q = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Q || {});
171
- function ne() {
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() {
172
172
  return {
173
173
  caseSensitive: !1,
174
174
  findBy: "value",
@@ -187,9 +187,9 @@ function ne() {
187
187
  }
188
188
  class Nt {
189
189
  constructor() {
190
- o(this, "_stateUpdates$", new Re());
190
+ o(this, "_stateUpdates$", new Me());
191
191
  o(this, "stateUpdates$", this._stateUpdates$.asObservable());
192
- o(this, "_state$", new T(ne()));
192
+ o(this, "_state$", new T(ie()));
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 X = class extends te {
270
+ let Q = class extends ee {
271
271
  constructor(e, n) {
272
272
  super();
273
273
  o(this, "_providers", /* @__PURE__ */ new Set());
@@ -277,7 +277,7 @@ let X = class extends te {
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 Re());
280
+ o(this, "_focusSignal$", new Me());
281
281
  o(this, "focusSignal$", this._focusSignal$.asObservable());
282
282
  this._injector = e, this._contextService = n;
283
283
  }
@@ -360,8 +360,8 @@ let X = class extends te {
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 = ne();
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();
365
365
  return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
366
366
  }
367
367
  find() {
@@ -376,25 +376,25 @@ let X = class extends te {
376
376
  return this._providers.add(e), A(() => this._providers.delete(e));
377
377
  }
378
378
  _toggleRevealReplace(e) {
379
- this._contextService.setContextValue(Fe, e);
379
+ this._contextService.setContextValue(ye, e);
380
380
  }
381
381
  _toggleDisplayRawFormula(e) {
382
382
  this._contextService.setContextValue(It, e);
383
383
  }
384
384
  };
385
- X = De([
386
- w(0, $(pe)),
387
- w(1, ee)
388
- ], X);
389
- const xe = {
385
+ Q = Fe([
386
+ w(0, $(fe)),
387
+ w(1, X)
388
+ ], Q);
389
+ const De = {
390
390
  id: "ui.command.replace-current-match",
391
391
  type: I.COMMAND,
392
- handler: (t) => t.get(_).replace()
393
- }, $t = "CONFIRM_REPLACE_ALL", Pe = {
392
+ handler: (t) => t.get(p).replace()
393
+ }, $t = "CONFIRM_REPLACE_ALL", xe = {
394
394
  id: "ui.command.replace-all-matches",
395
395
  type: I.COMMAND,
396
396
  handler: async (t) => {
397
- const e = t.get(pt), n = t.get(B), i = t.get(ve);
397
+ const e = t.get(pt), n = t.get(W), i = t.get(me);
398
398
  if (!await e.confirm({
399
399
  id: $t,
400
400
  title: { title: n.t("find-replace.replace.confirm.title") },
@@ -402,7 +402,7 @@ const xe = {
402
402
  confirmText: n.t("button.confirm")
403
403
  }))
404
404
  return !1;
405
- const s = await t.get(_).replaceAll(), { success: a, failure: c } = s;
405
+ const s = await t.get(p).replaceAll(), { success: a, failure: c } = s;
406
406
  return c > 0 ? (a === 0 ? i.show({
407
407
  type: N.Error,
408
408
  content: n.t("find-replace.replace.all-failure")
@@ -418,37 +418,37 @@ const xe = {
418
418
  id: "ui.operation.open-find-dialog",
419
419
  type: I.OPERATION,
420
420
  handler: (t) => {
421
- const e = t.get(_);
421
+ const e = t.get(p);
422
422
  return e.revealed ? e.focusFindInput() : e.start(), !0;
423
423
  }
424
- }, re = {
424
+ }, ne = {
425
425
  id: "ui.operation.open-replace-dialog",
426
426
  type: I.OPERATION,
427
427
  handler: (t) => {
428
- const e = t.get(_);
428
+ const e = t.get(p);
429
429
  return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
430
430
  }
431
- }, Te = {
431
+ }, Pe = {
432
432
  type: I.OPERATION,
433
433
  id: "ui.operation.go-to-next-match",
434
- handler: (t) => (t.get(_).moveToNextMatch(), !0)
435
- }, Oe = {
434
+ handler: (t) => (t.get(p).moveToNextMatch(), !0)
435
+ }, Te = {
436
436
  type: I.OPERATION,
437
437
  id: "ui.operation.go-to-previous-match",
438
- handler: (t) => (t.get(_).moveToPreviousMatch(), !0)
439
- }, Ee = {
438
+ handler: (t) => (t.get(p).moveToPreviousMatch(), !0)
439
+ }, Oe = {
440
440
  type: I.OPERATION,
441
441
  id: "ui.operation.focus-selection",
442
- handler: (t) => (t.get(_).focusSelection(), !0)
442
+ handler: (t) => (t.get(p).focusSelection(), !0)
443
443
  };
444
- var p = function() {
445
- return p = Object.assign || function(t) {
444
+ var f = function() {
445
+ return f = Object.assign || function(t) {
446
446
  for (var e, n = 1, i = arguments.length; n < i; n++) {
447
447
  e = arguments[n];
448
448
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
449
449
  }
450
450
  return t;
451
- }, p.apply(this, arguments);
451
+ }, f.apply(this, arguments);
452
452
  }, At = function(t, e) {
453
453
  var n = {};
454
454
  for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
@@ -456,17 +456,17 @@ var p = function() {
456
456
  for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
457
457
  e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
458
458
  return n;
459
- }, Ne = W(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 = Z("_".concat(Ut()));
461
- return $e(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, p({ ref: e, className: c }, a), s);
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
462
  });
463
- function $e(t, e, n, i, r) {
464
- return be(t.tag, p(p({ key: e }, Lt(t, n, r)), i), (wt(t, n).children || []).map(function(s, a) {
465
- return $e(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
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
466
  }));
467
467
  }
468
468
  function Lt(t, e, n) {
469
- var i = p({}, t.attrs);
469
+ var i = f({}, t.attrs);
470
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
471
  var a = s[0], c = s[1];
472
472
  a === "mask" && typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
@@ -479,23 +479,23 @@ function Lt(t, e, n) {
479
479
  }
480
480
  function wt(t, e) {
481
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) ? p(p({}, t), { children: t.children.map(function(r) {
483
- return typeof r.attrs.id == "string" && i && i.includes(r.attrs.id) ? p(p({}, r), { attrs: p(p({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
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
484
  }) }) : t;
485
485
  }
486
486
  function Ut() {
487
487
  return Math.random().toString(36).substring(2, 8);
488
488
  }
489
- Ne.displayName = "UniverIcon";
490
- var kt = { 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" } }] }, Ae = W(function(t, e) {
491
- return be(Ne, Object.assign({}, t, {
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, {
492
492
  id: "search-icon",
493
493
  ref: e,
494
- icon: kt
494
+ icon: Bt
495
495
  }));
496
496
  });
497
- Ae.displayName = "SearchIcon";
498
- function Le(t) {
497
+ $e.displayName = "SearchIcon";
498
+ function Ae(t) {
499
499
  const {
500
500
  findCompleted: e,
501
501
  localeService: n,
@@ -505,24 +505,20 @@ function Le(t) {
505
505
  findReplaceService: a,
506
506
  onChange: c,
507
507
  ...d
508
- } = t, [m, g] = Pt(s), y = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
509
- function v(f) {
510
- r === i && f === 1 ? a.moveToNextMatch() : r === 1 && f === i || f < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
511
- }
512
- function j(f) {
513
- f.key === "Enter" && v(r + 1);
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();
514
511
  }
515
- return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (f) => f.stopPropagation(), children: /* @__PURE__ */ l(
516
- Ce,
512
+ return /* @__PURE__ */ l("div", { className: "univer-relative univer-flex univer-items-center univer-gap-2", onDrag: (m) => m.stopPropagation(), children: /* @__PURE__ */ l(
513
+ Se,
517
514
  {
518
515
  "data-u-comp": "search-input",
519
516
  autoFocus: !0,
520
517
  placeholder: n.t("find-replace.dialog.find-placeholder"),
521
- value: m,
522
- onChange: (f) => {
523
- g(f), c == null || c(f);
518
+ value: g,
519
+ onChange: (m) => {
520
+ _(m), c == null || c(m);
524
521
  },
525
- onKeyDown: j,
526
522
  slot: /* @__PURE__ */ l(
527
523
  bt,
528
524
  {
@@ -530,14 +526,14 @@ function Le(t) {
530
526
  text: y,
531
527
  value: r,
532
528
  total: i,
533
- onChange: v
529
+ onChange: S
534
530
  }
535
531
  ),
536
532
  ...d
537
533
  }
538
534
  ) });
539
535
  }
540
- function we(t, e) {
536
+ function Le(t, e) {
541
537
  const n = u(() => {
542
538
  var r;
543
539
  (r = document.querySelector(".univer-find-input input")) == null || r.focus();
@@ -550,17 +546,17 @@ function we(t, e) {
550
546
  return () => r.unsubscribe();
551
547
  }, [t, n]), { focus: n, selectHasFocus: i };
552
548
  }
553
- const Bt = W(function(e, n) {
554
- const i = S(B), r = S(_), s = S(k), a = P(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: m, matchesPosition: g } = a, R = u(() => {
555
- s.executeCommand(re.id);
556
- }, [s]), y = _t((v) => r.changeFindString(v), 500);
557
- return we(r, n), /* @__PURE__ */ F(q, { children: [
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: [
558
554
  /* @__PURE__ */ l(
559
- Le,
555
+ Ae,
560
556
  {
561
557
  findCompleted: c,
562
- matchesCount: m,
563
- matchesPosition: g,
558
+ matchesCount: g,
559
+ matchesPosition: _,
564
560
  findReplaceService: r,
565
561
  localeService: i,
566
562
  initialFindString: d,
@@ -576,29 +572,29 @@ const Bt = W(function(e, n) {
576
572
  }
577
573
  ) })
578
574
  ] });
579
- }), Wt = W(function(e, n) {
580
- const i = S(_), r = S(B), s = S(k), a = S(ve), c = P(i.currentMatch$, void 0, !0), d = P(i.replaceables$, void 0, !0), m = P(i.state$, void 0, !0), {
581
- matchesCount: g,
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: _,
582
578
  matchesPosition: R,
583
579
  findString: y,
584
- inputtingFindString: v,
585
- replaceString: j,
586
- caseSensitive: f,
587
- matchesTheWholeCell: Be,
588
- findDirection: We,
580
+ inputtingFindString: S,
581
+ replaceString: m,
582
+ caseSensitive: Be,
583
+ matchesTheWholeCell: We,
584
+ findDirection: ke,
589
585
  findScope: je,
590
586
  findBy: Ve,
591
- findCompleted: V
592
- } = m, Ge = v.length === 0, He = g === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = u(
587
+ findCompleted: j
588
+ } = g, Ge = S.length === 0, He = _ === 0 || !(c != null && c.replaceable), Ke = d.length === 0, qe = u(
593
589
  (h) => i.changeInputtingFindString(h),
594
590
  [i]
595
591
  ), Ze = u(
596
592
  (h) => i.changeReplaceString(h),
597
593
  [i]
598
- ), { focus: ze } = we(i, n), Ye = u(() => {
599
- y === v ? i.moveToNextMatch() : (i.changeFindString(v), i.find());
600
- }, [y, v, i]), Je = u(() => s.executeCommand(xe.id), [s]), Qe = u(async () => {
601
- await s.executeCommand(Pe.id), ze();
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();
602
598
  }, [s]), Xe = u((h) => {
603
599
  i.changeFindDirection(h);
604
600
  }, [i]), et = u((h) => {
@@ -607,43 +603,43 @@ const Bt = W(function(e, n) {
607
603
  i.changeFindBy(h);
608
604
  }, [i]), it = Vt(r), nt = Gt(r), rt = Ht(r);
609
605
  return L(() => {
610
- V && g === 0 && a.show({
606
+ j && _ === 0 && a.show({
611
607
  content: r.t("find-replace.dialog.no-match"),
612
608
  type: N.Warning,
613
609
  duration: 5e3
614
610
  });
615
- }, [V, g, a, r]), /* @__PURE__ */ F("div", { children: [
611
+ }, [j, _, a, r]), /* @__PURE__ */ F("div", { children: [
616
612
  /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
617
- Le,
613
+ Ae,
618
614
  {
619
- findCompleted: V,
615
+ findCompleted: j,
620
616
  className: "univer-find-input",
621
- matchesCount: g,
617
+ matchesCount: _,
622
618
  matchesPosition: R,
623
619
  findReplaceService: i,
624
620
  localeService: r,
625
- initialFindString: v,
621
+ initialFindString: S,
626
622
  onChange: qe
627
623
  }
628
624
  ) }),
629
625
  /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
630
- Ce,
626
+ Se,
631
627
  {
632
628
  placeholder: r.t("find-replace.dialog.replace-placeholder"),
633
- value: j,
629
+ value: m,
634
630
  onChange: (h) => Ze(h)
635
631
  }
636
632
  ) }),
637
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(G, { value: We, options: nt, onChange: Xe }) }),
638
- /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ F(q, { children: [
639
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(G, { value: je, options: it, onChange: et }) }),
640
- /* @__PURE__ */ l(b, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(G, { value: Ve, options: rt, onChange: tt }) })
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 }) })
641
637
  ] }) }),
642
- /* @__PURE__ */ l(oe, { children: /* @__PURE__ */ F(q, { children: [
638
+ /* @__PURE__ */ l(ae, { children: /* @__PURE__ */ F(K, { children: [
643
639
  /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
644
- ce,
640
+ oe,
645
641
  {
646
- checked: f,
642
+ checked: Be,
647
643
  onChange: (h) => {
648
644
  i.changeCaseSensitive(h);
649
645
  },
@@ -651,9 +647,9 @@ const Bt = W(function(e, n) {
651
647
  }
652
648
  ) }),
653
649
  /* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(
654
- ce,
650
+ oe,
655
651
  {
656
- checked: Be,
652
+ checked: We,
657
653
  onChange: (h) => {
658
654
  i.changeMatchesTheWholeCell(h);
659
655
  },
@@ -662,74 +658,74 @@ const Bt = W(function(e, n) {
662
658
  ) })
663
659
  ] }) }),
664
660
  /* @__PURE__ */ F("div", { className: "univer-mt-6 univer-flex univer-justify-between", children: [
665
- /* @__PURE__ */ l(H, { variant: "primary", onClick: Ye, disabled: Ge, children: r.t("find-replace.dialog.find") }),
661
+ /* @__PURE__ */ l(G, { variant: "primary", onClick: Ye, disabled: Ge, children: r.t("find-replace.dialog.find") }),
666
662
  /* @__PURE__ */ F("span", { className: "univer-inline-flex univer-gap-2", children: [
667
- /* @__PURE__ */ l(H, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace") }),
668
- /* @__PURE__ */ l(H, { disabled: Ke, onClick: Qe, children: r.t("find-replace.dialog.replace-all") })
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") })
669
665
  ] })
670
666
  ] })
671
667
  ] });
672
668
  });
673
669
  function jt() {
674
- const t = S(_), e = S(Se), n = S(ee), i = P(t.state$, void 0, !0), r = Z(null);
670
+ const t = v(p), e = v(ve), n = v(X), i = P(t.state$, void 0, !0), r = q(null);
675
671
  L(() => {
676
672
  let d;
677
673
  return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
678
674
  }, [e]);
679
- const s = Z(null), a = u(
680
- (d) => n.setContextValue(ye, d),
675
+ const s = q(null), a = u(
676
+ (d) => n.setContextValue(Ie, d),
681
677
  [n]
682
678
  ), c = u(
683
- (d) => n.setContextValue(Ie, d),
679
+ (d) => n.setContextValue(be, d),
684
680
  [n]
685
681
  );
686
682
  return L(() => {
687
- var m;
688
- const d = Dt(document, "focusin").subscribe((g) => {
683
+ var g;
684
+ const d = Dt(document, "focusin").subscribe((_) => {
689
685
  var R;
690
- g.target && ((R = r.current) != null && R.contains(g.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
686
+ _.target && ((R = r.current) != null && R.contains(_.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!1) : c(!0);
691
687
  });
692
- return (m = s.current) == null || m.focus(), a(!0), c(!0), () => {
688
+ return (g = s.current) == null || g.focus(), a(!0), c(!0), () => {
693
689
  d.unsubscribe(), a(!1);
694
690
  };
695
- }, [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 }) });
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 }) });
696
692
  }
697
693
  function Vt(t) {
698
694
  const e = t.getCurrentLocale();
699
- return ie(() => [
700
- { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Q.SUBUNIT },
701
- { label: t.t("find-replace.dialog.find-scope.workbook"), value: Q.UNIT }
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 }
702
698
  ], [e]);
703
699
  }
704
700
  function Gt(t) {
705
701
  const e = t.getCurrentLocale();
706
- return ie(() => [
707
- { label: t.t("find-replace.dialog.find-direction.row"), value: Y.ROW },
708
- { label: t.t("find-replace.dialog.find-direction.column"), value: Y.COLUMN }
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 }
709
705
  ], [e]);
710
706
  }
711
707
  function Ht(t) {
712
708
  const e = t.getCurrentLocale();
713
- return ie(() => [
714
- { label: t.t("find-replace.dialog.find-by.value"), value: J.VALUE },
715
- { label: t.t("find-replace.dialog.find-by.formula"), value: J.FORMULA }
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 }
716
712
  ], [e]);
717
713
  }
718
714
  function x(t) {
719
- return t.getContextValue(ye);
715
+ return t.getContextValue(Ie);
720
716
  }
721
717
  function Kt(t) {
722
- return t.getContextValue(Fe);
718
+ return t.getContextValue(ye);
723
719
  }
724
- function Ue(t) {
725
- return t.getContextValue(Ie);
720
+ function we(t) {
721
+ return t.getContextValue(be);
726
722
  }
727
723
  const E = "7_find-replace-shortcuts";
728
- function se(t) {
729
- return t.getContextValue(ge);
724
+ function re(t) {
725
+ return t.getContextValue(_e);
730
726
  }
731
- function ae(t) {
732
- return !t.getContextValue(me);
727
+ function se(t) {
728
+ return !t.getContextValue(ge);
733
729
  }
734
730
  const qt = {
735
731
  id: O.id,
@@ -737,7 +733,7 @@ const qt = {
737
733
  binding: M.F | D.CTRL_COMMAND,
738
734
  group: E,
739
735
  preconditions(t) {
740
- return !x(t) && se(t) && ae(t);
736
+ return !x(t) && re(t) && se(t);
741
737
  }
742
738
  }, Zt = {
743
739
  id: O.id,
@@ -745,37 +741,37 @@ const qt = {
745
741
  binding: M.F | D.CTRL_COMMAND,
746
742
  mac: M.F | D.MAC_CTRL,
747
743
  preconditions(t) {
748
- return !x(t) && se(t) && ae(t);
744
+ return !x(t) && re(t) && se(t);
749
745
  }
750
746
  }, zt = {
751
- id: re.id,
747
+ id: ne.id,
752
748
  description: "find-replace.shortcut.open-replace-dialog",
753
749
  binding: M.H | D.CTRL_COMMAND,
754
750
  mac: M.H | D.MAC_CTRL,
755
751
  group: E,
756
752
  preconditions(t) {
757
- return se(t) && ae(t) && (!x(t) || !Kt(t));
753
+ return re(t) && se(t) && (!x(t) || !Kt(t));
758
754
  }
759
755
  }, Yt = {
760
- id: Te.id,
756
+ id: Pe.id,
761
757
  description: "find-replace.shortcut.go-to-next-match",
762
758
  binding: M.ENTER,
763
759
  group: E,
764
760
  priority: 1e3,
765
761
  preconditions(t) {
766
- return Ue(t) && x(t);
762
+ return we(t) && x(t);
767
763
  }
768
764
  }, Jt = {
769
- id: Oe.id,
765
+ id: Te.id,
770
766
  description: "find-replace.shortcut.go-to-previous-match",
771
767
  binding: M.ENTER | D.SHIFT,
772
768
  group: E,
773
769
  priority: 1e3,
774
770
  preconditions(t) {
775
- return Ue(t) && x(t);
771
+ return we(t) && x(t);
776
772
  }
777
773
  }, Qt = {
778
- id: Ee.id,
774
+ id: Oe.id,
779
775
  description: "find-replace.shortcut.focus-selection",
780
776
  binding: M.ESC,
781
777
  group: E,
@@ -785,16 +781,16 @@ const qt = {
785
781
  }
786
782
  };
787
783
  function Xt(t) {
788
- const e = t.get(ee);
784
+ const e = t.get(X);
789
785
  return {
790
786
  id: O.id,
791
787
  icon: "SearchIcon",
792
788
  tooltip: "find-replace.toolbar",
793
789
  type: mt.BUTTON,
794
790
  hidden$: gt(t, lt.UNIVER_SHEET),
795
- disabled$: Me([
796
- e.subscribeContextValue$(me),
797
- e.subscribeContextValue$(ge)
791
+ disabled$: Ce([
792
+ e.subscribeContextValue$(ge),
793
+ e.subscribeContextValue$(_e)
798
794
  ]).pipe(xt(([n, i]) => n || !i))
799
795
  };
800
796
  }
@@ -811,12 +807,12 @@ var ti = Object.getOwnPropertyDescriptor, ii = (t, e, n, i) => {
811
807
  (a = t[s]) && (r = a(r) || r);
812
808
  return r;
813
809
  }, C = (t, e) => (n, i) => e(n, i, t);
814
- const de = "DESKTOP_FIND_REPLACE_DIALOG", ke = 350, ni = 20, ri = 64;
810
+ const le = "DESKTOP_FIND_REPLACE_DIALOG", Ue = 350, ni = 20, ri = 64;
815
811
  let U = class extends dt {
816
- constructor(e, n, i, r, s, a, c, d, m) {
812
+ constructor(e, n, i, r, s, a, c, d, g) {
817
813
  super();
818
814
  o(this, "_closingListenerDisposable");
819
- 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._initCommands(), this._initUI(), this._initShortcuts();
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();
820
816
  }
821
817
  dispose() {
822
818
  var e;
@@ -825,12 +821,12 @@ let U = class extends dt {
825
821
  _initCommands() {
826
822
  [
827
823
  O,
828
- re,
829
- Te,
830
- Oe,
824
+ ne,
831
825
  Pe,
826
+ Te,
832
827
  xe,
833
- Ee
828
+ De,
829
+ Oe
834
830
  ].forEach((e) => {
835
831
  this.disposeWithMe(this._commandService.registerCommand(e));
836
832
  });
@@ -848,20 +844,20 @@ let U = class extends dt {
848
844
  _initUI() {
849
845
  [
850
846
  ["FindReplaceDialog", jt],
851
- ["SearchIcon", Ae]
847
+ ["SearchIcon", $e]
852
848
  ].forEach(([e, n]) => {
853
849
  this.disposeWithMe(
854
850
  this._componentManager.register(e, n)
855
851
  );
856
- }), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(le(this.dispose$)).subscribe((e) => {
852
+ }), this._menuManagerService.mergeMenu(ei), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
857
853
  e.revealed === !0 && this._openPanel();
858
854
  });
859
855
  }
860
856
  _openPanel() {
861
857
  this._dialogService.open({
862
- id: de,
858
+ id: le,
863
859
  draggable: !0,
864
- width: ke,
860
+ width: Ue,
865
861
  title: { title: this._localeService.t("find-replace.dialog.title") },
866
862
  children: { label: "FindReplaceDialog" },
867
863
  destroyOnClose: !0,
@@ -870,43 +866,43 @@ let U = class extends dt {
870
866
  defaultPosition: si(),
871
867
  preservePositionOnDestroy: !0,
872
868
  onClose: () => this.closePanel()
873
- }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(le(this.dispose$)).subscribe((e) => {
869
+ }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
874
870
  (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
875
871
  }));
876
872
  }
877
873
  closePanel() {
878
- this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(de), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
874
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(le), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
879
875
  }
880
876
  };
881
877
  U = ii([
882
- C(0, _e),
878
+ C(0, pe),
883
879
  C(1, St),
884
880
  C(2, Ct),
885
- C(3, k),
886
- C(4, _),
881
+ C(3, B),
882
+ C(4, p),
887
883
  C(5, Mt),
888
- C(6, Se),
889
- C(7, $(B)),
884
+ C(6, ve),
885
+ C(7, $(W)),
890
886
  C(8, $(Rt))
891
887
  ], U);
892
888
  function si() {
893
889
  const { innerWidth: t } = window;
894
- return { x: t - ke - ni, y: ri };
890
+ return { x: t - Ue - ni, y: ri };
895
891
  }
896
- const ai = "find-replace.config", he = {};
892
+ const ai = "find-replace.config", de = {};
897
893
  var oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
898
894
  for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
899
895
  (a = t[s]) && (r = a(r) || r);
900
896
  return r;
901
- }, ue = (t, e) => (n, i) => e(n, i, t);
897
+ }, he = (t, e) => (n, i) => e(n, i, t);
902
898
  const li = "UNIVER_FIND_REPLACE_PLUGIN";
903
- var K;
904
- let fe = (K = class extends ut {
905
- constructor(t = he, e, n) {
899
+ var H;
900
+ let ue = (H = class extends ut {
901
+ constructor(t = de, e, n) {
906
902
  super(), this._config = t, this._injector = e, this._configService = n;
907
903
  const { ...i } = ft(
908
904
  {},
909
- he,
905
+ de,
910
906
  this._config
911
907
  );
912
908
  this._configService.setConfig(ai, i);
@@ -914,32 +910,32 @@ let fe = (K = class extends ut {
914
910
  onStarting() {
915
911
  [
916
912
  [U],
917
- [_, { useClass: X }]
913
+ [p, { useClass: Q }]
918
914
  ].forEach((t) => this._injector.add(t));
919
915
  }
920
916
  onRendered() {
921
917
  this._injector.get(U);
922
918
  }
923
- }, o(K, "pluginName", li), K);
924
- fe = ci([
925
- ue(1, $(pe)),
926
- ue(2, ht)
927
- ], fe);
919
+ }, o(H, "pluginName", li), H);
920
+ ue = ci([
921
+ he(1, $(fe)),
922
+ he(2, ht)
923
+ ], ue);
928
924
  export {
929
- J as FindBy,
930
- Y as FindDirection,
925
+ Y as FindBy,
926
+ z as FindDirection,
931
927
  vi as FindModel,
932
928
  U as FindReplaceController,
933
- z as FindReplaceModel,
929
+ Z as FindReplaceModel,
934
930
  Nt as FindReplaceState,
935
- Q as FindScope,
936
- Te as GoToNextMatchOperation,
937
- Oe as GoToPreviousMatchOperation,
938
- _ as IFindReplaceService,
931
+ J as FindScope,
932
+ Pe as GoToNextMatchOperation,
933
+ Te as GoToPreviousMatchOperation,
934
+ p as IFindReplaceService,
939
935
  O as OpenFindDialogOperation,
940
- re as OpenReplaceDialogOperation,
941
- Pe as ReplaceAllMatchesCommand,
942
- xe as ReplaceCurrentMatchCommand,
943
- fe as UniverFindReplacePlugin,
944
- ne as createInitFindReplaceState
936
+ ne as OpenReplaceDialogOperation,
937
+ xe as ReplaceAllMatchesCommand,
938
+ De as ReplaceCurrentMatchCommand,
939
+ ue as UniverFindReplacePlugin,
940
+ ie as createInitFindReplaceState
945
941
  };