@univerjs/sheets-find-replace 1.0.0-insiders.20260813-7c9aa50 → 1.0.0

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,8 +1,8 @@
1
1
  import { ColorKit, CommandType, DependentOn, Disposable, EDITOR_ACTIVATED, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, Rectangle, ThemeService, Tools, UniverInstanceType, fromCallback, groupBy, merge, regexp, replaceInDocumentBody, rotate } from "@univerjs/core";
2
2
  import { SelectRangeCommand, SetRangeValuesCommand, SetSelectionsOperation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SheetsSelectionsService, UniverSheetsPlugin } from "@univerjs/sheets";
3
- import { IRenderManagerService, RENDER_RAW_FORMULA_KEY, Rect, Shape, UniverRenderEnginePlugin } from "@univerjs/engine-render";
4
- import { FindBy, FindDirection, FindModel, FindReplaceController, FindScope, IFindReplaceService, UniverFindReplacePlugin } from "@univerjs/find-replace";
5
- import { ScrollToCellCommand, SheetSkeletonManagerService, UniverSheetsUIPlugin, getCoordByCell, getSheetObject } from "@univerjs/sheets-ui";
3
+ import { IRenderManagerService, RENDER_RAW_FORMULA_KEY, Rect, Shape, UniverRenderEnginePlugin, convertTransformToOffsetY } from "@univerjs/engine-render";
4
+ import { CloseFindDialogOperation, FindBy, FindDirection, FindModel, FindScope, IFindReplaceService, UniverFindReplaceMobileUIPlugin, UniverFindReplacePlugin } from "@univerjs/find-replace";
5
+ import { ScrollToCellCommand, SetScrollRelativeCommand, SheetSkeletonManagerService, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, getCoordByCell, getSheetObject, getViewportByCell } from "@univerjs/sheets-ui";
6
6
  import { Subject, debounceTime, filter, merge as merge$1, skip, throttleTime } from "rxjs";
7
7
 
8
8
  //#region src/commands/commands/sheet-replace.command.ts
@@ -42,7 +42,7 @@ function getReplaceAllResult(results, replacements) {
42
42
  }
43
43
 
44
44
  //#endregion
45
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
45
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPrimitive.js
56
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/defineProperty.js
76
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorateParam.js
164
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorate.js
172
+ //#region \0@oxc-project+runtime@0.149.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);
@@ -180,10 +180,9 @@ function __decorate(decorators, target, key, desc) {
180
180
  //#endregion
181
181
  //#region src/controllers/sheet-find-replace.controller.ts
182
182
  let SheetsFindReplaceController = class SheetsFindReplaceController extends Disposable {
183
- constructor(_injector, _findReplaceController, _contextService, _findReplaceService, _commandService) {
183
+ constructor(_injector, _contextService, _findReplaceService, _commandService) {
184
184
  super();
185
185
  this._injector = _injector;
186
- this._findReplaceController = _findReplaceController;
187
186
  this._contextService = _contextService;
188
187
  this._findReplaceService = _findReplaceService;
189
188
  this._commandService = _commandService;
@@ -193,14 +192,16 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends Disp
193
192
  }
194
193
  dispose() {
195
194
  super.dispose();
196
- this._findReplaceController.closePanel();
195
+ this._findReplaceService.terminate();
197
196
  this._provider.dispose();
198
197
  }
199
198
  _init() {
200
199
  const provider = this._injector.createInstance(SheetsFindReplaceProvider);
201
200
  this._provider = provider;
202
201
  this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(provider));
203
- this.disposeWithMe(this._contextService.subscribeContextValue$(EDITOR_ACTIVATED).pipe(filter((v) => !!v)).subscribe(() => this._findReplaceController.closePanel()));
202
+ this.disposeWithMe(this._contextService.subscribeContextValue$(EDITOR_ACTIVATED).pipe(filter((v) => !!v)).subscribe(() => {
203
+ this._commandService.executeCommand(CloseFindDialogOperation.id).catch(() => void 0);
204
+ }));
204
205
  }
205
206
  _initCommands() {
206
207
  [SheetReplaceCommand].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
@@ -208,10 +209,9 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends Disp
208
209
  };
209
210
  SheetsFindReplaceController = __decorate([
210
211
  __decorateParam(0, Inject(Injector)),
211
- __decorateParam(1, Inject(FindReplaceController)),
212
- __decorateParam(2, IContextService),
213
- __decorateParam(3, IFindReplaceService),
214
- __decorateParam(4, ICommandService)
212
+ __decorateParam(1, IContextService),
213
+ __decorateParam(2, IFindReplaceService),
214
+ __decorateParam(3, ICommandService)
215
215
  ], SheetsFindReplaceController);
216
216
  const SHEETS_FIND_REPLACE_PROVIDER_NAME = "sheets-find-replace-provider";
217
217
  const FIND_REPLACE_Z_INDEX = 1e4;
@@ -271,9 +271,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
271
271
  this.findInWorkbook(query);
272
272
  break;
273
273
  case FindScope.SUBUNIT:
274
- default:
275
- this.findInActiveWorksheet(query);
276
- break;
274
+ default: this.findInActiveWorksheet(query);
277
275
  }
278
276
  }
