@univerjs-pro/sheets-pivot 1.0.0-rc.0 → 1.0.1

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 (99) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ar-SA.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/de-DE.js +1 -1
  6. package/lib/cjs/locale/en-US.js +1 -1
  7. package/lib/cjs/locale/es-ES.js +1 -1
  8. package/lib/cjs/locale/fa-IR.js +1 -1
  9. package/lib/cjs/locale/fr-FR.js +1 -1
  10. package/lib/cjs/locale/id-ID.js +1 -1
  11. package/lib/cjs/locale/it-IT.js +1 -1
  12. package/lib/cjs/locale/ja-JP.js +1 -1
  13. package/lib/cjs/locale/ko-KR.js +1 -1
  14. package/lib/cjs/locale/pl-PL.js +1 -1
  15. package/lib/cjs/locale/pt-BR.js +1 -1
  16. package/lib/cjs/locale/ru-RU.js +1 -1
  17. package/lib/cjs/locale/sk-SK.js +1 -1
  18. package/lib/cjs/locale/vi-VN.js +1 -1
  19. package/lib/cjs/locale/zh-CN.js +1 -1
  20. package/lib/cjs/locale/zh-HK.js +1 -1
  21. package/lib/cjs/locale/zh-TW.js +1 -1
  22. package/lib/es/facade.js +1 -1
  23. package/lib/es/index.js +1 -1
  24. package/lib/es/locale/ar-SA.js +1 -1
  25. package/lib/es/locale/ca-ES.js +1 -1
  26. package/lib/es/locale/de-DE.js +1 -1
  27. package/lib/es/locale/en-US.js +1 -1
  28. package/lib/es/locale/es-ES.js +1 -1
  29. package/lib/es/locale/fa-IR.js +1 -1
  30. package/lib/es/locale/fr-FR.js +1 -1
  31. package/lib/es/locale/id-ID.js +1 -1
  32. package/lib/es/locale/it-IT.js +1 -1
  33. package/lib/es/locale/ja-JP.js +1 -1
  34. package/lib/es/locale/ko-KR.js +1 -1
  35. package/lib/es/locale/pl-PL.js +1 -1
  36. package/lib/es/locale/pt-BR.js +1 -1
  37. package/lib/es/locale/ru-RU.js +1 -1
  38. package/lib/es/locale/sk-SK.js +1 -1
  39. package/lib/es/locale/vi-VN.js +1 -1
  40. package/lib/es/locale/zh-CN.js +1 -1
  41. package/lib/es/locale/zh-HK.js +1 -1
  42. package/lib/es/locale/zh-TW.js +1 -1
  43. package/lib/facade.js +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/locale/ar-SA.js +1 -1
  46. package/lib/locale/ca-ES.js +1 -1
  47. package/lib/locale/de-DE.js +1 -1
  48. package/lib/locale/en-US.js +1 -1
  49. package/lib/locale/es-ES.js +1 -1
  50. package/lib/locale/fa-IR.js +1 -1
  51. package/lib/locale/fr-FR.js +1 -1
  52. package/lib/locale/id-ID.js +1 -1
  53. package/lib/locale/it-IT.js +1 -1
  54. package/lib/locale/ja-JP.js +1 -1
  55. package/lib/locale/ko-KR.js +1 -1
  56. package/lib/locale/pl-PL.js +1 -1
  57. package/lib/locale/pt-BR.js +1 -1
  58. package/lib/locale/ru-RU.js +1 -1
  59. package/lib/locale/sk-SK.js +1 -1
  60. package/lib/locale/vi-VN.js +1 -1
  61. package/lib/locale/zh-CN.js +1 -1
  62. package/lib/locale/zh-HK.js +1 -1
  63. package/lib/locale/zh-TW.js +1 -1
  64. package/lib/types/commands/command/set-pivot-collapse-by-field.command.d.ts +8 -0
  65. package/lib/types/commands/command/set-pivot-collapse.command.d.ts +8 -1
  66. package/lib/types/commands/command/update-value-position.command.d.ts +8 -0
  67. package/lib/types/const/type.d.ts +23 -4
  68. package/lib/types/controllers/sheets-pivot-cache-provider.controller.d.ts +6 -0
  69. package/lib/types/controllers/sheets-pivot-caculate.controller.d.ts +4 -1
  70. package/lib/types/facade/f-pivot-table.d.ts +3 -2
  71. package/lib/types/facade/index.d.ts +1 -0
  72. package/lib/types/index.d.ts +8 -2
  73. package/lib/types/models/sheets-pivot-data-field-manager.d.ts +4 -3
  74. package/lib/types/models/sheets-pivot-data-source-model.d.ts +10 -3
  75. package/lib/types/plugin.d.ts +1 -1
  76. package/lib/types/services/sheets-pivot-cache.service.d.ts +35 -0
  77. package/lib/types/services/sheets-pivot-unit-cache.provider.d.ts +10 -0
  78. package/lib/umd/facade.js +1 -1
  79. package/lib/umd/index.js +1 -1
  80. package/lib/umd/locale/ar-SA.js +1 -1
  81. package/lib/umd/locale/ca-ES.js +1 -1
  82. package/lib/umd/locale/de-DE.js +1 -1
  83. package/lib/umd/locale/en-US.js +1 -1
  84. package/lib/umd/locale/es-ES.js +1 -1
  85. package/lib/umd/locale/fa-IR.js +1 -1
  86. package/lib/umd/locale/fr-FR.js +1 -1
  87. package/lib/umd/locale/id-ID.js +1 -1
  88. package/lib/umd/locale/it-IT.js +1 -1
  89. package/lib/umd/locale/ja-JP.js +1 -1
  90. package/lib/umd/locale/ko-KR.js +1 -1
  91. package/lib/umd/locale/pl-PL.js +1 -1
  92. package/lib/umd/locale/pt-BR.js +1 -1
  93. package/lib/umd/locale/ru-RU.js +1 -1
  94. package/lib/umd/locale/sk-SK.js +1 -1
  95. package/lib/umd/locale/vi-VN.js +1 -1
  96. package/lib/umd/locale/zh-CN.js +1 -1
  97. package/lib/umd/locale/zh-HK.js +1 -1
  98. package/lib/umd/locale/zh-TW.js +1 -1
  99. package/package.json +12 -11
