@univerjs-pro/engine-pivot 1.0.0-alpha.8 → 1.0.0-beta.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.
@@ -8,7 +8,7 @@ export { isErrorValue, isPrefixValue, LabelViewItem, PivotView, PivotViewItem, }
8
8
  export { PivotTable } from './pivot/pivot-table';
9
9
  export { createLabelField, createValueField, PivotTableLabelField, PivotTableValueField, } from './pivot/table-field';
10
10
  export { PivotCallbackEnum, PivotDataFieldDataTypeEnum, PivotDataFieldSortOperatorEnum, PivotDataFieldSortTypeEnum, PivotDataFieldTypeEnum, PivotDateGroupFieldDateSystemEnum, PivotDateGroupFieldDateTypeEnum, PivotErrorTypeEnum, PivotFilterTypeEnum, PivotLayoutTypeEnum, PivotShowAsTypeEnum, PivotSubtotalPositionEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum, ST_PivotFilterOperatorEnum, } from './types/enum';
11
- export type { IDataFieldValue, IDateValue, IPivotTableFilterInfo, IPivotTableDateGroupInfo, IPivotTableManualFilter, IPivotTableSortInfo, IPivotTableValueFilter, IValueFilterInfoItem, } from './types/interface';
11
+ export type { IDataFieldValue, IDateValue, IPivotTableDateGroupInfo, IPivotTableFilterInfo, IPivotTableManualFilter, IPivotTableSortInfo, IPivotTableValueFilter, IValueFilterInfoItem, } from './types/interface';
12
12
  export type { IBaseGroupFieldJSON, IDataFieldManagerBaseJSON, IFieldsCollectionJSON, IPivotTableLabelFieldJSON, IPivotTableSnapshot, IPivotTableValueFieldJSON, } from './types/json-types';
13
13
  export { PivotTableChangeTypeEnum } from './types/json-types';
14
14
  export type { IPivotTableAddFieldChange, IPivotTableChangeSet, IPivotTableRemoveFieldChange, IPivotTableRenameFieldChange, IPivotTableSetCollapseChange, IPivotTableSetFilterInfoChange, IPivotTableSetFormatChange, IPivotTableSetLayoutChange, IPivotTableSetOptionsChange, IPivotTableSetSortInfoChange, IPivotTableSetSubtotalTypeChange, IPivotTableSetValueFilterChange, IPivotTableUpdatePositionChange, IPivotTableUpdateValuePositionChange, IPivotUpdateSourceChange, } from './types/json-types';
@@ -1,8 +1,8 @@
1
1
  import type { PivotTable } from '../pivot/pivot-table';
2
2
  import type { NodeTree } from '../summary/node-tree';
3
3
  import type { SummaryManager } from '../summary/summary-manager';