279
277
  focusSelection() {
@@ -474,7 +472,8 @@ let SheetFindModel = class SheetFindModel extends FindModel {
474
472
  if (currentRender == null) return;
475
473
  const { scene } = currentRender;
476
474
  const matches = this._matches;
477
- const color = new ColorKit(this._themeService.getColorFromTheme("yellow.400")).toRgb();
475
+ const searchBackgroundColor = this._themeService.getColorFromTheme("yellow.400");
476
+ const color = new ColorKit(searchBackgroundColor).toRgb();
478
477
  const worksheet = this._workbook.getActiveSheet();
479
478
  if (!worksheet) return;
480
479
  const activeSheetId = worksheet.getSheetId();
@@ -649,7 +648,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
649
648
  const matchRange = match.range.range;
650
649
  if (!(findByRow ? isBehindPositionWithRowPriority(range, matchRange) : isBehindPositionWithColumnPriority(range, matchRange))) return false;
651
650
  const isSame = isSamePosition(range, matchRange);
652
- return stayIfOnMatch ? isSame : !isSame;
651
+ return stayIfOnMatch || !isSame;
653
652
  });
654
653
  if (index === -1) index = matches.length - 1;
655
654
  const match = matches[index];
@@ -875,7 +874,7 @@ function trimLeadingTrailingWhitespace(value) {
875
874
  //#endregion
876
875
  //#region package.json
877
876
  var name = "@univerjs/sheets-find-replace";
878
- var version = "1.0.0-insiders.20260813-7c9aa50";
877
+ var version = "1.0.0";
879
878
 
880
879
  //#endregion
881
880
  //#region src/config/config.ts
@@ -898,6 +897,103 @@ const SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY = "sheets-find-replace.config";
898
897
  const configSymbol = Symbol(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY);
899
898
  const defaultPluginConfig = {};
900
899
 
900
+ //#endregion
901
+ //#region src/controllers/mobile/sheet-find-replace-mobile.controller.ts
902
+ const MOBILE_FIND_REPLACE_BAR_SELECTOR = "[data-u-comp=\"mobile-find-replace-bar\"]";
903
+ const MOBILE_FIND_MATCH_SAFE_PADDING = 8;
904
+ function getMobileFindMatchScrollOffset(cellBottom, barTop, safePadding) {
905
+ return Math.max(0, cellBottom - barTop + safePadding);
906
+ }
907
+ let SheetsFindReplaceMobileController = class SheetsFindReplaceMobileController extends Disposable {
908
+ constructor(_commandService, _univerInstanceService, _renderManagerService) {
909
+ super();
910
+ this._commandService = _commandService;
911
+ this._univerInstanceService = _univerInstanceService;
912
+ this._renderManagerService = _renderManagerService;
913
+ _defineProperty(this, "_pendingFrameId", null);
914
+ this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
915
+ var _command$params;
916
+ if (command.id !== ScrollToCellCommand.id || (options === null || options === void 0 ? void 0 : options.fromFindReplace) !== true) return;
917
+ const range = (_command$params = command.params) === null || _command$params === void 0 ? void 0 : _command$params.range;
918
+ if (!range) return;
919
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
920
+ const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
921
+ if (!workbook || !worksheet) return;
922
+ this._scheduleReveal(workbook.getUnitId(), worksheet.getSheetId(), range.endRow, range.endColumn);
923
+ }));
924
+ }
925
+ dispose() {
926
+ if (this._pendingFrameId !== null) {
927
+ cancelAnimationFrame(this._pendingFrameId);
928
+ this._pendingFrameId = null;
929
+ }
930
+ super.dispose();
931
+ }
932
+ _scheduleReveal(unitId, subUnitId, row, column) {
933
+ if (this._pendingFrameId !== null) cancelAnimationFrame(this._pendingFrameId);
934
+ this._pendingFrameId = requestAnimationFrame(() => {
935
+ this._pendingFrameId = null;
936
+ this._revealMatch(unitId, subUnitId, row, column);
937
+ });
938
+ }
939
+ _revealMatch(unitId, subUnitId, row, column) {
940
+ const bar = document.querySelector(MOBILE_FIND_REPLACE_BAR_SELECTOR);
941
+ if (!bar) return;
942
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
943
+ const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
944
+ if (!workbook || !worksheet || workbook.getUnitId() !== unitId || worksheet.getSheetId() !== subUnitId) return;
945
+ const render = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
946
+ const sheetObject = getSheetObject(workbook, this._renderManagerService);
947
+ const skeleton = render === null || render === void 0 ? void 0 : render.with(SheetSkeletonManagerService).getSkeleton(worksheet.getSheetId());
948
+ if (!sheetObject || !skeleton) return;
949
+ const { scene, engine } = sheetObject;
950
+ const viewport = getViewportByCell(row, column, scene, worksheet);
951
+ if (!viewport) return;
952
+ const { endY } = getCoordByCell(row, column, scene, skeleton);
953
+ const { scaleY } = scene.getAncestorScale();
954
+ const scrollXY = scene.getViewportScrollXY(viewport);
955
+ const offsetY = getMobileFindMatchScrollOffset(engine.getCanvasElement().getBoundingClientRect().top + convertTransformToOffsetY(endY, scaleY, scrollXY), bar.getBoundingClientRect().top, MOBILE_FIND_MATCH_SAFE_PADDING);
956
+ if (offsetY === 0) return;
957
+ this._commandService.executeCommand(SetScrollRelativeCommand.id, { offsetY }).catch(() => void 0);
958
+ }
959
+ };
960
+ SheetsFindReplaceMobileController = __decorate([
961
+ __decorateParam(0, ICommandService),
962
+ __decorateParam(1, IUniverInstanceService),
963
+ __decorateParam(2, IRenderManagerService)
964
+ ], SheetsFindReplaceMobileController);
965
+
966
+ //#endregion
967
+ //#region src/mobile-plugin.ts
968
+ let UniverSheetsFindReplaceMobileUIPlugin = class UniverSheetsFindReplaceMobileUIPlugin extends Plugin {
969
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
970
+ super();
971
+ this._config = _config;
972
+ this._injector = _injector;
973
+ this._configService = _configService;
974
+ const { ...rest } = merge({}, defaultPluginConfig, this._config);
975
+ this._configService.setConfig(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY, rest);
976
+ }
977
+ onStarting() {
978
+ [[SheetsFindReplaceController], [SheetsFindReplaceMobileController]].forEach((dependency) => this._injector.add(dependency));
979
+ }
980
+ onRendered() {
981
+ this._injector.get(SheetsFindReplaceMobileController);
982
+ }
983
+ onSteady() {
984
+ this._injector.get(SheetsFindReplaceController);
985
+ }
986
+ };
987
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "pluginName", "SHEET_FIND_REPLACE_PLUGIN");
988
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "packageName", name);
989
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "version", version);
990
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
991
+ UniverSheetsFindReplaceMobileUIPlugin = __decorate([
992
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverFindReplaceMobileUIPlugin, UniverSheetsMobileUIPlugin),
993
+ __decorateParam(1, Inject(Injector)),
994
+ __decorateParam(2, IConfigService)
995
+ ], UniverSheetsFindReplaceMobileUIPlugin);
996
+
901
997
  //#endregion
