@univerjs/sheets-find-replace 0.24.0 → 0.25.0-insiders.20260604-29ebbff

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 (72) hide show
  1. package/lib/cjs/facade.js +6 -6
  2. package/lib/cjs/index.js +25 -27
  3. package/lib/es/facade.js +6 -6
  4. package/lib/es/index.js +24 -26
  5. package/lib/facade.js +6 -6
  6. package/lib/index.js +24 -26
  7. package/lib/types/facade/f-text-finder.d.ts +18 -9
  8. package/lib/types/facade/f-univer.d.ts +2 -1
  9. package/lib/umd/facade.js +1 -1
  10. package/lib/umd/index.js +1 -1
  11. package/package.json +8 -13
  12. package/LICENSE +0 -176
  13. package/lib/cjs/locale/ca-ES.js +0 -9
  14. package/lib/cjs/locale/en-US.js +0 -24
  15. package/lib/cjs/locale/es-ES.js +0 -9
  16. package/lib/cjs/locale/fa-IR.js +0 -9
  17. package/lib/cjs/locale/fr-FR.js +0 -9
  18. package/lib/cjs/locale/ja-JP.js +0 -9
  19. package/lib/cjs/locale/ko-KR.js +0 -9
  20. package/lib/cjs/locale/ru-RU.js +0 -9
  21. package/lib/cjs/locale/sk-SK.js +0 -9
  22. package/lib/cjs/locale/vi-VN.js +0 -9
  23. package/lib/cjs/locale/zh-CN.js +0 -24
  24. package/lib/cjs/locale/zh-TW.js +0 -9
  25. package/lib/es/locale/ca-ES.js +0 -8
  26. package/lib/es/locale/en-US.js +0 -23
  27. package/lib/es/locale/es-ES.js +0 -8
  28. package/lib/es/locale/fa-IR.js +0 -8
  29. package/lib/es/locale/fr-FR.js +0 -8
  30. package/lib/es/locale/ja-JP.js +0 -8
  31. package/lib/es/locale/ko-KR.js +0 -8
  32. package/lib/es/locale/ru-RU.js +0 -8
  33. package/lib/es/locale/sk-SK.js +0 -8
  34. package/lib/es/locale/vi-VN.js +0 -8
  35. package/lib/es/locale/zh-CN.js +0 -23
  36. package/lib/es/locale/zh-TW.js +0 -8
  37. package/lib/locale/ca-ES.js +0 -8
  38. package/lib/locale/en-US.js +0 -23
  39. package/lib/locale/es-ES.js +0 -8
  40. package/lib/locale/fa-IR.js +0 -8
  41. package/lib/locale/fr-FR.js +0 -8
  42. package/lib/locale/ja-JP.js +0 -8
  43. package/lib/locale/ko-KR.js +0 -8
  44. package/lib/locale/ru-RU.js +0 -8
  45. package/lib/locale/sk-SK.js +0 -8
  46. package/lib/locale/vi-VN.js +0 -8
  47. package/lib/locale/zh-CN.js +0 -23
  48. package/lib/locale/zh-TW.js +0 -8
  49. package/lib/types/locale/ca-ES.d.ts +0 -18
  50. package/lib/types/locale/en-US.d.ts +0 -24
  51. package/lib/types/locale/es-ES.d.ts +0 -18
  52. package/lib/types/locale/fa-IR.d.ts +0 -18
  53. package/lib/types/locale/fr-FR.d.ts +0 -18
  54. package/lib/types/locale/ja-JP.d.ts +0 -18
  55. package/lib/types/locale/ko-KR.d.ts +0 -18
  56. package/lib/types/locale/ru-RU.d.ts +0 -18
  57. package/lib/types/locale/sk-SK.d.ts +0 -18
  58. package/lib/types/locale/vi-VN.d.ts +0 -18
  59. package/lib/types/locale/zh-CN.d.ts +0 -24
  60. package/lib/types/locale/zh-TW.d.ts +0 -18
  61. package/lib/umd/locale/ca-ES.js +0 -1
  62. package/lib/umd/locale/en-US.js +0 -1
  63. package/lib/umd/locale/es-ES.js +0 -1
  64. package/lib/umd/locale/fa-IR.js +0 -1
  65. package/lib/umd/locale/fr-FR.js +0 -1
  66. package/lib/umd/locale/ja-JP.js +0 -1
  67. package/lib/umd/locale/ko-KR.js +0 -1
  68. package/lib/umd/locale/ru-RU.js +0 -1
  69. package/lib/umd/locale/sk-SK.js +0 -1
  70. package/lib/umd/locale/vi-VN.js +0 -1
  71. package/lib/umd/locale/zh-CN.js +0 -1
  72. package/lib/umd/locale/zh-TW.js +0 -1
