@univerjs/sheets-find-replace 0.17.0 → 0.18.0-insiders.20260328-d26c36e

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 (75) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +3 -1
  3. package/lib/cjs/locale/ca-ES.js +1 -1
  4. package/lib/cjs/locale/en-US.js +1 -1
  5. package/lib/cjs/locale/es-ES.js +1 -1
  6. package/lib/cjs/locale/fa-IR.js +1 -1
  7. package/lib/cjs/locale/fr-FR.js +1 -1
  8. package/lib/cjs/locale/ja-JP.js +1 -1
  9. package/lib/cjs/locale/ko-KR.js +1 -1
  10. package/lib/cjs/locale/ru-RU.js +1 -1
  11. package/lib/cjs/locale/sk-SK.js +1 -1
  12. package/lib/cjs/locale/vi-VN.js +1 -1
  13. package/lib/cjs/locale/zh-CN.js +1 -1
  14. package/lib/cjs/locale/zh-TW.js +1 -1
  15. package/lib/es/facade.js +1 -101
  16. package/lib/es/index.js +3 -633
  17. package/lib/es/locale/ca-ES.js +1 -11
  18. package/lib/es/locale/en-US.js +1 -11
  19. package/lib/es/locale/es-ES.js +1 -11
  20. package/lib/es/locale/fa-IR.js +1 -11
  21. package/lib/es/locale/fr-FR.js +1 -11
  22. package/lib/es/locale/ja-JP.js +1 -11
  23. package/lib/es/locale/ko-KR.js +1 -11
  24. package/lib/es/locale/ru-RU.js +1 -11
  25. package/lib/es/locale/sk-SK.js +1 -11
  26. package/lib/es/locale/vi-VN.js +1 -11
  27. package/lib/es/locale/zh-CN.js +1 -11
  28. package/lib/es/locale/zh-TW.js +1 -11
  29. package/lib/facade.js +1 -101
  30. package/lib/index.js +3 -633
  31. package/lib/locale/ca-ES.js +1 -11
  32. package/lib/locale/en-US.js +1 -11
  33. package/lib/locale/es-ES.js +1 -11
  34. package/lib/locale/fa-IR.js +1 -11
  35. package/lib/locale/fr-FR.js +1 -11
  36. package/lib/locale/ja-JP.js +1 -11
  37. package/lib/locale/ko-KR.js +1 -11
  38. package/lib/locale/ru-RU.js +1 -11
  39. package/lib/locale/sk-SK.js +1 -11
  40. package/lib/locale/vi-VN.js +1 -11
  41. package/lib/locale/zh-CN.js +1 -11
  42. package/lib/locale/zh-TW.js +1 -11
  43. package/lib/types/commands/commands/sheet-replace.command.d.ts +17 -2
  44. package/lib/types/controllers/sheet-find-replace.controller.d.ts +21 -4
  45. package/lib/types/controllers/utils.d.ts +17 -2
  46. package/lib/types/facade/f-text-finder.d.ts +19 -2
  47. package/lib/types/facade/f-univer.d.ts +15 -0
  48. package/lib/types/locale/ca-ES.d.ts +16 -1
  49. package/lib/types/locale/es-ES.d.ts +16 -1
  50. package/lib/types/locale/fa-IR.d.ts +16 -1
  51. package/lib/types/locale/fr-FR.d.ts +16 -1
  52. package/lib/types/locale/ja-JP.d.ts +16 -1
  53. package/lib/types/locale/ko-KR.d.ts +16 -1
  54. package/lib/types/locale/ru-RU.d.ts +16 -1
  55. package/lib/types/locale/sk-SK.d.ts +16 -1
  56. package/lib/types/locale/vi-VN.d.ts +16 -1
  57. package/lib/types/locale/zh-TW.d.ts +16 -1
  58. package/lib/types/plugin.d.ts +16 -1
  59. package/lib/types/views/shapes/find-replace-highlight.shape.d.ts +18 -2
  60. package/lib/umd/facade.js +1 -1
  61. package/lib/umd/index.js +1 -1
  62. package/lib/umd/locale/ca-ES.js +1 -1
  63. package/lib/umd/locale/en-US.js +1 -1
  64. package/lib/umd/locale/es-ES.js +1 -1
  65. package/lib/umd/locale/fa-IR.js +1 -1
  66. package/lib/umd/locale/fr-FR.js +1 -1
  67. package/lib/umd/locale/ja-JP.js +1 -1
  68. package/lib/umd/locale/ko-KR.js +1 -1
  69. package/lib/umd/locale/ru-RU.js +1 -1
  70. package/lib/umd/locale/sk-SK.js +1 -1
  71. package/lib/umd/locale/vi-VN.js +1 -1
  72. package/lib/umd/locale/zh-CN.js +1 -1
  73. package/lib/umd/locale/zh-TW.js +1 -1
  74. package/package.json +12 -11
  75. package/LICENSE +0 -176