@@ -1 +1 @@
1
- const _0xcb9037=_0x3db2;function _0x4fb1(){const _0x5a43b3=['60sIufiz','(其他)','{0}','{0}:{1}','年-季','1956tQSzVv','61266RHfVci','7QysnPT','{0}\x20{1}','工作表','6725235spjKDN','月-日','Q{0}','計數項:','6226472rhwmeq','小時-分鐘','2835160VtvuiO','母體變異數項:','1037555IHNwZp','變異數項:','{0}-{1}-{2}','2692oOWhIV','平均值項:','1963566QcGRbe','乘積項:','{0}-Q{1}','年-月-日','(空白)','85YrVsnS','數值計數項:','欄標籤','最大值項:','母體標準差項:','{0}-{1}'];_0x4fb1=function(){return _0x5a43b3;};return _0x4fb1();}(function(_0x23b26e,_0x585482){const _0x5cc221=_0x3db2,_0x5517e3=_0x23b26e();while(!![]){try{const _0x106160=parseInt(_0x5cc221(0x187))/0x1+parseInt(_0x5cc221(0x18a))/0x2*(-parseInt(_0x5cc221(0x17a))/0x3)+-parseInt(_0x5cc221(0x185))/0x4+-parseInt(_0x5cc221(0x16f))/0x5*(-parseInt(_0x5cc221(0x17b))/0x6)+-parseInt(_0x5cc221(0x17c))/0x7*(parseInt(_0x5cc221(0x183))/0x8)+-parseInt(_0x5cc221(0x16a))/0x9*(-parseInt(_0x5cc221(0x175))/0xa)+parseInt(_0x5cc221(0x17f))/0xb;if(_0x106160===_0x585482)break;else _0x5517e3['push'](_0x5517e3['shift']());}catch(_0xe68955){_0x5517e3['push'](_0x5517e3['shift']());}}}(_0x4fb1,0xbb3a0));const e={'sheets-pivot':{'sheet':_0xcb9037(0x17e),'blankValue':_0xcb9037(0x16e),'otherValue':_0xcb9037(0x176),'columnName':'欄\x20','subTotalText':'小計','grandTotalText':'總計','valueText':'值','rowLabels':'列標籤','columnLabels':_0xcb9037(0x171),'averageName':_0xcb9037(0x18b),'countName':_0xcb9037(0x182),'countNumsName':_0xcb9037(0x170),'maxName':_0xcb9037(0x172),'minName':'最小值項:','productName':_0xcb9037(0x16b),'stdDevName':'標準差項:','stdDevpName':_0xcb9037(0x173),'sumName':'總和項:','varName':_0xcb9037(0x188),'varpName':_0xcb9037(0x186),'subTotal':'小計','grandTotal':'總計','value':'值','blank':'空白','other':'其他','renderText':{'valueField':'{0}{1}','subtotal':'{0}\x20{1}','grandTotal':_0xcb9037(0x17d),'multipleGrandTotal':'{0}','subtotalWithValue':_0xcb9037(0x17d)},'emptyPivot':{'filter':'篩選','row':'列','column':'欄','values':'值'},'dateGroup':{'year':'年','month':'月','day':'日','date':'日','hour':'小時','minute':'分鐘','hourMinute':_0xcb9037(0x184),'quarter':'季','monthDate':_0xcb9037(0x180),'yearQuarter':_0xcb9037(0x179),'yearMonth':'年-月','yearMonthDate':_0xcb9037(0x16d)},'cellDateGroupDisplay':{'minute':'{0}','hour':_0xcb9037(0x177),'hourMinute':_0xcb9037(0x178),'date':_0xcb9037(0x177),'month':_0xcb9037(0x177),'monthDate':_0xcb9037(0x174),'quarter':_0xcb9037(0x181),'year':_0xcb9037(0x177),'yearMonth':_0xcb9037(0x174),'yearMonthDate':_0xcb9037(0x189),'yearQuarter':_0xcb9037(0x16c)}}};function _0x3db2(_0x318cb6,_0xc86ac6){_0x318cb6=_0x318cb6-0x16a;const _0x4fb17a=_0x4fb1();let _0x3db2c7=_0x4fb17a[_0x318cb6];return _0x3db2c7;}export{e as default};
1
+ const _0x51c14d=_0x5c5f;function _0x5c5f(_0x184027,_0x53d471){_0x184027=_0x184027-0x134;const _0x47b43c=_0x47b4();let _0x5c5f25=_0x47b43c[_0x184027];return _0x5c5f25;}(function(_0x1e727c,_0x281a80){const _0x3ef36b=_0x5c5f,_0x3df9af=_0x1e727c();while(!![]){try{const _0x4a958e=parseInt(_0x3ef36b(0x13e))/0x1+parseInt(_0x3ef36b(0x150))/0x2*(parseInt(_0x3ef36b(0x14b))/0x3)+-parseInt(_0x3ef36b(0x143))/0x4*(parseInt(_0x3ef36b(0x145))/0x5)+parseInt(_0x3ef36b(0x14f))/0x6+parseInt(_0x3ef36b(0x140))/0x7+-parseInt(_0x3ef36b(0x141))/0x8+parseInt(_0x3ef36b(0x135))/0x9;if(_0x4a958e===_0x281a80)break;else _0x3df9af['push'](_0x3df9af['shift']());}catch(_0x1ec578){_0x3df9af['push'](_0x3df9af['shift']());}}}(_0x47b4,0x97289));const e={'sheets-pivot':{'sheet':'工作表','blankValue':_0x51c14d(0x151),'otherValue':'(其他)','columnName':'欄\x20','subTotalText':'小計','grandTotalText':'總計','valueText':'值','rowLabels':_0x51c14d(0x13c),'columnLabels':_0x51c14d(0x154),'averageName':_0x51c14d(0x147),'countName':_0x51c14d(0x13d),'countNumsName':_0x51c14d(0x14e),'maxName':_0x51c14d(0x138),'minName':'最小值項:','productName':_0x51c14d(0x152),'stdDevName':'標準差項:','stdDevpName':_0x51c14d(0x142),'sumName':_0x51c14d(0x148),'varName':_0x51c14d(0x14a),'varpName':_0x51c14d(0x146),'subTotal':'小計','grandTotal':'總計','value':'值','blank':'空白','other':'其他','renderText':{'valueField':_0x51c14d(0x13a),'subtotal':'{0}\x20{1}','grandTotal':_0x51c14d(0x13f),'multipleGrandTotal':_0x51c14d(0x139),'subtotalWithValue':_0x51c14d(0x13f)},'emptyPivot':{'filter':'篩選','row':'列','column':'欄','values':'值'},'dateGroup':{'year':'年','month':'月','day':'日','date':'日','hour':'小時','minute':'分鐘','hourMinute':_0x51c14d(0x137),'quarter':'季','monthDate':_0x51c14d(0x14c),'yearQuarter':_0x51c14d(0x134),'yearMonth':'年-月','yearMonthDate':_0x51c14d(0x13b)},'cellDateGroupDisplay':{'minute':_0x51c14d(0x139),'hour':_0x51c14d(0x139),'hourMinute':_0x51c14d(0x144),'date':_0x51c14d(0x139),'month':_0x51c14d(0x139),'monthDate':_0x51c14d(0x149),'quarter':_0x51c14d(0x153),'year':'{0}','yearMonth':'{0}-{1}','yearMonthDate':_0x51c14d(0x14d),'yearQuarter':_0x51c14d(0x136)}}};export{e as default};function _0x47b4(){const _0x1d8861=['平均值項:','總和項:','{0}-{1}','變異數項:','42AlnLbs','月-日','{0}-{1}-{2}','數值計數項:','3042roGMNu','64656rGWbTV','(空白)','乘積項:','Q{0}','欄標籤','年-季','7611003KziFvY','{0}-Q{1}','小時-分鐘','最大值項:','{0}','{0}{1}','年-月-日','列標籤','計數項:','228550ejwrdi','{0}\x20{1}','2311750rIDWcR','9865504zitngx','母體標準差項:','20932uTbJoc','{0}:{1}','5pPmFsV','母體變異數項:'];_0x47b4=function(){return _0x1d8861;};return _0x47b4();}
@@ -0,0 +1,8 @@
1
+ import type { ICommand } from '@univerjs/core';
2
+ import type { IPivotCollapseTarget } from './set-pivot-collapse.command';
3
+ export type ISetPivotCollapseByFieldCommandParams = IPivotCollapseTarget;
4
+ /**
5
+ * Sets collapse state using the semantic PivotTable field and item identity.
6
+ * This is used by projections such as PivotChart that do not own a sheet cell.
7
+ */
8
+ export declare const SetPivotCollapseByFieldCommand: ICommand<ISetPivotCollapseByFieldCommandParams>;
@@ -1,4 +1,5 @@
1
- import type { ICommand } from '@univerjs/core';
1
+ import type { IAccessor, ICommand } from '@univerjs/core';
2
+ import type { IGetPivotCollapseDataParams } from '../../const/type';
2
3
  export interface ISetPivotCollapseCommandParams {
3
4
  /**
4
5
  * @property {string} unitId The unit id of workbook which the pivot table belongs to.
@@ -21,4 +22,10 @@ export interface ISetPivotCollapseCommandParams {
21
22
  */
22
23
  collapse: boolean;
23
24
  }
