@univerjs/sheets-table 0.10.13 → 0.10.14-nightly.202511070628
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +249 -251
- package/lib/index.js +249 -251
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (t, e, n) =>
|
|
4
|
-
import { CellValueType as q, BorderStyleTypes as
|
|
5
|
-
import { getSheetCommandTarget as $, SheetInterceptorService as pe, INTERCEPTOR_POINT as
|
|
6
|
-
import { Subject as Y, BehaviorSubject as
|
|
7
|
-
var M = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(M || {}), y = /* @__PURE__ */ ((t) => (t.Row = "row", t.Col = "column", t))(y || {}),
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var tt = (t, e, n) => e in t ? et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var b = (t, e, n) => tt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CellValueType as q, BorderStyleTypes as nt, createREGEXFromWildChar as Z, generateRandomId as L, IUniverInstanceService as E, Inject as p, LocaleService as me, Disposable as Q, CommandType as N, IUndoRedoService as A, ICommandService as x, sequenceExecute as B, ILogService as Ae, IResourceManagerService as st, Rectangle as Se, RTree as rt, InterceptorEffectEnum as at, UniverInstanceType as z, customNameCharacterCheck as ot, Injector as Ee, IConfigService as Be, Plugin as it, merge as lt, registerDependencies as ut, touchDependencies as Ie } from "@univerjs/core";
|
|
5
|
+
import { getSheetCommandTarget as $, SheetInterceptorService as pe, INTERCEPTOR_POINT as Le, RemoveSheetCommand as ct, CopySheetCommand as dt, AddRangeThemeMutation as We, RemoveRangeThemeMutation as He, SheetRangeThemeModel as Ve, SheetsSelectionsService as be, InsertRowMutation as Pe, RemoveRowMutation as qe, getMoveRangeUndoRedoMutations as we, InsertColMutation as Je, RemoveColMutation as ke, IExclusiveRangeService as ht, RefRangeService as gt, RemoveColCommand as mt, RemoveRowCommand as bt, InsertColCommand as wt, InsertRowCommand as ft, SheetRangeThemeService as Rt, RangeThemeStyle as St, ZebraCrossingCacheController as Ct } from "@univerjs/sheets";
|
|
6
|
+
import { Subject as Y, BehaviorSubject as Qe, filter as fe, switchMap as Me } from "rxjs";
|
|
7
|
+
var M = /* @__PURE__ */ ((t) => (t.Insert = "insert", t.Delete = "delete", t))(M || {}), y = /* @__PURE__ */ ((t) => (t.Row = "row", t.Col = "column", t))(y || {}), Ye = /* @__PURE__ */ ((t) => (t.None = "none", t.String = "string", t.Number = "number", t.Date = "date", t.Bool = "bool", t.Checkbox = "checkbox", t.List = "list", t))(Ye || {}), ne = /* @__PURE__ */ ((t) => (t.manual = "manual", t.condition = "condition", t))(ne || {}), O = /* @__PURE__ */ ((t) => (t.Date = "date", t.Number = "number", t.String = "string", t.Logic = "logic", t))(O || {}), F = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.GreaterThan = "greaterThan", t.GreaterThanOrEqual = "greaterThanOrEqual", t.LessThan = "lessThan", t.LessThanOrEqual = "lessThanOrEqual", t.Between = "between", t.NotBetween = "notBetween", t.Above = "above", t.Below = "below", t.TopN = "topN", t))(F || {}), V = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.Contains = "contains", t.NotContains = "notContains", t.StartsWith = "startsWith", t.EndsWith = "endsWith", t))(V || {}), m = /* @__PURE__ */ ((t) => (t.Equal = "equal", t.NotEqual = "notEqual", t.After = "after", t.AfterOrEqual = "afterOrEqual", t.Before = "before", t.BeforeOrEqual = "beforeOrEqual", t.Between = "between", t.NotBetween = "notBetween", t.Today = "today", t.Yesterday = "yesterday", t.Tomorrow = "tomorrow", t.ThisWeek = "thisWeek", t.LastWeek = "lastWeek", t.NextWeek = "nextWeek", t.ThisMonth = "thisMonth", t.LastMonth = "lastMonth", t.NextMonth = "nextMonth", t.ThisQuarter = "thisQuarter", t.LastQuarter = "lastQuarter", t.NextQuarter = "nextQuarter", t.ThisYear = "thisYear", t.LastYear = "lastYear", t.NextYear = "nextYear", t.YearToDate = "yearToDate", t.Quarter = "quarter", t.Month = "month", t.M1 = "m1", t.M2 = "m2", t.M3 = "m3", t.M4 = "m4", t.M5 = "m5", t.M6 = "m6", t.M7 = "m7", t.M8 = "m8", t.M9 = "m9", t.M10 = "m10", t.M11 = "m11", t.M12 = "m12", t.Q1 = "q1", t.Q2 = "q2", t.Q3 = "q3", t.Q4 = "q4", t))(m || {}), P = /* @__PURE__ */ ((t) => (t[t.FilteredSortNone = 1] = "FilteredSortNone", t[t.FilteredSortAsc = 2] = "FilteredSortAsc", t[t.FilteredSortDesc = 3] = "FilteredSortDesc", t[t.FilterNoneSortNone = 4] = "FilterNoneSortNone", t[t.FilterNoneSortAsc = 5] = "FilterNoneSortAsc", t[t.FilterNoneSortDesc = 6] = "FilterNoneSortDesc", t))(P || {}), G = /* @__PURE__ */ ((t) => (t.Asc = "asc", t.Desc = "desc", t.None = "none", t))(G || {});
|
|
8
8
|
function te(t, e) {
|
|
9
9
|
return `${e} ${t}`;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ const ve = "TRUE", Fe = "FALSE", pt = (t) => {
|
|
|
12
12
|
var n;
|
|
13
13
|
return ((n = t.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "")) || "";
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function Ge(t) {
|
|
16
16
|
if (t) {
|
|
17
17
|
const { v: e, t: n, p: s } = t;
|
|
18
18
|
return s ? pt(s) : (n === q.FORCE_STRING || n === q.STRING) && e !== void 0 && e !== null ? String(e) : n === q.BOOLEAN ? e ? ve : Fe : n === q.NUMBER ? String(e) : typeof e === "boolean" ? e ? ve : Fe : e == null ? "" : String(e);
|
|
@@ -46,11 +46,11 @@ function rs(t) {
|
|
|
46
46
|
return t ? t.filterType === ne.manual : !1;
|
|
47
47
|
}
|
|
48
48
|
const D = {
|
|
49
|
-
s:
|
|
49
|
+
s: nt.THIN,
|
|
50
50
|
cl: {
|
|
51
51
|
rgb: "rgb(95, 101, 116)"
|
|
52
52
|
}
|
|
53
|
-
},
|
|
53
|
+
}, ze = "sheets-table.config", ye = {}, as = {
|
|
54
54
|
headerRowStyle: {
|
|
55
55
|
bd: {
|
|
56
56
|
t: D
|
|
@@ -111,8 +111,8 @@ const D = {
|
|
|
111
111
|
[["#AC94FA", "#FFFFFF", "#F6F5FF", "#EDEBFE"], ["#fff"]],
|
|
112
112
|
[["#F17EBB", "#FFFFFF", "#FDF2F8", "#FCE8F3"], ["#fff"]],
|
|
113
113
|
[["#F98080", "#FFFFFF", "#FDF2F2", "#FDE8E8"], ["#fff"]]
|
|
114
|
-
],
|
|
115
|
-
const [n, s] = t, [r, a, o, u] = n, [
|
|
114
|
+
], je = It.map((t, e) => {
|
|
115
|
+
const [n, s] = t, [r, a, o, u] = n, [l] = s;
|
|
116
116
|
return {
|
|
117
117
|
name: `table-default-${e}`,
|
|
118
118
|
style: {
|
|
@@ -121,7 +121,7 @@ const D = {
|
|
|
121
121
|
rgb: r
|
|
122
122
|
},
|
|
123
123
|
cl: {
|
|
124
|
-
rgb:
|
|
124
|
+
rgb: l
|
|
125
125
|
},
|
|
126
126
|
bd: {
|
|
127
127
|
t: D
|
|
@@ -166,7 +166,7 @@ class j {
|
|
|
166
166
|
b(this, "formula");
|
|
167
167
|
b(this, "meta");
|
|
168
168
|
b(this, "style");
|
|
169
|
-
this.id = e, this.displayName = n, this.dataType =
|
|
169
|
+
this.id = e, this.displayName = n, this.dataType = Ye.String, this.formula = "", this.meta = {}, this.style = {};
|
|
170
170
|
}
|
|
171
171
|
getMeta() {
|
|
172
172
|
return this.meta;
|
|
@@ -209,14 +209,14 @@ const Mt = (t) => t.getMonth() <= 2, vt = (t) => {
|
|
|
209
209
|
}, K = (t) => {
|
|
210
210
|
const e = t.getDay(), n = t.getDate() - e + (e === 0 ? -6 : 1), s = new Date(t);
|
|
211
211
|
return s.setDate(n), s;
|
|
212
|
-
},
|
|
212
|
+
}, Ke = 10080 * 60 * 1e3, Jt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
213
213
|
const n = K(t), s = K(e);
|
|
214
214
|
return n.toDateString() === s.toDateString();
|
|
215
215
|
}, kt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
216
|
-
const n = K(t), s = new Date(K(e).getTime() +
|
|
216
|
+
const n = K(t), s = new Date(K(e).getTime() + Ke);
|
|
217
217
|
return n.toDateString() === s.toDateString();
|
|
218
218
|
}, Qt = (t, e = /* @__PURE__ */ new Date()) => {
|
|
219
|
-
const n = K(t), s = new Date(K(e).getTime() -
|
|
219
|
+
const n = K(t), s = new Date(K(e).getTime() - Ke);
|
|
220
220
|
return n.toDateString() === s.toDateString();
|
|
221
221
|
}, Yt = (t, e = /* @__PURE__ */ new Date()) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth(), Gt = (t) => {
|
|
222
222
|
const e = new Date(t);
|
|
@@ -581,11 +581,11 @@ const Cn = /* @__PURE__ */ new Set([
|
|
|
581
581
|
F.TopN
|
|
582
582
|
]);
|
|
583
583
|
m.Today, m.Yesterday, m.Tomorrow, m.ThisWeek, m.LastWeek, m.NextWeek, m.ThisMonth, m.LastMonth, m.NextMonth, m.ThisQuarter, m.LastQuarter, m.NextQuarter, m.NextYear, m.ThisYear, m.LastYear, m.YearToDate;
|
|
584
|
-
function
|
|
584
|
+
function Xe(t) {
|
|
585
585
|
return Cn.has(t);
|
|
586
586
|
}
|
|
587
587
|
function pn(t, e) {
|
|
588
|
-
if (
|
|
588
|
+
if (Xe(t.filterInfo.compareType))
|
|
589
589
|
return (n) => !0;
|
|
590
590
|
switch (t.filterInfo.conditionType) {
|
|
591
591
|
case O.Date:
|
|
@@ -684,23 +684,23 @@ class De {
|
|
|
684
684
|
doColumnFilter(e, n, s, r) {
|
|
685
685
|
const a = this._tableColumnFilterList[s];
|
|
686
686
|
if (a && e) {
|
|
687
|
-
const { startRow: o, endRow: u, startColumn:
|
|
687
|
+
const { startRow: o, endRow: u, startColumn: l } = n, i = l + s, h = this.getExecuteFunc(e, n, s, a);
|
|
688
688
|
for (let d = o; d <= u; d++) {
|
|
689
689
|
const c = Tt(a) ? a.filterInfo.conditionType : O.String;
|
|
690
|
-
ue(e, d,
|
|
690
|
+
ue(e, d, i, c) === null ? r.add(d) : h(ue(e, d, i, c)) || r.add(d);
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
_getNumberCalculatedOptions(e, n, s) {
|
|
695
|
-
const { startRow: r, endRow: a, startColumn: o } = n, u = o + s,
|
|
696
|
-
let
|
|
695
|
+
const { startRow: r, endRow: a, startColumn: o } = n, u = o + s, l = [];
|
|
696
|
+
let i = 0, h = 0;
|
|
697
697
|
for (let d = r; d <= a; d++) {
|
|
698
698
|
const c = ue(e, d, u, O.Number);
|
|
699
|
-
c !== null && (
|
|
699
|
+
c !== null && (l.push(c), i++, h += c);
|
|
700
700
|
}
|
|
701
701
|
return {
|
|
702
|
-
list:
|
|
703
|
-
average:
|
|
702
|
+
list: l,
|
|
703
|
+
average: i > 0 ? h / i : 0
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
706
|
getExecuteFunc(e, n, s, r) {
|
|
@@ -708,7 +708,7 @@ class De {
|
|
|
708
708
|
const a = new Set(r.values);
|
|
709
709
|
return (o) => a.has(o);
|
|
710
710
|
} else if (r.filterType === ne.condition) {
|
|
711
|
-
const o =
|
|
711
|
+
const o = Xe(r.filterInfo.compareType) ? this._getNumberCalculatedOptions(e, n, s) : void 0;
|
|
712
712
|
return pn(r, o);
|
|
713
713
|
} else
|
|
714
714
|
return (a) => !0;
|
|
@@ -749,15 +749,15 @@ class xe {
|
|
|
749
749
|
var o, u;
|
|
750
750
|
this._tableStyleId = n == null ? void 0 : n.tableStyleId, this._showHeader = (o = n == null ? void 0 : n.showHeader) != null ? o : !0, this._showFooter = !1;
|
|
751
751
|
const s = this.getRange(), r = s.startColumn, a = s.endColumn;
|
|
752
|
-
for (let
|
|
753
|
-
const
|
|
752
|
+
for (let l = r; l <= a; l++) {
|
|
753
|
+
const i = l - r;
|
|
754
754
|
let h, d;
|
|
755
|
-
(u = n.columns) != null && u[
|
|
755
|
+
(u = n.columns) != null && u[i] ? (h = n.columns[i].id, d = n.columns[i].displayName) : (h = L(), d = e[l - r]);
|
|
756
756
|
const c = new j(h, d);
|
|
757
757
|
this._columns.set(h, c), this._columnOrder.push(h);
|
|
758
758
|
}
|
|
759
|
-
n.filters && n.filters.forEach((
|
|
760
|
-
|
|
759
|
+
n.filters && n.filters.forEach((i, h) => {
|
|
760
|
+
i && this._tableFilters.setColumnFilter(h, i);
|
|
761
761
|
});
|
|
762
762
|
}
|
|
763
763
|
setTableFilterColumn(e, n) {
|
|
@@ -770,11 +770,11 @@ class xe {
|
|
|
770
770
|
return this._tableFilters;
|
|
771
771
|
}
|
|
772
772
|
getTableFilterRange() {
|
|
773
|
-
const e = this.getRange(), n = this.isShowHeader(), s = this.isShowFooter(), { startRow: r, startColumn: a, endRow: o, endColumn: u } = e,
|
|
773
|
+
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;
|
|
774
774
|
return {
|
|
775
|
-
startRow:
|
|
775
|
+
startRow: l,
|
|
776
776
|
startColumn: a,
|
|
777
|
-
endRow:
|
|
777
|
+
endRow: i,
|
|
778
778
|
endColumn: u
|
|
779
779
|
};
|
|
780
780
|
}
|
|
@@ -841,7 +841,7 @@ class xe {
|
|
|
841
841
|
}
|
|
842
842
|
getTableStyleId() {
|
|
843
843
|
var e;
|
|
844
|
-
return (e = this._tableStyleId) != null ? e :
|
|
844
|
+
return (e = this._tableStyleId) != null ? e : je[0].name;
|
|
845
845
|
}
|
|
846
846
|
setTableStyleId(e) {
|
|
847
847
|
this._tableStyleId = e;
|
|
@@ -933,7 +933,7 @@ let T = class extends Q {
|
|
|
933
933
|
b(this, "tableThemeChanged$", this._tableThemeChanged$.asObservable());
|
|
934
934
|
b(this, "_tableFilterChanged$", new Y());
|
|
935
935
|
b(this, "tableFilterChanged$", this._tableFilterChanged$.asObservable());
|
|
936
|
-
b(this, "_tableInitStatus", new
|
|
936
|
+
b(this, "_tableInitStatus", new Qe(!1));
|
|
937
937
|
b(this, "tableInitStatus$", this._tableInitStatus.asObservable());
|
|
938
938
|
this._univerInstanceService = e, this._localeService = n, this._tableMap = /* @__PURE__ */ new Map();
|
|
939
939
|
}
|
|
@@ -942,10 +942,10 @@ let T = class extends Q {
|
|
|
942
942
|
}
|
|
943
943
|
getColumnHeader(e, n, s, r) {
|
|
944
944
|
var d;
|
|
945
|
-
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn: u, endColumn:
|
|
946
|
-
for (let c = u; c <=
|
|
947
|
-
|
|
948
|
-
return
|
|
945
|
+
const a = (d = this._univerInstanceService.getUnit(e)) == null ? void 0 : d.getSheetBySheetId(n), { startRow: o, startColumn: u, endColumn: l } = s, i = [], h = r != null ? r : "Column";
|
|
946
|
+
for (let c = u; c <= l; c++)
|
|
947
|
+
i.push(Ge(a == null ? void 0 : a.getCell(o, c)) || te(c - u + 1, h));
|
|
948
|
+
return i;
|
|
949
949
|
}
|
|
950
950
|
/**
|
|
951
951
|
* Add a table to univer.
|
|
@@ -960,23 +960,23 @@ let T = class extends Q {
|
|
|
960
960
|
*/
|
|
961
961
|
addTable(e, n, s, r, a, o, u) {
|
|
962
962
|
var c;
|
|
963
|
-
const
|
|
964
|
-
if (h.setSubunitId(n), this._ensureUnit(e).set(
|
|
963
|
+
const l = o != null ? o : L(), i = a || this.getColumnHeader(e, n, r), h = new xe(l, s, r, i, u);
|
|
964
|
+
if (h.setSubunitId(n), this._ensureUnit(e).set(l, h), this._tableAdd$.next({
|
|
965
965
|
unitId: e,
|
|
966
966
|
subUnitId: n,
|
|
967
967
|
range: r,
|
|
968
968
|
tableName: s,
|
|
969
|
-
tableId:
|
|
969
|
+
tableId: l,
|
|
970
970
|
tableStyleId: u == null ? void 0 : u.tableStyleId
|
|
971
971
|
}), u != null && u.filters) {
|
|
972
972
|
const g = (c = this._univerInstanceService.getUnit(e)) == null ? void 0 : c.getSheetBySheetId(n);
|
|
973
973
|
h.getTableFilters().doFilter(g, r), this._tableFilterChanged$.next({
|
|
974
974
|
unitId: e,
|
|
975
975
|
subUnitId: n,
|
|
976
|
-
tableId:
|
|
976
|
+
tableId: l
|
|
977
977
|
});
|
|
978
978
|
}
|
|
979
|
-
return
|
|
979
|
+
return l;
|
|
980
980
|
}
|
|
981
981
|
addFilter(e, n, s, r) {
|
|
982
982
|
const a = this.getTable(e, n);
|
|
@@ -1068,13 +1068,13 @@ let T = class extends Q {
|
|
|
1068
1068
|
if (r) {
|
|
1069
1069
|
const a = r.getTableInfo(), o = r.getTableStyleId();
|
|
1070
1070
|
s == null || s.delete(n);
|
|
1071
|
-
const { subUnitId: u, range:
|
|
1071
|
+
const { subUnitId: u, range: l, name: i } = a;
|
|
1072
1072
|
this._tableDelete$.next({
|
|
1073
1073
|
unitId: e,
|
|
1074
1074
|
subUnitId: u,
|
|
1075
1075
|
tableId: n,
|
|
1076
|
-
range:
|
|
1077
|
-
tableName:
|
|
1076
|
+
range: l,
|
|
1077
|
+
tableName: i,
|
|
1078
1078
|
tableStyleId: o
|
|
1079
1079
|
});
|
|
1080
1080
|
}
|
|
@@ -1082,24 +1082,24 @@ let T = class extends Q {
|
|
|
1082
1082
|
operationTableRowCol(e, n, s) {
|
|
1083
1083
|
const r = this.getTableById(e, n);
|
|
1084
1084
|
if (!r) return;
|
|
1085
|
-
const { operationType: a, rowColType: o, index: u, count:
|
|
1085
|
+
const { operationType: a, rowColType: o, index: u, count: l, columnsJson: i } = s, h = r.getRange(), d = { ...h };
|
|
1086
1086
|
if (a === M.Insert) {
|
|
1087
1087
|
if (o === "row")
|
|
1088
|
-
d.endRow +=
|
|
1088
|
+
d.endRow += l;
|
|
1089
1089
|
else if (o === "column") {
|
|
1090
|
-
d.endColumn +=
|
|
1091
|
-
for (let c = 0; c <
|
|
1090
|
+
d.endColumn += l;
|
|
1091
|
+
for (let c = 0; c < l; c++) {
|
|
1092
1092
|
const g = this._localeService.t("sheets-table.columnPrefix"), C = new j(L(), te(r.getColumnsCount() + 1 + c, g));
|
|
1093
|
-
|
|
1093
|
+
i != null && i[c] && C.fromJSON(i[c]);
|
|
1094
1094
|
const w = u + c - h.startColumn;
|
|
1095
1095
|
r.insertColumn(w, C);
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
} else if (o === "row")
|
|
1099
|
-
d.endRow -=
|
|
1099
|
+
d.endRow -= l;
|
|
1100
1100
|
else if (o === "column") {
|
|
1101
|
-
d.endColumn -=
|
|
1102
|
-
for (let c =
|
|
1101
|
+
d.endColumn -= l;
|
|
1102
|
+
for (let c = l - 1; c >= 0; c--) {
|
|
1103
1103
|
const g = u + c - h.startColumn;
|
|
1104
1104
|
r.removeColumn(g);
|
|
1105
1105
|
}
|
|
@@ -1117,25 +1117,25 @@ let T = class extends Q {
|
|
|
1117
1117
|
if (!r) return;
|
|
1118
1118
|
const a = r.getRange(), o = s.newRange;
|
|
1119
1119
|
if (o.startColumn < a.startColumn) {
|
|
1120
|
-
const u = a.startColumn - o.startColumn,
|
|
1121
|
-
for (let
|
|
1122
|
-
r.insertColumn(a.startColumn, new j(L(), te(r.getColumnsCount() + 1,
|
|
1120
|
+
const u = a.startColumn - o.startColumn, l = this._localeService.t("sheets-table.columnPrefix");
|
|
1121
|
+
for (let i = 0; i < u; i++)
|
|
1122
|
+
r.insertColumn(a.startColumn, new j(L(), te(r.getColumnsCount() + 1, l)));
|
|
1123
1123
|
} else if (o.startColumn > a.startColumn) {
|
|
1124
1124
|
const u = o.startColumn - a.startColumn;
|
|
1125
|
-
for (let
|
|
1126
|
-
const
|
|
1127
|
-
r.removeColumn(
|
|
1125
|
+
for (let l = u - 1; l >= 0; l--) {
|
|
1126
|
+
const i = o.startColumn + l - a.startColumn;
|
|
1127
|
+
r.removeColumn(i);
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
1130
|
if (o.endColumn < a.endColumn) {
|
|
1131
1131
|
const u = a.endColumn - o.endColumn;
|
|
1132
|
-
for (let
|
|
1133
|
-
const
|
|
1134
|
-
r.removeColumn(
|
|
1132
|
+
for (let l = u - 1; l >= 0; l--) {
|
|
1133
|
+
const i = o.endColumn + l - a.startColumn;
|
|
1134
|
+
r.removeColumn(i);
|
|
1135
1135
|
}
|
|
1136
1136
|
} else if (o.endColumn > a.endColumn) {
|
|
1137
1137
|
const u = o.endColumn - a.endColumn;
|
|
1138
|
-
for (let
|
|
1138
|
+
for (let l = 0; l < u; l++)
|
|
1139
1139
|
r.insertColumn(a.endColumn, new j(L(), te(r.getColumnsCount() + 1, "Column")));
|
|
1140
1140
|
}
|
|
1141
1141
|
r.setRange(o), this._tableRangeChanged$.next({
|
|
@@ -1150,7 +1150,7 @@ let T = class extends Q {
|
|
|
1150
1150
|
var c;
|
|
1151
1151
|
const r = this._tableMap.get(e), a = r == null ? void 0 : r.get(n);
|
|
1152
1152
|
if (!a) return;
|
|
1153
|
-
const o = a.getSubunitId(), { name: u, updateRange:
|
|
1153
|
+
const o = a.getSubunitId(), { name: u, updateRange: l, rowColOperation: i, theme: h, options: d } = s;
|
|
1154
1154
|
if (u) {
|
|
1155
1155
|
const g = a.getDisplayName();
|
|
1156
1156
|
a.setDisplayName(u), this._tableNameChanged$.next({
|
|
@@ -1161,7 +1161,7 @@ let T = class extends Q {
|
|
|
1161
1161
|
oldTableName: g
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
|
-
if (
|
|
1164
|
+
if (i && this.operationTableRowCol(e, n, i), l && this.updateTableRange(e, n, l), h) {
|
|
1165
1165
|
const g = (c = a.getTableStyleId()) != null ? c : "default";
|
|
1166
1166
|
a.setTableStyleId(h), this._tableThemeChanged$.next({
|
|
1167
1167
|
unitId: e,
|
|
@@ -1179,10 +1179,10 @@ let T = class extends Q {
|
|
|
1179
1179
|
const a = r.getSubunitId();
|
|
1180
1180
|
if (!n[a]) {
|
|
1181
1181
|
const o = /* @__PURE__ */ new Set();
|
|
1182
|
-
this.getTablesBySubunitId(e, a).forEach((
|
|
1183
|
-
const
|
|
1184
|
-
if (
|
|
1185
|
-
for (const h of
|
|
1182
|
+
this.getTablesBySubunitId(e, a).forEach((l) => {
|
|
1183
|
+
const i = l.getTableFilters().getFilterOutRows();
|
|
1184
|
+
if (i)
|
|
1185
|
+
for (const h of i)
|
|
1186
1186
|
o.add(h);
|
|
1187
1187
|
}), n[a] = {
|
|
1188
1188
|
tables: [],
|
|
@@ -1199,19 +1199,19 @@ let T = class extends Q {
|
|
|
1199
1199
|
if (!o)
|
|
1200
1200
|
return;
|
|
1201
1201
|
const u = o.worksheet;
|
|
1202
|
-
let
|
|
1203
|
-
n[a].tables ?
|
|
1204
|
-
const h = this.getColumnHeader(e, a,
|
|
1205
|
-
if (d.setTableMeta(
|
|
1202
|
+
let l;
|
|
1203
|
+
n[a].tables ? l = n[a].tables : Array.isArray(n[a]) && (l = n[a]), l && l.forEach((i) => {
|
|
1204
|
+
const h = this.getColumnHeader(e, a, i.range), d = new xe(i.id, i.name, i.range, h, i.options);
|
|
1205
|
+
if (d.setTableMeta(i.meta), i.columns.length && d.setColumns(i.columns), i.filters) {
|
|
1206
1206
|
const c = d.getTableFilters();
|
|
1207
|
-
c.fromJSON(
|
|
1207
|
+
c.fromJSON(i.filters), c.doFilter(u, d.getTableFilterRange());
|
|
1208
1208
|
}
|
|
1209
|
-
d.setSubunitId(a), s.set(
|
|
1209
|
+
d.setSubunitId(a), s.set(i.id, d), this._tableAdd$.next({
|
|
1210
1210
|
unitId: e,
|
|
1211
1211
|
subUnitId: a,
|
|
1212
|
-
range:
|
|
1213
|
-
tableName:
|
|
1214
|
-
tableId:
|
|
1212
|
+
range: i.range,
|
|
1213
|
+
tableName: i.name,
|
|
1214
|
+
tableId: i.id
|
|
1215
1215
|
});
|
|
1216
1216
|
});
|
|
1217
1217
|
}), this._tableInitStatus.next(!0);
|
|
@@ -1285,8 +1285,8 @@ const J = {
|
|
|
1285
1285
|
id: "sheet.mutation.add-table",
|
|
1286
1286
|
type: N.MUTATION,
|
|
1287
1287
|
handler: (t, e) => {
|
|
1288
|
-
const { tableId: n, unitId: s, subUnitId: r, name: a, range: o, header: u, options:
|
|
1289
|
-
return t.get(X).addTable(s, r, a, o, u, n,
|
|
1288
|
+
const { tableId: n, unitId: s, subUnitId: r, name: a, range: o, header: u, options: l } = e;
|
|
1289
|
+
return t.get(X).addTable(s, r, a, o, u, n, l), !0;
|
|
1290
1290
|
}
|
|
1291
1291
|
}, k = {
|
|
1292
1292
|
id: "sheet.mutation.delete-table",
|
|
@@ -1308,10 +1308,10 @@ const J = {
|
|
|
1308
1308
|
const f = t.get(T).getTableList(e.unitId).length;
|
|
1309
1309
|
o = `${r.t("sheets-table.tablePrefix")}${f + 1}`;
|
|
1310
1310
|
}
|
|
1311
|
-
const u = [],
|
|
1312
|
-
return u.push({ id: J.id, params: { ...e, tableId: a, name: o, header: g } }),
|
|
1311
|
+
const u = [], l = [], i = t.get(T), { unitId: h, subUnitId: d, range: c } = e, g = i.getColumnHeader(h, d, c, r.t("sheets-table.columnPrefix"));
|
|
1312
|
+
return u.push({ id: J.id, params: { ...e, tableId: a, name: o, header: g } }), l.push({ id: k.id, params: { tableId: a, unitId: e.unitId } }), B(u, s) && n.pushUndoRedo({
|
|
1313
1313
|
unitID: e.unitId,
|
|
1314
|
-
undoMutations:
|
|
1314
|
+
undoMutations: l,
|
|
1315
1315
|
redoMutations: u
|
|
1316
1316
|
}), !0;
|
|
1317
1317
|
}
|
|
@@ -1321,10 +1321,8 @@ const J = {
|
|
|
1321
1321
|
handler: (t, e) => {
|
|
1322
1322
|
if (!e)
|
|
1323
1323
|
return !1;
|
|
1324
|
-
const n = t.get(A), s = t.get(x), r = t.get(T), a =
|
|
1325
|
-
|
|
1326
|
-
throw new Error("[TableManager]: Table not found");
|
|
1327
|
-
return a.push({ id: k.id, params: { ...e } }), o.push({
|
|
1324
|
+
const n = t.get(A), s = t.get(x), r = t.get(T), a = t.get(Ae), o = [], u = [], l = r.getTable(e.unitId, e.tableId), i = l == null ? void 0 : l.toJSON();
|
|
1325
|
+
return i ? (o.push({ id: k.id, params: { ...e } }), u.push({
|
|
1328
1326
|
id: J.id,
|
|
1329
1327
|
params: {
|
|
1330
1328
|
unitId: e.unitId,
|
|
@@ -1334,11 +1332,11 @@ const J = {
|
|
|
1334
1332
|
range: i.range,
|
|
1335
1333
|
options: i.options
|
|
1336
1334
|
}
|
|
1337
|
-
}), B(
|
|
1335
|
+
}), B(o, s) && n.pushUndoRedo({
|
|
1338
1336
|
unitID: e.unitId,
|
|
1339
|
-
undoMutations:
|
|
1340
|
-
redoMutations:
|
|
1341
|
-
}), !0;
|
|
1337
|
+
undoMutations: u,
|
|
1338
|
+
redoMutations: o
|
|
1339
|
+
}), !0) : (a.error("[TableManager]: Table not found"), !1);
|
|
1342
1340
|
}
|
|
1343
1341
|
}, Ce = {
|
|
1344
1342
|
id: "sheet.mutation.set-table-filter",
|
|
@@ -1360,7 +1358,7 @@ const J = {
|
|
|
1360
1358
|
redoMutations: a
|
|
1361
1359
|
}), !0;
|
|
1362
1360
|
}
|
|
1363
|
-
},
|
|
1361
|
+
}, Ze = "SHEET_TABLE_PLUGIN", re = "SHEET_TABLE", Un = "table-custom";
|
|
1364
1362
|
var $n = Object.getOwnPropertyDescriptor, An = (t, e, n, s) => {
|
|
1365
1363
|
for (var r = s > 1 ? void 0 : s ? $n(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
1366
1364
|
(o = t[a]) && (r = o(r) || r);
|
|
@@ -1374,14 +1372,14 @@ let W = class extends Q {
|
|
|
1374
1372
|
}
|
|
1375
1373
|
getContainerTableWithRange(e, n, s) {
|
|
1376
1374
|
const r = this._ensureTableRangeRTree(e), o = Array.from(r.bulkSearch([{ unitId: e, sheetId: n, range: s }])).find((u) => {
|
|
1377
|
-
const
|
|
1378
|
-
return
|
|
1375
|
+
const l = this._tableManager.getTable(e, String(u));
|
|
1376
|
+
return l ? Se.contains(l.getRange(), s) : !1;
|
|
1379
1377
|
});
|
|
1380
1378
|
if (o)
|
|
1381
1379
|
return this._tableManager.getTable(e, String(o));
|
|
1382
1380
|
}
|
|
1383
1381
|
_ensureTableRangeRTree(e) {
|
|
1384
|
-
return this._tableRangeRTree.has(e) || this._tableRangeRTree.set(e, new
|
|
1382
|
+
return this._tableRangeRTree.has(e) || this._tableRangeRTree.set(e, new rt()), this._tableRangeRTree.get(e);
|
|
1385
1383
|
}
|
|
1386
1384
|
registerTableChangeEvent() {
|
|
1387
1385
|
this.disposeWithMe(
|
|
@@ -1423,12 +1421,12 @@ let W = class extends Q {
|
|
|
1423
1421
|
}
|
|
1424
1422
|
registerTableHeaderInterceptor() {
|
|
1425
1423
|
this.disposeWithMe(
|
|
1426
|
-
this._sheetInterceptorService.intercept(
|
|
1427
|
-
effect:
|
|
1424
|
+
this._sheetInterceptorService.intercept(Le.CELL_CONTENT, {
|
|
1425
|
+
effect: at.Value,
|
|
1428
1426
|
handler: (e, n, s) => {
|
|
1429
|
-
const { row: r, col: a, unitId: o, subUnitId: u } = n,
|
|
1430
|
-
if ((e == null ? void 0 : e.v) === void 0 &&
|
|
1431
|
-
const h = Array.from(
|
|
1427
|
+
const { row: r, col: a, unitId: o, subUnitId: u } = n, l = this._ensureTableRangeRTree(o);
|
|
1428
|
+
if ((e == null ? void 0 : e.v) === void 0 && l) {
|
|
1429
|
+
const h = Array.from(l.bulkSearch([{ unitId: o, sheetId: u, range: { startColumn: a, endColumn: a, startRow: r, endRow: r } }]));
|
|
1432
1430
|
if (h.length > 0) {
|
|
1433
1431
|
const d = this._tableManager.getTable(o, h[0]);
|
|
1434
1432
|
if (d) {
|
|
@@ -1467,7 +1465,7 @@ let W = class extends Q {
|
|
|
1467
1465
|
}
|
|
1468
1466
|
},
|
|
1469
1467
|
businesses: [z.UNIVER_SHEET],
|
|
1470
|
-
pluginName:
|
|
1468
|
+
pluginName: Ze,
|
|
1471
1469
|
onLoad: (e, n) => {
|
|
1472
1470
|
this._fromJSON(e, n);
|
|
1473
1471
|
},
|
|
@@ -1490,9 +1488,9 @@ let W = class extends Q {
|
|
|
1490
1488
|
const o = this._tableManager.getTablesBySubunitId(r, a);
|
|
1491
1489
|
if (o.length === 0)
|
|
1492
1490
|
return { redos: [], undos: [] };
|
|
1493
|
-
const u = [],
|
|
1494
|
-
return o.forEach((
|
|
1495
|
-
const h =
|
|
1491
|
+
const u = [], l = [];
|
|
1492
|
+
return o.forEach((i) => {
|
|
1493
|
+
const h = i.toJSON();
|
|
1496
1494
|
u.push({
|
|
1497
1495
|
id: k.id,
|
|
1498
1496
|
params: {
|
|
@@ -1500,7 +1498,7 @@ let W = class extends Q {
|
|
|
1500
1498
|
subUnitId: a,
|
|
1501
1499
|
tableId: h.id
|
|
1502
1500
|
}
|
|
1503
|
-
}),
|
|
1501
|
+
}), l.push({
|
|
1504
1502
|
id: J.id,
|
|
1505
1503
|
params: {
|
|
1506
1504
|
unitId: r,
|
|
@@ -1515,7 +1513,7 @@ let W = class extends Q {
|
|
|
1515
1513
|
}
|
|
1516
1514
|
}
|
|
1517
1515
|
});
|
|
1518
|
-
}), { redos: u, undos:
|
|
1516
|
+
}), { redos: u, undos: l };
|
|
1519
1517
|
} else if (e.id === dt.id) {
|
|
1520
1518
|
const s = e.params, { unitId: r, subUnitId: a, targetSubUnitId: o } = s;
|
|
1521
1519
|
if (!r || !a || !o)
|
|
@@ -1523,10 +1521,10 @@ let W = class extends Q {
|
|
|
1523
1521
|
const u = this._tableManager.getTablesBySubunitId(r, a);
|
|
1524
1522
|
if (u.length === 0)
|
|
1525
1523
|
return { redos: [], undos: [] };
|
|
1526
|
-
const
|
|
1524
|
+
const l = [], i = [];
|
|
1527
1525
|
return u.forEach((h) => {
|
|
1528
1526
|
const d = h.toJSON(), c = L();
|
|
1529
|
-
|
|
1527
|
+
l.push({
|
|
1530
1528
|
id: J.id,
|
|
1531
1529
|
params: {
|
|
1532
1530
|
unitId: r,
|
|
@@ -1543,7 +1541,7 @@ let W = class extends Q {
|
|
|
1543
1541
|
filters: d.filters.tableColumnFilterList
|
|
1544
1542
|
}
|
|
1545
1543
|
}
|
|
1546
|
-
}),
|
|
1544
|
+
}), i.push({
|
|
1547
1545
|
id: k.id,
|
|
1548
1546
|
params: {
|
|
1549
1547
|
unitId: r,
|
|
@@ -1551,7 +1549,7 @@ let W = class extends Q {
|
|
|
1551
1549
|
tableId: c
|
|
1552
1550
|
}
|
|
1553
1551
|
});
|
|
1554
|
-
}), { redos:
|
|
1552
|
+
}), { redos: l, undos: i };
|
|
1555
1553
|
}
|
|
1556
1554
|
return { redos: [], undos: [] };
|
|
1557
1555
|
}
|
|
@@ -1566,7 +1564,7 @@ W = An([
|
|
|
1566
1564
|
ae(0, p(E)),
|
|
1567
1565
|
ae(1, p(pe)),
|
|
1568
1566
|
ae(2, p(T)),
|
|
1569
|
-
ae(3, p(
|
|
1567
|
+
ae(3, p(st))
|
|
1570
1568
|
], W);
|
|
1571
1569
|
const S = {
|
|
1572
1570
|
id: "sheet.mutation.set-sheet-table",
|
|
@@ -1583,21 +1581,21 @@ const S = {
|
|
|
1583
1581
|
handler: (t, e) => {
|
|
1584
1582
|
if (!e)
|
|
1585
1583
|
return !1;
|
|
1586
|
-
const n = t.get(T), { unitId: s, tableId: r, themeStyle: a } = e, o = [], u = [],
|
|
1587
|
-
if (!
|
|
1588
|
-
const
|
|
1584
|
+
const n = t.get(T), { unitId: s, tableId: r, themeStyle: a } = e, o = [], u = [], l = n.getTableById(s, r);
|
|
1585
|
+
if (!l) return !1;
|
|
1586
|
+
const i = l.getSubunitId();
|
|
1589
1587
|
o.push({
|
|
1590
|
-
id:
|
|
1588
|
+
id: We.id,
|
|
1591
1589
|
params: {
|
|
1592
1590
|
unitId: s,
|
|
1593
|
-
subUnitId:
|
|
1591
|
+
subUnitId: i,
|
|
1594
1592
|
styleJSON: a.toJson()
|
|
1595
1593
|
}
|
|
1596
1594
|
}), o.push({
|
|
1597
1595
|
id: S.id,
|
|
1598
1596
|
params: {
|
|
1599
1597
|
unitId: s,
|
|
1600
|
-
subUnitId:
|
|
1598
|
+
subUnitId: i,
|
|
1601
1599
|
tableId: r,
|
|
1602
1600
|
config: {
|
|
1603
1601
|
theme: a.getName()
|
|
@@ -1607,17 +1605,17 @@ const S = {
|
|
|
1607
1605
|
id: S.id,
|
|
1608
1606
|
params: {
|
|
1609
1607
|
unitId: s,
|
|
1610
|
-
subUnitId:
|
|
1608
|
+
subUnitId: i,
|
|
1611
1609
|
tableId: r,
|
|
1612
1610
|
config: {
|
|
1613
|
-
themeStyle:
|
|
1611
|
+
themeStyle: l.getTableStyleId()
|
|
1614
1612
|
}
|
|
1615
1613
|
}
|
|
1616
1614
|
}), u.push({
|
|
1617
|
-
id:
|
|
1615
|
+
id: He.id,
|
|
1618
1616
|
params: {
|
|
1619
1617
|
unitId: s,
|
|
1620
|
-
subUnitId:
|
|
1618
|
+
subUnitId: i,
|
|
1621
1619
|
styleName: a.getName()
|
|
1622
1620
|
}
|
|
1623
1621
|
});
|
|
@@ -1634,17 +1632,17 @@ const S = {
|
|
|
1634
1632
|
handler: (t, e) => {
|
|
1635
1633
|
if (!e)
|
|
1636
1634
|
return !1;
|
|
1637
|
-
const { unitId: n, tableId: s, themeName: r } = e, a = t.get(T), o = t.get(
|
|
1635
|
+
const { unitId: n, tableId: s, themeName: r } = e, a = t.get(T), o = t.get(Ve), u = a.getTableById(n, s);
|
|
1638
1636
|
if (!u) return !1;
|
|
1639
|
-
const
|
|
1637
|
+
const l = u.getSubunitId(), i = [], h = [], d = o.getRegisteredRangeThemes().filter((f) => f == null ? void 0 : f.startsWith("table-default"));
|
|
1640
1638
|
let g = o.getRegisteredRangeThemes().filter((f) => f == null ? void 0 : f.startsWith(Un)).find((f) => f !== r);
|
|
1641
|
-
g || (g = d[0]),
|
|
1639
|
+
g || (g = d[0]), i.push({ id: S.id, params: { unitId: n, subUnitId: l, tableId: s, config: { theme: g } } }), i.push({ id: He.id, params: { unitId: n, subUnitId: l, styleName: r } });
|
|
1642
1640
|
const C = o.getDefaultRangeThemeStyle(r);
|
|
1643
|
-
C && (h.push({ id:
|
|
1641
|
+
C && (h.push({ id: We.id, params: { unitId: n, subUnitId: l, styleJSON: C.toJson() } }), h.push({ id: S.id, params: { unitId: n, subUnitId: l, tableId: s, config: { theme: r } } }));
|
|
1644
1642
|
const w = t.get(x);
|
|
1645
|
-
return B(
|
|
1643
|
+
return B(i, w) && t.get(A).pushUndoRedo({
|
|
1646
1644
|
unitID: n,
|
|
1647
|
-
redoMutations:
|
|
1645
|
+
redoMutations: i,
|
|
1648
1646
|
undoMutations: h
|
|
1649
1647
|
}), !0;
|
|
1650
1648
|
}
|
|
@@ -1655,17 +1653,17 @@ const S = {
|
|
|
1655
1653
|
handler: (t, e) => {
|
|
1656
1654
|
if (!e)
|
|
1657
1655
|
return !1;
|
|
1658
|
-
const { unitId: n, tableId: s, name: r, updateRange: a, rowColOperation: o, theme: u } = e,
|
|
1659
|
-
if (!
|
|
1656
|
+
const { unitId: n, tableId: s, name: r, updateRange: a, rowColOperation: o, theme: u } = e, l = t.get(T), i = l.getTableById(n, s);
|
|
1657
|
+
if (!i) return !1;
|
|
1660
1658
|
const h = {}, d = {}, c = t.get(me), C = t.get(E).getCurrentUnitOfType(z.UNIVER_SHEET), w = /* @__PURE__ */ new Set();
|
|
1661
1659
|
if (C && (C.getSheets().forEach((_) => {
|
|
1662
1660
|
w.add(_.getName());
|
|
1663
|
-
}),
|
|
1661
|
+
}), l.getTableList(n).forEach((_) => {
|
|
1664
1662
|
w.add(_.name);
|
|
1665
1663
|
})), r) {
|
|
1666
|
-
if (!
|
|
1667
|
-
return t.get(
|
|
1668
|
-
h.name =
|
|
1664
|
+
if (!ot(r, w))
|
|
1665
|
+
return t.get(Ae).warn(c.t("sheets-table.tableNameError")), !1;
|
|
1666
|
+
h.name = i.getDisplayName(), d.name = r;
|
|
1669
1667
|
}
|
|
1670
1668
|
o && (h.rowColOperation = {
|
|
1671
1669
|
operationType: o.operationType === M.Insert ? M.Delete : M.Insert,
|
|
@@ -1673,11 +1671,11 @@ const S = {
|
|
|
1673
1671
|
index: o.index,
|
|
1674
1672
|
count: o.count
|
|
1675
1673
|
}, d.rowColOperation = o), a && (h.updateRange = {
|
|
1676
|
-
newRange:
|
|
1677
|
-
}, d.updateRange = a), u && (h.theme =
|
|
1674
|
+
newRange: i.getRange()
|
|
1675
|
+
}, d.updateRange = a), u && (h.theme = i.getTableStyleId(), d.theme = u);
|
|
1678
1676
|
const R = {
|
|
1679
1677
|
unitId: n,
|
|
1680
|
-
subUnitId:
|
|
1678
|
+
subUnitId: i.getSubunitId(),
|
|
1681
1679
|
tableId: s,
|
|
1682
1680
|
config: d
|
|
1683
1681
|
};
|
|
@@ -1688,7 +1686,7 @@ const S = {
|
|
|
1688
1686
|
id: S.id,
|
|
1689
1687
|
params: {
|
|
1690
1688
|
unitId: n,
|
|
1691
|
-
subUnitId:
|
|
1689
|
+
subUnitId: i.getSubunitId(),
|
|
1692
1690
|
tableId: s,
|
|
1693
1691
|
config: h
|
|
1694
1692
|
}
|
|
@@ -1709,16 +1707,16 @@ const S = {
|
|
|
1709
1707
|
const e = t.get(E), n = $(e);
|
|
1710
1708
|
if (!n)
|
|
1711
1709
|
return !1;
|
|
1712
|
-
const { workbook: s, worksheet: r, unitId: a, subUnitId: o } = n,
|
|
1713
|
-
if (!
|
|
1710
|
+
const { workbook: s, worksheet: r, unitId: a, subUnitId: o } = n, l = t.get(be).getCurrentSelections();
|
|
1711
|
+
if (!l.length || l.length > 1)
|
|
1714
1712
|
return !1;
|
|
1715
1713
|
t.get(T);
|
|
1716
|
-
const h =
|
|
1714
|
+
const h = l[0].range, c = t.get(W).getContainerTableWithRange(a, o, h);
|
|
1717
1715
|
if (!c) return !1;
|
|
1718
1716
|
const g = h.endRow - h.startRow + 1, w = r.getRowCount() - 1, R = r.getCellMatrix().getDataRange().endRow, f = [], I = [];
|
|
1719
1717
|
if (w - R < g)
|
|
1720
1718
|
f.push({
|
|
1721
|
-
id:
|
|
1719
|
+
id: Pe.id,
|
|
1722
1720
|
params: {
|
|
1723
1721
|
unitId: a,
|
|
1724
1722
|
subUnitId: o,
|
|
@@ -1752,7 +1750,7 @@ const S = {
|
|
|
1752
1750
|
}
|
|
1753
1751
|
}
|
|
1754
1752
|
}), I.push({
|
|
1755
|
-
id:
|
|
1753
|
+
id: qe.id,
|
|
1756
1754
|
params: {
|
|
1757
1755
|
unitId: a,
|
|
1758
1756
|
subUnitId: o,
|
|
@@ -1831,16 +1829,16 @@ const S = {
|
|
|
1831
1829
|
const { worksheet: s, unitId: r, subUnitId: a } = n, u = t.get(be).getCurrentSelections();
|
|
1832
1830
|
if (!u.length || u.length > 1)
|
|
1833
1831
|
return !1;
|
|
1834
|
-
const
|
|
1832
|
+
const i = u[0].range, d = t.get(W).getContainerTableWithRange(r, a, i);
|
|
1835
1833
|
if (!d) return !1;
|
|
1836
|
-
const c =
|
|
1834
|
+
const c = i.endColumn - i.startColumn + 1, C = s.getColumnCount() - 1, w = s.getCellMatrix().getDataRange().endColumn, R = [], f = [];
|
|
1837
1835
|
if (C - w < c)
|
|
1838
1836
|
R.push({
|
|
1839
|
-
id:
|
|
1837
|
+
id: Je.id,
|
|
1840
1838
|
params: {
|
|
1841
1839
|
unitId: r,
|
|
1842
1840
|
subUnitId: a,
|
|
1843
|
-
range: { ...
|
|
1841
|
+
range: { ...i }
|
|
1844
1842
|
}
|
|
1845
1843
|
}), R.push({
|
|
1846
1844
|
id: S.id,
|
|
@@ -1852,7 +1850,7 @@ const S = {
|
|
|
1852
1850
|
rowColOperation: {
|
|
1853
1851
|
operationType: M.Insert,
|
|
1854
1852
|
rowColType: y.Col,
|
|
1855
|
-
index:
|
|
1853
|
+
index: i.startColumn,
|
|
1856
1854
|
count: c
|
|
1857
1855
|
}
|
|
1858
1856
|
}
|
|
@@ -1867,17 +1865,17 @@ const S = {
|
|
|
1867
1865
|
rowColOperation: {
|
|
1868
1866
|
operationType: M.Delete,
|
|
1869
1867
|
rowColType: y.Col,
|
|
1870
|
-
index:
|
|
1868
|
+
index: i.startColumn,
|
|
1871
1869
|
count: c
|
|
1872
1870
|
}
|
|
1873
1871
|
}
|
|
1874
1872
|
}
|
|
1875
1873
|
}), f.push({
|
|
1876
|
-
id:
|
|
1874
|
+
id: ke.id,
|
|
1877
1875
|
params: {
|
|
1878
1876
|
unitId: r,
|
|
1879
1877
|
subUnitId: a,
|
|
1880
|
-
range: { ...
|
|
1878
|
+
range: { ...i }
|
|
1881
1879
|
}
|
|
1882
1880
|
});
|
|
1883
1881
|
else {
|
|
@@ -1892,7 +1890,7 @@ const S = {
|
|
|
1892
1890
|
rowColOperation: {
|
|
1893
1891
|
operationType: M.Insert,
|
|
1894
1892
|
rowColType: y.Col,
|
|
1895
|
-
index:
|
|
1893
|
+
index: i.startColumn,
|
|
1896
1894
|
count: c
|
|
1897
1895
|
}
|
|
1898
1896
|
}
|
|
@@ -1907,7 +1905,7 @@ const S = {
|
|
|
1907
1905
|
rowColOperation: {
|
|
1908
1906
|
operationType: M.Delete,
|
|
1909
1907
|
rowColType: y.Col,
|
|
1910
|
-
index:
|
|
1908
|
+
index: i.startColumn,
|
|
1911
1909
|
count: c
|
|
1912
1910
|
}
|
|
1913
1911
|
}
|
|
@@ -1921,7 +1919,7 @@ const S = {
|
|
|
1921
1919
|
range: {
|
|
1922
1920
|
startRow: _.startRow,
|
|
1923
1921
|
endRow: _.endRow,
|
|
1924
|
-
startColumn:
|
|
1922
|
+
startColumn: i.startColumn,
|
|
1925
1923
|
endColumn: w
|
|
1926
1924
|
}
|
|
1927
1925
|
},
|
|
@@ -1931,7 +1929,7 @@ const S = {
|
|
|
1931
1929
|
range: {
|
|
1932
1930
|
startRow: _.startRow,
|
|
1933
1931
|
endRow: _.endRow,
|
|
1934
|
-
startColumn:
|
|
1932
|
+
startColumn: i.startColumn + c,
|
|
1935
1933
|
endColumn: w + c
|
|
1936
1934
|
}
|
|
1937
1935
|
}
|
|
@@ -1957,9 +1955,9 @@ const S = {
|
|
|
1957
1955
|
const { unitId: r, subUnitId: a } = s, u = t.get(be).getCurrentSelections();
|
|
1958
1956
|
if (!u.length || u.length > 1)
|
|
1959
1957
|
return !1;
|
|
1960
|
-
const
|
|
1958
|
+
const i = u[0].range, d = t.get(W).getContainerTableWithRange(r, a, i);
|
|
1961
1959
|
if (!d) return !1;
|
|
1962
|
-
const c =
|
|
1960
|
+
const c = i.endRow - i.startRow + 1, g = [], C = [], w = d.getRange();
|
|
1963
1961
|
g.push({
|
|
1964
1962
|
id: S.id,
|
|
1965
1963
|
params: {
|
|
@@ -1994,7 +1992,7 @@ const S = {
|
|
|
1994
1992
|
unitId: r,
|
|
1995
1993
|
subUnitId: a,
|
|
1996
1994
|
range: {
|
|
1997
|
-
startRow:
|
|
1995
|
+
startRow: i.endRow + 1,
|
|
1998
1996
|
endRow: f,
|
|
1999
1997
|
startColumn: w.startColumn,
|
|
2000
1998
|
endColumn: w.endColumn
|
|
@@ -2004,7 +2002,7 @@ const S = {
|
|
|
2004
2002
|
unitId: r,
|
|
2005
2003
|
subUnitId: a,
|
|
2006
2004
|
range: {
|
|
2007
|
-
startRow:
|
|
2005
|
+
startRow: i.startRow,
|
|
2008
2006
|
endRow: f - c,
|
|
2009
2007
|
startColumn: w.startColumn,
|
|
2010
2008
|
endColumn: w.endColumn
|
|
@@ -2030,10 +2028,10 @@ const S = {
|
|
|
2030
2028
|
return !1;
|
|
2031
2029
|
const { workbook: r, unitId: a, subUnitId: o } = s;
|
|
2032
2030
|
t.get(T);
|
|
2033
|
-
const
|
|
2034
|
-
if (!
|
|
2031
|
+
const l = t.get(be).getCurrentSelections();
|
|
2032
|
+
if (!l.length || l.length > 1)
|
|
2035
2033
|
return !1;
|
|
2036
|
-
const h =
|
|
2034
|
+
const h = l[0].range, c = t.get(W).getContainerTableWithRange(a, o, h);
|
|
2037
2035
|
if (!c) return !1;
|
|
2038
2036
|
const g = h.endColumn - h.startColumn + 1, C = [], w = [], R = c.getRange();
|
|
2039
2037
|
C.push({
|
|
@@ -2180,21 +2178,21 @@ let de = class extends Q {
|
|
|
2180
2178
|
if (!o.length)
|
|
2181
2179
|
return { undos: e, redos: n };
|
|
2182
2180
|
const { range: u } = t;
|
|
2183
|
-
return o.forEach((
|
|
2184
|
-
const
|
|
2185
|
-
if (u.startRow >
|
|
2181
|
+
return o.forEach((l) => {
|
|
2182
|
+
const i = l.getRange();
|
|
2183
|
+
if (u.startRow > i.startRow && u.startRow <= i.endRow) {
|
|
2186
2184
|
const h = u.endRow - u.startRow + 1;
|
|
2187
2185
|
n.push({
|
|
2188
2186
|
id: S.id,
|
|
2189
2187
|
params: {
|
|
2190
2188
|
unitId: r,
|
|
2191
2189
|
subUnitId: a,
|
|
2192
|
-
tableId:
|
|
2190
|
+
tableId: l.getId(),
|
|
2193
2191
|
config: {
|
|
2194
2192
|
updateRange: {
|
|
2195
2193
|
newRange: {
|
|
2196
|
-
...
|
|
2197
|
-
endRow:
|
|
2194
|
+
...i,
|
|
2195
|
+
endRow: i.endRow + h
|
|
2198
2196
|
}
|
|
2199
2197
|
}
|
|
2200
2198
|
}
|
|
@@ -2204,11 +2202,11 @@ let de = class extends Q {
|
|
|
2204
2202
|
params: {
|
|
2205
2203
|
unitId: r,
|
|
2206
2204
|
subUnitId: a,
|
|
2207
|
-
tableId:
|
|
2205
|
+
tableId: l.getId(),
|
|
2208
2206
|
config: {
|
|
2209
2207
|
updateRange: {
|
|
2210
2208
|
newRange: {
|
|
2211
|
-
...
|
|
2209
|
+
...i
|
|
2212
2210
|
}
|
|
2213
2211
|
}
|
|
2214
2212
|
}
|
|
@@ -2225,16 +2223,16 @@ let de = class extends Q {
|
|
|
2225
2223
|
if (!o.length)
|
|
2226
2224
|
return { undos: e, redos: n };
|
|
2227
2225
|
const { range: u } = t;
|
|
2228
|
-
return o.forEach((
|
|
2229
|
-
const
|
|
2230
|
-
if (u.startColumn >
|
|
2226
|
+
return o.forEach((l) => {
|
|
2227
|
+
const i = l.getRange();
|
|
2228
|
+
if (u.startColumn > i.startColumn && u.startColumn <= i.endColumn) {
|
|
2231
2229
|
const h = u.endColumn - u.startColumn + 1;
|
|
2232
2230
|
n.push({
|
|
2233
2231
|
id: S.id,
|
|
2234
2232
|
params: {
|
|
2235
2233
|
unitId: r,
|
|
2236
2234
|
subUnitId: a,
|
|
2237
|
-
tableId:
|
|
2235
|
+
tableId: l.getId(),
|
|
2238
2236
|
config: {
|
|
2239
2237
|
rowColOperation: {
|
|
2240
2238
|
operationType: M.Insert,
|
|
@@ -2249,7 +2247,7 @@ let de = class extends Q {
|
|
|
2249
2247
|
params: {
|
|
2250
2248
|
unitId: r,
|
|
2251
2249
|
subUnitId: a,
|
|
2252
|
-
tableId:
|
|
2250
|
+
tableId: l.getId(),
|
|
2253
2251
|
config: {
|
|
2254
2252
|
rowColOperation: {
|
|
2255
2253
|
operationType: M.Delete,
|
|
@@ -2267,14 +2265,14 @@ let de = class extends Q {
|
|
|
2267
2265
|
const e = [], n = [], s = [], r = [], a = $(this._univerInstanceService);
|
|
2268
2266
|
if (!a)
|
|
2269
2267
|
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2270
|
-
const { unitId: o, subUnitId: u } = a,
|
|
2271
|
-
if (!
|
|
2268
|
+
const { unitId: o, subUnitId: u } = a, l = this._tableManager.getTablesBySubunitId(o, u);
|
|
2269
|
+
if (!l.length)
|
|
2272
2270
|
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2273
|
-
const { range:
|
|
2274
|
-
return
|
|
2271
|
+
const { range: i } = t, h = i.endRow - i.startRow + 1;
|
|
2272
|
+
return l.forEach((d) => {
|
|
2275
2273
|
const c = d.getRange();
|
|
2276
|
-
if (Se.intersects(c,
|
|
2277
|
-
if (
|
|
2274
|
+
if (Se.intersects(c, i))
|
|
2275
|
+
if (i.startRow <= c.startRow && i.endRow >= c.startRow) {
|
|
2278
2276
|
s.push({
|
|
2279
2277
|
id: k.id,
|
|
2280
2278
|
params: {
|
|
@@ -2295,7 +2293,7 @@ let de = class extends Q {
|
|
|
2295
2293
|
options: g.options
|
|
2296
2294
|
}
|
|
2297
2295
|
});
|
|
2298
|
-
} else
|
|
2296
|
+
} else i.startRow > c.startRow && i.startRow <= c.endRow ? (n.push({
|
|
2299
2297
|
id: S.id,
|
|
2300
2298
|
params: {
|
|
2301
2299
|
unitId: o,
|
|
@@ -2324,7 +2322,7 @@ let de = class extends Q {
|
|
|
2324
2322
|
}
|
|
2325
2323
|
}
|
|
2326
2324
|
}
|
|
2327
|
-
})) :
|
|
2325
|
+
})) : i.startRow < c.endRow && i.endRow >= c.endRow && (n.push({
|
|
2328
2326
|
id: S.id,
|
|
2329
2327
|
params: {
|
|
2330
2328
|
unitId: o,
|
|
@@ -2334,7 +2332,7 @@ let de = class extends Q {
|
|
|
2334
2332
|
updateRange: {
|
|
2335
2333
|
newRange: {
|
|
2336
2334
|
...c,
|
|
2337
|
-
endRow:
|
|
2335
|
+
endRow: i.startRow - 1
|
|
2338
2336
|
}
|
|
2339
2337
|
}
|
|
2340
2338
|
}
|
|
@@ -2360,14 +2358,14 @@ let de = class extends Q {
|
|
|
2360
2358
|
const e = [], n = [], s = [], r = [], a = $(this._univerInstanceService);
|
|
2361
2359
|
if (!a)
|
|
2362
2360
|
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2363
|
-
const { unitId: o, subUnitId: u } = a,
|
|
2364
|
-
if (!
|
|
2361
|
+
const { unitId: o, subUnitId: u } = a, l = this._tableManager.getTablesBySubunitId(o, u);
|
|
2362
|
+
if (!l.length)
|
|
2365
2363
|
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2366
|
-
const { range:
|
|
2367
|
-
return
|
|
2364
|
+
const { range: i } = t, h = i.endColumn - i.startColumn + 1;
|
|
2365
|
+
return l.forEach((d) => {
|
|
2368
2366
|
const c = d.getRange();
|
|
2369
|
-
if (Se.intersects(c,
|
|
2370
|
-
if (
|
|
2367
|
+
if (Se.intersects(c, i)) {
|
|
2368
|
+
if (i.startColumn <= c.startColumn && i.endColumn >= c.endColumn) {
|
|
2371
2369
|
s.push({
|
|
2372
2370
|
id: k.id,
|
|
2373
2371
|
params: {
|
|
@@ -2381,7 +2379,7 @@ let de = class extends Q {
|
|
|
2381
2379
|
return { undos: e, redos: n, preRedos: s, preUndos: r };
|
|
2382
2380
|
const U = [];
|
|
2383
2381
|
for (let _ = w; _ <= R; _++)
|
|
2384
|
-
U.push(
|
|
2382
|
+
U.push(Ge(I == null ? void 0 : I.getCell(C, _)) || te(_ - w + 1, this._localeService.t("sheets-table.columnPrefix")));
|
|
2385
2383
|
e.push({
|
|
2386
2384
|
id: J.id,
|
|
2387
2385
|
params: {
|
|
@@ -2394,8 +2392,8 @@ let de = class extends Q {
|
|
|
2394
2392
|
options: g.options
|
|
2395
2393
|
}
|
|
2396
2394
|
});
|
|
2397
|
-
} else if (
|
|
2398
|
-
const g =
|
|
2395
|
+
} else if (i.startColumn <= c.startColumn && i.endColumn >= c.startColumn) {
|
|
2396
|
+
const g = i.endColumn - c.startColumn + 1;
|
|
2399
2397
|
n.push({
|
|
2400
2398
|
id: S.id,
|
|
2401
2399
|
params: {
|
|
@@ -2434,8 +2432,8 @@ let de = class extends Q {
|
|
|
2434
2432
|
}
|
|
2435
2433
|
}
|
|
2436
2434
|
});
|
|
2437
|
-
} else if (
|
|
2438
|
-
const g = c.endColumn -
|
|
2435
|
+
} else if (i.startColumn > c.startColumn && i.endColumn > c.endColumn) {
|
|
2436
|
+
const g = c.endColumn - i.startColumn + 1;
|
|
2439
2437
|
n.push({
|
|
2440
2438
|
id: S.id,
|
|
2441
2439
|
params: {
|
|
@@ -2446,13 +2444,13 @@ let de = class extends Q {
|
|
|
2446
2444
|
rowColOperation: {
|
|
2447
2445
|
operationType: M.Delete,
|
|
2448
2446
|
rowColType: y.Col,
|
|
2449
|
-
index:
|
|
2447
|
+
index: i.startColumn,
|
|
2450
2448
|
count: g
|
|
2451
2449
|
}
|
|
2452
2450
|
}
|
|
2453
2451
|
}
|
|
2454
2452
|
});
|
|
2455
|
-
const C = [], w =
|
|
2453
|
+
const C = [], w = i.startColumn - c.startColumn;
|
|
2456
2454
|
for (let R = 0; R < g; R++) {
|
|
2457
2455
|
const f = d.getTableColumnByIndex(R + w);
|
|
2458
2456
|
f && C.push(f.toJSON());
|
|
@@ -2467,14 +2465,14 @@ let de = class extends Q {
|
|
|
2467
2465
|
rowColOperation: {
|
|
2468
2466
|
operationType: M.Insert,
|
|
2469
2467
|
rowColType: y.Col,
|
|
2470
|
-
index:
|
|
2468
|
+
index: i.startColumn,
|
|
2471
2469
|
count: h,
|
|
2472
2470
|
columnsJson: C
|
|
2473
2471
|
}
|
|
2474
2472
|
}
|
|
2475
2473
|
}
|
|
2476
2474
|
});
|
|
2477
|
-
} else if (
|
|
2475
|
+
} else if (i.startColumn > c.startColumn && i.endColumn <= c.endColumn) {
|
|
2478
2476
|
n.push({
|
|
2479
2477
|
id: S.id,
|
|
2480
2478
|
params: {
|
|
@@ -2485,13 +2483,13 @@ let de = class extends Q {
|
|
|
2485
2483
|
rowColOperation: {
|
|
2486
2484
|
operationType: M.Delete,
|
|
2487
2485
|
rowColType: y.Col,
|
|
2488
|
-
index:
|
|
2486
|
+
index: i.startColumn,
|
|
2489
2487
|
count: h
|
|
2490
2488
|
}
|
|
2491
2489
|
}
|
|
2492
2490
|
}
|
|
2493
2491
|
});
|
|
2494
|
-
const g = [], C =
|
|
2492
|
+
const g = [], C = i.startColumn - c.startColumn;
|
|
2495
2493
|
for (let w = 0; w < h; w++) {
|
|
2496
2494
|
const R = d.getTableColumnByIndex(w + C);
|
|
2497
2495
|
R && g.push(R.toJSON());
|
|
@@ -2506,7 +2504,7 @@ let de = class extends Q {
|
|
|
2506
2504
|
rowColOperation: {
|
|
2507
2505
|
operationType: M.Insert,
|
|
2508
2506
|
rowColType: y.Col,
|
|
2509
|
-
index:
|
|
2507
|
+
index: i.startColumn,
|
|
2510
2508
|
count: h,
|
|
2511
2509
|
columnsJson: g
|
|
2512
2510
|
}
|
|
@@ -2519,51 +2517,51 @@ let de = class extends Q {
|
|
|
2519
2517
|
}
|
|
2520
2518
|
_initCommandListener() {
|
|
2521
2519
|
this._commandService.onCommandExecuted((t) => {
|
|
2522
|
-
if (t.id ===
|
|
2520
|
+
if (t.id === Pe.id) {
|
|
2523
2521
|
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endRow - r.startRow + 1;
|
|
2524
2522
|
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2525
|
-
const
|
|
2526
|
-
r.startRow <=
|
|
2523
|
+
const l = u.getRange();
|
|
2524
|
+
r.startRow <= l.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2527
2525
|
newRange: {
|
|
2528
|
-
...
|
|
2529
|
-
startRow:
|
|
2530
|
-
endRow:
|
|
2526
|
+
...l,
|
|
2527
|
+
startRow: l.startRow + a,
|
|
2528
|
+
endRow: l.endRow + a
|
|
2531
2529
|
}
|
|
2532
2530
|
});
|
|
2533
2531
|
});
|
|
2534
|
-
} else if (t.id ===
|
|
2532
|
+
} else if (t.id === Je.id) {
|
|
2535
2533
|
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endColumn - r.startColumn + 1;
|
|
2536
2534
|
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2537
|
-
const
|
|
2538
|
-
r.startColumn <=
|
|
2535
|
+
const l = u.getRange();
|
|
2536
|
+
r.startColumn <= l.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2539
2537
|
newRange: {
|
|
2540
|
-
...
|
|
2541
|
-
startColumn:
|
|
2542
|
-
endColumn:
|
|
2538
|
+
...l,
|
|
2539
|
+
startColumn: l.startColumn + a,
|
|
2540
|
+
endColumn: l.endColumn + a
|
|
2543
2541
|
}
|
|
2544
2542
|
});
|
|
2545
2543
|
});
|
|
2546
|
-
} else if (t.id ===
|
|
2544
|
+
} else if (t.id === qe.id) {
|
|
2547
2545
|
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endRow - r.startRow + 1;
|
|
2548
2546
|
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2549
|
-
const
|
|
2550
|
-
r.startRow <
|
|
2547
|
+
const l = u.getRange();
|
|
2548
|
+
r.startRow < l.startRow && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2551
2549
|
newRange: {
|
|
2552
|
-
...
|
|
2553
|
-
startRow:
|
|
2554
|
-
endRow:
|
|
2550
|
+
...l,
|
|
2551
|
+
startRow: l.startRow - a,
|
|
2552
|
+
endRow: l.endRow - a
|
|
2555
2553
|
}
|
|
2556
2554
|
});
|
|
2557
2555
|
});
|
|
2558
|
-
} else if (t.id ===
|
|
2556
|
+
} else if (t.id === ke.id) {
|
|
2559
2557
|
const e = t.params, { unitId: n, subUnitId: s, range: r } = e, a = r.endColumn - r.startColumn + 1;
|
|
2560
2558
|
this._tableManager.getTablesBySubunitId(n, s).forEach((u) => {
|
|
2561
|
-
const
|
|
2562
|
-
r.startColumn <
|
|
2559
|
+
const l = u.getRange();
|
|
2560
|
+
r.startColumn < l.startColumn && this._tableManager.updateTableRange(n, u.getId(), {
|
|
2563
2561
|
newRange: {
|
|
2564
|
-
...
|
|
2565
|
-
startColumn:
|
|
2566
|
-
endColumn:
|
|
2562
|
+
...l,
|
|
2563
|
+
startColumn: l.startColumn - a,
|
|
2564
|
+
endColumn: l.endColumn - a
|
|
2567
2565
|
}
|
|
2568
2566
|
});
|
|
2569
2567
|
});
|
|
@@ -2575,7 +2573,7 @@ de = Qn([
|
|
|
2575
2573
|
H(0, p(x)),
|
|
2576
2574
|
H(1, p(gt)),
|
|
2577
2575
|
H(2, p(E)),
|
|
2578
|
-
H(3, p(
|
|
2576
|
+
H(3, p(Ee)),
|
|
2579
2577
|
H(4, p(pe)),
|
|
2580
2578
|
H(5, p(T)),
|
|
2581
2579
|
H(6, p(me))
|
|
@@ -2595,8 +2593,8 @@ let he = class extends Q {
|
|
|
2595
2593
|
registerTableChangeEvent() {
|
|
2596
2594
|
this.disposeWithMe(
|
|
2597
2595
|
this._tableManager.tableAdd$.subscribe((e) => {
|
|
2598
|
-
const { range: n, tableId: s, unitId: r, subUnitId: a, tableStyleId: o } = e, u = this._tableManager.getTable(r, s),
|
|
2599
|
-
u.setTableStyleId(
|
|
2596
|
+
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;
|
|
2597
|
+
u.setTableStyleId(l), this._sheetRangeThemeService.registerRangeThemeStyle(l, {
|
|
2600
2598
|
unitId: r,
|
|
2601
2599
|
subUnitId: a,
|
|
2602
2600
|
range: { ...n }
|
|
@@ -2605,12 +2603,12 @@ let he = class extends Q {
|
|
|
2605
2603
|
), this.disposeWithMe(
|
|
2606
2604
|
this._tableManager.tableRangeChanged$.subscribe((e) => {
|
|
2607
2605
|
const { range: n, oldRange: s, tableId: r, unitId: a, subUnitId: o } = e, u = this._tableManager.getTable(a, r);
|
|
2608
|
-
let
|
|
2609
|
-
|
|
2606
|
+
let l = u.getTableStyleId();
|
|
2607
|
+
l || (l = this._allThemes[this._defaultThemeIndex].name, u.setTableStyleId(l)), this._sheetRangeThemeService.removeRangeThemeRule(l, {
|
|
2610
2608
|
unitId: a,
|
|
2611
2609
|
subUnitId: o,
|
|
2612
2610
|
range: { ...s }
|
|
2613
|
-
}), this._sheetRangeThemeService.registerRangeThemeStyle(
|
|
2611
|
+
}), this._sheetRangeThemeService.registerRangeThemeStyle(l, {
|
|
2614
2612
|
unitId: a,
|
|
2615
2613
|
subUnitId: o,
|
|
2616
2614
|
range: { ...n }
|
|
@@ -2618,15 +2616,15 @@ let he = class extends Q {
|
|
|
2618
2616
|
})
|
|
2619
2617
|
), this.disposeWithMe(
|
|
2620
2618
|
this._tableManager.tableThemeChanged$.subscribe((e) => {
|
|
2621
|
-
const { theme: n, oldTheme: s, tableId: r, unitId: a, subUnitId: o } = e,
|
|
2619
|
+
const { theme: n, oldTheme: s, tableId: r, unitId: a, subUnitId: o } = e, l = this._tableManager.getTable(a, r).getRange();
|
|
2622
2620
|
this._sheetRangeThemeService.removeRangeThemeRule(s, {
|
|
2623
2621
|
unitId: a,
|
|
2624
2622
|
subUnitId: o,
|
|
2625
|
-
range: { ...
|
|
2623
|
+
range: { ...l }
|
|
2626
2624
|
}), this._sheetRangeThemeService.registerRangeThemeStyle(n, {
|
|
2627
2625
|
unitId: a,
|
|
2628
2626
|
subUnitId: o,
|
|
2629
|
-
range: { ...
|
|
2627
|
+
range: { ...l }
|
|
2630
2628
|
});
|
|
2631
2629
|
})
|
|
2632
2630
|
), this.disposeWithMe(
|
|
@@ -2641,8 +2639,8 @@ let he = class extends Q {
|
|
|
2641
2639
|
);
|
|
2642
2640
|
}
|
|
2643
2641
|
_initUserTableTheme() {
|
|
2644
|
-
const e = this._configService.getConfig(
|
|
2645
|
-
this._defaultThemeIndex = n, this._allThemes = s.concat(
|
|
2642
|
+
const e = this._configService.getConfig(ze) || {}, n = e.defaultThemeIndex || 0, s = e.userThemes || [];
|
|
2643
|
+
this._defaultThemeIndex = n, this._allThemes = s.concat(je);
|
|
2646
2644
|
}
|
|
2647
2645
|
_initDefaultTableTheme() {
|
|
2648
2646
|
for (let e = 0; e < this._allThemes.length; e++) {
|
|
@@ -2657,8 +2655,8 @@ let he = class extends Q {
|
|
|
2657
2655
|
he = Gn([
|
|
2658
2656
|
oe(0, p(T)),
|
|
2659
2657
|
oe(1, p(Rt)),
|
|
2660
|
-
oe(2, p(
|
|
2661
|
-
oe(3,
|
|
2658
|
+
oe(2, p(Ve)),
|
|
2659
|
+
oe(3, Be)
|
|
2662
2660
|
], he);
|
|
2663
2661
|
var zn = Object.getOwnPropertyDescriptor, jn = (t, e, n, s) => {
|
|
2664
2662
|
for (var r = s > 1 ? void 0 : s ? zn(e, n) : e, a = t.length - 1, o; a >= 0; a--)
|
|
@@ -2668,7 +2666,7 @@ var zn = Object.getOwnPropertyDescriptor, jn = (t, e, n, s) => {
|
|
|
2668
2666
|
let ge = class extends Q {
|
|
2669
2667
|
constructor(e, n, s, r) {
|
|
2670
2668
|
super();
|
|
2671
|
-
b(this, "_tableFilteredOutRows$", new
|
|
2669
|
+
b(this, "_tableFilteredOutRows$", new Qe(/* @__PURE__ */ new Set()));
|
|
2672
2670
|
b(this, "tableFilteredOutRows$", this._tableFilteredOutRows$.asObservable());
|
|
2673
2671
|
b(this, "_subscription", null);
|
|
2674
2672
|
this._tableManager = e, this._sheetInterceptorService = n, this._univerInstanceService = s, this._zebraCrossingCacheController = r, this.registerFilterChangeEvent(), this.initTableHiddenRowIntercept(), this._initFilteredOutRows();
|
|
@@ -2680,7 +2678,7 @@ let ge = class extends Q {
|
|
|
2680
2678
|
this._tableFilteredOutRows$.next(e);
|
|
2681
2679
|
}
|
|
2682
2680
|
initTableHiddenRowIntercept() {
|
|
2683
|
-
this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
2681
|
+
this.disposeWithMe(this._sheetInterceptorService.intercept(Le.ROW_FILTERED, {
|
|
2684
2682
|
// 这里需要保证优先级高于sheet的筛选,因为筛选没有next,低于筛选的不会触发interceptor
|
|
2685
2683
|
priority: 100,
|
|
2686
2684
|
handler: (e, n, s) => {
|
|
@@ -2713,8 +2711,8 @@ let ge = class extends Q {
|
|
|
2713
2711
|
registerFilterChangeEvent() {
|
|
2714
2712
|
this.disposeWithMe(
|
|
2715
2713
|
this._tableManager.tableFilterChanged$.subscribe((e) => {
|
|
2716
|
-
var
|
|
2717
|
-
const { unitId: n, subUnitId: s, tableId: r } = e, a = (
|
|
2714
|
+
var i;
|
|
2715
|
+
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);
|
|
2718
2716
|
if (!a || !o)
|
|
2719
2717
|
return;
|
|
2720
2718
|
this.tableFilteredOutRows.clear(), o.getTableFilters().doFilter(a, o.getTableFilterRange()), this._tableManager.getTablesBySubunitId(n, s).forEach((h) => {
|
|
@@ -2750,7 +2748,7 @@ let $e = (le = class extends it {
|
|
|
2750
2748
|
ye,
|
|
2751
2749
|
this._config
|
|
2752
2750
|
);
|
|
2753
|
-
this._configService.setConfig(
|
|
2751
|
+
this._configService.setConfig(ze, r), this._initRegisterCommand();
|
|
2754
2752
|
}
|
|
2755
2753
|
onStarting() {
|
|
2756
2754
|
ut(this._injector, [
|
|
@@ -2793,10 +2791,10 @@ let $e = (le = class extends it {
|
|
|
2793
2791
|
Pn
|
|
2794
2792
|
].forEach((t) => this._commandService.registerCommand(t));
|
|
2795
2793
|
}
|
|
2796
|
-
}, b(le, "pluginName",
|
|
2794
|
+
}, b(le, "pluginName", Ze), b(le, "type", z.UNIVER_SHEET), le);
|
|
2797
2795
|
$e = Xn([
|
|
2798
|
-
Re(1, p(
|
|
2799
|
-
Re(2,
|
|
2796
|
+
Re(1, p(Ee)),
|
|
2797
|
+
Re(2, Be),
|
|
2800
2798
|
Re(3, p(x))
|
|
2801
2799
|
], $e);
|
|
2802
2800
|
export {
|
|
@@ -2819,7 +2817,7 @@ export {
|
|
|
2819
2817
|
P as SheetsTableButtonStateEnum,
|
|
2820
2818
|
W as SheetsTableController,
|
|
2821
2819
|
G as SheetsTableSortStateEnum,
|
|
2822
|
-
|
|
2820
|
+
Ye as TableColumnDataTypeEnum,
|
|
2823
2821
|
ne as TableColumnFilterTypeEnum,
|
|
2824
2822
|
O as TableConditionTypeEnum,
|
|
2825
2823
|
m as TableDateCompareTypeEnum,
|