@univerjs/sheets-table 0.17.0 → 0.18.0

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 (44) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/es/facade.js +1 -165
  4. package/lib/es/index.js +1 -2922
  5. package/lib/facade.js +1 -165
  6. package/lib/index.js +1 -2922
  7. package/lib/types/commands/commands/add-sheet-table.command.d.ts +17 -2
  8. package/lib/types/commands/commands/add-table-theme.command.d.ts +17 -2
  9. package/lib/types/commands/commands/delete-sheet-table.command.d.ts +17 -2
  10. package/lib/types/commands/commands/remove-table-theme.command.d.ts +16 -1
  11. package/lib/types/commands/commands/set-sheet-table.command.d.ts +17 -2
  12. package/lib/types/commands/commands/set-table-filter.command.d.ts +17 -2
  13. package/lib/types/commands/commands/sheet-table-row-col.command.d.ts +16 -1
  14. package/lib/types/commands/mutations/add-sheet-table.mutation.d.ts +17 -2
  15. package/lib/types/commands/mutations/delete-sheet-table.mutation.d.ts +16 -1
  16. package/lib/types/commands/mutations/set-sheet-table.mutation.d.ts +17 -2
  17. package/lib/types/commands/mutations/set-table-filter.mutation.d.ts +17 -2
  18. package/lib/types/config/config.d.ts +16 -1
  19. package/lib/types/controllers/sheet-table-formula.controller.d.ts +15 -0
  20. package/lib/types/controllers/sheet-table-range.controller.d.ts +15 -0
  21. package/lib/types/controllers/sheet-table-ref-range.controller.d.ts +15 -0
  22. package/lib/types/controllers/sheet-table-theme.controller.d.ts +15 -0
  23. package/lib/types/controllers/sheets-table.controller.d.ts +18 -2
  24. package/lib/types/controllers/table-filter.controller.d.ts +16 -1
  25. package/lib/types/controllers/table-theme.factory.d.ts +45 -30
  26. package/lib/types/facade/f-enum.d.ts +15 -0
  27. package/lib/types/facade/f-workbook.d.ts +16 -1
  28. package/lib/types/facade/f-worksheet.d.ts +17 -2
  29. package/lib/types/model/filter-util/condition.d.ts +19 -3
  30. package/lib/types/model/filter-util/date-filter-util.d.ts +16 -1
  31. package/lib/types/model/filter-util/manual.d.ts +16 -1
  32. package/lib/types/model/filter-util/number-filter-util.d.ts +16 -1
  33. package/lib/types/model/filter-util/text-filter-util.d.ts +16 -1
  34. package/lib/types/model/table-column.d.ts +17 -2
  35. package/lib/types/model/table-filter.d.ts +19 -3
  36. package/lib/types/model/table-manager.d.ts +25 -9
  37. package/lib/types/model/table.d.ts +17 -2
  38. package/lib/types/plugin.d.ts +16 -1
  39. package/lib/types/services/table-service.d.ts +18 -2
  40. package/lib/types/types/type.d.ts +17 -2
  41. package/lib/types/util.d.ts +19 -4
  42. package/lib/umd/facade.js +1 -1
  43. package/lib/umd/index.js +1 -1
  44. package/package.json +9 -8
