@univerjs/sheets-table 1.3.0 → 1.4.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 (82) hide show
  1. package/README.md +23 -0
  2. package/lib/cjs/facade.js +3 -7
  3. package/lib/cjs/index.js +45 -4960
  4. package/lib/cjs/locale/ar-SA.js +1 -2
  5. package/lib/cjs/locale/ca-ES.js +1 -2
  6. package/lib/cjs/locale/de-DE.js +1 -2
  7. package/lib/cjs/locale/en-US.js +1 -2
  8. package/lib/cjs/locale/es-ES.js +1 -2
  9. package/lib/cjs/locale/fa-IR.js +1 -2
  10. package/lib/cjs/locale/fr-FR.js +1 -2
  11. package/lib/cjs/locale/id-ID.js +1 -2
  12. package/lib/cjs/locale/it-IT.js +1 -2
  13. package/lib/cjs/locale/ja-JP.js +1 -2
  14. package/lib/cjs/locale/ko-KR.js +1 -2
  15. package/lib/cjs/locale/pl-PL.js +1 -2
  16. package/lib/cjs/locale/pt-BR.js +1 -2
  17. package/lib/cjs/locale/ru-RU.js +1 -2
  18. package/lib/cjs/locale/sk-SK.js +1 -2
  19. package/lib/cjs/locale/vi-VN.js +1 -2
  20. package/lib/cjs/locale/zh-CN.js +1 -2
  21. package/lib/cjs/locale/zh-HK.js +1 -2
  22. package/lib/cjs/locale/zh-TW.js +1 -2
  23. package/lib/cjs/plugin-D9zM3t0a.js +5296 -0
  24. package/lib/cjs/worker.js +9 -0
  25. package/lib/es/facade.js +3 -6
  26. package/lib/es/index.js +1 -4916
  27. package/lib/es/locale/ar-SA.js +1 -2
  28. package/lib/es/locale/ca-ES.js +1 -2
  29. package/lib/es/locale/de-DE.js +1 -2
  30. package/lib/es/locale/en-US.js +1 -2
  31. package/lib/es/locale/es-ES.js +1 -2
  32. package/lib/es/locale/fa-IR.js +1 -2
  33. package/lib/es/locale/fr-FR.js +1 -2
  34. package/lib/es/locale/id-ID.js +1 -2
  35. package/lib/es/locale/it-IT.js +1 -2
  36. package/lib/es/locale/ja-JP.js +1 -2
  37. package/lib/es/locale/ko-KR.js +1 -2
  38. package/lib/es/locale/pl-PL.js +1 -2
  39. package/lib/es/locale/pt-BR.js +1 -2
  40. package/lib/es/locale/ru-RU.js +1 -2
  41. package/lib/es/locale/sk-SK.js +1 -2
  42. package/lib/es/locale/vi-VN.js +1 -2
  43. package/lib/es/locale/zh-CN.js +1 -2
  44. package/lib/es/locale/zh-HK.js +1 -2
  45. package/lib/es/locale/zh-TW.js +1 -2
  46. package/lib/es/plugin-D3R6dh5q.js +5039 -0
  47. package/lib/es/worker.js +3 -0
  48. package/lib/facade.js +3 -6
  49. package/lib/index.js +1 -4916
  50. package/lib/locale/ar-SA.js +1 -2
  51. package/lib/locale/ca-ES.js +1 -2
  52. package/lib/locale/de-DE.js +1 -2
  53. package/lib/locale/en-US.js +1 -2
  54. package/lib/locale/es-ES.js +1 -2
  55. package/lib/locale/fa-IR.js +1 -2
  56. package/lib/locale/fr-FR.js +1 -2
  57. package/lib/locale/id-ID.js +1 -2
  58. package/lib/locale/it-IT.js +1 -2
  59. package/lib/locale/ja-JP.js +1 -2
  60. package/lib/locale/ko-KR.js +1 -2
  61. package/lib/locale/pl-PL.js +1 -2
  62. package/lib/locale/pt-BR.js +1 -2
  63. package/lib/locale/ru-RU.js +1 -2
  64. package/lib/locale/sk-SK.js +1 -2
  65. package/lib/locale/vi-VN.js +1 -2
  66. package/lib/locale/zh-CN.js +1 -2
  67. package/lib/locale/zh-HK.js +1 -2
  68. package/lib/locale/zh-TW.js +1 -2
  69. package/lib/plugin-D3R6dh5q.js +5039 -0
  70. package/lib/types/commands/mutations/add-sheet-table.mutation.d.ts +2 -1
  71. package/lib/types/controllers/sheets-table.controller.d.ts +1 -0
  72. package/lib/types/controllers/table-theme.factory.d.ts +25 -25
  73. package/lib/types/models/filter-util/condition.d.ts +1 -1
  74. package/lib/types/models/filter-util/date-filter-util.d.ts +1 -1
  75. package/lib/types/models/table-dxf.d.ts +25 -0
  76. package/lib/types/models/table-manager.d.ts +2 -2
  77. package/lib/types/models/table.d.ts +4 -4
  78. package/lib/types/services/table.service.d.ts +2 -2
  79. package/lib/types/worker.d.ts +16 -0
  80. package/lib/umd/index.js +1 -1
  81. package/lib/worker.js +3 -0
  82. package/package.json +16 -11
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IMutation } from '@univerjs/core';
17
- import type { ITableOptions, ITableRange } from '../../types/type';
17
+ import type { ITableOptions, ITableRange, TableMetaType } from '../../types/type';
18
18
  export interface IAddSheetTableParams {
19
19
  unitId: string;
20
20
  subUnitId: string;
@@ -23,6 +23,7 @@ export interface IAddSheetTableParams {
23
23
  options?: ITableOptions;
24
24
  tableId?: string;
25
25
  header?: string[];
26
+ meta?: TableMetaType;
26
27
  }
27
28
  export declare const AddSheetTableMutation: IMutation<IAddSheetTableParams & {
28
29
  tableId: string;
@@ -27,6 +27,7 @@ export declare class SheetsTableController extends Disposable {
27
27
  getContainerTableWithRange(unitId: string, subUnitId: string, range: IRange): import("../models/table").Table | undefined;
28
28
  private _ensureTableRangeRTree;
29
29
  registerTableChangeEvent(): void;
30
+ registerTableStyleInterceptor(): void;
30
31
  registerTableHeaderInterceptor(): void;
31
32
  private _toJson;
32
33
  private _fromJSON;
@@ -16,7 +16,13 @@
16
16
  import type { IRangeThemeStyleItem, IRangeThemeStyleJSON } from '@univerjs/sheets';
17
17
  import type { ITableDefaultThemeStyle } from '../config/config';
18
18
  export declare const customEmptyThemeWithBorderStyle: Omit<IRangeThemeStyleJSON, 'name'>;
19
- export declare const processStyleWithBorderStyle: (key: keyof Omit<IRangeThemeStyleJSON, "name">, style: IRangeThemeStyleItem) => IRangeThemeStyleItem | {
19
+ export declare const processStyleWithBorderStyle: (key: keyof Omit<IRangeThemeStyleJSON, 'name'>, style: IRangeThemeStyleItem) => IRangeThemeStyleItem | {
20
+ bl?: import("@univerjs/core").BooleanNumber;
21
+ ol?: import("@univerjs/core").ITextDecoration;
22
+ bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
23
+ cl?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
24
+ ht?: import("@univerjs/core").Nullable<import("@univerjs/core").HorizontalAlign>;
25
+ vt?: import("@univerjs/core").Nullable<import("@univerjs/core").VerticalAlign>;
20
26
  bd: {
21
27
  t: {
22
28
  s: import("@univerjs/core").BorderStyleTypes;
@@ -28,65 +34,59 @@ export declare const processStyleWithBorderStyle: (key: keyof Omit<IRangeThemeSt
28
34
  r?: undefined;
29
35
  l?: undefined;
30
36
  };
37
+ } | {
38
+ bl?: import("@univerjs/core").BooleanNumber;
39
+ ol?: import("@univerjs/core").ITextDecoration;
40
+ bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
31
41
  cl?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
32
- bl?: import("@univerjs/core").BooleanNumber | undefined;
33
42
  ht?: import("@univerjs/core").Nullable<import("@univerjs/core").HorizontalAlign>;
34
43
  vt?: import("@univerjs/core").Nullable<import("@univerjs/core").VerticalAlign>;
35
- ol?: import("@univerjs/core").ITextDecoration | undefined;
36
- bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
37
- } | {
38
44
  bd: {
45
+ t?: undefined;
39
46
  b: {
40
47
  s: import("@univerjs/core").BorderStyleTypes;
41
48
  cl: {
42
49
  rgb: string;
43
50
  };
44
51
  };
45
- t?: undefined;
46
52
  r?: undefined;
47
53
  l?: undefined;
48
54
  };
55
+ } | {
56
+ bl?: import("@univerjs/core").BooleanNumber;
57
+ ol?: import("@univerjs/core").ITextDecoration;
58
+ bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
49
59
  cl?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
50
- bl?: import("@univerjs/core").BooleanNumber | undefined;
51
60
  ht?: import("@univerjs/core").Nullable<import("@univerjs/core").HorizontalAlign>;
52
61
  vt?: import("@univerjs/core").Nullable<import("@univerjs/core").VerticalAlign>;
53
- ol?: import("@univerjs/core").ITextDecoration | undefined;
54
- bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
55
- } | {
56
62
  bd: {
63
+ t?: undefined;
64
+ b?: undefined;
57
65
  r: {
58
66
  s: import("@univerjs/core").BorderStyleTypes;
59
67
  cl: {
60
68
  rgb: string;
61
69
  };
62
70
  };
63
- t?: undefined;
64
- b?: undefined;
65
71
  l?: undefined;
66
72
  };
73
+ } | {
74
+ bl?: import("@univerjs/core").BooleanNumber;
75
+ ol?: import("@univerjs/core").ITextDecoration;
76
+ bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
67
77
  cl?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
68
- bl?: import("@univerjs/core").BooleanNumber | undefined;
69
78
  ht?: import("@univerjs/core").Nullable<import("@univerjs/core").HorizontalAlign>;
70
79
  vt?: import("@univerjs/core").Nullable<import("@univerjs/core").VerticalAlign>;
71
- ol?: import("@univerjs/core").ITextDecoration | undefined;
72
- bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
73
- } | {
74
80
  bd: {
81
+ t?: undefined;
82
+ b?: undefined;
83
+ r?: undefined;
75
84
  l: {
76
85
  s: import("@univerjs/core").BorderStyleTypes;
77
86
  cl: {
78
87
  rgb: string;
79
88
  };
80
89
  };
81
- t?: undefined;
82
- b?: undefined;
83
- r?: undefined;
84
90
  };
85
- cl?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
86
- bl?: import("@univerjs/core").BooleanNumber | undefined;
87
- ht?: import("@univerjs/core").Nullable<import("@univerjs/core").HorizontalAlign>;
88
- vt?: import("@univerjs/core").Nullable<import("@univerjs/core").VerticalAlign>;
89
- ol?: import("@univerjs/core").ITextDecoration | undefined;
90
- bg?: import("@univerjs/core").Nullable<import("@univerjs/core").IColorStyle>;
91
91
  };
92
92
  export declare const tableThemeConfig: ITableDefaultThemeStyle[];
@@ -21,7 +21,7 @@ import { TableConditionTypeEnum, TableDateCompareTypeEnum, TableNumberCompareTyp
21
21
  type TableConditionCompareType = TableNumberCompareTypeEnum | TableDateCompareTypeEnum | TableStringCompareTypeEnum;
22
22
  export declare function isNumberDynamicFilter(compareType: TableConditionCompareType): compareType is TableNumberCompareTypeEnum;
23
23
  export declare function isDateDynamicFilter(compareType: TableConditionCompareType): compareType is TableDateCompareTypeEnum;
24
- export declare function getConditionExecuteFunc(filter: ITableConditionFilterItem, calculatedOptions: ICalculatedOptions | undefined): ((date: Date) => boolean) | ((value: number) => boolean) | ((value: string) => boolean);
24
+ export declare function getConditionExecuteFunc(filter: ITableConditionFilterItem, calculatedOptions: ICalculatedOptions | undefined): typeof import("./date-filter-util").dateQ1 | ((value: number) => boolean) | ((value: string) => boolean);
25
25
  export declare function getCellValueWithConditionType(sheet: Worksheet, row: number, col: number, conditionType: TableConditionTypeEnum, dateSystem?: DateSystem): string | number | Date | null | undefined;
26
26
  export declare const getStringFromDataStream: (data: IDocumentData) => string;
27
27
  declare function excelSerialToDateTimeLocal(serial: number, dateSystem?: DateSystem): Date;
@@ -222,4 +222,4 @@ export declare const lastYear: (date: Date, anchorTime?: Date) => boolean;
222
222
  * @returns {boolean} return the date is match
223
223
  */
224
224
  export declare const yearToDate: (date: Date, anchorTime?: Date) => boolean;
225
- export declare function getDateFilterExecuteFunc(filterInfo: ITableDateFilterInfo): (date: Date) => boolean;
225
+ export declare function getDateFilterExecuteFunc(filterInfo: ITableDateFilterInfo): typeof dateQ1;
@@ -0,0 +1,25 @@
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 { ITableColumnJson, TableMetaType } from '../types/type';
18
+ import type { Table } from './table';
19
+ export declare function hasTableDxfStyles(table: {
20
+ meta?: TableMetaType;
21
+ columns?: ITableColumnJson[];
22
+ }): boolean;
23
+ export declare function isImportedTableWithoutTheme(table: Table): boolean;
24
+ /** Resolve table-owned formats without assigning a direct style to the cell. */
25
+ export declare function getTableDxfStyle(table: Table, row: number, col: number): IStyleData | undefined;
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
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
17
  import { Disposable, IUniverInstanceService, LocaleService } from '@univerjs/core';
18
+ import type { ITableAddedEvent, ITableDeletedEvent, ITableFilterChangedEvent, ITableFilterItem, ITableInfoWithUnitId, ITableNameChangedEvent, ITableOptions, ITableRange, ITableRangeChangedEvent, ITableRangeRowColOperation, ITableRangeUpdate, ITableRangeWithState, ITableResource, ITableSetConfig, ITableThemeChangedEvent, TableMetaType } from '../types/type';
19
19
  import { Table } from './table';
20
20
  export declare class TableManager extends Disposable {
21
21
  private readonly _univerInstanceService;
@@ -49,7 +49,7 @@ export declare class TableManager extends Disposable {
49
49
  * @param {ITableOptions} [options] Other options of the table.
50
50
  * @returns {string} The table id.
51
51
  */
52
- addTable(unitId: string, subUnitId: string, name: string, range: ITableRange, header?: string[], initId?: string, options?: ITableOptions): string;
52
+ addTable(unitId: string, subUnitId: string, name: string, range: ITableRange, header?: string[], initId?: string, options?: ITableOptions, meta?: TableMetaType): string;
53
53
  addFilter(unitId: string, tableId: string, column: number, filter: ITableFilterItem | undefined): void;
54
54
  getFilterRanges(unitId: string, subUnitId: string): IRange[];
55
55
  getSheetFilterRangeWithState(unitId: string, subUnitId: string): ITableRangeWithState[];
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ITableColumnJson, ITableFilterItem, ITableInfo, ITableJson, ITableOptions, ITableRange } from '../types/type';
16
+ import type { ITableColumnJson, ITableFilterItem, ITableInfo, ITableJson, ITableOptions, ITableRange, TableMetaType } from '../types/type';
17
17
  import { TableColumn } from './table-column';
18
18
  import { TableFilters } from './table-filter';
19
19
  export declare class Table {
@@ -29,7 +29,7 @@ export declare class Table {
29
29
  private _range;
30
30
  private _columns;
31
31
  private _columnOrder;
32
- tableMeta: Record<string, any>;
32
+ tableMeta: TableMetaType;
33
33
  private _tableFilters;
34
34
  private _subUnitId;
35
35
  constructor(id: string, name: string, range: ITableRange, header: string[], options?: ITableOptions);
@@ -47,8 +47,8 @@ export declare class Table {
47
47
  getColumnsCount(): number;
48
48
  insertColumn(index: number, column: TableColumn): void;
49
49
  removeColumn(index: number): void;
50
- setTableMeta(meta: Record<string, any>): void;
51
- getTableMeta(): Record<string, any>;
50
+ setTableMeta(meta: TableMetaType): void;
51
+ getTableMeta(): TableMetaType;
52
52
  getColumn(columnId: string): TableColumn | undefined;
53
53
  getTableColumnByIndex(index: number): TableColumn | undefined;
54
54
  getColumnNameByIndex(index: number): string;
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { Worksheet } from '@univerjs/core';
17
- import type { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange, TableMetaType } from '../types/type';
18
17
  import { Disposable } from '@univerjs/core';
18
+ import type { ITableFilterItem, ITableInfoWithUnitId, ITableOptions, ITableRange, TableMetaType } from '../types/type';
19
19
  import { TableManager } from '../models/table-manager';
20
20
  import { TableConditionTypeEnum } from '../types/enum';
21
21
  export declare class SheetTableService extends Disposable {
@@ -23,7 +23,7 @@ export declare class SheetTableService extends Disposable {
23
23
  constructor(_tableManager: TableManager);
24
24
  getTableInfo(unitId: string, tableId: string): ITableInfoWithUnitId | undefined;
25
25
  getTableList(unitId: string): ITableInfoWithUnitId[];
26
- addTable(unitId: string, subUnitId: string, tableName: string, rangeInfo: ITableRange, tableHeader?: string[], tableId?: string, options?: ITableOptions): string;
26
+ addTable(unitId: string, subUnitId: string, tableName: string, rangeInfo: ITableRange, tableHeader?: string[], tableId?: string, options?: ITableOptions, meta?: TableMetaType): string;
27
27
  deleteTable(unitId: string, subUnitId: string, tableId: string): void;
28
28
  getTableMeta(unitId: string, tableId: string): TableMetaType | undefined;
29
29
  setTableMeta(unitId: string, tableId: string, meta: TableMetaType): void;
@@ -0,0 +1,16 @@
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 { UniverSheetsTablePlugin } from './plugin';