@univerjs/find-replace 1.0.0-alpha.6 → 1.0.0-alpha.8

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.
Files changed (84) hide show
  1. package/lib/cjs/index.js +105 -42
  2. package/lib/cjs/locale/ar-SA.js +2 -1
  3. package/lib/cjs/locale/ca-ES.js +2 -1
  4. package/lib/cjs/locale/de-DE.js +2 -1
  5. package/lib/cjs/locale/en-US.js +2 -1
  6. package/lib/cjs/locale/es-ES.js +2 -1
  7. package/lib/cjs/locale/fa-IR.js +2 -1
  8. package/lib/cjs/locale/fr-FR.js +2 -1
  9. package/lib/cjs/locale/id-ID.js +2 -1
  10. package/lib/cjs/locale/it-IT.js +2 -1
  11. package/lib/cjs/locale/ja-JP.js +2 -1
  12. package/lib/cjs/locale/ko-KR.js +2 -1
  13. package/lib/cjs/locale/pl-PL.js +2 -1
  14. package/lib/cjs/locale/pt-BR.js +2 -1
  15. package/lib/cjs/locale/ru-RU.js +2 -1
  16. package/lib/cjs/locale/sk-SK.js +2 -1
  17. package/lib/cjs/locale/vi-VN.js +2 -1
  18. package/lib/cjs/locale/zh-CN.js +1 -0
  19. package/lib/cjs/locale/zh-HK.js +2 -1
  20. package/lib/cjs/locale/zh-TW.js +2 -1
  21. package/lib/es/index.js +107 -44
  22. package/lib/es/locale/ar-SA.js +2 -1
  23. package/lib/es/locale/ca-ES.js +2 -1
  24. package/lib/es/locale/de-DE.js +2 -1
  25. package/lib/es/locale/en-US.js +2 -1
  26. package/lib/es/locale/es-ES.js +2 -1
  27. package/lib/es/locale/fa-IR.js +2 -1
  28. package/lib/es/locale/fr-FR.js +2 -1
  29. package/lib/es/locale/id-ID.js +2 -1
  30. package/lib/es/locale/it-IT.js +2 -1
  31. package/lib/es/locale/ja-JP.js +2 -1
  32. package/lib/es/locale/ko-KR.js +2 -1
  33. package/lib/es/locale/pl-PL.js +2 -1
  34. package/lib/es/locale/pt-BR.js +2 -1
  35. package/lib/es/locale/ru-RU.js +2 -1
  36. package/lib/es/locale/sk-SK.js +2 -1
  37. package/lib/es/locale/vi-VN.js +2 -1
  38. package/lib/es/locale/zh-CN.js +1 -0
  39. package/lib/es/locale/zh-HK.js +2 -1
  40. package/lib/es/locale/zh-TW.js +2 -1
  41. package/lib/index.js +107 -44
  42. package/lib/locale/ar-SA.js +2 -1
  43. package/lib/locale/ca-ES.js +2 -1
  44. package/lib/locale/de-DE.js +2 -1
  45. package/lib/locale/en-US.js +2 -1
  46. package/lib/locale/es-ES.js +2 -1
  47. package/lib/locale/fa-IR.js +2 -1
  48. package/lib/locale/fr-FR.js +2 -1
  49. package/lib/locale/id-ID.js +2 -1
  50. package/lib/locale/it-IT.js +2 -1
  51. package/lib/locale/ja-JP.js +2 -1
  52. package/lib/locale/ko-KR.js +2 -1
  53. package/lib/locale/pl-PL.js +2 -1
  54. package/lib/locale/pt-BR.js +2 -1
  55. package/lib/locale/ru-RU.js +2 -1
  56. package/lib/locale/sk-SK.js +2 -1
  57. package/lib/locale/vi-VN.js +2 -1
  58. package/lib/locale/zh-CN.js +1 -0
  59. package/lib/locale/zh-HK.js +2 -1
  60. package/lib/locale/zh-TW.js +2 -1
  61. package/lib/types/locale/en-US.d.ts +1 -0
  62. package/lib/types/services/context-keys.d.ts +2 -0
  63. package/lib/types/services/find-replace.service.d.ts +24 -3
  64. package/lib/umd/index.js +1 -1
  65. package/lib/umd/locale/ar-SA.js +1 -1
  66. package/lib/umd/locale/ca-ES.js +1 -1
  67. package/lib/umd/locale/de-DE.js +1 -1
  68. package/lib/umd/locale/en-US.js +1 -1
  69. package/lib/umd/locale/es-ES.js +1 -1
  70. package/lib/umd/locale/fa-IR.js +1 -1
  71. package/lib/umd/locale/fr-FR.js +1 -1
  72. package/lib/umd/locale/id-ID.js +1 -1
  73. package/lib/umd/locale/it-IT.js +1 -1
  74. package/lib/umd/locale/ja-JP.js +1 -1
  75. package/lib/umd/locale/ko-KR.js +1 -1
  76. package/lib/umd/locale/pl-PL.js +1 -1
  77. package/lib/umd/locale/pt-BR.js +1 -1
  78. package/lib/umd/locale/ru-RU.js +1 -1
  79. package/lib/umd/locale/sk-SK.js +1 -1
  80. package/lib/umd/locale/vi-VN.js +1 -1
  81. package/lib/umd/locale/zh-CN.js +1 -1
  82. package/lib/umd/locale/zh-HK.js +1 -1
  83. package/lib/umd/locale/zh-TW.js +1 -1
  84. package/package.json +8 -8
