@univerjs-pro/sheets-pivot 1.2.0 → 1.3.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.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/locale/ar-SA.js +1 -1
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/de-DE.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/id-ID.js +1 -1
- package/lib/cjs/locale/it-IT.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/pl-PL.js +1 -1
- package/lib/cjs/locale/pt-BR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-HK.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/locale/ar-SA.js +1 -1
- package/lib/es/locale/ca-ES.js +1 -1
- package/lib/es/locale/de-DE.js +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/es-ES.js +1 -1
- package/lib/es/locale/fa-IR.js +1 -1
- package/lib/es/locale/fr-FR.js +1 -1
- package/lib/es/locale/id-ID.js +1 -1
- package/lib/es/locale/it-IT.js +1 -1
- package/lib/es/locale/ja-JP.js +1 -1
- package/lib/es/locale/ko-KR.js +1 -1
- package/lib/es/locale/pl-PL.js +1 -1
- package/lib/es/locale/pt-BR.js +1 -1
- package/lib/es/locale/ru-RU.js +1 -1
- package/lib/es/locale/sk-SK.js +1 -1
- package/lib/es/locale/vi-VN.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/es/locale/zh-HK.js +1 -1
- package/lib/es/locale/zh-TW.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/ar-SA.js +1 -1
- package/lib/locale/ca-ES.js +1 -1
- package/lib/locale/de-DE.js +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/es-ES.js +1 -1
- package/lib/locale/fa-IR.js +1 -1
- package/lib/locale/fr-FR.js +1 -1
- package/lib/locale/id-ID.js +1 -1
- package/lib/locale/it-IT.js +1 -1
- package/lib/locale/ja-JP.js +1 -1
- package/lib/locale/ko-KR.js +1 -1
- package/lib/locale/pl-PL.js +1 -1
- package/lib/locale/pt-BR.js +1 -1
- package/lib/locale/ru-RU.js +1 -1
- package/lib/locale/sk-SK.js +1 -1
- package/lib/locale/vi-VN.js +1 -1
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-HK.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/lib/types/commands/command/group-command-util.d.ts +12 -0
- package/lib/types/commands/command/set-pivot-excel-date-group.command.d.ts +10 -0
- package/lib/types/commands/command/set-pivot-filter.command.d.ts +2 -0
- package/lib/types/commands/command/set-pivot-manual-groups.command.d.ts +10 -0
- package/lib/types/commands/command/set-pivot-number-group.command.d.ts +10 -0
- package/lib/types/commands/command/util.d.ts +7 -1
- package/lib/types/commands/mutations/pivot-data-communication.mutation.d.ts +3 -1
- package/lib/types/config/config.d.ts +2 -2
- package/lib/types/const/const.d.ts +9 -2
- package/lib/types/const/type.d.ts +92 -1
- package/lib/types/controllers/sheets-pivot-ref-range.controller.d.ts +2 -0
- package/lib/types/controllers/sheets-pivot-rpc.controller.d.ts +9 -2
- package/lib/types/facade/f-enum.d.ts +12 -3
- package/lib/types/facade/f-generic-pivot-table.d.ts +2 -1
- package/lib/types/facade/f-pivot-table.d.ts +101 -1
- package/lib/types/index.d.ts +7 -2
- package/lib/types/locale/en-US.d.ts +9 -0
- package/lib/types/models/sheets-pivot-config-model.d.ts +55 -9
- package/lib/types/models/sheets-pivot-data-field-manager.d.ts +18 -7
- package/lib/types/models/sheets-pivot-data-source-model.d.ts +25 -3
- package/lib/types/record-filter-bridge.d.ts +9 -0
- package/lib/types/services/sheets-pivot-cache.service.d.ts +15 -3
- package/lib/types/services/sheets-pivot-table.service.d.ts +7 -0
- package/lib/types/util.d.ts +5 -11
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +12 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IPivotTableLabelFieldJSON, IPivotTableOptions, IPivotTableShowDataAsInfo, IPivotTableSortInfo, IPivotTableValueFieldJSON, IPivotTableValueFilter, IValueFilterInfoItem, PivotDataFieldDataTypeEnum, PivotDateGroupFieldDateTypeEnum, PivotSubtotalTypeEnum, PivotTableValuePositionEnum } from '@univerjs-pro/engine-pivot';
|
|
1
|
+
import type { IExcelDateGrouping, IManualGroup, INumberGrouping, IPivotTableLabelFieldJSON, IPivotTableOptions, IPivotTableShowDataAsInfo, IPivotTableSortInfo, IPivotTableValueFieldJSON, IPivotTableValueFilter, IValueFilterInfoItem, PivotDataFieldDataTypeEnum, PivotDateGroupFieldDateTypeEnum, PivotDateGroupingMode, PivotSubtotalTypeEnum, PivotTableValuePositionEnum } from '@univerjs-pro/engine-pivot';
|
|
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';
|
|
@@ -162,6 +162,21 @@ export declare class FPivotTable extends FBase {
|
|
|
162
162
|
* ```
|
|
163
163
|
*/
|
|
164
164
|
getOptions(): IPivotTableOptions | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* @description Get the effective date grouping mode of the pivot table. The mode defaults to legacy when not configured.
|
|
167
|
+
* @returns {PivotDateGroupingMode|undefined} The date grouping mode, or undefined if the pivot table no longer exists.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
172
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
173
|
+
* if (!fWorksheet) return;
|
|
174
|
+
* const fPivotTable = fWorkbook.getPivotTableByCell(fWorkbook.getId(), fWorksheet.getSheetId(), 0, 8);
|
|
175
|
+
* const mode = fPivotTable?.getDateGroupingMode();
|
|
176
|
+
* console.log(mode === univerAPI.Enum.PivotDateGroupingMode.ExcelLike);
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
getDateGroupingMode(): PivotDateGroupingMode | undefined;
|
|
165
180
|
/**
|
|
166
181
|
* @description Get the pivot table layout type.
|
|
167
182
|
* @returns {PivotLayoutTypeEnum|undefined} The layout type, or undefined if the pivot table no longer exists.
|
|
@@ -236,6 +251,21 @@ export declare class FPivotTable extends FBase {
|
|
|
236
251
|
* ```
|
|
237
252
|
*/
|
|
238
253
|
setOptions(options: IPivotTableOptions): Promise<boolean>;
|
|
254
|
+
/**
|
|
255
|
+
* @description Set the pivot table date grouping mode through the option command. Switching modes clears existing date groups.
|
|
256
|
+
* @param {PivotDateGroupingMode} mode The date grouping mode to set.
|
|
257
|
+
* @returns {Promise<boolean>} Whether the date grouping mode was set successfully.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
262
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
263
|
+
* if (!fWorksheet) return;
|
|
264
|
+
* const fPivotTable = fWorkbook.getPivotTableByCell(fWorkbook.getId(), fWorksheet.getSheetId(), 0, 8);
|
|
265
|
+
* await fPivotTable?.setDateGroupingMode(univerAPI.Enum.PivotDateGroupingMode.ExcelLike);
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
setDateGroupingMode(mode: PivotDateGroupingMode): Promise<boolean>;
|
|
239
269
|
/**
|
|
240
270
|
* @description Set the pivot table layout type through command. It keeps undo/redo, collaboration and render update paths consistent with panel operations.
|
|
241
271
|
* @param {PivotLayoutTypeEnum} layout The layout type to set.
|
|
@@ -904,6 +934,76 @@ export declare class FPivotTable extends FBase {
|
|
|
904
934
|
* ```
|
|
905
935
|
*/
|
|
906
936
|
setDateGroupType(tableFieldId: string, dateType: PivotDateGroupFieldDateTypeEnum): Promise<boolean>;
|
|
937
|
+
/**
|
|
938
|
+
* @description Group a date label field by Excel-style calendar units. The pivot table must use Excel-like date grouping mode.
|
|
939
|
+
* @param {string} tableFieldId The source label field id.
|
|
940
|
+
* @param {IExcelDateGrouping} grouping The date units and range settings.
|
|
941
|
+
* @returns {Promise<boolean>} Whether the date group was set successfully.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* ```ts
|
|
945
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
946
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
947
|
+
* if (!fWorksheet) return;
|
|
948
|
+
* const fPivotTable = fWorkbook.getPivotTableByCell(fWorkbook.getId(), fWorksheet.getSheetId(), 0, 8);
|
|
949
|
+
* const rowIds = fPivotTable?.getFieldIdsByArea(univerAPI.Enum.PivotTableFiledAreaEnum.Row);
|
|
950
|
+
* if (rowIds?.length) {
|
|
951
|
+
* await fPivotTable?.setExcelDateGroup(rowIds[0], {
|
|
952
|
+
* units: [univerAPI.Enum.PivotExcelDateGroupUnit.Year, univerAPI.Enum.PivotExcelDateGroupUnit.Month],
|
|
953
|
+
* autoStart: true,
|
|
954
|
+
* autoEnd: true,
|
|
955
|
+
* });
|
|
956
|
+
* }
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
setExcelDateGroup(tableFieldId: string, grouping: IExcelDateGrouping): Promise<boolean>;
|
|
960
|
+
/**
|
|
961
|
+
* @description Group a numeric label field into intervals.
|
|
962
|
+
* @param {string} tableFieldId The source label field id.
|
|
963
|
+
* @param {INumberGrouping} grouping The numeric range and interval settings.
|
|
964
|
+
* @returns {Promise<boolean>} Whether the number group was set successfully.
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```ts
|
|
968
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
969
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
970
|
+
* if (!fWorksheet) return;
|
|
971
|
+
* const fPivotTable = fWorkbook.getPivotTableByCell(fWorkbook.getId(), fWorksheet.getSheetId(), 0, 8);
|
|
972
|
+
* const rowIds = fPivotTable?.getFieldIdsByArea(univerAPI.Enum.PivotTableFiledAreaEnum.Row);
|
|
973
|
+
* if (rowIds?.length) {
|
|
974
|
+
* await fPivotTable?.setNumberGroup(rowIds[0], { autoStart: true, autoEnd: true, interval: 10 });
|
|
975
|
+
* }
|
|
976
|
+
* ```
|
|
977
|
+
*/
|
|
978
|
+
setNumberGroup(tableFieldId: string, grouping: INumberGrouping): Promise<boolean>;
|
|
979
|
+
/**
|
|
980
|
+
* @description Replace the manual member groups of one source field. Pass an empty array to remove all manual groups.
|
|
981
|
+
* Each group keeps its stable `id` when renamed; members retain their value types even when displayed labels match.
|
|
982
|
+
* @param {string} sourceFieldId The original source field id, not the derived group or table field id.
|
|
983
|
+
* @param {IManualGroup[]} groups The complete next set of groups, each with an id, name, and at least two source members.
|
|
984
|
+
* @returns {Promise<boolean>} Whether the manual groups were updated successfully.
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```ts
|
|
988
|
+
* import { RecordValueType } from '@univerjs/core';
|
|
989
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
990
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
991
|
+
* if (!fWorksheet) return;
|
|
992
|
+
* const fPivotTable = fWorkbook.getPivotTableByCell(fWorkbook.getId(), fWorksheet.getSheetId(), 0, 8);
|
|
993
|
+
* const sourceFieldId = fPivotTable?.getSourceFieldsInfo().find((field) => field.name === 'Region')?.id;
|
|
994
|
+
* if (sourceFieldId) {
|
|
995
|
+
* await fPivotTable?.setManualGroups(sourceFieldId, [{
|
|
996
|
+
* id: 'north',
|
|
997
|
+
* name: 'North',
|
|
998
|
+
* members: [
|
|
999
|
+
* { type: RecordValueType.String, value: 'East' },
|
|
1000
|
+
* { type: RecordValueType.String, value: 'West' },
|
|
1001
|
+
* ],
|
|
1002
|
+
* }]);
|
|
1003
|
+
* }
|
|
1004
|
+
* ```
|
|
1005
|
+
*/
|
|
1006
|
+
setManualGroups(sourceFieldId: string, groups: IManualGroup[]): Promise<boolean>;
|
|
907
1007
|
/**
|
|
908
1008
|
* @description Collapse or expand a pivot table item by the cell position through command.
|
|
909
1009
|
* @param {number} row - The row index of the pivot item cell.
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,11 +20,14 @@ export type { ISetPivotCollapseByFieldCommandParams } from './commands/command/s
|
|
|
20
20
|
export { SetPivotCollapseCommand } from './commands/command/set-pivot-collapse.command';
|
|
21
21
|
export type { ISetPivotCollapseCommandParams } from './commands/command/set-pivot-collapse.command';
|
|
22
22
|
export { SetPivotDateGroupCommand } from './commands/command/set-pivot-date-group.command';
|
|
23
|
+
export { SetPivotExcelDateGroupCommand } from './commands/command/set-pivot-excel-date-group.command';
|
|
23
24
|
export { SetPivotFieldsConfigCommand } from './commands/command/set-pivot-fields-config.command';
|
|
24
25
|
export type { ISetPivotFieldsConfigCommandParams } from './commands/command/set-pivot-fields-config.command';
|
|
25
26
|
export { SetPivotFilterCommand } from './commands/command/set-pivot-filter.command';
|
|
26
27
|
export type { ISetPivotFilterCommandParams } from './commands/command/set-pivot-filter.command';
|
|
27
28
|
export { SetPivotLayoutCommand } from './commands/command/set-pivot-layout.command';
|
|
29
|
+
export { SetPivotManualGroupsCommand } from './commands/command/set-pivot-manual-groups.command';
|
|
30
|
+
export { SetPivotNumberGroupCommand } from './commands/command/set-pivot-number-group.command';
|
|
28
31
|
export { SetPivotOptionCommand } from './commands/command/set-pivot-option.command';
|
|
29
32
|
export { SetPivotSortCommand } from './commands/command/set-pivot-sort.command';
|
|
30
33
|
export type { ISetPivotSortCommandParams } from './commands/command/set-pivot-sort.command';
|
|
@@ -57,7 +60,8 @@ export { UpdateValuePositionMutation } from './commands/mutations/update-value-p
|
|
|
57
60
|
export { SHEETS_PIVOT_PLUGIN_CONFIG_KEY } from './config/config';
|
|
58
61
|
export type { IUniverSheetsPivotConfig } from './config/config';
|
|
59
62
|
export { BLANK_ROW_COUNT, getAdjustRangesPosition, PivotDisplayDataType, PositionType, SHEET_PIVOT_TABLE_PLUGIN, } from './const/const';
|
|
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';
|
|
63
|
+
export type { IAddPivotTableMutationParams, IPivotCellPositionInfo, IPivotCollectionChange, IPivotManualFilterCoordinationParams, IPivotManualFilterCoordinationResult, IPivotPanelDataInfo, IPivotPanelSourceList, IPivotPanelTableListItemBase, IPivotRangesInfo, IPivotReportScope, IPivotTableAddedEventParams, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableMovedEventParams, IPivotTableRemovedEventParams, IPivotTableRenderedEventParams, IPivotViewUpdateInfo, IRemovePivotTableMutationParams, ISendPivotViewLocalMutationParams, ISetPivotLayoutMutationParams, ISetPivotOptionMutationParams, IUnitRangeNameWithSubUnitId, } from './const/type';
|
|
64
|
+
export { PIVOT_FIELD_REMOVE_COORDINATION, PIVOT_MANUAL_FILTER_COORDINATION, PivotTableOperationEnum, } from './const/type';
|
|
61
65
|
export { PivotCalculatorController } from './controllers/sheets-pivot-caculate.controller';
|
|
62
66
|
export { getOrCreatePivotSheetCopyPlan, PIVOT_SHEET_COPY_CONTEXT_KEY, remapPivotReportDataFields, } from './models/pivot-sheet-copy-plan';
|
|
63
67
|
export type { IPivotSheetCopyPlan, IPivotSheetCopyPlanEntry, IPivotSheetCopyScope, IPivotSheetCopySource, IPivotSheetDataFieldCopyContext, } from './models/pivot-sheet-copy-plan';
|
|
@@ -66,8 +70,9 @@ export { SheetsPivotTableConfigModel } from './models/sheets-pivot-config-model'
|
|
|
66
70
|
export { SheetsPivotDataSourceModel } from './models/sheets-pivot-data-source-model';
|
|
67
71
|
export { SheetsPivotTableAdaptorModel } from './models/sheets-pivot-table-adaptor-model';
|
|
68
72
|
export { UniverSheetsPivotTablePlugin } from './plugin';
|
|
73
|
+
export { compilePivotRecordFilter, getSlicerSelectionFromPivotManualFilter } from './record-filter-bridge';
|
|
69
74
|
export { SheetsPivotCacheService } from './services/sheets-pivot-cache.service';
|
|
70
75
|
export { SheetsPivotRPCService } from './services/sheets-pivot-rpc.service';
|
|
71
76
|
export { SheetsPivotTableService } from './services/sheets-pivot-table.service';
|
|
72
77
|
export type { IPivotSheetCellContext, IPivotValueFilterTarget } from './util';
|
|
73
|
-
export { generateSetRangeValueMutations, getDateGroupName, getEmptyPivotRanges, getPivotAppliedRanges, resolvePivotSheetCell, resolvePivotValueFieldId, resolvePivotValueFilterTarget, setPivotDateSystem, unionPivotViewRange, } from './util';
|
|
78
|
+
export { generateSetRangeValueMutations, getDateGroupName, getEmptyPivotRanges, getInsertRowColMutations, getPivotAppliedRanges, resolvePivotSheetCell, resolvePivotValueFieldId, resolvePivotValueFilterTarget, setPivotDateSystem, unionPivotViewRange, } from './util';
|
|
@@ -39,6 +39,7 @@ declare const locale: {
|
|
|
39
39
|
values: string;
|
|
40
40
|
};
|
|
41
41
|
dateGroup: {
|
|
42
|
+
second: string;
|
|
42
43
|
year: string;
|
|
43
44
|
month: string;
|
|
44
45
|
day: string;
|
|
@@ -52,7 +53,15 @@ declare const locale: {
|
|
|
52
53
|
yearMonth: string;
|
|
53
54
|
yearMonthDate: string;
|
|
54
55
|
};
|
|
56
|
+
numberGroupRange: string;
|
|
57
|
+
numberGroupClosedRange: string;
|
|
58
|
+
numberGroupBefore: string;
|
|
59
|
+
numberGroupAfter: string;
|
|
55
60
|
cellDateGroupDisplay: {
|
|
61
|
+
second: string;
|
|
62
|
+
before: string;
|
|
63
|
+
after: string;
|
|
64
|
+
dayRange: string;
|
|
56
65
|
minute: string;
|
|
57
66
|
hour: string;
|
|
58
67
|
hourMinute: string;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { IFieldsCollectionJSON } from '@univerjs-pro/engine-pivot';
|
|
2
2
|
import type { Nullable, ObjectMatrix } from '@univerjs/core';
|
|
3
|
-
import type { IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotRangesInfo, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableRangeInfo } from '../const/type';
|
|
4
3
|
import { Disposable, ICommandService, IConfigService, Injector, IResourceManagerService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
4
|
+
import type { IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotCollectionChange, IPivotRangesInfo, IPivotTableCellData, IPivotTableConfig, IPivotTableMatrixInfo, IPivotTableRangeInfo, ISheetsPivotCacheSnapshot } from '../const/type';
|
|
5
|
+
interface IPivotConfigChange {
|
|
6
|
+
unitId: string;
|
|
7
|
+
subUnitId: string;
|
|
8
|
+
pivotTableId: string;
|
|
9
|
+
pivotTableConfig: Nullable<IPivotTableConfig>;
|
|
10
|
+
}
|
|
5
11
|
export declare class SheetsPivotTableConfigModel extends Disposable {
|
|
6
12
|
private _injector;
|
|
7
13
|
private _commandService;
|
|
@@ -11,23 +17,44 @@ export declare class SheetsPivotTableConfigModel extends Disposable {
|
|
|
11
17
|
private readonly _localeService;
|
|
12
18
|
private _model;
|
|
13
19
|
private _collectionConfigModel;
|
|
20
|
+
private readonly _cacheConfigModel;
|
|
21
|
+
private readonly _retainedSources;
|
|
22
|
+
private readonly _runtimeIds;
|
|
23
|
+
private readonly _runtimeStates;
|
|
24
|
+
private readonly _runtimeState$;
|
|
25
|
+
readonly runtimeState$: import("rxjs").Observable<{
|
|
26
|
+
unitId: string;
|
|
27
|
+
state: "initializing" | "ready" | "error";
|
|
28
|
+
}>;
|
|
14
29
|
private _pivotTableRangeInfo;
|
|
15
30
|
private _pivotTableMatrixInfo;
|
|
16
|
-
private
|
|
31
|
+
private readonly _collectionChange$;
|
|
32
|
+
readonly collectionChange$: import("rxjs").Observable<IPivotCollectionChange>;
|
|
33
|
+
private _pendingChanges?;
|
|
17
34
|
private _pivotInitCompleted$;
|
|
18
35
|
pivotInitCompleted$: import("rxjs").Observable<boolean>;
|
|
19
36
|
private _pivotConfigChange$;
|
|
20
|
-
pivotConfigChange$: import("rxjs").Observable<
|
|
21
|
-
unitId: string;
|
|
22
|
-
subUnitId: string;
|
|
23
|
-
pivotTableId: string;
|
|
24
|
-
pivotTableConfig: Nullable<IPivotTableConfig>;
|
|
25
|
-
}>;
|
|
37
|
+
pivotConfigChange$: import("rxjs").Observable<IPivotConfigChange>;
|
|
26
38
|
private _textInfo;
|
|
27
|
-
configVersion$: import("rxjs").Observable<number>;
|
|
28
39
|
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _resourceManagerService: IResourceManagerService, _configService: IConfigService, _localeService: LocaleService);
|
|
40
|
+
/** Publish notifications only after all related synchronous model writes have completed. */
|
|
41
|
+
batchUpdate<T>(update: () => T): T;
|
|
42
|
+
watchPivotTableChanges(unitId: string, subUnitId: string, pivotTableId: string): import("rxjs").Observable<IPivotCollectionChange | IPivotConfigChange>;
|
|
43
|
+
private _emitConfigChange;
|
|
44
|
+
private _emitCollectionChange;
|
|
45
|
+
private _moveSources;
|
|
29
46
|
private _initUnitDisposed;
|
|
30
47
|
setPivotInitCompleted(): void;
|
|
48
|
+
beginRuntime(unitId: string, runtimeId: string): void;
|
|
49
|
+
getRuntimeId(unitId: string): string | undefined;
|
|
50
|
+
getRuntimeState(unitId: string): 'initializing' | 'ready' | 'error' | undefined;
|
|
51
|
+
setRuntimeState(unitId: string, state: 'initializing' | 'ready' | 'error'): void;
|
|
52
|
+
acceptsRuntime(unitId: string, runtimeId?: string): boolean;
|
|
53
|
+
/** Worker results may refresh derived names, but never replace mutation-owned configuration. */
|
|
54
|
+
updateDerivedConfig(unitId: string, subUnitId: string, pivotTableId: string, result: Nullable<IPivotTableConfig>, collection?: IFieldsCollectionJSON): boolean;
|
|
55
|
+
private _getDefaultFieldName;
|
|
56
|
+
private _getCalculationConfig;
|
|
57
|
+
updateDerivedMetadata(unitId: string, metadata?: IDataFieldManagerJSON, caches?: Record<string, ISheetsPivotCacheSnapshot>): void;
|
|
31
58
|
private _initLocale;
|
|
32
59
|
getTextInfo(): Record<string, string>;
|
|
33
60
|
updateViewInfo(unitId: string, subUnitId: string, pivotTableId: string, valueMatrix: ObjectMatrix<Nullable<IPivotTableCellData>>, rangesCache: IPivotRangesInfo | undefined): void;
|
|
@@ -36,8 +63,26 @@ export declare class SheetsPivotTableConfigModel extends Disposable {
|
|
|
36
63
|
getTargetByPivotId(unitId: string, subUnitId: string, pivotTableId: string): Nullable<IPivotCellPositionInfo>;
|
|
37
64
|
getSubUnitPivotConfigs(unitId: string, subUnitId: string): Map<string, IPivotTableConfig> | undefined;
|
|
38
65
|
updateConfigCache(unitId: string, subUnitId: string, pivotTableId: string, pivotTableConfig: Nullable<IPivotTableConfig>): void;
|
|
66
|
+
prepareConfigBatch(updates: readonly {
|
|
67
|
+
unitId: string;
|
|
68
|
+
subUnitId: string;
|
|
69
|
+
pivotTableId: string;
|
|
70
|
+
config: IPivotTableConfig;
|
|
71
|
+
}[]): {
|
|
72
|
+
commit(): void;
|
|
73
|
+
publish(): void;
|
|
74
|
+
};
|
|
75
|
+
applyConfigChange(scope: {
|
|
76
|
+
unitId: string;
|
|
77
|
+
subUnitId: string;
|
|
78
|
+
pivotTableId: string;
|
|
79
|
+
}, apply: (config: IPivotTableConfig) => void): boolean;
|
|
39
80
|
getCollection(unitId: string, pivotTableId: string): IFieldsCollectionJSON | undefined;
|
|
40
81
|
updateCollectionConfig(unitId: string, collectionConfig: IDataFieldManagerJSON): void;
|
|
82
|
+
updateCacheConfig(unitId: string, configs: Record<string, ISheetsPivotCacheSnapshot>): void;
|
|
83
|
+
setRetainedSources(unitId: string, pivotCacheIds: readonly string[]): void;
|
|
84
|
+
updateCollectionMetadata(unitId: string, reportId: string, collection: IFieldsCollectionJSON, cache?: ISheetsPivotCacheSnapshot): void;
|
|
85
|
+
removeCollectionMetadata(unitId: string, reportId: string): void;
|
|
41
86
|
private _ensurePivotMap;
|
|
42
87
|
private _ensurePivotTableRangeInfo;
|
|
43
88
|
private _ensurePivotTableMatrixInfo;
|
|
@@ -63,3 +108,4 @@ export declare class SheetsPivotTableConfigModel extends Disposable {
|
|
|
63
108
|
private _toJSON;
|
|
64
109
|
private _initSnapshot;
|
|
65
110
|
}
|
|
111
|
+
export {};
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import type { IDataFieldValue, IFieldsCollectionJSON, PivotSubtotalTypeEnum } from '@univerjs-pro/engine-pivot';
|
|
2
|
-
import type { ICellData, IRange, IUnitRangeName, IUniverInstanceService, Nullable, ObjectMatrix, Styles, Worksheet } from '@univerjs/core';
|
|
1
|
+
import type { IDataFieldValue, IFieldsCollectionJSON, IPivotTableRecordFilter, PivotSubtotalTypeEnum } from '@univerjs-pro/engine-pivot';
|
|
2
|
+
import type { ICellData, IDisposable, IRange, IUnitRangeName, IUniverInstanceService, Nullable, ObjectMatrix, Styles, Worksheet } from '@univerjs/core';
|
|
3
3
|
import type { IRuntimeUnitDataType } from '@univerjs/engine-formula';
|
|
4
|
+
import { DataField, DataFieldManager, FieldsCollection } from '@univerjs-pro/engine-pivot';
|
|
5
|
+
import { numfmt } from '@univerjs/core';
|
|
4
6
|
import type { ICurrentDataMatrix, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotReportScope, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
|
|
5
7
|
import type { SheetsPivotDataSourceModel } from './sheets-pivot-data-source-model';
|
|
6
|
-
import { DataField, DataFieldManager, FieldsCollection } from '@univerjs-pro/engine-pivot';
|
|
7
8
|
interface IFeatureDirtyRangeType {
|
|
8
9
|
[unitId: string]: Nullable<{
|
|
9
10
|
[sheetId: string]: IRange[];
|
|
10
11
|
}>;
|
|
11
12
|
}
|
|
13
|
+
type TPatternInfoRecord = Record<string, ReturnType<typeof numfmt.getFormatInfo>>;
|
|
12
14
|
export declare class SheetsPivotDataFieldManager extends DataFieldManager {
|
|
15
|
+
compileRecordFilter(filter: IPivotTableRecordFilter): (value: IDataFieldValue) => boolean;
|
|
13
16
|
/**
|
|
14
17
|
* 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
18
|
*/
|
|
16
19
|
rangeKeyMap: Record<string, string>;
|
|
17
20
|
private _reportScopeMap;
|
|
21
|
+
private readonly _sourceFieldLeases;
|
|
18
22
|
private _univerInstanceService;
|
|
19
|
-
_host: SheetsPivotDataSourceModel;
|
|
23
|
+
_host: SheetsPivotDataSourceModel | null;
|
|
20
24
|
constructor(host: SheetsPivotDataSourceModel, univerInstanceService: IUniverInstanceService);
|
|
21
25
|
initDataRanges(): void;
|
|
26
|
+
retainSourceFields(source: IUnitRangeNameWithSubUnitId): IDisposable;
|
|
27
|
+
getNoUsedDataFieldIds(excludeCollectionToken: string): string[];
|
|
22
28
|
getAutoDisplayNameFunction(): (baseName: string, subtotalType: PivotSubtotalTypeEnum) => string;
|
|
23
29
|
deleteDataField(dataFieldId: string): void;
|
|
24
30
|
/**
|
|
@@ -44,6 +50,10 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
|
|
|
44
50
|
getCollection(token: string): FieldsCollection;
|
|
45
51
|
addCollection(token: string, collection: FieldsCollection, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo?: IPivotCellPositionInfo, reportScope?: IPivotReportScope): void;
|
|
46
52
|
handleMoveRange(token: string, sourceRangeInfo: IUnitRangeNameWithSubUnitId): void;
|
|
53
|
+
handleMoveRange(sources: readonly {
|
|
54
|
+
before: IUnitRangeNameWithSubUnitId;
|
|
55
|
+
after: IUnitRangeNameWithSubUnitId;
|
|
56
|
+
}[]): void;
|
|
47
57
|
getPivotDirtyViewInfo(): {
|
|
48
58
|
runtimeCellData: IRuntimeUnitDataType;
|
|
49
59
|
dirtyRanges: IFeatureDirtyRangeType;
|
|
@@ -56,9 +66,10 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
|
|
|
56
66
|
* @param unitDataMatrix the unit data matrix from runtime data
|
|
57
67
|
* @param {number} rowIndex - the row index
|
|
58
68
|
* @param {number} colIndex - the column index
|
|
59
|
-
* @returns {Nullable<ICellData>} the cell data
|
|
69
|
+
* @returns {Nullable<ICellData>} the resolved cell data
|
|
60
70
|
*/
|
|
61
71
|
getMatrixValue(matrix: ObjectMatrix<Nullable<ICellData>>, arrayFormulaCellDataMatrix: ObjectMatrix<Nullable<ICellData>> | undefined, unitDataMatrix: ObjectMatrix<Nullable<ICellData>> | undefined, rowIndex: number, colIndex: number): Nullable<ICellData>;
|
|
72
|
+
private _getResolvedMatrixValue;
|
|
62
73
|
refreshDataField(dataFieldId: string, dataRangeInfo: IUnitRangeNameWithSubUnitId, index: number, currentDataMatrix?: ICurrentDataMatrix): void;
|
|
63
74
|
refreshData(collection: FieldsCollection, list: {
|
|
64
75
|
index: number;
|
|
@@ -69,10 +80,10 @@ export declare class SheetsPivotDataFieldManager extends DataFieldManager {
|
|
|
69
80
|
* - adjust sheet cell value to the type that pivot engine can recognize
|
|
70
81
|
* @param {Nullable<ICellData>} cellData the cell data
|
|
71
82
|
* @param {Styles} styles styles in the workbook
|
|
72
|
-
* @param {
|
|
83
|
+
* @param {TPatternInfoRecord} patternInfoRecord the pattern info record
|
|
73
84
|
* @returns {IDataFieldValue} the value to add into the data field
|
|
74
85
|
*/
|
|
75
|
-
adjustSheetCellData(cellData: Nullable<ICellData>, styles: Styles, patternInfoRecord:
|
|
86
|
+
adjustSheetCellData(cellData: Nullable<ICellData>, styles: Styles, patternInfoRecord: TPatternInfoRecord, isArrayFormulaCell?: boolean): IDataFieldValue;
|
|
76
87
|
getRangeData(dataRangeInfo: IUnitRangeName): {
|
|
77
88
|
header: (string | null)[];
|
|
78
89
|
data: IDataFieldValue[][];
|
|
@@ -2,10 +2,11 @@ import type { DataField, FieldsCollection, IFieldsCollectionJSON, IPivotTableSna
|
|
|
2
2
|
import type { IPivotCacheHandle } from '@univerjs-pro/pivot-cache';
|
|
3
3
|
import type { IUnitRangeName, Nullable } from '@univerjs/core';
|
|
4
4
|
import type { IMoveRangeMutationParams } from '@univerjs/sheets';
|
|
5
|
-
import type { ICollectionChangeInfo, IDataFieldManagerJSON, IPivotCellPositionInfo, IPivotMutationDirtyViewInfo, IPivotReportScope, IPivotTableConfig, IPivotTableJson, IPivotWorkerItemCache, ISendPivotConfigLocalMutationParams, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
|
|
6
|
-
import type { IViewTranslateCtx } from './view-util';
|
|
7
5
|
import { PivotTable } from '@univerjs-pro/engine-pivot';
|
|
8
6
|
import { Disposable, ICommandService, Injector, IResourceManagerService, IUniverInstanceService, LifecycleService } from '@univerjs/core';
|
|
7
|
+
import { IFeatureCalculationManagerService } from '@univerjs/engine-formula';
|
|
8
|
+
import type { ICollectionChangeInfo, ICurrentDataMatrix, IDataFieldManagerJSON, IInitializePivotRuntimeParams, IPivotCellPositionInfo, IPivotMutationDirtyViewInfo, IPivotReportScope, IPivotTableConfig, IPivotTableJson, IPivotWorkerItemCache, ISendPivotConfigLocalMutationParams, IUnitRangeNameWithSubUnitId, IUpdateInfo } from '../const/type';
|
|
9
|
+
import type { IViewTranslateCtx } from './view-util';
|
|
9
10
|
import { PivotTableOperationEnum } from '../const/type';
|
|
10
11
|
import { SheetsPivotCacheService } from '../services/sheets-pivot-cache.service';
|
|
11
12
|
import { SheetsPivotDataFieldManager } from './sheets-pivot-data-field-manager';
|
|
@@ -16,7 +17,9 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
|
|
|
16
17
|
private readonly _commandService;
|
|
17
18
|
private _resourceManagerService;
|
|
18
19
|
private readonly _sheetsPivotCacheService;
|
|
20
|
+
private readonly _sourceCalculation?;
|
|
19
21
|
private _model;
|
|
22
|
+
private readonly _runtimeUnits;
|
|
20
23
|
private _pivotTableInstanceCache;
|
|
21
24
|
private _viewData;
|
|
22
25
|
private _viewTranslateContextCache;
|
|
@@ -33,6 +36,7 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
|
|
|
33
36
|
private _fieldsCollectionChange$;
|
|
34
37
|
fieldsCollectionChange$: import("rxjs").Observable<Record<string, FieldsCollection>>;
|
|
35
38
|
private _dataFieldManagerCollection;
|
|
39
|
+
private readonly _sourceLeases;
|
|
36
40
|
needSameDeleteModel: {
|
|
37
41
|
deleteUnitId: (unitId: string) => void;
|
|
38
42
|
}[];
|
|
@@ -40,8 +44,11 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
|
|
|
40
44
|
* - this property is used to store the dirty pivot table collection which need to be marked dirty when mutations is executed
|
|
41
45
|
*/
|
|
42
46
|
private _queryingMap;
|
|
43
|
-
constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService, _commandService: ICommandService, _resourceManagerService: IResourceManagerService, _sheetsPivotCacheService: SheetsPivotCacheService);
|
|
47
|
+
constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService, _commandService: ICommandService, _resourceManagerService: IResourceManagerService, _sheetsPivotCacheService: SheetsPivotCacheService, _sourceCalculation?: IFeatureCalculationManagerService | undefined);
|
|
44
48
|
getTextInfo(): Record<string, string>;
|
|
49
|
+
getRuntimeId(unitId: string): string | undefined;
|
|
50
|
+
private _getRuntimeIds;
|
|
51
|
+
initializeRuntime(params: IInitializePivotRuntimeParams): boolean;
|
|
45
52
|
setTextInfo(textInfo: Record<string, string>, direction: 'ltr' | 'rtl'): void;
|
|
46
53
|
handleMoveRange(params: IMoveRangeMutationParams): void;
|
|
47
54
|
broadcastCollectionChange(info: ICollectionChangeInfo): void;
|
|
@@ -78,6 +85,21 @@ export declare class SheetsPivotDataSourceModel extends Disposable {
|
|
|
78
85
|
getPivotTableInstance(pivotTableId: string): PivotTable | undefined;
|
|
79
86
|
getPivotCacheId(unitId: string, pivotTableId: string): string | undefined;
|
|
80
87
|
getPivotCacheHandle(unitId: string, pivotTableId: string): IPivotCacheHandle | undefined;
|
|
88
|
+
/** Prepare owned report state and derived cell matrices without publishing partial reports. */
|
|
89
|
+
preparePivotBatch(updates: readonly {
|
|
90
|
+
unitId: string;
|
|
91
|
+
subUnitId: string;
|
|
92
|
+
pivotTableId: string;
|
|
93
|
+
pivot: PivotTable;
|
|
94
|
+
config: IPivotTableConfig;
|
|
95
|
+
view: PivotView;
|
|
96
|
+
}[]): {
|
|
97
|
+
commit(): void;
|
|
98
|
+
publish(): void;
|
|
99
|
+
};
|
|
100
|
+
acquireSource(unitId: string, pivotCacheId: string): IPivotCacheHandle;
|
|
101
|
+
/** Rebuild a retained source even when it has no surviving report collection. */
|
|
102
|
+
refreshSource(unitId: string, pivotCacheId: string, cycle?: object, matrix?: ICurrentDataMatrix): void;
|
|
81
103
|
deleteUnitId(unitId: string): void;
|
|
82
104
|
addCollectionByJSON(token: string, collectionJSON: IFieldsCollectionJSON, sourceRangeInfo: IUnitRangeNameWithSubUnitId, targetCellInfo?: IPivotCellPositionInfo, reportScope?: IPivotReportScope): IUpdateInfo;
|
|
83
105
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DataField, IDataFieldValue, IPivotTableRecordFilter } from '@univerjs-pro/engine-pivot';
|
|
2
|
+
import type { RecordSelection } from '@univerjs/core';
|
|
3
|
+
export declare function compilePivotRecordFilter(filter: IPivotTableRecordFilter): (value: IDataFieldValue) => boolean;
|
|
4
|
+
export interface IPivotRecordFilterItemState {
|
|
5
|
+
checkedItems: string[];
|
|
6
|
+
partialItems: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function getPivotRecordFilterItemState(field: DataField, filter: IPivotTableRecordFilter): IPivotRecordFilterItemState;
|
|
9
|
+
export declare function getSlicerSelectionFromPivotManualFilter(field: DataField, checkedItems: readonly string[], partialItems: readonly string[], current: RecordSelection, isAll: boolean): RecordSelection;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { DataFieldManager } from '@univerjs-pro/engine-pivot';
|
|
2
2
|
import type { IPivotCacheHandle } from '@univerjs-pro/pivot-cache';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IRange, Worksheet } from '@univerjs/core';
|
|
4
|
+
import type { IMoveRangeMutationParams } from '@univerjs/sheets';
|
|
4
5
|
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
6
|
+
import type { ISheetsPivotCacheSnapshot, IUnitRangeNameWithSubUnitId } from '../const/type';
|
|
5
7
|
export interface ISheetsPivotCacheRefreshPayload {
|
|
6
8
|
dirtyFieldIds: readonly string[];
|
|
7
9
|
previousFieldNames: Readonly<Record<string, string>>;
|
|
8
10
|
}
|
|
9
11
|
export interface ISheetsPivotCacheRefreshResult extends ISheetsPivotCacheRefreshPayload {
|
|
10
12
|
pivotCacheId: string;
|
|
11
|
-
revision: number;
|
|
12
13
|
}
|
|
13
14
|
export declare class SheetsPivotCacheService extends Disposable {
|
|
14
15
|
private readonly _univerInstanceService;
|
|
@@ -17,9 +18,18 @@ export declare class SheetsPivotCacheService extends Disposable {
|
|
|
17
18
|
private readonly _reportBindings;
|
|
18
19
|
private readonly _refreshCycleCache;
|
|
19
20
|
constructor(_univerInstanceService: IUniverInstanceService);
|
|
21
|
+
getExistingCacheId(source: IUnitRangeNameWithSubUnitId, dataFieldManager: DataFieldManager): string | undefined;
|
|
22
|
+
updateSource(pivotCacheId: string, source: IUnitRangeNameWithSubUnitId): void;
|
|
23
|
+
moveSources(params: IMoveRangeMutationParams): {
|
|
24
|
+
pivotCacheId: string;
|
|
25
|
+
before: IUnitRangeNameWithSubUnitId;
|
|
26
|
+
after: IUnitRangeNameWithSubUnitId;
|
|
27
|
+
}[];
|
|
28
|
+
private _findCache;
|
|
20
29
|
acquireForReport(reportUnitId: string, reportId: string, sourceRangeInfo: IUnitRangeNameWithSubUnitId, dataFieldManager: DataFieldManager, preferredPivotCacheId?: string): IPivotCacheHandle;
|
|
21
30
|
releaseReport(reportUnitId: string, reportId: string): void;
|
|
22
|
-
acquireById(ownerUnitId: string, pivotCacheId: string): IPivotCacheHandle;
|
|
31
|
+
acquireById(ownerUnitId: string, pivotCacheId: string, retainSource?: boolean): IPivotCacheHandle;
|
|
32
|
+
getSourceRange(ownerUnitId: string, pivotCacheId: string): IUnitRangeNameWithSubUnitId | undefined;
|
|
23
33
|
getReportPivotCacheId(reportUnitId: string, reportId: string): string | undefined;
|
|
24
34
|
getReportHandle(reportUnitId: string, reportId: string): IPivotCacheHandle | undefined;
|
|
25
35
|
toJSON(unitId: string): Record<string, ISheetsPivotCacheSnapshot>;
|
|
@@ -33,3 +43,5 @@ export declare class SheetsPivotCacheService extends Disposable {
|
|
|
33
43
|
private _createHandle;
|
|
34
44
|
private _deleteRecordIfUnused;
|
|
35
45
|
}
|
|
46
|
+
export declare function normalizeSourceRange(range: IRange, sheet: Worksheet): IRange;
|
|
47
|
+
export declare function getMovedPivotSource(source: IUnitRangeNameWithSubUnitId, params: IMoveRangeMutationParams, sheetName: string): IUnitRangeNameWithSubUnitId | undefined;
|
|
@@ -7,9 +7,16 @@ export declare class SheetsPivotTableService extends Disposable {
|
|
|
7
7
|
private _sheetsPivotTableAdaptorModel;
|
|
8
8
|
private _localeService;
|
|
9
9
|
readonly asyncInterceptor: AsyncInterceptorManager<{
|
|
10
|
+
PIVOT_MANUAL_FILTER_COORDINATION: import("@univerjs/core").IAsyncInterceptor<import("..").IPivotManualFilterCoordinationResult, import("..").IPivotManualFilterCoordinationParams>;
|
|
10
11
|
PIVOT_PERFORM_CHECK: import("@univerjs/core").IAsyncInterceptor<boolean, IPivotPerformCheckParams>;
|
|
11
12
|
}>;
|
|
12
13
|
readonly interceptor: InterceptorManager<{
|
|
14
|
+
PIVOT_FIELD_REMOVE_COORDINATION: import("@univerjs/core").IInterceptor<string[], {
|
|
15
|
+
unitId: string;
|
|
16
|
+
subUnitId: string;
|
|
17
|
+
pivotTableId: string;
|
|
18
|
+
fieldIds: string[];
|
|
19
|
+
}>;
|
|
13
20
|
PIVOT_MUTATION_GENERATE: import("@univerjs/core").IInterceptor<import("@univerjs/core").IUndoRedoCommandInfosByInterceptor, IPivotPerformCheckParams>;
|
|
14
21
|
}>;
|
|
15
22
|
constructor(_sheetInterceptorService: SheetInterceptorService, _sheetsPivotTableAdaptorModel: SheetsPivotTableAdaptorModel, _localeService: LocaleService);
|
package/lib/types/util.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ILabelViewHeaderMapItem, IPivotTableSnapshot, IPivotViewInfo, PivotTable, PivotView } from '@univerjs-pro/engine-pivot';
|
|
2
2
|
import type { IAccessor, IMutationInfo, Injector, IObjectArrayPrimitiveType, IRange, Nullable } from '@univerjs/core';
|
|
3
3
|
import type { ISetRangeValuesMutationParams } from '@univerjs/sheets';
|
|
4
|
-
import
|
|
5
|
-
import { PivotDateGroupFieldDateTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum } from '@univerjs-pro/engine-pivot';
|
|
4
|
+
import { PivotDateGroupFieldDateTypeEnum, PivotExcelDateGroupUnit, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum } from '@univerjs-pro/engine-pivot';
|
|
6
5
|
import { DateSystem, ObjectMatrix } from '@univerjs/core';
|
|
6
|
+
import type { IGetPivotDataLocalMutationParams, IPivotCellPositionInfo, IPivotPanelDataInfo, IPivotRangesInfo, IPivotRenderCache, IPivotTableCellData, IPivotTableConfig } from './const/type';
|
|
7
7
|
import { SheetsPivotDataSourceModel } from './models/sheets-pivot-data-source-model';
|
|
8
8
|
export declare const generateDefaultEmptyCache: (textOptions: {
|
|
9
9
|
filter: string;
|
|
@@ -25,7 +25,7 @@ export declare const generateDefaultEmptyCache: (textOptions: {
|
|
|
25
25
|
* @param {PivotSubtotalTypeEnum} subtotalType the type of subtotal to be displayed for this value field.
|
|
26
26
|
* @returns {string} the auto display name of the value field.
|
|
27
27
|
*/
|
|
28
|
-
export declare function getAutoDisplayName(this: SheetsPivotDataSourceModel, baseName: string, subtotalType: PivotSubtotalTypeEnum): string;
|
|
28
|
+
export declare function getAutoDisplayName(this: Pick<SheetsPivotDataSourceModel, 'getTextInfo'>, baseName: string, subtotalType: PivotSubtotalTypeEnum): string;
|
|
29
29
|
export declare function getPivotCellInfo(row: number, col: number, cellInfo: Nullable<IPivotTableCellData>, pivotTable: PivotTable, pivotItemRenderCache: IPivotRenderCache): {
|
|
30
30
|
filterId: string | undefined;
|
|
31
31
|
info: Nullable<IPivotViewInfo>;
|
|
@@ -50,13 +50,7 @@ export declare function resolvePivotSheetCell(row: number, col: number, cellInfo
|
|
|
50
50
|
export declare function resolvePivotValueFieldId(context: IPivotSheetCellContext, valueFieldIds: string[]): string | undefined;
|
|
51
51
|
export declare function resolvePivotValueFilterTarget(context: IPivotSheetCellContext, fieldsConfig: IPivotTableSnapshot): IPivotValueFilterTarget | undefined;
|
|
52
52
|
export declare function getPivotTableInfo(pivotTable: PivotTable, pivotTableId: string, config: IPivotTableConfig): IPivotPanelDataInfo;
|
|
53
|
-
export declare function flattenObject(inject: Injector, obj:
|
|
54
|
-
[key: string]: any;
|
|
55
|
-
}, parentKey?: string, result?: {
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
}): {
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
};
|
|
53
|
+
export declare function flattenObject(inject: Injector, obj: Record<string, unknown>, parentKey?: string, result?: Record<string, string>): Record<string, string>;
|
|
60
54
|
export declare const unionPivotViewRange: (rangeInfo: IPivotRangesInfo | undefined) => IRange[];
|
|
61
55
|
export declare function getPivotDrillDownData(injector: Injector, params: IGetPivotDataLocalMutationParams): {
|
|
62
56
|
indexes: number[];
|
|
@@ -104,4 +98,4 @@ export declare function setConfigToPivotTable(pivotTable: PivotTable, config: IP
|
|
|
104
98
|
export declare function resetPivotTable(pivotTable: PivotTable, area?: PivotTableFiledAreaEnum | undefined): void;
|
|
105
99
|
export declare function findCommonDateType(maxExcelDate: number, minExcelDate: number): PivotDateGroupFieldDateTypeEnum;
|
|
106
100
|
export declare function setPivotDateSystem(dateSystem: DateSystem | undefined): void;
|
|
107
|
-
export declare function getDateGroupName(injector: Injector, dateType: PivotDateGroupFieldDateTypeEnum): string;
|
|
101
|
+
export declare function getDateGroupName(injector: Injector, dateType: PivotDateGroupFieldDateTypeEnum | PivotExcelDateGroupUnit): string;
|