@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/LICENSE +176 -0
- package/README.md +1 -5
- package/lib/cjs/facade.js +6 -6
- package/lib/cjs/index.js +122 -20
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +120 -24
- package/lib/facade.js +6 -6
- package/lib/index.js +120 -24
- package/lib/types/controllers/mobile/sheet-find-replace-mobile.controller.d.ts +28 -0
- package/lib/types/controllers/sheet-find-replace.controller.d.ts +2 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/mobile-plugin.d.ts +30 -0
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
12
|
| --- | --- | :---: | :---: | :---: |
|
|
13
|
-
| `@univerjs/sheets-find-replace` | `UniverSheetsFindReplace` | No |
|
|
13
|
+
| `@univerjs/sheets-find-replace` | `UniverSheetsFindReplace` | No | No | Yes |
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -25,12 +25,9 @@ Keep all `@univerjs/*` packages on the same version.
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
|
-
import EnUS from '@univerjs/sheets-find-replace/locale/en-US';
|
|
29
28
|
import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';
|
|
30
29
|
|
|
31
30
|
univer.registerPlugin(UniverSheetsFindReplacePlugin);
|
|
32
|
-
|
|
33
|
-
// Merge EnUS into your Univer locale map when this package contributes UI text.
|
|
34
31
|
```
|
|
35
32
|
|
|
36
33
|
## Integration Notes
|
|
@@ -42,4 +39,3 @@ Use this package with `@univerjs/find-replace` to share find and replace infrast
|
|
|
42
39
|
- [Documentation](https://docs.univer.ai)
|
|
43
40
|
- [NPM package](https://npmjs.com/package/@univerjs/sheets-find-replace)
|
|
44
41
|
- [GitHub repository](https://github.com/dream-num/univer)
|
|
45
|
-
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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/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.
|
|
46
|
+
//#region \0@oxc-project+runtime@0.149.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.
|
|
57
|
+
//#region \0@oxc-project+runtime@0.149.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.
|
|
70
|
+
//#region \0@oxc-project+runtime@0.149.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.
|
|
77
|
+
//#region \0@oxc-project+runtime@0.149.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.
|
|
165
|
+
//#region \0@oxc-project+runtime@0.149.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.
|
|
173
|
+
//#region \0@oxc-project+runtime@0.149.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);
|
|
@@ -181,10 +181,9 @@ function __decorate(decorators, target, key, desc) {
|
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region src/controllers/sheet-find-replace.controller.ts
|
|
183
183
|
let SheetsFindReplaceController = class SheetsFindReplaceController extends _univerjs_core.Disposable {
|
|
184
|
-
constructor(_injector,
|
|
184
|
+
constructor(_injector, _contextService, _findReplaceService, _commandService) {
|
|
185
185
|
super();
|
|
186
186
|
this._injector = _injector;
|
|
187
|
-
this._findReplaceController = _findReplaceController;
|
|
188
187
|
this._contextService = _contextService;
|
|
189
188
|
this._findReplaceService = _findReplaceService;
|
|
190
189
|
this._commandService = _commandService;
|
|
@@ -194,14 +193,16 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends _uni
|
|
|
194
193
|
}
|
|
195
194
|
dispose() {
|
|
196
195
|
super.dispose();
|
|
197
|
-
this.
|
|
196
|
+
this._findReplaceService.terminate();
|
|
198
197
|
this._provider.dispose();
|
|
199
198
|
}
|
|
200
199
|
_init() {
|
|
201
200
|
const provider = this._injector.createInstance(SheetsFindReplaceProvider);
|
|
202
201
|
this._provider = provider;
|
|
203
202
|
this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(provider));
|
|
204
|
-
this.disposeWithMe(this._contextService.subscribeContextValue$(_univerjs_core.EDITOR_ACTIVATED).pipe((0, rxjs.filter)((v) => !!v)).subscribe(() =>
|
|
203
|
+
this.disposeWithMe(this._contextService.subscribeContextValue$(_univerjs_core.EDITOR_ACTIVATED).pipe((0, rxjs.filter)((v) => !!v)).subscribe(() => {
|
|
204
|
+
this._commandService.executeCommand(_univerjs_find_replace.CloseFindDialogOperation.id).catch(() => void 0);
|
|
205
|
+
}));
|
|
205
206
|
}
|
|
206
207
|
_initCommands() {
|
|
207
208
|
[SheetReplaceCommand].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
|
|
@@ -209,10 +210,9 @@ let SheetsFindReplaceController = class SheetsFindReplaceController extends _uni
|
|
|
209
210
|
};
|
|
210
211
|
SheetsFindReplaceController = __decorate([
|
|
211
212
|
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
212
|
-
__decorateParam(1,
|
|
213
|
-
__decorateParam(2,
|
|
214
|
-
__decorateParam(3,
|
|
215
|
-
__decorateParam(4, _univerjs_core.ICommandService)
|
|
213
|
+
__decorateParam(1, _univerjs_core.IContextService),
|
|
214
|
+
__decorateParam(2, _univerjs_find_replace.IFindReplaceService),
|
|
215
|
+
__decorateParam(3, _univerjs_core.ICommandService)
|
|
216
216
|
], SheetsFindReplaceController);
|
|
217
217
|
const SHEETS_FIND_REPLACE_PROVIDER_NAME = "sheets-find-replace-provider";
|
|
218
218
|
const FIND_REPLACE_Z_INDEX = 1e4;
|
|
@@ -272,9 +272,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
|
|
|
272
272
|
this.findInWorkbook(query);
|
|
273
273
|
break;
|
|
274
274
|
case _univerjs_find_replace.FindScope.SUBUNIT:
|
|
275
|
-
default:
|
|
276
|
-
this.findInActiveWorksheet(query);
|
|
277
|
-
break;
|
|
275
|
+
default: this.findInActiveWorksheet(query);
|
|
278
276
|
}
|
|
279
277
|
}
|
|
280
278
|
focusSelection() {
|
|
@@ -475,7 +473,8 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
|
|
|
475
473
|
if (currentRender == null) return;
|
|
476
474
|
const { scene } = currentRender;
|
|
477
475
|
const matches = this._matches;
|
|
478
|
-
const
|
|
476
|
+
const searchBackgroundColor = this._themeService.getColorFromTheme("yellow.400");
|
|
477
|
+
const color = new _univerjs_core.ColorKit(searchBackgroundColor).toRgb();
|
|
479
478
|
const worksheet = this._workbook.getActiveSheet();
|
|
480
479
|
if (!worksheet) return;
|
|
481
480
|
const activeSheetId = worksheet.getSheetId();
|
|
@@ -650,7 +649,7 @@ let SheetFindModel = class SheetFindModel extends _univerjs_find_replace.FindMod
|
|
|
650
649
|
const matchRange = match.range.range;
|
|
651
650
|
if (!(findByRow ? isBehindPositionWithRowPriority(range, matchRange) : isBehindPositionWithColumnPriority(range, matchRange))) return false;
|
|
652
651
|
const isSame = isSamePosition(range, matchRange);
|
|
653
|
-
return stayIfOnMatch
|
|
652
|
+
return stayIfOnMatch || !isSame;
|
|
654
653
|
});
|
|
655
654
|
if (index === -1) index = matches.length - 1;
|
|
656
655
|
const match = matches[index];
|
|
@@ -876,7 +875,7 @@ function trimLeadingTrailingWhitespace(value) {
|
|
|
876
875
|
//#endregion
|
|
877
876
|
//#region package.json
|
|
878
877
|
var name = "@univerjs/sheets-find-replace";
|
|
879
|
-
var version = "1.0.0
|
|
878
|
+
var version = "1.0.0";
|
|
880
879
|
|
|
881
880
|
//#endregion
|
|
882
881
|
//#region src/config/config.ts
|
|
@@ -899,6 +898,103 @@ const SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY = "sheets-find-replace.config";
|
|
|
899
898
|
const configSymbol = Symbol(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY);
|
|
900
899
|
const defaultPluginConfig = {};
|
|
901
900
|
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/controllers/mobile/sheet-find-replace-mobile.controller.ts
|
|
903
|
+
const MOBILE_FIND_REPLACE_BAR_SELECTOR = "[data-u-comp=\"mobile-find-replace-bar\"]";
|
|
904
|
+
const MOBILE_FIND_MATCH_SAFE_PADDING = 8;
|
|
905
|
+
function getMobileFindMatchScrollOffset(cellBottom, barTop, safePadding) {
|
|
906
|
+
return Math.max(0, cellBottom - barTop + safePadding);
|
|
907
|
+
}
|
|
908
|
+
let SheetsFindReplaceMobileController = class SheetsFindReplaceMobileController extends _univerjs_core.Disposable {
|
|
909
|
+
constructor(_commandService, _univerInstanceService, _renderManagerService) {
|
|
910
|
+
super();
|
|
911
|
+
this._commandService = _commandService;
|
|
912
|
+
this._univerInstanceService = _univerInstanceService;
|
|
913
|
+
this._renderManagerService = _renderManagerService;
|
|
914
|
+
_defineProperty(this, "_pendingFrameId", null);
|
|
915
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((command, options) => {
|
|
916
|
+
var _command$params;
|
|
917
|
+
if (command.id !== _univerjs_sheets_ui.ScrollToCellCommand.id || (options === null || options === void 0 ? void 0 : options.fromFindReplace) !== true) return;
|
|
918
|
+
const range = (_command$params = command.params) === null || _command$params === void 0 ? void 0 : _command$params.range;
|
|
919
|
+
if (!range) return;
|
|
920
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
921
|
+
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
922
|
+
if (!workbook || !worksheet) return;
|
|
923
|
+
this._scheduleReveal(workbook.getUnitId(), worksheet.getSheetId(), range.endRow, range.endColumn);
|
|
924
|
+
}));
|
|
925
|
+
}
|
|
926
|
+
dispose() {
|
|
927
|
+
if (this._pendingFrameId !== null) {
|
|
928
|
+
cancelAnimationFrame(this._pendingFrameId);
|
|
929
|
+
this._pendingFrameId = null;
|
|
930
|
+
}
|
|
931
|
+
super.dispose();
|
|
932
|
+
}
|
|
933
|
+
_scheduleReveal(unitId, subUnitId, row, column) {
|
|
934
|
+
if (this._pendingFrameId !== null) cancelAnimationFrame(this._pendingFrameId);
|
|
935
|
+
this._pendingFrameId = requestAnimationFrame(() => {
|
|
936
|
+
this._pendingFrameId = null;
|
|
937
|
+
this._revealMatch(unitId, subUnitId, row, column);
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
_revealMatch(unitId, subUnitId, row, column) {
|
|
941
|
+
const bar = document.querySelector(MOBILE_FIND_REPLACE_BAR_SELECTOR);
|
|
942
|
+
if (!bar) return;
|
|
943
|
+
const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
944
|
+
const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
|
|
945
|
+
if (!workbook || !worksheet || workbook.getUnitId() !== unitId || worksheet.getSheetId() !== subUnitId) return;
|
|
946
|
+
const render = this._renderManagerService.getRenderUnitById(workbook.getUnitId());
|
|
947
|
+
const sheetObject = (0, _univerjs_sheets_ui.getSheetObject)(workbook, this._renderManagerService);
|
|
948
|
+
const skeleton = render === null || render === void 0 ? void 0 : render.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeleton(worksheet.getSheetId());
|
|
949
|
+
if (!sheetObject || !skeleton) return;
|
|
950
|
+
const { scene, engine } = sheetObject;
|
|
951
|
+
const viewport = (0, _univerjs_sheets_ui.getViewportByCell)(row, column, scene, worksheet);
|
|
952
|
+
if (!viewport) return;
|
|
953
|
+
const { endY } = (0, _univerjs_sheets_ui.getCoordByCell)(row, column, scene, skeleton);
|
|
954
|
+
const { scaleY } = scene.getAncestorScale();
|
|
955
|
+
const scrollXY = scene.getViewportScrollXY(viewport);
|
|
956
|
+
const offsetY = getMobileFindMatchScrollOffset(engine.getCanvasElement().getBoundingClientRect().top + (0, _univerjs_engine_render.convertTransformToOffsetY)(endY, scaleY, scrollXY), bar.getBoundingClientRect().top, MOBILE_FIND_MATCH_SAFE_PADDING);
|
|
957
|
+
if (offsetY === 0) return;
|
|
958
|
+
this._commandService.executeCommand(_univerjs_sheets_ui.SetScrollRelativeCommand.id, { offsetY }).catch(() => void 0);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
SheetsFindReplaceMobileController = __decorate([
|
|
962
|
+
__decorateParam(0, _univerjs_core.ICommandService),
|
|
963
|
+
__decorateParam(1, _univerjs_core.IUniverInstanceService),
|
|
964
|
+
__decorateParam(2, _univerjs_engine_render.IRenderManagerService)
|
|
965
|
+
], SheetsFindReplaceMobileController);
|
|
966
|
+
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/mobile-plugin.ts
|
|
969
|
+
let UniverSheetsFindReplaceMobileUIPlugin = class UniverSheetsFindReplaceMobileUIPlugin extends _univerjs_core.Plugin {
|
|
970
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
971
|
+
super();
|
|
972
|
+
this._config = _config;
|
|
973
|
+
this._injector = _injector;
|
|
974
|
+
this._configService = _configService;
|
|
975
|
+
const { ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
|
|
976
|
+
this._configService.setConfig(SHEETS_FIND_REPLACE_PLUGIN_CONFIG_KEY, rest);
|
|
977
|
+
}
|
|
978
|
+
onStarting() {
|
|
979
|
+
[[SheetsFindReplaceController], [SheetsFindReplaceMobileController]].forEach((dependency) => this._injector.add(dependency));
|
|
980
|
+
}
|
|
981
|
+
onRendered() {
|
|
982
|
+
this._injector.get(SheetsFindReplaceMobileController);
|
|
983
|
+
}
|
|
984
|
+
onSteady() {
|
|
985
|
+
this._injector.get(SheetsFindReplaceController);
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
_defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "pluginName", "SHEET_FIND_REPLACE_PLUGIN");
|
|
989
|
+
_defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "packageName", name);
|
|
990
|
+
_defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "version", version);
|
|
991
|
+
_defineProperty(UniverSheetsFindReplaceMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
992
|
+
UniverSheetsFindReplaceMobileUIPlugin = __decorate([
|
|
993
|
+
(0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_find_replace.UniverFindReplaceMobileUIPlugin, _univerjs_sheets_ui.UniverSheetsMobileUIPlugin),
|
|
994
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
995
|
+
__decorateParam(2, _univerjs_core.IConfigService)
|
|
996
|
+
], UniverSheetsFindReplaceMobileUIPlugin);
|
|
997
|
+
|
|
902
998
|
//#endregion
|
|
903
999
|
//#region src/plugin.ts
|
|
904
1000
|
let UniverSheetsFindReplacePlugin = class UniverSheetsFindReplacePlugin extends _univerjs_core.Plugin {
|
|
@@ -935,6 +1031,12 @@ Object.defineProperty(exports, 'SheetsFindReplaceController', {
|
|
|
935
1031
|
return SheetsFindReplaceController;
|
|
936
1032
|
}
|
|
937
1033
|
});
|
|
1034
|
+
Object.defineProperty(exports, 'UniverSheetsFindReplaceMobileUIPlugin', {
|
|
1035
|
+
enumerable: true,
|
|
1036
|
+
get: function () {
|
|
1037
|
+
return UniverSheetsFindReplaceMobileUIPlugin;
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
938
1040
|
Object.defineProperty(exports, 'UniverSheetsFindReplacePlugin', {
|
|
939
1041
|
enumerable: true,
|
|
940
1042
|
get: function () {
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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);
|