@lumeer/pivot 0.0.3 → 0.0.6
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/esm2022/lib/lmr-pivot-table.component.mjs +12 -6
- package/esm2022/lib/lmr-pivot-table.module.mjs +12 -3
- package/esm2022/lib/lmr-simple-pivot-table.component.mjs +98 -0
- package/esm2022/lib/util/lmr-pivot-config.mjs +1 -1
- package/esm2022/lib/util/lmr-pivot-data.mjs +1 -1
- package/esm2022/lib/util/lmr-simple-pivot-config.mjs +2 -0
- package/esm2022/lib/util/pivot-data-converter.mjs +20 -15
- package/esm2022/lib/util/pivot-table-converter.mjs +237 -65
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/lumeer-pivot.mjs +370 -86
- package/fesm2022/lumeer-pivot.mjs.map +1 -1
- package/lib/lmr-pivot-table.component.d.ts +5 -3
- package/lib/lmr-pivot-table.module.d.ts +8 -6
- package/lib/lmr-simple-pivot-table.component.d.ts +32 -0
- package/lib/util/lmr-pivot-config.d.ts +26 -5
- package/lib/util/lmr-pivot-data.d.ts +23 -7
- package/lib/util/lmr-simple-pivot-config.d.ts +9 -0
- package/lib/util/pivot-data-converter.d.ts +1 -1
- package/lib/util/pivot-table-converter.d.ts +13 -3
- package/lumeer-pivot-0.0.6.tgz +0 -0
- package/package.json +3 -2
- package/public-api.d.ts +2 -0
- package/lumeer-pivot-0.0.3.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter, OnChanges, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
|
|
2
|
-
import { LmrPivotConfig,
|
|
2
|
+
import { LmrPivotConfig, LmrPivotTransform } from './util/lmr-pivot-config';
|
|
3
3
|
import { Collection, ConstraintData, DocumentsAndLinksData, LinkType, Query } from '@lumeer/data-filters';
|
|
4
4
|
import { LmrPivotData } from './util/lmr-pivot-data';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
@@ -13,9 +13,11 @@ export declare class LmrPivotTableComponent implements OnInit, OnChanges {
|
|
|
13
13
|
constraintData: ConstraintData;
|
|
14
14
|
config: LmrPivotConfig;
|
|
15
15
|
transform: LmrPivotTransform;
|
|
16
|
-
|
|
16
|
+
emptyTablesTemplateInput: TemplateRef<any>;
|
|
17
|
+
tableCellTemplateInput: TemplateRef<any>;
|
|
17
18
|
cellClick: EventEmitter<LmrPivotTableCell>;
|
|
18
19
|
pivotDataChange: EventEmitter<LmrPivotData>;
|
|
20
|
+
pivotTablesChange: EventEmitter<LmrPivotTable[]>;
|
|
19
21
|
emptyTablesTemplate: TemplateRef<any>;
|
|
20
22
|
tableCellTemplate: TemplateRef<any>;
|
|
21
23
|
private readonly pivotTransformer;
|
|
@@ -27,5 +29,5 @@ export declare class LmrPivotTableComponent implements OnInit, OnChanges {
|
|
|
27
29
|
private handleData;
|
|
28
30
|
ngOnChanges(changes: SimpleChanges): void;
|
|
29
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<LmrPivotTableComponent, never>;
|
|
30
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<LmrPivotTableComponent, "lmr-pivot-table", never, { "collections": { "alias": "collections"; "required": false; }; "data": { "alias": "data"; "required": false; }; "linkTypes": { "alias": "linkTypes"; "required": false; }; "query": { "alias": "query"; "required": false; }; "constraintData": { "alias": "constraintData"; "required": false; }; "config": { "alias": "config"; "required": false; }; "transform": { "alias": "transform"; "required": false; }; "
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LmrPivotTableComponent, "lmr-pivot-table", never, { "collections": { "alias": "collections"; "required": false; }; "data": { "alias": "data"; "required": false; }; "linkTypes": { "alias": "linkTypes"; "required": false; }; "query": { "alias": "query"; "required": false; }; "constraintData": { "alias": "constraintData"; "required": false; }; "config": { "alias": "config"; "required": false; }; "transform": { "alias": "transform"; "required": false; }; "emptyTablesTemplateInput": { "alias": "emptyTablesTemplateInput"; "required": false; }; "tableCellTemplateInput": { "alias": "tableCellTemplateInput"; "required": false; }; }, { "cellClick": "cellClick"; "pivotDataChange": "pivotDataChange"; "pivotTablesChange": "pivotTablesChange"; }, ["emptyTablesTemplate", "tableCellTemplate"], never, false, never>;
|
|
31
33
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "./lmr-pivot-table.component";
|
|
3
|
-
import * as i2 from "./
|
|
4
|
-
import * as i3 from "./pipes/pivot-
|
|
5
|
-
import * as i4 from "./pipes/
|
|
6
|
-
import * as i5 from "./
|
|
7
|
-
import * as i6 from "
|
|
3
|
+
import * as i2 from "./lmr-simple-pivot-table.component";
|
|
4
|
+
import * as i3 from "./pipes/pivot-data-empty.pipe";
|
|
5
|
+
import * as i4 from "./pipes/pivot-table-value.pipe";
|
|
6
|
+
import * as i5 from "./pipes/contrast-color.pipe";
|
|
7
|
+
import * as i6 from "./directives/lmr-templates.directive";
|
|
8
|
+
import * as i7 from "@angular/common";
|
|
9
|
+
import * as i8 from "@angular/cdk/scrolling";
|
|
8
10
|
export declare class LmrPivotTableModule {
|
|
9
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<LmrPivotTableModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<LmrPivotTableModule, [typeof i1.LmrPivotTableComponent, typeof i2.
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LmrPivotTableModule, [typeof i1.LmrPivotTableComponent, typeof i2.LmrSimplePivotTableComponent, typeof i3.PivotDataEmptyPipe, typeof i4.PivotTableCellHasValuePipe, typeof i5.ContrastColorPipe, typeof i6.LmrEmptyTablesTemplateDirective, typeof i6.LmrTableCellTemplateDirective], [typeof i7.CommonModule, typeof i8.ScrollingModule], [typeof i1.LmrPivotTableComponent, typeof i2.LmrSimplePivotTableComponent, typeof i6.LmrEmptyTablesTemplateDirective, typeof i6.LmrTableCellTemplateDirective]>;
|
|
11
13
|
static ɵinj: i0.ɵɵInjectorDeclaration<LmrPivotTableModule>;
|
|
12
14
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
|
|
2
|
+
import { LmrPivotConfig, LmrPivotTransform } from './util/lmr-pivot-config';
|
|
3
|
+
import { Attribute, Collection, ConstraintData, DocumentsAndLinksData, LanguageTag, Query } from '@lumeer/data-filters';
|
|
4
|
+
import { LmrPivotData } from './util/lmr-pivot-data';
|
|
5
|
+
import { LmrPivotTable, LmrPivotTableCell } from './util/lmr-pivot-table';
|
|
6
|
+
import { LmrSimplePivotConfig } from './util/lmr-simple-pivot-config';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class LmrSimplePivotTableComponent implements OnChanges {
|
|
9
|
+
rows: Record<string, any>[];
|
|
10
|
+
attributes: Attribute[];
|
|
11
|
+
color: string;
|
|
12
|
+
config: LmrSimplePivotConfig;
|
|
13
|
+
transform: LmrPivotTransform;
|
|
14
|
+
locale: LanguageTag;
|
|
15
|
+
cellClick: EventEmitter<LmrPivotTableCell>;
|
|
16
|
+
pivotDataChange: EventEmitter<LmrPivotData>;
|
|
17
|
+
pivotTablesChange: EventEmitter<LmrPivotTable[]>;
|
|
18
|
+
emptyTablesTemplate: TemplateRef<any>;
|
|
19
|
+
tableCellTemplate: TemplateRef<any>;
|
|
20
|
+
readonly collectionId: string;
|
|
21
|
+
readonly query: Query;
|
|
22
|
+
collection: Collection;
|
|
23
|
+
pivotConfig: LmrPivotConfig;
|
|
24
|
+
data: DocumentsAndLinksData;
|
|
25
|
+
constraintData: ConstraintData;
|
|
26
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
27
|
+
private createCollection;
|
|
28
|
+
private createConfig;
|
|
29
|
+
private createRows;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LmrSimplePivotTableComponent, never>;
|
|
31
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LmrSimplePivotTableComponent, "lmr-simple-pivot-table", never, { "rows": { "alias": "rows"; "required": false; }; "attributes": { "alias": "attributes"; "required": false; }; "color": { "alias": "color"; "required": false; }; "config": { "alias": "config"; "required": false; }; "transform": { "alias": "transform"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; }, { "cellClick": "cellClick"; "pivotDataChange": "pivotDataChange"; "pivotTablesChange": "pivotTablesChange"; }, ["emptyTablesTemplate", "tableCellTemplate"], never, false, never>;
|
|
32
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Constraint, DataAggregationType, QueryAttribute, QueryStem } from '@lumeer/data-filters';
|
|
2
|
+
import { LmrPivotDataHeader } from './lmr-pivot-data';
|
|
2
3
|
export interface LmrPivotConfig {
|
|
3
4
|
version?: LmrPivotConfigVersion;
|
|
4
5
|
stemsConfigs: LmrPivotStemConfig[];
|
|
@@ -6,11 +7,13 @@ export interface LmrPivotConfig {
|
|
|
6
7
|
}
|
|
7
8
|
export interface LmrPivotTransform {
|
|
8
9
|
checkValidConstraintOverride?: (c1: Constraint, c2: Constraint) => Constraint;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
formatAggregation?: (type: DataAggregationType) => string;
|
|
11
|
+
formatSummaryHeader?: (header: LmrPivotDataHeader, level: number) => {
|
|
12
|
+
title?: string;
|
|
13
|
+
summary: string;
|
|
14
|
+
};
|
|
15
|
+
formatRowHeader?: (title: string, level: number) => string;
|
|
16
|
+
formatColumnHeader?: (title: string, level: number) => string;
|
|
14
17
|
}
|
|
15
18
|
export interface LmrPivotStemConfig {
|
|
16
19
|
stem?: QueryStem;
|
|
@@ -27,8 +30,10 @@ export interface LmrPivotRowColumnAttribute extends LmrPivotAttribute {
|
|
|
27
30
|
showSums?: boolean;
|
|
28
31
|
sticky?: boolean;
|
|
29
32
|
sort?: LmrPivotSort;
|
|
33
|
+
expressions?: LmrPivotExpression[];
|
|
30
34
|
}
|
|
31
35
|
export interface LmrPivotRowAttribute extends LmrPivotRowColumnAttribute {
|
|
36
|
+
showHeader?: boolean;
|
|
32
37
|
}
|
|
33
38
|
export interface LmrPivotColumnAttribute extends LmrPivotRowColumnAttribute {
|
|
34
39
|
}
|
|
@@ -55,3 +60,19 @@ export interface LmrPivotValueAttribute extends LmrPivotAttribute {
|
|
|
55
60
|
aggregation: DataAggregationType;
|
|
56
61
|
valueType?: LmrPivotValueType;
|
|
57
62
|
}
|
|
63
|
+
export interface LmrPivotExpression {
|
|
64
|
+
operation: LmrPivotExpressionOperation;
|
|
65
|
+
operands: LmrPivotOperand[];
|
|
66
|
+
title: string;
|
|
67
|
+
type: 'expression';
|
|
68
|
+
}
|
|
69
|
+
export type LmrPivotExpressionOperation = 'add' | 'subtract' | 'multiply' | 'divide';
|
|
70
|
+
export interface LmrPivotHeaderOperand {
|
|
71
|
+
type: 'header';
|
|
72
|
+
value: string;
|
|
73
|
+
}
|
|
74
|
+
export interface LmrPivotValueOperand {
|
|
75
|
+
type: 'value';
|
|
76
|
+
value: number;
|
|
77
|
+
}
|
|
78
|
+
export type LmrPivotOperand = LmrPivotHeaderOperand | LmrPivotValueOperand | LmrPivotExpression;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Constraint, ConstraintData, DataAggregationType, DataResource } from '@lumeer/data-filters';
|
|
2
|
-
import { LmrPivotSort, LmrPivotValueType } from './lmr-pivot-config';
|
|
2
|
+
import { LmrPivotExpression, LmrPivotHeaderOperand, LmrPivotSort, LmrPivotValueOperand, LmrPivotValueType } from './lmr-pivot-config';
|
|
3
3
|
export interface LmrPivotData {
|
|
4
4
|
data: LmrPivotStemData[];
|
|
5
5
|
constraintData?: ConstraintData;
|
|
@@ -8,21 +8,29 @@ export interface LmrPivotData {
|
|
|
8
8
|
}
|
|
9
9
|
export interface LmrPivotStemData {
|
|
10
10
|
columnHeaders: LmrPivotDataHeader[];
|
|
11
|
+
columnHeaderAttributes: LmrPivotHeaderAttribute[];
|
|
11
12
|
rowHeaders: LmrPivotDataHeader[];
|
|
13
|
+
rowHeaderAttributes: LmrPivotHeaderAttribute[];
|
|
12
14
|
valueTitles: string[];
|
|
13
15
|
values: any[][];
|
|
14
16
|
dataResources: DataResource[][][];
|
|
15
17
|
valuesConstraints?: Constraint[];
|
|
16
18
|
valueTypes?: LmrPivotValueType[];
|
|
17
19
|
valueAggregations?: DataAggregationType[];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
rowSorts?: LmrPivotSort[];
|
|
21
|
-
columnShowSums: boolean[];
|
|
22
|
-
columnSticky: boolean[];
|
|
23
|
-
columnSorts?: LmrPivotSort[];
|
|
20
|
+
rowsConfig: LmrPivotDimensionConfig[];
|
|
21
|
+
columnsConfig: LmrPivotDimensionConfig[];
|
|
24
22
|
hasAdditionalColumnLevel?: boolean;
|
|
25
23
|
}
|
|
24
|
+
export interface LmrPivotDimensionConfig {
|
|
25
|
+
showSums?: boolean;
|
|
26
|
+
sticky?: boolean;
|
|
27
|
+
sort?: LmrPivotSort;
|
|
28
|
+
expressions?: LmrPivotExpression[];
|
|
29
|
+
}
|
|
30
|
+
export interface LmrPivotHeaderAttribute {
|
|
31
|
+
title: string;
|
|
32
|
+
color: string;
|
|
33
|
+
}
|
|
26
34
|
export interface LmrPivotDataHeader {
|
|
27
35
|
title: string;
|
|
28
36
|
children?: LmrPivotDataHeader[];
|
|
@@ -31,4 +39,12 @@ export interface LmrPivotDataHeader {
|
|
|
31
39
|
isValueHeader: boolean;
|
|
32
40
|
constraint?: Constraint;
|
|
33
41
|
attributeName?: string;
|
|
42
|
+
expressions?: LmrPivotDataHeaderExpression[];
|
|
43
|
+
}
|
|
44
|
+
export interface LmrPivotDataHeaderExpression extends LmrPivotExpression {
|
|
45
|
+
lastHeaderIndex?: number;
|
|
46
|
+
operands: LmrPivotDataHeaderOperand[];
|
|
34
47
|
}
|
|
48
|
+
export type LmrPivotDataHeaderOperand = LmrPivotHeaderOperand & {
|
|
49
|
+
headers: LmrPivotDataHeader[];
|
|
50
|
+
} | LmrPivotValueOperand | LmrPivotDataHeaderExpression;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LmrPivotColumnAttribute, LmrPivotRowAttribute, LmrPivotValueAttribute } from './lmr-pivot-config';
|
|
2
|
+
export interface LmrSimplePivotConfig {
|
|
3
|
+
rowAttributes: LmrSimplePivotRowAttribute[];
|
|
4
|
+
columnAttributes: LmrSimplePivotColumnAttribute[];
|
|
5
|
+
valueAttributes: LmrSimplePivotValueAttribute[];
|
|
6
|
+
}
|
|
7
|
+
export type LmrSimplePivotRowAttribute = Omit<LmrPivotRowAttribute, 'resourceType' | 'resourceId' | 'resourceIndex'>;
|
|
8
|
+
export type LmrSimplePivotColumnAttribute = Omit<LmrPivotColumnAttribute, 'resourceType' | 'resourceId' | 'resourceIndex'>;
|
|
9
|
+
export type LmrSimplePivotValueAttribute = Omit<LmrPivotValueAttribute, 'resourceType' | 'resourceId' | 'resourceIndex'>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { ConstraintData } from '@lumeer/data-filters';
|
|
2
2
|
import { LmrPivotData, LmrPivotStemData } from './lmr-pivot-data';
|
|
3
3
|
import { LmrPivotTable } from './lmr-pivot-table';
|
|
4
|
-
import {
|
|
4
|
+
import { LmrPivotTransform } from './lmr-pivot-config';
|
|
5
5
|
export declare class PivotTableConverter {
|
|
6
6
|
static readonly emptyClass = "pivot-empty-cell";
|
|
7
7
|
static readonly dataClass = "pivot-data-cell";
|
|
8
8
|
static readonly groupDataClass = "pivot-data-group-cell";
|
|
9
9
|
static readonly rowHeaderClass = "pivot-row-header-cell";
|
|
10
10
|
static readonly rowGroupHeaderClass = "pivot-row-group-header-cell";
|
|
11
|
+
static readonly rowAttributeHeaderClass = "pivot-row-attribute-header-cell";
|
|
11
12
|
static readonly columnHeaderClass = "pivot-column-header-cell";
|
|
12
13
|
static readonly columnGroupHeaderClass = "pivot-column-group-header-cell";
|
|
13
14
|
private readonly groupColors;
|
|
14
15
|
private readonly percentageConstraint;
|
|
15
16
|
private data;
|
|
16
|
-
private
|
|
17
|
+
private transform;
|
|
17
18
|
private values;
|
|
18
19
|
private dataResources;
|
|
19
20
|
private constraintData;
|
|
@@ -23,7 +24,8 @@ export declare class PivotTableConverter {
|
|
|
23
24
|
private columnsTransformationArray;
|
|
24
25
|
private valueTypeInfo;
|
|
25
26
|
private nonStickyRowIndex;
|
|
26
|
-
|
|
27
|
+
private nonStickyColumnIndex;
|
|
28
|
+
createTables(pivotData: LmrPivotData, transform: LmrPivotTransform): LmrPivotTable[];
|
|
27
29
|
private dataAreEmpty;
|
|
28
30
|
private updateData;
|
|
29
31
|
private get rowShowSums();
|
|
@@ -31,6 +33,10 @@ export declare class PivotTableConverter {
|
|
|
31
33
|
private transformData;
|
|
32
34
|
private fillCellsByRows;
|
|
33
35
|
private iterateAndFillCellsByRows;
|
|
36
|
+
private splitRowGroupHeader;
|
|
37
|
+
private formatSummaryHeader;
|
|
38
|
+
private formatRowHeader;
|
|
39
|
+
private formatColumnHeader;
|
|
34
40
|
private getHeaderBackground;
|
|
35
41
|
private getLevelOpacity;
|
|
36
42
|
private isRowLevelSticky;
|
|
@@ -43,11 +49,15 @@ export declare class PivotTableConverter {
|
|
|
43
49
|
private formatValueByPercentage;
|
|
44
50
|
private formatValueByConstraint;
|
|
45
51
|
private fillCellsForGroupedRow;
|
|
52
|
+
private fillCellsForExpressionRow;
|
|
53
|
+
private evaluateExpression;
|
|
54
|
+
private evaluateOperand;
|
|
46
55
|
private getGroupedValuesForRowsAndCols;
|
|
47
56
|
private fillCellsByColumns;
|
|
48
57
|
private iterateAndFillCellsByColumns;
|
|
49
58
|
private fillCellsForGroupedColumn;
|
|
50
59
|
private aggregateAndFormatDataValues;
|
|
60
|
+
private aggregateDataValues;
|
|
51
61
|
private aggregationByColumns;
|
|
52
62
|
private fillCellsForColumn;
|
|
53
63
|
private aggregateOrFormatSingleValue;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumeer/pivot",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
+
"@angular/cdk": "^16.2.12",
|
|
5
6
|
"@angular/common": "^16.2.12",
|
|
6
7
|
"@angular/core": "^16.2.12",
|
|
7
|
-
"@lumeer/data-filters": "^0.8.
|
|
8
|
+
"@lumeer/data-filters": "^0.8.6",
|
|
8
9
|
"@lumeer/utils": "^0.1.3"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
package/public-api.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './lib/lmr-pivot-table.component';
|
|
2
|
+
export * from './lib/lmr-simple-pivot-table.component';
|
|
2
3
|
export * from './lib/lmr-pivot-table.module';
|
|
3
4
|
export * from './lib/util/lmr-pivot-config';
|
|
5
|
+
export * from './lib/util/lmr-simple-pivot-config';
|
|
4
6
|
export * from './lib/util/lmr-pivot-data';
|
|
5
7
|
export * from './lib/util/lmr-pivot-table';
|
|
6
8
|
export * from './lib/util/pivot-util';
|
package/lumeer-pivot-0.0.3.tgz
DELETED
|
Binary file
|