@univerjs-pro/sheets-pivot 0.2.7

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 (51) hide show
  1. package/README.md +34 -0
  2. package/lib/cjs/index.js +1 -0
  3. package/lib/es/index.js +1 -0
  4. package/lib/locale/en-US.json +30 -0
  5. package/lib/locale/ru-RU.json +30 -0
  6. package/lib/locale/vi-VN.json +30 -0
  7. package/lib/locale/zh-CN.json +30 -0
  8. package/lib/locale/zh-TW.json +30 -0
  9. package/lib/types/commands/command/add-pivot-table-with-config.command.d.ts +4 -0
  10. package/lib/types/commands/command/util.d.ts +13 -0
  11. package/lib/types/commands/mutations/add-pivot-field.mutation.d.ts +4 -0
  12. package/lib/types/commands/mutations/add-pivot-table.mutation.d.ts +4 -0
  13. package/lib/types/commands/mutations/change-apply-util.d.ts +15 -0
  14. package/lib/types/commands/mutations/pivot-data-communication.mutation.d.ts +7 -0
  15. package/lib/types/commands/mutations/remove-pivot-field.mutation.d.ts +4 -0
  16. package/lib/types/commands/mutations/remove-pivot-table.mutation.d.ts +4 -0
  17. package/lib/types/commands/mutations/rename-pivot-field.mutation.d.ts +4 -0
  18. package/lib/types/commands/mutations/set-pivot-collapse.mutation.d.ts +4 -0
  19. package/lib/types/commands/mutations/set-pivot-field-format.mutation.d.ts +4 -0
  20. package/lib/types/commands/mutations/set-pivot-filter.mutation.d.ts +4 -0
  21. package/lib/types/commands/mutations/set-pivot-option.mutation.d.ts +4 -0
  22. package/lib/types/commands/mutations/set-pivot-position.mutation.d.ts +4 -0
  23. package/lib/types/commands/mutations/set-pivot-sort.mutation.d.ts +4 -0
  24. package/lib/types/commands/mutations/set-pivot-subtotal-type.mutation.d.ts +4 -0
  25. package/lib/types/commands/mutations/update-field-position.mutation.d.ts +4 -0
  26. package/lib/types/commands/mutations/update-pivot-field-source-info.mutation.d.ts +4 -0
  27. package/lib/types/commands/mutations/update-pivot-table-source.mutation.d.ts +4 -0
  28. package/lib/types/commands/mutations/update-value-position.mutation.d.ts +4 -0
  29. package/lib/types/commands/operations/pivot-table-dirty-view.operation.d.ts +4 -0
  30. package/lib/types/const/const.d.ts +95 -0
  31. package/lib/types/const/template.d.ts +886 -0
  32. package/lib/types/const/type.d.ts +492 -0
  33. package/lib/types/controllers/sheets-pivot-caculate.controller.d.ts +44 -0
  34. package/lib/types/controllers/sheets-pivot-rpc.controller.d.ts +21 -0
  35. package/lib/types/index.d.ts +28 -0
  36. package/lib/types/locale/en-US.d.ts +4 -0
  37. package/lib/types/locale/ru-RU.d.ts +4 -0
  38. package/lib/types/locale/vi-VN.d.ts +4 -0
  39. package/lib/types/locale/zh-CN.d.ts +31 -0
  40. package/lib/types/locale/zh-TW.d.ts +4 -0
  41. package/lib/types/models/sheets-pivot-config-model.d.ts +58 -0
  42. package/lib/types/models/sheets-pivot-data-field-manager.d.ts +99 -0
  43. package/lib/types/models/sheets-pivot-data-source-model.d.ts +136 -0
  44. package/lib/types/models/sheets-pivot-table-adaptor-model.d.ts +43 -0
  45. package/lib/types/models/view-util.d.ts +17 -0
  46. package/lib/types/plugin.d.ts +21 -0
  47. package/lib/types/services/sheets-pivot-rpc.service.d.ts +12 -0
  48. package/lib/types/services/sheets-pivot-table.service.d.ts +11 -0
  49. package/lib/types/util.d.ts +40 -0
  50. package/lib/umd/index.js +1 -0
  51. package/package.json +94 -0