package/lib/cjs/index.js CHANGED
@@ -33,9 +33,11 @@ const FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS";
33
33
  * If the find replace feature is activated and the replace is revealed.
34
34
  */
35
35
  const FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
36
+ /** If the focused unit has a find-replace provider. */
37
+ const FIND_REPLACE_AVAILABLE = "FIND_REPLACE_AVAILABLE";
36
38
 
37
39
  //#endregion
38
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
40
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
39
41
  function _typeof(o) {
40
42
  "@babel/helpers - typeof";
41
43
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -46,7 +48,7 @@ function _typeof(o) {
46
48
  }
47
49
 
48
50
  //#endregion
49
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
51
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
50
52
  function toPrimitive(t, r) {
51
53
  if ("object" != _typeof(t) || !t) return t;
52
54
  var e = t[Symbol.toPrimitive];
@@ -59,14 +61,14 @@ function toPrimitive(t, r) {
59
61
  }
60
62
 
61
63
  //#endregion
62
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
64
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
63
65
  function toPropertyKey(t) {
64
66
  var i = toPrimitive(t, "string");
65
67
  return "symbol" == _typeof(i) ? i : i + "";
66
68
  }
67
69
 
68
70
  //#endregion
69
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
71
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
70
72
  function _defineProperty(e, r, t) {
71
73
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
72
74
  value: t,
@@ -77,7 +79,7 @@ function _defineProperty(e, r, t) {
77
79
  }
78
80
 
79
81
  //#endregion
80
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
82
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
81
83
  function __decorateParam(paramIndex, decorator) {
82
84
  return function(target, key) {
83
85
  decorator(target, key, paramIndex);
@@ -85,7 +87,7 @@ function __decorateParam(paramIndex, decorator) {
85
87
  }
86
88
 
87
89
  //#endregion
88
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
90
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
89
91
  function __decorate(decorators, target, key, desc) {
90
92
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
91
93
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -106,6 +108,7 @@ function shouldStateUpdateTriggerResearch(statusUpdate) {
106
108
  if (typeof statusUpdate.inputtingFindString !== "undefined") return true;
107
109
  if (typeof statusUpdate.findDirection !== "undefined") return true;
108
110
  if (typeof statusUpdate.matchesTheWholeCell !== "undefined") return true;
111
+ if (typeof statusUpdate.matchesTheWholeWord !== "undefined") return true;
109
112
  if (typeof statusUpdate.caseSensitive !== "undefined") return true;
110
113
  if (typeof statusUpdate.findScope !== "undefined") return true;
111
114
  if (typeof statusUpdate.findBy !== "undefined") return true;
@@ -171,7 +174,8 @@ let FindReplaceModel = class FindReplaceModel extends _univerjs_core.Disposable
171
174
  findBy: this._state.findBy,
172
175
  replaceRevealed: this._state.replaceRevealed,
173
176
  caseSensitive: this._state.caseSensitive,
174
- matchesTheWholeCell: this._state.matchesTheWholeCell
177
+ matchesTheWholeCell: this._state.matchesTheWholeCell,
178
+ matchesTheWholeWord: this._state.matchesTheWholeWord
175
179
  })))).flat();
176
180
  this._subscribeToModelsChanges(findModels);
177
181
  const newMatches = this._matches = findModels.map((c) => c.getMatches()).flat();
@@ -358,6 +362,7 @@ function createInitFindReplaceState() {
358
362
  matchesCount: 0,
359
363
  matchesPosition: 0,
360
364
  matchesTheWholeCell: false,
365
+ matchesTheWholeWord: false,
361
366
  replaceRevealed: false,
362
367
  replaceString: "",
363
368
  revealed: true
@@ -383,6 +388,7 @@ var FindReplaceState = class {
383
388
  _defineProperty(this, "_matchesCount", 0);
384
389
  _defineProperty(this, "_caseSensitive", true);
385
390
  _defineProperty(this, "_matchesTheWholeCell", false);
391
+ _defineProperty(this, "_matchesTheWholeWord", false);
386
392
  _defineProperty(this, "_findDirection", "row");
387
393
  _defineProperty(this, "_findScope", "subunit");
388
394
  _defineProperty(this, "_findBy", "value");
@@ -418,6 +424,9 @@ var FindReplaceState = class {
418
424
  get matchesTheWholeCell() {
419
425
  return this._matchesTheWholeCell;
420
426
  }
427
+ get matchesTheWholeWord() {
428
+ return this._matchesTheWholeWord;
429
+ }
421
430
  get findDirection() {
422
431
  return this._findDirection;
423
432
  }
@@ -488,6 +497,11 @@ var FindReplaceState = class {
488
497
  changedState.matchesTheWholeCell = changes.matchesTheWholeCell;
489
498
  changed = true;
490
499
  }
500
+ if (typeof changes.matchesTheWholeWord !== "undefined" && changes.matchesTheWholeWord !== this._matchesTheWholeWord) {
501
+ this._matchesTheWholeWord = changes.matchesTheWholeWord;
502
+ changedState.matchesTheWholeWord = changes.matchesTheWholeWord;
503
+ changed = true;
504
+ }
491
505
  if (typeof changes.inputtingFindString !== "undefined" && changes.inputtingFindString !== this._inputtingFindString) {
492
506
  this._inputtingFindString = changes.inputtingFindString;
493
507
  changedState.inputtingFindString = changes.inputtingFindString;
@@ -510,6 +524,7 @@ var FindReplaceState = class {
510
524
  matchesCount: this._matchesCount,
511
525
  matchesPosition: this._matchesPosition,
512
526
  matchesTheWholeCell: this._matchesTheWholeCell,
527
+ matchesTheWholeWord: this._matchesTheWholeWord,
513
528
  replaceRevealed: this._replaceRevealed,
514
529
  revealed: this._revealed
515
530
  });
@@ -530,10 +545,11 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
530
545
  get replaceRevealed() {
531
546
  return this._state.replaceRevealed;
532
547
  }
533
- constructor(_injector, _contextService) {
548
+ constructor(_injector, _contextService, _univerInstanceService) {
534
549
  super();
535
550
  this._injector = _injector;
536
551
  this._contextService = _contextService;
552
+ this._univerInstanceService = _univerInstanceService;
537
553
  _defineProperty(this, "_providers", /* @__PURE__ */ new Set());
538
554
  _defineProperty(this, "_state", new FindReplaceState());
539
555
  _defineProperty(this, "_model", void 0);
@@ -544,6 +560,10 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
544
560
  _defineProperty(this, "replaceables$", this._replaceables$.asObservable());
545
561
  _defineProperty(this, "_focusSignal$", new rxjs.Subject());
546
562
  _defineProperty(this, "focusSignal$", this._focusSignal$.asObservable());
563
+ _defineProperty(this, "_providerCapabilities$", new rxjs.BehaviorSubject(null));
564
+ _defineProperty(this, "providerCapabilities$", this._providerCapabilities$.asObservable());
565
+ _defineProperty(this, "_activeProvider", null);
566
+ this.disposeWithMe((0, _univerjs_core.toDisposable)(this._univerInstanceService.focused$.subscribe(() => this._syncActiveProvider())));
547
567
  }
548
568
  dispose() {
549
569
  super.dispose();
@@ -552,6 +572,7 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
552
572
  this._replaceables$.next([]);
553
573
  this._replaceables$.complete();
554
574
  this._focusSignal$.complete();
575
+ this._providerCapabilities$.complete();
555
576
  }
556
577
  getProviders() {
557
578
  return this._providers;
@@ -582,6 +603,9 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
582
603
  changeMatchesTheWholeCell(matchesTheWholeCell) {
583
604
  this._state.changeState({ matchesTheWholeCell });
584
605
  }
606
+ changeMatchesTheWholeWord(matchesTheWholeWord) {
607
+ this._state.changeState({ matchesTheWholeWord });
608
+ }
585
609
  changeCaseSensitive(caseSensitive) {
586
610
  this._state.changeState({ caseSensitive });
587
611
  }
@@ -631,8 +655,8 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
631
655
  (_this$_model2 = this._model) === null || _this$_model2 === void 0 || _this$_model2.focusSelection();
632
656
  }
633
657
  start(revealReplace = false) {
634
- if (this._providers.size === 0) return false;
635
- this._model = this._injector.createInstance(FindReplaceModel, this._state, this._providers);
658
+ if (!this._activeProvider) return false;
659
+ this._model = this._injector.createInstance(FindReplaceModel, this._state, /* @__PURE__ */ new Set([this._activeProvider]));
636
660
  this._modelDisposables = new _univerjs_core.DisposableCollection();
637
661
  this._modelDisposables.add((0, _univerjs_core.toDisposable)(this._model.currentMatch$.subscribe((match) => this._currentMatch$.next(match))));
638
662
  this._modelDisposables.add((0, _univerjs_core.toDisposable)(this._model.replaceables$.subscribe((replaceables) => this._replaceables$.next(replaceables))));
@@ -657,7 +681,21 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
657
681
  }
658
682
  registerFindReplaceProvider(provider) {
659
683
  this._providers.add(provider);
660
- return (0, _univerjs_core.toDisposable)(() => this._providers.delete(provider));
684
+ this._syncActiveProvider();
685
+ return (0, _univerjs_core.toDisposable)(() => {
686
+ this._providers.delete(provider);
687
+ this._syncActiveProvider();
688
+ });
689
+ }
690
+ _syncActiveProvider() {
691
+ var _Array$from$find, _provider$capabilitie;
692
+ const unit = this._univerInstanceService.getFocusedUnit();
693
+ const provider = unit == null ? null : (_Array$from$find = Array.from(this._providers).find((candidate) => candidate.isSupported(unit))) !== null && _Array$from$find !== void 0 ? _Array$from$find : null;
694
+ if (provider === this._activeProvider) return;
695
+ if (this.revealed) this.terminate();
696
+ this._activeProvider = provider;
697
+ this._providerCapabilities$.next((_provider$capabilitie = provider === null || provider === void 0 ? void 0 : provider.capabilities) !== null && _provider$capabilitie !== void 0 ? _provider$capabilitie : null);
698
+ this._contextService.setContextValue(FIND_REPLACE_AVAILABLE, provider != null);
661
699
  }
662
700
  _toggleRevealReplace(revealReplace) {
663
701
  this._contextService.setContextValue(FIND_REPLACE_REPLACE_REVEALED, revealReplace);
@@ -666,7 +704,11 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
666
704
  this._contextService.setContextValue(_univerjs_engine_render.RENDER_RAW_FORMULA_KEY, force);
667
705
  }
668
706
  };
669
- FindReplaceService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, _univerjs_core.IContextService)], FindReplaceService);
707
+ FindReplaceService = __decorate([
708
+ __decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
709
+ __decorateParam(1, _univerjs_core.IContextService),
710
+ __decorateParam(2, _univerjs_core.IUniverInstanceService)
711
+ ], FindReplaceService);
670
712
 
671
713
  //#endregion
672
714
  //#region src/commands/commands/replace.command.ts
@@ -777,6 +819,10 @@ function FindReplaceMenuItemFactory(accessor) {
777
819
  //#region src/menu/schema.ts
778
820
  const menuSchema = { [_univerjs_ui.RibbonDataGroup.ORGANIZATION]: { [OpenFindDialogOperation.id]: {
779
821
  order: 2,
822
+ gridLayout: {
823
+ row: 1,
824
+ column: 3
825
+ },
780
826
  menuItemFactory: FindReplaceMenuItemFactory
781
827
  } } };
782
828
 
@@ -792,8 +838,8 @@ function whenFindReplaceInputFocused(contextService) {
792
838
  return contextService.getContextValue(FIND_REPLACE_INPUT_FOCUS);
793
839
  }
794
840
  const FIND_REPLACE_SHORTCUT_GROUP = "7_find-replace-shortcuts";
795
- function whenSheetFocused(contextService) {
796
- return contextService.getContextValue(_univerjs_core.FOCUSING_SHEET);
841
+ function whenFindReplaceAvailable(contextService) {
842
+ return contextService.getContextValue(FIND_REPLACE_AVAILABLE);
797
843
  }
798
844
  function whenEditorNotActivated(contextService) {
799
845
  return !contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED);
@@ -805,7 +851,7 @@ const OpenFindDialogShortcutItem = {
805
851
  group: FIND_REPLACE_SHORTCUT_GROUP,
806
852
  groupTitle: "find-replace.shortcut.panel",
807
853
  preconditions(contextService) {
808
- return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
854
+ return !whenFindReplaceDialogFocused(contextService) && whenFindReplaceAvailable(contextService) && whenEditorNotActivated(contextService);
809
855
  }
810
856
  };
811
857
  const MacOpenFindDialogShortcutItem = {
@@ -814,7 +860,7 @@ const MacOpenFindDialogShortcutItem = {
814
860
  binding: _univerjs_ui.KeyCode.F | _univerjs_ui.MetaKeys.CTRL_COMMAND,
815
861
  mac: _univerjs_ui.KeyCode.F | _univerjs_ui.MetaKeys.MAC_CTRL,
816
862
  preconditions(contextService) {
817
- return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
863
+ return !whenFindReplaceDialogFocused(contextService) && whenFindReplaceAvailable(contextService) && whenEditorNotActivated(contextService);
818
864
  }
819
865
  };
820
866
  const OpenReplaceDialogShortcutItem = {
@@ -825,7 +871,7 @@ const OpenReplaceDialogShortcutItem = {
825
871
  group: FIND_REPLACE_SHORTCUT_GROUP,
826
872
  groupTitle: "find-replace.shortcut.panel",
827
873
  preconditions(contextService) {
828
- return whenSheetFocused(contextService) && whenEditorNotActivated(contextService) && (!whenFindReplaceDialogFocused(contextService) || !whenReplaceRevealed(contextService));
874
+ return whenFindReplaceAvailable(contextService) && whenEditorNotActivated(contextService) && (!whenFindReplaceDialogFocused(contextService) || !whenReplaceRevealed(contextService));
829
875
  }
830
876
  };
831
877
  const GoToNextFindMatchShortcutItem = {
@@ -920,13 +966,14 @@ let FindReplaceController = class FindReplaceController extends _univerjs_core.R
920
966
  });
921
967
  }
922
968
  _openPanel() {
969
+ var _this$_univerInstance;
970
+ const sessionUnitId = (_this$_univerInstance = this._univerInstanceService.getFocusedUnit()) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
923
971
  this._dialogService.open({
924
972
  id: FIND_REPLACE_DIALOG_ID,
925
973
  draggable: true,
926
974
  width: FIND_REPLACE_PANEL_WIDTH,
927
975
  title: { title: this._localeService.t("find-replace.dialog.title") },
928
976
  children: { label: "FindReplaceDialog" },
929
- destroyOnClose: true,
930
977
  mask: false,
931
978
  maskClosable: false,
932
979
  defaultPosition: getFindReplaceDialogDefaultPosition(),
@@ -934,7 +981,7 @@ let FindReplaceController = class FindReplaceController extends _univerjs_core.R
934
981
  onClose: () => this.closePanel()
935
982
  });
936
983
  this._closingListenerDisposable = (0, _univerjs_core.toDisposable)(this._univerInstanceService.focused$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((focused) => {
937
- if (!focused || !this._univerInstanceService.getUniverSheetInstance(focused)) this.closePanel();
984
+ if (!focused || focused !== sessionUnitId) this.closePanel();
938
985
  }));
939
986
  }
940
987
  closePanel() {
@@ -967,7 +1014,7 @@ function getFindReplaceDialogDefaultPosition() {
967
1014
  //#endregion
968
1015
  //#region package.json
969
1016
  var name = "@univerjs/find-replace";
970
- var version = "1.0.0-alpha.6";
1017
+ var version = "1.0.0-alpha.8";
971
1018
 
972
1019
  //#endregion
973
1020
  //#region src/config/config.ts
@@ -1092,7 +1139,8 @@ const ReplaceDialog = (0, react.forwardRef)(function ReplaceDialogImpl(_props, r
1092
1139
  const messageService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMessageService);
1093
1140
  const currentMatch = (0, _univerjs_ui.useObservable)(findReplaceService.currentMatch$, void 0, true);
1094
1141
  const replaceables = (0, _univerjs_ui.useObservable)(findReplaceService.replaceables$, void 0, true);
1095
- const { matchesCount, matchesPosition, findString, inputtingFindString, replaceString, caseSensitive, matchesTheWholeCell, findDirection, findScope, findBy, findCompleted } = (0, _univerjs_ui.useObservable)(findReplaceService.state$, void 0, true);
1142
+ const capabilities = (0, _univerjs_ui.useObservable)(findReplaceService.providerCapabilities$, null, true);
1143
+ const { matchesCount, matchesPosition, findString, inputtingFindString, replaceString, caseSensitive, matchesTheWholeCell, matchesTheWholeWord, findDirection, findScope, findBy, findCompleted } = (0, _univerjs_ui.useObservable)(findReplaceService.state$, void 0, true);
1096
1144
  const findDisabled = inputtingFindString.length === 0;
1097
1145
  const replaceDisabled = matchesCount === 0 || !(currentMatch === null || currentMatch === void 0 ? void 0 : currentMatch.replaceable);
1098
1146
  const replaceAllDisabled = replaceables.length === 0;
@@ -1114,7 +1162,7 @@ const ReplaceDialog = (0, react.forwardRef)(function ReplaceDialogImpl(_props, r
1114
1162
  const onClickReplaceAllButton = (0, react.useCallback)(async () => {
1115
1163
  await commandService.executeCommand(ReplaceAllMatchesCommand.id);
1116
1164
  focus();
1117
- }, [commandService]);
1165
+ }, [commandService, focus]);
1118
1166
  const onChangeFindDirection = (0, react.useCallback)((findDirection) => {
1119
1167
  findReplaceService.changeFindDirection(findDirection);
1120
1168
  }, [findReplaceService]);
@@ -1169,7 +1217,7 @@ const ReplaceDialog = (0, react.forwardRef)(function ReplaceDialogImpl(_props, r
1169
1217
  onChange: (value) => onReplaceStringChange(value)
1170
1218
  })
1171
1219
  }),
1172
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1220
+ (capabilities === null || capabilities === void 0 ? void 0 : capabilities.findDirection) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1173
1221
  label: localeService.t("find-replace.dialog.find-direction.title"),
1174
1222
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
1175
1223
  value: findDirection,
@@ -1177,14 +1225,14 @@ const ReplaceDialog = (0, react.forwardRef)(function ReplaceDialogImpl(_props, r
1177
1225
  onChange: onChangeFindDirection
1178
1226
  })
1179
1227
  }),
1180
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormDualColumnLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1228
+ ((capabilities === null || capabilities === void 0 ? void 0 : capabilities.findScope) || (capabilities === null || capabilities === void 0 ? void 0 : capabilities.findBy)) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormDualColumnLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [capabilities.findScope && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1181
1229
  label: localeService.t("find-replace.dialog.find-scope.title"),
1182
1230
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
1183
1231
  value: findScope,
1184
1232
  options: findScopeOptions,
1185
1233
  onChange: onChangeFindScope
1186
1234
  })
1187
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1235
+ }), capabilities.findBy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
1188
1236
  label: localeService.t("find-replace.dialog.find-by.title"),
