@univerjs/sheets-filter 0.1.12 → 0.1.13-nightly.202406041140
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,83 +1,83 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { isNumeric as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { BehaviorSubject as
|
|
7
|
-
import { SheetInterceptorService as
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
operator:
|
|
11
|
-
fn: (s,
|
|
12
|
-
}, Le = {
|
|
13
|
-
operator: E.GREATER_THAN_OR_EQUAL,
|
|
14
|
-
fn: (s, r) => A(s) ? s >= r : !1
|
|
15
|
-
}, Be = {
|
|
16
|
-
operator: E.LESS_THAN,
|
|
17
|
-
fn: (s, r) => A(s) ? s < r : !1
|
|
18
|
-
}, Ue = {
|
|
19
|
-
operator: E.LESS_THAN_OR_EQUAL,
|
|
20
|
-
fn: (s, r) => A(s) ? s <= r : !1
|
|
1
|
+
var ue = Object.defineProperty;
|
|
2
|
+
var de = (s, t, e) => t in s ? ue(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var g = (s, t, e) => (de(s, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import { isNumeric as he, Disposable as U, Rectangle as Z, mergeSets as H, Tools as q, extractPureTextFromCell as fe, CellValueType as k, CommandType as $, UniverInstanceType as V, fromCallback as me, OnLifecycle as ee, LifecycleStages as te, IResourceManagerService as _e, IUniverInstanceService as re, ICommandService as se, DisposableCollection as ge, moveMatrixArray as D, Plugin as Ce } from "@univerjs/core";
|
|
5
|
+
import { Inject as L, Injector as Re } from "@wendellhu/redi";
|
|
6
|
+
import { BehaviorSubject as x, merge as pe, filter as Fe, switchMap as we, of as Se } from "rxjs";
|
|
7
|
+
import { SheetInterceptorService as ve, RefRangeService as Me, SetWorksheetActivateCommand as Ee, RemoveSheetCommand as Oe, INTERCEPTOR_POINT as ye, RemoveRowMutation as Ae, InsertRowMutation as Te, getSheetCommandTarget as Ne, MoveRowsCommand as xe, MoveRangeCommand as $e, EffectRefRangId as G, RemoveRowCommand as Ie, RemoveColCommand as Le, InsertColCommand as Be, InsertRowCommand as Pe } from "@univerjs/sheets";
|
|
8
|
+
var O = /* @__PURE__ */ ((s) => (s.EQUAL = "equal", s.GREATER_THAN = "greaterThan", s.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", s.LESS_THAN = "lessThan", s.LESS_THAN_OR_EQUAL = "lessThanOrEqual", s.NOT_EQUALS = "notEqual", s))(O || {});
|
|
9
|
+
const Ue = {
|
|
10
|
+
operator: O.GREATER_THAN,
|
|
11
|
+
fn: (s, t) => T(s) ? s > t : !1
|
|
21
12
|
}, ze = {
|
|
22
|
-
operator:
|
|
23
|
-
fn: (s,
|
|
24
|
-
},
|
|
25
|
-
operator:
|
|
26
|
-
fn: (s,
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
operator: O.GREATER_THAN_OR_EQUAL,
|
|
14
|
+
fn: (s, t) => T(s) ? s >= t : !1
|
|
15
|
+
}, He = {
|
|
16
|
+
operator: O.LESS_THAN,
|
|
17
|
+
fn: (s, t) => T(s) ? s < t : !1
|
|
18
|
+
}, We = {
|
|
19
|
+
operator: O.LESS_THAN_OR_EQUAL,
|
|
20
|
+
fn: (s, t) => T(s) ? s <= t : !1
|
|
21
|
+
}, be = {
|
|
22
|
+
operator: O.EQUAL,
|
|
23
|
+
fn: (s, t) => T(s) ? s === t : !1
|
|
24
|
+
}, ne = {
|
|
25
|
+
operator: O.NOT_EQUALS,
|
|
26
|
+
fn: (s, t) => {
|
|
27
|
+
if (typeof t == "string") {
|
|
28
|
+
if (t === " ")
|
|
29
29
|
return s != null;
|
|
30
|
-
const e =
|
|
31
|
-
return e &&
|
|
30
|
+
const e = oe(s);
|
|
31
|
+
return e && Qe(t) ? !le(t).test(e) : e !== t;
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return T(s) ? s !== t : !0;
|
|
34
34
|
}
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
}, ie = /* @__PURE__ */ new Map([]), ke = [Ue, ze, He, We, be, ne];
|
|
36
|
+
ke.forEach((s) => {
|
|
37
|
+
ie.set(s.operator, s);
|
|
38
38
|
});
|
|
39
|
-
function
|
|
39
|
+
function Ve(s) {
|
|
40
40
|
return !!s;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
fn: (s,
|
|
44
|
-
const e =
|
|
45
|
-
return e === null ?
|
|
42
|
+
const je = {
|
|
43
|
+
fn: (s, t) => {
|
|
44
|
+
const e = oe(s);
|
|
45
|
+
return e === null ? t === "" : le(t).test(e);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
function
|
|
49
|
-
return s ?
|
|
48
|
+
function J(s) {
|
|
49
|
+
return s ? ie.get(s) : je;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function T(s) {
|
|
52
52
|
return typeof s == "number";
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return !!(typeof s == "number" || typeof s == "string" &&
|
|
54
|
+
function X(s) {
|
|
55
|
+
return !!(typeof s == "number" || typeof s == "string" && he(s));
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function oe(s) {
|
|
58
58
|
return typeof s == "boolean" || s == null ? null : typeof s == "string" ? s : s.toString();
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Qe(s) {
|
|
61
61
|
return typeof s == "number" ? !1 : s.indexOf("*") !== -1 || s.indexOf("?") !== -1;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
return new RegExp(`^${
|
|
63
|
+
function le(s) {
|
|
64
|
+
const t = s.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("?", ".").replace(/[*]/g, ".$&");
|
|
65
|
+
return new RegExp(`^${t}$`);
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
class
|
|
69
|
-
constructor(e,
|
|
67
|
+
const W = () => /* @__PURE__ */ new Set();
|
|
68
|
+
class P extends U {
|
|
69
|
+
constructor(e, r, n) {
|
|
70
70
|
super();
|
|
71
|
-
|
|
71
|
+
g(this, "_filteredOutRows$", new x(W()));
|
|
72
72
|
/** An observable value. A set of filtered out rows. */
|
|
73
|
-
|
|
73
|
+
g(this, "filteredOutRows$", this._filteredOutRows$.asObservable());
|
|
74
74
|
// TODO: we may need to update which cols have criteria rather than simple boolean
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.unitId = e, this.subUnitId =
|
|
75
|
+
g(this, "_hasCriteria$", new x(!1));
|
|
76
|
+
g(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
77
|
+
g(this, "_filterColumnByIndex", /* @__PURE__ */ new Map());
|
|
78
|
+
g(this, "_alreadyFilteredOutRows", W());
|
|
79
|
+
g(this, "_range");
|
|
80
|
+
this.unitId = e, this.subUnitId = r, this._worksheet = n;
|
|
81
81
|
}
|
|
82
82
|
get filteredOutRows() {
|
|
83
83
|
return this._filteredOutRows$.getValue();
|
|
@@ -93,8 +93,8 @@ class L extends B {
|
|
|
93
93
|
*/
|
|
94
94
|
serialize() {
|
|
95
95
|
const e = {
|
|
96
|
-
ref:
|
|
97
|
-
filterColumns: this._getAllFilterColumns(!0).sort(([
|
|
96
|
+
ref: Z.clone(this._range),
|
|
97
|
+
filterColumns: this._getAllFilterColumns(!0).sort(([r], [n]) => r - n).map(([r, n]) => n.serialize())
|
|
98
98
|
};
|
|
99
99
|
return this._alreadyFilteredOutRows && (e.cachedFilteredOut = Array.from(this._alreadyFilteredOutRows).sort()), e;
|
|
100
100
|
}
|
|
@@ -105,13 +105,13 @@ class L extends B {
|
|
|
105
105
|
* @param worksheet the Worksheet object
|
|
106
106
|
* @param autoFilter auto filter data
|
|
107
107
|
*/
|
|
108
|
-
static deserialize(e,
|
|
109
|
-
const o = new
|
|
108
|
+
static deserialize(e, r, n, i) {
|
|
109
|
+
const o = new P(e, r, n);
|
|
110
110
|
return o._dump(i), o;
|
|
111
111
|
}
|
|
112
112
|
_dump(e) {
|
|
113
|
-
var
|
|
114
|
-
this.setRange(e.ref), (
|
|
113
|
+
var r;
|
|
114
|
+
this.setRange(e.ref), (r = e.filterColumns) == null || r.forEach((n) => this._setCriteriaWithoutReCalc(n.colId, n)), e.cachedFilteredOut && (this._alreadyFilteredOutRows = new Set(e.cachedFilteredOut), this._emit()), this._emitHasCriteria();
|
|
115
115
|
}
|
|
116
116
|
isRowFiltered(e) {
|
|
117
117
|
return this._alreadyFilteredOutRows.has(e);
|
|
@@ -127,9 +127,9 @@ class L extends B {
|
|
|
127
127
|
* @param col
|
|
128
128
|
*/
|
|
129
129
|
getFilteredOutRowsExceptCol(e) {
|
|
130
|
-
return this._getAllFilterColumns(!0).filter(([
|
|
131
|
-
const i = n.calc({ getAlreadyFilteredOutRows: () =>
|
|
132
|
-
return i ?
|
|
130
|
+
return this._getAllFilterColumns(!0).filter(([r]) => r !== e).reduce((r, [, n]) => {
|
|
131
|
+
const i = n.calc({ getAlreadyFilteredOutRows: () => r });
|
|
132
|
+
return i ? H(r, i) : r;
|
|
133
133
|
}, /* @__PURE__ */ new Set());
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
@@ -137,45 +137,45 @@ class L extends B {
|
|
|
137
137
|
* if the new range not overlaps the old range.
|
|
138
138
|
*/
|
|
139
139
|
setRange(e) {
|
|
140
|
-
this._range = e, this._getAllFilterColumns(!0).forEach(([
|
|
140
|
+
this._range = e, this._getAllFilterColumns(!0).forEach(([r, n]) => {
|
|
141
141
|
n.setRangeAndColumn({
|
|
142
142
|
startRow: e.startRow,
|
|
143
143
|
endRow: e.endRow,
|
|
144
|
-
startColumn:
|
|
145
|
-
endColumn:
|
|
146
|
-
},
|
|
144
|
+
startColumn: r,
|
|
145
|
+
endColumn: r
|
|
146
|
+
}, r);
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Set or remove filter criteria on a specific row.
|
|
151
151
|
*/
|
|
152
|
-
setCriteria(e,
|
|
152
|
+
setCriteria(e, r, n = !1) {
|
|
153
153
|
if (!this._range)
|
|
154
154
|
throw new Error("[FilterModel] could not set criteria before a range is set!");
|
|
155
|
-
if (!
|
|
155
|
+
if (!r) {
|
|
156
156
|
this._removeCriteria(e), this._rebuildAlreadyFilteredOutRowsWithCache(), n && this._reCalcAllColumns(), this._emit(), this._emitHasCriteria();
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
|
-
this._setCriteriaWithoutReCalc(e,
|
|
159
|
+
this._setCriteriaWithoutReCalc(e, r), n && (this._rebuildAlreadyFilteredOutRowsWithCache(), this._reCalcWithNoCacheColumns(), this._emit(), this._emitHasCriteria());
|
|
160
160
|
}
|
|
161
161
|
getAllFilterColumns() {
|
|
162
162
|
return this._getAllFilterColumns(!0);
|
|
163
163
|
}
|
|
164
164
|
getFilterColumn(e) {
|
|
165
|
-
var
|
|
166
|
-
return (
|
|
165
|
+
var r;
|
|
166
|
+
return (r = this._filterColumnByIndex.get(e)) != null ? r : null;
|
|
167
167
|
}
|
|
168
168
|
reCalc() {
|
|
169
169
|
this._reCalcAllColumns(), this._emit();
|
|
170
170
|
}
|
|
171
171
|
_getAllFilterColumns(e = !1) {
|
|
172
|
-
const
|
|
173
|
-
return e ?
|
|
172
|
+
const r = Array.from(this._filterColumnByIndex.entries());
|
|
173
|
+
return e ? r : r.map(([n, i]) => i);
|
|
174
174
|
}
|
|
175
175
|
_reCalcAllColumns() {
|
|
176
|
-
this._alreadyFilteredOutRows =
|
|
176
|
+
this._alreadyFilteredOutRows = W(), this._getAllFilterColumns().forEach((e) => e.__clearCache()), this._reCalcWithNoCacheColumns();
|
|
177
177
|
}
|
|
178
|
-
_setCriteriaWithoutReCalc(e,
|
|
178
|
+
_setCriteriaWithoutReCalc(e, r) {
|
|
179
179
|
const n = this._range;
|
|
180
180
|
if (!n)
|
|
181
181
|
throw new Error("[FilterModel] could not set criteria before a range is set!");
|
|
@@ -183,17 +183,17 @@ class L extends B {
|
|
|
183
183
|
if (e > o || e < i)
|
|
184
184
|
throw new Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);
|
|
185
185
|
let l;
|
|
186
|
-
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new
|
|
186
|
+
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new qe(
|
|
187
187
|
this.unitId,
|
|
188
188
|
this.subUnitId,
|
|
189
189
|
this._worksheet,
|
|
190
|
-
|
|
190
|
+
r,
|
|
191
191
|
{ getAlreadyFilteredOutRows: () => this._alreadyFilteredOutRows }
|
|
192
|
-
), l.setRangeAndColumn(n, e), this._filterColumnByIndex.set(e, l)), l.setCriteria(
|
|
192
|
+
), l.setRangeAndColumn(n, e), this._filterColumnByIndex.set(e, l)), l.setCriteria(r);
|
|
193
193
|
}
|
|
194
194
|
_removeCriteria(e) {
|
|
195
|
-
const
|
|
196
|
-
|
|
195
|
+
const r = this._filterColumnByIndex.get(e);
|
|
196
|
+
r && (r.dispose(), this._filterColumnByIndex.delete(e));
|
|
197
197
|
}
|
|
198
198
|
_emit() {
|
|
199
199
|
this._filteredOutRows$.next(this._alreadyFilteredOutRows);
|
|
@@ -202,27 +202,27 @@ class L extends B {
|
|
|
202
202
|
this._hasCriteria$.next(this._filterColumnByIndex.size > 0);
|
|
203
203
|
}
|
|
204
204
|
_rebuildAlreadyFilteredOutRowsWithCache() {
|
|
205
|
-
const e = this._getAllFilterColumns().filter((
|
|
205
|
+
const e = this._getAllFilterColumns().filter((r) => r.hasCache()).reduce((r, n) => H(r, n.filteredOutRows), /* @__PURE__ */ new Set());
|
|
206
206
|
this._alreadyFilteredOutRows = e;
|
|
207
207
|
}
|
|
208
208
|
_reCalcWithNoCacheColumns() {
|
|
209
|
-
const e = this._getAllFilterColumns().filter((
|
|
210
|
-
for (const
|
|
211
|
-
const n =
|
|
212
|
-
n && (this._alreadyFilteredOutRows =
|
|
209
|
+
const e = this._getAllFilterColumns().filter((r) => !r.hasCache());
|
|
210
|
+
for (const r of e) {
|
|
211
|
+
const n = r.reCalc();
|
|
212
|
+
n && (this._alreadyFilteredOutRows = H(this._alreadyFilteredOutRows, n));
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
class
|
|
217
|
-
constructor(e,
|
|
216
|
+
class qe extends U {
|
|
217
|
+
constructor(e, r, n, i, o) {
|
|
218
218
|
super();
|
|
219
|
-
|
|
219
|
+
g(this, "_filteredOutRows", null);
|
|
220
220
|
/** Cache the filter function. */
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.unitId = e, this.subUnitId =
|
|
221
|
+
g(this, "_filterFn", null);
|
|
222
|
+
g(this, "_range", null);
|
|
223
|
+
g(this, "_column", 0);
|
|
224
|
+
g(this, "_filterByValues", !1);
|
|
225
|
+
this.unitId = e, this.subUnitId = r, this._worksheet = n, this._criteria = i, this._filterColumnContext = o;
|
|
226
226
|
}
|
|
227
227
|
get filteredOutRows() {
|
|
228
228
|
return this._filteredOutRows;
|
|
@@ -239,7 +239,7 @@ class Ve extends B {
|
|
|
239
239
|
serialize() {
|
|
240
240
|
if (!this._criteria)
|
|
241
241
|
throw new Error("[FilterColumn]: could not serialize without a filter column!");
|
|
242
|
-
return
|
|
242
|
+
return q.deepClone({
|
|
243
243
|
...this._criteria,
|
|
244
244
|
colId: this._column
|
|
245
245
|
});
|
|
@@ -248,14 +248,14 @@ class Ve extends B {
|
|
|
248
248
|
return this._filteredOutRows !== null;
|
|
249
249
|
}
|
|
250
250
|
// The first row should be omitted!
|
|
251
|
-
setRangeAndColumn(e,
|
|
252
|
-
this._range = e, this._column =
|
|
251
|
+
setRangeAndColumn(e, r) {
|
|
252
|
+
this._range = e, this._column = r;
|
|
253
253
|
}
|
|
254
254
|
setCriteria(e) {
|
|
255
255
|
this._criteria = e, this._generateFilterFn(), this._filteredOutRows = null;
|
|
256
256
|
}
|
|
257
257
|
getColumnData() {
|
|
258
|
-
return
|
|
258
|
+
return q.deepClone(this._criteria);
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Trigger new calculation on this `FilterModel` instance.
|
|
@@ -273,15 +273,15 @@ class Ve extends B {
|
|
|
273
273
|
throw new Error("[FilterColumn] cannot calculate without a range!");
|
|
274
274
|
if (typeof this._column != "number")
|
|
275
275
|
throw new TypeError("[FilterColumn] cannot calculate without a column offset!");
|
|
276
|
-
const
|
|
276
|
+
const r = this._column, n = { startColumn: r, endColumn: r, startRow: this._range.startRow + 1, endRow: this._range.endRow }, i = /* @__PURE__ */ new Set(), o = e.getAlreadyFilteredOutRows();
|
|
277
277
|
for (const l of this._worksheet.iterateByColumn(n, !1, !1)) {
|
|
278
278
|
const { row: a, rowSpan: u, col: c } = l;
|
|
279
279
|
if (o.has(a) && (!u || u === 1))
|
|
280
280
|
continue;
|
|
281
|
-
const h = this._filterByValues ?
|
|
281
|
+
const h = this._filterByValues ? fe(this._worksheet.getCell(a, c)) : et(this._worksheet, a, c);
|
|
282
282
|
if (!this._filterFn(h) && (i.add(a), u))
|
|
283
|
-
for (let
|
|
284
|
-
i.add(a +
|
|
283
|
+
for (let _ = 1; _ < u; _++)
|
|
284
|
+
i.add(a + _);
|
|
285
285
|
}
|
|
286
286
|
return i;
|
|
287
287
|
}
|
|
@@ -291,108 +291,110 @@ class Ve extends B {
|
|
|
291
291
|
}
|
|
292
292
|
function De(s) {
|
|
293
293
|
if (s.filters)
|
|
294
|
-
return
|
|
294
|
+
return Ge(s.filters);
|
|
295
295
|
if (s.customFilters)
|
|
296
|
-
return
|
|
296
|
+
return Je(s.customFilters);
|
|
297
297
|
throw new Error("[FilterModel]: other types of filters are not supported yet.");
|
|
298
298
|
}
|
|
299
|
-
function Qe(s) {
|
|
300
|
-
const r = !!s.blank, e = new Set(s.filters);
|
|
301
|
-
return (t) => t === void 0 || t === "" ? r : e.has(typeof t == "string" ? t : `${t}`);
|
|
302
|
-
}
|
|
303
|
-
function qe(s) {
|
|
304
|
-
const r = s.customFilters.map((e) => Ye(e));
|
|
305
|
-
return Xe(r) ? s.and ? Ge(r) : Je(r) : r[0];
|
|
306
|
-
}
|
|
307
299
|
function Ge(s) {
|
|
308
|
-
const
|
|
309
|
-
return (
|
|
300
|
+
const t = !!s.blank, e = new Set(s.filters);
|
|
301
|
+
return (r) => r === void 0 || r === "" ? t : e.has(typeof r == "string" ? r : `${r}`);
|
|
310
302
|
}
|
|
311
303
|
function Je(s) {
|
|
312
|
-
const
|
|
313
|
-
return (t)
|
|
304
|
+
const t = s.customFilters.map((e) => Ze(e));
|
|
305
|
+
return Ke(t) ? s.and ? Xe(t) : Ye(t) : t[0];
|
|
314
306
|
}
|
|
315
307
|
function Xe(s) {
|
|
316
|
-
|
|
308
|
+
const [t, e] = s;
|
|
309
|
+
return (r) => t(r) && e(r);
|
|
317
310
|
}
|
|
318
311
|
function Ye(s) {
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
312
|
+
const [t, e] = s;
|
|
313
|
+
return (r) => t(r) || e(r);
|
|
314
|
+
}
|
|
315
|
+
function Ke(s) {
|
|
316
|
+
return s.length === 2;
|
|
317
|
+
}
|
|
318
|
+
function Ze(s) {
|
|
319
|
+
const t = s.val;
|
|
320
|
+
if (s.operator === O.NOT_EQUALS && !X(t))
|
|
321
|
+
return (n) => ne.fn(n, t);
|
|
322
|
+
if (Ve(s.operator)) {
|
|
323
|
+
if (!X(t))
|
|
324
324
|
return () => !1;
|
|
325
|
-
const n =
|
|
325
|
+
const n = J(s.operator), i = Number(t);
|
|
326
326
|
return (o) => n.fn(o, i);
|
|
327
327
|
}
|
|
328
|
-
const e =
|
|
329
|
-
return (
|
|
328
|
+
const e = J(s.operator);
|
|
329
|
+
return (r) => e.fn(r, t);
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
const
|
|
333
|
-
if (!
|
|
331
|
+
function et(s, t, e) {
|
|
332
|
+
const r = s.getCell(t, e);
|
|
333
|
+
if (!r)
|
|
334
334
|
return null;
|
|
335
|
-
const n = s.getCellRaw(
|
|
336
|
-
return
|
|
335
|
+
const n = s.getCellRaw(t, e);
|
|
336
|
+
return r && !n ? Y(r) : n ? r.t === k.NUMBER && typeof r.v == "string" ? n.v : Y(n) : null;
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
var
|
|
340
|
-
const
|
|
341
|
-
if (
|
|
342
|
-
return
|
|
338
|
+
function Y(s) {
|
|
339
|
+
var r, n;
|
|
340
|
+
const t = (n = (r = s.p) == null ? void 0 : r.body) == null ? void 0 : n.dataStream;
|
|
341
|
+
if (t)
|
|
342
|
+
return t.trimEnd();
|
|
343
343
|
const e = s.v;
|
|
344
|
-
return typeof e == "string" ? s.t ===
|
|
344
|
+
return typeof e == "string" ? s.t === k.BOOLEAN ? e.toUpperCase() : e : typeof e == "number" ? s.t === k.BOOLEAN ? e ? "TRUE" : "FALSE" : e : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : "";
|
|
345
345
|
}
|
|
346
|
-
const
|
|
346
|
+
const R = {
|
|
347
347
|
id: "sheet.mutation.set-filter-range",
|
|
348
|
-
type:
|
|
349
|
-
handler: (s,
|
|
350
|
-
const { subUnitId: e, unitId:
|
|
351
|
-
return s.get(v).ensureFilterModel(
|
|
348
|
+
type: $.MUTATION,
|
|
349
|
+
handler: (s, t) => {
|
|
350
|
+
const { subUnitId: e, unitId: r, range: n } = t;
|
|
351
|
+
return s.get(v).ensureFilterModel(r, e).setRange(n), !0;
|
|
352
352
|
}
|
|
353
|
-
},
|
|
353
|
+
}, w = {
|
|
354
354
|
id: "sheet.mutation.set-filter-criteria",
|
|
355
|
-
type:
|
|
356
|
-
handler: (s,
|
|
357
|
-
const { subUnitId: e, unitId:
|
|
355
|
+
type: $.MUTATION,
|
|
356
|
+
handler: (s, t) => {
|
|
357
|
+
const { subUnitId: e, unitId: r, criteria: n, col: i, reCalc: o = !0 } = t, a = s.get(v).getFilterModel(r, e);
|
|
358
358
|
return a ? (a.setCriteria(i, n, o), !0) : !1;
|
|
359
359
|
}
|
|
360
|
-
},
|
|
360
|
+
}, A = {
|
|
361
361
|
id: "sheet.mutation.remove-filter",
|
|
362
|
-
type:
|
|
363
|
-
handler: (s,
|
|
364
|
-
const { unitId: e, subUnitId:
|
|
365
|
-
return s.get(v).removeFilterModel(e,
|
|
362
|
+
type: $.MUTATION,
|
|
363
|
+
handler: (s, t) => {
|
|
364
|
+
const { unitId: e, subUnitId: r } = t;
|
|
365
|
+
return s.get(v).removeFilterModel(e, r);
|
|
366
366
|
}
|
|
367
|
-
},
|
|
367
|
+
}, ae = {
|
|
368
368
|
id: "sheet.mutation.re-calc-filter",
|
|
369
|
-
type:
|
|
370
|
-
handler: (s,
|
|
371
|
-
const { unitId: e, subUnitId:
|
|
369
|
+
type: $.MUTATION,
|
|
370
|
+
handler: (s, t) => {
|
|
371
|
+
const { unitId: e, subUnitId: r } = t, i = s.get(v).getFilterModel(e, r);
|
|
372
372
|
return i ? (i.reCalc(), !0) : !1;
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
|
-
var
|
|
376
|
-
for (var n = t
|
|
377
|
-
(o = s[i]) && (n =
|
|
378
|
-
return
|
|
379
|
-
}, b = (s,
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
]),
|
|
386
|
-
let v = class extends
|
|
387
|
-
constructor(
|
|
375
|
+
var tt = (s, t, e, r) => {
|
|
376
|
+
for (var n = t, i = s.length - 1, o; i >= 0; i--)
|
|
377
|
+
(o = s[i]) && (n = o(n) || n);
|
|
378
|
+
return n;
|
|
379
|
+
}, b = (s, t) => (e, r) => t(e, r, s);
|
|
380
|
+
const rt = /* @__PURE__ */ new Set([
|
|
381
|
+
R.id,
|
|
382
|
+
w.id,
|
|
383
|
+
A.id,
|
|
384
|
+
ae.id
|
|
385
|
+
]), ce = "SHEET_FILTER_PLUGIN";
|
|
386
|
+
let v = class extends U {
|
|
387
|
+
constructor(t, e, r) {
|
|
388
388
|
super();
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
g(this, "_filterModels", /* @__PURE__ */ new Map());
|
|
390
|
+
g(this, "_loadedUnitId$", new x(null));
|
|
391
|
+
g(this, "loadedUnitId$", this._loadedUnitId$.asObservable());
|
|
392
|
+
g(this, "_errorMsg$", new x(null));
|
|
393
|
+
g(this, "errorMsg$", this._errorMsg$.asObservable());
|
|
394
|
+
g(this, "_activeFilterModel$", new x(null));
|
|
393
395
|
/** An observable value emitting the current Workbook's active Worksheet's filter model (if there is one). */
|
|
394
|
-
|
|
395
|
-
this._resourcesManagerService =
|
|
396
|
+
g(this, "activeFilterModel$", this._activeFilterModel$.asObservable());
|
|
397
|
+
this._resourcesManagerService = t, this._univerInstanceService = e, this._commandService = r, this._initModel(), this._initActiveFilterModel();
|
|
396
398
|
}
|
|
397
399
|
/** The current Workbook's active Worksheet's filter model (if there is one). */
|
|
398
400
|
get activeFilterModel() {
|
|
@@ -403,197 +405,200 @@ let v = class extends B {
|
|
|
403
405
|
* @param unitId
|
|
404
406
|
* @param subUnitId
|
|
405
407
|
*/
|
|
406
|
-
ensureFilterModel(
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
return
|
|
410
|
-
const n = this._univerInstanceService.getUniverSheetInstance(
|
|
408
|
+
ensureFilterModel(t, e) {
|
|
409
|
+
const r = this.getFilterModel(t, e);
|
|
410
|
+
if (r)
|
|
411
|
+
return r;
|
|
412
|
+
const n = this._univerInstanceService.getUniverSheetInstance(t);
|
|
411
413
|
if (!n)
|
|
412
|
-
throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing workbook ${
|
|
414
|
+
throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing workbook ${t}!`);
|
|
413
415
|
const i = n.getSheetBySheetId(e);
|
|
414
416
|
if (!i)
|
|
415
417
|
throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing worksheet ${e}!`);
|
|
416
|
-
const o = new
|
|
417
|
-
return this._cacheFilterModel(
|
|
418
|
+
const o = new P(t, e, i);
|
|
419
|
+
return this._cacheFilterModel(t, e, o), o;
|
|
420
|
+
}
|
|
421
|
+
getFilterModel(t, e) {
|
|
422
|
+
var r, n;
|
|
423
|
+
return (n = (r = this._filterModels.get(t)) == null ? void 0 : r.get(e)) != null ? n : null;
|
|
418
424
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
return
|
|
425
|
+
removeFilterModel(t, e) {
|
|
426
|
+
const r = this.getFilterModel(t, e);
|
|
427
|
+
return r ? (r.dispose(), this._filterModels.get(t).delete(e), !0) : !1;
|
|
422
428
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
return t ? (t.dispose(), this._filterModels.get(r).delete(e), !0) : !1;
|
|
429
|
+
setFilterErrorMsg(t) {
|
|
430
|
+
this._errorMsg$.next(t);
|
|
426
431
|
}
|
|
427
432
|
_updateActiveFilterModel() {
|
|
428
|
-
let
|
|
433
|
+
let t;
|
|
429
434
|
try {
|
|
430
|
-
if (
|
|
435
|
+
if (t = this._univerInstanceService.getCurrentUnitForType(V.UNIVER_SHEET), !t) {
|
|
431
436
|
this._activeFilterModel$.next(null);
|
|
432
437
|
return;
|
|
433
438
|
}
|
|
434
439
|
} catch {
|
|
435
440
|
return;
|
|
436
441
|
}
|
|
437
|
-
const e =
|
|
442
|
+
const e = t.getRawActiveSheet();
|
|
438
443
|
if (!e) {
|
|
439
444
|
this._activeFilterModel$.next(null);
|
|
440
445
|
return;
|
|
441
446
|
}
|
|
442
|
-
const
|
|
447
|
+
const r = e.getUnitId(), n = e.getSheetId(), i = this.getFilterModel(r, n);
|
|
443
448
|
this._activeFilterModel$.next(i);
|
|
444
449
|
}
|
|
445
450
|
_initActiveFilterModel() {
|
|
446
451
|
this.disposeWithMe(
|
|
447
|
-
|
|
452
|
+
pe(
|
|
448
453
|
// source1: executing filter related mutations
|
|
449
|
-
|
|
454
|
+
me(this._commandService.onCommandExecuted).pipe(Fe(([t]) => t.type === $.MUTATION && rt.has(t.id))),
|
|
450
455
|
// source2: activate sheet changes
|
|
451
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
456
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(V.UNIVER_SHEET).pipe(we((t) => {
|
|
452
457
|
var e;
|
|
453
|
-
return (e =
|
|
458
|
+
return (e = t == null ? void 0 : t.activeSheet$) != null ? e : Se(null);
|
|
454
459
|
}))
|
|
455
460
|
).subscribe(() => this._updateActiveFilterModel())
|
|
456
461
|
);
|
|
457
462
|
}
|
|
458
|
-
_serializeAutoFiltersForUnit(
|
|
459
|
-
const e = this._filterModels.get(
|
|
463
|
+
_serializeAutoFiltersForUnit(t) {
|
|
464
|
+
const e = this._filterModels.get(t);
|
|
460
465
|
if (!e)
|
|
461
466
|
return "{}";
|
|
462
|
-
const
|
|
467
|
+
const r = {};
|
|
463
468
|
return e.forEach((n, i) => {
|
|
464
|
-
|
|
465
|
-
}), JSON.stringify(
|
|
469
|
+
r[i] = n.serialize();
|
|
470
|
+
}), JSON.stringify(r);
|
|
466
471
|
}
|
|
467
|
-
_deserializeAutoFiltersForUnit(
|
|
468
|
-
const
|
|
472
|
+
_deserializeAutoFiltersForUnit(t, e) {
|
|
473
|
+
const r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
469
474
|
Object.keys(e).forEach((n) => {
|
|
470
|
-
const i = e[n], o =
|
|
471
|
-
this._cacheFilterModel(
|
|
475
|
+
const i = e[n], o = P.deserialize(t, n, r.getSheetBySheetId(n), i);
|
|
476
|
+
this._cacheFilterModel(t, n, o);
|
|
472
477
|
});
|
|
473
478
|
}
|
|
474
479
|
_initModel() {
|
|
475
480
|
this._resourcesManagerService.registerPluginResource({
|
|
476
|
-
pluginName:
|
|
481
|
+
pluginName: ce,
|
|
477
482
|
businesses: [2],
|
|
478
|
-
toJson: (
|
|
479
|
-
parseJson: (
|
|
480
|
-
onLoad: (
|
|
481
|
-
this._deserializeAutoFiltersForUnit(
|
|
483
|
+
toJson: (t) => this._serializeAutoFiltersForUnit(t),
|
|
484
|
+
parseJson: (t) => JSON.parse(t),
|
|
485
|
+
onLoad: (t, e) => {
|
|
486
|
+
this._deserializeAutoFiltersForUnit(t, e), this._loadedUnitId$.next(t), this._updateActiveFilterModel();
|
|
482
487
|
},
|
|
483
|
-
onUnLoad: (
|
|
484
|
-
const e = this._filterModels.get(
|
|
485
|
-
e && (e.forEach((
|
|
488
|
+
onUnLoad: (t) => {
|
|
489
|
+
const e = this._filterModels.get(t);
|
|
490
|
+
e && (e.forEach((r) => r.dispose()), this._filterModels.delete(t));
|
|
486
491
|
}
|
|
487
492
|
});
|
|
488
493
|
}
|
|
489
|
-
_cacheFilterModel(
|
|
490
|
-
this._filterModels.has(
|
|
494
|
+
_cacheFilterModel(t, e, r) {
|
|
495
|
+
this._filterModels.has(t) || this._filterModels.set(t, /* @__PURE__ */ new Map()), this._filterModels.get(t).set(e, r);
|
|
491
496
|
}
|
|
492
497
|
};
|
|
493
|
-
v =
|
|
494
|
-
|
|
495
|
-
b(0,
|
|
496
|
-
b(1,
|
|
497
|
-
b(2,
|
|
498
|
+
v = tt([
|
|
499
|
+
ee(te.Ready, v),
|
|
500
|
+
b(0, _e),
|
|
501
|
+
b(1, re),
|
|
502
|
+
b(2, se)
|
|
498
503
|
], v);
|
|
499
|
-
function
|
|
504
|
+
function st(s, t) {
|
|
500
505
|
for (let e = 0; e < s.length; e++) {
|
|
501
|
-
let
|
|
506
|
+
let r = e;
|
|
502
507
|
if (s[e])
|
|
503
508
|
for (let n = e + 1; n < s.length; n++)
|
|
504
|
-
s[
|
|
509
|
+
s[r] && s[n] && t(s[r], s[n]) && (s[r] = null, r = n);
|
|
505
510
|
}
|
|
506
511
|
return s.filter((e) => e !== null);
|
|
507
512
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
513
|
+
function E(s) {
|
|
514
|
+
return st(s, (t, e) => t.id === w.id && e.id === w.id && t.params.unitId === e.params.unitId && t.params.subUnitId === e.params.subUnitId && t.params.col === e.params.col);
|
|
510
515
|
}
|
|
511
|
-
var
|
|
512
|
-
for (var n = t
|
|
513
|
-
(o = s[i]) && (n =
|
|
514
|
-
return
|
|
515
|
-
},
|
|
516
|
-
let
|
|
517
|
-
constructor(s,
|
|
518
|
-
super(), this._commandService = s, this._sheetInterceptorService =
|
|
516
|
+
var nt = (s, t, e, r) => {
|
|
517
|
+
for (var n = t, i = s.length - 1, o; i >= 0; i--)
|
|
518
|
+
(o = s[i]) && (n = o(n) || n);
|
|
519
|
+
return n;
|
|
520
|
+
}, N = (s, t) => (e, r) => t(e, r, s);
|
|
521
|
+
let B = class extends U {
|
|
522
|
+
constructor(s, t, e, r, n) {
|
|
523
|
+
super(), this._commandService = s, this._sheetInterceptorService = t, this._sheetsFilterService = e, this._univerInstanceService = r, this._refRangeService = n, this._initCommands(), this._initRowFilteredInterceptor(), this._initInterceptors(), this._commandExecutedListener(), this._initErrorHandling();
|
|
519
524
|
}
|
|
520
525
|
_initCommands() {
|
|
521
526
|
[
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
527
|
+
w,
|
|
528
|
+
R,
|
|
529
|
+
ae,
|
|
530
|
+
A
|
|
526
531
|
].forEach((s) => this.disposeWithMe(this._commandService.registerCommand(s)));
|
|
527
532
|
}
|
|
528
533
|
_initInterceptors() {
|
|
529
534
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
530
535
|
getMutations: (e) => this._getUpdateFilter(e)
|
|
531
536
|
}));
|
|
532
|
-
const s = new
|
|
537
|
+
const s = new ge(), t = (e, r) => {
|
|
533
538
|
var a;
|
|
534
539
|
const n = this._univerInstanceService.getUniverSheetInstance(e);
|
|
535
|
-
if (!n || !(n == null ? void 0 : n.getSheetBySheetId(
|
|
540
|
+
if (!n || !(n == null ? void 0 : n.getSheetBySheetId(r)))
|
|
536
541
|
return;
|
|
537
542
|
s.dispose();
|
|
538
|
-
const o = (a = this._sheetsFilterService.getFilterModel(e,
|
|
543
|
+
const o = (a = this._sheetsFilterService.getFilterModel(e, r)) == null ? void 0 : a.getRange(), l = (u) => {
|
|
539
544
|
switch (u.id) {
|
|
540
545
|
case Pe.id: {
|
|
541
|
-
const c = u.params, h = c.unitId || e,
|
|
542
|
-
return this._handleInsertRowCommand(c, h,
|
|
546
|
+
const c = u.params, h = c.unitId || e, _ = c.subUnitId || r;
|
|
547
|
+
return this._handleInsertRowCommand(c, h, _);
|
|
543
548
|
}
|
|
544
|
-
case
|
|
545
|
-
const c = u.params, h = c.unitId || e,
|
|
546
|
-
return this._handleInsertColCommand(c, h,
|
|
549
|
+
case Be.id: {
|
|
550
|
+
const c = u.params, h = c.unitId || e, _ = c.subUnitId || r;
|
|
551
|
+
return this._handleInsertColCommand(c, h, _);
|
|
547
552
|
}
|
|
548
|
-
case
|
|
553
|
+
case Le.id: {
|
|
549
554
|
const c = u.params;
|
|
550
|
-
return this._handleRemoveColCommand(c, e,
|
|
555
|
+
return this._handleRemoveColCommand(c, e, r);
|
|
551
556
|
}
|
|
552
|
-
case
|
|
557
|
+
case Ie.id: {
|
|
553
558
|
const c = u.params;
|
|
554
|
-
return this._handleRemoveRowCommand(c, e,
|
|
559
|
+
return this._handleRemoveRowCommand(c, e, r);
|
|
555
560
|
}
|
|
556
|
-
case
|
|
561
|
+
case G.MoveColsCommandId: {
|
|
557
562
|
const c = u.params;
|
|
558
|
-
return this._handleMoveColsCommand(c, e,
|
|
563
|
+
return this._handleMoveColsCommand(c, e, r);
|
|
559
564
|
}
|
|
560
|
-
case
|
|
565
|
+
case G.MoveRowsCommandId: {
|
|
561
566
|
const c = u.params;
|
|
562
|
-
return this._handleMoveRowsCommand(c, e,
|
|
567
|
+
return this._handleMoveRowsCommand(c, e, r);
|
|
563
568
|
}
|
|
564
|
-
case
|
|
569
|
+
case $e.id: {
|
|
565
570
|
const c = u.params;
|
|
566
|
-
return this._handleMoveRangeCommand(c, e,
|
|
571
|
+
return this._handleMoveRangeCommand(c, e, r);
|
|
567
572
|
}
|
|
568
573
|
}
|
|
569
574
|
return { redos: [], undos: [] };
|
|
570
575
|
};
|
|
571
|
-
o && s.add(this._refRangeService.registerRefRange(o, l, e,
|
|
576
|
+
o && s.add(this._refRangeService.registerRefRange(o, l, e, r));
|
|
572
577
|
};
|
|
573
578
|
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
574
|
-
if (e.id ===
|
|
575
|
-
const
|
|
579
|
+
if (e.id === Ee.id) {
|
|
580
|
+
const r = e.params, n = r.subUnitId, i = r.unitId;
|
|
576
581
|
if (!n || !i)
|
|
577
582
|
return;
|
|
578
|
-
|
|
583
|
+
t(i, n);
|
|
579
584
|
}
|
|
580
|
-
if (e.id ===
|
|
581
|
-
const
|
|
585
|
+
if (e.id === R.id) {
|
|
586
|
+
const r = e.params, n = r.subUnitId, i = r.unitId;
|
|
582
587
|
if (!n || !i)
|
|
583
588
|
return;
|
|
584
|
-
r
|
|
589
|
+
t(r.unitId, r.subUnitId);
|
|
585
590
|
}
|
|
586
591
|
})), this.disposeWithMe(this._sheetsFilterService.loadedUnitId$.subscribe((e) => {
|
|
587
592
|
if (e) {
|
|
588
|
-
const
|
|
589
|
-
n &&
|
|
593
|
+
const r = this._univerInstanceService.getUniverSheetInstance(e), n = r == null ? void 0 : r.getActiveSheet();
|
|
594
|
+
n && t(e, n.getSheetId());
|
|
590
595
|
}
|
|
591
596
|
}));
|
|
592
597
|
}
|
|
593
598
|
_getUpdateFilter(s) {
|
|
594
|
-
const { id:
|
|
595
|
-
switch (
|
|
596
|
-
case
|
|
599
|
+
const { id: t } = s;
|
|
600
|
+
switch (t) {
|
|
601
|
+
case Oe.id: {
|
|
597
602
|
const e = s.params;
|
|
598
603
|
return this._handleRemoveSheetCommand(e, e.unitId, e.subUnitId);
|
|
599
604
|
}
|
|
@@ -603,45 +608,45 @@ let P = class extends B {
|
|
|
603
608
|
undos: []
|
|
604
609
|
};
|
|
605
610
|
}
|
|
606
|
-
_handleInsertColCommand(s,
|
|
607
|
-
var
|
|
608
|
-
const
|
|
609
|
-
if (!
|
|
611
|
+
_handleInsertColCommand(s, t, e) {
|
|
612
|
+
var m;
|
|
613
|
+
const r = this._sheetsFilterService.getFilterModel(t, e), n = (m = r == null ? void 0 : r.getRange()) != null ? m : null;
|
|
614
|
+
if (!r || !n)
|
|
610
615
|
return this._handleNull();
|
|
611
616
|
const { startColumn: i, endColumn: o } = n, { startColumn: l, endColumn: a } = s.range, u = a - l + 1;
|
|
612
617
|
if (a > o)
|
|
613
618
|
return this._handleNull();
|
|
614
|
-
const c = [], h = [],
|
|
615
|
-
unitId:
|
|
619
|
+
const c = [], h = [], _ = l, p = {
|
|
620
|
+
unitId: t,
|
|
616
621
|
subUnitId: e,
|
|
617
622
|
range: {
|
|
618
623
|
...n,
|
|
619
624
|
startColumn: l <= i ? i + u : i,
|
|
620
625
|
endColumn: o + u
|
|
621
626
|
}
|
|
622
|
-
},
|
|
623
|
-
unitId:
|
|
627
|
+
}, C = {
|
|
628
|
+
unitId: t,
|
|
624
629
|
subUnitId: e,
|
|
625
630
|
range: n
|
|
626
631
|
};
|
|
627
|
-
c.push({ id:
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
const { undos:
|
|
631
|
-
c.push(...S), h.push(...
|
|
632
|
+
c.push({ id: R.id, params: p }), h.push({ id: R.id, params: C });
|
|
633
|
+
const f = r.getAllFilterColumns().filter((d) => d[0] >= _);
|
|
634
|
+
if (f.length !== 0) {
|
|
635
|
+
const { undos: d, redos: S } = this.moveCriteria(t, e, f, u);
|
|
636
|
+
c.push(...S), h.push(...d);
|
|
632
637
|
}
|
|
633
|
-
return { redos:
|
|
638
|
+
return { redos: E(c), undos: E(h) };
|
|
634
639
|
}
|
|
635
|
-
_handleInsertRowCommand(s,
|
|
636
|
-
var
|
|
637
|
-
const
|
|
638
|
-
if (!
|
|
640
|
+
_handleInsertRowCommand(s, t, e) {
|
|
641
|
+
var C;
|
|
642
|
+
const r = this._sheetsFilterService.getFilterModel(t, e), n = (C = r == null ? void 0 : r.getRange()) != null ? C : null;
|
|
643
|
+
if (!r || !n)
|
|
639
644
|
return this._handleNull();
|
|
640
645
|
const { startRow: i, endRow: o } = n, { startRow: l, endRow: a } = s.range, u = a - l + 1;
|
|
641
646
|
if (a > o)
|
|
642
647
|
return this._handleNull();
|
|
643
|
-
const c = [], h = [],
|
|
644
|
-
unitId:
|
|
648
|
+
const c = [], h = [], _ = {
|
|
649
|
+
unitId: t,
|
|
645
650
|
subUnitId: e,
|
|
646
651
|
range: {
|
|
647
652
|
...n,
|
|
@@ -649,55 +654,55 @@ let P = class extends B {
|
|
|
649
654
|
endRow: o + u
|
|
650
655
|
}
|
|
651
656
|
}, p = {
|
|
652
|
-
unitId:
|
|
657
|
+
unitId: t,
|
|
653
658
|
subUnitId: e,
|
|
654
659
|
range: n
|
|
655
660
|
};
|
|
656
|
-
return c.push({ id:
|
|
657
|
-
redos:
|
|
658
|
-
undos:
|
|
661
|
+
return c.push({ id: R.id, params: _ }), h.push({ id: R.id, params: p }), {
|
|
662
|
+
redos: E(c),
|
|
663
|
+
undos: E(h)
|
|
659
664
|
};
|
|
660
665
|
}
|
|
661
|
-
_handleRemoveColCommand(s,
|
|
662
|
-
var
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
666
|
+
_handleRemoveColCommand(s, t, e) {
|
|
667
|
+
var F;
|
|
668
|
+
const r = this._sheetsFilterService.getFilterModel(t, e), n = (F = r == null ? void 0 : r.getRange()) != null ? F : null;
|
|
669
|
+
if (!r || !n)
|
|
665
670
|
return this._handleNull();
|
|
666
671
|
const { startColumn: i, endColumn: o } = n, { startColumn: l, endColumn: a } = s.range;
|
|
667
672
|
if (l > o)
|
|
668
673
|
return this._handleNull();
|
|
669
|
-
const u = [], c = [], h = a < i ? 0 : Math.min(a, o) - Math.max(l, i) + 1,
|
|
670
|
-
p.forEach((
|
|
671
|
-
const [
|
|
672
|
-
|
|
674
|
+
const u = [], c = [], h = a < i ? 0 : Math.min(a, o) - Math.max(l, i) + 1, _ = a - l + 1, p = r.getAllFilterColumns();
|
|
675
|
+
p.forEach((f) => {
|
|
676
|
+
const [m, d] = f;
|
|
677
|
+
m <= a && m >= l && (u.push({ id: w.id, params: { unitId: t, subUnitId: e, col: m, criteria: null } }), c.push({ id: w.id, params: { unitId: t, subUnitId: e, col: m, criteria: { ...d.serialize(), colId: m } } }));
|
|
673
678
|
});
|
|
674
|
-
const
|
|
675
|
-
const [
|
|
676
|
-
return
|
|
679
|
+
const C = p.filter((f) => {
|
|
680
|
+
const [m, d] = f;
|
|
681
|
+
return m > a;
|
|
677
682
|
});
|
|
678
|
-
if (
|
|
679
|
-
const { undos:
|
|
680
|
-
u.push(...
|
|
683
|
+
if (C.length > 0) {
|
|
684
|
+
const { undos: f, redos: m } = this.moveCriteria(t, e, C, -_);
|
|
685
|
+
u.push(...m), c.push(...f);
|
|
681
686
|
}
|
|
682
687
|
if (h === o - i + 1) {
|
|
683
|
-
const
|
|
684
|
-
unitId:
|
|
688
|
+
const f = {
|
|
689
|
+
unitId: t,
|
|
685
690
|
subUnitId: e
|
|
686
691
|
};
|
|
687
|
-
u.push({ id:
|
|
692
|
+
u.push({ id: A.id, params: f });
|
|
688
693
|
} else if (i <= l) {
|
|
689
|
-
const
|
|
690
|
-
unitId:
|
|
694
|
+
const f = o - h, m = {
|
|
695
|
+
unitId: t,
|
|
691
696
|
subUnitId: e,
|
|
692
697
|
range: {
|
|
693
698
|
...n,
|
|
694
|
-
endColumn:
|
|
699
|
+
endColumn: f
|
|
695
700
|
}
|
|
696
701
|
};
|
|
697
|
-
u.push({ id:
|
|
702
|
+
u.push({ id: R.id, params: m });
|
|
698
703
|
} else {
|
|
699
|
-
const
|
|
700
|
-
unitId:
|
|
704
|
+
const f = {
|
|
705
|
+
unitId: t,
|
|
701
706
|
subUnitId: e,
|
|
702
707
|
range: {
|
|
703
708
|
...n,
|
|
@@ -705,65 +710,66 @@ let P = class extends B {
|
|
|
705
710
|
endColumn: o - (a - l + 1)
|
|
706
711
|
}
|
|
707
712
|
};
|
|
708
|
-
u.push({ id:
|
|
713
|
+
u.push({ id: R.id, params: f });
|
|
709
714
|
}
|
|
710
|
-
return c.push({ id:
|
|
711
|
-
undos:
|
|
712
|
-
redos:
|
|
715
|
+
return c.push({ id: R.id, params: { range: n, unitId: t, subUnitId: e } }), {
|
|
716
|
+
undos: E(c),
|
|
717
|
+
redos: E(u)
|
|
713
718
|
};
|
|
714
719
|
}
|
|
715
|
-
_handleRemoveRowCommand(s,
|
|
716
|
-
var
|
|
717
|
-
const
|
|
718
|
-
if (!
|
|
720
|
+
_handleRemoveRowCommand(s, t, e) {
|
|
721
|
+
var C;
|
|
722
|
+
const r = this._sheetsFilterService.getFilterModel(t, e);
|
|
723
|
+
if (!r)
|
|
719
724
|
return this._handleNull();
|
|
720
|
-
const n =
|
|
725
|
+
const n = r.getRange(), { startRow: i, endRow: o } = n, { startRow: l, endRow: a } = s.range;
|
|
721
726
|
if (l > o)
|
|
722
727
|
return this._handleNull();
|
|
723
|
-
const u = [], c = [], h =
|
|
724
|
-
c.push({ id:
|
|
728
|
+
const u = [], c = [], h = r.getAllFilterColumns(), _ = i <= a && i >= l;
|
|
729
|
+
c.push({ id: R.id, params: { range: n, unitId: t, subUnitId: e } });
|
|
725
730
|
const p = Math.min(a, o) - Math.max(l, i) + 1;
|
|
726
|
-
if (p === o - i + 1 ||
|
|
727
|
-
const
|
|
728
|
-
unitId:
|
|
731
|
+
if (p === o - i + 1 || _) {
|
|
732
|
+
const F = {
|
|
733
|
+
unitId: t,
|
|
729
734
|
subUnitId: e
|
|
730
735
|
};
|
|
731
|
-
u.push({ id:
|
|
732
|
-
const [
|
|
733
|
-
unitId:
|
|
736
|
+
u.push({ id: A.id, params: F }), h.forEach((f) => {
|
|
737
|
+
const [m, d] = f, S = {
|
|
738
|
+
unitId: t,
|
|
734
739
|
subUnitId: e,
|
|
735
|
-
col:
|
|
736
|
-
criteria: { ...
|
|
740
|
+
col: m,
|
|
741
|
+
criteria: { ...d.serialize(), colId: m }
|
|
737
742
|
};
|
|
738
|
-
c.push({ id:
|
|
743
|
+
c.push({ id: w.id, params: S });
|
|
739
744
|
});
|
|
740
745
|
} else {
|
|
741
|
-
const
|
|
742
|
-
if (!
|
|
746
|
+
const F = (C = this._univerInstanceService.getUniverSheetInstance(t)) == null ? void 0 : C.getSheetBySheetId(e);
|
|
747
|
+
if (!F)
|
|
743
748
|
return this._handleNull();
|
|
744
|
-
const
|
|
745
|
-
for (let
|
|
746
|
-
|
|
747
|
-
const
|
|
748
|
-
unitId:
|
|
749
|
+
const f = [];
|
|
750
|
+
for (let M = l; M <= a; M++)
|
|
751
|
+
F.getRowFiltered(M) && f.push(M);
|
|
752
|
+
const m = Math.min(i, l), d = m + (o - i) - p + f.length, S = {
|
|
753
|
+
unitId: t,
|
|
749
754
|
subUnitId: e,
|
|
750
755
|
range: {
|
|
751
756
|
...n,
|
|
752
|
-
startRow:
|
|
753
|
-
endRow:
|
|
757
|
+
startRow: m,
|
|
758
|
+
endRow: d
|
|
754
759
|
}
|
|
755
760
|
};
|
|
756
|
-
u.push({ id:
|
|
761
|
+
u.push({ id: R.id, params: S });
|
|
757
762
|
}
|
|
758
763
|
return {
|
|
759
|
-
undos:
|
|
760
|
-
redos:
|
|
764
|
+
undos: E(c),
|
|
765
|
+
redos: E(u)
|
|
761
766
|
};
|
|
762
767
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
768
|
+
// eslint-disable-next-line max-lines-per-function
|
|
769
|
+
_handleMoveColsCommand(s, t, e) {
|
|
770
|
+
var m;
|
|
771
|
+
const r = this._sheetsFilterService.getFilterModel(t, e), n = (m = r == null ? void 0 : r.getRange()) != null ? m : null;
|
|
772
|
+
if (!r || !n)
|
|
767
773
|
return this._handleNull();
|
|
768
774
|
const { startColumn: i, endColumn: o } = n, { fromRange: l, toRange: a } = s;
|
|
769
775
|
if (l.endColumn < i && a.startColumn <= i || l.startColumn > o && a.endColumn > o)
|
|
@@ -772,51 +778,56 @@ let P = class extends B {
|
|
|
772
778
|
for (let d = i; d <= o; d++)
|
|
773
779
|
h[d] = {
|
|
774
780
|
colIndex: d,
|
|
775
|
-
filter:
|
|
781
|
+
filter: r.getFilterColumn(d)
|
|
776
782
|
};
|
|
777
783
|
D(l.startColumn, l.endColumn - l.startColumn + 1, a.startColumn, h);
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
784
|
+
let _ = n.startColumn, p = n.endColumn;
|
|
785
|
+
i >= l.startColumn && i <= l.endColumn && a.startColumn > l.startColumn && l.endColumn < o && (_ = l.endColumn + 1), o >= l.startColumn && o <= l.endColumn && a.startColumn < l.startColumn && l.startColumn > i && (p = l.startColumn - 1);
|
|
786
|
+
const C = Object.keys(h).map((d) => Number(d)), F = C.find((d) => h[d].colIndex === p), f = C.find((d) => h[d].colIndex === _);
|
|
787
|
+
if (C.forEach((d) => {
|
|
788
|
+
var j, Q;
|
|
789
|
+
const { colIndex: S, filter: M } = h[d], y = d;
|
|
790
|
+
if (M) {
|
|
791
|
+
if (y >= f && y <= F) {
|
|
792
|
+
const z = {
|
|
793
|
+
unitId: t,
|
|
794
|
+
subUnitId: e,
|
|
795
|
+
col: y,
|
|
796
|
+
criteria: { ...M.serialize(), colId: y }
|
|
797
|
+
};
|
|
798
|
+
u.push({ id: w.id, params: z }), c.push({ id: A.id, params: { unitId: t, subUnitId: e, col: y, criteria: { ...(j = r.getFilterColumn(y)) == null ? void 0 : j.serialize(), colId: y } } });
|
|
799
|
+
}
|
|
800
|
+
if (!((Q = h[S]) != null && Q.filter)) {
|
|
801
|
+
const z = {
|
|
802
|
+
unitId: t,
|
|
792
803
|
subUnitId: e,
|
|
793
|
-
col:
|
|
804
|
+
col: S,
|
|
794
805
|
criteria: null
|
|
795
806
|
};
|
|
796
|
-
u.push({ id:
|
|
807
|
+
u.push({ id: w.id, params: z }), c.push({ id: w.id, params: { unitId: t, subUnitId: e, col: S, criteria: { ...M.serialize(), colId: S } } });
|
|
797
808
|
}
|
|
798
809
|
}
|
|
799
|
-
}), i !==
|
|
810
|
+
}), i !== f || o !== F) {
|
|
800
811
|
const d = {
|
|
801
|
-
unitId:
|
|
812
|
+
unitId: t,
|
|
802
813
|
subUnitId: e,
|
|
803
814
|
range: {
|
|
804
815
|
...n,
|
|
805
|
-
startColumn:
|
|
806
|
-
endColumn:
|
|
816
|
+
startColumn: f,
|
|
817
|
+
endColumn: F
|
|
807
818
|
}
|
|
808
819
|
};
|
|
809
|
-
u.unshift({ id:
|
|
820
|
+
u.unshift({ id: R.id, params: d }), c.push({ id: R.id, params: { range: n, unitId: t, subUnitId: e } });
|
|
810
821
|
}
|
|
811
822
|
return {
|
|
812
823
|
undos: c,
|
|
813
824
|
redos: u
|
|
814
825
|
};
|
|
815
826
|
}
|
|
816
|
-
_handleMoveRowsCommand(s,
|
|
817
|
-
var
|
|
818
|
-
const
|
|
819
|
-
if (!
|
|
827
|
+
_handleMoveRowsCommand(s, t, e) {
|
|
828
|
+
var m;
|
|
829
|
+
const r = this._sheetsFilterService.getFilterModel(t, e), n = (m = r == null ? void 0 : r.getRange()) != null ? m : null;
|
|
830
|
+
if (!r || !n)
|
|
820
831
|
return this._handleNull();
|
|
821
832
|
const { startRow: i, endRow: o } = n, { fromRange: l, toRange: a } = s;
|
|
822
833
|
if (l.endRow < i && a.startRow <= i || l.startRow > o && a.endRow > o)
|
|
@@ -824,53 +835,55 @@ let P = class extends B {
|
|
|
824
835
|
const u = [], c = [], h = {};
|
|
825
836
|
for (let d = i; d <= o; d++)
|
|
826
837
|
h[d] = {
|
|
827
|
-
|
|
838
|
+
oldIndex: d
|
|
828
839
|
};
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
840
|
+
const _ = i;
|
|
841
|
+
let p = o;
|
|
842
|
+
o >= l.startRow && o <= l.endRow && a.startRow < l.startRow && l.startRow > i && (p = l.startRow - 1), D(l.startRow, l.endRow - l.startRow + 1, a.startRow, h);
|
|
843
|
+
const C = Object.keys(h).map((d) => Number(d)), F = C.find((d) => h[d].oldIndex === p), f = C.find((d) => h[d].oldIndex === _);
|
|
844
|
+
if (i !== f || o !== F) {
|
|
832
845
|
const d = {
|
|
833
|
-
unitId:
|
|
846
|
+
unitId: t,
|
|
834
847
|
subUnitId: e,
|
|
835
848
|
range: {
|
|
836
849
|
...n,
|
|
837
|
-
startRow:
|
|
838
|
-
endRow:
|
|
850
|
+
startRow: f,
|
|
851
|
+
endRow: F
|
|
839
852
|
}
|
|
840
853
|
};
|
|
841
|
-
u.unshift({ id:
|
|
854
|
+
u.unshift({ id: R.id, params: d }), c.push({ id: R.id, params: { range: n, unitId: t, subUnitId: e } });
|
|
842
855
|
}
|
|
843
856
|
return {
|
|
844
857
|
redos: u,
|
|
845
858
|
undos: c
|
|
846
859
|
};
|
|
847
860
|
}
|
|
848
|
-
_handleMoveRangeCommand(s,
|
|
849
|
-
const { fromRange:
|
|
861
|
+
_handleMoveRangeCommand(s, t, e) {
|
|
862
|
+
const { fromRange: r, toRange: n } = s, i = this._sheetsFilterService.getFilterModel(t, e);
|
|
850
863
|
if (!i)
|
|
851
864
|
return this._handleNull();
|
|
852
865
|
const o = i.getRange();
|
|
853
866
|
if (!o)
|
|
854
867
|
return this._handleNull();
|
|
855
868
|
const l = [], a = [];
|
|
856
|
-
if (
|
|
857
|
-
const u = o.startRow -
|
|
869
|
+
if (Z.contains(r, o)) {
|
|
870
|
+
const u = o.startRow - r.startRow, c = o.startColumn - r.startColumn, h = {
|
|
858
871
|
startRow: n.startRow + u,
|
|
859
872
|
startColumn: n.startColumn + c,
|
|
860
873
|
endRow: n.startRow + u + (o.endRow - o.startRow),
|
|
861
874
|
endColumn: n.startColumn + c + (o.endColumn - o.startColumn)
|
|
862
|
-
},
|
|
863
|
-
id:
|
|
875
|
+
}, _ = {
|
|
876
|
+
id: A.id,
|
|
864
877
|
params: {
|
|
865
|
-
unitId:
|
|
878
|
+
unitId: t,
|
|
866
879
|
subUnitId: e
|
|
867
880
|
}
|
|
868
|
-
}, p = { id:
|
|
869
|
-
l.push(
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
const [
|
|
873
|
-
S && (l.push({ id:
|
|
881
|
+
}, p = { id: R.id, params: { unitId: t, subUnitId: e, range: h } }, C = { id: R.id, params: { unitId: t, subUnitId: e, range: o } };
|
|
882
|
+
l.push(_, p), a.push(_, C);
|
|
883
|
+
const F = i.getAllFilterColumns(), f = n.startColumn - r.startColumn;
|
|
884
|
+
F.forEach((m) => {
|
|
885
|
+
const [d, S] = m;
|
|
886
|
+
S && (l.push({ id: w.id, params: { unitId: t, subUnitId: e, col: d + f, criteria: { ...S.serialize(), colId: d + f } } }), a.push({ id: w.id, params: { unitId: t, subUnitId: e, col: d, criteria: { ...S.serialize(), colId: d } } }));
|
|
874
887
|
});
|
|
875
888
|
}
|
|
876
889
|
return {
|
|
@@ -878,18 +891,18 @@ let P = class extends B {
|
|
|
878
891
|
undos: a
|
|
879
892
|
};
|
|
880
893
|
}
|
|
881
|
-
_handleRemoveSheetCommand(s,
|
|
882
|
-
const
|
|
883
|
-
if (!
|
|
894
|
+
_handleRemoveSheetCommand(s, t, e) {
|
|
895
|
+
const r = this._sheetsFilterService.getFilterModel(t, e);
|
|
896
|
+
if (!r)
|
|
884
897
|
return this._handleNull();
|
|
885
|
-
const n =
|
|
898
|
+
const n = r.getRange();
|
|
886
899
|
if (!n)
|
|
887
900
|
return this._handleNull();
|
|
888
901
|
const i = [], o = [];
|
|
889
|
-
return
|
|
902
|
+
return r.getAllFilterColumns().forEach((a) => {
|
|
890
903
|
const [u, c] = a;
|
|
891
|
-
o.push({ id:
|
|
892
|
-
}), i.push({ id:
|
|
904
|
+
o.push({ id: w.id, params: { unitId: t, subUnitId: e, col: a, criteria: { ...c.serialize(), colId: a } } });
|
|
905
|
+
}), i.push({ id: A.id, params: { unitId: t, subUnitId: e, range: n } }), o.unshift({ id: R.id, params: { range: n, unitId: t, subUnitId: e } }), {
|
|
893
906
|
undos: o,
|
|
894
907
|
redos: i
|
|
895
908
|
};
|
|
@@ -898,33 +911,33 @@ let P = class extends B {
|
|
|
898
911
|
return { redos: [], undos: [] };
|
|
899
912
|
}
|
|
900
913
|
_initRowFilteredInterceptor() {
|
|
901
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
902
|
-
handler: (s,
|
|
903
|
-
var e,
|
|
904
|
-
return s ? !0 : (
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
)) == null ? void 0 : e.isRowFiltered(
|
|
914
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(ye.ROW_FILTERED, {
|
|
915
|
+
handler: (s, t) => {
|
|
916
|
+
var e, r;
|
|
917
|
+
return s ? !0 : (r = (e = this._sheetsFilterService.getFilterModel(
|
|
918
|
+
t.unitId,
|
|
919
|
+
t.subUnitId
|
|
920
|
+
)) == null ? void 0 : e.isRowFiltered(t.row)) != null ? r : !1;
|
|
908
921
|
}
|
|
909
922
|
}));
|
|
910
923
|
}
|
|
911
|
-
moveCriteria(s,
|
|
924
|
+
moveCriteria(s, t, e, r) {
|
|
912
925
|
const n = {
|
|
913
926
|
unitId: s,
|
|
914
|
-
subUnitId:
|
|
927
|
+
subUnitId: t,
|
|
915
928
|
criteria: null,
|
|
916
929
|
col: -1
|
|
917
930
|
}, i = [], o = [];
|
|
918
931
|
return e.forEach((l) => {
|
|
919
932
|
const [a, u] = l;
|
|
920
933
|
o.push({
|
|
921
|
-
id:
|
|
934
|
+
id: w.id,
|
|
922
935
|
params: {
|
|
923
936
|
...n,
|
|
924
937
|
col: a
|
|
925
938
|
}
|
|
926
939
|
}), i.push({
|
|
927
|
-
id:
|
|
940
|
+
id: w.id,
|
|
928
941
|
params: {
|
|
929
942
|
...n,
|
|
930
943
|
col: a,
|
|
@@ -934,17 +947,17 @@ let P = class extends B {
|
|
|
934
947
|
}), e.forEach((l) => {
|
|
935
948
|
const [a, u] = l;
|
|
936
949
|
o.push({
|
|
937
|
-
id:
|
|
950
|
+
id: w.id,
|
|
938
951
|
params: {
|
|
939
952
|
...n,
|
|
940
|
-
col: a +
|
|
941
|
-
criteria: { ...u.serialize(), colId: a +
|
|
953
|
+
col: a + r,
|
|
954
|
+
criteria: { ...u.serialize(), colId: a + r }
|
|
942
955
|
}
|
|
943
956
|
}), i.push({
|
|
944
|
-
id:
|
|
957
|
+
id: w.id,
|
|
945
958
|
params: {
|
|
946
959
|
...n,
|
|
947
|
-
col: a +
|
|
960
|
+
col: a + r,
|
|
948
961
|
criteria: null
|
|
949
962
|
}
|
|
950
963
|
});
|
|
@@ -955,12 +968,12 @@ let P = class extends B {
|
|
|
955
968
|
}
|
|
956
969
|
_commandExecutedListener() {
|
|
957
970
|
this.disposeWithMe(this._commandService.onCommandExecuted((s) => {
|
|
958
|
-
const { unitId:
|
|
959
|
-
if (!
|
|
971
|
+
const { unitId: t, subUnitId: e } = s.params || {}, r = this._sheetsFilterService.getFilterModel(t, e);
|
|
972
|
+
if (!r)
|
|
960
973
|
return;
|
|
961
|
-
const n = Array.from(
|
|
974
|
+
const n = Array.from(r.filteredOutRows).sort((l, a) => l - a), i = [];
|
|
962
975
|
let o = !1;
|
|
963
|
-
if (s.id ===
|
|
976
|
+
if (s.id === Ae.id) {
|
|
964
977
|
const { startRow: l, endRow: a } = s.params.range, u = n.filter((c) => c >= l && c <= a);
|
|
965
978
|
n.forEach((c) => {
|
|
966
979
|
if (c < l)
|
|
@@ -972,60 +985,73 @@ let P = class extends B {
|
|
|
972
985
|
i.push(c - (a - l + 1 - u.length));
|
|
973
986
|
});
|
|
974
987
|
}
|
|
975
|
-
if (s.id ===
|
|
988
|
+
if (s.id === Te.id) {
|
|
976
989
|
const { startRow: l, endRow: a } = s.params.range;
|
|
977
990
|
n.forEach((u) => {
|
|
978
991
|
u >= l ? (o = !0, i.push(u + (a - l + 1))) : i.push(u);
|
|
979
992
|
});
|
|
980
993
|
}
|
|
981
|
-
o && (
|
|
994
|
+
o && (r.filteredOutRows = new Set(i));
|
|
995
|
+
}));
|
|
996
|
+
}
|
|
997
|
+
_initErrorHandling() {
|
|
998
|
+
this.disposeWithMe(this._commandService.beforeCommandExecuted((s) => {
|
|
999
|
+
const t = s.params, e = Ne(this._univerInstanceService);
|
|
1000
|
+
if (!e)
|
|
1001
|
+
return;
|
|
1002
|
+
const { subUnitId: r, unitId: n } = e, i = this._sheetsFilterService.getFilterModel(n, r);
|
|
1003
|
+
if (!i)
|
|
1004
|
+
return;
|
|
1005
|
+
const o = i.getRange();
|
|
1006
|
+
if (s.id === xe.id && t.fromRange.startRow <= o.startRow && t.fromRange.endRow >= o.startRow)
|
|
1007
|
+
throw this._sheetsFilterService.setFilterErrorMsg("sheets-filter.msg.filter-header-forbidden"), new Error("[SheetsFilterController]: Cannot move header row of filter");
|
|
982
1008
|
}));
|
|
983
1009
|
}
|
|
984
1010
|
};
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
],
|
|
993
|
-
var
|
|
994
|
-
for (var n = t
|
|
995
|
-
(o = s[i]) && (n =
|
|
996
|
-
return
|
|
997
|
-
},
|
|
998
|
-
let
|
|
999
|
-
constructor(s,
|
|
1000
|
-
super(), this._injector =
|
|
1011
|
+
B = nt([
|
|
1012
|
+
ee(te.Ready, B),
|
|
1013
|
+
N(0, se),
|
|
1014
|
+
N(1, L(ve)),
|
|
1015
|
+
N(2, L(v)),
|
|
1016
|
+
N(3, re),
|
|
1017
|
+
N(4, L(Me))
|
|
1018
|
+
], B);
|
|
1019
|
+
var it = (s, t, e, r) => {
|
|
1020
|
+
for (var n = t, i = s.length - 1, o; i >= 0; i--)
|
|
1021
|
+
(o = s[i]) && (n = o(n) || n);
|
|
1022
|
+
return n;
|
|
1023
|
+
}, ot = (s, t) => (e, r) => t(e, r, s), I;
|
|
1024
|
+
let K = (I = class extends Ce {
|
|
1025
|
+
constructor(s, t) {
|
|
1026
|
+
super(), this._injector = t;
|
|
1001
1027
|
}
|
|
1002
1028
|
onStarting(s) {
|
|
1003
1029
|
[
|
|
1004
1030
|
[v],
|
|
1005
|
-
[
|
|
1006
|
-
].forEach((
|
|
1031
|
+
[B]
|
|
1032
|
+
].forEach((t) => s.add(t));
|
|
1007
1033
|
}
|
|
1008
|
-
},
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
],
|
|
1034
|
+
}, g(I, "type", V.UNIVER_SHEET), g(I, "pluginName", ce), I);
|
|
1035
|
+
K = it([
|
|
1036
|
+
ot(1, L(Re))
|
|
1037
|
+
], K);
|
|
1012
1038
|
export {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1039
|
+
O as CustomFilterOperator,
|
|
1040
|
+
rt as FILTER_MUTATIONS,
|
|
1041
|
+
qe as FilterColumn,
|
|
1042
|
+
P as FilterModel,
|
|
1043
|
+
ae as ReCalcSheetsFilterMutation,
|
|
1044
|
+
A as RemoveSheetsFilterMutation,
|
|
1045
|
+
ce as SHEET_FILTER_SNAPSHOT_ID,
|
|
1046
|
+
w as SetSheetsFilterCriteriaMutation,
|
|
1047
|
+
R as SetSheetsFilterRangeMutation,
|
|
1022
1048
|
v as SheetsFilterService,
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1049
|
+
K as UniverSheetsFilterPlugin,
|
|
1050
|
+
be as equals,
|
|
1051
|
+
J as getCustomFilterFn,
|
|
1052
|
+
Ue as greaterThan,
|
|
1053
|
+
ze as greaterThanOrEqualTo,
|
|
1054
|
+
He as lessThan,
|
|
1055
|
+
We as lessThanOrEqualTo,
|
|
1056
|
+
ne as notEquals
|
|
1031
1057
|
};
|