@univerjs/sheets-table 0.6.10-experimental.20250418-8830bd4

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.
Files changed (47) hide show
  1. package/README.md +21 -0
  2. package/lib/cjs/facade.js +1 -0
  3. package/lib/cjs/index.js +1 -0
  4. package/lib/es/facade.js +67 -0
  5. package/lib/es/index.js +2696 -0
  6. package/lib/facade.js +67 -0
  7. package/lib/index.js +2696 -0
  8. package/lib/types/commands/commands/add-sheet-table.command.d.ts +11 -0
  9. package/lib/types/commands/commands/add-table-theme.command.d.ts +8 -0
  10. package/lib/types/commands/commands/delete-sheet-table.command.d.ts +3 -0
  11. package/lib/types/commands/commands/remove-table-theme.command.d.ts +7 -0
  12. package/lib/types/commands/commands/set-sheet-table.command.d.ts +7 -0
  13. package/lib/types/commands/commands/set-table-filter.command.d.ts +3 -0
  14. package/lib/types/commands/commands/sheet-table-row-col.command.d.ts +11 -0
  15. package/lib/types/commands/mutations/add-sheet-table.mutation.d.ts +14 -0
  16. package/lib/types/commands/mutations/delete-sheet-table.mutation.d.ts +7 -0
  17. package/lib/types/commands/mutations/set-sheet-table.mutation.d.ts +9 -0
  18. package/lib/types/commands/mutations/set-table-filter.mutation.d.ts +11 -0
  19. package/lib/types/const.d.ts +18 -0
  20. package/lib/types/controllers/sheet-table-range.controller.d.ts +9 -0
  21. package/lib/types/controllers/sheet-table-ref-range.controller.d.ts +19 -0
  22. package/lib/types/controllers/sheet-table-theme.controller.d.ts +12 -0
  23. package/lib/types/controllers/sheets-table.controller.d.ts +19 -0
  24. package/lib/types/controllers/table-filter.controller.d.ts +18 -0
  25. package/lib/types/controllers/table-theme.factory.d.ts +88 -0
  26. package/lib/types/facade/f-workbook.d.ts +88 -0
  27. package/lib/types/facade/f-worksheet.d.ts +17 -0
  28. package/lib/types/facade/index.d.ts +19 -0
  29. package/lib/types/index.d.ts +42 -0
  30. package/lib/types/model/filter-util/condition.d.ts +11 -0
  31. package/lib/types/model/filter-util/date-filter-util.d.ts +210 -0
  32. package/lib/types/model/filter-util/manual.d.ts +7 -0
  33. package/lib/types/model/filter-util/number-filter-util.d.ts +32 -0
  34. package/lib/types/model/filter-util/text-filter-util.d.ts +8 -0
  35. package/lib/types/model/filter-util/top-n.d.ts +29 -0
  36. package/lib/types/model/table-column.d.ts +24 -0
  37. package/lib/types/model/table-filter.d.ts +26 -0
  38. package/lib/types/model/table-manager.d.ts +79 -0
  39. package/lib/types/model/table.d.ts +81 -0
  40. package/lib/types/plugin.d.ts +12 -0
  41. package/lib/types/services/table-service.d.ts +18 -0
  42. package/lib/types/types/enum.d.ts +115 -0
  43. package/lib/types/types/type.d.ts +205 -0
  44. package/lib/types/util.d.ts +16 -0
  45. package/lib/umd/facade.js +1 -0
  46. package/lib/umd/index.js +1 -0
  47. package/package.json +81 -0