1189
1237
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Select, {
1190
1238
  value: findBy,
@@ -1192,19 +1240,29 @@ const ReplaceDialog = (0, react.forwardRef)(function ReplaceDialogImpl(_props, r
1192
1240
  onChange: onChangeFindBy
1193
1241
  })
1194
1242
  })] }) }),
1195
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormDualColumnLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1196
- checked: caseSensitive,
1197
- onChange: (checked) => {
1198
- findReplaceService.changeCaseSensitive(checked);
1199
- },
1200
- children: localeService.t("find-replace.dialog.case-sensitive")
1201
- }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1202
- checked: matchesTheWholeCell,
1203
- onChange: (checked) => {
1204
- findReplaceService.changeMatchesTheWholeCell(checked);
1205
- },
1206
- children: localeService.t("find-replace.dialog.match-the-whole-cell")
1207
- }) })] }) }),
1243
+ ((capabilities === null || capabilities === void 0 ? void 0 : capabilities.caseSensitive) || (capabilities === null || capabilities === void 0 ? void 0 : capabilities.matchesTheWholeCell) || (capabilities === null || capabilities === void 0 ? void 0 : capabilities.matchesTheWholeWord)) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormDualColumnLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1244
+ capabilities.caseSensitive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1245
+ checked: caseSensitive,
1246
+ onChange: (checked) => {
1247
+ findReplaceService.changeCaseSensitive(checked);
1248
+ if (findCompleted) findReplaceService.find();
1249
+ },
1250
+ children: localeService.t("find-replace.dialog.case-sensitive")
1251
+ }) }),
1252
+ capabilities.matchesTheWholeCell && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1253
+ checked: matchesTheWholeCell,
1254
+ onChange: (checked) => findReplaceService.changeMatchesTheWholeCell(checked),
1255
+ children: localeService.t("find-replace.dialog.match-the-whole-cell")
1256
+ }) }),
1257
+ capabilities.matchesTheWholeWord && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
1258
+ checked: matchesTheWholeWord,
1259
+ onChange: (checked) => {
1260
+ findReplaceService.changeMatchesTheWholeWord(checked);
1261
+ if (findCompleted) findReplaceService.find();
1262
+ },
1263
+ children: localeService.t("find-replace.dialog.match-the-whole-word")
1264
+ }) })
1265
+ ] }) }),
1208
1266
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1209
1267
  className: "univer-mt-6 univer-flex univer-justify-between",
