@univerjs/sheets-table 0.7.0 → 0.8.0-nightly.202505261607

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 CHANGED
@@ -1 +1 @@
1
- "use strict";const s=require("@univerjs/sheets-table"),c=require("@univerjs/sheets/facade"),T=require("@univerjs/core");class m extends c.FWorkbook{getTableInfo(e){const t=this.getId();return this._injector.get(s.SheetTableService).getTableInfo(t,e)}getTableList(){const e=this.getId();return this._injector.get(s.SheetTableService).getTableList(e)}async addTable(e,t,i,a,d){var o;const n=this._injector.get(s.SheetTableService),r={unitId:this.getId(),name:t,subUnitId:e,range:i,options:d,tableId:a};if(await this._commandService.executeCommand(s.AddSheetTableCommand.id,r))return(o=n.getTableList(this.getId()).find(l=>l.name===t))==null?void 0:o.id}async removeTable(e){var a;const t=(a=this.getTableInfo(e))==null?void 0:a.subUnitId;if(!t)return!1;const i={unitId:this.getId(),subUnitId:t,tableId:e};return this._commandService.executeCommand(s.DeleteSheetTableCommand.id,i)}getTableInfoByName(e){return this.getTableList().find(i=>i.name===e)}setTableFilter(e,t,i){const a={unitId:this.getId(),tableId:e,column:t,tableFilter:i};return this._commandService.executeCommand(s.SetSheetTableFilterCommand.id,a)}}c.FWorkbook.extend(m);class u extends c.FWorksheet{addTable(e,t,i,a){const d=this._injector.get(s.SheetTableService),n=this.getSheetId(),r=this.getWorkbook().getUnitId(),b=this._injector.get(s.TableManager),o=this._injector.get(T.LocaleService),l=b.getColumnHeader(r,n,t,o.t("sheets-table.columnPrefix"));return d.addTable(r,n,e,t,l,i,a)}addTableFilter(e,t,i){const a={unitId:this.getWorkbook().getUnitId(),tableId:e,column:t,tableFilter:i};return this._commandService.executeCommand(s.SetSheetTableFilterCommand.id,a)}}c.FWorksheet.extend(u);
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 g, DeleteSheetTableCommand as u, SetSheetTableFilterCommand as b, TableManager as I } from "@univerjs/sheets-table";
2
- import { FWorkbook as m, FWorksheet as h } from "@univerjs/sheets/facade";
3
- import { LocaleService as S } from "@univerjs/core";
4
- class v extends m {
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, i, a, d) {
14
- var r;
15
- const n = this._injector.get(o), s = {
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: i,
20
- options: d,
21
- tableId: a
21
+ range: n,
22
+ options: r,
23
+ id: i
22
24
  };
23
- if (await this._commandService.executeCommand(g.id, s))
24
- return (r = n.getTableList(this.getId()).find((c) => c.name === t)) == null ? void 0 : r.id;
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 a;
28
- const t = (a = this.getTableInfo(e)) == null ? void 0 : a.subUnitId;
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 i = {
33
+ const n = {
32
34
  unitId: this.getId(),
33
35
  subUnitId: t,
34
36
  tableId: e
35
37
  };
36
- return this._commandService.executeCommand(u.id, i);
38
+ return this._commandService.executeCommand(T.id, n);
37
39
  }
38
40
  getTableInfoByName(e) {
39
- return this.getTableList().find((i) => i.name === e);
41
+ return this.getTableList().find((n) => n.name === e);
40
42
  }
41
- setTableFilter(e, t, i) {
42
- const a = {
43
+ setTableFilter(e, t, n) {
44
+ const i = {
43
45
  unitId: this.getId(),
44
46
  tableId: e,
45
47
  column: t,
46
- tableFilter: i
48
+ tableFilter: n
47
49
  };
48
- return this._commandService.executeCommand(b.id, a);
50
+ return this._commandService.executeCommand(d.id, i);
49
51
  }
50
52
  }
51
- m.extend(v);
52
- class f extends h {
53
- addTable(e, t, i, a) {
54
- const d = this._injector.get(o), n = this.getSheetId(), s = this.getWorkbook().getUnitId(), l = this._injector.get(I), r = this._injector.get(S), c = l.getColumnHeader(s, n, t, r.t("sheets-table.columnPrefix"));
55
- return d.addTable(s, n, e, t, c, i, a);
56
- }
57
- addTableFilter(e, t, i) {
58
- const a = {
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: i
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(b.id, a);
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
- h.extend(f);
148
+ I.extend(U);
package/lib/facade.js CHANGED
@@ -1,7 +1,9 @@
1
- import { SheetTableService as o, AddSheetTableCommand as g, DeleteSheetTableCommand as u, SetSheetTableFilterCommand as b, TableManager as I } from "@univerjs/sheets-table";
2
- import { FWorkbook as m, FWorksheet as h } from "@univerjs/sheets/facade";
3
- import { LocaleService as S } from "@univerjs/core";
4
- class v extends m {
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, i, a, d) {
14
- var r;
15
- const n = this._injector.get(o), s = {
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: i,
20
- options: d,
21
- tableId: a
21
+ range: n,
22
+ options: r,
23
+ id: i
22
24
  };
23
- if (await this._commandService.executeCommand(g.id, s))
24
- return (r = n.getTableList(this.getId()).find((c) => c.name === t)) == null ? void 0 : r.id;
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 a;
28
- const t = (a = this.getTableInfo(e)) == null ? void 0 : a.subUnitId;
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 i = {
33
+ const n = {
32
34
  unitId: this.getId(),
33
35
  subUnitId: t,
34
36
  tableId: e
35
37
  };
36
- return this._commandService.executeCommand(u.id, i);
38
+ return this._commandService.executeCommand(T.id, n);
37
39
  }
38
40
  getTableInfoByName(e) {
39
- return this.getTableList().find((i) => i.name === e);
41
+ return this.getTableList().find((n) => n.name === e);
40
42
  }
41
- setTableFilter(e, t, i) {
42
- const a = {
43
+ setTableFilter(e, t, n) {
44
+ const i = {
43
45
  unitId: this.getId(),
44
46
  tableId: e,
45
47
  column: t,
46
- tableFilter: i
48
+ tableFilter: n
47
49
  };
48
- return this._commandService.executeCommand(b.id, a);
50
+ return this._commandService.executeCommand(d.id, i);
49
51
  }
50
52
  }
51
- m.extend(v);
52
- class f extends h {
53
- addTable(e, t, i, a) {
54
- const d = this._injector.get(o), n = this.getSheetId(), s = this.getWorkbook().getUnitId(), l = this._injector.get(I), r = this._injector.get(S), c = l.getColumnHeader(s, n, t, r.t("sheets-table.columnPrefix"));
55
- return d.addTable(s, n, e, t, c, i, a);
56
- }
57
- addTableFilter(e, t, i) {
58
- const a = {
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: i
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(b.id, a);
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
- h.extend(f);
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
+ }
@@ -11,21 +11,52 @@ export interface IFWorkbookSheetsTableMixin {
11
11
  * @example
12
12
  * ```typescript
13
13
  * const fWorkbook = univerAPI.getActiveWorkbook();
14
- * const fSheet = fWorkbook.getActiveSheet();
15
- * const id = fWorkbook.addTable('Table1', {
16
- * unitId: fWorkbook.getId(),
17
- * subUnitId:fSheet.getSheetId(),
18
- * range: {
19
- * startRow: 1,
20
- * startColumn: 1,
21
- * endRow: 10,
22
- * endColumn: 5,
23
- * },
24
- * }, { showHeader: true });
25
- * const tableInfo = fWorkbook.getTableInfo(fWorkbook.getId(), id);
14
+ * const fWorksheet = fWorkbook.getActiveSheet();
15
+ *
16
+ * // Insert a table in the range B2:F11
17
+ * const fRange = fWorksheet.getRange('B2:F11');
18
+ * const success = await fWorksheet.addTable(
19
+ * 'name-1',
20
+ * fRange.getRange(),
21
+ * 'id-1',
22
+ * {
23
+ * showHeader: true,
24
+ * }
25
+ * );
26
+ *
27
+ * if (success) {
28
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
29
+ * console.log('debugger tableInfo', tableInfo);
30
+ * }
26
31
  * ```
27
32
  */
28
33
  getTableInfo(tableId: string): ITableInfoWithUnitId | undefined;
34
+ /**
35
+ * Get table information by name
36
+ * @param {string} tableName The table name
37
+ * @returns {ITableInfo} The table information
38
+ * @example
39
+ * ```typescript
40
+ * const fWorkbook = univerAPI.getActiveWorkbook();
41
+ * const fWorksheet = fWorkbook.getActiveSheet();
42
+ *
43
+ * // Insert a table in the range B2:F11
44
+ * const fRange = fWorksheet.getRange('B2:F11');
45
+ * const success = await fWorksheet.addTable(
46
+ * 'name-1',
47
+ * fRange.getRange(),
48
+ * 'id-1',
49
+ * {
50
+ * showHeader: true,
51
+ * }
52
+ * );
53
+ *
54
+ * if (success) {
55
+ * const tableInfo = fWorkbook.getTableInfoByName('name-1');
56
+ * console.log('debugger tableInfo', tableInfo);
57
+ * }
58
+ * ```
59
+ */
29
60
  getTableInfoByName(tableName: string): ITableInfoWithUnitId | undefined;
30
61
  /**
31
62
  * Get table list
@@ -33,45 +64,98 @@ export interface IFWorkbookSheetsTableMixin {
33
64
  * @example
34
65
  * ```typescript
35
66
  * const fWorkbook = univerAPI.getActiveWorkbook();
36
- * const fSheet = fWorkbook.getActiveSheet();
37
- * const id = fWorkbook.addTable('Table1', {
38
- * unitId: fWorkbook.getId(),
39
- * subUnitId:fSheet.getSheetId(),
40
- * range: {
41
- * startRow: 1,
42
- * startColumn: 1,
43
- * endRow: 10,
44
- * endColumn: 5,
45
- * },
46
- * }, { showHeader: true });
47
- * const tableList = fWorkbook.getTableList(fWorkbook.getId());
67
+ * const tables = fWorkbook.getTableList();
68
+ * console.log('debugger tables', tables);
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
55
- * @param {ITableOptions} options The table options
77
+ * @param {string} [tableId] The table id
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
- * const fSheet = fWorkbook.getActiveSheet();
61
- * const id = fWorkbook.addTable('Table1', {
62
- * unitId: fWorkbook.getId(),
63
- * subUnitId:fSheet.getSheetId(),
64
- * range: {
65
- * startRow: 1,
66
- * startColumn: 1,
67
- * endRow: 10,
68
- * endColumn: 5,
69
- * },
70
- * }, 'table1' ,{ showHeader: true });
83
+ * const fWorksheet = fWorkbook.getActiveSheet();
84
+ *
85
+ * // Insert a table in the range B2:F11
86
+ * const fRange = fWorksheet.getRange('B2:F11');
87
+ * const id = await fWorkbook.addTable(
88
+ * fWorksheet.getSheetId(),
89
+ * 'name-1',
90
+ * fRange.getRange(),
91
+ * 'id-1',
92
+ * {
93
+ * showHeader: true,
94
+ * }
95
+ * );
96
+ *
97
+ * if (id) {
98
+ * const tableInfo = fWorkbook.getTableInfo(id);
99
+ * console.log('debugger tableInfo', tableInfo);
100
+ * }
71
101
  * ```
72
102
  */
73
103
  addTable(subUnitId: string, tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<string | undefined>;
104
+ /**
105
+ * set table filter
106
+ * @param {string} tableId The table id
107
+ * @param {number} column The column index, starting from 0.
108
+ * @param {ITableFilterItem} filter The filter item
109
+ * @returns {Promise<boolean>} The result of set table filter
110
+ * @example
111
+ * ```typescript
112
+ * const fWorkbook = univerAPI.getActiveWorkbook();
113
+ * const fWorksheet = fWorkbook.getActiveSheet();
114
+ *
115
+ * // Insert a table in the range B2:F11
116
+ * const fRange = fWorksheet.getRange('B2:F11');
117
+ * const success = await fWorksheet.addTable(
118
+ * 'name-1',
119
+ * fRange.getRange(),
120
+ * 'id-1',
121
+ * {
122
+ * showHeader: true,
123
+ * }
124
+ * );
125
+ *
126
+ * if (success) {
127
+ * // Set the filter for the second column
128
+ * await fWorkbook.setTableFilter('id-1', 1, {
129
+ * filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
130
+ * filterInfo: {
131
+ * conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
132
+ * compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
133
+ * expectedValue: 10,
134
+ * },
135
+ * });
136
+ *
137
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
138
+ * console.log('debugger tableInfo', tableInfo);
139
+ * }
140
+ * ```
141
+ */
74
142
  setTableFilter(tableId: string, column: number, filter: ITableFilterItem | undefined): void;
143
+ /**
144
+ * Remove table
145
+ * @param {string} tableId The table id
146
+ * @returns {boolean} The result of remove table
147
+ * @example
148
+ * ```typescript
149
+ * const fWorkbook = univerAPI.getActiveWorkbook();
150
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
151
+ * console.log('debugger tableInfo', tableInfo);
152
+ *
153
+ * if (tableInfo) {
154
+ * // Remove the table with the specified id
155
+ * await fWorkbook.removeTable('id-1');
156
+ * }
157
+ * ```
158
+ */
75
159
  removeTable(tableId: string): Promise<boolean>;
76
160
  }
77
161
  export declare class FWorkbookSheetsTableMixin extends FWorkbook implements IFWorkbookSheetsTableMixin {
@@ -1,15 +1,301 @@
1
- import { ITableFilterItem, ITableOptions, ITableRange } from '@univerjs/sheets-table';
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
- addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): string;
8
- addTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
8
+ /**
9
+ * Add a table to the worksheet
10
+ * @param {string} tableName The table name
11
+ * @param {ITableRange} rangeInfo The table range information
12
+ * @param {string} [tableId] The table id
13
+ * @param {ITableOptions} [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 fWorksheet = fWorkbook.getActiveSheet();
19
+ *
20
+ * // Insert a table in the range B2:F11
21
+ * const fRange = fWorksheet.getRange('B2:F11');
22
+ * const success = await fWorksheet.addTable(
23
+ * 'name-1',
24
+ * fRange.getRange(),
25
+ * 'id-1',
26
+ * {
27
+ * showHeader: true,
28
+ * }
29
+ * );
30
+ *
31
+ * if (success) {
32
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
33
+ * console.log('debugger tableInfo', tableInfo);
34
+ * }
35
+ * ```
36
+ */
37
+ addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<boolean>;
38
+ /**
39
+ * Set the filter for a table column
40
+ * @param {string} tableId The table id
41
+ * @param {number} column The table column index, starting from 0. For example, the first column is 0, the second column is 1, and so on.
42
+ * @param {ITableFilterItem} filter The filter item
43
+ * @returns {Promise<boolean>} Whether the table filter was set successfully
44
+ * @example
45
+ * ```typescript
46
+ * const fWorkbook = univerAPI.getActiveWorkbook();
47
+ * const fWorksheet = fWorkbook.getActiveSheet();
48
+ *
49
+ * // Insert a table in the range B2:F11
50
+ * const fRange = fWorksheet.getRange('B2:F11');
51
+ * const success = await fWorksheet.addTable(
52
+ * 'name-1',
53
+ * fRange.getRange(),
54
+ * 'id-1',
55
+ * {
56
+ * showHeader: true,
57
+ * }
58
+ * );
59
+ *
60
+ * if (success) {
61
+ * // Set the filter for the second column
62
+ * await fWorksheet.setTableFilter('id-1', 1, {
63
+ * filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
64
+ * filterInfo: {
65
+ * conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
66
+ * compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
67
+ * expectedValue: 10,
68
+ * },
69
+ * });
70
+ *
71
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
72
+ * console.log('debugger tableInfo', tableInfo);
73
+ * }
74
+ * ```
75
+ */
76
+ setTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
77
+ /**
78
+ * Remove a table from the worksheet
79
+ * @param {string} tableId The table id
80
+ * @returns {Promise<boolean>} Whether the table was removed successfully
81
+ * @example
82
+ * ```typescript
83
+ * const fWorkbook = univerAPI.getActiveWorkbook();
84
+ * const fWorksheet = fWorkbook.getActiveSheet();
85
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
86
+ * console.log('debugger tableInfo', tableInfo);
87
+ *
88
+ * if (tableInfo) {
89
+ * // Remove the table with the specified id
90
+ * await fWorksheet.removeTable('id-1');
91
+ * }
92
+ * ```
93
+ */
94
+ removeTable(tableId: string): Promise<boolean>;
95
+ /**
96
+ * Set the range of a table
97
+ * @param {string} tableId The table id
98
+ * @param {ITableRange} rangeInfo The new range information
99
+ * @returns {Promise<boolean>} Whether the table range was set successfully
100
+ * @example
101
+ * ```typescript
102
+ * const fWorkbook = univerAPI.getActiveWorkbook();
103
+ * const fWorksheet = fWorkbook.getActiveSheet();
104
+ *
105
+ * // Insert a table in the range B2:F11
106
+ * const fRange = fWorksheet.getRange('B2:F11');
107
+ * const success = await fWorksheet.addTable(
108
+ * 'name-1',
109
+ * fRange.getRange(),
110
+ * 'id-1',
111
+ * {
112
+ * showHeader: true,
113
+ * }
114
+ * );
115
+ *
116
+ * if (success) {
117
+ * // Update the table range to B2:F21 after 3 seconds
118
+ * setTimeout(async () => {
119
+ * const newRange = fWorksheet.getRange('B2:F21');
120
+ * await fWorksheet.setTableRange('id-1', newRange.getRange());
121
+ *
122
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
123
+ * console.log('debugger tableInfo', tableInfo);
124
+ * }, 3000);
125
+ * }
126
+ * ```
127
+ */
128
+ setTableRange(tableId: string, rangeInfo: ITableRange): Promise<boolean>;
129
+ /**
130
+ * Set the name of a table
131
+ * @param {string} tableId The table id
132
+ * @param {string} tableName The new table name
133
+ * @returns {Promise<boolean>} Whether the table name was set successfully
134
+ * @example
135
+ * ```typescript
136
+ * const fWorkbook = univerAPI.getActiveWorkbook();
137
+ * const fWorksheet = fWorkbook.getActiveSheet();
138
+ *
139
+ * // Insert a table in the range B2:F11
140
+ * const fRange = fWorksheet.getRange('B2:F11');
141
+ * const success = await fWorksheet.addTable(
142
+ * 'name-1',
143
+ * fRange.getRange(),
144
+ * 'id-1',
145
+ * {
146
+ * showHeader: true,
147
+ * }
148
+ * );
149
+ *
150
+ * if (success) {
151
+ * // Update the table name after 3 seconds
152
+ * setTimeout(async () => {
153
+ * await fWorksheet.setTableName('id-1', 'new-name');
154
+ *
155
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
156
+ * console.log('debugger tableInfo', tableInfo);
157
+ * }, 3000);
158
+ * }
159
+ * ```
160
+ */
161
+ setTableName(tableId: string, tableName: string): Promise<boolean>;
162
+ /**
163
+ * Get the list of tables in the worksheet
164
+ * @returns {ITableInfoWithUnitId[]} The list of tables
165
+ * @example
166
+ * ```typescript
167
+ * const fWorkbook = univerAPI.getActiveWorkbook();
168
+ * const fWorksheet = fWorkbook.getActiveSheet();
169
+ * const tables = fWorksheet.getSubTableInfos();
170
+ * console.log('debugger tables', tables);
171
+ * ```
172
+ */
173
+ getSubTableInfos(): ITableInfoWithUnitId[];
174
+ /**
175
+ * Reset the column filter of a table
176
+ * @param {string} tableId The table id
177
+ * @param {number} column The column index, starting from 0. For example, the first column is 0, the second column is 1, and so on.
178
+ * @returns {Promise<boolean>} Whether the table filter was reset successfully
179
+ * @example
180
+ * ```typescript
181
+ * const fWorkbook = univerAPI.getActiveWorkbook();
182
+ * const fWorksheet = fWorkbook.getActiveSheet();
183
+ *
184
+ * // Insert a table in the range B2:F11
185
+ * const fRange = fWorksheet.getRange('B2:F11');
186
+ * const success = await fWorksheet.addTable(
187
+ * 'name-1',
188
+ * fRange.getRange(),
189
+ * 'id-1',
190
+ * {
191
+ * showHeader: true,
192
+ * }
193
+ * );
194
+ *
195
+ * if (success) {
196
+ * // Set the filter for the second column
197
+ * await fWorksheet.setTableFilter('id-1', 1, {
198
+ * filterType: univerAPI.Enum.TableColumnFilterTypeEnum.condition,
199
+ * filterInfo: {
200
+ * conditionType: univerAPI.Enum.TableConditionTypeEnum.Number,
201
+ * compareType: univerAPI.Enum.TableNumberCompareTypeEnum.GreaterThan,
202
+ * expectedValue: 10,
203
+ * },
204
+ * });
205
+ *
206
+ * // Reset the filter for the second column after 3 seconds
207
+ * setTimeout(async () => {
208
+ * await fWorksheet.resetFilter('id-1', 1);
209
+ * }, 3000);
210
+ *
211
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
212
+ * console.log('debugger tableInfo', tableInfo);
213
+ * }
214
+ * ```
215
+ */
216
+ resetFilter(tableId: string, column: number): Promise<boolean>;
217
+ /**
218
+ * Get the table information by cell position
219
+ * @param {number} row The cell row index, starting from 0.
220
+ * @param {number} column The cell column index, starting from 0.
221
+ * @returns {ITableInfoWithUnitId | undefined} The table information or undefined if not found
222
+ * @example
223
+ * ```typescript
224
+ * const fWorkbook = univerAPI.getActiveWorkbook();
225
+ * const fWorksheet = fWorkbook.getActiveSheet();
226
+ *
227
+ * const cellB2 = fWorksheet.getRange('B2');
228
+ * const row = cellB2.getRow();
229
+ * const column = cellB2.getColumn();
230
+ * console.log('debugger tableInfo', fWorksheet.getTableByCell(row, column));
231
+ *
232
+ * // Insert a table in the range B2:F11
233
+ * const fRange = fWorksheet.getRange('B2:F11');
234
+ * const success = await fWorksheet.addTable(
235
+ * 'name-1',
236
+ * fRange.getRange(),
237
+ * 'id-1',
238
+ * {
239
+ * showHeader: true,
240
+ * }
241
+ * );
242
+ * console.log('debugger tableInfo2', fWorksheet.getTableByCell(row, column));
243
+ * ```
244
+ */
245
+ getTableByCell(row: number, column: number): ITableInfoWithUnitId | undefined;
246
+ /**
247
+ * Add a theme to the table
248
+ * @param {string} tableId The table id
249
+ * @param {IRangeThemeStyleJSON} themeStyleJSON The theme style JSON
250
+ * @returns {Promise<boolean>} Whether the theme was added successfully
251
+ * @example
252
+ * ```typescript
253
+ * const fWorkbook = univerAPI.getActiveWorkbook();
254
+ * const fWorksheet = fWorkbook.getActiveSheet();
255
+ *
256
+ * // Insert a table in the range B2:F11
257
+ * const fRange = fWorksheet.getRange('B2:F11');
258
+ * const success = await fWorksheet.addTable(
259
+ * 'name-1',
260
+ * fRange.getRange(),
261
+ * 'id-1',
262
+ * {
263
+ * showHeader: true,
264
+ * }
265
+ * );
266
+ *
267
+ * if (success) {
268
+ * await fWorksheet.addTableTheme('id-1', {
269
+ * name: 'table-custom-1',
270
+ * headerRowStyle: {
271
+ * bg: {
272
+ * rgb: '#145f82',
273
+ * },
274
+ * },
275
+ * firstRowStyle: {
276
+ * bg: {
277
+ * rgb: '#c0e4f5',
278
+ * },
279
+ * },
280
+ * });
281
+ *
282
+ * const tableInfo = fWorkbook.getTableInfo('id-1');
283
+ * console.log('debugger tableInfo', tableInfo);
284
+ * }
285
+ * ```
286
+ */
287
+ addTableTheme(tableId: string, themeStyleJSON: IRangeThemeStyleJSON): Promise<boolean>;
9
288
  }
10
289
  export declare class FWorkSheetTableMixin extends FWorksheet implements IFWorkSheetTableMixin {
11
- addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): string;
12
- addTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
290
+ addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<boolean>;
291
+ setTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
292
+ removeTable(tableId: string): Promise<boolean>;
293
+ setTableRange(tableId: string, rangeInfo: ITableRange): Promise<boolean>;
294
+ setTableName(tableId: string, tableName: string): Promise<boolean>;
295
+ getSubTableInfos(): ITableInfoWithUnitId[];
296
+ resetFilter(tableId: string, column: number): Promise<boolean>;
297
+ getTableByCell(row: number, column: number): ITableInfoWithUnitId | undefined;
298
+ addTableTheme(tableId: string, themeStyleJSON: IRangeThemeStyleJSON): Promise<boolean>;
13
299
  }
14
300
  declare module '@univerjs/sheets/facade' {
15
301
  interface FWorksheet extends IFWorkSheetTableMixin {
@@ -15,5 +15,6 @@
15
15
  */
16
16
  import './f-workbook';
17
17
  import './f-worksheet';
18
+ import './f-enum';
18
19
  export type * from './f-workbook';
19
20
  export type * from './f-worksheet';
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(i,s){typeof exports=="object"&&typeof module<"u"?s(require("@univerjs/sheets-table"),require("@univerjs/sheets/facade"),require("@univerjs/core")):typeof define=="function"&&define.amd?define(["@univerjs/sheets-table","@univerjs/sheets/facade","@univerjs/core"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i.UniverSheetsTable,i.UniverSheetsFacade,i.UniverCore))})(this,function(i,s,u){"use strict";class b extends s.FWorkbook{getTableInfo(e){const t=this.getId();return this._injector.get(i.SheetTableService).getTableInfo(t,e)}getTableList(){const e=this.getId();return this._injector.get(i.SheetTableService).getTableList(e)}async addTable(e,t,n,r,c){var d;const a=this._injector.get(i.SheetTableService),o={unitId:this.getId(),name:t,subUnitId:e,range:n,options:c,tableId:r};if(await this._commandService.executeCommand(i.AddSheetTableCommand.id,o))return(d=a.getTableList(this.getId()).find(l=>l.name===t))==null?void 0:d.id}async removeTable(e){var r;const t=(r=this.getTableInfo(e))==null?void 0:r.subUnitId;if(!t)return!1;const n={unitId:this.getId(),subUnitId:t,tableId:e};return this._commandService.executeCommand(i.DeleteSheetTableCommand.id,n)}getTableInfoByName(e){return this.getTableList().find(n=>n.name===e)}setTableFilter(e,t,n){const r={unitId:this.getId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(i.SetSheetTableFilterCommand.id,r)}}s.FWorkbook.extend(b);class m extends s.FWorksheet{addTable(e,t,n,r){const c=this._injector.get(i.SheetTableService),a=this.getSheetId(),o=this.getWorkbook().getUnitId(),h=this._injector.get(i.TableManager),d=this._injector.get(u.LocaleService),l=h.getColumnHeader(o,a,t,d.t("sheets-table.columnPrefix"));return c.addTable(o,a,e,t,l,n,r)}addTableFilter(e,t,n){const r={unitId:this.getWorkbook().getUnitId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(i.SetSheetTableFilterCommand.id,r)}}s.FWorksheet.extend(m)});
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",
3
+ "version": "0.8.0-nightly.202505261607",
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,15 +60,15 @@
60
60
  "rxjs": ">=7.0.0"
61
61
  },
62
62
  "dependencies": {
63
- "@univerjs/sheets": "0.7.0",
64
- "@univerjs/core": "0.7.0"
63
+ "@univerjs/core": "0.8.0-nightly.202505261607",
64
+ "@univerjs/sheets": "0.8.0-nightly.202505261607"
65
65
  },
66
66
  "devDependencies": {
67
67
  "rxjs": "^7.8.2",
68
68
  "typescript": "^5.8.3",
69
69
  "vite": "^6.3.5",
70
- "vitest": "^3.1.3",
71
- "@univerjs-infra/shared": "0.7.0"
70
+ "vitest": "^3.1.4",
71
+ "@univerjs-infra/shared": "0.8.0-beta.0"
72
72
  },
73
73
  "scripts": {
74
74
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS