@univerjs/sheets-filter 0.6.6-nightly.202503161606 → 0.6.6-nightly.202503181607
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,30 +1,31 @@
|
|
|
1
1
|
var ve = Object.defineProperty;
|
|
2
2
|
var Me = (i, r, e) => r in i ? ve(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
3
|
var w = (i, r, e) => Me(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { isNumeric as Ee, Disposable as B, Rectangle as K, mergeSets as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { isNumeric as Ee, Disposable as B, Rectangle as K, mergeSets as G, Tools as te, extractPureTextFromCell as ye, CellValueType as X, UniverInstanceType as D, fromCallback as Oe, CommandType as E, IResourceManagerService as Ae, IUniverInstanceService as T, ICommandService as N, Inject as I, Optional as Te, DisposableCollection as Ne, moveMatrixArray as re, Plugin as xe, merge as Ie, touchDependencies as $e, Injector as Pe, IConfigService as Ue, IUndoRedoService as q, sequenceExecute as De, ErrorService as Le, LocaleService as Be } from "@univerjs/core";
|
|
5
|
+
import { DataSyncPrimaryController as be } from "@univerjs/rpc";
|
|
6
|
+
import { SheetInterceptorService as He, RefRangeService as ze, SetWorksheetActiveOperation as We, CopySheetCommand as Ve, RemoveSheetCommand as je, INTERCEPTOR_POINT as ke, RemoveRowMutation as qe, InsertRowMutation as Qe, SetRangeValuesMutation as Ge, expandToContinuousRange as de, getSheetCommandTarget as b, MoveRowsCommand as Je, MoveRangeCommand as Ye, EffectRefRangId as ne, RemoveRowCommand as Ke, RemoveColCommand as Xe, InsertColCommand as Ze, InsertRowCommand as et, SheetsSelectionsService as tt, isSingleCellSelection as rt } from "@univerjs/sheets";
|
|
7
|
+
import { BehaviorSubject as L, merge as nt, filter as it, switchMap as st, of as ot } from "rxjs";
|
|
8
|
+
import { IActiveDirtyManagerService as lt, ISheetRowFilteredService as at } from "@univerjs/engine-formula";
|
|
9
|
+
const ct = "sheets-filter.config", ie = {}, ue = "sheet.mutation.set-filter-range", he = "sheet.mutation.set-filter-criteria", me = "sheet.mutation.remove-filter", fe = "sheet.mutation.re-calc-filter", ge = /* @__PURE__ */ new Set([
|
|
10
|
+
ue,
|
|
10
11
|
he,
|
|
11
12
|
me,
|
|
12
13
|
fe
|
|
13
14
|
]);
|
|
14
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 || {});
|
|
15
|
-
const
|
|
16
|
+
const dt = {
|
|
16
17
|
operator: x.GREATER_THAN,
|
|
17
18
|
fn: (i, r) => U(i) ? i > r : !1
|
|
18
|
-
},
|
|
19
|
+
}, ut = {
|
|
19
20
|
operator: x.GREATER_THAN_OR_EQUAL,
|
|
20
21
|
fn: (i, r) => U(i) ? i >= r : !1
|
|
21
|
-
},
|
|
22
|
+
}, ht = {
|
|
22
23
|
operator: x.LESS_THAN,
|
|
23
24
|
fn: (i, r) => U(i) ? i < r : !1
|
|
24
|
-
},
|
|
25
|
+
}, mt = {
|
|
25
26
|
operator: x.LESS_THAN_OR_EQUAL,
|
|
26
27
|
fn: (i, r) => U(i) ? i <= r : !1
|
|
27
|
-
},
|
|
28
|
+
}, ft = {
|
|
28
29
|
operator: x.EQUAL,
|
|
29
30
|
fn: (i, r) => U(i) ? i === r : !1
|
|
30
31
|
}, _e = {
|
|
@@ -34,25 +35,25 @@ const lt = {
|
|
|
34
35
|
if (r === " ")
|
|
35
36
|
return i != null;
|
|
36
37
|
const e = Ce(i);
|
|
37
|
-
return e &&
|
|
38
|
+
return e && Ct(r) ? !pe(r).test(e) : e !== r;
|
|
38
39
|
}
|
|
39
40
|
return U(i) ? i !== r : !0;
|
|
40
41
|
}
|
|
41
|
-
}, Re = /* @__PURE__ */ new Map([]),
|
|
42
|
-
|
|
42
|
+
}, Re = /* @__PURE__ */ new Map([]), gt = [dt, ut, ht, mt, ft, _e];
|
|
43
|
+
gt.forEach((i) => {
|
|
43
44
|
Re.set(i.operator, i);
|
|
44
45
|
});
|
|
45
|
-
function
|
|
46
|
+
function _t(i) {
|
|
46
47
|
return !!i;
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const Rt = {
|
|
49
50
|
fn: (i, r) => {
|
|
50
51
|
const e = Ce(i);
|
|
51
52
|
return e === null ? r === "" : pe(r).test(e);
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
function se(i) {
|
|
55
|
-
return i ? Re.get(i) :
|
|
56
|
+
return i ? Re.get(i) : Rt;
|
|
56
57
|
}
|
|
57
58
|
function U(i) {
|
|
58
59
|
return typeof i == "number";
|
|
@@ -63,25 +64,25 @@ function oe(i) {
|
|
|
63
64
|
function Ce(i) {
|
|
64
65
|
return typeof i == "boolean" || i == null ? null : typeof i == "string" ? i : i.toString();
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function Ct(i) {
|
|
67
68
|
return typeof i == "number" ? !1 : i.indexOf("*") !== -1 || i.indexOf("?") !== -1;
|
|
68
69
|
}
|
|
69
70
|
function pe(i) {
|
|
70
71
|
const r = i.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("?", ".").replace(/[*]/g, ".$&");
|
|
71
72
|
return new RegExp(`^${r}$`);
|
|
72
73
|
}
|
|
73
|
-
const
|
|
74
|
-
class
|
|
74
|
+
const J = () => /* @__PURE__ */ new Set();
|
|
75
|
+
class V extends B {
|
|
75
76
|
constructor(e, t, n) {
|
|
76
77
|
super();
|
|
77
|
-
w(this, "_filteredOutRows$", new L(
|
|
78
|
+
w(this, "_filteredOutRows$", new L(J()));
|
|
78
79
|
/** An observable value. A set of filtered out rows. */
|
|
79
80
|
w(this, "filteredOutRows$", this._filteredOutRows$.asObservable());
|
|
80
81
|
// TODO: we may need to update which cols have criteria rather than simple boolean
|
|
81
82
|
w(this, "_hasCriteria$", new L(!1));
|
|
82
83
|
w(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
83
84
|
w(this, "_filterColumnByIndex", /* @__PURE__ */ new Map());
|
|
84
|
-
w(this, "_alreadyFilteredOutRows",
|
|
85
|
+
w(this, "_alreadyFilteredOutRows", J());
|
|
85
86
|
w(this, "_range");
|
|
86
87
|
this.unitId = e, this.subUnitId = t, this._worksheet = n;
|
|
87
88
|
}
|
|
@@ -112,7 +113,7 @@ class W extends B {
|
|
|
112
113
|
* @param autoFilter auto filter data
|
|
113
114
|
*/
|
|
114
115
|
static deserialize(e, t, n, s) {
|
|
115
|
-
const o = new
|
|
116
|
+
const o = new V(e, t, n);
|
|
116
117
|
return o._dump(s), o;
|
|
117
118
|
}
|
|
118
119
|
_dump(e) {
|
|
@@ -135,7 +136,7 @@ class W extends B {
|
|
|
135
136
|
getFilteredOutRowsExceptCol(e) {
|
|
136
137
|
return this._getAllFilterColumns(!0).filter(([t]) => t !== e).reduce((t, [, n]) => {
|
|
137
138
|
const s = n.calc({ getAlreadyFilteredOutRows: () => t });
|
|
138
|
-
return s ?
|
|
139
|
+
return s ? G(t, s) : t;
|
|
139
140
|
}, /* @__PURE__ */ new Set());
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
@@ -179,7 +180,7 @@ class W extends B {
|
|
|
179
180
|
return e ? t : t.map(([n, s]) => s);
|
|
180
181
|
}
|
|
181
182
|
_reCalcAllColumns() {
|
|
182
|
-
this._alreadyFilteredOutRows =
|
|
183
|
+
this._alreadyFilteredOutRows = J(), this._getAllFilterColumns().forEach((e) => e.__clearCache()), this._reCalcWithNoCacheColumns();
|
|
183
184
|
}
|
|
184
185
|
_setCriteriaWithoutReCalc(e, t) {
|
|
185
186
|
const n = this._range;
|
|
@@ -189,7 +190,7 @@ class W extends B {
|
|
|
189
190
|
if (e > o || e < s)
|
|
190
191
|
throw new Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);
|
|
191
192
|
let l;
|
|
192
|
-
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new
|
|
193
|
+
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new pt(
|
|
193
194
|
this.unitId,
|
|
194
195
|
this.subUnitId,
|
|
195
196
|
this._worksheet,
|
|
@@ -208,18 +209,18 @@ class W extends B {
|
|
|
208
209
|
this._hasCriteria$.next(this._filterColumnByIndex.size > 0);
|
|
209
210
|
}
|
|
210
211
|
_rebuildAlreadyFilteredOutRowsWithCache() {
|
|
211
|
-
const e = this._getAllFilterColumns().filter((t) => t.hasCache()).reduce((t, n) =>
|
|
212
|
+
const e = this._getAllFilterColumns().filter((t) => t.hasCache()).reduce((t, n) => G(t, n.filteredOutRows), /* @__PURE__ */ new Set());
|
|
212
213
|
this._alreadyFilteredOutRows = e;
|
|
213
214
|
}
|
|
214
215
|
_reCalcWithNoCacheColumns() {
|
|
215
216
|
const e = this._getAllFilterColumns().filter((t) => !t.hasCache());
|
|
216
217
|
for (const t of e) {
|
|
217
218
|
const n = t.reCalc();
|
|
218
|
-
n && (this._alreadyFilteredOutRows =
|
|
219
|
+
n && (this._alreadyFilteredOutRows = G(this._alreadyFilteredOutRows, n));
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
class
|
|
223
|
+
class pt extends B {
|
|
223
224
|
constructor(e, t, n, s, o) {
|
|
224
225
|
super();
|
|
225
226
|
w(this, "_filteredOutRows", null);
|
|
@@ -284,48 +285,48 @@ class _t extends B {
|
|
|
284
285
|
const { row: a, rowSpan: c, col: h } = l;
|
|
285
286
|
if (o.has(a) && (!c || c === 1))
|
|
286
287
|
continue;
|
|
287
|
-
const
|
|
288
|
-
if (!this._filterFn(
|
|
289
|
-
for (let
|
|
290
|
-
s.add(a +
|
|
288
|
+
const d = this._filterByValues ? ye(this._worksheet.getCell(a, h)) : Ot(this._worksheet, a, h);
|
|
289
|
+
if (!this._filterFn(d) && (s.add(a), c))
|
|
290
|
+
for (let u = 1; u < c; u++)
|
|
291
|
+
s.add(a + u);
|
|
291
292
|
}
|
|
292
293
|
return s;
|
|
293
294
|
}
|
|
294
295
|
_generateFilterFn() {
|
|
295
|
-
this._criteria && (this._filterFn =
|
|
296
|
+
this._criteria && (this._filterFn = Ft(this._criteria), this._filterByValues = !!this._criteria.filters);
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
|
-
function
|
|
299
|
+
function Ft(i) {
|
|
299
300
|
if (i.filters)
|
|
300
|
-
return
|
|
301
|
+
return wt(i.filters);
|
|
301
302
|
if (i.customFilters)
|
|
302
|
-
return
|
|
303
|
+
return St(i.customFilters);
|
|
303
304
|
throw new Error("[FilterModel]: other types of filters are not supported yet.");
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
+
function wt(i) {
|
|
306
307
|
const r = !!i.blank, e = new Set(i.filters);
|
|
307
308
|
return (t) => t === void 0 || t === "" ? r : e.has(typeof t == "string" ? t : `${t}`);
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
-
const r = i.customFilters.map((e) =>
|
|
311
|
-
return
|
|
310
|
+
function St(i) {
|
|
311
|
+
const r = i.customFilters.map((e) => yt(e));
|
|
312
|
+
return Et(r) ? i.and ? vt(r) : Mt(r) : r[0];
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
+
function vt(i) {
|
|
314
315
|
const [r, e] = i;
|
|
315
316
|
return (t) => r(t) && e(t);
|
|
316
317
|
}
|
|
317
|
-
function
|
|
318
|
+
function Mt(i) {
|
|
318
319
|
const [r, e] = i;
|
|
319
320
|
return (t) => r(t) || e(t);
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
+
function Et(i) {
|
|
322
323
|
return i.length === 2;
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function yt(i) {
|
|
325
326
|
const r = i.val;
|
|
326
327
|
if (i.operator === x.NOT_EQUALS && !oe(r))
|
|
327
328
|
return (n) => _e.fn(n, r);
|
|
328
|
-
if (
|
|
329
|
+
if (_t(i.operator)) {
|
|
329
330
|
if (!oe(r)) return () => !1;
|
|
330
331
|
const n = se(i.operator), s = Number(r);
|
|
331
332
|
return (o) => n.fn(o, s);
|
|
@@ -333,7 +334,7 @@ function vt(i) {
|
|
|
333
334
|
const e = se(i.operator);
|
|
334
335
|
return (t) => e.fn(t, r);
|
|
335
336
|
}
|
|
336
|
-
function
|
|
337
|
+
function Ot(i, r, e) {
|
|
337
338
|
const t = i.getCell(r, e);
|
|
338
339
|
if (!t) return null;
|
|
339
340
|
const n = i.getCellRaw(r, e);
|
|
@@ -346,11 +347,11 @@ function le(i) {
|
|
|
346
347
|
const e = i.v;
|
|
347
348
|
return typeof e == "string" ? i.t === X.BOOLEAN ? e.toUpperCase() : e : typeof e == "number" ? i.t === X.BOOLEAN ? e ? "TRUE" : "FALSE" : e : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : "";
|
|
348
349
|
}
|
|
349
|
-
var
|
|
350
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
350
|
+
var At = Object.getOwnPropertyDescriptor, Tt = (i, r, e, t) => {
|
|
351
|
+
for (var n = t > 1 ? void 0 : t ? At(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
351
352
|
(o = i[s]) && (n = o(n) || n);
|
|
352
353
|
return n;
|
|
353
|
-
},
|
|
354
|
+
}, Y = (i, r) => (e, t) => r(e, t, i);
|
|
354
355
|
const Fe = "SHEET_FILTER_PLUGIN";
|
|
355
356
|
let M = class extends B {
|
|
356
357
|
constructor(r, e, t) {
|
|
@@ -384,7 +385,7 @@ let M = class extends B {
|
|
|
384
385
|
const s = n.getSheetBySheetId(e);
|
|
385
386
|
if (!s)
|
|
386
387
|
throw new Error(`[SheetsFilterService]: could not create "FilterModel" on a non-existing worksheet ${e}!`);
|
|
387
|
-
const o = new
|
|
388
|
+
const o = new V(r, e, s);
|
|
388
389
|
return this._cacheFilterModel(r, e, o), o;
|
|
389
390
|
}
|
|
390
391
|
getFilterModel(r, e) {
|
|
@@ -419,13 +420,13 @@ let M = class extends B {
|
|
|
419
420
|
}
|
|
420
421
|
_initActiveFilterModel() {
|
|
421
422
|
this.disposeWithMe(
|
|
422
|
-
|
|
423
|
+
nt(
|
|
423
424
|
// source1: executing filter related mutations
|
|
424
|
-
Oe(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
|
|
425
|
+
Oe(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(it(([r]) => r.type === E.MUTATION && ge.has(r.id))),
|
|
425
426
|
// source2: activate sheet changes
|
|
426
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(D.UNIVER_SHEET).pipe(
|
|
427
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(D.UNIVER_SHEET).pipe(st((r) => {
|
|
427
428
|
var e;
|
|
428
|
-
return (e = r == null ? void 0 : r.activeSheet$) != null ? e :
|
|
429
|
+
return (e = r == null ? void 0 : r.activeSheet$) != null ? e : ot(null);
|
|
429
430
|
}))
|
|
430
431
|
).subscribe(() => this._updateActiveFilterModel())
|
|
431
432
|
);
|
|
@@ -442,7 +443,7 @@ let M = class extends B {
|
|
|
442
443
|
_deserializeAutoFiltersForUnit(r, e) {
|
|
443
444
|
const t = this._univerInstanceService.getUniverSheetInstance(r);
|
|
444
445
|
Object.keys(e).forEach((n) => {
|
|
445
|
-
const s = e[n], o =
|
|
446
|
+
const s = e[n], o = V.deserialize(r, n, t.getSheetBySheetId(n), s);
|
|
446
447
|
this._cacheFilterModel(r, n, o);
|
|
447
448
|
});
|
|
448
449
|
}
|
|
@@ -465,13 +466,13 @@ let M = class extends B {
|
|
|
465
466
|
this._filterModels.has(r) || this._filterModels.set(r, /* @__PURE__ */ new Map()), this._filterModels.get(r).set(e, t);
|
|
466
467
|
}
|
|
467
468
|
};
|
|
468
|
-
M =
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
M = Tt([
|
|
470
|
+
Y(0, Ae),
|
|
471
|
+
Y(1, T),
|
|
472
|
+
Y(2, N)
|
|
472
473
|
], M);
|
|
473
474
|
const R = {
|
|
474
|
-
id:
|
|
475
|
+
id: ue,
|
|
475
476
|
type: E.MUTATION,
|
|
476
477
|
handler: (i, r) => {
|
|
477
478
|
const { subUnitId: e, unitId: t, range: n } = r;
|
|
@@ -491,7 +492,7 @@ const R = {
|
|
|
491
492
|
const { unitId: e, subUnitId: t } = r;
|
|
492
493
|
return i.get(M).removeFilterModel(e, t);
|
|
493
494
|
}
|
|
494
|
-
},
|
|
495
|
+
}, W = {
|
|
495
496
|
id: fe,
|
|
496
497
|
type: E.MUTATION,
|
|
497
498
|
handler: (i, r) => {
|
|
@@ -499,7 +500,7 @@ const R = {
|
|
|
499
500
|
return s ? (s.reCalc(), !0) : !1;
|
|
500
501
|
}
|
|
501
502
|
};
|
|
502
|
-
function
|
|
503
|
+
function Nt(i, r) {
|
|
503
504
|
for (let e = 0; e < i.length; e++) {
|
|
504
505
|
let t = e;
|
|
505
506
|
if (i[e])
|
|
@@ -508,33 +509,36 @@ function Ot(i, r) {
|
|
|
508
509
|
}
|
|
509
510
|
return i.filter((e) => e !== null);
|
|
510
511
|
}
|
|
511
|
-
function
|
|
512
|
-
return
|
|
512
|
+
function $(i) {
|
|
513
|
+
return Nt(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);
|
|
513
514
|
}
|
|
514
|
-
var
|
|
515
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
515
|
+
var xt = Object.getOwnPropertyDescriptor, It = (i, r, e, t) => {
|
|
516
|
+
for (var n = t > 1 ? void 0 : t ? xt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
516
517
|
(o = i[s]) && (n = o(n) || n);
|
|
517
518
|
return n;
|
|
518
519
|
}, P = (i, r) => (e, t) => r(e, t, i);
|
|
519
|
-
let
|
|
520
|
-
constructor(r, e, t, n, s) {
|
|
520
|
+
let j = class extends B {
|
|
521
|
+
constructor(r, e, t, n, s, o) {
|
|
521
522
|
super();
|
|
522
|
-
w(this, "_disposableCollection", new
|
|
523
|
-
this._commandService = r, this._sheetInterceptorService = e, this._sheetsFilterService = t, this._univerInstanceService = n, this._refRangeService = s, this._initCommands(), this._initRowFilteredInterceptor(), this._initInterceptors(), this._commandExecutedListener(), this._initErrorHandling();
|
|
523
|
+
w(this, "_disposableCollection", new Ne());
|
|
524
|
+
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();
|
|
524
525
|
}
|
|
525
526
|
_initCommands() {
|
|
526
527
|
[
|
|
527
528
|
p,
|
|
528
529
|
R,
|
|
529
|
-
|
|
530
|
+
W,
|
|
530
531
|
y
|
|
531
|
-
].forEach((r) =>
|
|
532
|
+
].forEach((r) => {
|
|
533
|
+
var e;
|
|
534
|
+
this.disposeWithMe(this._commandService.registerCommand(r)), (e = this._dataSyncPrimaryController) == null || e.registerSyncingMutations(r);
|
|
535
|
+
});
|
|
532
536
|
}
|
|
533
537
|
_initInterceptors() {
|
|
534
538
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
535
539
|
getMutations: (r) => this._getUpdateFilter(r)
|
|
536
540
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((r) => {
|
|
537
|
-
if (r.id ===
|
|
541
|
+
if (r.id === We.id) {
|
|
538
542
|
const e = r.params, t = e.subUnitId, n = e.unitId;
|
|
539
543
|
if (!t || !n)
|
|
540
544
|
return;
|
|
@@ -560,19 +564,19 @@ let V = class extends B {
|
|
|
560
564
|
if (!t || !n) return;
|
|
561
565
|
const s = (l = this._sheetsFilterService.getFilterModel(r, e)) == null ? void 0 : l.getRange(), o = (a) => {
|
|
562
566
|
switch (a.id) {
|
|
563
|
-
case
|
|
564
|
-
const c = a.params, h = c.unitId || r,
|
|
565
|
-
return this._handleInsertRowCommand(c, h,
|
|
567
|
+
case et.id: {
|
|
568
|
+
const c = a.params, h = c.unitId || r, d = c.subUnitId || e;
|
|
569
|
+
return this._handleInsertRowCommand(c, h, d);
|
|
566
570
|
}
|
|
567
|
-
case
|
|
568
|
-
const c = a.params, h = c.unitId || r,
|
|
569
|
-
return this._handleInsertColCommand(c, h,
|
|
571
|
+
case Ze.id: {
|
|
572
|
+
const c = a.params, h = c.unitId || r, d = c.subUnitId || e;
|
|
573
|
+
return this._handleInsertColCommand(c, h, d);
|
|
570
574
|
}
|
|
571
|
-
case
|
|
575
|
+
case Xe.id: {
|
|
572
576
|
const c = a.params;
|
|
573
577
|
return this._handleRemoveColCommand(c, r, e);
|
|
574
578
|
}
|
|
575
|
-
case
|
|
579
|
+
case Ke.id: {
|
|
576
580
|
const c = a.params;
|
|
577
581
|
return this._handleRemoveRowCommand(c, r, e);
|
|
578
582
|
}
|
|
@@ -584,7 +588,7 @@ let V = class extends B {
|
|
|
584
588
|
const c = a.params;
|
|
585
589
|
return this._handleMoveRowsCommand(c, r, e);
|
|
586
590
|
}
|
|
587
|
-
case
|
|
591
|
+
case Ye.id: {
|
|
588
592
|
const c = a.params;
|
|
589
593
|
return this._handleMoveRangeCommand(c, r, e);
|
|
590
594
|
}
|
|
@@ -596,11 +600,11 @@ let V = class extends B {
|
|
|
596
600
|
_getUpdateFilter(r) {
|
|
597
601
|
const { id: e } = r;
|
|
598
602
|
switch (e) {
|
|
599
|
-
case
|
|
603
|
+
case je.id: {
|
|
600
604
|
const t = r.params;
|
|
601
605
|
return this._handleRemoveSheetCommand(t, t.unitId, t.subUnitId);
|
|
602
606
|
}
|
|
603
|
-
case
|
|
607
|
+
case Ve.id: {
|
|
604
608
|
const t = r.params, { targetSubUnitId: n, unitId: s, subUnitId: o } = t;
|
|
605
609
|
return !s || !o || !n ? this._handleNull() : this._handleCopySheetCommand(s, o, n);
|
|
606
610
|
}
|
|
@@ -618,7 +622,7 @@ let V = class extends B {
|
|
|
618
622
|
const { startColumn: o, endColumn: l } = s, { startColumn: a, endColumn: c } = r.range, h = c - a + 1;
|
|
619
623
|
if (c > l)
|
|
620
624
|
return this._handleNull();
|
|
621
|
-
const
|
|
625
|
+
const d = [], u = [], f = a, g = {
|
|
622
626
|
unitId: e,
|
|
623
627
|
subUnitId: t,
|
|
624
628
|
range: {
|
|
@@ -631,13 +635,13 @@ let V = class extends B {
|
|
|
631
635
|
subUnitId: t,
|
|
632
636
|
range: s
|
|
633
637
|
};
|
|
634
|
-
|
|
638
|
+
d.push({ id: R.id, params: g }), u.push({ id: R.id, params: C });
|
|
635
639
|
const F = n.getAllFilterColumns().filter((m) => m[0] >= f);
|
|
636
640
|
if (F.length !== 0) {
|
|
637
641
|
const { newRange: m, oldRange: v } = this._moveCriteria(e, t, F, h);
|
|
638
|
-
|
|
642
|
+
d.push(...m.redos, ...v.redos), u.push(...m.undos, ...v.undos);
|
|
639
643
|
}
|
|
640
|
-
return { redos:
|
|
644
|
+
return { redos: $(d), undos: $(u) };
|
|
641
645
|
}
|
|
642
646
|
_handleInsertRowCommand(r, e, t) {
|
|
643
647
|
var C;
|
|
@@ -647,7 +651,7 @@ let V = class extends B {
|
|
|
647
651
|
const { startRow: o, endRow: l } = s, { startRow: a, endRow: c } = r.range, h = c - a + 1;
|
|
648
652
|
if (c > l)
|
|
649
653
|
return this._handleNull();
|
|
650
|
-
const
|
|
654
|
+
const d = [], u = [], f = {
|
|
651
655
|
unitId: e,
|
|
652
656
|
subUnitId: t,
|
|
653
657
|
range: {
|
|
@@ -660,9 +664,9 @@ let V = class extends B {
|
|
|
660
664
|
subUnitId: t,
|
|
661
665
|
range: s
|
|
662
666
|
};
|
|
663
|
-
return
|
|
664
|
-
redos:
|
|
665
|
-
undos:
|
|
667
|
+
return d.push({ id: R.id, params: f }), u.push({ id: R.id, params: g }), {
|
|
668
|
+
redos: $(d),
|
|
669
|
+
undos: $(u)
|
|
666
670
|
};
|
|
667
671
|
}
|
|
668
672
|
_handleRemoveColCommand(r, e, t) {
|
|
@@ -673,10 +677,10 @@ let V = class extends B {
|
|
|
673
677
|
const { startColumn: o, endColumn: l } = s, { startColumn: a, endColumn: c } = r.range;
|
|
674
678
|
if (a > l)
|
|
675
679
|
return this._handleNull();
|
|
676
|
-
const h = [],
|
|
680
|
+
const h = [], d = [], u = c < o ? 0 : Math.min(c, l) - Math.max(a, o) + 1, f = c - a + 1, g = n.getAllFilterColumns();
|
|
677
681
|
g.forEach((_) => {
|
|
678
682
|
const [m, v] = _;
|
|
679
|
-
m <= c && m >= a && (h.push({ id: p.id, params: { unitId: e, subUnitId: t, col: m, criteria: null } }),
|
|
683
|
+
m <= c && m >= a && (h.push({ id: p.id, params: { unitId: e, subUnitId: t, col: m, criteria: null } }), d.push({ id: p.id, params: { unitId: e, subUnitId: t, col: m, criteria: { ...v.serialize(), colId: m } } }));
|
|
680
684
|
});
|
|
681
685
|
const C = g.filter((_) => {
|
|
682
686
|
const [m, v] = _;
|
|
@@ -685,24 +689,24 @@ let V = class extends B {
|
|
|
685
689
|
let S = { undos: [], redos: [] };
|
|
686
690
|
if (C.length > 0) {
|
|
687
691
|
const { oldRange: _, newRange: m } = this._moveCriteria(e, t, C, -f);
|
|
688
|
-
S = m, h.push(..._.redos),
|
|
692
|
+
S = m, h.push(..._.redos), d.unshift(..._.undos);
|
|
689
693
|
}
|
|
690
|
-
if (
|
|
694
|
+
if (u === l - o + 1) {
|
|
691
695
|
const _ = {
|
|
692
696
|
unitId: e,
|
|
693
697
|
subUnitId: t
|
|
694
698
|
};
|
|
695
|
-
h.push({ id: y.id, params: _ }),
|
|
699
|
+
h.push({ id: y.id, params: _ }), d.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
696
700
|
} else {
|
|
697
|
-
const _ = o <= a ? o :
|
|
701
|
+
const _ = o <= a ? o : u === 0 ? o - f : a, m = o <= a ? l - u : l - f, v = {
|
|
698
702
|
unitId: e,
|
|
699
703
|
subUnitId: t,
|
|
700
704
|
range: { ...s, startColumn: _, endColumn: m }
|
|
701
705
|
};
|
|
702
|
-
h.push({ id: R.id, params: v }),
|
|
706
|
+
h.push({ id: R.id, params: v }), d.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } }), h.push(...S.redos), d.unshift(...S.undos);
|
|
703
707
|
}
|
|
704
708
|
return {
|
|
705
|
-
undos:
|
|
709
|
+
undos: d,
|
|
706
710
|
redos: h
|
|
707
711
|
};
|
|
708
712
|
}
|
|
@@ -730,22 +734,22 @@ let V = class extends B {
|
|
|
730
734
|
}
|
|
731
735
|
}]
|
|
732
736
|
};
|
|
733
|
-
const h = [],
|
|
734
|
-
|
|
737
|
+
const h = [], d = [], u = n.getAllFilterColumns(), f = o <= c && o >= a;
|
|
738
|
+
d.push({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
735
739
|
const g = Math.min(c, l) - Math.max(a, o) + 1;
|
|
736
740
|
if (g === l - o + 1 || f) {
|
|
737
741
|
const S = {
|
|
738
742
|
unitId: e,
|
|
739
743
|
subUnitId: t
|
|
740
744
|
};
|
|
741
|
-
h.push({ id: y.id, params: S }),
|
|
745
|
+
h.push({ id: y.id, params: S }), u.forEach((F) => {
|
|
742
746
|
const [_, m] = F, v = {
|
|
743
747
|
unitId: e,
|
|
744
748
|
subUnitId: t,
|
|
745
749
|
col: _,
|
|
746
750
|
criteria: { ...m.serialize(), colId: _ }
|
|
747
751
|
};
|
|
748
|
-
|
|
752
|
+
d.push({ id: p.id, params: v });
|
|
749
753
|
});
|
|
750
754
|
} else {
|
|
751
755
|
const S = (C = this._univerInstanceService.getUniverSheetInstance(e)) == null ? void 0 : C.getSheetBySheetId(t);
|
|
@@ -766,8 +770,8 @@ let V = class extends B {
|
|
|
766
770
|
h.push({ id: R.id, params: v });
|
|
767
771
|
}
|
|
768
772
|
return {
|
|
769
|
-
undos:
|
|
770
|
-
redos:
|
|
773
|
+
undos: $(d),
|
|
774
|
+
redos: $(h)
|
|
771
775
|
};
|
|
772
776
|
}
|
|
773
777
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -779,22 +783,22 @@ let V = class extends B {
|
|
|
779
783
|
const { startColumn: o, endColumn: l } = s, { fromRange: a, toRange: c } = r;
|
|
780
784
|
if (a.endColumn < o && c.startColumn <= o || a.startColumn > l && c.endColumn > l)
|
|
781
785
|
return this._handleNull();
|
|
782
|
-
const h = [],
|
|
786
|
+
const h = [], d = [], u = {};
|
|
783
787
|
for (let m = o; m <= l; m++)
|
|
784
|
-
|
|
788
|
+
u[m] = {
|
|
785
789
|
colIndex: m,
|
|
786
790
|
filter: n.getFilterColumn(m)
|
|
787
791
|
};
|
|
788
|
-
re(a.startColumn, a.endColumn - a.startColumn + 1, c.startColumn,
|
|
792
|
+
re(a.startColumn, a.endColumn - a.startColumn + 1, c.startColumn, u);
|
|
789
793
|
let f = s.startColumn, g = s.endColumn;
|
|
790
794
|
o >= a.startColumn && o <= a.endColumn && c.startColumn > a.startColumn && a.endColumn < l && (f = a.endColumn + 1), l >= a.startColumn && l <= a.endColumn && c.startColumn < a.startColumn && a.startColumn > o && (g = a.startColumn - 1);
|
|
791
|
-
const C = Object.keys(
|
|
795
|
+
const C = Object.keys(u).map((m) => Number(m)), S = C.find((m) => u[m].colIndex === g), F = C.find((m) => u[m].colIndex === f);
|
|
792
796
|
if (C.forEach((m) => {
|
|
793
797
|
var Z, ee;
|
|
794
|
-
const { colIndex: v, filter: O } =
|
|
798
|
+
const { colIndex: v, filter: O } = u[m], A = m;
|
|
795
799
|
if (O) {
|
|
796
800
|
if (A >= F && A <= S) {
|
|
797
|
-
const
|
|
801
|
+
const Q = {
|
|
798
802
|
unitId: e,
|
|
799
803
|
subUnitId: t,
|
|
800
804
|
col: A,
|
|
@@ -805,16 +809,16 @@ let V = class extends B {
|
|
|
805
809
|
col: A,
|
|
806
810
|
criteria: n.getFilterColumn(A) ? { ...(Z = n.getFilterColumn(A)) == null ? void 0 : Z.serialize(), colId: A } : null
|
|
807
811
|
};
|
|
808
|
-
h.push({ id: p.id, params:
|
|
812
|
+
h.push({ id: p.id, params: Q }), d.push({ id: p.id, params: Se });
|
|
809
813
|
}
|
|
810
|
-
if (!((ee =
|
|
811
|
-
const
|
|
814
|
+
if (!((ee = u[v]) != null && ee.filter)) {
|
|
815
|
+
const Q = {
|
|
812
816
|
unitId: e,
|
|
813
817
|
subUnitId: t,
|
|
814
818
|
col: v,
|
|
815
819
|
criteria: null
|
|
816
820
|
};
|
|
817
|
-
h.push({ id: p.id, params:
|
|
821
|
+
h.push({ id: p.id, params: Q }), d.push({ id: p.id, params: { unitId: e, subUnitId: t, col: v, criteria: { ...O.serialize(), colId: v } } });
|
|
818
822
|
}
|
|
819
823
|
}
|
|
820
824
|
}), o !== F || l !== S) {
|
|
@@ -827,10 +831,10 @@ let V = class extends B {
|
|
|
827
831
|
endColumn: S
|
|
828
832
|
}
|
|
829
833
|
};
|
|
830
|
-
h.unshift({ id: R.id, params: m }),
|
|
834
|
+
h.unshift({ id: R.id, params: m }), d.unshift({ id: R.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
831
835
|
}
|
|
832
836
|
return {
|
|
833
|
-
undos:
|
|
837
|
+
undos: d,
|
|
834
838
|
redos: h
|
|
835
839
|
};
|
|
836
840
|
}
|
|
@@ -842,15 +846,15 @@ let V = class extends B {
|
|
|
842
846
|
const { startRow: o, endRow: l } = s, { fromRange: a, toRange: c } = r;
|
|
843
847
|
if (a.endRow < o && c.startRow <= o || a.startRow > l && c.endRow > l)
|
|
844
848
|
return this._handleNull();
|
|
845
|
-
const h = [],
|
|
849
|
+
const h = [], d = [], u = {};
|
|
846
850
|
for (let m = o; m <= l; m++)
|
|
847
|
-
|
|
851
|
+
u[m] = {
|
|
848
852
|
oldIndex: m
|
|
849
853
|
};
|
|
850
854
|
const f = o;
|
|
851
855
|
let g = l;
|
|
852
|
-
l >= a.startRow && l <= a.endRow && c.startRow < a.startRow && a.startRow > o && (g = a.startRow - 1), re(a.startRow, a.endRow - a.startRow + 1, c.startRow,
|
|
853
|
-
const C = Object.keys(
|
|
856
|
+
l >= a.startRow && l <= a.endRow && c.startRow < a.startRow && a.startRow > o && (g = a.startRow - 1), re(a.startRow, a.endRow - a.startRow + 1, c.startRow, u);
|
|
857
|
+
const C = Object.keys(u).map((m) => Number(m)), S = C.find((m) => u[m].oldIndex === g), F = C.find((m) => u[m].oldIndex === f);
|
|
854
858
|
if (o !== F || l !== S) {
|
|
855
859
|
const m = {
|
|
856
860
|
unitId: e,
|
|
@@ -861,11 +865,11 @@ let V = class extends B {
|
|
|
861
865
|
endRow: S
|
|
862
866
|
}
|
|
863
867
|
};
|
|
864
|
-
h.push({ id: R.id, params: m }, { id:
|
|
868
|
+
h.push({ id: R.id, params: m }, { id: W.id, params: { unitId: e, subUnitId: t } }), d.push({ id: R.id, params: { range: s, unitId: e, subUnitId: t } }, { id: W.id, params: { unitId: e, subUnitId: t } });
|
|
865
869
|
}
|
|
866
870
|
return {
|
|
867
871
|
redos: h,
|
|
868
|
-
undos:
|
|
872
|
+
undos: d
|
|
869
873
|
};
|
|
870
874
|
}
|
|
871
875
|
_handleMoveRangeCommand(r, e, t) {
|
|
@@ -877,18 +881,18 @@ let V = class extends B {
|
|
|
877
881
|
return this._handleNull();
|
|
878
882
|
const a = [], c = [];
|
|
879
883
|
if (K.contains(n, l)) {
|
|
880
|
-
const h = l.startRow - n.startRow,
|
|
884
|
+
const h = l.startRow - n.startRow, d = l.startColumn - n.startColumn, u = {
|
|
881
885
|
startRow: s.startRow + h,
|
|
882
|
-
startColumn: s.startColumn +
|
|
886
|
+
startColumn: s.startColumn + d,
|
|
883
887
|
endRow: s.startRow + h + (l.endRow - l.startRow),
|
|
884
|
-
endColumn: s.startColumn +
|
|
888
|
+
endColumn: s.startColumn + d + (l.endColumn - l.startColumn)
|
|
885
889
|
}, f = {
|
|
886
890
|
id: y.id,
|
|
887
891
|
params: {
|
|
888
892
|
unitId: e,
|
|
889
893
|
subUnitId: t
|
|
890
894
|
}
|
|
891
|
-
}, g = { id: R.id, params: { unitId: e, subUnitId: t, range:
|
|
895
|
+
}, g = { id: R.id, params: { unitId: e, subUnitId: t, range: u } }, C = { id: R.id, params: { unitId: e, subUnitId: t, range: l } };
|
|
892
896
|
a.push(f, g), c.push(f, C);
|
|
893
897
|
const S = o.getAllFilterColumns(), F = s.startColumn - n.startColumn;
|
|
894
898
|
S.forEach((_) => {
|
|
@@ -930,8 +934,8 @@ let V = class extends B {
|
|
|
930
934
|
if (!s)
|
|
931
935
|
return this._handleNull();
|
|
932
936
|
const o = [], l = [], a = [], c = [];
|
|
933
|
-
return n.getAllFilterColumns().forEach(([
|
|
934
|
-
o.push({ id: p.id, params: { unitId: r, subUnitId: t, col:
|
|
937
|
+
return n.getAllFilterColumns().forEach(([d, u]) => {
|
|
938
|
+
o.push({ id: p.id, params: { unitId: r, subUnitId: t, col: d, criteria: { ...u.serialize(), colId: d } } }), a.push({ id: p.id, params: { unitId: r, subUnitId: t, col: d, criteria: null } });
|
|
935
939
|
}), a.push({ id: y.id, params: { unitId: r, subUnitId: t, range: s } }), o.unshift({ id: R.id, params: { range: s, unitId: r, subUnitId: t } }), {
|
|
936
940
|
undos: l,
|
|
937
941
|
redos: o,
|
|
@@ -943,7 +947,7 @@ let V = class extends B {
|
|
|
943
947
|
return { redos: [], undos: [] };
|
|
944
948
|
}
|
|
945
949
|
_initRowFilteredInterceptor() {
|
|
946
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
950
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(ke.ROW_FILTERED, {
|
|
947
951
|
// sheet-interceptor.service.ts
|
|
948
952
|
handler: (r, e) => {
|
|
949
953
|
var t, n;
|
|
@@ -962,35 +966,35 @@ let V = class extends B {
|
|
|
962
966
|
col: -1
|
|
963
967
|
}, o = [], l = [], a = [], c = [];
|
|
964
968
|
return t.forEach((h) => {
|
|
965
|
-
const [
|
|
969
|
+
const [d, u] = h;
|
|
966
970
|
l.push({
|
|
967
971
|
id: p.id,
|
|
968
972
|
params: {
|
|
969
973
|
...s,
|
|
970
|
-
col:
|
|
974
|
+
col: d
|
|
971
975
|
}
|
|
972
976
|
}), o.push({
|
|
973
977
|
id: p.id,
|
|
974
978
|
params: {
|
|
975
979
|
...s,
|
|
976
|
-
col:
|
|
977
|
-
criteria: { ...
|
|
980
|
+
col: d,
|
|
981
|
+
criteria: { ...u.serialize(), colId: d }
|
|
978
982
|
}
|
|
979
983
|
});
|
|
980
984
|
}), t.forEach((h) => {
|
|
981
|
-
const [
|
|
985
|
+
const [d, u] = h;
|
|
982
986
|
c.push({
|
|
983
987
|
id: p.id,
|
|
984
988
|
params: {
|
|
985
989
|
...s,
|
|
986
|
-
col:
|
|
987
|
-
criteria: { ...
|
|
990
|
+
col: d + n,
|
|
991
|
+
criteria: { ...u.serialize(), colId: d + n }
|
|
988
992
|
}
|
|
989
993
|
}), a.push({
|
|
990
994
|
id: p.id,
|
|
991
995
|
params: {
|
|
992
996
|
...s,
|
|
993
|
-
col:
|
|
997
|
+
col: d + n,
|
|
994
998
|
criteria: null
|
|
995
999
|
}
|
|
996
1000
|
});
|
|
@@ -1010,37 +1014,37 @@ let V = class extends B {
|
|
|
1010
1014
|
var c, h;
|
|
1011
1015
|
const { unitId: t, subUnitId: n } = r.params || {}, s = this._sheetsFilterService.getFilterModel(t, n);
|
|
1012
1016
|
if (!s) return;
|
|
1013
|
-
const o = Array.from(s.filteredOutRows).sort((
|
|
1017
|
+
const o = Array.from(s.filteredOutRows).sort((d, u) => d - u), l = [];
|
|
1014
1018
|
let a = !1;
|
|
1015
|
-
if (r.id ===
|
|
1016
|
-
const { startRow:
|
|
1019
|
+
if (r.id === qe.id) {
|
|
1020
|
+
const { startRow: d, endRow: u } = r.params.range, f = o.filter((g) => g >= d && g <= u);
|
|
1017
1021
|
o.forEach((g) => {
|
|
1018
|
-
if (g <
|
|
1022
|
+
if (g < d)
|
|
1019
1023
|
l.push(g);
|
|
1020
|
-
else if (a = !0, g <=
|
|
1021
|
-
const C = Math.max(
|
|
1024
|
+
else if (a = !0, g <= u) {
|
|
1025
|
+
const C = Math.max(d, l.length ? l[l.length - 1] + 1 : d);
|
|
1022
1026
|
l.push(C);
|
|
1023
1027
|
} else
|
|
1024
|
-
l.push(g - (
|
|
1028
|
+
l.push(g - (u - d + 1 - f.length));
|
|
1025
1029
|
});
|
|
1026
1030
|
}
|
|
1027
|
-
if (r.id ===
|
|
1028
|
-
const { startRow:
|
|
1031
|
+
if (r.id === Qe.id) {
|
|
1032
|
+
const { startRow: d, endRow: u } = r.params.range;
|
|
1029
1033
|
o.forEach((f) => {
|
|
1030
|
-
f >=
|
|
1034
|
+
f >= d ? (a = !0, l.push(f + (u - d + 1))) : l.push(f);
|
|
1031
1035
|
});
|
|
1032
1036
|
}
|
|
1033
|
-
if (a && (s.filteredOutRows = new Set(l)), r.id ===
|
|
1034
|
-
const
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
if (
|
|
1038
|
-
for (let f =
|
|
1039
|
-
const g = (c =
|
|
1037
|
+
if (a && (s.filteredOutRows = new Set(l)), r.id === Ge.id && !(e != null && e.onlyLocal)) {
|
|
1038
|
+
const d = this._getExtendRegion(t, n);
|
|
1039
|
+
if (d) {
|
|
1040
|
+
const u = r.params.cellValue;
|
|
1041
|
+
if (u)
|
|
1042
|
+
for (let f = d.startColumn; f <= d.endColumn; f++) {
|
|
1043
|
+
const g = (c = u == null ? void 0 : u[d.startRow]) == null ? void 0 : c[f];
|
|
1040
1044
|
if (g && this._cellHasValue(g)) {
|
|
1041
1045
|
const C = (h = this._univerInstanceService.getUnit(t)) == null ? void 0 : h.getSheetBySheetId(n);
|
|
1042
1046
|
if (C) {
|
|
1043
|
-
const S =
|
|
1047
|
+
const S = de(d, { down: !0 }, C), F = this._sheetsFilterService.getFilterModel(t, n), _ = F.getRange();
|
|
1044
1048
|
F.setRange({
|
|
1045
1049
|
..._,
|
|
1046
1050
|
endRow: S.endRow
|
|
@@ -1081,7 +1085,7 @@ let V = class extends B {
|
|
|
1081
1085
|
const { subUnitId: n, unitId: s } = t, o = this._sheetsFilterService.getFilterModel(s, n);
|
|
1082
1086
|
if (!o) return;
|
|
1083
1087
|
const l = o.getRange();
|
|
1084
|
-
if (r.id ===
|
|
1088
|
+
if (r.id === Je.id && e.fromRange.startRow <= l.startRow && e.fromRange.endRow < l.endRow && e.fromRange.endRow >= l.startRow)
|
|
1085
1089
|
throw this._sheetsFilterService.setFilterErrorMsg("sheets-filter.msg.filter-header-forbidden"), new Error("[SheetsFilterController]: Cannot move header row of filter");
|
|
1086
1090
|
}));
|
|
1087
1091
|
}
|
|
@@ -1090,21 +1094,22 @@ let V = class extends B {
|
|
|
1090
1094
|
return !(e.length === 0 || e.every((t) => t == null));
|
|
1091
1095
|
}
|
|
1092
1096
|
};
|
|
1093
|
-
|
|
1097
|
+
j = It([
|
|
1094
1098
|
P(0, N),
|
|
1095
|
-
P(1,
|
|
1096
|
-
P(2,
|
|
1099
|
+
P(1, I(He)),
|
|
1100
|
+
P(2, I(M)),
|
|
1097
1101
|
P(3, T),
|
|
1098
|
-
P(4,
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
+
P(4, I(ze)),
|
|
1103
|
+
P(5, Te(be))
|
|
1104
|
+
], j);
|
|
1105
|
+
var $t = Object.getOwnPropertyDescriptor, Pt = (i, r, e, t) => {
|
|
1106
|
+
for (var n = t > 1 ? void 0 : t ? $t(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1102
1107
|
(o = i[s]) && (n = o(n) || n);
|
|
1103
1108
|
return n;
|
|
1104
|
-
},
|
|
1105
|
-
let
|
|
1106
|
-
constructor(i, r, e) {
|
|
1107
|
-
super(), this._activeDirtyManagerService = i, this.
|
|
1109
|
+
}, H = (i, r) => (e, t) => r(e, t, i);
|
|
1110
|
+
let k = class extends B {
|
|
1111
|
+
constructor(i, r, e, t) {
|
|
1112
|
+
super(), this._activeDirtyManagerService = i, this._sheetRowFilteredService = r, this._sheetsFilterService = e, this._univerInstanceService = t, this._initFormulaDirtyRange(), this._registerSheetRowFiltered();
|
|
1108
1113
|
}
|
|
1109
1114
|
_initFormulaDirtyRange() {
|
|
1110
1115
|
ge.forEach((i) => {
|
|
@@ -1144,78 +1149,85 @@ let j = class extends B {
|
|
|
1144
1149
|
}
|
|
1145
1150
|
}];
|
|
1146
1151
|
}
|
|
1152
|
+
_registerSheetRowFiltered() {
|
|
1153
|
+
this._sheetRowFilteredService.register((i, r, e) => {
|
|
1154
|
+
var t, n;
|
|
1155
|
+
return (n = (t = this._sheetsFilterService.getFilterModel(i, r)) == null ? void 0 : t.isRowFiltered(e)) != null ? n : !1;
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1147
1158
|
};
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1159
|
+
k = Pt([
|
|
1160
|
+
H(0, I(lt)),
|
|
1161
|
+
H(1, I(at)),
|
|
1162
|
+
H(2, I(M)),
|
|
1163
|
+
H(3, T)
|
|
1164
|
+
], k);
|
|
1165
|
+
var Ut = Object.getOwnPropertyDescriptor, Dt = (i, r, e, t) => {
|
|
1166
|
+
for (var n = t > 1 ? void 0 : t ? Ut(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1155
1167
|
(o = i[s]) && (n = o(n) || n);
|
|
1156
1168
|
return n;
|
|
1157
|
-
}, ae = (i, r) => (e, t) => r(e, t, i),
|
|
1158
|
-
let ce = (
|
|
1169
|
+
}, ae = (i, r) => (e, t) => r(e, t, i), z;
|
|
1170
|
+
let ce = (z = class extends xe {
|
|
1159
1171
|
constructor(i = ie, r, e) {
|
|
1160
1172
|
super(), this._config = i, this._injector = r, this._configService = e;
|
|
1161
|
-
const { ...t } =
|
|
1173
|
+
const { ...t } = Ie(
|
|
1162
1174
|
{},
|
|
1163
1175
|
ie,
|
|
1164
1176
|
this._config
|
|
1165
1177
|
);
|
|
1166
|
-
this._configService.setConfig(
|
|
1178
|
+
this._configService.setConfig(ct, t);
|
|
1167
1179
|
}
|
|
1168
1180
|
onStarting() {
|
|
1169
1181
|
[
|
|
1170
|
-
[
|
|
1182
|
+
[k],
|
|
1171
1183
|
[M],
|
|
1172
|
-
[
|
|
1184
|
+
[j]
|
|
1173
1185
|
].forEach((i) => this._injector.add(i));
|
|
1174
1186
|
}
|
|
1175
1187
|
onReady() {
|
|
1176
|
-
|
|
1177
|
-
[
|
|
1178
|
-
[
|
|
1188
|
+
$e(this._injector, [
|
|
1189
|
+
[k],
|
|
1190
|
+
[j]
|
|
1179
1191
|
]);
|
|
1180
1192
|
}
|
|
1181
|
-
}, w(
|
|
1182
|
-
ce =
|
|
1183
|
-
ae(1,
|
|
1193
|
+
}, w(z, "type", D.UNIVER_SHEET), w(z, "pluginName", Fe), z);
|
|
1194
|
+
ce = Dt([
|
|
1195
|
+
ae(1, I(Pe)),
|
|
1184
1196
|
ae(2, Ue)
|
|
1185
1197
|
], ce);
|
|
1186
|
-
const
|
|
1198
|
+
const Lt = {
|
|
1187
1199
|
id: "sheet.command.set-filter-range",
|
|
1188
1200
|
type: E.COMMAND,
|
|
1189
1201
|
handler: (i, r) => {
|
|
1190
|
-
const e = i.get(M), t = i.get(N), n = i.get(
|
|
1202
|
+
const e = i.get(M), t = i.get(N), n = i.get(q), s = i.get(T), { unitId: o, subUnitId: l, range: a } = r;
|
|
1191
1203
|
if (!b(s, r) || e.getFilterModel(o, l)) return !1;
|
|
1192
1204
|
if (a.endRow === a.startRow) {
|
|
1193
|
-
const f = i.get(
|
|
1205
|
+
const f = i.get(Le), g = i.get(Be);
|
|
1194
1206
|
return f.emit(g.t("sheets-filter.command.not-valid-filter-range")), !1;
|
|
1195
1207
|
}
|
|
1196
|
-
const
|
|
1197
|
-
return
|
|
1208
|
+
const d = { id: R.id, params: { unitId: o, subUnitId: l, range: a } }, u = t.syncExecuteCommand(d.id, d.params);
|
|
1209
|
+
return u && n.pushUndoRedo({
|
|
1198
1210
|
unitID: o,
|
|
1199
1211
|
undoMutations: [{ id: y.id, params: { unitId: o, subUnitId: l } }],
|
|
1200
|
-
redoMutations: [
|
|
1201
|
-
}),
|
|
1212
|
+
redoMutations: [d]
|
|
1213
|
+
}), u;
|
|
1202
1214
|
}
|
|
1203
|
-
},
|
|
1215
|
+
}, Bt = {
|
|
1204
1216
|
id: "sheet.command.remove-sheet-filter",
|
|
1205
1217
|
type: E.COMMAND,
|
|
1206
1218
|
handler: (i, r) => {
|
|
1207
|
-
const e = i.get(T), t = i.get(M), n = i.get(N), s = i.get(
|
|
1219
|
+
const e = i.get(T), t = i.get(M), n = i.get(N), s = i.get(q), o = b(e, r);
|
|
1208
1220
|
if (!o) return !1;
|
|
1209
1221
|
const { unitId: l, subUnitId: a } = o, c = t.getFilterModel(l, a);
|
|
1210
1222
|
if (!c) return !1;
|
|
1211
|
-
const h = c == null ? void 0 : c.serialize(),
|
|
1212
|
-
return
|
|
1223
|
+
const h = c == null ? void 0 : c.serialize(), d = bt(l, a, h), u = n.syncExecuteCommand(y.id, { unitId: l, subUnitId: a });
|
|
1224
|
+
return u && s.pushUndoRedo({
|
|
1213
1225
|
unitID: l,
|
|
1214
|
-
undoMutations:
|
|
1226
|
+
undoMutations: d,
|
|
1215
1227
|
redoMutations: [{ id: y.id, params: { unitId: l, subUnitId: a } }]
|
|
1216
|
-
}),
|
|
1228
|
+
}), u;
|
|
1217
1229
|
}
|
|
1218
|
-
},
|
|
1230
|
+
}, Gt = {
|
|
1219
1231
|
id: "sheet.command.smart-toggle-filter",
|
|
1220
1232
|
type: E.COMMAND,
|
|
1221
1233
|
handler: async (i) => {
|
|
@@ -1223,25 +1235,25 @@ const Ut = {
|
|
|
1223
1235
|
if (!s || !n) return !1;
|
|
1224
1236
|
const o = n.getUnitId(), l = s.getSheetId();
|
|
1225
1237
|
if (e.getFilterModel(o, l))
|
|
1226
|
-
return t.executeCommand(
|
|
1227
|
-
const h = i.get(
|
|
1238
|
+
return t.executeCommand(Bt.id, { unitId: o, subUnitId: l });
|
|
1239
|
+
const h = i.get(tt).getCurrentLastSelection();
|
|
1228
1240
|
if (!h) return !1;
|
|
1229
|
-
const
|
|
1230
|
-
return t.executeCommand(
|
|
1241
|
+
const d = h.range, u = rt(h) ? de(d, { left: !0, right: !0, up: !0, down: !0 }, s) : d;
|
|
1242
|
+
return t.executeCommand(Lt.id, {
|
|
1231
1243
|
unitId: o,
|
|
1232
1244
|
subUnitId: l,
|
|
1233
|
-
range:
|
|
1245
|
+
range: u
|
|
1234
1246
|
});
|
|
1235
1247
|
}
|
|
1236
|
-
},
|
|
1248
|
+
}, Jt = {
|
|
1237
1249
|
id: "sheet.command.set-filter-criteria",
|
|
1238
1250
|
type: E.COMMAND,
|
|
1239
1251
|
handler: (i, r) => {
|
|
1240
|
-
const e = i.get(M), t = i.get(N), n = i.get(
|
|
1252
|
+
const e = i.get(M), t = i.get(N), n = i.get(q), { unitId: s, subUnitId: o, col: l, criteria: a } = r, c = e.getFilterModel(s, o);
|
|
1241
1253
|
if (!c) return !1;
|
|
1242
1254
|
const h = c.getRange();
|
|
1243
1255
|
if (!h || l < h.startColumn || l > h.endColumn) return !1;
|
|
1244
|
-
const
|
|
1256
|
+
const d = c.getFilterColumn(l), u = zt(s, o, l, d), f = {
|
|
1245
1257
|
id: p.id,
|
|
1246
1258
|
params: {
|
|
1247
1259
|
unitId: s,
|
|
@@ -1252,36 +1264,36 @@ const Ut = {
|
|
|
1252
1264
|
}, g = t.syncExecuteCommand(f.id, f.params);
|
|
1253
1265
|
return g && n.pushUndoRedo({
|
|
1254
1266
|
unitID: s,
|
|
1255
|
-
undoMutations: [
|
|
1267
|
+
undoMutations: [u],
|
|
1256
1268
|
redoMutations: [f]
|
|
1257
1269
|
}), g;
|
|
1258
1270
|
}
|
|
1259
|
-
},
|
|
1271
|
+
}, Yt = {
|
|
1260
1272
|
id: "sheet.command.clear-filter-criteria",
|
|
1261
1273
|
type: E.COMMAND,
|
|
1262
1274
|
handler: (i, r) => {
|
|
1263
|
-
const e = i.get(M), t = i.get(
|
|
1275
|
+
const e = i.get(M), t = i.get(q), n = i.get(N), s = i.get(T), o = b(s, r);
|
|
1264
1276
|
if (!o) return !1;
|
|
1265
1277
|
const { unitId: l, subUnitId: a } = o, c = e.getFilterModel(o.unitId, o.subUnitId);
|
|
1266
1278
|
if (!c) return !1;
|
|
1267
|
-
const h = c.serialize(),
|
|
1268
|
-
return
|
|
1279
|
+
const h = c.serialize(), d = we(l, a, h), u = Ht(l, a, h);
|
|
1280
|
+
return De(u, n).result ? (t.pushUndoRedo({
|
|
1269
1281
|
unitID: l,
|
|
1270
|
-
undoMutations:
|
|
1271
|
-
redoMutations:
|
|
1282
|
+
undoMutations: d,
|
|
1283
|
+
redoMutations: u
|
|
1272
1284
|
}), !0) : !1;
|
|
1273
1285
|
}
|
|
1274
|
-
},
|
|
1286
|
+
}, Kt = {
|
|
1275
1287
|
id: "sheet.command.re-calc-filter",
|
|
1276
1288
|
type: E.COMMAND,
|
|
1277
1289
|
handler: (i, r) => {
|
|
1278
1290
|
const e = i.get(M), t = i.get(N), n = i.get(T), s = b(n, r);
|
|
1279
1291
|
if (!s) return !1;
|
|
1280
1292
|
const { unitId: o, subUnitId: l } = s;
|
|
1281
|
-
return e.getFilterModel(s.unitId, s.subUnitId) ? t.executeCommand(
|
|
1293
|
+
return e.getFilterModel(s.unitId, s.subUnitId) ? t.executeCommand(W.id, { unitId: o, subUnitId: l }) : !1;
|
|
1282
1294
|
}
|
|
1283
1295
|
};
|
|
1284
|
-
function
|
|
1296
|
+
function bt(i, r, e) {
|
|
1285
1297
|
const t = [], n = {
|
|
1286
1298
|
id: R.id,
|
|
1287
1299
|
params: {
|
|
@@ -1308,7 +1320,7 @@ function we(i, r, e) {
|
|
|
1308
1320
|
t.push(o);
|
|
1309
1321
|
}), t;
|
|
1310
1322
|
}
|
|
1311
|
-
function
|
|
1323
|
+
function Ht(i, r, e) {
|
|
1312
1324
|
var n;
|
|
1313
1325
|
const t = [];
|
|
1314
1326
|
return (n = e.filterColumns) == null || n.forEach((s) => {
|
|
@@ -1324,7 +1336,7 @@ function Lt(i, r, e) {
|
|
|
1324
1336
|
t.push(o);
|
|
1325
1337
|
}), t;
|
|
1326
1338
|
}
|
|
1327
|
-
function
|
|
1339
|
+
function zt(i, r, e, t) {
|
|
1328
1340
|
if (!t)
|
|
1329
1341
|
return {
|
|
1330
1342
|
id: p.id,
|
|
@@ -1347,28 +1359,28 @@ function Bt(i, r, e, t) {
|
|
|
1347
1359
|
};
|
|
1348
1360
|
}
|
|
1349
1361
|
export {
|
|
1350
|
-
|
|
1362
|
+
Yt as ClearSheetsFilterCriteriaCommand,
|
|
1351
1363
|
x as CustomFilterOperator,
|
|
1352
1364
|
ge as FILTER_MUTATIONS,
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1365
|
+
pt as FilterColumn,
|
|
1366
|
+
V as FilterModel,
|
|
1367
|
+
Kt as ReCalcSheetsFilterCommand,
|
|
1368
|
+
W as ReCalcSheetsFilterMutation,
|
|
1369
|
+
Bt as RemoveSheetFilterCommand,
|
|
1358
1370
|
y as RemoveSheetsFilterMutation,
|
|
1359
1371
|
Fe as SHEET_FILTER_SNAPSHOT_ID,
|
|
1360
|
-
|
|
1361
|
-
|
|
1372
|
+
Lt as SetSheetFilterRangeCommand,
|
|
1373
|
+
Jt as SetSheetsFilterCriteriaCommand,
|
|
1362
1374
|
p as SetSheetsFilterCriteriaMutation,
|
|
1363
1375
|
R as SetSheetsFilterRangeMutation,
|
|
1364
1376
|
M as SheetsFilterService,
|
|
1365
|
-
|
|
1377
|
+
Gt as SmartToggleSheetsFilterCommand,
|
|
1366
1378
|
ce as UniverSheetsFilterPlugin,
|
|
1367
|
-
|
|
1379
|
+
ft as equals,
|
|
1368
1380
|
se as getCustomFilterFn,
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1381
|
+
dt as greaterThan,
|
|
1382
|
+
ut as greaterThanOrEqualTo,
|
|
1383
|
+
ht as lessThan,
|
|
1384
|
+
mt as lessThanOrEqualTo,
|
|
1373
1385
|
_e as notEquals
|
|
1374
1386
|
};
|