@@ -0,0 +1,58 @@
1
+ import { Nullable, ObjectMatrix, Disposable, ICommandService, Injector, IUniverInstanceService } from '@univerjs/core';
2
+ import { IDataFieldManagerJSON, IPivotRangesInfo, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableRangeInfo } from '../const/type';
3
+
4
+ export declare class SheetsPivotTableConfigModel extends Disposable {
5
+ private _injector;
6
+ private _commandService;
7
+ private _univerInstanceService;
8
+ private _model;
9
+ private _collectionConfigModel;
10
+ private _pivotTableRangeInfo;
11
+ private _pivotTableMatrixInfo;
12
+ private _configVersion$;
13
+ private _pivotInitCompleted$;
14
+ pivotInitCompleted$: import('rxjs').Observable<boolean>;
15
+ private _pivotConfigChange$;
16
+ pivotConfigChange$: import('rxjs').Observable<{
17
+ unitId: string;
18
+ subUnitId: string;
19
+ pivotTableId: string;
20
+ pivotTableConfig: Nullable<IPivotTableConfig>;
21
+ }>;
22
+ private _textInfo;
23
+ configVersion$: import('rxjs').Observable<number>;
24
+ constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService);
25
+ private _initUnitDisposed;
26
+ setPivotInitCompleted(): void;
27
+ private _initLocale;
28
+ getTextInfo(): Record<string, string>;
29
+ updateViewInfo(unitId: string, subUnitId: string, pivotTableId: string, valueMatrix: ObjectMatrix<Nullable<IPivotTableCellData>>, rangesCache: IPivotRangesInfo | undefined): void;
30
+ getPivotTableConfig(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableConfig | undefined;
31
+ getTargetByPivotId(unitId: string, subUnitId: string, pivotTableId: string): import('../const/type').IPivotCellPositionInfo | undefined;
32
+ getSubUnitPivotConfigs(unitId: string, subUnitId: string): Map<string, IPivotTableConfig> | undefined;
33
+ updateConfigCache(unitId: string, subUnitId: string, pivotTableId: string, pivotTableConfig: Nullable<IPivotTableConfig>): void;
34
+ getCollection(unitId: string, pivotTableId: string): import('@univerjs-pro/pivot-engine').IFieldsCollectionJSON | undefined;
35
+ updateCollectionConfig(unitId: string, collectionConfig: IDataFieldManagerJSON): void;
36
+ private _ensurePivotMap;
37
+ private _ensurePivotTableRangeInfo;
38
+ private _ensurePivotTableMatrixInfo;
39
+ updatePivotTableRangeInfo(unitId: string, subUnitId: string, pivotTableId: string, rangeInfo: IPivotRangesInfo | undefined): void;
40
+ updatePivotTableMatrixInfo(unitId: string, subUnitId: string, pivotTableId: string, matrixInfo: ObjectMatrix<Nullable<IPivotTableCellData>>): void;
41
+ /**
42
+ * - get the pivot table range info for sheet or calc engine
43
+ * @param {string} unitId - the unit id
44
+ * @param {string} subUnitId - the sub unit id
45
+ * @param {string} pivotTableId - the pivot table id
46
+ * @returns {IPivotRangesInfo} - the pivot table range info
47
+ */
48
+ getPivotTableRangeInfo(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableRangeInfo | undefined;
49
+ /**
50
+ * - get the pivot table matrix info for sheet or calc engine
51
+ * @param {string} unitId - the unit id
52
+ * @param {string} subUnitId - the sub unit id
53
+ * @param {string} pivotTableId - the pivot table id
54
+ * @returns {IPivotTableMatrixInfo} - the pivot table matrix info
55
+ */
56
+ getPivotTableMatrixInfo(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableMatrixInfo | undefined;
57
+ deleteUnitId(unitId: string): void;
58
+ }
@@ -0,0 +1,99 @@
1
+ import { ICellData, IRange, IUnitRangeName, IUniverInstanceService, Nullable, ObjectMatrix, Styles, Worksheet } from '@univerjs/core';
2
+ import { IDataFieldValue, IFieldsCollectionJSON, DataField, DataFieldManager, FieldsCollection } from '@univerjs-pro/pivot-engine';
3
+ import { IRuntimeUnitDataType } from '@univerjs/engine-formula';
4
+ import { ICurrentDataMatrix, IDataFieldManagerJSON, IPivotCellPositionInfo, IUnitRangeNameWithSubUnitId } from '../const/type';
5
+ import { SheetsPivotDataSourceModel } from './sheets-pivot-data-source-model';
6
+
7
+ interface IFeatureDirtyRangeType {
8
+ [unitId: string]: Nullable<{
9
+ [sheetId: string]: IRange[];
10
+ }>;
11
+ }
12
+ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
13
+ /**
14
+ * the key is pivot table id, the value is the data range info. those data range is one-to-one with the pivot table
15
+ */
16
+ rangeKeyMap: Record<string, string>;
17
+ private _univerInstanceService;
18
+ _host: SheetsPivotDataSourceModel;
19
+ constructor(host: SheetsPivotDataSourceModel, univerInstanceService: IUniverInstanceService);
20
+ initDataRanges(): void;
21
+ getAutoDisplayNameFunction(): (baseName: string, subtotalType: import('@univerjs-pro/pivot-engine').PivotSubtotalTypeEnum) => string;
22
+ deleteDataField(dataFieldId: string): void;
23
+ removeCollectionImp(token: string): void;
24
+ getRangeKey(rangeInfo: IUnitRangeName, colIndex: number): string;
25
+ getDataFieldByRangeKey(rangeKey: string): DataField;
26
+ setRangeKeyMap(rangeKey: string, dataFieldId: string): void;
27
+ addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): {
28
+ collection: FieldsCollection;
29
+ updateDataFieldList: {
30
+ index: number;
31
+ dataField: DataField;
32
+ }[];
33
+ };
34
+ getRangeStartEndInfo(range: IRange, sheet: Worksheet): {
35
+ startRow: number;
36
+ startColumn: number;
37
+ endRow: number;
38
+ endColumn: number;
39
+ };
40
+ /**
41
+ * - when add pivot table, we should create a collection with data range first
42
+ * @param {IUnitRangeName} dataRangeInfo the data range info
43
+ * @returns {FieldsCollection} the created collection
44
+ */
45
+ createCollectionWithDataRange(dataRangeInfo: IUnitRangeName): {
46
+ updateDataFieldList: {
47
+ index: number;
48
+ dataField: DataField;
49
+ }[];
50
+ collection: FieldsCollection;
51
+ };
52
+ _getAutoName(colIndex: number): string;
53
+ uniqueDataFieldName(name: IDataFieldValue, colIndex: number): string;
54
+ getCollection(token: string): FieldsCollection;
55
+ addCollection(token: string, collection: FieldsCollection, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): void;
56
+ getPivotDirtyViewInfo(): {
57
+ runtimeCellData: IRuntimeUnitDataType;
58
+ dirtyRanges: IFeatureDirtyRangeType;
59
+ };
60
+ getUpdateRangeDeleteIds(token: string, dataRangeInfo: IUnitRangeName): string[] | undefined;
61
+ /**
62
+ * get the matrix value from different matrix, when refresh the data source of pivot table
63
+ * @param matrix the sheet cell matrix
64
+ * @param arrayFormulaCellDataMatrix the array formula cell data matrix from run time data
65
+ * @param unitDataMatrix the unit data matrix from runtime data
66
+ * @param {number} rowIndex - the row index
67
+ * @param {number} colIndex - the column index
68
+ * @returns {Nullable<ICellData>} the cell data
69
+ */
70
+ getMatrixValue(matrix: ObjectMatrix<Nullable<ICellData>>, arrayFormulaCellDataMatrix: ObjectMatrix<Nullable<ICellData>> | undefined, unitDataMatrix: ObjectMatrix<Nullable<ICellData>> | undefined, rowIndex: number, colIndex: number): Nullable<ICellData>;
71
+ refreshDataField(dataFieldId: string, dataRangeInfo: IUnitRangeNameWithSubUnitId, index: number, currentDataMatrix?: ICurrentDataMatrix): {
72
+ header: never[];
73
+ data: never[];
74
+ } | undefined;
75
+ refreshData(collection: FieldsCollection, list: {
76
+ index: number;
77
+ dataField: DataField;
78
+ }[], dataRangeInfo: IUnitRangeName): {
79
+ header: never[];
80
+ data: never[];
81
+ } | undefined;
82
+ getRangeKeyList(dataRangeInfo: IUnitRangeName): string[];
83
+ /**
84
+ * - adjust sheet cell value to the type that pivot engine can recognize
85
+ * @param {Nullable<ICellData>} cellData the cell data
86
+ * @param {Styles} styles styles in the workbook
87
+ * @param {Record<string, any>} patternInfoRecord the pattern info record
88
+ * @returns {IDataFieldValue} the value to add into the data field
89
+ */
90
+ adjustSheetCellData(cellData: Nullable<ICellData>, styles: Styles, patternInfoRecord: Record<string, any>): IDataFieldValue;
91
+ getRangeData(dataRangeInfo: IUnitRangeName): {
92
+ header: (string | null)[];
93
+ data: (string | number | boolean | import('@univerjs-pro/pivot-engine').IDateValue | null | undefined)[][];
94
+ };
95
+ toJSON(): IDataFieldManagerJSON;
96
+ fromJSON(jsonData: IDataFieldManagerJSON): void;
97
+ dispose(): void;
98
+ }
99
+ export {};
@@ -0,0 +1,136 @@
1
+ import { IUnitRangeName, Nullable, Disposable, ICommandService, IConfigService, Injector, IResourceManagerService, IUniverInstanceService, LifecycleService } from '@univerjs/core';
2
+ import { DataField, FieldsCollection, IFieldsCollectionJSON, IPivotTableSnapshot, PivotView, PivotTable } from '@univerjs-pro/pivot-engine';
3
+ import { ICollectionChangeInfo, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotMutationDirtyViewInfo, IPivotTableConfig, IPivotTableJson, IPivotWorkerItemCache, IUnitRangeNameWithSubUnitId, PivotTableOperationEnum } from '../const/type';
4
+ import { SheetsPivotDataFieldManager } from './sheets-pivot-data-field-manager';
5
+ import { IViewTranslateCtx } from './view-util';
6
+
7
+ export declare class SheetsPivotDataSourceModel extends Disposable {
8
+ private readonly _injector;
9
+ private readonly _univerInstanceService;
10
+ readonly _lifecycleService: LifecycleService;
11
+ private readonly _configService;
12
+ private readonly _commandService;
13
+ private _resourceManagerService;
14
+ private _model;
15
+ private _pivotTableInstanceCache;
16
+ private _viewData;
17
+ private _textInfo;
18
+ private _collectionChange$;
19
+ collectionChange$: import('rxjs').Observable<ICollectionChangeInfo>;
20
+ private _viewData$;
21
+ viewData$: import('rxjs').Observable<{
22
+ unitId: string;
23
+ subUnitId: string;
24
+ pivotTableId: string;
25
+ }>;
26
+ private _fieldsCollectionChange$;
27
+ fieldsCollectionChange$: import('rxjs').Observable<Record<string, FieldsCollection>>;
28
+ private _dataFieldManagerCollection;
29
+ needSameDeleteModel: {
30
+ deleteUnitId: (unitId: string) => void;
31
+ }[];
32
+ /**
33
+ * - this property is used to store the dirty pivot table collection which need to be marked dirty when mutations is executed
34
+ */
35
+ private _queryingMap;
36
+ constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService, _configService: IConfigService, _commandService: ICommandService, _resourceManagerService: IResourceManagerService);
37
+ getTextInfo(): Record<string, string> | {
38
+ 'sheets-pivot.blankValue': string;
39
+ 'sheets-pivot.columnName': string;
40
+ 'sheets-pivot.subTotalText': string;
41
+ 'sheets-pivot.grandTotalText': string;
42
+ 'sheets-pivot.valueText': string;
43
+ 'sheets-pivot.averageName': string;
44
+ 'sheets-pivot.countName': string;
45
+ 'sheets-pivot.countNumsName': string;
46
+ 'sheets-pivot.maxName': string;
47
+ 'sheets-pivot.minName': string;
48
+ 'sheets-pivot.productName': string;
49
+ 'sheets-pivot.stdDevName': string;
50
+ 'sheets-pivot.stdDevpName': string;
51
+ 'sheets-pivot.sumName': string;
52
+ 'sheets-pivot.varName': string;
53
+ 'sheets-pivot.varpName': string;
54
+ 'sheets-pivot.subTotal': string;
55
+ 'sheets-pivot.grandTotal': string;
56
+ 'sheets-pivot.value': string;
57
+ 'sheets-pivot.blank': string;
58
+ 'sheets-pivot.emptyPivot.filter': string;
59
+ 'sheets-pivot.emptyPivot.row': string;
60
+ 'sheets-pivot.emptyPivot.column': string;
61
+ 'sheets-pivot.emptyPivot.values': string;
62
+ };
63
+ setTextInfo(textInfo: Record<string, string>): void;
64
+ broadcastCollectionChange(info: ICollectionChangeInfo): void;
65
+ getDataFieldManager(unitId: string): SheetsPivotDataFieldManager;
66
+ getCollection(unitId: string, token: string): FieldsCollection;
67
+ getUpdateRangeDeleteIds(unitId: string, token: string, dataRangeInfo: IUnitRangeName): string[] | undefined;
68
+ private _ensurePivotMap;
69
+ private _updateModelCache;
70
+ private _deleteModelCache;
71
+ private _updatePivotTableInstanceCache;
72
+ private _deletePivotTableInstanceCache;
73
+ private _ensureViewDataMap;
74
+ updateView(unitId: string, subUnitId: string, type: PivotTableOperationEnum, pivotTableId: string, view: Nullable<PivotView>, pivotConfig: Nullable<IPivotTableConfig>, collectionConfig?: IDataFieldManagerJSON, ignoreDirty?: boolean): void;
75
+ /**
76
+ * - the function is used to save the dirty view data and range for formula calculation
77
+ * @param {IViewTranslateCtx} ctx the dirty context
78
+ * @param {boolean} ignoreDirty the flag to ignore the dirty view area, only in handleSourceRangeChange , we get a dirty change from the source range change, we need ignore the dirty view area,because the dirty view area has done immediately
79
+ */
80
+ updateViewData(ctx: IViewTranslateCtx, ignoreDirty: boolean): void;
81
+ addPivotTable(unitId: string, subUnitId: string, pivotTableId: string, pivotTable: PivotTable, pivotTableConfig: IPivotTableConfig): void;
82
+ removePivotTable(unitId: string, subUnitId: string, pivotTableId: string): void;
83
+ setPivotTable(unitId: string, subUnitId: string, pivotTableId: string, pivotTableConfig: IPivotTableConfig): void;
84
+ getPivotTableConfig(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableConfig | null;
85
+ /**
86
+ * - get the pivot table model json config
87
+ * @param {string} unitId
88
+ * @param {string} subUnitId
89
+ * @param {string} pivotTableId - the pivot table id
90
+ * @returns {IPivotTableSnapshot|undefined} the pivot table model json config
91
+ */
92
+ getPivotTableModelConfig(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableSnapshot | undefined;
93
+ getPivotTableInstance(pivotTableId: string): PivotTable | undefined;
94
+ deleteUnitId(unitId: string): void;
95
+ addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): {
96
+ collection: FieldsCollection;
97
+ updateDataFieldList: {
98
+ index: number;
99
+ dataField: DataField;
100
+ }[];
101
+ };
102
+ /**
103
+ * - this function just create a collection with data range info, but wil not add it to the dataFieldManager
104
+ */
105
+ createCollectionWithDataRange(dataRangeInfo: IUnitRangeNameWithSubUnitId): {
106
+ updateDataFieldList: {
107
+ index: number;
108
+ dataField: DataField;
109
+ }[];
110
+ collection: FieldsCollection;
111
+ };
112
+ refreshData(collection: FieldsCollection, updateDataFieldList: {
113
+ index: number;
114
+ dataField: DataField;
115
+ }[], dataRangeInfo: IUnitRangeName): void;
116
+ removeDataField(unitId: string, dataFieldId: string): void;
117
+ removeCollections(unitId: string, token: string): void;
118
+ getSubUnitPivotConfigs(unitId: string, subUnitId: string): Map<string, IPivotTableConfig> | undefined;
119
+ getTargetByPivotId(pivotTableId: string): {
120
+ unitId: string;
121
+ subUnitId: string;
122
+ } | null;
123
+ sideEffectUpdateWorkerCache(unitId: string, subUnitId: string, pivotTableId: string, workerCache?: IPivotWorkerItemCache): void;
124
+ dispose(): void;
125
+ getViewData(unitId: string, subUnitId: string, pivotTableId: string): IPivotWorkerItemCache | null;
126
+ addDirtyPivotTable(dirtyInfo: IPivotMutationDirtyViewInfo): void;
127
+ updateDirtyPivotTable(dirtyInfo: IPivotMutationDirtyViewInfo): void;
128
+ /**
129
+ * trigger the pivot table query
130
+ * @param dirtyInfo
131
+ */
132
+ queryDirtyPivotTable(dirtyInfo: IPivotMutationDirtyViewInfo): void;
133
+ toJSON(unitId: string): IPivotTableJson;
134
+ fromJSON(jsonData: IPivotTableJson): void;
135
+ private _initSnapshot;
136
+ }
@@ -0,0 +1,43 @@
1
+ import { Nullable, Disposable, Injector, IUniverInstanceService, LocaleService, ObjectMatrix } from '@univerjs/core';
2
+ import { IPivotRangesInfo, IPivotRenderCache, IPivotTableCellData, IPivotTableConfigChangeInfo, PivotTableOperationEnum } from '../const/type';
3
+ import { SheetsPivotTableConfigModel } from './sheets-pivot-config-model';
4
+
5
+ export declare class SheetsPivotTableAdaptorModel extends Disposable {
6
+ private _localeService;
7
+ private _injector;
8
+ private _sheetsPivotTableConfigModel;
9
+ private _univerInstanceService;
10
+ private _pivotRenderInfoCache;
11
+ private _pivotRenderValueMatrixCache;
12
+ private _markDirty$;
13
+ markDirty$: import('rxjs').Observable<{
14
+ unitId: string;
15
+ subUnitId: string;
16
+ }>;
17
+ private _viewUpdate$;
18
+ viewUpdate$: import('rxjs').Observable<{
19
+ unitId: string;
20
+ subUnitId: string;
21
+ pivotTableId: string;
22
+ rangesCache: IPivotRangesInfo | undefined;
23
+ valueMatrix: ObjectMatrix<Nullable<IPivotTableCellData>>;
24
+ type: PivotTableOperationEnum;
25
+ }>;
26
+ private _textInfo;
27
+ constructor(_localeService: LocaleService, _injector: Injector, _sheetsPivotTableConfigModel: SheetsPivotTableConfigModel, _univerInstanceService: IUniverInstanceService);
28
+ private _initUnitDisposed;
29
+ private _initLocale;
30
+ updateRenderCache(config: IPivotTableConfigChangeInfo): {
31
+ rangeCache: IPivotRangesInfo;
32
+ matrix: ObjectMatrix<Nullable<IPivotTableCellData>>;
33
+ } | undefined;
34
+ clearRenderCache(config: IPivotTableConfigChangeInfo): void;
35
+ private _ensurePivotItemRenderInfoCache;
36
+ private _ensurePivotItemRenderValueMatrixCache;
37
+ getPivotTableCellData(unitId: string, subUnitId: string, row: number, col: number): IPivotTableCellData | undefined;
38
+ getPivotTableIdByCell(unitId: string, subUnitId: string, startRow: number, startCol: number): string | undefined;
39
+ getSubUnitPivotMatrix(unitId: string, subUnitId: string): ObjectMatrix<Nullable<IPivotTableCellData>>;
40
+ getPivotItemRenderInfoCache(unitId: string, subUnitId: string, pivotTableId: string): IPivotRenderCache | undefined;
41
+ deleteUnitId(unitId: string): void;
42
+ markDirty(unitId: string, subUnitId: string): void;
43
+ }
@@ -0,0 +1,17 @@
1
+ import { PivotView } from '@univerjs-pro/pivot-engine';
2
+ import { Nullable, ObjectMatrix } from '@univerjs/core';
3
+ import { IPivotCellPositionInfo, IPivotRangesInfo, IPivotTableCellData } from '../const/type';
4
+
5
+ export interface IViewTranslateCtx {
6
+ view: Nullable<PivotView>;
7
+ pivotTableId: string;
8
+ isEmpty: boolean;
9
+ targetCellInfo: IPivotCellPositionInfo;
10
+ textInfo: Record<string, string>;
11
+ }
12
+ interface IViewTranslateResult {
13
+ matrix: ObjectMatrix<Nullable<IPivotTableCellData>>;
14
+ rangesCache: IPivotRangesInfo;
15
+ }
16
+ export declare const adjustViewForCalcEngine: (ctx: IViewTranslateCtx) => IViewTranslateResult;
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
+ import { DataSyncPrimaryController } from '@univerjs/rpc';
3
+ import { IUniverSheetsConfig } from '@univerjs/sheets';
4
+
5
+ interface IUniverSheetsPivotConfig extends IUniverSheetsConfig {
6
+ isServer?: boolean;
7
+ }
8
+ export declare class UniverSheetsPivotTablePlugin extends Plugin {
9
+ private _config;
10
+ readonly _injector: Injector;
11
+ private readonly _commandService;
12
+ private readonly _configService;
13
+ private readonly _dataSyncPrimaryController?;
14
+ static pluginName: string;
15
+ static type: UniverInstanceType;
16
+ constructor(_config: IUniverSheetsPivotConfig, _injector: Injector, _commandService: ICommandService, _configService: IConfigService, _dataSyncPrimaryController?: DataSyncPrimaryController | undefined);
17
+ _initConfig(): void;
18
+ onStarting(): void;
19
+ private _initRegisterCommand;
20
+ }
21
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Disposable, ICommandService, Injector } from '@univerjs/core';
2
+ import { IGetPivotDataLocalMutationParams, ISendPivotDataLocalMutationParams } from '../const/type';
3
+
4
+ export declare class SheetsPivotRPCService extends Disposable {
5
+ private readonly _injector;
6
+ private readonly _commandService;
7
+ private _requestResolvers;
8
+ constructor(_injector: Injector, _commandService: ICommandService);
9
+ handleAsyncResponse(data: ISendPivotDataLocalMutationParams): void;
10
+ getPivotDisplayConfig(params: Omit<IGetPivotDataLocalMutationParams, 'version'>): Promise<ISendPivotDataLocalMutationParams>;
11
+ private _generateUniqueVersion;
12
+ }
@@ -0,0 +1,11 @@
1
+ import { Disposable } from '@univerjs/core';
2
+ import { SheetInterceptorService } from '@univerjs/sheets';
3
+ import { SheetsPivotTableAdaptorModel } from '../models/sheets-pivot-table-adaptor-model';
4
+
5
+ export declare class SheetsPivotTableService extends Disposable {
6
+ private _sheetInterceptorService;
7
+ private _sheetsPivotTableAdaptorModel;
8
+ constructor(_sheetInterceptorService: SheetInterceptorService, _sheetsPivotTableAdaptorModel: SheetsPivotTableAdaptorModel);
9
+ private _init;
10
+ private _initViewModelBySheetInterceptor;
11
+ }
@@ -0,0 +1,40 @@
1
+ import { Injector, Nullable, ObjectMatrix } from '@univerjs/core';
2
+ import { ILabelViewHeaderMapItem, IPivotViewInfo, PivotTable, PivotSubtotalTypeEnum } from '@univerjs-pro/pivot-engine';
3
+ import { IPivotPanelDataInfo, IPivotRangesInfo, IPivotRenderCache, IPivotTableCellData, IPivotTableConfig } from './const/type';
4
+ import { SheetsPivotDataSourceModel } from './models/sheets-pivot-data-source-model';
5
+
6
+ export declare const generateDefaultEmptyCache: (textOptions: {
7
+ filter: string;
8
+ row: string;
9
+ column: string;
10
+ values: string;
11
+ }, startCell: {
12
+ row: number;
13
+ col: number;
14
+ }) => {
15
+ matrixCache: ObjectMatrix<IPivotTableCellData>;
16
+ rangesCache: IPivotRangesInfo;
17
+ };
18
+ /**
19
+ * - Get the auto display name of the value field.
20
+ * @description - which may use prefix text like excel
21
+ * - the prefix text is create by subtotal type
22
+ * @param {string} baseName the name without prefix text
23
+ * @param {PivotSubtotalTypeEnum} subtotalType the type of subtotal to be displayed for this value field.
24
+ * @returns {string} the auto display name of the value field.
25
+ */
26
+ export declare function getAutoDisplayName(this: SheetsPivotDataSourceModel, baseName: string, subtotalType: PivotSubtotalTypeEnum): string;
27
+ export declare function getPivotCellInfo(row: number, col: number, cellInfo: Nullable<IPivotTableCellData>, pivotTable: PivotTable, pivotItemRenderCache: IPivotRenderCache): {
28
+ filterId: Nullable<string>;
29
+ info: Nullable<IPivotViewInfo>;
30
+ data: Nullable<IPivotTableCellData>;
31
+ headerInfo: Nullable<ILabelViewHeaderMapItem>;
32
+ } | undefined;
33
+ export declare function getPivotTableInfo(pivotTable: PivotTable, pivotTableId: string, config: IPivotTableConfig): IPivotPanelDataInfo;
34
+ export declare function flattenObject(inject: Injector, obj: {
35
+ [key: string]: any;
36
+ }, parentKey?: string, result?: {
37
+ [key: string]: any;
38
+ }): {
39
+ [key: string]: any;
40
+ };