@univerjs-pro/engine-pivot 0.6.7 → 0.6.9
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/index.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/index.js +1 -0
- package/lib/types/const.d.ts +5 -0
- package/lib/types/field/base-group-field.d.ts +22 -0
- package/lib/types/field/data-field.d.ts +6 -1
- package/lib/types/field/date-group-field.d.ts +18 -0
- package/lib/types/field/fields-collection.d.ts +13 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/layout/pivot-view.d.ts +6 -1
- package/lib/types/pivot/pivot-table.d.ts +1 -0
- package/lib/types/summary/node-tree.d.ts +3 -3
- package/lib/types/types/enum.d.ts +95 -1
- package/lib/types/types/interface.d.ts +27 -3
- package/lib/types/types/json-types.d.ts +18 -2
- package/lib/types/types/layout-type.d.ts +2 -1
- package/lib/types/util.d.ts +13 -2
- package/lib/umd/index.js +1 -1
- package/package.json +1 -1
|
@@ -265,7 +265,11 @@ export declare enum PivotDataFieldSortOperatorEnum {
|
|
|
265
265
|
/**
|
|
266
266
|
* - the descending sort
|
|
267
267
|
*/
|
|
268
|
-
descending = 2
|
|
268
|
+
descending = 2,
|
|
269
|
+
/**
|
|
270
|
+
* - the custom sort
|
|
271
|
+
*/
|
|
272
|
+
custom = 3
|
|
269
273
|
}
|
|
270
274
|
/**
|
|
271
275
|
* Enum for IST_PivotFilter Operator
|
|
@@ -636,3 +640,93 @@ export declare enum PivotCallbackEnum {
|
|
|
636
640
|
*/
|
|
637
641
|
onQueryEnd = "onQueryEnd"
|
|
638
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Enum for pivot data field group type.
|
|
645
|
+
* @enum {number}
|
|
646
|
+
*/
|
|
647
|
+
export declare enum PivotDataFieldTypeEnum {
|
|
648
|
+
/**
|
|
649
|
+
* - the default data field
|
|
650
|
+
*/
|
|
651
|
+
defaultNormalField = 1,
|
|
652
|
+
/**
|
|
653
|
+
* - the number group type
|
|
654
|
+
*/
|
|
655
|
+
numberGroupField = 2,
|
|
656
|
+
/**
|
|
657
|
+
* - the date group type
|
|
658
|
+
*/
|
|
659
|
+
dateGroupField = 3,
|
|
660
|
+
/**
|
|
661
|
+
* - the text group type
|
|
662
|
+
*/
|
|
663
|
+
textGroupField = 4,
|
|
664
|
+
/**
|
|
665
|
+
* - the custom group type, if this grouping is used, the user needs to register the relevant records generation function
|
|
666
|
+
*/
|
|
667
|
+
customGroupField = 5
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Enum for representing different date group field types in a pivot table.
|
|
671
|
+
*/
|
|
672
|
+
export declare enum PivotDateGroupFieldDateTypeEnum {
|
|
673
|
+
/**
|
|
674
|
+
* The minute date type.
|
|
675
|
+
* Represents data grouped by minute.
|
|
676
|
+
*/
|
|
677
|
+
Minute = "minute",
|
|
678
|
+
/**
|
|
679
|
+
* The hour date type.
|
|
680
|
+
* Represents data grouped by hour.
|
|
681
|
+
*/
|
|
682
|
+
Hour = "hour",
|
|
683
|
+
/**
|
|
684
|
+
* The hour-minute date type.
|
|
685
|
+
* Represents data grouped by both hour and minute.
|
|
686
|
+
*/
|
|
687
|
+
HourMinute = "hour-minute",
|
|
688
|
+
/**
|
|
689
|
+
* The date type.
|
|
690
|
+
* Represents data grouped by specific dates.
|
|
691
|
+
*/
|
|
692
|
+
Date = "date",
|
|
693
|
+
/**
|
|
694
|
+
* The month date type.
|
|
695
|
+
* Represents data grouped by month.
|
|
696
|
+
*/
|
|
697
|
+
Month = "month",
|
|
698
|
+
/**
|
|
699
|
+
* The month-date type.
|
|
700
|
+
* Represents data grouped by both month and specific dates.
|
|
701
|
+
*/
|
|
702
|
+
MonthDate = "month-date",
|
|
703
|
+
/**
|
|
704
|
+
* The quarter date type.
|
|
705
|
+
* Represents data grouped by quarters (e.g., Q1, Q2).
|
|
706
|
+
*/
|
|
707
|
+
Quarter = "quarter",
|
|
708
|
+
/**
|
|
709
|
+
* The year date type.
|
|
710
|
+
* Represents data grouped by year.
|
|
711
|
+
*/
|
|
712
|
+
Year = "year",
|
|
713
|
+
/**
|
|
714
|
+
* The year-month date type.
|
|
715
|
+
* Represents data grouped by both year and month.
|
|
716
|
+
*/
|
|
717
|
+
YearMonth = "year-month",
|
|
718
|
+
/**
|
|
719
|
+
* The year-quarter date type.
|
|
720
|
+
* Represents data grouped by both year and quarter.
|
|
721
|
+
*/
|
|
722
|
+
YearQuarter = "year-quarter",
|
|
723
|
+
/**
|
|
724
|
+
* The year-month-date type.
|
|
725
|
+
* Represents data grouped by year, month, and specific dates.
|
|
726
|
+
*/
|
|
727
|
+
YearMonthDate = "year-month-date"
|
|
728
|
+
}
|
|
729
|
+
export declare enum PivotDateGroupFieldDateSystemEnum {
|
|
730
|
+
Date1900 = "date1900",
|
|
731
|
+
Date1904 = "date1904"
|
|
732
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PivotDataFieldDataTypeEnum, PivotDataFieldSortOperatorEnum, PivotFilterTypeEnum, PivotShowAsTypeEnum, PivotSubtotalTypeEnum, ST_PivotFilterOperatorEnum } from './enum';
|
|
1
|
+
import { PivotDataFieldDataTypeEnum, PivotDataFieldSortOperatorEnum, PivotDataFieldTypeEnum, PivotDateGroupFieldDateTypeEnum, PivotFilterTypeEnum, PivotShowAsTypeEnum, PivotSubtotalTypeEnum, ST_PivotFilterOperatorEnum } from './enum';
|
|
2
2
|
export interface IDateValue {
|
|
3
3
|
/**
|
|
4
4
|
* @description the date value, it stores the number of seconds since January 1, 1970, 00:00:00 UTC, it is same to excel date value
|
|
@@ -25,6 +25,22 @@ export interface IDataFieldInfo {
|
|
|
25
25
|
minDate: number;
|
|
26
26
|
records: IDataFieldValue[];
|
|
27
27
|
rangeKey: string;
|
|
28
|
+
/**
|
|
29
|
+
* @description the data field type, Used to distinguish between grouping and original data field
|
|
30
|
+
*/
|
|
31
|
+
dataFieldType: PivotDataFieldTypeEnum;
|
|
32
|
+
}
|
|
33
|
+
export interface IBaseGroupFieldInfo extends IDataFieldInfo {
|
|
34
|
+
/**
|
|
35
|
+
* @description the original field id of the group field
|
|
36
|
+
*/
|
|
37
|
+
originalFieldId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IDateGroupFieldInfo extends IBaseGroupFieldInfo {
|
|
40
|
+
/**
|
|
41
|
+
* @description the date type of the date group field
|
|
42
|
+
*/
|
|
43
|
+
dateType?: PivotDateGroupFieldDateTypeEnum;
|
|
28
44
|
}
|
|
29
45
|
export interface IPivotField {
|
|
30
46
|
id: string;
|
|
@@ -52,10 +68,18 @@ export interface IPivotTuple {
|
|
|
52
68
|
squareSum: number;
|
|
53
69
|
}
|
|
54
70
|
export type IPivotTableFilterInfo = IPivotTableManualFilter | IPivotTableCustomFilter | IPivotTableValueFilter;
|
|
55
|
-
export type IPivotTableSortInfo = IPivotTableLabelSortInfo | IPivotTableValueSortInfo;
|
|
71
|
+
export type IPivotTableSortInfo = IPivotTableLabelSortInfo | IPivotTableValueSortInfo | IPivotTableLabelCustomSortInfo;
|
|
72
|
+
export type IPivotTableGroupInfo = IPivotTableDateGroupInfo;
|
|
73
|
+
export interface IPivotTableDateGroupInfo {
|
|
74
|
+
type: PivotDataFieldTypeEnum.dateGroupField;
|
|
75
|
+
dateType: PivotDateGroupFieldDateTypeEnum;
|
|
76
|
+
}
|
|
56
77
|
export interface IPivotTableLabelSortInfo {
|
|
57
78
|
type: PivotDataFieldSortOperatorEnum;
|
|
58
79
|
}
|
|
80
|
+
export interface IPivotTableLabelCustomSortInfo extends IPivotTableLabelSortInfo {
|
|
81
|
+
customOrder: string[];
|
|
82
|
+
}
|
|
59
83
|
export interface IPivotTableValueSortInfo {
|
|
60
84
|
/**
|
|
61
85
|
* @property {PivotDataFieldSortOperatorEnum} - The sort operator of the field items.
|
|
@@ -123,7 +147,7 @@ export interface IPivotTableLabelFieldQueryData {
|
|
|
123
147
|
/**
|
|
124
148
|
* Information about the sort applied to the label field.
|
|
125
149
|
*/
|
|
126
|
-
sortInfo
|
|
150
|
+
sortInfo?: IPivotTableSortInfo;
|
|
127
151
|
}
|
|
128
152
|
/**
|
|
129
153
|
* Represents the data structure for a pivot table query.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PivotDataFieldDataTypeEnum, PivotLayoutTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum } from './enum';
|
|
1
|
+
import { PivotDataFieldDataTypeEnum, PivotDataFieldTypeEnum, PivotDateGroupFieldDateTypeEnum, PivotLayoutTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum } from './enum';
|
|
2
2
|
import { IPivotTableFilterInfo, IPivotTableShowDataAsInfo, IPivotTableSortInfo, IPivotTableValueFilter, IValueFilterInfoItem } from './interface';
|
|
3
3
|
import { IPivotTableOptions } from './layout-type';
|
|
4
4
|
export interface IPivotTableValueFieldJSON {
|
|
@@ -90,10 +90,26 @@ export interface IDataFieldJSON {
|
|
|
90
90
|
hexCode: string;
|
|
91
91
|
fieldDataType: PivotDataFieldDataTypeEnum;
|
|
92
92
|
rangeKey: string;
|
|
93
|
+
/**
|
|
94
|
+
* @description the data field type, Used to distinguish between grouping and original data field
|
|
95
|
+
*/
|
|
96
|
+
dataFieldType: PivotDataFieldTypeEnum;
|
|
97
|
+
}
|
|
98
|
+
export interface IBaseGroupFieldJSON extends IDataFieldJSON {
|
|
99
|
+
/**
|
|
100
|
+
* @description the original field id of the group field
|
|
101
|
+
*/
|
|
102
|
+
originalFieldId: string;
|
|
103
|
+
}
|
|
104
|
+
export interface IDateGroupFieldJSON extends IBaseGroupFieldJSON {
|
|
105
|
+
/**
|
|
106
|
+
* @description the date type of the date group field
|
|
107
|
+
*/
|
|
108
|
+
dateType?: PivotDateGroupFieldDateTypeEnum;
|
|
93
109
|
}
|
|
94
110
|
export interface IDataFieldManagerBaseJSON {
|
|
95
111
|
collections: Record<string, IFieldsCollectionJSON>;
|
|
96
|
-
dataFields: Record<string, IDataFieldJSON>;
|
|
112
|
+
dataFields: Record<string, IDataFieldJSON | IBaseGroupFieldJSON>;
|
|
97
113
|
}
|
|
98
114
|
/**
|
|
99
115
|
* Represents the change type of the pivot table.
|
|
@@ -2,7 +2,7 @@ import { PivotView } from '../layout/pivot-view';
|
|
|
2
2
|
import { NodeTree } from '../summary/node-tree';
|
|
3
3
|
import { SummaryManager } from '../summary/summary-manager';
|
|
4
4
|
import { PivotErrorTypeEnum } from './enum';
|
|
5
|
-
import { IPivotTableQueryData, IPivotTableValueFieldQueryData, IValueFilterInfoItem } from './interface';
|
|
5
|
+
import { IPivotTableGroupInfo, IPivotTableQueryData, IPivotTableValueFieldQueryData, IValueFilterInfoItem } from './interface';
|
|
6
6
|
export interface IPivotViewItemData {
|
|
7
7
|
[row: number]: IPivotViewColData;
|
|
8
8
|
}
|
|
@@ -239,5 +239,6 @@ export interface IPivotViewJSON {
|
|
|
239
239
|
cornerView: IPivotViewItemJSON;
|
|
240
240
|
version: number;
|
|
241
241
|
formatMap: Record<string, string>;
|
|
242
|
+
groupInfo: Record<string, IPivotTableGroupInfo>;
|
|
242
243
|
}
|
|
243
244
|
export {};
|
package/lib/types/util.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseGroupField } from './field/base-group-field';
|
|
2
|
+
import { DataField } from './field/data-field';
|
|
3
|
+
import { DateGroupField } from './field/date-group-field';
|
|
4
|
+
import { IBaseGroupFieldJSON, IDataFieldJSON, IDataFieldValue, IDateGroupFieldJSON, IDateValue, IMeasuresMapItem, IPivotTableCustomFilter, IPivotTableDateGroupInfo, IPivotTableFilterInfo, IPivotTableGroupInfo, IPivotTableLabelCustomSortInfo, IPivotTableManualFilter, IPivotTableSortInfo, ITupleItem, IValueFilterInfoItem, PivotErrorTypeEnum, ST_PivotFilterOperatorEnum, PivotCellStyleTypeEnum, PivotDataFieldDataTypeEnum, PivotDateGroupFieldDateTypeEnum, PivotSubtotalTypeEnum, PivotTableFiledAreaEnum } from './types';
|
|
2
5
|
import { PivotTuple } from './summary/pivot-tuple';
|
|
3
6
|
/**
|
|
4
7
|
* - judge the value is date like type
|
|
@@ -101,7 +104,7 @@ export declare function getFilterStatusAndValue(filterInfo: IPivotTableFilterInf
|
|
|
101
104
|
* @param {IPivotTableSortInfo} sortInfo the sort info
|
|
102
105
|
* @returns {PivotCellStyleTypeEnum} the cell style type
|
|
103
106
|
*/
|
|
104
|
-
export declare function getDimFilterSortStatus(filterInfo: IPivotTableFilterInfo | undefined, sortInfo: IPivotTableSortInfo, valueFilterInfo: IValueFilterInfoItem): PivotCellStyleTypeEnum;
|
|
107
|
+
export declare function getDimFilterSortStatus(filterInfo: IPivotTableFilterInfo | undefined, sortInfo: IPivotTableSortInfo | undefined, valueFilterInfo: IValueFilterInfoItem): PivotCellStyleTypeEnum;
|
|
105
108
|
/**
|
|
106
109
|
* - use the paths and value index to get the unique key of in layout pivot view, which use same rule to create the key in pivot engine
|
|
107
110
|
* @param {string[]} paths - the paths of the cell
|
|
@@ -133,3 +136,11 @@ export declare function isErrorTypeSubtotal(subtotal: number | {
|
|
|
133
136
|
}): subtotal is {
|
|
134
137
|
errorType: PivotErrorTypeEnum;
|
|
135
138
|
};
|
|
139
|
+
export declare function isLabelCustomSortInfo(sortInfo: IPivotTableSortInfo): sortInfo is IPivotTableLabelCustomSortInfo;
|
|
140
|
+
export declare function excelDateToUnixMilliseconds(excelDate: number, useDefault1900DateSystem?: boolean): number;
|
|
141
|
+
export declare function isDateGroupField(field: DataField): field is DateGroupField;
|
|
142
|
+
export declare function isBaseGroupField(field: DataField): field is BaseGroupField;
|
|
143
|
+
export declare function isBaseGroupFieldJSON(field: IDataFieldJSON | IBaseGroupFieldJSON): field is IBaseGroupFieldJSON;
|
|
144
|
+
export declare function isDateGroupFieldJSON(field: IDataFieldJSON | IBaseGroupFieldJSON): field is IDateGroupFieldJSON;
|
|
145
|
+
export declare function isDateGroupInfo(groupInfo: IPivotTableGroupInfo): groupInfo is IPivotTableDateGroupInfo;
|
|
146
|
+
export declare function getDateGroupValue(excelDate: number, dateType: PivotDateGroupFieldDateTypeEnum, useDefault1900DateSystem?: boolean): string;
|