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