UNPKG

@univerjs-pro/sheets-pivot

Version:

Univer Sheets Pivot Table

115 lines (114 loc) 3.01 kB
import { IDataFieldValue, PivotFilterTypeEnum, PivotSubtotalTypeEnum } from '@univerjs-pro/engine-pivot'; /** * Configuration options for the pivot table cube. */ export interface IPivotTableCubeConfig { /** * Whether to display the grand total for rows. * @default false */ showRowGrandTotal?: boolean; /** * Whether to display subtotals for rows. * @default false */ showRowSubTotal?: boolean; } /** * Represents a data array used in the pivot table. * The first row contains field names (headers), and subsequent rows contain field values. * @example * const data: IDataFieldDataArray = [ * ["Name", "Age"], // Headers * ["Alice", 30], // Row 1 * ["Bob", 25] // Row 2 * ]; */ export type IDataFieldDataArray = [ string[], ...Array<(IDataFieldValue & Date)[]> ]; /** * Defines the dimensions of a pivot table. * Used to specify fields for rows, columns, filters, and values. */ export interface IDimensionInfo { /** * Field names to be used as row dimensions. */ row?: string[]; /** * Field names to be used as column dimensions. */ column?: string[]; /** * Field names to be used as filter dimensions. */ filter?: string[]; /** * Field names to be used as value measure. */ value?: string[]; } export declare enum NumberFilterEnum { /** * Filter by value that is between two values * @type {number} */ valueBetween = 57, /** * Filter by value that is equal to a specific value * @type {number} */ valueEqual = 58, /** * Filter by value that is greater than a specific value * @type {number} */ valueGreaterThan = 59, /** * Filter by value that is greater than or equal to a specific value * @type {number} */ valueGreaterThanOrEqual = 60, /** * Filter by value that is less than a specific value * @type {number} */ valueLessThan = 61, /** * Filter by value that is less than or equal to a specific value * @type {number} */ valueLessThanOrEqual = 62, /** * Filter by value that is not between two values * @type {number} */ valueNotBetween = 63, /** * Filter by value that is not equal to a specific value * @type {number} */ valueNotEqual = 64 } export interface IPivotTableManualFilter { /** * @property {PivotFilterTypeEnum} type - filter type. */ type: PivotFilterTypeEnum.ManualFilter; /** * @property {string[]} list - The list of selected items. */ list: string[]; isAll?: boolean; } export interface IPivotTableCustomFilter { type: PivotFilterTypeEnum.CustomFilter; operator: NumberFilterEnum; expected: number | [number, number]; } export type IFGenericPivotFilterOptions = IPivotTableManualFilter | IPivotTableCustomFilter; export interface IPivotTableValueOptions { subtotal?: PivotSubtotalTypeEnum; }