@@ -0,0 +1,210 @@
1
+ import { ITableDateFilterInfo } from '../../types/type';
2
+ /**
3
+ * The provided date is a date in Q1 of the year.
4
+ * @param {Date} date - The date to compare.
5
+ * @returns {boolean} return the date is match
6
+ */
7
+ export declare const dateQ1: (date: Date) => boolean;
8
+ /**
9
+ * The provided date is a date in Q2 of the year.
10
+ * @param {Date} date - The date to compare.
11
+ * @returns {boolean} return the date is match
12
+ */
13
+ export declare const dateQ2: (date: Date) => boolean;
14
+ /**
15
+ * The provided date is a date in Q3 of the year.
16
+ * @param {Date} date - The date to compare.
17
+ * @returns {boolean} return the date is match
18
+ */
19
+ export declare const dateQ3: (date: Date) => boolean;
20
+ /**
21
+ * The provided date is a date in Q4 of the year.
22
+ * @param {Date} date - The date to compare.
23
+ * @returns {boolean} return the date is match
24
+ */
25
+ export declare const dateQ4: (date: Date) => boolean;
26
+ /**
27
+ * The provided date is a date in January.
28
+ * @param {Date} date - The date to compare.
29
+ * @returns {boolean} return the date is match
30
+ */
31
+ export declare const dateM1: (date: Date) => boolean;
32
+ /**
33
+ * The provided date is a date in February.
34
+ * @param {Date} date - The date to compare.
35
+ * @returns {boolean} return the date is match
36
+ */
37
+ export declare const dateM2: (date: Date) => boolean;
38
+ /**
39
+ * The provided date is a date in March.
40
+ * @param {Date} date - The date to compare.
41
+ * @returns {boolean} return the date is match
42
+ */
43
+ export declare const dateM3: (date: Date) => boolean;
44
+ /**
45
+ * The provided date is a date in April.
46
+ * @param {Date} date - The date to compare.
47
+ * @returns {boolean} return the date is match
48
+ */
49
+ export declare const dateM4: (date: Date) => boolean;
50
+ /**
51
+ * The provided date is a date in May.
52
+ * @param {Date} date - The date to compare.
53
+ * @returns {boolean} return the date is match
54
+ */
55
+ export declare const dateM5: (date: Date) => boolean;
56
+ /**
57
+ * The provided date is a date in June.
58
+ * @param {Date} date - The date to compare.
59
+ * @returns {boolean} return the date is match
60
+ */
61
+ export declare const dateM6: (date: Date) => boolean;
62
+ /**
63
+ * The provided date is a date in July.
64
+ * @param {Date} date - The date to compare.
65
+ * @returns {boolean} return the date is match
66
+ */
67
+ export declare const dateM7: (date: Date) => boolean;
68
+ /**
69
+ * The provided date is a date in August.
70
+ * @param {Date} date - The date to compare.
71
+ * @returns {boolean} return the date is match
72
+ */
73
+ export declare const dateM8: (date: Date) => boolean;
74
+ /**
75
+ * The provided date is a date in September.
76
+ * @param {Date} date - The date to compare.
77
+ * @returns {boolean} return the date is match
78
+ */
79
+ export declare const dateM9: (date: Date) => boolean;
80
+ /**
81
+ * The provided date is a date in October.
82
+ * @param {Date} date - The date to compare.
83
+ * @returns {boolean} return the date is match
84
+ */
85
+ export declare const dateM10: (date: Date) => boolean;
86
+ /**
87
+ * The provided date is a date in November.
88
+ * @param {Date} date - The date to compare.
89
+ * @returns {boolean} return the date is match
90
+ */
91
+ export declare const dateM11: (date: Date) => boolean;
92
+ /**
93
+ * The provided date is a date in December.
94
+ * @param {Date} date - The date to compare.
95
+ * @returns {boolean} return the date is match
96
+ */
97
+ export declare const dateM12: (date: Date) => boolean;
98
+ /**
99
+ * The provided date is today.
100
+ * @param {Date} expectedDate - The date to compare.
101
+ * @param {Date} [anchorTime] - The reference date.
102
+ * @returns {boolean} return the date is match
103
+ */
104
+ export declare const today: (expectedDate: Date, anchorTime?: Date) => boolean;
105
+ /**
106
+ * The provided date is tomorrow.
107
+ * @param {Date} date - The date to compare.
108
+ * @param {Date} [anchorTime] - The reference date.
109
+ * @returns {boolean} return the date is match
110
+ */
111
+ export declare const tomorrow: (date: Date, anchorTime?: Date) => boolean;
112
+ /**
113
+ * The provided date is yesterday.
114
+ * @param {Date} date - The date to compare.
115
+ * @param {Date} [anchorTime] - The reference date.
116
+ * @returns {boolean} return the date is match
117
+ */
118
+ export declare const yesterday: (date: Date, anchorTime?: Date) => boolean;
119
+ /**
120
+ * The provided date is in the current week.
121
+ * @param {Date} date - The date to compare.
122
+ * @param {Date} [anchorTime] - The reference date.
123
+ * @returns {boolean} return the date is match
124
+ */
125
+ export declare const thisWeek: (date: Date, anchorTime?: Date) => boolean;
126
+ /**
127
+ * The provided date is in the next week.
128
+ * @param {Date} date - The date to compare.
129
+ * @param {Date} [anchorTime] - The reference date.
130
+ * @returns {boolean} return the date is match
131
+ */
132
+ export declare const nextWeek: (date: Date, anchorTime?: Date) => boolean;
133
+ /**
134
+ * The provided date is in the last week.
135
+ * @param {Date} date - The date to compare.
136
+ * @param {Date} [anchorTime] - The reference date.
137
+ * @returns {boolean} return the date is match
138
+ */
139
+ export declare const lastWeek: (date: Date, anchorTime?: Date) => boolean;
140
+ /**
141
+ * The provided date is in the current month.
142
+ * @param {Date} date - The date to compare.
143
+ * @param {Date} [anchorTime] - The reference date.
144
+ * @returns {boolean} return the date is match
145
+ */
146
+ export declare const thisMonth: (date: Date, anchorTime?: Date) => boolean;
147
+ /**
148
+ * The provided date is in the next month.
149
+ * @param {Date} date - The date to compare.
150
+ * @param {Date} [anchorTime] - The reference date.
151
+ * @returns {boolean} return the date is match
152
+ */
153
+ export declare const nextMonth: (date: Date, anchorTime?: Date) => boolean;
154
+ /**
155
+ * The provided date is in the last month.
156
+ * @param {Date} date - The date to compare.
157
+ * @param {Date} [anchorTime] - The reference date.
158
+ * @returns {boolean} return the date is match
159
+ */
160
+ export declare const lastMonth: (date: Date, anchorTime?: Date) => boolean;
161
+ /**
162
+ * The provided date is in the current quarter.
163
+ * @param {Date} date - The date to compare.
164
+ * @param {Date} [anchorTime] - The reference date.
165
+ * @returns {boolean} return the date is match
166
+ */
167
+ export declare const thisQuarter: (date: Date, anchorTime?: Date) => boolean;
168
+ /**
169
+ * The provided date is in the next quarter.
170
+ * @param {Date} date - The date to compare.
171
+ * @param {Date} [anchorTime] - The reference date.
172
+ * @returns {boolean} return the date is match
173
+ */
174
+ export declare const nextQuarter: (date: Date, anchorTime?: Date) => boolean;
175
+ /**
176
+ * The provided date is in the last quarter.
177
+ * @param {Date} date - The date to compare.
178
+ * @param {Date} [anchorTime] - The reference date.
179
+ * @returns {boolean} return the date is match
180
+ */
181
+ export declare const lastQuarter: (date: Date, anchorTime?: Date) => boolean;
182
+ /**
183
+ * The provided date is in the current year.
184
+ * @param {Date} date - The date to compare.
185
+ * @param {Date} [anchorTime] - The reference date.
186
+ * @returns {boolean} return the date is match
187
+ */
188
+ export declare const thisYear: (date: Date, anchorTime?: Date) => boolean;
189
+ /**
190
+ * The provided date is in the next year.
191
+ * @param {Date} date - The date to compare.
192
+ * @param {Date} [anchorTime] - The reference date.
193
+ * @returns {boolean} return the date is match
194
+ */
195
+ export declare const nextYear: (date: Date, anchorTime?: Date) => boolean;
196
+ /**
197
+ * The provided date is in the last year.
198
+ * @param {Date} date - The date to compare.
199
+ * @param {Date} [anchorTime] - The reference date.
200
+ * @returns {boolean} return the date is match
201
+ */
202
+ export declare const lastYear: (date: Date, anchorTime?: Date) => boolean;
203
+ /**
204
+ * The provided date is in the year to date.
205
+ * @param {Date} date - The date to compare.
206
+ * @param {Date} [anchorTime] - The reference date.
207
+ * @returns {boolean} return the date is match
208
+ */
209
+ export declare const yearToDate: (date: Date, anchorTime?: Date) => boolean;
210
+ export declare function getDateFilterExecuteFunc(filterInfo: ITableDateFilterInfo): (date: Date) => boolean;
@@ -0,0 +1,7 @@
1
+ import { ICellData, Nullable } from '@univerjs/core';
2
+ /**
3
+ * Get pure text in a cell.
4
+ * @param cell
5
+ * @returns pure text in this cell
6
+ */
7
+ export declare function extractPureTextFromCell(cell: Nullable<ICellData>): string;
@@ -0,0 +1,32 @@
1
+ import { ICalculatedOptions, ITableNumberFilterInfo } from '../../types/type';
2
+ /**
3
+ * @description Checks if a value is above the average.
4
+ * @param {number} value - The value to check.
5
+ * @param {number} average - The average value.
6
+ * @returns {boolean} A boolean value indicating whether the value is above the average.
7
+ */
8
+ export declare const above: (value: number, average: number) => boolean;
9
+ /**
10
+ * @description Checks if a value is below the average.
11
+ * @param {number} value - The value to check.
12
+ * @param {number} average - The average value.
13
+ * @returns {boolean} A boolean value indicating whether the value is below the average.
14
+ */
15
+ export declare const below: (value: number, average: number) => boolean;
16
+ /**
17
+ * @description Gets the largest N values from a list and checks if the expected value is included.
18
+ * @param {number[]} list - The list of numbers.
19
+ * @param {number} top - The number of top values to retrieve.
20
+ * @param {number} expectedValue - The expected value to check for inclusion.
21
+ * @returns {boolean} A boolean value indicating whether the expected value is included in the top N values.
22
+ */
23
+ export declare const getTopN: (list: number[], top: number, expectedValue: number) => boolean;
24
+ /**
25
+ * @description Gets the smallest N values from a list and checks if the expected value is included.
26
+ * @param {number[]} list - The list of numbers.
27
+ * @param {number} bottom - The number of bottom values to retrieve.
28
+ * @param {number} expectedValue - The expected value to check for inclusion.
29
+ * @returns {boolean} A boolean value indicating whether the expected value is included in the bottom N values.
30
+ */
31
+ export declare const getBottomN: (list: number[], bottom: number, expectedValue: number) => boolean;
32
+ export declare function getNumberFilterExecuteFunc(filter: ITableNumberFilterInfo, calculatedOptions: ICalculatedOptions | undefined): (value: number) => boolean;
@@ -0,0 +1,8 @@
1
+ import { ITableStringFilterInfo } from '../../types/type';
2
+ export declare const textEqual: (compareValue: string, expectedValue: string) => boolean;
3
+ export declare const textNotEqual: (compareValue: string, expectedValue: string) => boolean;
4
+ export declare const textContain: (compareValue: string, expectedValue: string) => boolean;
5
+ export declare const textNotContain: (compareValue: string, expectedValue: string) => boolean;
6
+ export declare const textStartWith: (compareValue: string, expectedValue: string) => boolean;
7
+ export declare const textEndWith: (compareValue: string, expectedValue: string) => boolean;
8
+ export declare function getTextFilterExecuteFunc(filter: ITableStringFilterInfo): (value: string) => boolean;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Returns the kth largest element from the given list using a min heap.
18
+ * @param {number[]} list The list of numbers.
19
+ * @param {number} k The value of k.
20
+ * @returns The kth largest element.
21
+ */
22
+ export declare const getLargestK: (list: number[], k: number) => number[];
23
+ /**
24
+ * Returns the kth smallest element from the given list using a max heap.
25
+ * @param {number[]} list The list of numbers.
26
+ * @param {number} k The value of k.
27
+ * @returns The kth smallest element.
28
+ */
29
+ export declare const getSmallestK: (list: number[], k: number) => number[];
@@ -0,0 +1,24 @@
1
+ import { IStyleData } from '@univerjs/core';
2
+ import { TableMetaType } from '../types/type';
3
+ import { TableColumnDataTypeEnum } from '../types/enum';
4
+ export declare class TableColumn {
5
+ dataType: TableColumnDataTypeEnum;
6
+ id: string;
7
+ displayName: string;
8
+ formula: string;
9
+ meta: TableMetaType;
10
+ style: IStyleData;
11
+ constructor(id: string, name: string);
12
+ getMeta(): TableMetaType;
13
+ setMeta(meta: TableMetaType): void;
14
+ getDisplayName(): string;
15
+ toJSON(): {
16
+ id: string;
17
+ displayName: string;
18
+ dataType: TableColumnDataTypeEnum;
19
+ formula: string;
20
+ meta: TableMetaType;
21
+ style: IStyleData;
22
+ };
23
+ fromJSON(json: any): void;
24
+ }
@@ -0,0 +1,26 @@
1
+ import { Worksheet } from '@univerjs/core';
2
+ import { SheetsTableButtonStateEnum, SheetsTableSortStateEnum } from '../types/enum';
3
+ import { ITableFilterItem, ITableFilterJSON, ITableRange } from '../types/type';
4
+ export declare class TableFilters {
5
+ private _tableColumnFilterList;
6
+ private _tableSortInfo;
7
+ private _filterOutRows;
8
+ constructor();
9
+ setColumnFilter(columnIndex: number, filter: ITableFilterItem | undefined): void;
10
+ setSortState(columnIndex: number, sortState: SheetsTableSortStateEnum): void;
11
+ getColumnFilter(columnIndex: number): ITableFilterItem | undefined;
12
+ getFilterState(columnIndex: number): SheetsTableButtonStateEnum;
13
+ getSortState(): {
14
+ columnIndex: number;
15
+ sortState: SheetsTableSortStateEnum;
16
+ };
17
+ getFilterStates(range: ITableRange): SheetsTableButtonStateEnum[];
18
+ getFilterOutRows(): Set<number>;
19
+ doFilter(sheet: Worksheet, range: ITableRange): Set<number>;
20
+ doColumnFilter(sheet: Worksheet, range: ITableRange, columnIndex: number, filterOutRows: Set<number>): void;
21
+ private _getNumberCalculatedOptions;
22
+ getExecuteFunc(sheet: Worksheet, range: ITableRange, columnIndex: number, filter: ITableFilterItem): (value: any) => boolean;
23
+ toJSON(): ITableFilterJSON;
24
+ fromJSON(json: ITableFilterJSON): void;
25
+ dispose(): void;
26
+ }
@@ -0,0 +1,79 @@
1
+ import { IRange, Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
+ import { ITableAddedEvent, ITableDeletedEvent, ITableFilterChangedEvent, ITableFilterItem, ITableInfoWithUnitId, ITableNameChangedEvent, ITableOptions, ITableRange, ITableRangeChangedEvent, ITableRangeRowColOperation, ITableRangeUpdate, ITableRangeWithState, ITableResource, ITableSetConfig, ITableThemeChangedEvent } from '../types/type';
3
+ import { Table } from './table';
4
+ export declare class TableManager extends Disposable {
5
+ private readonly _univerInstanceService;
6
+ private readonly _localeService;
7
+ private _tableMap;
8
+ private _tableAdd$;
9
+ tableAdd$: import('rxjs').Observable<ITableAddedEvent>;
10
+ private _tableDelete$;
11
+ tableDelete$: import('rxjs').Observable<ITableDeletedEvent>;
12
+ private _tableNameChanged$;
13
+ tableNameChanged$: import('rxjs').Observable<ITableNameChangedEvent>;
14
+ private _tableRangeChanged$;
15
+ tableRangeChanged$: import('rxjs').Observable<ITableRangeChangedEvent>;
16
+ private _tableThemeChanged$;
17
+ tableThemeChanged$: import('rxjs').Observable<ITableThemeChangedEvent>;
18
+ private _tableFilterChanged$;
19
+ tableFilterChanged$: import('rxjs').Observable<ITableFilterChangedEvent>;
20
+ private _tableInitStatus;
21
+ tableInitStatus$: import('rxjs').Observable<boolean>;
22
+ constructor(_univerInstanceService: IUniverInstanceService, _localeService: LocaleService);
23
+ private _ensureUnit;
24
+ getColumnHeader(unitId: string, subUnitId: string, range: ITableRange, prefixText?: string): string[];
25
+ /**
26
+ * Add a table to univer.
27
+ * @param {string} unitId The unit id of the table.
28
+ * @param {string} subUnitId The subunit id of the table.
29
+ * @param {string} name The table name, it should be unique in the unit or it will be appended with a number.
30
+ * @param {ITableRange} range The range of the table, it contains the unit id and subunit id.
31
+ * @param {ITableOptions} [options] Other options of the table.
32
+ * @returns {string} The table id.
33
+ */
34
+ addTable(unitId: string, subUnitId: string, name: string, range: ITableRange, header?: string[], initId?: string, options?: ITableOptions): string;
35
+ addFilter(unitId: string, tableId: string, column: number, filter: ITableFilterItem | undefined): void;
36
+ getFilterRanges(unitId: string, subUnitId: string): IRange[];
37
+ getSheetFilterRangeWithState(unitId: string, subUnitId: string): ITableRangeWithState[];
38
+ getTable(unitId: string, tableId: string): Table | undefined;
39
+ /**
40
+ * Get the unique table name, in excel, the table name should be unique because it is used as a reference.
41
+ * @param {string} unitId The unit id of the table.
42
+ * @param {string} baseName The base name of the table.
43
+ * @returns {string} The unique table name
44
+ */
45
+ getUniqueTableName(unitId: string, baseName: string): string;
46
+ /**
47
+ * Get table by unit id and table id.
48
+ * @param {string} unitId The unit id of the table.
49
+ * @param {string} tableId The table id.
50
+ * @returns {Table} The table.
51
+ */
52
+ getTableById(unitId: string, tableId: string): Table | undefined;
53
+ getTableList(unitId: string): ITableInfoWithUnitId[];
54
+ /**
55
+ * Get the table list by unit id and subunit id.
56
+ * @param {string} unitId The unit id of the table.
57
+ * @param {string} subUnitId The subunit id of the table.
58
+ * @returns {Table[]} The table list.
59
+ */
60
+ getTablesBySubunitId(unitId: string, subUnitId: string): Table[];
61
+ getTablesInfoBySubunitId(unitId: string, subUnitId: string): {
62
+ id: string;
63
+ name: string;
64
+ range: {
65
+ startRow: number;
66
+ startColumn: number;
67
+ endRow: number;
68
+ endColumn: number;
69
+ };
70
+ }[];
71
+ deleteTable(unitId: string, tableId: string): void;
72
+ operationTableRowCol(unitId: string, tableId: string, config: ITableRangeRowColOperation): void;
73
+ updateTableRange(unitId: string, tableId: string, config: ITableRangeUpdate): void;
74
+ setTableByConfig(unitId: string, tableId: string, config: ITableSetConfig): void;
75
+ toJSON(unitId: string): ITableResource;
76
+ fromJSON(unitId: string, data: ITableResource): void;
77
+ deleteUnitId(unitId: string): void;
78
+ dispose(): void;
79
+ }
@@ -0,0 +1,81 @@
1
+ import { ITableColumnJson, ITableFilterItem, ITableInfo, ITableJson, ITableOptions, ITableRange } from '../types/type';
2
+ import { TableColumn } from './table-column';
3
+ import { TableFilters } from './table-filter';
4
+ export declare class Table {
5
+ private _id;
6
+ private _name;
7
+ /**
8
+ * @property {string} tableStyleId The table style id. If the property is empty, the default style will be used.
9
+ */
10
+ private _tableStyleId?;
11
+ private _showHeader;
12
+ private _showFooter;
13
+ private _range;
14
+ private _columns;
15
+ private _columnOrder;
16
+ tableMeta: Record<string, any>;
17
+ private _tableFilters;
18
+ private _subUnitId;
19
+ constructor(id: string, name: string, range: ITableRange, header: string[], options?: ITableOptions);
20
+ _init(header: string[], options: ITableOptions): void;
21
+ setTableFilterColumn(columnIndex: number, filter: ITableFilterItem): void;
22
+ getTableFilterColumn(columnIndex: number): ITableFilterItem | undefined;
23
+ getTableFilters(): TableFilters;
24
+ getTableFilterRange(): {
25
+ startRow: number;
26
+ startColumn: number;
27
+ endRow: number;
28
+ endColumn: number;
29
+ };
30
+ setColumns(columns: ITableColumnJson[]): void;
31
+ getColumnsCount(): number;
32
+ insertColumn(index: number, column: TableColumn): void;
33
+ removeColumn(index: number): void;
34
+ setTableMeta(meta: Record<string, any>): void;
35
+ getTableMeta(): Record<string, any>;
36
+ getColumn(columnId: string): TableColumn | undefined;
37
+ getTableColumnByIndex(index: number): TableColumn | undefined;
38
+ getColumnNameByIndex(index: number): string;
39
+ getId(): string;
40
+ getRangeInfo(): {
41
+ startRow: number;
42
+ startColumn: number;
43
+ endRow: number;
44
+ endColumn: number;
45
+ };
46
+ getRange(): {
47
+ startRow: number;
48
+ startColumn: number;
49
+ endRow: number;
50
+ endColumn: number;
51
+ };
52
+ setRange(range: ITableRange): void;
53
+ setDisplayName(name: string): void;
54
+ getDisplayName(): string;
55
+ getSubunitId(): string;
56
+ setSubunitId(subUnitId: string): void;
57
+ getTableStyleId(): string;
58
+ setTableStyleId(tableStyleId: string): void;
59
+ isShowHeader(): boolean;
60
+ setShowHeader(showHeader: boolean): void;
61
+ isShowFooter(): boolean;
62
+ getTableInfo(): ITableInfo;
63
+ getTableConfig(): {
64
+ name: string;
65
+ range: {
66
+ startRow: number;
67
+ startColumn: number;
68
+ endRow: number;
69
+ endColumn: number;
70
+ };
71
+ options: {
72
+ showHeader: boolean;
73
+ showFooter: boolean;
74
+ };
75
+ tableStyleId: string | undefined;
76
+ };
77
+ getFilterStates(range: ITableRange): import('..').SheetsTableButtonStateEnum[];
78
+ toJSON(): ITableJson;
79
+ fromJSON(json: ITableJson): void;
80
+ dispose(): void;
81
+ }
@@ -0,0 +1,12 @@
1
+ import { ICommandService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
+ export declare class UniverSheetTablePlugin extends Plugin {
3
+ private readonly _config;
4
+ protected _injector: Injector;
5
+ private _commandService;
6
+ static pluginName: string;
7
+ static type: UniverInstanceType;
8
+ constructor(_config: {} | undefined, _injector: Injector, _commandService: ICommandService);
9
+ onStarting(): void;
10
+ onReady(): void;
11
+ private _initRegisterCommand;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { Worksheet, Disposable } from '@univerjs/core';
2
+ import { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange, TableMetaType } from '../types/type';
3
+ import { TableManager } from '../model/table-manager';
4
+ import { TableConditionTypeEnum } from '../types/enum';
5
+ export declare class SheetTableService extends Disposable {
6
+ private _tableManager;
7
+ constructor(_tableManager: TableManager);
8
+ getTableInfo(unitId: string, tableId: string): ITableInfoWithUnitId | undefined;
9
+ getTableList(unitId: string): ITableInfoWithUnitId[];
10
+ addTable(unitId: string, subUnitId: string, tableName: string, rangeInfo: ITableRange, tableHeader?: string[], tableId?: string, options?: ITableOptions): string;
11
+ deleteTable(unitId: string, subUnitId: string, tableId: string): void;
12
+ getTableMeta(unitId: string, tableId: string): TableMetaType | undefined;
13
+ setTableMeta(unitId: string, tableId: string, meta: TableMetaType): void;
14
+ getTableColumnMeta(unitId: string, tableId: string, index: number): TableMetaType | undefined;
15
+ selTableColumnMeta(unitId: string, tableId: string, index: number, meta: TableMetaType): void;
16
+ addFilter(unitId: string, tableId: string, column: number, filter: ITableFilterItem): void;
17
+ getCellValueWithConditionType(sheet: Worksheet, row: number, col: number, conditionType?: TableConditionTypeEnum): string | number | Date | null;
18
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export declare enum TableColumnDataTypeEnum {
17
+ None = "none",
18
+ String = "string",
19
+ Number = "number",
20
+ Date = "date",
21
+ Bool = "bool",
22
+ Checkbox = "checkbox",
23
+ List = "list"
24
+ }
25
+ export declare enum TableColumnFilterTypeEnum {
26
+ manual = "manual",
27
+ condition = "condition"
28
+ }
29
+ export declare enum TableConditionTypeEnum {
30
+ Date = "date",
31
+ Number = "number",
32
+ String = "string",
33
+ Logic = "logic"
34
+ }
35
+ export declare enum TableNumberCompareTypeEnum {
36
+ Equal = "equal",
37
+ NotEqual = "notEqual",
38
+ GreaterThan = "greaterThan",
39
+ GreaterThanOrEqual = "greaterThanOrEqual",
40
+ LessThan = "lessThan",
41
+ LessThanOrEqual = "lessThanOrEqual",
42
+ Between = "between",
43
+ NotBetween = "notBetween",
44
+ Above = "above",
45
+ Below = "below",
46
+ TopN = "topN"
47
+ }
48
+ export declare enum TableStringCompareTypeEnum {
49
+ Equal = "equal",
50
+ NotEqual = "notEqual",
51
+ Contains = "contains",
52
+ NotContains = "notContains",
53
+ StartsWith = "startsWith",
54
+ EndsWith = "endsWith"
55
+ }
56
+ export declare enum TableDateCompareTypeEnum {
57
+ Equal = "equal",
58
+ NotEqual = "notEqual",
59
+ After = "after",
60
+ AfterOrEqual = "afterOrEqual",
61
+ Before = "before",
62
+ BeforeOrEqual = "beforeOrEqual",
63
+ Between = "between",
64
+ NotBetween = "notBetween",
65
+ Today = "today",
66
+ Yesterday = "yesterday",
67
+ Tomorrow = "tomorrow",
68
+ ThisWeek = "thisWeek",
69
+ LastWeek = "lastWeek",
70
+ NextWeek = "nextWeek",
71
+ ThisMonth = "thisMonth",
72
+ LastMonth = "lastMonth",
73
+ NextMonth = "nextMonth",
74
+ ThisQuarter = "thisQuarter",
75
+ LastQuarter = "lastQuarter",
76
+ NextQuarter = "nextQuarter",
77
+ ThisYear = "thisYear",
78
+ LastYear = "lastYear",
79
+ NextYear = "nextYear",
80
+ YearToDate = "yearToDate",
81
+ Quarter = "quarter",
82
+ Month = "month",
83
+ M1 = "m1",
84
+ M2 = "m2",
85
+ M3 = "m3",
86
+ M4 = "m4",
87
+ M5 = "m5",
88
+ M6 = "m6",
89
+ M7 = "m7",
90
+ M8 = "m8",
91
+ M9 = "m9",
92
+ M10 = "m10",
93
+ M11 = "m11",
94
+ M12 = "m12",
95
+ Q1 = "q1",
96
+ Q2 = "q2",
97
+ Q3 = "q3",
98
+ Q4 = "q4"
99
+ }
100
+ /**
101
+ * Represents the pivot cell style type enum
102
+ */
103
+ export declare enum SheetsTableButtonStateEnum {
104
+ FilteredSortNone = 1,
105
+ FilteredSortAsc = 2,
106
+ FilteredSortDesc = 3,
107
+ FilterNoneSortNone = 4,
108
+ FilterNoneSortAsc = 5,
109
+ FilterNoneSortDesc = 6
110
+ }
111
+ export declare enum SheetsTableSortStateEnum {
112
+ Asc = "asc",
113
+ Desc = "desc",
114
+ None = "none"
115
+ }