4
- import type { IColumnNodeSizeInfo, INodeSizeInfo, IPivotLayoutCtx, IPivotTableLabelFieldQueryData, IPivotTableQueryData, PivotErrorTypeEnum } from '../types';
5
- import type { PageViewItem } from './pivot-view';
4
+ import type { IColumnNodeSizeInfo, INodeSizeInfo, IPivotLayoutCtx, IPivotTableLabelFieldQueryData, IPivotTableQueryData, IPivotViewValueType, PivotErrorTypeEnum } from '../types';
5
+ import type { ColViewItem, PageViewItem } from './pivot-view';
6
6
  export declare class BaseLayout {
7
7
  /**
8
8
  *
@@ -15,7 +15,7 @@ export declare class BaseLayout {
15
15
  static layoutPageOverThenDown(filters: IPivotTableLabelFieldQueryData[], page: PageViewItem, pageWrap?: number): void;
16
16
  static layoutPageDownThenOver(filters: IPivotTableLabelFieldQueryData[], page: PageViewItem, pageWrap?: number): void;
17
17
  static layoutCol(ctx: IPivotLayoutCtx): void;
18
- static layoutCorner(ctx: IPivotLayoutCtx): void;
18
+ static layoutCorner(_ctx: IPivotLayoutCtx): void;
19
19
  static layoutColHeader(ctx: IPivotLayoutCtx): void;
20
20
  static setValueSize(ctx: IPivotLayoutCtx): void;
21
21
  static layoutNoneColFields(ctx: IPivotLayoutCtx, nodeTree: NodeTree): IColumnNodeSizeInfo;
@@ -52,6 +52,7 @@ export declare class BaseLayout {
52
52
  static shouldMultipleTotal(hasMultiValue: boolean, nodeLevel: number, valueIndex: number): boolean;
53
53
  static shouldMultipleNode(hasMultiValue: boolean, nodeLevel: number, valueIndex: number): boolean;
54
54
  static getRowIndexForColHeader(nodeLevel: number, valueIndex: number, hasMultiValue: boolean): number;
55
+ static setColLabelValue(colView: ColViewItem, row: number, col: number, value: IPivotViewValueType, isBlank: boolean, isOther: boolean): void;
55
56
  static layoutColNode(ctx: IPivotLayoutCtx, nodeTree: NodeTree, col: number, valueIds: string[]): IColumnNodeSizeInfo;
56
57
  static getMeasureIndex(isColMultiMeasure: boolean, valueIds: string[], measureIndexesMap: Record<string, number>): number;
57
58
  static updateColumnSubtotal(ctx: IPivotLayoutCtx, col: number, nodeTree: NodeTree, valueIds: string[], colPathMap: Record<string, number>): void;
@@ -6,6 +6,11 @@ import type { PivotView } from './pivot-view';
6
6
  import { BaseLayout } from './base-layout';
7
7
  export declare class TabularLayout extends BaseLayout {
8
8
  static layout(pivotTable: PivotTable, summaryManager: SummaryManager, queryData: IPivotTableQueryData): PivotView;
9
+ static layoutHeadersWithoutColumnDimensions(ctx: IPivotLayoutCtx): void;
10
+ static getCornerSize(ctx: IPivotLayoutCtx): {
11
+ rowCount: number;
12
+ colCount: number;
13
+ };
9
14
  static layoutCorner(ctx: IPivotLayoutCtx): void;
10
15
  static layoutRowFields(ctx: IPivotLayoutCtx): void;
11
16
  static doRowLeafNode(ctx: IPivotLayoutCtx, nodeTree: NodeTree, row: number, valueIds: string[]): IRowNodeSizeInfo;
@@ -146,8 +146,10 @@ export declare class PivotModel {
146
146
  isExistFieldName(fieldName: string): boolean;
147
147
  /**
148
148
  * @description Rename a field in the pivot table.
149
+ * Renaming a field to its current display name is an idempotent no-op. A display name already
150
+ * used by another field is rejected.
149
151
  * @param {string} fieldId - The id of the field to be renamed.
150
- * @param displayName - The new display name of the field.
152
+ * @param {string} displayName - The new display name of the field.
151
153
  * @returns {void}
152
154
  */
153
155
  renameField(fieldId: string, displayName: string): void;
@@ -45,5 +45,6 @@ export declare class NodeTree {
45
45
  setName(name: string): void;
46
46
  addNode(node: NodeTree, path: string, sortMap: Record<string, number> | undefined, sortType: PivotDataFieldSortOperatorEnum): void;
47
47
  sortNode(path: string, sortedMap: Record<string, number>, sortType: PivotDataFieldSortOperatorEnum): void;
48
+ sortChildrenByValue(fieldId: string, sortType: PivotDataFieldSortOperatorEnum, getValue: (index: number) => number | undefined): void;
48
49
  getNode(path: string): NodeTree | undefined;
49
50
  }
@@ -1,5 +1,5 @@
1
1
  import type { DataField } from '../field/data-field';
2
- import type { IDimensionMapItem, IMeasuresMapItem, IPivotSummaryLevelPool, IPivotTableQueryData, IPivotTableValueFilter, ITupleItem, IValueFilterInfoItem, PivotErrorTypeEnum, PivotSubtotalTypeEnum } from '../types';
2
+ import type { IDimensionMapItem, IMeasuresMapItem, IPivotSummaryLevelPool, IPivotTableQueryData, IPivotTableValueFilter, IPivotTableValueSortInfo, ITupleItem, IValueFilterInfoItem, PivotErrorTypeEnum, PivotSubtotalTypeEnum } from '../types';
3
3
  import type { TupleGroup } from './tuple-group';
4
4
  import { PivotDataFieldSortOperatorEnum } from '../types';
5
5
  import { NodeTree } from './node-tree';
@@ -45,6 +45,7 @@ export declare class SummaryManager {
45
45
  type: PivotDataFieldSortOperatorEnum;
46
46
  sortMap: Record<string, number>;
47
47
  }>;
48
+ valueSortInfo: Record<string, IPivotTableValueSortInfo>;
48
49
  valueFilterInfo: IValueFilterInfoItem[];
49
50
  subtotalMap: Record<string, {
50
51
  subTotal: PivotSubtotalTypeEnum;
@@ -57,6 +58,7 @@ export declare class SummaryManager {
57
58
  } | undefined;
58
59
  getSortedMap(tableFieldId: string, dataField: DataField): Record<string, number>;
59
60
  doSummary(): void;
61
+ private _applyValueSorts;
60
62
  private _getIndex;
61
63
  buildNodeTree(ignoreLeafSet: Set<number>): void;
62
64
  createTupleWithoutCheck(paths: string[], nodeIndex: number, tupleKey: string): void;
@@ -117,6 +117,8 @@ export interface IPivotTableValueFilter {
117
117
  operator: ST_PivotFilterOperatorEnum;
118
118
  expected: any;
119
119
  valueFieldId: string;
120
+ /** Whether a count/percent rank filter keeps the bottom values instead of the top values. */
121
+ isBottom?: boolean;
120
122
  }
121
123
  export interface IPivotTableShowDataAsInfo {
122
124
  type: PivotShowAsTypeEnum;
@@ -179,9 +179,13 @@ export interface IPivotTableOptions {
179
179
  */
180
180
  mergeItems?: boolean;
181
181
  /**
182
- * Whether to repeat the item labels in the pivot table
182
+ * Whether to repeat row item labels in the pivot table
183
183
  */
184
184
  repeatRowLabels?: boolean;
185
+ /**
186
+ * Whether to repeat column item labels in the pivot table
187
+ */
188
+ repeatColLabels?: boolean;
185
189
  /**
186
190
  * Whether to show subtotal and grand total, if showSubtotal is false, the subtotal and grand total will not be calculated and rendered, if showGrandTotal is false, the grand total will not be calculated and rendered
187
191
  */
@@ -243,6 +247,7 @@ export interface IPivotLayoutCtx {
243
247
  measureIndexesMap: Record<string, number>;
244
248
  collapseInfo: Record<string, boolean | Record<string, boolean>>;
245
249
  repeatRowLabels: boolean;
250
+ repeatColLabels: boolean;
246
251
  valueFilterMap: Record<string, IValueFilterInfoItem>;
247
252
  showRowSubtotal: boolean;
248
253
  showRowGrandTotal: boolean;