1210
1268
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
@@ -1234,9 +1292,10 @@ function FindReplaceDialog() {
1234
1292
  const state = (0, _univerjs_ui.useObservable)(findReplaceService.state$, void 0, true);
1235
1293
  const dialogContainerRef = (0, react.useRef)(null);
1236
1294
  (0, react.useEffect)(() => {
1237
- let disposable;
1238
- if (dialogContainerRef.current) disposable = layoutService.registerContainerElement(dialogContainerRef.current);
1239
- return () => disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
1295
+ const container = dialogContainerRef.current;
1296
+ if (!container) return;
1297
+ const disposable = layoutService.registerContainerElement(container);
1298
+ return () => disposable.dispose();
1240
1299
  }, [layoutService]);
1241
1300
  const focusRef = (0, react.useRef)(null);
1242
1301
  const setDialogContainerFocus = (0, react.useCallback)((focused) => contextService.setContextValue(FIND_REPLACE_DIALOG_FOCUS, focused), [contextService]);
@@ -1324,7 +1383,11 @@ let UniverFindReplacePlugin = class UniverFindReplacePlugin extends _univerjs_co
1324
1383
  _defineProperty(UniverFindReplacePlugin, "pluginName", "UNIVER_FIND_REPLACE_PLUGIN");
1325
1384
  _defineProperty(UniverFindReplacePlugin, "packageName", name);
1326
1385
  _defineProperty(UniverFindReplacePlugin, "version", version);
1327
- UniverFindReplacePlugin = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(2, _univerjs_core.IConfigService)], UniverFindReplacePlugin);
1386
+ UniverFindReplacePlugin = __decorate([
1387
+ (0, _univerjs_core.DependentOn)(_univerjs_ui.UniverUIPlugin),
1388
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1389
+ __decorateParam(2, _univerjs_core.IConfigService)
1390
+ ], UniverFindReplacePlugin);
1328
1391
 
