@dcupl/common 1.0.2 → 1.1.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/dist/lib-cjs/getAggregation.d.ts +3 -0
- package/dist/lib-cjs/getAggregation.js +234 -0
- package/dist/lib-cjs/getAggregation.js.map +1 -0
- package/dist/lib-cjs/index.d.ts +7 -4
- package/dist/lib-cjs/index.js +7 -4
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/indices.controller.d.ts +13 -0
- package/dist/lib-cjs/indices.controller.js +160 -0
- package/dist/lib-cjs/indices.controller.js.map +1 -0
- package/dist/lib-cjs/pivot.d.ts +25 -0
- package/dist/lib-cjs/pivot.js +257 -0
- package/dist/lib-cjs/pivot.js.map +1 -0
- package/dist/lib-cjs/types/aggregation.types.d.ts +2 -1
- package/dist/lib-esm/getAggregation.d.ts +3 -0
- package/dist/lib-esm/getAggregation.js +229 -0
- package/dist/lib-esm/getAggregation.js.map +1 -0
- package/dist/lib-esm/index.d.ts +7 -4
- package/dist/lib-esm/index.js +7 -4
- package/dist/lib-esm/index.js.map +1 -1
- package/dist/lib-esm/indices.controller.d.ts +13 -0
- package/dist/lib-esm/indices.controller.js +154 -0
- package/dist/lib-esm/indices.controller.js.map +1 -0
- package/dist/lib-esm/pivot.d.ts +25 -0
- package/dist/lib-esm/pivot.js +253 -0
- package/dist/lib-esm/pivot.js.map +1 -0
- package/dist/lib-esm/types/aggregation.types.d.ts +2 -1
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
import objectHash from 'object-hash';
|
|
13
|
+
var IndicesController = /** @class */ (function () {
|
|
14
|
+
function IndicesController() {
|
|
15
|
+
this.indexMap = new Map();
|
|
16
|
+
// Possible performance gain*
|
|
17
|
+
this.dataMap = new Map();
|
|
18
|
+
}
|
|
19
|
+
IndicesController.prototype.reset = function (attributeKey) {
|
|
20
|
+
if (attributeKey) {
|
|
21
|
+
this.indexMap.delete(attributeKey);
|
|
22
|
+
this.dataMap.delete(attributeKey);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.indexMap.clear();
|
|
26
|
+
this.dataMap.clear();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
IndicesController.prototype.fillDataMap = function (attributeKey, attributeValue) {
|
|
30
|
+
var e_1, _a, e_2, _b;
|
|
31
|
+
var _c;
|
|
32
|
+
var valueMap = this.dataMap.get(attributeKey);
|
|
33
|
+
if (!valueMap) {
|
|
34
|
+
valueMap = new Map();
|
|
35
|
+
this.dataMap.set(attributeKey, valueMap);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
for (var attributeValue_1 = __values(attributeValue), attributeValue_1_1 = attributeValue_1.next(); !attributeValue_1_1.done; attributeValue_1_1 = attributeValue_1.next()) {
|
|
39
|
+
var value = attributeValue_1_1.value;
|
|
40
|
+
var keyAsString = void 0;
|
|
41
|
+
if (typeof value === 'object' && value && value.key) {
|
|
42
|
+
keyAsString = value.key;
|
|
43
|
+
}
|
|
44
|
+
else if (Array.isArray(value)) {
|
|
45
|
+
try {
|
|
46
|
+
for (var value_1 = (e_2 = void 0, __values(value)), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
|
|
47
|
+
var item = value_1_1.value;
|
|
48
|
+
this.fillDataMap(attributeKey, [item]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
52
|
+
finally {
|
|
53
|
+
try {
|
|
54
|
+
if (value_1_1 && !value_1_1.done && (_b = value_1.return)) _b.call(value_1);
|
|
55
|
+
}
|
|
56
|
+
finally { if (e_2) throw e_2.error; }
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
keyAsString = value;
|
|
62
|
+
}
|
|
63
|
+
var listItem = valueMap.get(keyAsString);
|
|
64
|
+
if (!listItem) {
|
|
65
|
+
listItem = { key: keyAsString };
|
|
66
|
+
(_c = this.dataMap.get(attributeKey)) === null || _c === void 0 ? void 0 : _c.set(keyAsString, listItem);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
71
|
+
finally {
|
|
72
|
+
try {
|
|
73
|
+
if (attributeValue_1_1 && !attributeValue_1_1.done && (_a = attributeValue_1.return)) _a.call(attributeValue_1);
|
|
74
|
+
}
|
|
75
|
+
finally { if (e_1) throw e_1.error; }
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
IndicesController.prototype.fillInverseIndex = function (attributeKey, originKey, foreignKeys) {
|
|
79
|
+
var e_3, _a, e_4, _b;
|
|
80
|
+
if (!attributeKey || !originKey || !foreignKeys || !Array.isArray(foreignKeys)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var valueMap = this.indexMap.get(attributeKey) || new Map();
|
|
84
|
+
try {
|
|
85
|
+
for (var foreignKeys_1 = __values(foreignKeys), foreignKeys_1_1 = foreignKeys_1.next(); !foreignKeys_1_1.done; foreignKeys_1_1 = foreignKeys_1.next()) {
|
|
86
|
+
var value = foreignKeys_1_1.value;
|
|
87
|
+
var keyAsString = void 0;
|
|
88
|
+
if (typeof value === 'object' && value && value.key) {
|
|
89
|
+
keyAsString = value.key;
|
|
90
|
+
}
|
|
91
|
+
else if (Array.isArray(value)) {
|
|
92
|
+
try {
|
|
93
|
+
// keyAsString = JSON.stringify(value);
|
|
94
|
+
for (var value_2 = (e_4 = void 0, __values(value)), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
|
|
95
|
+
var item = value_2_1.value;
|
|
96
|
+
this.fillInverseIndex(attributeKey, originKey, [item]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
100
|
+
finally {
|
|
101
|
+
try {
|
|
102
|
+
if (value_2_1 && !value_2_1.done && (_b = value_2.return)) _b.call(value_2);
|
|
103
|
+
}
|
|
104
|
+
finally { if (e_4) throw e_4.error; }
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
keyAsString = value;
|
|
110
|
+
}
|
|
111
|
+
var valueArray = valueMap.get(keyAsString) || [];
|
|
112
|
+
valueArray.push(originKey);
|
|
113
|
+
valueMap.set(keyAsString, valueArray);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
117
|
+
finally {
|
|
118
|
+
try {
|
|
119
|
+
if (foreignKeys_1_1 && !foreignKeys_1_1.done && (_a = foreignKeys_1.return)) _a.call(foreignKeys_1);
|
|
120
|
+
}
|
|
121
|
+
finally { if (e_3) throw e_3.error; }
|
|
122
|
+
}
|
|
123
|
+
this.indexMap.set(attributeKey, valueMap);
|
|
124
|
+
};
|
|
125
|
+
IndicesController.prototype.getIndex = function (attributeKey, context) {
|
|
126
|
+
var indexName = this.getIndexName(attributeKey, context);
|
|
127
|
+
return this.indexMap.get(indexName);
|
|
128
|
+
};
|
|
129
|
+
IndicesController.prototype.getData = function (attributeKey, context) {
|
|
130
|
+
var indexName = this.getIndexName(attributeKey, context);
|
|
131
|
+
return this.dataMap.get(indexName);
|
|
132
|
+
};
|
|
133
|
+
IndicesController.prototype.getOrCreateIndex = function (attributeKey, relevantData, context) {
|
|
134
|
+
var _this = this;
|
|
135
|
+
var indexName = this.getIndexName(attributeKey, context);
|
|
136
|
+
var index = this.getIndex(indexName);
|
|
137
|
+
if (!index) {
|
|
138
|
+
this.reset(indexName);
|
|
139
|
+
relevantData.forEach(function (entry) {
|
|
140
|
+
var attributeValue = entry[attributeKey];
|
|
141
|
+
_this.fillInverseIndex(indexName, entry.key, [attributeValue]);
|
|
142
|
+
_this.fillDataMap(indexName, [attributeValue]);
|
|
143
|
+
});
|
|
144
|
+
index = this.getIndex(indexName);
|
|
145
|
+
}
|
|
146
|
+
return index;
|
|
147
|
+
};
|
|
148
|
+
IndicesController.prototype.getIndexName = function (attributeKey, context) {
|
|
149
|
+
return context ? attributeKey + '_' + objectHash(context) : attributeKey;
|
|
150
|
+
};
|
|
151
|
+
return IndicesController;
|
|
152
|
+
}());
|
|
153
|
+
export { IndicesController };
|
|
154
|
+
//# sourceMappingURL=indices.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indices.controller.js","sourceRoot":"","sources":["../../src/indices.controller.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AASrC;IAKE;QAJQ,aAAQ,GAA6B,IAAI,GAAG,EAAE,CAAC;QACvD,6BAA6B;QACrB,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IAElC,CAAC;IAET,iCAAK,GAAZ,UAAa,YAAqB;QAChC,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SACtB;IACH,CAAC;IAEM,uCA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|
2
|
+
type PivotRowOption = {
|
|
3
|
+
attribute: string;
|
|
4
|
+
};
|
|
5
|
+
type PivotColumnOption = {
|
|
6
|
+
attribute: string;
|
|
7
|
+
};
|
|
8
|
+
type PivotValueOption = AggregationOptions;
|
|
9
|
+
export type PivotOptions = {
|
|
10
|
+
rows: PivotRowOption[];
|
|
11
|
+
columns: PivotColumnOption[];
|
|
12
|
+
values: PivotValueOption[];
|
|
13
|
+
options?: {
|
|
14
|
+
includePaths?: boolean;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type PivotResponseItem = {
|
|
18
|
+
key: string;
|
|
19
|
+
values?: Aggregation[];
|
|
20
|
+
columns?: Omit<PivotResponseItem, 'rows'>[];
|
|
21
|
+
rows?: PivotResponseItem[];
|
|
22
|
+
};
|
|
23
|
+
export type PivotResponse = PivotResponseItem;
|
|
24
|
+
export declare function pivot<ListType extends ListItem = ListItem>(relevantData: Map<string, ListType>, options: PivotOptions, response?: PivotResponse, paths?: any, parentPath?: string): PivotResponse;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __values = (this && this.__values) || function(o) {
|
|
13
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
14
|
+
if (m) return m.call(o);
|
|
15
|
+
if (o && typeof o.length === "number") return {
|
|
16
|
+
next: function () {
|
|
17
|
+
if (o && i >= o.length) o = void 0;
|
|
18
|
+
return { value: o && o[i++], done: !o };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
22
|
+
};
|
|
23
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
import { getAggregation } from './getAggregation';
|
|
40
|
+
import { IndicesController } from './indices.controller';
|
|
41
|
+
var pivotPathSeparator = '__';
|
|
42
|
+
export function pivot(relevantData, options, response, paths, parentPath) {
|
|
43
|
+
var e_1, _a;
|
|
44
|
+
var _b;
|
|
45
|
+
if (response === void 0) { response = { key: 'root' }; }
|
|
46
|
+
if (paths === void 0) { paths = {}; }
|
|
47
|
+
if (parentPath === void 0) { parentPath = 'root'; }
|
|
48
|
+
var indicesCtrl = new IndicesController();
|
|
49
|
+
options.columns.forEach(function (column) {
|
|
50
|
+
if (column.attribute) {
|
|
51
|
+
indicesCtrl.getOrCreateIndex(column.attribute, relevantData);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
options.rows.forEach(function (row) {
|
|
55
|
+
if (row.attribute) {
|
|
56
|
+
indicesCtrl.getOrCreateIndex(row.attribute, relevantData);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
options.values.forEach(function (value) {
|
|
60
|
+
if (value.attribute) {
|
|
61
|
+
indicesCtrl.getOrCreateIndex(value.attribute, relevantData);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Rows
|
|
66
|
+
*/
|
|
67
|
+
if (options.rows && options.rows.length > 0) {
|
|
68
|
+
response.rows = response.rows || [];
|
|
69
|
+
var item = getPivotRowItem(relevantData, options.rows[0], options, indicesCtrl, paths, parentPath);
|
|
70
|
+
response.rows.push(item);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Columns
|
|
74
|
+
*/
|
|
75
|
+
if (options.columns && options.columns.length > 0) {
|
|
76
|
+
response.columns = response.columns || [];
|
|
77
|
+
var item = getPivotColumnItem(relevantData, options.columns[0], options, indicesCtrl, paths, parentPath);
|
|
78
|
+
response.columns.push(item);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Value Aggregations
|
|
82
|
+
*/
|
|
83
|
+
if (response.key === 'root') {
|
|
84
|
+
try {
|
|
85
|
+
for (var _c = __values(options.values), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
86
|
+
var value = _d.value;
|
|
87
|
+
response.values = response.values || [];
|
|
88
|
+
var agg = getAggregation(value, relevantData, indicesCtrl.getIndex(value.attribute), value.attribute);
|
|
89
|
+
paths[parentPath] = agg;
|
|
90
|
+
response.values.push(agg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
94
|
+
finally {
|
|
95
|
+
try {
|
|
96
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
97
|
+
}
|
|
98
|
+
finally { if (e_1) throw e_1.error; }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if ((_b = options.options) === null || _b === void 0 ? void 0 : _b.includePaths) {
|
|
102
|
+
Object.defineProperty(response, 'paths', { enumerable: false, value: paths });
|
|
103
|
+
}
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
106
|
+
function getPivotRowItem(modelData, options, globalOptions, modelIndexMap, paths, parentPath) {
|
|
107
|
+
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
108
|
+
if (paths === void 0) { paths = {}; }
|
|
109
|
+
if (parentPath === void 0) { parentPath = ''; }
|
|
110
|
+
var item = { key: options.attribute };
|
|
111
|
+
var indexMap = modelIndexMap.getIndex(options.attribute);
|
|
112
|
+
try {
|
|
113
|
+
for (var _e = __values(indexMap.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
114
|
+
var _g = __read(_f.value, 2), key = _g[0], itemKeys = _g[1];
|
|
115
|
+
var rowItem = {
|
|
116
|
+
key: key,
|
|
117
|
+
};
|
|
118
|
+
var relevantData = new Map();
|
|
119
|
+
try {
|
|
120
|
+
for (var itemKeys_1 = (e_3 = void 0, __values(itemKeys)), itemKeys_1_1 = itemKeys_1.next(); !itemKeys_1_1.done; itemKeys_1_1 = itemKeys_1.next()) {
|
|
121
|
+
var key_1 = itemKeys_1_1.value;
|
|
122
|
+
if (!modelData.has(key_1)) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
relevantData.set(key_1, modelData.get(key_1));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
129
|
+
finally {
|
|
130
|
+
try {
|
|
131
|
+
if (itemKeys_1_1 && !itemKeys_1_1.done && (_b = itemKeys_1.return)) _b.call(itemKeys_1);
|
|
132
|
+
}
|
|
133
|
+
finally { if (e_3) throw e_3.error; }
|
|
134
|
+
}
|
|
135
|
+
if (!relevantData.size)
|
|
136
|
+
continue;
|
|
137
|
+
try {
|
|
138
|
+
for (var _h = (e_4 = void 0, __values(globalOptions.values)), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
139
|
+
var value = _j.value;
|
|
140
|
+
rowItem.values = rowItem.values || [];
|
|
141
|
+
var agg = getAggregation(value, relevantData, modelIndexMap.getIndex(value.attribute), value.attribute);
|
|
142
|
+
paths[parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key] = agg;
|
|
143
|
+
rowItem.values.push(agg);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
147
|
+
finally {
|
|
148
|
+
try {
|
|
149
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
150
|
+
}
|
|
151
|
+
finally { if (e_4) throw e_4.error; }
|
|
152
|
+
}
|
|
153
|
+
item.rows = item.rows || [];
|
|
154
|
+
item.rows.push(rowItem);
|
|
155
|
+
if (globalOptions.rows.length > 1) {
|
|
156
|
+
var newOptions = __assign(__assign({}, globalOptions), { rows: globalOptions.rows.slice(1) });
|
|
157
|
+
pivot(relevantData, newOptions, rowItem, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
if (globalOptions.columns) {
|
|
161
|
+
try {
|
|
162
|
+
for (var _k = (e_5 = void 0, __values(globalOptions.columns)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
163
|
+
var columnOption = _l.value;
|
|
164
|
+
rowItem.columns = rowItem.columns || [];
|
|
165
|
+
var columnItem = getPivotColumnItem(relevantData, columnOption, globalOptions, modelIndexMap, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
|
|
166
|
+
rowItem.columns.push(columnItem);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
170
|
+
finally {
|
|
171
|
+
try {
|
|
172
|
+
if (_l && !_l.done && (_d = _k.return)) _d.call(_k);
|
|
173
|
+
}
|
|
174
|
+
finally { if (e_5) throw e_5.error; }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
181
|
+
finally {
|
|
182
|
+
try {
|
|
183
|
+
if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
|
|
184
|
+
}
|
|
185
|
+
finally { if (e_2) throw e_2.error; }
|
|
186
|
+
}
|
|
187
|
+
return item;
|
|
188
|
+
}
|
|
189
|
+
function getPivotColumnItem(modelData, options, globalOptions, modelIndexMap, paths, parentPath) {
|
|
190
|
+
var e_6, _a, e_7, _b, e_8, _c;
|
|
191
|
+
if (paths === void 0) { paths = {}; }
|
|
192
|
+
if (parentPath === void 0) { parentPath = ''; }
|
|
193
|
+
var item = { key: options.attribute };
|
|
194
|
+
var indexMap = modelIndexMap.getIndex(options.attribute);
|
|
195
|
+
try {
|
|
196
|
+
for (var _d = __values(indexMap.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
197
|
+
var _f = __read(_e.value, 2), key = _f[0], itemKeys = _f[1];
|
|
198
|
+
var rowItem = {
|
|
199
|
+
key: key,
|
|
200
|
+
};
|
|
201
|
+
var relevantData = new Map();
|
|
202
|
+
try {
|
|
203
|
+
for (var itemKeys_2 = (e_7 = void 0, __values(itemKeys)), itemKeys_2_1 = itemKeys_2.next(); !itemKeys_2_1.done; itemKeys_2_1 = itemKeys_2.next()) {
|
|
204
|
+
var key_2 = itemKeys_2_1.value;
|
|
205
|
+
if (!modelData.has(key_2)) {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
relevantData.set(key_2, modelData.get(key_2));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
212
|
+
finally {
|
|
213
|
+
try {
|
|
214
|
+
if (itemKeys_2_1 && !itemKeys_2_1.done && (_b = itemKeys_2.return)) _b.call(itemKeys_2);
|
|
215
|
+
}
|
|
216
|
+
finally { if (e_7) throw e_7.error; }
|
|
217
|
+
}
|
|
218
|
+
if (!relevantData.size)
|
|
219
|
+
continue;
|
|
220
|
+
try {
|
|
221
|
+
for (var _g = (e_8 = void 0, __values(globalOptions.values)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
222
|
+
var value = _h.value;
|
|
223
|
+
rowItem.values = rowItem.values || [];
|
|
224
|
+
var agg = getAggregation(value, relevantData, modelIndexMap.getIndex(value.attribute), value.attribute);
|
|
225
|
+
paths[parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key] = agg;
|
|
226
|
+
rowItem.values.push(agg);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
230
|
+
finally {
|
|
231
|
+
try {
|
|
232
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
233
|
+
}
|
|
234
|
+
finally { if (e_8) throw e_8.error; }
|
|
235
|
+
}
|
|
236
|
+
item.columns = item.columns || [];
|
|
237
|
+
item.columns.push(rowItem);
|
|
238
|
+
if (globalOptions.columns.length > 1) {
|
|
239
|
+
var newOptions = __assign(__assign({}, globalOptions), { columns: globalOptions.columns.slice(1) });
|
|
240
|
+
pivot(relevantData, newOptions, rowItem, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
245
|
+
finally {
|
|
246
|
+
try {
|
|
247
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
248
|
+
}
|
|
249
|
+
finally { if (e_6) throw e_6.error; }
|
|
250
|
+
}
|
|
251
|
+
return item;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=pivot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pivot.js","sourceRoot":"","sources":["../../src/pivot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AA+BzD,IAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,UAAU,KAAK,CACnB,YAAmC,EACnC,OAAqB,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AAI,CAAC,OAAO,CAAC,CAAC;YAE3B,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,IAAM,UAAU,yBAAQ,aAAa,KAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAE,CAAC;gBACjF,KAAK,CACH,YAAY,EACZ,UAAU,EACV,OAAO,EACP,KAAK,EACL,UAAU,GAAG,kBAAkB,GAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,GAAG,GAAG,CAC/E,CAAC;aACH;SACF;;;;;;;;;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -9,6 +9,7 @@ export type AggregationOptions = {
|
|
|
9
9
|
types: AggregationType[];
|
|
10
10
|
distinctOptions?: {
|
|
11
11
|
limit?: number;
|
|
12
|
+
skipKeys?: boolean;
|
|
12
13
|
};
|
|
13
14
|
groupOptions?: {
|
|
14
15
|
limit?: number;
|
|
@@ -27,7 +28,7 @@ export type AggregationGroupOption = {
|
|
|
27
28
|
export type AggregationDistinctValue = {
|
|
28
29
|
value: string;
|
|
29
30
|
count: number;
|
|
30
|
-
keys
|
|
31
|
+
keys?: string[];
|
|
31
32
|
};
|
|
32
33
|
export type AggregationGroupValue = {
|
|
33
34
|
option: AggregationGroupOption;
|