@univerjs-pro/engine-pivot 0.4.2 → 0.5.0-alpha.0
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/types/index.d.ts +2539 -11
- package/lib/umd/index.js +1 -1
- package/package.json +9 -12
- package/lib/types/const.d.ts +0 -15
- package/lib/types/field/data-field-manager.d.ts +0 -22
- package/lib/types/field/data-field.d.ts +0 -161
- package/lib/types/field/fields-collection.d.ts +0 -70
- package/lib/types/layout/base-layout.d.ts +0 -58
- package/lib/types/layout/compact.d.ts +0 -9
- package/lib/types/layout/outline.d.ts +0 -9
- package/lib/types/layout/pivot-view.d.ts +0 -135
- package/lib/types/layout/tabular.d.ts +0 -28
- package/lib/types/pivot/model.d.ts +0 -189
- package/lib/types/pivot/pivot-table.d.ts +0 -233
- package/lib/types/pivot/table-field.d.ts +0 -131
- package/lib/types/summary/node-tree.d.ts +0 -48
- package/lib/types/summary/pivot-tuple.d.ts +0 -24
- package/lib/types/summary/summary-manager.d.ts +0 -72
- package/lib/types/summary/tuple-group.d.ts +0 -82
- package/lib/types/types/enum.d.ts +0 -624
- package/lib/types/types/index.d.ts +0 -5
- package/lib/types/types/interface.d.ts +0 -187
- package/lib/types/types/json-types.d.ts +0 -184
- package/lib/types/types/layout-type.d.ts +0 -237
- package/lib/types/types/summary-type.d.ts +0 -41
- package/lib/types/util.d.ts +0 -124
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { IPivotTableChangeSet, IPivotTableFilterInfo, IPivotTableOptions, IPivotTableQueryData, IPivotTableSnapshot, IPivotTableSortInfo, PivotSubtotalTypeEnum, PivotLayoutTypeEnum, PivotTableFiledAreaEnum, PivotTableValuePositionEnum } from '../types';
|
|
2
|
-
import { PivotTableLabelField, PivotTableValueField } from './table-field';
|
|
3
|
-
/**
|
|
4
|
-
* @class PivotModel represents a config model for a pivot table.
|
|
5
|
-
* @description The pivot model is a class that stores the pivot table's configuration information.
|
|
6
|
-
* @typedef PivotModel
|
|
7
|
-
* @property {string[]} rowFields - An array of row fields id.
|
|
8
|
-
* @property {string[]} columnFields - An array of column fields id.
|
|
9
|
-
* @property {string[]} valueFields - An array of value fields id.
|
|
10
|
-
* @property {string[]} filterFields - An array of filter fields id.
|
|
11
|
-
* @property {string[]} hiddenFields - An array of hidden fields id.
|
|
12
|
-
* @property {Record<string, PivotTableLabelField>} dimension - A object of dimension fields, which key is the field id and value is the field.
|
|
13
|
-
* @property {Record<string, PivotTableValueField>} measure - A object of measure fields, which key is the field id and value is the field.
|
|
14
|
-
* @property {number} valueIndex - The special ΣValue fields order index in the dimension fields
|
|
15
|
-
* @property {PivotTableValuePositionEnum} valuePosition - The special ΣValue fields position in row or column area.
|
|
16
|
-
* @property {PivotLayoutTypeEnum} layout - The layout type of the pivot table.
|
|
17
|
-
* @property {Record<string, any>} collapseInfo - The collapse information of the pivot table. Which data structure is {fieldId: boolean | {item: boolean}}
|
|
18
|
-
*/
|
|
19
|
-
export declare class PivotModel {
|
|
20
|
-
/**
|
|
21
|
-
*@property An array of row fields id.
|
|
22
|
-
*/
|
|
23
|
-
rowFields: string[];
|
|
24
|
-
/**
|
|
25
|
-
*@property An array of column fields id.
|
|
26
|
-
*/
|
|
27
|
-
columnFields: string[];
|
|
28
|
-
/**
|
|
29
|
-
*@property An array of value fields id.
|
|
30
|
-
*/
|
|
31
|
-
valueFields: string[];
|
|
32
|
-
/**
|
|
33
|
-
*@property An array of filter fields id.
|
|
34
|
-
*/
|
|
35
|
-
filterFields: string[];
|
|
36
|
-
/**
|
|
37
|
-
*@property An array of hidden fields id.
|
|
38
|
-
*/
|
|
39
|
-
hiddenFields: string[];
|
|
40
|
-
/**
|
|
41
|
-
*@property An array of dimension fields.
|
|
42
|
-
*/
|
|
43
|
-
dimension: Record<string, PivotTableLabelField>;
|
|
44
|
-
/**
|
|
45
|
-
*@property An array of measure fields.
|
|
46
|
-
*/
|
|
47
|
-
measure: Record<string, PivotTableValueField>;
|
|
48
|
-
/**
|
|
49
|
-
*@property The special ΣValue fields order index in the dimension fields.
|
|
50
|
-
*@description The special ΣValue fields order index in the dimension fields, the index value is equal to the index of the field in the row or column area which the ΣValue field followed.
|
|
51
|
-
*/
|
|
52
|
-
valueIndex: number;
|
|
53
|
-
/**
|
|
54
|
-
*@property The special ΣValue fields position in row or column area.
|
|
55
|
-
*/
|
|
56
|
-
valuePosition: PivotTableValuePositionEnum;
|
|
57
|
-
/**
|
|
58
|
-
*@property The layout type of the pivot table.
|
|
59
|
-
*/
|
|
60
|
-
layout: PivotLayoutTypeEnum;
|
|
61
|
-
/**
|
|
62
|
-
* @property The collapse information of the pivot table.
|
|
63
|
-
*/
|
|
64
|
-
collapseInfo: Record<string, boolean | Record<string, boolean>>;
|
|
65
|
-
/**
|
|
66
|
-
* Creates an instance of PivotModel.
|
|
67
|
-
*/
|
|
68
|
-
options: IPivotTableOptions;
|
|
69
|
-
_changeStack: IPivotTableChangeSet[];
|
|
70
|
-
/**
|
|
71
|
-
* the dirty status is used to flag the pivot table need to be queried data from the data source or just use cached tuple data.
|
|
72
|
-
*/
|
|
73
|
-
private _isDirty;
|
|
74
|
-
constructor();
|
|
75
|
-
startChangeStack(): void;
|
|
76
|
-
endChangeStack(): IPivotTableChangeSet[];
|
|
77
|
-
/**
|
|
78
|
-
* - set a dirty status to flag the pivot table whether it is changed.
|
|
79
|
-
* @param {boolean} dirty
|
|
80
|
-
*/
|
|
81
|
-
setDirty(dirty: boolean): void;
|
|
82
|
-
/**
|
|
83
|
-
* - get the dirty status of the pivot table.
|
|
84
|
-
* @returns {boolean} - The dirty status of the pivot table.
|
|
85
|
-
*/
|
|
86
|
-
getDirty(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* - Set the options of the pivot table.
|
|
89
|
-
* @param {IPivotTableOptions} options - The options to be set.
|
|
90
|
-
* @returns {void}
|
|
91
|
-
*/
|
|
92
|
-
setOptions(options: IPivotTableOptions): void;
|
|
93
|
-
/**
|
|
94
|
-
* - Get the options of the pivot table. It is a copy of the options.
|
|
95
|
-
* @returns {IPivotTableOptions} - The options of the pivot table.
|
|
96
|
-
*/
|
|
97
|
-
getOptions(): IPivotTableOptions;
|
|
98
|
-
/**
|
|
99
|
-
* @description Set the collapse status of the field. Those properties are used to save the collapse status of the field in the pivot table.
|
|
100
|
-
* @param {string} fieldId - The id of the field.
|
|
101
|
-
* @param {boolean} collapse - The collapse status of the field.
|
|
102
|
-
* @param {string} [item] - The item of the field.
|
|
103
|
-
*/
|
|
104
|
-
setCollapse(fieldId: string, collapse: boolean, item?: string): void;
|
|
105
|
-
setFilterInfo(fieldId: string, filterInfo: IPivotTableFilterInfo): void;
|
|
106
|
-
getFieldFormat(fieldId: string): string | undefined;
|
|
107
|
-
setFieldFormat(fieldId: string, format: string | undefined): void;
|
|
108
|
-
setSortInfo(fieldId: string, sortInfo: IPivotTableSortInfo | undefined): void;
|
|
109
|
-
getSortInfo(fieldId: string): IPivotTableSortInfo | undefined;
|
|
110
|
-
getFilterInfo(fieldId: string): IPivotTableFilterInfo | undefined;
|
|
111
|
-
iterateField(callback: (field: PivotTableLabelField | PivotTableValueField) => void): void;
|
|
112
|
-
iterateFieldDim(callback: (field: PivotTableLabelField) => void): void;
|
|
113
|
-
iterateFieldMeasure(callback: (field: PivotTableValueField) => void): void;
|
|
114
|
-
iterateFieldByArea(area: PivotTableFiledAreaEnum, callback: (field: PivotTableLabelField | PivotTableValueField) => void): void;
|
|
115
|
-
/**
|
|
116
|
-
* @description Add a field to the pivot table.
|
|
117
|
-
* @param {PivotTableLabelField | PivotTableValueField} field -the field to be added.
|
|
118
|
-
* @param {PivotTableFiledAreaEnum} area -The area to add the field.
|
|
119
|
-
* @param {number} index - The index of the field in the area.
|
|
120
|
-
*/
|
|
121
|
-
addField(field: PivotTableLabelField | PivotTableValueField, area: PivotTableFiledAreaEnum, index?: number): void;
|
|
122
|
-
/**
|
|
123
|
-
* @description Get where the field bo be position info by field id.
|
|
124
|
-
* @param {string} fieldId - The id of the field.
|
|
125
|
-
* @typedef PositionInfo
|
|
126
|
-
* @property {PivotTableFiledAreaEnum} area - The area of the field.
|
|
127
|
-
* @property {number} index - The index of the field in the area.
|
|
128
|
-
* @returns PositionInfo - The position info of the field. if the field is not in the pivot table, the area will be undefined and the index will be -1.
|
|
129
|
-
*/
|
|
130
|
-
getFieldPositionInfoById(fieldId: string): {
|
|
131
|
-
area: PivotTableFiledAreaEnum | undefined;
|
|
132
|
-
index: number;
|
|
133
|
-
};
|
|
134
|
-
updateFieldSourceInfo(fieldId: string, sourceName: string, dataFieldId: string): void;
|
|
135
|
-
getFieldsAreaByType(type: PivotTableFiledAreaEnum): string[];
|
|
136
|
-
getFieldById(fieldId: string): PivotTableLabelField | PivotTableValueField | undefined;
|
|
137
|
-
isExistFieldName(fieldName: string): boolean;
|
|
138
|
-
/**
|
|
139
|
-
* @description Rename a field in the pivot table.
|
|
140
|
-
* @param {string} fieldId - The id of the field to be renamed.
|
|
141
|
-
* @param displayName - The new display name of the field.
|
|
142
|
-
* @returns {void}
|
|
143
|
-
*/
|
|
144
|
-
renameField(fieldId: string, displayName: string): void;
|
|
145
|
-
/**
|
|
146
|
-
* @description Remove a field from the pivot table by the field id.
|
|
147
|
-
* @param {string} fieldId - The id of the field to be removed.
|
|
148
|
-
* @returns {void} -void
|
|
149
|
-
*/
|
|
150
|
-
removeField(fieldId: string): void;
|
|
151
|
-
updateFieldPosition(fieldId: string, area: PivotTableFiledAreaEnum, index: number): void;
|
|
152
|
-
/**
|
|
153
|
-
* - Update the value position of the pivot table.
|
|
154
|
-
* @param valuePosition
|
|
155
|
-
* @param valueIndex
|
|
156
|
-
*/
|
|
157
|
-
updateValuePosition(valuePosition: PivotTableValuePositionEnum, valueIndex: number): void;
|
|
158
|
-
/**
|
|
159
|
-
* - The special ΣValue fields order index in the dimension fields
|
|
160
|
-
* @returns {number} the index
|
|
161
|
-
*/
|
|
162
|
-
getValueIndex(): number;
|
|
163
|
-
getValuePosition(): PivotTableValuePositionEnum;
|
|
164
|
-
/**
|
|
165
|
-
* - Whether the pivot table has the special ΣValue fields in column area.
|
|
166
|
-
* @returns {boolean} - has or not.
|
|
167
|
-
*/
|
|
168
|
-
isColMultiMeasure(): boolean;
|
|
169
|
-
/**
|
|
170
|
-
* - Whether the pivot table has the special ΣValue fields in row area.
|
|
171
|
-
* @returns {boolean} - has or not.
|
|
172
|
-
*/
|
|
173
|
-
isRowMultiMeasure(): boolean;
|
|
174
|
-
isEmpty(): boolean;
|
|
175
|
-
/**
|
|
176
|
-
* - set or update a field's subtotal type. , the table field must in the value area.
|
|
177
|
-
* @param {string} tableFieldId - The id of the pivot table field.
|
|
178
|
-
* @param {PivotSubtotalTypeEnum} subtotal - The subtotal type.
|
|
179
|
-
*/
|
|
180
|
-
setSubtotalType(tableFieldId: string, subtotal: PivotSubtotalTypeEnum): void;
|
|
181
|
-
/**
|
|
182
|
-
* Represents the query data of the pivot table.Which is used to query the data from the data collection.
|
|
183
|
-
* @returns {IPivotTableQueryData} - The query data of the pivot table.
|
|
184
|
-
*/
|
|
185
|
-
getQueryData(): IPivotTableQueryData;
|
|
186
|
-
fromJSON(data: IPivotTableSnapshot): void;
|
|
187
|
-
toJSON(): IPivotTableSnapshot;
|
|
188
|
-
cloneBufferModel(): PivotModel;
|
|
189
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { DataField } from '../field/data-field';
|
|
2
|
-
import { FieldsCollection } from '../field/fields-collection';
|
|
3
|
-
import { PivotView } from '../layout/pivot-view';
|
|
4
|
-
import { IPivotTableChangeSet, IPivotTableFilterInfo, IPivotTableOptions, IPivotTableQueryData, IPivotTableSnapshot, IPivotTableSortInfo, PivotTableFiledAreaEnum, PivotTableValuePositionEnum, PivotDataFieldDataTypeEnum, PivotSubtotalTypeEnum } from '../types';
|
|
5
|
-
import { PivotModel } from './model';
|
|
6
|
-
import { PivotTableLabelField, PivotTableValueField } from './table-field';
|
|
7
|
-
/**
|
|
8
|
-
* @class PivotTable - represents the wrapper class pivot table.
|
|
9
|
-
* @description The pivot table is a wrapper class which references the data fields collection and pivot table model.
|
|
10
|
-
* @implements IPivotTable
|
|
11
|
-
*/
|
|
12
|
-
export declare class PivotTable {
|
|
13
|
-
dataFieldsCollection: FieldsCollection;
|
|
14
|
-
private _viewVersion;
|
|
15
|
-
private _model;
|
|
16
|
-
_bufferModel: PivotModel;
|
|
17
|
-
private _tupleGroupCache;
|
|
18
|
-
constructor(dataFieldsCollection: FieldsCollection, model?: PivotModel);
|
|
19
|
-
updateDataFieldsCollection(dataFieldsCollection: FieldsCollection): void;
|
|
20
|
-
private _getModel;
|
|
21
|
-
startCollectChangeset(): void;
|
|
22
|
-
endCollectChangeset(): IPivotTableChangeSet[];
|
|
23
|
-
_generateModel(): void;
|
|
24
|
-
createLabelFieldByDataFieldId(dataFieldId: string, tableName?: string): PivotTableLabelField | undefined;
|
|
25
|
-
createValueFieldByDataFieldId(dataFieldId: string): PivotTableValueField | undefined;
|
|
26
|
-
updateValuePosition(valuePosition: PivotTableValuePositionEnum, valueIndex: number): void;
|
|
27
|
-
isColMultiMeasure(): boolean;
|
|
28
|
-
isRowMultiMeasure(): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* get the order index of ΣValue in row or col
|
|
31
|
-
* @returns {number} -1 means not exist, otherwise the index of the ΣValue
|
|
32
|
-
*/
|
|
33
|
-
getValueIndex(): number;
|
|
34
|
-
/**
|
|
35
|
-
* - get the value position
|
|
36
|
-
* @returns {PivotTableValuePositionEnum} the value position, only row or column
|
|
37
|
-
*/
|
|
38
|
-
getValuePosition(): PivotTableValuePositionEnum;
|
|
39
|
-
/**
|
|
40
|
-
* - iterate all pivot table fields
|
|
41
|
-
* @param {(field: PivotTableLabelField | PivotTableValueField) => void} callback the callback function
|
|
42
|
-
*/
|
|
43
|
-
iterateField(callback: (field: PivotTableLabelField | PivotTableValueField) => void): void;
|
|
44
|
-
/**
|
|
45
|
-
* - iterate the dimension field, it means all the label fields
|
|
46
|
-
* @param {(field: PivotTableLabelField | PivotTableValueField) => void} callback the callback function
|
|
47
|
-
*/
|
|
48
|
-
iterateFieldDim(callback: (field: PivotTableLabelField) => void): void;
|
|
49
|
-
/**
|
|
50
|
-
* - iterate the field by the area
|
|
51
|
-
* @param {PivotTableFiledAreaEnum} area the area of the field enum
|
|
52
|
-
* @param {(field: PivotTableLabelField | PivotTableValueField) => void} callback the callback function
|
|
53
|
-
*/
|
|
54
|
-
iterateFieldByArea(area: PivotTableFiledAreaEnum, callback: (field: PivotTableLabelField | PivotTableValueField) => void): void;
|
|
55
|
-
/**
|
|
56
|
-
* - get how many fields in the area
|
|
57
|
-
* @param {PivotTableFiledAreaEnum} area - the area of the field enum
|
|
58
|
-
* @returns {number} the field count
|
|
59
|
-
*/
|
|
60
|
-
getFieldCountByArea(area: PivotTableFiledAreaEnum): number;
|
|
61
|
-
getValueFields(): string[];
|
|
62
|
-
/**
|
|
63
|
-
* - get a unique field name in the pivot table
|
|
64
|
-
* @param {string} autoName the given field name
|
|
65
|
-
* @returns {string} the unique field name
|
|
66
|
-
*/
|
|
67
|
-
getUniqueValueFieldName(autoName: string): string;
|
|
68
|
-
/**
|
|
69
|
-
* - get the data field by the table field id
|
|
70
|
-
* @param {string} tableField - the table field id
|
|
71
|
-
* @returns {DataField|undefined} the data field or undefined
|
|
72
|
-
*/
|
|
73
|
-
getDataFieldByTableId(tableField: string): DataField | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* - get all the table fields by use the data field id
|
|
76
|
-
* @param dataFieldId
|
|
77
|
-
* @returns {string[]} the table field ids
|
|
78
|
-
*/
|
|
79
|
-
getTableFieldsByDataFieldId(dataFieldId: string): (PivotTableLabelField | PivotTableValueField)[];
|
|
80
|
-
/**
|
|
81
|
-
* - get the table field by the table field id
|
|
82
|
-
* @param {string} tableFieldId - the table field id
|
|
83
|
-
* @returns {PivotTableLabelField | PivotTableValueField | undefined} the table field or undefined
|
|
84
|
-
*/
|
|
85
|
-
getTableFieldById(tableFieldId: string): PivotTableLabelField | PivotTableValueField | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* - check the field is exist in the pivot table or not
|
|
88
|
-
* @param {string} tableFieldId the check field id
|
|
89
|
-
* @returns {boolean} exist or not
|
|
90
|
-
*/
|
|
91
|
-
isExistField(tableFieldId: string): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* - get the pivot table is empty or not
|
|
94
|
-
* @returns {boolean} empty or not
|
|
95
|
-
*/
|
|
96
|
-
isEmpty(): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* - get the data field by the data field id
|
|
99
|
-
* @param {string} dataFieldId the data field id
|
|
100
|
-
* @returns {DataField|undefined} the data field or undefined
|
|
101
|
-
*/
|
|
102
|
-
getDataFieldByDataFieldId(dataFieldId: string): DataField | undefined;
|
|
103
|
-
getDataFieldItemInfo(dataField: DataField): {
|
|
104
|
-
items: string[];
|
|
105
|
-
itemTypes: PivotDataFieldDataTypeEnum[];
|
|
106
|
-
};
|
|
107
|
-
getUniqueFieldId(): string;
|
|
108
|
-
/**
|
|
109
|
-
* - add a field to the pivot table by the source name , if the field is a measure field, it will be use auto name.
|
|
110
|
-
* @param {string} dataFieldId data field name
|
|
111
|
-
* @param {PivotTableFiledAreaEnum} area the area of the added field
|
|
112
|
-
* @param {number} [index] the position of the field in the area, if not set, the field will be added to the end of the area.
|
|
113
|
-
* @returns {PivotTableLabelField|PivotTableValueField} the added field
|
|
114
|
-
*/
|
|
115
|
-
addFieldWithSourceId(dataFieldId: string, area: PivotTableFiledAreaEnum, index?: number): PivotTableLabelField | PivotTableValueField | undefined;
|
|
116
|
-
setOptions(options: IPivotTableOptions): void;
|
|
117
|
-
/**
|
|
118
|
-
* the func is only use for when refresh
|
|
119
|
-
* @param {string} fieldId the table field id
|
|
120
|
-
* @param {string} sourceName the source name of the field
|
|
121
|
-
* @param {string} dataFieldId the data field id
|
|
122
|
-
*/
|
|
123
|
-
updateFieldSourceInfo(fieldId: string, sourceName: string, dataFieldId: string): void;
|
|
124
|
-
/**
|
|
125
|
-
* - Set the subtotal type of the field. only the value field can set the subtotal type. only effective for the value field.
|
|
126
|
-
* @param {string} fieldId - The id of the field.
|
|
127
|
-
* @param {PivotSubtotalTypeEnum} subtotalType - The subtotal type of the field.
|
|
128
|
-
*/
|
|
129
|
-
setSubtotalType(fieldId: string, subtotalType: PivotSubtotalTypeEnum): void;
|
|
130
|
-
/**
|
|
131
|
-
* - Rename the field.
|
|
132
|
-
* @param {string} fieldId - The id of the field.
|
|
133
|
-
* @param {string} displayName - The display name of the field.
|
|
134
|
-
*/
|
|
135
|
-
renameField(fieldId: string, displayName: string): void;
|
|
136
|
-
/**
|
|
137
|
-
* - Set the filter information of the dimension field. only the dimension field can set the filter information.
|
|
138
|
-
* @param fieldId
|
|
139
|
-
* @param filterInfo
|
|
140
|
-
*/
|
|
141
|
-
setFilterInfo(fieldId: string, filterInfo: IPivotTableFilterInfo): void;
|
|
142
|
-
/**
|
|
143
|
-
* - Set the sort information of the dimension field. only the dimension field can set the sort information.
|
|
144
|
-
* @param {string} fieldId - The id of the field.
|
|
145
|
-
* @param {IPivotTableSortInfo} sortInfo - The sort information of the field.
|
|
146
|
-
*/
|
|
147
|
-
setSortInfo(fieldId: string, sortInfo: IPivotTableSortInfo | undefined): void;
|
|
148
|
-
/**
|
|
149
|
-
* - get the sort information of the dimension field.
|
|
150
|
-
* @param fieldId - The id of the field.
|
|
151
|
-
* @returns {IPivotTableSortInfo} -The sort information of the field.
|
|
152
|
-
*/
|
|
153
|
-
getSortInfo(fieldId: string): IPivotTableSortInfo | undefined;
|
|
154
|
-
getFilterInfo(fieldId: string): IPivotTableFilterInfo | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* get the filter information by the filter index
|
|
157
|
-
* @param {number} index - The index of the filter field.
|
|
158
|
-
* @returns {string | undefined} the table field id
|
|
159
|
-
*/
|
|
160
|
-
getFilterFieldIdByIndex(index: number): string | undefined;
|
|
161
|
-
/**
|
|
162
|
-
* - set the position of the field in the pivot table. which used in pivot panel drag field.
|
|
163
|
-
* @param {string} fieldId - The id of the pivot table field.
|
|
164
|
-
* @param {PivotTableFiledAreaEnum} area which area the field will be placed.
|
|
165
|
-
* @param {number} index the index of the field in the area.
|
|
166
|
-
*/
|
|
167
|
-
updateFieldPosition(fieldId: string, area: PivotTableFiledAreaEnum, index: number): void;
|
|
168
|
-
/**
|
|
169
|
-
* - get a format for pivot table field, which will be applied in the pivot table view. the label field will use the format to format the date value.
|
|
170
|
-
* @description when a show data as type is selected, we should set the format for the field.
|
|
171
|
-
* @param {string} fieldId -the field id
|
|
172
|
-
* @returns {string} the field format code
|
|
173
|
-
*/
|
|
174
|
-
getFieldFormat(fieldId: string): string | undefined;
|
|
175
|
-
/**
|
|
176
|
-
* - set the format for pivot table field, which will be applied in the pivot table view. the label field will use the format to format the date value.
|
|
177
|
-
* @description when a show data as type is selected, we should set the format for the field. a label field which contains the date value should set the format.
|
|
178
|
-
* @param {string} fieldId
|
|
179
|
-
* @param {string|undefined} format
|
|
180
|
-
*/
|
|
181
|
-
setFieldFormat(fieldId: string, format: string | undefined): void;
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
* @param field
|
|
185
|
-
* @param area
|
|
186
|
-
* @example
|
|
187
|
-
* const pt= new PivotTable(fieldsCollection);
|
|
188
|
-
* var areaField = pt.addFieldWithSourceName('区域', PivotTableFiledAreaEnum.Column);
|
|
189
|
-
* pt.addFieldWithSourceName('省份', PivotTableFiledAreaEnum.Filter);
|
|
190
|
-
*/
|
|
191
|
-
addField(field: PivotTableLabelField | PivotTableValueField, area: PivotTableFiledAreaEnum, index?: number): void;
|
|
192
|
-
removeField(fieldId: string): void;
|
|
193
|
-
getOptions(): IPivotTableOptions;
|
|
194
|
-
/**
|
|
195
|
-
* @description Set the collapse status of the field. Those properties are used to save the collapse status of the field in the pivot table.
|
|
196
|
-
* @param {string} fieldId - The id of the field.
|
|
197
|
-
* @param {boolean} collapse - The collapse status of the field.
|
|
198
|
-
* @param {string} [item] - The item of the field.
|
|
199
|
-
*/
|
|
200
|
-
setCollapse(fieldId: string, collapse: boolean, item?: string): void;
|
|
201
|
-
/**
|
|
202
|
-
* - get the pivot view need query or not
|
|
203
|
-
* @param {number} viewVersion
|
|
204
|
-
* @returns {boolean} - need query or not
|
|
205
|
-
*/
|
|
206
|
-
getNeedQuery(viewVersion: number): boolean;
|
|
207
|
-
/**
|
|
208
|
-
* @description Get the field position information by the field id.
|
|
209
|
-
* @param {string} fieldId the field id
|
|
210
|
-
* @returns {PositionInfo} - The position information of the field or undefined.
|
|
211
|
-
*/
|
|
212
|
-
getFieldPositionInfoById(fieldId: string): {
|
|
213
|
-
area: PivotTableFiledAreaEnum | undefined;
|
|
214
|
-
index: number;
|
|
215
|
-
};
|
|
216
|
-
private _getTupleCache;
|
|
217
|
-
/**
|
|
218
|
-
* Find the tupleItem in the cache that matches the position order according to the passed array,
|
|
219
|
-
* and after obtaining the row number array marked on it,
|
|
220
|
-
* summarize and sort to get all the relevant source data rows
|
|
221
|
-
*
|
|
222
|
-
* The key point here is that `dimensionIdList` and `dimensionTableIdList` are one-to-one index corresponding
|
|
223
|
-
*
|
|
224
|
-
* @param {string[][]} -A two-dimensional array with path and tableFieldId
|
|
225
|
-
* @returns {number[]} -Sorted row numbers
|
|
226
|
-
*/
|
|
227
|
-
getIndexesByPathStr(tuple: string[][]): number[];
|
|
228
|
-
setDirty(dirty: boolean): void;
|
|
229
|
-
query(config?: IPivotTableQueryData): PivotView;
|
|
230
|
-
toJSON(): IPivotTableSnapshot;
|
|
231
|
-
fromJSON(data: IPivotTableSnapshot): void;
|
|
232
|
-
dispose(): void;
|
|
233
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { IPivotTableFilterInfo, IPivotTableLabelFieldJSON, IPivotTableLabelFieldQueryData, IPivotTableShowDataAsInfo, IPivotTableSortInfo, IPivotTableValueFieldJSON, IPivotTableValueFieldQueryData, PivotSubtotalTypeEnum } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a base class for the field in a pivot table.
|
|
4
|
-
* @abstract
|
|
5
|
-
* @description The base class for the field in a pivot table.
|
|
6
|
-
* @property {string} dataFieldId - The base data field id of the field.
|
|
7
|
-
* @property {string} id - The unique identifier of the field.
|
|
8
|
-
* @property {string} displayName - The display name of the field. the default value is the data field name.
|
|
9
|
-
* @property {string} lossLessProperty - thr public object to save the property not defined but should be saved.
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class PivotTableFieldBase {
|
|
13
|
-
/**
|
|
14
|
-
* @property {string} - The base data field id of the field.
|
|
15
|
-
*/
|
|
16
|
-
readonly dataFieldId: string;
|
|
17
|
-
readonly id: string;
|
|
18
|
-
readonly sourceName: string;
|
|
19
|
-
displayName: string;
|
|
20
|
-
format: string | undefined;
|
|
21
|
-
lossLessProperty?: any;
|
|
22
|
-
constructor(dataFieldId: string, id: string, displayName: string | undefined, sourceName: string);
|
|
23
|
-
getId(): string;
|
|
24
|
-
/**
|
|
25
|
-
* - the read only name in collection
|
|
26
|
-
* @returns {string} - the source name of the field, which is the name of the data field.
|
|
27
|
-
*/
|
|
28
|
-
getSourceName(): string;
|
|
29
|
-
setSourceName(sourceName: string): void;
|
|
30
|
-
setDataFieldId(dataFieldId: string): void;
|
|
31
|
-
getDataFieldId(): string;
|
|
32
|
-
getFormat(): string | undefined;
|
|
33
|
-
setFormat(format: string | undefined): void;
|
|
34
|
-
setDisplayName(displayName: string): void;
|
|
35
|
-
getDisplayName(): string;
|
|
36
|
-
/**
|
|
37
|
-
* @abstract
|
|
38
|
-
*/
|
|
39
|
-
abstract toJSON(): object;
|
|
40
|
-
/**
|
|
41
|
-
* @abstract
|
|
42
|
-
* @param {object} data - the data config a field.
|
|
43
|
-
*/
|
|
44
|
-
abstract fromJSON(data: object): void;
|
|
45
|
-
/**
|
|
46
|
-
* @abstract
|
|
47
|
-
* @returns {object} - the query data of the field.
|
|
48
|
-
*/
|
|
49
|
-
abstract getQueryData(): object;
|
|
50
|
-
}
|
|
51
|
-
export declare class PivotTableValueField extends PivotTableFieldBase {
|
|
52
|
-
subtotal: PivotSubtotalTypeEnum;
|
|
53
|
-
showDataAs: IPivotTableShowDataAsInfo;
|
|
54
|
-
constructor(dataFieldId: string, id: string, displayName: string | undefined, sourceName: string);
|
|
55
|
-
setSubtotal(subtotal: PivotSubtotalTypeEnum): void;
|
|
56
|
-
getSubtotal(): PivotSubtotalTypeEnum;
|
|
57
|
-
setShowDataAs(showDataAs: IPivotTableShowDataAsInfo): void;
|
|
58
|
-
getShowDataAs(): IPivotTableShowDataAsInfo;
|
|
59
|
-
getQueryData(): IPivotTableValueFieldQueryData;
|
|
60
|
-
/**
|
|
61
|
-
* @override
|
|
62
|
-
* @returns {IPivotTableValueFieldJSON} - the JSON data of the value field.
|
|
63
|
-
*/
|
|
64
|
-
toJSON(): IPivotTableValueFieldJSON;
|
|
65
|
-
/**
|
|
66
|
-
* @override
|
|
67
|
-
* @param data
|
|
68
|
-
*/
|
|
69
|
-
fromJSON(data: IPivotTableValueFieldJSON): void;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Represents a label field in a pivot table.
|
|
73
|
-
*/
|
|
74
|
-
export declare class PivotTableLabelField extends PivotTableFieldBase {
|
|
75
|
-
sortInfo: IPivotTableSortInfo | undefined;
|
|
76
|
-
filterInfo: IPivotTableFilterInfo;
|
|
77
|
-
constructor(dataFieldId: string, id: string, displayName: string | undefined, sourceName: string);
|
|
78
|
-
/**
|
|
79
|
-
* @method setSortInfo
|
|
80
|
-
* @description Set the sort information of the label field.
|
|
81
|
-
* @param {IPivotTableSortInfo} sortInfo - The sort information of the label field.
|
|
82
|
-
*/
|
|
83
|
-
setSortInfo(sortInfo: IPivotTableSortInfo | undefined): void;
|
|
84
|
-
/**
|
|
85
|
-
* @method getSortInfo
|
|
86
|
-
* @description Get the sort information of the label field.
|
|
87
|
-
* @returns {IPivotTableSortInfo} The sort information of the label field.
|
|
88
|
-
*/
|
|
89
|
-
getSortInfo(): IPivotTableSortInfo | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* @method setFilterInfo
|
|
92
|
-
* @description Set the filter information of the label field. Only one of the manual filter, custom filter or value filter can be effective.
|
|
93
|
-
* @param {IPivotTableFilterInfo} filterInfo - The filter information of the label field. the manual filter, custom filter or value filter is opposite to each other.
|
|
94
|
-
*/
|
|
95
|
-
setFilterInfo(filterInfo: IPivotTableFilterInfo): void;
|
|
96
|
-
/**
|
|
97
|
-
* @method getFilterInfo
|
|
98
|
-
* @description Get the filter information of the label field.
|
|
99
|
-
* @returns {IPivotTableFilterInfo} The filter information of the label field.
|
|
100
|
-
*/
|
|
101
|
-
getFilterInfo(): IPivotTableFilterInfo;
|
|
102
|
-
getQueryData(): IPivotTableLabelFieldQueryData;
|
|
103
|
-
toJSON(): IPivotTableLabelFieldJSON;
|
|
104
|
-
fromJSON(data: IPivotTableLabelFieldJSON): void;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Clone the label field to a value field.
|
|
108
|
-
* @param {PivotTableLabelField} labelField - The label field to be cloned.
|
|
109
|
-
* @param {boolean} [keepUnknown] - Whether to keep the unknown property of the label field. the default value is true.
|
|
110
|
-
* @returns {PivotTableValueField} - the value field may has sortInfo and filterInfo in the property lossLessProperty.
|
|
111
|
-
*/
|
|
112
|
-
export declare function cloneLabelFieldToValueField(labelField: PivotTableLabelField, keepUnknown?: boolean): PivotTableValueField;
|
|
113
|
-
/**
|
|
114
|
-
* Clone the value field to a label field.
|
|
115
|
-
* @param {PivotTableValueField} valueField - The value field to be cloned.
|
|
116
|
-
* @param {boolean} [keepUnknown] - Whether to keep the unknown property of the value field. the default value is true.
|
|
117
|
-
* @returns {PivotTableLabelField} - the label field may has sortInfo and filterInfo in the property lossLessProperty.
|
|
118
|
-
*/
|
|
119
|
-
export declare function cloneValueFieldToLabelField(valueField: PivotTableValueField, keepUnknown?: boolean): PivotTableLabelField;
|
|
120
|
-
/**
|
|
121
|
-
* - Create a value field from the JSON data.
|
|
122
|
-
* @param {IPivotTableValueFieldJSON} data - The JSON data of the value field.
|
|
123
|
-
* @returns {PivotTableValueField} - The value field created from the JSON data.
|
|
124
|
-
*/
|
|
125
|
-
export declare function createValueField(data: IPivotTableValueFieldJSON): PivotTableValueField;
|
|
126
|
-
/**
|
|
127
|
-
* - Create a label field from the JSON data.
|
|
128
|
-
* @param {IPivotTableLabelFieldJSON} data - The JSON data of the label field.
|
|
129
|
-
* @returns {PivotTableLabelField} - The label field created from the JSON data.
|
|
130
|
-
*/
|
|
131
|
-
export declare function createLabelField(data: IPivotTableLabelFieldJSON): PivotTableLabelField;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { PivotDataFieldDataTypeEnum } from '../types';
|
|
2
|
-
export declare class NodeTree {
|
|
3
|
-
/**
|
|
4
|
-
* @property {number} index - The id of the node tree.which is the index of summary-manager tuples
|
|
5
|
-
*/
|
|
6
|
-
private readonly _index;
|
|
7
|
-
/**
|
|
8
|
-
* @property {number} level - The level of the node tree. the root level is 0.
|
|
9
|
-
*/
|
|
10
|
-
private _level;
|
|
11
|
-
/**
|
|
12
|
-
* @property {number} parentIndex - The parent index of the node tree. the root node parent index is -1.
|
|
13
|
-
*/
|
|
14
|
-
parentIndex: number;
|
|
15
|
-
paths: string[];
|
|
16
|
-
isLeaf: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* @property {string} name - The name of the node tree.
|
|
19
|
-
*/
|
|
20
|
-
name: string;
|
|
21
|
-
fieldId: string;
|
|
22
|
-
collapse: boolean;
|
|
23
|
-
sortedList: string[];
|
|
24
|
-
hasSort: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* - the data type of the node tree.
|
|
27
|
-
*/
|
|
28
|
-
type: PivotDataFieldDataTypeEnum;
|
|
29
|
-
private _nodes;
|
|
30
|
-
constructor(index: number, fieldId: string, type: PivotDataFieldDataTypeEnum);
|
|
31
|
-
getCollapse(): boolean;
|
|
32
|
-
setCollapse(collapse: boolean): void;
|
|
33
|
-
getFieldsId(): string;
|
|
34
|
-
iterate(callback: (node: NodeTree) => void): void;
|
|
35
|
-
getIndex(): number;
|
|
36
|
-
hasNode(path: string): boolean;
|
|
37
|
-
setParentIndex(parentIndex: number): void;
|
|
38
|
-
setLevel(level: number): void;
|
|
39
|
-
getLevel(): number;
|
|
40
|
-
setPaths(paths: string[]): void;
|
|
41
|
-
getPaths(): string[];
|
|
42
|
-
setLeaf(): void;
|
|
43
|
-
getIsLeaf(): boolean;
|
|
44
|
-
setName(name: string): void;
|
|
45
|
-
addNode(node: NodeTree, path: string, sortMap: Record<string, number> | undefined, isAsc: boolean): void;
|
|
46
|
-
sortNode(path: string, sortedMap: Record<string, number>, isAsc: boolean): void;
|
|
47
|
-
getNode(path: string): NodeTree | undefined;
|
|
48
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IDataFieldValue, ITPivotTupleInfo, PivotErrorTypeEnum, PivotSubtotalTypeEnum } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* @class PivotTuple
|
|
4
|
-
* @description use Welford algorithm calc subtotal
|
|
5
|
-
* https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
|
|
6
|
-
*/
|
|
7
|
-
export declare class PivotTuple {
|
|
8
|
-
private _sum;
|
|
9
|
-
private _count;
|
|
10
|
-
private _countN;
|
|
11
|
-
private _product;
|
|
12
|
-
private _min;
|
|
13
|
-
private _max;
|
|
14
|
-
private _squareSum;
|
|
15
|
-
constructor();
|
|
16
|
-
getInfo(): ITPivotTupleInfo;
|
|
17
|
-
reset(): void;
|
|
18
|
-
addValue(value: IDataFieldValue): void;
|
|
19
|
-
unionTuples(tuples: PivotTuple[]): void;
|
|
20
|
-
unionTupleInfo(tupleInfo: ITPivotTupleInfo): void;
|
|
21
|
-
getSubtotal(subtotalType: PivotSubtotalTypeEnum): number | {
|
|
22
|
-
errorType: PivotErrorTypeEnum;
|
|
23
|
-
};
|
|
24
|
-
}
|