25
+ export type IPivotCollapseTarget = IGetPivotCollapseDataParams & {
26
+ unitId: string;
27
+ subUnitId: string;
28
+ pivotTableId: string;
29
+ };
24
30
  export declare const SetPivotCollapseCommand: ICommand<ISetPivotCollapseCommandParams>;
31
+ export declare function executePivotCollapse(accessor: IAccessor, target: IPivotCollapseTarget): Promise<boolean>;
@@ -1,6 +1,14 @@
1
1
  import type { PivotTableValuePositionEnum } from '@univerjs-pro/engine-pivot';
2
2
  import type { ICommand } from '@univerjs/core';
3
3
  export interface IUpdatePivotValuePositionCommandParams {
4
+ /**
5
+ * @property {string} [unitId] The unit id of workbook which the pivot table belongs to.
6
+ */
7
+ unitId?: string;
8
+ /**
9
+ * @property {string} [subUnitId] The sub unit id of worksheet which the pivot table belongs to.
10
+ */
11
+ subUnitId?: string;
4
12
  /**
5
13
  * @property {string} pivotTableId The pivot table id.
6
14
  */
@@ -23,6 +23,10 @@ export declare enum CollectionChangeEnum {
23
23
  export type IUnitRangeNameWithSubUnitId = IUnitRangeName & {
24
24
  subUnitId: string;
25
25
  };
26
+ export interface IPivotReportScope {
27
+ unitId: string;
28
+ subUnitId: string;
29
+ }
26
30
  export interface ICollectionChangeInfo {
27
31
  token: string;
28
32
  type: CollectionChangeEnum;
@@ -37,6 +41,7 @@ export interface IAddPivotTableParams {
37
41
  }
38
42
  export interface IUpdatePivotTableSourceRangeMutationParams {
39
43
  pivotTableId: string;
44
+ pivotCacheId?: string;
40
45
  deleteIds: string[];
41
46
  collectionJSON: IFieldsCollectionJSON;
42
47
  dataRangeInfo: IUnitRangeNameWithSubUnitId;
@@ -172,7 +177,7 @@ export interface ISetPivotCollapseMutation {
172
177
  subUnitId: string;
173
178
  pivotTableId: string;
174
179
  fieldId: string;
175
- collapse: boolean;
180
+ collapse: boolean | Record<string, boolean> | undefined;
176
181
  item?: string;
177
182
  }
178
183
  export interface IAdjustPivotTableRes {
@@ -207,6 +212,7 @@ export interface IPivotCellPositionInfo {
207
212
  export interface IPivotTableConfig {
208
213
  targetCellInfo: IPivotCellPositionInfo;
209
214
  sourceRangeInfo: IUnitRangeNameWithSubUnitId;
215
+ pivotCacheId?: string;
210
216
  themeId?: string;
211
217
  fieldsConfig: IPivotTableSnapshot;
212
218
  isEmpty: boolean;
@@ -260,9 +266,14 @@ export interface IPivotTableCellData {
260
266
  export interface IDataFieldManagerJSON extends IDataFieldManagerBaseJSON {
261
267
  dataRanges: Record<string, IUnitRangeName>;
262
268
  }
269
+ export interface ISheetsPivotCacheSnapshot {
270
+ pivotCacheId: string;
271
+ sourceRangeInfo: IUnitRangeNameWithSubUnitId;
272
+ }
263
273
  export interface IPivotTableJson {
264
274
  dataFieldManagerConfig: Record<string, IDataFieldManagerJSON>;
265
275
  pivotTableConfigs: Record<string, Record<string, Record<string, IPivotTableConfig>>>;
276
+ pivotCacheConfigs?: Record<string, Record<string, ISheetsPivotCacheSnapshot>>;
266
277
  }
267
278
  export type IRangePosition = 'row' | 'col' | 'corner' | 'data';
268
279
  export interface IPivotRenderCache {
@@ -357,6 +368,7 @@ export interface IGetAddPivotTableDataParams {
357
368
  subUnitId: string;
358
369
  };
359
370
  pivotTableId: string;
371
+ fieldsConfig?: IPivotTableSnapshot;
360
372
  }
361
373
  export interface IGetAddPivotTableWithConfigDataParams {
362
374
  sourceRangeInfo: IUnitRangeName & {
@@ -378,11 +390,18 @@ export interface IGetMovePivotFieldDataParams {
378
390
  export interface IGetRemovePivotFieldDataParams {
379
391
  fieldIds: string[];
380
392
  }
381
- export interface IGetPivotCollapseDataParams {
393
+ export type IGetPivotCollapseDataParams = {
382
394
  tableFieldId: string;
383
395
  collapse: boolean;
384
- item: string;
385
- }
396
+ item?: string;
397
+ rowLevelFieldId?: never;
398
+ } | {
399
+ /** Set the entire row axis depth in one query and changeset collection. */
400
+ rowLevelFieldId: string;
401
+ tableFieldId?: never;
402
+ collapse?: never;
403
+ item?: never;
404
+ };
386
405
  export interface IGetPivotFilterDataParams {
387
406
  tableFieldId: string;
388
407
  items: string[];
@@ -0,0 +1,6 @@
1
+ import { IPivotCacheProviderRegistry } from '@univerjs-pro/pivot-cache';
2
+ import { Disposable } from '@univerjs/core';
3
+ import { SheetsPivotUnitCacheProvider } from '../services/sheets-pivot-unit-cache.provider';
4
+ export declare class SheetsPivotCacheProviderController extends Disposable {
5
+ constructor(registry: IPivotCacheProviderRegistry, provider: SheetsPivotUnitCacheProvider);
6
+ }
@@ -3,6 +3,7 @@ import type { ICurrentDataMatrix, IPivotCellPositionInfo, IUnitRangeNameWithSubU
3
3
  import { Disposable, ICommandService, IConfigService, Injector, IUniverInstanceService } from '@univerjs/core';
4
4
  import { GlobalComputingStatusService, IFeatureCalculationManagerService } from '@univerjs/engine-formula';
5
5
  import { SheetsPivotDataSourceModel } from '../models/sheets-pivot-data-source-model';
6
+ import { SheetsPivotCacheService } from '../services/sheets-pivot-cache.service';
6
7
  interface IPivotDirtyViewInfo {
7
8
  unitId: string;
8
9
  subUnitId: string;
@@ -16,7 +17,8 @@ export declare class PivotCalculatorController extends Disposable {
16
17
  private readonly _injector;
17
18
  private readonly _univerInstanceService;
18
19
  private readonly _configService;
19
- constructor(_sheetsPivotDataSourceModel: SheetsPivotDataSourceModel, _featureCalculationManagerService: IFeatureCalculationManagerService, _commandService: ICommandService, _globalComputingSrv: GlobalComputingStatusService, _injector: Injector, _univerInstanceService: IUniverInstanceService, _configService: IConfigService);
20
+ private readonly _sheetsPivotCacheService;
21
+ constructor(_sheetsPivotDataSourceModel: SheetsPivotDataSourceModel, _featureCalculationManagerService: IFeatureCalculationManagerService, _commandService: ICommandService, _globalComputingSrv: GlobalComputingStatusService, _injector: Injector, _univerInstanceService: IUniverInstanceService, _configService: IConfigService, _sheetsPivotCacheService: SheetsPivotCacheService);
20
22
  private _isAutoDateGroupEnabled;
21
23
  private _setDateSystem;
22
24
  _init(): void;
@@ -35,6 +37,7 @@ export declare class PivotCalculatorController extends Disposable {
35
37
  */
36
38
  triggerDirtyFeature(dirtyInfos: IPivotDirtyViewInfo[]): void;
37
39
  removeSourceRangeChange(unitId: string, subUnitId: string, token: string): void;
40
+ handleReportSourceRangeChange(token: string, dataRangeInfo: IUnitRangeNameWithSubUnitId, reportUnitId: string, reportSubUnitId: string): void;
38
41
  handleSourceRangeChange(token: string, dataRangeInfo: IUnitRangeNameWithSubUnitId, targetInfo: IPivotCellPositionInfo): void;
39
42
  /**
40
43
  * GET the runtime real data from runtime data, it use for refresh the data filed used rightly data
@@ -2,6 +2,7 @@ import type { IPivotTableLabelFieldJSON, IPivotTableOptions, IPivotTableShowData
2
2
  import type { IPivotTableConfig, IPivotTableMatrixInfo, IUnitRangeNameWithSubUnitId } from '@univerjs-pro/sheets-pivot';
3
3
  import type { Injector, IRange, Nullable } from '@univerjs/core';
4
4
  import { PivotLayoutTypeEnum, PivotTableFiledAreaEnum } from '@univerjs-pro/engine-pivot';
5
+ import { FBase } from '@univerjs/core/facade';
5
6
  interface IPivotTableDataFieldInfo {
6
7
  id: string;
7
8
  name: string;
@@ -30,7 +31,7 @@ export interface IPivotTableFieldSettingOptions {
30
31
  * The facade class for the pivot table.Which uses to setting the pivot table fields configs.
31
32
  * @hideconstructor
32
33
  */
33
- export declare class FPivotTable {
34
+ export declare class FPivotTable extends FBase {
34
35
  /**
35
36
  * @ignore
36
37
  */
@@ -43,7 +44,7 @@ export declare class FPivotTable {
43
44
  * @ignore
44
45
  */
45
46
  pivotTableId: string;
46
- private _injector;
47
+ protected readonly _injector: Injector;
47
48
  constructor(unitId: string, subUnitId: string, pivotTableId: string, injector: Injector);
48
49
  /**
49
50
  * @description Get the pivot table config by the pivot table id.
@@ -5,6 +5,7 @@ import './f-event';
5
5
  import './f-univer';
6
6
  export type * from './f-enum';
7
7
  export type * from './f-event';
8
+ export { FPivotTable } from './f-pivot-table';
8
9
  export type * from './f-pivot-table';
9
10
  export type * from './f-workbook';
10
11
  export type * from './f-worksheet';
@@ -15,6 +15,8 @@ export { RemovePivotFieldCommand } from './commands/command/remove-pivot-field.c
15
15
  export type { IRemovePivotFieldCommandParams } from './commands/command/remove-pivot-field.command';
16
16
  export { RemovePivotTableCommand } from './commands/command/remove-pivot-table.command';
17
17
  export { ResetPivotFieldsConfigCommand } from './commands/command/reset-pivot-fields-config.command';
18
+ export { SetPivotCollapseByFieldCommand } from './commands/command/set-pivot-collapse-by-field.command';
19
+ export type { ISetPivotCollapseByFieldCommandParams } from './commands/command/set-pivot-collapse-by-field.command';
18
20
  export { SetPivotCollapseCommand } from './commands/command/set-pivot-collapse.command';
19
21
  export type { ISetPivotCollapseCommandParams } from './commands/command/set-pivot-collapse.command';
20
22
  export { SetPivotDateGroupCommand } from './commands/command/set-pivot-date-group.command';
@@ -36,6 +38,7 @@ export { UpdatePivotValuePositionCommand } from './commands/command/update-value
36
38
  export type { IUpdatePivotValuePositionCommandParams } from './commands/command/update-value-position.command';
37
39
  export { AddPivotFieldMutation } from './commands/mutations/add-pivot-field.mutation';
38
40
  export { AddPivotTableMutation } from './commands/mutations/add-pivot-table.mutation';
41
+ export { SendPivotViewLocalMutation } from './commands/mutations/pivot-data-communication.mutation';
39
42
  export { RemovePivotFieldMutation } from './commands/mutations/remove-pivot-field.mutation';
40
43
  export { RemovePivotTableMutation } from './commands/mutations/remove-pivot-table.mutation';
41
44
  export { RenamePivotFieldMutation } from './commands/mutations/rename-pivot-field.mutation';
@@ -54,12 +57,15 @@ export { UpdateValuePositionMutation } from './commands/mutations/update-value-p
54
57
  export { SHEETS_PIVOT_PLUGIN_CONFIG_KEY } from './config/config';
55
58
  export type { IUniverSheetsPivotConfig } from './config/config';
56
59
  export { BLANK_ROW_COUNT, getAdjustRangesPosition, PivotDisplayDataType, PositionType, SHEET_PIVOT_TABLE_PLUGIN, } from './const/const';
57
- export type { IAddPivotTableMutationParams, IPivotCellPositionInfo, IPivotPanelDataInfo, IPivotPanelSourceList, IPivotPanelTableListItemBase, IPivotRangesInfo, IPivotTableAddedEventParams, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableMovedEventParams, IPivotTableRemovedEventParams, IPivotTableRenderedEventParams, IPivotViewUpdateInfo, IRemovePivotTableMutationParams, ISetPivotLayoutMutationParams, ISetPivotOptionMutationParams, IUnitRangeNameWithSubUnitId, } from './const/type';
60
+ export type { IAddPivotTableMutationParams, IPivotCellPositionInfo, IPivotPanelDataInfo, IPivotPanelSourceList, IPivotPanelTableListItemBase, IPivotRangesInfo, IPivotReportScope, IPivotTableAddedEventParams, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableMovedEventParams, IPivotTableRemovedEventParams, IPivotTableRenderedEventParams, IPivotViewUpdateInfo, IRemovePivotTableMutationParams, ISendPivotViewLocalMutationParams, ISetPivotLayoutMutationParams, ISetPivotOptionMutationParams, IUnitRangeNameWithSubUnitId, } from './const/type';
61
+ export { PivotCalculatorController } from './controllers/sheets-pivot-caculate.controller';
58
62
  export { mapPivotSheetColumn, mapPivotSheetRange } from './models/pivot-sheet-projection';
59
63
  export { SheetsPivotTableConfigModel } from './models/sheets-pivot-config-model';
64
+ export { SheetsPivotDataSourceModel } from './models/sheets-pivot-data-source-model';
60
65
  export { SheetsPivotTableAdaptorModel } from './models/sheets-pivot-table-adaptor-model';
61
66
  export { UniverSheetsPivotTablePlugin } from './plugin';
67
+ export { SheetsPivotCacheService } from './services/sheets-pivot-cache.service';
62
68
  export { SheetsPivotRPCService } from './services/sheets-pivot-rpc.service';
63
69
  export { SheetsPivotTableService } from './services/sheets-pivot-table.service';
64
70
  export type { IPivotSheetCellContext, IPivotValueFilterTarget } from './util';
65
- export { generateSetRangeValueMutations, getEmptyPivotRanges, getPivotAppliedRanges, resolvePivotSheetCell, resolvePivotValueFieldId, resolvePivotValueFilterTarget, unionPivotViewRange, } from './util';
71
+ export { generateSetRangeValueMutations, getDateGroupName, getEmptyPivotRanges, getPivotAppliedRanges, resolvePivotSheetCell, resolvePivotValueFieldId, resolvePivotValueFilterTarget, setPivotDateSystem, unionPivotViewRange, } from './util';
@@ -1,7 +1,7 @@
1
1
  import type { IDataFieldValue, IFieldsCollectionJSON, PivotSubtotalTypeEnum } from '@univerjs-pro/engine-pivot';
2
2
  import type { ICellData, IRange, IUnitRangeName, IUniverInstanceService, Nullable, ObjectMatrix, Styles, Worksheet } from '@univerjs/core';
3
3
  import type { IRuntimeUnitDataType } from '@univerjs/engine-formula';
4
- import type { ICurrentDataMatrix, IDataFieldManagerJSON, IPivotCellPositionInfo, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
4
+ import type { ICurrentDataMatrix, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotReportScope, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
5
5
  import type { SheetsPivotDataSourceModel } from './sheets-pivot-data-source-model';
6
6
  import { DataField, DataFieldManager, FieldsCollection } from '@univerjs-pro/engine-pivot';
7
7
  interface IFeatureDirtyRangeType {
@@ -14,6 +14,7 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
14
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
15
  */
16
16
  rangeKeyMap: Record<string, string>;
17
+ private _reportScopeMap;
17
18
  private _univerInstanceService;
18
19
  _host: SheetsPivotDataSourceModel;
19
20
  constructor(host: SheetsPivotDataSourceModel, univerInstanceService: IUniverInstanceService);
@@ -30,7 +31,7 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
30
31
  getDataFieldByRangeKey(rangeKey: string): DataField | undefined;
31
32
  setRangeKeyMap(rangeKey: string, dataFieldId: string): void;
32
33
  updateRangeKeyMap(oldRangeKey: string, newRangeKey: string): void;
33
- addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): IUpdateInfo;
34
+ addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo?: IPivotCellPositionInfo, reportScope?: IPivotReportScope): IUpdateInfo;
34
35
  getRangeStartEndInfo(range: IRange, sheet: Worksheet): IRange;
35
36
  /**
36
37
  * - when add pivot table, we should create a collection with data range first
@@ -41,7 +42,7 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
41
42
  _getAutoName(colIndex: number): string;
42
43
  uniqueDataFieldName(name: IDataFieldValue, colIndex: number): string;
43
44
  getCollection(token: string): FieldsCollection;
44
- addCollection(token: string, collection: FieldsCollection, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): void;
45
+ addCollection(token: string, collection: FieldsCollection, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo?: IPivotCellPositionInfo, reportScope?: IPivotReportScope): void;
45
46
  handleMoveRange(token: string, sourceRangeInfo: IUnitRangeNameWithSubUnitId): void;
46
47
  getPivotDirtyViewInfo(): {
47
48
  runtimeCellData: IRuntimeUnitDataType;
@@ -1,11 +1,13 @@
1
1
  import type { DataField, FieldsCollection, IFieldsCollectionJSON, IPivotTableSnapshot, PivotView } from '@univerjs-pro/engine-pivot';
2
+ import type { IPivotCacheHandle } from '@univerjs-pro/pivot-cache';
2
3
  import type { IUnitRangeName, Nullable } from '@univerjs/core';
3
4
  import type { IMoveRangeMutationParams } from '@univerjs/sheets';
4
- import type { ICollectionChangeInfo, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotMutationDirtyViewInfo, IPivotTableConfig, IPivotTableJson, IPivotWorkerItemCache, ISendPivotConfigLocalMutationParams, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
5
+ import type { ICollectionChangeInfo, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotMutationDirtyViewInfo, IPivotReportScope, IPivotTableConfig, IPivotTableJson, IPivotWorkerItemCache, ISendPivotConfigLocalMutationParams, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
5
6
  import type { IViewTranslateCtx } from './view-util';
6
7
  import { PivotTable } from '@univerjs-pro/engine-pivot';
7
8
  import { Disposable, ICommandService, Injector, IResourceManagerService, IUniverInstanceService, LifecycleService } from '@univerjs/core';
8
9
  import { PivotTableOperationEnum } from '../const/type';
10
+ import { SheetsPivotCacheService } from '../services/sheets-pivot-cache.service';
9
11
  import { SheetsPivotDataFieldManager } from './sheets-pivot-data-field-manager';
10
12
  export declare class SheetsPivotDataSourceModel extends Disposable {
11
13
  private readonly _injector;
@@ -13,6 +15,7 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
13
15
  readonly _lifecycleService: LifecycleService;
14
16
  private readonly _commandService;
15
17
  private _resourceManagerService;
18
+ private readonly _sheetsPivotCacheService;
16
19
  private _model;
17
20
  private _pivotTableInstanceCache;
18
21
  private _viewData;
@@ -37,7 +40,7 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
37
40
  * - this property is used to store the dirty pivot table collection which need to be marked dirty when mutations is executed
38
41
  */
39
42
  private _queryingMap;
40
- constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService, _commandService: ICommandService, _resourceManagerService: IResourceManagerService);
43
+ constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService, _commandService: ICommandService, _resourceManagerService: IResourceManagerService, _sheetsPivotCacheService: SheetsPivotCacheService);
41
44
  getTextInfo(): Record<string, string>;
42
45
  setTextInfo(textInfo: Record<string, string>, direction: 'ltr' | 'rtl'): void;
43
46
  handleMoveRange(params: IMoveRangeMutationParams): void;
@@ -62,6 +65,7 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
62
65
  addPivotTable(unitId: string, subUnitId: string, pivotTableId: string, pivotTable: PivotTable, pivotTableConfig: IPivotTableConfig): void;
63
66
  removePivotTable(unitId: string, subUnitId: string, pivotTableId: string): void;
64
67
  setPivotTable(unitId: string, subUnitId: string, pivotTableId: string, pivotTableConfig: IPivotTableConfig): void;
68
+ updatePivotTableSourceRange(unitId: string, subUnitId: string, pivotTableId: string, sourceRangeInfo: IUnitRangeNameWithSubUnitId, preferredPivotCacheId?: string): boolean;
65
69
  getPivotTableConfig(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableConfig | undefined;
66
70
  /**
67
71
  * - get the pivot table model json config
@@ -72,8 +76,10 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
72
76
  */
73
77
  getPivotTableModelConfig(unitId: string, subUnitId: string, pivotTableId: string): IPivotTableSnapshot | undefined;
74
78
  getPivotTableInstance(pivotTableId: string): PivotTable | undefined;
79
+ getPivotCacheId(unitId: string, pivotTableId: string): string | undefined;
80
+ getPivotCacheHandle(unitId: string, pivotTableId: string): IPivotCacheHandle | undefined;
75
81
  deleteUnitId(unitId: string): void;
76
- addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo: IPivotCellPositionInfo): IUpdateInfo;
82
+ addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo?: IPivotCellPositionInfo, reportScope?: IPivotReportScope): IUpdateInfo;
77
83
  /**
78
84
  * - this function just create a collection with data range info, but wil not add it to the dataFieldManager
79
85
  */
@@ -84,6 +90,7 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
84
90
  }[], dataRangeInfo: IUnitRangeNameWithSubUnitId): void;
85
91
  removeDataField(unitId: string, dataFieldId: string): void;
86
92
  removeCollections(unitId: string, token: string): void;
93
+ syncCollectionConfig(unitId: string): void;
87
94
  getSubUnitPivotConfigs(unitId: string, subUnitId: string): Map<string, IPivotTableConfig> | undefined;
88
95
  getTargetByPivotId(pivotTableId: string): {
89
96
  unitId: string;
@@ -1,6 +1,6 @@
1
+ import type { IUniverSheetsPivotConfig } from './config/config';
1
2
  import { ICommandService, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
3
  import { DataSyncPrimaryController } from '@univerjs/rpc';
3
- import type { IUniverSheetsPivotConfig } from './config/config';
4
4
  export declare class UniverSheetsPivotTablePlugin extends Plugin {
5
5
  private readonly _config;
6
6
  readonly _injector: Injector;
@@ -0,0 +1,35 @@
1
+ import type { DataFieldManager } from '@univerjs-pro/engine-pivot';
2
+ import type { IPivotCacheHandle } from '@univerjs-pro/pivot-cache';
3
+ import type { ISheetsPivotCacheSnapshot, IUnitRangeNameWithSubUnitId } from '../const/type';
4
+ import { Disposable, IUniverInstanceService } from '@univerjs/core';
5
+ export interface ISheetsPivotCacheRefreshPayload {
6
+ dirtyFieldIds: readonly string[];
7
+ previousFieldNames: Readonly<Record<string, string>>;
8
+ }
9
+ export interface ISheetsPivotCacheRefreshResult extends ISheetsPivotCacheRefreshPayload {
10
+ pivotCacheId: string;
11
+ revision: number;
12
+ }
13
+ export declare class SheetsPivotCacheService extends Disposable {
14
+ private readonly _univerInstanceService;
15
+ private readonly _cacheById;
16
+ private readonly _cacheBySourceKey;
17
+ private readonly _reportBindings;
18
+ private readonly _refreshCycleCache;
19
+ constructor(_univerInstanceService: IUniverInstanceService);
20
+ acquireForReport(reportUnitId: string, reportId: string, sourceRangeInfo: IUnitRangeNameWithSubUnitId, dataFieldManager: DataFieldManager, preferredPivotCacheId?: string): IPivotCacheHandle;
21
+ releaseReport(reportUnitId: string, reportId: string): void;
22
+ acquireById(ownerUnitId: string, pivotCacheId: string): IPivotCacheHandle;
23
+ getReportPivotCacheId(reportUnitId: string, reportId: string): string | undefined;
24
+ getReportHandle(reportUnitId: string, reportId: string): IPivotCacheHandle | undefined;
25
+ toJSON(unitId: string): Record<string, ISheetsPivotCacheSnapshot>;
26
+ fromJSON(unitId: string, snapshots: Record<string, ISheetsPivotCacheSnapshot>, dataFieldManager: DataFieldManager): void;
27
+ pruneUnreferenced(unitId: string): void;
28
+ deleteUnitId(unitId: string): void;
29
+ refreshOnce(pivotCacheId: string, cycleKey: object, refresh: () => ISheetsPivotCacheRefreshPayload): ISheetsPivotCacheRefreshResult;
30
+ dispose(): void;
31
+ private _normalizeSource;
32
+ private _createRecord;
33
+ private _createHandle;
34
+ private _deleteRecordIfUnused;
35
+ }
@@ -0,0 +1,10 @@
1
+ import type { IPivotCacheHandle, IPivotCacheProvider, IPivotCacheReference, IUnitPivotCacheReference } from '@univerjs-pro/pivot-cache';
2
+ import { PivotCacheReferenceKindEnum } from '@univerjs-pro/pivot-cache';
3
+ import { SheetsPivotCacheService } from './sheets-pivot-cache.service';
4
+ export declare class SheetsPivotUnitCacheProvider implements IPivotCacheProvider<IUnitPivotCacheReference> {
5
+ private readonly _cacheService;
6
+ readonly kind = PivotCacheReferenceKindEnum.Unit;
7
+ constructor(_cacheService: SheetsPivotCacheService);
8
+ isReference(reference: IPivotCacheReference): reference is IUnitPivotCacheReference;
9
+ acquire(reference: IUnitPivotCacheReference): IPivotCacheHandle;
10
+ }