902
998
  //#region src/plugin.ts
903
999
  let UniverSheetsFindReplacePlugin = class UniverSheetsFindReplacePlugin extends Plugin {
@@ -927,4 +1023,4 @@ UniverSheetsFindReplacePlugin = __decorate([
927
1023
  ], UniverSheetsFindReplacePlugin);
928
1024
 
929
1025
  //#endregion
930
- export { SheetReplaceCommand, SheetsFindReplaceController, UniverSheetsFindReplacePlugin };
1026
+ export { SheetReplaceCommand, SheetsFindReplaceController, UniverSheetsFindReplaceMobileUIPlugin, UniverSheetsFindReplacePlugin };
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.140.0/helpers/esm/typeof.js
7
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorate.js
57
+ //#region \0@oxc-project+runtime@0.149.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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ColorKit, CommandType, DependentOn, Disposable, EDITOR_ACTIVATED, ICommandService, IConfigService, IContextService, IUndoRedoService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, Rectangle, ThemeService, Tools, UniverInstanceType, fromCallback, groupBy, merge, regexp, replaceInDocumentBody, rotate } from "@univerjs/core";
2
2
  import { SelectRangeCommand, SetRangeValuesCommand, SetSelectionsOperation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SheetsSelectionsService, UniverSheetsPlugin } from "@univerjs/sheets";
3
- import { IRenderManagerService, RENDER_RAW_FORMULA_KEY, Rect, Shape, UniverRenderEnginePlugin } from "@univerjs/engine-render";
4
- import { FindBy, FindDirection, FindModel, FindReplaceController, FindScope, IFindReplaceService, UniverFindReplacePlugin } from "@univerjs/find-replace";
5
- import { ScrollToCellCommand, SheetSkeletonManagerService, UniverSheetsUIPlugin, getCoordByCell, getSheetObject } from "@univerjs/sheets-ui";
3
+ import { IRenderManagerService, RENDER_RAW_FORMULA_KEY, Rect, Shape, UniverRenderEnginePlugin, convertTransformToOffsetY } from "@univerjs/engine-render";
4
+ import { CloseFindDialogOperation, FindBy, FindDirection, FindModel, FindScope, IFindReplaceService, UniverFindReplaceMobileUIPlugin, UniverFindReplacePlugin } from "@univerjs/find-replace";
5
+ import { ScrollToCellCommand, SetScrollRelativeCommand, SheetSkeletonManagerService, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, getCoordByCell, getSheetObject, getViewportByCell } from "@univerjs/sheets-ui";
6
6
  import { Subject, debounceTime, filter, merge as merge$1, skip, throttleTime } from "rxjs";
7
7
 
8
8
  //#region src/commands/commands/sheet-replace.command.ts
@@ -42,7 +42,7 @@ function getReplaceAllResult(results, replacements) {
42
42
  }
43
43
 
44
44
  //#endregion
45
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
45
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPrimitive.js
56
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/defineProperty.js
76
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorateParam.js
164
+ //#region \0@oxc-project+runtime@0.149.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.140.0/helpers/esm/decorate.js
172
+ //#region \0@oxc-project+runtime@0.149.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);
@@ -180,10 +180,9 @@ function __decorate(decorators, target, key, desc) {
180
180
  //#endregion
181
181
  //#region src/controllers/sheet-find-replace.controller.ts
182
182
  let SheetsFindReplaceController = class SheetsFindReplaceController extends Disposable {
183
- constructor(_injector, _findReplaceController, _contextService, _findReplaceService, _commandService) {
183
+ constructor(_injector, _contextService, _findReplaceService, _commandService) {
184
184
  super();
185
185
  this._injector = _injector;
186
- this._findReplaceController = _findReplaceController;
187
186
  this._contextService = _contextService;
188
187
  this._findReplaceService = _findReplaceService;
189
188
  this._commandService = _commandService;
@@ -193,14 +192,16 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends Disp
193
192
  }
194
193
  dispose() {
195
194
  super.dispose();
196
- this._findReplaceController.closePanel();
195
+ this._findReplaceService.terminate();
197
196
  this._provider.dispose();
198
197
  }
199
198
  _init() {
200
199
  const provider = this._injector.createInstance(SheetsFindReplaceProvider);
201
200
  this._provider = provider;
202
201
  this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(provider));
203
- this.disposeWithMe(this._contextService.subscribeContextValue$(EDITOR_ACTIVATED).pipe(filter((v) => !!v)).subscribe(() => this._findReplaceController.closePanel()));
202
+ this.disposeWithMe(this._contextService.subscribeContextValue$(EDITOR_ACTIVATED).pipe(filter((v) => !!v)).subscribe(() => {
203
+ this._commandService.executeCommand(CloseFindDialogOperation.id).catch(() => void 0);
204
+ }));
204
205
  }
205
206
  _initCommands() {
206
207
  [SheetReplaceCommand].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
@@ -208,10 +209,9 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends Disp
208
209
  };
209
210
  SheetsFindReplaceController = __decorate([
210
211
  __decorateParam(0, Inject(Injector)),
211
- __decorateParam(1, Inject(FindReplaceController)),
212
- __decorateParam(2, IContextService),
213
- __decorateParam(3, IFindReplaceService),
214
- __decorateParam(4, ICommandService)
212
+ __decorateParam(1, IContextService),
213
+ __decorateParam(2, IFindReplaceService),
214
+ __decorateParam(3, ICommandService)
215
215
  ], SheetsFindReplaceController);
216
216
  const SHEETS_FIND_REPLACE_PROVIDER_NAME = "sheets-find-replace-provider";
217
217
  const FIND_REPLACE_Z_INDEX = 1e4;
@@ -271,9 +271,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
271
271
  this.findInWorkbook(query);
272
272
  break;
273
273
  case FindScope.SUBUNIT:
274
- default:
275
- this.findInActiveWorksheet(query);
276
- break;
274
+ default: this.findInActiveWorksheet(query);
277
275
  }
278
276
  }
279
277
  focusSelection() {
@@ -474,7 +472,8 @@ let SheetFindModel = class SheetFindModel extends FindModel {
474
472
  if (currentRender == null) return;
475
473
  const { scene } = currentRender;
476
474
  const matches = this._matches;
477
- const color = new ColorKit(this._themeService.getColorFromTheme("yellow.400")).toRgb();
475
+ const searchBackgroundColor = this._themeService.getColorFromTheme("yellow.400");
476
+ const color = new ColorKit(searchBackgroundColor).toRgb();
478
477
  const worksheet = this._workbook.getActiveSheet();
479
478
  if (!worksheet) return;
480
479
  const activeSheetId = worksheet.getSheetId();
@@ -649,7 +648,7 @@ let SheetFindModel = class SheetFindModel extends FindModel {
649
648
  const matchRange = match.range.range;
650
649
  if (!(findByRow ? isBehindPositionWithRowPriority(range, matchRange) : isBehindPositionWithColumnPriority(range, matchRange))) return false;
651
650
  const isSame = isSamePosition(range, matchRange);
652
- return stayIfOnMatch ? isSame : !isSame;
651
+ return stayIfOnMatch || !isSame;
653
652
  });
654
653
  if (index === -1) index = matches.length - 1;
655
654
  const match = matches[index];
@@ -875,7 +874,7 @@ function trimLeadingTrailingWhitespace(value) {
875
874
  //#endregion
876
875
  //#region package.json
877
876
  var name = "@univerjs/sheets-find-replace";
878
- var version = "1.0.0-insiders.20260813-7c9aa50";
877
+ var version = "1.0.0";
879
878
 
880
879
  //#endregion
881
880
  //#region src/config/config.ts
@@ -898,6 +897,103 @@ const SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY = "sheets-find-replace.config";
898
897
  const configSymbol = Symbol(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY);
899
898
  const defaultPluginConfig = {};
900
899
 
900
+ //#endregion
901
+ //#region src/controllers/mobile/sheet-find-replace-mobile.controller.ts
902
+ const MOBILE_FIND_REPLACE_BAR_SELECTOR = "[data-u-comp=\"mobile-find-replace-bar\"]";
903
+ const MOBILE_FIND_MATCH_SAFE_PADDING = 8;
904
+ function getMobileFindMatchScrollOffset(cellBottom, barTop, safePadding) {
905
+ return Math.max(0, cellBottom - barTop + safePadding);
906
+ }
907
+ let SheetsFindReplaceMobileController = class SheetsFindReplaceMobileController extends Disposable {
908
+ constructor(_commandService, _univerInstanceService, _renderManagerService) {
909
+ super();
910
+ this._commandService = _commandService;
911
+ this._univerInstanceService = _univerInstanceService;
912
+ this._renderManagerService = _renderManagerService;
913
+ _defineProperty(this, "_pendingFrameId", null);
914
+ this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
915
+ var _command$params;
916
+ if (command.id !== ScrollToCellCommand.id || (options === null || options === void 0 ? void 0 : options.fromFindReplace) !== true) return;
917
+ const range = (_command$params = command.params) === null || _command$params === void 0 ? void 0 : _command$params.range;
918
+ if (!range) return;
919
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
920
+ const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
921
+ if (!workbook || !worksheet) return;
922
+ this._scheduleReveal(workbook.getUnitId(), worksheet.getSheetId(), range.endRow, range.endColumn);
923
+ }));
924
+ }
925
+ dispose() {
926
+ if (this._pendingFrameId !== null) {
927
+ cancelAnimationFrame(this._pendingFrameId);
928
+ this._pendingFrameId = null;
929
+ }
930
+ super.dispose();
931
+ }
932
+ _scheduleReveal(unitId, subUnitId, row, column) {
933
+ if (this._pendingFrameId !== null) cancelAnimationFrame(this._pendingFrameId);
934
+ this._pendingFrameId = requestAnimationFrame(() => {
935
+ this._pendingFrameId = null;
936
+ this._revealMatch(unitId, subUnitId, row, column);
937
+ });
938
+ }
939
+ _revealMatch(unitId, subUnitId, row, column) {
940
+ const bar = document.querySelector(MOBILE_FIND_REPLACE_BAR_SELECTOR);
941
+ if (!bar) return;
942
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
943
+ const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
944
+ if (!workbook || !worksheet || workbook.getUnitId() !== unitId || worksheet.getSheetId() !== subUnitId) return;
945
+ const render = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
946
+ const sheetObject = getSheetObject(workbook, this._renderManagerService);
947
+ const skeleton = render === null || render === void 0 ? void 0 : render.with(SheetSkeletonManagerService).getSkeleton(worksheet.getSheetId());
948
+ if (!sheetObject || !skeleton) return;
949
+ const { scene, engine } = sheetObject;
950
+ const viewport = getViewportByCell(row, column, scene, worksheet);
951
+ if (!viewport) return;
952
+ const { endY } = getCoordByCell(row, column, scene, skeleton);
953
+ const { scaleY } = scene.getAncestorScale();
954
+ const scrollXY = scene.getViewportScrollXY(viewport);
955
+ const offsetY = getMobileFindMatchScrollOffset(engine.getCanvasElement().getBoundingClientRect().top + convertTransformToOffsetY(endY, scaleY, scrollXY), bar.getBoundingClientRect().top, MOBILE_FIND_MATCH_SAFE_PADDING);
956
+ if (offsetY === 0) return;
957
+ this._commandService.executeCommand(SetScrollRelativeCommand.id, { offsetY }).catch(() => void 0);
958
+ }
959
+ };
960
+ SheetsFindReplaceMobileController = __decorate([
961
+ __decorateParam(0, ICommandService),
962
+ __decorateParam(1, IUniverInstanceService),
963
+ __decorateParam(2, IRenderManagerService)
964
+ ], SheetsFindReplaceMobileController);
965
+
966
+ //#endregion
967
+ //#region src/mobile-plugin.ts
968
+ let UniverSheetsFindReplaceMobileUIPlugin = class UniverSheetsFindReplaceMobileUIPlugin extends Plugin {
969
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
970
+ super();
971
+ this._config = _config;
972
+ this._injector = _injector;
973
+ this._configService = _configService;
974
+ const { ...rest } = merge({}, defaultPluginConfig, this._config);
975
+ this._configService.setConfig(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY, rest);
976
+ }
977
+ onStarting() {
978
+ [[SheetsFindReplaceController], [SheetsFindReplaceMobileController]].forEach((dependency) => this._injector.add(dependency));
979
+ }
980
+ onRendered() {
981
+ this._injector.get(SheetsFindReplaceMobileController);
982
+ }
983
+ onSteady() {
984
+ this._injector.get(SheetsFindReplaceController);
985
+ }
986
+ };
987
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "pluginName", "SHEET_FIND_REPLACE_PLUGIN");
988
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "packageName", name);
989
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "version", version);
990
+ _defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
991
+ UniverSheetsFindReplaceMobileUIPlugin = __decorate([
992
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverFindReplaceMobileUIPlugin, UniverSheetsMobileUIPlugin),
993
+ __decorateParam(1, Inject(Injector)),
994
+ __decorateParam(2, IConfigService)
995
+ ], UniverSheetsFindReplaceMobileUIPlugin);
996
+
901
997
  //#endregion