package/lib/cjs/facade.js CHANGED
@@ -4,7 +4,7 @@ let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
4
4
  let rxjs = require("rxjs");
5
5
  let _univerjs_core_facade = require("@univerjs/core/facade");
6
6
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
7
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
8
8
  function _typeof(o) {
9
9
  "@babel/helpers - typeof";
10
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +15,7 @@ function _typeof(o) {
15
15
  }
16
16
 
17
17
  //#endregion
18
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
19
19
  function toPrimitive(t, r) {
20
20
  if ("object" != _typeof(t) || !t) return t;
21
21
  var e = t[Symbol.toPrimitive];
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
32
32
  function toPropertyKey(t) {
33
33
  var i = toPrimitive(t, "string");
34
34
  return "symbol" == _typeof(i) ? i : i + "";
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
39
39
  function _defineProperty(e, r, t) {
40
40
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
41
  value: t,
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
50
50
  function __decorateParam(paramIndex, decorator) {
51
51
  return function(target, key) {
52
52
  decorator(target, key, paramIndex);
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
57
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
58
58
  function __decorate(decorators, target, key, desc) {
59
59
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
60
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
package/lib/cjs/index.js CHANGED
@@ -43,7 +43,7 @@ function getReplaceAllResult(results, replacements) {
43
43
  }
44
44
 
45
45
  //#endregion
46
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
46
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
47
47
  function _typeof(o) {
48
48
  "@babel/helpers - typeof";
49
49
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -54,7 +54,7 @@ function _typeof(o) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
57
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
58
58
  function toPrimitive(t, r) {
59
59
  if ("object" != _typeof(t) || !t) return t;
60
60
  var e = t[Symbol.toPrimitive];
@@ -67,14 +67,14 @@ function toPrimitive(t, r) {
67
67
  }
68
68
 
69
69
  //#endregion
70
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
70
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
71
71
  function toPropertyKey(t) {
72
72
  var i = toPrimitive(t, "string");
73
73
  return "symbol" == _typeof(i) ? i : i + "";
74
74
  }
75
75
 
76
76
  //#endregion
77
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
77
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
78
78
  function _defineProperty(e, r, t) {
79
79
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
80
80
  value: t,
@@ -162,7 +162,7 @@ function isSelectionSingleCell(selection, worksheet) {
162
162
  }
163
163
 
164
164
  //#endregion
165
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
165
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
166
166
  function __decorateParam(paramIndex, decorator) {
167
167
  return function(target, key) {
168
168
  decorator(target, key, paramIndex);
@@ -170,7 +170,7 @@ function __decorateParam(paramIndex, decorator) {
170
170
  }
171
171
 
172
172
  //#endregion
173
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
173
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
174
174
  function __decorate(decorators, target, key, desc) {
175
175
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
176
176
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -527,14 +527,17 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
527
527
  _getSheetObject() {
528
528
  return (0, _univerjs_sheets_ui.getSheetObject)(this._univerInstanceService, this._renderManagerService);
529
529
  }
530
- _focusMatch(match) {
530
+ async _focusMatch(match) {
531
531
  var _this$_workbook$getAc;
532
- const subUnitId = match.range.subUnitId;
533
- if (subUnitId !== ((_this$_workbook$getAc = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc === void 0 ? void 0 : _this$_workbook$getAc.getSheetId())) this._commandService.executeCommand(_univerjs_sheets.SetWorksheetActivateCommand.id, {
534
- unitId: this._workbook.getUnitId(),
535
- subUnitId
536
- }, { fromFindReplace: true });
537
- this._commandService.executeCommand(_univerjs_sheets_ui.ScrollToCellCommand.id, { range: match.range.range }, { fromFindReplace: true });
532
+ const { subUnitId, range } = match.range;
533
+ if (subUnitId !== ((_this$_workbook$getAc = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc === void 0 ? void 0 : _this$_workbook$getAc.getSheetId())) {
534
+ const unitId = this._workbook.getUnitId();
535
+ await this._commandService.executeCommand(_univerjs_sheets.SetWorksheetActivateCommand.id, {
536
+ unitId,
537
+ subUnitId
538
+ }, { fromFindReplace: true });
539
+ }
540
+ this._commandService.executeCommand(_univerjs_sheets_ui.ScrollToCellCommand.id, { range }, { fromFindReplace: true });
538
541
  }
539
542
  _tryRestoreLastMatchesPosition(lastMatch, newMatches) {
540
543
  if (!lastMatch) return 0;
@@ -556,13 +559,12 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
556
559
  const ignoreSelection = (_params$ignoreSelecti = params === null || params === void 0 ? void 0 : params.ignoreSelection) !== null && _params$ignoreSelecti !== void 0 ? _params$ignoreSelecti : false;
557
560
  const matchToMove = this._findNextMatch(loop, stayIfOnMatch, ignoreSelection);
558
561
  if (matchToMove) {
559
- var _this$_workbook$getAc2;
560
562
  const [match, index] = matchToMove;
561
563
  this._matchesPosition = index + 1;
562
564
  if (this._query.findScope === _univerjs_find_replace.FindScope.UNIT) this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match);
563
565
  else this._activeHighlightIndex = index;
564
566
  if (!noFocus) this._focusMatch(match);
565
- if (((_this$_workbook$getAc2 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc2 === void 0 ? void 0 : _this$_workbook$getAc2.getSheetId()) === match.range.subUnitId) this._updateCurrentHighlightShape(this._activeHighlightIndex);
567
+ this._updateCurrentHighlightShape(this._activeHighlightIndex);
566
568
  return match;
567
569
  }
568
570
  this._matchesPosition = 0;
@@ -578,13 +580,12 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
578
580
  const ignoreSelection = (_params$ignoreSelecti2 = params === null || params === void 0 ? void 0 : params.ignoreSelection) !== null && _params$ignoreSelecti2 !== void 0 ? _params$ignoreSelecti2 : false;
579
581
  const matchToMove = this._findPreviousMatch(loop, stayIfOnMatch, ignoreSelection);
580
582
  if (matchToMove) {
581
- var _this$_workbook$getAc3;
582
583
  const [match, index] = matchToMove;
583
584
  this._matchesPosition = index + 1;
584
585
  if (this._query.findScope === _univerjs_find_replace.FindScope.UNIT) this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match);
585
586
  else this._activeHighlightIndex = index;
586
587
  if (!noFocus) this._focusMatch(match);
587
- if (((_this$_workbook$getAc3 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc3 === void 0 ? void 0 : _this$_workbook$getAc3.getSheetId()) === match.range.subUnitId) this._updateCurrentHighlightShape(this._activeHighlightIndex);
588
+ this._updateCurrentHighlightShape(this._activeHighlightIndex);
588
589
  return match;
589
590
  }
590
591
  this._matchesPosition = 0;
@@ -592,7 +593,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
592
593
  return null;
593
594
  }
594
595
  _findPreviousMatch(loop = false, stayIfOnMatch = false, ignoreSelection = false) {
595
- var _this$_workbook$getAc4;
596
+ var _this$_workbook$getAc2;
596
597
  if (this.currentMatch) {
597
598
  const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
598
599
  if (stayIfOnMatch) return [this.currentMatch, currentMatchIndex];
@@ -608,14 +609,14 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
608
609
  return [this._matches[lastIndex], lastIndex];
609
610
  }
610
611
  if (this._query.findScope !== _univerjs_find_replace.FindScope.UNIT) return this._findPreviousMatchByRange(this._matches, lastSelection.range);
611
- const currentSheetId = (_this$_workbook$getAc4 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc4 === void 0 ? void 0 : _this$_workbook$getAc4.getSheetId();
612
+ const currentSheetId = (_this$_workbook$getAc2 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc2 === void 0 ? void 0 : _this$_workbook$getAc2.getSheetId();
612
613
  if (!currentSheetId) return null;
613
614
  const worksheetThatHasMatch = this._findPreviousWorksheetThatHasAMatch(currentSheetId, loop);
614
615
  if (!worksheetThatHasMatch) return null;
615
616
  return this._findPreviousMatchByRange(this._matchesByWorksheet.get(worksheetThatHasMatch), lastSelection.range);
616
617
  }
617
618
  _findNextMatch(loop = false, stayIfOnMatch = false, ignoreSelection = false) {
618
- var _this$_workbook$getAc5;
619
+ var _this$_workbook$getAc3;
619
620
  if (this.currentMatch) {
620
621
  const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
621
622
  if (stayIfOnMatch) return [this.currentMatch, currentMatchIndex];
@@ -628,7 +629,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
628
629
  const last = this._workbookSelections.getCurrentLastSelection();
629
630
  if (ignoreSelection || !last) return [this._matches[0], 0];
630
631
  if (this._query.findScope !== _univerjs_find_replace.FindScope.UNIT) return this._findNextMatchByRange(this._matches, last.range, stayIfOnMatch);
631
- const currentSheetId = (_this$_workbook$getAc5 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc5 === void 0 ? void 0 : _this$_workbook$getAc5.getSheetId();
632
+ const currentSheetId = (_this$_workbook$getAc3 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc3 === void 0 ? void 0 : _this$_workbook$getAc3.getSheetId();
632
633
  if (!currentSheetId) return null;
633
634
  const worksheetThatHasMatch = this._findNextWorksheetThatHasAMatch(currentSheetId, loop);
634
635
  if (!worksheetThatHasMatch) return null;
@@ -722,7 +723,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
722
723
  if (match.isFormula) {
723
724
  if (!shouldReplaceFormula) return null;
724
725
  return {
725
- f: currentContent.f.replace(new RegExp(escapeRegExp(findString), replaceFlag), replaceString),
726
+ f: currentContent.f.replace(new RegExp((0, _univerjs_core.escapeRegExp)(findString), replaceFlag), replaceString),
726
727
  v: null
727
728
  };
728
729
  }
@@ -731,7 +732,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
731
732
  (0, _univerjs_core.replaceInDocumentBody)(clonedRichText.body, findString, replaceString, this._query.caseSensitive);
732
733
  return { p: clonedRichText };
733
734
  }
734
- return { v: currentContent.v.toString().replace(new RegExp(escapeRegExp(findString), replaceFlag), replaceString) };
735
+ return { v: currentContent.v.toString().replace(new RegExp((0, _univerjs_core.escapeRegExp)(findString), replaceFlag), replaceString) };
735
736
  }
736
737
  };
737
738
  SheetFindModel = __decorate([
@@ -742,9 +743,6 @@ SheetFindModel = __decorate([
742
743
  __decorateParam(6, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService)),
743
744
  __decorateParam(7, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetsSelectionsService))
744
745
  ], SheetFindModel);
745
- function escapeRegExp(text) {
746
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
747
- }
748
746
  /**
749
747
  * This module is responsible for searching and replacing in the sheets.
750
748
  * It also adds the search results to the search view by highlighting them.
@@ -870,7 +868,7 @@ function trimLeadingTrailingWhitespace(value) {
870
868
  //#endregion
871
869
  //#region package.json
872
870
  var name = "@univerjs/sheets-find-replace";
873
- var version = "0.24.0";
871
+ var version = "0.25.0-insiders.20260604-29ebbff";
874
872
 
875
873
  //#endregion
876
874
  //#region src/config/config.ts
package/lib/es/facade.js CHANGED
@@ -4,7 +4,7 @@ import { FRange } from "@univerjs/sheets/facade";
4
4
  import { filter, firstValueFrom } from "rxjs";
5
5
  import { FUniver } from "@univerjs/core/facade";
6
6
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
7
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
8
8
  function _typeof(o) {
9
9
  "@babel/helpers - typeof";
10
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +15,7 @@ function _typeof(o) {
15
15
  }
16
16
 
17
17
  //#endregion
18
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
19
19
  function toPrimitive(t, r) {
20
20
  if ("object" != _typeof(t) || !t) return t;
21
21
  var e = t[Symbol.toPrimitive];
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
32
32
  function toPropertyKey(t) {
33
33
  var i = toPrimitive(t, "string");
34
34
  return "symbol" == _typeof(i) ? i : i + "";
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
39
39
  function _defineProperty(e, r, t) {
40
40
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
41
  value: t,
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
50
50
  function __decorateParam(paramIndex, decorator) {
51
51
  return function(target, key) {
52
52
  decorator(target, key, paramIndex);
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
57
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
58
58
  function __decorate(decorators, target, key, desc) {
59
59
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
60
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
package/lib/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ColorKit, CommandType, DependentOn, Disposable, EDITOR_ACTIVATED, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, Rectangle, ThemeService, Tools, UniverInstanceType, fromCallback, groupBy, merge, replaceInDocumentBody, rotate } from "@univerjs/core";
1
+ import { ColorKit, CommandType, DependentOn, Disposable, EDITOR_ACTIVATED, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, Rectangle, ThemeService, Tools, UniverInstanceType, escapeRegExp, fromCallback, groupBy, merge, replaceInDocumentBody, rotate } from "@univerjs/core";
2
2
  import { SelectRangeCommand, SetRangeValuesCommand, SetSelectionsOperation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SheetsSelectionsService, UniverSheetsPlugin } from "@univerjs/sheets";
3
3
  import { IRenderManagerService, RENDER_RAW_FORMULA_KEY, Rect, Shape } from "@univerjs/engine-render";
4
4
  import { FindBy, FindDirection, FindModel, FindReplaceController, FindScope, IFindReplaceService, UniverFindReplacePlugin } from "@univerjs/find-replace";
@@ -42,7 +42,7 @@ function getReplaceAllResult(results, replacements) {
42
42
  }
43
43
 
44
44
  //#endregion
45
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
45
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
46
46
  function _typeof(o) {
47
47
  "@babel/helpers - typeof";
48
48
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -53,7 +53,7 @@ function _typeof(o) {
53
53
  }
54
54
 
55
55
  //#endregion
56
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
56
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
57
57
  function toPrimitive(t, r) {
58
58
  if ("object" != _typeof(t) || !t) return t;
59
59
  var e = t[Symbol.toPrimitive];
@@ -66,14 +66,14 @@ function toPrimitive(t, r) {
66
66
  }
67
67
 
68
68
  //#endregion
69
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
70
70
  function toPropertyKey(t) {
71
71
  var i = toPrimitive(t, "string");
72
72
  return "symbol" == _typeof(i) ? i : i + "";
73
73
  }
74
74
 
75
75
  //#endregion
76
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
76
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
77
77
  function _defineProperty(e, r, t) {
78
78
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
79
79
  value: t,
@@ -161,7 +161,7 @@ function isSelectionSingleCell(selection, worksheet) {
161
161
  }
162
162
 
163
163
  //#endregion
164
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
164
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
165
165
  function __decorateParam(paramIndex, decorator) {
166
166
  return function(target, key) {
167
167
  decorator(target, key, paramIndex);
@@ -169,7 +169,7 @@ function __decorateParam(paramIndex, decorator) {
169
169
  }
170
170
 
171
171
  //#endregion
172
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
172
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
173
173
  function __decorate(decorators, target, key, desc) {
174
174
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
175
175
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -526,14 +526,17 @@ let SheetFindModel = class SheetFindModel extends FindModel {
526
526
  _getSheetObject() {
527
527
  return getSheetObject(this._univerInstanceService, this._renderManagerService);
528
528
  }
529
- _focusMatch(match) {
529
+ async _focusMatch(match) {
530
530
  var _this$_workbook$getAc;
531
- const subUnitId = match.range.subUnitId;
532
- if (subUnitId !== ((_this$_workbook$getAc = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc === void 0 ? void 0 : _this$_workbook$getAc.getSheetId())) this._commandService.executeCommand(SetWorksheetActivateCommand.id, {
533
- unitId: this._workbook.getUnitId(),
534
- subUnitId
535
- }, { fromFindReplace: true });
536
- this._commandService.executeCommand(ScrollToCellCommand.id, { range: match.range.range }, { fromFindReplace: true });
531
+ const { subUnitId, range } = match.range;
532
+ if (subUnitId !== ((_this$_workbook$getAc = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc === void 0 ? void 0 : _this$_workbook$getAc.getSheetId())) {
533
+ const unitId = this._workbook.getUnitId();
534
+ await this._commandService.executeCommand(SetWorksheetActivateCommand.id, {
535
+ unitId,
536
+ subUnitId
537
+ }, { fromFindReplace: true });
538
+ }
539
+ this._commandService.executeCommand(ScrollToCellCommand.id, { range }, { fromFindReplace: true });
537
540
  }
538
541
  _tryRestoreLastMatchesPosition(lastMatch, newMatches) {
539
542
  if (!lastMatch) return 0;
@@ -555,13 +558,12 @@ let SheetFindModel = class SheetFindModel extends FindModel {
555
558
  const ignoreSelection = (_params$ignoreSelecti = params === null || params === void 0 ? void 0 : params.ignoreSelection) !== null && _params$ignoreSelecti !== void 0 ? _params$ignoreSelecti : false;
556
559
  const matchToMove = this._findNextMatch(loop, stayIfOnMatch, ignoreSelection);
557
560
  if (matchToMove) {
558
- var _this$_workbook$getAc2;
559
561
  const [match, index] = matchToMove;
560
562
  this._matchesPosition = index + 1;
561
563
  if (this._query.findScope === FindScope.UNIT) this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match);
562
564
  else this._activeHighlightIndex = index;
563
565
  if (!noFocus) this._focusMatch(match);
564
- if (((_this$_workbook$getAc2 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc2 === void 0 ? void 0 : _this$_workbook$getAc2.getSheetId()) === match.range.subUnitId) this._updateCurrentHighlightShape(this._activeHighlightIndex);
566
+ this._updateCurrentHighlightShape(this._activeHighlightIndex);
565
567
  return match;
566
568
  }
567
569
  this._matchesPosition = 0;
@@ -577,13 +579,12 @@ let SheetFindModel = class SheetFindModel extends FindModel {
577
579
  const ignoreSelection = (_params$ignoreSelecti2 = params === null || params === void 0 ? void 0 : params.ignoreSelection) !== null && _params$ignoreSelecti2 !== void 0 ? _params$ignoreSelecti2 : false;
578
580
  const matchToMove = this._findPreviousMatch(loop, stayIfOnMatch, ignoreSelection);
579
581
  if (matchToMove) {
580
- var _this$_workbook$getAc3;
581
582
  const [match, index] = matchToMove;
582
583
  this._matchesPosition = index + 1;
583
584
  if (this._query.findScope === FindScope.UNIT) this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match);
584
585
  else this._activeHighlightIndex = index;
585
586
  if (!noFocus) this._focusMatch(match);
586
- if (((_this$_workbook$getAc3 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc3 === void 0 ? void 0 : _this$_workbook$getAc3.getSheetId()) === match.range.subUnitId) this._updateCurrentHighlightShape(this._activeHighlightIndex);
587
+ this._updateCurrentHighlightShape(this._activeHighlightIndex);
587
588
  return match;
588
589
  }
589
590
  this._matchesPosition = 0;
@@ -591,7 +592,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
591
592
  return null;
592
593
  }
593
594
  _findPreviousMatch(loop = false, stayIfOnMatch = false, ignoreSelection = false) {
594
- var _this$_workbook$getAc4;
595
+ var _this$_workbook$getAc2;
595
596
  if (this.currentMatch) {
596
597
  const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
597
598
  if (stayIfOnMatch) return [this.currentMatch, currentMatchIndex];
@@ -607,14 +608,14 @@ let SheetFindModel = class SheetFindModel extends FindModel {
607
608
  return [this._matches[lastIndex], lastIndex];
608
609
  }
609
610
  if (this._query.findScope !== FindScope.UNIT) return this._findPreviousMatchByRange(this._matches, lastSelection.range);
610
- const currentSheetId = (_this$_workbook$getAc4 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc4 === void 0 ? void 0 : _this$_workbook$getAc4.getSheetId();
611
+ const currentSheetId = (_this$_workbook$getAc2 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc2 === void 0 ? void 0 : _this$_workbook$getAc2.getSheetId();
611
612
  if (!currentSheetId) return null;
612
613
  const worksheetThatHasMatch = this._findPreviousWorksheetThatHasAMatch(currentSheetId, loop);
613
614
  if (!worksheetThatHasMatch) return null;
614
615
  return this._findPreviousMatchByRange(this._matchesByWorksheet.get(worksheetThatHasMatch), lastSelection.range);
615
616
  }
616
617
  _findNextMatch(loop = false, stayIfOnMatch = false, ignoreSelection = false) {
617
- var _this$_workbook$getAc5;
618
+ var _this$_workbook$getAc3;
618
619
  if (this.currentMatch) {
619
620
  const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
620
621
  if (stayIfOnMatch) return [this.currentMatch, currentMatchIndex];
@@ -627,7 +628,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
627
628
  const last = this._workbookSelections.getCurrentLastSelection();
628
629
  if (ignoreSelection || !last) return [this._matches[0], 0];
629
630
  if (this._query.findScope !== FindScope.UNIT) return this._findNextMatchByRange(this._matches, last.range, stayIfOnMatch);
630
- const currentSheetId = (_this$_workbook$getAc5 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc5 === void 0 ? void 0 : _this$_workbook$getAc5.getSheetId();
631
+ const currentSheetId = (_this$_workbook$getAc3 = this._workbook.getActiveSheet()) === null || _this$_workbook$getAc3 === void 0 ? void 0 : _this$_workbook$getAc3.getSheetId();
631
632
  if (!currentSheetId) return null;
632
633
  const worksheetThatHasMatch = this._findNextWorksheetThatHasAMatch(currentSheetId, loop);
633
634
  if (!worksheetThatHasMatch) return null;
@@ -741,9 +742,6 @@ SheetFindModel = __decorate([
741
742
  __decorateParam(6, Inject(ThemeService)),
742
743
  __decorateParam(7, Inject(SheetsSelectionsService))
743
744
  ], SheetFindModel);
744
- function escapeRegExp(text) {
745
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
746
- }
747
745
  /**
748
746
  * This module is responsible for searching and replacing in the sheets.
749
747
  * It also adds the search results to the search view by highlighting them.
@@ -869,7 +867,7 @@ function trimLeadingTrailingWhitespace(value) {
869
867
  //#endregion
870
868
  //#region package.json
871
869
  var name = "@univerjs/sheets-find-replace";
872
- var version = "0.24.0";
870
+ var version = "0.25.0-insiders.20260604-29ebbff";
873
871
 
874
872
  //#endregion
875
873
  //#region src/config/config.ts
package/lib/facade.js CHANGED
@@ -4,7 +4,7 @@ import { FRange } from "@univerjs/sheets/facade";
4
4
  import { filter, firstValueFrom } from "rxjs";
5
5
  import { FUniver } from "@univerjs/core/facade";
6
6
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
7
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
8
8
  function _typeof(o) {
9
9
  "@babel/helpers - typeof";
10
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +15,7 @@ function _typeof(o) {
15
15
  }
16
16
 
17
17
  //#endregion
18
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
19
19
  function toPrimitive(t, r) {
20
20
  if ("object" != _typeof(t) || !t) return t;
21
21
  var e = t[Symbol.toPrimitive];
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
32
32
  function toPropertyKey(t) {
33
33
  var i = toPrimitive(t, "string");
34
34
  return "symbol" == _typeof(i) ? i : i + "";
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
39
39
  function _defineProperty(e, r, t) {
40
40
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
41
  value: t,
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
50
50
  function __decorateParam(paramIndex, decorator) {
51
51
  return function(target, key) {
52
52
  decorator(target, key, paramIndex);
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
57
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
58
58
  function __decorate(decorators, target, key, desc) {
59
59
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
60
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);