@univerjs/sheets-table 0.10.1 → 0.10.2-nightly.202508080617
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 +61 -44
- package/lib/es/index.js +368 -339
- package/lib/facade.js +61 -44
- package/lib/index.js +368 -339
- package/lib/types/facade/f-worksheet.d.ts +4 -4
- package/lib/types/model/filter-util/condition.d.ts +1 -1
- package/lib/types/services/table-service.d.ts +1 -1
- package/lib/types/types/type.d.ts +8 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -176
package/lib/facade.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { RangeThemeStyle as
|
|
5
|
-
import { FEnum as
|
|
6
|
-
class
|
|
1
|
+
import { LocaleService as h, IUniverInstanceService as y, UniverInstanceType as x, customNameCharacterCheck as g, ILogService as u, cellToRange as F, Rectangle as N } from "@univerjs/core";
|
|
2
|
+
import { SheetTableService as l, AddSheetTableCommand as k, DeleteSheetTableCommand as C, SetSheetTableFilterCommand as T, SetSheetTableCommand as f, AddTableThemeCommand as U, TableColumnFilterTypeEnum as W, TableConditionTypeEnum as j, TableNumberCompareTypeEnum as w, TableStringCompareTypeEnum as L, TableDateCompareTypeEnum as R } from "@univerjs/sheets-table";
|
|
3
|
+
import { FWorkbook as _, FWorksheet as p } from "@univerjs/sheets/facade";
|
|
4
|
+
import { RangeThemeStyle as P } from "@univerjs/sheets";
|
|
5
|
+
import { FEnum as E } from "@univerjs/core/facade";
|
|
6
|
+
class V extends _ {
|
|
7
7
|
getTableInfo(e) {
|
|
8
8
|
const t = this.getId();
|
|
9
|
-
return this._injector.get(
|
|
9
|
+
return this._injector.get(l).getTableInfo(t, e);
|
|
10
10
|
}
|
|
11
11
|
getTableList() {
|
|
12
12
|
const e = this.getId();
|
|
13
|
-
return this._injector.get(
|
|
14
|
-
}
|
|
15
|
-
async addTable(e, t, n, i,
|
|
16
|
-
var
|
|
17
|
-
const
|
|
13
|
+
return this._injector.get(l).getTableList(e);
|
|
14
|
+
}
|
|
15
|
+
async addTable(e, t, n, i, a) {
|
|
16
|
+
var v;
|
|
17
|
+
const o = this._injector.get(l), r = this._injector.get(h), c = this._injector.get(y).getCurrentUnitOfType(x.UNIVER_SHEET), b = /* @__PURE__ */ new Set();
|
|
18
|
+
if (c && c.getSheets().forEach((m) => {
|
|
19
|
+
b.add(m.getName());
|
|
20
|
+
}), !g(t, b)) {
|
|
21
|
+
this._injector.get(u).warn(r.t("sheets-table.tableNameError"));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const d = {
|
|
18
25
|
unitId: this.getId(),
|
|
19
26
|
name: t,
|
|
20
27
|
subUnitId: e,
|
|
21
28
|
range: n,
|
|
22
|
-
options:
|
|
29
|
+
options: a,
|
|
23
30
|
id: i
|
|
24
31
|
};
|
|
25
|
-
if (await this._commandService.executeCommand(
|
|
26
|
-
return (
|
|
32
|
+
if (await this._commandService.executeCommand(k.id, d))
|
|
33
|
+
return (v = o.getTableList(this.getId()).find((m) => m.name === t)) == null ? void 0 : v.id;
|
|
27
34
|
}
|
|
28
35
|
async removeTable(e) {
|
|
29
36
|
var i;
|
|
@@ -35,7 +42,7 @@ class W extends h {
|
|
|
35
42
|
subUnitId: t,
|
|
36
43
|
tableId: e
|
|
37
44
|
};
|
|
38
|
-
return this._commandService.executeCommand(
|
|
45
|
+
return this._commandService.executeCommand(C.id, n);
|
|
39
46
|
}
|
|
40
47
|
getTableInfoByName(e) {
|
|
41
48
|
return this.getTableList().find((n) => n.name === e);
|
|
@@ -47,21 +54,26 @@ class W extends h {
|
|
|
47
54
|
column: t,
|
|
48
55
|
tableFilter: n
|
|
49
56
|
};
|
|
50
|
-
return this._commandService.executeCommand(
|
|
57
|
+
return this._commandService.executeCommand(T.id, i);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
class
|
|
60
|
+
_.extend(V);
|
|
61
|
+
class D extends p {
|
|
55
62
|
addTable(e, t, n, i) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
const a = this.getSheetId(), o = this.getWorkbook(), r = o.getUnitId(), s = this._injector.get(h), c = /* @__PURE__ */ new Set();
|
|
64
|
+
if (o && o.getSheets().forEach((d) => {
|
|
65
|
+
c.add(d.getName());
|
|
66
|
+
}), !g(e, c))
|
|
67
|
+
return this._injector.get(u).warn(s.t("sheets-table.tableNameError")), !1;
|
|
68
|
+
const I = {
|
|
69
|
+
unitId: r,
|
|
70
|
+
subUnitId: a,
|
|
59
71
|
name: e,
|
|
60
72
|
range: t,
|
|
61
73
|
id: n,
|
|
62
74
|
options: i
|
|
63
75
|
};
|
|
64
|
-
return this._commandService.executeCommand(
|
|
76
|
+
return this._commandService.executeCommand(k.id, I);
|
|
65
77
|
}
|
|
66
78
|
setTableFilter(e, t, n) {
|
|
67
79
|
const i = {
|
|
@@ -70,7 +82,7 @@ class E extends g {
|
|
|
70
82
|
column: t,
|
|
71
83
|
tableFilter: n
|
|
72
84
|
};
|
|
73
|
-
return this._commandService.executeCommand(
|
|
85
|
+
return this._commandService.executeCommand(T.id, i);
|
|
74
86
|
}
|
|
75
87
|
removeTable(e) {
|
|
76
88
|
const t = {
|
|
@@ -78,7 +90,7 @@ class E extends g {
|
|
|
78
90
|
subUnitId: this.getSheetId(),
|
|
79
91
|
tableId: e
|
|
80
92
|
};
|
|
81
|
-
return this._commandService.executeCommand(
|
|
93
|
+
return this._commandService.executeCommand(C.id, t);
|
|
82
94
|
}
|
|
83
95
|
setTableRange(e, t) {
|
|
84
96
|
const n = {
|
|
@@ -88,19 +100,24 @@ class E extends g {
|
|
|
88
100
|
newRange: t
|
|
89
101
|
}
|
|
90
102
|
};
|
|
91
|
-
return this._commandService.executeCommand(
|
|
103
|
+
return this._commandService.executeCommand(f.id, n);
|
|
92
104
|
}
|
|
93
105
|
setTableName(e, t) {
|
|
94
|
-
const n =
|
|
106
|
+
const n = this.getWorkbook(), i = this._injector.get(h), a = /* @__PURE__ */ new Set();
|
|
107
|
+
if (n && n.getSheets().forEach((s) => {
|
|
108
|
+
a.add(s.getName());
|
|
109
|
+
}), !g(t, a))
|
|
110
|
+
return this._injector.get(u).warn(i.t("sheets-table.tableNameError")), !1;
|
|
111
|
+
const r = {
|
|
95
112
|
unitId: this.getWorkbook().getUnitId(),
|
|
96
113
|
tableId: e,
|
|
97
114
|
name: t
|
|
98
115
|
};
|
|
99
|
-
return this._commandService.executeCommand(
|
|
116
|
+
return this._commandService.executeCommand(f.id, r);
|
|
100
117
|
}
|
|
101
118
|
getSubTableInfos() {
|
|
102
119
|
const e = this._fWorkbook.getId();
|
|
103
|
-
return this._injector.get(
|
|
120
|
+
return this._injector.get(l).getTableList(e).filter((n) => n.subUnitId === this.getSheetId());
|
|
104
121
|
}
|
|
105
122
|
resetFilter(e, t) {
|
|
106
123
|
const n = {
|
|
@@ -109,40 +126,40 @@ class E extends g {
|
|
|
109
126
|
column: t,
|
|
110
127
|
tableFilter: void 0
|
|
111
128
|
};
|
|
112
|
-
return this._commandService.executeCommand(
|
|
129
|
+
return this._commandService.executeCommand(T.id, n);
|
|
113
130
|
}
|
|
114
131
|
getTableByCell(e, t) {
|
|
115
|
-
const n = this._fWorkbook.getId(),
|
|
116
|
-
return
|
|
117
|
-
const
|
|
118
|
-
return
|
|
132
|
+
const n = this._fWorkbook.getId(), a = this._injector.get(l).getTableList(n).filter((r) => r.subUnitId === this.getSheetId()), o = F(e, t);
|
|
133
|
+
return a.find((r) => {
|
|
134
|
+
const s = r.range;
|
|
135
|
+
return N.intersects(s, o);
|
|
119
136
|
});
|
|
120
137
|
}
|
|
121
138
|
addTableTheme(e, t) {
|
|
122
|
-
const n = new
|
|
123
|
-
return n.fromJson(t), this._commandService.executeCommand(
|
|
139
|
+
const n = new P("table-style");
|
|
140
|
+
return n.fromJson(t), this._commandService.executeCommand(U.id, {
|
|
124
141
|
unitId: this._fWorkbook.getId(),
|
|
125
142
|
tableId: e,
|
|
126
143
|
themeStyle: n
|
|
127
144
|
});
|
|
128
145
|
}
|
|
129
146
|
}
|
|
130
|
-
|
|
131
|
-
class
|
|
147
|
+
p.extend(D);
|
|
148
|
+
class A extends E {
|
|
132
149
|
get TableColumnFilterTypeEnum() {
|
|
133
|
-
return
|
|
150
|
+
return W;
|
|
134
151
|
}
|
|
135
152
|
get TableConditionTypeEnum() {
|
|
136
|
-
return
|
|
153
|
+
return j;
|
|
137
154
|
}
|
|
138
155
|
get TableNumberCompareTypeEnum() {
|
|
139
|
-
return
|
|
156
|
+
return w;
|
|
140
157
|
}
|
|
141
158
|
get TableStringCompareTypeEnum() {
|
|
142
|
-
return
|
|
159
|
+
return L;
|
|
143
160
|
}
|
|
144
161
|
get TableDateCompareTypeEnum() {
|
|
145
|
-
return
|
|
162
|
+
return R;
|
|
146
163
|
}
|
|
147
164
|
}
|
|
148
|
-
|
|
165
|
+
E.extend(A);
|