@univerjs/sheets-filter 0.10.3 → 0.10.4-nightly.202508220605
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 +210 -198
- package/lib/index.js +210 -198
- package/lib/types/controllers/sheets-filter.controller.d.ts +4 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
var Ee = Object.defineProperty;
|
|
2
2
|
var Oe = (i, r, e) => r in i ? Ee(i, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[r] = e;
|
|
3
3
|
var S = (i, r, e) => Oe(i, typeof r != "symbol" ? r + "" : r, e);
|
|
4
|
-
import { isNumeric as ye, Disposable as B, Rectangle as
|
|
5
|
-
import { getSheetCommandTarget as
|
|
6
|
-
import { BehaviorSubject as D, merge as
|
|
7
|
-
import { COLOR_BLACK_RGB as
|
|
8
|
-
import { DataSyncPrimaryController as
|
|
9
|
-
import { IActiveDirtyManagerService as
|
|
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",
|
|
4
|
+
import { isNumeric as ye, Disposable as B, Rectangle as Y, mergeSets as J, Tools as re, extractPureTextFromCell as Ae, CellValueType as X, ColorKit as ne, UniverInstanceType as P, fromCallback as Te, CommandType as E, IResourceManagerService as Ne, IUniverInstanceService as N, ICommandService as I, IUndoRedoService as G, sequenceExecute as Ie, ErrorService as xe, LocaleService as $e, Inject as T, Optional as be, DisposableCollection as Le, moveMatrixArray as ie, Plugin as Ue, merge as Pe, touchDependencies as De, Injector as Be, IConfigService as ze } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as z, SheetsSelectionsService as He, isSingleCellSelection as We, expandToContinuousRange as he, SheetInterceptorService as Ve, RefRangeService as je, ZebraCrossingCacheController as ke, SetWorksheetActiveOperation as qe, CopySheetCommand as Ge, RemoveSheetCommand as Qe, INTERCEPTOR_POINT as Je, RemoveRowMutation as Ze, InsertRowMutation as Ke, SetRangeValuesMutation as Ye, MoveRowsCommand as Xe, MoveRangeCommand as et, EffectRefRangId as se, RemoveRowCommand as tt, RemoveColCommand as rt, InsertColCommand as nt, InsertRowCommand as it } from "@univerjs/sheets";
|
|
6
|
+
import { BehaviorSubject as D, merge as st, filter as ot, switchMap as lt, of as at } from "rxjs";
|
|
7
|
+
import { COLOR_BLACK_RGB as ct } from "@univerjs/engine-render";
|
|
8
|
+
import { DataSyncPrimaryController as ut } from "@univerjs/rpc";
|
|
9
|
+
import { IActiveDirtyManagerService as dt, ISheetRowFilteredService as ht } 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", Ce = /* @__PURE__ */ new Set([
|
|
11
11
|
fe,
|
|
12
12
|
me,
|
|
13
13
|
ge,
|
|
14
14
|
_e
|
|
15
15
|
]);
|
|
16
|
-
var
|
|
17
|
-
const
|
|
16
|
+
var b = /* @__PURE__ */ ((i) => (i[i.VALUES = 0] = "VALUES", i[i.COLORS = 1] = "COLORS", i[i.CONDITIONS = 2] = "CONDITIONS", i))(b || {}), 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 ft = {
|
|
18
18
|
operator: x.GREATER_THAN,
|
|
19
|
-
fn: (i, r) =>
|
|
20
|
-
}, ft = {
|
|
21
|
-
operator: x.GREATER_THAN_OR_EQUAL,
|
|
22
|
-
fn: (i, r) => P(i) ? i >= r : !1
|
|
19
|
+
fn: (i, r) => U(i) ? i > r : !1
|
|
23
20
|
}, mt = {
|
|
24
|
-
operator: x.
|
|
25
|
-
fn: (i, r) =>
|
|
21
|
+
operator: x.GREATER_THAN_OR_EQUAL,
|
|
22
|
+
fn: (i, r) => U(i) ? i >= r : !1
|
|
26
23
|
}, gt = {
|
|
27
|
-
operator: x.
|
|
28
|
-
fn: (i, r) =>
|
|
24
|
+
operator: x.LESS_THAN,
|
|
25
|
+
fn: (i, r) => U(i) ? i < r : !1
|
|
29
26
|
}, _t = {
|
|
27
|
+
operator: x.LESS_THAN_OR_EQUAL,
|
|
28
|
+
fn: (i, r) => U(i) ? i <= r : !1
|
|
29
|
+
}, Ct = {
|
|
30
30
|
operator: x.EQUAL,
|
|
31
|
-
fn: (i, r) =>
|
|
32
|
-
},
|
|
31
|
+
fn: (i, r) => U(i) ? i === r : !1
|
|
32
|
+
}, Re = {
|
|
33
33
|
operator: x.NOT_EQUALS,
|
|
34
34
|
fn: (i, r) => {
|
|
35
35
|
if (typeof r == "string") {
|
|
36
36
|
if (r === " ")
|
|
37
37
|
return i != null;
|
|
38
38
|
const e = Fe(i);
|
|
39
|
-
return e &&
|
|
39
|
+
return e && St(r) ? !Se(r).test(e) : e !== r;
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return U(i) ? i !== r : !0;
|
|
42
42
|
}
|
|
43
|
-
}, pe = /* @__PURE__ */ new Map([]), Rt = [
|
|
43
|
+
}, pe = /* @__PURE__ */ new Map([]), Rt = [ft, mt, gt, _t, Ct, Re];
|
|
44
44
|
Rt.forEach((i) => {
|
|
45
45
|
pe.set(i.operator, i);
|
|
46
46
|
});
|
|
47
|
-
function
|
|
47
|
+
function pt(i) {
|
|
48
48
|
return !!i;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const Ft = {
|
|
51
51
|
fn: (i, r) => {
|
|
52
52
|
const e = Fe(i);
|
|
53
53
|
return e === null ? r === "" : Se(r).test(e);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
function oe(i) {
|
|
57
|
-
return i ? pe.get(i) :
|
|
57
|
+
return i ? pe.get(i) : Ft;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function U(i) {
|
|
60
60
|
return typeof i == "number";
|
|
61
61
|
}
|
|
62
62
|
function le(i) {
|
|
@@ -65,25 +65,25 @@ function le(i) {
|
|
|
65
65
|
function Fe(i) {
|
|
66
66
|
return typeof i == "boolean" || i == null ? null : typeof i == "string" ? i : i.toString();
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function St(i) {
|
|
69
69
|
return typeof i == "number" ? !1 : i.indexOf("*") !== -1 || i.indexOf("?") !== -1;
|
|
70
70
|
}
|
|
71
71
|
function Se(i) {
|
|
72
72
|
const r = i.replace(/[.+^${}()|[\]\\]/g, "\\$&").replaceAll("?", ".").replace(/[*]/g, ".$&");
|
|
73
73
|
return new RegExp(`^${r}$`);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const Z = () => /* @__PURE__ */ new Set();
|
|
76
76
|
class j extends B {
|
|
77
77
|
constructor(e, t, n) {
|
|
78
78
|
super();
|
|
79
|
-
S(this, "_filteredOutRows$", new D(
|
|
79
|
+
S(this, "_filteredOutRows$", new D(Z()));
|
|
80
80
|
/** An observable value. A set of filtered out rows. */
|
|
81
81
|
S(this, "filteredOutRows$", this._filteredOutRows$.asObservable());
|
|
82
82
|
// TODO: we may need to update which cols have criteria rather than simple boolean
|
|
83
83
|
S(this, "_hasCriteria$", new D(!1));
|
|
84
84
|
S(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
85
85
|
S(this, "_filterColumnByIndex", /* @__PURE__ */ new Map());
|
|
86
|
-
S(this, "_alreadyFilteredOutRows",
|
|
86
|
+
S(this, "_alreadyFilteredOutRows", Z());
|
|
87
87
|
S(this, "_range");
|
|
88
88
|
this.unitId = e, this.subUnitId = t, this._worksheet = n;
|
|
89
89
|
}
|
|
@@ -101,7 +101,7 @@ class j extends B {
|
|
|
101
101
|
*/
|
|
102
102
|
serialize() {
|
|
103
103
|
const e = {
|
|
104
|
-
ref:
|
|
104
|
+
ref: Y.clone(this._range),
|
|
105
105
|
filterColumns: this._getAllFilterColumns(!0).sort(([t], [n]) => t - n).map(([t, n]) => n.serialize())
|
|
106
106
|
};
|
|
107
107
|
return this._alreadyFilteredOutRows && (e.cachedFilteredOut = Array.from(this._alreadyFilteredOutRows).sort()), e;
|
|
@@ -181,7 +181,7 @@ class j extends B {
|
|
|
181
181
|
return e ? t : t.map(([n, s]) => s);
|
|
182
182
|
}
|
|
183
183
|
_reCalcAllColumns() {
|
|
184
|
-
this._alreadyFilteredOutRows =
|
|
184
|
+
this._alreadyFilteredOutRows = Z(), this._getAllFilterColumns().forEach((e) => e.__clearCache()), this._reCalcWithNoCacheColumns();
|
|
185
185
|
}
|
|
186
186
|
_setCriteriaWithoutReCalc(e, t) {
|
|
187
187
|
const n = this._range;
|
|
@@ -191,7 +191,7 @@ class j extends B {
|
|
|
191
191
|
if (e > o || e < s)
|
|
192
192
|
throw new Error(`[FilterModel] could not set criteria on column ${e} which is out of range!`);
|
|
193
193
|
let l;
|
|
194
|
-
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new
|
|
194
|
+
this._filterColumnByIndex.has(e) ? l = this._filterColumnByIndex.get(e) : (l = new wt(
|
|
195
195
|
this.unitId,
|
|
196
196
|
this.subUnitId,
|
|
197
197
|
this._worksheet,
|
|
@@ -221,7 +221,7 @@ class j extends B {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class wt extends B {
|
|
225
225
|
constructor(e, t, n, s, o) {
|
|
226
226
|
super();
|
|
227
227
|
S(this, "_filteredOutRows", null);
|
|
@@ -229,7 +229,7 @@ class St extends B {
|
|
|
229
229
|
S(this, "_filterFn", null);
|
|
230
230
|
S(this, "_range", null);
|
|
231
231
|
S(this, "_column", 0);
|
|
232
|
-
S(this, "_filterBy",
|
|
232
|
+
S(this, "_filterBy", b.VALUES);
|
|
233
233
|
this.unitId = e, this.subUnitId = t, this._worksheet = n, this._criteria = s, this._filterColumnContext = o;
|
|
234
234
|
}
|
|
235
235
|
get filteredOutRows() {
|
|
@@ -289,30 +289,30 @@ class St extends B {
|
|
|
289
289
|
const { row: a, rowSpan: c, col: h } = l;
|
|
290
290
|
if (o.has(a) && (!c || c === 1))
|
|
291
291
|
continue;
|
|
292
|
-
if (!(this._filterBy ===
|
|
292
|
+
if (!(this._filterBy === b.VALUES ? this._filterFn(Ae(this._worksheet.getCell(a, h))) : this._filterBy === b.COLORS ? this._filterFn(this._worksheet.getComposedCellStyle(a, h)) : this._filterFn(It(this._worksheet, a, h))) && (s.add(a), c))
|
|
293
293
|
for (let d = 1; d < c; d++)
|
|
294
294
|
s.add(a + d);
|
|
295
295
|
}
|
|
296
296
|
return s;
|
|
297
297
|
}
|
|
298
298
|
_generateFilterFn() {
|
|
299
|
-
this._criteria && (this._filterFn =
|
|
299
|
+
this._criteria && (this._filterFn = vt(this._criteria), this._filterBy = this._criteria.filters ? b.VALUES : this._criteria.colorFilters ? b.COLORS : b.CONDITIONS);
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function vt(i) {
|
|
303
303
|
if (i.filters)
|
|
304
|
-
return
|
|
304
|
+
return Mt(i.filters);
|
|
305
305
|
if (i.colorFilters)
|
|
306
|
-
return
|
|
306
|
+
return Et(i.colorFilters);
|
|
307
307
|
if (i.customFilters)
|
|
308
|
-
return
|
|
308
|
+
return Ot(i.customFilters);
|
|
309
309
|
throw new Error("[FilterModel]: other types of filters are not supported yet.");
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function Mt(i) {
|
|
312
312
|
const r = !!i.blank, e = new Set(i.filters);
|
|
313
313
|
return (t) => t === void 0 || t === "" ? r : e.has(typeof t == "string" ? t : `${t}`);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Et(i) {
|
|
316
316
|
if (i.cellFillColors) {
|
|
317
317
|
const r = new Set(i.cellFillColors);
|
|
318
318
|
return (e) => {
|
|
@@ -328,33 +328,33 @@ function Mt(i) {
|
|
|
328
328
|
return (e) => {
|
|
329
329
|
var n;
|
|
330
330
|
if (!e || !((n = e.cl) != null && n.rgb))
|
|
331
|
-
return !!r.has(
|
|
331
|
+
return !!r.has(ct);
|
|
332
332
|
const t = new ne(e.cl.rgb).toRgbString();
|
|
333
333
|
return r.has(t);
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
336
|
throw new Error("[FilterModel]: color filters are not supported yet.");
|
|
337
337
|
}
|
|
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
338
|
function Ot(i) {
|
|
339
|
+
const r = i.customFilters.map((e) => Nt(e));
|
|
340
|
+
return Tt(r) ? i.and ? yt(r) : At(r) : r[0];
|
|
341
|
+
}
|
|
342
|
+
function yt(i) {
|
|
343
343
|
const [r, e] = i;
|
|
344
344
|
return (t) => r(t) && e(t);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function At(i) {
|
|
347
347
|
const [r, e] = i;
|
|
348
348
|
return (t) => r(t) || e(t);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Tt(i) {
|
|
351
351
|
return i.length === 2;
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Nt(i) {
|
|
354
354
|
const r = i.val;
|
|
355
355
|
if (i.operator === x.NOT_EQUALS && !le(r))
|
|
356
|
-
return (n) =>
|
|
357
|
-
if (
|
|
356
|
+
return (n) => Re.fn(n, r);
|
|
357
|
+
if (pt(i.operator)) {
|
|
358
358
|
if (!le(r)) return () => !1;
|
|
359
359
|
const n = oe(i.operator), s = Number(r);
|
|
360
360
|
return (o) => n.fn(o, s);
|
|
@@ -362,24 +362,24 @@ function Tt(i) {
|
|
|
362
362
|
const e = oe(i.operator);
|
|
363
363
|
return (t) => e.fn(t, r);
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function It(i, r, e) {
|
|
366
366
|
const t = i.getCell(r, e);
|
|
367
367
|
if (!t) return null;
|
|
368
368
|
const n = i.getCellRaw(r, e);
|
|
369
|
-
return t && !n ? ae(t) : n ? t.t ===
|
|
369
|
+
return t && !n ? ae(t) : n ? t.t === X.NUMBER && typeof t.v == "string" ? n.v : ae(n) : null;
|
|
370
370
|
}
|
|
371
371
|
function ae(i) {
|
|
372
372
|
var t, n;
|
|
373
373
|
const r = (n = (t = i.p) == null ? void 0 : t.body) == null ? void 0 : n.dataStream;
|
|
374
374
|
if (r) return r.trimEnd();
|
|
375
375
|
const e = i.v;
|
|
376
|
-
return typeof e == "string" ? i.t ===
|
|
376
|
+
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" : "";
|
|
377
377
|
}
|
|
378
|
-
var xt = Object.getOwnPropertyDescriptor,
|
|
378
|
+
var xt = Object.getOwnPropertyDescriptor, $t = (i, r, e, t) => {
|
|
379
379
|
for (var n = t > 1 ? void 0 : t ? xt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
380
380
|
(o = i[s]) && (n = o(n) || n);
|
|
381
381
|
return n;
|
|
382
|
-
},
|
|
382
|
+
}, K = (i, r) => (e, t) => r(e, t, i);
|
|
383
383
|
const we = "SHEET_FILTER_PLUGIN";
|
|
384
384
|
let M = class extends B {
|
|
385
385
|
constructor(r, e, t) {
|
|
@@ -430,7 +430,7 @@ let M = class extends B {
|
|
|
430
430
|
_updateActiveFilterModel() {
|
|
431
431
|
let r;
|
|
432
432
|
try {
|
|
433
|
-
if (r = this._univerInstanceService.getCurrentUnitForType(
|
|
433
|
+
if (r = this._univerInstanceService.getCurrentUnitForType(P.UNIVER_SHEET), !r) {
|
|
434
434
|
this._activeFilterModel$.next(null);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
@@ -448,13 +448,13 @@ let M = class extends B {
|
|
|
448
448
|
}
|
|
449
449
|
_initActiveFilterModel() {
|
|
450
450
|
this.disposeWithMe(
|
|
451
|
-
|
|
451
|
+
st(
|
|
452
452
|
// source1: executing filter related mutations
|
|
453
|
-
Te(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
|
|
453
|
+
Te(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(ot(([r]) => r.type === E.MUTATION && Ce.has(r.id))),
|
|
454
454
|
// source2: activate sheet changes
|
|
455
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
455
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(P.UNIVER_SHEET).pipe(lt((r) => {
|
|
456
456
|
var e;
|
|
457
|
-
return (e = r == null ? void 0 : r.activeSheet$) != null ? e :
|
|
457
|
+
return (e = r == null ? void 0 : r.activeSheet$) != null ? e : at(null);
|
|
458
458
|
}))
|
|
459
459
|
).subscribe(() => this._updateActiveFilterModel())
|
|
460
460
|
);
|
|
@@ -478,7 +478,7 @@ let M = class extends B {
|
|
|
478
478
|
_initModel() {
|
|
479
479
|
this._resourcesManagerService.registerPluginResource({
|
|
480
480
|
pluginName: we,
|
|
481
|
-
businesses: [
|
|
481
|
+
businesses: [P.UNIVER_SHEET],
|
|
482
482
|
toJson: (r) => this._serializeAutoFiltersForUnit(r),
|
|
483
483
|
parseJson: (r) => JSON.parse(r),
|
|
484
484
|
onLoad: (r, e) => {
|
|
@@ -494,12 +494,12 @@ let M = class extends B {
|
|
|
494
494
|
this._filterModels.has(r) || this._filterModels.set(r, /* @__PURE__ */ new Map()), this._filterModels.get(r).set(e, t);
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
|
-
M =
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
497
|
+
M = $t([
|
|
498
|
+
K(0, Ne),
|
|
499
|
+
K(1, N),
|
|
500
|
+
K(2, I)
|
|
501
501
|
], M);
|
|
502
|
-
const
|
|
502
|
+
const C = {
|
|
503
503
|
id: fe,
|
|
504
504
|
type: E.MUTATION,
|
|
505
505
|
handler: (i, r) => {
|
|
@@ -520,72 +520,72 @@ const R = {
|
|
|
520
520
|
const { unitId: e, subUnitId: t } = r;
|
|
521
521
|
return i.get(M).removeFilterModel(e, t);
|
|
522
522
|
}
|
|
523
|
-
},
|
|
523
|
+
}, V = {
|
|
524
524
|
id: _e,
|
|
525
525
|
type: E.MUTATION,
|
|
526
526
|
handler: (i, r) => {
|
|
527
527
|
const { unitId: e, subUnitId: t } = r, s = i.get(M).getFilterModel(e, t);
|
|
528
528
|
return s ? (s.reCalc(), !0) : !1;
|
|
529
529
|
}
|
|
530
|
-
},
|
|
530
|
+
}, bt = {
|
|
531
531
|
id: "sheet.command.set-filter-range",
|
|
532
532
|
type: E.COMMAND,
|
|
533
533
|
handler: (i, r) => {
|
|
534
|
-
const e = i.get(M), t = i.get(
|
|
535
|
-
if (!
|
|
534
|
+
const e = i.get(M), t = i.get(I), n = i.get(G), s = i.get(N), { unitId: o, subUnitId: l, range: a } = r;
|
|
535
|
+
if (!z(s, r) || e.getFilterModel(o, l)) return !1;
|
|
536
536
|
if (a.endRow === a.startRow) {
|
|
537
|
-
const m = i.get(
|
|
537
|
+
const m = i.get(xe), g = i.get($e);
|
|
538
538
|
return m.emit(g.t("sheets-filter.command.not-valid-filter-range")), !1;
|
|
539
539
|
}
|
|
540
|
-
const u = { id:
|
|
540
|
+
const u = { id: C.id, params: { unitId: o, subUnitId: l, range: a } }, d = t.syncExecuteCommand(u.id, u.params);
|
|
541
541
|
return d && n.pushUndoRedo({
|
|
542
542
|
unitID: o,
|
|
543
543
|
undoMutations: [{ id: O.id, params: { unitId: o, subUnitId: l } }],
|
|
544
544
|
redoMutations: [u]
|
|
545
545
|
}), d;
|
|
546
546
|
}
|
|
547
|
-
},
|
|
547
|
+
}, Lt = {
|
|
548
548
|
id: "sheet.command.remove-sheet-filter",
|
|
549
549
|
type: E.COMMAND,
|
|
550
550
|
handler: (i, r) => {
|
|
551
|
-
const e = i.get(
|
|
551
|
+
const e = i.get(N), t = i.get(M), n = i.get(I), s = i.get(G), o = z(e, r);
|
|
552
552
|
if (!o) return !1;
|
|
553
553
|
const { unitId: l, subUnitId: a } = o, c = t.getFilterModel(l, a);
|
|
554
554
|
if (!c) return !1;
|
|
555
|
-
const h = c == null ? void 0 : c.serialize(), u =
|
|
555
|
+
const h = c == null ? void 0 : c.serialize(), u = Ut(l, a, h), d = n.syncExecuteCommand(O.id, { unitId: l, subUnitId: a });
|
|
556
556
|
return d && s.pushUndoRedo({
|
|
557
557
|
unitID: l,
|
|
558
558
|
undoMutations: u,
|
|
559
559
|
redoMutations: [{ id: O.id, params: { unitId: l, subUnitId: a } }]
|
|
560
560
|
}), d;
|
|
561
561
|
}
|
|
562
|
-
},
|
|
562
|
+
}, er = {
|
|
563
563
|
id: "sheet.command.smart-toggle-filter",
|
|
564
564
|
type: E.COMMAND,
|
|
565
565
|
handler: async (i) => {
|
|
566
|
-
const r = i.get(
|
|
566
|
+
const r = i.get(N), e = i.get(M), t = i.get(I), n = r.getCurrentUnitForType(P.UNIVER_SHEET), s = n == null ? void 0 : n.getActiveSheet();
|
|
567
567
|
if (!s || !n) return !1;
|
|
568
568
|
const o = n.getUnitId(), l = s.getSheetId();
|
|
569
569
|
if (e.getFilterModel(o, l))
|
|
570
|
-
return t.executeCommand(
|
|
571
|
-
const h = i.get(
|
|
570
|
+
return t.executeCommand(Lt.id, { unitId: o, subUnitId: l });
|
|
571
|
+
const h = i.get(He).getCurrentLastSelection();
|
|
572
572
|
if (!h) return !1;
|
|
573
|
-
const u = h.range, d =
|
|
574
|
-
return t.executeCommand(
|
|
573
|
+
const u = h.range, d = We(h) ? he(u, { left: !0, right: !0, up: !0, down: !0 }, s) : u;
|
|
574
|
+
return t.executeCommand(bt.id, {
|
|
575
575
|
unitId: o,
|
|
576
576
|
subUnitId: l,
|
|
577
577
|
range: d
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
|
-
},
|
|
580
|
+
}, tr = {
|
|
581
581
|
id: "sheet.command.set-filter-criteria",
|
|
582
582
|
type: E.COMMAND,
|
|
583
583
|
handler: (i, r) => {
|
|
584
|
-
const e = i.get(M), t = i.get(
|
|
584
|
+
const e = i.get(M), t = i.get(I), n = i.get(G), { unitId: s, subUnitId: o, col: l, criteria: a } = r, c = e.getFilterModel(s, o);
|
|
585
585
|
if (!c) return !1;
|
|
586
586
|
const h = c.getRange();
|
|
587
587
|
if (!h || l < h.startColumn || l > h.endColumn) return !1;
|
|
588
|
-
const u = c.getFilterColumn(l), d =
|
|
588
|
+
const u = c.getFilterColumn(l), d = Dt(s, o, l, u), m = {
|
|
589
589
|
id: p.id,
|
|
590
590
|
params: {
|
|
591
591
|
unitId: s,
|
|
@@ -600,34 +600,34 @@ const R = {
|
|
|
600
600
|
redoMutations: [m]
|
|
601
601
|
}), g;
|
|
602
602
|
}
|
|
603
|
-
},
|
|
603
|
+
}, rr = {
|
|
604
604
|
id: "sheet.command.clear-filter-criteria",
|
|
605
605
|
type: E.COMMAND,
|
|
606
606
|
handler: (i, r) => {
|
|
607
|
-
const e = i.get(M), t = i.get(G), n = i.get(
|
|
607
|
+
const e = i.get(M), t = i.get(G), n = i.get(I), s = i.get(N), o = z(s, r);
|
|
608
608
|
if (!o) return !1;
|
|
609
609
|
const { unitId: l, subUnitId: a } = o, c = e.getFilterModel(o.unitId, o.subUnitId);
|
|
610
610
|
if (!c) return !1;
|
|
611
611
|
const h = c.serialize(), u = ve(l, a, h), d = Pt(l, a, h);
|
|
612
|
-
return
|
|
612
|
+
return Ie(d, n).result ? (t.pushUndoRedo({
|
|
613
613
|
unitID: l,
|
|
614
614
|
undoMutations: u,
|
|
615
615
|
redoMutations: d
|
|
616
616
|
}), !0) : !1;
|
|
617
617
|
}
|
|
618
|
-
},
|
|
618
|
+
}, nr = {
|
|
619
619
|
id: "sheet.command.re-calc-filter",
|
|
620
620
|
type: E.COMMAND,
|
|
621
621
|
handler: (i, r) => {
|
|
622
|
-
const e = i.get(M), t = i.get(
|
|
622
|
+
const e = i.get(M), t = i.get(I), n = i.get(N), s = z(n, r);
|
|
623
623
|
if (!s) return !1;
|
|
624
624
|
const { unitId: o, subUnitId: l } = s;
|
|
625
|
-
return e.getFilterModel(s.unitId, s.subUnitId) ? t.executeCommand(
|
|
625
|
+
return e.getFilterModel(s.unitId, s.subUnitId) ? t.executeCommand(V.id, { unitId: o, subUnitId: l }) : !1;
|
|
626
626
|
}
|
|
627
627
|
};
|
|
628
|
-
function
|
|
628
|
+
function Ut(i, r, e) {
|
|
629
629
|
const t = [], n = {
|
|
630
|
-
id:
|
|
630
|
+
id: C.id,
|
|
631
631
|
params: {
|
|
632
632
|
unitId: i,
|
|
633
633
|
subUnitId: r,
|
|
@@ -668,7 +668,7 @@ function Pt(i, r, e) {
|
|
|
668
668
|
t.push(o);
|
|
669
669
|
}), t;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function Dt(i, r, e, t) {
|
|
672
672
|
if (!t)
|
|
673
673
|
return {
|
|
674
674
|
id: p.id,
|
|
@@ -690,8 +690,8 @@ function bt(i, r, e, t) {
|
|
|
690
690
|
}
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
|
-
const
|
|
694
|
-
function
|
|
693
|
+
const Bt = "sheets-filter.config", ce = {};
|
|
694
|
+
function zt(i, r) {
|
|
695
695
|
for (let e = 0; e < i.length; e++) {
|
|
696
696
|
let t = e;
|
|
697
697
|
if (i[e])
|
|
@@ -700,25 +700,36 @@ function Bt(i, r) {
|
|
|
700
700
|
}
|
|
701
701
|
return i.filter((e) => e !== null);
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
return
|
|
703
|
+
function L(i) {
|
|
704
|
+
return zt(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);
|
|
705
705
|
}
|
|
706
|
-
var Ht = Object.getOwnPropertyDescriptor,
|
|
706
|
+
var Ht = Object.getOwnPropertyDescriptor, Wt = (i, r, e, t) => {
|
|
707
707
|
for (var n = t > 1 ? void 0 : t ? Ht(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
708
708
|
(o = i[s]) && (n = o(n) || n);
|
|
709
709
|
return n;
|
|
710
|
-
},
|
|
710
|
+
}, $ = (i, r) => (e, t) => r(e, t, i);
|
|
711
711
|
let k = class extends B {
|
|
712
|
-
constructor(r, e, t, n, s, o) {
|
|
712
|
+
constructor(r, e, t, n, s, o, l) {
|
|
713
713
|
super();
|
|
714
714
|
S(this, "_disposableCollection", new Le());
|
|
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();
|
|
715
|
+
this._commandService = r, this._sheetInterceptorService = e, this._sheetsFilterService = t, this._univerInstanceService = n, this._refRangeService = s, this._dataSyncPrimaryController = o, this._zebraCrossingCacheController = l, this._initCommands(), this._initRowFilteredInterceptor(), this._initInterceptors(), this._commandExecutedListener(), this._initErrorHandling(), this._initZebraCrossingCacheListener();
|
|
716
|
+
}
|
|
717
|
+
_initZebraCrossingCacheListener() {
|
|
718
|
+
this.disposeWithMe(
|
|
719
|
+
this._sheetsFilterService.activeFilterModel$.subscribe((r) => {
|
|
720
|
+
r && this.disposeWithMe(
|
|
721
|
+
r.filteredOutRows$.subscribe(() => {
|
|
722
|
+
this._zebraCrossingCacheController.updateZebraCrossingCache(r.unitId, r.subUnitId);
|
|
723
|
+
})
|
|
724
|
+
);
|
|
725
|
+
})
|
|
726
|
+
);
|
|
716
727
|
}
|
|
717
728
|
_initCommands() {
|
|
718
729
|
[
|
|
719
730
|
p,
|
|
720
|
-
|
|
721
|
-
|
|
731
|
+
C,
|
|
732
|
+
V,
|
|
722
733
|
O
|
|
723
734
|
].forEach((r) => {
|
|
724
735
|
var e;
|
|
@@ -729,13 +740,13 @@ let k = class extends B {
|
|
|
729
740
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
730
741
|
getMutations: (r) => this._getUpdateFilter(r)
|
|
731
742
|
})), this.disposeWithMe(this._commandService.onCommandExecuted((r) => {
|
|
732
|
-
if (r.id ===
|
|
743
|
+
if (r.id === qe.id) {
|
|
733
744
|
const e = r.params, t = e.subUnitId, n = e.unitId;
|
|
734
745
|
if (!t || !n)
|
|
735
746
|
return;
|
|
736
747
|
this._registerRefRange(n, t);
|
|
737
748
|
}
|
|
738
|
-
if (r.id ===
|
|
749
|
+
if (r.id === C.id) {
|
|
739
750
|
const e = r.params, t = e.subUnitId, n = e.unitId;
|
|
740
751
|
if (!t || !n)
|
|
741
752
|
return;
|
|
@@ -755,19 +766,19 @@ let k = class extends B {
|
|
|
755
766
|
if (!t || !n) return;
|
|
756
767
|
const s = (l = this._sheetsFilterService.getFilterModel(r, e)) == null ? void 0 : l.getRange(), o = (a) => {
|
|
757
768
|
switch (a.id) {
|
|
758
|
-
case
|
|
769
|
+
case it.id: {
|
|
759
770
|
const c = a.params, h = c.unitId || r, u = c.subUnitId || e;
|
|
760
771
|
return this._handleInsertRowCommand(c, h, u);
|
|
761
772
|
}
|
|
762
|
-
case
|
|
773
|
+
case nt.id: {
|
|
763
774
|
const c = a.params, h = c.unitId || r, u = c.subUnitId || e;
|
|
764
775
|
return this._handleInsertColCommand(c, h, u);
|
|
765
776
|
}
|
|
766
|
-
case
|
|
777
|
+
case rt.id: {
|
|
767
778
|
const c = a.params;
|
|
768
779
|
return this._handleRemoveColCommand(c, r, e);
|
|
769
780
|
}
|
|
770
|
-
case
|
|
781
|
+
case tt.id: {
|
|
771
782
|
const c = a.params;
|
|
772
783
|
return this._handleRemoveRowCommand(c, r, e);
|
|
773
784
|
}
|
|
@@ -779,7 +790,7 @@ let k = class extends B {
|
|
|
779
790
|
const c = a.params;
|
|
780
791
|
return this._handleMoveRowsCommand(c, r, e);
|
|
781
792
|
}
|
|
782
|
-
case
|
|
793
|
+
case et.id: {
|
|
783
794
|
const c = a.params;
|
|
784
795
|
return this._handleMoveRangeCommand(c, r, e);
|
|
785
796
|
}
|
|
@@ -791,11 +802,11 @@ let k = class extends B {
|
|
|
791
802
|
_getUpdateFilter(r) {
|
|
792
803
|
const { id: e } = r;
|
|
793
804
|
switch (e) {
|
|
794
|
-
case
|
|
805
|
+
case Qe.id: {
|
|
795
806
|
const t = r.params;
|
|
796
807
|
return this._handleRemoveSheetCommand(t, t.unitId, t.subUnitId);
|
|
797
808
|
}
|
|
798
|
-
case
|
|
809
|
+
case Ge.id: {
|
|
799
810
|
const t = r.params, { targetSubUnitId: n, unitId: s, subUnitId: o } = t;
|
|
800
811
|
return !s || !o || !n ? this._handleNull() : this._handleCopySheetCommand(s, o, n);
|
|
801
812
|
}
|
|
@@ -821,22 +832,22 @@ let k = class extends B {
|
|
|
821
832
|
startColumn: a <= o ? o + h : o,
|
|
822
833
|
endColumn: l + h
|
|
823
834
|
}
|
|
824
|
-
},
|
|
835
|
+
}, R = {
|
|
825
836
|
unitId: e,
|
|
826
837
|
subUnitId: t,
|
|
827
838
|
range: s
|
|
828
839
|
};
|
|
829
|
-
u.push({ id:
|
|
840
|
+
u.push({ id: C.id, params: g }), d.push({ id: C.id, params: R });
|
|
830
841
|
const F = n.getAllFilterColumns().filter((f) => f[0] >= m);
|
|
831
842
|
if (F.length !== 0) {
|
|
832
843
|
const { newRange: f, oldRange: v } = this._moveCriteria(e, t, F, h);
|
|
833
844
|
u.push(...f.redos, ...v.redos), d.push(...f.undos, ...v.undos);
|
|
834
845
|
}
|
|
835
|
-
return { redos:
|
|
846
|
+
return { redos: L(u), undos: L(d) };
|
|
836
847
|
}
|
|
837
848
|
_handleInsertRowCommand(r, e, t) {
|
|
838
|
-
var
|
|
839
|
-
const n = this._sheetsFilterService.getFilterModel(e, t), s = (
|
|
849
|
+
var R;
|
|
850
|
+
const n = this._sheetsFilterService.getFilterModel(e, t), s = (R = n == null ? void 0 : n.getRange()) != null ? R : null;
|
|
840
851
|
if (!n || !s)
|
|
841
852
|
return this._handleNull();
|
|
842
853
|
const { startRow: o, endRow: l } = s, { startRow: a, endRow: c } = r.range, h = c - a + 1;
|
|
@@ -855,9 +866,9 @@ let k = class extends B {
|
|
|
855
866
|
subUnitId: t,
|
|
856
867
|
range: s
|
|
857
868
|
};
|
|
858
|
-
return u.push({ id:
|
|
859
|
-
redos:
|
|
860
|
-
undos:
|
|
869
|
+
return u.push({ id: C.id, params: m }), d.push({ id: C.id, params: g }), {
|
|
870
|
+
redos: L(u),
|
|
871
|
+
undos: L(d)
|
|
861
872
|
};
|
|
862
873
|
}
|
|
863
874
|
_handleRemoveColCommand(r, e, t) {
|
|
@@ -873,13 +884,13 @@ let k = class extends B {
|
|
|
873
884
|
const [f, v] = _;
|
|
874
885
|
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 } } }));
|
|
875
886
|
});
|
|
876
|
-
const
|
|
887
|
+
const R = g.filter((_) => {
|
|
877
888
|
const [f, v] = _;
|
|
878
889
|
return f > c;
|
|
879
890
|
});
|
|
880
891
|
let w = { undos: [], redos: [] };
|
|
881
|
-
if (
|
|
882
|
-
const { oldRange: _, newRange: f } = this._moveCriteria(e, t,
|
|
892
|
+
if (R.length > 0) {
|
|
893
|
+
const { oldRange: _, newRange: f } = this._moveCriteria(e, t, R, -m);
|
|
883
894
|
w = f, h.push(..._.redos), u.unshift(..._.undos);
|
|
884
895
|
}
|
|
885
896
|
if (d === l - o + 1) {
|
|
@@ -887,14 +898,14 @@ let k = class extends B {
|
|
|
887
898
|
unitId: e,
|
|
888
899
|
subUnitId: t
|
|
889
900
|
};
|
|
890
|
-
h.push({ id: O.id, params: _ }), u.unshift({ id:
|
|
901
|
+
h.push({ id: O.id, params: _ }), u.unshift({ id: C.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
891
902
|
} else {
|
|
892
903
|
const _ = o <= a ? o : d === 0 ? o - m : a, f = o <= a ? l - d : l - m, v = {
|
|
893
904
|
unitId: e,
|
|
894
905
|
subUnitId: t,
|
|
895
906
|
range: { ...s, startColumn: _, endColumn: f }
|
|
896
907
|
};
|
|
897
|
-
h.push({ id:
|
|
908
|
+
h.push({ id: C.id, params: v }), u.unshift({ id: C.id, params: { range: s, unitId: e, subUnitId: t } }), h.push(...w.redos), u.unshift(...w.undos);
|
|
898
909
|
}
|
|
899
910
|
return {
|
|
900
911
|
undos: u,
|
|
@@ -902,7 +913,7 @@ let k = class extends B {
|
|
|
902
913
|
};
|
|
903
914
|
}
|
|
904
915
|
_handleRemoveRowCommand(r, e, t) {
|
|
905
|
-
var
|
|
916
|
+
var R;
|
|
906
917
|
const n = this._sheetsFilterService.getFilterModel(e, t);
|
|
907
918
|
if (!n)
|
|
908
919
|
return this._handleNull();
|
|
@@ -911,9 +922,9 @@ let k = class extends B {
|
|
|
911
922
|
return this._handleNull();
|
|
912
923
|
if (c < o)
|
|
913
924
|
return {
|
|
914
|
-
undos: [{ id:
|
|
925
|
+
undos: [{ id: C.id, params: { range: s, unitId: e, subUnitId: t } }],
|
|
915
926
|
redos: [{
|
|
916
|
-
id:
|
|
927
|
+
id: C.id,
|
|
917
928
|
params: {
|
|
918
929
|
range: {
|
|
919
930
|
...s,
|
|
@@ -926,7 +937,7 @@ let k = class extends B {
|
|
|
926
937
|
}]
|
|
927
938
|
};
|
|
928
939
|
const h = [], u = [], d = n.getAllFilterColumns(), m = o <= c && o >= a;
|
|
929
|
-
u.push({ id:
|
|
940
|
+
u.push({ id: C.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
930
941
|
const g = Math.min(c, l) - Math.max(a, o) + 1;
|
|
931
942
|
if (g === l - o + 1 || m) {
|
|
932
943
|
const w = {
|
|
@@ -943,7 +954,7 @@ let k = class extends B {
|
|
|
943
954
|
u.push({ id: p.id, params: v });
|
|
944
955
|
});
|
|
945
956
|
} else {
|
|
946
|
-
const w = (
|
|
957
|
+
const w = (R = this._univerInstanceService.getUniverSheetInstance(e)) == null ? void 0 : R.getSheetBySheetId(t);
|
|
947
958
|
if (!w)
|
|
948
959
|
return this._handleNull();
|
|
949
960
|
const F = [];
|
|
@@ -958,11 +969,11 @@ let k = class extends B {
|
|
|
958
969
|
endRow: f
|
|
959
970
|
}
|
|
960
971
|
};
|
|
961
|
-
h.push({ id:
|
|
972
|
+
h.push({ id: C.id, params: v });
|
|
962
973
|
}
|
|
963
974
|
return {
|
|
964
|
-
undos:
|
|
965
|
-
redos:
|
|
975
|
+
undos: L(u),
|
|
976
|
+
redos: L(h)
|
|
966
977
|
};
|
|
967
978
|
}
|
|
968
979
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -983,8 +994,8 @@ let k = class extends B {
|
|
|
983
994
|
ie(a.startColumn, a.endColumn - a.startColumn + 1, c.startColumn, d);
|
|
984
995
|
let m = s.startColumn, g = s.endColumn;
|
|
985
996
|
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
|
|
987
|
-
if (
|
|
997
|
+
const R = Object.keys(d).map((f) => Number(f)), w = R.find((f) => d[f].colIndex === g), F = R.find((f) => d[f].colIndex === m);
|
|
998
|
+
if (R.forEach((f) => {
|
|
988
999
|
var ee, te;
|
|
989
1000
|
const { colIndex: v, filter: y } = d[f], A = f;
|
|
990
1001
|
if (y) {
|
|
@@ -1022,7 +1033,7 @@ let k = class extends B {
|
|
|
1022
1033
|
endColumn: w
|
|
1023
1034
|
}
|
|
1024
1035
|
};
|
|
1025
|
-
h.unshift({ id:
|
|
1036
|
+
h.unshift({ id: C.id, params: f }), u.unshift({ id: C.id, params: { range: s, unitId: e, subUnitId: t } });
|
|
1026
1037
|
}
|
|
1027
1038
|
return {
|
|
1028
1039
|
undos: u,
|
|
@@ -1045,7 +1056,7 @@ let k = class extends B {
|
|
|
1045
1056
|
const m = o;
|
|
1046
1057
|
let g = l;
|
|
1047
1058
|
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
|
|
1059
|
+
const R = Object.keys(d).map((f) => Number(f)), w = R.find((f) => d[f].oldIndex === g), F = R.find((f) => d[f].oldIndex === m);
|
|
1049
1060
|
if (o !== F || l !== w) {
|
|
1050
1061
|
const f = {
|
|
1051
1062
|
unitId: e,
|
|
@@ -1056,7 +1067,7 @@ let k = class extends B {
|
|
|
1056
1067
|
endRow: w
|
|
1057
1068
|
}
|
|
1058
1069
|
};
|
|
1059
|
-
h.push({ id:
|
|
1070
|
+
h.push({ id: C.id, params: f }, { id: V.id, params: { unitId: e, subUnitId: t } }), u.push({ id: C.id, params: { range: s, unitId: e, subUnitId: t } }, { id: V.id, params: { unitId: e, subUnitId: t } });
|
|
1060
1071
|
}
|
|
1061
1072
|
return {
|
|
1062
1073
|
redos: h,
|
|
@@ -1071,7 +1082,7 @@ let k = class extends B {
|
|
|
1071
1082
|
if (!l)
|
|
1072
1083
|
return this._handleNull();
|
|
1073
1084
|
const a = [], c = [];
|
|
1074
|
-
if (
|
|
1085
|
+
if (Y.contains(n, l)) {
|
|
1075
1086
|
const h = l.startRow - n.startRow, u = l.startColumn - n.startColumn, d = {
|
|
1076
1087
|
startRow: s.startRow + h,
|
|
1077
1088
|
startColumn: s.startColumn + u,
|
|
@@ -1083,19 +1094,19 @@ let k = class extends B {
|
|
|
1083
1094
|
unitId: e,
|
|
1084
1095
|
subUnitId: t
|
|
1085
1096
|
}
|
|
1086
|
-
}, g = { id:
|
|
1087
|
-
a.push(m, g), c.push(m,
|
|
1097
|
+
}, g = { id: C.id, params: { unitId: e, subUnitId: t, range: d } }, R = { id: C.id, params: { unitId: e, subUnitId: t, range: l } };
|
|
1098
|
+
a.push(m, g), c.push(m, R);
|
|
1088
1099
|
const w = o.getAllFilterColumns(), F = s.startColumn - n.startColumn;
|
|
1089
1100
|
w.forEach((_) => {
|
|
1090
1101
|
const [f, v] = _;
|
|
1091
1102
|
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 } } }));
|
|
1092
1103
|
});
|
|
1093
|
-
} else if (
|
|
1104
|
+
} else if (Y.intersects(s, l)) {
|
|
1094
1105
|
const h = {
|
|
1095
1106
|
...l,
|
|
1096
1107
|
endRow: Math.max(l.endRow, s.endRow)
|
|
1097
1108
|
};
|
|
1098
|
-
a.push({ id:
|
|
1109
|
+
a.push({ id: C.id, params: { unitId: e, subUnitId: t, range: h } }), c.push({ id: C.id, params: { unitId: e, subUnitId: t, range: l } });
|
|
1099
1110
|
}
|
|
1100
1111
|
return {
|
|
1101
1112
|
redos: a,
|
|
@@ -1112,7 +1123,7 @@ let k = class extends B {
|
|
|
1112
1123
|
const o = [], l = [];
|
|
1113
1124
|
return n.getAllFilterColumns().forEach(([c, h]) => {
|
|
1114
1125
|
l.push({ id: p.id, params: { unitId: e, subUnitId: t, col: c, criteria: { ...h.serialize(), colId: c } } });
|
|
1115
|
-
}), o.push({ id: O.id, params: { unitId: e, subUnitId: t, range: s } }), l.unshift({ id:
|
|
1126
|
+
}), o.push({ id: O.id, params: { unitId: e, subUnitId: t, range: s } }), l.unshift({ id: C.id, params: { range: s, unitId: e, subUnitId: t } }), {
|
|
1116
1127
|
undos: l,
|
|
1117
1128
|
redos: o
|
|
1118
1129
|
};
|
|
@@ -1127,7 +1138,7 @@ let k = class extends B {
|
|
|
1127
1138
|
const o = [], l = [], a = [], c = [];
|
|
1128
1139
|
return n.getAllFilterColumns().forEach(([u, d]) => {
|
|
1129
1140
|
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:
|
|
1141
|
+
}), a.push({ id: O.id, params: { unitId: r, subUnitId: t, range: s } }), o.unshift({ id: C.id, params: { range: s, unitId: r, subUnitId: t } }), {
|
|
1131
1142
|
undos: l,
|
|
1132
1143
|
redos: o,
|
|
1133
1144
|
preUndos: a,
|
|
@@ -1138,7 +1149,7 @@ let k = class extends B {
|
|
|
1138
1149
|
return { redos: [], undos: [] };
|
|
1139
1150
|
}
|
|
1140
1151
|
_initRowFilteredInterceptor() {
|
|
1141
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
1152
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(Je.ROW_FILTERED, {
|
|
1142
1153
|
// sheet-interceptor.service.ts
|
|
1143
1154
|
handler: (r, e) => {
|
|
1144
1155
|
var t, n;
|
|
@@ -1207,14 +1218,14 @@ let k = class extends B {
|
|
|
1207
1218
|
if (!s) return;
|
|
1208
1219
|
const o = Array.from(s.filteredOutRows).sort((u, d) => u - d), l = [];
|
|
1209
1220
|
let a = !1;
|
|
1210
|
-
if (r.id ===
|
|
1221
|
+
if (r.id === Ze.id) {
|
|
1211
1222
|
const { startRow: u, endRow: d } = r.params.range, m = o.filter((g) => g >= u && g <= d);
|
|
1212
1223
|
o.forEach((g) => {
|
|
1213
1224
|
if (g < u)
|
|
1214
1225
|
l.push(g);
|
|
1215
1226
|
else if (a = !0, g <= d) {
|
|
1216
|
-
const
|
|
1217
|
-
l.push(
|
|
1227
|
+
const R = Math.max(u, l.length ? l[l.length - 1] + 1 : u);
|
|
1228
|
+
l.push(R);
|
|
1218
1229
|
} else
|
|
1219
1230
|
l.push(g - (d - u + 1 - m.length));
|
|
1220
1231
|
});
|
|
@@ -1233,9 +1244,9 @@ let k = class extends B {
|
|
|
1233
1244
|
for (let m = u.startColumn; m <= u.endColumn; m++) {
|
|
1234
1245
|
const g = (c = d == null ? void 0 : d[u.startRow]) == null ? void 0 : c[m];
|
|
1235
1246
|
if (g && this._cellHasValue(g)) {
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1238
|
-
const w = he(u, { down: !0 },
|
|
1247
|
+
const R = (h = this._univerInstanceService.getUnit(t)) == null ? void 0 : h.getSheetBySheetId(n);
|
|
1248
|
+
if (R) {
|
|
1249
|
+
const w = he(u, { down: !0 }, R), F = this._sheetsFilterService.getFilterModel(t, n), _ = F.getRange();
|
|
1239
1250
|
F.setRange({
|
|
1240
1251
|
..._,
|
|
1241
1252
|
endRow: w.endRow
|
|
@@ -1271,7 +1282,7 @@ let k = class extends B {
|
|
|
1271
1282
|
}
|
|
1272
1283
|
_initErrorHandling() {
|
|
1273
1284
|
this.disposeWithMe(this._commandService.beforeCommandExecuted((r) => {
|
|
1274
|
-
const e = r.params, t =
|
|
1285
|
+
const e = r.params, t = z(this._univerInstanceService);
|
|
1275
1286
|
if (!t) return;
|
|
1276
1287
|
const { subUnitId: n, unitId: s } = t, o = this._sheetsFilterService.getFilterModel(s, n);
|
|
1277
1288
|
if (!o) return;
|
|
@@ -1285,25 +1296,26 @@ let k = class extends B {
|
|
|
1285
1296
|
return !(e.length === 0 || e.every((t) => t == null));
|
|
1286
1297
|
}
|
|
1287
1298
|
};
|
|
1288
|
-
k =
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1299
|
+
k = Wt([
|
|
1300
|
+
$(0, I),
|
|
1301
|
+
$(1, T(Ve)),
|
|
1302
|
+
$(2, T(M)),
|
|
1303
|
+
$(3, N),
|
|
1304
|
+
$(4, T(je)),
|
|
1305
|
+
$(5, be(ut)),
|
|
1306
|
+
$(6, T(ke))
|
|
1295
1307
|
], k);
|
|
1296
|
-
var Vt = Object.getOwnPropertyDescriptor,
|
|
1308
|
+
var Vt = Object.getOwnPropertyDescriptor, jt = (i, r, e, t) => {
|
|
1297
1309
|
for (var n = t > 1 ? void 0 : t ? Vt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1298
1310
|
(o = i[s]) && (n = o(n) || n);
|
|
1299
1311
|
return n;
|
|
1300
|
-
},
|
|
1312
|
+
}, H = (i, r) => (e, t) => r(e, t, i);
|
|
1301
1313
|
let q = class extends B {
|
|
1302
1314
|
constructor(i, r, e, t) {
|
|
1303
1315
|
super(), this._activeDirtyManagerService = i, this._sheetRowFilteredService = r, this._sheetsFilterService = e, this._univerInstanceService = t, this._initFormulaDirtyRange(), this._registerSheetRowFiltered();
|
|
1304
1316
|
}
|
|
1305
1317
|
_initFormulaDirtyRange() {
|
|
1306
|
-
|
|
1318
|
+
Ce.forEach((i) => {
|
|
1307
1319
|
this._activeDirtyManagerService.register(
|
|
1308
1320
|
i,
|
|
1309
1321
|
{
|
|
@@ -1347,26 +1359,26 @@ let q = class extends B {
|
|
|
1347
1359
|
});
|
|
1348
1360
|
}
|
|
1349
1361
|
};
|
|
1350
|
-
q =
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1362
|
+
q = jt([
|
|
1363
|
+
H(0, T(dt)),
|
|
1364
|
+
H(1, T(ht)),
|
|
1365
|
+
H(2, T(M)),
|
|
1366
|
+
H(3, N)
|
|
1355
1367
|
], q);
|
|
1356
|
-
var
|
|
1357
|
-
for (var n = t > 1 ? void 0 : t ?
|
|
1368
|
+
var kt = Object.getOwnPropertyDescriptor, qt = (i, r, e, t) => {
|
|
1369
|
+
for (var n = t > 1 ? void 0 : t ? kt(r, e) : r, s = i.length - 1, o; s >= 0; s--)
|
|
1358
1370
|
(o = i[s]) && (n = o(n) || n);
|
|
1359
1371
|
return n;
|
|
1360
|
-
}, ue = (i, r) => (e, t) => r(e, t, i),
|
|
1361
|
-
let de = (
|
|
1372
|
+
}, ue = (i, r) => (e, t) => r(e, t, i), W;
|
|
1373
|
+
let de = (W = class extends Ue {
|
|
1362
1374
|
constructor(i = ce, r, e) {
|
|
1363
1375
|
super(), this._config = i, this._injector = r, this._configService = e;
|
|
1364
|
-
const { ...t } =
|
|
1376
|
+
const { ...t } = Pe(
|
|
1365
1377
|
{},
|
|
1366
1378
|
ce,
|
|
1367
1379
|
this._config
|
|
1368
1380
|
);
|
|
1369
|
-
this._configService.setConfig(
|
|
1381
|
+
this._configService.setConfig(Bt, t);
|
|
1370
1382
|
}
|
|
1371
1383
|
onStarting() {
|
|
1372
1384
|
[
|
|
@@ -1381,35 +1393,35 @@ let de = (V = class extends Pe {
|
|
|
1381
1393
|
[k]
|
|
1382
1394
|
]);
|
|
1383
1395
|
}
|
|
1384
|
-
}, S(
|
|
1385
|
-
de =
|
|
1386
|
-
ue(1,
|
|
1387
|
-
ue(2,
|
|
1396
|
+
}, S(W, "type", P.UNIVER_SHEET), S(W, "pluginName", we), W);
|
|
1397
|
+
de = qt([
|
|
1398
|
+
ue(1, T(Be)),
|
|
1399
|
+
ue(2, ze)
|
|
1388
1400
|
], de);
|
|
1389
1401
|
export {
|
|
1390
|
-
|
|
1402
|
+
rr as ClearSheetsFilterCriteriaCommand,
|
|
1391
1403
|
x as CustomFilterOperator,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1404
|
+
Ce as FILTER_MUTATIONS,
|
|
1405
|
+
b as FilterBy,
|
|
1406
|
+
wt as FilterColumn,
|
|
1395
1407
|
j as FilterModel,
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1408
|
+
nr as ReCalcSheetsFilterCommand,
|
|
1409
|
+
V as ReCalcSheetsFilterMutation,
|
|
1410
|
+
Lt as RemoveSheetFilterCommand,
|
|
1399
1411
|
O as RemoveSheetsFilterMutation,
|
|
1400
1412
|
we as SHEET_FILTER_SNAPSHOT_ID,
|
|
1401
|
-
|
|
1402
|
-
|
|
1413
|
+
bt as SetSheetFilterRangeCommand,
|
|
1414
|
+
tr as SetSheetsFilterCriteriaCommand,
|
|
1403
1415
|
p as SetSheetsFilterCriteriaMutation,
|
|
1404
|
-
|
|
1416
|
+
C as SetSheetsFilterRangeMutation,
|
|
1405
1417
|
M as SheetsFilterService,
|
|
1406
|
-
|
|
1418
|
+
er as SmartToggleSheetsFilterCommand,
|
|
1407
1419
|
de as UniverSheetsFilterPlugin,
|
|
1408
|
-
|
|
1420
|
+
Ct as equals,
|
|
1409
1421
|
oe as getCustomFilterFn,
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1422
|
+
ft as greaterThan,
|
|
1423
|
+
mt as greaterThanOrEqualTo,
|
|
1424
|
+
gt as lessThan,
|
|
1425
|
+
_t as lessThanOrEqualTo,
|
|
1426
|
+
Re as notEquals
|
|
1415
1427
|
};
|