@univerjs/sheets-table 0.7.0-nightly.202505161607 → 0.7.0-nightly.202505171606
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/es/facade.js +113 -32
- package/lib/facade.js +113 -32
- package/lib/types/facade/f-enum.d.ts +23 -0
- package/lib/types/facade/f-workbook.d.ts +107 -31
- package/lib/types/facade/f-worksheet.d.ts +276 -5
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/package.json +3 -3
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const a=require("@univerjs/sheets-table"),d=require("@univerjs/sheets/facade"),c=require("@univerjs/core"),h=require("@univerjs/sheets"),T=require("@univerjs/core/facade");class g extends d.FWorkbook{getTableInfo(e){const t=this.getId();return this._injector.get(a.SheetTableService).getTableInfo(t,e)}getTableList(){const e=this.getId();return this._injector.get(a.SheetTableService).getTableList(e)}async addTable(e,t,n,i,o){var b;const s=this._injector.get(a.SheetTableService),r={unitId:this.getId(),name:t,subUnitId:e,range:n,options:o,id:i};if(await this._commandService.executeCommand(a.AddSheetTableCommand.id,r))return(b=s.getTableList(this.getId()).find(u=>u.name===t))==null?void 0:b.id}async removeTable(e){var i;const t=(i=this.getTableInfo(e))==null?void 0:i.subUnitId;if(!t)return!1;const n={unitId:this.getId(),subUnitId:t,tableId:e};return this._commandService.executeCommand(a.DeleteSheetTableCommand.id,n)}getTableInfoByName(e){return this.getTableList().find(n=>n.name===e)}setTableFilter(e,t,n){const i={unitId:this.getId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(a.SetSheetTableFilterCommand.id,i)}}d.FWorkbook.extend(g);class S extends d.FWorksheet{addTable(e,t,n,i){const o=this.getSheetId(),r={unitId:this.getWorkbook().getUnitId(),subUnitId:o,name:e,range:t,id:n,options:i};return this._commandService.executeCommand(a.AddSheetTableCommand.id,r)}setTableFilter(e,t,n){const i={unitId:this.getWorkbook().getUnitId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(a.SetSheetTableFilterCommand.id,i)}removeTable(e){const t={unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),tableId:e};return this._commandService.executeCommand(a.DeleteSheetTableCommand.id,t)}setTableRange(e,t){const n={unitId:this.getWorkbook().getUnitId(),tableId:e,updateRange:{newRange:t}};return this._commandService.executeCommand(a.SetSheetTableCommand.id,n)}setTableName(e,t){const n={unitId:this.getWorkbook().getUnitId(),tableId:e,name:t};return this._commandService.executeCommand(a.SetSheetTableCommand.id,n)}getSubTableInfos(){const e=this._fWorkbook.getId();return this._injector.get(a.SheetTableService).getTableList(e).filter(n=>n.subUnitId===this.getSheetId())}resetFilter(e,t){const n={unitId:this._fWorkbook.getId(),tableId:e,column:t,tableFilter:void 0};return this._commandService.executeCommand(a.SetSheetTableFilterCommand.id,n)}getTableByCell(e,t){const n=this._fWorkbook.getId(),o=this._injector.get(a.SheetTableService).getTableList(n).filter(r=>r.subUnitId===this.getSheetId()),s=c.cellToRange(e,t);return o.find(r=>{const m=r.range;return c.Rectangle.intersects(m,s)})}addTableTheme(e,t){const n=new h.RangeThemeStyle("table-style");return n.fromJson(t),this._commandService.executeCommand(a.AddTableThemeCommand.id,{unitId:this._fWorkbook.getId(),tableId:e,themeStyle:n})}}d.FWorksheet.extend(S);class I extends T.FEnum{get TableColumnFilterTypeEnum(){return a.TableColumnFilterTypeEnum}get TableConditionTypeEnum(){return a.TableConditionTypeEnum}get TableNumberCompareTypeEnum(){return a.TableNumberCompareTypeEnum}get TableStringCompareTypeEnum(){return a.TableStringCompareTypeEnum}get TableDateCompareTypeEnum(){return a.TableDateCompareTypeEnum}}T.FEnum.extend(I);
|
package/lib/es/facade.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SheetTableService as o, AddSheetTableCommand as
|
|
2
|
-
import { FWorkbook as
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { SheetTableService as o, AddSheetTableCommand as u, DeleteSheetTableCommand as T, SetSheetTableFilterCommand as d, SetSheetTableCommand as c, AddTableThemeCommand as C, TableColumnFilterTypeEnum as f, TableConditionTypeEnum as v, TableNumberCompareTypeEnum as k, TableStringCompareTypeEnum as p, TableDateCompareTypeEnum as _ } from "@univerjs/sheets-table";
|
|
2
|
+
import { FWorkbook as h, FWorksheet as g } from "@univerjs/sheets/facade";
|
|
3
|
+
import { cellToRange as x, Rectangle as y } from "@univerjs/core";
|
|
4
|
+
import { RangeThemeStyle as F } from "@univerjs/sheets";
|
|
5
|
+
import { FEnum as I } from "@univerjs/core/facade";
|
|
6
|
+
class W extends h {
|
|
5
7
|
getTableInfo(e) {
|
|
6
8
|
const t = this.getId();
|
|
7
9
|
return this._injector.get(o).getTableInfo(t, e);
|
|
@@ -10,58 +12,137 @@ class v extends m {
|
|
|
10
12
|
const e = this.getId();
|
|
11
13
|
return this._injector.get(o).getTableList(e);
|
|
12
14
|
}
|
|
13
|
-
async addTable(e, t,
|
|
14
|
-
var
|
|
15
|
-
const
|
|
15
|
+
async addTable(e, t, n, i, r) {
|
|
16
|
+
var b;
|
|
17
|
+
const s = this._injector.get(o), a = {
|
|
16
18
|
unitId: this.getId(),
|
|
17
19
|
name: t,
|
|
18
20
|
subUnitId: e,
|
|
19
|
-
range:
|
|
20
|
-
options:
|
|
21
|
-
|
|
21
|
+
range: n,
|
|
22
|
+
options: r,
|
|
23
|
+
id: i
|
|
22
24
|
};
|
|
23
|
-
if (await this._commandService.executeCommand(
|
|
24
|
-
return (
|
|
25
|
+
if (await this._commandService.executeCommand(u.id, a))
|
|
26
|
+
return (b = s.getTableList(this.getId()).find((S) => S.name === t)) == null ? void 0 : b.id;
|
|
25
27
|
}
|
|
26
28
|
async removeTable(e) {
|
|
27
|
-
var
|
|
28
|
-
const t = (
|
|
29
|
+
var i;
|
|
30
|
+
const t = (i = this.getTableInfo(e)) == null ? void 0 : i.subUnitId;
|
|
29
31
|
if (!t)
|
|
30
32
|
return !1;
|
|
31
|
-
const
|
|
33
|
+
const n = {
|
|
32
34
|
unitId: this.getId(),
|
|
33
35
|
subUnitId: t,
|
|
34
36
|
tableId: e
|
|
35
37
|
};
|
|
36
|
-
return this._commandService.executeCommand(
|
|
38
|
+
return this._commandService.executeCommand(T.id, n);
|
|
37
39
|
}
|
|
38
40
|
getTableInfoByName(e) {
|
|
39
|
-
return this.getTableList().find((
|
|
41
|
+
return this.getTableList().find((n) => n.name === e);
|
|
40
42
|
}
|
|
41
|
-
setTableFilter(e, t,
|
|
42
|
-
const
|
|
43
|
+
setTableFilter(e, t, n) {
|
|
44
|
+
const i = {
|
|
43
45
|
unitId: this.getId(),
|
|
44
46
|
tableId: e,
|
|
45
47
|
column: t,
|
|
46
|
-
tableFilter:
|
|
48
|
+
tableFilter: n
|
|
47
49
|
};
|
|
48
|
-
return this._commandService.executeCommand(
|
|
50
|
+
return this._commandService.executeCommand(d.id, i);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
class
|
|
53
|
-
addTable(e, t,
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
h.extend(W);
|
|
54
|
+
class E extends g {
|
|
55
|
+
addTable(e, t, n, i) {
|
|
56
|
+
const r = this.getSheetId(), a = {
|
|
57
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
58
|
+
subUnitId: r,
|
|
59
|
+
name: e,
|
|
60
|
+
range: t,
|
|
61
|
+
id: n,
|
|
62
|
+
options: i
|
|
63
|
+
};
|
|
64
|
+
return this._commandService.executeCommand(u.id, a);
|
|
65
|
+
}
|
|
66
|
+
setTableFilter(e, t, n) {
|
|
67
|
+
const i = {
|
|
59
68
|
unitId: this.getWorkbook().getUnitId(),
|
|
60
69
|
tableId: e,
|
|
61
70
|
column: t,
|
|
62
|
-
tableFilter:
|
|
71
|
+
tableFilter: n
|
|
72
|
+
};
|
|
73
|
+
return this._commandService.executeCommand(d.id, i);
|
|
74
|
+
}
|
|
75
|
+
removeTable(e) {
|
|
76
|
+
const t = {
|
|
77
|
+
unitId: this._fWorkbook.getId(),
|
|
78
|
+
subUnitId: this.getSheetId(),
|
|
79
|
+
tableId: e
|
|
80
|
+
};
|
|
81
|
+
return this._commandService.executeCommand(T.id, t);
|
|
82
|
+
}
|
|
83
|
+
setTableRange(e, t) {
|
|
84
|
+
const n = {
|
|
85
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
86
|
+
tableId: e,
|
|
87
|
+
updateRange: {
|
|
88
|
+
newRange: t
|
|
89
|
+
}
|
|
63
90
|
};
|
|
64
|
-
return this._commandService.executeCommand(
|
|
91
|
+
return this._commandService.executeCommand(c.id, n);
|
|
92
|
+
}
|
|
93
|
+
setTableName(e, t) {
|
|
94
|
+
const n = {
|
|
95
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
96
|
+
tableId: e,
|
|
97
|
+
name: t
|
|
98
|
+
};
|
|
99
|
+
return this._commandService.executeCommand(c.id, n);
|
|
100
|
+
}
|
|
101
|
+
getSubTableInfos() {
|
|
102
|
+
const e = this._fWorkbook.getId();
|
|
103
|
+
return this._injector.get(o).getTableList(e).filter((n) => n.subUnitId === this.getSheetId());
|
|
104
|
+
}
|
|
105
|
+
resetFilter(e, t) {
|
|
106
|
+
const n = {
|
|
107
|
+
unitId: this._fWorkbook.getId(),
|
|
108
|
+
tableId: e,
|
|
109
|
+
column: t,
|
|
110
|
+
tableFilter: void 0
|
|
111
|
+
};
|
|
112
|
+
return this._commandService.executeCommand(d.id, n);
|
|
113
|
+
}
|
|
114
|
+
getTableByCell(e, t) {
|
|
115
|
+
const n = this._fWorkbook.getId(), r = this._injector.get(o).getTableList(n).filter((a) => a.subUnitId === this.getSheetId()), s = x(e, t);
|
|
116
|
+
return r.find((a) => {
|
|
117
|
+
const l = a.range;
|
|
118
|
+
return y.intersects(l, s);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
addTableTheme(e, t) {
|
|
122
|
+
const n = new F("table-style");
|
|
123
|
+
return n.fromJson(t), this._commandService.executeCommand(C.id, {
|
|
124
|
+
unitId: this._fWorkbook.getId(),
|
|
125
|
+
tableId: e,
|
|
126
|
+
themeStyle: n
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
g.extend(E);
|
|
131
|
+
class U extends I {
|
|
132
|
+
get TableColumnFilterTypeEnum() {
|
|
133
|
+
return f;
|
|
134
|
+
}
|
|
135
|
+
get TableConditionTypeEnum() {
|
|
136
|
+
return v;
|
|
137
|
+
}
|
|
138
|
+
get TableNumberCompareTypeEnum() {
|
|
139
|
+
return k;
|
|
140
|
+
}
|
|
141
|
+
get TableStringCompareTypeEnum() {
|
|
142
|
+
return p;
|
|
143
|
+
}
|
|
144
|
+
get TableDateCompareTypeEnum() {
|
|
145
|
+
return _;
|
|
65
146
|
}
|
|
66
147
|
}
|
|
67
|
-
|
|
148
|
+
I.extend(U);
|
package/lib/facade.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SheetTableService as o, AddSheetTableCommand as
|
|
2
|
-
import { FWorkbook as
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { SheetTableService as o, AddSheetTableCommand as u, DeleteSheetTableCommand as T, SetSheetTableFilterCommand as d, SetSheetTableCommand as c, AddTableThemeCommand as C, TableColumnFilterTypeEnum as f, TableConditionTypeEnum as v, TableNumberCompareTypeEnum as k, TableStringCompareTypeEnum as p, TableDateCompareTypeEnum as _ } from "@univerjs/sheets-table";
|
|
2
|
+
import { FWorkbook as h, FWorksheet as g } from "@univerjs/sheets/facade";
|
|
3
|
+
import { cellToRange as x, Rectangle as y } from "@univerjs/core";
|
|
4
|
+
import { RangeThemeStyle as F } from "@univerjs/sheets";
|
|
5
|
+
import { FEnum as I } from "@univerjs/core/facade";
|
|
6
|
+
class W extends h {
|
|
5
7
|
getTableInfo(e) {
|
|
6
8
|
const t = this.getId();
|
|
7
9
|
return this._injector.get(o).getTableInfo(t, e);
|
|
@@ -10,58 +12,137 @@ class v extends m {
|
|
|
10
12
|
const e = this.getId();
|
|
11
13
|
return this._injector.get(o).getTableList(e);
|
|
12
14
|
}
|
|
13
|
-
async addTable(e, t,
|
|
14
|
-
var
|
|
15
|
-
const
|
|
15
|
+
async addTable(e, t, n, i, r) {
|
|
16
|
+
var b;
|
|
17
|
+
const s = this._injector.get(o), a = {
|
|
16
18
|
unitId: this.getId(),
|
|
17
19
|
name: t,
|
|
18
20
|
subUnitId: e,
|
|
19
|
-
range:
|
|
20
|
-
options:
|
|
21
|
-
|
|
21
|
+
range: n,
|
|
22
|
+
options: r,
|
|
23
|
+
id: i
|
|
22
24
|
};
|
|
23
|
-
if (await this._commandService.executeCommand(
|
|
24
|
-
return (
|
|
25
|
+
if (await this._commandService.executeCommand(u.id, a))
|
|
26
|
+
return (b = s.getTableList(this.getId()).find((S) => S.name === t)) == null ? void 0 : b.id;
|
|
25
27
|
}
|
|
26
28
|
async removeTable(e) {
|
|
27
|
-
var
|
|
28
|
-
const t = (
|
|
29
|
+
var i;
|
|
30
|
+
const t = (i = this.getTableInfo(e)) == null ? void 0 : i.subUnitId;
|
|
29
31
|
if (!t)
|
|
30
32
|
return !1;
|
|
31
|
-
const
|
|
33
|
+
const n = {
|
|
32
34
|
unitId: this.getId(),
|
|
33
35
|
subUnitId: t,
|
|
34
36
|
tableId: e
|
|
35
37
|
};
|
|
36
|
-
return this._commandService.executeCommand(
|
|
38
|
+
return this._commandService.executeCommand(T.id, n);
|
|
37
39
|
}
|
|
38
40
|
getTableInfoByName(e) {
|
|
39
|
-
return this.getTableList().find((
|
|
41
|
+
return this.getTableList().find((n) => n.name === e);
|
|
40
42
|
}
|
|
41
|
-
setTableFilter(e, t,
|
|
42
|
-
const
|
|
43
|
+
setTableFilter(e, t, n) {
|
|
44
|
+
const i = {
|
|
43
45
|
unitId: this.getId(),
|
|
44
46
|
tableId: e,
|
|
45
47
|
column: t,
|
|
46
|
-
tableFilter:
|
|
48
|
+
tableFilter: n
|
|
47
49
|
};
|
|
48
|
-
return this._commandService.executeCommand(
|
|
50
|
+
return this._commandService.executeCommand(d.id, i);
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
class
|
|
53
|
-
addTable(e, t,
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
h.extend(W);
|
|
54
|
+
class E extends g {
|
|
55
|
+
addTable(e, t, n, i) {
|
|
56
|
+
const r = this.getSheetId(), a = {
|
|
57
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
58
|
+
subUnitId: r,
|
|
59
|
+
name: e,
|
|
60
|
+
range: t,
|
|
61
|
+
id: n,
|
|
62
|
+
options: i
|
|
63
|
+
};
|
|
64
|
+
return this._commandService.executeCommand(u.id, a);
|
|
65
|
+
}
|
|
66
|
+
setTableFilter(e, t, n) {
|
|
67
|
+
const i = {
|
|
59
68
|
unitId: this.getWorkbook().getUnitId(),
|
|
60
69
|
tableId: e,
|
|
61
70
|
column: t,
|
|
62
|
-
tableFilter:
|
|
71
|
+
tableFilter: n
|
|
72
|
+
};
|
|
73
|
+
return this._commandService.executeCommand(d.id, i);
|
|
74
|
+
}
|
|
75
|
+
removeTable(e) {
|
|
76
|
+
const t = {
|
|
77
|
+
unitId: this._fWorkbook.getId(),
|
|
78
|
+
subUnitId: this.getSheetId(),
|
|
79
|
+
tableId: e
|
|
80
|
+
};
|
|
81
|
+
return this._commandService.executeCommand(T.id, t);
|
|
82
|
+
}
|
|
83
|
+
setTableRange(e, t) {
|
|
84
|
+
const n = {
|
|
85
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
86
|
+
tableId: e,
|
|
87
|
+
updateRange: {
|
|
88
|
+
newRange: t
|
|
89
|
+
}
|
|
63
90
|
};
|
|
64
|
-
return this._commandService.executeCommand(
|
|
91
|
+
return this._commandService.executeCommand(c.id, n);
|
|
92
|
+
}
|
|
93
|
+
setTableName(e, t) {
|
|
94
|
+
const n = {
|
|
95
|
+
unitId: this.getWorkbook().getUnitId(),
|
|
96
|
+
tableId: e,
|
|
97
|
+
name: t
|
|
98
|
+
};
|
|
99
|
+
return this._commandService.executeCommand(c.id, n);
|
|
100
|
+
}
|
|
101
|
+
getSubTableInfos() {
|
|
102
|
+
const e = this._fWorkbook.getId();
|
|
103
|
+
return this._injector.get(o).getTableList(e).filter((n) => n.subUnitId === this.getSheetId());
|
|
104
|
+
}
|
|
105
|
+
resetFilter(e, t) {
|
|
106
|
+
const n = {
|
|
107
|
+
unitId: this._fWorkbook.getId(),
|
|
108
|
+
tableId: e,
|
|
109
|
+
column: t,
|
|
110
|
+
tableFilter: void 0
|
|
111
|
+
};
|
|
112
|
+
return this._commandService.executeCommand(d.id, n);
|
|
113
|
+
}
|
|
114
|
+
getTableByCell(e, t) {
|
|
115
|
+
const n = this._fWorkbook.getId(), r = this._injector.get(o).getTableList(n).filter((a) => a.subUnitId === this.getSheetId()), s = x(e, t);
|
|
116
|
+
return r.find((a) => {
|
|
117
|
+
const l = a.range;
|
|
118
|
+
return y.intersects(l, s);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
addTableTheme(e, t) {
|
|
122
|
+
const n = new F("table-style");
|
|
123
|
+
return n.fromJson(t), this._commandService.executeCommand(C.id, {
|
|
124
|
+
unitId: this._fWorkbook.getId(),
|
|
125
|
+
tableId: e,
|
|
126
|
+
themeStyle: n
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
g.extend(E);
|
|
131
|
+
class U extends I {
|
|
132
|
+
get TableColumnFilterTypeEnum() {
|
|
133
|
+
return f;
|
|
134
|
+
}
|
|
135
|
+
get TableConditionTypeEnum() {
|
|
136
|
+
return v;
|
|
137
|
+
}
|
|
138
|
+
get TableNumberCompareTypeEnum() {
|
|
139
|
+
return k;
|
|
140
|
+
}
|
|
141
|
+
get TableStringCompareTypeEnum() {
|
|
142
|
+
return p;
|
|
143
|
+
}
|
|
144
|
+
get TableDateCompareTypeEnum() {
|
|
145
|
+
return _;
|
|
65
146
|
}
|
|
66
147
|
}
|
|
67
|
-
|
|
148
|
+
I.extend(U);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FEnum } from '@univerjs/core/facade';
|
|
2
|
+
import { TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from '@univerjs/sheets-table';
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface ITableEnumMixin {
|
|
7
|
+
TableColumnFilterTypeEnum: typeof TableColumnFilterTypeEnum;
|
|
8
|
+
TableConditionTypeEnum: typeof TableConditionTypeEnum;
|
|
9
|
+
TableNumberCompareTypeEnum: typeof TableNumberCompareTypeEnum;
|
|
10
|
+
TableStringCompareTypeEnum: typeof TableStringCompareTypeEnum;
|
|
11
|
+
TableDateCompareTypeEnum: typeof TableDateCompareTypeEnum;
|
|
12
|
+
}
|
|
13
|
+
export declare class TableEnum extends FEnum implements ITableEnumMixin {
|
|
14
|
+
get TableColumnFilterTypeEnum(): typeof TableColumnFilterTypeEnum;
|
|
15
|
+
get TableConditionTypeEnum(): typeof TableConditionTypeEnum;
|
|
16
|
+
get TableNumberCompareTypeEnum(): typeof TableNumberCompareTypeEnum;
|
|
17
|
+
get TableStringCompareTypeEnum(): typeof TableStringCompareTypeEnum;
|
|
18
|
+
get TableDateCompareTypeEnum(): typeof TableDateCompareTypeEnum;
|
|
19
|
+
}
|
|
20
|
+
declare module '@univerjs/core/facade' {
|
|
21
|
+
interface FEnum extends ITableEnumMixin {
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -12,20 +12,41 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
14
14
|
* const fSheet = fWorkbook.getActiveSheet();
|
|
15
|
-
* const
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
*
|
|
15
|
+
* const subUnitId = fSheet.getSheetId();
|
|
16
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1', {
|
|
17
|
+
* startRow: 1,
|
|
18
|
+
* startColumn: 1,
|
|
19
|
+
* endRow: 10,
|
|
20
|
+
* endColumn: 5,
|
|
21
|
+
* }, 'id-1', {
|
|
22
|
+
* showHeader: true
|
|
23
|
+
* })
|
|
24
|
+
* const tableInfo = fWorkbook.getTableInfo(id);
|
|
25
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
getTableInfo(tableId: string): ITableInfoWithUnitId | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Get table information by name
|
|
31
|
+
* @param tableName The table name
|
|
32
|
+
* @returns {ITableInfo} The table information
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
36
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
37
|
+
* const subUnitId = fSheet.getSheetId();
|
|
38
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1', {
|
|
39
|
+
* startRow: 1,
|
|
40
|
+
* startColumn: 1,
|
|
41
|
+
* endRow: 10,
|
|
42
|
+
* endColumn: 5,
|
|
43
|
+
* }, 'id-1', {
|
|
44
|
+
* showHeader: true
|
|
45
|
+
* })
|
|
46
|
+
* const tableInfo = fWorkbook.getTableInfoByName('name-1');
|
|
47
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
29
50
|
getTableInfoByName(tableName: string): ITableInfoWithUnitId | undefined;
|
|
30
51
|
/**
|
|
31
52
|
* Get table list
|
|
@@ -34,44 +55,99 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
34
55
|
* ```typescript
|
|
35
56
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
36
57
|
* const fSheet = fWorkbook.getActiveSheet();
|
|
37
|
-
* const
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* }
|
|
46
|
-
* }, { showHeader: true });
|
|
58
|
+
* const subUnitId = fSheet.getSheetId();
|
|
59
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1',{
|
|
60
|
+
* startRow: 1,
|
|
61
|
+
* startColumn: 1,
|
|
62
|
+
* endRow: 10,
|
|
63
|
+
* endColumn: 5,
|
|
64
|
+
* }, 'id-1',{
|
|
65
|
+
* showHeader: true
|
|
66
|
+
* })
|
|
47
67
|
* const tableList = fWorkbook.getTableList(fWorkbook.getId());
|
|
68
|
+
* console.log('debugger tableList', tableList);
|
|
48
69
|
* ```
|
|
49
70
|
*/
|
|
50
71
|
getTableList(): ITableInfo[];
|
|
51
72
|
/**
|
|
52
73
|
* Add table
|
|
74
|
+
* @param {string} subUnitId The sub unit id
|
|
53
75
|
* @param {string} tableName The table name
|
|
54
76
|
* @param {ITableRange} rangeInfo The table range information
|
|
77
|
+
* @param {string} tableId The table id
|
|
55
78
|
* @param {ITableOptions} options The table options
|
|
56
79
|
* @returns {string} The table id
|
|
57
80
|
* @example
|
|
58
81
|
* ```typescript
|
|
59
82
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
60
83
|
* const fSheet = fWorkbook.getActiveSheet();
|
|
61
|
-
* const
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* }
|
|
84
|
+
* const subUnitId = fSheet.getSheetId();
|
|
85
|
+
* const unitId = fWorkbook.getId();
|
|
86
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1',{
|
|
87
|
+
* startRow: 1,
|
|
88
|
+
* startColumn: 1,
|
|
89
|
+
* endRow: 10,
|
|
90
|
+
* endColumn: 5,
|
|
91
|
+
* }, 'id-1',{
|
|
92
|
+
* showHeader: true
|
|
93
|
+
* })
|
|
94
|
+
* console.log('tableId:', id)
|
|
71
95
|
* ```
|
|
72
96
|
*/
|
|
73
97
|
addTable(subUnitId: string, tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<string | undefined>;
|
|
98
|
+
/**
|
|
99
|
+
* set table filter
|
|
100
|
+
* @param {string} tableId The table id
|
|
101
|
+
* @param {number} column The column index
|
|
102
|
+
* @param {ITableFilterItem} filter The filter item
|
|
103
|
+
* @returns {Promise<boolean>} The result of set table filter
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
107
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
108
|
+
* const subUnitId = fSheet.getSheetId();
|
|
109
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1',{
|
|
110
|
+
* startRow: 1,
|
|
111
|
+
* startColumn: 1,
|
|
112
|
+
* endRow: 10,
|
|
113
|
+
* endColumn: 5,
|
|
114
|
+
* }, 'id-1',{
|
|
115
|
+
* showHeader: true
|
|
116
|
+
* })
|
|
117
|
+
* const tableInfo = fWorkbook.getTableInfo(id);
|
|
118
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
119
|
+
* const result = await fWorkbook.setTableFilter(id, 1, {
|
|
120
|
+
* filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
|
|
121
|
+
* filterInfo: {
|
|
122
|
+
* conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
|
|
123
|
+
* compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
|
|
124
|
+
* expectedValue: 10,
|
|
125
|
+
* }
|
|
126
|
+
* })
|
|
127
|
+
*/
|
|
74
128
|
setTableFilter(tableId: string, column: number, filter: ITableFilterItem | undefined): void;
|
|
129
|
+
/**
|
|
130
|
+
* Remove table
|
|
131
|
+
* @param {string} tableId The table id
|
|
132
|
+
* @returns {boolean} The result of remove table
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
136
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
137
|
+
* const subUnitId = fSheet.getSheetId();
|
|
138
|
+
* const id = await fWorkbook.addTable(subUnitId, 'name-1', {
|
|
139
|
+
* startRow: 1,
|
|
140
|
+
* startColumn: 1,
|
|
141
|
+
* endRow: 10,
|
|
142
|
+
* endColumn: 5,
|
|
143
|
+
* }, 'id-1', {
|
|
144
|
+
* showHeader: true
|
|
145
|
+
* })
|
|
146
|
+
* const removedSuccess = await fWorkbook.removeTable(id);
|
|
147
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1')
|
|
148
|
+
* console.log('debugger tableInfo is undefined', tableInfo)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
75
151
|
removeTable(tableId: string): Promise<boolean>;
|
|
76
152
|
}
|
|
77
153
|
export declare class FWorkbookSheetsTableMixin extends FWorkbook implements IFWorkbookSheetsTableMixin {
|
|
@@ -1,15 +1,286 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRangeThemeStyleJSON } from '@univerjs/sheets';
|
|
2
|
+
import { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange } from '@univerjs/sheets-table';
|
|
2
3
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
3
4
|
/**
|
|
4
5
|
* @ignore
|
|
5
6
|
*/
|
|
6
7
|
export interface IFWorkSheetTableMixin {
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Add a table to the worksheet
|
|
10
|
+
* @param tableName The table name
|
|
11
|
+
* @param rangeInfo The table range information
|
|
12
|
+
* @param tableId The table id
|
|
13
|
+
* @param options The table options
|
|
14
|
+
* @returns {Promise<boolean>} Whether the table was added successfully
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
18
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
19
|
+
* const subUnitId = fSheet.getSheetId();
|
|
20
|
+
* const res = await fSheet.addTable('name-1', {
|
|
21
|
+
* startRow: 1,
|
|
22
|
+
* startColumn: 1,
|
|
23
|
+
* endRow: 10,
|
|
24
|
+
* endColumn: 5,
|
|
25
|
+
* }, 'id-1', {
|
|
26
|
+
* showHeader: true
|
|
27
|
+
* })
|
|
28
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
29
|
+
* console.log('debugger tableInfo', tableInfo);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param tableId The table id
|
|
36
|
+
* @param column The column index
|
|
37
|
+
* @param filter The filter item
|
|
38
|
+
* @returns {Promise<boolean>} Whether the table filter was set successfully
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
42
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
43
|
+
* const subUnitId = fSheet.getSheetId();
|
|
44
|
+
* const res = await fSheet.addTable('name-1', {
|
|
45
|
+
* startRow: 1,
|
|
46
|
+
* startColumn: 1,
|
|
47
|
+
* endRow: 10,
|
|
48
|
+
* endColumn: 5,
|
|
49
|
+
* }, 'id-1', {
|
|
50
|
+
* showHeader: true
|
|
51
|
+
* })
|
|
52
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
53
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
54
|
+
* const result = await fSheet.setTableFilter('id-1', 1, {
|
|
55
|
+
* filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
|
|
56
|
+
* filterInfo: {
|
|
57
|
+
* conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
|
|
58
|
+
* compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
|
|
59
|
+
* expectedValue: 10,
|
|
60
|
+
* }
|
|
61
|
+
* });
|
|
62
|
+
* console.log('debugger result',result);
|
|
63
|
+
*/
|
|
64
|
+
setTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Remove a table from the worksheet
|
|
67
|
+
* @param tableId The table id
|
|
68
|
+
* @returns {Promise<boolean>} Whether the table was removed successfully
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
72
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
73
|
+
* const subUnitId = fSheet.getSheetId();
|
|
74
|
+
* const res = await fSheet.addTable('name-1', {
|
|
75
|
+
* startRow: 1,
|
|
76
|
+
* startColumn: 1,
|
|
77
|
+
* endRow: 10,
|
|
78
|
+
* endColumn: 5,
|
|
79
|
+
* }, 'id-1', {
|
|
80
|
+
* showHeader: true
|
|
81
|
+
* })
|
|
82
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
83
|
+
* console.log('debugger tableInfo', tableInfo);
|
|
84
|
+
* const result = await fSheet.removeTable('id-1');
|
|
85
|
+
* console.log('debugger result', result);
|
|
86
|
+
*/
|
|
87
|
+
removeTable(tableId: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Set the range of a table
|
|
90
|
+
* @param tableId The table id
|
|
91
|
+
* @param rangeInfo The new range information
|
|
92
|
+
* @returns {Promise<boolean>} Whether the table range was set successfully
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
96
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
97
|
+
* const subUnitId = fSheet.getSheetId();
|
|
98
|
+
* const res = await fSheet.addTable('name-1', {
|
|
99
|
+
* startRow: 1,
|
|
100
|
+
* startColumn: 1,
|
|
101
|
+
* endRow: 10,
|
|
102
|
+
* endColumn: 5,
|
|
103
|
+
* }, 'id-1', {
|
|
104
|
+
* showHeader: true
|
|
105
|
+
* })
|
|
106
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
107
|
+
* console.log('debugger tableInfo', tableInfo);
|
|
108
|
+
* const result = await fSheet.setTableRange('id-1', {
|
|
109
|
+
* startRow: 1,
|
|
110
|
+
* startColumn: 1,
|
|
111
|
+
* endRow: 20,
|
|
112
|
+
* endColumn: 5,
|
|
113
|
+
* })
|
|
114
|
+
* console.log('debugger result', result);
|
|
115
|
+
* const tableInfo2 = fWorkbook.getTableInfo('id-1');
|
|
116
|
+
* console.log('debugger tableInfo2', tableInfo2);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
setTableRange(tableId: string, rangeInfo: ITableRange): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Set the name of a table
|
|
122
|
+
* @param tableId The table id
|
|
123
|
+
* @param tableName The new table name
|
|
124
|
+
* @returns {Promise<boolean>} Whether the table name was set successfully
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
128
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
129
|
+
* const subUnitId = fSheet.getSheetId();
|
|
130
|
+
* const res = await fSheet.addTable('name-1', {
|
|
131
|
+
* startRow: 1,
|
|
132
|
+
* startColumn: 1,
|
|
133
|
+
* endRow: 10,
|
|
134
|
+
* endColumn: 5,
|
|
135
|
+
* }, 'id-1', {
|
|
136
|
+
* showHeader: true
|
|
137
|
+
* })
|
|
138
|
+
* const result = await fSheet.setTableName('id-1', 'new-name');
|
|
139
|
+
* console.log('debugger result',result);
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
setTableName(tableId: string, tableName: string): Promise<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Get the list of tables in the worksheet
|
|
145
|
+
* @returns {ITableInfoWithUnitId[]} The list of tables
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
149
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
150
|
+
* const subUnitId = fSheet.getSheetId();
|
|
151
|
+
* const res = await fSheet.addTable('name-1', {
|
|
152
|
+
* startRow: 1,
|
|
153
|
+
* startColumn: 1,
|
|
154
|
+
* endRow: 10,
|
|
155
|
+
* endColumn: 5,
|
|
156
|
+
* }, 'id-1', {
|
|
157
|
+
* showHeader: true
|
|
158
|
+
* })
|
|
159
|
+
* const tableList = fSheet.getSubTableInfos();
|
|
160
|
+
* console.log('debugger tableList',tableList);
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
getSubTableInfos(): ITableInfoWithUnitId[];
|
|
164
|
+
/**
|
|
165
|
+
* Reset the column filter of a table
|
|
166
|
+
* @param tableId The table id
|
|
167
|
+
* @param column The column index
|
|
168
|
+
* @returns {Promise<boolean>} Whether the table filter was reset successfully
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
172
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
173
|
+
* const subUnitId = fSheet.getSheetId();
|
|
174
|
+
* const res = await fSheet.addTable('name-1', {
|
|
175
|
+
* startRow: 1,
|
|
176
|
+
* startColumn: 1,
|
|
177
|
+
* endRow: 10,
|
|
178
|
+
* endColumn: 5,
|
|
179
|
+
* }, 'id-1', {
|
|
180
|
+
* showHeader: true
|
|
181
|
+
* })
|
|
182
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
183
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
184
|
+
* const result = await fSheet.setTableFilter('id-1', 1, {
|
|
185
|
+
* filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
|
|
186
|
+
* filterInfo: {
|
|
187
|
+
* conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
|
|
188
|
+
* compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
|
|
189
|
+
* expectedValue: 10,
|
|
190
|
+
* }
|
|
191
|
+
* })
|
|
192
|
+
* console.log('debugger result',result);
|
|
193
|
+
* const result2 = await fSheet.resetFilter('id-1', 1);
|
|
194
|
+
* console.log('debugger result2',result2);
|
|
195
|
+
* const tableInfo2 = fWorkbook.getTableInfo('id-1');
|
|
196
|
+
* console.log('debugger tableInfo2',tableInfo2);
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
resetFilter(tableId: string, column: number): Promise<boolean>;
|
|
200
|
+
/**
|
|
201
|
+
* Get the table information by cell position
|
|
202
|
+
* @param row The row index
|
|
203
|
+
* @param column The column index
|
|
204
|
+
* @returns {ITableInfoWithUnitId | undefined} The table information or undefined if not found
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
208
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
209
|
+
* const subUnitId = fSheet.getSheetId();
|
|
210
|
+
* const res = await fSheet.addTable('name-1', {
|
|
211
|
+
* startRow: 1,
|
|
212
|
+
* startColumn: 1,
|
|
213
|
+
* endRow: 10,
|
|
214
|
+
* endColumn: 5,
|
|
215
|
+
* }, 'id-1', {
|
|
216
|
+
* showHeader: true
|
|
217
|
+
* })
|
|
218
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
219
|
+
* console.log('debugger tableInfo',tableInfo);
|
|
220
|
+
* const tableInfo2 = fSheet.getTableByCell(1, 1);
|
|
221
|
+
* console.log('debugger tableInfo2',tableInfo2);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
getTableByCell(row: number, column: number): ITableInfoWithUnitId | undefined;
|
|
225
|
+
/**
|
|
226
|
+
* Add a theme to the table
|
|
227
|
+
* @param tableId The table id
|
|
228
|
+
* @param themeStyleJSON The theme style JSON
|
|
229
|
+
* @returns {Promise<boolean>} Whether the theme was added successfully
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
233
|
+
* const fSheet = fWorkbook.getActiveSheet();
|
|
234
|
+
* const subUnitId = fSheet.getSheetId();
|
|
235
|
+
* const res = await fSheet.addTable('name-1', {
|
|
236
|
+
* startRow: 1,
|
|
237
|
+
* startColumn: 1,
|
|
238
|
+
* endRow: 10,
|
|
239
|
+
* endColumn: 5,
|
|
240
|
+
* }, 'id-1', {
|
|
241
|
+
* showHeader: true
|
|
242
|
+
* })
|
|
243
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
244
|
+
* console.log('debugger tableInfo', tableInfo);
|
|
245
|
+
* const result = await fSheet.addTableTheme('id-1', {
|
|
246
|
+
* name: "table-custom-1",
|
|
247
|
+
* headerRowStyle: {
|
|
248
|
+
* bd: {
|
|
249
|
+
* t: {
|
|
250
|
+
* s: 1,
|
|
251
|
+
* cl: {
|
|
252
|
+
* rgb: "rgb(95 101 116)"
|
|
253
|
+
* }
|
|
254
|
+
* }
|
|
255
|
+
* },
|
|
256
|
+
* bg: {
|
|
257
|
+
* rgb: 'rgb(255,123,65)'
|
|
258
|
+
* }
|
|
259
|
+
* },
|
|
260
|
+
* lastRowStyle: {
|
|
261
|
+
* bd: {
|
|
262
|
+
* b: {
|
|
263
|
+
* s: 1,
|
|
264
|
+
* cl: {
|
|
265
|
+
* rgb: "rgb(95 101 116)"
|
|
266
|
+
* }
|
|
267
|
+
* }
|
|
268
|
+
* }
|
|
269
|
+
* },
|
|
270
|
+
* });
|
|
271
|
+
*/
|
|
272
|
+
addTableTheme(tableId: string, themeStyleJSON: IRangeThemeStyleJSON): Promise<boolean>;
|
|
9
273
|
}
|
|
10
274
|
export declare class FWorkSheetTableMixin extends FWorksheet implements IFWorkSheetTableMixin {
|
|
11
|
-
addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions):
|
|
12
|
-
|
|
275
|
+
addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<boolean>;
|
|
276
|
+
setTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
|
|
277
|
+
removeTable(tableId: string): Promise<boolean>;
|
|
278
|
+
setTableRange(tableId: string, rangeInfo: ITableRange): Promise<boolean>;
|
|
279
|
+
setTableName(tableId: string, tableName: string): Promise<boolean>;
|
|
280
|
+
getSubTableInfos(): ITableInfoWithUnitId[];
|
|
281
|
+
resetFilter(tableId: string, column: number): Promise<boolean>;
|
|
282
|
+
getTableByCell(row: number, column: number): ITableInfoWithUnitId | undefined;
|
|
283
|
+
addTableTheme(tableId: string, themeStyleJSON: IRangeThemeStyleJSON): Promise<boolean>;
|
|
13
284
|
}
|
|
14
285
|
declare module '@univerjs/sheets/facade' {
|
|
15
286
|
interface FWorksheet extends IFWorkSheetTableMixin {
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,a){typeof exports=="object"&&typeof module<"u"?a(require("@univerjs/sheets-table"),require("@univerjs/sheets/facade"),require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["@univerjs/sheets-table","@univerjs/sheets/facade","@univerjs/core","@univerjs/sheets","@univerjs/core/facade"],a):(t=typeof globalThis<"u"?globalThis:t||self,a(t.UniverSheetsTable,t.UniverSheetsFacade,t.UniverCore,t.UniverSheets,t.UniverCoreFacade))})(this,function(t,a,m,h,u){"use strict";class T extends a.FWorkbook{getTableInfo(e){const n=this.getId();return this._injector.get(t.SheetTableService).getTableInfo(n,e)}getTableList(){const e=this.getId();return this._injector.get(t.SheetTableService).getTableList(e)}async addTable(e,n,i,r,d){var b;const s=this._injector.get(t.SheetTableService),o={unitId:this.getId(),name:n,subUnitId:e,range:i,options:d,id:r};if(await this._commandService.executeCommand(t.AddSheetTableCommand.id,o))return(b=s.getTableList(this.getId()).find(v=>v.name===n))==null?void 0:b.id}async removeTable(e){var r;const n=(r=this.getTableInfo(e))==null?void 0:r.subUnitId;if(!n)return!1;const i={unitId:this.getId(),subUnitId:n,tableId:e};return this._commandService.executeCommand(t.DeleteSheetTableCommand.id,i)}getTableInfoByName(e){return this.getTableList().find(i=>i.name===e)}setTableFilter(e,n,i){const r={unitId:this.getId(),tableId:e,column:n,tableFilter:i};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,r)}}a.FWorkbook.extend(T);class S extends a.FWorksheet{addTable(e,n,i,r){const d=this.getSheetId(),o={unitId:this.getWorkbook().getUnitId(),subUnitId:d,name:e,range:n,id:i,options:r};return this._commandService.executeCommand(t.AddSheetTableCommand.id,o)}setTableFilter(e,n,i){const r={unitId:this.getWorkbook().getUnitId(),tableId:e,column:n,tableFilter:i};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,r)}removeTable(e){const n={unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),tableId:e};return this._commandService.executeCommand(t.DeleteSheetTableCommand.id,n)}setTableRange(e,n){const i={unitId:this.getWorkbook().getUnitId(),tableId:e,updateRange:{newRange:n}};return this._commandService.executeCommand(t.SetSheetTableCommand.id,i)}setTableName(e,n){const i={unitId:this.getWorkbook().getUnitId(),tableId:e,name:n};return this._commandService.executeCommand(t.SetSheetTableCommand.id,i)}getSubTableInfos(){const e=this._fWorkbook.getId();return this._injector.get(t.SheetTableService).getTableList(e).filter(i=>i.subUnitId===this.getSheetId())}resetFilter(e,n){const i={unitId:this._fWorkbook.getId(),tableId:e,column:n,tableFilter:void 0};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,i)}getTableByCell(e,n){const i=this._fWorkbook.getId(),d=this._injector.get(t.SheetTableService).getTableList(i).filter(o=>o.subUnitId===this.getSheetId()),s=m.cellToRange(e,n);return d.find(o=>{const l=o.range;return m.Rectangle.intersects(l,s)})}addTableTheme(e,n){const i=new h.RangeThemeStyle("table-style");return i.fromJson(n),this._commandService.executeCommand(t.AddTableThemeCommand.id,{unitId:this._fWorkbook.getId(),tableId:e,themeStyle:i})}}a.FWorksheet.extend(S);class g extends u.FEnum{get TableColumnFilterTypeEnum(){return t.TableColumnFilterTypeEnum}get TableConditionTypeEnum(){return t.TableConditionTypeEnum}get TableNumberCompareTypeEnum(){return t.TableNumberCompareTypeEnum}get TableStringCompareTypeEnum(){return t.TableStringCompareTypeEnum}get TableDateCompareTypeEnum(){return t.TableDateCompareTypeEnum}}u.FEnum.extend(g)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-table",
|
|
3
|
-
"version": "0.7.0-nightly.
|
|
3
|
+
"version": "0.7.0-nightly.202505171606",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A library for connect and bind data from other sources to Univer Sheets",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"rxjs": ">=7.0.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/
|
|
63
|
+
"@univerjs/sheets": "0.7.0-nightly.202505171606",
|
|
64
|
+
"@univerjs/core": "0.7.0-nightly.202505171606"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"rxjs": "^7.8.2",
|