@univerjs-pro/engine-pivot 0.6.0 → 0.6.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.
@@ -138,6 +138,7 @@ export declare class DataField {
138
138
  */
139
139
  addRecord(record: IDataFieldValue, index: number): void;
140
140
  getIndexesByKey(key: string): number[];
141
+ getAllIndexMap(): Record<string, number[]>;
141
142
  /**
142
143
  * @description Update the item key in the data field.
143
144
  * @param {IDateValue} record - The date value.
@@ -25,6 +25,8 @@ export declare class FieldsCollection {
25
25
  readonly host: DataFieldManager;
26
26
  constructor(host: DataFieldManager);
27
27
  getFieldIds(): string[];
28
+ getFieldDisplayNames(): string[];
29
+ getFieldIdByDisplayName(name: string): string | undefined;
28
30
  hasField(fieldId: string): boolean;
29
31
  /**
30
32
  * find the is there has a data field whose name is the same as the sourceName.
@@ -183,6 +183,11 @@ export declare class PivotModel {
183
183
  * @returns {IPivotTableQueryData} - The query data of the pivot table.
184
184
  */
185
185
  getQueryData(): IPivotTableQueryData;
186
+ /**
187
+ * Resets the specified or all pivot table areas.
188
+ * @param {PivotTableFiledAreaEnum} [area] - The area to be reset. If not passed, all areas will be reset.
189
+ */
190
+ reset(area?: PivotTableFiledAreaEnum): void;
186
191
  fromJSON(data: IPivotTableSnapshot): void;
187
192
  toJSON(): IPivotTableSnapshot;
188
193
  cloneBufferModel(): PivotModel;
@@ -1,7 +1,7 @@
1
1
  import { DataField } from '../field/data-field';
2
2
  import { FieldsCollection } from '../field/fields-collection';
3
3
  import { PivotView } from '../layout/pivot-view';
4
- import { IPivotTableChangeSet, IPivotTableFilterInfo, IPivotTableOptions, IPivotTableQueryData, IPivotTableSnapshot, IPivotTableSortInfo, PivotTableFiledAreaEnum, PivotTableValuePositionEnum, PivotDataFieldDataTypeEnum, PivotSubtotalTypeEnum } from '../types';
4
+ import { IPivotTableChangeSet, IPivotTableFilterInfo, IPivotTableOptions, IPivotTableQueryData, IPivotTableSnapshot, IPivotTableSortInfo, PivotTableFiledAreaEnum, PivotTableValuePositionEnum, PivotCallbackEnum, PivotDataFieldDataTypeEnum, PivotSubtotalTypeEnum } from '../types';
5
5
  import { PivotModel } from './model';
6
6
  import { PivotTableLabelField, PivotTableValueField } from './table-field';
7
7
  /**
@@ -15,7 +15,21 @@ export declare class PivotTable {
15
15
  private _model;
16
16
  _bufferModel: PivotModel;
17
17
  private _tupleGroupCache;
18
- constructor(dataFieldsCollection: FieldsCollection, model?: PivotModel);
18
+ private _id;
19
+ private static _callbacks;
20
+ /**
21
+ * Register callback functions that are executed at certain times
22
+ * @param {PivotCallbackEnum} event - Enumeration of execution time
23
+ * @param {(id?: string) => void} callback - Callback Function
24
+ */
25
+ static registerCallbackWithEvent(event: PivotCallbackEnum, callback: (id?: string) => void): void;
26
+ /**
27
+ * Unregisters the callback function from the specified event.
28
+ * @param {PivotCallbackEnum} event - Enumeration of execution time
29
+ * @param {(id?: string) => void} callback - Callback Function
30
+ */
31
+ static unRegisterCallbackWithEvent(event: PivotCallbackEnum, callback: (id?: string) => void): void;
32
+ constructor(dataFieldsCollection: FieldsCollection, model?: PivotModel, id?: string);
19
33
  updateDataFieldsCollection(dataFieldsCollection: FieldsCollection): void;
20
34
  private _getModel;
21
35
  startCollectChangeset(): void;
@@ -100,6 +114,17 @@ export declare class PivotTable {
100
114
  * @returns {DataField|undefined} the data field or undefined
101
115
  */
102
116
  getDataFieldByDataFieldId(dataFieldId: string): DataField | undefined;
117
+ /**
118
+ * - get the data field id by the display name
119
+ * @param {string} name - the display name of the data field.
120
+ * @returns {string | undefined} - the data fieldId corresponding to the display name, or undefined if not found.
121
+ */
122
+ getDataFieldIdByDisplayName(name: string): string | undefined;
123
+ /**
124
+ * - get all display names of the data fields
125
+ * @returns {string[]} the all display names of the data fields
126
+ */
127
+ getFieldDisplayNames(): string[];
103
128
  getDataFieldItemInfo(dataField: DataField): {
104
129
  items: string[];
105
130
  itemTypes: PivotDataFieldDataTypeEnum[];
@@ -229,6 +254,7 @@ export declare class PivotTable {
229
254
  */
230
255
  getIndexesByPathStr(tuple: string[][]): number[];
231
256
  setDirty(dirty: boolean): void;
257
+ reset(area?: PivotTableFiledAreaEnum): void;
232
258
  query(config?: IPivotTableQueryData): PivotView;
233
259
  toJSON(): IPivotTableSnapshot;
234
260
  fromJSON(data: IPivotTableSnapshot): void;
@@ -622,3 +622,17 @@ export declare enum PivotLayoutTypeEnum {
622
622
  */
623
623
  tabular = 3
624
624
  }
625
+ /**
626
+ * Enum the execution time of callback functions
627
+ * @enum {string}
628
+ */
629
+ export declare enum PivotCallbackEnum {
630
+ /**
631
+ * The pivot engine starts calculating
632
+ */
633
+ onQueryStart = "onQueryStart",
634
+ /**
635
+ * The pivot engine completes the calculation
636
+ */
637
+ onQueryEnd = "onQueryEnd"
638
+ }
@@ -1,4 +1,4 @@
1
- import { PivotLayoutTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum } from './enum';
1
+ import { PivotDataFieldDataTypeEnum, PivotLayoutTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum } from './enum';
2
2
  import { IPivotTableFilterInfo, IPivotTableShowDataAsInfo, IPivotTableSortInfo } from './interface';
3
3
  import { IPivotTableOptions } from './layout-type';
4
4
  export interface IPivotTableValueFieldJSON {
@@ -84,6 +84,7 @@ export interface IDataFieldJSON {
84
84
  id: string;
85
85
  name: string;
86
86
  hexCode: string;
87
+ fieldDataType: PivotDataFieldDataTypeEnum;
87
88
  rangeKey: string;
88
89
  }
89
90
  export interface IDataFieldManagerBaseJSON {
@@ -156,6 +156,10 @@ export interface IPivotTableOptions {
156
156
  * use span in the pivot table header
157
157
  */
158
158
  mergeItems?: boolean;
159
+ /**
160
+ * Whether to repeat the item labels in the pivot table
161
+ */
162
+ repeatRowLabels?: boolean;
159
163
  }
160
164
  export interface INodeSizeInfo {
161
165
  /**
@@ -196,6 +200,7 @@ export interface IPivotLayoutCtx {
196
200
  summaryManager: SummaryManager;
197
201
  measureIndexesMap: Record<string, number>;
198
202
  collapseInfo: Record<string, boolean | Record<string, boolean>>;
203
+ repeatRowLabels: boolean;
199
204
  }
200
205
  export interface IPageViewItemRange {
201
206
  row: number;
@@ -1,4 +1,4 @@
1
- import { IDataFieldValue, IDateValue, IMeasuresMapItem, IPivotTableCustomFilter, IPivotTableFilterInfo, IPivotTableManualFilter, IPivotTableSortInfo, ITupleItem, PivotCellStyleTypeEnum, PivotDataFieldDataTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum } from './types';
1
+ import { IDataFieldValue, IDateValue, IMeasuresMapItem, IPivotTableCustomFilter, IPivotTableFilterInfo, IPivotTableManualFilter, IPivotTableSortInfo, ITupleItem, PivotCellStyleTypeEnum, PivotDataFieldDataTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, ST_PivotFilterOperatorEnum } from './types';
2
2
  /**
3
3
  * - judge the value is date like type
4
4
  * @param {IDataFieldValue} value the date like value
@@ -122,3 +122,4 @@ export declare function unionSortedList(arrays: number[][]): number[];
122
122
  * @returns {Record<string, number>} the sorted item map
123
123
  */
124
124
  export declare function sortLabelItem(items: string[], itemTypes: PivotDataFieldDataTypeEnum[], itemsMap: Record<string, number>): Record<string, number>;
125
+ export declare function getCustomNumberFilterResultTemp(indexesMap: Record<string, number[]>, operator: ST_PivotFilterOperatorEnum, expected: number | [number, number]): number[][];