@univerjs/sheets-find-replace 0.20.1 → 0.21.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/cjs/facade.js +204 -1
- package/lib/cjs/index.js +936 -1
- package/lib/cjs/locale/ca-ES.js +9 -1
- package/lib/cjs/locale/en-US.js +24 -1
- package/lib/cjs/locale/es-ES.js +9 -1
- package/lib/cjs/locale/fa-IR.js +9 -1
- package/lib/cjs/locale/fr-FR.js +9 -1
- package/lib/cjs/locale/ja-JP.js +9 -1
- package/lib/cjs/locale/ko-KR.js +9 -1
- package/lib/cjs/locale/ru-RU.js +9 -1
- package/lib/cjs/locale/sk-SK.js +9 -1
- package/lib/cjs/locale/vi-VN.js +9 -1
- package/lib/cjs/locale/zh-CN.js +24 -1
- package/lib/cjs/locale/zh-TW.js +9 -1
- package/lib/es/facade.js +205 -1
- package/lib/es/index.js +923 -1
- package/lib/es/locale/ca-ES.js +8 -1
- package/lib/es/locale/en-US.js +23 -1
- package/lib/es/locale/es-ES.js +8 -1
- package/lib/es/locale/fa-IR.js +8 -1
- package/lib/es/locale/fr-FR.js +8 -1
- package/lib/es/locale/ja-JP.js +8 -1
- package/lib/es/locale/ko-KR.js +8 -1
- package/lib/es/locale/ru-RU.js +8 -1
- package/lib/es/locale/sk-SK.js +8 -1
- package/lib/es/locale/vi-VN.js +8 -1
- package/lib/es/locale/zh-CN.js +23 -1
- package/lib/es/locale/zh-TW.js +8 -1
- package/lib/facade.js +205 -1
- package/lib/index.js +923 -1
- package/lib/locale/ca-ES.js +8 -1
- package/lib/locale/en-US.js +23 -1
- package/lib/locale/es-ES.js +8 -1
- package/lib/locale/fa-IR.js +8 -1
- package/lib/locale/fr-FR.js +8 -1
- package/lib/locale/ja-JP.js +8 -1
- package/lib/locale/ko-KR.js +8 -1
- package/lib/locale/ru-RU.js +8 -1
- package/lib/locale/sk-SK.js +8 -1
- package/lib/locale/vi-VN.js +8 -1
- package/lib/locale/zh-CN.js +23 -1
- package/lib/locale/zh-TW.js +8 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/cjs/locale/ca-ES.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ca-ES.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "No s’ha pogut substituir algunes cel·les",
|
|
5
|
+
failure: "No s’ha pogut substituir cap cel·la"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/en-US.ts
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
19
|
+
"partial-failure": "Failed to replace some cells",
|
|
20
|
+
failure: "Failed to replace all cells"
|
|
21
|
+
} } };
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
module.exports = locale;
|
package/lib/cjs/locale/es-ES.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/es-ES.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "No se pudo reemplazar algunas celdas",
|
|
5
|
+
failure: "No se pudo reemplazar ninguna celda"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/fa-IR.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "جایگزینی برخی سلولها ناموفق بود",
|
|
5
|
+
failure: "جایگزینی همه سلولها ناموفق بود"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/fr-FR.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "Échec du remplacement de certaines cellules",
|
|
5
|
+
failure: "Échec du remplacement de toutes les cellules"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/ja-JP.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ja-JP.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "一部のセルの置換に失敗しました",
|
|
5
|
+
failure: "すべてのセルの置換に失敗しました"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/ko-KR.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ko-KR.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "일부 셀 교체에 실패했습니다",
|
|
5
|
+
failure: "모든 셀 교체에 실패했습니다"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/ru-RU.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "Не удалось заменить некоторые ячейки",
|
|
5
|
+
failure: "Не удалось заменить все ячейки"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/sk-SK.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/sk-SK.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "Nepodarilo sa nahradiť niektoré bunky",
|
|
5
|
+
failure: "Nepodarilo sa nahradiť všetky bunky"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/vi-VN.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "Thay thế một phần ô thất bại",
|
|
5
|
+
failure: "Thay thế thất bại"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/cjs/locale/zh-CN.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/zh-CN.ts
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
var zh_CN_default = { "sheet-find-replace": { replace: {
|
|
19
|
+
"partial-failure": "部分单元格替换失败",
|
|
20
|
+
failure: "替换失败"
|
|
21
|
+
} } };
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
module.exports = zh_CN_default;
|
package/lib/cjs/locale/zh-TW.js
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/locale/zh-TW.ts
|
|
3
|
+
const locale = { "sheet-find-replace": { replace: {
|
|
4
|
+
"partial-failure": "部分儲存格替換失敗",
|
|
5
|
+
failure: "替換失敗"
|
|
6
|
+
} } };
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
module.exports = locale;
|
package/lib/es/facade.js
CHANGED
|
@@ -1 +1,205 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Disposable, IUniverInstanceService, Inject, Injector } from "@univerjs/core";
|
|
2
|
+
import { FindBy, FindReplaceModel, FindReplaceState, IFindReplaceService, createInitFindReplaceState } from "@univerjs/find-replace";
|
|
3
|
+
import { FRange } from "@univerjs/sheets/facade";
|
|
4
|
+
import { FUniver } from "@univerjs/core/facade";
|
|
5
|
+
|
|
6
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
|
|
7
|
+
function _typeof(o) {
|
|
8
|
+
"@babel/helpers - typeof";
|
|
9
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
10
|
+
return typeof o;
|
|
11
|
+
} : function(o) {
|
|
12
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
13
|
+
}, _typeof(o);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
|
|
18
|
+
function toPrimitive(t, r) {
|
|
19
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
20
|
+
var e = t[Symbol.toPrimitive];
|
|
21
|
+
if (void 0 !== e) {
|
|
22
|
+
var i = e.call(t, r || "default");
|
|
23
|
+
if ("object" != _typeof(i)) return i;
|
|
24
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
25
|
+
}
|
|
26
|
+
return ("string" === r ? String : Number)(t);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
|
|
31
|
+
function toPropertyKey(t) {
|
|
32
|
+
var i = toPrimitive(t, "string");
|
|
33
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
|
|
38
|
+
function _defineProperty(e, r, t) {
|
|
39
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
40
|
+
value: t,
|
|
41
|
+
enumerable: !0,
|
|
42
|
+
configurable: !0,
|
|
43
|
+
writable: !0
|
|
44
|
+
}) : e[r] = t, e;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
|
|
49
|
+
function __decorateParam(paramIndex, decorator) {
|
|
50
|
+
return function(target, key) {
|
|
51
|
+
decorator(target, key, paramIndex);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
|
|
57
|
+
function __decorate(decorators, target, key, desc) {
|
|
58
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
59
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
60
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
61
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/facade/f-text-finder.ts
|
|
66
|
+
let FTextFinder = class FTextFinder extends Disposable {
|
|
67
|
+
constructor(_initialState, _injector, _univerInstanceService, _findReplaceService) {
|
|
68
|
+
super();
|
|
69
|
+
this._injector = _injector;
|
|
70
|
+
this._univerInstanceService = _univerInstanceService;
|
|
71
|
+
this._findReplaceService = _findReplaceService;
|
|
72
|
+
_defineProperty(this, "_state", new FindReplaceState());
|
|
73
|
+
_defineProperty(this, "_model", void 0);
|
|
74
|
+
_defineProperty(this, "_complete", void 0);
|
|
75
|
+
const providers = this._findReplaceService.getProviders();
|
|
76
|
+
this._model = this._injector.createInstance(FindReplaceModel, this._state, providers);
|
|
77
|
+
const newState = {
|
|
78
|
+
...createInitFindReplaceState(),
|
|
79
|
+
..._initialState
|
|
80
|
+
};
|
|
81
|
+
this._state.changeState(newState);
|
|
82
|
+
}
|
|
83
|
+
findAll() {
|
|
84
|
+
if (!this._state.findCompleted || !this._complete) return [];
|
|
85
|
+
return this._complete.results.map((result) => {
|
|
86
|
+
return this._findMatchToFRange(result);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
findNext() {
|
|
90
|
+
var _this$_model;
|
|
91
|
+
if (!this._state.findCompleted || !this._complete) return null;
|
|
92
|
+
const match = (_this$_model = this._model) === null || _this$_model === void 0 ? void 0 : _this$_model.moveToNextMatch();
|
|
93
|
+
if (!match) return null;
|
|
94
|
+
return this._findMatchToFRange(match);
|
|
95
|
+
}
|
|
96
|
+
findPrevious() {
|
|
97
|
+
var _this$_model2;
|
|
98
|
+
const match = (_this$_model2 = this._model) === null || _this$_model2 === void 0 ? void 0 : _this$_model2.moveToPreviousMatch();
|
|
99
|
+
if (!match) return null;
|
|
100
|
+
return this._findMatchToFRange(match);
|
|
101
|
+
}
|
|
102
|
+
getCurrentMatch() {
|
|
103
|
+
var _this$_model3;
|
|
104
|
+
if (!this._state.findCompleted || !this._complete) throw new Error("Find operation is not completed.");
|
|
105
|
+
const match = (_this$_model3 = this._model) === null || _this$_model3 === void 0 ? void 0 : _this$_model3.currentMatch$.value;
|
|
106
|
+
if (!match) return null;
|
|
107
|
+
return this._findMatchToFRange(match);
|
|
108
|
+
}
|
|
109
|
+
async matchCaseAsync(matchCase) {
|
|
110
|
+
this._state.changeState({
|
|
111
|
+
caseSensitive: matchCase,
|
|
112
|
+
findCompleted: false
|
|
113
|
+
});
|
|
114
|
+
return new Promise((resolve) => {
|
|
115
|
+
const subscribe = this._state.stateUpdates$.subscribe(async (state) => {
|
|
116
|
+
if (state.findCompleted === true) {
|
|
117
|
+
subscribe.unsubscribe();
|
|
118
|
+
await this.ensureCompleteAsync();
|
|
119
|
+
resolve(this);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async matchEntireCellAsync(matchEntireCell) {
|
|
125
|
+
this._state.changeState({
|
|
126
|
+
matchesTheWholeCell: matchEntireCell,
|
|
127
|
+
findCompleted: false
|
|
128
|
+
});
|
|
129
|
+
return new Promise((resolve) => {
|
|
130
|
+
const subscribe = this._state.stateUpdates$.subscribe(async (state) => {
|
|
131
|
+
if (state.findCompleted === true) {
|
|
132
|
+
subscribe.unsubscribe();
|
|
133
|
+
await this.ensureCompleteAsync();
|
|
134
|
+
resolve(this);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async matchFormulaTextAsync(matchFormulaText) {
|
|
140
|
+
this._state.changeState({
|
|
141
|
+
findBy: matchFormulaText ? FindBy.FORMULA : FindBy.VALUE,
|
|
142
|
+
findCompleted: false
|
|
143
|
+
});
|
|
144
|
+
return new Promise((resolve) => {
|
|
145
|
+
const subscribe = this._state.stateUpdates$.subscribe(async (state) => {
|
|
146
|
+
if (state.findCompleted === true) {
|
|
147
|
+
subscribe.unsubscribe();
|
|
148
|
+
await this.ensureCompleteAsync();
|
|
149
|
+
resolve(this);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async replaceAllWithAsync(replaceText) {
|
|
155
|
+
var _await$this$_model$re, _await$this$_model$re2, _this$_model4;
|
|
156
|
+
await this._state.changeState({
|
|
157
|
+
replaceRevealed: true,
|
|
158
|
+
replaceString: replaceText
|
|
159
|
+
});
|
|
160
|
+
const res = (_await$this$_model$re = (_await$this$_model$re2 = await ((_this$_model4 = this._model) === null || _this$_model4 === void 0 ? void 0 : _this$_model4.replaceAll())) === null || _await$this$_model$re2 === void 0 ? void 0 : _await$this$_model$re2.success) !== null && _await$this$_model$re !== void 0 ? _await$this$_model$re : 0;
|
|
161
|
+
this._state.changeState({ replaceRevealed: false });
|
|
162
|
+
return res;
|
|
163
|
+
}
|
|
164
|
+
async replaceWithAsync(replaceText) {
|
|
165
|
+
var _this$_model5;
|
|
166
|
+
await this._state.changeState({
|
|
167
|
+
replaceRevealed: true,
|
|
168
|
+
replaceString: replaceText
|
|
169
|
+
});
|
|
170
|
+
await ((_this$_model5 = this._model) === null || _this$_model5 === void 0 ? void 0 : _this$_model5.replace());
|
|
171
|
+
this._state.changeState({ replaceRevealed: false });
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
async ensureCompleteAsync() {
|
|
175
|
+
var _this$_model6;
|
|
176
|
+
this._complete = await ((_this$_model6 = this._model) === null || _this$_model6 === void 0 ? void 0 : _this$_model6.start());
|
|
177
|
+
}
|
|
178
|
+
_findMatchToFRange(match) {
|
|
179
|
+
const { unitId } = match;
|
|
180
|
+
const { subUnitId, range } = match.range;
|
|
181
|
+
const workbook = this._univerInstanceService.getUnit(unitId);
|
|
182
|
+
const worksheet = workbook.getSheetBySheetId(subUnitId);
|
|
183
|
+
return this._injector.createInstance(FRange, workbook, worksheet, range);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
FTextFinder = __decorate([
|
|
187
|
+
__decorateParam(1, Inject(Injector)),
|
|
188
|
+
__decorateParam(2, IUniverInstanceService),
|
|
189
|
+
__decorateParam(3, IFindReplaceService)
|
|
190
|
+
], FTextFinder);
|
|
191
|
+
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/facade/f-univer.ts
|
|
194
|
+
var FUniverSheetsFindReplaceMixin = class extends FUniver {
|
|
195
|
+
async createTextFinderAsync(text) {
|
|
196
|
+
const state = { findString: text };
|
|
197
|
+
const textFinder = this._injector.createInstance(FTextFinder, state);
|
|
198
|
+
await textFinder.ensureCompleteAsync();
|
|
199
|
+
return textFinder;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
FUniver.extend(FUniverSheetsFindReplaceMixin);
|
|
203
|
+
|
|
204
|
+
//#endregion
|
|
205
|
+
export { };
|