@univerjs/sheets-table 0.10.6 → 0.10.7-nightly.202509090319
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 +363 -364
- package/lib/index.js +363 -364
- package/lib/types/facade/f-workbook.d.ts +4 -4
- package/lib/types/facade/f-worksheet.d.ts +20 -7
- package/lib/types/types/type.d.ts +23 -0
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
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 Ce, INTERCEPTOR_POINT as Le, AddRangeThemeMutation as Ee, RemoveRangeThemeMutation as We, SheetRangeThemeModel as He, SheetsSelectionsService as ge, InsertRowMutation as Pe, RemoveRowMutation as Ve, getMoveRangeUndoRedoMutations as me, InsertColMutation as qe, RemoveColMutation as
|
|
6
|
-
import { Subject as
|
|
7
|
-
var I = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(I || {}), D = /* @__PURE__ */ ((t) => (t.Row = "row", t.Col = "column", t))(D || {}), 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 || {}), Z = /* @__PURE__ */ ((t) => (t.manual = "manual", t.condition = "condition", t))(Z || {}), U = /* @__PURE__ */ ((t) => (t.Date = "date", t.Number = "number", t.String = "string", t.Logic = "logic", t))(U || {}), 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 || {}),
|
|
4
|
+
import { CellValueType as V, BorderStyleTypes as tt, generateRandomId as q, IUniverInstanceService as E, Inject as C, LocaleService as de, Disposable as k, CommandType as y, IUndoRedoService as A, ICommandService as x, sequenceExecute as B, IResourceManagerService as nt, Rectangle as pe, RTree as rt, InterceptorEffectEnum as st, UniverInstanceType as he, customNameCharacterCheck as at, ILogService as ot, Injector as Ae, IConfigService as Be, Plugin as it, merge as lt, registerDependencies as ut, touchDependencies as Ie } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as $, SheetInterceptorService as Ce, INTERCEPTOR_POINT as Le, AddRangeThemeMutation as Ee, RemoveRangeThemeMutation as We, SheetRangeThemeModel as He, SheetsSelectionsService as ge, InsertRowMutation as Pe, RemoveRowMutation as Ve, getMoveRangeUndoRedoMutations as me, InsertColMutation as qe, RemoveColMutation as ke, IExclusiveRangeService as ct, RefRangeService as dt, RemoveColCommand as ht, RemoveRowCommand as gt, InsertColCommand as mt, InsertRowCommand as bt, SheetRangeThemeService as wt, RangeThemeStyle as Rt } from "@univerjs/sheets";
|
|
6
|
+
import { Subject as J, BehaviorSubject as Je, filter as be, switchMap as Me } from "rxjs";
|
|
7
|
+
var I = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(I || {}), D = /* @__PURE__ */ ((t) => (t.Row = "row", t.Col = "column", t))(D || {}), 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 || {}), Z = /* @__PURE__ */ ((t) => (t.manual = "manual", t.condition = "condition", t))(Z || {}), U = /* @__PURE__ */ ((t) => (t.Date = "date", t.Number = "number", t.String = "string", t.Logic = "logic", t))(U || {}), 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 || {}), H = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.Contains = "contains", t.NotContains = "notContains", t.StartsWith = "startsWith", t.EndsWith = "endsWith", t))(H || {}), g = /* @__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))(g || {}), 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 || {}), Q = /* @__PURE__ */ ((t) => (t.Asc = "asc", t.Desc = "desc", t.None = "none", t))(Q || {});
|
|
8
8
|
function X(t, e) {
|
|
9
9
|
return `${e} ${t}`;
|
|
10
10
|
}
|
|
11
|
-
const ve = "TRUE", Fe = "FALSE",
|
|
11
|
+
const ve = "TRUE", Fe = "FALSE", ft = (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
17
|
const { v: e, t: n, p: r } = t;
|
|
18
|
-
return r ?
|
|
18
|
+
return r ? ft(r) : (n === V.FORCE_STRING || n === V.STRING) && e !== void 0 && e !== null ? String(e) : n === V.BOOLEAN ? e ? ve : Fe : n === V.NUMBER ? String(e) : typeof e === "boolean" ? e ? ve : Fe : e == null ? "" : String(e);
|
|
19
19
|
}
|
|
20
20
|
return "";
|
|
21
21
|
}
|
|
22
22
|
function pt(t, e) {
|
|
23
23
|
if (t != null)
|
|
24
24
|
switch (e) {
|
|
25
|
-
case
|
|
26
|
-
return
|
|
27
|
-
case
|
|
28
|
-
return
|
|
25
|
+
case Q.Asc:
|
|
26
|
+
return P.FilteredSortAsc;
|
|
27
|
+
case Q.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 Q.Asc:
|
|
35
|
+
return P.FilterNoneSortAsc;
|
|
36
|
+
case Q.Desc:
|
|
37
|
+
return P.FilterNoneSortDesc;
|
|
38
38
|
default:
|
|
39
|
-
return
|
|
39
|
+
return P.FilterNoneSortNone;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
function St(t) {
|
|
@@ -45,30 +45,30 @@ function St(t) {
|
|
|
45
45
|
function tr(t) {
|
|
46
46
|
return t ? t.filterType === Z.manual : !1;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const N = {
|
|
49
49
|
s: tt.THIN,
|
|
50
50
|
cl: {
|
|
51
|
-
rgb: "rgb(95 101 116)"
|
|
51
|
+
rgb: "rgb(95, 101, 116)"
|
|
52
52
|
}
|
|
53
53
|
}, Ge = "sheets-table.config", De = {}, nr = {
|
|
54
54
|
headerRowStyle: {
|
|
55
55
|
bd: {
|
|
56
|
-
t:
|
|
56
|
+
t: N
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
headerColumnStyle: {
|
|
60
60
|
bd: {
|
|
61
|
-
l:
|
|
61
|
+
l: N
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
lastColumnStyle: {
|
|
65
65
|
bd: {
|
|
66
|
-
r:
|
|
66
|
+
r: N
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
lastRowStyle: {
|
|
70
70
|
bd: {
|
|
71
|
-
b:
|
|
71
|
+
b: N
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}, rr = (t, e) => {
|
|
@@ -77,7 +77,7 @@ const y = {
|
|
|
77
77
|
return {
|
|
78
78
|
...e,
|
|
79
79
|
bd: {
|
|
80
|
-
t:
|
|
80
|
+
t: N
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
} else if (t === "lastRowStyle") {
|
|
@@ -85,7 +85,7 @@ const y = {
|
|
|
85
85
|
return {
|
|
86
86
|
...e,
|
|
87
87
|
bd: {
|
|
88
|
-
b:
|
|
88
|
+
b: N
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
} else if (t === "lastColumnStyle") {
|
|
@@ -93,14 +93,14 @@ const y = {
|
|
|
93
93
|
return {
|
|
94
94
|
...e,
|
|
95
95
|
bd: {
|
|
96
|
-
r:
|
|
96
|
+
r: N
|
|
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: N
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
return e;
|
|
@@ -112,7 +112,7 @@ const y = {
|
|
|
112
112
|
[["#F17EBB", "#FFFFFF", "#FDF2F8", "#FCE8F3"], ["#fff"]],
|
|
113
113
|
[["#F98080", "#FFFFFF", "#FDF2F2", "#FDE8E8"], ["#fff"]]
|
|
114
114
|
], je = Ct.map((t, e) => {
|
|
115
|
-
const [n, r] = t, [s, a, o,
|
|
115
|
+
const [n, r] = t, [s, a, o, u] = n, [l] = r;
|
|
116
116
|
return {
|
|
117
117
|
name: `table-default-${e}`,
|
|
118
118
|
style: {
|
|
@@ -121,15 +121,15 @@ const y = {
|
|
|
121
121
|
rgb: s
|
|
122
122
|
},
|
|
123
123
|
cl: {
|
|
124
|
-
rgb:
|
|
124
|
+
rgb: l
|
|
125
125
|
},
|
|
126
126
|
bd: {
|
|
127
|
-
t:
|
|
127
|
+
t: N
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
headerColumnStyle: {
|
|
131
131
|
bd: {
|
|
132
|
-
l:
|
|
132
|
+
l: N
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
firstRowStyle: {
|
|
@@ -144,21 +144,21 @@ const y = {
|
|
|
144
144
|
},
|
|
145
145
|
lastRowStyle: {
|
|
146
146
|
bg: {
|
|
147
|
-
rgb:
|
|
147
|
+
rgb: u
|
|
148
148
|
},
|
|
149
149
|
bd: {
|
|
150
|
-
b:
|
|
150
|
+
b: N
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
lastColumnStyle: {
|
|
154
154
|
bd: {
|
|
155
|
-
r:
|
|
155
|
+
r: N
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
});
|
|
161
|
-
class
|
|
161
|
+
class Y {
|
|
162
162
|
constructor(e, n) {
|
|
163
163
|
b(this, "dataType");
|
|
164
164
|
b(this, "id");
|
|
@@ -200,7 +200,7 @@ const _t = (t) => t.getMonth() <= 2, Tt = (t) => {
|
|
|
200
200
|
}, Mt = (t) => {
|
|
201
201
|
const e = t.getMonth();
|
|
202
202
|
return e > 8 && e <= 11;
|
|
203
|
-
}, vt = (t) => t.getMonth() === 0, Ft = (t) => t.getMonth() === 1, Dt = (t) => t.getMonth() === 2,
|
|
203
|
+
}, vt = (t) => t.getMonth() === 0, Ft = (t) => t.getMonth() === 1, Dt = (t) => t.getMonth() === 2, yt = (t) => t.getMonth() === 3, Nt = (t) => t.getMonth() === 4, xt = (t) => t.getMonth() === 5, Ot = (t) => t.getMonth() === 6, Ut = (t) => t.getMonth() === 7, $t = (t) => t.getMonth() === 8, At = (t) => t.getMonth() === 9, Bt = (t) => t.getMonth() === 10, Lt = (t) => t.getMonth() === 11, Et = (t, e = /* @__PURE__ */ new Date()) => t.toDateString() === e.toDateString(), Wt = (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
|
}, Ht = (t, e = /* @__PURE__ */ new Date()) => {
|
|
@@ -218,7 +218,7 @@ const _t = (t) => t.getMonth() <= 2, Tt = (t) => {
|
|
|
218
218
|
}, qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
219
219
|
const n = G(t), r = new Date(G(e).getTime() - ze);
|
|
220
220
|
return n.toDateString() === r.toDateString();
|
|
221
|
-
},
|
|
221
|
+
}, kt = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth(), Jt = (t) => {
|
|
222
222
|
const e = new Date(t);
|
|
223
223
|
return e.setHours(0, 0, 0, 0), e.setDate(1), e;
|
|
224
224
|
}, Qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
@@ -229,7 +229,7 @@ const _t = (t) => t.getMonth() <= 2, Tt = (t) => {
|
|
|
229
229
|
const s = t.getTime();
|
|
230
230
|
return s >= n.getTime() && s < r.getTime();
|
|
231
231
|
}, Yt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
232
|
-
const n =
|
|
232
|
+
const n = Jt(e), r = new Date(n);
|
|
233
233
|
r.setMonth(r.getMonth() + 1, 0);
|
|
234
234
|
const s = t.getTime();
|
|
235
235
|
return s >= n.getTime() && s < r.getTime();
|
|
@@ -325,7 +325,7 @@ function tn(t) {
|
|
|
325
325
|
}
|
|
326
326
|
case g.ThisMonth: {
|
|
327
327
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
328
|
-
return (n) =>
|
|
328
|
+
return (n) => kt(n, e);
|
|
329
329
|
}
|
|
330
330
|
case g.LastMonth: {
|
|
331
331
|
const e = t.anchorTime ? new Date(t.anchorTime) : /* @__PURE__ */ new Date();
|
|
@@ -370,9 +370,9 @@ function tn(t) {
|
|
|
370
370
|
case g.M3:
|
|
371
371
|
return Dt;
|
|
372
372
|
case g.M4:
|
|
373
|
-
return Nt;
|
|
374
|
-
case g.M5:
|
|
375
373
|
return yt;
|
|
374
|
+
case g.M5:
|
|
375
|
+
return Nt;
|
|
376
376
|
case g.M6:
|
|
377
377
|
return xt;
|
|
378
378
|
case g.M7:
|
|
@@ -562,32 +562,32 @@ const z = (t) => {
|
|
|
562
562
|
}, cn = (t, e) => z(e).test(t), dn = (t, e) => !z(e).test(t), hn = (t, e) => z(`*${e}*`).test(t), gn = (t, e) => !z(`*${e}*`).test(t), mn = (t, e) => z(`${e}*`).test(t), bn = (t, e) => z(`*${e}`).test(t);
|
|
563
563
|
function wn(t) {
|
|
564
564
|
switch (t.compareType) {
|
|
565
|
-
case
|
|
565
|
+
case H.Equal:
|
|
566
566
|
return (e) => cn(e, t.expectedValue);
|
|
567
|
-
case
|
|
567
|
+
case H.NotEqual:
|
|
568
568
|
return (e) => dn(e, t.expectedValue);
|
|
569
|
-
case
|
|
569
|
+
case H.Contains:
|
|
570
570
|
return (e) => hn(e, t.expectedValue);
|
|
571
|
-
case
|
|
571
|
+
case H.NotContains:
|
|
572
572
|
return (e) => gn(e, t.expectedValue);
|
|
573
|
-
case
|
|
573
|
+
case H.StartsWith:
|
|
574
574
|
return (e) => mn(e, t.expectedValue);
|
|
575
|
-
case
|
|
575
|
+
case H.EndsWith:
|
|
576
576
|
return (e) => bn(e, t.expectedValue);
|
|
577
577
|
default:
|
|
578
578
|
return console.error(`Unknown filter operator: ${t.compareType}`), (e) => !0;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
const
|
|
581
|
+
const Rn = /* @__PURE__ */ new Set([
|
|
582
582
|
F.Above,
|
|
583
583
|
F.Below,
|
|
584
584
|
F.TopN
|
|
585
585
|
]);
|
|
586
586
|
g.Today, g.Yesterday, g.Tomorrow, g.ThisWeek, g.LastWeek, g.NextWeek, g.ThisMonth, g.LastMonth, g.NextMonth, g.ThisQuarter, g.LastQuarter, g.NextQuarter, g.NextYear, g.ThisYear, g.LastYear, g.YearToDate;
|
|
587
587
|
function Ke(t) {
|
|
588
|
-
return
|
|
588
|
+
return Rn.has(t);
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function fn(t, e) {
|
|
591
591
|
if (Ke(t.filterInfo.compareType))
|
|
592
592
|
return (n) => !0;
|
|
593
593
|
switch (t.filterInfo.conditionType) {
|
|
@@ -605,11 +605,11 @@ function Rn(t, e) {
|
|
|
605
605
|
function oe(t, e, n, r) {
|
|
606
606
|
switch (r) {
|
|
607
607
|
case U.Date: {
|
|
608
|
-
const s =
|
|
608
|
+
const s = ye(t, e, n);
|
|
609
609
|
return s ? Cn(s) : null;
|
|
610
610
|
}
|
|
611
611
|
case U.Number:
|
|
612
|
-
return
|
|
612
|
+
return ye(t, e, n);
|
|
613
613
|
case U.String:
|
|
614
614
|
default:
|
|
615
615
|
return Sn(t, e, n);
|
|
@@ -626,25 +626,25 @@ function Sn(t, e, n) {
|
|
|
626
626
|
if (o)
|
|
627
627
|
return pn(o);
|
|
628
628
|
if (typeof s == "string")
|
|
629
|
-
return a ===
|
|
629
|
+
return a === V.BOOLEAN ? s.toUpperCase() : s;
|
|
630
630
|
if (typeof s == "number")
|
|
631
|
-
return a ===
|
|
631
|
+
return a === V.BOOLEAN ? s ? "TRUE" : "FALSE" : s;
|
|
632
632
|
if (typeof s == "boolean") return s ? "TRUE" : "FALSE";
|
|
633
633
|
if (s !== void 0)
|
|
634
634
|
return String(s);
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function ye(t, e, n) {
|
|
637
637
|
const r = t.getCell(e, n);
|
|
638
638
|
if (!r) return null;
|
|
639
639
|
const { v: s, t: a, p: o } = r;
|
|
640
|
-
return o ? null : typeof s == "string" && a ===
|
|
640
|
+
return o ? null : typeof s == "string" && a === V.NUMBER ? Number(t.getCellRaw(e, n).v) : Number(s);
|
|
641
641
|
}
|
|
642
642
|
function Cn(t) {
|
|
643
643
|
const e = new Date(Date.UTC(1900, 0, 1, 0, 0, 0)), n = new Date(Date.UTC(1900, 1, 28, 0, 0, 0));
|
|
644
644
|
let r = t - 1;
|
|
645
645
|
return r > (n.getTime() - e.getTime()) / (1e3 * 3600 * 24) && (r -= 1), r < 0 && (r = t), new Date(e.getTime() + r * (1e3 * 3600 * 24));
|
|
646
646
|
}
|
|
647
|
-
class
|
|
647
|
+
class Ne {
|
|
648
648
|
constructor() {
|
|
649
649
|
b(this, "_tableColumnFilterList");
|
|
650
650
|
b(this, "_tableSortInfo");
|
|
@@ -662,7 +662,7 @@ class ye {
|
|
|
662
662
|
}
|
|
663
663
|
getFilterState(e) {
|
|
664
664
|
var r;
|
|
665
|
-
const n = ((r = this._tableSortInfo) == null ? void 0 : r.columnIndex) === e ? this._tableSortInfo.sortState :
|
|
665
|
+
const n = ((r = this._tableSortInfo) == null ? void 0 : r.columnIndex) === e ? this._tableSortInfo.sortState : Q.None;
|
|
666
666
|
return pt(this._tableColumnFilterList[e], n);
|
|
667
667
|
}
|
|
668
668
|
getSortState() {
|
|
@@ -687,22 +687,22 @@ class ye {
|
|
|
687
687
|
doColumnFilter(e, n, r, s) {
|
|
688
688
|
const a = this._tableColumnFilterList[r];
|
|
689
689
|
if (a && e) {
|
|
690
|
-
const { startRow: o, endRow:
|
|
691
|
-
for (let d = o; d <=
|
|
690
|
+
const { startRow: o, endRow: u, startColumn: l } = n, i = l + r, h = this.getExecuteFunc(e, n, r, a);
|
|
691
|
+
for (let d = o; d <= u; d++) {
|
|
692
692
|
const c = St(a) ? a.filterInfo.conditionType : U.String;
|
|
693
693
|
oe(e, d, i, c) === null ? s.add(d) : h(oe(e, d, i, c)) || s.add(d);
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
_getNumberCalculatedOptions(e, n, r) {
|
|
698
|
-
const { startRow: s, endRow: a, startColumn: o } = n,
|
|
698
|
+
const { startRow: s, endRow: a, startColumn: o } = n, u = o + r, l = [];
|
|
699
699
|
let i = 0, h = 0;
|
|
700
700
|
for (let d = s; d <= a; d++) {
|
|
701
|
-
const c = oe(e, d,
|
|
702
|
-
c !== null && (
|
|
701
|
+
const c = oe(e, d, u, U.Number);
|
|
702
|
+
c !== null && (l.push(c), i++, h += c);
|
|
703
703
|
}
|
|
704
704
|
return {
|
|
705
|
-
list:
|
|
705
|
+
list: l,
|
|
706
706
|
average: i > 0 ? h / i : 0
|
|
707
707
|
};
|
|
708
708
|
}
|
|
@@ -712,7 +712,7 @@ class ye {
|
|
|
712
712
|
return (o) => a.has(o);
|
|
713
713
|
} else if (s.filterType === Z.condition) {
|
|
714
714
|
const o = Ke(s.filterInfo.compareType) ? this._getNumberCalculatedOptions(e, n, r) : void 0;
|
|
715
|
-
return
|
|
715
|
+
return fn(s, o);
|
|
716
716
|
} else
|
|
717
717
|
return (a) => !0;
|
|
718
718
|
}
|
|
@@ -746,24 +746,21 @@ class xe {
|
|
|
746
746
|
b(this, "tableMeta");
|
|
747
747
|
b(this, "_tableFilters");
|
|
748
748
|
b(this, "_subUnitId");
|
|
749
|
-
this._id = e, this._range = r, this._name = n, this._tableFilters = new
|
|
749
|
+
this._id = e, this._range = r, this._name = n, this._tableFilters = new Ne(), this._init(s, a);
|
|
750
750
|
}
|
|
751
751
|
_init(e, n) {
|
|
752
|
-
var
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
const u = L(), i = new J(u, e[l - a]);
|
|
762
|
-
this._columns.set(u, i), this._columnOrder.push(u);
|
|
763
|
-
}
|
|
752
|
+
var o, u;
|
|
753
|
+
this._tableStyleId = n == null ? void 0 : n.tableStyleId, this._showHeader = (o = n == null ? void 0 : n.showHeader) != null ? o : !0, this._showFooter = !1;
|
|
754
|
+
const r = this.getRange(), s = r.startColumn, a = r.endColumn;
|
|
755
|
+
for (let l = s; l <= a; l++) {
|
|
756
|
+
const i = l - s;
|
|
757
|
+
let h, d;
|
|
758
|
+
(u = n.columns) != null && u[i] ? (h = n.columns[i].id, d = n.columns[i].displayName) : (h = q(), d = e[l - s]);
|
|
759
|
+
const c = new Y(h, d);
|
|
760
|
+
this._columns.set(h, c), this._columnOrder.push(h);
|
|
764
761
|
}
|
|
765
|
-
n.filters && n.filters.forEach((
|
|
766
|
-
|
|
762
|
+
n.filters && n.filters.forEach((i, h) => {
|
|
763
|
+
i && this._tableFilters.setColumnFilter(h, i);
|
|
767
764
|
});
|
|
768
765
|
}
|
|
769
766
|
setTableFilterColumn(e, n) {
|
|
@@ -776,17 +773,17 @@ class xe {
|
|
|
776
773
|
return this._tableFilters;
|
|
777
774
|
}
|
|
778
775
|
getTableFilterRange() {
|
|
779
|
-
const e = this.getRange(), n = this.isShowHeader(), r = this.isShowFooter(), { startRow: s, startColumn: a, endRow: o, endColumn:
|
|
776
|
+
const e = this.getRange(), n = this.isShowHeader(), r = this.isShowFooter(), { startRow: s, startColumn: a, endRow: o, endColumn: u } = e, l = n ? s + 1 : s, i = r ? o - 1 : o;
|
|
780
777
|
return {
|
|
781
|
-
startRow:
|
|
778
|
+
startRow: l,
|
|
782
779
|
startColumn: a,
|
|
783
780
|
endRow: i,
|
|
784
|
-
endColumn:
|
|
781
|
+
endColumn: u
|
|
785
782
|
};
|
|
786
783
|
}
|
|
787
784
|
setColumns(e) {
|
|
788
785
|
this._columns.clear(), this._columnOrder = [], e.forEach((n) => {
|
|
789
|
-
const r = new
|
|
786
|
+
const r = new Y(n.id, n.displayName);
|
|
790
787
|
r.fromJSON(n), this._columns.set(n.id, r), this._columnOrder.push(n.id);
|
|
791
788
|
});
|
|
792
789
|
}
|
|
@@ -908,10 +905,11 @@ class xe {
|
|
|
908
905
|
};
|
|
909
906
|
}
|
|
910
907
|
fromJSON(e) {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
908
|
+
var r, s;
|
|
909
|
+
this._id = e.id, this._name = e.name, this._range = e.range, this.tableMeta = e.meta, this._tableStyleId = e.options.tableStyleId || "", this._showHeader = (r = e.options.showHeader) != null ? r : !0, this._showFooter = (s = e.options.showFooter) != null ? s : !0, e.columns.forEach((a) => {
|
|
910
|
+
const o = new Y(a.id, a.displayName);
|
|
911
|
+
o.fromJSON(a), this._columns.set(a.id, o), this._columnOrder.push(a.id);
|
|
912
|
+
}), this._tableFilters = new Ne(), this._tableFilters.fromJSON(e.filters);
|
|
915
913
|
}
|
|
916
914
|
dispose() {
|
|
917
915
|
this._id = "", this._name = "", this._tableStyleId = "", this._showHeader = !0, this._showFooter = !0, delete this._range, this._columns.clear(), this._columnOrder = [];
|
|
@@ -926,19 +924,19 @@ let _ = class extends k {
|
|
|
926
924
|
constructor(e, n) {
|
|
927
925
|
super();
|
|
928
926
|
b(this, "_tableMap");
|
|
929
|
-
b(this, "_tableAdd$", new
|
|
927
|
+
b(this, "_tableAdd$", new J());
|
|
930
928
|
b(this, "tableAdd$", this._tableAdd$.asObservable());
|
|
931
|
-
b(this, "_tableDelete$", new
|
|
929
|
+
b(this, "_tableDelete$", new J());
|
|
932
930
|
b(this, "tableDelete$", this._tableDelete$.asObservable());
|
|
933
|
-
b(this, "_tableNameChanged$", new
|
|
931
|
+
b(this, "_tableNameChanged$", new J());
|
|
934
932
|
b(this, "tableNameChanged$", this._tableNameChanged$.asObservable());
|
|
935
|
-
b(this, "_tableRangeChanged$", new
|
|
933
|
+
b(this, "_tableRangeChanged$", new J());
|
|
936
934
|
b(this, "tableRangeChanged$", this._tableRangeChanged$.asObservable());
|
|
937
|
-
b(this, "_tableThemeChanged$", new
|
|
935
|
+
b(this, "_tableThemeChanged$", new J());
|
|
938
936
|
b(this, "tableThemeChanged$", this._tableThemeChanged$.asObservable());
|
|
939
|
-
b(this, "_tableFilterChanged$", new
|
|
937
|
+
b(this, "_tableFilterChanged$", new J());
|
|
940
938
|
b(this, "tableFilterChanged$", this._tableFilterChanged$.asObservable());
|
|
941
|
-
b(this, "_tableInitStatus", new
|
|
939
|
+
b(this, "_tableInitStatus", new Je(!1));
|
|
942
940
|
b(this, "tableInitStatus$", this._tableInitStatus.asObservable());
|
|
943
941
|
this._univerInstanceService = e, this._localeService = n, this._tableMap = /* @__PURE__ */ new Map();
|
|
944
942
|
}
|
|
@@ -947,9 +945,9 @@ let _ = class extends k {
|
|
|
947
945
|
}
|
|
948
946
|
getColumnHeader(e, n, r, s) {
|
|
949
947
|
var d;
|
|
950
|
-
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn:
|
|
951
|
-
for (let c =
|
|
952
|
-
i.push(Ye(a == null ? void 0 : a.getCell(o, c)) || X(c -
|
|
948
|
+
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn: u, endColumn: l } = r, i = [], h = s != null ? s : "Column";
|
|
949
|
+
for (let c = u; c <= l; c++)
|
|
950
|
+
i.push(Ye(a == null ? void 0 : a.getCell(o, c)) || X(c - u + 1, h));
|
|
953
951
|
return i;
|
|
954
952
|
}
|
|
955
953
|
/**
|
|
@@ -961,24 +959,25 @@ let _ = class extends k {
|
|
|
961
959
|
* @param {ITableOptions} [options] Other options of the table.
|
|
962
960
|
* @returns {string} The table id.
|
|
963
961
|
*/
|
|
964
|
-
addTable(e, n, r, s, a, o,
|
|
965
|
-
const
|
|
966
|
-
return h.setSubunitId(n), this._ensureUnit(e).set(
|
|
962
|
+
addTable(e, n, r, s, a, o, u) {
|
|
963
|
+
const l = o != null ? o : q(), i = a || this.getColumnHeader(e, n, s), h = new xe(l, r, s, i, u);
|
|
964
|
+
return h.setSubunitId(n), this._ensureUnit(e).set(l, h), this._tableAdd$.next({
|
|
967
965
|
unitId: e,
|
|
968
966
|
subUnitId: n,
|
|
969
967
|
range: s,
|
|
970
968
|
tableName: r,
|
|
971
|
-
tableId:
|
|
972
|
-
|
|
969
|
+
tableId: l,
|
|
970
|
+
tableStyleId: u == null ? void 0 : u.tableStyleId
|
|
971
|
+
}), l;
|
|
973
972
|
}
|
|
974
973
|
addFilter(e, n, r, s) {
|
|
975
974
|
const a = this.getTable(e, n);
|
|
976
975
|
if (a) {
|
|
977
976
|
a.getTableFilters().setColumnFilter(r, s);
|
|
978
|
-
const
|
|
977
|
+
const u = a.getSubunitId();
|
|
979
978
|
this._tableFilterChanged$.next({
|
|
980
979
|
unitId: e,
|
|
981
|
-
subUnitId:
|
|
980
|
+
subUnitId: u,
|
|
982
981
|
tableId: n
|
|
983
982
|
});
|
|
984
983
|
}
|
|
@@ -1020,7 +1019,7 @@ let _ = class extends k {
|
|
|
1020
1019
|
const r = this._tableMap.get(e);
|
|
1021
1020
|
if (!r)
|
|
1022
1021
|
return n;
|
|
1023
|
-
const s = new Set(Array.from(r.values()).map((
|
|
1022
|
+
const s = new Set(Array.from(r.values()).map((u) => u.getDisplayName()));
|
|
1024
1023
|
let a = n, o = 1;
|
|
1025
1024
|
for (; s.has(a); )
|
|
1026
1025
|
a = `${n}-${o}`, o++;
|
|
@@ -1061,12 +1060,12 @@ let _ = class extends k {
|
|
|
1061
1060
|
if (s) {
|
|
1062
1061
|
const a = s.getTableInfo(), o = s.getTableStyleId();
|
|
1063
1062
|
r == null || r.delete(n);
|
|
1064
|
-
const { subUnitId:
|
|
1063
|
+
const { subUnitId: u, range: l, name: i } = a;
|
|
1065
1064
|
this._tableDelete$.next({
|
|
1066
1065
|
unitId: e,
|
|
1067
|
-
subUnitId:
|
|
1066
|
+
subUnitId: u,
|
|
1068
1067
|
tableId: n,
|
|
1069
|
-
range:
|
|
1068
|
+
range: l,
|
|
1070
1069
|
tableName: i,
|
|
1071
1070
|
tableStyleId: o
|
|
1072
1071
|
});
|
|
@@ -1075,25 +1074,25 @@ let _ = class extends k {
|
|
|
1075
1074
|
operationTableRowCol(e, n, r) {
|
|
1076
1075
|
const s = this.getTableById(e, n);
|
|
1077
1076
|
if (!s) return;
|
|
1078
|
-
const { operationType: a, rowColType: o, index:
|
|
1077
|
+
const { operationType: a, rowColType: o, index: u, count: l, columnsJson: i } = r, h = s.getRange(), d = { ...h };
|
|
1079
1078
|
if (a === I.Insert) {
|
|
1080
1079
|
if (o === "row")
|
|
1081
|
-
d.endRow +=
|
|
1080
|
+
d.endRow += l;
|
|
1082
1081
|
else if (o === "column") {
|
|
1083
|
-
d.endColumn +=
|
|
1084
|
-
for (let c = 0; c <
|
|
1085
|
-
const m = this._localeService.t("sheets-table.columnPrefix"), S = new
|
|
1082
|
+
d.endColumn += l;
|
|
1083
|
+
for (let c = 0; c < l; c++) {
|
|
1084
|
+
const m = this._localeService.t("sheets-table.columnPrefix"), S = new Y(q(), X(s.getColumnsCount() + 1 + c, m));
|
|
1086
1085
|
i != null && i[c] && S.fromJSON(i[c]);
|
|
1087
|
-
const w =
|
|
1086
|
+
const w = u + c - h.startColumn;
|
|
1088
1087
|
s.insertColumn(w, S);
|
|
1089
1088
|
}
|
|
1090
1089
|
}
|
|
1091
1090
|
} else if (o === "row")
|
|
1092
|
-
d.endRow -=
|
|
1091
|
+
d.endRow -= l;
|
|
1093
1092
|
else if (o === "column") {
|
|
1094
|
-
d.endColumn -=
|
|
1095
|
-
for (let c =
|
|
1096
|
-
const m =
|
|
1093
|
+
d.endColumn -= l;
|
|
1094
|
+
for (let c = l - 1; c >= 0; c--) {
|
|
1095
|
+
const m = u + c - h.startColumn;
|
|
1097
1096
|
s.removeColumn(m);
|
|
1098
1097
|
}
|
|
1099
1098
|
}
|
|
@@ -1110,26 +1109,26 @@ let _ = class extends k {
|
|
|
1110
1109
|
if (!s) return;
|
|
1111
1110
|
const a = s.getRange(), o = r.newRange;
|
|
1112
1111
|
if (o.startColumn < a.startColumn) {
|
|
1113
|
-
const
|
|
1114
|
-
for (let i = 0; i <
|
|
1115
|
-
s.insertColumn(a.startColumn, new
|
|
1112
|
+
const u = a.startColumn - o.startColumn, l = this._localeService.t("sheets-table.columnPrefix");
|
|
1113
|
+
for (let i = 0; i < u; i++)
|
|
1114
|
+
s.insertColumn(a.startColumn, new Y(q(), X(s.getColumnsCount() + 1, l)));
|
|
1116
1115
|
} else if (o.startColumn > a.startColumn) {
|
|
1117
|
-
const
|
|
1118
|
-
for (let
|
|
1119
|
-
const i = o.startColumn +
|
|
1116
|
+
const u = o.startColumn - a.startColumn;
|
|
1117
|
+
for (let l = u - 1; l >= 0; l--) {
|
|
1118
|
+
const i = o.startColumn + l - a.startColumn;
|
|
1120
1119
|
s.removeColumn(i);
|
|
1121
1120
|
}
|
|
1122
1121
|
}
|
|
1123
1122
|
if (o.endColumn < a.endColumn) {
|
|
1124
|
-
const
|
|
1125
|
-
for (let
|
|
1126
|
-
const i = o.endColumn +
|
|
1123
|
+
const u = a.endColumn - o.endColumn;
|
|
1124
|
+
for (let l = u - 1; l >= 0; l--) {
|
|
1125
|
+
const i = o.endColumn + l - a.startColumn;
|
|
1127
1126
|
s.removeColumn(i);
|
|
1128
1127
|
}
|
|
1129
1128
|
} else if (o.endColumn > a.endColumn) {
|
|
1130
|
-
const
|
|
1131
|
-
for (let
|
|
1132
|
-
s.insertColumn(a.endColumn, new
|
|
1129
|
+
const u = o.endColumn - a.endColumn;
|
|
1130
|
+
for (let l = 0; l < u; l++)
|
|
1131
|
+
s.insertColumn(a.endColumn, new Y(q(), X(s.getColumnsCount() + 1, "Column")));
|
|
1133
1132
|
}
|
|
1134
1133
|
s.setRange(o), this._tableRangeChanged$.next({
|
|
1135
1134
|
unitId: e,
|
|
@@ -1143,18 +1142,18 @@ let _ = class extends k {
|
|
|
1143
1142
|
var c;
|
|
1144
1143
|
const s = this._tableMap.get(e), a = s == null ? void 0 : s.get(n);
|
|
1145
1144
|
if (!a) return;
|
|
1146
|
-
const o = a.getSubunitId(), { name:
|
|
1147
|
-
if (
|
|
1145
|
+
const o = a.getSubunitId(), { name: u, updateRange: l, rowColOperation: i, theme: h, options: d } = r;
|
|
1146
|
+
if (u) {
|
|
1148
1147
|
const m = a.getDisplayName();
|
|
1149
|
-
a.setDisplayName(
|
|
1148
|
+
a.setDisplayName(u), this._tableNameChanged$.next({
|
|
1150
1149
|
unitId: e,
|
|
1151
1150
|
subUnitId: o,
|
|
1152
1151
|
tableId: n,
|
|
1153
|
-
tableName:
|
|
1152
|
+
tableName: u,
|
|
1154
1153
|
oldTableName: m
|
|
1155
1154
|
});
|
|
1156
1155
|
}
|
|
1157
|
-
if (i && this.operationTableRowCol(e, n, i),
|
|
1156
|
+
if (i && this.operationTableRowCol(e, n, i), l && this.updateTableRange(e, n, l), h) {
|
|
1158
1157
|
const m = (c = a.getTableStyleId()) != null ? c : "default";
|
|
1159
1158
|
a.setTableStyleId(h), this._tableThemeChanged$.next({
|
|
1160
1159
|
unitId: e,
|
|
@@ -1172,8 +1171,8 @@ let _ = class extends k {
|
|
|
1172
1171
|
const a = s.getSubunitId();
|
|
1173
1172
|
if (!n[a]) {
|
|
1174
1173
|
const o = /* @__PURE__ */ new Set();
|
|
1175
|
-
this.getTablesBySubunitId(e, a).forEach((
|
|
1176
|
-
const i =
|
|
1174
|
+
this.getTablesBySubunitId(e, a).forEach((l) => {
|
|
1175
|
+
const i = l.getTableFilters().getFilterOutRows();
|
|
1177
1176
|
if (i)
|
|
1178
1177
|
for (const h of i)
|
|
1179
1178
|
o.add(h);
|
|
@@ -1191,13 +1190,13 @@ let _ = class extends k {
|
|
|
1191
1190
|
const o = $(this._univerInstanceService, { unitId: e, subUnitId: a });
|
|
1192
1191
|
if (!o)
|
|
1193
1192
|
return;
|
|
1194
|
-
const
|
|
1195
|
-
let
|
|
1196
|
-
n[a].tables ?
|
|
1193
|
+
const u = o.worksheet;
|
|
1194
|
+
let l;
|
|
1195
|
+
n[a].tables ? l = n[a].tables : Array.isArray(n[a]) && (l = n[a]), l && l.forEach((i) => {
|
|
1197
1196
|
const h = this.getColumnHeader(e, a, i.range), d = new xe(i.id, i.name, i.range, h, i.options);
|
|
1198
1197
|
if (d.setTableMeta(i.meta), i.columns.length && d.setColumns(i.columns), i.filters) {
|
|
1199
1198
|
const c = d.getTableFilters();
|
|
1200
|
-
c.fromJSON(i.filters), c.doFilter(
|
|
1199
|
+
c.fromJSON(i.filters), c.doFilter(u, d.getTableFilterRange());
|
|
1201
1200
|
}
|
|
1202
1201
|
d.setSubunitId(a), r.set(i.id, d), this._tableAdd$.next({
|
|
1203
1202
|
unitId: e,
|
|
@@ -1219,7 +1218,7 @@ let _ = class extends k {
|
|
|
1219
1218
|
}
|
|
1220
1219
|
};
|
|
1221
1220
|
_ = Tn([
|
|
1222
|
-
Oe(0,
|
|
1221
|
+
Oe(0, E),
|
|
1223
1222
|
Oe(1, C(de))
|
|
1224
1223
|
], _);
|
|
1225
1224
|
var In = Object.getOwnPropertyDescriptor, Mn = (t, e, n, r) => {
|
|
@@ -1276,46 +1275,46 @@ j = Mn([
|
|
|
1276
1275
|
], j);
|
|
1277
1276
|
const ee = {
|
|
1278
1277
|
id: "sheet.mutation.add-table",
|
|
1279
|
-
type:
|
|
1278
|
+
type: y.MUTATION,
|
|
1280
1279
|
handler: (t, e) => {
|
|
1281
|
-
const { tableId: n, unitId: r, subUnitId: s, name: a, range: o, header:
|
|
1282
|
-
return t.get(j).addTable(r, s, a, o,
|
|
1280
|
+
const { tableId: n, unitId: r, subUnitId: s, name: a, range: o, header: u, options: l } = e;
|
|
1281
|
+
return t.get(j).addTable(r, s, a, o, u, n, l), !0;
|
|
1283
1282
|
}
|
|
1284
1283
|
}, te = {
|
|
1285
1284
|
id: "sheet.mutation.delete-table",
|
|
1286
|
-
type:
|
|
1285
|
+
type: y.MUTATION,
|
|
1287
1286
|
handler: (t, e) => {
|
|
1288
1287
|
const { unitId: n, subUnitId: r, tableId: s } = e;
|
|
1289
1288
|
return t.get(j).deleteTable(n, r, s), !0;
|
|
1290
1289
|
}
|
|
1291
1290
|
}, Fn = {
|
|
1292
1291
|
id: "sheet.command.add-table",
|
|
1293
|
-
type:
|
|
1292
|
+
type: y.COMMAND,
|
|
1294
1293
|
handler: (t, e) => {
|
|
1295
1294
|
var w;
|
|
1296
1295
|
if (!e)
|
|
1297
1296
|
return !1;
|
|
1298
|
-
const n = t.get(A), r = t.get(x), s = t.get(de), a = (w = e.id) != null ? w :
|
|
1297
|
+
const n = t.get(A), r = t.get(x), s = t.get(de), a = (w = e.id) != null ? w : q();
|
|
1299
1298
|
let o = e.name;
|
|
1300
1299
|
if (!o) {
|
|
1301
|
-
const
|
|
1302
|
-
o = `${s.t("sheets-table.tablePrefix")}${
|
|
1300
|
+
const R = t.get(_).getTableList(e.unitId).length;
|
|
1301
|
+
o = `${s.t("sheets-table.tablePrefix")}${R + 1}`;
|
|
1303
1302
|
}
|
|
1304
|
-
const
|
|
1305
|
-
return
|
|
1303
|
+
const u = [], l = [], i = t.get(_), { unitId: h, subUnitId: d, range: c } = e, m = i.getColumnHeader(h, d, c, s.t("sheets-table.columnPrefix"));
|
|
1304
|
+
return u.push({ id: ee.id, params: { ...e, tableId: a, name: o, header: m } }), l.push({ id: te.id, params: { tableId: a, unitId: e.unitId } }), B(u, r) && n.pushUndoRedo({
|
|
1306
1305
|
unitID: e.unitId,
|
|
1307
|
-
undoMutations:
|
|
1308
|
-
redoMutations:
|
|
1306
|
+
undoMutations: l,
|
|
1307
|
+
redoMutations: u
|
|
1309
1308
|
}), !0;
|
|
1310
1309
|
}
|
|
1311
1310
|
}, Dn = {
|
|
1312
1311
|
id: "sheet.command.delete-table",
|
|
1313
|
-
type:
|
|
1312
|
+
type: y.COMMAND,
|
|
1314
1313
|
handler: (t, e) => {
|
|
1315
1314
|
if (!e)
|
|
1316
1315
|
return !1;
|
|
1317
|
-
const n = t.get(A), r = t.get(x), s = t.get(_), a = [], o = [],
|
|
1318
|
-
if (!
|
|
1316
|
+
const n = t.get(A), r = t.get(x), s = t.get(_), a = [], o = [], u = s.getTable(e.unitId, e.tableId), l = u == null ? void 0 : u.toJSON();
|
|
1317
|
+
if (!l)
|
|
1319
1318
|
throw new Error("[TableManager]: Table not found");
|
|
1320
1319
|
return a.push({ id: te.id, params: { ...e } }), o.push({
|
|
1321
1320
|
id: ee.id,
|
|
@@ -1323,9 +1322,9 @@ const ee = {
|
|
|
1323
1322
|
unitId: e.unitId,
|
|
1324
1323
|
subUnitId: e.subUnitId,
|
|
1325
1324
|
tableId: e.tableId,
|
|
1326
|
-
name:
|
|
1327
|
-
range:
|
|
1328
|
-
options:
|
|
1325
|
+
name: l.name,
|
|
1326
|
+
range: l.range,
|
|
1327
|
+
options: l.options
|
|
1329
1328
|
}
|
|
1330
1329
|
}), B(a, r) && n.pushUndoRedo({
|
|
1331
1330
|
unitID: e.unitId,
|
|
@@ -1335,40 +1334,40 @@ const ee = {
|
|
|
1335
1334
|
}
|
|
1336
1335
|
}, Se = {
|
|
1337
1336
|
id: "sheet.mutation.set-table-filter",
|
|
1338
|
-
type:
|
|
1337
|
+
type: y.MUTATION,
|
|
1339
1338
|
handler: (t, e) => {
|
|
1340
1339
|
const { tableId: n, unitId: r, column: s, tableFilter: a } = e;
|
|
1341
1340
|
return t.get(_).addFilter(r, n, s, a), !0;
|
|
1342
1341
|
}
|
|
1343
|
-
},
|
|
1342
|
+
}, yn = {
|
|
1344
1343
|
id: "sheet.command.set-table-filter",
|
|
1345
|
-
type:
|
|
1344
|
+
type: y.COMMAND,
|
|
1346
1345
|
handler: (t, e) => {
|
|
1347
1346
|
if (!e)
|
|
1348
1347
|
return !1;
|
|
1349
|
-
const n = t.get(A), r = t.get(x), s = e.tableId ||
|
|
1348
|
+
const n = t.get(A), r = t.get(x), s = e.tableId || q(), a = [], o = [];
|
|
1350
1349
|
return a.push({ id: Se.id, params: { ...e, tableId: s } }), o.push({ id: Se.id, params: { ...e, tableId: s, tableFilter: void 0 } }), B(a, r) && n.pushUndoRedo({
|
|
1351
1350
|
unitID: e.unitId,
|
|
1352
1351
|
undoMutations: o,
|
|
1353
1352
|
redoMutations: a
|
|
1354
1353
|
}), !0;
|
|
1355
1354
|
}
|
|
1356
|
-
}, Xe = "SHEET_TABLE_PLUGIN", re = "SHEET_TABLE",
|
|
1355
|
+
}, Xe = "SHEET_TABLE_PLUGIN", re = "SHEET_TABLE", Nn = "table-custom";
|
|
1357
1356
|
var xn = Object.getOwnPropertyDescriptor, On = (t, e, n, r) => {
|
|
1358
1357
|
for (var s = r > 1 ? void 0 : r ? xn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
1359
1358
|
(o = t[a]) && (s = o(s) || s);
|
|
1360
1359
|
return s;
|
|
1361
1360
|
}, we = (t, e) => (n, r) => e(n, r, t);
|
|
1362
|
-
let
|
|
1361
|
+
let L = class extends k {
|
|
1363
1362
|
constructor(e, n, r) {
|
|
1364
1363
|
super();
|
|
1365
1364
|
b(this, "_tableRangeRTree", /* @__PURE__ */ new Map());
|
|
1366
1365
|
this._sheetInterceptorService = e, this._tableManager = n, this._resourceManagerService = r, this._initSnapshot(), this.registerTableChangeEvent(), this.registerTableHeaderInterceptor();
|
|
1367
1366
|
}
|
|
1368
1367
|
getContainerTableWithRange(e, n, r) {
|
|
1369
|
-
const s = this._ensureTableRangeRTree(e), o = Array.from(s.bulkSearch([{ unitId: e, sheetId: n, range: r }])).find((
|
|
1370
|
-
const
|
|
1371
|
-
return
|
|
1368
|
+
const s = this._ensureTableRangeRTree(e), o = Array.from(s.bulkSearch([{ unitId: e, sheetId: n, range: r }])).find((u) => {
|
|
1369
|
+
const l = this._tableManager.getTable(e, String(u));
|
|
1370
|
+
return l ? pe.contains(l.getRange(), r) : !1;
|
|
1372
1371
|
});
|
|
1373
1372
|
if (o)
|
|
1374
1373
|
return this._tableManager.getTable(e, String(o));
|
|
@@ -1389,13 +1388,13 @@ let E = class extends k {
|
|
|
1389
1388
|
})
|
|
1390
1389
|
), this.disposeWithMe(
|
|
1391
1390
|
this._tableManager.tableRangeChanged$.subscribe((e) => {
|
|
1392
|
-
const { range: n, tableId: r, unitId: s, subUnitId: a, oldRange: o } = e,
|
|
1393
|
-
|
|
1391
|
+
const { range: n, tableId: r, unitId: s, subUnitId: a, oldRange: o } = e, u = this._ensureTableRangeRTree(s);
|
|
1392
|
+
u.remove({
|
|
1394
1393
|
unitId: s,
|
|
1395
1394
|
sheetId: a,
|
|
1396
1395
|
id: r,
|
|
1397
1396
|
range: { ...o }
|
|
1398
|
-
}),
|
|
1397
|
+
}), u.insert({
|
|
1399
1398
|
unitId: s,
|
|
1400
1399
|
sheetId: a,
|
|
1401
1400
|
id: r,
|
|
@@ -1419,9 +1418,9 @@ let E = class extends k {
|
|
|
1419
1418
|
this._sheetInterceptorService.intercept(Le.CELL_CONTENT, {
|
|
1420
1419
|
effect: st.Value,
|
|
1421
1420
|
handler: (e, n, r) => {
|
|
1422
|
-
const { row: s, col: a, unitId: o, subUnitId:
|
|
1423
|
-
if ((e == null ? void 0 : e.v) === void 0 &&
|
|
1424
|
-
const h = Array.from(
|
|
1421
|
+
const { row: s, col: a, unitId: o, subUnitId: u } = n, l = this._ensureTableRangeRTree(o);
|
|
1422
|
+
if ((e == null ? void 0 : e.v) === void 0 && l) {
|
|
1423
|
+
const h = Array.from(l.bulkSearch([{ unitId: o, sheetId: u, range: { startColumn: a, endColumn: a, startRow: s, endRow: s } }]));
|
|
1425
1424
|
if (h.length > 0) {
|
|
1426
1425
|
const d = this._tableManager.getTable(o, h[0]);
|
|
1427
1426
|
if (d) {
|
|
@@ -1473,14 +1472,14 @@ let E = class extends k {
|
|
|
1473
1472
|
super.dispose(), this._tableRangeRTree.clear();
|
|
1474
1473
|
}
|
|
1475
1474
|
};
|
|
1476
|
-
|
|
1475
|
+
L = On([
|
|
1477
1476
|
we(0, C(Ce)),
|
|
1478
1477
|
we(1, C(_)),
|
|
1479
1478
|
we(2, C(nt))
|
|
1480
|
-
],
|
|
1479
|
+
], L);
|
|
1481
1480
|
const p = {
|
|
1482
1481
|
id: "sheet.mutation.set-sheet-table",
|
|
1483
|
-
type:
|
|
1482
|
+
type: y.MUTATION,
|
|
1484
1483
|
handler: (t, e) => {
|
|
1485
1484
|
if (!e)
|
|
1486
1485
|
return !1;
|
|
@@ -1489,13 +1488,13 @@ const p = {
|
|
|
1489
1488
|
}
|
|
1490
1489
|
}, Un = {
|
|
1491
1490
|
id: "sheet.command.add-table-theme",
|
|
1492
|
-
type:
|
|
1491
|
+
type: y.COMMAND,
|
|
1493
1492
|
handler: (t, e) => {
|
|
1494
1493
|
if (!e)
|
|
1495
1494
|
return !1;
|
|
1496
|
-
const n = t.get(_), { unitId: r, tableId: s, themeStyle: a } = e, o = [],
|
|
1497
|
-
if (!
|
|
1498
|
-
const i =
|
|
1495
|
+
const n = t.get(_), { unitId: r, tableId: s, themeStyle: a } = e, o = [], u = [], l = n.getTableById(r, s);
|
|
1496
|
+
if (!l) return !1;
|
|
1497
|
+
const i = l.getSubunitId();
|
|
1499
1498
|
o.push({
|
|
1500
1499
|
id: Ee.id,
|
|
1501
1500
|
params: {
|
|
@@ -1513,17 +1512,17 @@ const p = {
|
|
|
1513
1512
|
theme: a.getName()
|
|
1514
1513
|
}
|
|
1515
1514
|
}
|
|
1516
|
-
}),
|
|
1515
|
+
}), u.push({
|
|
1517
1516
|
id: p.id,
|
|
1518
1517
|
params: {
|
|
1519
1518
|
unitId: r,
|
|
1520
1519
|
subUnitId: i,
|
|
1521
1520
|
tableId: s,
|
|
1522
1521
|
config: {
|
|
1523
|
-
themeStyle:
|
|
1522
|
+
themeStyle: l.getTableStyleId()
|
|
1524
1523
|
}
|
|
1525
1524
|
}
|
|
1526
|
-
}),
|
|
1525
|
+
}), u.push({
|
|
1527
1526
|
id: We.id,
|
|
1528
1527
|
params: {
|
|
1529
1528
|
unitId: r,
|
|
@@ -1534,23 +1533,23 @@ const p = {
|
|
|
1534
1533
|
const h = t.get(x);
|
|
1535
1534
|
return B(o, h) && t.get(A).pushUndoRedo({
|
|
1536
1535
|
unitID: r,
|
|
1537
|
-
undoMutations:
|
|
1536
|
+
undoMutations: u,
|
|
1538
1537
|
redoMutations: o
|
|
1539
1538
|
}), !0;
|
|
1540
1539
|
}
|
|
1541
1540
|
}, $n = {
|
|
1542
1541
|
id: "sheet.command.remove-table-theme",
|
|
1543
|
-
type:
|
|
1542
|
+
type: y.COMMAND,
|
|
1544
1543
|
handler: (t, e) => {
|
|
1545
1544
|
if (!e)
|
|
1546
1545
|
return !1;
|
|
1547
|
-
const { unitId: n, tableId: r, themeName: s } = e, a = t.get(_), o = t.get(He),
|
|
1548
|
-
if (!
|
|
1549
|
-
const
|
|
1550
|
-
let m = o.getRegisteredRangeThemes().filter((
|
|
1551
|
-
m || (m = d[0]), i.push({ id: p.id, params: { unitId: n, subUnitId:
|
|
1546
|
+
const { unitId: n, tableId: r, themeName: s } = e, a = t.get(_), o = t.get(He), u = a.getTableById(n, r);
|
|
1547
|
+
if (!u) return !1;
|
|
1548
|
+
const l = u.getSubunitId(), i = [], h = [], d = o.getRegisteredRangeThemes().filter((R) => R == null ? void 0 : R.startsWith("table-default"));
|
|
1549
|
+
let m = o.getRegisteredRangeThemes().filter((R) => R == null ? void 0 : R.startsWith(Nn)).find((R) => R !== s);
|
|
1550
|
+
m || (m = d[0]), i.push({ id: p.id, params: { unitId: n, subUnitId: l, tableId: r, config: { theme: m } } }), i.push({ id: We.id, params: { unitId: n, subUnitId: l, styleName: s } });
|
|
1552
1551
|
const S = o.getDefaultRangeThemeStyle(s);
|
|
1553
|
-
S && (h.push({ id: Ee.id, params: { unitId: n, subUnitId:
|
|
1552
|
+
S && (h.push({ id: Ee.id, params: { unitId: n, subUnitId: l, styleJSON: S.toJson() } }), h.push({ id: p.id, params: { unitId: n, subUnitId: l, tableId: r, config: { theme: s } } }));
|
|
1554
1553
|
const w = t.get(x);
|
|
1555
1554
|
return B(i, w) && t.get(A).pushUndoRedo({
|
|
1556
1555
|
unitID: n,
|
|
@@ -1560,14 +1559,14 @@ const p = {
|
|
|
1560
1559
|
}
|
|
1561
1560
|
}, An = {
|
|
1562
1561
|
id: "sheet.command.set-table-config",
|
|
1563
|
-
type:
|
|
1562
|
+
type: y.COMMAND,
|
|
1564
1563
|
// eslint-disable-next-line max-lines-per-function
|
|
1565
1564
|
handler: (t, e) => {
|
|
1566
1565
|
if (!e)
|
|
1567
1566
|
return !1;
|
|
1568
|
-
const { unitId: n, tableId: r, name: s, updateRange: a, rowColOperation: o, theme:
|
|
1567
|
+
const { unitId: n, tableId: r, name: s, updateRange: a, rowColOperation: o, theme: u } = e, i = t.get(_).getTableById(n, r);
|
|
1569
1568
|
if (!i) return !1;
|
|
1570
|
-
const h = {}, d = {}, c = t.get(de), S = t.get(
|
|
1569
|
+
const h = {}, d = {}, c = t.get(de), S = t.get(E).getCurrentUnitOfType(he.UNIVER_SHEET), w = /* @__PURE__ */ new Set();
|
|
1571
1570
|
if (S && S.getSheets().forEach((O) => {
|
|
1572
1571
|
w.add(O.getName());
|
|
1573
1572
|
}), s) {
|
|
@@ -1582,14 +1581,14 @@ const p = {
|
|
|
1582
1581
|
count: o.count
|
|
1583
1582
|
}, d.rowColOperation = o), a && (h.updateRange = {
|
|
1584
1583
|
newRange: i.getRange()
|
|
1585
|
-
}, d.updateRange = a),
|
|
1586
|
-
const
|
|
1584
|
+
}, d.updateRange = a), u && (h.theme = i.getTableStyleId(), d.theme = u);
|
|
1585
|
+
const f = {
|
|
1587
1586
|
unitId: n,
|
|
1588
1587
|
subUnitId: i.getSubunitId(),
|
|
1589
1588
|
tableId: r,
|
|
1590
1589
|
config: d
|
|
1591
1590
|
};
|
|
1592
|
-
return t.get(x).executeCommand(p.id,
|
|
1591
|
+
return t.get(x).executeCommand(p.id, f), t.get(A).pushUndoRedo({
|
|
1593
1592
|
unitID: n,
|
|
1594
1593
|
undoMutations: [
|
|
1595
1594
|
{
|
|
@@ -1605,34 +1604,34 @@ const p = {
|
|
|
1605
1604
|
redoMutations: [
|
|
1606
1605
|
{
|
|
1607
1606
|
id: p.id,
|
|
1608
|
-
params:
|
|
1607
|
+
params: f
|
|
1609
1608
|
}
|
|
1610
1609
|
]
|
|
1611
1610
|
}), !0;
|
|
1612
1611
|
}
|
|
1613
1612
|
}, Bn = {
|
|
1614
1613
|
id: "sheet.command.table-insert-row",
|
|
1615
|
-
type:
|
|
1614
|
+
type: y.COMMAND,
|
|
1616
1615
|
handler: (t) => {
|
|
1617
|
-
const e = t.get(
|
|
1616
|
+
const e = t.get(E), n = $(e);
|
|
1618
1617
|
if (!n)
|
|
1619
1618
|
return !1;
|
|
1620
|
-
const { workbook: r, worksheet: s, unitId: a, subUnitId: o } = n,
|
|
1621
|
-
if (!
|
|
1619
|
+
const { workbook: r, worksheet: s, unitId: a, subUnitId: o } = n, l = t.get(ge).getCurrentSelections();
|
|
1620
|
+
if (!l.length || l.length > 1)
|
|
1622
1621
|
return !1;
|
|
1623
1622
|
t.get(_);
|
|
1624
|
-
const h =
|
|
1623
|
+
const h = l[0].range, c = t.get(L).getContainerTableWithRange(a, o, h);
|
|
1625
1624
|
if (!c) return !1;
|
|
1626
|
-
const m = h.endRow - h.startRow + 1, w = s.getRowCount() - 1,
|
|
1627
|
-
if (w -
|
|
1628
|
-
|
|
1625
|
+
const m = h.endRow - h.startRow + 1, w = s.getRowCount() - 1, f = s.getCellMatrix().getDataRange().endRow, R = [], T = [];
|
|
1626
|
+
if (w - f < m)
|
|
1627
|
+
R.push({
|
|
1629
1628
|
id: Pe.id,
|
|
1630
1629
|
params: {
|
|
1631
1630
|
unitId: a,
|
|
1632
1631
|
subUnitId: o,
|
|
1633
1632
|
range: { ...h }
|
|
1634
1633
|
}
|
|
1635
|
-
}),
|
|
1634
|
+
}), R.push({
|
|
1636
1635
|
id: p.id,
|
|
1637
1636
|
params: {
|
|
1638
1637
|
unitId: a,
|
|
@@ -1669,7 +1668,7 @@ const p = {
|
|
|
1669
1668
|
});
|
|
1670
1669
|
else {
|
|
1671
1670
|
const M = { ...c.getRange() };
|
|
1672
|
-
|
|
1671
|
+
R.push({
|
|
1673
1672
|
id: p.id,
|
|
1674
1673
|
params: {
|
|
1675
1674
|
unitId: a,
|
|
@@ -1704,7 +1703,7 @@ const p = {
|
|
|
1704
1703
|
subUnitId: o,
|
|
1705
1704
|
range: {
|
|
1706
1705
|
startRow: h.startRow,
|
|
1707
|
-
endRow:
|
|
1706
|
+
endRow: f,
|
|
1708
1707
|
startColumn: M.startColumn,
|
|
1709
1708
|
endColumn: M.endColumn
|
|
1710
1709
|
}
|
|
@@ -1714,43 +1713,43 @@ const p = {
|
|
|
1714
1713
|
subUnitId: o,
|
|
1715
1714
|
range: {
|
|
1716
1715
|
startRow: h.startRow + m,
|
|
1717
|
-
endRow:
|
|
1716
|
+
endRow: f + m,
|
|
1718
1717
|
startColumn: M.startColumn,
|
|
1719
1718
|
endColumn: M.endColumn
|
|
1720
1719
|
}
|
|
1721
1720
|
}
|
|
1722
1721
|
);
|
|
1723
|
-
K && (
|
|
1722
|
+
K && (R.push(...K.redos), T.push(...K.undos));
|
|
1724
1723
|
}
|
|
1725
1724
|
const O = t.get(x);
|
|
1726
|
-
return B(
|
|
1725
|
+
return B(R, O) && t.get(A).pushUndoRedo({
|
|
1727
1726
|
unitID: a,
|
|
1728
1727
|
undoMutations: T,
|
|
1729
|
-
redoMutations:
|
|
1728
|
+
redoMutations: R
|
|
1730
1729
|
}), !0;
|
|
1731
1730
|
}
|
|
1732
1731
|
}, Ln = {
|
|
1733
1732
|
id: "sheet.command.table-insert-col",
|
|
1734
|
-
type:
|
|
1733
|
+
type: y.COMMAND,
|
|
1735
1734
|
handler: (t) => {
|
|
1736
|
-
const e = t.get(
|
|
1735
|
+
const e = t.get(E), n = $(e);
|
|
1737
1736
|
if (!n)
|
|
1738
1737
|
return !1;
|
|
1739
|
-
const { worksheet: r, unitId: s, subUnitId: a } = n,
|
|
1740
|
-
if (!
|
|
1738
|
+
const { worksheet: r, unitId: s, subUnitId: a } = n, u = t.get(ge).getCurrentSelections();
|
|
1739
|
+
if (!u.length || u.length > 1)
|
|
1741
1740
|
return !1;
|
|
1742
|
-
const i =
|
|
1741
|
+
const i = u[0].range, d = t.get(L).getContainerTableWithRange(s, a, i);
|
|
1743
1742
|
if (!d) return !1;
|
|
1744
|
-
const c = i.endColumn - i.startColumn + 1, S = r.getColumnCount() - 1, w = r.getCellMatrix().getDataRange().endColumn,
|
|
1743
|
+
const c = i.endColumn - i.startColumn + 1, S = r.getColumnCount() - 1, w = r.getCellMatrix().getDataRange().endColumn, f = [], R = [];
|
|
1745
1744
|
if (S - w < c)
|
|
1746
|
-
|
|
1745
|
+
f.push({
|
|
1747
1746
|
id: qe.id,
|
|
1748
1747
|
params: {
|
|
1749
1748
|
unitId: s,
|
|
1750
1749
|
subUnitId: a,
|
|
1751
1750
|
range: { ...i }
|
|
1752
1751
|
}
|
|
1753
|
-
}),
|
|
1752
|
+
}), f.push({
|
|
1754
1753
|
id: p.id,
|
|
1755
1754
|
params: {
|
|
1756
1755
|
unitId: s,
|
|
@@ -1765,7 +1764,7 @@ const p = {
|
|
|
1765
1764
|
}
|
|
1766
1765
|
}
|
|
1767
1766
|
}
|
|
1768
|
-
}),
|
|
1767
|
+
}), R.push({
|
|
1769
1768
|
id: p.id,
|
|
1770
1769
|
params: {
|
|
1771
1770
|
unitId: s,
|
|
@@ -1780,8 +1779,8 @@ const p = {
|
|
|
1780
1779
|
}
|
|
1781
1780
|
}
|
|
1782
1781
|
}
|
|
1783
|
-
}),
|
|
1784
|
-
id:
|
|
1782
|
+
}), R.push({
|
|
1783
|
+
id: ke.id,
|
|
1785
1784
|
params: {
|
|
1786
1785
|
unitId: s,
|
|
1787
1786
|
subUnitId: a,
|
|
@@ -1790,7 +1789,7 @@ const p = {
|
|
|
1790
1789
|
});
|
|
1791
1790
|
else {
|
|
1792
1791
|
const v = d.getRange();
|
|
1793
|
-
|
|
1792
|
+
f.push({
|
|
1794
1793
|
id: p.id,
|
|
1795
1794
|
params: {
|
|
1796
1795
|
unitId: s,
|
|
@@ -1805,7 +1804,7 @@ const p = {
|
|
|
1805
1804
|
}
|
|
1806
1805
|
}
|
|
1807
1806
|
}
|
|
1808
|
-
}),
|
|
1807
|
+
}), R.push({
|
|
1809
1808
|
id: p.id,
|
|
1810
1809
|
params: {
|
|
1811
1810
|
unitId: s,
|
|
@@ -1844,28 +1843,28 @@ const p = {
|
|
|
1844
1843
|
}
|
|
1845
1844
|
}
|
|
1846
1845
|
);
|
|
1847
|
-
M && (
|
|
1846
|
+
M && (f.push(...M.redos), R.push(...M.undos));
|
|
1848
1847
|
}
|
|
1849
1848
|
const T = t.get(x);
|
|
1850
|
-
return B(
|
|
1849
|
+
return B(f, T) && t.get(A).pushUndoRedo({
|
|
1851
1850
|
unitID: s,
|
|
1852
|
-
undoMutations:
|
|
1853
|
-
redoMutations:
|
|
1851
|
+
undoMutations: R,
|
|
1852
|
+
redoMutations: f
|
|
1854
1853
|
}), !0;
|
|
1855
1854
|
}
|
|
1856
1855
|
}, En = {
|
|
1857
1856
|
id: "sheet.command.table-remove-row",
|
|
1858
|
-
type:
|
|
1857
|
+
type: y.COMMAND,
|
|
1859
1858
|
handler: (t, e) => {
|
|
1860
1859
|
if (!e)
|
|
1861
1860
|
return !1;
|
|
1862
|
-
const n = t.get(
|
|
1861
|
+
const n = t.get(E), r = $(n);
|
|
1863
1862
|
if (!r)
|
|
1864
1863
|
return !1;
|
|
1865
|
-
const { unitId: s, subUnitId: a } = r,
|
|
1866
|
-
if (!
|
|
1864
|
+
const { unitId: s, subUnitId: a } = r, u = t.get(ge).getCurrentSelections();
|
|
1865
|
+
if (!u.length || u.length > 1)
|
|
1867
1866
|
return !1;
|
|
1868
|
-
const i =
|
|
1867
|
+
const i = u[0].range, d = t.get(L).getContainerTableWithRange(s, a, i);
|
|
1869
1868
|
if (!d) return !1;
|
|
1870
1869
|
const c = i.endRow - i.startRow + 1, m = [], S = [], w = d.getRange();
|
|
1871
1870
|
m.push({
|
|
@@ -1896,14 +1895,14 @@ const p = {
|
|
|
1896
1895
|
}
|
|
1897
1896
|
}
|
|
1898
1897
|
});
|
|
1899
|
-
const
|
|
1898
|
+
const R = r.worksheet.getCellMatrix().getDataRange().endRow, T = me(
|
|
1900
1899
|
t,
|
|
1901
1900
|
{
|
|
1902
1901
|
unitId: s,
|
|
1903
1902
|
subUnitId: a,
|
|
1904
1903
|
range: {
|
|
1905
1904
|
startRow: i.endRow + 1,
|
|
1906
|
-
endRow:
|
|
1905
|
+
endRow: R,
|
|
1907
1906
|
startColumn: w.startColumn,
|
|
1908
1907
|
endColumn: w.endColumn
|
|
1909
1908
|
}
|
|
@@ -1913,7 +1912,7 @@ const p = {
|
|
|
1913
1912
|
subUnitId: a,
|
|
1914
1913
|
range: {
|
|
1915
1914
|
startRow: i.startRow,
|
|
1916
|
-
endRow:
|
|
1915
|
+
endRow: R - c,
|
|
1917
1916
|
startColumn: w.startColumn,
|
|
1918
1917
|
endColumn: w.endColumn
|
|
1919
1918
|
}
|
|
@@ -1929,21 +1928,21 @@ const p = {
|
|
|
1929
1928
|
}
|
|
1930
1929
|
}, Wn = {
|
|
1931
1930
|
id: "sheet.command.table-remove-col",
|
|
1932
|
-
type:
|
|
1931
|
+
type: y.COMMAND,
|
|
1933
1932
|
handler: (t, e) => {
|
|
1934
1933
|
if (!e)
|
|
1935
1934
|
return !1;
|
|
1936
|
-
const n = t.get(
|
|
1935
|
+
const n = t.get(E), r = $(n);
|
|
1937
1936
|
if (!r)
|
|
1938
1937
|
return !1;
|
|
1939
1938
|
const { workbook: s, unitId: a, subUnitId: o } = r;
|
|
1940
1939
|
t.get(_);
|
|
1941
|
-
const
|
|
1942
|
-
if (!
|
|
1940
|
+
const l = t.get(ge).getCurrentSelections();
|
|
1941
|
+
if (!l.length || l.length > 1)
|
|
1943
1942
|
return !1;
|
|
1944
|
-
const h =
|
|
1943
|
+
const h = l[0].range, c = t.get(L).getContainerTableWithRange(a, o, h);
|
|
1945
1944
|
if (!c) return !1;
|
|
1946
|
-
const m = h.endColumn - h.startColumn + 1, S = [], w = [],
|
|
1945
|
+
const m = h.endColumn - h.startColumn + 1, S = [], w = [], f = c.getRange();
|
|
1947
1946
|
S.push({
|
|
1948
1947
|
id: p.id,
|
|
1949
1948
|
params: {
|
|
@@ -1960,10 +1959,10 @@ const p = {
|
|
|
1960
1959
|
}
|
|
1961
1960
|
}
|
|
1962
1961
|
});
|
|
1963
|
-
const
|
|
1962
|
+
const R = [], T = h.startColumn - f.startColumn;
|
|
1964
1963
|
for (let ne = 0; ne < m; ne++) {
|
|
1965
1964
|
const Te = c.getTableInfo().columns[T + ne];
|
|
1966
|
-
Te &&
|
|
1965
|
+
Te && R.push(Te);
|
|
1967
1966
|
}
|
|
1968
1967
|
w.push({
|
|
1969
1968
|
id: p.id,
|
|
@@ -1977,7 +1976,7 @@ const p = {
|
|
|
1977
1976
|
rowColType: D.Col,
|
|
1978
1977
|
index: h.startColumn,
|
|
1979
1978
|
count: m,
|
|
1980
|
-
columnsJson:
|
|
1979
|
+
columnsJson: R
|
|
1981
1980
|
}
|
|
1982
1981
|
}
|
|
1983
1982
|
}
|
|
@@ -1988,8 +1987,8 @@ const p = {
|
|
|
1988
1987
|
unitId: a,
|
|
1989
1988
|
subUnitId: o,
|
|
1990
1989
|
range: {
|
|
1991
|
-
startRow:
|
|
1992
|
-
endRow:
|
|
1990
|
+
startRow: f.startRow,
|
|
1991
|
+
endRow: f.endRow,
|
|
1993
1992
|
startColumn: h.endColumn + 1,
|
|
1994
1993
|
endColumn: v
|
|
1995
1994
|
}
|
|
@@ -1998,8 +1997,8 @@ const p = {
|
|
|
1998
1997
|
unitId: a,
|
|
1999
1998
|
subUnitId: o,
|
|
2000
1999
|
range: {
|
|
2001
|
-
startRow:
|
|
2002
|
-
endRow:
|
|
2000
|
+
startRow: f.startRow,
|
|
2001
|
+
endRow: f.endRow,
|
|
2003
2002
|
startColumn: h.startColumn,
|
|
2004
2003
|
endColumn: v - m
|
|
2005
2004
|
}
|
|
@@ -2056,7 +2055,7 @@ var Vn = Object.getOwnPropertyDescriptor, qn = (t, e, n, r) => {
|
|
|
2056
2055
|
for (var s = r > 1 ? void 0 : r ? Vn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2057
2056
|
(o = t[a]) && (s = o(s) || s);
|
|
2058
2057
|
return s;
|
|
2059
|
-
},
|
|
2058
|
+
}, W = (t, e) => (n, r) => e(n, r, t);
|
|
2060
2059
|
let le = class extends k {
|
|
2061
2060
|
constructor(t, e, n, r, s, a, o) {
|
|
2062
2061
|
super(), this._commandService = t, this._refRangeService = e, this._univerInstanceService = n, this._injector = r, this._sheetInterceptorService = s, this._tableManager = a, this._localeService = o, this._initCommandInterceptor(), this._initCommandListener();
|
|
@@ -2087,17 +2086,17 @@ let le = class extends k {
|
|
|
2087
2086
|
const { unitId: s, subUnitId: a } = r, o = this._tableManager.getTablesBySubunitId(s, a);
|
|
2088
2087
|
if (!o.length)
|
|
2089
2088
|
return { undos: e, redos: n };
|
|
2090
|
-
const { range:
|
|
2091
|
-
return o.forEach((
|
|
2092
|
-
const i =
|
|
2093
|
-
if (
|
|
2094
|
-
const h =
|
|
2089
|
+
const { range: u } = t;
|
|
2090
|
+
return o.forEach((l) => {
|
|
2091
|
+
const i = l.getRange();
|
|
2092
|
+
if (u.startRow > i.startRow && u.startRow <= i.endRow) {
|
|
2093
|
+
const h = u.endRow - u.startRow + 1;
|
|
2095
2094
|
n.push({
|
|
2096
2095
|
id: p.id,
|
|
2097
2096
|
params: {
|
|
2098
2097
|
unitId: s,
|
|
2099
2098
|
subUnitId: a,
|
|
2100
|
-
tableId:
|
|
2099
|
+
tableId: l.getId(),
|
|
2101
2100
|
config: {
|
|
2102
2101
|
updateRange: {
|
|
2103
2102
|
newRange: {
|
|
@@ -2112,7 +2111,7 @@ let le = class extends k {
|
|
|
2112
2111
|
params: {
|
|
2113
2112
|
unitId: s,
|
|
2114
2113
|
subUnitId: a,
|
|
2115
|
-
tableId:
|
|
2114
|
+
tableId: l.getId(),
|
|
2116
2115
|
config: {
|
|
2117
2116
|
updateRange: {
|
|
2118
2117
|
newRange: {
|
|
@@ -2132,22 +2131,22 @@ let le = class extends k {
|
|
|
2132
2131
|
const { unitId: s, subUnitId: a } = r, o = this._tableManager.getTablesBySubunitId(s, a);
|
|
2133
2132
|
if (!o.length)
|
|
2134
2133
|
return { undos: e, redos: n };
|
|
2135
|
-
const { range:
|
|
2136
|
-
return o.forEach((
|
|
2137
|
-
const i =
|
|
2138
|
-
if (
|
|
2139
|
-
const h =
|
|
2134
|
+
const { range: u } = t;
|
|
2135
|
+
return o.forEach((l) => {
|
|
2136
|
+
const i = l.getRange();
|
|
2137
|
+
if (u.startColumn > i.startColumn && u.startColumn <= i.endColumn) {
|
|
2138
|
+
const h = u.endColumn - u.startColumn + 1;
|
|
2140
2139
|
n.push({
|
|
2141
2140
|
id: p.id,
|
|
2142
2141
|
params: {
|
|
2143
2142
|
unitId: s,
|
|
2144
2143
|
subUnitId: a,
|
|
2145
|
-
tableId:
|
|
2144
|
+
tableId: l.getId(),
|
|
2146
2145
|
config: {
|
|
2147
2146
|
rowColOperation: {
|
|
2148
2147
|
operationType: I.Insert,
|
|
2149
2148
|
rowColType: D.Col,
|
|
2150
|
-
index:
|
|
2149
|
+
index: u.startColumn,
|
|
2151
2150
|
count: h
|
|
2152
2151
|
}
|
|
2153
2152
|
}
|
|
@@ -2157,12 +2156,12 @@ let le = class extends k {
|
|
|
2157
2156
|
params: {
|
|
2158
2157
|
unitId: s,
|
|
2159
2158
|
subUnitId: a,
|
|
2160
|
-
tableId:
|
|
2159
|
+
tableId: l.getId(),
|
|
2161
2160
|
config: {
|
|
2162
2161
|
rowColOperation: {
|
|
2163
2162
|
operationType: I.Delete,
|
|
2164
2163
|
rowColType: D.Col,
|
|
2165
|
-
index:
|
|
2164
|
+
index: u.startColumn,
|
|
2166
2165
|
count: h
|
|
2167
2166
|
}
|
|
2168
2167
|
}
|
|
@@ -2175,11 +2174,11 @@ let le = class extends k {
|
|
|
2175
2174
|
const e = [], n = [], r = [], s = [], a = $(this._univerInstanceService);
|
|
2176
2175
|
if (!a)
|
|
2177
2176
|
return { undos: e, redos: n, preRedos: r, preUndos: s };
|
|
2178
|
-
const { unitId: o, subUnitId:
|
|
2179
|
-
if (!
|
|
2177
|
+
const { unitId: o, subUnitId: u } = a, l = this._tableManager.getTablesBySubunitId(o, u);
|
|
2178
|
+
if (!l.length)
|
|
2180
2179
|
return { undos: e, redos: n, preRedos: r, preUndos: s };
|
|
2181
2180
|
const { range: i } = t, h = i.endRow - i.startRow + 1;
|
|
2182
|
-
return
|
|
2181
|
+
return l.forEach((d) => {
|
|
2183
2182
|
const c = d.getRange();
|
|
2184
2183
|
if (pe.intersects(c, i))
|
|
2185
2184
|
if (i.startRow <= c.startRow && i.endRow >= c.startRow) {
|
|
@@ -2187,7 +2186,7 @@ let le = class extends k {
|
|
|
2187
2186
|
id: te.id,
|
|
2188
2187
|
params: {
|
|
2189
2188
|
unitId: o,
|
|
2190
|
-
subUnitId:
|
|
2189
|
+
subUnitId: u,
|
|
2191
2190
|
tableId: d.getId()
|
|
2192
2191
|
}
|
|
2193
2192
|
});
|
|
@@ -2196,7 +2195,7 @@ let le = class extends k {
|
|
|
2196
2195
|
id: ee.id,
|
|
2197
2196
|
params: {
|
|
2198
2197
|
unitId: o,
|
|
2199
|
-
subUnitId:
|
|
2198
|
+
subUnitId: u,
|
|
2200
2199
|
tableId: m.id,
|
|
2201
2200
|
name: m.name,
|
|
2202
2201
|
range: m.range,
|
|
@@ -2207,7 +2206,7 @@ let le = class extends k {
|
|
|
2207
2206
|
id: p.id,
|
|
2208
2207
|
params: {
|
|
2209
2208
|
unitId: o,
|
|
2210
|
-
subUnitId:
|
|
2209
|
+
subUnitId: u,
|
|
2211
2210
|
tableId: d.getId(),
|
|
2212
2211
|
config: {
|
|
2213
2212
|
updateRange: {
|
|
@@ -2222,7 +2221,7 @@ let le = class extends k {
|
|
|
2222
2221
|
id: p.id,
|
|
2223
2222
|
params: {
|
|
2224
2223
|
unitId: o,
|
|
2225
|
-
subUnitId:
|
|
2224
|
+
subUnitId: u,
|
|
2226
2225
|
tableId: d.getId(),
|
|
2227
2226
|
config: {
|
|
2228
2227
|
updateRange: {
|
|
@@ -2236,7 +2235,7 @@ let le = class extends k {
|
|
|
2236
2235
|
id: p.id,
|
|
2237
2236
|
params: {
|
|
2238
2237
|
unitId: o,
|
|
2239
|
-
subUnitId:
|
|
2238
|
+
subUnitId: u,
|
|
2240
2239
|
tableId: d.getId(),
|
|
2241
2240
|
config: {
|
|
2242
2241
|
updateRange: {
|
|
@@ -2251,7 +2250,7 @@ let le = class extends k {
|
|
|
2251
2250
|
id: p.id,
|
|
2252
2251
|
params: {
|
|
2253
2252
|
unitId: o,
|
|
2254
|
-
subUnitId:
|
|
2253
|
+
subUnitId: u,
|
|
2255
2254
|
tableId: d.getId(),
|
|
2256
2255
|
config: {
|
|
2257
2256
|
updateRange: {
|
|
@@ -2268,11 +2267,11 @@ let le = class extends k {
|
|
|
2268
2267
|
const e = [], n = [], r = [], s = [], a = $(this._univerInstanceService);
|
|
2269
2268
|
if (!a)
|
|
2270
2269
|
return { undos: e, redos: n, preRedos: r, preUndos: s };
|
|
2271
|
-
const { unitId: o, subUnitId:
|
|
2272
|
-
if (!
|
|
2270
|
+
const { unitId: o, subUnitId: u } = a, l = this._tableManager.getTablesBySubunitId(o, u);
|
|
2271
|
+
if (!l.length)
|
|
2273
2272
|
return { undos: e, redos: n, preRedos: r, preUndos: s };
|
|
2274
2273
|
const { range: i } = t, h = i.endColumn - i.startColumn + 1;
|
|
2275
|
-
return
|
|
2274
|
+
return l.forEach((d) => {
|
|
2276
2275
|
const c = d.getRange();
|
|
2277
2276
|
if (pe.intersects(c, i)) {
|
|
2278
2277
|
if (i.startColumn <= c.startColumn && i.endColumn >= c.endColumn) {
|
|
@@ -2280,21 +2279,21 @@ let le = class extends k {
|
|
|
2280
2279
|
id: te.id,
|
|
2281
2280
|
params: {
|
|
2282
2281
|
unitId: o,
|
|
2283
|
-
subUnitId:
|
|
2282
|
+
subUnitId: u,
|
|
2284
2283
|
tableId: d.getId()
|
|
2285
2284
|
}
|
|
2286
2285
|
});
|
|
2287
|
-
const m = d.toJSON(), { startRow: S, startColumn: w, endColumn:
|
|
2286
|
+
const m = d.toJSON(), { startRow: S, startColumn: w, endColumn: f } = m.range, R = this._univerInstanceService.getUnit(o), T = R == null ? void 0 : R.getSheetBySheetId(u);
|
|
2288
2287
|
if (!T)
|
|
2289
2288
|
return { undos: e, redos: n, preRedos: r, preUndos: s };
|
|
2290
2289
|
const O = [];
|
|
2291
|
-
for (let v = w; v <=
|
|
2290
|
+
for (let v = w; v <= f; v++)
|
|
2292
2291
|
O.push(Ye(T == null ? void 0 : T.getCell(S, v)) || X(v - w + 1, this._localeService.t("sheets-table.columnPrefix")));
|
|
2293
2292
|
e.push({
|
|
2294
2293
|
id: ee.id,
|
|
2295
2294
|
params: {
|
|
2296
2295
|
unitId: o,
|
|
2297
|
-
subUnitId:
|
|
2296
|
+
subUnitId: u,
|
|
2298
2297
|
tableId: m.id,
|
|
2299
2298
|
name: m.name,
|
|
2300
2299
|
header: O,
|
|
@@ -2308,7 +2307,7 @@ let le = class extends k {
|
|
|
2308
2307
|
id: p.id,
|
|
2309
2308
|
params: {
|
|
2310
2309
|
unitId: o,
|
|
2311
|
-
subUnitId:
|
|
2310
|
+
subUnitId: u,
|
|
2312
2311
|
tableId: d.getId(),
|
|
2313
2312
|
config: {
|
|
2314
2313
|
rowColOperation: {
|
|
@@ -2322,14 +2321,14 @@ let le = class extends k {
|
|
|
2322
2321
|
});
|
|
2323
2322
|
const S = [];
|
|
2324
2323
|
for (let w = 0; w < m; w++) {
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2324
|
+
const f = d.getTableColumnByIndex(w);
|
|
2325
|
+
f && S.push(f.toJSON());
|
|
2327
2326
|
}
|
|
2328
2327
|
e.push({
|
|
2329
2328
|
id: p.id,
|
|
2330
2329
|
params: {
|
|
2331
2330
|
unitId: o,
|
|
2332
|
-
subUnitId:
|
|
2331
|
+
subUnitId: u,
|
|
2333
2332
|
tableId: d.getId(),
|
|
2334
2333
|
config: {
|
|
2335
2334
|
rowColOperation: {
|
|
@@ -2348,7 +2347,7 @@ let le = class extends k {
|
|
|
2348
2347
|
id: p.id,
|
|
2349
2348
|
params: {
|
|
2350
2349
|
unitId: o,
|
|
2351
|
-
subUnitId:
|
|
2350
|
+
subUnitId: u,
|
|
2352
2351
|
tableId: d.getId(),
|
|
2353
2352
|
config: {
|
|
2354
2353
|
rowColOperation: {
|
|
@@ -2361,15 +2360,15 @@ let le = class extends k {
|
|
|
2361
2360
|
}
|
|
2362
2361
|
});
|
|
2363
2362
|
const S = [], w = i.startColumn - c.startColumn;
|
|
2364
|
-
for (let
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2363
|
+
for (let f = 0; f < m; f++) {
|
|
2364
|
+
const R = d.getTableColumnByIndex(f + w);
|
|
2365
|
+
R && S.push(R.toJSON());
|
|
2367
2366
|
}
|
|
2368
2367
|
e.push({
|
|
2369
2368
|
id: p.id,
|
|
2370
2369
|
params: {
|
|
2371
2370
|
unitId: o,
|
|
2372
|
-
subUnitId:
|
|
2371
|
+
subUnitId: u,
|
|
2373
2372
|
tableId: d.getId(),
|
|
2374
2373
|
config: {
|
|
2375
2374
|
rowColOperation: {
|
|
@@ -2387,7 +2386,7 @@ let le = class extends k {
|
|
|
2387
2386
|
id: p.id,
|
|
2388
2387
|
params: {
|
|
2389
2388
|
unitId: o,
|
|
2390
|
-
subUnitId:
|
|
2389
|
+
subUnitId: u,
|
|
2391
2390
|
tableId: d.getId(),
|
|
2392
2391
|
config: {
|
|
2393
2392
|
rowColOperation: {
|
|
@@ -2401,14 +2400,14 @@ let le = class extends k {
|
|
|
2401
2400
|
});
|
|
2402
2401
|
const m = [], S = i.startColumn - c.startColumn;
|
|
2403
2402
|
for (let w = 0; w < h; w++) {
|
|
2404
|
-
const
|
|
2405
|
-
|
|
2403
|
+
const f = d.getTableColumnByIndex(w + S);
|
|
2404
|
+
f && m.push(f.toJSON());
|
|
2406
2405
|
}
|
|
2407
2406
|
e.push({
|
|
2408
2407
|
id: p.id,
|
|
2409
2408
|
params: {
|
|
2410
2409
|
unitId: o,
|
|
2411
|
-
subUnitId:
|
|
2410
|
+
subUnitId: u,
|
|
2412
2411
|
tableId: d.getId(),
|
|
2413
2412
|
config: {
|
|
2414
2413
|
rowColOperation: {
|
|
@@ -2429,49 +2428,49 @@ let le = class extends k {
|
|
|
2429
2428
|
this._commandService.onCommandExecuted((t) => {
|
|
2430
2429
|
if (t.id === Pe.id) {
|
|
2431
2430
|
const e = t.params, { unitId: n, subUnitId: r, range: s } = e, a = s.endRow - s.startRow + 1;
|
|
2432
|
-
this._tableManager.getTablesBySubunitId(n, r).forEach((
|
|
2433
|
-
const
|
|
2434
|
-
s.startRow <=
|
|
2431
|
+
this._tableManager.getTablesBySubunitId(n, r).forEach((u) => {
|
|
2432
|
+
const l = u.getRange();
|
|
2433
|
+
s.startRow <= l.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2435
2434
|
newRange: {
|
|
2436
|
-
...
|
|
2437
|
-
startRow:
|
|
2438
|
-
endRow:
|
|
2435
|
+
...l,
|
|
2436
|
+
startRow: l.startRow + a,
|
|
2437
|
+
endRow: l.endRow + a
|
|
2439
2438
|
}
|
|
2440
2439
|
});
|
|
2441
2440
|
});
|
|
2442
2441
|
} else if (t.id === qe.id) {
|
|
2443
2442
|
const e = t.params, { unitId: n, subUnitId: r, range: s } = e, a = s.endColumn - s.startColumn + 1;
|
|
2444
|
-
this._tableManager.getTablesBySubunitId(n, r).forEach((
|
|
2445
|
-
const
|
|
2446
|
-
s.startColumn <=
|
|
2443
|
+
this._tableManager.getTablesBySubunitId(n, r).forEach((u) => {
|
|
2444
|
+
const l = u.getRange();
|
|
2445
|
+
s.startColumn <= l.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2447
2446
|
newRange: {
|
|
2448
|
-
...
|
|
2449
|
-
startColumn:
|
|
2450
|
-
endColumn:
|
|
2447
|
+
...l,
|
|
2448
|
+
startColumn: l.startColumn + a,
|
|
2449
|
+
endColumn: l.endColumn + a
|
|
2451
2450
|
}
|
|
2452
2451
|
});
|
|
2453
2452
|
});
|
|
2454
2453
|
} else if (t.id === Ve.id) {
|
|
2455
2454
|
const e = t.params, { unitId: n, subUnitId: r, range: s } = e, a = s.endRow - s.startRow + 1;
|
|
2456
|
-
this._tableManager.getTablesBySubunitId(n, r).forEach((
|
|
2457
|
-
const
|
|
2458
|
-
s.startRow <
|
|
2455
|
+
this._tableManager.getTablesBySubunitId(n, r).forEach((u) => {
|
|
2456
|
+
const l = u.getRange();
|
|
2457
|
+
s.startRow < l.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2459
2458
|
newRange: {
|
|
2460
|
-
...
|
|
2461
|
-
startRow:
|
|
2462
|
-
endRow:
|
|
2459
|
+
...l,
|
|
2460
|
+
startRow: l.startRow - a,
|
|
2461
|
+
endRow: l.endRow - a
|
|
2463
2462
|
}
|
|
2464
2463
|
});
|
|
2465
2464
|
});
|
|
2466
|
-
} else if (t.id ===
|
|
2465
|
+
} else if (t.id === ke.id) {
|
|
2467
2466
|
const e = t.params, { unitId: n, subUnitId: r, range: s } = e, a = s.endColumn - s.startColumn + 1;
|
|
2468
|
-
this._tableManager.getTablesBySubunitId(n, r).forEach((
|
|
2469
|
-
const
|
|
2470
|
-
s.startColumn <
|
|
2467
|
+
this._tableManager.getTablesBySubunitId(n, r).forEach((u) => {
|
|
2468
|
+
const l = u.getRange();
|
|
2469
|
+
s.startColumn < l.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2471
2470
|
newRange: {
|
|
2472
|
-
...
|
|
2473
|
-
startColumn:
|
|
2474
|
-
endColumn:
|
|
2471
|
+
...l,
|
|
2472
|
+
startColumn: l.startColumn - a,
|
|
2473
|
+
endColumn: l.endColumn - a
|
|
2475
2474
|
}
|
|
2476
2475
|
});
|
|
2477
2476
|
});
|
|
@@ -2480,16 +2479,16 @@ let le = class extends k {
|
|
|
2480
2479
|
}
|
|
2481
2480
|
};
|
|
2482
2481
|
le = qn([
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2482
|
+
W(0, C(x)),
|
|
2483
|
+
W(1, C(dt)),
|
|
2484
|
+
W(2, C(E)),
|
|
2485
|
+
W(3, C(Ae)),
|
|
2486
|
+
W(4, C(Ce)),
|
|
2487
|
+
W(5, C(_)),
|
|
2488
|
+
W(6, C(de))
|
|
2490
2489
|
], le);
|
|
2491
|
-
var
|
|
2492
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2490
|
+
var kn = Object.getOwnPropertyDescriptor, Jn = (t, e, n, r) => {
|
|
2491
|
+
for (var s = r > 1 ? void 0 : r ? kn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2493
2492
|
(o = t[a]) && (s = o(s) || s);
|
|
2494
2493
|
return s;
|
|
2495
2494
|
}, se = (t, e) => (n, r) => e(n, r, t);
|
|
@@ -2503,8 +2502,8 @@ let ue = class extends k {
|
|
|
2503
2502
|
registerTableChangeEvent() {
|
|
2504
2503
|
this.disposeWithMe(
|
|
2505
2504
|
this._tableManager.tableAdd$.subscribe((e) => {
|
|
2506
|
-
const { range: n, tableId: r, unitId: s, subUnitId: a } = e,
|
|
2507
|
-
|
|
2505
|
+
const { range: n, tableId: r, unitId: s, subUnitId: a, tableStyleId: o } = e, u = this._tableManager.getTable(s, r), l = o || this._allThemes[this._defaultThemeIndex].name;
|
|
2506
|
+
u.setTableStyleId(l), this._sheetRangeThemeService.registerRangeThemeStyle(l, {
|
|
2508
2507
|
unitId: s,
|
|
2509
2508
|
subUnitId: a,
|
|
2510
2509
|
range: { ...n }
|
|
@@ -2512,13 +2511,13 @@ let ue = class extends k {
|
|
|
2512
2511
|
})
|
|
2513
2512
|
), this.disposeWithMe(
|
|
2514
2513
|
this._tableManager.tableRangeChanged$.subscribe((e) => {
|
|
2515
|
-
const { range: n, oldRange: r, tableId: s, unitId: a, subUnitId: o } = e,
|
|
2516
|
-
let
|
|
2517
|
-
|
|
2514
|
+
const { range: n, oldRange: r, tableId: s, unitId: a, subUnitId: o } = e, u = this._tableManager.getTable(a, s);
|
|
2515
|
+
let l = u.getTableStyleId();
|
|
2516
|
+
l || (l = this._allThemes[this._defaultThemeIndex].name, u.setTableStyleId(l)), this._sheetRangeThemeService.removeRangeThemeRule(l, {
|
|
2518
2517
|
unitId: a,
|
|
2519
2518
|
subUnitId: o,
|
|
2520
2519
|
range: { ...r }
|
|
2521
|
-
}), this._sheetRangeThemeService.registerRangeThemeStyle(
|
|
2520
|
+
}), this._sheetRangeThemeService.registerRangeThemeStyle(l, {
|
|
2522
2521
|
unitId: a,
|
|
2523
2522
|
subUnitId: o,
|
|
2524
2523
|
range: { ...n }
|
|
@@ -2526,15 +2525,15 @@ let ue = class extends k {
|
|
|
2526
2525
|
})
|
|
2527
2526
|
), this.disposeWithMe(
|
|
2528
2527
|
this._tableManager.tableThemeChanged$.subscribe((e) => {
|
|
2529
|
-
const { theme: n, oldTheme: r, tableId: s, unitId: a, subUnitId: o } = e,
|
|
2528
|
+
const { theme: n, oldTheme: r, tableId: s, unitId: a, subUnitId: o } = e, l = this._tableManager.getTable(a, s).getRange();
|
|
2530
2529
|
this._sheetRangeThemeService.removeRangeThemeRule(r, {
|
|
2531
2530
|
unitId: a,
|
|
2532
2531
|
subUnitId: o,
|
|
2533
|
-
range: { ...
|
|
2532
|
+
range: { ...l }
|
|
2534
2533
|
}), this._sheetRangeThemeService.registerRangeThemeStyle(n, {
|
|
2535
2534
|
unitId: a,
|
|
2536
2535
|
subUnitId: o,
|
|
2537
|
-
range: { ...
|
|
2536
|
+
range: { ...l }
|
|
2538
2537
|
});
|
|
2539
2538
|
})
|
|
2540
2539
|
), this.disposeWithMe(
|
|
@@ -2554,7 +2553,7 @@ let ue = class extends k {
|
|
|
2554
2553
|
}
|
|
2555
2554
|
_initDefaultTableTheme() {
|
|
2556
2555
|
for (let e = 0; e < this._allThemes.length; e++) {
|
|
2557
|
-
const { name: n, style: r } = this._allThemes[e], s = new
|
|
2556
|
+
const { name: n, style: r } = this._allThemes[e], s = new Rt(n, r);
|
|
2558
2557
|
this._sheetRangeThemeModel.registerDefaultRangeTheme(s);
|
|
2559
2558
|
}
|
|
2560
2559
|
}
|
|
@@ -2562,7 +2561,7 @@ let ue = class extends k {
|
|
|
2562
2561
|
super.dispose(), this._allThemes = [], this._defaultThemeIndex = 0;
|
|
2563
2562
|
}
|
|
2564
2563
|
};
|
|
2565
|
-
ue =
|
|
2564
|
+
ue = Jn([
|
|
2566
2565
|
se(0, C(_)),
|
|
2567
2566
|
se(1, C(wt)),
|
|
2568
2567
|
se(2, C(He)),
|
|
@@ -2572,11 +2571,11 @@ var Qn = Object.getOwnPropertyDescriptor, Yn = (t, e, n, r) => {
|
|
|
2572
2571
|
for (var s = r > 1 ? void 0 : r ? Qn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2573
2572
|
(o = t[a]) && (s = o(s) || s);
|
|
2574
2573
|
return s;
|
|
2575
|
-
},
|
|
2574
|
+
}, Re = (t, e) => (n, r) => e(n, r, t);
|
|
2576
2575
|
let ce = class extends k {
|
|
2577
2576
|
constructor(e, n, r) {
|
|
2578
2577
|
super();
|
|
2579
|
-
b(this, "_tableFilteredOutRows$", new
|
|
2578
|
+
b(this, "_tableFilteredOutRows$", new Je(/* @__PURE__ */ new Set()));
|
|
2580
2579
|
b(this, "tableFilteredOutRows$", this._tableFilteredOutRows$.asObservable());
|
|
2581
2580
|
b(this, "_subscription", null);
|
|
2582
2581
|
this._tableManager = e, this._sheetInterceptorService = n, this._univerInstanceService = r, this.registerFilterChangeEvent(), this.initTableHiddenRowIntercept(), this._initFilteredOutRows();
|
|
@@ -2613,8 +2612,8 @@ let ce = class extends k {
|
|
|
2613
2612
|
this.tableFilteredOutRows.clear(), this._tableManager.getTablesBySubunitId(n, r).forEach((a) => {
|
|
2614
2613
|
const o = a.getTableFilters().getFilterOutRows();
|
|
2615
2614
|
if (o)
|
|
2616
|
-
for (const
|
|
2617
|
-
this.tableFilteredOutRows.add(
|
|
2615
|
+
for (const u of o)
|
|
2616
|
+
this.tableFilteredOutRows.add(u);
|
|
2618
2617
|
});
|
|
2619
2618
|
});
|
|
2620
2619
|
}
|
|
@@ -2640,15 +2639,15 @@ let ce = class extends k {
|
|
|
2640
2639
|
}
|
|
2641
2640
|
};
|
|
2642
2641
|
ce = Yn([
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2642
|
+
Re(0, C(_)),
|
|
2643
|
+
Re(1, C(Ce)),
|
|
2644
|
+
Re(2, C(E))
|
|
2646
2645
|
], ce);
|
|
2647
2646
|
var Gn = Object.getOwnPropertyDescriptor, jn = (t, e, n, r) => {
|
|
2648
2647
|
for (var s = r > 1 ? void 0 : r ? Gn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
2649
2648
|
(o = t[a]) && (s = o(s) || s);
|
|
2650
2649
|
return s;
|
|
2651
|
-
},
|
|
2650
|
+
}, fe = (t, e) => (n, r) => e(n, r, t), ae;
|
|
2652
2651
|
let $e = (ae = class extends it {
|
|
2653
2652
|
constructor(t = De, e, n, r) {
|
|
2654
2653
|
super(), this._config = t, this._injector = e, this._configService = n, this._commandService = r;
|
|
@@ -2663,7 +2662,7 @@ let $e = (ae = class extends it {
|
|
|
2663
2662
|
ut(this._injector, [
|
|
2664
2663
|
[_],
|
|
2665
2664
|
[ue],
|
|
2666
|
-
[
|
|
2665
|
+
[L],
|
|
2667
2666
|
[j],
|
|
2668
2667
|
[ce],
|
|
2669
2668
|
[ie],
|
|
@@ -2672,7 +2671,7 @@ let $e = (ae = class extends it {
|
|
|
2672
2671
|
[ie],
|
|
2673
2672
|
[le],
|
|
2674
2673
|
[ue],
|
|
2675
|
-
[
|
|
2674
|
+
[L],
|
|
2676
2675
|
[j],
|
|
2677
2676
|
[ce]
|
|
2678
2677
|
]);
|
|
@@ -2689,7 +2688,7 @@ let $e = (ae = class extends it {
|
|
|
2689
2688
|
Dn,
|
|
2690
2689
|
te,
|
|
2691
2690
|
Se,
|
|
2692
|
-
|
|
2691
|
+
yn,
|
|
2693
2692
|
An,
|
|
2694
2693
|
p,
|
|
2695
2694
|
Un,
|
|
@@ -2702,9 +2701,9 @@ let $e = (ae = class extends it {
|
|
|
2702
2701
|
}
|
|
2703
2702
|
}, b(ae, "pluginName", Xe), b(ae, "type", he.UNIVER_SHEET), ae);
|
|
2704
2703
|
$e = jn([
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2704
|
+
fe(1, C(Ae)),
|
|
2705
|
+
fe(2, Be),
|
|
2706
|
+
fe(3, C(x))
|
|
2708
2707
|
], $e);
|
|
2709
2708
|
export {
|
|
2710
2709
|
Fn as AddSheetTableCommand,
|
|
@@ -2713,9 +2712,9 @@ export {
|
|
|
2713
2712
|
Dn as DeleteSheetTableCommand,
|
|
2714
2713
|
te as DeleteSheetTableMutation,
|
|
2715
2714
|
$n as RemoveTableThemeCommand,
|
|
2716
|
-
|
|
2715
|
+
Nn as SHEET_TABLE_CUSTOM_THEME_PREFIX,
|
|
2717
2716
|
An as SetSheetTableCommand,
|
|
2718
|
-
|
|
2717
|
+
yn as SetSheetTableFilterCommand,
|
|
2719
2718
|
Se as SetSheetTableFilterMutation,
|
|
2720
2719
|
p as SetSheetTableMutation,
|
|
2721
2720
|
Ln as SheetTableInsertColCommand,
|
|
@@ -2723,16 +2722,16 @@ export {
|
|
|
2723
2722
|
Wn as SheetTableRemoveColCommand,
|
|
2724
2723
|
En as SheetTableRemoveRowCommand,
|
|
2725
2724
|
j as SheetTableService,
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2725
|
+
P as SheetsTableButtonStateEnum,
|
|
2726
|
+
L as SheetsTableController,
|
|
2727
|
+
Q as SheetsTableSortStateEnum,
|
|
2729
2728
|
Qe as TableColumnDataTypeEnum,
|
|
2730
2729
|
Z as TableColumnFilterTypeEnum,
|
|
2731
2730
|
U as TableConditionTypeEnum,
|
|
2732
2731
|
g as TableDateCompareTypeEnum,
|
|
2733
2732
|
_ as TableManager,
|
|
2734
2733
|
F as TableNumberCompareTypeEnum,
|
|
2735
|
-
|
|
2734
|
+
H as TableStringCompareTypeEnum,
|
|
2736
2735
|
$e as UniverSheetsTablePlugin,
|
|
2737
2736
|
nr as customEmptyThemeWithBorderStyle,
|
|
2738
2737
|
St as isConditionFilter,
|