@univerjs-pro/sheets-pivot
Version:
Univer Sheets Pivot Table
89 lines (88 loc) • 4.46 kB
TypeScript
import { ILabelViewHeaderMapItem, IPivotTableSnapshot, IPivotViewInfo, LabelViewItem, PivotTable, PivotView, PivotViewItem, PivotDateGroupFieldDateTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum } from '@univerjs-pro/engine-pivot';
import { IAccessor, IMutationInfo, Injector, IRange, Nullable, ObjectMatrix } from '@univerjs/core';
import { ISetRangeValuesMutationParams } from '@univerjs/sheets';
import { IGetPivotDataLocalMutationParams, IPivotCellPositionInfo, IPivotPanelDataInfo, IPivotRangesInfo, IPivotRenderCache, IPivotTableCellData, IPivotTableConfig } from './const/type';
import { SheetsPivotDataSourceModel } from './models/sheets-pivot-data-source-model';
export declare const generateDefaultEmptyCache: (textOptions: {
filter: string;
row: string;
column: string;
values: string;
}, startCell: {
row: number;
col: number;
}) => {
matrixCache: ObjectMatrix<IPivotTableCellData>;
rangesCache: IPivotRangesInfo;
};
/**
* - Get the auto display name of the value field.
* @description - which may use prefix text like excel
* - the prefix text is create by subtotal type
* @param {string} baseName the name without prefix text
* @param {PivotSubtotalTypeEnum} subtotalType the type of subtotal to be displayed for this value field.
* @returns {string} the auto display name of the value field.
*/
export declare function getAutoDisplayName(this: SheetsPivotDataSourceModel, baseName: string, subtotalType: PivotSubtotalTypeEnum): string;
export declare function getPivotCellInfo(row: number, col: number, cellInfo: Nullable<IPivotTableCellData>, pivotTable: PivotTable, pivotItemRenderCache: IPivotRenderCache): {
filterId: Nullable<string>;
info: Nullable<IPivotViewInfo>;
data: Nullable<IPivotTableCellData>;
headerInfo: Nullable<ILabelViewHeaderMapItem>;
} | undefined;
export declare function getPivotTableInfo(pivotTable: PivotTable, pivotTableId: string, config: IPivotTableConfig): IPivotPanelDataInfo;
export declare function flattenObject(inject: Injector, obj: {
[key: string]: any;
}, parentKey?: string, result?: {
[key: string]: any;
}): {
[key: string]: any;
};
export declare const unionPivotViewRange: (rangeInfo: IPivotRangesInfo | undefined) => IRange[];
export declare function getPivotDrillDownData(injector: Injector, params: IGetPivotDataLocalMutationParams): {
indexes: number[];
range: IRange;
sourceUnitId: string;
sourceSubUnitId: string;
formatMap: Record<string, string>;
} | undefined;
export declare function canUsePivot(ls?: string, pbk?: string): boolean;
export declare function getPivotInfoByLicense(defaultPivotCount: number, ls?: string, pbk?: string): {
count: number;
timeValid: boolean;
};
export declare function generateSetRangeValueMutations(injector: Injector, unitId: string, subUnitId: string, ranges: IRange[]): {
setRangeValueUndoMutation: {
id: string;
params: ISetRangeValuesMutationParams;
};
setRangeValueRedoMutation: {
id: string;
params: ISetRangeValuesMutationParams;
};
shouldClear: boolean;
};
export declare function getEmptyPivotRanges(cellInfo: IPivotCellPositionInfo): {
startRow: number;
endRow: number;
startColumn: number;
endColumn: number;
}[];
export declare function getPivotRowColCount(view: PivotView, startCell: {
row: number;
col: number;
}, isEmpty: boolean): {
rowCount: number;
colCount: number;
};
export declare function getInsertRowColMutations(accessor: IAccessor, view: PivotView, cellInfo: IPivotCellPositionInfo, isEmpty: boolean): {
undos: IMutationInfo<object>[];
redos: IMutationInfo<object>[];
};
export declare function getHeaderViewMaxText(labelView: LabelViewItem, textInfo: Record<string, string>, isCol: boolean, formatMap: Record<string, string>): string;
export declare function getValueViewMaxText(rowView: PivotViewItem): string;
export declare function getCornerMaxText(corner: PivotViewItem): string;
export declare function setConfigToPivotTable(pivotTable: PivotTable, config: IPivotTableSnapshot): void;
export declare function resetPivotTable(pivotTable: PivotTable, area?: PivotTableFiledAreaEnum | undefined): void;
export declare function findCommonDateType(maxExcelDate: number, minExcelDate: number): PivotDateGroupFieldDateTypeEnum;
export declare function getDateGroupName(injector: Injector, dateType: PivotDateGroupFieldDateTypeEnum): string;