@univerjs/sheets-filter 0.9.1 → 0.9.2
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/index.js +1 -1
- package/lib/es/index.js +394 -365
- package/lib/index.js +394 -365
- package/lib/types/index.d.ts +2 -2
- package/lib/types/models/filter-model.d.ts +6 -4
- package/lib/types/models/types.d.ts +19 -0
- package/lib/umd/index.js +1 -1
- package/package.json +7 -6
package/lib/es/index.js
CHANGED
|
@@ -1,89 +1,90 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { isNumeric as
|
|
5
|
-
import { getSheetCommandTarget as
|
|
6
|
-
import { BehaviorSubject as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var Ee = Object.defineProperty;
|
|
2
|
+
var Oe = (i, r, e) => r in i ? Ee(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
|
+
var S = (i, r, e) => Oe(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
+
import { isNumeric as ye, Disposable as B, Rectangle as X, mergeSets as J, Tools as re, extractPureTextFromCell as Ae, CellValueType as Z, ColorKit as ne, UniverInstanceType as b, fromCallback as Te, CommandType as E, IResourceManagerService as Ne, IUniverInstanceService as T, ICommandService as N, IUndoRedoService as G, sequenceExecute as xe, ErrorService as Ie, LocaleService as $e, Inject as $, Optional as Ue, DisposableCollection as Le, moveMatrixArray as ie, Plugin as Pe, merge as be, touchDependencies as De, Injector as Be, IConfigService as He } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as H, SheetsSelectionsService as ze, isSingleCellSelection as Ve, expandToContinuousRange as he, SheetInterceptorService as We, RefRangeService as je, SetWorksheetActiveOperation as ke, CopySheetCommand as qe, RemoveSheetCommand as Ge, INTERCEPTOR_POINT as Qe, RemoveRowMutation as Je, InsertRowMutation as Ke, SetRangeValuesMutation as Ye, MoveRowsCommand as Xe, MoveRangeCommand as Ze, EffectRefRangId as se, RemoveRowCommand as et, RemoveColCommand as tt, InsertColCommand as rt, InsertRowCommand as nt } from "@univerjs/sheets";
|
|
6
|
+
import { BehaviorSubject as D, merge as it, filter as st, switchMap as ot, of as lt } from "rxjs";
|
|
7
|
+
import { COLOR_BLACK_RGB as at } from "@univerjs/engine-render";
|
|
8
|
+
import { DataSyncPrimaryController as ct } from "@univerjs/rpc";
|
|
9
|
+
import { IActiveDirtyManagerService as ut, ISheetRowFilteredService as dt } from "@univerjs/engine-formula";
|
|
10
|
+
const fe = "sheet.mutation.set-filter-range", me = "sheet.mutation.set-filter-criteria", ge = "sheet.mutation.remove-filter", _e = "sheet.mutation.re-calc-filter", Re = /* @__PURE__ */ new Set([
|
|
11
|
+
fe,
|
|
12
12
|
me,
|
|
13
|
-
|
|
13
|
+
ge,
|
|
14
|
+
_e
|
|
14
15
|
]);
|
|
15
|
-
var x = /* @__PURE__ */ ((i) => (i.EQUAL = "equal", i.GREATER_THAN = "greaterThan", i.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", i.LESS_THAN = "lessThan", i.LESS_THAN_OR_EQUAL = "lessThanOrEqual", i.NOT_EQUALS = "notEqual", i))(x || {});
|
|
16
|
-
const
|
|
16
|
+
var I = /* @__PURE__ */ ((i) => (i[i.VALUES = 0] = "VALUES", i[i.COLORS = 1] = "COLORS", i[i.CONDITIONS = 2] = "CONDITIONS", i))(I || {}), x = /* @__PURE__ */ ((i) => (i.EQUAL = "equal", i.GREATER_THAN = "greaterThan", i.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", i.LESS_THAN = "lessThan", i.LESS_THAN_OR_EQUAL = "lessThanOrEqual", i.NOT_EQUALS = "notEqual", i))(x || {});
|
|
17
|
+
const ht = {
|
|
17
18
|
operator: x.GREATER_THAN,
|
|
18
|
-
fn: (i, r) =>
|
|
19
|
-
},
|
|
19
|
+
fn: (i, r) => P(i) ? i > r : !1
|
|
20
|
+
}, ft = {
|
|
20
21
|
operator: x.GREATER_THAN_OR_EQUAL,
|
|
21
|
-
fn: (i, r) =>
|
|
22
|
-
},
|
|
22
|
+
fn: (i, r) => P(i) ? i >= r : !1
|
|
23
|
+
}, mt = {
|
|
23
24
|
operator: x.LESS_THAN,
|
|
24
|
-
fn: (i, r) =>
|
|
25
|
-
},
|
|
25
|
+
fn: (i, r) => P(i) ? i < r : !1
|
|
26
|
+
}, gt = {
|
|
26
27
|
operator: x.LESS_THAN_OR_EQUAL,
|
|
27
|
-
fn: (i, r) =>
|
|
28
|
-
},
|
|
28
|
+
fn: (i, r) => P(i) ? i <= r : !1
|
|
29
|
+
}, _t = {
|
|
29
30
|
operator: x.EQUAL,
|
|
30
|
-
fn: (i, r) =>
|
|
31
|
-
},
|
|
31
|
+
fn: (i, r) => P(i) ? i === r : !1
|
|
32
|
+
}, Ce = {
|
|
32
33
|
operator: x.NOT_EQUALS,
|
|
33
34
|
fn: (i, r) => {
|
|
34
35
|
if (typeof r == "string") {
|
|
35
36
|
if (r === " ")
|
|
36
37
|
return i != null;
|
|
37
|
-
const e =
|
|
38
|
-
return e &&
|
|
38
|
+
const e = Fe(i);
|
|
39
|
+
return e && Ft(r) ? !Se(r).test(e) : e !== r;
|
|
39
40
|
}
|
|
40
|
-
return
|
|
41
|
+
return P(i) ? i !== r : !0;
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
}, pe = /* @__PURE__ */ new Map([]), Rt = [ht, ft, mt, gt, _t, Ce];
|
|
44
|
+
Rt.forEach((i) => {
|
|
45
|
+
pe.set(i.operator, i);
|
|
45
46
|
});
|
|
46
|
-
function
|
|
47
|
+
function Ct(i) {
|
|
47
48
|
return !!i;
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
+
const pt = {
|
|
50
51
|
fn: (i, r) => {
|
|
51
|
-
const e =
|
|
52
|
-
return e === null ? r === "" :
|
|
52
|
+
const e = Fe(i);
|
|
53
|
+
return e === null ? r === "" : Se(r).test(e);
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
|
-
function
|
|
56
|
-
return i ?
|
|
56
|
+
function oe(i) {
|
|
57
|
+
return i ? pe.get(i) : pt;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function P(i) {
|
|
59
60
|
return typeof i == "number";
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
return !!(typeof i == "number" || typeof i == "string" &&
|
|
62
|
+
function le(i) {
|
|
63
|
+
return !!(typeof i == "number" || typeof i == "string" && ye(i));
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function Fe(i) {
|
|
65
66
|
return typeof i == "boolean" || i == null ? null : typeof i == "string" ? i : i.toString();
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function Ft(i) {
|
|
68
69
|
return typeof i == "number" ? !1 : i.indexOf("*") !== -1 || i.indexOf("?") !== -1;
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function Se(i) {
|
|
71
72
|
const r = i.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("?", ".").replace(/[*]/g, ".$&");
|
|
72
73
|
return new RegExp(`^${r}$`);
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
-
class
|
|
75
|
+
const K = () => /* @__PURE__ */ new Set();
|
|
76
|
+
class j extends B {
|
|
76
77
|
constructor(e, t, n) {
|
|
77
78
|
super();
|
|
78
|
-
|
|
79
|
+
S(this, "_filteredOutRows$", new D(K()));
|
|
79
80
|
/** An observable value. A set of filtered out rows. */
|
|
80
|
-
|
|
81
|
+
S(this, "filteredOutRows$", this._filteredOutRows$.asObservable());
|
|
81
82
|
// TODO: we may need to update which cols have criteria rather than simple boolean
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
S(this, "_hasCriteria$", new D(!1));
|
|
84
|
+
S(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
85
|
+
S(this, "_filterColumnByIndex", /* @__PURE__ */ new Map());
|
|
86
|
+
S(this, "_alreadyFilteredOutRows", K());
|
|
87
|
+
S(this, "_range");
|
|
87
88
|
this.unitId = e, this.subUnitId = t, this._worksheet = n;
|
|
88
89
|
}
|
|
89
90
|
get filteredOutRows() {
|
|
@@ -100,7 +101,7 @@ class V extends B {
|
|
|
100
101
|
*/
|
|
101
102
|
serialize() {
|
|
102
103
|
const e = {
|
|
103
|
-
ref:
|
|
104
|
+
ref: X.clone(this._range),
|
|
104
105
|
filterColumns: this._getAllFilterColumns(!0).sort(([t], [n]) => t - n).map(([t, n]) => n.serialize())
|
|
105
106
|
};
|
|
106
107
|
return this._alreadyFilteredOutRows && (e.cachedFilteredOut = Array.from(this._alreadyFilteredOutRows).sort()), e;
|
|
@@ -113,7 +114,7 @@ class V extends B {
|
|
|
113
114
|
* @param autoFilter auto filter data
|
|
114
115
|
*/
|
|
115
116
|
static deserialize(e, t, n, s) {
|
|
116
|
-
const o = new
|
|
117
|
+
const o = new j(e, t, n);
|
|
117
118
|
return o._dump(s), o;
|
|
118
119
|
}
|
|
119
120
|
_dump(e) {
|
|
@@ -136,7 +137,7 @@ class V extends B {
|
|
|
136
137
|
getFilteredOutRowsExceptCol(e) {
|
|
137
138
|
return this._getAllFilterColumns(!0).filter(([t]) => t !== e).reduce((t, [, n]) => {
|
|
138
139
|
const s = n.calc({ getAlreadyFilteredOutRows: () => t });
|
|
139
|
-
return s ?
|
|
140
|
+
return s ? J(t, s) : t;
|
|
140
141
|
}, /* @__PURE__ */ new Set());
|
|
141
142
|
}
|
|
142
143
|
/**
|
|
@@ -180,7 +181,7 @@ class V extends B {
|
|
|
180
181
|
return e ? t : t.map(([n, s]) => s);
|
|
181
182
|
}
|
|
182
183
|
_reCalcAllColumns() {
|
|
183
|
-
this._alreadyFilteredOutRows =
|
|
184
|
+
this._alreadyFilteredOutRows = K(), this._getAllFilterColumns().forEach((e) => e.__clearCache()), this._reCalcWithNoCacheColumns();
|
|
184
185
|
}
|
|
185
186
|
_setCriteriaWithoutReCalc(e, t) {
|
|
186
187
|
const n = this._range;
|
|
@@ -190,7 +191,7 @@ class V extends B {
|
|
|
190
191
|
if (e > o || e < s)
|
|
191
192
|
throw new Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);
|
|
192
193
|
let l;
|
|
193
|
-
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new
|
|
194
|
+
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new St(
|
|
194
195
|
this.unitId,
|
|
195
196
|
this.subUnitId,
|
|
196
197
|
this._worksheet,
|
|
@@ -209,31 +210,34 @@ class V extends B {
|
|
|
209
210
|
this._hasCriteria$.next(this._filterColumnByIndex.size > 0);
|
|
210
211
|
}
|
|
211
212
|
_rebuildAlreadyFilteredOutRowsWithCache() {
|
|
212
|
-
const e = this._getAllFilterColumns().filter((t) => t.hasCache()).reduce((t, n) =>
|
|
213
|
+
const e = this._getAllFilterColumns().filter((t) => t.hasCache()).reduce((t, n) => J(t, n.filteredOutRows), /* @__PURE__ */ new Set());
|
|
213
214
|
this._alreadyFilteredOutRows = e;
|
|
214
215
|
}
|
|
215
216
|
_reCalcWithNoCacheColumns() {
|
|
216
217
|
const e = this._getAllFilterColumns().filter((t) => !t.hasCache());
|
|
217
218
|
for (const t of e) {
|
|
218
219
|
const n = t.reCalc();
|
|
219
|
-
n && (this._alreadyFilteredOutRows =
|
|
220
|
+
n && (this._alreadyFilteredOutRows = J(this._alreadyFilteredOutRows, n));
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
|
-
class
|
|
224
|
+
class St extends B {
|
|
224
225
|
constructor(e, t, n, s, o) {
|
|
225
226
|
super();
|
|
226
|
-
|
|
227
|
+
S(this, "_filteredOutRows", null);
|
|
227
228
|
/** Cache the filter function. */
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
S(this, "_filterFn", null);
|
|
230
|
+
S(this, "_range", null);
|
|
231
|
+
S(this, "_column", 0);
|
|
232
|
+
S(this, "_filterBy", I.VALUES);
|
|
232
233
|
this.unitId = e, this.subUnitId = t, this._worksheet = n, this._criteria = s, this._filterColumnContext = o;
|
|
233
234
|
}
|
|
234
235
|
get filteredOutRows() {
|
|
235
236
|
return this._filteredOutRows;
|
|
236
237
|
}
|
|
238
|
+
get filterBy() {
|
|
239
|
+
return this._filterBy;
|
|
240
|
+
}
|
|
237
241
|
dispose() {
|
|
238
242
|
super.dispose(), this._filteredOutRows = null;
|
|
239
243
|
}
|
|
@@ -246,7 +250,7 @@ class Ct extends B {
|
|
|
246
250
|
serialize() {
|
|
247
251
|
if (!this._criteria)
|
|
248
252
|
throw new Error("[FilterColumn]: could not serialize without a filter column!");
|
|
249
|
-
return
|
|
253
|
+
return re.deepClone({
|
|
250
254
|
...this._criteria,
|
|
251
255
|
colId: this._column
|
|
252
256
|
});
|
|
@@ -262,7 +266,7 @@ class Ct extends B {
|
|
|
262
266
|
this._criteria = e, this._generateFilterFn(), this._filteredOutRows = null;
|
|
263
267
|
}
|
|
264
268
|
getColumnData() {
|
|
265
|
-
return
|
|
269
|
+
return re.deepClone(this._criteria);
|
|
266
270
|
}
|
|
267
271
|
/**
|
|
268
272
|
* Trigger new calculation on this `FilterModel` instance.
|
|
@@ -285,85 +289,109 @@ class Ct extends B {
|
|
|
285
289
|
const { row: a, rowSpan: c, col: h } = l;
|
|
286
290
|
if (o.has(a) && (!c || c === 1))
|
|
287
291
|
continue;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
s.add(a + u);
|
|
292
|
+
if (!(this._filterBy === I.VALUES ? this._filterFn(Ae(this._worksheet.getCell(a, h))) : this._filterBy === I.COLORS ? this._filterFn(this._worksheet.getComposedCellStyle(a, h)) : this._filterFn(Nt(this._worksheet, a, h))) && (s.add(a), c))
|
|
293
|
+
for (let d = 1; d < c; d++)
|
|
294
|
+
s.add(a + d);
|
|
292
295
|
}
|
|
293
296
|
return s;
|
|
294
297
|
}
|
|
295
298
|
_generateFilterFn() {
|
|
296
|
-
this._criteria && (this._filterFn =
|
|
299
|
+
this._criteria && (this._filterFn = wt(this._criteria), this._filterBy = this._criteria.filters ? I.VALUES : this._criteria.colorFilters ? I.COLORS : I.CONDITIONS);
|
|
297
300
|
}
|
|
298
301
|
}
|
|
299
|
-
function
|
|
302
|
+
function wt(i) {
|
|
300
303
|
if (i.filters)
|
|
301
|
-
return
|
|
304
|
+
return vt(i.filters);
|
|
305
|
+
if (i.colorFilters)
|
|
306
|
+
return Mt(i.colorFilters);
|
|
302
307
|
if (i.customFilters)
|
|
303
|
-
return
|
|
308
|
+
return Et(i.customFilters);
|
|
304
309
|
throw new Error("[FilterModel]: other types of filters are not supported yet.");
|
|
305
310
|
}
|
|
306
|
-
function
|
|
311
|
+
function vt(i) {
|
|
307
312
|
const r = !!i.blank, e = new Set(i.filters);
|
|
308
313
|
return (t) => t === void 0 || t === "" ? r : e.has(typeof t == "string" ? t : `${t}`);
|
|
309
314
|
}
|
|
310
|
-
function
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
function Mt(i) {
|
|
316
|
+
if (i.cellFillColors) {
|
|
317
|
+
const r = new Set(i.cellFillColors);
|
|
318
|
+
return (e) => {
|
|
319
|
+
var n;
|
|
320
|
+
if (!e || !((n = e.bg) != null && n.rgb))
|
|
321
|
+
return !!r.has(null);
|
|
322
|
+
const t = new ne(e.bg.rgb).toRgbString();
|
|
323
|
+
return r.has(t);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
if (i.cellTextColors) {
|
|
327
|
+
const r = new Set(i.cellTextColors);
|
|
328
|
+
return (e) => {
|
|
329
|
+
var n;
|
|
330
|
+
if (!e || !((n = e.cl) != null && n.rgb))
|
|
331
|
+
return !!r.has(at);
|
|
332
|
+
const t = new ne(e.cl.rgb).toRgbString();
|
|
333
|
+
return r.has(t);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
throw new Error("[FilterModel]: color filters are not supported yet.");
|
|
313
337
|
}
|
|
314
|
-
function
|
|
338
|
+
function Et(i) {
|
|
339
|
+
const r = i.customFilters.map((e) => Tt(e));
|
|
340
|
+
return At(r) ? i.and ? Ot(r) : yt(r) : r[0];
|
|
341
|
+
}
|
|
342
|
+
function Ot(i) {
|
|
315
343
|
const [r, e] = i;
|
|
316
344
|
return (t) => r(t) && e(t);
|
|
317
345
|
}
|
|
318
|
-
function
|
|
346
|
+
function yt(i) {
|
|
319
347
|
const [r, e] = i;
|
|
320
348
|
return (t) => r(t) || e(t);
|
|
321
349
|
}
|
|
322
|
-
function
|
|
350
|
+
function At(i) {
|
|
323
351
|
return i.length === 2;
|
|
324
352
|
}
|
|
325
|
-
function
|
|
353
|
+
function Tt(i) {
|
|
326
354
|
const r = i.val;
|
|
327
|
-
if (i.operator === x.NOT_EQUALS && !
|
|
328
|
-
return (n) =>
|
|
329
|
-
if (
|
|
330
|
-
if (!
|
|
331
|
-
const n =
|
|
355
|
+
if (i.operator === x.NOT_EQUALS && !le(r))
|
|
356
|
+
return (n) => Ce.fn(n, r);
|
|
357
|
+
if (Ct(i.operator)) {
|
|
358
|
+
if (!le(r)) return () => !1;
|
|
359
|
+
const n = oe(i.operator), s = Number(r);
|
|
332
360
|
return (o) => n.fn(o, s);
|
|
333
361
|
}
|
|
334
|
-
const e =
|
|
362
|
+
const e = oe(i.operator);
|
|
335
363
|
return (t) => e.fn(t, r);
|
|
336
364
|
}
|
|
337
|
-
function
|
|
365
|
+
function Nt(i, r, e) {
|
|
338
366
|
const t = i.getCell(r, e);
|
|
339
367
|
if (!t) return null;
|
|
340
368
|
const n = i.getCellRaw(r, e);
|
|
341
|
-
return t && !n ?
|
|
369
|
+
return t && !n ? ae(t) : n ? t.t === Z.NUMBER && typeof t.v == "string" ? n.v : ae(n) : null;
|
|
342
370
|
}
|
|
343
|
-
function
|
|
371
|
+
function ae(i) {
|
|
344
372
|
var t, n;
|
|
345
373
|
const r = (n = (t = i.p) == null ? void 0 : t.body) == null ? void 0 : n.dataStream;
|
|
346
374
|
if (r) return r.trimEnd();
|
|
347
375
|
const e = i.v;
|
|
348
|
-
return typeof e == "string" ? i.t ===
|
|
376
|
+
return typeof e == "string" ? i.t === Z.BOOLEAN ? e.toUpperCase() : e : typeof e == "number" ? i.t === Z.BOOLEAN ? e ? "TRUE" : "FALSE" : e : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : "";
|
|
349
377
|
}
|
|
350
|
-
var
|
|
351
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
378
|
+
var xt = Object.getOwnPropertyDescriptor, It = (i, r, e, t) => {
|
|
379
|
+
for (var n = t > 1 ? void 0 : t ? xt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
352
380
|
(o = i[s]) && (n = o(n) || n);
|
|
353
381
|
return n;
|
|
354
382
|
}, Y = (i, r) => (e, t) => r(e, t, i);
|
|
355
|
-
const
|
|
383
|
+
const we = "SHEET_FILTER_PLUGIN";
|
|
356
384
|
let M = class extends B {
|
|
357
385
|
constructor(r, e, t) {
|
|
358
386
|
super();
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
387
|
+
S(this, "_filterModels", /* @__PURE__ */ new Map());
|
|
388
|
+
S(this, "_loadedUnitId$", new D(null));
|
|
389
|
+
S(this, "loadedUnitId$", this._loadedUnitId$.asObservable());
|
|
390
|
+
S(this, "_errorMsg$", new D(null));
|
|
391
|
+
S(this, "errorMsg$", this._errorMsg$.asObservable());
|
|
392
|
+
S(this, "_activeFilterModel$", new D(null));
|
|
365
393
|
/** An observable value emitting the current Workbook's active Worksheet's filter model (if there is one). */
|
|
366
|
-
|
|
394
|
+
S(this, "activeFilterModel$", this._activeFilterModel$.asObservable());
|
|
367
395
|
this._resourcesManagerService = r, this._univerInstanceService = e, this._commandService = t, this._initModel(), this._initActiveFilterModel();
|
|
368
396
|
}
|
|
369
397
|
/** The current Workbook's active Worksheet's filter model (if there is one). */
|
|
@@ -385,7 +413,7 @@ let M = class extends B {
|
|
|
385
413
|
const s = n.getSheetBySheetId(e);
|
|
386
414
|
if (!s)
|
|
387
415
|
throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing worksheet ${e}!`);
|
|
388
|
-
const o = new
|
|
416
|
+
const o = new j(r, e, s);
|
|
389
417
|
return this._cacheFilterModel(r, e, o), o;
|
|
390
418
|
}
|
|
391
419
|
getFilterModel(r, e) {
|
|
@@ -402,7 +430,7 @@ let M = class extends B {
|
|
|
402
430
|
_updateActiveFilterModel() {
|
|
403
431
|
let r;
|
|
404
432
|
try {
|
|
405
|
-
if (r = this._univerInstanceService.getCurrentUnitForType(
|
|
433
|
+
if (r = this._univerInstanceService.getCurrentUnitForType(b.UNIVER_SHEET), !r) {
|
|
406
434
|
this._activeFilterModel$.next(null);
|
|
407
435
|
return;
|
|
408
436
|
}
|
|
@@ -420,13 +448,13 @@ let M = class extends B {
|
|
|
420
448
|
}
|
|
421
449
|
_initActiveFilterModel() {
|
|
422
450
|
this.disposeWithMe(
|
|
423
|
-
|
|
451
|
+
it(
|
|
424
452
|
// source1: executing filter related mutations
|
|
425
|
-
|
|
453
|
+
Te(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(st(([r]) => r.type === E.MUTATION && Re.has(r.id))),
|
|
426
454
|
// source2: activate sheet changes
|
|
427
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
455
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(b.UNIVER_SHEET).pipe(ot((r) => {
|
|
428
456
|
var e;
|
|
429
|
-
return (e = r == null ? void 0 : r.activeSheet$) != null ? e :
|
|
457
|
+
return (e = r == null ? void 0 : r.activeSheet$) != null ? e : lt(null);
|
|
430
458
|
}))
|
|
431
459
|
).subscribe(() => this._updateActiveFilterModel())
|
|
432
460
|
);
|
|
@@ -443,14 +471,14 @@ let M = class extends B {
|
|
|
443
471
|
_deserializeAutoFiltersForUnit(r, e) {
|
|
444
472
|
const t = this._univerInstanceService.getUniverSheetInstance(r);
|
|
445
473
|
Object.keys(e).forEach((n) => {
|
|
446
|
-
const s = e[n], o =
|
|
474
|
+
const s = e[n], o = j.deserialize(r, n, t.getSheetBySheetId(n), s);
|
|
447
475
|
this._cacheFilterModel(r, n, o);
|
|
448
476
|
});
|
|
449
477
|
}
|
|
450
478
|
_initModel() {
|
|
451
479
|
this._resourcesManagerService.registerPluginResource({
|
|
452
|
-
pluginName:
|
|
453
|
-
businesses: [
|
|
480
|
+
pluginName: we,
|
|
481
|
+
businesses: [b.UNIVER_SHEET],
|
|
454
482
|
toJson: (r) => this._serializeAutoFiltersForUnit(r),
|
|
455
483
|
parseJson: (r) => JSON.parse(r),
|
|
456
484
|
onLoad: (r, e) => {
|
|
@@ -466,98 +494,98 @@ let M = class extends B {
|
|
|
466
494
|
this._filterModels.has(r) || this._filterModels.set(r, /* @__PURE__ */ new Map()), this._filterModels.get(r).set(e, t);
|
|
467
495
|
}
|
|
468
496
|
};
|
|
469
|
-
M =
|
|
470
|
-
Y(0,
|
|
497
|
+
M = It([
|
|
498
|
+
Y(0, Ne),
|
|
471
499
|
Y(1, T),
|
|
472
500
|
Y(2, N)
|
|
473
501
|
], M);
|
|
474
502
|
const R = {
|
|
475
|
-
id:
|
|
503
|
+
id: fe,
|
|
476
504
|
type: E.MUTATION,
|
|
477
505
|
handler: (i, r) => {
|
|
478
506
|
const { subUnitId: e, unitId: t, range: n } = r;
|
|
479
507
|
return i.get(M).ensureFilterModel(t, e).setRange(n), !0;
|
|
480
508
|
}
|
|
481
509
|
}, p = {
|
|
482
|
-
id:
|
|
510
|
+
id: me,
|
|
483
511
|
type: E.MUTATION,
|
|
484
512
|
handler: (i, r) => {
|
|
485
513
|
const { subUnitId: e, unitId: t, criteria: n, col: s, reCalc: o = !0 } = r, a = i.get(M).getFilterModel(t, e);
|
|
486
514
|
return a ? (a.setCriteria(s, n, o), !0) : !1;
|
|
487
515
|
}
|
|
488
|
-
},
|
|
489
|
-
id:
|
|
516
|
+
}, O = {
|
|
517
|
+
id: ge,
|
|
490
518
|
type: E.MUTATION,
|
|
491
519
|
handler: (i, r) => {
|
|
492
520
|
const { unitId: e, subUnitId: t } = r;
|
|
493
521
|
return i.get(M).removeFilterModel(e, t);
|
|
494
522
|
}
|
|
495
523
|
}, W = {
|
|
496
|
-
id:
|
|
524
|
+
id: _e,
|
|
497
525
|
type: E.MUTATION,
|
|
498
526
|
handler: (i, r) => {
|
|
499
527
|
const { unitId: e, subUnitId: t } = r, s = i.get(M).getFilterModel(e, t);
|
|
500
528
|
return s ? (s.reCalc(), !0) : !1;
|
|
501
529
|
}
|
|
502
|
-
},
|
|
530
|
+
}, $t = {
|
|
503
531
|
id: "sheet.command.set-filter-range",
|
|
504
532
|
type: E.COMMAND,
|
|
505
533
|
handler: (i, r) => {
|
|
506
|
-
const e = i.get(M), t = i.get(N), n = i.get(
|
|
507
|
-
if (!
|
|
534
|
+
const e = i.get(M), t = i.get(N), n = i.get(G), s = i.get(T), { unitId: o, subUnitId: l, range: a } = r;
|
|
535
|
+
if (!H(s, r) || e.getFilterModel(o, l)) return !1;
|
|
508
536
|
if (a.endRow === a.startRow) {
|
|
509
|
-
const
|
|
510
|
-
return
|
|
537
|
+
const m = i.get(Ie), g = i.get($e);
|
|
538
|
+
return m.emit(g.t("sheets-filter.command.not-valid-filter-range")), !1;
|
|
511
539
|
}
|
|
512
|
-
const
|
|
513
|
-
return
|
|
540
|
+
const u = { id: R.id, params: { unitId: o, subUnitId: l, range: a } }, d = t.syncExecuteCommand(u.id, u.params);
|
|
541
|
+
return d && n.pushUndoRedo({
|
|
514
542
|
unitID: o,
|
|
515
|
-
undoMutations: [{ id:
|
|
516
|
-
redoMutations: [
|
|
517
|
-
}),
|
|
543
|
+
undoMutations: [{ id: O.id, params: { unitId: o, subUnitId: l } }],
|
|
544
|
+
redoMutations: [u]
|
|
545
|
+
}), d;
|
|
518
546
|
}
|
|
519
|
-
},
|
|
547
|
+
}, Ut = {
|
|
520
548
|
id: "sheet.command.remove-sheet-filter",
|
|
521
549
|
type: E.COMMAND,
|
|
522
550
|
handler: (i, r) => {
|
|
523
|
-
const e = i.get(T), t = i.get(M), n = i.get(N), s = i.get(
|
|
551
|
+
const e = i.get(T), t = i.get(M), n = i.get(N), s = i.get(G), o = H(e, r);
|
|
524
552
|
if (!o) return !1;
|
|
525
553
|
const { unitId: l, subUnitId: a } = o, c = t.getFilterModel(l, a);
|
|
526
554
|
if (!c) return !1;
|
|
527
|
-
const h = c == null ? void 0 : c.serialize(),
|
|
528
|
-
return
|
|
555
|
+
const h = c == null ? void 0 : c.serialize(), u = Lt(l, a, h), d = n.syncExecuteCommand(O.id, { unitId: l, subUnitId: a });
|
|
556
|
+
return d && s.pushUndoRedo({
|
|
529
557
|
unitID: l,
|
|
530
|
-
undoMutations:
|
|
531
|
-
redoMutations: [{ id:
|
|
532
|
-
}),
|
|
558
|
+
undoMutations: u,
|
|
559
|
+
redoMutations: [{ id: O.id, params: { unitId: l, subUnitId: a } }]
|
|
560
|
+
}), d;
|
|
533
561
|
}
|
|
534
|
-
},
|
|
562
|
+
}, Zt = {
|
|
535
563
|
id: "sheet.command.smart-toggle-filter",
|
|
536
564
|
type: E.COMMAND,
|
|
537
565
|
handler: async (i) => {
|
|
538
|
-
const r = i.get(T), e = i.get(M), t = i.get(N), n = r.getCurrentUnitForType(
|
|
566
|
+
const r = i.get(T), e = i.get(M), t = i.get(N), n = r.getCurrentUnitForType(b.UNIVER_SHEET), s = n == null ? void 0 : n.getActiveSheet();
|
|
539
567
|
if (!s || !n) return !1;
|
|
540
568
|
const o = n.getUnitId(), l = s.getSheetId();
|
|
541
569
|
if (e.getFilterModel(o, l))
|
|
542
|
-
return t.executeCommand(
|
|
543
|
-
const h = i.get(
|
|
570
|
+
return t.executeCommand(Ut.id, { unitId: o, subUnitId: l });
|
|
571
|
+
const h = i.get(ze).getCurrentLastSelection();
|
|
544
572
|
if (!h) return !1;
|
|
545
|
-
const
|
|
546
|
-
return t.executeCommand(
|
|
573
|
+
const u = h.range, d = Ve(h) ? he(u, { left: !0, right: !0, up: !0, down: !0 }, s) : u;
|
|
574
|
+
return t.executeCommand($t.id, {
|
|
547
575
|
unitId: o,
|
|
548
576
|
subUnitId: l,
|
|
549
|
-
range:
|
|
577
|
+
range: d
|
|
550
578
|
});
|
|
551
579
|
}
|
|
552
|
-
},
|
|
580
|
+
}, er = {
|
|
553
581
|
id: "sheet.command.set-filter-criteria",
|
|
554
582
|
type: E.COMMAND,
|
|
555
583
|
handler: (i, r) => {
|
|
556
|
-
const e = i.get(M), t = i.get(N), n = i.get(
|
|
584
|
+
const e = i.get(M), t = i.get(N), n = i.get(G), { unitId: s, subUnitId: o, col: l, criteria: a } = r, c = e.getFilterModel(s, o);
|
|
557
585
|
if (!c) return !1;
|
|
558
586
|
const h = c.getRange();
|
|
559
587
|
if (!h || l < h.startColumn || l > h.endColumn) return !1;
|
|
560
|
-
const
|
|
588
|
+
const u = c.getFilterColumn(l), d = bt(s, o, l, u), m = {
|
|
561
589
|
id: p.id,
|
|
562
590
|
params: {
|
|
563
591
|
unitId: s,
|
|
@@ -565,39 +593,39 @@ const R = {
|
|
|
565
593
|
col: l,
|
|
566
594
|
criteria: a
|
|
567
595
|
}
|
|
568
|
-
}, g = t.syncExecuteCommand(
|
|
596
|
+
}, g = t.syncExecuteCommand(m.id, m.params);
|
|
569
597
|
return g && n.pushUndoRedo({
|
|
570
598
|
unitID: s,
|
|
571
|
-
undoMutations: [
|
|
572
|
-
redoMutations: [
|
|
599
|
+
undoMutations: [d],
|
|
600
|
+
redoMutations: [m]
|
|
573
601
|
}), g;
|
|
574
602
|
}
|
|
575
|
-
},
|
|
603
|
+
}, tr = {
|
|
576
604
|
id: "sheet.command.clear-filter-criteria",
|
|
577
605
|
type: E.COMMAND,
|
|
578
606
|
handler: (i, r) => {
|
|
579
|
-
const e = i.get(M), t = i.get(
|
|
607
|
+
const e = i.get(M), t = i.get(G), n = i.get(N), s = i.get(T), o = H(s, r);
|
|
580
608
|
if (!o) return !1;
|
|
581
609
|
const { unitId: l, subUnitId: a } = o, c = e.getFilterModel(o.unitId, o.subUnitId);
|
|
582
610
|
if (!c) return !1;
|
|
583
|
-
const h = c.serialize(),
|
|
584
|
-
return
|
|
611
|
+
const h = c.serialize(), u = ve(l, a, h), d = Pt(l, a, h);
|
|
612
|
+
return xe(d, n).result ? (t.pushUndoRedo({
|
|
585
613
|
unitID: l,
|
|
586
|
-
undoMutations:
|
|
587
|
-
redoMutations:
|
|
614
|
+
undoMutations: u,
|
|
615
|
+
redoMutations: d
|
|
588
616
|
}), !0) : !1;
|
|
589
617
|
}
|
|
590
|
-
},
|
|
618
|
+
}, rr = {
|
|
591
619
|
id: "sheet.command.re-calc-filter",
|
|
592
620
|
type: E.COMMAND,
|
|
593
621
|
handler: (i, r) => {
|
|
594
|
-
const e = i.get(M), t = i.get(N), n = i.get(T), s =
|
|
622
|
+
const e = i.get(M), t = i.get(N), n = i.get(T), s = H(n, r);
|
|
595
623
|
if (!s) return !1;
|
|
596
624
|
const { unitId: o, subUnitId: l } = s;
|
|
597
625
|
return e.getFilterModel(s.unitId, s.subUnitId) ? t.executeCommand(W.id, { unitId: o, subUnitId: l }) : !1;
|
|
598
626
|
}
|
|
599
627
|
};
|
|
600
|
-
function
|
|
628
|
+
function Lt(i, r, e) {
|
|
601
629
|
const t = [], n = {
|
|
602
630
|
id: R.id,
|
|
603
631
|
params: {
|
|
@@ -606,9 +634,9 @@ function xt(i, r, e) {
|
|
|
606
634
|
range: e.ref
|
|
607
635
|
}
|
|
608
636
|
};
|
|
609
|
-
return t.push(n),
|
|
637
|
+
return t.push(n), ve(i, r, e).forEach((o) => t.push(o)), t;
|
|
610
638
|
}
|
|
611
|
-
function
|
|
639
|
+
function ve(i, r, e) {
|
|
612
640
|
var n;
|
|
613
641
|
const t = [];
|
|
614
642
|
return (n = e.filterColumns) == null || n.forEach((s) => {
|
|
@@ -624,7 +652,7 @@ function we(i, r, e) {
|
|
|
624
652
|
t.push(o);
|
|
625
653
|
}), t;
|
|
626
654
|
}
|
|
627
|
-
function
|
|
655
|
+
function Pt(i, r, e) {
|
|
628
656
|
var n;
|
|
629
657
|
const t = [];
|
|
630
658
|
return (n = e.filterColumns) == null || n.forEach((s) => {
|
|
@@ -640,7 +668,7 @@ function It(i, r, e) {
|
|
|
640
668
|
t.push(o);
|
|
641
669
|
}), t;
|
|
642
670
|
}
|
|
643
|
-
function
|
|
671
|
+
function bt(i, r, e, t) {
|
|
644
672
|
if (!t)
|
|
645
673
|
return {
|
|
646
674
|
id: p.id,
|
|
@@ -662,8 +690,8 @@ function $t(i, r, e, t) {
|
|
|
662
690
|
}
|
|
663
691
|
};
|
|
664
692
|
}
|
|
665
|
-
const
|
|
666
|
-
function
|
|
693
|
+
const Dt = "sheets-filter.config", ce = {};
|
|
694
|
+
function Bt(i, r) {
|
|
667
695
|
for (let e = 0; e < i.length; e++) {
|
|
668
696
|
let t = e;
|
|
669
697
|
if (i[e])
|
|
@@ -672,18 +700,18 @@ function Ut(i, r) {
|
|
|
672
700
|
}
|
|
673
701
|
return i.filter((e) => e !== null);
|
|
674
702
|
}
|
|
675
|
-
function
|
|
676
|
-
return
|
|
703
|
+
function U(i) {
|
|
704
|
+
return Bt(i, (r, e) => r.id === p.id && e.id === p.id && r.params.unitId === e.params.unitId && r.params.subUnitId === e.params.subUnitId && r.params.col === e.params.col);
|
|
677
705
|
}
|
|
678
|
-
var
|
|
679
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
706
|
+
var Ht = Object.getOwnPropertyDescriptor, zt = (i, r, e, t) => {
|
|
707
|
+
for (var n = t > 1 ? void 0 : t ? Ht(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
680
708
|
(o = i[s]) && (n = o(n) || n);
|
|
681
709
|
return n;
|
|
682
|
-
},
|
|
683
|
-
let
|
|
710
|
+
}, L = (i, r) => (e, t) => r(e, t, i);
|
|
711
|
+
let k = class extends B {
|
|
684
712
|
constructor(r, e, t, n, s, o) {
|
|
685
713
|
super();
|
|
686
|
-
|
|
714
|
+
S(this, "_disposableCollection", new Le());
|
|
687
715
|
this._commandService = r, this._sheetInterceptorService = e, this._sheetsFilterService = t, this._univerInstanceService = n, this._refRangeService = s, this._dataSyncPrimaryController = o, this._initCommands(), this._initRowFilteredInterceptor(), this._initInterceptors(), this._commandExecutedListener(), this._initErrorHandling();
|
|
688
716
|
}
|
|
689
717
|
_initCommands() {
|
|
@@ -691,7 +719,7 @@ let j = class extends B {
|
|
|
691
719
|
p,
|
|
692
720
|
R,
|
|
693
721
|
W,
|
|
694
|
-
|
|
722
|
+
O
|
|
695
723
|
].forEach((r) => {
|
|
696
724
|
var e;
|
|
697
725
|
this.disposeWithMe(this._commandService.registerCommand(r)), (e = this._dataSyncPrimaryController) == null || e.registerSyncingMutations(r);
|
|
@@ -701,7 +729,7 @@ let j = class extends B {
|
|
|
701
729
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
702
730
|
getMutations: (r) => this._getUpdateFilter(r)
|
|
703
731
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((r) => {
|
|
704
|
-
if (r.id ===
|
|
732
|
+
if (r.id === ke.id) {
|
|
705
733
|
const e = r.params, t = e.subUnitId, n = e.unitId;
|
|
706
734
|
if (!t || !n)
|
|
707
735
|
return;
|
|
@@ -727,31 +755,31 @@ let j = class extends B {
|
|
|
727
755
|
if (!t || !n) return;
|
|
728
756
|
const s = (l = this._sheetsFilterService.getFilterModel(r, e)) == null ? void 0 : l.getRange(), o = (a) => {
|
|
729
757
|
switch (a.id) {
|
|
730
|
-
case
|
|
731
|
-
const c = a.params, h = c.unitId || r,
|
|
732
|
-
return this._handleInsertRowCommand(c, h,
|
|
758
|
+
case nt.id: {
|
|
759
|
+
const c = a.params, h = c.unitId || r, u = c.subUnitId || e;
|
|
760
|
+
return this._handleInsertRowCommand(c, h, u);
|
|
733
761
|
}
|
|
734
|
-
case
|
|
735
|
-
const c = a.params, h = c.unitId || r,
|
|
736
|
-
return this._handleInsertColCommand(c, h,
|
|
762
|
+
case rt.id: {
|
|
763
|
+
const c = a.params, h = c.unitId || r, u = c.subUnitId || e;
|
|
764
|
+
return this._handleInsertColCommand(c, h, u);
|
|
737
765
|
}
|
|
738
|
-
case
|
|
766
|
+
case tt.id: {
|
|
739
767
|
const c = a.params;
|
|
740
768
|
return this._handleRemoveColCommand(c, r, e);
|
|
741
769
|
}
|
|
742
|
-
case
|
|
770
|
+
case et.id: {
|
|
743
771
|
const c = a.params;
|
|
744
772
|
return this._handleRemoveRowCommand(c, r, e);
|
|
745
773
|
}
|
|
746
|
-
case
|
|
774
|
+
case se.MoveColsCommandId: {
|
|
747
775
|
const c = a.params;
|
|
748
776
|
return this._handleMoveColsCommand(c, r, e);
|
|
749
777
|
}
|
|
750
|
-
case
|
|
778
|
+
case se.MoveRowsCommandId: {
|
|
751
779
|
const c = a.params;
|
|
752
780
|
return this._handleMoveRowsCommand(c, r, e);
|
|
753
781
|
}
|
|
754
|
-
case
|
|
782
|
+
case Ze.id: {
|
|
755
783
|
const c = a.params;
|
|
756
784
|
return this._handleMoveRangeCommand(c, r, e);
|
|
757
785
|
}
|
|
@@ -763,11 +791,11 @@ let j = class extends B {
|
|
|
763
791
|
_getUpdateFilter(r) {
|
|
764
792
|
const { id: e } = r;
|
|
765
793
|
switch (e) {
|
|
766
|
-
case
|
|
794
|
+
case Ge.id: {
|
|
767
795
|
const t = r.params;
|
|
768
796
|
return this._handleRemoveSheetCommand(t, t.unitId, t.subUnitId);
|
|
769
797
|
}
|
|
770
|
-
case
|
|
798
|
+
case qe.id: {
|
|
771
799
|
const t = r.params, { targetSubUnitId: n, unitId: s, subUnitId: o } = t;
|
|
772
800
|
return !s || !o || !n ? this._handleNull() : this._handleCopySheetCommand(s, o, n);
|
|
773
801
|
}
|
|
@@ -785,7 +813,7 @@ let j = class extends B {
|
|
|
785
813
|
const { startColumn: o, endColumn: l } = s, { startColumn: a, endColumn: c } = r.range, h = c - a + 1;
|
|
786
814
|
if (c > l)
|
|
787
815
|
return this._handleNull();
|
|
788
|
-
const
|
|
816
|
+
const u = [], d = [], m = a, g = {
|
|
789
817
|
unitId: e,
|
|
790
818
|
subUnitId: t,
|
|
791
819
|
range: {
|
|
@@ -798,13 +826,13 @@ let j = class extends B {
|
|
|
798
826
|
subUnitId: t,
|
|
799
827
|
range: s
|
|
800
828
|
};
|
|
801
|
-
|
|
802
|
-
const F = n.getAllFilterColumns().filter((
|
|
829
|
+
u.push({ id: R.id, params: g }), d.push({ id: R.id, params: C });
|
|
830
|
+
const F = n.getAllFilterColumns().filter((f) => f[0] >= m);
|
|
803
831
|
if (F.length !== 0) {
|
|
804
|
-
const { newRange:
|
|
805
|
-
|
|
832
|
+
const { newRange: f, oldRange: v } = this._moveCriteria(e, t, F, h);
|
|
833
|
+
u.push(...f.redos, ...v.redos), d.push(...f.undos, ...v.undos);
|
|
806
834
|
}
|
|
807
|
-
return { redos:
|
|
835
|
+
return { redos: U(u), undos: U(d) };
|
|
808
836
|
}
|
|
809
837
|
_handleInsertRowCommand(r, e, t) {
|
|
810
838
|
var C;
|
|
@@ -814,7 +842,7 @@ let j = class extends B {
|
|
|
814
842
|
const { startRow: o, endRow: l } = s, { startRow: a, endRow: c } = r.range, h = c - a + 1;
|
|
815
843
|
if (c > l)
|
|
816
844
|
return this._handleNull();
|
|
817
|
-
const
|
|
845
|
+
const u = [], d = [], m = {
|
|
818
846
|
unitId: e,
|
|
819
847
|
subUnitId: t,
|
|
820
848
|
range: {
|
|
@@ -827,9 +855,9 @@ let j = class extends B {
|
|
|
827
855
|
subUnitId: t,
|
|
828
856
|
range: s
|
|
829
857
|
};
|
|
830
|
-
return
|
|
831
|
-
redos:
|
|
832
|
-
undos:
|
|
858
|
+
return u.push({ id: R.id, params: m }), d.push({ id: R.id, params: g }), {
|
|
859
|
+
redos: U(u),
|
|
860
|
+
undos: U(d)
|
|
833
861
|
};
|
|
834
862
|
}
|
|
835
863
|
_handleRemoveColCommand(r, e, t) {
|
|
@@ -840,36 +868,36 @@ let j = class extends B {
|
|
|
840
868
|
const { startColumn: o, endColumn: l } = s, { startColumn: a, endColumn: c } = r.range;
|
|
841
869
|
if (a > l)
|
|
842
870
|
return this._handleNull();
|
|
843
|
-
const h = [],
|
|
871
|
+
const h = [], u = [], d = c < o ? 0 : Math.min(c, l) - Math.max(a, o) + 1, m = c - a + 1, g = n.getAllFilterColumns();
|
|
844
872
|
g.forEach((_) => {
|
|
845
|
-
const [
|
|
846
|
-
|
|
873
|
+
const [f, v] = _;
|
|
874
|
+
f <= c && f >= a && (h.push({ id: p.id, params: { unitId: e, subUnitId: t, col: f, criteria: null } }), u.push({ id: p.id, params: { unitId: e, subUnitId: t, col: f, criteria: { ...v.serialize(), colId: f } } }));
|
|
847
875
|
});
|
|
848
876
|
const C = g.filter((_) => {
|
|
849
|
-
const [
|
|
850
|
-
return
|
|
877
|
+
const [f, v] = _;
|
|
878
|
+
return f > c;
|
|
851
879
|
});
|
|
852
|
-
let
|
|
880
|
+
let w = { undos: [], redos: [] };
|
|
853
881
|
if (C.length > 0) {
|
|
854
|
-
const { oldRange: _, newRange:
|
|
855
|
-
|
|
882
|
+
const { oldRange: _, newRange: f } = this._moveCriteria(e, t, C, -m);
|
|
883
|
+
w = f, h.push(..._.redos), u.unshift(..._.undos);
|
|
856
884
|
}
|
|
857
|
-
if (
|
|
885
|
+
if (d === l - o + 1) {
|
|
858
886
|
const _ = {
|
|
859
887
|
unitId: e,
|
|
860
888
|
subUnitId: t
|
|
861
889
|
};
|
|
862
|
-
h.push({ id:
|
|
890
|
+
h.push({ id: O.id, params: _ }), u.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
863
891
|
} else {
|
|
864
|
-
const _ = o <= a ? o :
|
|
892
|
+
const _ = o <= a ? o : d === 0 ? o - m : a, f = o <= a ? l - d : l - m, v = {
|
|
865
893
|
unitId: e,
|
|
866
894
|
subUnitId: t,
|
|
867
|
-
range: { ...s, startColumn: _, endColumn:
|
|
895
|
+
range: { ...s, startColumn: _, endColumn: f }
|
|
868
896
|
};
|
|
869
|
-
h.push({ id: R.id, params: v }),
|
|
897
|
+
h.push({ id: R.id, params: v }), u.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } }), h.push(...w.redos), u.unshift(...w.undos);
|
|
870
898
|
}
|
|
871
899
|
return {
|
|
872
|
-
undos:
|
|
900
|
+
undos: u,
|
|
873
901
|
redos: h
|
|
874
902
|
};
|
|
875
903
|
}
|
|
@@ -897,44 +925,44 @@ let j = class extends B {
|
|
|
897
925
|
}
|
|
898
926
|
}]
|
|
899
927
|
};
|
|
900
|
-
const h = [],
|
|
901
|
-
|
|
928
|
+
const h = [], u = [], d = n.getAllFilterColumns(), m = o <= c && o >= a;
|
|
929
|
+
u.push({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
902
930
|
const g = Math.min(c, l) - Math.max(a, o) + 1;
|
|
903
|
-
if (g === l - o + 1 ||
|
|
904
|
-
const
|
|
931
|
+
if (g === l - o + 1 || m) {
|
|
932
|
+
const w = {
|
|
905
933
|
unitId: e,
|
|
906
934
|
subUnitId: t
|
|
907
935
|
};
|
|
908
|
-
h.push({ id:
|
|
909
|
-
const [_,
|
|
936
|
+
h.push({ id: O.id, params: w }), d.forEach((F) => {
|
|
937
|
+
const [_, f] = F, v = {
|
|
910
938
|
unitId: e,
|
|
911
939
|
subUnitId: t,
|
|
912
940
|
col: _,
|
|
913
|
-
criteria: { ...
|
|
941
|
+
criteria: { ...f.serialize(), colId: _ }
|
|
914
942
|
};
|
|
915
|
-
|
|
943
|
+
u.push({ id: p.id, params: v });
|
|
916
944
|
});
|
|
917
945
|
} else {
|
|
918
|
-
const
|
|
919
|
-
if (!
|
|
946
|
+
const w = (C = this._univerInstanceService.getUniverSheetInstance(e)) == null ? void 0 : C.getSheetBySheetId(t);
|
|
947
|
+
if (!w)
|
|
920
948
|
return this._handleNull();
|
|
921
949
|
const F = [];
|
|
922
|
-
for (let
|
|
923
|
-
|
|
924
|
-
const _ = Math.min(o, a),
|
|
950
|
+
for (let y = a; y <= c; y++)
|
|
951
|
+
w.getRowFiltered(y) && F.push(y);
|
|
952
|
+
const _ = Math.min(o, a), f = _ + (l - o) - g + F.length, v = {
|
|
925
953
|
unitId: e,
|
|
926
954
|
subUnitId: t,
|
|
927
955
|
range: {
|
|
928
956
|
...s,
|
|
929
957
|
startRow: _,
|
|
930
|
-
endRow:
|
|
958
|
+
endRow: f
|
|
931
959
|
}
|
|
932
960
|
};
|
|
933
961
|
h.push({ id: R.id, params: v });
|
|
934
962
|
}
|
|
935
963
|
return {
|
|
936
|
-
undos:
|
|
937
|
-
redos:
|
|
964
|
+
undos: U(u),
|
|
965
|
+
redos: U(h)
|
|
938
966
|
};
|
|
939
967
|
}
|
|
940
968
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -946,58 +974,58 @@ let j = class extends B {
|
|
|
946
974
|
const { startColumn: o, endColumn: l } = s, { fromRange: a, toRange: c } = r;
|
|
947
975
|
if (a.endColumn < o && c.startColumn <= o || a.startColumn > l && c.endColumn > l)
|
|
948
976
|
return this._handleNull();
|
|
949
|
-
const h = [],
|
|
950
|
-
for (let
|
|
951
|
-
|
|
952
|
-
colIndex:
|
|
953
|
-
filter: n.getFilterColumn(
|
|
977
|
+
const h = [], u = [], d = {};
|
|
978
|
+
for (let f = o; f <= l; f++)
|
|
979
|
+
d[f] = {
|
|
980
|
+
colIndex: f,
|
|
981
|
+
filter: n.getFilterColumn(f)
|
|
954
982
|
};
|
|
955
|
-
|
|
956
|
-
let
|
|
957
|
-
o >= a.startColumn && o <= a.endColumn && c.startColumn > a.startColumn && a.endColumn < l && (
|
|
958
|
-
const C = Object.keys(
|
|
959
|
-
if (C.forEach((
|
|
960
|
-
var
|
|
961
|
-
const { colIndex: v, filter:
|
|
962
|
-
if (
|
|
963
|
-
if (A >= F && A <=
|
|
983
|
+
ie(a.startColumn, a.endColumn - a.startColumn + 1, c.startColumn, d);
|
|
984
|
+
let m = s.startColumn, g = s.endColumn;
|
|
985
|
+
o >= a.startColumn && o <= a.endColumn && c.startColumn > a.startColumn && a.endColumn < l && (m = a.endColumn + 1), l >= a.startColumn && l <= a.endColumn && c.startColumn < a.startColumn && a.startColumn > o && (g = a.startColumn - 1);
|
|
986
|
+
const C = Object.keys(d).map((f) => Number(f)), w = C.find((f) => d[f].colIndex === g), F = C.find((f) => d[f].colIndex === m);
|
|
987
|
+
if (C.forEach((f) => {
|
|
988
|
+
var ee, te;
|
|
989
|
+
const { colIndex: v, filter: y } = d[f], A = f;
|
|
990
|
+
if (y) {
|
|
991
|
+
if (A >= F && A <= w) {
|
|
964
992
|
const Q = {
|
|
965
993
|
unitId: e,
|
|
966
994
|
subUnitId: t,
|
|
967
995
|
col: A,
|
|
968
|
-
criteria: { ...
|
|
969
|
-
},
|
|
996
|
+
criteria: { ...y.serialize(), colId: A }
|
|
997
|
+
}, Me = {
|
|
970
998
|
unitId: e,
|
|
971
999
|
subUnitId: t,
|
|
972
1000
|
col: A,
|
|
973
|
-
criteria: n.getFilterColumn(A) ? { ...(
|
|
1001
|
+
criteria: n.getFilterColumn(A) ? { ...(ee = n.getFilterColumn(A)) == null ? void 0 : ee.serialize(), colId: A } : null
|
|
974
1002
|
};
|
|
975
|
-
h.push({ id: p.id, params: Q }),
|
|
1003
|
+
h.push({ id: p.id, params: Q }), u.push({ id: p.id, params: Me });
|
|
976
1004
|
}
|
|
977
|
-
if (!((
|
|
1005
|
+
if (!((te = d[v]) != null && te.filter)) {
|
|
978
1006
|
const Q = {
|
|
979
1007
|
unitId: e,
|
|
980
1008
|
subUnitId: t,
|
|
981
1009
|
col: v,
|
|
982
1010
|
criteria: null
|
|
983
1011
|
};
|
|
984
|
-
h.push({ id: p.id, params: Q }),
|
|
1012
|
+
h.push({ id: p.id, params: Q }), u.push({ id: p.id, params: { unitId: e, subUnitId: t, col: v, criteria: { ...y.serialize(), colId: v } } });
|
|
985
1013
|
}
|
|
986
1014
|
}
|
|
987
|
-
}), o !== F || l !==
|
|
988
|
-
const
|
|
1015
|
+
}), o !== F || l !== w) {
|
|
1016
|
+
const f = {
|
|
989
1017
|
unitId: e,
|
|
990
1018
|
subUnitId: t,
|
|
991
1019
|
range: {
|
|
992
1020
|
...s,
|
|
993
1021
|
startColumn: F,
|
|
994
|
-
endColumn:
|
|
1022
|
+
endColumn: w
|
|
995
1023
|
}
|
|
996
1024
|
};
|
|
997
|
-
h.unshift({ id: R.id, params:
|
|
1025
|
+
h.unshift({ id: R.id, params: f }), u.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
998
1026
|
}
|
|
999
1027
|
return {
|
|
1000
|
-
undos:
|
|
1028
|
+
undos: u,
|
|
1001
1029
|
redos: h
|
|
1002
1030
|
};
|
|
1003
1031
|
}
|
|
@@ -1009,30 +1037,30 @@ let j = class extends B {
|
|
|
1009
1037
|
const { startRow: o, endRow: l } = s, { fromRange: a, toRange: c } = r;
|
|
1010
1038
|
if (a.endRow < o && c.startRow <= o || a.startRow > l && c.endRow > l)
|
|
1011
1039
|
return this._handleNull();
|
|
1012
|
-
const h = [],
|
|
1013
|
-
for (let
|
|
1014
|
-
|
|
1015
|
-
oldIndex:
|
|
1040
|
+
const h = [], u = [], d = {};
|
|
1041
|
+
for (let f = o; f <= l; f++)
|
|
1042
|
+
d[f] = {
|
|
1043
|
+
oldIndex: f
|
|
1016
1044
|
};
|
|
1017
|
-
const
|
|
1045
|
+
const m = o;
|
|
1018
1046
|
let g = l;
|
|
1019
|
-
l >= a.startRow && l <= a.endRow && c.startRow < a.startRow && a.startRow > o && (g = a.startRow - 1),
|
|
1020
|
-
const C = Object.keys(
|
|
1021
|
-
if (o !== F || l !==
|
|
1022
|
-
const
|
|
1047
|
+
l >= a.startRow && l <= a.endRow && c.startRow < a.startRow && a.startRow > o && (g = a.startRow - 1), ie(a.startRow, a.endRow - a.startRow + 1, c.startRow, d);
|
|
1048
|
+
const C = Object.keys(d).map((f) => Number(f)), w = C.find((f) => d[f].oldIndex === g), F = C.find((f) => d[f].oldIndex === m);
|
|
1049
|
+
if (o !== F || l !== w) {
|
|
1050
|
+
const f = {
|
|
1023
1051
|
unitId: e,
|
|
1024
1052
|
subUnitId: t,
|
|
1025
1053
|
range: {
|
|
1026
1054
|
...s,
|
|
1027
1055
|
startRow: F,
|
|
1028
|
-
endRow:
|
|
1056
|
+
endRow: w
|
|
1029
1057
|
}
|
|
1030
1058
|
};
|
|
1031
|
-
h.push({ id: R.id, params:
|
|
1059
|
+
h.push({ id: R.id, params: f }, { id: W.id, params: { unitId: e, subUnitId: t } }), u.push({ id: R.id, params: { range: s, unitId: e, subUnitId: t } }, { id: W.id, params: { unitId: e, subUnitId: t } });
|
|
1032
1060
|
}
|
|
1033
1061
|
return {
|
|
1034
1062
|
redos: h,
|
|
1035
|
-
undos:
|
|
1063
|
+
undos: u
|
|
1036
1064
|
};
|
|
1037
1065
|
}
|
|
1038
1066
|
_handleMoveRangeCommand(r, e, t) {
|
|
@@ -1043,26 +1071,26 @@ let j = class extends B {
|
|
|
1043
1071
|
if (!l)
|
|
1044
1072
|
return this._handleNull();
|
|
1045
1073
|
const a = [], c = [];
|
|
1046
|
-
if (
|
|
1047
|
-
const h = l.startRow - n.startRow,
|
|
1074
|
+
if (X.contains(n, l)) {
|
|
1075
|
+
const h = l.startRow - n.startRow, u = l.startColumn - n.startColumn, d = {
|
|
1048
1076
|
startRow: s.startRow + h,
|
|
1049
|
-
startColumn: s.startColumn +
|
|
1077
|
+
startColumn: s.startColumn + u,
|
|
1050
1078
|
endRow: s.startRow + h + (l.endRow - l.startRow),
|
|
1051
|
-
endColumn: s.startColumn +
|
|
1052
|
-
},
|
|
1053
|
-
id:
|
|
1079
|
+
endColumn: s.startColumn + u + (l.endColumn - l.startColumn)
|
|
1080
|
+
}, m = {
|
|
1081
|
+
id: O.id,
|
|
1054
1082
|
params: {
|
|
1055
1083
|
unitId: e,
|
|
1056
1084
|
subUnitId: t
|
|
1057
1085
|
}
|
|
1058
|
-
}, g = { id: R.id, params: { unitId: e, subUnitId: t, range:
|
|
1059
|
-
a.push(
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
const [
|
|
1063
|
-
v && (a.push({ id: p.id, params: { unitId: e, subUnitId: t, col:
|
|
1086
|
+
}, g = { id: R.id, params: { unitId: e, subUnitId: t, range: d } }, C = { id: R.id, params: { unitId: e, subUnitId: t, range: l } };
|
|
1087
|
+
a.push(m, g), c.push(m, C);
|
|
1088
|
+
const w = o.getAllFilterColumns(), F = s.startColumn - n.startColumn;
|
|
1089
|
+
w.forEach((_) => {
|
|
1090
|
+
const [f, v] = _;
|
|
1091
|
+
v && (a.push({ id: p.id, params: { unitId: e, subUnitId: t, col: f + F, criteria: { ...v.serialize(), colId: f + F } } }), c.push({ id: p.id, params: { unitId: e, subUnitId: t, col: f, criteria: { ...v.serialize(), colId: f } } }));
|
|
1064
1092
|
});
|
|
1065
|
-
} else if (
|
|
1093
|
+
} else if (X.intersects(s, l)) {
|
|
1066
1094
|
const h = {
|
|
1067
1095
|
...l,
|
|
1068
1096
|
endRow: Math.max(l.endRow, s.endRow)
|
|
@@ -1084,7 +1112,7 @@ let j = class extends B {
|
|
|
1084
1112
|
const o = [], l = [];
|
|
1085
1113
|
return n.getAllFilterColumns().forEach(([c, h]) => {
|
|
1086
1114
|
l.push({ id: p.id, params: { unitId: e, subUnitId: t, col: c, criteria: { ...h.serialize(), colId: c } } });
|
|
1087
|
-
}), o.push({ id:
|
|
1115
|
+
}), o.push({ id: O.id, params: { unitId: e, subUnitId: t, range: s } }), l.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } }), {
|
|
1088
1116
|
undos: l,
|
|
1089
1117
|
redos: o
|
|
1090
1118
|
};
|
|
@@ -1097,9 +1125,9 @@ let j = class extends B {
|
|
|
1097
1125
|
if (!s)
|
|
1098
1126
|
return this._handleNull();
|
|
1099
1127
|
const o = [], l = [], a = [], c = [];
|
|
1100
|
-
return n.getAllFilterColumns().forEach(([
|
|
1101
|
-
o.push({ id: p.id, params: { unitId: r, subUnitId: t, col:
|
|
1102
|
-
}), a.push({ id:
|
|
1128
|
+
return n.getAllFilterColumns().forEach(([u, d]) => {
|
|
1129
|
+
o.push({ id: p.id, params: { unitId: r, subUnitId: t, col: u, criteria: { ...d.serialize(), colId: u } } }), a.push({ id: p.id, params: { unitId: r, subUnitId: t, col: u, criteria: null } });
|
|
1130
|
+
}), a.push({ id: O.id, params: { unitId: r, subUnitId: t, range: s } }), o.unshift({ id: R.id, params: { range: s, unitId: r, subUnitId: t } }), {
|
|
1103
1131
|
undos: l,
|
|
1104
1132
|
redos: o,
|
|
1105
1133
|
preUndos: a,
|
|
@@ -1110,7 +1138,7 @@ let j = class extends B {
|
|
|
1110
1138
|
return { redos: [], undos: [] };
|
|
1111
1139
|
}
|
|
1112
1140
|
_initRowFilteredInterceptor() {
|
|
1113
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
1141
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(Qe.ROW_FILTERED, {
|
|
1114
1142
|
// sheet-interceptor.service.ts
|
|
1115
1143
|
handler: (r, e) => {
|
|
1116
1144
|
var t, n;
|
|
@@ -1129,35 +1157,35 @@ let j = class extends B {
|
|
|
1129
1157
|
col: -1
|
|
1130
1158
|
}, o = [], l = [], a = [], c = [];
|
|
1131
1159
|
return t.forEach((h) => {
|
|
1132
|
-
const [
|
|
1160
|
+
const [u, d] = h;
|
|
1133
1161
|
l.push({
|
|
1134
1162
|
id: p.id,
|
|
1135
1163
|
params: {
|
|
1136
1164
|
...s,
|
|
1137
|
-
col:
|
|
1165
|
+
col: u
|
|
1138
1166
|
}
|
|
1139
1167
|
}), o.push({
|
|
1140
1168
|
id: p.id,
|
|
1141
1169
|
params: {
|
|
1142
1170
|
...s,
|
|
1143
|
-
col:
|
|
1144
|
-
criteria: { ...
|
|
1171
|
+
col: u,
|
|
1172
|
+
criteria: { ...d.serialize(), colId: u }
|
|
1145
1173
|
}
|
|
1146
1174
|
});
|
|
1147
1175
|
}), t.forEach((h) => {
|
|
1148
|
-
const [
|
|
1176
|
+
const [u, d] = h;
|
|
1149
1177
|
c.push({
|
|
1150
1178
|
id: p.id,
|
|
1151
1179
|
params: {
|
|
1152
1180
|
...s,
|
|
1153
|
-
col:
|
|
1154
|
-
criteria: { ...
|
|
1181
|
+
col: u + n,
|
|
1182
|
+
criteria: { ...d.serialize(), colId: u + n }
|
|
1155
1183
|
}
|
|
1156
1184
|
}), a.push({
|
|
1157
1185
|
id: p.id,
|
|
1158
1186
|
params: {
|
|
1159
1187
|
...s,
|
|
1160
|
-
col:
|
|
1188
|
+
col: u + n,
|
|
1161
1189
|
criteria: null
|
|
1162
1190
|
}
|
|
1163
1191
|
});
|
|
@@ -1177,40 +1205,40 @@ let j = class extends B {
|
|
|
1177
1205
|
var c, h;
|
|
1178
1206
|
const { unitId: t, subUnitId: n } = r.params || {}, s = this._sheetsFilterService.getFilterModel(t, n);
|
|
1179
1207
|
if (!s) return;
|
|
1180
|
-
const o = Array.from(s.filteredOutRows).sort((
|
|
1208
|
+
const o = Array.from(s.filteredOutRows).sort((u, d) => u - d), l = [];
|
|
1181
1209
|
let a = !1;
|
|
1182
|
-
if (r.id ===
|
|
1183
|
-
const { startRow:
|
|
1210
|
+
if (r.id === Je.id) {
|
|
1211
|
+
const { startRow: u, endRow: d } = r.params.range, m = o.filter((g) => g >= u && g <= d);
|
|
1184
1212
|
o.forEach((g) => {
|
|
1185
|
-
if (g <
|
|
1213
|
+
if (g < u)
|
|
1186
1214
|
l.push(g);
|
|
1187
|
-
else if (a = !0, g <=
|
|
1188
|
-
const C = Math.max(
|
|
1215
|
+
else if (a = !0, g <= d) {
|
|
1216
|
+
const C = Math.max(u, l.length ? l[l.length - 1] + 1 : u);
|
|
1189
1217
|
l.push(C);
|
|
1190
1218
|
} else
|
|
1191
|
-
l.push(g - (
|
|
1219
|
+
l.push(g - (d - u + 1 - m.length));
|
|
1192
1220
|
});
|
|
1193
1221
|
}
|
|
1194
|
-
if (r.id ===
|
|
1195
|
-
const { startRow:
|
|
1196
|
-
o.forEach((
|
|
1197
|
-
|
|
1222
|
+
if (r.id === Ke.id) {
|
|
1223
|
+
const { startRow: u, endRow: d } = r.params.range;
|
|
1224
|
+
o.forEach((m) => {
|
|
1225
|
+
m >= u ? (a = !0, l.push(m + (d - u + 1))) : l.push(m);
|
|
1198
1226
|
});
|
|
1199
1227
|
}
|
|
1200
|
-
if (a && (s.filteredOutRows = new Set(l)), r.id ===
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1205
|
-
for (let
|
|
1206
|
-
const g = (c =
|
|
1228
|
+
if (a && (s.filteredOutRows = new Set(l)), r.id === Ye.id && !(e != null && e.onlyLocal)) {
|
|
1229
|
+
const u = this._getExtendRegion(t, n);
|
|
1230
|
+
if (u) {
|
|
1231
|
+
const d = r.params.cellValue;
|
|
1232
|
+
if (d)
|
|
1233
|
+
for (let m = u.startColumn; m <= u.endColumn; m++) {
|
|
1234
|
+
const g = (c = d == null ? void 0 : d[u.startRow]) == null ? void 0 : c[m];
|
|
1207
1235
|
if (g && this._cellHasValue(g)) {
|
|
1208
1236
|
const C = (h = this._univerInstanceService.getUnit(t)) == null ? void 0 : h.getSheetBySheetId(n);
|
|
1209
1237
|
if (C) {
|
|
1210
|
-
const
|
|
1238
|
+
const w = he(u, { down: !0 }, C), F = this._sheetsFilterService.getFilterModel(t, n), _ = F.getRange();
|
|
1211
1239
|
F.setRange({
|
|
1212
1240
|
..._,
|
|
1213
|
-
endRow:
|
|
1241
|
+
endRow: w.endRow
|
|
1214
1242
|
}), this._registerRefRange(t, n);
|
|
1215
1243
|
}
|
|
1216
1244
|
}
|
|
@@ -1243,12 +1271,12 @@ let j = class extends B {
|
|
|
1243
1271
|
}
|
|
1244
1272
|
_initErrorHandling() {
|
|
1245
1273
|
this.disposeWithMe(this._commandService.beforeCommandExecuted((r) => {
|
|
1246
|
-
const e = r.params, t =
|
|
1274
|
+
const e = r.params, t = H(this._univerInstanceService);
|
|
1247
1275
|
if (!t) return;
|
|
1248
1276
|
const { subUnitId: n, unitId: s } = t, o = this._sheetsFilterService.getFilterModel(s, n);
|
|
1249
1277
|
if (!o) return;
|
|
1250
1278
|
const l = o.getRange();
|
|
1251
|
-
if (r.id ===
|
|
1279
|
+
if (r.id === Xe.id && e.fromRange.startRow <= l.startRow && e.fromRange.endRow < l.endRow && e.fromRange.endRow >= l.startRow)
|
|
1252
1280
|
throw this._sheetsFilterService.setFilterErrorMsg("sheets-filter.msg.filter-header-forbidden"), new Error("[SheetsFilterController]: Cannot move header row of filter");
|
|
1253
1281
|
}));
|
|
1254
1282
|
}
|
|
@@ -1257,25 +1285,25 @@ let j = class extends B {
|
|
|
1257
1285
|
return !(e.length === 0 || e.every((t) => t == null));
|
|
1258
1286
|
}
|
|
1259
1287
|
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
],
|
|
1268
|
-
var
|
|
1269
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1288
|
+
k = zt([
|
|
1289
|
+
L(0, N),
|
|
1290
|
+
L(1, $(We)),
|
|
1291
|
+
L(2, $(M)),
|
|
1292
|
+
L(3, T),
|
|
1293
|
+
L(4, $(je)),
|
|
1294
|
+
L(5, Ue(ct))
|
|
1295
|
+
], k);
|
|
1296
|
+
var Vt = Object.getOwnPropertyDescriptor, Wt = (i, r, e, t) => {
|
|
1297
|
+
for (var n = t > 1 ? void 0 : t ? Vt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1270
1298
|
(o = i[s]) && (n = o(n) || n);
|
|
1271
1299
|
return n;
|
|
1272
|
-
},
|
|
1273
|
-
let
|
|
1300
|
+
}, z = (i, r) => (e, t) => r(e, t, i);
|
|
1301
|
+
let q = class extends B {
|
|
1274
1302
|
constructor(i, r, e, t) {
|
|
1275
1303
|
super(), this._activeDirtyManagerService = i, this._sheetRowFilteredService = r, this._sheetsFilterService = e, this._univerInstanceService = t, this._initFormulaDirtyRange(), this._registerSheetRowFiltered();
|
|
1276
1304
|
}
|
|
1277
1305
|
_initFormulaDirtyRange() {
|
|
1278
|
-
|
|
1306
|
+
Re.forEach((i) => {
|
|
1279
1307
|
this._activeDirtyManagerService.register(
|
|
1280
1308
|
i,
|
|
1281
1309
|
{
|
|
@@ -1319,68 +1347,69 @@ let k = class extends B {
|
|
|
1319
1347
|
});
|
|
1320
1348
|
}
|
|
1321
1349
|
};
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
],
|
|
1328
|
-
var
|
|
1329
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1350
|
+
q = Wt([
|
|
1351
|
+
z(0, $(ut)),
|
|
1352
|
+
z(1, $(dt)),
|
|
1353
|
+
z(2, $(M)),
|
|
1354
|
+
z(3, T)
|
|
1355
|
+
], q);
|
|
1356
|
+
var jt = Object.getOwnPropertyDescriptor, kt = (i, r, e, t) => {
|
|
1357
|
+
for (var n = t > 1 ? void 0 : t ? jt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1330
1358
|
(o = i[s]) && (n = o(n) || n);
|
|
1331
1359
|
return n;
|
|
1332
|
-
},
|
|
1333
|
-
let
|
|
1334
|
-
constructor(i =
|
|
1360
|
+
}, ue = (i, r) => (e, t) => r(e, t, i), V;
|
|
1361
|
+
let de = (V = class extends Pe {
|
|
1362
|
+
constructor(i = ce, r, e) {
|
|
1335
1363
|
super(), this._config = i, this._injector = r, this._configService = e;
|
|
1336
|
-
const { ...t } =
|
|
1364
|
+
const { ...t } = be(
|
|
1337
1365
|
{},
|
|
1338
|
-
|
|
1366
|
+
ce,
|
|
1339
1367
|
this._config
|
|
1340
1368
|
);
|
|
1341
|
-
this._configService.setConfig(
|
|
1369
|
+
this._configService.setConfig(Dt, t);
|
|
1342
1370
|
}
|
|
1343
1371
|
onStarting() {
|
|
1344
1372
|
[
|
|
1345
|
-
[
|
|
1373
|
+
[q],
|
|
1346
1374
|
[M],
|
|
1347
|
-
[
|
|
1375
|
+
[k]
|
|
1348
1376
|
].forEach((i) => this._injector.add(i));
|
|
1349
1377
|
}
|
|
1350
1378
|
onReady() {
|
|
1351
1379
|
De(this._injector, [
|
|
1352
|
-
[
|
|
1353
|
-
[
|
|
1380
|
+
[q],
|
|
1381
|
+
[k]
|
|
1354
1382
|
]);
|
|
1355
1383
|
}
|
|
1356
|
-
},
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
],
|
|
1384
|
+
}, S(V, "type", b.UNIVER_SHEET), S(V, "pluginName", we), V);
|
|
1385
|
+
de = kt([
|
|
1386
|
+
ue(1, $(Be)),
|
|
1387
|
+
ue(2, He)
|
|
1388
|
+
], de);
|
|
1361
1389
|
export {
|
|
1362
|
-
|
|
1390
|
+
tr as ClearSheetsFilterCriteriaCommand,
|
|
1363
1391
|
x as CustomFilterOperator,
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1392
|
+
Re as FILTER_MUTATIONS,
|
|
1393
|
+
I as FilterBy,
|
|
1394
|
+
St as FilterColumn,
|
|
1395
|
+
j as FilterModel,
|
|
1396
|
+
rr as ReCalcSheetsFilterCommand,
|
|
1368
1397
|
W as ReCalcSheetsFilterMutation,
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1398
|
+
Ut as RemoveSheetFilterCommand,
|
|
1399
|
+
O as RemoveSheetsFilterMutation,
|
|
1400
|
+
we as SHEET_FILTER_SNAPSHOT_ID,
|
|
1401
|
+
$t as SetSheetFilterRangeCommand,
|
|
1402
|
+
er as SetSheetsFilterCriteriaCommand,
|
|
1374
1403
|
p as SetSheetsFilterCriteriaMutation,
|
|
1375
1404
|
R as SetSheetsFilterRangeMutation,
|
|
1376
1405
|
M as SheetsFilterService,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1406
|
+
Zt as SmartToggleSheetsFilterCommand,
|
|
1407
|
+
de as UniverSheetsFilterPlugin,
|
|
1408
|
+
_t as equals,
|
|
1409
|
+
oe as getCustomFilterFn,
|
|
1410
|
+
ht as greaterThan,
|
|
1411
|
+
ft as greaterThanOrEqualTo,
|
|
1412
|
+
mt as lessThan,
|
|
1413
|
+
gt as lessThanOrEqualTo,
|
|
1414
|
+
Ce as notEquals
|
|
1386
1415
|
};
|