902
998
  //#region src/plugin.ts
903
999
  let UniverSheetsFindReplacePlugin = class UniverSheetsFindReplacePlugin extends Plugin {
@@ -927,4 +1023,4 @@ UniverSheetsFindReplacePlugin = __decorate([
927
1023
  ], UniverSheetsFindReplacePlugin);
928
1024
 
929
1025
  //#endregion
930
- export { SheetReplaceCommand, SheetsFindReplaceController, UniverSheetsFindReplacePlugin };
1026
+ export { SheetReplaceCommand, SheetsFindReplaceController, UniverSheetsFindReplaceMobileUIPlugin, UniverSheetsFindReplacePlugin };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
17
+ import { IRenderManagerService } from '@univerjs/engine-render';
18
+ export declare function getMobileFindMatchScrollOffset(cellBottom: number, barTop: number, safePadding: number): number;
19
+ export declare class SheetsFindReplaceMobileController extends Disposable {
20
+ private readonly _commandService;
21
+ private readonly _univerInstanceService;
22
+ private readonly _renderManagerService;
23
+ private _pendingFrameId;
24
+ constructor(_commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService);
25
+ dispose(): void;
26
+ private _scheduleReveal;
27
+ private _revealMatch;
28
+ }
@@ -17,17 +17,16 @@ import type { ICellData, IDisposable, IRange, Nullable, Workbook, Worksheet } fr
17
17
  import type { IFindComplete, IFindMatch, IFindMoveParams, IFindQuery, IReplaceAllResult } from '@univerjs/find-replace';
18
18
  import { Disposable, ICommandService, IContextService, Injector, IUniverInstanceService, ThemeService } from '@univerjs/core';
19
19
  import { IRenderManagerService } from '@univerjs/engine-render';
20
- import { FindModel, FindReplaceController, IFindReplaceService } from '@univerjs/find-replace';
20
+ import { FindModel, IFindReplaceService } from '@univerjs/find-replace';
21
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
22
22
  import { SheetSkeletonManagerService } from '@univerjs/sheets-ui';
23
23
  export declare class SheetsFindReplaceController extends Disposable implements IDisposable {
24
24
  private readonly _injector;
25
- private readonly _findReplaceController;
26
25
  private readonly _contextService;
27
26
  private readonly _findReplaceService;
28
27
  private readonly _commandService;
29
28
  private _provider;
30
- constructor(_injector: Injector, _findReplaceController: FindReplaceController, _contextService: IContextService, _findReplaceService: IFindReplaceService, _commandService: ICommandService);
29
+ constructor(_injector: Injector, _contextService: IContextService, _findReplaceService: IFindReplaceService, _commandService: ICommandService);
31
30
  dispose(): void;
32
31
  private _init;
33
32
  private _initCommands;
@@ -16,4 +16,5 @@
16
16
  export { SheetReplaceCommand } from './commands/commands/sheet-replace.command';
17
17
  export type { IUniverSheetsFindReplaceConfig } from './config/config';
18
18
  export { SheetsFindReplaceController } from './controllers/sheet-find-replace.controller';
19
+ export { UniverSheetsFindReplaceMobileUIPlugin } from './mobile-plugin';
19
20
  export { UniverSheetsFindReplacePlugin } from './plugin';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IUniverSheetsFindReplaceConfig } from './config/config';
17
+ import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
18
+ export declare class UniverSheetsFindReplaceMobileUIPlugin extends Plugin {
19
+ private readonly _config;
20
+ protected readonly _injector: Injector;
21
+ private readonly _configService;
22
+ static pluginName: string;
23
+ static packageName: string;
24
+ static version: string;
25
+ static type: UniverInstanceType;
26
+ constructor(_config: Partial<IUniverSheetsFindReplaceConfig> | undefined, _injector: Injector, _configService: IConfigService);
27
+ onStarting(): void;
28
+ onRendered(): void;
29
+ onSteady(): void;
30
+ }