@univerjs/sheets-table 0.7.0-nightly.202505181606 → 0.7.0-nightly.202505191607
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/types/facade/f-workbook.d.ts +93 -85
- package/lib/types/facade/f-worksheet.d.ts +200 -185
- package/package.json +3 -3
|
@@ -11,40 +11,50 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
14
|
-
* const
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
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;
|
|
29
34
|
/**
|
|
30
35
|
* Get table information by name
|
|
31
|
-
* @param tableName The table name
|
|
36
|
+
* @param {string} tableName The table name
|
|
32
37
|
* @returns {ITableInfo} The table information
|
|
33
38
|
* @example
|
|
34
39
|
* ```typescript
|
|
35
40
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
36
|
-
* const
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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
|
+
* }
|
|
48
58
|
* ```
|
|
49
59
|
*/
|
|
50
60
|
getTableInfoByName(tableName: string): ITableInfoWithUnitId | undefined;
|
|
@@ -54,18 +64,8 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
54
64
|
* @example
|
|
55
65
|
* ```typescript
|
|
56
66
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
57
|
-
* const
|
|
58
|
-
*
|
|
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
|
-
* })
|
|
67
|
-
* const tableList = fWorkbook.getTableList(fWorkbook.getId());
|
|
68
|
-
* console.log('debugger tableList', tableList);
|
|
67
|
+
* const tables = fWorkbook.getTableList();
|
|
68
|
+
* console.log('debugger tables', tables);
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
71
|
getTableList(): ITableInfo[];
|
|
@@ -74,56 +74,70 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
74
74
|
* @param {string} subUnitId The sub unit id
|
|
75
75
|
* @param {string} tableName The table name
|
|
76
76
|
* @param {ITableRange} rangeInfo The table range information
|
|
77
|
-
* @param {string} tableId The table id
|
|
78
|
-
* @param {ITableOptions} options The table options
|
|
77
|
+
* @param {string} [tableId] The table id
|
|
78
|
+
* @param {ITableOptions} [options] The table options
|
|
79
79
|
* @returns {string} The table id
|
|
80
80
|
* @example
|
|
81
81
|
* ```typescript
|
|
82
82
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
83
|
-
* const
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* const
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
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
|
+
* }
|
|
95
101
|
* ```
|
|
96
102
|
*/
|
|
97
103
|
addTable(subUnitId: string, tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<string | undefined>;
|
|
98
104
|
/**
|
|
99
105
|
* set table filter
|
|
100
106
|
* @param {string} tableId The table id
|
|
101
|
-
* @param {number} column The column index
|
|
107
|
+
* @param {number} column The column index, starting from 0.
|
|
102
108
|
* @param {ITableFilterItem} filter The filter item
|
|
103
109
|
* @returns {Promise<boolean>} The result of set table filter
|
|
104
110
|
* @example
|
|
105
111
|
* ```typescript
|
|
106
112
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
107
|
-
* const
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
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
|
+
* ```
|
|
127
141
|
*/
|
|
128
142
|
setTableFilter(tableId: string, column: number, filter: ITableFilterItem | undefined): void;
|
|
129
143
|
/**
|
|
@@ -133,19 +147,13 @@ export interface IFWorkbookSheetsTableMixin {
|
|
|
133
147
|
* @example
|
|
134
148
|
* ```typescript
|
|
135
149
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
136
|
-
* const
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
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)
|
|
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
|
+
* }
|
|
149
157
|
* ```
|
|
150
158
|
*/
|
|
151
159
|
removeTable(tableId: string): Promise<boolean>;
|
|
@@ -7,136 +7,155 @@ import { FWorksheet } from '@univerjs/sheets/facade';
|
|
|
7
7
|
export interface IFWorkSheetTableMixin {
|
|
8
8
|
/**
|
|
9
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
|
|
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
14
|
* @returns {Promise<boolean>} Whether the table was added successfully
|
|
15
15
|
* @example
|
|
16
16
|
* ```typescript
|
|
17
17
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
18
|
-
* const
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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
|
+
* }
|
|
30
35
|
* ```
|
|
31
36
|
*/
|
|
32
37
|
addTable(tableName: string, rangeInfo: ITableRange, tableId?: string, options?: ITableOptions): Promise<boolean>;
|
|
33
38
|
/**
|
|
34
|
-
*
|
|
35
|
-
* @param tableId The table id
|
|
36
|
-
* @param column The column index
|
|
37
|
-
* @param filter The filter item
|
|
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
|
|
38
43
|
* @returns {Promise<boolean>} Whether the table filter was set successfully
|
|
39
44
|
* @example
|
|
40
45
|
* ```typescript
|
|
41
46
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
42
|
-
* const
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
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
|
+
* ```
|
|
63
75
|
*/
|
|
64
76
|
setTableFilter(tableId: string, column: number, filter: ITableFilterItem): Promise<boolean>;
|
|
65
77
|
/**
|
|
66
78
|
* Remove a table from the worksheet
|
|
67
|
-
* @param tableId The table id
|
|
79
|
+
* @param {string} tableId The table id
|
|
68
80
|
* @returns {Promise<boolean>} Whether the table was removed successfully
|
|
69
81
|
* @example
|
|
70
82
|
* ```typescript
|
|
71
83
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
72
|
-
* const
|
|
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
|
-
* })
|
|
84
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
82
85
|
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
83
86
|
* console.log('debugger tableInfo', tableInfo);
|
|
84
|
-
*
|
|
85
|
-
*
|
|
87
|
+
*
|
|
88
|
+
* if (tableInfo) {
|
|
89
|
+
* // Remove the table with the specified id
|
|
90
|
+
* await fWorksheet.removeTable('id-1');
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
86
93
|
*/
|
|
87
94
|
removeTable(tableId: string): Promise<boolean>;
|
|
88
95
|
/**
|
|
89
96
|
* Set the range of a table
|
|
90
|
-
* @param tableId The table id
|
|
91
|
-
* @param rangeInfo The new range information
|
|
97
|
+
* @param {string} tableId The table id
|
|
98
|
+
* @param {ITableRange} rangeInfo The new range information
|
|
92
99
|
* @returns {Promise<boolean>} Whether the table range was set successfully
|
|
93
100
|
* @example
|
|
94
101
|
* ```typescript
|
|
95
102
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
96
|
-
* const
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
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
|
+
* }
|
|
117
126
|
* ```
|
|
118
127
|
*/
|
|
119
128
|
setTableRange(tableId: string, rangeInfo: ITableRange): Promise<boolean>;
|
|
120
129
|
/**
|
|
121
130
|
* Set the name of a table
|
|
122
|
-
* @param tableId The table id
|
|
123
|
-
* @param tableName The new table name
|
|
131
|
+
* @param {string} tableId The table id
|
|
132
|
+
* @param {string} tableName The new table name
|
|
124
133
|
* @returns {Promise<boolean>} Whether the table name was set successfully
|
|
125
134
|
* @example
|
|
126
135
|
* ```typescript
|
|
127
136
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
128
|
-
* const
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
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
|
+
* }
|
|
140
159
|
* ```
|
|
141
160
|
*/
|
|
142
161
|
setTableName(tableId: string, tableName: string): Promise<boolean>;
|
|
@@ -146,128 +165,124 @@ export interface IFWorkSheetTableMixin {
|
|
|
146
165
|
* @example
|
|
147
166
|
* ```typescript
|
|
148
167
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
149
|
-
* const
|
|
150
|
-
* const
|
|
151
|
-
*
|
|
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);
|
|
168
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
169
|
+
* const tables = fWorksheet.getSubTableInfos();
|
|
170
|
+
* console.log('debugger tables', tables);
|
|
161
171
|
* ```
|
|
162
172
|
*/
|
|
163
173
|
getSubTableInfos(): ITableInfoWithUnitId[];
|
|
164
174
|
/**
|
|
165
175
|
* Reset the column filter of a table
|
|
166
|
-
* @param tableId The table id
|
|
167
|
-
* @param column The column index
|
|
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.
|
|
168
178
|
* @returns {Promise<boolean>} Whether the table filter was reset successfully
|
|
169
179
|
* @example
|
|
170
180
|
* ```typescript
|
|
171
181
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
172
|
-
* const
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
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
|
+
* }
|
|
197
214
|
* ```
|
|
198
215
|
*/
|
|
199
216
|
resetFilter(tableId: string, column: number): Promise<boolean>;
|
|
200
217
|
/**
|
|
201
218
|
* Get the table information by cell position
|
|
202
|
-
* @param row The row index
|
|
203
|
-
* @param column The column index
|
|
219
|
+
* @param {number} row The cell row index, starting from 0.
|
|
220
|
+
* @param {number} column The cell column index, starting from 0.
|
|
204
221
|
* @returns {ITableInfoWithUnitId | undefined} The table information or undefined if not found
|
|
205
222
|
* @example
|
|
206
223
|
* ```typescript
|
|
207
224
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
208
|
-
* const
|
|
209
|
-
*
|
|
210
|
-
* const
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
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));
|
|
222
243
|
* ```
|
|
223
244
|
*/
|
|
224
245
|
getTableByCell(row: number, column: number): ITableInfoWithUnitId | undefined;
|
|
225
246
|
/**
|
|
226
247
|
* Add a theme to the table
|
|
227
|
-
* @param tableId The table id
|
|
228
|
-
* @param themeStyleJSON The theme style JSON
|
|
248
|
+
* @param {string} tableId The table id
|
|
249
|
+
* @param {IRangeThemeStyleJSON} themeStyleJSON The theme style JSON
|
|
229
250
|
* @returns {Promise<boolean>} Whether the theme was added successfully
|
|
230
251
|
* @example
|
|
231
252
|
* ```typescript
|
|
232
253
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
233
|
-
* const
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
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
|
+
* },
|
|
255
279
|
* },
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* b: {
|
|
263
|
-
* s: 1,
|
|
264
|
-
* cl: {
|
|
265
|
-
* rgb: "rgb(95 101 116)"
|
|
266
|
-
* }
|
|
267
|
-
* }
|
|
268
|
-
* }
|
|
269
|
-
* },
|
|
270
|
-
* });
|
|
280
|
+
* });
|
|
281
|
+
*
|
|
282
|
+
* const tableInfo = fWorkbook.getTableInfo('id-1');
|
|
283
|
+
* console.log('debugger tableInfo', tableInfo);
|
|
284
|
+
* }
|
|
285
|
+
* ```
|
|
271
286
|
*/
|
|
272
287
|
addTableTheme(tableId: string, themeStyleJSON: IRangeThemeStyleJSON): Promise<boolean>;
|
|
273
288
|
}
|
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.202505191607",
|
|
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/core": "0.7.0-nightly.
|
|
64
|
-
"@univerjs/sheets": "0.7.0-nightly.
|
|
63
|
+
"@univerjs/core": "0.7.0-nightly.202505191607",
|
|
64
|
+
"@univerjs/sheets": "0.7.0-nightly.202505191607"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"rxjs": "^7.8.2",
|