@@ -1,4 +1,19 @@
1
- import { ITableDateFilterInfo } from '../../types/type';
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
+ import type { ITableDateFilterInfo } from '../../types/type';
2
17
  /**
3
18
  * The provided date is a date in Q1 of the year.
4
19
  * @param {Date} date - The date to compare.
@@ -1,4 +1,19 @@
1
- import { ICellData, Nullable } from '@univerjs/core';
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
+ import type { ICellData, Nullable } from '@univerjs/core';
2
17
  /**
3
18
  * Get pure text in a cell.
4
19
  * @param cell
@@ -1,4 +1,19 @@
1
- import { ICalculatedOptions, ITableNumberFilterInfo } from '../../types/type';
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
+ import type { ICalculatedOptions, ITableNumberFilterInfo } from '../../types/type';
2
17
  /**
3
18
  * @description Checks if a value is above the average.
4
19
  * @param {number} value - The value to check.
@@ -1,4 +1,19 @@
1
- import { ITableStringFilterInfo } from '../../types/type';
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
+ import type { ITableStringFilterInfo } from '../../types/type';
2
17
  export declare const textEqual: (compareValue: string, expectedValue: string) => boolean;
3
18
  export declare const textNotEqual: (compareValue: string, expectedValue: string) => boolean;
4
19
  export declare const textContain: (compareValue: string, expectedValue: string) => boolean;
@@ -1,5 +1,20 @@
1
- import { IStyleData } from '@univerjs/core';
2
- import { TableMetaType } from '../types/type';
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
+ import type { IStyleData } from '@univerjs/core';
17
+ import type { TableMetaType } from '../types/type';
3
18
  import { TableColumnDataTypeEnum } from '../types/enum';
4
19
  export declare class TableColumn {
5
20
  dataType: TableColumnDataTypeEnum;
@@ -1,6 +1,22 @@
1
- import { Worksheet } from '@univerjs/core';
2
- import { SheetsTableButtonStateEnum, SheetsTableSortStateEnum } from '../types/enum';
3
- import { ITableFilterItem, ITableFilterJSON, ITableRange } from '../types/type';
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
+ import type { Worksheet } from '@univerjs/core';
17
+ import type { SheetsTableButtonStateEnum } from '../types/enum';
18
+ import type { ITableFilterItem, ITableFilterJSON, ITableRange } from '../types/type';
19
+ import { SheetsTableSortStateEnum } from '../types/enum';
4
20
  export declare class TableFilters {
5
21
  private _tableColumnFilterList;
6
22
  private _tableSortInfo;
@@ -1,24 +1,40 @@
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';
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
+ import type { IRange } from '@univerjs/core';
17
+ import type { ITableAddedEvent, ITableDeletedEvent, ITableFilterChangedEvent, ITableFilterItem, ITableInfoWithUnitId, ITableNameChangedEvent, ITableOptions, ITableRange, ITableRangeChangedEvent, ITableRangeRowColOperation, ITableRangeUpdate, ITableRangeWithState, ITableResource, ITableSetConfig, ITableThemeChangedEvent } from '../types/type';
18
+ import { Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
3
19
  import { Table } from './table';
4
20
  export declare class TableManager extends Disposable {
5
21
  private readonly _univerInstanceService;
6
22
  private readonly _localeService;
7
23
  private _tableMap;
8
24
  private _tableAdd$;
9
- tableAdd$: import('rxjs').Observable<ITableAddedEvent>;
25
+ tableAdd$: import("rxjs").Observable<ITableAddedEvent>;
10
26
  private _tableDelete$;
11
- tableDelete$: import('rxjs').Observable<ITableDeletedEvent>;
27
+ tableDelete$: import("rxjs").Observable<ITableDeletedEvent>;
12
28
  private _tableNameChanged$;
13
- tableNameChanged$: import('rxjs').Observable<ITableNameChangedEvent>;
29
+ tableNameChanged$: import("rxjs").Observable<ITableNameChangedEvent>;
14
30
  private _tableRangeChanged$;
15
- tableRangeChanged$: import('rxjs').Observable<ITableRangeChangedEvent>;
31
+ tableRangeChanged$: import("rxjs").Observable<ITableRangeChangedEvent>;
16
32
  private _tableThemeChanged$;
17
- tableThemeChanged$: import('rxjs').Observable<ITableThemeChangedEvent>;
33
+ tableThemeChanged$: import("rxjs").Observable<ITableThemeChangedEvent>;
18
34
  private _tableFilterChanged$;
19
- tableFilterChanged$: import('rxjs').Observable<ITableFilterChangedEvent>;
35
+ tableFilterChanged$: import("rxjs").Observable<ITableFilterChangedEvent>;
20
36
  private _tableInitStatus;
21
- tableInitStatus$: import('rxjs').Observable<boolean>;
37
+ tableInitStatus$: import("rxjs").Observable<boolean>;
22
38
  constructor(_univerInstanceService: IUniverInstanceService, _localeService: LocaleService);
23
39
  private _ensureUnit;
24
40
  getColumnHeader(unitId: string, subUnitId: string, range: ITableRange, prefixText?: string): string[];
@@ -1,4 +1,19 @@
1
- import { ITableColumnJson, ITableFilterItem, ITableInfo, ITableJson, ITableOptions, ITableRange } from '../types/type';
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
+ import type { ITableColumnJson, ITableFilterItem, ITableInfo, ITableJson, ITableOptions, ITableRange } from '../types/type';
2
17
  import { TableColumn } from './table-column';
3
18
  import { TableFilters } from './table-filter';
4
19
  export declare class Table {
@@ -74,7 +89,7 @@ export declare class Table {
74
89
  };
75
90
  tableStyleId: string | undefined;
76
91
  };
77
- getFilterStates(range: ITableRange): import('..').SheetsTableButtonStateEnum[];
92
+ getFilterStates(range: ITableRange): import("..").SheetsTableButtonStateEnum[];
78
93
  toJSON(): ITableJson;
79
94
  fromJSON(json: ITableJson): void;
80
95
  dispose(): void;
@@ -1,4 +1,19 @@
1
- import { IUniverSheetsTableConfig } from './config/config';
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
+ import type { IUniverSheetsTableConfig } from './config/config';
2
17
  import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
3
18
  export declare class UniverSheetsTablePlugin extends Plugin {
4
19
  private readonly _config;
@@ -1,5 +1,21 @@
1
- import { Worksheet, Disposable } from '@univerjs/core';
2
- import { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange, TableMetaType } from '../types/type';
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
+ import type { Worksheet } from '@univerjs/core';
17
+ import type { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange, TableMetaType } from '../types/type';
18
+ import { Disposable } from '@univerjs/core';
3
19
  import { TableManager } from '../model/table-manager';
4
20
  import { TableConditionTypeEnum } from '../types/enum';
5
21
  export declare class SheetTableService extends Disposable {
@@ -1,5 +1,20 @@
1
- import { IRange, IStyleData, Nullable } from '@univerjs/core';
2
- import { SheetsTableButtonStateEnum, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from './enum';
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
+ import type { IRange, IStyleData, Nullable } from '@univerjs/core';
17
+ import type { SheetsTableButtonStateEnum, SheetsTableSortStateEnum, TableColumnDataTypeEnum, TableColumnFilterTypeEnum, TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTypeEnum, TableStringCompareTypeEnum } from './enum';
3
18
  export interface ITableRange {
4
19
  startRow: number;
5
20
  startColumn: number;
@@ -1,7 +1,22 @@
1
- import { ICellData, IDocumentData, IUniverInstanceService, Nullable } from '@univerjs/core';
2
- import { IDefinedNamesService } from '@univerjs/engine-formula';
3
- import { TableManager } from './model/table-manager';
4
- import { ITableConditionFilterItem, ITableFilterItem, ITableManualFilterItem } from './types/type';
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
+ import type { ICellData, IDocumentData, IUniverInstanceService, Nullable } from '@univerjs/core';
17
+ import type { IDefinedNamesService } from '@univerjs/engine-formula';
18
+ import type { TableManager } from './model/table-manager';
19
+ import type { ITableConditionFilterItem, ITableFilterItem, ITableManualFilterItem } from './types/type';
5
20
  import { SheetsTableButtonStateEnum, SheetsTableSortStateEnum } from './types/enum';
6
21
  export declare function getColumnName(columnIndex: number, columnText: string): string;
7
22
  export declare const getStringFromDataStream: (data: IDocumentData) => string;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(r,i){typeof exports=="object"&&typeof module<"u"?i(require("@univerjs/core"),require("@univerjs/sheets-table"),require("@univerjs/sheets/facade"),require("@univerjs/sheets"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/sheets-table","@univerjs/sheets/facade","@univerjs/sheets","@univerjs/core/facade"],i):(r=typeof globalThis<"u"?globalThis:r||self,i(r.UniverCore,r.UniverSheetsTable,r.UniverSheetsFacade,r.UniverSheets,r.UniverCoreFacade))})(this,(function(r,i,l,I,b){"use strict";class f extends l.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,a,s){var T;const c=this._injector.get(i.SheetTableService),o=this._injector.get(r.LocaleService),m=this._injector.get(r.IUniverInstanceService).getCurrentUnitOfType(r.UniverInstanceType.UNIVER_SHEET),S=new Set;if(m&&m.getSheets().forEach(h=>{S.add(h.getName())}),!r.customNameCharacterCheck(t,S)){this._injector.get(r.ILogService).warn(o.t("sheets-table.tableNameError"));return}const u={unitId:this.getId(),name:t,subUnitId:e,range:n,options:s,id:a};if(await this._commandService.executeCommand(i.AddSheetTableCommand.id,u))return(T=c.getTableList(this.getId()).find(h=>h.name===t))==null?void 0:T.id}async removeTable(e){var a;const t=(a=this.getTableInfo(e))==null?void 0:a.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 a={unitId:this.getId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(i.SetSheetTableFilterCommand.id,a)}}l.FWorkbook.extend(f);class C extends l.FWorksheet{addTable(e,t,n,a){const s=this.getSheetId(),c=this.getWorkbook(),o=c.getUnitId(),d=this._injector.get(r.LocaleService),m=new Set;if(c&&c.getSheets().forEach(u=>{m.add(u.getName())}),!r.customNameCharacterCheck(e,m))return this._injector.get(r.ILogService).warn(d.t("sheets-table.tableNameError")),!1;const v={unitId:o,subUnitId:s,name:e,range:t,id:n,options:a};return this._commandService.executeCommand(i.AddSheetTableCommand.id,v)}setTableFilter(e,t,n){const a={unitId:this.getWorkbook().getUnitId(),tableId:e,column:t,tableFilter:n};return this._commandService.executeCommand(i.SetSheetTableFilterCommand.id,a)}removeTable(e){const t={unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),tableId:e};return this._commandService.executeCommand(i.DeleteSheetTableCommand.id,t)}setTableRange(e,t){const n={unitId:this.getWorkbook().getUnitId(),tableId:e,updateRange:{newRange:t}};return this._commandService.executeCommand(i.SetSheetTableCommand.id,n)}setTableName(e,t){const n=this.getWorkbook(),a=this._injector.get(r.LocaleService),s=new Set;if(n&&n.getSheets().forEach(d=>{s.add(d.getName())}),!r.customNameCharacterCheck(t,s))return this._injector.get(r.ILogService).warn(a.t("sheets-table.tableNameError")),!1;const o={unitId:this.getWorkbook().getUnitId(),tableId:e,name:t};return this._commandService.executeCommand(i.SetSheetTableCommand.id,o)}getSubTableInfos(){const e=this._fWorkbook.getId();return this._injector.get(i.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(i.SetSheetTableFilterCommand.id,n)}getTableByCell(e,t){const n=this._fWorkbook.getId(),s=this._injector.get(i.SheetTableService).getTableList(n).filter(o=>o.subUnitId===this.getSheetId()),c=r.cellToRange(e,t);return s.find(o=>{const d=o.range;return r.Rectangle.intersects(d,c)})}addTableTheme(e,t){const n=new I.RangeThemeStyle("table-style");return n.fromJson(t),this._commandService.executeCommand(i.AddTableThemeCommand.id,{unitId:this._fWorkbook.getId(),tableId:e,themeStyle:n})}}l.FWorksheet.extend(C);class k extends b.FEnum{get TableColumnFilterTypeEnum(){return i.TableColumnFilterTypeEnum}get TableConditionTypeEnum(){return i.TableConditionTypeEnum}get TableNumberCompareTypeEnum(){return i.TableNumberCompareTypeEnum}get TableStringCompareTypeEnum(){return i.TableStringCompareTypeEnum}get TableDateCompareTypeEnum(){return i.TableDateCompareTypeEnum}}b.FEnum.extend(k)}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(require(`@univerjs/core`),require(`@univerjs/sheets-table`),require(`@univerjs/sheets/facade`),require(`@univerjs/sheets`),require(`@univerjs/core/facade`)):typeof define==`function`&&define.amd?define([`@univerjs/core`,`@univerjs/sheets-table`,`@univerjs/sheets/facade`,`@univerjs/sheets`,`@univerjs/core/facade`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore,e.UniverSheetsTable,e.UniverSheetsFacade,e.UniverSheets,e.UniverCoreFacade))})(this,function(e,t,n,r,i){var a=class extends n.FWorkbook{getTableInfo(e){let n=this.getId();return this._injector.get(t.SheetTableService).getTableInfo(n,e)}getTableList(){let e=this.getId();return this._injector.get(t.SheetTableService).getTableList(e)}async addTable(n,r,i,a,o){let s=this._injector.get(t.SheetTableService),c=this._injector.get(e.LocaleService),l=this._injector.get(e.IUniverInstanceService).getCurrentUnitOfType(e.UniverInstanceType.UNIVER_SHEET),u=new Set;if(l&&l.getSheets().forEach(e=>{u.add(e.getName())}),!(0,e.customNameCharacterCheck)(r,u)){this._injector.get(e.ILogService).warn(c.t(`sheets-table.tableNameError`));return}let d={unitId:this.getId(),name:r,subUnitId:n,range:i,options:o,id:a};if(await this._commandService.executeCommand(t.AddSheetTableCommand.id,d)){var f;return(f=s.getTableList(this.getId()).find(e=>e.name===r))==null?void 0:f.id}}async removeTable(e){var n;let r=(n=this.getTableInfo(e))==null?void 0:n.subUnitId;if(!r)return!1;let i={unitId:this.getId(),subUnitId:r,tableId:e};return this._commandService.executeCommand(t.DeleteSheetTableCommand.id,i)}getTableInfoByName(e){return this.getTableList().find(t=>t.name===e)}setTableFilter(e,n,r){let i={unitId:this.getId(),tableId:e,column:n,tableFilter:r};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,i)}};n.FWorkbook.extend(a);var o=class extends n.FWorksheet{addTable(n,r,i,a){let o=this.getSheetId(),s=this.getWorkbook(),c=s.getUnitId(),l=this._injector.get(e.LocaleService),u=new Set;if(s&&s.getSheets().forEach(e=>{u.add(e.getName())}),!(0,e.customNameCharacterCheck)(n,u))return this._injector.get(e.ILogService).warn(l.t(`sheets-table.tableNameError`)),!1;let d={unitId:c,subUnitId:o,name:n,range:r,id:i,options:a};return this._commandService.executeCommand(t.AddSheetTableCommand.id,d)}setTableFilter(e,n,r){let i={unitId:this.getWorkbook().getUnitId(),tableId:e,column:n,tableFilter:r};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,i)}removeTable(e){let n={unitId:this._fWorkbook.getId(),subUnitId:this.getSheetId(),tableId:e};return this._commandService.executeCommand(t.DeleteSheetTableCommand.id,n)}setTableRange(e,n){let r={unitId:this.getWorkbook().getUnitId(),tableId:e,updateRange:{newRange:n}};return this._commandService.executeCommand(t.SetSheetTableCommand.id,r)}setTableName(n,r){let i=this.getWorkbook(),a=this._injector.get(e.LocaleService),o=new Set;if(i&&i.getSheets().forEach(e=>{o.add(e.getName())}),!(0,e.customNameCharacterCheck)(r,o))return this._injector.get(e.ILogService).warn(a.t(`sheets-table.tableNameError`)),!1;let s={unitId:this.getWorkbook().getUnitId(),tableId:n,name:r};return this._commandService.executeCommand(t.SetSheetTableCommand.id,s)}getSubTableInfos(){let e=this._fWorkbook.getId();return this._injector.get(t.SheetTableService).getTableList(e).filter(e=>e.subUnitId===this.getSheetId())}resetFilter(e,n){let r={unitId:this._fWorkbook.getId(),tableId:e,column:n,tableFilter:void 0};return this._commandService.executeCommand(t.SetSheetTableFilterCommand.id,r)}getTableByCell(n,r){let i=this._fWorkbook.getId(),a=this._injector.get(t.SheetTableService).getTableList(i).filter(e=>e.subUnitId===this.getSheetId()),o=(0,e.cellToRange)(n,r);return a.find(t=>{let n=t.range;return e.Rectangle.intersects(n,o)})}addTableTheme(e,n){let i=new r.RangeThemeStyle(`table-style`);return i.fromJson(n),this._commandService.executeCommand(t.AddTableThemeCommand.id,{unitId:this._fWorkbook.getId(),tableId:e,themeStyle:i})}};n.FWorksheet.extend(o);var s=class extends i.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}};i.FEnum.extend(s)});