1329
1392
  //#endregion
1330
1393
  exports.FindBy = FindBy;
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "استبدال",
18
18
  "replace-all": "استبدال الكل",
19
19
  "case-sensitive": "حساس لحالة الأحرف",
20
- "find-placeholder": "البحث في هذه الورقة",
20
+ "find-placeholder": "البحث",
21
21
  "advanced-finding": "بحث واستبدال متقدم",
22
22
  "replace-placeholder": "أدخل نص الاستبدال",
23
23
  "match-the-whole-cell": "تطابق الخلية بأكملها",
24
+ "match-the-whole-word": "مطابقة الكلمة بالكامل",
24
25
  "find-direction": {
25
26
  title: "اتجاه البحث",
26
27
  row: "البحث حسب الصف",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Reemplaça",
18
18
  "replace-all": "Reemplaça-ho tot",
19
19
  "case-sensitive": "Distingeix majúscules de minúscules",
20
- "find-placeholder": "Cerca en aquest full",
20
+ "find-placeholder": "Cerca",
21
21
  "advanced-finding": "Cerca i reemplaçament avançats",
22
22
  "replace-placeholder": "Introduïu la cadena de reemplaçament",
23
23
  "match-the-whole-cell": "Coincidir amb la cel·la sencera",
24
+ "match-the-whole-word": "Coincideix amb la paraula sencera",
24
25
  "find-direction": {
25
26
  title: "Direcció de la cerca",
26
27
  row: "Cerca per fila",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Ersetzen",
18
18
  "replace-all": "Alle ersetzen",
19
19
  "case-sensitive": "Groß-/Kleinschreibung beachten",
20
- "find-placeholder": "In diesem Blatt suchen",
20
+ "find-placeholder": "Suchen",
21
21
  "advanced-finding": "Erweitertes Suchen & Ersetzen",
22
22
  "replace-placeholder": "Ersetzungstext eingeben",
23
23
  "match-the-whole-cell": "Ganze Zelle vergleichen",
24
+ "match-the-whole-word": "Nur ganzes Wort",
24
25
  "find-direction": {
25
26
  title: "Suchrichtung",
26
27
  row: "Nach Zeile suchen",
@@ -32,10 +32,11 @@ const locale = { "find-replace": {
32
32
  replace: "Replace",
33
33
  "replace-all": "Replace All",
34
34
  "case-sensitive": "Case Sensitive",
35
- "find-placeholder": "Find in this Sheet",
35
+ "find-placeholder": "Find",
36
36
  "advanced-finding": "Advanced Searching & Replace",
37
37
  "replace-placeholder": "Input Replace String",
38
38
  "match-the-whole-cell": "Match the Whole Cell",
39
+ "match-the-whole-word": "Match Whole Word",
39
40
  "find-direction": {
40
41
  title: "Find Direction",
41
42
  row: "Search by Row",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Reemplazar",
18
18
  "replace-all": "Reemplazar todo",
19
19
  "case-sensitive": "Distinguir mayúsculas y minúsculas",
20
- "find-placeholder": "Buscar en esta hoja",
20
+ "find-placeholder": "Buscar",
21
21
  "advanced-finding": "Búsqueda y reemplazo avanzados",
22
22
  "replace-placeholder": "Introducir cadena de reemplazo",
23
23
  "match-the-whole-cell": "Coincidir con toda la celda",
24
+ "match-the-whole-word": "Coincidir con la palabra completa",
24
25
  "find-direction": {
25
26
  title: "Dirección de búsqueda",
26
27
  row: "Buscar por fila",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "جایگزینی",
18
18
  "replace-all": "جایگزینی همه",
19
19
  "case-sensitive": "حساس به حروف بزرگ و کوچک",
20
- "find-placeholder": "جستجو در این شیت",
20
+ "find-placeholder": "جستجو",
21
21
  "advanced-finding": "جستجو و جایگزینی پیشرفته",
22
22
  "replace-placeholder": "رشته جایگزینی را وارد کنید",
23
23
  "match-the-whole-cell": "تطابق کل سلول",
24
+ "match-the-whole-word": "تطبیق کل کلمه",
24
25
  "find-direction": {
25
26
  title: "جهت جستجو",
26
27
  row: "جستجو بر اساس ردیف",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Remplacer",
18
18
  "replace-all": "Remplacer tout",
19
19
  "case-sensitive": "Sensible à la casse",
20
- "find-placeholder": "Rechercher dans cette feuille",
20
+ "find-placeholder": "Rechercher",
21
21
  "advanced-finding": "Recherche et remplacement avancés",
22
22
  "replace-placeholder": "Saisir la chaîne de remplacement",
23
23
  "match-the-whole-cell": "Correspondance de la cellule entière",
24
+ "match-the-whole-word": "Mot entier",
24
25
  "find-direction": {
25
26
  title: "Direction de la recherche",
26
27
  row: "Rechercher par ligne",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Ganti",
18
18
  "replace-all": "Ganti Semua",
19
19
  "case-sensitive": "Sensitif Huruf",
20
- "find-placeholder": "Cari di Lembar ini",
20
+ "find-placeholder": "Cari",
21
21
  "advanced-finding": "Pencarian & Penggantian Lanjutan",
22
22
  "replace-placeholder": "Masukkan String Pengganti",
23
23
  "match-the-whole-cell": "Cocokkan Seluruh Sel",
24
+ "match-the-whole-word": "Cocokkan seluruh kata",
24
25
  "find-direction": {
25
26
  title: "Arah Cari",
26
27
  row: "Cari per Baris",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Sostituisci",
18
18
  "replace-all": "Sostituisci tutto",
19
19
  "case-sensitive": "Maiuscole/minuscole",
20
- "find-placeholder": "Trova in questo foglio",
20
+ "find-placeholder": "Trova",
21
21
  "advanced-finding": "Ricerca e sostituzione avanzate",
22
22
  "replace-placeholder": "Inserisci stringa di sostituzione",
23
23
  "match-the-whole-cell": "Corrispondenza con l'intera cella",
24
+ "match-the-whole-word": "Trova parola intera",
24
25
  "find-direction": {
25
26
  title: "Direzione ricerca",
26
27
  row: "Cerca per riga",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "置換",
18
18
  "replace-all": "すべて置換",
19
19
  "case-sensitive": "大文字と小文字を区別",
20
- "find-placeholder": "このシート内を検索",
20
+ "find-placeholder": "検索",
21
21
  "advanced-finding": "詳細検索と置換",
22
22
  "replace-placeholder": "置換文字列を入力",
23
23
  "match-the-whole-cell": "セル全体に一致",
24
+ "match-the-whole-word": "単語単位で検索",
24
25
  "find-direction": {
25
26
  title: "検索方向",
26
27
  row: "行ごとに検索",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "바꾸기",
18
18
  "replace-all": "모두 바꾸기",
19
19
  "case-sensitive": "대/소문자 구분",
20
- "find-placeholder": "이 시트에서 찾기",
20
+ "find-placeholder": "찾기",
21
21
  "advanced-finding": "고급 검색 및 바꾸기",
22
22
  "replace-placeholder": "바꿀 문자열 입력",
23
23
  "match-the-whole-cell": "전체 셀 내용 일치",
24
+ "match-the-whole-word": "단어 단위로 일치",
24
25
  "find-direction": {
25
26
  title: "검색 방향",
26
27
  row: "행 기준 검색",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Zamień",
18
18
  "replace-all": "Zamień wszystko",
19
19
  "case-sensitive": "Rozróżniaj wielkość liter",
20
- "find-placeholder": "Znajdź w tym arkuszu",
20
+ "find-placeholder": "Znajdź",
21
21
  "advanced-finding": "Zaawansowane wyszukiwanie i zastępowanie",
22
22
  "replace-placeholder": "Wprowadź ciąg zastępujący",
23
23
  "match-the-whole-cell": "Dopasuj całą komórkę",
24
+ "match-the-whole-word": "Dopasuj całe słowo",
24
25
  "find-direction": {
25
26
  title: "Kierunek wyszukiwania",
26
27
  row: "Szukaj według wierszy",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Substituir",
18
18
  "replace-all": "Substituir Tudo",
19
19
  "case-sensitive": "Diferenciar Maiúsculas/Minúsculas",
20
- "find-placeholder": "Localizar nesta Planilha",
20
+ "find-placeholder": "Localizar",
21
21
  "advanced-finding": "Pesquisa e Substituição Avançadas",
22
22
  "replace-placeholder": "Digite o Texto de Substituição",
23
23
  "match-the-whole-cell": "Corresponder à Célula Inteira",
24
+ "match-the-whole-word": "Corresponder palavra inteira",
24
25
  "find-direction": {
25
26
  title: "Direção da Pesquisa",
26
27
  row: "Pesquisar por Linha",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Заменить",
18
18
  "replace-all": "Заменить все",
19
19
  "case-sensitive": "Учитывать регистр",
20
- "find-placeholder": "Найти на этом листе",
20
+ "find-placeholder": "Найти",
21
21
  "advanced-finding": "Расширенный поиск и замена",
22
22
  "replace-placeholder": "Введите строку для замены",
23
23
  "match-the-whole-cell": "Соответствие всей ячейке",
24
+ "match-the-whole-word": "Только слово целиком",
24
25
  "find-direction": {
25
26
  title: "Направление поиска",
26
27
  row: "Искать по строкам",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Nahradiť",
18
18
  "replace-all": "Nahradiť všetko",
19
19
  "case-sensitive": "Rozlišovať veľké a malé písmená",
20
- "find-placeholder": "Hľadať v tomto hárku",
20
+ "find-placeholder": "Hľadať",
21
21
  "advanced-finding": "Pokročilé hľadanie a nahradenie",
22
22
  "replace-placeholder": "Zadajte reťazec na nahradenie",
23
23
  "match-the-whole-cell": "Zhoda s celou bunkou",
24
+ "match-the-whole-word": "Hľadať iba celé slová",
24
25
  "find-direction": {
25
26
  title: "Smer hľadania",
26
27
  row: "Hľadať podľa riadkov",
@@ -17,10 +17,11 @@ const locale = { "find-replace": {
17
17
  replace: "Thay thế",
18
18
  "replace-all": "Thay thế Tất cả",
19
19
  "case-sensitive": "Phân biệt chữ hoa chữ thường",
20
- "find-placeholder": "Tìm trong Trang tính này",
20
+ "find-placeholder": "Tìm",
21
21
  "advanced-finding": "Tìm kiếm & Thay thế Nâng cao",
22
22
  "replace-placeholder": "Nhập chuỗi thay thế",
23
23
  "match-the-whole-cell": "Khớp toàn bộ ô",
24
+ "match-the-whole-word": "Khớp toàn bộ từ",
24
25
  "find-direction": {
25
26
  title: "Hướng tìm kiếm",
26
27
  row: "Tìm theo hàng",
@@ -21,6 +21,7 @@ const locale = { "find-replace": {
21
21
  "replace-placeholder": "输入替换内容",
22
22
  "case-sensitive": "匹配大小写",
23
23
  "match-the-whole-cell": "匹配整个单元格",
24
+ "match-the-whole-word": "全词匹配",
24
25
  "find-scope": {
25
26
  title: "查找范围",
26
27
  "current-sheet": "当前子表",