package/lib/es/facade.js CHANGED
@@ -1,101 +1 @@
1
- var u = Object.defineProperty;
2
- var p = (a, e, t) => e in a ? u(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var c = (a, e, t) => p(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { Inject as m, Injector as _, IUniverInstanceService as f, Disposable as v } from "@univerjs/core";
5
- import { IFindReplaceService as g, FindReplaceModel as y, createInitFindReplaceState as S, FindReplaceState as b, FindBy as h } from "@univerjs/find-replace";
6
- import { FRange as F } from "@univerjs/sheets/facade";
7
- import { FUniver as d } from "@univerjs/core/facade";
8
- var w = Object.getOwnPropertyDescriptor, C = (a, e, t, s) => {
9
- for (var n = s > 1 ? void 0 : s ? w(e, t) : e, i = a.length - 1, r; i >= 0; i--)
10
- (r = a[i]) && (n = r(n) || n);
11
- return n;
12
- }, o = (a, e) => (t, s) => e(t, s, a);
13
- let l = class extends v {
14
- constructor(e, t, s, n) {
15
- super();
16
- c(this, "_state", new b());
17
- c(this, "_model");
18
- c(this, "_complete");
19
- this._injector = t, this._univerInstanceService = s, this._findReplaceService = n;
20
- const i = this._findReplaceService.getProviders();
21
- this._model = this._injector.createInstance(y, this._state, i);
22
- const r = {
23
- ...S(),
24
- ...e
25
- };
26
- this._state.changeState(r);
27
- }
28
- findAll() {
29
- return !this._state.findCompleted || !this._complete ? [] : this._complete.results.map((e) => this._findMatchToFRange(e));
30
- }
31
- findNext() {
32
- var t;
33
- if (!this._state.findCompleted || !this._complete)
34
- return null;
35
- const e = (t = this._model) == null ? void 0 : t.moveToNextMatch();
36
- return e ? this._findMatchToFRange(e) : null;
37
- }
38
- findPrevious() {
39
- var t;
40
- const e = (t = this._model) == null ? void 0 : t.moveToPreviousMatch();
41
- return e ? this._findMatchToFRange(e) : null;
42
- }
43
- getCurrentMatch() {
44
- var t;
45
- if (!this._state.findCompleted || !this._complete)
46
- throw new Error("Find operation is not completed.");
47
- const e = (t = this._model) == null ? void 0 : t.currentMatch$.value;
48
- return e ? this._findMatchToFRange(e) : null;
49
- }
50
- async matchCaseAsync(e) {
51
- return this._state.changeState({ caseSensitive: e, findCompleted: !1 }), new Promise((t) => {
52
- const s = this._state.stateUpdates$.subscribe(async (n) => {
53
- n.findCompleted === !0 && (s.unsubscribe(), await this.ensureCompleteAsync(), t(this));
54
- });
55
- });
56
- }
57
- async matchEntireCellAsync(e) {
58
- return this._state.changeState({ matchesTheWholeCell: e, findCompleted: !1 }), new Promise((t) => {
59
- const s = this._state.stateUpdates$.subscribe(async (n) => {
60
- n.findCompleted === !0 && (s.unsubscribe(), await this.ensureCompleteAsync(), t(this));
61
- });
62
- });
63
- }
64
- async matchFormulaTextAsync(e) {
65
- return this._state.changeState({ findBy: e ? h.FORMULA : h.VALUE, findCompleted: !1 }), new Promise((t) => {
66
- const s = this._state.stateUpdates$.subscribe(async (n) => {
67
- n.findCompleted === !0 && (s.unsubscribe(), await this.ensureCompleteAsync(), t(this));
68
- });
69
- });
70
- }
71
- async replaceAllWithAsync(e) {
72
- var s, n, i;
73
- await this._state.changeState({ replaceRevealed: !0, replaceString: e });
74
- const t = (i = (n = await ((s = this._model) == null ? void 0 : s.replaceAll())) == null ? void 0 : n.success) != null ? i : 0;
75
- return this._state.changeState({ replaceRevealed: !1 }), t;
76
- }
77
- async replaceWithAsync(e) {
78
- var t;
79
- return await this._state.changeState({ replaceRevealed: !0, replaceString: e }), await ((t = this._model) == null ? void 0 : t.replace()), this._state.changeState({ replaceRevealed: !1 }), !0;
80
- }
81
- async ensureCompleteAsync() {
82
- var e;
83
- this._complete = await ((e = this._model) == null ? void 0 : e.start());
84
- }
85
- _findMatchToFRange(e) {
86
- const { unitId: t } = e, { subUnitId: s, range: n } = e.range, i = this._univerInstanceService.getUnit(t), r = i.getSheetBySheetId(s);
87
- return this._injector.createInstance(F, i, r, n);
88
- }
89
- };
90
- l = C([
91
- o(1, m(_)),
92
- o(2, f),
93
- o(3, g)
94
- ], l);
95
- class R extends d {
96
- async createTextFinderAsync(e) {
97
- const t = { findString: e }, s = this._injector.createInstance(l, t);
98
- return await s.ensureCompleteAsync(), s;
99
- }
100
- }
101
- d.extend(R);
1
+ import{Disposable as e,IUniverInstanceService as t,Inject as n,Injector as r}from"@univerjs/core";import{FindBy as i,FindReplaceModel as a,FindReplaceState as o,IFindReplaceService as s,createInitFindReplaceState as c}from"@univerjs/find-replace";import{FRange as l}from"@univerjs/sheets/facade";import{FUniver as u}from"@univerjs/core/facade";function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let _=class extends e{constructor(e,t,n,r){super(),this._injector=t,this._univerInstanceService=n,this._findReplaceService=r,m(this,`_state`,new o),m(this,`_model`,void 0),m(this,`_complete`,void 0);let i=this._findReplaceService.getProviders();this._model=this._injector.createInstance(a,this._state,i);let s={...c(),...e};this._state.changeState(s)}findAll(){return!this._state.findCompleted||!this._complete?[]:this._complete.results.map(e=>this._findMatchToFRange(e))}findNext(){var e;if(!this._state.findCompleted||!this._complete)return null;let t=(e=this._model)==null?void 0:e.moveToNextMatch();return t?this._findMatchToFRange(t):null}findPrevious(){var e;let t=(e=this._model)==null?void 0:e.moveToPreviousMatch();return t?this._findMatchToFRange(t):null}getCurrentMatch(){var e;if(!this._state.findCompleted||!this._complete)throw Error(`Find operation is not completed.`);let t=(e=this._model)==null?void 0:e.currentMatch$.value;return t?this._findMatchToFRange(t):null}async matchCaseAsync(e){return this._state.changeState({caseSensitive:e,findCompleted:!1}),new Promise(e=>{let t=this._state.stateUpdates$.subscribe(async n=>{n.findCompleted===!0&&(t.unsubscribe(),await this.ensureCompleteAsync(),e(this))})})}async matchEntireCellAsync(e){return this._state.changeState({matchesTheWholeCell:e,findCompleted:!1}),new Promise(e=>{let t=this._state.stateUpdates$.subscribe(async n=>{n.findCompleted===!0&&(t.unsubscribe(),await this.ensureCompleteAsync(),e(this))})})}async matchFormulaTextAsync(e){return this._state.changeState({findBy:e?i.FORMULA:i.VALUE,findCompleted:!1}),new Promise(e=>{let t=this._state.stateUpdates$.subscribe(async n=>{n.findCompleted===!0&&(t.unsubscribe(),await this.ensureCompleteAsync(),e(this))})})}async replaceAllWithAsync(e){var t,n,r;await this._state.changeState({replaceRevealed:!0,replaceString:e});let i=(t=(n=await((r=this._model)==null?void 0:r.replaceAll()))==null?void 0:n.success)==null?0:t;return this._state.changeState({replaceRevealed:!1}),i}async replaceWithAsync(e){var t;return await this._state.changeState({replaceRevealed:!0,replaceString:e}),await((t=this._model)==null?void 0:t.replace()),this._state.changeState({replaceRevealed:!1}),!0}async ensureCompleteAsync(){var e;this._complete=await((e=this._model)==null?void 0:e.start())}_findMatchToFRange(e){let{unitId:t}=e,{subUnitId:n,range:r}=e.range,i=this._univerInstanceService.getUnit(t),a=i.getSheetBySheetId(n);return this._injector.createInstance(l,i,a,r)}};_=g([h(1,n(r)),h(2,t),h(3,s)],_);var v=class extends u{async createTextFinderAsync(e){let t={findString:e},n=this._injector.createInstance(_,t);return await n.ensureCompleteAsync(),n}};u.extend(v);export{};