@univerjs/sheets-table 0.10.12 → 0.10.13-nightly.202510290902
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 +1038 -946
- package/lib/index.js +1038 -946
- package/lib/types/controllers/sheets-table.controller.d.ts +4 -2
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
var Ze = Object.defineProperty;
|
|
2
2
|
var et = (t, e, n) => e in t ? Ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var b = (t, e, n) => et(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CellValueType as
|
|
5
|
-
import { getSheetCommandTarget as $, SheetInterceptorService as pe, INTERCEPTOR_POINT as Be, AddRangeThemeMutation as
|
|
6
|
-
import { Subject as
|
|
7
|
-
var M = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(M || {}),
|
|
8
|
-
function
|
|
4
|
+
import { CellValueType as q, BorderStyleTypes as tt, createREGEXFromWildChar as Z, generateRandomId as L, IUniverInstanceService as E, Inject as p, LocaleService as me, Disposable as Q, CommandType as N, IUndoRedoService as A, ICommandService as x, sequenceExecute as B, IResourceManagerService as nt, Rectangle as Se, RTree as st, InterceptorEffectEnum as rt, UniverInstanceType as z, customNameCharacterCheck as at, ILogService as ot, Injector as Ae, IConfigService as Ee, Plugin as it, merge as lt, registerDependencies as ut, touchDependencies as Ie } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as $, SheetInterceptorService as pe, INTERCEPTOR_POINT as Be, RemoveSheetCommand as ct, CopySheetCommand as dt, AddRangeThemeMutation as Le, RemoveRangeThemeMutation as We, SheetRangeThemeModel as He, SheetsSelectionsService as be, InsertRowMutation as Ve, RemoveRowMutation as Pe, getMoveRangeUndoRedoMutations as we, InsertColMutation as qe, RemoveColMutation as Je, IExclusiveRangeService as ht, RefRangeService as gt, RemoveColCommand as mt, RemoveRowCommand as bt, InsertColCommand as wt, InsertRowCommand as ft, SheetRangeThemeService as Rt, RangeThemeStyle as St, ZebraCrossingCacheController as Ct } from "@univerjs/sheets";
|
|
6
|
+
import { Subject as Y, BehaviorSubject as ke, filter as fe, switchMap as Me } from "rxjs";
|
|
7
|
+
var M = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(M || {}), y = /* @__PURE__ */ ((t) => (t.Row = "row", t.Col = "column", t))(y || {}), Qe = /* @__PURE__ */ ((t) => (t.None = "none", t.String = "string", t.Number = "number", t.Date = "date", t.Bool = "bool", t.Checkbox = "checkbox", t.List = "list", t))(Qe || {}), ne = /* @__PURE__ */ ((t) => (t.manual = "manual", t.condition = "condition", t))(ne || {}), O = /* @__PURE__ */ ((t) => (t.Date = "date", t.Number = "number", t.String = "string", t.Logic = "logic", t))(O || {}), F = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.GreaterThan = "greaterThan", t.GreaterThanOrEqual = "greaterThanOrEqual", t.LessThan = "lessThan", t.LessThanOrEqual = "lessThanOrEqual", t.Between = "between", t.NotBetween = "notBetween", t.Above = "above", t.Below = "below", t.TopN = "topN", t))(F || {}), V = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.Contains = "contains", t.NotContains = "notContains", t.StartsWith = "startsWith", t.EndsWith = "endsWith", t))(V || {}), m = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.After = "after", t.AfterOrEqual = "afterOrEqual", t.Before = "before", t.BeforeOrEqual = "beforeOrEqual", t.Between = "between", t.NotBetween = "notBetween", t.Today = "today", t.Yesterday = "yesterday", t.Tomorrow = "tomorrow", t.ThisWeek = "thisWeek", t.LastWeek = "lastWeek", t.NextWeek = "nextWeek", t.ThisMonth = "thisMonth", t.LastMonth = "lastMonth", t.NextMonth = "nextMonth", t.ThisQuarter = "thisQuarter", t.LastQuarter = "lastQuarter", t.NextQuarter = "nextQuarter", t.ThisYear = "thisYear", t.LastYear = "lastYear", t.NextYear = "nextYear", t.YearToDate = "yearToDate", t.Quarter = "quarter", t.Month = "month", t.M1 = "m1", t.M2 = "m2", t.M3 = "m3", t.M4 = "m4", t.M5 = "m5", t.M6 = "m6", t.M7 = "m7", t.M8 = "m8", t.M9 = "m9", t.M10 = "m10", t.M11 = "m11", t.M12 = "m12", t.Q1 = "q1", t.Q2 = "q2", t.Q3 = "q3", t.Q4 = "q4", t))(m || {}), P = /* @__PURE__ */ ((t) => (t[t.FilteredSortNone = 1] = "FilteredSortNone", t[t.FilteredSortAsc = 2] = "FilteredSortAsc", t[t.FilteredSortDesc = 3] = "FilteredSortDesc", t[t.FilterNoneSortNone = 4] = "FilterNoneSortNone", t[t.FilterNoneSortAsc = 5] = "FilterNoneSortAsc", t[t.FilterNoneSortDesc = 6] = "FilterNoneSortDesc", t))(P || {}), G = /* @__PURE__ */ ((t) => (t.Asc = "asc", t.Desc = "desc", t.None = "none", t))(G || {});
|
|
8
|
+
function te(t, e) {
|
|
9
9
|
return `${e} ${t}`;
|
|
10
10
|
}
|
|
11
|
-
const ve = "TRUE", Fe = "FALSE",
|
|
11
|
+
const ve = "TRUE", Fe = "FALSE", pt = (t) => {
|
|
12
12
|
var n;
|
|
13
13
|
return ((n = t.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "")) || "";
|
|
14
14
|
};
|
|
15
15
|
function Ye(t) {
|
|
16
16
|
if (t) {
|
|
17
|
-
const { v: e, t: n, p:
|
|
18
|
-
return
|
|
17
|
+
const { v: e, t: n, p: s } = t;
|
|
18
|
+
return s ? pt(s) : (n === q.FORCE_STRING || n === q.STRING) && e !== void 0 && e !== null ? String(e) : n === q.BOOLEAN ? e ? ve : Fe : n === q.NUMBER ? String(e) : typeof e === "boolean" ? e ? ve : Fe : e == null ? "" : String(e);
|
|
19
19
|
}
|
|
20
20
|
return "";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function _t(t, e) {
|
|
23
23
|
if (t != null)
|
|
24
24
|
switch (e) {
|
|
25
|
-
case
|
|
26
|
-
return
|
|
27
|
-
case
|
|
28
|
-
return
|
|
25
|
+
case G.Asc:
|
|
26
|
+
return P.FilteredSortAsc;
|
|
27
|
+
case G.Desc:
|
|
28
|
+
return P.FilteredSortDesc;
|
|
29
29
|
default:
|
|
30
|
-
return
|
|
30
|
+
return P.FilteredSortNone;
|
|
31
31
|
}
|
|
32
32
|
else
|
|
33
33
|
switch (e) {
|
|
34
|
-
case
|
|
35
|
-
return
|
|
36
|
-
case
|
|
37
|
-
return
|
|
34
|
+
case G.Asc:
|
|
35
|
+
return P.FilterNoneSortAsc;
|
|
36
|
+
case G.Desc:
|
|
37
|
+
return P.FilterNoneSortDesc;
|
|
38
38
|
default:
|
|
39
|
-
return
|
|
39
|
+
return P.FilterNoneSortNone;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return t ? t.filterType ===
|
|
42
|
+
function Tt(t) {
|
|
43
|
+
return t ? t.filterType === ne.condition : !1;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return t ? t.filterType ===
|
|
45
|
+
function rs(t) {
|
|
46
|
+
return t ? t.filterType === ne.manual : !1;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const D = {
|
|
49
49
|
s: tt.THIN,
|
|
50
50
|
cl: {
|
|
51
51
|
rgb: "rgb(95, 101, 116)"
|
|
52
52
|
}
|
|
53
|
-
}, Ge = "sheets-table.config",
|
|
53
|
+
}, Ge = "sheets-table.config", ye = {}, as = {
|
|
54
54
|
headerRowStyle: {
|
|
55
55
|
bd: {
|
|
56
|
-
t:
|
|
56
|
+
t: D
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
headerColumnStyle: {
|
|
60
60
|
bd: {
|
|
61
|
-
l:
|
|
61
|
+
l: D
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
lastColumnStyle: {
|
|
65
65
|
bd: {
|
|
66
|
-
r:
|
|
66
|
+
r: D
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
lastRowStyle: {
|
|
70
70
|
bd: {
|
|
71
|
-
b:
|
|
71
|
+
b: D
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
},
|
|
74
|
+
}, os = (t, e) => {
|
|
75
75
|
if (t === "headerRowStyle") {
|
|
76
76
|
if (!e.bd)
|
|
77
77
|
return {
|
|
78
78
|
...e,
|
|
79
79
|
bd: {
|
|
80
|
-
t:
|
|
80
|
+
t: D
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
} else if (t === "lastRowStyle") {
|
|
@@ -85,7 +85,7 @@ const N = {
|
|
|
85
85
|
return {
|
|
86
86
|
...e,
|
|
87
87
|
bd: {
|
|
88
|
-
b:
|
|
88
|
+
b: D
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
} else if (t === "lastColumnStyle") {
|
|
@@ -93,43 +93,43 @@ const N = {
|
|
|
93
93
|
return {
|
|
94
94
|
...e,
|
|
95
95
|
bd: {
|
|
96
|
-
r:
|
|
96
|
+
r: D
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
} else if (t === "headerColumnStyle" && !e.bd)
|
|
100
100
|
return {
|
|
101
101
|
...e,
|
|
102
102
|
bd: {
|
|
103
|
-
l:
|
|
103
|
+
l: D
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
return e;
|
|
107
|
-
},
|
|
107
|
+
}, It = [
|
|
108
108
|
[["#6280F9", "#FFFFFF", "#BAC6F8", "#D2DAFA"], ["#fff"]],
|
|
109
109
|
[["#16BDCA", "#FFFFFF", "#EDFAFA", "#AFECEF"], ["#000"]],
|
|
110
110
|
[["#31C48D", "#FFFFFF", "#F3FAF7", "#BCF0DA"], ["#fff"]],
|
|
111
111
|
[["#AC94FA", "#FFFFFF", "#F6F5FF", "#EDEBFE"], ["#fff"]],
|
|
112
112
|
[["#F17EBB", "#FFFFFF", "#FDF2F8", "#FCE8F3"], ["#fff"]],
|
|
113
113
|
[["#F98080", "#FFFFFF", "#FDF2F2", "#FDE8E8"], ["#fff"]]
|
|
114
|
-
], ze =
|
|
115
|
-
const [n,
|
|
114
|
+
], ze = It.map((t, e) => {
|
|
115
|
+
const [n, s] = t, [r, a, o, u] = n, [i] = s;
|
|
116
116
|
return {
|
|
117
117
|
name: `table-default-${e}`,
|
|
118
118
|
style: {
|
|
119
119
|
headerRowStyle: {
|
|
120
120
|
bg: {
|
|
121
|
-
rgb:
|
|
121
|
+
rgb: r
|
|
122
122
|
},
|
|
123
123
|
cl: {
|
|
124
|
-
rgb:
|
|
124
|
+
rgb: i
|
|
125
125
|
},
|
|
126
126
|
bd: {
|
|
127
|
-
t:
|
|
127
|
+
t: D
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
headerColumnStyle: {
|
|
131
131
|
bd: {
|
|
132
|
-
l:
|
|
132
|
+
l: D
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
firstRowStyle: {
|
|
@@ -147,18 +147,18 @@ const N = {
|
|
|
147
147
|
rgb: u
|
|
148
148
|
},
|
|
149
149
|
bd: {
|
|
150
|
-
b:
|
|
150
|
+
b: D
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
lastColumnStyle: {
|
|
154
154
|
bd: {
|
|
155
|
-
r:
|
|
155
|
+
r: D
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
});
|
|
161
|
-
class
|
|
161
|
+
class j {
|
|
162
162
|
constructor(e, n) {
|
|
163
163
|
b(this, "dataType");
|
|
164
164
|
b(this, "id");
|
|
@@ -191,215 +191,215 @@ class Y {
|
|
|
191
191
|
this.id = e.id, this.displayName = e.displayName, this.dataType = e.dataType, this.formula = e.formula, this.meta = e.meta, this.style = e.style;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const Mt = (t) => t.getMonth() <= 2, vt = (t) => {
|
|
195
195
|
const e = t.getMonth();
|
|
196
196
|
return e > 2 && e <= 5;
|
|
197
|
-
},
|
|
197
|
+
}, Ft = (t) => {
|
|
198
198
|
const e = t.getMonth();
|
|
199
199
|
return e > 5 && e <= 8;
|
|
200
|
-
},
|
|
200
|
+
}, yt = (t) => {
|
|
201
201
|
const e = t.getMonth();
|
|
202
202
|
return e > 8 && e <= 11;
|
|
203
|
-
},
|
|
203
|
+
}, Nt = (t) => t.getMonth() === 0, Dt = (t) => t.getMonth() === 1, xt = (t) => t.getMonth() === 2, Ot = (t) => t.getMonth() === 3, Ut = (t) => t.getMonth() === 4, $t = (t) => t.getMonth() === 5, At = (t) => t.getMonth() === 6, Et = (t) => t.getMonth() === 7, Bt = (t) => t.getMonth() === 8, Lt = (t) => t.getMonth() === 9, Wt = (t) => t.getMonth() === 10, Ht = (t) => t.getMonth() === 11, Vt = (t, e = /* @__PURE__ */ new Date()) => t.toDateString() === e.toDateString(), Pt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
204
204
|
const n = new Date(e);
|
|
205
205
|
return n.setDate(n.getDate() + 1), t.toDateString() === n.toDateString();
|
|
206
|
-
},
|
|
206
|
+
}, qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
207
207
|
const n = new Date(e);
|
|
208
208
|
return n.setDate(n.getDate() - 1), t.toDateString() === n.toDateString();
|
|
209
|
-
},
|
|
210
|
-
const e = t.getDay(), n = t.getDate() - e + (e === 0 ? -6 : 1),
|
|
211
|
-
return
|
|
212
|
-
}, je = 10080 * 60 * 1e3,
|
|
213
|
-
const n =
|
|
214
|
-
return n.toDateString() ===
|
|
215
|
-
}, qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
216
|
-
const n = G(t), r = new Date(G(e).getTime() + je);
|
|
217
|
-
return n.toDateString() === r.toDateString();
|
|
209
|
+
}, K = (t) => {
|
|
210
|
+
const e = t.getDay(), n = t.getDate() - e + (e === 0 ? -6 : 1), s = new Date(t);
|
|
211
|
+
return s.setDate(n), s;
|
|
212
|
+
}, je = 10080 * 60 * 1e3, Jt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
213
|
+
const n = K(t), s = K(e);
|
|
214
|
+
return n.toDateString() === s.toDateString();
|
|
218
215
|
}, kt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
219
|
-
const n =
|
|
220
|
-
return n.toDateString() ===
|
|
221
|
-
},
|
|
216
|
+
const n = K(t), s = new Date(K(e).getTime() + je);
|
|
217
|
+
return n.toDateString() === s.toDateString();
|
|
218
|
+
}, Qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
219
|
+
const n = K(t), s = new Date(K(e).getTime() - je);
|
|
220
|
+
return n.toDateString() === s.toDateString();
|
|
221
|
+
}, Yt = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth(), Gt = (t) => {
|
|
222
222
|
const e = new Date(t);
|
|
223
223
|
return e.setHours(0, 0, 0, 0), e.setDate(1), e;
|
|
224
|
-
},
|
|
224
|
+
}, zt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
225
225
|
const n = new Date(e);
|
|
226
226
|
n.setHours(0, 0, 0, 0), n.setMonth(n.getMonth() + 1, 1);
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
return
|
|
231
|
-
},
|
|
232
|
-
const n =
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
return
|
|
227
|
+
const s = new Date(n);
|
|
228
|
+
s.setMonth(s.getMonth() + 1, 0);
|
|
229
|
+
const r = t.getTime();
|
|
230
|
+
return r >= n.getTime() && r < s.getTime();
|
|
231
|
+
}, jt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
232
|
+
const n = Gt(e), s = new Date(n);
|
|
233
|
+
s.setMonth(s.getMonth() + 1, 0);
|
|
234
|
+
const r = t.getTime();
|
|
235
|
+
return r >= n.getTime() && r < s.getTime();
|
|
236
236
|
}, _e = (t) => {
|
|
237
237
|
const e = new Date(t);
|
|
238
238
|
e.setHours(0, 0, 0, 0), e.setDate(1);
|
|
239
239
|
const n = e.getMonth();
|
|
240
240
|
return e.setMonth(n - n % 3), e;
|
|
241
|
-
}, zt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
242
|
-
const n = _e(e), r = new Date(n);
|
|
243
|
-
r.setMonth(r.getMonth() + 3);
|
|
244
|
-
const s = t.getTime();
|
|
245
|
-
return s >= n.getTime() && s < r.getTime();
|
|
246
|
-
}, jt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
247
|
-
const n = _e(e), r = new Date(n);
|
|
248
|
-
r.setMonth(r.getMonth() + 3);
|
|
249
|
-
const s = new Date(r);
|
|
250
|
-
s.setMonth(s.getMonth() + 3, 0);
|
|
251
|
-
const a = t.getTime();
|
|
252
|
-
return a >= r.getTime() && a < s.getTime();
|
|
253
241
|
}, Kt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
254
|
-
const n = _e(e),
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
s.
|
|
242
|
+
const n = _e(e), s = new Date(n);
|
|
243
|
+
s.setMonth(s.getMonth() + 3);
|
|
244
|
+
const r = t.getTime();
|
|
245
|
+
return r >= n.getTime() && r < s.getTime();
|
|
246
|
+
}, Xt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
247
|
+
const n = _e(e), s = new Date(n);
|
|
248
|
+
s.setMonth(s.getMonth() + 3);
|
|
249
|
+
const r = new Date(s);
|
|
250
|
+
r.setMonth(r.getMonth() + 3, 0);
|
|
251
|
+
const a = t.getTime();
|
|
252
|
+
return a >= s.getTime() && a < r.getTime();
|
|
253
|
+
}, Zt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
254
|
+
const n = _e(e), s = new Date(n);
|
|
255
|
+
s.setMonth(s.getMonth() - 3);
|
|
256
|
+
const r = new Date(n);
|
|
257
|
+
r.setDate(0);
|
|
258
258
|
const a = t.getTime();
|
|
259
|
-
return a >=
|
|
260
|
-
},
|
|
259
|
+
return a >= s.getTime() && a < r.getTime();
|
|
260
|
+
}, en = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear(), tn = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear() + 1, nn = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear() - 1, sn = (t, e = /* @__PURE__ */ new Date()) => {
|
|
261
261
|
const n = new Date(e);
|
|
262
262
|
n.setHours(0, 0, 0, 0), n.setMonth(0, 1);
|
|
263
|
-
const
|
|
264
|
-
return
|
|
263
|
+
const s = t.getTime();
|
|
264
|
+
return s >= n.getTime() && s < e.getTime();
|
|
265
265
|
};
|
|
266
|
-
function
|
|
266
|
+
function rn(t) {
|
|
267
267
|
switch (t.compareType) {
|
|
268
|
-
case
|
|
268
|
+
case m.Equal: {
|
|
269
269
|
const e = new Date(t.expectedValue);
|
|
270
270
|
return (n) => n.getTime() === e.getTime();
|
|
271
271
|
}
|
|
272
|
-
case
|
|
272
|
+
case m.NotEqual: {
|
|
273
273
|
const e = new Date(t.expectedValue);
|
|
274
274
|
return (n) => n.getTime() !== e.getTime();
|
|
275
275
|
}
|
|
276
|
-
case
|
|
276
|
+
case m.After: {
|
|
277
277
|
const e = new Date(t.expectedValue);
|
|
278
278
|
return (n) => n.getTime() > e.getTime();
|
|
279
279
|
}
|
|
280
|
-
case
|
|
280
|
+
case m.Before: {
|
|
281
281
|
const e = new Date(t.expectedValue);
|
|
282
282
|
return (n) => n.getTime() < e.getTime();
|
|
283
283
|
}
|
|
284
|
-
case
|
|
284
|
+
case m.AfterOrEqual: {
|
|
285
285
|
const e = new Date(t.expectedValue);
|
|
286
286
|
return (n) => n.getTime() >= e.getTime();
|
|
287
287
|
}
|
|
288
|
-
case
|
|
288
|
+
case m.BeforeOrEqual: {
|
|
289
289
|
const e = new Date(t.expectedValue);
|
|
290
290
|
return (n) => n.getTime() <= e.getTime();
|
|
291
291
|
}
|
|
292
|
-
case
|
|
292
|
+
case m.Between:
|
|
293
293
|
return (e) => {
|
|
294
|
-
const [n,
|
|
295
|
-
return e.getTime() >= new Date(n).getTime() && e.getTime() <= new Date(
|
|
294
|
+
const [n, s] = t.expectedValue;
|
|
295
|
+
return e.getTime() >= new Date(n).getTime() && e.getTime() <= new Date(s).getTime();
|
|
296
296
|
};
|
|
297
|
-
case
|
|
297
|
+
case m.NotBetween:
|
|
298
298
|
return (e) => {
|
|
299
|
-
const [n,
|
|
300
|
-
return e.getTime() < new Date(n).getTime() || e.getTime() > new Date(
|
|
299
|
+
const [n, s] = t.expectedValue;
|
|
300
|
+
return e.getTime() < new Date(n).getTime() || e.getTime() > new Date(s).getTime();
|
|
301
301
|
};
|
|
302
|
-
case
|
|
303
|
-
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
304
|
-
return (n) => Wt(n, e);
|
|
305
|
-
}
|
|
306
|
-
case g.Yesterday: {
|
|
302
|
+
case m.Today: {
|
|
307
303
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
308
304
|
return (n) => Vt(n, e);
|
|
309
305
|
}
|
|
310
|
-
case
|
|
306
|
+
case m.Yesterday: {
|
|
311
307
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
312
|
-
return (n) =>
|
|
308
|
+
return (n) => qt(n, e);
|
|
313
309
|
}
|
|
314
|
-
case
|
|
310
|
+
case m.Tomorrow: {
|
|
315
311
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
316
312
|
return (n) => Pt(n, e);
|
|
317
313
|
}
|
|
318
|
-
case
|
|
314
|
+
case m.ThisWeek: {
|
|
319
315
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
320
|
-
return (n) =>
|
|
316
|
+
return (n) => Jt(n, e);
|
|
321
317
|
}
|
|
322
|
-
case
|
|
318
|
+
case m.LastWeek: {
|
|
323
319
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
324
|
-
return (n) =>
|
|
320
|
+
return (n) => Qt(n, e);
|
|
325
321
|
}
|
|
326
|
-
case
|
|
322
|
+
case m.NextWeek: {
|
|
327
323
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
328
|
-
return (n) =>
|
|
324
|
+
return (n) => kt(n, e);
|
|
329
325
|
}
|
|
330
|
-
case
|
|
326
|
+
case m.ThisMonth: {
|
|
331
327
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
332
|
-
return (n) =>
|
|
328
|
+
return (n) => Yt(n, e);
|
|
333
329
|
}
|
|
334
|
-
case
|
|
330
|
+
case m.LastMonth: {
|
|
335
331
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
336
|
-
return (n) =>
|
|
332
|
+
return (n) => jt(n, e);
|
|
337
333
|
}
|
|
338
|
-
case
|
|
334
|
+
case m.NextMonth: {
|
|
339
335
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
340
336
|
return (n) => zt(n, e);
|
|
341
337
|
}
|
|
342
|
-
case
|
|
338
|
+
case m.ThisQuarter: {
|
|
343
339
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
344
340
|
return (n) => Kt(n, e);
|
|
345
341
|
}
|
|
346
|
-
case
|
|
342
|
+
case m.LastQuarter: {
|
|
347
343
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
348
|
-
return (n) =>
|
|
344
|
+
return (n) => Zt(n, e);
|
|
349
345
|
}
|
|
350
|
-
case
|
|
346
|
+
case m.NextQuarter: {
|
|
351
347
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
352
348
|
return (n) => Xt(n, e);
|
|
353
349
|
}
|
|
354
|
-
case
|
|
350
|
+
case m.ThisYear: {
|
|
355
351
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
356
352
|
return (n) => en(n, e);
|
|
357
353
|
}
|
|
358
|
-
case
|
|
354
|
+
case m.LastYear: {
|
|
359
355
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
360
|
-
return (n) =>
|
|
356
|
+
return (n) => nn(n, e);
|
|
361
357
|
}
|
|
362
|
-
case
|
|
358
|
+
case m.NextYear: {
|
|
363
359
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
364
360
|
return (n) => tn(n, e);
|
|
365
361
|
}
|
|
366
|
-
case
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
case
|
|
371
|
-
return yt;
|
|
372
|
-
case g.M4:
|
|
362
|
+
case m.YearToDate: {
|
|
363
|
+
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
364
|
+
return (n) => sn(n, e);
|
|
365
|
+
}
|
|
366
|
+
case m.M1:
|
|
373
367
|
return Nt;
|
|
374
|
-
case
|
|
368
|
+
case m.M2:
|
|
369
|
+
return Dt;
|
|
370
|
+
case m.M3:
|
|
375
371
|
return xt;
|
|
376
|
-
case
|
|
372
|
+
case m.M4:
|
|
377
373
|
return Ot;
|
|
378
|
-
case
|
|
374
|
+
case m.M5:
|
|
379
375
|
return Ut;
|
|
380
|
-
case
|
|
376
|
+
case m.M6:
|
|
381
377
|
return $t;
|
|
382
|
-
case
|
|
378
|
+
case m.M7:
|
|
383
379
|
return At;
|
|
384
|
-
case
|
|
385
|
-
return Lt;
|
|
386
|
-
case g.M11:
|
|
387
|
-
return Bt;
|
|
388
|
-
case g.M12:
|
|
380
|
+
case m.M8:
|
|
389
381
|
return Et;
|
|
390
|
-
case
|
|
391
|
-
return
|
|
392
|
-
case
|
|
393
|
-
return
|
|
394
|
-
case
|
|
382
|
+
case m.M9:
|
|
383
|
+
return Bt;
|
|
384
|
+
case m.M10:
|
|
385
|
+
return Lt;
|
|
386
|
+
case m.M11:
|
|
387
|
+
return Wt;
|
|
388
|
+
case m.M12:
|
|
389
|
+
return Ht;
|
|
390
|
+
case m.Q1:
|
|
395
391
|
return Mt;
|
|
396
|
-
case
|
|
392
|
+
case m.Q2:
|
|
397
393
|
return vt;
|
|
394
|
+
case m.Q3:
|
|
395
|
+
return Ft;
|
|
396
|
+
case m.Q4:
|
|
397
|
+
return yt;
|
|
398
398
|
default:
|
|
399
399
|
throw new Error("Unsupported compare type");
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
class
|
|
402
|
+
class an {
|
|
403
403
|
/**
|
|
404
404
|
* Initializes a new instance of the Heap class.
|
|
405
405
|
*/
|
|
@@ -413,8 +413,8 @@ class rn {
|
|
|
413
413
|
* @param index2 The index of the second element.
|
|
414
414
|
*/
|
|
415
415
|
swap(e, n) {
|
|
416
|
-
const
|
|
417
|
-
this.heap[e] = this.heap[n], this.heap[n] =
|
|
416
|
+
const s = this.heap[e];
|
|
417
|
+
this.heap[e] = this.heap[n], this.heap[n] = s;
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* Returns the index of the parent node for the given index.
|
|
@@ -463,7 +463,7 @@ class rn {
|
|
|
463
463
|
return this.heap.includes(e);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
class
|
|
466
|
+
class on extends an {
|
|
467
467
|
/**
|
|
468
468
|
* Initializes a new instance of the MinHeap class.
|
|
469
469
|
*/
|
|
@@ -485,8 +485,8 @@ class sn extends rn {
|
|
|
485
485
|
* @param index The index of the element to be shifted down.
|
|
486
486
|
*/
|
|
487
487
|
shiftDown(e) {
|
|
488
|
-
const n = this.getLeftIndex(e),
|
|
489
|
-
this.heap[n] < this.heap[e] && (this.swap(n, e), this.shiftDown(n)), this.heap[
|
|
488
|
+
const n = this.getLeftIndex(e), s = this.getRightIndex(e);
|
|
489
|
+
this.heap[n] < this.heap[e] && (this.swap(n, e), this.shiftDown(n)), this.heap[s] < this.heap[e] && (this.swap(s, e), this.shiftDown(s));
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* Inserts a new value into the min heap.
|
|
@@ -502,146 +502,146 @@ class sn extends rn {
|
|
|
502
502
|
this.heap[0] = this.heap.pop(), this.shiftDown(0);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
const
|
|
506
|
-
const n = new
|
|
507
|
-
for (const
|
|
508
|
-
n.insert(
|
|
505
|
+
const ln = (t, e) => {
|
|
506
|
+
const n = new on();
|
|
507
|
+
for (const s of t)
|
|
508
|
+
n.insert(s), n.size() > e && n.pop();
|
|
509
509
|
return n.heap;
|
|
510
|
-
},
|
|
511
|
-
function
|
|
510
|
+
}, un = (t, e) => t > e, cn = (t, e) => t < e, dn = (t, e, n) => ln(t, e).includes(n);
|
|
511
|
+
function hn(t, e) {
|
|
512
512
|
switch (t.compareType) {
|
|
513
513
|
case F.Equal: {
|
|
514
514
|
const n = Number(t.expectedValue);
|
|
515
|
-
return (
|
|
515
|
+
return (s) => s === n;
|
|
516
516
|
}
|
|
517
517
|
case F.NotEqual: {
|
|
518
518
|
const n = Number(t.expectedValue);
|
|
519
|
-
return (
|
|
519
|
+
return (s) => s !== n;
|
|
520
520
|
}
|
|
521
521
|
case F.GreaterThan: {
|
|
522
522
|
const n = Number(t.expectedValue);
|
|
523
|
-
return (
|
|
523
|
+
return (s) => s > n;
|
|
524
524
|
}
|
|
525
525
|
case F.GreaterThanOrEqual: {
|
|
526
526
|
const n = Number(t.expectedValue);
|
|
527
|
-
return (
|
|
527
|
+
return (s) => s >= n;
|
|
528
528
|
}
|
|
529
529
|
case F.LessThan: {
|
|
530
530
|
const n = Number(t.expectedValue);
|
|
531
|
-
return (
|
|
531
|
+
return (s) => s < n;
|
|
532
532
|
}
|
|
533
533
|
case F.LessThanOrEqual: {
|
|
534
534
|
const n = Number(t.expectedValue);
|
|
535
|
-
return (
|
|
535
|
+
return (s) => s <= n;
|
|
536
536
|
}
|
|
537
537
|
case F.Between: {
|
|
538
|
-
const [n,
|
|
539
|
-
return
|
|
538
|
+
const [n, s] = t.expectedValue, r = Number(n), a = Number(s);
|
|
539
|
+
return r > a ? (o) => o >= a && o <= r : (o) => o >= r && o <= a;
|
|
540
540
|
}
|
|
541
541
|
case F.NotBetween: {
|
|
542
|
-
const [n,
|
|
543
|
-
return
|
|
542
|
+
const [n, s] = t.expectedValue, r = Number(n), a = Number(s);
|
|
543
|
+
return r > a ? (o) => o < a || o > r : (o) => o < r || o > a;
|
|
544
544
|
}
|
|
545
545
|
case F.Above: {
|
|
546
546
|
const n = e.average;
|
|
547
|
-
return (
|
|
547
|
+
return (s) => un(s, n);
|
|
548
548
|
}
|
|
549
549
|
case F.Below: {
|
|
550
550
|
const n = e.average;
|
|
551
|
-
return (
|
|
551
|
+
return (s) => cn(s, n);
|
|
552
552
|
}
|
|
553
553
|
case F.TopN: {
|
|
554
|
-
const n = e.list,
|
|
555
|
-
return (
|
|
554
|
+
const n = e.list, s = Number(t.expectedValue);
|
|
555
|
+
return (r) => dn(n, s, r);
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
const
|
|
560
|
-
function
|
|
559
|
+
const gn = (t, e) => Z(e).test(t), mn = (t, e) => !Z(e).test(t), bn = (t, e) => Z(`*${e}*`).test(t), wn = (t, e) => !Z(`*${e}*`).test(t), fn = (t, e) => Z(`${e}*`).test(t), Rn = (t, e) => Z(`*${e}`).test(t);
|
|
560
|
+
function Sn(t) {
|
|
561
561
|
switch (t.compareType) {
|
|
562
|
-
case
|
|
563
|
-
return (e) => dn(e, t.expectedValue);
|
|
564
|
-
case H.NotEqual:
|
|
565
|
-
return (e) => hn(e, t.expectedValue);
|
|
566
|
-
case H.Contains:
|
|
562
|
+
case V.Equal:
|
|
567
563
|
return (e) => gn(e, t.expectedValue);
|
|
568
|
-
case
|
|
564
|
+
case V.NotEqual:
|
|
569
565
|
return (e) => mn(e, t.expectedValue);
|
|
570
|
-
case
|
|
566
|
+
case V.Contains:
|
|
571
567
|
return (e) => bn(e, t.expectedValue);
|
|
572
|
-
case
|
|
568
|
+
case V.NotContains:
|
|
573
569
|
return (e) => wn(e, t.expectedValue);
|
|
570
|
+
case V.StartsWith:
|
|
571
|
+
return (e) => fn(e, t.expectedValue);
|
|
572
|
+
case V.EndsWith:
|
|
573
|
+
return (e) => Rn(e, t.expectedValue);
|
|
574
574
|
default:
|
|
575
575
|
return console.error(`Unknown filter operator: ${t.compareType}`), (e) => !0;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
const
|
|
578
|
+
const Cn = /* @__PURE__ */ new Set([
|
|
579
579
|
F.Above,
|
|
580
580
|
F.Below,
|
|
581
581
|
F.TopN
|
|
582
582
|
]);
|
|
583
|
-
|
|
583
|
+
m.Today, m.Yesterday, m.Tomorrow, m.ThisWeek, m.LastWeek, m.NextWeek, m.ThisMonth, m.LastMonth, m.NextMonth, m.ThisQuarter, m.LastQuarter, m.NextQuarter, m.NextYear, m.ThisYear, m.LastYear, m.YearToDate;
|
|
584
584
|
function Ke(t) {
|
|
585
|
-
return
|
|
585
|
+
return Cn.has(t);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function pn(t, e) {
|
|
588
588
|
if (Ke(t.filterInfo.compareType))
|
|
589
589
|
return (n) => !0;
|
|
590
590
|
switch (t.filterInfo.conditionType) {
|
|
591
591
|
case O.Date:
|
|
592
|
-
return
|
|
592
|
+
return rn(t.filterInfo);
|
|
593
593
|
case O.Number:
|
|
594
|
-
return
|
|
594
|
+
return hn(t.filterInfo, e);
|
|
595
595
|
case O.String:
|
|
596
|
-
return
|
|
596
|
+
return Sn(t.filterInfo);
|
|
597
597
|
case O.Logic:
|
|
598
598
|
default:
|
|
599
599
|
return (n) => !0;
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
function
|
|
603
|
-
switch (
|
|
602
|
+
function ue(t, e, n, s) {
|
|
603
|
+
switch (s) {
|
|
604
604
|
case O.Date: {
|
|
605
|
-
const
|
|
606
|
-
return
|
|
605
|
+
const r = Ne(t, e, n);
|
|
606
|
+
return r ? In(r) : null;
|
|
607
607
|
}
|
|
608
608
|
case O.Number:
|
|
609
|
-
return
|
|
609
|
+
return Ne(t, e, n);
|
|
610
610
|
case O.String:
|
|
611
611
|
default:
|
|
612
|
-
return
|
|
612
|
+
return Tn(t, e, n);
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
|
-
const
|
|
615
|
+
const _n = (t) => {
|
|
616
616
|
var n;
|
|
617
617
|
return ((n = t.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "")) || "";
|
|
618
618
|
};
|
|
619
|
-
function
|
|
620
|
-
const
|
|
621
|
-
if (!
|
|
622
|
-
const { v:
|
|
619
|
+
function Tn(t, e, n) {
|
|
620
|
+
const s = t.getCell(e, n);
|
|
621
|
+
if (!s) return null;
|
|
622
|
+
const { v: r, t: a, p: o } = s;
|
|
623
623
|
if (o)
|
|
624
|
-
return
|
|
625
|
-
if (typeof
|
|
626
|
-
return a ===
|
|
627
|
-
if (typeof
|
|
628
|
-
return a ===
|
|
629
|
-
if (typeof
|
|
630
|
-
if (
|
|
631
|
-
return String(
|
|
624
|
+
return _n(o);
|
|
625
|
+
if (typeof r == "string")
|
|
626
|
+
return a === q.BOOLEAN ? r.toUpperCase() : r;
|
|
627
|
+
if (typeof r == "number")
|
|
628
|
+
return a === q.BOOLEAN ? r ? "TRUE" : "FALSE" : r;
|
|
629
|
+
if (typeof r == "boolean") return r ? "TRUE" : "FALSE";
|
|
630
|
+
if (r !== void 0)
|
|
631
|
+
return String(r);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
const
|
|
635
|
-
if (!
|
|
636
|
-
const { v:
|
|
637
|
-
return o ? null : typeof
|
|
633
|
+
function Ne(t, e, n) {
|
|
634
|
+
const s = t.getCell(e, n);
|
|
635
|
+
if (!s) return null;
|
|
636
|
+
const { v: r, t: a, p: o } = s;
|
|
637
|
+
return o ? null : typeof r == "string" && a === q.NUMBER ? Number(t.getCellRaw(e, n).v) : Number(r);
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function In(t) {
|
|
640
640
|
const e = new Date(Date.UTC(1900, 0, 1, 0, 0, 0)), n = new Date(Date.UTC(1900, 1, 28, 0, 0, 0));
|
|
641
|
-
let
|
|
642
|
-
return
|
|
641
|
+
let s = t - 1;
|
|
642
|
+
return s > (n.getTime() - e.getTime()) / (1e3 * 3600 * 24) && (s -= 1), s < 0 && (s = t), new Date(e.getTime() + s * (1e3 * 3600 * 24));
|
|
643
643
|
}
|
|
644
|
-
class
|
|
644
|
+
class De {
|
|
645
645
|
constructor() {
|
|
646
646
|
b(this, "_tableColumnFilterList");
|
|
647
647
|
b(this, "_tableSortInfo");
|
|
@@ -658,58 +658,58 @@ class Ne {
|
|
|
658
658
|
return this._tableColumnFilterList[e];
|
|
659
659
|
}
|
|
660
660
|
getFilterState(e) {
|
|
661
|
-
var
|
|
662
|
-
const n = ((
|
|
663
|
-
return
|
|
661
|
+
var s;
|
|
662
|
+
const n = ((s = this._tableSortInfo) == null ? void 0 : s.columnIndex) === e ? this._tableSortInfo.sortState : G.None;
|
|
663
|
+
return _t(this._tableColumnFilterList[e], n);
|
|
664
664
|
}
|
|
665
665
|
getSortState() {
|
|
666
666
|
var e;
|
|
667
667
|
return (e = this._tableSortInfo) != null ? e : {};
|
|
668
668
|
}
|
|
669
669
|
getFilterStates(e) {
|
|
670
|
-
const n = [], { startColumn:
|
|
671
|
-
for (let a =
|
|
672
|
-
n.push(this.getFilterState(a -
|
|
670
|
+
const n = [], { startColumn: s, endColumn: r } = e;
|
|
671
|
+
for (let a = s; a <= r; a++)
|
|
672
|
+
n.push(this.getFilterState(a - s));
|
|
673
673
|
return n;
|
|
674
674
|
}
|
|
675
675
|
getFilterOutRows() {
|
|
676
676
|
return this._filterOutRows;
|
|
677
677
|
}
|
|
678
678
|
doFilter(e, n) {
|
|
679
|
-
const
|
|
680
|
-
for (let a = 0; a <
|
|
681
|
-
|
|
682
|
-
return this._filterOutRows =
|
|
679
|
+
const s = /* @__PURE__ */ new Set(), r = this._tableColumnFilterList;
|
|
680
|
+
for (let a = 0; a < r.length; a++)
|
|
681
|
+
r[a] && this.doColumnFilter(e, n, a, s);
|
|
682
|
+
return this._filterOutRows = s, s;
|
|
683
683
|
}
|
|
684
|
-
doColumnFilter(e, n,
|
|
685
|
-
const a = this._tableColumnFilterList[
|
|
684
|
+
doColumnFilter(e, n, s, r) {
|
|
685
|
+
const a = this._tableColumnFilterList[s];
|
|
686
686
|
if (a && e) {
|
|
687
|
-
const { startRow: o, endRow: u, startColumn:
|
|
687
|
+
const { startRow: o, endRow: u, startColumn: i } = n, l = i + s, h = this.getExecuteFunc(e, n, s, a);
|
|
688
688
|
for (let d = o; d <= u; d++) {
|
|
689
|
-
const c =
|
|
690
|
-
|
|
689
|
+
const c = Tt(a) ? a.filterInfo.conditionType : O.String;
|
|
690
|
+
ue(e, d, l, c) === null ? r.add(d) : h(ue(e, d, l, c)) || r.add(d);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
_getNumberCalculatedOptions(e, n,
|
|
695
|
-
const { startRow:
|
|
696
|
-
let
|
|
697
|
-
for (let d =
|
|
698
|
-
const c =
|
|
699
|
-
c !== null && (
|
|
694
|
+
_getNumberCalculatedOptions(e, n, s) {
|
|
695
|
+
const { startRow: r, endRow: a, startColumn: o } = n, u = o + s, i = [];
|
|
696
|
+
let l = 0, h = 0;
|
|
697
|
+
for (let d = r; d <= a; d++) {
|
|
698
|
+
const c = ue(e, d, u, O.Number);
|
|
699
|
+
c !== null && (i.push(c), l++, h += c);
|
|
700
700
|
}
|
|
701
701
|
return {
|
|
702
|
-
list:
|
|
703
|
-
average:
|
|
702
|
+
list: i,
|
|
703
|
+
average: l > 0 ? h / l : 0
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
|
-
getExecuteFunc(e, n,
|
|
707
|
-
if (
|
|
708
|
-
const a = new Set(
|
|
706
|
+
getExecuteFunc(e, n, s, r) {
|
|
707
|
+
if (r.filterType === ne.manual) {
|
|
708
|
+
const a = new Set(r.values);
|
|
709
709
|
return (o) => a.has(o);
|
|
710
|
-
} else if (
|
|
711
|
-
const o = Ke(
|
|
712
|
-
return
|
|
710
|
+
} else if (r.filterType === ne.condition) {
|
|
711
|
+
const o = Ke(r.filterInfo.compareType) ? this._getNumberCalculatedOptions(e, n, s) : void 0;
|
|
712
|
+
return pn(r, o);
|
|
713
713
|
} else
|
|
714
714
|
return (a) => !0;
|
|
715
715
|
}
|
|
@@ -728,7 +728,7 @@ class Ne {
|
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
class xe {
|
|
731
|
-
constructor(e, n,
|
|
731
|
+
constructor(e, n, s, r, a = {}) {
|
|
732
732
|
b(this, "_id");
|
|
733
733
|
b(this, "_name");
|
|
734
734
|
/**
|
|
@@ -743,21 +743,21 @@ class xe {
|
|
|
743
743
|
b(this, "tableMeta");
|
|
744
744
|
b(this, "_tableFilters");
|
|
745
745
|
b(this, "_subUnitId");
|
|
746
|
-
this._id = e, this._range =
|
|
746
|
+
this._id = e, this._range = s, this._name = n, this._tableFilters = new De(), this._init(r, a);
|
|
747
747
|
}
|
|
748
748
|
_init(e, n) {
|
|
749
749
|
var o, u;
|
|
750
750
|
this._tableStyleId = n == null ? void 0 : n.tableStyleId, this._showHeader = (o = n == null ? void 0 : n.showHeader) != null ? o : !0, this._showFooter = !1;
|
|
751
|
-
const
|
|
752
|
-
for (let
|
|
753
|
-
const
|
|
751
|
+
const s = this.getRange(), r = s.startColumn, a = s.endColumn;
|
|
752
|
+
for (let i = r; i <= a; i++) {
|
|
753
|
+
const l = i - r;
|
|
754
754
|
let h, d;
|
|
755
|
-
(u = n.columns) != null && u[
|
|
756
|
-
const c = new
|
|
755
|
+
(u = n.columns) != null && u[l] ? (h = n.columns[l].id, d = n.columns[l].displayName) : (h = L(), d = e[i - r]);
|
|
756
|
+
const c = new j(h, d);
|
|
757
757
|
this._columns.set(h, c), this._columnOrder.push(h);
|
|
758
758
|
}
|
|
759
|
-
n.filters && n.filters.forEach((
|
|
760
|
-
|
|
759
|
+
n.filters && n.filters.forEach((l, h) => {
|
|
760
|
+
l && this._tableFilters.setColumnFilter(h, l);
|
|
761
761
|
});
|
|
762
762
|
}
|
|
763
763
|
setTableFilterColumn(e, n) {
|
|
@@ -770,26 +770,26 @@ class xe {
|
|
|
770
770
|
return this._tableFilters;
|
|
771
771
|
}
|
|
772
772
|
getTableFilterRange() {
|
|
773
|
-
const e = this.getRange(), n = this.isShowHeader(),
|
|
773
|
+
const e = this.getRange(), n = this.isShowHeader(), s = this.isShowFooter(), { startRow: r, startColumn: a, endRow: o, endColumn: u } = e, i = n ? r + 1 : r, l = s ? o - 1 : o;
|
|
774
774
|
return {
|
|
775
|
-
startRow:
|
|
775
|
+
startRow: i,
|
|
776
776
|
startColumn: a,
|
|
777
|
-
endRow:
|
|
777
|
+
endRow: l,
|
|
778
778
|
endColumn: u
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
781
|
setColumns(e) {
|
|
782
782
|
this._columns.clear(), this._columnOrder = [], e.forEach((n) => {
|
|
783
|
-
const
|
|
784
|
-
|
|
783
|
+
const s = new j(n.id, n.displayName);
|
|
784
|
+
s.fromJSON(n), this._columns.set(n.id, s), this._columnOrder.push(n.id);
|
|
785
785
|
});
|
|
786
786
|
}
|
|
787
787
|
getColumnsCount() {
|
|
788
788
|
return this._columnOrder.length;
|
|
789
789
|
}
|
|
790
790
|
insertColumn(e, n) {
|
|
791
|
-
const
|
|
792
|
-
this._columns.set(
|
|
791
|
+
const s = n.id;
|
|
792
|
+
this._columns.set(s, n), this._columnOrder.splice(e, 0, s);
|
|
793
793
|
}
|
|
794
794
|
removeColumn(e) {
|
|
795
795
|
const n = this._columnOrder[e];
|
|
@@ -809,9 +809,9 @@ class xe {
|
|
|
809
809
|
return this.getColumn(n);
|
|
810
810
|
}
|
|
811
811
|
getColumnNameByIndex(e) {
|
|
812
|
-
var
|
|
812
|
+
var s;
|
|
813
813
|
const n = this._columnOrder[e];
|
|
814
|
-
return ((
|
|
814
|
+
return ((s = this.getColumn(n)) == null ? void 0 : s.getDisplayName()) || "";
|
|
815
815
|
}
|
|
816
816
|
getId() {
|
|
817
817
|
return this._id;
|
|
@@ -902,50 +902,50 @@ class xe {
|
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
904
|
fromJSON(e) {
|
|
905
|
-
var
|
|
906
|
-
this._id = e.id, this._name = e.name, this._range = e.range, this.tableMeta = e.meta, this._tableStyleId = e.options.tableStyleId || "", this._showHeader = (
|
|
907
|
-
const o = new
|
|
905
|
+
var s, r;
|
|
906
|
+
this._id = e.id, this._name = e.name, this._range = e.range, this.tableMeta = e.meta, this._tableStyleId = e.options.tableStyleId || "", this._showHeader = (s = e.options.showHeader) != null ? s : !0, this._showFooter = (r = e.options.showFooter) != null ? r : !0, e.columns.forEach((a) => {
|
|
907
|
+
const o = new j(a.id, a.displayName);
|
|
908
908
|
o.fromJSON(a), this._columns.set(a.id, o), this._columnOrder.push(a.id);
|
|
909
|
-
}), this._tableFilters = new
|
|
909
|
+
}), this._tableFilters = new De(), this._tableFilters.fromJSON(e.filters);
|
|
910
910
|
}
|
|
911
911
|
dispose() {
|
|
912
912
|
this._id = "", this._name = "", this._tableStyleId = "", this._showHeader = !0, this._showFooter = !0, delete this._range, this._columns.clear(), this._columnOrder = [];
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
|
-
var
|
|
916
|
-
for (var
|
|
917
|
-
(o = t[a]) && (
|
|
918
|
-
return
|
|
919
|
-
}, Oe = (t, e) => (n,
|
|
920
|
-
let T = class extends
|
|
915
|
+
var Mn = Object.getOwnPropertyDescriptor, vn = (t, e, n, s) => {
|
|
916
|
+
for (var r = s > 1 ? void 0 : s ? Mn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
917
|
+
(o = t[a]) && (r = o(r) || r);
|
|
918
|
+
return r;
|
|
919
|
+
}, Oe = (t, e) => (n, s) => e(n, s, t);
|
|
920
|
+
let T = class extends Q {
|
|
921
921
|
constructor(e, n) {
|
|
922
922
|
super();
|
|
923
923
|
b(this, "_tableMap");
|
|
924
|
-
b(this, "_tableAdd$", new
|
|
924
|
+
b(this, "_tableAdd$", new Y());
|
|
925
925
|
b(this, "tableAdd$", this._tableAdd$.asObservable());
|
|
926
|
-
b(this, "_tableDelete$", new
|
|
926
|
+
b(this, "_tableDelete$", new Y());
|
|
927
927
|
b(this, "tableDelete$", this._tableDelete$.asObservable());
|
|
928
|
-
b(this, "_tableNameChanged$", new
|
|
928
|
+
b(this, "_tableNameChanged$", new Y());
|
|
929
929
|
b(this, "tableNameChanged$", this._tableNameChanged$.asObservable());
|
|
930
|
-
b(this, "_tableRangeChanged$", new
|
|
930
|
+
b(this, "_tableRangeChanged$", new Y());
|
|
931
931
|
b(this, "tableRangeChanged$", this._tableRangeChanged$.asObservable());
|
|
932
|
-
b(this, "_tableThemeChanged$", new
|
|
932
|
+
b(this, "_tableThemeChanged$", new Y());
|
|
933
933
|
b(this, "tableThemeChanged$", this._tableThemeChanged$.asObservable());
|
|
934
|
-
b(this, "_tableFilterChanged$", new
|
|
934
|
+
b(this, "_tableFilterChanged$", new Y());
|
|
935
935
|
b(this, "tableFilterChanged$", this._tableFilterChanged$.asObservable());
|
|
936
|
-
b(this, "_tableInitStatus", new
|
|
936
|
+
b(this, "_tableInitStatus", new ke(!1));
|
|
937
937
|
b(this, "tableInitStatus$", this._tableInitStatus.asObservable());
|
|
938
938
|
this._univerInstanceService = e, this._localeService = n, this._tableMap = /* @__PURE__ */ new Map();
|
|
939
939
|
}
|
|
940
940
|
_ensureUnit(e) {
|
|
941
941
|
return this._tableMap.has(e) || this._tableMap.set(e, /* @__PURE__ */ new Map()), this._tableMap.get(e);
|
|
942
942
|
}
|
|
943
|
-
getColumnHeader(e, n,
|
|
943
|
+
getColumnHeader(e, n, s, r) {
|
|
944
944
|
var d;
|
|
945
|
-
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn: u, endColumn:
|
|
946
|
-
for (let c = u; c <=
|
|
947
|
-
|
|
948
|
-
return
|
|
945
|
+
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn: u, endColumn: i } = s, l = [], h = r != null ? r : "Column";
|
|
946
|
+
for (let c = u; c <= i; c++)
|
|
947
|
+
l.push(Ye(a == null ? void 0 : a.getCell(o, c)) || te(c - u + 1, h));
|
|
948
|
+
return l;
|
|
949
949
|
}
|
|
950
950
|
/**
|
|
951
951
|
* Add a table to univer.
|
|
@@ -958,21 +958,30 @@ let T = class extends k {
|
|
|
958
958
|
* @param {ITableOptions} [options] Other options of the table.
|
|
959
959
|
* @returns {string} The table id.
|
|
960
960
|
*/
|
|
961
|
-
addTable(e, n,
|
|
962
|
-
|
|
963
|
-
|
|
961
|
+
addTable(e, n, s, r, a, o, u) {
|
|
962
|
+
var c;
|
|
963
|
+
const i = o != null ? o : L(), l = a || this.getColumnHeader(e, n, r), h = new xe(i, s, r, l, u);
|
|
964
|
+
if (h.setSubunitId(n), this._ensureUnit(e).set(i, h), this._tableAdd$.next({
|
|
964
965
|
unitId: e,
|
|
965
966
|
subUnitId: n,
|
|
966
|
-
range:
|
|
967
|
-
tableName:
|
|
968
|
-
tableId:
|
|
967
|
+
range: r,
|
|
968
|
+
tableName: s,
|
|
969
|
+
tableId: i,
|
|
969
970
|
tableStyleId: u == null ? void 0 : u.tableStyleId
|
|
970
|
-
}),
|
|
971
|
+
}), u != null && u.filters) {
|
|
972
|
+
const g = (c = this._univerInstanceService.getUnit(e)) == null ? void 0 : c.getSheetBySheetId(n);
|
|
973
|
+
h.getTableFilters().doFilter(g, r), this._tableFilterChanged$.next({
|
|
974
|
+
unitId: e,
|
|
975
|
+
subUnitId: n,
|
|
976
|
+
tableId: i
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
return i;
|
|
971
980
|
}
|
|
972
|
-
addFilter(e, n,
|
|
981
|
+
addFilter(e, n, s, r) {
|
|
973
982
|
const a = this.getTable(e, n);
|
|
974
983
|
if (a) {
|
|
975
|
-
a.getTableFilters().setColumnFilter(
|
|
984
|
+
a.getTableFilters().setColumnFilter(s, r);
|
|
976
985
|
const u = a.getSubunitId();
|
|
977
986
|
this._tableFilterChanged$.next({
|
|
978
987
|
unitId: e,
|
|
@@ -982,31 +991,31 @@ let T = class extends k {
|
|
|
982
991
|
}
|
|
983
992
|
}
|
|
984
993
|
getFilterRanges(e, n) {
|
|
985
|
-
const
|
|
986
|
-
if (!
|
|
994
|
+
const s = this._tableMap.get(e);
|
|
995
|
+
if (!s)
|
|
987
996
|
return [];
|
|
988
|
-
const
|
|
989
|
-
return
|
|
990
|
-
a.getSubunitId() === n && a.isShowHeader() &&
|
|
991
|
-
}),
|
|
997
|
+
const r = [];
|
|
998
|
+
return s.forEach((a) => {
|
|
999
|
+
a.getSubunitId() === n && a.isShowHeader() && r.push(a.getRange());
|
|
1000
|
+
}), r;
|
|
992
1001
|
}
|
|
993
1002
|
getSheetFilterRangeWithState(e, n) {
|
|
994
|
-
const
|
|
995
|
-
if (!
|
|
1003
|
+
const s = this._tableMap.get(e);
|
|
1004
|
+
if (!s)
|
|
996
1005
|
return [];
|
|
997
|
-
const
|
|
998
|
-
return
|
|
999
|
-
a.getSubunitId() === n && a.isShowHeader() &&
|
|
1006
|
+
const r = [];
|
|
1007
|
+
return s.forEach((a) => {
|
|
1008
|
+
a.getSubunitId() === n && a.isShowHeader() && r.push({
|
|
1000
1009
|
tableId: a.getId(),
|
|
1001
1010
|
range: a.getRange(),
|
|
1002
1011
|
states: a.getFilterStates(a.getRange())
|
|
1003
1012
|
});
|
|
1004
|
-
}),
|
|
1013
|
+
}), r;
|
|
1005
1014
|
}
|
|
1006
1015
|
getTable(e, n) {
|
|
1007
|
-
const
|
|
1008
|
-
if (
|
|
1009
|
-
return
|
|
1016
|
+
const s = this._tableMap.get(e);
|
|
1017
|
+
if (s)
|
|
1018
|
+
return s.get(n);
|
|
1010
1019
|
}
|
|
1011
1020
|
/**
|
|
1012
1021
|
* Get the unique table name, in excel, the table name should be unique because it is used as a reference.
|
|
@@ -1015,12 +1024,12 @@ let T = class extends k {
|
|
|
1015
1024
|
* @returns {string} The unique table name
|
|
1016
1025
|
*/
|
|
1017
1026
|
getUniqueTableName(e, n) {
|
|
1018
|
-
const
|
|
1019
|
-
if (!
|
|
1027
|
+
const s = this._tableMap.get(e);
|
|
1028
|
+
if (!s)
|
|
1020
1029
|
return n;
|
|
1021
|
-
const
|
|
1030
|
+
const r = new Set(Array.from(s.values()).map((u) => u.getDisplayName()));
|
|
1022
1031
|
let a = n, o = 1;
|
|
1023
|
-
for (;
|
|
1032
|
+
for (; r.has(a); )
|
|
1024
1033
|
a = `${n}-${o}`, o++;
|
|
1025
1034
|
return a;
|
|
1026
1035
|
}
|
|
@@ -1035,7 +1044,7 @@ let T = class extends k {
|
|
|
1035
1044
|
}
|
|
1036
1045
|
getTableList(e) {
|
|
1037
1046
|
const n = this._tableMap.get(e);
|
|
1038
|
-
return n ? Array.from(n.values()).map((
|
|
1047
|
+
return n ? Array.from(n.values()).map((s) => ({ ...s.getTableInfo(), unitId: e })) : [];
|
|
1039
1048
|
}
|
|
1040
1049
|
/**
|
|
1041
1050
|
* Get the table list by unit id and subunit id.
|
|
@@ -1044,165 +1053,165 @@ let T = class extends k {
|
|
|
1044
1053
|
* @returns {Table[]} The table list.
|
|
1045
1054
|
*/
|
|
1046
1055
|
getTablesBySubunitId(e, n) {
|
|
1047
|
-
const
|
|
1048
|
-
return
|
|
1056
|
+
const s = this._tableMap.get(e);
|
|
1057
|
+
return s ? Array.from(s.values()).filter((r) => r.getSubunitId() === n) : [];
|
|
1049
1058
|
}
|
|
1050
1059
|
getTablesInfoBySubunitId(e, n) {
|
|
1051
|
-
return this.getTablesBySubunitId(e, n).map((
|
|
1052
|
-
id:
|
|
1053
|
-
name:
|
|
1054
|
-
range:
|
|
1060
|
+
return this.getTablesBySubunitId(e, n).map((s) => ({
|
|
1061
|
+
id: s.getId(),
|
|
1062
|
+
name: s.getDisplayName(),
|
|
1063
|
+
range: s.getRange()
|
|
1055
1064
|
}));
|
|
1056
1065
|
}
|
|
1057
1066
|
deleteTable(e, n) {
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1060
|
-
const a =
|
|
1061
|
-
|
|
1062
|
-
const { subUnitId: u, range:
|
|
1067
|
+
const s = this._tableMap.get(e), r = s == null ? void 0 : s.get(n);
|
|
1068
|
+
if (r) {
|
|
1069
|
+
const a = r.getTableInfo(), o = r.getTableStyleId();
|
|
1070
|
+
s == null || s.delete(n);
|
|
1071
|
+
const { subUnitId: u, range: i, name: l } = a;
|
|
1063
1072
|
this._tableDelete$.next({
|
|
1064
1073
|
unitId: e,
|
|
1065
1074
|
subUnitId: u,
|
|
1066
1075
|
tableId: n,
|
|
1067
|
-
range:
|
|
1068
|
-
tableName:
|
|
1076
|
+
range: i,
|
|
1077
|
+
tableName: l,
|
|
1069
1078
|
tableStyleId: o
|
|
1070
1079
|
});
|
|
1071
1080
|
}
|
|
1072
1081
|
}
|
|
1073
|
-
operationTableRowCol(e, n,
|
|
1074
|
-
const
|
|
1075
|
-
if (!
|
|
1076
|
-
const { operationType: a, rowColType: o, index: u, count:
|
|
1082
|
+
operationTableRowCol(e, n, s) {
|
|
1083
|
+
const r = this.getTableById(e, n);
|
|
1084
|
+
if (!r) return;
|
|
1085
|
+
const { operationType: a, rowColType: o, index: u, count: i, columnsJson: l } = s, h = r.getRange(), d = { ...h };
|
|
1077
1086
|
if (a === M.Insert) {
|
|
1078
1087
|
if (o === "row")
|
|
1079
|
-
d.endRow +=
|
|
1088
|
+
d.endRow += i;
|
|
1080
1089
|
else if (o === "column") {
|
|
1081
|
-
d.endColumn +=
|
|
1082
|
-
for (let c = 0; c <
|
|
1083
|
-
const
|
|
1084
|
-
|
|
1090
|
+
d.endColumn += i;
|
|
1091
|
+
for (let c = 0; c < i; c++) {
|
|
1092
|
+
const g = this._localeService.t("sheets-table.columnPrefix"), C = new j(L(), te(r.getColumnsCount() + 1 + c, g));
|
|
1093
|
+
l != null && l[c] && C.fromJSON(l[c]);
|
|
1085
1094
|
const w = u + c - h.startColumn;
|
|
1086
|
-
|
|
1095
|
+
r.insertColumn(w, C);
|
|
1087
1096
|
}
|
|
1088
1097
|
}
|
|
1089
1098
|
} else if (o === "row")
|
|
1090
|
-
d.endRow -=
|
|
1099
|
+
d.endRow -= i;
|
|
1091
1100
|
else if (o === "column") {
|
|
1092
|
-
d.endColumn -=
|
|
1093
|
-
for (let c =
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1101
|
+
d.endColumn -= i;
|
|
1102
|
+
for (let c = i - 1; c >= 0; c--) {
|
|
1103
|
+
const g = u + c - h.startColumn;
|
|
1104
|
+
r.removeColumn(g);
|
|
1096
1105
|
}
|
|
1097
1106
|
}
|
|
1098
|
-
|
|
1107
|
+
r.setRange(d), this._tableRangeChanged$.next({
|
|
1099
1108
|
unitId: e,
|
|
1100
|
-
subUnitId:
|
|
1109
|
+
subUnitId: r.getSubunitId(),
|
|
1101
1110
|
tableId: n,
|
|
1102
1111
|
range: d,
|
|
1103
1112
|
oldRange: h
|
|
1104
1113
|
});
|
|
1105
1114
|
}
|
|
1106
|
-
updateTableRange(e, n,
|
|
1107
|
-
const
|
|
1108
|
-
if (!
|
|
1109
|
-
const a =
|
|
1115
|
+
updateTableRange(e, n, s) {
|
|
1116
|
+
const r = this.getTableById(e, n);
|
|
1117
|
+
if (!r) return;
|
|
1118
|
+
const a = r.getRange(), o = s.newRange;
|
|
1110
1119
|
if (o.startColumn < a.startColumn) {
|
|
1111
|
-
const u = a.startColumn - o.startColumn,
|
|
1112
|
-
for (let
|
|
1113
|
-
|
|
1120
|
+
const u = a.startColumn - o.startColumn, i = this._localeService.t("sheets-table.columnPrefix");
|
|
1121
|
+
for (let l = 0; l < u; l++)
|
|
1122
|
+
r.insertColumn(a.startColumn, new j(L(), te(r.getColumnsCount() + 1, i)));
|
|
1114
1123
|
} else if (o.startColumn > a.startColumn) {
|
|
1115
1124
|
const u = o.startColumn - a.startColumn;
|
|
1116
|
-
for (let
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1125
|
+
for (let i = u - 1; i >= 0; i--) {
|
|
1126
|
+
const l = o.startColumn + i - a.startColumn;
|
|
1127
|
+
r.removeColumn(l);
|
|
1119
1128
|
}
|
|
1120
1129
|
}
|
|
1121
1130
|
if (o.endColumn < a.endColumn) {
|
|
1122
1131
|
const u = a.endColumn - o.endColumn;
|
|
1123
|
-
for (let
|
|
1124
|
-
const
|
|
1125
|
-
|
|
1132
|
+
for (let i = u - 1; i >= 0; i--) {
|
|
1133
|
+
const l = o.endColumn + i - a.startColumn;
|
|
1134
|
+
r.removeColumn(l);
|
|
1126
1135
|
}
|
|
1127
1136
|
} else if (o.endColumn > a.endColumn) {
|
|
1128
1137
|
const u = o.endColumn - a.endColumn;
|
|
1129
|
-
for (let
|
|
1130
|
-
|
|
1138
|
+
for (let i = 0; i < u; i++)
|
|
1139
|
+
r.insertColumn(a.endColumn, new j(L(), te(r.getColumnsCount() + 1, "Column")));
|
|
1131
1140
|
}
|
|
1132
|
-
|
|
1141
|
+
r.setRange(o), this._tableRangeChanged$.next({
|
|
1133
1142
|
unitId: e,
|
|
1134
|
-
subUnitId:
|
|
1143
|
+
subUnitId: r.getSubunitId(),
|
|
1135
1144
|
tableId: n,
|
|
1136
1145
|
range: o,
|
|
1137
1146
|
oldRange: a
|
|
1138
1147
|
});
|
|
1139
1148
|
}
|
|
1140
|
-
setTableByConfig(e, n,
|
|
1149
|
+
setTableByConfig(e, n, s) {
|
|
1141
1150
|
var c;
|
|
1142
|
-
const
|
|
1151
|
+
const r = this._tableMap.get(e), a = r == null ? void 0 : r.get(n);
|
|
1143
1152
|
if (!a) return;
|
|
1144
|
-
const o = a.getSubunitId(), { name: u, updateRange:
|
|
1153
|
+
const o = a.getSubunitId(), { name: u, updateRange: i, rowColOperation: l, theme: h, options: d } = s;
|
|
1145
1154
|
if (u) {
|
|
1146
|
-
const
|
|
1155
|
+
const g = a.getDisplayName();
|
|
1147
1156
|
a.setDisplayName(u), this._tableNameChanged$.next({
|
|
1148
1157
|
unitId: e,
|
|
1149
1158
|
subUnitId: o,
|
|
1150
1159
|
tableId: n,
|
|
1151
1160
|
tableName: u,
|
|
1152
|
-
oldTableName:
|
|
1161
|
+
oldTableName: g
|
|
1153
1162
|
});
|
|
1154
1163
|
}
|
|
1155
|
-
if (
|
|
1156
|
-
const
|
|
1164
|
+
if (l && this.operationTableRowCol(e, n, l), i && this.updateTableRange(e, n, i), h) {
|
|
1165
|
+
const g = (c = a.getTableStyleId()) != null ? c : "default";
|
|
1157
1166
|
a.setTableStyleId(h), this._tableThemeChanged$.next({
|
|
1158
1167
|
unitId: e,
|
|
1159
1168
|
subUnitId: o,
|
|
1160
1169
|
tableId: n,
|
|
1161
1170
|
theme: h,
|
|
1162
|
-
oldTheme:
|
|
1171
|
+
oldTheme: g
|
|
1163
1172
|
});
|
|
1164
1173
|
}
|
|
1165
1174
|
d && d.showHeader !== void 0 && a.setShowHeader(d.showHeader);
|
|
1166
1175
|
}
|
|
1167
1176
|
toJSON(e) {
|
|
1168
|
-
const n = {},
|
|
1169
|
-
return
|
|
1170
|
-
const a =
|
|
1177
|
+
const n = {}, s = this._tableMap.get(e);
|
|
1178
|
+
return s && s.forEach((r) => {
|
|
1179
|
+
const a = r.getSubunitId();
|
|
1171
1180
|
if (!n[a]) {
|
|
1172
1181
|
const o = /* @__PURE__ */ new Set();
|
|
1173
|
-
this.getTablesBySubunitId(e, a).forEach((
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1176
|
-
for (const h of
|
|
1182
|
+
this.getTablesBySubunitId(e, a).forEach((i) => {
|
|
1183
|
+
const l = i.getTableFilters().getFilterOutRows();
|
|
1184
|
+
if (l)
|
|
1185
|
+
for (const h of l)
|
|
1177
1186
|
o.add(h);
|
|
1178
1187
|
}), n[a] = {
|
|
1179
1188
|
tables: [],
|
|
1180
1189
|
tableFilteredOutRows: Array.from(o)
|
|
1181
1190
|
};
|
|
1182
1191
|
}
|
|
1183
|
-
n[a].tables.push(
|
|
1192
|
+
n[a].tables.push(r.toJSON());
|
|
1184
1193
|
}), n;
|
|
1185
1194
|
}
|
|
1186
1195
|
fromJSON(e, n) {
|
|
1187
|
-
const
|
|
1196
|
+
const s = this._ensureUnit(e);
|
|
1188
1197
|
Object.keys(n).forEach((a) => {
|
|
1189
1198
|
const o = $(this._univerInstanceService, { unitId: e, subUnitId: a });
|
|
1190
1199
|
if (!o)
|
|
1191
1200
|
return;
|
|
1192
1201
|
const u = o.worksheet;
|
|
1193
|
-
let
|
|
1194
|
-
n[a].tables ?
|
|
1195
|
-
const h = this.getColumnHeader(e, a,
|
|
1196
|
-
if (d.setTableMeta(
|
|
1202
|
+
let i;
|
|
1203
|
+
n[a].tables ? i = n[a].tables : Array.isArray(n[a]) && (i = n[a]), i && i.forEach((l) => {
|
|
1204
|
+
const h = this.getColumnHeader(e, a, l.range), d = new xe(l.id, l.name, l.range, h, l.options);
|
|
1205
|
+
if (d.setTableMeta(l.meta), l.columns.length && d.setColumns(l.columns), l.filters) {
|
|
1197
1206
|
const c = d.getTableFilters();
|
|
1198
|
-
c.fromJSON(
|
|
1207
|
+
c.fromJSON(l.filters), c.doFilter(u, d.getTableFilterRange());
|
|
1199
1208
|
}
|
|
1200
|
-
d.setSubunitId(a),
|
|
1209
|
+
d.setSubunitId(a), s.set(l.id, d), this._tableAdd$.next({
|
|
1201
1210
|
unitId: e,
|
|
1202
1211
|
subUnitId: a,
|
|
1203
|
-
range:
|
|
1204
|
-
tableName:
|
|
1205
|
-
tableId:
|
|
1212
|
+
range: l.range,
|
|
1213
|
+
tableName: l.name,
|
|
1214
|
+
tableId: l.id
|
|
1206
1215
|
});
|
|
1207
1216
|
});
|
|
1208
1217
|
}), this._tableInitStatus.next(!0);
|
|
@@ -1216,16 +1225,16 @@ let T = class extends k {
|
|
|
1216
1225
|
}), this._tableMap.clear();
|
|
1217
1226
|
}
|
|
1218
1227
|
};
|
|
1219
|
-
T =
|
|
1228
|
+
T = vn([
|
|
1220
1229
|
Oe(0, E),
|
|
1221
|
-
Oe(1, p(
|
|
1230
|
+
Oe(1, p(me))
|
|
1222
1231
|
], T);
|
|
1223
|
-
var
|
|
1224
|
-
for (var
|
|
1225
|
-
(o = t[a]) && (
|
|
1226
|
-
return
|
|
1227
|
-
},
|
|
1228
|
-
let
|
|
1232
|
+
var Fn = Object.getOwnPropertyDescriptor, yn = (t, e, n, s) => {
|
|
1233
|
+
for (var r = s > 1 ? void 0 : s ? Fn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
1234
|
+
(o = t[a]) && (r = o(r) || r);
|
|
1235
|
+
return r;
|
|
1236
|
+
}, Nn = (t, e) => (n, s) => e(n, s, t);
|
|
1237
|
+
let X = class extends Q {
|
|
1229
1238
|
constructor(t) {
|
|
1230
1239
|
super(), this._tableManager = t;
|
|
1231
1240
|
}
|
|
@@ -1240,8 +1249,8 @@ let z = class extends k {
|
|
|
1240
1249
|
getTableList(t) {
|
|
1241
1250
|
return this._tableManager.getTableList(t);
|
|
1242
1251
|
}
|
|
1243
|
-
addTable(t, e, n,
|
|
1244
|
-
return this._tableManager.addTable(t, e, n,
|
|
1252
|
+
addTable(t, e, n, s, r, a, o) {
|
|
1253
|
+
return this._tableManager.addTable(t, e, n, s, r, a, o);
|
|
1245
1254
|
}
|
|
1246
1255
|
deleteTable(t, e, n) {
|
|
1247
1256
|
this._tableManager.deleteTable(t, n);
|
|
@@ -1251,161 +1260,161 @@ let z = class extends k {
|
|
|
1251
1260
|
return (n = this._tableManager.getTable(t, e)) == null ? void 0 : n.getTableMeta();
|
|
1252
1261
|
}
|
|
1253
1262
|
setTableMeta(t, e, n) {
|
|
1254
|
-
var
|
|
1255
|
-
(
|
|
1263
|
+
var s;
|
|
1264
|
+
(s = this._tableManager.getTable(t, e)) == null || s.setTableMeta(n);
|
|
1256
1265
|
}
|
|
1257
1266
|
getTableColumnMeta(t, e, n) {
|
|
1258
|
-
var
|
|
1259
|
-
return (
|
|
1267
|
+
var s, r;
|
|
1268
|
+
return (r = (s = this._tableManager.getTable(t, e)) == null ? void 0 : s.getTableColumnByIndex(n)) == null ? void 0 : r.getMeta();
|
|
1260
1269
|
}
|
|
1261
|
-
selTableColumnMeta(t, e, n,
|
|
1262
|
-
var
|
|
1263
|
-
(a = (
|
|
1270
|
+
selTableColumnMeta(t, e, n, s) {
|
|
1271
|
+
var r, a;
|
|
1272
|
+
(a = (r = this._tableManager.getTable(t, e)) == null ? void 0 : r.getTableColumnByIndex(n)) == null || a.setMeta(s);
|
|
1264
1273
|
}
|
|
1265
|
-
addFilter(t, e, n,
|
|
1266
|
-
this._tableManager.addFilter(t, e, n,
|
|
1274
|
+
addFilter(t, e, n, s) {
|
|
1275
|
+
this._tableManager.addFilter(t, e, n, s);
|
|
1267
1276
|
}
|
|
1268
|
-
getCellValueWithConditionType(t, e, n,
|
|
1269
|
-
return
|
|
1277
|
+
getCellValueWithConditionType(t, e, n, s = O.String) {
|
|
1278
|
+
return ue(t, e, n, s);
|
|
1270
1279
|
}
|
|
1271
1280
|
};
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
],
|
|
1275
|
-
const
|
|
1281
|
+
X = yn([
|
|
1282
|
+
Nn(0, p(T))
|
|
1283
|
+
], X);
|
|
1284
|
+
const J = {
|
|
1276
1285
|
id: "sheet.mutation.add-table",
|
|
1277
|
-
type:
|
|
1286
|
+
type: N.MUTATION,
|
|
1278
1287
|
handler: (t, e) => {
|
|
1279
|
-
const { tableId: n, unitId:
|
|
1280
|
-
return t.get(
|
|
1288
|
+
const { tableId: n, unitId: s, subUnitId: r, name: a, range: o, header: u, options: i } = e;
|
|
1289
|
+
return t.get(X).addTable(s, r, a, o, u, n, i), !0;
|
|
1281
1290
|
}
|
|
1282
|
-
},
|
|
1291
|
+
}, k = {
|
|
1283
1292
|
id: "sheet.mutation.delete-table",
|
|
1284
|
-
type:
|
|
1293
|
+
type: N.MUTATION,
|
|
1285
1294
|
handler: (t, e) => {
|
|
1286
|
-
const { unitId: n, subUnitId:
|
|
1287
|
-
return t.get(
|
|
1295
|
+
const { unitId: n, subUnitId: s, tableId: r } = e;
|
|
1296
|
+
return t.get(X).deleteTable(n, s, r), !0;
|
|
1288
1297
|
}
|
|
1289
1298
|
}, Dn = {
|
|
1290
1299
|
id: "sheet.command.add-table",
|
|
1291
|
-
type:
|
|
1300
|
+
type: N.COMMAND,
|
|
1292
1301
|
handler: (t, e) => {
|
|
1293
1302
|
var w;
|
|
1294
1303
|
if (!e)
|
|
1295
1304
|
return !1;
|
|
1296
|
-
const n = t.get(A),
|
|
1305
|
+
const n = t.get(A), s = t.get(x), r = t.get(me), a = (w = e.id) != null ? w : L();
|
|
1297
1306
|
let o = e.name;
|
|
1298
1307
|
if (!o) {
|
|
1299
1308
|
const f = t.get(T).getTableList(e.unitId).length;
|
|
1300
|
-
o = `${
|
|
1309
|
+
o = `${r.t("sheets-table.tablePrefix")}${f + 1}`;
|
|
1301
1310
|
}
|
|
1302
|
-
const u = [],
|
|
1303
|
-
return u.push({ id:
|
|
1311
|
+
const u = [], i = [], l = t.get(T), { unitId: h, subUnitId: d, range: c } = e, g = l.getColumnHeader(h, d, c, r.t("sheets-table.columnPrefix"));
|
|
1312
|
+
return u.push({ id: J.id, params: { ...e, tableId: a, name: o, header: g } }), i.push({ id: k.id, params: { tableId: a, unitId: e.unitId } }), B(u, s) && n.pushUndoRedo({
|
|
1304
1313
|
unitID: e.unitId,
|
|
1305
|
-
undoMutations:
|
|
1314
|
+
undoMutations: i,
|
|
1306
1315
|
redoMutations: u
|
|
1307
1316
|
}), !0;
|
|
1308
1317
|
}
|
|
1309
|
-
},
|
|
1318
|
+
}, xn = {
|
|
1310
1319
|
id: "sheet.command.delete-table",
|
|
1311
|
-
type:
|
|
1320
|
+
type: N.COMMAND,
|
|
1312
1321
|
handler: (t, e) => {
|
|
1313
1322
|
if (!e)
|
|
1314
1323
|
return !1;
|
|
1315
|
-
const n = t.get(A),
|
|
1316
|
-
if (!
|
|
1324
|
+
const n = t.get(A), s = t.get(x), r = t.get(T), a = [], o = [], u = r.getTable(e.unitId, e.tableId), i = u == null ? void 0 : u.toJSON();
|
|
1325
|
+
if (!i)
|
|
1317
1326
|
throw new Error("[TableManager]: Table not found");
|
|
1318
|
-
return a.push({ id:
|
|
1319
|
-
id:
|
|
1327
|
+
return a.push({ id: k.id, params: { ...e } }), o.push({
|
|
1328
|
+
id: J.id,
|
|
1320
1329
|
params: {
|
|
1321
1330
|
unitId: e.unitId,
|
|
1322
1331
|
subUnitId: e.subUnitId,
|
|
1323
1332
|
tableId: e.tableId,
|
|
1324
|
-
name:
|
|
1325
|
-
range:
|
|
1326
|
-
options:
|
|
1333
|
+
name: i.name,
|
|
1334
|
+
range: i.range,
|
|
1335
|
+
options: i.options
|
|
1327
1336
|
}
|
|
1328
|
-
}),
|
|
1337
|
+
}), B(a, s) && n.pushUndoRedo({
|
|
1329
1338
|
unitID: e.unitId,
|
|
1330
1339
|
undoMutations: o,
|
|
1331
1340
|
redoMutations: a
|
|
1332
1341
|
}), !0;
|
|
1333
1342
|
}
|
|
1334
|
-
},
|
|
1343
|
+
}, Ce = {
|
|
1335
1344
|
id: "sheet.mutation.set-table-filter",
|
|
1336
|
-
type:
|
|
1345
|
+
type: N.MUTATION,
|
|
1337
1346
|
handler: (t, e) => {
|
|
1338
|
-
const { tableId: n, unitId:
|
|
1339
|
-
return t.get(T).addFilter(
|
|
1347
|
+
const { tableId: n, unitId: s, column: r, tableFilter: a } = e;
|
|
1348
|
+
return t.get(T).addFilter(s, n, r, a), !0;
|
|
1340
1349
|
}
|
|
1341
|
-
},
|
|
1350
|
+
}, On = {
|
|
1342
1351
|
id: "sheet.command.set-table-filter",
|
|
1343
|
-
type:
|
|
1352
|
+
type: N.COMMAND,
|
|
1344
1353
|
handler: (t, e) => {
|
|
1345
1354
|
if (!e)
|
|
1346
1355
|
return !1;
|
|
1347
|
-
const n = t.get(A),
|
|
1348
|
-
return a.push({ id:
|
|
1356
|
+
const n = t.get(A), s = t.get(x), r = e.tableId || L(), a = [], o = [];
|
|
1357
|
+
return a.push({ id: Ce.id, params: { ...e, tableId: r } }), o.push({ id: Ce.id, params: { ...e, tableId: r, tableFilter: void 0 } }), B(a, s) && n.pushUndoRedo({
|
|
1349
1358
|
unitID: e.unitId,
|
|
1350
1359
|
undoMutations: o,
|
|
1351
1360
|
redoMutations: a
|
|
1352
1361
|
}), !0;
|
|
1353
1362
|
}
|
|
1354
|
-
}, Xe = "SHEET_TABLE_PLUGIN", re = "SHEET_TABLE",
|
|
1355
|
-
var
|
|
1356
|
-
for (var
|
|
1357
|
-
(o = t[a]) && (
|
|
1358
|
-
return
|
|
1359
|
-
},
|
|
1360
|
-
let
|
|
1361
|
-
constructor(e, n, r) {
|
|
1363
|
+
}, Xe = "SHEET_TABLE_PLUGIN", re = "SHEET_TABLE", Un = "table-custom";
|
|
1364
|
+
var $n = Object.getOwnPropertyDescriptor, An = (t, e, n, s) => {
|
|
1365
|
+
for (var r = s > 1 ? void 0 : s ? $n(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
1366
|
+
(o = t[a]) && (r = o(r) || r);
|
|
1367
|
+
return r;
|
|
1368
|
+
}, ae = (t, e) => (n, s) => e(n, s, t);
|
|
1369
|
+
let W = class extends Q {
|
|
1370
|
+
constructor(e, n, s, r) {
|
|
1362
1371
|
super();
|
|
1363
1372
|
b(this, "_tableRangeRTree", /* @__PURE__ */ new Map());
|
|
1364
|
-
this.
|
|
1373
|
+
this._univerInstanceService = e, this._sheetInterceptorService = n, this._tableManager = s, this._resourceManagerService = r, this._initSnapshot(), this._initSheetChange(), this.registerTableChangeEvent(), this.registerTableHeaderInterceptor();
|
|
1365
1374
|
}
|
|
1366
|
-
getContainerTableWithRange(e, n,
|
|
1367
|
-
const
|
|
1368
|
-
const
|
|
1369
|
-
return
|
|
1375
|
+
getContainerTableWithRange(e, n, s) {
|
|
1376
|
+
const r = this._ensureTableRangeRTree(e), o = Array.from(r.bulkSearch([{ unitId: e, sheetId: n, range: s }])).find((u) => {
|
|
1377
|
+
const i = this._tableManager.getTable(e, String(u));
|
|
1378
|
+
return i ? Se.contains(i.getRange(), s) : !1;
|
|
1370
1379
|
});
|
|
1371
1380
|
if (o)
|
|
1372
1381
|
return this._tableManager.getTable(e, String(o));
|
|
1373
1382
|
}
|
|
1374
1383
|
_ensureTableRangeRTree(e) {
|
|
1375
|
-
return this._tableRangeRTree.has(e) || this._tableRangeRTree.set(e, new
|
|
1384
|
+
return this._tableRangeRTree.has(e) || this._tableRangeRTree.set(e, new st()), this._tableRangeRTree.get(e);
|
|
1376
1385
|
}
|
|
1377
1386
|
registerTableChangeEvent() {
|
|
1378
1387
|
this.disposeWithMe(
|
|
1379
1388
|
this._tableManager.tableAdd$.subscribe((e) => {
|
|
1380
|
-
const { range: n, tableId:
|
|
1381
|
-
this._ensureTableRangeRTree(
|
|
1382
|
-
unitId:
|
|
1389
|
+
const { range: n, tableId: s, unitId: r, subUnitId: a } = e;
|
|
1390
|
+
this._ensureTableRangeRTree(r).insert({
|
|
1391
|
+
unitId: r,
|
|
1383
1392
|
sheetId: a,
|
|
1384
|
-
id:
|
|
1393
|
+
id: s,
|
|
1385
1394
|
range: { ...n }
|
|
1386
1395
|
});
|
|
1387
1396
|
})
|
|
1388
1397
|
), this.disposeWithMe(
|
|
1389
1398
|
this._tableManager.tableRangeChanged$.subscribe((e) => {
|
|
1390
|
-
const { range: n, tableId:
|
|
1399
|
+
const { range: n, tableId: s, unitId: r, subUnitId: a, oldRange: o } = e, u = this._ensureTableRangeRTree(r);
|
|
1391
1400
|
u.remove({
|
|
1392
|
-
unitId:
|
|
1401
|
+
unitId: r,
|
|
1393
1402
|
sheetId: a,
|
|
1394
|
-
id:
|
|
1403
|
+
id: s,
|
|
1395
1404
|
range: { ...o }
|
|
1396
1405
|
}), u.insert({
|
|
1397
|
-
unitId:
|
|
1406
|
+
unitId: r,
|
|
1398
1407
|
sheetId: a,
|
|
1399
|
-
id:
|
|
1408
|
+
id: s,
|
|
1400
1409
|
range: { ...n }
|
|
1401
1410
|
});
|
|
1402
1411
|
})
|
|
1403
1412
|
), this.disposeWithMe(
|
|
1404
1413
|
this._tableManager.tableDelete$.subscribe((e) => {
|
|
1405
|
-
const { tableId: n, unitId:
|
|
1406
|
-
this._ensureTableRangeRTree(
|
|
1407
|
-
unitId:
|
|
1408
|
-
sheetId:
|
|
1414
|
+
const { tableId: n, unitId: s, subUnitId: r, range: a } = e;
|
|
1415
|
+
this._ensureTableRangeRTree(s).remove({
|
|
1416
|
+
unitId: s,
|
|
1417
|
+
sheetId: r,
|
|
1409
1418
|
id: n,
|
|
1410
1419
|
range: { ...a }
|
|
1411
1420
|
});
|
|
@@ -1415,23 +1424,23 @@ let B = class extends k {
|
|
|
1415
1424
|
registerTableHeaderInterceptor() {
|
|
1416
1425
|
this.disposeWithMe(
|
|
1417
1426
|
this._sheetInterceptorService.intercept(Be.CELL_CONTENT, {
|
|
1418
|
-
effect:
|
|
1419
|
-
handler: (e, n,
|
|
1420
|
-
const { row:
|
|
1421
|
-
if ((e == null ? void 0 : e.v) === void 0 &&
|
|
1422
|
-
const h = Array.from(
|
|
1427
|
+
effect: rt.Value,
|
|
1428
|
+
handler: (e, n, s) => {
|
|
1429
|
+
const { row: r, col: a, unitId: o, subUnitId: u } = n, i = this._ensureTableRangeRTree(o);
|
|
1430
|
+
if ((e == null ? void 0 : e.v) === void 0 && i) {
|
|
1431
|
+
const h = Array.from(i.bulkSearch([{ unitId: o, sheetId: u, range: { startColumn: a, endColumn: a, startRow: r, endRow: r } }]));
|
|
1423
1432
|
if (h.length > 0) {
|
|
1424
1433
|
const d = this._tableManager.getTable(o, h[0]);
|
|
1425
1434
|
if (d) {
|
|
1426
|
-
const c = d.getRange(),
|
|
1427
|
-
if (c.startRow ===
|
|
1428
|
-
const w = d.getColumnNameByIndex(
|
|
1429
|
-
return (!e || e === n.rawData) && (e = { ...n.rawData }), e.v = w,
|
|
1435
|
+
const c = d.getRange(), g = a - c.startColumn;
|
|
1436
|
+
if (c.startRow === r) {
|
|
1437
|
+
const w = d.getColumnNameByIndex(g);
|
|
1438
|
+
return (!e || e === n.rawData) && (e = { ...n.rawData }), e.v = w, s(e);
|
|
1430
1439
|
}
|
|
1431
1440
|
}
|
|
1432
1441
|
}
|
|
1433
1442
|
}
|
|
1434
|
-
return
|
|
1443
|
+
return s(e);
|
|
1435
1444
|
}
|
|
1436
1445
|
})
|
|
1437
1446
|
);
|
|
@@ -1457,7 +1466,7 @@ let B = class extends k {
|
|
|
1457
1466
|
return {};
|
|
1458
1467
|
}
|
|
1459
1468
|
},
|
|
1460
|
-
businesses: [
|
|
1469
|
+
businesses: [z.UNIVER_SHEET],
|
|
1461
1470
|
pluginName: Xe,
|
|
1462
1471
|
onLoad: (e, n) => {
|
|
1463
1472
|
this._fromJSON(e, n);
|
|
@@ -1467,113 +1476,196 @@ let B = class extends k {
|
|
|
1467
1476
|
}
|
|
1468
1477
|
}));
|
|
1469
1478
|
}
|
|
1479
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1480
|
+
_initSheetChange() {
|
|
1481
|
+
this.disposeWithMe(
|
|
1482
|
+
this._sheetInterceptorService.interceptCommand({
|
|
1483
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1484
|
+
getMutations: (e) => {
|
|
1485
|
+
var n;
|
|
1486
|
+
if (e.id === ct.id) {
|
|
1487
|
+
const s = e.params, r = s.unitId || this._univerInstanceService.getCurrentUnitOfType(z.UNIVER_SHEET).getUnitId(), a = s.subUnitId || ((n = this._univerInstanceService.getCurrentUnitOfType(z.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : n.getSheetId());
|
|
1488
|
+
if (!r || !a)
|
|
1489
|
+
return { redos: [], undos: [] };
|
|
1490
|
+
const o = this._tableManager.getTablesBySubunitId(r, a);
|
|
1491
|
+
if (o.length === 0)
|
|
1492
|
+
return { redos: [], undos: [] };
|
|
1493
|
+
const u = [], i = [];
|
|
1494
|
+
return o.forEach((l) => {
|
|
1495
|
+
const h = l.toJSON();
|
|
1496
|
+
u.push({
|
|
1497
|
+
id: k.id,
|
|
1498
|
+
params: {
|
|
1499
|
+
unitId: r,
|
|
1500
|
+
subUnitId: a,
|
|
1501
|
+
tableId: h.id
|
|
1502
|
+
}
|
|
1503
|
+
}), i.push({
|
|
1504
|
+
id: J.id,
|
|
1505
|
+
params: {
|
|
1506
|
+
unitId: r,
|
|
1507
|
+
subUnitId: a,
|
|
1508
|
+
name: h.name,
|
|
1509
|
+
range: h.range,
|
|
1510
|
+
tableId: h.id,
|
|
1511
|
+
options: {
|
|
1512
|
+
...h.options,
|
|
1513
|
+
columns: h.columns,
|
|
1514
|
+
filters: h.filters.tableColumnFilterList
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
}), { redos: u, undos: i };
|
|
1519
|
+
} else if (e.id === dt.id) {
|
|
1520
|
+
const s = e.params, { unitId: r, subUnitId: a, targetSubUnitId: o } = s;
|
|
1521
|
+
if (!r || !a || !o)
|
|
1522
|
+
return { redos: [], undos: [] };
|
|
1523
|
+
const u = this._tableManager.getTablesBySubunitId(r, a);
|
|
1524
|
+
if (u.length === 0)
|
|
1525
|
+
return { redos: [], undos: [] };
|
|
1526
|
+
const i = [], l = [];
|
|
1527
|
+
return u.forEach((h) => {
|
|
1528
|
+
const d = h.toJSON(), c = L();
|
|
1529
|
+
i.push({
|
|
1530
|
+
id: J.id,
|
|
1531
|
+
params: {
|
|
1532
|
+
unitId: r,
|
|
1533
|
+
subUnitId: o,
|
|
1534
|
+
name: d.name,
|
|
1535
|
+
range: {
|
|
1536
|
+
...d.range,
|
|
1537
|
+
sheetId: o
|
|
1538
|
+
},
|
|
1539
|
+
tableId: c,
|
|
1540
|
+
options: {
|
|
1541
|
+
...d.options,
|
|
1542
|
+
columns: d.columns,
|
|
1543
|
+
filters: d.filters.tableColumnFilterList
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}), l.push({
|
|
1547
|
+
id: k.id,
|
|
1548
|
+
params: {
|
|
1549
|
+
unitId: r,
|
|
1550
|
+
subUnitId: o,
|
|
1551
|
+
tableId: c
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
}), { redos: i, undos: l };
|
|
1555
|
+
}
|
|
1556
|
+
return { redos: [], undos: [] };
|
|
1557
|
+
}
|
|
1558
|
+
})
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1470
1561
|
dispose() {
|
|
1471
1562
|
super.dispose(), this._tableRangeRTree.clear();
|
|
1472
1563
|
}
|
|
1473
1564
|
};
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1565
|
+
W = An([
|
|
1566
|
+
ae(0, p(E)),
|
|
1567
|
+
ae(1, p(pe)),
|
|
1568
|
+
ae(2, p(T)),
|
|
1569
|
+
ae(3, p(nt))
|
|
1570
|
+
], W);
|
|
1571
|
+
const S = {
|
|
1480
1572
|
id: "sheet.mutation.set-sheet-table",
|
|
1481
|
-
type:
|
|
1573
|
+
type: N.MUTATION,
|
|
1482
1574
|
handler: (t, e) => {
|
|
1483
1575
|
if (!e)
|
|
1484
1576
|
return !1;
|
|
1485
|
-
const { unitId: n, tableId:
|
|
1486
|
-
return t.get(T).setTableByConfig(n,
|
|
1577
|
+
const { unitId: n, tableId: s, config: r } = e;
|
|
1578
|
+
return t.get(T).setTableByConfig(n, s, r), !0;
|
|
1487
1579
|
}
|
|
1488
|
-
},
|
|
1580
|
+
}, En = {
|
|
1489
1581
|
id: "sheet.command.add-table-theme",
|
|
1490
|
-
type:
|
|
1582
|
+
type: N.COMMAND,
|
|
1491
1583
|
handler: (t, e) => {
|
|
1492
1584
|
if (!e)
|
|
1493
1585
|
return !1;
|
|
1494
|
-
const n = t.get(T), { unitId:
|
|
1495
|
-
if (!
|
|
1496
|
-
const
|
|
1586
|
+
const n = t.get(T), { unitId: s, tableId: r, themeStyle: a } = e, o = [], u = [], i = n.getTableById(s, r);
|
|
1587
|
+
if (!i) return !1;
|
|
1588
|
+
const l = i.getSubunitId();
|
|
1497
1589
|
o.push({
|
|
1498
|
-
id:
|
|
1590
|
+
id: Le.id,
|
|
1499
1591
|
params: {
|
|
1500
|
-
unitId:
|
|
1501
|
-
subUnitId:
|
|
1592
|
+
unitId: s,
|
|
1593
|
+
subUnitId: l,
|
|
1502
1594
|
styleJSON: a.toJson()
|
|
1503
1595
|
}
|
|
1504
1596
|
}), o.push({
|
|
1505
|
-
id:
|
|
1597
|
+
id: S.id,
|
|
1506
1598
|
params: {
|
|
1507
|
-
unitId:
|
|
1508
|
-
subUnitId:
|
|
1509
|
-
tableId:
|
|
1599
|
+
unitId: s,
|
|
1600
|
+
subUnitId: l,
|
|
1601
|
+
tableId: r,
|
|
1510
1602
|
config: {
|
|
1511
1603
|
theme: a.getName()
|
|
1512
1604
|
}
|
|
1513
1605
|
}
|
|
1514
1606
|
}), u.push({
|
|
1515
|
-
id:
|
|
1607
|
+
id: S.id,
|
|
1516
1608
|
params: {
|
|
1517
|
-
unitId:
|
|
1518
|
-
subUnitId:
|
|
1519
|
-
tableId:
|
|
1609
|
+
unitId: s,
|
|
1610
|
+
subUnitId: l,
|
|
1611
|
+
tableId: r,
|
|
1520
1612
|
config: {
|
|
1521
|
-
themeStyle:
|
|
1613
|
+
themeStyle: i.getTableStyleId()
|
|
1522
1614
|
}
|
|
1523
1615
|
}
|
|
1524
1616
|
}), u.push({
|
|
1525
1617
|
id: We.id,
|
|
1526
1618
|
params: {
|
|
1527
|
-
unitId:
|
|
1528
|
-
subUnitId:
|
|
1619
|
+
unitId: s,
|
|
1620
|
+
subUnitId: l,
|
|
1529
1621
|
styleName: a.getName()
|
|
1530
1622
|
}
|
|
1531
1623
|
});
|
|
1532
1624
|
const h = t.get(x);
|
|
1533
|
-
return
|
|
1534
|
-
unitID:
|
|
1625
|
+
return B(o, h) && t.get(A).pushUndoRedo({
|
|
1626
|
+
unitID: s,
|
|
1535
1627
|
undoMutations: u,
|
|
1536
1628
|
redoMutations: o
|
|
1537
1629
|
}), !0;
|
|
1538
1630
|
}
|
|
1539
|
-
},
|
|
1631
|
+
}, Bn = {
|
|
1540
1632
|
id: "sheet.command.remove-table-theme",
|
|
1541
|
-
type:
|
|
1633
|
+
type: N.COMMAND,
|
|
1542
1634
|
handler: (t, e) => {
|
|
1543
1635
|
if (!e)
|
|
1544
1636
|
return !1;
|
|
1545
|
-
const { unitId: n, tableId:
|
|
1637
|
+
const { unitId: n, tableId: s, themeName: r } = e, a = t.get(T), o = t.get(He), u = a.getTableById(n, s);
|
|
1546
1638
|
if (!u) return !1;
|
|
1547
|
-
const
|
|
1548
|
-
let
|
|
1549
|
-
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1639
|
+
const i = u.getSubunitId(), l = [], h = [], d = o.getRegisteredRangeThemes().filter((f) => f == null ? void 0 : f.startsWith("table-default"));
|
|
1640
|
+
let g = o.getRegisteredRangeThemes().filter((f) => f == null ? void 0 : f.startsWith(Un)).find((f) => f !== r);
|
|
1641
|
+
g || (g = d[0]), l.push({ id: S.id, params: { unitId: n, subUnitId: i, tableId: s, config: { theme: g } } }), l.push({ id: We.id, params: { unitId: n, subUnitId: i, styleName: r } });
|
|
1642
|
+
const C = o.getDefaultRangeThemeStyle(r);
|
|
1643
|
+
C && (h.push({ id: Le.id, params: { unitId: n, subUnitId: i, styleJSON: C.toJson() } }), h.push({ id: S.id, params: { unitId: n, subUnitId: i, tableId: s, config: { theme: r } } }));
|
|
1552
1644
|
const w = t.get(x);
|
|
1553
|
-
return
|
|
1645
|
+
return B(l, w) && t.get(A).pushUndoRedo({
|
|
1554
1646
|
unitID: n,
|
|
1555
|
-
redoMutations:
|
|
1647
|
+
redoMutations: l,
|
|
1556
1648
|
undoMutations: h
|
|
1557
1649
|
}), !0;
|
|
1558
1650
|
}
|
|
1559
1651
|
}, Ln = {
|
|
1560
1652
|
id: "sheet.command.set-table-config",
|
|
1561
|
-
type:
|
|
1653
|
+
type: N.COMMAND,
|
|
1562
1654
|
// eslint-disable-next-line max-lines-per-function
|
|
1563
1655
|
handler: (t, e) => {
|
|
1564
1656
|
if (!e)
|
|
1565
1657
|
return !1;
|
|
1566
|
-
const { unitId: n, tableId:
|
|
1567
|
-
if (!
|
|
1568
|
-
const h = {}, d = {}, c = t.get(
|
|
1569
|
-
if (
|
|
1658
|
+
const { unitId: n, tableId: s, name: r, updateRange: a, rowColOperation: o, theme: u } = e, i = t.get(T), l = i.getTableById(n, s);
|
|
1659
|
+
if (!l) return !1;
|
|
1660
|
+
const h = {}, d = {}, c = t.get(me), C = t.get(E).getCurrentUnitOfType(z.UNIVER_SHEET), w = /* @__PURE__ */ new Set();
|
|
1661
|
+
if (C && (C.getSheets().forEach((_) => {
|
|
1570
1662
|
w.add(_.getName());
|
|
1571
|
-
}),
|
|
1663
|
+
}), i.getTableList(n).forEach((_) => {
|
|
1572
1664
|
w.add(_.name);
|
|
1573
|
-
})),
|
|
1574
|
-
if (!at(
|
|
1665
|
+
})), r) {
|
|
1666
|
+
if (!at(r, w))
|
|
1575
1667
|
return t.get(ot).warn(c.t("sheets-table.tableNameError")), !1;
|
|
1576
|
-
h.name =
|
|
1668
|
+
h.name = l.getDisplayName(), d.name = r;
|
|
1577
1669
|
}
|
|
1578
1670
|
o && (h.rowColOperation = {
|
|
1579
1671
|
operationType: o.operationType === M.Insert ? M.Delete : M.Insert,
|
|
@@ -1581,50 +1673,50 @@ const C = {
|
|
|
1581
1673
|
index: o.index,
|
|
1582
1674
|
count: o.count
|
|
1583
1675
|
}, d.rowColOperation = o), a && (h.updateRange = {
|
|
1584
|
-
newRange:
|
|
1585
|
-
}, d.updateRange = a), u && (h.theme =
|
|
1676
|
+
newRange: l.getRange()
|
|
1677
|
+
}, d.updateRange = a), u && (h.theme = l.getTableStyleId(), d.theme = u);
|
|
1586
1678
|
const R = {
|
|
1587
1679
|
unitId: n,
|
|
1588
|
-
subUnitId:
|
|
1589
|
-
tableId:
|
|
1680
|
+
subUnitId: l.getSubunitId(),
|
|
1681
|
+
tableId: s,
|
|
1590
1682
|
config: d
|
|
1591
1683
|
};
|
|
1592
|
-
return t.get(x).executeCommand(
|
|
1684
|
+
return t.get(x).executeCommand(S.id, R), t.get(A).pushUndoRedo({
|
|
1593
1685
|
unitID: n,
|
|
1594
1686
|
undoMutations: [
|
|
1595
1687
|
{
|
|
1596
|
-
id:
|
|
1688
|
+
id: S.id,
|
|
1597
1689
|
params: {
|
|
1598
1690
|
unitId: n,
|
|
1599
|
-
subUnitId:
|
|
1600
|
-
tableId:
|
|
1691
|
+
subUnitId: l.getSubunitId(),
|
|
1692
|
+
tableId: s,
|
|
1601
1693
|
config: h
|
|
1602
1694
|
}
|
|
1603
1695
|
}
|
|
1604
1696
|
],
|
|
1605
1697
|
redoMutations: [
|
|
1606
1698
|
{
|
|
1607
|
-
id:
|
|
1699
|
+
id: S.id,
|
|
1608
1700
|
params: R
|
|
1609
1701
|
}
|
|
1610
1702
|
]
|
|
1611
1703
|
}), !0;
|
|
1612
1704
|
}
|
|
1613
|
-
},
|
|
1705
|
+
}, Wn = {
|
|
1614
1706
|
id: "sheet.command.table-insert-row",
|
|
1615
|
-
type:
|
|
1707
|
+
type: N.COMMAND,
|
|
1616
1708
|
handler: (t) => {
|
|
1617
1709
|
const e = t.get(E), n = $(e);
|
|
1618
1710
|
if (!n)
|
|
1619
1711
|
return !1;
|
|
1620
|
-
const { workbook:
|
|
1621
|
-
if (!
|
|
1712
|
+
const { workbook: s, worksheet: r, unitId: a, subUnitId: o } = n, i = t.get(be).getCurrentSelections();
|
|
1713
|
+
if (!i.length || i.length > 1)
|
|
1622
1714
|
return !1;
|
|
1623
1715
|
t.get(T);
|
|
1624
|
-
const h =
|
|
1716
|
+
const h = i[0].range, c = t.get(W).getContainerTableWithRange(a, o, h);
|
|
1625
1717
|
if (!c) return !1;
|
|
1626
|
-
const
|
|
1627
|
-
if (w - R <
|
|
1718
|
+
const g = h.endRow - h.startRow + 1, w = r.getRowCount() - 1, R = r.getCellMatrix().getDataRange().endRow, f = [], I = [];
|
|
1719
|
+
if (w - R < g)
|
|
1628
1720
|
f.push({
|
|
1629
1721
|
id: Ve.id,
|
|
1630
1722
|
params: {
|
|
@@ -1633,7 +1725,7 @@ const C = {
|
|
|
1633
1725
|
range: { ...h }
|
|
1634
1726
|
}
|
|
1635
1727
|
}), f.push({
|
|
1636
|
-
id:
|
|
1728
|
+
id: S.id,
|
|
1637
1729
|
params: {
|
|
1638
1730
|
unitId: a,
|
|
1639
1731
|
subUnitId: o,
|
|
@@ -1642,13 +1734,13 @@ const C = {
|
|
|
1642
1734
|
updateRange: {
|
|
1643
1735
|
newRange: {
|
|
1644
1736
|
...c.getRange(),
|
|
1645
|
-
endRow: c.getRange().endRow +
|
|
1737
|
+
endRow: c.getRange().endRow + g
|
|
1646
1738
|
}
|
|
1647
1739
|
}
|
|
1648
1740
|
}
|
|
1649
1741
|
}
|
|
1650
1742
|
}), I.push({
|
|
1651
|
-
id:
|
|
1743
|
+
id: S.id,
|
|
1652
1744
|
params: {
|
|
1653
1745
|
unitId: a,
|
|
1654
1746
|
subUnitId: o,
|
|
@@ -1670,7 +1762,7 @@ const C = {
|
|
|
1670
1762
|
else {
|
|
1671
1763
|
const v = { ...c.getRange() };
|
|
1672
1764
|
f.push({
|
|
1673
|
-
id:
|
|
1765
|
+
id: S.id,
|
|
1674
1766
|
params: {
|
|
1675
1767
|
unitId: a,
|
|
1676
1768
|
subUnitId: o,
|
|
@@ -1679,13 +1771,13 @@ const C = {
|
|
|
1679
1771
|
updateRange: {
|
|
1680
1772
|
newRange: {
|
|
1681
1773
|
...v,
|
|
1682
|
-
endRow: v.endRow +
|
|
1774
|
+
endRow: v.endRow + g
|
|
1683
1775
|
}
|
|
1684
1776
|
}
|
|
1685
1777
|
}
|
|
1686
1778
|
}
|
|
1687
1779
|
}), I.push({
|
|
1688
|
-
id:
|
|
1780
|
+
id: S.id,
|
|
1689
1781
|
params: {
|
|
1690
1782
|
unitId: a,
|
|
1691
1783
|
subUnitId: o,
|
|
@@ -1697,7 +1789,7 @@ const C = {
|
|
|
1697
1789
|
}
|
|
1698
1790
|
}
|
|
1699
1791
|
});
|
|
1700
|
-
const
|
|
1792
|
+
const ee = we(
|
|
1701
1793
|
t,
|
|
1702
1794
|
{
|
|
1703
1795
|
unitId: a,
|
|
@@ -1713,133 +1805,133 @@ const C = {
|
|
|
1713
1805
|
unitId: a,
|
|
1714
1806
|
subUnitId: o,
|
|
1715
1807
|
range: {
|
|
1716
|
-
startRow: h.startRow +
|
|
1717
|
-
endRow: R +
|
|
1808
|
+
startRow: h.startRow + g,
|
|
1809
|
+
endRow: R + g,
|
|
1718
1810
|
startColumn: v.startColumn,
|
|
1719
1811
|
endColumn: v.endColumn
|
|
1720
1812
|
}
|
|
1721
1813
|
}
|
|
1722
1814
|
);
|
|
1723
|
-
|
|
1815
|
+
ee && (f.push(...ee.redos), I.push(...ee.undos));
|
|
1724
1816
|
}
|
|
1725
1817
|
const U = t.get(x);
|
|
1726
|
-
return
|
|
1818
|
+
return B(f, U) && t.get(A).pushUndoRedo({
|
|
1727
1819
|
unitID: a,
|
|
1728
1820
|
undoMutations: I,
|
|
1729
1821
|
redoMutations: f
|
|
1730
1822
|
}), !0;
|
|
1731
1823
|
}
|
|
1732
|
-
},
|
|
1824
|
+
}, Hn = {
|
|
1733
1825
|
id: "sheet.command.table-insert-col",
|
|
1734
|
-
type:
|
|
1826
|
+
type: N.COMMAND,
|
|
1735
1827
|
handler: (t) => {
|
|
1736
1828
|
const e = t.get(E), n = $(e);
|
|
1737
1829
|
if (!n)
|
|
1738
1830
|
return !1;
|
|
1739
|
-
const { worksheet:
|
|
1831
|
+
const { worksheet: s, unitId: r, subUnitId: a } = n, u = t.get(be).getCurrentSelections();
|
|
1740
1832
|
if (!u.length || u.length > 1)
|
|
1741
1833
|
return !1;
|
|
1742
|
-
const
|
|
1834
|
+
const l = u[0].range, d = t.get(W).getContainerTableWithRange(r, a, l);
|
|
1743
1835
|
if (!d) return !1;
|
|
1744
|
-
const c =
|
|
1745
|
-
if (
|
|
1836
|
+
const c = l.endColumn - l.startColumn + 1, C = s.getColumnCount() - 1, w = s.getCellMatrix().getDataRange().endColumn, R = [], f = [];
|
|
1837
|
+
if (C - w < c)
|
|
1746
1838
|
R.push({
|
|
1747
1839
|
id: qe.id,
|
|
1748
1840
|
params: {
|
|
1749
|
-
unitId:
|
|
1841
|
+
unitId: r,
|
|
1750
1842
|
subUnitId: a,
|
|
1751
|
-
range: { ...
|
|
1843
|
+
range: { ...l }
|
|
1752
1844
|
}
|
|
1753
1845
|
}), R.push({
|
|
1754
|
-
id:
|
|
1846
|
+
id: S.id,
|
|
1755
1847
|
params: {
|
|
1756
|
-
unitId:
|
|
1848
|
+
unitId: r,
|
|
1757
1849
|
subUnitId: a,
|
|
1758
1850
|
tableId: d.getId(),
|
|
1759
1851
|
config: {
|
|
1760
1852
|
rowColOperation: {
|
|
1761
1853
|
operationType: M.Insert,
|
|
1762
|
-
rowColType:
|
|
1763
|
-
index:
|
|
1854
|
+
rowColType: y.Col,
|
|
1855
|
+
index: l.startColumn,
|
|
1764
1856
|
count: c
|
|
1765
1857
|
}
|
|
1766
1858
|
}
|
|
1767
1859
|
}
|
|
1768
1860
|
}), f.push({
|
|
1769
|
-
id:
|
|
1861
|
+
id: S.id,
|
|
1770
1862
|
params: {
|
|
1771
|
-
unitId:
|
|
1863
|
+
unitId: r,
|
|
1772
1864
|
subUnitId: a,
|
|
1773
1865
|
tableId: d.getId(),
|
|
1774
1866
|
config: {
|
|
1775
1867
|
rowColOperation: {
|
|
1776
1868
|
operationType: M.Delete,
|
|
1777
|
-
rowColType:
|
|
1778
|
-
index:
|
|
1869
|
+
rowColType: y.Col,
|
|
1870
|
+
index: l.startColumn,
|
|
1779
1871
|
count: c
|
|
1780
1872
|
}
|
|
1781
1873
|
}
|
|
1782
1874
|
}
|
|
1783
1875
|
}), f.push({
|
|
1784
|
-
id:
|
|
1876
|
+
id: Je.id,
|
|
1785
1877
|
params: {
|
|
1786
|
-
unitId:
|
|
1878
|
+
unitId: r,
|
|
1787
1879
|
subUnitId: a,
|
|
1788
|
-
range: { ...
|
|
1880
|
+
range: { ...l }
|
|
1789
1881
|
}
|
|
1790
1882
|
});
|
|
1791
1883
|
else {
|
|
1792
1884
|
const _ = d.getRange();
|
|
1793
1885
|
R.push({
|
|
1794
|
-
id:
|
|
1886
|
+
id: S.id,
|
|
1795
1887
|
params: {
|
|
1796
|
-
unitId:
|
|
1888
|
+
unitId: r,
|
|
1797
1889
|
subUnitId: a,
|
|
1798
1890
|
tableId: d.getId(),
|
|
1799
1891
|
config: {
|
|
1800
1892
|
rowColOperation: {
|
|
1801
1893
|
operationType: M.Insert,
|
|
1802
|
-
rowColType:
|
|
1803
|
-
index:
|
|
1894
|
+
rowColType: y.Col,
|
|
1895
|
+
index: l.startColumn,
|
|
1804
1896
|
count: c
|
|
1805
1897
|
}
|
|
1806
1898
|
}
|
|
1807
1899
|
}
|
|
1808
1900
|
}), f.push({
|
|
1809
|
-
id:
|
|
1901
|
+
id: S.id,
|
|
1810
1902
|
params: {
|
|
1811
|
-
unitId:
|
|
1903
|
+
unitId: r,
|
|
1812
1904
|
subUnitId: a,
|
|
1813
1905
|
tableId: d.getId(),
|
|
1814
1906
|
config: {
|
|
1815
1907
|
rowColOperation: {
|
|
1816
1908
|
operationType: M.Delete,
|
|
1817
|
-
rowColType:
|
|
1818
|
-
index:
|
|
1909
|
+
rowColType: y.Col,
|
|
1910
|
+
index: l.startColumn,
|
|
1819
1911
|
count: c
|
|
1820
1912
|
}
|
|
1821
1913
|
}
|
|
1822
1914
|
}
|
|
1823
1915
|
});
|
|
1824
|
-
const v =
|
|
1916
|
+
const v = we(
|
|
1825
1917
|
t,
|
|
1826
1918
|
{
|
|
1827
|
-
unitId:
|
|
1919
|
+
unitId: r,
|
|
1828
1920
|
subUnitId: a,
|
|
1829
1921
|
range: {
|
|
1830
1922
|
startRow: _.startRow,
|
|
1831
1923
|
endRow: _.endRow,
|
|
1832
|
-
startColumn:
|
|
1924
|
+
startColumn: l.startColumn,
|
|
1833
1925
|
endColumn: w
|
|
1834
1926
|
}
|
|
1835
1927
|
},
|
|
1836
1928
|
{
|
|
1837
|
-
unitId:
|
|
1929
|
+
unitId: r,
|
|
1838
1930
|
subUnitId: a,
|
|
1839
1931
|
range: {
|
|
1840
1932
|
startRow: _.startRow,
|
|
1841
1933
|
endRow: _.endRow,
|
|
1842
|
-
startColumn:
|
|
1934
|
+
startColumn: l.startColumn + c,
|
|
1843
1935
|
endColumn: w + c
|
|
1844
1936
|
}
|
|
1845
1937
|
}
|
|
@@ -1847,31 +1939,31 @@ const C = {
|
|
|
1847
1939
|
v && (R.push(...v.redos), f.push(...v.undos));
|
|
1848
1940
|
}
|
|
1849
1941
|
const I = t.get(x);
|
|
1850
|
-
return
|
|
1851
|
-
unitID:
|
|
1942
|
+
return B(R, I) && t.get(A).pushUndoRedo({
|
|
1943
|
+
unitID: r,
|
|
1852
1944
|
undoMutations: f,
|
|
1853
1945
|
redoMutations: R
|
|
1854
1946
|
}), !0;
|
|
1855
1947
|
}
|
|
1856
|
-
},
|
|
1948
|
+
}, Vn = {
|
|
1857
1949
|
id: "sheet.command.table-remove-row",
|
|
1858
|
-
type:
|
|
1950
|
+
type: N.COMMAND,
|
|
1859
1951
|
handler: (t, e) => {
|
|
1860
1952
|
if (!e)
|
|
1861
1953
|
return !1;
|
|
1862
|
-
const n = t.get(E),
|
|
1863
|
-
if (!
|
|
1954
|
+
const n = t.get(E), s = $(n);
|
|
1955
|
+
if (!s)
|
|
1864
1956
|
return !1;
|
|
1865
|
-
const { unitId:
|
|
1957
|
+
const { unitId: r, subUnitId: a } = s, u = t.get(be).getCurrentSelections();
|
|
1866
1958
|
if (!u.length || u.length > 1)
|
|
1867
1959
|
return !1;
|
|
1868
|
-
const
|
|
1960
|
+
const l = u[0].range, d = t.get(W).getContainerTableWithRange(r, a, l);
|
|
1869
1961
|
if (!d) return !1;
|
|
1870
|
-
const c =
|
|
1871
|
-
|
|
1872
|
-
id:
|
|
1962
|
+
const c = l.endRow - l.startRow + 1, g = [], C = [], w = d.getRange();
|
|
1963
|
+
g.push({
|
|
1964
|
+
id: S.id,
|
|
1873
1965
|
params: {
|
|
1874
|
-
unitId:
|
|
1966
|
+
unitId: r,
|
|
1875
1967
|
subUnitId: a,
|
|
1876
1968
|
tableId: d.getId(),
|
|
1877
1969
|
config: {
|
|
@@ -1883,10 +1975,10 @@ const C = {
|
|
|
1883
1975
|
}
|
|
1884
1976
|
}
|
|
1885
1977
|
}
|
|
1886
|
-
}),
|
|
1887
|
-
id:
|
|
1978
|
+
}), C.push({
|
|
1979
|
+
id: S.id,
|
|
1888
1980
|
params: {
|
|
1889
|
-
unitId:
|
|
1981
|
+
unitId: r,
|
|
1890
1982
|
subUnitId: a,
|
|
1891
1983
|
tableId: d.getId(),
|
|
1892
1984
|
config: {
|
|
@@ -1896,56 +1988,56 @@ const C = {
|
|
|
1896
1988
|
}
|
|
1897
1989
|
}
|
|
1898
1990
|
});
|
|
1899
|
-
const f =
|
|
1991
|
+
const f = s.worksheet.getCellMatrix().getDataRange().endRow, I = we(
|
|
1900
1992
|
t,
|
|
1901
1993
|
{
|
|
1902
|
-
unitId:
|
|
1994
|
+
unitId: r,
|
|
1903
1995
|
subUnitId: a,
|
|
1904
1996
|
range: {
|
|
1905
|
-
startRow:
|
|
1997
|
+
startRow: l.endRow + 1,
|
|
1906
1998
|
endRow: f,
|
|
1907
1999
|
startColumn: w.startColumn,
|
|
1908
2000
|
endColumn: w.endColumn
|
|
1909
2001
|
}
|
|
1910
2002
|
},
|
|
1911
2003
|
{
|
|
1912
|
-
unitId:
|
|
2004
|
+
unitId: r,
|
|
1913
2005
|
subUnitId: a,
|
|
1914
2006
|
range: {
|
|
1915
|
-
startRow:
|
|
2007
|
+
startRow: l.startRow,
|
|
1916
2008
|
endRow: f - c,
|
|
1917
2009
|
startColumn: w.startColumn,
|
|
1918
2010
|
endColumn: w.endColumn
|
|
1919
2011
|
}
|
|
1920
2012
|
}
|
|
1921
2013
|
);
|
|
1922
|
-
I && (
|
|
2014
|
+
I && (g.push(...I.redos), C.push(...I.undos));
|
|
1923
2015
|
const U = t.get(x);
|
|
1924
|
-
return
|
|
1925
|
-
unitID:
|
|
1926
|
-
undoMutations:
|
|
1927
|
-
redoMutations:
|
|
2016
|
+
return B(g, U) && t.get(A).pushUndoRedo({
|
|
2017
|
+
unitID: r,
|
|
2018
|
+
undoMutations: C,
|
|
2019
|
+
redoMutations: g
|
|
1928
2020
|
}), !0;
|
|
1929
2021
|
}
|
|
1930
|
-
},
|
|
2022
|
+
}, Pn = {
|
|
1931
2023
|
id: "sheet.command.table-remove-col",
|
|
1932
|
-
type:
|
|
2024
|
+
type: N.COMMAND,
|
|
1933
2025
|
handler: (t, e) => {
|
|
1934
2026
|
if (!e)
|
|
1935
2027
|
return !1;
|
|
1936
|
-
const n = t.get(E),
|
|
1937
|
-
if (!
|
|
2028
|
+
const n = t.get(E), s = $(n);
|
|
2029
|
+
if (!s)
|
|
1938
2030
|
return !1;
|
|
1939
|
-
const { workbook:
|
|
2031
|
+
const { workbook: r, unitId: a, subUnitId: o } = s;
|
|
1940
2032
|
t.get(T);
|
|
1941
|
-
const
|
|
1942
|
-
if (!
|
|
2033
|
+
const i = t.get(be).getCurrentSelections();
|
|
2034
|
+
if (!i.length || i.length > 1)
|
|
1943
2035
|
return !1;
|
|
1944
|
-
const h =
|
|
2036
|
+
const h = i[0].range, c = t.get(W).getContainerTableWithRange(a, o, h);
|
|
1945
2037
|
if (!c) return !1;
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1948
|
-
id:
|
|
2038
|
+
const g = h.endColumn - h.startColumn + 1, C = [], w = [], R = c.getRange();
|
|
2039
|
+
C.push({
|
|
2040
|
+
id: S.id,
|
|
1949
2041
|
params: {
|
|
1950
2042
|
unitId: a,
|
|
1951
2043
|
subUnitId: o,
|
|
@@ -1953,20 +2045,20 @@ const C = {
|
|
|
1953
2045
|
config: {
|
|
1954
2046
|
rowColOperation: {
|
|
1955
2047
|
operationType: M.Delete,
|
|
1956
|
-
rowColType:
|
|
2048
|
+
rowColType: y.Col,
|
|
1957
2049
|
index: h.startColumn,
|
|
1958
|
-
count:
|
|
2050
|
+
count: g
|
|
1959
2051
|
}
|
|
1960
2052
|
}
|
|
1961
2053
|
}
|
|
1962
2054
|
});
|
|
1963
2055
|
const f = [], I = h.startColumn - R.startColumn;
|
|
1964
|
-
for (let
|
|
1965
|
-
const Te = c.getTableInfo().columns[I +
|
|
2056
|
+
for (let se = 0; se < g; se++) {
|
|
2057
|
+
const Te = c.getTableInfo().columns[I + se];
|
|
1966
2058
|
Te && f.push(Te);
|
|
1967
2059
|
}
|
|
1968
2060
|
w.push({
|
|
1969
|
-
id:
|
|
2061
|
+
id: S.id,
|
|
1970
2062
|
params: {
|
|
1971
2063
|
unitId: a,
|
|
1972
2064
|
subUnitId: o,
|
|
@@ -1974,15 +2066,15 @@ const C = {
|
|
|
1974
2066
|
config: {
|
|
1975
2067
|
rowColOperation: {
|
|
1976
2068
|
operationType: M.Insert,
|
|
1977
|
-
rowColType:
|
|
2069
|
+
rowColType: y.Col,
|
|
1978
2070
|
index: h.startColumn,
|
|
1979
|
-
count:
|
|
2071
|
+
count: g,
|
|
1980
2072
|
columnsJson: f
|
|
1981
2073
|
}
|
|
1982
2074
|
}
|
|
1983
2075
|
}
|
|
1984
2076
|
});
|
|
1985
|
-
const _ =
|
|
2077
|
+
const _ = s.worksheet.getCellMatrix().getDataRange().endColumn, v = we(
|
|
1986
2078
|
t,
|
|
1987
2079
|
{
|
|
1988
2080
|
unitId: a,
|
|
@@ -2001,122 +2093,122 @@ const C = {
|
|
|
2001
2093
|
startRow: R.startRow,
|
|
2002
2094
|
endRow: R.endRow,
|
|
2003
2095
|
startColumn: h.startColumn,
|
|
2004
|
-
endColumn: _ -
|
|
2096
|
+
endColumn: _ - g
|
|
2005
2097
|
}
|
|
2006
2098
|
}
|
|
2007
2099
|
);
|
|
2008
|
-
v && (
|
|
2009
|
-
const
|
|
2010
|
-
return
|
|
2100
|
+
v && (C.push(...v.redos), w.push(...v.undos));
|
|
2101
|
+
const ee = t.get(x);
|
|
2102
|
+
return B(C, ee) && t.get(A).pushUndoRedo({
|
|
2011
2103
|
unitID: a,
|
|
2012
2104
|
undoMutations: w,
|
|
2013
|
-
redoMutations:
|
|
2105
|
+
redoMutations: C
|
|
2014
2106
|
}), !0;
|
|
2015
2107
|
}
|
|
2016
2108
|
};
|
|
2017
|
-
var
|
|
2018
|
-
for (var
|
|
2019
|
-
(o = t[a]) && (
|
|
2020
|
-
return
|
|
2021
|
-
}, Ue = (t, e) => (n,
|
|
2022
|
-
let
|
|
2109
|
+
var qn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, s) => {
|
|
2110
|
+
for (var r = s > 1 ? void 0 : s ? qn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2111
|
+
(o = t[a]) && (r = o(r) || r);
|
|
2112
|
+
return r;
|
|
2113
|
+
}, Ue = (t, e) => (n, s) => e(n, s, t);
|
|
2114
|
+
let ce = class extends Q {
|
|
2023
2115
|
constructor(t, e) {
|
|
2024
2116
|
super(), this._tableManager = t, this._exclusiveRangeService = e, this._initRangeListener();
|
|
2025
2117
|
}
|
|
2026
2118
|
_initRangeListener() {
|
|
2027
2119
|
this.disposeWithMe(
|
|
2028
2120
|
this._tableManager.tableRangeChanged$.subscribe((t) => {
|
|
2029
|
-
const { range: e, tableId: n, unitId:
|
|
2030
|
-
this._exclusiveRangeService.clearExclusiveRangesByGroupId(
|
|
2121
|
+
const { range: e, tableId: n, unitId: s, subUnitId: r } = t;
|
|
2122
|
+
this._exclusiveRangeService.clearExclusiveRangesByGroupId(s, r, re, n), this._exclusiveRangeService.addExclusiveRange(s, r, re, [{
|
|
2031
2123
|
range: { ...e },
|
|
2032
2124
|
groupId: n
|
|
2033
2125
|
}]);
|
|
2034
2126
|
})
|
|
2035
2127
|
), this.disposeWithMe(
|
|
2036
2128
|
this._tableManager.tableAdd$.subscribe((t) => {
|
|
2037
|
-
const { tableId: e, unitId: n, subUnitId:
|
|
2038
|
-
this._exclusiveRangeService.addExclusiveRange(n,
|
|
2039
|
-
range: { ...
|
|
2129
|
+
const { tableId: e, unitId: n, subUnitId: s, range: r } = t;
|
|
2130
|
+
this._exclusiveRangeService.addExclusiveRange(n, s, re, [{
|
|
2131
|
+
range: { ...r },
|
|
2040
2132
|
groupId: e
|
|
2041
2133
|
}]);
|
|
2042
2134
|
})
|
|
2043
2135
|
), this.disposeWithMe(
|
|
2044
2136
|
this._tableManager.tableDelete$.subscribe((t) => {
|
|
2045
|
-
const { tableId: e, unitId: n, subUnitId:
|
|
2046
|
-
this._exclusiveRangeService.clearExclusiveRangesByGroupId(n,
|
|
2137
|
+
const { tableId: e, unitId: n, subUnitId: s } = t;
|
|
2138
|
+
this._exclusiveRangeService.clearExclusiveRangesByGroupId(n, s, re, e);
|
|
2047
2139
|
})
|
|
2048
2140
|
);
|
|
2049
2141
|
}
|
|
2050
2142
|
};
|
|
2051
|
-
|
|
2143
|
+
ce = Jn([
|
|
2052
2144
|
Ue(0, p(T)),
|
|
2053
|
-
Ue(1, p(
|
|
2054
|
-
],
|
|
2055
|
-
var
|
|
2056
|
-
for (var
|
|
2057
|
-
(o = t[a]) && (
|
|
2058
|
-
return
|
|
2059
|
-
},
|
|
2060
|
-
let
|
|
2061
|
-
constructor(t, e, n,
|
|
2062
|
-
super(), this._commandService = t, this._refRangeService = e, this._univerInstanceService = n, this._injector =
|
|
2145
|
+
Ue(1, p(ht))
|
|
2146
|
+
], ce);
|
|
2147
|
+
var kn = Object.getOwnPropertyDescriptor, Qn = (t, e, n, s) => {
|
|
2148
|
+
for (var r = s > 1 ? void 0 : s ? kn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2149
|
+
(o = t[a]) && (r = o(r) || r);
|
|
2150
|
+
return r;
|
|
2151
|
+
}, H = (t, e) => (n, s) => e(n, s, t);
|
|
2152
|
+
let de = class extends Q {
|
|
2153
|
+
constructor(t, e, n, s, r, a, o) {
|
|
2154
|
+
super(), this._commandService = t, this._refRangeService = e, this._univerInstanceService = n, this._injector = s, this._sheetInterceptorService = r, this._tableManager = a, this._localeService = o, this._initCommandInterceptor(), this._initCommandListener();
|
|
2063
2155
|
}
|
|
2064
2156
|
_initCommandInterceptor() {
|
|
2065
2157
|
const t = this;
|
|
2066
2158
|
this._sheetInterceptorService.interceptCommand({
|
|
2067
2159
|
getMutations(e) {
|
|
2068
|
-
const n = { redos: [], undos: [] }, { id:
|
|
2069
|
-
switch (
|
|
2160
|
+
const n = { redos: [], undos: [] }, { id: s, params: r } = e;
|
|
2161
|
+
switch (s) {
|
|
2162
|
+
case ft.id:
|
|
2163
|
+
return t._generateTableMutationWithInsertRow(r);
|
|
2164
|
+
case wt.id:
|
|
2165
|
+
return t._generateTableMutationWithInsertCol(r);
|
|
2070
2166
|
case bt.id:
|
|
2071
|
-
return t.
|
|
2167
|
+
return t._generateTableMutationWithRemoveRow(r);
|
|
2072
2168
|
case mt.id:
|
|
2073
|
-
return t.
|
|
2074
|
-
case gt.id:
|
|
2075
|
-
return t._generateTableMutationWithRemoveRow(s);
|
|
2076
|
-
case ht.id:
|
|
2077
|
-
return t._generateTableMutationWithRemoveCol(s);
|
|
2169
|
+
return t._generateTableMutationWithRemoveCol(r);
|
|
2078
2170
|
}
|
|
2079
2171
|
return n;
|
|
2080
2172
|
}
|
|
2081
2173
|
});
|
|
2082
2174
|
}
|
|
2083
2175
|
_generateTableMutationWithInsertRow(t) {
|
|
2084
|
-
const e = [], n = [],
|
|
2085
|
-
if (!
|
|
2176
|
+
const e = [], n = [], s = $(this._univerInstanceService);
|
|
2177
|
+
if (!s)
|
|
2086
2178
|
return { undos: e, redos: n };
|
|
2087
|
-
const { unitId:
|
|
2179
|
+
const { unitId: r, subUnitId: a } = s, o = this._tableManager.getTablesBySubunitId(r, a);
|
|
2088
2180
|
if (!o.length)
|
|
2089
2181
|
return { undos: e, redos: n };
|
|
2090
2182
|
const { range: u } = t;
|
|
2091
|
-
return o.forEach((
|
|
2092
|
-
const
|
|
2093
|
-
if (u.startRow >
|
|
2183
|
+
return o.forEach((i) => {
|
|
2184
|
+
const l = i.getRange();
|
|
2185
|
+
if (u.startRow > l.startRow && u.startRow <= l.endRow) {
|
|
2094
2186
|
const h = u.endRow - u.startRow + 1;
|
|
2095
2187
|
n.push({
|
|
2096
|
-
id:
|
|
2188
|
+
id: S.id,
|
|
2097
2189
|
params: {
|
|
2098
|
-
unitId:
|
|
2190
|
+
unitId: r,
|
|
2099
2191
|
subUnitId: a,
|
|
2100
|
-
tableId:
|
|
2192
|
+
tableId: i.getId(),
|
|
2101
2193
|
config: {
|
|
2102
2194
|
updateRange: {
|
|
2103
2195
|
newRange: {
|
|
2104
|
-
...
|
|
2105
|
-
endRow:
|
|
2196
|
+
...l,
|
|
2197
|
+
endRow: l.endRow + h
|
|
2106
2198
|
}
|
|
2107
2199
|
}
|
|
2108
2200
|
}
|
|
2109
2201
|
}
|
|
2110
2202
|
}), e.push({
|
|
2111
|
-
id:
|
|
2203
|
+
id: S.id,
|
|
2112
2204
|
params: {
|
|
2113
|
-
unitId:
|
|
2205
|
+
unitId: r,
|
|
2114
2206
|
subUnitId: a,
|
|
2115
|
-
tableId:
|
|
2207
|
+
tableId: i.getId(),
|
|
2116
2208
|
config: {
|
|
2117
2209
|
updateRange: {
|
|
2118
2210
|
newRange: {
|
|
2119
|
-
...
|
|
2211
|
+
...l
|
|
2120
2212
|
}
|
|
2121
2213
|
}
|
|
2122
2214
|
}
|
|
@@ -2126,42 +2218,42 @@ let ue = class extends k {
|
|
|
2126
2218
|
}), { undos: e, redos: n };
|
|
2127
2219
|
}
|
|
2128
2220
|
_generateTableMutationWithInsertCol(t) {
|
|
2129
|
-
const e = [], n = [],
|
|
2130
|
-
if (!
|
|
2221
|
+
const e = [], n = [], s = $(this._univerInstanceService);
|
|
2222
|
+
if (!s)
|
|
2131
2223
|
return { undos: e, redos: n };
|
|
2132
|
-
const { unitId:
|
|
2224
|
+
const { unitId: r, subUnitId: a } = s, o = this._tableManager.getTablesBySubunitId(r, a);
|
|
2133
2225
|
if (!o.length)
|
|
2134
2226
|
return { undos: e, redos: n };
|
|
2135
2227
|
const { range: u } = t;
|
|
2136
|
-
return o.forEach((
|
|
2137
|
-
const
|
|
2138
|
-
if (u.startColumn >
|
|
2228
|
+
return o.forEach((i) => {
|
|
2229
|
+
const l = i.getRange();
|
|
2230
|
+
if (u.startColumn > l.startColumn && u.startColumn <= l.endColumn) {
|
|
2139
2231
|
const h = u.endColumn - u.startColumn + 1;
|
|
2140
2232
|
n.push({
|
|
2141
|
-
id:
|
|
2233
|
+
id: S.id,
|
|
2142
2234
|
params: {
|
|
2143
|
-
unitId:
|
|
2235
|
+
unitId: r,
|
|
2144
2236
|
subUnitId: a,
|
|
2145
|
-
tableId:
|
|
2237
|
+
tableId: i.getId(),
|
|
2146
2238
|
config: {
|
|
2147
2239
|
rowColOperation: {
|
|
2148
2240
|
operationType: M.Insert,
|
|
2149
|
-
rowColType:
|
|
2241
|
+
rowColType: y.Col,
|
|
2150
2242
|
index: u.startColumn,
|
|
2151
2243
|
count: h
|
|
2152
2244
|
}
|
|
2153
2245
|
}
|
|
2154
2246
|
}
|
|
2155
2247
|
}), e.push({
|
|
2156
|
-
id:
|
|
2248
|
+
id: S.id,
|
|
2157
2249
|
params: {
|
|
2158
|
-
unitId:
|
|
2250
|
+
unitId: r,
|
|
2159
2251
|
subUnitId: a,
|
|
2160
|
-
tableId:
|
|
2252
|
+
tableId: i.getId(),
|
|
2161
2253
|
config: {
|
|
2162
2254
|
rowColOperation: {
|
|
2163
2255
|
operationType: M.Delete,
|
|
2164
|
-
rowColType:
|
|
2256
|
+
rowColType: y.Col,
|
|
2165
2257
|
index: u.startColumn,
|
|
2166
2258
|
count: h
|
|
2167
2259
|
}
|
|
@@ -2172,39 +2264,39 @@ let ue = class extends k {
|
|
|
2172
2264
|
}), { undos: e, redos: n };
|
|
2173
2265
|
}
|
|
2174
2266
|
_generateTableMutationWithRemoveRow(t) {
|
|
2175
|
-
const e = [], n = [],
|
|
2267
|
+
const e = [], n = [], s = [], r = [], a = $(this._univerInstanceService);
|
|
2176
2268
|
if (!a)
|
|
2177
|
-
return { undos: e, redos: n, preRedos:
|
|
2178
|
-
const { unitId: o, subUnitId: u } = a,
|
|
2179
|
-
if (!
|
|
2180
|
-
return { undos: e, redos: n, preRedos:
|
|
2181
|
-
const { range:
|
|
2182
|
-
return
|
|
2269
|
+
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2270
|
+
const { unitId: o, subUnitId: u } = a, i = this._tableManager.getTablesBySubunitId(o, u);
|
|
2271
|
+
if (!i.length)
|
|
2272
|
+
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2273
|
+
const { range: l } = t, h = l.endRow - l.startRow + 1;
|
|
2274
|
+
return i.forEach((d) => {
|
|
2183
2275
|
const c = d.getRange();
|
|
2184
|
-
if (
|
|
2185
|
-
if (
|
|
2186
|
-
|
|
2187
|
-
id:
|
|
2276
|
+
if (Se.intersects(c, l))
|
|
2277
|
+
if (l.startRow <= c.startRow && l.endRow >= c.startRow) {
|
|
2278
|
+
s.push({
|
|
2279
|
+
id: k.id,
|
|
2188
2280
|
params: {
|
|
2189
2281
|
unitId: o,
|
|
2190
2282
|
subUnitId: u,
|
|
2191
2283
|
tableId: d.getId()
|
|
2192
2284
|
}
|
|
2193
2285
|
});
|
|
2194
|
-
const
|
|
2286
|
+
const g = d.toJSON();
|
|
2195
2287
|
e.push({
|
|
2196
|
-
id:
|
|
2288
|
+
id: J.id,
|
|
2197
2289
|
params: {
|
|
2198
2290
|
unitId: o,
|
|
2199
2291
|
subUnitId: u,
|
|
2200
|
-
tableId:
|
|
2201
|
-
name:
|
|
2202
|
-
range:
|
|
2203
|
-
options:
|
|
2292
|
+
tableId: g.id,
|
|
2293
|
+
name: g.name,
|
|
2294
|
+
range: g.range,
|
|
2295
|
+
options: g.options
|
|
2204
2296
|
}
|
|
2205
2297
|
});
|
|
2206
|
-
} else
|
|
2207
|
-
id:
|
|
2298
|
+
} else l.startRow > c.startRow && l.startRow <= c.endRow ? (n.push({
|
|
2299
|
+
id: S.id,
|
|
2208
2300
|
params: {
|
|
2209
2301
|
unitId: o,
|
|
2210
2302
|
subUnitId: u,
|
|
@@ -2219,7 +2311,7 @@ let ue = class extends k {
|
|
|
2219
2311
|
}
|
|
2220
2312
|
}
|
|
2221
2313
|
}), e.push({
|
|
2222
|
-
id:
|
|
2314
|
+
id: S.id,
|
|
2223
2315
|
params: {
|
|
2224
2316
|
unitId: o,
|
|
2225
2317
|
subUnitId: u,
|
|
@@ -2232,8 +2324,8 @@ let ue = class extends k {
|
|
|
2232
2324
|
}
|
|
2233
2325
|
}
|
|
2234
2326
|
}
|
|
2235
|
-
})) :
|
|
2236
|
-
id:
|
|
2327
|
+
})) : l.startRow < c.endRow && l.endRow >= c.endRow && (n.push({
|
|
2328
|
+
id: S.id,
|
|
2237
2329
|
params: {
|
|
2238
2330
|
unitId: o,
|
|
2239
2331
|
subUnitId: u,
|
|
@@ -2242,13 +2334,13 @@ let ue = class extends k {
|
|
|
2242
2334
|
updateRange: {
|
|
2243
2335
|
newRange: {
|
|
2244
2336
|
...c,
|
|
2245
|
-
endRow:
|
|
2337
|
+
endRow: l.startRow - 1
|
|
2246
2338
|
}
|
|
2247
2339
|
}
|
|
2248
2340
|
}
|
|
2249
2341
|
}
|
|
2250
2342
|
}), e.push({
|
|
2251
|
-
id:
|
|
2343
|
+
id: S.id,
|
|
2252
2344
|
params: {
|
|
2253
2345
|
unitId: o,
|
|
2254
2346
|
subUnitId: u,
|
|
@@ -2262,50 +2354,50 @@ let ue = class extends k {
|
|
|
2262
2354
|
}
|
|
2263
2355
|
}
|
|
2264
2356
|
}));
|
|
2265
|
-
}), { undos: e, redos: n, preRedos:
|
|
2357
|
+
}), { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2266
2358
|
}
|
|
2267
2359
|
_generateTableMutationWithRemoveCol(t) {
|
|
2268
|
-
const e = [], n = [],
|
|
2360
|
+
const e = [], n = [], s = [], r = [], a = $(this._univerInstanceService);
|
|
2269
2361
|
if (!a)
|
|
2270
|
-
return { undos: e, redos: n, preRedos:
|
|
2271
|
-
const { unitId: o, subUnitId: u } = a,
|
|
2272
|
-
if (!
|
|
2273
|
-
return { undos: e, redos: n, preRedos:
|
|
2274
|
-
const { range:
|
|
2275
|
-
return
|
|
2362
|
+
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2363
|
+
const { unitId: o, subUnitId: u } = a, i = this._tableManager.getTablesBySubunitId(o, u);
|
|
2364
|
+
if (!i.length)
|
|
2365
|
+
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2366
|
+
const { range: l } = t, h = l.endColumn - l.startColumn + 1;
|
|
2367
|
+
return i.forEach((d) => {
|
|
2276
2368
|
const c = d.getRange();
|
|
2277
|
-
if (
|
|
2278
|
-
if (
|
|
2279
|
-
|
|
2280
|
-
id:
|
|
2369
|
+
if (Se.intersects(c, l)) {
|
|
2370
|
+
if (l.startColumn <= c.startColumn && l.endColumn >= c.endColumn) {
|
|
2371
|
+
s.push({
|
|
2372
|
+
id: k.id,
|
|
2281
2373
|
params: {
|
|
2282
2374
|
unitId: o,
|
|
2283
2375
|
subUnitId: u,
|
|
2284
2376
|
tableId: d.getId()
|
|
2285
2377
|
}
|
|
2286
2378
|
});
|
|
2287
|
-
const
|
|
2379
|
+
const g = d.toJSON(), { startRow: C, startColumn: w, endColumn: R } = g.range, f = this._univerInstanceService.getUnit(o), I = f == null ? void 0 : f.getSheetBySheetId(u);
|
|
2288
2380
|
if (!I)
|
|
2289
|
-
return { undos: e, redos: n, preRedos:
|
|
2381
|
+
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2290
2382
|
const U = [];
|
|
2291
2383
|
for (let _ = w; _ <= R; _++)
|
|
2292
|
-
U.push(Ye(I == null ? void 0 : I.getCell(
|
|
2384
|
+
U.push(Ye(I == null ? void 0 : I.getCell(C, _)) || te(_ - w + 1, this._localeService.t("sheets-table.columnPrefix")));
|
|
2293
2385
|
e.push({
|
|
2294
|
-
id:
|
|
2386
|
+
id: J.id,
|
|
2295
2387
|
params: {
|
|
2296
2388
|
unitId: o,
|
|
2297
2389
|
subUnitId: u,
|
|
2298
|
-
tableId:
|
|
2299
|
-
name:
|
|
2390
|
+
tableId: g.id,
|
|
2391
|
+
name: g.name,
|
|
2300
2392
|
header: U,
|
|
2301
|
-
range:
|
|
2302
|
-
options:
|
|
2393
|
+
range: g.range,
|
|
2394
|
+
options: g.options
|
|
2303
2395
|
}
|
|
2304
2396
|
});
|
|
2305
|
-
} else if (
|
|
2306
|
-
const
|
|
2397
|
+
} else if (l.startColumn <= c.startColumn && l.endColumn >= c.startColumn) {
|
|
2398
|
+
const g = l.endColumn - c.startColumn + 1;
|
|
2307
2399
|
n.push({
|
|
2308
|
-
id:
|
|
2400
|
+
id: S.id,
|
|
2309
2401
|
params: {
|
|
2310
2402
|
unitId: o,
|
|
2311
2403
|
subUnitId: u,
|
|
@@ -2313,20 +2405,20 @@ let ue = class extends k {
|
|
|
2313
2405
|
config: {
|
|
2314
2406
|
rowColOperation: {
|
|
2315
2407
|
operationType: M.Delete,
|
|
2316
|
-
rowColType:
|
|
2408
|
+
rowColType: y.Col,
|
|
2317
2409
|
index: c.startColumn,
|
|
2318
|
-
count:
|
|
2410
|
+
count: g
|
|
2319
2411
|
}
|
|
2320
2412
|
}
|
|
2321
2413
|
}
|
|
2322
2414
|
});
|
|
2323
|
-
const
|
|
2324
|
-
for (let w = 0; w <
|
|
2415
|
+
const C = [];
|
|
2416
|
+
for (let w = 0; w < g; w++) {
|
|
2325
2417
|
const R = d.getTableColumnByIndex(w);
|
|
2326
|
-
R &&
|
|
2418
|
+
R && C.push(R.toJSON());
|
|
2327
2419
|
}
|
|
2328
2420
|
e.push({
|
|
2329
|
-
id:
|
|
2421
|
+
id: S.id,
|
|
2330
2422
|
params: {
|
|
2331
2423
|
unitId: o,
|
|
2332
2424
|
subUnitId: u,
|
|
@@ -2334,18 +2426,18 @@ let ue = class extends k {
|
|
|
2334
2426
|
config: {
|
|
2335
2427
|
rowColOperation: {
|
|
2336
2428
|
operationType: M.Insert,
|
|
2337
|
-
rowColType:
|
|
2429
|
+
rowColType: y.Col,
|
|
2338
2430
|
index: c.startColumn,
|
|
2339
|
-
count:
|
|
2340
|
-
columnsJson:
|
|
2431
|
+
count: g,
|
|
2432
|
+
columnsJson: C
|
|
2341
2433
|
}
|
|
2342
2434
|
}
|
|
2343
2435
|
}
|
|
2344
2436
|
});
|
|
2345
|
-
} else if (
|
|
2346
|
-
const
|
|
2437
|
+
} else if (l.startColumn > c.startColumn && l.endColumn > c.endColumn) {
|
|
2438
|
+
const g = c.endColumn - l.startColumn + 1;
|
|
2347
2439
|
n.push({
|
|
2348
|
-
id:
|
|
2440
|
+
id: S.id,
|
|
2349
2441
|
params: {
|
|
2350
2442
|
unitId: o,
|
|
2351
2443
|
subUnitId: u,
|
|
@@ -2353,20 +2445,20 @@ let ue = class extends k {
|
|
|
2353
2445
|
config: {
|
|
2354
2446
|
rowColOperation: {
|
|
2355
2447
|
operationType: M.Delete,
|
|
2356
|
-
rowColType:
|
|
2357
|
-
index:
|
|
2358
|
-
count:
|
|
2448
|
+
rowColType: y.Col,
|
|
2449
|
+
index: l.startColumn,
|
|
2450
|
+
count: g
|
|
2359
2451
|
}
|
|
2360
2452
|
}
|
|
2361
2453
|
}
|
|
2362
2454
|
});
|
|
2363
|
-
const
|
|
2364
|
-
for (let R = 0; R <
|
|
2455
|
+
const C = [], w = l.startColumn - c.startColumn;
|
|
2456
|
+
for (let R = 0; R < g; R++) {
|
|
2365
2457
|
const f = d.getTableColumnByIndex(R + w);
|
|
2366
|
-
f &&
|
|
2458
|
+
f && C.push(f.toJSON());
|
|
2367
2459
|
}
|
|
2368
2460
|
e.push({
|
|
2369
|
-
id:
|
|
2461
|
+
id: S.id,
|
|
2370
2462
|
params: {
|
|
2371
2463
|
unitId: o,
|
|
2372
2464
|
subUnitId: u,
|
|
@@ -2374,17 +2466,17 @@ let ue = class extends k {
|
|
|
2374
2466
|
config: {
|
|
2375
2467
|
rowColOperation: {
|
|
2376
2468
|
operationType: M.Insert,
|
|
2377
|
-
rowColType:
|
|
2378
|
-
index:
|
|
2469
|
+
rowColType: y.Col,
|
|
2470
|
+
index: l.startColumn,
|
|
2379
2471
|
count: h,
|
|
2380
|
-
columnsJson:
|
|
2472
|
+
columnsJson: C
|
|
2381
2473
|
}
|
|
2382
2474
|
}
|
|
2383
2475
|
}
|
|
2384
2476
|
});
|
|
2385
|
-
} else if (
|
|
2477
|
+
} else if (l.startColumn > c.startColumn && l.endColumn <= c.endColumn) {
|
|
2386
2478
|
n.push({
|
|
2387
|
-
id:
|
|
2479
|
+
id: S.id,
|
|
2388
2480
|
params: {
|
|
2389
2481
|
unitId: o,
|
|
2390
2482
|
subUnitId: u,
|
|
@@ -2392,20 +2484,20 @@ let ue = class extends k {
|
|
|
2392
2484
|
config: {
|
|
2393
2485
|
rowColOperation: {
|
|
2394
2486
|
operationType: M.Delete,
|
|
2395
|
-
rowColType:
|
|
2396
|
-
index:
|
|
2487
|
+
rowColType: y.Col,
|
|
2488
|
+
index: l.startColumn,
|
|
2397
2489
|
count: h
|
|
2398
2490
|
}
|
|
2399
2491
|
}
|
|
2400
2492
|
}
|
|
2401
2493
|
});
|
|
2402
|
-
const
|
|
2494
|
+
const g = [], C = l.startColumn - c.startColumn;
|
|
2403
2495
|
for (let w = 0; w < h; w++) {
|
|
2404
|
-
const R = d.getTableColumnByIndex(w +
|
|
2405
|
-
R &&
|
|
2496
|
+
const R = d.getTableColumnByIndex(w + C);
|
|
2497
|
+
R && g.push(R.toJSON());
|
|
2406
2498
|
}
|
|
2407
2499
|
e.push({
|
|
2408
|
-
id:
|
|
2500
|
+
id: S.id,
|
|
2409
2501
|
params: {
|
|
2410
2502
|
unitId: o,
|
|
2411
2503
|
subUnitId: u,
|
|
@@ -2413,65 +2505,65 @@ let ue = class extends k {
|
|
|
2413
2505
|
config: {
|
|
2414
2506
|
rowColOperation: {
|
|
2415
2507
|
operationType: M.Insert,
|
|
2416
|
-
rowColType:
|
|
2417
|
-
index:
|
|
2508
|
+
rowColType: y.Col,
|
|
2509
|
+
index: l.startColumn,
|
|
2418
2510
|
count: h,
|
|
2419
|
-
columnsJson:
|
|
2511
|
+
columnsJson: g
|
|
2420
2512
|
}
|
|
2421
2513
|
}
|
|
2422
2514
|
}
|
|
2423
2515
|
});
|
|
2424
2516
|
}
|
|
2425
2517
|
}
|
|
2426
|
-
}), { undos: e, redos: n, preRedos:
|
|
2518
|
+
}), { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2427
2519
|
}
|
|
2428
2520
|
_initCommandListener() {
|
|
2429
2521
|
this._commandService.onCommandExecuted((t) => {
|
|
2430
2522
|
if (t.id === Ve.id) {
|
|
2431
|
-
const e = t.params, { unitId: n, subUnitId:
|
|
2432
|
-
this._tableManager.getTablesBySubunitId(n,
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2523
|
+
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endRow - r.startRow + 1;
|
|
2524
|
+
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2525
|
+
const i = u.getRange();
|
|
2526
|
+
r.startRow <= i.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2435
2527
|
newRange: {
|
|
2436
|
-
...
|
|
2437
|
-
startRow:
|
|
2438
|
-
endRow:
|
|
2528
|
+
...i,
|
|
2529
|
+
startRow: i.startRow + a,
|
|
2530
|
+
endRow: i.endRow + a
|
|
2439
2531
|
}
|
|
2440
2532
|
});
|
|
2441
2533
|
});
|
|
2442
2534
|
} else if (t.id === qe.id) {
|
|
2443
|
-
const e = t.params, { unitId: n, subUnitId:
|
|
2444
|
-
this._tableManager.getTablesBySubunitId(n,
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2535
|
+
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endColumn - r.startColumn + 1;
|
|
2536
|
+
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2537
|
+
const i = u.getRange();
|
|
2538
|
+
r.startColumn <= i.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2447
2539
|
newRange: {
|
|
2448
|
-
...
|
|
2449
|
-
startColumn:
|
|
2450
|
-
endColumn:
|
|
2540
|
+
...i,
|
|
2541
|
+
startColumn: i.startColumn + a,
|
|
2542
|
+
endColumn: i.endColumn + a
|
|
2451
2543
|
}
|
|
2452
2544
|
});
|
|
2453
2545
|
});
|
|
2454
2546
|
} else if (t.id === Pe.id) {
|
|
2455
|
-
const e = t.params, { unitId: n, subUnitId:
|
|
2456
|
-
this._tableManager.getTablesBySubunitId(n,
|
|
2457
|
-
const
|
|
2458
|
-
|
|
2547
|
+
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endRow - r.startRow + 1;
|
|
2548
|
+
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2549
|
+
const i = u.getRange();
|
|
2550
|
+
r.startRow < i.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2459
2551
|
newRange: {
|
|
2460
|
-
...
|
|
2461
|
-
startRow:
|
|
2462
|
-
endRow:
|
|
2552
|
+
...i,
|
|
2553
|
+
startRow: i.startRow - a,
|
|
2554
|
+
endRow: i.endRow - a
|
|
2463
2555
|
}
|
|
2464
2556
|
});
|
|
2465
2557
|
});
|
|
2466
|
-
} else if (t.id ===
|
|
2467
|
-
const e = t.params, { unitId: n, subUnitId:
|
|
2468
|
-
this._tableManager.getTablesBySubunitId(n,
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2558
|
+
} else if (t.id === Je.id) {
|
|
2559
|
+
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endColumn - r.startColumn + 1;
|
|
2560
|
+
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2561
|
+
const i = u.getRange();
|
|
2562
|
+
r.startColumn < i.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2471
2563
|
newRange: {
|
|
2472
|
-
...
|
|
2473
|
-
startColumn:
|
|
2474
|
-
endColumn:
|
|
2564
|
+
...i,
|
|
2565
|
+
startColumn: i.startColumn - a,
|
|
2566
|
+
endColumn: i.endColumn - a
|
|
2475
2567
|
}
|
|
2476
2568
|
});
|
|
2477
2569
|
});
|
|
@@ -2479,46 +2571,46 @@ let ue = class extends k {
|
|
|
2479
2571
|
});
|
|
2480
2572
|
}
|
|
2481
2573
|
};
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
],
|
|
2491
|
-
var
|
|
2492
|
-
for (var
|
|
2493
|
-
(o = t[a]) && (
|
|
2494
|
-
return
|
|
2495
|
-
},
|
|
2496
|
-
let
|
|
2497
|
-
constructor(e, n,
|
|
2574
|
+
de = Qn([
|
|
2575
|
+
H(0, p(x)),
|
|
2576
|
+
H(1, p(gt)),
|
|
2577
|
+
H(2, p(E)),
|
|
2578
|
+
H(3, p(Ae)),
|
|
2579
|
+
H(4, p(pe)),
|
|
2580
|
+
H(5, p(T)),
|
|
2581
|
+
H(6, p(me))
|
|
2582
|
+
], de);
|
|
2583
|
+
var Yn = Object.getOwnPropertyDescriptor, Gn = (t, e, n, s) => {
|
|
2584
|
+
for (var r = s > 1 ? void 0 : s ? Yn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2585
|
+
(o = t[a]) && (r = o(r) || r);
|
|
2586
|
+
return r;
|
|
2587
|
+
}, oe = (t, e) => (n, s) => e(n, s, t);
|
|
2588
|
+
let he = class extends Q {
|
|
2589
|
+
constructor(e, n, s, r) {
|
|
2498
2590
|
super();
|
|
2499
2591
|
b(this, "_defaultThemeIndex", 0);
|
|
2500
2592
|
b(this, "_allThemes", []);
|
|
2501
|
-
this._tableManager = e, this._sheetRangeThemeService = n, this._sheetRangeThemeModel =
|
|
2593
|
+
this._tableManager = e, this._sheetRangeThemeService = n, this._sheetRangeThemeModel = s, this._configService = r, this._initUserTableTheme(), this.registerTableChangeEvent(), this._initDefaultTableTheme();
|
|
2502
2594
|
}
|
|
2503
2595
|
registerTableChangeEvent() {
|
|
2504
2596
|
this.disposeWithMe(
|
|
2505
2597
|
this._tableManager.tableAdd$.subscribe((e) => {
|
|
2506
|
-
const { range: n, tableId:
|
|
2507
|
-
u.setTableStyleId(
|
|
2508
|
-
unitId:
|
|
2598
|
+
const { range: n, tableId: s, unitId: r, subUnitId: a, tableStyleId: o } = e, u = this._tableManager.getTable(r, s), i = o || this._allThemes[this._defaultThemeIndex].name;
|
|
2599
|
+
u.setTableStyleId(i), this._sheetRangeThemeService.registerRangeThemeStyle(i, {
|
|
2600
|
+
unitId: r,
|
|
2509
2601
|
subUnitId: a,
|
|
2510
2602
|
range: { ...n }
|
|
2511
2603
|
});
|
|
2512
2604
|
})
|
|
2513
2605
|
), this.disposeWithMe(
|
|
2514
2606
|
this._tableManager.tableRangeChanged$.subscribe((e) => {
|
|
2515
|
-
const { range: n, oldRange:
|
|
2516
|
-
let
|
|
2517
|
-
|
|
2607
|
+
const { range: n, oldRange: s, tableId: r, unitId: a, subUnitId: o } = e, u = this._tableManager.getTable(a, r);
|
|
2608
|
+
let i = u.getTableStyleId();
|
|
2609
|
+
i || (i = this._allThemes[this._defaultThemeIndex].name, u.setTableStyleId(i)), this._sheetRangeThemeService.removeRangeThemeRule(i, {
|
|
2518
2610
|
unitId: a,
|
|
2519
2611
|
subUnitId: o,
|
|
2520
|
-
range: { ...
|
|
2521
|
-
}), this._sheetRangeThemeService.registerRangeThemeStyle(
|
|
2612
|
+
range: { ...s }
|
|
2613
|
+
}), this._sheetRangeThemeService.registerRangeThemeStyle(i, {
|
|
2522
2614
|
unitId: a,
|
|
2523
2615
|
subUnitId: o,
|
|
2524
2616
|
range: { ...n }
|
|
@@ -2526,60 +2618,60 @@ let ce = class extends k {
|
|
|
2526
2618
|
})
|
|
2527
2619
|
), this.disposeWithMe(
|
|
2528
2620
|
this._tableManager.tableThemeChanged$.subscribe((e) => {
|
|
2529
|
-
const { theme: n, oldTheme:
|
|
2530
|
-
this._sheetRangeThemeService.removeRangeThemeRule(
|
|
2621
|
+
const { theme: n, oldTheme: s, tableId: r, unitId: a, subUnitId: o } = e, i = this._tableManager.getTable(a, r).getRange();
|
|
2622
|
+
this._sheetRangeThemeService.removeRangeThemeRule(s, {
|
|
2531
2623
|
unitId: a,
|
|
2532
2624
|
subUnitId: o,
|
|
2533
|
-
range: { ...
|
|
2625
|
+
range: { ...i }
|
|
2534
2626
|
}), this._sheetRangeThemeService.registerRangeThemeStyle(n, {
|
|
2535
2627
|
unitId: a,
|
|
2536
2628
|
subUnitId: o,
|
|
2537
|
-
range: { ...
|
|
2629
|
+
range: { ...i }
|
|
2538
2630
|
});
|
|
2539
2631
|
})
|
|
2540
2632
|
), this.disposeWithMe(
|
|
2541
2633
|
this._tableManager.tableDelete$.subscribe((e) => {
|
|
2542
|
-
const { range: n, unitId:
|
|
2634
|
+
const { range: n, unitId: s, subUnitId: r, tableStyleId: a = this._allThemes[this._defaultThemeIndex].name } = e;
|
|
2543
2635
|
this._sheetRangeThemeService.removeRangeThemeRule(a, {
|
|
2544
|
-
unitId:
|
|
2545
|
-
subUnitId:
|
|
2636
|
+
unitId: s,
|
|
2637
|
+
subUnitId: r,
|
|
2546
2638
|
range: { ...n }
|
|
2547
2639
|
});
|
|
2548
2640
|
})
|
|
2549
2641
|
);
|
|
2550
2642
|
}
|
|
2551
2643
|
_initUserTableTheme() {
|
|
2552
|
-
const e = this._configService.getConfig(Ge) || {}, n = e.defaultThemeIndex || 0,
|
|
2553
|
-
this._defaultThemeIndex = n, this._allThemes =
|
|
2644
|
+
const e = this._configService.getConfig(Ge) || {}, n = e.defaultThemeIndex || 0, s = e.userThemes || [];
|
|
2645
|
+
this._defaultThemeIndex = n, this._allThemes = s.concat(ze);
|
|
2554
2646
|
}
|
|
2555
2647
|
_initDefaultTableTheme() {
|
|
2556
2648
|
for (let e = 0; e < this._allThemes.length; e++) {
|
|
2557
|
-
const { name: n, style:
|
|
2558
|
-
this._sheetRangeThemeModel.registerDefaultRangeTheme(
|
|
2649
|
+
const { name: n, style: s } = this._allThemes[e], r = new St(n, s);
|
|
2650
|
+
this._sheetRangeThemeModel.registerDefaultRangeTheme(r);
|
|
2559
2651
|
}
|
|
2560
2652
|
}
|
|
2561
2653
|
dispose() {
|
|
2562
2654
|
super.dispose(), this._allThemes = [], this._defaultThemeIndex = 0;
|
|
2563
2655
|
}
|
|
2564
2656
|
};
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
],
|
|
2571
|
-
var
|
|
2572
|
-
for (var
|
|
2573
|
-
(o = t[a]) && (
|
|
2574
|
-
return
|
|
2575
|
-
},
|
|
2576
|
-
let
|
|
2577
|
-
constructor(e, n,
|
|
2657
|
+
he = Gn([
|
|
2658
|
+
oe(0, p(T)),
|
|
2659
|
+
oe(1, p(Rt)),
|
|
2660
|
+
oe(2, p(He)),
|
|
2661
|
+
oe(3, Ee)
|
|
2662
|
+
], he);
|
|
2663
|
+
var zn = Object.getOwnPropertyDescriptor, jn = (t, e, n, s) => {
|
|
2664
|
+
for (var r = s > 1 ? void 0 : s ? zn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2665
|
+
(o = t[a]) && (r = o(r) || r);
|
|
2666
|
+
return r;
|
|
2667
|
+
}, ie = (t, e) => (n, s) => e(n, s, t);
|
|
2668
|
+
let ge = class extends Q {
|
|
2669
|
+
constructor(e, n, s, r) {
|
|
2578
2670
|
super();
|
|
2579
|
-
b(this, "_tableFilteredOutRows$", new
|
|
2671
|
+
b(this, "_tableFilteredOutRows$", new ke(/* @__PURE__ */ new Set()));
|
|
2580
2672
|
b(this, "tableFilteredOutRows$", this._tableFilteredOutRows$.asObservable());
|
|
2581
2673
|
b(this, "_subscription", null);
|
|
2582
|
-
this._tableManager = e, this._sheetInterceptorService = n, this._univerInstanceService =
|
|
2674
|
+
this._tableManager = e, this._sheetInterceptorService = n, this._univerInstanceService = s, this._zebraCrossingCacheController = r, this.registerFilterChangeEvent(), this.initTableHiddenRowIntercept(), this._initFilteredOutRows();
|
|
2583
2675
|
}
|
|
2584
2676
|
get tableFilteredOutRows() {
|
|
2585
2677
|
return this._tableFilteredOutRows$.value;
|
|
@@ -2591,26 +2683,26 @@ let de = class extends k {
|
|
|
2591
2683
|
this.disposeWithMe(this._sheetInterceptorService.intercept(Be.ROW_FILTERED, {
|
|
2592
2684
|
// 这里需要保证优先级高于sheet的筛选,因为筛选没有next,低于筛选的不会触发interceptor
|
|
2593
2685
|
priority: 100,
|
|
2594
|
-
handler: (e, n,
|
|
2686
|
+
handler: (e, n, s) => {
|
|
2595
2687
|
if (e) return !0;
|
|
2596
|
-
const
|
|
2597
|
-
return
|
|
2688
|
+
const r = this.tableFilteredOutRows.has(n.row);
|
|
2689
|
+
return r ? !0 : s(r);
|
|
2598
2690
|
}
|
|
2599
2691
|
}));
|
|
2600
2692
|
}
|
|
2601
2693
|
_initFilteredOutRows() {
|
|
2602
2694
|
this._tableManager.tableInitStatus$.pipe(
|
|
2603
|
-
|
|
2604
|
-
Me(() => this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2605
|
-
|
|
2695
|
+
fe((e) => e),
|
|
2696
|
+
Me(() => this._univerInstanceService.getCurrentTypeOfUnit$(z.UNIVER_SHEET)),
|
|
2697
|
+
fe((e) => e != null),
|
|
2606
2698
|
Me((e) => e.activeSheet$),
|
|
2607
|
-
|
|
2699
|
+
fe((e) => e != null)
|
|
2608
2700
|
).subscribe(() => {
|
|
2609
2701
|
const e = $(this._univerInstanceService);
|
|
2610
2702
|
if (!e)
|
|
2611
2703
|
return;
|
|
2612
|
-
const { unitId: n, subUnitId:
|
|
2613
|
-
this.tableFilteredOutRows.clear(), this._tableManager.getTablesBySubunitId(n,
|
|
2704
|
+
const { unitId: n, subUnitId: s } = e;
|
|
2705
|
+
this.tableFilteredOutRows.clear(), this._tableManager.getTablesBySubunitId(n, s).forEach((a) => {
|
|
2614
2706
|
const o = a.getTableFilters().getFilterOutRows();
|
|
2615
2707
|
if (o)
|
|
2616
2708
|
for (const u of o)
|
|
@@ -2621,16 +2713,16 @@ let de = class extends k {
|
|
|
2621
2713
|
registerFilterChangeEvent() {
|
|
2622
2714
|
this.disposeWithMe(
|
|
2623
2715
|
this._tableManager.tableFilterChanged$.subscribe((e) => {
|
|
2624
|
-
var
|
|
2625
|
-
const { unitId: n, subUnitId:
|
|
2716
|
+
var l;
|
|
2717
|
+
const { unitId: n, subUnitId: s, tableId: r } = e, a = (l = this._univerInstanceService.getUnit(n)) == null ? void 0 : l.getSheetBySheetId(s), o = this._tableManager.getTable(n, r);
|
|
2626
2718
|
if (!a || !o)
|
|
2627
2719
|
return;
|
|
2628
|
-
this.tableFilteredOutRows.clear(), o.getTableFilters().doFilter(a, o.getTableFilterRange()), this._tableManager.getTablesBySubunitId(n,
|
|
2720
|
+
this.tableFilteredOutRows.clear(), o.getTableFilters().doFilter(a, o.getTableFilterRange()), this._tableManager.getTablesBySubunitId(n, s).forEach((h) => {
|
|
2629
2721
|
const d = h.getTableFilters().getFilterOutRows();
|
|
2630
2722
|
if (d)
|
|
2631
2723
|
for (const c of d)
|
|
2632
2724
|
this.tableFilteredOutRows.add(c);
|
|
2633
|
-
}), this._zebraCrossingCacheController.updateZebraCrossingCache(n,
|
|
2725
|
+
}), this._zebraCrossingCacheController.updateZebraCrossingCache(n, s);
|
|
2634
2726
|
})
|
|
2635
2727
|
);
|
|
2636
2728
|
}
|
|
@@ -2639,43 +2731,43 @@ let de = class extends k {
|
|
|
2639
2731
|
super.dispose(), (e = this._subscription) == null || e.unsubscribe();
|
|
2640
2732
|
}
|
|
2641
2733
|
};
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
],
|
|
2648
|
-
var
|
|
2649
|
-
for (var
|
|
2650
|
-
(o = t[a]) && (
|
|
2651
|
-
return
|
|
2652
|
-
}, Re = (t, e) => (n,
|
|
2653
|
-
let $e = (
|
|
2654
|
-
constructor(t =
|
|
2655
|
-
super(), this._config = t, this._injector = e, this._configService = n, this._commandService =
|
|
2656
|
-
const { ...
|
|
2734
|
+
ge = jn([
|
|
2735
|
+
ie(0, p(T)),
|
|
2736
|
+
ie(1, p(pe)),
|
|
2737
|
+
ie(2, p(E)),
|
|
2738
|
+
ie(3, p(Ct))
|
|
2739
|
+
], ge);
|
|
2740
|
+
var Kn = Object.getOwnPropertyDescriptor, Xn = (t, e, n, s) => {
|
|
2741
|
+
for (var r = s > 1 ? void 0 : s ? Kn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2742
|
+
(o = t[a]) && (r = o(r) || r);
|
|
2743
|
+
return r;
|
|
2744
|
+
}, Re = (t, e) => (n, s) => e(n, s, t), le;
|
|
2745
|
+
let $e = (le = class extends it {
|
|
2746
|
+
constructor(t = ye, e, n, s) {
|
|
2747
|
+
super(), this._config = t, this._injector = e, this._configService = n, this._commandService = s;
|
|
2748
|
+
const { ...r } = lt(
|
|
2657
2749
|
{},
|
|
2658
|
-
|
|
2750
|
+
ye,
|
|
2659
2751
|
this._config
|
|
2660
2752
|
);
|
|
2661
|
-
this._configService.setConfig(Ge,
|
|
2753
|
+
this._configService.setConfig(Ge, r), this._initRegisterCommand();
|
|
2662
2754
|
}
|
|
2663
2755
|
onStarting() {
|
|
2664
2756
|
ut(this._injector, [
|
|
2665
2757
|
[T],
|
|
2758
|
+
[he],
|
|
2759
|
+
[W],
|
|
2760
|
+
[X],
|
|
2761
|
+
[ge],
|
|
2666
2762
|
[ce],
|
|
2667
|
-
[
|
|
2668
|
-
[z],
|
|
2669
|
-
[de],
|
|
2670
|
-
[le],
|
|
2671
|
-
[ue]
|
|
2763
|
+
[de]
|
|
2672
2764
|
]), Ie(this._injector, [
|
|
2673
|
-
[le],
|
|
2674
|
-
[ue],
|
|
2675
2765
|
[ce],
|
|
2676
|
-
[
|
|
2677
|
-
[
|
|
2678
|
-
[
|
|
2766
|
+
[de],
|
|
2767
|
+
[he],
|
|
2768
|
+
[W],
|
|
2769
|
+
[X],
|
|
2770
|
+
[ge]
|
|
2679
2771
|
]);
|
|
2680
2772
|
}
|
|
2681
2773
|
onReady() {
|
|
@@ -2686,57 +2778,57 @@ let $e = (oe = class extends it {
|
|
|
2686
2778
|
_initRegisterCommand() {
|
|
2687
2779
|
[
|
|
2688
2780
|
Dn,
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2781
|
+
J,
|
|
2782
|
+
xn,
|
|
2783
|
+
k,
|
|
2784
|
+
Ce,
|
|
2785
|
+
On,
|
|
2694
2786
|
Ln,
|
|
2695
|
-
|
|
2696
|
-
$n,
|
|
2697
|
-
An,
|
|
2698
|
-
Bn,
|
|
2787
|
+
S,
|
|
2699
2788
|
En,
|
|
2789
|
+
Bn,
|
|
2700
2790
|
Wn,
|
|
2701
|
-
Hn
|
|
2791
|
+
Hn,
|
|
2792
|
+
Vn,
|
|
2793
|
+
Pn
|
|
2702
2794
|
].forEach((t) => this._commandService.registerCommand(t));
|
|
2703
2795
|
}
|
|
2704
|
-
}, b(
|
|
2705
|
-
$e =
|
|
2796
|
+
}, b(le, "pluginName", Xe), b(le, "type", z.UNIVER_SHEET), le);
|
|
2797
|
+
$e = Xn([
|
|
2706
2798
|
Re(1, p(Ae)),
|
|
2707
|
-
Re(2,
|
|
2799
|
+
Re(2, Ee),
|
|
2708
2800
|
Re(3, p(x))
|
|
2709
2801
|
], $e);
|
|
2710
2802
|
export {
|
|
2711
2803
|
Dn as AddSheetTableCommand,
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2804
|
+
J as AddSheetTableMutation,
|
|
2805
|
+
En as AddTableThemeCommand,
|
|
2806
|
+
xn as DeleteSheetTableCommand,
|
|
2807
|
+
k as DeleteSheetTableMutation,
|
|
2808
|
+
Bn as RemoveTableThemeCommand,
|
|
2809
|
+
Un as SHEET_TABLE_CUSTOM_THEME_PREFIX,
|
|
2718
2810
|
Ln as SetSheetTableCommand,
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2811
|
+
On as SetSheetTableFilterCommand,
|
|
2812
|
+
Ce as SetSheetTableFilterMutation,
|
|
2813
|
+
S as SetSheetTableMutation,
|
|
2814
|
+
Hn as SheetTableInsertColCommand,
|
|
2815
|
+
Wn as SheetTableInsertRowCommand,
|
|
2816
|
+
Pn as SheetTableRemoveColCommand,
|
|
2817
|
+
Vn as SheetTableRemoveRowCommand,
|
|
2818
|
+
X as SheetTableService,
|
|
2819
|
+
P as SheetsTableButtonStateEnum,
|
|
2820
|
+
W as SheetsTableController,
|
|
2821
|
+
G as SheetsTableSortStateEnum,
|
|
2730
2822
|
Qe as TableColumnDataTypeEnum,
|
|
2731
|
-
|
|
2823
|
+
ne as TableColumnFilterTypeEnum,
|
|
2732
2824
|
O as TableConditionTypeEnum,
|
|
2733
|
-
|
|
2825
|
+
m as TableDateCompareTypeEnum,
|
|
2734
2826
|
T as TableManager,
|
|
2735
2827
|
F as TableNumberCompareTypeEnum,
|
|
2736
|
-
|
|
2828
|
+
V as TableStringCompareTypeEnum,
|
|
2737
2829
|
$e as UniverSheetsTablePlugin,
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2830
|
+
as as customEmptyThemeWithBorderStyle,
|
|
2831
|
+
Tt as isConditionFilter,
|
|
2832
|
+
rs as isManualFilter,
|
|
2833
|
+
os as processStyleWithBorderStyle
|
|
2742
2834
|
};
|